diff --git a/include/battle_z_move.h b/include/battle_z_move.h index 697bfa676c..92fb685b2f 100644 --- a/include/battle_z_move.h +++ b/include/battle_z_move.h @@ -21,6 +21,7 @@ void CreateZMoveTriggerSprite(u8, bool8); void HideZMoveTriggerSprite(void); bool32 IsZMoveTriggerSpriteActive(void); void DestroyZMoveTriggerSprite(void); +u16 GetTypeBasedZMove(u16 move, u8 battler); bool32 MoveSelectionDisplayZMove(u16 zmove, u32 battler); void SetZEffect(void); bool32 IsZMoveUsable(u8 battler, u16 moveIndex); diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index e3c6b2f7a5..c4d67e7024 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -10981,7 +10981,17 @@ static void Cmd_tryhealhalfhealth(void) static void SetMoveForMirrorMove(u32 move) { gHitMarker &= ~HITMARKER_ATTACKSTRING_PRINTED; - gCurrentMove = move; + // Edge case, we used Z Mirror Move, got the stat boost and now need to use the Z-move + if (gBattleStruct->zmove.toBeUsed[gBattlerAttacker] && !IS_MOVE_STATUS(move)) + { + gCurrentMove = gBattleStruct->zmove.chosenZMove = GetTypeBasedZMove(move, gBattlerAttacker); + QueueZMove(gBattlerAttacker, move); + } + else + { + gCurrentMove = move; + } + SetAtkCancellerForCalledMove(); gBattlerTarget = GetMoveTarget(gCurrentMove, NO_TARGET_OVERRIDE); gBattlescriptCurrInstr = GET_MOVE_BATTLESCRIPT(gCurrentMove); diff --git a/src/battle_util.c b/src/battle_util.c index 523026f8eb..08562e4295 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3518,6 +3518,9 @@ u8 AtkCanceller_UnableToUseMove(u32 moveType) case CANCELLER_Z_MOVES: if (gBattleStruct->zmove.toBeUsed[gBattlerAttacker] != MOVE_NONE) { + // For Z-Mirror Move, so it doesn't play the animation twice. + bool32 alreadyUsed = (gBattleStruct->zmove.used[gBattlerAttacker] == TRUE); + //attacker has a queued z move gBattleStruct->zmove.active = TRUE; gBattleStruct->zmove.activeCategory = gBattleStruct->zmove.categories[gBattlerAttacker]; @@ -3530,13 +3533,19 @@ u8 AtkCanceller_UnableToUseMove(u32 moveType) if (gBattleStruct->zmove.activeCategory == DAMAGE_CATEGORY_STATUS) { gBattleStruct->zmove.effect = gMovesInfo[gBattleStruct->zmove.baseMoves[gBattlerAttacker]].zMove.effect; - BattleScriptPushCursor(); - gBattlescriptCurrInstr = BattleScript_ZMoveActivateStatus; + if (!alreadyUsed) + { + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_ZMoveActivateStatus; + } } else { - BattleScriptPushCursor(); - gBattlescriptCurrInstr = BattleScript_ZMoveActivateDamaging; + if (!alreadyUsed) + { + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_ZMoveActivateDamaging; + } } effect = 1; } diff --git a/src/battle_z_move.c b/src/battle_z_move.c index b65f017f19..203185cfdc 100644 --- a/src/battle_z_move.c +++ b/src/battle_z_move.c @@ -47,7 +47,6 @@ // Function Declarations static void SpriteCB_ZMoveTrigger(struct Sprite *sprite); static u16 GetSignatureZMove(u16 move, u16 species, u16 item); -static u16 GetTypeBasedZMove(u16 move, u8 battler); static void ZMoveSelectionDisplayPpNumber(u32 battler); static void ZMoveSelectionDisplayPower(u16 move, u16 zMove); static void ShowZMoveTriggerSprite(u8 battleId); @@ -376,7 +375,7 @@ static u16 GetSignatureZMove(u16 move, u16 species, u16 item) return MOVE_NONE; } -static u16 GetTypeBasedZMove(u16 move, u8 battler) +u16 GetTypeBasedZMove(u16 move, u8 battler) { u8 moveType = gMovesInfo[move].type;