From de8002e9e0caeef9daed9f0f3b2d9bbec69e50bb Mon Sep 17 00:00:00 2001 From: Alex <93446519+AlexOn1ine@users.noreply.github.com> Date: Thu, 1 Aug 2024 09:58:14 +0200 Subject: [PATCH] Removes unnecessary checks for Shield Dust and Covert Cloak (#5073) * Removes unnecessary checks for Shield Dust and Covert Cloak * remove redundant include * Update test/battle/ability/shield_dust.c Co-authored-by: hedara90 <90hedara@gmail.com> * Update test/battle/hold_effect/covert_cloak.c Co-authored-by: hedara90 <90hedara@gmail.com> --------- Co-authored-by: hedara90 <90hedara@gmail.com> --- src/battle_script_commands.c | 10 ---------- test/battle/ability/shield_dust.c | 12 ++++++++++++ .../{item_effect => hold_effect}/covert_cloak.c | 17 +++++++++++++++++ 3 files changed, 29 insertions(+), 10 deletions(-) rename test/battle/{item_effect => hold_effect}/covert_cloak.c (93%) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 678568a574..55fcb3bc68 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -11704,16 +11704,6 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr } return STAT_CHANGE_DIDNT_WORK; } - else if (battlerAbility == ABILITY_SHIELD_DUST && flags == 0) - { - RecordAbilityBattle(battler, ABILITY_SHIELD_DUST); - return STAT_CHANGE_DIDNT_WORK; - } - else if (flags == 0 && battlerHoldEffect == HOLD_EFFECT_COVERT_CLOAK) - { - RecordItemEffectBattle(battler, HOLD_EFFECT_COVERT_CLOAK); - return STAT_CHANGE_DIDNT_WORK; - } else // try to decrease { statValue = -GET_STAT_BUFF_VALUE(statValue); diff --git a/test/battle/ability/shield_dust.c b/test/battle/ability/shield_dust.c index ea6fbfb285..93a277dea8 100644 --- a/test/battle/ability/shield_dust.c +++ b/test/battle/ability/shield_dust.c @@ -164,3 +164,15 @@ SINGLE_BATTLE_TEST("Shield Dust blocks Sparkling Aria in singles") } } } + +SINGLE_BATTLE_TEST("Shield Dust does not prevent ability stat changes") +{ + GIVEN { + PLAYER(SPECIES_VIVILLON) { Ability(ABILITY_SHIELD_DUST); } + OPPONENT(SPECIES_ELDEGOSS) { Ability(ABILITY_COTTON_DOWN); } + } WHEN { + TURN { MOVE(player, MOVE_TACKLE); } + } SCENE { + MESSAGE("Vivillon's Speed fell!"); + } +} diff --git a/test/battle/item_effect/covert_cloak.c b/test/battle/hold_effect/covert_cloak.c similarity index 93% rename from test/battle/item_effect/covert_cloak.c rename to test/battle/hold_effect/covert_cloak.c index fc9a59bbd0..58c4486fd6 100644 --- a/test/battle/item_effect/covert_cloak.c +++ b/test/battle/hold_effect/covert_cloak.c @@ -1,6 +1,11 @@ #include "global.h" #include "test/battle.h" +ASSUMPTIONS +{ + ASSUME(gItemsInfo[ITEM_COVERT_CLOAK].holdEffect == HOLD_EFFECT_COVERT_CLOAK); +} + SINGLE_BATTLE_TEST("Covert Cloak blocks secondary effects") { u16 move; @@ -162,3 +167,15 @@ SINGLE_BATTLE_TEST("Covert Cloak blocks Sparkling Aria in singles") } } } + +SINGLE_BATTLE_TEST("Covert Cloak does not prevent ability stat changes") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_COVERT_CLOAK); } + OPPONENT(SPECIES_ELDEGOSS) { Ability(ABILITY_COTTON_DOWN); } + } WHEN { + TURN { MOVE(player, MOVE_TACKLE); } + } SCENE { + MESSAGE("Wobbuffet's Speed fell!"); + } +}