AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
npc_snobold_vassal::npc_snobold_vassalAI Struct Reference
Inheritance diagram for npc_snobold_vassal::npc_snobold_vassalAI:
ScriptedAI CreatureAI UnitAI

Public Member Functions

 npc_snobold_vassalAI (Creature *pCreature)
 
void Reset () override
 
void AttackStart (Unit *who) override
 
void MoveInLineOfSight (Unit *) override
 
void SetGUID (ObjectGuid const &guid, int32 id) override
 
void EnterEvadeMode (EvadeReason why) override
 
void LoseCarrier ()
 
Creature * GetGormok () const
 
Unit * SelectFireBombTarget ()
 
bool BoardGormok (Creature *gormok)
 
void ReturnToGormok ()
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith()
 
void JustDied (Unit *) override
 
void DoAction (int32 param) override
 
- Public Member Functions inherited from ScriptedAI
 ScriptedAI (Creature *creature)
 
 ~ScriptedAI () override
 
void AttackStartNoMove (Unit *target)
 
void DamageTaken (Unit *, uint32 &, DamageEffectType, SpellSchoolMask) override
 Called at any Damage from any attacker (before damage apply)
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith()
 
void JustDied (Unit *) override
 
void KilledUnit (Unit *) override
 
void JustSummoned (Creature *) override
 
void SummonedCreatureDespawn (Creature *) override
 
void SpellHit (Unit *, SpellInfo const *) override
 
void SpellHitTarget (Unit *, SpellInfo const *) override
 
void MovementInform (uint32, uint32) override
 
void OnPossess (bool)
 
bool IsInRoom (Position const *pos, Axis axis, bool above)
 
void Reset () override
 
void JustEngagedWith (Unit *) override
 Called for reaction when initially engaged - this happens after JustEnteredCombat.
 
void AttackStart (Unit *) override
 
void DoStartMovement (Unit *target, float distance=0.0f, float angle=0.0f)
 
void DoStartNoMovement (Unit *target)
 
void DoStopAttack ()
 
void DoRewardPlayersInArea ()
 
void DoCastSpell (Unit *target, SpellInfo const *spellInfo, bool triggered=false)
 
void DoPlaySoundToSet (WorldObject *source, uint32 soundId)
 
void DoPlayMusic (uint32 soundId, bool zone)
 
void DoAddThreat (Unit *unit, float amount)
 
void DoModifyThreatByPercent (Unit *unit, int32 pct)
 
void DoResetThreat (Unit *unit)
 
void DoResetThreatList ()
 
float DoGetThreat (Unit *unit)
 
void DoTeleportPlayer (Unit *unit, float x, float y, float z, float o)
 
void DoTeleportPlayer (Unit *unit, Position pos)
 
void DoTeleportAll (float x, float y, float z, float o)
 
Unit * DoSelectLowestHpFriendly (float range, uint32 minHPDiff=1)
 
std::list< Creature * > DoFindFriendlyCC (float range)
 
std::list< Creature * > DoFindFriendlyMissingBuff (float range, uint32 spellId)
 
Player * GetPlayerAtMinimumRange (float minRange)
 
Creature * DoSpawnCreature (uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, uint32 type, uint32 despawntime)
 
bool IsUniqueTimedEventDone (uint32 id) const
 
void SetUniqueTimedEventDone (uint32 id)
 
void ResetUniqueTimedEvent (uint32 id)
 
void ClearUniqueTimedEventsDone ()
 
void ScheduleTimedEvent (Milliseconds timerMin, Milliseconds timerMax, std::function< void()> exec, Milliseconds repeatMin, Milliseconds repeatMax=0ms, uint32 uniqueId=0)
 
void ScheduleTimedEvent (Milliseconds timerMax, std::function< void()> exec, Milliseconds repeatMin, Milliseconds repeatMax=0ms, uint32 uniqueId=0)
 
void ScheduleUniqueTimedEvent (Milliseconds timer, std::function< void()> exec, uint32 uniqueId)
 
bool HealthBelowPct (uint32 pct) const
 
bool HealthAbovePct (uint32 pct) const
 
SpellInfo const * SelectSpell (Unit *target, uint32 school, uint32 mechanic, SelectTargetType targets, uint32 powerCostMin, uint32 powerCostMax, float rangeMin, float rangeMax, SelectEffect effect)
 
void SetEquipmentSlots (bool loadDefault, int32 mainHand=EQUIP_NO_CHANGE, int32 offHand=EQUIP_NO_CHANGE, int32 ranged=EQUIP_NO_CHANGE)
 
virtual bool CheckEvadeIfOutOfCombatArea () const
 
bool IsHeroic () const
 
Difficulty GetDifficulty () const
 
bool Is25ManRaid () const
 
template<class T >
T const & DUNGEON_MODE (T const &normal5, T const &heroic10) const
 
template<class T >
T const & RAID_MODE (T const &normal10, T const &normal25) const
 
template<class T >
T const & RAID_MODE (T const &normal10, T const &normal25, T const &heroic10, T const &heroic25) const
 
Player * SelectTargetFromPlayerList (float maxdist, uint32 excludeAura=0, bool mustBeInLOS=false) const
 
void SetInvincibility (bool apply)
 
bool IsInvincible () const
 
void SetAutoAttackAllowed (bool allow)
 
bool IsAutoAttackAllowed () const
 
- Public Member Functions inherited from CreatureAI
void Talk (uint8 id, WorldObject const *whisperTarget=nullptr, Milliseconds delay=0ms)
 Causes the creature to talk/say the text assigned to their entry in the creature_text database table.
 
void Talk (uint8 id, Milliseconds delay)
 
WorldObject * GetSummoner () const
 Returns the summoner creature/object, if the creature is a temporary summon.
 
 CreatureAI (Creature *creature)
 
 ~CreatureAI () override
 
bool IsEngaged () const
 Check if creature is currently engaged in combat.
 
void MoveCircleChecks ()
 
void MoveBackwardsChecks ()
 
void MoveInLineOfSight_Safe (Unit *who)
 == Reactions At =================================
 
void TriggerAlert (Unit const *who) const
 
virtual bool CanRespawn ()
 
virtual bool IsEscortNPC (bool=true) const
 
void JustEnteredCombat (Unit *who) override
 Called when the unit enters combat.
 
virtual void JustStartedThreateningMe (Unit *who)
 
void EngagementStart (Unit *who)
 
void EngagementOver ()
 
void JustExitedCombat () override
 Called when the unit leaves combat.
 
virtual void IsSummonedBy (WorldObject *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void SummonedCreatureDespawnAll ()
 
virtual void SummonedCreatureEvade (Creature *)
 
virtual void OnSpellStart (SpellInfo const *)
 
virtual void OnSpellCast (SpellInfo const *)
 
virtual void OnSpellFailed (SpellInfo const *)
 
virtual void OnChannelFinished (SpellInfo const *)
 
virtual void AttackedBy (Unit *)
 
virtual bool IsEscorted ()
 
virtual void JustRespawned ()
 
virtual void PathEndReached (uint32)
 
virtual void WaypointPathStarted (uint32)
 == Waypoints system =============================
 
virtual void WaypointStarted (uint32, uint32)
 
virtual void WaypointReached (uint32, uint32)
 
virtual void WaypointPathEnded (uint32, uint32)
 
void OnCharmed (bool apply) override
 Called when unit is charmed.
 
virtual void JustReachedHome ()
 
void DoZoneInCombat (Creature *creature=nullptr, float maxRangeToNearestTarget=250.0f)
 
virtual void ReceiveEmote (Player *, uint32)
 
virtual void OwnerAttackedBy (Unit *attacker)
 
virtual void OwnerAttacked (Unit *target)
 
void OnOwnerCombatInteraction (Unit *target)
 
virtual void CorpseRemoved (uint32 &)
 == Triggered Actions Requested ==================
 
virtual void PassengerBoarded (Unit *, int8, bool)
 == Fields =======================================
 
virtual bool BeforeSpellClick (Unit *)
 
virtual void OnSpellClick (Unit *, bool &)
 
virtual bool CanSeeAlways (WorldObject const *)
 
virtual bool CanBeSeen (Player const *)
 
virtual bool CanAlwaysBeDetectable (WorldObject const *)
 
virtual void PetStopAttack ()
 
int32 VisualizeBoundary (uint32 duration, Unit *owner=nullptr, bool fill=false, bool checkZ=false) const
 
virtual bool CheckInRoom ()
 
CreatureBoundary const * GetBoundary () const
 
void SetBoundary (CreatureBoundary const *boundary, bool negativeBoundaries=false)
 
bool IsInBoundary (Position const *who=nullptr) const
 
virtual void CalculateThreat (Unit *, float &, SpellInfo const *)
 
virtual bool OnTeleportUnreacheablePlayer (Player *)
 
virtual void OnAuraRemove (AuraApplication *, AuraRemoveMode)
 
virtual void DistancingStarted ()
 
virtual void DistancingEnded ()
 
- Public Member Functions inherited from UnitAI
 UnitAI (Unit *unit)
 
virtual ~UnitAI ()
 
virtual bool CanAIAttack (Unit const *) const
 
virtual void InitializeAI ()
 
virtual uint32 GetData (uint32) const
 
virtual void SetData (uint32, uint32)
 
virtual ObjectGuid GetGUID (int32=0) const
 
Unit * SelectTarget (SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
 
template<class PREDICATE >
Unit * SelectTarget (SelectTargetMethod targetType, uint32 position, PREDICATE const &predicate)
 
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
 Select the best (up to) <num> targets (in <targetType> order) from the threat list that fulfill the following:
 
template<class PREDICATE >
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectTargetMethod targetType, uint32 position, PREDICATE const &predicate)
 
virtual void OnDespawn ()
 Called when the unit is about to be removed from the world (despawn, grid unload, corpse disappearing, player logging out etc.)
 
virtual void EvadeTimerExpired ()
 Called when evade timer expires (target unreachable for too long)
 
virtual void DamageDealt (Unit *, uint32 &, DamageEffectType, SpellSchoolMask)
 Called at any Damage to any victim (before damage apply)
 
virtual void HealReceived (Unit *, uint32 &)
 Called when the creature receives heal.
 
virtual void OnPowerUpdate (Powers, int32, int32, uint32)
 Called when the creature power updates.
 
virtual void HealDone (Unit *, uint32 &)
 Called when the unit heals.
 
virtual void OnCalculateMeleeDamageReceived (uint32 &, Unit *)
 Called during damage calculations.
 
virtual void OnCalculateSpellDamageReceived (int32 &, Unit *)
 
virtual void OnCalculatePeriodicTickReceived (uint32 &, Unit *)
 Called during calculation when receiving periodic healing or damage (DoT or HoT)
 
void AttackStartCaster (Unit *victim, float dist)
 
SpellCastResult DoAddAuraToAllHostilePlayers (uint32 spellid)
 
SpellCastResult DoCast (uint32 spellId)
 
SpellCastResult DoCast (Unit *victim, uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastSelf (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastToAllHostilePlayers (uint32 spellid, bool triggered=false)
 To specify the caster as target if the spell is self-cast.
 
SpellCastResult DoCastVictim (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastAOE (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastRandomTarget (uint32 spellId, uint32 threatTablePosition=0, float dist=0.0f, bool playerOnly=true, bool triggered=false, bool withTank=true, int32 aura=0)
 Cast the spell on a random unit from the threat list.
 
SpellCastResult DoCastMaxThreat (uint32 spellId, uint32 threatTablePosition=0, float dist=0.0f, bool playerOnly=true, bool triggered=false)
 Cast spell on the top threat target, which may not be the current victim.
 
float DoGetSpellMaxRange (uint32 spellId, bool positive=false)
 
void DoMeleeAttackIfReady ()
 
bool DoSpellAttackIfReady (uint32 spell)
 
void DoSpellAttackToRandomTargetIfReady (uint32 spell, uint32 threatTablePosition=0, float dist=0.f, bool playerOnly=true)
 
virtual void SummonMovementInform (Creature *, uint32, uint32)
 Called when a summon reaches a waypoint or point movement finished.
 
virtual void sGossipHello (Player *)
 
virtual void sGossipSelect (Player *, uint32, uint32)
 
virtual void sGossipSelectCode (Player *, uint32, uint32, char const *)
 
virtual void sQuestAccept (Player *, Quest const *)
 
virtual void sQuestSelect (Player *, Quest const *)
 
virtual void sQuestComplete (Player *, Quest const *)
 
virtual void sQuestReward (Player *, Quest const *, uint32)
 
virtual void sOnGameEvent (bool, uint16)
 
virtual std::string GetDebugInfo () const
 

Public Attributes

InstanceScript * pInstance
 
EventMap events
 
ObjectGuid TargetGUID
 
bool Dismounted = false
 
- Public Attributes inherited from ScriptedAI
Creature * me
 

Additional Inherited Members

- Public Types inherited from ScriptedAI
enum class  Axis {
  AXIS_X ,
  AXIS_Y
}
 
- Public Types inherited from CreatureAI
enum  EvadeReason {
  EVADE_REASON_NO_HOSTILES ,
  EVADE_REASON_BOUNDARY ,
  EVADE_REASON_SEQUENCE_BREAK ,
  EVADE_REASON_NO_PATH ,
  EVADE_REASON_OTHER
}
 
- Static Public Member Functions inherited from CreatureAI
static bool IsInBounds (CreatureBoundary const &boundary, Position const *who)
 
- Static Public Member Functions inherited from UnitAI
static void FillAISpellInfo ()
 
- Static Public Attributes inherited from UnitAI
static AISpellInfoType * AISpellInfo
 
- Protected Member Functions inherited from CreatureAI
bool UpdateVictim ()
 
bool UpdateVictimWithGaze ()
 
void SetGazeOn (Unit *target)
 
Creature * DoSummon (uint32 entry, Position const &pos, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
Creature * DoSummon (uint32 entry, WorldObject *obj, float radius=5.0f, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
Creature * DoSummonFlyer (uint32 entry, WorldObject *obj, float flightZ, float radius=5.0f, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
bool _EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER)
 
- Protected Attributes inherited from CreatureAI
Creature *const me
 
EventMap events
 
TaskScheduler scheduler
 
CreatureBoundary const * _boundary
 
bool _negateBoundary
 
bool _isEngaged
 
- Protected Attributes inherited from UnitAI
Unit *const me
 

Detailed Description

Constructor & Destructor Documentation

◆ npc_snobold_vassalAI()

npc_snobold_vassal::npc_snobold_vassalAI::npc_snobold_vassalAI ( Creature *  pCreature)
inline
97 : ScriptedAI(pCreature)
98 {
99 pInstance = pCreature->GetInstanceScript();
102 }
@ REACT_PASSIVE
Definition Unit.h:574
void SetReactState(ReactStates state)
A creature can have 3 ReactStates : Agressive, Passive, Neutral.
Definition Creature.h:99
void Clear()
Definition ObjectGuid.h:141
InstanceScript * GetInstanceScript() const
Definition Object.cpp:1247
Definition ScriptedCreature.h:202
Creature * me
Definition ScriptedCreature.h:292
ObjectGuid TargetGUID
Definition boss_northrend_beasts.cpp:106
InstanceScript * pInstance
Definition boss_northrend_beasts.cpp:104

References ObjectGuid::Clear(), WorldObject::GetInstanceScript(), ScriptedAI::me, pInstance, REACT_PASSIVE, Creature::SetReactState(), and TargetGUID.

Member Function Documentation

◆ AttackStart()

void npc_snobold_vassal::npc_snobold_vassalAI::AttackStart ( Unit *  who)
inlineoverridevirtual

Reimplemented from UnitAI.

116 {
117 if (!Dismounted && who->GetGUID() != TargetGUID)
118 return;
120 }
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:120
void AttackStart(Unit *) override
Definition ScriptedCreature.cpp:228
bool Dismounted
Definition boss_northrend_beasts.cpp:107

References ScriptedAI::AttackStart(), Dismounted, Object::GetGUID(), and TargetGUID.

Referenced by SetGUID().

◆ BoardGormok()

bool npc_snobold_vassal::npc_snobold_vassalAI::BoardGormok ( Creature *  gormok)
inline
185 {
186 if (Vehicle* vk = gormok->GetVehicleKit())
187 for (uint8 i = 0; i < 4; ++i)
188 if (!vk->GetPassenger(i))
189 {
190 me->EnterVehicleUnattackable(gormok, i);
191 Reset();
192 return true;
193 }
194
195 return false;
196 }
std::uint8_t uint8
Definition Define.h:109
void EnterVehicleUnattackable(Unit *base, int8 seatId=-1)
Definition Unit.cpp:15307
Vehicle * GetVehicleKit() const
Definition Unit.h:1947
Definition Vehicle.h:28
void Reset() override
Definition boss_northrend_beasts.cpp:109

References Unit::EnterVehicleUnattackable(), Unit::GetVehicleKit(), ScriptedAI::me, and Reset().

Referenced by LoseCarrier(), and ReturnToGormok().

◆ DoAction()

void npc_snobold_vassal::npc_snobold_vassalAI::DoAction ( int32  param)
inlineoverridevirtual

Reimplemented from UnitAI.

322 {
323 switch (param)
324 {
327 break;
329 // Gormok's death ejects his passengers; they keep bombing and join the fight shortly after landing
330 if (TargetGUID)
331 return;
332
333 Dismounted = true;
335 // Engaged but passive until the attack step, so their own threat lists feed the early Fire Bombs
337 events.Reset();
338 events.ScheduleEvent(EVENT_SPELL_FIRE_BOMB, 1s, 12s);
339 events.ScheduleEvent(EVENT_DISMOUNTED_ATTACK, 5s);
340 break;
341 }
342 }
@ ACTION_GORMOK_DIED
Definition boss_northrend_beasts.cpp:60
@ ACTION_SNOBOLD_MISSED
Definition boss_northrend_beasts.cpp:61
@ EVENT_SPELL_FIRE_BOMB
Definition boss_northrend_beasts.cpp:53
@ EVENT_DISMOUNTED_ATTACK
Definition boss_northrend_beasts.cpp:55
events
Definition boss_sartura.cpp:43
TaskScheduler scheduler
Definition CreatureAI.h:74
void DoZoneInCombat(Creature *creature=nullptr, float maxRangeToNearestTarget=250.0f)
Definition CreatureAI.cpp:117
TaskScheduler & CancelAll()
Definition TaskScheduler.cpp:45
void ReturnToGormok()
Definition boss_northrend_beasts.cpp:199

References ACTION_GORMOK_DIED, ACTION_SNOBOLD_MISSED, TaskScheduler::CancelAll(), Dismounted, CreatureAI::DoZoneInCombat(), EVENT_DISMOUNTED_ATTACK, EVENT_SPELL_FIRE_BOMB, ReturnToGormok(), CreatureAI::scheduler, and TargetGUID.

Referenced by LoseCarrier().

◆ EnterEvadeMode()

void npc_snobold_vassal::npc_snobold_vassalAI::EnterEvadeMode ( EvadeReason  why)
inlineoverridevirtual

Reimplemented from CreatureAI.

141 {
142 // Nothing cleans up a dismounted snobold once Gormok's corpse is gone
143 if (Dismounted)
144 {
146 return;
147 }
148
150 }
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
Definition CreatureAI.cpp:235
void DespawnOrUnsummon(Milliseconds msTimeToDespawn=0ms, Seconds forcedRespawnTimer=0s)
Definition Creature.cpp:2221

References Creature::DespawnOrUnsummon(), Dismounted, CreatureAI::EnterEvadeMode(), and ScriptedAI::me.

◆ GetGormok()

Creature * npc_snobold_vassal::npc_snobold_vassalAI::GetGormok ( ) const
inline
167 {
169 }
ObjectGuid GetGuidData(uint32 type) const override
Definition InstanceScript.cpp:121
Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:234
@ DATA_GORMOK
Definition trial_of_the_crusader.h:63

References DATA_GORMOK, ObjectAccessor::GetCreature(), InstanceScript::GetGuidData(), ScriptedAI::me, and pInstance.

Referenced by LoseCarrier(), ReturnToGormok(), and SelectFireBombTarget().

◆ JustDied()

void npc_snobold_vassal::npc_snobold_vassalAI::JustDied ( Unit *  )
inlineoverridevirtual

Reimplemented from CreatureAI.

312 {
314 if (t->IsAlive())
315 t->RemoveAurasDueToSpell(SPELL_SNOBOLLED);
316
317 // Dead passengers aren't unseated, so the corpse would ride the carrier and keep its seat taken
318 me->ExitVehicle();
319 }
@ SPELL_SNOBOLLED
Definition boss_northrend_beasts.cpp:38
Definition Unit.h:670
void ExitVehicle(Position const *exitPosition=nullptr)
Definition Unit.cpp:15393
Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:223

References Unit::ExitVehicle(), ObjectAccessor::GetUnit(), ScriptedAI::me, SPELL_SNOBOLLED, and TargetGUID.

◆ LoseCarrier()

void npc_snobold_vassal::npc_snobold_vassalAI::LoseCarrier ( )
inline
153 {
156 me->CombatStop(true);
159 Creature* gormok = GetGormok();
160 if (gormok && gormok->IsAlive())
161 BoardGormok(gormok);
162 else // Gormok is dead or gone, so fight on like the Snobolds ejected from him
164 }
Definition Creature.h:47
void ClearAllThreat()
Definition ThreatManager.cpp:617
uint32 GetMaxHealth() const
Definition Unit.h:1123
bool IsAlive() const
Definition Unit.h:1812
void SetHealth(uint32 val)
Definition Unit.cpp:12020
void CombatStop(bool includingCast=false, bool mutualPvP=true, bool keepPvPForOthers=false)
Definition Unit.cpp:7303
ThreatManager & GetThreatMgr()
Definition Unit.h:965
void RemoveAllAuras()
Definition Unit.cpp:5393
void DoAction(int32 param) override
Definition boss_northrend_beasts.cpp:321
bool BoardGormok(Creature *gormok)
Definition boss_northrend_beasts.cpp:184
Creature * GetGormok() const
Definition boss_northrend_beasts.cpp:166

References ACTION_GORMOK_DIED, BoardGormok(), ObjectGuid::Clear(), ThreatManager::ClearAllThreat(), Unit::CombatStop(), DoAction(), GetGormok(), Unit::GetMaxHealth(), Unit::GetThreatMgr(), Unit::IsAlive(), ScriptedAI::me, Unit::RemoveAllAuras(), Unit::SetHealth(), and TargetGUID.

Referenced by UpdateAI().

◆ MoveInLineOfSight()

void npc_snobold_vassal::npc_snobold_vassalAI::MoveInLineOfSight ( Unit *  )
inlineoverridevirtual

Reimplemented from CreatureAI.

122{}

◆ Reset()

void npc_snobold_vassal::npc_snobold_vassalAI::Reset ( )
inlineoverridevirtual

Reimplemented from UnitAI.

110 {
111 events.Reset();
112 events.ScheduleEvent(EVENT_SPELL_FIRE_BOMB, 10s, 30s);
113 }

References EVENT_SPELL_FIRE_BOMB.

Referenced by BoardGormok().

◆ ReturnToGormok()

void npc_snobold_vassal::npc_snobold_vassalAI::ReturnToGormok ( )
inline
200 {
201 scheduler.Schedule(1100ms, [this](TaskContext context)
202 {
203 Creature* gormok = GetGormok();
204 if (!gormok || !gormok->IsAlive())
205 return;
206
207 if (context.GetRepeatCounter() == 0)
208 me->GetMotionMaster()->MoveFollow(gormok, 0.0f, 0.0f, MOTION_SLOT_ACTIVE, false);
209
210 if (!me->IsWithinMeleeRange(gormok))
211 {
212 context.Repeat(250ms);
213 return;
214 }
215
217 if (BoardGormok(gormok))
218 scheduler.Schedule(1200ms, [this](TaskContext /*context*/)
219 {
221 });
222 else
224 });
225 }
@ MOTION_SLOT_ACTIVE
Definition MotionMaster.h:65
@ SPELL_FULL_HEAL
Definition boss_northrend_beasts.cpp:42
void MoveFollow(Unit *target, float dist, float angle, MovementSlot slot=MOTION_SLOT_ACTIVE, bool inheritWalkState=true, bool inheritSpeed=true)
The unit will follow this target. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition MotionMaster.cpp:448
void Clear(bool reset=true)
Definition MotionMaster.h:194
Definition TaskScheduler.h:422
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
Definition TaskScheduler.h:494
TaskScheduler::repeated_t GetRepeatCounter() const
Returns the repeat counter which increases every time the task is repeated.
Definition TaskScheduler.cpp:243
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
Definition TaskScheduler.h:233
SpellCastResult DoCastSelf(uint32 spellId, bool triggered=false)
Definition UnitAI.h:399
MotionMaster * GetMotionMaster()
Definition Unit.h:1774
bool IsWithinMeleeRange(Unit const *obj, float dist=0.f) const
Definition Unit.cpp:790

References BoardGormok(), MotionMaster::Clear(), Creature::DespawnOrUnsummon(), UnitAI::DoCastSelf(), GetGormok(), Unit::GetMotionMaster(), TaskContext::GetRepeatCounter(), Unit::IsAlive(), Unit::IsWithinMeleeRange(), ScriptedAI::me, MOTION_SLOT_ACTIVE, MotionMaster::MoveFollow(), TaskContext::Repeat(), TaskScheduler::Schedule(), CreatureAI::scheduler, and SPELL_FULL_HEAL.

Referenced by DoAction().

◆ SelectFireBombTarget()

Unit * npc_snobold_vassal::npc_snobold_vassalAI::SelectFireBombTarget ( )
inline
173 {
174 Creature* gormok = GetGormok();
175 if (!gormok || !gormok->IsAlive())
176 return SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true);
177
178 if (Unit* target = gormok->AI()->SelectTarget(SelectTargetMethod::Random, 0, [gormok](Unit* unit) { return unit->IsPlayer() && !unit->IsWithinMeleeRange(gormok); }))
179 return target;
180
181 return gormok->AI()->SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true);
182 }
CreatureAI * AI() const
Definition Creature.h:143
Unit * SelectTarget(SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:108

References Creature::AI(), GetGormok(), Unit::IsAlive(), Random, and UnitAI::SelectTarget().

Referenced by UpdateAI().

◆ SetGUID()

void npc_snobold_vassal::npc_snobold_vassalAI::SetGUID ( ObjectGuid const &  guid,
int32  id 
)
inlineoverridevirtual

Reimplemented from UnitAI.

125 {
126 if (id != DATA_SNOBOLD_CARRIER)
127 return;
128
129 TargetGUID = guid;
130 if (Player* carrier = ObjectAccessor::GetPlayer(*me, guid))
131 AttackStart(carrier);
132
133 // Started on every latch: a Snobold that reboarded Gormok is still engaged, so JustEngagedWith won't fire again
134 events.Reset();
135 events.ScheduleEvent(EVENT_SPELL_SNOBOLLED, 1100ms);
136 events.ScheduleEvent(EVENT_SPELL_HEAD_CRACK, 2700ms);
137 events.ScheduleEvent(EVENT_SPELL_BATTER, 1100ms);
138 }
@ DATA_SNOBOLD_CARRIER
Definition boss_northrend_beasts.cpp:67
@ EVENT_SPELL_HEAD_CRACK
Definition boss_northrend_beasts.cpp:54
@ EVENT_SPELL_BATTER
Definition boss_northrend_beasts.cpp:52
@ EVENT_SPELL_SNOBOLLED
Definition boss_northrend_beasts.cpp:51
Definition Player.h:1086
Player * GetPlayer(Map const *, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:244
void AttackStart(Unit *who) override
Definition boss_northrend_beasts.cpp:115

References AttackStart(), DATA_SNOBOLD_CARRIER, EVENT_SPELL_BATTER, EVENT_SPELL_HEAD_CRACK, EVENT_SPELL_SNOBOLLED, ObjectAccessor::GetPlayer(), ScriptedAI::me, and TargetGUID.

◆ UpdateAI()

void npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI ( uint32  )
inlineoverridevirtual

Use to start attacking a target. Called just before JustEngagedWith()

Implements UnitAI.

228 {
229 scheduler.Update(diff);
230
231 Unit* t = nullptr;
232 if (Dismounted)
233 {
235 return;
236
237 t = me->GetVictim();
238 }
239 else
240 {
241 if (!me->GetVehicle())
242 {
243 // Ejected because the carrier left the map or stopped being a vehicle when Northrend Beasts ended
244 if (TargetGUID)
245 LoseCarrier();
246 return;
247 }
248
250 if (!t)
251 t = me->GetVehicleBase();
252 }
253
254 if (!Dismounted && t->isDead())
255 {
256 LoseCarrier();
257 return;
258 }
259
260 events.Update(diff);
261
263 return;
264
265 switch (events.ExecuteEvent())
266 {
267 case 0:
268 break;
272 // An unengaged creature never evades, so a Snobold with nobody left to fight would idle forever
273 if (!me->IsEngaged())
274 {
276 return;
277 }
278 events.ScheduleEvent(EVENT_SPELL_HEAD_CRACK, 1s, 5s);
279 break;
281 if (t->IsPlayer())
282 me->CastSpell((Unit*)nullptr, SPELL_SNOBOLLED, true);
283
284 break;
286 // Batter is an interrupt, only used once the carrier starts a cast
287 if (t->IsPlayer() && t->IsNonMeleeSpellCast(false, false, true))
288 {
290 events.Repeat(8s);
291 }
292 else
293 events.Repeat(250ms);
294 break;
296 if (Dismounted || !t->IsPlayer())
297 if (Unit* target = SelectFireBombTarget())
298 DoCast(target, SPELL_FIRE_BOMB);
299 events.Repeat(20s, 30s);
300 break;
302 if (t->IsPlayer())
304 events.Repeat(30s, 35s);
305 break;
306 }
307
309 }
@ UNIT_STATE_CASTING
Definition UnitDefines.h:188
@ REACT_AGGRESSIVE
Definition Unit.h:576
@ SPELL_FIRE_BOMB
Definition boss_northrend_beasts.cpp:40
@ SPELL_BATTER
Definition boss_northrend_beasts.cpp:39
@ SPELL_HEAD_CRACK
Definition boss_northrend_beasts.cpp:41
bool UpdateVictim()
Definition CreatureAI.cpp:350
bool IsEngaged() const override
Definition Creature.cpp:2963
ReactStates GetReactState() const
Definition Creature.h:100
bool IsPlayer() const
Definition Object.h:207
TaskScheduler & Update(success_t const &callback=EmptyCallback)
Definition TaskScheduler.cpp:27
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:41
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:175
Vehicle * GetVehicle() const
Definition Unit.h:1948
Unit * GetVehicleBase() const
Definition Unit.cpp:14704
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
Definition Unit.cpp:4049
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition Unit.cpp:1378
Unit * GetVictim() const
Definition Unit.h:910
bool HasUnitState(const uint32 f) const
Definition Unit.h:742
bool isDead() const
Definition Unit.h:1814
Unit * SelectFireBombTarget()
Definition boss_northrend_beasts.cpp:172
void LoseCarrier()
Definition boss_northrend_beasts.cpp:152

References Unit::CastSpell(), Creature::DespawnOrUnsummon(), Dismounted, UnitAI::DoCast(), UnitAI::DoMeleeAttackIfReady(), CreatureAI::DoZoneInCombat(), EVENT_DISMOUNTED_ATTACK, EVENT_SPELL_BATTER, EVENT_SPELL_FIRE_BOMB, EVENT_SPELL_HEAD_CRACK, EVENT_SPELL_SNOBOLLED, Creature::GetReactState(), ObjectAccessor::GetUnit(), Unit::GetVehicle(), Unit::GetVehicleBase(), Unit::GetVictim(), Unit::HasUnitState(), Unit::isDead(), Creature::IsEngaged(), Unit::IsNonMeleeSpellCast(), Object::IsPlayer(), LoseCarrier(), ScriptedAI::me, REACT_AGGRESSIVE, REACT_PASSIVE, CreatureAI::scheduler, SelectFireBombTarget(), Creature::SetReactState(), SPELL_BATTER, SPELL_FIRE_BOMB, SPELL_HEAD_CRACK, SPELL_SNOBOLLED, TargetGUID, UNIT_STATE_CASTING, TaskScheduler::Update(), and CreatureAI::UpdateVictim().

Member Data Documentation

◆ Dismounted

bool npc_snobold_vassal::npc_snobold_vassalAI::Dismounted = false

◆ events

EventMap npc_snobold_vassal::npc_snobold_vassalAI::events

◆ pInstance

InstanceScript* npc_snobold_vassal::npc_snobold_vassalAI::pInstance

Referenced by GetGormok(), and npc_snobold_vassalAI().

◆ TargetGUID

ObjectGuid npc_snobold_vassal::npc_snobold_vassalAI::TargetGUID

The documentation for this struct was generated from the following file: