Rename battlerId to battler for consistency (#2126)
This commit is contained in:
@@ -851,27 +851,27 @@ static void UNUSED MarkAllBattlersForControllerExec(void)
|
||||
// set a bit indicating that we're sending a message over the link. That
|
||||
// message will be received by all other players... *and* by us, the player
|
||||
// sending it, at which point we'll invoke MarkBattlerReceivedLinkData,
|
||||
// below, to clear the "we're sending a message" bit and set the "controller
|
||||
// below, to clear the "we're sending a message" bit and set the "controller
|
||||
// is now active" bit.
|
||||
void MarkBattlerForControllerExec(u8 battlerId)
|
||||
void MarkBattlerForControllerExec(u8 battler)
|
||||
{
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
|
||||
MARK_BATTLE_CONTROLLER_MESSAGE_OUTBOUND_OVER_LINK(battlerId);
|
||||
MARK_BATTLE_CONTROLLER_MESSAGE_OUTBOUND_OVER_LINK(battler);
|
||||
else
|
||||
MARK_BATTLE_CONTROLLER_ACTIVE_ON_LOCAL(battlerId);
|
||||
MARK_BATTLE_CONTROLLER_ACTIVE_ON_LOCAL(battler);
|
||||
}
|
||||
|
||||
// Called when a message dispatched from the battle engine to a battle
|
||||
// Called when a message dispatched from the battle engine to a battle
|
||||
// controller is received over link communications. All players assume
|
||||
// that if they've received the message, everyone else has as well.
|
||||
void MarkBattlerReceivedLinkData(u8 battlerId)
|
||||
void MarkBattlerReceivedLinkData(u8 battler)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < GetLinkPlayerCount(); i++)
|
||||
MARK_BATTLE_CONTROLLER_ACTIVE_FOR_PLAYER(battlerId, i);
|
||||
MARK_BATTLE_CONTROLLER_ACTIVE_FOR_PLAYER(battler, i);
|
||||
|
||||
MARK_BATTLE_CONTROLLER_MESSAGE_SYNCHRONIZED_OVER_LINK(battlerId);
|
||||
MARK_BATTLE_CONTROLLER_MESSAGE_SYNCHRONIZED_OVER_LINK(battler);
|
||||
}
|
||||
|
||||
void CancelMultiTurnMoves(u8 battler)
|
||||
@@ -1079,44 +1079,44 @@ u8 TrySetCantSelectMoveBattleScript(void)
|
||||
return limitations;
|
||||
}
|
||||
|
||||
u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u8 check)
|
||||
u8 CheckMoveLimitations(u8 battler, u8 unusableMoves, u8 check)
|
||||
{
|
||||
u8 holdEffect;
|
||||
u16 *choicedMove = &gBattleStruct->choicedMove[battlerId];
|
||||
u16 *choicedMove = &gBattleStruct->choicedMove[battler];
|
||||
s32 i;
|
||||
|
||||
if (gBattleMons[battlerId].item == ITEM_ENIGMA_BERRY)
|
||||
holdEffect = gEnigmaBerries[battlerId].holdEffect;
|
||||
if (gBattleMons[battler].item == ITEM_ENIGMA_BERRY)
|
||||
holdEffect = gEnigmaBerries[battler].holdEffect;
|
||||
else
|
||||
holdEffect = ItemId_GetHoldEffect(gBattleMons[battlerId].item);
|
||||
holdEffect = ItemId_GetHoldEffect(gBattleMons[battler].item);
|
||||
|
||||
gPotentialItemEffectBattler = battlerId;
|
||||
gPotentialItemEffectBattler = battler;
|
||||
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
// No move
|
||||
if (gBattleMons[battlerId].moves[i] == MOVE_NONE && check & MOVE_LIMITATION_ZEROMOVE)
|
||||
if (gBattleMons[battler].moves[i] == MOVE_NONE && check & MOVE_LIMITATION_ZEROMOVE)
|
||||
unusableMoves |= gBitTable[i];
|
||||
// No PP
|
||||
if (gBattleMons[battlerId].pp[i] == 0 && check & MOVE_LIMITATION_PP)
|
||||
if (gBattleMons[battler].pp[i] == 0 && check & MOVE_LIMITATION_PP)
|
||||
unusableMoves |= gBitTable[i];
|
||||
// Disable
|
||||
if (gBattleMons[battlerId].moves[i] == gDisableStructs[battlerId].disabledMove && check & MOVE_LIMITATION_DISABLED)
|
||||
if (gBattleMons[battler].moves[i] == gDisableStructs[battler].disabledMove && check & MOVE_LIMITATION_DISABLED)
|
||||
unusableMoves |= gBitTable[i];
|
||||
// Torment
|
||||
if (gBattleMons[battlerId].moves[i] == gLastMoves[battlerId] && check & MOVE_LIMITATION_TORMENTED && gBattleMons[battlerId].status2 & STATUS2_TORMENT)
|
||||
if (gBattleMons[battler].moves[i] == gLastMoves[battler] && check & MOVE_LIMITATION_TORMENTED && gBattleMons[battler].status2 & STATUS2_TORMENT)
|
||||
unusableMoves |= gBitTable[i];
|
||||
// Taunt
|
||||
if (gDisableStructs[battlerId].tauntTimer && check & MOVE_LIMITATION_TAUNT && gBattleMoves[gBattleMons[battlerId].moves[i]].power == 0)
|
||||
if (gDisableStructs[battler].tauntTimer && check & MOVE_LIMITATION_TAUNT && gBattleMoves[gBattleMons[battler].moves[i]].power == 0)
|
||||
unusableMoves |= gBitTable[i];
|
||||
// Imprison
|
||||
if (GetImprisonedMovesCount(battlerId, gBattleMons[battlerId].moves[i]) && check & MOVE_LIMITATION_IMPRISON)
|
||||
if (GetImprisonedMovesCount(battler, gBattleMons[battler].moves[i]) && check & MOVE_LIMITATION_IMPRISON)
|
||||
unusableMoves |= gBitTable[i];
|
||||
// Encore
|
||||
if (gDisableStructs[battlerId].encoreTimer && gDisableStructs[battlerId].encoredMove != gBattleMons[battlerId].moves[i])
|
||||
if (gDisableStructs[battler].encoreTimer && gDisableStructs[battler].encoredMove != gBattleMons[battler].moves[i])
|
||||
unusableMoves |= gBitTable[i];
|
||||
// Choice Band
|
||||
if (holdEffect == HOLD_EFFECT_CHOICE_BAND && *choicedMove != MOVE_NONE && *choicedMove != MOVE_UNAVAILABLE && *choicedMove != gBattleMons[battlerId].moves[i])
|
||||
if (holdEffect == HOLD_EFFECT_CHOICE_BAND && *choicedMove != MOVE_NONE && *choicedMove != MOVE_UNAVAILABLE && *choicedMove != gBattleMons[battler].moves[i])
|
||||
unusableMoves |= gBitTable[i];
|
||||
}
|
||||
return unusableMoves;
|
||||
@@ -1139,11 +1139,11 @@ bool8 AreAllMovesUnusable(void)
|
||||
return (unusable == ALL_MOVES_MASK);
|
||||
}
|
||||
|
||||
u8 GetImprisonedMovesCount(u8 battlerId, u16 move)
|
||||
u8 GetImprisonedMovesCount(u8 battler, u16 move)
|
||||
{
|
||||
s32 i;
|
||||
u8 imprisonedMoves = 0;
|
||||
u8 battlerSide = GetBattlerSide(battlerId);
|
||||
u8 battlerSide = GetBattlerSide(battler);
|
||||
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
{
|
||||
@@ -3225,16 +3225,16 @@ enum
|
||||
};
|
||||
|
||||
#define TRY_EAT_CONFUSE_BERRY(flavor) \
|
||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / 2 && !moveTurn) \
|
||||
if (gBattleMons[battler].hp <= gBattleMons[battler].maxHP / 2 && !moveTurn) \
|
||||
{ \
|
||||
PREPARE_FLAVOR_BUFFER(gBattleTextBuff1, flavor); \
|
||||
gBattleMoveDamage = gBattleMons[battlerId].maxHP / battlerHoldEffectParam; \
|
||||
gBattleMoveDamage = gBattleMons[battler].maxHP / battlerHoldEffectParam; \
|
||||
if (gBattleMoveDamage == 0) \
|
||||
gBattleMoveDamage = 1; \
|
||||
if (gBattleMons[battlerId].hp + gBattleMoveDamage > gBattleMons[battlerId].maxHP) \
|
||||
gBattleMoveDamage = gBattleMons[battlerId].maxHP - gBattleMons[battlerId].hp; \
|
||||
if (gBattleMons[battler].hp + gBattleMoveDamage > gBattleMons[battler].maxHP) \
|
||||
gBattleMoveDamage = gBattleMons[battler].maxHP - gBattleMons[battler].hp; \
|
||||
gBattleMoveDamage *= -1; \
|
||||
if (GetFlavorRelationByPersonality(gBattleMons[battlerId].personality, flavor) < 0) \
|
||||
if (GetFlavorRelationByPersonality(gBattleMons[battler].personality, flavor) < 0) \
|
||||
BattleScriptExecute(BattleScript_BerryConfuseHealEnd2); \
|
||||
else \
|
||||
BattleScriptExecute(BattleScript_ItemHealHP_RemoveItem); \
|
||||
@@ -3242,11 +3242,11 @@ enum
|
||||
}
|
||||
|
||||
#define TRY_EAT_STAT_UP_BERRY(stat) \
|
||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam \
|
||||
&& !moveTurn && gBattleMons[battlerId].statStages[stat] < MAX_STAT_STAGE) \
|
||||
if (gBattleMons[battler].hp <= gBattleMons[battler].maxHP / battlerHoldEffectParam \
|
||||
&& !moveTurn && gBattleMons[battler].statStages[stat] < MAX_STAT_STAGE) \
|
||||
{ \
|
||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, stat); \
|
||||
gEffectBattler = battlerId; \
|
||||
gEffectBattler = battler; \
|
||||
SET_STATCHANGER(stat, 1, FALSE); \
|
||||
gBattleScripting.animArg1 = STAT_ANIM_PLUS1 + (stat); \
|
||||
gBattleScripting.animArg2 = 0; \
|
||||
@@ -3254,7 +3254,7 @@ enum
|
||||
effect = ITEM_STATS_CHANGE; \
|
||||
}
|
||||
|
||||
u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
u8 ItemBattleEffects(u8 caseID, u8 battler, bool8 moveTurn)
|
||||
{
|
||||
int i = 0;
|
||||
u8 effect = ITEM_NO_EFFECT;
|
||||
@@ -3263,11 +3263,11 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
u8 battlerHoldEffectParam, atkHoldEffectParam, UNUSED defHoldEffectParam;
|
||||
u16 atkItem, defItem;
|
||||
|
||||
gLastUsedItem = gBattleMons[battlerId].item;
|
||||
gLastUsedItem = gBattleMons[battler].item;
|
||||
if (gLastUsedItem == ITEM_ENIGMA_BERRY)
|
||||
{
|
||||
battlerHoldEffect = gEnigmaBerries[battlerId].holdEffect;
|
||||
battlerHoldEffectParam = gEnigmaBerries[battlerId].holdEffectParam;
|
||||
battlerHoldEffect = gEnigmaBerries[battler].holdEffect;
|
||||
battlerHoldEffectParam = gEnigmaBerries[battler].holdEffectParam;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3306,39 +3306,39 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
switch (battlerHoldEffect)
|
||||
{
|
||||
case HOLD_EFFECT_DOUBLE_PRIZE:
|
||||
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
|
||||
if (GetBattlerSide(battler) == B_SIDE_PLAYER)
|
||||
gBattleStruct->moneyMultiplier = 2;
|
||||
break;
|
||||
case HOLD_EFFECT_RESTORE_STATS:
|
||||
for (i = 0; i < NUM_BATTLE_STATS; i++)
|
||||
{
|
||||
if (gBattleMons[battlerId].statStages[i] < DEFAULT_STAT_STAGE)
|
||||
if (gBattleMons[battler].statStages[i] < DEFAULT_STAT_STAGE)
|
||||
{
|
||||
gBattleMons[battlerId].statStages[i] = DEFAULT_STAT_STAGE;
|
||||
gBattleMons[battler].statStages[i] = DEFAULT_STAT_STAGE;
|
||||
effect = ITEM_STATS_CHANGE;
|
||||
}
|
||||
}
|
||||
if (effect != 0)
|
||||
{
|
||||
gBattleScripting.battler = battlerId;
|
||||
gPotentialItemEffectBattler = battlerId;
|
||||
gActiveBattler = gBattlerAttacker = battlerId;
|
||||
gBattleScripting.battler = battler;
|
||||
gPotentialItemEffectBattler = battler;
|
||||
gActiveBattler = gBattlerAttacker = battler;
|
||||
BattleScriptExecute(BattleScript_WhiteHerbEnd2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ITEMEFFECT_NORMAL:
|
||||
if (gBattleMons[battlerId].hp)
|
||||
if (gBattleMons[battler].hp)
|
||||
{
|
||||
switch (battlerHoldEffect)
|
||||
{
|
||||
case HOLD_EFFECT_RESTORE_HP:
|
||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / 2 && !moveTurn)
|
||||
if (gBattleMons[battler].hp <= gBattleMons[battler].maxHP / 2 && !moveTurn)
|
||||
{
|
||||
gBattleMoveDamage = battlerHoldEffectParam;
|
||||
if (gBattleMons[battlerId].hp + battlerHoldEffectParam > gBattleMons[battlerId].maxHP)
|
||||
gBattleMoveDamage = gBattleMons[battlerId].maxHP - gBattleMons[battlerId].hp;
|
||||
if (gBattleMons[battler].hp + battlerHoldEffectParam > gBattleMons[battler].maxHP)
|
||||
gBattleMoveDamage = gBattleMons[battler].maxHP - gBattleMons[battler].hp;
|
||||
gBattleMoveDamage *= -1;
|
||||
BattleScriptExecute(BattleScript_ItemHealHP_RemoveItem);
|
||||
effect = ITEM_HP_CHANGE;
|
||||
@@ -3351,10 +3351,10 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
u8 ppBonuses;
|
||||
u16 move;
|
||||
|
||||
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
|
||||
mon = &gPlayerParty[gBattlerPartyIndexes[battlerId]];
|
||||
if (GetBattlerSide(battler) == B_SIDE_PLAYER)
|
||||
mon = &gPlayerParty[gBattlerPartyIndexes[battler]];
|
||||
else
|
||||
mon = &gEnemyParty[gBattlerPartyIndexes[battlerId]];
|
||||
mon = &gEnemyParty[gBattlerPartyIndexes[battler]];
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
move = GetMonData(mon, MON_DATA_MOVE1 + i);
|
||||
@@ -3383,32 +3383,32 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
case HOLD_EFFECT_RESTORE_STATS:
|
||||
for (i = 0; i < NUM_BATTLE_STATS; i++)
|
||||
{
|
||||
if (gBattleMons[battlerId].statStages[i] < DEFAULT_STAT_STAGE)
|
||||
if (gBattleMons[battler].statStages[i] < DEFAULT_STAT_STAGE)
|
||||
{
|
||||
gBattleMons[battlerId].statStages[i] = DEFAULT_STAT_STAGE;
|
||||
gBattleMons[battler].statStages[i] = DEFAULT_STAT_STAGE;
|
||||
effect = ITEM_STATS_CHANGE;
|
||||
}
|
||||
}
|
||||
if (effect != 0)
|
||||
{
|
||||
gBattleScripting.battler = battlerId;
|
||||
gPotentialItemEffectBattler = battlerId;
|
||||
gActiveBattler = gBattlerAttacker = battlerId;
|
||||
gBattleScripting.battler = battler;
|
||||
gPotentialItemEffectBattler = battler;
|
||||
gActiveBattler = gBattlerAttacker = battler;
|
||||
BattleScriptExecute(BattleScript_WhiteHerbEnd2);
|
||||
}
|
||||
break;
|
||||
case HOLD_EFFECT_LEFTOVERS:
|
||||
if (gBattleMons[battlerId].hp < gBattleMons[battlerId].maxHP && !moveTurn)
|
||||
if (gBattleMons[battler].hp < gBattleMons[battler].maxHP && !moveTurn)
|
||||
{
|
||||
gBattleMoveDamage = gBattleMons[battlerId].maxHP / 16;
|
||||
gBattleMoveDamage = gBattleMons[battler].maxHP / 16;
|
||||
if (gBattleMoveDamage == 0)
|
||||
gBattleMoveDamage = 1;
|
||||
if (gBattleMons[battlerId].hp + gBattleMoveDamage > gBattleMons[battlerId].maxHP)
|
||||
gBattleMoveDamage = gBattleMons[battlerId].maxHP - gBattleMons[battlerId].hp;
|
||||
if (gBattleMons[battler].hp + gBattleMoveDamage > gBattleMons[battler].maxHP)
|
||||
gBattleMoveDamage = gBattleMons[battler].maxHP - gBattleMons[battler].hp;
|
||||
gBattleMoveDamage *= -1;
|
||||
BattleScriptExecute(BattleScript_ItemHealHP_End2);
|
||||
effect = ITEM_HP_CHANGE;
|
||||
RecordItemEffectBattle(battlerId, battlerHoldEffect);
|
||||
RecordItemEffectBattle(battler, battlerHoldEffect);
|
||||
}
|
||||
break;
|
||||
case HOLD_EFFECT_CONFUSE_SPICY:
|
||||
@@ -3427,12 +3427,12 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
TRY_EAT_CONFUSE_BERRY(FLAVOR_SOUR);
|
||||
break;
|
||||
case HOLD_EFFECT_ATTACK_UP:
|
||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam
|
||||
&& !moveTurn && gBattleMons[battlerId].statStages[STAT_ATK] < MAX_STAT_STAGE)
|
||||
if (gBattleMons[battler].hp <= gBattleMons[battler].maxHP / battlerHoldEffectParam
|
||||
&& !moveTurn && gBattleMons[battler].statStages[STAT_ATK] < MAX_STAT_STAGE)
|
||||
{
|
||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_ATK);
|
||||
PREPARE_STRING_BUFFER(gBattleTextBuff2, STRINGID_STATROSE); // Only the Attack stat-up berry has this
|
||||
gEffectBattler = battlerId;
|
||||
gEffectBattler = battler;
|
||||
SET_STATCHANGER(STAT_ATK, 1, FALSE);
|
||||
gBattleScripting.animArg1 = STAT_ANIM_PLUS1 + STAT_ATK;
|
||||
gBattleScripting.animArg2 = 0;
|
||||
@@ -3453,20 +3453,20 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
TRY_EAT_STAT_UP_BERRY(STAT_SPDEF);
|
||||
break;
|
||||
case HOLD_EFFECT_CRITICAL_UP:
|
||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn
|
||||
&& !(gBattleMons[battlerId].status2 & STATUS2_FOCUS_ENERGY))
|
||||
if (gBattleMons[battler].hp <= gBattleMons[battler].maxHP / battlerHoldEffectParam && !moveTurn
|
||||
&& !(gBattleMons[battler].status2 & STATUS2_FOCUS_ENERGY))
|
||||
{
|
||||
gBattleMons[battlerId].status2 |= STATUS2_FOCUS_ENERGY;
|
||||
gBattleMons[battler].status2 |= STATUS2_FOCUS_ENERGY;
|
||||
BattleScriptExecute(BattleScript_BerryFocusEnergyEnd2);
|
||||
effect = ITEM_EFFECT_OTHER;
|
||||
}
|
||||
break;
|
||||
case HOLD_EFFECT_RANDOM_STAT_UP:
|
||||
if (!moveTurn && gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam)
|
||||
if (!moveTurn && gBattleMons[battler].hp <= gBattleMons[battler].maxHP / battlerHoldEffectParam)
|
||||
{
|
||||
for (i = 0; i < NUM_STATS - 1; i++)
|
||||
{
|
||||
if (gBattleMons[battlerId].statStages[STAT_ATK + i] < MAX_STAT_STAGE)
|
||||
if (gBattleMons[battler].statStages[STAT_ATK + i] < MAX_STAT_STAGE)
|
||||
break;
|
||||
}
|
||||
if (i != NUM_STATS - 1)
|
||||
@@ -3474,7 +3474,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
do
|
||||
{
|
||||
i = Random() % (NUM_STATS - 1);
|
||||
} while (gBattleMons[battlerId].statStages[STAT_ATK + i] == MAX_STAT_STAGE);
|
||||
} while (gBattleMons[battler].statStages[STAT_ATK + i] == MAX_STAT_STAGE);
|
||||
|
||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, i + 1);
|
||||
|
||||
@@ -3487,7 +3487,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
gBattleTextBuff2[6] = STRINGID_STATROSE >> 8;
|
||||
gBattleTextBuff2[7] = EOS;
|
||||
|
||||
gEffectBattler = battlerId;
|
||||
gEffectBattler = battler;
|
||||
SET_STATCHANGER(i + 1, 2, FALSE);
|
||||
gBattleScripting.animArg1 = STAT_ANIM_PLUS2 + (i + 1);
|
||||
gBattleScripting.animArg2 = 0;
|
||||
@@ -3497,85 +3497,85 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
}
|
||||
break;
|
||||
case HOLD_EFFECT_CURE_PAR:
|
||||
if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS)
|
||||
if (gBattleMons[battler].status1 & STATUS1_PARALYSIS)
|
||||
{
|
||||
gBattleMons[battlerId].status1 &= ~STATUS1_PARALYSIS;
|
||||
gBattleMons[battler].status1 &= ~STATUS1_PARALYSIS;
|
||||
BattleScriptExecute(BattleScript_BerryCurePrlzEnd2);
|
||||
effect = ITEM_STATUS_CHANGE;
|
||||
}
|
||||
break;
|
||||
case HOLD_EFFECT_CURE_PSN:
|
||||
if (gBattleMons[battlerId].status1 & STATUS1_PSN_ANY)
|
||||
if (gBattleMons[battler].status1 & STATUS1_PSN_ANY)
|
||||
{
|
||||
gBattleMons[battlerId].status1 &= ~(STATUS1_PSN_ANY | STATUS1_TOXIC_COUNTER);
|
||||
gBattleMons[battler].status1 &= ~(STATUS1_PSN_ANY | STATUS1_TOXIC_COUNTER);
|
||||
BattleScriptExecute(BattleScript_BerryCurePsnEnd2);
|
||||
effect = ITEM_STATUS_CHANGE;
|
||||
}
|
||||
break;
|
||||
case HOLD_EFFECT_CURE_BRN:
|
||||
if (gBattleMons[battlerId].status1 & STATUS1_BURN)
|
||||
if (gBattleMons[battler].status1 & STATUS1_BURN)
|
||||
{
|
||||
gBattleMons[battlerId].status1 &= ~STATUS1_BURN;
|
||||
gBattleMons[battler].status1 &= ~STATUS1_BURN;
|
||||
BattleScriptExecute(BattleScript_BerryCureBrnEnd2);
|
||||
effect = ITEM_STATUS_CHANGE;
|
||||
}
|
||||
break;
|
||||
case HOLD_EFFECT_CURE_FRZ:
|
||||
if (gBattleMons[battlerId].status1 & STATUS1_FREEZE)
|
||||
if (gBattleMons[battler].status1 & STATUS1_FREEZE)
|
||||
{
|
||||
gBattleMons[battlerId].status1 &= ~STATUS1_FREEZE;
|
||||
gBattleMons[battler].status1 &= ~STATUS1_FREEZE;
|
||||
BattleScriptExecute(BattleScript_BerryCureFrzEnd2);
|
||||
effect = ITEM_STATUS_CHANGE;
|
||||
}
|
||||
break;
|
||||
case HOLD_EFFECT_CURE_SLP:
|
||||
if (gBattleMons[battlerId].status1 & STATUS1_SLEEP)
|
||||
if (gBattleMons[battler].status1 & STATUS1_SLEEP)
|
||||
{
|
||||
gBattleMons[battlerId].status1 &= ~STATUS1_SLEEP;
|
||||
gBattleMons[battlerId].status2 &= ~STATUS2_NIGHTMARE;
|
||||
gBattleMons[battler].status1 &= ~STATUS1_SLEEP;
|
||||
gBattleMons[battler].status2 &= ~STATUS2_NIGHTMARE;
|
||||
BattleScriptExecute(BattleScript_BerryCureSlpEnd2);
|
||||
effect = ITEM_STATUS_CHANGE;
|
||||
}
|
||||
break;
|
||||
case HOLD_EFFECT_CURE_CONFUSION:
|
||||
if (gBattleMons[battlerId].status2 & STATUS2_CONFUSION)
|
||||
if (gBattleMons[battler].status2 & STATUS2_CONFUSION)
|
||||
{
|
||||
gBattleMons[battlerId].status2 &= ~STATUS2_CONFUSION;
|
||||
gBattleMons[battler].status2 &= ~STATUS2_CONFUSION;
|
||||
BattleScriptExecute(BattleScript_BerryCureConfusionEnd2);
|
||||
effect = ITEM_EFFECT_OTHER;
|
||||
}
|
||||
break;
|
||||
case HOLD_EFFECT_CURE_STATUS:
|
||||
if (gBattleMons[battlerId].status1 & STATUS1_ANY || gBattleMons[battlerId].status2 & STATUS2_CONFUSION)
|
||||
if (gBattleMons[battler].status1 & STATUS1_ANY || gBattleMons[battler].status2 & STATUS2_CONFUSION)
|
||||
{
|
||||
i = 0;
|
||||
if (gBattleMons[battlerId].status1 & STATUS1_PSN_ANY)
|
||||
if (gBattleMons[battler].status1 & STATUS1_PSN_ANY)
|
||||
{
|
||||
StringCopy(gBattleTextBuff1, gStatusConditionString_PoisonJpn);
|
||||
i++;
|
||||
}
|
||||
if (gBattleMons[battlerId].status1 & STATUS1_SLEEP)
|
||||
if (gBattleMons[battler].status1 & STATUS1_SLEEP)
|
||||
{
|
||||
gBattleMons[battlerId].status2 &= ~STATUS2_NIGHTMARE;
|
||||
gBattleMons[battler].status2 &= ~STATUS2_NIGHTMARE;
|
||||
StringCopy(gBattleTextBuff1, gStatusConditionString_SleepJpn);
|
||||
i++;
|
||||
}
|
||||
if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS)
|
||||
if (gBattleMons[battler].status1 & STATUS1_PARALYSIS)
|
||||
{
|
||||
StringCopy(gBattleTextBuff1, gStatusConditionString_ParalysisJpn);
|
||||
i++;
|
||||
}
|
||||
if (gBattleMons[battlerId].status1 & STATUS1_BURN)
|
||||
if (gBattleMons[battler].status1 & STATUS1_BURN)
|
||||
{
|
||||
StringCopy(gBattleTextBuff1, gStatusConditionString_BurnJpn);
|
||||
i++;
|
||||
}
|
||||
if (gBattleMons[battlerId].status1 & STATUS1_FREEZE)
|
||||
if (gBattleMons[battler].status1 & STATUS1_FREEZE)
|
||||
{
|
||||
StringCopy(gBattleTextBuff1, gStatusConditionString_IceJpn);
|
||||
i++;
|
||||
}
|
||||
if (gBattleMons[battlerId].status2 & STATUS2_CONFUSION)
|
||||
if (gBattleMons[battler].status2 & STATUS2_CONFUSION)
|
||||
{
|
||||
StringCopy(gBattleTextBuff1, gStatusConditionString_ConfusionJpn);
|
||||
i++;
|
||||
@@ -3584,16 +3584,16 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_CURED_PROBLEM;
|
||||
else
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_NORMALIZED_STATUS;
|
||||
gBattleMons[battlerId].status1 = 0;
|
||||
gBattleMons[battlerId].status2 &= ~STATUS2_CONFUSION;
|
||||
gBattleMons[battler].status1 = 0;
|
||||
gBattleMons[battler].status2 &= ~STATUS2_CONFUSION;
|
||||
BattleScriptExecute(BattleScript_BerryCureChosenStatusEnd2);
|
||||
effect = ITEM_STATUS_CHANGE;
|
||||
}
|
||||
break;
|
||||
case HOLD_EFFECT_CURE_ATTRACT:
|
||||
if (gBattleMons[battlerId].status2 & STATUS2_INFATUATION)
|
||||
if (gBattleMons[battler].status2 & STATUS2_INFATUATION)
|
||||
{
|
||||
gBattleMons[battlerId].status2 &= ~STATUS2_INFATUATION;
|
||||
gBattleMons[battler].status2 &= ~STATUS2_INFATUATION;
|
||||
StringCopy(gBattleTextBuff1, gStatusConditionString_LoveJpn);
|
||||
BattleScriptExecute(BattleScript_BerryCureChosenStatusEnd2);
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_CURED_PROBLEM;
|
||||
@@ -3603,18 +3603,18 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
}
|
||||
if (effect != 0)
|
||||
{
|
||||
gBattleScripting.battler = battlerId;
|
||||
gPotentialItemEffectBattler = battlerId;
|
||||
gActiveBattler = gBattlerAttacker = battlerId;
|
||||
gBattleScripting.battler = battler;
|
||||
gPotentialItemEffectBattler = battler;
|
||||
gActiveBattler = gBattlerAttacker = battler;
|
||||
switch (effect)
|
||||
{
|
||||
case ITEM_STATUS_CHANGE:
|
||||
BtlController_EmitSetMonData(B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battlerId].status1);
|
||||
BtlController_EmitSetMonData(B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
break;
|
||||
case ITEM_PP_CHANGE:
|
||||
if (MOVE_IS_PERMANENT(battlerId, i))
|
||||
gBattleMons[battlerId].pp[i] = changedPP;
|
||||
if (MOVE_IS_PERMANENT(battler, i))
|
||||
gBattleMons[battler].pp[i] = changedPP;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -3623,13 +3623,13 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
case ITEMEFFECT_DUMMY:
|
||||
break;
|
||||
case ITEMEFFECT_MOVE_END:
|
||||
for (battlerId = 0; battlerId < gBattlersCount; battlerId++)
|
||||
for (battler = 0; battler < gBattlersCount; battler++)
|
||||
{
|
||||
gLastUsedItem = gBattleMons[battlerId].item;
|
||||
if (gBattleMons[battlerId].item == ITEM_ENIGMA_BERRY)
|
||||
gLastUsedItem = gBattleMons[battler].item;
|
||||
if (gBattleMons[battler].item == ITEM_ENIGMA_BERRY)
|
||||
{
|
||||
battlerHoldEffect = gEnigmaBerries[battlerId].holdEffect;
|
||||
battlerHoldEffectParam = gEnigmaBerries[battlerId].holdEffectParam;
|
||||
battlerHoldEffect = gEnigmaBerries[battler].holdEffect;
|
||||
battlerHoldEffectParam = gEnigmaBerries[battler].holdEffectParam;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3639,64 +3639,64 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
switch (battlerHoldEffect)
|
||||
{
|
||||
case HOLD_EFFECT_CURE_PAR:
|
||||
if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS)
|
||||
if (gBattleMons[battler].status1 & STATUS1_PARALYSIS)
|
||||
{
|
||||
gBattleMons[battlerId].status1 &= ~STATUS1_PARALYSIS;
|
||||
gBattleMons[battler].status1 &= ~STATUS1_PARALYSIS;
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_BerryCureParRet;
|
||||
effect = ITEM_STATUS_CHANGE;
|
||||
}
|
||||
break;
|
||||
case HOLD_EFFECT_CURE_PSN:
|
||||
if (gBattleMons[battlerId].status1 & STATUS1_PSN_ANY)
|
||||
if (gBattleMons[battler].status1 & STATUS1_PSN_ANY)
|
||||
{
|
||||
gBattleMons[battlerId].status1 &= ~(STATUS1_PSN_ANY | STATUS1_TOXIC_COUNTER);
|
||||
gBattleMons[battler].status1 &= ~(STATUS1_PSN_ANY | STATUS1_TOXIC_COUNTER);
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_BerryCurePsnRet;
|
||||
effect = ITEM_STATUS_CHANGE;
|
||||
}
|
||||
break;
|
||||
case HOLD_EFFECT_CURE_BRN:
|
||||
if (gBattleMons[battlerId].status1 & STATUS1_BURN)
|
||||
if (gBattleMons[battler].status1 & STATUS1_BURN)
|
||||
{
|
||||
gBattleMons[battlerId].status1 &= ~STATUS1_BURN;
|
||||
gBattleMons[battler].status1 &= ~STATUS1_BURN;
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_BerryCureBrnRet;
|
||||
effect = ITEM_STATUS_CHANGE;
|
||||
}
|
||||
break;
|
||||
case HOLD_EFFECT_CURE_FRZ:
|
||||
if (gBattleMons[battlerId].status1 & STATUS1_FREEZE)
|
||||
if (gBattleMons[battler].status1 & STATUS1_FREEZE)
|
||||
{
|
||||
gBattleMons[battlerId].status1 &= ~STATUS1_FREEZE;
|
||||
gBattleMons[battler].status1 &= ~STATUS1_FREEZE;
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_BerryCureFrzRet;
|
||||
effect = ITEM_STATUS_CHANGE;
|
||||
}
|
||||
break;
|
||||
case HOLD_EFFECT_CURE_SLP:
|
||||
if (gBattleMons[battlerId].status1 & STATUS1_SLEEP)
|
||||
if (gBattleMons[battler].status1 & STATUS1_SLEEP)
|
||||
{
|
||||
gBattleMons[battlerId].status1 &= ~STATUS1_SLEEP;
|
||||
gBattleMons[battlerId].status2 &= ~STATUS2_NIGHTMARE;
|
||||
gBattleMons[battler].status1 &= ~STATUS1_SLEEP;
|
||||
gBattleMons[battler].status2 &= ~STATUS2_NIGHTMARE;
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_BerryCureSlpRet;
|
||||
effect = ITEM_STATUS_CHANGE;
|
||||
}
|
||||
break;
|
||||
case HOLD_EFFECT_CURE_CONFUSION:
|
||||
if (gBattleMons[battlerId].status2 & STATUS2_CONFUSION)
|
||||
if (gBattleMons[battler].status2 & STATUS2_CONFUSION)
|
||||
{
|
||||
gBattleMons[battlerId].status2 &= ~STATUS2_CONFUSION;
|
||||
gBattleMons[battler].status2 &= ~STATUS2_CONFUSION;
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_BerryCureConfusionRet;
|
||||
effect = ITEM_EFFECT_OTHER;
|
||||
}
|
||||
break;
|
||||
case HOLD_EFFECT_CURE_ATTRACT:
|
||||
if (gBattleMons[battlerId].status2 & STATUS2_INFATUATION)
|
||||
if (gBattleMons[battler].status2 & STATUS2_INFATUATION)
|
||||
{
|
||||
gBattleMons[battlerId].status2 &= ~STATUS2_INFATUATION;
|
||||
gBattleMons[battler].status2 &= ~STATUS2_INFATUATION;
|
||||
StringCopy(gBattleTextBuff1, gStatusConditionString_LoveJpn);
|
||||
BattleScriptPushCursor();
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_CURED_PROBLEM;
|
||||
@@ -3705,31 +3705,31 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
}
|
||||
break;
|
||||
case HOLD_EFFECT_CURE_STATUS:
|
||||
if (gBattleMons[battlerId].status1 & STATUS1_ANY || gBattleMons[battlerId].status2 & STATUS2_CONFUSION)
|
||||
if (gBattleMons[battler].status1 & STATUS1_ANY || gBattleMons[battler].status2 & STATUS2_CONFUSION)
|
||||
{
|
||||
if (gBattleMons[battlerId].status1 & STATUS1_PSN_ANY)
|
||||
if (gBattleMons[battler].status1 & STATUS1_PSN_ANY)
|
||||
StringCopy(gBattleTextBuff1, gStatusConditionString_PoisonJpn);
|
||||
|
||||
if (gBattleMons[battlerId].status1 & STATUS1_SLEEP)
|
||||
if (gBattleMons[battler].status1 & STATUS1_SLEEP)
|
||||
{
|
||||
gBattleMons[battlerId].status2 &= ~STATUS2_NIGHTMARE;
|
||||
gBattleMons[battler].status2 &= ~STATUS2_NIGHTMARE;
|
||||
StringCopy(gBattleTextBuff1, gStatusConditionString_SleepJpn);
|
||||
}
|
||||
|
||||
if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS)
|
||||
if (gBattleMons[battler].status1 & STATUS1_PARALYSIS)
|
||||
StringCopy(gBattleTextBuff1, gStatusConditionString_ParalysisJpn);
|
||||
|
||||
if (gBattleMons[battlerId].status1 & STATUS1_BURN)
|
||||
if (gBattleMons[battler].status1 & STATUS1_BURN)
|
||||
StringCopy(gBattleTextBuff1, gStatusConditionString_BurnJpn);
|
||||
|
||||
if (gBattleMons[battlerId].status1 & STATUS1_FREEZE)
|
||||
if (gBattleMons[battler].status1 & STATUS1_FREEZE)
|
||||
StringCopy(gBattleTextBuff1, gStatusConditionString_IceJpn);
|
||||
|
||||
if (gBattleMons[battlerId].status2 & STATUS2_CONFUSION)
|
||||
if (gBattleMons[battler].status2 & STATUS2_CONFUSION)
|
||||
StringCopy(gBattleTextBuff1, gStatusConditionString_ConfusionJpn);
|
||||
|
||||
gBattleMons[battlerId].status1 = 0;
|
||||
gBattleMons[battlerId].status2 &= ~STATUS2_CONFUSION;
|
||||
gBattleMons[battler].status1 = 0;
|
||||
gBattleMons[battler].status2 &= ~STATUS2_CONFUSION;
|
||||
BattleScriptPushCursor();
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_CURED_PROBLEM;
|
||||
gBattlescriptCurrInstr = BattleScript_BerryCureChosenStatusRet;
|
||||
@@ -3739,16 +3739,16 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
case HOLD_EFFECT_RESTORE_STATS:
|
||||
for (i = 0; i < NUM_BATTLE_STATS; i++)
|
||||
{
|
||||
if (gBattleMons[battlerId].statStages[i] < DEFAULT_STAT_STAGE)
|
||||
if (gBattleMons[battler].statStages[i] < DEFAULT_STAT_STAGE)
|
||||
{
|
||||
gBattleMons[battlerId].statStages[i] = DEFAULT_STAT_STAGE;
|
||||
gBattleMons[battler].statStages[i] = DEFAULT_STAT_STAGE;
|
||||
effect = ITEM_STATS_CHANGE;
|
||||
}
|
||||
}
|
||||
if (effect != 0)
|
||||
{
|
||||
gBattleScripting.battler = battlerId;
|
||||
gPotentialItemEffectBattler = battlerId;
|
||||
gBattleScripting.battler = battler;
|
||||
gPotentialItemEffectBattler = battler;
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_WhiteHerbRet;
|
||||
return effect;
|
||||
@@ -3757,9 +3757,9 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
}
|
||||
if (effect != 0)
|
||||
{
|
||||
gBattleScripting.battler = battlerId;
|
||||
gPotentialItemEffectBattler = battlerId;
|
||||
gActiveBattler = battlerId;
|
||||
gBattleScripting.battler = battler;
|
||||
gPotentialItemEffectBattler = battler;
|
||||
gActiveBattler = battler;
|
||||
BtlController_EmitSetMonData(B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
break;
|
||||
@@ -3812,11 +3812,11 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
return effect;
|
||||
}
|
||||
|
||||
void ClearFuryCutterDestinyBondGrudge(u8 battlerId)
|
||||
void ClearFuryCutterDestinyBondGrudge(u8 battler)
|
||||
{
|
||||
gDisableStructs[battlerId].furyCutterCounter = 0;
|
||||
gBattleMons[battlerId].status2 &= ~STATUS2_DESTINY_BOND;
|
||||
gStatuses3[battlerId] &= ~STATUS3_GRUDGE;
|
||||
gDisableStructs[battler].furyCutterCounter = 0;
|
||||
gBattleMons[battler].status2 &= ~STATUS2_DESTINY_BOND;
|
||||
gStatuses3[battler] &= ~STATUS3_GRUDGE;
|
||||
}
|
||||
|
||||
void HandleAction_RunBattleScript(void) // identical to RunBattleScriptCommands
|
||||
@@ -3910,14 +3910,14 @@ u8 GetMoveTarget(u16 move, u8 setTarget)
|
||||
return targetBattler;
|
||||
}
|
||||
|
||||
static bool32 IsBattlerModernFatefulEncounter(u8 battlerId)
|
||||
static bool32 IsBattlerModernFatefulEncounter(u8 battler)
|
||||
{
|
||||
if (GetBattlerSide(battlerId) == B_SIDE_OPPONENT)
|
||||
if (GetBattlerSide(battler) == B_SIDE_OPPONENT)
|
||||
return TRUE;
|
||||
if (GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES, NULL) != SPECIES_DEOXYS
|
||||
&& GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES, NULL) != SPECIES_MEW)
|
||||
if (GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES, NULL) != SPECIES_DEOXYS
|
||||
&& GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES, NULL) != SPECIES_MEW)
|
||||
return TRUE;
|
||||
return GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_MODERN_FATEFUL_ENCOUNTER, NULL);
|
||||
return GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_MODERN_FATEFUL_ENCOUNTER, NULL);
|
||||
}
|
||||
|
||||
u8 IsMonDisobedient(void)
|
||||
|
||||
Reference in New Issue
Block a user