Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
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
16
enum
MageSpells
17
{
18
SPELL_MIRROR_IMAGE_CLONE_ME
= 45204,
19
SPELL_MIRROR_IMAGE_COPY_WEAPONS
= 41054,
20
SPELL_MIRROR_IMAGE_MASTERS_THREAT_LIST
= 58838,
21
};
22
23
class
npc_pet_mage_mirror_image
:
public
CreatureScript
24
{
25
public
:
26
npc_pet_mage_mirror_image
() :
CreatureScript
(
"npc_pet_mage_mirror_image"
) { }
27
28
struct
npc_pet_mage_mirror_imageAI
:
CasterAI
29
{
30
npc_pet_mage_mirror_imageAI
(
Creature
* creature) :
CasterAI
(creature) { }
31
32
uint32
spellId
= 0;
33
34
void
InitializeAI
()
OVERRIDE
35
{
36
CasterAI::InitializeAI
();
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)
50
me
->CastSpell(
me
,
SPELL_MIRROR_IMAGE_MASTERS_THREAT_LIST
,
true
);
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!
54
owner->
CastSpell
(
me
,
SPELL_MIRROR_IMAGE_CLONE_ME
,
true
);
55
owner->
CastSpell
(
me
,
SPELL_MIRROR_IMAGE_COPY_WEAPONS
,
true
);
56
}
57
58
// Do not reload Creature templates on evade mode enter - prevent visual lost
59
void
EnterEvadeMode
()
OVERRIDE
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
);
82
EnterEvadeMode
();
83
return
;
84
}
85
86
DoCastVictim
(
spellId
);
87
}
88
};
89
90
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
91
{
92
return
new
npc_pet_mage_mirror_imageAI
(creature);
93
}
94
};
95
96
void
AddSC_mage_pet_scripts
()
97
{
98
new
npc_pet_mage_mirror_image
();
99
}
CombatAI.h
uint32
std::uint32_t uint32
Definition
Define.h:77
OVERRIDE
#define OVERRIDE
Definition
Define.h:60
MOTION_SLOT_ACTIVE
@ MOTION_SLOT_ACTIVE
Definition
MotionMaster.h:48
Pet.h
PET_FOLLOW_DIST
#define PET_FOLLOW_DIST
Definition
PetDefines.h:57
ScriptMgr.h
ScriptedCreature.h
SPELL_SCHOOL_MASK_ALL
@ SPELL_SCHOOL_MASK_ALL
Definition
SharedDefines.h:288
UNIT_STATE_FOLLOW
@ UNIT_STATE_FOLLOW
Definition
Unit.h:521
UNIT_STATE_CASTING
@ UNIT_STATE_CASTING
Definition
Unit.h:527
MageSpells
MageSpells
Definition
boss_priestess_delrissa.cpp:733
CasterAI::InitializeAI
void InitializeAI() OVERRIDE
Definition
CombatAI.cpp:111
CasterAI::CasterAI
CasterAI(Creature *c)
Definition
CombatAI.h:46
CreatureAI
Definition
CreatureAI.h:54
CreatureAI::UpdateVictim
bool UpdateVictim()
Definition
CreatureAI.cpp:192
CreatureAI::me
Creature *const me
Definition
CreatureAI.h:56
Creature
Definition
Creature.h:427
CreatureScript::CreatureScript
CreatureScript(const char *name)
Definition
ScriptMgr.cpp:1436
UnitAI::DoCastVictim
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition
UnitAI.cpp:168
Unit
Definition
Unit.h:1367
Unit::CastSpell
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)
Definition
UnitCombat.cpp:324
npc_pet_mage_mirror_image
Definition
pet_mage.cpp:24
npc_pet_mage_mirror_image::npc_pet_mage_mirror_image
npc_pet_mage_mirror_image()
Definition
pet_mage.cpp:26
npc_pet_mage_mirror_image::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
pet_mage.cpp:90
AddSC_mage_pet_scripts
void AddSC_mage_pet_scripts()
Definition
pet_mage.cpp:96
SPELL_MIRROR_IMAGE_COPY_WEAPONS
@ SPELL_MIRROR_IMAGE_COPY_WEAPONS
Definition
pet_mage.cpp:19
SPELL_MIRROR_IMAGE_MASTERS_THREAT_LIST
@ SPELL_MIRROR_IMAGE_MASTERS_THREAT_LIST
Definition
pet_mage.cpp:20
SPELL_MIRROR_IMAGE_CLONE_ME
@ SPELL_MIRROR_IMAGE_CLONE_ME
Definition
pet_mage.cpp:18
npc_pet_mage_mirror_image::npc_pet_mage_mirror_imageAI
Definition
pet_mage.cpp:29
npc_pet_mage_mirror_image::npc_pet_mage_mirror_imageAI::UpdateAI
void UpdateAI(uint32 diff) override
== Triggered Actions Requested ==================
Definition
pet_mage.cpp:74
npc_pet_mage_mirror_image::npc_pet_mage_mirror_imageAI::InitializeAI
void InitializeAI() OVERRIDE
Definition
pet_mage.cpp:34
npc_pet_mage_mirror_image::npc_pet_mage_mirror_imageAI::spellId
uint32 spellId
Definition
pet_mage.cpp:32
npc_pet_mage_mirror_image::npc_pet_mage_mirror_imageAI::EnterEvadeMode
void EnterEvadeMode() OVERRIDE
Definition
pet_mage.cpp:59
npc_pet_mage_mirror_image::npc_pet_mage_mirror_imageAI::npc_pet_mage_mirror_imageAI
npc_pet_mage_mirror_imageAI(Creature *creature)
Definition
pet_mage.cpp:30
src
server
scripts
Pet
pet_mage.cpp
Generated on
for Project SkyFire Core by
1.17.0