All pastes #1002846 Raw Edit

Untitled

public cpp v1 · immutable
#1002846 ·published 2008-04-30 12:48 UTC
rendered paste body
//WORK!!! but we have core bug, if u get damage the AURA_PLAYER_IS_TELEPORTED fades from you...//Note: Kalecgos (dragon form) and Sathrovarr (demon) need to be killed at the same time, so compare health percentages every once in a while.//todo: - need mooore dataaa//redesign (:S)//enrange,KALEC_SAY_FRIENDLY_ON_NEAR_LOSING,say@spellcasting,shatrovvar die but kalec hp > x% loot is not accessible,if kalec die before shat die loot not accessible:)//i dont find the wall around apex point//server crash when you deal more damage as shathrovarr hp in gm mode//flying away#define KALEC_SAY_NON_FRIENDLY_ON_AGGRO "No longer will I be a slave to Malygos! Challenge me and you will be destroyed!"#define KALEC_SAY_NON_FRIENDLY_ON_KILL_1 "In the name of Kil'jaeden!"#define KALEC_SAY_NON_FRIENDLY_ON_KILL_2 "You were warned!"#define KALEC_SAY_NON_FRIENDLY_BEFORE_FLY_AWAY "My awakening is complete! You shall all perish!"#define KALEC_SAY_NON_FRIENDLY_ON_SPELL_1 "I will purge you!"#define KALEC_SAY_NON_FRIENDLY_ON_SPELL_2 "Your pain has only begun!"#define KALEC_SAY_FRIENDLY_ON_AGGRO "I need... your help... Cannot... resist him... much longer..."#define KALEC_SAY_FRIENDLY_ON_LOSING "Aaahhh! Help me, before I lose my mind!"#define KALEC_SAY_FRIENDLY_ON_NEAR_LOSING "Hurry! There is not much of me left!" //???#define KALEC_SAY_FRIENDLY_AT_END "I am forever in your debt. Once we have triumphed over Kil'jaeden, this entire world will be in your debt as well."#define SHAT_SAY_ON_AGGRO "Gyahaha... There will be no reprieve. My work here is nearly finished."#define SHAT_SAY_ON_KILL_1 "Pitious mortal!"#define SHAT_SAY_ON_KILL_2 "Haven't you heard? I always win!"#define SHAT_SAY_ON_ENRANGE "I have toyed with you long enough!"#define SHAT_SAY_ON_DIE "I'm... never on... the losing... side..."#define SHAT_SAY_ON_SPELL_1 "Your misery is my delight!"#define SHAT_SAY_ON_SPELL_2 "I will watch you bleed!"#define KALECGOS_Z 53#define SHATHROVARR_Z -74#define fligh_away_x 1551#define fligh_away_y 788#define fligh_away_z 121#define TELEPORT_GO 187055#define KALECGOS_HUMAN_FORM_ID 24891#define SPELL_BANISH 40370#define BERSERK 0//kalecgos spells:#define ARCANE_BUFFET 45018#define FROST_BREATH 44799#define TAIL_LASH 45122//kalecgos human form spells#define HEROIC_STRIKE 45026 //aggro..:)#define REVITALIZE 45027//Shathrovarr spells#define CORRUPTING_STRIKE 45029#define COURSE_OF_BUNDLESS_AGONY 45032#define SHADOW_BOLT_VOLLEY 45031//realmswitching#define AURA_PLAYER_NOT_ABLE_TO_TELEPORT 44867#define AURA_PLAYER_IS_TELEPORTED 46021 //if we get damage this fades...(i think bug@invisibility:)#define KALECGOS_TELEPORT 44866 //summon go, and dealdmg(currently) (spellname: spectral blast)#include "sc_creature.h"#include "GameObject.h"#include "sc_gossip.h"#include "PointMovementGenerator.h"#include "def_sunwell_plateau.h"struct MANGOS_DLL_DECL boss_kalecgosAI : public ScriptedAI{	uint32 wild_magics[6];	uint32 arcane_buffet_timer;	uint32 frost_breath_timer;	uint32 wild_magic_timer;	uint32 spectral_blast_timer;	uint32 gameobject_despawn_timer;	uint32 checktimer ;	bool flight;	Unit *target;	ScriptedInstance *pInstance;	Unit *tempunit;    boss_kalecgosAI(Creature *c) : ScriptedAI(c)     {		pInstance = (c->GetInstanceData()) ? ((ScriptedInstance*)c->GetInstanceData()) : NULL;		Reset();    }	void Reset(){		wild_magics[0] = 44978;		wild_magics[1] = 45001;		wild_magics[2] = 45002;		wild_magics[3] = 45004;		wild_magics[4] = 45006;		wild_magics[5] = 45010;		checktimer = 10000;		arcane_buffet_timer = 8000;		frost_breath_timer = 25000;		wild_magic_timer = 10000;		spectral_blast_timer = 20000+5000;		flight = false;	}	void Aggro(Unit* who)    {		m_creature->setEmoteState(0);		DoYell(KALEC_SAY_NON_FRIENDLY_ON_AGGRO,LANG_UNIVERSAL,NULL);    }    void KilledUnit(Unit *victim)    {		switch(rand()%2){			case 0:			DoYell(KALEC_SAY_NON_FRIENDLY_ON_KILL_1,LANG_UNIVERSAL,NULL);			break;			case 1:			DoYell(KALEC_SAY_NON_FRIENDLY_ON_KILL_2,LANG_UNIVERSAL,NULL);			break;		}    }	void JustDied(Unit *victim){		tempunit = Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_SHATHROVARR));		if(tempunit->isAlive()){			EndOfFight();		}		//he can't die...but...:)	}	void UpdateAI(const uint32 diff)	{		if(flight){		m_creature->setFaction(35); //friendly		DoYell(KALEC_SAY_NON_FRIENDLY_BEFORE_FLY_AWAY,LANG_UNIVERSAL,NULL);		m_creature->GetMotionMaster()->Mutate(new PointMovementGenerator<Creature>(0, fligh_away_x, fligh_away_y, fligh_away_z));				}else{		if (!m_creature->SelectHostilTarget() || !m_creature->getVictim())            return;		if(arcane_buffet_timer < diff)            {                DoCast(m_creature->getVictim(), ARCANE_BUFFET);                arcane_buffet_timer = 8000;            } else arcane_buffet_timer -= diff;		if(arcane_buffet_timer < diff)            {                DoCast(m_creature->getVictim(), FROST_BREATH);                arcane_buffet_timer = 25000;            } else arcane_buffet_timer -= diff;		if(wild_magic_timer < diff)            {				Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0);				int wild_num = rand()%5;                DoCast(target, wild_magics[wild_num]);                wild_magic_timer = 10000;            } else wild_magic_timer -= diff;		if(spectral_blast_timer < diff)            {				Unit *goback;                    std::list<HostilReference *> t_list = m_creature->getThreatManager().getThreatList();                    for(std::list<HostilReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)                    {						goback = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());						if(goback->GetTypeId() == TYPEID_PLAYER){							if(!goback->HasAura(AURA_PLAYER_NOT_ABLE_TO_TELEPORT,0) && goback != m_creature->getVictim()){								target = goback;							}						}					}				if(target)                DoCast(target, KALECGOS_TELEPORT);                spectral_blast_timer = 20000+(rand()%5000);				            }else spectral_blast_timer -= diff;				if(checktimer < diff){		tempunit = Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_SHATHROVARR));		uint32 percent_shat = (tempunit->GetHealth()*100)/tempunit->GetMaxHealth();		uint32 percent_kalec = (m_creature->GetHealth()*100)/m_creature->GetMaxHealth();			if(!(percent_shat-percent_kalec < 5 && percent_shat-percent_kalec > -5)) // 5% is tipp				EndOfFight();		if(percent_kalec == 1 && percent_shat > 1)			DoCast(m_creature,SPELL_BANISH);		checktimer = 10000;		}else checktimer -= diff;		DoMeleeAttackIfReady();		}	}	void EndOfFight(){		//...need more data		DoYell(KALEC_SAY_FRIENDLY_ON_LOSING,LANG_UNIVERSAL,NULL);	}	};struct MANGOS_DLL_DECL boss_kalecgos_humanAI : public ScriptedAI{	//i think: this mob hp == 100-kalecgoshp%	//or we dont need this...kalecgos have http://www.wowhead.com/?spell=44670 spell, or this is kalecgos->tofriendly	uint32 revitalize_timer;	uint32 heroic_timer;	bool revitalize;    boss_kalecgos_humanAI(Creature *c) : ScriptedAI(c)     {		Reset();    }	void Reset(){		revitalize_timer = 10000;		heroic_timer = 1000;		revitalize = false;	}	void Aggro(Unit* who)    {		DoYell(KALEC_SAY_FRIENDLY_ON_AGGRO,LANG_UNIVERSAL,NULL);		    }    void JustDied(Unit *victim)    {		DoYell(KALEC_SAY_FRIENDLY_ON_LOSING,LANG_UNIVERSAL,NULL);    }	void UpdateAI(const uint32 diff)	{		if (!m_creature->SelectHostilTarget() || !m_creature->getVictim())            return;		if(!revitalize && heroic_timer < diff){			DoCast(m_creature->getVictim(),HEROIC_STRIKE);		heroic_timer = 1000;	}else heroic_timer -= diff;		if(revitalize_timer < diff && revitalize){			DoCast(m_creature,REVITALIZE);			revitalize_timer = 10000;		}else revitalize_timer -= diff;		if(revitalize){			m_creature->AttackStop();		}else{DoMeleeAttackIfReady();}	}};struct MANGOS_DLL_DECL boss_SathrovarrAI : public ScriptedAI{	uint32 corruption_strike_timer;	uint32 course_of_bundless_agony_timer;	uint32 shadow_bolt_volley_timer;	Creature *kalecgos_human;	uint32 refresh;	std::list<HostilReference *> lastgroup;	ScriptedInstance *pInstance;	Unit *tempunit;    boss_SathrovarrAI(Creature *c) : ScriptedAI(c)     {		Reset();		pInstance = (c->GetInstanceData()) ? ((ScriptedInstance*)c->GetInstanceData()) : NULL;    }	void Reset(){			shadow_bolt_volley_timer = 5000;		course_of_bundless_agony_timer = 20000;		corruption_strike_timer = 13000;		refresh = 1000;		DoCast(m_creature,AURA_PLAYER_IS_TELEPORTED);	}	void Aggro(Unit* who)    {		DoYell(SHAT_SAY_ON_AGGRO,LANG_UNIVERSAL,NULL);		summon_kalecgos_human();    }	void KilledUnit(Unit *){		switch(rand()%2){			case 0:			DoYell(SHAT_SAY_ON_KILL_1,LANG_UNIVERSAL,NULL);			break;			case 1:			DoYell(SHAT_SAY_ON_KILL_2,LANG_UNIVERSAL,NULL);			break;		}	}    void JustDied(Unit *victim)    {		DoYell(SHAT_SAY_ON_DIE,LANG_UNIVERSAL,NULL);		Unit *goback; 		tempunit = Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_KALECGOS));		lastgroup = tempunit->getThreatManager().getThreatList();		for(std::list<HostilReference *>::iterator itr = lastgroup.begin(); itr!= lastgroup.end(); ++itr)        {		goback = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());		if(goback->GetTypeId() == TYPEID_PLAYER){		((Player*)goback)->TeleportTo(goback->GetMapId(),goback->GetPositionX(),goback->GetPositionY(),KALECGOS_Z,goback->GetOrientation());							}		}		if(kalecgos_human){		((boss_kalecgos_humanAI*)kalecgos_human->AI())->DoYell(KALEC_SAY_FRIENDLY_AT_END,LANG_UNIVERSAL,NULL);		kalecgos_human->DealDamage(kalecgos_human, kalecgos_human->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);		}				m_creature->Relocate(m_creature->GetPositionX(),m_creature->GetPositionY(),KALECGOS_Z);		//pInstance->SetData(0,1);flymodeon:)    }	void UpdateAI(const uint32 diff)	{		if(!m_creature->HasAura(AURA_PLAYER_IS_TELEPORTED,0))			DoCast(m_creature,AURA_PLAYER_IS_TELEPORTED);		if (!m_creature->SelectHostilTarget() || !m_creature->getVictim())            return;			if(refresh < diff){					Unit *goback;                    std::list<HostilReference *> t_list = m_creature->getThreatManager().getThreatList();                    for(std::list<HostilReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)                    {						goback = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());						if(goback->GetTypeId() == TYPEID_PLAYER){							if(!goback->HasAura(AURA_PLAYER_IS_TELEPORTED,0)){																((Player*)goback)->TeleportTo(goback->GetMapId(),goback->GetPositionX(),goback->GetPositionY(),KALECGOS_Z,goback->GetOrientation());								goback->CastSpell(goback,AURA_PLAYER_NOT_ABLE_TO_TELEPORT,false);								m_creature->getThreatManager().getThreatList().remove((*itr));							}						}					}			refresh = 1000;		}else refresh -= diff;				if(shadow_bolt_volley_timer< diff)            {				Unit *target;				for(int i = 0; i<10; ++i){				 target = SelectUnit(SELECT_TARGET_RANDOM, 0);				 if(target != kalecgos_human)					 break;				}				if(target)				DoCast(target, SHADOW_BOLT_VOLLEY);                shadow_bolt_volley_timer = 10000+(rand()%5000);            }else shadow_bolt_volley_timer -= diff;		if(course_of_bundless_agony_timer < diff)            {				Unit *target;				for(int i = 0; i<10; ++i){					target = SelectUnit(SELECT_TARGET_RANDOM, 0);					if(target != kalecgos_human)						break;				}				if(target)                DoCast(target, COURSE_OF_BUNDLESS_AGONY);                course_of_bundless_agony_timer = 20000;            }else course_of_bundless_agony_timer -= diff;		if(corruption_strike_timer < diff)            {				Unit *target;				for(int i = 0; i<10; ++i){				target = SelectUnit(SELECT_TARGET_RANDOM, 0);				if(target != kalecgos_human && m_creature->GetDistance(target) < 5)					break;				}				if(target)                DoCast(target, CORRUPTING_STRIKE);                corruption_strike_timer = 13000;            }else corruption_strike_timer -= diff;		if(kalecgos_human){		if(m_creature->getVictim() !=  kalecgos_human){				((boss_kalecgos_humanAI*)kalecgos_human->AI())->revitalize = true;		}else{				((boss_kalecgos_humanAI*)kalecgos_human->AI())->revitalize = false;		}	}		if((m_creature->GetHealth()*100)/m_creature->GetMaxHealth() < 5){		//enrange kalecgos			tempunit = Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_KALECGOS));			DoYell(SHAT_SAY_ON_ENRANGE,LANG_UNIVERSAL,NULL);			DoCast(tempunit,BERSERK);		}						DoMeleeAttackIfReady();			}	void summon_kalecgos_human()	{		kalecgos_human = DoSpawnCreature(KALECGOS_HUMAN_FORM_ID, 0, 0, 0, 0, TEMPSUMMON_DEAD_DESPAWN, 500000);		kalecgos_human ->Attack(m_creature);	}};CreatureAI* GetAI_boss_kalecgos(Creature *_Creature){    return new boss_kalecgosAI (_Creature);}CreatureAI* GetAI_boss_Sathrovarr(Creature *_Creature){    return new boss_SathrovarrAI (_Creature);}CreatureAI* GetAI_boss_kalecgos_human(Creature *_Creature){    return new boss_kalecgos_humanAI (_Creature);}bool GOkalocegos_teleporter(Player *player, GameObject* _GO){	if(player->HasAura(AURA_PLAYER_NOT_ABLE_TO_TELEPORT,0))		return false;	((Player*)player)->TeleportTo(player->GetMapId(),player->GetPositionX(),player->GetPositionY(),SHATHROVARR_Z,player->GetOrientation());	player->CastSpell(player,AURA_PLAYER_IS_TELEPORTED,true);    return false;}void AddSC_boss_kalecgos(){    Script *newscript;    newscript = new Script;    newscript->Name="boss_kalecgos";    newscript->GetAI = GetAI_boss_kalecgos;    m_scripts[nrscripts++] = newscript;    newscript = new Script;    newscript->Name="boss_Sathrovarr";    newscript->GetAI = GetAI_boss_Sathrovarr;    m_scripts[nrscripts++] = newscript;    newscript = new Script;    newscript->Name="boss_kalecgos_human";    newscript->GetAI = GetAI_boss_kalecgos_human;    m_scripts[nrscripts++] = newscript;    newscript = new Script;    newscript->Name="kalocegos_teleporter";    newscript->pGOHello = GOkalocegos_teleporter;    m_scripts[nrscripts++] = newscript;}