Don't allow instant revivals for a one hit KO move

pull/2/head
Flashfyre 2023-11-07 20:02:42 -05:00
parent fdc1bc5b61
commit 39a458cb3a
2 changed files with 20 additions and 14 deletions

View File

@ -2011,8 +2011,12 @@ export class DamagePhase extends PokemonPhase {
} }
export class FaintPhase extends PokemonPhase { export class FaintPhase extends PokemonPhase {
constructor(scene: BattleScene, battlerIndex: BattlerIndex) { private preventEndure: boolean;
constructor(scene: BattleScene, battlerIndex: BattlerIndex, preventEndure?: boolean) {
super(scene, battlerIndex); super(scene, battlerIndex);
this.preventEndure = preventEndure;
} }
start() { start() {
@ -2020,6 +2024,7 @@ export class FaintPhase extends PokemonPhase {
const pokemon = this.getPokemon(); const pokemon = this.getPokemon();
if (!this.preventEndure) {
const instantReviveModifier = this.scene.applyModifier(PokemonInstantReviveModifier, this.player, this.getPokemon()) as PokemonInstantReviveModifier; const instantReviveModifier = this.scene.applyModifier(PokemonInstantReviveModifier, this.player, this.getPokemon()) as PokemonInstantReviveModifier;
if (instantReviveModifier) { if (instantReviveModifier) {
@ -2036,6 +2041,7 @@ export class FaintPhase extends PokemonPhase {
return this.end(); return this.end();
} }
} }
}
this.scene.queueMessage(getPokemonMessage(pokemon, ' fainted!'), null, true); this.scene.queueMessage(getPokemonMessage(pokemon, ' fainted!'), null, true);

View File

@ -858,7 +858,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
this.hp = Math.max(this.hp - damage, 0); this.hp = Math.max(this.hp - damage, 0);
if (this.isFainted()) { if (this.isFainted()) {
this.scene.unshiftPhase(new FaintPhase(this.scene, this.getBattlerIndex())); this.scene.unshiftPhase(new FaintPhase(this.scene, this.getBattlerIndex(), preventEndure));
this.resetSummonData(); this.resetSummonData();
} }
} }