void DamageTaken(Unit* done_by, uint32 &damage) { if (damage >= me->GetHealth() && done_by != me) { if (!m_bUncorrupted) { damage = 0; m_bBanished = true; DoCastMe( SPELL_BANISH, true); me->GetMotionMaster()->MoveIdle(); } else { damage = 0; BeginOutro(); } } }
void DamageTaken(Unit* done_by, uint32 &damage) { if (damage > m_creature->GetHealth() && done_by != m_creature) { if (!Uncorrupted) { damage = 0; Banished = true; DoCast(m_creature, SPELL_BANISH, true); m_creature->GetMotionMaster()->MoveIdle(); } else { damage = 0; BeginOutro(); } } }
void UpdateAI(const uint32 diff) { if (!me->getVictim() || !me->SelectHostileTarget() || m_bBanished) return; if (!m_bEnraged && ((me->GetHealth()*100 / me->GetMaxHealth()) < 10)) { if (Unit* pSathrovarr = Unit::GetUnit(*me, pInstance->GetData64(DATA_SATHROVARR))) pSathrovarr->CastSpell(pSathrovarr, SPELL_CRAZED_RAGE, true); DoCastMe( SPELL_CRAZED_RAGE, true); m_bEnraged = true; } if (!m_bChecked && ((me->GetHealth()*100 / me->GetMaxHealth()) < 1)) { m_bChecked = true; if (!m_bUncorrupted) { m_bBanished = true; DoCastMe( SPELL_BANISH, true); me->GetMotionMaster()->MoveIdle(); } else BeginOutro(); } if (m_uiExitTimer) { if (m_uiExitTimer <= diff) { debug_log("SD2: KALEC: Exiting the arena"); float x, y, z; me->GetRandomPoint(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 30, x, y, z); z = 70.0f; me->GetMotionMaster()->MovePoint(1, x, y, z); m_uiExitTimer = 0; } else m_uiExitTimer -= diff; } if (m_uiArcaneBuffetTimer < diff) { if (!urand(0, 2)) DoScriptText(SAY_EVIL_SPELL1, me); DoCastVictim( SPELL_ARCANE_BUFFET); m_uiArcaneBuffetTimer = 20000; } else m_uiArcaneBuffetTimer -= diff; if (m_uiFrostBreathTimer < diff) { if (!urand(0, 1)) DoScriptText(SAY_EVIL_SPELL2, me); DoCastVictim( SPELL_FROST_BREATH); m_uiFrostBreathTimer = 25000; } else m_uiFrostBreathTimer -= diff; if (m_uiWildMagicTimer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(target, WildMagic[rand()%6]); m_uiWildMagicTimer = 19000; } else m_uiWildMagicTimer -= diff; if (m_uiSpectralBlastTimer < diff) { m_bHasSpectralTarget = false; me->CastSpell(me, SPELL_SPECTRAL_BLAST_DUMMY, false); m_uiSpectralBlastTimer = 30000; } else m_uiSpectralBlastTimer -= diff; if (!m_bBanished) DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (!m_creature->getVictim() || !m_creature->SelectHostilTarget() || Banished) return; if (((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 10) && !Enraged) { Unit* Sathrovarr = Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_SATHROVARR)); if (Sathrovarr) Sathrovarr->CastSpell(Sathrovarr, SPELL_CRAZED_RAGE, true); DoCast(m_creature, SPELL_CRAZED_RAGE, true); Enraged = true; } if (((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 1) && !Checked) { Checked = true; if (!Uncorrupted) { Banished = true; DoCast(m_creature, SPELL_BANISH, true); m_creature->GetMotionMaster()->MoveIdle(); } else BeginOutro(); } if (ExitTimer) { if (ExitTimer <= diff) { debug_log("SD2: KALEC: Exiting the arena"); DoScriptText(SAY_GOOD_PLRWIN, m_creature); m_creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT + MOVEMENTFLAG_LEVITATING); float x, y, z; float iniX, iniY, iniZ; m_creature->GetPosition(iniX, iniY, iniZ); m_creature->GetRandomPoint(iniX, iniY, iniZ, 30, x, y, z); z = 70; m_creature->GetMotionMaster()->MovePoint(1, x, y, z); }else ExitTimer -= diff; } if (!LockedArena) { if (ForceFieldTimer < diff) { if (pInstance) { if (GameObject* pForceField = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_GO_FORCEFIELD))) pForceField->SetGoState(GO_STATE_ACTIVE); LockedArena = true; }else error_log(ERROR_INST_DATA); }else ForceFieldTimer -= diff; } if (ArcaneBuffetTimer < diff) { if (rand()%3 == 0) DoScriptText(SAY_EVIL_SPELL1, m_creature); DoCast(m_creature->getVictim(), SPELL_ARCANE_BUFFET); ArcaneBuffetTimer = 20000; }else ArcaneBuffetTimer -= diff; if (FrostBreathTimer < diff) { if (rand()%2 == 0) DoScriptText(SAY_EVIL_SPELL2, m_creature); DoCast(m_creature->getVictim(), SPELL_FROST_BREATH); FrostBreathTimer = 25000; }else FrostBreathTimer -= diff; if (WildMagicTimer < diff) { DoCast(m_creature->getVictim(), WildMagic[rand()%6]); WildMagicTimer = 19000; }else WildMagicTimer -= diff; if (SpectralBlastTimer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1)) { TeleportTargetGUID = target->GetGUID(); m_creature->SetUInt64Value(UNIT_FIELD_TARGET, TeleportTargetGUID); SpectralBlastTimer = 30000; SpectralTeleportTimer = 2000; } }else SpectralBlastTimer -= diff; if (SpectralTeleportTimer < diff) { if (TeleportTargetGUID) { Unit* pUnit = Unit::GetUnit((*m_creature), TeleportTargetGUID); if (pUnit) { pUnit->CastSpell(pUnit, SPELL_SPECTRAL_BLAST, true); TeleportToInnerVeil((Player*)pUnit); } else error_log(ERROR_MISSING_TELEPORT_GUID); } else error_log(ERROR_MISSING_TELEPORT_GUID); m_creature->SetUInt64Value(UNIT_FIELD_TARGET, m_creature->getVictim()->GetGUID()); TeleportTargetGUID = 0; SpectralTeleportTimer = SpectralBlastTimer + 2000; }else SpectralTeleportTimer -= diff; if (!Banished) DoMeleeAttackIfReady(); }