Fixes Trump Card's power calculation using its own PP when called by another move (#9445)
Some checks are pending
CI / build (push) Waiting to run
CI / docs_validate (push) Waiting to run
CI / allcontributors (push) Waiting to run
Docs / deploy (push) Waiting to run

This commit is contained in:
PhallenTree 2026-03-06 19:47:19 +00:00 committed by GitHub
parent 78e4de61f8
commit 66b550b9f0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 77 additions and 2 deletions

View File

@ -6357,7 +6357,7 @@ static inline u32 CalcMoveBasePower(struct BattleContext *ctx)
basePower *= 2;
break;
case EFFECT_TRUMP_CARD:
i = GetMoveSlot(gBattleMons[battlerAtk].moves, move);
i = GetMoveSlot(gBattleMons[battlerAtk].moves, ctx->chosenMove);
if (i != MAX_MON_MOVES)
{
if (gBattleMons[battlerAtk].pp[i] >= ARRAY_COUNT(sTrumpCardPowerTable))

View File

@ -1,4 +1,79 @@
#include "global.h"
#include "test/battle.h"
TO_DO_BATTLE_TEST("TODO: Write Trump Card (Move Effect) test titles")
ASSUMPTIONS
{
ASSUME(GetMoveEffect(MOVE_TRUMP_CARD) == EFFECT_TRUMP_CARD);
}
SINGLE_BATTLE_TEST("Trump Card increases in power if its PP is low", s16 damage)
{
// pp + 1 is assigned as the move's PP as it will be reduced before its base power is determined
u32 pp;
PARAMETRIZE { pp = 4; } // 40 power
PARAMETRIZE { pp = 3; } // 50 power
PARAMETRIZE { pp = 2; } // 60 power
PARAMETRIZE { pp = 1; } // 80 power
PARAMETRIZE { pp = 0; } // 200 power
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { MovesWithPP({MOVE_TRUMP_CARD, pp + 1}); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_TRUMP_CARD); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_TRUMP_CARD, player);
HP_BAR(opponent, captureDamage: &results[i].damage);
} FINALLY {
EXPECT_MUL_EQ(results[0].damage, UQ_4_12(1.25), results[1].damage);
EXPECT_MUL_EQ(results[0].damage, UQ_4_12(1.5), results[2].damage);
EXPECT_MUL_EQ(results[0].damage, UQ_4_12(2.0), results[3].damage);
EXPECT_MUL_EQ(results[0].damage, UQ_4_12(5.0), results[4].damage);
}
}
SINGLE_BATTLE_TEST("Trump Card doesn't increase in power if its PP is low when called by a different move", s16 damage)
{
u32 pp;
PARAMETRIZE { pp = 4; } // would be 40 power
PARAMETRIZE { pp = 0; } // would be 200 power
GIVEN {
ASSUME(GetMoveEffect(MOVE_SLEEP_TALK) == EFFECT_SLEEP_TALK);
PLAYER(SPECIES_WOBBUFFET) { MovesWithPP({MOVE_TRUMP_CARD, pp}, {MOVE_SLEEP_TALK, 10}); Status1(STATUS1_SLEEP); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_SLEEP_TALK); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_SLEEP_TALK, player);
ANIMATION(ANIM_TYPE_MOVE, MOVE_TRUMP_CARD, player);
HP_BAR(opponent, captureDamage: &results[i].damage);
} FINALLY {
EXPECT_EQ(results[0].damage, results[1].damage);
}
}
SINGLE_BATTLE_TEST("Trump Card increases in power if the move that called it has low PP", s16 damage)
{
// pp + 1 is assigned as the move's PP as it will be reduced before its base power is determined
u32 pp;
PARAMETRIZE { pp = 4; } // 40 power
PARAMETRIZE { pp = 0; } // 200 power
GIVEN {
ASSUME(GetMoveEffect(MOVE_SLEEP_TALK) == EFFECT_SLEEP_TALK);
PLAYER(SPECIES_WOBBUFFET) { MovesWithPP({MOVE_TRUMP_CARD, 5}, {MOVE_SLEEP_TALK, pp + 1}); Status1(STATUS1_SLEEP); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_SLEEP_TALK); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_SLEEP_TALK, player);
ANIMATION(ANIM_TYPE_MOVE, MOVE_TRUMP_CARD, player);
HP_BAR(opponent, captureDamage: &results[i].damage);
} FINALLY {
EXPECT_MUL_EQ(results[0].damage, UQ_4_12(5.0), results[1].damage);
}
}