Defiant and Competitive

This commit is contained in:
DizzyEggg 2019-02-16 12:54:11 +01:00
parent c0f47d67aa
commit c1f9032989
4 changed files with 29 additions and 4 deletions

View File

@ -5803,6 +5803,16 @@ BattleScript_DrizzleActivates::
call BattleScript_WeatherFormChanges
end3
BattleScript_DefiantActivates::
pause 0x20
call BattleScript_AbilityPopUp
statbuffchange 0, NULL
setgraphicalstatchangevalues
playanimation BS_ABILITY_BATTLER, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
printstring STRINGID_PKMNSSTATCHANGED2
waitmessage 0x40
return
BattleScript_AbilityPopUp:
showabilitypopup BS_ABILITY_BATTLER
recordability BS_ABILITY_BATTLER

View File

@ -295,5 +295,6 @@ extern const u8 BattleScript_MistySurgeActivates[];
extern const u8 BattleScript_ElectricSurgeActivates[];
extern const u8 BattleScript_SpectralThiefSteal[];
extern const u8 BattleScript_StatUpMsg[];
extern const u8 BattleScript_DefiantActivates[];
#endif // GUARD_BATTLE_SCRIPTS_H

View File

@ -1893,8 +1893,9 @@ static void atk10_printstring(void)
if (gBattleControllerExecFlags == 0)
{
u16 var = T2_READ_16(gBattlescriptCurrInstr + 1);
PrepareStringBattle(var, gBattlerAttacker);
gBattlescriptCurrInstr += 3;
PrepareStringBattle(var, gBattlerAttacker);
gBattleCommunication[MSG_DISPLAY] = 1;
}
}
@ -1938,9 +1939,8 @@ static void atk13_printfromtable(void)
const u16 *ptr = (const u16*) T1_READ_PTR(gBattlescriptCurrInstr + 1);
ptr += gBattleCommunication[MULTISTRING_CHOOSER];
PrepareStringBattle(*ptr, gBattlerAttacker);
gBattlescriptCurrInstr += 5;
PrepareStringBattle(*ptr, gBattlerAttacker);
gBattleCommunication[MSG_DISPLAY] = 1;
}
}

View File

@ -483,11 +483,25 @@ void PrepareStringBattle(u16 stringId, u8 battler)
else if (stringId == STRINGID_STATSWONTINCREASE && gBattleScripting.statChanger & STAT_BUFF_NEGATIVE)
stringId = STRINGID_STATSWONTDECREASE;
if (stringId == STRINGID_STATSWONTDECREASE2 && GetBattlerAbility(battler) == ABILITY_CONTRARY)
else if (stringId == STRINGID_STATSWONTDECREASE2 && GetBattlerAbility(battler) == ABILITY_CONTRARY)
stringId = STRINGID_STATSWONTINCREASE2;
else if (stringId == STRINGID_STATSWONTINCREASE2 && GetBattlerAbility(battler) == ABILITY_CONTRARY)
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)
{
gBattlerAbility = gBattlerTarget;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_DefiantActivates;
if (GetBattlerAbility(gBattlerTarget) == ABILITY_DEFIANT)
SET_STATCHANGER(STAT_ATK, 2, FALSE);
else
SET_STATCHANGER(STAT_SPATK, 2, FALSE);
}
gActiveBattler = battler;
BtlController_EmitPrintString(0, stringId);
MarkBattlerForControllerExec(gActiveBattler);