From 4074c3b96a2a86bf5efedd3f31d94a19db6b696f Mon Sep 17 00:00:00 2001 From: Tr0n Date: Tue, 9 Apr 2024 18:13:14 +0200 Subject: [PATCH] fix out of order access of variables --- src/game/src/battle.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game/src/battle.cpp b/src/game/src/battle.cpp index b7ca89f..d30fd28 100644 --- a/src/game/src/battle.cpp +++ b/src/game/src/battle.cpp @@ -205,15 +205,15 @@ int CalcMagicDamage(LPCHARACTER pkAttacker, LPCHARACTER pkVictim) float CalcAttackRating(LPCHARACTER pkAttacker, LPCHARACTER pkVictim, bool bIgnoreTargetRating) { - int iARSrc = std::min(90, (attacker_dx * 4 + attacker_lv * 2) / 6); - int iERSrc = std::min(90, (victim_dx * 4 + victim_lv * 2) / 6); - int attacker_dx = pkAttacker->GetPolymorphPoint(POINT_DX); int attacker_lv = pkAttacker->GetLevel(); int victim_dx = pkVictim->GetPolymorphPoint(POINT_DX); int victim_lv = pkAttacker->GetLevel(); + int iARSrc = std::min(90, (attacker_dx * 4 + attacker_lv * 2) / 6); + int iERSrc = std::min(90, (victim_dx * 4 + victim_lv * 2) / 6); + float fAR = ((float) iARSrc + 210.0f) / 300.0f; // fAR = 0.7 ~ 1.0 if (bIgnoreTargetRating)