Fixes some restore issues (#6629)
This commit is contained in:
parent
37f72bb237
commit
6b09480912
@ -6010,7 +6010,6 @@ BattleScript_RoarSuccessSwitch_Ret:
|
||||
swapattackerwithtarget @ continuation of RedCardActivates
|
||||
restoretarget
|
||||
restoreattacker
|
||||
restoresavedmove
|
||||
setbyte sSWITCH_CASE, B_SWITCH_NORMAL
|
||||
return
|
||||
|
||||
@ -9492,7 +9491,6 @@ BattleScript_RedCardActivationNoSwitch::
|
||||
removeitem BS_SCRIPTING
|
||||
restoretarget
|
||||
restoreattacker
|
||||
restoresavedmove
|
||||
return
|
||||
|
||||
BattleScript_RedCardActivates::
|
||||
@ -9515,6 +9513,7 @@ BattleScript_RedCardIngrainContinue:
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
removeitem BS_SCRIPTING
|
||||
restoretarget
|
||||
restoreattacker
|
||||
return
|
||||
BattleScript_RedCardSuctionCups:
|
||||
printstring STRINGID_PKMNANCHORSITSELFWITH
|
||||
|
||||
@ -834,7 +834,6 @@ struct BattleStruct
|
||||
u8 usedMicleBerry;
|
||||
struct MessageStatus slideMessageStatus;
|
||||
u8 trainerSlideSpriteIds[MAX_BATTLERS_COUNT];
|
||||
u16 savedMove; // backup current move for mid-turn switching, e.g. Red Card
|
||||
u16 opponentMonCanTera:6;
|
||||
u16 opponentMonCanDynamax:6;
|
||||
u16 padding:4;
|
||||
|
||||
@ -7199,7 +7199,6 @@ static void Cmd_moveend(void)
|
||||
gLastUsedItem = gBattleMons[battler].item;
|
||||
SaveBattlerTarget(battler); // save battler with red card
|
||||
SaveBattlerAttacker(gBattlerAttacker);
|
||||
gBattleStruct->savedMove = gCurrentMove;
|
||||
gBattleScripting.battler = battler;
|
||||
gEffectBattler = gBattlerAttacker;
|
||||
if (moveEffect == EFFECT_HIT_ESCAPE)
|
||||
@ -7414,7 +7413,11 @@ static void Cmd_moveend(void)
|
||||
gBattleScripting.moveendState++;
|
||||
break;
|
||||
case MOVEEND_DANCER: // Special case because it's so annoying
|
||||
if (IsDanceMove(gCurrentMove) && !gBattleStruct->snatchedMoveIsUsed)
|
||||
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)
|
||||
{
|
||||
u32 battler, nextDancer = 0;
|
||||
bool32 hasDancerTriggered = FALSE;
|
||||
@ -7448,7 +7451,7 @@ static void Cmd_moveend(void)
|
||||
nextDancer = battler | 0x4;
|
||||
}
|
||||
}
|
||||
if (nextDancer && AbilityBattleEffects(ABILITYEFFECT_MOVE_END_OTHER, nextDancer & 0x3, 0, 0, 0))
|
||||
if (nextDancer && AbilityBattleEffects(ABILITYEFFECT_MOVE_END_OTHER, nextDancer & 0x3, 0, 0, originallyUsedMove))
|
||||
effect = TRUE;
|
||||
}
|
||||
}
|
||||
@ -18779,15 +18782,3 @@ void BS_SetSteelsurge(void)
|
||||
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||
}
|
||||
}
|
||||
|
||||
void BS_RestoreSavedMove(void)
|
||||
{
|
||||
NATIVE_ARGS();
|
||||
|
||||
if (gBattleStruct->savedMove == MOVE_NONE)
|
||||
DebugPrintfLevel(MGBA_LOG_WARN, "restoresavedmove was called with no move saved!");
|
||||
|
||||
gCurrentMove = gBattleStruct->savedMove;
|
||||
gBattleStruct->savedMove = MOVE_NONE;
|
||||
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||
}
|
||||
|
||||
@ -6271,7 +6271,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
||||
{
|
||||
case ABILITY_DANCER:
|
||||
if (IsBattlerAlive(battler)
|
||||
&& IsDanceMove(gCurrentMove)
|
||||
&& IsDanceMove(move)
|
||||
&& !gSpecialStatuses[battler].dancerUsedMove
|
||||
&& gBattlerAttacker != battler)
|
||||
{
|
||||
@ -6279,7 +6279,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
||||
gSpecialStatuses[battler].dancerUsedMove = TRUE;
|
||||
gSpecialStatuses[battler].dancerOriginalTarget = gBattleStruct->moveTarget[battler] | 0x4;
|
||||
gBattlerAttacker = gBattlerAbility = battler;
|
||||
gCalledMove = gCurrentMove;
|
||||
gCalledMove = move;
|
||||
|
||||
// Set the target to the original target of the mon that first used a Dance move
|
||||
gBattlerTarget = gBattleScripting.savedBattler & 0x3;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user