Skip to content

Commit

Permalink
Spell/Unit: Migrate a lot of wotlk only scripts to spell scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Sep 28, 2023
1 parent d139f9a commit a997cda
Show file tree
Hide file tree
Showing 6 changed files with 151 additions and 149 deletions.
30 changes: 29 additions & 1 deletion sql/scriptdev2/spell.sql
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(28851,'spell_increased_healing_done_dummy'),
(28853,'spell_increased_healing_done_dummy'),
(27859,'spell_increased_spell_damage_done_dummy'),
(28854,'spell_increased_spell_damage_done_dummy'),
(28857,'spell_increased_spell_damage_done_dummy'),
(21056,'spell_mark_of_lord_kazzak'),
(21063,'spell_twisted_reflection'),
Expand Down Expand Up @@ -598,7 +599,6 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(33556,'spell_increased_spell_damage_done_dummy'),
(34230,'spell_increased_spell_damage_done_dummy'),
(41040,'spell_increased_spell_damage_done_dummy'),
(28854,'spell_increased_spell_damage_done_dummy'),
(34252,'spell_increased_spell_damage_done_dummy'),
(34292,'spell_increased_spell_damage_done_dummy'),
(28695,'spell_gameobject_call_for_help_on_usage'), -- Herb Gathering (Master)
Expand Down Expand Up @@ -880,6 +880,9 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(59915,'spell_discerning_eye_of_the_beast'),
(60211,'spell_cauterize'),
(60539,'spell_sapphiron_achievement_check'),
(60772,'spell_increased_spell_damage_done_dummy'),
(60775,'spell_increased_spell_damage_done_dummy'),
(60779,'spell_increased_healing_done_dummy'),
(60929,'spell_loatheb_prewarn'),
(61071,'spell_vortex_aura'),
(61072,'spell_vortex_aura'),
Expand Down Expand Up @@ -1042,6 +1045,18 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(48707,'spell_anti_magic_shell_absorb_self'),
(50462,'spell_anti_magic_shell_zone'),
(50461,'spell_anti_zone_absorb'),
(49024,'spell_merciless_combat'),
(49538,'spell_merciless_combat'),
(49202,'spell_tundra_stalker'),
(50127,'spell_tundra_stalker'),
(50128,'spell_tundra_stalker'),
(50129,'spell_tundra_stalker'),
(50130,'spell_tundra_stalker'),
(50117,'spell_rage_of_rivendare'),
(50118,'spell_rage_of_rivendare'),
(50119,'spell_rage_of_rivendare'),
(50120,'spell_rage_of_rivendare'),
(50121,'spell_rage_of_rivendare'),
(55090,'spell_scourge_strike'),
(55265,'spell_scourge_strike'),
(55270,'spell_scourge_strike'),
Expand Down Expand Up @@ -1074,6 +1089,11 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(60051,'spell_explosive_shot'),
(60052,'spell_explosive_shot'),
(60053,'spell_explosive_shot'),
(53241,'spell_marked_for_death_hunter'),
(53243,'spell_marked_for_death_hunter'),
(53244,'spell_marked_for_death_hunter'),
(53245,'spell_marked_for_death_hunter'),
(53246,'spell_marked_for_death_hunter'),
(781,'spell_disengage');

-- Priest
Expand Down Expand Up @@ -1114,6 +1134,11 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(63504,'spell_improved_flash_heal'),
(63505,'spell_improved_flash_heal'),
(63506,'spell_improved_flash_heal'),
(47573,'spell_twisted_faith'),
(47577,'spell_twisted_faith'),
(47578,'spell_twisted_faith'),
(51166,'spell_twisted_faith'),
(51167,'spell_twisted_faith'),
(34861,'spell_circle_of_healing'),
(34863,'spell_circle_of_healing'),
(34864,'spell_circle_of_healing'),
Expand Down Expand Up @@ -1234,6 +1259,9 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(54053,'spell_shadow_bite'),
(63108,'spell_siphon_life_wotlk'),
(56229,'spell_glyph_of_shadowburn'),
(47198,'spell_deaths_embrace'),
(47199,'spell_deaths_embrace'),
(47200,'spell_deaths_embrace'),
(48018,'spell_demonic_circle_summon'),
(48020,'spell_demonic_circle_teleport');

Expand Down
148 changes: 0 additions & 148 deletions src/game/Entities/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8024,92 +8024,6 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellSchoolMask schoolMask, Spel
i->OnDamageCalculate(this, victim, DoneAdvertisedBenefit, DoneTotalMod);
}

AuraList const& mOverrideClassScript = owner->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
for (auto i : mOverrideClassScript)
{
if (!i->isAffectedOnSpell(spellInfo))
continue;
switch (i->GetModifier()->m_miscvalue)
{
case 6917: // Death's Embrace
case 6926:
case 6928:
{
if (victim->HasAuraState(AURA_STATE_HEALTHLESS_20_PERCENT))
DoneTotalMod *= (100.0f + i->GetModifier()->m_amount) / 100.0f;
break;
}
case 6916: // Death's Embrace
case 6925:
case 6927:
if (HasAuraState(AURA_STATE_HEALTHLESS_20_PERCENT))
DoneTotalMod *= (100.0f + i->GetModifier()->m_amount) / 100.0f;
break;
case 5481: // Starfire Bonus
{
if (victim->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, uint64(0x0000000000200002)))
DoneTotalMod *= (i->GetModifier()->m_amount + 100.0f) / 100.0f;
break;
}
// Subject to downranking, i.e. normal per spell spelldamage
case 4418: // Increased Shock Damage
case 4554: // Increased Lightning Damage
case 4555: // Improved Moonfire
case 5142: // Increased Lightning Damage
case 5147: // Improved Consecration / Libram of Resurgence
case 5148: // Idol of the Shooting Star
case 6008: // Increased Lightning Damage
case 8627: // Totem of Hex
{
DoneAdvertisedBenefit += i->GetModifier()->m_amount;
break;
}
// Tundra Stalker
// Merciless Combat
case 7277:
{
// Merciless Combat
if (i->GetSpellProto()->SpellIconID == 2656)
{
if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT))
DoneTotalMod *= (100.0f + i->GetModifier()->m_amount) / 100.0f;
}
else // Tundra Stalker
{
// Frost Fever (target debuff)
if (victim->GetAura(SPELL_AURA_MOD_MELEE_HASTE, SPELLFAMILY_DEATHKNIGHT, uint64(0x0000000000000000), 0x00000002))
DoneTotalMod *= (i->GetModifier()->m_amount + 100.0f) / 100.0f;
break;
}
break;
}
case 7293: // Rage of Rivendare
{
if (victim->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DEATHKNIGHT, uint64(0x0200000000000000)))
DoneTotalMod *= (i->GetModifier()->m_amount + 100.0f) / 100.0f;
break;
}
// Twisted Faith
case 7377:
{
if (victim->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, uint64(0x0000000000008000), 0, GetObjectGuid()))
DoneTotalMod *= (i->GetModifier()->m_amount + 100.0f) / 100.0f;
break;
}
// Marked for Death
case 7598:
case 7599:
case 7600:
case 7601:
case 7602:
{
if (victim->GetAura(SPELL_AURA_MOD_STALKED, SPELLFAMILY_HUNTER, uint64(0x0000000000000400)))
DoneTotalMod *= (i->GetModifier()->m_amount + 100.0f) / 100.0f;
break;
}
}
}

// Custom scripted damage
switch (spellInfo->SpellFamilyName)
{
Expand Down Expand Up @@ -8478,19 +8392,6 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellEntry const* spellInfo, in
}
}

AuraList const& auraDummy = owner->GetAurasByType(SPELL_AURA_DUMMY);
for (auto i : auraDummy)
{
if (!i->isAffectedOnSpell(spellInfo))
continue;
switch (i->GetSpellProto()->Id)
{
case 60779: // Idol of Lush Moss
DoneAdvertisedBenefit += i->GetModifier()->m_amount;
break;
}
}

for (auto i : GetScriptedLocationAuras(SCRIPT_LOCATION_SPELL_HEALING_DONE))
{
if (!i->isAffectedOnSpell(spellInfo))
Expand Down Expand Up @@ -8868,55 +8769,6 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType
DoneTotalMod *= (i->GetModifier()->m_amount + 100.0f) / 100.0f;
}

if (spellInfo)
{
// .. done (class scripts)
AuraList const& mOverrideClassScript = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
for (auto i : mOverrideClassScript)
{
if (!(i->isAffectedOnSpell(spellInfo)))
continue;
switch (i->GetMiscValue())
{
// Tundra Stalker
case 7277: // Merciless Combat
{
// Merciless Combat
if (i->GetSpellProto()->SpellIconID == 2656)
{
if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT))
DoneTotalMod *= (100.0f + i->GetModifier()->m_amount) / 100.0f;
}
else // Tundra Stalker
{
// Frost Fever (target debuff)
if (victim->GetAura(SPELL_AURA_MOD_MELEE_HASTE, SPELLFAMILY_DEATHKNIGHT, uint64(0x0000000000000000), 0x00000002))
DoneTotalMod *= (i->GetModifier()->m_amount + 100.0f) / 100.0f;
break;
}
break;
}
case 7293: // Rage of Rivendare
{
if (victim->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DEATHKNIGHT, uint64(0x0200000000000000)))
DoneTotalMod *= (i->GetModifier()->m_amount + 100.0f) / 100.0f;
break;
}
// Marked for Death
case 7598:
case 7599:
case 7600:
case 7601:
case 7602:
{
if (victim->GetAura(SPELL_AURA_MOD_STALKED, SPELLFAMILY_HUNTER, uint64(0x0000000000000400)))
DoneTotalMod *= (i->GetModifier()->m_amount + 100.0f) / 100.0f;
break;
}
}
}
}

if (spellInfo)
{
// Frost Strike
Expand Down
59 changes: 59 additions & 0 deletions src/game/Spells/Scripts/Scripting/ClassScripts/DeathKnight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,62 @@ struct GargoyleDeathKnightAI : public CombatAI
}
};

// 49024 - Merciless Combat
struct MercilessCombat : public AuraScript
{
void OnApply(Aura* aura, bool apply) const override
{
aura->GetTarget()->RegisterScriptedLocationAura(aura, SCRIPT_LOCATION_SPELL_DAMAGE_DONE, apply);
aura->GetTarget()->RegisterScriptedLocationAura(aura, SCRIPT_LOCATION_MELEE_DAMAGE_DONE, apply);
}

void OnDamageCalculate(Aura* aura, Unit* /*attacker*/, Unit* victim, int32& /*advertisedBenefit*/, float& totalMod) const override
{
if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT))
totalMod *= (100.0f + aura->GetModifier()->m_amount) / 100.0f;
}
};

// 49202 - Tundra Stalker
struct TundraStalker : public AuraScript
{
void OnApply(Aura* aura, bool apply) const override
{
if (aura->GetEffIndex() == EFFECT_INDEX_0)
{
aura->GetTarget()->RegisterScriptedLocationAura(aura, SCRIPT_LOCATION_SPELL_DAMAGE_DONE, apply);
aura->GetTarget()->RegisterScriptedLocationAura(aura, SCRIPT_LOCATION_MELEE_DAMAGE_DONE, apply);
}
}

void OnDamageCalculate(Aura* aura, Unit* /*attacker*/, Unit* victim, int32& /*advertisedBenefit*/, float& totalMod) const override
{
// Frost Fever (target debuff)
if (victim->GetAura(SPELL_AURA_MOD_MELEE_HASTE, SPELLFAMILY_DEATHKNIGHT, uint64(0x0000000000000000), 0x00000002))
totalMod *= (aura->GetModifier()->m_amount + 100.0f) / 100.0f;
}
};

// 50117 - Rage of Rivendare
struct RageOfRivendare : public AuraScript
{
void OnApply(Aura* aura, bool apply) const override
{
if (aura->GetEffIndex() == EFFECT_INDEX_0)
{
aura->GetTarget()->RegisterScriptedLocationAura(aura, SCRIPT_LOCATION_SPELL_DAMAGE_DONE, apply);
aura->GetTarget()->RegisterScriptedLocationAura(aura, SCRIPT_LOCATION_MELEE_DAMAGE_DONE, apply);
}
}

void OnDamageCalculate(Aura* aura, Unit* /*attacker*/, Unit* victim, int32& /*advertisedBenefit*/, float& totalMod) const override
{
// Blood Plague (target debuff)
if (victim->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DEATHKNIGHT, uint64(0x0200000000000000)))
totalMod *= (aura->GetModifier()->m_amount + 100.0f) / 100.0f;
}
};

void LoadDeathKnightScripts()
{
RegisterSpellScript<ScourgeStrike>("spell_scourge_strike");
Expand All @@ -631,6 +687,9 @@ void LoadDeathKnightScripts()
RegisterSpellScript<AntiMagicShellAbsorbSelf>("spell_anti_magic_shell_absorb_self");
RegisterSpellScript<AntiMagicShellZone>("spell_anti_magic_shell_zone");
RegisterSpellScript<AntiMagicZoneAbsorb>("spell_anti_zone_absorb");
RegisterSpellScript<MercilessCombat>("spell_merciless_combat");
RegisterSpellScript<TundraStalker>("spell_tundra_stalker");
RegisterSpellScript<RageOfRivendare>("spell_rage_of_rivendare");

Script* pNewScript = new Script;
pNewScript->Name = "npc_gargoyle_dk";
Expand Down
21 changes: 21 additions & 0 deletions src/game/Spells/Scripts/Scripting/ClassScripts/Hunter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,26 @@ struct LockAndLoadTrigger : public SpellScript
}
};

// 53241 - Marked For Death
struct MarkedForDeathHunter : public AuraScript
{
void OnApply(Aura* aura, bool apply) const override
{
if (aura->GetEffIndex() == EFFECT_INDEX_0)
{
aura->GetTarget()->RegisterScriptedLocationAura(aura, SCRIPT_LOCATION_SPELL_DAMAGE_DONE, apply);
aura->GetTarget()->RegisterScriptedLocationAura(aura, SCRIPT_LOCATION_MELEE_DAMAGE_DONE, apply);
}
}

void OnDamageCalculate(Aura* aura, Unit* /*attacker*/, Unit* victim, int32& /*advertisedBenefit*/, float& totalMod) const override
{
// Hunter's Mark
if (victim->GetAura(SPELL_AURA_MOD_STALKED, SPELLFAMILY_HUNTER, uint64(0x0000000000000400)))
totalMod *= (aura->GetModifier()->m_amount + 100.0f) / 100.0f;
}
};

void LoadHunterScripts()
{
RegisterSpellScript<Entrapment>("spell_entrapment");
Expand All @@ -206,4 +226,5 @@ void LoadHunterScripts()
RegisterSpellScript<ExplosiveShot>("spell_explosive_shot");
RegisterSpellScript<LockAndLoad>("spell_lock_and_load");
RegisterSpellScript<LockAndLoadTrigger>("spell_lock_and_load_trigger");
RegisterSpellScript<MarkedForDeathHunter>("spell_marked_for_death_hunter");
}
18 changes: 18 additions & 0 deletions src/game/Spells/Scripts/Scripting/ClassScripts/Priest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,23 @@ struct ImprovedFlashHeal : public AuraScript
}
};

// 47573 - TwistedFaith
struct TwistedFaith : public AuraScript
{
void OnApply(Aura* aura, bool apply) const override
{
if (aura->GetEffIndex() == EFFECT_INDEX_1)
aura->GetTarget()->RegisterScriptedLocationAura(aura, SCRIPT_LOCATION_SPELL_DAMAGE_DONE, apply);
}

void OnDamageCalculate(Aura* aura, Unit* /*attacker*/, Unit* victim, int32& /*advertisedBenefit*/, float& totalMod) const override
{
// Shadow Word: Pain
if (victim->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, uint64(0x0000000000008000), 0, aura->GetTarget()->GetObjectGuid()))
totalMod *= (aura->GetModifier()->m_amount + 100.0f) / 100.0f;
}
};

void LoadPriestScripts()
{
RegisterSpellScript<PowerInfusion>("spell_power_infusion");
Expand All @@ -428,4 +445,5 @@ void LoadPriestScripts()
RegisterSpellScript<RenewedHope>("spell_renewed_hope");
RegisterSpellScript<RenewedHopeDamageTaken>("spell_renewed_hope_damage_taken");
RegisterSpellScript<ImprovedFlashHeal>("spell_improved_flash_heal");
RegisterSpellScript<TwistedFaith>("spell_twisted_faith");
}
Loading

0 comments on commit a997cda

Please sign in to comment.