fix, rename, label battle labels and battlescripts

This commit is contained in:
DizzyEggg 2017-11-26 13:26:58 +01:00
parent cc572f7c00
commit 9886eeb5d8
11 changed files with 177 additions and 207 deletions

View File

@ -1231,6 +1231,11 @@
chosenstatusanimation \bank 0x1 \status
.endm
.macro sethword dst, value
setbyte \dst, \value & 0xFF
setbyte \dst + 1, (\value >> 8) & 0xFF
.endm
.macro setword dst, value
setbyte \dst, \value & 0xFF
setbyte \dst + 1, (\value >> 8) & 0xFF
@ -1242,6 +1247,10 @@
copyarray \dst, \src, 0x1
.endm
.macro copyhword dst, src
copyarray \dst, \src, 0x2
.endm
.macro copyword dst, src
copyarray \dst, \src, 0x4
.endm

View File

@ -145,7 +145,6 @@
.equiv sANIM_ARG1, gBattleScripting + 0x10
.equiv sANIM_ARG2, gBattleScripting + 0x11
.equiv sTRIPLE_KICK_POWER, gBattleScripting + 0x12
.equiv sFIELD_13, gBattleScripting + 0x13
.equiv sMOVEEND_STATE, gBattleScripting + 0x14
.equiv sFIELD_15, gBattleScripting + 0x15
.equiv sFIELD_16, gBattleScripting + 0x16

View File

@ -299,8 +299,8 @@ BattleScript_EffectSleep::
attackstring
ppreduce
jumpifstatus2 TARGET, STATUS2_SUBSTITUTE, BattleScript_ButItFailed
jumpifstatus TARGET, STATUS_SLEEP, BattleScript_82D8AB0
jumpifcantmakeasleep BattleScript_82D8ACF
jumpifstatus TARGET, STATUS_SLEEP, BattleScript_AlreadyAsleep
jumpifcantmakeasleep BattleScript_CantMakeAsleep
jumpifstatus TARGET, STATUS_ANY, BattleScript_ButItFailed
accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE
jumpifsideaffecting TARGET, SIDE_STATUS_SAFEGUARD, BattleScript_SafeguardProtected
@ -310,20 +310,20 @@ BattleScript_EffectSleep::
seteffectprimary
goto BattleScript_MoveEnd
BattleScript_82D8AB0::
BattleScript_AlreadyAsleep::
various ATTACKER, 0x17
pause 0x20
printstring STRINGID_PKMNALREADYASLEEP
waitmessage 0x40
goto BattleScript_MoveEnd
BattleScript_82D8AC1::
BattleScript_WasntAffected::
pause 0x20
printstring STRINGID_PKMNWASNTAFFECTED
waitmessage 0x40
goto BattleScript_MoveEnd
BattleScript_82D8ACF::
BattleScript_CantMakeAsleep::
pause 0x20
printfromtable gUproarAwakeStringIds
waitmessage 0x40
@ -446,7 +446,7 @@ BattleScript_82D8C0E::
attackstring
ppreduce
waitmessage 0x40
goto BattleScript_82D8AC1
goto BattleScript_WasntAffected
BattleScript_82D8C18::
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
@ -628,7 +628,7 @@ BattleScript_EffectMultiHit::
BattleScript_82D8DFD::
jumpifhasnohp ATTACKER, BattleScript_82D8E93
jumpifhasnohp TARGET, BattleScript_82D8E74
jumpifhalfword EQUAL, gLastUsedMove, 0xD6, BattleScript_82D8E1F
jumpifhalfword EQUAL, gOriginallyUsedMove, MOVE_SLEEP_TALK, BattleScript_82D8E1F
jumpifstatus ATTACKER, STATUS_SLEEP, BattleScript_82D8E74
BattleScript_82D8E1F::
movevaluescleanup
@ -655,7 +655,6 @@ BattleScript_82D8E1F::
jumpifbyte COMMON_BITS, gBattleMoveFlags, MOVESTATUS_ENDURED, BattleScript_82D8E74
decrementmultihit BattleScript_82D8DFD
goto BattleScript_82D8E74
BattleScript_82D8E71::
pause 0x20
BattleScript_82D8E74::
@ -927,7 +926,7 @@ BattleScript_EffectConfuse::
ppreduce
jumpifability TARGET, ABILITY_OWN_TEMPO, BattleScript_OwnTempoPrevents
jumpifstatus2 TARGET, STATUS2_SUBSTITUTE, BattleScript_ButItFailed
jumpifstatus2 TARGET, STATUS2_CONFUSION, BattleScript_82D9201
jumpifstatus2 TARGET, STATUS2_CONFUSION, BattleScript_AlreadyConfused
accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE
jumpifsideaffecting TARGET, SIDE_STATUS_SAFEGUARD, BattleScript_SafeguardProtected
attackanimation
@ -938,7 +937,7 @@ BattleScript_EffectConfuse::
waitmessage 0x40
goto BattleScript_MoveEnd
BattleScript_82D9201::
BattleScript_AlreadyConfused::
various ATTACKER, 0x17
pause 0x20
printstring STRINGID_PKMNALREADYCONFUSED
@ -1033,7 +1032,7 @@ BattleScript_EffectParalyze::
jumpifstatus2 TARGET, STATUS2_SUBSTITUTE, BattleScript_ButItFailed
typecalc
jumpifbyte COMMON_BITS, gBattleMoveFlags, MOVESTATUS_MISSED | MOVESTATUS_NOTAFFECTED | MOVESTATUS_FAILED, BattleScript_ButItFailed
jumpifstatus TARGET, STATUS_PARALYSIS, BattleScript_82D9351
jumpifstatus TARGET, STATUS_PARALYSIS, BattleScript_AlreadyParalyzed
jumpifstatus TARGET, STATUS_ANY, BattleScript_ButItFailed
accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE
jumpifsideaffecting TARGET, SIDE_STATUS_SAFEGUARD, BattleScript_SafeguardProtected
@ -1045,7 +1044,7 @@ BattleScript_EffectParalyze::
waitmessage 0x40
goto BattleScript_MoveEnd
BattleScript_82D9351::
BattleScript_AlreadyParalyzed::
various ATTACKER, 0x17
pause 0x20
printstring STRINGID_PKMNISALREADYPARALYZED
@ -1282,7 +1281,7 @@ BattleScript_EffectSnore::
ppreduce
goto BattleScript_ButItFailed
BattleScript_82D95CE::
jumpifhalfword EQUAL, gLastUsedMove, 0xD6, BattleScript_82D95E2
jumpifhalfword EQUAL, gOriginallyUsedMove, MOVE_SLEEP_TALK, BattleScript_82D95E2
printstring STRINGID_PKMNFASTASLEEP
waitmessage 0x40
statusanimation ATTACKER
@ -1406,26 +1405,25 @@ BattleScript_EffectTripleKick::
attackcanceler
attackstring
ppreduce
setbyte sTRIPLE_KICK_POWER, 0x0
setbyte sFIELD_13, 0x0
sethword sTRIPLE_KICK_POWER, 0x0
initmultihitstring
setmultihit 0x3
BattleScript_82D9718::
jumpifhasnohp ATTACKER, BattleScript_82D97D7
jumpifhasnohp TARGET, BattleScript_82D9799
jumpifhalfword EQUAL, gLastUsedMove, 0xD6, BattleScript_82D973A
jumpifstatus ATTACKER, STATUS_SLEEP, BattleScript_82D9799
BattleScript_TripleKickLoop::
jumpifhasnohp ATTACKER, BattleScript_TripleKickEnd
jumpifhasnohp TARGET, BattleScript_TripleKickNoMoreHits
jumpifhalfword EQUAL, gOriginallyUsedMove, MOVE_SLEEP_TALK, BattleScript_82D973A
jumpifstatus ATTACKER, STATUS_SLEEP, BattleScript_TripleKickNoMoreHits
BattleScript_82D973A::
accuracycheck BattleScript_82D9799, ACC_CURR_MOVE
accuracycheck BattleScript_TripleKickNoMoreHits, ACC_CURR_MOVE
movevaluescleanup
addbyte sTRIPLE_KICK_POWER, 0xA
addbyte sTRIPLE_KICK_POWER, 10
addbyte sMULTIHIT_STRING + 4, 0x1
copyarray gDynamicBasePower, sTRIPLE_KICK_POWER, 0x2
copyhword gDynamicBasePower, sTRIPLE_KICK_POWER
critcalc
damagecalc
typecalc
adjustnormaldamage
jumpifbyte COMMON_BITS, gBattleMoveFlags, MOVESTATUS_MISSED | MOVESTATUS_NOTAFFECTED | MOVESTATUS_FAILED, BattleScript_82D9799
jumpifbyte COMMON_BITS, gBattleMoveFlags, MOVESTATUS_MISSED | MOVESTATUS_NOTAFFECTED | MOVESTATUS_FAILED, BattleScript_TripleKickNoMoreHits
attackanimation
waitanimation
effectivenesssound
@ -1439,22 +1437,22 @@ BattleScript_82D973A::
waitmessage 0x1
setbyte sMOVEEND_STATE, 0x0
moveend 0x2, 0x10
jumpifbyte COMMON_BITS, gBattleMoveFlags, MOVESTATUS_ENDURED, BattleScript_82D97AD
decrementmultihit BattleScript_82D9718
goto BattleScript_82D97AD
BattleScript_82D9799::
jumpifbyte COMMON_BITS, gBattleMoveFlags, MOVESTATUS_ENDURED, BattleScript_TripleKickPrintStrings
decrementmultihit BattleScript_TripleKickLoop
goto BattleScript_TripleKickPrintStrings
BattleScript_TripleKickNoMoreHits::
pause 0x20
jumpifbyte EQUAL, sMULTIHIT_STRING + 4, 0x0, BattleScript_82D97AD
jumpifbyte EQUAL, sMULTIHIT_STRING + 4, 0x0, BattleScript_TripleKickPrintStrings
bicbyte gBattleMoveFlags, MOVESTATUS_MISSED
BattleScript_82D97AD::
BattleScript_TripleKickPrintStrings::
resultmessage
waitmessage 0x40
jumpifbyte EQUAL, sMULTIHIT_STRING + 4, 0x0, BattleScript_82D97D7
jumpifbyte COMMON_BITS, gBattleMoveFlags, MOVESTATUS_NOTAFFECTED, BattleScript_82D97D7
jumpifbyte EQUAL, sMULTIHIT_STRING + 4, 0x0, BattleScript_TripleKickEnd
jumpifbyte COMMON_BITS, gBattleMoveFlags, MOVESTATUS_NOTAFFECTED, BattleScript_TripleKickEnd
copyarray gBattleTextBuff1, sMULTIHIT_STRING, 0x6
printstring STRINGID_HITXTIMES
waitmessage 0x40
BattleScript_82D97D7::
BattleScript_TripleKickEnd::
seteffectwithchance
tryfaintmon TARGET, FALSE, NULL
setbyte sMOVEEND_STATE, 0xE
@ -3545,7 +3543,6 @@ BattleScript_82DAFE4::
jumpifbyte NOT_EQUAL, cMULTISTRING_CHOOSER, 0x0, BattleScript_82DB001
accuracycheck BattleScript_82DB058, MOVE_FUTURE_SIGHT
goto BattleScript_82DB008
BattleScript_82DB001::
accuracycheck BattleScript_82DB058, MOVE_DOOM_DESIRE
BattleScript_82DB008::
@ -3553,7 +3550,6 @@ BattleScript_82DB008::
jumpifbyte NOT_EQUAL, cMULTISTRING_CHOOSER, 0x0, BattleScript_82DB020
playanimation ATTACKER, ANIM_FUTURE_SIGHT_HIT, NULL
goto BattleScript_82DB027
BattleScript_82DB020::
playanimation ATTACKER, ANIM_x13, NULL
BattleScript_82DB027::

View File

@ -706,13 +706,6 @@ struct BattleStruct
extern struct BattleStruct* gBattleStruct;
#define MEME_ACCESS_U8(structName, structPtr, arrayId, offsetField, value) \
{ \
u8* var2 = (u8*)((u32)(arrayId)); \
var2 = (u32)(structPtr) + var2; \
var2[offsetof(struct structName, offsetField)] = value; \
}
#define GET_MOVE_TYPE(move, typeArg) \
{ \
if (gBattleStruct->dynamicMoveType) \
@ -850,8 +843,7 @@ struct BattleScripting
u8 twoTurnsMoveStringId;
u8 animArg1;
u8 animArg2;
u8 tripleKickPower;
u8 field_13;
u16 tripleKickPower;
u8 atk49_state;
u8 field_15;
u8 field_16;

View File

@ -13,9 +13,9 @@ extern const u8 BattleScript_PrintMoveMissed[];
extern const u8 BattleScript_MoveMissedPause[];
extern const u8 BattleScript_MoveMissed[];
extern const u8 BattleScript_EffectSleep[];
extern const u8 BattleScript_82D8AB0[];
extern const u8 BattleScript_82D8AC1[];
extern const u8 BattleScript_82D8ACF[];
extern const u8 BattleScript_AlreadyAsleep[];
extern const u8 BattleScript_WasntAffected[];
extern const u8 BattleScript_CantMakeAsleep[];
extern const u8 BattleScript_EffectPoisonHit[];
extern const u8 BattleScript_EffectAbsorb[];
extern const u8 BattleScript_82D8B26[];
@ -94,7 +94,7 @@ extern const u8 BattleScript_EffectMist[];
extern const u8 BattleScript_EffectFocusEnergy[];
extern const u8 BattleScript_EffectRecoil[];
extern const u8 BattleScript_EffectConfuse[];
extern const u8 BattleScript_82D9201[];
extern const u8 BattleScript_AlreadyConfused[];
extern const u8 BattleScript_EffectAttackUp2[];
extern const u8 BattleScript_EffectDefenseUp2[];
extern const u8 BattleScript_EffectSpeedUp2[];
@ -109,7 +109,7 @@ extern const u8 BattleScript_EffectReflect[];
extern const u8 BattleScript_82D928C[];
extern const u8 BattleScript_EffectPoison[];
extern const u8 BattleScript_EffectParalyze[];
extern const u8 BattleScript_82D9351[];
extern const u8 BattleScript_AlreadyParalyzed[];
extern const u8 BattleScript_LimberProtected[];
extern const u8 BattleScript_EffectAttackDownHit[];
extern const u8 BattleScript_EffectDefenseDownHit[];
@ -155,11 +155,11 @@ extern const u8 BattleScript_EffectHealBell[];
extern const u8 BattleScript_82D96ED[];
extern const u8 BattleScript_82D96FE[];
extern const u8 BattleScript_EffectTripleKick[];
extern const u8 BattleScript_82D9718[];
extern const u8 BattleScript_TripleKickLoop[];
extern const u8 BattleScript_82D973A[];
extern const u8 BattleScript_82D9799[];
extern const u8 BattleScript_82D97AD[];
extern const u8 BattleScript_82D97D7[];
extern const u8 BattleScript_TripleKickNoMoreHits[];
extern const u8 BattleScript_TripleKickPrintStrings[];
extern const u8 BattleScript_TripleKickEnd[];
extern const u8 BattleScript_EffectThief[];
extern const u8 BattleScript_EffectMeanLook[];
extern const u8 BattleScript_EffectNightmare[];

View File

@ -123,11 +123,11 @@ extern s32 gBattleMoveDamage;
extern const u8* gUnknown_02024230[BATTLE_BANKS_COUNT];
extern u16 gUnknownMovesUsedByBanks[BATTLE_BANKS_COUNT];
extern u16 gLastUsedMovesByBanks[BATTLE_BANKS_COUNT];
extern u16 gUnknown_02024250[BATTLE_BANKS_COUNT];
extern u16 gTurnMovesHitWith[BATTLE_BANKS_COUNT];
extern u16 gUnknown_02024258[BATTLE_BANKS_COUNT];
extern u16 gUnknown_02024260[BATTLE_BANKS_COUNT];
extern u16 gLockedMoves[BATTLE_BANKS_COUNT];
extern u8 gUnknown_02024270[BATTLE_BANKS_COUNT];
extern u8 gTurnMovesHitBy[BATTLE_BANKS_COUNT];
extern u8 gUnknown_02024284[BATTLE_BANKS_COUNT];
extern u32 gStatuses3[BATTLE_BANKS_COUNT];
extern u16 gSideAffecting[2];
@ -149,7 +149,7 @@ extern u16 gDynamicBasePower;
extern u8 gCritMultiplier;
extern u8 gCurrMovePos;
extern u8 gUnknown_020241E9;
extern u16 gLastUsedMove;
extern u16 gOriginallyUsedMove;
extern const struct BattleMove gBattleMoves[];
extern const u16 gUnknown_08C004E0[]; // battle textbox palette
@ -461,7 +461,7 @@ static void sub_8036A5C(void)
u32 status = 0;
s32 i;
for (i = 0; i < 6; i++)
for (i = 0; i < PARTY_SIZE; i++)
{
species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2);
hp = GetMonData(&gPlayerParty[i], MON_DATA_HP);
@ -1878,7 +1878,7 @@ static void sub_8038B94(u8 taskId)
}
r7 = 0;
for (i = 0; i < 6; i++)
for (i = 0; i < PARTY_SIZE; i++)
{
u16 species = GetMonData(&sp4[i], MON_DATA_SPECIES2);
u16 hp = GetMonData(&sp4[i], MON_DATA_HP);
@ -1902,7 +1902,7 @@ static void sub_8038B94(u8 taskId)
gTasks[taskId].data[3] = r7;
r7 = 0;
for (i = 0; i < 6; i++)
for (i = 0; i < PARTY_SIZE; i++)
{
u16 species = GetMonData(&sp8[i], MON_DATA_SPECIES2);
u16 hp = GetMonData(&sp8[i], MON_DATA_HP);
@ -2741,13 +2741,13 @@ static void BattleStartClearSetData(void)
for (j = 0; j < sizeof(struct DisableStruct); j++)
dataPtr[j] = 0;
gDisableStructs[i].isFirstTurn= 2;
gDisableStructs[i].isFirstTurn = 2;
gUnknown_02024284[i] = 0;
gLastUsedMovesByBanks[i] = 0;
gUnknown_02024250[i] = 0;
gTurnMovesHitWith[i] = 0;
gUnknown_02024258[i] = 0;
gUnknown_02024260[i] = 0;
gUnknown_02024270[i] = 0xFF;
gTurnMovesHitBy[i] = 0xFF;
gLockedMoves[i] = 0;
gUnknownMovesUsedByBanks[i] = 0;
gBattleResources->flags->flags[i] = 0;
@ -2911,11 +2911,11 @@ void SwitchInClearSetData(void)
gDisableStructs[gActiveBank].isFirstTurn= 2;
gDisableStructs[gActiveBank].truantUnknownBit = disableStructCopy.truantUnknownBit;
gLastUsedMovesByBanks[gActiveBank] = 0;
gUnknown_02024250[gActiveBank] = 0;
gTurnMovesHitWith[gActiveBank] = 0;
gUnknown_02024258[gActiveBank] = 0;
gUnknown_02024260[gActiveBank] = 0;
gUnknownMovesUsedByBanks[gActiveBank] = 0;
gUnknown_02024270[gActiveBank] = 0xFF;
gTurnMovesHitBy[gActiveBank] = 0xFF;
*(gBattleStruct->mirrorMoves + gActiveBank * 2 + 0) = 0;
*(gBattleStruct->mirrorMoves + gActiveBank * 2 + 1) = 0;
@ -3003,11 +3003,11 @@ void FaintClearSetData(void)
gDisableStructs[gActiveBank].isFirstTurn = 2;
gLastUsedMovesByBanks[gActiveBank] = 0;
gUnknown_02024250[gActiveBank] = 0;
gTurnMovesHitWith[gActiveBank] = 0;
gUnknown_02024258[gActiveBank] = 0;
gUnknown_02024260[gActiveBank] = 0;
gUnknownMovesUsedByBanks[gActiveBank] = 0;
gUnknown_02024270[gActiveBank] = 0xFF;
gTurnMovesHitBy[gActiveBank] = 0xFF;
*(u8*)((u8*)(&gBattleStruct->choicedMove[gActiveBank]) + 0) = 0;
*(u8*)((u8*)(&gBattleStruct->choicedMove[gActiveBank]) + 1) = 0;
@ -5048,19 +5048,19 @@ static void HandleAction_UseMove(void)
if (gProtectStructs[gBankAttacker].onlyStruggle)
{
gProtectStructs[gBankAttacker].onlyStruggle = 0;
gCurrentMove = gLastUsedMove = MOVE_STRUGGLE;
gCurrentMove = gOriginallyUsedMove = 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 = gLastUsedMove = gLockedMoves[gBankAttacker];
gCurrentMove = gOriginallyUsedMove = 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 = gLastUsedMove = gDisableStructs[gBankAttacker].encoredMove;
gCurrentMove = gOriginallyUsedMove = 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 = gLastUsedMove = gBattleMons[gBankAttacker].moves[gCurrMovePos];
gCurrentMove = gOriginallyUsedMove = 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 = gLastUsedMove = gBattleMons[gBankAttacker].moves[gCurrMovePos];
gCurrentMove = gOriginallyUsedMove = gBattleMons[gBankAttacker].moves[gCurrMovePos];
*(gBattleStruct->moveTarget + gBankAttacker) = GetMoveTarget(gCurrentMove, 0);
}
else
{
gCurrentMove = gLastUsedMove = gBattleMons[gBankAttacker].moves[gCurrMovePos];
gCurrentMove = gOriginallyUsedMove = gBattleMons[gBankAttacker].moves[gCurrMovePos];
}
if (gBattleMons[gBankAttacker].hp != 0)
@ -5122,7 +5122,7 @@ static void HandleAction_UseMove(void)
}
if (var == 4)
{
if (gBattleMoves[gLastUsedMove].target & MOVE_TARGET_RANDOM)
if (gBattleMoves[gOriginallyUsedMove].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[gLastUsedMove].target & MOVE_TARGET_RANDOM)
&& gBattleMoves[gOriginallyUsedMove].target & MOVE_TARGET_RANDOM)
{
if (GetBankSide(gBankAttacker) == SIDE_PLAYER)
{
@ -5600,7 +5600,7 @@ static void HandleAction_ActionFinished(void)
gBattleMoveFlags = 0;
gBattleScripting.animTurn = 0;
gBattleScripting.animTargetsHit = 0;
gUnknown_02024250[gBankAttacker] = 0;
gTurnMovesHitWith[gBankAttacker] = 0;
gUnknown_02024258[gBankAttacker] = 0;
gBattleStruct->dynamicMoveType = 0;
gDynamicBasePower = 0;

View File

@ -16,8 +16,8 @@ extern u32 gBattleTypeFlags;
extern u32 gStatuses3[BATTLE_BANKS_COUNT];
extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT];
extern u16 gBattlePartyID[BATTLE_BANKS_COUNT];
extern u16 gUnknown_02024250[BATTLE_BANKS_COUNT];
extern u8 gUnknown_02024270[BATTLE_BANKS_COUNT];
extern u16 gTurnMovesHitWith[BATTLE_BANKS_COUNT];
extern u8 gTurnMovesHitBy[BATTLE_BANKS_COUNT];
extern u16 gDynamicBasePower;
extern u8 gBattleMoveFlags;
extern u8 gCritMultiplier;
@ -141,11 +141,11 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void)
if (HasSuperEffectiveMoveAgainstOpponents(TRUE) && Random() % 3 != 0)
return FALSE;
if (gUnknown_02024250[gActiveBank] == 0)
if (gTurnMovesHitWith[gActiveBank] == 0)
return FALSE;
if (gUnknown_02024250[gActiveBank] == 0xFFFF)
if (gTurnMovesHitWith[gActiveBank] == 0xFFFF)
return FALSE;
if (gBattleMoves[gUnknown_02024250[gActiveBank]].power == 0)
if (gBattleMoves[gTurnMovesHitWith[gActiveBank]].power == 0)
return FALSE;
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
@ -162,11 +162,11 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void)
bankIn2 = gActiveBank;
}
if (gBattleMoves[gUnknown_02024250[gActiveBank]].type == TYPE_FIRE)
if (gBattleMoves[gTurnMovesHitWith[gActiveBank]].type == TYPE_FIRE)
absorbingTypeAbility = ABILITY_FLASH_FIRE;
else if (gBattleMoves[gUnknown_02024250[gActiveBank]].type == TYPE_WATER)
else if (gBattleMoves[gTurnMovesHitWith[gActiveBank]].type == TYPE_WATER)
absorbingTypeAbility = ABILITY_WATER_ABSORB;
else if (gBattleMoves[gUnknown_02024250[gActiveBank]].type == TYPE_ELECTRIC)
else if (gBattleMoves[gTurnMovesHitWith[gActiveBank]].type == TYPE_ELECTRIC)
absorbingTypeAbility = ABILITY_VOLT_ABSORB;
else
return FALSE;
@ -238,13 +238,13 @@ static bool8 ShouldSwitchIfNaturalCure(void)
if (gBattleMons[gActiveBank].hp < gBattleMons[gActiveBank].maxHP / 2)
return FALSE;
if ((gUnknown_02024250[gActiveBank] == 0 || gUnknown_02024250[gActiveBank] == 0xFFFF) && Random() & 1)
if ((gTurnMovesHitWith[gActiveBank] == 0 || gTurnMovesHitWith[gActiveBank] == 0xFFFF) && Random() & 1)
{
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBank) = 6;
EmitTwoReturnValues(1, ACTION_SWITCH, 0);
return TRUE;
}
else if (gBattleMoves[gUnknown_02024250[gActiveBank]].power == 0 && Random() & 1)
else if (gBattleMoves[gTurnMovesHitWith[gActiveBank]].power == 0 && Random() & 1)
{
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBank) = 6;
EmitTwoReturnValues(1, ACTION_SWITCH, 0);
@ -345,13 +345,13 @@ static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent)
u16 move;
u8 moveFlags;
if (gUnknown_02024250[gActiveBank] == 0)
if (gTurnMovesHitWith[gActiveBank] == 0)
return FALSE;
if (gUnknown_02024250[gActiveBank] == 0xFFFF)
if (gTurnMovesHitWith[gActiveBank] == 0xFFFF)
return FALSE;
if (gUnknown_02024270[gActiveBank] == 0xFF)
if (gTurnMovesHitBy[gActiveBank] == 0xFF)
return FALSE;
if (gBattleMoves[gUnknown_02024250[gActiveBank]].power == 0)
if (gBattleMoves[gTurnMovesHitWith[gActiveBank]].power == 0)
return FALSE;
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
@ -411,10 +411,10 @@ static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent)
else
monAbility = gBaseStats[species].ability1;
moveFlags = AI_TypeCalc(gUnknown_02024250[gActiveBank], species, monAbility);
moveFlags = AI_TypeCalc(gTurnMovesHitWith[gActiveBank], species, monAbility);
if (moveFlags & flags)
{
bankIn1 = gUnknown_02024270[gActiveBank];
bankIn1 = gTurnMovesHitBy[gActiveBank];
for (j = 0; j < 4; j++)
{

View File

@ -38,7 +38,7 @@ extern u8 gEffectBank;
extern u16 gBattleWeather;
extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT];
extern u16 gCurrentMove;
extern u16 gLastUsedMove;
extern u16 gOriginallyUsedMove;
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->lastMove = gLastUsedMove;
stringInfo->lastMove = gOriginallyUsedMove;
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->lastMove = gLastUsedMove;
stringInfo->lastMove = gOriginallyUsedMove;
stringInfo->lastItem = gLastUsedItem;
stringInfo->lastAbility = gLastUsedAbility;
stringInfo->scrActive = gBattleScripting.bank;

View File

@ -74,10 +74,10 @@ extern u8 gCurrentActionFuncId;
extern u32 gHitMarker;
extern u8 gBattleMoveFlags;
extern u8 gBattleCommunication[];
extern u16 gUnknown_02024250[4];
extern u16 gTurnMovesHitWith[4];
extern u16 gUnknown_02024258[4];
extern u16 gUnknown_02024260[4];
extern u8 gUnknown_02024270[4];
extern u8 gTurnMovesHitBy[4];
extern u8 gStringBank;
extern u16 gDynamicBasePower;
extern u16 gLastUsedItem;
@ -99,7 +99,7 @@ extern u8 gCurrentTurnActionNumber;
extern u8 gBattleBufferB[BATTLE_BANKS_COUNT][0x200];
extern u16 gLockedMoves[BATTLE_BANKS_COUNT];
extern u16 gPartnerTrainerId;
extern u16 gLastUsedMove;
extern u16 gOriginallyUsedMove;
extern u16 gUnknownMovesUsedByBanks[BATTLE_BANKS_COUNT];
extern u16 gLastUsedMovesByBanks[BATTLE_BANKS_COUNT];
extern u16 gTrainerBattleOpponent_A;
@ -1105,7 +1105,7 @@ static void atk00_attackcanceler(void)
{
CancelMultiTurnMoves(gBankAttacker);
gBattleMoveFlags |= MOVESTATUS_MISSED;
gUnknown_02024250[gBankTarget] = 0;
gTurnMovesHitWith[gBankTarget] = 0;
gUnknown_02024258[gBankTarget] = 0;
gBattleCommunication[6] = 1;
gBattlescriptCurrInstr++;
@ -1121,7 +1121,7 @@ static void JumpIfMoveFailed(u8 adder, u16 move)
const void* BS_ptr = gBattlescriptCurrInstr + adder;
if (gBattleMoveFlags & MOVESTATUS_NOEFFECT)
{
gUnknown_02024250[gBankTarget] = 0;
gTurnMovesHitWith[gBankTarget] = 0;
gUnknown_02024258[gBankTarget] = 0;
BS_ptr = BSScriptReadPtr(gBattlescriptCurrInstr + 1);
}
@ -1484,7 +1484,7 @@ static void atk06_typecalc(void)
{
gLastUsedAbility = gBattleMons[gBankTarget].ability;
gBattleMoveFlags |= (MOVESTATUS_MISSED | MOVESTATUS_NOTAFFECTED);
gUnknown_02024250[gBankTarget] = 0;
gTurnMovesHitWith[gBankTarget] = 0;
gUnknown_02024258[gBankTarget] = 0;
gBattleCommunication[6] = moveType;
RecordAbilityBattle(gBankTarget, gLastUsedAbility);
@ -1520,7 +1520,7 @@ static void atk06_typecalc(void)
{
gLastUsedAbility = ABILITY_WONDER_GUARD;
gBattleMoveFlags |= MOVESTATUS_MISSED;
gUnknown_02024250[gBankTarget] = 0;
gTurnMovesHitWith[gBankTarget] = 0;
gUnknown_02024258[gBankTarget] = 0;
gBattleCommunication[6] = 3;
RecordAbilityBattle(gBankTarget, gLastUsedAbility);
@ -4860,10 +4860,10 @@ static void atk49_moveend(void)
effect = FALSE;
if (gLastUsedMove == 0xFFFF)
if (gOriginallyUsedMove == 0xFFFF)
lastMove = 0;
else
lastMove = gLastUsedMove;
lastMove = gOriginallyUsedMove;
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
|| gLastUsedMove == MOVE_STRUGGLE || (*choicedMoveAtk != 0 && *choicedMoveAtk != 0xFFFF))
|| gOriginallyUsedMove == MOVE_STRUGGLE || (*choicedMoveAtk != 0 && *choicedMoveAtk != 0xFFFF))
goto LOOP;
if (gLastUsedMove == MOVE_BATON_PASS && !(gBattleMoveFlags & MOVESTATUS_FAILED))
if (gOriginallyUsedMove == MOVE_BATON_PASS && !(gBattleMoveFlags & MOVESTATUS_FAILED))
{
gBattleScripting.atk49_state++;
break;
}
*choicedMoveAtk = gLastUsedMove;
*choicedMoveAtk = gOriginallyUsedMove;
LOOP:
{
for (i = 0; i < 4; i++)
@ -5036,7 +5036,7 @@ static void atk49_moveend(void)
}
if (gHitMarker & HITMARKER_ATTACKSTRING_PRINTED)
{
gUnknownMovesUsedByBanks[gBankAttacker] = gLastUsedMove;
gUnknownMovesUsedByBanks[gBankAttacker] = gOriginallyUsedMove;
}
if (!(gAbsentBankFlags & gBitTable[gBankAttacker])
&& !(gBattleStruct->field_91 & gBitTable[gBankAttacker])
@ -5044,7 +5044,7 @@ static void atk49_moveend(void)
{
if (gHitMarker & HITMARKER_OBEYS)
{
gLastUsedMovesByBanks[gBankAttacker] = gLastUsedMove;
gLastUsedMovesByBanks[gBankAttacker] = gOriginallyUsedMove;
gUnknown_02024260[gBankAttacker] = gCurrentMove;
}
else
@ -5054,23 +5054,23 @@ static void atk49_moveend(void)
}
if (!(gHitMarker & HITMARKER_FAINTED(gBankTarget)))
gUnknown_02024270[gBankTarget] = gBankAttacker;
gTurnMovesHitBy[gBankTarget] = gBankAttacker;
if (gHitMarker & HITMARKER_OBEYS && !(gBattleMoveFlags & MOVESTATUS_NOEFFECT))
{
if (gLastUsedMove == 0xFFFF)
if (gOriginallyUsedMove == 0xFFFF)
{
gUnknown_02024250[gBankTarget] = gLastUsedMove;
gTurnMovesHitWith[gBankTarget] = gOriginallyUsedMove;
}
else
{
gUnknown_02024250[gBankTarget] = gCurrentMove;
gTurnMovesHitWith[gBankTarget] = gCurrentMove;
GET_MOVE_TYPE(gCurrentMove, gUnknown_02024258[gBankTarget]);
}
}
else
{
gUnknown_02024250[gBankTarget] = 0xFFFF;
gTurnMovesHitWith[gBankTarget] = 0xFFFF;
}
}
gBattleScripting.atk49_state++;
@ -5083,16 +5083,16 @@ static void atk49_moveend(void)
{
u8 target, attacker;
*(gBattleStruct->mirrorMoves + gBankTarget * 2 + 0) = gLastUsedMove;
*(gBattleStruct->mirrorMoves + gBankTarget * 2 + 1) = gLastUsedMove >> 8;
*(gBattleStruct->mirrorMoves + gBankTarget * 2 + 0) = gOriginallyUsedMove;
*(gBattleStruct->mirrorMoves + gBankTarget * 2 + 1) = gOriginallyUsedMove >> 8;
target = gBankTarget;
attacker = gBankAttacker;
*(attacker * 2 + target * 8 + (u8*)(gBattleStruct->mirrorMoveArrays) + 0) = gLastUsedMove;
*(attacker * 2 + target * 8 + (u8*)(gBattleStruct->mirrorMoveArrays) + 0) = gOriginallyUsedMove;
target = gBankTarget;
attacker = gBankAttacker;
*(attacker * 2 + target * 8 + (u8*)(gBattleStruct->mirrorMoveArrays) + 1) = gLastUsedMove >> 8;
*(attacker * 2 + target * 8 + (u8*)(gBattleStruct->mirrorMoveArrays) + 1) = gOriginallyUsedMove >> 8;
}
gBattleScripting.atk49_state++;
break;
@ -5144,7 +5144,7 @@ static void atk4A_typecalc2(void)
{
gLastUsedAbility = gBattleMons[gBankTarget].ability;
gBattleMoveFlags |= (MOVESTATUS_MISSED | MOVESTATUS_NOTAFFECTED);
gUnknown_02024250[gBankTarget] = 0;
gTurnMovesHitWith[gBankTarget] = 0;
gBattleCommunication[6] = moveType;
RecordAbilityBattle(gBankTarget, gLastUsedAbility);
}
@ -5219,7 +5219,7 @@ static void atk4A_typecalc2(void)
{
gLastUsedAbility = ABILITY_WONDER_GUARD;
gBattleMoveFlags |= MOVESTATUS_MISSED;
gUnknown_02024250[gBankTarget] = 0;
gTurnMovesHitWith[gBankTarget] = 0;
gBattleCommunication[6] = 3;
RecordAbilityBattle(gBankTarget, gLastUsedAbility);
}
@ -5452,10 +5452,10 @@ static void atk4F_jumpifcantswitch(void)
{
if (GetBankSide(gActiveBank) == SIDE_OPPONENT)
{
r7 = GetBankByIdentity(1);
r7 = GetBankByIdentity(IDENTITY_OPPONENT_MON1);
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
compareVar = GetBankByIdentity(3);
compareVar = GetBankByIdentity(IDENTITY_OPPONENT_MON2);
else
compareVar = r7;
@ -5463,10 +5463,10 @@ static void atk4F_jumpifcantswitch(void)
}
else
{
r7 = GetBankByIdentity(0);
r7 = GetBankByIdentity(IDENTITY_PLAYER_MON1);
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
compareVar = GetBankByIdentity(2);
compareVar = GetBankByIdentity(IDENTITY_PLAYER_MON2);
else
compareVar = r7;
@ -6009,7 +6009,7 @@ static void atk59_handlelearnnewmove(void)
}
else
{
gActiveBank = GetBankByIdentity(0);
gActiveBank = GetBankByIdentity(IDENTITY_PLAYER_MON1);
if (gBattlePartyID[gActiveBank] == gBattleStruct->expGetterId
&& !(gBattleMons[gActiveBank].status2 & STATUS2_TRANSFORMED))
@ -6018,7 +6018,7 @@ static void atk59_handlelearnnewmove(void)
}
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{
gActiveBank = GetBankByIdentity(2);
gActiveBank = GetBankByIdentity(IDENTITY_PLAYER_MON2);
if (gBattlePartyID[gActiveBank] == gBattleStruct->expGetterId
&& !(gBattleMons[gActiveBank].status2 & STATUS2_TRANSFORMED))
{
@ -6386,7 +6386,7 @@ static void atk63_jumptorandomattack(void)
if (gBattlescriptCurrInstr[1] != 0)
gCurrentMove = gRandomMove;
else
gLastUsedMove = gCurrentMove = gRandomMove;
gOriginallyUsedMove = gCurrentMove = gRandomMove;
gBattlescriptCurrInstr = gBattleScriptsForMoveEffects[gBattleMoves[gCurrentMove].effect];
}
@ -6849,7 +6849,7 @@ static void atk6D_resetsentmonsvalue(void)
static void atk6E_setatktoplayer0(void)
{
gBankAttacker = GetBankByIdentity(0);
gBankAttacker = GetBankByIdentity(IDENTITY_PLAYER_MON1);
gBattlescriptCurrInstr++;
}
@ -8352,7 +8352,7 @@ static void atk9A_setfocusenergy(void)
static void atk9B_transformdataexecution(void)
{
gLastUsedMove = 0xFFFF;
gOriginallyUsedMove = 0xFFFF;
gBattlescriptCurrInstr++;
if (gBattleMons[gBankTarget].status2 & STATUS2_TRANSFORMED
|| gStatuses3[gBankTarget] & STATUS3_SEMI_INVULNERABLE)
@ -8432,7 +8432,7 @@ static bool8 IsMoveUncopyableByMimic(u16 move)
static void atk9D_mimicattackcopy(void)
{
gLastUsedMove = 0xFFFF;
gOriginallyUsedMove = 0xFFFF;
if (IsMoveUncopyableByMimic(gLastUsedMovesByBanks[gBankTarget])
|| gBattleMons[gBankAttacker].status2 & STATUS2_TRANSFORMED
@ -8652,13 +8652,13 @@ static void atkA5_painsplitdmgcalc(void)
static void atkA6_settypetorandomresistance(void) // conversion 2
{
if (gUnknown_02024250[gBankAttacker] == 0
|| gUnknown_02024250[gBankAttacker] == 0xFFFF)
if (gTurnMovesHitWith[gBankAttacker] == 0
|| gTurnMovesHitWith[gBankAttacker] == 0xFFFF)
{
gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1);
}
else if (IsTwoTurnsMove(gUnknown_02024250[gBankAttacker])
&& gBattleMons[gUnknown_02024270[gBankAttacker]].status2 & STATUS2_MULTIPLETURNS)
else if (IsTwoTurnsMove(gTurnMovesHitWith[gBankAttacker])
&& gBattleMons[gTurnMovesHitBy[gBankAttacker]].status2 & STATUS2_MULTIPLETURNS)
{
gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1);
}
@ -8726,7 +8726,7 @@ static void atkA7_setalwayshitflag(void)
static void atkA8_copymovepermanently(void) // sketch
{
gLastUsedMove = 0xFFFF;
gOriginallyUsedMove = 0xFFFF;
if (!(gBattleMons[gBankAttacker].status2 & STATUS2_TRANSFORMED)
&& gUnknownMovesUsedByBanks[gBankTarget] != MOVE_STRUGGLE
@ -9024,7 +9024,7 @@ static void atkAE_healpartystatus(void)
gBattleMons[gBankAttacker].status1 = 0;
gBattleMons[gBankAttacker].status2 &= ~(STATUS2_NIGHTMARE);
gActiveBank = GetBankByIdentity(GetBankIdentity(gBankAttacker) ^ 2);
gActiveBank = GetBankByIdentity(GetBankIdentity(gBankAttacker) ^ BIT_MON);
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE
&& !(gAbsentBankFlags & gBitTable[gActiveBank]))
{

View File

@ -459,7 +459,7 @@ u8 TrySetCantSelectMoveBattleScript(void)
u8 CheckMoveLimitations(u8 bank, u8 unusableMoves, u8 check)
{
u8 holdEffect;
u16* choicedMove = &gBattleStruct->choicedMove[bank];
u16 *choicedMove = &gBattleStruct->choicedMove[bank];
s32 i;
if (gBattleMons[bank].item == ITEM_ENIGMA_BERRY)
@ -584,11 +584,7 @@ u8 UpdateTurnCounters(void)
{
gSideAffecting[sideBank] &= ~SIDE_STATUS_REFLECT;
BattleScriptExecute(BattleScript_82DACFA);
gBattleTextBuff1[0] = 0xFD;
gBattleTextBuff1[1] = 2;
gBattleTextBuff1[2] = MOVE_REFLECT;
gBattleTextBuff1[3] = MOVE_REFLECT >> 8;
gBattleTextBuff1[4] = EOS;
PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_REFLECT);
effect++;
}
}
@ -614,11 +610,7 @@ u8 UpdateTurnCounters(void)
gSideAffecting[sideBank] &= ~SIDE_STATUS_LIGHTSCREEN;
BattleScriptExecute(BattleScript_82DACFA);
gBattleCommunication[MULTISTRING_CHOOSER] = sideBank;
gBattleTextBuff1[0] = 0xFD;
gBattleTextBuff1[1] = 2;
gBattleTextBuff1[2] = MOVE_LIGHT_SCREEN;
gBattleTextBuff1[3] = MOVE_LIGHT_SCREEN >> 8;
gBattleTextBuff1[4] = EOS;
PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_LIGHT_SCREEN);
effect++;
}
}
@ -643,11 +635,7 @@ u8 UpdateTurnCounters(void)
gSideAffecting[sideBank] &= ~SIDE_STATUS_MIST;
BattleScriptExecute(BattleScript_82DACFA);
gBattleCommunication[MULTISTRING_CHOOSER] = sideBank;
gBattleTextBuff1[0] = 0xFD;
gBattleTextBuff1[1] = 2;
gBattleTextBuff1[2] = MOVE_MIST;
gBattleTextBuff1[3] = MOVE_MIST >> 8;
gBattleTextBuff1[4] = EOS;
PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_MIST);
effect++;
}
gBattleStruct->turnSideTracker++;
@ -773,9 +761,10 @@ u8 UpdateTurnCounters(void)
gBattlescriptCurrInstr = BattleScript_82DACC9;
}
else
{
gBattlescriptCurrInstr = BattleScript_82DAC47;
gBattleScripting.animArg1 = 0xD;
}
gBattleScripting.animArg1 = B_ANIM_HAIL_CONTINUES;
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
BattleScriptExecute(gBattlescriptCurrInstr);
effect++;
@ -870,7 +859,7 @@ u8 TurnBasedEffects(void)
gBattleMoveDamage = gBattleMons[gActiveBank].maxHP / 16;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
if ((gBattleMons[gActiveBank].status1 & 0xF00) != 0xF00) //not 16 turns
if ((gBattleMons[gActiveBank].status1 & 0xF00) != 0xF00) // not 16 turns
gBattleMons[gActiveBank].status1 += 0x100;
gBattleMoveDamage *= (gBattleMons[gActiveBank].status1 & 0xF00) >> 8;
BattleScriptExecute(BattleScript_PoisonTurnDmg);
@ -929,8 +918,8 @@ u8 TurnBasedEffects(void)
// This is the only way I could get this array access to match.
gBattleScripting.animArg1 = *(gBattleStruct->wrappedMove + gActiveBank * 2 + 0);
gBattleScripting.animArg2 = *(gBattleStruct->wrappedMove + gActiveBank * 2 + 1);
gBattleTextBuff1[0] = 0xFD;
gBattleTextBuff1[1] = 2;
gBattleTextBuff1[0] = B_BUFF_PLACEHOLDER_BEGIN;
gBattleTextBuff1[1] = B_BUFF_MOVE;
gBattleTextBuff1[2] = *(gBattleStruct->wrappedMove + gActiveBank * 2 + 0);
gBattleTextBuff1[3] = *(gBattleStruct->wrappedMove + gActiveBank * 2 + 1);
gBattleTextBuff1[4] = EOS;
@ -941,8 +930,8 @@ u8 TurnBasedEffects(void)
}
else // broke free
{
gBattleTextBuff1[0] = 0xFD;
gBattleTextBuff1[1] = 2;
gBattleTextBuff1[0] = B_BUFF_PLACEHOLDER_BEGIN;
gBattleTextBuff1[1] = B_BUFF_MOVE;
gBattleTextBuff1[2] = *(gBattleStruct->wrappedMove + gActiveBank * 2 + 0);
gBattleTextBuff1[3] = *(gBattleStruct->wrappedMove + gActiveBank * 2 + 1);
gBattleTextBuff1[4] = EOS;
@ -1014,7 +1003,7 @@ u8 TurnBasedEffects(void)
gBattleMons[gActiveBank].status2 &= ~(STATUS2_MULTIPLETURNS);
if (!(gBattleMons[gActiveBank].status2 & STATUS2_CONFUSION))
{
gBattleCommunication[MOVE_EFFECT_BYTE] = 0x47;
gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_CONFUSION | MOVE_EFFECT_AFFECTS_USER;
SetMoveEffect(1, 0);
if (gBattleMons[gActiveBank].status2 & STATUS2_CONFUSION)
BattleScriptExecute(BattleScript_ThrashConfuses);
@ -1139,11 +1128,8 @@ bool8 sub_8041364(void)
else
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
gBattleTextBuff1[0] = 0xFD;
gBattleTextBuff1[1] = 2;
gBattleTextBuff1[2] = gWishFutureKnock.futureSightMove[gActiveBank];
gBattleTextBuff1[3] = gWishFutureKnock.futureSightMove[gActiveBank] >> 8;
gBattleTextBuff1[4] = EOS;
PREPARE_MOVE_BUFFER(gBattleTextBuff1, gWishFutureKnock.futureSightMove[gActiveBank]);
gBankTarget = gActiveBank;
gBankAttacker = gWishFutureKnock.futureSightAttacker[gActiveBank];
gBattleMoveDamage = gWishFutureKnock.futureSightDmg[gActiveBank];
@ -1151,11 +1137,11 @@ bool8 sub_8041364(void)
BattleScriptExecute(BattleScript_82DAFE4);
if (gWishFutureKnock.futureSightCounter[gActiveBank] == 0
&& gWishFutureKnock.futureSightCounter[gActiveBank ^ 2] == 0)
&& gWishFutureKnock.futureSightCounter[gActiveBank ^ BIT_MON] == 0)
{
gSideAffecting[GetBankIdentity(gBankTarget) & 1] &= ~SIDE_STATUS_FUTUREATTACK;
gSideAffecting[GET_BANK_SIDE(gBankTarget)] &= ~(SIDE_STATUS_FUTUREATTACK);
}
return 1;
return TRUE;
}
}
// Why do I have to keep doing this to match?
@ -1177,12 +1163,7 @@ bool8 sub_8041364(void)
gBattleStruct->field_1A1++;
if (gStatuses3[gActiveBank] & STATUS3_PERISH_SONG)
{
gBattleTextBuff1[0] = 0xFD;
gBattleTextBuff1[1] = 1;
gBattleTextBuff1[2] = 1;
gBattleTextBuff1[3] = 1;
gBattleTextBuff1[4] = gDisableStructs[gActiveBank].perishSongTimer1;
gBattleTextBuff1[5] = EOS;
PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff1, 1, gDisableStructs[gActiveBank].perishSongTimer1);
if (gDisableStructs[gActiveBank].perishSongTimer1 == 0)
{
gStatuses3[gActiveBank] &= ~STATUS3_PERISH_SONG;
@ -1195,7 +1176,7 @@ bool8 sub_8041364(void)
gBattlescriptCurrInstr = BattleScript_82DAF20;
}
BattleScriptExecute(gBattlescriptCurrInstr);
return 1;
return TRUE;
}
}
// Hm...
@ -1218,14 +1199,14 @@ bool8 sub_8041364(void)
gBattlescriptCurrInstr = BattleScript_82DB8F3;
BattleScriptExecute(BattleScript_82DB8F3);
gBattleStruct->field_1A0++;
return 1;
return TRUE;
}
break;
}
gHitMarker &= ~(HITMARKER_GRUDGE | HITMARKER_x20);
return 0;
return FALSE;
}
#define sub_8041728_MAX_CASE 7
@ -1572,7 +1553,7 @@ u8 AtkCanceller_UnableToUseMove(void)
}
gBattleStruct->atkCancellerTracker++;
break;
case 14: // last case
case ATKCANCELLER_MAX_CASE:
break;
}
@ -1674,14 +1655,14 @@ bool8 sub_80423F4(u8 bank, u8 r1, u8 r2)
{
if (GetBankSide(bank) == SIDE_OPPONENT)
{
r7 = GetBankByIdentity(1);
r6 = GetBankByIdentity(3);
r7 = GetBankByIdentity(IDENTITY_OPPONENT_MON1);
r6 = GetBankByIdentity(IDENTITY_OPPONENT_MON2);
party = gEnemyParty;
}
else
{
r7 = GetBankByIdentity(0);
r6 = GetBankByIdentity(2);
r7 = GetBankByIdentity(IDENTITY_PLAYER_MON1);
r6 = GetBankByIdentity(IDENTITY_PLAYER_MON2);
party = gPlayerParty;
}
if (r1 == 6)
@ -1799,10 +1780,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
else
move = gCurrentMove;
if (gBattleStruct->dynamicMoveType)
moveType = gBattleStruct->dynamicMoveType & 0x3F;
else
moveType = gBattleMoves[move].type;
GET_MOVE_TYPE(move, moveType);
switch (caseID)
{
@ -2525,7 +2503,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
return effect;
}
void BattleScriptExecute(const u8* BS_ptr)
void BattleScriptExecute(const u8 *BS_ptr)
{
gBattlescriptCurrInstr = BS_ptr;
BATTLE_CALLBACKS_STACK->function[BATTLE_CALLBACKS_STACK->size++] = gBattleMainFunc;
@ -2533,7 +2511,7 @@ void BattleScriptExecute(const u8* BS_ptr)
gCurrentActionFuncId = 0;
}
void BattleScriptPushCursorAndCallback(const u8* BS_ptr)
void BattleScriptPushCursorAndCallback(const u8 *BS_ptr)
{
BattleScriptPushCursor();
gBattlescriptCurrInstr = BS_ptr;
@ -3265,7 +3243,7 @@ u8 GetMoveTarget(u16 move, u8 useMoveTarget)
switch (moveTarget)
{
case MOVE_TARGET_SELECTED:
side = GetBankSide(gBankAttacker) ^ 1;
side = GetBankSide(gBankAttacker) ^ BIT_SIDE;
if (gSideTimers[side].followmeTimer && gBattleMons[gSideTimers[side].followmeTarget].hp)
targetBank = gSideTimers[side].followmeTarget;
else
@ -3279,7 +3257,7 @@ u8 GetMoveTarget(u16 move, u8 useMoveTarget)
&& AbilityBattleEffects(ABILITYEFFECT_COUNT_OTHER_SIDE, gBankAttacker, ABILITY_LIGHTNING_ROD, 0, 0)
&& gBattleMons[targetBank].ability != ABILITY_LIGHTNING_ROD)
{
targetBank ^= 2;
targetBank ^= BIT_MON;
RecordAbilityBattle(targetBank, gBattleMons[targetBank].ability);
gSpecialStatuses[targetBank].lightningRodRedirected = 1;
}
@ -3289,12 +3267,12 @@ u8 GetMoveTarget(u16 move, u8 useMoveTarget)
case MOVE_TARGET_BOTH:
case MOVE_TARGET_FOES_AND_ALLY:
case MOVE_TARGET_OPPONENTS_FIELD:
targetBank = GetBankByIdentity((GetBankIdentity(gBankAttacker) & 1) ^ 1);
targetBank = GetBankByIdentity((GetBankIdentity(gBankAttacker) & BIT_SIDE) ^ BIT_SIDE);
if (gAbsentBankFlags & gBitTable[targetBank])
targetBank ^= 2;
targetBank ^= BIT_MON;
break;
case MOVE_TARGET_RANDOM:
side = GetBankSide(gBankAttacker) ^ 1;
side = GetBankSide(gBankAttacker) ^ BIT_SIDE;
if (gSideTimers[side].followmeTimer && gBattleMons[gSideTimers[side].followmeTarget].hp)
targetBank = gSideTimers[side].followmeTarget;
else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && moveTarget & MOVE_TARGET_RANDOM)
@ -3302,22 +3280,22 @@ u8 GetMoveTarget(u16 move, u8 useMoveTarget)
if (GetBankSide(gBankAttacker) == SIDE_PLAYER)
{
if (Random() & 1)
targetBank = GetBankByIdentity(1);
targetBank = GetBankByIdentity(IDENTITY_OPPONENT_MON1);
else
targetBank = GetBankByIdentity(3);
targetBank = GetBankByIdentity(IDENTITY_OPPONENT_MON2);
}
else
{
if (Random() & 1)
targetBank = GetBankByIdentity(0);
targetBank = GetBankByIdentity(IDENTITY_PLAYER_MON1);
else
targetBank = GetBankByIdentity(2);
targetBank = GetBankByIdentity(IDENTITY_PLAYER_MON2);
}
if (gAbsentBankFlags & gBitTable[targetBank])
targetBank ^= 2;
targetBank ^= BIT_MON;
}
else
targetBank = GetBankByIdentity((GetBankIdentity(gBankAttacker) & 1) ^ 1);
targetBank = GetBankByIdentity((GetBankIdentity(gBankAttacker) & BIT_SIDE) ^ BIT_SIDE);
break;
case MOVE_TARGET_USER:
case MOVE_TARGET_x10:
@ -3325,11 +3303,7 @@ u8 GetMoveTarget(u16 move, u8 useMoveTarget)
break;
}
#ifndef NONMATCHING
MEME_ACCESS_U8(BattleStruct, gBattleStruct, gBankAttacker, moveTarget, targetBank);
#else
gBattleStruct->moveTarget[gBankAttacker] = targetBank;
#endif // NONMATCHING
*(gBattleStruct->moveTarget + gBankAttacker) = targetBank;
return targetBank;
}

View File

@ -312,7 +312,7 @@ gUnknown_020241E9: @ 20241E9
gCurrentMove: @ 20241EA
.space 0x2
gLastUsedMove: @ 20241EC
gOriginallyUsedMove: @ 20241EC
.space 0x2
gRandomMove: @ 20241EE
@ -375,7 +375,7 @@ gUnknownMovesUsedByBanks: @ 2024240
gLastUsedMovesByBanks: @ 2024248
.space 0x8
gUnknown_02024250: @ 2024250
gTurnMovesHitWith: @ 2024250
.space 0x8
gUnknown_02024258: @ 2024258
@ -387,7 +387,7 @@ gUnknown_02024260: @ 2024260
gLockedMoves: @ 2024268
.space 0x8
gUnknown_02024270: @ 2024270
gTurnMovesHitBy: @ 2024270
.space 0x4
gChosenMovesByBanks: @ 2024274