[Cleanup] Cleanup magic numbers (#2662)

* [Cleanup] Cleanup magic numbers

* renamed RACE_NODE
This commit is contained in:
Aeadoin
2022-12-20 11:31:42 -05:00
committed by GitHub
parent ed6194ad19
commit 900e1aecf6
6 changed files with 43 additions and 27 deletions
+13 -8
View File
@@ -4363,19 +4363,23 @@ bool Merc::IsStanding() {
float Merc::GetMaxMeleeRangeToTarget(Mob* target) {
float result = 0;
if(target) {
if (target) {
float size_mod = GetSize();
float other_size_mod = target->GetSize();
if(GetRace() == 49 || GetRace() == 158 || GetRace() == 196) //For races with a fixed size
if (GetRace() == RACE_LAVA_DRAGON_49 || GetRace() == RACE_WURM_158 || GetRace() == RACE_GHOST_DRAGON_196) //For races with a fixed size
{
size_mod = 60.0f;
else if (size_mod < 6.0)
} else if (size_mod < 6.0) {
size_mod = 8.0f;
}
if(target->GetRace() == 49 || target->GetRace() == 158 || target->GetRace() == 196) //For races with a fixed size
if (target->GetRace() == RACE_LAVA_DRAGON_49 || target->GetRace() == RACE_WURM_158 || target->GetRace() == RACE_GHOST_DRAGON_196) //For races with a fixed size
{
other_size_mod = 60.0f;
else if (other_size_mod < 6.0)
} else if (other_size_mod < 6.0) {
other_size_mod = 8.0f;
}
if (other_size_mod > size_mod) {
size_mod = other_size_mod;
@@ -4383,12 +4387,13 @@ float Merc::GetMaxMeleeRangeToTarget(Mob* target) {
// this could still use some work, but for now it's an improvement....
if (size_mod > 29)
if (size_mod > 29) {
size_mod *= size_mod;
else if (size_mod > 19)
} else if (size_mod > 19) {
size_mod *= size_mod * 2;
else
} else {
size_mod *= size_mod * 4;
}
// prevention of ridiculously sized hit boxes
if (size_mod > 10000)