From e9a0c793019c964d1197090c60b954a317645bff Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Tue, 2 Apr 2024 02:12:55 -0400 Subject: [PATCH] [Bug Fix] SPA214 SE_MaxHPChange calculation errors corrected. (#4238) * [Bug Fix] HP Bar not updating when applying HP Buff with a heal. Bug: When an HP buff with a heal effect is applied for first time, the heal portion of the effect heals the client and updates HPs currently server side, but client side the HP bar does not register it as a heal thus you display as less than full HP. However due to server thinking your healed, you are unable to correct it by healing. Solution: You need to resend the HP update after buff completed and action packet resent. * add SE_MaxHPChange to fix would result in same bug * [Bug Fix] SPA214 Percent HP change calculation fix Fix how spell and item bonuses using SPA 214 are calculated. Will now be calculated consistent with client. * [Bug Fix] SPA214 SE_MaxHPChange calculation errors corrected. removed code from other PR --- zone/bonuses.cpp | 1 + zone/bot.cpp | 3 +-- zone/client_mods.cpp | 5 +++-- zone/common.h | 4 ++-- zone/merc.cpp | 4 +--- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index 05c8760cc..13aa824bc 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -5001,6 +5001,7 @@ void Mob::NegateSpellEffectBonuses(uint16 spell_id) case SE_MaxHPChange: if (negate_spellbonus) { spellbonuses.MaxHPChange = effect_value; } if (negate_aabonus) { aabonuses.MaxHPChange = effect_value; } + if (negate_aabonus) { aabonuses.MaxHP = effect_value; } if (negate_itembonus) { itembonuses.MaxHPChange = effect_value; } break; diff --git a/zone/bot.cpp b/zone/bot.cpp index 0e0156a5c..bffadd22c 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -6235,11 +6235,10 @@ int64 Bot::CalcMaxHP() { uint32 nd = 10000; bot_hp += (GenerateBaseHitPoints() + itembonuses.HP); bot_hp += itembonuses.heroic_max_hp; - nd += aabonuses.MaxHP; + nd += aabonuses.MaxHP + spellbonuses.MaxHPChange + itembonuses.MaxHPChange; bot_hp = ((float)bot_hp * (float)nd / (float)10000); bot_hp += (spellbonuses.HP + aabonuses.HP); bot_hp += GroupLeadershipAAHealthEnhancement(); - bot_hp += (bot_hp * ((spellbonuses.MaxHPChange + itembonuses.MaxHPChange) / 10000.0f)); max_hp = bot_hp; if (current_hp > max_hp) current_hp = max_hp; diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index 61c383a7e..d69f83676 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -322,11 +322,12 @@ int64 Client::CalcMaxHP() //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 + + nd += aabonuses.MaxHP + spellbonuses.MaxHPChange + itembonuses.MaxHPChange; //Natural Durability, Physical Enhancement, Planar Durability (MaxHP and MaxHPChange are SPA214) max_hp = (float)max_hp * (float)nd / (float)10000; //this is to fix the HP-above-495k issue max_hp += spellbonuses.HP + aabonuses.HP; + max_hp += GroupLeadershipAAHealthEnhancement(); - max_hp += max_hp * ((spellbonuses.MaxHPChange + itembonuses.MaxHPChange) / 10000.0f); if (current_hp > max_hp) { current_hp = max_hp; } diff --git a/zone/common.h b/zone/common.h index 547dd6e0d..57056d0d5 100644 --- a/zone/common.h +++ b/zone/common.h @@ -287,7 +287,7 @@ struct StatBonuses { int32 AC; int64 HP; int64 HPRegen; - int64 MaxHP; + int64 MaxHP; //same bonus as MaxHPChange when applied to spells and item bonuses int64 ManaRegen; int64 EnduranceRegen; int64 Mana; @@ -413,7 +413,7 @@ struct StatBonuses { int32 MeleeLifetap; //i int32 Vampirism; //i int32 HealRate; // Spell effect that influences effectiveness of heals - int32 MaxHPChange; // Spell Effect + int32 MaxHPChange; // percent change in hit points (aabonuses use variable MaxHP) int16 SkillDmgTaken[EQ::skills::HIGHEST_SKILL + 2]; // All Skills + -1 int32 HealAmt; // Item Effect int32 SpellDmg; // Item Effect diff --git a/zone/merc.cpp b/zone/merc.cpp index c1dcecb0b..c48282ca9 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -461,15 +461,13 @@ int64 Merc::CalcMaxHP() { //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 + nd += aabonuses.MaxHP + spellbonuses.MaxHPChange + itembonuses.MaxHPChange; //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; max_hp += GroupLeadershipAAHealthEnhancement(); - max_hp += max_hp * ((spellbonuses.MaxHPChange + itembonuses.MaxHPChange) / 10000.0f); - if (current_hp > max_hp) current_hp = max_hp;