Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
pet_mage.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6/*
7 * Ordered alphabetically using scriptname.
8 * Scriptnames of files in this file should be prefixed with "npc_pet_mag_".
9 */
10
11#include "ScriptMgr.h"
12#include "ScriptedCreature.h"
13#include "CombatAI.h"
14#include "Pet.h"
15
22
24{
25 public:
26 npc_pet_mage_mirror_image() : CreatureScript("npc_pet_mage_mirror_image") { }
27
29 {
31
33
35 {
37 Unit* owner = me->GetOwner();
38 if (!owner)
39 return;
40
41
42 switch (me->GetEntry())
43 {
44 case 31216: spellId = 59638; break; // Frost bolt
45 case 47243: spellId = 88084; break; // Arcane Blast
46 case 47244: spellId = 88082; break; // Fireball
47 }
48
49 // Inherit Master's Threat List (not yet implemented)
51 // here mirror image casts on summoner spell (not present in client dbc) 49866
52 // here should be auras (not present in client dbc): 35657, 35658, 35659, 35660 selfcasted by mirror images (stats related?)
53 // Clone Me!
56 }
57
58 // Do not reload Creature templates on evade mode enter - prevent visual lost
60 {
61 if (me->IsInEvadeMode() || !me->IsAlive())
62 return;
63
64 Unit* owner = me->GetCharmerOrOwner();
65
66 me->CombatStop(true);
67 if (owner && !me->HasUnitState(UNIT_STATE_FOLLOW))
68 {
69 me->GetMotionMaster()->Clear(false);
70 me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle(), MOTION_SLOT_ACTIVE);
71 }
72 }
73
74 void UpdateAI(uint32 diff) override
75 {
76 if (!UpdateVictim() || me->HasUnitState(UNIT_STATE_CASTING))
77 return;
78
79 if (me->GetVictim()->GetSchoolImmunityMask() == SPELL_SCHOOL_MASK_ALL || me->GetVictim()->HasBreakableByDamageCrowdControlAura(me))
80 {
81 me->InterruptNonMeleeSpells(false);
83 return;
84 }
85
87 }
88 };
89
91 {
92 return new npc_pet_mage_mirror_imageAI(creature);
93 }
94};
95
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ MOTION_SLOT_ACTIVE
#define PET_FOLLOW_DIST
Definition PetDefines.h:57
@ SPELL_SCHOOL_MASK_ALL
@ UNIT_STATE_FOLLOW
Definition Unit.h:521
@ UNIT_STATE_CASTING
Definition Unit.h:527
void InitializeAI() OVERRIDE
Definition CombatAI.cpp:111
CasterAI(Creature *c)
Definition CombatAI.h:46
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:56
CreatureScript(const char *name)
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
Definition Unit.h:1367
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, uint64 originalCaster=0)
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition pet_mage.cpp:90
void AddSC_mage_pet_scripts()
Definition pet_mage.cpp:96
@ SPELL_MIRROR_IMAGE_COPY_WEAPONS
Definition pet_mage.cpp:19
@ SPELL_MIRROR_IMAGE_MASTERS_THREAT_LIST
Definition pet_mage.cpp:20
@ SPELL_MIRROR_IMAGE_CLONE_ME
Definition pet_mage.cpp:18
void UpdateAI(uint32 diff) override
== Triggered Actions Requested ==================
Definition pet_mage.cpp:74