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

Public Member Functions

 npc_simon_bunnyAI (Creature *creature)
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith()
 
void DoAction (int32 action) override
 
void SetData (uint32 type, uint32) override
 
void SetGUID (ObjectGuid guid, int32 id) override
 
void StartGame ()
 
void ResetNode ()
 
void CheckPlayerSequence ()
 
void GenerateColorSequence ()
 
void PrepareClusters (bool clustersOnly=false)
 
void PlayNextColor ()
 
void PlayColor (uint8 color)
 
void SetUpPreGame ()
 
void GiveRewardForLevel (uint8 level)
 
void GivePunishment ()
 
void SpellHitTarget (Unit *target, SpellInfo const *spell) override
 
bool CheckPlayer ()
 
- Public Member Functions inherited from ScriptedAI
 ScriptedAI (Creature *creature)
 
 ~ScriptedAI () override
 
void AttackStartNoMove (Unit *target)
 
void DamageTaken (Unit *, uint32 &, DamageEffectType, SpellSchoolMask) override
 Called at any Damage from any attacker (before damage apply)
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith()
 
void JustDied (Unit *) override
 
void KilledUnit (Unit *) override
 
void JustSummoned (Creature *) override
 
void SummonedCreatureDespawn (Creature *) override
 
void SpellHit (Unit *, SpellInfo const *) override
 
void SpellHitTarget (Unit *, SpellInfo const *) override
 
void MovementInform (uint32, uint32) override
 
void OnPossess (bool)
 
bool IsInRoom (const Position *pos, Axis axis, bool above)
 
void Reset () override
 
void JustEngagedWith (Unit *) override
 Called for reaction when initially engaged.
 
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.
 
void Talk (uint8 id, Milliseconds delay)
 
WorldObjectGetSummoner () const
 Returns the summoner creature/object, if the creature is a temporary summon.
 
 CreatureAI (Creature *creature)
 
 ~CreatureAI () override
 
void MoveCircleChecks ()
 
void MoveBackwardsChecks ()
 
void MoveInLineOfSight_Safe (Unit *who)
 == Reactions At =================================
 
void TriggerAlert (Unit const *who) const
 
virtual bool CanRespawn ()
 
virtual void EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER)
 
virtual void IsSummonedBy (WorldObject *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void SummonedCreatureDespawnAll ()
 
virtual void SummonedCreatureEvade (Creature *)
 
virtual void AttackedBy (Unit *)
 
virtual bool IsEscorted ()
 
virtual void JustRespawned ()
 
virtual void PathEndReached (uint32)
 
void OnCharmed (bool apply) override
 Called when unit is charmed.
 
virtual void JustReachedHome ()
 
void DoZoneInCombat (Creature *creature=nullptr, float maxRangeToNearestTarget=250.0f)
 
virtual void ReceiveEmote (Player *, uint32)
 
virtual void OwnerAttackedBy (Unit *)
 
virtual void OwnerAttacked (Unit *)
 
virtual void CorpseRemoved (uint32 &)
 == Triggered Actions Requested ==================
 
virtual void PassengerBoarded (Unit *, int8, bool)
 == Fields =======================================
 
virtual bool BeforeSpellClick (Unit *)
 
virtual void OnSpellClick (Unit *, bool &)
 
virtual bool CanSeeAlways (WorldObject const *)
 
virtual bool CanBeSeen (Player const *)
 
virtual bool CanAlwaysBeDetectable (WorldObject const *)
 
virtual void PetStopAttack ()
 
int32 VisualizeBoundary (uint32 duration, Unit *owner=nullptr, bool fill=false, bool checkZ=false) const
 
virtual bool CheckInRoom ()
 
CreatureBoundary const * GetBoundary () const
 
void SetBoundary (CreatureBoundary const *boundary, bool negativeBoundaries=false)
 
bool IsInBoundary (Position const *who=nullptr) const
 
virtual void CalculateThreat (Unit *, float &, SpellInfo const *)
 
virtual bool OnTeleportUnreacheablePlayer (Player *)
 
virtual void OnAuraRemove (AuraApplication *, AuraRemoveMode)
 
- Public Member Functions inherited from UnitAI
 UnitAI (Unit *unit)
 
virtual ~UnitAI ()
 
virtual bool CanAIAttack (Unit const *) const
 
virtual void InitializeAI ()
 
virtual uint32 GetData (uint32) const
 
virtual 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:
 
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.
 
virtual void JustExitedCombat ()
 Called when the unit leaves combat.
 
virtual void DamageDealt (Unit *, uint32 &, DamageEffectType, SpellSchoolMask)
 Called at any Damage to any victim (before damage apply)
 
virtual void HealReceived (Unit *, uint32 &)
 Called when the creature receives heal.
 
virtual void OnPowerUpdate (Powers, int32, int32, uint32)
 Called when the creature power updates.
 
virtual void HealDone (Unit *, uint32 &)
 Called when the unit heals.
 
virtual void OnCalculateMeleeDamageReceived (uint32 &, Unit *)
 Called during damage calculations.
 
virtual void OnCalculateSpellDamageReceived (int32 &, Unit *)
 
virtual void OnCalculatePeriodicTickReceived (uint32 &, Unit *)
 Called during calculation when receiving periodic healing or damage (DoT or HoT)
 
void AttackStartCaster (Unit *victim, float dist)
 
SpellCastResult DoAddAuraToAllHostilePlayers (uint32 spellid)
 
SpellCastResult DoCast (uint32 spellId)
 
SpellCastResult DoCast (Unit *victim, uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastSelf (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastToAllHostilePlayers (uint32 spellid, bool triggered=false)
 To specify the caster as target if the spell is self-cast.
 
SpellCastResult DoCastVictim (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastAOE (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastRandomTarget (uint32 spellId, uint32 threatTablePosition=0, float dist=0.0f, bool playerOnly=true, bool triggered=false, bool withTank=true)
 Cast the spell on a random unit from the threat list.
 
SpellCastResult DoCastMaxThreat (uint32 spellId, uint32 threatTablePosition=0, float dist=0.0f, bool playerOnly=true, bool triggered=false)
 Cast spell on the top threat target, which may not be the current victim.
 
float DoGetSpellMaxRange (uint32 spellId, bool positive=false)
 
void DoMeleeAttackIfReady ()
 
bool DoSpellAttackIfReady (uint32 spell)
 
void DoSpellAttackToRandomTargetIfReady (uint32 spell, uint32 threatTablePosition=0, float dist=0.f, bool playerOnly=true)
 
virtual void SummonMovementInform (Creature *, uint32, uint32)
 Called when a summon reaches a waypoint or point movement finished.
 
virtual void sGossipHello (Player *)
 
virtual void sGossipSelect (Player *, uint32, uint32)
 
virtual void sGossipSelectCode (Player *, uint32, uint32, char const *)
 
virtual void sQuestAccept (Player *, Quest const *)
 
virtual void sQuestSelect (Player *, Quest const *)
 
virtual void sQuestComplete (Player *, Quest const *)
 
virtual void sQuestReward (Player *, Quest const *, uint32)
 
virtual void sOnGameEvent (bool, uint16)
 
virtual std::string GetDebugInfo () const
 

Public Attributes

bool large
 
bool listening
 
uint8 gameLevel
 
uint8 fails
 
uint8 gameTicks
 
ObjectGuid playerGUID
 
uint32 clusterIds [SIMON_MAX_COLORS]
 
float zCoordCorrection
 
float searchDistance
 
EventMap _events
 
std::list< uint8colorSequence
 
std::list< uint8playableSequence
 
std::list< uint8playerSequence
 
- 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_simon_bunnyAI()

npc_simon_bunny::npc_simon_bunnyAI::npc_simon_bunnyAI ( Creature creature)
inline
556: ScriptedAI(creature) { }
Definition ScriptedCreature.h:190

Member Function Documentation

◆ CheckPlayer()

bool npc_simon_bunny::npc_simon_bunnyAI::CheckPlayer ( )
inline
976 {
978 {
979 if (player->isDead())
980 return false;
981 if (player->GetDistance2d(me) >= 2.0f * searchDistance)
982 {
984 return false;
985 }
986 }
987 else
988 return false;
989
990 return true;
991 }
Definition Player.h:1082
Player * GetPlayer(Map const *, ObjectGuid const guid)
Definition ObjectAccessor.cpp:220
Creature * me
Definition ScriptedCreature.h:280
float searchDistance
Definition zone_blades_edge_mountains.cpp:566
void GivePunishment()
Definition zone_blades_edge_mountains.cpp:940
ObjectGuid playerGUID
Definition zone_blades_edge_mountains.cpp:563

References ObjectAccessor::GetPlayer(), GivePunishment(), ScriptedAI::me, playerGUID, and searchDistance.

Referenced by UpdateAI().

◆ CheckPlayerSequence()

void npc_simon_bunny::npc_simon_bunnyAI::CheckPlayerSequence ( )
inline
787 {
788 bool correct = true;
789 if (playerSequence.size() <= colorSequence.size())
790 for (std::list<uint8>::const_iterator i = playerSequence.begin(), j = colorSequence.begin(); i != playerSequence.end(); ++i, ++j)
791 if ((*i) != (*j))
792 correct = false;
793
794 if (correct && (playerSequence.size() == colorSequence.size()))
796 else if (!correct)
798 }
std::list< uint8 > playerSequence
Definition zone_blades_edge_mountains.cpp:568
void DoAction(int32 action) override
Definition zone_blades_edge_mountains.cpp:624
std::list< uint8 > colorSequence
Definition zone_blades_edge_mountains.cpp:568
@ ACTION_SIMON_WRONG_SEQUENCE
Definition zone_blades_edge_mountains.cpp:536
@ ACTION_SIMON_CORRECT_FULL_SEQUENCE
Definition zone_blades_edge_mountains.cpp:535

References ACTION_SIMON_CORRECT_FULL_SEQUENCE, ACTION_SIMON_WRONG_SEQUENCE, colorSequence, DoAction(), and playerSequence.

Referenced by SetData().

◆ DoAction()

void npc_simon_bunny::npc_simon_bunnyAI::DoAction ( int32  action)
inlineoverridevirtual

Reimplemented from UnitAI.

625 {
626 switch (action)
627 {
629 listening = false;
633 if (gameLevel == 10)
634 ResetNode();
635 else
637 break;
639 gameLevel++;
641 break;
645 break;
646 }
647 }
void CancelEventGroup(uint32 group)
Definition EventMap.cpp:209
void ScheduleEvent(uint32 eventId, uint32 time, uint32 group=0, uint32 phase=0)
Definition EventMap.cpp:56
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:177
bool listening
Definition zone_blades_edge_mountains.cpp:559
uint8 gameLevel
Definition zone_blades_edge_mountains.cpp:560
void ResetNode()
Definition zone_blades_edge_mountains.cpp:763
EventMap _events
Definition zone_blades_edge_mountains.cpp:567
void GiveRewardForLevel(uint8 level)
Definition zone_blades_edge_mountains.cpp:909
@ ACTION_SIMON_ROUND_FINISHED
Definition zone_blades_edge_mountains.cpp:537
@ EVENT_SIMON_SETUP_PRE_GAME
Definition zone_blades_edge_mountains.cpp:527
@ SPELL_VISUAL_START_AI_LEVEL
Definition zone_blades_edge_mountains.cpp:516

References _events, ACTION_SIMON_CORRECT_FULL_SEQUENCE, ACTION_SIMON_ROUND_FINISHED, ACTION_SIMON_WRONG_SEQUENCE, EventMap::CancelEventGroup(), DoAction(), UnitAI::DoCast(), EVENT_SIMON_SETUP_PRE_GAME, gameLevel, GivePunishment(), GiveRewardForLevel(), listening, ResetNode(), EventMap::ScheduleEvent(), and SPELL_VISUAL_START_AI_LEVEL.

Referenced by CheckPlayerSequence(), DoAction(), and UpdateAI().

◆ GenerateColorSequence()

void npc_simon_bunny::npc_simon_bunnyAI::GenerateColorSequence ( )
inline
805 {
806 colorSequence.clear();
807 for (uint8 i = 0; i <= gameLevel; i++)
809
810 for (std::list<uint8>::const_iterator i = colorSequence.begin(); i != colorSequence.end(); ++i)
811 playableSequence.push_back(*i);
812 }
static First const & RAND(First const &first, Second const &second, Rest const &... rest)
Definition CreatureAIImpl.h:25
std::uint8_t uint8
Definition Define.h:109
std::list< uint8 > playableSequence
Definition zone_blades_edge_mountains.cpp:568
@ SIMON_GREEN
Definition zone_blades_edge_mountains.cpp:544
@ SIMON_BLUE
Definition zone_blades_edge_mountains.cpp:542
@ SIMON_RED
Definition zone_blades_edge_mountains.cpp:543
@ SIMON_YELLOW
Definition zone_blades_edge_mountains.cpp:545

References colorSequence, gameLevel, playableSequence, RAND(), SIMON_BLUE, SIMON_GREEN, SIMON_RED, and SIMON_YELLOW.

Referenced by SetUpPreGame().

◆ GivePunishment()

void npc_simon_bunny::npc_simon_bunnyAI::GivePunishment ( )
inline
941 {
942 if (large)
943 {
946 guardian->AI()->AttackStart(player);
947
948 ResetNode();
949 }
950 else
951 {
952 fails++;
953
955 DoCast(player, SPELL_BAD_PRESS_TRIGGER, true);
956
957 if (fails >= 4)
958 ResetNode();
959 }
960 }
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
Definition Object.h:50
Definition Creature.h:43
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:2368
float GetPositionZ() const
Definition Position.h:123
float GetPositionX() const
Definition Position.h:121
float GetPositionY() const
Definition Position.h:122
bool large
Definition zone_blades_edge_mountains.cpp:558
uint8 fails
Definition zone_blades_edge_mountains.cpp:561
float zCoordCorrection
Definition zone_blades_edge_mountains.cpp:565
@ NPC_APEXIS_GUARDIAN
Definition zone_blades_edge_mountains.cpp:481
@ SPELL_BAD_PRESS_TRIGGER
Definition zone_blades_edge_mountains.cpp:518

References UnitAI::DoCast(), fails, ObjectAccessor::GetPlayer(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), large, ScriptedAI::me, NPC_APEXIS_GUARDIAN, playerGUID, ResetNode(), SPELL_BAD_PRESS_TRIGGER, WorldObject::SummonCreature(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, and zCoordCorrection.

Referenced by CheckPlayer(), DoAction(), and GiveRewardForLevel().

◆ GiveRewardForLevel()

void npc_simon_bunny::npc_simon_bunnyAI::GiveRewardForLevel ( uint8  level)
inline
910 {
911 uint32 rewSpell = 0;
912 switch (level)
913 {
914 case 6:
915 if (large)
917 else
918 rewSpell = SPELL_REWARD_BUFF_1;
919 break;
920 case 8:
921 rewSpell = SPELL_REWARD_BUFF_2;
922 break;
923 case 10:
924 rewSpell = SPELL_REWARD_BUFF_3;
925 break;
926 }
927
928 if (rewSpell)
930 DoCast(player, rewSpell, true);
931 }
std::uint32_t uint32
Definition Define.h:107
@ SPELL_REWARD_BUFF_2
Definition zone_blades_edge_mountains.cpp:521
@ SPELL_REWARD_BUFF_3
Definition zone_blades_edge_mountains.cpp:522
@ SPELL_REWARD_BUFF_1
Definition zone_blades_edge_mountains.cpp:520

References UnitAI::DoCast(), ObjectAccessor::GetPlayer(), GivePunishment(), large, ScriptedAI::me, playerGUID, SPELL_REWARD_BUFF_1, SPELL_REWARD_BUFF_2, and SPELL_REWARD_BUFF_3.

Referenced by DoAction().

◆ PlayColor()

void npc_simon_bunny::npc_simon_bunnyAI::PlayColor ( uint8  color)
inline
841 {
842 switch (color)
843 {
844 case SIMON_BLUE:
847 break;
848 case SIMON_GREEN:
851 break;
852 case SIMON_RED:
855 break;
856 case SIMON_YELLOW:
859 break;
860 }
861 }
void DoPlaySoundToSet(WorldObject *source, uint32 soundId)
Definition ScriptedCreature.cpp:263
@ SOUND_RED
Definition zone_blades_edge_mountains.cpp:510
@ SOUND_YELLOW
Definition zone_blades_edge_mountains.cpp:511
@ SOUND_BLUE
Definition zone_blades_edge_mountains.cpp:508
@ SOUND_GREEN
Definition zone_blades_edge_mountains.cpp:509
@ SPELL_VISUAL_YELLOW
Definition zone_blades_edge_mountains.cpp:506
@ SPELL_VISUAL_BLUE
Definition zone_blades_edge_mountains.cpp:503
@ SPELL_VISUAL_RED
Definition zone_blades_edge_mountains.cpp:505
@ SPELL_VISUAL_GREEN
Definition zone_blades_edge_mountains.cpp:504

References UnitAI::DoCast(), ScriptedAI::DoPlaySoundToSet(), ScriptedAI::me, SIMON_BLUE, SIMON_GREEN, SIMON_RED, SIMON_YELLOW, SOUND_BLUE, SOUND_GREEN, SOUND_RED, SOUND_YELLOW, SPELL_VISUAL_BLUE, SPELL_VISUAL_GREEN, SPELL_VISUAL_RED, and SPELL_VISUAL_YELLOW.

Referenced by PlayNextColor(), and SetData().

◆ PlayNextColor()

void npc_simon_bunny::npc_simon_bunnyAI::PlayNextColor ( )
inline
834 {
835 PlayColor(*playableSequence.begin());
836 playableSequence.erase(playableSequence.begin());
837 }
void PlayColor(uint8 color)
Definition zone_blades_edge_mountains.cpp:840

References playableSequence, and PlayColor().

Referenced by UpdateAI().

◆ PrepareClusters()

void npc_simon_bunny::npc_simon_bunnyAI::PrepareClusters ( bool  clustersOnly = false)
inline
816 {
817 for (uint32 clusterId = SIMON_BLUE; clusterId < SIMON_MAX_COLORS; clusterId++)
818 if (GameObject* cluster = me->FindNearestGameObject(clusterIds[clusterId], searchDistance))
819 cluster->RemoveGameObjectFlag(GO_FLAG_NOT_SELECTABLE);
820
821 if (clustersOnly)
822 return;
823
824 for (uint32 auraId = GO_AURA_BLUE; auraId <= GO_AURA_YELLOW; auraId++)
825 if (GameObject* auraGo = me->FindNearestGameObject(auraId, searchDistance))
826 auraGo->RemoveFromWorld();
827 }
@ GO_FLAG_NOT_SELECTABLE
Definition SharedDefines.h:1607
Definition GameObject.h:120
GameObject * FindNearestGameObject(uint32 entry, float range, bool onlySpawned=false) const
Definition Object.cpp:2468
uint32 clusterIds[SIMON_MAX_COLORS]
Definition zone_blades_edge_mountains.cpp:564
@ SIMON_MAX_COLORS
Definition zone_blades_edge_mountains.cpp:546
@ GO_AURA_YELLOW
Definition zone_blades_edge_mountains.cpp:488
@ GO_AURA_BLUE
Definition zone_blades_edge_mountains.cpp:485

References clusterIds, WorldObject::FindNearestGameObject(), GO_AURA_BLUE, GO_AURA_YELLOW, GO_FLAG_NOT_SELECTABLE, ScriptedAI::me, searchDistance, SIMON_BLUE, and SIMON_MAX_COLORS.

Referenced by UpdateAI().

◆ ResetNode()

void npc_simon_bunny::npc_simon_bunnyAI::ResetNode ( )
inline
764 {
766
767 for (uint32 clusterId = SIMON_BLUE; clusterId < SIMON_MAX_COLORS; clusterId++)
768 if (GameObject* cluster = me->FindNearestGameObject(clusterIds[clusterId], searchDistance))
769 cluster->SetGameObjectFlag(GO_FLAG_NOT_SELECTABLE);
770
771 for (uint32 auraId = GO_AURA_BLUE; auraId <= GO_AURA_YELLOW; auraId++)
772 if (GameObject* auraGo = me->FindNearestGameObject(auraId, searchDistance))
773 auraGo->RemoveFromWorld();
774
776 relic->RemoveGameObjectFlag(GO_FLAG_NOT_SELECTABLE);
777
778 me->DespawnOrUnsummon(1000);
779 }
void DespawnOrUnsummon(Milliseconds msTimeToDespawn, Seconds forcedRespawnTimer)
Definition Creature.cpp:2177
@ GO_APEXIS_MONUMENT
Definition zone_blades_edge_mountains.cpp:484
@ GO_APEXIS_RELIC
Definition zone_blades_edge_mountains.cpp:483
@ SOUND_DISABLE_NODE
Definition zone_blades_edge_mountains.cpp:512

References clusterIds, Creature::DespawnOrUnsummon(), ScriptedAI::DoPlaySoundToSet(), WorldObject::FindNearestGameObject(), GO_APEXIS_MONUMENT, GO_APEXIS_RELIC, GO_AURA_BLUE, GO_AURA_YELLOW, GO_FLAG_NOT_SELECTABLE, large, ScriptedAI::me, searchDistance, SIMON_BLUE, SIMON_MAX_COLORS, and SOUND_DISABLE_NODE.

Referenced by DoAction(), GivePunishment(), and UpdateAI().

◆ SetData()

void npc_simon_bunny::npc_simon_bunnyAI::SetData ( uint32  type,
uint32   
)
inlineoverridevirtual

Reimplemented from UnitAI.

651 {
652 if (!listening)
653 return;
654
655 uint8 pressedColor = SIMON_MAX_COLORS;
656
657 if (type == clusterIds[SIMON_RED])
658 pressedColor = SIMON_RED;
659 else if (type == clusterIds[SIMON_BLUE])
660 pressedColor = SIMON_BLUE;
661 else if (type == clusterIds[SIMON_GREEN])
662 pressedColor = SIMON_GREEN;
663 else if (type == clusterIds[SIMON_YELLOW])
664 pressedColor = SIMON_YELLOW;
665
666 PlayColor(pressedColor);
667 playerSequence.push_back(pressedColor);
670 }
void CheckPlayerSequence()
Definition zone_blades_edge_mountains.cpp:786
@ EVENT_SIMON_RESET_CLUSTERS
Definition zone_blades_edge_mountains.cpp:529

References _events, CheckPlayerSequence(), clusterIds, EVENT_SIMON_RESET_CLUSTERS, listening, PlayColor(), playerSequence, EventMap::ScheduleEvent(), SIMON_BLUE, SIMON_GREEN, SIMON_MAX_COLORS, SIMON_RED, and SIMON_YELLOW.

◆ SetGUID()

void npc_simon_bunny::npc_simon_bunnyAI::SetGUID ( ObjectGuid  guid,
int32  id 
)
inlineoverridevirtual

Reimplemented from UnitAI.

674 {
675 me->SetCanFly(true);
676
677 large = (bool)id;
678 playerGUID = guid;
679 StartGame();
680 }
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:3305
void StartGame()
Definition zone_blades_edge_mountains.cpp:686

References large, ScriptedAI::me, playerGUID, Creature::SetCanFly(), and StartGame().

◆ SetUpPreGame()

void npc_simon_bunny::npc_simon_bunnyAI::SetUpPreGame ( )
inline
868 {
869 for (uint32 clusterId = SIMON_BLUE; clusterId < SIMON_MAX_COLORS; clusterId++)
870 {
871 if (GameObject* cluster = me->FindNearestGameObject(clusterIds[clusterId], 2.0f * searchDistance))
872 {
873 cluster->SetGameObjectFlag(GO_FLAG_NOT_SELECTABLE);
874
875 // break since we don't need glowing auras for large clusters
876 if (large)
877 break;
878
879 float x, y, z, o;
880 cluster->GetPosition(x, y, z, o);
881 me->NearTeleportTo(x, y, z, o);
882
883 uint32 preGameSpellId;
884 if (cluster->GetEntry() == clusterIds[SIMON_RED])
885 preGameSpellId = SPELL_PRE_GAME_RED;
886 else if (cluster->GetEntry() == clusterIds[SIMON_BLUE])
887 preGameSpellId = SPELL_PRE_GAME_BLUE;
888 else if (cluster->GetEntry() == clusterIds[SIMON_GREEN])
889 preGameSpellId = SPELL_PRE_GAME_GREEN;
890 else if (cluster->GetEntry() == clusterIds[SIMON_YELLOW])
891 preGameSpellId = SPELL_PRE_GAME_YELLOW;
892 else break;
893
894 me->CastSpell(cluster, preGameSpellId, true);
895 }
896 }
897
899 {
900 float x, y, z, o;
901 relic->GetPosition(x, y, z, o);
902 me->NearTeleportTo(x, y, z + zCoordCorrection, o);
903 }
904
906 }
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:1179
void NearTeleportTo(Position &pos, bool casting=false, bool vehicleTeleport=false, bool withPet=false, bool removeTransport=false)
Definition Unit.cpp:19759
void GenerateColorSequence()
Definition zone_blades_edge_mountains.cpp:804
@ SPELL_PRE_GAME_RED
Definition zone_blades_edge_mountains.cpp:501
@ SPELL_PRE_GAME_GREEN
Definition zone_blades_edge_mountains.cpp:500
@ SPELL_PRE_GAME_YELLOW
Definition zone_blades_edge_mountains.cpp:502
@ SPELL_PRE_GAME_BLUE
Definition zone_blades_edge_mountains.cpp:499

References Unit::CastSpell(), clusterIds, WorldObject::FindNearestGameObject(), GenerateColorSequence(), GO_APEXIS_MONUMENT, GO_APEXIS_RELIC, GO_FLAG_NOT_SELECTABLE, large, ScriptedAI::me, Unit::NearTeleportTo(), searchDistance, SIMON_BLUE, SIMON_GREEN, SIMON_MAX_COLORS, SIMON_RED, SIMON_YELLOW, SPELL_PRE_GAME_BLUE, SPELL_PRE_GAME_GREEN, SPELL_PRE_GAME_RED, SPELL_PRE_GAME_YELLOW, and zCoordCorrection.

Referenced by UpdateAI().

◆ SpellHitTarget()

void npc_simon_bunny::npc_simon_bunnyAI::SpellHitTarget ( Unit target,
SpellInfo const *  spell 
)
inlineoverridevirtual

Reimplemented from CreatureAI.

963 {
964 // Cast SPELL_BAD_PRESS_DAMAGE with scaled basepoints when the visual hits the target.
965 // Need Fix: When SPELL_BAD_PRESS_TRIGGER hits target it triggers spell SPELL_BAD_PRESS_DAMAGE by itself
966 // so player gets damage equal to calculated damage dbc basepoints for SPELL_BAD_PRESS_DAMAGE (~50)
967 if (spell->Id == SPELL_BAD_PRESS_TRIGGER)
968 {
969 int32 bp = (int32)((float)(fails) * 0.33f * target->GetMaxHealth());
970 target->CastCustomSpell(target, SPELL_BAD_PRESS_DAMAGE, &bp, nullptr, nullptr, true);
971 }
972 }
std::int32_t int32
Definition Define.h:103
uint32 GetMaxHealth() const
Definition Unit.h:1030
SpellCastResult CastCustomSpell(Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition Unit.cpp:1236
@ SPELL_BAD_PRESS_DAMAGE
Definition zone_blades_edge_mountains.cpp:519

References Unit::CastCustomSpell(), fails, Unit::GetMaxHealth(), SpellInfo::Id, SPELL_BAD_PRESS_DAMAGE, and SPELL_BAD_PRESS_TRIGGER.

◆ StartGame()

void npc_simon_bunny::npc_simon_bunnyAI::StartGame ( )
inline
687 {
688 listening = false;
689 gameLevel = 0;
690 fails = 0;
691 gameTicks = 0;
692 zCoordCorrection = large ? 8.0f : 2.75f;
693 searchDistance = large ? 13.0f : 5.0f;
694 colorSequence.clear();
695 playableSequence.clear();
696 playerSequence.clear();
697 me->SetObjectScale(large ? 2.0f : 1.0f);
698
699 std::list<WorldObject*> ClusterList;
703
704 for (std::list<WorldObject*>::const_iterator i = ClusterList.begin(); i != ClusterList.end(); ++i)
705 {
706 if (GameObject* go = (*i)->ToGameObject())
707 {
708 // We are checking for displayid because all simon nodes have 4 clusters with different entries
709 if (large)
710 {
711 switch (go->GetGOInfo()->displayId)
712 {
714 clusterIds[SIMON_BLUE] = go->GetEntry();
715 break;
716
718 clusterIds[SIMON_RED] = go->GetEntry();
719 break;
720
722 clusterIds[SIMON_GREEN] = go->GetEntry();
723 break;
724
726 clusterIds[SIMON_YELLOW] = go->GetEntry();
727 break;
728 }
729 }
730 else
731 {
732 switch (go->GetGOInfo()->displayId)
733 {
735 clusterIds[SIMON_BLUE] = go->GetEntry();
736 break;
737
739 clusterIds[SIMON_RED] = go->GetEntry();
740 break;
741
743 clusterIds[SIMON_GREEN] = go->GetEntry();
744 break;
745
747 clusterIds[SIMON_YELLOW] = go->GetEntry();
748 break;
749 }
750 }
751 }
752 }
753
754 _events.Reset();
757
759 relic->SetGameObjectFlag(GO_FLAG_NOT_SELECTABLE);
760 }
Definition GridNotifiers.h:1586
void SetObjectScale(float scale) override
Definition Creature.cpp:3514
void Reset()
Definition EventMap.cpp:21
GameObject * ToGameObject()
Definition Object.h:214
Definition GridNotifiers.h:239
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius)
Definition CellImpl.h:185
uint8 gameTicks
Definition zone_blades_edge_mountains.cpp:562
@ EVENT_SIMON_PERIODIC_PLAYER_CHECK
Definition zone_blades_edge_mountains.cpp:530
@ EVENT_SIMON_ROUND_FINISHED
Definition zone_blades_edge_mountains.cpp:533
@ GO_YELLOW_CLUSTER_DISPLAY
Definition zone_blades_edge_mountains.cpp:493
@ GO_BLUE_CLUSTER_DISPLAY_LARGE
Definition zone_blades_edge_mountains.cpp:494
@ GO_GREEN_CLUSTER_DISPLAY
Definition zone_blades_edge_mountains.cpp:491
@ GO_BLUE_CLUSTER_DISPLAY
Definition zone_blades_edge_mountains.cpp:490
@ GO_GREEN_CLUSTER_DISPLAY_LARGE
Definition zone_blades_edge_mountains.cpp:495
@ GO_RED_CLUSTER_DISPLAY_LARGE
Definition zone_blades_edge_mountains.cpp:496
@ GO_RED_CLUSTER_DISPLAY
Definition zone_blades_edge_mountains.cpp:492
@ GO_YELLOW_CLUSTER_DISPLAY_LARGE
Definition zone_blades_edge_mountains.cpp:497

References _events, clusterIds, colorSequence, EVENT_SIMON_PERIODIC_PLAYER_CHECK, EVENT_SIMON_ROUND_FINISHED, fails, WorldObject::FindNearestGameObject(), gameLevel, gameTicks, GO_APEXIS_MONUMENT, GO_APEXIS_RELIC, GO_BLUE_CLUSTER_DISPLAY, GO_BLUE_CLUSTER_DISPLAY_LARGE, GO_FLAG_NOT_SELECTABLE, GO_GREEN_CLUSTER_DISPLAY, GO_GREEN_CLUSTER_DISPLAY_LARGE, GO_RED_CLUSTER_DISPLAY, GO_RED_CLUSTER_DISPLAY_LARGE, GO_YELLOW_CLUSTER_DISPLAY, GO_YELLOW_CLUSTER_DISPLAY_LARGE, large, listening, ScriptedAI::me, playableSequence, playerSequence, EventMap::Reset(), EventMap::ScheduleEvent(), searchDistance, Creature::SetObjectScale(), SIMON_BLUE, SIMON_GREEN, SIMON_RED, SIMON_YELLOW, Object::ToGameObject(), Cell::VisitAllObjects(), and zCoordCorrection.

Referenced by SetGUID().

◆ UpdateAI()

void npc_simon_bunny::npc_simon_bunnyAI::UpdateAI ( uint32  )
inlineoverridevirtual

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

Implements UnitAI.

571 {
572 _events.Update(diff);
573
574 switch (_events.ExecuteEvent())
575 {
577 if (!CheckPlayer())
578 ResetNode();
579 else
581 break;
583 SetUpPreGame();
586 break;
588 if (!playableSequence.empty())
589 {
592 }
593 else
594 {
595 listening = true;
597 playerSequence.clear();
599 gameTicks = 0;
601 }
602 break;
605
606 if (gameTicks > gameLevel)
608 else
610 gameTicks++;
611 break;
613 PrepareClusters(true);
614 break;
617 break;
620 break;
621 }
622 }
uint32 ExecuteEvent()
Definition EventMap.cpp:114
void Update(uint32 time)
Definition EventMap.h:54
void CancelEvent(uint32 eventId)
Definition EventMap.cpp:190
void PlayNextColor()
Definition zone_blades_edge_mountains.cpp:833
bool CheckPlayer()
Definition zone_blades_edge_mountains.cpp:975
void PrepareClusters(bool clustersOnly=false)
Definition zone_blades_edge_mountains.cpp:815
void SetUpPreGame()
Definition zone_blades_edge_mountains.cpp:867
@ EVENT_SIMON_GAME_TICK
Definition zone_blades_edge_mountains.cpp:532
@ EVENT_SIMON_PLAY_SEQUENCE
Definition zone_blades_edge_mountains.cpp:528
@ EVENT_SIMON_TOO_LONG_TIME
Definition zone_blades_edge_mountains.cpp:531
@ SPELL_VISUAL_START_PLAYER_LEVEL
Definition zone_blades_edge_mountains.cpp:515
@ SPELL_AUDIBLE_GAME_TICK
Definition zone_blades_edge_mountains.cpp:514

References _events, ACTION_SIMON_ROUND_FINISHED, ACTION_SIMON_WRONG_SEQUENCE, EventMap::CancelEvent(), CheckPlayer(), DoAction(), UnitAI::DoCast(), EVENT_SIMON_GAME_TICK, EVENT_SIMON_PERIODIC_PLAYER_CHECK, EVENT_SIMON_PLAY_SEQUENCE, EVENT_SIMON_RESET_CLUSTERS, EVENT_SIMON_ROUND_FINISHED, EVENT_SIMON_SETUP_PRE_GAME, EVENT_SIMON_TOO_LONG_TIME, EventMap::ExecuteEvent(), gameLevel, gameTicks, listening, playableSequence, playerSequence, PlayNextColor(), PrepareClusters(), ResetNode(), EventMap::ScheduleEvent(), SetUpPreGame(), SPELL_AUDIBLE_GAME_TICK, SPELL_VISUAL_START_PLAYER_LEVEL, and EventMap::Update().

Member Data Documentation

◆ _events

EventMap npc_simon_bunny::npc_simon_bunnyAI::_events

Referenced by DoAction(), SetData(), StartGame(), and UpdateAI().

◆ clusterIds

uint32 npc_simon_bunny::npc_simon_bunnyAI::clusterIds[SIMON_MAX_COLORS]

◆ colorSequence

std::list<uint8> npc_simon_bunny::npc_simon_bunnyAI::colorSequence

◆ fails

uint8 npc_simon_bunny::npc_simon_bunnyAI::fails

◆ gameLevel

uint8 npc_simon_bunny::npc_simon_bunnyAI::gameLevel

◆ gameTicks

uint8 npc_simon_bunny::npc_simon_bunnyAI::gameTicks

Referenced by StartGame(), and UpdateAI().

◆ large

bool npc_simon_bunny::npc_simon_bunnyAI::large

◆ listening

bool npc_simon_bunny::npc_simon_bunnyAI::listening

Referenced by DoAction(), SetData(), StartGame(), and UpdateAI().

◆ playableSequence

std::list<uint8> npc_simon_bunny::npc_simon_bunnyAI::playableSequence

◆ playerGUID

ObjectGuid npc_simon_bunny::npc_simon_bunnyAI::playerGUID

◆ playerSequence

std::list<uint8> npc_simon_bunny::npc_simon_bunnyAI::playerSequence

◆ searchDistance

float npc_simon_bunny::npc_simon_bunnyAI::searchDistance

◆ zCoordCorrection

float npc_simon_bunny::npc_simon_bunnyAI::zCoordCorrection

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