All pastes #994996 Raw Edit

sunwell 1. boss

public cpp v1 · immutable
#994996 ·published 2008-04-23 20:21 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://i dont find the wall around apex point//server crash when you deal more damage as shathrovarr hp in gm mode//flying away#define KALECAGOS_Z 53#define SHATHROVARR_Z -74#define fligh_up_x 1704#define fligh_up_y 928#define fligh_up_z 75#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//kalecgos spells:#define ARCANE_BUFFET 45018#define FROST_BREATH 44799#define HEROIC_STRIKE 45026#define TAIL_LASH 45122//kalecgos human form spells#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 KALECAGOS_TELEPORT 44866 //summon go, and dealdmg(currently) (spellname: spectral blast)#include "sc_creature.h"#include "GameObject.h"#include "SpellAuras.h"#include "sc_gossip.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;	bool flight;	uint32 flighttime;	uint32 station;	Unit *target;	bool gameobject_spawned;	uint64 shathrovarr;    boss_kalecgosAI(Creature *c) : ScriptedAI(c)     {		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;		arcane_buffet_timer = 8000;		frost_breath_timer = 25000;		wild_magic_timer = 10000;		spectral_blast_timer = 20000+5000;		gameobject_despawn_timer = 2000;		gameobject_spawned = false;		flight = false;		flighttime = 2000;		station = 0;		m_creature->setEmoteState(EMOTE_STATE_SLEEP);	}	void Aggro(Unit* who)    {		m_creature->setEmoteState(0);    }    void KilledUnit(Unit *victim)    {        }	void UpdateAI(const uint32 diff)	{		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, KALECAGOS_TELEPORT);                spectral_blast_timer = 20000+(rand()%5000);				gameobject_spawned = true;            }else spectral_blast_timer -= diff;		/*need correction...		if(flight){			if(flighttime < diff){				if(station == 0){					m_creature->SendMonsterMove(fligh_up_x,fligh_up_y,fligh_up_z,0,0,2000); //need flags					m_creature->Relocate(fligh_up_x,fligh_up_y,fligh_up_z);					flighttime = 2000;					station++;				}else if(station == 1){					m_creature->SendMonsterMove(fligh_away_x,fligh_away_y,fligh_away_z,0,0,10000); //need flags					m_creature->Relocate(fligh_away_x,fligh_away_y,fligh_away_z);					station++;					flighttime = 10000;				}else if(station == 2){					m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);				}			}else flighttime -= diff;		}*/		DoMeleeAttackIfReady();	}};struct MANGOS_DLL_DECL boss_kalecgos_humanAI : public ScriptedAI{	uint32 revitalize_timer;	bool revitalize;    boss_kalecgos_humanAI(Creature *c) : ScriptedAI(c)     {		Reset();    }	void Reset(){		revitalize_timer = 10000;		revitalize = false;	}	void Aggro(Unit* who)    {    }    void JustDied(Unit *victim)    {    }	void UpdateAI(const uint32 diff)	{		if (!m_creature->SelectHostilTarget() || !m_creature->getVictim())            return;		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 *kalecagos_human;	uint32 refresh;	std::list<HostilReference *> lastgroup;    boss_SathrovarrAI(Creature *c) : ScriptedAI(c)     {		    }	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)    {		summon_kacoegos_human();    }    void JustDied(Unit *victim)    {		Unit *goback;		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(),KALECAGOS_Z,goback->GetOrientation());							}		}		if(kalecagos_human)		kalecagos_human->DealDamage(kalecagos_human, kalecagos_human->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);				m_creature->Relocate(m_creature->GetPositionX(),m_creature->GetPositionY(),KALECAGOS_Z); //good    }	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)){								//relocating dont work good currently..								//m_creature->Say("iam on:".x."!",0,0);																((Player*)goback)->TeleportTo(goback->GetMapId(),goback->GetPositionX(),goback->GetPositionY(),KALECAGOS_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 != kalecagos_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 != kalecagos_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 != kalecagos_human && m_creature->GetDistance(target) < 5)					break;				}				if(target)                DoCast(target, CORRUPTING_STRIKE);                corruption_strike_timer = 13000;            }else corruption_strike_timer -= diff;		//human form - i dont have idea...he speak &?:D		/*if(kalecagos_human){			if(m_creature->getVictim() !=  kalecagos_human)				((boss_kalecgos_humanAI*)kalecagos_human->AI())->revitalize = true;*/			/*if(!kalecagos_human->isAlive()){				//end of fight(kill all player in 2.dimension)			Unit *target;					std::list<HostilReference *> t_list = m_creature->getThreatManager().getThreatList();					for(std::list<HostilReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)					{						target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());						m_creature->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);					}				}*/		DoMeleeAttackIfReady();			lastgroup = m_creature->getThreatManager().getThreatList();		}	void summon_kacoegos_human()	{		kalecagos_human = DoSpawnCreature(KALECGOS_HUMAN_FORM_ID, 0, 0, 0, 0, TEMPSUMMON_DEAD_DESPAWN, 500000);		kalecagos_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;}