Skip to content

Commit e8c42b5

Browse files
authored
Scripts/Spells: Implement priest talent Death's Torment (TrinityCore#31487)
1 parent 1aab5cf commit e8c42b5

2 files changed

Lines changed: 75 additions & 0 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_pri_deaths_torment');
2+
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
3+
(1240364,'spell_pri_deaths_torment');
4+
5+
DELETE FROM `spell_proc` WHERE `SpellId` IN (1240364);
6+
INSERT INTO `spell_proc` (`SpellId`,`SchoolMask`,`SpellFamilyName`,`SpellFamilyMask0`,`SpellFamilyMask1`,`SpellFamilyMask2`,`SpellFamilyMask3`,`ProcFlags`,`ProcFlags2`,`SpellTypeMask`,`SpellPhaseMask`,`HitMask`,`AttributesMask`,`DisableEffectsMask`,`ProcsPerMinute`,`Chance`,`Cooldown`,`Charges`) VALUES
7+
(1240364,0x00,6,0x00000000,0x00000002,0x00000000,0x00000000,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0,0,0,0); -- Death's Torment

src/server/scripts/Spells/spell_priest.cpp

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,56 @@ class spell_pri_dark_indulgence : public SpellScript
999999
}
10001000
};
10011001

1002+
// 1240364 - Death's Torment
1003+
class spell_pri_deaths_torment : public AuraScript
1004+
{
1005+
public:
1006+
struct Data
1007+
{
1008+
int32 DamagePct = 0;
1009+
int32 BacklashPct = 10; // for some weird reason its 10% for backlash, not 15%
1010+
int32 EnergizePct = 25; // for some weird reason its 25% for energize, not 15%
1011+
};
1012+
1013+
bool Validate(SpellInfo const* spellInfo) override
1014+
{
1015+
return ValidateSpellInfo({ SPELL_PRIEST_SHADOW_WORD_DEATH })
1016+
&& ValidateSpellEffect({ { spellInfo->Id, EFFECT_1 } });
1017+
}
1018+
1019+
static bool CheckProc(AuraScript const&, ProcEventInfo const& eventInfo)
1020+
{
1021+
return eventInfo.GetProcSpell()->m_customArg.type() != typeid(Data);
1022+
}
1023+
1024+
void HandleProc(ProcEventInfo const& eventInfo) const
1025+
{
1026+
Unit* caster = eventInfo.GetActor();
1027+
Unit* target = eventInfo.GetActionTarget();
1028+
1029+
int32 maxHits = GetEffect(EFFECT_0)->GetAmount();
1030+
int32 effectiveness = GetEffect(EFFECT_1)->GetAmount();
1031+
1032+
for (int32 i = 1; i <= maxHits; ++i)
1033+
{
1034+
caster->m_Events.AddEventAtOffset([caster, targetGuid = target->GetGUID(), effectiveness]
1035+
{
1036+
if (Unit* target = ObjectAccessor::GetUnit(*caster, targetGuid))
1037+
caster->CastSpell(target, SPELL_PRIEST_SHADOW_WORD_DEATH, CastSpellExtraArgsInit{
1038+
.TriggerFlags = TRIGGERED_IGNORE_GCD | TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD | TRIGGERED_IGNORE_POWER_COST | TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR,
1039+
.CustomArg = Data{ .DamagePct = effectiveness }
1040+
});
1041+
}, i * 250ms);
1042+
}
1043+
}
1044+
1045+
void Register() override
1046+
{
1047+
DoCheckProc += AuraCheckProcFn(spell_pri_deaths_torment::CheckProc);
1048+
OnProc += AuraProcFn(spell_pri_deaths_torment::HandleProc);
1049+
}
1050+
};
1051+
10021052
// 1215265 - Dispersing Light
10031053
class spell_pri_dispersing_light : public AuraScript
10041054
{
@@ -4310,6 +4360,10 @@ class spell_pri_shadow_word_death : public SpellScript
43104360
{
43114361
if (victim->HealthBelowPct(GetEffectInfo(EFFECT_2).CalcValue(GetCaster())))
43124362
AddPct(pctMod, GetEffectInfo(EFFECT_3).CalcValue(GetCaster()));
4363+
4364+
// handles Death's Torment talent
4365+
if (spell_pri_deaths_torment::Data const* deathsTorment = std::any_cast<spell_pri_deaths_torment::Data>(&GetSpell()->m_customArg))
4366+
ApplyPct(pctMod, deathsTorment->DamagePct);
43134367
}
43144368

43154369
void DetermineKillStatus(DamageInfo const& damageInfo, uint32& /*resistAmount*/, int32& /*absorbAmount*/) const
@@ -4319,6 +4373,11 @@ class spell_pri_shadow_word_death : public SpellScript
43194373
{
43204374
Unit* caster = GetCaster();
43214375
int32 backlashDamage = caster->CountPctFromMaxHealth(GetEffectInfo(EFFECT_5).CalcValue(caster));
4376+
4377+
// Death's Torment effectiveness on backlash too
4378+
if (spell_pri_deaths_torment::Data const* deathsTorment = std::any_cast<spell_pri_deaths_torment::Data>(&GetSpell()->m_customArg))
4379+
backlashDamage = CalculatePct(backlashDamage, deathsTorment->BacklashPct);
4380+
43224381
caster->m_Events.AddEventAtOffset([caster, originalCastId = GetSpell()->m_castId, backlashDamage]
43234382
{
43244383
caster->CastSpell(caster, SPELL_PRIEST_SHADOW_WORD_DEATH_DAMAGE, CastSpellExtraArgs()
@@ -4330,12 +4389,20 @@ class spell_pri_shadow_word_death : public SpellScript
43304389
}
43314390
}
43324391

4392+
void HandleDeathsTormentEnergize(SpellEffIndex /*effIndex*/)
4393+
{
4394+
if (spell_pri_deaths_torment::Data const* deathsTorment = std::any_cast<spell_pri_deaths_torment::Data>(&GetSpell()->m_customArg))
4395+
SetEffectValue(CalculatePct(GetEffectValue(), deathsTorment->EnergizePct));
4396+
}
4397+
43334398
void Register() override
43344399
{
43354400
CalcDamage += SpellCalcDamageFn(spell_pri_shadow_word_death::HandleDamageCalculation);
43364401

43374402
// abuse OnCalculateResistAbsorb to determine if this spell will kill target or not (its still not perfect - happens before absorbs are applied)
43384403
OnCalculateResistAbsorb += SpellOnResistAbsorbCalculateFn(spell_pri_shadow_word_death::DetermineKillStatus);
4404+
4405+
OnEffectHitTarget += SpellEffectFn(spell_pri_shadow_word_death::HandleDeathsTormentEnergize, EFFECT_4, SPELL_EFFECT_ENERGIZE);
43394406
}
43404407
};
43414408

@@ -5200,6 +5267,7 @@ void AddSC_priest_spell_scripts()
52005267
RegisterSpellScript(spell_pri_circle_of_healing);
52015268
RegisterSpellScript(spell_pri_crystalline_reflection);
52025269
RegisterSpellScript(spell_pri_dark_indulgence);
5270+
RegisterSpellScript(spell_pri_deaths_torment);
52035271
RegisterSpellScript(spell_pri_dispersing_light);
52045272
RegisterSpellScript(spell_pri_dispersing_light_heal);
52055273
RegisterSpellScript(spell_pri_divine_aegis);

0 commit comments

Comments
 (0)