more battle documentation

This commit is contained in:
DizzyEggg
2018-06-30 14:12:17 +02:00
parent 272b98da6c
commit 30c85a5128
6 changed files with 56 additions and 55 deletions
+2 -2
View File
@@ -511,7 +511,7 @@
.byte \bank .byte \bank
.endm .endm
.macro atk5F .macro swapattackerwithtarget
.byte 0x5f .byte 0x5f
.endm .endm
@@ -1163,7 +1163,7 @@
.4byte \param0 .4byte \param0
.endm .endm
.macro snatchsetbanks .macro snatchsetbattlers
.byte 0xed .byte 0xed
.endm .endm
+7 -7
View File
@@ -2873,7 +2873,7 @@ BattleScript_FaintedMonTryChooseAnother::
jumpifnotbattletype BATTLE_TYPE_TRAINER, BattleScript_FaintedMonChooseAnother jumpifnotbattletype BATTLE_TYPE_TRAINER, BattleScript_FaintedMonChooseAnother
jumpifbattletype BATTLE_TYPE_LINK, BattleScript_FaintedMonChooseAnother jumpifbattletype BATTLE_TYPE_LINK, BattleScript_FaintedMonChooseAnother
jumpifbattletype BATTLE_TYPE_x2000000, BattleScript_FaintedMonChooseAnother jumpifbattletype BATTLE_TYPE_x2000000, BattleScript_FaintedMonChooseAnother
jumpifbattletype BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOME | BATTLE_TYPE_PALACE | BATTLE_TYPE_ARENA | BATTLE_TYPE_FACTORY | BATTLE_TYPE_PIKE | BATTLE_TYPE_PYRAMID, BattleScript_FaintedMonChooseAnother jumpifbattletype BATTLE_TYPE_FRONTIER, BattleScript_FaintedMonChooseAnother
jumpifbattletype BATTLE_TYPE_DOUBLE, BattleScript_FaintedMonChooseAnother jumpifbattletype BATTLE_TYPE_DOUBLE, BattleScript_FaintedMonChooseAnother
jumpifword CMP_COMMON_BITS, gHitMarker, HITMARKER_x400000, BattleScript_FaintedMonChooseAnother jumpifword CMP_COMMON_BITS, gHitMarker, HITMARKER_x400000, BattleScript_FaintedMonChooseAnother
jumpifbyte CMP_EQUAL, sBATTLE_STYLE, 0x1, BattleScript_FaintedMonChooseAnother jumpifbyte CMP_EQUAL, sBATTLE_STYLE, 0x1, BattleScript_FaintedMonChooseAnother
@@ -2968,7 +2968,7 @@ BattleScript_PayDayMoneyAndPickUpItems::
BattleScript_LocalBattleLost:: BattleScript_LocalBattleLost::
jumpifbattletype BATTLE_TYPE_DOME, BattleScript_CheckDomeDrew jumpifbattletype BATTLE_TYPE_DOME, BattleScript_CheckDomeDrew
jumpifbattletype BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOME | BATTLE_TYPE_PALACE | BATTLE_TYPE_ARENA | BATTLE_TYPE_FACTORY | BATTLE_TYPE_PIKE | BATTLE_TYPE_PYRAMID, BattleScript_LocalBattleLostPrintTrainersWinText jumpifbattletype BATTLE_TYPE_FRONTIER, BattleScript_LocalBattleLostPrintTrainersWinText
jumpifbattletype BATTLE_TYPE_x4000000, BattleScript_LocalBattleLostPrintTrainersWinText jumpifbattletype BATTLE_TYPE_x4000000, BattleScript_LocalBattleLostPrintTrainersWinText
jumpifbattletype BATTLE_TYPE_EREADER_TRAINER, BattleScript_LocalBattleLostEnd jumpifbattletype BATTLE_TYPE_EREADER_TRAINER, BattleScript_LocalBattleLostEnd
jumpifhalfword CMP_EQUAL, gTrainerBattleOpponent_A, 0x400, BattleScript_LocalBattleLostEnd jumpifhalfword CMP_EQUAL, gTrainerBattleOpponent_A, 0x400, BattleScript_LocalBattleLostEnd
@@ -3120,10 +3120,10 @@ BattleScript_PursuitSwitchDmgSetMultihit::
setmultihit 0x2 setmultihit 0x2
BattleScript_PursuitSwitchDmgLoop:: BattleScript_PursuitSwitchDmgLoop::
jumpifnopursuitswitchdmg BattleScript_DoSwitchOut jumpifnopursuitswitchdmg BattleScript_DoSwitchOut
atk5F swapattackerwithtarget
trysetdestinybondtohappen trysetdestinybondtohappen
call BattleScript_PursuitDmgOnSwitchOut call BattleScript_PursuitDmgOnSwitchOut
atk5F swapattackerwithtarget
BattleScript_DoSwitchOut:: BattleScript_DoSwitchOut::
decrementmultihit BattleScript_PursuitSwitchDmgLoop decrementmultihit BattleScript_PursuitSwitchDmgLoop
switchoutabilities BS_ATTACKER switchoutabilities BS_ATTACKER
@@ -3230,7 +3230,7 @@ BattleScript_DamagingWeatherContinues::
playanimation2 BS_ATTACKER, sB_ANIM_ARG1, NULL playanimation2 BS_ATTACKER, sB_ANIM_ARG1, NULL
setbyte gBattleCommunication, 0x0 setbyte gBattleCommunication, 0x0
BattleScript_DamagingWeatherLoop:: BattleScript_DamagingWeatherLoop::
copyarraywithindex gBattlerAttacker, gBattleTurnOrder, gBattleCommunication, 0x1 copyarraywithindex gBattlerAttacker, gBattlerByTurnOrder, gBattleCommunication, 0x1
weatherdamage weatherdamage
jumpifword CMP_EQUAL, gBattleMoveDamage, 0x0, BattleScript_DamagingWeatherLoopIncrement jumpifword CMP_EQUAL, gBattleMoveDamage, 0x0, BattleScript_DamagingWeatherLoopIncrement
printfromtable gSandStormHailDmgStringIds printfromtable gSandStormHailDmgStringIds
@@ -3710,12 +3710,12 @@ BattleScript_MagicCoatBounce::
BattleScript_SnatchedMove:: BattleScript_SnatchedMove::
attackstring attackstring
ppreduce ppreduce
snatchsetbanks snatchsetbattlers
playanimation BS_TARGET, B_ANIM_SNATCH_MOVE, NULL playanimation BS_TARGET, B_ANIM_SNATCH_MOVE, NULL
printstring STRINGID_PKMNSNATCHEDMOVE printstring STRINGID_PKMNSNATCHEDMOVE
waitmessage 0x40 waitmessage 0x40
orword gHitMarker, HITMARKER_ATTACKSTRING_PRINTED | HITMARKER_NO_PPDEDUCT | HITMARKER_x800000 orword gHitMarker, HITMARKER_ATTACKSTRING_PRINTED | HITMARKER_NO_PPDEDUCT | HITMARKER_x800000
atk5F swapattackerwithtarget
return return
BattleScript_EnduredMsg:: BattleScript_EnduredMsg::
+1 -1
View File
@@ -159,7 +159,7 @@
#define HITMARKER_NO_ATTACKSTRING 0x00000200 #define HITMARKER_NO_ATTACKSTRING 0x00000200
#define HITMARKER_ATTACKSTRING_PRINTED 0x00000400 #define HITMARKER_ATTACKSTRING_PRINTED 0x00000400
#define HITMARKER_NO_PPDEDUCT 0x00000800 #define HITMARKER_NO_PPDEDUCT 0x00000800
#define HITMARKER_PURSUIT_TRAP 0x00001000 #define HITMARKER_SWAP_ATTACKER_TARGET 0x00001000
#define HITMARKER_IGNORE_SAFEGUARD 0x00002000 #define HITMARKER_IGNORE_SAFEGUARD 0x00002000
#define HITMARKER_SYNCHRONISE_EFFECT 0x00004000 #define HITMARKER_SYNCHRONISE_EFFECT 0x00004000
#define HITMARKER_RUN 0x00008000 #define HITMARKER_RUN 0x00008000
+1
View File
@@ -561,6 +561,7 @@ static const u8 sUnknown_0831BCE0[][3] = {{0, 0, 0}, {3, 5, 0}, {2, 3, 0}, {1, 2
static const u8 sUnknown_0831BCEF[] = {4, 3, 2, 1}; static const u8 sUnknown_0831BCEF[] = {4, 3, 2, 1};
static const u8 sUnknown_0831BCF3[] = {4, 4, 4, 4}; static const u8 sUnknown_0831BCF3[] = {4, 4, 4, 4};
// code
void CB2_InitBattle(void) void CB2_InitBattle(void)
{ {
MoveSaveBlocks_ResetHeap(); MoveSaveBlocks_ResetHeap();
+26 -25
View File
@@ -45,7 +45,6 @@ extern const u8 gText_PkmnBoxLanettesPCFull[];
extern const u8 gText_PkmnTransferredSomeonesPC[]; extern const u8 gText_PkmnTransferredSomeonesPC[];
extern const u8 gText_PkmnTransferredLanettesPC[]; extern const u8 gText_PkmnTransferredLanettesPC[];
extern u16 sub_8068BB0(void); // pokemon_1
extern u8 sub_81A4D00(void); // battle_frontier_2 extern u8 sub_81A4D00(void); // battle_frontier_2
extern u8 GetFrontierOpponentClass(u16 trainerId); // battle_tower extern u8 GetFrontierOpponentClass(u16 trainerId); // battle_tower
extern u8 sub_81D5530(u16 trainerId); // pokenav extern u8 sub_81D5530(u16 trainerId); // pokenav
@@ -58,8 +57,8 @@ extern void sub_81D572C(u8 arg0, u16 trainerId); // pokenav
extern void GetFrontierTrainerName(u8 *dst, u16 trainerId); extern void GetFrontierTrainerName(u8 *dst, u16 trainerId);
// this file's functions // this file's functions
static void sub_814F8F8(u8 *textPtr); static void ChooseMoveUsedParticle(u8 *textPtr);
static void sub_814F950(u8 *dst); static void ChooseTypeOfMoveUsedString(u8 *dst);
static void ExpandBattleTextBuffPlaceholders(const u8 *src, u8 *dst); static void ExpandBattleTextBuffPlaceholders(const u8 *src, u8 *dst);
// ewram variables // ewram variables
@@ -1322,8 +1321,8 @@ static const u8 sText_LinkTrainerWantsToBattlePause[] = _("{B_20}\nwants to batt
static const u8 sText_TwoLinkTrainersWantToBattlePause[] = _("{B_20} and {B_21}\nwant to battle!{PAUSE 49}"); static const u8 sText_TwoLinkTrainersWantToBattlePause[] = _("{B_20} and {B_21}\nwant to battle!{PAUSE 49}");
// This is four lists of moves which use a different attack string in Japanese // This is four lists of moves which use a different attack string in Japanese
// to the default. See the documentation for sub_814F950 for more detail. // to the default. See the documentation for ChooseTypeOfMoveUsedString for more detail.
static const u16 sUnknownMoveTable[] = static const u16 sGrammarMoveUsedTable[] =
{ {
MOVE_SWORDS_DANCE, MOVE_STRENGTH, MOVE_GROWTH, MOVE_SWORDS_DANCE, MOVE_STRENGTH, MOVE_GROWTH,
MOVE_HARDEN, MOVE_MINIMIZE, MOVE_SMOKESCREEN, MOVE_HARDEN, MOVE_MINIMIZE, MOVE_SMOKESCREEN,
@@ -2142,14 +2141,14 @@ void BufferStringBattle(u16 stringID)
} }
break; break;
case STRINGID_USEDMOVE: // pokemon used a move msg case STRINGID_USEDMOVE: // pokemon used a move msg
sub_814F8F8(gBattleTextBuff1); // buff1 doesn't appear in the string, leftover from japanese move names? ChooseMoveUsedParticle(gBattleTextBuff1); // buff1 doesn't appear in the string, leftover from japanese move names
if (gStringInfo->currentMove > LAST_MOVE_INDEX) if (gStringInfo->currentMove > LAST_MOVE_INDEX)
StringCopy(gBattleTextBuff2, sATypeMove_Table[*(&gBattleStruct->stringMoveType)]); StringCopy(gBattleTextBuff2, sATypeMove_Table[*(&gBattleStruct->stringMoveType)]);
else else
StringCopy(gBattleTextBuff2, gMoveNames[gStringInfo->currentMove]); StringCopy(gBattleTextBuff2, gMoveNames[gStringInfo->currentMove]);
sub_814F950(gBattleTextBuff2); ChooseTypeOfMoveUsedString(gBattleTextBuff2);
stringPtr = sText_AttackerUsedX; stringPtr = sText_AttackerUsedX;
break; break;
case STRINGID_BATTLEEND: // battle end case STRINGID_BATTLEEND: // battle end
@@ -2740,10 +2739,6 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst)
return dstID; return dstID;
} }
// TODO: move these to a general header like util.h
#define ByteRead16(ptr) ((ptr)[0] | ((ptr)[1] << 8))
#define ByteRead32(ptr) ((ptr)[0] | (ptr)[1] << 8 | (ptr)[2] << 16 | (ptr)[3] << 24)
static void ExpandBattleTextBuffPlaceholders(const u8 *src, u8 *dst) static void ExpandBattleTextBuffPlaceholders(const u8 *src, u8 *dst)
{ {
u32 srcID = 1; u32 srcID = 1;
@@ -2757,7 +2752,7 @@ static void ExpandBattleTextBuffPlaceholders(const u8 *src, u8 *dst)
switch (src[srcID]) switch (src[srcID])
{ {
case B_BUFF_STRING: // battle string case B_BUFF_STRING: // battle string
hword = ByteRead16(&src[srcID + 1]); hword = T1_READ_16(&src[srcID + 1]);
StringAppend(dst, gBattleStringsTable[hword - BATTLESTRINGS_ID_ADDER]); StringAppend(dst, gBattleStringsTable[hword - BATTLESTRINGS_ID_ADDER]);
srcID += 3; srcID += 3;
break; break;
@@ -2768,17 +2763,17 @@ static void ExpandBattleTextBuffPlaceholders(const u8 *src, u8 *dst)
value = src[srcID + 3]; value = src[srcID + 3];
break; break;
case 2: case 2:
value = ByteRead16(&src[srcID + 3]); value = T1_READ_16(&src[srcID + 3]);
break; break;
case 4: case 4:
value = ByteRead32(&src[srcID + 3]); value = T1_READ_32(&src[srcID + 3]);
break; break;
} }
ConvertIntToDecimalStringN(dst, value, 0, src[srcID + 2]); ConvertIntToDecimalStringN(dst, value, 0, src[srcID + 2]);
srcID += src[srcID + 1] + 3; srcID += src[srcID + 1] + 3;
break; break;
case B_BUFF_MOVE: // move name case B_BUFF_MOVE: // move name
StringAppend(dst, gMoveNames[ByteRead16(&src[srcID + 1])]); StringAppend(dst, gMoveNames[T1_READ_16(&src[srcID + 1])]);
srcID += 3; srcID += 3;
break; break;
case B_BUFF_TYPE: // type name case B_BUFF_TYPE: // type name
@@ -2808,7 +2803,7 @@ static void ExpandBattleTextBuffPlaceholders(const u8 *src, u8 *dst)
srcID += 2; srcID += 2;
break; break;
case B_BUFF_SPECIES: // species name case B_BUFF_SPECIES: // species name
GetSpeciesName(dst, ByteRead16(&src[srcID + 1])); GetSpeciesName(dst, T1_READ_16(&src[srcID + 1]));
srcID += 3; srcID += 3;
break; break;
case B_BUFF_MON_NICK: // poke nick without prefix case B_BUFF_MON_NICK: // poke nick without prefix
@@ -2828,7 +2823,7 @@ static void ExpandBattleTextBuffPlaceholders(const u8 *src, u8 *dst)
srcID += 2; srcID += 2;
break; break;
case B_BUFF_ITEM: // item name case B_BUFF_ITEM: // item name
hword = ByteRead16(&src[srcID + 1]); hword = T1_READ_16(&src[srcID + 1]);
if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)) if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000))
{ {
if (hword == ITEM_ENIGMA_BERRY) if (hword == ITEM_ENIGMA_BERRY)
@@ -2839,13 +2834,19 @@ static void ExpandBattleTextBuffPlaceholders(const u8 *src, u8 *dst)
StringAppend(dst, sText_BerrySuffix); StringAppend(dst, sText_BerrySuffix);
} }
else else
{
StringAppend(dst, sText_EnigmaBerry); StringAppend(dst, sText_EnigmaBerry);
}
} }
else else
{
CopyItemName(hword, dst); CopyItemName(hword, dst);
}
} }
else else
{
CopyItemName(hword, dst); CopyItemName(hword, dst);
}
srcID += 3; srcID += 3;
break; break;
} }
@@ -2854,18 +2855,18 @@ static void ExpandBattleTextBuffPlaceholders(const u8 *src, u8 *dst)
// Loads one of two text strings into the provided buffer. This is functionally // Loads one of two text strings into the provided buffer. This is functionally
// unused, since the value loaded into the buffer is not read; it loaded one of // unused, since the value loaded into the buffer is not read; it loaded one of
// two particles (either "は" or "の") which works in tandem with sub_814F950 // two particles (either "は" or "の") which works in tandem with ChooseTypeOfMoveUsedString
// below to effect changes in the meaning of the line. // below to effect changes in the meaning of the line.
static void sub_814F8F8(u8* textBuff) static void ChooseMoveUsedParticle(u8* textBuff)
{ {
s32 counter = 0; s32 counter = 0;
u32 i = 0; u32 i = 0;
while (counter != 4) while (counter != 4)
{ {
if (sUnknownMoveTable[i] == 0) if (sGrammarMoveUsedTable[i] == 0)
counter++; counter++;
if (sUnknownMoveTable[i++] == gStringInfo->currentMove) if (sGrammarMoveUsedTable[i++] == gStringInfo->currentMove)
break; break;
} }
@@ -2879,7 +2880,7 @@ static void sub_814F8F8(u8* textBuff)
} }
// Appends "!" to the text buffer `dst`. In the original Japanese this looked // Appends "!" to the text buffer `dst`. In the original Japanese this looked
// into the table of moves at sUnknownMoveTable and varied the line accordingly. // into the table of moves at sGrammarMoveUsedTable and varied the line accordingly.
// //
// sText_ExclamationMark was a plain "!", used for any attack not on the list. // sText_ExclamationMark was a plain "!", used for any attack not on the list.
// It resulted in the translation "<NAME>'s <ATTACK>!". // It resulted in the translation "<NAME>'s <ATTACK>!".
@@ -2896,7 +2897,7 @@ static void sub_814F8F8(u8* textBuff)
// //
// sText_ExclamationMark5 was " こうげき!" This resulted in a translation of // sText_ExclamationMark5 was " こうげき!" This resulted in a translation of
// "<NAME>'s <ATTACK> attack!". // "<NAME>'s <ATTACK> attack!".
static void sub_814F950(u8* dst) static void ChooseTypeOfMoveUsedString(u8* dst)
{ {
s32 counter = 0; s32 counter = 0;
s32 i = 0; s32 i = 0;
@@ -2906,9 +2907,9 @@ static void sub_814F950(u8* dst)
while (counter != 4) while (counter != 4)
{ {
if (sUnknownMoveTable[i] == MOVE_NONE) if (sGrammarMoveUsedTable[i] == MOVE_NONE)
counter++; counter++;
if (sUnknownMoveTable[i++] == gStringInfo->currentMove) if (sGrammarMoveUsedTable[i++] == gStringInfo->currentMove)
break; break;
} }
+19 -20
View File
@@ -67,7 +67,6 @@ extern bool8 sub_81B1250(void); // ?
extern bool8 InBattlePike(void); extern bool8 InBattlePike(void);
extern bool8 InBattlePyramid(void); extern bool8 InBattlePyramid(void);
extern u16 GetBattlePyramidPickupItemId(void); extern u16 GetBattlePyramidPickupItemId(void);
extern u8 Overworld_GetMapTypeOfSaveblockLocation(void);
extern u8 sub_813B21C(void); extern u8 sub_813B21C(void);
extern u16 get_unknown_box_id(void); extern u16 get_unknown_box_id(void);
@@ -185,7 +184,7 @@ static void atk5B_yesnoboxstoplearningmove(void);
static void atk5C_hitanimation(void); static void atk5C_hitanimation(void);
static void atk5D_getmoneyreward(void); static void atk5D_getmoneyreward(void);
static void atk5E(void); static void atk5E(void);
static void atk5F(void); static void atk5F_swapattackerwithtarget(void);
static void atk60_incrementgamestat(void); static void atk60_incrementgamestat(void);
static void atk61_drawpartystatussummary(void); static void atk61_drawpartystatussummary(void);
static void atk62_hidepartystatussummary(void); static void atk62_hidepartystatussummary(void);
@@ -327,7 +326,7 @@ static void atkE9_setweatherballtype(void);
static void atkEA_tryrecycleitem(void); static void atkEA_tryrecycleitem(void);
static void atkEB_settypetoterrain(void); static void atkEB_settypetoterrain(void);
static void atkEC_pursuitrelated(void); static void atkEC_pursuitrelated(void);
static void atkEF_snatchsetbanks(void); static void atkEF_snatchsetbattlers(void);
static void atkEE_removelightscreenreflect(void); static void atkEE_removelightscreenreflect(void);
static void atkEF_handleballthrow(void); static void atkEF_handleballthrow(void);
static void atkF0_givecaughtmon(void); static void atkF0_givecaughtmon(void);
@@ -437,7 +436,7 @@ void (* const gBattleScriptingCommandsTable[])(void) =
atk5C_hitanimation, atk5C_hitanimation,
atk5D_getmoneyreward, atk5D_getmoneyreward,
atk5E, atk5E,
atk5F, atk5F_swapattackerwithtarget,
atk60_incrementgamestat, atk60_incrementgamestat,
atk61_drawpartystatussummary, atk61_drawpartystatussummary,
atk62_hidepartystatussummary, atk62_hidepartystatussummary,
@@ -579,7 +578,7 @@ void (* const gBattleScriptingCommandsTable[])(void) =
atkEA_tryrecycleitem, atkEA_tryrecycleitem,
atkEB_settypetoterrain, atkEB_settypetoterrain,
atkEC_pursuitrelated, atkEC_pursuitrelated,
atkEF_snatchsetbanks, atkEF_snatchsetbattlers,
atkEE_removelightscreenreflect, atkEE_removelightscreenreflect,
atkEF_handleballthrow, atkEF_handleballthrow,
atkF0_givecaughtmon, atkF0_givecaughtmon,
@@ -1172,7 +1171,7 @@ static void atk01_accuracycheck(void)
calc = (calc * 130) / 100; // 1.3 compound eyes boost calc = (calc * 130) / 100; // 1.3 compound eyes boost
if (WEATHER_HAS_EFFECT && gBattleMons[gBattlerTarget].ability == ABILITY_SAND_VEIL && gBattleWeather & WEATHER_SANDSTORM_ANY) if (WEATHER_HAS_EFFECT && gBattleMons[gBattlerTarget].ability == ABILITY_SAND_VEIL && gBattleWeather & WEATHER_SANDSTORM_ANY)
calc = (calc * 80) / 100; // 1.2 sand veil loss calc = (calc * 80) / 100; // 1.2 sand veil loss
if (gBattleMons[gBattlerAttacker].ability == ABILITY_HUSTLE && type < 9) if (gBattleMons[gBattlerAttacker].ability == ABILITY_HUSTLE && IS_MOVE_PHYSICAL(type))
calc = (calc * 80) / 100; // 1.2 hustle loss calc = (calc * 80) / 100; // 1.2 hustle loss
if (gBattleMons[gBattlerTarget].item == ITEM_ENIGMA_BERRY) if (gBattleMons[gBattlerTarget].item == ITEM_ENIGMA_BERRY)
@@ -4676,12 +4675,12 @@ static void atk49_moveend(void)
gBattleScripting.atk49_state++; gBattleScripting.atk49_state++;
break; break;
case 14: // This case looks interesting, although I am not certain what it does. Probably fine tunes edge cases. case 14: // This case looks interesting, although I am not certain what it does. Probably fine tunes edge cases.
if (gHitMarker & HITMARKER_PURSUIT_TRAP) if (gHitMarker & HITMARKER_SWAP_ATTACKER_TARGET)
{ {
gActiveBattler = gBattlerAttacker; gActiveBattler = gBattlerAttacker;
gBattlerAttacker = gBattlerTarget; gBattlerAttacker = gBattlerTarget;
gBattlerTarget = gActiveBattler; gBattlerTarget = gActiveBattler;
gHitMarker &= ~(HITMARKER_PURSUIT_TRAP); gHitMarker &= ~(HITMARKER_SWAP_ATTACKER_TARGET);
} }
if (gHitMarker & HITMARKER_ATTACKSTRING_PRINTED) if (gHitMarker & HITMARKER_ATTACKSTRING_PRINTED)
{ {
@@ -5950,7 +5949,7 @@ static void atk5E(void)
if (gBattleControllerExecFlags == 0) if (gBattleControllerExecFlags == 0)
{ {
s32 i; s32 i;
struct BattlePokemon* bufferPoke = (struct BattlePokemon*) &gBattleBufferB[gActiveBattler][4]; struct BattlePokemon *bufferPoke = (struct BattlePokemon*) &gBattleBufferB[gActiveBattler][4];
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
gBattleMons[gActiveBattler].moves[i] = bufferPoke->moves[i]; gBattleMons[gActiveBattler].moves[i] = bufferPoke->moves[i];
@@ -5962,16 +5961,16 @@ static void atk5E(void)
} }
} }
static void atk5F(void) static void atk5F_swapattackerwithtarget(void)
{ {
gActiveBattler = gBattlerAttacker; gActiveBattler = gBattlerAttacker;
gBattlerAttacker = gBattlerTarget; gBattlerAttacker = gBattlerTarget;
gBattlerTarget = gActiveBattler; gBattlerTarget = gActiveBattler;
if (gHitMarker & HITMARKER_PURSUIT_TRAP) if (gHitMarker & HITMARKER_SWAP_ATTACKER_TARGET)
gHitMarker &= ~(HITMARKER_PURSUIT_TRAP); gHitMarker &= ~(HITMARKER_SWAP_ATTACKER_TARGET);
else else
gHitMarker |= HITMARKER_PURSUIT_TRAP; gHitMarker |= HITMARKER_SWAP_ATTACKER_TARGET;
gBattlescriptCurrInstr++; gBattlescriptCurrInstr++;
} }
@@ -5987,8 +5986,8 @@ static void atk60_incrementgamestat(void)
static void atk61_drawpartystatussummary(void) static void atk61_drawpartystatussummary(void)
{ {
s32 i; s32 i;
struct Pokemon* party; struct Pokemon *party;
struct HpAndStatus hpStatuses[6]; struct HpAndStatus hpStatuses[PARTY_SIZE];
if (gBattleControllerExecFlags) if (gBattleControllerExecFlags)
return; return;
@@ -6000,7 +5999,7 @@ static void atk61_drawpartystatussummary(void)
else else
party = gEnemyParty; party = gEnemyParty;
for (i = 0; i < 6; i++) for (i = 0; i < PARTY_SIZE; i++)
{ {
if (GetMonData(&party[i], MON_DATA_SPECIES2) == SPECIES_NONE if (GetMonData(&party[i], MON_DATA_SPECIES2) == SPECIES_NONE
|| GetMonData(&party[i], MON_DATA_SPECIES2) == SPECIES_EGG) || GetMonData(&party[i], MON_DATA_SPECIES2) == SPECIES_EGG)
@@ -8595,7 +8594,7 @@ static void atkAE_healpartystatus(void)
if (gCurrentMove == MOVE_HEAL_BELL) if (gCurrentMove == MOVE_HEAL_BELL)
{ {
struct Pokemon* party; struct Pokemon *party;
s32 i; s32 i;
gBattleCommunication[MULTISTRING_CHOOSER] = 0; gBattleCommunication[MULTISTRING_CHOOSER] = 0;
@@ -8633,7 +8632,7 @@ static void atkAE_healpartystatus(void)
} }
} }
for (i = 0; i < 6; i++) for (i = 0; i < PARTY_SIZE; i++)
{ {
u16 species = GetMonData(&party[i], MON_DATA_SPECIES2); u16 species = GetMonData(&party[i], MON_DATA_SPECIES2);
u8 abilityBit = GetMonData(&party[i], MON_DATA_ALT_ABILITY); u8 abilityBit = GetMonData(&party[i], MON_DATA_ALT_ABILITY);
@@ -10053,7 +10052,7 @@ static void atkEC_pursuitrelated(void)
} }
} }
static void atkEF_snatchsetbanks(void) static void atkEF_snatchsetbattlers(void)
{ {
gEffectBattler = gBattlerAttacker; gEffectBattler = gBattlerAttacker;
@@ -10131,7 +10130,7 @@ static void atkEF_handleballthrow(void)
ballMultiplier = 10; ballMultiplier = 10;
break; break;
case ITEM_DIVE_BALL: case ITEM_DIVE_BALL:
if (Overworld_GetMapTypeOfSaveblockLocation() == 5) if (Overworld_GetMapTypeOfSaveblockLocation() == MAP_TYPE_UNDERWATER)
ballMultiplier = 35; ballMultiplier = 35;
else else
ballMultiplier = 10; ballMultiplier = 10;