mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 05:06:24 +00:00
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)and2b1b36f561 (diff-ea612aafadff90005e88b243eb000369be9e5cb6f8dc85a008d31e42b156e0ec)
This commit is contained in:
@@ -8409,28 +8409,8 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
|
||||
break;
|
||||
case SPELLFAMILY_WARLOCK:
|
||||
{
|
||||
// Drain Soul
|
||||
if (auraSpellInfo->SpellFamilyFlags[0] & 0x4000)
|
||||
{
|
||||
// Improved Drain Soul
|
||||
Unit::AuraEffectList const& mAddFlatModifier = GetAuraEffectsByType(SPELL_AURA_DUMMY);
|
||||
for (Unit::AuraEffectList::const_iterator i = mAddFlatModifier.begin(); i != mAddFlatModifier.end(); ++i)
|
||||
{
|
||||
if ((*i)->GetMiscValue() == SPELLMOD_CHANCE_OF_SUCCESS && (*i)->GetSpellInfo()->SpellIconID == 113)
|
||||
{
|
||||
int32 value2 = CalculateSpellDamage(this, (*i)->GetSpellInfo(), 2);
|
||||
basepoints0 = int32(CalculatePct(GetMaxPower(POWER_MANA), value2));
|
||||
// Drain Soul
|
||||
CastCustomSpell(this, 18371, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Not remove charge (aura removed on death in any cases)
|
||||
// Need for correct work Drain Soul SPELL_AURA_CHANNEL_DEATH_ITEM aura
|
||||
return false;
|
||||
}
|
||||
// Nether Protection
|
||||
else if (auraSpellInfo->SpellIconID == 1985)
|
||||
if (auraSpellInfo->SpellIconID == 1985)
|
||||
{
|
||||
if (!procSpell)
|
||||
return false;
|
||||
|
||||
@@ -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)));
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
|
||||
enum WarlockSpells
|
||||
{
|
||||
SPELL_WARLOCK_DRAIN_SOUL_R1 = 1120,
|
||||
SPELL_WARLOCK_CREATE_SOULSHARD = 43836,
|
||||
SPELL_WARLOCK_CURSE_OF_DOOM_EFFECT = 18662,
|
||||
SPELL_WARLOCK_DEMONIC_CIRCLE_SUMMON = 48018,
|
||||
SPELL_WARLOCK_DEMONIC_CIRCLE_TELEPORT = 48020,
|
||||
@@ -40,6 +42,8 @@ enum WarlockSpells
|
||||
SPELL_WARLOCK_DEMONIC_EMPOWERMENT_FELHUNTER = 54509,
|
||||
SPELL_WARLOCK_DEMONIC_EMPOWERMENT_IMP = 54444,
|
||||
SPELL_WARLOCK_FEL_SYNERGY_HEAL = 54181,
|
||||
SPELL_WARLOCK_GLYPH_OF_DRAIN_SOUL_AURA = 58070,
|
||||
SPELL_WARLOCK_GLYPH_OF_DRAIN_SOUL_PROC = 58068,
|
||||
SPELL_WARLOCK_GLYPH_OF_SHADOWFLAME = 63311,
|
||||
SPELL_WARLOCK_GLYPH_OF_SIPHON_LIFE = 56216,
|
||||
SPELL_WARLOCK_HAUNT = 48181,
|
||||
@@ -54,7 +58,9 @@ enum WarlockSpells
|
||||
SPELL_WARLOCK_LIFE_TAP_ENERGIZE_2 = 32553,
|
||||
SPELL_WARLOCK_SOULSHATTER = 32835,
|
||||
SPELL_WARLOCK_SIPHON_LIFE_HEAL = 63106,
|
||||
SPELL_WARLOCK_UNSTABLE_AFFLICTION_DISPEL = 31117
|
||||
SPELL_WARLOCK_UNSTABLE_AFFLICTION_DISPEL = 31117,
|
||||
SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_R1 = 18213,
|
||||
SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_PROC = 18371
|
||||
};
|
||||
|
||||
enum WarlockSpellIcons
|
||||
@@ -1367,6 +1373,92 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
// -1120 - Drain Soul
|
||||
class spell_warl_drain_soul : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warl_drain_soul() : SpellScriptLoader("spell_warl_drain_soul") { }
|
||||
|
||||
class spell_warl_drain_soul_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_warl_drain_soul_AuraScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo(
|
||||
{
|
||||
SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_R1,
|
||||
SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_PROC,
|
||||
SPELL_WARLOCK_CREATE_SOULSHARD,
|
||||
SPELL_WARLOCK_GLYPH_OF_DRAIN_SOUL_AURA,
|
||||
SPELL_WARLOCK_GLYPH_OF_DRAIN_SOUL_PROC
|
||||
});
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
// Drain Soul's proc tries to happen each time the warlock lands a killing blow on a unit while channeling.
|
||||
// Make sure that the dying unit is afflicted by the caster's Drain Soul debuff in order to avoid a false positive.
|
||||
|
||||
Unit* caster = GetCaster();
|
||||
Unit* victim = eventInfo.GetProcTarget();
|
||||
|
||||
if (caster && victim)
|
||||
{
|
||||
return victim->GetAuraApplicationOfRankedSpell(SPELL_WARLOCK_DRAIN_SOUL_R1, caster->GetGUID()) != 0;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
Unit* caster = eventInfo.GetActor();
|
||||
// Improved Drain Soul.
|
||||
if (Aura const* impDrainSoul = caster->GetAuraOfRankedSpell(SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_R1, caster->GetGUID()))
|
||||
{
|
||||
int32 amount = CalculatePct(caster->GetMaxPower(POWER_MANA), impDrainSoul->GetSpellInfo()->Effects[EFFECT_2].CalcValue());
|
||||
caster->CastCustomSpell(SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_PROC, SPELLVALUE_BASE_POINT0, amount, caster, true, nullptr, aurEff, caster->GetGUID());
|
||||
}
|
||||
}
|
||||
|
||||
void HandleTick(AuraEffect const* aurEff)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
Unit* target = GetTarget();
|
||||
|
||||
if (caster && caster->GetTypeId() == TYPEID_PLAYER && caster->ToPlayer()->isHonorOrXPTarget(target))
|
||||
{
|
||||
if (roll_chance_i(20))
|
||||
{
|
||||
caster->CastSpell(caster, SPELL_WARLOCK_CREATE_SOULSHARD, aurEff);
|
||||
// Glyph of Drain Soul - chance to create an additional Soul Shard.
|
||||
if (AuraEffect* aur = caster->GetAuraEffect(SPELL_WARLOCK_GLYPH_OF_DRAIN_SOUL_AURA, EFFECT_0))
|
||||
{
|
||||
if (roll_chance_i(aur->GetMiscValue()))
|
||||
{
|
||||
caster->CastSpell(caster, SPELL_WARLOCK_CREATE_SOULSHARD, aur);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
DoCheckProc += AuraCheckProcFn(spell_warl_drain_soul_AuraScript::CheckProc);
|
||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_warl_drain_soul_AuraScript::HandleTick, EFFECT_1, SPELL_AURA_PERIODIC_DAMAGE);
|
||||
OnEffectProc += AuraEffectProcFn(spell_warl_drain_soul_AuraScript::HandleProc, EFFECT_2, SPELL_AURA_PROC_TRIGGER_SPELL);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const override
|
||||
{
|
||||
return new spell_warl_drain_soul_AuraScript();
|
||||
}
|
||||
};
|
||||
void AddSC_warlock_spell_scripts()
|
||||
{
|
||||
// Ours
|
||||
@@ -1399,4 +1491,5 @@ void AddSC_warlock_spell_scripts()
|
||||
new spell_warl_siphon_life();
|
||||
new spell_warl_soulshatter();
|
||||
new spell_warl_unstable_affliction();
|
||||
new spell_warl_drain_soul();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user