From aa051dab02328b4f58fd6570621ce588d2760ae5 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Tue, 6 Dec 2022 05:03:07 -0300 Subject: [PATCH] Implemented Costar's effect --- data/battle_scripts_1.s | 7 +++++++ include/battle_scripts.h | 1 + include/battle_util.h | 1 + src/battle_util.c | 14 ++++++++++++++ 4 files changed, 23 insertions(+) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 11f819c06..d6e0499ba 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -8451,6 +8451,13 @@ BattleScript_SupremeOverlordActivates:: waitmessage B_WAIT_TIME_LONG end3 +BattleScript_CostarActivates:: + pause B_WAIT_TIME_SHORT + call BattleScript_AbilityPopUp + printstring STRINGID_PKMNCOPIEDSTATCHANGES + waitmessage B_WAIT_TIME_LONG + end3 + BattleScript_AttackWeakenedByStrongWinds:: pause B_WAIT_TIME_SHORT printstring STRINGID_ATTACKWEAKENEDBSTRONGWINDS diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 72db7e1f9..20575a5b6 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -446,6 +446,7 @@ extern const u8 BattleScript_GoodAsGoldActivates[]; extern const u8 BattleScript_RuinAbilityActivates[]; extern const u8 BattleScript_CudChewActivates[]; extern const u8 BattleScript_SupremeOverlordActivates[]; +extern const u8 BattleScript_CostarActivates[]; // zmoves extern const u8 BattleScript_ZMoveActivateDamaging[]; diff --git a/include/battle_util.h b/include/battle_util.h index 3f516daba..8922cd842 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -204,5 +204,6 @@ bool32 CanBeFrozen(u8 battlerId); bool32 CanBeConfused(u8 battlerId); bool32 IsBattlerTerrainAffected(u8 battlerId, u32 terrainFlag); u32 GetBattlerFriendshipScore(u8 battlerId); +u32 CountBattlerStatIncreases(u8 battlerId, bool32 countEvasionAcc); #endif // GUARD_BATTLE_UTIL_H diff --git a/src/battle_util.c b/src/battle_util.c index 36120a756..9bc5e24d4 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -4965,6 +4965,20 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move effect++; } break; + case ABILITY_COSTAR: + if (!gSpecialStatuses[battler].switchInAbilityDone + && IsDoubleBattle() + && IsBattlerAlive(BATTLE_PARTNER(battler)) + && CountBattlerStatIncreases(BATTLE_PARTNER(battler), FALSE)) + { + gSpecialStatuses[battler].switchInAbilityDone = TRUE; + for (i = 0; i < NUM_BATTLE_STATS; i++) + gBattleMons[battler].statStages[i] = gBattleMons[BATTLE_PARTNER(battler)].statStages[i]; + gBattlerTarget = BATTLE_PARTNER(battler); + BattleScriptPushCursorAndCallback(BattleScript_CostarActivates); + effect++; + } + break; #if B_WEATHER_FORMS < GEN_5 default: if (gBattleMons[battler].species == SPECIES_CHERRIM)