Merge pull request #6491

Core/Spells: convert some spell effects to SpellScripts
Closes #6491
This commit is contained in:
QAston
2012-06-14 19:12:03 +02:00
30 changed files with 1967 additions and 991 deletions
-81
View File
@@ -3602,87 +3602,6 @@ void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId
// Call AfterDispel hook on AuraScript
aura->CallScriptAfterDispel(&dispelInfo);
switch (aura->GetSpellInfo()->SpellFamilyName)
{
case SPELLFAMILY_WARLOCK:
{
// Unstable Affliction (crash if before removeaura?)
if (aura->GetSpellInfo()->SpellFamilyFlags[1] & 0x0100)
{
Unit* caster = aura->GetCaster();
if (!caster)
break;
if (AuraEffect const* aurEff = aura->GetEffect(EFFECT_0))
{
int32 damage = aurEff->GetAmount() * 9;
// backfire damage and silence
caster->CastCustomSpell(dispeller, 31117, &damage, NULL, NULL, true, NULL, aurEff);
}
}
break;
}
case SPELLFAMILY_DRUID:
{
// Lifebloom
if (aura->GetSpellInfo()->SpellFamilyFlags[1] & 0x10)
{
if (AuraEffect const* aurEff = aura->GetEffect(EFFECT_1))
{
// final heal
int32 healAmount = aurEff->GetAmount();
if (Unit* caster = aura->GetCaster())
{
healAmount = caster->SpellHealingBonusDone(this, aura->GetSpellInfo(), healAmount, HEAL, dispelInfo.GetRemovedCharges());
healAmount = this->SpellHealingBonusTaken(caster, aura->GetSpellInfo(), healAmount, HEAL, dispelInfo.GetRemovedCharges());
}
CastCustomSpell(this, 33778, &healAmount, NULL, NULL, true, NULL, NULL, aura->GetCasterGUID());
// mana
if (Unit* caster = aura->GetCaster())
{
int32 mana = CalculatePctU(caster->GetCreateMana(), aura->GetSpellInfo()->ManaCostPercentage) * chargesRemoved / 2;
caster->CastCustomSpell(caster, 64372, &mana, NULL, NULL, true, NULL, NULL, aura->GetCasterGUID());
}
}
}
break;
}
case SPELLFAMILY_SHAMAN:
{
// Flame Shock
if (aura->GetSpellInfo()->SpellFamilyFlags[0] & 0x10000000)
{
if (Unit* caster = aura->GetCaster())
{
uint32 triggeredSpellId = 0;
// Lava Flows
if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, 3087, 0))
{
switch (aurEff->GetId())
{
case 51482: // Rank 3
triggeredSpellId = 65264;
break;
case 51481: // Rank 2
triggeredSpellId = 65263;
break;
case 51480: // Rank 1
triggeredSpellId = 64694;
break;
default:
sLog->outError("Unit::RemoveAurasDueToSpellByDispel: Unknown rank of Lava Flows (%d) found", aurEff->GetId());
}
}
if (triggeredSpellId)
caster->CastSpell(caster, triggeredSpellId, true);
}
}
break;
}
default:
break;
}
return;
}
else
@@ -781,33 +781,18 @@ void AuraEffect::CalculatePeriodic(Unit* caster, bool create, bool load)
m_amplitude = 1 * IN_MILLISECONDS;
case SPELL_AURA_PERIODIC_DAMAGE:
case SPELL_AURA_PERIODIC_HEAL:
case SPELL_AURA_PERIODIC_ENERGIZE:
case SPELL_AURA_OBS_MOD_HEALTH:
case SPELL_AURA_PERIODIC_TRIGGER_SPELL:
case SPELL_AURA_PERIODIC_ENERGIZE:
case SPELL_AURA_PERIODIC_LEECH:
case SPELL_AURA_PERIODIC_HEALTH_FUNNEL:
case SPELL_AURA_PERIODIC_MANA_LEECH:
case SPELL_AURA_PERIODIC_DAMAGE_PERCENT:
case SPELL_AURA_POWER_BURN:
m_isPeriodic = true;
break;
case SPELL_AURA_PERIODIC_TRIGGER_SPELL:
if (GetId() == 51912)
m_amplitude = 3000;
m_isPeriodic = true;
break;
case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE:
case SPELL_AURA_PERIODIC_DUMMY:
case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE:
m_isPeriodic = true;
break;
case SPELL_AURA_DUMMY:
// Haunting Spirits - perdiodic trigger demon
if (GetId() == 7057)
{
m_isPeriodic = true;
m_amplitude = irand (0, 60) + 30;
m_amplitude *= IN_MILLISECONDS;
}
break;
default:
break;
}
@@ -1103,14 +1088,6 @@ void AuraEffect::UpdatePeriodic(Unit* caster)
{
switch (GetAuraType())
{
case SPELL_AURA_DUMMY:
// Haunting Spirits
if (GetId() == 7057)
{
m_amplitude = irand (0, 60) + 30;
m_amplitude *= IN_MILLISECONDS;
}
break;
case SPELL_AURA_PERIODIC_DUMMY:
switch (GetSpellInfo()->SpellFamilyName)
{
@@ -1312,11 +1289,6 @@ void AuraEffect::PeriodicTick(AuraApplication * aurApp, Unit* caster) const
case SPELL_AURA_POWER_BURN:
HandlePeriodicPowerBurnAuraTick(target, caster);
break;
case SPELL_AURA_DUMMY:
// Haunting Spirits
if (GetId() == 7057)
target->CastSpell((Unit*)NULL, GetAmount(), true);
break;
default:
break;
}
@@ -5011,38 +4983,6 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
if (Unit* spellTarget = ObjectAccessor::GetUnit(*target, target->ToPlayer()->GetComboTarget()))
target->CastSpell(spellTarget, 51699, true);
break;
case 28832: // Mark of Korth'azz
case 28833: // Mark of Blaumeux
case 28834: // Mark of Rivendare
case 28835: // Mark of Zeliek
if (caster) // actually we can also use cast(this, originalcasterguid)
{
int32 damage;
switch (GetBase()->GetStackAmount())
{
case 1: damage = 0; break;
case 2: damage = 500; break;
case 3: damage = 1000; break;
case 4: damage = 1500; break;
case 5: damage = 4000; break;
case 6: damage = 12000; break;
default:damage = 20000 + 1000 * (GetBase()->GetStackAmount() - 7); break;
}
if (damage)
caster->CastCustomSpell(28836, SPELLVALUE_BASE_POINT0, damage, target);
}
break;
case 63322: // Saronite Vapors
{
if (caster)
{
int32 mana = int32(GetAmount() * pow(2.0f, GetBase()->GetStackAmount())); // mana restore - bp * 2^stackamount
int32 damage = mana * 2; // damage
caster->CastCustomSpell(target, 63337, &mana, NULL, NULL, true);
caster->CastCustomSpell(target, 63338, &damage, NULL, NULL, true);
}
break;
}
case 71563:
if (Aura* newAura = target->AddAura(71564, target))
newAura->SetStackAmount(newAura->GetSpellInfo()->StackAmount);
@@ -5136,57 +5076,6 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
break;
}
break;
case SPELLFAMILY_MAGE:
// Living Bomb
if (m_spellInfo->SpellFamilyFlags[1] & 0x20000)
{
AuraRemoveMode removeMode = aurApp->GetRemoveMode();
if (caster && (removeMode == AURA_REMOVE_BY_ENEMY_SPELL || removeMode == AURA_REMOVE_BY_EXPIRE))
caster->CastSpell(target, GetAmount(), true);
}
break;
case SPELLFAMILY_PRIEST:
// Vampiric Touch
if (m_spellInfo->SpellFamilyFlags[1] & 0x0400 && aurApp->GetRemoveMode() == AURA_REMOVE_BY_ENEMY_SPELL && GetEffIndex() == 0)
if (AuraEffect const* aurEff = GetBase()->GetEffect(1))
{
int32 damage = aurEff->GetAmount() * 8;
// backfire damage
target->CastCustomSpell(target, 64085, &damage, NULL, NULL, true, NULL, NULL, GetCasterGUID());
}
break;
case SPELLFAMILY_WARLOCK:
// Haunt
if (m_spellInfo->SpellFamilyFlags[1] & 0x40000)
if (caster)
target->CastCustomSpell(caster, 48210, &m_amount, 0, 0, true, NULL, this, GetCasterGUID());
break;
case SPELLFAMILY_DRUID:
// Lifebloom
if (GetSpellInfo()->SpellFamilyFlags[1] & 0x10)
{
// Final heal only on duration end
if (aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
return;
// final heal
int32 stack = GetBase()->GetStackAmount();
int32 heal = m_amount;
if (caster)
{
heal = caster->SpellHealingBonusDone(target, GetSpellInfo(), heal, HEAL, stack);
heal = target->SpellHealingBonusTaken(caster, GetSpellInfo(), heal, HEAL, stack);
}
target->CastCustomSpell(target, 33778, &heal, &stack, NULL, true, NULL, this, GetCasterGUID());
// restore mana
if (caster)
{
int32 returnmana = CalculatePctU(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * stack / 2;
caster->CastCustomSpell(caster, 64372, &returnmana, NULL, NULL, true, NULL, this, GetCasterGUID());
}
}
break;
case SPELLFAMILY_DEATHKNIGHT:
// Summon Gargoyle (Dismiss Gargoyle at remove)
if (GetId() == 61777)
@@ -5262,48 +5151,6 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
target->SetEntry(apply ? 17654 : 17326);
break;
}
//Summon Fire Elemental
case 40133:
{
if (!caster)
break;
Unit* owner = caster->GetOwner();
if (owner && owner->GetTypeId() == TYPEID_PLAYER)
{
if (apply)
owner->CastSpell(owner, 8985, true);
else
owner->ToPlayer()->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true);
}
break;
}
//Summon Earth Elemental
case 40132 :
{
if (!caster)
break;
Unit* owner = caster->GetOwner();
if (owner && owner->GetTypeId() == TYPEID_PLAYER)
{
if (apply)
owner->CastSpell(owner, 19704, true);
else
owner->ToPlayer()->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true);
}
break;
}
case 57723: // Exhaustion
case 57724: // Sated
{
switch (GetId())
{
case 57723: target->ApplySpellImmune(GetId(), IMMUNITY_ID, 32182, apply); break; // Heroism
case 57724: target->ApplySpellImmune(GetId(), IMMUNITY_ID, 2825, apply); break; // Bloodlust
}
break;
}
case 57819: // Argent Champion
case 57820: // Ebon Champion
case 57821: // Champion of the Kirin Tor
@@ -5396,69 +5243,14 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
}
case SPELLFAMILY_DRUID:
{
if (!(mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK))
break;
switch (GetId())
{
case 52610: // Savage Roar
{
uint32 spellId = 62071;
if (apply)
{
if (target->GetShapeshiftForm() != FORM_CAT)
break;
target->CastSpell(target, spellId, true, NULL, NULL, GetCasterGUID());
break;
}
target->RemoveAurasDueToSpell(spellId);
break;
}
case 61336: // Survival Instincts
{
if (!(mode & AURA_EFFECT_HANDLE_REAL))
break;
if (apply)
{
if (!target->IsInFeralForm())
break;
int32 bp0 = int32(target->CountPctFromMaxHealth(GetAmount()));
target->CastCustomSpell(target, 50322, &bp0, NULL, NULL, true);
}
else
target->RemoveAurasDueToSpell(50322);
break;
}
}
// Predatory Strikes
if (target->GetTypeId() == TYPEID_PLAYER && GetSpellInfo()->SpellIconID == 1563)
{
target->ToPlayer()->UpdateAttackPowerAndDamage();
}
//if (!(mode & AURA_EFFECT_HANDLE_REAL))
//break;
break;
}
case SPELLFAMILY_SHAMAN:
{
if (!(mode & AURA_EFFECT_HANDLE_REAL))
break;
// Sentry Totem
if (GetId() == 6495 && caster && caster->GetTypeId() == TYPEID_PLAYER)
{
if (apply)
{
if (uint64 guid = caster->m_SummonSlot[4])
{
if (Creature* totem = caster->GetMap()->GetCreature(guid))
if (totem->isTotem())
caster->ToPlayer()->CastSpell(totem, 6277, true);
}
}
else
caster->ToPlayer()->StopCastingBindSight();
return;
}
//if (!(mode & AURA_EFFECT_HANDLE_REAL))
//break;
break;
}
case SPELLFAMILY_PALADIN:
@@ -6088,14 +5880,6 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster)
if (caster)
caster->CastCustomSpell(29879, SPELLVALUE_BASE_POINT0, int32(target->CountPctFromMaxHealth(21)), target, true, NULL, this);
return;
// Detonate Mana
case 27819:
if (int32 mana = (int32)(target->GetMaxPower(POWER_MANA) / 10))
{
mana = target->ModifyPower(POWER_MANA, -mana);
target->CastCustomSpell(27820, SPELLVALUE_BASE_POINT0, -mana*10, target, true, NULL, this);
}
return;
// Inoculate Nestlewood Owlkin
case 29528:
if (target->GetTypeId() != TYPEID_UNIT) // prevent error reports in case ignored player target
@@ -6760,33 +6544,6 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con
target->AddThreat(caster, float(gainedAmount) * 0.5f, GetSpellInfo()->GetSchoolMask(), GetSpellInfo());
}
// spell-specific code
switch (GetId())
{
case 31447: // Mark of Kaz'rogal
if (target->GetPower(powerType) == 0)
{
target->CastSpell(target, 31463, true, 0, this);
// Remove aura
GetBase()->SetDuration(0);
}
break;
case 32960: // Mark of Kazzak
{
int32 modifier = int32(target->GetPower(powerType) * 0.05f);
target->ModifyPower(powerType, -modifier);
if (target->GetPower(powerType) == 0)
{
target->CastSpell(target, 32961, true, 0, this);
// Remove aura
GetBase()->SetDuration(0);
}
break;
}
default:
break;
}
// Drain Mana
if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK
&& m_spellInfo->SpellFamilyFlags[0] & 0x00000010)
+22 -133
View File
@@ -1286,18 +1286,6 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge
maxSize = m_caster->HasAura(62970) ? 6 : 5; // Glyph of Wild Growth
power = POWER_HEALTH;
}
else if (m_spellInfo->SpellFamilyFlags[2] == 0x0100) // Starfall
{
// Remove targets not in LoS or in stealth
for (std::list<Unit*>::iterator itr = unitTargets.begin(); itr != unitTargets.end();)
{
if ((*itr)->HasStealthAura() || (*itr)->HasInvisibilityAura() || !(*itr)->IsWithinLOSInMap(m_caster))
itr = unitTargets.erase(itr);
else
++itr;
}
break;
}
else
break;
@@ -1338,6 +1326,11 @@ 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)
{
@@ -1346,8 +1339,6 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge
if ((*j)->IsAffectedOnSpell(m_spellInfo))
maxTargets += (*j)->GetAmount();
if (m_spellInfo->Id == 5246) //Intimidating Shout
unitTargets.remove(m_targets.GetUnitTarget());
Trinity::Containers::RandomResizeList(unitTargets, maxTargets);
}
@@ -2473,12 +2464,6 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
caster->ToPlayer()->CastItemCombatSpell(unitTarget, m_attackType, procVictim, procEx);
}
// Haunt
if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->SpellFamilyFlags[1] & 0x40000 && m_spellAura && m_spellAura->GetEffect(1))
{
AuraEffect* aurEff = m_spellAura->GetEffect(1);
aurEff->SetAmount(CalculatePctU(aurEff->GetAmount(), damageInfo.damage));
}
m_damage = damageInfo.damage;
@@ -4858,19 +4843,9 @@ SpellCastResult Spell::CheckCast(bool strict)
if (!(m_spellInfo->AttributesEx2 & SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS) && VMAP::VMapFactory::checkSpellForLoS(m_spellInfo->Id) && !m_caster->IsWithinLOSInMap(target))
return SPELL_FAILED_LINE_OF_SIGHT;
}
else
{
if (m_caster->GetTypeId() == TYPEID_PLAYER) // Target - is player caster
{
// Lay on Hands - cannot be self-cast on paladin with Forbearance or after using Avenging Wrath
if (m_spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN && m_spellInfo->SpellFamilyFlags[0] & 0x0008000)
if (target->HasAura(61988)) // Immunity shield marker
return SPELL_FAILED_TARGET_AURASTATE;
}
}
}
//Check for line of sight for spells with dest
// Check for line of sight for spells with dest
if (m_targets.HasDst())
{
float x, y, z;
@@ -4969,7 +4944,8 @@ SpellCastResult Spell::CheckCast(bool strict)
bool hasDispellableAura = false;
bool hasNonDispelEffect = false;
for (int i = 0; i < MAX_SPELL_EFFECTS; i++)
uint32 dispelMask = 0;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_DISPEL)
{
if (m_spellInfo->Effects[i].IsTargetingArea() || m_spellInfo->AttributesEx & SPELL_ATTR1_MELEE_COMBAT_START)
@@ -4977,17 +4953,8 @@ SpellCastResult Spell::CheckCast(bool strict)
hasDispellableAura = true;
break;
}
if (Unit* target = m_targets.GetUnitTarget())
{
DispelChargesList dispelList;
uint32 dispelMask = SpellInfo::GetDispelMask(DispelType(m_spellInfo->Effects[i].MiscValue));
target->GetDispellableAuraList(m_caster, dispelMask, dispelList);
if (!dispelList.empty())
{
hasDispellableAura = true;
break;
}
}
dispelMask |= SpellInfo::GetDispelMask(DispelType(m_spellInfo->Effects[i].MiscValue));
}
else if (m_spellInfo->Effects[i].IsEffect())
{
@@ -4995,34 +4962,22 @@ SpellCastResult Spell::CheckCast(bool strict)
break;
}
if (!hasNonDispelEffect && !hasDispellableAura && m_spellInfo->HasEffect(SPELL_EFFECT_DISPEL) && !IsTriggered())
return SPELL_FAILED_NOTHING_TO_DISPEL;
if (!hasNonDispelEffect && !hasDispellableAura && dispelMask && !IsTriggered())
{
if (Unit* target = m_targets.GetUnitTarget())
{
DispelChargesList dispelList;
target->GetDispellableAuraList(m_caster, dispelMask, dispelList);
if (dispelList.empty())
return SPELL_FAILED_NOTHING_TO_DISPEL;
}
}
for (int i = 0; i < MAX_SPELL_EFFECTS; i++)
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
// for effects of spells that have only one target
switch (m_spellInfo->Effects[i].Effect)
{
case SPELL_EFFECT_DUMMY:
{
if (m_spellInfo->Id == 19938) // Awaken Peon
{
Unit* unit = m_targets.GetUnitTarget();
if (!unit || !unit->HasAura(17743))
return SPELL_FAILED_BAD_TARGETS;
}
else if (m_spellInfo->Id == 31789) // Righteous Defense
{
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return SPELL_FAILED_DONT_REPORT;
Unit* target = m_targets.GetUnitTarget();
if (!target || !target->IsFriendlyTo(m_caster) || target->getAttackers().empty())
return SPELL_FAILED_BAD_TARGETS;
}
break;
}
case SPELL_EFFECT_LEARN_SPELL:
{
if (m_caster->GetTypeId() != TYPEID_PLAYER)
@@ -5339,10 +5294,6 @@ SpellCastResult Spell::CheckCast(bool strict)
}
case SPELL_EFFECT_LEAP_BACK:
{
// Spell 781 (Disengage) requires player to be in combat
if (m_caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->Id == 781 && !m_caster->isInCombat())
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW;
if (m_caster->HasUnitState(UNIT_STATE_ROOT))
{
if (m_caster->GetTypeId() == TYPEID_PLAYER)
@@ -5364,66 +5315,10 @@ SpellCastResult Spell::CheckCast(bool strict)
}
}
for (int i = 0; i < MAX_SPELL_EFFECTS; i++)
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
switch (m_spellInfo->Effects[i].ApplyAuraName)
{
case SPELL_AURA_DUMMY:
{
//custom check
switch (m_spellInfo->Id)
{
// Tag Murloc
case 30877:
{
Unit* target = m_targets.GetUnitTarget();
if (!target || target->GetEntry() != 17326)
return SPELL_FAILED_BAD_TARGETS;
break;
}
case 61336:
if (m_caster->GetTypeId() != TYPEID_PLAYER || !m_caster->ToPlayer()->IsInFeralForm())
return SPELL_FAILED_ONLY_SHAPESHIFT;
break;
case 1515:
{
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return SPELL_FAILED_BAD_TARGETS;
if (!m_targets.GetUnitTarget() || m_targets.GetUnitTarget()->GetTypeId() == TYPEID_PLAYER)
return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
Creature* target = m_targets.GetUnitTarget()->ToCreature();
if (target->getLevel() > m_caster->getLevel())
return SPELL_FAILED_HIGHLEVEL;
// use SMSG_PET_TAME_FAILURE?
if (!target->GetCreatureTemplate()->isTameable (m_caster->ToPlayer()->CanTameExoticPets()))
return SPELL_FAILED_BAD_TARGETS;
if (m_caster->GetPetGUID())
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
if (m_caster->GetCharmGUID())
return SPELL_FAILED_ALREADY_HAVE_CHARM;
break;
}
case 44795: // Parachute
{
float x, y, z;
m_caster->GetPosition(x, y, z);
float ground_Z = m_caster->GetMap()->GetHeight(m_caster->GetPhaseMask(), x, y, z);
if (fabs(ground_Z - z) < 0.1f)
return SPELL_FAILED_DONT_REPORT;
break;
}
default:
break;
}
break;
}
case SPELL_AURA_MOD_POSSESS_PET:
{
if (m_caster->GetTypeId() != TYPEID_PLAYER)
@@ -7183,12 +7078,6 @@ void Spell::PrepareTriggersExecutedOnHit()
// todo: move this to scripts
switch (m_spellInfo->SpellFamilyName)
{
case SPELLFAMILY_GENERIC:
{
if (m_spellInfo->Mechanic == MECHANIC_BANDAGE) // Bandages
m_preCastSpell = 11196; // Recently Bandaged
break;
}
case SPELLFAMILY_MAGE:
{
// Permafrost
+8 -363
View File
@@ -353,43 +353,6 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
return;
break;
}
case 33671: // gruul's shatter
case 50811: // krystallus shatter ( Normal )
case 61547: // krystallus shatter ( Heroic )
{
// don't damage self and only players
if (unitTarget->GetGUID() == m_caster->GetGUID() || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
float radius = m_spellInfo->Effects[EFFECT_0].CalcRadius(m_caster);
if (!radius)
return;
float distance = m_caster->GetDistance2d(unitTarget);
damage = (distance > radius) ? 0 : int32(m_spellInfo->Effects[EFFECT_0].CalcValue(m_caster) * ((radius - distance)/radius));
break;
}
// Loken Pulsing Shockwave
case 59837:
case 52942:
{
// don't damage self and only players
if (unitTarget->GetGUID() == m_caster->GetGUID() || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
float radius = m_spellInfo->Effects[EFFECT_0].CalcRadius(m_caster);
if (!radius)
return;
float distance = m_caster->GetDistance2d(unitTarget);
damage = (distance > radius) ? 0 : int32(m_spellInfo->Effects[EFFECT_0].CalcValue(m_caster) * distance);
break;
}
// TODO: add spell specific target requirement hook for spells
// Shadowbolts only affects targets with Shadow Mark (Gothik)
case 27831:
case 55638:
if (!unitTarget->HasAura(27825))
return;
break;
// Gargoyle Strike
case 51963:
{
@@ -3574,15 +3537,6 @@ void Spell::EffectHealMaxHealth(SpellEffIndex /*effIndex*/)
return;
int32 addhealth = 0;
if (m_spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN) // Lay on Hands
{
if (m_caster->GetGUID() == unitTarget->GetGUID())
{
m_caster->CastSpell(m_caster, 25771, true); // Forbearance
m_caster->CastSpell(m_caster, 61988, true); // Immune shield marker (serverside)
m_caster->CastSpell(m_caster, 61987, true); // Avenging Wrath marker
}
}
// damage == 0 - heal for caster max health
if (damage == 0)
@@ -3813,12 +3767,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
if (!itemTarget && m_caster->GetTypeId() != TYPEID_PLAYER)
return;
uint32 spell_id = 0;
switch (urand(1, 5))
{
case 1: spell_id = 8854; break;
default: spell_id = 8855; break;
}
uint32 spell_id = roll_chance_i(20) ? 8854 : 8855;
m_caster->CastSpell(m_caster, spell_id, true, NULL);
return;
@@ -3865,10 +3814,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
unitTarget->HandleEmoteCommand(EMOTE_STATE_DANCE);
return;
}
// Escape artist
case 20589:
m_caster->RemoveMovementImpairingAuras();
return;
// Decimate
case 28374:
case 54426:
@@ -3899,15 +3844,8 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
DoCreateItem(effIndex, item);
break;
}
// Improved Sprint
case 30918:
{
// Removes snares and roots.
unitTarget->RemoveMovementImpairingAuras();
break;
}
// Spirit Walk
case 58876:
case 20589: // Escape artist
case 30918: // Improved Sprint
{
// Removes snares and roots.
unitTarget->RemoveMovementImpairingAuras();
@@ -3925,96 +3863,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
}
}
break;
case 48025: // Headless Horseman's Mount
{
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
// Prevent stacking of mounts and client crashes upon dismounting
unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED);
// Triggered spell id dependent on riding skill and zone
bool canFly = true;
uint32 v_map = GetVirtualMapForMapAndZone(unitTarget->GetMapId(), unitTarget->GetZoneId());
if (v_map != 530 && v_map != 571)
canFly = false;
if (canFly && v_map == 571 && !unitTarget->ToPlayer()->HasSpell(54197))
canFly = false;
float x, y, z;
unitTarget->GetPosition(x, y, z);
uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z);
AreaTableEntry const* pArea = sAreaStore.LookupEntry(areaFlag);
if (!pArea || (canFly && (pArea->flags & AREA_FLAG_NO_FLY_ZONE)))
canFly = false;
switch (unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING))
{
case 75: unitTarget->CastSpell(unitTarget, 51621, true); break;
case 150: unitTarget->CastSpell(unitTarget, 48024, true); break;
case 225:
{
if (canFly)
unitTarget->CastSpell(unitTarget, 51617, true);
else
unitTarget->CastSpell(unitTarget, 48024, true);
}break;
case 300:
{
if (canFly)
unitTarget->CastSpell(unitTarget, 48023, true);
else
unitTarget->CastSpell(unitTarget, 48024, true);
}break;
}
return;
}
case 47977: // Magic Broom
{
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
// Prevent stacking of mounts and client crashes upon dismounting
unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED);
// Triggered spell id dependent on riding skill and zone
bool canFly = true;
uint32 v_map = GetVirtualMapForMapAndZone(unitTarget->GetMapId(), unitTarget->GetZoneId());
if (v_map != 530 && v_map != 571)
canFly = false;
if (canFly && v_map == 571 && !unitTarget->ToPlayer()->HasSpell(54197))
canFly = false;
float x, y, z;
unitTarget->GetPosition(x, y, z);
uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z);
AreaTableEntry const* pArea = sAreaStore.LookupEntry(areaFlag);
if (!pArea || (canFly && (pArea->flags & AREA_FLAG_NO_FLY_ZONE)))
canFly = false;
switch (unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING))
{
case 75: unitTarget->CastSpell(unitTarget, 42680, true); break;
case 150: unitTarget->CastSpell(unitTarget, 42683, true); break;
case 225:
{
if (canFly)
unitTarget->CastSpell(unitTarget, 42667, true);
else
unitTarget->CastSpell(unitTarget, 42683, true);
}break;
case 300:
{
if (canFly)
unitTarget->CastSpell(unitTarget, 42668, true);
else
unitTarget->CastSpell(unitTarget, 42683, true);
}break;
}
return;
}
// Mug Transformation
case 41931:
{
@@ -4206,25 +4054,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
if (unitTarget)
unitTarget->CastSpell(m_caster, damage, true);
return;
// Winged Steed of the Ebon Blade
case 54729:
{
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
// Prevent stacking of mounts and client crashes upon dismounting
unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED);
// Triggered spell id dependent on riding skill
if (uint16 skillval = unitTarget->ToPlayer()->GetSkillValue(SKILL_RIDING))
{
if (skillval >= 300)
unitTarget->CastSpell(unitTarget, 54727, true);
else
unitTarget->CastSpell(unitTarget, 54726, true);
}
return;
}
case 57347: // Retrieving (Wintergrasp RP-GG pickup spell)
{
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT || m_caster->GetTypeId() != TYPEID_PLAYER)
@@ -4307,188 +4136,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
m_caster->CastSpell(m_caster, 63919, true);
return;
}
case 71342: // Big Love Rocket
{
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
// Prevent stacking of mounts and client crashes upon dismounting
unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED);
// Triggered spell id dependent on riding skill and zone
bool canFly = true;
uint32 v_map = GetVirtualMapForMapAndZone(unitTarget->GetMapId(), unitTarget->GetZoneId());
if (v_map != 530 && v_map != 571)
canFly = false;
if (canFly && v_map == 571 && !unitTarget->ToPlayer()->HasSpell(54197))
canFly = false;
float x, y, z;
unitTarget->GetPosition(x, y, z);
uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z);
AreaTableEntry const* pArea = sAreaStore.LookupEntry(areaFlag);
if (!pArea || (canFly && (pArea->flags & AREA_FLAG_NO_FLY_ZONE)))
canFly = false;
switch (unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING))
{
case 0: unitTarget->CastSpell(unitTarget, 71343, true); break;
case 75: unitTarget->CastSpell(unitTarget, 71344, true); break;
case 150: unitTarget->CastSpell(unitTarget, 71345, true); break;
case 225:
{
if (canFly)
unitTarget->CastSpell(unitTarget, 71346, true);
else
unitTarget->CastSpell(unitTarget, 71345, true);
}break;
case 300:
{
if (canFly)
unitTarget->CastSpell(unitTarget, 71347, true);
else
unitTarget->CastSpell(unitTarget, 71345, true);
}break;
}
return;
}
case 72286: // Invincible
{
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
// Prevent stacking of mounts and client crashes upon dismounting
unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED);
// Triggered spell id dependent on riding skill and zone
bool canFly = true;
uint32 v_map = GetVirtualMapForMapAndZone(unitTarget->GetMapId(), unitTarget->GetZoneId());
if (v_map != 530 && v_map != 571)
canFly = false;
if (canFly && v_map == 571 && !unitTarget->ToPlayer()->HasSpell(54197))
canFly = false;
float x, y, z;
unitTarget->GetPosition(x, y, z);
uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z);
AreaTableEntry const* pArea = sAreaStore.LookupEntry(areaFlag);
if (!pArea || (canFly && (pArea->flags & AREA_FLAG_NO_FLY_ZONE)))
canFly = false;
switch (unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING))
{
case 75: unitTarget->CastSpell(unitTarget, 72281, true); break;
case 150: unitTarget->CastSpell(unitTarget, 72282, true); break;
case 225:
{
if (canFly)
unitTarget->CastSpell(unitTarget, 72283, true);
else
unitTarget->CastSpell(unitTarget, 72282, true);
}break;
case 300:
{
if (canFly)
unitTarget->CastSpell(unitTarget, 72284, true);
else
unitTarget->CastSpell(unitTarget, 72282, true);
}break;
}
return;
}
case 74856: // Blazing Hippogryph
{
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
// Prevent stacking of mounts and client crashes upon dismounting
unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED);
// Triggered spell id dependent on riding skill
if (uint16 skillval = unitTarget->ToPlayer()->GetSkillValue(SKILL_RIDING))
{
if (skillval >= 300)
unitTarget->CastSpell(unitTarget, 74855, true);
else
unitTarget->CastSpell(unitTarget, 74854, true);
}
return;
}
case 75614: // Celestial Steed
{
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
// Prevent stacking of mounts and client crashes upon dismounting
unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED);
// Triggered spell id dependent on riding skill and zone
bool canFly = true;
uint32 v_map = GetVirtualMapForMapAndZone(unitTarget->GetMapId(), unitTarget->GetZoneId());
if (v_map != 530 && v_map != 571)
canFly = false;
if (canFly && v_map == 571 && !unitTarget->ToPlayer()->HasSpell(54197))
canFly = false;
float x, y, z;
unitTarget->GetPosition(x, y, z);
uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z);
AreaTableEntry const* pArea = sAreaStore.LookupEntry(areaFlag);
if (!pArea || (canFly && (pArea->flags & AREA_FLAG_NO_FLY_ZONE)))
canFly = false;
switch (unitTarget->ToPlayer()->GetBaseSkillValue(SKILL_RIDING))
{
case 75: unitTarget->CastSpell(unitTarget, 75619, true); break;
case 150: unitTarget->CastSpell(unitTarget, 75620, true); break;
case 225:
{
if (canFly)
unitTarget->CastSpell(unitTarget, 75617, true);
else
unitTarget->CastSpell(unitTarget, 75620, true);
}break;
case 300:
{
if (canFly)
{
if (unitTarget->ToPlayer()->Has310Flyer(false))
unitTarget->CastSpell(unitTarget, 76153, true);
else
unitTarget->CastSpell(unitTarget, 75618, true);
}
else
unitTarget->CastSpell(unitTarget, 75620, true);
}break;
}
return;
}
case 75973: // X-53 Touring Rocket
{
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
// Prevent stacking of mounts
unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED);
// Triggered spell id dependent on riding skill
if (uint16 skillval = unitTarget->ToPlayer()->GetSkillValue(SKILL_RIDING))
{
if (skillval >= 300)
{
if (unitTarget->ToPlayer()->Has310Flyer(false))
unitTarget->CastSpell(unitTarget, 76154, true);
else
unitTarget->CastSpell(unitTarget, 75972, true);
}
else
unitTarget->CastSpell(unitTarget, 75957, true);
}
return;
}
case 59317: // Teleporting
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
@@ -5104,16 +4751,14 @@ void Spell::EffectDisEnchant(SpellEffIndex /*effIndex*/)
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
return;
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
Player* p_caster = (Player*)m_caster;
if (!itemTarget || !itemTarget->GetTemplate()->DisenchantID)
return;
p_caster->UpdateCraftSkill(m_spellInfo->Id);
m_caster->ToPlayer()->SendLoot(itemTarget->GetGUID(), LOOT_DISENCHANTING);
if (Player* caster = m_caster->ToPlayer())
{
caster->UpdateCraftSkill(m_spellInfo->Id);
caster->SendLoot(itemTarget->GetGUID(), LOOT_DISENCHANTING);
}
// item will be removed at disenchanting end
}
+11 -13
View File
@@ -2960,8 +2960,10 @@ void SpellMgr::LoadDbcDataCorrections()
switch (spellInfo->Id)
{
case 40244: case 40245: // Simon Game Visual
case 40246: case 40247: // Simon Game Visual
case 40244: // Simon Game Visual
case 40245: // Simon Game Visual
case 40246: // Simon Game Visual
case 40247: // Simon Game Visual
case 42835: // Spout, remove damage effect, only anim is needed
spellInfo->Effect[0] = 0;
break;
@@ -2973,7 +2975,6 @@ void SpellMgr::LoadDbcDataCorrections()
spellInfo->EffectImplicitTargetB[0] = 0;
break;
case 63665: // Charge (Argent Tournament emote on riders)
case 31447: // Mark of Kaz'rogal (needs target selection script)
case 31298: // Sleep (needs target selection script)
case 51904: // Summon Ghouls On Scarlet Crusade (this should use conditions table, script for this spell needs to be fixed)
case 2895: // Wrath of Air Totem rank 1 (Aura)
@@ -3128,6 +3129,9 @@ void SpellMgr::LoadDbcDataCorrections()
case 51852: // The Eye of Acherus (no spawn in phase 2 in db)
spellInfo->EffectMiscValue[0] |= 1;
break;
case 51912: // Crafty's Ultra-Advanced Proto-Typical Shortening Blaster
spellInfo->EffectAmplitude[0] = 3000;
break;
case 29809: // Desecration Arm - 36 instead of 37 - typo? :/
spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_7_YARDS;
break;
@@ -3258,6 +3262,10 @@ void SpellMgr::LoadDbcDataCorrections()
case 53313: // Entangling Roots (Rank 8) -- Nature's Grasp Proc
spellInfo->CastingTimeIndex = 1;
break;
case 59414: // Pulsing Shockwave Aura (Loken)
// this flag breaks movement, remove it
spellInfo->AttributesEx &= ~SPELL_ATTR1_CHANNELED_1;
break;
case 61719: // Easter Lay Noblegarden Egg Aura - Interrupt flags copied from aura which this aura is linked with
spellInfo->AuraInterruptFlags = AURA_INTERRUPT_FLAG_HITBYSPELL | AURA_INTERRUPT_FLAG_TAKE_DAMAGE;
break;
@@ -3299,11 +3307,6 @@ void SpellMgr::LoadDbcDataCorrections()
// that will be clear if we get more spells with problem like this
spellInfo->AttributesEx |= SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY;
break;
case 62584: // Lifebinder's Gift
case 64185: // Lifebinder's Gift
spellInfo->EffectImplicitTargetB[1] = TARGET_UNIT_NEARBY_ENTRY;
spellInfo->EffectImplicitTargetB[2] = TARGET_UNIT_NEARBY_ENTRY;
break;
case 62301: // Cosmic Smash (Algalon the Observer)
spellInfo->MaxAffectedTargets = 1;
break;
@@ -3545,11 +3548,6 @@ void SpellMgr::LoadDbcDataCorrections()
switch (spellInfo->SpellFamilyName)
{
case SPELLFAMILY_DRUID:
// Starfall Target Selection
if (spellInfo->SpellFamilyFlags[2] & 0x100)
spellInfo->MaxAffectedTargets = 2;
break;
case SPELLFAMILY_PALADIN:
// Seals of the Pure should affect Seal of Righteousness
if (spellInfo->SpellIconID == 25 && spellInfo->Attributes & SPELL_ATTR0_PASSIVE)