fix(Core/Spells): Fixed Spiritual Attunement not working with partial… (#15767)

fix(Core/Spells): Fixed Spiritual Attunement not working with partial overheals.

Fixes #14430
This commit is contained in:
UltraNix
2023-04-02 15:13:16 +02:00
committed by GitHub
parent 4d24c412e0
commit 1acbb9ee53
3 changed files with 45 additions and 17 deletions

View File

@@ -6498,11 +6498,12 @@ void Unit::SendAttackStateUpdate(uint32 HitInfo, Unit* target, uint8 /*SwingType
}
//victim may be nullptr
bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, Spell const* spellProc /*= nullptr*/)
bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, ProcEventInfo const& eventInfo)
{
SpellInfo const* dummySpell = triggeredByAura->GetSpellInfo();
uint32 effIndex = triggeredByAura->GetEffIndex();
int32 triggerAmount = triggeredByAura->GetAmount();
Spell const* spellProc = eventInfo.GetProcSpell();
Item* castItem = triggeredByAura->GetBase()->GetCastItemGUID() && GetTypeId() == TYPEID_PLAYER
? ToPlayer()->GetItemByGuid(triggeredByAura->GetBase()->GetCastItemGUID()) : nullptr;
@@ -7864,12 +7865,22 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (!procSpell || !procSpell->IsPositive())
return false;
// heal amount
basepoints0 = int32(CalculatePct(std::min(damage, GetMaxHealth() - GetHealth()), triggerAmount));
target = this;
HealInfo const* healInfo = eventInfo.GetHealInfo();
if (!healInfo)
{
return false;
}
if (basepoints0)
triggered_spell_id = 31786;
uint32 effectiveHeal = healInfo->GetEffectiveHeal();
if (effectiveHeal)
{
// heal amount
basepoints0 = int32(CalculatePct(effectiveHeal, triggerAmount));
target = this;
if (basepoints0)
triggered_spell_id = 31786;
}
break;
}
// Paladin Tier 6 Trinket (Ashtongue Talisman of Zeal)
@@ -11185,16 +11196,18 @@ void Unit::UnsummonAllTotems(bool onDeath /*= false*/)
}
}
void Unit::SendHealSpellLog(Unit* victim, uint32 SpellID, uint32 Damage, uint32 OverHeal, uint32 Absorb, bool critical)
void Unit::SendHealSpellLog(HealInfo const& healInfo, bool critical)
{
uint32 overheal = healInfo.GetHeal() - healInfo.GetEffectiveHeal();
// we guess size
WorldPacket data(SMSG_SPELLHEALLOG, (8 + 8 + 4 + 4 + 4 + 4 + 1 + 1));
data << victim->GetPackGUID();
data << healInfo.GetTarget()->GetPackGUID();
data << GetPackGUID();
data << uint32(SpellID);
data << uint32(Damage);
data << uint32(OverHeal);
data << uint32(Absorb); // Absorb amount
data << uint32(healInfo.GetSpellInfo()->Id);
data << uint32(healInfo.GetHeal());
data << uint32(overheal);
data << uint32(healInfo.GetAbsorb()); // Absorb amount
data << uint8(critical ? 1 : 0);
data << uint8(0); // unused
SendMessageToSet(&data, true);
@@ -11210,7 +11223,9 @@ int32 Unit::HealBySpell(HealInfo& healInfo, bool critical)
CalcHealAbsorb(healInfo);
int32 gain = Unit::DealHeal(healInfo.GetHealer(), healInfo.GetTarget(), healInfo.GetHeal());
SendHealSpellLog(healInfo.GetTarget(), healInfo.GetSpellInfo()->Id, healInfo.GetHeal(), uint32(healInfo.GetHeal() - gain), healInfo.GetAbsorb(), critical);
healInfo.SetEffectiveHeal(gain);
SendHealSpellLog(healInfo, critical);
return gain;
}
@@ -16538,7 +16553,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u
case SPELL_AURA_DUMMY:
{
LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting spell id {} (triggered by {} dummy aura of spell {})", spellInfo->Id, (isVictim ? "a victim's" : "an attacker's"), triggeredByAura->GetId());
if (HandleDummyAuraProc(target, damage, triggeredByAura, procSpellInfo, procFlag, procExtra, cooldown, procSpell))
if (HandleDummyAuraProc(target, damage, triggeredByAura, procSpellInfo, procFlag, procExtra, cooldown, eventInfo))
takeCharges = true;
break;
}