Fix fainted ally targeted attacks redirecting to self
parent
48ff8b248b
commit
23a8fb1fc9
|
@ -623,7 +623,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm {
|
|||
|
||||
getFormSpriteKey(formIndex?: integer) {
|
||||
if (this.forms.length && formIndex >= this.forms.length) {
|
||||
console.warn(`Attempted accessing form with index ${formIndex} of species ${this.getName()} with only ${this.forms?.length || 0} forms`);
|
||||
console.warn(`Attempted accessing form with index ${formIndex} of species ${this.getName()} with only ${this.forms.length || 0} forms`);
|
||||
formIndex = Math.min(formIndex, this.forms.length - 1);
|
||||
}
|
||||
return this.forms?.length
|
||||
|
|
|
@ -2850,7 +2850,7 @@ export class FaintPhase extends PokemonPhase {
|
|||
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;
|
||||
targetingMovePhase = this.scene.findPhase(mp => mp instanceof MovePhase && mp.targets.length === 1 && mp.targets[0] === pokemon.getBattlerIndex() && mp.pokemon.isPlayer() !== allyPokemon.isPlayer()) as MovePhase;
|
||||
if (targetingMovePhase && targetingMovePhase.targets[0] !== allyPokemon.getBattlerIndex())
|
||||
targetingMovePhase.targets[0] = allyPokemon.getBattlerIndex();
|
||||
} while (targetingMovePhase);
|
||||
|
|
Loading…
Reference in New Issue