rendered paste bodythe black_temple for sd2 271
thx
#include "../../sc_defines.h"
#include "../../../../../game/TargetedMovementGenerator.h"
#include "../../../../../shared/WorldPacket.h"
#include "../../../../../game/SpellAuras.h"
#include "../../../../../game/Player.h"
#include "../../../../../game/GossipDef.h"
//#define GOSSIP_ITEM " 我们将和伊利丹战斗! "
#define GOSSIP_ITEM " 开启黑暗神殿大门! "
#define SAY_KILL1 " 谁想成为下一个?! "
#define SOUND_KILL1 11473
#define SAY_KILL2 " 太轻松了! "
#define SOUND_KILL2 11472
/* Spells */
#define SPELL_ILLIDAN_KNEEL 39656
#define SPELL_PARASITIC 41914
#define SPELL_FLAME_CRASH 40832
#define SPELL_SHEAR 41032
#define SPELL_DRAW_SOUL 41303
#define SPELL_FLAME_BURST 41126
#define SPELL_FLAME_CRASH_EFFECT 40836
#define SPELL_AGONIZING_FLAMES 40932
#define SPELL_FIREBALL 40598
#define SPELL_EYEBLAST 40017
#define SPELL_MOLTENFLAME 40253
#define SPELL_DEMON_FIRE 40029
#define SPELL_DEMON_FORM 40506
#define SPELL_SHADOW_BLAST 41078
#define SPELL_DARK_BARRAGE 40585
#define SPELL_SHADOW_PRISON 40647
#define SPELL_DEATH_EFFECT 40220
#define SPELL_MAIEV_BLINK 41221
#define SPELL_CAGE_TRAP 40760
#define SPELL_POTION 40545
// Flames of Azzinoth uses this
#define SPELL_FLAME_BLAST 40631
#define SPELL_SUMMON_BLAZE 40637
#define SPELL_BLAZE 40610
#define DEMON_FORM_DISPLAYID 21322
#define NORMAL_FORM_DISPLAYID 21135
/* Coordinates for summons */
#define ILLIDAN_X 671.840
#define ILLIDAN_Y 304.100
#define ILLIDAN_Z 353.192
#define POS_Z 354
#define X_GLAIVE1 678
#define Y_GLAIVE1 287
#define X_FLAME1 677
#define Y_FLAME1 290
#define X_GLAIVE2 678
#define Y_GLAIVE2 321
#define X_FLAME2 677
#define Y_FLAME2 319
#define MAIEV_X 692
#define MAIEV_Y 351
#define MAIEV_Z 352
#define FLY_X1 692
#define FLY_Y1 331
#define FLY_Z1 353
#define FLY_X2 713
#define FLY_Y2 309
#define FLY_Z2 366
#define FLY_X3 687
#define FLY_Y3 271
#define FLY_Z3 353
#define FLY_X4 650
#define FLY_Y4 285
#define FLY_Z4 353
#define FLY_X5 653
#define FLY_Y5 331
#define FLY_Z5 371
// Illidan Glaive - 21431
//Flame of Azzinoth - 21320
// Dark Illidan - 21322
struct MANGOS_DLL_DECL boss_illidanAI : public ScriptedAI
{
boss_illidanAI(Creature *c) : ScriptedAI(c)
{ pInstance = (c->GetInstanceData()) ? ((ScriptedInstance*)c->GetInstanceData()) : NULL;
EnterEvadeMode();
}
ScriptedInstance *pInstance;
uint64 Flame1GUID;
uint64 Flame2GUID;
uint64 Glaive1GUID;
uint64 Glaive2GUID;
uint64 MaievGUID;
uint64 AkamaGUID;
uint64 MVGUID;
Creature *Maiev;
uint32 ShearTimer;
uint32 FlameCrashTimer;
uint32 DrawSoulTimer;
uint32 ParasiticTimer;
uint32 FlameBurstTimer;
uint32 FireballTimer;
uint32 EyeBlastTimer;
uint32 AgonizingFlamesTimer;
uint32 ShadowBlastTimer;
uint32 DarkBarrageTimer;
uint32 SummonTimer;
uint32 DemonFormTimer;
uint32 FlyTimer;
uint32 gut;
uint32 DeadFlameCount;
uint32 TalkTimer;
uint32 TalkCount;
uint32 redTimer;
uint32 phase;
uint32 inDemonTimer;
uint32 gutTime1;
uint32 gutTime2;
uint32 gutTime3;
uint32 gutTime4;
uint32 gutTime5;
uint32 gutTime6;
uint32 gutTime7;
uint32 gutTime8;
uint32 mvTimer;
bool FlameOne;
bool FlameTwo;
bool DemonForm;
bool HasSummoned;
bool IsTalking;
bool MVsafe;
bool InCombat;
void EnterEvadeMode();
void MoveInLineOfSight(Unit *who);
void AttackStart(Unit *who);
void UpdateAI(const uint32 diff);
void ResetThreat();
void KilledUnit(Unit *victim);
void JustDied(Unit *killer);
void SpecialMove(float X, float Y, float Z, uint32 Time, Creature *creature);
};
void boss_illidanAI::EnterEvadeMode()
{
Flame1GUID = 0;
Flame2GUID = 0;
Glaive1GUID = 0;
Glaive2GUID = 0;
MaievGUID = 0;
AkamaGUID = 0;
MVGUID = 0;
gut = 1 ;
inDemonTimer = 1000;
ShearTimer = 20000;
FlameCrashTimer = 30000;
DrawSoulTimer = 45000;
ParasiticTimer = 50000;
FireballTimer = 5000;
EyeBlastTimer = 30000;
FlameBurstTimer = 30000;
AgonizingFlamesTimer = 25000;
DarkBarrageTimer = 15000;
ShadowBlastTimer = 5000;
DemonFormTimer = 0;
SummonTimer = 35000;
FlyTimer = 15000;
redTimer = 30000;
gutTime1 = 0;
gutTime2 = 0;
gutTime3 = 0;
gutTime4 = 0;
gutTime5 = 0;
gutTime6 = 0;
gutTime8 = 0;
gutTime7 = 0;
mvTimer = 60000;
TalkTimer = 0;
TalkCount = 0;
phase = 1;
DemonForm = false;
IsTalking = false;
HasSummoned = false;
MVsafe = false;
InCombat = false;
m_creature->InterruptSpell(CURRENT_GENERIC_SPELL);
m_creature->SetFloatValue(OBJECT_FIELD_SCALE_X,1.5);
m_creature->SetHover(false);
(*m_creature).GetMotionMaster()->Clear(false);
m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, NORMAL_FORM_DISPLAYID);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
// m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,0);
m_creature->RemoveAllAuras();
m_creature->DeleteThreatList();
m_creature->CombatStop();
DoGoHome();
}
void boss_illidanAI::KilledUnit(Unit *victim)
{
//if (phase == 5)
//MVsafe = true;
switch(rand()%2)
{
case 0:
DoYell(SAY_KILL1, LANG_UNIVERSAL, NULL);
DoPlaySoundToSet(m_creature, SOUND_KILL1);
break;
case 1:
DoYell(SAY_KILL2, LANG_UNIVERSAL, NULL);
DoPlaySoundToSet(m_creature, SOUND_KILL2);
break;
}
}
void boss_illidanAI::JustDied(Unit* killer)
{
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
void boss_illidanAI::AttackStart(Unit *who)
{
if (!who)
return;
if (who->isTargetableForAttack() && who!= m_creature)
{
//Begin melee attack if we are within range
DoStartMeleeAttack(who);
if (!InCombat)
{
DoYell(" 你们这是自寻死路! ",LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature,11466);
// m_creature->RemoveAura(SPELL_ILLIDAN_KNEEL, 0);
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,389);
InCombat = true;
}
}
}
void boss_illidanAI::MoveInLineOfSight(Unit *who)
{
if (!who || m_creature->getVictim())
return;
if (who->isTargetableForAttack() && who->isInAccessablePlaceFor(m_creature) && m_creature->IsHostileTo(who))
{
float attackRadius = m_creature->GetAttackDistance(who);
if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->GetDistanceZ(who) <= CREATURE_Z_ATTACK_RANGE && m_creature->IsWithinLOSInMap(who))
{
if(who->HasStealthAura())
who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
//Begin melee attack if we are within range
DoStartMeleeAttack(who);
if (!InCombat)
{
DoYell(" 你们这是自寻死路! ",LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature,11466);
// m_creature->RemoveAura(SPELL_ILLIDAN_KNEEL, 0);
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,389);
InCombat = true;
}
}
}
}
void boss_illidanAI::UpdateAI(const uint32 diff)
{
// Maiev1GUID = pInstance->GetUnitGUID("MV");
// Creature* Maiev1 = ((Creature*)Unit::GetUnit((*m_creature), Maiev1GUID));
//Return since we have no target
if (!m_creature->SelectHostilTarget() || !m_creature->getVictim())
{
// if(!m_creature->HasAura(SPELL_ILLIDAN_KNEEL, 0))
// DoCast(m_creature, SPELL_ILLIDAN_KNEEL);
return;
}
if(IsTalking)
{
if(TalkTimer < diff)
{
switch(TalkCount)
{
case 0:
m_creature->RemoveAllAuras();
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, 6);
m_creature->SetFloatValue(OBJECT_FIELD_SCALE_X,1.5);
//m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, 21135);
//Illidan->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY, 45479);
//Illidan->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY+1, 45481);
m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY, 0);
m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO, 0);
m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY+1, 0);
m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO+2, 0);
//m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
//m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); ;
//Maiev1->RemoveFromWorld();
DoCast(m_creature->getVictim(), SPELL_SHADOW_PRISON);
DoYell(" 你们就这点本事吗?这就是你们全部的能耐? ",LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature,11476);
TalkTimer = 8000;
TalkCount++;
//}
break;
case 1:
if(MaievGUID)
{
Creature* Maiev = NULL;
Maiev = ((Creature*)Unit::GetUnit((*m_creature), MaievGUID));
if(Maiev && (Maiev->isAlive()))
{
//DoCast(Maiev, 40545);
Maiev->CastSpell(Maiev, 40545,true);
Maiev->SetUInt32Value(UNIT_NPC_EMOTESTATE, 5);
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,0);
Maiev->SetInFront(m_creature);
Maiev->SetVisibility(VISIBILITY_ON);
m_creature->SetInFront(Maiev);
Maiev->Yell(" 他们的愤怒和我的相比简直不值一提!伊利丹,我们之间终于要决一胜负了! ",LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(Maiev,11491);
Maiev->SetInFront(m_creature);
TalkTimer = 8000;
TalkCount++;
}
}
break;
case 2:
if(MaievGUID)
{
Creature* Maiev = NULL;
Maiev = ((Creature*)Unit::GetUnit((*m_creature), MaievGUID));
if(Maiev && (Maiev->isAlive()))
{
Maiev->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
Maiev->SetVisibility(VISIBILITY_ON);
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,6);
DoYell(" 玛维,你怎么可能! ",LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature,11477);
Maiev->SetInFront(m_creature);
m_creature->SetInFront(Maiev);
TalkTimer = 5000;
TalkCount++;
}
}
break;
case 3:
if(MaievGUID)
{
Creature* Maiev = NULL;
Maiev = ((Creature*)Unit::GetUnit((*m_creature), MaievGUID));
if(Maiev && (Maiev->isAlive()))
{ Maiev->SetUInt32Value(UNIT_NPC_EMOTESTATE, 5);
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,0);
Maiev->SetVisibility(VISIBILITY_ON);
Maiev->SetInFront(m_creature);
m_creature->SetInFront(Maiev);
//m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
// m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Maiev->Yell(" 啊~~~我长久以来的追猎终于要结束了……今天,正义将得到申张! ",LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(Maiev,11492);
TalkTimer = 9000;
TalkCount++;
}
}
break;
case 4:
if(MaievGUID)
{
Creature* Maiev = NULL;
Maiev = ((Creature*)Unit::GetUnit((*m_creature), MaievGUID));
if(Maiev && (Maiev->isAlive()))
{ m_creature->RemoveAllAuras();
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,389);
m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY, 45479);
m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY+1, 45481);
(*m_creature).GetMotionMaster()->Clear(false);
(*m_creature).GetMotionMaster()->Mutate(new TargetedMovementGenerator<Creature>(*m_creature->getVictim()));
//Creature* Maiev1 = NULL;
//Maiev1GUID = Maiev1->GetGUID();
//m_creature->AI()->AttackStart(Maiev);
//Maiev->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
//Maiev->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
//Maiev->SetVisibility(VISIBILITY_ON);
Maiev->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
Maiev->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Maiev->AI()->AttackStart(m_creature);
Maiev->AddThreat(m_creature, 500000);
//((CreatureAI*)Akama->AI())->AttackStart(m_creature);
Maiev->SetUInt32Value(UNIT_NPC_EMOTESTATE, 38);
phase = 5;
IsTalking = false;
}
}
break;
case 5:
if(MaievGUID)
{
Creature* Maiev = NULL;
Maiev = ((Creature*)Unit::GetUnit((*m_creature), MaievGUID));
if(Maiev && (Maiev->isAlive()))
{
//m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, 21135);
m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY, 0);
m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY+1, 0);
m_creature->SetFloatValue(OBJECT_FIELD_SCALE_X,1);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->InterruptSpell(CURRENT_GENERIC_SPELL);
(*m_creature).GetMotionMaster()->Clear();
(*m_creature).GetMotionMaster()->Idle();
m_creature->RemoveAllAuras();
//m_creature->Relocate(692.168640,305.063019,354.164886,0.122792);
//m_creature->SendMonsterMove(692.168640,305.063019,354.164886,0.122792,true,0);//返回中间
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, 404);
Maiev->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
Maiev->Yell(" 唉!结束了,你被打败了。 ",LANG_UNIVERSAL,NULL);
//Maiev1->SetVisibility(VISIBILITY_OFF);
//Maiev1->RemoveFromWorld();
DoPlaySoundToSet(Maiev,11496);
TalkTimer = 4000;
TalkCount++;
}
}
break;
case 6:
m_creature->RemoveAllAuras();
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, 404);
DoYell(" 你赢了,玛维!但是一个没有目标的猎手什么都不是!你离开了我,什么都不是…… ",LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature,11478);
TalkTimer = 25000;
TalkCount++;
break;
case 7:
if(MaievGUID)
{
Creature* Maiev = NULL;
Maiev = ((Creature*)Unit::GetUnit((*m_creature), MaievGUID));
if(Maiev && (Maiev->isAlive()))
{ m_creature->RemoveAllAuras();
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, 404);
Maiev->Yell(" 他说的对!我觉得很失落,我……什么都不是。 ",LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(Maiev,11497);
TalkTimer = 10000;
TalkCount++;
}
}
break;
case 8:
if(MaievGUID)
{
Creature* Maiev = NULL;
Maiev = ((Creature*)Unit::GetUnit((*m_creature), MaievGUID));
if(Maiev && (Maiev->isAlive()))
{ m_creature->RemoveAllAuras();
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, 404);
Maiev->Yell(" 再会,勇士们! ",LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(Maiev,11498);
Maiev->CastSpell(Maiev,34673,true);
TalkTimer = 1000;
TalkCount++;
}
}
break;
case 9:
if(MaievGUID)
{
Creature* Maiev = NULL;
Maiev = ((Creature*)Unit::GetUnit((*m_creature), MaievGUID));
if(Maiev && (Maiev->isAlive()))
{
Maiev->SetVisibility(VISIBILITY_OFF);
m_creature->getVictim()->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_NORMAL, NULL, false);
TalkTimer = 1000;
}
}
break;
}
}else TalkTimer -= diff;
return;
}
// if((!m_creature->isHover()) && (phase != 2) && (!IsTalking) && (!DemonForm))
// m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,389);
if (phase == 1 )
{
if (!m_creature->isHover())
{
m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF);
m_creature->SetHover(true);
}
}
if (phase == 5 && (!DemonForm) )
{
if(redTimer < diff)
{
DoYell(" 你对真正的力量一无所知! ", LANG_UNIVERSAL, NULL);
DoPlaySoundToSet(m_creature, 11469);
DoCast(m_creature->getVictim(), 41447);//变红
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,389);
redTimer = 60000;
}else redTimer -= diff;
}
if (phase == 5 )
{
Creature* Maiev = NULL;
Maiev = ((Creature*)Unit::GetUnit((*m_creature), MaievGUID));
if(mvTimer < diff)
{
switch(rand()%3)
{
case 0:
Maiev->Yell(" 感受我曾经感受过的痛苦吧 ", LANG_UNIVERSAL, NULL);
DoPlaySoundToSet(Maiev,11494);
Maiev->CastSpell(m_creature,40760,true);
break;
case 1:
Maiev->Yell(" 这一次你不会有机会再去监狱了 ", LANG_UNIVERSAL, NULL);
DoPlaySoundToSet(Maiev,11495);
Maiev->CastSpell(m_creature,40760,true);
break;
case 2:
Maiev->Yell(" 受死吧!你这魔鬼! ", LANG_UNIVERSAL, NULL);
DoPlaySoundToSet(Maiev,11500);
Maiev->CastSpell(Maiev,40545,true);
break;
}
mvTimer = 60000;
}else mvTimer -= diff;
}
if(((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 70) && (phase == 1))
{
Creature* Glaive1 = NULL;
Creature* Glaive2 = NULL;
Creature* Flame1 = NULL;
Creature* Flame2 = NULL;
m_creature->InterruptSpell(CURRENT_GENERIC_SPELL);
// DoTextEmote("is entering phase 2", m_creature);
phase = 2;
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,254);
(*m_creature).GetMotionMaster()->Clear(false);
(*m_creature).GetMotionMaster()->Idle();
m_creature->Relocate(692.168640,305.063019,354.164886,0.122792);
m_creature->SendMonsterMove(692.168640,305.063019,354.164886,0.122792,true,1000);//返回中间
m_creature->SetHover(true);
m_creature->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY, 0);
m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY+1, 0);
DoYell(" 让艾辛诺斯的烈焰吞噬你们! ",LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature,11480);
Glaive1 = m_creature->SummonCreature(22996,m_creature->GetPositionX()-10,m_creature->GetPositionY()+20, m_creature->GetPositionZ(),0,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,300000);
Glaive1->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Glaive2 = m_creature->SummonCreature(22996,m_creature->GetPositionX()-10,m_creature->GetPositionY()-20, m_creature->GetPositionZ(),3,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,300000);
Glaive2->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Flame1 = m_creature->SummonCreature(22997, m_creature->GetPositionX()+(rand()%25),m_creature->GetPositionY()-20, m_creature->GetPositionZ(), 5, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000);
Unit* target = NULL;
target = SelectUnit(SELECT_TARGET_RANDOM, 0);
if (target)
Flame1->AI()->AttackStart(target);
else Flame1->AI()->AttackStart(m_creature->getVictim());
Flame2 = m_creature->SummonCreature(22997, m_creature->GetPositionX()-(rand()%25),m_creature->GetPositionY()+20, m_creature->GetPositionZ(), 5, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000);
if (target)
Flame1->AI()->AttackStart(target);
else Flame1->AI()->AttackStart(m_creature->getVictim());
if(Glaive1 && Flame1)
{
Glaive1GUID = Glaive1->GetGUID();
Flame1GUID = Flame1->GetGUID();
Glaive1->CastSpell(Flame1, 40227, true);
}
if(Glaive2 && Flame2)
{
Glaive2GUID = Glaive2->GetGUID();
Flame2GUID = Flame2->GetGUID();
Glaive2->CastSpell(Flame2, 40227, true);
}
HasSummoned = true;
}
if(HasSummoned && (phase == 2))
{
if(Flame1GUID)
{
Creature* Flame1 = NULL;
Flame1 = ((Creature*)Unit::GetUnit((*m_creature), Flame1GUID));
if(Flame1 && (!Flame1->isAlive()))
{
m_creature->SetHealth(m_creature->GetMaxHealth()*0.6);
DeadFlameCount++;
Flame1GUID = 0;
}
}
if(Flame2GUID)
{
Creature* Flame2 = NULL;
Flame2 = ((Creature*)Unit::GetUnit((*m_creature), Flame2GUID));
if(Flame2 && (!Flame2->isAlive()))
{
m_creature->SetHealth(m_creature->GetMaxHealth()*0.65);
DeadFlameCount++;
Flame2GUID = 0;
}
}
if(!Flame1GUID && !Flame2GUID)
{
m_creature->InterruptSpell(CURRENT_GENERIC_SPELL);
// DoTextEmote("is entering phase 3", m_creature);
phase = 3;
m_creature->SetHealth(m_creature->GetMaxHealth()*0.65);
if(Glaive1GUID)
{
Unit* Glaive1 = NULL;
Glaive1 = Unit::GetUnit((*m_creature), Glaive1GUID);
if(Glaive1)
Glaive1->SetVisibility(VISIBILITY_OFF);
Glaive1->DealDamage(Glaive1, Glaive1->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_NORMAL, NULL, false);
}
if(Glaive2GUID)
{
Unit* Glaive2 = NULL;
Glaive2 = Unit::GetUnit((*m_creature), Glaive2GUID);
if(Glaive2)
Glaive2->SetVisibility(VISIBILITY_OFF);
Glaive2->DealDamage(Glaive2, Glaive2->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_NORMAL, NULL, false);
}
m_creature->RemoveAllAuras();
m_creature->InterruptSpell(CURRENT_GENERIC_SPELL);
DoYell(" 你们浪费了我太多时间,去死吧! ",LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature,11474);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY, 45479);
m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY+1, 45481);
m_creature->Relocate(692.168640,305.063019,354.164886,0.122792);
m_creature->SendMonsterMove(692.168640,305.063019,354.164886,0.122792,true,1000);//返回中间
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,0);
m_creature->SetHover(false);
(*m_creature).GetMotionMaster()->Clear(false);
(*m_creature).GetMotionMaster()->Mutate(new TargetedMovementGenerator<Creature>(*m_creature->getVictim()));
Unit* target;
target = SelectUnit(SELECT_TARGET_RANDOM, 0);
if(target)
{
m_creature->AI()->AttackStart(target);
m_creature->AddThreat(target, 50000);
(*m_creature).GetMotionMaster()->Clear(false);
(*m_creature).GetMotionMaster()->Mutate(new TargetedMovementGenerator<Creature>(*m_creature->getVictim()));
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,389);
}
}
}
if(((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 60) && (phase == 3))
{
phase = 10;
}
if(((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 40) && (phase == 10))
{
m_creature->RemoveAllAuras();
// DoYell("Entering Phase 4!", LANG_UNIVERSAL, NULL);
// DoTextEmote("is entering phase 4", m_creature);
m_creature->InterruptSpell(CURRENT_GENERIC_SPELL);
//if(!pInstance)
// return;
//MVGUID = pInstance->GetUnitGUID("MV");//获取马尾ID23197
// Creature* MV = ((Creature*)Unit::GetUnit((*m_creature), MVGUID));
//Maiev1->RemoveFromWorld();
// if(MV && MV->isAlive())
// {
// Creature* Maiev = NULL;
if (!Maiev)
Maiev = m_creature->SummonCreature(23197, (m_creature->GetPositionX() + 10), (m_creature->GetPositionY() + 5), m_creature->GetPositionZ(), 5, TEMPSUMMON_DEAD_DESPAWN, 10000);
if(Maiev)
{
MaievGUID = Maiev->GetGUID();
Maiev->SetVisibility(VISIBILITY_ON);
Maiev->CastSpell(Maiev, 30211,true);
(*m_creature).GetMotionMaster()->Clear(false);
(*m_creature).GetMotionMaster()->Idle();
Maiev->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
Maiev->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
MVsafe = true ;
DemonForm = false;
IsTalking = true;
TalkTimer = 0;
TalkCount = 0;
phase = 4;
Maiev->SetInFront(m_creature);
m_creature->SetInFront(Maiev);
}
//}
}
if(((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 2) && (phase == 5))
{
m_creature->InterruptSpell(CURRENT_GENERIC_SPELL);
// DoYell("ILLIDAN MUST DIE!!..wait what? That's me! NOO!!", LANG_UNIVERSAL, NULL);
m_creature->RemoveAllAuras();
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
if(MaievGUID)
{
Unit* Maiev = NULL;
Maiev = Unit::GetUnit((*m_creature), MaievGUID);
if(Maiev)
{
(*m_creature).GetMotionMaster()->Clear(false);
(*m_creature).GetMotionMaster()->Idle();
(*Maiev).GetMotionMaster()->Clear(false);
(*Maiev).GetMotionMaster()->Idle();
IsTalking = true;
TalkTimer = 0;
TalkCount = 5;
phase = 6;
}
}
}
if(phase != 2 && (!DemonForm))
{
if(ShearTimer < diff)
{
m_creature->StopMoving();
// DoYell("SHEAR!", LANG_UNIVERSAL, NULL);
DoCast(m_creature->getVictim(), SPELL_SHEAR);
ShearTimer = 20000;
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,389);
}else ShearTimer -= diff;
if(FlameCrashTimer < diff)
{
m_creature->StopMoving();
// DoYell("FLAME CRASH!", LANG_UNIVERSAL, NULL);
DoCast(m_creature->getVictim(), SPELL_FLAME_CRASH);
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,389);
FlameCrashTimer = 35000;
}else FlameCrashTimer -= diff;
if(DrawSoulTimer < diff)
{
//DoYell("Draw Soul!", LANG_UNIVERSAL, NULL);
DoCast(m_creature->getVictim(), SPELL_DRAW_SOUL);
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,389);
DrawSoulTimer = 40000;
}else DrawSoulTimer -= diff;
if(ParasiticTimer < diff)
{
// DoYell("Parasitic Shadowfiend!", LANG_UNIVERSAL, NULL);
Unit* target;
target = SelectUnit(SELECT_TARGET_RANDOM, 0);
if(target)
DoCast(target, SPELL_PARASITIC);
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,389);
ParasiticTimer = 50000;
}else ParasiticTimer -= diff;
if(m_creature->isAttackReady())
//m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,389);
DoMeleeAttackIfReady();
}
if(phase == 2)
{
if(!m_creature->isHover())
{
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,254);
m_creature->SetHover(true);
}
if(FlyTimer < diff)
{
// DoTextEmote("is flying to a new position", NULL);
m_creature->InterruptSpell(CURRENT_GENERIC_SPELL);
switch(rand()%5)
{
case 0:
SpecialMove(FLY_X1, FLY_Y1, FLY_Z1, 5000, m_creature);
m_creature->Relocate(FLY_X1, FLY_Y1, FLY_Z1);
break;
case 1:
SpecialMove(FLY_X2, FLY_Y2, FLY_Z2, 5000, m_creature);
m_creature->Relocate(FLY_X2, FLY_Y2, FLY_Z2);
break;
case 2:
SpecialMove(FLY_X3, FLY_Y3, FLY_Z3, 5000, m_creature);
m_creature->Relocate(FLY_X3, FLY_Y3, FLY_Z3);
break;
case 3:
SpecialMove(FLY_X4, FLY_Y4, FLY_Z4, 5000, m_creature);
m_creature->Relocate(FLY_X4, FLY_Y4, FLY_Z4);
break;
case 4:
SpecialMove(FLY_X5, FLY_Y5, FLY_Z5, 5000, m_creature);
m_creature->Relocate(FLY_X5, FLY_Y5, FLY_Z5);
break;
}
FlyTimer = 20000;
FireballTimer += 5000;
DarkBarrageTimer += 5000;
}else FlyTimer -= diff;
if(FireballTimer < diff)
{
Unit* target;
target = SelectUnit(SELECT_TARGET_RANDOM, 0);
if(target)
DoCast(target, SPELL_FIREBALL);
FireballTimer = 7000;
}else FireballTimer -= diff;
if(EyeBlastTimer < diff)
{
Creature* BlastTarget;
BlastTarget = m_creature->SummonCreature(23069, m_creature->GetPositionX()+(rand()%35),m_creature->GetPositionY()+(rand()%35), m_creature->GetPositionZ(), 5, TEMPSUMMON_TIMED_DESPAWN, 20000);
if(BlastTarget)
{
m_creature->InterruptSpell(CURRENT_GENERIC_SPELL);
DoTextEmote(" 他的眼睛放射出绿色的光芒…… ",NULL);
DoPlaySoundToSet(m_creature,11481);
DoYell(" 直视背叛者的双眼吧! ",LANG_UNIVERSAL,NULL);
DoCast(BlastTarget, SPELL_EYEBLAST);
}
EyeBlastTimer = 90000;
}else EyeBlastTimer -= diff;
if(DarkBarrageTimer < diff)
{
m_creature->InterruptSpell(CURRENT_GENERIC_SPELL);
DoYell(" 你们这些乌合之众休想碰到我! ",LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature,11479);
Unit* target;
target = SelectUnit(SELECT_TARGET_RANDOM, 0);
if(target)
DoCast(target, SPELL_DARK_BARRAGE);
DarkBarrageTimer = 60000;
FireballTimer += 10000;
FlyTimer += 10000;
}else DarkBarrageTimer -= diff;
}
if((phase == 10 || phase == 4 || phase == 5 )&& (!DemonForm))
{
if(AgonizingFlamesTimer < diff)
{
DoPlaySoundToSet(m_creature,11467);
DoYell(" 我可以感觉到你们的仇恨! ",LANG_UNIVERSAL,NULL);
Unit* target;
target = SelectUnit(SELECT_TARGET_RANDOM, 0);
if(target)
DoCast(target, SPELL_AGONIZING_FLAMES);
AgonizingFlamesTimer = 25000;
}else AgonizingFlamesTimer -= diff;
}
if(phase == 10 || phase == 5)
{
// if(DemonFormTimer < diff)
// {
if(!DemonForm && gut == 1)
{
gut ++;
m_creature->RemoveAllAuras();
m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY, 0);
m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO, 0);
m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY+1, 0);
m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO+2, 0);
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,404);
//m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
//m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->InterruptSpell(CURRENT_GENERIC_SPELL);
ResetThreat();
(*m_creature).GetMotionMaster()->Clear(false);
(*m_creature).GetMotionMaster()->Idle();
//DoCast(m_creature,40398);//hover?
DoYell("感受我体内的恶魔之力吧! ",LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature,11475);
//(*m_creature).GetMotionMaster()->Mutate(new TargetedMovementGenerator<Creature>(*m_creature->getVictim()));
gutTime1 = 3000;
return;
}
if (gut == 2 && gutTime1 < diff)
{
gut ++;
m_creature->RemoveAllAuras();
m_creature->InterruptSpell(CURRENT_GENERIC_SPELL);
ResetThreat();
(*m_creature).GetMotionMaster()->Clear(false);
(*m_creature).GetMotionMaster()->Idle();
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, 403);
//DoCast(m_creature,40511);//hover?
gutTime2 = 1000;
return;
}else gutTime1 -= diff;
if (gut == 3 && gutTime2 < diff)
{
gut ++;
DemonForm = true;
m_creature->RemoveAllAuras();
m_creature->InterruptSpell(CURRENT_GENERIC_SPELL);
ResetThreat();
(*m_creature).GetMotionMaster()->Clear(false);
(*m_creature).GetMotionMaster()->Idle();
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, 405);
gutTime3= 3000;
return;
} else gutTime2 -= diff;
if (gut == 4 && gutTime3 < diff)
{
gut ++;
DemonForm = true;
m_creature->RemoveAllAuras();
m_creature->InterruptSpell(CURRENT_GENERIC_SPELL);
ResetThreat();
(*m_creature).GetMotionMaster()->Clear(false);
(*m_creature).GetMotionMaster()->Idle();
//m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
//m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
DoCast(m_creature, SPELL_DEMON_FORM);//变身
m_creature->SetFloatValue(OBJECT_FIELD_SCALE_X,2.5);
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, 53);
gutTime4= 60000;
return;
} else gutTime3-= diff;
if (gut == 5 && gutTime4 < diff)
{
gut ++;
m_creature->InterruptSpell(CURRENT_GENERIC_SPELL);
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,404);
m_creature->SetFloatValue(OBJECT_FIELD_SCALE_X,1.5);
ResetThreat();
(*m_creature).GetMotionMaster()->Clear(false);
(*m_creature).GetMotionMaster()->Idle();
//DoCast(m_creature,40511);//hover?
gutTime5 = 3000;
return;
}else gutTime4-= diff;
if (gut == 6 && gutTime5 < diff)
{
gut ++;
m_creature->RemoveAllAuras();
m_creature->InterruptSpell(CURRENT_GENERIC_SPELL);
m_creature->RemoveAura(SPELL_DEMON_FORM, 0);
m_creature->RemoveAura(SPELL_DEMON_FORM, 1);
m_creature->RemoveAura(SPELL_DEMON_FORM, 2);
ResetThreat();
(*m_creature).GetMotionMaster()->Clear(false);
(*m_creature).GetMotionMaster()->Idle();
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, 403);
gutTime6 = 1000;
return;
}else gutTime5 -= diff;
if (gut == 7 && gutTime6 < diff)
{
gut ++;
m_creature->RemoveAllAuras();
m_creature->InterruptSpell(CURRENT_GENERIC_SPELL);
ResetThreat();
(*m_creature).GetMotionMaster()->Clear(false);
(*m_creature).GetMotionMaster()->Idle();
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, 405);
gutTime7= 3000;
return;
} else gutTime6 -= diff;
if (gut == 8 && gutTime7 < diff)
{
gut ++;
m_creature->RemoveAllAuras();
ResetThreat();
m_creature->InterruptSpell(CURRENT_GENERIC_SPELL);
(*m_creature).GetMotionMaster()->Clear(false);
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, 389);
(*m_creature).GetMotionMaster()->Mutate(new TargetedMovementGenerator<Creature>(*m_creature->getVictim()));
m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, NORMAL_FORM_DISPLAYID);
m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY, 45479);
m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY+1, 45481);
DemonForm = false;
gutTime8= 60000;
return;
}else gutTime7 -= diff;
if (gut == 9 && gutTime8 < diff)
{
gut = 1;
//DoYell(" 变人完事! ", LANG_UNIVERSAL, NULL);
return;
}else gutTime8-= diff;
//DemonFormTimer = 15000;
// }else DemonFormTimer -= diff;
}
if(DemonForm)
{
if(ShadowBlastTimer < diff)
{
Unit* target;
target = SelectUnit(SELECT_TARGET_RANDOM, 0);
DoCast(target, SPELL_SHADOW_BLAST);
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, 53);
ShadowBlastTimer = 4000;
}else ShadowBlastTimer -= diff;
if(FlameBurstTimer < diff)
{
// DoYell("FLAME BURST!", LANG_UNIVERSAL, NULL);
DoYell(" 感受一万年的仇恨吧! ", LANG_UNIVERSAL, NULL);
DoPlaySoundToSet(m_creature, 11470);
DoCast(m_creature->getVictim(), SPELL_FLAME_BURST);
FlameBurstTimer = 35000;
}else FlameBurstTimer -= diff;
if(SummonTimer < diff)
{
// DoYell("SUMMONING BEHOLDERS!", LANG_UNIVERSAL, NULL);
for(uint32 i = 0; i<5; i++)
{
Creature* Demon = m_creature->SummonCreature(23375, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 5, TEMPSUMMON_CORPSE_DESPAWN, 2000);
if(Demon)
{
Unit* target;
target = SelectUnit(SELECT_TARGET_RANDOM, 0);
if(target)
{
Demon->AI()->AttackStart(target);
Demon->AddThreat(target, 50000);
(*Demon).GetMotionMaster()->Mutate(new TargetedMovementGenerator<Creature>(*Demon->getVictim()));
}
}
}
SummonTimer = 35000;
}else SummonTimer -= diff;
if( m_creature->getVictim() && m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE))
{
if( m_creature->isAttackReady() )
{
m_creature->AttackerStateUpdate(m_creature->getVictim());
m_creature->resetAttackTimer();
}
}
}
// if(DemonFormTimer < diff)
// {
//DoYell("LEAVING DEMON FORM", LANG_UNIVERSAL, NULL);
// m_creature->RemoveAllAuras();
// ResetThreat();
// m_creature->InterruptSpell(CURRENT_GENERIC_SPELL);
// (*m_creature).GetMotionMaster()->Clear(false);
// (*m_creature).GetMotionMaster()->Mutate(new TargetedMovementGenerator<Creature>(*m_creature->getVictim()));
// m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, NORMAL_FORM_DISPLAYID);
// m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY, 45479);
// m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY+1, 45481);
// m_creature->RemoveAura(SPELL_DEMON_FORM, 0);
// m_creature->RemoveAura(SPELL_DEMON_FORM, 1);
// m_creature->RemoveAura(SPELL_DEMON_FORM, 2);
// DemonForm = false;
// DemonFormTimer = 15000;
// gut = 1;
// }else DemonFormTimer -= diff;
}
void boss_illidanAI::ResetThreat()
{
std::list<HostilReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
std::list<HostilReference*>::iterator i = m_threatlist.begin();
for(i = m_threatlist.begin(); i != m_threatlist.end(); ++i)
{
Unit* pUnit = NULL;
pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid());
if(pUnit)
{
m_creature->getThreatManager().modifyThreatPercent(pUnit, -100);
}
}
}
void boss_illidanAI::SpecialMove(float X, float Y, float Z, uint32 Time, Creature* creature)
{
WorldPacket data( SMSG_MONSTER_MOVE, (41+creature->GetPackGUID().size()) );
data.append(creature->GetPackGUID());
data << creature->GetPositionX() << creature->GetPositionY() << creature->GetPositionZ();
// unknown field - unrelated to orientation
// seems to increment about 1000 for every 1.7 seconds
// for now, we'll just use mstime
data << getMSTime();
data << uint8(0); // walkback when walking from A to B
data << uint32(0x0200); // flags
/* Flags:
512: Floating, moving without walking/running
*/
data << Time; // Time in between points
data << uint32(1); // 1 single waypoint
data << X << Y << Z; // the single waypoint Point B
creature->SendMessageToSet( &data, true );
}
struct MANGOS_DLL_DECL flame_of_azzinothAI : public ScriptedAI
{
flame_of_azzinothAI(Creature *c) : ScriptedAI(c) {EnterEvadeMode();}
uint32 FlameBlastTimer;
uint32 BlazeTimer;
bool InCombat;
void EnterEvadeMode()
{
FlameBlastTimer = 5000;
BlazeTimer = 0;
InCombat = false;
m_creature->RemoveAllAuras();
m_creature->DeleteThreatList();
m_creature->CombatStop();
DoGoHome();
}
void AttackStart(Unit *who)
{
if (!who)
return;
if (who->isTargetableForAttack() && who!= m_creature)
{
//Begin melee attack if we are within range
DoStartMeleeAttack(who);
InCombat = true;
}
}
void MoveInLineOfSight(Unit *who)
{
if (!who || m_creature->getVictim())
return;
if (who->isTargetableForAttack() && who->isInAccessablePlaceFor(m_creature) && m_creature->IsHostileTo(who))
{
float attackRadius = m_creature->GetAttackDistance(who);
if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->GetDistanceZ(who) <= CREATURE_Z_ATTACK_RANGE && m_creature->IsWithinLOSInMap(who))
{
if(who->HasStealthAura())
who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
DoStartMeleeAttack(who);
InCombat = true;
}
}
}
void UpdateAI(const uint32 diff)
{
//Check if we have a target
if (!m_creature->SelectHostilTarget() || !m_creature->getVictim())
return;
if(FlameBlastTimer < diff)
{
DoCast(m_creature, SPELL_FLAME_BLAST);
FlameBlastTimer = 15000;
}else FlameBlastTimer -= diff;
if (BlazeTimer < diff)
{
DoCast(m_creature, SPELL_SUMMON_BLAZE);
BlazeTimer = 10000;
}else BlazeTimer -= diff;
}
};
struct MANGOS_DLL_DECL flamecrashAI : public ScriptedAI
{
flamecrashAI(Creature *c) : ScriptedAI(c) {EnterEvadeMode();}
uint32 FlameCrashTimer;
void EnterEvadeMode()
{
FlameCrashTimer = 1000;
m_creature->RemoveAllAuras();
m_creature->DeleteThreatList();
m_creature->CombatStop();
DoGoHome();
}
void AttackStart(Unit *who){ return; }
void MoveInLineOfSight(Unit *who){ return; }
void UpdateAI(const uint32 diff)
{
if(FlameCrashTimer < diff)
{
DoCast(m_creature, SPELL_FLAME_CRASH_EFFECT);
FlameCrashTimer = 15000;
}else FlameCrashTimer -= diff;
}
};
struct MANGOS_DLL_DECL demonfireAI : public ScriptedAI
{
demonfireAI(Creature *c) : ScriptedAI(c) {EnterEvadeMode();}
uint32 DemonFireTimer;
void EnterEvadeMode()
{
DemonFireTimer = 0;
m_creature->RemoveAllAuras();
m_creature->DeleteThreatList();
m_creature->CombatStop();
DoGoHome();
}
void AttackStart(Unit *who){ return; }
void MoveInLineOfSight(Unit *who){ return; }
void UpdateAI(const uint32 diff)
{
if(DemonFireTimer < diff)
{
DoCast(m_creature, SPELL_DEMON_FIRE);
DemonFireTimer = 30000;
}else DemonFireTimer -= diff;
}
};
struct MANGOS_DLL_DECL blazeAI : public ScriptedAI
{
blazeAI(Creature *c) : ScriptedAI(c) {EnterEvadeMode();}
uint32 BlazeTimer;
void EnterEvadeMode(){ BlazeTimer = 1000; }
void AttackStart(Unit *who){ return; }
void MoveInLineOfSight(Unit *who){ return; }
void UpdateAI(const uint32 diff)
{
if(BlazeTimer < diff)
{
DoCast(m_creature, SPELL_BLAZE);
BlazeTimer = 15000;
}else BlazeTimer -= diff;
}
};
struct MANGOS_DLL_DECL cage_trap_triggerAI : public ScriptedAI
{
cage_trap_triggerAI(Creature *c) : ScriptedAI(c)
{
// if(c->GetInstanceData())
//pInstance = ((ScriptedInstance*)c->GetInstanceData());
EnterEvadeMode();
}
//ScriptedInstance* pInstance;
// uint64 IllidanGUID;
uint32 CagedTimer;
uint32 mvTimer;
void EnterEvadeMode()
{
CagedTimer = 0;
mvTimer = 0;
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->SetVisibility(VISIBILITY_OFF);
m_creature->SetFloatValue(OBJECT_FIELD_SCALE_X,2.5);
m_creature->RemoveAllAuras();
m_creature->DeleteThreatList();
m_creature->CombatStop();
DoGoHome();
}
void AttackStart(Unit *who){ return; }
void MoveInLineOfSight(Unit *who){ return; }
void UpdateAI(const uint32 diff)
{
}
};
struct MANGOS_DLL_DECL boss_illidan1AI : public ScriptedAI
{
boss_illidan1AI(Creature *c) : ScriptedAI(c)
{
if(c->GetInstanceData())
pInstance = ((ScriptedInstance*)c->GetInstanceData());
EnterEvadeMode();
}
ScriptedInstance* pInstance;
uint64 IllidanGUID1;
void EnterEvadeMode()
{
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,398);
m_creature->SetFloatValue(OBJECT_FIELD_SCALE_X,1.5);
m_creature->RemoveAllAuras();
m_creature->DeleteThreatList();
m_creature->CombatStop();
DoGoHome();
}
void AttackStart(Unit *who){ return; }
void MoveInLineOfSight(Unit *who){ return; }
void UpdateAI(const uint32 diff)
{
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
};
struct MANGOS_DLL_DECL akamaAI : public ScriptedAI
{
akamaAI(Creature *c) : ScriptedAI(c)
{
if(c->GetInstanceData())
pInstance = ((ScriptedInstance*)c->GetInstanceData());
EnterEvadeMode();
}
ScriptedInstance* pInstance;
uint64 IllidanGUID;
uint64 IllidanGUID1;
uint32 WalkTime;
uint32 TalkTimer;
uint32 WalkTime1;
uint32 TalkCount;
uint32 DespawnTimer;
uint32 wut;
uint32 wutTime1;
uint32 wutTime2;
uint32 wutTime3;
uint32 wutTime4;
bool IsTalking;
bool Despawn;
void EnterEvadeMode()
{
if(pInstance)
{
pInstance->SetData("IllidanStormrageEvent", 0); // Not Started
}
IllidanGUID = NULL;
IllidanGUID1 = NULL;
wut = 1;
wutTime1 = 0;
wutTime2 = 0;
wutTime3 = 0;
wutTime4 = 0;
WalkTime = 0;
TalkTimer = 0;
TalkCount = 0;
//WalkCount = 0;
IsTalking = false;
DespawnTimer = 0;
Despawn = false;
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
// m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, 20681);
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
m_creature->SetVisibility(VISIBILITY_ON);
//Illidan->SetVisibility(VISIBILITY_ON);
m_creature->RemoveAllAuras();
m_creature->DeleteThreatList();
m_creature->CombatStop();
DoGoHome();
}
void BeginEvent(Player* target)
{
if(!pInstance)
return;
IllidanGUID1 = pInstance->GetData64("IllidanStormrage");
Creature* Illidan1 = ((Creature*)Unit::GetUnit((*m_creature), IllidanGUID1));
Creature* Illidan = NULL;
Illidan = m_creature->SummonCreature(2, 692.168640,305.063019,354.164886,0.122792, TEMPSUMMON_DEAD_DESPAWN, 100000);
IllidanGUID = Illidan->GetGUID();
m_creature->SetUInt32Value(UNIT_NPC_FLAGS,0);
Illidan->SetVisibility(VISIBILITY_OFF);
Illidan1->SetVisibility(VISIBILITY_ON);
if(Illidan && Illidan->isAlive())
{
// DoYell("Checking and removing aura", LANG_UNIVERSAL, NULL);
// if(Illidan->HasAura(SPELL_ILLIDAN_KNEEL, 0))
// Illidan->RemoveAura(SPELL_ILLIDAN_KNEEL, 0);
//DoYell("Setting destination", LANG_UNIVERSAL, NULL);
float destX = Illidan->GetPositionX() + 30;
float destY = Illidan->GetPositionY();
float destZ = Illidan->GetPositionZ();
// DoYell("Setting Walk Time", LANG_UNIVERSAL, NULL);
// DoYell("Sending Monster Move", LANG_UNIVERSAL, NULL);
//m_creature->SendMonsterMove(destX, destY, destZ, 0, false, WalkTime);
WalkTime = 10000;
// SpecialMove (755.229614, 304.244415, 312.159668, 5000, m_creature);
// SpecialMove (771.880676, 305.175659, 313.610596, 5000, m_creature);
//SpecialMove (779.961548, 305.039795, 319.706055, 5000, m_creature);
//SpecialMove (793.287415, 290.741547, 319.774963, 5000, m_creature);
//SpecialMove (792.858276, 278.565430, 328.446716, 5000, m_creature);
//SpecialMove (792.382019, 261.826965, 341.463715, 5000, m_creature);
//SpecialMove (782.984314, 249.260162, 341.709167, 5000, m_creature);
//SpecialMove (773.819031, 245.568298, 347.780304, 5000, m_creature);
//SpecialMove (764.204895, 241.937164, 353.667877, 5000, m_creature);
//SpecialMove (742.981079, 252.640411, 352.996094 5000, m_creature);
//SpecialMove (733.58,306.13,352.996185, 5000, m_creature);
//SpecialMove (715.58429,305.4794,353.25, 5000, m_creature);
}
}
void DamageTaken(Unit *done_by, uint32 &damage)
{
if(damage > m_creature->GetHealth())
{
if(done_by != m_creature)
{
damage = 0;
m_creature->SetHealth(m_creature->GetMaxHealth());
}
}
}
void UpdateAI(const uint32 diff)
{
//GameObject* Gate = _unit->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(774.7f, 304.6f, 314.85f, 185905);
if(WalkTime > 0)
{
// if(WalkTime < diff) 这个应该是检测移动的循环 之前不能触发暂时屏蔽
// {
if(IllidanGUID1)
{
Unit* Illidan = NULL;
Illidan = Unit::GetUnit((*m_creature), IllidanGUID);
Creature* Illidan1 = NULL;
Illidan1 = ((Creature*)Unit::GetUnit((*m_creature), IllidanGUID1));
if(Illidan && Illidan->isAlive())
{
m_creature->SetUInt32Value(UNIT_NPC_FLAGS,0);//设计阿卡马不允许选择
TalkCount = 0;//说话次数归0
IsTalking = true;//设计准备开始对话
WalkTime = 0;//取消移动循环条件
// DoYell("Illidan Alive, idling", LANG_UNIVERSAL, NULL);
// (*m_creature).GetMotionMaster()->Clear(false);
// (*m_creature).GetMotionMaster()->Idle();
// DoYell("AttackStart", LANG_UNIVERSAL, NULL);
// AttackStart(Illidan);
//DoYell("Set In Front", LANG_UNIVERSAL, NULL);
//Illidan->SetInFront(m_creature);
// m_creature->SetInFront(Illidan);
//DoYell("Set In Combat", LANG_UNIVERSAL, NULL);
//InCombat = true;
// DoYell("Talk Count", LANG_UNIVERSAL, NULL);
}
}
// }else WalkTime -= diff;
}
if(IsTalking)
{
if(IllidanGUID && IllidanGUID1)
{
Unit* Illidan = NULL;
Illidan = Unit::GetUnit((*m_creature), IllidanGUID);
Creature* Illidan1 = NULL;
Illidan1 = ((Creature*)Unit::GetUnit((*m_creature), IllidanGUID1));
if(TalkTimer < diff)
{
// DoYell("Reacquiring GUID", LANG_UNIVERSAL, NULL);
switch(TalkCount)
{
case 0:
// DoYell("Entering Illidan Block", LANG_UNIVERSAL, NULL);
if(Illidan1 && Illidan1->isAlive())
{
Illidan1->SetVisibility(VISIBILITY_ON);
//Illidan->SetVisibility(VISIBILITY_OFF);
DoYell(" 时机来临了,终于等到这一刻了! ",LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature, 11380);
Illidan->setFaction(35);
Illidan1->SetUInt32Value(UNIT_NPC_EMOTESTATE, 398);
//Illidan->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY, 45479);
//Illidan->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY+1, 45481);
//Illidan->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY, 0);
//Illidan->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY+1, 0);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Illidan1->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
Illidan1->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
DoCast(m_creature, 40545);
TalkTimer = 8000;//阿卡马开门时间
TalkCount++;
}
break;
case 1:
if(Illidan1 && Illidan1->isAlive())
{
if(pInstance)
{
DoYell(" 伊利丹会付出代价的! ",LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature, 11381);
pInstance->SetData("GrandmasterVorpil_Death", 0);
}
m_creature->InterruptSpell(CURRENT_GENERIC_SPELL);
TalkTimer = 1000;//阿卡马打开大门结束
TalkCount++;
}
break;
case 2:
if(Illidan1 && Illidan1->isAlive())
{
//DoYell(" 阿卡马第一步 ",LANG_UNIVERSAL,NULL);
SpecialMove (771.880676, 305.175659, 313.610596, 3000, m_creature);
m_creature->Relocate(771.880676, 305.175659, 313.610596);
//m_creature->StopMoving();
TalkTimer = 3000;//阿卡马走路时间
TalkCount++;
}
break;
case 3:
if(Illidan1 && Illidan1->isAlive())
{
//DoYell(" 阿卡马第2步 ",LANG_UNIVERSAL,NULL);
SpecialMove (779.961548, 305.039795, 319.706055, 5000, m_creature);
m_creature->Relocate(779.961548, 305.039795, 319.706055);
TalkTimer = 5000;//阿卡马走路时间
TalkCount++;
}
break;
case 4:
if(Illidan1 && Illidan1->isAlive())
{
//DoYell(" 阿卡马第3步 ",LANG_UNIVERSAL,NULL);
SpecialMove (793.287415, 290.741547, 319.774963, 5000, m_creature);
m_creature->Relocate(793.287415, 290.741547, 319.774963);
TalkTimer = 5000;//阿卡马走路时间
TalkCount++;
}
break;
case 5:
if(Illidan1 && Illidan1->isAlive())
{
//DoYell(" 阿卡马第4步 ",LANG_UNIVERSAL,NULL);
SpecialMove (792.858276, 278.565430, 328.446716, 5000, m_creature);
m_creature->Relocate(792.858276, 278.565430, 328.446716);
TalkTimer = 5000;//阿卡马走路时间
TalkCount++;
}
break;
case 6:
if(Illidan1 && Illidan1->isAlive())
{
//DoYell(" 阿卡马第5步 ",LANG_UNIVERSAL,NULL);
SpecialMove (792.382019, 261.826965, 341.463715, 5000, m_creature);
m_creature->Relocate(792.382019, 261.826965, 341.463715);
TalkTimer = 5000;//阿卡马走路时间
TalkCount++;
}
break;
case 7:
if(Illidan1 && Illidan1->isAlive())
{
//DoYell(" 阿卡马第6步 ",LANG_UNIVERSAL,NULL);
SpecialMove (782.984314, 249.260162, 341.709167, 5000, m_creature);
m_creature->Relocate(782.984314, 249.260162, 341.709167);
TalkTimer = 5000;//阿卡马走路时间
TalkCount++;
}
break;
case 8:
if(Illidan1 && Illidan1->isAlive())
{
//DoYell(" 阿卡马第7步 ",LANG_UNIVERSAL,NULL);
SpecialMove (773.819031, 245.568298, 347.780304, 5000, m_creature);
m_creature->Relocate(773.819031, 245.568298, 347.780304);
TalkTimer = 5000;//阿卡马走路时间
TalkCount++;
}
break;
case 9:
if(Illidan1 && Illidan1->isAlive())
{
//DoYell(" 阿卡马第8步 ",LANG_UNIVERSAL,NULL);
SpecialMove (764.204895, 241.937164, 353.667877, 5000, m_creature);
m_creature->Relocate(764.204895, 241.937164, 353.667877);
TalkTimer = 5000;//阿卡马走路时间
TalkCount++;
}
break;
case 10:
if(Illidan1 && Illidan1->isAlive())
{
//DoYell(" 阿卡马第9步 ",LANG_UNIVERSAL,NULL);
SpecialMove (742.981079, 252.640411, 352.996094, 5000, m_creature);
m_creature->Relocate(742.981079, 252.640411, 352.996094);
TalkTimer = 5000;//阿卡马走路时间
TalkCount++;
}
break;
case 11:
if(Illidan1 && Illidan1->isAlive())
{
//DoYell(" 阿卡马第10步 ",LANG_UNIVERSAL,NULL);
SpecialMove (716.58429,305.4794,353.25, 10000, m_creature);
m_creature->Relocate(716.58429,305.4794,353.25);
TalkTimer = 10000;//阿卡马走路时间
TalkCount++;
}
break;
case 12:
if(Illidan1 && Illidan1->isAlive())
{
DoYell(" 我们要终结你的统治,伊利丹。我的人民以及整个外域都将重获自由! ",LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature,11389);
//Akama->Yell(" 圣光会再次照耀这阴暗的太厅,我发誓! ",LANG_UNIVERSAL,NULL);
//DoPlaySoundToSet(Akama,11387);
Illidan1->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,25);
Illidan1->SetVisibility(VISIBILITY_ON);
Illidan->SetVisibility(VISIBILITY_OFF);
//m_creature->SendMonsterMove(733.11804,306.13,352.996185,3.127908,true,0);//
m_creature->SendMonsterMove(715.58429,305.4794,353.25,3.127908,true,0);//
m_creature->Relocate(715.58429,305.4794,353.25,3.127908);
TalkTimer = 10000;
TalkCount++;
}
break;
case 13:
if(Illidan1 && Illidan1->isAlive())
{
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
Illidan1->SetUInt32Value(UNIT_NPC_EMOTESTATE, 6);
Illidan1->SetVisibility(VISIBILITY_ON);
//Illidan->SetVisibility(VISIBILITY_OFF);
Illidan1->Yell(" 阿卡玛,你的两面三刀并没有让我感到意外。我早就应该把你和你那些畸形的同胞全部杀掉! ",LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature,11463);
TalkTimer = 12500;
TalkCount++;
}
break;
case 14:
if(Illidan1 && Illidan1->isAlive())
{
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,25);
DoYell(" 圣光会再次照耀这阴暗的大厅.我发誓! ",LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature, 11387);
Illidan1->SetUInt32Value(UNIT_NPC_EMOTESTATE, 6);
Illidan1->SetVisibility(VISIBILITY_ON);
//Illidan->SetVisibility(VISIBILITY_OFF);
TalkTimer = 5500;
TalkCount++;
break;
}
case 15:
if(Illidan1 && Illidan1->isAlive())
{ Illidan1->SetVisibility(VISIBILITY_ON);
//Illidan->SetVisibility(VISIBILITY_OFF);
Illidan1->SetUInt32Value(UNIT_NPC_EMOTESTATE, 6);
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
Illidan1->Yell(" 说的好,但是这毫无意义! ",LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature,11464);
TalkTimer = 7000;
TalkCount++;
}
break;
case 16:
if(Illidan1 && Illidan1->isAlive())
{
Illidan1->SetVisibility(VISIBILITY_ON);
Illidan->SetVisibility(VISIBILITY_OFF);
Illidan->SetUInt32Value(UNIT_NPC_EMOTESTATE, 406);
Illidan1->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
DoYell(" 进行战斗,朋友们!杀了它,让我的人民摆脱诅咒! ",LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature,11391);
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,25);
TalkTimer = 8800;
TalkCount++;
}
break;
case 17:
if(Illidan && Illidan->isAlive())
{
Creature* Illidan = NULL;
Illidan = ((Creature*)Unit::GetUnit((*m_creature), IllidanGUID));
//Unit* Illidan = NULL;
//Illidan = Unit::GetUnit((*m_creature), IllidanGUID);
Illidan1->SetVisibility(VISIBILITY_OFF);
Illidan->SetVisibility(VISIBILITY_ON);
Illidan->setFaction(1752);
Illidan->RemoveAllAuras();
Illidan->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY, 45479);
Illidan->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY+1, 45481);
Illidan->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Illidan->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
Illidan->SetUInt32Value(UNIT_NPC_EMOTESTATE, 389);
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, 38);
//Illidan->MonsterYell(" 你们这是自寻死路! ",LANG_UNIVERSAL,NULL);
//DoPlaySoundToSet(m_creature,11466);
Illidan->SetHover(true);
//(Illidan).GetMotionMaster()->Clear(false);
//(Illidan).GetMotionMaster()->Mutate(new TargetedMovementGenerator<Creature>(Illidan->getVictim()));
(*Illidan).GetMotionMaster()->Clear(false);
(*Illidan).GetMotionMaster()->Mutate(new TargetedMovementGenerator<Creature>(*m_creature));
m_creature->AddThreat(Illidan, 500000.0f);
Illidan->AddThreat(m_creature, 50000.0f);
((CreatureAI*)m_creature->AI())->AttackStart(Illidan);
Illidan->AI()->AttackStart(m_creature);
DoStartMeleeAttack(Illidan);
Illidan->SetInFront(m_creature);
m_creature->SetInFront(Illidan);
if(IllidanGUID)
{
Illidan->AI()->AttackStart(m_creature);
Unit* target;
target = SelectUnit(SELECT_TARGET_RANDOM, 0);
if(target)
{
Illidan->AI()->AttackStart(target);
Illidan->SetUInt32Value(UNIT_NPC_EMOTESTATE, 389);
Illidan->AddThreat(target, 50000);
(*Illidan).GetMotionMaster()->Mutate(new TargetedMovementGenerator<Creature>(*Illidan->getVictim()));
//目标攻击语句重点参考
}
}
//Unit* target = NULL;
//target = SelectUnit(SELECT_TARGET_RANDOM, 0);
//if (target)
//Illidan1->AddThreat(target, 50000.0f);
//Illidan1->AI()->AttackStart(target);
IsTalking = false;
}
break;
case 18:
if(Illidan && Illidan->isAlive() )
{
Illidan->MonsterYell(" 来吧!我的手下!让这个叛徒付出代价! ",LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature,11465);
TalkTimer = 5000;//这里设计30秒一粒单开始叫小弟
Illidan->CastSpell(Illidan,41117,false);
TalkCount++;
}
break;
case 19:
if(Illidan && Illidan->isAlive() )
{
//Illidan->MonsterYell(" 来吧!我的手下!让这个叛徒付出代价! ",LANG_UNIVERSAL,NULL);
//DoPlaySoundToSet(m_creature,11465);
TalkTimer = 5000;//这里设计30秒一粒单开始叫小弟
Illidan->CastSpell(Illidan,41117,false);
TalkCount++;
}
break;
case 20:
if(Illidan && Illidan->isAlive() )
{
//Illidan->MonsterYell(" 来吧!我的手下!让这个叛徒付出代价! ",LANG_UNIVERSAL,NULL);
//DoPlaySoundToSet(m_creature,11465);
TalkTimer = 5000;//这里设计30秒一粒单开始叫小弟
Illidan->CastSpell(Illidan,41117,false);
TalkCount++;
}
break;
case 21:
if(Illidan && Illidan->isAlive() )
{
//Illidan->MonsterYell(" 来吧!我的手下!让这个叛徒付出代价! ",LANG_UNIVERSAL,NULL);
//DoPlaySoundToSet(m_creature,11465);
TalkTimer = 5000;//这里设计30秒一粒单开始叫小弟
Illidan->CastSpell(Illidan,41117,false);
TalkCount++;
}
break;
case 22:
if(Illidan && Illidan->isAlive() )
{
DoYell(" 我来对付这些渣子!进攻吧朋友们!向伊利丹发起进攻! ",LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature,11390);
TalkTimer = 6000;
DespawnTimer = 5000;
Despawn = true;
IsTalking = false;
}
break;
}
}else TalkTimer -= diff;
return;
}
}
if(!m_creature->SelectHostilTarget() || !m_creature->getVictim())
return;
if(IllidanGUID)
{
Creature* Illidan = NULL;
Illidan = ((Creature*)Unit::GetUnit((*m_creature), IllidanGUID));
if(Illidan && Illidan->isAlive())
{
if((Illidan->GetHealth()*100 / Illidan->GetMaxHealth()) < 90 && (TalkCount < 18))
{
IsTalking = true;
TalkCount = 18;
}
if((Illidan->GetHealth()*100 / Illidan->GetMaxHealth()) < 90 && (TalkCount == 22))
{
TalkCount = 23;
}
}
}
if(Despawn)
{
if(DespawnTimer < diff)
{
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
SpecialMove (745.94,365.729,352.996, 6000, m_creature);
m_creature->Relocate(745.94,365.729,352.996);
m_creature->SetVisibility(VISIBILITY_OFF);
m_creature->RemoveFromWorld();
//m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, 11686);
m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_NORMAL, NULL, false);
}else DespawnTimer -= diff;
}
if((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 30)
{
DoCast(m_creature, SPELL_POTION);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
//m_creature->SetHealth(m_creature->GetMaxHealth());
}
}
void SpecialMove(float X, float Y, float Z, uint32 Time,Creature* creature)
{
WorldPacket data( SMSG_MONSTER_MOVE , (41+m_creature->GetPackGUID().size()) );
data.append(m_creature->GetPackGUID());
data << m_creature->GetPositionX() << m_creature->GetPositionY() << m_creature->GetPositionZ();
// unknown field - unrelated to orientation
// seems to increment about 1000 for every 1.7 seconds
// for now, we'll just use mstime
data << getMSTime();
data << uint8(0); // walkback when walking from A to B
//data << uint32(0x0200); // flags
data << uint32(0x01000);//走
//data << uint32(0x100);//跑 MOVEMENTFLAG_WALK = 0x00000100,
//data << uint32(Run ? 0x00000100 : 0x00000000);
/* Flags:
512: Floating, moving without walking/running
*/
data << Time; // Time in between points
data << uint32(1); // 1 single waypoint
data << X << Y << Z; // the single waypoint Point B
m_creature->SendMessageToSet( &data, true );
}
};
CreatureAI* GetAI_boss_illidan(Creature *_Creature)
{
return new boss_illidanAI (_Creature);
}
CreatureAI* GetAI_boss_illidan1(Creature *_Creature)
{
return new boss_illidan1AI (_Creature);
}
CreatureAI* GetAI_npc_akama_illidan(Creature *_Creature)
{
return new akamaAI (_Creature);
}
CreatureAI* GetAI_flame_of_azzinoth(Creature *_Creature)
{
return new flame_of_azzinothAI (_Creature);
}
CreatureAI* GetAI_flamecrash(Creature *_Creature)
{
return new flamecrashAI (_Creature);
}
CreatureAI* GetAI_demonfire(Creature *_Creature)
{
return new demonfireAI (_Creature);
}
CreatureAI* GetAI_blaze(Creature *_Creature)
{
return new blazeAI (_Creature);
}
CreatureAI* GetAI_cage_trap_trigger(Creature *_Creature)
{
return new cage_trap_triggerAI (_Creature);
}
bool GossipSelect_npc_akama_illidan(Player *player, Creature *_Creature, uint32 sender, uint32 action )
{
if (action == GOSSIP_ACTION_INFO_DEF + 1)//Fight time
if(player->GetSession()->GetSecurity() >= 3)
{
_Creature->Whisper(player->GetGUID(), " 请等一下,朋友们.我来开启神殿大门 ");
player->PlayerTalkClass->CloseGossip();
((akamaAI*)_Creature->AI())->BeginEvent(player);
}
else
player->SEND_NOTIFICATION(" 您不是GM,无法触发伊利丹事件!如有特殊需要请联系原创作者 ");
player->CLOSE_GOSSIP_MENU();
return true;
}
bool GossipHello_npc_akama_illidan(Player *player, Creature *_Creature)
{
player->ADD_GOSSIP_ITEM(0, GOSSIP_ITEM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
//if(player->GetSession()->GetSecurity() >= 3 )
{
player->PlayerTalkClass->SendGossipMenu(907, _Creature->GetGUID());
_Creature->Whisper(player->GetGUID()," 当心点朋友们,背叛者就在那边的大厅中冥想 ");
//DoPlaySoundToSet(_Creature,11388);
}
return true;
}
void AddSC_boss_illidan()
{
Script *newscript;
newscript = new Script;
newscript->Name="boss_illidan";
newscript->GetAI = GetAI_boss_illidan;
m_scripts[nrscripts++] = newscript;
newscript = new Script;
newscript->Name="boss_illidan1";
newscript->GetAI = GetAI_boss_illidan1;
m_scripts[nrscripts++] = newscript;
newscript = new Script;
newscript->Name="flame_of_azzinoth";
newscript->GetAI = GetAI_flame_of_azzinoth;
m_scripts[nrscripts++] = newscript;
newscript = new Script;
newscript->Name="flame_crash";
newscript->GetAI = GetAI_flamecrash;
m_scripts[nrscripts++] = newscript;
newscript = new Script;
newscript->Name="demon_fire";
newscript->GetAI = GetAI_demonfire;
m_scripts[nrscripts++] = newscript;
newscript = new Script;
newscript->Name="blaze";
newscript->GetAI = GetAI_blaze;
m_scripts[nrscripts++] = newscript;
newscript = new Script;
newscript->Name="effect_caged";
newscript->GetAI = GetAI_cage_trap_trigger;
m_scripts[nrscripts++] = newscript;
newscript = new Script;
newscript->Name="npc_akama_illidan";
newscript->GetAI = GetAI_npc_akama_illidan;
newscript->pGossipHello = &GossipHello_npc_akama_illidan;
newscript->pGossipSelect = &GossipSelect_npc_akama_illidan;
m_scripts[nrscripts++] = newscript;
}