Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_salramm_the_fleshcrafter.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/* Script Data Start
7SDName: Boss salramm
8SDAuthor: Tartalo
9SD%Complete: 80
10SDComment: @todo Intro
11SDCategory:
12Script Data End */
13
14#include "ScriptMgr.h"
15#include "ScriptedCreature.h"
17
28
39
41{
42public:
43 boss_salramm() : CreatureScript("boss_salramm") { }
44
46 {
47 return new boss_salrammAI(creature);
48 }
49
50 struct boss_salrammAI : public ScriptedAI
51 {
52 boss_salrammAI(Creature* creature) : ScriptedAI(creature)
53 {
54 instance = creature->GetInstanceScript();
55 if (instance)
57 }
58
64
66
68 {
69 uiCurseFleshTimer = 30000; //30s DBM
70 uiExplodeGhoulTimer = std::rand() % 28000 + 25000; //approx 6 sec after summon ghouls
71 uiShadowBoltTimer = std::rand() % 12000 + 8000; // approx 10s
72 uiStealFleshTimer = 12345;
73 uiSummonGhoulsTimer = std::rand() % 24000 + 19000; //on a video approx 24s after aggro
74
75 if (instance)
77 }
78
79 void EnterCombat(Unit* /*who*/) OVERRIDE
80 {
82
83 if (instance)
85 }
86
88 {
89 //Return since we have no target
90 if (!UpdateVictim())
91 return;
92
93 //Curse of twisted flesh timer
94 if (uiCurseFleshTimer <= diff)
95 {
97 uiCurseFleshTimer = 37000;
98 } else uiCurseFleshTimer -= diff;
99
100 //Shadow bolt timer
101 if (uiShadowBoltTimer <= diff)
102 {
103 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
104 DoCast(target, SPELL_SHADOW_BOLT);
105 uiShadowBoltTimer = std::rand() % 12000 + 8000;
106 } else uiShadowBoltTimer -= diff;
107
108 //Steal Flesh timer
109 if (uiStealFleshTimer <= diff)
110 {
112 if (Unit* random_pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0))
113 DoCast(random_pTarget, SPELL_STEAL_FLESH);
114 uiStealFleshTimer = 10000;
115 } else uiStealFleshTimer -= diff;
116
117 //Summon ghouls timer
118 if (uiSummonGhoulsTimer <= diff)
119 {
121 if (Unit* random_pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0))
122 DoCast(random_pTarget, SPELL_SUMMON_GHOULS);
123 uiSummonGhoulsTimer = 10000;
124 } else uiSummonGhoulsTimer -= diff;
125
127 }
128
129 void JustDied(Unit* /*killer*/) OVERRIDE
130 {
132
133 if (instance)
135 }
136
138 {
139 if (victim->GetTypeId() != TypeID::TYPEID_PLAYER)
140 return;
141
142 Talk(SAY_SLAY);
143 }
144 };
145};
146
148{
149 new boss_salramm();
150}
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
@ TYPEID_PLAYER
Definition Object.h:55
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ SAY_SLAY
#define SAY_DEATH
#define SAY_AGGRO
@ SPELL_SHADOW_BOLT
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
Definition UnitAI.cpp:66
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
Definition Unit.h:1367
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
CreatureAI * GetAI(Creature *creature) const OVERRIDE
@ DATA_SALRAMM_EVENT
ScriptedAI(Creature *creature)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================