Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes redundant Decorate check #5696

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions src/battle_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 23 additions & 9 deletions test/battle/move_effect/protect.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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!");
}
}
Expand Down Expand Up @@ -570,3 +583,4 @@ SINGLE_BATTLE_TEST("Spiky Shield does not damage users on Counter or Mirror Coat
}
}
}

Loading