mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Move pestilence to spellscripts
Fixes crash and warnings introduced in d4bbc26261
Fixes a bug that allowed dks to spread diseases using another dks diseases
Closes: https://github.com/TrinityCore/TrinityCore/issues/12245
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
--
|
||||
DELETE FROM `spell_script_names` WHERE `spell_id` = 50842;
|
||||
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (50842, 'spell_dk_pestilence');
|
||||
@@ -379,8 +379,9 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]=
|
||||
AuraEffect::AuraEffect(Aura* base, uint8 effIndex, int32 *baseAmount, Unit* caster):
|
||||
m_base(base), m_spellInfo(base->GetSpellInfo()),
|
||||
m_baseAmount(baseAmount ? *baseAmount : m_spellInfo->Effects[effIndex].BasePoints),
|
||||
m_damage(0), m_critChance(0.0f), m_donePct(1.0f),
|
||||
m_spellmod(NULL), m_periodicTimer(0), m_tickNumber(0), m_effIndex(effIndex),
|
||||
m_canBeRecalculated(true), m_damage(0), m_critChance(0.0f), m_donePct(1.0f), m_isPeriodic(false)
|
||||
m_canBeRecalculated(true), m_isPeriodic(false)
|
||||
{
|
||||
CalculatePeriodic(caster, true, false);
|
||||
|
||||
|
||||
@@ -4049,51 +4049,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SPELLFAMILY_DEATHKNIGHT:
|
||||
{
|
||||
// Pestilence
|
||||
if (m_spellInfo->SpellFamilyFlags[1]&0x10000)
|
||||
{
|
||||
// Get diseases on target of spell
|
||||
if (m_targets.GetUnitTarget() && // Glyph of Disease - cast on unit target too to refresh aura
|
||||
(m_targets.GetUnitTarget() != unitTarget || m_caster->HasAura(63334)))
|
||||
{
|
||||
// And spread them on target
|
||||
// Blood Plague
|
||||
if (m_targets.GetUnitTarget()->HasAura(55078))
|
||||
{
|
||||
AuraEffect* aurEffOld = m_targets.GetUnitTarget()->GetAura(55078)->GetEffect(0);
|
||||
float donePct = aurEffOld->GetDonePct();
|
||||
float critChance = aurEffOld->GetCritChance();
|
||||
|
||||
m_caster->CastSpell(unitTarget, 55078, true);
|
||||
|
||||
if (unitTarget->HasAura(55078))
|
||||
if (AuraEffect* aurEffNew = unitTarget->GetAura(55078)->GetEffect(0))
|
||||
{
|
||||
aurEffNew->SetCritChance(critChance); // Blood Plague can crit if caster has T9.
|
||||
aurEffNew->SetDonePct(donePct);
|
||||
aurEffNew->SetDamage(m_caster->SpellDamageBonusDone(unitTarget, aurEffNew->GetSpellInfo(), std::max(aurEffNew->GetAmount(), 0), DOT) * donePct);
|
||||
}
|
||||
}
|
||||
// Frost Fever
|
||||
if (m_targets.GetUnitTarget()->HasAura(55095))
|
||||
{
|
||||
float donePct = m_targets.GetUnitTarget()->GetAura(55095)->GetEffect(0)->GetDonePct();
|
||||
|
||||
m_caster->CastSpell(unitTarget, 55095, true);
|
||||
|
||||
if (unitTarget->HasAura(55095))
|
||||
if (AuraEffect* aurEffNew = unitTarget->GetAura(55095)->GetEffect(0))
|
||||
{
|
||||
aurEffNew->SetDonePct(donePct);
|
||||
aurEffNew->SetDamage(m_caster->SpellDamageBonusDone(unitTarget, aurEffNew->GetSpellInfo(), std::max(aurEffNew->GetAmount(), 0), DOT) * donePct);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// normal DB scripted effect
|
||||
|
||||
@@ -39,9 +39,11 @@ enum DeathKnightSpells
|
||||
SPELL_DK_DEATH_COIL_DAMAGE = 47632,
|
||||
SPELL_DK_DEATH_COIL_HEAL = 47633,
|
||||
SPELL_DK_DEATH_STRIKE_HEAL = 45470,
|
||||
SPELL_DK_FROST_FEVER = 55095,
|
||||
SPELL_DK_FROST_PRESENCE = 48263,
|
||||
SPELL_DK_FROST_PRESENCE_TRIGGERED = 61261,
|
||||
SPELL_DK_GHOUL_EXPLODE = 47496,
|
||||
SPELL_DK_GLYPH_OF_DISEASE = 63334,
|
||||
SPELL_DK_GLYPH_OF_ICEBOUND_FORTITUDE = 58625,
|
||||
SPELL_DK_IMPROVED_BLOOD_PRESENCE_R1 = 50365,
|
||||
SPELL_DK_IMPROVED_FROST_PRESENCE_R1 = 50384,
|
||||
@@ -51,6 +53,7 @@ enum DeathKnightSpells
|
||||
SPELL_DK_ITEM_SIGIL_VENGEFUL_HEART = 64962,
|
||||
SPELL_DK_ITEM_T8_MELEE_4P_BONUS = 64736,
|
||||
SPELL_DK_MASTER_OF_GHOULS = 52143,
|
||||
SPELL_DK_BLOOD_PLAGUE = 55078,
|
||||
SPELL_DK_RAISE_DEAD_USE_REAGENT = 48289,
|
||||
SPELL_DK_RUNIC_POWER_ENERGIZE = 49088,
|
||||
SPELL_DK_SCENT_OF_BLOOD = 50422,
|
||||
@@ -933,6 +936,91 @@ class spell_dk_improved_unholy_presence : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
// ID - 50842 Pestilence
|
||||
class spell_dk_pestilence : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_dk_pestilence() : SpellScriptLoader("spell_dk_pestilence") { }
|
||||
|
||||
class spell_dk_pestilence_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_dk_pestilence_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* spellInfo) override
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_DK_GLYPH_OF_DISEASE)
|
||||
|| !sSpellMgr->GetSpellInfo(SPELL_DK_BLOOD_PLAGUE)
|
||||
|| !sSpellMgr->GetSpellInfo(SPELL_DK_FROST_FEVER))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void OnHit(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
Unit* hitUnit = GetHitUnit();
|
||||
Unit* victim = GetExplTargetUnit();
|
||||
|
||||
if (!victim)
|
||||
return;
|
||||
|
||||
if (victim != hitUnit || caster->HasAura(SPELL_DK_GLYPH_OF_DISEASE))
|
||||
{
|
||||
if (Aura* aurOld = victim->GetAura(SPELL_DK_BLOOD_PLAGUE, caster->GetGUID())) // Check Blood Plague application on victim.
|
||||
{
|
||||
if (AuraEffect* aurEffOld = aurOld->GetEffect(EFFECT_0))
|
||||
{
|
||||
float donePct = aurEffOld->GetDonePct();
|
||||
float critChance = aurEffOld->GetCritChance();
|
||||
|
||||
caster->CastSpell(hitUnit, SPELL_DK_BLOOD_PLAGUE, true); // Spread the disease to hitUnit.
|
||||
|
||||
if (Aura* aurNew = hitUnit->GetAura(SPELL_DK_BLOOD_PLAGUE, caster->GetGUID())) // Check Blood Plague application on hitUnit.
|
||||
{
|
||||
if (AuraEffect* aurEffNew = aurNew->GetEffect(EFFECT_0))
|
||||
{
|
||||
aurEffNew->SetCritChance(critChance); // Blood Plague can crit if caster has T9.
|
||||
aurEffNew->SetDonePct(donePct);
|
||||
aurEffNew->SetDamage(caster->SpellDamageBonusDone(hitUnit, aurEffNew->GetSpellInfo(), std::max(aurEffNew->GetAmount(), NULL), DOT) * donePct);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Aura* aurOld = victim->GetAura(SPELL_DK_FROST_FEVER, caster->GetGUID())) // Check Frost Fever application on victim.
|
||||
{
|
||||
if (AuraEffect* aurEffOld = aurOld->GetEffect(EFFECT_0))
|
||||
{
|
||||
float donePct = aurEffOld->GetDonePct();
|
||||
|
||||
caster->CastSpell(hitUnit, SPELL_DK_FROST_FEVER, true); // Spread the disease to hitUnit.
|
||||
|
||||
if (Aura* aurNew = hitUnit->GetAura(SPELL_DK_FROST_FEVER, caster->GetGUID())) // Check Frost Fever application on hitUnit.
|
||||
{
|
||||
if (AuraEffect* aurEffNew = aurNew->GetEffect(EFFECT_0))
|
||||
{
|
||||
aurEffNew->SetDonePct(donePct);
|
||||
aurEffNew->SetDamage(caster->SpellDamageBonusDone(hitUnit, aurEffNew->GetSpellInfo(), std::max(aurEffNew->GetAmount(), NULL), DOT) * donePct);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_dk_pestilence_SpellScript::OnHit, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const override
|
||||
{
|
||||
return new spell_dk_pestilence_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 48266 - Blood Presence
|
||||
// 48263 - Frost Presence
|
||||
// 48265 - Unholy Presence
|
||||
@@ -1467,6 +1555,7 @@ void AddSC_deathknight_spell_scripts()
|
||||
new spell_dk_improved_blood_presence();
|
||||
new spell_dk_improved_frost_presence();
|
||||
new spell_dk_improved_unholy_presence();
|
||||
new spell_dk_pestilence();
|
||||
new spell_dk_presence();
|
||||
new spell_dk_raise_dead();
|
||||
new spell_dk_rune_tap_party();
|
||||
|
||||
Reference in New Issue
Block a user