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

Public Member Functions

 npc_battle_at_valhalasAI (Creature *creature)
 
void Reset () override
 
void ResetData ()
 
void JustSummoned (Creature *creature) override
 
void PrepareSummons ()
 
void StartBattle (ObjectGuid guid, uint32 questId)
 
void CheckSummons ()
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith() More...
 
- 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) More...
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith() More...
 
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 (const Position *pos, Axis axis, bool above)
 
void Reset () override
 
void JustEngagedWith (Unit *) override
 Called for reaction when initially engaged. More...
 
void AttackStart (Unit *) override
 
void DoStartMovement (Unit *target, float distance=0.0f, float angle=0.0f)
 
void DoStartNoMovement (Unit *target)
 
void DoStopAttack ()
 
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)
 
UnitDoSelectLowestHpFriendly (float range, uint32 minHPDiff=1)
 
std::list< Creature * > DoFindFriendlyCC (float range)
 
std::list< Creature * > DoFindFriendlyMissingBuff (float range, uint32 spellId)
 
PlayerGetPlayerAtMinimumRange (float minRange)
 
CreatureDoSpawnCreature (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=0s, uint32 uniqueId=0)
 
void ScheduleTimedEvent (Milliseconds timerMax, std::function< void()> exec, Milliseconds repeatMin, Milliseconds repeatMax=0s, 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 >
const T & DUNGEON_MODE (const T &normal5, const T &heroic10) const
 
template<class T >
const T & RAID_MODE (const T &normal10, const T &normal25) const
 
template<class T >
const T & RAID_MODE (const T &normal10, const T &normal25, const T &heroic10, const T &heroic25) const
 
PlayerSelectTargetFromPlayerList (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=0s)
 Causes the creature to talk/say the text assigned to their entry in the creature_text database table. More...
 
void Talk (uint8 id, Milliseconds delay)
 
WorldObjectGetSummoner () const
 Returns the summoner creature/object, if the creature is a temporary summon. More...
 
 CreatureAI (Creature *creature)
 
 ~CreatureAI () override
 
void MoveCircleChecks ()
 
void MoveBackwardsChecks ()
 
void MoveInLineOfSight_Safe (Unit *who)
 == Reactions At ================================= More...
 
void TriggerAlert (Unit const *who) const
 
virtual bool CanRespawn ()
 
virtual void EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER)
 
virtual void JustEngagedWith (Unit *)
 Called for reaction when initially engaged. More...
 
virtual void JustDied (Unit *)
 
virtual void KilledUnit (Unit *)
 
virtual void JustSummoned (Creature *)
 
virtual void IsSummonedBy (WorldObject *)
 
virtual void SummonedCreatureDespawn (Creature *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void SummonedCreatureDespawnAll ()
 
virtual void SummonedCreatureEvade (Creature *)
 
virtual void SpellHit (Unit *, SpellInfo const *)
 
virtual void SpellHitTarget (Unit *, SpellInfo const *)
 
virtual void AttackedBy (Unit *)
 
virtual bool IsEscorted ()
 
virtual void JustRespawned ()
 
virtual void MovementInform (uint32, uint32)
 
virtual void PathEndReached (uint32)
 
void OnCharmed (bool apply) override
 Called when unit is charmed. More...
 
virtual void JustReachedHome ()
 
void DoZoneInCombat (Creature *creature=nullptr, float maxRangeToNearestTarget=250.0f)
 
virtual void ReceiveEmote (Player *, uint32)
 
virtual void OwnerAttackedBy (Unit *)
 
virtual void OwnerAttacked (Unit *)
 
virtual void CorpseRemoved (uint32 &)
 == Triggered Actions Requested ================== More...
 
virtual void PassengerBoarded (Unit *, int8, bool)
 == Fields ======================================= More...
 
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 ()
 
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)
 
- Public Member Functions inherited from UnitAI
 UnitAI (Unit *unit)
 
virtual ~UnitAI ()
 
virtual bool CanAIAttack (Unit const *) const
 
virtual void AttackStart (Unit *)
 
virtual void UpdateAI (uint32)=0
 Use to start attacking a target. Called just before JustEngagedWith() More...
 
virtual void InitializeAI ()
 
virtual void Reset ()
 
virtual void OnCharmed (bool apply)=0
 Called when unit is charmed. More...
 
virtual void DoAction (int32)
 
virtual uint32 GetData (uint32) const
 
virtual void SetData (uint32, uint32)
 
virtual void SetGUID (ObjectGuid, int32=0)
 
virtual ObjectGuid GetGUID (int32=0) const
 
UnitSelectTarget (SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
 
template<class PREDICATE >
UnitSelectTarget (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: More...
 
template<class PREDICATE >
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectTargetMethod targetType, uint32 position, PREDICATE const &predicate)
 
virtual void JustEnteredCombat (Unit *)
 Called when the unit enters combat. More...
 
virtual void JustExitedCombat ()
 Called when the unit leaves combat. More...
 
virtual void DamageDealt (Unit *, uint32 &, DamageEffectType)
 Called at any Damage to any victim (before damage apply) More...
 
virtual void DamageTaken (Unit *, uint32 &, DamageEffectType, SpellSchoolMask)
 Called at any Damage from any attacker (before damage apply) More...
 
virtual void HealReceived (Unit *, uint32 &)
 Called when the creature receives heal. More...
 
virtual void OnPowerUpdate (Powers, int32, int32, uint32)
 Called when the creature power updates. More...
 
virtual void HealDone (Unit *, uint32 &)
 Called when the unit heals. More...
 
virtual void OnCalculateMeleeDamageReceived (uint32 &, Unit *)
 Called during damage calculations. More...
 
virtual void OnCalculateSpellDamageReceived (int32 &, Unit *)
 
virtual void OnCalculatePeriodicTickReceived (uint32 &, Unit *)
 Called during calculation when receiving periodic healing or damage (DoT or HoT) More...
 
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. More...
 
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)
 Cast the spell on a random unit from the threat list. More...
 
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. More...
 
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. More...
 
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

EventMap events
 
SummonList summons
 
ObjectGuid playerGUID
 
ObjectGuid playerGUID2
 
uint32 currentQuest
 
- Public Attributes inherited from ScriptedAI
Creatureme
 

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 AISpellInfoTypeAISpellInfo
 
- Protected Member Functions inherited from CreatureAI
bool UpdateVictim ()
 
bool UpdateVictimWithGaze ()
 
void SetGazeOn (Unit *target)
 
CreatureDoSummon (uint32 entry, Position const &pos, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
CreatureDoSummon (uint32 entry, WorldObject *obj, float radius=5.0f, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
CreatureDoSummonFlyer (uint32 entry, WorldObject *obj, float flightZ, float radius=5.0f, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
virtual void MoveInLineOfSight (Unit *)
 
bool _EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER)
 
- Protected Attributes inherited from CreatureAI
Creature *const me
 
EventMap events
 
TaskScheduler scheduler
 
CreatureBoundary const * _boundary
 
bool _negateBoundary
 
- Protected Attributes inherited from UnitAI
Unit *const me
 

Detailed Description

Constructor & Destructor Documentation

◆ npc_battle_at_valhalasAI()

npc_battle_at_valhalas::npc_battle_at_valhalasAI::npc_battle_at_valhalasAI ( Creature creature)
inline
107 : ScriptedAI(creature), summons(me)
108 {
109 }
Definition: ScriptedCreature.h:190
Creature * me
Definition: ScriptedCreature.h:280
SummonList summons
Definition: zone_icecrown.cpp:112

Member Function Documentation

◆ CheckSummons()

void npc_battle_at_valhalas::npc_battle_at_valhalasAI::CheckSummons ( )
inline
178 {
179 bool allow = true;
180 for (ObjectGuid const& guid : summons)
181 if (Creature* cr = ObjectAccessor::GetCreature(*me, guid))
182 if (cr->IsAlive())
183 allow = false;
184
185 if (allow)
186 {
187 uint32 quest = currentQuest;
189 {
190 switch (quest)
191 {
193 me->Yell("$N has defeated the fallen heroes of Valhalas battles past. This is only a beginning, but it will suffice.", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID));
194 break;
196 me->Yell("Khit'rix the Dark Master has been defeated by $N and his band of companions. Let the next challenge be issued!", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID));
197 break;
198 case QUEST_BFV_SIGRID:
199 me->Yell("$N has defeated Sigrid Iceborn for a second time. Well, this time he did it with the help of his friends, but a win is a win!", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID));
200 break;
202 me->Yell("The horror known as Carnage is no more. Could it be that $N is truly worthy of battle in Valhalas? We shall see.", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID));
203 break;
204 case QUEST_BFV_THANE:
205 me->Yell("Thane Banahogg the Deathblow has fallen to $N and his fighting companions. He has but one challenge ahead of him. Who will it be?", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID));
206 break;
207 case QUEST_BFV_FINAL:
208 me->Yell("The unthinkable has happened... $N has slain Prince Sandoval!", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID));
209 break;
210 }
211 player->GroupEventHappens(quest, player);
212 }
215 if (quest == QUEST_BFV_FINAL)
216 events.ScheduleEvent(EVENT_VALHALAS_THIRD, 7s);
217 }
218 else
219 {
220 uint32 quest = currentQuest;
222 {
223 if (!player->HasQuest(quest))
224 {
225 ResetData();
226 return;
227 }
228 }
229 }
230 }
std::uint32_t uint32
Definition: Define.h:107
events
Definition: boss_sartura.cpp:43
@ QUEST_BFV_FINAL
Definition: zone_icecrown.cpp:78
@ QUEST_BFV_CARNAGE
Definition: zone_icecrown.cpp:76
@ QUEST_BFV_DARK_MASTER
Definition: zone_icecrown.cpp:74
@ QUEST_BFV_FALLEN_HEROES
Definition: zone_icecrown.cpp:73
@ QUEST_BFV_SIGRID
Definition: zone_icecrown.cpp:75
@ EVENT_VALHALAS_THIRD
Definition: zone_icecrown.cpp:82
@ QUEST_BFV_THANE
Definition: zone_icecrown.cpp:77
@ LANG_UNIVERSAL
Definition: SharedDefines.h:735
Creature * GetCreature(WorldObject const &u, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:210
Player * GetPlayer(Map const *, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:220
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
Definition: CreatureAI.cpp:208
Definition: Creature.h:43
Definition: ObjectGuid.h:118
Definition: Player.h:1081
virtual void Yell(std::string_view text, Language language, WorldObject const *target=nullptr)
Definition: Unit.cpp:21144
void ResetData()
Definition: zone_icecrown.cpp:122
uint32 currentQuest
Definition: zone_icecrown.cpp:115
ObjectGuid playerGUID
Definition: zone_icecrown.cpp:113
ObjectGuid playerGUID2
Definition: zone_icecrown.cpp:114

References currentQuest, CreatureAI::EnterEvadeMode(), EVENT_VALHALAS_THIRD, ObjectAccessor::GetCreature(), ObjectAccessor::GetPlayer(), LANG_UNIVERSAL, ScriptedAI::me, playerGUID, playerGUID2, QUEST_BFV_CARNAGE, QUEST_BFV_DARK_MASTER, QUEST_BFV_FALLEN_HEROES, QUEST_BFV_FINAL, QUEST_BFV_SIGRID, QUEST_BFV_THANE, ResetData(), summons, and Unit::Yell().

Referenced by UpdateAI().

◆ JustSummoned()

void npc_battle_at_valhalas::npc_battle_at_valhalasAI::JustSummoned ( Creature creature)
inlineoverridevirtual

Reimplemented from ScriptedAI.

132 {
133 summons.Summon(creature);
134 if (creature->GetEntry() != NPC_PRINCE)
136 creature->AI()->AttackStart(player);
137 }
@ NPC_PRINCE
Definition: zone_icecrown.cpp:97
virtual void AttackStart(Unit *)
Definition: UnitAI.cpp:27
void Summon(Creature const *summon)
Definition: ScriptedCreature.h:88
CreatureAI * AI() const
Definition: Creature.h:140
uint32 GetEntry() const
Definition: Object.h:115

References Creature::AI(), UnitAI::AttackStart(), Object::GetEntry(), ObjectAccessor::GetPlayer(), ScriptedAI::me, NPC_PRINCE, playerGUID, SummonList::Summon(), and summons.

◆ PrepareSummons()

void npc_battle_at_valhalas::npc_battle_at_valhalasAI::PrepareSummons ( )
inline
140 {
141 switch (currentQuest)
142 {
144 me->SummonCreature(NPC_ELDRETH, 8245.5f, 3522.7f, 627.67f, 3.11f, TEMPSUMMON_MANUAL_DESPAWN, 30000);
145 me->SummonCreature(NPC_GENESS, 8217.45f, 3546.0f, 628.20f, 4.41f, TEMPSUMMON_MANUAL_DESPAWN, 30000);
146 me->SummonCreature(NPC_JHADRAS, 8179.99f, 3523.72f, 628.1f, 5.95f, TEMPSUMMON_MANUAL_DESPAWN, 30000);
147 me->SummonCreature(NPC_MASUD, 8184.97f, 3491.2f, 625.33f, 0.6f, TEMPSUMMON_MANUAL_DESPAWN, 30000);
148 me->SummonCreature(NPC_RITH, 8213.5f, 3478.5f, 626.79f, 1.56f, TEMPSUMMON_MANUAL_DESPAWN, 30000);
149 me->SummonCreature(NPC_TALLA, 8238.30f, 3485.5f, 628.5f, 2.157f, TEMPSUMMON_MANUAL_DESPAWN, 30000);
150 break;
152 me->SummonCreature(NPC_DARK_MASTER, 8184.97f, 3491.2f, 625.33f, 0.6f, TEMPSUMMON_MANUAL_DESPAWN, 30000);
153 break;
154 case QUEST_BFV_SIGRID:
155 me->SummonCreature(NPC_SIGRID, 8238.30f, 3485.5f, 628.5f, 2.157f, TEMPSUMMON_MANUAL_DESPAWN, 30000);
156 break;
158 me->SummonCreature(NPC_CARNAGE, 8179.99f, 3523.72f, 628.1f, 5.95f, TEMPSUMMON_MANUAL_DESPAWN, 30000);
159 break;
160 case QUEST_BFV_THANE:
161 me->SummonCreature(NPC_THANE, 8217.45f, 3546.0f, 628.20f, 4.41f, TEMPSUMMON_MANUAL_DESPAWN, 30000);
162 break;
163 case QUEST_BFV_FINAL:
164 me->SummonCreature(NPC_PRINCE, 8245.5f, 3522.7f, 627.67f, 3.11f, TEMPSUMMON_MANUAL_DESPAWN, 30000);
165 break;
166 }
167 }
@ NPC_GENESS
Definition: zone_icecrown.cpp:87
@ NPC_JHADRAS
Definition: zone_icecrown.cpp:88
@ NPC_DARK_MASTER
Definition: zone_icecrown.cpp:93
@ NPC_TALLA
Definition: zone_icecrown.cpp:91
@ NPC_RITH
Definition: zone_icecrown.cpp:90
@ NPC_MASUD
Definition: zone_icecrown.cpp:89
@ NPC_THANE
Definition: zone_icecrown.cpp:96
@ NPC_SIGRID
Definition: zone_icecrown.cpp:94
@ NPC_ELDRETH
Definition: zone_icecrown.cpp:86
@ NPC_CARNAGE
Definition: zone_icecrown.cpp:95
@ TEMPSUMMON_MANUAL_DESPAWN
Definition: Object.h:53
TempSummon * SummonCreature(uint32 id, const Position &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false) const
Definition: Object.cpp:2366

References currentQuest, ScriptedAI::me, NPC_CARNAGE, NPC_DARK_MASTER, NPC_ELDRETH, NPC_GENESS, NPC_JHADRAS, NPC_MASUD, NPC_PRINCE, NPC_RITH, NPC_SIGRID, NPC_TALLA, NPC_THANE, QUEST_BFV_CARNAGE, QUEST_BFV_DARK_MASTER, QUEST_BFV_FALLEN_HEROES, QUEST_BFV_FINAL, QUEST_BFV_SIGRID, QUEST_BFV_THANE, WorldObject::SummonCreature(), and TEMPSUMMON_MANUAL_DESPAWN.

Referenced by UpdateAI().

◆ Reset()

void npc_battle_at_valhalas::npc_battle_at_valhalasAI::Reset ( )
inlineoverridevirtual

Reimplemented from ScriptedAI.

118 {
119 ResetData();
120 }

References ResetData().

◆ ResetData()

void npc_battle_at_valhalas::npc_battle_at_valhalasAI::ResetData ( )
inline
123 {
124 events.Reset();
127 currentQuest = 0;
129 }
@ UNIT_NPC_FLAG_QUESTGIVER
Definition: UnitDefines.h:295
void DespawnAll(uint32 delay=0)
Definition: ScriptedCreature.cpp:71
void Clear()
Definition: ObjectGuid.h:138
void SetNpcFlag(NPCFlags flags)
Definition: Unit.h:726

References ObjectGuid::Clear(), currentQuest, SummonList::DespawnAll(), ScriptedAI::me, playerGUID, Unit::SetNpcFlag(), summons, and UNIT_NPC_FLAG_QUESTGIVER.

Referenced by CheckSummons(), npc_battle_at_valhalas::OnQuestAccept(), and Reset().

◆ StartBattle()

void npc_battle_at_valhalas::npc_battle_at_valhalasAI::StartBattle ( ObjectGuid  guid,
uint32  questId 
)
inline
170 {
171 events.ScheduleEvent(EVENT_VALHALAS_FIRST, 6s);
172 events.ScheduleEvent(EVENT_VALHALAS_CHECK_PLAYER, 30s);
173 currentQuest = questId;
174 playerGUID = guid;
175 }
@ EVENT_VALHALAS_FIRST
Definition: zone_icecrown.cpp:80
@ EVENT_VALHALAS_CHECK_PLAYER
Definition: zone_icecrown.cpp:83

References currentQuest, EVENT_VALHALAS_CHECK_PLAYER, EVENT_VALHALAS_FIRST, and playerGUID.

Referenced by npc_battle_at_valhalas::OnQuestAccept().

◆ UpdateAI()

void npc_battle_at_valhalas::npc_battle_at_valhalasAI::UpdateAI ( uint32  )
inlineoverridevirtual

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

Reimplemented from ScriptedAI.

233 {
234 events.Update(diff);
235 switch (events.ExecuteEvent())
236 {
238 {
239 switch (currentQuest)
240 {
242 events.ScheduleEvent(EVENT_VALHALAS_SECOND, 8s);
243 me->Yell("$N and comrades in arms have chosen to accept honorable combat within the sacred confines of Valhalas.", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID));
244 break;
246 events.ScheduleEvent(EVENT_VALHALAS_SECOND, 8s);
247 me->Yell("$N has accepted the challenge of Khit'rix the Dark Master. May the gods show mercy upon him for Khit'rix surely will not.", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID));
248 break;
249 case QUEST_BFV_SIGRID:
251 me->TextEmote("Circling Valhalas, Sigrid Iceborn approaches to seek her revenge!", nullptr, true);
252 break;
254 events.ScheduleEvent(EVENT_VALHALAS_SECOND, 8s);
255 me->Yell("From the bowels of the Underhalls comes Carnage. Brave and foolish $N has accepted the challenge. $N and his group stand ready to face the monstrosity.", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID));
256 break;
257 case QUEST_BFV_THANE:
258 events.ScheduleEvent(EVENT_VALHALAS_SECOND, 8s);
259 me->Yell("Thane Banahogg returns to Valhalas for the first time in ages to prove that the vrykul are the only beings worthy to fight within its sacred ring. Will $N prove him wrong?", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID));
260 break;
261 case QUEST_BFV_FINAL:
262 events.ScheduleEvent(EVENT_VALHALAS_SECOND, 8s);
263 me->Yell("From the depths of Icecrown Citadel, one of the Lich King's chosen comes to put an end to the existence of $N and his friends.", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID));
264 break;
265 }
266
269 break;
270 }
272 {
273 switch (currentQuest)
274 {
276 me->Yell("There can only be one outcome to such a battle: death for one side or the other. Let $n prove himself upon the bones of these outsiders who have fallen before!", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID));
277 me->TextEmote("The fallen heroes of Valhalas emerge from the ground to do battle once more!", nullptr, true);
278 break;
280 me->TextEmote("Khit'rix the Dark Master skitters into Valhalas from the southeast!", nullptr, true);
281 break;
283 me->TextEmote("Lumbering in from the south, the smell of Carnage precedes him!", nullptr, true);
284 break;
285 case QUEST_BFV_THANE:
286 me->TextEmote("Thane Banahogg appears upon the overlook to the southeast!", nullptr, true);
287 break;
288 case QUEST_BFV_FINAL:
289 me->Yell("Warriors of Jotunheim, I present to you, Blood Prince Sandoval!", LANG_UNIVERSAL);
290 me->TextEmote("Without warning, Prince Sandoval magically appears within Valhalas!", nullptr, true);
291 break;
292 }
293
295 break;
296 }
298 {
299 me->Yell("In defeating him, he and his fighting companions have proven themselves worthy of battle in this most sacred place of vrykul honor.", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID));
300 events.ScheduleEvent(EVENT_VALHALAS_THIRD + 2, 7s);
301 break;
302 }
304 {
305 me->Yell("ALL HAIL $N, CHAMPION OF VALHALAS! ", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID2));
306 break;
307 }
309 {
310 bool fail = true;
312 if (me->GetDistance(player) < 100.0f)
313 {
314 fail = false;
315 CheckSummons();
316 }
317
318 if (fail)
320
321 events.Repeat(5s);
322 break;
323 }
324 }
325 }
@ EVENT_VALHALAS_SECOND
Definition: zone_icecrown.cpp:81
void SetPosition(float x, float y, float z, float o)
Definition: Creature.cpp:3154
float GetDistance(WorldObject const *obj) const
Definition: Object.cpp:1256
float GetPositionZ() const
Definition: Position.h:118
float GetOrientation() const
Definition: Position.h:119
float GetPositionX() const
Definition: Position.h:116
float GetPositionY() const
Definition: Position.h:117
MotionMaster * GetMotionMaster()
Definition: Unit.h:1620
virtual void TextEmote(std::string_view text, WorldObject const *target=nullptr, bool isBossEmote=false)
Definition: Unit.cpp:21149
void MovePoint(uint32 id, const Position &pos, bool generatePath=true, bool forceDestination=true)
Definition: MotionMaster.h:213
void CheckSummons()
Definition: zone_icecrown.cpp:177
void PrepareSummons()
Definition: zone_icecrown.cpp:139

References CheckSummons(), currentQuest, CreatureAI::EnterEvadeMode(), EVENT_VALHALAS_CHECK_PLAYER, EVENT_VALHALAS_FIRST, EVENT_VALHALAS_SECOND, EVENT_VALHALAS_THIRD, WorldObject::GetDistance(), Unit::GetMotionMaster(), Position::GetOrientation(), ObjectAccessor::GetPlayer(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), LANG_UNIVERSAL, ScriptedAI::me, MotionMaster::MovePoint(), playerGUID, playerGUID2, PrepareSummons(), QUEST_BFV_CARNAGE, QUEST_BFV_DARK_MASTER, QUEST_BFV_FALLEN_HEROES, QUEST_BFV_FINAL, QUEST_BFV_SIGRID, QUEST_BFV_THANE, Creature::SetPosition(), Unit::TextEmote(), and Unit::Yell().

Member Data Documentation

◆ currentQuest

uint32 npc_battle_at_valhalas::npc_battle_at_valhalasAI::currentQuest

◆ events

EventMap npc_battle_at_valhalas::npc_battle_at_valhalasAI::events

◆ playerGUID

ObjectGuid npc_battle_at_valhalas::npc_battle_at_valhalasAI::playerGUID

◆ playerGUID2

ObjectGuid npc_battle_at_valhalas::npc_battle_at_valhalasAI::playerGUID2

Referenced by CheckSummons(), and UpdateAI().

◆ summons

SummonList npc_battle_at_valhalas::npc_battle_at_valhalasAI::summons