aboutsummaryrefslogtreecommitdiff
path: root/src/server/game
diff options
context:
space:
mode:
authorNay <dnpd.dd@gmail.com>2013-01-20 08:45:23 -0800
committerNay <dnpd.dd@gmail.com>2013-01-20 08:45:23 -0800
commitf4907e92aadfce433bdcc370293a2c3b967ae671 (patch)
treebcdd5f315dc101ee8f97370e584f14693008b70f /src/server/game
parentb9f901a645f6af17fc9316e68220cda76f83bea3 (diff)
parentc38d95ac33e44ea30908b5d8e8707848094dd5f0 (diff)
Merge pull request #8961 from joschiwald/spellscripts3
Core/Spells: convert some spells to SpellScripts
Diffstat (limited to 'src/server/game')
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp284
-rw-r--r--src/server/game/Spells/Spell.cpp5
-rw-r--r--src/server/game/Spells/SpellEffects.cpp191
3 files changed, 5 insertions, 475 deletions
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index da38a519917..e440b2a0fbd 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -483,112 +483,8 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
}
break;
case SPELL_AURA_SCHOOL_ABSORB:
- m_canBeRecalculated = false;
- if (!caster)
- break;
- switch (GetSpellInfo()->SpellFamilyName)
- {
- case SPELLFAMILY_MAGE:
- // Ice Barrier
- if (GetSpellInfo()->SpellFamilyFlags[1] & 0x1 && GetSpellInfo()->SpellFamilyFlags[2] & 0x8)
- {
- // +80.68% from sp bonus
- DoneActualBenefit += caster->SpellBaseDamageBonusDone(m_spellInfo->GetSchoolMask()) * 0.8068f;
- // Glyph of Ice Barrier: its weird having a SPELLMOD_ALL_EFFECTS here but its blizzards doing :)
- // Glyph of Ice Barrier is only applied at the spell damage bonus because it was already applied to the base value in CalculateSpellDamage
- DoneActualBenefit = caster->ApplyEffectModifiers(GetSpellInfo(), m_effIndex, DoneActualBenefit);
- }
- // Fire Ward
- else if (GetSpellInfo()->SpellFamilyFlags[0] & 0x8 && GetSpellInfo()->SpellFamilyFlags[2] & 0x8)
- {
- // +80.68% from sp bonus
- DoneActualBenefit += caster->SpellBaseDamageBonusDone(m_spellInfo->GetSchoolMask()) * 0.8068f;
- }
- // Frost Ward
- else if (GetSpellInfo()->SpellFamilyFlags[0] & 0x100 && GetSpellInfo()->SpellFamilyFlags[2] & 0x8)
- {
- // +80.68% from sp bonus
- DoneActualBenefit += caster->SpellBaseDamageBonusDone(m_spellInfo->GetSchoolMask()) * 0.8068f;
- }
- break;
- case SPELLFAMILY_WARLOCK:
- // Shadow Ward
- if (m_spellInfo->SpellFamilyFlags[2] & 0x40)
- {
- // +80.68% from sp bonus
- DoneActualBenefit += caster->SpellBaseDamageBonusDone(m_spellInfo->GetSchoolMask()) * 0.8068f;
- }
- break;
- case SPELLFAMILY_PRIEST:
- // Power Word: Shield
- if (GetSpellInfo()->SpellFamilyFlags[0] & 0x1 && GetSpellInfo()->SpellFamilyFlags[2] & 0x400)
- {
- // +80.68% from sp bonus
- float bonus = 0.8068f;
-
- // Borrowed Time
- if (AuraEffect const* pAurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 2899, 1))
- bonus += CalculatePct(1.0f, pAurEff->GetAmount());
-
- DoneActualBenefit += caster->SpellBaseHealingBonusDone(m_spellInfo->GetSchoolMask()) * bonus;
- // Improved PW: Shield: its weird having a SPELLMOD_ALL_EFFECTS here but its blizzards doing :)
- // Improved PW: Shield is only applied at the spell healing bonus because it was already applied to the base value in CalculateSpellDamage
- DoneActualBenefit = caster->ApplyEffectModifiers(GetSpellInfo(), m_effIndex, DoneActualBenefit);
- DoneActualBenefit *= caster->CalculateLevelPenalty(GetSpellInfo());
-
- amount += int32(DoneActualBenefit);
-
- // Twin Disciplines
- if (AuraEffect const* pAurEff = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_PRIEST, 0x400000, 0, 0, caster->GetGUID()))
- AddPct(amount, pAurEff->GetAmount());
-
- // Focused Power
- // Reuse variable, not sure if this code below can be moved before Twin Disciplines
- DoneActualBenefit = float(amount);
- DoneActualBenefit *= caster->GetTotalAuraMultiplier(SPELL_AURA_MOD_HEALING_DONE_PERCENT);
- amount = int32(DoneActualBenefit);
-
- return amount;
- }
- break;
- case SPELLFAMILY_PALADIN:
- // Sacred Shield
- if (m_spellInfo->SpellFamilyFlags[1] & 0x80000)
- {
- //+75.00% from sp bonus
- float bonus = 0.75f;
-
- DoneActualBenefit += caster->SpellBaseHealingBonusDone(m_spellInfo->GetSchoolMask()) * bonus;
- // Divine Guardian is only applied at the spell healing bonus because it was already applied to the base value in CalculateSpellDamage
- DoneActualBenefit = caster->ApplyEffectModifiers(GetSpellInfo(), m_effIndex, DoneActualBenefit);
- DoneActualBenefit *= caster->CalculateLevelPenalty(GetSpellInfo());
-
- amount += (int32)DoneActualBenefit;
-
- // Arena - Dampening
- AuraEffect const* pAurEff = caster->GetAuraEffect(74410, 0);
- if (!pAurEff)
- pAurEff = caster->GetAuraEffect(74411, 0); // Battleground - Dampening
- if (pAurEff)
- AddPct(amount, pAurEff->GetAmount());
-
- return amount;
- }
- break;
- default:
- break;
- }
- break;
case SPELL_AURA_MANA_SHIELD:
m_canBeRecalculated = false;
- if (!caster)
- break;
- // Mana Shield
- if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_MAGE && GetSpellInfo()->SpellFamilyFlags[0] & 0x8000 && m_spellInfo->SpellFamilyFlags[2] & 0x8)
- {
- // +80.53% from +spd bonus
- DoneActualBenefit += caster->SpellBaseDamageBonusDone(m_spellInfo->GetSchoolMask()) * 0.8053f;
- }
break;
case SPELL_AURA_DUMMY:
if (!caster)
@@ -600,161 +496,9 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
amount = GetBase()->GetUnitOwner()->SpellHealingBonusTaken(caster, GetSpellInfo(), amount, SPELL_DIRECT_DAMAGE);
}
break;
- case SPELL_AURA_PERIODIC_DAMAGE:
- if (!caster)
- break;
- // Rupture
- if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_ROGUE && m_spellInfo->SpellFamilyFlags[0] & 0x100000)
- {
- m_canBeRecalculated = false;
- if (caster->GetTypeId() != TYPEID_PLAYER)
- break;
- //1 point : ${($m1+$b1*1+0.015*$AP)*4} damage over 8 secs
- //2 points: ${($m1+$b1*2+0.024*$AP)*5} damage over 10 secs
- //3 points: ${($m1+$b1*3+0.03*$AP)*6} damage over 12 secs
- //4 points: ${($m1+$b1*4+0.03428571*$AP)*7} damage over 14 secs
- //5 points: ${($m1+$b1*5+0.0375*$AP)*8} damage over 16 secs
- float AP_per_combo[6] = {0.0f, 0.015f, 0.024f, 0.03f, 0.03428571f, 0.0375f};
- uint8 cp = caster->ToPlayer()->GetComboPoints();
- if (cp > 5) cp = 5;
- amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * AP_per_combo[cp]);
- }
- // Rip
- else if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_DRUID && m_spellInfo->SpellFamilyFlags[0] & 0x00800000 && GetAuraType() == SPELL_AURA_PERIODIC_DAMAGE)
- {
- m_canBeRecalculated = false;
- // 0.01*$AP*cp
- if (caster->GetTypeId() != TYPEID_PLAYER)
- break;
-
- uint8 cp = caster->ToPlayer()->GetComboPoints();
-
- // Idol of Feral Shadows. Cant be handled as SpellMod in SpellAura:Dummy due its dependency from CPs
- if (AuraEffect const* aurEff = caster->GetAuraEffect(34241, EFFECT_0))
- amount += cp * aurEff->GetAmount();
- // Idol of Worship. Cant be handled as SpellMod in SpellAura:Dummy due its dependency from CPs
- else if (AuraEffect const* aurEff = caster->GetAuraEffect(60774, EFFECT_0))
- amount += cp * aurEff->GetAmount();
-
- amount += uint32(CalculatePct(caster->GetTotalAttackPowerValue(BASE_ATTACK), cp));
- }
- // Rend
- else if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARRIOR && GetSpellInfo()->SpellFamilyFlags[0] & 0x20)
- {
- m_canBeRecalculated = false;
- // $0.2 * (($MWB + $mwb) / 2 + $AP / 14 * $MWS) bonus per tick
- float ap = caster->GetTotalAttackPowerValue(BASE_ATTACK);
- int32 mws = caster->GetAttackTime(BASE_ATTACK);
- float mwb_min = caster->GetWeaponDamageRange(BASE_ATTACK, MINDAMAGE);
- float mwb_max = caster->GetWeaponDamageRange(BASE_ATTACK, MAXDAMAGE);
- float mwb = ((mwb_min + mwb_max) / 2 + ap * mws / 14000) * 0.2f;
- amount += int32(caster->ApplyEffectModifiers(m_spellInfo, m_effIndex, mwb));
- // "If used while your target is above 75% health, Rend does 35% more damage."
- // as for 3.1.3 only ranks above 9 (wrong tooltip?)
- if (m_spellInfo->GetRank() >= 9)
- {
- if (GetBase()->GetUnitOwner()->HasAuraState(AURA_STATE_HEALTH_ABOVE_75_PERCENT, m_spellInfo, caster))
- AddPct(amount, m_spellInfo->Effects[EFFECT_2].CalcValue(caster));
- }
- }
- break;
- case SPELL_AURA_PERIODIC_ENERGIZE:
- switch (m_spellInfo->Id)
- {
- case 29166: // Innervate
- ApplyPct(amount, float(GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA)) / GetTotalTicks());
- break;
- case 48391: // Owlkin Frenzy
- ApplyPct(amount, GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA));
- break;
- default:
- break;
- }
- break;
- case SPELL_AURA_PERIODIC_HEAL:
- if (!caster)
- break;
- // Lightwell Renew
- if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_PRIEST && m_spellInfo->SpellFamilyFlags[2] & 0x4000)
- {
- if (caster->GetTypeId() == TYPEID_PLAYER)
- // Bonus from Glyph of Lightwell
- if (AuraEffect* modHealing = caster->GetAuraEffect(55673, 0))
- AddPct(amount, modHealing->GetAmount());
- }
- break;
- case SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN:
- if (!caster)
- break;
- // Icebound Fortitude
- if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && m_spellInfo->SpellFamilyFlags[0] & 0x00100000)
- {
- if (caster->GetTypeId() == TYPEID_PLAYER)
- {
- int32 value = (-1 * amount) - 10;
- uint32 defva = uint32(caster->ToPlayer()->GetSkillValue(SKILL_DEFENSE) + caster->ToPlayer()->GetRatingBonusValue(CR_DEFENSE_SKILL));
-
- if (defva > 400)
- value += int32((defva - 400) * 0.15);
-
- // Glyph of Icebound Fortitude
- if (AuraEffect const* aurEff = caster->GetAuraEffect(58625, 0))
- {
- int32 valMax = aurEff->GetAmount();
- if (value < valMax)
- value = valMax;
- }
- amount = -value;
- }
- }
- // Hand of Salvation
- else if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_PALADIN && GetSpellInfo()->SpellFamilyFlags[0] & 0x00000100)
- {
- //Glyph of Salvation
- if (caster->GetGUID() == GetBase()->GetUnitOwner()->GetGUID())
- if (AuraEffect const* aurEff = caster->GetAuraEffect(63225, 0))
- amount = -aurEff->GetAmount();
- }
- break;
- case SPELL_AURA_MOD_THREAT:
- {
- uint8 level_diff = 0;
- float multiplier = 0.0f;
- switch (GetId())
- {
- // Arcane Shroud
- case 26400:
- level_diff = GetBase()->GetUnitOwner()->getLevel() - 60;
- multiplier = 2;
- break;
- // The Eye of Diminution
- case 28862:
- level_diff = GetBase()->GetUnitOwner()->getLevel() - 60;
- multiplier = 1;
- break;
- }
- if (level_diff > 0)
- amount += int32(multiplier * level_diff);
- break;
- }
- case SPELL_AURA_MOD_INCREASE_HEALTH:
- // Vampiric Blood
- if (GetId() == 55233)
- amount = GetBase()->GetUnitOwner()->CountPctFromMaxHealth(amount);
- break;
- case SPELL_AURA_MOD_INCREASE_SPEED:
- // Dash - do not set speed if not in cat form
- if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_DRUID && GetSpellInfo()->SpellFamilyFlags[2] & 0x00000008)
- amount = GetBase()->GetUnitOwner()->GetShapeshiftForm() == FORM_CAT ? amount : 0;
- break;
default:
break;
}
- if (DoneActualBenefit != 0.0f)
- {
- DoneActualBenefit *= caster->CalculateLevelPenalty(GetSpellInfo());
- amount += (int32)DoneActualBenefit;
- }
GetBase()->CallScriptEffectCalcAmountHandlers(const_cast<AuraEffect const*>(this), amount, m_canBeRecalculated);
amount *= GetBase()->GetStackAmount();
@@ -848,32 +592,6 @@ void AuraEffect::CalculateSpellMod()
{
switch (GetAuraType())
{
- case SPELL_AURA_DUMMY:
- switch (GetSpellInfo()->SpellFamilyName)
- {
- case SPELLFAMILY_DRUID:
- switch (GetId())
- {
- case 34246: // Idol of the Emerald Queen
- case 60779: // Idol of Lush Moss
- {
- if (!m_spellmod)
- {
- m_spellmod = new SpellModifier(GetBase());
- m_spellmod->op = SPELLMOD_DOT;
- m_spellmod->type = SPELLMOD_FLAT;
- m_spellmod->spellId = GetId();
- m_spellmod->mask[1] = 0x0010;
- }
- m_spellmod->value = GetAmount()/7;
- }
- break;
- }
- break;
- default:
- break;
- }
- break;
case SPELL_AURA_ADD_FLAT_MODIFIER:
case SPELL_AURA_ADD_PCT_MODIFIER:
if (!m_spellmod)
@@ -882,7 +600,7 @@ void AuraEffect::CalculateSpellMod()
m_spellmod->op = SpellModOp(GetMiscValue());
ASSERT(m_spellmod->op < MAX_SPELLMOD);
- m_spellmod->type = SpellModType(GetAuraType()); // SpellModType value == spell aura types
+ m_spellmod->type = SpellModType(GetAuraType()); // SpellModType value == spell aura types
m_spellmod->spellId = GetId();
m_spellmod->mask = GetSpellInfo()->Effects[GetEffIndex()].SpellClassMask;
m_spellmod->charges = GetBase()->GetCharges();
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 9bb3eaa31f1..054f6a109db 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -1345,11 +1345,6 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge
}
}
- // todo: move to scripts, but we must call it before resize list by MaxAffectedTargets
- // Intimidating Shout
- if (m_spellInfo->Id == 5246 && effIndex != EFFECT_0)
- unitTargets.remove(m_targets.GetUnitTarget());
-
// Other special target selection goes here
if (uint32 maxTargets = m_spellValue->MaxAffectedTargets)
{
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 1dddb08be0b..4fdf6654cba 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -883,12 +883,6 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex)
m_caster->CastSpell(unitTarget, spell->Id, true);
return;
}
- // Righteous Defense
- case 31980:
- {
- m_caster->CastSpell(unitTarget, 31790, true);
- return;
- }
// Cloak of Shadows
case 35729:
{
@@ -1139,32 +1133,8 @@ void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/)
return;
// Pre effects
- uint8 uiMaxSafeLevel = 0;
switch (m_spellInfo->Id)
{
- case 48129: // Scroll of Recall
- uiMaxSafeLevel = 40;
- case 60320: // Scroll of Recall II
- if (!uiMaxSafeLevel)
- uiMaxSafeLevel = 70;
- case 60321: // Scroll of Recal III
- if (!uiMaxSafeLevel)
- uiMaxSafeLevel = 80;
-
- if (unitTarget->getLevel() > uiMaxSafeLevel)
- {
- unitTarget->AddAura(60444, unitTarget); //Apply Lost! Aura
-
- // ALLIANCE from 60323 to 60330 - HORDE from 60328 to 60335
- uint32 spellId = 60323;
- if (m_caster->ToPlayer()->GetTeam() == HORDE)
- spellId += 5;
-
- spellId += urand(0, 7);
- m_caster->CastSpell(m_caster, spellId, true);
- return;
- }
- break;
case 66550: // teleports outside (Isle of Conquest)
if (Player* target = unitTarget->ToPlayer())
{
@@ -1188,7 +1158,7 @@ void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/)
// If not exist data for dest location - return
if (!m_targets.HasDst())
{
- sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::EffectTeleportUnits - does not have destination for spell ID %u\n", m_spellInfo->Id);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::EffectTeleportUnits - does not have destination for spellId %u.", m_spellInfo->Id);
return;
}
@@ -1585,10 +1555,6 @@ void Spell::EffectHealPct(SpellEffIndex /*effIndex*/)
if (!m_originalCaster)
return;
- // Rune Tap - Party
- if (m_spellInfo->Id == 59754 && unitTarget == m_caster)
- return;
-
uint32 heal = m_originalCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, unitTarget->CountPctFromMaxHealth(damage), HEAL);
heal = unitTarget->SpellHealingBonusTaken(m_originalCaster, m_spellInfo, heal, HEAL);
@@ -3732,23 +3698,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
return;
unitTarget->RemoveAurasDueToSpell(m_spellInfo->Effects[effIndex].CalcValue());
break;
- // PX-238 Winter Wondervolt TRAP
- case 26275:
- {
- uint32 spells[4] = { 26272, 26157, 26273, 26274 };
-
- // check presence
- for (uint8 j = 0; j < 4; ++j)
- if (unitTarget->HasAuraEffect(spells[j], 0))
- return;
-
- // select spell
- uint32 iTmpSpellId = spells[urand(0, 3)];
-
- // cast
- unitTarget->CastSpell(unitTarget, iTmpSpellId, true);
- return;
- }
// Bending Shinbone
case 8856:
{
@@ -3794,14 +3743,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
m_caster->CastSpell(unitTarget, 22682, true);
return;
}
- // Piccolo of the Flaming Fire
- case 17512:
- {
- if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
- return;
- unitTarget->HandleEmoteCommand(EMOTE_STATE_DANCE);
- return;
- }
// Decimate
case 28374:
case 54426:
@@ -3944,17 +3885,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
m_caster->MonsterTextEmote(buf, 0);
break;
}
- // Vigilance
- case 50725:
- {
- if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
- return;
-
- // Remove Taunt cooldown
- unitTarget->ToPlayer()->RemoveSpellCooldown(355, true);
-
- return;
- }
// Death Knight Initiate Visual
case 51519:
{
@@ -4113,17 +4043,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
}
return;
}
- case 63845: // Create Lance
- {
- if (m_caster->GetTypeId() != TYPEID_PLAYER)
- return;
-
- if (m_caster->ToPlayer()->GetTeam() == ALLIANCE)
- m_caster->CastSpell(m_caster, 63914, true);
- else
- m_caster->CastSpell(m_caster, 63919, true);
- return;
- }
case 59317: // Teleporting
{
@@ -4317,46 +4236,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
return;
}
}
- case SPELLFAMILY_POTION:
- {
- switch (m_spellInfo->Id)
- {
- // Netherbloom
- case 28702:
- {
- if (!unitTarget)
- return;
- // 25% chance of casting a random buff
- if (roll_chance_i(75))
- return;
-
- // triggered spells are 28703 to 28707
- // Note: some sources say, that there was the possibility of
- // receiving a debuff. However, this seems to be removed by a patch.
- const uint32 spellid = 28703;
-
- // don't overwrite an existing aura
- for (uint8 i = 0; i < 5; ++i)
- if (unitTarget->HasAura(spellid + i))
- return;
- unitTarget->CastSpell(unitTarget, spellid+urand(0, 4), true);
- break;
- }
-
- // Nightmare Vine
- case 28720:
- {
- if (!unitTarget)
- return;
- // 25% chance of casting Nightmare Pollen
- if (roll_chance_i(75))
- return;
- unitTarget->CastSpell(unitTarget, 28721, true);
- break;
- }
- }
- break;
- }
case SPELLFAMILY_DEATHKNIGHT:
{
// Pestilence
@@ -4377,19 +4256,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
}
break;
}
- case SPELLFAMILY_WARRIOR:
- {
- // Shattering Throw
- if (m_spellInfo->SpellFamilyFlags[1] & 0x00400000)
- {
- if (!unitTarget)
- return;
- // remove shields, will still display immune to damage part
- unitTarget->RemoveAurasWithMechanic(1<<MECHANIC_IMMUNE_SHIELD, AURA_REMOVE_BY_ENEMY_SPELL);
- return;
- }
- break;
- }
}
// normal DB scripted effect
@@ -4868,44 +4734,11 @@ void Spell::EffectResurrect(SpellEffIndex effIndex)
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
return;
- if (!unitTarget)
- return;
- if (unitTarget->GetTypeId() != TYPEID_PLAYER)
+ if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
- if (unitTarget->isAlive())
+ if (unitTarget->isAlive() || !unitTarget->IsInWorld())
return;
- if (!unitTarget->IsInWorld())
- return;
-
- switch (m_spellInfo->Id)
- {
- // Defibrillate (Goblin Jumper Cables) have 33% chance on success
- case 8342:
- if (roll_chance_i(67))
- {
- m_caster->CastSpell(m_caster, 8338, true, m_CastItem);
- return;
- }
- break;
- // Defibrillate (Goblin Jumper Cables XL) have 50% chance on success
- case 22999:
- if (roll_chance_i(50))
- {
- m_caster->CastSpell(m_caster, 23055, true, m_CastItem);
- return;
- }
- break;
- // Defibrillate (Gnomish Army Knife) have 67% chance on success_list
- case 54732:
- if (roll_chance_i(33))
- {
- return;
- }
- break;
- default:
- break;
- }
Player* target = unitTarget->ToPlayer();
@@ -5151,26 +4984,10 @@ void Spell::EffectKnockBack(SpellEffIndex effIndex)
if (creatureTarget->isWorldBoss() || creatureTarget->IsDungeonBoss())
return;
- // Spells with SPELL_EFFECT_KNOCK_BACK(like Thunderstorm) can't knoback target if target has ROOT/STUN
+ // Spells with SPELL_EFFECT_KNOCK_BACK (like Thunderstorm) can't knockback target if target has ROOT/STUN
if (unitTarget->HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED))
return;
- // Typhoon
- if (m_spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && m_spellInfo->SpellFamilyFlags[1] & 0x01000000)
- {
- // Glyph of Typhoon
- if (m_caster->HasAura(62135))
- return;
- }
-
- // Thunderstorm
- if (m_spellInfo->SpellFamilyName == SPELLFAMILY_SHAMAN && m_spellInfo->SpellFamilyFlags[1] & 0x00002000)
- {
- // Glyph of Thunderstorm
- if (m_caster->HasAura(62132))
- return;
- }
-
// Instantly interrupt non melee spells being casted
if (unitTarget->IsNonMeleeSpellCasted(true))
unitTarget->InterruptNonMeleeSpells(true);