Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ScriptPCH.h"
- enum eNums
- {
- SPELL_ICEARMOR = 36881,
- SPELL_FROSTBOLT = 59251,
- SPELL_PESTILENCE = 50842,
- SPELL_ENRAGE = 54287
- };
- class example : public CreatureScript
- {
- public:
- example() : CreatureScript("example"){}
- struct exampleAI : public ScriptedAI
- {
- exampleAI(Creature *c) : ScriptedAI(c) {} // typo found in Creature
- uint32 Icearmor_Timer;
- uint32 Frostbolt_Timer;
- uint32 Pestilence_Timer;
- uint32 Enrage_Timer;
- uint32 Phase; // Defined Phase
- void Reset()
- {
- Icearmor_Timer = 0;
- Frostbolt_Timer = 0;
- Pestilence_Timer = 5000;
- Enrage_Timer = 1500;
- Phase = 1; // Phase was undefined
- }
- void KilledUnit(Unit * /*victim*/)
- {
- }
- void JustDied(Unit * /*victim*/)
- {
- }
- void EnterCombat(Unit * /*who*/)
- {
- me->MonsterYell("if you see this then it works good job!", LANG_UNIVERSAL, NULL); // fixed typo in function name
- }
- void UpdateAI(const uint32 uiDiff)
- {
- if (!me->getVictim())
- {
- if (Icearmor_Timer <= uiDiff)
- {
- DoCast(me, SPELL_ICEARMOR);
- Icearmor_Timer = 18000000;
- }
- else
- Icearmor_Timer -= uiDiff;
- }
- if (!UpdateVictim())
- return;
- if (Enrage_Timer <= uiDiff) // fixed typo in uiDiff
- {
- DoCast(me, SPELL_ENRAGE);
- }
- if (Phase == 1 && me->GetHealthPct() <= 55) // fixed () error and made it simpler
- {
- Phase = 2;
- }
- if (Phase == 1) // Fixed typo in Phase
- {
- if (Frostbolt_Timer <= uiDiff)
- {
- DoCast(me->getVictim(), SPELL_FROSTBOLT);
- Frostbolt_Timer = 3000;
- }
- else
- Frostbolt_Timer -= uiDiff;
- if (Pestilence_Timer <= uiDiff) // Deleted ; causing errors
- {
- if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0)) // Fixed typo in pTarget and fixed SelectTarget function
- DoCast(pTarget, SPELL_PESTILENCE);
- Pestilence_Timer = 10000;
- }
- else
- Pestilence_Timer -= uiDiff;
- }
- if (Phase == 2)
- {
- DoCast(me->getVictim(), SPELL_FROSTBOLT);
- Frostbolt_Timer = 3000; // missing ;
- }
- else
- Frostbolt_Timer -= uiDiff; // uiDiff typo
- DoMeleeAttackIfReady(); // not inside a hook, fixed
- }
- CreatureAI* GetAI_example(Creature* pCreature) const // was possibly in wrong place
- {
- return new exampleAI(pCreature);
- };
- };
- };
- void AddSC_example()
- {
- new example();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement