diff --git a/src/data/ability.ts b/src/data/ability.ts index 31f41492ba7..3e711efc76b 100755 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -23,7 +23,7 @@ import { Command } from "../ui/command-ui-handler"; import { BerryModifierType } from "#app/modifier/modifier-type"; import { getPokeballName } from "./pokeball"; import { Species } from "./enums/species"; -import {BattlerIndex} from "#app/battle"; +import { BattlerIndex } from "#app/battle"; export class Ability implements Localizable { public id: Abilities; @@ -2764,8 +2764,12 @@ export class PostDancingMoveAbAttr extends PostMoveUsedAbAttr { * @return true if the Dancer ability was resolved */ applyPostMoveUsed(dancer: Pokemon, move: PokemonMove, source: Pokemon, targets: BattlerIndex[], args: any[]): boolean | Promise { + // List of tags that prevent the Dancer from replicating the move + const forbiddenTags = [BattlerTagType.FLYING, BattlerTagType.UNDERWATER, + BattlerTagType.UNDERGROUND, BattlerTagType.HIDDEN]; // The move to replicate cannot come from the Dancer - if (source.getBattlerIndex() !== dancer.getBattlerIndex()) { + if (source.getBattlerIndex() !== dancer.getBattlerIndex() + && !dancer.summonData.tags.some(tag => forbiddenTags.includes(tag.tagType))) { // If the move is an AttackMove or a StatusMove the Dancer must replicate the move on the source of the Dance if (move.getMove() instanceof AttackMove || move.getMove() instanceof StatusMove) { const target = this.getTarget(dancer, source, targets); @@ -2774,8 +2778,9 @@ export class PostDancingMoveAbAttr extends PostMoveUsedAbAttr { // If the move is a SelfStatusMove (ie. Swords Dance) the Dancer should replicate it on itself dancer.scene.unshiftPhase(new MovePhase(dancer.scene, dancer, [dancer.getBattlerIndex()], move, true)); } + return true; } - return true; + return false; } /** diff --git a/src/phases.ts b/src/phases.ts index c9c93ab414d..a31cd4297aa 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -2583,7 +2583,7 @@ export class MovePhase extends BattlePhase { this.scene.getPlayerField().forEach(pokemon => { applyPostMoveUsedAbAttrs(PostMoveUsedAbAttr, pokemon, this.move, this.pokemon, this.targets); }); - this.scene.getEnemyParty().forEach(pokemon => { + this.scene.getEnemyField().forEach(pokemon => { applyPostMoveUsedAbAttrs(PostMoveUsedAbAttr, pokemon, this.move, this.pokemon, this.targets); }); }