|
15 | 15 | * with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 | */ |
17 | 17 |
|
18 | | -/* ScriptData |
19 | | -SDName: Thunder_Bluff |
20 | | -SD%Complete: 100 |
21 | | -SDComment: Quest support: 925 |
22 | | -SDCategory: Thunder Bluff |
23 | | -EndScriptData */ |
24 | | - |
25 | 18 | #include "ScriptMgr.h" |
26 | 19 | #include "ScriptedCreature.h" |
27 | 20 | #include "ScriptedGossip.h" |
28 | 21 | #include "Player.h" |
29 | 22 |
|
30 | | -/*##### |
31 | | -# npc_cairne_bloodhoof |
32 | | -######*/ |
33 | | - |
34 | 23 | enum CairneBloodhoof |
35 | 24 | { |
36 | | - SPELL_BERSERKER_CHARGE = 16636, |
37 | | - SPELL_CLEAVE = 16044, |
| 25 | + SAY_EVADE = 0, |
| 26 | + |
| 27 | + SPELL_CLEAVE = 15284, |
38 | 28 | SPELL_MORTAL_STRIKE = 16856, |
39 | 29 | SPELL_THUNDERCLAP = 23931, |
40 | | - SPELL_UPPERCUT = 22916 |
41 | | -}; |
| 30 | + SPELL_UPPERCUT = 22916, |
| 31 | + SPELL_WAR_STOMP = 59705, |
42 | 32 |
|
43 | | -enum Sounds |
44 | | -{ |
45 | | - SOUND_AGGRO = 5884 |
46 | | -}; |
| 33 | + SPELL_CAIRNES_HOOFPRINT = 23123, |
47 | 34 |
|
48 | | -enum Gossips |
49 | | -{ |
50 | | - GOSSIP_MENU_HCB = 5851, |
51 | | - GOSSIP_OPTION_HCB = 0 |
| 35 | + EVENT_CLEAVE = 1, |
| 36 | + EVENT_MORTAL_STRIKE = 2, |
| 37 | + EVENT_THUNDERCLAP = 3, |
| 38 | + EVENT_UPPERCUT = 4, |
| 39 | + EVENT_WAR_STOMP = 5, |
| 40 | + |
| 41 | + SOUND_AGGRO = 5884 |
52 | 42 | }; |
53 | 43 |
|
54 | | -/// @todo verify abilities/timers |
55 | | -class npc_cairne_bloodhoof : public CreatureScript |
| 44 | +// 3057 - Cairne Bloodhoof |
| 45 | +struct npc_cairne_bloodhoof : public ScriptedAI |
56 | 46 | { |
57 | | -public: |
58 | | - npc_cairne_bloodhoof() : CreatureScript("npc_cairne_bloodhoof") { } |
| 47 | + npc_cairne_bloodhoof(Creature* creature) : ScriptedAI(creature) { } |
59 | 48 |
|
60 | | - struct npc_cairne_bloodhoofAI : public ScriptedAI |
| 49 | + void Reset() override |
61 | 50 | { |
62 | | - npc_cairne_bloodhoofAI(Creature* creature) : ScriptedAI(creature) |
63 | | - { |
64 | | - Initialize(); |
65 | | - } |
66 | | - |
67 | | - void Initialize() |
68 | | - { |
69 | | - BerserkerChargeTimer = 30000; |
70 | | - CleaveTimer = 5000; |
71 | | - MortalStrikeTimer = 10000; |
72 | | - ThunderclapTimer = 15000; |
73 | | - UppercutTimer = 10000; |
74 | | - } |
75 | | - |
76 | | - uint32 BerserkerChargeTimer; |
77 | | - uint32 CleaveTimer; |
78 | | - uint32 MortalStrikeTimer; |
79 | | - uint32 ThunderclapTimer; |
80 | | - uint32 UppercutTimer; |
81 | | - |
82 | | - void Reset() override |
83 | | - { |
84 | | - Initialize(); |
85 | | - } |
86 | | - |
87 | | - void JustEngagedWith(Unit* /*who*/) override |
88 | | - { |
89 | | - DoPlaySoundToSet(me, SOUND_AGGRO); |
90 | | - } |
91 | | - |
92 | | - void UpdateAI(uint32 diff) override |
93 | | - { |
94 | | - if (!UpdateVictim()) |
95 | | - return; |
| 51 | + _events.Reset(); |
| 52 | + } |
96 | 53 |
|
97 | | - if (BerserkerChargeTimer <= diff) |
98 | | - { |
99 | | - if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0)) |
100 | | - DoCast(target, SPELL_BERSERKER_CHARGE); |
101 | | - BerserkerChargeTimer = 25000; |
102 | | - } else BerserkerChargeTimer -= diff; |
| 54 | + void JustEngagedWith(Unit* /*who*/) override |
| 55 | + { |
| 56 | + DoPlaySoundToSet(me, SOUND_AGGRO); |
103 | 57 |
|
104 | | - if (UppercutTimer <= diff) |
105 | | - { |
106 | | - DoCastVictim(SPELL_UPPERCUT); |
107 | | - UppercutTimer = 20000; |
108 | | - } else UppercutTimer -= diff; |
| 58 | + _events.ScheduleEvent(EVENT_CLEAVE, 5s, 10s); |
| 59 | + _events.ScheduleEvent(EVENT_MORTAL_STRIKE, 10s, 15s); |
| 60 | + _events.ScheduleEvent(EVENT_THUNDERCLAP, 15s, 20s); |
| 61 | + _events.ScheduleEvent(EVENT_UPPERCUT, 10s, 20s); |
| 62 | + _events.ScheduleEvent(EVENT_WAR_STOMP, 25s, 30s); |
| 63 | + } |
109 | 64 |
|
110 | | - if (ThunderclapTimer <= diff) |
111 | | - { |
112 | | - DoCastVictim(SPELL_THUNDERCLAP); |
113 | | - ThunderclapTimer = 15000; |
114 | | - } else ThunderclapTimer -= diff; |
| 65 | + void EnterEvadeMode(EvadeReason why) override |
| 66 | + { |
| 67 | + Talk(SAY_EVADE); |
| 68 | + ScriptedAI::EnterEvadeMode(why); |
| 69 | + } |
115 | 70 |
|
116 | | - if (MortalStrikeTimer <= diff) |
117 | | - { |
118 | | - DoCastVictim(SPELL_MORTAL_STRIKE); |
119 | | - MortalStrikeTimer = 15000; |
120 | | - } else MortalStrikeTimer -= diff; |
| 71 | + void UpdateAI(uint32 diff) override |
| 72 | + { |
| 73 | + if (!UpdateVictim()) |
| 74 | + return; |
121 | 75 |
|
122 | | - if (CleaveTimer <= diff) |
123 | | - { |
124 | | - DoCastVictim(SPELL_CLEAVE); |
125 | | - CleaveTimer = 7000; |
126 | | - } else CleaveTimer -= diff; |
| 76 | + if (me->HasUnitState(UNIT_STATE_CASTING)) |
| 77 | + return; |
127 | 78 |
|
128 | | - DoMeleeAttackIfReady(); |
129 | | - } |
| 79 | + _events.Update(diff); |
130 | 80 |
|
131 | | - bool OnGossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override |
| 81 | + while (uint32 eventId = _events.ExecuteEvent()) |
132 | 82 | { |
133 | | - uint32 const action = player->PlayerTalkClass->GetGossipOptionAction(gossipListId); |
134 | | - ClearGossipMenuFor(player); |
135 | | - if (action == GOSSIP_SENDER_INFO) |
| 83 | + switch (eventId) |
136 | 84 | { |
137 | | - player->CastSpell(player, 23123, false); |
138 | | - SendGossipMenuFor(player, 7014, me->GetGUID()); |
| 85 | + case EVENT_CLEAVE: |
| 86 | + DoCastVictim(SPELL_CLEAVE); |
| 87 | + _events.Repeat(5s, 10s); |
| 88 | + break; |
| 89 | + case EVENT_MORTAL_STRIKE: |
| 90 | + DoCastVictim(SPELL_MORTAL_STRIKE); |
| 91 | + _events.Repeat(10s, 15s); |
| 92 | + break; |
| 93 | + case EVENT_THUNDERCLAP: |
| 94 | + DoCastSelf(SPELL_THUNDERCLAP); |
| 95 | + _events.Repeat(15s, 20s); |
| 96 | + break; |
| 97 | + case EVENT_UPPERCUT: |
| 98 | + DoCastVictim(SPELL_UPPERCUT); |
| 99 | + _events.Repeat(20s, 25s); |
| 100 | + break; |
| 101 | + case EVENT_WAR_STOMP: |
| 102 | + DoCastSelf(SPELL_WAR_STOMP); |
| 103 | + _events.Repeat(25s, 30s); |
| 104 | + break; |
| 105 | + default: |
| 106 | + break; |
139 | 107 | } |
140 | | - return true; |
141 | | - } |
142 | | - |
143 | | - bool OnGossipHello(Player* player) override |
144 | | - { |
145 | | - InitGossipMenuFor(player, GOSSIP_MENU_HCB); |
146 | | - if (me->IsQuestGiver()) |
147 | | - player->PrepareQuestMenu(me->GetGUID()); |
148 | | - |
149 | | - if (player->GetQuestStatus(925) == QUEST_STATUS_INCOMPLETE) |
150 | | - AddGossipItemFor(player, GOSSIP_MENU_HCB, GOSSIP_OPTION_HCB, GOSSIP_SENDER_MAIN, GOSSIP_SENDER_INFO); |
151 | 108 |
|
152 | | - SendGossipMenuFor(player, 7013, me->GetGUID()); |
153 | | - |
154 | | - return true; |
| 109 | + if (me->HasUnitState(UNIT_STATE_CASTING)) |
| 110 | + return; |
155 | 111 | } |
156 | | - }; |
157 | 112 |
|
158 | | - CreatureAI* GetAI(Creature* creature) const override |
| 113 | + DoMeleeAttackIfReady(); |
| 114 | + } |
| 115 | + |
| 116 | + bool OnGossipSelect(Player* player, uint32 /*menuId*/, uint32 /*gossipListId*/) override |
159 | 117 | { |
160 | | - return new npc_cairne_bloodhoofAI(creature); |
| 118 | + DoCast(player, SPELL_CAIRNES_HOOFPRINT); |
| 119 | + return false; |
161 | 120 | } |
| 121 | + |
| 122 | +private: |
| 123 | + EventMap _events; |
162 | 124 | }; |
163 | 125 |
|
164 | 126 | void AddSC_thunder_bluff() |
165 | 127 | { |
166 | | - new npc_cairne_bloodhoof(); |
| 128 | + RegisterCreatureAI(npc_cairne_bloodhoof); |
167 | 129 | } |
0 commit comments