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

This commit is contained in:
Flashfyre committed 2023-11-07 20:02:42 -05:00
1 parent fdc1bc5b61
commit 39a458cb3a
2 files changed
+20 -14

No files matched your search

+19 -13
View File
@@ -2011,8 +2011,12 @@ export class DamagePhase 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);
this.preventEndure = preventEndure;
}
start() {
@@ -2020,20 +2024,22 @@ export class FaintPhase extends PokemonPhase {
const pokemon = this.getPokemon();
const instantReviveModifier = this.scene.applyModifier(PokemonInstantReviveModifier, this.player, this.getPokemon()) as PokemonInstantReviveModifier;
if (!this.preventEndure) {
const instantReviveModifier = this.scene.applyModifier(PokemonInstantReviveModifier, this.player, this.getPokemon()) as PokemonInstantReviveModifier;
if (instantReviveModifier) {
if (!--instantReviveModifier.stackCount)
this.scene.removeModifier(instantReviveModifier);
this.scene.updateModifiers(this.player);
return this.end();
}
if (instantReviveModifier) {
if (!--instantReviveModifier.stackCount)
this.scene.removeModifier(instantReviveModifier);
this.scene.updateModifiers(this.player);
return this.end();
}
if (!pokemon.isPlayer()) {
const enemyInstantReviveModifiers = this.scene.findModifiers(m => m instanceof EnemyInstantReviveChanceModifier, false);
for (let modifier of enemyInstantReviveModifiers) {
if (modifier.shouldApply([ pokemon ]) && modifier.apply([ pokemon ]))
return this.end();
if (!pokemon.isPlayer()) {
const enemyInstantReviveModifiers = this.scene.findModifiers(m => m instanceof EnemyInstantReviveChanceModifier, false);
for (let modifier of enemyInstantReviveModifiers) {
if (modifier.shouldApply([ pokemon ]) && modifier.apply([ pokemon ]))
return this.end();
}
}
}
+1 -1
View File
@@ -858,7 +858,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
this.hp = Math.max(this.hp - damage, 0);
if (this.isFainted()) {
this.scene.unshiftPhase(new FaintPhase(this.scene, this.getBattlerIndex()));
this.scene.unshiftPhase(new FaintPhase(this.scene, this.getBattlerIndex(), preventEndure));
this.resetSummonData();
}
}