fixed-damage-move-ai-calc-fix (#7385)

This commit is contained in:
grintoul 2025-07-28 13:10:34 +01:00 committed by GitHub
parent 7c6cff1fb3
commit 1fbee7cce0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 2 deletions

View File

@ -280,6 +280,7 @@ u32 CalcRolloutBasePower(u32 battlerAtk, u32 basePower, u32 rolloutTimer);
u32 CalcFuryCutterBasePower(u32 basePower, u32 furyCutterCounter);
s32 CalculateMoveDamage(struct DamageContext *ctx);
s32 CalculateMoveDamageVars(struct DamageContext *ctx);
s32 DoFixedDamageMoveCalc(struct DamageContext *ctx);
s32 ApplyModifiersAfterDmgRoll(struct DamageContext *ctx, s32 dmg);
uq4_12_t CalcTypeEffectivenessMultiplier(struct DamageContext *ctx);
uq4_12_t CalcPartyMonTypeEffectivenessMultiplier(u16 move, u16 speciesDef, u16 abilityDef);

View File

@ -893,7 +893,12 @@ struct SimulatedDamage AI_CalcDamage(u32 move, u32 battlerAtk, u32 battlerDef, u
AI_StoreBattlerTypes(battlerAtk, types);
ProteanTryChangeType(battlerAtk, aiData->abilities[battlerAtk], move, ctx.moveType);
if (moveEffect == EFFECT_TRIPLE_KICK)
s32 fixedDamage = DoFixedDamageMoveCalc(&ctx);
if (fixedDamage != INT32_MAX)
{
simDamage.minimum = simDamage.median = simDamage.maximum = fixedDamage;
}
else if (moveEffect == EFFECT_TRIPLE_KICK)
{
for (gMultiHitCounter = GetMoveStrikeCount(move); gMultiHitCounter > 0; gMultiHitCounter--) // The global is used to simulate actual damage done
{

View File

@ -9392,7 +9392,7 @@ s32 ApplyModifiersAfterDmgRoll(struct DamageContext *ctx, s32 dmg)
return dmg;
}
static inline s32 DoFixedDamageMoveCalc(struct DamageContext *ctx)
s32 DoFixedDamageMoveCalc(struct DamageContext *ctx)
{
s32 dmg = 0;
s32 randDamage;