[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
This commit is contained in:
KayenEQ 2024-04-02 02:12:55 -04:00 committed by GitHub
parent dc48c45421
commit e9a0c79301
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 8 additions and 9 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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

View File

@ -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;