From e11fa09632e87594b599455517bf7d3521758b65 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 2 Dec 2020 18:46:29 -0300 Subject: [PATCH] Implemented Intrepid Sword and Dauntless Shield and... -Renamed BattleScript_TargetAbilityStatRaise to BattleScript_TargetAbilityStatRaiseOnMoveEnd -Added a copy, BattleScript_TargetAbilityStatRaiseOnSwitchin Their labels reflect the instances of a battle in which they can be called. --- data/battle_scripts_1.s | 12 +++++++++++- include/battle_scripts.h | 3 ++- src/battle_util.c | 28 +++++++++++++++++++++++----- 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 6f1ceb63b..fa59e58ce 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -7082,7 +7082,17 @@ BattleScript_AngryPointActivates:: waitmessage 0x40 return -BattleScript_TargetAbilityStatRaise:: +BattleScript_TargetAbilityStatRaiseOnSwitchin:: + call BattleScript_AbilityPopUp + statbuffchange STAT_BUFF_NOT_PROTECT_AFFECTED | MOVE_EFFECT_CERTAIN, NULL + setgraphicalstatchangevalues + playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1 + waitanimation + printstring STRINGID_TARGETABILITYSTATRAISE + waitmessage 0x40 + end3 + +BattleScript_TargetAbilityStatRaiseOnMoveEnd:: call BattleScript_AbilityPopUp statbuffchange STAT_BUFF_NOT_PROTECT_AFFECTED | MOVE_EFFECT_CERTAIN, NULL setgraphicalstatchangevalues diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 3566a1c4d..7799e721f 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -249,7 +249,7 @@ extern const u8 BattleScript_SturdiedMsg[]; extern const u8 BattleScript_GravityEnds[]; extern const u8 BattleScript_MoveStatDrain[]; extern const u8 BattleScript_MoveStatDrain_PPLoss[]; -extern const u8 BattleScript_TargetAbilityStatRaise[]; +extern const u8 BattleScript_TargetAbilityStatRaiseOnMoveEnd[]; extern const u8 BattleScript_AngryPointActivates[]; extern const u8 BattleScript_AttackerAbilityStatRaise[]; extern const u8 BattleScript_AttackerAbilityStatRaiseEnd3[]; @@ -350,5 +350,6 @@ extern const u8 BattleScript_EmergencyExitWild[]; extern const u8 BattleScript_EmergencyExitWildNoPopUp[]; extern const u8 BattleScript_CheekPouchActivates[]; extern const u8 BattleScript_AnnounceAirLockCloudNine[]; +extern const u8 BattleScript_TargetAbilityStatRaiseOnSwitchin[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/src/battle_util.c b/src/battle_util.c index b929b7499..ef414b711 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3936,6 +3936,24 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move effect++; } break; + case ABILITY_INTREPID_SWORD: + if (!gSpecialStatuses[battler].switchInAbilityDone) + { + gSpecialStatuses[battler].switchInAbilityDone = 1; + SET_STATCHANGER(STAT_ATK, 1, FALSE); + BattleScriptPushCursorAndCallback(BattleScript_TargetAbilityStatRaiseOnSwitchin); + effect++; + } + break; + case ABILITY_DAUNTLESS_SHIELD: + if (!gSpecialStatuses[battler].switchInAbilityDone) + { + gSpecialStatuses[battler].switchInAbilityDone = 1; + SET_STATCHANGER(STAT_DEF, 1, FALSE); + BattleScriptPushCursorAndCallback(BattleScript_TargetAbilityStatRaiseOnSwitchin); + effect++; + } + break; } break; case ABILITYEFFECT_ENDTURN: // 1 @@ -4249,7 +4267,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move { SET_STATCHANGER(STAT_ATK, 1, FALSE); BattleScriptPushCursor(); - gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaise; + gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaiseOnMoveEnd; effect++; } break; @@ -4262,7 +4280,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move { SET_STATCHANGER(STAT_SPEED, 1, FALSE); BattleScriptPushCursor(); - gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaise; + gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaiseOnMoveEnd; effect++; } break; @@ -4275,7 +4293,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move { SET_STATCHANGER(STAT_DEF, 2, FALSE); BattleScriptPushCursor(); - gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaise; + gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaiseOnMoveEnd; effect++; } break; @@ -4287,7 +4305,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move { SET_STATCHANGER(STAT_DEF, 1, FALSE); BattleScriptPushCursor(); - gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaise; + gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaiseOnMoveEnd; effect++; } break; @@ -4304,7 +4322,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move { SET_STATCHANGER(STAT_SPATK, 1, FALSE); BattleScriptPushCursor(); - gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaise; + gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaiseOnMoveEnd; effect++; } break;