Fixes damage calculation,
This commit is contained in:
parent
3baabe6d79
commit
f3721ad2a5
|
@ -8,7 +8,7 @@ using HitData = const CreatureLib::Battling::ExecutingAttack::HitData;
|
||||||
uint32_t PkmnLib::Battling::DamageLibrary::GetDamage(CreatureLib::Battling::ExecutingAttack* attack,
|
uint32_t PkmnLib::Battling::DamageLibrary::GetDamage(CreatureLib::Battling::ExecutingAttack* attack,
|
||||||
CreatureLib::Battling::Creature* target, uint8_t hitIndex,
|
CreatureLib::Battling::Creature* target, uint8_t hitIndex,
|
||||||
const HitData& hitData) const {
|
const HitData& hitData) const {
|
||||||
auto levelMod = static_cast<float>(2 * attack->GetUser()->GetLevel());
|
auto levelMod = static_cast<float>(2 * attack->GetUser()->GetLevel()) / 5;
|
||||||
auto bp = hitData.GetBasePower();
|
auto bp = hitData.GetBasePower();
|
||||||
auto statMod = GetStatModifier(attack, target, hitIndex, hitData);
|
auto statMod = GetStatModifier(attack, target, hitIndex, hitData);
|
||||||
auto damageMod = GetDamageModifier(attack, target, hitIndex, hitData);
|
auto damageMod = GetDamageModifier(attack, target, hitIndex, hitData);
|
||||||
|
@ -18,7 +18,7 @@ uint32_t PkmnLib::Battling::DamageLibrary::GetDamage(CreatureLib::Battling::Exec
|
||||||
uint32_t damage;
|
uint32_t damage;
|
||||||
if (floatDamage < 0) {
|
if (floatDamage < 0) {
|
||||||
damage = 0;
|
damage = 0;
|
||||||
} else if (floatDamage > (float)UINT32_MAX) {
|
} else if (floatDamage >= (float)UINT32_MAX) {
|
||||||
damage = UINT32_MAX;
|
damage = UINT32_MAX;
|
||||||
} else { // TODO: C++ 20 - add [[likely]] attribute when supported by both gcc and Clang
|
} else { // TODO: C++ 20 - add [[likely]] attribute when supported by both gcc and Clang
|
||||||
damage = static_cast<uint32_t>(floatDamage);
|
damage = static_cast<uint32_t>(floatDamage);
|
||||||
|
|
Loading…
Reference in New Issue