Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool bPointReached;
- bool bClockwise;
- uint32 uiTimer;
- uint32 uiCheckTimer;
- float x, y, r, c, mx, my;
- void Reset()
- {
- me->AddUnitMovementFlag(MOVEFLAG_LEVITATING);
- bPointReached = true;
- uiTimer = urand(500,1000);
- uiCheckTimer = 1000;
- r = 17;
- c = 0;
- mx = ShieldOrbLocations[0][0];
- my = ShieldOrbLocations[0][1];
- bClockwise = urand(0,1);
- }
- void UpdateAI(const uint32 diff)
- {
- if (bPointReached)
- {
- if (bClockwise)
- {
- y = my - r * sin(c);
- x = mx - r * cos(c);
- }
- else
- {
- y = my + r * sin(c);
- x = mx + r * cos(c);
- }
- bPointReached = false;
- uiCheckTimer = 1000;
- me->GetMotionMaster()->MovePoint(1,x, y, SHIELD_ORB_Z);
- c += M_PI/32;
- if (c >= 2*M_PI) c = 0;
- }
- else
- {
- if (uiCheckTimer <= diff)
- {
- DoTeleportTo(x,y,SHIELD_ORB_Z);
- bPointReached = true;
- }
- else uiCheckTimer -= diff;
- }
- if (uiTimer <= diff)
- {
- if (Unit* random = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_PLAYER_GUID) : 0))
- DoCast(random, SPELL_SHADOW_BOLT, false);
- uiTimer = urand(500,1000);
- } else uiTimer -= diff;
- }
- void MovementInform(uint32 type, uint32 /*id*/)
- {
- if (type != POINT_MOTION_TYPE)
- return;
- bPointReached = true;
- }
Advertisement
Add Comment
Please, Sign In to add comment