Match the client's bugged state with natural durability, remove redundant statbonus maxhp

This commit is contained in:
KimLS 2021-09-16 00:53:11 -07:00
parent fba333fe8a
commit 6e16f6c1b6
6 changed files with 13 additions and 36 deletions

View File

@ -760,7 +760,7 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon)
case SE_IncreaseRange:
break;
case SE_MaxHPChange:
newbon->MaxHP += base1;
newbon->MaxHPChange += base1;
break;
case SE_Packrat:
newbon->Packrat += base1;

View File

@ -315,19 +315,13 @@ int32 Client::CalcHPRegenCap()
int32 Client::CalcMaxHP()
{
int64 nd = 10000;
int64 max_hp = (CalcBaseHP() + itembonuses.HP);
//The AA desc clearly says it only applies to base hp..
//but the actual effect sent on live causes the client
//to apply it to (basehp + itemhp).. I will oblige to the client's whims over
//the aa description
nd += aabonuses.MaxHP; //Natural Durability, Physical Enhancement, Planar Durability
max_hp = max_hp * nd / 10000; //this is to fix the HP-above-495k issue
int32 base_hp = (CalcBaseHP() + itembonuses.HP);
int32 nd = aabonuses.MaxHPChange + spellbonuses.MaxHPChange + itembonuses.MaxHPChange;
max_hp = (base_hp * nd / 10000) + base_hp;
max_hp += GroupLeadershipAAHealthEnhancement();
max_hp += 5;
max_hp += GetHeroicSTA() * 10;
max_hp += spellbonuses.HP + aabonuses.HP;
max_hp += GroupLeadershipAAHealthEnhancement();
max_hp += max_hp * ((spellbonuses.MaxHPChange + itembonuses.MaxHPChange) / 10000.0f);
max_hp += aabonuses.HP + spellbonuses.HP;
if (current_hp > max_hp) {
current_hp = max_hp;
}
@ -340,8 +334,7 @@ int32 Client::CalcMaxHP()
}
}
this->max_hp = std::min(max_hp, (int64)std::numeric_limits<decltype(Mob::max_hp)>::max());
return this->max_hp;
return max_hp;
}
uint32 Mob::GetClassLevelFactor()

View File

@ -339,7 +339,6 @@ struct StatBonuses {
int32 AC;
int32 HP;
int32 HPRegen;
int32 MaxHP;
int32 ManaRegen;
int32 EnduranceRegen;
int32 Mana;

View File

@ -20,11 +20,6 @@ int32 Lua_StatBonuses::GetHPRegen() const {
return self->HPRegen;
}
int32 Lua_StatBonuses::GetMaxHP() const {
Lua_Safe_Call_Int();
return self->MaxHP;
}
int32 Lua_StatBonuses::GetManaRegen() const {
Lua_Safe_Call_Int();
return self->ManaRegen;
@ -1291,7 +1286,6 @@ luabind::scope lua_register_stat_bonuses() {
.def("AC", &Lua_StatBonuses::GetAC)
.def("HP", &Lua_StatBonuses::GetHP)
.def("HPRegen", &Lua_StatBonuses::GetHPRegen)
.def("MaxHP", &Lua_StatBonuses::GetMaxHP)
.def("ManaRegen", &Lua_StatBonuses::GetManaRegen)
.def("EnduranceRegen", &Lua_StatBonuses::GetEnduranceRegen)
.def("Mana", &Lua_StatBonuses::GetMana)

View File

@ -28,7 +28,6 @@ public:
int32 GetAC() const;
int32 GetHP() const;
int32 GetHPRegen() const;
int32 GetMaxHP() const;
int32 GetManaRegen() const;
int32 GetEnduranceRegen() const;
int32 GetMana() const;

View File

@ -843,21 +843,13 @@ int32 Merc::CalcHPRegenCap()
}
int32 Merc::CalcMaxHP() {
float nd = 10000;
max_hp = (CalcBaseHP() + itembonuses.HP);
//The AA desc clearly says it only applies to base hp..
//but the actual effect sent on live causes the client
//to apply it to (basehp + itemhp).. I will oblige to the client's whims over
//the aa description
nd += aabonuses.MaxHP; //Natural Durability, Physical Enhancement, Planar Durability
max_hp = (float)max_hp * (float)nd / (float)10000; //this is to fix the HP-above-495k issue
max_hp += spellbonuses.HP + aabonuses.HP;
int32 base_hp = (CalcBaseHP() + itembonuses.HP);
int32 nd = aabonuses.MaxHPChange + spellbonuses.MaxHPChange + itembonuses.MaxHPChange;
max_hp = (base_hp * nd / 10000) + base_hp;
max_hp += GroupLeadershipAAHealthEnhancement();
max_hp += max_hp * ((spellbonuses.MaxHPChange + itembonuses.MaxHPChange) / 10000.0f);
max_hp += 5;
max_hp += GetHeroicSTA() * 10;
max_hp += aabonuses.HP + spellbonuses.HP;
if (current_hp > max_hp)
current_hp = max_hp;