void SpellHitTarget(Unit* pTarget, const SpellEntry* pSpell) { if (pSpell->Id == SPELL_SPECTRAL_BLAST_DUMMY && !m_bHasSpectralTarget) { if (pTarget->GetTypeId() != TYPEID_PLAYER) return; if (pTarget->HasAura(SPELL_SPECTRAL_EXHAUSTION,0) || pTarget->HasAura(SPELL_SPECTRAL_REALM)) return; if (pTarget == me->getVictim()) return; m_bHasSpectralTarget = true; pTarget->CastSpell(pTarget, SPELL_SPECTRAL_BLAST, true); SendToInnerVeil(pTarget); } }
void UpdateAI(const uint32 diff) { if (m_bBanished) return; if(!m_creature->getVictim() || !m_creature->SelectHostileTarget()) { if(m_pInstance && m_pInstance->GetData(TYPE_KALECGOS) == IN_PROGRESS) m_creature->AI()->EnterEvadeMode(); return; } if (!m_bEnraged && m_creature->GetHealthPercent() < 10.0f) { /* if (Creature* pSathrovarr = m_creature->GetMap()->GetCreature(m_pInstance->GetData64(DATA_SATHROVARR))) { if (pSathrovarr->isAlive()) pSathrovarr->CastSpell(pSathrovarr, SPELL_CRAZED_RAGE, true); }*/ // enrage ak ma 10% m_creature->CastSpell(m_creature, SPELL_CRAZED_RAGE, true); m_bEnraged = true; } // teleport ak ma pod 5% if (!m_bChecked && m_creature->GetHealthPercent() < 5.0f) { m_bChecked = true; if (!m_bUncorrupted) { m_bBanished = true; DoCastSpellIfCan(m_creature, SPELL_BANISH, true); m_creature->GetMotionMaster()->MoveIdle(); Map::PlayerList const& lPlayers = m_pInstance->instance->GetPlayers(); for(Map::PlayerList::const_iterator itr = lPlayers.begin(); itr != lPlayers.end(); ++itr) { Player* pPlayer = itr->getSource(); if (pPlayer && pPlayer->isAlive() && !pPlayer->isGameMaster()) SendToInnerVeil(pPlayer); } // Vypnutie bariery m_pInstance->SetData(TYPE_KALECGOS, DONE); } /* else BeginOutro(); */ } if (m_uiExitTimer) { if (m_uiExitTimer <= diff) { debug_log("SD2: KALEC: Exiting the arena"); float x, y, z; m_creature->GetRandomPoint(m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 30, x, y, z); z = 70.0f; m_creature->GetMotionMaster()->MovePoint(1, x, y, z); m_uiExitTimer = 0; }else m_uiExitTimer -= diff; } if (m_uiArcaneBuffetTimer < diff) { if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_ARCANE_BUFFET) == CAST_OK) { if (!urand(0, 2)) DoScriptText(SAY_EVIL_SPELL1, m_creature); m_uiArcaneBuffetTimer = 20000; } } else m_uiArcaneBuffetTimer -= diff; if (m_uiFrostBreathTimer < diff) { if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_FROST_BREATH) == CAST_OK) { if (!urand(0, 1)) DoScriptText(SAY_EVIL_SPELL2, m_creature); m_uiFrostBreathTimer = 25000; } } else m_uiFrostBreathTimer -= diff; if (m_uiWildMagicTimer < diff) { if (Unit* target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) DoCastSpellIfCan(target, WildMagic[rand()%6]); m_uiWildMagicTimer = 19000; } else m_uiWildMagicTimer -= diff; if (m_uiSpectralBlastTimer < diff) { m_bHasSpectralTarget = false; m_creature->CastSpell(m_creature, SPELL_SPECTRAL_BLAST_DUMMY, false); m_uiSpectralBlastTimer = 30000; } else m_uiSpectralBlastTimer -= diff; if (!m_bBanished) DoMeleeAttackIfReady(); }