diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 5e7488108..2a3d8674a 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -628,7 +628,7 @@ BattleScript_EffectMultiHit:: BattleScript_82D8DFD:: jumpifhasnohp ATTACKER, BattleScript_82D8E93 jumpifhasnohp TARGET, BattleScript_82D8E74 - jumpifhalfword EQUAL, gOriginallyUsedMove, MOVE_SLEEP_TALK, BattleScript_82D8E1F + jumpifhalfword EQUAL, gChosenMove, MOVE_SLEEP_TALK, BattleScript_82D8E1F jumpifstatus ATTACKER, STATUS_SLEEP, BattleScript_82D8E74 BattleScript_82D8E1F:: movevaluescleanup @@ -1281,7 +1281,7 @@ BattleScript_EffectSnore:: ppreduce goto BattleScript_ButItFailed BattleScript_SnoreIsAsleep:: - jumpifhalfword EQUAL, gOriginallyUsedMove, MOVE_SLEEP_TALK, BattleScript_DoSnore + jumpifhalfword EQUAL, gChosenMove, MOVE_SLEEP_TALK, BattleScript_DoSnore printstring STRINGID_PKMNFASTASLEEP waitmessage 0x40 statusanimation ATTACKER @@ -1411,7 +1411,7 @@ BattleScript_EffectTripleKick:: BattleScript_TripleKickLoop:: jumpifhasnohp ATTACKER, BattleScript_TripleKickEnd jumpifhasnohp TARGET, BattleScript_TripleKickNoMoreHits - jumpifhalfword EQUAL, gOriginallyUsedMove, MOVE_SLEEP_TALK, BattleScript_DoTripleKickAttack + jumpifhalfword EQUAL, gChosenMove, MOVE_SLEEP_TALK, BattleScript_DoTripleKickAttack jumpifstatus ATTACKER, STATUS_SLEEP, BattleScript_TripleKickNoMoreHits BattleScript_DoTripleKickAttack:: accuracycheck BattleScript_TripleKickNoMoreHits, ACC_CURR_MOVE diff --git a/src/battle_2.c b/src/battle_2.c index 8afca2f10..eead4d7a9 100644 --- a/src/battle_2.c +++ b/src/battle_2.c @@ -121,11 +121,11 @@ extern u8 gMultiHitCounter; extern u8 gBattleMoveFlags; extern s32 gBattleMoveDamage; extern const u8* gPalaceSelectionBattleScripts[BATTLE_BANKS_COUNT]; -extern u16 gOriginallyLastPrintedMoves[BATTLE_BANKS_COUNT]; -extern u16 gOriginallyLastMoves[BATTLE_BANKS_COUNT]; +extern u16 gLastPrintedMoves[BATTLE_BANKS_COUNT]; +extern u16 gLastMoves[BATTLE_BANKS_COUNT]; extern u16 gLastLandedMoves[BATTLE_BANKS_COUNT]; extern u16 gLastHitByType[BATTLE_BANKS_COUNT]; -extern u16 gLastMoves[BATTLE_BANKS_COUNT]; +extern u16 gLastResultingMoves[BATTLE_BANKS_COUNT]; extern u16 gLockedMoves[BATTLE_BANKS_COUNT]; extern u8 gLastHitBy[BATTLE_BANKS_COUNT]; extern u8 gUnknown_02024284[BATTLE_BANKS_COUNT]; @@ -149,7 +149,7 @@ extern u16 gDynamicBasePower; extern u8 gCritMultiplier; extern u8 gCurrMovePos; extern u8 gUnknown_020241E9; -extern u16 gOriginallyUsedMove; +extern u16 gChosenMove; extern const struct BattleMove gBattleMoves[]; extern const u16 gUnknown_08C004E0[]; // battle textbox palette @@ -2743,13 +2743,13 @@ static void BattleStartClearSetData(void) gDisableStructs[i].isFirstTurn = 2; gUnknown_02024284[i] = 0; - gOriginallyLastMoves[i] = 0; + gLastMoves[i] = 0; gLastLandedMoves[i] = 0; gLastHitByType[i] = 0; - gLastMoves[i] = 0; + gLastResultingMoves[i] = 0; gLastHitBy[i] = 0xFF; gLockedMoves[i] = 0; - gOriginallyLastPrintedMoves[i] = 0; + gLastPrintedMoves[i] = 0; gBattleResources->flags->flags[i] = 0; gPalaceSelectionBattleScripts[i] = 0; } @@ -2910,11 +2910,11 @@ void SwitchInClearSetData(void) gBattleMoveFlags = 0; gDisableStructs[gActiveBank].isFirstTurn = 2; gDisableStructs[gActiveBank].truantUnknownBit = disableStructCopy.truantUnknownBit; - gOriginallyLastMoves[gActiveBank] = 0; + gLastMoves[gActiveBank] = 0; gLastLandedMoves[gActiveBank] = 0; gLastHitByType[gActiveBank] = 0; - gLastMoves[gActiveBank] = 0; - gOriginallyLastPrintedMoves[gActiveBank] = 0; + gLastResultingMoves[gActiveBank] = 0; + gLastPrintedMoves[gActiveBank] = 0; gLastHitBy[gActiveBank] = 0xFF; *(gBattleStruct->mirrorMoves + gActiveBank * 2 + 0) = 0; @@ -3002,11 +3002,11 @@ void FaintClearSetData(void) gDisableStructs[gActiveBank].isFirstTurn = 2; - gOriginallyLastMoves[gActiveBank] = 0; + gLastMoves[gActiveBank] = 0; gLastLandedMoves[gActiveBank] = 0; gLastHitByType[gActiveBank] = 0; - gLastMoves[gActiveBank] = 0; - gOriginallyLastPrintedMoves[gActiveBank] = 0; + gLastResultingMoves[gActiveBank] = 0; + gLastPrintedMoves[gActiveBank] = 0; gLastHitBy[gActiveBank] = 0xFF; *(u8*)((u8*)(&gBattleStruct->choicedMove[gActiveBank]) + 0) = 0; @@ -5048,19 +5048,19 @@ static void HandleAction_UseMove(void) if (gProtectStructs[gBankAttacker].onlyStruggle) { gProtectStructs[gBankAttacker].onlyStruggle = 0; - gCurrentMove = gOriginallyUsedMove = MOVE_STRUGGLE; + gCurrentMove = gChosenMove = MOVE_STRUGGLE; gHitMarker |= HITMARKER_NO_PPDEDUCT; *(gBattleStruct->moveTarget + gBankAttacker) = GetMoveTarget(MOVE_STRUGGLE, 0); } else if (gBattleMons[gBankAttacker].status2 & STATUS2_MULTIPLETURNS || gBattleMons[gBankAttacker].status2 & STATUS2_RECHARGE) { - gCurrentMove = gOriginallyUsedMove = gLockedMoves[gBankAttacker]; + gCurrentMove = gChosenMove = gLockedMoves[gBankAttacker]; } // encore forces you to use the same move else if (gDisableStructs[gBankAttacker].encoredMove != MOVE_NONE && gDisableStructs[gBankAttacker].encoredMove == gBattleMons[gBankAttacker].moves[gDisableStructs[gBankAttacker].encoredMovePos]) { - gCurrentMove = gOriginallyUsedMove = gDisableStructs[gBankAttacker].encoredMove; + gCurrentMove = gChosenMove = gDisableStructs[gBankAttacker].encoredMove; gCurrMovePos = gUnknown_020241E9 = gDisableStructs[gBankAttacker].encoredMovePos; *(gBattleStruct->moveTarget + gBankAttacker) = GetMoveTarget(gCurrentMove, 0); } @@ -5069,7 +5069,7 @@ static void HandleAction_UseMove(void) && gDisableStructs[gBankAttacker].encoredMove != gBattleMons[gBankAttacker].moves[gDisableStructs[gBankAttacker].encoredMovePos]) { gCurrMovePos = gUnknown_020241E9 = gDisableStructs[gBankAttacker].encoredMovePos; - gCurrentMove = gOriginallyUsedMove = gBattleMons[gBankAttacker].moves[gCurrMovePos]; + gCurrentMove = gChosenMove = gBattleMons[gBankAttacker].moves[gCurrMovePos]; gDisableStructs[gBankAttacker].encoredMove = MOVE_NONE; gDisableStructs[gBankAttacker].encoredMovePos = 0; gDisableStructs[gBankAttacker].encoreTimer1 = 0; @@ -5077,12 +5077,12 @@ static void HandleAction_UseMove(void) } else if (gBattleMons[gBankAttacker].moves[gCurrMovePos] != gChosenMovesByBanks[gBankAttacker]) { - gCurrentMove = gOriginallyUsedMove = gBattleMons[gBankAttacker].moves[gCurrMovePos]; + gCurrentMove = gChosenMove = gBattleMons[gBankAttacker].moves[gCurrMovePos]; *(gBattleStruct->moveTarget + gBankAttacker) = GetMoveTarget(gCurrentMove, 0); } else { - gCurrentMove = gOriginallyUsedMove = gBattleMons[gBankAttacker].moves[gCurrMovePos]; + gCurrentMove = gChosenMove = gBattleMons[gBankAttacker].moves[gCurrMovePos]; } if (gBattleMons[gBankAttacker].hp != 0) @@ -5122,7 +5122,7 @@ static void HandleAction_UseMove(void) } if (var == 4) { - if (gBattleMoves[gOriginallyUsedMove].target & MOVE_TARGET_RANDOM) + if (gBattleMoves[gChosenMove].target & MOVE_TARGET_RANDOM) { if (GetBankSide(gBankAttacker) == SIDE_PLAYER) { @@ -5167,7 +5167,7 @@ static void HandleAction_UseMove(void) } } else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE - && gBattleMoves[gOriginallyUsedMove].target & MOVE_TARGET_RANDOM) + && gBattleMoves[gChosenMove].target & MOVE_TARGET_RANDOM) { if (GetBankSide(gBankAttacker) == SIDE_PLAYER) { diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c index 5fde5669e..97226f5c9 100644 --- a/src/battle_ai_script_commands.c +++ b/src/battle_ai_script_commands.c @@ -58,7 +58,7 @@ extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT]; extern u16 gCurrentMove; extern u8 gBankTarget; extern u8 gAbsentBankFlags; -extern u16 gOriginallyLastMoves[BATTLE_BANKS_COUNT]; +extern u16 gLastMoves[BATTLE_BANKS_COUNT]; extern u16 gTrainerBattleOpponent_A; extern u16 gTrainerBattleOpponent_B; extern u32 gStatuses3[BATTLE_BANKS_COUNT]; @@ -633,12 +633,12 @@ static void RecordLastUsedMoveByTarget(void) for (i = 0; i < 4; i++) { - if (gBattleResources->battleHistory->usedMoves[gBankTarget].moves[i] == gOriginallyLastMoves[gBankTarget]) + if (gBattleResources->battleHistory->usedMoves[gBankTarget].moves[i] == gLastMoves[gBankTarget]) break; - if (gBattleResources->battleHistory->usedMoves[gBankTarget].moves[i] != gOriginallyLastMoves[gBankTarget] // HACK: This redundant condition is a hack to make the asm match. + if (gBattleResources->battleHistory->usedMoves[gBankTarget].moves[i] != gLastMoves[gBankTarget] // HACK: This redundant condition is a hack to make the asm match. && gBattleResources->battleHistory->usedMoves[gBankTarget].moves[i] == 0) { - gBattleResources->battleHistory->usedMoves[gBankTarget].moves[i] = gOriginallyLastMoves[gBankTarget]; + gBattleResources->battleHistory->usedMoves[gBankTarget].moves[i] = gLastMoves[gBankTarget]; break; } } @@ -1252,9 +1252,9 @@ static void BattleAICmd_is_most_powerful_move(void) static void BattleAICmd_get_last_used_bank_move(void) { if (gAIScriptPtr[1] == AI_USER) - AI_THINKING_STRUCT->funcResult = gOriginallyLastMoves[sBank_AI]; + AI_THINKING_STRUCT->funcResult = gLastMoves[sBank_AI]; else - AI_THINKING_STRUCT->funcResult = gOriginallyLastMoves[gBankTarget]; + AI_THINKING_STRUCT->funcResult = gLastMoves[gBankTarget]; gAIScriptPtr += 2; } diff --git a/src/battle_controllers.c b/src/battle_controllers.c index b3fb91b42..2d373e876 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -38,7 +38,7 @@ extern u8 gEffectBank; extern u16 gBattleWeather; extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT]; extern u16 gCurrentMove; -extern u16 gOriginallyUsedMove; +extern u16 gChosenMove; extern u16 gLastUsedItem; extern u8 gBattleOutcome; extern u8 gLastUsedAbility; @@ -1120,7 +1120,7 @@ void EmitPrintString(u8 bufferId, u16 stringID) stringInfo = (struct StringInfoBattle*)(&gBattleBuffersTransferData[4]); stringInfo->currentMove = gCurrentMove; - stringInfo->originallyUsedMove = gOriginallyUsedMove; + stringInfo->originallyUsedMove = gChosenMove; stringInfo->lastItem = gLastUsedItem; stringInfo->lastAbility = gLastUsedAbility; stringInfo->scrActive = gBattleScripting.bank; @@ -1152,7 +1152,7 @@ void EmitPrintSelectionString(u8 bufferId, u16 stringID) stringInfo = (struct StringInfoBattle*)(&gBattleBuffersTransferData[4]); stringInfo->currentMove = gCurrentMove; - stringInfo->originallyUsedMove = gOriginallyUsedMove; + stringInfo->originallyUsedMove = gChosenMove; stringInfo->lastItem = gLastUsedItem; stringInfo->lastAbility = gLastUsedAbility; stringInfo->scrActive = gBattleScripting.bank; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 0e6209ed8..59bb58868 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -76,7 +76,7 @@ extern u8 gBattleMoveFlags; extern u8 gBattleCommunication[]; extern u16 gLastLandedMoves[4]; extern u16 gLastHitByType[4]; -extern u16 gLastMoves[4]; +extern u16 gLastResultingMoves[4]; extern u8 gLastHitBy[4]; extern u8 gStringBank; extern u16 gDynamicBasePower; @@ -99,9 +99,9 @@ extern u8 gCurrentTurnActionNumber; extern u8 gBattleBufferB[BATTLE_BANKS_COUNT][0x200]; extern u16 gLockedMoves[BATTLE_BANKS_COUNT]; extern u16 gPartnerTrainerId; -extern u16 gOriginallyUsedMove; -extern u16 gOriginallyLastPrintedMoves[BATTLE_BANKS_COUNT]; -extern u16 gOriginallyLastMoves[BATTLE_BANKS_COUNT]; +extern u16 gChosenMove; +extern u16 gLastPrintedMoves[BATTLE_BANKS_COUNT]; +extern u16 gLastMoves[BATTLE_BANKS_COUNT]; extern u16 gTrainerBattleOpponent_A; extern u16 gTrainerBattleOpponent_B; extern u8 gUnknown_020241E9; @@ -4860,10 +4860,10 @@ static void atk49_moveend(void) effect = FALSE; - if (gOriginallyUsedMove == 0xFFFF) + if (gChosenMove == 0xFFFF) originallyUsedMove = 0; else - originallyUsedMove = gOriginallyUsedMove; + originallyUsedMove = gChosenMove; arg1 = gBattlescriptCurrInstr[1]; arg2 = gBattlescriptCurrInstr[2]; @@ -4934,14 +4934,14 @@ static void atk49_moveend(void) break; case 6: // update choice band move if (!(gHitMarker & HITMARKER_OBEYS) || holdEffectAtk != HOLD_EFFECT_CHOICE_BAND - || gOriginallyUsedMove == MOVE_STRUGGLE || (*choicedMoveAtk != 0 && *choicedMoveAtk != 0xFFFF)) + || gChosenMove == MOVE_STRUGGLE || (*choicedMoveAtk != 0 && *choicedMoveAtk != 0xFFFF)) goto LOOP; - if (gOriginallyUsedMove == MOVE_BATON_PASS && !(gBattleMoveFlags & MOVESTATUS_FAILED)) + if (gChosenMove == MOVE_BATON_PASS && !(gBattleMoveFlags & MOVESTATUS_FAILED)) { gBattleScripting.atk49_state++; break; } - *choicedMoveAtk = gOriginallyUsedMove; + *choicedMoveAtk = gChosenMove; LOOP: { for (i = 0; i < 4; i++) @@ -5036,7 +5036,7 @@ static void atk49_moveend(void) } if (gHitMarker & HITMARKER_ATTACKSTRING_PRINTED) { - gOriginallyLastPrintedMoves[gBankAttacker] = gOriginallyUsedMove; + gLastPrintedMoves[gBankAttacker] = gChosenMove; } if (!(gAbsentBankFlags & gBitTable[gBankAttacker]) && !(gBattleStruct->field_91 & gBitTable[gBankAttacker]) @@ -5044,13 +5044,13 @@ static void atk49_moveend(void) { if (gHitMarker & HITMARKER_OBEYS) { - gOriginallyLastMoves[gBankAttacker] = gOriginallyUsedMove; - gLastMoves[gBankAttacker] = gCurrentMove; + gLastMoves[gBankAttacker] = gChosenMove; + gLastResultingMoves[gBankAttacker] = gCurrentMove; } else { - gOriginallyLastMoves[gBankAttacker] = 0xFFFF; gLastMoves[gBankAttacker] = 0xFFFF; + gLastResultingMoves[gBankAttacker] = 0xFFFF; } if (!(gHitMarker & HITMARKER_FAINTED(gBankTarget))) @@ -5058,9 +5058,9 @@ static void atk49_moveend(void) if (gHitMarker & HITMARKER_OBEYS && !(gBattleMoveFlags & MOVESTATUS_NOEFFECT)) { - if (gOriginallyUsedMove == 0xFFFF) + if (gChosenMove == 0xFFFF) { - gLastLandedMoves[gBankTarget] = gOriginallyUsedMove; + gLastLandedMoves[gBankTarget] = gChosenMove; } else { @@ -5083,16 +5083,16 @@ static void atk49_moveend(void) { u8 target, attacker; - *(gBattleStruct->mirrorMoves + gBankTarget * 2 + 0) = gOriginallyUsedMove; - *(gBattleStruct->mirrorMoves + gBankTarget * 2 + 1) = gOriginallyUsedMove >> 8; + *(gBattleStruct->mirrorMoves + gBankTarget * 2 + 0) = gChosenMove; + *(gBattleStruct->mirrorMoves + gBankTarget * 2 + 1) = gChosenMove >> 8; target = gBankTarget; attacker = gBankAttacker; - *(attacker * 2 + target * 8 + (u8*)(gBattleStruct->mirrorMoveArrays) + 0) = gOriginallyUsedMove; + *(attacker * 2 + target * 8 + (u8*)(gBattleStruct->mirrorMoveArrays) + 0) = gChosenMove; target = gBankTarget; attacker = gBankAttacker; - *(attacker * 2 + target * 8 + (u8*)(gBattleStruct->mirrorMoveArrays) + 1) = gOriginallyUsedMove >> 8; + *(attacker * 2 + target * 8 + (u8*)(gBattleStruct->mirrorMoveArrays) + 1) = gChosenMove >> 8; } gBattleScripting.atk49_state++; break; @@ -6386,7 +6386,7 @@ static void atk63_jumptorandomattack(void) if (gBattlescriptCurrInstr[1] != 0) gCurrentMove = gRandomMove; else - gOriginallyUsedMove = gCurrentMove = gRandomMove; + gChosenMove = gCurrentMove = gRandomMove; gBattlescriptCurrInstr = gBattleScriptsForMoveEffects[gBattleMoves[gCurrentMove].effect]; } @@ -7131,7 +7131,7 @@ static void atk76_various(void) static void atk77_setprotectlike(void) // protect and endure { bool8 notLastTurn = TRUE; - u16 lastMove = gLastMoves[gBankAttacker]; + u16 lastMove = gLastResultingMoves[gBankAttacker]; if (lastMove != MOVE_PROTECT && lastMove != MOVE_DETECT && lastMove != MOVE_ENDURE) gDisableStructs[gBankAttacker].protectUses = 0; @@ -8352,7 +8352,7 @@ static void atk9A_setfocusenergy(void) static void atk9B_transformdataexecution(void) { - gOriginallyUsedMove = 0xFFFF; + gChosenMove = 0xFFFF; gBattlescriptCurrInstr++; if (gBattleMons[gBankTarget].status2 & STATUS2_TRANSFORMED || gStatuses3[gBankTarget] & STATUS3_SEMI_INVULNERABLE) @@ -8432,12 +8432,12 @@ static bool8 IsMoveUncopyableByMimic(u16 move) static void atk9D_mimicattackcopy(void) { - gOriginallyUsedMove = 0xFFFF; + gChosenMove = 0xFFFF; - if (IsMoveUncopyableByMimic(gOriginallyLastMoves[gBankTarget]) + if (IsMoveUncopyableByMimic(gLastMoves[gBankTarget]) || gBattleMons[gBankAttacker].status2 & STATUS2_TRANSFORMED - || gOriginallyLastMoves[gBankTarget] == 0 - || gOriginallyLastMoves[gBankTarget] == 0xFFFF) + || gLastMoves[gBankTarget] == 0 + || gLastMoves[gBankTarget] == 0xFFFF) { gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); } @@ -8447,20 +8447,20 @@ static void atk9D_mimicattackcopy(void) for (i = 0; i < 4; i++) { - if (gBattleMons[gBankAttacker].moves[i] == gOriginallyLastMoves[gBankTarget]) + if (gBattleMons[gBankAttacker].moves[i] == gLastMoves[gBankTarget]) break; } if (i == 4) { - gBattleMons[gBankAttacker].moves[gCurrMovePos] = gOriginallyLastMoves[gBankTarget]; - if (gBattleMoves[gOriginallyLastMoves[gBankTarget]].pp < 5) - gBattleMons[gBankAttacker].pp[gCurrMovePos] = gBattleMoves[gOriginallyLastMoves[gBankTarget]].pp; + gBattleMons[gBankAttacker].moves[gCurrMovePos] = gLastMoves[gBankTarget]; + if (gBattleMoves[gLastMoves[gBankTarget]].pp < 5) + gBattleMons[gBankAttacker].pp[gCurrMovePos] = gBattleMoves[gLastMoves[gBankTarget]].pp; else gBattleMons[gBankAttacker].pp[gCurrMovePos] = 5; - PREPARE_MOVE_BUFFER(gBattleTextBuff1, gOriginallyLastMoves[gBankTarget]) + PREPARE_MOVE_BUFFER(gBattleTextBuff1, gLastMoves[gBankTarget]) gDisableStructs[gBankAttacker].unk18_b |= gBitTable[gCurrMovePos]; gBattlescriptCurrInstr += 5; @@ -8575,7 +8575,7 @@ static void atkA3_disablelastusedattack(void) for (i = 0; i < 4; i++) { - if (gBattleMons[gBankTarget].moves[i] == gOriginallyLastMoves[gBankTarget]) + if (gBattleMons[gBankTarget].moves[i] == gLastMoves[gBankTarget]) break; } if (gDisableStructs[gBankTarget].disabledMove == 0 @@ -8600,13 +8600,13 @@ static void atkA4_trysetencore(void) for (i = 0; i < 4; i++) { - if (gBattleMons[gBankTarget].moves[i] == gOriginallyLastMoves[gBankTarget]) + if (gBattleMons[gBankTarget].moves[i] == gLastMoves[gBankTarget]) break; } - if (gOriginallyLastMoves[gBankTarget] == MOVE_STRUGGLE - || gOriginallyLastMoves[gBankTarget] == MOVE_ENCORE - || gOriginallyLastMoves[gBankTarget] == MOVE_MIRROR_MOVE) + if (gLastMoves[gBankTarget] == MOVE_STRUGGLE + || gLastMoves[gBankTarget] == MOVE_ENCORE + || gLastMoves[gBankTarget] == MOVE_MIRROR_MOVE) { i = 4; } @@ -8726,13 +8726,13 @@ static void atkA7_setalwayshitflag(void) static void atkA8_copymovepermanently(void) // sketch { - gOriginallyUsedMove = 0xFFFF; + gChosenMove = 0xFFFF; if (!(gBattleMons[gBankAttacker].status2 & STATUS2_TRANSFORMED) - && gOriginallyLastPrintedMoves[gBankTarget] != MOVE_STRUGGLE - && gOriginallyLastPrintedMoves[gBankTarget] != 0 - && gOriginallyLastPrintedMoves[gBankTarget] != 0xFFFF - && gOriginallyLastPrintedMoves[gBankTarget] != MOVE_SKETCH) + && gLastPrintedMoves[gBankTarget] != MOVE_STRUGGLE + && gLastPrintedMoves[gBankTarget] != 0 + && gLastPrintedMoves[gBankTarget] != 0xFFFF + && gLastPrintedMoves[gBankTarget] != MOVE_SKETCH) { s32 i; @@ -8740,7 +8740,7 @@ static void atkA8_copymovepermanently(void) // sketch { if (gBattleMons[gBankAttacker].moves[i] == MOVE_SKETCH) continue; - if (gBattleMons[gBankAttacker].moves[i] == gOriginallyLastPrintedMoves[gBankTarget]) + if (gBattleMons[gBankAttacker].moves[i] == gLastPrintedMoves[gBankTarget]) break; } @@ -8752,8 +8752,8 @@ static void atkA8_copymovepermanently(void) // sketch { struct MovePpInfo movePpData; - gBattleMons[gBankAttacker].moves[gCurrMovePos] = gOriginallyLastPrintedMoves[gBankTarget]; - gBattleMons[gBankAttacker].pp[gCurrMovePos] = gBattleMoves[gOriginallyLastPrintedMoves[gBankTarget]].pp; + gBattleMons[gBankAttacker].moves[gCurrMovePos] = gLastPrintedMoves[gBankTarget]; + gBattleMons[gBankAttacker].pp[gCurrMovePos] = gBattleMoves[gLastPrintedMoves[gBankTarget]].pp; gActiveBank = gBankAttacker; for (i = 0; i < 4; i++) @@ -8766,7 +8766,7 @@ static void atkA8_copymovepermanently(void) // sketch EmitSetMonData(0, REQUEST_MOVES_PP_BATTLE, 0, sizeof(struct MovePpInfo), &movePpData); MarkBufferBankForExecution(gActiveBank); - PREPARE_MOVE_BUFFER(gBattleTextBuff1, gOriginallyLastPrintedMoves[gBankTarget]) + PREPARE_MOVE_BUFFER(gBattleTextBuff1, gLastPrintedMoves[gBankTarget]) gBattlescriptCurrInstr += 5; } @@ -8899,14 +8899,14 @@ static void atkAC_remaininghptopower(void) static void atkAD_tryspiteppreduce(void) { - if (gOriginallyLastMoves[gBankTarget] != 0 - && gOriginallyLastMoves[gBankTarget] != 0xFFFF) + if (gLastMoves[gBankTarget] != 0 + && gLastMoves[gBankTarget] != 0xFFFF) { s32 i; for (i = 0; i < 4; i++) { - if (gOriginallyLastMoves[gBankTarget] == gBattleMons[gBankTarget].moves[i]) + if (gLastMoves[gBankTarget] == gBattleMons[gBankTarget].moves[i]) break; } @@ -8916,7 +8916,7 @@ static void atkAD_tryspiteppreduce(void) if (gBattleMons[gBankTarget].pp[i] < ppToDeduct) ppToDeduct = gBattleMons[gBankTarget].pp[i]; - PREPARE_MOVE_BUFFER(gBattleTextBuff1, gOriginallyLastMoves[gBankTarget]) + PREPARE_MOVE_BUFFER(gBattleTextBuff1, gLastMoves[gBankTarget]) ConvertIntToDecimalStringN(gBattleTextBuff2, ppToDeduct, 0, 1); diff --git a/src/battle_util.c b/src/battle_util.c index 904dfc032..94c51c0f8 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -43,7 +43,7 @@ extern s32 gBattleMoveDamage; extern struct BattleEnigmaBerry gEnigmaBerries[BATTLE_BANKS_COUNT]; extern u8 gBattleBufferB[BATTLE_BANKS_COUNT][0x200]; extern u32 gBattleTypeFlags; -extern u16 gOriginallyLastMoves[BATTLE_BANKS_COUNT]; +extern u16 gLastMoves[BATTLE_BANKS_COUNT]; extern u32 gHitMarker; extern u8 gEffectBank; extern u16 gBattlePartyID[BATTLE_BANKS_COUNT]; @@ -373,7 +373,7 @@ u8 TrySetCantSelectMoveBattleScript(void) } } - if (move == gOriginallyLastMoves[gActiveBank] && move != MOVE_STRUGGLE && (gBattleMons[gActiveBank].status2 & STATUS2_TORMENT)) + if (move == gLastMoves[gActiveBank] && move != MOVE_STRUGGLE && (gBattleMons[gActiveBank].status2 & STATUS2_TORMENT)) { CancelMultiTurnMoves(gActiveBank); if (gBattleTypeFlags & BATTLE_TYPE_PALACE) @@ -477,7 +477,7 @@ u8 CheckMoveLimitations(u8 bank, u8 unusableMoves, u8 check) unusableMoves |= gBitTable[i]; if (gBattleMons[bank].moves[i] == gDisableStructs[bank].disabledMove && check & MOVE_LIMITATION_DISABLED) unusableMoves |= gBitTable[i]; - if (gBattleMons[bank].moves[i] == gOriginallyLastMoves[bank] && check & MOVE_LIMITATION_TORMENTED && gBattleMons[bank].status2 & STATUS2_TORMENT) + if (gBattleMons[bank].moves[i] == gLastMoves[bank] && check & MOVE_LIMITATION_TORMENTED && gBattleMons[bank].status2 & STATUS2_TORMENT) unusableMoves |= gBitTable[i]; if (gDisableStructs[bank].tauntTimer1 && check & MOVE_LIMITATION_TAUNT && gBattleMoves[gBattleMons[bank].moves[i]].power == 0) unusableMoves |= gBitTable[i]; diff --git a/sym_ewram.txt b/sym_ewram.txt index cff1df585..2a015dc2d 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -312,7 +312,7 @@ gUnknown_020241E9: @ 20241E9 gCurrentMove: @ 20241EA .space 0x2 -gOriginallyUsedMove: @ 20241EC +gChosenMove: @ 20241EC .space 0x2 gRandomMove: @ 20241EE @@ -369,10 +369,10 @@ gSelectionBattleScripts: @ 2024220 gPalaceSelectionBattleScripts: @ 2024230 .space 0x10 -gOriginallyLastPrintedMoves: @ 2024240 +gLastPrintedMoves: @ 2024240 .space 0x8 -gOriginallyLastMoves: @ 2024248 +gLastMoves: @ 2024248 .space 0x8 gLastLandedMoves: @ 2024250 @@ -381,7 +381,7 @@ gLastLandedMoves: @ 2024250 gLastHitByType: @ 2024258 .space 0x8 -gLastMoves: @ 2024260 +gLastResultingMoves: @ 2024260 .space 0x8 gLockedMoves: @ 2024268