diff --git a/src/data/abilities/ability.ts b/src/data/abilities/ability.ts index 5d70ed191ca..37f5b22d007 100644 --- a/src/data/abilities/ability.ts +++ b/src/data/abilities/ability.ts @@ -3081,7 +3081,7 @@ export class PostSummonUserFieldRemoveStatusEffectAbAttr extends PostSummonAbAtt return; } - for (const p of pokemon.getAlliedField()) { + for (const p of pokemon.getAlliesGenerator()) { if (p.status && this.statusEffect.includes(p.status.effect)) { globalScene.phaseManager.queueMessage(getStatusEffectHealText(p.status.effect, getPokemonNameWithAffix(p))); p.resetStatus(false); diff --git a/src/data/arena-tag.ts b/src/data/arena-tag.ts index dffca78e77a..16843884bd6 100644 --- a/src/data/arena-tag.ts +++ b/src/data/arena-tag.ts @@ -1280,7 +1280,7 @@ class TailwindTag extends SerializableArenaTag { ); } - for (const pokemon of source.getAlliedField()) { + for (const pokemon of source.getAlliesGenerator()) { // Apply the CHARGED tag to party members with the WIND_POWER ability // TODO: This should not be handled here if (pokemon.hasAbility(AbilityId.WIND_POWER) && !pokemon.getTag(BattlerTagType.CHARGED)) { diff --git a/src/data/moves/move.ts b/src/data/moves/move.ts index 77f2af29398..0fb8cb4968b 100644 --- a/src/data/moves/move.ts +++ b/src/data/moves/move.ts @@ -860,7 +860,7 @@ export abstract class Move implements Localizable { aura.apply({pokemon: source, simulated, opponent: target, move: this, power}); } - for (const p of source.getAlliedField()) { + for (const p of source.getAlliesGenerator()) { applyAbAttrs("UserFieldMoveTypePowerBoostAbAttr", {pokemon: p, opponent: target, move: this, simulated, power}); } diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 0e1e1a93c5e..13390d4e4fa 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -2465,7 +2465,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container { } if (!cancelledHolder.value) { - for (const p of this.getAlliedField()) { + for (const p of this.getAlliesGenerator()) { applyAbAttrs("FieldPriorityMoveImmunityAbAttr", { pokemon: p, opponent: source, @@ -3233,7 +3233,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container { } /** - * Returns the pokemon that oppose this one and are active + * Returns the pokemon that oppose this one and are active in non-speed order * * @param onField - whether to also check if the pokemon is currently on the field (defaults to true) */ @@ -3243,6 +3243,9 @@ export abstract class Pokemon extends Phaser.GameObjects.Container { ); } + /** + * @returns A generator of pokemon that oppose this one in speed order + */ public getOpponentsGenerator(): Generator { return inSpeedOrder(this.isPlayer() ? ArenaTagSide.ENEMY : ArenaTagSide.PLAYER); } @@ -3256,11 +3259,9 @@ export abstract class Pokemon extends Phaser.GameObjects.Container { } /** - * Gets the Pokémon on the allied field. - * * @returns An generator of Pokémon on the allied field in speed order. */ - getAlliedField(): Generator { + getAlliesGenerator(): Generator { return inSpeedOrder(this.isPlayer() ? ArenaTagSide.PLAYER : ArenaTagSide.ENEMY); } @@ -4025,7 +4026,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container { const cancelled = new BooleanHolder(false); applyAbAttrs("BattlerTagImmunityAbAttr", { pokemon: this, tag: stubTag, cancelled, simulated: true }); - for (const pokemon of this.getAlliedField()) { + for (const pokemon of this.getAlliesGenerator()) { applyAbAttrs("UserFieldBattlerTagImmunityAbAttr", { pokemon, tag: stubTag, @@ -4067,7 +4068,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container { return false; } - for (const pokemon of this.getAlliedField()) { + for (const pokemon of this.getAlliesGenerator()) { applyAbAttrs("UserFieldBattlerTagImmunityAbAttr", { pokemon, tag: newTag, cancelled, target: this }); if (cancelled.value) { return false; @@ -4785,7 +4786,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container { return false; } - for (const pokemon of this.getAlliedField()) { + for (const pokemon of this.getAlliesGenerator()) { applyAbAttrs("UserFieldStatusEffectImmunityAbAttr", { pokemon, effect, diff --git a/src/modifier/modifier.ts b/src/modifier/modifier.ts index c95c349e65f..fabfad043f3 100644 --- a/src/modifier/modifier.ts +++ b/src/modifier/modifier.ts @@ -1915,7 +1915,7 @@ export class PokemonInstantReviveModifier extends PokemonHeldItemModifier { // Remove the Pokemon's FAINT status pokemon.resetStatus(true, false, true, false); - for (const p of pokemon.getAlliedField()) { + for (const p of pokemon.getAlliesGenerator()) { applyAbAttrs("CommanderAbAttr", { pokemon: p }); } return true; diff --git a/src/phases/post-summon-phase.ts b/src/phases/post-summon-phase.ts index 70a45ad802c..b514d726e04 100644 --- a/src/phases/post-summon-phase.ts +++ b/src/phases/post-summon-phase.ts @@ -39,7 +39,7 @@ export class PostSummonPhase extends PokemonPhase { ) { pokemon.lapseTag(BattlerTagType.MYSTERY_ENCOUNTER_POST_SUMMON); } - for (const p of pokemon.getAlliedField()) { + for (const p of pokemon.getAlliesGenerator()) { applyAbAttrs("CommanderAbAttr", { pokemon: p }); }