Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Core/Spells Implement SPELL_ATTR8_COMBAT_RESURECTION_LIMIT
Browse files Browse the repository at this point in the history
- fix an issue where some battle resurrection spells were using the wrong effect basepoints for health and mana calculations
  • Loading branch information
Crypticaz authored and AriDEV committed Aug 3, 2021
1 parent 8a7d57c commit e02ee0a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/server/game/Miscellaneous/SharedDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ enum SpellAttr8
SPELL_ATTR8_ARMOR_SPECIALIZATION = 0x00100000, // 20
SPELL_ATTR8_UNK21 = 0x00200000, // 21
SPELL_ATTR8_UNK22 = 0x00400000, // 22
SPELL_ATTR8_UNK23 = 0x00800000, // 23
SPELL_ATTR8_COMBAT_RESURECTION_LIMIT = 0x00800000, // 23
SPELL_ATTR8_HEALING_SPELL = 0x01000000, // 24
SPELL_ATTR8_UNK25 = 0x02000000, // 25
SPELL_ATTR8_RAID_MARKER = 0x04000000, // 26 probably spell no need learn to cast
Expand Down
41 changes: 31 additions & 10 deletions src/server/game/Spells/SpellEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4386,8 +4386,20 @@ void Spell::EffectResurrect(SpellEffIndex effIndex)
if (target->IsRessurectRequested()) // already have one active request
return;

uint32 health = target->CountPctFromMaxHealth(damage);
uint32 mana = CalculatePct(target->GetMaxPower(POWER_MANA), damage);
uint32 health = 0;
uint32 mana = 0;

// check for spells that use different health and mana % on some resurrection
if (m_spellInfo->AttributesEx8 & SPELL_ATTR8_COMBAT_RESURECTION_LIMIT)
{
health = target->CountPctFromMaxHealth(m_spellInfo->Effects[EFFECT_1].BasePoints);
mana = CalculatePct(target->GetMaxPower(POWER_MANA), m_spellInfo->Effects[EFFECT_0].BasePoints);
}
else
{
health = target->CountPctFromMaxHealth(damage);
mana = CalculatePct(target->GetMaxPower(POWER_MANA), damage);
}

ExecuteLogEffectResurrect(effIndex, target);

Expand Down Expand Up @@ -4528,18 +4540,27 @@ void Spell::EffectSelfResurrect(SpellEffIndex effIndex)
uint32 health = 0;
uint32 mana = 0;

// flat case
if (damage < 0)
// check for spells that use different health and mana % on some battle resurrection
if (m_spellInfo->AttributesEx8 & SPELL_ATTR8_COMBAT_RESURECTION_LIMIT)
{
health = uint32(-damage);
mana = m_spellInfo->Effects[effIndex].MiscValue;
health = m_caster->CountPctFromMaxHealth(m_spellInfo->Effects[EFFECT_1].BasePoints);
mana = CalculatePct(m_caster->GetMaxPower(POWER_MANA), m_spellInfo->Effects[EFFECT_0].BasePoints);
}
// percent case
else
{
health = m_caster->CountPctFromMaxHealth(damage);
if (m_caster->GetMaxPower(POWER_MANA) > 0)
mana = CalculatePct(m_caster->GetMaxPower(POWER_MANA), damage);
// flat case
if (damage < 0)
{
health = uint32(-damage);
mana = m_spellInfo->Effects[effIndex].MiscValue;
}
// percent case
else
{
health = m_caster->CountPctFromMaxHealth(damage);
if (m_caster->GetMaxPower(POWER_MANA) > 0)
mana = CalculatePct(m_caster->GetMaxPower(POWER_MANA), damage);
}
}

Player* player = m_caster->ToPlayer();
Expand Down

0 comments on commit e02ee0a

Please sign in to comment.