Core/AI: ported SpellHit and SpellHitTarget refactor from 335 branch

This commit is contained in:
Ovahlord committed 2022-09-22 10:33:13 +02:00
1 parent 7630711eaa
commit c6711adf8b
141 files changed
+507 -424

No files matched your search

+2 -4
View File
@@ -88,12 +88,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 SpellHit(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 SpellHitTarget(GameObject* /*target*/, SpellInfo const* /*spellInfo*/) { }
virtual void SpellHitTarget(WorldObject* /*target*/, SpellInfo const* /*spellInfo*/) { }
};
class TC_GAME_API NullGameObjectAI : public GameObjectAI
+2 -4
View File
@@ -142,12 +142,10 @@ class TC_GAME_API CreatureAI : public UnitAI
virtual void JustUnregisteredDynObject(DynamicObject* /*dynObject*/) { }
// Called when hit by a spell
virtual void SpellHit(Unit* /*caster*/, SpellInfo const* /*spellInfo*/) { }
virtual void SpellHit(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 SpellHitTarget(GameObject* /*target*/, SpellInfo const* /*spellInfo*/) { }
virtual void SpellHitTarget(WorldObject* /*target*/, SpellInfo const* /*spellInfo*/) { }
// Should return true if the NPC is currently being escorted
virtual bool IsEscorted() const { return false; }
+6 -6
View File
@@ -661,14 +661,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);
}
void SmartAI::SpellHitTarget(Unit* target, SpellInfo const* spellInfo)
void SmartAI::SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo)
{
GetScript()->ProcessEventsFor(SMART_EVENT_SPELLHIT_TARGET, target, 0, 0, false, spellInfo);
GetScript()->ProcessEventsFor(SMART_EVENT_SPELLHIT_TARGET, target->ToUnit(), 0, 0, false, spellInfo);
}
void SmartAI::DamageTaken(Unit* doneBy, uint32& damage)
@@ -1077,9 +1077,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);
}
class SmartTrigger : public AreaTriggerScript
+6 -3
View File
@@ -104,10 +104,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 SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override;
// Called when spell hits a target
void SpellHitTarget(Unit* target, 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;
@@ -268,7 +268,10 @@ 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;
void SetGossipReturn(bool val) { _gossipReturn = val; }
+3 -15
View File
@@ -2768,15 +2768,8 @@ void Spell::TargetInfo::DoDamageAndTriggers(Spell* spell)
{
//AI functions
if (_spellHitTarget->GetTypeId() == TYPEID_UNIT)
{
if (_spellHitTarget->ToCreature()->IsAIEnabled())
{
if (spell->m_caster->GetTypeId() == TYPEID_GAMEOBJECT)
_spellHitTarget->ToCreature()->AI()->SpellHit(spell->m_caster->ToGameObject(), spell->m_spellInfo);
else
_spellHitTarget->ToCreature()->AI()->SpellHit(spell->m_caster->ToUnit(), spell->m_spellInfo);
}
}
_spellHitTarget->ToCreature()->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()->SpellHitTarget(_spellHitTarget, spell->m_spellInfo);
@@ -2820,14 +2813,9 @@ void Spell::GOTargetInfo::DoTargetSpellHit(Spell* spell, uint8 effIndex)
spell->HandleEffects(nullptr, nullptr, go, nullptr, effIndex, SPELL_EFFECT_HANDLE_HIT_TARGET);
//AI functions
// AI functions
if (go->AI())
{
if (spell->m_caster->GetTypeId() == TYPEID_GAMEOBJECT)
go->AI()->SpellHit(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()->SpellHitTarget(go, spell->m_spellInfo);
@@ -121,7 +121,7 @@ struct boss_alizabal : public BossAI
}
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
{
if (spell->Id == SPELL_SEETHING_HATE_TARGETING)
Talk(SAY_SEETHING_HATE, target);
@@ -104,7 +104,7 @@ struct boss_pit_lord_argaloth : public BossAI
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_FEL_FIRESTORM)
{
@@ -743,7 +743,7 @@ struct npc_ignacious final : public ScriptedAI
damage = me->GetHealth() - 1;
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_AEGIS_OF_FLAME)
Talk(SAY_ABILITY);
@@ -1329,14 +1329,18 @@ struct npc_elementium_monstrosity final : public ScriptedAI
}
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
{
Creature* creatureTarget = target->ToCreature();
if (!creatureTarget)
return;
if (spell->Id == SPELL_MERGE_HEALTH)
{
_mergedHealth += target->GetHealth();
_mergedHealth += creatureTarget->GetHealth();
_mergedTargets++;
if (Creature* creature = target->ToCreature())
if (Creature* creature = creatureTarget->ToCreature())
creature->DespawnOrUnsummon();
if (_mergedTargets == 4)
@@ -1404,7 +1408,7 @@ struct npc_ascendant_council_violent_cyclone final : public ScriptedAI
_events.ScheduleEvent(EVENT_CYCLONE_AGGRO, 2s + 300ms);
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
{
// According to sniffs the cyclone uses the positions of the Ascendant Council Target Stalkers
// as potential waypoints so he stays within a certain area rather than moving arround the room
@@ -1527,7 +1531,7 @@ struct npc_ascendant_council_plume_stalker final : public NullCreatureAI
{
npc_ascendant_council_plume_stalker(Creature* creature) : NullCreatureAI(creature) { }
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_LAVA_SEED_DUMMY)
{
@@ -1625,7 +1629,7 @@ struct npc_ascendant_council_frozen_orb final : public ScriptedAI
feludius->AI()->JustSummoned(me);
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
{
switch (spell->Id)
{
@@ -1691,7 +1695,7 @@ struct npc_ascendant_council_flame_strike final : public ScriptedAI
summoner->CastSpell(me, SPELL_FLAME_STRIKE);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_FLAME_STRIKE)
{
@@ -1700,13 +1704,17 @@ struct npc_ascendant_council_flame_strike final : public ScriptedAI
}
}
void SpellHitTarget(Unit* target, SpellInfo const* /*spell*/) override
void SpellHitTarget(WorldObject* target, SpellInfo const* /*spell*/) override
{
if (target->GetEntry() == NPC_FROZEN_ORB)
Creature* creatureTarget = target->ToCreature();
if (!creatureTarget)
return;
if (creatureTarget->GetEntry() == NPC_FROZEN_ORB)
{
target->GetMotionMaster()->Clear();
target->RemoveAllAuras();
target->ToCreature()->DespawnOrUnsummon(2s + 300ms);
creatureTarget->GetMotionMaster()->Clear();
creatureTarget->RemoveAllAuras();
creatureTarget->DespawnOrUnsummon(2s + 300ms);
me->RemoveAllAuras();
me->DespawnOrUnsummon(2s + 300ms);
}
@@ -350,7 +350,7 @@ struct boss_chogall final : public BossAI
Talk(SAY_DEATH_NORMAL);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
switch (spell->Id)
{
@@ -592,7 +592,7 @@ struct npc_chogall_corrupting_adherent final : public ScriptedAI
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_CONSUME_BLOOD_OF_THE_OLD_GODS)
{
@@ -217,7 +217,7 @@ struct boss_halfus_wyrmbreaker final : public BossAI
_DespawnAtEvade();
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spell) override
{
if (!caster)
return;
@@ -439,7 +439,7 @@ struct npc_halfus_enslaved_dragon final : public ScriptedAI
protoBehemoth->AI()->DoAction(ACTION_CAST_DRAGONS_VENGEANCE);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->HasEffect(SPELL_EFFECT_SEND_EVENT))
{
@@ -277,15 +277,15 @@ struct boss_theralion final : public BossAI
_DespawnAtEvade();
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spell) override
{
if (!caster)
if (!caster || !caster->IsUnit())
return;
switch (spell->Id)
{
case SPELL_SHARE_HEALTH_2:
if (!caster->HasAura(SPELL_SHARE_HEALTH_1))
if (!caster->ToUnit()->HasAura(SPELL_SHARE_HEALTH_1))
DoCastAOE(SPELL_SHARE_HEALTH_1, true);
break;
case SPELL_TRIGGER_ACTION_THERALION:
@@ -517,15 +517,15 @@ struct boss_valiona final : public BossAI
_DespawnAtEvade();
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spell) override
{
if (!caster)
if (!caster || !caster->IsUnit())
return;
switch (spell->Id)
{
case SPELL_SHARE_HEALTH_1:
if (!caster->HasAura(SPELL_SHARE_HEALTH_2))
if (!caster->ToUnit()->HasAura(SPELL_SHARE_HEALTH_2))
DoCastAOE(SPELL_SHARE_HEALTH_2, true);
break;
case SPELL_TRIGGER_ACTION_VALIONA:
@@ -771,7 +771,7 @@ struct npc_theralion_and_valiona_unstable_twilight final : public ScriptedAI
_events.ScheduleEvent(EVENT_MOVE_RANDOM, 1ms, 1s);
}
void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* /*target*/, SpellInfo const* spell) override
{
switch (spell->Id)
{
@@ -631,7 +631,7 @@ struct npc_raz_the_crazed : public EscortAI
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_STOP_HEART)
_events.ScheduleEvent(EVENT_KILL_RAZ, 4s);
@@ -143,7 +143,7 @@ public:
instance->SetBossState(DATA_PYROGAURD_EMBERSEER, DONE);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_ENCAGE_EMBERSEER)
{
@@ -399,7 +399,7 @@ struct npc_bwd_dwarven_spirit : public ScriptedAI
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
uint32 triggeredEventId = 0;
switch (spell->Id)
@@ -694,7 +694,7 @@ struct npc_magmaw_lava_parasite : public ScriptedAI
me->DespawnOrUnsummon(2s + 500ms);
}
void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* /*target*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_LAVA_PARASITE_RIDE_VEHICLE)
{
@@ -1313,7 +1313,7 @@ struct npc_nefarians_end_shadowblaze : public NullCreatureAI
nefarian->AI()->JustSummoned(me);
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
{
switch (spell->Id)
{
@@ -481,7 +481,7 @@ struct npc_omnotron_electron : public ScriptedAI
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_ACTIVATED)
{
@@ -491,7 +491,7 @@ struct npc_omnotron_electron : public ScriptedAI
}
}
void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* /*target*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_LIGHTNING_CONDUCTOR)
if (IsHeroic())
@@ -624,7 +624,7 @@ struct npc_omnotron_magmatron : public ScriptedAI
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_ACTIVATED)
{
@@ -634,7 +634,7 @@ struct npc_omnotron_magmatron : public ScriptedAI
}
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
{
if (spell->Id == SPELL_ACQUIRING_TARGET && target)
{
@@ -767,7 +767,7 @@ struct npc_omnotron_toxitron : public ScriptedAI
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_ACTIVATED)
{
@@ -901,7 +901,7 @@ struct npc_omnotron_arcanotron : public ScriptedAI
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_ACTIVATED)
{
@@ -917,7 +917,7 @@ struct npc_omnotron_arcanotron : public ScriptedAI
me->MakeInterruptable(false);
}
void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* /*target*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_ARCANE_ANNIHILATION)
if (!_instance->instance->GetWorldStateValue(WORLD_STATE_ID_ARCANE_ANNIHILATOR))
@@ -1145,7 +1145,7 @@ struct npc_omnotron_poison_bomb : public ScriptedAI
me->DespawnOrUnsummon(2s + 500ms);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_QUIETE_SUICIDE)
{
@@ -313,7 +313,7 @@ class npc_ripsnarl_vapor : public CreatureScript
me->DespawnOrUnsummon(Seconds(5));
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_VAPOR_ANIMUS)
DoCastAOE(SPELL_COALESCE, true);
@@ -226,7 +226,7 @@ class boss_foe_reaper_5000 : public CreatureScript
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
switch (spell->Id)
{
@@ -258,10 +258,10 @@ struct boss_helix_gearbreaker : public BossAI
damage = me->GetHealth() - 1;
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
{
if (spell->Id == SPELL_RIDE_VEHICLE)
AttackStart(target);
if (spell->Id == SPELL_RIDE_VEHICLE && target->IsUnit())
AttackStart(target->ToUnit());
}
void UpdateAI(uint32 diff) override
@@ -620,7 +620,7 @@ struct npc_gilnean_crow : public PassiveAI
{
npc_gilnean_crow(Creature* creature) : PassiveAI(creature) { }
void SpellHit(GameObject* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_GILNEAN_CROW)
_events.ScheduleEvent(EVENT_APPLY_HOVER_BYTES, 500ms);
@@ -87,7 +87,7 @@ struct npc_gilneas_horrid_abomination : public ScriptedAI
me->GetMotionMaster()->MoveRandom(6.0f);
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spell) override
{
switch (spell->Id)
{
@@ -244,7 +244,7 @@ struct npc_gilneas_save_the_children : public ScriptedAI
_events.ScheduleEvent(EVENT_CRY, Seconds(1));
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spell) override
{
switch (spell->Id)
{
@@ -392,7 +392,7 @@ struct npc_gilneas_forsaken_catapult : public VehicleAI
_events.ScheduleEvent(EVENT_CHECK_AREA, Milliseconds(1));
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
switch (spell->Id)
{
@@ -409,17 +409,21 @@ struct npc_gilneas_forsaken_catapult : public VehicleAI
_targetPos = pos;
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
{
Unit* unitTarget = target->ToUnit();
if (!unitTarget)
return;
switch (spell->Id)
{
case SPELL_LAUNCH:
if (target->GetVehicleCreatureBase())
if (unitTarget->GetVehicleCreatureBase())
{
Position pos = target->GetPosition();
Position pos = unitTarget->GetPosition();
pos.m_positionZ += 6.0f;
target->ExitVehicle(&pos);
target->GetMotionMaster()->MoveJump(_targetPos, 58.62504f, 12.75955f);
unitTarget->ExitVehicle(&pos);
unitTarget->GetMotionMaster()->MoveJump(_targetPos, 58.62504f, 12.75955f);
}
break;
default:
@@ -175,7 +175,7 @@ struct boss_general_umbriss : public BossAI
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_FRENZY)
Talk(SAY_ANNOUNCE_FRENZY);
@@ -244,7 +244,7 @@ struct npc_umbriss_skardyn : public ScriptedAI
_events.ScheduleEvent(EVENT_ATTACK_PLAYER, Milliseconds(1));
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_MODGUDS_MALICE || spell->Id == SPELL_MODGUDS_MALICE_HC)
_infected = true;
@@ -68,7 +68,7 @@ struct npc_grim_batol_twilight_beguiler : public ScriptedAI
me->InterruptNonMeleeSpells(true);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_GRONN_KNOCKBACK_COSMETIC)
{
@@ -222,7 +222,7 @@ public:
std::bind(&BossAI::DoMeleeAttackIfReady, this));
}
void SpellHit(Unit* /*source*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*source*/, SpellInfo const* spell) override
{
if (spell->Mechanic == MECHANIC_DISARM)
Talk(SAY_DISARMED);
@@ -149,7 +149,7 @@ public:
creature->AI()->KilledUnit(who);
}
void SpellHit(Unit* /*who*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*who*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_INFERNAL_RELAY)
{
@@ -473,7 +473,7 @@ public:
DrinkInturrupted = true;
}
void SpellHit(Unit* /*pAttacker*/, SpellInfo const* Spell) override
void SpellHit(WorldObject* /*pAttacker*/, SpellInfo const* Spell) override
{
//We only care about interrupt effects and only if they are durring a spell currently being cast
if ((Spell->Effects[0].Effect != SPELL_EFFECT_INTERRUPT_CAST &&
@@ -92,7 +92,7 @@ public:
Talk(SAY_AGGRO);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_BROKEN_PACT)
events.ScheduleEvent(EVENT_SUMMON_KILREK, Seconds(32));
@@ -367,7 +367,7 @@ public:
me->DespawnOrUnsummon();
}
void SpellHit(Unit* /*caster*/, SpellInfo const* Spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* Spell) override
{
if ((Spell->SchoolMask == SPELL_SCHOOL_MASK_FIRE) && (!(rand32() % 10)))
{
@@ -1132,7 +1132,7 @@ public:
me->DespawnOrUnsummon();
}
void SpellHit(Unit* /*caster*/, SpellInfo const* Spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* Spell) override
{
if (Spell->Id == SPELL_DRINK_POISON)
{
@@ -218,26 +218,30 @@ struct boss_felblood_kaelthas : public BossAI
}
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
{
Unit* unitTarget = target->ToUnit();
if (!unitTarget)
return;
switch (spell->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]()
unitTarget->m_Events.AddEventAtOffset([unitTarget, gravityLapseDamageSpell]()
{
target->CastSpell(target, gravityLapseDamageSpell);
target->CastSpell(target, SPELL_GRAVITY_LAPSE_FLY);
unitTarget->CastSpell(unitTarget, gravityLapseDamageSpell);
unitTarget->CastSpell(unitTarget, SPELL_GRAVITY_LAPSE_FLY);
}, 400ms);
_gravityLapseTargetCount++;
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;
@@ -537,7 +537,7 @@ public:
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SWIMMING);
}
void SpellHit(Unit* pCaster, SpellInfo const* pSpell) override
void SpellHit(WorldObject* pCaster, SpellInfo const* pSpell) override
{
if (!m_bIsDuelInProgress && pSpell->Id == SPELL_DUEL)
{
@@ -795,22 +795,24 @@ public:
return false;
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spell) override
{
if (spell->Id == SPELL_DELIVER_STOLEN_HORSE)
{
if (caster->GetTypeId() == TYPEID_UNIT && caster->IsVehicle())
if (caster->GetTypeId() == TYPEID_UNIT && caster->ToCreature()->IsVehicle())
{
if (Unit* charmer = caster->GetCharmer())
Creature* creatureCaster = caster->ToCreature();
if (Unit* charmer = creatureCaster->GetCharmer())
{
if (charmer->HasAura(SPELL_EFFECT_STOLEN_HORSE))
{
charmer->RemoveAurasDueToSpell(SPELL_EFFECT_STOLEN_HORSE);
caster->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
caster->SetFaction(FACTION_FRIENDLY);
DoCast(caster, SPELL_CALL_DARK_RIDER, true);
creatureCaster->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
creatureCaster->SetFaction(FACTION_FRIENDLY);
DoCast(creatureCaster, SPELL_CALL_DARK_RIDER, true);
if (Creature* Dark_Rider = me->FindNearestCreature(NPC_DARK_RIDER_OF_ACHERUS, 15))
ENSURE_AI(npc_dark_rider_of_acherus::npc_dark_rider_of_acherusAI, Dark_Rider->AI())->InitDespawnHorse(caster);
ENSURE_AI(npc_dark_rider_of_acherus::npc_dark_rider_of_acherusAI, Dark_Rider->AI())->InitDespawnHorse(creatureCaster);
}
}
}
@@ -183,7 +183,7 @@ public:
DoCast(me, _spell);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_WISP_FLIGHT_PORT && Creaturetype == 4)
me->SetDisplayId(2027);
@@ -298,9 +298,9 @@ public:
}
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spell) override
{
if (!withbody)
if (!withbody || !caster->IsUnit())
return;
if (spell->Id == SPELL_FLYING_HEAD)
@@ -319,7 +319,7 @@ public:
DoCast(me, SPELL_HEAD, false);
SaySound(SAY_LOST_HEAD);
me->GetMotionMaster()->Clear(false);
me->GetMotionMaster()->MoveFleeing(caster->GetVictim());
me->GetMotionMaster()->MoveFleeing(caster->ToUnit()->GetVictim());
}
}
@@ -528,7 +528,7 @@ public:
}
}
void SaySound(uint8 textEntry, Unit* target = 0)
void SaySound(uint8 textEntry, WorldObject* target = 0)
{
Talk(textEntry, target);
laugh += 4000;
@@ -555,10 +555,13 @@ public:
return nullptr;
}
void SpellHitTarget(Unit* unit, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
{
if (spell->Id == SPELL_CONFLAGRATION && unit->HasAura(SPELL_CONFLAGRATION))
SaySound(SAY_CONFLAGRATION, unit);
if (!target->IsUnit())
return;
if (spell->Id == SPELL_CONFLAGRATION && target->ToUnit()->HasAura(SPELL_CONFLAGRATION))
SaySound(SAY_CONFLAGRATION, target);
}
void JustDied(Unit* /*killer*/) override
@@ -581,8 +584,11 @@ public:
}
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spell) override
{
if (!caster->IsCreature())
return;
if (withhead)
return;
@@ -598,8 +604,9 @@ public:
me->SetFullHealth();
SaySound(SAY_REJOINED);
DoCast(me, SPELL_HEAD);
caster->GetMotionMaster()->Clear(false);
caster->GetMotionMaster()->MoveFollow(me, 6, float(urand(0, 5)));
caster->ToCreature()->GetMotionMaster()->Clear(false);
caster->ToCreature()->GetMotionMaster()->MoveFollow(me, 6, float(urand(0, 5)));
}
}
@@ -812,7 +819,7 @@ public:
void JustEngagedWith(Unit* /*who*/) override { }
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_SPROUTING)
{
@@ -148,7 +148,7 @@ public:
void JustEngagedWith(Unit* /*who*/) override { }
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spell) override
{
if (Tagged || spell->Id != SPELL_EGAN_BLASTER)
return;
@@ -239,7 +239,7 @@ public:
void JustEngagedWith(Unit* /*who*/) override { }
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (!Tagged && spell->Id == SPELL_EGAN_BLASTER)
Tagged = true;
@@ -162,7 +162,7 @@ public:
me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
{
switch (spell->Id)
{
@@ -178,30 +178,43 @@ public:
}
}
void HandleTouchedSpells(Unit* target, uint32 TouchedType)
void HandleTouchedSpells(WorldObject* target, uint32 TouchedType)
{
if (!target->IsUnit())
return;
switch (TouchedType)
{
case SPELL_FLAME_TOUCHED:
if (!target->HasAura(SPELL_DARK_FLAME))
{
Unit* unitTarget = target->ToUnit();
if (!unitTarget->HasAura(SPELL_DARK_FLAME))
{
if (target->HasAura(SPELL_DARK_TOUCHED))
if (unitTarget->HasAura(SPELL_DARK_TOUCHED))
{
target->RemoveAurasDueToSpell(SPELL_DARK_TOUCHED);
target->CastSpell(target, SPELL_DARK_FLAME, true);
} else target->CastSpell(target, SPELL_FLAME_TOUCHED, true);
unitTarget->RemoveAurasDueToSpell(SPELL_DARK_TOUCHED);
unitTarget->CastSpell(unitTarget, SPELL_DARK_FLAME, true);
}
else unitTarget->CastSpell(unitTarget, SPELL_FLAME_TOUCHED, true);
}
break;
}
case SPELL_DARK_TOUCHED:
if (!target->HasAura(SPELL_DARK_FLAME))
{
Unit* unitTarget = target->ToUnit();
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;
}
default:
break;
}
}
@@ -438,7 +451,7 @@ public:
me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
{
switch (spell->Id)
{
@@ -455,34 +468,45 @@ public:
}
}
void HandleTouchedSpells(Unit* target, uint32 TouchedType)
void HandleTouchedSpells(WorldObject* target, uint32 TouchedType)
{
if (!target->IsUnit())
return;
switch (TouchedType)
{
case SPELL_FLAME_TOUCHED:
if (!target->HasAura(SPELL_DARK_FLAME))
{
Unit* unitTarget = target->ToUnit();
if (!unitTarget->HasAura(SPELL_DARK_FLAME))
{
if (target->HasAura(SPELL_DARK_TOUCHED))
if (unitTarget->HasAura(SPELL_DARK_TOUCHED))
{
target->RemoveAurasDueToSpell(SPELL_DARK_TOUCHED);
target->CastSpell(target, SPELL_DARK_FLAME, true);
unitTarget->RemoveAurasDueToSpell(SPELL_DARK_TOUCHED);
unitTarget->CastSpell(unitTarget, SPELL_DARK_FLAME, true);
}
else
target->CastSpell(target, SPELL_FLAME_TOUCHED, true);
unitTarget->CastSpell(unitTarget, SPELL_FLAME_TOUCHED, true);
}
break;
}
case SPELL_DARK_TOUCHED:
if (!target->HasAura(SPELL_DARK_FLAME))
{
Unit* unitTarget = target->ToUnit();
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);
unitTarget->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED);
unitTarget->CastSpell(unitTarget, SPELL_DARK_FLAME, true);
}
else
target->CastSpell(target, SPELL_DARK_TOUCHED, true);
unitTarget->CastSpell(unitTarget, SPELL_DARK_TOUCHED, true);
}
break;
}
default:
break;
}
}
@@ -675,21 +699,28 @@ public:
void JustEngagedWith(Unit* /*who*/) override { }
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
{
if (!target->IsUnit())
return;
switch (spell->Id)
{
case SPELL_SHADOW_FURY:
case SPELL_DARK_STRIKE:
if (!target->HasAura(SPELL_DARK_FLAME))
{
Unit* unitTarget = target->ToUnit();
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,8 +198,13 @@ public:
instance->SetBossState(DATA_FELMYST, DONE);
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spell) override
{
if (!caster || !caster->IsUnit())
return;
Unit* unitCaster = caster->ToUnit();
// workaround for linked aura
/*if (spell->Id == SPELL_VAPOR_FORCE)
{
@@ -209,15 +214,15 @@ public:
if (spell->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,15 @@ struct boss_sathrovarr : public BossAI
kalecgos->AI()->EnterEvadeMode(why);
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spell) override
{
if (!caster || !caster->IsUnit())
return;
if (spell->Id == SPELL_TAP_CHECK_DAMAGE)
{
DoCastSelf(SPELL_TELEPORT_BACK, true);
Unit::Kill(caster, me);
Unit::Kill(caster->ToUnit(), me);
}
}
@@ -353,7 +353,7 @@ 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* spell) override
{
switch (spell->Id)
{
@@ -126,7 +126,7 @@ struct boss_commander_ulthok : public BossAI
instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me);
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
{
if (!target)
return;
@@ -451,7 +451,7 @@ struct npc_ozumat_neptulon : public ScriptedAI
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_ENTANGLING_GRASP)
{
@@ -678,10 +678,13 @@ struct npc_ozumat_unyielding_behemoth : public ScriptedAI
}
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
{
if (!target->IsUnit())
return;
if (spell->Id == SPELL_SHADOW_BLAST_VISUAL)
target->RemoveAurasDueToSpell(SPELL_SHRINK);
target->ToUnit()->RemoveAurasDueToSpell(SPELL_SHRINK);
}
void UpdateAI(uint32 diff) override
@@ -193,7 +193,7 @@ struct npc_tott_lady_nazjar : public ScriptedAI
}
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
{
bool useLeftGUIDs = false;
if (spell->Id == SPELL_TRIGGER_MURLOC)
@@ -124,7 +124,7 @@ class boss_archaedas : public CreatureScript
me->SetControlled(false, UNIT_STATE_ROOT);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
// Being woken up from the altar, start the awaken sequence
if (spell->Id == SPELL_ARCHAEDAS_AWAKEN)
@@ -271,7 +271,7 @@ class npc_archaedas_minions : public CreatureScript
bAmIAwake = true;
}
void SpellHit(Unit * /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
// time to wake up, start animation
if (spell->Id == SPELL_ARCHAEDAS_AWAKEN)
@@ -351,7 +351,7 @@ struct npc_mandokir_ohgan : public ScriptedAI
}
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
{
if (target && spell->Id == SPELL_OHGAN_ORDERS)
_events.CancelEvent(EVENT_ATTACK_PLAYERS);
@@ -408,7 +408,7 @@ struct npc_zanzil_zanzili_berserker : public ScriptedAI
_elixirHits = 0;
}
void SpellHit(Unit* /*caster*/, const SpellInfo* spellInfo) override
void SpellHit(WorldObject* /*caster*/, const SpellInfo* spellInfo) override
{
if (spellInfo->Id == SPELL_ZANZILS_RESURRECTION_ELIXIR_TRIGGERED)
{
@@ -426,15 +426,15 @@ struct npc_zanzil_zanzili_berserker : public ScriptedAI
}
}
void SpellHitTarget(Unit* victim, const SpellInfo* spellInfo) override
void SpellHitTarget(WorldObject* victim, const SpellInfo* spellInfo) override
{
if (!victim)
if (!victim || !victim->IsUnit())
return;
if (spellInfo->Id == SPELL_PURSUIT)
{
me->GetThreatManager().ResetAllThreat();
AddThreat(victim, spellInfo->Effects[EFFECT_1].BasePoints);
AddThreat(victim->ToUnit(), spellInfo->Effects[EFFECT_1].CalcValue());
Talk(SAY_WHISPER_PURSUIT_PLAYER, victim);
Talk(SAY_ANNOUNCE_PURSUIT_PLAYER, victim);
}
@@ -135,13 +135,16 @@ struct npc_zulgurub_berserking_boulder_roller : public ScriptedAI
me->GetMotionMaster()->MoveTargetedHome();
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
{
if (!target->IsUnit())
return;
if (spell->Id == SPELL_ROLLING_BOULDERS_SEARCH_EFFECT)
{
me->SetReactState(REACT_AGGRESSIVE);
me->RemoveAurasDueToSpell(SPELL_ROLLING_BOULDERS_PERIODIC_AURA);
AttackStart(target);
AttackStart(target->ToUnit());
}
}
@@ -586,15 +589,15 @@ struct npc_zulgurub_gurubashi_berserker: public ScriptedAI
me->GetMotionMaster()->MoveTargetedHome();
}
void SpellHitTarget(Unit* victim, const SpellInfo* spellInfo) override
void SpellHitTarget(WorldObject* victim, const SpellInfo* spellInfo) override
{
if (!victim)
if (!victim->IsUnit())
return;
if (spellInfo->Id == SPELL_PURSUIT)
{
me->GetThreatManager().ResetAllThreat();
AddThreat(victim, spellInfo->Effects[EFFECT_1].BasePoints);
AddThreat(victim->ToUnit(), spellInfo->Effects[EFFECT_1].CalcValue());
Talk(SAY_WHISPER_PURSUIT_PLAYER, victim);
Talk(SAY_ANNOUNCE_PURSUIT_PLAYER, victim);
}
@@ -56,7 +56,7 @@ public:
_tapped = false;
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spell) override
{
if (_tapped)
return;
@@ -150,7 +150,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)
{
@@ -326,7 +326,7 @@ struct npc_hogger : public ScriptedAI
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_UPSET_STOMACH)
{
@@ -306,7 +306,7 @@ struct npc_brazie_the_bonatist_vehicle : public VehicleAI
}
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spell) override
{
switch (spell->Id)
{
@@ -872,7 +872,7 @@ struct npc_brazie_spot : public ScriptedAI
return 0;
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
switch (spell->Id)
{
@@ -1137,15 +1137,15 @@ struct npc_brazie_vehicle_notifier : public ScriptedAI
vehicle->AI()->JustSummoned(me);
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spell) override
{
if (!caster)
if (!caster || !caster->IsUnit())
return;
switch (spell->Id)
{
case SPELL_GAIN_SOLAR_POWER_SPELLCLICK:
if (Unit* vehicle = caster->GetVehicleCreatureBase())
if (Unit* vehicle = caster->ToUnit()->GetVehicleCreatureBase())
DoCast(vehicle, SPELL_GAIN_SOLAR_POWER_ENERGIZE, true);
me->GetMotionMaster()->MoveJump(SolarPowerJumpPos, 45.0f, 20.0f);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
@@ -127,7 +127,7 @@ class boss_epoch : public CreatureScript
}
}
void SpellHitTarget(Unit* target, SpellInfo const* info) override
void SpellHitTarget(WorldObject* target, SpellInfo const* info) override
{
if (info->Id == SPELL_TIME_STEP_DUMMY && me->IsHostileTo(target))
{
@@ -69,7 +69,7 @@ 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* spell) override
{
if (spell->Id == SPELL_CORRUPTION_OF_TIME_CHANNEL)
target->CastSpell(target, SPELL_CORRUPTION_OF_TIME_TARGET, true);
@@ -1407,7 +1407,7 @@ public:
current = candidate;
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (!_crateRevealed && spell->Id == SPELL_ARCANE_DISRUPTION)
{
@@ -137,7 +137,7 @@ public:
void JustEngagedWith(Unit* /*who*/) override { }
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (SpellCorrupt_Timer)
return;
@@ -119,7 +119,7 @@ class boss_baleroc : public CreatureScript
me->SetCanDualWield(true);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
switch (spell->Id)
{
@@ -269,7 +269,7 @@ struct npc_ptah_beetle_stalker : public ScriptedAI
{
npc_ptah_beetle_stalker(Creature* creature) : ScriptedAI(creature) { }
void SpellHit(Unit* /*caster*/, const SpellInfo* spellInfo) override
void SpellHit(WorldObject* /*caster*/, const SpellInfo* spellInfo) override
{
if (spellInfo->Id == SPELL_BEETLE_BURROW)
_events.ScheduleEvent(EVENT_SUMMON_JEWELED_SCARAB, Seconds(5), Seconds(6));
@@ -317,7 +317,7 @@ struct npc_rajh_orb_of_the_sun : public ScriptedAI
_events.ScheduleEvent(EVENT_GROW, 1s);
}
void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* /*target*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_RIDE_VEHICLE)
_events.ScheduleEvent(EVENT_BLAZING_INFERNO, 500ms);
@@ -303,7 +303,7 @@ public:
setesh->CastSpell(me, SPELL_CHAOS_BLAST_MISSLE, true);
}
void SpellHit(Unit* /*caster*/, const SpellInfo* spellInfo) override
void SpellHit(WorldObject* /*caster*/, const SpellInfo* spellInfo) override
{
if (spellInfo->Id != SPELL_CHAOS_BLAST_MISSLE)
return;
@@ -392,12 +392,12 @@ public:
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
void SpellHit(Unit* caster, const SpellInfo* spellInfo) override
void SpellHit(WorldObject* caster, const SpellInfo* spellInfo) override
{
if (spellInfo->Id != SPELL_CHANNEL_CHAOS_PORTAL)
if (!caster || !caster->IsUnit() || spellInfo->Id != SPELL_CHANNEL_CHAOS_PORTAL)
return;
caster->InterruptNonMeleeSpells(true, SPELL_CHANNEL_CHAOS_PORTAL);
caster->ToUnit()->InterruptNonMeleeSpells(true, SPELL_CHANNEL_CHAOS_PORTAL);
me->RemoveAurasDueToSpell(SPELL_DUMMY_AURA);
events.ScheduleEvent(EVENT_CAST_VISUAL, Seconds(1));
}
@@ -196,7 +196,7 @@ public:
Talk(SAY_KILL);
}
void SpellHit(Unit* /*pCaster*/, SpellInfo const* Spell) override
void SpellHit(WorldObject* /*pCaster*/, SpellInfo const* Spell) override
{
if (Spell->Id == SPELL_BREATH_EAST_TO_WEST ||
Spell->Id == SPELL_BREATH_WEST_TO_EAST ||
@@ -272,7 +272,7 @@ public:
}
}
void SpellHitTarget(Unit* target, SpellInfo const* Spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* Spell) override
{
//Workaround - Couldn't find a way to group this spells (All Eruption)
if (((Spell->Id >= 17086 && Spell->Id <= 17095) ||
@@ -117,14 +117,16 @@ class boss_ossirian : public CreatureScript
Initialize();
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spell) override
{
if (!caster || !caster->IsCreature() || !caster->ToCreature()->IsSummon())
for (uint8 i = 0; i < NUM_WEAKNESS; ++i)
{
if (spell->Id == SpellWeakness[i])
{
me->RemoveAurasDueToSpell(SPELL_SUPREME);
caster->ToTempSummon()->UnSummon();
caster->ToCreature()->ToTempSummon()->UnSummon();
SpawnNextCrystal();
}
}
@@ -164,7 +164,7 @@ struct boss_twinemperorsAI : public BossAI
}
}
void SpellHit(Unit* caster, SpellInfo const* entry) override
void SpellHit(WorldObject* caster, SpellInfo const* entry) override
{
if (caster == me)
return;
@@ -151,7 +151,7 @@ class boss_viscidus : public CreatureScript
Talk(EMOTE_CRACK);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if ((spell->GetSchoolMask() & SPELL_SCHOOL_MASK_FROST) && _phase == PHASE_FROST && me->GetHealthPct() > 5.0f)
{
@@ -622,7 +622,7 @@ struct npc_alakir_ice_storm : public ScriptedAI
_events.ScheduleEvent(EVENT_PING_ICE_STORM_TRIGGERS, 1s);
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
{
if (spell->Id == SPELL_ICE_STORM_PING && target->GetExactDist2d(me) > 20.0f)
_iceStormPositions.push_back(target->GetPosition());
@@ -349,7 +349,7 @@ struct boss_anshal : public BossAI
}
}
void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* /*target*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_WIND_DISTANCE_CHECKER)
{
@@ -359,7 +359,7 @@ struct boss_anshal : public BossAI
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_GATHER_STRENGTH)
{
@@ -597,7 +597,7 @@ struct boss_nezir : public BossAI
}
}
void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* /*target*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_WIND_DISTANCE_CHECKER)
{
@@ -607,7 +607,7 @@ struct boss_nezir : public BossAI
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_GATHER_STRENGTH)
{
@@ -836,7 +836,7 @@ struct boss_rohash : public BossAI
}
}
void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* /*target*/, SpellInfo const* spell) override
{
switch (spell->Id)
{
@@ -850,7 +850,7 @@ struct boss_rohash : public BossAI
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_GATHER_STRENGTH)
{
@@ -1032,10 +1032,10 @@ struct npc_conclave_of_wind_ravenous_creeper : public ScriptedAI
*/
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
{
if (spell->Id == SPELL_AI_CLEAR_TARGET)
ModifyThreatByPercent(target, -100);
if (target->IsUnit() && spell->Id == SPELL_AI_CLEAR_TARGET)
ModifyThreatByPercent(target->ToUnit(), -100);
}
void EnterEvadeMode(EvadeReason /*why*/) override
@@ -117,7 +117,7 @@ struct npc_lurking_tempest : public NullCreatureAI
DoCastSelf(SPELL_LURK_SEARCH_PERIODIC);
}
void SpellHit(Unit* /*unit*/, SpellInfo const* spellInfo) override
void SpellHit(WorldObject* /*unit*/, SpellInfo const* spellInfo) override
{
if (spellInfo->Id == SPELL_FEIGN_DEATH)
Talk(SAY_FEIGN_DEATH);
@@ -111,7 +111,7 @@ public:
}
}
void SpellHit(Unit* Caster, SpellInfo const* Spell) override
void SpellHit(WorldObject* caster, SpellInfo const* Spell) override
{
if (Spell->SpellFamilyFlags[2] & 0x080000000)
{
@@ -120,7 +120,7 @@ public:
DoCast(me, SPELL_STUNNED, true);
pCaster = Caster->GetGUID();
pCaster = caster->GetGUID();
SayThanksTimer = 5000;
}
@@ -73,11 +73,16 @@ public:
}
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spell) override
{
if (!caster || !caster->IsUnit())
return;
Unit* unitCaster = caster->ToUnit();
if (spell->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);
@@ -89,7 +94,7 @@ public:
EngagementOver();
me->FollowTarget(caster);
me->FollowTarget(unitCaster);
me->setActive(true);
}
}
@@ -86,7 +86,7 @@ public:
DoCast(SPELL_OMEN_SUMMON_SPOTLIGHT);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_ELUNE_CANDLE)
{
@@ -248,7 +248,7 @@ struct npc_mh_faerie_dragon : public ScriptedAI
me->GetMotionMaster()->MoveRandom(7.0f);
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spell) override
{
if (!caster)
return;
@@ -605,7 +605,7 @@ struct npc_mh_arch_druid_fandral_staghelm : public PassiveAI
me->FollowTarget(summoner);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_CUE_FANDRAL_TO_DESPAWN)
me->DespawnOrUnsummon();
+1 -1
View File
@@ -86,7 +86,7 @@ struct npc_mulgore_captured_brave : public ScriptedAI
{
npc_mulgore_captured_brave(Creature* creature) : ScriptedAI(creature) { }
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id != SPELL_UNLOCKING)
return;
@@ -231,7 +231,7 @@ public:
me->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_FLARE || spell->Id == SPELL_FOLLY)
{
+9 -7
View File
@@ -235,18 +235,20 @@ struct npc_uldum_uldum_camera_bunny_04 : public ScriptedAI
_pingCount = 0;
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spell) override
{
if (!caster)
if (!caster || !caster->IsUnit())
return;
Unit* unitCaster = caster->ToUnit();
switch (spell->Id)
{
case SPELL_PING_CAMERA_00:
if (_pingCount == PING_INDEX_PING_ALL_ACTORS)
{
_clonedImageGUID = caster->GetGUID();
DoCast(caster, SPELL_INVISIBLE_BEAM);
_clonedImageGUID = unitCaster->GetGUID();
DoCast(unitCaster, SPELL_INVISIBLE_BEAM);
DoCastSelf(SPELL_REVERSE_CAST_RIDE_VEHICLE, true);
DoCastSelf(SPELL_MASTER_PING_ALL_ACTORS, true);
_events.ScheduleEvent(EVENT_MOVE_PATH_1, 11s);
@@ -258,9 +260,9 @@ struct npc_uldum_uldum_camera_bunny_04 : public ScriptedAI
break;
case SPELL_PING_CAMERA_01:
me->CastStop();
DoCast(caster, SPELL_INVISIBLE_BEAM, true);
DoCast(unitCaster, SPELL_INVISIBLE_BEAM, true);
me->GetMotionMaster()->MoveAlongSplineChain(POINT_NONE, SPLINE_CHAIN_ID_CAMERA_PATH_2, true);
caster->GetMotionMaster()->MoveAlongSplineChain(POINT_NONE, SPLINE_CHAIN_ID_BEAM_TARGET_PATH_1, false);
unitCaster->GetMotionMaster()->MoveAlongSplineChain(POINT_NONE, SPLINE_CHAIN_ID_BEAM_TARGET_PATH_1, false);
_events.ScheduleEvent(EVENT_FADE_TO_BLACK_1, 8s + 500ms);
break;
case SPELL_PING_CAMERA_02:
@@ -272,7 +274,7 @@ struct npc_uldum_uldum_camera_bunny_04 : public ScriptedAI
}
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
{
if (spell->Id == SPELL_PING_BEAM_TARGET)
target->CastSpell(me, SPELL_PING_CAMERA_01, true);
@@ -371,7 +371,7 @@ class npc_crystal_shard : public CreatureScript
_events.ScheduleEvent(EVENT_REMOVE_SHRINK_AURA, Seconds(1) + Milliseconds(200));
}
void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* /*target*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_CRYSTAL_SHARDS_TARGET)
{
@@ -111,7 +111,7 @@ public:
}
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
{
if (spell->Id == SPELL_INSANITY)
{
@@ -360,7 +360,7 @@ public:
}
}
void SpellHit(Unit* /*whose*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*whose*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_SUBMERGE)
{
@@ -294,13 +294,13 @@ class boss_krik_thir : public CreatureScript
DoMeleeAttackIfReady();
}
void SpellHit(Unit* /*whose*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*whose*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_SUBBOSS_AGGRO_TRIGGER)
DoZoneInCombat();
}
void SpellHitTarget(Unit* /*who*/, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* /*who*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_SUBBOSS_AGGRO_TRIGGER)
Talk(SAY_SEND_GROUP);
@@ -380,7 +380,7 @@ struct npc_gatewatcher_petAI : public ScriptedAI
JustEngagedWith(who);
}
void SpellHit(Unit* /*whose*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*whose*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_SUBBOSS_AGGRO_TRIGGER)
DoZoneInCombat();
@@ -752,10 +752,10 @@ class npc_anub_ar_skirmisher : public CreatureScript
DoMeleeAttackIfReady();
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
{
if (spell->Id == SPELL_CHARGE && target)
DoCast(target, SPELL_FIXATE_TRIGGER);
if (spell->Id == SPELL_CHARGE && target->IsUnit())
DoCast(target->ToUnit(), SPELL_FIXATE_TRIGGER);
}
};
@@ -309,7 +309,7 @@ class boss_halion : public CreatureScript
}
}
void SpellHit(Unit* /*who*/, SpellInfo const* spellInfo) override
void SpellHit(WorldObject* /*who*/, SpellInfo const* spellInfo) override
{
if (spellInfo->Id == SPELL_TWILIGHT_MENDING)
Talk(SAY_REGENERATE);
@@ -493,7 +493,7 @@ class boss_twilight_halion : public CreatureScript
}
}
void SpellHit(Unit* /*who*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*who*/, SpellInfo const* spell) override
{
switch (spell->Id)
{
@@ -973,7 +973,7 @@ class boss_icehowl : public CreatureScript
instance->SetData(TYPE_NORTHREND_BEASTS, ICEHOWL_IN_PROGRESS);
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
{
if (spell->Id == SPELL_TRAMPLE && target->GetTypeId() == TYPEID_PLAYER)
{
@@ -222,7 +222,7 @@ class boss_devourer_of_souls : public CreatureScript
}
}
void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* /*target*/, SpellInfo const* spell) override
{
if (spell->Id == H_SPELL_PHANTOM_BLAST)
threeFaced = false;
@@ -171,11 +171,11 @@ class boss_garfrost : public CreatureScript
events.ScheduleEvent(EVENT_RESUME_ATTACK, 5000);
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
{
if (spell->Id == SPELL_PERMAFROST_HELPER)
if (spell->Id == SPELL_PERMAFROST_HELPER && target->IsUnit())
{
if (Aura* aura = target->GetAura(SPELL_PERMAFROST_HELPER))
if (Aura* aura = target->ToUnit()->GetAura(SPELL_PERMAFROST_HELPER))
_permafrostStack = std::max<uint32>(_permafrostStack, aura->GetStackAmount());
}
}
@@ -346,7 +346,7 @@ class boss_drakkari_elemental : public CreatureScript
me->DespawnOrUnsummon();
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
{
if (spell->Id == SPELL_MERGE)
{
@@ -169,7 +169,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);
@@ -125,7 +125,7 @@ class boss_moorabi : public CreatureScript
Talk(EMOTE_ACTIVATE_ALTAR);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spellInfo) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
{
if (spellInfo->Id == SPELL_TRANSFORMATION)
{
@@ -540,7 +540,7 @@ struct BloodPrincesBossAI : public BossAI
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SelectInvocationSpell())
DoAction(ACTION_CAST_INVOCATION);
@@ -417,7 +417,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* spell) override
{
if (target->GetTransport())
{
@@ -442,7 +442,7 @@ class boss_deathbringer_saurfang : public CreatureScript
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_BLOOD_LINK_POWER)
if (Aura* bloodPower = me->GetAura(SPELL_BLOOD_POWER))
@@ -714,7 +714,7 @@ class npc_high_overlord_saurfang_icc : public CreatureScript
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_GRIP_OF_AGONY)
{
@@ -921,7 +921,7 @@ class npc_muradin_bronzebeard_icc : public CreatureScript
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_GRIP_OF_AGONY)
{
@@ -1003,7 +1003,7 @@ class npc_saurfang_event : public CreatureScript
_index = data;
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_GRIP_OF_AGONY)
{
@@ -162,10 +162,10 @@ class boss_festergut : public CreatureScript
Talk(SAY_KILL);
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
{
if (spell->Id == PUNGENT_BLIGHT_HELPER)
target->RemoveAurasDueToSpell(INOCULATED_HELPER);
if (spell->Id == PUNGENT_BLIGHT_HELPER && target->IsUnit())
target->ToUnit()->RemoveAurasDueToSpell(INOCULATED_HELPER);
}
void UpdateAI(uint32 diff) override
@@ -386,7 +386,7 @@ class boss_lady_deathwhisper : public CreatureScript
}
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
{
if (spell->Id == SPELL_SUMMON_SPIRITS)
_nextVengefulShadeTargetGUID.push_back(target->GetGUID());
@@ -545,7 +545,7 @@ class npc_cult_fanatic : public CreatureScript
});
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
switch (spell->Id)
{
@@ -652,7 +652,7 @@ class npc_cult_adherent : public CreatureScript
});
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
switch (spell->Id)
{
@@ -745,7 +745,7 @@ class npc_vengeful_shade : public CreatureScript
_targetGUID = guid;
}
void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* /*target*/, SpellInfo const* spell) override
{
switch (spell->Id)
{
@@ -732,7 +732,7 @@ 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* spell) override
{
if (!_newTargetSelectTimer && spell->Id == sSpellMgr->GetSpellIdForDifficulty(_hitTargetSpellId, me))
_newTargetSelectTimer = 1000;
@@ -747,7 +747,7 @@ class npc_putricide_oozeAI : public ScriptedAI
DoCastAOE(_auraSpellId, true);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_TEAR_GAS_CREATURE)
_newTargetSelectTimer = 1000;
@@ -166,7 +166,7 @@ class boss_rotface : public CreatureScript
professor->AI()->EnterEvadeMode();
}
void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* /*target*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_SLIME_SPRAY)
Talk(SAY_SLIME_SPRAY);
@@ -428,11 +428,11 @@ class boss_sindragosa : public CreatureScript
summon->AI()->JustDied(summon);
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
{
if (uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(70127, me))
if (spellId == spell->Id)
if (Aura const* mysticBuffet = target->GetAura(spell->Id))
if (spellId == spell->Id && target->IsUnit())
if (Aura const* mysticBuffet = target->ToUnit()->GetAura(spell->Id))
_mysticBuffetStack = std::max<uint8>(_mysticBuffetStack, mysticBuffet->GetStackAmount());
}
@@ -782,13 +782,13 @@ class boss_the_lich_king : public CreatureScript
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_HARVESTED_SOUL && me->IsInCombat() && !IsHeroic())
Talk(SAY_LK_FROSTMOURNE_KILL);
}
void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* /*target*/, SpellInfo const* spell) override
{
if (spell->Id == REMORSELESS_WINTER_1 || spell->Id == REMORSELESS_WINTER_2)
{
@@ -1194,7 +1194,7 @@ class npc_tirion_fordring_tft : public CreatureScript
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_ICE_LOCK)
me->SetFacingTo(3.085098f);
@@ -378,7 +378,7 @@ class boss_valithria_dreamwalker : public CreatureScript
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_DREAM_SLIP)
{
@@ -745,7 +745,7 @@ class boss_sister_svalna : public CreatureScript
}
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spell) override
{
if (spell->Id == SPELL_HURL_SPEAR && me->HasAura(SPELL_AETHER_SHIELD))
{
@@ -766,12 +766,13 @@ class boss_sister_svalna : public CreatureScript
me->SetHover(false);
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
{
switch (spell->Id)
{
case SPELL_IMPALING_SPEAR_KILL:
Unit::Kill(me, target);
if (target->IsUnit())
Unit::Kill(me, target->ToUnit());
break;
case SPELL_IMPALING_SPEAR:
if (TempSummon* summon = target->SummonCreature(NPC_IMPALING_SPEAR, *target))
@@ -1218,7 +1219,7 @@ struct npc_argent_captainAI : public ScriptedAI
Reset();
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_REVIVE_CHAMPION && !IsUndead)
{
@@ -68,10 +68,11 @@ public:
_events.ScheduleEvent(EVENT_CRUSHING_LEAP, 15 * IN_MILLISECONDS);
}
void SpellHit(Unit* caster, SpellInfo const* /*spell*/) override
void SpellHit(WorldObject* caster, SpellInfo const* /*spell*/) override
{
if (caster->IsVehicle())
Unit::Kill(me, caster);
if (caster && caster->IsUnit() && caster->ToUnit()->IsVehicle())
Unit::Kill(me, caster->ToUnit());
}
void UpdateAI(uint32 diff) override
@@ -125,13 +125,13 @@ class boss_faerlina : public CreatureScript
Talk(SAY_DEATH);
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spell) override
{
if (spell->Id == SPELL_WIDOWS_EMBRACE_HELPER)
if (caster && caster->IsUnit() && spell->Id == SPELL_WIDOWS_EMBRACE_HELPER)
{
++_frenzyDispels;
Talk(EMOTE_WIDOW_EMBRACE, caster);
Unit::Kill(me, caster);
Unit::Kill(me, caster->ToUnit());
}
}
@@ -443,7 +443,7 @@ class boss_four_horsemen_baron : public CreatureScript
DoMeleeAttackIfReady();
}
void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* /*target*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_UNHOLY_SHADOW)
Talk(SAY_SPECIAL);
@@ -519,7 +519,7 @@ class boss_four_horsemen_thane : public CreatureScript
DoMeleeAttackIfReady();
}
void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* /*target*/, SpellInfo const* spell) override
{
if (_shouldSay && spell->Id == SPELL_METEOR)
{
@@ -671,7 +671,7 @@ class boss_four_horsemen_sir : public CreatureScript
}
}
void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* /*target*/, SpellInfo const* spell) override
{
if (_shouldSay && spell->Id == SPELL_HOLY_WRATH)
{
@@ -908,7 +908,7 @@ public:
return nullptr;
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (!spell)
return;
@@ -63,7 +63,7 @@ class boss_grobbulus : public CreatureScript
events.ScheduleEvent(EVENT_BERSERK, Minutes(12));
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
{
if (spell->Id == SPELL_SLIME_SPRAY)
me->SummonCreature(NPC_FALLOUT_SLIME, *target, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT);
@@ -282,7 +282,7 @@ public:
damage = 0;
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_CHAINS_DUMMY)
{
@@ -94,7 +94,7 @@ public:
Talk(SAY_SLAY);
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spell) override
{
if (spell->Id == SPELL_UNDERSTUDY_TAUNT)
Talk(SAY_TAUNTED, caster);
@@ -187,12 +187,12 @@ class boss_sapphiron : public CreatureScript
EnterPhaseGround(true);
}
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
{
switch(spell->Id)
{
case SPELL_CHECK_RESISTS:
if (target && target->GetResistance(SPELL_SCHOOL_FROST) > MAX_FROST_RESISTANCE)
if (target && target->IsUnit() && target->ToUnit()->GetResistance(SPELL_SCHOOL_FROST) > MAX_FROST_RESISTANCE)
_canTheHundredClub = false;
break;
}
@@ -604,35 +604,37 @@ public:
refreshBeam = true;
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spell) override
{
if (!caster)
if (!caster || !caster->IsUnit())
return;
if (spell->Id != SPELL_STALAGG_TESLA_PERIODIC)
return;
Unit* unitCaster = caster->ToUnit();
if (!isFeignDeath && me->IsInCombat() && !me->GetHomePosition().IsInDist(me, OVERLOAD_DISTANCE))
{
if (!isOverloading)
{
isOverloading = true;
caster->SetImmuneToPC(false);
unitCaster->SetImmuneToPC(false);
if (Creature* creatureCaster = caster->ToCreature())
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);
unitCaster->CastStop(SPELL_TESLA_SHOCK);
unitCaster->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);
unitCaster->CastStop();
unitCaster->CastSpell(me, SPELL_STALAGG_CHAIN_VISUAL, true);
unitCaster->SetImmuneToPC(true);
}
}
@@ -853,35 +855,37 @@ public:
refreshBeam = true;
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spell) override
{
if (!caster)
if (!caster || !caster->IsUnit())
return;
if (spell->Id != SPELL_FEUGEN_TESLA_PERIODIC)
return;
Unit* unitCaster = caster->ToUnit();
if (!isFeignDeath && me->IsInCombat() && !me->GetHomePosition().IsInDist(me, OVERLOAD_DISTANCE))
{
if (!isOverloading)
{
isOverloading = true;
caster->SetImmuneToPC(false);
unitCaster->SetImmuneToPC(false);
if (Creature* creatureCaster = caster->ToCreature())
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);
unitCaster->CastStop(SPELL_TESLA_SHOCK);
unitCaster->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);
unitCaster->CastStop();
unitCaster->CastSpell(me, SPELL_FEUGEN_CHAIN_VISUAL, true);
unitCaster->SetImmuneToPC(true);
}
}
@@ -629,7 +629,7 @@ public:
}
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
void SpellHit(WorldObject* caster, SpellInfo const* spell) override
{
if (spell->Id == SPELL_POWER_SPARK_MALYGOS)
{
@@ -1025,7 +1025,7 @@ public:
_instance = creature->GetInstanceScript();
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_PORTAL_OPENED)
{
@@ -1476,7 +1476,7 @@ public:
}
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
void SpellHit(WorldObject* /*caster*/, SpellInfo const* spell) override
{
if (spell->Id == SPELL_ARCANE_BOMB_TRIGGER)
{
Loaded 100 of 141 files, more files were not shown because too many files have changed in this diff. Show more