Damage calculation can only return 0 if effectiveness is 0.
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
aee0f04d9c
commit
e323b62250
|
@ -34,7 +34,7 @@ uint32_t PkmnLib::Battling::DamageLibrary::GetDamage(CreatureLib::Battling::Exec
|
||||||
if (_hasRandomness) {
|
if (_hasRandomness) {
|
||||||
Ensure(attack->GetUser()->GetBattle().GetValue());
|
Ensure(attack->GetUser()->GetBattle().GetValue());
|
||||||
float randPercentage = 85 + attack->GetUser()->GetBattle().GetValue()->GetRandom()->Get(0, 16);
|
float randPercentage = 85 + attack->GetUser()->GetBattle().GetValue()->GetRandom()->Get(0, 16);
|
||||||
floatDamage = fl(floatDamage * (randPercentage / 100.0));
|
floatDamage = fl(floatDamage * (randPercentage / 100.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attack->GetUser()->HasType(hitData.GetType())) {
|
if (attack->GetUser()->HasType(hitData.GetType())) {
|
||||||
|
@ -46,8 +46,12 @@ uint32_t PkmnLib::Battling::DamageLibrary::GetDamage(CreatureLib::Battling::Exec
|
||||||
floatDamage = fl(floatDamage * hitData.GetEffectiveness());
|
floatDamage = fl(floatDamage * hitData.GetEffectiveness());
|
||||||
|
|
||||||
uint32_t damage = 0;
|
uint32_t damage = 0;
|
||||||
if (floatDamage < 0) {
|
if (floatDamage <= 0) {
|
||||||
|
if (hitData.GetEffectiveness() == 0) {
|
||||||
damage = 0;
|
damage = 0;
|
||||||
|
} else {
|
||||||
|
damage = 1;
|
||||||
|
}
|
||||||
} else if (floatDamage >= (float)UINT32_MAX) {
|
} else if (floatDamage >= (float)UINT32_MAX) {
|
||||||
damage = UINT32_MAX;
|
damage = UINT32_MAX;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue