* Rename InstanceData to InstanceScript

* Rename *mgr to their new names in scripts project
* Mass convert all the scripts (NEEDS THOROUGH TESTING, because it was done automatically) Please, report bugs on issue tracker.

--HG--
branch : trunk
rename : src/server/game/Instances/InstanceData.cpp => src/server/game/Instances/InstanceScript.cpp
rename : src/server/game/Instances/InstanceData.h => src/server/game/Instances/InstanceScript.h
This commit is contained in:
azazel
2010-08-08 22:54:58 +06:00
parent 8a69e50d6a
commit 590199d8e1
482 changed files with 84476 additions and 82697 deletions
@@ -36,313 +36,321 @@ EndScriptData */
#define SPELL_HEAL 25807
#define SPELL_FEAR 19408
struct boss_kriAI : public ScriptedAI
␍class boss_kri : public CreatureScript
{
boss_kriAI(Creature *c) : ScriptedAI(c)
public:
boss_kri() : CreatureScript("boss_kri") { }
CreatureAI* GetAI(Creature* pCreature) const
{
pInstance = c->GetInstanceData();
return new boss_kriAI (pCreature);
}
ScriptedInstance *pInstance;
uint32 Cleave_Timer;
uint32 ToxicVolley_Timer;
uint32 Check_Timer;
bool VemDead;
bool Death;
void Reset()
struct boss_kriAI : public ScriptedAI
{
Cleave_Timer = 4000 + rand()%4000;
ToxicVolley_Timer = 6000 + rand()%6000;
Check_Timer = 2000;
VemDead = false;
Death = false;
}
void EnterCombat(Unit * /*who*/)
{
}
void JustDied(Unit* /*killer*/)
{
if (pInstance)
boss_kriAI(Creature *c) : ScriptedAI(c)
{
if (pInstance->GetData(DATA_BUG_TRIO_DEATH) < 2)
// Unlootable if death
me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
pInstance->SetData(DATA_BUG_TRIO_DEATH, 1);
}
}
void UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
//Cleave_Timer
if (Cleave_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_CLEAVE);
Cleave_Timer = 5000 + rand()%7000;
} else Cleave_Timer -= diff;
//ToxicVolley_Timer
if (ToxicVolley_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_TOXIC_VOLLEY);
ToxicVolley_Timer = 10000 + rand()%5000;
} else ToxicVolley_Timer -= diff;
if (me->GetHealth() <= me->GetMaxHealth() * 0.05 && !Death)
{
DoCast(me->getVictim(), SPELL_POISON_CLOUD);
Death = true;
pInstance = c->GetInstanceScript();
}
if (!VemDead)
InstanceScript *pInstance;
uint32 Cleave_Timer;
uint32 ToxicVolley_Timer;
uint32 Check_Timer;
bool VemDead;
bool Death;
void Reset()
{
//Checking if Vem is dead. If yes we will enrage.
if (Check_Timer <= diff)
{
if (pInstance && pInstance->GetData(DATA_VEMISDEAD))
{
DoCast(me, SPELL_ENRAGE);
VemDead = true;
}
Check_Timer = 2000;
} else Check_Timer -=diff;
Cleave_Timer = 4000 + rand()%4000;
ToxicVolley_Timer = 6000 + rand()%6000;
Check_Timer = 2000;
VemDead = false;
Death = false;
}
DoMeleeAttackIfReady();
}
};
struct boss_vemAI : public ScriptedAI
{
boss_vemAI(Creature *c) : ScriptedAI(c)
{
pInstance = c->GetInstanceData();
}
ScriptedInstance *pInstance;
uint32 Charge_Timer;
uint32 KnockBack_Timer;
uint32 Enrage_Timer;
bool Enraged;
void Reset()
{
Charge_Timer = 15000 + rand()%12000;
KnockBack_Timer = 8000 + rand()%12000;
Enrage_Timer = 120000;
Enraged = false;
}
void JustDied(Unit* /*Killer*/)
{
if (pInstance)
void EnterCombat(Unit * /*who*/)
{
pInstance->SetData(DATA_VEM_DEATH, 0);
if (pInstance->GetData(DATA_BUG_TRIO_DEATH) < 2)
// Unlootable if death
me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
pInstance->SetData(DATA_BUG_TRIO_DEATH, 1);
}
}
void EnterCombat(Unit * /*who*/)
{
}
void UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
//Charge_Timer
if (Charge_Timer <= diff)
{
Unit *pTarget = NULL;
pTarget = SelectUnit(SELECT_TARGET_RANDOM,0);
if (pTarget)
{
DoCast(pTarget, SPELL_CHARGE);
//me->SendMonsterMove(pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, true,1);
AttackStart(pTarget);
}
Charge_Timer = 8000 + rand()%8000;
} else Charge_Timer -= diff;
//KnockBack_Timer
if (KnockBack_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_KNOCKBACK);
if (DoGetThreat(me->getVictim()))
DoModifyThreatPercent(me->getVictim(),-80);
KnockBack_Timer = 15000 + rand()%10000;
} else KnockBack_Timer -= diff;
//Enrage_Timer
if (!Enraged && Enrage_Timer <= diff)
{
DoCast(me, SPELL_ENRAGE);
Enraged = true;
} else Charge_Timer -= diff;
DoMeleeAttackIfReady();
}
};
struct boss_yaujAI : public ScriptedAI
{
boss_yaujAI(Creature *c) : ScriptedAI(c)
{
pInstance = c->GetInstanceData();
}
ScriptedInstance *pInstance;
uint32 Heal_Timer;
uint32 Fear_Timer;
uint32 Check_Timer;
bool VemDead;
void Reset()
{
Heal_Timer = 25000 + rand()%15000;
Fear_Timer = 12000 + rand()%12000;
Check_Timer = 2000;
VemDead = false;
}
void JustDied(Unit* /*Killer*/)
{
if (pInstance)
{
if (pInstance->GetData(DATA_BUG_TRIO_DEATH) < 2)
// Unlootable if death
me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
pInstance->SetData(DATA_BUG_TRIO_DEATH, 1);
}
for (uint8 i = 0; i < 10; ++i)
{
Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0);
Creature* Summoned = me->SummonCreature(15621,me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(),0,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,90000);
if (Summoned && pTarget)
Summoned->AI()->AttackStart(pTarget);
}
}
void EnterCombat(Unit * /*who*/)
{
}
void UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
//Fear_Timer
if (Fear_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_FEAR);
DoResetThreat();
Fear_Timer = 20000;
} else Fear_Timer -= diff;
//Casting Heal to other twins or herself.
if (Heal_Timer <= diff)
void JustDied(Unit* /*killer*/)
{
if (pInstance)
{
Unit *pKri = Unit::GetUnit((*me), pInstance->GetData64(DATA_KRI));
Unit *pVem = Unit::GetUnit((*me), pInstance->GetData64(DATA_VEM));
if (pInstance->GetData(DATA_BUG_TRIO_DEATH) < 2)
// Unlootable if death
me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
switch (urand(0,2))
{
case 0:
if (pKri)
DoCast(pKri, SPELL_HEAL);
break;
case 1:
if (pVem)
DoCast(pVem, SPELL_HEAL);
break;
case 2:
DoCast(me, SPELL_HEAL);
break;
}
pInstance->SetData(DATA_BUG_TRIO_DEATH, 1);
}
}
void UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
//Cleave_Timer
if (Cleave_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_CLEAVE);
Cleave_Timer = 5000 + rand()%7000;
} else Cleave_Timer -= diff;
//ToxicVolley_Timer
if (ToxicVolley_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_TOXIC_VOLLEY);
ToxicVolley_Timer = 10000 + rand()%5000;
} else ToxicVolley_Timer -= diff;
if (me->GetHealth() <= me->GetMaxHealth() * 0.05 && !Death)
{
DoCast(me->getVictim(), SPELL_POISON_CLOUD);
Death = true;
}
Heal_Timer = 15000+rand()%15000;
} else Heal_Timer -= diff;
//Checking if Vem is dead. If yes we will enrage.
if (Check_Timer <= diff)
{
if (!VemDead)
{
if (pInstance)
//Checking if Vem is dead. If yes we will enrage.
if (Check_Timer <= diff)
{
if (pInstance->GetData(DATA_VEMISDEAD))
if (pInstance && pInstance->GetData(DATA_VEMISDEAD))
{
DoCast(me, SPELL_ENRAGE);
VemDead = true;
}
}
Check_Timer = 2000;
} else Check_Timer -=diff;
}
Check_Timer = 2000;
} else Check_Timer -= diff;
DoMeleeAttackIfReady();
DoMeleeAttackIfReady();
}
};
};
␍class boss_vem : public CreatureScript
{
public:
boss_vem() : CreatureScript("boss_vem") { }
CreatureAI* GetAI(Creature* pCreature) const
{
return new boss_vemAI (pCreature);
}
struct boss_vemAI : public ScriptedAI
{
boss_vemAI(Creature *c) : ScriptedAI(c)
{
pInstance = c->GetInstanceScript();
}
InstanceScript *pInstance;
uint32 Charge_Timer;
uint32 KnockBack_Timer;
uint32 Enrage_Timer;
bool Enraged;
void Reset()
{
Charge_Timer = 15000 + rand()%12000;
KnockBack_Timer = 8000 + rand()%12000;
Enrage_Timer = 120000;
Enraged = false;
}
void JustDied(Unit* /*Killer*/)
{
if (pInstance)
{
pInstance->SetData(DATA_VEM_DEATH, 0);
if (pInstance->GetData(DATA_BUG_TRIO_DEATH) < 2)
// Unlootable if death
me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
pInstance->SetData(DATA_BUG_TRIO_DEATH, 1);
}
}
void EnterCombat(Unit * /*who*/)
{
}
void UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
//Charge_Timer
if (Charge_Timer <= diff)
{
Unit *pTarget = NULL;
pTarget = SelectUnit(SELECT_TARGET_RANDOM,0);
if (pTarget)
{
DoCast(pTarget, SPELL_CHARGE);
//me->SendMonsterMove(pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, true,1);
AttackStart(pTarget);
}
Charge_Timer = 8000 + rand()%8000;
} else Charge_Timer -= diff;
//KnockBack_Timer
if (KnockBack_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_KNOCKBACK);
if (DoGetThreat(me->getVictim()))
DoModifyThreatPercent(me->getVictim(),-80);
KnockBack_Timer = 15000 + rand()%10000;
} else KnockBack_Timer -= diff;
//Enrage_Timer
if (!Enraged && Enrage_Timer <= diff)
{
DoCast(me, SPELL_ENRAGE);
Enraged = true;
} else Charge_Timer -= diff;
DoMeleeAttackIfReady();
}
};
};
␍class boss_yauj : public CreatureScript
{
public:
boss_yauj() : CreatureScript("boss_yauj") { }
CreatureAI* GetAI(Creature* pCreature) const
{
return new boss_yaujAI (pCreature);
}
struct boss_yaujAI : public ScriptedAI
{
boss_yaujAI(Creature *c) : ScriptedAI(c)
{
pInstance = c->GetInstanceScript();
}
InstanceScript *pInstance;
uint32 Heal_Timer;
uint32 Fear_Timer;
uint32 Check_Timer;
bool VemDead;
void Reset()
{
Heal_Timer = 25000 + rand()%15000;
Fear_Timer = 12000 + rand()%12000;
Check_Timer = 2000;
VemDead = false;
}
void JustDied(Unit* /*Killer*/)
{
if (pInstance)
{
if (pInstance->GetData(DATA_BUG_TRIO_DEATH) < 2)
// Unlootable if death
me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
pInstance->SetData(DATA_BUG_TRIO_DEATH, 1);
}
for (uint8 i = 0; i < 10; ++i)
{
Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0);
Creature* Summoned = me->SummonCreature(15621,me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(),0,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,90000);
if (Summoned && pTarget)
Summoned->AI()->AttackStart(pTarget);
}
}
void EnterCombat(Unit * /*who*/)
{
}
void UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
//Fear_Timer
if (Fear_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_FEAR);
DoResetThreat();
Fear_Timer = 20000;
} else Fear_Timer -= diff;
//Casting Heal to other twins or herself.
if (Heal_Timer <= diff)
{
if (pInstance)
{
Unit *pKri = Unit::GetUnit((*me), pInstance->GetData64(DATA_KRI));
Unit *pVem = Unit::GetUnit((*me), pInstance->GetData64(DATA_VEM));
switch (urand(0,2))
{
case 0:
if (pKri)
DoCast(pKri, SPELL_HEAL);
break;
case 1:
if (pVem)
DoCast(pVem, SPELL_HEAL);
break;
case 2:
DoCast(me, SPELL_HEAL);
break;
}
}
Heal_Timer = 15000+rand()%15000;
} else Heal_Timer -= diff;
//Checking if Vem is dead. If yes we will enrage.
if (Check_Timer <= diff)
{
if (!VemDead)
{
if (pInstance)
{
if (pInstance->GetData(DATA_VEMISDEAD))
{
DoCast(me, SPELL_ENRAGE);
VemDead = true;
}
}
}
Check_Timer = 2000;
} else Check_Timer -= diff;
DoMeleeAttackIfReady();
}
};
};
CreatureAI* GetAI_boss_yauj(Creature* pCreature)
{
return new boss_yaujAI (pCreature);
}
CreatureAI* GetAI_boss_vem(Creature* pCreature)
{
return new boss_vemAI (pCreature);
}
CreatureAI* GetAI_boss_kri(Creature* pCreature)
{
return new boss_kriAI (pCreature);
}
void AddSC_bug_trio()
{
Script *newscript;
newscript = new Script;
newscript->Name = "boss_kri";
newscript->GetAI = &GetAI_boss_kri;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "boss_vem";
newscript->GetAI = &GetAI_boss_vem;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "boss_yauj";
newscript->GetAI = &GetAI_boss_yauj;
newscript->RegisterSelf();
new boss_kri();
new boss_vem();
new boss_yauj();
}
File diff suppressed because it is too large Load Diff
@@ -36,173 +36,175 @@ EndScriptData */
// Enrage for his spawns
#define SPELL_ENRAGE 28798
struct boss_fankrissAI : public ScriptedAI
␍class boss_fankriss : public CreatureScript
{
boss_fankrissAI(Creature *c) : ScriptedAI(c) {}
public:
boss_fankriss() : CreatureScript("boss_fankriss") { }
uint32 MortalWound_Timer;
uint32 SpawnHatchlings_Timer;
uint32 SpawnSpawns_Timer;
int Rand;
int RandX;
int RandY;
Creature* Hatchling;
Creature* Spawn;
void Reset()
CreatureAI* GetAI(Creature* pCreature) const
{
MortalWound_Timer = 10000 + rand()%5000;
SpawnHatchlings_Timer = 6000 + rand()%6000;
SpawnSpawns_Timer = 15000 + rand()%30000;
return new boss_fankrissAI (pCreature);
}
void SummonSpawn(Unit* victim)
struct boss_fankrissAI : public ScriptedAI
{
if (!victim)
return;
boss_fankrissAI(Creature *c) : ScriptedAI(c) {}
Rand = 10 + (rand()%10);
switch (rand()%2)
uint32 MortalWound_Timer;
uint32 SpawnHatchlings_Timer;
uint32 SpawnSpawns_Timer;
int Rand;
int RandX;
int RandY;
Creature* Hatchling;
Creature* Spawn;
void Reset()
{
case 0: RandX = 0 - Rand; break;
case 1: RandX = 0 + Rand; break;
MortalWound_Timer = 10000 + rand()%5000;
SpawnHatchlings_Timer = 6000 + rand()%6000;
SpawnSpawns_Timer = 15000 + rand()%30000;
}
Rand = 0;
Rand = 10 + (rand()%10);
switch (rand()%2)
void SummonSpawn(Unit* victim)
{
case 0: RandY = 0 - Rand; break;
case 1: RandY = 0 + Rand; break;
}
Rand = 0;
Spawn = DoSpawnCreature(15630, RandX, RandY, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
if (Spawn)
Spawn->AI()->AttackStart(victim);
}
if (!victim)
return;
void EnterCombat(Unit * /*who*/)
{
}
void UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
//MortalWound_Timer
if (MortalWound_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_MORTAL_WOUND);
MortalWound_Timer = 10000 + rand()%10000;
} else MortalWound_Timer -= diff;
//Summon 1-3 Spawns of Fankriss at random time.
if (SpawnSpawns_Timer <= diff)
{
switch (urand(0,2))
Rand = 10 + (rand()%10);
switch (rand()%2)
{
case 0:
SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0));
break;
case 1:
SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0));
SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0));
break;
case 2:
SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0));
SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0));
SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0));
break;
case 0: RandX = 0 - Rand; break;
case 1: RandX = 0 + Rand; break;
}
SpawnSpawns_Timer = 30000 + rand()%30000;
} else SpawnSpawns_Timer -= diff;
// Teleporting Random Target to one of the three tunnels and spawn 4 hatchlings near the gamer.
//We will only telport if fankriss has more than 3% of hp so teleported gamers can always loot.
if (me->GetHealth()*100 / me->GetMaxHealth() > 3)
{
if (SpawnHatchlings_Timer <= diff)
Rand = 0;
Rand = 10 + (rand()%10);
switch (rand()%2)
{
Unit *pTarget = NULL;
pTarget = SelectUnit(SELECT_TARGET_RANDOM,0);
if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER)
{
DoCast(pTarget, SPELL_ROOT);
if (DoGetThreat(pTarget))
DoModifyThreatPercent(pTarget, -100);
switch(urand(0,2))
{
case 0:
DoTeleportPlayer(pTarget, -8106.0142,1289.2900,-74.419533,5.112);
Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()-3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (Hatchling)
Hatchling->AI()->AttackStart(pTarget);
Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()+3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (Hatchling)
Hatchling->AI()->AttackStart(pTarget);
Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()-5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (Hatchling)
Hatchling->AI()->AttackStart(pTarget);
Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()+5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (Hatchling)
Hatchling->AI()->AttackStart(pTarget);
break;
case 1:
DoTeleportPlayer(pTarget, -7990.135354,1155.1907,-78.849319,2.608);
Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()-3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (Hatchling)
Hatchling->AI()->AttackStart(pTarget);
Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()+3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (Hatchling)
Hatchling->AI()->AttackStart(pTarget);
Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()-5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (Hatchling)
Hatchling->AI()->AttackStart(pTarget);
Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()+5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (Hatchling)
Hatchling->AI()->AttackStart(pTarget);
break;
case 2:
DoTeleportPlayer(pTarget,-8159.7753,1127.9064,-76.868660,0.675);
Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()-3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (Hatchling)
Hatchling->AI()->AttackStart(pTarget);
Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()+3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (Hatchling)
Hatchling->AI()->AttackStart(pTarget);
Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()-5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (Hatchling)
Hatchling->AI()->AttackStart(pTarget);
Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()+5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (Hatchling)
Hatchling->AI()->AttackStart(pTarget);
break;
}
}
SpawnHatchlings_Timer = 45000 + rand()%15000;
} else SpawnHatchlings_Timer -= diff;
case 0: RandY = 0 - Rand; break;
case 1: RandY = 0 + Rand; break;
}
Rand = 0;
Spawn = DoSpawnCreature(15630, RandX, RandY, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
if (Spawn)
Spawn->AI()->AttackStart(victim);
}
DoMeleeAttackIfReady();
}
void EnterCombat(Unit * /*who*/)
{
}
void UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
//MortalWound_Timer
if (MortalWound_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_MORTAL_WOUND);
MortalWound_Timer = 10000 + rand()%10000;
} else MortalWound_Timer -= diff;
//Summon 1-3 Spawns of Fankriss at random time.
if (SpawnSpawns_Timer <= diff)
{
switch (urand(0,2))
{
case 0:
SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0));
break;
case 1:
SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0));
SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0));
break;
case 2:
SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0));
SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0));
SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0));
break;
}
SpawnSpawns_Timer = 30000 + rand()%30000;
} else SpawnSpawns_Timer -= diff;
// Teleporting Random Target to one of the three tunnels and spawn 4 hatchlings near the gamer.
//We will only telport if fankriss has more than 3% of hp so teleported gamers can always loot.
if (me->GetHealth()*100 / me->GetMaxHealth() > 3)
{
if (SpawnHatchlings_Timer <= diff)
{
Unit *pTarget = NULL;
pTarget = SelectUnit(SELECT_TARGET_RANDOM,0);
if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER)
{
DoCast(pTarget, SPELL_ROOT);
if (DoGetThreat(pTarget))
DoModifyThreatPercent(pTarget, -100);
switch(urand(0,2))
{
case 0:
DoTeleportPlayer(pTarget, -8106.0142,1289.2900,-74.419533,5.112);
Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()-3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (Hatchling)
Hatchling->AI()->AttackStart(pTarget);
Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()+3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (Hatchling)
Hatchling->AI()->AttackStart(pTarget);
Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()-5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (Hatchling)
Hatchling->AI()->AttackStart(pTarget);
Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()+5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (Hatchling)
Hatchling->AI()->AttackStart(pTarget);
break;
case 1:
DoTeleportPlayer(pTarget, -7990.135354,1155.1907,-78.849319,2.608);
Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()-3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (Hatchling)
Hatchling->AI()->AttackStart(pTarget);
Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()+3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (Hatchling)
Hatchling->AI()->AttackStart(pTarget);
Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()-5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (Hatchling)
Hatchling->AI()->AttackStart(pTarget);
Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()+5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (Hatchling)
Hatchling->AI()->AttackStart(pTarget);
break;
case 2:
DoTeleportPlayer(pTarget,-8159.7753,1127.9064,-76.868660,0.675);
Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()-3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (Hatchling)
Hatchling->AI()->AttackStart(pTarget);
Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()+3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (Hatchling)
Hatchling->AI()->AttackStart(pTarget);
Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()-5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (Hatchling)
Hatchling->AI()->AttackStart(pTarget);
Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()+5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (Hatchling)
Hatchling->AI()->AttackStart(pTarget);
break;
}
}
SpawnHatchlings_Timer = 45000 + rand()%15000;
} else SpawnHatchlings_Timer -= diff;
}
DoMeleeAttackIfReady();
}
};
};
CreatureAI* GetAI_boss_fankriss(Creature* pCreature)
{
return new boss_fankrissAI (pCreature);
}
void AddSC_boss_fankriss()
{
Script *newscript;
newscript = new Script;
newscript->Name = "boss_fankriss";
newscript->GetAI = &GetAI_boss_fankriss;
newscript->RegisterSelf();
new boss_fankriss();
}
@@ -34,117 +34,119 @@ EndScriptData */
#define SPELL_NOXIOUSPOISON 26053
#define SPELL_WYVERNSTING 26180
#define SPELL_ACIDSPIT 26050
struct boss_huhuranAI : public ScriptedAI
␍class boss_huhuran : public CreatureScript
{
boss_huhuranAI(Creature *c) : ScriptedAI(c) {}
public:
boss_huhuran() : CreatureScript("boss_huhuran") { }
uint32 Frenzy_Timer;
uint32 Wyvern_Timer;
uint32 Spit_Timer;
uint32 PoisonBolt_Timer;
uint32 NoxiousPoison_Timer;
uint32 FrenzyBack_Timer;
bool Frenzy;
bool Berserk;
void Reset()
CreatureAI* GetAI(Creature* pCreature) const
{
Frenzy_Timer = 25000 + rand()%10000;
Wyvern_Timer = 18000 + rand()%10000;
Spit_Timer = 8000;
PoisonBolt_Timer = 4000;
NoxiousPoison_Timer = 10000 + rand()%10000;
FrenzyBack_Timer = 15000;
Frenzy = false;
Berserk = false;
return new boss_huhuranAI (pCreature);
}
void EnterCombat(Unit * /*who*/)
struct boss_huhuranAI : public ScriptedAI
{
}
boss_huhuranAI(Creature *c) : ScriptedAI(c) {}
void UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
uint32 Frenzy_Timer;
uint32 Wyvern_Timer;
uint32 Spit_Timer;
uint32 PoisonBolt_Timer;
uint32 NoxiousPoison_Timer;
uint32 FrenzyBack_Timer;
//Frenzy_Timer
if (!Frenzy && Frenzy_Timer <= diff)
bool Frenzy;
bool Berserk;
void Reset()
{
DoCast(me, SPELL_FRENZY);
DoScriptText(EMOTE_GENERIC_FRENZY_KILL, me);
Frenzy = true;
PoisonBolt_Timer = 3000;
Frenzy_Timer = 25000 + rand()%10000;
} else Frenzy_Timer -= diff;
// Wyvern Timer
if (Wyvern_Timer <= diff)
{
if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0))
DoCast(pTarget, SPELL_WYVERNSTING);
Wyvern_Timer = 15000 + rand()%17000;
} else Wyvern_Timer -= diff;
//Spit Timer
if (Spit_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_ACIDSPIT);
Spit_Timer = 5000 + rand()%5000;
} else Spit_Timer -= diff;
//NoxiousPoison_Timer
if (NoxiousPoison_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_NOXIOUSPOISON);
NoxiousPoison_Timer = 12000 + rand()%12000;
} else NoxiousPoison_Timer -= diff;
//PoisonBolt only if frenzy or berserk
if (Frenzy || Berserk)
{
if (PoisonBolt_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_POISONBOLT);
PoisonBolt_Timer = 3000;
} else PoisonBolt_Timer -= diff;
}
//FrenzyBack_Timer
if (Frenzy && FrenzyBack_Timer <= diff)
{
me->InterruptNonMeleeSpells(false);
Frenzy = false;
Wyvern_Timer = 18000 + rand()%10000;
Spit_Timer = 8000;
PoisonBolt_Timer = 4000;
NoxiousPoison_Timer = 10000 + rand()%10000;
FrenzyBack_Timer = 15000;
} else FrenzyBack_Timer -= diff;
if (!Berserk && me->GetHealth()*100 / me->GetMaxHealth() < 31)
{
me->InterruptNonMeleeSpells(false);
DoScriptText(EMOTE_GENERIC_BERSERK, me);
DoCast(me, SPELL_BERSERK);
Berserk = true;
Frenzy = false;
Berserk = false;
}
DoMeleeAttackIfReady();
}
void EnterCombat(Unit * /*who*/)
{
}
void UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
//Frenzy_Timer
if (!Frenzy && Frenzy_Timer <= diff)
{
DoCast(me, SPELL_FRENZY);
DoScriptText(EMOTE_GENERIC_FRENZY_KILL, me);
Frenzy = true;
PoisonBolt_Timer = 3000;
Frenzy_Timer = 25000 + rand()%10000;
} else Frenzy_Timer -= diff;
// Wyvern Timer
if (Wyvern_Timer <= diff)
{
if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0))
DoCast(pTarget, SPELL_WYVERNSTING);
Wyvern_Timer = 15000 + rand()%17000;
} else Wyvern_Timer -= diff;
//Spit Timer
if (Spit_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_ACIDSPIT);
Spit_Timer = 5000 + rand()%5000;
} else Spit_Timer -= diff;
//NoxiousPoison_Timer
if (NoxiousPoison_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_NOXIOUSPOISON);
NoxiousPoison_Timer = 12000 + rand()%12000;
} else NoxiousPoison_Timer -= diff;
//PoisonBolt only if frenzy or berserk
if (Frenzy || Berserk)
{
if (PoisonBolt_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_POISONBOLT);
PoisonBolt_Timer = 3000;
} else PoisonBolt_Timer -= diff;
}
//FrenzyBack_Timer
if (Frenzy && FrenzyBack_Timer <= diff)
{
me->InterruptNonMeleeSpells(false);
Frenzy = false;
FrenzyBack_Timer = 15000;
} else FrenzyBack_Timer -= diff;
if (!Berserk && me->GetHealth()*100 / me->GetMaxHealth() < 31)
{
me->InterruptNonMeleeSpells(false);
DoScriptText(EMOTE_GENERIC_BERSERK, me);
DoCast(me, SPELL_BERSERK);
Berserk = true;
}
DoMeleeAttackIfReady();
}
};
};
CreatureAI* GetAI_boss_huhuran(Creature* pCreature)
{
return new boss_huhuranAI (pCreature);
}
void AddSC_boss_huhuran()
{
Script *newscript;
newscript = new Script;
newscript->Name = "boss_huhuran";
newscript->GetAI = &GetAI_boss_huhuran;
newscript->RegisterSelf();
new boss_huhuran();
}
@@ -32,111 +32,113 @@ EndScriptData */
#define SPELL_BIRTH 26262 //The Birth Animation
#define SPELL_DIRTMOUND_PASSIVE 26092
struct boss_ouroAI : public ScriptedAI
␍class boss_ouro : public CreatureScript
{
boss_ouroAI(Creature *c) : ScriptedAI(c) {}
public:
boss_ouro() : CreatureScript("boss_ouro") { }
uint32 Sweep_Timer;
uint32 SandBlast_Timer;
uint32 Submerge_Timer;
uint32 Back_Timer;
uint32 ChangeTarget_Timer;
uint32 Spawn_Timer;
bool Enrage;
bool Submerged;
void Reset()
CreatureAI* GetAI(Creature* pCreature) const
{
Sweep_Timer = 5000 + rand()%5000;
SandBlast_Timer = 20000 + rand()%15000;
Submerge_Timer = 90000 + rand()%60000;
Back_Timer = 30000 + rand()%15000;
ChangeTarget_Timer = 5000 + rand()%3000;
Spawn_Timer = 10000 + rand()%10000;
Enrage = false;
Submerged = false;
return new boss_ouroAI (pCreature);
}
void EnterCombat(Unit * /*who*/)
struct boss_ouroAI : public ScriptedAI
{
DoCast(me->getVictim(), SPELL_BIRTH);
}
boss_ouroAI(Creature *c) : ScriptedAI(c) {}
void UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
uint32 Sweep_Timer;
uint32 SandBlast_Timer;
uint32 Submerge_Timer;
uint32 Back_Timer;
uint32 ChangeTarget_Timer;
uint32 Spawn_Timer;
//Sweep_Timer
if (!Submerged && Sweep_Timer <= diff)
bool Enrage;
bool Submerged;
void Reset()
{
DoCast(me->getVictim(), SPELL_SWEEP);
Sweep_Timer = 15000 + rand()%15000;
} else Sweep_Timer -= diff;
//SandBlast_Timer
if (!Submerged && SandBlast_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_SANDBLAST);
Sweep_Timer = 5000 + rand()%5000;
SandBlast_Timer = 20000 + rand()%15000;
} else SandBlast_Timer -= diff;
//Submerge_Timer
if (!Submerged && Submerge_Timer <= diff)
{
//Cast
me->HandleEmoteCommand(EMOTE_ONESHOT_SUBMERGE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->setFaction(35);
DoCast(me, SPELL_DIRTMOUND_PASSIVE);
Submerged = true;
Submerge_Timer = 90000 + rand()%60000;
Back_Timer = 30000 + rand()%15000;
} else Submerge_Timer -= diff;
//ChangeTarget_Timer
if (Submerged && ChangeTarget_Timer <= diff)
{
Unit *pTarget = NULL;
pTarget = SelectUnit(SELECT_TARGET_RANDOM,0);
if (pTarget)
DoTeleportTo(pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ());
ChangeTarget_Timer = 10000 + rand()%10000;
} else ChangeTarget_Timer -= diff;
//Back_Timer
if (Submerged && Back_Timer <= diff)
{
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->setFaction(14);
DoCast(me->getVictim(), SPELL_GROUND_RUPTURE);
ChangeTarget_Timer = 5000 + rand()%3000;
Spawn_Timer = 10000 + rand()%10000;
Enrage = false;
Submerged = false;
Submerge_Timer = 60000 + rand()%60000;
} else Back_Timer -= diff;
}
void EnterCombat(Unit * /*who*/)
{
DoCast(me->getVictim(), SPELL_BIRTH);
}
void UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
//Sweep_Timer
if (!Submerged && Sweep_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_SWEEP);
Sweep_Timer = 15000 + rand()%15000;
} else Sweep_Timer -= diff;
//SandBlast_Timer
if (!Submerged && SandBlast_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_SANDBLAST);
SandBlast_Timer = 20000 + rand()%15000;
} else SandBlast_Timer -= diff;
//Submerge_Timer
if (!Submerged && Submerge_Timer <= diff)
{
//Cast
me->HandleEmoteCommand(EMOTE_ONESHOT_SUBMERGE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->setFaction(35);
DoCast(me, SPELL_DIRTMOUND_PASSIVE);
Submerged = true;
Back_Timer = 30000 + rand()%15000;
} else Submerge_Timer -= diff;
//ChangeTarget_Timer
if (Submerged && ChangeTarget_Timer <= diff)
{
Unit *pTarget = NULL;
pTarget = SelectUnit(SELECT_TARGET_RANDOM,0);
if (pTarget)
DoTeleportTo(pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ());
ChangeTarget_Timer = 10000 + rand()%10000;
} else ChangeTarget_Timer -= diff;
//Back_Timer
if (Submerged && Back_Timer <= diff)
{
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->setFaction(14);
DoCast(me->getVictim(), SPELL_GROUND_RUPTURE);
Submerged = false;
Submerge_Timer = 60000 + rand()%60000;
} else Back_Timer -= diff;
DoMeleeAttackIfReady();
}
};
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI_boss_ouro(Creature* pCreature)
{
return new boss_ouroAI (pCreature);
}
void AddSC_boss_ouro()
{
Script *newscript;
newscript = new Script;
newscript->Name = "boss_ouro";
newscript->GetAI = &GetAI_boss_ouro;
newscript->RegisterSelf();
new boss_ouro();
}
@@ -36,104 +36,248 @@ EndScriptData */
//Guard Spell
#define SPELL_WHIRLWINDADD 26038
#define SPELL_KNOCKBACK 26027
struct boss_sarturaAI : public ScriptedAI
␍class boss_sartura : public CreatureScript
{
boss_sarturaAI(Creature *c) : ScriptedAI(c) {}
public:
boss_sartura() : CreatureScript("boss_sartura") { }
uint32 WhirlWind_Timer;
uint32 WhirlWindRandom_Timer;
uint32 WhirlWindEnd_Timer;
uint32 AggroReset_Timer;
uint32 AggroResetEnd_Timer;
uint32 EnrageHard_Timer;
bool Enraged;
bool EnragedHard;
bool WhirlWind;
bool AggroReset;
void Reset()
CreatureAI* GetAI(Creature* pCreature) const
{
WhirlWind_Timer = 30000;
WhirlWindRandom_Timer = 3000 + rand()%4000;
WhirlWindEnd_Timer = 15000;
AggroReset_Timer = 45000 + rand()%10000;
AggroResetEnd_Timer = 5000;
EnrageHard_Timer = 10*60000;
WhirlWind = false;
AggroReset = false;
Enraged = false;
EnragedHard = false;
return new boss_sarturaAI (pCreature);
}
void EnterCombat(Unit * /*who*/)
struct boss_sarturaAI : public ScriptedAI
{
DoScriptText(SAY_AGGRO, me);
}
boss_sarturaAI(Creature *c) : ScriptedAI(c) {}
void JustDied(Unit* /*Killer*/)
{
DoScriptText(SAY_DEATH, me);
}
uint32 WhirlWind_Timer;
uint32 WhirlWindRandom_Timer;
uint32 WhirlWindEnd_Timer;
uint32 AggroReset_Timer;
uint32 AggroResetEnd_Timer;
uint32 EnrageHard_Timer;
void KilledUnit(Unit* /*victim*/)
{
DoScriptText(SAY_SLAY, me);
}
bool Enraged;
bool EnragedHard;
bool WhirlWind;
bool AggroReset;
void UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
if (WhirlWind)
void Reset()
{
if (WhirlWindRandom_Timer <= diff)
{
//Attack random Gamers
Unit *pTarget = NULL;
pTarget = SelectUnit(SELECT_TARGET_RANDOM,1);
if (pTarget)
me->AddThreat(pTarget, 1.0f);
me->TauntApply(pTarget);
AttackStart(pTarget);
WhirlWind_Timer = 30000;
WhirlWindRandom_Timer = 3000 + rand()%4000;
WhirlWindEnd_Timer = 15000;
AggroReset_Timer = 45000 + rand()%10000;
AggroResetEnd_Timer = 5000;
EnrageHard_Timer = 10*60000;
WhirlWindRandom_Timer = 3000 + rand()%4000;
} else WhirlWindRandom_Timer -= diff;
WhirlWind = false;
AggroReset = false;
Enraged = false;
EnragedHard = false;
if (WhirlWindEnd_Timer <= diff)
{
WhirlWind = false;
WhirlWind_Timer = 25000 + rand()%15000;
} else WhirlWindEnd_Timer -= diff;
}
if (!WhirlWind)
void EnterCombat(Unit * /*who*/)
{
if (WhirlWind_Timer <= diff)
DoScriptText(SAY_AGGRO, me);
}
void JustDied(Unit* /*Killer*/)
{
DoScriptText(SAY_DEATH, me);
}
void KilledUnit(Unit* /*victim*/)
{
DoScriptText(SAY_SLAY, me);
}
void UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
if (WhirlWind)
{
DoCast(me, SPELL_WHIRLWIND);
if (WhirlWindRandom_Timer <= diff)
{
//Attack random Gamers
Unit *pTarget = NULL;
pTarget = SelectUnit(SELECT_TARGET_RANDOM,1);
if (pTarget)
me->AddThreat(pTarget, 1.0f);
me->TauntApply(pTarget);
AttackStart(pTarget);
WhirlWindRandom_Timer = 3000 + rand()%4000;
} else WhirlWindRandom_Timer -= diff;
if (WhirlWindEnd_Timer <= diff)
{
WhirlWind = false;
WhirlWind_Timer = 25000 + rand()%15000;
} else WhirlWindEnd_Timer -= diff;
}
if (!WhirlWind)
{
if (WhirlWind_Timer <= diff)
{
DoCast(me, SPELL_WHIRLWIND);
WhirlWind = true;
WhirlWindEnd_Timer = 15000;
} else WhirlWind_Timer -= diff;
if (AggroReset_Timer <= diff)
{
//Attack random Gamers
Unit *pTarget = NULL;
pTarget = SelectUnit(SELECT_TARGET_RANDOM,1);
if (pTarget)
me->AddThreat(pTarget, 1.0f);
me->TauntApply(pTarget);
AttackStart(pTarget);
AggroReset = true;
AggroReset_Timer = 2000 + rand()%3000;
} else AggroReset_Timer -= diff;
if (AggroReset)
{
if (AggroResetEnd_Timer <= diff)
{
AggroReset = false;
AggroResetEnd_Timer = 5000;
AggroReset_Timer = 35000 + rand()%10000;
} else AggroResetEnd_Timer -= diff;
}
//If she is 20% enrage
if (!Enraged)
{
if (me->GetHealth()*100 / me->GetMaxHealth() <= 20 && !me->IsNonMeleeSpellCasted(false))
{
DoCast(me, SPELL_ENRAGE);
Enraged = true;
}
}
//After 10 minutes hard enrage
if (!EnragedHard)
{
if (EnrageHard_Timer <= diff)
{
DoCast(me, SPELL_ENRAGEHARD);
EnragedHard = true;
} else EnrageHard_Timer -= diff;
}
DoMeleeAttackIfReady();
}
}
};
};
␍class mob_sartura_royal_guard : public CreatureScript
{
public:
mob_sartura_royal_guard() : CreatureScript("mob_sartura_royal_guard") { }
CreatureAI* GetAI(Creature* pCreature) const
{
return new mob_sartura_royal_guardAI (pCreature);
}
struct mob_sartura_royal_guardAI : public ScriptedAI
{
mob_sartura_royal_guardAI(Creature *c) : ScriptedAI(c) {}
uint32 WhirlWind_Timer;
uint32 WhirlWindRandom_Timer;
uint32 WhirlWindEnd_Timer;
uint32 AggroReset_Timer;
uint32 AggroResetEnd_Timer;
uint32 KnockBack_Timer;
bool WhirlWind;
bool AggroReset;
void Reset()
{
WhirlWind_Timer = 30000;
WhirlWindRandom_Timer = 3000 + rand()%4000;
WhirlWindEnd_Timer = 15000;
AggroReset_Timer = 45000 + rand()%10000;
AggroResetEnd_Timer = 5000;
KnockBack_Timer = 10000;
WhirlWind = false;
AggroReset = false;
}
void EnterCombat(Unit * /*who*/)
{
}
void UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
if (!WhirlWind && WhirlWind_Timer <= diff)
{
DoCast(me, SPELL_WHIRLWINDADD);
WhirlWind = true;
WhirlWind_Timer = 25000 + rand()%15000;
WhirlWindEnd_Timer = 15000;
} else WhirlWind_Timer -= diff;
if (AggroReset_Timer <= diff)
if (WhirlWind)
{
//Attack random Gamers
Unit *pTarget = NULL;
pTarget = SelectUnit(SELECT_TARGET_RANDOM,1);
if (pTarget)
me->AddThreat(pTarget, 1.0f);
me->TauntApply(pTarget);
AttackStart(pTarget);
if (WhirlWindRandom_Timer <= diff)
{
//Attack random Gamers
Unit *pTarget = NULL;
pTarget = SelectUnit(SELECT_TARGET_RANDOM,1);
if (pTarget)
me->AddThreat(pTarget, 1.0f);
me->TauntApply(pTarget);
AttackStart(pTarget);
WhirlWindRandom_Timer = 3000 + rand()%4000;
} else WhirlWindRandom_Timer -= diff;
if (WhirlWindEnd_Timer <= diff)
{
WhirlWind = false;
} else WhirlWindEnd_Timer -= diff;
}
if (!WhirlWind)
{
if (AggroReset_Timer <= diff)
{
//Attack random Gamers
Unit *pTarget = NULL;
pTarget = SelectUnit(SELECT_TARGET_RANDOM,1);
if (pTarget)
me->AddThreat(pTarget, 1.0f);
me->TauntApply(pTarget);
AttackStart(pTarget);
AggroReset = true;
AggroReset_Timer = 2000 + rand()%3000;
} else AggroReset_Timer -= diff;
} else AggroReset_Timer -= diff;
if (KnockBack_Timer <= diff)
{
DoCast(me, SPELL_WHIRLWINDADD);
KnockBack_Timer = 10000 + rand()%10000;
} else KnockBack_Timer -= diff;
}
if (AggroReset)
{
@@ -141,159 +285,20 @@ struct boss_sarturaAI : public ScriptedAI
{
AggroReset = false;
AggroResetEnd_Timer = 5000;
AggroReset_Timer = 35000 + rand()%10000;
AggroReset_Timer = 30000 + rand()%10000;
} else AggroResetEnd_Timer -= diff;
}
//If she is 20% enrage
if (!Enraged)
{
if (me->GetHealth()*100 / me->GetMaxHealth() <= 20 && !me->IsNonMeleeSpellCasted(false))
{
DoCast(me, SPELL_ENRAGE);
Enraged = true;
}
}
//After 10 minutes hard enrage
if (!EnragedHard)
{
if (EnrageHard_Timer <= diff)
{
DoCast(me, SPELL_ENRAGEHARD);
EnragedHard = true;
} else EnrageHard_Timer -= diff;
}
DoMeleeAttackIfReady();
}
}
};
};
struct mob_sartura_royal_guardAI : public ScriptedAI
{
mob_sartura_royal_guardAI(Creature *c) : ScriptedAI(c) {}
uint32 WhirlWind_Timer;
uint32 WhirlWindRandom_Timer;
uint32 WhirlWindEnd_Timer;
uint32 AggroReset_Timer;
uint32 AggroResetEnd_Timer;
uint32 KnockBack_Timer;
bool WhirlWind;
bool AggroReset;
void Reset()
{
WhirlWind_Timer = 30000;
WhirlWindRandom_Timer = 3000 + rand()%4000;
WhirlWindEnd_Timer = 15000;
AggroReset_Timer = 45000 + rand()%10000;
AggroResetEnd_Timer = 5000;
KnockBack_Timer = 10000;
WhirlWind = false;
AggroReset = false;
}
void EnterCombat(Unit * /*who*/)
{
}
void UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
if (!WhirlWind && WhirlWind_Timer <= diff)
{
DoCast(me, SPELL_WHIRLWINDADD);
WhirlWind = true;
WhirlWind_Timer = 25000 + rand()%15000;
WhirlWindEnd_Timer = 15000;
} else WhirlWind_Timer -= diff;
if (WhirlWind)
{
if (WhirlWindRandom_Timer <= diff)
{
//Attack random Gamers
Unit *pTarget = NULL;
pTarget = SelectUnit(SELECT_TARGET_RANDOM,1);
if (pTarget)
me->AddThreat(pTarget, 1.0f);
me->TauntApply(pTarget);
AttackStart(pTarget);
WhirlWindRandom_Timer = 3000 + rand()%4000;
} else WhirlWindRandom_Timer -= diff;
if (WhirlWindEnd_Timer <= diff)
{
WhirlWind = false;
} else WhirlWindEnd_Timer -= diff;
}
if (!WhirlWind)
{
if (AggroReset_Timer <= diff)
{
//Attack random Gamers
Unit *pTarget = NULL;
pTarget = SelectUnit(SELECT_TARGET_RANDOM,1);
if (pTarget)
me->AddThreat(pTarget, 1.0f);
me->TauntApply(pTarget);
AttackStart(pTarget);
AggroReset = true;
AggroReset_Timer = 2000 + rand()%3000;
} else AggroReset_Timer -= diff;
if (KnockBack_Timer <= diff)
{
DoCast(me, SPELL_WHIRLWINDADD);
KnockBack_Timer = 10000 + rand()%10000;
} else KnockBack_Timer -= diff;
}
if (AggroReset)
{
if (AggroResetEnd_Timer <= diff)
{
AggroReset = false;
AggroResetEnd_Timer = 5000;
AggroReset_Timer = 30000 + rand()%10000;
} else AggroResetEnd_Timer -= diff;
}
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI_boss_sartura(Creature* pCreature)
{
return new boss_sarturaAI (pCreature);
}
CreatureAI* GetAI_mob_sartura_royal_guard(Creature* pCreature)
{
return new mob_sartura_royal_guardAI (pCreature);
}
void AddSC_boss_sartura()
{
Script *newscript;
newscript = new Script;
newscript->Name = "boss_sartura";
newscript->GetAI = &GetAI_boss_sartura;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "mob_sartura_royal_guard";
newscript->GetAI = &GetAI_mob_sartura_royal_guard;
newscript->RegisterSelf();
new boss_sartura();
new mob_sartura_royal_guard();
}
@@ -50,251 +50,253 @@ class ov_mycoordinates
x = cx; y = cy; z = cz; r = cr;
}
};
struct boss_skeramAI : public ScriptedAI
␍class boss_skeram : public CreatureScript
{
boss_skeramAI(Creature *c) : ScriptedAI(c)
public:
boss_skeram() : CreatureScript("boss_skeram") { }
CreatureAI* GetAI(Creature* pCreature) const
{
IsImage = false;
return new boss_skeramAI (pCreature);
}
uint32 ArcaneExplosion_Timer;
uint32 EarthShock_Timer;
uint32 FullFillment_Timer;
uint32 Blink_Timer;
uint32 Invisible_Timer;
bool Images75;
bool Images50;
bool Images25;
bool IsImage;
bool Invisible;
void Reset()
struct boss_skeramAI : public ScriptedAI
{
ArcaneExplosion_Timer = 6000 + rand()%6000;
EarthShock_Timer = 2000;
FullFillment_Timer = 15000;
Blink_Timer = 8000 + rand()%12000;
Invisible_Timer = 500;
Images75 = false;
Images50 = false;
Images25 = false;
Invisible = false;
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetVisibility(VISIBILITY_ON);
if (IsImage)
me->setDeathState(JUST_DIED);
}
void KilledUnit(Unit* /*victim*/)
{
DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), me);
}
void JustDied(Unit* /*Killer*/)
{
if (!IsImage)
DoScriptText(SAY_DEATH, me);
}
void EnterCombat(Unit * /*who*/)
{
if (IsImage || Images75)
return;
DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2,SAY_AGGRO3), me);
}
void UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
//ArcaneExplosion_Timer
if (ArcaneExplosion_Timer <= diff)
boss_skeramAI(Creature *c) : ScriptedAI(c)
{
DoCast(me->getVictim(), SPELL_ARCANE_EXPLOSION);
ArcaneExplosion_Timer = 8000 + rand()%10000;
} else ArcaneExplosion_Timer -= diff;
//If we are within range melee the target
if (me->IsWithinMeleeRange(me->getVictim()))
{
//Make sure our attack is ready and we arn't currently casting
if (me->isAttackReady() && !me->IsNonMeleeSpellCasted(false))
{
me->AttackerStateUpdate(me->getVictim());
me->resetAttackTimer();
}
}else
{
//EarthShock_Timer
if (EarthShock_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_EARTH_SHOCK);
EarthShock_Timer = 1000;
} else EarthShock_Timer -= diff;
IsImage = false;
}
//Blink_Timer
if (Blink_Timer <= diff)
uint32 ArcaneExplosion_Timer;
uint32 EarthShock_Timer;
uint32 FullFillment_Timer;
uint32 Blink_Timer;
uint32 Invisible_Timer;
bool Images75;
bool Images50;
bool Images25;
bool IsImage;
bool Invisible;
void Reset()
{
//DoCast(me, SPELL_BLINK);
ArcaneExplosion_Timer = 6000 + rand()%6000;
EarthShock_Timer = 2000;
FullFillment_Timer = 15000;
Blink_Timer = 8000 + rand()%12000;
Invisible_Timer = 500;
Images75 = false;
Images50 = false;
Images25 = false;
Invisible = false;
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetVisibility(VISIBILITY_ON);
if (IsImage)
me->setDeathState(JUST_DIED);
}
void KilledUnit(Unit* /*victim*/)
{
DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), me);
}
void JustDied(Unit* /*Killer*/)
{
if (!IsImage)
DoScriptText(SAY_DEATH, me);
}
void EnterCombat(Unit * /*who*/)
{
if (IsImage || Images75)
return;
DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2,SAY_AGGRO3), me);
}
void UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
//ArcaneExplosion_Timer
if (ArcaneExplosion_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_ARCANE_EXPLOSION);
ArcaneExplosion_Timer = 8000 + rand()%10000;
} else ArcaneExplosion_Timer -= diff;
//If we are within range melee the target
if (me->IsWithinMeleeRange(me->getVictim()))
{
//Make sure our attack is ready and we arn't currently casting
if (me->isAttackReady() && !me->IsNonMeleeSpellCasted(false))
{
me->AttackerStateUpdate(me->getVictim());
me->resetAttackTimer();
}
}else
{
//EarthShock_Timer
if (EarthShock_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_EARTH_SHOCK);
EarthShock_Timer = 1000;
} else EarthShock_Timer -= diff;
}
//Blink_Timer
if (Blink_Timer <= diff)
{
//DoCast(me, SPELL_BLINK);
switch (urand(0,2))
{
case 0:
me->GetMap()->CreatureRelocation(me, -8340.782227,2083.814453,125.648788,0.0f);
DoResetThreat();
break;
case 1:
me->GetMap()->CreatureRelocation(me, -8341.546875,2118.504639,133.058151,0.0f);
DoResetThreat();
break;
case 2:
me->GetMap()->CreatureRelocation(me, -8318.822266,2058.231201,133.058151,0.0f);
DoResetThreat();
break;
}
DoStopAttack();
Blink_Timer= 20000 + rand()%20000;
} else Blink_Timer -= diff;
int procent = (int) (me->GetHealth()*100 / me->GetMaxHealth() +0.5);
//Summoning 2 Images and teleporting to a random position on 75% health
if ((!Images75 && !IsImage) && (procent <= 75 && procent > 70))
DoSplit(75);
//Summoning 2 Images and teleporting to a random position on 50% health
if ((!Images50 && !IsImage) &&
(procent <= 50 && procent > 45))
DoSplit(50);
//Summoning 2 Images and teleporting to a random position on 25% health
if ((!Images25 && !IsImage) && (procent <= 25 && procent > 20))
DoSplit(25);
//Invisible_Timer
if (Invisible)
{
if (Invisible_Timer <= diff)
{
//Making Skeram visible after telporting
me->SetVisibility(VISIBILITY_ON);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Invisible_Timer = 2500;
Invisible = false;
} else Invisible_Timer -= diff;
}
DoMeleeAttackIfReady();
}
void DoSplit(int atPercent /* 75 50 25 */)
{
DoScriptText(SAY_SPLIT, me);
ov_mycoordinates *place1 = new ov_mycoordinates(-8340.782227,2083.814453,125.648788,0);
ov_mycoordinates *place2 = new ov_mycoordinates(-8341.546875,2118.504639,133.058151,0);
ov_mycoordinates *place3 = new ov_mycoordinates(-8318.822266,2058.231201,133.058151,0);
ov_mycoordinates *bossc=place1, *i1=place2, *i2=place3;
switch (urand(0,2))
{
case 0:
me->GetMap()->CreatureRelocation(me, -8340.782227,2083.814453,125.648788,0.0f);
DoResetThreat();
bossc=place1;
i1=place2;
i2=place3;
break;
case 1:
me->GetMap()->CreatureRelocation(me, -8341.546875,2118.504639,133.058151,0.0f);
DoResetThreat();
bossc=place2;
i1=place1;
i2=place3;
break;
case 2:
me->GetMap()->CreatureRelocation(me, -8318.822266,2058.231201,133.058151,0.0f);
DoResetThreat();
bossc=place3;
i1=place1;
i2=place2;
break;
}
for (uint16 i = 0; i < 41; ++i)
{
if (Player *pTarget = CAST_PLR(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)))
{
if (Group *pGrp = pTarget->GetGroup())
for (uint8 ico = 0; ico < TARGETICONCOUNT; ++ico)
{
//if (grp->m_targetIcons[ico] == me->GetGUID()) -- private member :(
pGrp->SetTargetIcon(ico, 0, 0);
}
break;
}
}
me->RemoveAllAuras();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetVisibility(VISIBILITY_OFF);
me->GetMap()->CreatureRelocation(me, bossc->x, bossc->y, bossc->z, bossc->r);
Invisible = true;
delete place1;
delete place2;
delete place3;
DoResetThreat();
DoStopAttack();
Blink_Timer= 20000 + rand()%20000;
} else Blink_Timer -= diff;
int procent = (int) (me->GetHealth()*100 / me->GetMaxHealth() +0.5);
//Summoning 2 Images and teleporting to a random position on 75% health
if ((!Images75 && !IsImage) && (procent <= 75 && procent > 70))
DoSplit(75);
//Summoning 2 Images and teleporting to a random position on 50% health
if ((!Images50 && !IsImage) &&
(procent <= 50 && procent > 45))
DoSplit(50);
//Summoning 2 Images and teleporting to a random position on 25% health
if ((!Images25 && !IsImage) && (procent <= 25 && procent > 20))
DoSplit(25);
//Invisible_Timer
if (Invisible)
{
if (Invisible_Timer <= diff)
switch (atPercent)
{
//Making Skeram visible after telporting
me->SetVisibility(VISIBILITY_ON);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Invisible_Timer = 2500;
Invisible = false;
} else Invisible_Timer -= diff;
}
DoMeleeAttackIfReady();
}
void DoSplit(int atPercent /* 75 50 25 */)
{
DoScriptText(SAY_SPLIT, me);
ov_mycoordinates *place1 = new ov_mycoordinates(-8340.782227,2083.814453,125.648788,0);
ov_mycoordinates *place2 = new ov_mycoordinates(-8341.546875,2118.504639,133.058151,0);
ov_mycoordinates *place3 = new ov_mycoordinates(-8318.822266,2058.231201,133.058151,0);
ov_mycoordinates *bossc=place1, *i1=place2, *i2=place3;
switch (urand(0,2))
{
case 0:
bossc=place1;
i1=place2;
i2=place3;
break;
case 1:
bossc=place2;
i1=place1;
i2=place3;
break;
case 2:
bossc=place3;
i1=place1;
i2=place2;
break;
}
for (uint16 i = 0; i < 41; ++i)
{
if (Player *pTarget = CAST_PLR(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)))
{
if (Group *pGrp = pTarget->GetGroup())
for (uint8 ico = 0; ico < TARGETICONCOUNT; ++ico)
{
//if (grp->m_targetIcons[ico] == me->GetGUID()) -- private member :(
pGrp->SetTargetIcon(ico, 0, 0);
}
break;
case 75: Images75 = true; break;
case 50: Images50 = true; break;
case 25: Images25 = true; break;
}
Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0);
Creature *Image1 = me->SummonCreature(15263, i1->x, i1->y, i1->z, i1->r, TEMPSUMMON_CORPSE_DESPAWN, 30000);
if (Image1)
{
Image1->SetMaxHealth(me->GetMaxHealth() / 5);
Image1->SetHealth(me->GetHealth() / 5);
if (pTarget)
Image1->AI()->AttackStart(pTarget);
CAST_AI(boss_skeram::boss_skeramAI, Image1->AI())->IsImage = true;
}
Creature *Image2 = me->SummonCreature(15263,i2->x, i2->y, i2->z, i2->r, TEMPSUMMON_CORPSE_DESPAWN, 30000);
if (Image2)
{
Image2->SetMaxHealth(me->GetMaxHealth() / 5);
Image2->SetHealth(me->GetHealth() / 5);
if (pTarget)
Image2->AI()->AttackStart(pTarget);
CAST_AI(boss_skeram::boss_skeramAI, Image2->AI())->IsImage = true;
}
Invisible = true;
}
me->RemoveAllAuras();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetVisibility(VISIBILITY_OFF);
me->GetMap()->CreatureRelocation(me, bossc->x, bossc->y, bossc->z, bossc->r);
Invisible = true;
delete place1;
delete place2;
delete place3;
DoResetThreat();
DoStopAttack();
switch (atPercent)
{
case 75: Images75 = true; break;
case 50: Images50 = true; break;
case 25: Images25 = true; break;
}
Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0);
Creature *Image1 = me->SummonCreature(15263, i1->x, i1->y, i1->z, i1->r, TEMPSUMMON_CORPSE_DESPAWN, 30000);
if (Image1)
{
Image1->SetMaxHealth(me->GetMaxHealth() / 5);
Image1->SetHealth(me->GetHealth() / 5);
if (pTarget)
Image1->AI()->AttackStart(pTarget);
CAST_AI(boss_skeramAI, Image1->AI())->IsImage = true;
}
Creature *Image2 = me->SummonCreature(15263,i2->x, i2->y, i2->z, i2->r, TEMPSUMMON_CORPSE_DESPAWN, 30000);
if (Image2)
{
Image2->SetMaxHealth(me->GetMaxHealth() / 5);
Image2->SetHealth(me->GetHealth() / 5);
if (pTarget)
Image2->AI()->AttackStart(pTarget);
CAST_AI(boss_skeramAI, Image2->AI())->IsImage = true;
}
Invisible = true;
}
};
};
CreatureAI* GetAI_boss_skeram(Creature* pCreature)
{
return new boss_skeramAI (pCreature);
}
void AddSC_boss_skeram()
{
Script *newscript;
newscript = new Script;
newscript->Name = "boss_skeram";
newscript->GetAI = &GetAI_boss_skeram;
newscript->RegisterSelf();
new boss_skeram();
}
@@ -63,10 +63,10 @@ struct boss_twinemperorsAI : public ScriptedAI
{
boss_twinemperorsAI(Creature *c): ScriptedAI(c)
{
pInstance = c->GetInstanceData();
pInstance = c->GetInstanceScript();
}
ScriptedInstance *pInstance;
InstanceScript *pInstance;
uint32 Heal_Timer;
uint32 Teleport_Timer;
@@ -382,217 +382,221 @@ struct boss_twinemperorsAI : public ScriptedAI
} else EnrageTimer-=diff;
}
};
struct boss_veknilashAI : public boss_twinemperorsAI
␍class boss_veknilash : public CreatureScript
{
bool IAmVeklor() {return false;}
boss_veknilashAI(Creature *c) : boss_twinemperorsAI(c) {}
public:
boss_veknilash() : CreatureScript("boss_veknilash") { }
uint32 UpperCut_Timer;
uint32 UnbalancingStrike_Timer;
uint32 Scarabs_Timer;
int Rand;
int RandX;
int RandY;
Creature* Summoned;
void Reset()
CreatureAI* GetAI(Creature* pCreature) const
{
TwinReset();
UpperCut_Timer = 14000 + rand()%15000;
UnbalancingStrike_Timer = 8000 + rand()%10000;
Scarabs_Timer = 7000 + rand()%7000;
//Added. Can be removed if its included in DB.
me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true);
return new boss_veknilashAI (pCreature);
}
void CastSpellOnBug(Creature *pTarget)
struct boss_veknilashAI : public boss_twinemperorsAI
{
pTarget->setFaction(14);
pTarget->AI()->AttackStart(me->getThreatManager().getHostilTarget());
pTarget->AddAura(SPELL_MUTATE_BUG, pTarget);
pTarget->SetHealth(pTarget->GetMaxHealth());
}
bool IAmVeklor() {return false;}
boss_veknilashAI(Creature *c) : boss_twinemperorsAI(c) {}
void UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
uint32 UpperCut_Timer;
uint32 UnbalancingStrike_Timer;
uint32 Scarabs_Timer;
int Rand;
int RandX;
int RandY;
if (!TryActivateAfterTTelep(diff))
return;
Creature* Summoned;
//UnbalancingStrike_Timer
if (UnbalancingStrike_Timer <= diff)
void Reset()
{
DoCast(me->getVictim(), SPELL_UNBALANCING_STRIKE);
UnbalancingStrike_Timer = 8000+rand()%12000;
} else UnbalancingStrike_Timer -= diff;
TwinReset();
UpperCut_Timer = 14000 + rand()%15000;
UnbalancingStrike_Timer = 8000 + rand()%10000;
Scarabs_Timer = 7000 + rand()%7000;
if (UpperCut_Timer <= diff)
//Added. Can be removed if its included in DB.
me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true);
}
void CastSpellOnBug(Creature *pTarget)
{
Unit* randomMelee = SelectTarget(SELECT_TARGET_RANDOM, 0, NOMINAL_MELEE_RANGE, true);
if (randomMelee)
DoCast(randomMelee, SPELL_UPPERCUT);
UpperCut_Timer = 15000+rand()%15000;
} else UpperCut_Timer -= diff;
pTarget->setFaction(14);
pTarget->AI()->AttackStart(me->getThreatManager().getHostilTarget());
pTarget->AddAura(SPELL_MUTATE_BUG, pTarget);
pTarget->SetHealth(pTarget->GetMaxHealth());
}
HandleBugs(diff);
//Heal brother when 60yrds close
TryHealBrother(diff);
//Teleporting to brother
if (Teleport_Timer <= diff)
void UpdateAI(const uint32 diff)
{
TeleportToMyBrother();
} else Teleport_Timer -= diff;
//Return since we have no target
if (!UpdateVictim())
return;
CheckEnrage(diff);
if (!TryActivateAfterTTelep(diff))
return;
//UnbalancingStrike_Timer
if (UnbalancingStrike_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_UNBALANCING_STRIKE);
UnbalancingStrike_Timer = 8000+rand()%12000;
} else UnbalancingStrike_Timer -= diff;
if (UpperCut_Timer <= diff)
{
Unit* randomMelee = SelectTarget(SELECT_TARGET_RANDOM, 0, NOMINAL_MELEE_RANGE, true);
if (randomMelee)
DoCast(randomMelee, SPELL_UPPERCUT);
UpperCut_Timer = 15000+rand()%15000;
} else UpperCut_Timer -= diff;
HandleBugs(diff);
//Heal brother when 60yrds close
TryHealBrother(diff);
//Teleporting to brother
if (Teleport_Timer <= diff)
{
TeleportToMyBrother();
} else Teleport_Timer -= diff;
CheckEnrage(diff);
DoMeleeAttackIfReady();
}
};
DoMeleeAttackIfReady();
}
};
struct boss_veklorAI : public boss_twinemperorsAI
␍class boss_veklor : public CreatureScript
{
bool IAmVeklor() {return true;}
boss_veklorAI(Creature *c) : boss_twinemperorsAI(c) {}
public:
boss_veklor() : CreatureScript("boss_veklor") { }
uint32 ShadowBolt_Timer;
uint32 Blizzard_Timer;
uint32 ArcaneBurst_Timer;
uint32 Scorpions_Timer;
int Rand;
int RandX;
int RandY;
Creature* Summoned;
void Reset()
CreatureAI* GetAI(Creature* pCreature) const
{
TwinReset();
ShadowBolt_Timer = 0;
Blizzard_Timer = 15000 + rand()%5000;
ArcaneBurst_Timer = 1000;
Scorpions_Timer = 7000 + rand()%7000;
//Added. Can be removed if its included in DB.
me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, true);
me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 0);
me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, 0);
return new boss_veklorAI (pCreature);
}
void CastSpellOnBug(Creature *pTarget)
struct boss_veklorAI : public boss_twinemperorsAI
{
pTarget->setFaction(14);
pTarget->AddAura(SPELL_EXPLODEBUG, pTarget);
pTarget->SetHealth(pTarget->GetMaxHealth());
}
bool IAmVeklor() {return true;}
boss_veklorAI(Creature *c) : boss_twinemperorsAI(c) {}
void UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
uint32 ShadowBolt_Timer;
uint32 Blizzard_Timer;
uint32 ArcaneBurst_Timer;
uint32 Scorpions_Timer;
int Rand;
int RandX;
int RandY;
// reset arcane burst after teleport - we need to do this because
// when VL jumps to VN's location there will be a warrior who will get only 2s to run away
// which is almost impossible
if (AfterTeleport)
ArcaneBurst_Timer = 5000;
if (!TryActivateAfterTTelep(diff))
return;
Creature* Summoned;
//ShadowBolt_Timer
if (ShadowBolt_Timer <= diff)
void Reset()
{
if (!me->IsWithinDist(me->getVictim(), 45.0f))
me->GetMotionMaster()->MoveChase(me->getVictim(), VEKLOR_DIST, 0);
else
DoCast(me->getVictim(), SPELL_SHADOWBOLT);
ShadowBolt_Timer = 2000;
} else ShadowBolt_Timer -= diff;
TwinReset();
ShadowBolt_Timer = 0;
Blizzard_Timer = 15000 + rand()%5000;
ArcaneBurst_Timer = 1000;
Scorpions_Timer = 7000 + rand()%7000;
//Blizzard_Timer
if (Blizzard_Timer <= diff)
{
Unit *pTarget = NULL;
pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 45, true);
if (pTarget)
DoCast(pTarget, SPELL_BLIZZARD);
Blizzard_Timer = 15000+rand()%15000;
} else Blizzard_Timer -= diff;
//Added. Can be removed if its included in DB.
me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, true);
me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 0);
me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, 0);
}
if (ArcaneBurst_Timer <= diff)
void CastSpellOnBug(Creature *pTarget)
{
Unit *mvic;
if ((mvic=SelectTarget(SELECT_TARGET_NEAREST, 0, NOMINAL_MELEE_RANGE, true)) != NULL)
{
DoCast(mvic, SPELL_ARCANEBURST);
pTarget->setFaction(14);
pTarget->AddAura(SPELL_EXPLODEBUG, pTarget);
pTarget->SetHealth(pTarget->GetMaxHealth());
}
void UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
// reset arcane burst after teleport - we need to do this because
// when VL jumps to VN's location there will be a warrior who will get only 2s to run away
// which is almost impossible
if (AfterTeleport)
ArcaneBurst_Timer = 5000;
}
} else ArcaneBurst_Timer -= diff;
if (!TryActivateAfterTTelep(diff))
return;
HandleBugs(diff);
//Heal brother when 60yrds close
TryHealBrother(diff);
//Teleporting to brother
if (Teleport_Timer <= diff)
{
TeleportToMyBrother();
} else Teleport_Timer -= diff;
CheckEnrage(diff);
//VL doesn't melee
//DoMeleeAttackIfReady();
}
void AttackStart(Unit* who)
{
if (!who)
return;
if (who->isTargetableForAttack())
{
// VL doesn't melee
if (me->Attack(who, false))
//ShadowBolt_Timer
if (ShadowBolt_Timer <= diff)
{
me->GetMotionMaster()->MoveChase(who, VEKLOR_DIST, 0);
me->AddThreat(who, 0.0f);
if (!me->IsWithinDist(me->getVictim(), 45.0f))
me->GetMotionMaster()->MoveChase(me->getVictim(), VEKLOR_DIST, 0);
else
DoCast(me->getVictim(), SPELL_SHADOWBOLT);
ShadowBolt_Timer = 2000;
} else ShadowBolt_Timer -= diff;
//Blizzard_Timer
if (Blizzard_Timer <= diff)
{
Unit *pTarget = NULL;
pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 45, true);
if (pTarget)
DoCast(pTarget, SPELL_BLIZZARD);
Blizzard_Timer = 15000+rand()%15000;
} else Blizzard_Timer -= diff;
if (ArcaneBurst_Timer <= diff)
{
Unit *mvic;
if ((mvic=SelectTarget(SELECT_TARGET_NEAREST, 0, NOMINAL_MELEE_RANGE, true)) != NULL)
{
DoCast(mvic, SPELL_ARCANEBURST);
ArcaneBurst_Timer = 5000;
}
} else ArcaneBurst_Timer -= diff;
HandleBugs(diff);
//Heal brother when 60yrds close
TryHealBrother(diff);
//Teleporting to brother
if (Teleport_Timer <= diff)
{
TeleportToMyBrother();
} else Teleport_Timer -= diff;
CheckEnrage(diff);
//VL doesn't melee
//DoMeleeAttackIfReady();
}
void AttackStart(Unit* who)
{
if (!who)
return;
if (who->isTargetableForAttack())
{
// VL doesn't melee
if (me->Attack(who, false))
{
me->GetMotionMaster()->MoveChase(who, VEKLOR_DIST, 0);
me->AddThreat(who, 0.0f);
}
}
}
}
};
};
CreatureAI* GetAI_boss_veknilash(Creature* pCreature)
{
return new boss_veknilashAI (pCreature);
}
CreatureAI* GetAI_boss_veklor(Creature* pCreature)
{
return new boss_veklorAI (pCreature);
}
void AddSC_boss_twinemperors()
{
Script *newscript;
newscript = new Script;
newscript->Name = "boss_veknilash";
newscript->GetAI = &GetAI_boss_veknilash;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "boss_veklor";
newscript->GetAI = &GetAI_boss_veklor;
newscript->RegisterSelf();
new boss_veknilash();
new boss_veklor();
}
@@ -25,144 +25,146 @@ EndScriptData */
#include "ScriptPCH.h"
#include "temple_of_ahnqiraj.h"
struct instance_temple_of_ahnqiraj : public ScriptedInstance
␍class instance_temple_of_ahnqiraj : public InstanceMapScript
{
instance_temple_of_ahnqiraj(Map* pMap) : ScriptedInstance(pMap) {Initialize();};
public:
instance_temple_of_ahnqiraj() : InstanceMapScript("instance_temple_of_ahnqiraj") { }
//If Vem is dead...
bool IsBossDied[3];
//Storing Skeram, Vem and Kri.
uint64 SkeramGUID;
uint64 VemGUID;
uint64 KriGUID;
uint64 VeklorGUID;
uint64 VeknilashGUID;
uint32 BugTrioDeathCount;
uint32 CthunPhase;
void Initialize()
InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap)
{
IsBossDied[0] = false;
IsBossDied[1] = false;
IsBossDied[2] = false;
SkeramGUID = 0;
VemGUID = 0;
KriGUID = 0;
VeklorGUID = 0;
VeknilashGUID = 0;
BugTrioDeathCount = 0;
CthunPhase = 0;
return new instance_temple_of_ahnqiraj_InstanceMapScript(pMap);
}
void OnCreatureCreate(Creature* pCreature, bool /*add*/)
struct instance_temple_of_ahnqiraj_InstanceMapScript : public InstanceScript
{
switch (pCreature->GetEntry())
instance_temple_of_ahnqiraj_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();};
//If Vem is dead...
bool IsBossDied[3];
//Storing Skeram, Vem and Kri.
uint64 SkeramGUID;
uint64 VemGUID;
uint64 KriGUID;
uint64 VeklorGUID;
uint64 VeknilashGUID;
uint32 BugTrioDeathCount;
uint32 CthunPhase;
void Initialize()
{
case 15263: SkeramGUID = pCreature->GetGUID(); break;
case 15544: VemGUID = pCreature->GetGUID(); break;
case 15511: KriGUID = pCreature->GetGUID(); break;
case 15276: VeklorGUID = pCreature->GetGUID(); break;
case 15275: VeknilashGUID = pCreature->GetGUID(); break;
IsBossDied[0] = false;
IsBossDied[1] = false;
IsBossDied[2] = false;
SkeramGUID = 0;
VemGUID = 0;
KriGUID = 0;
VeklorGUID = 0;
VeknilashGUID = 0;
BugTrioDeathCount = 0;
CthunPhase = 0;
}
}
bool IsEncounterInProgress() const
{
//not active in AQ40
return false;
}
uint32 GetData(uint32 type)
{
switch(type)
void OnCreatureCreate(Creature* pCreature, bool /*add*/)
{
case DATA_VEMISDEAD:
if (IsBossDied[0])
return 1;
break;
case DATA_VEKLORISDEAD:
if (IsBossDied[1])
return 1;
break;
case DATA_VEKNILASHISDEAD:
if (IsBossDied[2])
return 1;
break;
case DATA_BUG_TRIO_DEATH:
return BugTrioDeathCount;
case DATA_CTHUN_PHASE:
return CthunPhase;
switch (pCreature->GetEntry())
{
case 15263: SkeramGUID = pCreature->GetGUID(); break;
case 15544: VemGUID = pCreature->GetGUID(); break;
case 15511: KriGUID = pCreature->GetGUID(); break;
case 15276: VeklorGUID = pCreature->GetGUID(); break;
case 15275: VeknilashGUID = pCreature->GetGUID(); break;
}
}
return 0;
}
uint64 GetData64 (uint32 identifier)
{
switch(identifier)
bool IsEncounterInProgress() const
{
case DATA_SKERAM:
return SkeramGUID;
case DATA_VEM:
return VemGUID;
case DATA_KRI:
return KriGUID;
case DATA_VEKLOR:
return VeklorGUID;
case DATA_VEKNILASH:
return VeknilashGUID;
//not active in AQ40
return false;
}
return 0;
} // end GetData64
void SetData(uint32 type, uint32 data)
{
switch(type)
uint32 GetData(uint32 type)
{
case DATA_VEM_DEATH:
IsBossDied[0] = true;
break;
switch(type)
{
case DATA_VEMISDEAD:
if (IsBossDied[0])
return 1;
break;
case DATA_BUG_TRIO_DEATH:
++BugTrioDeathCount;
break;
case DATA_VEKLORISDEAD:
if (IsBossDied[1])
return 1;
break;
case DATA_VEKLOR_DEATH:
IsBossDied[1] = true;
break;
case DATA_VEKNILASHISDEAD:
if (IsBossDied[2])
return 1;
break;
case DATA_VEKNILASH_DEATH:
IsBossDied[2] = true;
break;
case DATA_BUG_TRIO_DEATH:
return BugTrioDeathCount;
case DATA_CTHUN_PHASE:
CthunPhase = data;
break;
case DATA_CTHUN_PHASE:
return CthunPhase;
}
return 0;
}
}
uint64 GetData64 (uint32 identifier)
{
switch(identifier)
{
case DATA_SKERAM:
return SkeramGUID;
case DATA_VEM:
return VemGUID;
case DATA_KRI:
return KriGUID;
case DATA_VEKLOR:
return VeklorGUID;
case DATA_VEKNILASH:
return VeknilashGUID;
}
return 0;
} // end GetData64
void SetData(uint32 type, uint32 data)
{
switch(type)
{
case DATA_VEM_DEATH:
IsBossDied[0] = true;
break;
case DATA_BUG_TRIO_DEATH:
++BugTrioDeathCount;
break;
case DATA_VEKLOR_DEATH:
IsBossDied[1] = true;
break;
case DATA_VEKNILASH_DEATH:
IsBossDied[2] = true;
break;
case DATA_CTHUN_PHASE:
CthunPhase = data;
break;
}
}
};
};
InstanceData* GetInstanceData_instance_temple_of_ahnqiraj(Map* pMap)
{
return new instance_temple_of_ahnqiraj(pMap);
}
void AddSC_instance_temple_of_ahnqiraj()
{
Script *newscript;
newscript = new Script;
newscript->Name = "instance_temple_of_ahnqiraj";
newscript->GetInstanceData = &GetInstanceData_instance_temple_of_ahnqiraj;
newscript->RegisterSelf();
new instance_temple_of_ahnqiraj();
}
@@ -54,245 +54,247 @@ EndScriptData */
#define SPELL_STORM_BUFF 2148
#define SPELL_STORM 26546
struct aqsentinelAI : public ScriptedAI
␍class mob_anubisath_sentinel : public CreatureScript
{
uint32 ability;
int abselected;
public:
mob_anubisath_sentinel() : CreatureScript("mob_anubisath_sentinel") { }
void selectAbility(int asel)
CreatureAI* GetAI(Creature* pCreature) const
{
switch (asel)
return new aqsentinelAI (pCreature);
}
struct aqsentinelAI : public ScriptedAI
{
uint32 ability;
int abselected;
void selectAbility(int asel)
{
case 0: ability = SPELL_MENDING_BUFF;break;
case 1: ability = SPELL_KNOCK_BUFF;break;
case 2: ability = SPELL_MANAB_BUFF;break;
case 3: ability = SPELL_REFLECTAF_BUFF;break;
case 4: ability = SPELL_REFLECTSFr_BUFF;break;
case 5: ability = SPELL_THORNS_BUFF;break;
case 6: ability = SPELL_THUNDER_BUFF;break;
case 7: ability = SPELL_MSTRIKE_BUFF;break;
case 8: ability = SPELL_STORM_BUFF;break;
}
}
aqsentinelAI(Creature *c) : ScriptedAI(c)
{
ClearBuddyList();
abselected = 0; // just initialization of variable
}
uint64 NearbyGUID[3];
void ClearBuddyList()
{
NearbyGUID[0] = NearbyGUID[1] = NearbyGUID[2] = 0;
}
void AddBuddyToList(uint64 CreatureGUID)
{
if (CreatureGUID == me->GetGUID())
return;
for (int i=0; i<3; ++i)
{
if (NearbyGUID[i] == CreatureGUID)
return;
if (!NearbyGUID[i])
switch (asel)
{
NearbyGUID[i] = CreatureGUID;
return;
case 0: ability = SPELL_MENDING_BUFF;break;
case 1: ability = SPELL_KNOCK_BUFF;break;
case 2: ability = SPELL_MANAB_BUFF;break;
case 3: ability = SPELL_REFLECTAF_BUFF;break;
case 4: ability = SPELL_REFLECTSFr_BUFF;break;
case 5: ability = SPELL_THORNS_BUFF;break;
case 6: ability = SPELL_THUNDER_BUFF;break;
case 7: ability = SPELL_MSTRIKE_BUFF;break;
case 8: ability = SPELL_STORM_BUFF;break;
}
}
}
void GiveBuddyMyList(Creature *c)
{
aqsentinelAI *cai = CAST_AI(aqsentinelAI, (c)->AI());
for (int i=0; i<3; ++i)
if (NearbyGUID[i] && NearbyGUID[i] != c->GetGUID())
cai->AddBuddyToList(NearbyGUID[i]);
cai->AddBuddyToList(me->GetGUID());
}
void SendMyListToBuddies()
{
for (int i=0; i<3; ++i)
if (Creature *pNearby = Unit::GetCreature(*me, NearbyGUID[i]))
GiveBuddyMyList(pNearby);
}
void CallBuddiesToAttack(Unit *who)
{
for (int i=0; i<3; ++i)
aqsentinelAI(Creature *c) : ScriptedAI(c)
{
Creature *c = Unit::GetCreature(*me, NearbyGUID[i]);
if (c)
ClearBuddyList();
abselected = 0; // just initialization of variable
}
uint64 NearbyGUID[3];
void ClearBuddyList()
{
NearbyGUID[0] = NearbyGUID[1] = NearbyGUID[2] = 0;
}
void AddBuddyToList(uint64 CreatureGUID)
{
if (CreatureGUID == me->GetGUID())
return;
for (int i=0; i<3; ++i)
{
if (!c->isInCombat())
if (NearbyGUID[i] == CreatureGUID)
return;
if (!NearbyGUID[i])
{
c->SetNoCallAssistance(true);
if (c->AI())
c->AI()->AttackStart(who);
NearbyGUID[i] = CreatureGUID;
return;
}
}
}
}
void AddSentinelsNear(Unit * /*nears*/)
{
std::list<Creature*> assistList;
me->GetCreatureListWithEntryInGrid(assistList,15264,70.0f);
if (assistList.empty())
return;
for (std::list<Creature*>::const_iterator iter = assistList.begin(); iter != assistList.end(); ++iter)
AddBuddyToList((*iter)->GetGUID());
}
int pickAbilityRandom(bool *chosenAbilities)
{
for (int t = 0; t < 2; ++t)
void GiveBuddyMyList(Creature *c)
{
for (int i = !t ? (rand()%9) : 0; i < 9; ++i)
{
if (!chosenAbilities[i])
{
chosenAbilities[i] = true;
return i;
}
}
aqsentinelAI *cai = CAST_AI(aqsentinelAI, (c)->AI());
for (int i=0; i<3; ++i)
if (NearbyGUID[i] && NearbyGUID[i] != c->GetGUID())
cai->AddBuddyToList(NearbyGUID[i]);
cai->AddBuddyToList(me->GetGUID());
}
return 0; // should never happen
}
void GetOtherSentinels(Unit *who)
{
bool *chosenAbilities = new bool[9];
memset(chosenAbilities, 0, 9*sizeof(bool));
selectAbility(pickAbilityRandom(chosenAbilities));
ClearBuddyList();
AddSentinelsNear(me);
int bli;
for (bli = 0; bli < 3; ++bli)
void SendMyListToBuddies()
{
if (!NearbyGUID[bli])
break;
Creature *pNearby = Unit::GetCreature(*me, NearbyGUID[bli]);
if (!pNearby)
break;
AddSentinelsNear(pNearby);
CAST_AI(aqsentinelAI, pNearby->AI())->gatherOthersWhenAggro = false;
CAST_AI(aqsentinelAI, pNearby->AI())->selectAbility(pickAbilityRandom(chosenAbilities));
for (int i=0; i<3; ++i)
if (Creature *pNearby = Unit::GetCreature(*me, NearbyGUID[i]))
GiveBuddyMyList(pNearby);
}
/*if (bli < 3)
DoYell("I dont have enough buddies.", LANG_NEUTRAL, 0);*/
SendMyListToBuddies();
CallBuddiesToAttack(who);
delete[] chosenAbilities;
}
bool gatherOthersWhenAggro;
void Reset()
{
if (!me->isDead())
void CallBuddiesToAttack(Unit *who)
{
for (int i=0; i<3; ++i)
{
if (!NearbyGUID[i])
continue;
if (Creature *pNearby = Unit::GetCreature(*me, NearbyGUID[i]))
Creature *c = Unit::GetCreature(*me, NearbyGUID[i]);
if (c)
{
if (pNearby->isDead())
pNearby->Respawn();
if (!c->isInCombat())
{
c->SetNoCallAssistance(true);
if (c->AI())
c->AI()->AttackStart(who);
}
}
}
}
ClearBuddyList();
gatherOthersWhenAggro = true;
}
void GainSentinelAbility(uint32 id)
{
me->AddAura(id, me);
}
void EnterCombat(Unit * who)
{
if (gatherOthersWhenAggro)
GetOtherSentinels(who);
GainSentinelAbility(ability);
DoZoneInCombat();
}
void JustDied(Unit* /*who*/)
{
for (int ni=0; ni<3; ++ni)
void AddSentinelsNear(Unit * /*nears*/)
{
Creature *sent = Unit::GetCreature(*me, NearbyGUID[ni]);
if (!sent)
continue;
if (sent->isDead())
continue;
int h = sent->GetHealth() + (sent->GetMaxHealth() / 2);
if (h > sent->GetMaxHealth())
h = sent->GetMaxHealth();
sent->SetHealth(h);
CAST_AI(aqsentinelAI, sent->AI())->GainSentinelAbility(ability);
}
}
std::list<Creature*> assistList;
me->GetCreatureListWithEntryInGrid(assistList,15264,70.0f);
Unit *GetHatedManaUser() const
{
std::list<HostileReference*>::const_iterator i;
for (i = me->getThreatManager().getThreatList().begin(); i != me->getThreatManager().getThreatList().end(); ++i)
if (assistList.empty())
return;
for (std::list<Creature*>::const_iterator iter = assistList.begin(); iter != assistList.end(); ++iter)
AddBuddyToList((*iter)->GetGUID());
}
int pickAbilityRandom(bool *chosenAbilities)
{
Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (pUnit->getPowerType() == POWER_MANA)
return pUnit;
for (int t = 0; t < 2; ++t)
{
for (int i = !t ? (rand()%9) : 0; i < 9; ++i)
{
if (!chosenAbilities[i])
{
chosenAbilities[i] = true;
return i;
}
}
}
return 0; // should never happen
}
return NULL;
}
Unit* GetAuraEffectTriggerTarget(uint32 spellId, uint8 /*effIndex*/) const
{
switch (spellId)
void GetOtherSentinels(Unit *who)
{
case SPELL_KNOCK_BUFF:
case SPELL_THUNDER_BUFF:
case SPELL_MSTRIKE_BUFF:
case SPELL_STORM_BUFF:
return me->getVictim();
bool *chosenAbilities = new bool[9];
memset(chosenAbilities, 0, 9*sizeof(bool));
selectAbility(pickAbilityRandom(chosenAbilities));
case SPELL_MANAB_BUFF:
return GetHatedManaUser();
ClearBuddyList();
AddSentinelsNear(me);
int bli;
for (bli = 0; bli < 3; ++bli)
{
if (!NearbyGUID[bli])
break;
case SPELL_MENDING_BUFF:
case SPELL_REFLECTAF_BUFF:
case SPELL_REFLECTSFr_BUFF:
case SPELL_THORNS_BUFF:
default:
return me;
Creature *pNearby = Unit::GetCreature(*me, NearbyGUID[bli]);
if (!pNearby)
break;
AddSentinelsNear(pNearby);
CAST_AI(aqsentinelAI, pNearby->AI())->gatherOthersWhenAggro = false;
CAST_AI(aqsentinelAI, pNearby->AI())->selectAbility(pickAbilityRandom(chosenAbilities));
}
/*if (bli < 3)
DoYell("I dont have enough buddies.", LANG_NEUTRAL, 0);*/
SendMyListToBuddies();
CallBuddiesToAttack(who);
delete[] chosenAbilities;
}
}
bool gatherOthersWhenAggro;
void Reset()
{
if (!me->isDead())
{
for (int i=0; i<3; ++i)
{
if (!NearbyGUID[i])
continue;
if (Creature *pNearby = Unit::GetCreature(*me, NearbyGUID[i]))
{
if (pNearby->isDead())
pNearby->Respawn();
}
}
}
ClearBuddyList();
gatherOthersWhenAggro = true;
}
void GainSentinelAbility(uint32 id)
{
me->AddAura(id, me);
}
void EnterCombat(Unit * who)
{
if (gatherOthersWhenAggro)
GetOtherSentinels(who);
GainSentinelAbility(ability);
DoZoneInCombat();
}
void JustDied(Unit* /*who*/)
{
for (int ni=0; ni<3; ++ni)
{
Creature *sent = Unit::GetCreature(*me, NearbyGUID[ni]);
if (!sent)
continue;
if (sent->isDead())
continue;
int h = sent->GetHealth() + (sent->GetMaxHealth() / 2);
if (h > sent->GetMaxHealth())
h = sent->GetMaxHealth();
sent->SetHealth(h);
CAST_AI(aqsentinelAI, sent->AI())->GainSentinelAbility(ability);
}
}
Unit *GetHatedManaUser() const
{
std::list<HostileReference*>::const_iterator i;
for (i = me->getThreatManager().getThreatList().begin(); i != me->getThreatManager().getThreatList().end(); ++i)
{
Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (pUnit->getPowerType() == POWER_MANA)
return pUnit;
}
return NULL;
}
Unit* GetAuraEffectTriggerTarget(uint32 spellId, uint8 /*effIndex*/) const
{
switch (spellId)
{
case SPELL_KNOCK_BUFF:
case SPELL_THUNDER_BUFF:
case SPELL_MSTRIKE_BUFF:
case SPELL_STORM_BUFF:
return me->getVictim();
case SPELL_MANAB_BUFF:
return GetHatedManaUser();
case SPELL_MENDING_BUFF:
case SPELL_REFLECTAF_BUFF:
case SPELL_REFLECTSFr_BUFF:
case SPELL_THORNS_BUFF:
default:
return me;
}
}
};
};
CreatureAI* GetAI_mob_anubisath_sentinelAI(Creature* pCreature)
{
return new aqsentinelAI (pCreature);
}
void AddSC_mob_anubisath_sentinel()
{
Script *newscript;
newscript = new Script;
newscript->Name = "mob_anubisath_sentinel";
newscript->GetAI = &GetAI_mob_anubisath_sentinelAI;
newscript->RegisterSelf();
new mob_anubisath_sentinel();
}