[Refactor] Delete stale pokemon objects at the end of a battle

This commit is contained in:
damocleas 2025-04-08 18:10:39 -04:00 committed by GitHub
commit b3a4c75c06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -73,6 +73,13 @@ export class BattleEndPhase extends BattlePhase {
}
globalScene.clearEnemyHeldItemModifiers();
for (const p of globalScene.getEnemyParty()) {
try {
p.destroy();
} catch {
console.warn("Unable to destroy stale pokemon object in BattleEndPhase:", p);
}
}
const lapsingModifiers = globalScene.findModifiers(
m => m instanceof LapsingPersistentModifier || m instanceof LapsingPokemonHeldItemModifier,