R.I.P SimpleAI

- Convert SimpleAI to (DB) SmartAI
- Spell ids corrected (and completed some of the scripts)
- Random cleanup (code style) in some scripts
This commit is contained in:
Nay
2012-03-11 16:59:17 +00:00
parent 036dae5a36
commit 2b2d054f64
10 changed files with 373 additions and 938 deletions
@@ -1,280 +0,0 @@
/*
* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* ScriptData
SDName: SimpleAI
SD%Complete: 100
SDComment: Base Class for SimpleAI creatures
SDCategory: Creatures
EndScriptData */
#include "ScriptPCH.h"
#include "ScriptedSimpleAI.h"
SimpleAI::SimpleAI(Creature* c) : ScriptedAI(c)
{
//Clear all data
Aggro_TextId[0] = 0;
Aggro_TextId[1] = 0;
Aggro_TextId[2] = 0;
Aggro_Sound[0] = 0;
Aggro_Sound[1] = 0;
Aggro_Sound[2] = 0;
Death_TextId[0] = 0;
Death_TextId[1] = 0;
Death_TextId[2] = 0;
Death_Sound[0] = 0;
Death_Sound[1] = 0;
Death_Sound[2] = 0;
Death_Spell = 0;
Death_Target_Type = 0;
Kill_TextId[0] = 0;
Kill_TextId[1] = 0;
Kill_TextId[2] = 0;
Kill_Sound[0] = 0;
Kill_Sound[1] = 0;
Kill_Sound[2] = 0;
Kill_Spell = 0;
Kill_Target_Type = 0;
memset(Spell, 0, sizeof(Spell));
EnterEvadeMode();
}
void SimpleAI::Reset()
{
}
void SimpleAI::EnterCombat(Unit* who)
{
//Reset cast timers
if (Spell[0].First_Cast >= 0)
Spell_Timer[0] = Spell[0].First_Cast;
else Spell_Timer[0] = 1000;
if (Spell[1].First_Cast >= 0)
Spell_Timer[1] = Spell[1].First_Cast;
else Spell_Timer[1] = 1000;
if (Spell[2].First_Cast >= 0)
Spell_Timer[2] = Spell[2].First_Cast;
else Spell_Timer[2] = 1000;
if (Spell[3].First_Cast >= 0)
Spell_Timer[3] = Spell[3].First_Cast;
else Spell_Timer[3] = 1000;
if (Spell[4].First_Cast >= 0)
Spell_Timer[4] = Spell[4].First_Cast;
else Spell_Timer[4] = 1000;
if (Spell[5].First_Cast >= 0)
Spell_Timer[5] = Spell[5].First_Cast;
else Spell_Timer[5] = 1000;
if (Spell[6].First_Cast >= 0)
Spell_Timer[6] = Spell[6].First_Cast;
else Spell_Timer[6] = 1000;
if (Spell[7].First_Cast >= 0)
Spell_Timer[7] = Spell[7].First_Cast;
else Spell_Timer[7] = 1000;
if (Spell[8].First_Cast >= 0)
Spell_Timer[8] = Spell[8].First_Cast;
else Spell_Timer[8] = 1000;
if (Spell[9].First_Cast >= 0)
Spell_Timer[9] = Spell[9].First_Cast;
else Spell_Timer[9] = 1000;
uint8 random_text = urand(0, 2);
//Random text
if (Aggro_TextId[random_text])
DoScriptText(Aggro_TextId[random_text], me, who);
//Random sound
if (Aggro_Sound[random_text])
DoPlaySoundToSet(me, Aggro_Sound[random_text]);
}
void SimpleAI::KilledUnit(Unit* victim)
{
uint8 random_text = urand(0, 2);
//Random yell
if (Kill_TextId[random_text])
DoScriptText(Kill_TextId[random_text], me, victim);
//Random sound
if (Kill_Sound[random_text])
DoPlaySoundToSet(me, Kill_Sound[random_text]);
if (!Kill_Spell)
return;
Unit* target = NULL;
switch (Kill_Target_Type)
{
case CAST_SELF:
target = me;
break;
case CAST_HOSTILE_TARGET:
target = me->getVictim();
break;
case CAST_HOSTILE_SECOND_AGGRO:
target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1);
break;
case CAST_HOSTILE_LAST_AGGRO:
target = SelectTarget(SELECT_TARGET_BOTTOMAGGRO, 0);
break;
case CAST_HOSTILE_RANDOM:
target = SelectTarget(SELECT_TARGET_RANDOM, 0);
break;
case CAST_KILLEDUNIT_VICTIM:
target = victim;
break;
}
//Target is ok, cast a spell on it
if (target)
DoCast(target, Kill_Spell);
}
void SimpleAI::DamageTaken(Unit* killer, uint32& damage)
{
//Return if damage taken won't kill us
if (me->GetHealth() > damage)
return;
uint8 random_text = urand(0, 2);
//Random yell
if (Death_TextId[random_text])
DoScriptText(Death_TextId[random_text], me, killer);
//Random sound
if (Death_Sound[random_text])
DoPlaySoundToSet(me, Death_Sound[random_text]);
if (!Death_Spell)
return;
Unit* target = NULL;
switch (Death_Target_Type)
{
case CAST_SELF:
target = me;
break;
case CAST_HOSTILE_TARGET:
target = me->getVictim();
break;
case CAST_HOSTILE_SECOND_AGGRO:
target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1);
break;
case CAST_HOSTILE_LAST_AGGRO:
target = SelectTarget(SELECT_TARGET_BOTTOMAGGRO, 0);
break;
case CAST_HOSTILE_RANDOM:
target = SelectTarget(SELECT_TARGET_RANDOM, 0);
break;
case CAST_JUSTDIED_KILLER:
target = killer;
break;
}
//Target is ok, cast a spell on it
if (target)
DoCast(target, Death_Spell);
}
void SimpleAI::UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
//Spells
for (uint32 i = 0; i < MAX_SIMPLEAI_SPELLS; ++i)
{
//Spell not valid
if (!Spell[i].Enabled || !Spell[i].Spell_Id)
continue;
if (Spell_Timer[i] <= diff)
{
//Check if this is a percentage based
if (Spell[i].First_Cast < 0 && Spell[i].First_Cast > -100 && HealthAbovePct(uint32(-Spell[i].First_Cast)))
continue;
//Check Current spell
if (!(Spell[i].InterruptPreviousCast && me->IsNonMeleeSpellCasted(false)))
{
Unit* target = NULL;
switch (Spell[i].Cast_Target_Type)
{
case CAST_SELF:
target = me;
break;
case CAST_HOSTILE_TARGET:
target = me->getVictim();
break;
case CAST_HOSTILE_SECOND_AGGRO:
target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1);
break;
case CAST_HOSTILE_LAST_AGGRO:
target = SelectTarget(SELECT_TARGET_BOTTOMAGGRO, 0);
break;
case CAST_HOSTILE_RANDOM:
target = SelectTarget(SELECT_TARGET_RANDOM, 0);
break;
}
//Target is ok, cast a spell on it and then do our random yell
if (target)
{
if (me->IsNonMeleeSpellCasted(false))
me->InterruptNonMeleeSpells(false);
DoCast(target, Spell[i].Spell_Id);
//Yell and sound use the same number so that you can make
//the Creature yell with the correct sound effect attached
uint8 random_text = urand(0, 2);
//Random yell
if (Spell[i].TextId[random_text])
DoScriptText(Spell[i].TextId[random_text], me, target);
//Random sound
if (Spell[i].Text_Sound[random_text])
DoPlaySoundToSet(me, Spell[i].Text_Sound[random_text]);
}
}
//Spell will cast agian when the cooldown is up
if (Spell[i].CooldownRandomAddition)
Spell_Timer[i] = Spell[i].Cooldown + (rand() % Spell[i].CooldownRandomAddition);
else Spell_Timer[i] = Spell[i].Cooldown;
} else Spell_Timer[i] -= diff;
}
DoMeleeAttackIfReady();
}
@@ -1,73 +0,0 @@
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
#ifndef SC_SIMPLEAI_H
#define SC_SIMPLEAI_H
enum CastTarget
{
CAST_SELF = 0, //Self cast
CAST_HOSTILE_TARGET, //Our current target (ie: highest aggro)
CAST_HOSTILE_SECOND_AGGRO, //Second highest aggro (generaly used for cleaves and some special attacks)
CAST_HOSTILE_LAST_AGGRO, //Dead last on aggro (no idea what this could be used for)
CAST_HOSTILE_RANDOM, //Just any random target on our threat list
CAST_FRIENDLY_RANDOM, //NOT YET IMPLEMENTED
//Special cases
CAST_KILLEDUNIT_VICTIM, //Only works within KilledUnit function
CAST_JUSTDIED_KILLER, //Only works within JustDied function
};
#define MAX_SIMPLEAI_SPELLS 10
struct SimpleAI : public ScriptedAI
{
SimpleAI(Creature* c);// : ScriptedAI(c);
void Reset();
void EnterCombat(Unit* /*who*/);
void KilledUnit(Unit* /*victim*/);
void DamageTaken(Unit* killer, uint32& damage);
void UpdateAI(const uint32 diff);
public:
int32 Aggro_TextId[3];
uint32 Aggro_Sound[3];
int32 Death_TextId[3];
uint32 Death_Sound[3];
uint32 Death_Spell;
uint32 Death_Target_Type;
int32 Kill_TextId[3];
uint32 Kill_Sound[3];
uint32 Kill_Spell;
uint32 Kill_Target_Type;
struct SimpleAI_Spell
{
uint32 Spell_Id; //Spell ID to cast
int32 First_Cast; //Delay for first cast
uint32 Cooldown; //Cooldown between casts
uint32 CooldownRandomAddition; //Random addition to cooldown (in range from 0 - CooldownRandomAddition)
uint32 Cast_Target_Type; //Target type (note that certain spells may ignore this)
bool InterruptPreviousCast; //Interrupt a previous cast if this spell needs to be cast
bool Enabled; //Spell enabled or disabled (default: false)
//3 texts to many?
int32 TextId[3];
uint32 Text_Sound[3];
}Spell[MAX_SIMPLEAI_SPELLS];
protected:
uint32 Spell_Timer[MAX_SIMPLEAI_SPELLS];
};
#endif
@@ -151,7 +151,6 @@ void AddSC_boss_sulfuron();
void AddSC_boss_majordomo();
void AddSC_boss_ragnaros();
void AddSC_instance_molten_core();
void AddSC_molten_core();
void AddSC_the_scarlet_enclave(); //Scarlet Enclave
void AddSC_the_scarlet_enclave_c1();
void AddSC_the_scarlet_enclave_c2();
@@ -761,7 +760,6 @@ void AddEasternKingdomsScripts()
AddSC_boss_majordomo();
AddSC_boss_ragnaros();
AddSC_instance_molten_core();
AddSC_molten_core();
AddSC_the_scarlet_enclave(); //Scarlet Enclave
AddSC_the_scarlet_enclave_c1();
AddSC_the_scarlet_enclave_c2();
-1
View File
@@ -34,7 +34,6 @@ set(scripts_STAT_SRCS
../game/AI/ScriptedAI/ScriptedEscortAI.cpp
../game/AI/ScriptedAI/ScriptedCreature.cpp
../game/AI/ScriptedAI/ScriptedFollowerAI.cpp
../game/AI/ScriptedAI/ScriptedSimpleAI.cpp
)
if(SCRIPTS)
@@ -84,7 +84,6 @@ set(scripts_STAT_SRCS
EasternKingdoms/MoltenCore/instance_molten_core.cpp
EasternKingdoms/MoltenCore/boss_sulfuron_harbinger.cpp
EasternKingdoms/MoltenCore/boss_magmadar.cpp
EasternKingdoms/MoltenCore/molten_core.cpp
EasternKingdoms/MoltenCore/boss_shazzrah.cpp
EasternKingdoms/Stratholme/boss_baroness_anastari.cpp
EasternKingdoms/Stratholme/boss_nerubenkan.cpp
@@ -24,7 +24,6 @@ SDCategory: Karazhan
EndScriptData */
#include "ScriptPCH.h"
#include "ScriptedSimpleAI.h"
#include "karazhan.h"
#include "GameObject.h"
@@ -549,33 +548,8 @@ public:
};
// CONVERT TO ACID
class mob_shadow_of_aran : public CreatureScript
{
public:
mob_shadow_of_aran() : CreatureScript("mob_shadow_of_aran") { }
CreatureAI* GetAI(Creature* creature) const
{
sLog->outString("TSCR: Convert simpleAI script for Creature Entry %u to ACID", creature->GetEntry());
SimpleAI* ai = new SimpleAI (creature);
ai->Spell[0].Enabled = true;
ai->Spell[0].Spell_Id = SPELL_SHADOW_PYRO;
ai->Spell[0].Cooldown = 5000;
ai->Spell[0].First_Cast = 1000;
ai->Spell[0].Cast_Target_Type = CAST_HOSTILE_TARGET;
ai->EnterEvadeMode();
return ai;
}
};
void AddSC_boss_shade_of_aran()
{
new boss_shade_of_aran();
new mob_shadow_of_aran();
new mob_aran_elemental();
}
@@ -1,86 +0,0 @@
/*
* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* ScriptData
SDName: Molten_Core
SD%Complete: 100
SDComment:
SDCategory: Molten Core
EndScriptData */
/* ContentData
mob_ancient_core_hound
EndContentData */
#include "ScriptPCH.h"
#include "ScriptedSimpleAI.h"
enum Spells
{
SPELL_CONE_OF_FIRE = 19630,
SPELL_BITE = 19771,
//Random Debuff (each hound has only one of these)
SPELL_GROUND_STOMP = 19364,
SPELL_ANCIENT_DREAD = 19365,
SPELL_CAUTERIZING_FLAMES = 19366,
SPELL_WITHERING_HEAT = 19367,
SPELL_ANCIENT_DESPAIR = 19369,
SPELL_ANCIENT_HYSTERIA = 19372
};
class mob_ancient_core_hound : public CreatureScript
{
public:
mob_ancient_core_hound() : CreatureScript("mob_ancient_core_hound") { }
CreatureAI* GetAI(Creature* creature) const
{
SimpleAI* ai = new SimpleAI(creature);
ai->Spell[0].Enabled = true;
ai->Spell[0].Spell_Id = SPELL_CONE_OF_FIRE;
ai->Spell[0].Cooldown = 7000;
ai->Spell[0].First_Cast = 10000;
ai->Spell[0].Cast_Target_Type = CAST_HOSTILE_TARGET;
uint32 RandDebuff = RAND(SPELL_GROUND_STOMP, SPELL_ANCIENT_DREAD, SPELL_CAUTERIZING_FLAMES,
SPELL_WITHERING_HEAT, SPELL_ANCIENT_DESPAIR, SPELL_ANCIENT_HYSTERIA);
ai->Spell[1].Enabled = true;
ai->Spell[1].Spell_Id = RandDebuff;
ai->Spell[1].Cooldown = 24000;
ai->Spell[1].First_Cast = 15000;
ai->Spell[1].Cast_Target_Type = CAST_HOSTILE_TARGET;
ai->Spell[2].Enabled = true;
ai->Spell[2].Spell_Id = SPELL_BITE;
ai->Spell[2].Cooldown = 6000;
ai->Spell[2].First_Cast = 4000;
ai->Spell[2].Cast_Target_Type = CAST_HOSTILE_TARGET;
ai->EnterEvadeMode();
return ai;
}
};
void AddSC_molten_core()
{
new mob_ancient_core_hound();
}
File diff suppressed because it is too large Load Diff
@@ -25,7 +25,6 @@ EndScriptData */
#include "ScriptPCH.h"
#include "serpent_shrine.h"
#include "ScriptedSimpleAI.h"
#include "Spell.h"
#define SPELL_SPOUT 37433
@@ -55,15 +54,16 @@ EndScriptData */
float AddPos[9][3] =
{
{2.8553810f, -459.823914f, -19.182686f}, //MOVE_AMBUSHER_1 X, Y, Z
{12.400000f, -466.042267f, -19.182686f}, //MOVE_AMBUSHER_2 X, Y, Z
{51.366653f, -460.836060f, -19.182686f}, //MOVE_AMBUSHER_3 X, Y, Z
{62.597980f, -457.433044f, -19.182686f}, //MOVE_AMBUSHER_4 X, Y, Z
{77.607452f, -384.302765f, -19.182686f}, //MOVE_AMBUSHER_5 X, Y, Z
{63.897900f, -378.984924f, -19.182686f}, //MOVE_AMBUSHER_6 X, Y, Z
{34.447250f, -387.333618f, -19.182686f}, //MOVE_GUARDIAN_1 X, Y, Z
{14.388216f, -423.468018f, -19.625271f}, //MOVE_GUARDIAN_2 X, Y, Z
{42.471519f, -445.115295f, -19.769423f} //MOVE_GUARDIAN_3 X, Y, Z
// MOVE_AMBUSHER_1 X, Y, Z
{2.8553810f, -459.823914f, -19.182686f},
{12.400000f, -466.042267f, -19.182686f},
{51.366653f, -460.836060f, -19.182686f},
{62.597980f, -457.433044f, -19.182686f},
{77.607452f, -384.302765f, -19.182686f},
{63.897900f, -378.984924f, -19.182686f},
{34.447250f, -387.333618f, -19.182686f},
{14.388216f, -423.468018f, -19.625271f},
{42.471519f, -445.115295f, -19.769423f}
};
class boss_the_lurker_below : public CreatureScript
@@ -80,10 +80,10 @@ public:
{
boss_the_lurker_belowAI(Creature* c) : Scripted_NoMovementAI(c), Summons(me)
{
instance = c->GetInstanceScript();
Instance = c->GetInstanceScript();
}
InstanceScript* instance;
InstanceScript* Instance;
SummonList Summons;
bool Spawned;
@@ -103,7 +103,7 @@ public:
bool CheckCanStart()//check if players fished
{
if (instance && instance->GetData(DATA_STRANGE_POOL) == NOT_STARTED)
if (Instance && Instance->GetData(DATA_STRANGE_POOL) == NOT_STARTED)
return false;
return true;
}
@@ -112,39 +112,39 @@ public:
me->AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_LEVITATING);
SpoutAnimTimer = 1000;
RotTimer = 0;
WaterboltTimer = 15000;//give time to get in range when fight starts
WaterboltTimer = 15000; // give time to get in range when fight starts
SpoutTimer = 45000;
WhirlTimer = 18000;//after avery spout
WhirlTimer = 18000; // after avery spout
PhaseTimer = 120000;
GeyserTimer = rand()%5000 + 15000;
CheckTimer = 15000;//give time to get in range when fight starts
WaitTimer = 60000;//never reached
WaitTimer2 = 60000;//never reached
CheckTimer = 15000; // give time to get in range when fight starts
WaitTimer = 60000; // never reached
WaitTimer2 = 60000; // never reached
Submerged = true;//will be false at combat start
Submerged = true; // will be false at combat start
Spawned = false;
InRange = false;
CanStartEvent = false;
Summons.DespawnAll();
if (instance)
if (Instance)
{
instance->SetData(DATA_THELURKERBELOWEVENT, NOT_STARTED);
instance->SetData(DATA_STRANGE_POOL, NOT_STARTED);
Instance->SetData(DATA_THELURKERBELOWEVENT, NOT_STARTED);
Instance->SetData(DATA_STRANGE_POOL, NOT_STARTED);
}
DoCast(me, SPELL_SUBMERGE);//submerge anim
me->SetVisible(false);//we start invis under water, submerged
DoCast(me, SPELL_SUBMERGE); // submerge anim
me->SetVisible(false); // we start invis under water, submerged
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
}
void JustDied(Unit* /*Killer*/)
void JustDied(Unit* /*killer*/)
{
if (instance)
if (Instance)
{
instance->SetData(DATA_THELURKERBELOWEVENT, DONE);
instance->SetData(DATA_STRANGE_POOL, IN_PROGRESS);
Instance->SetData(DATA_THELURKERBELOWEVENT, DONE);
Instance->SetData(DATA_STRANGE_POOL, IN_PROGRESS);
}
Summons.DespawnAll();
@@ -152,22 +152,20 @@ public:
void EnterCombat(Unit* who)
{
if (instance)
instance->SetData(DATA_THELURKERBELOWEVENT, IN_PROGRESS);
if (Instance)
Instance->SetData(DATA_THELURKERBELOWEVENT, IN_PROGRESS);
Scripted_NoMovementAI::EnterCombat(who);
}
void MoveInLineOfSight(Unit* who)
{
if (!CanStartEvent)//boss is invisible, don't attack
if (!CanStartEvent) // boss is invisible, don't attack
return;
if (!me->getVictim() && who->IsValidAttackTarget(me))
{
float attackRadius = me->GetAttackDistance(who);
if (me->IsWithinDistInMap(who, attackRadius))
{
AttackStart(who);
}
}
}
@@ -179,7 +177,7 @@ public:
void UpdateAI(const uint32 diff)
{
if (!CanStartEvent)//boss is invisible, don't attack
if (!CanStartEvent) // boss is invisible, don't attack
{
if (CheckCanStart())
{
@@ -190,21 +188,21 @@ public:
WaitTimer2 = 500;
}
if (!Submerged && WaitTimer2 <= diff)//wait 500ms before emerge anim
if (!Submerged && WaitTimer2 <= diff) // wait 500ms before emerge anim
{
me->RemoveAllAuras();
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
DoCast(me, SPELL_EMERGE, false);
WaitTimer2 = 60000;//never reached
WaitTimer2 = 60000; // never reached
WaitTimer = 3000;
}
else
WaitTimer2 -= diff;
if (WaitTimer <= diff)//wait 3secs for emerge anim, then attack
if (WaitTimer <= diff) // wait 3secs for emerge anim, then attack
{
WaitTimer = 3000;
CanStartEvent = true;//fresh fished from pool
CanStartEvent = true; // fresh fished from pool
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
@@ -214,7 +212,7 @@ public:
return;
}
if (me->getThreatManager().getThreatList().empty())//check if should evade
if (me->getThreatManager().getThreatList().empty()) // check if should evade
{
if (me->isInCombat())
EnterEvadeMode();
@@ -226,7 +224,7 @@ public:
{
me->InterruptNonMeleeSpells(false);
DoCast(me, SPELL_SUBMERGE);
PhaseTimer = 60000;//60secs submerged
PhaseTimer = 60000; // 60secs submerged
Submerged = true;
} else PhaseTimer-=diff;
@@ -236,12 +234,12 @@ public:
me->SetReactState(REACT_PASSIVE);
me->GetMotionMaster()->MoveRotate(20000, urand(0, 1) ? ROTATE_DIRECTION_LEFT : ROTATE_DIRECTION_RIGHT);
SpoutTimer = 45000;
WhirlTimer = 20000;//whirl directly after spout
WhirlTimer = 20000; // whirl directly after spout
RotTimer = 20000;
return;
} else SpoutTimer -= diff;
//Whirl directly after a Spout and at random times
// Whirl directly after a Spout and at random times
if (WhirlTimer <= diff)
{
WhirlTimer = 18000;
@@ -273,7 +271,7 @@ public:
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
{
if (i->getSource() && i->getSource()->isAlive() && me->HasInArc(float(diff/20000*M_PI*2), i->getSource()) && me->IsWithinDist(i->getSource(), SPOUT_DIST) && !i->getSource()->IsInWater())
DoCast(i->getSource(), SPELL_SPOUT, true);//only knock back palyers in arc, in 100yards, not in water
DoCast(i->getSource(), SPELL_SPOUT, true); // only knock back players in arc, in 100yards, not in water
}
}
@@ -300,7 +298,7 @@ public:
GeyserTimer = rand()%5000 + 15000;
} else GeyserTimer -= diff;
if (!InRange)//if on players in melee range cast Waterbolt
if (!InRange) // if on players in melee range cast Waterbolt
{
if (WaterboltTimer <= diff)
{
@@ -318,12 +316,13 @@ public:
DoMeleeAttackIfReady();
}else//submerged
}
else // submerged
{
if (PhaseTimer <= diff)
{
Submerged = false;
me->InterruptNonMeleeSpells(false);//shouldn't be any
me->InterruptNonMeleeSpells(false); // shouldn't be any
me->RemoveAllAuras();
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
me->RemoveFlag(UNIT_NPC_EMOTESTATE, EMOTE_STATE_SUBMERGED);
@@ -334,28 +333,22 @@ public:
return;
} else PhaseTimer-=diff;
if (me->getThreatManager().getThreatList().empty())//check if should evade
if (me->getThreatManager().getThreatList().empty()) // check if should evade
{
EnterEvadeMode();
return;
}
if (!me->isInCombat())
DoZoneInCombat();
if (!Spawned)
{
me->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
//spawn adds
// spawn adds
for (uint8 i = 0; i < 9; ++i)
{
Creature* Summoned;
if (i < 6)
Summoned = me->SummonCreature(MOB_COILFANG_AMBUSHER, AddPos[i][0], AddPos[i][1], AddPos[i][2], 0, TEMPSUMMON_CORPSE_DESPAWN, 0);
else Summoned = me->SummonCreature(MOB_COILFANG_GUARDIAN, AddPos[i][0], AddPos[i][1], AddPos[i][2], 0, TEMPSUMMON_CORPSE_DESPAWN, 0);
if (Summoned)
Summons.Summon(Summoned);
}
if (Creature* summoned = me->SummonCreature(i < 6 ? MOB_COILFANG_AMBUSHER : MOB_COILFANG_GUARDIAN, AddPos[i][0], AddPos[i][1], AddPos[i][2], 0, TEMPSUMMON_CORPSE_DESPAWN, 0))
Summons.Summon(summoned);
Spawned = true;
}
}
@@ -363,32 +356,6 @@ public:
};
};
class mob_coilfang_guardian : public CreatureScript
{
public:
mob_coilfang_guardian() : CreatureScript("mob_coilfang_guardian") { }
CreatureAI* GetAI(Creature* creature) const
{
SimpleAI* ai = new SimpleAI (creature);
ai->Spell[0].Enabled = true;
ai->Spell[0].Spell_Id = SPELL_ARCINGSMASH;
ai->Spell[0].Cooldown = 15000;
ai->Spell[0].First_Cast = 5000;
ai->Spell[0].Cast_Target_Type = CAST_HOSTILE_TARGET;
ai->Spell[1].Enabled = true;
ai->Spell[1].Spell_Id = SPELL_HAMSTRING;
ai->Spell[1].Cooldown = 10000;
ai->Spell[1].First_Cast = 2000;
ai->Spell[1].Cast_Target_Type = CAST_HOSTILE_TARGET;
return ai;
}
};
class mob_coilfang_ambusher : public CreatureScript
{
public:
@@ -412,12 +379,6 @@ public:
{
MultiShotTimer = 10000;
ShootBowTimer = 4000;
}
void EnterCombat(Unit* /*who*/)
{
}
void MoveInLineOfSight(Unit* who)
@@ -438,18 +399,16 @@ public:
DoCast(me->getVictim(), SPELL_SPREAD_SHOT, true);
MultiShotTimer = 10000+rand()%10000;
ShootBowTimer += 1500;//add global cooldown
ShootBowTimer += 1500; // add global cooldown
} else MultiShotTimer -= diff;
if (ShootBowTimer <= diff)
{
Unit* target = NULL;
target = SelectTarget(SELECT_TARGET_RANDOM, 0);
int bp0 = 1100;
if (target)
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
me->CastCustomSpell(target, SPELL_SHOOT, &bp0, NULL, NULL, true);
ShootBowTimer = 4000+rand()%5000;
MultiShotTimer += 1500;//add global cooldown
MultiShotTimer += 1500; // add global cooldown
} else ShootBowTimer -= diff;
}
};
@@ -482,7 +441,6 @@ class go_strange_pool : public GameObjectScript
void AddSC_boss_the_lurker_below()
{
new boss_the_lurker_below();
new mob_coilfang_guardian();
new mob_coilfang_ambusher();
new go_strange_pool();
}