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:
Unholychick
2014-06-11 19:59:50 +02:00
parent 5ebf24281c
commit 52c0fc96bb
4 changed files with 94 additions and 46 deletions

View File

@@ -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