Skip to content

Commit

Permalink
IsFinalStrikeEffect uses effect instead of move (rh-hideout#4917)
Browse files Browse the repository at this point in the history
* IsFinalStrikeEffect uses effect instead of move

* Update test/battle/ability/parental_bond.c

---------

Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com>
  • Loading branch information
Sneed69 and AlexOn1ine authored Jul 6, 2024
1 parent 93f5ca2 commit 60c7588
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ static void DrawLevelUpBannerText(void);
static void SpriteCB_MonIconOnLvlUpBanner(struct Sprite *sprite);
static bool32 CriticalCapture(u32 odds);
static void BestowItem(u32 battlerAtk, u32 battlerDef);
static bool8 IsFinalStrikeEffect(u16 move);
static bool8 IsFinalStrikeEffect(u32 moveEffect);
static void TryUpdateRoundTurnOrder(void);
static bool32 ChangeOrderTargetAfterAttacker(void);
void ApplyExperienceMultipliers(s32 *expAmount, u8 expGetterMonId, u8 faintedBattler);
Expand Down Expand Up @@ -15876,10 +15876,9 @@ bool32 IsMoveAffectedByParentalBond(u32 move, u32 battler)
return FALSE;
}

static bool8 IsFinalStrikeEffect(u16 move)
static bool8 IsFinalStrikeEffect(u32 moveEffect)
{
u32 i;
u16 moveEffect = gMovesInfo[move].effect;

for (i = 0; i < ARRAY_COUNT(sFinalStrikeOnlyEffects); i++)
{
Expand Down
24 changes: 24 additions & 0 deletions test/battle/ability/parental_bond.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,30 @@ SINGLE_BATTLE_TEST("Parental Bond has no affect on multi hit moves and they stil
}
}

SINGLE_BATTLE_TEST("Parental Bond Smack Down effect triggers after 2nd hit")
{
GIVEN {
ASSUME(gMovesInfo[MOVE_SMACK_DOWN].category != DAMAGE_CATEGORY_STATUS);
ASSUME(gMovesInfo[MOVE_SMACK_DOWN].strikeCount < 2);
ASSUME(MoveHasAdditionalEffect(MOVE_SMACK_DOWN, MOVE_EFFECT_SMACK_DOWN));
PLAYER(SPECIES_KANGASKHAN) { Item(ITEM_KANGASKHANITE); }
OPPONENT(SPECIES_SKARMORY);
} WHEN {
TURN { MOVE(player, MOVE_SMACK_DOWN, megaEvolve: TRUE); }
} SCENE {
MESSAGE("Kangaskhan's Kangaskhanite is reacting to 1's Mega Ring!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_MEGA_EVOLUTION, player);
MESSAGE("Kangaskhan has Mega Evolved into Mega Kangaskhan!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_SMACK_DOWN, player);
HP_BAR(opponent);
NOT MESSAGE("Foe Skarmory fell straight down!");
HP_BAR(opponent);
MESSAGE("Foe Skarmory fell straight down!");
} THEN {
EXPECT_EQ(player->species, SPECIES_KANGASKHAN_MEGA);
}
}

TO_DO_BATTLE_TEST("Parental Bond tests");

// Temporary TODO: Convert Bulbapedia description into tests.
Expand Down

0 comments on commit 60c7588

Please sign in to comment.