Adding clause so right Pokemon in double battle cannot target itself with a spread move when left one dies with no replacement (#1370)

This commit is contained in:
td76099 2024-05-25 15:06:50 -04:00 committed by GitHub
parent 93c91bf73a
commit ae0cd86bc3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2646,8 +2646,14 @@ export class MoveEffectPhase extends PokemonPhase {
constructor(scene: BattleScene, battlerIndex: BattlerIndex, targets: BattlerIndex[], move: PokemonMove) {
super(scene, battlerIndex);
this.move = move;
// In double battles, if the right Pokemon selects a spread move and the left Pokemon dies
// with no party members available to switch in, then the right Pokemon takes the index
// of the left Pokemon and gets hit unless this is checked.
if (targets.includes(battlerIndex) && this.move.getMove().moveTarget === MoveTarget.ALL_NEAR_OTHERS) {
const i = targets.indexOf(battlerIndex);
targets.splice(i,i+1);
}
this.targets = targets;
}