|
15 | 15 | * with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 | */ |
17 | 17 |
|
18 | | -/* ScriptData |
19 | | -SDName: Boss_Celebras_the_Cursed |
20 | | -SD%Complete: 100 |
21 | | -SDComment: |
22 | | -SDCategory: Maraudon |
23 | | -EndScriptData */ |
24 | | - |
25 | 18 | #include "ScriptMgr.h" |
26 | 19 | #include "maraudon.h" |
27 | 20 | #include "ScriptedCreature.h" |
28 | 21 |
|
29 | | -enum Spells |
| 22 | +enum CelebrasSpells |
30 | 23 | { |
31 | 24 | SPELL_WRATH = 21807, |
32 | | - SPELL_ENTANGLINGROOTS = 12747, |
| 25 | + SPELL_ENTANGLING_ROOTS = 12747, |
33 | 26 | SPELL_CORRUPT_FORCES = 21968 |
34 | 27 | }; |
35 | 28 |
|
36 | | -class celebras_the_cursed : public CreatureScript |
| 29 | +enum CelebrasMisc |
| 30 | +{ |
| 31 | + NPC_CELEBRAS_THE_REDEEMED = 13716 |
| 32 | +}; |
| 33 | + |
| 34 | +// 12225 - Celebras the Cursed |
| 35 | +struct boss_celebras_the_cursed : public ScriptedAI |
37 | 36 | { |
38 | | -public: |
39 | | - celebras_the_cursed() : CreatureScript("celebras_the_cursed") { } |
| 37 | + boss_celebras_the_cursed(Creature* creature) : ScriptedAI(creature) { } |
40 | 38 |
|
41 | | - CreatureAI* GetAI(Creature* creature) const override |
| 39 | + void Reset() override |
42 | 40 | { |
43 | | - return GetMaraudonAI<celebras_the_cursedAI>(creature); |
| 41 | + _scheduler.CancelAll(); |
44 | 42 | } |
45 | 43 |
|
46 | | - struct celebras_the_cursedAI : public ScriptedAI |
| 44 | + void JustEngagedWith(Unit* /*who*/) override |
47 | 45 | { |
48 | | - celebras_the_cursedAI(Creature* creature) : ScriptedAI(creature) |
49 | | - { |
50 | | - Initialize(); |
51 | | - } |
52 | | - |
53 | | - void Initialize() |
54 | | - { |
55 | | - WrathTimer = 8000; |
56 | | - EntanglingRootsTimer = 2000; |
57 | | - CorruptForcesTimer = 30000; |
58 | | - } |
59 | | - |
60 | | - uint32 WrathTimer; |
61 | | - uint32 EntanglingRootsTimer; |
62 | | - uint32 CorruptForcesTimer; |
63 | | - |
64 | | - void Reset() override |
65 | | - { |
66 | | - Initialize(); |
67 | | - } |
68 | | - |
69 | | - void JustEngagedWith(Unit* /*who*/) override { } |
70 | | - |
71 | | - void JustDied(Unit* /*killer*/) override |
72 | | - { |
73 | | - me->SummonCreature(13716, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10min); |
74 | | - } |
75 | | - |
76 | | - void UpdateAI(uint32 diff) override |
77 | | - { |
78 | | - if (!UpdateVictim()) |
79 | | - return; |
80 | | - |
81 | | - //Wrath |
82 | | - if (WrathTimer <= diff) |
| 46 | + _scheduler |
| 47 | + .SetValidator([this] |
83 | 48 | { |
84 | | - if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0)) |
85 | | - DoCast(target, SPELL_WRATH); |
86 | | - WrathTimer = 8000; |
87 | | - } |
88 | | - else WrathTimer -= diff; |
89 | | - |
90 | | - //EntanglingRoots |
91 | | - if (EntanglingRootsTimer <= diff) |
| 49 | + return !me->HasUnitState(UNIT_STATE_CASTING); |
| 50 | + }) |
| 51 | + .Schedule(0s, 6s, [this](TaskContext task) |
92 | 52 | { |
93 | | - DoCastVictim(SPELL_ENTANGLINGROOTS); |
94 | | - EntanglingRootsTimer = 20000; |
95 | | - } |
96 | | - else EntanglingRootsTimer -= diff; |
97 | | - |
98 | | - //CorruptForces |
99 | | - if (CorruptForcesTimer <= diff) |
| 53 | + DoCastVictim(SPELL_WRATH); |
| 54 | + task.Repeat(4s, 8s); |
| 55 | + }) |
| 56 | + .Schedule(0s, 5s, [this](TaskContext task) |
100 | 57 | { |
101 | | - me->InterruptNonMeleeSpells(false); |
102 | | - DoCast(me, SPELL_CORRUPT_FORCES); |
103 | | - CorruptForcesTimer = 20000; |
104 | | - } |
105 | | - else CorruptForcesTimer -= diff; |
| 58 | + DoCastVictim(SPELL_ENTANGLING_ROOTS); |
| 59 | + task.Repeat(20s); |
| 60 | + }) |
| 61 | + .Schedule(30s, [this](TaskContext task) |
| 62 | + { |
| 63 | + DoCastSelf(SPELL_CORRUPT_FORCES); |
| 64 | + task.Repeat(20s); |
| 65 | + }); |
| 66 | + } |
| 67 | + |
| 68 | + void JustDied(Unit* /*killer*/) override |
| 69 | + { |
| 70 | + me->SummonCreature(NPC_CELEBRAS_THE_REDEEMED, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_MANUAL_DESPAWN); |
| 71 | + } |
| 72 | + |
| 73 | + void UpdateAI(uint32 diff) override |
| 74 | + { |
| 75 | + if (!UpdateVictim()) |
| 76 | + return; |
106 | 77 |
|
| 78 | + _scheduler.Update(diff, [this] |
| 79 | + { |
107 | 80 | DoMeleeAttackIfReady(); |
108 | | - } |
109 | | - }; |
| 81 | + }); |
| 82 | + } |
| 83 | + |
| 84 | +private: |
| 85 | + TaskScheduler _scheduler; |
110 | 86 | }; |
111 | 87 |
|
112 | 88 | void AddSC_boss_celebras_the_cursed() |
113 | 89 | { |
114 | | - new celebras_the_cursed(); |
| 90 | + RegisterMaraudonCreatureAI(boss_celebras_the_cursed); |
115 | 91 | } |
0 commit comments