mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-14 03:19:28 +02:00
Removed most uses of allRewards
from across the code
This commit is contained in:
parent
f5d08567c9
commit
3f3bbf7d85
@ -49,4 +49,5 @@ export type SilentReward =
|
|||||||
| TrainerItemId
|
| TrainerItemId
|
||||||
| typeof RewardId.VOUCHER
|
| typeof RewardId.VOUCHER
|
||||||
| typeof RewardId.VOUCHER_PLUS
|
| typeof RewardId.VOUCHER_PLUS
|
||||||
| typeof RewardId.VOUCHER_PREMIUM;
|
| typeof RewardId.VOUCHER_PREMIUM
|
||||||
|
| typeof RewardId.ROGUE_BALL;
|
||||||
|
@ -150,7 +150,7 @@ export const ATrainersTestEncounter: MysteryEncounter = MysteryEncounterBuilder.
|
|||||||
},
|
},
|
||||||
async () => {
|
async () => {
|
||||||
const encounter = globalScene.currentBattle.mysteryEncounter!;
|
const encounter = globalScene.currentBattle.mysteryEncounter!;
|
||||||
// Battle the stat trainer for an Egg and great allRewards
|
// Battle the stat trainer for an Egg and great rewards
|
||||||
const config: EnemyPartyConfig = encounter.enemyPartyConfigs[0];
|
const config: EnemyPartyConfig = encounter.enemyPartyConfigs[0];
|
||||||
|
|
||||||
await transitionMysteryEncounterIntroVisuals();
|
await transitionMysteryEncounterIntroVisuals();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
|
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
|
||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
import { speciesStarterCosts } from "#balance/starters";
|
import { speciesStarterCosts } from "#balance/starters";
|
||||||
import { allRewards, allTrainerItems } from "#data/data-lists";
|
import { allTrainerItems } from "#data/data-lists";
|
||||||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||||
@ -136,7 +136,7 @@ export const AnOfferYouCantRefuseEncounter: MysteryEncounter = MysteryEncounterB
|
|||||||
})
|
})
|
||||||
.withOptionPhase(async () => {
|
.withOptionPhase(async () => {
|
||||||
// Give the player a Shiny Charm
|
// Give the player a Shiny Charm
|
||||||
globalScene.phaseManager.unshiftNew("RewardPhase", allRewards.SHINY_CHARM);
|
globalScene.phaseManager.unshiftNew("RewardPhase", TrainerItemId.SHINY_CHARM);
|
||||||
leaveEncounterWithoutBattle(true);
|
leaveEncounterWithoutBattle(true);
|
||||||
})
|
})
|
||||||
.build(),
|
.build(),
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
|
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
|
||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
import { allRewards } from "#data/data-lists";
|
|
||||||
import { Challenges } from "#enums/challenges";
|
import { Challenges } from "#enums/challenges";
|
||||||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||||
import type { PokemonType } from "#enums/pokemon-type";
|
import type { PokemonType } from "#enums/pokemon-type";
|
||||||
|
import { RewardId } from "#enums/reward-id";
|
||||||
import { SpeciesId } from "#enums/species-id";
|
import { SpeciesId } from "#enums/species-id";
|
||||||
import type { HeldItemConfiguration } from "#items/held-item-data-types";
|
import type { HeldItemConfiguration } from "#items/held-item-data-types";
|
||||||
import type { EnemyPartyConfig, EnemyPokemonConfig } from "#mystery-encounters/encounter-phase-utils";
|
import type { EnemyPartyConfig, EnemyPokemonConfig } from "#mystery-encounters/encounter-phase-utils";
|
||||||
@ -160,7 +160,7 @@ export const DarkDealEncounter: MysteryEncounter = MysteryEncounterBuilder.withE
|
|||||||
.withOptionPhase(async () => {
|
.withOptionPhase(async () => {
|
||||||
// Give the player 5 Rogue Balls
|
// Give the player 5 Rogue Balls
|
||||||
const encounter = globalScene.currentBattle.mysteryEncounter!;
|
const encounter = globalScene.currentBattle.mysteryEncounter!;
|
||||||
globalScene.phaseManager.unshiftNew("RewardPhase", allRewards.ROGUE_BALL);
|
globalScene.phaseManager.unshiftNew("RewardPhase", RewardId.ROGUE_BALL);
|
||||||
|
|
||||||
// Start encounter with random legendary (7-10 starter strength) that has level additive
|
// Start encounter with random legendary (7-10 starter strength) that has level additive
|
||||||
// If this is a mono-type challenge, always ensure the required type is filtered for
|
// If this is a mono-type challenge, always ensure the required type is filtered for
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
|
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
|
||||||
import { timedEventManager } from "#app/global-event-manager";
|
import { timedEventManager } from "#app/global-event-manager";
|
||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
import { allHeldItems, allRewards } from "#data/data-lists";
|
import { allHeldItems } from "#data/data-lists";
|
||||||
import { HeldItemCategoryId, HeldItemId, isItemInCategory } from "#enums/held-item-id";
|
import { HeldItemCategoryId, HeldItemId, isItemInCategory } from "#enums/held-item-id";
|
||||||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||||
|
import { RewardId } from "#enums/reward-id";
|
||||||
import { SpeciesId } from "#enums/species-id";
|
import { SpeciesId } from "#enums/species-id";
|
||||||
import { TrainerItemId } from "#enums/trainer-item-id";
|
import { TrainerItemId } from "#enums/trainer-item-id";
|
||||||
import type { PlayerPokemon, Pokemon } from "#field/pokemon";
|
import type { PlayerPokemon, Pokemon } from "#field/pokemon";
|
||||||
@ -61,10 +62,10 @@ const doEventReward = () => {
|
|||||||
return !fullStack;
|
return !fullStack;
|
||||||
});
|
});
|
||||||
if (candidates.length > 0) {
|
if (candidates.length > 0) {
|
||||||
globalScene.phaseManager.unshiftNew("RewardPhase", allRewards[randSeedItem(candidates)]);
|
globalScene.phaseManager.unshiftNew("RewardPhase", randSeedItem(candidates));
|
||||||
} else {
|
} else {
|
||||||
// At max stacks, give a Voucher instead
|
// At max stacks, give a Voucher instead
|
||||||
globalScene.phaseManager.unshiftNew("RewardPhase", allRewards.VOUCHER);
|
globalScene.phaseManager.unshiftNew("RewardPhase", RewardId.VOUCHER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -168,7 +169,7 @@ export const DelibirdyEncounter: MysteryEncounter = MysteryEncounterBuilder.with
|
|||||||
// At max stacks, give the first party pokemon a Shell Bell instead
|
// At max stacks, give the first party pokemon a Shell Bell instead
|
||||||
backupOption();
|
backupOption();
|
||||||
} else {
|
} else {
|
||||||
globalScene.phaseManager.unshiftNew("RewardPhase", allRewards.AMULET_COIN);
|
globalScene.phaseManager.unshiftNew("RewardPhase", TrainerItemId.AMULET_COIN);
|
||||||
doEventReward();
|
doEventReward();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,7 +239,7 @@ export const DelibirdyEncounter: MysteryEncounter = MysteryEncounterBuilder.with
|
|||||||
// At max stacks, give the first party pokemon a Shell Bell instead
|
// At max stacks, give the first party pokemon a Shell Bell instead
|
||||||
backupOption();
|
backupOption();
|
||||||
} else {
|
} else {
|
||||||
globalScene.phaseManager.unshiftNew("RewardPhase", allRewards.CANDY_JAR);
|
globalScene.phaseManager.unshiftNew("RewardPhase", TrainerItemId.CANDY_JAR);
|
||||||
doEventReward();
|
doEventReward();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -249,7 +250,7 @@ export const DelibirdyEncounter: MysteryEncounter = MysteryEncounterBuilder.with
|
|||||||
// At max stacks, give the first party pokemon a Shell Bell instead
|
// At max stacks, give the first party pokemon a Shell Bell instead
|
||||||
backupOption();
|
backupOption();
|
||||||
} else {
|
} else {
|
||||||
globalScene.phaseManager.unshiftNew("RewardPhase", allRewards.BERRY_POUCH);
|
globalScene.phaseManager.unshiftNew("RewardPhase", TrainerItemId.BERRY_POUCH);
|
||||||
doEventReward();
|
doEventReward();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -321,7 +322,7 @@ export const DelibirdyEncounter: MysteryEncounter = MysteryEncounterBuilder.with
|
|||||||
// At max stacks, give the first party pokemon a Shell Bell instead
|
// At max stacks, give the first party pokemon a Shell Bell instead
|
||||||
backupOption();
|
backupOption();
|
||||||
} else {
|
} else {
|
||||||
globalScene.phaseManager.unshiftNew("RewardPhase", allRewards.HEALING_CHARM);
|
globalScene.phaseManager.unshiftNew("RewardPhase", TrainerItemId.HEALING_CHARM);
|
||||||
doEventReward();
|
doEventReward();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,8 +4,11 @@ import { MoveCategory } from "#enums/move-category";
|
|||||||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||||
|
import { RewardId } from "#enums/reward-id";
|
||||||
import { Stat } from "#enums/stat";
|
import { Stat } from "#enums/stat";
|
||||||
|
import { TrainerItemId } from "#enums/trainer-item-id";
|
||||||
import type { PlayerPokemon } from "#field/pokemon";
|
import type { PlayerPokemon } from "#field/pokemon";
|
||||||
|
import { generateRewardOptionFromId } from "#items/reward-utils";
|
||||||
import type { PokemonMove } from "#moves/pokemon-move";
|
import type { PokemonMove } from "#moves/pokemon-move";
|
||||||
import {
|
import {
|
||||||
leaveEncounterWithoutBattle,
|
leaveEncounterWithoutBattle,
|
||||||
@ -93,16 +96,16 @@ export const FieldTripEncounter: MysteryEncounter = MysteryEncounterBuilder.with
|
|||||||
.withOptionPhase(async () => {
|
.withOptionPhase(async () => {
|
||||||
const encounter = globalScene.currentBattle.mysteryEncounter!;
|
const encounter = globalScene.currentBattle.mysteryEncounter!;
|
||||||
if (encounter.misc.correctMove) {
|
if (encounter.misc.correctMove) {
|
||||||
const modifiers = [
|
const rewards = [
|
||||||
generateRewardOptionFromId(RewardId.TEMP_STAT_STAGE_BOOSTER, [Stat.ATK])!,
|
generateRewardOptionFromId({ id: RewardId.TEMP_STAT_STAGE_BOOSTER, args: Stat.ATK })!,
|
||||||
generateRewardOptionFromId(RewardId.TEMP_STAT_STAGE_BOOSTER, [Stat.DEF])!,
|
generateRewardOptionFromId({ id: RewardId.TEMP_STAT_STAGE_BOOSTER, args: Stat.DEF })!,
|
||||||
generateRewardOptionFromId(RewardId.TEMP_STAT_STAGE_BOOSTER, [Stat.SPD])!,
|
generateRewardOptionFromId({ id: RewardId.TEMP_STAT_STAGE_BOOSTER, args: Stat.SPD })!,
|
||||||
generateRewardOptionFromId(RewardId.DIRE_HIT)!,
|
generateRewardOptionFromId(RewardId.DIRE_HIT)!,
|
||||||
generateRewardOptionFromId(RewardId.RARER_CANDY)!,
|
generateRewardOptionFromId(RewardId.RARER_CANDY)!,
|
||||||
];
|
];
|
||||||
|
|
||||||
setEncounterRewards({
|
setEncounterRewards({
|
||||||
guaranteedRewardOptions: modifiers,
|
guaranteedRewardOptions: rewards,
|
||||||
fillRemaining: false,
|
fillRemaining: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -141,16 +144,16 @@ export const FieldTripEncounter: MysteryEncounter = MysteryEncounterBuilder.with
|
|||||||
.withOptionPhase(async () => {
|
.withOptionPhase(async () => {
|
||||||
const encounter = globalScene.currentBattle.mysteryEncounter!;
|
const encounter = globalScene.currentBattle.mysteryEncounter!;
|
||||||
if (encounter.misc.correctMove) {
|
if (encounter.misc.correctMove) {
|
||||||
const modifiers = [
|
const rewards = [
|
||||||
generateRewardOptionFromId(RewardId.TEMP_STAT_STAGE_BOOSTER, [Stat.SPATK])!,
|
generateRewardOptionFromId({ id: RewardId.TEMP_STAT_STAGE_BOOSTER, args: Stat.SPATK })!,
|
||||||
generateRewardOptionFromId(RewardId.TEMP_STAT_STAGE_BOOSTER, [Stat.SPDEF])!,
|
generateRewardOptionFromId({ id: RewardId.TEMP_STAT_STAGE_BOOSTER, args: Stat.SPDEF })!,
|
||||||
generateRewardOptionFromId(RewardId.TEMP_STAT_STAGE_BOOSTER, [Stat.SPD])!,
|
generateRewardOptionFromId({ id: RewardId.TEMP_STAT_STAGE_BOOSTER, args: Stat.SPD })!,
|
||||||
generateRewardOptionFromId(RewardId.DIRE_HIT)!,
|
generateRewardOptionFromId(RewardId.DIRE_HIT)!,
|
||||||
generateRewardOptionFromId(RewardId.RARER_CANDY)!,
|
generateRewardOptionFromId(RewardId.RARER_CANDY)!,
|
||||||
];
|
];
|
||||||
|
|
||||||
setEncounterRewards({
|
setEncounterRewards({
|
||||||
guaranteedRewardOptions: modifiers,
|
guaranteedRewardOptions: rewards,
|
||||||
fillRemaining: false,
|
fillRemaining: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -189,16 +192,16 @@ export const FieldTripEncounter: MysteryEncounter = MysteryEncounterBuilder.with
|
|||||||
.withOptionPhase(async () => {
|
.withOptionPhase(async () => {
|
||||||
const encounter = globalScene.currentBattle.mysteryEncounter!;
|
const encounter = globalScene.currentBattle.mysteryEncounter!;
|
||||||
if (encounter.misc.correctMove) {
|
if (encounter.misc.correctMove) {
|
||||||
const modifiers = [
|
const rewards = [
|
||||||
generateRewardOptionFromId(RewardId.TEMP_STAT_STAGE_BOOSTER, [Stat.ACC])!,
|
generateRewardOptionFromId({ id: RewardId.TEMP_STAT_STAGE_BOOSTER, args: Stat.ACC })!,
|
||||||
generateRewardOptionFromId(RewardId.TEMP_STAT_STAGE_BOOSTER, [Stat.SPD])!,
|
generateRewardOptionFromId({ id: RewardId.TEMP_STAT_STAGE_BOOSTER, args: Stat.SPD })!,
|
||||||
generateRewardOptionFromId(RewardId.GREAT_BALL)!,
|
generateRewardOptionFromId(RewardId.GREAT_BALL)!,
|
||||||
generateRewardOptionFromId(RewardId.IV_SCANNER)!,
|
generateRewardOptionFromId(TrainerItemId.IV_SCANNER)!,
|
||||||
generateRewardOptionFromId(RewardId.RARER_CANDY)!,
|
generateRewardOptionFromId(RewardId.RARER_CANDY)!,
|
||||||
];
|
];
|
||||||
|
|
||||||
setEncounterRewards({
|
setEncounterRewards({
|
||||||
guaranteedRewardOptions: modifiers,
|
guaranteedRewardOptions: rewards,
|
||||||
fillRemaining: false,
|
fillRemaining: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -250,7 +250,6 @@ export const FieryFalloutEncounter: MysteryEncounter = MysteryEncounterBuilder.w
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// No allRewards
|
|
||||||
leaveEncounterWithoutBattle(true);
|
leaveEncounterWithoutBattle(true);
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -99,7 +99,7 @@ export const FightOrFlightEncounter: MysteryEncounter = MysteryEncounterBuilder.
|
|||||||
: RarityTier.GREAT;
|
: RarityTier.GREAT;
|
||||||
generateRewardPoolWeights(getRewardPoolForType(RewardPoolType.PLAYER), globalScene.getPlayerParty(), 0);
|
generateRewardPoolWeights(getRewardPoolForType(RewardPoolType.PLAYER), globalScene.getPlayerParty(), 0);
|
||||||
let item: RewardOption | null = null;
|
let item: RewardOption | null = null;
|
||||||
// TMs and Candy Jar excluded from possible allRewards as they're too swingy in value for a singular item reward
|
// TMs and Candy Jar excluded from possible rewards as they're too swingy in value for a singular item reward
|
||||||
while (!item || isTmReward(item.type) || (item.type as TrainerItemReward).itemId === TrainerItemId.CANDY_JAR) {
|
while (!item || isTmReward(item.type) || (item.type as TrainerItemReward).itemId === TrainerItemId.CANDY_JAR) {
|
||||||
item = generatePlayerRewardOptions(1, globalScene.getPlayerParty(), [], {
|
item = generatePlayerRewardOptions(1, globalScene.getPlayerParty(), [], {
|
||||||
guaranteedRarityTiers: [tier],
|
guaranteedRarityTiers: [tier],
|
||||||
|
@ -426,7 +426,7 @@ export const GlobalTradeSystemEncounter: MysteryEncounter = MysteryEncounterBuil
|
|||||||
|
|
||||||
generateRewardPoolWeights(getRewardPoolForType(RewardPoolType.PLAYER), party, 0);
|
generateRewardPoolWeights(getRewardPoolForType(RewardPoolType.PLAYER), party, 0);
|
||||||
let item: RewardOption | null = null;
|
let item: RewardOption | null = null;
|
||||||
// TMs excluded from possible allRewards
|
// TMs excluded from possible rewards
|
||||||
while (!item || isTmReward(item.type)) {
|
while (!item || isTmReward(item.type)) {
|
||||||
item = generatePlayerRewardOptions(1, party, [], {
|
item = generatePlayerRewardOptions(1, party, [], {
|
||||||
guaranteedRarityTiers: [tier],
|
guaranteedRarityTiers: [tier],
|
||||||
|
@ -304,7 +304,7 @@ export const TheExpertPokemonBreederEncounter: MysteryEncounter = MysteryEncount
|
|||||||
// Remove all Pokemon from the party except the chosen Pokemon
|
// Remove all Pokemon from the party except the chosen Pokemon
|
||||||
removePokemonFromPartyAndStoreHeldItems(encounter, pokemon1);
|
removePokemonFromPartyAndStoreHeldItems(encounter, pokemon1);
|
||||||
|
|
||||||
// Configure outro dialogue for egg allRewards
|
// Configure outro dialogue for egg rewards
|
||||||
encounter.dialogue.outro = [
|
encounter.dialogue.outro = [
|
||||||
{
|
{
|
||||||
speaker: trainerNameKey,
|
speaker: trainerNameKey,
|
||||||
@ -363,7 +363,7 @@ export const TheExpertPokemonBreederEncounter: MysteryEncounter = MysteryEncount
|
|||||||
// Remove all Pokemon from the party except the chosen Pokemon
|
// Remove all Pokemon from the party except the chosen Pokemon
|
||||||
removePokemonFromPartyAndStoreHeldItems(encounter, pokemon2);
|
removePokemonFromPartyAndStoreHeldItems(encounter, pokemon2);
|
||||||
|
|
||||||
// Configure outro dialogue for egg allRewards
|
// Configure outro dialogue for egg rewards
|
||||||
encounter.dialogue.outro = [
|
encounter.dialogue.outro = [
|
||||||
{
|
{
|
||||||
speaker: trainerNameKey,
|
speaker: trainerNameKey,
|
||||||
@ -422,7 +422,7 @@ export const TheExpertPokemonBreederEncounter: MysteryEncounter = MysteryEncount
|
|||||||
// Remove all Pokemon from the party except the chosen Pokemon
|
// Remove all Pokemon from the party except the chosen Pokemon
|
||||||
removePokemonFromPartyAndStoreHeldItems(encounter, pokemon3);
|
removePokemonFromPartyAndStoreHeldItems(encounter, pokemon3);
|
||||||
|
|
||||||
// Configure outro dialogue for egg allRewards
|
// Configure outro dialogue for egg rewards
|
||||||
encounter.dialogue.outro = [
|
encounter.dialogue.outro = [
|
||||||
{
|
{
|
||||||
speaker: trainerNameKey,
|
speaker: trainerNameKey,
|
||||||
@ -640,7 +640,7 @@ function onGameOver() {
|
|||||||
const chosenPokemon = encounter.misc.chosenPokemon;
|
const chosenPokemon = encounter.misc.chosenPokemon;
|
||||||
chosenPokemon.friendship = 0;
|
chosenPokemon.friendship = 0;
|
||||||
|
|
||||||
// Clear all allRewards that would have been earned
|
// Clear all rewards that would have been earned
|
||||||
encounter.doEncounterRewards = undefined;
|
encounter.doEncounterRewards = undefined;
|
||||||
|
|
||||||
// Set flag that encounter was failed
|
// Set flag that encounter was failed
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { applyAbAttrs } from "#abilities/apply-ab-attrs";
|
import { applyAbAttrs } from "#abilities/apply-ab-attrs";
|
||||||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
|
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
|
||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
import { allRewards } from "#data/data-lists";
|
|
||||||
import { SpeciesFormChangeAbilityTrigger } from "#data/form-change-triggers";
|
import { SpeciesFormChangeAbilityTrigger } from "#data/form-change-triggers";
|
||||||
import { AbilityId } from "#enums/ability-id";
|
import { AbilityId } from "#enums/ability-id";
|
||||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||||
@ -119,7 +118,7 @@ export const TheWinstrateChallengeEncounter: MysteryEncounter = MysteryEncounter
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
async () => {
|
async () => {
|
||||||
// Spawn 5 trainer battles back to back with Macho Brace in allRewards
|
// Spawn 5 trainer battles back to back with Macho Brace in rewards
|
||||||
globalScene.currentBattle.mysteryEncounter!.doContinueEncounter = async () => {
|
globalScene.currentBattle.mysteryEncounter!.doContinueEncounter = async () => {
|
||||||
await endTrainerBattleAndShowDialogue();
|
await endTrainerBattleAndShowDialogue();
|
||||||
};
|
};
|
||||||
@ -158,13 +157,13 @@ async function spawnNextTrainerOrEndEncounter() {
|
|||||||
await showEncounterDialogue(`${namespace}:victory`, `${namespace}:speaker`);
|
await showEncounterDialogue(`${namespace}:victory`, `${namespace}:speaker`);
|
||||||
|
|
||||||
// Give 10x Voucher
|
// Give 10x Voucher
|
||||||
const reward = allRewards[RewardId.VOUCHER_PREMIUM]();
|
const reward = generateRewardOptionFromId(RewardId.VOUCHER_PREMIUM).type;
|
||||||
globalScene.applyReward(reward as Reward, {});
|
globalScene.applyReward(reward as Reward, {});
|
||||||
globalScene.playSound("item_fanfare");
|
globalScene.playSound("item_fanfare");
|
||||||
await showEncounterText(i18next.t("battle:rewardGain", { modifierName: (reward as Reward).name }));
|
await showEncounterText(i18next.t("battle:rewardGain", { modifierName: (reward as Reward).name }));
|
||||||
|
|
||||||
await showEncounterDialogue(`${namespace}:victory_2`, `${namespace}:speaker`);
|
await showEncounterDialogue(`${namespace}:victory_2`, `${namespace}:speaker`);
|
||||||
globalScene.ui.clearText(); // Clears "Winstrate" title from screen as allRewards get animated in
|
globalScene.ui.clearText(); // Clears "Winstrate" title from screen as rewards get animated in
|
||||||
const machoBrace = generateRewardOptionFromId(HeldItemId.MACHO_BRACE)!;
|
const machoBrace = generateRewardOptionFromId(HeldItemId.MACHO_BRACE)!;
|
||||||
machoBrace.type.tier = RarityTier.MASTER;
|
machoBrace.type.tier = RarityTier.MASTER;
|
||||||
setEncounterRewards({
|
setEncounterRewards({
|
||||||
|
@ -174,11 +174,11 @@ export class MysteryEncounter implements IMysteryEncounter {
|
|||||||
onVisualsStart?: () => boolean;
|
onVisualsStart?: () => boolean;
|
||||||
/** Event triggered prior to {@linkcode CommandPhase}, during {@linkcode TurnInitPhase} */
|
/** Event triggered prior to {@linkcode CommandPhase}, during {@linkcode TurnInitPhase} */
|
||||||
onTurnStart?: () => boolean;
|
onTurnStart?: () => boolean;
|
||||||
/** Event prior to any allRewards logic in {@linkcode MysteryEncounterRewardsPhase} */
|
/** Event prior to any reward logic in {@linkcode MysteryEncounterRewardsPhase} */
|
||||||
onRewards?: () => Promise<void>;
|
onRewards?: () => Promise<void>;
|
||||||
/** Will provide the player party EXP before allRewards are displayed for that wave */
|
/** Will provide the player party EXP before rewards are displayed for that wave */
|
||||||
doEncounterExp?: () => boolean;
|
doEncounterExp?: () => boolean;
|
||||||
/** Will provide the player a allRewards shop for that wave */
|
/** Will provide the player a reward shop for that wave */
|
||||||
doEncounterRewards?: () => boolean;
|
doEncounterRewards?: () => boolean;
|
||||||
/** Will execute callback during VictoryPhase of a continuousEncounter */
|
/** Will execute callback during VictoryPhase of a continuousEncounter */
|
||||||
doContinueEncounter?: () => Promise<void>;
|
doContinueEncounter?: () => Promise<void>;
|
||||||
@ -238,7 +238,7 @@ export class MysteryEncounter implements IMysteryEncounter {
|
|||||||
encounterMode: MysteryEncounterMode;
|
encounterMode: MysteryEncounterMode;
|
||||||
/**
|
/**
|
||||||
* Flag for checking if it's the first time a shop is being shown for an encounter.
|
* Flag for checking if it's the first time a shop is being shown for an encounter.
|
||||||
* Defaults to true so that the first shop does not override the specified allRewards.
|
* Defaults to true so that the first shop does not override the specified rewards.
|
||||||
* Will be set to false after a shop is shown (so can't reroll same rarity items for free)
|
* Will be set to false after a shop is shown (so can't reroll same rarity items for free)
|
||||||
*/
|
*/
|
||||||
lockEncounterRarityTiers: boolean;
|
lockEncounterRarityTiers: boolean;
|
||||||
@ -928,34 +928,6 @@ export class MysteryEncounterBuilder implements Partial<IMysteryEncounter> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Can set custom encounter allRewards via this callback function
|
|
||||||
* If allRewards are always deterministic for an encounter, this is a good way to set them
|
|
||||||
*
|
|
||||||
* NOTE: If allRewards are dependent on options selected, runtime data, etc.,
|
|
||||||
* It may be better to programmatically set doEncounterRewards elsewhere.
|
|
||||||
* There is a helper function in mystery-encounter utils, setEncounterRewards(), which can be called programmatically to set allRewards
|
|
||||||
* @param doEncounterRewards Synchronous callback function to perform during allRewards phase of the encounter
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
withRewards(doEncounterRewards: () => boolean): this & Required<Pick<IMysteryEncounter, "doEncounterRewards">> {
|
|
||||||
return Object.assign(this, { doEncounterRewards: doEncounterRewards });
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Can set custom encounter exp via this callback function
|
|
||||||
* If exp always deterministic for an encounter, this is a good way to set them
|
|
||||||
*
|
|
||||||
* NOTE: If allRewards are dependent on options selected, runtime data, etc.,
|
|
||||||
* It may be better to programmatically set doEncounterExp elsewhere.
|
|
||||||
* There is a helper function in mystery-encounter utils, setEncounterExp(), which can be called programmatically to set allRewards
|
|
||||||
* @param doEncounterExp Synchronous callback function to perform during allRewards phase of the encounter
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
withExp(doEncounterExp: () => boolean): this & Required<Pick<IMysteryEncounter, "doEncounterExp">> {
|
|
||||||
return Object.assign(this, { doEncounterExp: doEncounterExp });
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can be used to perform init logic before intro visuals are shown and before the MysteryEncounterPhase begins
|
* Can be used to perform init logic before intro visuals are shown and before the MysteryEncounterPhase begins
|
||||||
* Useful for performing things like procedural generation of intro sprites, etc.
|
* Useful for performing things like procedural generation of intro sprites, etc.
|
||||||
|
@ -686,7 +686,7 @@ export function selectOptionThenPokemon(
|
|||||||
/**
|
/**
|
||||||
* Will initialize reward phases to follow the mystery encounter
|
* Will initialize reward phases to follow the mystery encounter
|
||||||
* Can have shop displayed or skipped
|
* Can have shop displayed or skipped
|
||||||
* @param customShopRewards - adds a shop phase with the specified allRewards / reward tiers
|
* @param customShopRewards - adds a shop phase with the specified reward tiers
|
||||||
* @param eggRewards
|
* @param eggRewards
|
||||||
* @param preRewardsCallback - can execute an arbitrary callback before the new phases if necessary (useful for updating items/party/injecting new phases before {@linkcode MysteryEncounterRewardsPhase})
|
* @param preRewardsCallback - can execute an arbitrary callback before the new phases if necessary (useful for updating items/party/injecting new phases before {@linkcode MysteryEncounterRewardsPhase})
|
||||||
*/
|
*/
|
||||||
@ -768,8 +768,8 @@ export function initSubsequentOptionSelect(optionSelectSettings: OptionSelectSet
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Can be used to exit an encounter without any battles or followup
|
* Can be used to exit an encounter without any battles or followup
|
||||||
* Will skip any shops and allRewards, and queue the next encounter phase as normal
|
* Will skip any shops and rewards, and queue the next encounter phase as normal
|
||||||
* @param addHealPhase - when true, will add a shop phase to end of encounter with 0 allRewards but healing items are available
|
* @param addHealPhase - when true, will add a shop phase to end of encounter with 0 rewards but healing items are available
|
||||||
* @param encounterMode - Can set custom encounter mode if necessary (may be required for forcing Pokemon to return before next phase)
|
* @param encounterMode - Can set custom encounter mode if necessary (may be required for forcing Pokemon to return before next phase)
|
||||||
*/
|
*/
|
||||||
export function leaveEncounterWithoutBattle(
|
export function leaveEncounterWithoutBattle(
|
||||||
|
@ -79,9 +79,8 @@ export abstract class ItemTransferHeldItem extends HeldItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modifier for held items that steal items from the enemy at the end of
|
* Held item that steal items from the enemy at the end of
|
||||||
* each turn.
|
* each turn.
|
||||||
* @see {@linkcode allRewards[MINI_BLACK_HOLE]}
|
|
||||||
*/
|
*/
|
||||||
export class TurnEndItemStealHeldItem extends ItemTransferHeldItem {
|
export class TurnEndItemStealHeldItem extends ItemTransferHeldItem {
|
||||||
public effects: HeldItemEffect[] = [HeldItemEffect.TURN_END_ITEM_STEAL];
|
public effects: HeldItemEffect[] = [HeldItemEffect.TURN_END_ITEM_STEAL];
|
||||||
@ -120,10 +119,8 @@ export class TurnEndItemStealHeldItem extends ItemTransferHeldItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modifier for held items that add a chance to steal items from the target of a
|
* Held item that adds a chance to steal items from the target of a
|
||||||
* successful attack.
|
* successful attack.
|
||||||
* @see {@linkcode allRewards[GRIP_CLAW]}
|
|
||||||
* @see {@linkcode HeldItemTransferModifier}
|
|
||||||
*/
|
*/
|
||||||
export class ContactItemStealChanceHeldItem extends ItemTransferHeldItem {
|
export class ContactItemStealChanceHeldItem extends ItemTransferHeldItem {
|
||||||
public effects: HeldItemEffect[] = [HeldItemEffect.CONTACT_ITEM_STEAL_CHANCE];
|
public effects: HeldItemEffect[] = [HeldItemEffect.CONTACT_ITEM_STEAL_CHANCE];
|
||||||
|
@ -2,11 +2,11 @@ import { pokerogueApi } from "#api/pokerogue-api";
|
|||||||
import { clientSessionId } from "#app/account";
|
import { clientSessionId } from "#app/account";
|
||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
import { pokemonEvolutions } from "#balance/pokemon-evolutions";
|
import { pokemonEvolutions } from "#balance/pokemon-evolutions";
|
||||||
import { allRewards } from "#data/data-lists";
|
|
||||||
import { getCharVariantFromDialogue } from "#data/dialogue";
|
import { getCharVariantFromDialogue } from "#data/dialogue";
|
||||||
import type { PokemonSpecies } from "#data/pokemon-species";
|
import type { PokemonSpecies } from "#data/pokemon-species";
|
||||||
import { BattleType } from "#enums/battle-type";
|
import { BattleType } from "#enums/battle-type";
|
||||||
import { PlayerGender } from "#enums/player-gender";
|
import { PlayerGender } from "#enums/player-gender";
|
||||||
|
import { RewardId } from "#enums/reward-id";
|
||||||
import { TrainerType } from "#enums/trainer-type";
|
import { TrainerType } from "#enums/trainer-type";
|
||||||
import { UiMode } from "#enums/ui-mode";
|
import { UiMode } from "#enums/ui-mode";
|
||||||
import { Unlockables } from "#enums/unlockables";
|
import { Unlockables } from "#enums/unlockables";
|
||||||
@ -151,10 +151,10 @@ export class GameOverPhase extends BattlePhase {
|
|||||||
this.handleUnlocks();
|
this.handleUnlocks();
|
||||||
|
|
||||||
for (const species of this.firstRibbons) {
|
for (const species of this.firstRibbons) {
|
||||||
globalScene.phaseManager.unshiftNew("RibbonRewardPhase", allRewards.VOUCHER_PLUS, species);
|
globalScene.phaseManager.unshiftNew("RibbonRewardPhase", RewardId.VOUCHER_PLUS, species);
|
||||||
}
|
}
|
||||||
if (!firstClear) {
|
if (!firstClear) {
|
||||||
globalScene.phaseManager.unshiftNew("GameOverRewardPhase", allRewards.VOUCHER_PREMIUM);
|
globalScene.phaseManager.unshiftNew("GameOverRewardPhase", RewardId.VOUCHER_PREMIUM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.getRunHistoryEntry().then(runHistoryEntry => {
|
this.getRunHistoryEntry().then(runHistoryEntry => {
|
||||||
|
@ -532,13 +532,13 @@ export class MysteryEncounterRewardsPhase extends Phase {
|
|||||||
} else {
|
} else {
|
||||||
this.doEncounterRewardsAndContinue();
|
this.doEncounterRewardsAndContinue();
|
||||||
}
|
}
|
||||||
// Do not use ME's seedOffset for allRewards, these should always be consistent with waveIndex (once per wave)
|
// Do not use ME's seedOffset for rewards, these should always be consistent with waveIndex (once per wave)
|
||||||
}, globalScene.currentBattle.waveIndex * 1000);
|
}, globalScene.currentBattle.waveIndex * 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Queues encounter EXP and allRewards phases, {@linkcode PostMysteryEncounterPhase}, and ends phase
|
* Queues encounter EXP and reward phases, {@linkcode PostMysteryEncounterPhase}, and ends phase
|
||||||
*/
|
*/
|
||||||
doEncounterRewardsAndContinue() {
|
doEncounterRewardsAndContinue() {
|
||||||
const encounter = globalScene.currentBattle.mysteryEncounter!;
|
const encounter = globalScene.currentBattle.mysteryEncounter!;
|
||||||
|
@ -108,7 +108,7 @@ export class SelectRewardPhase extends BattlePhase {
|
|||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Pick an option from the allRewards
|
// Pick an option from the rewards
|
||||||
case 1:
|
case 1:
|
||||||
return this.selectRewardOption(cursor, rewardSelectCallback);
|
return this.selectRewardOption(cursor, rewardSelectCallback);
|
||||||
// Pick an option from the shop
|
// Pick an option from the shop
|
||||||
@ -121,7 +121,7 @@ export class SelectRewardPhase extends BattlePhase {
|
|||||||
this.resetRewardSelect(rewardSelectCallback);
|
this.resetRewardSelect(rewardSelectCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pick a reward from among the allRewards and apply it
|
// Pick a reward from among the rewards and apply it
|
||||||
private selectRewardOption(cursor: number, rewardSelectCallback: RewardSelectCallback): boolean {
|
private selectRewardOption(cursor: number, rewardSelectCallback: RewardSelectCallback): boolean {
|
||||||
if (this.typeOptions.length === 0) {
|
if (this.typeOptions.length === 0) {
|
||||||
globalScene.ui.clearText();
|
globalScene.ui.clearText();
|
||||||
@ -175,7 +175,6 @@ export class SelectRewardPhase extends BattlePhase {
|
|||||||
return cost === -1;
|
return cost === -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reroll allRewards
|
|
||||||
private rerollRewards() {
|
private rerollRewards() {
|
||||||
const rerollCost = this.getRerollCost(globalScene.lockRarityTiers);
|
const rerollCost = this.getRerollCost(globalScene.lockRarityTiers);
|
||||||
if (rerollCost < 0 || globalScene.money < rerollCost) {
|
if (rerollCost < 0 || globalScene.money < rerollCost) {
|
||||||
|
@ -59,7 +59,7 @@ export class VictoryPhase extends PokemonPhase {
|
|||||||
.map(r => globalScene.phaseManager.pushNew("RewardPhase", r));
|
.map(r => globalScene.phaseManager.pushNew("RewardPhase", r));
|
||||||
break;
|
break;
|
||||||
case ClassicFixedBossWaves.EVIL_BOSS_2:
|
case ClassicFixedBossWaves.EVIL_BOSS_2:
|
||||||
// Should get Lock Capsule on 165 before shop phase so it can be used in the allRewards shop
|
// Should get Lock Capsule on 165 before shop phase so it can be used in the reward shop
|
||||||
globalScene.phaseManager.pushNew("RewardPhase", TrainerItemId.LOCK_CAPSULE);
|
globalScene.phaseManager.pushNew("RewardPhase", TrainerItemId.LOCK_CAPSULE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -124,7 +124,7 @@ export class VictoryPhase extends PokemonPhase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If this wave is a fixed battle with special custom modifier allRewards,
|
* If this wave is a fixed battle with special custom rewards,
|
||||||
* will pass those settings to the upcoming {@linkcode SelectRewardPhase}`.
|
* will pass those settings to the upcoming {@linkcode SelectRewardPhase}`.
|
||||||
*/
|
*/
|
||||||
getFixedBattleCustomRewards(): CustomRewardSettings | undefined {
|
getFixedBattleCustomRewards(): CustomRewardSettings | undefined {
|
||||||
|
@ -67,7 +67,7 @@ interface TimedEvent extends EventBanner {
|
|||||||
mysteryEncounterTierChanges?: EventMysteryEncounterTier[];
|
mysteryEncounterTierChanges?: EventMysteryEncounterTier[];
|
||||||
luckBoostedSpecies?: SpeciesId[];
|
luckBoostedSpecies?: SpeciesId[];
|
||||||
boostFusions?: boolean; //MODIFIER REWORK PLEASE
|
boostFusions?: boolean; //MODIFIER REWORK PLEASE
|
||||||
classicWaveRewards?: EventWaveReward[]; // Rival battle allRewards
|
classicWaveRewards?: EventWaveReward[]; // Rival battle rewards
|
||||||
trainerShinyChance?: number; // Odds over 65536 of trainer mon generating as shiny
|
trainerShinyChance?: number; // Odds over 65536 of trainer mon generating as shiny
|
||||||
music?: EventMusicReplacement[];
|
music?: EventMusicReplacement[];
|
||||||
dailyRunChallenges?: EventChallenge[];
|
dailyRunChallenges?: EventChallenge[];
|
||||||
@ -569,8 +569,8 @@ export class TimedEventManager {
|
|||||||
/**
|
/**
|
||||||
* Gets all the modifier types associated with a certain wave during an event
|
* Gets all the modifier types associated with a certain wave during an event
|
||||||
* @see EventWaveReward
|
* @see EventWaveReward
|
||||||
* @param wave the wave to check for associated allRewards
|
* @param wave the wave to check for associated rewards
|
||||||
* @returns array of strings of the event modifier reward types
|
* @returns array of strings of the event reward types
|
||||||
*/
|
*/
|
||||||
getFixedBattleEventRewards(wave: number): SilentReward[] {
|
getFixedBattleEventRewards(wave: number): SilentReward[] {
|
||||||
const ret: SilentReward[] = [];
|
const ret: SilentReward[] = [];
|
||||||
|
Loading…
Reference in New Issue
Block a user