Move `try/catch` inside `for` loop

Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
This commit is contained in:
NightKev 2025-04-07 15:57:50 -07:00
parent cb5deb408f
commit 17a56cc6c1
1 changed files with 6 additions and 4 deletions

View File

@ -73,10 +73,12 @@ export class BattleEndPhase extends BattlePhase {
}
globalScene.clearEnemyHeldItemModifiers();
try {
globalScene.getEnemyParty().forEach(p => p.destroy());
} catch {
console.warn("Unable to destroy stale pokemon objects in BattleEndPhase.");
for (const p of globalScene.getEnemyParty()) {
try {
p.destroy();
} catch {
console.warn("Unable to destroy stale pokemon objects in BattleEndPhase.");
}
}
const lapsingModifiers = globalScene.findModifiers(