Blackfathom Deeps, Twilight Lord Kelris: implement script (needed for GO handling)

--HG--
branch : trunk
This commit is contained in:
tartalo
2009-11-20 21:15:29 +01:00
parent 3b1c6a7bed
commit 0f2dc64a41
3 changed files with 110 additions and 1 deletions
+1
View File
@@ -207,6 +207,7 @@ SET(trinityscript_LIB_SRCS
scripts/examples/example_gossip_codebox.cpp
scripts/examples/example_misc.cpp
scripts/kalimdor/blackfathom_depths/boss_gelihast.cpp
scripts/kalimdor/blackfathom_depths/boss_kelris.cpp
scripts/kalimdor/blackfathom_depths/instance_blackfathom_deeps.cpp
scripts/kalimdor/blackfathom_depths/blackfathom_deeps.cpp
scripts/kalimdor/blackfathom_depths/blackfathom_deeps.h
@@ -82,4 +82,4 @@ void AddSC_boss_gelihast()
newscript->Name = "boss_gelihast";
newscript->GetAI = &GetAI_boss_gelihast;
newscript->RegisterSelf();
}
}
@@ -0,0 +1,108 @@
/*
* Copyright (C) 2008-2009 Trinity <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "precompiled.h"
#include "blackfathom_deeps.h"
enum Spells
{
SPELL_MIND_BLAST = 15587,
SPELL_SLEEP = 8399,
};
//Id's from ACID
enum Yells
{
SAY_AGGRO = -566,
SAY_SLEEP = -567,
SAY_DEATH = -568
};
struct TRINITY_DLL_DECL boss_kelrisAI : public ScriptedAI
{
boss_kelrisAI(Creature *c) : ScriptedAI(c)
{
pInstance = c->GetInstanceData();
}
uint32 uiMindBlastTimer;
uint32 uiSleepTimer;
ScriptedInstance *pInstance;
void Reset()
{
uiMindBlastTimer = urand(2000,5000);
uiSleepTimer = urand(9000,12000);
if (pInstance)
pInstance->SetData(TYPE_KELRIS, NOT_STARTED);
}
void EnterCombat(Unit* who)
{
DoScriptText(SAY_AGGRO, m_creature);
if (pInstance)
pInstance->SetData(TYPE_KELRIS, IN_PROGRESS);
}
void JustDied(Unit* killer)
{
DoScriptText(SAY_DEATH, m_creature);
if (pInstance)
pInstance->SetData(TYPE_KELRIS, DONE);
}
void UpdateAI(const uint32 diff)
{
if (!UpdateVictim())
return;
if (uiMindBlastTimer < diff)
{
DoCastVictim(SPELL_MIND_BLAST);
uiMindBlastTimer = urand(7000,9000);
} else uiMindBlastTimer -= diff;
if (uiSleepTimer < diff)
{
if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
{
DoScriptText(SAY_SLEEP, m_creature);
DoCast(pTarget, SPELL_SLEEP);
}
uiSleepTimer = urand(15000,20000);
} else uiSleepTimer -= diff;
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI_boss_kelris(Creature* pCreature)
{
return new boss_kelrisAI (pCreature);
}
void AddSC_boss_kelris()
{
Script *newscript;
newscript = new Script;
newscript->Name = "boss_kelris";
newscript->GetAI = &GetAI_boss_kelris;
newscript->RegisterSelf();
}