From 3fea44de6fdc8eab601183c4a2394d2fc3d7a619 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Wed, 6 Mar 2024 22:41:55 -0500 Subject: [PATCH] Fix bug with trainer double battles and implement Magnetic Flux move --- src/data/move.ts | 8 +++++--- src/phases.ts | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/data/move.ts b/src/data/move.ts index 2905e620e..15b9cd251 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -3096,7 +3096,7 @@ export function initMoves() { new StatusMove(Moves.BLOCK, "Block", Type.NORMAL, -1, 5, -1, "The user blocks the target's way with arms spread wide to prevent escape.", -1, 0, 3) .attr(AddBattlerTagAttr, BattlerTagType.TRAPPED, false, true, 1), new StatusMove(Moves.HOWL, "Howl", Type.NORMAL, -1, 40, -1, "The user howls loudly to raise the spirit of itself and allies. This raises their Attack stats.", -1, 0, 3) - .attr(StatChangeAttr, BattleStat.ATK, 1, true) + .attr(StatChangeAttr, BattleStat.ATK, 1) .soundBased() .target(MoveTarget.USER_AND_ALLIES), new AttackMove(Moves.DRAGON_CLAW, "Dragon Claw", Type.DRAGON, MoveCategory.PHYSICAL, 80, 100, 15, 78, "The user slashes the target with huge sharp claws.", -1, 0, 3), @@ -3688,8 +3688,10 @@ export function initMoves() { .attr(ChargeAttr, ChargeAnim.GEOMANCY_CHARGING, "is charging its power!") .attr(StatChangeAttr, [ BattleStat.SPATK, BattleStat.SPDEF, BattleStat.SPD ], 2, true) .ignoresVirtual(), - new StatusMove(Moves.MAGNETIC_FLUX, "Magnetic Flux (N)", Type.ELECTRIC, -1, 20, -1, "The user manipulates magnetic fields, which raises the Defense and Sp. Def stats of ally Pokémon with the Plus or Minus Ability.", -1, 0, 6) - .target(MoveTarget.USER_AND_ALLIES), + new StatusMove(Moves.MAGNETIC_FLUX, "Magnetic Flux", Type.ELECTRIC, -1, 20, -1, "The user manipulates magnetic fields, which raises the Defense and Sp. Def stats of ally Pokémon with the Plus or Minus Ability.", -1, 0, 6) + .attr(StatChangeAttr, [ BattleStat.DEF, BattleStat.SPDEF ], 1, false, (user, target, move) => !![ Abilities.PLUS, Abilities.MINUS].find(a => a === user.getAbility().id)) + .target(MoveTarget.USER_AND_ALLIES) + .condition((user, target, move) => !![ user, user.getAlly() ].filter(p => p?.isActive()).find(p => !![ Abilities.PLUS, Abilities.MINUS].find(a => a === p.getAbility().id))), new StatusMove(Moves.HAPPY_HOUR, "Happy Hour (N)", Type.NORMAL, -1, 30, -1, "Using Happy Hour doubles the amount of prize money received after battle.", -1, 0, 6) // No animation .target(MoveTarget.USER_SIDE), new StatusMove(Moves.ELECTRIC_TERRAIN, "Electric Terrain (N)", Type.ELECTRIC, -1, 10, -1, "The user electrifies the ground for five turns, powering up Electric-type moves. Pokémon on the ground no longer fall asleep.", -1, 0, 6) diff --git a/src/phases.ts b/src/phases.ts index a5fb458f1..75f053c9c 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -1072,8 +1072,10 @@ export class SwitchSummonPhase extends SummonPhase { if (!this.player) { if (this.slotIndex === -1) this.slotIndex = this.scene.currentBattle.trainer.getNextSummonIndex(); - this.showEnemyTrainer(); - this.scene.pbTrayEnemy.showPbTray(this.scene.getEnemyParty()); + if (this.slotIndex > -1) { + this.showEnemyTrainer(); + this.scene.pbTrayEnemy.showPbTray(this.scene.getEnemyParty()); + } } if (!this.doReturn || (this.slotIndex !== -1 && !(this.player ? this.scene.getParty() : this.scene.getEnemyParty())[this.slotIndex])) {