fix conflicts

This commit is contained in:
DizzyEggg 2023-09-13 15:14:09 +02:00
commit b7d0d37757
18 changed files with 102 additions and 114 deletions

View File

@ -15,9 +15,6 @@
#include "pokeball.h"
#include "battle_debug.h"
#define GET_BATTLER_SIDE(battler) (GetBattlerPosition(battler) & BIT_SIDE)
#define GET_BATTLER_SIDE2(battler) (gBattlerPositions[battler] & BIT_SIDE)
// Used to exclude moves learned temporarily by Transform or Mimic
#define MOVE_IS_PERMANENT(battler, moveSlot) \
(!(gBattleMons[battler].status2 & STATUS2_TRANSFORMED) \
@ -751,17 +748,6 @@ STATIC_ASSERT(sizeof(((struct BattleStruct *)0)->palaceFlags) * 8 >= MAX_BATTLER
#define SET_STATCHANGER(statId, stage, goesDown)(gBattleScripting.statChanger = (statId) + ((stage) << 3) + (goesDown << 7))
#define SET_STATCHANGER2(dst, statId, stage, goesDown)(dst = (statId) + ((stage) << 3) + (goesDown << 7))
static inline struct Pokemon *GetSideParty(u32 side)
{
return side == B_SIDE_PLAYER ? gPlayerParty : gEnemyParty;
}
static inline struct Pokemon *GetBattlerParty(u32 battlerId)
{
extern u8 GetBattlerSide(u8 battler);
return GetSideParty(GetBattlerSide(battlerId));
}
// NOTE: The members of this struct have hard-coded offsets
// in include/constants/battle_script_commands.h
struct BattleScripting
@ -1032,4 +1018,24 @@ extern u16 gBallToDisplay;
extern bool8 gLastUsedBallMenuPresent;
extern u8 gPartyCriticalHits[PARTY_SIZE];
static inline u32 GetBattlerPosition(u32 battler)
{
return gBattlerPositions[battler];
}
static inline u32 GetBattlerSide(u32 battler)
{
return GetBattlerPosition(battler) & BIT_SIDE;
}
static inline struct Pokemon *GetSideParty(u32 side)
{
return (side == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty;
}
static inline struct Pokemon *GetBattlerParty(u32 battler)
{
return GetSideParty(GetBattlerSide(battler));
}
#endif // GUARD_BATTLE_H

View File

@ -165,8 +165,6 @@ void Trade_MoveSelectedMonToTarget(struct Sprite *sprite);
void DestroyAnimVisualTaskAndDisableBlend(u8 taskId);
void DestroySpriteAndFreeResources_(struct Sprite *sprite);
void SetBattlerSpriteYOffsetFromOtherYScale(u8 spriteId, u8 otherSpriteId);
u8 GetBattlerSide(u8 battler);
u8 GetBattlerPosition(u8 battler);
u8 GetBattlerAtPosition(u8 position);
void ConvertPosDataToTranslateLinearData(struct Sprite *sprite);
void InitAnimFastLinearTranslationWithSpeedAndPos(struct Sprite *sprite);

View File

@ -329,7 +329,7 @@ void Ai_UpdateSwitchInData(u32 battler)
void Ai_UpdateFaintData(u32 battler)
{
struct AiPartyMon *aiMon = &AI_PARTY->mons[GET_BATTLER_SIDE(battler)][gBattlerPartyIndexes[battler]];
struct AiPartyMon *aiMon = &AI_PARTY->mons[GetBattlerSide(battler)][gBattlerPartyIndexes[battler]];
ClearBattlerMoveHistory(battler);
ClearBattlerAbilityHistory(battler);
ClearBattlerItemEffectHistory(battler);
@ -2590,7 +2590,7 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u16 move, s32 score)
score -= 10;
break;
case EFFECT_LUCKY_CHANT:
if (gSideTimers[GET_BATTLER_SIDE(battlerAtk)].luckyChantTimer != 0
if (gSideTimers[GetBattlerSide(battlerAtk)].luckyChantTimer != 0
|| PartnerMoveIsSameNoTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove))
score -= 10;
break;

View File

@ -3406,7 +3406,7 @@ s32 AI_CalcPartyMonBestMoveDamage(u32 battlerAtk, u32 battlerDef, struct Pokemon
if (BattlerHasAi(battlerAtk))
move = GetMonData(attackerMon, MON_DATA_MOVE1 + i);
else
move = AI_PARTY->mons[GET_BATTLER_SIDE2(battlerAtk)][gBattlerPartyIndexes[battlerAtk]].moves[i];
move = AI_PARTY->mons[GetBattlerSide(battlerAtk)][gBattlerPartyIndexes[battlerAtk]].moves[i];
if (move != MOVE_NONE && gBattleMoves[move].power != 0)
{

View File

@ -216,7 +216,7 @@ void DoMoveAnim(u16 move)
// Make sure the anim target of moves hitting everyone is at the opposite side.
if (GetBattlerMoveTargetType(gBattlerAttacker, move) & MOVE_TARGET_FOES_AND_ALLY && IsDoubleBattle())
{
while (GET_BATTLER_SIDE(gBattleAnimAttacker) == GET_BATTLER_SIDE(gBattleAnimTarget))
while (GetBattlerSide(gBattleAnimAttacker) == GetBattlerSide(gBattleAnimTarget))
{
if (++gBattleAnimTarget >= MAX_BATTLERS_COUNT)
gBattleAnimTarget = 0;

View File

@ -1704,7 +1704,7 @@ void AnimTask_AirCutterProjectile(u8 taskId)
}
else
{
if (GET_BATTLER_SIDE2(gBattleAnimTarget) == B_SIDE_PLAYER)
if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER)
{
gTasks[taskId].data[4] = 1;
gBattleAnimArgs[0] = -gBattleAnimArgs[0];

View File

@ -564,7 +564,7 @@ static void AnimFistOrFootRandomPos(struct Sprite *sprite)
if (Random2() & 1)
y *= -1;
if (GET_BATTLER_SIDE2(battler) == B_SIDE_PLAYER)
if (GetBattlerSide(battler) == B_SIDE_PLAYER)
y += 0xFFF0;
sprite->x += x;

View File

@ -1276,12 +1276,12 @@ static void InitPoisonGasCloudAnim(struct Sprite *sprite)
if (GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) < GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2))
sprite->data[7] = 0x8000;
if (GET_BATTLER_SIDE2(gBattleAnimTarget) == B_SIDE_PLAYER)
if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER)
{
gBattleAnimArgs[1] = -gBattleAnimArgs[1];
gBattleAnimArgs[3] = -gBattleAnimArgs[3];
if ((sprite->data[7] & 0x8000) && GET_BATTLER_SIDE2(gBattleAnimAttacker) == B_SIDE_PLAYER)
if ((sprite->data[7] & 0x8000) && GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
sprite->subpriority = gSprites[GetAnimBattlerSpriteId(ANIM_TARGET)].subpriority + 1;
sprite->data[6] = 1;
@ -1362,7 +1362,7 @@ static void MovePoisonGasCloud(struct Sprite *sprite)
sprite->data[7]++;
if (IsContest())
sprite->data[5] = 80;
else if (GET_BATTLER_SIDE2(gBattleAnimTarget) != B_SIDE_PLAYER)
else if (GetBattlerSide(gBattleAnimTarget) != B_SIDE_PLAYER)
sprite->data[5] = 204;
else
sprite->data[5] = 80;
@ -1408,7 +1408,7 @@ static void MovePoisonGasCloud(struct Sprite *sprite)
sprite->data[4] = sprite->y + 4;
if (IsContest())
sprite->data[2] = -16;
else if (GET_BATTLER_SIDE2(gBattleAnimTarget) != B_SIDE_PLAYER)
else if (GetBattlerSide(gBattleAnimTarget) != B_SIDE_PLAYER)
sprite->data[2] = DISPLAY_WIDTH + 16;
else
sprite->data[2] = -16;

View File

@ -845,23 +845,13 @@ bool32 InitSpritePosToAnimBattler(u32 animBattlerId, struct Sprite *sprite, bool
return TRUE;
}
u8 GetBattlerSide(u8 battlerId)
{
return GET_BATTLER_SIDE2(battlerId);
}
u8 GetBattlerPosition(u8 battlerId)
{
return gBattlerPositions[battlerId];
}
u8 GetBattlerAtPosition(u8 position)
{
u8 i;
for (i = 0; i < gBattlersCount; i++)
{
if (gBattlerPositions[i] == position)
if (GetBattlerPosition(i) == position)
break;
}
return i;
@ -880,7 +870,7 @@ bool8 IsBattlerSpritePresent(u8 battlerId)
}
else
{
if (gBattlerPositions[battlerId] == 0xff)
if (GetBattlerPosition(battlerId) == 0xff)
return FALSE;
if (!gBattleStruct->spriteIgnore0Hp)

View File

@ -692,7 +692,7 @@ static void HandleInputChooseMove(u32 battler)
if (moveTarget & MOVE_TARGET_USER)
gMultiUsePlayerCursor = battler;
else
gMultiUsePlayerCursor = GetBattlerAtPosition(BATTLE_OPPOSITE(GET_BATTLER_SIDE(battler)));
gMultiUsePlayerCursor = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerSide(battler)));
if (!gBattleResources->bufferA[battler][1]) // not a double battle
{

View File

@ -629,7 +629,7 @@ static void SetBattlePartyIds(void)
{
if (i < 2)
{
if (GET_BATTLER_SIDE2(i) == B_SIDE_PLAYER)
if (GetBattlerSide(i) == B_SIDE_PLAYER)
{
if (IsValidForBattle(&gPlayerParty[j]))
{
@ -648,7 +648,7 @@ static void SetBattlePartyIds(void)
}
else
{
if (GET_BATTLER_SIDE2(i) == B_SIDE_PLAYER)
if (GetBattlerSide(i) == B_SIDE_PLAYER)
{
if (IsValidForBattle(&gPlayerParty[j]) && gBattlerPartyIndexes[i - 2] != j)
{

View File

@ -855,7 +855,7 @@ static void PutAiInfoText(struct BattleDebugMenu *data)
// items info
for (i = 0; i < gBattlersCount; i++)
{
if (GET_BATTLER_SIDE(i) == B_SIDE_PLAYER && IsBattlerAlive(i))
if (GetBattlerSide(i) == B_SIDE_PLAYER && IsBattlerAlive(i))
{
u16 ability = AI_GetAbility(i);
u16 holdEffect = AI_GetHoldEffect(i);
@ -875,10 +875,10 @@ static void PutAiPartyText(struct BattleDebugMenu *data)
{
u32 i, j, count;
u8 *text = Alloc(0x50), *txtPtr;
struct AiPartyMon *aiMons = AI_PARTY->mons[GET_BATTLER_SIDE(data->aiBattlerId)];
struct AiPartyMon *aiMons = AI_PARTY->mons[GetBattlerSide(data->aiBattlerId)];
FillWindowPixelBuffer(data->aiMovesWindowId, 0x11);
count = AI_PARTY->count[GET_BATTLER_SIDE(data->aiBattlerId)];
count = AI_PARTY->count[GetBattlerSide(data->aiBattlerId)];
for (i = 0; i < count; i++)
{
if (aiMons[i].wasSentInBattle)
@ -941,7 +941,7 @@ static void Task_ShowAiKnowledge(u8 taskId)
LoadMonIconPalettes();
for (count = 0, i = 0; i < MAX_BATTLERS_COUNT; i++)
{
if (GET_BATTLER_SIDE(i) == B_SIDE_PLAYER && IsBattlerAlive(i))
if (GetBattlerSide(i) == B_SIDE_PLAYER && IsBattlerAlive(i))
{
data->spriteIds.aiIconSpriteIds[i] = CreateMonIcon(gBattleMons[i].species,
SpriteCallbackDummy,
@ -1000,8 +1000,8 @@ static void Task_ShowAiParty(u8 taskId)
LoadMonIconPalettes();
LoadPartyMenuAilmentGfx();
data->aiBattlerId = data->battlerId;
aiMons = AI_PARTY->mons[GET_BATTLER_SIDE(data->aiBattlerId)];
for (i = 0; i < AI_PARTY->count[GET_BATTLER_SIDE(data->aiBattlerId)]; i++)
aiMons = AI_PARTY->mons[GetBattlerSide(data->aiBattlerId)];
for (i = 0; i < AI_PARTY->count[GetBattlerSide(data->aiBattlerId)]; i++)
{
u16 species = SPECIES_NONE; // Question mark
if (aiMons[i].wasSentInBattle && aiMons[i].species)
@ -1626,7 +1626,7 @@ static void ValueToCharDigits(u8 *charDigits, u32 newValue, u8 maxDigits)
static u8 *GetSideStatusValue(struct BattleDebugMenu *data, bool32 changeStatus, bool32 statusTrue)
{
struct SideTimer *sideTimer = &gSideTimers[GET_BATTLER_SIDE(data->battlerId)];
struct SideTimer *sideTimer = &gSideTimers[GetBattlerSide(data->battlerId)];
switch (data->currentSecondaryListItemId)
{
@ -1909,7 +1909,7 @@ static void SetUpModifyArrows(struct BattleDebugMenu *data)
data->modifyArrows.maxValue = 9;
data->modifyArrows.maxDigits = 2;
data->modifyArrows.modifiedValPtr = &gSideStatuses[GET_BATTLER_SIDE(data->battlerId)];
data->modifyArrows.modifiedValPtr = &gSideStatuses[GetBattlerSide(data->battlerId)];
data->modifyArrows.typeOfVal = VAR_SIDE_STATUS;
data->modifyArrows.currValue = *GetSideStatusValue(data, FALSE, FALSE);
break;

View File

@ -278,7 +278,7 @@ u16 ChooseMoveAndTargetInBattlePalace(u32 battler)
else if (moveTarget == MOVE_TARGET_SELECTED)
chosenMoveId |= GetBattlePalaceTarget(battler);
else
chosenMoveId |= (GetBattlerAtPosition(BATTLE_OPPOSITE(GET_BATTLER_SIDE(battler))) << 8);
chosenMoveId |= (GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerSide(battler))) << 8);
return chosenMoveId;
}
@ -684,7 +684,7 @@ void BattleLoadAllHealthBoxesGfxAtOnce(void)
numberOfBattlers = MAX_BATTLERS_COUNT;
}
for (i = 0; i < numberOfBattlers; i++)
LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[gBattlerPositions[i]]);
LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[GetBattlerPosition(i)]);
}
bool8 BattleLoadAllHealthBoxesGfx(u8 state)
@ -711,9 +711,9 @@ bool8 BattleLoadAllHealthBoxesGfx(u8 state)
else if (state == 3)
LoadCompressedSpriteSheet(&sSpriteSheet_SinglesOpponentHealthbox);
else if (state == 4)
LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[gBattlerPositions[0]]);
LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[GetBattlerPosition(0)]);
else if (state == 5)
LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[gBattlerPositions[1]]);
LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[GetBattlerPosition(1)]);
else
retVal = TRUE;
}
@ -733,13 +733,13 @@ bool8 BattleLoadAllHealthBoxesGfx(u8 state)
else if (state == 5)
LoadCompressedSpriteSheet(&sSpriteSheets_DoublesOpponentHealthbox[1]);
else if (state == 6)
LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[gBattlerPositions[0]]);
LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[GetBattlerPosition(0)]);
else if (state == 7)
LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[gBattlerPositions[1]]);
LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[GetBattlerPosition(1)]);
else if (state == 8)
LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[gBattlerPositions[2]]);
LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[GetBattlerPosition(2)]);
else if (state == 9)
LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[gBattlerPositions[3]]);
LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[GetBattlerPosition(3)]);
else
retVal = TRUE;
}
@ -792,7 +792,7 @@ bool8 BattleInitAllSprites(u8 *state1, u8 *battler)
break;
case 4:
InitBattlerHealthboxCoords(*battler);
if (gBattlerPositions[*battler] <= B_POSITION_OPPONENT_LEFT)
if (GetBattlerPosition(*battler) <= B_POSITION_OPPONENT_LEFT)
DummyBattleInterfaceFunc(gHealthboxSpriteIds[*battler], FALSE);
else
DummyBattleInterfaceFunc(gHealthboxSpriteIds[*battler], TRUE);

View File

@ -4652,7 +4652,7 @@ u32 GetBattlerTotalSpeedStatArgs(u32 battler, u32 ability, u32 holdEffect)
speed *= 2;
// various effects
if (gSideStatuses[GET_BATTLER_SIDE(battler)] & SIDE_STATUS_TAILWIND)
if (gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_TAILWIND)
speed *= 2;
if (gBattleResources->flags->flags[battler] & RESOURCE_FLAG_UNBURDEN)
speed *= 2;

View File

@ -2980,7 +2980,7 @@ static void GetBattlerNick(u32 battler, u8 *dst)
{
struct Pokemon *mon, *illusionMon;
if (GET_BATTLER_SIDE(battler) == B_SIDE_PLAYER)
if (GetBattlerSide(battler) == B_SIDE_PLAYER)
mon = &gPlayerParty[gBattlerPartyIndexes[battler]];
else
mon = &gEnemyParty[gBattlerPartyIndexes[battler]];

View File

@ -2817,7 +2817,7 @@ void SetMoveEffect(bool32 primary, u32 certain)
INCREMENT_RESET_RETURN
}
if (gSideStatuses[GET_BATTLER_SIDE(gEffectBattler)] & SIDE_STATUS_SAFEGUARD && !(gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
if (gSideStatuses[GetBattlerSide(gEffectBattler)] & SIDE_STATUS_SAFEGUARD && !(gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
&& !primary && gBattleScripting.moveEffect <= MOVE_EFFECT_CONFUSION)
INCREMENT_RESET_RETURN
@ -3157,7 +3157,7 @@ void SetMoveEffect(bool32 primary, u32 certain)
break;
case MOVE_EFFECT_PAYDAY:
// Don't scatter coins on the second hit of Parental Bond
if (GET_BATTLER_SIDE(gBattlerAttacker) == B_SIDE_PLAYER && gSpecialStatuses[gBattlerAttacker].parentalBondState!= PARENTAL_BOND_2ND_HIT)
if (GetBattlerSide(gBattlerAttacker) == B_SIDE_PLAYER && gSpecialStatuses[gBattlerAttacker].parentalBondState!= PARENTAL_BOND_2ND_HIT)
{
u16 payday = gPaydayMoney;
gPaydayMoney += (gBattleMons[gBattlerAttacker].level * 5);
@ -3173,7 +3173,7 @@ void SetMoveEffect(bool32 primary, u32 certain)
}
break;
case MOVE_EFFECT_HAPPY_HOUR:
if (GET_BATTLER_SIDE(gBattlerAttacker) == B_SIDE_PLAYER && !gBattleStruct->moneyMultiplierMove)
if (GetBattlerSide(gBattlerAttacker) == B_SIDE_PLAYER && !gBattleStruct->moneyMultiplierMove)
{
gBattleStruct->moneyMultiplier *= 2;
gBattleStruct->moneyMultiplierMove = 1;
@ -3948,16 +3948,10 @@ static void Cmd_jumpifsideaffecting(void)
{
CMD_ARGS(u8 battler, u32 flags, const u8 *jumpInstr);
u8 side;
u32 flags;
const u8 *jumpInstr;
u32 side = GetBattlerSide(GetBattlerForBattleScript(cmd->battler));
side = GET_BATTLER_SIDE(GetBattlerForBattleScript(cmd->battler));
flags = cmd->flags;
jumpInstr = cmd->jumpInstr;
if (gSideStatuses[side] & flags)
gBattlescriptCurrInstr = jumpInstr;
if (gSideStatuses[side] & cmd->flags)
gBattlescriptCurrInstr = cmd->jumpInstr;
else
gBattlescriptCurrInstr = cmd->nextInstr;
}
@ -5086,7 +5080,7 @@ static void Cmd_playstatchangeanimation(void)
changeableStatsCount++;
}
}
else if (!gSideTimers[GET_BATTLER_SIDE(battler)].mistTimer
else if (!gSideTimers[GetBattlerSide(battler)].mistTimer
&& GetBattlerHoldEffect(battler, TRUE) != HOLD_EFFECT_CLEAR_AMULET
&& ability != ABILITY_CLEAR_BODY
&& ability != ABILITY_FULL_METAL_BODY
@ -8463,7 +8457,7 @@ static void HandleScriptMegaPrimalBurst(u32 caseId, u32 battler, u32 type)
struct Pokemon *party = GetBattlerParty(battler);
struct Pokemon *mon = &party[gBattlerPartyIndexes[battler]];
u32 position = GetBattlerPosition(battler);
u32 side = GET_BATTLER_SIDE(battler);
u32 side = GetBattlerSide(battler);
// Change species.
if (caseId == 0)
@ -8672,7 +8666,7 @@ static void Cmd_various(void)
while (gBattleStruct->friskedBattler < gBattlersCount)
{
gBattlerTarget = gBattleStruct->friskedBattler++;
if (GET_BATTLER_SIDE2(battler) != GET_BATTLER_SIDE2(gBattlerTarget)
if (GetBattlerSide(battler) != GetBattlerSide(gBattlerTarget)
&& IsBattlerAlive(gBattlerTarget)
&& gBattleMons[gBattlerTarget].item != ITEM_NONE)
{
@ -9306,11 +9300,11 @@ static void Cmd_various(void)
case VARIOUS_SET_LUCKY_CHANT:
{
VARIOUS_ARGS(const u8 *failInstr);
if (!(gSideStatuses[GET_BATTLER_SIDE(battler)] & SIDE_STATUS_LUCKY_CHANT))
if (!(gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_LUCKY_CHANT))
{
gSideStatuses[GET_BATTLER_SIDE(battler)] |= SIDE_STATUS_LUCKY_CHANT;
gSideTimers[GET_BATTLER_SIDE(battler)].luckyChantBattlerId = battler;
gSideTimers[GET_BATTLER_SIDE(battler)].luckyChantTimer = 5;
gSideStatuses[GetBattlerSide(battler)] |= SIDE_STATUS_LUCKY_CHANT;
gSideTimers[GetBattlerSide(battler)].luckyChantBattlerId = battler;
gSideTimers[GetBattlerSide(battler)].luckyChantTimer = 5;
gBattlescriptCurrInstr = cmd->nextInstr;
}
else
@ -9897,7 +9891,7 @@ static void Cmd_various(void)
case VARIOUS_SET_AURORA_VEIL:
{
VARIOUS_ARGS();
if (gSideStatuses[GET_BATTLER_SIDE(battler)] & SIDE_STATUS_AURORA_VEIL
if (gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_AURORA_VEIL
|| !(WEATHER_HAS_EFFECT && gBattleWeather & (B_WEATHER_HAIL | B_WEATHER_SNOW)))
{
gMoveResultFlags |= MOVE_RESULT_MISSED;
@ -9905,12 +9899,12 @@ static void Cmd_various(void)
}
else
{
gSideStatuses[GET_BATTLER_SIDE(battler)] |= SIDE_STATUS_AURORA_VEIL;
gSideStatuses[GetBattlerSide(battler)] |= SIDE_STATUS_AURORA_VEIL;
if (GetBattlerHoldEffect(battler, TRUE) == HOLD_EFFECT_LIGHT_CLAY)
gSideTimers[GET_BATTLER_SIDE(battler)].auroraVeilTimer = 8;
gSideTimers[GetBattlerSide(battler)].auroraVeilTimer = 8;
else
gSideTimers[GET_BATTLER_SIDE(battler)].auroraVeilTimer = 5;
gSideTimers[GET_BATTLER_SIDE(battler)].auroraVeilBattlerId = battler;
gSideTimers[GetBattlerSide(battler)].auroraVeilTimer = 5;
gSideTimers[GetBattlerSide(battler)].auroraVeilBattlerId = battler;
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && CountAliveMonsInBattle(BATTLE_ALIVE_SIDE, gBattlerAttacker) == 2)
gBattleCommunication[MULTISTRING_CHOOSER] = 5;
@ -10310,11 +10304,11 @@ static void Cmd_various(void)
if (gBattleMons[gBattlerAttacker].species == SPECIES_GRENINJA_BATTLE_BOND
&& HasAttackerFaintedTarget()
&& CalculateBattlerPartyCount(gBattlerTarget) > 1
&& !(gBattleStruct->battleBondTransformed[GET_BATTLER_SIDE2(gBattlerAttacker)] & gBitTable[gBattlerPartyIndexes[gBattlerAttacker]]))
&& !(gBattleStruct->battleBondTransformed[GetBattlerSide(gBattlerAttacker)] & gBitTable[gBattlerPartyIndexes[gBattlerAttacker]]))
{
gBattleStruct->battleBondTransformed[GET_BATTLER_SIDE2(gBattlerAttacker)] |= gBitTable[gBattlerPartyIndexes[gBattlerAttacker]];
gBattleStruct->battleBondTransformed[GetBattlerSide(gBattlerAttacker)] |= gBitTable[gBattlerPartyIndexes[gBattlerAttacker]];
PREPARE_SPECIES_BUFFER(gBattleTextBuff1, gBattleMons[gBattlerAttacker].species);
gBattleStruct->changedSpecies[GET_BATTLER_SIDE2(gBattlerAttacker)][gBattlerPartyIndexes[gBattlerAttacker]] = gBattleMons[gBattlerAttacker].species;
gBattleStruct->changedSpecies[GetBattlerSide(gBattlerAttacker)][gBattlerPartyIndexes[gBattlerAttacker]] = gBattleMons[gBattlerAttacker].species;
gBattleMons[gBattlerAttacker].species = SPECIES_GRENINJA_ASH;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_BattleBondActivatesOnMoveEndAttacker;
@ -11067,19 +11061,19 @@ static void Cmd_setreflect(void)
{
CMD_ARGS();
if (gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] & SIDE_STATUS_REFLECT)
if (gSideStatuses[GetBattlerSide(gBattlerAttacker)] & SIDE_STATUS_REFLECT)
{
gMoveResultFlags |= MOVE_RESULT_MISSED;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SIDE_STATUS_FAILED;
}
else
{
gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] |= SIDE_STATUS_REFLECT;
gSideStatuses[GetBattlerSide(gBattlerAttacker)] |= SIDE_STATUS_REFLECT;
if (GetBattlerHoldEffect(gBattlerAttacker, TRUE) == HOLD_EFFECT_LIGHT_CLAY)
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].reflectTimer = 8;
gSideTimers[GetBattlerSide(gBattlerAttacker)].reflectTimer = 8;
else
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].reflectTimer = 5;
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].reflectBattlerId = gBattlerAttacker;
gSideTimers[GetBattlerSide(gBattlerAttacker)].reflectTimer = 5;
gSideTimers[GetBattlerSide(gBattlerAttacker)].reflectBattlerId = gBattlerAttacker;
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && CountAliveMonsInBattle(BATTLE_ALIVE_SIDE, gBattlerAttacker) == 2)
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_REFLECT_DOUBLE;
@ -11483,7 +11477,7 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr
if (statValue <= -1) // Stat decrease.
{
if (gSideTimers[GET_BATTLER_SIDE(battler)].mistTimer
if (gSideTimers[GetBattlerSide(battler)].mistTimer
&& !certain && gCurrentMove != MOVE_CURSE
&& !(battler == gBattlerTarget && GetBattlerAbility(gBattlerAttacker) == ABILITY_INFILTRATOR))
{
@ -12125,19 +12119,19 @@ static void Cmd_setlightscreen(void)
{
CMD_ARGS();
if (gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] & SIDE_STATUS_LIGHTSCREEN)
if (gSideStatuses[GetBattlerSide(gBattlerAttacker)] & SIDE_STATUS_LIGHTSCREEN)
{
gMoveResultFlags |= MOVE_RESULT_MISSED;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SIDE_STATUS_FAILED;
}
else
{
gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] |= SIDE_STATUS_LIGHTSCREEN;
gSideStatuses[GetBattlerSide(gBattlerAttacker)] |= SIDE_STATUS_LIGHTSCREEN;
if (GetBattlerHoldEffect(gBattlerAttacker, TRUE) == HOLD_EFFECT_LIGHT_CLAY)
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].lightscreenTimer = 8;
gSideTimers[GetBattlerSide(gBattlerAttacker)].lightscreenTimer = 8;
else
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].lightscreenTimer = 5;
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].lightscreenBattlerId = gBattlerAttacker;
gSideTimers[GetBattlerSide(gBattlerAttacker)].lightscreenTimer = 5;
gSideTimers[GetBattlerSide(gBattlerAttacker)].lightscreenBattlerId = gBattlerAttacker;
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && CountAliveMonsInBattle(BATTLE_ALIVE_SIDE, gBattlerAttacker) == 2)
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_LIGHTSCREEN_DOUBLE;
@ -12399,16 +12393,16 @@ static void Cmd_setmist(void)
{
CMD_ARGS();
if (gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].mistTimer)
if (gSideTimers[GetBattlerSide(gBattlerAttacker)].mistTimer)
{
gMoveResultFlags |= MOVE_RESULT_FAILED;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MIST_FAILED;
}
else
{
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].mistTimer = 5;
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].mistBattlerId = gBattlerAttacker;
gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] |= SIDE_STATUS_MIST;
gSideTimers[GetBattlerSide(gBattlerAttacker)].mistTimer = 5;
gSideTimers[GetBattlerSide(gBattlerAttacker)].mistBattlerId = gBattlerAttacker;
gSideStatuses[GetBattlerSide(gBattlerAttacker)] |= SIDE_STATUS_MIST;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_MIST;
}
gBattlescriptCurrInstr = cmd->nextInstr;
@ -13356,16 +13350,16 @@ static void Cmd_setsafeguard(void)
{
CMD_ARGS();
if (gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] & SIDE_STATUS_SAFEGUARD)
if (gSideStatuses[GetBattlerSide(gBattlerAttacker)] & SIDE_STATUS_SAFEGUARD)
{
gMoveResultFlags |= MOVE_RESULT_MISSED;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SIDE_STATUS_FAILED;
}
else
{
gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] |= SIDE_STATUS_SAFEGUARD;
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].safeguardTimer = 5;
gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].safeguardBattlerId = gBattlerAttacker;
gSideStatuses[GetBattlerSide(gBattlerAttacker)] |= SIDE_STATUS_SAFEGUARD;
gSideTimers[GetBattlerSide(gBattlerAttacker)].safeguardTimer = 5;
gSideTimers[GetBattlerSide(gBattlerAttacker)].safeguardBattlerId = gBattlerAttacker;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SET_SAFEGUARD;
}
@ -13676,7 +13670,7 @@ static void Cmd_trysetfutureattack(void)
}
else
{
gSideStatuses[GET_BATTLER_SIDE(gBattlerTarget)] |= SIDE_STATUS_FUTUREATTACK;
gSideStatuses[GetBattlerSide(gBattlerTarget)] |= SIDE_STATUS_FUTUREATTACK;
gWishFutureKnock.futureSightMove[gBattlerTarget] = gCurrentMove;
gWishFutureKnock.futureSightAttacker[gBattlerTarget] = gBattlerAttacker;
gWishFutureKnock.futureSightCounter[gBattlerTarget] = 3;

View File

@ -3139,7 +3139,7 @@ bool32 HandleWishPerishSongOnTurnEnd(void)
if (gWishFutureKnock.futureSightCounter[battler] == 0
&& gWishFutureKnock.futureSightCounter[BATTLE_PARTNER(battler)] == 0)
{
gSideStatuses[GET_BATTLER_SIDE(gBattlerTarget)] &= ~SIDE_STATUS_FUTUREATTACK;
gSideStatuses[GetBattlerSide(gBattlerTarget)] &= ~SIDE_STATUS_FUTUREATTACK;
}
return TRUE;
}
@ -7932,7 +7932,7 @@ u32 GetMoveTarget(u16 move, u8 setTarget)
case MOVE_TARGET_BOTH:
case MOVE_TARGET_FOES_AND_ALLY:
case MOVE_TARGET_OPPONENTS_FIELD:
targetBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GET_BATTLER_SIDE(gBattlerAttacker)));
targetBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker)));
if (!IsBattlerAlive(targetBattler))
targetBattler ^= BIT_FLANK;
break;
@ -7943,7 +7943,7 @@ u32 GetMoveTarget(u16 move, u8 setTarget)
else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && moveTarget & MOVE_TARGET_RANDOM)
targetBattler = SetRandomTarget(gBattlerAttacker);
else
targetBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GET_BATTLER_SIDE(gBattlerAttacker)));
targetBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker)));
break;
case MOVE_TARGET_USER_OR_SELECTED:
case MOVE_TARGET_USER:
@ -8723,7 +8723,7 @@ static inline u32 CalcMoveBasePowerAfterModifiers(u32 move, u32 battlerAtk, u32
u32 basePower = CalcMoveBasePower(move, battlerAtk, battlerDef, defAbility, weather);
uq4_12_t holdEffectModifier;
uq4_12_t modifier = UQ_4_12(1.0);
u32 atkSide = GET_BATTLER_SIDE(battlerAtk);
u32 atkSide = GetBattlerSide(battlerAtk);
// move effect
switch (gBattleMoves[move].effect)
@ -9581,7 +9581,7 @@ static inline uq4_12_t GetAirborneModifier(u32 move, u32 battlerDef)
static inline uq4_12_t GetScreensModifier(u32 move, u32 battlerAtk, u32 battlerDef, bool32 isCrit, u32 abilityAtk)
{
u32 sideStatus = gSideStatuses[GET_BATTLER_SIDE(battlerDef)];
u32 sideStatus = gSideStatuses[GetBattlerSide(battlerDef)];
bool32 lightScreen = (sideStatus & SIDE_STATUS_LIGHTSCREEN) && IS_MOVE_SPECIAL(move);
bool32 reflect = (sideStatus & SIDE_STATUS_REFLECT) && IS_MOVE_PHYSICAL(move);
bool32 auroraVeil = sideStatus & SIDE_STATUS_AURORA_VEIL;
@ -10370,7 +10370,7 @@ bool32 CanBattlerFormChange(u32 battler, u16 method)
bool32 TryBattleFormChange(u32 battler, u16 method)
{
u8 monId = gBattlerPartyIndexes[battler];
u8 side = GET_BATTLER_SIDE(battler);
u8 side = GetBattlerSide(battler);
struct Pokemon *party = GetBattlerParty(battler);
u16 targetSpecies;

View File

@ -4436,7 +4436,7 @@ u8 CountAliveMonsInBattle(u8 caseId, u32 battler)
u8 GetDefaultMoveTarget(u8 battlerId)
{
u8 opposing = BATTLE_OPPOSITE(GET_BATTLER_SIDE(battlerId));
u8 opposing = BATTLE_OPPOSITE(GetBattlerSide(battlerId));
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
return GetBattlerAtPosition(opposing);