diff --git a/src/data/move.ts b/src/data/move.ts index a4c6717b497..64fade29567 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -1960,9 +1960,9 @@ export class ResetStatsAttr extends MoveEffectAttr { } /** - * Attribute used for moves which swap the user and the target's stat changes. + * Attribute used for moves which swap the user and the target's battle stat changes. */ -export class SwapStatsAttr extends MoveEffectAttr +export class SwapBattleStatsAttr extends MoveEffectAttr { public statsToSwap: BattleStat[]; @@ -1972,7 +1972,7 @@ export class SwapStatsAttr extends MoveEffectAttr this.statsToSwap = statToSwap; } /** - * Swaps the user and the target's stat changes. + * Swaps the user and the target's battle stat changes. * @param user Pokemon that used the move * @param target The target of the move * @param move Move with this attribute @@ -1988,7 +1988,7 @@ export class SwapStatsAttr extends MoveEffectAttr const targetBattleStat = target.summonData.battleStats; this.statsToSwap.forEach(stat => { - let userStat = userBattleStat[stat]; + const userStat = userBattleStat[stat]; userBattleStat[stat] = targetBattleStat[stat]; targetBattleStat[stat] = userStat; }); @@ -2000,39 +2000,24 @@ export class SwapStatsAttr extends MoveEffectAttr target.scene.queueMessage(getPokemonMessage(user, ' switched stat changes with the target!')); } else { - const statsName = this.statsToSwap.map(stat => getBattleStatName(stat)); - target.scene.queueMessage(getPokemonMessage(user, ' switched all changes to its ' + statsName.join(' and ') + ' with its target!')); + const statsNames = this.statsToSwap.map(stat => getBattleStatName(stat)); + const lastStat = statsNames.pop(); + let statsMessage = ''; + + if (statsNames.length) { + statsMessage = statsNames.join(', ') + ` and ${lastStat}`; + } + else { + statsMessage = lastStat; + } + + target.scene.queueMessage(getPokemonMessage(user, ` switched all changes to its ${statsMessage} with its target!`)); } return true; } } -export class SpeedSwapAttr extends MoveEffectAttr -{ - /** - * Swaps the user and the target's stat changes. - * @param user Pokemon that used the move - * @param target The target of the move - * @param move Move with this attribute - * @param args N/A - * @returns true if the function succeeds - */ - apply(user: Pokemon, target: Pokemon, move: Move, args: any []): boolean - { - if (!super.apply(user, target, move, args)) - return false; - - const userSpeed = user.stats[Stat.SPD]; - user.stats[Stat.SPD] = target.stats[BattleStat.SPD]; - target.stats[Stat.SPD] = userSpeed; - - target.scene.queueMessage(getPokemonMessage(user, ' switched Speed with its target!')); - - return true; - } -} - export class HpSplitAttr extends MoveEffectAttr { apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): Promise { return new Promise(resolve => { @@ -5525,9 +5510,9 @@ export function initMoves() { .attr(CopyMoveAttr) .ignoresVirtual(), new StatusMove(Moves.POWER_SWAP, Type.PSYCHIC, -1, 10, -1, 0, 4) - .attr(SwapStatsAttr, [BattleStat.ATK, BattleStat.SPATK]), + .attr(SwapBattleStatsAttr, [BattleStat.ATK, BattleStat.SPATK]), new StatusMove(Moves.GUARD_SWAP, Type.PSYCHIC, -1, 10, -1, 0, 4) - .attr(SwapStatsAttr, [BattleStat.DEF, BattleStat.SPDEF]), + .attr(SwapBattleStatsAttr, [BattleStat.DEF, BattleStat.SPDEF]), new AttackMove(Moves.PUNISHMENT, Type.DARK, MoveCategory.PHYSICAL, -1, 100, 5, -1, 0, 4) .unimplemented(), new AttackMove(Moves.LAST_RESORT, Type.NORMAL, MoveCategory.PHYSICAL, 140, 100, 5, -1, 0, 4) @@ -5540,7 +5525,7 @@ export function initMoves() { .attr(AddArenaTrapTagAttr, ArenaTagType.TOXIC_SPIKES) .target(MoveTarget.ENEMY_SIDE), new StatusMove(Moves.HEART_SWAP, Type.PSYCHIC, -1, 10, -1, 0, 4) - .attr(SwapStatsAttr), + .attr(SwapBattleStatsAttr), new SelfStatusMove(Moves.AQUA_RING, Type.WATER, -1, 20, -1, 0, 4) .attr(AddBattlerTagAttr, BattlerTagType.AQUA_RING, true, true), new SelfStatusMove(Moves.MAGNET_RISE, Type.ELECTRIC, -1, 10, -1, 0, 4) @@ -6364,7 +6349,7 @@ export function initMoves() { user.scene.queueMessage(getPokemonMessage(user, ` burned itself out!`)); }), new StatusMove(Moves.SPEED_SWAP, Type.PSYCHIC, -1, 10, -1, 0, 7) - .attr(SpeedSwapAttr), + .unimplemented(), new AttackMove(Moves.SMART_STRIKE, Type.STEEL, MoveCategory.PHYSICAL, 70, -1, 10, -1, 0, 7), new StatusMove(Moves.PURIFY, Type.POISON, -1, 20, -1, 0, 7) .triageMove()