TrinityCore
Loading...
Searching...
No Matches
boss_renataki.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "zulgurub.h"
19#include "ScriptedCreature.h"
20#include "ScriptMgr.h"
21
23{
24 SPELL_AMBUSH = 34794,
26};
27
28enum Misc
29{
30 EQUIP_ID_MAIN_HAND = 0 // was item display id 31818, but this id does not exist
31};
32
33struct boss_renataki : public BossAI
34{
36 {
37 Initialize();
38 }
39
41 {
42 _invisibleTimer = urand(8000, 18000);
43 _ambushTimer = 3000;
44 _visibleTimer = 4000;
45 _aggroTimer = urand(15000, 25000);
46 _thousandBladesTimer = urand(4000, 8000);
47 _invisible = false;
48 _ambushed = false;
49 }
50
51 void Reset() override
52 {
53 _Reset();
54 Initialize();
55 }
56
57 void UpdateAI(uint32 diff) override
58 {
59 if (!UpdateVictim())
60 return;
61
62 if (_invisibleTimer <= diff)
63 {
66 me->SetDisplayId(11686);
68 _invisible = true;
69 _invisibleTimer = urand(15000, 30000);
70 }
71 else
72 _invisibleTimer -= diff;
73
74 if (_invisible)
75 {
76 if (_ambushTimer <= diff)
77 {
78 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
79 {
80 DoTeleportTo(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ());
81 DoCast(target, SPELL_AMBUSH);
82 }
83
84 _ambushed = true;
85 _ambushTimer = 3000;
86 }
87 else
88 _ambushTimer -= diff;
89 }
90
91 if (_ambushed)
92 {
93 if (_visibleTimer <= diff)
94 {
96 me->SetDisplayId(15268);
99 _invisible = false;
100 _visibleTimer = 4000;
101 }
102 else
103 _visibleTimer -= diff;
104 }
105
106 // Resetting some aggro so he attacks other gamers
107 if (!_invisible)
108 {
109 if (_aggroTimer <= diff)
110 {
111 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
112 {
113 if (GetThreat(me->GetVictim()))
115 AttackStart(target);
116 }
117
118 _aggroTimer = urand(7000, 20000);
119 }
120 else
121 _aggroTimer -= diff;
122
123 if (_thousandBladesTimer <= diff)
124 {
126 _thousandBladesTimer = urand(7000, 12000);
127 }
128 else
129 _thousandBladesTimer -= diff;
130 }
131
133 }
134
135private:
143};
144
@ EQUIP_UNEQUIP
Definition CreatureAI.h:76
@ EQUIP_NO_CHANGE
Definition CreatureAI.h:75
uint32_t uint32
Definition Define.h:133
Spells
Definition PlayerAI.cpp:32
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
@ UNIT_FLAG_UNINTERACTIBLE
@ CURRENT_GENERIC_SPELL
Definition Unit.h:607
@ EQUIP_ID_MAIN_HAND
@ SPELL_THOUSANDBLADES
@ SPELL_AMBUSH
void AddSC_boss_renataki()
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void SetDisplayId(uint32 modelId) override
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, SpellCastResult result=SPELL_FAILED_INTERRUPTED, Optional< SpellCastResult > resultOther={})
Definition Unit.cpp:3021
Unit * GetVictim() const
Definition Unit.h:859
void SetUnitFlag(UnitFlags flags)
Definition Unit.h:954
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:955
void SetEquipmentSlots(bool loadDefault, int32 mainHand=EQUIP_NO_CHANGE, int32 offHand=EQUIP_NO_CHANGE, int32 ranged=EQUIP_NO_CHANGE)
void AttackStart(Unit *) override
void DoTeleportTo(float x, float y, float z, uint32 time=0)
float GetThreat(Unit const *victim, Unit const *who=nullptr)
void ModifyThreatByPercent(Unit *victim, int32 pct, Unit *who=nullptr)
uint32 _thousandBladesTimer
boss_renataki(Creature *creature)
void UpdateAI(uint32 diff) override
void Reset() override
#define RegisterZulGurubCreatureAI(ai_name)
Definition zulgurub.h:91
@ DATA_EDGE_OF_MADNESS
Definition zulgurub.h:39