Add move target redirection
parent
2cc38ac2cb
commit
f0b00f9f27
|
@ -1954,7 +1954,7 @@ export class CommonAnimPhase extends PokemonPhase {
|
||||||
export class MovePhase extends BattlePhase {
|
export class MovePhase extends BattlePhase {
|
||||||
public pokemon: Pokemon;
|
public pokemon: Pokemon;
|
||||||
public move: PokemonMove;
|
public move: PokemonMove;
|
||||||
protected targets: BattlerIndex[];
|
public targets: BattlerIndex[];
|
||||||
protected followUp: boolean;
|
protected followUp: boolean;
|
||||||
protected ignorePp: boolean;
|
protected ignorePp: boolean;
|
||||||
protected cancelled: boolean;
|
protected cancelled: boolean;
|
||||||
|
@ -2849,6 +2849,18 @@ export class FaintPhase extends PokemonPhase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.scene.currentBattle.double) {
|
||||||
|
const allyPokemon = pokemon.getAlly();
|
||||||
|
if (allyPokemon?.isActive(true)) {
|
||||||
|
let targetingMovePhase: MovePhase;
|
||||||
|
do {
|
||||||
|
targetingMovePhase = this.scene.findPhase(mp => mp instanceof MovePhase && mp.targets.length === 1 && mp.targets[0] === pokemon.getBattlerIndex()) as MovePhase;
|
||||||
|
if (targetingMovePhase && targetingMovePhase.targets[0] !== allyPokemon.getBattlerIndex())
|
||||||
|
targetingMovePhase.targets[0] = allyPokemon.getBattlerIndex();
|
||||||
|
} while (targetingMovePhase);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pokemon.lapseTags(BattlerTagLapseType.FAINT);
|
pokemon.lapseTags(BattlerTagLapseType.FAINT);
|
||||||
this.scene.getField(true).filter(p => p !== pokemon).forEach(p => p.removeTagsBySourceId(pokemon.id));
|
this.scene.getField(true).filter(p => p !== pokemon).forEach(p => p.removeTagsBySourceId(pokemon.id));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue