From ea3c13a1ecca497946c6aec8619555ae5a92ac82 Mon Sep 17 00:00:00 2001 From: AlexOn1ine Date: Wed, 14 Aug 2024 14:51:54 +0200 Subject: [PATCH 1/3] Fixes booster energy not increasing speed --- src/battle_main.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/battle_main.c b/src/battle_main.c index 526c54d62f5f..d3866fd5a2db 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -4717,7 +4717,6 @@ void SwapTurnOrder(u8 id1, u8 id2) u32 GetBattlerTotalSpeedStatArgs(u32 battler, u32 ability, u32 holdEffect) { u32 speed = gBattleMons[battler].speed; - u32 highestStat = GetHighestStatId(battler); // weather abilities if (WEATHER_HAS_EFFECT) @@ -4739,10 +4738,12 @@ u32 GetBattlerTotalSpeedStatArgs(u32 battler, u32 ability, u32 holdEffect) speed *= 2; else if (ability == ABILITY_SLOW_START && gDisableStructs[battler].slowStartTimer != 0) speed /= 2; - else if (ability == ABILITY_PROTOSYNTHESIS && gBattleWeather & B_WEATHER_SUN && highestStat == STAT_SPEED) - speed = (speed * 150) / 100; - else if (ability == ABILITY_QUARK_DRIVE && gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN && highestStat == STAT_SPEED) - speed = (speed * 150) / 100; + else if (GetHighestStatId(battler) == STAT_SPEED) + { + if ((ability == ABILITY_PROTOSYNTHESIS && (gBattleWeather & B_WEATHER_SUN || gBattleStruct->boosterEnergyActivates & gBitTable[battler])) + || (ability == ABILITY_QUARK_DRIVE && (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN || gBattleStruct->boosterEnergyActivates & gBitTable[battler]))) + speed = (speed * 150) / 100; + } // stat stages speed *= gStatStageRatios[gBattleMons[battler].statStages[STAT_SPEED]][0]; From d1b7a3cd0b7bd018aa23313979be9cb1cde89a19 Mon Sep 17 00:00:00 2001 From: AlexOn1ine Date: Wed, 14 Aug 2024 15:06:17 +0200 Subject: [PATCH 2/3] alternative solution --- src/battle_main.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/battle_main.c b/src/battle_main.c index d3866fd5a2db..0eaad6dda6e6 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -4738,12 +4738,10 @@ u32 GetBattlerTotalSpeedStatArgs(u32 battler, u32 ability, u32 holdEffect) speed *= 2; else if (ability == ABILITY_SLOW_START && gDisableStructs[battler].slowStartTimer != 0) speed /= 2; - else if (GetHighestStatId(battler) == STAT_SPEED) - { - if ((ability == ABILITY_PROTOSYNTHESIS && (gBattleWeather & B_WEATHER_SUN || gBattleStruct->boosterEnergyActivates & gBitTable[battler])) - || (ability == ABILITY_QUARK_DRIVE && (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN || gBattleStruct->boosterEnergyActivates & gBitTable[battler]))) - speed = (speed * 150) / 100; - } + if (ability == ABILITY_PROTOSYNTHESIS && (gBattleWeather & B_WEATHER_SUN || gBattleStruct->boosterEnergyActivates & gBitTable[battler])) + speed = (GetHighestStatId(battler) == STAT_SPEED) ? (speed * 150) / 100 : speed; + if (ability == ABILITY_QUARK_DRIVE && (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN || gBattleStruct->boosterEnergyActivates & gBitTable[battler])) + speed = (GetHighestStatId(battler) == STAT_SPEED) ? (speed * 150) / 100 : speed; // stat stages speed *= gStatStageRatios[gBattleMons[battler].statStages[STAT_SPEED]][0]; From 0e25269b1f537d0ed367c5e6c3d4cf9d63f2e8d9 Mon Sep 17 00:00:00 2001 From: AlexOn1ine Date: Wed, 14 Aug 2024 15:06:49 +0200 Subject: [PATCH 3/3] forgot else --- src/battle_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/battle_main.c b/src/battle_main.c index 0eaad6dda6e6..e164976e9d16 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -4738,9 +4738,9 @@ u32 GetBattlerTotalSpeedStatArgs(u32 battler, u32 ability, u32 holdEffect) speed *= 2; else if (ability == ABILITY_SLOW_START && gDisableStructs[battler].slowStartTimer != 0) speed /= 2; - if (ability == ABILITY_PROTOSYNTHESIS && (gBattleWeather & B_WEATHER_SUN || gBattleStruct->boosterEnergyActivates & gBitTable[battler])) + else if (ability == ABILITY_PROTOSYNTHESIS && (gBattleWeather & B_WEATHER_SUN || gBattleStruct->boosterEnergyActivates & gBitTable[battler])) speed = (GetHighestStatId(battler) == STAT_SPEED) ? (speed * 150) / 100 : speed; - if (ability == ABILITY_QUARK_DRIVE && (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN || gBattleStruct->boosterEnergyActivates & gBitTable[battler])) + else if (ability == ABILITY_QUARK_DRIVE && (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN || gBattleStruct->boosterEnergyActivates & gBitTable[battler])) speed = (GetHighestStatId(battler) == STAT_SPEED) ? (speed * 150) / 100 : speed; // stat stages