Core/AI: refactor SpellHit and SpellHitTarget. (#24691)

* Core/AI: refactor SpellHit and SpellHitTarget.

- now caster/target is WorldObject instead of Unit
- remove SpellHitByGameObject / SpellHitTargetGameObject (handled by SpellHit / SpellHitTarget)
- rename parameters in scripts according parent methods

* Restore logic in Algalon script

* Changed check for REMORSELESS_WINTER hit to avoid dublicate call, because it has TARGET_UNIT_CASTER for effects 0/1 and TARGET_GAMEOBJECT_SRC_AREA for effect 2

* Fix build after merge

(cherry picked from commit e3b232fe0e5c21a87d3fe71813e9d750259823f1)
This commit is contained in:
ForesterDev
2022-01-06 20:46:25 +01:00
committed by Shauren
parent f0242d4ec7
commit 3171cd3fa9
111 changed files with 609 additions and 517 deletions
+2 -4
View File
@@ -97,12 +97,10 @@ class TC_GAME_API GameObjectAI
virtual void EventInform(uint32 /*eventId*/) { }
// Called when hit by a spell
virtual void SpellHit(Unit* /*caster*/, SpellInfo const* /*spellInfo*/) { }
virtual void SpellHitByGameObject(GameObject* /*caster*/, SpellInfo const* /*spellInfo*/) { }
virtual void SpellHit(WorldObject* /*caster*/, SpellInfo const* /*spellInfo*/) { }
// Called when spell hits a target
virtual void SpellHitTarget(Unit* /*target*/, SpellInfo const* /*spellInfo*/) { }
virtual void SpellHitTargetGameObject(GameObject* /*target*/, SpellInfo const* /*spellInfo*/) { }
virtual void SpellHitTarget(WorldObject* /*target*/, SpellInfo const* /*spellInfo*/) { }
// Called when the gameobject summon successfully other creature
virtual void JustSummoned(Creature* /*summon*/) { }
+2 -4
View File
@@ -134,12 +134,10 @@ class TC_GAME_API CreatureAI : public UnitAI
virtual void JustUnregisteredAreaTrigger(AreaTrigger* /*areaTrigger*/) { }
// Called when hit by a spell
virtual void SpellHit(Unit* /*caster*/, SpellInfo const* /*spellInfo*/) { }
virtual void SpellHitByGameObject(GameObject* /*caster*/, SpellInfo const* /*spellInfo*/) { }
virtual void SpellHit(WorldObject* /*caster*/, SpellInfo const* /*spellInfo*/) { }
// Called when spell hits a target
virtual void SpellHitTarget(Unit* /*target*/, SpellInfo const* /*spellInfo*/) { }
virtual void SpellHitTargetGameObject(GameObject* /*target*/, SpellInfo const* /*spellInfo*/) { }
virtual void SpellHitTarget(WorldObject* /*target*/, SpellInfo const* /*spellInfo*/) { }
// Called when a spell cast gets interrupted
virtual void OnSpellCastInterrupt(SpellInfo const* /*spell*/) { }
+6 -16
View File
@@ -615,24 +615,14 @@ void SmartAI::AttackStart(Unit* who)
}
}
void SmartAI::SpellHit(Unit* unit, SpellInfo const* spellInfo)
void SmartAI::SpellHit(WorldObject* caster, SpellInfo const* spellInfo)
{
GetScript()->ProcessEventsFor(SMART_EVENT_SPELLHIT, unit, 0, 0, false, spellInfo);
GetScript()->ProcessEventsFor(SMART_EVENT_SPELLHIT, caster->ToUnit(), 0, 0, false, spellInfo, caster->ToGameObject());
}
void SmartAI::SpellHitByGameObject(GameObject* object, SpellInfo const* spellInfo)
void SmartAI::SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo)
{
GetScript()->ProcessEventsFor(SMART_EVENT_SPELLHIT, nullptr, 0, 0, false, spellInfo, object);
}
void SmartAI::SpellHitTarget(Unit* target, SpellInfo const* spellInfo)
{
GetScript()->ProcessEventsFor(SMART_EVENT_SPELLHIT_TARGET, target, 0, 0, false, spellInfo);
}
void SmartAI::SpellHitTargetGameObject(GameObject* target, SpellInfo const* spellInfo)
{
GetScript()->ProcessEventsFor(SMART_EVENT_SPELLHIT_TARGET, nullptr, 0, 0, false, spellInfo, target);
GetScript()->ProcessEventsFor(SMART_EVENT_SPELLHIT_TARGET, target->ToUnit(), 0, 0, false, spellInfo, target->ToGameObject());
}
void SmartAI::DamageTaken(Unit* doneBy, uint32& damage)
@@ -1102,9 +1092,9 @@ void SmartGameObjectAI::EventInform(uint32 eventId)
GetScript()->ProcessEventsFor(SMART_EVENT_GO_EVENT_INFORM, nullptr, eventId);
}
void SmartGameObjectAI::SpellHit(Unit* unit, SpellInfo const* spellInfo)
void SmartGameObjectAI::SpellHit(WorldObject* caster, SpellInfo const* spellInfo)
{
GetScript()->ProcessEventsFor(SMART_EVENT_SPELLHIT, unit, 0, 0, false, spellInfo);
GetScript()->ProcessEventsFor(SMART_EVENT_SPELLHIT, caster->ToUnit(), 0, 0, false, spellInfo);
}
void SmartGameObjectAI::JustSummoned(Creature* creature)
+5 -5
View File
@@ -99,12 +99,10 @@ class TC_GAME_API SmartAI : public CreatureAI
void MoveInLineOfSight(Unit* who) override;
// Called when hit by a spell
void SpellHit(Unit* unit, SpellInfo const* spellInfo) override;
void SpellHitByGameObject(GameObject* object, SpellInfo const* spellInfo) override;
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override;
// Called when spell hits a target
void SpellHitTarget(Unit* target, SpellInfo const* spellInfo) override;
void SpellHitTargetGameObject(GameObject* object, SpellInfo const* spellInfo) override;
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override;
// Called at any Damage from any attacker (before damage apply)
void DamageTaken(Unit* doneBy, uint32& damage) override;
@@ -270,7 +268,9 @@ class TC_GAME_API SmartGameObjectAI : public GameObjectAI
void OnGameEvent(bool start, uint16 eventId) override;
void OnLootStateChanged(uint32 state, Unit* unit) override;
void EventInform(uint32 eventId) override;
void SpellHit(Unit* unit, SpellInfo const* spellInfo) override;
// Called when hit by a spell
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override;
// Called when the gameobject summon successfully other creature
void JustSummoned(Creature* creature) override;
+5 -15
View File
@@ -2695,12 +2695,7 @@ void Spell::TargetInfo::DoDamageAndTriggers(Spell* spell)
//AI functions
if (Creature* cHitTarget = _spellHitTarget->ToCreature())
if (CreatureAI* hitTargetAI = cHitTarget->AI())
{
if (spell->m_caster->GetTypeId() == TYPEID_GAMEOBJECT)
hitTargetAI->SpellHitByGameObject(spell->m_caster->ToGameObject(), spell->m_spellInfo);
else
hitTargetAI->SpellHit(spell->m_caster->ToUnit(), spell->m_spellInfo);
}
hitTargetAI->SpellHit(spell->m_caster, spell->m_spellInfo);
if (spell->m_caster->GetTypeId() == TYPEID_UNIT && spell->m_caster->ToCreature()->IsAIEnabled())
spell->m_caster->ToCreature()->AI()->SpellHitTarget(_spellHitTarget, spell->m_spellInfo);
@@ -2744,19 +2739,14 @@ void Spell::GOTargetInfo::DoTargetSpellHit(Spell* spell, SpellEffectInfo const&
spell->HandleEffects(nullptr, nullptr, go, spellEffectInfo, SPELL_EFFECT_HANDLE_HIT_TARGET);
//AI functions
// AI functions
if (go->AI())
{
if (spell->m_caster->GetTypeId() == TYPEID_GAMEOBJECT)
go->AI()->SpellHitByGameObject(spell->m_caster->ToGameObject(), spell->m_spellInfo);
else
go->AI()->SpellHit(spell->m_caster->ToUnit(), spell->m_spellInfo);
}
go->AI()->SpellHit(spell->m_caster, spell->m_spellInfo);
if (spell->m_caster->GetTypeId() == TYPEID_UNIT && spell->m_caster->ToCreature()->IsAIEnabled())
spell->m_caster->ToCreature()->AI()->SpellHitTargetGameObject(go, spell->m_spellInfo);
spell->m_caster->ToCreature()->AI()->SpellHitTarget(go, spell->m_spellInfo);
else if (spell->m_caster->GetTypeId() == TYPEID_GAMEOBJECT && spell->m_caster->ToGameObject()->AI())
spell->m_caster->ToGameObject()->AI()->SpellHitTargetGameObject(go, spell->m_spellInfo);
spell->m_caster->ToGameObject()->AI()->SpellHitTarget(go, spell->m_spellInfo);
spell->CallScriptOnHitHandlers();
spell->CallScriptAfterHitHandlers();
@@ -123,9 +123,9 @@ public:
instance->SetBossState(DATA_PYROGAURD_EMBERSEER, DONE);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_ENCAGE_EMBERSEER)
if (spellInfo->Id == SPELL_ENCAGE_EMBERSEER)
{
if (!me->GetAuraCount(SPELL_ENCAGED_EMBERSEER))
{
@@ -134,7 +134,7 @@ public:
}
}
if (spell->Id == SPELL_EMBERSEER_GROWING_TRIGGER)
if (spellInfo->Id == SPELL_EMBERSEER_GROWING_TRIGGER)
{
if (me->GetAuraCount(SPELL_EMBERSEER_GROWING_TRIGGER) == 10)
Talk(EMOTE_TEN_STACK);
@@ -222,12 +222,12 @@ public:
std::bind(&BossAI::DoMeleeAttackIfReady, this));
}
void SpellHit(Unit* /*source*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Mechanic == MECHANIC_DISARM)
if (spellInfo->Mechanic == MECHANIC_DISARM)
Talk(SAY_DISARMED);
if (spell->Id == SPELL_MOUNT)
if (spellInfo->Id == SPELL_MOUNT)
{
if (Creature* midnight = ObjectAccessor::GetCreature(*me, _midnightGUID))
{
@@ -154,9 +154,9 @@ public:
creature->AI()->KilledUnit(who);
}
void SpellHit(Unit* /*who*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_INFERNAL_RELAY)
if (spellInfo->Id == SPELL_INFERNAL_RELAY)
{
me->SetDisplayId(me->GetNativeDisplayId());
me->AddUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
@@ -499,7 +499,7 @@ public:
DrinkInturrupted = true;
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spellInfo) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
//We only care about interrupt effects and only if they are durring a spell currently being cast
if (!spellInfo->HasEffect(SPELL_EFFECT_INTERRUPT_CAST) || !me->IsNonMeleeSpellCast(false))
@@ -92,9 +92,9 @@ public:
Talk(SAY_AGGRO);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_BROKEN_PACT)
if (spellInfo->Id == SPELL_BROKEN_PACT)
events.ScheduleEvent(EVENT_SUMMON_KILREK, 32s);
}
@@ -372,9 +372,9 @@ public:
me->DespawnOrUnsummon();
}
void SpellHit(Unit* /*caster*/, SpellInfo const* Spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if ((Spell->SchoolMask == SPELL_SCHOOL_MASK_FIRE) && (!(rand32() % 10)))
if ((spellInfo->SchoolMask == SPELL_SCHOOL_MASK_FIRE) && (!(rand32() % 10)))
{
/*
if (not direct damage(aoe, dot))
@@ -1136,9 +1136,9 @@ public:
me->DespawnOrUnsummon();
}
void SpellHit(Unit* /*caster*/, SpellInfo const* Spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (Spell->Id == SPELL_DRINK_POISON)
if (spellInfo->Id == SPELL_DRINK_POISON)
{
Talk(SAY_JULIANNE_DEATH01);
DrinkPoisonTimer = 2500;
@@ -217,13 +217,17 @@ struct boss_felblood_kaelthas : public BossAI
}
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
{
switch (spell->Id)
Unit* unitTarget = target->ToUnit();
if (!unitTarget)
return;
switch (spellInfo->Id)
{
case SPELL_GRAVITY_LAPSE_INITIAL:
{
DoCast(target, gravityLapseTeleportSpells[_gravityLapseTargetCount], true);
DoCast(unitTarget, gravityLapseTeleportSpells[_gravityLapseTargetCount], true);
uint32 gravityLapseDamageSpell = SPELL_GRAVITY_LAPSE_DAMAGE;
target->m_Events.AddEventAtOffset([target, gravityLapseDamageSpell]()
{
@@ -235,8 +239,8 @@ struct boss_felblood_kaelthas : public BossAI
break;
}
case SPELL_CLEAR_FLIGHT:
target->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY);
target->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_DAMAGE);
unitTarget->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY);
unitTarget->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_DAMAGE);
break;
default:
break;
@@ -577,12 +577,12 @@ public:
me->AddUnitFlag(UNIT_FLAG_SWIMMING);
}
void SpellHit(Unit* pCaster, SpellInfo const* pSpell) override
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
if (!m_bIsDuelInProgress && pSpell->Id == SPELL_DUEL)
if (!m_bIsDuelInProgress && spellInfo->Id == SPELL_DUEL)
{
m_uiDuelerGUID = pCaster->GetGUID();
Talk(SAY_DUEL, pCaster);
m_uiDuelerGUID = caster->GetGUID();
Talk(SAY_DUEL, caster);
m_bIsDuelInProgress = true;
}
}
@@ -758,9 +758,9 @@ struct npc_dark_rider_of_acherus : public ScriptedAI
}
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_DESPAWN_HORSE && target->GetGUID() == _horseGUID)
if (spellInfo->Id == SPELL_DESPAWN_HORSE && target->GetGUID() == _horseGUID)
if (Creature* creature = target->ToCreature())
creature->DespawnOrUnsummon(2s);
}
@@ -205,7 +205,7 @@ struct npc_wisp_invis : public ScriptedAI
DoCastSelf(_firstSpell);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spellInfo) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spellInfo->Id == SPELL_HEADLESS_HORSEMAN___WISP_FLIGHT_PORT && _creatureType == 4)
me->SetDisplayId(DISPLAYID_INVIS_WISP_MAN);
@@ -327,17 +327,21 @@ struct npc_head : public ScriptedAI
}
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
Unit* unitCaster = caster->ToUnit();
if (!unitCaster)
return;
if (!_withBody)
return;
if (spell->Id == SPELL_HEADLESS_HORSEMAN_CLIMAX___SEND_HEAD)
if (spellInfo->Id == SPELL_HEADLESS_HORSEMAN_CLIMAX___SEND_HEAD)
{
_withBody = false;
if (!_bodyGUID)
_bodyGUID = caster->GetGUID();
_bodyGUID = unitCaster->GetGUID();
me->RemoveAllAuras();
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
@@ -348,9 +352,9 @@ struct npc_head : public ScriptedAI
DoTalk(SAY_LOST_HEAD);
_scheduler.Schedule(2s, [caster, this](TaskContext /*context*/)
_scheduler.Schedule(2s, [unitCaster, this](TaskContext /*context*/)
{
me->GetMotionMaster()->MoveFleeing(caster);
me->GetMotionMaster()->MoveFleeing(unitCaster);
});
}
}
@@ -609,10 +613,14 @@ struct boss_headless_horseman : public ScriptedAI
head->AI()->SetData(DATA_HEAD_TALK, SAY_PLAYER_DEATH);
}
void SpellHitTarget(Unit* unit, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_CONFLAGRATION && unit->HasAura(SPELL_CONFLAGRATION))
DoTalk(SAY_CONFLAGRATION, unit);
Unit* unitTarget = target->ToUnit();
if (!unitTarget)
return;
if (spellInfo->Id == SPELL_CONFLAGRATION && unitTarget->HasAura(SPELL_CONFLAGRATION))
DoTalk(SAY_CONFLAGRATION, unitTarget);
}
void JustDied(Unit* /*killer*/) override
@@ -633,8 +641,12 @@ struct boss_headless_horseman : public ScriptedAI
}
}
void SpellHit(Unit* caster, SpellInfo const* spellInfo) override
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
Unit* unitCaster = caster->ToUnit();
if (!unitCaster)
return;
if (_withHead)
return;
@@ -652,8 +664,8 @@ struct boss_headless_horseman : public ScriptedAI
DoTalk(SAY_REJOINED);
DoCastSelf(SPELL_HEADLESS_HORSEMAN_CLIMAX___HEAD_VISUAL);
caster->GetMotionMaster()->Clear();
caster->GetMotionMaster()->MoveFollow(me, 6.f, 0.f);
unitCaster->GetMotionMaster()->Clear();
unitCaster->GetMotionMaster()->MoveFollow(me, 6.f, 0.f);
switch (_phase)
{
@@ -830,9 +842,9 @@ struct npc_pulsing_pumpkin : public ScriptedAI
me->AddUnitFlag(UNIT_FLAG_STUNNED);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_SPROUTING)
if (spellInfo->Id == SPELL_SPROUTING)
{
_sprouted = true;
me->RemoveAllAuras();
@@ -181,10 +181,10 @@ public:
damage = 0;
}
void SpellHit(Unit* /*who*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
// Casted from Whitemane
if (spell->Id == SPELL_SCARLET_RESURRECTION)
if (spellInfo->Id == SPELL_SCARLET_RESURRECTION)
{
scheduler.Schedule(3s, [this](TaskContext /*context*/)
{
@@ -400,7 +400,7 @@ public:
});
}
void SpellHitTarget(Unit* target, SpellInfo const* spellInfo) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
{
if (target->GetEntry() == NPC_MOGRAINE && spellInfo->Id == SPELL_SCARLET_RESURRECTION)
MograineResurrected();
@@ -249,9 +249,9 @@ class boss_archmage_arugal : public CreatureScript
Talk(SAY_SLAY);
}
void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* /*target*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_ARUGAL_CURSE)
if (spellInfo->Id == SPELL_ARUGAL_CURSE)
Talk(SAY_TRANSFORM);
}
@@ -156,9 +156,9 @@ struct npc_summoned_skeleton : public ScriptedAI
{
npc_summoned_skeleton(Creature* creature) : ScriptedAI(creature) { }
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_DEATH_PACT_2)
if (spellInfo->Id == SPELL_DEATH_PACT_2)
DoCastSelf(SPELL_DEATH_PACT_3, true);
}
};
@@ -146,9 +146,9 @@ public:
void JustEngagedWith(Unit* /*who*/) override { }
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
if (Tagged || spell->Id != SPELL_EGAN_BLASTER)
if (Tagged || spellInfo->Id != SPELL_EGAN_BLASTER)
return;
Player* player = caster->ToPlayer();
@@ -242,9 +242,9 @@ public:
void JustEngagedWith(Unit* /*who*/) override { }
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (!Tagged && spell->Id == SPELL_EGAN_BLASTER)
if (!Tagged && spellInfo->Id == SPELL_EGAN_BLASTER)
Tagged = true;
}
@@ -161,18 +161,22 @@ public:
me->RemoveDynamicFlag(UNIT_DYNFLAG_LOOTABLE);
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
{
switch (spell->Id)
Unit* unitTarget = target->ToUnit();
if (!unitTarget)
return;
switch (spellInfo->Id)
{
case SPELL_SHADOW_BLADES:
case SPELL_SHADOW_NOVA:
case SPELL_CONFOUNDING_BLOW:
case SPELL_SHADOW_FURY:
HandleTouchedSpells(target, SPELL_DARK_TOUCHED);
HandleTouchedSpells(unitTarget, SPELL_DARK_TOUCHED);
break;
case SPELL_CONFLAGRATION:
HandleTouchedSpells(target, SPELL_FLAME_TOUCHED);
HandleTouchedSpells(unitTarget, SPELL_FLAME_TOUCHED);
break;
}
}
@@ -437,19 +441,23 @@ public:
me->RemoveDynamicFlag(UNIT_DYNFLAG_LOOTABLE);
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
{
switch (spell->Id)
Unit* unitTarget = target->ToUnit();
if (!unitTarget)
return;
switch (spellInfo->Id)
{
case SPELL_BLAZE:
target->CastSpell(target, SPELL_BLAZE_SUMMON, true);
target->CastSpell(unitTarget, SPELL_BLAZE_SUMMON, true);
break;
case SPELL_CONFLAGRATION:
case SPELL_FLAME_SEAR:
HandleTouchedSpells(target, SPELL_FLAME_TOUCHED);
HandleTouchedSpells(unitTarget, SPELL_FLAME_TOUCHED);
break;
case SPELL_SHADOW_NOVA:
HandleTouchedSpells(target, SPELL_DARK_TOUCHED);
HandleTouchedSpells(unitTarget, SPELL_DARK_TOUCHED);
break;
}
}
@@ -674,19 +682,25 @@ public:
void JustEngagedWith(Unit* /*who*/) override { }
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
{
switch (spell->Id)
Unit* unitTarget = target->ToUnit();
if (!unitTarget)
return;
switch (spellInfo->Id)
{
case SPELL_SHADOW_FURY:
case SPELL_DARK_STRIKE:
if (!target->HasAura(SPELL_DARK_FLAME))
if (!unitTarget->HasAura(SPELL_DARK_FLAME))
{
if (target->HasAura(SPELL_FLAME_TOUCHED))
if (unitTarget->HasAura(SPELL_FLAME_TOUCHED))
{
target->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED);
target->CastSpell(target, SPELL_DARK_FLAME, true);
} else target->CastSpell(target, SPELL_DARK_TOUCHED, true);
unitTarget->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED);
unitTarget->CastSpell(unitTarget, SPELL_DARK_FLAME, true);
}
else
unitTarget->CastSpell(unitTarget, SPELL_DARK_TOUCHED, true);
}
break;
}
@@ -198,26 +198,30 @@ public:
instance->SetBossState(DATA_FELMYST, DONE);
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
Unit* unitCaster = caster->ToUnit();
if (!unitCaster)
return;
// workaround for linked aura
/*if (spell->Id == SPELL_VAPOR_FORCE)
{
caster->CastSpell(caster, SPELL_VAPOR_TRIGGER, true);
}*/
// workaround for mind control
if (spell->Id == SPELL_FOG_INFORM)
if (spellInfo->Id == SPELL_FOG_INFORM)
{
float x, y, z;
caster->GetPosition(x, y, z);
unitCaster->GetPosition(x, y, z);
if (Unit* summon = me->SummonCreature(NPC_DEAD, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000))
{
summon->SetMaxHealth(caster->GetMaxHealth());
summon->SetHealth(caster->GetMaxHealth());
summon->SetMaxHealth(unitCaster->GetMaxHealth());
summon->SetHealth(unitCaster->GetMaxHealth());
summon->CastSpell(summon, SPELL_FOG_CHARM, true);
summon->CastSpell(summon, SPELL_FOG_CHARM2, true);
}
Unit::DealDamage(me, caster, caster->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
Unit::DealDamage(me, unitCaster, unitCaster->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
}
}
@@ -473,12 +473,16 @@ struct boss_sathrovarr : public BossAI
kalecgos->AI()->EnterEvadeMode(why);
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_TAP_CHECK_DAMAGE)
Unit* unitCaster = caster->ToUnit();
if (!unitCaster)
return;
if (spellInfo->Id == SPELL_TAP_CHECK_DAMAGE)
{
DoCastSelf(SPELL_TELEPORT_BACK, true);
Unit::Kill(caster, me);
Unit::Kill(unitCaster, me);
}
}
@@ -353,9 +353,9 @@ public:
summon->m_Events.AddEvent(new VoidSpawnSummon(summon), summon->m_Events.CalculateTime(1500));
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
switch (spell->Id)
switch (spellInfo->Id)
{
case SPELL_OPEN_ALL_PORTALS:
DoCastAOE(SPELL_OPEN_PORTAL, true);
@@ -128,7 +128,7 @@ class boss_archaedas : public CreatureScript
me->SetControlled(false, UNIT_STATE_ROOT);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spellInfo) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
// Being woken up from the altar, start the awaken sequence
if (spellInfo->Id == SPELL_ARCHAEDAS_AWAKEN)
@@ -279,7 +279,7 @@ class npc_archaedas_minions : public CreatureScript
bAmIAwake = true;
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spellInfo) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
// time to wake up, start animation
if (spellInfo->Id == SPELL_ARCHAEDAS_AWAKEN)
@@ -57,7 +57,7 @@ public:
_tapped = false;
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spell) override
{
if (_tapped)
return;
@@ -151,7 +151,7 @@ public:
me->SetHealth(me->CountPctFromMaxHealth(_percentHP));
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spell) override
{
if (!_hitBySpell)
{
@@ -128,9 +128,9 @@ class boss_epoch : public CreatureScript
}
}
void SpellHitTarget(Unit* target, SpellInfo const* info) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
{
if (info->Id == SPELL_TIME_STEP_DUMMY && me->IsHostileTo(target))
if (spellInfo->Id == SPELL_TIME_STEP_DUMMY && me->IsHostileTo(target))
{
_stepTargets.push_back(target->GetGUID());
events.RescheduleEvent(EVENT_TIME_STEP, Milliseconds(500));
@@ -69,9 +69,9 @@ class boss_infinite_corruptor : public CreatureScript
DoCastAOE(SPELL_CORRUPTION_OF_TIME_CHANNEL); // implicitly targets the Guardian
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_CORRUPTION_OF_TIME_CHANNEL)
if (spellInfo->Id == SPELL_CORRUPTION_OF_TIME_CHANNEL)
target->CastSpell(target, SPELL_CORRUPTION_OF_TIME_TARGET, true);
}
@@ -1408,9 +1408,9 @@ public:
current = candidate;
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (!_crateRevealed && spell->Id == SPELL_ARCANE_DISRUPTION)
if (!_crateRevealed && spellInfo->Id == SPELL_ARCANE_DISRUPTION)
{
_crateRevealed = true;
if (InstanceScript* instance = me->GetInstanceScript())
@@ -140,15 +140,15 @@ public:
void JustEngagedWith(Unit* /*who*/) override { }
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (SpellCorrupt_Timer)
return;
if (spell->Id == SPELL_CORRUPT_AEONUS)
if (spellInfo->Id == SPELL_CORRUPT_AEONUS)
SpellCorrupt_Timer = 1000;
if (spell->Id == SPELL_CORRUPT)
if (spellInfo->Id == SPELL_CORRUPT)
SpellCorrupt_Timer = 3000;
}
@@ -291,9 +291,9 @@ struct npc_shard_of_torment : public NullCreatureAI
});
}
void SpellHitTarget(Unit* /*target*/, const SpellInfo* spell) override
void SpellHitTarget(WorldObject* /*target*/, SpellInfo const* spellInfo) override
{
if (spell->Id != SPELL_TORMENT)
if (spellInfo->Id != SPELL_TORMENT)
return;
scheduler.CancelAll();
@@ -196,14 +196,14 @@ public:
Talk(SAY_KILL);
}
void SpellHit(Unit* /*pCaster*/, SpellInfo const* Spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (Spell->Id == SPELL_BREATH_EAST_TO_WEST ||
Spell->Id == SPELL_BREATH_WEST_TO_EAST ||
Spell->Id == SPELL_BREATH_SE_TO_NW ||
Spell->Id == SPELL_BREATH_NW_TO_SE ||
Spell->Id == SPELL_BREATH_SW_TO_NE ||
Spell->Id == SPELL_BREATH_NE_TO_SW)
if (spellInfo->Id == SPELL_BREATH_EAST_TO_WEST ||
spellInfo->Id == SPELL_BREATH_WEST_TO_EAST ||
spellInfo->Id == SPELL_BREATH_SE_TO_NW ||
spellInfo->Id == SPELL_BREATH_NW_TO_SE ||
spellInfo->Id == SPELL_BREATH_SW_TO_NE ||
spellInfo->Id == SPELL_BREATH_NE_TO_SW)
{
PointData = GetMoveData();
MovePoint = PointData->LocIdEnd;
@@ -274,20 +274,20 @@ public:
}
}
void SpellHitTarget(Unit* target, SpellInfo const* Spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
{
//Workaround - Couldn't find a way to group this spells (All Eruption)
if (((Spell->Id >= 17086 && Spell->Id <= 17095) ||
(Spell->Id == 17097) ||
(Spell->Id >= 18351 && Spell->Id <= 18361) ||
(Spell->Id >= 18564 && Spell->Id <= 18576) ||
(Spell->Id >= 18578 && Spell->Id <= 18607) ||
(Spell->Id == 18609) ||
(Spell->Id >= 18611 && Spell->Id <= 18628) ||
(Spell->Id >= 21132 && Spell->Id <= 21133) ||
(Spell->Id >= 21135 && Spell->Id <= 21139) ||
(Spell->Id >= 22191 && Spell->Id <= 22202) ||
(Spell->Id >= 22267 && Spell->Id <= 22268)) &&
if (((spellInfo->Id >= 17086 && spellInfo->Id <= 17095) ||
(spellInfo->Id == 17097) ||
(spellInfo->Id >= 18351 && spellInfo->Id <= 18361) ||
(spellInfo->Id >= 18564 && spellInfo->Id <= 18576) ||
(spellInfo->Id >= 18578 && spellInfo->Id <= 18607) ||
(spellInfo->Id == 18609) ||
(spellInfo->Id >= 18611 && spellInfo->Id <= 18628) ||
(spellInfo->Id >= 21132 && spellInfo->Id <= 21133) ||
(spellInfo->Id >= 21135 && spellInfo->Id <= 21139) ||
(spellInfo->Id >= 22191 && spellInfo->Id <= 22202) ||
(spellInfo->Id >= 22267 && spellInfo->Id <= 22268)) &&
(target->GetTypeId() == TYPEID_PLAYER))
{
instance->SetData(DATA_SHE_DEEP_BREATH_MORE, FAIL);
@@ -122,11 +122,11 @@ class boss_ossirian : public CreatureScript
Initialize();
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
for (uint8 i = 0; i < NUM_WEAKNESS; ++i)
{
if (spell->Id == SpellWeakness[i])
if (spellInfo->Id == SpellWeakness[i])
{
me->RemoveAurasDueToSpell(SPELL_SUPREME);
// Despawn used crystal
@@ -164,13 +164,13 @@ struct boss_twinemperorsAI : public BossAI
}
}
void SpellHit(Unit* caster, SpellInfo const* entry) override
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
if (caster == me)
return;
Creature* pOtherBoss = GetOtherBoss();
if (entry->Id != SPELL_HEAL_BROTHER || !pOtherBoss)
if (spellInfo->Id != SPELL_HEAL_BROTHER || !pOtherBoss)
return;
// add health so we keep same percentage for both brothers
@@ -151,9 +151,9 @@ class boss_viscidus : public CreatureScript
Talk(EMOTE_CRACK);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if ((spell->GetSchoolMask() & SPELL_SCHOOL_MASK_FROST) && _phase == PHASE_FROST && me->GetHealthPct() > 5.0f)
if ((spellInfo->GetSchoolMask() & SPELL_SCHOOL_MASK_FROST) && _phase == PHASE_FROST && me->GetHealthPct() > 5.0f)
{
++_hitcounter;
@@ -106,9 +106,9 @@ public:
}
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
if (spell->SpellFamilyFlags[2] & 0x80000000 && !_tappedBySpell)
if (spellInfo->SpellFamilyFlags[2] & 0x80000000 && !_tappedBySpell)
{
_events.Reset();
_tappedBySpell = true;
+10 -6
View File
@@ -73,14 +73,18 @@ public:
}
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_KODO_KOMBO_ITEM)
Unit* unitCaster = caster->ToUnit();
if (!unitCaster)
return;
if (spellInfo->Id == SPELL_KODO_KOMBO_ITEM)
{
if (!(caster->HasAura(SPELL_KODO_KOMBO_PLAYER_BUFF) || me->HasAura(SPELL_KODO_KOMBO_DESPAWN_BUFF))
if (!(unitCaster->HasAura(SPELL_KODO_KOMBO_PLAYER_BUFF) || me->HasAura(SPELL_KODO_KOMBO_DESPAWN_BUFF))
&& (me->GetEntry() == NPC_AGED_KODO || me->GetEntry() == NPC_DYING_KODO || me->GetEntry() == NPC_ANCIENT_KODO))
{
caster->CastSpell(caster, SPELL_KODO_KOMBO_PLAYER_BUFF, true);
unitCaster->CastSpell(unitCaster, SPELL_KODO_KOMBO_PLAYER_BUFF, true);
DoCast(me, SPELL_KODO_KOMBO_DESPAWN_BUFF, true);
me->UpdateEntry(NPC_TAMED_KODO);
@@ -90,12 +94,12 @@ public:
EngagementOver();
me->GetMotionMaster()->MoveFollow(caster, PET_FOLLOW_DIST, me->GetFollowAngle());
me->GetMotionMaster()->MoveFollow(unitCaster, PET_FOLLOW_DIST, me->GetFollowAngle());
me->setActive(true);
me->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
}
}
else if (spell->Id == SPELL_KODO_KOMBO_GOSSIP)
else if (spellInfo->Id == SPELL_KODO_KOMBO_GOSSIP)
{
me->AddNpcFlag(UNIT_NPC_FLAG_GOSSIP);
me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
+1 -1
View File
@@ -79,7 +79,7 @@ public:
work = true;
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spell) override
{
if (spell->Id != SPELL_AWAKEN_PEON)
return;
@@ -84,9 +84,9 @@ public:
DoCast(SPELL_OMEN_SUMMON_SPOTLIGHT);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_ELUNE_CANDLE)
if (spellInfo->Id == SPELL_ELUNE_CANDLE)
{
if (me->HasAura(SPELL_OMEN_STARFALL))
me->RemoveAurasDueToSpell(SPELL_OMEN_STARFALL);
@@ -187,9 +187,9 @@ public:
me->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_FLARE || spell->Id == SPELL_FOLLY)
if (spellInfo->Id == SPELL_FLARE || spellInfo->Id == SPELL_FOLLY)
{
++FlareCount;
@@ -111,9 +111,9 @@ public:
}
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_INSANITY)
if (spellInfo->Id == SPELL_INSANITY)
{
// Not good target or too many players
if (target->GetTypeId() != TYPEID_PLAYER || insanityHandled > 4)
@@ -361,9 +361,9 @@ public:
}
}
void SpellHit(Unit* /*whose*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_SUBMERGE)
if (spellInfo->Id == SPELL_SUBMERGE)
{
me->AddUnitFlag(UnitFlags(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE));
me->RemoveAurasDueToSpell(SPELL_LEECHING_SWARM);
@@ -294,15 +294,15 @@ class boss_krik_thir : public CreatureScript
DoMeleeAttackIfReady();
}
void SpellHit(Unit* /*whose*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_SUBBOSS_AGGRO_TRIGGER)
if (spellInfo->Id == SPELL_SUBBOSS_AGGRO_TRIGGER)
DoZoneInCombat();
}
void SpellHitTarget(Unit* /*who*/, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* /*target*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_SUBBOSS_AGGRO_TRIGGER)
if (spellInfo->Id == SPELL_SUBBOSS_AGGRO_TRIGGER)
Talk(SAY_SEND_GROUP);
}
@@ -381,9 +381,9 @@ struct npc_gatewatcher_petAI : public ScriptedAI
JustEngagedWith(who);
}
void SpellHit(Unit* /*whose*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_SUBBOSS_AGGRO_TRIGGER)
if (spellInfo->Id == SPELL_SUBBOSS_AGGRO_TRIGGER)
DoZoneInCombat();
}
@@ -753,10 +753,14 @@ class npc_anub_ar_skirmisher : public CreatureScript
DoMeleeAttackIfReady();
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_CHARGE && target)
DoCast(target, SPELL_FIXATE_TRIGGER);
Unit* unitTarget = target->ToUnit();
if (!unitTarget)
return;
if (spellInfo->Id == SPELL_CHARGE)
DoCast(unitTarget, SPELL_FIXATE_TRIGGER);
}
};
@@ -309,7 +309,7 @@ class boss_halion : public CreatureScript
}
}
void SpellHit(Unit* /*who*/, SpellInfo const* spellInfo) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spellInfo->Id == SPELL_TWILIGHT_MENDING)
Talk(SAY_REGENERATE);
@@ -494,9 +494,9 @@ class boss_twilight_halion : public CreatureScript
}
}
void SpellHit(Unit* /*who*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
switch (spell->Id)
switch (spellInfo->Id)
{
case SPELL_TWILIGHT_DIVISION:
if (Creature* controller = instance->GetCreature(DATA_HALION_CONTROLLER))
@@ -643,7 +643,7 @@ struct npc_open_portal_target_toc : public ScriptedAI
me->SetDisableGravity(true);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spellInfo) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spellInfo->Id == SPELL_OPEN_PORTAL)
{
@@ -221,9 +221,9 @@ class boss_devourer_of_souls : public CreatureScript
}
}
void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* /*target*/, SpellInfo const* spellInfo) override
{
if (spell->Id == H_SPELL_PHANTOM_BLAST)
if (spellInfo->Id == H_SPELL_PHANTOM_BLAST)
threeFaced = false;
}
@@ -171,11 +171,15 @@ class boss_garfrost : public CreatureScript
events.ScheduleEvent(EVENT_RESUME_ATTACK, 5s);
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_PERMAFROST_HELPER)
Unit* unitTarget = target->ToUnit();
if (!unitTarget)
return;
if (spellInfo->Id == SPELL_PERMAFROST_HELPER)
{
if (Aura* aura = target->GetAura(SPELL_PERMAFROST_HELPER))
if (Aura* aura = unitTarget->GetAura(SPELL_PERMAFROST_HELPER))
_permafrostStack = std::max<uint32>(_permafrostStack, aura->GetStackAmount());
}
}
@@ -346,9 +346,9 @@ class boss_drakkari_elemental : public CreatureScript
me->DespawnOrUnsummon();
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_MERGE)
if (spellInfo->Id == SPELL_MERGE)
{
if (Creature* colossus = target->ToCreature())
{
@@ -174,7 +174,7 @@ class boss_gal_darah : public CreatureScript
Talk(SAY_SLAY);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spellInfo) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spellInfo->Id == SPELL_TRANSFORM_BACK)
me->RemoveAurasDueToSpell(SPELL_TRANSFORM_RHINO);
@@ -126,7 +126,7 @@ class boss_moorabi : public CreatureScript
Talk(SAY_DEATH);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spellInfo) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spellInfo->Id == SPELL_TRANSFORMATION)
{
@@ -544,9 +544,9 @@ struct BloodPrincesBossAI : public BossAI
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SelectInvocationSpell())
if (spellInfo->Id == SelectInvocationSpell())
DoAction(ACTION_CAST_INVOCATION);
}
@@ -414,7 +414,7 @@ class boss_deathbringer_saurfang : public CreatureScript
instance->HandleGameObject(instance->GetGuidData(GO_SAURFANG_S_DOOR), false);
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
{
if (target->GetTransport())
{
@@ -422,7 +422,7 @@ class boss_deathbringer_saurfang : public CreatureScript
return;
}
switch (spell->Id)
switch (spellInfo->Id)
{
case SPELL_MARK_OF_THE_FALLEN_CHAMPION:
Talk(SAY_MARK_OF_THE_FALLEN_CHAMPION);
@@ -443,9 +443,9 @@ class boss_deathbringer_saurfang : public CreatureScript
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_BLOOD_LINK_POWER)
if (spellInfo->Id == SPELL_BLOOD_LINK_POWER)
if (Aura* bloodPower = me->GetAura(SPELL_BLOOD_POWER))
bloodPower->RecalculateAmountOfEffects();
}
@@ -715,9 +715,9 @@ class npc_high_overlord_saurfang_icc : public CreatureScript
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_GRIP_OF_AGONY)
if (spellInfo->Id == SPELL_GRIP_OF_AGONY)
{
me->SetDisableGravity(true);
me->GetMotionMaster()->MovePoint(POINT_CHOKE, chokePos[0]);
@@ -922,9 +922,9 @@ class npc_muradin_bronzebeard_icc : public CreatureScript
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_GRIP_OF_AGONY)
if (spellInfo->Id == SPELL_GRIP_OF_AGONY)
{
me->SetDisableGravity(true);
me->GetMotionMaster()->MovePoint(POINT_CHOKE, chokePos[0]);
@@ -1004,9 +1004,9 @@ class npc_saurfang_event : public CreatureScript
_index = data;
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_GRIP_OF_AGONY)
if (spellInfo->Id == SPELL_GRIP_OF_AGONY)
{
me->SetDisableGravity(true);
me->GetMotionMaster()->MovePoint(POINT_CHOKE, chokePos[_index]);
@@ -160,10 +160,14 @@ class boss_festergut : public CreatureScript
Talk(SAY_KILL);
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
{
if (spell->Id == PUNGENT_BLIGHT_HELPER)
target->RemoveAurasDueToSpell(INOCULATED_HELPER);
Unit* unitTarget = target->ToUnit();
if (!unitTarget)
return;
if (spellInfo->Id == PUNGENT_BLIGHT_HELPER)
unitTarget->RemoveAurasDueToSpell(INOCULATED_HELPER);
}
void UpdateAI(uint32 diff) override
@@ -459,9 +459,9 @@ class boss_lady_deathwhisper : public CreatureScript
}
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_SUMMON_SPIRITS)
if (spellInfo->Id == SPELL_SUMMON_SPIRITS)
_nextVengefulShadeTargetGUID.push_back(target->GetGUID());
}
@@ -628,9 +628,9 @@ class npc_cult_fanatic : public CreatureScript
});
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
switch (spell->Id)
switch (spellInfo->Id)
{
case SPELL_DARK_TRANSFORMATION_T:
me->InterruptNonMeleeSpells(true);
@@ -735,9 +735,9 @@ class npc_cult_adherent : public CreatureScript
});
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
switch (spell->Id)
switch (spellInfo->Id)
{
case SPELL_DARK_EMPOWERMENT_T:
me->UpdateEntry(NPC_EMPOWERED_ADHERENT);
@@ -828,9 +828,9 @@ class npc_vengeful_shade : public CreatureScript
_targetGUID = guid;
}
void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* /*target*/, SpellInfo const* spellInfo) override
{
switch (spell->Id)
switch (spellInfo->Id)
{
case SPELL_VENGEFUL_BLAST:
case SPELL_VENGEFUL_BLAST_25N:
@@ -726,9 +726,9 @@ class npc_putricide_oozeAI : public ScriptedAI
npc_putricide_oozeAI(Creature* creature, uint32 auraSpellId, uint32 hitTargetSpellId) : ScriptedAI(creature),
_auraSpellId(auraSpellId), _hitTargetSpellId(hitTargetSpellId), _newTargetSelectTimer(0), _instance(creature->GetInstanceScript()) { }
void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* /*target*/, SpellInfo const* spellInfo) override
{
if (!_newTargetSelectTimer && spell->Id == _hitTargetSpellId)
if (!_newTargetSelectTimer && spellInfo->Id == _hitTargetSpellId)
{
_newTargetSelectTimer = 1000;
// go passive until next target selection
@@ -745,9 +745,9 @@ class npc_putricide_oozeAI : public ScriptedAI
DoCastAOE(_auraSpellId, true);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_TEAR_GAS_CREATURE)
if (spellInfo->Id == SPELL_TEAR_GAS_CREATURE)
_newTargetSelectTimer = 1000;
}
@@ -172,9 +172,9 @@ class boss_rotface : public CreatureScript
professor->AI()->EnterEvadeMode();
}
void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* /*target*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_SLIME_SPRAY)
if (spellInfo->Id == SPELL_SLIME_SPRAY)
Talk(SAY_SLIME_SPRAY);
}
@@ -439,10 +439,14 @@ class boss_sindragosa : public CreatureScript
summon->AI()->JustDied(summon);
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
{
if (spell->Id == 70127)
if (Aura const* mysticBuffet = target->GetAura(spell->Id))
Unit* unitTarget = target->ToUnit();
if (!unitTarget)
return;
if (spellInfo->Id == 70127)
if (Aura const* mysticBuffet = unitTarget->GetAura(spellInfo->Id))
_mysticBuffetStack = std::max<uint8>(_mysticBuffetStack, mysticBuffet->GetStackAmount());
}
@@ -414,9 +414,9 @@ struct boss_sister_svalna : public BossAI
}
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_HURL_SPEAR && me->HasAura(SPELL_AETHER_SHIELD))
if (spellInfo->Id == SPELL_HURL_SPEAR && me->HasAura(SPELL_AETHER_SHIELD))
{
me->RemoveAurasDueToSpell(SPELL_AETHER_SHIELD);
Talk(EMOTE_SVALNA_BROKEN_SHIELD, caster);
@@ -436,17 +436,21 @@ struct boss_sister_svalna : public BossAI
me->SetHover(false);
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
{
switch (spell->Id)
Unit* unitTarget = target->ToUnit();
if (!unitTarget)
return;
switch (spellInfo->Id)
{
case SPELL_IMPALING_SPEAR_KILL:
Unit::Kill(me, target);
Unit::Kill(me, unitTarget);
break;
case SPELL_IMPALING_SPEAR:
if (TempSummon* summon = target->SummonCreature(NPC_IMPALING_SPEAR, *target))
if (TempSummon* summon = unitTarget->SummonCreature(NPC_IMPALING_SPEAR, *unitTarget))
{
Talk(EMOTE_SVALNA_IMPALE, target);
Talk(EMOTE_SVALNA_IMPALE, unitTarget);
CastSpellExtraArgs args;
args.AddSpellBP0(1);
summon->CastSpell(target, VEHICLE_SPELL_RIDE_HARDCODED, args);
@@ -874,9 +878,9 @@ public:
Reset();
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_REVIVE_CHAMPION && !IsUndead)
if (spellInfo->Id == SPELL_REVIVE_CHAMPION && !IsUndead)
{
IsUndead = true;
me->setDeathState(JUST_RESPAWNED);
@@ -901,7 +905,7 @@ public:
Talk(SAY_CAPTAIN_RESURRECTED);
me->UpdateEntry(newEntry, me->GetCreatureData());
DoCast(me, SPELL_UNDEATH, true);
DoCastSelf(SPELL_UNDEATH, true);
}
}
@@ -792,15 +792,12 @@ class boss_the_lich_king : public CreatureScript
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_HARVESTED_SOUL && me->IsInCombat() && !IsHeroic())
if (spellInfo->Id == SPELL_HARVESTED_SOUL && me->IsInCombat() && !IsHeroic())
Talk(SAY_LK_FROSTMOURNE_KILL);
}
void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override
{
if (spell->Id == REMORSELESS_WINTER_1 || spell->Id == REMORSELESS_WINTER_2)
if (spellInfo->Id == REMORSELESS_WINTER_1 || spellInfo->Id == REMORSELESS_WINTER_2)
{
me->GetMap()->SetZoneOverrideLight(AREA_ICECROWN_CITADEL, LIGHT_DEFAULT, LIGHT_SNOWSTORM, 5000);
me->GetMap()->SetZoneWeather(AREA_ICECROWN_CITADEL, WEATHER_STATE_LIGHT_SNOW, 0.5f);
@@ -1205,11 +1202,11 @@ class npc_tirion_fordring_tft : public CreatureScript
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_ICE_LOCK)
if (spellInfo->Id == SPELL_ICE_LOCK)
me->SetFacingTo(3.085098f);
else if (spell->Id == SPELL_BROKEN_FROSTMOURNE_KNOCK)
else if (spellInfo->Id == SPELL_BROKEN_FROSTMOURNE_KNOCK)
me->LoadEquipment(1); // remove glow on ashbringer
}
@@ -378,9 +378,9 @@ class boss_valithria_dreamwalker : public CreatureScript
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_DREAM_SLIP)
if (spellInfo->Id == SPELL_DREAM_SLIP)
{
DoCastSelf(SPELL_CLEAR_ALL);
DoCastSelf(SPELL_REPUTATION_BOSS_KILL, true);
@@ -740,9 +740,9 @@ struct npc_icc_orb_controller : public ScriptedAI
}
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_ORB_CONTROLLER_ACTIVE)
if (spellInfo->Id == SPELL_ORB_CONTROLLER_ACTIVE)
if (GameObject* orb = me->FindNearestGameObject(GO_EMPOWERING_BLOOD_ORB, 5.0f))
orb->AI()->SetGUID(caster->GetGUID(), DATA_GUID);
}
@@ -68,10 +68,14 @@ public:
_events.ScheduleEvent(EVENT_CRUSHING_LEAP, 15s);
}
void SpellHit(Unit* caster, SpellInfo const* /*spell*/) override
void SpellHit(WorldObject* caster, SpellInfo const* /*spellInfo*/) override
{
if (caster->IsVehicle())
Unit::Kill(me, caster);
Unit* unitCaster = caster->ToUnit();
if (!unitCaster)
return;
if (unitCaster->IsVehicle())
Unit::Kill(me, unitCaster);
}
void UpdateAI(uint32 diff) override
@@ -124,13 +124,17 @@ class boss_faerlina : public CreatureScript
Talk(SAY_DEATH);
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_WIDOWS_EMBRACE_HELPER)
Unit* unitCaster = caster->ToUnit();
if (!unitCaster)
return;
if (spellInfo->Id == SPELL_WIDOWS_EMBRACE_HELPER)
{
++_frenzyDispels;
Talk(EMOTE_WIDOW_EMBRACE, caster);
Unit::Kill(me, caster);
Unit::Kill(me, unitCaster);
}
}
@@ -46,31 +46,25 @@ enum Spells
/* baron */
SPELL_BARON_MARK = 28834,
SPELL_UNHOLY_SHADOW = 28882,
/* thane */
SPELL_THANE_MARK = 28832,
SPELL_METEOR = 28884,
/* lady */
SPELL_SHADOW_BOLT = 57374,
SPELL_LADY_MARK = 28833,
SPELL_VOID_ZONE = 28863,
SPELL_UNYIELDING_PAIN = 57381,
/* sir */
SPELL_HOLY_BOLT = 57376,
SPELL_SIR_MARK = 28835,
SPELL_HOLY_WRATH = 28883,
SPELL_CONDEMNATION = 57377
};
#define SPELL_HELPER_UNHOLY_SHADOW RAID_MODE<uint32>(28882, 57369) // Rivendare: Unholy Shadow
#define SPELL_HELPER_METEOR RAID_MODE<uint32>(28884, 57467) // Korth'azz: Meteor
#define SPELL_HELPER_SHADOW_BOLT RAID_MODE<uint32>(57374, 57464) // Blaumeux : Shadow Bolt
#define SPELL_HELPER_VOID_ZONE RAID_MODE<uint32>(28863, 57463) // Blaumeux : Void Zone
#define SPELL_HELPER_HOLY_BOLT RAID_MODE<uint32>(57376, 57465) // Zeliek : Holy Bolt
#define SPELL_HELPER_HOLY_WRATH RAID_MODE<uint32>(28883, 57466) // Zeliek: Holy Wrath
#define SPELL_UNHOLY_SHADOW RAID_MODE<uint32>(28882, 57369) // Rivendare: Unholy Shadow
#define SPELL_METEOR RAID_MODE<uint32>(28884, 57467) // Korth'azz: Meteor
#define SPELL_SHADOW_BOLT RAID_MODE<uint32>(57374, 57464) // Blaumeux : Shadow Bolt
#define SPELL_VOID_ZONE RAID_MODE<uint32>(28863, 57463) // Blaumeux : Void Zone
#define SPELL_HOLY_BOLT RAID_MODE<uint32>(57376, 57465) // Zeliek : Holy Bolt
#define SPELL_HOLY_WRATH RAID_MODE<uint32>(28883, 57466) // Zeliek: Holy Wrath
enum Actions
{
@@ -439,7 +433,7 @@ class boss_four_horsemen_baron : public CreatureScript
events.Repeat(Seconds(12));
break;
case EVENT_UNHOLYSHADOW:
DoCastVictim(SPELL_HELPER_UNHOLY_SHADOW);
DoCastVictim(SPELL_UNHOLY_SHADOW);
events.Repeat(randtime(Seconds(10), Seconds(30)));
break;
}
@@ -450,9 +444,9 @@ class boss_four_horsemen_baron : public CreatureScript
DoMeleeAttackIfReady();
}
void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* /*target*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_HELPER_UNHOLY_SHADOW)
if (spellInfo->Id == SPELL_UNHOLY_SHADOW)
Talk(SAY_SPECIAL);
}
};
@@ -513,7 +507,7 @@ class boss_four_horsemen_thane : public CreatureScript
case EVENT_METEOR:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 20.0f, true))
{
DoCast(target, SPELL_HELPER_METEOR);
DoCast(target, SPELL_METEOR);
_shouldSay = true;
}
events.Repeat(randtime(Seconds(13), Seconds(17)));
@@ -526,9 +520,9 @@ class boss_four_horsemen_thane : public CreatureScript
DoMeleeAttackIfReady();
}
void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* /*target*/, SpellInfo const* spellInfo) override
{
if (_shouldSay && spell->Id == SPELL_HELPER_METEOR)
if (_shouldSay && spellInfo->Id == SPELL_METEOR)
{
Talk(SAY_SPECIAL);
_shouldSay = false;
@@ -588,7 +582,7 @@ class boss_four_horsemen_lady : public CreatureScript
case EVENT_VOIDZONE:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f, true))
{
DoCast(target, SPELL_HELPER_VOID_ZONE, true);
DoCast(target, SPELL_VOID_ZONE, true);
Talk(SAY_SPECIAL);
}
events.Repeat(randtime(Seconds(12), Seconds(18)));
@@ -600,7 +594,7 @@ class boss_four_horsemen_lady : public CreatureScript
return;
if (Unit* target = SelectTarget(SELECT_TARGET_MINDISTANCE, 0, 45.0f, true))
DoCast(target, SPELL_HELPER_SHADOW_BOLT);
DoCast(target, SPELL_SHADOW_BOLT);
else
{
DoCastAOE(SPELL_UNYIELDING_PAIN);
@@ -658,7 +652,7 @@ class boss_four_horsemen_sir : public CreatureScript
case EVENT_HOLYWRATH:
if (Unit* target = SelectTarget(SELECT_TARGET_MINDISTANCE, 0, 45.0f, true))
{
DoCast(target, SPELL_HELPER_HOLY_WRATH, true);
DoCast(target, SPELL_HOLY_WRATH, true);
_shouldSay = true;
}
events.Repeat(randtime(Seconds(10), Seconds(18)));
@@ -670,7 +664,7 @@ class boss_four_horsemen_sir : public CreatureScript
return;
if (Unit* target = SelectTarget(SELECT_TARGET_MINDISTANCE, 0, 45.0f, true))
DoCast(target, SPELL_HELPER_HOLY_BOLT);
DoCast(target, SPELL_HOLY_BOLT);
else
{
DoCastAOE(SPELL_CONDEMNATION);
@@ -678,9 +672,9 @@ class boss_four_horsemen_sir : public CreatureScript
}
}
void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* /*target*/, SpellInfo const* spellInfo) override
{
if (_shouldSay && spell->Id == SPELL_HELPER_HOLY_WRATH)
if (_shouldSay && spellInfo->Id == SPELL_HOLY_WRATH)
{
Talk(SAY_SPECIAL);
_shouldSay = false;
@@ -909,12 +909,10 @@ public:
return nullptr;
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
{
if (!spell)
return;
switch (spell->Id)
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
switch (spellInfo->Id)
{
case SPELL_ANCHOR_1_TRAINEE:
DoCastAOE(SPELL_ANCHOR_2_TRAINEE, true);
@@ -65,9 +65,9 @@ class boss_grobbulus : public CreatureScript
events.ScheduleEvent(EVENT_BERSERK, 12min);
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_SLIME_SPRAY)
if (spellInfo->Id == SPELL_SLIME_SPRAY)
me->SummonCreature(NPC_FALLOUT_SLIME, *target, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT);
}
@@ -279,9 +279,9 @@ public:
damage = 0;
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_CHAINS_DUMMY)
if (spellInfo->Id == SPELL_CHAINS_DUMMY)
{
Talk(SAY_CHAINS);
std::list<Unit*> targets;
@@ -99,9 +99,9 @@ public:
Talk(SAY_SLAY);
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_UNDERSTUDY_TAUNT)
if (spellInfo->Id == SPELL_UNDERSTUDY_TAUNT)
Talk(SAY_TAUNTED, caster);
}
@@ -187,12 +187,16 @@ class boss_sapphiron : public CreatureScript
EnterPhaseGround(true);
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
{
switch(spell->Id)
Unit* unitTarget = target->ToUnit();
if (!unitTarget)
return;
switch(spellInfo->Id)
{
case SPELL_CHECK_RESISTS:
if (target && target->GetResistance(SPELL_SCHOOL_MASK_FROST) > MAX_FROST_RESISTANCE)
if (unitTarget->GetResistance(SPELL_SCHOOL_FROST) > MAX_FROST_RESISTANCE)
_canTheHundredClub = false;
break;
}
@@ -599,35 +599,36 @@ public:
refreshBeam = true;
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
if (!caster)
Creature* creatureCaster = caster->ToCreature();
if (!creatureCaster)
return;
if (spell->Id != SPELL_STALAGG_TESLA_PERIODIC)
if (spellInfo->Id != SPELL_STALAGG_TESLA_PERIODIC)
return;
if (!isFeignDeath && me->IsInCombat() && !me->GetHomePosition().IsInDist(me, OVERLOAD_DISTANCE))
{
if (!isOverloading)
{
isOverloading = true;
caster->SetImmuneToPC(false);
if (Creature* creatureCaster = caster->ToCreature())
creatureCaster->AI()->Talk(EMOTE_TESLA_LINK_BREAKS);
creatureCaster->SetImmuneToPC(false);
creatureCaster->AI()->Talk(EMOTE_TESLA_LINK_BREAKS);
me->RemoveAura(SPELL_STALAGG_CHAIN_VISUAL);
}
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
{
caster->CastStop(SPELL_TESLA_SHOCK);
caster->CastSpell(target, SPELL_TESLA_SHOCK,true);
creatureCaster->CastStop(SPELL_TESLA_SHOCK);
creatureCaster->CastSpell(target, SPELL_TESLA_SHOCK,true);
}
}
else if (isOverloading || refreshBeam)
{
isOverloading = false;
refreshBeam = false;
caster->CastStop();
caster->CastSpell(me, SPELL_STALAGG_CHAIN_VISUAL, true);
caster->SetImmuneToPC(true);
creatureCaster->CastStop();
creatureCaster->CastSpell(me, SPELL_STALAGG_CHAIN_VISUAL, true);
creatureCaster->SetImmuneToPC(true);
}
}
@@ -848,35 +849,37 @@ public:
refreshBeam = true;
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
if (!caster)
Creature* creatureCaster = caster->ToCreature();
if (!creatureCaster)
return;
if (spell->Id != SPELL_FEUGEN_TESLA_PERIODIC)
if (spellInfo->Id != SPELL_FEUGEN_TESLA_PERIODIC)
return;
if (!isFeignDeath && me->IsInCombat() && !me->GetHomePosition().IsInDist(me, OVERLOAD_DISTANCE))
{
if (!isOverloading)
{
isOverloading = true;
caster->SetImmuneToPC(false);
if (Creature* creatureCaster = caster->ToCreature())
creatureCaster->AI()->Talk(EMOTE_TESLA_LINK_BREAKS);
creatureCaster->SetImmuneToPC(false);
creatureCaster->AI()->Talk(EMOTE_TESLA_LINK_BREAKS);
me->RemoveAura(SPELL_STALAGG_CHAIN_VISUAL);
}
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
{
caster->CastStop(SPELL_TESLA_SHOCK);
caster->CastSpell(target, SPELL_TESLA_SHOCK,true);
creatureCaster->CastStop(SPELL_TESLA_SHOCK);
creatureCaster->CastSpell(target, SPELL_TESLA_SHOCK,true);
}
}
else if (isOverloading || refreshBeam)
{
isOverloading = false;
refreshBeam = false;
caster->CastStop();
caster->CastSpell(me, SPELL_FEUGEN_CHAIN_VISUAL, true);
caster->SetImmuneToPC(true);
creatureCaster->CastStop();
creatureCaster->CastSpell(me, SPELL_FEUGEN_CHAIN_VISUAL, true);
creatureCaster->SetImmuneToPC(true);
}
}
@@ -627,16 +627,16 @@ public:
}
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_POWER_SPARK_MALYGOS)
if (spellInfo->Id == SPELL_POWER_SPARK_MALYGOS)
{
if (Creature* creature = caster->ToCreature())
creature->DespawnOrUnsummon();
Talk(SAY_BUFF_SPARK);
}
else if (spell->Id == SPELL_MALYGOS_BERSERK)
else if (spellInfo->Id == SPELL_MALYGOS_BERSERK)
Talk(EMOTE_HIT_BERSERKER_TIMER);
}
@@ -1028,9 +1028,9 @@ public:
_instance = creature->GetInstanceScript();
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_PORTAL_OPENED)
if (spellInfo->Id == SPELL_PORTAL_OPENED)
{
if (Creature* malygos = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_MALYGOS)))
{
@@ -1479,12 +1479,12 @@ public:
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_ARCANE_BOMB_TRIGGER)
if (spellInfo->Id == SPELL_ARCANE_BOMB_TRIGGER)
{
DoCastAOE(SPELL_ARCANE_BOMB_KNOCKBACK_DAMAGE, true);
DoCast(me, SPELL_ARCANE_OVERLOAD_1, true);
DoCastSelf(SPELL_ARCANE_OVERLOAD_1, true);
}
}
@@ -296,7 +296,7 @@ class boss_urom : public CreatureScript
EngagementOver();
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spellInfo) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
switch (spellInfo->Id)
{
@@ -203,9 +203,9 @@ class npc_azure_ring_captain : public CreatureScript
me->SetReactState(REACT_AGGRESSIVE);
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_ICE_BEAM)
if (spellInfo->Id == SPELL_ICE_BEAM)
{
target->CastSpell(target, SPELL_SUMMON_ARCANE_BEAM, true);
me->DespawnOrUnsummon();
@@ -265,10 +265,10 @@ class npc_ruby_emerald_amber_drake : public CreatureScript
Initialize();
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (Unit* creator = ObjectAccessor::GetUnit(*me, me->GetCreatorGUID()))
if (spell->Id == SPELL_GPS)
if (spellInfo->Id == SPELL_GPS)
{
if (_instance->GetBossState(DATA_EREGOS) == DONE)
Talk(WHISPER_GPS_END, creator);
@@ -146,9 +146,9 @@ public:
Talk(SAY_SLAY);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_DISPERSE)
if (spellInfo->Id == SPELL_DISPERSE)
{
for (uint8 i = 0; i < DATA_MAX_SPARKS; ++i)
me->CastSpell(me, SPELL_SUMMON_SPARK, true);
@@ -52,9 +52,10 @@ enum Spells
// Molten Golem
SPELL_BLAST_WAVE = 23113,
SPELL_IMMOLATION_STRIKE = 52433,
SPELL_SHATTER = 52429,
};
#define SPELL_SHATTER DUNGEON_MODE<uint32>(52429,59527)
enum Events
{
EVENT_PAUSE = 1,
@@ -440,10 +441,10 @@ public:
}
}
void SpellHit(Unit* /*pCaster*/, SpellInfo const* pSpell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
// This is the dummy effect of the spells
if (pSpell->Id == SPELL_SHATTER)
if (spellInfo->Id == SPELL_SHATTER)
if (me->GetEntry() == NPC_BRITTLE_GOLEM)
me->DespawnOrUnsummon();
}
@@ -765,14 +765,18 @@ struct npc_living_constellation : public CreatureAI
}
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
if (spell->Id != SPELL_CONSTELLATION_PHASE_EFFECT || caster->GetTypeId() != TYPEID_UNIT)
Creature* creatureCaster = caster->ToCreature();
if (!creatureCaster)
return;
if (spellInfo->Id != SPELL_CONSTELLATION_PHASE_EFFECT)
return;
_instance->DoStartCriteriaTimer(CriteriaStartEvent::SendEvent, EVENT_ID_SUPERMASSIVE_START);
caster->CastSpell(nullptr, SPELL_BLACK_HOLE_CREDIT, TRIGGERED_FULL_MASK);
DoCast(caster, SPELL_DESPAWN_BLACK_HOLE, TRIGGERED_FULL_MASK);
creatureCaster->CastSpell(nullptr, SPELL_BLACK_HOLE_CREDIT, TRIGGERED_FULL_MASK);
DoCast(creatureCaster, SPELL_DESPAWN_BLACK_HOLE, TRIGGERED_FULL_MASK);
me->DespawnOrUnsummon(500ms);
}
@@ -825,9 +829,9 @@ struct npc_black_hole : public ScriptedAI
_summons.Summon(summon);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_DESPAWN_BLACK_HOLE)
if (spellInfo->Id == SPELL_DESPAWN_BLACK_HOLE)
{
_summons.DespawnAll();
me->DespawnOrUnsummon(1);
@@ -333,16 +333,16 @@ class boss_flame_leviathan : public CreatureScript
Talk(SAY_DEATH);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_START_THE_ENGINE)
if (spellInfo->Id == SPELL_START_THE_ENGINE)
if (Vehicle* vehicleKit = me->GetVehicleKit())
vehicleKit->InstallAllAccessories(false);
if (spell->Id == SPELL_ELECTROSHOCK)
if (spellInfo->Id == SPELL_ELECTROSHOCK)
me->InterruptSpell(CURRENT_CHANNELED_SPELL);
if (spell->Id == SPELL_OVERLOAD_CIRCUIT)
if (spellInfo->Id == SPELL_OVERLOAD_CIRCUIT)
++Shutdown;
}
@@ -478,15 +478,19 @@ class boss_flame_leviathan : public CreatureScript
DoBatteringRamIfReady();
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
{
if (spell->Id != SPELL_PURSUED)
Unit* unitTarget = target->ToUnit();
if (!unitTarget)
return;
_pursueTarget = target->GetGUID();
AttackStart(target);
if (spellInfo->Id != SPELL_PURSUED)
return;
for (SeatMap::const_iterator itr = target->GetVehicleKit()->Seats.begin(); itr != target->GetVehicleKit()->Seats.end(); ++itr)
_pursueTarget = unitTarget->GetGUID();
AttackStart(unitTarget);
for (SeatMap::const_iterator itr = unitTarget->GetVehicleKit()->Seats.begin(); itr != unitTarget->GetVehicleKit()->Seats.end(); ++itr)
{
if (Player* passenger = ObjectAccessor::GetPlayer(*me, itr->second.Passenger.Guid))
{
@@ -908,9 +912,9 @@ class npc_pool_of_tar : public CreatureScript
damage = 0;
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->SchoolMask & SPELL_SCHOOL_MASK_FIRE && !me->HasAura(SPELL_BLAZE))
if (spellInfo->SchoolMask & SPELL_SCHOOL_MASK_FIRE && !me->HasAura(SPELL_BLAZE))
me->CastSpell(me, SPELL_BLAZE, true);
}
@@ -1505,12 +1505,16 @@ class npc_unstable_sun_beam : public CreatureScript
despawnTimer -= diff;
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
{
if (target && spell->Id == SPELL_UNSTABLE_ENERGY)
Unit* unitTarget = target->ToUnit();
if (!unitTarget)
return;
if (spellInfo->Id == SPELL_UNSTABLE_ENERGY)
{
target->RemoveAurasDueToSpell(SPELL_UNSTABLE_SUN_BEAM);
target->RemoveAurasDueToSpell(SPELL_UNSTABLE_SUN_BEAM_TRIGGERED);
unitTarget->RemoveAurasDueToSpell(SPELL_UNSTABLE_SUN_BEAM);
unitTarget->RemoveAurasDueToSpell(SPELL_UNSTABLE_SUN_BEAM_TRIGGERED);
}
}
@@ -219,9 +219,9 @@ class boss_general_vezax : public CreatureScript
DoMeleeAttackIfReady();
}
void SpellHitTarget(Unit* who, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
{
if (who && who->GetTypeId() == TYPEID_PLAYER && spell->Id == SPELL_SHADOW_CRASH_HIT)
if (target->GetTypeId() == TYPEID_PLAYER && spellInfo->Id == SPELL_SHADOW_CRASH_HIT)
shadowDodger = false;
}
@@ -969,9 +969,9 @@ class npc_toasty_fire : public CreatureScript
DoCast(me, SPELL_SINGED, true);
}
void SpellHit(Unit* /*who*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_BLOCK_OF_ICE || spell->Id == SPELL_ICE_SHARD || spell->Id == SPELL_ICE_SHARD_HIT)
if (spellInfo->Id == SPELL_BLOCK_OF_ICE || spellInfo->Id == SPELL_ICE_SHARD || spellInfo->Id == SPELL_ICE_SHARD_HIT)
{
if (GameObject* ToastyFire = me->FindNearestGameObject(GO_TOASTY_FIRE, 1.0f))
me->RemoveGameObject(ToastyFire, true);
@@ -1036,10 +1036,10 @@ class boss_vx_001 : public CreatureScript
mimiron->AI()->Talk(events.IsInPhase(PHASE_VX_001) ? SAY_VX001_SLAY : SAY_V07TRON_SLAY);
}
void SpellHit(Unit* caster, SpellInfo const* /*spellProto*/) override
void SpellHit(WorldObject* caster, SpellInfo const* /*spellInfo*/) override
{
if (caster->GetEntry() == NPC_BURST_TARGET && !me->HasUnitState(UNIT_STATE_CASTING))
DoCast(caster, SPELL_RAPID_BURST);
DoCast(caster->ToUnit(), SPELL_RAPID_BURST);
}
void UpdateAI(uint32 diff) override
@@ -496,9 +496,9 @@ struct boss_razorscale : public BossAI
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_HARPOON_TRIGGER)
if (spellInfo->Id == SPELL_HARPOON_TRIGGER)
{
_harpoonHitCount++;
if (_harpoonHitCount == RAID_MODE(2, 4))
@@ -1450,9 +1450,9 @@ struct npc_razorscale_harpoon_fire_state : public ScriptedAI
{
npc_razorscale_harpoon_fire_state(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_FIREBOLT)
if (spellInfo->Id == SPELL_FIREBOLT)
{
DoCastSelf(SPELL_HARPOON_FIRE_STATE);
if (Creature* commander = _instance->GetCreature(DATA_EXPEDITION_COMMANDER))
@@ -524,7 +524,7 @@ class boss_thorim : public CreatureScript
Talk(SAY_SLAY);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spellInfo) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spellInfo->Id == SPELL_TOUCH_OF_DOMINION_TRIGGERED)
{
@@ -537,9 +537,9 @@ class boss_thorim : public CreatureScript
}
}
void SpellHitTarget(Unit* who, SpellInfo const* spellInfo) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
{
if (who->GetTypeId() == TYPEID_PLAYER && spellInfo->Id == SPELL_LIGHTNING_RELEASE)
if (target->GetTypeId() == TYPEID_PLAYER && spellInfo->Id == SPELL_LIGHTNING_RELEASE)
_dontStandInTheLightning = false;
}
@@ -1576,7 +1576,7 @@ class npc_sif : public CreatureScript
_events.Reset();
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spellInfo) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spellInfo->Id == SPELL_STORMHAMMER_SIF)
{
@@ -736,12 +736,12 @@ class boss_sara : public CreatureScript
}
}
void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* /*target*/, SpellInfo const* spellInfo) override
{
if (!roll_chance_i(30) || _events.IsInPhase(PHASE_TRANSFORM))
return;
switch (spell->Id)
switch (spellInfo->Id)
{
case SPELL_SARAS_FERVOR:
Talk(SAY_SARA_FERVOR_HIT);
@@ -947,10 +947,10 @@ class boss_yogg_saron : public CreatureScript
me->AddLootMode(LOOT_MODE_HARD_MODE_1);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
// Val'anyr
if (spell->Id == SPELL_IN_THE_MAWS_OF_THE_OLD_GOD)
if (spellInfo->Id == SPELL_IN_THE_MAWS_OF_THE_OLD_GOD)
me->AddLootMode(32);
}
@@ -446,9 +446,9 @@ public:
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_LAUNCH_HARPOON)
if (spellInfo->Id == SPELL_LAUNCH_HARPOON)
if (Creature* skadi = _instance->GetCreature(DATA_SKADI_THE_RUTHLESS))
skadi->AI()->DoAction(ACTION_HARPOON_HIT);
}
@@ -220,7 +220,7 @@ class boss_svala : public CreatureScript
Talk(SAY_DEATH);
}
void SpellHitTarget(Unit* /*target*/, SpellInfo const* spellInfo) override
void SpellHitTarget(WorldObject* /*target*/, SpellInfo const* spellInfo) override
{
if (spellInfo->Id == SPELL_RITUAL_STRIKE_EFF_1 && !events.IsInPhase(NORMAL) && !events.IsInPhase(SVALADEAD))
{
@@ -148,9 +148,9 @@ public:
events.ScheduleEvent(EVENT_ANCESTORS_VENGEANCE, DUNGEON_MODE(60000, 45000), EVENT_GROUP_BASE_SPELLS);
}
void SpellHitTarget(Unit* who, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
{
if (who && who->GetTypeId() == TYPEID_PLAYER && spell->Id == SPELL_BANE_HIT)
if (target->GetTypeId() == TYPEID_PLAYER && spellInfo->Id == SPELL_BANE_HIT)
kingsBane = false;
}
@@ -248,13 +248,17 @@ class npc_ichor_globule : public CreatureScript
creature->SetReactState(REACT_PASSIVE);
}
void SpellHit(Unit* caster, SpellInfo const* spellInfo) override
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
Unit* unitCaster = caster->ToUnit();
if (!unitCaster)
return;
if (spellInfo->Id == SPELL_WATER_GLOBULE_VISUAL)
{
DoCast(me, SPELL_WATER_GLOBULE_TRANSFORM);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->GetMotionMaster()->MoveFollow(caster, 0.0f, 0.0f);
me->GetMotionMaster()->MoveFollow(unitCaster, 0.0f, 0.0f);
}
}
@@ -121,9 +121,9 @@ class boss_xevozz : public CreatureScript
_JustDied();
}
void SpellHit(Unit* /*who*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_ARCANE_POWER || spell->Id == H_SPELL_ARCANE_POWER)
if (spellInfo->Id == SPELL_ARCANE_POWER || spellInfo->Id == H_SPELL_ARCANE_POWER)
Talk(SAY_SUMMON_ENERGY);
}
@@ -1313,18 +1313,21 @@ public:
AttackStart(who);
}
void SpellHit(Unit* pCaster, SpellInfo const* pSpell) override
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
if (pSpell->Id == SPELL_ARCANE_CHAINS && pCaster->GetTypeId() == TYPEID_PLAYER && !HealthAbovePct(50) && !bEnslaved)
Player* playerCaster = caster->ToPlayer();
if (!playerCaster)
return;
if (spellInfo->Id == SPELL_ARCANE_CHAINS && !HealthAbovePct(50) && !bEnslaved)
{
EnterEvadeMode(); //We make sure that the npc is not attacking the player!
me->SetReactState(REACT_PASSIVE);
StartFollow(pCaster->ToPlayer());
StartFollow(playerCaster);
me->UpdateEntry(NPC_CAPTURED_BERLY_SORCERER);
DoCast(me, SPELL_COSMETIC_ENSLAVE_CHAINS_SELF, true);
if (Player* player = pCaster->ToPlayer())
player->KilledMonsterCredit(NPC_CAPTURED_BERLY_SORCERER);
playerCaster->KilledMonsterCredit(NPC_CAPTURED_BERLY_SORCERER);
bEnslaved = true;
}
@@ -1418,10 +1421,14 @@ public:
{
}
void SpellHit(Unit* unit, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
if ((spell->Id == SPELL_NEURAL_NEEDLE || spell->Id == SPELL_PROTOTYPE_NEURAL_NEEDLE) && unit->GetTypeId() == TYPEID_PLAYER)
GotStinged(unit->ToPlayer(), spell->Id);
Player* playerCaster = caster->ToPlayer();
if (!playerCaster)
return;
if (spellInfo->Id == SPELL_NEURAL_NEEDLE || spellInfo->Id == SPELL_PROTOTYPE_NEURAL_NEEDLE)
GotStinged(playerCaster, spellInfo->Id);
}
void GotStinged(Player* caster, uint32 spellId)
@@ -538,9 +538,9 @@ class npc_wyrmrest_defender : public CreatureScript
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
switch (spell->Id)
switch (spellInfo->Id)
{
case SPELL_WYRMREST_DEFENDER_MOUNT:
Talk(WHISPER_MOUNTED, me->GetCharmerOrOwner());
@@ -624,9 +624,9 @@ class npc_torturer_lecraft : public CreatureScript
Talk (SAY_AGGRO, player);
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
if (spell->Id != SPELL_HIGH_EXECUTORS_BRANDING_IRON)
if (spellInfo->Id != SPELL_HIGH_EXECUTORS_BRANDING_IRON)
return;
if (Player* player = caster->ToPlayer())
@@ -298,13 +298,17 @@ public:
_gender = Data;
}
void SpellHit(Unit* Caster, SpellInfo const* Spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
if (Spell->Id == SPELL_OUTHOUSE_GROANS)
{
Unit* unitCaster = caster->ToUnit();
if (!unitCaster)
return;
if (spellInfo->Id == SPELL_OUTHOUSE_GROANS)
{
++_counter;
if (_counter < 5)
DoCast(Caster, SPELL_CAMERA_SHAKE, true);
DoCast(unitCaster, SPELL_CAMERA_SHAKE, true);
else
_counter = 0;
DoCast(me, SPELL_DUST_FIELD, true);
@@ -495,13 +499,16 @@ public:
me->DespawnOrUnsummon(_despawnTimer);
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_RENEW_SKIRMISHER && caster->GetTypeId() == TYPEID_PLAYER
&& caster->ToPlayer()->GetQuestStatus(QUEST_OVERWHELMED) == QUEST_STATUS_INCOMPLETE)
Player* playerCaster = caster->ToPlayer();
if (!playerCaster)
return;
if (spellInfo->Id == SPELL_RENEW_SKIRMISHER && playerCaster->GetQuestStatus(QUEST_OVERWHELMED) == QUEST_STATUS_INCOMPLETE)
{
DoCast(caster, SPELL_KILL_CREDIT);
Talk(SAY_RANDOM, caster);
DoCast(playerCaster, SPELL_KILL_CREDIT);
Talk(SAY_RANDOM, playerCaster);
if (me->IsStandState())
me->GetMotionMaster()->MovePoint(1, me->GetPositionX()+7, me->GetPositionY()+7, me->GetPositionZ());
else
@@ -616,9 +623,9 @@ public:
DoMeleeAttackIfReady();
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_SMOKE_BOMB && caster->GetTypeId() == TYPEID_PLAYER)
if (spellInfo->Id == SPELL_SMOKE_BOMB && caster->GetTypeId() == TYPEID_PLAYER)
{
me->AddUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetImmuneToPC(true);
@@ -908,7 +915,7 @@ public:
FinishQuest(false, _faction);
}
void SpellHit(Unit* caster, SpellInfo const* /*spellInfo*/) override
void SpellHit(WorldObject* caster, SpellInfo const* /*spellInfo*/) override
{
if (caster->GetEntry() == NPC_HORDE_LUMBERBOAT || caster->GetEntry() == NPC_ALLIANCE_LUMBERBOAT)
FinishQuest(true, _faction);
+15 -11
View File
@@ -234,32 +234,36 @@ class npc_tournament_training_dummy : public CreatureScript
events.RescheduleEvent(EVENT_DUMMY_RESET, 10000);
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
Unit* unitCaster = caster->ToUnit();
if (!unitCaster)
return;
switch (me->GetEntry())
{
case NPC_CHARGE_TARGET:
if (spell->Id == SPELL_PLAYER_CHARGE)
if (spellInfo->Id == SPELL_PLAYER_CHARGE)
if (isVulnerable)
DoCast(caster, SPELL_CHARGE_CREDIT, true);
DoCast(unitCaster, SPELL_CHARGE_CREDIT, true);
break;
case NPC_MELEE_TARGET:
if (spell->Id == SPELL_PLAYER_THRUST)
if (spellInfo->Id == SPELL_PLAYER_THRUST)
{
DoCast(caster, SPELL_MELEE_CREDIT, true);
DoCast(unitCaster, SPELL_MELEE_CREDIT, true);
if (Unit* target = caster->GetVehicleBase())
if (Unit* target = unitCaster->GetVehicleBase())
DoCast(target, SPELL_COUNTERATTACK, true);
}
break;
case NPC_RANGED_TARGET:
if (spell->Id == SPELL_PLAYER_BREAK_SHIELD)
if (spellInfo->Id == SPELL_PLAYER_BREAK_SHIELD)
if (isVulnerable)
DoCast(caster, SPELL_RANGED_CREDIT, true);
DoCast(unitCaster, SPELL_RANGED_CREDIT, true);
break;
}
if (spell->Id == SPELL_PLAYER_BREAK_SHIELD)
if (spellInfo->Id == SPELL_PLAYER_BREAK_SHIELD)
if (!me->HasAura(SPELL_CHARGE_DEFEND) && !me->HasAura(SPELL_RANGED_DEFEND))
isVulnerable = true;
}
@@ -756,9 +760,9 @@ class npc_frostbrood_skytalon : public CreatureScript
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
switch (spell->Id)
switch (spellInfo->Id)
{
case SPELL_EXPLOSION:
DoCast(me, SPELL_IMMOLATION);
@@ -304,7 +304,7 @@ public:
sayTimer -= diff;
}
void SpellHit(Unit* caster, SpellInfo const* spellInfo) override
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
if (spellInfo->Id != SPELL_OFFER)
return;
@@ -574,16 +574,16 @@ public:
{
npc_haiphoonAI(Creature* creature) : VehicleAI(creature) { }
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
{
if (target == me)
return;
if (spell->Id == SPELL_DEVOUR_WIND && me->GetCharmerOrOwnerPlayerOrPlayerItself())
if (spellInfo->Id == SPELL_DEVOUR_WIND && me->GetCharmerOrOwnerPlayerOrPlayerItself())
{
me->UpdateEntry(NPC_HAIPHOON_AIR);
}
else if (spell->Id == SPELL_DEVOUR_WATER && me->GetCharmerOrOwnerPlayerOrPlayerItself())
else if (spellInfo->Id == SPELL_DEVOUR_WATER && me->GetCharmerOrOwnerPlayerOrPlayerItself())
{
me->UpdateEntry(NPC_HAIPHOON_WATER);
}
@@ -226,15 +226,19 @@ public:
me->DespawnOrUnsummon();
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
if (spell->Id != SPELL_ICE_LANCE)
Unit* unitCaster = caster->ToUnit();
if (!unitCaster)
return;
if (caster->GetVehicleKit()->GetAvailableSeatCount() != 0)
if (spellInfo->Id != SPELL_ICE_LANCE)
return;
if (unitCaster->GetVehicleKit()->GetAvailableSeatCount() != 0)
{
me->CastSpell(me, SPELL_FREE_PRISONER, true);
me->CastSpell(caster, SPELL_RIDE_DRAKE, true);
me->CastSpell(unitCaster, SPELL_RIDE_DRAKE, true);
me->CastSpell(me, SPELL_SHARD_IMPACT, true);
freed = true;
}
@@ -751,7 +755,7 @@ public:
}
}
void SpellHit(Unit* caster, SpellInfo const* spellInfo) override
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
if (!_playerGuid.IsEmpty() || spellInfo->Id != SPELL_SPEAR_OF_HODIR)
return;
+24 -17
View File
@@ -75,27 +75,28 @@ public:
rageclaw->SetFacingToObject(me);
}
void UnlockRageclaw(Unit* who, Creature* rageclaw)
void UnlockRageclaw(Creature* rageclaw)
{
if (!who)
return;
// pointer check not needed
DoCast(rageclaw, SPELL_FREE_RAGECLAW, true);
me->setDeathState(DEAD);
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_UNLOCK_SHACKLE)
Player* playerCaster = caster->ToPlayer();
if (!playerCaster)
return;
if (spellInfo->Id == SPELL_UNLOCK_SHACKLE)
{
if (caster->ToPlayer()->GetQuestStatus(QUEST_TROLLS_IS_GONE_CRAZY) == QUEST_STATUS_INCOMPLETE)
if (playerCaster->GetQuestStatus(QUEST_TROLLS_IS_GONE_CRAZY) == QUEST_STATUS_INCOMPLETE)
{
if (Creature* rageclaw = ObjectAccessor::GetCreature(*me, _rageclawGUID))
{
UnlockRageclaw(caster, rageclaw);
caster->ToPlayer()->KilledMonster(rageclaw->GetCreatureTemplate(), _rageclawGUID);
UnlockRageclaw(rageclaw);
playerCaster->KilledMonster(rageclaw->GetCreatureTemplate(), _rageclawGUID);
me->RemoveAurasDueToSpell(SPELL_CHAIN_OF_THE_SCURGE_RIGHT);
me->DespawnOrUnsummon();
}
@@ -142,9 +143,9 @@ public:
void MoveInLineOfSight(Unit* /*who*/) override { }
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_FREE_RAGECLAW)
if (spellInfo->Id == SPELL_FREE_RAGECLAW)
{
me->RemoveAurasDueToSpell(SPELL_CHAIN_OF_THE_SCURGE_LEFT);
me->SetStandState(UNIT_STAND_STATE_STAND);
@@ -925,16 +926,22 @@ public:
Reset();
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
if (spell->Id != GYMERS_GRAB)
Unit* unitCaster = caster->ToUnit();
if (!unitCaster)
return;
if (Vehicle* veh = caster->GetVehicleKit())
if (veh->GetAvailableSeatCount() != 0)
if (spellInfo->Id != GYMERS_GRAB)
return;
if (Vehicle* veh = unitCaster->GetVehicleKit())
{
me->CastSpell(caster, RIDE_VEHICLE, true);
me->CastSpell(caster, HEALING_WINDS, true);
if (veh->GetAvailableSeatCount() != 0)
{
me->CastSpell(caster, RIDE_VEHICLE, true);
me->CastSpell(caster, HEALING_WINDS, true);
}
}
}
};
@@ -236,9 +236,9 @@ struct boss_shade_of_akama : public BossAI
_DespawnAtEvade();
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_AKAMA_SOUL_CHANNEL)
if (spellInfo->Id == SPELL_AKAMA_SOUL_CHANNEL)
{
events.ScheduleEvent(EVENT_START_CHANNELERS_AND_SPAWNERS, 1s);
me->SetEmoteState(EMOTE_STATE_NONE);
@@ -247,7 +247,7 @@ struct boss_shade_of_akama : public BossAI
AttackStart(akama);
}
if (spell->Id == SPELL_AKAMA_SOUL_RETRIEVE)
if (spellInfo->Id == SPELL_AKAMA_SOUL_RETRIEVE)
DoCastSelf(SPELL_AKAMA_SOUL_EXPEL_CHANNEL);
}
@@ -381,9 +381,9 @@ struct npc_akama_shade : public ScriptedAI
void EnterEvadeMode(EvadeReason /*why*/) override { }
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_THREAT && !_isInCombat)
if (spellInfo->Id == SPELL_THREAT && !_isInCombat)
{
_isInCombat = true;
me->SetWalk(false);
@@ -92,9 +92,9 @@ struct boss_najentus : public BossAI
Talk(SAY_DEATH);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spell->Id == SPELL_HURL_SPINE && me->HasAura(SPELL_TIDAL_SHIELD))
if (spellInfo->Id == SPELL_HURL_SPINE && me->HasAura(SPELL_TIDAL_SHIELD))
{
me->RemoveAurasDueToSpell(SPELL_TIDAL_SHIELD);
DoCastSelf(SPELL_TIDAL_BURST, true);
@@ -149,10 +149,10 @@ public:
Talk(SAY_SLAY);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
//hack :(
if (spell->Id == SPELL_WARLORDS_RAGE_PROC)
if (spellInfo->Id == SPELL_WARLORDS_RAGE_PROC)
if (instance->GetData(DATA_DISTILLER) == DONE)
me->RemoveAurasDueToSpell(SPELL_WARLORDS_RAGE_PROC);
}
@@ -514,7 +514,7 @@ struct npc_earthen_ring_flamecaller : public ScriptedAI
DoCastSelf(SPELL_FIND_OPENING_CHANNEL);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spellInfo) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
switch (spellInfo->Id)
{
@@ -122,11 +122,11 @@ class boss_gruul : public CreatureScript
Talk(SAY_DEATH);
}
void SpellHitTarget(Unit* target, SpellInfo const* pSpell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
{
//This to emulate effect1 (77) of SPELL_GROUND_SLAM, knock back to any direction
//It's initially wrong, since this will cause fall damage, which is by comments, not intended.
if (pSpell->Id == SPELL_GROUND_SLAM)
if (spellInfo->Id == SPELL_GROUND_SLAM)
{
if (target->GetTypeId() == TYPEID_PLAYER)
{
@@ -146,7 +146,7 @@ class boss_gruul : public CreatureScript
}
//this part should be in the core
if (pSpell->Id == SPELL_SHATTER)
if (spellInfo->Id == SPELL_SHATTER)
{
/// @todo use eventmap to kill this stuff
//clear this, if we are still performing

Some files were not shown because too many files have changed in this diff Show More