Further cleaning after comparing with pokefirered
STAT_BUFF changed to STAT_CHANGE, as it also uses debuffs
This commit is contained in:
@@ -961,7 +961,7 @@ static void Cmd_attackcanceler(void)
|
||||
if (gProtectStructs[gBattlerTarget].bounceMove && gBattleMoves[gCurrentMove].flags & FLAG_MAGIC_COAT_AFFECTED)
|
||||
{
|
||||
PressurePPLose(gBattlerAttacker, gBattlerTarget, MOVE_MAGIC_COAT);
|
||||
gProtectStructs[gBattlerTarget].bounceMove = 0;
|
||||
gProtectStructs[gBattlerTarget].bounceMove = FALSE;
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_MagicCoatBounce;
|
||||
return;
|
||||
@@ -972,7 +972,7 @@ static void Cmd_attackcanceler(void)
|
||||
if ((gProtectStructs[gBattlerByTurnOrder[i]].stealMove) && gBattleMoves[gCurrentMove].flags & FLAG_SNATCH_AFFECTED)
|
||||
{
|
||||
PressurePPLose(gBattlerAttacker, gBattlerByTurnOrder[i], MOVE_SNATCH);
|
||||
gProtectStructs[gBattlerByTurnOrder[i]].stealMove = 0;
|
||||
gProtectStructs[gBattlerByTurnOrder[i]].stealMove = FALSE;
|
||||
gBattleScripting.battler = gBattlerByTurnOrder[i];
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_SnatchedMove;
|
||||
@@ -982,7 +982,7 @@ static void Cmd_attackcanceler(void)
|
||||
|
||||
if (gSpecialStatuses[gBattlerTarget].lightningRodRedirected)
|
||||
{
|
||||
gSpecialStatuses[gBattlerTarget].lightningRodRedirected = 0;
|
||||
gSpecialStatuses[gBattlerTarget].lightningRodRedirected = FALSE;
|
||||
gLastUsedAbility = ABILITY_LIGHTNING_ROD;
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_TookAttack;
|
||||
@@ -2754,7 +2754,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
|
||||
{
|
||||
u16* changedItem = &gBattleStruct->changedItems[gBattlerAttacker];
|
||||
gLastUsedItem = *changedItem = gBattleMons[gBattlerTarget].item;
|
||||
gBattleMons[gBattlerTarget].item = 0;
|
||||
gBattleMons[gBattlerTarget].item = ITEM_NONE;
|
||||
|
||||
gActiveBattler = gBattlerAttacker;
|
||||
BtlController_EmitSetMonData(BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gLastUsedItem), &gLastUsedItem);
|
||||
@@ -2851,7 +2851,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
|
||||
side = GetBattlerSide(gEffectBattler);
|
||||
|
||||
gLastUsedItem = gBattleMons[gEffectBattler].item;
|
||||
gBattleMons[gEffectBattler].item = 0;
|
||||
gBattleMons[gEffectBattler].item = ITEM_NONE;
|
||||
gWishFutureKnock.knockedOffMons[side] |= gBitTable[gBattlerPartyIndexes[gEffectBattler]];
|
||||
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||
@@ -3055,7 +3055,7 @@ static void Cmd_jumpifstatus(void)
|
||||
u32 flags = T2_READ_32(gBattlescriptCurrInstr + 2);
|
||||
const u8* jumpPtr = T2_READ_PTR(gBattlescriptCurrInstr + 6);
|
||||
|
||||
if (gBattleMons[battlerId].status1 & flags && gBattleMons[battlerId].hp)
|
||||
if (gBattleMons[battlerId].status1 & flags && gBattleMons[battlerId].hp != 0)
|
||||
gBattlescriptCurrInstr = jumpPtr;
|
||||
else
|
||||
gBattlescriptCurrInstr += 10;
|
||||
@@ -3067,7 +3067,7 @@ static void Cmd_jumpifstatus2(void)
|
||||
u32 flags = T2_READ_32(gBattlescriptCurrInstr + 2);
|
||||
const u8* jumpPtr = T2_READ_PTR(gBattlescriptCurrInstr + 6);
|
||||
|
||||
if (gBattleMons[battlerId].status2 & flags && gBattleMons[battlerId].hp)
|
||||
if (gBattleMons[battlerId].status2 & flags && gBattleMons[battlerId].hp != 0)
|
||||
gBattlescriptCurrInstr = jumpPtr;
|
||||
else
|
||||
gBattlescriptCurrInstr += 10;
|
||||
@@ -3322,7 +3322,9 @@ static void Cmd_getexp(void)
|
||||
else
|
||||
{
|
||||
// music change in wild battle after fainting a poke
|
||||
if (!(gBattleTypeFlags & BATTLE_TYPE_TRAINER) && gBattleMons[0].hp && !gBattleStruct->wildVictorySong)
|
||||
if (!(gBattleTypeFlags & BATTLE_TYPE_TRAINER)
|
||||
&& gBattleMons[0].hp
|
||||
&& !gBattleStruct->wildVictorySong)
|
||||
{
|
||||
BattleStopLowHpSound();
|
||||
PlayBGM(MUS_VICTORY_WILD);
|
||||
@@ -3488,8 +3490,8 @@ static void Cmd_getexp(void)
|
||||
if (gBattleControllerExecFlags == 0)
|
||||
{
|
||||
// not sure why gf clears the item and ability here
|
||||
gBattleMons[gBattlerFainted].item = 0;
|
||||
gBattleMons[gBattlerFainted].ability = 0;
|
||||
gBattleMons[gBattlerFainted].item = ITEM_NONE;
|
||||
gBattleMons[gBattlerFainted].ability = ABILITY_NONE;
|
||||
gBattlescriptCurrInstr += 2;
|
||||
}
|
||||
break;
|
||||
@@ -4609,7 +4611,7 @@ static void Cmd_switchindataupdate(void)
|
||||
i = GetBattlerSide(gActiveBattler);
|
||||
if (gWishFutureKnock.knockedOffMons[i] & gBitTable[gBattlerPartyIndexes[gActiveBattler]])
|
||||
{
|
||||
gBattleMons[gActiveBattler].item = 0;
|
||||
gBattleMons[gActiveBattler].item = ITEM_NONE;
|
||||
}
|
||||
|
||||
if (gBattleMoves[gCurrentMove].effect == EFFECT_BATON_PASS)
|
||||
@@ -5251,7 +5253,7 @@ static void Cmd_switchineffects(void)
|
||||
u32 hitmarkerFaintBits = gHitMarker >> 28;
|
||||
|
||||
gBattlerFainted++;
|
||||
while (1)
|
||||
while (TRUE)
|
||||
{
|
||||
if (hitmarkerFaintBits & gBitTable[gBattlerFainted] && !(gAbsentBattlerFlags & gBitTable[gBattlerFainted]))
|
||||
break;
|
||||
@@ -5872,7 +5874,7 @@ static void Cmd_removeitem(void)
|
||||
|
||||
usedHeldItem = &gBattleStruct->usedHeldItems[gActiveBattler];
|
||||
*usedHeldItem = gBattleMons[gActiveBattler].item;
|
||||
gBattleMons[gActiveBattler].item = 0;
|
||||
gBattleMons[gActiveBattler].item = ITEM_NONE;
|
||||
|
||||
BtlController_EmitSetMonData(BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[gActiveBattler].item), &gBattleMons[gActiveBattler].item);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
@@ -6895,8 +6897,8 @@ static void Cmd_negativedamage(void)
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
|
||||
#define STAT_BUFF_WORKED 0
|
||||
#define STAT_BUFF_DIDNT_WORK 1
|
||||
#define STAT_CHANGE_WORKED 0
|
||||
#define STAT_CHANGE_DIDNT_WORK 1
|
||||
|
||||
static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr)
|
||||
{
|
||||
@@ -6915,9 +6917,9 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr)
|
||||
certain++;
|
||||
flags &= ~MOVE_EFFECT_CERTAIN;
|
||||
|
||||
if (flags & STAT_BUFF_NOT_PROTECT_AFFECTED)
|
||||
if (flags & STAT_CHANGE_NOT_PROTECT_AFFECTED)
|
||||
notProtectAffected++;
|
||||
flags &= ~STAT_BUFF_NOT_PROTECT_AFFECTED;
|
||||
flags &= ~STAT_CHANGE_NOT_PROTECT_AFFECTED;
|
||||
|
||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, statId)
|
||||
|
||||
@@ -6926,7 +6928,7 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr)
|
||||
if (gSideTimers[GET_BATTLER_SIDE(gActiveBattler)].mistTimer
|
||||
&& !certain && gCurrentMove != MOVE_CURSE)
|
||||
{
|
||||
if (flags == STAT_BUFF_ALLOW_PTR)
|
||||
if (flags == STAT_CHANGE_ALLOW_PTR)
|
||||
{
|
||||
if (gSpecialStatuses[gActiveBattler].statLowered)
|
||||
{
|
||||
@@ -6940,19 +6942,19 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr)
|
||||
gSpecialStatuses[gActiveBattler].statLowered = 1;
|
||||
}
|
||||
}
|
||||
return STAT_BUFF_DIDNT_WORK;
|
||||
return STAT_CHANGE_DIDNT_WORK;
|
||||
}
|
||||
else if (gCurrentMove != MOVE_CURSE
|
||||
&& notProtectAffected != TRUE && JumpIfMoveAffectedByProtect(0))
|
||||
{
|
||||
gBattlescriptCurrInstr = BattleScript_ButItFailed;
|
||||
return STAT_BUFF_DIDNT_WORK;
|
||||
return STAT_CHANGE_DIDNT_WORK;
|
||||
}
|
||||
else if ((gBattleMons[gActiveBattler].ability == ABILITY_CLEAR_BODY
|
||||
|| gBattleMons[gActiveBattler].ability == ABILITY_WHITE_SMOKE)
|
||||
&& !certain && gCurrentMove != MOVE_CURSE)
|
||||
{
|
||||
if (flags == STAT_BUFF_ALLOW_PTR)
|
||||
if (flags == STAT_CHANGE_ALLOW_PTR)
|
||||
{
|
||||
if (gSpecialStatuses[gActiveBattler].statLowered)
|
||||
{
|
||||
@@ -6968,12 +6970,12 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr)
|
||||
gSpecialStatuses[gActiveBattler].statLowered = 1;
|
||||
}
|
||||
}
|
||||
return STAT_BUFF_DIDNT_WORK;
|
||||
return STAT_CHANGE_DIDNT_WORK;
|
||||
}
|
||||
else if (gBattleMons[gActiveBattler].ability == ABILITY_KEEN_EYE
|
||||
&& !certain && statId == STAT_ACC)
|
||||
{
|
||||
if (flags == STAT_BUFF_ALLOW_PTR)
|
||||
if (flags == STAT_CHANGE_ALLOW_PTR)
|
||||
{
|
||||
BattleScriptPush(BS_ptr);
|
||||
gBattleScripting.battler = gActiveBattler;
|
||||
@@ -6981,12 +6983,12 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr)
|
||||
gLastUsedAbility = gBattleMons[gActiveBattler].ability;
|
||||
RecordAbilityBattle(gActiveBattler, gLastUsedAbility);
|
||||
}
|
||||
return STAT_BUFF_DIDNT_WORK;
|
||||
return STAT_CHANGE_DIDNT_WORK;
|
||||
}
|
||||
else if (gBattleMons[gActiveBattler].ability == ABILITY_HYPER_CUTTER
|
||||
&& !certain && statId == STAT_ATK)
|
||||
{
|
||||
if (flags == STAT_BUFF_ALLOW_PTR)
|
||||
if (flags == STAT_CHANGE_ALLOW_PTR)
|
||||
{
|
||||
BattleScriptPush(BS_ptr);
|
||||
gBattleScripting.battler = gActiveBattler;
|
||||
@@ -6994,11 +6996,11 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr)
|
||||
gLastUsedAbility = gBattleMons[gActiveBattler].ability;
|
||||
RecordAbilityBattle(gActiveBattler, gLastUsedAbility);
|
||||
}
|
||||
return STAT_BUFF_DIDNT_WORK;
|
||||
return STAT_CHANGE_DIDNT_WORK;
|
||||
}
|
||||
else if (gBattleMons[gActiveBattler].ability == ABILITY_SHIELD_DUST && flags == 0)
|
||||
{
|
||||
return STAT_BUFF_DIDNT_WORK;
|
||||
return STAT_CHANGE_DIDNT_WORK;
|
||||
}
|
||||
else // try to decrease
|
||||
{
|
||||
@@ -7059,19 +7061,19 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr)
|
||||
if (gBattleMons[gActiveBattler].statStages[statId] > MAX_STAT_STAGE)
|
||||
gBattleMons[gActiveBattler].statStages[statId] = MAX_STAT_STAGE;
|
||||
|
||||
if (gBattleCommunication[MULTISTRING_CHOOSER] == B_MSG_STAT_WONT_INCREASE && flags & STAT_BUFF_ALLOW_PTR)
|
||||
if (gBattleCommunication[MULTISTRING_CHOOSER] == B_MSG_STAT_WONT_INCREASE && flags & STAT_CHANGE_ALLOW_PTR)
|
||||
gMoveResultFlags |= MOVE_RESULT_MISSED;
|
||||
|
||||
if (gBattleCommunication[MULTISTRING_CHOOSER] == B_MSG_STAT_WONT_INCREASE && !(flags & STAT_BUFF_ALLOW_PTR))
|
||||
return STAT_BUFF_DIDNT_WORK;
|
||||
if (gBattleCommunication[MULTISTRING_CHOOSER] == B_MSG_STAT_WONT_INCREASE && !(flags & STAT_CHANGE_ALLOW_PTR))
|
||||
return STAT_CHANGE_DIDNT_WORK;
|
||||
|
||||
return STAT_BUFF_WORKED;
|
||||
return STAT_CHANGE_WORKED;
|
||||
}
|
||||
|
||||
static void Cmd_statbuffchange(void)
|
||||
{
|
||||
const u8* jumpPtr = T1_READ_PTR(gBattlescriptCurrInstr + 2);
|
||||
if (ChangeStatBuffs(gBattleScripting.statChanger & 0xF0, GET_STAT_BUFF_ID(gBattleScripting.statChanger), gBattlescriptCurrInstr[1], jumpPtr) == STAT_BUFF_WORKED)
|
||||
if (ChangeStatBuffs(gBattleScripting.statChanger & 0xF0, GET_STAT_BUFF_ID(gBattleScripting.statChanger), gBattlescriptCurrInstr[1], jumpPtr) == STAT_CHANGE_WORKED)
|
||||
gBattlescriptCurrInstr += 6;
|
||||
}
|
||||
|
||||
@@ -7808,7 +7810,7 @@ static void Cmd_mimicattackcopy(void)
|
||||
|
||||
static void Cmd_metronome(void)
|
||||
{
|
||||
while (1)
|
||||
while (TRUE)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
@@ -7819,7 +7821,7 @@ static void Cmd_metronome(void)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++); // ?
|
||||
|
||||
i = -1;
|
||||
while (1)
|
||||
while (TRUE)
|
||||
{
|
||||
i++;
|
||||
if (sMovesForbiddenToCopy[i] == gCurrentMove)
|
||||
@@ -9433,7 +9435,7 @@ static void Cmd_trysetmagiccoat(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
gProtectStructs[gBattlerAttacker].bounceMove = 1;
|
||||
gProtectStructs[gBattlerAttacker].bounceMove = TRUE;
|
||||
gBattlescriptCurrInstr += 5;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user