From 3cc048cc01ba36f7e05b711c86baa908c7be5b3d Mon Sep 17 00:00:00 2001 From: Alex <93446519+AlexOn1ine@users.noreply.github.com> Date: Thu, 21 Nov 2024 06:13:31 +0100 Subject: [PATCH] Removes redundant Decorate check (#5696) --- src/battle_util.c | 9 --------- test/battle/move_effect/protect.c | 32 ++++++++++++++++++++++--------- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/battle_util.c b/src/battle_util.c index f7fee897e7..e4c78132ed 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8571,15 +8571,6 @@ bool32 IsMoveMakingContact(u32 move, u32 battlerAtk) bool32 IsBattlerProtected(u32 battlerAtk, u32 battlerDef, u32 move) { - // Decorate bypasses protect and detect, but not crafty shield - if (move == MOVE_DECORATE) - { - if (gSideStatuses[GetBattlerSide(battlerDef)] & SIDE_STATUS_CRAFTY_SHIELD) - return TRUE; - else if (gProtectStructs[battlerDef].protected) - return FALSE; - } - // Z-Moves and Max Moves bypass protection (except Max Guard). if ((IsZMove(move) || IsMaxMove(move)) && (!gProtectStructs[battlerDef].maxGuarded diff --git a/test/battle/move_effect/protect.c b/test/battle/move_effect/protect.c index 207544de1f..5b1b0a4e4e 100644 --- a/test/battle/move_effect/protect.c +++ b/test/battle/move_effect/protect.c @@ -103,7 +103,7 @@ SINGLE_BATTLE_TEST("King's Shield, Silk Trap and Obstruct protect from damaging MESSAGE("Wobbuffet's Attack fell!"); #else MESSAGE("Wobbuffet's Attack harshly fell!"); - #endif + #endif } else if (statId == STAT_SPEED) { MESSAGE("Wobbuffet's Speed fell!"); } else if (statId == STAT_DEF) { @@ -487,36 +487,49 @@ DOUBLE_BATTLE_TEST("Crafty Shield protects self and ally from status moves") } } -SINGLE_BATTLE_TEST("Protect does not block Confide") +SINGLE_BATTLE_TEST("Protect does not block Confide or Decorate") { + u32 move; + PARAMETRIZE { move = MOVE_CONFIDE; } + PARAMETRIZE { move = MOVE_DECORATE; } + GIVEN { ASSUME(gMovesInfo[MOVE_CONFIDE].effect == EFFECT_SPECIAL_ATTACK_DOWN); + ASSUME(gMovesInfo[MOVE_CONFIDE].ignoresProtect == TRUE); + ASSUME(gMovesInfo[MOVE_DECORATE].effect == EFFECT_DECORATE); + ASSUME(gMovesInfo[MOVE_DECORATE].ignoresProtect == TRUE); PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET); } WHEN { - TURN { MOVE(opponent, MOVE_PROTECT); MOVE(player, MOVE_CONFIDE); } + TURN { MOVE(opponent, MOVE_PROTECT); MOVE(player, move); } } SCENE { - MESSAGE("Wobbuffet used Confide!"); - ANIMATION(ANIM_TYPE_MOVE, MOVE_CONFIDE, player); + ANIMATION(ANIM_TYPE_MOVE, move, player); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent); NOT MESSAGE("The opposing Wobbuffet protected itself!"); } } -DOUBLE_BATTLE_TEST("Crafty Shield protects self and ally from Confide") +DOUBLE_BATTLE_TEST("Crafty Shield protects self and ally from Confide and Decorate") { + u32 move; + PARAMETRIZE { move = MOVE_CONFIDE; } + PARAMETRIZE { move = MOVE_DECORATE; } + GIVEN { ASSUME(gMovesInfo[MOVE_CONFIDE].effect == EFFECT_SPECIAL_ATTACK_DOWN); + ASSUME(gMovesInfo[MOVE_CONFIDE].ignoresProtect == TRUE); + ASSUME(gMovesInfo[MOVE_DECORATE].effect == EFFECT_DECORATE); + ASSUME(gMovesInfo[MOVE_DECORATE].ignoresProtect == TRUE); PLAYER(SPECIES_WOBBUFFET); PLAYER(SPECIES_WYNAUT); OPPONENT(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WYNAUT); } WHEN { - TURN { MOVE(opponentLeft, MOVE_CRAFTY_SHIELD); MOVE(playerLeft, MOVE_CONFIDE, target: opponentLeft); MOVE(playerRight, MOVE_CONFIDE, target: opponentRight); } + TURN { MOVE(opponentLeft, MOVE_CRAFTY_SHIELD); MOVE(playerLeft, move, target: opponentLeft); MOVE(playerRight, move, target: opponentRight); } } SCENE { - MESSAGE("Wobbuffet used Confide!"); + NOT ANIMATION(ANIM_TYPE_MOVE, move, playerLeft); MESSAGE("The opposing Wobbuffet protected itself!"); - MESSAGE("Wynaut used Confide!"); + NOT ANIMATION(ANIM_TYPE_MOVE, move, playerRight); MESSAGE("The opposing Wynaut protected itself!"); } } @@ -570,3 +583,4 @@ SINGLE_BATTLE_TEST("Spiky Shield does not damage users on Counter or Mirror Coat } } } +