Fix Focus Energy boosting crit by the wrong amount with gen1 crit chance (#7956)
Some checks are pending
CI / build (push) Waiting to run
CI / allcontributors (push) Waiting to run
Docs / deploy (push) Waiting to run

Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com>
This commit is contained in:
FosterProgramming 2025-10-16 21:34:40 +02:00 committed by GitHub
parent 1946d18ba5
commit bb4a876768
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 30 additions and 2 deletions

View File

@ -11161,7 +11161,8 @@ static void Cmd_setfocusenergy(void)
}
else
{
if (GetGenConfig(GEN_CONFIG_FOCUS_ENERGY_CRIT_RATIO) >= GEN_3)
if (GetGenConfig(GEN_CONFIG_FOCUS_ENERGY_CRIT_RATIO) >= GEN_3
|| GetGenConfig(GEN_CONFIG_CRIT_CHANCE) == GEN_1)
gBattleMons[battler].volatiles.focusEnergy = TRUE;
else
gBattleMons[battler].volatiles.dragonCheer = TRUE;

View File

@ -23,7 +23,34 @@ SINGLE_BATTLE_TEST("Focus Energy increases the user's critical hit ratio by 1 st
}
PASSES_RANDOMLY(1, chance, RNG_CRITICAL_HIT);
GIVEN {
WITH_CONFIG(GEN_CONFIG_CRIT_CHANCE, genConfig);
WITH_CONFIG(GEN_CONFIG_CRIT_CHANCE, (genConfig == GEN_1)? GEN_2 : genConfig);
WITH_CONFIG(GEN_CONFIG_FOCUS_ENERGY_CRIT_RATIO, genConfig);
ASSUME(GetSpeciesBaseSpeed(SPECIES_WOBBUFFET) == 33);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
if (useFocusEnergy)
TURN { MOVE(player, MOVE_FOCUS_ENERGY); }
TURN { MOVE(player, MOVE_SCRATCH); }
} SCENE {
if (useFocusEnergy)
ANIMATION(ANIM_TYPE_MOVE, MOVE_FOCUS_ENERGY, player);
ANIMATION(ANIM_TYPE_MOVE, MOVE_SCRATCH, player);
MESSAGE("A critical hit!");
}
}
SINGLE_BATTLE_TEST("Focus Energy multiplies crit chance by 4 with gen 1 crit chance")
{
bool32 useFocusEnergy = 0;
u32 genConfig = 0, chance = 0;
for (u32 j = GEN_1; j <= GEN_9; j++) {
PARAMETRIZE { genConfig = j; useFocusEnergy = FALSE; chance = 16;}
PARAMETRIZE { genConfig = j; useFocusEnergy = TRUE; chance = 4;}
}
PASSES_RANDOMLY(1, chance, RNG_CRITICAL_HIT);
GIVEN {
WITH_CONFIG(GEN_CONFIG_CRIT_CHANCE, GEN_1);
WITH_CONFIG(GEN_CONFIG_FOCUS_ENERGY_CRIT_RATIO, genConfig);
ASSUME(GetSpeciesBaseSpeed(SPECIES_WOBBUFFET) == 33);
PLAYER(SPECIES_WOBBUFFET);