Fix Defiant stat raise by allies

This commit is contained in:
DizzyEggg 2019-03-23 17:21:14 +01:00
parent d1fb5fa148
commit 7018745230
3 changed files with 7 additions and 3 deletions

View File

@ -226,6 +226,7 @@ struct SpecialStatus
s32 specialDmg;
u8 physicalBattlerId;
u8 specialBattlerId;
u8 changedStatsBattlerId; // Battler that was responsible for the latest stat change. Can be self.
};
struct SideTimer

View File

@ -7808,6 +7808,8 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr
else
gActiveBattler = gBattlerTarget;
gSpecialStatuses[gActiveBattler].changedStatsBattlerId = gBattlerAttacker;
flags &= ~(MOVE_EFFECT_AFFECTS_USER);
if (flags & MOVE_EFFECT_CERTAIN)

View File

@ -489,9 +489,10 @@ void PrepareStringBattle(u16 stringId, u8 battler)
stringId = STRINGID_STATSWONTDECREASE2;
// Check Defiant and Competitive stat raise whenever a stat is lowered.
else if (((GetBattlerAbility(gBattlerTarget) == ABILITY_DEFIANT && gBattleMons[gBattlerTarget].statStages[STAT_ATK] != 12)
|| (GetBattlerAbility(gBattlerTarget) == ABILITY_COMPETITIVE && gBattleMons[gBattlerTarget].statStages[STAT_SPATK] != 12))
&& stringId == STRINGID_PKMNSSTATCHANGED4)
else if (stringId == STRINGID_PKMNSSTATCHANGED4
&& ((GetBattlerAbility(gBattlerTarget) == ABILITY_DEFIANT && gBattleMons[gBattlerTarget].statStages[STAT_ATK] != 12)
|| (GetBattlerAbility(gBattlerTarget) == ABILITY_COMPETITIVE && gBattleMons[gBattlerTarget].statStages[STAT_SPATK] != 12))
&& gSpecialStatuses[gBattlerTarget].changedStatsBattlerId != BATTLE_PARTNER(gBattlerTarget))
{
gBattlerAbility = gBattlerTarget;
BattleScriptPushCursor();