remove gActiveBattler entirely

This commit is contained in:
DizzyEggg 2023-08-30 12:46:22 +02:00
parent a7615f9649
commit c29f8259f6
13 changed files with 38 additions and 51 deletions

View File

@ -367,7 +367,7 @@ B_ATK_PARTNER_NAME = FD 0E
B_ATK_NAME_WITH_PREFIX = FD 0F B_ATK_NAME_WITH_PREFIX = FD 0F
B_DEF_NAME_WITH_PREFIX = FD 10 B_DEF_NAME_WITH_PREFIX = FD 10
B_EFF_NAME_WITH_PREFIX = FD 11 @ EFF = short for gEffectBattler B_EFF_NAME_WITH_PREFIX = FD 11 @ EFF = short for gEffectBattler
B_ACTIVE_NAME_WITH_PREFIX = FD 12 B_SELECTION_NAME_WITH_PREFIX = FD 12
B_SCR_ACTIVE_NAME_WITH_PREFIX = FD 13 B_SCR_ACTIVE_NAME_WITH_PREFIX = FD 13
B_CURRENT_MOVE = FD 14 B_CURRENT_MOVE = FD 14
B_LAST_MOVE = FD 15 B_LAST_MOVE = FD 15
@ -409,8 +409,8 @@ B_ATK_TEAM2 = FD 38
B_DEF_NAME = FD 39 B_DEF_NAME = FD 39
B_DEF_TEAM1 = FD 3A B_DEF_TEAM1 = FD 3A
B_DEF_TEAM2 = FD 3B B_DEF_TEAM2 = FD 3B
B_ACTIVE_NAME = FD 3C B_SELECTION_NAME = FD 3C
B_ACTIVE_NAME2 = FD 3D @ no Illusion check B_SELECTION_NAME2 = FD 3D @ no Illusion check
@ indicates the end of a town/city name (before " TOWN" or " CITY") @ indicates the end of a town/city name (before " TOWN" or " CITY")
NAME_END = FC 00 NAME_END = FC 00

View File

@ -112,6 +112,7 @@ BattleScript_ItemSetFocusEnergy::
setfocusenergy setfocusenergy
playmoveanimation BS_ATTACKER, MOVE_FOCUS_ENERGY playmoveanimation BS_ATTACKER, MOVE_FOCUS_ENERGY
waitanimation waitanimation
copybyte sBATTLER, gBattlerAttacker
printstring STRINGID_PKMNUSEDXTOGETPUMPED printstring STRINGID_PKMNUSEDXTOGETPUMPED
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
end end

View File

@ -910,7 +910,7 @@ extern u8 gBattleTerrain;
extern u32 gUnusedFirstBattleVar1; extern u32 gUnusedFirstBattleVar1;
extern u8 *gBattleAnimBgTileBuffer; extern u8 *gBattleAnimBgTileBuffer;
extern u8 *gBattleAnimBgTilemapBuffer; extern u8 *gBattleAnimBgTilemapBuffer;
extern u8 gActiveBattler; extern u8 gSelectionBattler;
extern u32 gBattleControllerExecFlags; extern u32 gBattleControllerExecFlags;
extern u8 gBattlersCount; extern u8 gBattlersCount;
extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT]; extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT];

View File

@ -26,7 +26,7 @@
#define B_TXT_ATK_NAME_WITH_PREFIX 0xF #define B_TXT_ATK_NAME_WITH_PREFIX 0xF
#define B_TXT_DEF_NAME_WITH_PREFIX 0x10 #define B_TXT_DEF_NAME_WITH_PREFIX 0x10
#define B_TXT_EFF_NAME_WITH_PREFIX 0x11 // EFF = short for gEffectBank #define B_TXT_EFF_NAME_WITH_PREFIX 0x11 // EFF = short for gEffectBank
#define B_TXT_ACTIVE_NAME_WITH_PREFIX 0x12 #define B_TXT_SELECTION_NAME_WITH_PREFIX 0x12
#define B_TXT_SCR_ACTIVE_NAME_WITH_PREFIX 0x13 #define B_TXT_SCR_ACTIVE_NAME_WITH_PREFIX 0x13
#define B_TXT_CURRENT_MOVE 0x14 #define B_TXT_CURRENT_MOVE 0x14
#define B_TXT_LAST_MOVE 0x15 #define B_TXT_LAST_MOVE 0x15
@ -68,8 +68,8 @@
#define B_TXT_DEF_NAME 0x39 #define B_TXT_DEF_NAME 0x39
#define B_TXT_DEF_TEAM1 0x3A // Your/The opposing #define B_TXT_DEF_TEAM1 0x3A // Your/The opposing
#define B_TXT_DEF_TEAM2 0x3B // your/the opposing #define B_TXT_DEF_TEAM2 0x3B // your/the opposing
#define B_TXT_ACTIVE_NAME 0x3C #define B_TXT_SELECTION_NAME 0x3C
#define B_TXT_ACTIVE_NAME2 0x3D // no Illusion check #define B_TXT_SELECTION_NAME2 0x3D // no Illusion check
// for B_TXT_BUFF1, B_TXT_BUFF2 and B_TXT_BUFF3 // for B_TXT_BUFF1, B_TXT_BUFF2 and B_TXT_BUFF3

View File

@ -306,9 +306,7 @@
#define MAX_MON_PIC_FRAMES 2 #define MAX_MON_PIC_FRAMES 2
#define BATTLE_ALIVE_EXCEPT_BATTLER 0 #define BATTLE_ALIVE_EXCEPT_BATTLER 0
#define BATTLE_ALIVE_ATK_SIDE 1 #define BATTLE_ALIVE_SIDE 1
#define BATTLE_ALIVE_DEF_SIDE 2
#define BATTLE_ALIVE_EXCEPT_ATTACKER 3
#define SKIP_FRONT_ANIM (1 << 7) #define SKIP_FRONT_ANIM (1 << 7)

View File

@ -525,7 +525,7 @@ static void OpponentHandleChooseMove(u32 battler)
{ {
if (gBattleTypeFlags & BATTLE_TYPE_PALACE) if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
{ {
BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, ChooseMoveAndTargetInBattlePalace()); BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, ChooseMoveAndTargetInBattlePalace(battler));
} }
else else
{ {

View File

@ -1890,6 +1890,7 @@ static void PlayerHandleChooseAction(u32 battler)
TryRestoreLastUsedBall(); TryRestoreLastUsedBall();
ActionSelectionCreateCursorAt(gActionSelectionCursor[battler], 0); ActionSelectionCreateCursorAt(gActionSelectionCursor[battler], 0);
gSelectionBattler = battler;
BattleStringExpandPlaceholdersToDisplayedString(gText_WhatWillPkmnDo); BattleStringExpandPlaceholdersToDisplayedString(gText_WhatWillPkmnDo);
BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_ACTION_PROMPT); BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_ACTION_PROMPT);
} }

View File

@ -468,7 +468,7 @@ static void RecordedOpponentHandleChooseMove(u32 battler)
{ {
if (gBattleTypeFlags & BATTLE_TYPE_PALACE) if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
{ {
BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, ChooseMoveAndTargetInBattlePalace()); BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, ChooseMoveAndTargetInBattlePalace(battler));
} }
else else
{ {

View File

@ -474,7 +474,7 @@ static void RecordedPlayerHandleChooseMove(u32 battler)
{ {
if (gBattleTypeFlags & BATTLE_TYPE_PALACE) if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
{ {
BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, ChooseMoveAndTargetInBattlePalace()); BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, ChooseMoveAndTargetInBattlePalace(battler));
} }
else else
{ {

View File

@ -151,7 +151,7 @@ EWRAM_DATA struct MultiPartnerMenuPokemon gMultiPartnerParty[MULTI_PARTY_SIZE] =
EWRAM_DATA static struct MultiPartnerMenuPokemon* sMultiPartnerPartyBuffer = NULL; EWRAM_DATA static struct MultiPartnerMenuPokemon* sMultiPartnerPartyBuffer = NULL;
EWRAM_DATA u8 *gBattleAnimBgTileBuffer = NULL; EWRAM_DATA u8 *gBattleAnimBgTileBuffer = NULL;
EWRAM_DATA u8 *gBattleAnimBgTilemapBuffer = NULL; EWRAM_DATA u8 *gBattleAnimBgTilemapBuffer = NULL;
EWRAM_DATA u8 gActiveBattler = 0; EWRAM_DATA u8 gSelectionBattler = 0;
EWRAM_DATA u32 gBattleControllerExecFlags = 0; EWRAM_DATA u32 gBattleControllerExecFlags = 0;
EWRAM_DATA u8 gBattlersCount = 0; EWRAM_DATA u8 gBattlersCount = 0;
EWRAM_DATA u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT] = {0};
@ -4091,6 +4091,7 @@ static void HandleTurnActionSelectionState(void)
} }
break; break;
case STATE_BEFORE_ACTION_CHOSEN: // Choose an action. case STATE_BEFORE_ACTION_CHOSEN: // Choose an action.
gSelectionBattler = battler;
*(gBattleStruct->monToSwitchIntoId + battler) = PARTY_SIZE; *(gBattleStruct->monToSwitchIntoId + battler) = PARTY_SIZE;
if (gBattleTypeFlags & BATTLE_TYPE_MULTI if (gBattleTypeFlags & BATTLE_TYPE_MULTI
|| (position & BIT_FLANK) == B_FLANK_LEFT || (position & BIT_FLANK) == B_FLANK_LEFT

View File

@ -265,17 +265,17 @@ static const u8 sText_XFoundOneY[] = _("{B_ATK_NAME_WITH_PREFIX} found\none {B_L
static const u8 sText_SoothingAroma[] = _("A soothing aroma wafted\nthrough the area!"); static const u8 sText_SoothingAroma[] = _("A soothing aroma wafted\nthrough the area!");
static const u8 sText_ItemsCantBeUsedNow[] = _("Items can't be used now.{PAUSE 64}"); static const u8 sText_ItemsCantBeUsedNow[] = _("Items can't be used now.{PAUSE 64}");
static const u8 sText_ForXCommaYZ[] = _("For {B_SCR_ACTIVE_NAME_WITH_PREFIX},\n{B_LAST_ITEM} {B_BUFF1}"); static const u8 sText_ForXCommaYZ[] = _("For {B_SCR_ACTIVE_NAME_WITH_PREFIX},\n{B_LAST_ITEM} {B_BUFF1}");
static const u8 sText_PkmnUsedXToGetPumped[] = _("{B_ACTIVE_NAME_WITH_PREFIX} used\n{B_LAST_ITEM} to get pumped!"); static const u8 sText_PkmnUsedXToGetPumped[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} used\n{B_LAST_ITEM} to get pumped!");
static const u8 sText_PkmnLostFocus[] = _("{B_ATK_NAME_WITH_PREFIX} lost its\nfocus and couldn't move!"); static const u8 sText_PkmnLostFocus[] = _("{B_ATK_NAME_WITH_PREFIX} lost its\nfocus and couldn't move!");
static const u8 sText_PkmnWasDraggedOut[] = _("{B_DEF_NAME_WITH_PREFIX} was\ndragged out!\p"); static const u8 sText_PkmnWasDraggedOut[] = _("{B_DEF_NAME_WITH_PREFIX} was\ndragged out!\p");
static const u8 sText_TheWallShattered[] = _("The wall shattered!"); static const u8 sText_TheWallShattered[] = _("The wall shattered!");
static const u8 sText_ButNoEffect[] = _("But it had no effect!"); static const u8 sText_ButNoEffect[] = _("But it had no effect!");
static const u8 sText_PkmnHasNoMovesLeft[] = _("{B_ACTIVE_NAME_WITH_PREFIX} has no\nmoves left!\p"); static const u8 sText_PkmnHasNoMovesLeft[] = _("{B_SELECTION_NAME_WITH_PREFIX} has no\nmoves left!\p");
static const u8 sText_PkmnMoveIsDisabled[] = _("{B_ACTIVE_NAME_WITH_PREFIX}'s {B_CURRENT_MOVE}\nis disabled!\p"); static const u8 sText_PkmnMoveIsDisabled[] = _("{B_SELECTION_NAME_WITH_PREFIX}'s {B_CURRENT_MOVE}\nis disabled!\p");
static const u8 sText_PkmnCantUseMoveTorment[] = _("{B_ACTIVE_NAME_WITH_PREFIX} can't use the same\nmove in a row due to the Torment!\p"); static const u8 sText_PkmnCantUseMoveTorment[] = _("{B_SELECTION_NAME_WITH_PREFIX} can't use the same\nmove in a row due to the Torment!\p");
static const u8 sText_PkmnCantUseMoveTaunt[] = _("{B_ACTIVE_NAME_WITH_PREFIX} can't use\n{B_CURRENT_MOVE} after the Taunt!\p"); static const u8 sText_PkmnCantUseMoveTaunt[] = _("{B_SELECTION_NAME_WITH_PREFIX} can't use\n{B_CURRENT_MOVE} after the Taunt!\p");
static const u8 sText_PkmnCantUseMoveSealed[] = _("{B_ACTIVE_NAME_WITH_PREFIX} can't use the\nsealed {B_CURRENT_MOVE}!\p"); static const u8 sText_PkmnCantUseMoveSealed[] = _("{B_SELECTION_NAME_WITH_PREFIX} can't use the\nsealed {B_CURRENT_MOVE}!\p");
static const u8 sText_PkmnCantUseMoveThroatChop[] = _("{B_ACTIVE_NAME_WITH_PREFIX} can't use\n{B_CURRENT_MOVE} due to Throat Chop!\p"); static const u8 sText_PkmnCantUseMoveThroatChop[] = _("{B_SELECTION_NAME_WITH_PREFIX} can't use\n{B_CURRENT_MOVE} due to Throat Chop!\p");
static const u8 sText_PkmnMadeItRain[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s {B_SCR_ACTIVE_ABILITY}\nmade it rain!"); static const u8 sText_PkmnMadeItRain[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s {B_SCR_ACTIVE_ABILITY}\nmade it rain!");
static const u8 sText_PkmnRaisedSpeed[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s {B_SCR_ACTIVE_ABILITY}\nraised its SPEED!"); static const u8 sText_PkmnRaisedSpeed[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s {B_SCR_ACTIVE_ABILITY}\nraised its SPEED!");
static const u8 sText_PkmnProtectedBy[] = _("{B_DEF_NAME_WITH_PREFIX} was protected\nby {B_DEF_ABILITY}!"); static const u8 sText_PkmnProtectedBy[] = _("{B_DEF_NAME_WITH_PREFIX} was protected\nby {B_DEF_ABILITY}!");
@ -1945,7 +1945,7 @@ const u8 gText_PkmnIsEvolving[] = _("What?\n{STR_VAR_1} is evolving!");
const u8 gText_CongratsPkmnEvolved[] = _("Congratulations! Your {STR_VAR_1}\nevolved into {STR_VAR_2}!{WAIT_SE}\p"); const u8 gText_CongratsPkmnEvolved[] = _("Congratulations! Your {STR_VAR_1}\nevolved into {STR_VAR_2}!{WAIT_SE}\p");
const u8 gText_PkmnStoppedEvolving[] = _("Huh? {STR_VAR_1}\nstopped evolving!\p"); const u8 gText_PkmnStoppedEvolving[] = _("Huh? {STR_VAR_1}\nstopped evolving!\p");
const u8 gText_EllipsisQuestionMark[] = _("……?\p"); const u8 gText_EllipsisQuestionMark[] = _("……?\p");
const u8 gText_WhatWillPkmnDo[] = _("What will\n{B_ACTIVE_NAME2} do?"); const u8 gText_WhatWillPkmnDo[] = _("What will\n{B_SELECTION_NAME2} do?");
const u8 gText_WhatWillPkmnDo2[] = _("What will\n{B_PLAYER_NAME} do?"); const u8 gText_WhatWillPkmnDo2[] = _("What will\n{B_PLAYER_NAME} do?");
const u8 gText_WhatWillWallyDo[] = _("What will\nWALLY do?"); const u8 gText_WhatWillWallyDo[] = _("What will\nWALLY do?");
const u8 gText_LinkStandby[] = _("{PAUSE 16}Link standby…"); const u8 gText_LinkStandby[] = _("{PAUSE 16}Link standby…");
@ -3244,23 +3244,23 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst)
GetBattlerNick(gBattlerTarget, text); GetBattlerNick(gBattlerTarget, text);
toCpy = text; toCpy = text;
break; break;
case B_TXT_ACTIVE_NAME: // active name case B_TXT_SELECTION_NAME: // selection name
GetBattlerNick(gActiveBattler, text); GetBattlerNick(gSelectionBattler, text);
toCpy = text; toCpy = text;
break; break;
case B_TXT_ACTIVE_NAME2: // active battler name with prefix, no illusion case B_TXT_SELECTION_NAME2: // selection battler name with prefix, no illusion
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) if (GetBattlerSide(gSelectionBattler) == B_SIDE_PLAYER)
GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_NICKNAME, text); GetMonData(&gPlayerParty[gBattlerPartyIndexes[gSelectionBattler]], MON_DATA_NICKNAME, text);
else else
GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_NICKNAME, text); GetMonData(&gEnemyParty[gBattlerPartyIndexes[gSelectionBattler]], MON_DATA_NICKNAME, text);
StringGet_Nickname(text); StringGet_Nickname(text);
toCpy = text; toCpy = text;
break; break;
case B_TXT_EFF_NAME_WITH_PREFIX: // effect battler name with prefix case B_TXT_EFF_NAME_WITH_PREFIX: // effect battler name with prefix
HANDLE_NICKNAME_STRING_CASE(gEffectBattler) HANDLE_NICKNAME_STRING_CASE(gEffectBattler)
break; break;
case B_TXT_ACTIVE_NAME_WITH_PREFIX: // active battler name with prefix case B_TXT_SELECTION_NAME_WITH_PREFIX: // selection battler name with prefix
HANDLE_NICKNAME_STRING_CASE(gActiveBattler) HANDLE_NICKNAME_STRING_CASE(gSelectionBattler)
break; break;
case B_TXT_SCR_ACTIVE_NAME_WITH_PREFIX: // scripting active battler name with prefix case B_TXT_SCR_ACTIVE_NAME_WITH_PREFIX: // scripting active battler name with prefix
HANDLE_NICKNAME_STRING_CASE(gBattleScripting.battler) HANDLE_NICKNAME_STRING_CASE(gBattleScripting.battler)

View File

@ -9909,7 +9909,7 @@ static void Cmd_various(void)
gSideTimers[GET_BATTLER_SIDE(battler)].auroraVeilTimer = 5; gSideTimers[GET_BATTLER_SIDE(battler)].auroraVeilTimer = 5;
gSideTimers[GET_BATTLER_SIDE(battler)].auroraVeilBattlerId = battler; gSideTimers[GET_BATTLER_SIDE(battler)].auroraVeilBattlerId = battler;
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && CountAliveMonsInBattle(BATTLE_ALIVE_ATK_SIDE) == 2) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && CountAliveMonsInBattle(BATTLE_ALIVE_SIDE, gBattlerAttacker) == 2)
gBattleCommunication[MULTISTRING_CHOOSER] = 5; gBattleCommunication[MULTISTRING_CHOOSER] = 5;
else else
gBattleCommunication[MULTISTRING_CHOOSER] = 5; gBattleCommunication[MULTISTRING_CHOOSER] = 5;
@ -11132,7 +11132,7 @@ static void Cmd_setreflect(void)
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].reflectTimer = 5; gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].reflectTimer = 5;
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].reflectBattlerId = gBattlerAttacker; gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].reflectBattlerId = gBattlerAttacker;
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && CountAliveMonsInBattle(BATTLE_ALIVE_ATK_SIDE) == 2) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && CountAliveMonsInBattle(BATTLE_ALIVE_SIDE, gBattlerAttacker) == 2)
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_REFLECT_DOUBLE; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_REFLECT_DOUBLE;
else else
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_REFLECT_SINGLE; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_REFLECT_SINGLE;
@ -12190,7 +12190,7 @@ static void Cmd_setlightscreen(void)
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].lightscreenTimer = 5; gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].lightscreenTimer = 5;
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].lightscreenBattlerId = gBattlerAttacker; gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].lightscreenBattlerId = gBattlerAttacker;
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && CountAliveMonsInBattle(BATTLE_ALIVE_ATK_SIDE) == 2) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && CountAliveMonsInBattle(BATTLE_ALIVE_SIDE, gBattlerAttacker) == 2)
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_LIGHTSCREEN_DOUBLE; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_LIGHTSCREEN_DOUBLE;
else else
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_LIGHTSCREEN_SINGLE; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_LIGHTSCREEN_SINGLE;
@ -15898,12 +15898,12 @@ bool8 IsMoveAffectedByParentalBond(u16 move, u8 battler)
{ {
// Both foes are alive, spread move strikes once // Both foes are alive, spread move strikes once
case MOVE_TARGET_BOTH: case MOVE_TARGET_BOTH:
if (CountAliveMonsInBattle(BATTLE_ALIVE_DEF_SIDE) >= 2) if (CountAliveMonsInBattle(BATTLE_ALIVE_SIDE, gBattlerTarget) >= 2)
return FALSE; return FALSE;
break; break;
// Either both foes or one foe and its ally are alive; spread move strikes once // Either both foes or one foe and its ally are alive; spread move strikes once
case MOVE_TARGET_FOES_AND_ALLY: case MOVE_TARGET_FOES_AND_ALLY:
if (CountAliveMonsInBattle(BATTLE_ALIVE_EXCEPT_ATTACKER) >= 2) if (CountAliveMonsInBattle(BATTLE_ALIVE_EXCEPT_BATTLER, gBattlerAttacker) >= 2)
return FALSE; return FALSE;
break; break;
default: default:

View File

@ -4422,24 +4422,10 @@ u8 CountAliveMonsInBattle(u8 caseId, u32 battler)
retVal++; retVal++;
} }
break; break;
case BATTLE_ALIVE_ATK_SIDE: case BATTLE_ALIVE_SIDE:
for (i = 0; i < MAX_BATTLERS_COUNT; i++) for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{ {
if (GetBattlerSide(i) == GetBattlerSide(gBattlerAttacker) && !(gAbsentBattlerFlags & gBitTable[i])) if (GetBattlerSide(i) == GetBattlerSide(battler) && !(gAbsentBattlerFlags & gBitTable[i]))
retVal++;
}
break;
case BATTLE_ALIVE_DEF_SIDE:
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{
if (GetBattlerSide(i) == GetBattlerSide(gBattlerTarget) && !(gAbsentBattlerFlags & gBitTable[i]))
retVal++;
}
break;
case BATTLE_ALIVE_EXCEPT_ATTACKER:
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{
if (i != gBattlerAttacker && !(gAbsentBattlerFlags & gBitTable[i]))
retVal++; retVal++;
} }
break; break;