Skip to content

Commit

Permalink
Removes unnecessary checks for Shield Dust and Covert Cloak (#5073)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
AlexOn1ine and hedara90 authored Aug 1, 2024
1 parent e6175b5 commit de8002e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 10 deletions.
10 changes: 0 additions & 10 deletions src/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 12 additions & 0 deletions test/battle/ability/shield_dust.c
Original file line number Diff line number Diff line change
Expand Up @@ -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!");
}
}
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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!");
}
}

0 comments on commit de8002e

Please sign in to comment.