AzeorthCore 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 EnterCombat (Unit *) override
 
void JustReachedHome () override
 
void myDoMeleeAttackIfReady ()
 
void UpdateSharedHealth ()
 
void UpdateAI (uint32 diff) override
 
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
 
void UpdateAI (uint32 diff) override
 
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 EnterCombat (Unit *) override
 
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)
 Cast Spell. More...
 
void DoPlaySoundToSet (WorldObject *source, uint32 soundId)
 Play sound. More...
 
void DoPlayMusic (uint32 soundId, bool zone)
 
void DoResetThreat ()
 Reset Threat. More...
 
float DoGetThreat (Unit *unit)
 
void DoModifyThreatPercent (Unit *unit, int32 pct)
 Modify Unit Threat. More...
 
void DoTeleportPlayer (Unit *unit, float x, float y, float z, float o)
 Teleport player. More...
 
void DoTeleportAll (float x, float y, float z, float o)
 Teleport all. More...
 
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 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)
 
void SetCombatMovement (bool allowMovement)
 Set Combat Movement. More...
 
bool IsCombatMovementAllowed () const
 
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
 
- Public Member Functions inherited from CreatureAI
void Talk (uint8 id, WorldObject const *whisperTarget=nullptr)
 
 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 EnterCombat (Unit *)
 
virtual void JustDied (Unit *)
 
virtual void KilledUnit (Unit *)
 
virtual void JustSummoned (Creature *)
 
virtual void IsSummonedBy (Unit *)
 
virtual void SummonedCreatureDespawn (Creature *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void SummonedCreatureDespawnAll ()
 
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
 
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 *)
 
- 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
 
virtual void InitializeAI ()
 
virtual void Reset ()
 
virtual void OnCharmed (bool apply)=0
 
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, int32 aura=0)
 
template<class PREDICATE >
UnitSelectTarget (SelectTargetMethod targetType, uint32 position, PREDICATE const &predicate)
 
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectTargetMethod targetType, float dist=0.0f, bool playerOnly=false, int32 aura=0)
 
template<class PREDICATE >
void SelectTargetList (std::list< Unit * > &targetList, PREDICATE const &predicate, uint32 maxTargets, SelectTargetMethod targetType)
 
virtual void DamageDealt (Unit *, uint32 &, DamageEffectType)
 
virtual void DamageTaken (Unit *, uint32 &, DamageEffectType, SpellSchoolMask)
 
virtual void HealReceived (Unit *, uint32 &)
 
virtual void HealDone (Unit *, uint32 &)
 
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)
 
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)
 
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)
 
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
 
bool IsFleeing
 

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
 
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
109 : ScriptedAI(pCreature), summons(me)
110 {
111 pInstance = pCreature->GetInstanceScript();
116 SpecialMask = 0;
118
119 events.Reset();
120 if( me->GetEntry() == NPC_LIGHTBANE )
121 {
122 if( pInstance )
124
125 // special events here
126 events.RescheduleEvent(EVENT_BERSERK, IsHeroic() ? 360000 : 600000);
127 events.RescheduleEvent(EVENT_SUMMON_BALLS_1, urand(10000, 15000));
128 events.RescheduleEvent(EVENT_SPECIAL, 45000);
129 }
130 events.RescheduleEvent(EVENT_SPELL_SPIKE, urand(5000, 8000));
131 if( IsHeroic() )
132 events.RescheduleEvent(EVENT_SPELL_TOUCH, urand(10000, 25000), 1);
133
134 me->SetCanFly(true);
135 me->SetDisableGravity(true);
136 }
std::int32_t int32
Definition: Define.h:104
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44
@ OFF_ATTACK
Definition: Unit.h:397
@ UNIT_MOD_DAMAGE_OFFHAND
Definition: Unit.h:285
@ REACT_PASSIVE
Definition: Unit.h:1023
@ TOTAL_PCT
Definition: Unit.h:248
@ SPELL_AURA_HASTE_SPELLS
Definition: SpellAuraDefines.h:279
events
Definition: boss_sartura.cpp:43
@ EVENT_SUMMON_BALLS_1
Definition: boss_twin_valkyr.cpp:98
@ EVENT_SPECIAL
Definition: boss_twin_valkyr.cpp:103
@ EVENT_SPELL_SPIKE
Definition: boss_twin_valkyr.cpp:101
@ EVENT_SPELL_TOUCH
Definition: boss_twin_valkyr.cpp:102
@ EVENT_BERSERK
Definition: boss_twin_valkyr.cpp:97
@ NPC_LIGHTBANE
Definition: trial_of_the_crusader.h:183
@ ACHIEVEMENT_TIMED_TYPE_EVENT
Definition: DBCEnums.h:116
@ IMMUNITY_STATE
Definition: SharedDefines.h:1367
Definition: ScriptedCreature.h:177
bool IsHeroic() const
Definition: ScriptedCreature.h:355
Creature * me
Definition: ScriptedCreature.h:267
bool SetDisableGravity(bool disable, bool packetOnly=false, bool updateAnimationTier=true) override
Definition: Creature.cpp:3197
void SetReactState(ReactStates st)
Definition: Creature.h:88
bool SetCanFly(bool enable, bool packetOnly=false) override
Definition: Creature.cpp:3282
uint32 GetEntry() const
Definition: Object.h:109
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1194
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType=SPELL_BLOCK_TYPE_ALL)
Definition: Unit.cpp:14149
uint32 GetMaxHealth() const
Definition: Unit.h:1439
virtual void UpdateDamagePhysical(WeaponAttackType attType)
Definition: StatSystem.cpp:60
void SetModifierValue(UnitMods unitMod, UnitModifierType modifierType, float value)
Definition: Unit.h:2348
void DoStopTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
Definition: InstanceScript.cpp:475
InstanceScript * pInstance
Definition: boss_twin_valkyr.cpp:138
uint8 SpecialMask
Definition: boss_twin_valkyr.cpp:142
int32 LastSynchroHP
Definition: boss_twin_valkyr.cpp:141
SummonList summons
Definition: boss_twin_valkyr.cpp:139

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, Unit::UpdateDamagePhysical(), and urand().

Member Function Documentation

◆ DoAction()

void boss_twin_valkyrAI::DoAction ( int32  a)
inlineoverridevirtual

Reimplemented from UnitAI.

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

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().

◆ EnterCombat()

void boss_twin_valkyrAI::EnterCombat ( Unit )
inlineoverridevirtual

Reimplemented from ScriptedAI.

216 {
217 me->setActive(true);
220 if( Creature* twin = GetSister() )
221 if( !twin->IsInCombat() )
222 if( Unit* target = twin->SelectNearestTarget(200.0f) )
223 twin->AI()->AttackStart(target);
224
227
228 if( pInstance && me->GetEntry() == NPC_LIGHTBANE )
230 }
@ SAY_AGGRO
Definition: boss_twin_valkyr.cpp:33
@ SPELL_DARK_SURGE
Definition: boss_twin_valkyr.cpp:85
@ SPELL_LIGHT_SURGE
Definition: boss_twin_valkyr.cpp:78
Talk
Definition: boss_fathomlord_karathress.cpp:23
void DoZoneInCombat(Creature *creature=nullptr, float maxRangeToNearestTarget=250.0f)
Definition: CreatureAI.cpp:93
Definition: Creature.h:46
void LowerPlayerDamageReq(uint32 unDamage, bool damagedByPlayer=true)
Definition: Creature.cpp:3812
void setActive(bool isActiveObject)
Definition: Object.cpp:1087
Definition: Unit.h:1290
void DoStartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
Definition: InstanceScript.cpp:464
Creature * GetSister()
Definition: boss_twin_valkyr.cpp:204

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.

◆ EnterEvadeMode()

void boss_twin_valkyrAI::EnterEvadeMode ( EvadeReason  )
inlineoverridevirtual

Reimplemented from CreatureAI.

513 {
514 if( pInstance )
516 }
@ TYPE_FAILED
Definition: trial_of_the_crusader.h:32
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:53

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

◆ GetSister()

Creature * boss_twin_valkyrAI::GetSister ( )
inline
205 {
207 }
@ NPC_DARKBANE
Definition: trial_of_the_crusader.h:184
Creature * GetCreature(WorldObject const &u, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:215
ObjectGuid GetGuidData(uint32 type) const override
Definition: InstanceScript.cpp:93

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

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

◆ JustDied()

void boss_twin_valkyrAI::JustDied ( Unit )
inlineoverridevirtual

Reimplemented from ScriptedAI.

475 {
476 DoAction(-1);
478 if( pInstance )
479 {
482 }
483 if( Creature* twin = GetSister() )
484 if( twin->IsAlive() )
485 {
486 twin->SetHealth(1);
487 Unit::Kill(twin, twin);
488 }
489 }
@ DONE
Definition: InstanceScript.h:59
@ SAY_DEATH
Definition: boss_twin_valkyr.cpp:41
@ SPELL_POWERING_UP
Definition: boss_twin_valkyr.cpp:72
@ TYPE_VALKYR
Definition: trial_of_the_crusader.h:42
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:18608
void DoAction(int32 a) override
Definition: boss_twin_valkyr.cpp:144

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

◆ JustReachedHome()

void boss_twin_valkyrAI::JustReachedHome ( )
inlineoverridevirtual

Reimplemented from CreatureAI.

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

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.

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

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.

502 {
503 if( who->GetTypeId() == TYPEID_PLAYER )
504 {
506 Talk(id);
507 if( Creature* twin = GetSister() )
508 twin->AI()->Talk(id);
509 }
510 }
@ TYPEID_PLAYER
Definition: ObjectGuid.h:38
@ SAY_KILL_PLAYER_1
Definition: boss_twin_valkyr.cpp:39
@ SAY_KILL_PLAYER_2
Definition: boss_twin_valkyr.cpp:42
TypeID GetTypeId() const
Definition: Object.h:121

References GetSister(), Object::GetTypeId(), SAY_KILL_PLAYER_1, SAY_KILL_PLAYER_2, TYPEID_PLAYER, and urand().

◆ myDoMeleeAttackIfReady()

void boss_twin_valkyrAI::myDoMeleeAttackIfReady ( )
inline
238 {
240 return;
241
243 return;
244
245 Unit* victim = me->GetVictim();
246 if (!victim || !victim->IsInWorld())
247 return;
248
249 float allowedDist = std::sqrt(MELEE_RANGE * MELEE_RANGE + 6.0f * 6.0f);
250 if (!me->IsWithinMeleeRange(victim, allowedDist))
251 return;
252
253 if (me->isAttackReady())
254 {
255 me->AttackerStateUpdate(victim);
257 }
258
260 {
263 }
264 }
#define MELEE_RANGE
Definition: ObjectDefines.h:49
@ UNIT_STATE_CASTING
Definition: Unit.h:340
void DoMeleeAttackIfReady()
Definition: UnitAI.cpp:40
bool IsInWorld() const
Definition: Object.h:101
bool haveOffhandWeapon() const
Definition: Unit.cpp:670
bool IsWithinMeleeRange(Unit const *obj, float dist=0.f) const
Definition: Unit.cpp:864
Unit * GetVictim() const
Definition: Unit.h:1386
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1398
void AttackerStateUpdate(Unit *victim, WeaponAttackType attType=BASE_ATTACK, bool extra=false, bool ignoreCasting=false)
Definition: Unit.cpp:2930
bool isAttackReady(WeaponAttackType type=BASE_ATTACK) const
Definition: Unit.h:1343
void resetAttackTimer(WeaponAttackType type=BASE_ATTACK)
Definition: Unit.cpp:826

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.

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

References SummonList::Despawn(), and summons.

◆ UpdateAI()

void boss_twin_valkyrAI::UpdateAI ( uint32  diff)
inlineoverridevirtual

Reimplemented from ScriptedAI.

284 {
285 if( !UpdateVictim() )
286 return;
287
289 events.Update(diff);
290
292 return;
293
294 uint8 eventId = events.ExecuteEvent();
295
296 switch(eventId)
297 {
298 case 0:
299 break;
300 case EVENT_BERSERK:
301 me->CastSpell(me, SPELL_BERSERK, true);
303 if( Creature* twin = GetSister() )
304 {
305 twin->CastSpell(twin, SPELL_BERSERK, true);
306 twin->AI()->Talk(SAY_BERSERK);
307 }
308
309 break;
313 {
314 uint8 count = 0;
315 if( IsHeroic() )
316 count = eventId == EVENT_SUMMON_BALLS_3 ? 36 : 6;
317 else
318 count = eventId == EVENT_SUMMON_BALLS_3 ? 24 : 4;
319 for( uint8 i = 0; i < count; ++i )
320 {
321 float angle = rand_norm() * 2 * M_PI;
322 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) )
324 }
325
326 switch( eventId )
327 {
329 events.RescheduleEvent(EVENT_SUMMON_BALLS_2, 8000);
330 break;
332 events.RescheduleEvent(EVENT_SUMMON_BALLS_3, 8000);
333 break;
335 events.RescheduleEvent(EVENT_SUMMON_BALLS_1, 15000);
336 break;
337 }
338 }
339 break;
342 events.RepeatEvent(urand(7000, 10000));
343 break;
345 {
346 uint32 essenceId = 0;
347 switch( me->GetEntry() )
348 {
349 case NPC_LIGHTBANE:
350 switch( GetDifficulty() )
351 {
352 case 0:
353 essenceId = 65684;
354 break;
355 case 1:
356 essenceId = 67176;
357 break;
358 case 2:
359 essenceId = 67177;
360 break;
361 case 3:
362 essenceId = 67178;
363 break;
364 }
365 break;
366 case NPC_DARKBANE:
367 switch( GetDifficulty() )
368 {
369 case 0:
370 essenceId = 65686;
371 break;
372 case 1:
373 essenceId = 67222;
374 break;
375 case 2:
376 essenceId = 67223;
377 break;
378 case 3:
379 essenceId = 67224;
380 break;
381 }
382 break;
383 }
384
385 /*
386 if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, essenceId) )
387 me->CastSpell(target, me->GetEntry()==NPC_LIGHTBANE ? SPELL_LIGHT_TOUCH : SPELL_DARK_TOUCH, false);
388 events.RepeatEvent(urand(45000,50000));
389 */
390
391 GuidVector tList;
392 Map::PlayerList const& pList = me->GetMap()->GetPlayers();
393 if (pList.getSize())
394 {
395 for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr)
396 if (Player* plr = itr->GetSource())
397 if (Creature* sister = GetSister())
398 if ((!me->GetVictim() || me->GetVictim()->GetGUID() != plr->GetGUID()) && (!sister->GetVictim() || sister->GetVictim()->GetGUID() != plr->GetGUID()) && plr->HasAura(essenceId))
399 tList.push_back(plr->GetGUID());
400
401 if (!tList.empty())
402 if (Player* target = ObjectAccessor::GetPlayer(*me, tList[urand(0, tList.size() - 1)]))
403 {
405 events.RepeatEvent(urand(45000, 50000));
406 break;
407 }
408 }
409 events.RepeatEvent(10000);
410 }
411 break;
412 case EVENT_SPECIAL:
413 {
414 uint8 s;
415 do s = urand(0, 3);
416 while( SpecialMask & (1 << s) && (SpecialMask & 0xF) != 0xF );
417 SpecialMask |= (1 << s);
418 switch( s )
419 {
420 case 0: // light vortex
421 me->CastSpell((Unit*)nullptr, SPELL_LIGHT_VORTEX, false);
424 if( Creature* twin = GetSister() )
425 twin->AI()->Talk(SAY_LIGHT);
426 break;
427 case 1: // dark vortex
428 if( Creature* twin = GetSister() )
429 {
430 twin->CastSpell((Unit*)nullptr, SPELL_DARK_VORTEX, false);
431 twin->AI()->Talk(EMOTE_VORTEX);
432 twin->AI()->Talk(SAY_NIGHT);
434 }
435 break;
436 case 2: // light pact
439 if( Creature* twin = GetSister() )
440 {
441 twin->AI()->Talk(SAY_TWINK_PACT);
442 twin->AI()->DoAction(-3);
443 }
446 break;
447 case 3: // dark pact
448 if( Creature* twin = GetSister() )
449 {
450 twin->AI()->Talk(EMOTE_TWINK_PACT);
451 twin->AI()->Talk(SAY_TWINK_PACT);
453 twin->CastSpell(twin, SPELL_DARK_SHIELD, true);
454 twin->CastSpell(twin, SPELL_DARK_TWIN_PACT, false);
455 DoAction(-3);
456 }
457 break;
458 }
459 if( (SpecialMask & 0xF) == 0xF )
460 SpecialMask = 0;
461 events.RepeatEvent(45000);
462 events.DelayEventsToMax(15000, 1); // no touch of light/darkness during special abilities!
463 }
464 break;
466 me->SetCanDualWield(false);
467
468 break;
469 }
470
472 }
std::uint8_t uint8
Definition: Define.h:110
double rand_norm()
Definition: Random.cpp:77
@ TEMPSUMMON_CORPSE_TIMED_DESPAWN
Definition: Object.h:47
std::vector< ObjectGuid > GuidVector
Definition: ObjectGuid.h:258
@ NPC_CONCENTRATED_DARK
Definition: boss_twin_valkyr.cpp:59
@ NPC_CONCENTRATED_LIGHT
Definition: boss_twin_valkyr.cpp:60
@ 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:81
@ SPELL_LIGHT_TOUCH
Definition: boss_twin_valkyr.cpp:82
@ SPELL_LIGHT_TWIN_PACT
Definition: boss_twin_valkyr.cpp:80
@ SPELL_LIGHT_SHIELD
Definition: boss_twin_valkyr.cpp:79
@ SPELL_DARK_TOUCH
Definition: boss_twin_valkyr.cpp:89
@ SPELL_DARK_TWIN_SPIKE
Definition: boss_twin_valkyr.cpp:84
@ SPELL_DARK_VORTEX
Definition: boss_twin_valkyr.cpp:88
@ SPELL_DARK_TWIN_PACT
Definition: boss_twin_valkyr.cpp:87
@ SPELL_DARK_SHIELD
Definition: boss_twin_valkyr.cpp:86
@ SPELL_LIGHT_TWIN_SPIKE
Definition: boss_twin_valkyr.cpp:77
@ SPELL_BERSERK
Definition: boss_twin_valkyr.cpp:92
@ EVENT_SUMMON_BALLS_2
Definition: boss_twin_valkyr.cpp:99
@ EVENT_SUMMON_BALLS_3
Definition: boss_twin_valkyr.cpp:100
const Position Locs[]
Definition: trial_of_the_crusader.h:272
@ LOC_CENTER
Definition: trial_of_the_crusader.h:302
Player * GetPlayer(Map const *, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:225
uint32 getSize() const
Definition: LinkedList.h:115
Definition: LinkedList.h:139
bool UpdateVictim()
Definition: CreatureAI.cpp:268
Difficulty GetDifficulty() const
Definition: ScriptedCreature.h:358
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
TempSummon * SummonCreature(uint32 id, const Position &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0, SummonPropertiesEntry const *properties=nullptr) const
Definition: Object.cpp:2303
float GetPositionX() const
Definition: Position.h:117
Definition: Player.h:1046
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:266
void JustSummoned(Creature *s) override
Definition: boss_twin_valkyr.cpp:491
void myDoMeleeAttackIfReady()
Definition: boss_twin_valkyr.cpp:237

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
267 {
268 // lightbane synchronizes
269 if( me->GetEntry() == NPC_LIGHTBANE )
270 if( Creature* twin = GetSister() )
271 if( twin->IsAlive() && me->IsAlive() )
272 {
273 int32 d = CAST_AI(boss_twin_valkyrAI, twin->AI())->LastSynchroHP - (int32)twin->GetHealth();
274 int32 newhealth = (int32)me->GetHealth() - d;
275 if( newhealth <= 0 )
276 newhealth = 1;
277 me->SetHealth( (uint32)newhealth );
278 twin->SetHealth(me->GetHealth());
279 CAST_AI(boss_twin_valkyrAI, twin->AI())->LastSynchroHP = (int32)twin->GetHealth();
280 }
281 }
#define CAST_AI(a, b)
Definition: ScriptedCreature.h:27
bool IsAlive() const
Definition: Unit.h:2024
void SetHealth(uint32 val)
Definition: Unit.cpp:16191
uint32 GetHealth() const
Definition: Unit.h:1438
Definition: boss_twin_valkyr.cpp:108

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

InstanceScript* boss_twin_valkyrAI::pInstance

◆ SpecialMask

uint8 boss_twin_valkyrAI::SpecialMask

Referenced by boss_twin_valkyrAI(), and UpdateAI().

◆ summons

SummonList boss_twin_valkyrAI::summons