AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
boss_twin_valkyrAI Struct Reference
Inheritance diagram for boss_twin_valkyrAI:
ScriptedAI CreatureAI UnitAI boss_eydis::boss_eydisAI boss_fjola::boss_fjolaAI

Public Member Functions

 boss_twin_valkyrAI (Creature *pCreature)
 
void DoAction (int32 a) override
 
CreatureGetSister ()
 
void JustEngagedWith (Unit *) override
 Called for reaction when initially engaged. More...
 
void JustReachedHome () override
 
void myDoMeleeAttackIfReady ()
 
void UpdateSharedHealth ()
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith() More...
 
void JustDied (Unit *) override
 
void JustSummoned (Creature *s) override
 
void SummonedCreatureDespawn (Creature *s) override
 
void KilledUnit (Unit *who) override
 
void EnterEvadeMode (EvadeReason) 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) 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

InstanceScriptpInstance
 
SummonList summons
 
EventMap events
 
int32 LastSynchroHP
 
uint8 SpecialMask
 
- 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

◆ boss_twin_valkyrAI()

boss_twin_valkyrAI::boss_twin_valkyrAI ( Creature pCreature)
inline
108 : ScriptedAI(pCreature), summons(me)
109 {
110 pInstance = pCreature->GetInstanceScript();
115 SpecialMask = 0;
117
118 events.Reset();
119 if (me->GetEntry() == NPC_LIGHTBANE )
120 {
121 if (pInstance)
123
124 // special events here
125 events.RescheduleEvent(EVENT_BERSERK, IsHeroic() ? 6min : 10min);
126 events.RescheduleEvent(EVENT_SUMMON_BALLS_1, 10s, 15s);
127 events.RescheduleEvent(EVENT_SPECIAL, 45s);
128 }
129 events.RescheduleEvent(EVENT_SPELL_SPIKE, 5s, 8s);
130 if (IsHeroic())
131 events.RescheduleEvent(EVENT_SPELL_TOUCH, 10s, 25s, 1);
132
133 me->SetCanFly(true);
134 me->SetDisableGravity(true);
135 }
std::int32_t int32
Definition: Define.h:103
events
Definition: boss_sartura.cpp:43
@ EVENT_SUMMON_BALLS_1
Definition: boss_twin_valkyr.cpp:97
@ EVENT_SPECIAL
Definition: boss_twin_valkyr.cpp:102
@ EVENT_SPELL_SPIKE
Definition: boss_twin_valkyr.cpp:100
@ EVENT_SPELL_TOUCH
Definition: boss_twin_valkyr.cpp:101
@ EVENT_BERSERK
Definition: boss_twin_valkyr.cpp:96
@ NPC_LIGHTBANE
Definition: trial_of_the_crusader.h:184
@ ACHIEVEMENT_TIMED_TYPE_EVENT
Definition: DBCEnums.h:110
@ IMMUNITY_STATE
Definition: SharedDefines.h:1395
@ SPELL_AURA_HASTE_SPELLS
Definition: SpellAuraDefines.h:279
@ UNIT_MOD_DAMAGE_OFFHAND
Definition: Unit.h:166
@ REACT_PASSIVE
Definition: Unit.h:548
@ OFF_ATTACK
Definition: Unit.h:210
@ TOTAL_PCT
Definition: Unit.h:129
Definition: ScriptedCreature.h:190
bool IsHeroic() const
Definition: ScriptedCreature.h:379
Creature * me
Definition: ScriptedCreature.h:280
bool SetDisableGravity(bool disable, bool packetOnly=false, bool updateAnimationTier=true) override
Enable or disable the creature's fly mode by adding or removing: MOVEMENTFLAG_FLYING....
Definition: Creature.cpp:3205
bool SetCanFly(bool enable, bool packetOnly=false) override
Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pre...
Definition: Creature.cpp:3290
void SetReactState(ReactStates state)
A creature can have 3 ReactStates : Agressive, Passive, Neutral.
Definition: Creature.h:94
uint32 GetEntry() const
Definition: Object.h:115
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1203
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType=SPELL_BLOCK_TYPE_ALL)
Definition: Unit.cpp:13389
uint32 GetMaxHealth() const
Definition: Unit.h:1030
virtual void UpdateDamagePhysical(WeaponAttackType attType)
Definition: StatSystem.cpp:60
void SetModifierValue(UnitMods unitMod, UnitModifierType modifierType, float value)
Definition: Unit.h:1013
void DoStopTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
Definition: InstanceScript.cpp:656
InstanceScript * pInstance
Definition: boss_twin_valkyr.cpp:137
uint8 SpecialMask
Definition: boss_twin_valkyr.cpp:141
int32 LastSynchroHP
Definition: boss_twin_valkyr.cpp:140
SummonList summons
Definition: boss_twin_valkyr.cpp:138

References ACHIEVEMENT_TIMED_TYPE_EVENT, Unit::ApplySpellImmune(), InstanceScript::DoStopTimedAchievement(), EVENT_BERSERK, EVENT_SPECIAL, EVENT_SPELL_SPIKE, EVENT_SPELL_TOUCH, EVENT_SUMMON_BALLS_1, Object::GetEntry(), WorldObject::GetInstanceScript(), Unit::GetMaxHealth(), IMMUNITY_STATE, ScriptedAI::IsHeroic(), LastSynchroHP, ScriptedAI::me, NPC_LIGHTBANE, OFF_ATTACK, pInstance, REACT_PASSIVE, Creature::SetCanFly(), Creature::SetDisableGravity(), Unit::SetModifierValue(), Creature::SetReactState(), SpecialMask, SPELL_AURA_HASTE_SPELLS, TOTAL_PCT, UNIT_MOD_DAMAGE_OFFHAND, and Unit::UpdateDamagePhysical().

Member Function Documentation

◆ DoAction()

void boss_twin_valkyrAI::DoAction ( int32  a)
inlineoverridevirtual

Reimplemented from UnitAI.

144 {
145 switch (a)
146 {
147 case -1:
149 if (pInstance && me->GetEntry() == NPC_LIGHTBANE )
150 {
151 uint32 essenceId1 = 0, empoweredId1 = 0, touchId1 = 0, essenceId2 = 0, empoweredId2 = 0, touchId2 = 0;
152 switch (me->GetMap()->GetDifficulty())
153 {
154 case 0:
155 essenceId1 = 65684;
156 empoweredId1 = 65724;
157 touchId1 = 65950;
158 essenceId2 = 65686;
159 empoweredId2 = 65748;
160 touchId2 = 66001;
161 break;
162 case 1:
163 essenceId1 = 67176;
164 empoweredId1 = 67213;
165 touchId1 = 67296;
166 essenceId2 = 67222;
167 empoweredId2 = 67216;
168 touchId2 = 67281;
169 break;
170 case 2:
171 essenceId1 = 67177;
172 empoweredId1 = 67214;
173 touchId1 = 67297;
174 essenceId2 = 67223;
175 empoweredId2 = 67217;
176 touchId2 = 67282;
177 break;
178 case 3:
179 essenceId1 = 67178;
180 empoweredId1 = 67215;
181 touchId1 = 67298;
182 essenceId2 = 67224;
183 empoweredId2 = 67218;
184 touchId2 = 67283;
185 break;
186 }
193 }
194 break;
195 case -3:
196 me->SetCanDualWield(true);
198 events.RescheduleEvent(EVENT_REMOVE_DUAL_WIELD, 15s);
199 break;
200 }
201 }
std::uint32_t uint32
Definition: Define.h:107
@ SPELL_TWIN_POWER
Definition: boss_twin_valkyr.cpp:90
@ EVENT_REMOVE_DUAL_WIELD
Definition: boss_twin_valkyr.cpp:103
void DespawnAll(uint32 delay=0)
Definition: ScriptedCreature.cpp:71
void SetCanDualWield(bool value) override
Definition: Creature.cpp:1792
Map * GetMap() const
Definition: Object.h:536
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:1167
void DoRemoveAurasDueToSpellOnPlayers(uint32 spell)
Definition: InstanceScript.cpp:665
Difficulty GetDifficulty() const
Definition: Map.h:441

References Unit::CastSpell(), SummonList::DespawnAll(), InstanceScript::DoRemoveAurasDueToSpellOnPlayers(), EVENT_REMOVE_DUAL_WIELD, Map::GetDifficulty(), Object::GetEntry(), WorldObject::GetMap(), ScriptedAI::me, NPC_LIGHTBANE, pInstance, Creature::SetCanDualWield(), SPELL_TWIN_POWER, and summons.

Referenced by JustDied(), and UpdateAI().

◆ EnterEvadeMode()

void boss_twin_valkyrAI::EnterEvadeMode ( EvadeReason  )
inlineoverridevirtual

Reimplemented from CreatureAI.

511 {
512 if (pInstance)
514 }
@ TYPE_FAILED
Definition: trial_of_the_crusader.h:33
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:52

References pInstance, ZoneScript::SetData(), and TYPE_FAILED.

◆ GetSister()

Creature * boss_twin_valkyrAI::GetSister ( )
inline
204 {
206 }
@ NPC_DARKBANE
Definition: trial_of_the_crusader.h:185
Creature * GetCreature(WorldObject const &u, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:210
ObjectGuid GetGuidData(uint32 type) const override
Definition: InstanceScript.cpp:98

References ObjectAccessor::GetCreature(), Object::GetEntry(), InstanceScript::GetGuidData(), ScriptedAI::me, NPC_DARKBANE, NPC_LIGHTBANE, and pInstance.

Referenced by JustDied(), JustEngagedWith(), KilledUnit(), UpdateAI(), and UpdateSharedHealth().

◆ JustDied()

void boss_twin_valkyrAI::JustDied ( Unit )
inlineoverridevirtual

Reimplemented from ScriptedAI.

474 {
475 DoAction(-1);
477 if (pInstance)
478 {
481 }
482 if (Creature* twin = GetSister())
483 if (twin->IsAlive())
484 {
485 twin->SetHealth(1);
486 Unit::Kill(twin, twin);
487 }
488 }
Talk
Definition: hyjal.cpp:82
@ SAY_DEATH
Definition: boss_twin_valkyr.cpp:41
@ SPELL_POWERING_UP
Definition: boss_twin_valkyr.cpp:71
@ TYPE_VALKYR
Definition: trial_of_the_crusader.h:43
@ DONE
Definition: InstanceScript.h:60
Definition: Creature.h:43
static void Kill(Unit *killer, Unit *victim, bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
Definition: Unit.cpp:17702
Creature * GetSister()
Definition: boss_twin_valkyr.cpp:203
void DoAction(int32 a) override
Definition: boss_twin_valkyr.cpp:143

References DoAction(), DONE, InstanceScript::DoRemoveAurasDueToSpellOnPlayers(), GetSister(), Unit::Kill(), pInstance, SAY_DEATH, ZoneScript::SetData(), SPELL_POWERING_UP, and TYPE_VALKYR.

◆ JustEngagedWith()

void boss_twin_valkyrAI::JustEngagedWith ( Unit )
inlineoverridevirtual

Called for reaction when initially engaged.

Reimplemented from ScriptedAI.

215 {
216 me->setActive(true);
219 if (Creature* twin = GetSister())
220 if (!twin->IsInCombat())
221 if (Unit* target = twin->SelectNearestTarget(200.0f))
222 twin->AI()->AttackStart(target);
223
226
227 if (pInstance && me->GetEntry() == NPC_LIGHTBANE )
229 }
@ SAY_AGGRO
Definition: boss_twin_valkyr.cpp:33
@ SPELL_DARK_SURGE
Definition: boss_twin_valkyr.cpp:84
@ SPELL_LIGHT_SURGE
Definition: boss_twin_valkyr.cpp:77
void DoZoneInCombat(Creature *creature=nullptr, float maxRangeToNearestTarget=250.0f)
Definition: CreatureAI.cpp:106
void LowerPlayerDamageReq(uint32 unDamage, bool damagedByPlayer=true)
Definition: Creature.cpp:3806
void setActive(bool isActiveObject)
Definition: Object.cpp:1094
Definition: Unit.h:630
void DoStartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
Definition: InstanceScript.cpp:647

References ACHIEVEMENT_TIMED_TYPE_EVENT, Unit::CastSpell(), InstanceScript::DoStartTimedAchievement(), CreatureAI::DoZoneInCombat(), Object::GetEntry(), Unit::GetMaxHealth(), GetSister(), Creature::LowerPlayerDamageReq(), ScriptedAI::me, NPC_LIGHTBANE, pInstance, SAY_AGGRO, WorldObject::setActive(), SPELL_DARK_SURGE, and SPELL_LIGHT_SURGE.

◆ JustReachedHome()

void boss_twin_valkyrAI::JustReachedHome ( )
inlineoverridevirtual

Reimplemented from CreatureAI.

232 {
233 me->setActive(false);
234 }

References ScriptedAI::me, and WorldObject::setActive().

◆ JustSummoned()

void boss_twin_valkyrAI::JustSummoned ( Creature s)
inlineoverridevirtual

Reimplemented from ScriptedAI.

Reimplemented in boss_eydis::boss_eydisAI, and boss_fjola::boss_fjolaAI.

491 {
492 summons.Summon(s);
493 }
void Summon(Creature const *summon)
Definition: ScriptedCreature.h:88

References SummonList::Summon(), and summons.

Referenced by boss_eydis::boss_eydisAI::boss_eydisAI(), boss_fjola::boss_fjolaAI::boss_fjolaAI(), and UpdateAI().

◆ KilledUnit()

void boss_twin_valkyrAI::KilledUnit ( Unit who)
inlineoverridevirtual

Reimplemented from ScriptedAI.

501 {
502 if (who->IsPlayer())
503 {
505 if (Creature* twin = GetSister())
506 twin->AI()->Talk(SAY_KILL_PLAYER);
507 }
508 }
@ SAY_KILL_PLAYER
Definition: boss_twin_valkyr.cpp:39
bool IsPlayer() const
Definition: Object.h:200

References GetSister(), Object::IsPlayer(), and SAY_KILL_PLAYER.

◆ myDoMeleeAttackIfReady()

void boss_twin_valkyrAI::myDoMeleeAttackIfReady ( )
inline
237 {
239 return;
240
242 return;
243
244 Unit* victim = me->GetVictim();
245 if (!victim || !victim->IsInWorld())
246 return;
247
248 float allowedDist = std::sqrt(MELEE_RANGE * MELEE_RANGE + 6.0f * 6.0f);
249 if (!me->IsWithinMeleeRange(victim, allowedDist))
250 return;
251
252 if (me->isAttackReady())
253 {
254 me->AttackerStateUpdate(victim);
256 }
257
259 {
262 }
263 }
#define MELEE_RANGE
Definition: ObjectDefines.h:49
@ UNIT_STATE_CASTING
Definition: UnitDefines.h:164
void DoMeleeAttackIfReady()
Definition: UnitAI.cpp:39
bool IsInWorld() const
Definition: Object.h:107
bool haveOffhandWeapon() const
Definition: Unit.cpp:521
bool IsWithinMeleeRange(Unit const *obj, float dist=0.f) const
Definition: Unit.cpp:664
Unit * GetVictim() const
Definition: Unit.h:853
bool HasUnitState(const uint32 f) const
Definition: Unit.h:701
void AttackerStateUpdate(Unit *victim, WeaponAttackType attType=BASE_ATTACK, bool extra=false, bool ignoreCasting=false)
Definition: Unit.cpp:2565
bool isAttackReady(WeaponAttackType type=BASE_ATTACK) const
Definition: Unit.h:838
void resetAttackTimer(WeaponAttackType type=BASE_ATTACK)
Definition: Unit.cpp:642

References Unit::AttackerStateUpdate(), UnitAI::DoMeleeAttackIfReady(), Unit::GetVictim(), Unit::HasUnitState(), Unit::haveOffhandWeapon(), Unit::isAttackReady(), Object::IsInWorld(), Unit::IsWithinMeleeRange(), ScriptedAI::me, MELEE_RANGE, OFF_ATTACK, Unit::resetAttackTimer(), and UNIT_STATE_CASTING.

Referenced by UpdateAI().

◆ SummonedCreatureDespawn()

void boss_twin_valkyrAI::SummonedCreatureDespawn ( Creature s)
inlineoverridevirtual

Reimplemented from ScriptedAI.

496 {
497 summons.Despawn(s);
498 }
void Despawn(Creature const *summon)
Definition: ScriptedCreature.h:89

References SummonList::Despawn(), and summons.

◆ UpdateAI()

void boss_twin_valkyrAI::UpdateAI ( uint32  )
inlineoverridevirtual

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

Reimplemented from ScriptedAI.

283 {
284 if (!UpdateVictim())
285 return;
286
288 events.Update(diff);
289
291 return;
292
293 uint8 eventId = events.ExecuteEvent();
294
295 switch (eventId)
296 {
297 case 0:
298 break;
299 case EVENT_BERSERK:
300 me->CastSpell(me, SPELL_BERSERK, true);
302 if (Creature* twin = GetSister())
303 {
304 twin->CastSpell(twin, SPELL_BERSERK, true);
305 twin->AI()->Talk(SAY_BERSERK);
306 }
307
308 break;
312 {
313 uint8 count = 0;
314 if (IsHeroic())
315 count = eventId == EVENT_SUMMON_BALLS_3 ? 36 : 6;
316 else
317 count = eventId == EVENT_SUMMON_BALLS_3 ? 24 : 4;
318 for( uint8 i = 0; i < count; ++i )
319 {
320 float angle = rand_norm() * 2 * M_PI;
321 if (Creature* ball = me->SummonCreature((i % 2) ? NPC_CONCENTRATED_DARK : NPC_CONCENTRATED_LIGHT, Locs[LOC_CENTER].GetPositionX() + cos(angle) * 47.0f, Locs[LOC_CENTER].GetPositionY() + std::sin(angle) * 47.0f, Locs[LOC_CENTER].GetPositionZ() + 1.5f, 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1500))
323 }
324
325 switch (eventId)
326 {
328 events.RescheduleEvent(EVENT_SUMMON_BALLS_2, 8s);
329 break;
331 events.RescheduleEvent(EVENT_SUMMON_BALLS_3, 8s);
332 break;
334 events.RescheduleEvent(EVENT_SUMMON_BALLS_1, 15s);
335 break;
336 }
337 }
338 break;
341 events.Repeat(7s, 10s);
342 break;
344 {
345 uint32 essenceId = 0;
346 switch (me->GetEntry())
347 {
348 case NPC_LIGHTBANE:
349 switch (GetDifficulty())
350 {
351 case 0:
352 essenceId = 65684;
353 break;
354 case 1:
355 essenceId = 67176;
356 break;
357 case 2:
358 essenceId = 67177;
359 break;
360 case 3:
361 essenceId = 67178;
362 break;
363 }
364 break;
365 case NPC_DARKBANE:
366 switch (GetDifficulty())
367 {
368 case 0:
369 essenceId = 65686;
370 break;
371 case 1:
372 essenceId = 67222;
373 break;
374 case 2:
375 essenceId = 67223;
376 break;
377 case 3:
378 essenceId = 67224;
379 break;
380 }
381 break;
382 }
383
384 /*
385 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, essenceId))
386 me->CastSpell(target, me->GetEntry()==NPC_LIGHTBANE ? SPELL_LIGHT_TOUCH : SPELL_DARK_TOUCH, false);
387 events.RepeatEvent(urand(45000,50000));
388 */
389
390 GuidVector tList;
391 Map::PlayerList const& pList = me->GetMap()->GetPlayers();
392 if (pList.getSize())
393 {
394 for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr)
395 if (Player* plr = itr->GetSource())
396 if (Creature* sister = GetSister())
397 if ((!me->GetVictim() || me->GetVictim()->GetGUID() != plr->GetGUID()) && (!sister->GetVictim() || sister->GetVictim()->GetGUID() != plr->GetGUID()) && plr->HasAura(essenceId))
398 tList.push_back(plr->GetGUID());
399
400 if (!tList.empty())
401 if (Player* target = ObjectAccessor::GetPlayer(*me, tList[urand(0, tList.size() - 1)]))
402 {
404 events.Repeat(45s, 50s);
405 break;
406 }
407 }
408 events.Repeat(10s);
409 }
410 break;
411 case EVENT_SPECIAL:
412 {
413 uint8 s;
414 do s = urand(0, 3);
415 while( SpecialMask & (1 << s) && (SpecialMask & 0xF) != 0xF );
416 SpecialMask |= (1 << s);
417 switch (s)
418 {
419 case 0: // light vortex
420 me->CastSpell((Unit*)nullptr, SPELL_LIGHT_VORTEX, false);
423 if (Creature* twin = GetSister())
424 twin->AI()->Talk(SAY_LIGHT);
425 break;
426 case 1: // dark vortex
427 if (Creature* twin = GetSister())
428 {
429 twin->CastSpell((Unit*)nullptr, SPELL_DARK_VORTEX, false);
430 twin->AI()->Talk(EMOTE_VORTEX);
431 twin->AI()->Talk(SAY_NIGHT);
433 }
434 break;
435 case 2: // light pact
438 if (Creature* twin = GetSister())
439 {
440 twin->AI()->Talk(SAY_TWINK_PACT);
441 twin->AI()->DoAction(-3);
442 }
445 break;
446 case 3: // dark pact
447 if (Creature* twin = GetSister())
448 {
449 twin->AI()->Talk(EMOTE_TWINK_PACT);
450 twin->AI()->Talk(SAY_TWINK_PACT);
452 twin->CastSpell(twin, SPELL_DARK_SHIELD, true);
453 twin->CastSpell(twin, SPELL_DARK_TWIN_PACT, false);
454 DoAction(-3);
455 }
456 break;
457 }
458 if ((SpecialMask & 0xF) == 0xF )
459 SpecialMask = 0;
460 events.Repeat(45s);
461 events.DelayEventsToMax(15000, 1); // no touch of light/darkness during special abilities!
462 }
463 break;
465 me->SetCanDualWield(false);
466
467 break;
468 }
469
471 }
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44
double rand_norm()
Definition: Random.cpp:77
std::uint8_t uint8
Definition: Define.h:109
@ NPC_CONCENTRATED_DARK
Definition: boss_twin_valkyr.cpp:58
@ NPC_CONCENTRATED_LIGHT
Definition: boss_twin_valkyr.cpp:59
@ SAY_NIGHT
Definition: boss_twin_valkyr.cpp:34
@ EMOTE_TWINK_PACT
Definition: boss_twin_valkyr.cpp:37
@ SAY_LIGHT
Definition: boss_twin_valkyr.cpp:35
@ SAY_BERSERK
Definition: boss_twin_valkyr.cpp:40
@ SAY_TWINK_PACT
Definition: boss_twin_valkyr.cpp:38
@ EMOTE_VORTEX
Definition: boss_twin_valkyr.cpp:36
@ SPELL_LIGHT_VORTEX
Definition: boss_twin_valkyr.cpp:80
@ SPELL_LIGHT_TOUCH
Definition: boss_twin_valkyr.cpp:81
@ SPELL_LIGHT_TWIN_PACT
Definition: boss_twin_valkyr.cpp:79
@ SPELL_LIGHT_SHIELD
Definition: boss_twin_valkyr.cpp:78
@ SPELL_DARK_TOUCH
Definition: boss_twin_valkyr.cpp:88
@ SPELL_DARK_TWIN_SPIKE
Definition: boss_twin_valkyr.cpp:83
@ SPELL_DARK_VORTEX
Definition: boss_twin_valkyr.cpp:87
@ SPELL_DARK_TWIN_PACT
Definition: boss_twin_valkyr.cpp:86
@ SPELL_DARK_SHIELD
Definition: boss_twin_valkyr.cpp:85
@ SPELL_LIGHT_TWIN_SPIKE
Definition: boss_twin_valkyr.cpp:76
@ SPELL_BERSERK
Definition: boss_twin_valkyr.cpp:91
@ EVENT_SUMMON_BALLS_2
Definition: boss_twin_valkyr.cpp:98
@ EVENT_SUMMON_BALLS_3
Definition: boss_twin_valkyr.cpp:99
const Position Locs[]
Definition: trial_of_the_crusader.h:274
@ LOC_CENTER
Definition: trial_of_the_crusader.h:304
@ TEMPSUMMON_CORPSE_TIMED_DESPAWN
Definition: Object.h:51
std::vector< ObjectGuid > GuidVector
Definition: ObjectGuid.h:256
Player * GetPlayer(Map const *, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:220
uint32 getSize() const
Definition: LinkedList.h:115
Definition: LinkedList.h:139
bool UpdateVictim()
Definition: CreatureAI.cpp:280
Difficulty GetDifficulty() const
Definition: ScriptedCreature.h:382
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:112
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
float GetPositionX() const
Definition: Position.h:116
Definition: Player.h:1081
PlayerList const & GetPlayers() const
Definition: Map.h:484
Definition: MapRefMgr.h:26
iterator begin()
Definition: MapRefMgr.h:36
iterator end()
Definition: MapRefMgr.h:37
void UpdateSharedHealth()
Definition: boss_twin_valkyr.cpp:265
void JustSummoned(Creature *s) override
Definition: boss_twin_valkyr.cpp:490
void myDoMeleeAttackIfReady()
Definition: boss_twin_valkyr.cpp:236

References MapRefMgr::begin(), Unit::CastSpell(), DoAction(), EMOTE_TWINK_PACT, EMOTE_VORTEX, MapRefMgr::end(), EVENT_BERSERK, EVENT_REMOVE_DUAL_WIELD, EVENT_SPECIAL, EVENT_SPELL_SPIKE, EVENT_SPELL_TOUCH, EVENT_SUMMON_BALLS_1, EVENT_SUMMON_BALLS_2, EVENT_SUMMON_BALLS_3, ScriptedAI::GetDifficulty(), Object::GetEntry(), Object::GetGUID(), WorldObject::GetMap(), ObjectAccessor::GetPlayer(), Map::GetPlayers(), Position::GetPositionX(), GetSister(), LinkedListHead::getSize(), Unit::GetVictim(), Unit::HasUnitState(), ScriptedAI::IsHeroic(), JustSummoned(), LOC_CENTER, Locs, ScriptedAI::me, myDoMeleeAttackIfReady(), NPC_CONCENTRATED_DARK, NPC_CONCENTRATED_LIGHT, NPC_DARKBANE, NPC_LIGHTBANE, rand_norm(), SAY_BERSERK, SAY_LIGHT, SAY_NIGHT, SAY_TWINK_PACT, Creature::SetCanDualWield(), SpecialMask, SPELL_BERSERK, SPELL_DARK_SHIELD, SPELL_DARK_TOUCH, SPELL_DARK_TWIN_PACT, SPELL_DARK_TWIN_SPIKE, SPELL_DARK_VORTEX, SPELL_LIGHT_SHIELD, SPELL_LIGHT_TOUCH, SPELL_LIGHT_TWIN_PACT, SPELL_LIGHT_TWIN_SPIKE, SPELL_LIGHT_VORTEX, WorldObject::SummonCreature(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, UNIT_STATE_CASTING, UpdateSharedHealth(), CreatureAI::UpdateVictim(), and urand().

◆ UpdateSharedHealth()

void boss_twin_valkyrAI::UpdateSharedHealth ( )
inline
266 {
267 // lightbane synchronizes
268 if (me->GetEntry() == NPC_LIGHTBANE )
269 if (Creature* twin = GetSister())
270 if (twin->IsAlive() && me->IsAlive())
271 {
272 int32 d = CAST_AI(boss_twin_valkyrAI, twin->AI())->LastSynchroHP - (int32)twin->GetHealth();
273 int32 newhealth = (int32)me->GetHealth() - d;
274 if (newhealth <= 0)
275 newhealth = 1;
276 me->SetHealth( (uint32)newhealth );
277 twin->SetHealth(me->GetHealth());
278 CAST_AI(boss_twin_valkyrAI, twin->AI())->LastSynchroHP = (int32)twin->GetHealth();
279 }
280 }
#define CAST_AI(a, b)
Definition: UnitAI.h:26
bool IsAlive() const
Definition: Unit.h:1654
void SetHealth(uint32 val)
Definition: Unit.cpp:15478
uint32 GetHealth() const
Definition: Unit.h:1029
Definition: boss_twin_valkyr.cpp:107

References CAST_AI, Object::GetEntry(), Unit::GetHealth(), GetSister(), Unit::IsAlive(), ScriptedAI::me, NPC_LIGHTBANE, and Unit::SetHealth().

Referenced by UpdateAI().

Member Data Documentation

◆ events

EventMap boss_twin_valkyrAI::events

◆ LastSynchroHP

int32 boss_twin_valkyrAI::LastSynchroHP

Referenced by boss_twin_valkyrAI().

◆ pInstance

◆ SpecialMask

uint8 boss_twin_valkyrAI::SpecialMask

Referenced by boss_twin_valkyrAI(), and UpdateAI().

◆ summons

SummonList boss_twin_valkyrAI::summons