mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-04 07:22:19 +02:00
Replace many instantiations of new phase with phase manager
This commit is contained in:
parent
a72bdc7f1b
commit
77037bfb52
@ -2021,8 +2021,10 @@ export class SacrificialFullRestoreAttr extends SacrificialAttr {
|
|||||||
const party = user.isPlayer() ? globalScene.getPlayerParty() : globalScene.getEnemyParty();
|
const party = user.isPlayer() ? globalScene.getPlayerParty() : globalScene.getEnemyParty();
|
||||||
const maxPartyMemberHp = party.map(p => p.getMaxHp()).reduce((maxHp: number, hp: number) => Math.max(hp, maxHp), 0);
|
const maxPartyMemberHp = party.map(p => p.getMaxHp()).reduce((maxHp: number, hp: number) => Math.max(hp, maxHp), 0);
|
||||||
|
|
||||||
globalScene.phaseManager.pushPhase(
|
const pm = globalScene.phaseManager;
|
||||||
new PokemonHealPhase(
|
|
||||||
|
pm.pushPhase(
|
||||||
|
pm.create("PokemonHealPhase",
|
||||||
user.getBattlerIndex(),
|
user.getBattlerIndex(),
|
||||||
maxPartyMemberHp,
|
maxPartyMemberHp,
|
||||||
i18next.t(this.moveMessage, { pokemonName: getPokemonNameWithAffix(user) }),
|
i18next.t(this.moveMessage, { pokemonName: getPokemonNameWithAffix(user) }),
|
||||||
@ -4227,8 +4229,8 @@ export class PresentPowerAttr extends VariablePowerAttr {
|
|||||||
// If this move is multi-hit, disable all other hits
|
// If this move is multi-hit, disable all other hits
|
||||||
user.turnData.hitCount = 1;
|
user.turnData.hitCount = 1;
|
||||||
user.turnData.hitsLeft = 1;
|
user.turnData.hitsLeft = 1;
|
||||||
globalScene.phaseManager.unshiftPhase(new PokemonHealPhase(target.getBattlerIndex(),
|
globalScene.phaseManager.unshiftNew("PokemonHealPhase", target.getBattlerIndex(),
|
||||||
toDmgValue(target.getMaxHp() / 4), i18next.t("moveTriggers:regainedHealth", { pokemonName: getPokemonNameWithAffix(target) }), true));
|
toDmgValue(target.getMaxHp() / 4), i18next.t("moveTriggers:regainedHealth", { pokemonName: getPokemonNameWithAffix(target) }), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -6255,26 +6257,23 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
|||||||
if (this.switchType === SwitchType.FORCE_SWITCH) {
|
if (this.switchType === SwitchType.FORCE_SWITCH) {
|
||||||
switchOutTarget.leaveField(true);
|
switchOutTarget.leaveField(true);
|
||||||
const slotIndex = eligibleNewIndices[user.randBattleSeedInt(eligibleNewIndices.length)];
|
const slotIndex = eligibleNewIndices[user.randBattleSeedInt(eligibleNewIndices.length)];
|
||||||
globalScene.phaseManager.prependToPhase(
|
globalScene.phaseManager.prependNewToPhase(
|
||||||
new SwitchSummonPhase(
|
"MoveEndPhase",
|
||||||
this.switchType,
|
"SwitchSummonPhase",
|
||||||
switchOutTarget.getFieldIndex(),
|
this.switchType,
|
||||||
slotIndex,
|
switchOutTarget.getFieldIndex(),
|
||||||
false,
|
slotIndex,
|
||||||
true
|
false,
|
||||||
),
|
true
|
||||||
"MoveEndPhase"
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
switchOutTarget.leaveField(this.switchType === SwitchType.SWITCH);
|
switchOutTarget.leaveField(this.switchType === SwitchType.SWITCH);
|
||||||
globalScene.phaseManager.prependToPhase(
|
globalScene.phaseManager.prependNewToPhase("MoveEndPhase",
|
||||||
new SwitchPhase(
|
"SwitchPhase",
|
||||||
this.switchType,
|
this.switchType,
|
||||||
switchOutTarget.getFieldIndex(),
|
switchOutTarget.getFieldIndex(),
|
||||||
true,
|
true,
|
||||||
true
|
true
|
||||||
),
|
|
||||||
"MoveEndPhase"
|
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -6298,27 +6297,23 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
|||||||
if (this.switchType === SwitchType.FORCE_SWITCH) {
|
if (this.switchType === SwitchType.FORCE_SWITCH) {
|
||||||
switchOutTarget.leaveField(true);
|
switchOutTarget.leaveField(true);
|
||||||
const slotIndex = eligibleNewIndices[user.randBattleSeedInt(eligibleNewIndices.length)];
|
const slotIndex = eligibleNewIndices[user.randBattleSeedInt(eligibleNewIndices.length)];
|
||||||
globalScene.phaseManager.prependToPhase(
|
globalScene.phaseManager.prependNewToPhase("MoveEndPhase",
|
||||||
new SwitchSummonPhase(
|
"SwitchSummonPhase",
|
||||||
this.switchType,
|
this.switchType,
|
||||||
switchOutTarget.getFieldIndex(),
|
switchOutTarget.getFieldIndex(),
|
||||||
slotIndex,
|
slotIndex,
|
||||||
false,
|
false,
|
||||||
false
|
false
|
||||||
),
|
|
||||||
"MoveEndPhase"
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
switchOutTarget.leaveField(this.switchType === SwitchType.SWITCH);
|
switchOutTarget.leaveField(this.switchType === SwitchType.SWITCH);
|
||||||
globalScene.phaseManager.prependToPhase(
|
globalScene.phaseManager.prependNewToPhase("MoveEndPhase",
|
||||||
new SwitchSummonPhase(
|
"SwitchSummonPhase",
|
||||||
this.switchType,
|
this.switchType,
|
||||||
switchOutTarget.getFieldIndex(),
|
switchOutTarget.getFieldIndex(),
|
||||||
(globalScene.currentBattle.trainer ? globalScene.currentBattle.trainer.getNextSummonIndex((switchOutTarget as EnemyPokemon).trainerSlot) : 0),
|
(globalScene.currentBattle.trainer ? globalScene.currentBattle.trainer.getNextSummonIndex((switchOutTarget as EnemyPokemon).trainerSlot) : 0),
|
||||||
false,
|
false,
|
||||||
false
|
false
|
||||||
),
|
|
||||||
"MoveEndPhase"
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,6 @@ import { TrainerSlot } from "#enums/trainer-slot";
|
|||||||
import { PokeballType } from "#enums/pokeball";
|
import { PokeballType } from "#enums/pokeball";
|
||||||
import type HeldModifierConfig from "#app/@types/held-modifier-config";
|
import type HeldModifierConfig from "#app/@types/held-modifier-config";
|
||||||
import type { BerryType } from "#enums/berry-type";
|
import type { BerryType } from "#enums/berry-type";
|
||||||
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
|
|
||||||
import { Stat } from "#enums/stat";
|
import { Stat } from "#enums/stat";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
|
|
||||||
@ -237,8 +236,12 @@ export const AbsoluteAvariceEncounter: MysteryEncounter = MysteryEncounterBuilde
|
|||||||
tags: [BattlerTagType.MYSTERY_ENCOUNTER_POST_SUMMON],
|
tags: [BattlerTagType.MYSTERY_ENCOUNTER_POST_SUMMON],
|
||||||
mysteryEncounterBattleEffects: (pokemon: Pokemon) => {
|
mysteryEncounterBattleEffects: (pokemon: Pokemon) => {
|
||||||
queueEncounterMessage(`${namespace}:option.1.boss_enraged`);
|
queueEncounterMessage(`${namespace}:option.1.boss_enraged`);
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew(
|
||||||
new StatStageChangePhase(pokemon.getBattlerIndex(), true, statChangesForBattle, 1),
|
"StatStageChangePhase",
|
||||||
|
pokemon.getBattlerIndex(),
|
||||||
|
true,
|
||||||
|
statChangesForBattle,
|
||||||
|
1,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -35,7 +35,6 @@ import { BerryModifier } from "#app/modifier/modifier";
|
|||||||
import i18next from "#app/plugins/i18n";
|
import i18next from "#app/plugins/i18n";
|
||||||
import { BerryType } from "#enums/berry-type";
|
import { BerryType } from "#enums/berry-type";
|
||||||
import { PERMANENT_STATS, Stat } from "#enums/stat";
|
import { PERMANENT_STATS, Stat } from "#enums/stat";
|
||||||
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
|
|
||||||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
|
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
|
||||||
|
|
||||||
/** the i18n namespace for the encounter */
|
/** the i18n namespace for the encounter */
|
||||||
@ -237,8 +236,12 @@ export const BerriesAboundEncounter: MysteryEncounter = MysteryEncounterBuilder.
|
|||||||
config.pokemonConfigs![0].tags = [BattlerTagType.MYSTERY_ENCOUNTER_POST_SUMMON];
|
config.pokemonConfigs![0].tags = [BattlerTagType.MYSTERY_ENCOUNTER_POST_SUMMON];
|
||||||
config.pokemonConfigs![0].mysteryEncounterBattleEffects = (pokemon: Pokemon) => {
|
config.pokemonConfigs![0].mysteryEncounterBattleEffects = (pokemon: Pokemon) => {
|
||||||
queueEncounterMessage(`${namespace}:option.2.boss_enraged`);
|
queueEncounterMessage(`${namespace}:option.2.boss_enraged`);
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew(
|
||||||
new StatStageChangePhase(pokemon.getBattlerIndex(), true, statChangesForBattle, 1),
|
"StatStageChangePhase",
|
||||||
|
pokemon.getBattlerIndex(),
|
||||||
|
true,
|
||||||
|
statChangesForBattle,
|
||||||
|
1,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
setEncounterRewards(
|
setEncounterRewards(
|
||||||
|
@ -26,7 +26,6 @@ import type { PlayerPokemon } from "#app/field/pokemon";
|
|||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
import { PokemonMove } from "#app/field/pokemon";
|
import { PokemonMove } from "#app/field/pokemon";
|
||||||
import { getEncounterText, showEncounterDialogue } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
import { getEncounterText, showEncounterDialogue } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
||||||
import { LearnMovePhase } from "#app/phases/learn-move-phase";
|
|
||||||
import { MoveId } from "#enums/move-id";
|
import { MoveId } from "#enums/move-id";
|
||||||
import type { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler";
|
import type { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler";
|
||||||
import { MysteryEncounterOptionBuilder } from "#app/data/mystery-encounters/mystery-encounter-option";
|
import { MysteryEncounterOptionBuilder } from "#app/data/mystery-encounters/mystery-encounter-option";
|
||||||
@ -766,8 +765,10 @@ function doBugTypeMoveTutor(): Promise<void> {
|
|||||||
|
|
||||||
// Option select complete, handle if they are learning a move
|
// Option select complete, handle if they are learning a move
|
||||||
if (result && result.selectedOptionIndex < moveOptions.length) {
|
if (result && result.selectedOptionIndex < moveOptions.length) {
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew(
|
||||||
new LearnMovePhase(result.selectedPokemonIndex, moveOptions[result.selectedOptionIndex].moveId),
|
"LearnMovePhase",
|
||||||
|
result.selectedPokemonIndex,
|
||||||
|
moveOptions[result.selectedOptionIndex].moveId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,8 +26,6 @@ import type Pokemon from "#app/field/pokemon";
|
|||||||
import { EnemyPokemon, PokemonMove } from "#app/field/pokemon";
|
import { EnemyPokemon, PokemonMove } from "#app/field/pokemon";
|
||||||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
|
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
|
||||||
import { modifierTypes } from "#app/modifier/modifier-type";
|
import { modifierTypes } from "#app/modifier/modifier-type";
|
||||||
import { LearnMovePhase } from "#app/phases/learn-move-phase";
|
|
||||||
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
|
|
||||||
import PokemonData from "#app/system/pokemon-data";
|
import PokemonData from "#app/system/pokemon-data";
|
||||||
import type { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler";
|
import type { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler";
|
||||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||||
@ -176,13 +174,12 @@ export const DancingLessonsEncounter: MysteryEncounter = MysteryEncounterBuilder
|
|||||||
tags: [BattlerTagType.MYSTERY_ENCOUNTER_POST_SUMMON],
|
tags: [BattlerTagType.MYSTERY_ENCOUNTER_POST_SUMMON],
|
||||||
mysteryEncounterBattleEffects: (pokemon: Pokemon) => {
|
mysteryEncounterBattleEffects: (pokemon: Pokemon) => {
|
||||||
queueEncounterMessage(`${namespace}:option.1.boss_enraged`);
|
queueEncounterMessage(`${namespace}:option.1.boss_enraged`);
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew(
|
||||||
new StatStageChangePhase(
|
"StatStageChangePhase",
|
||||||
pokemon.getBattlerIndex(),
|
pokemon.getBattlerIndex(),
|
||||||
true,
|
true,
|
||||||
[Stat.ATK, Stat.DEF, Stat.SPATK, Stat.SPDEF],
|
[Stat.ATK, Stat.DEF, Stat.SPATK, Stat.SPDEF],
|
||||||
1,
|
1,
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -245,8 +242,10 @@ export const DancingLessonsEncounter: MysteryEncounter = MysteryEncounterBuilder
|
|||||||
|
|
||||||
const onPokemonSelected = (pokemon: PlayerPokemon) => {
|
const onPokemonSelected = (pokemon: PlayerPokemon) => {
|
||||||
encounter.setDialogueToken("selectedPokemon", pokemon.getNameToRender());
|
encounter.setDialogueToken("selectedPokemon", pokemon.getNameToRender());
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew(
|
||||||
new LearnMovePhase(globalScene.getPlayerParty().indexOf(pokemon), MoveId.REVELATION_DANCE),
|
"LearnMovePhase",
|
||||||
|
globalScene.getPlayerParty().indexOf(pokemon),
|
||||||
|
MoveId.REVELATION_DANCE,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Play animation again to "learn" the dance
|
// Play animation again to "learn" the dance
|
||||||
|
@ -44,7 +44,6 @@ import { EncounterAnim } from "#enums/encounter-anims";
|
|||||||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
|
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
|
||||||
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";
|
||||||
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
|
|
||||||
import { Stat } from "#enums/stat";
|
import { Stat } from "#enums/stat";
|
||||||
import { Ability } from "#app/data/abilities/ability-class";
|
import { Ability } from "#app/data/abilities/ability-class";
|
||||||
import { FIRE_RESISTANT_ABILITIES } from "#app/data/mystery-encounters/requirements/requirement-groups";
|
import { FIRE_RESISTANT_ABILITIES } from "#app/data/mystery-encounters/requirements/requirement-groups";
|
||||||
@ -92,8 +91,12 @@ export const FieryFalloutEncounter: MysteryEncounter = MysteryEncounterBuilder.w
|
|||||||
gender: Gender.MALE,
|
gender: Gender.MALE,
|
||||||
tags: [BattlerTagType.MYSTERY_ENCOUNTER_POST_SUMMON],
|
tags: [BattlerTagType.MYSTERY_ENCOUNTER_POST_SUMMON],
|
||||||
mysteryEncounterBattleEffects: (pokemon: Pokemon) => {
|
mysteryEncounterBattleEffects: (pokemon: Pokemon) => {
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew(
|
||||||
new StatStageChangePhase(pokemon.getBattlerIndex(), true, [Stat.SPDEF, Stat.SPD], 1),
|
"StatStageChangePhase",
|
||||||
|
pokemon.getBattlerIndex(),
|
||||||
|
true,
|
||||||
|
[Stat.SPDEF, Stat.SPD],
|
||||||
|
1,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -103,8 +106,12 @@ export const FieryFalloutEncounter: MysteryEncounter = MysteryEncounterBuilder.w
|
|||||||
gender: Gender.FEMALE,
|
gender: Gender.FEMALE,
|
||||||
tags: [BattlerTagType.MYSTERY_ENCOUNTER_POST_SUMMON],
|
tags: [BattlerTagType.MYSTERY_ENCOUNTER_POST_SUMMON],
|
||||||
mysteryEncounterBattleEffects: (pokemon: Pokemon) => {
|
mysteryEncounterBattleEffects: (pokemon: Pokemon) => {
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew(
|
||||||
new StatStageChangePhase(pokemon.getBattlerIndex(), true, [Stat.SPDEF, Stat.SPD], 1),
|
"StatStageChangePhase",
|
||||||
|
pokemon.getBattlerIndex(),
|
||||||
|
true,
|
||||||
|
[Stat.SPDEF, Stat.SPD],
|
||||||
|
1,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -32,7 +32,6 @@ import PokemonData from "#app/system/pokemon-data";
|
|||||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||||
import { queueEncounterMessage } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
import { queueEncounterMessage } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
||||||
import { randSeedInt } from "#app/utils/common";
|
import { randSeedInt } from "#app/utils/common";
|
||||||
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
|
|
||||||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
|
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
|
||||||
|
|
||||||
/** the i18n namespace for the encounter */
|
/** the i18n namespace for the encounter */
|
||||||
@ -76,8 +75,12 @@ export const FightOrFlightEncounter: MysteryEncounter = MysteryEncounterBuilder.
|
|||||||
queueEncounterMessage(`${namespace}:option.1.stat_boost`);
|
queueEncounterMessage(`${namespace}:option.1.stat_boost`);
|
||||||
// Randomly boost 1 stat 2 stages
|
// Randomly boost 1 stat 2 stages
|
||||||
// Cannot boost Spd, Acc, or Evasion
|
// Cannot boost Spd, Acc, or Evasion
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew(
|
||||||
new StatStageChangePhase(pokemon.getBattlerIndex(), true, [randSeedInt(4, 1)], 2),
|
"StatStageChangePhase",
|
||||||
|
pokemon.getBattlerIndex(),
|
||||||
|
true,
|
||||||
|
[randSeedInt(4, 1)],
|
||||||
|
2,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -27,7 +27,6 @@ import { getPartyLuckValue, modifierTypes } from "#app/modifier/modifier-type";
|
|||||||
import { TrainerSlot } from "#enums/trainer-slot";
|
import { TrainerSlot } from "#enums/trainer-slot";
|
||||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||||
import { getPokemonNameWithAffix } from "#app/messages";
|
import { getPokemonNameWithAffix } from "#app/messages";
|
||||||
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
|
|
||||||
import { Stat } from "#enums/stat";
|
import { Stat } from "#enums/stat";
|
||||||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
|
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
|
||||||
import {
|
import {
|
||||||
@ -227,8 +226,12 @@ async function doBiomeTransitionDialogueAndBattleInit() {
|
|||||||
tags: [BattlerTagType.MYSTERY_ENCOUNTER_POST_SUMMON],
|
tags: [BattlerTagType.MYSTERY_ENCOUNTER_POST_SUMMON],
|
||||||
mysteryEncounterBattleEffects: (pokemon: Pokemon) => {
|
mysteryEncounterBattleEffects: (pokemon: Pokemon) => {
|
||||||
queueEncounterMessage(`${namespace}:boss_enraged`);
|
queueEncounterMessage(`${namespace}:boss_enraged`);
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew(
|
||||||
new StatStageChangePhase(pokemon.getBattlerIndex(), true, statChangesForBattle, 1),
|
"StatStageChangePhase",
|
||||||
|
pokemon.getBattlerIndex(),
|
||||||
|
true,
|
||||||
|
statChangesForBattle,
|
||||||
|
1,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -27,7 +27,6 @@ import { BerryType } from "#enums/berry-type";
|
|||||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||||
import { CustomPokemonData } from "#app/data/custom-pokemon-data";
|
import { CustomPokemonData } from "#app/data/custom-pokemon-data";
|
||||||
import { Stat } from "#enums/stat";
|
import { Stat } from "#enums/stat";
|
||||||
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
|
|
||||||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
|
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
|
||||||
|
|
||||||
/** the i18n namespace for the encounter */
|
/** the i18n namespace for the encounter */
|
||||||
@ -116,8 +115,12 @@ export const TheStrongStuffEncounter: MysteryEncounter = MysteryEncounterBuilder
|
|||||||
tags: [BattlerTagType.MYSTERY_ENCOUNTER_POST_SUMMON],
|
tags: [BattlerTagType.MYSTERY_ENCOUNTER_POST_SUMMON],
|
||||||
mysteryEncounterBattleEffects: (pokemon: Pokemon) => {
|
mysteryEncounterBattleEffects: (pokemon: Pokemon) => {
|
||||||
queueEncounterMessage(`${namespace}:option.2.stat_boost`);
|
queueEncounterMessage(`${namespace}:option.2.stat_boost`);
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew(
|
||||||
new StatStageChangePhase(pokemon.getBattlerIndex(), true, [Stat.DEF, Stat.SPDEF], 1),
|
"StatStageChangePhase",
|
||||||
|
pokemon.getBattlerIndex(),
|
||||||
|
true,
|
||||||
|
[Stat.DEF, Stat.SPDEF],
|
||||||
|
1,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -35,7 +35,6 @@ import { PokeballType } from "#enums/pokeball";
|
|||||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||||
import { queueEncounterMessage } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
import { queueEncounterMessage } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
||||||
import { BerryModifier } from "#app/modifier/modifier";
|
import { BerryModifier } from "#app/modifier/modifier";
|
||||||
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
|
|
||||||
import { Stat } from "#enums/stat";
|
import { Stat } from "#enums/stat";
|
||||||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
|
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
|
||||||
|
|
||||||
@ -103,8 +102,12 @@ export const UncommonBreedEncounter: MysteryEncounter = MysteryEncounterBuilder.
|
|||||||
tags: [BattlerTagType.MYSTERY_ENCOUNTER_POST_SUMMON],
|
tags: [BattlerTagType.MYSTERY_ENCOUNTER_POST_SUMMON],
|
||||||
mysteryEncounterBattleEffects: (pokemon: Pokemon) => {
|
mysteryEncounterBattleEffects: (pokemon: Pokemon) => {
|
||||||
queueEncounterMessage(`${namespace}:option.1.stat_boost`);
|
queueEncounterMessage(`${namespace}:option.1.stat_boost`);
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew(
|
||||||
new StatStageChangePhase(pokemon.getBattlerIndex(), true, statChangesForBattle, 1),
|
"StatStageChangePhase",
|
||||||
|
pokemon.getBattlerIndex(),
|
||||||
|
true,
|
||||||
|
statChangesForBattle,
|
||||||
|
1,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -38,7 +38,6 @@ import { TimeOfDay } from "#enums/time-of-day";
|
|||||||
import { TrainerType } from "#enums/trainer-type";
|
import { TrainerType } from "#enums/trainer-type";
|
||||||
import { AbilityId } from "#enums/ability-id";
|
import { AbilityId } from "#enums/ability-id";
|
||||||
import { SpeciesFormChangeRevertWeatherFormTrigger, SpeciesFormChangeWeatherTrigger } from "#app/data/pokemon-forms";
|
import { SpeciesFormChangeRevertWeatherFormTrigger, SpeciesFormChangeWeatherTrigger } from "#app/data/pokemon-forms";
|
||||||
import { CommonAnimPhase } from "#app/phases/common-anim-phase";
|
|
||||||
import { WeatherType } from "#enums/weather-type";
|
import { WeatherType } from "#enums/weather-type";
|
||||||
import { FieldEffectModifier } from "#app/modifier/modifier";
|
import { FieldEffectModifier } from "#app/modifier/modifier";
|
||||||
|
|
||||||
@ -328,8 +327,12 @@ export class Arena {
|
|||||||
this.weather?.isImmutable() &&
|
this.weather?.isImmutable() &&
|
||||||
![WeatherType.HARSH_SUN, WeatherType.HEAVY_RAIN, WeatherType.STRONG_WINDS, WeatherType.NONE].includes(weather)
|
![WeatherType.HARSH_SUN, WeatherType.HEAVY_RAIN, WeatherType.STRONG_WINDS, WeatherType.NONE].includes(weather)
|
||||||
) {
|
) {
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew(
|
||||||
new CommonAnimPhase(undefined, undefined, CommonAnim.SUNNY + (oldWeatherType - 1), true),
|
"CommonAnimPhase",
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
CommonAnim.SUNNY + (oldWeatherType - 1),
|
||||||
|
true,
|
||||||
);
|
);
|
||||||
globalScene.phaseManager.queueMessage(getLegendaryWeatherContinuesMessage(oldWeatherType)!);
|
globalScene.phaseManager.queueMessage(getLegendaryWeatherContinuesMessage(oldWeatherType)!);
|
||||||
return false;
|
return false;
|
||||||
@ -348,8 +351,12 @@ export class Arena {
|
|||||||
); // TODO: is this bang correct?
|
); // TODO: is this bang correct?
|
||||||
|
|
||||||
if (this.weather) {
|
if (this.weather) {
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew(
|
||||||
new CommonAnimPhase(undefined, undefined, CommonAnim.SUNNY + (weather - 1), true),
|
"CommonAnimPhase",
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
CommonAnim.SUNNY + (weather - 1),
|
||||||
|
true,
|
||||||
);
|
);
|
||||||
globalScene.phaseManager.queueMessage(getWeatherStartMessage(weather)!); // TODO: is this bang correct?
|
globalScene.phaseManager.queueMessage(getWeatherStartMessage(weather)!); // TODO: is this bang correct?
|
||||||
} else {
|
} else {
|
||||||
@ -433,8 +440,11 @@ export class Arena {
|
|||||||
|
|
||||||
if (this.terrain) {
|
if (this.terrain) {
|
||||||
if (!ignoreAnim) {
|
if (!ignoreAnim) {
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew(
|
||||||
new CommonAnimPhase(undefined, undefined, CommonAnim.MISTY_TERRAIN + (terrain - 1)),
|
"CommonAnimPhase",
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
CommonAnim.MISTY_TERRAIN + (terrain - 1),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
globalScene.phaseManager.queueMessage(getTerrainStartMessage(terrain)!); // TODO: is this bang correct?
|
globalScene.phaseManager.queueMessage(getTerrainStartMessage(terrain)!); // TODO: is this bang correct?
|
||||||
|
@ -230,11 +230,6 @@ import { BiomeId } from "#enums/biome-id";
|
|||||||
import { MoveId } from "#enums/move-id";
|
import { MoveId } from "#enums/move-id";
|
||||||
import { SpeciesId } from "#enums/species-id";
|
import { SpeciesId } from "#enums/species-id";
|
||||||
import { getPokemonNameWithAffix } from "#app/messages";
|
import { getPokemonNameWithAffix } from "#app/messages";
|
||||||
import { DamageAnimPhase } from "#app/phases/damage-anim-phase";
|
|
||||||
import { LearnMovePhase } from "#app/phases/learn-move-phase";
|
|
||||||
import { ObtainStatusEffectPhase } from "#app/phases/obtain-status-effect-phase";
|
|
||||||
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
|
|
||||||
import { SwitchSummonPhase } from "#app/phases/switch-summon-phase";
|
|
||||||
import { Challenges } from "#enums/challenges";
|
import { Challenges } from "#enums/challenges";
|
||||||
import { PokemonAnimType } from "#enums/pokemon-anim-type";
|
import { PokemonAnimType } from "#enums/pokemon-anim-type";
|
||||||
import { PLAYER_PARTY_MAX_SIZE } from "#app/constants";
|
import { PLAYER_PARTY_MAX_SIZE } from "#app/constants";
|
||||||
@ -4046,7 +4041,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
} = {},
|
} = {},
|
||||||
): number {
|
): number {
|
||||||
const isIndirectDamage = [HitResult.INDIRECT, HitResult.INDIRECT_KO].includes(result);
|
const isIndirectDamage = [HitResult.INDIRECT, HitResult.INDIRECT_KO].includes(result);
|
||||||
const damagePhase = new DamageAnimPhase(this.getBattlerIndex(), damage, result as DamageResult, isCritical);
|
const damagePhase = globalScene.phaseManager.create(
|
||||||
|
"DamageAnimPhase",
|
||||||
|
this.getBattlerIndex(),
|
||||||
|
damage,
|
||||||
|
result as DamageResult,
|
||||||
|
isCritical,
|
||||||
|
);
|
||||||
globalScene.phaseManager.unshiftPhase(damagePhase);
|
globalScene.phaseManager.unshiftPhase(damagePhase);
|
||||||
if (this.switchOutStatus && source) {
|
if (this.switchOutStatus && source) {
|
||||||
damage = 0;
|
damage = 0;
|
||||||
@ -4775,8 +4776,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
if (overrideStatus) {
|
if (overrideStatus) {
|
||||||
this.resetStatus(false);
|
this.resetStatus(false);
|
||||||
}
|
}
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew(
|
||||||
new ObtainStatusEffectPhase(this.getBattlerIndex(), effect, turnsRemaining, sourceText, sourcePokemon),
|
"ObtainStatusEffectPhase",
|
||||||
|
this.getBattlerIndex(),
|
||||||
|
effect,
|
||||||
|
turnsRemaining,
|
||||||
|
sourceText,
|
||||||
|
sourcePokemon,
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -5632,9 +5638,13 @@ export class PlayerPokemon extends Pokemon {
|
|||||||
this.getFieldIndex(),
|
this.getFieldIndex(),
|
||||||
(slotIndex: number, _option: PartyOption) => {
|
(slotIndex: number, _option: PartyOption) => {
|
||||||
if (slotIndex >= globalScene.currentBattle.getBattlerCount() && slotIndex < 6) {
|
if (slotIndex >= globalScene.currentBattle.getBattlerCount() && slotIndex < 6) {
|
||||||
globalScene.phaseManager.prependToPhase(
|
globalScene.phaseManager.prependNewToPhase(
|
||||||
new SwitchSummonPhase(switchType, this.getFieldIndex(), slotIndex, false),
|
|
||||||
"MoveEndPhase",
|
"MoveEndPhase",
|
||||||
|
"SwitchSummonPhase",
|
||||||
|
switchType,
|
||||||
|
this.getFieldIndex(),
|
||||||
|
slotIndex,
|
||||||
|
false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
globalScene.ui.setMode(UiMode.MESSAGE).then(resolve);
|
globalScene.ui.setMode(UiMode.MESSAGE).then(resolve);
|
||||||
@ -5998,7 +6008,7 @@ export class PlayerPokemon extends Pokemon {
|
|||||||
pokemon
|
pokemon
|
||||||
.getMoveset(true)
|
.getMoveset(true)
|
||||||
.map((m: PokemonMove) =>
|
.map((m: PokemonMove) =>
|
||||||
globalScene.phaseManager.unshiftPhase(new LearnMovePhase(newPartyMemberIndex, m.getMove().id)),
|
globalScene.phaseManager.unshiftNew("LearnMovePhase", newPartyMemberIndex, m.getMove().id),
|
||||||
);
|
);
|
||||||
pokemon.destroy();
|
pokemon.destroy();
|
||||||
this.updateFusionPalette();
|
this.updateFusionPalette();
|
||||||
@ -6641,8 +6651,14 @@ export class EnemyPokemon extends Pokemon {
|
|||||||
stages++;
|
stages++;
|
||||||
}
|
}
|
||||||
|
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew(
|
||||||
new StatStageChangePhase(this.getBattlerIndex(), true, [boostedStat!], stages, true, true),
|
"StatStageChangePhase",
|
||||||
|
this.getBattlerIndex(),
|
||||||
|
true,
|
||||||
|
[boostedStat!],
|
||||||
|
stages,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
);
|
);
|
||||||
this.bossSegmentIndex--;
|
this.bossSegmentIndex--;
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,7 @@ import { getStatusEffectHealText } from "#app/data/status-effect";
|
|||||||
import Pokemon, { type PlayerPokemon } from "#app/field/pokemon";
|
import Pokemon, { type PlayerPokemon } from "#app/field/pokemon";
|
||||||
import { getPokemonNameWithAffix } from "#app/messages";
|
import { getPokemonNameWithAffix } from "#app/messages";
|
||||||
import Overrides from "#app/overrides";
|
import Overrides from "#app/overrides";
|
||||||
import { EvolutionPhase } from "#app/phases/evolution-phase";
|
import { LearnMoveType } from "#app/phases/learn-move-phase";
|
||||||
import { LearnMovePhase, LearnMoveType } from "#app/phases/learn-move-phase";
|
|
||||||
import { LevelUpPhase } from "#app/phases/level-up-phase";
|
|
||||||
import { PokemonHealPhase } from "#app/phases/pokemon-heal-phase";
|
|
||||||
import type { VoucherType } from "#app/system/voucher";
|
import type { VoucherType } from "#app/system/voucher";
|
||||||
import { Command } from "#app/ui/command-ui-handler";
|
import { Command } from "#app/ui/command-ui-handler";
|
||||||
import { addTextObject, TextStyle } from "#app/ui/text";
|
import { addTextObject, TextStyle } from "#app/ui/text";
|
||||||
@ -1684,16 +1681,15 @@ export class TurnHealModifier extends PokemonHeldItemModifier {
|
|||||||
*/
|
*/
|
||||||
override apply(pokemon: Pokemon): boolean {
|
override apply(pokemon: Pokemon): boolean {
|
||||||
if (!pokemon.isFullHp()) {
|
if (!pokemon.isFullHp()) {
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew(
|
||||||
new PokemonHealPhase(
|
"PokemonHealPhase",
|
||||||
pokemon.getBattlerIndex(),
|
pokemon.getBattlerIndex(),
|
||||||
toDmgValue(pokemon.getMaxHp() / 16) * this.stackCount,
|
toDmgValue(pokemon.getMaxHp() / 16) * this.stackCount,
|
||||||
i18next.t("modifier:turnHealApply", {
|
i18next.t("modifier:turnHealApply", {
|
||||||
pokemonNameWithAffix: getPokemonNameWithAffix(pokemon),
|
pokemonNameWithAffix: getPokemonNameWithAffix(pokemon),
|
||||||
typeName: this.type.name,
|
typeName: this.type.name,
|
||||||
}),
|
}),
|
||||||
true,
|
true,
|
||||||
),
|
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1782,16 +1778,15 @@ export class HitHealModifier extends PokemonHeldItemModifier {
|
|||||||
override apply(pokemon: Pokemon): boolean {
|
override apply(pokemon: Pokemon): boolean {
|
||||||
if (pokemon.turnData.totalDamageDealt && !pokemon.isFullHp()) {
|
if (pokemon.turnData.totalDamageDealt && !pokemon.isFullHp()) {
|
||||||
// TODO: this shouldn't be undefined AFAIK
|
// TODO: this shouldn't be undefined AFAIK
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew(
|
||||||
new PokemonHealPhase(
|
"PokemonHealPhase",
|
||||||
pokemon.getBattlerIndex(),
|
pokemon.getBattlerIndex(),
|
||||||
toDmgValue(pokemon.turnData.totalDamageDealt / 8) * this.stackCount,
|
toDmgValue(pokemon.turnData.totalDamageDealt / 8) * this.stackCount,
|
||||||
i18next.t("modifier:hitHealApply", {
|
i18next.t("modifier:hitHealApply", {
|
||||||
pokemonNameWithAffix: getPokemonNameWithAffix(pokemon),
|
pokemonNameWithAffix: getPokemonNameWithAffix(pokemon),
|
||||||
typeName: this.type.name,
|
typeName: this.type.name,
|
||||||
}),
|
}),
|
||||||
true,
|
true,
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1950,18 +1945,17 @@ export class PokemonInstantReviveModifier extends PokemonHeldItemModifier {
|
|||||||
*/
|
*/
|
||||||
override apply(pokemon: Pokemon): boolean {
|
override apply(pokemon: Pokemon): boolean {
|
||||||
// Restore the Pokemon to half HP
|
// Restore the Pokemon to half HP
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew(
|
||||||
new PokemonHealPhase(
|
"PokemonHealPhase",
|
||||||
pokemon.getBattlerIndex(),
|
pokemon.getBattlerIndex(),
|
||||||
toDmgValue(pokemon.getMaxHp() / 2),
|
toDmgValue(pokemon.getMaxHp() / 2),
|
||||||
i18next.t("modifier:pokemonInstantReviveApply", {
|
i18next.t("modifier:pokemonInstantReviveApply", {
|
||||||
pokemonNameWithAffix: getPokemonNameWithAffix(pokemon),
|
pokemonNameWithAffix: getPokemonNameWithAffix(pokemon),
|
||||||
typeName: this.type.name,
|
typeName: this.type.name,
|
||||||
}),
|
}),
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Remove the Pokemon's FAINT status
|
// Remove the Pokemon's FAINT status
|
||||||
@ -2323,12 +2317,11 @@ export class PokemonLevelIncrementModifier extends ConsumablePokemonModifier {
|
|||||||
|
|
||||||
playerPokemon.addFriendship(FRIENDSHIP_GAIN_FROM_RARE_CANDY);
|
playerPokemon.addFriendship(FRIENDSHIP_GAIN_FROM_RARE_CANDY);
|
||||||
|
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew(
|
||||||
new LevelUpPhase(
|
"LevelUpPhase",
|
||||||
globalScene.getPlayerParty().indexOf(playerPokemon),
|
globalScene.getPlayerParty().indexOf(playerPokemon),
|
||||||
playerPokemon.level - levelCount.value,
|
playerPokemon.level - levelCount.value,
|
||||||
playerPokemon.level,
|
playerPokemon.level,
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -2344,8 +2337,11 @@ export class TmModifier extends ConsumablePokemonModifier {
|
|||||||
* @returns always `true`
|
* @returns always `true`
|
||||||
*/
|
*/
|
||||||
override apply(playerPokemon: PlayerPokemon): boolean {
|
override apply(playerPokemon: PlayerPokemon): boolean {
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew(
|
||||||
new LearnMovePhase(globalScene.getPlayerParty().indexOf(playerPokemon), this.type.moveId, LearnMoveType.TM),
|
"LearnMovePhase",
|
||||||
|
globalScene.getPlayerParty().indexOf(playerPokemon),
|
||||||
|
this.type.moveId,
|
||||||
|
LearnMoveType.TM,
|
||||||
);
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -2367,13 +2363,12 @@ export class RememberMoveModifier extends ConsumablePokemonModifier {
|
|||||||
* @returns always `true`
|
* @returns always `true`
|
||||||
*/
|
*/
|
||||||
override apply(playerPokemon: PlayerPokemon, cost?: number): boolean {
|
override apply(playerPokemon: PlayerPokemon, cost?: number): boolean {
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew(
|
||||||
new LearnMovePhase(
|
"LearnMovePhase",
|
||||||
globalScene.getPlayerParty().indexOf(playerPokemon),
|
globalScene.getPlayerParty().indexOf(playerPokemon),
|
||||||
playerPokemon.getLearnableLevelMoves()[this.levelMoveIndex],
|
playerPokemon.getLearnableLevelMoves()[this.levelMoveIndex],
|
||||||
LearnMoveType.MEMORY,
|
LearnMoveType.MEMORY,
|
||||||
cost,
|
cost,
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -2410,9 +2405,7 @@ export class EvolutionItemModifier extends ConsumablePokemonModifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (matchingEvolution) {
|
if (matchingEvolution) {
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew("EvolutionPhase", playerPokemon, matchingEvolution, playerPokemon.level - 1);
|
||||||
new EvolutionPhase(playerPokemon, matchingEvolution, playerPokemon.level - 1),
|
|
||||||
);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3574,19 +3567,18 @@ export class EnemyTurnHealModifier extends EnemyPersistentModifier {
|
|||||||
*/
|
*/
|
||||||
override apply(enemyPokemon: Pokemon): boolean {
|
override apply(enemyPokemon: Pokemon): boolean {
|
||||||
if (!enemyPokemon.isFullHp()) {
|
if (!enemyPokemon.isFullHp()) {
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew(
|
||||||
new PokemonHealPhase(
|
"PokemonHealPhase",
|
||||||
enemyPokemon.getBattlerIndex(),
|
enemyPokemon.getBattlerIndex(),
|
||||||
Math.max(Math.floor(enemyPokemon.getMaxHp() / (100 / this.healPercent)) * this.stackCount, 1),
|
Math.max(Math.floor(enemyPokemon.getMaxHp() / (100 / this.healPercent)) * this.stackCount, 1),
|
||||||
i18next.t("modifier:enemyTurnHealApply", {
|
i18next.t("modifier:enemyTurnHealApply", {
|
||||||
pokemonNameWithAffix: getPokemonNameWithAffix(enemyPokemon),
|
pokemonNameWithAffix: getPokemonNameWithAffix(enemyPokemon),
|
||||||
}),
|
}),
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
),
|
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@ import { BerryModifier } from "#app/modifier/modifier";
|
|||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { BooleanHolder } from "#app/utils/common";
|
import { BooleanHolder } from "#app/utils/common";
|
||||||
import { FieldPhase } from "./field-phase";
|
import { FieldPhase } from "./field-phase";
|
||||||
import { CommonAnimPhase } from "./common-anim-phase";
|
|
||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
|
|
||||||
@ -58,8 +57,11 @@ export class BerryPhase extends FieldPhase {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew(
|
||||||
new CommonAnimPhase(pokemon.getBattlerIndex(), pokemon.getBattlerIndex(), CommonAnim.USE_ITEM),
|
"CommonAnimPhase",
|
||||||
|
pokemon.getBattlerIndex(),
|
||||||
|
pokemon.getBattlerIndex(),
|
||||||
|
CommonAnim.USE_ITEM,
|
||||||
);
|
);
|
||||||
|
|
||||||
for (const berryModifier of globalScene.applyModifiers(BerryModifier, pokemon.isPlayer(), pokemon)) {
|
for (const berryModifier of globalScene.applyModifiers(BerryModifier, pokemon.isPlayer(), pokemon)) {
|
||||||
|
@ -23,7 +23,6 @@ import { BoostBugSpawnModifier, IvScannerModifier, TurnHeldItemTransferModifier
|
|||||||
import { ModifierPoolType, regenerateModifierPoolThresholds } from "#app/modifier/modifier-type";
|
import { ModifierPoolType, regenerateModifierPoolThresholds } from "#app/modifier/modifier-type";
|
||||||
import Overrides from "#app/overrides";
|
import Overrides from "#app/overrides";
|
||||||
import { BattlePhase } from "#app/phases/battle-phase";
|
import { BattlePhase } from "#app/phases/battle-phase";
|
||||||
import { PostSummonPhase } from "#app/phases/post-summon-phase";
|
|
||||||
import { achvs } from "#app/system/achv";
|
import { achvs } from "#app/system/achv";
|
||||||
import { handleTutorial, Tutorial } from "#app/tutorial";
|
import { handleTutorial, Tutorial } from "#app/tutorial";
|
||||||
import { UiMode } from "#enums/ui-mode";
|
import { UiMode } from "#enums/ui-mode";
|
||||||
@ -568,21 +567,27 @@ export class EncounterPhase extends BattlePhase {
|
|||||||
|
|
||||||
if (![BattleType.TRAINER, BattleType.MYSTERY_ENCOUNTER].includes(globalScene.currentBattle.battleType)) {
|
if (![BattleType.TRAINER, BattleType.MYSTERY_ENCOUNTER].includes(globalScene.currentBattle.battleType)) {
|
||||||
enemyField.map(p =>
|
enemyField.map(p =>
|
||||||
globalScene.phaseManager.pushConditionalPhase(new PostSummonPhase(p.getBattlerIndex()), () => {
|
globalScene.phaseManager.pushConditionalPhase(
|
||||||
// if there is not a player party, we can't continue
|
globalScene.phaseManager.create("PostSummonPhase", p.getBattlerIndex()),
|
||||||
if (!globalScene.getPlayerParty().length) {
|
() => {
|
||||||
return false;
|
// if there is not a player party, we can't continue
|
||||||
}
|
if (!globalScene.getPlayerParty().length) {
|
||||||
// how many player pokemon are on the field ?
|
return false;
|
||||||
const pokemonsOnFieldCount = globalScene.getPlayerParty().filter(p => p.isOnField()).length;
|
}
|
||||||
// if it's a 2vs1, there will never be a 2nd pokemon on our field even
|
// how many player pokemon are on the field ?
|
||||||
const requiredPokemonsOnField = Math.min(globalScene.getPlayerParty().filter(p => !p.isFainted()).length, 2);
|
const pokemonsOnFieldCount = globalScene.getPlayerParty().filter(p => p.isOnField()).length;
|
||||||
// if it's a double, there should be 2, otherwise 1
|
// if it's a 2vs1, there will never be a 2nd pokemon on our field even
|
||||||
if (globalScene.currentBattle.double) {
|
const requiredPokemonsOnField = Math.min(
|
||||||
return pokemonsOnFieldCount === requiredPokemonsOnField;
|
globalScene.getPlayerParty().filter(p => !p.isFainted()).length,
|
||||||
}
|
2,
|
||||||
return pokemonsOnFieldCount === 1;
|
);
|
||||||
}),
|
// if it's a double, there should be 2, otherwise 1
|
||||||
|
if (globalScene.currentBattle.double) {
|
||||||
|
return pokemonsOnFieldCount === requiredPokemonsOnField;
|
||||||
|
}
|
||||||
|
return pokemonsOnFieldCount === 1;
|
||||||
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
const ivScannerModifier = globalScene.findModifier(m => m instanceof IvScannerModifier);
|
const ivScannerModifier = globalScene.findModifier(m => m instanceof IvScannerModifier);
|
||||||
if (ivScannerModifier) {
|
if (ivScannerModifier) {
|
||||||
|
@ -9,8 +9,7 @@ import { trainerConfigs } from "#app/data/trainers/trainer-config";
|
|||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
import { modifierTypes } from "#app/modifier/modifier-type";
|
import { modifierTypes } from "#app/modifier/modifier-type";
|
||||||
import { BattlePhase } from "#app/phases/battle-phase";
|
import { BattlePhase } from "#app/phases/battle-phase";
|
||||||
import { EndCardPhase } from "#app/phases/end-card-phase";
|
import type { EndCardPhase } from "#app/phases/end-card-phase";
|
||||||
import { RibbonModifierRewardPhase } from "#app/phases/ribbon-modifier-reward-phase";
|
|
||||||
import { achvs, ChallengeAchv } from "#app/system/achv";
|
import { achvs, ChallengeAchv } from "#app/system/achv";
|
||||||
import { Unlockables } from "#app/system/unlockables";
|
import { Unlockables } from "#app/system/unlockables";
|
||||||
import { UiMode } from "#enums/ui-mode";
|
import { UiMode } from "#enums/ui-mode";
|
||||||
@ -153,9 +152,7 @@ export class GameOverPhase extends BattlePhase {
|
|||||||
this.handleUnlocks();
|
this.handleUnlocks();
|
||||||
|
|
||||||
for (const species of this.firstRibbons) {
|
for (const species of this.firstRibbons) {
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew("RibbonModifierRewardPhase", modifierTypes.VOUCHER_PLUS, species);
|
||||||
new RibbonModifierRewardPhase(modifierTypes.VOUCHER_PLUS, species),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
if (!firstClear) {
|
if (!firstClear) {
|
||||||
globalScene.phaseManager.unshiftNew("GameOverModifierRewardPhase", modifierTypes.VOUCHER_PREMIUM);
|
globalScene.phaseManager.unshiftNew("GameOverModifierRewardPhase", modifierTypes.VOUCHER_PREMIUM);
|
||||||
@ -192,7 +189,7 @@ export class GameOverPhase extends BattlePhase {
|
|||||||
() => {
|
() => {
|
||||||
globalScene.ui.fadeOut(500).then(() => {
|
globalScene.ui.fadeOut(500).then(() => {
|
||||||
globalScene.charSprite.hide().then(() => {
|
globalScene.charSprite.hide().then(() => {
|
||||||
const endCardPhase = new EndCardPhase();
|
const endCardPhase = globalScene.phaseManager.create("EndCardPhase");
|
||||||
globalScene.phaseManager.unshiftPhase(endCardPhase);
|
globalScene.phaseManager.unshiftPhase(endCardPhase);
|
||||||
clear(endCardPhase);
|
clear(endCardPhase);
|
||||||
});
|
});
|
||||||
@ -202,7 +199,7 @@ export class GameOverPhase extends BattlePhase {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const endCardPhase = new EndCardPhase();
|
const endCardPhase = globalScene.phaseManager.create("EndCardPhase");
|
||||||
globalScene.phaseManager.unshiftPhase(endCardPhase);
|
globalScene.phaseManager.unshiftPhase(endCardPhase);
|
||||||
clear(endCardPhase);
|
clear(endCardPhase);
|
||||||
}
|
}
|
||||||
|
@ -44,8 +44,13 @@ export class MessagePhase extends Phase {
|
|||||||
page0 = page0.split(repname[p]).join(pokename[p]);
|
page0 = page0.split(repname[p]).join(pokename[p]);
|
||||||
page1 = page1.split(repname[p]).join(pokename[p]);
|
page1 = page1.split(repname[p]).join(pokename[p]);
|
||||||
}
|
}
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew(
|
||||||
new MessagePhase(page1, this.callbackDelay, this.prompt, this.promptDelay, this.speaker),
|
"MessagePhase",
|
||||||
|
page1,
|
||||||
|
this.callbackDelay,
|
||||||
|
this.prompt,
|
||||||
|
this.promptDelay,
|
||||||
|
this.speaker,
|
||||||
);
|
);
|
||||||
this.text = page0.trim();
|
this.text = page0.trim();
|
||||||
} else {
|
} else {
|
||||||
|
@ -68,8 +68,6 @@ import { BattlerTagType } from "#enums/battler-tag-type";
|
|||||||
import { MoveId } from "#enums/move-id";
|
import { MoveId } from "#enums/move-id";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import type { Phase } from "#app/phase";
|
import type { Phase } from "#app/phase";
|
||||||
import { ShowAbilityPhase } from "./show-ability-phase";
|
|
||||||
import { HideAbilityPhase } from "#app/phases/hide-ability-phase";
|
|
||||||
import type { TypeDamageMultiplier } from "#app/data/type";
|
import type { TypeDamageMultiplier } from "#app/data/type";
|
||||||
import { HitCheckResult } from "#enums/hit-check-result";
|
import { HitCheckResult } from "#enums/hit-check-result";
|
||||||
import type Move from "#app/data/moves/move";
|
import type Move from "#app/data/moves/move";
|
||||||
@ -188,9 +186,13 @@ export class MoveEffectPhase extends PokemonPhase {
|
|||||||
// TODO: ability displays should be handled by the ability
|
// TODO: ability displays should be handled by the ability
|
||||||
if (!target.getTag(BattlerTagType.MAGIC_COAT)) {
|
if (!target.getTag(BattlerTagType.MAGIC_COAT)) {
|
||||||
this.queuedPhases.push(
|
this.queuedPhases.push(
|
||||||
new ShowAbilityPhase(target.getBattlerIndex(), target.getPassiveAbility().hasAttr(ReflectStatusMoveAbAttr)),
|
globalScene.phaseManager.create(
|
||||||
|
"ShowAbilityPhase",
|
||||||
|
target.getBattlerIndex(),
|
||||||
|
target.getPassiveAbility().hasAttr(ReflectStatusMoveAbAttr),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
this.queuedPhases.push(new HideAbilityPhase());
|
this.queuedPhases.push(globalScene.phaseManager.create("HideAbilityPhase"));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.queuedPhases.push(
|
this.queuedPhases.push(
|
||||||
|
@ -39,10 +39,6 @@ import { MoveResult } from "#app/field/pokemon";
|
|||||||
import { getPokemonNameWithAffix } from "#app/messages";
|
import { getPokemonNameWithAffix } from "#app/messages";
|
||||||
import Overrides from "#app/overrides";
|
import Overrides from "#app/overrides";
|
||||||
import { BattlePhase } from "#app/phases/battle-phase";
|
import { BattlePhase } from "#app/phases/battle-phase";
|
||||||
import { CommonAnimPhase } from "#app/phases/common-anim-phase";
|
|
||||||
import { MoveChargePhase } from "#app/phases/move-charge-phase";
|
|
||||||
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
|
|
||||||
import { MoveEndPhase } from "#app/phases/move-end-phase";
|
|
||||||
import { NumberHolder } from "#app/utils/common";
|
import { NumberHolder } from "#app/utils/common";
|
||||||
import { AbilityId } from "#enums/ability-id";
|
import { AbilityId } from "#enums/ability-id";
|
||||||
import { ArenaTagType } from "#enums/arena-tag-type";
|
import { ArenaTagType } from "#enums/arena-tag-type";
|
||||||
@ -271,12 +267,11 @@ export class MovePhase extends BattlePhase {
|
|||||||
globalScene.phaseManager.queueMessage(
|
globalScene.phaseManager.queueMessage(
|
||||||
getStatusEffectActivationText(this.pokemon.status.effect, getPokemonNameWithAffix(this.pokemon)),
|
getStatusEffectActivationText(this.pokemon.status.effect, getPokemonNameWithAffix(this.pokemon)),
|
||||||
);
|
);
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew(
|
||||||
new CommonAnimPhase(
|
"CommonAnimPhase",
|
||||||
this.pokemon.getBattlerIndex(),
|
this.pokemon.getBattlerIndex(),
|
||||||
undefined,
|
undefined,
|
||||||
CommonAnim.POISON + (this.pokemon.status.effect - 1),
|
CommonAnim.POISON + (this.pokemon.status.effect - 1),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
} else if (healed) {
|
} else if (healed) {
|
||||||
globalScene.phaseManager.queueMessage(
|
globalScene.phaseManager.queueMessage(
|
||||||
@ -407,8 +402,13 @@ export class MovePhase extends BattlePhase {
|
|||||||
if (success) {
|
if (success) {
|
||||||
const move = this.move.getMove();
|
const move = this.move.getMove();
|
||||||
applyPreAttackAbAttrs(PokemonTypeChangeAbAttr, this.pokemon, null, move);
|
applyPreAttackAbAttrs(PokemonTypeChangeAbAttr, this.pokemon, null, move);
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew(
|
||||||
new MoveEffectPhase(this.pokemon.getBattlerIndex(), this.targets, move, this.reflected, this.move.virtual),
|
"MoveEffectPhase",
|
||||||
|
this.pokemon.getBattlerIndex(),
|
||||||
|
this.targets,
|
||||||
|
move,
|
||||||
|
this.reflected,
|
||||||
|
this.move.virtual,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
if ([MoveId.ROAR, MoveId.WHIRLWIND, MoveId.TRICK_OR_TREAT, MoveId.FORESTS_CURSE].includes(this.move.moveId)) {
|
if ([MoveId.ROAR, MoveId.WHIRLWIND, MoveId.TRICK_OR_TREAT, MoveId.FORESTS_CURSE].includes(this.move.moveId)) {
|
||||||
@ -457,8 +457,11 @@ export class MovePhase extends BattlePhase {
|
|||||||
applyPreAttackAbAttrs(PokemonTypeChangeAbAttr, this.pokemon, null, this.move.getMove());
|
applyPreAttackAbAttrs(PokemonTypeChangeAbAttr, this.pokemon, null, this.move.getMove());
|
||||||
|
|
||||||
this.showMoveText();
|
this.showMoveText();
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew(
|
||||||
new MoveChargePhase(this.pokemon.getBattlerIndex(), this.targets[0], this.move),
|
"MoveChargePhase",
|
||||||
|
this.pokemon.getBattlerIndex(),
|
||||||
|
this.targets[0],
|
||||||
|
this.move,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
this.pokemon.pushMoveHistory({
|
this.pokemon.pushMoveHistory({
|
||||||
@ -481,8 +484,11 @@ export class MovePhase extends BattlePhase {
|
|||||||
* Queues a {@linkcode MoveEndPhase} and then ends the phase
|
* Queues a {@linkcode MoveEndPhase} and then ends the phase
|
||||||
*/
|
*/
|
||||||
public end(): void {
|
public end(): void {
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew(
|
||||||
new MoveEndPhase(this.pokemon.getBattlerIndex(), this.getActiveTargetPokemon(), this.followUp),
|
"MoveEndPhase",
|
||||||
|
this.pokemon.getBattlerIndex(),
|
||||||
|
this.getActiveTargetPokemon(),
|
||||||
|
this.followUp,
|
||||||
);
|
);
|
||||||
|
|
||||||
super.end();
|
super.end();
|
||||||
|
@ -9,7 +9,6 @@ import type Pokemon from "#app/field/pokemon";
|
|||||||
import { getPokemonNameWithAffix } from "#app/messages";
|
import { getPokemonNameWithAffix } from "#app/messages";
|
||||||
import { BattlePhase } from "./battle-phase";
|
import { BattlePhase } from "./battle-phase";
|
||||||
import type { MovePhase } from "./move-phase";
|
import type { MovePhase } from "./move-phase";
|
||||||
import { PokemonHealPhase } from "./pokemon-heal-phase";
|
|
||||||
import {
|
import {
|
||||||
applyAbAttrs,
|
applyAbAttrs,
|
||||||
ClearTerrainAbAttr,
|
ClearTerrainAbAttr,
|
||||||
@ -159,8 +158,15 @@ export class QuietFormChangePhase extends BattlePhase {
|
|||||||
this.pokemon.findAndRemoveTags(t => t.tagType === BattlerTagType.AUTOTOMIZED);
|
this.pokemon.findAndRemoveTags(t => t.tagType === BattlerTagType.AUTOTOMIZED);
|
||||||
if (globalScene?.currentBattle.battleSpec === BattleSpec.FINAL_BOSS && this.pokemon.isEnemy()) {
|
if (globalScene?.currentBattle.battleSpec === BattleSpec.FINAL_BOSS && this.pokemon.isEnemy()) {
|
||||||
globalScene.playBgm();
|
globalScene.playBgm();
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew(
|
||||||
new PokemonHealPhase(this.pokemon.getBattlerIndex(), this.pokemon.getMaxHp(), null, false, false, false, true),
|
"PokemonHealPhase",
|
||||||
|
this.pokemon.getBattlerIndex(),
|
||||||
|
this.pokemon.getMaxHp(),
|
||||||
|
null,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
);
|
);
|
||||||
this.pokemon.findAndRemoveTags(() => true);
|
this.pokemon.findAndRemoveTags(() => true);
|
||||||
this.pokemon.bossSegments = 5;
|
this.pokemon.bossSegments = 5;
|
||||||
|
@ -72,18 +72,17 @@ export class StatStageChangePhase extends PokemonPhase {
|
|||||||
if (this.stats.length > 1) {
|
if (this.stats.length > 1) {
|
||||||
for (let i = 0; i < this.stats.length; i++) {
|
for (let i = 0; i < this.stats.length; i++) {
|
||||||
const stat = [this.stats[i]];
|
const stat = [this.stats[i]];
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew(
|
||||||
new StatStageChangePhase(
|
"StatStageChangePhase",
|
||||||
this.battlerIndex,
|
this.battlerIndex,
|
||||||
this.selfTarget,
|
this.selfTarget,
|
||||||
stat,
|
stat,
|
||||||
this.stages,
|
this.stages,
|
||||||
this.showMessage,
|
this.showMessage,
|
||||||
this.ignoreAbilities,
|
this.ignoreAbilities,
|
||||||
this.canBeCopied,
|
this.canBeCopied,
|
||||||
this.onChange,
|
this.onChange,
|
||||||
this.comingFromMirrorArmorUser,
|
this.comingFromMirrorArmorUser,
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return this.end();
|
return this.end();
|
||||||
|
@ -3,7 +3,6 @@ import PartyUiHandler, { PartyOption, PartyUiMode } from "#app/ui/party-ui-handl
|
|||||||
import { UiMode } from "#enums/ui-mode";
|
import { UiMode } from "#enums/ui-mode";
|
||||||
import { SwitchType } from "#enums/switch-type";
|
import { SwitchType } from "#enums/switch-type";
|
||||||
import { BattlePhase } from "./battle-phase";
|
import { BattlePhase } from "./battle-phase";
|
||||||
import { SwitchSummonPhase } from "./switch-summon-phase";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens the party selector UI and transitions into a {@linkcode SwitchSummonPhase}
|
* Opens the party selector UI and transitions into a {@linkcode SwitchSummonPhase}
|
||||||
@ -80,9 +79,7 @@ export class SwitchPhase extends BattlePhase {
|
|||||||
p => p.is("PostSummonPhase") && p.player && p.fieldIndex === this.fieldIndex,
|
p => p.is("PostSummonPhase") && p.player && p.fieldIndex === this.fieldIndex,
|
||||||
);
|
);
|
||||||
const switchType = option === PartyOption.PASS_BATON ? SwitchType.BATON_PASS : this.switchType;
|
const switchType = option === PartyOption.PASS_BATON ? SwitchType.BATON_PASS : this.switchType;
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew("SwitchSummonPhase", switchType, fieldIndex, slotIndex, this.doReturn);
|
||||||
new SwitchSummonPhase(switchType, fieldIndex, slotIndex, this.doReturn),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => super.end());
|
globalScene.ui.setMode(UiMode.MESSAGE).then(() => super.end());
|
||||||
},
|
},
|
||||||
|
@ -14,7 +14,6 @@ import {
|
|||||||
} from "#app/modifier/modifier";
|
} from "#app/modifier/modifier";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { FieldPhase } from "./field-phase";
|
import { FieldPhase } from "./field-phase";
|
||||||
import { PokemonHealPhase } from "./pokemon-heal-phase";
|
|
||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
|
|
||||||
export class TurnEndPhase extends FieldPhase {
|
export class TurnEndPhase extends FieldPhase {
|
||||||
@ -34,15 +33,14 @@ export class TurnEndPhase extends FieldPhase {
|
|||||||
globalScene.applyModifiers(TurnHealModifier, pokemon.isPlayer(), pokemon);
|
globalScene.applyModifiers(TurnHealModifier, pokemon.isPlayer(), pokemon);
|
||||||
|
|
||||||
if (globalScene.arena.terrain?.terrainType === TerrainType.GRASSY && pokemon.isGrounded()) {
|
if (globalScene.arena.terrain?.terrainType === TerrainType.GRASSY && pokemon.isGrounded()) {
|
||||||
globalScene.phaseManager.unshiftPhase(
|
globalScene.phaseManager.unshiftNew(
|
||||||
new PokemonHealPhase(
|
"PokemonHealPhase",
|
||||||
pokemon.getBattlerIndex(),
|
pokemon.getBattlerIndex(),
|
||||||
Math.max(pokemon.getMaxHp() >> 4, 1),
|
Math.max(pokemon.getMaxHp() >> 4, 1),
|
||||||
i18next.t("battle:turnEndHpRestore", {
|
i18next.t("battle:turnEndHpRestore", {
|
||||||
pokemonName: getPokemonNameWithAffix(pokemon),
|
pokemonName: getPokemonNameWithAffix(pokemon),
|
||||||
}),
|
}),
|
||||||
true,
|
true,
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,8 +6,6 @@ import {
|
|||||||
import { TurnInitEvent } from "#app/events/battle-scene";
|
import { TurnInitEvent } from "#app/events/battle-scene";
|
||||||
import type { PlayerPokemon } from "#app/field/pokemon";
|
import type { PlayerPokemon } from "#app/field/pokemon";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { CommandPhase } from "./command-phase";
|
|
||||||
import { EnemyCommandPhase } from "./enemy-command-phase";
|
|
||||||
import { FieldPhase } from "./field-phase";
|
import { FieldPhase } from "./field-phase";
|
||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
|
|
||||||
@ -66,9 +64,11 @@ export class TurnInitPhase extends FieldPhase {
|
|||||||
|
|
||||||
pokemon.resetTurnData();
|
pokemon.resetTurnData();
|
||||||
|
|
||||||
globalScene.phaseManager.pushPhase(
|
if (pokemon.isPlayer()) {
|
||||||
pokemon.isPlayer() ? new CommandPhase(i) : new EnemyCommandPhase(i - BattlerIndex.ENEMY),
|
globalScene.phaseManager.pushNew("CommandPhase", i);
|
||||||
);
|
} else {
|
||||||
|
globalScene.phaseManager.pushNew("EnemyCommandPhase", i - BattlerIndex.ENEMY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@ import { BypassSpeedChanceModifier } from "#app/modifier/modifier";
|
|||||||
import { Command } from "#app/ui/command-ui-handler";
|
import { Command } from "#app/ui/command-ui-handler";
|
||||||
import { randSeedShuffle, BooleanHolder } from "#app/utils/common";
|
import { randSeedShuffle, BooleanHolder } from "#app/utils/common";
|
||||||
import { FieldPhase } from "./field-phase";
|
import { FieldPhase } from "./field-phase";
|
||||||
import { SwitchSummonPhase } from "./switch-summon-phase";
|
|
||||||
import { BattlerIndex } from "#app/battle";
|
import { BattlerIndex } from "#app/battle";
|
||||||
import { TrickRoomTag } from "#app/data/arena-tag";
|
import { TrickRoomTag } from "#app/data/arena-tag";
|
||||||
import { SwitchType } from "#enums/switch-type";
|
import { SwitchType } from "#enums/switch-type";
|
||||||
@ -203,8 +202,13 @@ export class TurnStartPhase extends FieldPhase {
|
|||||||
case Command.POKEMON:
|
case Command.POKEMON:
|
||||||
{
|
{
|
||||||
const switchType = turnCommand.args?.[0] ? SwitchType.BATON_PASS : SwitchType.SWITCH;
|
const switchType = turnCommand.args?.[0] ? SwitchType.BATON_PASS : SwitchType.SWITCH;
|
||||||
phaseManager.unshiftPhase(
|
phaseManager.unshiftNew(
|
||||||
new SwitchSummonPhase(switchType, pokemon.getFieldIndex(), turnCommand.cursor!, true, pokemon.isPlayer()),
|
"SwitchSummonPhase",
|
||||||
|
switchType,
|
||||||
|
pokemon.getFieldIndex(),
|
||||||
|
turnCommand.cursor!,
|
||||||
|
true,
|
||||||
|
pokemon.isPlayer(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -4,8 +4,6 @@ import { BattleType } from "#enums/battle-type";
|
|||||||
import type { CustomModifierSettings } from "#app/modifier/modifier-type";
|
import type { CustomModifierSettings } from "#app/modifier/modifier-type";
|
||||||
import { modifierTypes } from "#app/modifier/modifier-type";
|
import { modifierTypes } from "#app/modifier/modifier-type";
|
||||||
import { PokemonPhase } from "./pokemon-phase";
|
import { PokemonPhase } from "./pokemon-phase";
|
||||||
import { ModifierRewardPhase } from "./modifier-reward-phase";
|
|
||||||
import { SelectModifierPhase } from "./select-modifier-phase";
|
|
||||||
import { handleMysteryEncounterVictory } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
import { handleMysteryEncounterVictory } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
import { timedEventManager } from "#app/global-event-manager";
|
import { timedEventManager } from "#app/global-event-manager";
|
||||||
@ -66,8 +64,11 @@ export class VictoryPhase extends PokemonPhase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (globalScene.currentBattle.waveIndex % 10) {
|
if (globalScene.currentBattle.waveIndex % 10) {
|
||||||
globalScene.phaseManager.pushPhase(
|
globalScene.phaseManager.pushNew(
|
||||||
new SelectModifierPhase(undefined, undefined, this.getFixedBattleCustomModifiers()),
|
"SelectModifierPhase",
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
this.getFixedBattleCustomModifiers(),
|
||||||
);
|
);
|
||||||
} else if (globalScene.gameMode.isDaily) {
|
} else if (globalScene.gameMode.isDaily) {
|
||||||
globalScene.phaseManager.pushNew("ModifierRewardPhase", modifierTypes.EXP_CHARM);
|
globalScene.phaseManager.pushNew("ModifierRewardPhase", modifierTypes.EXP_CHARM);
|
||||||
@ -86,24 +87,20 @@ export class VictoryPhase extends PokemonPhase {
|
|||||||
globalScene.currentBattle.waveIndex <= 750 &&
|
globalScene.currentBattle.waveIndex <= 750 &&
|
||||||
(globalScene.currentBattle.waveIndex <= 500 || globalScene.currentBattle.waveIndex % 30 === superExpWave)
|
(globalScene.currentBattle.waveIndex <= 500 || globalScene.currentBattle.waveIndex % 30 === superExpWave)
|
||||||
) {
|
) {
|
||||||
globalScene.phaseManager.pushPhase(
|
globalScene.phaseManager.pushNew(
|
||||||
new ModifierRewardPhase(
|
"ModifierRewardPhase",
|
||||||
globalScene.currentBattle.waveIndex % 30 !== superExpWave || globalScene.currentBattle.waveIndex > 250
|
globalScene.currentBattle.waveIndex % 30 !== superExpWave || globalScene.currentBattle.waveIndex > 250
|
||||||
? modifierTypes.EXP_CHARM
|
? modifierTypes.EXP_CHARM
|
||||||
: modifierTypes.SUPER_EXP_CHARM,
|
: modifierTypes.SUPER_EXP_CHARM,
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (globalScene.currentBattle.waveIndex <= 150 && !(globalScene.currentBattle.waveIndex % 50)) {
|
if (globalScene.currentBattle.waveIndex <= 150 && !(globalScene.currentBattle.waveIndex % 50)) {
|
||||||
globalScene.phaseManager.pushNew("ModifierRewardPhase", modifierTypes.GOLDEN_POKEBALL);
|
globalScene.phaseManager.pushNew("ModifierRewardPhase", modifierTypes.GOLDEN_POKEBALL);
|
||||||
}
|
}
|
||||||
if (globalScene.gameMode.isEndless && !(globalScene.currentBattle.waveIndex % 50)) {
|
if (globalScene.gameMode.isEndless && !(globalScene.currentBattle.waveIndex % 50)) {
|
||||||
globalScene.phaseManager.pushPhase(
|
globalScene.phaseManager.pushNew(
|
||||||
new ModifierRewardPhase(
|
"ModifierRewardPhase",
|
||||||
!(globalScene.currentBattle.waveIndex % 250)
|
!(globalScene.currentBattle.waveIndex % 250) ? modifierTypes.VOUCHER_PREMIUM : modifierTypes.VOUCHER_PLUS,
|
||||||
? modifierTypes.VOUCHER_PREMIUM
|
|
||||||
: modifierTypes.VOUCHER_PLUS,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
globalScene.phaseManager.pushNew("AddEnemyBuffModifierPhase");
|
globalScene.phaseManager.pushNew("AddEnemyBuffModifierPhase");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user