/*
* Sean++ Scripts for Ascent MMORPG Server
*
*
* 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 3 of the License, or
* 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, see .
*/#include "StdAfx.h"
#include "Setup.h"
#define CN_KAMYN 52005
#define DRAIN_LIFE 38817/////
#define CHAIN_LIGHTNING 32337/////
#define WHIRLWIND 33239
#define GROWTH 36300
#define DARK_DECAY 33129/////
#define FLAME_SHOCK 43303/////
#define ENRAGE 39249
class KamynAI : public CreatureAIScript
{
public:
ADD_CREATURE_FACTORY_FUNCTION(KamynAI);
SP_AI_Spell spells[7];
bool m_spellcheck[7];
KamynAI(Creature* pCreature) : CreatureAIScript(pCreature)
{
nrspells = 7;
for(int i=0;iSendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "How dare you step into my Lair with your ignorance? I am disgusted by your sight! Your efforts are completely useless and will accomplish nothing! You cannot afford to be owned as hard as you are preparing yourself to be! Back Down!");
RegisterAIUpdateEvent(_unit->GetUInt32Value(UNIT_FIELD_BASEATTACKTIME));
}
void OnCombatStop(Unit *mTarget)
{
CastTime();
_unit->GetAIInterface()->setCurrentAgent(AGENT_NULL);
_unit->GetAIInterface()->SetAIState(STATE_IDLE);
RemoveAIUpdateEvent();
}
void OnDied(Unit * mKiller)
{
CastTime();
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "It cannot be possible! How could you.. I don't.. But it.. Can't... Aghhh!");
///_unit->PlaySoundToSet(11327);
RemoveAIUpdateEvent();
}
void OnTargetDied(Unit* mTarget)
{
if (_unit->GetHealthPct() > 0)
{
int RandomSpeach;
RandomUInt(1000);
RandomSpeach=rand()%5;
switch (RandomSpeach)
{
case 0:
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "You are pathetic!");
/////_unit->PlaySoundToSet(11023);
break;
case 1:
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Your efforts amuse me!");
////_unit->PlaySoundToSet(11055);
break;
case 2:
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Did you actually think you stood a chance against your creator?");
/////_unit->PlaySoundToSet(11025);
break;
case 3:
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "You have underestimated my power.. How clumsy of you!");
////_unit->PlaySoundToSet(11056);
break;
case 4:
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "I never fail!");
////_unit->PlaySoundToSet(11057);
break;
case 5:
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "You shall not succeed!");
////_unit->PlaySoundToSet(11057);
break;
case 6:
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "You do not understand what you are fooling with!");
////_unit->PlaySoundToSet(11057);
break;
case 7:
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Back Down!");
////_unit->PlaySoundToSet(11057);
break;
case 8:
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Submit!");
////_unit->PlaySoundToSet(11057);
break;
}
}
}
void AIUpdate()
{
float val = (float)RandomFloat(100.0f);
SpellCast(val);
}
void CastTime()
{
for(int i=0;iGetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget())
{
float comulativeperc = 0;
Unit *target = NULL;
for(int i=0;iGetAIInterface()->GetNextTarget();
switch(spells[i].targettype)
{
case TARGET_SELF:
case TARGET_VARIOUS:
_unit->CastSpell(_unit, spells[i].info, spells[i].instant); break;
case TARGET_ATTACKING:
_unit->CastSpell(target, spells[i].info, spells[i].instant); break;
case TARGET_DESTINATION:
_unit->CastSpellAoF(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), spells[i].info, spells[i].instant); break;
}
if (spells[i].speech != "")
{
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, spells[i].speech.c_str());
_unit->PlaySoundToSet(spells[i].soundid);
}
m_spellcheck[i] = false;
return;
}
if ((val > comulativeperc && val <= (comulativeperc + spells[i].perctrigger)) || !spells[i].casttime)
{
_unit->setAttackTimer(spells[i].attackstoptimer, false);
m_spellcheck[i] = true;
}
comulativeperc += spells[i].perctrigger;
}
}
}
protected:
int nrspells;
};
void SetupKamynsLair(ScriptMgr * mgr)
{
mgr->register_creature_script(CN_KAMYN, &KamynAI::Create);
}