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

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
571: ScriptedAI(creature) { }
Definition: ScriptedCreature.h:190

Member Function Documentation

◆ CheckPlayer()

bool npc_simon_bunny::npc_simon_bunnyAI::CheckPlayer ( )
inline
991 {
993 {
994 if (player->isDead())
995 return false;
996 if (player->GetDistance2d(me) >= 2.0f * searchDistance)
997 {
999 return false;
1000 }
1001 }
1002 else
1003 return false;
1004
1005 return true;
1006 }
Player * GetPlayer(Map const *, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:220
Creature * me
Definition: ScriptedCreature.h:280
Definition: Player.h:1081
float searchDistance
Definition: zone_blades_edge_mountains.cpp:581
void GivePunishment()
Definition: zone_blades_edge_mountains.cpp:955
ObjectGuid playerGUID
Definition: zone_blades_edge_mountains.cpp:578

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

Referenced by UpdateAI().

◆ CheckPlayerSequence()

void npc_simon_bunny::npc_simon_bunnyAI::CheckPlayerSequence ( )
inline
802 {
803 bool correct = true;
804 if (playerSequence.size() <= colorSequence.size())
805 for (std::list<uint8>::const_iterator i = playerSequence.begin(), j = colorSequence.begin(); i != playerSequence.end(); ++i, ++j)
806 if ((*i) != (*j))
807 correct = false;
808
809 if (correct && (playerSequence.size() == colorSequence.size()))
811 else if (!correct)
813 }
@ ACTION_SIMON_WRONG_SEQUENCE
Definition: zone_blades_edge_mountains.cpp:551
@ ACTION_SIMON_CORRECT_FULL_SEQUENCE
Definition: zone_blades_edge_mountains.cpp:550
std::list< uint8 > playerSequence
Definition: zone_blades_edge_mountains.cpp:583
void DoAction(int32 action) override
Definition: zone_blades_edge_mountains.cpp:639
std::list< uint8 > colorSequence
Definition: zone_blades_edge_mountains.cpp:583

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.

640 {
641 switch (action)
642 {
644 listening = false;
648 if (gameLevel == 10)
649 ResetNode();
650 else
652 break;
654 gameLevel++;
656 break;
660 break;
661 }
662 }
@ ACTION_SIMON_ROUND_FINISHED
Definition: zone_blades_edge_mountains.cpp:552
@ EVENT_SIMON_SETUP_PRE_GAME
Definition: zone_blades_edge_mountains.cpp:542
@ SPELL_VISUAL_START_AI_LEVEL
Definition: zone_blades_edge_mountains.cpp:531
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:574
uint8 gameLevel
Definition: zone_blades_edge_mountains.cpp:575
void ResetNode()
Definition: zone_blades_edge_mountains.cpp:778
EventMap _events
Definition: zone_blades_edge_mountains.cpp:582
void GiveRewardForLevel(uint8 level)
Definition: zone_blades_edge_mountains.cpp:924

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
820 {
821 colorSequence.clear();
822 for (uint8 i = 0; i <= gameLevel; i++)
824
825 for (std::list<uint8>::const_iterator i = colorSequence.begin(); i != colorSequence.end(); ++i)
826 playableSequence.push_back(*i);
827 }
std::uint8_t uint8
Definition: Define.h:109
@ SIMON_GREEN
Definition: zone_blades_edge_mountains.cpp:559
@ SIMON_BLUE
Definition: zone_blades_edge_mountains.cpp:557
@ SIMON_RED
Definition: zone_blades_edge_mountains.cpp:558
@ SIMON_YELLOW
Definition: zone_blades_edge_mountains.cpp:560
static First const & RAND(First const &first, Second const &second, Rest const &... rest)
Definition: CreatureAIImpl.h:25
std::list< uint8 > playableSequence
Definition: zone_blades_edge_mountains.cpp:583

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
956 {
957 if (large)
958 {
961 guardian->AI()->AttackStart(player);
962
963 ResetNode();
964 }
965 else
966 {
967 fails++;
968
970 DoCast(player, SPELL_BAD_PRESS_TRIGGER, true);
971
972 if (fails >= 4)
973 ResetNode();
974 }
975 }
@ NPC_APEXIS_GUARDIAN
Definition: zone_blades_edge_mountains.cpp:496
@ SPELL_BAD_PRESS_TRIGGER
Definition: zone_blades_edge_mountains.cpp:533
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
Definition: Object.h:49
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:2366
float GetPositionZ() const
Definition: Position.h:118
float GetPositionX() const
Definition: Position.h:116
float GetPositionY() const
Definition: Position.h:117
bool large
Definition: zone_blades_edge_mountains.cpp:573
uint8 fails
Definition: zone_blades_edge_mountains.cpp:576
float zCoordCorrection
Definition: zone_blades_edge_mountains.cpp:580

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
925 {
926 uint32 rewSpell = 0;
927 switch (level)
928 {
929 case 6:
930 if (large)
932 else
933 rewSpell = SPELL_REWARD_BUFF_1;
934 break;
935 case 8:
936 rewSpell = SPELL_REWARD_BUFF_2;
937 break;
938 case 10:
939 rewSpell = SPELL_REWARD_BUFF_3;
940 break;
941 }
942
943 if (rewSpell)
945 DoCast(player, rewSpell, true);
946 }
std::uint32_t uint32
Definition: Define.h:107
@ SPELL_REWARD_BUFF_2
Definition: zone_blades_edge_mountains.cpp:536
@ SPELL_REWARD_BUFF_3
Definition: zone_blades_edge_mountains.cpp:537
@ SPELL_REWARD_BUFF_1
Definition: zone_blades_edge_mountains.cpp:535

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
856 {
857 switch (color)
858 {
859 case SIMON_BLUE:
862 break;
863 case SIMON_GREEN:
866 break;
867 case SIMON_RED:
870 break;
871 case SIMON_YELLOW:
874 break;
875 }
876 }
@ SOUND_RED
Definition: zone_blades_edge_mountains.cpp:525
@ SOUND_YELLOW
Definition: zone_blades_edge_mountains.cpp:526
@ SOUND_BLUE
Definition: zone_blades_edge_mountains.cpp:523
@ SOUND_GREEN
Definition: zone_blades_edge_mountains.cpp:524
@ SPELL_VISUAL_YELLOW
Definition: zone_blades_edge_mountains.cpp:521
@ SPELL_VISUAL_BLUE
Definition: zone_blades_edge_mountains.cpp:518
@ SPELL_VISUAL_RED
Definition: zone_blades_edge_mountains.cpp:520
@ SPELL_VISUAL_GREEN
Definition: zone_blades_edge_mountains.cpp:519
void DoPlaySoundToSet(WorldObject *source, uint32 soundId)
Definition: ScriptedCreature.cpp:263

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
849 {
850 PlayColor(*playableSequence.begin());
851 playableSequence.erase(playableSequence.begin());
852 }
void PlayColor(uint8 color)
Definition: zone_blades_edge_mountains.cpp:855

References playableSequence, and PlayColor().

Referenced by UpdateAI().

◆ PrepareClusters()

void npc_simon_bunny::npc_simon_bunnyAI::PrepareClusters ( bool  clustersOnly = false)
inline
831 {
832 for (uint32 clusterId = SIMON_BLUE; clusterId < SIMON_MAX_COLORS; clusterId++)
833 if (GameObject* cluster = me->FindNearestGameObject(clusterIds[clusterId], searchDistance))
834 cluster->RemoveGameObjectFlag(GO_FLAG_NOT_SELECTABLE);
835
836 if (clustersOnly)
837 return;
838
839 for (uint32 auraId = GO_AURA_BLUE; auraId <= GO_AURA_YELLOW; auraId++)
840 if (GameObject* auraGo = me->FindNearestGameObject(auraId, searchDistance))
841 auraGo->RemoveFromWorld();
842 }
@ SIMON_MAX_COLORS
Definition: zone_blades_edge_mountains.cpp:561
@ GO_AURA_YELLOW
Definition: zone_blades_edge_mountains.cpp:503
@ GO_AURA_BLUE
Definition: zone_blades_edge_mountains.cpp:500
@ 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:2466
uint32 clusterIds[SIMON_MAX_COLORS]
Definition: zone_blades_edge_mountains.cpp:579

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
779 {
781
782 for (uint32 clusterId = SIMON_BLUE; clusterId < SIMON_MAX_COLORS; clusterId++)
783 if (GameObject* cluster = me->FindNearestGameObject(clusterIds[clusterId], searchDistance))
784 cluster->SetGameObjectFlag(GO_FLAG_NOT_SELECTABLE);
785
786 for (uint32 auraId = GO_AURA_BLUE; auraId <= GO_AURA_YELLOW; auraId++)
787 if (GameObject* auraGo = me->FindNearestGameObject(auraId, searchDistance))
788 auraGo->RemoveFromWorld();
789
791 relic->RemoveGameObjectFlag(GO_FLAG_NOT_SELECTABLE);
792
793 me->DespawnOrUnsummon(1000);
794 }
@ GO_APEXIS_MONUMENT
Definition: zone_blades_edge_mountains.cpp:499
@ GO_APEXIS_RELIC
Definition: zone_blades_edge_mountains.cpp:498
@ SOUND_DISABLE_NODE
Definition: zone_blades_edge_mountains.cpp:527
void DespawnOrUnsummon(Milliseconds msTimeToDespawn, Seconds forcedRespawnTimer)
Definition: Creature.cpp:2178

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.

666 {
667 if (!listening)
668 return;
669
670 uint8 pressedColor = SIMON_MAX_COLORS;
671
672 if (type == clusterIds[SIMON_RED])
673 pressedColor = SIMON_RED;
674 else if (type == clusterIds[SIMON_BLUE])
675 pressedColor = SIMON_BLUE;
676 else if (type == clusterIds[SIMON_GREEN])
677 pressedColor = SIMON_GREEN;
678 else if (type == clusterIds[SIMON_YELLOW])
679 pressedColor = SIMON_YELLOW;
680
681 PlayColor(pressedColor);
682 playerSequence.push_back(pressedColor);
685 }
@ EVENT_SIMON_RESET_CLUSTERS
Definition: zone_blades_edge_mountains.cpp:544
void CheckPlayerSequence()
Definition: zone_blades_edge_mountains.cpp:801

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.

689 {
690 me->SetCanFly(true);
691
692 large = (bool)id;
693 playerGUID = guid;
694 StartGame();
695 }
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 StartGame()
Definition: zone_blades_edge_mountains.cpp:701

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

◆ SetUpPreGame()

void npc_simon_bunny::npc_simon_bunnyAI::SetUpPreGame ( )
inline
883 {
884 for (uint32 clusterId = SIMON_BLUE; clusterId < SIMON_MAX_COLORS; clusterId++)
885 {
886 if (GameObject* cluster = me->FindNearestGameObject(clusterIds[clusterId], 2.0f * searchDistance))
887 {
888 cluster->SetGameObjectFlag(GO_FLAG_NOT_SELECTABLE);
889
890 // break since we don't need glowing auras for large clusters
891 if (large)
892 break;
893
894 float x, y, z, o;
895 cluster->GetPosition(x, y, z, o);
896 me->NearTeleportTo(x, y, z, o);
897
898 uint32 preGameSpellId;
899 if (cluster->GetEntry() == clusterIds[SIMON_RED])
900 preGameSpellId = SPELL_PRE_GAME_RED;
901 else if (cluster->GetEntry() == clusterIds[SIMON_BLUE])
902 preGameSpellId = SPELL_PRE_GAME_BLUE;
903 else if (cluster->GetEntry() == clusterIds[SIMON_GREEN])
904 preGameSpellId = SPELL_PRE_GAME_GREEN;
905 else if (cluster->GetEntry() == clusterIds[SIMON_YELLOW])
906 preGameSpellId = SPELL_PRE_GAME_YELLOW;
907 else break;
908
909 me->CastSpell(cluster, preGameSpellId, true);
910 }
911 }
912
914 {
915 float x, y, z, o;
916 relic->GetPosition(x, y, z, o);
917 me->NearTeleportTo(x, y, z + zCoordCorrection, o);
918 }
919
921 }
@ SPELL_PRE_GAME_RED
Definition: zone_blades_edge_mountains.cpp:516
@ SPELL_PRE_GAME_GREEN
Definition: zone_blades_edge_mountains.cpp:515
@ SPELL_PRE_GAME_YELLOW
Definition: zone_blades_edge_mountains.cpp:517
@ SPELL_PRE_GAME_BLUE
Definition: zone_blades_edge_mountains.cpp:514
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 NearTeleportTo(Position &pos, bool casting=false, bool vehicleTeleport=false, bool withPet=false, bool removeTransport=false)
Definition: Unit.cpp:19979
void GenerateColorSequence()
Definition: zone_blades_edge_mountains.cpp:819

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 ScriptedAI.

978 {
979 // Cast SPELL_BAD_PRESS_DAMAGE with scaled basepoints when the visual hits the target.
980 // Need Fix: When SPELL_BAD_PRESS_TRIGGER hits target it triggers spell SPELL_BAD_PRESS_DAMAGE by itself
981 // so player gets damage equal to calculated damage dbc basepoints for SPELL_BAD_PRESS_DAMAGE (~50)
982 if (spell->Id == SPELL_BAD_PRESS_TRIGGER)
983 {
984 int32 bp = (int32)((float)(fails) * 0.33f * target->GetMaxHealth());
985 target->CastCustomSpell(target, SPELL_BAD_PRESS_DAMAGE, &bp, nullptr, nullptr, true);
986 }
987 }
std::int32_t int32
Definition: Define.h:103
@ SPELL_BAD_PRESS_DAMAGE
Definition: zone_blades_edge_mountains.cpp:534
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:1224

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
702 {
703 listening = false;
704 gameLevel = 0;
705 fails = 0;
706 gameTicks = 0;
707 zCoordCorrection = large ? 8.0f : 2.75f;
708 searchDistance = large ? 13.0f : 5.0f;
709 colorSequence.clear();
710 playableSequence.clear();
711 playerSequence.clear();
712 me->SetObjectScale(large ? 2.0f : 1.0f);
713
714 std::list<WorldObject*> ClusterList;
718
719 for (std::list<WorldObject*>::const_iterator i = ClusterList.begin(); i != ClusterList.end(); ++i)
720 {
721 if (GameObject* go = (*i)->ToGameObject())
722 {
723 // We are checking for displayid because all simon nodes have 4 clusters with different entries
724 if (large)
725 {
726 switch (go->GetGOInfo()->displayId)
727 {
729 clusterIds[SIMON_BLUE] = go->GetEntry();
730 break;
731
733 clusterIds[SIMON_RED] = go->GetEntry();
734 break;
735
737 clusterIds[SIMON_GREEN] = go->GetEntry();
738 break;
739
741 clusterIds[SIMON_YELLOW] = go->GetEntry();
742 break;
743 }
744 }
745 else
746 {
747 switch (go->GetGOInfo()->displayId)
748 {
750 clusterIds[SIMON_BLUE] = go->GetEntry();
751 break;
752
754 clusterIds[SIMON_RED] = go->GetEntry();
755 break;
756
758 clusterIds[SIMON_GREEN] = go->GetEntry();
759 break;
760
762 clusterIds[SIMON_YELLOW] = go->GetEntry();
763 break;
764 }
765 }
766 }
767 }
768
769 _events.Reset();
772
774 relic->SetGameObjectFlag(GO_FLAG_NOT_SELECTABLE);
775 }
@ EVENT_SIMON_PERIODIC_PLAYER_CHECK
Definition: zone_blades_edge_mountains.cpp:545
@ EVENT_SIMON_ROUND_FINISHED
Definition: zone_blades_edge_mountains.cpp:548
@ GO_YELLOW_CLUSTER_DISPLAY
Definition: zone_blades_edge_mountains.cpp:508
@ GO_BLUE_CLUSTER_DISPLAY_LARGE
Definition: zone_blades_edge_mountains.cpp:509
@ GO_GREEN_CLUSTER_DISPLAY
Definition: zone_blades_edge_mountains.cpp:506
@ GO_BLUE_CLUSTER_DISPLAY
Definition: zone_blades_edge_mountains.cpp:505
@ GO_GREEN_CLUSTER_DISPLAY_LARGE
Definition: zone_blades_edge_mountains.cpp:510
@ GO_RED_CLUSTER_DISPLAY_LARGE
Definition: zone_blades_edge_mountains.cpp:511
@ GO_RED_CLUSTER_DISPLAY
Definition: zone_blades_edge_mountains.cpp:507
@ GO_YELLOW_CLUSTER_DISPLAY_LARGE
Definition: zone_blades_edge_mountains.cpp:512
void Reset()
Definition: EventMap.cpp:21
void SetObjectScale(float scale) override
Definition: Creature.cpp:3499
GameObject * ToGameObject()
Definition: Object.h:213
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:206
Definition: GridNotifiers.h:239
Definition: GridNotifiers.h:1586
uint8 gameTicks
Definition: zone_blades_edge_mountains.cpp:577

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

Reimplemented from ScriptedAI.

586 {
587 _events.Update(diff);
588
589 switch (_events.ExecuteEvent())
590 {
592 if (!CheckPlayer())
593 ResetNode();
594 else
596 break;
598 SetUpPreGame();
601 break;
603 if (!playableSequence.empty())
604 {
607 }
608 else
609 {
610 listening = true;
612 playerSequence.clear();
614 gameTicks = 0;
616 }
617 break;
620
621 if (gameTicks > gameLevel)
623 else
625 gameTicks++;
626 break;
628 PrepareClusters(true);
629 break;
632 break;
635 break;
636 }
637 }
@ EVENT_SIMON_GAME_TICK
Definition: zone_blades_edge_mountains.cpp:547
@ EVENT_SIMON_PLAY_SEQUENCE
Definition: zone_blades_edge_mountains.cpp:543
@ EVENT_SIMON_TOO_LONG_TIME
Definition: zone_blades_edge_mountains.cpp:546
@ SPELL_VISUAL_START_PLAYER_LEVEL
Definition: zone_blades_edge_mountains.cpp:530
@ SPELL_AUDIBLE_GAME_TICK
Definition: zone_blades_edge_mountains.cpp:529
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:848
bool CheckPlayer()
Definition: zone_blades_edge_mountains.cpp:990
void PrepareClusters(bool clustersOnly=false)
Definition: zone_blades_edge_mountains.cpp:830
void SetUpPreGame()
Definition: zone_blades_edge_mountains.cpp:882

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