SHOW:
|
|
- or go back to the newest paste.
1 | #include "ScriptPCH.h" | |
2 | ||
3 | enum eNums | |
4 | { | |
5 | SPELL_ICEARMOR = 36881, | |
6 | SPELL_FROSTBOLT = 59251, | |
7 | SPELL_PESTILENCE = 50842, | |
8 | SPELL_ENRAGE = 54287 | |
9 | ||
10 | }; | |
11 | ||
12 | class example : public CreatureScript | |
13 | { | |
14 | public: | |
15 | - | example() : CreatureScript("example"){} |
15 | + | example() : CreatureScript("example"){} |
16 | ||
17 | - | CreatureAI* GetAI_example(Creature* pCreature) const |
17 | + | struct exampleAI : public ScriptedAI |
18 | { | |
19 | exampleAI(Creature *c) : ScriptedAI(c) {} // typo found in Creature | |
20 | ||
21 | uint32 Icearmor_Timer; | |
22 | - | struct exampleAI : public ScriptedAI |
22 | + | uint32 Frostbolt_Timer; |
23 | uint32 Pestilence_Timer; | |
24 | - | exampleAI(Craeture *c) : ScriptedAI(c) {} |
24 | + | uint32 Enrage_Timer; |
25 | uint32 Phase; // Defined Phase | |
26 | - | uint32 Icearmor_Timer; |
26 | + | |
27 | - | uint32 Frostbolt_Timer; |
27 | + | void Reset() |
28 | - | uint32 Pestilence_Timer; |
28 | + | |
29 | - | uint32 Enrage_Timer; |
29 | + | Icearmor_Timer = 0; |
30 | Frostbolt_Timer = 0; | |
31 | - | |
31 | + | Pestilence_Timer = 5000; |
32 | - | |
32 | + | Enrage_Timer = 1500; |
33 | - | void Reset() |
33 | + | |
34 | Phase = 1; // Phase was undefined | |
35 | - | Icearmor_Timer = 0; |
35 | + | |
36 | - | Frostbolt_Timer = 0; |
36 | + | |
37 | - | Pestilence_Timer = 5000; |
37 | + | void KilledUnit(Unit * /*victim*/) |
38 | - | Enrage_Timer = 1500; |
38 | + | |
39 | } | |
40 | - | Phase = 1; |
40 | + | |
41 | void JustDied(Unit * /*victim*/) | |
42 | { | |
43 | - | void KilledUnit(Unit * /*victim*/) |
43 | + | |
44 | ||
45 | void EnterCombat(Unit * /*who*/) | |
46 | { | |
47 | - | void JustDied(Unit * /*victim*/) |
47 | + | me->MonsterYell("if you see this then it works good job!", LANG_UNIVERSAL, NULL); // fixed typo in function name |
48 | } | |
49 | ||
50 | void UpdateAI(const uint32 uiDiff) | |
51 | - | void EnterCombat(Unit * /*who*/) |
51 | + | |
52 | if (!me->getVictim()) | |
53 | - | me->Monsteryell(Test,"if you see this then it works good job!", LANG_UNIVERSAL, NULL); |
53 | + | |
54 | if (Icearmor_Timer <= uiDiff) | |
55 | { | |
56 | - | void UpdateAI(const uint32 uiDiff) |
56 | + | |
57 | Icearmor_Timer = 18000000; | |
58 | - | if (!me->getVictim()) |
58 | + | } |
59 | else | |
60 | - | if (Icearmor_Timer <= uiDiff) |
60 | + | |
61 | } | |
62 | ||
63 | if (!UpdateVictim()) | |
64 | return; | |
65 | ||
66 | if (Enrage_Timer <= uiDiff) // fixed typo in uiDiff | |
67 | { | |
68 | DoCast(me, SPELL_ENRAGE); | |
69 | - | if (!UpdateVictim()) |
69 | + | |
70 | - | return; |
70 | + | |
71 | - | |
71 | + | if (Phase == 1 && me->GetHealthPct() <= 55) // fixed () error and made it simpler |
72 | - | if (Enrage_Timer <=uiDIff) |
72 | + | |
73 | - | { |
73 | + | Phase = 2; |
74 | - | DoCast(me, SPELL_ENRAGE); |
74 | + | |
75 | - | } |
75 | + | |
76 | - | |
76 | + | if (Phase == 1) // Fixed typo in Phase |
77 | - | if (((me->GetHealth()*100 / me->GetMaxHealth())) <55) && (Phase == 1)) |
77 | + | |
78 | - | { |
78 | + | |
79 | - | Phase = 2; |
79 | + | if (Frostbolt_Timer <= uiDiff) |
80 | - | } |
80 | + | { |
81 | DoCast(me->getVictim(), SPELL_FROSTBOLT); | |
82 | - | if (Phasae == 1) |
82 | + | Frostbolt_Timer = 3000; |
83 | - | { |
83 | + | } |
84 | else | |
85 | - | if (Frostbolt_Timer <= uiDiff) |
85 | + | Frostbolt_Timer -= uiDiff; |
86 | - | { |
86 | + | if (Pestilence_Timer <= uiDiff) // Deleted ; causing errors |
87 | - | Docast(me->getVictim(), SPELL_FROSTBOLT); |
87 | + | { |
88 | - | Frostbolt_Timer = 3000; |
88 | + | if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0)) // Fixed typo in pTarget and fixed SelectTarget function |
89 | - | } |
89 | + | DoCast(pTarget, SPELL_PESTILENCE); |
90 | - | else |
90 | + | Pestilence_Timer = 10000; |
91 | - | Frostbolt_Timer -= uiDiff; |
91 | + | } |
92 | - | if (Pestilence_Timer <= uiDiff;) |
92 | + | else |
93 | - | { |
93 | + | Pestilence_Timer -= uiDiff; |
94 | - | if (Unit *ptarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) |
94 | + | |
95 | - | DoCast(pTarget, SPELL_PESTILENCE); |
95 | + | |
96 | - | |
96 | + | if (Phase == 2) |
97 | - | Pestilence_Timer = 10000; |
97 | + | |
98 | - | } |
98 | + | DoCast(me->getVictim(), SPELL_FROSTBOLT); |
99 | - | else |
99 | + | Frostbolt_Timer = 3000; // missing ; |
100 | - | Pestilence_Timer -= uiDiff; |
100 | + | |
101 | - | } |
101 | + | |
102 | Frostbolt_Timer -= uiDiff; // uiDiff typo | |
103 | - | if (Phase == 2) |
103 | + | DoMeleeAttackIfReady(); // not inside a hook, fixed |
104 | - | { |
104 | + | |
105 | - | DoCast(me->getVictim(), SPELL_FROSTBOLT); |
105 | + | |
106 | - | Frostbolt_Timer = 3000 |
106 | + | CreatureAI* GetAI_example(Creature* pCreature) const // was possibly in wrong place |
107 | - | } |
107 | + | |
108 | - | else |
108 | + | |
109 | - | Frostbolt_Timer -= uiDIff; |
109 | + | |
110 | - | } |
110 | + | }; |
111 | - | |
111 | + | }; |
112 | - | DoMeleeAttackIfReady(); |
112 | + | |
113 | void AddSC_example() | |
114 | { | |
115 | new example(); | |
116 | } |