Skip to content

Commit

Permalink
Fixes Tera giving boost to dynamic bp moves (#6008)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexOn1ine authored Jan 11, 2025
1 parent 2da5479 commit 9e8ab3d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/battle_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -9244,13 +9244,14 @@ static inline u32 CalcMoveBasePowerAfterModifiers(struct DamageCalculationData *
u32 battlerDef = damageCalcData->battlerDef;
u32 move = damageCalcData->move;
u32 moveType = damageCalcData->moveType;
u32 moveEffect = gMovesInfo[move].effect;

uq4_12_t holdEffectModifier;
uq4_12_t modifier = UQ_4_12(1.0);
u32 atkSide = GetBattlerSide(battlerAtk);

// move effect
switch (gMovesInfo[move].effect)
switch (moveEffect)
{
case EFFECT_FACADE:
if (gBattleMons[battlerAtk].status1 & (STATUS1_BURN | STATUS1_PSN_ANY | STATUS1_PARALYSIS | STATUS1_FROSTBITE))
Expand Down Expand Up @@ -9556,8 +9557,11 @@ static inline u32 CalcMoveBasePowerAfterModifiers(struct DamageCalculationData *
&& (moveType == GetBattlerTeraType(battlerAtk)
|| (GetBattlerTeraType(battlerAtk) == TYPE_STELLAR && IsTypeStellarBoosted(battlerAtk, moveType)))
&& uq4_12_multiply_by_int_half_down(modifier, basePower) < 60
&& gMovesInfo[move].power > 1
&& gMovesInfo[move].strikeCount < 2
&& gMovesInfo[move].effect != EFFECT_MULTI_HIT
&& moveEffect != EFFECT_POWER_BASED_ON_USER_HP
&& moveEffect != EFFECT_POWER_BASED_ON_TARGET_HP
&& moveEffect != EFFECT_MULTI_HIT
&& gMovesInfo[move].priority == 0)
{
return 60;
Expand Down
19 changes: 19 additions & 0 deletions test/battle/gimmick/terastal.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,25 @@ SINGLE_BATTLE_TEST("(TERA) Terastallization's 60 BP floor does not apply to prio
}
}

SINGLE_BATTLE_TEST("(TERA) Terastallization's 60 BP floor does not apply to dynamic base power moves", s16 damage)
{
bool32 tera;
PARAMETRIZE { tera = GIMMICK_NONE; }
PARAMETRIZE { tera = GIMMICK_TERA; }
GIVEN {
ASSUME(gMovesInfo[MOVE_WATER_SPOUT].effect == EFFECT_POWER_BASED_ON_USER_HP);
PLAYER(SPECIES_WOBBUFFET) { HP(1); TeraType(TYPE_WATER); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_WATER_SPOUT, gimmick: tera); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_WATER_SPOUT, player);
HP_BAR(opponent, captureDamage: &results[i].damage);
} FINALLY {
EXPECT_EQ(results[0].damage, results[1].damage);
}
}

// Defensive Type Checks

SINGLE_BATTLE_TEST("(TERA) Terastallization changes type effectiveness", s16 damage)
Expand Down

0 comments on commit 9e8ab3d

Please sign in to comment.