Add failsafe for held item on nonexistent Pokemon
parent
2ec0c32487
commit
f2c35e36ef
|
@ -898,6 +898,11 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
player = true;
|
player = true;
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
const modifiers = player ? this.modifiers : this.enemyModifiers as PersistentModifier[];
|
const modifiers = player ? this.modifiers : this.enemyModifiers as PersistentModifier[];
|
||||||
|
for (let m = 0; m < modifiers.length; m++) {
|
||||||
|
const modifier = modifiers[m];
|
||||||
|
if (modifier instanceof PokemonHeldItemModifier && !this.getPokemonById((modifier as PokemonHeldItemModifier).pokemonId))
|
||||||
|
modifiers.splice(m--, 1);
|
||||||
|
}
|
||||||
for (let modifier of modifiers) {
|
for (let modifier of modifiers) {
|
||||||
if (modifier instanceof PersistentModifier)
|
if (modifier instanceof PersistentModifier)
|
||||||
(modifier as PersistentModifier).virtualStackCount = 0;
|
(modifier as PersistentModifier).virtualStackCount = 0;
|
||||||
|
|
Loading…
Reference in New Issue