fix(Core/Spells): Improved Drain Soul triggering from every target … (#8144)

...that dies and not just the one affected by Drain Soul and move the Drain Soul code to spell scripts

- TC Ports: d9743c984f (diff-ea612aafadff90005e88b243eb000369be9e5cb6f8dc85a008d31e42b156e0ec) and  2b1b36f561 (diff-ea612aafadff90005e88b243eb000369be9e5cb6f8dc85a008d31e42b156e0ec)
This commit is contained in:
Skjalf
2021-10-07 13:58:46 -03:00
committed by GitHub
parent d0ff62a1ab
commit 99cc428511
4 changed files with 100 additions and 56 deletions

View File

@@ -5431,7 +5431,6 @@ void AuraEffect::HandleChannelDeathItem(AuraApplication const* aurApp, uint8 mod
return;
Player* plCaster = caster->ToPlayer();
Unit* target = aurApp->GetTarget();
// Item amount
if (GetAmount() <= 0)
@@ -5440,24 +5439,6 @@ void AuraEffect::HandleChannelDeathItem(AuraApplication const* aurApp, uint8 mod
if (GetSpellInfo()->Effects[m_effIndex].ItemType == 0)
return;
// Soul Shard
if (GetSpellInfo()->Effects[m_effIndex].ItemType == 6265)
{
// Soul Shard only from units that grant XP or honor
if (!plCaster->isHonorOrXPTarget(target) ||
(target->GetTypeId() == TYPEID_UNIT && !target->ToCreature()->isTappedBy(plCaster)))
return;
// If this is Drain Soul, check for Glyph of Drain Soul
if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[0] & 0x00004000))
{
// Glyph of Drain Soul - chance to create an additional Soul Shard
if (AuraEffect* aur = caster->GetAuraEffect(58070, 0))
if (roll_chance_i(aur->GetMiscValue()))
caster->CastSpell(caster, 58068, true, 0, aur); // We _could_ simply do ++count here, but Blizz does it this way :)
}
}
//Adding items
uint32 noSpaceForCount = 0;
uint32 count = m_amount;
@@ -6308,21 +6289,6 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
damage += (damage + 1) / 2; // +1 prevent 0.5 damage possible lost at 1..4 ticks
// 5..8 ticks have normal tick damage
}
// There is a Chance to make a Soul Shard when Drain soul does damage
if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[0] & 0x00004000))
{
if (caster && caster->GetTypeId() == TYPEID_PLAYER && caster->ToPlayer()->isHonorOrXPTarget(target))
{
if (roll_chance_i(20))
{
caster->CastSpell(caster, 43836, true, 0, this);
// Glyph of Drain Soul - chance to create an additional Soul Shard
if (AuraEffect* aur = caster->GetAuraEffect(58070, 0))
if (roll_chance_i(aur->GetMiscValue()))
caster->CastSpell(caster, 58068, true, 0, aur);
}
}
}
}
else // xinef: ceil obtained value, it may happen that 10 ticks for 10% damage may not kill owner
damage = uint32(ceil(CalculatePct<float, float>(target->GetMaxHealth(), damage)));