Fix fury cutter scaling up to 640 power (#4846)

* Fix fury cutter scaling up to 640 power

* Replace three instances of int i with one int turn

* dynamic test
This commit is contained in:
sneed 2024-06-21 09:15:00 +03:00 committed by GitHub
parent 7ae88d8455
commit c31f982a7b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 48 additions and 1 deletions

View file

@ -13328,7 +13328,16 @@ static void Cmd_handlefurycutter(void)
}
else
{
if (gDisableStructs[gBattlerAttacker].furyCutterCounter != 5
u32 max;
if (B_UPDATED_MOVE_DATA >= GEN_6)
max = 3;
else if (B_UPDATED_MOVE_DATA == GEN_5)
max = 4;
else
max = 5;
if (gDisableStructs[gBattlerAttacker].furyCutterCounter < max
&& gSpecialStatuses[gBattlerAttacker].parentalBondState != PARENTAL_BOND_1ST_HIT) // Don't increment counter on first hit
gDisableStructs[gBattlerAttacker].furyCutterCounter++;

View file

@ -0,0 +1,38 @@
#include "global.h"
#include "test/battle.h"
ASSUMPTIONS
{
ASSUME(gMovesInfo[MOVE_FURY_CUTTER].effect == EFFECT_FURY_CUTTER);
}
SINGLE_BATTLE_TEST("Fury Cutter power doubles with each use, up to 160 power")
{
s16 damage[6];
int turn;
int maxTurns;
if (B_UPDATED_MOVE_DATA >= GEN_6)
maxTurns = 4;
else if (B_UPDATED_MOVE_DATA == GEN_5)
maxTurns = 5;
else
maxTurns = 6;
GIVEN {
PLAYER(SPECIES_CROBAT);
OPPONENT(SPECIES_LINOONE) { HP(900); }
} WHEN {
for (turn = 0; turn < maxTurns; turn++)
TURN { MOVE(player, MOVE_FURY_CUTTER); }
} SCENE {
for (turn = 0; turn < maxTurns; turn++) {
ANIMATION(ANIM_TYPE_MOVE, MOVE_FURY_CUTTER, player);
HP_BAR(opponent, captureDamage: &damage[turn]);
}
} THEN {
for (turn = 1; turn < maxTurns - 1; turn++)
EXPECT_MUL_EQ(damage[turn - 1], UQ_4_12(2.0), damage[turn]);
EXPECT_EQ(damage[maxTurns - 2], damage[maxTurns - 1]);
}
}