mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Scripts/Spells: Update Unstable Affliction script (#30150)
This commit is contained in:
3
sql/updates/world/master/2024_08_31_01_world.sql
Normal file
3
sql/updates/world/master/2024_08_31_01_world.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_warl_unstable_affliction';
|
||||
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||
(316099, 'spell_warl_unstable_affliction');
|
||||
@@ -61,8 +61,8 @@ enum WarlockSpells
|
||||
SPELL_WARLOCK_SOUL_SWAP_OVERRIDE = 86211,
|
||||
SPELL_WARLOCK_SOUL_SWAP_MOD_COST = 92794,
|
||||
SPELL_WARLOCK_SOUL_SWAP_DOT_MARKER = 92795,
|
||||
SPELL_WARLOCK_UNSTABLE_AFFLICTION = 30108,
|
||||
SPELL_WARLOCK_UNSTABLE_AFFLICTION_DISPEL = 31117,
|
||||
SPELL_WARLOCK_UNSTABLE_AFFLICTION_DAMAGE = 196364,
|
||||
SPELL_WARLOCK_UNSTABLE_AFFLICTION_ENERGIZE = 31117,
|
||||
SPELL_WARLOCK_SHADOWFLAME = 37378,
|
||||
SPELL_WARLOCK_FLAMESHADOW = 37379,
|
||||
SPELL_WARLOCK_SUMMON_SUCCUBUS = 712,
|
||||
@@ -962,38 +962,42 @@ class spell_warl_t4_2p_bonus : public AuraScript
|
||||
}
|
||||
};
|
||||
|
||||
// 30108, 34438, 34439, 35183 - Unstable Affliction
|
||||
// 316099 - Unstable Affliction
|
||||
class spell_warl_unstable_affliction : public AuraScript
|
||||
{
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_WARLOCK_UNSTABLE_AFFLICTION_DISPEL });
|
||||
return ValidateSpellInfo({ SPELL_WARLOCK_UNSTABLE_AFFLICTION_DAMAGE, SPELL_WARLOCK_UNSTABLE_AFFLICTION_ENERGIZE });
|
||||
}
|
||||
|
||||
void HandleDispel(DispelInfo* dispelInfo)
|
||||
void HandleDispel(DispelInfo const* dispelInfo) const
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
{
|
||||
if (AuraEffect const* aurEff = GetEffect(EFFECT_1))
|
||||
{
|
||||
if (Unit* target = dispelInfo->GetDispeller()->ToUnit())
|
||||
{
|
||||
int32 bp = aurEff->GetAmount();
|
||||
bp = target->SpellDamageBonusTaken(caster, aurEff->GetSpellInfo(), bp, DOT);
|
||||
bp *= 9;
|
||||
Unit* caster = GetCaster();
|
||||
if (!caster)
|
||||
return;
|
||||
|
||||
// backfire damage and silence
|
||||
CastSpellExtraArgs args(aurEff);
|
||||
args.AddSpellBP0(bp);
|
||||
caster->CastSpell(target, SPELL_WARLOCK_UNSTABLE_AFFLICTION_DISPEL, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
AuraEffect const* removedEffect = GetEffect(EFFECT_1);
|
||||
if (!removedEffect)
|
||||
return;
|
||||
|
||||
int32 damage = GetEffectInfo(EFFECT_0).CalcValue(caster, nullptr, GetUnitOwner()) / 100.0f * *removedEffect->CalculateEstimatedAmount(caster, removedEffect->GetAmount());
|
||||
caster->CastSpell(dispelInfo->GetDispeller(), SPELL_WARLOCK_UNSTABLE_AFFLICTION_DAMAGE, CastSpellExtraArgs()
|
||||
.AddSpellMod(SPELLVALUE_BASE_POINT0, damage)
|
||||
.SetTriggerFlags(TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR));
|
||||
}
|
||||
|
||||
void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) const
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_DEATH)
|
||||
return;
|
||||
|
||||
GetCaster()->CastSpell(GetCaster(), SPELL_WARLOCK_UNSTABLE_AFFLICTION_ENERGIZE, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
AfterDispel += AuraDispelFn(spell_warl_unstable_affliction::HandleDispel);
|
||||
OnEffectRemove += AuraEffectRemoveFn(spell_warl_unstable_affliction::HandleRemove, EFFECT_1, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user