void UpdateAI(uint32 diff) { if (CanCheck) { if (uiCheckTimer <= diff) { uiCheckTimer = 250; float x, y; me->GetPosition(x, y); if (pos.GetExactDist2d(x, y) >= 4.0f) { float dist = me->GetDistance(pos); float _x, _y, _z = me->GetPositionZ(); me->GetNearPoint2D(_x, _y, dist - 4.0f, me->GetAngle(&pos)); me->CastSpell(_x, _y, _z, SPELL_SUMMON_SHOCKWAVE, true); } } else uiCheckTimer -= diff; } }
void _MovePosition(float dist, float angle) { angle = me->NormalizeOrientation(angle); float cur_dist = 5.0f; Movement::MoveSplineInit init(*me); bool bPassed = false; while (!bPassed) { float x = me->GetPositionX() + (cur_dist * std::cos(angle)); float y = me->GetPositionY() + (cur_dist * std::sin(angle)); float z = me->GetPositionZ(); float center_dist = centerPos.GetExactDist2d(x, y); if (center_dist > 100.0f || cur_dist > dist) bPassed = true; else { G3D::Vector3 point; point.x = x; point.y = y; if (center_dist > 40.0f) z = -225.0f + ((center_dist - 40.0f) * 0.1333f); else z = -225.0f; point.z = z; init.Path().push_back(point); cur_dist += 5.0f; } } if (!init.Path().empty()) { init.SetWalk(false); init.Launch(); } }
void UpdateAI(uint32 const diff) { if (bExplode) return; if (!UpdateVictim()) return; if (centerPos.GetExactDist2d(me->GetPositionX(), me->GetPositionY()) > 95.0f) { bExplode = true; events.Reset(); me->StopMoving(); DoCastAOE(SPELL_BLACK_BLOOD_ERUPTION); me->DespawnOrUnsummon(5000); return; } events.Update(diff); if (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_CONTINUE: { DoCast(me, SPELL_VOID_OF_THE_UNMAKING_VISUAL, true); bAura = true; _MovePosition(200.0f, me->GetOrientation()); //me->GetMotionMaster()->MovePoint(POINT_VOID, pos); break; } case EVENT_CHECK_DISTANCE: { if (!bAura) { events.ScheduleEvent(EVENT_CHECK_DISTANCE, 500); break; } if (Player* pPlayer = me->FindNearestPlayer(5.0f)) { if (constAuraPtr aur = me->GetAura(SPELL_VOID_DIFFUSION_BUFF)) { if (aur->GetStackAmount() >= 9) if (InstanceScript* pInstance = me->GetInstanceScript()) if (Creature* pZonozz = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_ZONOZZ))) pZonozz->AI()->SetData(DATA_ACHIEVE, 1); } me->RemoveAura(SPELL_VOID_OF_THE_UNMAKING_VISUAL); bAura = false; DoCastAOE(SPELL_VOID_DIFFUSION_DMG); me->StopMoving(); float ang = me->GetAngle(pPlayer->GetPositionX(), pPlayer->GetPositionY()); if (me->NormalizeOrientation(me->GetOrientation() - ang) < (M_PI / 4.0f)) ang = me->GetOrientation(); _MovePosition(200.0f, ang + M_PI); //me->GetMotionMaster()->MovePoint(POINT_VOID, pos); events.ScheduleEvent(EVENT_UPDATE_AURA, 4000); events.ScheduleEvent(EVENT_CHECK_DISTANCE, 4000); } else if (Creature* pZonozz = me->FindNearestCreature(NPC_ZONOZZ, 5.0f)) { uint8 stacks = 1; if (constAuraPtr aur = me->GetAura(SPELL_VOID_DIFFUSION_BUFF)) stacks = aur->GetStackAmount(); pZonozz->AI()->SetData(DATA_VOID, stacks); events.Reset(); me->StopMoving(); me->DespawnOrUnsummon(2000); } else events.ScheduleEvent(EVENT_CHECK_DISTANCE, 200); break; } case EVENT_UPDATE_AURA: DoCast(me, SPELL_VOID_OF_THE_UNMAKING_VISUAL, true); bAura = true; break; default: break; } } }