change battle variables names

This commit is contained in:
DizzyEggg 2017-11-26 18:07:00 +01:00
parent 59f64c622b
commit d48392e677
7 changed files with 89 additions and 89 deletions

View File

@ -628,7 +628,7 @@ BattleScript_EffectMultiHit::
BattleScript_82D8DFD:: BattleScript_82D8DFD::
jumpifhasnohp ATTACKER, BattleScript_82D8E93 jumpifhasnohp ATTACKER, BattleScript_82D8E93
jumpifhasnohp TARGET, BattleScript_82D8E74 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 jumpifstatus ATTACKER, STATUS_SLEEP, BattleScript_82D8E74
BattleScript_82D8E1F:: BattleScript_82D8E1F::
movevaluescleanup movevaluescleanup
@ -1281,7 +1281,7 @@ BattleScript_EffectSnore::
ppreduce ppreduce
goto BattleScript_ButItFailed goto BattleScript_ButItFailed
BattleScript_SnoreIsAsleep:: BattleScript_SnoreIsAsleep::
jumpifhalfword EQUAL, gOriginallyUsedMove, MOVE_SLEEP_TALK, BattleScript_DoSnore jumpifhalfword EQUAL, gChosenMove, MOVE_SLEEP_TALK, BattleScript_DoSnore
printstring STRINGID_PKMNFASTASLEEP printstring STRINGID_PKMNFASTASLEEP
waitmessage 0x40 waitmessage 0x40
statusanimation ATTACKER statusanimation ATTACKER
@ -1411,7 +1411,7 @@ BattleScript_EffectTripleKick::
BattleScript_TripleKickLoop:: BattleScript_TripleKickLoop::
jumpifhasnohp ATTACKER, BattleScript_TripleKickEnd jumpifhasnohp ATTACKER, BattleScript_TripleKickEnd
jumpifhasnohp TARGET, BattleScript_TripleKickNoMoreHits 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 jumpifstatus ATTACKER, STATUS_SLEEP, BattleScript_TripleKickNoMoreHits
BattleScript_DoTripleKickAttack:: BattleScript_DoTripleKickAttack::
accuracycheck BattleScript_TripleKickNoMoreHits, ACC_CURR_MOVE accuracycheck BattleScript_TripleKickNoMoreHits, ACC_CURR_MOVE

View File

@ -121,11 +121,11 @@ extern u8 gMultiHitCounter;
extern u8 gBattleMoveFlags; extern u8 gBattleMoveFlags;
extern s32 gBattleMoveDamage; extern s32 gBattleMoveDamage;
extern const u8* gPalaceSelectionBattleScripts[BATTLE_BANKS_COUNT]; extern const u8* gPalaceSelectionBattleScripts[BATTLE_BANKS_COUNT];
extern u16 gOriginallyLastPrintedMoves[BATTLE_BANKS_COUNT]; extern u16 gLastPrintedMoves[BATTLE_BANKS_COUNT];
extern u16 gOriginallyLastMoves[BATTLE_BANKS_COUNT]; extern u16 gLastMoves[BATTLE_BANKS_COUNT];
extern u16 gLastLandedMoves[BATTLE_BANKS_COUNT]; extern u16 gLastLandedMoves[BATTLE_BANKS_COUNT];
extern u16 gLastHitByType[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 u16 gLockedMoves[BATTLE_BANKS_COUNT];
extern u8 gLastHitBy[BATTLE_BANKS_COUNT]; extern u8 gLastHitBy[BATTLE_BANKS_COUNT];
extern u8 gUnknown_02024284[BATTLE_BANKS_COUNT]; extern u8 gUnknown_02024284[BATTLE_BANKS_COUNT];
@ -149,7 +149,7 @@ extern u16 gDynamicBasePower;
extern u8 gCritMultiplier; extern u8 gCritMultiplier;
extern u8 gCurrMovePos; extern u8 gCurrMovePos;
extern u8 gUnknown_020241E9; extern u8 gUnknown_020241E9;
extern u16 gOriginallyUsedMove; extern u16 gChosenMove;
extern const struct BattleMove gBattleMoves[]; extern const struct BattleMove gBattleMoves[];
extern const u16 gUnknown_08C004E0[]; // battle textbox palette extern const u16 gUnknown_08C004E0[]; // battle textbox palette
@ -2743,13 +2743,13 @@ static void BattleStartClearSetData(void)
gDisableStructs[i].isFirstTurn = 2; gDisableStructs[i].isFirstTurn = 2;
gUnknown_02024284[i] = 0; gUnknown_02024284[i] = 0;
gOriginallyLastMoves[i] = 0; gLastMoves[i] = 0;
gLastLandedMoves[i] = 0; gLastLandedMoves[i] = 0;
gLastHitByType[i] = 0; gLastHitByType[i] = 0;
gLastMoves[i] = 0; gLastResultingMoves[i] = 0;
gLastHitBy[i] = 0xFF; gLastHitBy[i] = 0xFF;
gLockedMoves[i] = 0; gLockedMoves[i] = 0;
gOriginallyLastPrintedMoves[i] = 0; gLastPrintedMoves[i] = 0;
gBattleResources->flags->flags[i] = 0; gBattleResources->flags->flags[i] = 0;
gPalaceSelectionBattleScripts[i] = 0; gPalaceSelectionBattleScripts[i] = 0;
} }
@ -2910,11 +2910,11 @@ void SwitchInClearSetData(void)
gBattleMoveFlags = 0; gBattleMoveFlags = 0;
gDisableStructs[gActiveBank].isFirstTurn = 2; gDisableStructs[gActiveBank].isFirstTurn = 2;
gDisableStructs[gActiveBank].truantUnknownBit = disableStructCopy.truantUnknownBit; gDisableStructs[gActiveBank].truantUnknownBit = disableStructCopy.truantUnknownBit;
gOriginallyLastMoves[gActiveBank] = 0; gLastMoves[gActiveBank] = 0;
gLastLandedMoves[gActiveBank] = 0; gLastLandedMoves[gActiveBank] = 0;
gLastHitByType[gActiveBank] = 0; gLastHitByType[gActiveBank] = 0;
gLastMoves[gActiveBank] = 0; gLastResultingMoves[gActiveBank] = 0;
gOriginallyLastPrintedMoves[gActiveBank] = 0; gLastPrintedMoves[gActiveBank] = 0;
gLastHitBy[gActiveBank] = 0xFF; gLastHitBy[gActiveBank] = 0xFF;
*(gBattleStruct->mirrorMoves + gActiveBank * 2 + 0) = 0; *(gBattleStruct->mirrorMoves + gActiveBank * 2 + 0) = 0;
@ -3002,11 +3002,11 @@ void FaintClearSetData(void)
gDisableStructs[gActiveBank].isFirstTurn = 2; gDisableStructs[gActiveBank].isFirstTurn = 2;
gOriginallyLastMoves[gActiveBank] = 0; gLastMoves[gActiveBank] = 0;
gLastLandedMoves[gActiveBank] = 0; gLastLandedMoves[gActiveBank] = 0;
gLastHitByType[gActiveBank] = 0; gLastHitByType[gActiveBank] = 0;
gLastMoves[gActiveBank] = 0; gLastResultingMoves[gActiveBank] = 0;
gOriginallyLastPrintedMoves[gActiveBank] = 0; gLastPrintedMoves[gActiveBank] = 0;
gLastHitBy[gActiveBank] = 0xFF; gLastHitBy[gActiveBank] = 0xFF;
*(u8*)((u8*)(&gBattleStruct->choicedMove[gActiveBank]) + 0) = 0; *(u8*)((u8*)(&gBattleStruct->choicedMove[gActiveBank]) + 0) = 0;
@ -5048,19 +5048,19 @@ static void HandleAction_UseMove(void)
if (gProtectStructs[gBankAttacker].onlyStruggle) if (gProtectStructs[gBankAttacker].onlyStruggle)
{ {
gProtectStructs[gBankAttacker].onlyStruggle = 0; gProtectStructs[gBankAttacker].onlyStruggle = 0;
gCurrentMove = gOriginallyUsedMove = MOVE_STRUGGLE; gCurrentMove = gChosenMove = MOVE_STRUGGLE;
gHitMarker |= HITMARKER_NO_PPDEDUCT; gHitMarker |= HITMARKER_NO_PPDEDUCT;
*(gBattleStruct->moveTarget + gBankAttacker) = GetMoveTarget(MOVE_STRUGGLE, 0); *(gBattleStruct->moveTarget + gBankAttacker) = GetMoveTarget(MOVE_STRUGGLE, 0);
} }
else if (gBattleMons[gBankAttacker].status2 & STATUS2_MULTIPLETURNS || gBattleMons[gBankAttacker].status2 & STATUS2_RECHARGE) 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 // encore forces you to use the same move
else if (gDisableStructs[gBankAttacker].encoredMove != MOVE_NONE else if (gDisableStructs[gBankAttacker].encoredMove != MOVE_NONE
&& gDisableStructs[gBankAttacker].encoredMove == gBattleMons[gBankAttacker].moves[gDisableStructs[gBankAttacker].encoredMovePos]) && 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; gCurrMovePos = gUnknown_020241E9 = gDisableStructs[gBankAttacker].encoredMovePos;
*(gBattleStruct->moveTarget + gBankAttacker) = GetMoveTarget(gCurrentMove, 0); *(gBattleStruct->moveTarget + gBankAttacker) = GetMoveTarget(gCurrentMove, 0);
} }
@ -5069,7 +5069,7 @@ static void HandleAction_UseMove(void)
&& gDisableStructs[gBankAttacker].encoredMove != gBattleMons[gBankAttacker].moves[gDisableStructs[gBankAttacker].encoredMovePos]) && gDisableStructs[gBankAttacker].encoredMove != gBattleMons[gBankAttacker].moves[gDisableStructs[gBankAttacker].encoredMovePos])
{ {
gCurrMovePos = gUnknown_020241E9 = 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].encoredMove = MOVE_NONE;
gDisableStructs[gBankAttacker].encoredMovePos = 0; gDisableStructs[gBankAttacker].encoredMovePos = 0;
gDisableStructs[gBankAttacker].encoreTimer1 = 0; gDisableStructs[gBankAttacker].encoreTimer1 = 0;
@ -5077,12 +5077,12 @@ static void HandleAction_UseMove(void)
} }
else if (gBattleMons[gBankAttacker].moves[gCurrMovePos] != gChosenMovesByBanks[gBankAttacker]) 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); *(gBattleStruct->moveTarget + gBankAttacker) = GetMoveTarget(gCurrentMove, 0);
} }
else else
{ {
gCurrentMove = gOriginallyUsedMove = gBattleMons[gBankAttacker].moves[gCurrMovePos]; gCurrentMove = gChosenMove = gBattleMons[gBankAttacker].moves[gCurrMovePos];
} }
if (gBattleMons[gBankAttacker].hp != 0) if (gBattleMons[gBankAttacker].hp != 0)
@ -5122,7 +5122,7 @@ static void HandleAction_UseMove(void)
} }
if (var == 4) if (var == 4)
{ {
if (gBattleMoves[gOriginallyUsedMove].target & MOVE_TARGET_RANDOM) if (gBattleMoves[gChosenMove].target & MOVE_TARGET_RANDOM)
{ {
if (GetBankSide(gBankAttacker) == SIDE_PLAYER) if (GetBankSide(gBankAttacker) == SIDE_PLAYER)
{ {
@ -5167,7 +5167,7 @@ static void HandleAction_UseMove(void)
} }
} }
else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE
&& gBattleMoves[gOriginallyUsedMove].target & MOVE_TARGET_RANDOM) && gBattleMoves[gChosenMove].target & MOVE_TARGET_RANDOM)
{ {
if (GetBankSide(gBankAttacker) == SIDE_PLAYER) if (GetBankSide(gBankAttacker) == SIDE_PLAYER)
{ {

View File

@ -58,7 +58,7 @@ extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT];
extern u16 gCurrentMove; extern u16 gCurrentMove;
extern u8 gBankTarget; extern u8 gBankTarget;
extern u8 gAbsentBankFlags; extern u8 gAbsentBankFlags;
extern u16 gOriginallyLastMoves[BATTLE_BANKS_COUNT]; extern u16 gLastMoves[BATTLE_BANKS_COUNT];
extern u16 gTrainerBattleOpponent_A; extern u16 gTrainerBattleOpponent_A;
extern u16 gTrainerBattleOpponent_B; extern u16 gTrainerBattleOpponent_B;
extern u32 gStatuses3[BATTLE_BANKS_COUNT]; extern u32 gStatuses3[BATTLE_BANKS_COUNT];
@ -633,12 +633,12 @@ static void RecordLastUsedMoveByTarget(void)
for (i = 0; i < 4; i++) 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; 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] == 0)
{ {
gBattleResources->battleHistory->usedMoves[gBankTarget].moves[i] = gOriginallyLastMoves[gBankTarget]; gBattleResources->battleHistory->usedMoves[gBankTarget].moves[i] = gLastMoves[gBankTarget];
break; break;
} }
} }
@ -1252,9 +1252,9 @@ static void BattleAICmd_is_most_powerful_move(void)
static void BattleAICmd_get_last_used_bank_move(void) static void BattleAICmd_get_last_used_bank_move(void)
{ {
if (gAIScriptPtr[1] == AI_USER) if (gAIScriptPtr[1] == AI_USER)
AI_THINKING_STRUCT->funcResult = gOriginallyLastMoves[sBank_AI]; AI_THINKING_STRUCT->funcResult = gLastMoves[sBank_AI];
else else
AI_THINKING_STRUCT->funcResult = gOriginallyLastMoves[gBankTarget]; AI_THINKING_STRUCT->funcResult = gLastMoves[gBankTarget];
gAIScriptPtr += 2; gAIScriptPtr += 2;
} }

View File

@ -38,7 +38,7 @@ extern u8 gEffectBank;
extern u16 gBattleWeather; extern u16 gBattleWeather;
extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT]; extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT];
extern u16 gCurrentMove; extern u16 gCurrentMove;
extern u16 gOriginallyUsedMove; extern u16 gChosenMove;
extern u16 gLastUsedItem; extern u16 gLastUsedItem;
extern u8 gBattleOutcome; extern u8 gBattleOutcome;
extern u8 gLastUsedAbility; extern u8 gLastUsedAbility;
@ -1120,7 +1120,7 @@ void EmitPrintString(u8 bufferId, u16 stringID)
stringInfo = (struct StringInfoBattle*)(&gBattleBuffersTransferData[4]); stringInfo = (struct StringInfoBattle*)(&gBattleBuffersTransferData[4]);
stringInfo->currentMove = gCurrentMove; stringInfo->currentMove = gCurrentMove;
stringInfo->originallyUsedMove = gOriginallyUsedMove; stringInfo->originallyUsedMove = gChosenMove;
stringInfo->lastItem = gLastUsedItem; stringInfo->lastItem = gLastUsedItem;
stringInfo->lastAbility = gLastUsedAbility; stringInfo->lastAbility = gLastUsedAbility;
stringInfo->scrActive = gBattleScripting.bank; stringInfo->scrActive = gBattleScripting.bank;
@ -1152,7 +1152,7 @@ void EmitPrintSelectionString(u8 bufferId, u16 stringID)
stringInfo = (struct StringInfoBattle*)(&gBattleBuffersTransferData[4]); stringInfo = (struct StringInfoBattle*)(&gBattleBuffersTransferData[4]);
stringInfo->currentMove = gCurrentMove; stringInfo->currentMove = gCurrentMove;
stringInfo->originallyUsedMove = gOriginallyUsedMove; stringInfo->originallyUsedMove = gChosenMove;
stringInfo->lastItem = gLastUsedItem; stringInfo->lastItem = gLastUsedItem;
stringInfo->lastAbility = gLastUsedAbility; stringInfo->lastAbility = gLastUsedAbility;
stringInfo->scrActive = gBattleScripting.bank; stringInfo->scrActive = gBattleScripting.bank;

View File

@ -76,7 +76,7 @@ extern u8 gBattleMoveFlags;
extern u8 gBattleCommunication[]; extern u8 gBattleCommunication[];
extern u16 gLastLandedMoves[4]; extern u16 gLastLandedMoves[4];
extern u16 gLastHitByType[4]; extern u16 gLastHitByType[4];
extern u16 gLastMoves[4]; extern u16 gLastResultingMoves[4];
extern u8 gLastHitBy[4]; extern u8 gLastHitBy[4];
extern u8 gStringBank; extern u8 gStringBank;
extern u16 gDynamicBasePower; extern u16 gDynamicBasePower;
@ -99,9 +99,9 @@ extern u8 gCurrentTurnActionNumber;
extern u8 gBattleBufferB[BATTLE_BANKS_COUNT][0x200]; extern u8 gBattleBufferB[BATTLE_BANKS_COUNT][0x200];
extern u16 gLockedMoves[BATTLE_BANKS_COUNT]; extern u16 gLockedMoves[BATTLE_BANKS_COUNT];
extern u16 gPartnerTrainerId; extern u16 gPartnerTrainerId;
extern u16 gOriginallyUsedMove; extern u16 gChosenMove;
extern u16 gOriginallyLastPrintedMoves[BATTLE_BANKS_COUNT]; extern u16 gLastPrintedMoves[BATTLE_BANKS_COUNT];
extern u16 gOriginallyLastMoves[BATTLE_BANKS_COUNT]; extern u16 gLastMoves[BATTLE_BANKS_COUNT];
extern u16 gTrainerBattleOpponent_A; extern u16 gTrainerBattleOpponent_A;
extern u16 gTrainerBattleOpponent_B; extern u16 gTrainerBattleOpponent_B;
extern u8 gUnknown_020241E9; extern u8 gUnknown_020241E9;
@ -4860,10 +4860,10 @@ static void atk49_moveend(void)
effect = FALSE; effect = FALSE;
if (gOriginallyUsedMove == 0xFFFF) if (gChosenMove == 0xFFFF)
originallyUsedMove = 0; originallyUsedMove = 0;
else else
originallyUsedMove = gOriginallyUsedMove; originallyUsedMove = gChosenMove;
arg1 = gBattlescriptCurrInstr[1]; arg1 = gBattlescriptCurrInstr[1];
arg2 = gBattlescriptCurrInstr[2]; arg2 = gBattlescriptCurrInstr[2];
@ -4934,14 +4934,14 @@ static void atk49_moveend(void)
break; break;
case 6: // update choice band move case 6: // update choice band move
if (!(gHitMarker & HITMARKER_OBEYS) || holdEffectAtk != HOLD_EFFECT_CHOICE_BAND 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; goto LOOP;
if (gOriginallyUsedMove == MOVE_BATON_PASS && !(gBattleMoveFlags & MOVESTATUS_FAILED)) if (gChosenMove == MOVE_BATON_PASS && !(gBattleMoveFlags & MOVESTATUS_FAILED))
{ {
gBattleScripting.atk49_state++; gBattleScripting.atk49_state++;
break; break;
} }
*choicedMoveAtk = gOriginallyUsedMove; *choicedMoveAtk = gChosenMove;
LOOP: LOOP:
{ {
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
@ -5036,7 +5036,7 @@ static void atk49_moveend(void)
} }
if (gHitMarker & HITMARKER_ATTACKSTRING_PRINTED) if (gHitMarker & HITMARKER_ATTACKSTRING_PRINTED)
{ {
gOriginallyLastPrintedMoves[gBankAttacker] = gOriginallyUsedMove; gLastPrintedMoves[gBankAttacker] = gChosenMove;
} }
if (!(gAbsentBankFlags & gBitTable[gBankAttacker]) if (!(gAbsentBankFlags & gBitTable[gBankAttacker])
&& !(gBattleStruct->field_91 & gBitTable[gBankAttacker]) && !(gBattleStruct->field_91 & gBitTable[gBankAttacker])
@ -5044,13 +5044,13 @@ static void atk49_moveend(void)
{ {
if (gHitMarker & HITMARKER_OBEYS) if (gHitMarker & HITMARKER_OBEYS)
{ {
gOriginallyLastMoves[gBankAttacker] = gOriginallyUsedMove; gLastMoves[gBankAttacker] = gChosenMove;
gLastMoves[gBankAttacker] = gCurrentMove; gLastResultingMoves[gBankAttacker] = gCurrentMove;
} }
else else
{ {
gOriginallyLastMoves[gBankAttacker] = 0xFFFF;
gLastMoves[gBankAttacker] = 0xFFFF; gLastMoves[gBankAttacker] = 0xFFFF;
gLastResultingMoves[gBankAttacker] = 0xFFFF;
} }
if (!(gHitMarker & HITMARKER_FAINTED(gBankTarget))) if (!(gHitMarker & HITMARKER_FAINTED(gBankTarget)))
@ -5058,9 +5058,9 @@ static void atk49_moveend(void)
if (gHitMarker & HITMARKER_OBEYS && !(gBattleMoveFlags & MOVESTATUS_NOEFFECT)) if (gHitMarker & HITMARKER_OBEYS && !(gBattleMoveFlags & MOVESTATUS_NOEFFECT))
{ {
if (gOriginallyUsedMove == 0xFFFF) if (gChosenMove == 0xFFFF)
{ {
gLastLandedMoves[gBankTarget] = gOriginallyUsedMove; gLastLandedMoves[gBankTarget] = gChosenMove;
} }
else else
{ {
@ -5083,16 +5083,16 @@ static void atk49_moveend(void)
{ {
u8 target, attacker; u8 target, attacker;
*(gBattleStruct->mirrorMoves + gBankTarget * 2 + 0) = gOriginallyUsedMove; *(gBattleStruct->mirrorMoves + gBankTarget * 2 + 0) = gChosenMove;
*(gBattleStruct->mirrorMoves + gBankTarget * 2 + 1) = gOriginallyUsedMove >> 8; *(gBattleStruct->mirrorMoves + gBankTarget * 2 + 1) = gChosenMove >> 8;
target = gBankTarget; target = gBankTarget;
attacker = gBankAttacker; attacker = gBankAttacker;
*(attacker * 2 + target * 8 + (u8*)(gBattleStruct->mirrorMoveArrays) + 0) = gOriginallyUsedMove; *(attacker * 2 + target * 8 + (u8*)(gBattleStruct->mirrorMoveArrays) + 0) = gChosenMove;
target = gBankTarget; target = gBankTarget;
attacker = gBankAttacker; 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++; gBattleScripting.atk49_state++;
break; break;
@ -6386,7 +6386,7 @@ static void atk63_jumptorandomattack(void)
if (gBattlescriptCurrInstr[1] != 0) if (gBattlescriptCurrInstr[1] != 0)
gCurrentMove = gRandomMove; gCurrentMove = gRandomMove;
else else
gOriginallyUsedMove = gCurrentMove = gRandomMove; gChosenMove = gCurrentMove = gRandomMove;
gBattlescriptCurrInstr = gBattleScriptsForMoveEffects[gBattleMoves[gCurrentMove].effect]; gBattlescriptCurrInstr = gBattleScriptsForMoveEffects[gBattleMoves[gCurrentMove].effect];
} }
@ -7131,7 +7131,7 @@ static void atk76_various(void)
static void atk77_setprotectlike(void) // protect and endure static void atk77_setprotectlike(void) // protect and endure
{ {
bool8 notLastTurn = TRUE; bool8 notLastTurn = TRUE;
u16 lastMove = gLastMoves[gBankAttacker]; u16 lastMove = gLastResultingMoves[gBankAttacker];
if (lastMove != MOVE_PROTECT && lastMove != MOVE_DETECT && lastMove != MOVE_ENDURE) if (lastMove != MOVE_PROTECT && lastMove != MOVE_DETECT && lastMove != MOVE_ENDURE)
gDisableStructs[gBankAttacker].protectUses = 0; gDisableStructs[gBankAttacker].protectUses = 0;
@ -8352,7 +8352,7 @@ static void atk9A_setfocusenergy(void)
static void atk9B_transformdataexecution(void) static void atk9B_transformdataexecution(void)
{ {
gOriginallyUsedMove = 0xFFFF; gChosenMove = 0xFFFF;
gBattlescriptCurrInstr++; gBattlescriptCurrInstr++;
if (gBattleMons[gBankTarget].status2 & STATUS2_TRANSFORMED if (gBattleMons[gBankTarget].status2 & STATUS2_TRANSFORMED
|| gStatuses3[gBankTarget] & STATUS3_SEMI_INVULNERABLE) || gStatuses3[gBankTarget] & STATUS3_SEMI_INVULNERABLE)
@ -8432,12 +8432,12 @@ static bool8 IsMoveUncopyableByMimic(u16 move)
static void atk9D_mimicattackcopy(void) static void atk9D_mimicattackcopy(void)
{ {
gOriginallyUsedMove = 0xFFFF; gChosenMove = 0xFFFF;
if (IsMoveUncopyableByMimic(gOriginallyLastMoves[gBankTarget]) if (IsMoveUncopyableByMimic(gLastMoves[gBankTarget])
|| gBattleMons[gBankAttacker].status2 & STATUS2_TRANSFORMED || gBattleMons[gBankAttacker].status2 & STATUS2_TRANSFORMED
|| gOriginallyLastMoves[gBankTarget] == 0 || gLastMoves[gBankTarget] == 0
|| gOriginallyLastMoves[gBankTarget] == 0xFFFF) || gLastMoves[gBankTarget] == 0xFFFF)
{ {
gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1);
} }
@ -8447,20 +8447,20 @@ static void atk9D_mimicattackcopy(void)
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
if (gBattleMons[gBankAttacker].moves[i] == gOriginallyLastMoves[gBankTarget]) if (gBattleMons[gBankAttacker].moves[i] == gLastMoves[gBankTarget])
break; break;
} }
if (i == 4) if (i == 4)
{ {
gBattleMons[gBankAttacker].moves[gCurrMovePos] = gOriginallyLastMoves[gBankTarget]; gBattleMons[gBankAttacker].moves[gCurrMovePos] = gLastMoves[gBankTarget];
if (gBattleMoves[gOriginallyLastMoves[gBankTarget]].pp < 5) if (gBattleMoves[gLastMoves[gBankTarget]].pp < 5)
gBattleMons[gBankAttacker].pp[gCurrMovePos] = gBattleMoves[gOriginallyLastMoves[gBankTarget]].pp; gBattleMons[gBankAttacker].pp[gCurrMovePos] = gBattleMoves[gLastMoves[gBankTarget]].pp;
else else
gBattleMons[gBankAttacker].pp[gCurrMovePos] = 5; gBattleMons[gBankAttacker].pp[gCurrMovePos] = 5;
PREPARE_MOVE_BUFFER(gBattleTextBuff1, gOriginallyLastMoves[gBankTarget]) PREPARE_MOVE_BUFFER(gBattleTextBuff1, gLastMoves[gBankTarget])
gDisableStructs[gBankAttacker].unk18_b |= gBitTable[gCurrMovePos]; gDisableStructs[gBankAttacker].unk18_b |= gBitTable[gCurrMovePos];
gBattlescriptCurrInstr += 5; gBattlescriptCurrInstr += 5;
@ -8575,7 +8575,7 @@ static void atkA3_disablelastusedattack(void)
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
if (gBattleMons[gBankTarget].moves[i] == gOriginallyLastMoves[gBankTarget]) if (gBattleMons[gBankTarget].moves[i] == gLastMoves[gBankTarget])
break; break;
} }
if (gDisableStructs[gBankTarget].disabledMove == 0 if (gDisableStructs[gBankTarget].disabledMove == 0
@ -8600,13 +8600,13 @@ static void atkA4_trysetencore(void)
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
if (gBattleMons[gBankTarget].moves[i] == gOriginallyLastMoves[gBankTarget]) if (gBattleMons[gBankTarget].moves[i] == gLastMoves[gBankTarget])
break; break;
} }
if (gOriginallyLastMoves[gBankTarget] == MOVE_STRUGGLE if (gLastMoves[gBankTarget] == MOVE_STRUGGLE
|| gOriginallyLastMoves[gBankTarget] == MOVE_ENCORE || gLastMoves[gBankTarget] == MOVE_ENCORE
|| gOriginallyLastMoves[gBankTarget] == MOVE_MIRROR_MOVE) || gLastMoves[gBankTarget] == MOVE_MIRROR_MOVE)
{ {
i = 4; i = 4;
} }
@ -8726,13 +8726,13 @@ static void atkA7_setalwayshitflag(void)
static void atkA8_copymovepermanently(void) // sketch static void atkA8_copymovepermanently(void) // sketch
{ {
gOriginallyUsedMove = 0xFFFF; gChosenMove = 0xFFFF;
if (!(gBattleMons[gBankAttacker].status2 & STATUS2_TRANSFORMED) if (!(gBattleMons[gBankAttacker].status2 & STATUS2_TRANSFORMED)
&& gOriginallyLastPrintedMoves[gBankTarget] != MOVE_STRUGGLE && gLastPrintedMoves[gBankTarget] != MOVE_STRUGGLE
&& gOriginallyLastPrintedMoves[gBankTarget] != 0 && gLastPrintedMoves[gBankTarget] != 0
&& gOriginallyLastPrintedMoves[gBankTarget] != 0xFFFF && gLastPrintedMoves[gBankTarget] != 0xFFFF
&& gOriginallyLastPrintedMoves[gBankTarget] != MOVE_SKETCH) && gLastPrintedMoves[gBankTarget] != MOVE_SKETCH)
{ {
s32 i; s32 i;
@ -8740,7 +8740,7 @@ static void atkA8_copymovepermanently(void) // sketch
{ {
if (gBattleMons[gBankAttacker].moves[i] == MOVE_SKETCH) if (gBattleMons[gBankAttacker].moves[i] == MOVE_SKETCH)
continue; continue;
if (gBattleMons[gBankAttacker].moves[i] == gOriginallyLastPrintedMoves[gBankTarget]) if (gBattleMons[gBankAttacker].moves[i] == gLastPrintedMoves[gBankTarget])
break; break;
} }
@ -8752,8 +8752,8 @@ static void atkA8_copymovepermanently(void) // sketch
{ {
struct MovePpInfo movePpData; struct MovePpInfo movePpData;
gBattleMons[gBankAttacker].moves[gCurrMovePos] = gOriginallyLastPrintedMoves[gBankTarget]; gBattleMons[gBankAttacker].moves[gCurrMovePos] = gLastPrintedMoves[gBankTarget];
gBattleMons[gBankAttacker].pp[gCurrMovePos] = gBattleMoves[gOriginallyLastPrintedMoves[gBankTarget]].pp; gBattleMons[gBankAttacker].pp[gCurrMovePos] = gBattleMoves[gLastPrintedMoves[gBankTarget]].pp;
gActiveBank = gBankAttacker; gActiveBank = gBankAttacker;
for (i = 0; i < 4; i++) 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); EmitSetMonData(0, REQUEST_MOVES_PP_BATTLE, 0, sizeof(struct MovePpInfo), &movePpData);
MarkBufferBankForExecution(gActiveBank); MarkBufferBankForExecution(gActiveBank);
PREPARE_MOVE_BUFFER(gBattleTextBuff1, gOriginallyLastPrintedMoves[gBankTarget]) PREPARE_MOVE_BUFFER(gBattleTextBuff1, gLastPrintedMoves[gBankTarget])
gBattlescriptCurrInstr += 5; gBattlescriptCurrInstr += 5;
} }
@ -8899,14 +8899,14 @@ static void atkAC_remaininghptopower(void)
static void atkAD_tryspiteppreduce(void) static void atkAD_tryspiteppreduce(void)
{ {
if (gOriginallyLastMoves[gBankTarget] != 0 if (gLastMoves[gBankTarget] != 0
&& gOriginallyLastMoves[gBankTarget] != 0xFFFF) && gLastMoves[gBankTarget] != 0xFFFF)
{ {
s32 i; s32 i;
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
if (gOriginallyLastMoves[gBankTarget] == gBattleMons[gBankTarget].moves[i]) if (gLastMoves[gBankTarget] == gBattleMons[gBankTarget].moves[i])
break; break;
} }
@ -8916,7 +8916,7 @@ static void atkAD_tryspiteppreduce(void)
if (gBattleMons[gBankTarget].pp[i] < ppToDeduct) if (gBattleMons[gBankTarget].pp[i] < ppToDeduct)
ppToDeduct = gBattleMons[gBankTarget].pp[i]; ppToDeduct = gBattleMons[gBankTarget].pp[i];
PREPARE_MOVE_BUFFER(gBattleTextBuff1, gOriginallyLastMoves[gBankTarget]) PREPARE_MOVE_BUFFER(gBattleTextBuff1, gLastMoves[gBankTarget])
ConvertIntToDecimalStringN(gBattleTextBuff2, ppToDeduct, 0, 1); ConvertIntToDecimalStringN(gBattleTextBuff2, ppToDeduct, 0, 1);

View File

@ -43,7 +43,7 @@ extern s32 gBattleMoveDamage;
extern struct BattleEnigmaBerry gEnigmaBerries[BATTLE_BANKS_COUNT]; extern struct BattleEnigmaBerry gEnigmaBerries[BATTLE_BANKS_COUNT];
extern u8 gBattleBufferB[BATTLE_BANKS_COUNT][0x200]; extern u8 gBattleBufferB[BATTLE_BANKS_COUNT][0x200];
extern u32 gBattleTypeFlags; extern u32 gBattleTypeFlags;
extern u16 gOriginallyLastMoves[BATTLE_BANKS_COUNT]; extern u16 gLastMoves[BATTLE_BANKS_COUNT];
extern u32 gHitMarker; extern u32 gHitMarker;
extern u8 gEffectBank; extern u8 gEffectBank;
extern u16 gBattlePartyID[BATTLE_BANKS_COUNT]; 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); CancelMultiTurnMoves(gActiveBank);
if (gBattleTypeFlags & BATTLE_TYPE_PALACE) if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
@ -477,7 +477,7 @@ u8 CheckMoveLimitations(u8 bank, u8 unusableMoves, u8 check)
unusableMoves |= gBitTable[i]; unusableMoves |= gBitTable[i];
if (gBattleMons[bank].moves[i] == gDisableStructs[bank].disabledMove && check & MOVE_LIMITATION_DISABLED) if (gBattleMons[bank].moves[i] == gDisableStructs[bank].disabledMove && check & MOVE_LIMITATION_DISABLED)
unusableMoves |= gBitTable[i]; 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]; unusableMoves |= gBitTable[i];
if (gDisableStructs[bank].tauntTimer1 && check & MOVE_LIMITATION_TAUNT && gBattleMoves[gBattleMons[bank].moves[i]].power == 0) if (gDisableStructs[bank].tauntTimer1 && check & MOVE_LIMITATION_TAUNT && gBattleMoves[gBattleMons[bank].moves[i]].power == 0)
unusableMoves |= gBitTable[i]; unusableMoves |= gBitTable[i];

View File

@ -312,7 +312,7 @@ gUnknown_020241E9: @ 20241E9
gCurrentMove: @ 20241EA gCurrentMove: @ 20241EA
.space 0x2 .space 0x2
gOriginallyUsedMove: @ 20241EC gChosenMove: @ 20241EC
.space 0x2 .space 0x2
gRandomMove: @ 20241EE gRandomMove: @ 20241EE
@ -369,10 +369,10 @@ gSelectionBattleScripts: @ 2024220
gPalaceSelectionBattleScripts: @ 2024230 gPalaceSelectionBattleScripts: @ 2024230
.space 0x10 .space 0x10
gOriginallyLastPrintedMoves: @ 2024240 gLastPrintedMoves: @ 2024240
.space 0x8 .space 0x8
gOriginallyLastMoves: @ 2024248 gLastMoves: @ 2024248
.space 0x8 .space 0x8
gLastLandedMoves: @ 2024250 gLastLandedMoves: @ 2024250
@ -381,7 +381,7 @@ gLastLandedMoves: @ 2024250
gLastHitByType: @ 2024258 gLastHitByType: @ 2024258
.space 0x8 .space 0x8
gLastMoves: @ 2024260 gLastResultingMoves: @ 2024260
.space 0x8 .space 0x8
gLockedMoves: @ 2024268 gLockedMoves: @ 2024268