diff --git a/src/battle_main.c b/src/battle_main.c index 2b4b0aafd1..83c003150c 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -3260,7 +3260,6 @@ void SwitchInClearSetData(u32 battler, struct Volatiles *volatilesCopy) } gBattleStruct->choicedMove[battler] = MOVE_NONE; - gCurrentMove = MOVE_NONE; gBattleStruct->arenaTurnCounter = 0xFF; // Restore struct member so replacement does not miss timing diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index bc66490054..16d15e644e 100755 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -6383,8 +6383,9 @@ static void Cmd_moveend(void) } } enum BattleMoveEffects originalEffect = GetMoveEffect(originallyUsedMove); - if (!(gAbsentBattlerFlags & (1u << gBattlerAttacker)) - && originalEffect != EFFECT_BATON_PASS && originalEffect != EFFECT_HEALING_WISH) + if (IsBattlerAlive(gBattlerAttacker) + && originalEffect != EFFECT_BATON_PASS + && originalEffect != EFFECT_HEALING_WISH) { if (gHitMarker & HITMARKER_OBEYS) { @@ -6918,19 +6919,17 @@ static void Cmd_moveend(void) gBattleScripting.moveendState++; break; case MOVEEND_THIRD_MOVE_BLOCK: - // Special case for Steel Roller since it has to check the chosen move - if (GetMoveEffect(gChosenMove) == EFFECT_STEEL_ROLLER && IsBattlerTurnDamaged(gBattlerTarget)) - { - BattleScriptCall(BattleScript_RemoveTerrain); - effect = TRUE; - gBattleScripting.moveendState++; - break; - } - switch (moveEffect) { + case EFFECT_STEEL_ROLLER: + if (gFieldStatuses & STATUS_FIELD_TERRAIN_ANY && IsBattlerTurnDamaged(gBattlerTarget)) + { + BattleScriptCall(BattleScript_RemoveTerrain); + effect = TRUE; + } case EFFECT_ICE_SPINNER: if (gFieldStatuses & STATUS_FIELD_TERRAIN_ANY + && gLastPrintedMoves[gBattlerAttacker] == gCurrentMove && IsBattlerAlive(gBattlerAttacker) && IsBattlerTurnDamaged(gBattlerTarget)) { @@ -7062,11 +7061,7 @@ static void Cmd_moveend(void) gBattleScripting.moveendState++; break; case MOVEEND_DANCER: - if (gCurrentMove == MOVE_NONE) - originallyUsedMove = gChosenMove; // Fallback to chosen move in case attacker is switched out in the middle of an attack resolution (eg red card) - else - originallyUsedMove = gCurrentMove; - if (IsDanceMove(originallyUsedMove) && !gBattleStruct->snatchedMoveIsUsed) + if (IsDanceMove(gCurrentMove) && !gBattleStruct->snatchedMoveIsUsed) { u32 battler, nextDancer = 0; bool32 hasDancerTriggered = FALSE; @@ -7100,7 +7095,7 @@ static void Cmd_moveend(void) nextDancer = battler | 0x4; } } - if (nextDancer && AbilityBattleEffects(ABILITYEFFECT_MOVE_END_OTHER, nextDancer & 0x3, 0, 0, originallyUsedMove)) + if (nextDancer && AbilityBattleEffects(ABILITYEFFECT_MOVE_END_OTHER, nextDancer & 0x3, 0, 0, gCurrentMove)) effect = TRUE; } } diff --git a/src/battle_util.c b/src/battle_util.c index 5296798db4..647e21bb66 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -927,7 +927,7 @@ void HandleAction_ActionFinished(void) | HITMARKER_IGNORE_DISGUISE); ClearDamageCalcResults(); - gCurrentMove = 0; + gCurrentMove = MOVE_NONE; gBattleScripting.animTurn = 0; gBattleScripting.animTargetsHit = 0; gBattleStruct->dynamicMoveType = 0; diff --git a/test/battle/move_effect/roar.c b/test/battle/move_effect/roar.c index 5b1230f253..5c46e0cdf4 100644 --- a/test/battle/move_effect/roar.c +++ b/test/battle/move_effect/roar.c @@ -20,6 +20,8 @@ SINGLE_BATTLE_TEST("Roar switches the target with a random non-fainted replaceme } SCENE { ANIMATION(ANIM_TYPE_MOVE, MOVE_ROAR, player); MESSAGE("The opposing Bulbasaur was dragged out!"); + } THEN { + EXPECT_EQ(gLastUsedMove, MOVE_ROAR); } }