Implement generic script loaders to greatly reduce code duplication

This commit is contained in:
hondacrx
2017-07-20 19:43:24 -04:00
parent 19220d29d9
commit 2db988576a
89 changed files with 28255 additions and 36473 deletions
+22 -4
View File
@@ -1585,17 +1585,16 @@ namespace Game
foreach (var script in spellScriptsStorage.ToList()) foreach (var script in spellScriptsStorage.ToList())
{ {
SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(script.Key); SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(script.Key);
Dictionary<SpellScriptLoader, uint> SpellScriptLoaders = Global.ScriptMgr.CreateSpellScriptLoaders(script.Key);
Dictionary<SpellScriptLoader, uint> SpellScriptLoaders = Global.ScriptMgr.CreateSpellScriptLoaders(script.Key);
foreach (var pair in SpellScriptLoaders) foreach (var pair in SpellScriptLoaders)
{ {
SpellScript spellScript = pair.Key.GetSpellScript(); SpellScript spellScript = pair.Key.GetSpellScript();
AuraScript auraScript = pair.Key.GetAuraScript();
bool valid = true; bool valid = true;
if (spellScript == null && auraScript == null) if (spellScript == null)
{ {
Log.outError(LogFilter.Scripts, "Functions GetSpellScript() and GetAuraScript() of script `{0}` do not return objects - script skipped", GetScriptName(pair.Value)); Log.outError(LogFilter.Scripts, "Functions GetSpellScript() of script `{0}` do not return object - script skipped", GetScriptName(pair.Value));
valid = false; valid = false;
} }
@@ -1607,6 +1606,22 @@ namespace Game
valid = false; valid = false;
} }
if (!valid)
spellScriptsStorage.Remove(pair.Value);
}
Dictionary<AuraScriptLoader, uint> AuraScriptLoaders = Global.ScriptMgr.CreateAuraScriptLoaders(script.Key);
foreach (var pair in AuraScriptLoaders)
{
AuraScript auraScript = pair.Key.GetAuraScript();
bool valid = true;
if (auraScript == null)
{
Log.outError(LogFilter.Scripts, "Functions GetAuraScript() of script `{0}` do not return object - script skipped", GetScriptName(pair.Value));
valid = false;
}
if (auraScript != null) if (auraScript != null)
{ {
auraScript._Init(pair.Key.GetName(), spellEntry.Id); auraScript._Init(pair.Key.GetName(), spellEntry.Id);
@@ -1639,6 +1654,9 @@ namespace Game
if (string.IsNullOrEmpty(name)) if (string.IsNullOrEmpty(name))
return 0; return 0;
if (!scriptNamesStorage.Contains(name))
return 0;
return (uint)scriptNamesStorage.IndexOf(name); return (uint)scriptNamesStorage.IndexOf(name);
} }
public uint GetAreaTriggerScriptId(uint triggerid) public uint GetAreaTriggerScriptId(uint triggerid)
+57 -4
View File
@@ -49,11 +49,12 @@ namespace Game.Scripting
{ {
InstanceMap instance = obj.GetMap().ToInstanceMap(); InstanceMap instance = obj.GetMap().ToInstanceMap();
if (instance != null && instance.GetInstanceScript() != null) if (instance != null && instance.GetInstanceScript() != null)
if (instance.GetScriptId() == Global.ObjectMgr.GetScriptId(scriptName)) if (instance.GetScriptName() == scriptName)
return (T)Activator.CreateInstance(typeof(T), new object[] { obj }); return (T)Activator.CreateInstance(typeof(T), new object[] { obj });
return null; return null;
} }
public static T GetInstanceAI<T>(WorldObject obj) where T : class public static T GetInstanceAI<T>(WorldObject obj) where T : class
{ {
InstanceMap instance = obj.GetMap().ToInstanceMap(); InstanceMap instance = obj.GetMap().ToInstanceMap();
@@ -66,23 +67,57 @@ namespace Game.Scripting
string _name; string _name;
} }
class GenericSpellScriptLoader<S> : SpellScriptLoader where S : SpellScript
{
public GenericSpellScriptLoader(string name, object[] args) : base(name)
{
_args = args;
}
public override SpellScript GetSpellScript() { return (S)Activator.CreateInstance(typeof(S), _args); }
object[] _args;
}
class GenericAuraScriptLoader<A> : AuraScriptLoader where A : AuraScript
{
public GenericAuraScriptLoader(string name, object[] args) : base(name)
{
_args = args;
}
public override AuraScript GetAuraScript() { return (A)Activator.CreateInstance(typeof(A), _args); }
object[] _args;
}
public class SpellScriptLoader : ScriptObject public class SpellScriptLoader : ScriptObject
{ {
public SpellScriptLoader(string name) : base(name) public SpellScriptLoader(string name) : base(name)
{ {
Global.ScriptMgr.AddScript(this); Global.ScriptMgr.AddScript<SpellScriptLoader>(this);
} }
public override bool IsDatabaseBound() { return true; } public override bool IsDatabaseBound() { return true; }
// Should return a fully valid SpellScript. // Should return a fully valid SpellScript.
public virtual SpellScript GetSpellScript() { return null; } public virtual SpellScript GetSpellScript() { return null; }
}
public class AuraScriptLoader : ScriptObject
{
public AuraScriptLoader(string name) : base(name)
{
Global.ScriptMgr.AddScript<AuraScriptLoader>(this);
}
public override bool IsDatabaseBound() { return true; }
// Should return a fully valid AuraScript. // Should return a fully valid AuraScript.
public virtual AuraScript GetAuraScript() { return null; } public virtual AuraScript GetAuraScript() { return null; }
} }
class WorldScript : ScriptObject public class WorldScript : ScriptObject
{ {
protected WorldScript(string name) : base(name) protected WorldScript(string name) : base(name)
{ {
@@ -258,11 +293,29 @@ namespace Game.Scripting
public virtual void ModifySpellDamageTaken(Unit target, Unit attacker, ref int damage) { } public virtual void ModifySpellDamageTaken(Unit target, Unit attacker, ref int damage) { }
} }
public class GenericCreatureScript<AI> : CreatureScript where AI : CreatureAI
{
public GenericCreatureScript(string name, object[] args) : base(name)
{
_args = args;
}
public override CreatureAI GetAI(Creature me)
{
if (me.GetInstanceScript() != null)
return GetInstanceAI<AI>(me);
else
return (AI)Activator.CreateInstance(typeof(AI), me, _args);
}
object[] _args;
}
public class CreatureScript : UnitScript public class CreatureScript : UnitScript
{ {
public CreatureScript(string name) : base(name, false) public CreatureScript(string name) : base(name, false)
{ {
Global.ScriptMgr.AddScript(this); Global.ScriptMgr.AddScript<CreatureScript>(this);
} }
public override bool IsDatabaseBound() { return true; } public override bool IsDatabaseBound() { return true; }
+83 -9
View File
@@ -54,7 +54,7 @@ namespace Game.Scripting
Log.outInfo(LogFilter.ServerLoading, "Loading C# scripts"); Log.outInfo(LogFilter.ServerLoading, "Loading C# scripts");
FillSpellSummary(); //FillSpellSummary();
if (LoadScripts()) if (LoadScripts())
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} C# scripts in {1} ms", GetScriptCount(), Time.GetMSTimeDiffToNow(oldMSTime)); Log.outInfo(LogFilter.ServerLoading, "Loaded {0} C# scripts in {1} ms", GetScriptCount(), Time.GetMSTimeDiffToNow(oldMSTime));
@@ -103,12 +103,62 @@ namespace Game.Scripting
foreach (var attribute in attributes) foreach (var attribute in attributes)
{ {
if (!constructors.Any(p => p.GetParameters().Length == attribute.Args.Length)) var genericType = type;
string name = type.Name;
switch (type.BaseType.Name)
{ {
Log.outError(LogFilter.Scripts, "Type: {0} has ScriptAttribute that does not match paramter count: {1} Can't load script.", type.Name, attribute.Args.Length); case "SpellScript":
continue; genericType = typeof(GenericSpellScriptLoader<>).MakeGenericType(type);
name = name.Replace("_SpellScript", "");
break;
case "AuraScript":
genericType = typeof(GenericAuraScriptLoader<>).MakeGenericType(type);
name = name.Replace("_AuraScript", "");
break;
case "SpellScriptLoader":
case "AuraScriptLoader":
case "WorldScript":
case "FormulaScript":
case "WorldMapScript":
case "InstanceMapScript":
case "BattlegroundMapScript":
case "ItemScript":
case "UnitScript":
case "CreatureScript":
case "GameObjectScript":
case "AreaTriggerScript":
case "OutdoorPvPScript":
case "WeatherScript":
case "AuctionHouseScript":
case "ConditionScript":
case "VehicleScript":
case "DynamicObjectScript":
case "TransportScript":
case "AchievementCriteriaScript":
case "PlayerScript":
case "GuildScript":
case "GroupScript":
case "AreaTriggerEntityScript":
case "SceneScript":
if (!attribute.Name.IsEmpty())
name = attribute.Name;
if (attribute.Args.Empty())
Activator.CreateInstance(genericType);
else
Activator.CreateInstance(genericType, new object[] { name }.Combine(attribute.Args));
continue;
default:
genericType = typeof(GenericCreatureScript<>).MakeGenericType(type);
break;
} }
Activator.CreateInstance(type, attribute.Args);
if (!attribute.Name.IsEmpty())
name = attribute.Name;
Activator.CreateInstance(genericType, name, attribute.Args);
} }
} }
} }
@@ -389,7 +439,7 @@ namespace Game.Scripting
var scriptList = new List<AuraScript>(); var scriptList = new List<AuraScript>();
var bounds = Global.ObjectMgr.GetSpellScriptsBounds(spellId); var bounds = Global.ObjectMgr.GetSpellScriptsBounds(spellId);
var reg = GetScriptRegistry<SpellScriptLoader>(); var reg = GetScriptRegistry<AuraScriptLoader>();
if (reg == null) if (reg == null)
return scriptList; return scriptList;
@@ -432,6 +482,26 @@ namespace Game.Scripting
return scriptDic; return scriptDic;
} }
public Dictionary<AuraScriptLoader, uint> CreateAuraScriptLoaders(uint spellId)
{
var scriptDic = new Dictionary<AuraScriptLoader, uint>();
var bounds = Global.ObjectMgr.GetSpellScriptsBounds(spellId);
var reg = GetScriptRegistry<AuraScriptLoader>();
if (reg == null)
return scriptDic;
foreach (var id in bounds)
{
var tmpscript = reg.GetScriptById(id);
if (tmpscript == null)
continue;
scriptDic.Add(tmpscript, id);
}
return scriptDic;
}
//WorldScript //WorldScript
public void OnOpenStateChange(bool open) public void OnOpenStateChange(bool open)
@@ -1299,7 +1369,7 @@ namespace Game.Scripting
return m_mPointMoveMap.LookupByKey(creatureEntry); return m_mPointMoveMap.LookupByKey(creatureEntry);
} }
ScriptRegistry<T> GetScriptRegistry<T>() where T : ScriptObject public ScriptRegistry<T> GetScriptRegistry<T>() where T : ScriptObject
{ {
if (ScriptStorage.ContainsKey(typeof(T))) if (ScriptStorage.ContainsKey(typeof(T)))
return (ScriptRegistry<T>)ScriptStorage[typeof(T)]; return (ScriptRegistry<T>)ScriptStorage[typeof(T)];
@@ -1313,7 +1383,7 @@ namespace Game.Scripting
MultiMap<uint, ScriptPointMove> m_mPointMoveMap = new MultiMap<uint, ScriptPointMove>(); MultiMap<uint, ScriptPointMove> m_mPointMoveMap = new MultiMap<uint, ScriptPointMove>();
// creature entry + chain ID // creature entry + chain ID
MultiMap<Tuple<uint, ushort>, SplineChainLink> m_mSplineChainsMap = new MultiMap<Tuple<uint, ushort>, SplineChainLink>(); // spline chains MultiMap<Tuple<uint, ushort>, SplineChainLink> m_mSplineChainsMap = new MultiMap<Tuple<uint, ushort>, SplineChainLink>(); // spline chains
} }
@@ -1415,11 +1485,15 @@ namespace Game.Scripting
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
public class ScriptAttribute : Attribute public class ScriptAttribute : Attribute
{ {
public ScriptAttribute(params object[] args) //public ScriptAttribute() { }
public ScriptAttribute(string name="", params object[] args)
{ {
Name = name;
Args = args; Args = args;
} }
public string Name { get; private set; }
public object[] Args { get; private set; } public object[] Args { get; private set; }
} }
} }
+173 -194
View File
@@ -25,129 +25,124 @@ using Game.Scripting;
namespace Scripts.EasternKingdoms namespace Scripts.EasternKingdoms
{ {
[Script] [Script]
class npc_apprentice_mirveda : CreatureScript class npc_apprentice_mirveda : ScriptedAI
{ {
public npc_apprentice_mirveda() : base("npc_apprentice_mirveda") { } public npc_apprentice_mirveda(Creature creature)
: base(creature)
class npc_apprentice_mirvedaAI : ScriptedAI
{ {
public npc_apprentice_mirvedaAI(Creature creature) Summons = new SummonList(me);
: base(creature)
{
Summons = new SummonList(me);
}
public override void Reset()
{
SetCombatMovement(false);
KillCount = 0;
PlayerGUID.Clear();
Summons.DespawnAll();
}
public override void sQuestReward(Player player, Quest quest, uint opt)
{
if (quest.Id == QUEST_CORRUPTED_SOIL)
{
me.RemoveFlag64(UnitFields.NpcFlags, NPCFlags.QuestGiver);
_events.ScheduleEvent(EventTalk, 2000);
}
}
public override void sQuestAccept(Player player, Quest quest)
{
if (quest.Id == QUEST_UNEXPECTED_RESULT)
{
me.SetFaction(FactionCombat);
me.RemoveFlag64(UnitFields.NpcFlags, NPCFlags.QuestGiver);
_events.ScheduleEvent(EventSummon, 1000);
PlayerGUID = player.GetGUID();
}
}
public override void EnterCombat(Unit who)
{
_events.ScheduleEvent(EventFireball, 1000);
}
public override void JustSummoned(Creature summoned)
{
// This is the best I can do because AttackStart does nothing
summoned.GetMotionMaster().MovePoint(1, me.GetPositionX(), me.GetPositionY(), me.GetPositionZ());
// summoned.AI().AttackStart(me);
Summons.Summon(summoned);
}
public override void SummonedCreatureDies(Creature summoned, Unit who)
{
Summons.Despawn(summoned);
++KillCount;
}
public override void JustDied(Unit killer)
{
me.SetFaction(FactionNormal);
if (!PlayerGUID.IsEmpty())
{
Player player = Global.ObjAccessor.GetPlayer(me, PlayerGUID);
if (player)
player.FailQuest(QUEST_UNEXPECTED_RESULT);
}
}
public override void UpdateAI(uint diff)
{
if (KillCount >= 3 && !PlayerGUID.IsEmpty())
{
Player player = Global.ObjAccessor.GetPlayer(me, PlayerGUID);
if (player)
{
if (player.GetQuestStatus(QUEST_UNEXPECTED_RESULT) == QuestStatus.Incomplete)
{
player.CompleteQuest(QUEST_UNEXPECTED_RESULT);
me.SetFaction(FactionNormal);
me.SetFlag64(UnitFields.NpcFlags, NPCFlags.QuestGiver);
}
}
}
_events.Update(diff);
_events.ExecuteEvents(eventId =>
{
switch (eventId)
{
case EventTalk:
Talk(SayTestSoil);
_events.ScheduleEvent(EventAddQuestGiverFlag, 7000);
break;
case EventAddQuestGiverFlag:
me.SetFlag64(UnitFields.NpcFlags, NPCFlags.QuestGiver);
break;
case EventSummon:
me.SummonCreature(NPC_GHARZUL, 8749.505f, -7132.595f, 35.31983f, 3.816502f, TempSummonType.CorpseTimedDespawn, 180000);
me.SummonCreature(NPC_ANGERSHADE, 8755.38f, -7131.521f, 35.30957f, 3.816502f, TempSummonType.CorpseTimedDespawn, 180000);
me.SummonCreature(NPC_ANGERSHADE, 8753.199f, -7125.975f, 35.31986f, 3.816502f, TempSummonType.CorpseTimedDespawn, 180000);
break;
case EventFireball:
if (UpdateVictim())
{
DoCastVictim(SpellFireball, true); // Not casting in combat
_events.ScheduleEvent(EventFireball, 3000);
}
break;
default:
break;
}
});
DoMeleeAttackIfReady();
}
uint KillCount;
ObjectGuid PlayerGUID;
SummonList Summons;
} }
public override void Reset()
{
SetCombatMovement(false);
KillCount = 0;
PlayerGUID.Clear();
Summons.DespawnAll();
}
public override void sQuestReward(Player player, Quest quest, uint opt)
{
if (quest.Id == QUEST_CORRUPTED_SOIL)
{
me.RemoveFlag64(UnitFields.NpcFlags, NPCFlags.QuestGiver);
_events.ScheduleEvent(EventTalk, 2000);
}
}
public override void sQuestAccept(Player player, Quest quest)
{
if (quest.Id == QUEST_UNEXPECTED_RESULT)
{
me.SetFaction(FactionCombat);
me.RemoveFlag64(UnitFields.NpcFlags, NPCFlags.QuestGiver);
_events.ScheduleEvent(EventSummon, 1000);
PlayerGUID = player.GetGUID();
}
}
public override void EnterCombat(Unit who)
{
_events.ScheduleEvent(EventFireball, 1000);
}
public override void JustSummoned(Creature summoned)
{
// This is the best I can do because AttackStart does nothing
summoned.GetMotionMaster().MovePoint(1, me.GetPositionX(), me.GetPositionY(), me.GetPositionZ());
// summoned.AI().AttackStart(me);
Summons.Summon(summoned);
}
public override void SummonedCreatureDies(Creature summoned, Unit who)
{
Summons.Despawn(summoned);
++KillCount;
}
public override void JustDied(Unit killer)
{
me.SetFaction(FactionNormal);
if (!PlayerGUID.IsEmpty())
{
Player player = Global.ObjAccessor.GetPlayer(me, PlayerGUID);
if (player)
player.FailQuest(QUEST_UNEXPECTED_RESULT);
}
}
public override void UpdateAI(uint diff)
{
if (KillCount >= 3 && !PlayerGUID.IsEmpty())
{
Player player = Global.ObjAccessor.GetPlayer(me, PlayerGUID);
if (player)
{
if (player.GetQuestStatus(QUEST_UNEXPECTED_RESULT) == QuestStatus.Incomplete)
{
player.CompleteQuest(QUEST_UNEXPECTED_RESULT);
me.SetFaction(FactionNormal);
me.SetFlag64(UnitFields.NpcFlags, NPCFlags.QuestGiver);
}
}
}
_events.Update(diff);
_events.ExecuteEvents(eventId =>
{
switch (eventId)
{
case EventTalk:
Talk(SayTestSoil);
_events.ScheduleEvent(EventAddQuestGiverFlag, 7000);
break;
case EventAddQuestGiverFlag:
me.SetFlag64(UnitFields.NpcFlags, NPCFlags.QuestGiver);
break;
case EventSummon:
me.SummonCreature(NPC_GHARZUL, 8749.505f, -7132.595f, 35.31983f, 3.816502f, TempSummonType.CorpseTimedDespawn, 180000);
me.SummonCreature(NPC_ANGERSHADE, 8755.38f, -7131.521f, 35.30957f, 3.816502f, TempSummonType.CorpseTimedDespawn, 180000);
me.SummonCreature(NPC_ANGERSHADE, 8753.199f, -7125.975f, 35.31986f, 3.816502f, TempSummonType.CorpseTimedDespawn, 180000);
break;
case EventFireball:
if (UpdateVictim())
{
DoCastVictim(SpellFireball, true); // Not casting in combat
_events.ScheduleEvent(EventFireball, 3000);
}
break;
default:
break;
}
});
DoMeleeAttackIfReady();
}
uint KillCount;
ObjectGuid PlayerGUID;
SummonList Summons;
const uint EventTalk = 1; // Quest 8487 const uint EventTalk = 1; // Quest 8487
const uint EventAddQuestGiverFlag = 2; // Quest 8487 const uint EventAddQuestGiverFlag = 2; // Quest 8487
const uint EventSummon = 3; // Quest 8488 const uint EventSummon = 3; // Quest 8488
@@ -171,106 +166,90 @@ namespace Scripts.EasternKingdoms
// Quest // Quest
const uint QUEST_CORRUPTED_SOIL = 8487; const uint QUEST_CORRUPTED_SOIL = 8487;
const uint QUEST_UNEXPECTED_RESULT = 8488; const uint QUEST_UNEXPECTED_RESULT = 8488;
public override CreatureAI GetAI(Creature creature)
{
return new npc_apprentice_mirvedaAI(creature);
}
} }
[Script] [Script]
class npc_infused_crystal : CreatureScript class npc_infused_crystal : ScriptedAI
{ {
public npc_infused_crystal() : base("npc_infused_crystal") { } public npc_infused_crystal(Creature creature) : base(creature)
class npc_infused_crystalAI : ScriptedAI
{ {
public npc_infused_crystalAI(Creature creature) SetCombatMovement(false);
: base(creature) }
{
SetCombatMovement(false);
}
public override void Reset() public override void Reset()
{ {
EndTimer = 0; EndTimer = 0;
Completed = false; Completed = false;
Progress = false; Progress = false;
PlayerGUID.Clear(); PlayerGUID.Clear();
WaveTimer = 0; WaveTimer = 0;
} }
public override void MoveInLineOfSight(Unit who) public override void MoveInLineOfSight(Unit who)
{
if (!Progress && who.IsTypeId(TypeId.Player) && me.IsWithinDistInMap(who, 10.0f))
{ {
if (!Progress && who.IsTypeId(TypeId.Player) && me.IsWithinDistInMap(who, 10.0f)) if (who.ToPlayer().GetQuestStatus(QuestPoweringOurDefenses) == QuestStatus.Incomplete)
{ {
if (who.ToPlayer().GetQuestStatus(QuestPoweringOurDefenses) == QuestStatus.Incomplete) PlayerGUID = who.GetGUID();
{ WaveTimer = 1000;
PlayerGUID = who.GetGUID(); EndTimer = 60000;
WaveTimer = 1000; Progress = true;
EndTimer = 60000;
Progress = true;
}
} }
} }
}
public override void JustSummoned(Creature summoned) public override void JustSummoned(Creature summoned)
{
summoned.GetAI().AttackStart(me);
}
public override void JustDied(Unit killer)
{
if (!PlayerGUID.IsEmpty() && !Completed)
{ {
summoned.GetAI().AttackStart(me); Player player = Global.ObjAccessor.GetPlayer(me, PlayerGUID);
if (player)
player.FailQuest(QuestPoweringOurDefenses);
} }
}
public override void JustDied(Unit killer) public override void UpdateAI(uint diff)
{
if (EndTimer < diff && Progress)
{ {
if (!PlayerGUID.IsEmpty() && !Completed) Talk(Emote);
Completed = true;
if (!PlayerGUID.IsEmpty())
{ {
Player player = Global.ObjAccessor.GetPlayer(me, PlayerGUID); Player player = Global.ObjAccessor.GetPlayer(me, PlayerGUID);
if (player) if (player)
player.FailQuest(QuestPoweringOurDefenses); player.CompleteQuest(QuestPoweringOurDefenses);
} }
}
public override void UpdateAI(uint diff) me.DealDamage(me, (uint)me.GetHealth(), null, DamageEffectType.Direct, SpellSchoolMask.Normal, null, false);
me.RemoveCorpse();
}
else EndTimer -= diff;
if (WaveTimer < diff && !Completed && Progress)
{ {
if (EndTimer < diff && Progress) uint ran1 = RandomHelper.Rand32() % 8;
{ uint ran2 = RandomHelper.Rand32() % 8;
Talk(Emote); uint ran3 = RandomHelper.Rand32() % 8;
Completed = true; me.SummonCreature(NpcEnragedWeaith, SpawnLocations[ran1].X, SpawnLocations[ran1].Y, SpawnLocations[ran1].Z, 0, TempSummonType.TimedOrCorpseDespawn, 10000);
if (!PlayerGUID.IsEmpty()) me.SummonCreature(NpcEnragedWeaith, SpawnLocations[ran2].X, SpawnLocations[ran2].Y, SpawnLocations[ran2].Z, 0, TempSummonType.TimedOrCorpseDespawn, 10000);
{ me.SummonCreature(NpcEnragedWeaith, SpawnLocations[ran3].X, SpawnLocations[ran3].Y, SpawnLocations[ran3].Z, 0, TempSummonType.TimedOrCorpseDespawn, 10000);
Player player = Global.ObjAccessor.GetPlayer(me, PlayerGUID); WaveTimer = 30000;
if (player)
player.CompleteQuest(QuestPoweringOurDefenses);
}
me.DealDamage(me, (uint)me.GetHealth(), null, DamageEffectType.Direct, SpellSchoolMask.Normal, null, false);
me.RemoveCorpse();
}
else EndTimer -= diff;
if (WaveTimer < diff && !Completed && Progress)
{
uint ran1 = RandomHelper.Rand32() % 8;
uint ran2 = RandomHelper.Rand32() % 8;
uint ran3 = RandomHelper.Rand32() % 8;
me.SummonCreature(NpcEnragedWeaith, SpawnLocations[ran1].X, SpawnLocations[ran1].Y, SpawnLocations[ran1].Z, 0, TempSummonType.TimedOrCorpseDespawn, 10000);
me.SummonCreature(NpcEnragedWeaith, SpawnLocations[ran2].X, SpawnLocations[ran2].Y, SpawnLocations[ran2].Z, 0, TempSummonType.TimedOrCorpseDespawn, 10000);
me.SummonCreature(NpcEnragedWeaith, SpawnLocations[ran3].X, SpawnLocations[ran3].Y, SpawnLocations[ran3].Z, 0, TempSummonType.TimedOrCorpseDespawn, 10000);
WaveTimer = 30000;
}
else WaveTimer -= diff;
} }
else WaveTimer -= diff;
uint EndTimer;
uint WaveTimer;
bool Completed;
bool Progress;
ObjectGuid PlayerGUID;
} }
public override CreatureAI GetAI(Creature creature) uint EndTimer;
{ uint WaveTimer;
return new npc_infused_crystalAI(creature); bool Completed;
} bool Progress;
ObjectGuid PlayerGUID;
// Quest // Quest
const uint QuestPoweringOurDefenses = 8490; const uint QuestPoweringOurDefenses = 8490;
@@ -53,273 +53,253 @@ namespace Scripts.EasternKingdoms.Karazhan.Midnight
} }
[Script] [Script]
class boss_attumen : CreatureScript public class boss_attumen : ScriptedAI
{ {
public boss_attumen() : base("boss_attumen") { } public boss_attumen(Creature creature) : base(creature)
public class boss_attumenAI : ScriptedAI
{ {
public boss_attumenAI(Creature creature) : base(creature) CleaveTimer = RandomHelper.URand(10000, 15000);
CurseTimer = 30000;
RandomYellTimer = RandomHelper.URand(30000, 60000); //Occasionally yell
ChargeTimer = 20000;
ResetTimer = 0;
}
public override void Reset()
{
ResetTimer = 0;
Midnight.Clear();
}
public override void EnterEvadeMode(EvadeReason why)
{
base.EnterEvadeMode(why);
ResetTimer = 2000;
}
public override void EnterCombat(Unit who) { }
public override void KilledUnit(Unit victim)
{
Talk(TextIds.SayKill);
}
public override void JustDied(Unit killer)
{
Talk(TextIds.SayDeath);
Unit midnight = Global.ObjAccessor.GetUnit(me, Midnight);
if (midnight)
midnight.KillSelf();
}
public override void UpdateAI(uint diff)
{
if (ResetTimer != 0)
{ {
if (ResetTimer <= diff)
{
ResetTimer = 0;
Unit pMidnight = Global.ObjAccessor.GetUnit(me, Midnight);
if (pMidnight)
{
pMidnight.RemoveFlag(UnitFields.Flags, UnitFlags.NonAttackable);
pMidnight.SetVisible(true);
}
Midnight.Clear();
me.SetVisible(false);
me.KillSelf();
}
else ResetTimer -= diff;
}
//Return since we have no target
if (!UpdateVictim())
return;
if (me.HasFlag(UnitFields.Flags, UnitFlags.NonAttackable | UnitFlags.NotSelectable))
return;
if (CleaveTimer <= diff)
{
DoCastVictim(SpellIds.Shadowcleave);
CleaveTimer = RandomHelper.URand(10000, 15000); CleaveTimer = RandomHelper.URand(10000, 15000);
}
else CleaveTimer -= diff;
if (CurseTimer <= diff)
{
DoCastVictim(SpellIds.IntangiblePresence);
CurseTimer = 30000; CurseTimer = 30000;
RandomYellTimer = RandomHelper.URand(30000, 60000); //Occasionally yell
ChargeTimer = 20000;
ResetTimer = 0;
} }
else CurseTimer -= diff;
public override void Reset() if (RandomYellTimer <= diff)
{ {
ResetTimer = 0; Talk(TextIds.SayRandom);
Midnight.Clear(); RandomYellTimer = RandomHelper.URand(30000, 60000);
} }
else RandomYellTimer -= diff;
public override void EnterEvadeMode(EvadeReason why) if (me.GetUInt32Value(UnitFields.DisplayId) == Misc.MountedDisplayid)
{ {
base.EnterEvadeMode(why); if (ChargeTimer <= diff)
ResetTimer = 2000;
}
public override void EnterCombat(Unit who) { }
public override void KilledUnit(Unit victim)
{
Talk(TextIds.SayKill);
}
public override void JustDied(Unit killer)
{
Talk(TextIds.SayDeath);
Unit midnight = Global.ObjAccessor.GetUnit(me, Midnight);
if (midnight)
midnight.KillSelf();
}
public override void UpdateAI(uint diff)
{
if (ResetTimer != 0)
{ {
if (ResetTimer <= diff) var t_list = me.GetThreatManager().getThreatList();
List<Unit> target_list = new List<Unit>();
foreach (var hostileRefe in t_list)
{ {
ResetTimer = 0; var unit = Global.ObjAccessor.GetUnit(me, hostileRefe.getUnitGuid());
Unit pMidnight = Global.ObjAccessor.GetUnit(me, Midnight); if (unit && !unit.IsWithinDist(me, SharedConst.AttackDistance, false))
if (pMidnight) target_list.Add(unit);
{ unit = null;
pMidnight.RemoveFlag(UnitFields.Flags, UnitFlags.NonAttackable);
pMidnight.SetVisible(true);
}
Midnight.Clear();
me.SetVisible(false);
me.KillSelf();
} }
else ResetTimer -= diff; Unit target = null;
if (!target_list.Empty())
target = target_list.SelectRandom();
DoCast(target, SpellIds.BerserkerCharge);
ChargeTimer = 20000;
} }
else ChargeTimer -= diff;
//Return since we have no target }
if (!UpdateVictim()) else
return; {
if (HealthBelowPct(25))
if (me.HasFlag(UnitFields.Flags, UnitFlags.NonAttackable | UnitFlags.NotSelectable))
return;
if (CleaveTimer <= diff)
{ {
DoCastVictim(SpellIds.Shadowcleave); Creature pMidnight = ObjectAccessor.GetCreature(me, Midnight);
CleaveTimer = RandomHelper.URand(10000, 15000); if (pMidnight && pMidnight.IsTypeId(TypeId.Unit))
}
else CleaveTimer -= diff;
if (CurseTimer <= diff)
{
DoCastVictim(SpellIds.IntangiblePresence);
CurseTimer = 30000;
}
else CurseTimer -= diff;
if (RandomYellTimer <= diff)
{
Talk(TextIds.SayRandom);
RandomYellTimer = RandomHelper.URand(30000, 60000);
}
else RandomYellTimer -= diff;
if (me.GetUInt32Value(UnitFields.DisplayId) == Misc.MountedDisplayid)
{
if (ChargeTimer <= diff)
{ {
var t_list = me.GetThreatManager().getThreatList(); ((boss_midnight)pMidnight.GetAI()).Mount(me);
List<Unit> target_list = new List<Unit>(); me.SetHealth(pMidnight.GetHealth());
foreach (var hostileRefe in t_list) DoResetThreat();
{
var unit = Global.ObjAccessor.GetUnit(me, hostileRefe.getUnitGuid());
if (unit && !unit.IsWithinDist(me, SharedConst.AttackDistance, false))
target_list.Add(unit);
unit = null;
}
Unit target = null;
if (!target_list.Empty())
target = target_list.SelectRandom();
DoCast(target, SpellIds.BerserkerCharge);
ChargeTimer = 20000;
}
else ChargeTimer -= diff;
}
else
{
if (HealthBelowPct(25))
{
Creature pMidnight = ObjectAccessor.GetCreature(me, Midnight);
if (pMidnight && pMidnight.IsTypeId(TypeId.Unit))
{
((boss_midnight.boss_midnightAI)pMidnight.GetAI()).Mount(me);
me.SetHealth(pMidnight.GetHealth());
DoResetThreat();
}
} }
} }
DoMeleeAttackIfReady();
} }
public override void SpellHit(Unit source, SpellInfo spell) DoMeleeAttackIfReady();
{
if (spell.Mechanic == Mechanics.Disarm)
Talk(TextIds.SayDisarmed);
}
public ObjectGuid Midnight;
uint CleaveTimer;
uint CurseTimer;
uint RandomYellTimer;
uint ChargeTimer; //only when mounted
uint ResetTimer;
} }
public override CreatureAI GetAI(Creature creature) public override void SpellHit(Unit source, SpellInfo spell)
{ {
return new boss_attumenAI(creature); if (spell.Mechanic == Mechanics.Disarm)
Talk(TextIds.SayDisarmed);
} }
public ObjectGuid Midnight;
uint CleaveTimer;
uint CurseTimer;
uint RandomYellTimer;
uint ChargeTimer; //only when mounted
uint ResetTimer;
} }
[Script] [Script]
class boss_midnight : CreatureScript public class boss_midnight : ScriptedAI
{ {
public boss_midnight() : base("boss_midnight") { } public boss_midnight(Creature creature) : base(creature) { }
public class boss_midnightAI : ScriptedAI public override void Reset()
{ {
public boss_midnightAI(Creature creature) : base(creature) { } Phase = 1;
Attumen.Clear();
mountTimer = 0;
public override void Reset() me.RemoveFlag(UnitFields.Flags, UnitFlags.NonAttackable);
me.SetVisible(true);
}
public override void EnterCombat(Unit who) { }
public override void KilledUnit(Unit victim)
{
if (Phase == 2)
{ {
Phase = 1; Unit unit = Global.ObjAccessor.GetUnit(me, Attumen);
Attumen.Clear(); if (unit)
mountTimer = 0; Talk(TextIds.SayMidnightKill, unit);
me.RemoveFlag(UnitFields.Flags, UnitFlags.NonAttackable);
me.SetVisible(true);
} }
}
public override void EnterCombat(Unit who) { } public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
public override void KilledUnit(Unit victim) if (Phase == 1 && HealthBelowPct(95))
{ {
if (Phase == 2) Phase = 2;
Creature attumen = me.SummonCreature(Misc.SummonAttumen, 0.0f, 0.0f, 0.0f, 0.0f, TempSummonType.TimedOrDeadDespawn, 30000);
if (attumen)
{ {
Unit unit = Global.ObjAccessor.GetUnit(me, Attumen); Attumen = attumen.GetGUID();
if (unit) attumen.GetAI().AttackStart(me.GetVictim());
Talk(TextIds.SayMidnightKill, unit); SetMidnight(attumen, me.GetGUID());
Talk(TextIds.SayAppear, attumen);
} }
} }
else if (Phase == 2 && HealthBelowPct(25))
public override void UpdateAI(uint diff)
{ {
if (!UpdateVictim()) Unit pAttumen = Global.ObjAccessor.GetUnit(me, Attumen);
return; if (pAttumen)
Mount(pAttumen);
if (Phase == 1 && HealthBelowPct(95)) }
else if (Phase == 3)
{
if (mountTimer != 0)
{ {
Phase = 2; if (mountTimer <= diff)
Creature attumen = me.SummonCreature(Misc.SummonAttumen, 0.0f, 0.0f, 0.0f, 0.0f, TempSummonType.TimedOrDeadDespawn, 30000);
if (attumen)
{ {
Attumen = attumen.GetGUID(); mountTimer = 0;
attumen.GetAI().AttackStart(me.GetVictim()); me.SetVisible(false);
SetMidnight(attumen, me.GetGUID()); me.GetMotionMaster().MoveIdle();
Talk(TextIds.SayAppear, attumen); Unit pAttumen = Global.ObjAccessor.GetUnit(me, Attumen);
} if (pAttumen)
}
else if (Phase == 2 && HealthBelowPct(25))
{
Unit pAttumen = Global.ObjAccessor.GetUnit(me, Attumen);
if (pAttumen)
Mount(pAttumen);
}
else if (Phase == 3)
{
if (mountTimer != 0)
{
if (mountTimer <= diff)
{ {
mountTimer = 0; pAttumen.SetDisplayId(Misc.MountedDisplayid);
me.SetVisible(false); pAttumen.RemoveFlag(UnitFields.Flags, UnitFlags.NonAttackable);
me.GetMotionMaster().MoveIdle(); if (pAttumen.GetVictim())
Unit pAttumen = Global.ObjAccessor.GetUnit(me, Attumen);
if (pAttumen)
{ {
pAttumen.SetDisplayId(Misc.MountedDisplayid); pAttumen.GetMotionMaster().MoveChase(pAttumen.GetVictim());
pAttumen.RemoveFlag(UnitFields.Flags, UnitFlags.NonAttackable); pAttumen.SetTarget(pAttumen.GetVictim().GetGUID());
if (pAttumen.GetVictim())
{
pAttumen.GetMotionMaster().MoveChase(pAttumen.GetVictim());
pAttumen.SetTarget(pAttumen.GetVictim().GetGUID());
}
pAttumen.SetObjectScale(1);
} }
pAttumen.SetObjectScale(1);
} }
else mountTimer -= diff;
} }
else mountTimer -= diff;
} }
if (Phase != 3)
DoMeleeAttackIfReady();
} }
public void Mount(Unit pAttumen) if (Phase != 3)
{ DoMeleeAttackIfReady();
Talk(TextIds.SayMount, pAttumen);
Phase = 3;
me.SetFlag(UnitFields.Flags, UnitFlags.NonAttackable);
pAttumen.SetFlag(UnitFields.Flags, UnitFlags.NonAttackable);
float angle = me.GetAngle(pAttumen);
float distance = me.GetDistance2d(pAttumen);
float newX = me.GetPositionX() + (float)Math.Cos(angle) * (distance / 2);
float newY = me.GetPositionY() + (float)Math.Sin(angle) * (distance / 2);
float newZ = 50;
me.GetMotionMaster().Clear();
me.GetMotionMaster().MovePoint(0, newX, newY, newZ);
distance += 10;
newX = me.GetPositionX() + (float)Math.Cos(angle) * (distance / 2);
newY = me.GetPositionY() + (float)Math.Sin(angle) * (distance / 2);
pAttumen.GetMotionMaster().Clear();
pAttumen.GetMotionMaster().MovePoint(0, newX, newY, newZ);
mountTimer = 1000;
}
void SetMidnight(Creature pAttumen, ObjectGuid value)
{
((boss_attumen.boss_attumenAI)pAttumen.GetAI()).Midnight = value;
}
ObjectGuid Attumen;
byte Phase;
uint mountTimer;
} }
public override CreatureAI GetAI(Creature creature) public void Mount(Unit pAttumen)
{ {
return new boss_midnightAI(creature); Talk(TextIds.SayMount, pAttumen);
Phase = 3;
me.SetFlag(UnitFields.Flags, UnitFlags.NonAttackable);
pAttumen.SetFlag(UnitFields.Flags, UnitFlags.NonAttackable);
float angle = me.GetAngle(pAttumen);
float distance = me.GetDistance2d(pAttumen);
float newX = me.GetPositionX() + (float)Math.Cos(angle) * (distance / 2);
float newY = me.GetPositionY() + (float)Math.Sin(angle) * (distance / 2);
float newZ = 50;
me.GetMotionMaster().Clear();
me.GetMotionMaster().MovePoint(0, newX, newY, newZ);
distance += 10;
newX = me.GetPositionX() + (float)Math.Cos(angle) * (distance / 2);
newY = me.GetPositionY() + (float)Math.Sin(angle) * (distance / 2);
pAttumen.GetMotionMaster().Clear();
pAttumen.GetMotionMaster().MovePoint(0, newX, newY, newZ);
mountTimer = 1000;
} }
void SetMidnight(Creature pAttumen, ObjectGuid value)
{
((boss_attumen)pAttumen.GetAI()).Midnight = value;
}
ObjectGuid Attumen;
byte Phase;
uint mountTimer;
} }
} }
+82 -92
View File
@@ -46,123 +46,113 @@ namespace Scripts.EasternKingdoms.Karazhan.Curator
} }
[Script] [Script]
class boss_curator : CreatureScript class boss_curator : ScriptedAI
{ {
public boss_curator() : base("boss_curator") { } public boss_curator(Creature creature) : base(creature)
class boss_curatorAI : ScriptedAI
{ {
public boss_curatorAI(Creature creature) : base(creature) Initialize();
{ }
Initialize();
}
void Initialize() void Initialize()
{
_scheduler.Schedule(TimeSpan.FromSeconds(10), task =>
{ {
_scheduler.Schedule(TimeSpan.FromSeconds(10), task =>
{
//Summon Astral Flare //Summon Astral Flare
Creature AstralFlare = DoSpawnCreature(17096, RandomHelper.Rand32() % 37, RandomHelper.Rand32() % 37, 0, 0, TempSummonType.TimedDespawnOOC, 5000); Creature AstralFlare = DoSpawnCreature(17096, RandomHelper.Rand32() % 37, RandomHelper.Rand32() % 37, 0, 0, TempSummonType.TimedDespawnOOC, 5000);
Unit target = SelectTarget(SelectAggroTarget.Random, 0); Unit target = SelectTarget(SelectAggroTarget.Random, 0);
if (AstralFlare && target) if (AstralFlare && target)
{ {
AstralFlare.CastSpell(AstralFlare, SpellIds.AstralFlarePassive, false); AstralFlare.CastSpell(AstralFlare, SpellIds.AstralFlarePassive, false);
AstralFlare.GetAI().AttackStart(target); AstralFlare.GetAI().AttackStart(target);
} }
//Reduce Mana by 10% of max health //Reduce Mana by 10% of max health
int mana = me.GetMaxPower(PowerType.Mana); int mana = me.GetMaxPower(PowerType.Mana);
if (mana != 0) if (mana != 0)
{ {
mana /= 10; mana /= 10;
me.ModifyPower(PowerType.Mana, -mana); me.ModifyPower(PowerType.Mana, -mana);
//if this get's us below 10%, then we evocate (the 10th should be summoned now) //if this get's us below 10%, then we evocate (the 10th should be summoned now)
if (me.GetPower(PowerType.Mana) * 100 / me.GetMaxPower(PowerType.Mana) < 10) if (me.GetPower(PowerType.Mana) * 100 / me.GetMaxPower(PowerType.Mana) < 10)
{ {
Talk(TextIds.SayEvocate); Talk(TextIds.SayEvocate);
me.InterruptNonMeleeSpells(false); me.InterruptNonMeleeSpells(false);
DoCast(me, SpellIds.Evocation); DoCast(me, SpellIds.Evocation);
_scheduler.DelayAll(TimeSpan.FromSeconds(20)); _scheduler.DelayAll(TimeSpan.FromSeconds(20));
//Evocating = true; //Evocating = true;
//no AddTimer cooldown, this will make first flare appear instantly after evocate end, like expected //no AddTimer cooldown, this will make first flare appear instantly after evocate end, like expected
return; return;
}
else
{
if (RandomHelper.URand(0, 1) == 0)
{
Talk(TextIds.SaySummon);
}
}
} }
task.Repeat();
});
_scheduler.Schedule(TimeSpan.FromSeconds(15), task =>
{
if (Enraged)
task.Repeat(TimeSpan.FromSeconds(7));
else else
task.Repeat();
Unit target = SelectTarget(SelectAggroTarget.TopAggro, 1);
if (target)
DoCast(target, SpellIds.HatefulBolt);
});
Enraged = false;
}
public override void Reset()
{
Initialize();
me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Arcane, true);
}
public override void KilledUnit(Unit victim)
{
Talk(TextIds.SayKill);
}
public override void JustDied(Unit killer)
{
Talk(TextIds.SayDeath);
}
public override void EnterCombat(Unit victim)
{
Talk(TextIds.SayAggro);
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (!Enraged)
{
if (!HealthAbovePct(15))
{ {
Enraged = true; if (RandomHelper.URand(0, 1) == 0)
DoCast(me, SpellIds.Enrage); {
Talk(TextIds.SayEnrage); Talk(TextIds.SaySummon);
}
} }
} }
task.Repeat();
});
_scheduler.Schedule(TimeSpan.FromSeconds(15), task =>
{
if (Enraged)
task.Repeat(TimeSpan.FromSeconds(7));
else
task.Repeat();
Unit target = SelectTarget(SelectAggroTarget.TopAggro, 1);
if (target)
DoCast(target, SpellIds.HatefulBolt);
});
Enraged = false;
}
public override void Reset()
{
Initialize();
me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Arcane, true);
}
public override void KilledUnit(Unit victim)
{
Talk(TextIds.SayKill);
}
public override void JustDied(Unit killer)
{
Talk(TextIds.SayDeath);
}
public override void EnterCombat(Unit victim)
{
Talk(TextIds.SayAggro);
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (!Enraged)
{
if (!HealthAbovePct(15))
{
Enraged = true;
DoCast(me, SpellIds.Enrage);
Talk(TextIds.SayEnrage);
}
} }
bool Enraged;
} }
public override CreatureAI GetAI(Creature creature) bool Enraged;
{
return new boss_curatorAI(creature);
}
} }
} }
@@ -20,6 +20,7 @@ using Framework.IO;
using Game.Entities; using Game.Entities;
using Game.Maps; using Game.Maps;
using Game.Scripting; using Game.Scripting;
using Game.AI;
namespace Scripts.EasternKingdoms.Karazhan namespace Scripts.EasternKingdoms.Karazhan
{ {
@@ -458,5 +459,10 @@ namespace Scripts.EasternKingdoms.Karazhan
{ {
return new instance_karazhan_InstanceMapScript(map); return new instance_karazhan_InstanceMapScript(map);
} }
public static T GetKarazhanAI<T>(Creature creature) where T : CreatureAI
{
return GetInstanceAI<T>(creature, "instance_karazhan");
}
} }
} }
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+221 -252
View File
@@ -33,240 +33,220 @@ namespace Scripts.EasternKingdoms
} }
[Script] [Script]
class npc_unworthy_initiate : CreatureScript public class npc_unworthy_initiate : ScriptedAI
{ {
public npc_unworthy_initiate() : base("npc_unworthy_initiate") { } public npc_unworthy_initiate(Creature creature) : base(creature)
public class npc_unworthy_initiateAI : ScriptedAI
{ {
public npc_unworthy_initiateAI(Creature creature) : base(creature) me.SetReactState(ReactStates.Passive);
{ if (me.GetCurrentEquipmentId() == 0)
me.SetReactState(ReactStates.Passive); me.SetCurrentEquipmentId((byte)me.GetOriginalEquipmentId());
if (me.GetCurrentEquipmentId() == 0) }
me.SetCurrentEquipmentId((byte)me.GetOriginalEquipmentId());
}
public override void Reset() public override void Reset()
{ {
anchorGUID.Clear(); anchorGUID.Clear();
phase = UnworthyInitiatePhase.Chained; phase = UnworthyInitiatePhase.Chained;
_events.Reset(); _events.Reset();
me.SetFaction(7); me.SetFaction(7);
me.SetFlag(UnitFields.Flags, UnitFlags.ImmuneToPc); me.SetFlag(UnitFields.Flags, UnitFlags.ImmuneToPc);
me.SetStandState(UnitStandStateType.Kneel); me.SetStandState(UnitStandStateType.Kneel);
me.LoadEquipment(0, true); me.LoadEquipment(0, true);
} }
public override void EnterCombat(Unit who) public override void EnterCombat(Unit who)
{ {
_events.ScheduleEvent(EventIcyTouch, 1000, 1); _events.ScheduleEvent(EventIcyTouch, 1000, 1);
_events.ScheduleEvent(EventPlagueStrike, 3000, 1); _events.ScheduleEvent(EventPlagueStrike, 3000, 1);
_events.ScheduleEvent(EventBloodStrike, 2000, 1); _events.ScheduleEvent(EventBloodStrike, 2000, 1);
_events.ScheduleEvent(EventDeathCoil, 5000, 1); _events.ScheduleEvent(EventDeathCoil, 5000, 1);
} }
public override void MovementInform(MovementGeneratorType type, uint id) public override void MovementInform(MovementGeneratorType type, uint id)
{ {
if (type != MovementGeneratorType.Point) if (type != MovementGeneratorType.Point)
return; return;
if (id == 1) if (id == 1)
{
wait_timer = 5000;
me.CastSpell(me, SpellDKInitateVisual, true);
Player starter = Global.ObjAccessor.GetPlayer(me, playerGUID);
if (starter)
Global.CreatureTextMgr.SendChat(me, (byte)SayEventAttack, null, ChatMsg.Addon, Language.Addon, CreatureTextRange.Normal, 0, Team.Other, false, starter);
phase = UnworthyInitiatePhase.ToAttack;
}
}
public void EventStart(Creature anchor, Player target)
{ {
wait_timer = 5000; wait_timer = 5000;
phase = UnworthyInitiatePhase.ToEquip; me.CastSpell(me, SpellDKInitateVisual, true);
me.SetStandState(UnitStandStateType.Stand); Player starter = Global.ObjAccessor.GetPlayer(me, playerGUID);
me.RemoveAurasDueToSpell(SpellSoulPrisonChainSelf); if (starter)
me.RemoveAurasDueToSpell(SpellSoulPrisonChain); Global.CreatureTextMgr.SendChat(me, (byte)SayEventAttack, null, ChatMsg.Addon, Language.Addon, CreatureTextRange.Normal, 0, Team.Other, false, starter);
float z; phase = UnworthyInitiatePhase.ToAttack;
anchor.GetContactPoint(me, out anchorX, out anchorY, out z, 1.0f);
playerGUID = target.GetGUID();
Talk(SayEventStart);
} }
}
public override void UpdateAI(uint diff) public void EventStart(Creature anchor, Player target)
{
wait_timer = 5000;
phase = UnworthyInitiatePhase.ToEquip;
me.SetStandState(UnitStandStateType.Stand);
me.RemoveAurasDueToSpell(SpellSoulPrisonChainSelf);
me.RemoveAurasDueToSpell(SpellSoulPrisonChain);
float z;
anchor.GetContactPoint(me, out anchorX, out anchorY, out z, 1.0f);
playerGUID = target.GetGUID();
Talk(SayEventStart);
}
public override void UpdateAI(uint diff)
{
switch (phase)
{ {
switch (phase) case UnworthyInitiatePhase.Chained:
{ if (anchorGUID.IsEmpty())
case UnworthyInitiatePhase.Chained: {
if (anchorGUID.IsEmpty()) Creature anchor = me.FindNearestCreature(29521, 30);
if (anchor)
{ {
Creature anchor = me.FindNearestCreature(29521, 30); anchor.GetAI().SetGUID(me.GetGUID());
if (anchor) anchor.CastSpell(me, SpellSoulPrisonChain, true);
{ anchorGUID = anchor.GetGUID();
anchor.GetAI().SetGUID(me.GetGUID()); }
anchor.CastSpell(me, SpellSoulPrisonChain, true); else
anchorGUID = anchor.GetGUID(); Log.outError(LogFilter.Scripts, "npc_unworthy_initiateAI: unable to find anchor!");
}
else
Log.outError(LogFilter.Scripts, "npc_unworthy_initiateAI: unable to find anchor!");
float dist = 99.0f; float dist = 99.0f;
GameObject prison = null; GameObject prison = null;
for (byte i = 0; i < 12; ++i) for (byte i = 0; i < 12; ++i)
{
GameObject temp_prison = me.FindNearestGameObject(acherus_soul_prison[i], 30);
if (temp_prison)
{ {
GameObject temp_prison = me.FindNearestGameObject(acherus_soul_prison[i], 30); if (me.IsWithinDist(temp_prison, dist, false))
if (temp_prison)
{ {
if (me.IsWithinDist(temp_prison, dist, false)) dist = me.GetDistance2d(temp_prison);
{ prison = temp_prison;
dist = me.GetDistance2d(temp_prison);
prison = temp_prison;
}
} }
} }
if (prison)
prison.ResetDoorOrButton();
else
Log.outError(LogFilter.Scripts, "npc_unworthy_initiateAI: unable to find prison!");
} }
break;
case UnworthyInitiatePhase.ToEquip: if (prison)
if (wait_timer != 0) prison.ResetDoorOrButton();
else
Log.outError(LogFilter.Scripts, "npc_unworthy_initiateAI: unable to find prison!");
}
break;
case UnworthyInitiatePhase.ToEquip:
if (wait_timer != 0)
{
if (wait_timer > diff)
wait_timer -= diff;
else
{ {
if (wait_timer > diff) me.GetMotionMaster().MovePoint(1, anchorX, anchorY, me.GetPositionZ());
wait_timer -= diff; phase = UnworthyInitiatePhase.Equiping;
else wait_timer = 0;
{
me.GetMotionMaster().MovePoint(1, anchorX, anchorY, me.GetPositionZ());
phase = UnworthyInitiatePhase.Equiping;
wait_timer = 0;
}
} }
break; }
case UnworthyInitiatePhase.ToAttack: break;
if (wait_timer != 0) case UnworthyInitiatePhase.ToAttack:
if (wait_timer != 0)
{
if (wait_timer > diff)
wait_timer -= diff;
else
{ {
if (wait_timer > diff) me.SetFaction(14);
wait_timer -= diff; me.RemoveFlag(UnitFields.Flags, UnitFlags.ImmuneToPc);
else phase = UnworthyInitiatePhase.Attacking;
{
me.SetFaction(14);
me.RemoveFlag(UnitFields.Flags, UnitFlags.ImmuneToPc);
phase = UnworthyInitiatePhase.Attacking;
Player target = Global.ObjAccessor.GetPlayer(me, playerGUID); Player target = Global.ObjAccessor.GetPlayer(me, playerGUID);
if (target) if (target)
AttackStart(target); AttackStart(target);
wait_timer = 0; wait_timer = 0;
}
} }
break; }
case UnworthyInitiatePhase.Attacking: break;
if (!UpdateVictim()) case UnworthyInitiatePhase.Attacking:
return; if (!UpdateVictim())
return;
_events.Update(diff); _events.Update(diff);
_events.ExecuteEvents(eventId => _events.ExecuteEvents(eventId =>
{
switch (eventId)
{ {
switch (eventId) case EventIcyTouch:
{ DoCastVictim(SpellIcyTouch);
case EventIcyTouch: _events.DelayEvents(1000, 1);
DoCastVictim(SpellIcyTouch); _events.ScheduleEvent(EventIcyTouch, 5000, 1);
_events.DelayEvents(1000, 1); break;
_events.ScheduleEvent(EventIcyTouch, 5000, 1); case EventPlagueStrike:
break; DoCastVictim(SpellPlagueStrike);
case EventPlagueStrike: _events.DelayEvents(1000, 1);
DoCastVictim(SpellPlagueStrike); _events.ScheduleEvent(EventPlagueStrike, 5000, 1);
_events.DelayEvents(1000, 1); break;
_events.ScheduleEvent(EventPlagueStrike, 5000, 1); case EventBloodStrike:
break; DoCastVictim(SpellBloodStrike);
case EventBloodStrike: _events.DelayEvents(1000, 1);
DoCastVictim(SpellBloodStrike); _events.ScheduleEvent(EventBloodStrike, 5000, 1);
_events.DelayEvents(1000, 1); break;
_events.ScheduleEvent(EventBloodStrike, 5000, 1); case EventDeathCoil:
break; DoCastVictim(SpellDeathCoil);
case EventDeathCoil: _events.DelayEvents(1000, 1);
DoCastVictim(SpellDeathCoil); _events.ScheduleEvent(EventDeathCoil, 5000, 1);
_events.DelayEvents(1000, 1); break;
_events.ScheduleEvent(EventDeathCoil, 5000, 1); }
break; });
}
});
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
break; break;
default: default:
break; break;
}
} }
ObjectGuid playerGUID;
UnworthyInitiatePhase phase;
uint wait_timer;
float anchorX, anchorY;
ObjectGuid anchorGUID;
} }
public const uint SpellSoulPrisonChainSelf = 54612; ObjectGuid playerGUID;
public const uint SpellSoulPrisonChain = 54613; UnworthyInitiatePhase phase;
public const uint SpellDKInitateVisual = 51519; uint wait_timer;
float anchorX, anchorY;
ObjectGuid anchorGUID;
public const uint SpellIcyTouch = 52372; const uint SpellSoulPrisonChainSelf = 54612;
public const uint SpellPlagueStrike = 52373; const uint SpellSoulPrisonChain = 54613;
public const uint SpellBloodStrike = 52374; const uint SpellDKInitateVisual = 51519;
public const uint SpellDeathCoil = 52375;
public const uint SayEventStart = 0; const uint SpellIcyTouch = 52372;
public const uint SayEventAttack = 1; const uint SpellPlagueStrike = 52373;
const uint SpellBloodStrike = 52374;
const uint SpellDeathCoil = 52375;
public const uint EventIcyTouch = 1; const uint SayEventStart = 0;
public const uint EventPlagueStrike = 2; const uint SayEventAttack = 1;
public const uint EventBloodStrike = 3;
public const uint EventDeathCoil = 4;
public static uint[] acherus_soul_prison = { 191577, 191580, 191581, 191582, 191583, 191584, 191585, 191586, 191587, 191588, 191589, 191590 }; const uint EventIcyTouch = 1;
const uint EventPlagueStrike = 2;
const uint EventBloodStrike = 3;
const uint EventDeathCoil = 4;
public override CreatureAI GetAI(Creature creature) static uint[] acherus_soul_prison = { 191577, 191580, 191581, 191582, 191583, 191584, 191585, 191586, 191587, 191588, 191589, 191590 };
{
return new npc_unworthy_initiateAI(creature);
}
} }
[Script] [Script]
class npc_unworthy_initiate_anchor : CreatureScript class npc_unworthy_initiate_anchor : PassiveAI
{ {
public npc_unworthy_initiate_anchor() : base("npc_unworthy_initiate_anchor") { } public npc_unworthy_initiate_anchor(Creature creature) : base(creature) { }
class npc_unworthy_initiate_anchorAI : PassiveAI public override void SetGUID(ObjectGuid guid, int id)
{ {
public npc_unworthy_initiate_anchorAI(Creature creature) : base(creature) { } if (prisonerGUID.IsEmpty())
prisonerGUID = guid;
public override void SetGUID(ObjectGuid guid, int id)
{
if (prisonerGUID.IsEmpty())
prisonerGUID = guid;
}
public override ObjectGuid GetGUID(int id)
{
return prisonerGUID;
}
ObjectGuid prisonerGUID;
} }
public override CreatureAI GetAI(Creature creature) public override ObjectGuid GetGUID(int id)
{ {
return new npc_unworthy_initiate_anchorAI(creature); return prisonerGUID;
} }
ObjectGuid prisonerGUID;
} }
[Script] [Script]
@@ -284,13 +264,12 @@ namespace Scripts.EasternKingdoms
{ {
Creature prisoner = ObjectAccessor.GetCreature(player, prisonerGUID); Creature prisoner = ObjectAccessor.GetCreature(player, prisonerGUID);
if (prisoner) if (prisoner)
((npc_unworthy_initiate.npc_unworthy_initiateAI)prisoner.GetAI()).EventStart(anchor, player); ((npc_unworthy_initiate)prisoner.GetAI()).EventStart(anchor, player);
} }
} }
return false; return false;
} }
} }
struct EyeOfAcherus struct EyeOfAcherus
@@ -311,74 +290,64 @@ namespace Scripts.EasternKingdoms
} }
[Script] [Script]
class npc_eye_of_acherus : CreatureScript class npc_eye_of_acherus : ScriptedAI
{ {
public npc_eye_of_acherus() : base("npc_eye_of_acherus") { } public npc_eye_of_acherus(Creature creature) : base(creature)
class npc_eye_of_acherusAI : ScriptedAI
{ {
public npc_eye_of_acherusAI(Creature creature) : base(creature) Reset();
{
Reset();
}
uint startTimer;
public override void Reset()
{
startTimer = 2000;
}
public override void AttackStart(Unit u) { }
public override void MoveInLineOfSight(Unit u) { }
public override void JustDied(Unit killer)
{
Unit charmer = me.GetCharmer();
if (charmer)
charmer.RemoveAurasDueToSpell(EyeOfAcherus.SpellEyeControl);
}
public override void UpdateAI(uint diff)
{
if (me.IsCharmed())
{
if (startTimer <= diff) // fly to start point
{
me.CastSpell(me, EyeOfAcherus.SpellEyePhasemask, true);
me.CastSpell(me, EyeOfAcherus.SpellEyeVisual, true);
me.CastSpell(me, EyeOfAcherus.SpellEyeFlightBoost, true);
me.SetSpeedRate(UnitMoveType.Flight, 4f);
me.GetMotionMaster().MovePoint(0, EyeOfAcherus.EyeDestination[0], EyeOfAcherus.EyeDestination[1], EyeOfAcherus.EyeDestination[2]);
return;
}
else
startTimer -= diff;
}
else
me.ForcedDespawn();
}
public override void MovementInform(MovementGeneratorType type, uint id)
{
if (type != MovementGeneratorType.Point || id != 0)
return;
me.SetDisplayId(EyeOfAcherus.EyeSmallDisplayId);
me.CastSpell(me, EyeOfAcherus.SpellEyeFlight, true);
me.Say(EyeOfAcherus.SayEyeUnderControl, Language.Universal);
if (me.GetCharmer() && me.GetCharmer().IsTypeId(TypeId.Player))
me.GetCharmer().ToPlayer().SetClientControl(me, true);
}
} }
public override CreatureAI GetAI(Creature creature) uint startTimer;
public override void Reset()
{ {
return new npc_eye_of_acherusAI(creature); startTimer = 2000;
}
public override void AttackStart(Unit u) { }
public override void MoveInLineOfSight(Unit u) { }
public override void JustDied(Unit killer)
{
Unit charmer = me.GetCharmer();
if (charmer)
charmer.RemoveAurasDueToSpell(EyeOfAcherus.SpellEyeControl);
}
public override void UpdateAI(uint diff)
{
if (me.IsCharmed())
{
if (startTimer <= diff) // fly to start point
{
me.CastSpell(me, EyeOfAcherus.SpellEyePhasemask, true);
me.CastSpell(me, EyeOfAcherus.SpellEyeVisual, true);
me.CastSpell(me, EyeOfAcherus.SpellEyeFlightBoost, true);
me.SetSpeedRate(UnitMoveType.Flight, 4f);
me.GetMotionMaster().MovePoint(0, EyeOfAcherus.EyeDestination[0], EyeOfAcherus.EyeDestination[1], EyeOfAcherus.EyeDestination[2]);
return;
}
else
startTimer -= diff;
}
else
me.ForcedDespawn();
}
public override void MovementInform(MovementGeneratorType type, uint id)
{
if (type != MovementGeneratorType.Point || id != 0)
return;
me.SetDisplayId(EyeOfAcherus.EyeSmallDisplayId);
me.CastSpell(me, EyeOfAcherus.SpellEyeFlight, true);
me.Say(EyeOfAcherus.SayEyeUnderControl, Language.Universal);
if (me.GetCharmer() && me.GetCharmer().IsTypeId(TypeId.Player))
me.GetCharmer().ToPlayer().SetClientControl(me, true);
} }
} }
} }
@@ -36,122 +36,102 @@ namespace Scripts.EasternKingdoms.TheStockade
} }
[Script] [Script]
class boss_hogger : CreatureScript class boss_hogger : BossAI
{ {
public boss_hogger() : base("boss_hogger") { } public boss_hogger(Creature creature) : base(creature, DataTypes.Hogger) { }
class boss_hoggerAI : BossAI public override void EnterCombat(Unit who)
{ {
public boss_hoggerAI(Creature creature) : base(creature, DataTypes.Hogger) { } _EnterCombat();
Talk(TextIds.SayPull);
public override void EnterCombat(Unit who) _scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting));
_scheduler.Schedule(TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(4), task =>
{ {
_EnterCombat(); DoCastVictim(SpellIds.ViciousSlice);
Talk(TextIds.SayPull); task.Repeat(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(14));
});
_scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting)); _scheduler.Schedule(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(2), task =>
_scheduler.Schedule(TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(4), task =>
{
DoCastVictim(SpellIds.ViciousSlice);
task.Repeat(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(14));
});
_scheduler.Schedule(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(2), task =>
{
DoCast(SpellIds.MaddeningCall);
task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(20));
});
}
public override void JustDied(Unit killer)
{ {
Talk(TextIds.SayDeath); DoCast(SpellIds.MaddeningCall);
_JustDied(); task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(20));
me.SummonCreature(CreatureIds.WardenThelwater, Misc.WardenThelwaterPos); });
}
public override void JustSummoned(Creature summon)
{
base.JustSummoned(summon);
if (summon.GetEntry() == CreatureIds.WardenThelwater)
summon.GetMotionMaster().MovePoint(0, Misc.WardenThelwaterMovePos);
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
DoMeleeAttackIfReady();
}
public override void DamageTaken(Unit attacker, ref uint damage)
{
if (me.HealthBelowPctDamaged(30, damage) && !_hasEnraged)
{
_hasEnraged = true;
Talk(TextIds.SayEnrage);
DoCastSelf(SpellIds.Enrage);
}
}
bool _hasEnraged;
} }
public override CreatureAI GetAI(Creature creature) public override void JustDied(Unit killer)
{ {
return GetInstanceAI<boss_hoggerAI>(creature, nameof(instance_the_stockade)); Talk(TextIds.SayDeath);
_JustDied();
me.SummonCreature(CreatureIds.WardenThelwater, Misc.WardenThelwaterPos);
} }
public override void JustSummoned(Creature summon)
{
base.JustSummoned(summon);
if (summon.GetEntry() == CreatureIds.WardenThelwater)
summon.GetMotionMaster().MovePoint(0, Misc.WardenThelwaterMovePos);
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
DoMeleeAttackIfReady();
}
public override void DamageTaken(Unit attacker, ref uint damage)
{
if (me.HealthBelowPctDamaged(30, damage) && !_hasEnraged)
{
_hasEnraged = true;
Talk(TextIds.SayEnrage);
DoCastSelf(SpellIds.Enrage);
}
}
bool _hasEnraged;
} }
[Script] [Script]
class npc_warden_thelwater : CreatureScript class npc_warden_thelwater : ScriptedAI
{ {
public npc_warden_thelwater() : base("npc_warden_thelwater") { } public npc_warden_thelwater(Creature creature) : base(creature) { }
class npc_warden_thelwaterAI : ScriptedAI public override void MovementInform(MovementGeneratorType type, uint id)
{ {
public npc_warden_thelwaterAI(Creature creature) : base(creature) { } if (type == MovementGeneratorType.Point && id == 0)
_events.ScheduleEvent(Events.SayWarden1, TimeSpan.FromSeconds(1));
public override void MovementInform(MovementGeneratorType type, uint id)
{
if (type == MovementGeneratorType.Point && id == 0)
_events.ScheduleEvent(Events.SayWarden1, TimeSpan.FromSeconds(1));
}
public override void UpdateAI(uint diff)
{
_events.Update(diff);
_events.ExecuteEvents(eventId =>
{
switch (eventId)
{
case Events.SayWarden1:
Talk(TextIds.SayWarden1);
_events.ScheduleEvent(Events.SayWarden2, TimeSpan.FromSeconds(4));
break;
case Events.SayWarden2:
Talk(TextIds.SayWarden2);
_events.ScheduleEvent(Events.SayWarden3, TimeSpan.FromSeconds(3));
break;
case Events.SayWarden3:
Talk(TextIds.SayWarden3);
break;
}
});
}
} }
public override CreatureAI GetAI(Creature creature) public override void UpdateAI(uint diff)
{ {
return GetInstanceAI<npc_warden_thelwaterAI>(creature, nameof(instance_the_stockade)); _events.Update(diff);
_events.ExecuteEvents(eventId =>
{
switch (eventId)
{
case Events.SayWarden1:
Talk(TextIds.SayWarden1);
_events.ScheduleEvent(Events.SayWarden2, TimeSpan.FromSeconds(4));
break;
case Events.SayWarden2:
Talk(TextIds.SayWarden2);
_events.ScheduleEvent(Events.SayWarden3, TimeSpan.FromSeconds(3));
break;
case Events.SayWarden3:
Talk(TextIds.SayWarden3);
break;
}
});
} }
} }
} }
+189 -219
View File
@@ -35,7 +35,7 @@ namespace Scripts.Kalimdor.ZoneAshenvale
public const uint Cage = 178147; public const uint Cage = 178147;
//Muglash //Muglash
public const uint NagaBrazier = 178247; public const uint NagaBrazier = 178247;
//KingoftheFoulweald //KingoftheFoulweald
public const uint Banner = 178205; public const uint Banner = 178205;
@@ -46,7 +46,7 @@ namespace Scripts.Kalimdor.ZoneAshenvale
//RuulSnowhoof //RuulSnowhoof
public const uint FreedomToRuul = 6482; public const uint FreedomToRuul = 6482;
//Muglash //Muglash
public const uint Vorsha = 6641; public const uint Vorsha = 6641;
} }
@@ -98,232 +98,212 @@ namespace Scripts.Kalimdor.ZoneAshenvale
[Script] [Script]
class npc_ruul_snowhoof : CreatureScript class npc_ruul_snowhoof : npc_escortAI
{ {
public npc_ruul_snowhoof() : base("npc_ruul_snowhoof") { } public npc_ruul_snowhoof(Creature creature) : base(creature) { }
class npc_ruul_snowhoofAI : npc_escortAI public override void Reset()
{ {
public npc_ruul_snowhoofAI(Creature creature) : base(creature) { } GameObject cage = me.FindNearestGameObject(GameObjectIds.Cage, 20);
if (cage)
cage.SetGoState(GameObjectState.Ready);
}
public override void Reset() public override void EnterCombat(Unit who) { }
public override void JustSummoned(Creature summoned)
{
summoned.GetAI().AttackStart(me);
}
public override void sQuestAccept(Player player, Quest quest)
{
if (quest.Id == QuestIds.FreedomToRuul)
{ {
GameObject cage = me.FindNearestGameObject(GameObjectIds.Cage, 20); me.SetFaction(Misc.FactionQuest);
if (cage) base.Start(true, false, player.GetGUID());
cage.SetGoState(GameObjectState.Ready);
}
public override void EnterCombat(Unit who) { }
public override void JustSummoned(Creature summoned)
{
summoned.GetAI().AttackStart(me);
}
public override void sQuestAccept(Player player, Quest quest)
{
if (quest.Id == QuestIds.FreedomToRuul)
{
me.SetFaction(Misc.FactionQuest);
base.Start(true, false, player.GetGUID());
}
}
public override void WaypointReached(uint waypointId)
{
Player player = GetPlayerForEscort();
if (!player)
return;
switch (waypointId)
{
case 0:
me.SetUInt32Value(UnitFields.Bytes1, 0);
GameObject cage = me.FindNearestGameObject(GameObjectIds.Cage, 20);
if (cage)
cage.SetGoState(GameObjectState.Active);
break;
case 13:
me.SummonCreature(CreatureIds.ThistlefurTotemic, Misc.RuulSnowhoofSummonsCoord[0], TempSummonType.DeadDespawn, 60000);
me.SummonCreature(CreatureIds.ThistlefurUrsa, Misc.RuulSnowhoofSummonsCoord[1], TempSummonType.DeadDespawn, 60000);
me.SummonCreature(CreatureIds.ThistlefurPathfinder, Misc.RuulSnowhoofSummonsCoord[2], TempSummonType.DeadDespawn, 60000);
break;
case 19:
me.SummonCreature(CreatureIds.ThistlefurTotemic, Misc.RuulSnowhoofSummonsCoord[3], TempSummonType.DeadDespawn, 60000);
me.SummonCreature(CreatureIds.ThistlefurUrsa, Misc.RuulSnowhoofSummonsCoord[4], TempSummonType.DeadDespawn, 60000);
me.SummonCreature(CreatureIds.ThistlefurPathfinder, Misc.RuulSnowhoofSummonsCoord[5], TempSummonType.DeadDespawn, 60000);
break;
case 21:
player.GroupEventHappens(QuestIds.FreedomToRuul, me);
break;
}
}
public override void UpdateAI(uint diff)
{
base.UpdateAI(diff);
} }
} }
public override CreatureAI GetAI(Creature creature) public override void WaypointReached(uint waypointId)
{ {
return new npc_ruul_snowhoofAI(creature); Player player = GetPlayerForEscort();
if (!player)
return;
switch (waypointId)
{
case 0:
me.SetUInt32Value(UnitFields.Bytes1, 0);
GameObject cage = me.FindNearestGameObject(GameObjectIds.Cage, 20);
if (cage)
cage.SetGoState(GameObjectState.Active);
break;
case 13:
me.SummonCreature(CreatureIds.ThistlefurTotemic, Misc.RuulSnowhoofSummonsCoord[0], TempSummonType.DeadDespawn, 60000);
me.SummonCreature(CreatureIds.ThistlefurUrsa, Misc.RuulSnowhoofSummonsCoord[1], TempSummonType.DeadDespawn, 60000);
me.SummonCreature(CreatureIds.ThistlefurPathfinder, Misc.RuulSnowhoofSummonsCoord[2], TempSummonType.DeadDespawn, 60000);
break;
case 19:
me.SummonCreature(CreatureIds.ThistlefurTotemic, Misc.RuulSnowhoofSummonsCoord[3], TempSummonType.DeadDespawn, 60000);
me.SummonCreature(CreatureIds.ThistlefurUrsa, Misc.RuulSnowhoofSummonsCoord[4], TempSummonType.DeadDespawn, 60000);
me.SummonCreature(CreatureIds.ThistlefurPathfinder, Misc.RuulSnowhoofSummonsCoord[5], TempSummonType.DeadDespawn, 60000);
break;
case 21:
player.GroupEventHappens(QuestIds.FreedomToRuul, me);
break;
}
}
public override void UpdateAI(uint diff)
{
base.UpdateAI(diff);
} }
} }
[Script] [Script]
class npc_muglash : CreatureScript public class npc_muglash : npc_escortAI
{ {
public npc_muglash() : base("npc_muglash") { } public npc_muglash(Creature creature) : base(creature)
public class npc_muglashAI : npc_escortAI
{ {
public npc_muglashAI(Creature creature) : base(creature) Initialize();
{ }
Initialize();
}
void Initialize() void Initialize()
{ {
eventTimer = 10000; eventTimer = 10000;
waveId = 0; waveId = 0;
_isBrazierExtinguished = false; _isBrazierExtinguished = false;
} }
public override void Reset() public override void Reset()
{ {
Initialize(); Initialize();
} }
public override void EnterCombat(Unit who) public override void EnterCombat(Unit who)
{
Player player = GetPlayerForEscort();
if (player)
{ {
Player player = GetPlayerForEscort(); if (HasEscortState(eEscortState.Paused))
if (player)
{ {
if (HasEscortState(eEscortState.Paused)) if (Convert.ToBoolean(RandomHelper.URand(0, 1)))
{ Talk(TextIds.SayMugOnGuard, player);
if (Convert.ToBoolean(RandomHelper.URand(0, 1)))
Talk(TextIds.SayMugOnGuard, player);
return;
}
}
}
public override void JustDied(Unit killer)
{
if (HasEscortState(eEscortState.Escorting))
{
Player player = GetPlayerForEscort();
if (player)
player.FailQuest(QuestIds.Vorsha);
}
}
public override void JustSummoned(Creature summoned)
{
summoned.GetAI().AttackStart(me);
}
public override void sQuestAccept(Player player, Quest quest)
{
if (quest.Id == QuestIds.Vorsha)
{
Talk(TextIds.SayMugStart1);
me.SetFaction(Misc.FactionQuest);
base.Start(true, false, player.GetGUID());
}
}
public override void WaypointReached(uint waypointId)
{
Player player = GetPlayerForEscort();
if (player)
{
switch (waypointId)
{
case 0:
Talk(TextIds.SayMugStart2, player);
break;
case 24:
Talk(TextIds.SayMugBrazier, player);
GameObject go = GetClosestGameObjectWithEntry(me, GameObjectIds.NagaBrazier, SharedConst.InteractionDistance * 2);
if (go)
{
go.RemoveFlag(GameObjectFields.Flags, GameObjectFlags.NotSelectable);
SetEscortPaused(true);
}
break;
case 25:
Talk(TextIds.SayMugGratitude);
player.GroupEventHappens(QuestIds.Vorsha, me);
break;
case 26:
Talk(TextIds.SayMugPatrol);
break;
case 27:
Talk(TextIds.SayMugReturn);
break;
}
}
}
void DoWaveSummon()
{
switch (waveId)
{
case 1:
me.SummonCreature(CreatureIds.WrathRider, Misc.FirstNagaCoord[0], TempSummonType.TimedDespawnOOC, 60000);
me.SummonCreature(CreatureIds.WrathSorceress, Misc.FirstNagaCoord[1], TempSummonType.TimedDespawnOOC, 60000);
me.SummonCreature(CreatureIds.WrathRazortail, Misc.FirstNagaCoord[2], TempSummonType.TimedDespawnOOC, 60000);
break;
case 2:
me.SummonCreature(CreatureIds.WrathPriestess, Misc.SecondNagaCoord[0], TempSummonType.TimedDespawnOOC, 60000);
me.SummonCreature(CreatureIds.WrathMyrmidon, Misc.SecondNagaCoord[1], TempSummonType.TimedDespawnOOC, 60000);
me.SummonCreature(CreatureIds.WrathSeawitch, Misc.SecondNagaCoord[2], TempSummonType.TimedDespawnOOC, 60000);
break;
case 3:
me.SummonCreature(CreatureIds.Vorsha, Misc.VorshaCoord, TempSummonType.TimedDespawnOOC, 60000);
break;
case 4:
SetEscortPaused(false);
Talk(TextIds.SayMugDone);
break;
}
}
public override void UpdateAI(uint diff)
{
base.UpdateAI(diff);
if (!me.GetVictim())
{
if (HasEscortState(eEscortState.Paused) && _isBrazierExtinguished)
{
if (eventTimer < diff)
{
++waveId;
DoWaveSummon();
eventTimer = 10000;
}
else
eventTimer -= diff;
}
return; return;
} }
DoMeleeAttackIfReady();
} }
uint eventTimer;
byte waveId;
public bool _isBrazierExtinguished { get; set; }
} }
public override CreatureAI GetAI(Creature creature) public override void JustDied(Unit killer)
{ {
return new npc_muglashAI(creature); if (HasEscortState(eEscortState.Escorting))
{
Player player = GetPlayerForEscort();
if (player)
player.FailQuest(QuestIds.Vorsha);
}
} }
public override void JustSummoned(Creature summoned)
{
summoned.GetAI().AttackStart(me);
}
public override void sQuestAccept(Player player, Quest quest)
{
if (quest.Id == QuestIds.Vorsha)
{
Talk(TextIds.SayMugStart1);
me.SetFaction(Misc.FactionQuest);
base.Start(true, false, player.GetGUID());
}
}
public override void WaypointReached(uint waypointId)
{
Player player = GetPlayerForEscort();
if (player)
{
switch (waypointId)
{
case 0:
Talk(TextIds.SayMugStart2, player);
break;
case 24:
Talk(TextIds.SayMugBrazier, player);
GameObject go = GetClosestGameObjectWithEntry(me, GameObjectIds.NagaBrazier, SharedConst.InteractionDistance * 2);
if (go)
{
go.RemoveFlag(GameObjectFields.Flags, GameObjectFlags.NotSelectable);
SetEscortPaused(true);
}
break;
case 25:
Talk(TextIds.SayMugGratitude);
player.GroupEventHappens(QuestIds.Vorsha, me);
break;
case 26:
Talk(TextIds.SayMugPatrol);
break;
case 27:
Talk(TextIds.SayMugReturn);
break;
}
}
}
void DoWaveSummon()
{
switch (waveId)
{
case 1:
me.SummonCreature(CreatureIds.WrathRider, Misc.FirstNagaCoord[0], TempSummonType.TimedDespawnOOC, 60000);
me.SummonCreature(CreatureIds.WrathSorceress, Misc.FirstNagaCoord[1], TempSummonType.TimedDespawnOOC, 60000);
me.SummonCreature(CreatureIds.WrathRazortail, Misc.FirstNagaCoord[2], TempSummonType.TimedDespawnOOC, 60000);
break;
case 2:
me.SummonCreature(CreatureIds.WrathPriestess, Misc.SecondNagaCoord[0], TempSummonType.TimedDespawnOOC, 60000);
me.SummonCreature(CreatureIds.WrathMyrmidon, Misc.SecondNagaCoord[1], TempSummonType.TimedDespawnOOC, 60000);
me.SummonCreature(CreatureIds.WrathSeawitch, Misc.SecondNagaCoord[2], TempSummonType.TimedDespawnOOC, 60000);
break;
case 3:
me.SummonCreature(CreatureIds.Vorsha, Misc.VorshaCoord, TempSummonType.TimedDespawnOOC, 60000);
break;
case 4:
SetEscortPaused(false);
Talk(TextIds.SayMugDone);
break;
}
}
public override void UpdateAI(uint diff)
{
base.UpdateAI(diff);
if (!me.GetVictim())
{
if (HasEscortState(eEscortState.Paused) && _isBrazierExtinguished)
{
if (eventTimer < diff)
{
++waveId;
DoWaveSummon();
eventTimer = 10000;
}
else
eventTimer -= diff;
}
return;
}
DoMeleeAttackIfReady();
}
uint eventTimer;
byte waveId;
public bool _isBrazierExtinguished { get; set; }
} }
[Script] [Script]
@@ -336,7 +316,7 @@ namespace Scripts.Kalimdor.ZoneAshenvale
Creature creature = ScriptedAI.GetClosestCreatureWithEntry(go, CreatureIds.Muglash, SharedConst.InteractionDistance * 2); Creature creature = ScriptedAI.GetClosestCreatureWithEntry(go, CreatureIds.Muglash, SharedConst.InteractionDistance * 2);
if (creature) if (creature)
{ {
npc_muglash.npc_muglashAI pEscortAI = creature.GetAI<npc_muglash.npc_muglashAI>(); npc_muglash pEscortAI = creature.GetAI<npc_muglash>();
if (pEscortAI != null) if (pEscortAI != null)
{ {
creature.GetAI().Talk(TextIds.SayMugBrazierWait); creature.GetAI().Talk(TextIds.SayMugBrazierWait);
@@ -351,28 +331,18 @@ namespace Scripts.Kalimdor.ZoneAshenvale
} }
[Script] [Script]
class spell_destroy_karangs_banner : SpellScriptLoader class spell_destroy_karangs_banner : SpellScript
{ {
public spell_destroy_karangs_banner() : base("spell_destroy_karangs_banner") { } void HandleAfterCast()
class spell_destroy_karangs_banner_SpellScript : SpellScript
{ {
void HandleAfterCast() GameObject banner = GetCaster().FindNearestGameObject(GameObjectIds.Banner, GetSpellInfo().GetMaxRange(true));
{ if (banner)
GameObject banner = GetCaster().FindNearestGameObject(GameObjectIds.Banner, GetSpellInfo().GetMaxRange(true)); banner.Delete();
if (banner)
banner.Delete();
}
public override void Register()
{
AfterCast.Add(new CastHandler(HandleAfterCast));
}
} }
public override SpellScript GetSpellScript() public override void Register()
{ {
return new spell_destroy_karangs_banner_SpellScript(); AfterCast.Add(new CastHandler(HandleAfterCast));
} }
} }
} }
+73 -93
View File
@@ -26,118 +26,98 @@ using System;
namespace Scripts.Kalimdor namespace Scripts.Kalimdor
{ {
[Script] [Script]
class npc_lazy_peon : CreatureScript class npc_lazy_peon : NullCreatureAI
{ {
public npc_lazy_peon() : base("npc_lazy_peon") { } public npc_lazy_peon(Creature creature) : base(creature) { }
class npc_lazy_peonAI : NullCreatureAI public override void InitializeAI()
{ {
public npc_lazy_peonAI(Creature creature) : base(creature) { } me.SetWalk(true);
public override void InitializeAI() scheduler.Schedule(TimeSpan.FromSeconds(1), TimeSpan.FromMilliseconds(120000), task =>
{ {
me.SetWalk(true); GameObject Lumberpile = me.FindNearestGameObject(GoLumberpile, 20);
if (Lumberpile)
me.GetMotionMaster().MovePoint(1, Lumberpile.GetPositionX() - 1, Lumberpile.GetPositionY(), Lumberpile.GetPositionZ());
task.Repeat();
});
scheduler.Schedule(TimeSpan.FromSeconds(1), TimeSpan.FromMilliseconds(120000), task => scheduler.Schedule(TimeSpan.FromMilliseconds(300000), task =>
{
GameObject Lumberpile = me.FindNearestGameObject(GoLumberpile, 20);
if (Lumberpile)
me.GetMotionMaster().MovePoint(1, Lumberpile.GetPositionX() - 1, Lumberpile.GetPositionY(), Lumberpile.GetPositionZ());
task.Repeat();
});
scheduler.Schedule(TimeSpan.FromMilliseconds(300000), task =>
{
me.HandleEmoteCommand(Emote.StateNone);
me.GetMotionMaster().MovePoint(2, me.GetHomePosition());
task.Repeat();
});
}
public override void MovementInform(MovementGeneratorType type, uint id)
{ {
switch (id) me.HandleEmoteCommand(Emote.StateNone);
{ me.GetMotionMaster().MovePoint(2, me.GetHomePosition());
case 1: task.Repeat();
me.HandleEmoteCommand(Emote.StateWorkChopwood); });
break;
case 2:
DoCast(me, SpellBuffSleep);
break;
}
}
public override void SpellHit(Unit caster, SpellInfo spell)
{
if (spell.Id != SpellAwakenPeon)
return;
Player player = caster.ToPlayer();
if (player && player.GetQuestStatus(QuestLazyPeons) == QuestStatus.Incomplete)
{
player.KilledMonsterCredit(me.GetEntry(), me.GetGUID());
Talk(SaySpellHit, caster);
me.RemoveAllAuras();
GameObject Lumberpile = me.FindNearestGameObject(GoLumberpile, 20);
if (Lumberpile)
me.GetMotionMaster().MovePoint(1, Lumberpile.GetPositionX() - 1, Lumberpile.GetPositionY(), Lumberpile.GetPositionZ());
}
}
public override void UpdateAI(uint diff)
{
scheduler.Update(diff);
//if (!UpdateVictim())
//return;
//DoMeleeAttackIfReady();
}
const int QuestLazyPeons = 37446;
const int GoLumberpile = 175784;
const uint SpellBuffSleep = 17743;
const int SpellAwakenPeon = 19938;
const int SaySpellHit = 0;
TaskScheduler scheduler = new TaskScheduler();
} }
public override CreatureAI GetAI(Creature creature) public override void MovementInform(MovementGeneratorType type, uint id)
{ {
return new npc_lazy_peonAI(creature); switch (id)
{
case 1:
me.HandleEmoteCommand(Emote.StateWorkChopwood);
break;
case 2:
DoCast(me, SpellBuffSleep);
break;
}
} }
public override void SpellHit(Unit caster, SpellInfo spell)
{
if (spell.Id != SpellAwakenPeon)
return;
Player player = caster.ToPlayer();
if (player && player.GetQuestStatus(QuestLazyPeons) == QuestStatus.Incomplete)
{
player.KilledMonsterCredit(me.GetEntry(), me.GetGUID());
Talk(SaySpellHit, caster);
me.RemoveAllAuras();
GameObject Lumberpile = me.FindNearestGameObject(GoLumberpile, 20);
if (Lumberpile)
me.GetMotionMaster().MovePoint(1, Lumberpile.GetPositionX() - 1, Lumberpile.GetPositionY(), Lumberpile.GetPositionZ());
}
}
public override void UpdateAI(uint diff)
{
scheduler.Update(diff);
//if (!UpdateVictim())
//return;
//DoMeleeAttackIfReady();
}
const int QuestLazyPeons = 37446;
const int GoLumberpile = 175784;
const uint SpellBuffSleep = 17743;
const int SpellAwakenPeon = 19938;
const int SaySpellHit = 0;
TaskScheduler scheduler = new TaskScheduler();
} }
[Script] [Script]
class spell_voodoo : SpellScriptLoader class spell_voodoo : SpellScript
{ {
public spell_voodoo() : base("spell_voodoo") { } public override bool Validate(SpellInfo spellInfo)
class spell_voodoo_SpellScript : SpellScript
{ {
public override bool Validate(SpellInfo spellInfo) return ValidateSpellInfo(SpellBrew, SpellGhostly, SpellHex1, SpellHex2, SpellHex3, SpellGrow, SpellLaunch);
{
return ValidateSpellInfo(SpellBrew, SpellGhostly, SpellHex1, SpellHex2, SpellHex3, SpellGrow, SpellLaunch);
}
void HandleDummy(uint effIndex)
{
uint spellid = RandomHelper.RAND(SpellBrew, SpellGhostly, RandomHelper.RAND(SpellHex1, SpellHex2, SpellHex3), SpellGrow, SpellLaunch);
Unit target = GetHitUnit();
if (target)
GetCaster().CastSpell(target, spellid, false);
}
public override void Register()
{
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
}
} }
public override SpellScript GetSpellScript() void HandleDummy(uint effIndex)
{ {
return new spell_voodoo_SpellScript(); uint spellid = RandomHelper.RAND(SpellBrew, SpellGhostly, RandomHelper.RAND(SpellHex1, SpellHex2, SpellHex3), SpellGrow, SpellLaunch);
Unit target = GetHitUnit();
if (target)
GetCaster().CastSpell(target, spellid, false);
}
public override void Register()
{
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
} }
const uint SpellBrew = 16712; // Special Brew const uint SpellBrew = 16712; // Special Brew
@@ -45,165 +45,145 @@ namespace Scripts.Northrend.AzjolNerub.Ahnkahet.Amanitar
} }
[Script] [Script]
class boss_amanitar : CreatureScript class boss_amanitar : BossAI
{ {
public boss_amanitar() : base("boss_amanitar") { } public boss_amanitar(Creature creature) : base(creature, DataTypes.Amanitar) { }
class boss_amanitarAI : BossAI public override void Reset()
{ {
public boss_amanitarAI(Creature creature) : base(creature, DataTypes.Amanitar) { } _Reset();
me.SetMeleeDamageSchool(SpellSchools.Nature);
me.ApplySpellImmune(0, SpellImmunity.School, SpellSchoolMask.Nature, true);
}
public override void Reset() public override void EnterCombat(Unit who)
{
_EnterCombat();
_scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting));
_scheduler.Schedule(TimeSpan.FromSeconds(5), task =>
{ {
_Reset(); SpawnAdds();
me.SetMeleeDamageSchool(SpellSchools.Nature); task.Repeat(TimeSpan.FromSeconds(20));
me.ApplySpellImmune(0, SpellImmunity.School, SpellSchoolMask.Nature, true); });
} _scheduler.Schedule(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(9), task =>
public override void EnterCombat(Unit who)
{ {
_EnterCombat(); DoCast(SelectTarget(SelectAggroTarget.Random, 0, 100, true), SpellIds.EntanglingRoots, true);
task.Repeat(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(15));
_scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting)); });
_scheduler.Schedule(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(14), task =>
_scheduler.Schedule(TimeSpan.FromSeconds(5), task =>
{
SpawnAdds();
task.Repeat(TimeSpan.FromSeconds(20));
});
_scheduler.Schedule(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(9), task =>
{
DoCast(SelectTarget(SelectAggroTarget.Random, 0, 100, true), SpellIds.EntanglingRoots, true);
task.Repeat(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(15));
});
_scheduler.Schedule(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(14), task =>
{
DoCastVictim(SpellIds.Bash);
task.Repeat(TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(12));
});
_scheduler.Schedule(TimeSpan.FromSeconds(12), TimeSpan.FromSeconds(18), task =>
{
DoCast(SpellIds.Mini);
task.Repeat(TimeSpan.FromSeconds(25), TimeSpan.FromSeconds(30));
});
_scheduler.Schedule(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(20), task =>
{
DoCast(SelectTarget(SelectAggroTarget.Random, 0, 100, true), SpellIds.VenomBoltVolley, true);
task.Repeat(TimeSpan.FromSeconds(18), TimeSpan.FromSeconds(22));
});
}
public override void JustDied(Unit killer)
{ {
_JustDied(); DoCastVictim(SpellIds.Bash);
instance.DoRemoveAurasDueToSpellOnPlayers(SpellIds.Mini); task.Repeat(TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(12));
} });
_scheduler.Schedule(TimeSpan.FromSeconds(12), TimeSpan.FromSeconds(18), task =>
void SpawnAdds()
{ {
int u = 0; DoCast(SpellIds.Mini);
task.Repeat(TimeSpan.FromSeconds(25), TimeSpan.FromSeconds(30));
});
_scheduler.Schedule(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(20), task =>
{
DoCast(SelectTarget(SelectAggroTarget.Random, 0, 100, true), SpellIds.VenomBoltVolley, true);
task.Repeat(TimeSpan.FromSeconds(18), TimeSpan.FromSeconds(22));
});
}
for (byte i = 0; i < 30; ++i) public override void JustDied(Unit killer)
{
_JustDied();
instance.DoRemoveAurasDueToSpellOnPlayers(SpellIds.Mini);
}
void SpawnAdds()
{
int u = 0;
for (byte i = 0; i < 30; ++i)
{
Position pos = me.GetRandomNearPosition(30.0f);
pos.posZ = me.GetMap().GetHeight(pos.GetPositionX(), pos.GetPositionY(), MapConst.MaxHeight) + 2.0f;
Creature trigger = me.SummonCreature(CreatureIds.Trigger, pos);
if (trigger)
{ {
Position pos = me.GetRandomNearPosition(30.0f); Creature temp1 = trigger.FindNearestCreature(CreatureIds.HealthyMushroom, 4.0f, true);
pos.posZ = me.GetMap().GetHeight(pos.GetPositionX(), pos.GetPositionY(), MapConst.MaxHeight) + 2.0f; Creature temp2 = trigger.FindNearestCreature(CreatureIds.PoisonousMushroom, 4.0f, true);
if (temp1 || temp2)
Creature trigger = me.SummonCreature(CreatureIds.Trigger, pos);
if (trigger)
{ {
Creature temp1 = trigger.FindNearestCreature(CreatureIds.HealthyMushroom, 4.0f, true); trigger.DisappearAndDie();
Creature temp2 = trigger.FindNearestCreature(CreatureIds.PoisonousMushroom, 4.0f, true); }
if (temp1 || temp2) else
{ {
trigger.DisappearAndDie(); u = 1 - u;
} trigger.DisappearAndDie();
else me.SummonCreature(u > 0 ? CreatureIds.PoisonousMushroom : CreatureIds.HealthyMushroom, pos, TempSummonType.TimedOrCorpseDespawn, 60 * Time.InMilliseconds);
{
u = 1 - u;
trigger.DisappearAndDie();
me.SummonCreature(u > 0 ? CreatureIds.PoisonousMushroom : CreatureIds.HealthyMushroom, pos, TempSummonType.TimedOrCorpseDespawn, 60 * Time.InMilliseconds);
}
} }
} }
} }
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
DoMeleeAttackIfReady();
}
} }
public override CreatureAI GetAI(Creature creature) public override void UpdateAI(uint diff)
{ {
return GetInstanceAI<boss_amanitarAI>(creature); if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
DoMeleeAttackIfReady();
} }
} }
[Script] [Script]
class npc_amanitar_mushrooms : CreatureScript class npc_amanitar_mushrooms : ScriptedAI
{ {
public npc_amanitar_mushrooms() : base("npc_amanitar_mushrooms") { } public npc_amanitar_mushrooms(Creature creature) : base(creature) { }
class npc_amanitar_mushroomsAI : ScriptedAI public override void Reset()
{ {
public npc_amanitar_mushroomsAI(Creature creature) : base(creature) { } _scheduler.CancelAll();
_scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting));
public override void Reset() _scheduler.Schedule(TimeSpan.FromSeconds(1), task =>
{ {
_scheduler.CancelAll();
_scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting));
_scheduler.Schedule(TimeSpan.FromSeconds(1), task =>
{
if (me.GetEntry() == CreatureIds.PoisonousMushroom)
{
DoCast(me, SpellIds.PoisonousMushroomVisualArea, true);
DoCast(me, SpellIds.PoisonousMushroomPoisonCloud);
}
task.Repeat(TimeSpan.FromSeconds(7));
});
me.SetDisplayId(me.GetCreatureTemplate().ModelId2);
DoCast(SpellIds.PutridMushroom);
if (me.GetEntry() == CreatureIds.PoisonousMushroom) if (me.GetEntry() == CreatureIds.PoisonousMushroom)
DoCast(SpellIds.PoisonousMushroomVisualAura); {
else DoCast(me, SpellIds.PoisonousMushroomVisualArea, true);
DoCast(SpellIds.PowerMushroomVisualAura); DoCast(me, SpellIds.PoisonousMushroomPoisonCloud);
} }
task.Repeat(TimeSpan.FromSeconds(7));
});
public override void DamageTaken(Unit attacker, ref uint damage) me.SetDisplayId(me.GetCreatureTemplate().ModelId2);
{ DoCast(SpellIds.PutridMushroom);
if (damage >= me.GetHealth() && me.GetEntry() == CreatureIds.HealthyMushroom)
DoCast(me, SpellIds.HealthyMushroomPotentFungus, true);
}
public override void EnterCombat(Unit who) { } if (me.GetEntry() == CreatureIds.PoisonousMushroom)
public override void AttackStart(Unit victim) { } DoCast(SpellIds.PoisonousMushroomVisualAura);
else
public override void UpdateAI(uint diff) DoCast(SpellIds.PowerMushroomVisualAura);
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
}
} }
public override CreatureAI GetAI(Creature creature) public override void DamageTaken(Unit attacker, ref uint damage)
{ {
return new npc_amanitar_mushroomsAI(creature); if (damage >= me.GetHealth() && me.GetEntry() == CreatureIds.HealthyMushroom)
DoCast(me, SpellIds.HealthyMushroomPotentFungus, true);
}
public override void EnterCombat(Unit who) { }
public override void AttackStart(Unit victim) { }
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
} }
} }
} }
@@ -54,213 +54,184 @@ namespace Scripts.Northrend.AzjolNerub.Ahnkahet.ElderNadox
} }
[Script] [Script]
class boss_elder_nadox : CreatureScript class boss_elder_nadox : BossAI
{ {
public boss_elder_nadox() : base("boss_elder_nadox") { } public boss_elder_nadox(Creature creature) : base(creature, DataTypes.ElderNadox)
class boss_elder_nadoxAI : BossAI
{ {
public boss_elder_nadoxAI(Creature creature) : base(creature, DataTypes.ElderNadox) Initialize();
{ }
Initialize();
}
void Initialize() void Initialize()
{ {
GuardianSummoned = false; GuardianSummoned = false;
GuardianDied = false; GuardianDied = false;
} }
public override void Reset() public override void Reset()
{ {
_Reset(); _Reset();
Initialize(); Initialize();
} }
public override void EnterCombat(Unit who) public override void EnterCombat(Unit who)
{ {
_EnterCombat(); _EnterCombat();
Talk(TextIds.SayAggro); Talk(TextIds.SayAggro);
_scheduler.Schedule(TimeSpan.FromSeconds(13), task => _scheduler.Schedule(TimeSpan.FromSeconds(13), task =>
{
DoCast(SelectTarget(SelectAggroTarget.Random, 0, 100, true), SpellIds.BroodPlague, true);
task.Repeat(TimeSpan.FromSeconds(15));
});
_scheduler.Schedule(TimeSpan.FromSeconds(10), task =>
{
/// @todo: summoned by egg
DoCast(me, SpellIds.SummonSwarmers);
if (RandomHelper.URand(1, 3) == 3) // 33% chance of dialog
Talk(TextIds.SayEggSac);
task.Repeat();
});
if (IsHeroic())
{
_scheduler.Schedule(TimeSpan.FromSeconds(12), task =>
{ {
DoCast(SelectTarget(SelectAggroTarget.Random, 0, 100, true), SpellIds.BroodPlague, true); DoCast(SpellIds.HBroodRage);
task.Repeat(TimeSpan.FromSeconds(15)); task.Repeat(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(50));
}); });
_scheduler.Schedule(TimeSpan.FromSeconds(10), task => _scheduler.Schedule(TimeSpan.FromSeconds(5), task =>
{ {
/// @todo: summoned by egg if (me.HasAura(SpellIds.Enrage))
DoCast(me, SpellIds.SummonSwarmers); return;
if (RandomHelper.URand(1, 3) == 3) // 33% chance of dialog if (me.GetPositionZ() < 24.0f)
Talk(TextIds.SayEggSac); DoCast(me, SpellIds.Enrage, true);
task.Repeat(); task.Repeat();
}); });
if (IsHeroic())
{
_scheduler.Schedule(TimeSpan.FromSeconds(12), task =>
{
DoCast(SpellIds.HBroodRage);
task.Repeat(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(50));
});
_scheduler.Schedule(TimeSpan.FromSeconds(5), task =>
{
if (me.HasAura(SpellIds.Enrage))
return;
if (me.GetPositionZ() < 24.0f)
DoCast(me, SpellIds.Enrage, true);
task.Repeat();
});
}
} }
public override void SummonedCreatureDies(Creature summon, Unit killer)
{
if (summon.GetEntry() == AKCreatureIds.AhnkaharGuardian)
GuardianDied = true;
}
public override uint GetData(uint type)
{
if (type == Misc.DataRespectYourElders)
return !GuardianDied ? 1 : 0u;
return 0;
}
public override void KilledUnit(Unit who)
{
if (who.IsTypeId(TypeId.Player))
Talk(TextIds.SaySlay);
}
public override void JustDied(Unit killer)
{
_JustDied();
Talk(TextIds.SayDeath);
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (!GuardianSummoned && me.HealthBelowPct(50))
{
/// @todo: summoned by egg
Talk(TextIds.EmoteHatches, me);
DoCast(me, SpellIds.SummonSwarmGuard);
GuardianSummoned = true;
}
DoMeleeAttackIfReady();
}
bool GuardianSummoned;
bool GuardianDied;
} }
public override CreatureAI GetAI(Creature creature) public override void SummonedCreatureDies(Creature summon, Unit killer)
{ {
return GetInstanceAI<boss_elder_nadoxAI>(creature, "instance_ahnkahet"); if (summon.GetEntry() == AKCreatureIds.AhnkaharGuardian)
GuardianDied = true;
} }
public override uint GetData(uint type)
{
if (type == Misc.DataRespectYourElders)
return !GuardianDied ? 1 : 0u;
return 0;
}
public override void KilledUnit(Unit who)
{
if (who.IsTypeId(TypeId.Player))
Talk(TextIds.SaySlay);
}
public override void JustDied(Unit killer)
{
_JustDied();
Talk(TextIds.SayDeath);
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (!GuardianSummoned && me.HealthBelowPct(50))
{
/// @todo: summoned by egg
Talk(TextIds.EmoteHatches, me);
DoCast(me, SpellIds.SummonSwarmGuard);
GuardianSummoned = true;
}
DoMeleeAttackIfReady();
}
bool GuardianSummoned;
bool GuardianDied;
} }
[Script] [Script]
class npc_ahnkahar_nerubian : CreatureScript class npc_ahnkahar_nerubian : ScriptedAI
{ {
public npc_ahnkahar_nerubian() : base("npc_ahnkahar_nerubian") { } public npc_ahnkahar_nerubian(Creature creature) : base(creature) { }
class npc_ahnkahar_nerubianAI : ScriptedAI public override void Reset()
{ {
public npc_ahnkahar_nerubianAI(Creature creature) : base(creature) { } _scheduler.CancelAll();
_scheduler.Schedule(TimeSpan.FromSeconds(13), task =>
public override void Reset()
{ {
_scheduler.CancelAll(); DoCast(me, SpellIds.Sprint);
_scheduler.Schedule(TimeSpan.FromSeconds(13), task => task.Repeat(TimeSpan.FromSeconds(20));
{ });
DoCast(me, SpellIds.Sprint);
task.Repeat(TimeSpan.FromSeconds(20));
});
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
if (me.HasUnitState(UnitState.Casting))
return;
_scheduler.Update(diff);
DoMeleeAttackIfReady();
}
} }
public override CreatureAI GetAI(Creature creature) public override void UpdateAI(uint diff)
{ {
return new npc_ahnkahar_nerubianAI(creature); if (!UpdateVictim())
return;
if (me.HasUnitState(UnitState.Casting))
return;
_scheduler.Update(diff);
DoMeleeAttackIfReady();
} }
} }
// 56159 - Swarm // 56159 - Swarm
[Script] [Script]
class spell_ahn_kahet_swarm : SpellScriptLoader class spell_ahn_kahet_swarm : SpellScript
{ {
public spell_ahn_kahet_swarm() : base("spell_ahn_kahet_swarm") { } public spell_ahn_kahet_swarm()
class spell_ahn_kahet_swarm_SpellScript : SpellScript
{ {
public spell_ahn_kahet_swarm_SpellScript() _targetCount = 0;
{ }
_targetCount = 0;
}
public override bool Validate(SpellInfo spellInfo) public override bool Validate(SpellInfo spellInfo)
{ {
return ValidateSpellInfo(SpellIds.SwarmBuff); return ValidateSpellInfo(SpellIds.SwarmBuff);
} }
void CountTargets(List<WorldObject> targets) void CountTargets(List<WorldObject> targets)
{ {
_targetCount = targets.Count; _targetCount = targets.Count;
} }
void HandleDummy(uint effIndex) void HandleDummy(uint effIndex)
{
if (_targetCount != 0)
{ {
if (_targetCount != 0) Aura aura = GetCaster().GetAura(SpellIds.SwarmBuff);
{ Aura aura = GetCaster().GetAura(SpellIds.SwarmBuff); if (aura != null)
if (aura != null) {
{ aura.SetStackAmount((byte)_targetCount);
aura.SetStackAmount((byte)_targetCount); aura.RefreshDuration();
aura.RefreshDuration();
}
else
GetCaster().CastCustomSpell(SpellIds.SwarmBuff, SpellValueMod.AuraStack, _targetCount, GetCaster(), TriggerCastFlags.FullMask);
} }
else else
GetCaster().RemoveAurasDueToSpell(SpellIds.SwarmBuff); GetCaster().CastCustomSpell(SpellIds.SwarmBuff, SpellValueMod.AuraStack, _targetCount, GetCaster(), TriggerCastFlags.FullMask);
} }
else
public override void Register() GetCaster().RemoveAurasDueToSpell(SpellIds.SwarmBuff);
{
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(CountTargets, 0, Targets.UnitSrcAreaAlly));
OnEffectHit.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
}
int _targetCount;
} }
public override SpellScript GetSpellScript() public override void Register()
{ {
return new spell_ahn_kahet_swarm_SpellScript(); OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(CountTargets, 0, Targets.UnitSrcAreaAlly));
OnEffectHit.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
} }
int _targetCount;
} }
[Script] [Script]
@@ -56,240 +56,233 @@ namespace Scripts.Northrend.AzjolNerub.Ahnkahet.HeraldVolazj
} }
[Script] [Script]
class boss_volazj : CreatureScript class boss_volazj : ScriptedAI
{ {
public boss_volazj() : base("boss_volazj") { } public boss_volazj(Creature creature) : base(creature)
class boss_volazjAI : ScriptedAI
{ {
public boss_volazjAI(Creature creature) : base(creature) Summons = new SummonList(me);
{
Summons = new SummonList(me);
Initialize(); Initialize();
instance = creature.GetInstanceScript(); instance = creature.GetInstanceScript();
}
void Initialize()
{
uiMindFlayTimer = 8 * Time.InMilliseconds;
uiShadowBoltVolleyTimer = 5 * Time.InMilliseconds;
uiShiverTimer = 15 * Time.InMilliseconds;
// Used for Insanity handling
insanityHandled = 0;
}
// returns the percentage of health after taking the given damage.
uint GetHealthPct(uint damage)
{
if (damage > me.GetHealth())
return 0;
return (uint)(100 * (me.GetHealth() - damage) / me.GetMaxHealth());
}
public override void DamageTaken(Unit pAttacker, ref uint damage)
{
if (me.HasFlag(UnitFields.Flags, UnitFlags.NotSelectable))
damage = 0;
if ((GetHealthPct(0) >= 66 && GetHealthPct(damage) < 66) ||
(GetHealthPct(0) >= 33 && GetHealthPct(damage) < 33))
{
me.InterruptNonMeleeSpells(false);
DoCast(me, SpellIds.Insanity, false);
} }
}
void Initialize() public override void SpellHitTarget(Unit target, SpellInfo spell)
{
if (spell.Id == SpellIds.Insanity)
{ {
uiMindFlayTimer = 8 * Time.InMilliseconds; // Not good target or too many players
uiShadowBoltVolleyTimer = 5 * Time.InMilliseconds; if (target.GetTypeId() != TypeId.Player || insanityHandled > 4)
uiShiverTimer = 15 * Time.InMilliseconds; return;
// Used for Insanity handling // First target - start channel visual and set self as unnattackable
insanityHandled = 0; if (insanityHandled == 0)
}
// returns the percentage of health after taking the given damage.
uint GetHealthPct(uint damage)
{
if (damage > me.GetHealth())
return 0;
return (uint)(100 * (me.GetHealth() - damage) / me.GetMaxHealth());
}
public override void DamageTaken(Unit pAttacker, ref uint damage)
{
if (me.HasFlag(UnitFields.Flags, UnitFlags.NotSelectable))
damage = 0;
if ((GetHealthPct(0) >= 66 && GetHealthPct(damage) < 66) ||
(GetHealthPct(0) >= 33 && GetHealthPct(damage) < 33))
{ {
me.InterruptNonMeleeSpells(false); // Channel visual
DoCast(me, SpellIds.Insanity, false); DoCast(me, SpellIds.InsanityVisual, true);
// Unattackable
me.SetFlag(UnitFields.Flags, UnitFlags.NotSelectable);
me.SetControlled(true, UnitState.Stunned);
} }
}
public override void SpellHitTarget(Unit target, SpellInfo spell) // phase the player
{ target.CastSpell(target, SpellIds.InsanityTarget + insanityHandled, true);
if (spell.Id == SpellIds.Insanity)
{
// Not good target or too many players
if (target.GetTypeId() != TypeId.Player || insanityHandled > 4)
return;
// First target - start channel visual and set self as unnattackable
if (insanityHandled == 0)
{
// Channel visual
DoCast(me, SpellIds.InsanityVisual, true);
// Unattackable
me.SetFlag(UnitFields.Flags, UnitFlags.NotSelectable);
me.SetControlled(true, UnitState.Stunned);
}
// phase the player SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.InsanityTarget + insanityHandled);
target.CastSpell(target, SpellIds.InsanityTarget + insanityHandled, true); if (spellInfo == null)
return;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.InsanityTarget + insanityHandled); // summon twisted party members for this target
if (spellInfo == null)
return;
// summon twisted party members for this target
var players = me.GetMap().GetPlayers();
foreach (var player in players)
{
if (!player || !player.IsAlive())
continue;
// Summon clone
Unit summon = me.SummonCreature(AKCreatureIds.TwistedVisage, me.GetPositionX(), me.GetPositionY(), me.GetPositionZ(), me.GetOrientation(), TempSummonType.CorpseDespawn, 0);
if (summon)
{
// clone
player.CastSpell(summon, SpellIds.ClonePlayer, true);
// phase the summon
summon.SetInPhase((uint)spellInfo.GetEffect(0).MiscValueB, true, true);
}
}
++insanityHandled;
}
}
void ResetPlayersPhase()
{
var players = me.GetMap().GetPlayers(); var players = me.GetMap().GetPlayers();
foreach (var player in players) foreach (var player in players)
{
if (!player || !player.IsAlive())
continue;
// Summon clone
Unit summon = me.SummonCreature(AKCreatureIds.TwistedVisage, me.GetPositionX(), me.GetPositionY(), me.GetPositionZ(), me.GetOrientation(), TempSummonType.CorpseDespawn, 0);
if (summon)
{
// clone
player.CastSpell(summon, SpellIds.ClonePlayer, true);
// phase the summon
summon.SetInPhase((uint)spellInfo.GetEffect(0).MiscValueB, true, true);
}
}
++insanityHandled;
}
}
void ResetPlayersPhase()
{
var players = me.GetMap().GetPlayers();
foreach (var player in players)
{
for (uint index = 0; index <= 4; ++index)
player.RemoveAurasDueToSpell(SpellIds.InsanityTarget + index);
}
}
public override void Reset()
{
Initialize();
instance.SetBossState(DataTypes.HeraldVolazj, EncounterState.NotStarted);
instance.DoStopCriteriaTimer(CriteriaTimedTypes.Event, Misc.AchievQuickDemiseStartEvent);
// Visible for all players in insanity
me.SetInPhase(169, true, true);
for (uint i = 173; i <= 177; ++i)
me.SetInPhase(i, true, true);
ResetPlayersPhase();
// Cleanup
Summons.DespawnAll();
me.RemoveFlag(UnitFields.Flags, UnitFlags.NotSelectable);
me.SetControlled(false, UnitState.Stunned);
}
public override void EnterCombat(Unit who)
{
Talk(TextIds.SayAggro);
instance.SetBossState(DataTypes.HeraldVolazj, EncounterState.InProgress);
instance.DoStartCriteriaTimer(CriteriaTimedTypes.Event, Misc.AchievQuickDemiseStartEvent);
}
public override void JustSummoned(Creature summon)
{
Summons.Summon(summon);
}
public override void SummonedCreatureDespawn(Creature summon)
{
uint nextPhase = 0;
Summons.Despawn(summon);
// Check if all summons in this phase killed
foreach (var guid in Summons)
{
Creature visage = ObjectAccessor.GetCreature(me, guid);
if (visage)
{
// Not all are dead
if (visage.IsInPhase(summon))
return;
else
{
nextPhase = visage.GetPhases().First();
break;
}
}
}
// Roll Insanity
var players = me.GetMap().GetPlayers();
foreach (var player in players)
{
if (player)
{ {
for (uint index = 0; index <= 4; ++index) for (uint index = 0; index <= 4; ++index)
player.RemoveAurasDueToSpell(SpellIds.InsanityTarget + index); player.RemoveAurasDueToSpell(SpellIds.InsanityTarget + index);
player.CastSpell(player, SpellIds.InsanityTarget + nextPhase - 173, true);
} }
} }
}
public override void Reset() public override void UpdateAI(uint diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
if (insanityHandled != 0)
{ {
Initialize(); if (!Summons.Empty())
instance.SetBossState(DataTypes.HeraldVolazj, EncounterState.NotStarted);
instance.DoStopCriteriaTimer(CriteriaTimedTypes.Event, Misc.AchievQuickDemiseStartEvent);
// Visible for all players in insanity
me.SetInPhase(169, true, true);
for (uint i = 173; i <= 177; ++i)
me.SetInPhase(i, true, true);
ResetPlayersPhase();
// Cleanup
Summons.DespawnAll();
me.RemoveFlag(UnitFields.Flags, UnitFlags.NotSelectable);
me.SetControlled(false, UnitState.Stunned);
}
public override void EnterCombat(Unit who)
{
Talk(TextIds.SayAggro);
instance.SetBossState(DataTypes.HeraldVolazj, EncounterState.InProgress);
instance.DoStartCriteriaTimer(CriteriaTimedTypes.Event, Misc.AchievQuickDemiseStartEvent);
}
public override void JustSummoned(Creature summon)
{
Summons.Summon(summon);
}
public override void SummonedCreatureDespawn(Creature summon)
{
uint nextPhase = 0;
Summons.Despawn(summon);
// Check if all summons in this phase killed
foreach (var guid in Summons)
{
Creature visage = ObjectAccessor.GetCreature(me, guid);
if (visage)
{
// Not all are dead
if (visage.IsInPhase(summon))
return;
else
{
nextPhase = visage.GetPhases().First();
break;
}
}
}
// Roll Insanity
var players = me.GetMap().GetPlayers();
foreach (var player in players)
{
if (player)
{
for (uint index = 0; index <= 4; ++index)
player.RemoveAurasDueToSpell(SpellIds.InsanityTarget + index);
player.CastSpell(player, SpellIds.InsanityTarget + nextPhase - 173, true);
}
}
}
public override void UpdateAI(uint diff)
{
//Return since we have no target
if (!UpdateVictim())
return; return;
if (insanityHandled != 0) insanityHandled = 0;
{ me.RemoveFlag(UnitFields.Flags, UnitFlags.NotSelectable);
if (!Summons.Empty()) me.SetControlled(false, UnitState.Stunned);
return; me.RemoveAurasDueToSpell(SpellIds.InsanityVisual);
insanityHandled = 0;
me.RemoveFlag(UnitFields.Flags, UnitFlags.NotSelectable);
me.SetControlled(false, UnitState.Stunned);
me.RemoveAurasDueToSpell(SpellIds.InsanityVisual);
}
if (uiMindFlayTimer <= diff)
{
DoCastVictim(SpellIds.MindFlay);
uiMindFlayTimer = 20 * Time.InMilliseconds;
} else uiMindFlayTimer -= diff;
if (uiShadowBoltVolleyTimer <= diff)
{
DoCastVictim(SpellIds.ShadowBoltVolley);
uiShadowBoltVolleyTimer = 5 * Time.InMilliseconds;
} else uiShadowBoltVolleyTimer -= diff;
if (uiShiverTimer <= diff)
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0);
if (target)
DoCast(target, SpellIds.Shiver);
uiShiverTimer = 15 * Time.InMilliseconds;
} else uiShiverTimer -= diff;
DoMeleeAttackIfReady();
} }
public override void JustDied(Unit killer) if (uiMindFlayTimer <= diff)
{ {
Talk(TextIds.SayDeath); DoCastVictim(SpellIds.MindFlay);
uiMindFlayTimer = 20 * Time.InMilliseconds;
instance.SetBossState(DataTypes.HeraldVolazj, EncounterState.Done);
Summons.DespawnAll();
ResetPlayersPhase();
} }
else uiMindFlayTimer -= diff;
public override void KilledUnit(Unit who) if (uiShadowBoltVolleyTimer <= diff)
{ {
if (who.IsTypeId(TypeId.Player)) DoCastVictim(SpellIds.ShadowBoltVolley);
Talk(TextIds.SaySlay); uiShadowBoltVolleyTimer = 5 * Time.InMilliseconds;
} }
else uiShadowBoltVolleyTimer -= diff;
InstanceScript instance; if (uiShiverTimer <= diff)
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0);
if (target)
DoCast(target, SpellIds.Shiver);
uiShiverTimer = 15 * Time.InMilliseconds;
}
else uiShiverTimer -= diff;
uint uiMindFlayTimer; DoMeleeAttackIfReady();
uint uiShadowBoltVolleyTimer;
uint uiShiverTimer;
uint insanityHandled;
SummonList Summons;
} }
public override CreatureAI GetAI(Creature creature) public override void JustDied(Unit killer)
{ {
return GetInstanceAI<boss_volazjAI>(creature); Talk(TextIds.SayDeath);
instance.SetBossState(DataTypes.HeraldVolazj, EncounterState.Done);
Summons.DespawnAll();
ResetPlayersPhase();
} }
public override void KilledUnit(Unit who)
{
if (who.IsTypeId(TypeId.Player))
Talk(TextIds.SaySlay);
}
InstanceScript instance;
uint uiMindFlayTimer;
uint uiShadowBoltVolleyTimer;
uint uiShiverTimer;
uint insanityHandled;
SummonList Summons;
} }
} }
@@ -58,527 +58,497 @@ namespace Scripts.Northrend.AzjolNerub.Ahnkahet.JedogaShadowseeker
} }
[Script] [Script]
class boss_jedoga_shadowseeker : CreatureScript public class boss_jedoga_shadowseeker : ScriptedAI
{ {
public boss_jedoga_shadowseeker() : base("boss_jedoga_shadowseeker") { } public boss_jedoga_shadowseeker(Creature creature) : base(creature)
public class boss_jedoga_shadowseekerAI : ScriptedAI
{ {
public boss_jedoga_shadowseekerAI(Creature creature) : base(creature) instance = creature.GetInstanceScript();
bFirstTime = true;
bPreDone = false;
}
void Initialize()
{
uiOpFerTimer = RandomHelper.URand(15 * Time.InMilliseconds, 20 * Time.InMilliseconds);
uiCycloneTimer = 3 * Time.InMilliseconds;
uiBoltTimer = 7 * Time.InMilliseconds;
uiThunderTimer = 12 * Time.InMilliseconds;
bOpFerok = false;
bOpFerokFail = false;
bOnGround = false;
bCanDown = false;
volunteerWork = true;
}
public override void Reset()
{
Initialize();
DoCast(SpellIds.RandomLightningVisual);
if (!bFirstTime)
instance.SetBossState(DataTypes.JedogaShadowseeker, EncounterState.Fail);
instance.SetGuidData(DataTypes.PlJedogaTarget, ObjectGuid.Empty);
instance.SetGuidData(DataTypes.AddJedogaVictim, ObjectGuid.Empty);
instance.SetData(DataTypes.JedogaResetInitiands, 0);
MoveUp();
bFirstTime = false;
}
public override void EnterCombat(Unit who)
{
if (instance == null || (who.GetTypeId() == TypeId.Unit && who.GetEntry() == AKCreatureIds.JedogaController))
return;
Talk(TextIds.SayAggro);
me.SetInCombatWithZone();
instance.SetBossState(DataTypes.JedogaShadowseeker, EncounterState.InProgress);
}
public override void AttackStart(Unit who)
{
if (!who || (who.GetTypeId() == TypeId.Unit && who.GetEntry() == AKCreatureIds.JedogaController))
return;
base.AttackStart(who);
}
public override void KilledUnit(Unit Victim)
{
if (!Victim || !Victim.IsTypeId(TypeId.Player))
return;
Talk(TextIds.SaySlay);
}
public override void JustDied(Unit killer)
{
Talk(TextIds.SayDeath);
instance.SetBossState(DataTypes.JedogaShadowseeker, EncounterState.Done);
}
public override void DoAction(int action)
{
if (action == Misc.ActionInitiateKilled)
volunteerWork = false;
}
public override uint GetData(uint type)
{
if (type == Misc.DataVolunteerWork)
return volunteerWork ? 1 : 0u;
return 0;
}
public override void MoveInLineOfSight(Unit who)
{
if (instance == null || !who || (who.IsTypeId(TypeId.Unit) && who.GetEntry() == AKCreatureIds.JedogaController))
return;
if (!bPreDone && who.IsTypeId(TypeId.Player) && me.GetDistance(who) < 100.0f)
{ {
instance = creature.GetInstanceScript(); Talk(TextIds.SayPreaching);
bFirstTime = true; bPreDone = true;
bPreDone = false;
} }
void Initialize() if (instance.GetBossState(DataTypes.JedogaShadowseeker) != EncounterState.InProgress || !bOnGround)
return;
if (!me.GetVictim() && me.CanCreatureAttack(who))
{ {
uiOpFerTimer = RandomHelper.URand(15 * Time.InMilliseconds, 20 * Time.InMilliseconds); float attackRadius = me.GetAttackDistance(who);
if (me.IsWithinDistInMap(who, attackRadius) && me.IsWithinLOSInMap(who))
uiCycloneTimer = 3 * Time.InMilliseconds;
uiBoltTimer = 7 * Time.InMilliseconds;
uiThunderTimer = 12 * Time.InMilliseconds;
bOpFerok = false;
bOpFerokFail = false;
bOnGround = false;
bCanDown = false;
volunteerWork = true;
}
public override void Reset()
{
Initialize();
DoCast(SpellIds.RandomLightningVisual);
if (!bFirstTime)
instance.SetBossState(DataTypes.JedogaShadowseeker, EncounterState.Fail);
instance.SetGuidData(DataTypes.PlJedogaTarget, ObjectGuid.Empty);
instance.SetGuidData(DataTypes.AddJedogaVictim, ObjectGuid.Empty);
instance.SetData(DataTypes.JedogaResetInitiands, 0);
MoveUp();
bFirstTime = false;
}
public override void EnterCombat(Unit who)
{
if (instance == null || (who.GetTypeId() == TypeId.Unit && who.GetEntry() == AKCreatureIds.JedogaController))
return;
Talk(TextIds.SayAggro);
me.SetInCombatWithZone();
instance.SetBossState(DataTypes.JedogaShadowseeker, EncounterState.InProgress);
}
public override void AttackStart(Unit who)
{
if (!who || (who.GetTypeId() == TypeId.Unit && who.GetEntry() == AKCreatureIds.JedogaController))
return;
base.AttackStart(who);
}
public override void KilledUnit(Unit Victim)
{
if (!Victim || !Victim.IsTypeId(TypeId.Player))
return;
Talk(TextIds.SaySlay);
}
public override void JustDied(Unit killer)
{
Talk(TextIds.SayDeath);
instance.SetBossState(DataTypes.JedogaShadowseeker, EncounterState.Done);
}
public override void DoAction(int action)
{
if (action == Misc.ActionInitiateKilled)
volunteerWork = false;
}
public override uint GetData(uint type)
{
if (type == Misc.DataVolunteerWork)
return volunteerWork ? 1 : 0u;
return 0;
}
public override void MoveInLineOfSight(Unit who)
{
if (instance == null || !who || (who.IsTypeId(TypeId.Unit) && who.GetEntry() == AKCreatureIds.JedogaController))
return;
if (!bPreDone && who.IsTypeId(TypeId.Player) && me.GetDistance(who) < 100.0f)
{ {
Talk(TextIds.SayPreaching); if (!me.GetVictim())
bPreDone = true;
}
if (instance.GetBossState(DataTypes.JedogaShadowseeker) != EncounterState.InProgress || !bOnGround)
return;
if (!me.GetVictim() && me.CanCreatureAttack(who))
{
float attackRadius = me.GetAttackDistance(who);
if (me.IsWithinDistInMap(who, attackRadius) && me.IsWithinLOSInMap(who))
{ {
if (!me.GetVictim()) who.RemoveAurasByType(AuraType.ModStealth);
{ AttackStart(who);
who.RemoveAurasByType(AuraType.ModStealth);
AttackStart(who);
}
else
{
who.SetInCombatWith(me);
me.AddThreat(who, 0.0f);
}
} }
}
}
void MoveDown()
{
bOpFerokFail = false;
instance.SetData(DataTypes.JedogaTriggerSwitch, 0);
me.GetMotionMaster().MovePoint(1, Misc.JedogaPosition[1]);
me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Normal, false);
me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Magic, false);
me.RemoveFlag(UnitFields.Flags, UnitFlags.NotSelectable | UnitFlags.NonAttackable);
me.RemoveAurasDueToSpell(SpellIds.SphereVisual);
bOnGround = true;
if (UpdateVictim())
{
AttackStart(me.GetVictim());
me.GetMotionMaster().MoveChase(me.GetVictim());
}
else
{
Unit target = Global.ObjAccessor.GetUnit(me, instance.GetGuidData(DataTypes.PlJedogaTarget));
if (target)
{
AttackStart(target);
instance.SetData(DataTypes.JedogaResetInitiands, 0);
if (instance.GetBossState(DataTypes.JedogaShadowseeker) != EncounterState.InProgress)
EnterCombat(target);
}
else if (!me.IsInCombat())
EnterEvadeMode();
}
}
void MoveUp()
{
me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Normal, true);
me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Magic, true);
me.SetFlag(UnitFields.Flags, UnitFlags.NotSelectable | UnitFlags.NonAttackable);
me.AttackStop();
me.RemoveAllAuras();
me.LoadCreaturesAddon();
me.GetMotionMaster().MovePoint(0, Misc.JedogaPosition[0]);
instance.SetData(DataTypes.JedogaTriggerSwitch, 1);
if (instance.GetBossState(DataTypes.JedogaShadowseeker) == EncounterState.InProgress)
GetVictimForSacrifice();
bOnGround = false;
uiOpFerTimer = RandomHelper.URand(15 * Time.InMilliseconds, 30 * Time.InMilliseconds);
}
void GetVictimForSacrifice()
{
ObjectGuid victim = instance.GetGuidData(DataTypes.AddJedogaInitiand);
if (!victim.IsEmpty())
{
Talk(TextIds.SaySacrifice1);
instance.SetGuidData(DataTypes.AddJedogaVictim, victim);
}
else
bCanDown = true;
}
void Sacrifice()
{
Talk(TextIds.SaySacrifice2);
me.InterruptNonMeleeSpells(false);
DoCast(me, SpellIds.GiftOfTheHerald, false);
bOpFerok = false;
bCanDown = true;
}
public override void UpdateAI(uint diff)
{
if (instance.GetBossState(DataTypes.JedogaShadowseeker) != EncounterState.InProgress && instance.GetData(DataTypes.AllInitiandDead) != 0)
MoveDown();
if (bOpFerok && !bOnGround && !bCanDown)
Sacrifice();
if (bOpFerokFail && !bOnGround && !bCanDown)
bCanDown = true;
if (bCanDown)
{
MoveDown();
bCanDown = false;
}
if (bOnGround)
{
if (!UpdateVictim())
return;
if (uiCycloneTimer <= diff)
{
DoCast(me, SpellIds.CycloneStrike, false);
uiCycloneTimer = RandomHelper.URand(15 * Time.InMilliseconds, 30 * Time.InMilliseconds);
}
else uiCycloneTimer -= diff;
if (uiBoltTimer <= diff)
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100, true);
if (target)
me.CastSpell(target, SpellIds.LightningBolt, false);
uiBoltTimer = RandomHelper.URand(15 * Time.InMilliseconds, 30 * Time.InMilliseconds);
}
else uiBoltTimer -= diff;
if (uiThunderTimer <= diff)
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100, true);
if (target)
me.CastSpell(target, SpellIds.Thundershock, false);
uiThunderTimer = RandomHelper.URand(15 * Time.InMilliseconds, 30 * Time.InMilliseconds);
}
else uiThunderTimer -= diff;
if (uiOpFerTimer <= diff)
MoveUp();
else else
uiOpFerTimer -= diff; {
who.SetInCombatWith(me);
DoMeleeAttackIfReady(); me.AddThreat(who, 0.0f);
}
} }
} }
InstanceScript instance;
uint uiOpFerTimer;
uint uiCycloneTimer;
uint uiBoltTimer;
uint uiThunderTimer;
bool bPreDone;
public bool bOpFerok;
bool bOnGround;
public bool bOpFerokFail;
bool bCanDown;
bool volunteerWork;
bool bFirstTime;
} }
public override CreatureAI GetAI(Creature creature) void MoveDown()
{ {
return GetInstanceAI<boss_jedoga_shadowseekerAI>(creature); bOpFerokFail = false;
instance.SetData(DataTypes.JedogaTriggerSwitch, 0);
me.GetMotionMaster().MovePoint(1, Misc.JedogaPosition[1]);
me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Normal, false);
me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Magic, false);
me.RemoveFlag(UnitFields.Flags, UnitFlags.NotSelectable | UnitFlags.NonAttackable);
me.RemoveAurasDueToSpell(SpellIds.SphereVisual);
bOnGround = true;
if (UpdateVictim())
{
AttackStart(me.GetVictim());
me.GetMotionMaster().MoveChase(me.GetVictim());
}
else
{
Unit target = Global.ObjAccessor.GetUnit(me, instance.GetGuidData(DataTypes.PlJedogaTarget));
if (target)
{
AttackStart(target);
instance.SetData(DataTypes.JedogaResetInitiands, 0);
if (instance.GetBossState(DataTypes.JedogaShadowseeker) != EncounterState.InProgress)
EnterCombat(target);
}
else if (!me.IsInCombat())
EnterEvadeMode();
}
} }
void MoveUp()
{
me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Normal, true);
me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Magic, true);
me.SetFlag(UnitFields.Flags, UnitFlags.NotSelectable | UnitFlags.NonAttackable);
me.AttackStop();
me.RemoveAllAuras();
me.LoadCreaturesAddon();
me.GetMotionMaster().MovePoint(0, Misc.JedogaPosition[0]);
instance.SetData(DataTypes.JedogaTriggerSwitch, 1);
if (instance.GetBossState(DataTypes.JedogaShadowseeker) == EncounterState.InProgress)
GetVictimForSacrifice();
bOnGround = false;
uiOpFerTimer = RandomHelper.URand(15 * Time.InMilliseconds, 30 * Time.InMilliseconds);
}
void GetVictimForSacrifice()
{
ObjectGuid victim = instance.GetGuidData(DataTypes.AddJedogaInitiand);
if (!victim.IsEmpty())
{
Talk(TextIds.SaySacrifice1);
instance.SetGuidData(DataTypes.AddJedogaVictim, victim);
}
else
bCanDown = true;
}
void Sacrifice()
{
Talk(TextIds.SaySacrifice2);
me.InterruptNonMeleeSpells(false);
DoCast(me, SpellIds.GiftOfTheHerald, false);
bOpFerok = false;
bCanDown = true;
}
public override void UpdateAI(uint diff)
{
if (instance.GetBossState(DataTypes.JedogaShadowseeker) != EncounterState.InProgress && instance.GetData(DataTypes.AllInitiandDead) != 0)
MoveDown();
if (bOpFerok && !bOnGround && !bCanDown)
Sacrifice();
if (bOpFerokFail && !bOnGround && !bCanDown)
bCanDown = true;
if (bCanDown)
{
MoveDown();
bCanDown = false;
}
if (bOnGround)
{
if (!UpdateVictim())
return;
if (uiCycloneTimer <= diff)
{
DoCast(me, SpellIds.CycloneStrike, false);
uiCycloneTimer = RandomHelper.URand(15 * Time.InMilliseconds, 30 * Time.InMilliseconds);
}
else uiCycloneTimer -= diff;
if (uiBoltTimer <= diff)
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100, true);
if (target)
me.CastSpell(target, SpellIds.LightningBolt, false);
uiBoltTimer = RandomHelper.URand(15 * Time.InMilliseconds, 30 * Time.InMilliseconds);
}
else uiBoltTimer -= diff;
if (uiThunderTimer <= diff)
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100, true);
if (target)
me.CastSpell(target, SpellIds.Thundershock, false);
uiThunderTimer = RandomHelper.URand(15 * Time.InMilliseconds, 30 * Time.InMilliseconds);
}
else uiThunderTimer -= diff;
if (uiOpFerTimer <= diff)
MoveUp();
else
uiOpFerTimer -= diff;
DoMeleeAttackIfReady();
}
}
InstanceScript instance;
uint uiOpFerTimer;
uint uiCycloneTimer;
uint uiBoltTimer;
uint uiThunderTimer;
bool bPreDone;
public bool bOpFerok;
bool bOnGround;
public bool bOpFerokFail;
bool bCanDown;
bool volunteerWork;
bool bFirstTime;
} }
[Script] [Script]
class npc_jedoga_twilight_volunteer : CreatureScript class npc_jedoga_twilight_volunteer : ScriptedAI
{ {
public npc_jedoga_twilight_volunteer() : base("npc_jedoga_initiand") { } public npc_jedoga_twilight_volunteer(Creature creature) : base(creature)
class npc_jedoga_twilight_volunteerAI : ScriptedAI
{ {
public npc_jedoga_twilight_volunteerAI(Creature creature) : base(creature) Initialize();
{ instance = creature.GetInstanceScript();
Initialize(); }
instance = creature.GetInstanceScript();
}
void Initialize() void Initialize()
{
bWalking = false;
bCheckTimer = 2 * Time.InMilliseconds;
}
public override void Reset()
{
Initialize();
if (instance.GetBossState(DataTypes.JedogaShadowseeker) != EncounterState.InProgress)
{ {
me.RemoveAurasDueToSpell(SpellIds.SphereVisual);
me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Normal, false);
me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Magic, false);
me.RemoveFlag(UnitFields.Flags, UnitFlags.NotSelectable | UnitFlags.NonAttackable);
}
else
{
DoCast(me, SpellIds.SphereVisual, false);
me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Normal, true);
me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Magic, true);
me.SetFlag(UnitFields.Flags, UnitFlags.NotSelectable | UnitFlags.NonAttackable);
}
}
public override void JustDied(Unit killer)
{
if (!killer || instance == null)
return;
if (bWalking)
{
Creature boss = ObjectAccessor.GetCreature(me, instance.GetGuidData(DataTypes.JedogaShadowseeker));
if (boss)
{
if (!boss.GetAI<boss_jedoga_shadowseeker>().bOpFerok)
boss.GetAI<boss_jedoga_shadowseeker>().bOpFerokFail = true;
if (killer.IsTypeId(TypeId.Player))
boss.GetAI().DoAction(Misc.ActionInitiateKilled);
}
instance.SetGuidData(DataTypes.AddJedogaVictim, ObjectGuid.Empty);
bWalking = false; bWalking = false;
bCheckTimer = 2 * Time.InMilliseconds;
} }
if (killer.IsTypeId(TypeId.Player))
instance.SetGuidData(DataTypes.PlJedogaTarget, killer.GetGUID());
}
public override void Reset() public override void EnterCombat(Unit who) { }
public override void AttackStart(Unit victim)
{
if ((instance.GetBossState(DataTypes.JedogaShadowseeker) == EncounterState.InProgress) || !victim)
return;
base.AttackStart(victim);
}
public override void MoveInLineOfSight(Unit who)
{
if ((instance.GetBossState(DataTypes.JedogaShadowseeker) == EncounterState.InProgress) || !who)
return;
base.MoveInLineOfSight(who);
}
public override void MovementInform(MovementGeneratorType uiType, uint uiPointId)
{
if (uiType != MovementGeneratorType.Point || instance == null)
return;
switch (uiPointId)
{ {
Initialize(); case 1:
{
Creature boss = me.GetMap().GetCreature(instance.GetGuidData(DataTypes.JedogaShadowseeker));
if (boss)
{
boss.GetAI<boss_jedoga_shadowseeker>().bOpFerok = true;
boss.GetAI<boss_jedoga_shadowseeker>().bOpFerokFail = false;
me.KillSelf();
}
}
break;
}
}
if (instance.GetBossState(DataTypes.JedogaShadowseeker) != EncounterState.InProgress) public override void UpdateAI(uint diff)
{
if (bCheckTimer <= diff)
{
if (me.GetGUID() == instance.GetGuidData(DataTypes.AddJedogaVictim) && !bWalking)
{ {
me.RemoveAurasDueToSpell(SpellIds.SphereVisual); me.RemoveAurasDueToSpell(SpellIds.SphereVisual);
me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Normal, false); me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Normal, false);
me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Magic, false); me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Magic, false);
me.RemoveFlag(UnitFields.Flags, UnitFlags.NotSelectable | UnitFlags.NonAttackable); me.RemoveFlag(UnitFields.Flags, UnitFlags.NotSelectable | UnitFlags.NonAttackable);
float distance = me.GetDistance(Misc.JedogaPosition[1]);
if (distance < 9.0f)
me.SetSpeedRate(UnitMoveType.Walk, 0.5f);
else if (distance < 15.0f)
me.SetSpeedRate(UnitMoveType.Walk, 0.75f);
else if (distance < 20.0f)
me.SetSpeedRate(UnitMoveType.Walk, 1.0f);
me.GetMotionMaster().Clear(false);
me.GetMotionMaster().MovePoint(1, Misc.JedogaPosition[1]);
bWalking = true;
} }
else if (!bWalking)
{ {
DoCast(me, SpellIds.SphereVisual, false); if (instance.GetBossState(DataTypes.JedogaShadowseeker) != EncounterState.InProgress && me.HasAura(SpellIds.SphereVisual))
me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Normal, true);
me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Magic, true);
me.SetFlag(UnitFields.Flags, UnitFlags.NotSelectable | UnitFlags.NonAttackable);
}
}
public override void JustDied(Unit killer)
{
if (!killer || instance == null)
return;
if (bWalking)
{
Creature boss = ObjectAccessor.GetCreature(me, instance.GetGuidData(DataTypes.JedogaShadowseeker));
if (boss)
{
if (!boss.GetAI<boss_jedoga_shadowseeker.boss_jedoga_shadowseekerAI>().bOpFerok)
boss.GetAI<boss_jedoga_shadowseeker.boss_jedoga_shadowseekerAI>().bOpFerokFail = true;
if (killer.IsTypeId(TypeId.Player))
boss.GetAI().DoAction(Misc.ActionInitiateKilled);
}
instance.SetGuidData(DataTypes.AddJedogaVictim, ObjectGuid.Empty);
bWalking = false;
}
if (killer.IsTypeId(TypeId.Player))
instance.SetGuidData(DataTypes.PlJedogaTarget, killer.GetGUID());
}
public override void EnterCombat(Unit who) { }
public override void AttackStart(Unit victim)
{
if ((instance.GetBossState(DataTypes.JedogaShadowseeker) == EncounterState.InProgress) || !victim)
return;
base.AttackStart(victim);
}
public override void MoveInLineOfSight(Unit who)
{
if ((instance.GetBossState(DataTypes.JedogaShadowseeker) == EncounterState.InProgress) || !who)
return;
base.MoveInLineOfSight(who);
}
public override void MovementInform(MovementGeneratorType uiType, uint uiPointId)
{
if (uiType != MovementGeneratorType.Point || instance == null)
return;
switch (uiPointId)
{
case 1:
{
Creature boss = me.GetMap().GetCreature(instance.GetGuidData(DataTypes.JedogaShadowseeker));
if (boss)
{
boss.GetAI<boss_jedoga_shadowseeker.boss_jedoga_shadowseekerAI>().bOpFerok = true;
boss.GetAI<boss_jedoga_shadowseeker.boss_jedoga_shadowseekerAI>().bOpFerokFail = false;
me.KillSelf();
}
}
break;
}
}
public override void UpdateAI(uint diff)
{
if (bCheckTimer <= diff)
{
if (me.GetGUID() == instance.GetGuidData(DataTypes.AddJedogaVictim) && !bWalking)
{ {
me.RemoveAurasDueToSpell(SpellIds.SphereVisual); me.RemoveAurasDueToSpell(SpellIds.SphereVisual);
me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Normal, false); me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Normal, false);
me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Magic, false); me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Magic, false);
me.RemoveFlag(UnitFields.Flags, UnitFlags.NotSelectable | UnitFlags.NonAttackable); me.RemoveFlag(UnitFields.Flags, UnitFlags.NotSelectable | UnitFlags.NonAttackable);
float distance = me.GetDistance(Misc.JedogaPosition[1]);
if (distance < 9.0f)
me.SetSpeedRate(UnitMoveType.Walk, 0.5f);
else if (distance < 15.0f)
me.SetSpeedRate(UnitMoveType.Walk, 0.75f);
else if (distance < 20.0f)
me.SetSpeedRate(UnitMoveType.Walk, 1.0f);
me.GetMotionMaster().Clear(false);
me.GetMotionMaster().MovePoint(1, Misc.JedogaPosition[1]);
bWalking = true;
} }
if (!bWalking) if (instance.GetBossState(DataTypes.JedogaShadowseeker) == EncounterState.InProgress && !me.HasAura(SpellIds.SphereVisual))
{ {
if (instance.GetBossState(DataTypes.JedogaShadowseeker) != EncounterState.InProgress && me.HasAura(SpellIds.SphereVisual)) DoCast(me, SpellIds.SphereVisual, false);
{ me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Normal, true);
me.RemoveAurasDueToSpell(SpellIds.SphereVisual); me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Magic, true);
me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Normal, false); me.SetFlag(UnitFields.Flags, UnitFlags.NotSelectable | UnitFlags.NonAttackable);
me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Magic, false);
me.RemoveFlag(UnitFields.Flags, UnitFlags.NotSelectable | UnitFlags.NonAttackable);
}
if (instance.GetBossState(DataTypes.JedogaShadowseeker) == EncounterState.InProgress && !me.HasAura(SpellIds.SphereVisual))
{
DoCast(me, SpellIds.SphereVisual, false);
me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Normal, true);
me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Magic, true);
me.SetFlag(UnitFields.Flags, UnitFlags.NotSelectable | UnitFlags.NonAttackable);
}
} }
bCheckTimer = 2 * Time.InMilliseconds;
} }
else bCheckTimer -= diff; bCheckTimer = 2 * Time.InMilliseconds;
//Return since we have no target
if (!UpdateVictim())
return;
DoMeleeAttackIfReady();
} }
else bCheckTimer -= diff;
InstanceScript instance; //Return since we have no target
if (!UpdateVictim())
return;
uint bCheckTimer; DoMeleeAttackIfReady();
bool bWalking;
} }
public override CreatureAI GetAI(Creature creature) InstanceScript instance;
{
return GetInstanceAI<npc_jedoga_twilight_volunteerAI>(creature); uint bCheckTimer;
} bool bWalking;
} }
[Script] [Script]
class npc_jedoga_controller : CreatureScript class npc_jedoga_controller : ScriptedAI
{ {
public npc_jedoga_controller() : base("npc_jedogas_aufseher_trigger") { } public npc_jedoga_controller(Creature creature) : base(creature)
class npc_jedoga_controllerAI : ScriptedAI
{ {
public npc_jedoga_controllerAI(Creature creature) : base(creature) instance = creature.GetInstanceScript();
{ bRemoved = false;
instance = creature.GetInstanceScript(); bRemoved2 = false;
bRemoved = false; bCast = false;
bRemoved2 = false; bCast2 = false;
bCast = false;
bCast2 = false;
SetCombatMovement(false); SetCombatMovement(false);
}
public override void Reset() { }
public override void EnterCombat(Unit who) { }
public override void AttackStart(Unit victim) { }
public override void MoveInLineOfSight(Unit who) { }
public override void UpdateAI(uint diff)
{
if (!bRemoved && me.GetPositionX() > 440.0f)
{
if (instance.GetBossState(DataTypes.PrinceTaldaram) == EncounterState.Done)
{
me.InterruptNonMeleeSpells(true);
bRemoved = true;
return;
}
if (!bCast)
{
//DoCast(me, JedogaShadowseekerConst.SpellBeamVisualJedogasAufseher1, false);
bCast = true;
}
}
if (!bRemoved2 && me.GetPositionX() < 440.0f)
{
if (!bCast2 && instance.GetData(DataTypes.JedogaTriggerSwitch) != 0)
{
//DoCast(me, JedogaShadowseekerConst.SpellBeamVisualJedogasAufseher2, false);
bCast2 = true;
}
if (bCast2 && instance.GetData(DataTypes.JedogaTriggerSwitch) == 0)
{
me.InterruptNonMeleeSpells(true);
bCast2 = false;
}
if (!bRemoved2 && instance.GetBossState(DataTypes.JedogaShadowseeker) == EncounterState.Done)
{
me.InterruptNonMeleeSpells(true);
bRemoved2 = true;
}
}
}
InstanceScript instance;
bool bRemoved;
bool bRemoved2;
bool bCast;
bool bCast2;
} }
public override CreatureAI GetAI(Creature creature) public override void Reset() { }
public override void EnterCombat(Unit who) { }
public override void AttackStart(Unit victim) { }
public override void MoveInLineOfSight(Unit who) { }
public override void UpdateAI(uint diff)
{ {
return GetInstanceAI<npc_jedoga_controllerAI>(creature); if (!bRemoved && me.GetPositionX() > 440.0f)
{
if (instance.GetBossState(DataTypes.PrinceTaldaram) == EncounterState.Done)
{
me.InterruptNonMeleeSpells(true);
bRemoved = true;
return;
}
if (!bCast)
{
//DoCast(me, JedogaShadowseekerConst.SpellBeamVisualJedogasAufseher1, false);
bCast = true;
}
}
if (!bRemoved2 && me.GetPositionX() < 440.0f)
{
if (!bCast2 && instance.GetData(DataTypes.JedogaTriggerSwitch) != 0)
{
//DoCast(me, JedogaShadowseekerConst.SpellBeamVisualJedogasAufseher2, false);
bCast2 = true;
}
if (bCast2 && instance.GetData(DataTypes.JedogaTriggerSwitch) == 0)
{
me.InterruptNonMeleeSpells(true);
bCast2 = false;
}
if (!bRemoved2 && instance.GetBossState(DataTypes.JedogaShadowseeker) == EncounterState.Done)
{
me.InterruptNonMeleeSpells(true);
bRemoved2 = true;
}
}
} }
InstanceScript instance;
bool bRemoved;
bool bRemoved2;
bool bCast;
bool bCast2;
} }
[Script] [Script]
@@ -82,301 +82,281 @@ namespace Scripts.Northrend.AzjolNerub.Ahnkahet.PrinceTaldaram
} }
[Script] [Script]
class boss_prince_taldaram : CreatureScript public class boss_prince_taldaram : BossAI
{ {
public boss_prince_taldaram() : base("boss_prince_taldaram") { } public boss_prince_taldaram(Creature creature) : base(creature, DataTypes.PrinceTaldaram)
public class boss_prince_taldaramAI : BossAI
{ {
public boss_prince_taldaramAI(Creature creature) : base(creature, DataTypes.PrinceTaldaram) me.SetDisableGravity(true);
_embraceTakenDamage = 0;
}
public override void Reset()
{
_Reset();
_flameSphereTargetGUID.Clear();
_embraceTargetGUID.Clear();
_embraceTakenDamage = 0;
}
public override void EnterCombat(Unit who)
{
_EnterCombat();
Talk(TextIds.SayAggro);
_events.ScheduleEvent(Misc.EventBloodthirst, 10000);
_events.ScheduleEvent(Misc.EventVanish, RandomHelper.URand(25000, 35000));
_events.ScheduleEvent(Misc.EventConjureFlameSpheres, 5000);
}
public override void JustSummoned(Creature summon)
{
base.JustSummoned(summon);
switch (summon.GetEntry())
{ {
me.SetDisableGravity(true); case CreatureIds.FlameSphere1:
_embraceTakenDamage = 0; case CreatureIds.FlameSphere2:
case CreatureIds.FlameSphere3:
summon.GetAI().SetGUID(_flameSphereTargetGUID);
break;
} }
}
public override void Reset() public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_events.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
_events.ExecuteEvents(eventId =>
{ {
_Reset(); switch (eventId)
_flameSphereTargetGUID.Clear();
_embraceTargetGUID.Clear();
_embraceTakenDamage = 0;
}
public override void EnterCombat(Unit who)
{
_EnterCombat();
Talk(TextIds.SayAggro);
_events.ScheduleEvent(Misc.EventBloodthirst, 10000);
_events.ScheduleEvent(Misc.EventVanish, RandomHelper.URand(25000, 35000));
_events.ScheduleEvent(Misc.EventConjureFlameSpheres, 5000);
}
public override void JustSummoned(Creature summon)
{
base.JustSummoned(summon);
switch (summon.GetEntry())
{ {
case CreatureIds.FlameSphere1: case Misc.EventBloodthirst:
case CreatureIds.FlameSphere2: DoCast(me, SpellIds.Bloodthirst);
case CreatureIds.FlameSphere3: _events.ScheduleEvent(Misc.EventBloodthirst, 10000);
summon.GetAI().SetGUID(_flameSphereTargetGUID); break;
case Misc.EventConjureFlameSpheres:
// random target?
Unit victim = me.GetVictim();
if (victim)
{
_flameSphereTargetGUID = victim.GetGUID();
DoCast(victim, SpellIds.ConjureFlameSphere);
}
_events.ScheduleEvent(Misc.EventConjureFlameSpheres, 15000);
break;
case Misc.EventVanish:
{
var players = me.GetMap().GetPlayers();
uint targets = 0;
foreach (var player in players)
{
if (player && player.IsAlive())
++targets;
}
if (targets > 2)
{
Talk(TextIds.SayVanish);
DoCast(me, SpellIds.Vanish);
me.SetInCombatState(true); // Prevents the boss from resetting
_events.DelayEvents(500);
_events.ScheduleEvent(Misc.EventJustVanished, 500);
Unit embraceTarget = SelectTarget(SelectAggroTarget.Random, 0, 100.0f, true);
if (embraceTarget)
_embraceTargetGUID = embraceTarget.GetGUID();
}
_events.ScheduleEvent(Misc.EventVanish, RandomHelper.URand(25000, 35000));
break;
}
case Misc.EventJustVanished:
{
Unit embraceTarget = GetEmbraceTarget();
if (embraceTarget)
{
me.GetMotionMaster().Clear();
me.SetSpeedRate(UnitMoveType.Walk, 2.0f);
me.GetMotionMaster().MoveChase(embraceTarget);
}
_events.ScheduleEvent(Misc.EventVanished, 1300);
}
break;
case Misc.EventVanished:
{
Unit embraceTarget = GetEmbraceTarget();
if (embraceTarget)
DoCast(embraceTarget, SpellIds.EmbraceOfTheVampyr);
Talk(TextIds.SayFeed);
me.GetMotionMaster().Clear();
me.SetSpeedRate(UnitMoveType.Walk, 1.0f);
me.GetMotionMaster().MoveChase(me.GetVictim());
_events.ScheduleEvent(Misc.EventFeeding, 20000);
}
break;
case Misc.EventFeeding:
_embraceTargetGUID.Clear();
break;
default:
break; break;
} }
} });
public override void UpdateAI(uint diff) DoMeleeAttackIfReady();
{
if (!UpdateVictim())
return;
_events.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
_events.ExecuteEvents(eventId =>
{
switch (eventId)
{
case Misc.EventBloodthirst:
DoCast(me, SpellIds.Bloodthirst);
_events.ScheduleEvent(Misc.EventBloodthirst, 10000);
break;
case Misc.EventConjureFlameSpheres:
// random target?
Unit victim = me.GetVictim();
if (victim)
{
_flameSphereTargetGUID = victim.GetGUID();
DoCast(victim, SpellIds.ConjureFlameSphere);
}
_events.ScheduleEvent(Misc.EventConjureFlameSpheres, 15000);
break;
case Misc.EventVanish:
{
var players = me.GetMap().GetPlayers();
uint targets = 0;
foreach (var player in players)
{
if (player && player.IsAlive())
++targets;
}
if (targets > 2)
{
Talk(TextIds.SayVanish);
DoCast(me, SpellIds.Vanish);
me.SetInCombatState(true); // Prevents the boss from resetting
_events.DelayEvents(500);
_events.ScheduleEvent(Misc.EventJustVanished, 500);
Unit embraceTarget = SelectTarget(SelectAggroTarget.Random, 0, 100.0f, true);
if (embraceTarget)
_embraceTargetGUID = embraceTarget.GetGUID();
}
_events.ScheduleEvent(Misc.EventVanish, RandomHelper.URand(25000, 35000));
break;
}
case Misc.EventJustVanished:
{
Unit embraceTarget = GetEmbraceTarget();
if (embraceTarget)
{
me.GetMotionMaster().Clear();
me.SetSpeedRate(UnitMoveType.Walk, 2.0f);
me.GetMotionMaster().MoveChase(embraceTarget);
}
_events.ScheduleEvent(Misc.EventVanished, 1300);
}
break;
case Misc.EventVanished:
{
Unit embraceTarget = GetEmbraceTarget();
if (embraceTarget)
DoCast(embraceTarget, SpellIds.EmbraceOfTheVampyr);
Talk(TextIds.SayFeed);
me.GetMotionMaster().Clear();
me.SetSpeedRate(UnitMoveType.Walk, 1.0f);
me.GetMotionMaster().MoveChase(me.GetVictim());
_events.ScheduleEvent(Misc.EventFeeding, 20000);
}
break;
case Misc.EventFeeding:
_embraceTargetGUID.Clear();
break;
default:
break;
}
});
DoMeleeAttackIfReady();
}
public override void DamageTaken(Unit doneBy, ref uint damage)
{
Unit embraceTarget = GetEmbraceTarget();
if (embraceTarget && embraceTarget.IsAlive())
{
_embraceTakenDamage += damage;
if (_embraceTakenDamage > DungeonMode<uint>(Misc.DataEmbraceDmg, Misc.DataEmbraceDmgH))
{
_embraceTargetGUID.Clear();
me.CastStop();
}
}
}
public override void JustDied(Unit killer)
{
Talk(TextIds.SayDeath);
_JustDied();
}
public override void KilledUnit(Unit victim)
{
if (!victim.IsTypeId(TypeId.Player))
return;
if (victim.GetGUID() == _embraceTargetGUID)
_embraceTargetGUID.Clear();
Talk(TextIds.SaySlay);
}
public bool CheckSpheres()
{
for (byte i = 0; i < 2; ++i)
{
if (instance.GetData(DataTypes.Sphere1 + i) == 0)
return false;
}
RemovePrison();
return true;
}
Unit GetEmbraceTarget()
{
if (!_embraceTargetGUID.IsEmpty())
return Global.ObjAccessor.GetUnit(me, _embraceTargetGUID);
return null;
}
void RemovePrison()
{
me.RemoveFlag(UnitFields.Flags, UnitFlags.NotSelectable);
me.RemoveAurasDueToSpell(SpellIds.BeamVisual);
me.SetHomePosition(me.GetPositionX(), me.GetPositionY(), Misc.DataGroundPositionZ, me.GetOrientation());
DoCast(SpellIds.HoverFall);
me.SetDisableGravity(false);
me.GetMotionMaster().MoveLand(0, me.GetHomePosition());
Talk(TextIds.SayWarning);
instance.HandleGameObject(instance.GetGuidData(DataTypes.PrinceTaldaramPlatform), true);
}
ObjectGuid _flameSphereTargetGUID;
ObjectGuid _embraceTargetGUID;
uint _embraceTakenDamage;
} }
public override CreatureAI GetAI(Creature creature) public override void DamageTaken(Unit doneBy, ref uint damage)
{ {
return GetInstanceAI<boss_prince_taldaramAI>(creature); Unit embraceTarget = GetEmbraceTarget();
if (embraceTarget && embraceTarget.IsAlive())
{
_embraceTakenDamage += damage;
if (_embraceTakenDamage > DungeonMode<uint>(Misc.DataEmbraceDmg, Misc.DataEmbraceDmgH))
{
_embraceTargetGUID.Clear();
me.CastStop();
}
}
} }
public override void JustDied(Unit killer)
{
Talk(TextIds.SayDeath);
_JustDied();
}
public override void KilledUnit(Unit victim)
{
if (!victim.IsTypeId(TypeId.Player))
return;
if (victim.GetGUID() == _embraceTargetGUID)
_embraceTargetGUID.Clear();
Talk(TextIds.SaySlay);
}
public bool CheckSpheres()
{
for (byte i = 0; i < 2; ++i)
{
if (instance.GetData(DataTypes.Sphere1 + i) == 0)
return false;
}
RemovePrison();
return true;
}
Unit GetEmbraceTarget()
{
if (!_embraceTargetGUID.IsEmpty())
return Global.ObjAccessor.GetUnit(me, _embraceTargetGUID);
return null;
}
void RemovePrison()
{
me.RemoveFlag(UnitFields.Flags, UnitFlags.NotSelectable);
me.RemoveAurasDueToSpell(SpellIds.BeamVisual);
me.SetHomePosition(me.GetPositionX(), me.GetPositionY(), Misc.DataGroundPositionZ, me.GetOrientation());
DoCast(SpellIds.HoverFall);
me.SetDisableGravity(false);
me.GetMotionMaster().MoveLand(0, me.GetHomePosition());
Talk(TextIds.SayWarning);
instance.HandleGameObject(instance.GetGuidData(DataTypes.PrinceTaldaramPlatform), true);
}
ObjectGuid _flameSphereTargetGUID;
ObjectGuid _embraceTargetGUID;
uint _embraceTakenDamage;
} }
[Script] // 30106, 31686, 31687 - Flame Sphere [Script] // 30106, 31686, 31687 - Flame Sphere
class npc_prince_taldaram_flame_sphere : CreatureScript class npc_prince_taldaram_flame_sphere : ScriptedAI
{ {
public npc_prince_taldaram_flame_sphere() : base("npc_prince_taldaram_flame_sphere") { } public npc_prince_taldaram_flame_sphere(Creature creature) : base(creature)
class npc_prince_taldaram_flame_sphereAI : ScriptedAI
{ {
public npc_prince_taldaram_flame_sphereAI(Creature creature) : base(creature) }
public override void Reset()
{
DoCast(me, SpellIds.FlameSphereSpawnEffect, true);
DoCast(me, SpellIds.FlameSphereVisual, true);
_flameSphereTargetGUID.Clear();
_events.Reset();
_events.ScheduleEvent(Misc.EventStartMove, 3 * Time.InMilliseconds);
_events.ScheduleEvent(Misc.EventDespawn, 13 * Time.InMilliseconds);
}
public override void SetGUID(ObjectGuid guid, int id = 0)
{
_flameSphereTargetGUID = guid;
}
public override void EnterCombat(Unit who) { }
public override void MoveInLineOfSight(Unit who) { }
public override void UpdateAI(uint diff)
{
_events.Update(diff);
_events.ExecuteEvents(eventId =>
{ {
} switch (eventId)
public override void Reset()
{
DoCast(me, SpellIds.FlameSphereSpawnEffect, true);
DoCast(me, SpellIds.FlameSphereVisual, true);
_flameSphereTargetGUID.Clear();
_events.Reset();
_events.ScheduleEvent(Misc.EventStartMove, 3 * Time.InMilliseconds);
_events.ScheduleEvent(Misc.EventDespawn, 13 * Time.InMilliseconds);
}
public override void SetGUID(ObjectGuid guid, int id = 0)
{
_flameSphereTargetGUID = guid;
}
public override void EnterCombat(Unit who) { }
public override void MoveInLineOfSight(Unit who) { }
public override void UpdateAI(uint diff)
{
_events.Update(diff);
_events.ExecuteEvents(eventId =>
{ {
switch (eventId) case Misc.EventStartMove:
{ {
case Misc.EventStartMove: DoCast(me, SpellIds.FlameSpherePeriodic, true);
/// @todo: find correct values
float angleOffset = 0.0f;
float distOffset = Misc.DataSphereDistance;
switch (me.GetEntry())
{ {
DoCast(me, SpellIds.FlameSpherePeriodic, true); case CreatureIds.FlameSphere1:
break;
/// @todo: find correct values case CreatureIds.FlameSphere2:
float angleOffset = 0.0f; angleOffset = Misc.DataSphereAngleOffset;
float distOffset = Misc.DataSphereDistance; break;
case CreatureIds.FlameSphere3:
switch (me.GetEntry()) angleOffset = -Misc.DataSphereAngleOffset;
{ break;
case CreatureIds.FlameSphere1: default:
break;
case CreatureIds.FlameSphere2:
angleOffset = Misc.DataSphereAngleOffset;
break;
case CreatureIds.FlameSphere3:
angleOffset = -Misc.DataSphereAngleOffset;
break;
default:
return;
}
Unit sphereTarget = Global.ObjAccessor.GetUnit(me, _flameSphereTargetGUID);
if (!sphereTarget)
return; return;
float angle = me.GetAngle(sphereTarget) + angleOffset;
float x = me.GetPositionX() + distOffset * (float)Math.Cos(angle);
float y = me.GetPositionY() + distOffset * (float)Math.Sin(angle);
/// @todo: correct speed
me.GetMotionMaster().MovePoint(0, x, y, me.GetPositionZ());
break;
} }
case Misc.EventDespawn:
DoCast(me, SpellIds.FlameSphereDeathEffect, true);
me.DespawnOrUnsummon(1000);
break;
default:
break;
}
});
}
ObjectGuid _flameSphereTargetGUID; Unit sphereTarget = Global.ObjAccessor.GetUnit(me, _flameSphereTargetGUID);
if (!sphereTarget)
return;
float angle = me.GetAngle(sphereTarget) + angleOffset;
float x = me.GetPositionX() + distOffset * (float)Math.Cos(angle);
float y = me.GetPositionY() + distOffset * (float)Math.Sin(angle);
/// @todo: correct speed
me.GetMotionMaster().MovePoint(0, x, y, me.GetPositionZ());
break;
}
case Misc.EventDespawn:
DoCast(me, SpellIds.FlameSphereDeathEffect, true);
me.DespawnOrUnsummon(1000);
break;
default:
break;
}
});
} }
public override CreatureAI GetAI(Creature creature) ObjectGuid _flameSphereTargetGUID;
{
return new npc_prince_taldaram_flame_sphereAI(creature);
}
} }
[Script] // 193093, 193094 - Ancient Nerubian Device [Script] // 193093, 193094 - Ancient Nerubian Device
@@ -408,69 +388,49 @@ namespace Scripts.Northrend.AzjolNerub.Ahnkahet.PrinceTaldaram
break; break;
} }
PrinceTaldaram.GetAI<boss_prince_taldaram.boss_prince_taldaramAI>().CheckSpheres(); PrinceTaldaram.GetAI<boss_prince_taldaram>().CheckSpheres();
} }
return true; return true;
} }
} }
[Script] // 55931 - Conjure Flame Sphere [Script] // 55931 - Conjure Flame Sphere
class spell_prince_taldaram_conjure_flame_sphere : SpellScriptLoader class spell_prince_taldaram_conjure_flame_sphere : SpellScript
{ {
public spell_prince_taldaram_conjure_flame_sphere() : base("spell_prince_taldaram_conjure_flame_sphere") { } public override bool Validate(SpellInfo spellInfo)
class spell_prince_taldaram_conjure_flame_sphere_SpellScript : SpellScript
{ {
public override bool Validate(SpellInfo spellInfo) return ValidateSpellInfo(SpellIds.FlameSphereSummon1, SpellIds.FlameSphereSummon2, SpellIds.FlameSphereSummon3);
{ }
return ValidateSpellInfo(SpellIds.FlameSphereSummon1, SpellIds.FlameSphereSummon2, SpellIds.FlameSphereSummon3);
}
void HandleScript(uint effIndex) void HandleScript(uint effIndex)
{ {
Unit caster = GetCaster(); Unit caster = GetCaster();
caster.CastSpell(caster, SpellIds.FlameSphereSummon1, true); caster.CastSpell(caster, SpellIds.FlameSphereSummon1, true);
if (caster.GetMap().IsHeroic()) if (caster.GetMap().IsHeroic())
{
caster.CastSpell(caster, SpellIds.FlameSphereSummon2, true);
caster.CastSpell(caster, SpellIds.FlameSphereSummon3, true);
}
}
public override void Register()
{ {
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.Dummy)); caster.CastSpell(caster, SpellIds.FlameSphereSummon2, true);
caster.CastSpell(caster, SpellIds.FlameSphereSummon3, true);
} }
} }
public override SpellScript GetSpellScript() public override void Register()
{ {
return new spell_prince_taldaram_conjure_flame_sphere_SpellScript(); OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.Dummy));
} }
} }
[Script] // 55895, 59511, 59512 - Flame Sphere Summon [Script] // 55895, 59511, 59512 - Flame Sphere Summon
class spell_prince_taldaram_flame_sphere_summon : SpellScriptLoader class spell_prince_taldaram_flame_sphere_summon : SpellScript
{ {
public spell_prince_taldaram_flame_sphere_summon() : base("spell_prince_taldaram_flame_sphere_summon") { } void SetDest(ref SpellDestination dest)
class spell_prince_taldaram_flame_sphere_summon_SpellScript : SpellScript
{ {
void SetDest(ref SpellDestination dest) dest.RelocateOffset(new Position(0.0f, 0.0f, 5.5f, 0.0f));
{
dest.RelocateOffset(new Position(0.0f, 0.0f, 5.5f, 0.0f));
}
public override void Register()
{
OnDestinationTargetSelect.Add(new DestinationTargetSelectHandler(SetDest, 0, Targets.DestCaster));
}
} }
public override SpellScript GetSpellScript() public override void Register()
{ {
return new spell_prince_taldaram_flame_sphere_summon_SpellScript(); OnDestinationTargetSelect.Add(new DestinationTargetSelectHandler(SetDest, 0, Targets.DestCaster));
} }
} }
} }
@@ -23,6 +23,59 @@ using System.Collections.Generic;
namespace Scripts.Northrend.AzjolNerub.Ahnkahet namespace Scripts.Northrend.AzjolNerub.Ahnkahet
{ {
struct DataTypes
{
// Encounter States/Boss GUIDs
public const uint ElderNadox = 0;
public const uint PrinceTaldaram = 1;
public const uint JedogaShadowseeker = 2;
public const uint Amanitar = 3;
public const uint HeraldVolazj = 4;
// Additional Data
public const uint Sphere1 = 5;
public const uint Sphere2 = 6;
public const uint PrinceTaldaramPlatform = 7;
public const uint PlJedogaTarget = 8;
public const uint AddJedogaVictim = 9;
public const uint AddJedogaInitiand = 10;
public const uint JedogaTriggerSwitch = 11;
public const uint JedogaResetInitiands = 12;
public const uint AllInitiandDead = 13;
}
struct AKCreatureIds
{
public const uint ElderNadox = 29309;
public const uint PrinceTaldaram = 29308;
public const uint JedogaShadowseeker = 29310;
public const uint Amanitar = 30258;
public const uint HeraldVolazj = 29311;
// Elder Nadox
public const uint AhnkaharGuardian = 30176;
public const uint AhnkaharSwarmer = 30178;
// Jedoga Shadowseeker
public const uint Initiand = 30114;
public const uint JedogaController = 30181;
// Herald Volazj
//public const uint TwistedVisage1 = 30621,
//public const uint TwistedVisage2 = 30622,
//public const uint TwistedVisage3 = 30623,
//public const uint TwistedVisage4 = 30624,
public const uint TwistedVisage = 30625;
}
struct GameObjectIds
{
public const uint PrinceTaldaramGate = 192236;
public const uint PrinceTaldaramPlatform = 193564;
public const uint Sphere1 = 193093;
public const uint Sphere2 = 193094;
}
[Script] [Script]
class instance_ahnkahet : InstanceMapScript class instance_ahnkahet : InstanceMapScript
{ {
@@ -151,7 +204,7 @@ namespace Scripts.Northrend.AzjolNerub.Ahnkahet
case DataTypes.Sphere1: case DataTypes.Sphere1:
case DataTypes.Sphere2: case DataTypes.Sphere2:
return SpheresState[type - DataTypes.Sphere1]; return SpheresState[type - DataTypes.Sphere1];
case DataTypes.AllInitiandDead: case DataTypes.AllInitiandDead:
foreach (ObjectGuid guid in InitiandGUIDs) foreach (ObjectGuid guid in InitiandGUIDs)
{ {
Creature cr = instance.GetCreature(guid); Creature cr = instance.GetCreature(guid);
@@ -278,57 +331,4 @@ namespace Scripts.Northrend.AzjolNerub.Ahnkahet
return new instance_ahnkahet_InstanceScript(map); return new instance_ahnkahet_InstanceScript(map);
} }
} }
struct DataTypes
{
// Encounter States/Boss GUIDs
public const uint ElderNadox = 0;
public const uint PrinceTaldaram = 1;
public const uint JedogaShadowseeker = 2;
public const uint Amanitar = 3;
public const uint HeraldVolazj = 4;
// Additional Data
public const uint Sphere1 = 5;
public const uint Sphere2 = 6;
public const uint PrinceTaldaramPlatform = 7;
public const uint PlJedogaTarget = 8;
public const uint AddJedogaVictim = 9;
public const uint AddJedogaInitiand = 10;
public const uint JedogaTriggerSwitch = 11;
public const uint JedogaResetInitiands = 12;
public const uint AllInitiandDead = 13;
}
struct AKCreatureIds
{
public const uint ElderNadox = 29309;
public const uint PrinceTaldaram = 29308;
public const uint JedogaShadowseeker = 29310;
public const uint Amanitar = 30258;
public const uint HeraldVolazj = 29311;
// Elder Nadox
public const uint AhnkaharGuardian = 30176;
public const uint AhnkaharSwarmer = 30178;
// Jedoga Shadowseeker
public const uint Initiand = 30114;
public const uint JedogaController = 30181;
// Herald Volazj
//public const uint TwistedVisage1 = 30621,
//public const uint TwistedVisage2 = 30622,
//public const uint TwistedVisage3 = 30623,
//public const uint TwistedVisage4 = 30624,
public const uint TwistedVisage = 30625;
}
struct GameObjectIds
{
public const uint PrinceTaldaramGate = 192236;
public const uint PrinceTaldaramPlatform = 193564;
public const uint Sphere1 = 193093;
public const uint Sphere2 = 193094;
}
} }
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -22,41 +22,6 @@ using Game.Scripting;
namespace Scripts.Northrend.AzjolNerub.AzjolNerub namespace Scripts.Northrend.AzjolNerub.AzjolNerub
{ {
[Script]
class instance_azjol_nerub : InstanceMapScript
{
public instance_azjol_nerub() : base(nameof(instance_azjol_nerub), 601) { }
class instance_azjol_nerub_InstanceScript : InstanceScript
{
public instance_azjol_nerub_InstanceScript(Map map) : base(map)
{
SetHeaders(ANInstanceMisc.DataHeader);
SetBossNumber(ANInstanceMisc.EncounterCount);
LoadBossBoundaries(ANInstanceMisc.boundaries);
LoadDoorData(ANInstanceMisc.doorData);
LoadObjectData(ANInstanceMisc.creatureData, ANInstanceMisc.gameobjectData);
}
public override void OnUnitDeath(Unit who)
{
base.OnUnitDeath(who);
Creature creature = who.ToCreature();
if (!creature || creature.IsCritter() || creature.IsControlledByPlayer())
return;
Creature gatewatcher = GetCreature(ANDataTypes.KrikthirTheGatewatcher);
if (gatewatcher)
gatewatcher.GetAI().DoAction(-ANInstanceMisc.ActionGatewatcherGreet);
}
}
public override InstanceScript GetInstanceScript(InstanceMap map)
{
return new instance_azjol_nerub_InstanceScript(map);
}
}
struct ANDataTypes struct ANDataTypes
{ {
// Encounter States/Boss Guids // Encounter States/Boss Guids
@@ -128,4 +93,39 @@ namespace Scripts.Northrend.AzjolNerub.AzjolNerub
new BossBoundaryEntry(ANDataTypes.Anubarak, new CircleBoundary(new Position(550.6178f, 253.5917f), 26.0f)) new BossBoundaryEntry(ANDataTypes.Anubarak, new CircleBoundary(new Position(550.6178f, 253.5917f), 26.0f))
}; };
} }
[Script]
class instance_azjol_nerub : InstanceMapScript
{
public instance_azjol_nerub() : base(nameof(instance_azjol_nerub), 601) { }
class instance_azjol_nerub_InstanceScript : InstanceScript
{
public instance_azjol_nerub_InstanceScript(Map map) : base(map)
{
SetHeaders(ANInstanceMisc.DataHeader);
SetBossNumber(ANInstanceMisc.EncounterCount);
LoadBossBoundaries(ANInstanceMisc.boundaries);
LoadDoorData(ANInstanceMisc.doorData);
LoadObjectData(ANInstanceMisc.creatureData, ANInstanceMisc.gameobjectData);
}
public override void OnUnitDeath(Unit who)
{
base.OnUnitDeath(who);
Creature creature = who.ToCreature();
if (!creature || creature.IsCritter() || creature.IsControlledByPlayer())
return;
Creature gatewatcher = GetCreature(ANDataTypes.KrikthirTheGatewatcher);
if (gatewatcher)
gatewatcher.GetAI().DoAction(-ANInstanceMisc.ActionGatewatcherGreet);
}
}
public override InstanceScript GetInstanceScript(InstanceMap map)
{
return new instance_azjol_nerub_InstanceScript(map);
}
}
} }
@@ -71,237 +71,160 @@ namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheChampion
public const uint POISON_BOTTLE = 67701; public const uint POISON_BOTTLE = 67701;
} }
/*
struct Point
{
float x, y, z;
}
const Point MovementPoint[] =
{
{746.84f, 623.15f, 411.41f},
{747.96f, 620.29f, 411.09f},
{750.23f, 618.35f, 411.09f}
}
*/
/*
* Generic AI for vehicles used by npcs in ToC, it needs more improvements. *
* Script Complete: 25%. *
*/
[Script] [Script]
class generic_vehicleAI_toc5 : CreatureScript class generic_vehicleAI_toc5 : npc_escortAI
{ {
public generic_vehicleAI_toc5() : base("generic_vehicleAI_toc5") { } public generic_vehicleAI_toc5(Creature creature) : base(creature)
class generic_vehicleAI_toc5AI : npc_escortAI
{ {
public generic_vehicleAI_toc5AI(Creature creature) : base(creature) Initialize();
{ SetDespawnAtEnd(false);
Initialize(); uiWaypointPath = 0;
SetDespawnAtEnd(false);
uiWaypointPath = 0;
instance = creature.GetInstanceScript(); instance = creature.GetInstanceScript();
}
void Initialize()
{
uiChargeTimer = 5000;
uiShieldBreakerTimer = 8000;
uiBuffTimer = RandomHelper.URand(30000, 60000);
}
public override void Reset()
{
Initialize();
}
public override void SetData(uint uiType, uint uiData)
{
switch (uiType)
{
case 1:
AddWaypoint(0, 747.36f, 634.07f, 411.572f);
AddWaypoint(1, 780.43f, 607.15f, 411.82f);
AddWaypoint(2, 785.99f, 599.41f, 411.92f);
AddWaypoint(3, 778.44f, 601.64f, 411.79f);
uiWaypointPath = 1;
break;
case 2:
AddWaypoint(0, 747.35f, 634.07f, 411.57f);
AddWaypoint(1, 768.72f, 581.01f, 411.92f);
AddWaypoint(2, 763.55f, 590.52f, 411.71f);
uiWaypointPath = 2;
break;
case 3:
AddWaypoint(0, 747.35f, 634.07f, 411.57f);
AddWaypoint(1, 784.02f, 645.33f, 412.39f);
AddWaypoint(2, 775.67f, 641.91f, 411.91f);
uiWaypointPath = 3;
break;
} }
void Initialize() if (uiType <= 3)
{ Start(false, true);
uiChargeTimer = 5000; }
uiShieldBreakerTimer = 8000;
uiBuffTimer = RandomHelper.URand(30000, 60000);
}
public override void Reset() public override void WaypointReached(uint waypointId)
{
switch (waypointId)
{ {
Initialize(); case 2:
} if (uiWaypointPath == 3 || uiWaypointPath == 2)
public override void SetData(uint uiType, uint uiData)
{
switch (uiType)
{
case 1:
AddWaypoint(0, 747.36f, 634.07f, 411.572f);
AddWaypoint(1, 780.43f, 607.15f, 411.82f);
AddWaypoint(2, 785.99f, 599.41f, 411.92f);
AddWaypoint(3, 778.44f, 601.64f, 411.79f);
uiWaypointPath = 1;
break;
case 2:
AddWaypoint(0, 747.35f, 634.07f, 411.57f);
AddWaypoint(1, 768.72f, 581.01f, 411.92f);
AddWaypoint(2, 763.55f, 590.52f, 411.71f);
uiWaypointPath = 2;
break;
case 3:
AddWaypoint(0, 747.35f, 634.07f, 411.57f);
AddWaypoint(1, 784.02f, 645.33f, 412.39f);
AddWaypoint(2, 775.67f, 641.91f, 411.91f);
uiWaypointPath = 3;
break;
}
if (uiType <= 3)
Start(false, true);
}
public override void WaypointReached(uint waypointId)
{
switch (waypointId)
{
case 2:
if (uiWaypointPath == 3 || uiWaypointPath == 2)
instance.SetData((uint)Data.DATA_MOVEMENT_DONE, instance.GetData((uint)Data.DATA_MOVEMENT_DONE) + 1);
break;
case 3:
instance.SetData((uint)Data.DATA_MOVEMENT_DONE, instance.GetData((uint)Data.DATA_MOVEMENT_DONE) + 1); instance.SetData((uint)Data.DATA_MOVEMENT_DONE, instance.GetData((uint)Data.DATA_MOVEMENT_DONE) + 1);
break; break;
case 3:
instance.SetData((uint)Data.DATA_MOVEMENT_DONE, instance.GetData((uint)Data.DATA_MOVEMENT_DONE) + 1);
break;
}
}
public override void EnterCombat(Unit who)
{
DoCastSpellShield();
}
void DoCastSpellShield()
{
for (byte i = 0; i < 3; ++i)
DoCast(me, TrialOfChampionSpells.SHIELD, true);
}
public override void UpdateAI(uint uiDiff)
{
base.UpdateAI(uiDiff);
if (!UpdateVictim())
return;
if (uiBuffTimer <= uiDiff)
{
if (!me.HasAura(TrialOfChampionSpells.SHIELD))
DoCastSpellShield();
uiBuffTimer = RandomHelper.URand(30000, 45000);
}
else
uiBuffTimer -= uiDiff;
if (uiChargeTimer <= uiDiff)
{
var players = me.GetMap().GetPlayers();
if (!players.Empty())
{
foreach (var player in players)
{
if (player && !player.IsGameMaster() && me.IsInRange(player, 8.0f, 25.0f, false))
{
DoResetThreat();
me.AddThreat(player, 1.0f);
DoCast(player, TrialOfChampionSpells.CHARGE);
break;
}
}
} }
uiChargeTimer = 5000;
} }
else
uiChargeTimer -= uiDiff;
public override void EnterCombat(Unit who) //dosen't work at all
if (uiShieldBreakerTimer <= uiDiff)
{ {
DoCastSpellShield(); Vehicle pVehicle = me.GetVehicleKit();
} if (!pVehicle)
void DoCastSpellShield()
{
for (byte i = 0; i < 3; ++i)
DoCast(me, TrialOfChampionSpells.SHIELD, true);
}
public override void UpdateAI(uint uiDiff)
{
base.UpdateAI(uiDiff);
if (!UpdateVictim())
return; return;
if (uiBuffTimer <= uiDiff) Unit pPassenger = pVehicle.GetPassenger(0);
{ if (pPassenger)
if (!me.HasAura(TrialOfChampionSpells.SHIELD))
DoCastSpellShield();
uiBuffTimer = RandomHelper.URand(30000, 45000);
}
else
uiBuffTimer -= uiDiff;
if (uiChargeTimer <= uiDiff)
{ {
var players = me.GetMap().GetPlayers(); var players = me.GetMap().GetPlayers();
if (!players.Empty()) if (!players.Empty())
{ {
foreach (var player in players) foreach (var player in players)
{ {
if (player && !player.IsGameMaster() && me.IsInRange(player, 8.0f, 25.0f, false)) if (player && !player.IsGameMaster() && me.IsInRange(player, 10.0f, 30.0f, false))
{ {
DoResetThreat(); pPassenger.CastSpell(player, TrialOfChampionSpells.SHIELD_BREAKER, true);
me.AddThreat(player, 1.0f);
DoCast(player, TrialOfChampionSpells.CHARGE);
break; break;
} }
} }
} }
uiChargeTimer = 5000;
} }
else uiShieldBreakerTimer = 7000;
uiChargeTimer -= uiDiff;
//dosen't work at all
if (uiShieldBreakerTimer <= uiDiff)
{
Vehicle pVehicle = me.GetVehicleKit();
if (!pVehicle)
return;
Unit pPassenger = pVehicle.GetPassenger(0);
if (pPassenger)
{
var players = me.GetMap().GetPlayers();
if (!players.Empty())
{
foreach (var player in players)
{
if (player && !player.IsGameMaster() && me.IsInRange(player, 10.0f, 30.0f, false))
{
pPassenger.CastSpell(player, TrialOfChampionSpells.SHIELD_BREAKER, true);
break;
}
}
}
}
uiShieldBreakerTimer = 7000;
}
else
uiShieldBreakerTimer -= uiDiff;
DoMeleeAttackIfReady();
} }
else
uiShieldBreakerTimer -= uiDiff;
InstanceScript instance; DoMeleeAttackIfReady();
uint uiChargeTimer;
uint uiShieldBreakerTimer;
uint uiBuffTimer;
uint uiWaypointPath;
} }
public override CreatureAI GetAI(Creature creature) InstanceScript instance;
{
return GetInstanceAI<generic_vehicleAI_toc5AI>(creature);
}
public static void AggroAllPlayers(Creature temp) uint uiChargeTimer;
{ uint uiShieldBreakerTimer;
var PlList = temp.GetMap().GetPlayers(); uint uiBuffTimer;
if (PlList.Empty()) uint uiWaypointPath;
return;
foreach (var player in PlList)
{
if (player)
{
if (player.IsGameMaster())
continue;
if (player.IsAlive())
{
temp.RemoveFlag(UnitFields.Flags, UnitFlags.NonAttackable | UnitFlags.ImmuneToPc);
temp.SetReactState(ReactStates.Aggressive);
temp.SetInCombatWith(player);
player.SetInCombatWith(temp);
temp.AddThreat(player, 0.0f);
}
}
}
}
public static bool GrandChampionsOutVehicle(Creature me)
{
InstanceScript instance = me.GetInstanceScript();
if (instance == null)
return false;
Creature pGrandChampion1 = ObjectAccessor.GetCreature(me, instance.GetGuidData((uint)Data64.DATA_GRAND_CHAMPION_1));
Creature pGrandChampion2 = ObjectAccessor.GetCreature(me, instance.GetGuidData((uint)Data64.DATA_GRAND_CHAMPION_2));
Creature pGrandChampion3 = ObjectAccessor.GetCreature(me, instance.GetGuidData((uint)Data64.DATA_GRAND_CHAMPION_3));
if (pGrandChampion1 && pGrandChampion2 && pGrandChampion3)
{
if (pGrandChampion1.m_movementInfo.transport.guid.IsEmpty() &&
pGrandChampion2.m_movementInfo.transport.guid.IsEmpty() &&
pGrandChampion3.m_movementInfo.transport.guid.IsEmpty())
return true;
}
return false;
}
} }
abstract class boss_basic_toc5AI : ScriptedAI abstract class boss_basic_toc5AI : ScriptedAI
@@ -349,7 +272,7 @@ namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheChampion
public override void UpdateAI(uint diff) public override void UpdateAI(uint diff)
{ {
if (!bDone && generic_vehicleAI_toc5.GrandChampionsOutVehicle(me)) if (!bDone && GrandChampionsOutVehicle(me))
{ {
bDone = true; bDone = true;
@@ -368,7 +291,7 @@ namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheChampion
{ {
if (uiPhase == 1) if (uiPhase == 1)
{ {
generic_vehicleAI_toc5.AggroAllPlayers(me); AggroAllPlayers(me);
uiPhase = 0; uiPhase = 0;
} }
} }
@@ -381,6 +304,54 @@ namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheChampion
return !me.m_movementInfo.transport.guid.IsEmpty(); return !me.m_movementInfo.transport.guid.IsEmpty();
} }
void AggroAllPlayers(Creature temp)
{
var PlList = temp.GetMap().GetPlayers();
if (PlList.Empty())
return;
foreach (var player in PlList)
{
if (player)
{
if (player.IsGameMaster())
continue;
if (player.IsAlive())
{
temp.RemoveFlag(UnitFields.Flags, UnitFlags.NonAttackable | UnitFlags.ImmuneToPc);
temp.SetReactState(ReactStates.Aggressive);
temp.SetInCombatWith(player);
player.SetInCombatWith(temp);
temp.AddThreat(player, 0.0f);
}
}
}
}
bool GrandChampionsOutVehicle(Creature me)
{
InstanceScript instance = me.GetInstanceScript();
if (instance == null)
return false;
Creature pGrandChampion1 = ObjectAccessor.GetCreature(me, instance.GetGuidData((uint)Data64.DATA_GRAND_CHAMPION_1));
Creature pGrandChampion2 = ObjectAccessor.GetCreature(me, instance.GetGuidData((uint)Data64.DATA_GRAND_CHAMPION_2));
Creature pGrandChampion3 = ObjectAccessor.GetCreature(me, instance.GetGuidData((uint)Data64.DATA_GRAND_CHAMPION_3));
if (pGrandChampion1 && pGrandChampion2 && pGrandChampion3)
{
if (pGrandChampion1.m_movementInfo.transport.guid.IsEmpty() &&
pGrandChampion2.m_movementInfo.transport.guid.IsEmpty() &&
pGrandChampion3.m_movementInfo.transport.guid.IsEmpty())
return true;
}
return false;
}
public TaskScheduler NonCombatEvents = new TaskScheduler(); public TaskScheduler NonCombatEvents = new TaskScheduler();
public InstanceScript instance; public InstanceScript instance;
@@ -393,337 +364,287 @@ namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheChampion
} }
[Script] [Script]
class boss_warrior_toc5 : CreatureScript // Marshal Jacob Alerius && Mokra the Skullcrusher || Warrior
class boss_warrior_toc5 : boss_basic_toc5AI
{ {
public boss_warrior_toc5() : base("boss_warrior_toc5") { } public boss_warrior_toc5(Creature creature) : base(creature) { }
// Marshal Jacob Alerius && Mokra the Skullcrusher || Warrior public override void Initialize()
class boss_warrior_toc5AI : boss_basic_toc5AI
{ {
public boss_warrior_toc5AI(Creature creature) : base(creature) { } _scheduler.Schedule(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(20), task =>
public override void Initialize()
{ {
_scheduler.Schedule(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(20), task => DoCastVictim(TrialOfChampionSpells.BLADESTORM);
{ task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(20));
DoCastVictim(TrialOfChampionSpells.BLADESTORM); });
task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(20));
});
_scheduler.Schedule(TimeSpan.FromSeconds(7), task => _scheduler.Schedule(TimeSpan.FromSeconds(7), task =>
{
var players = me.GetMap().GetPlayers();
if (!players.Empty())
{ {
var players = me.GetMap().GetPlayers(); foreach (var player in players)
if (!players.Empty())
{ {
foreach (var player in players) if (player && !player.IsGameMaster() && me.IsInRange(player, 8.0f, 25.0f, false))
{ {
if (player && !player.IsGameMaster() && me.IsInRange(player, 8.0f, 25.0f, false)) DoResetThreat();
{ me.AddThreat(player, 5.0f);
DoResetThreat(); DoCast(player, TrialOfChampionSpells.INTERCEPT);
me.AddThreat(player, 5.0f); break;
DoCast(player, TrialOfChampionSpells.INTERCEPT);
break;
}
} }
} }
task.Repeat(TimeSpan.FromSeconds(7)); }
}); task.Repeat(TimeSpan.FromSeconds(7));
});
_scheduler.Schedule(TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(12), task => _scheduler.Schedule(TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(12), task =>
{
DoCastVictim(TrialOfChampionSpells.MORTAL_STRIKE);
task.Repeat(TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(12));
});
}
public override void UpdateAI(uint diff)
{ {
base.UpdateAI(diff); DoCastVictim(TrialOfChampionSpells.MORTAL_STRIKE);
task.Repeat(TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(12));
if (!UpdateVictim() || InVehicle()) });
return;
_scheduler.Update(diff);
DoMeleeAttackIfReady();
}
} }
public override CreatureAI GetAI(Creature creature) public override void UpdateAI(uint diff)
{ {
return GetInstanceAI<boss_warrior_toc5AI>(creature); base.UpdateAI(diff);
if (!UpdateVictim() || InVehicle())
return;
_scheduler.Update(diff);
DoMeleeAttackIfReady();
}
}
[Script]
// Ambrose Boltspark && Eressea Dawnsinger || Mage
class boss_mage_toc5 : boss_basic_toc5AI
{
public boss_mage_toc5(Creature creature) : base(creature) { }
public override void Initialize()
{
_scheduler.Schedule(TimeSpan.FromSeconds(5), task =>
{
DoCastVictim(TrialOfChampionSpells.FIREBALL);
task.Repeat(TimeSpan.FromSeconds(5));
});
_scheduler.Schedule(TimeSpan.FromSeconds(8), task =>
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0);
if (target)
DoCast(target, TrialOfChampionSpells.POLYMORPH);
task.Repeat(TimeSpan.FromSeconds(8));
});
_scheduler.Schedule(TimeSpan.FromSeconds(12), task =>
{
DoCastAOE(TrialOfChampionSpells.BLAST_WAVE, false);
task.Repeat(TimeSpan.FromSeconds(13));
});
_scheduler.Schedule(TimeSpan.FromSeconds(22), task =>
{
me.InterruptNonMeleeSpells(true);
DoCast(me, TrialOfChampionSpells.HASTE);
task.Repeat(TimeSpan.FromSeconds(22));
});
}
public override void UpdateAI(uint diff)
{
base.UpdateAI(diff);
if (!UpdateVictim() || InVehicle())
return;
_scheduler.Update(diff);
DoMeleeAttackIfReady();
} }
} }
[Script] [Script]
class boss_mage_toc5 : CreatureScript // Colosos && Runok Wildmane || Shaman
class boss_shaman_toc5 : boss_basic_toc5AI
{ {
public boss_mage_toc5() : base("boss_mage_toc5") { } public boss_shaman_toc5(Creature creature) : base(creature) { }
// Ambrose Boltspark && Eressea Dawnsinger || Mage public override void Initialize()
class boss_mage_toc5AI : boss_basic_toc5AI
{ {
public boss_mage_toc5AI(Creature creature) : base(creature) { } _scheduler.Schedule(TimeSpan.FromSeconds(16), task =>
public override void Initialize()
{ {
_scheduler.Schedule(TimeSpan.FromSeconds(5), task => Unit target = SelectTarget(SelectAggroTarget.Random, 0);
{ if (target)
DoCastVictim(TrialOfChampionSpells.FIREBALL); DoCast(target, TrialOfChampionSpells.CHAIN_LIGHTNING);
task.Repeat(TimeSpan.FromSeconds(5));
});
_scheduler.Schedule(TimeSpan.FromSeconds(8), task => task.Repeat(TimeSpan.FromSeconds(16));
{ });
Unit target = SelectTarget(SelectAggroTarget.Random, 0);
if (target)
DoCast(target, TrialOfChampionSpells.POLYMORPH);
task.Repeat(TimeSpan.FromSeconds(8));
});
_scheduler.Schedule(TimeSpan.FromSeconds(12), task => _scheduler.Schedule(TimeSpan.FromSeconds(12), task =>
{
DoCastAOE(TrialOfChampionSpells.BLAST_WAVE, false);
task.Repeat(TimeSpan.FromSeconds(13));
});
_scheduler.Schedule(TimeSpan.FromSeconds(22), task =>
{
me.InterruptNonMeleeSpells(true);
DoCast(me, TrialOfChampionSpells.HASTE);
task.Repeat(TimeSpan.FromSeconds(22));
});
}
public override void UpdateAI(uint diff)
{ {
base.UpdateAI(diff); bool bChance = RandomHelper.randChance(50);
if (!UpdateVictim() || InVehicle()) if (!bChance)
return;
_scheduler.Update(diff);
DoMeleeAttackIfReady();
}
}
public override CreatureAI GetAI(Creature creature)
{
return GetInstanceAI<boss_mage_toc5AI>(creature);
}
}
[Script]
class boss_shaman_toc5 : CreatureScript
{
public boss_shaman_toc5() : base("boss_shaman_toc5") { }
// Colosos && Runok Wildmane || Shaman
class boss_shaman_toc5AI : boss_basic_toc5AI
{
public boss_shaman_toc5AI(Creature creature) : base(creature) { }
public override void Initialize()
{
_scheduler.Schedule(TimeSpan.FromSeconds(16), task =>
{ {
Unit target = SelectTarget(SelectAggroTarget.Random, 0); Unit pFriend = DoSelectLowestHpFriendly(40);
if (target) if (pFriend)
DoCast(target, TrialOfChampionSpells.CHAIN_LIGHTNING); DoCast(pFriend, TrialOfChampionSpells.HEALING_WAVE);
}
else
DoCast(me, TrialOfChampionSpells.HEALING_WAVE);
task.Repeat(TimeSpan.FromSeconds(16)); task.Repeat(TimeSpan.FromSeconds(12));
}); });
_scheduler.Schedule(TimeSpan.FromSeconds(12), task => _scheduler.Schedule(TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(35), task =>
{
bool bChance = RandomHelper.randChance(50);
if (!bChance)
{
Unit pFriend = DoSelectLowestHpFriendly(40);
if (pFriend)
DoCast(pFriend, TrialOfChampionSpells.HEALING_WAVE);
}
else
DoCast(me, TrialOfChampionSpells.HEALING_WAVE);
task.Repeat(TimeSpan.FromSeconds(12));
});
_scheduler.Schedule(TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(35), task =>
{
DoCast(me, TrialOfChampionSpells.EARTH_SHIELD);
task.Repeat(TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(35));
});
_scheduler.Schedule(TimeSpan.FromSeconds(20), TimeSpan.FromSeconds(25), task =>
{
DoCastVictim(TrialOfChampionSpells.HEX_OF_MENDING, true);
task.Repeat(TimeSpan.FromSeconds(20), TimeSpan.FromSeconds(25));
});
}
public override void EnterCombat(Unit who)
{ {
DoCast(me, TrialOfChampionSpells.EARTH_SHIELD); DoCast(me, TrialOfChampionSpells.EARTH_SHIELD);
DoCast(who, TrialOfChampionSpells.HEX_OF_MENDING); task.Repeat(TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(35));
} });
public override void UpdateAI(uint diff) _scheduler.Schedule(TimeSpan.FromSeconds(20), TimeSpan.FromSeconds(25), task =>
{ {
base.UpdateAI(diff); DoCastVictim(TrialOfChampionSpells.HEX_OF_MENDING, true);
task.Repeat(TimeSpan.FromSeconds(20), TimeSpan.FromSeconds(25));
if (!UpdateVictim() || InVehicle()) });
return;
_scheduler.Update(diff);
DoMeleeAttackIfReady();
}
} }
public override CreatureAI GetAI(Creature creature) public override void EnterCombat(Unit who)
{ {
return GetInstanceAI<boss_shaman_toc5AI>(creature); DoCast(me, TrialOfChampionSpells.EARTH_SHIELD);
DoCast(who, TrialOfChampionSpells.HEX_OF_MENDING);
}
public override void UpdateAI(uint diff)
{
base.UpdateAI(diff);
if (!UpdateVictim() || InVehicle())
return;
_scheduler.Update(diff);
DoMeleeAttackIfReady();
} }
} }
[Script] [Script]
class boss_hunter_toc5 : CreatureScript // Jaelyne Evensong && Zul'tore || Hunter
class boss_hunter_toc5 : boss_basic_toc5AI
{ {
public boss_hunter_toc5() : base("boss_hunter_toc5") { } public boss_hunter_toc5(Creature creature) : base(creature) { }
// Jaelyne Evensong && Zul'tore || Hunter public override void Initialize()
class boss_hunter_toc5AI : boss_basic_toc5AI
{ {
public boss_hunter_toc5AI(Creature creature) : base(creature) { } _scheduler.Schedule(TimeSpan.FromSeconds(7), task =>
public override void Initialize()
{ {
_scheduler.Schedule(TimeSpan.FromSeconds(7), task => DoCastAOE(TrialOfChampionSpells.LIGHTNING_ARROWS, false);
{ task.Repeat(TimeSpan.FromSeconds(7));
DoCastAOE(TrialOfChampionSpells.LIGHTNING_ARROWS, false); });
task.Repeat(TimeSpan.FromSeconds(7));
});
_scheduler.Schedule(TimeSpan.FromSeconds(12), task => _scheduler.Schedule(TimeSpan.FromSeconds(12), task =>
{
ObjectGuid uiTargetGUID = ObjectGuid.Empty;
Unit target = SelectTarget(SelectAggroTarget.Farthest, 0, 30.0f);
if (target)
{ {
ObjectGuid uiTargetGUID = ObjectGuid.Empty; uiTargetGUID = target.GetGUID();
Unit target = SelectTarget(SelectAggroTarget.Farthest, 0, 30.0f); DoCast(target, TrialOfChampionSpells.SHOOT);
if (target) }
{
uiTargetGUID = target.GetGUID();
DoCast(target, TrialOfChampionSpells.SHOOT);
}
bool bShoot = true; bool bShoot = true;
task.Repeat(TimeSpan.FromSeconds(12)); task.Repeat(TimeSpan.FromSeconds(12));
task.Schedule(TimeSpan.FromSeconds(3), task1 => task.Schedule(TimeSpan.FromSeconds(3), task1 =>
{
if (bShoot)
{ {
if (bShoot) me.InterruptNonMeleeSpells(true);
Unit target1 = Global.ObjAccessor.GetUnit(me, uiTargetGUID);
if (target1 && me.IsInRange(target1, 5.0f, 30.0f, false))
{ {
me.InterruptNonMeleeSpells(true); DoCast(target1, TrialOfChampionSpells.MULTI_SHOT);
}
Unit target1 = Global.ObjAccessor.GetUnit(me, uiTargetGUID); else
if (target1 && me.IsInRange(target1, 5.0f, 30.0f, false)) {
var players = me.GetMap().GetPlayers();
if (!players.Empty())
{ {
DoCast(target1, TrialOfChampionSpells.MULTI_SHOT); foreach (var player in players)
}
else
{
var players = me.GetMap().GetPlayers();
if (!players.Empty())
{ {
foreach (var player in players) if (player && !player.IsGameMaster() && me.IsInRange(player, 5.0f, 30.0f, false))
{ {
if (player && !player.IsGameMaster() && me.IsInRange(player, 5.0f, 30.0f, false)) DoCast(player, TrialOfChampionSpells.MULTI_SHOT);
{ break;
DoCast(player, TrialOfChampionSpells.MULTI_SHOT);
break;
}
} }
} }
} }
bShoot = false;
} }
}); bShoot = false;
}
}); });
} });
public override void UpdateAI(uint diff)
{
base.UpdateAI(diff);
if (!UpdateVictim() || InVehicle())
return;
_scheduler.Update(diff);
DoMeleeAttackIfReady();
}
} }
public override CreatureAI GetAI(Creature creature) public override void UpdateAI(uint diff)
{ {
return GetInstanceAI<boss_hunter_toc5AI>(creature); base.UpdateAI(diff);
if (!UpdateVictim() || InVehicle())
return;
_scheduler.Update(diff);
DoMeleeAttackIfReady();
} }
} }
[Script] [Script]
class boss_rouge_toc5 : CreatureScript // Lana Stouthammer Evensong && Deathstalker Visceri || Rouge
class boss_rouge_toc5 : boss_basic_toc5AI
{ {
public boss_rouge_toc5() : base("boss_rouge_toc5") { } public boss_rouge_toc5(Creature creature) : base(creature) { }
// Lana Stouthammer Evensong && Deathstalker Visceri || Rouge public override void Initialize()
class boss_rouge_toc5AI : boss_basic_toc5AI
{ {
public boss_rouge_toc5AI(Creature creature) : base(creature) { } _scheduler.Schedule(TimeSpan.FromSeconds(8), task =>
public override void Initialize()
{ {
_scheduler.Schedule(TimeSpan.FromSeconds(8), task => DoCastVictim(TrialOfChampionSpells.EVISCERATE);
{
DoCastVictim(TrialOfChampionSpells.EVISCERATE);
task.Repeat(TimeSpan.FromSeconds(8)); task.Repeat(TimeSpan.FromSeconds(8));
}); });
_scheduler.Schedule(TimeSpan.FromSeconds(14), task => _scheduler.Schedule(TimeSpan.FromSeconds(14), task =>
{
DoCastAOE(TrialOfChampionSpells.FAN_OF_KNIVES, false);
task.Repeat(TimeSpan.FromSeconds(14));
});
_scheduler.Schedule(TimeSpan.FromSeconds(19), task =>
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0);
if (target)
DoCast(target, TrialOfChampionSpells.POISON_BOTTLE);
task.Repeat(TimeSpan.FromSeconds(19));
});
}
public override void UpdateAI(uint diff)
{ {
base.UpdateAI(diff); DoCastAOE(TrialOfChampionSpells.FAN_OF_KNIVES, false);
if (!UpdateVictim() || !me.m_movementInfo.transport.guid.IsEmpty()) task.Repeat(TimeSpan.FromSeconds(14));
return; });
_scheduler.Update(diff); _scheduler.Schedule(TimeSpan.FromSeconds(19), task =>
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0);
if (target)
DoCast(target, TrialOfChampionSpells.POISON_BOTTLE);
DoMeleeAttackIfReady(); task.Repeat(TimeSpan.FromSeconds(19));
} });
} }
public override CreatureAI GetAI(Creature creature) public override void UpdateAI(uint diff)
{ {
return GetInstanceAI<boss_rouge_toc5AI>(creature); base.UpdateAI(diff);
if (!UpdateVictim() || !me.m_movementInfo.transport.guid.IsEmpty())
return;
_scheduler.Update(diff);
DoMeleeAttackIfReady();
} }
} }
} }
@@ -24,6 +24,7 @@ using Game.Scripting;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Game.AI;
namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheChampion namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheChampion
{ {
@@ -32,11 +33,6 @@ namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheChampion
{ {
public instance_trial_of_the_champion() : base("instance_trial_of_the_champion", 650) { } public instance_trial_of_the_champion() : base("instance_trial_of_the_champion", 650) { }
public override InstanceScript GetInstanceScript(InstanceMap map)
{
return new instance_trial_of_the_champion_InstanceMapScript(map);
}
class instance_trial_of_the_champion_InstanceMapScript : InstanceScript class instance_trial_of_the_champion_InstanceMapScript : InstanceScript
{ {
public instance_trial_of_the_champion_InstanceMapScript(Map map) : base(map) public instance_trial_of_the_champion_InstanceMapScript(Map map) : base(map)
@@ -329,5 +325,15 @@ namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheChampion
//bool bDone; //bool bDone;
} }
public override InstanceScript GetInstanceScript(InstanceMap map)
{
return new instance_trial_of_the_champion_InstanceMapScript(map);
}
public static T GetTrialOfTheChampionAI<T>(Creature creature) where T : CreatureAI
{
return GetInstanceAI<T>(creature, "instance_trial_of_the_champion");
}
} }
} }
@@ -223,7 +223,8 @@ namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheChampion
if (summon) if (summon)
AggroAllPlayers(summon); AggroAllPlayers(summon);
} }
} else if (uiLesserChampions == 9) }
else if (uiLesserChampions == 9)
StartGrandChampionsAttack(); StartGrandChampionsAttack();
break; break;
@@ -542,11 +543,6 @@ namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheChampion
Position SpawnPosition = new Position(746.261f, 657.401f, 411.681f, 4.65f); Position SpawnPosition = new Position(746.261f, 657.401f, 411.681f, 4.65f);
} }
public override CreatureAI GetAI(Creature creature)
{
return GetInstanceAI<npc_announcer_toc5AI>(creature);
}
public override bool OnGossipHello(Player player, Creature creature) public override bool OnGossipHello(Player player, Creature creature)
{ {
InstanceScript instance = creature.GetInstanceScript(); InstanceScript instance = creature.GetInstanceScript();
@@ -583,5 +579,10 @@ namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheChampion
return true; return true;
} }
public override CreatureAI GetAI(Creature creature)
{
return instance_trial_of_the_champion.GetTrialOfTheChampionAI<npc_announcer_toc5AI>(creature);
}
} }
} }
@@ -85,484 +85,403 @@ namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheCrusader
} }
[Script] [Script]
class boss_jaraxxus : CreatureScript class boss_jaraxxus : BossAI
{ {
public public boss_jaraxxus(Creature creature) : base(creature, DataTypes.BossJaraxxus) { }
boss_jaraxxus() : base("boss_jaraxxus") { }
class boss_jaraxxusAI : BossAI public override void Reset()
{ {
public boss_jaraxxusAI(Creature creature) : base(creature, DataTypes.BossJaraxxus) { } _Reset();
_events.ScheduleEvent(Jaraxxus.EventFelFireball, 5 * Time.InMilliseconds);
_events.ScheduleEvent(Jaraxxus.EventFelLightning, RandomHelper.URand(10 * Time.InMilliseconds, 15 * Time.InMilliseconds));
_events.ScheduleEvent(Jaraxxus.EventIncinerateFlesh, RandomHelper.URand(20 * Time.InMilliseconds, 25 * Time.InMilliseconds));
_events.ScheduleEvent(Jaraxxus.EventNetherPower, 40 * Time.InMilliseconds);
_events.ScheduleEvent(Jaraxxus.EventLegionFlame, 30 * Time.InMilliseconds);
_events.ScheduleEvent(Jaraxxus.EventSummonoNetherPortal, 20 * Time.InMilliseconds);
_events.ScheduleEvent(Jaraxxus.EventSummonInfernalEruption, 80 * Time.InMilliseconds);
}
public override void Reset() public override void JustReachedHome()
{
_JustReachedHome();
instance.SetBossState(DataTypes.BossJaraxxus, EncounterState.Fail);
DoCast(me, Spells.JaraxxusChains);
me.SetFlag(UnitFields.Flags, UnitFlags.NonAttackable);
}
public override void KilledUnit(Unit who)
{
if (who.IsTypeId(TypeId.Player))
{ {
_Reset(); Talk(Jaraxxus.SayKillPlayer);
_events.ScheduleEvent(Jaraxxus.EventFelFireball, 5 * Time.InMilliseconds); instance.SetData(DataTypes.TributeToImmortalityEligible, 0);
_events.ScheduleEvent(Jaraxxus.EventFelLightning, RandomHelper.URand(10 * Time.InMilliseconds, 15 * Time.InMilliseconds));
_events.ScheduleEvent(Jaraxxus.EventIncinerateFlesh, RandomHelper.URand(20 * Time.InMilliseconds, 25 * Time.InMilliseconds));
_events.ScheduleEvent(Jaraxxus.EventNetherPower, 40 * Time.InMilliseconds);
_events.ScheduleEvent(Jaraxxus.EventLegionFlame, 30 * Time.InMilliseconds);
_events.ScheduleEvent(Jaraxxus.EventSummonoNetherPortal, 20 * Time.InMilliseconds);
_events.ScheduleEvent(Jaraxxus.EventSummonInfernalEruption, 80 * Time.InMilliseconds);
} }
}
public override void JustReachedHome() public override void JustDied(Unit killer)
{ {
_JustReachedHome(); _JustDied();
instance.SetBossState(DataTypes.BossJaraxxus, EncounterState.Fail); Talk(Jaraxxus.SayDeath);
DoCast(me, Spells.JaraxxusChains); }
me.SetFlag(UnitFields.Flags, UnitFlags.NonAttackable);
}
public override void KilledUnit(Unit who) public override void JustSummoned(Creature summoned)
{
summons.Summon(summoned);
}
public override void EnterCombat(Unit who)
{
_EnterCombat();
Talk(Jaraxxus.SayAggro);
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_events.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
_events.ExecuteEvents(eventId =>
{ {
if (who.IsTypeId(TypeId.Player)) switch (eventId)
{ {
Talk(Jaraxxus.SayKillPlayer); case Jaraxxus.EventFelFireball:
instance.SetData(DataTypes.TributeToImmortalityEligible, 0); DoCastVictim(Jaraxxus.SpellFelFireball);
} _events.ScheduleEvent(Jaraxxus.EventFelFireball, RandomHelper.URand(10 * Time.InMilliseconds, 15 * Time.InMilliseconds));
} return;
case Jaraxxus.EventFelLightning:
public override void JustDied(Unit killer) {
{ Unit target = SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true, -Jaraxxus.SpellLordHittin);
_JustDied();
Talk(Jaraxxus.SayDeath);
}
public override void JustSummoned(Creature summoned)
{
summons.Summon(summoned);
}
public override void EnterCombat(Unit who)
{
_EnterCombat();
Talk(Jaraxxus.SayAggro);
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_events.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
_events.ExecuteEvents(eventId =>
{
switch (eventId)
{
case Jaraxxus.EventFelFireball:
DoCastVictim(Jaraxxus.SpellFelFireball);
_events.ScheduleEvent(Jaraxxus.EventFelFireball, RandomHelper.URand(10 * Time.InMilliseconds, 15 * Time.InMilliseconds));
return;
case Jaraxxus.EventFelLightning:
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true, -Jaraxxus.SpellLordHittin);
if (target)
DoCast(target, Jaraxxus.SpellFelLighting);
_events.ScheduleEvent(Jaraxxus.EventFelLightning, RandomHelper.URand(10 * Time.InMilliseconds, 15 * Time.InMilliseconds));
return;
}
case Jaraxxus.EventIncinerateFlesh:
{
Unit target = SelectTarget(SelectAggroTarget.Random, 1, 0.0f, true, -Jaraxxus.SpellLordHittin);
if (target)
{
Talk(Jaraxxus.EmoteIncinerate, target);
Talk(Jaraxxus.SayIncinerate);
DoCast(target, Jaraxxus.SpellInfernalEruption);
}
_events.ScheduleEvent(Jaraxxus.EventIncinerateFlesh, RandomHelper.URand(20 * Time.InMilliseconds, 25 * Time.InMilliseconds));
return;
}
case Jaraxxus.EventNetherPower:
me.CastCustomSpell(Jaraxxus.SpellNetherPower, SpellValueMod.AuraStack, RaidMode(5, 10, 5, 10), me, true);
_events.ScheduleEvent(Jaraxxus.EventNetherPower, 40 * Time.InMilliseconds);
return;
case Jaraxxus.EventLegionFlame:
{
Unit target = SelectTarget(SelectAggroTarget.Random, 1, 0.0f, true, -Jaraxxus.SpellLordHittin);
if (target)
{
Talk(Jaraxxus.EmoteLegionFlame, target);
DoCast(target, Jaraxxus.SpellLegionFlame);
}
_events.ScheduleEvent(Jaraxxus.EventLegionFlame, 30 * Time.InMilliseconds);
return;
}
case Jaraxxus.EventSummonoNetherPortal:
Talk(Jaraxxus.EmoteNetherPortal);
Talk(Jaraxxus.SayMistressOfPain);
DoCast(Jaraxxus.SpellNetherPortal);
_events.ScheduleEvent(Jaraxxus.EventSummonoNetherPortal, 2 * Time.Minute * Time.InMilliseconds);
return;
case Jaraxxus.EventSummonInfernalEruption:
Talk(Jaraxxus.EmoteInfernalEruption);
Talk(Jaraxxus.SayInfernalEruption);
DoCast(Jaraxxus.SpellInfernalEruption);
_events.ScheduleEvent(Jaraxxus.EventSummonInfernalEruption, 2 * Time.Minute * Time.InMilliseconds);
return;
}
});
DoMeleeAttackIfReady();
}
}
public override CreatureAI GetAI(Creature creature)
{
return GetInstanceAI<boss_jaraxxusAI>(creature);
}
}
[Script]
class npc_legion_flame : CreatureScript
{
public npc_legion_flame() : base("npc_legion_flame") { }
class npc_legion_flameAI : ScriptedAI
{
public npc_legion_flameAI(Creature creature) : base(creature)
{
SetCombatMovement(false);
_instance = creature.GetInstanceScript();
}
public override void Reset()
{
me.SetFlag(UnitFields.Flags, UnitFlags.NonAttackable | UnitFlags.NotSelectable);
me.SetInCombatWithZone();
DoCast(Jaraxxus.SpellLegionFlameEffect);
}
public override void UpdateAI(uint diff)
{
UpdateVictim();
if (_instance.GetBossState(DataTypes.BossJaraxxus) != EncounterState.InProgress)
me.DespawnOrUnsummon();
}
InstanceScript _instance;
}
public override CreatureAI GetAI(Creature creature)
{
return GetInstanceAI<npc_legion_flameAI>(creature);
}
}
[Script]
class npc_infernal_volcano : CreatureScript
{
public npc_infernal_volcano() : base("npc_infernal_volcano") { }
class npc_infernal_volcanoAI : ScriptedAI
{
public npc_infernal_volcanoAI(Creature creature) : base(creature)
{
_summons = new SummonList(me);
SetCombatMovement(false);
}
public override void Reset()
{
me.SetReactState(ReactStates.Passive);
if (!IsHeroic())
me.SetFlag(UnitFields.Flags, UnitFlags.NonAttackable | UnitFlags.NotSelectable | UnitFlags.Pacified);
else
me.RemoveFlag(UnitFields.Flags, UnitFlags.NonAttackable | UnitFlags.NotSelectable | UnitFlags.Pacified);
_summons.DespawnAll();
}
public override void IsSummonedBy(Unit summoner)
{
DoCast(Jaraxxus.SpellInfernalEruptionEffect);
}
public override void JustSummoned(Creature summoned)
{
_summons.Summon(summoned);
// makes immediate corpse despawn of summoned Felflame Infernals
summoned.SetCorpseDelay(0);
}
public override void JustDied(Unit killer)
{
// used to despawn corpse immediately
me.DespawnOrUnsummon();
}
public override void UpdateAI(uint diff) { }
SummonList _summons;
}
public override CreatureAI GetAI(Creature creature)
{
return new npc_infernal_volcanoAI(creature);
}
}
[Script]
class npc_fel_infernal : CreatureScript
{
public npc_fel_infernal() : base("npc_fel_infernal") { }
class npc_fel_infernalAI : ScriptedAI
{
public npc_fel_infernalAI(Creature creature) : base(creature)
{
_instance = creature.GetInstanceScript();
}
public override void Reset()
{
_felStreakTimer = 30 * Time.InMilliseconds;
me.SetInCombatWithZone();
}
public override void UpdateAI(uint diff)
{
if (_instance.GetBossState(DataTypes.BossJaraxxus) != EncounterState.InProgress)
{
me.DespawnOrUnsummon();
return;
}
if (!UpdateVictim())
return;
if (_felStreakTimer <= diff)
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true);
if (target)
DoCast(target, Jaraxxus.SpellFelStreak);
_felStreakTimer = 30 * Time.InMilliseconds;
}
else
_felStreakTimer -= diff;
DoMeleeAttackIfReady();
}
uint _felStreakTimer;
InstanceScript _instance;
}
public override CreatureAI GetAI(Creature creature)
{
return GetInstanceAI<npc_fel_infernalAI>(creature);
}
}
[Script]
class npc_nether_portal : CreatureScript
{
public npc_nether_portal() : base("npc_nether_portal") { }
class npc_nether_portalAI : ScriptedAI
{
public npc_nether_portalAI(Creature creature) : base(creature)
{
_summons = new SummonList(me);
}
public override void Reset()
{
me.SetReactState(ReactStates.Passive);
if (!IsHeroic())
me.SetFlag(UnitFields.Flags, UnitFlags.NonAttackable | UnitFlags.NotSelectable | UnitFlags.Pacified);
else
me.RemoveFlag(UnitFields.Flags, UnitFlags.NonAttackable | UnitFlags.NotSelectable | UnitFlags.Pacified);
_summons.DespawnAll();
}
public override void IsSummonedBy(Unit summoner)
{
DoCast(Jaraxxus.SpellNetherPortalEffect);
}
public override void JustSummoned(Creature summoned)
{
_summons.Summon(summoned);
// makes immediate corpse despawn of summoned Mistress of Pain
summoned.SetCorpseDelay(0);
}
public override void JustDied(Unit killer)
{
// used to despawn corpse immediately
me.DespawnOrUnsummon();
}
public override void UpdateAI(uint diff) { }
SummonList _summons;
}
public override CreatureAI GetAI(Creature creature)
{
return new npc_nether_portalAI(creature);
}
}
[Script]
class npc_mistress_of_pain : CreatureScript
{
public npc_mistress_of_pain() : base("npc_mistress_of_pain") { }
class npc_mistress_of_painAI : ScriptedAI
{
public npc_mistress_of_painAI(Creature creature) : base(creature)
{
_instance = creature.GetInstanceScript();
_instance.SetData(DataTypes.MistressOfPainCount, DataTypes.Increase);
}
public override void Reset()
{
_events.ScheduleEvent(Jaraxxus.EventShivanSlash, 30 * Time.InMilliseconds);
_events.ScheduleEvent(Jaraxxus.EventSpinningStrike, 30 * Time.InMilliseconds);
if (IsHeroic())
_events.ScheduleEvent(Jaraxxus.EventMistressKiss, 15 * Time.InMilliseconds);
me.SetInCombatWithZone();
}
public override void JustDied(Unit killer)
{
_instance.SetData(DataTypes.MistressOfPainCount, DataTypes.Decrease);
}
public override void UpdateAI(uint diff)
{
if (_instance.GetBossState(DataTypes.BossJaraxxus) != EncounterState.InProgress)
{
me.DespawnOrUnsummon();
return;
}
if (!UpdateVictim())
return;
_events.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
_events.ExecuteEvents(eventId =>
{
switch (eventId)
{
case Jaraxxus.EventShivanSlash:
DoCastVictim(Jaraxxus.SpellShivanSlash);
_events.ScheduleEvent(Jaraxxus.EventShivanSlash, 30 * Time.InMilliseconds);
return;
case Jaraxxus.EventSpinningStrike:
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true);
if (target) if (target)
DoCast(target, Jaraxxus.SpellSpinningStrike); DoCast(target, Jaraxxus.SpellFelLighting);
_events.ScheduleEvent(Jaraxxus.EventSpinningStrike, 30 * Time.InMilliseconds); _events.ScheduleEvent(Jaraxxus.EventFelLightning, RandomHelper.URand(10 * Time.InMilliseconds, 15 * Time.InMilliseconds));
return; return;
case Jaraxxus.EventMistressKiss: }
DoCast(me, Jaraxxus.SpellMistressKiss); case Jaraxxus.EventIncinerateFlesh:
_events.ScheduleEvent(Jaraxxus.EventMistressKiss, 30 * Time.InMilliseconds); {
Unit target = SelectTarget(SelectAggroTarget.Random, 1, 0.0f, true, -Jaraxxus.SpellLordHittin);
if (target)
{
Talk(Jaraxxus.EmoteIncinerate, target);
Talk(Jaraxxus.SayIncinerate);
DoCast(target, Jaraxxus.SpellInfernalEruption);
}
_events.ScheduleEvent(Jaraxxus.EventIncinerateFlesh, RandomHelper.URand(20 * Time.InMilliseconds, 25 * Time.InMilliseconds));
return; return;
default: }
break; case Jaraxxus.EventNetherPower:
} me.CastCustomSpell(Jaraxxus.SpellNetherPower, SpellValueMod.AuraStack, RaidMode(5, 10, 5, 10), me, true);
}); _events.ScheduleEvent(Jaraxxus.EventNetherPower, 40 * Time.InMilliseconds);
return;
case Jaraxxus.EventLegionFlame:
{
Unit target = SelectTarget(SelectAggroTarget.Random, 1, 0.0f, true, -Jaraxxus.SpellLordHittin);
if (target)
{
Talk(Jaraxxus.EmoteLegionFlame, target);
DoCast(target, Jaraxxus.SpellLegionFlame);
}
_events.ScheduleEvent(Jaraxxus.EventLegionFlame, 30 * Time.InMilliseconds);
return;
}
case Jaraxxus.EventSummonoNetherPortal:
Talk(Jaraxxus.EmoteNetherPortal);
Talk(Jaraxxus.SayMistressOfPain);
DoCast(Jaraxxus.SpellNetherPortal);
_events.ScheduleEvent(Jaraxxus.EventSummonoNetherPortal, 2 * Time.Minute * Time.InMilliseconds);
return;
case Jaraxxus.EventSummonInfernalEruption:
Talk(Jaraxxus.EmoteInfernalEruption);
Talk(Jaraxxus.SayInfernalEruption);
DoCast(Jaraxxus.SpellInfernalEruption);
_events.ScheduleEvent(Jaraxxus.EventSummonInfernalEruption, 2 * Time.Minute * Time.InMilliseconds);
return;
}
});
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
}
InstanceScript _instance;
}
public override CreatureAI GetAI(Creature creature)
{
return GetInstanceAI<npc_mistress_of_painAI>(creature);
} }
} }
[Script] [Script]
class spell_mistress_kiss : SpellScriptLoader class npc_legion_flame : ScriptedAI
{ {
public spell_mistress_kiss() : base("spell_mistress_kiss") { } public npc_legion_flame(Creature creature) : base(creature)
class spell_mistress_kiss_AuraScript : AuraScript
{ {
public override bool Load() SetCombatMovement(false);
_instance = creature.GetInstanceScript();
}
public override void Reset()
{
me.SetFlag(UnitFields.Flags, UnitFlags.NonAttackable | UnitFlags.NotSelectable);
me.SetInCombatWithZone();
DoCast(Jaraxxus.SpellLegionFlameEffect);
}
public override void UpdateAI(uint diff)
{
UpdateVictim();
if (_instance.GetBossState(DataTypes.BossJaraxxus) != EncounterState.InProgress)
me.DespawnOrUnsummon();
}
InstanceScript _instance;
}
[Script]
class npc_infernal_volcano : ScriptedAI
{
public npc_infernal_volcano(Creature creature) : base(creature)
{
_summons = new SummonList(me);
SetCombatMovement(false);
}
public override void Reset()
{
me.SetReactState(ReactStates.Passive);
if (!IsHeroic())
me.SetFlag(UnitFields.Flags, UnitFlags.NonAttackable | UnitFlags.NotSelectable | UnitFlags.Pacified);
else
me.RemoveFlag(UnitFields.Flags, UnitFlags.NonAttackable | UnitFlags.NotSelectable | UnitFlags.Pacified);
_summons.DespawnAll();
}
public override void IsSummonedBy(Unit summoner)
{
DoCast(Jaraxxus.SpellInfernalEruptionEffect);
}
public override void JustSummoned(Creature summoned)
{
_summons.Summon(summoned);
// makes immediate corpse despawn of summoned Felflame Infernals
summoned.SetCorpseDelay(0);
}
public override void JustDied(Unit killer)
{
// used to despawn corpse immediately
me.DespawnOrUnsummon();
}
public override void UpdateAI(uint diff) { }
SummonList _summons;
}
[Script]
class npc_fel_infernal : ScriptedAI
{
public npc_fel_infernal(Creature creature) : base(creature)
{
_instance = creature.GetInstanceScript();
}
public override void Reset()
{
_felStreakTimer = 30 * Time.InMilliseconds;
me.SetInCombatWithZone();
}
public override void UpdateAI(uint diff)
{
if (_instance.GetBossState(DataTypes.BossJaraxxus) != EncounterState.InProgress)
{ {
return ValidateSpellInfo(Jaraxxus.SpellMistressKissDamageSilence); me.DespawnOrUnsummon();
return;
} }
void HandleDummyTick(AuraEffect aurEff) if (!UpdateVictim())
return;
if (_felStreakTimer <= diff)
{ {
Unit caster = GetCaster(); Unit target = SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true);
Unit target = GetTarget(); if (target)
if (caster && target) DoCast(target, Jaraxxus.SpellFelStreak);
_felStreakTimer = 30 * Time.InMilliseconds;
}
else
_felStreakTimer -= diff;
DoMeleeAttackIfReady();
}
uint _felStreakTimer;
InstanceScript _instance;
}
[Script]
class npc_nether_portal : ScriptedAI
{
public npc_nether_portal(Creature creature) : base(creature)
{
_summons = new SummonList(me);
}
public override void Reset()
{
me.SetReactState(ReactStates.Passive);
if (!IsHeroic())
me.SetFlag(UnitFields.Flags, UnitFlags.NonAttackable | UnitFlags.NotSelectable | UnitFlags.Pacified);
else
me.RemoveFlag(UnitFields.Flags, UnitFlags.NonAttackable | UnitFlags.NotSelectable | UnitFlags.Pacified);
_summons.DespawnAll();
}
public override void IsSummonedBy(Unit summoner)
{
DoCast(Jaraxxus.SpellNetherPortalEffect);
}
public override void JustSummoned(Creature summoned)
{
_summons.Summon(summoned);
// makes immediate corpse despawn of summoned Mistress of Pain
summoned.SetCorpseDelay(0);
}
public override void JustDied(Unit killer)
{
// used to despawn corpse immediately
me.DespawnOrUnsummon();
}
public override void UpdateAI(uint diff) { }
SummonList _summons;
}
[Script]
class npc_mistress_of_pain : ScriptedAI
{
public npc_mistress_of_pain(Creature creature) : base(creature)
{
_instance = creature.GetInstanceScript();
_instance.SetData(DataTypes.MistressOfPainCount, DataTypes.Increase);
}
public override void Reset()
{
_events.ScheduleEvent(Jaraxxus.EventShivanSlash, 30 * Time.InMilliseconds);
_events.ScheduleEvent(Jaraxxus.EventSpinningStrike, 30 * Time.InMilliseconds);
if (IsHeroic())
_events.ScheduleEvent(Jaraxxus.EventMistressKiss, 15 * Time.InMilliseconds);
me.SetInCombatWithZone();
}
public override void JustDied(Unit killer)
{
_instance.SetData(DataTypes.MistressOfPainCount, DataTypes.Decrease);
}
public override void UpdateAI(uint diff)
{
if (_instance.GetBossState(DataTypes.BossJaraxxus) != EncounterState.InProgress)
{
me.DespawnOrUnsummon();
return;
}
if (!UpdateVictim())
return;
_events.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
_events.ExecuteEvents(eventId =>
{
switch (eventId)
{ {
if (target.HasUnitState(UnitState.Casting)) case Jaraxxus.EventShivanSlash:
{ DoCastVictim(Jaraxxus.SpellShivanSlash);
caster.CastSpell(target, Jaraxxus.SpellMistressKissDamageSilence, true); _events.ScheduleEvent(Jaraxxus.EventShivanSlash, 30 * Time.InMilliseconds);
target.RemoveAurasDueToSpell(GetSpellInfo().Id); return;
} case Jaraxxus.EventSpinningStrike:
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true);
if (target)
DoCast(target, Jaraxxus.SpellSpinningStrike);
_events.ScheduleEvent(Jaraxxus.EventSpinningStrike, 30 * Time.InMilliseconds);
return;
case Jaraxxus.EventMistressKiss:
DoCast(me, Jaraxxus.SpellMistressKiss);
_events.ScheduleEvent(Jaraxxus.EventMistressKiss, 30 * Time.InMilliseconds);
return;
default:
break;
}
});
DoMeleeAttackIfReady();
}
InstanceScript _instance;
}
[Script]
class spell_mistress_kiss : AuraScript
{
public override bool Load()
{
return ValidateSpellInfo(Jaraxxus.SpellMistressKissDamageSilence);
}
void HandleDummyTick(AuraEffect aurEff)
{
Unit caster = GetCaster();
Unit target = GetTarget();
if (caster && target)
{
if (target.HasUnitState(UnitState.Casting))
{
caster.CastSpell(target, Jaraxxus.SpellMistressKissDamageSilence, true);
target.RemoveAurasDueToSpell(GetSpellInfo().Id);
} }
} }
public override void Register()
{
OnEffectPeriodic.Add(new EffectPeriodicHandler(HandleDummyTick, 0, AuraType.PeriodicDummy));
}
} }
public override AuraScript GetAuraScript() public override void Register()
{ {
return new spell_mistress_kiss_AuraScript(); OnEffectPeriodic.Add(new EffectPeriodicHandler(HandleDummyTick, 0, AuraType.PeriodicDummy));
} }
} }
[Script] [Script]
class spell_mistress_kiss_area : SpellScriptLoader class spell_mistress_kiss_area : SpellScript
{ {
public spell_mistress_kiss_area() : base("spell_mistress_kiss_area") { } void FilterTargets(List<WorldObject> targets)
class spell_mistress_kiss_area_SpellScript : SpellScript
{ {
void FilterTargets(List<WorldObject> targets) // get a list of players with mana
{ targets.RemoveAll(unit => unit.IsTypeId(TypeId.Player) && unit.ToPlayer().getPowerType() == PowerType.Mana);
// get a list of players with mana if (targets.Empty())
targets.RemoveAll(unit => unit.IsTypeId(TypeId.Player) && unit.ToPlayer().getPowerType() == PowerType.Mana); return;
if (targets.Empty())
return;
WorldObject target = targets.SelectRandom(); WorldObject target = targets.SelectRandom();
targets.Clear(); targets.Clear();
targets.Add(target); targets.Add(target);
}
void HandleScript(uint effIndex)
{
GetCaster().CastSpell(GetHitUnit(), (uint)GetEffectValue(), true);
}
public override void Register()
{
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitSrcAreaEnemy));
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
}
} }
public override SpellScript GetSpellScript() void HandleScript(uint effIndex)
{ {
return new spell_mistress_kiss_area_SpellScript(); GetCaster().CastSpell(GetHitUnit(), (uint)GetEffectValue(), true);
}
public override void Register()
{
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitSrcAreaEnemy));
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
} }
} }
} }
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+127 -147
View File
@@ -42,7 +42,7 @@ namespace Scripts.Northrend
//Minigob //Minigob
public const int SpellManabonked = 61834; public const int SpellManabonked = 61834;
public const int SpellTeleportVisual = 51347; public const int SpellTeleportVisual = 51347;
public const int SpellImprovedBlink = 61995; public const int SpellImprovedBlink = 61995;
public const int EventSelectTarget = 1; public const int EventSelectTarget = 1;
public const int EventBlink = 2; public const int EventBlink = 2;
@@ -50,174 +50,154 @@ namespace Scripts.Northrend
public const int EventDespawn = 4; public const int EventDespawn = 4;
public const int MailMinigobEntry = 264; public const int MailMinigobEntry = 264;
public const int MailDeliverDelayMin = 5 * Time.Minute; public const int MailDeliverDelayMin = 5 * Time.Minute;
public const int MailDeliverDelayMax = 15 * Time.Minute; public const int MailDeliverDelayMax = 15 * Time.Minute;
} }
[Script] [Script]
class npc_mageguard_dalaran : CreatureScript class npc_mageguard_dalaran : ScriptedAI
{ {
public npc_mageguard_dalaran() : base("npc_mageguard_dalaran") { } public npc_mageguard_dalaran(Creature creature) : base(creature)
class npc_mageguard_dalaranAI : ScriptedAI
{ {
public npc_mageguard_dalaranAI(Creature creature) : base(creature) creature.SetFlag(UnitFields.Flags, UnitFlags.NonAttackable);
{ creature.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchools.Normal, true);
creature.SetFlag(UnitFields.Flags, UnitFlags.NonAttackable); creature.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Magic, true);
creature.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchools.Normal, true); }
creature.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Magic, true);
}
public override void Reset() { } public override void Reset() { }
public override void EnterCombat(Unit who) { } public override void EnterCombat(Unit who) { }
public override void AttackStart(Unit who) { } public override void AttackStart(Unit who) { }
public override void MoveInLineOfSight(Unit who) public override void MoveInLineOfSight(Unit who)
{ {
if (!who || !who.IsInWorld || who.GetZoneId() != 4395) if (!who || !who.IsInWorld || who.GetZoneId() != 4395)
return;
if (!me.IsWithinDist(who, 65.0f, false))
return;
Player player = who.GetCharmerOrOwnerPlayerOrPlayerItself();
if (!player || player.IsGameMaster() || player.IsBeingTeleported() ||
// If player has Disguise aura for quest A Meeting With The Magister or An Audience With The Arcanist, do not teleport it away but let it pass
player.HasAura(DalaranConst.SpellSunreaverDisguiseFemale) || player.HasAura(DalaranConst.SpellSunreaverDisguiseMale) ||
player.HasAura(DalaranConst.SpellSilverConenantDisguiseFemale) || player.HasAura(DalaranConst.SpellSilverConenantDisguiseMale))
return;
switch (me.GetEntry())
{
case 29254:
if (player.GetTeam() == Team.Horde) // Horde unit found in Alliance area
{
if (GetClosestCreatureWithEntry(me, DalaranConst.NpcAplleboughA, 32.0f))
{
if (me.isInBackInMap(who, 12.0f)) // In my line of sight, "outdoors", and behind me
DoCast(who, DalaranConst.SpellTrespasserA); // Teleport the Horde unit out
}
else // In my line of sight, and "indoors"
DoCast(who, DalaranConst.SpellTrespasserA); // Teleport the Horde unit out
}
break;
case 29255:
if (player.GetTeam() == Team.Alliance) // Alliance unit found in Horde area
{
if (GetClosestCreatureWithEntry(me, DalaranConst.NpcSweetberryH, 32.0f))
{
if (me.isInBackInMap(who, 12.0f)) // In my line of sight, "outdoors", and behind me
DoCast(who, DalaranConst.SpellTrespasserH); // Teleport the Alliance unit out
}
else // In my line of sight, and "indoors"
DoCast(who, DalaranConst.SpellTrespasserH); // Teleport the Alliance unit out
}
break;
}
me.SetOrientation(me.GetHomePosition().GetOrientation());
return; return;
if (!me.IsWithinDist(who, 65.0f, false))
return;
Player player = who.GetCharmerOrOwnerPlayerOrPlayerItself();
if (!player || player.IsGameMaster() || player.IsBeingTeleported() ||
// If player has Disguise aura for quest A Meeting With The Magister or An Audience With The Arcanist, do not teleport it away but let it pass
player.HasAura(DalaranConst.SpellSunreaverDisguiseFemale) || player.HasAura(DalaranConst.SpellSunreaverDisguiseMale) ||
player.HasAura(DalaranConst.SpellSilverConenantDisguiseFemale) || player.HasAura(DalaranConst.SpellSilverConenantDisguiseMale))
return;
switch (me.GetEntry())
{
case 29254:
if (player.GetTeam() == Team.Horde) // Horde unit found in Alliance area
{
if (GetClosestCreatureWithEntry(me, DalaranConst.NpcAplleboughA, 32.0f))
{
if (me.isInBackInMap(who, 12.0f)) // In my line of sight, "outdoors", and behind me
DoCast(who, DalaranConst.SpellTrespasserA); // Teleport the Horde unit out
}
else // In my line of sight, and "indoors"
DoCast(who, DalaranConst.SpellTrespasserA); // Teleport the Horde unit out
}
break;
case 29255:
if (player.GetTeam() == Team.Alliance) // Alliance unit found in Horde area
{
if (GetClosestCreatureWithEntry(me, DalaranConst.NpcSweetberryH, 32.0f))
{
if (me.isInBackInMap(who, 12.0f)) // In my line of sight, "outdoors", and behind me
DoCast(who, DalaranConst.SpellTrespasserH); // Teleport the Alliance unit out
}
else // In my line of sight, and "indoors"
DoCast(who, DalaranConst.SpellTrespasserH); // Teleport the Alliance unit out
}
break;
} }
me.SetOrientation(me.GetHomePosition().GetOrientation());
public override void UpdateAI(uint diff) { } return;
} }
public override CreatureAI GetAI(Creature creature) public override void UpdateAI(uint diff) { }
{
return new npc_mageguard_dalaranAI(creature);
}
} }
[Script] [Script]
class npc_minigob_manabonk : CreatureScript class npc_minigob_manabonk : ScriptedAI
{ {
public npc_minigob_manabonk() : base("npc_minigob_manabonk") { } public npc_minigob_manabonk(Creature creature) : base(creature)
class npc_minigob_manabonkAI : ScriptedAI
{ {
public npc_minigob_manabonkAI(Creature creature) : base(creature) me.setActive(true);
{
me.setActive(true);
}
public override void Reset()
{
me.SetVisible(false);
_events.ScheduleEvent(DalaranConst.EventSelectTarget, Time.InMilliseconds);
}
Player SelectTargetInDalaran()
{
List<Player> PlayerInDalaranList = new List<Player>();
var players = me.GetMap().GetPlayers();
foreach (var player in players)
{
if (player.GetZoneId() == me.GetZoneId() && !player.IsFlying() && !player.IsMounted() && !player.IsGameMaster())
PlayerInDalaranList.Add(player);
}
if (PlayerInDalaranList.Empty())
return null;
return PlayerInDalaranList.SelectRandom();
}
void SendMailToPlayer(Player player)
{
SQLTransaction trans = new SQLTransaction();
uint deliverDelay = RandomHelper.URand(DalaranConst.MailDeliverDelayMin, DalaranConst.MailDeliverDelayMax);
new MailDraft(DalaranConst.MailMinigobEntry, true).SendMailTo(trans, new MailReceiver(player), new MailSender(MailMessageType.Creature, me.GetEntry()), MailCheckMask.None, deliverDelay);
DB.Characters.CommitTransaction(trans);
}
public override void UpdateAI(uint diff)
{
_events.Update(diff);
_events.ExecuteEvents(eventId =>
{
switch (eventId)
{
case DalaranConst.EventSelectTarget:
me.SetVisible(true);
DoCast(me, DalaranConst.SpellTeleportVisual);
Player player = SelectTargetInDalaran();
if (player)
{
me.NearTeleportTo(player.GetPositionX(), player.GetPositionY(), player.GetPositionZ(), 0.0f);
DoCast(player, DalaranConst.SpellManabonked);
SendMailToPlayer(player);
}
_events.ScheduleEvent(DalaranConst.EventBlink, 3 * Time.InMilliseconds);
break;
case DalaranConst.EventBlink:
{
DoCast(me, DalaranConst.SpellImprovedBlink);
Position pos = me.GetRandomNearPosition(RandomHelper.FRand(15, 40));
me.GetMotionMaster().MovePoint(0, pos.posX, pos.posY, pos.posZ);
_events.ScheduleEvent(DalaranConst.EventDespawn, 3 * Time.InMilliseconds);
_events.ScheduleEvent(DalaranConst.EventDespawnVisual, (uint)(2.5 * Time.InMilliseconds));
break;
}
case DalaranConst.EventDespawnVisual:
DoCast(me, DalaranConst.SpellTeleportVisual);
break;
case DalaranConst.EventDespawn:
me.DespawnOrUnsummon();
break;
default:
break;
}
});
}
} }
public override CreatureAI GetAI(Creature creature) public override void Reset()
{ {
return new npc_minigob_manabonkAI(creature); me.SetVisible(false);
_events.ScheduleEvent(DalaranConst.EventSelectTarget, Time.InMilliseconds);
}
Player SelectTargetInDalaran()
{
List<Player> PlayerInDalaranList = new List<Player>();
var players = me.GetMap().GetPlayers();
foreach (var player in players)
{
if (player.GetZoneId() == me.GetZoneId() && !player.IsFlying() && !player.IsMounted() && !player.IsGameMaster())
PlayerInDalaranList.Add(player);
}
if (PlayerInDalaranList.Empty())
return null;
return PlayerInDalaranList.SelectRandom();
}
void SendMailToPlayer(Player player)
{
SQLTransaction trans = new SQLTransaction();
uint deliverDelay = RandomHelper.URand(DalaranConst.MailDeliverDelayMin, DalaranConst.MailDeliverDelayMax);
new MailDraft(DalaranConst.MailMinigobEntry, true).SendMailTo(trans, new MailReceiver(player), new MailSender(MailMessageType.Creature, me.GetEntry()), MailCheckMask.None, deliverDelay);
DB.Characters.CommitTransaction(trans);
}
public override void UpdateAI(uint diff)
{
_events.Update(diff);
_events.ExecuteEvents(eventId =>
{
switch (eventId)
{
case DalaranConst.EventSelectTarget:
me.SetVisible(true);
DoCast(me, DalaranConst.SpellTeleportVisual);
Player player = SelectTargetInDalaran();
if (player)
{
me.NearTeleportTo(player.GetPositionX(), player.GetPositionY(), player.GetPositionZ(), 0.0f);
DoCast(player, DalaranConst.SpellManabonked);
SendMailToPlayer(player);
}
_events.ScheduleEvent(DalaranConst.EventBlink, 3 * Time.InMilliseconds);
break;
case DalaranConst.EventBlink:
{
DoCast(me, DalaranConst.SpellImprovedBlink);
Position pos = me.GetRandomNearPosition(RandomHelper.FRand(15, 40));
me.GetMotionMaster().MovePoint(0, pos.posX, pos.posY, pos.posZ);
_events.ScheduleEvent(DalaranConst.EventDespawn, 3 * Time.InMilliseconds);
_events.ScheduleEvent(DalaranConst.EventDespawnVisual, (uint)(2.5 * Time.InMilliseconds));
break;
}
case DalaranConst.EventDespawnVisual:
DoCast(me, DalaranConst.SpellTeleportVisual);
break;
case DalaranConst.EventDespawn:
me.DespawnOrUnsummon();
break;
default:
break;
}
});
} }
} }
} }
+161 -191
View File
@@ -43,221 +43,191 @@ namespace Scripts.Northrend.DraktharonKeep.KingDred
} }
[Script] [Script]
class boss_king_dred : CreatureScript class boss_king_dred : BossAI
{ {
public boss_king_dred() : base("boss_king_dred") { } public boss_king_dred(Creature creature) : base(creature, DTKDataTypes.KingDred)
class boss_king_dredAI : BossAI
{ {
public boss_king_dredAI(Creature creature) : base(creature, DTKDataTypes.KingDred) Initialize();
{
Initialize();
}
void Initialize()
{
raptorsKilled = 0;
}
public override void Reset()
{
Initialize();
_Reset();
}
public override void EnterCombat(Unit who)
{
_EnterCombat();
_scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting));
_scheduler.Schedule(TimeSpan.FromSeconds(33), task =>
{
DoCastAOE(SpellIds.BellowingRoar);
task.Repeat();
});
_scheduler.Schedule(TimeSpan.FromSeconds(20), task =>
{
DoCastVictim(SpellIds.GrievousBite);
task.Repeat();
});
_scheduler.Schedule(TimeSpan.FromSeconds(18.5), task =>
{
DoCastVictim(SpellIds.ManglingSlash);
task.Repeat();
});
_scheduler.Schedule(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(20), task =>
{
DoCastAOE(SpellIds.FearsomeRoar);
task.Repeat();
});
_scheduler.Schedule(TimeSpan.FromSeconds(17), task =>
{
DoCastVictim(SpellIds.PiercingSlash);
task.Repeat();
});
_scheduler.Schedule(TimeSpan.FromSeconds(20), TimeSpan.FromSeconds(25), task =>
{
DoCastVictim(SpellIds.RaptorCall);
float x, y, z;
me.GetClosePoint(out x, out y, out z, me.GetObjectSize() / 3, 10.0f);
me.SummonCreature(RandomHelper.RAND(DTKCreatureIds.DrakkariGutripper, DTKCreatureIds.DrakkariScytheclaw), x, y, z, 0, TempSummonType.DeadDespawn, 1000);
task.Repeat();
});
}
public override void DoAction(int action)
{
if (action == Misc.ActionRaptorKilled)
++raptorsKilled;
}
public override uint GetData(uint type)
{
if (type == Misc.DataRaptorsKilled)
return raptorsKilled;
return 0;
}
public override void JustDied(Unit killer)
{
_JustDied();
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
DoMeleeAttackIfReady();
}
byte raptorsKilled;
} }
public override CreatureAI GetAI(Creature creature) void Initialize()
{ {
return GetInstanceAI<boss_king_dredAI>(creature); raptorsKilled = 0;
} }
public override void Reset()
{
Initialize();
_Reset();
}
public override void EnterCombat(Unit who)
{
_EnterCombat();
_scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting));
_scheduler.Schedule(TimeSpan.FromSeconds(33), task =>
{
DoCastAOE(SpellIds.BellowingRoar);
task.Repeat();
});
_scheduler.Schedule(TimeSpan.FromSeconds(20), task =>
{
DoCastVictim(SpellIds.GrievousBite);
task.Repeat();
});
_scheduler.Schedule(TimeSpan.FromSeconds(18.5), task =>
{
DoCastVictim(SpellIds.ManglingSlash);
task.Repeat();
});
_scheduler.Schedule(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(20), task =>
{
DoCastAOE(SpellIds.FearsomeRoar);
task.Repeat();
});
_scheduler.Schedule(TimeSpan.FromSeconds(17), task =>
{
DoCastVictim(SpellIds.PiercingSlash);
task.Repeat();
});
_scheduler.Schedule(TimeSpan.FromSeconds(20), TimeSpan.FromSeconds(25), task =>
{
DoCastVictim(SpellIds.RaptorCall);
float x, y, z;
me.GetClosePoint(out x, out y, out z, me.GetObjectSize() / 3, 10.0f);
me.SummonCreature(RandomHelper.RAND(DTKCreatureIds.DrakkariGutripper, DTKCreatureIds.DrakkariScytheclaw), x, y, z, 0, TempSummonType.DeadDespawn, 1000);
task.Repeat();
});
}
public override void DoAction(int action)
{
if (action == Misc.ActionRaptorKilled)
++raptorsKilled;
}
public override uint GetData(uint type)
{
if (type == Misc.DataRaptorsKilled)
return raptorsKilled;
return 0;
}
public override void JustDied(Unit killer)
{
_JustDied();
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
DoMeleeAttackIfReady();
}
byte raptorsKilled;
} }
[Script] [Script]
class npc_drakkari_gutripper : CreatureScript class npc_drakkari_gutripper : ScriptedAI
{ {
public npc_drakkari_gutripper() : base("npc_drakkari_gutripper") { } public npc_drakkari_gutripper(Creature creature) : base(creature)
class npc_drakkari_gutripperAI : ScriptedAI
{ {
public npc_drakkari_gutripperAI(Creature creature) : base(creature) Initialize();
{ instance = me.GetInstanceScript();
Initialize();
instance = me.GetInstanceScript();
}
void Initialize()
{
_scheduler.Schedule(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(15), task =>
{
DoCastVictim(SpellIds.GutRip, false);
task.Repeat();
});
}
public override void Reset()
{
Initialize();
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
DoMeleeAttackIfReady();
}
public override void JustDied(Unit killer)
{
Creature dred = ObjectAccessor.GetCreature(me, instance.GetGuidData(DTKDataTypes.KingDred));
if (dred)
dred.GetAI().DoAction(Misc.ActionRaptorKilled);
}
InstanceScript instance;
} }
public override CreatureAI GetAI(Creature creature) void Initialize()
{ {
return GetInstanceAI<npc_drakkari_gutripperAI>(creature); _scheduler.Schedule(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(15), task =>
{
DoCastVictim(SpellIds.GutRip, false);
task.Repeat();
});
} }
public override void Reset()
{
Initialize();
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
DoMeleeAttackIfReady();
}
public override void JustDied(Unit killer)
{
Creature dred = ObjectAccessor.GetCreature(me, instance.GetGuidData(DTKDataTypes.KingDred));
if (dred)
dred.GetAI().DoAction(Misc.ActionRaptorKilled);
}
InstanceScript instance;
} }
[Script] [Script]
class npc_drakkari_scytheclaw : CreatureScript class npc_drakkari_scytheclaw : ScriptedAI
{ {
public npc_drakkari_scytheclaw() : base("npc_drakkari_scytheclaw") { } public npc_drakkari_scytheclaw(Creature creature) : base(creature)
class npc_drakkari_scytheclawAI : ScriptedAI
{ {
public npc_drakkari_scytheclawAI(Creature creature) : base(creature) Initialize();
{ instance = me.GetInstanceScript();
Initialize();
instance = me.GetInstanceScript();
}
void Initialize()
{
_scheduler.Schedule(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(15), task =>
{
DoCastVictim(SpellIds.Rend, false);
task.Repeat();
});
}
public override void Reset()
{
_scheduler.CancelAll();
Initialize();
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
DoMeleeAttackIfReady();
}
public override void JustDied(Unit killer)
{
Creature dred = ObjectAccessor.GetCreature(me, instance.GetGuidData(DTKDataTypes.KingDred));
if (dred)
dred.GetAI().DoAction(Misc.ActionRaptorKilled);
}
InstanceScript instance;
} }
public override CreatureAI GetAI(Creature creature) void Initialize()
{ {
return GetInstanceAI<npc_drakkari_scytheclawAI>(creature); _scheduler.Schedule(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(15), task =>
{
DoCastVictim(SpellIds.Rend, false);
task.Repeat();
});
} }
public override void Reset()
{
_scheduler.CancelAll();
Initialize();
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
DoMeleeAttackIfReady();
}
public override void JustDied(Unit killer)
{
Creature dred = ObjectAccessor.GetCreature(me, instance.GetGuidData(DTKDataTypes.KingDred));
if (dred)
dred.GetAI().DoAction(Misc.ActionRaptorKilled);
}
InstanceScript instance;
} }
[Script] [Script]
+261 -291
View File
@@ -98,303 +98,283 @@ namespace Scripts.Northrend.DraktharonKeep.Novos
} }
[Script] [Script]
class boss_novos : CreatureScript class boss_novos : BossAI
{ {
public boss_novos() : base("boss_novos") { } public boss_novos(Creature creature) : base(creature, DTKDataTypes.Novos)
class boss_novosAI : BossAI
{ {
public boss_novosAI(Creature creature) : base(creature, DTKDataTypes.Novos) Initialize();
_bubbled = false;
}
void Initialize()
{
_ohNovos = true;
}
public override void Reset()
{
_Reset();
Initialize();
SetCrystalsStatus(false);
SetSummonerStatus(false);
SetBubbled(false);
}
public override void EnterCombat(Unit victim)
{
_EnterCombat();
Talk(TextIds.SayAggro);
SetCrystalsStatus(true);
SetSummonerStatus(true);
SetBubbled(true);
}
public override void AttackStart(Unit target)
{
if (!target)
return;
if (me.Attack(target, true))
DoStartNoMovement(target);
}
public override void KilledUnit(Unit who)
{
if (who.IsTypeId(TypeId.Player))
Talk(TextIds.SayKill);
}
public override void JustDied(Unit killer)
{
_JustDied();
Talk(TextIds.SayDeath);
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim() || _bubbled)
return;
_events.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
_events.ExecuteEvents(eventId =>
{ {
Initialize(); switch (eventId)
_bubbled = false; {
} case Misc.EventSummonMinions:
DoCast(SpellIds.SummonMinions);
void Initialize() _events.ScheduleEvent(Misc.EventSummonMinions, 15000);
{ break;
_ohNovos = true; case Misc.EventAttack:
} Unit victim = SelectTarget(SelectAggroTarget.Random);
if (victim)
public override void Reset() DoCast(victim, RandomHelper.RAND(SpellIds.ArcaneBlast, SpellIds.Blizzard, SpellIds.Frostbolt, SpellIds.WrathOfMisery));
{ _events.ScheduleEvent(Misc.EventAttack, 3000);
_Reset(); break;
default:
Initialize(); break;
SetCrystalsStatus(false); }
SetSummonerStatus(false);
SetBubbled(false);
}
public override void EnterCombat(Unit victim)
{
_EnterCombat();
Talk(TextIds.SayAggro);
SetCrystalsStatus(true);
SetSummonerStatus(true);
SetBubbled(true);
}
public override void AttackStart(Unit target)
{
if (!target)
return;
if (me.Attack(target, true))
DoStartNoMovement(target);
}
public override void KilledUnit(Unit who)
{
if (who.IsTypeId(TypeId.Player))
Talk(TextIds.SayKill);
}
public override void JustDied(Unit killer)
{
_JustDied();
Talk(TextIds.SayDeath);
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim() || _bubbled)
return;
_events.Update(diff);
if (me.HasUnitState(UnitState.Casting)) if (me.HasUnitState(UnitState.Casting))
return; return;
});
_events.ExecuteEvents(eventId =>
{
switch (eventId)
{
case Misc.EventSummonMinions:
DoCast(SpellIds.SummonMinions);
_events.ScheduleEvent(Misc.EventSummonMinions, 15000);
break;
case Misc.EventAttack:
Unit victim = SelectTarget(SelectAggroTarget.Random);
if (victim)
DoCast(victim, RandomHelper.RAND(SpellIds.ArcaneBlast, SpellIds.Blizzard, SpellIds.Frostbolt, SpellIds.WrathOfMisery));
_events.ScheduleEvent(Misc.EventAttack, 3000);
break;
default:
break;
}
if (me.HasUnitState(UnitState.Casting))
return;
});
}
public override void DoAction(int action)
{
if (action == DTKDataTypes.ActionCrystalHandlerDied)
{
Talk(TextIds.SayArcaneField);
SetSummonerStatus(false);
SetBubbled(false);
_events.ScheduleEvent(Misc.EventAttack, 3000);
if (IsHeroic())
_events.ScheduleEvent(Misc.EventSummonMinions, 15000);
}
}
public override void MoveInLineOfSight(Unit who)
{
base.MoveInLineOfSight(who);
if (!_ohNovos || !who || !who.IsTypeId(TypeId.Player) || who.GetPositionY() > Misc.MaxYCoordOhNovosMAX)
return;
uint entry = who.GetEntry();
if (entry == DTKCreatureIds.HulkingCorpse || entry == DTKCreatureIds.RisenShadowcaster || entry == DTKCreatureIds.FetidTrollCorpse)
_ohNovos = false;
}
public override uint GetData(uint type)
{
return type == Misc.DataNovosAchiev && _ohNovos ? 1 : 0u;
}
public override void JustSummoned(Creature summon)
{
me.Yell(TextIds.SaySummoningAdds, summon);
me.TextEmote(TextIds.EmoteSummoningAdds, summon);
summon.SelectNearestTargetInAttackDistance(50f);
summons.Summon(summon);
}
void SetBubbled(bool state)
{
_bubbled = state;
if (!state)
{
if (me.HasFlag(UnitFields.Flags, UnitFlags.NonAttackable))
me.RemoveFlag(UnitFields.Flags, UnitFlags.NonAttackable);
if (me.HasUnitState(UnitState.Casting))
me.CastStop();
}
else
{
if (!me.HasFlag(UnitFields.Flags, UnitFlags.NonAttackable))
me.SetFlag(UnitFields.Flags, UnitFlags.NonAttackable);
DoCast(SpellIds.ArcaneField);
}
}
void SetSummonerStatus(bool active)
{
for (byte i = 0; i < 4; i++)
{
ObjectGuid guid = instance.GetGuidData(DTKDataTypes.NovosSummoner1 + i);
if (!guid.IsEmpty())
{
Creature crystalChannelTarget = ObjectAccessor.GetCreature(me, guid);
if (crystalChannelTarget)
{
if (active)
crystalChannelTarget.GetAI().SetData(Misc.summoners[i].eventId, Misc.summoners[i].timer);
else
crystalChannelTarget.GetAI().Reset();
}
}
}
}
void SetCrystalsStatus(bool active)
{
for (byte i = 0; i < 4; i++)
{
ObjectGuid guid = instance.GetGuidData(DTKDataTypes.NovosCrystal1 + i);
if (!guid.IsEmpty())
{
GameObject crystal = ObjectAccessor.GetGameObject(me, guid);
if (crystal)
SetCrystalStatus(crystal, active);
}
}
}
void SetCrystalStatus(GameObject crystal, bool active)
{
crystal.SetGoState(active ? GameObjectState.Active : GameObjectState.Ready);
Creature crystalChannelTarget = crystal.FindNearestCreature(DTKCreatureIds.CrystalChannelTarget, 5.0f);
if (crystalChannelTarget)
{
if (active)
crystalChannelTarget.CastSpell(null, SpellIds.BeamChannel);
else if (crystalChannelTarget.HasUnitState(UnitState.Casting))
crystalChannelTarget.CastStop();
}
}
bool _ohNovos;
bool _bubbled;
} }
public override CreatureAI GetAI(Creature creature) public override void DoAction(int action)
{ {
return GetInstanceAI<boss_novosAI>(creature); if (action == DTKDataTypes.ActionCrystalHandlerDied)
{
Talk(TextIds.SayArcaneField);
SetSummonerStatus(false);
SetBubbled(false);
_events.ScheduleEvent(Misc.EventAttack, 3000);
if (IsHeroic())
_events.ScheduleEvent(Misc.EventSummonMinions, 15000);
}
} }
public override void MoveInLineOfSight(Unit who)
{
base.MoveInLineOfSight(who);
if (!_ohNovos || !who || !who.IsTypeId(TypeId.Player) || who.GetPositionY() > Misc.MaxYCoordOhNovosMAX)
return;
uint entry = who.GetEntry();
if (entry == DTKCreatureIds.HulkingCorpse || entry == DTKCreatureIds.RisenShadowcaster || entry == DTKCreatureIds.FetidTrollCorpse)
_ohNovos = false;
}
public override uint GetData(uint type)
{
return type == Misc.DataNovosAchiev && _ohNovos ? 1 : 0u;
}
public override void JustSummoned(Creature summon)
{
me.Yell(TextIds.SaySummoningAdds, summon);
me.TextEmote(TextIds.EmoteSummoningAdds, summon);
summon.SelectNearestTargetInAttackDistance(50f);
summons.Summon(summon);
}
void SetBubbled(bool state)
{
_bubbled = state;
if (!state)
{
if (me.HasFlag(UnitFields.Flags, UnitFlags.NonAttackable))
me.RemoveFlag(UnitFields.Flags, UnitFlags.NonAttackable);
if (me.HasUnitState(UnitState.Casting))
me.CastStop();
}
else
{
if (!me.HasFlag(UnitFields.Flags, UnitFlags.NonAttackable))
me.SetFlag(UnitFields.Flags, UnitFlags.NonAttackable);
DoCast(SpellIds.ArcaneField);
}
}
void SetSummonerStatus(bool active)
{
for (byte i = 0; i < 4; i++)
{
ObjectGuid guid = instance.GetGuidData(DTKDataTypes.NovosSummoner1 + i);
if (!guid.IsEmpty())
{
Creature crystalChannelTarget = ObjectAccessor.GetCreature(me, guid);
if (crystalChannelTarget)
{
if (active)
crystalChannelTarget.GetAI().SetData(Misc.summoners[i].eventId, Misc.summoners[i].timer);
else
crystalChannelTarget.GetAI().Reset();
}
}
}
}
void SetCrystalsStatus(bool active)
{
for (byte i = 0; i < 4; i++)
{
ObjectGuid guid = instance.GetGuidData(DTKDataTypes.NovosCrystal1 + i);
if (!guid.IsEmpty())
{
GameObject crystal = ObjectAccessor.GetGameObject(me, guid);
if (crystal)
SetCrystalStatus(crystal, active);
}
}
}
void SetCrystalStatus(GameObject crystal, bool active)
{
crystal.SetGoState(active ? GameObjectState.Active : GameObjectState.Ready);
Creature crystalChannelTarget = crystal.FindNearestCreature(DTKCreatureIds.CrystalChannelTarget, 5.0f);
if (crystalChannelTarget)
{
if (active)
crystalChannelTarget.CastSpell(null, SpellIds.BeamChannel);
else if (crystalChannelTarget.HasUnitState(UnitState.Casting))
crystalChannelTarget.CastStop();
}
}
bool _ohNovos;
bool _bubbled;
} }
[Script] [Script]
class npc_crystal_channel_target : CreatureScript class npc_crystal_channel_target : ScriptedAI
{ {
public npc_crystal_channel_target() : base("npc_crystal_channel_target") { } public npc_crystal_channel_target(Creature creature) : base(creature) { }
class npc_crystal_channel_targetAI : ScriptedAI public override void Reset()
{ {
public npc_crystal_channel_targetAI(Creature creature) : base(creature) { } _events.Reset();
_crystalHandlerCount = 0;
}
public override void Reset() public override void UpdateAI(uint diff)
{
_events.Update(diff);
_events.ExecuteEvents(eventId =>
{ {
_events.Reset(); switch (eventId)
_crystalHandlerCount = 0;
}
public override void UpdateAI(uint diff)
{
_events.Update(diff);
_events.ExecuteEvents(eventId =>
{ {
switch (eventId) case Misc.EventSummonCrystalHandler:
{ me.SummonCreature(DTKCreatureIds.CrystalHandler, Misc.SummonPositions[_crystalHandlerCount++]);
case Misc.EventSummonCrystalHandler: if (_crystalHandlerCount < 4)
me.SummonCreature(DTKCreatureIds.CrystalHandler, Misc.SummonPositions[_crystalHandlerCount++]); _events.Repeat(TimeSpan.FromSeconds(15));
if (_crystalHandlerCount < 4) break;
_events.Repeat(TimeSpan.FromSeconds(15)); case Misc.EventSummonRisenShadowcaster:
break; DoCast(SpellIds.SummonRisenShadowcaster);
case Misc.EventSummonRisenShadowcaster: _events.Repeat(TimeSpan.FromSeconds(7));
DoCast(SpellIds.SummonRisenShadowcaster); break;
_events.Repeat(TimeSpan.FromSeconds(7)); case Misc.EventSummonFetidTrollCorpse:
break; DoCast(SpellIds.SummonFetidTrollCorpse);
case Misc.EventSummonFetidTrollCorpse: _events.Repeat(TimeSpan.FromSeconds(3));
DoCast(SpellIds.SummonFetidTrollCorpse); break;
_events.Repeat(TimeSpan.FromSeconds(3)); case Misc.EventSummonHulkingCorpse:
break; DoCast(SpellIds.SummonHulkingCorpse);
case Misc.EventSummonHulkingCorpse: _events.Repeat(TimeSpan.FromSeconds(30));
DoCast(SpellIds.SummonHulkingCorpse); break;
_events.Repeat(TimeSpan.FromSeconds(30)); }
break; });
} }
});
}
public override void SetData(uint id, uint value) public override void SetData(uint id, uint value)
{
_events.ScheduleEvent(id, TimeSpan.FromSeconds(value));
}
public override void SummonedCreatureDies(Creature summon, Unit killer)
{
if (_crystalHandlerCount < 4)
return;
InstanceScript instance = me.GetInstanceScript();
if (instance != null)
{ {
_events.ScheduleEvent(id, TimeSpan.FromSeconds(value)); ObjectGuid guid = instance.GetGuidData(DTKDataTypes.Novos);
} if (!guid.IsEmpty())
public override void SummonedCreatureDies(Creature summon, Unit killer)
{
if (_crystalHandlerCount < 4)
return;
InstanceScript instance = me.GetInstanceScript();
if (instance != null)
{ {
ObjectGuid guid = instance.GetGuidData(DTKDataTypes.Novos); Creature novos = ObjectAccessor.GetCreature(me, guid);
if (!guid.IsEmpty()) if (novos)
{ novos.GetAI().DoAction(DTKDataTypes.ActionCrystalHandlerDied);
Creature novos = ObjectAccessor.GetCreature(me, guid); }
if (novos) }
novos.GetAI().DoAction(DTKDataTypes.ActionCrystalHandlerDied); }
}
public override void JustSummoned(Creature summon)
{
InstanceScript instance = me.GetInstanceScript();
if (instance != null)
{
ObjectGuid guid = instance.GetGuidData(DTKDataTypes.Novos);
if (!guid.IsEmpty())
{
Creature novos = ObjectAccessor.GetCreature(me, guid);
if (novos)
novos.GetAI().JustSummoned(summon);
} }
} }
public override void JustSummoned(Creature summon) if (summon)
{ summon.GetMotionMaster().MovePath(summon.GetEntry() * 100, false);
InstanceScript instance = me.GetInstanceScript();
if (instance != null)
{
ObjectGuid guid = instance.GetGuidData(DTKDataTypes.Novos);
if (!guid.IsEmpty())
{
Creature novos = ObjectAccessor.GetCreature(me, guid);
if (novos)
novos.GetAI().JustSummoned(summon);
}
}
if (summon)
summon.GetMotionMaster().MovePath(summon.GetEntry() * 100, false);
}
uint _crystalHandlerCount;
} }
public override CreatureAI GetAI(Creature creature) uint _crystalHandlerCount;
{
return GetInstanceAI<npc_crystal_channel_targetAI>(creature);
}
} }
[Script] [Script]
@@ -409,32 +389,22 @@ namespace Scripts.Northrend.DraktharonKeep.Novos
} }
[Script] [Script]
class spell_novos_summon_minions : SpellScriptLoader class spell_novos_summon_minions : SpellScript
{ {
public spell_novos_summon_minions() : base("spell_novos_summon_minions") { } public override bool Validate(SpellInfo spellInfo)
class spell_novos_summon_minions_SpellScript : SpellScript
{ {
public override bool Validate(SpellInfo spellInfo) return ValidateSpellInfo(SpellIds.SummonCopyOfMinions);
{
return ValidateSpellInfo(SpellIds.SummonCopyOfMinions);
}
void HandleScript(uint effIndex)
{
for (byte i = 0; i < 2; ++i)
GetCaster().CastSpell((Unit)null, SpellIds.SummonCopyOfMinions, true);
}
public override void Register()
{
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
}
} }
public override SpellScript GetSpellScript() void HandleScript(uint effIndex)
{ {
return new spell_novos_summon_minions_SpellScript(); for (byte i = 0; i < 2; ++i)
GetCaster().CastSpell((Unit)null, SpellIds.SummonCopyOfMinions, true);
}
public override void Register()
{
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
} }
} }
} }
+132 -152
View File
@@ -74,178 +74,158 @@ namespace Scripts.Northrend.DraktharonKeep.TharonJa
} }
[Script] [Script]
class boss_tharon_ja : CreatureScript class boss_tharon_ja : BossAI
{ {
public boss_tharon_ja() : base("boss_tharon_ja") { } public boss_tharon_ja(Creature creature) : base(creature, DTKDataTypes.TharonJa) { }
class boss_tharon_jaAI : BossAI public override void Reset()
{ {
public boss_tharon_jaAI(Creature creature) : base(creature, DTKDataTypes.TharonJa) { } _Reset();
me.RestoreDisplayId();
}
public override void Reset() public override void EnterCombat(Unit who)
{
Talk(TextIds.SayAggro);
_EnterCombat();
_events.ScheduleEvent(EventIds.DecayFlesh, TimeSpan.FromSeconds(20));
_events.ScheduleEvent(EventIds.CurseOfLife, TimeSpan.FromSeconds(1));
_events.ScheduleEvent(EventIds.RainOfFire, TimeSpan.FromSeconds(14), TimeSpan.FromSeconds(18));
_events.ScheduleEvent(EventIds.ShadowVolley, TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(10));
}
public override void KilledUnit(Unit who)
{
if (who.IsTypeId(TypeId.Player))
Talk(TextIds.SayKill);
}
public override void JustDied(Unit killer)
{
_JustDied();
Talk(TextIds.SayDeath);
DoCastAOE(SpellIds.ClearGiftOfTharonJa, true);
DoCastAOE(SpellIds.AchievementCheck, true);
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_events.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
_events.ExecuteEvents(eventId =>
{ {
_Reset(); switch (eventId)
me.RestoreDisplayId(); {
} case EventIds.CurseOfLife:
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100.0f, true);
if (target)
DoCast(target, SpellIds.CurseOfLife);
_events.ScheduleEvent(EventIds.CurseOfLife, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(15));
}
return;
case EventIds.ShadowVolley:
DoCastVictim(SpellIds.ShadowVolley);
_events.ScheduleEvent(EventIds.ShadowVolley, TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(10));
return;
case EventIds.RainOfFire:
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100.0f, true);
if (target)
DoCast(target, SpellIds.RainOfFire);
_events.ScheduleEvent(EventIds.RainOfFire, TimeSpan.FromSeconds(14), TimeSpan.FromSeconds(18));
}
return;
case EventIds.LightningBreath:
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100.0f, true);
if (target)
DoCast(target, SpellIds.LightningBreath);
_events.ScheduleEvent(EventIds.LightningBreath, TimeSpan.FromSeconds(6), TimeSpan.FromSeconds(7));
}
return;
case EventIds.EyeBeam:
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100.0f, true);
if (target)
DoCast(target, SpellIds.EyeBeam);
_events.ScheduleEvent(EventIds.EyeBeam, TimeSpan.FromSeconds(4), TimeSpan.FromSeconds(6));
}
return;
case EventIds.PoisonCloud:
DoCastAOE(SpellIds.PoisonCloud);
_events.ScheduleEvent(EventIds.PoisonCloud, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12));
return;
case EventIds.DecayFlesh:
DoCastAOE(SpellIds.DecayFlesh);
_events.ScheduleEvent(EventIds.GoingFlesh, TimeSpan.FromSeconds(6));
return;
case EventIds.GoingFlesh:
Talk(TextIds.SayFlesh);
me.SetDisplayId(Misc.ModelFlesh);
DoCastAOE(SpellIds.GiftOfTharonJa, true);
DoCast(me, SpellIds.FleshVisual, true);
DoCast(me, SpellIds.Dummy, true);
public override void EnterCombat(Unit who) _events.Reset();
{ _events.ScheduleEvent(EventIds.ReturnFlesh, TimeSpan.FromSeconds(20));
Talk(TextIds.SayAggro); _events.ScheduleEvent(EventIds.LightningBreath, TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(4));
_EnterCombat(); _events.ScheduleEvent(EventIds.EyeBeam, TimeSpan.FromSeconds(4), TimeSpan.FromSeconds(8));
_events.ScheduleEvent(EventIds.PoisonCloud, TimeSpan.FromSeconds(6), TimeSpan.FromSeconds(7));
break;
case EventIds.ReturnFlesh:
DoCastAOE(SpellIds.ReturnFlesh);
_events.ScheduleEvent(EventIds.GoingSkeletal, 6000);
return;
case EventIds.GoingSkeletal:
Talk(TextIds.SaySkeleton);
me.RestoreDisplayId();
DoCastAOE(SpellIds.ClearGiftOfTharonJa, true);
_events.ScheduleEvent(EventIds.DecayFlesh, TimeSpan.FromSeconds(20)); _events.Reset();
_events.ScheduleEvent(EventIds.CurseOfLife, TimeSpan.FromSeconds(1)); _events.ScheduleEvent(EventIds.DecayFlesh, TimeSpan.FromSeconds(20));
_events.ScheduleEvent(EventIds.RainOfFire, TimeSpan.FromSeconds(14), TimeSpan.FromSeconds(18)); _events.ScheduleEvent(EventIds.CurseOfLife, TimeSpan.FromSeconds(1));
_events.ScheduleEvent(EventIds.ShadowVolley, TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(10)); _events.ScheduleEvent(EventIds.RainOfFire, TimeSpan.FromSeconds(14), TimeSpan.FromSeconds(18));
} _events.ScheduleEvent(EventIds.ShadowVolley, TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(10));
break;
public override void KilledUnit(Unit who) default:
{ break;
if (who.IsTypeId(TypeId.Player)) }
Talk(TextIds.SayKill);
}
public override void JustDied(Unit killer)
{
_JustDied();
Talk(TextIds.SayDeath);
DoCastAOE(SpellIds.ClearGiftOfTharonJa, true);
DoCastAOE(SpellIds.AchievementCheck, true);
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_events.Update(diff);
if (me.HasUnitState(UnitState.Casting)) if (me.HasUnitState(UnitState.Casting))
return; return;
});
_events.ExecuteEvents(eventId => DoMeleeAttackIfReady();
{
switch (eventId)
{
case EventIds.CurseOfLife:
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100.0f, true);
if (target)
DoCast(target, SpellIds.CurseOfLife);
_events.ScheduleEvent(EventIds.CurseOfLife, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(15));
}
return;
case EventIds.ShadowVolley:
DoCastVictim(SpellIds.ShadowVolley);
_events.ScheduleEvent(EventIds.ShadowVolley, TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(10));
return;
case EventIds.RainOfFire:
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100.0f, true);
if (target)
DoCast(target, SpellIds.RainOfFire);
_events.ScheduleEvent(EventIds.RainOfFire, TimeSpan.FromSeconds(14), TimeSpan.FromSeconds(18));
}
return;
case EventIds.LightningBreath:
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100.0f, true);
if (target)
DoCast(target, SpellIds.LightningBreath);
_events.ScheduleEvent(EventIds.LightningBreath, TimeSpan.FromSeconds(6), TimeSpan.FromSeconds(7));
}
return;
case EventIds.EyeBeam:
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100.0f, true);
if (target)
DoCast(target, SpellIds.EyeBeam);
_events.ScheduleEvent(EventIds.EyeBeam, TimeSpan.FromSeconds(4), TimeSpan.FromSeconds(6));
}
return;
case EventIds.PoisonCloud:
DoCastAOE(SpellIds.PoisonCloud);
_events.ScheduleEvent(EventIds.PoisonCloud, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12));
return;
case EventIds.DecayFlesh:
DoCastAOE(SpellIds.DecayFlesh);
_events.ScheduleEvent(EventIds.GoingFlesh, TimeSpan.FromSeconds(6));
return;
case EventIds.GoingFlesh:
Talk(TextIds.SayFlesh);
me.SetDisplayId(Misc.ModelFlesh);
DoCastAOE(SpellIds.GiftOfTharonJa, true);
DoCast(me, SpellIds.FleshVisual, true);
DoCast(me, SpellIds.Dummy, true);
_events.Reset();
_events.ScheduleEvent(EventIds.ReturnFlesh, TimeSpan.FromSeconds(20));
_events.ScheduleEvent(EventIds.LightningBreath, TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(4));
_events.ScheduleEvent(EventIds.EyeBeam, TimeSpan.FromSeconds(4), TimeSpan.FromSeconds(8));
_events.ScheduleEvent(EventIds.PoisonCloud, TimeSpan.FromSeconds(6), TimeSpan.FromSeconds(7));
break;
case EventIds.ReturnFlesh:
DoCastAOE(SpellIds.ReturnFlesh);
_events.ScheduleEvent(EventIds.GoingSkeletal, 6000);
return;
case EventIds.GoingSkeletal:
Talk(TextIds.SaySkeleton);
me.RestoreDisplayId();
DoCastAOE(SpellIds.ClearGiftOfTharonJa, true);
_events.Reset();
_events.ScheduleEvent(EventIds.DecayFlesh, TimeSpan.FromSeconds(20));
_events.ScheduleEvent(EventIds.CurseOfLife, TimeSpan.FromSeconds(1));
_events.ScheduleEvent(EventIds.RainOfFire, TimeSpan.FromSeconds(14), TimeSpan.FromSeconds(18));
_events.ScheduleEvent(EventIds.ShadowVolley, TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(10));
break;
default:
break;
}
if (me.HasUnitState(UnitState.Casting))
return;
});
DoMeleeAttackIfReady();
}
}
public override CreatureAI GetAI(Creature creature)
{
return GetInstanceAI<boss_tharon_jaAI>(creature);
} }
} }
[Script] [Script]
class spell_tharon_ja_clear_gift_of_tharon_ja : SpellScriptLoader class spell_tharon_ja_clear_gift_of_tharon_ja : SpellScript
{ {
public spell_tharon_ja_clear_gift_of_tharon_ja() : base("spell_tharon_ja_clear_gift_of_tharon_ja") { } public override bool Validate(SpellInfo spellInfo)
class spell_tharon_ja_clear_gift_of_tharon_ja_SpellScript : SpellScript
{ {
public override bool Validate(SpellInfo spellInfo) return ValidateSpellInfo(SpellIds.GiftOfTharonJa);
{
return ValidateSpellInfo(SpellIds.GiftOfTharonJa);
}
void HandleScript(uint effIndex)
{
Unit target = GetHitUnit();
if (target)
target.RemoveAura(SpellIds.GiftOfTharonJa);
}
public override void Register()
{
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
}
} }
public override SpellScript GetSpellScript() void HandleScript(uint effIndex)
{ {
return new spell_tharon_ja_clear_gift_of_tharon_ja_SpellScript(); Unit target = GetHitUnit();
if (target)
target.RemoveAura(SpellIds.GiftOfTharonJa);
}
public override void Register()
{
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
} }
} }
} }
+147 -197
View File
@@ -59,256 +59,206 @@ namespace Scripts.Northrend.DraktharonKeep.Trollgore
} }
[Script] [Script]
class boss_trollgore : CreatureScript class boss_trollgore : BossAI
{ {
public boss_trollgore() : base("boss_trollgore") { } public boss_trollgore(Creature creature) : base(creature, DTKDataTypes.Trollgore)
class boss_trollgoreAI : BossAI
{ {
public boss_trollgoreAI(Creature creature) : base(creature, DTKDataTypes.Trollgore) Initialize();
}
void Initialize()
{
_consumptionJunction = true;
}
public override void Reset()
{
_Reset();
Initialize();
}
public override void EnterCombat(Unit who)
{
_EnterCombat();
Talk(TextIds.SayAggro);
_scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting));
_scheduler.Schedule(TimeSpan.FromSeconds(15), task =>
{
Talk(TextIds.SayConsume);
DoCastAOE(SpellIds.Consume);
task.Repeat();
});
_scheduler.Schedule(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(5), task =>
{ {
Initialize(); DoCastVictim(SpellIds.Crush);
} task.Repeat(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(15));
});
void Initialize() _scheduler.Schedule(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(60), task =>
{ {
_consumptionJunction = true; DoCastVictim(SpellIds.InfectedWound);
} task.Repeat(TimeSpan.FromSeconds(25), TimeSpan.FromSeconds(35));
});
public override void Reset() _scheduler.Schedule(TimeSpan.FromSeconds(3), task =>
{ {
_Reset(); Talk(TextIds.SayExplode);
Initialize(); DoCastAOE(SpellIds.CorpseExplode);
} task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(19));
});
public override void EnterCombat(Unit who) _scheduler.Schedule(TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(40), task =>
{ {
_EnterCombat(); for (byte i = 0; i < 3; ++i)
Talk(TextIds.SayAggro);
_scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting));
_scheduler.Schedule(TimeSpan.FromSeconds(15), task =>
{
Talk(TextIds.SayConsume);
DoCastAOE(SpellIds.Consume);
task.Repeat();
});
_scheduler.Schedule(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(5), task =>
{ {
DoCastVictim(SpellIds.Crush); Creature trigger = ObjectAccessor.GetCreature(me, instance.GetGuidData(DTKDataTypes.TrollgoreInvaderSummoner1 + i));
task.Repeat(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(15)); if (trigger)
}); trigger.CastSpell(trigger, RandomHelper.RAND(SpellIds.SummonInvaderA, SpellIds.SummonInvaderB, SpellIds.SummonInvaderC), true, null, null, me.GetGUID());
_scheduler.Schedule(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(60), task =>
{
DoCastVictim(SpellIds.InfectedWound);
task.Repeat(TimeSpan.FromSeconds(25), TimeSpan.FromSeconds(35));
});
_scheduler.Schedule(TimeSpan.FromSeconds(3), task =>
{
Talk(TextIds.SayExplode);
DoCastAOE(SpellIds.CorpseExplode);
task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(19));
});
_scheduler.Schedule(TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(40), task =>
{
for (byte i = 0; i < 3; ++i)
{
Creature trigger = ObjectAccessor.GetCreature(me, instance.GetGuidData(DTKDataTypes.TrollgoreInvaderSummoner1 + i));
if (trigger)
trigger.CastSpell(trigger, RandomHelper.RAND(SpellIds.SummonInvaderA, SpellIds.SummonInvaderB, SpellIds.SummonInvaderC), true, null, null, me.GetGUID());
}
task.Repeat();
});
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
if (_consumptionJunction)
{
Aura ConsumeAura = me.GetAura(DungeonMode(SpellIds.ConsumeBuff, SpellIds.ConsumeBuffH));
if (ConsumeAura != null && ConsumeAura.GetStackAmount() > 9)
_consumptionJunction = false;
} }
DoMeleeAttackIfReady(); task.Repeat();
} });
public override void JustDied(Unit killer)
{
_JustDied();
Talk(TextIds.SayDeath);
}
public override uint GetData(uint type)
{
if (type == Misc.DataConsumptionJunction)
return _consumptionJunction ? 1 : 0u;
return 0;
}
public override void KilledUnit(Unit victim)
{
if (victim.IsTypeId(TypeId.Player))
Talk(TextIds.SayKill);
}
public override void JustSummoned(Creature summon)
{
summon.GetMotionMaster().MovePoint(Misc.PointLanding, Misc.Landing);
summons.Summon(summon);
}
bool _consumptionJunction;
} }
public override CreatureAI GetAI(Creature creature) public override void UpdateAI(uint diff)
{ {
return GetInstanceAI<boss_trollgoreAI>(creature); if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
if (_consumptionJunction)
{
Aura ConsumeAura = me.GetAura(DungeonMode(SpellIds.ConsumeBuff, SpellIds.ConsumeBuffH));
if (ConsumeAura != null && ConsumeAura.GetStackAmount() > 9)
_consumptionJunction = false;
}
DoMeleeAttackIfReady();
} }
public override void JustDied(Unit killer)
{
_JustDied();
Talk(TextIds.SayDeath);
}
public override uint GetData(uint type)
{
if (type == Misc.DataConsumptionJunction)
return _consumptionJunction ? 1 : 0u;
return 0;
}
public override void KilledUnit(Unit victim)
{
if (victim.IsTypeId(TypeId.Player))
Talk(TextIds.SayKill);
}
public override void JustSummoned(Creature summon)
{
summon.GetMotionMaster().MovePoint(Misc.PointLanding, Misc.Landing);
summons.Summon(summon);
}
bool _consumptionJunction;
} }
[Script] [Script]
class npc_drakkari_invader : CreatureScript class npc_drakkari_invader : ScriptedAI
{ {
public npc_drakkari_invader() : base("npc_drakkari_invader") { } public npc_drakkari_invader(Creature creature) : base(creature) { }
class npc_drakkari_invaderAI : ScriptedAI public override void MovementInform(MovementGeneratorType type, uint pointId)
{ {
public npc_drakkari_invaderAI(Creature creature) : base(creature) { } if (type == MovementGeneratorType.Point && pointId == Misc.PointLanding)
public override void MovementInform(MovementGeneratorType type, uint pointId)
{ {
if (type == MovementGeneratorType.Point && pointId == Misc.PointLanding) me.Dismount();
{ me.RemoveFlag(UnitFields.Flags, UnitFlags.ImmuneToPc | UnitFlags.ImmuneToNpc);
me.Dismount(); DoCastAOE(SpellIds.InvaderTaunt);
me.RemoveFlag(UnitFields.Flags, UnitFlags.ImmuneToPc | UnitFlags.ImmuneToNpc);
DoCastAOE(SpellIds.InvaderTaunt);
}
} }
} }
public override CreatureAI GetAI(Creature creature)
{
return GetInstanceAI<npc_drakkari_invaderAI>(creature);
}
} }
[Script] // 49380, 59803 - Consume [Script] // 49380, 59803 - Consume
class spell_trollgore_consume : SpellScriptLoader class spell_trollgore_consume : SpellScript
{ {
public spell_trollgore_consume() : base("spell_trollgore_consume") { } public override bool Validate(SpellInfo spellInfo)
class spell_trollgore_consume_SpellScript : SpellScript
{ {
public override bool Validate(SpellInfo spellInfo) return ValidateSpellInfo(SpellIds.ConsumeBuff);
{
return ValidateSpellInfo(SpellIds.ConsumeBuff);
}
void HandleConsume(uint effIndex)
{
Unit target = GetHitUnit();
if (target)
target.CastSpell(GetCaster(), SpellIds.ConsumeBuff, true);
}
public override void Register()
{
OnEffectHitTarget.Add(new EffectHandler(HandleConsume, 1, SpellEffectName.ScriptEffect));
}
} }
public override SpellScript GetSpellScript() void HandleConsume(uint effIndex)
{ {
return new spell_trollgore_consume_SpellScript(); Unit target = GetHitUnit();
if (target)
target.CastSpell(GetCaster(), SpellIds.ConsumeBuff, true);
}
public override void Register()
{
OnEffectHitTarget.Add(new EffectHandler(HandleConsume, 1, SpellEffectName.ScriptEffect));
} }
} }
[Script] // 49555, 59807 - Corpse Explode [Script] // 49555, 59807 - Corpse Explode
class spell_trollgore_corpse_explode : SpellScriptLoader class spell_trollgore_corpse_explode : AuraScript
{ {
public spell_trollgore_corpse_explode() : base("spell_trollgore_corpse_explode") { } public override bool Validate(SpellInfo spellInfo)
class spell_trollgore_corpse_explode_AuraScript : AuraScript
{ {
public override bool Validate(SpellInfo spellInfo) return ValidateSpellInfo(SpellIds.CorpseExplodeDamage);
{ }
return ValidateSpellInfo(SpellIds.CorpseExplodeDamage);
}
void PeriodicTick(AuraEffect aurEff) void PeriodicTick(AuraEffect aurEff)
{
if (aurEff.GetTickNumber() == 2)
{ {
if (aurEff.GetTickNumber() == 2) Unit caster = GetCaster();
{ if (caster)
Unit caster = GetCaster(); caster.CastSpell(GetTarget(), SpellIds.CorpseExplodeDamage, true, null, aurEff);
if (caster)
caster.CastSpell(GetTarget(), SpellIds.CorpseExplodeDamage, true, null, aurEff);
}
}
void HandleRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
{
Creature target = GetTarget().ToCreature();
if (target)
target.DespawnOrUnsummon();
}
public override void Register()
{
OnEffectPeriodic.Add(new EffectPeriodicHandler(PeriodicTick, 0, AuraType.Dummy));
AfterEffectRemove.Add(new EffectApplyHandler(HandleRemove, 0, AuraType.PeriodicDummy, AuraEffectHandleModes.Real));
} }
} }
public override AuraScript GetAuraScript() void HandleRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
{ {
return new spell_trollgore_corpse_explode_AuraScript(); Creature target = GetTarget().ToCreature();
if (target)
target.DespawnOrUnsummon();
}
public override void Register()
{
OnEffectPeriodic.Add(new EffectPeriodicHandler(PeriodicTick, 0, AuraType.Dummy));
AfterEffectRemove.Add(new EffectApplyHandler(HandleRemove, 0, AuraType.PeriodicDummy, AuraEffectHandleModes.Real));
} }
} }
[Script] // 49405 - Invader Taunt Trigger [Script] // 49405 - Invader Taunt Trigger
class spell_trollgore_invader_taunt : SpellScriptLoader class spell_trollgore_invader_taunt : SpellScript
{ {
public spell_trollgore_invader_taunt() : base("spell_trollgore_invader_taunt") { } public override bool Validate(SpellInfo spellInfo)
class spell_trollgore_invader_taunt_SpellScript : SpellScript
{ {
public override bool Validate(SpellInfo spellInfo) return ValidateSpellInfo((uint)spellInfo.GetEffect(0).CalcValue());
{
return ValidateSpellInfo((uint)spellInfo.GetEffect(0).CalcValue());
}
void HandleTaunt(uint effIndex)
{
Unit target = GetHitUnit();
if (target)
target.CastSpell(GetCaster(), (uint)GetEffectValue(), true);
}
public override void Register()
{
OnEffectHitTarget.Add(new EffectHandler(HandleTaunt, 0, SpellEffectName.ScriptEffect));
}
} }
public override SpellScript GetSpellScript() void HandleTaunt(uint effIndex)
{ {
return new spell_trollgore_invader_taunt_SpellScript(); Unit target = GetHitUnit();
if (target)
target.CastSpell(GetCaster(), (uint)GetEffectValue(), true);
}
public override void Register()
{
OnEffectHitTarget.Add(new EffectHandler(HandleTaunt, 0, SpellEffectName.ScriptEffect));
} }
} }
@@ -327,7 +277,7 @@ namespace Scripts.Northrend.DraktharonKeep.Trollgore
Creature Trollgore = target.ToCreature(); Creature Trollgore = target.ToCreature();
if (Trollgore) if (Trollgore)
if (Trollgore.GetAI().GetData(Misc.DataConsumptionJunction) != 0) if (Trollgore.GetAI().GetData(Misc.DataConsumptionJunction) != 0)
return true; return true;
return false; return false;
} }
+289 -319
View File
@@ -66,379 +66,349 @@ namespace Scripts.Northrend.Gundrak.DrakkariColossus
} }
[Script] [Script]
class boss_drakkari_colossus : CreatureScript class boss_drakkari_colossus : BossAI
{ {
public boss_drakkari_colossus() : base("boss_drakkari_colossus") { } public boss_drakkari_colossus(Creature creature) : base(creature, GDDataTypes.DrakkariColossus)
class boss_drakkari_colossusAI : BossAI
{ {
public boss_drakkari_colossusAI(Creature creature) : base(creature, GDDataTypes.DrakkariColossus) Initialize();
me.SetReactState(ReactStates.Passive);
introDone = false;
}
void Initialize()
{
phase = Misc.ColossusPhaseNormal;
}
public override void Reset()
{
_Reset();
if (GetData(Misc.DataIntroDone) != 0)
{ {
Initialize(); me.SetReactState(ReactStates.Aggressive);
me.SetReactState(ReactStates.Passive); me.RemoveFlag(UnitFields.Flags, UnitFlags.ImmuneToPc);
introDone = false;
}
void Initialize()
{
phase = Misc.ColossusPhaseNormal;
}
public override void Reset()
{
_Reset();
if (GetData(Misc.DataIntroDone) != 0)
{
me.SetReactState(ReactStates.Aggressive);
me.RemoveFlag(UnitFields.Flags, UnitFlags.ImmuneToPc);
me.RemoveAura(SpellIds.FreezeAnim);
}
_scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting));
_scheduler.Schedule(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(30), task =>
{
DoCastVictim(SpellIds.MightyBlow);
task.Repeat(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(15));
});
Initialize();
}
public override void EnterCombat(Unit who)
{
_EnterCombat();
me.RemoveAura(SpellIds.FreezeAnim); me.RemoveAura(SpellIds.FreezeAnim);
} }
public override void JustDied(Unit killer) _scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting));
_scheduler.Schedule(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(30), task =>
{ {
_JustDied(); DoCastVictim(SpellIds.MightyBlow);
task.Repeat(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(15));
});
Initialize();
}
public override void EnterCombat(Unit who)
{
_EnterCombat();
me.RemoveAura(SpellIds.FreezeAnim);
}
public override void JustDied(Unit killer)
{
_JustDied();
}
public override void DoAction(int action)
{
switch (action)
{
case Misc.ActionSummonElemental:
DoCast(SpellIds.Emerge);
break;
case Misc.ActionFreezeColossus:
me.GetMotionMaster().Clear();
me.GetMotionMaster().MoveIdle();
me.SetReactState(ReactStates.Passive);
me.SetFlag(UnitFields.Flags, UnitFlags.ImmuneToPc);
DoCast(me, SpellIds.FreezeAnim);
break;
case Misc.ActionUnfreezeColossus:
if (me.GetReactState() == ReactStates.Aggressive)
return;
me.SetReactState(ReactStates.Aggressive);
me.RemoveFlag(UnitFields.Flags, UnitFlags.ImmuneToPc);
me.RemoveAura(SpellIds.FreezeAnim);
me.SetInCombatWithZone();
if (me.GetVictim())
me.GetMotionMaster().MoveChase(me.GetVictim(), 0, 0);
break;
} }
}
public override void DoAction(int action) public override void DamageTaken(Unit attacker, ref uint damage)
{
if (me.HasFlag(UnitFields.Flags, UnitFlags.ImmuneToPc))
damage = 0;
if (phase == Misc.ColossusPhaseNormal ||
phase == Misc.ColossusPhaseFirstElementalSummon)
{ {
switch (action) if (HealthBelowPct(phase == Misc.ColossusPhaseNormal ? 50 : 5))
{ {
case Misc.ActionSummonElemental: damage = 0;
DoCast(SpellIds.Emerge); phase = (phase == Misc.ColossusPhaseNormal ? Misc.ColossusPhaseFirstElementalSummon : Misc.ColossusPhaseSecondElementalSummon);
break; DoAction(Misc.ActionFreezeColossus);
case Misc.ActionFreezeColossus: DoAction(Misc.ActionSummonElemental);
me.GetMotionMaster().Clear();
me.GetMotionMaster().MoveIdle();
me.SetReactState(ReactStates.Passive);
me.SetFlag(UnitFields.Flags, UnitFlags.ImmuneToPc);
DoCast(me, SpellIds.FreezeAnim);
break;
case Misc.ActionUnfreezeColossus:
if (me.GetReactState() == ReactStates.Aggressive)
return;
me.SetReactState(ReactStates.Aggressive);
me.RemoveFlag(UnitFields.Flags, UnitFlags.ImmuneToPc);
me.RemoveAura(SpellIds.FreezeAnim);
me.SetInCombatWithZone();
if (me.GetVictim())
me.GetMotionMaster().MoveChase(me.GetVictim(), 0, 0);
break;
} }
} }
}
public override void DamageTaken(Unit attacker, ref uint damage) public override uint GetData(uint data)
{
if (data == Misc.DataColossusPhase)
return phase;
else if (data == Misc.DataIntroDone)
return introDone ? 1 : 0u;
return 0;
}
public override void SetData(uint type, uint data)
{
if (type == Misc.DataIntroDone)
introDone = data != 0;
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
if (me.GetReactState() == ReactStates.Aggressive)
DoMeleeAttackIfReady();
}
public override void JustSummoned(Creature summon)
{
summon.SetInCombatWithZone();
if (phase == Misc.ColossusPhaseSecondElementalSummon)
summon.SetHealth(summon.GetMaxHealth() / 2);
}
byte phase;
bool introDone;
}
[Script]
class boss_drakkari_elemental : ScriptedAI
{
public boss_drakkari_elemental(Creature creature) : base(creature)
{
DoCast(me, SpellIds.ElementalSpawnEffect);
instance = creature.GetInstanceScript();
}
public override void Reset()
{
_scheduler.CancelAll();
_scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting));
_scheduler.Schedule(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(15), task =>
{ {
if (me.HasFlag(UnitFields.Flags, UnitFlags.ImmuneToPc)) DoCast(SpellIds.SurgeVisual);
damage = 0; Unit target = SelectTarget(SelectAggroTarget.Random, 1, 0.0f, true);
if (target)
DoCast(target, SpellIds.Surge);
task.Repeat(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(15));
});
if (phase == Misc.ColossusPhaseNormal || me.AddAura(SpellIds.MojoVolley, me);
phase == Misc.ColossusPhaseFirstElementalSummon) }
public override void JustDied(Unit killer)
{
Talk(TextIds.EmoteActivateAltar);
Creature colossus = instance.GetCreature(GDDataTypes.DrakkariColossus);
if (colossus)
killer.Kill(colossus);
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
DoMeleeAttackIfReady();
}
public override void DoAction(int action)
{
switch (action)
{
case Misc.ActionReturnToColossus:
Talk(TextIds.EmoteMojo);
DoCast(SpellIds.SurgeVisual);
Creature colossus = instance.GetCreature(GDDataTypes.DrakkariColossus);
if (colossus)
// what if the elemental is more than 80 yards from drakkari colossus ?
DoCast(colossus, SpellIds.Merge, true);
break;
}
}
public override void DamageTaken(Unit attacker, ref uint damage)
{
if (HealthBelowPct(50))
{
Creature colossus = instance.GetCreature(GDDataTypes.DrakkariColossus);
if (colossus)
{ {
if (HealthBelowPct(phase == Misc.ColossusPhaseNormal ? 50 : 5)) if (colossus.GetAI().GetData(Misc.DataColossusPhase) == Misc.ColossusPhaseFirstElementalSummon)
{ {
damage = 0; damage = 0;
phase = (phase == Misc.ColossusPhaseNormal ? Misc.ColossusPhaseFirstElementalSummon : Misc.ColossusPhaseSecondElementalSummon);
DoAction(Misc.ActionFreezeColossus);
DoAction(Misc.ActionSummonElemental);
}
}
}
public override uint GetData(uint data) // to prevent spell spaming
{ if (me.HasUnitState(UnitState.Charging))
if (data == Misc.DataColossusPhase) return;
return phase;
else if (data == Misc.DataIntroDone)
return introDone ? 1 : 0u;
return 0; // not sure about this, the idea of this code is to prevent bug the elemental
} // if it is not in a acceptable distance to cast the charge spell.
if (me.GetDistance(colossus) > 80.0f)
public override void SetData(uint type, uint data)
{
if (type == Misc.DataIntroDone)
introDone = data != 0;
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
if (me.GetReactState() == ReactStates.Aggressive)
DoMeleeAttackIfReady();
}
public override void JustSummoned(Creature summon)
{
summon.SetInCombatWithZone();
if (phase == Misc.ColossusPhaseSecondElementalSummon)
summon.SetHealth(summon.GetMaxHealth() / 2);
}
byte phase;
bool introDone;
}
public override CreatureAI GetAI(Creature creature)
{
return GetInstanceAI<boss_drakkari_colossusAI>(creature);
}
}
[Script]
class boss_drakkari_elemental : CreatureScript
{
public boss_drakkari_elemental() : base("boss_drakkari_elemental") { }
class boss_drakkari_elementalAI : ScriptedAI
{
public boss_drakkari_elementalAI(Creature creature) : base(creature)
{
DoCast(me, SpellIds.ElementalSpawnEffect);
instance = creature.GetInstanceScript();
}
public override void Reset()
{
_scheduler.CancelAll();
_scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting));
_scheduler.Schedule(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(15), task =>
{
DoCast(SpellIds.SurgeVisual);
Unit target = SelectTarget(SelectAggroTarget.Random, 1, 0.0f, true);
if (target)
DoCast(target, SpellIds.Surge);
task.Repeat(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(15));
});
me.AddAura(SpellIds.MojoVolley, me);
}
public override void JustDied(Unit killer)
{
Talk(TextIds.EmoteActivateAltar);
Creature colossus = instance.GetCreature(GDDataTypes.DrakkariColossus);
if (colossus)
killer.Kill(colossus);
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
DoMeleeAttackIfReady();
}
public override void DoAction(int action)
{
switch (action)
{
case Misc.ActionReturnToColossus:
Talk(TextIds.EmoteMojo);
DoCast(SpellIds.SurgeVisual);
Creature colossus = instance.GetCreature(GDDataTypes.DrakkariColossus);
if (colossus)
// what if the elemental is more than 80 yards from drakkari colossus ?
DoCast(colossus, SpellIds.Merge, true);
break;
}
}
public override void DamageTaken(Unit attacker, ref uint damage)
{
if (HealthBelowPct(50))
{
Creature colossus = instance.GetCreature(GDDataTypes.DrakkariColossus);
if (colossus)
{
if (colossus.GetAI().GetData(Misc.DataColossusPhase) == Misc.ColossusPhaseFirstElementalSummon)
{ {
damage = 0; if (me.GetMotionMaster().GetCurrentMovementGeneratorType() == MovementGeneratorType.Point)
// to prevent spell spaming
if (me.HasUnitState(UnitState.Charging))
return; return;
// not sure about this, the idea of this code is to prevent bug the elemental me.GetMotionMaster().MovePoint(0, colossus.GetPositionX(), colossus.GetPositionY(), colossus.GetPositionZ());
// if it is not in a acceptable distance to cast the charge spell. return;
if (me.GetDistance(colossus) > 80.0f)
{
if (me.GetMotionMaster().GetCurrentMovementGeneratorType() == MovementGeneratorType.Point)
return;
me.GetMotionMaster().MovePoint(0, colossus.GetPositionX(), colossus.GetPositionY(), colossus.GetPositionZ());
return;
}
DoAction(Misc.ActionReturnToColossus);
} }
DoAction(Misc.ActionReturnToColossus);
} }
} }
} }
public override void EnterEvadeMode(EvadeReason why)
{
me.DespawnOrUnsummon();
}
public override void SpellHitTarget(Unit target, SpellInfo spell)
{
if (spell.Id == SpellIds.Merge)
{
Creature colossus = target.ToCreature();
if (colossus)
{
colossus.GetAI().DoAction(Misc.ActionUnfreezeColossus);
me.DespawnOrUnsummon();
}
}
}
InstanceScript instance;
} }
public override CreatureAI GetAI(Creature creature) public override void EnterEvadeMode(EvadeReason why)
{ {
return GetInstanceAI<boss_drakkari_elementalAI>(creature); me.DespawnOrUnsummon();
} }
public override void SpellHitTarget(Unit target, SpellInfo spell)
{
if (spell.Id == SpellIds.Merge)
{
Creature colossus = target.ToCreature();
if (colossus)
{
colossus.GetAI().DoAction(Misc.ActionUnfreezeColossus);
me.DespawnOrUnsummon();
}
}
}
InstanceScript instance;
} }
[Script] [Script]
class npc_living_mojo : CreatureScript class npc_living_mojo : ScriptedAI
{ {
public npc_living_mojo() : base("npc_living_mojo") { } public npc_living_mojo(Creature creature) : base(creature)
class npc_living_mojoAI : ScriptedAI
{ {
public npc_living_mojoAI(Creature creature) : base(creature) instance = creature.GetInstanceScript();
{ }
instance = creature.GetInstanceScript();
}
public override void Reset() public override void Reset()
{
_scheduler.Schedule(TimeSpan.FromSeconds(2), task =>
{ {
_scheduler.Schedule(TimeSpan.FromSeconds(2), task => DoCastVictim(SpellIds.MojoWave);
{ task.Repeat(TimeSpan.FromSeconds(15));
DoCastVictim(SpellIds.MojoWave); });
task.Repeat(TimeSpan.FromSeconds(15));
});
_scheduler.Schedule(TimeSpan.FromSeconds(7), task => _scheduler.Schedule(TimeSpan.FromSeconds(7), task =>
{
DoCastVictim(SpellIds.MojoPuddle);
task.Repeat(TimeSpan.FromSeconds(18));
});
}
void MoveMojos(Creature boss)
{ {
List<Creature> mojosList = new List<Creature>(); DoCastVictim(SpellIds.MojoPuddle);
boss.GetCreatureListWithEntryInGrid(mojosList, me.GetEntry(), 12.0f); task.Repeat(TimeSpan.FromSeconds(18));
if (!mojosList.Empty()) });
}
void MoveMojos(Creature boss)
{
List<Creature> mojosList = new List<Creature>();
boss.GetCreatureListWithEntryInGrid(mojosList, me.GetEntry(), 12.0f);
if (!mojosList.Empty())
{
foreach (var mojo in mojosList)
{ {
foreach (var mojo in mojosList) if (mojo)
{ mojo.GetMotionMaster().MovePoint(1, boss.GetHomePosition());
if (mojo)
mojo.GetMotionMaster().MovePoint(1, boss.GetHomePosition());
}
} }
} }
}
public override void MovementInform(MovementGeneratorType type, uint id) public override void MovementInform(MovementGeneratorType type, uint id)
{
if (type != MovementGeneratorType.Point)
return;
if (id == 1)
{ {
if (type != MovementGeneratorType.Point)
return;
if (id == 1)
{
Creature colossus = instance.GetCreature(GDDataTypes.DrakkariColossus);
if (colossus)
{
colossus.GetAI().DoAction(Misc.ActionUnfreezeColossus);
if (colossus.GetAI().GetData(Misc.DataIntroDone) == 0)
colossus.GetAI().SetData(Misc.DataIntroDone, 1);
colossus.SetInCombatWithZone();
me.DespawnOrUnsummon();
}
}
}
public override void AttackStart(Unit attacker)
{
if (me.GetMotionMaster().GetCurrentMovementGeneratorType() == MovementGeneratorType.Point)
return;
// we do this checks to see if the creature is one of the creatures that sorround the boss
Creature colossus = instance.GetCreature(GDDataTypes.DrakkariColossus); Creature colossus = instance.GetCreature(GDDataTypes.DrakkariColossus);
if (colossus) if (colossus)
{ {
Position homePosition = me.GetHomePosition(); colossus.GetAI().DoAction(Misc.ActionUnfreezeColossus);
if (colossus.GetAI().GetData(Misc.DataIntroDone) == 0)
float distance = homePosition.GetExactDist(colossus.GetHomePosition()); colossus.GetAI().SetData(Misc.DataIntroDone, 1);
colossus.SetInCombatWithZone();
if (distance < 12.0f) me.DespawnOrUnsummon();
{
MoveMojos(colossus);
me.SetReactState(ReactStates.Passive);
}
else
base.AttackStart(attacker);
} }
} }
public override void UpdateAI(uint diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
_scheduler.Update(diff);
DoMeleeAttackIfReady();
}
InstanceScript instance;
} }
public override CreatureAI GetAI(Creature creature) public override void AttackStart(Unit attacker)
{ {
return GetInstanceAI<npc_living_mojoAI>(creature); if (me.GetMotionMaster().GetCurrentMovementGeneratorType() == MovementGeneratorType.Point)
return;
// we do this checks to see if the creature is one of the creatures that sorround the boss
Creature colossus = instance.GetCreature(GDDataTypes.DrakkariColossus);
if (colossus)
{
Position homePosition = me.GetHomePosition();
float distance = homePosition.GetExactDist(colossus.GetHomePosition());
if (distance < 12.0f)
{
MoveMojos(colossus);
me.SetReactState(ReactStates.Passive);
}
else
base.AttackStart(attacker);
}
} }
public override void UpdateAI(uint diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
_scheduler.Update(diff);
DoMeleeAttackIfReady();
}
InstanceScript instance;
} }
} }
+70 -80
View File
@@ -38,91 +38,81 @@ namespace Scripts.Northrend.Gundrak.EckTheFerocious
} }
[Script] [Script]
class boss_eck : CreatureScript class boss_eck : BossAI
{ {
public boss_eck() : base("boss_eck") { } public boss_eck(Creature creature) : base(creature, GDDataTypes.EckTheFerocious)
class boss_eckAI : BossAI
{ {
public boss_eckAI(Creature creature) : base(creature, GDDataTypes.EckTheFerocious) Initialize();
{ Talk(TextIds.EmoteSpawn);
Initialize();
Talk(TextIds.EmoteSpawn);
}
void Initialize()
{
_berserk = false;
}
public override void Reset()
{
_Reset();
Initialize();
}
public override void EnterCombat(Unit who)
{
_EnterCombat();
_scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting));
_scheduler.Schedule(TimeSpan.FromSeconds(5), task =>
{
DoCastVictim(SpellIds.Bite);
task.Repeat(TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(12));
});
_scheduler.Schedule(TimeSpan.FromSeconds(10), task =>
{
DoCastVictim(SpellIds.Spit);
task.Repeat(TimeSpan.FromSeconds(6), TimeSpan.FromSeconds(14));
});
_scheduler.Schedule(TimeSpan.FromSeconds(8), task =>
{
Unit target = SelectTarget(SelectAggroTarget.Random, 1, 35.0f, true);
if (target)
DoCast(target, RandomHelper.RAND(SpellIds.Spring1, SpellIds.Spring2));
task.Repeat(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(10));
});
// 60-90 secs according to wowwiki
_scheduler.Schedule(TimeSpan.FromSeconds(60), TimeSpan.FromSeconds(90), 1, task =>
{
DoCast(me, SpellIds.Berserk);
_berserk = true;
});
}
public override void DamageTaken(Unit attacker, ref uint damage)
{
if (!_berserk && me.HealthBelowPctDamaged(20, damage))
{
_scheduler.RescheduleGroup(1, TimeSpan.FromSeconds(1));
_berserk = true;
}
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
DoMeleeAttackIfReady();
}
bool _berserk;
} }
public override CreatureAI GetAI(Creature creature) void Initialize()
{ {
return GetInstanceAI<boss_eckAI>(creature); _berserk = false;
} }
public override void Reset()
{
_Reset();
Initialize();
}
public override void EnterCombat(Unit who)
{
_EnterCombat();
_scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting));
_scheduler.Schedule(TimeSpan.FromSeconds(5), task =>
{
DoCastVictim(SpellIds.Bite);
task.Repeat(TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(12));
});
_scheduler.Schedule(TimeSpan.FromSeconds(10), task =>
{
DoCastVictim(SpellIds.Spit);
task.Repeat(TimeSpan.FromSeconds(6), TimeSpan.FromSeconds(14));
});
_scheduler.Schedule(TimeSpan.FromSeconds(8), task =>
{
Unit target = SelectTarget(SelectAggroTarget.Random, 1, 35.0f, true);
if (target)
DoCast(target, RandomHelper.RAND(SpellIds.Spring1, SpellIds.Spring2));
task.Repeat(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(10));
});
// 60-90 secs according to wowwiki
_scheduler.Schedule(TimeSpan.FromSeconds(60), TimeSpan.FromSeconds(90), 1, task =>
{
DoCast(me, SpellIds.Berserk);
_berserk = true;
});
}
public override void DamageTaken(Unit attacker, ref uint damage)
{
if (!_berserk && me.HealthBelowPctDamaged(20, damage))
{
_scheduler.RescheduleGroup(1, TimeSpan.FromSeconds(1));
_berserk = true;
}
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
DoMeleeAttackIfReady();
}
bool _berserk;
} }
} }
+1 -1
View File
@@ -322,7 +322,7 @@ namespace Scripts.Northrend.Gundrak
public override void ReadSaveDataMore(StringArguments data) public override void ReadSaveDataMore(StringArguments data)
{ {
SladRanStatueState = (GameObjectState)data.NextUInt32(); SladRanStatueState = (GameObjectState)data.NextUInt32();
DrakkariColossusStatueState = (GameObjectState)data.NextUInt32(); DrakkariColossusStatueState = (GameObjectState)data.NextUInt32();
MoorabiStatueState = (GameObjectState)data.NextUInt32(); MoorabiStatueState = (GameObjectState)data.NextUInt32();
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -38,7 +38,7 @@ namespace Scripts.Northrend.IcecrownCitadel
public const uint Sindragosa = 11; public const uint Sindragosa = 11;
public const uint TheLichKing = 12; public const uint TheLichKing = 12;
public const uint MaxEncounters = 13; public const uint MaxEncounters = 13;
} }
struct Texts struct Texts
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -13,7 +13,7 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
using Game.Entities; using Game.Entities;
+150 -170
View File
@@ -64,208 +64,188 @@ namespace Scripts.Northrend.Nexus.Nexus
} }
[Script] [Script]
class boss_anomalus : CreatureScript class boss_anomalus : ScriptedAI
{ {
public boss_anomalus() : base("boss_anomalus") { } public boss_anomalus(Creature creature) : base(creature)
class boss_anomalusAI : ScriptedAI
{ {
public boss_anomalusAI(Creature creature) : base(creature) instance = me.GetInstanceScript();
}
void Initialize()
{
_scheduler.Schedule(TimeSpan.FromSeconds(5), task =>
{ {
instance = me.GetInstanceScript(); Unit target = SelectTarget(SelectAggroTarget.Random, 0);
if (target)
DoCast(target, AnomalusConst.SpellSpark);
task.Repeat(TimeSpan.FromSeconds(5));
});
Phase = 0;
uiChaoticRiftGUID.Clear();
chaosTheory = true;
}
public override void Reset()
{
Initialize();
instance.SetBossState(DataTypes.Anomalus, EncounterState.NotStarted);
}
public override void EnterCombat(Unit who)
{
Talk(AnomalusConst.SayAggro);
instance.SetBossState(DataTypes.Anomalus, EncounterState.InProgress);
}
public override void JustDied(Unit killer)
{
Talk(AnomalusConst.SayDeath);
instance.SetBossState(DataTypes.Anomalus, EncounterState.Done);
}
public override uint GetData(uint type)
{
if (type == AnomalusConst.DataChaosTheory)
return chaosTheory ? 1 : 0u;
return 0;
}
public override void SummonedCreatureDies(Creature summoned, Unit who)
{
if (summoned.GetEntry() == AnomalusConst.NpcChaoticRift)
chaosTheory = false;
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
if (me.GetDistance(me.GetHomePosition()) > 60.0f)
{
// Not blizzlike, hack to avoid an exploit
EnterEvadeMode();
return;
} }
void Initialize() if (me.HasAura(AnomalusConst.SpellRiftShield))
{ {
_scheduler.Schedule(TimeSpan.FromSeconds(5), task => if (!uiChaoticRiftGUID.IsEmpty())
{ {
Creature Rift = ObjectAccessor.GetCreature(me, uiChaoticRiftGUID);
if (Rift && Rift.IsDead())
{
me.RemoveAurasDueToSpell(AnomalusConst.SpellRiftShield);
uiChaoticRiftGUID.Clear();
}
return;
}
}
else
uiChaoticRiftGUID.Clear();
if ((Phase == 0) && HealthBelowPct(50))
{
Phase = 1;
Talk(AnomalusConst.SayShield);
DoCast(me, AnomalusConst.SpellRiftShield);
Creature Rift = me.SummonCreature(AnomalusConst.NpcChaoticRift, AnomalusConst.RiftLocation[RandomHelper.IRand(0, 5)], TempSummonType.TimedDespawnOOC, 1000);
if (Rift)
{
//DoCast(Rift, SPELL_CHARGE_RIFT);
Unit target = SelectTarget(SelectAggroTarget.Random, 0); Unit target = SelectTarget(SelectAggroTarget.Random, 0);
if (target) if (target)
DoCast(target, AnomalusConst.SpellSpark); Rift.GetAI().AttackStart(target);
uiChaoticRiftGUID = Rift.GetGUID();
task.Repeat(TimeSpan.FromSeconds(5)); Talk(AnomalusConst.SayRift);
});
Phase = 0;
uiChaoticRiftGUID.Clear();
chaosTheory = true;
}
public override void Reset()
{
Initialize();
instance.SetBossState(DataTypes.Anomalus, EncounterState.NotStarted);
}
public override void EnterCombat(Unit who)
{
Talk(AnomalusConst.SayAggro);
instance.SetBossState(DataTypes.Anomalus, EncounterState.InProgress);
}
public override void JustDied(Unit killer)
{
Talk(AnomalusConst.SayDeath);
instance.SetBossState(DataTypes.Anomalus, EncounterState.Done);
}
public override uint GetData(uint type)
{
if (type == AnomalusConst.DataChaosTheory)
return chaosTheory ? 1 : 0u;
return 0;
}
public override void SummonedCreatureDies(Creature summoned, Unit who)
{
if (summoned.GetEntry() == AnomalusConst.NpcChaoticRift)
chaosTheory = false;
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
if (me.GetDistance(me.GetHomePosition()) > 60.0f)
{
// Not blizzlike, hack to avoid an exploit
EnterEvadeMode();
return;
} }
if (me.HasAura(AnomalusConst.SpellRiftShield))
{
if (!uiChaoticRiftGUID.IsEmpty())
{
Creature Rift = ObjectAccessor.GetCreature(me, uiChaoticRiftGUID);
if (Rift && Rift.IsDead())
{
me.RemoveAurasDueToSpell(AnomalusConst.SpellRiftShield);
uiChaoticRiftGUID.Clear();
}
return;
}
}
else
uiChaoticRiftGUID.Clear();
if ((Phase == 0) && HealthBelowPct(50))
{
Phase = 1;
Talk(AnomalusConst.SayShield);
DoCast(me, AnomalusConst.SpellRiftShield);
Creature Rift = me.SummonCreature(AnomalusConst.NpcChaoticRift, AnomalusConst.RiftLocation[RandomHelper.IRand(0, 5)], TempSummonType.TimedDespawnOOC, 1000);
if (Rift)
{
//DoCast(Rift, SPELL_CHARGE_RIFT);
Unit target = SelectTarget(SelectAggroTarget.Random, 0);
if (target)
Rift.GetAI().AttackStart(target);
uiChaoticRiftGUID = Rift.GetGUID();
Talk(AnomalusConst.SayRift);
}
}
_scheduler.Update(diff);
DoMeleeAttackIfReady();
} }
InstanceScript instance; _scheduler.Update(diff);
byte Phase; DoMeleeAttackIfReady();
ObjectGuid uiChaoticRiftGUID;
bool chaosTheory;
} }
public override CreatureAI GetAI(Creature creature) InstanceScript instance;
{
return GetInstanceAI<boss_anomalusAI>(creature); byte Phase;
} ObjectGuid uiChaoticRiftGUID;
bool chaosTheory;
} }
[Script] [Script]
class npc_chaotic_rift : CreatureScript class npc_chaotic_rift : ScriptedAI
{ {
public npc_chaotic_rift() : base("npc_chaotic_rift") { } public npc_chaotic_rift(Creature creature) : base(creature)
class npc_chaotic_riftAI : ScriptedAI
{ {
public npc_chaotic_riftAI(Creature creature) : base(creature) Initialize();
{ instance = me.GetInstanceScript();
Initialize(); SetCombatMovement(false);
instance = me.GetInstanceScript(); }
SetCombatMovement(false);
}
void Initialize() void Initialize()
{ {
uiChaoticEnergyBurstTimer = 1000; uiChaoticEnergyBurstTimer = 1000;
uiSummonCrazedManaWraithTimer = 5000; uiSummonCrazedManaWraithTimer = 5000;
} }
public override void Reset() public override void Reset()
{ {
Initialize(); Initialize();
me.SetDisplayId(me.GetCreatureTemplate().ModelId2); me.SetDisplayId(me.GetCreatureTemplate().ModelId2);
DoCast(me, AnomalusConst.SpellArcaneform, false); DoCast(me, AnomalusConst.SpellArcaneform, false);
} }
public override void UpdateAI(uint diff) public override void UpdateAI(uint diff)
{ {
if (!UpdateVictim()) if (!UpdateVictim())
return; return;
if (uiChaoticEnergyBurstTimer <= diff) if (uiChaoticEnergyBurstTimer <= diff)
{
Creature Anomalus = ObjectAccessor.GetCreature(me, instance.GetGuidData(DataTypes.Anomalus));
Unit target = SelectTarget(SelectAggroTarget.Random, 0);
if (target)
{
if (Anomalus && Anomalus.HasAura(AnomalusConst.SpellRiftShield))
DoCast(target, AnomalusConst.SpellChargedChaoticEnergyBurst);
else
DoCast(target, AnomalusConst.SpellChaoticEnergyBurst);
}
uiChaoticEnergyBurstTimer = 1000;
}
else
uiChaoticEnergyBurstTimer -= diff;
if (uiSummonCrazedManaWraithTimer <= diff)
{
Creature Wraith = me.SummonCreature(AnomalusConst.NpcCrazedManaWraith, me.GetPositionX() + 1, me.GetPositionY() + 1, me.GetPositionZ(), 0, TempSummonType.TimedDespawnOOC, 1000);
if (Wraith)
{ {
Creature Anomalus = ObjectAccessor.GetCreature(me, instance.GetGuidData(DataTypes.Anomalus));
Unit target = SelectTarget(SelectAggroTarget.Random, 0); Unit target = SelectTarget(SelectAggroTarget.Random, 0);
if (target) if (target)
{ Wraith.GetAI().AttackStart(target);
if (Anomalus && Anomalus.HasAura(AnomalusConst.SpellRiftShield))
DoCast(target, AnomalusConst.SpellChargedChaoticEnergyBurst);
else
DoCast(target, AnomalusConst.SpellChaoticEnergyBurst);
}
uiChaoticEnergyBurstTimer = 1000;
} }
Creature Anomalus = ObjectAccessor.GetCreature(me, instance.GetGuidData(DataTypes.Anomalus));
if (Anomalus && Anomalus.HasAura(AnomalusConst.SpellRiftShield))
uiSummonCrazedManaWraithTimer = 5000;
else else
uiChaoticEnergyBurstTimer -= diff; uiSummonCrazedManaWraithTimer = 10000;
if (uiSummonCrazedManaWraithTimer <= diff)
{
Creature Wraith = me.SummonCreature(AnomalusConst.NpcCrazedManaWraith, me.GetPositionX() + 1, me.GetPositionY() + 1, me.GetPositionZ(), 0, TempSummonType.TimedDespawnOOC, 1000);
if (Wraith)
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0);
if (target)
Wraith.GetAI().AttackStart(target);
}
Creature Anomalus = ObjectAccessor.GetCreature(me, instance.GetGuidData(DataTypes.Anomalus));
if (Anomalus && Anomalus.HasAura(AnomalusConst.SpellRiftShield))
uiSummonCrazedManaWraithTimer = 5000;
else
uiSummonCrazedManaWraithTimer = 10000;
}
else
uiSummonCrazedManaWraithTimer -= diff;
} }
else
InstanceScript instance; uiSummonCrazedManaWraithTimer -= diff;
uint uiChaoticEnergyBurstTimer;
uint uiSummonCrazedManaWraithTimer;
} }
public override CreatureAI GetAI(Creature creature) InstanceScript instance;
{
return GetInstanceAI<npc_chaotic_riftAI>(creature); uint uiChaoticEnergyBurstTimer;
} uint uiSummonCrazedManaWraithTimer;
} }
[Script] [Script]
+134 -154
View File
@@ -52,151 +52,141 @@ namespace Scripts.Northrend.Nexus.Nexus
} }
[Script] [Script]
class boss_keristrasza : CreatureScript public class boss_keristrasza : BossAI
{ {
public boss_keristrasza() : base("boss_keristrasza") { } public boss_keristrasza(Creature creature) : base(creature, DataTypes.Keristrasza)
public class boss_keristraszaAI : BossAI
{ {
public boss_keristraszaAI(Creature creature) : base(creature, DataTypes.Keristrasza) Initialize();
}
void Initialize()
{
_enrage = false;
//Crystal FireBreath
_scheduler.Schedule(TimeSpan.FromSeconds(14), task =>
{ {
Initialize(); DoCastVictim(KeristraszaConst.SpellCrystalFireBreath);
} task.Repeat(TimeSpan.FromSeconds(14));
});
void Initialize() //CrystalChainsCrystalize
_scheduler.Schedule(TimeSpan.FromSeconds(DungeonMode<uint>(30, 11)), task =>
{ {
_enrage = false; Talk(KeristraszaConst.SayCrystalNova);
if (IsHeroic())
//Crystal FireBreath DoCast(me, KeristraszaConst.SpellCrystalize);
_scheduler.Schedule(TimeSpan.FromSeconds(14), task =>
{
DoCastVictim(KeristraszaConst.SpellCrystalFireBreath);
task.Repeat(TimeSpan.FromSeconds(14));
});
//CrystalChainsCrystalize
_scheduler.Schedule(TimeSpan.FromSeconds(DungeonMode<uint>(30, 11)), task =>
{
Talk(KeristraszaConst.SayCrystalNova);
if (IsHeroic())
DoCast(me, KeristraszaConst.SpellCrystalize);
else
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100.0f, true);
if (target)
DoCast(target, KeristraszaConst.SpellCrystalChains);
}
task.Repeat(TimeSpan.FromSeconds(DungeonMode<uint>(30, 11)));
});
//TailSweep
_scheduler.Schedule(TimeSpan.FromSeconds(5), task =>
{
DoCast(me, KeristraszaConst.SpellTailSweep);
task.Repeat(TimeSpan.FromSeconds(5));
});
}
public override void Reset()
{
Initialize();
_intenseColdList.Clear();
me.RemoveFlag(UnitFields.Flags, UnitFlags.Stunned);
RemovePrison(CheckContainmentSpheres());
_Reset();
}
public override void EnterCombat(Unit who)
{
Talk(KeristraszaConst.SayAggro);
DoCastAOE(KeristraszaConst.SpellIntenseCold);
_EnterCombat();
}
public override void JustDied(Unit killer)
{
Talk(KeristraszaConst.SayDeath);
_JustDied();
}
public override void KilledUnit(Unit who)
{
if (who.IsTypeId(TypeId.Player))
Talk(KeristraszaConst.SaySlay);
}
public bool CheckContainmentSpheres(bool removePrison = false)
{
for (uint i = DataTypes.AnomalusContainmetSphere; i < (DataTypes.AnomalusContainmetSphere + KeristraszaConst.DataContainmentSpheres); ++i)
{
GameObject containmentSpheres = ObjectAccessor.GetGameObject(me, instance.GetGuidData(i));
if (!containmentSpheres || containmentSpheres.GetGoState() != GameObjectState.Active)
return false;
}
if (removePrison)
RemovePrison(true);
return true;
}
void RemovePrison(bool remove)
{
if (remove)
{
me.RemoveFlag(UnitFields.Flags, UnitFlags.ImmuneToPc);
me.RemoveFlag(UnitFields.Flags, UnitFlags.NonAttackable);
if (me.HasAura(KeristraszaConst.SpellFrozenPrison))
me.RemoveAurasDueToSpell(KeristraszaConst.SpellFrozenPrison);
}
else else
{ {
me.SetFlag(UnitFields.Flags, UnitFlags.ImmuneToPc); Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100.0f, true);
me.SetFlag(UnitFields.Flags, UnitFlags.NonAttackable); if (target)
DoCast(me, KeristraszaConst.SpellFrozenPrison, false); DoCast(target, KeristraszaConst.SpellCrystalChains);
} }
}
public override void SetGUID(ObjectGuid guid, int id = 0) task.Repeat(TimeSpan.FromSeconds(DungeonMode<uint>(30, 11)));
});
//TailSweep
_scheduler.Schedule(TimeSpan.FromSeconds(5), task =>
{ {
if (id == KeristraszaConst.DataIntenseCold) DoCast(me, KeristraszaConst.SpellTailSweep);
_intenseColdList.Add(guid); task.Repeat(TimeSpan.FromSeconds(5));
} });
public override void DamageTaken(Unit attacker, ref uint damage)
{
if (!_enrage && me.HealthBelowPctDamaged(25, damage))
{
Talk(KeristraszaConst.SayEnrage);
Talk(KeristraszaConst.SayFrenzy);
DoCast(me, KeristraszaConst.SpellEnrage);
_enrage = true;
}
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
DoMeleeAttackIfReady();
}
bool _enrage;
public List<ObjectGuid> _intenseColdList = new List<ObjectGuid>();
} }
public override CreatureAI GetAI(Creature creature) public override void Reset()
{ {
return GetInstanceAI<boss_keristraszaAI>(creature); Initialize();
_intenseColdList.Clear();
me.RemoveFlag(UnitFields.Flags, UnitFlags.Stunned);
RemovePrison(CheckContainmentSpheres());
_Reset();
} }
public override void EnterCombat(Unit who)
{
Talk(KeristraszaConst.SayAggro);
DoCastAOE(KeristraszaConst.SpellIntenseCold);
_EnterCombat();
}
public override void JustDied(Unit killer)
{
Talk(KeristraszaConst.SayDeath);
_JustDied();
}
public override void KilledUnit(Unit who)
{
if (who.IsTypeId(TypeId.Player))
Talk(KeristraszaConst.SaySlay);
}
public bool CheckContainmentSpheres(bool removePrison = false)
{
for (uint i = DataTypes.AnomalusContainmetSphere; i < (DataTypes.AnomalusContainmetSphere + KeristraszaConst.DataContainmentSpheres); ++i)
{
GameObject containmentSpheres = ObjectAccessor.GetGameObject(me, instance.GetGuidData(i));
if (!containmentSpheres || containmentSpheres.GetGoState() != GameObjectState.Active)
return false;
}
if (removePrison)
RemovePrison(true);
return true;
}
void RemovePrison(bool remove)
{
if (remove)
{
me.RemoveFlag(UnitFields.Flags, UnitFlags.ImmuneToPc);
me.RemoveFlag(UnitFields.Flags, UnitFlags.NonAttackable);
if (me.HasAura(KeristraszaConst.SpellFrozenPrison))
me.RemoveAurasDueToSpell(KeristraszaConst.SpellFrozenPrison);
}
else
{
me.SetFlag(UnitFields.Flags, UnitFlags.ImmuneToPc);
me.SetFlag(UnitFields.Flags, UnitFlags.NonAttackable);
DoCast(me, KeristraszaConst.SpellFrozenPrison, false);
}
}
public override void SetGUID(ObjectGuid guid, int id = 0)
{
if (id == KeristraszaConst.DataIntenseCold)
_intenseColdList.Add(guid);
}
public override void DamageTaken(Unit attacker, ref uint damage)
{
if (!_enrage && me.HealthBelowPctDamaged(25, damage))
{
Talk(KeristraszaConst.SayEnrage);
Talk(KeristraszaConst.SayFrenzy);
DoCast(me, KeristraszaConst.SpellEnrage);
_enrage = true;
}
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
DoMeleeAttackIfReady();
}
bool _enrage;
public List<ObjectGuid> _intenseColdList = new List<ObjectGuid>();
} }
[Script] [Script]
@@ -215,7 +205,7 @@ namespace Scripts.Northrend.Nexus.Nexus
go.SetFlag(GameObjectFields.Flags, GameObjectFlags.NotSelectable); go.SetFlag(GameObjectFields.Flags, GameObjectFlags.NotSelectable);
go.SetGoState(GameObjectState.Active); go.SetGoState(GameObjectState.Active);
((boss_keristrasza.boss_keristraszaAI)pKeristrasza.GetAI()).CheckContainmentSpheres(true); ((boss_keristrasza)pKeristrasza.GetAI()).CheckContainmentSpheres(true);
} }
return true; return true;
} }
@@ -223,33 +213,23 @@ namespace Scripts.Northrend.Nexus.Nexus
} }
[Script] [Script]
class spell_intense_cold : SpellScriptLoader class spell_intense_cold : AuraScript
{ {
public spell_intense_cold() : base("spell_intense_cold") { } void HandlePeriodicTick(AuraEffect aurEff)
class spell_intense_cold_AuraScript : AuraScript
{ {
void HandlePeriodicTick(AuraEffect aurEff) if (aurEff.GetBase().GetStackAmount() < 2)
{ return;
if (aurEff.GetBase().GetStackAmount() < 2) Unit caster = GetCaster();
return; /// @todo the caster should be boss but not the player
Unit caster = GetCaster(); if (!caster || caster.GetAI() == null)
/// @todo the caster should be boss but not the player return;
if (!caster || caster.GetAI() == null)
return;
caster.GetAI().SetGUID(GetTarget().GetGUID(), (int)KeristraszaConst.DataIntenseCold); caster.GetAI().SetGUID(GetTarget().GetGUID(), (int)KeristraszaConst.DataIntenseCold);
}
public override void Register()
{
OnEffectPeriodic.Add(new EffectPeriodicHandler(HandlePeriodicTick, 1, AuraType.PeriodicDamage));
}
} }
public override AuraScript GetAuraScript() public override void Register()
{ {
return new spell_intense_cold_AuraScript(); OnEffectPeriodic.Add(new EffectPeriodicHandler(HandlePeriodicTick, 1, AuraType.PeriodicDamage));
} }
} }
@@ -263,7 +243,7 @@ namespace Scripts.Northrend.Nexus.Nexus
if (!target) if (!target)
return false; return false;
var _intenseColdList = ((boss_keristrasza.boss_keristraszaAI)target.ToCreature().GetAI())._intenseColdList; var _intenseColdList = ((boss_keristrasza)target.ToCreature().GetAI())._intenseColdList;
if (!_intenseColdList.Empty()) if (!_intenseColdList.Empty())
{ {
foreach (var guid in _intenseColdList) foreach (var guid in _intenseColdList)
+219 -239
View File
@@ -55,252 +55,242 @@ namespace Scripts.Northrend.Nexus.Nexus
} }
[Script] [Script]
class boss_magus_telestra : CreatureScript class boss_magus_telestra : ScriptedAI
{ {
public boss_magus_telestra() : base("boss_magus_telestra") { } public boss_magus_telestra(Creature creature) : base(creature)
class boss_magus_telestraAI : ScriptedAI
{ {
public boss_magus_telestraAI(Creature creature) : base(creature) instance = creature.GetInstanceScript();
bFireMagusDead = false;
bFrostMagusDead = false;
bArcaneMagusDead = false;
uiIsWaitingToAppearTimer = 0;
}
void Initialize()
{
Phase = 0;
uiIceNovaTimer = 7 * Time.InMilliseconds;
uiFireBombTimer = 0;
uiGravityWellTimer = 15 * Time.InMilliseconds;
uiCooldown = 0;
for (byte n = 0; n < 3; ++n)
time[n] = 0;
splitPersonality = 0;
bIsWaitingToAppear = false;
}
public override void Reset()
{
Initialize();
me.RemoveFlag(UnitFields.Flags, UnitFlags.NotSelectable);
instance.SetBossState(DataTypes.MagusTelestra, EncounterState.NotStarted);
if (IsHeroic() && Global.GameEventMgr.IsActiveEvent(MagusTelestraConst.GameEventWinterVeil) && !me.HasAura(MagusTelestraConst.SpellWearChristmasHat))
me.AddAura(MagusTelestraConst.SpellWearChristmasHat, me);
}
public override void EnterCombat(Unit who)
{
Talk(MagusTelestraConst.SayAggro);
instance.SetBossState(DataTypes.MagusTelestra, EncounterState.InProgress);
}
public override void JustDied(Unit killer)
{
Talk(MagusTelestraConst.SayDeath);
instance.SetBossState(DataTypes.MagusTelestra, EncounterState.Done);
}
public override void KilledUnit(Unit who)
{
if (who.IsTypeId(TypeId.Player))
Talk(MagusTelestraConst.SayKill);
}
public override uint GetData(uint type)
{
if (type == MagusTelestraConst.DataSplitPersonality)
return splitPersonality;
return 0;
}
public override void UpdateAI(uint diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
if (bIsWaitingToAppear)
{ {
instance = creature.GetInstanceScript(); me.StopMoving();
me.AttackStop();
if (uiIsWaitingToAppearTimer <= diff)
{
me.CastSpell(me, 47714, true);
me.RemoveFlag(UnitFields.Flags, UnitFlags.NotSelectable);
bIsWaitingToAppear = false;
InVanish = false;
me.SendAIReaction(AiReaction.Hostile);
}
else
uiIsWaitingToAppearTimer -= diff;
return;
}
if ((Phase == 1) || (Phase == 3))
{
if (bFireMagusDead && bFrostMagusDead && bArcaneMagusDead)
{
for (byte n = 0; n < 3; ++n)
time[n] = 0;
me.GetMotionMaster().Clear();
DoCast(me, MagusTelestraConst.SpellTelestraBack);
if (Phase == 1)
Phase = 2;
if (Phase == 3)
Phase = 4;
bIsWaitingToAppear = true;
uiIsWaitingToAppearTimer = 4 * Time.InMilliseconds;
Talk(MagusTelestraConst.SayMerge);
}
else
return;
}
if ((Phase == 0) && HealthBelowPct(50))
{
InVanish = true;
Phase = 1;
me.CastStop();
me.RemoveAllAuras();
me.CastSpell(me, 47710, false);
me.SetFlag(UnitFields.Flags, UnitFlags.NotSelectable);
bFireMagusDead = false; bFireMagusDead = false;
bFrostMagusDead = false; bFrostMagusDead = false;
bArcaneMagusDead = false; bArcaneMagusDead = false;
uiIsWaitingToAppearTimer = 0; Talk(MagusTelestraConst.SaySplit);
return;
} }
void Initialize() if (IsHeroic() && (Phase == 2) && HealthBelowPct(10))
{ {
Phase = 0; InVanish = true;
Phase = 3;
me.CastStop();
me.RemoveAllAuras();
me.SetFlag(UnitFields.Flags, UnitFlags.NotSelectable);
bFireMagusDead = false;
bFrostMagusDead = false;
bArcaneMagusDead = false;
Talk(MagusTelestraConst.SaySplit);
return;
}
uiIceNovaTimer = 7 * Time.InMilliseconds; if (uiCooldown != 0)
uiFireBombTimer = 0; {
if (uiCooldown <= diff)
uiCooldown = 0;
else
{
uiCooldown -= diff;
return;
}
}
if (uiIceNovaTimer <= diff)
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0);
if (target)
{
DoCast(target, MagusTelestraConst.SpellIceNova, false);
uiCooldown = 1500;
}
uiIceNovaTimer = 15 * Time.InMilliseconds;
}
else uiIceNovaTimer -= diff;
if (uiGravityWellTimer <= diff)
{
Unit target = me.GetVictim();
if (target)
{
DoCast(target, MagusTelestraConst.SpellGravityWell);
uiCooldown = 6 * Time.InMilliseconds;
}
uiGravityWellTimer = 15 * Time.InMilliseconds; uiGravityWellTimer = 15 * Time.InMilliseconds;
uiCooldown = 0;
for (byte n = 0; n < 3; ++n)
time[n] = 0;
splitPersonality = 0;
bIsWaitingToAppear = false;
} }
else uiGravityWellTimer -= diff;
public override void Reset() if (uiFireBombTimer <= diff)
{ {
Initialize(); Unit target = SelectTarget(SelectAggroTarget.Random, 0);
if (target)
me.RemoveFlag(UnitFields.Flags, UnitFlags.NotSelectable); {
DoCast(target, MagusTelestraConst.SpellFirebomb, false);
instance.SetBossState(DataTypes.MagusTelestra, EncounterState.NotStarted); uiCooldown = 2 * Time.InMilliseconds;
}
if (IsHeroic() && Global.GameEventMgr.IsActiveEvent(MagusTelestraConst.GameEventWinterVeil) && !me.HasAura(MagusTelestraConst.SpellWearChristmasHat)) uiFireBombTimer = 2 * Time.InMilliseconds;
me.AddAura(MagusTelestraConst.SpellWearChristmasHat, me);
} }
else uiFireBombTimer -= diff;
public override void EnterCombat(Unit who) if (!InVanish)
{ DoMeleeAttackIfReady();
Talk(MagusTelestraConst.SayAggro);
instance.SetBossState(DataTypes.MagusTelestra, EncounterState.InProgress);
}
public override void JustDied(Unit killer)
{
Talk(MagusTelestraConst.SayDeath);
instance.SetBossState(DataTypes.MagusTelestra, EncounterState.Done);
}
public override void KilledUnit(Unit who)
{
if (who.IsTypeId(TypeId.Player))
Talk(MagusTelestraConst.SayKill);
}
public override uint GetData(uint type)
{
if (type == MagusTelestraConst.DataSplitPersonality)
return splitPersonality;
return 0;
}
public override void UpdateAI(uint diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
if (bIsWaitingToAppear)
{
me.StopMoving();
me.AttackStop();
if (uiIsWaitingToAppearTimer <= diff)
{
me.CastSpell(me, 47714, true);
me.RemoveFlag(UnitFields.Flags, UnitFlags.NotSelectable);
bIsWaitingToAppear = false;
InVanish = false;
me.SendAIReaction(AiReaction.Hostile);
}
else
uiIsWaitingToAppearTimer -= diff;
return;
}
if ((Phase == 1) || (Phase == 3))
{
if (bFireMagusDead && bFrostMagusDead && bArcaneMagusDead)
{
for (byte n = 0; n < 3; ++n)
time[n] = 0;
me.GetMotionMaster().Clear();
DoCast(me, MagusTelestraConst.SpellTelestraBack);
if (Phase == 1)
Phase = 2;
if (Phase == 3)
Phase = 4;
bIsWaitingToAppear = true;
uiIsWaitingToAppearTimer = 4 * Time.InMilliseconds;
Talk(MagusTelestraConst.SayMerge);
}
else
return;
}
if ((Phase == 0) && HealthBelowPct(50))
{
InVanish = true;
Phase = 1;
me.CastStop();
me.RemoveAllAuras();
me.CastSpell(me, 47710, false);
me.SetFlag(UnitFields.Flags, UnitFlags.NotSelectable);
bFireMagusDead = false;
bFrostMagusDead = false;
bArcaneMagusDead = false;
Talk(MagusTelestraConst.SaySplit);
return;
}
if (IsHeroic() && (Phase == 2) && HealthBelowPct(10))
{
InVanish = true;
Phase = 3;
me.CastStop();
me.RemoveAllAuras();
me.SetFlag(UnitFields.Flags, UnitFlags.NotSelectable);
bFireMagusDead = false;
bFrostMagusDead = false;
bArcaneMagusDead = false;
Talk(MagusTelestraConst.SaySplit);
return;
}
if (uiCooldown != 0)
{
if (uiCooldown <= diff)
uiCooldown = 0;
else
{
uiCooldown -= diff;
return;
}
}
if (uiIceNovaTimer <= diff)
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0);
if (target)
{
DoCast(target, MagusTelestraConst.SpellIceNova, false);
uiCooldown = 1500;
}
uiIceNovaTimer = 15 * Time.InMilliseconds;
}
else uiIceNovaTimer -= diff;
if (uiGravityWellTimer <= diff)
{
Unit target = me.GetVictim();
if (target)
{
DoCast(target, MagusTelestraConst.SpellGravityWell);
uiCooldown = 6 * Time.InMilliseconds;
}
uiGravityWellTimer = 15 * Time.InMilliseconds;
}
else uiGravityWellTimer -= diff;
if (uiFireBombTimer <= diff)
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0);
if (target)
{
DoCast(target, MagusTelestraConst.SpellFirebomb, false);
uiCooldown = 2 * Time.InMilliseconds;
}
uiFireBombTimer = 2 * Time.InMilliseconds;
}
else uiFireBombTimer -= diff;
if (!InVanish)
DoMeleeAttackIfReady();
}
public override void SummonedCreatureDies(Creature summon, Unit killer)
{
if (summon.IsAlive())
return;
switch (summon.GetEntry())
{
case MagusTelestraConst.NpcFireMagus:
bFireMagusDead = true;
break;
case MagusTelestraConst.NpcFrostMagus:
bFrostMagusDead = true;
break;
case MagusTelestraConst.NpcArcaneMagus:
bArcaneMagusDead = true;
break;
}
byte i = 0;
while (time[i] != 0)
++i;
time[i] = Global.WorldMgr.GetGameTime();
if (i == 2 && (time[2] - time[1] < 5) && (time[1] - time[0] < 5))
++splitPersonality;
}
InstanceScript instance;
bool bFireMagusDead;
bool bFrostMagusDead;
bool bArcaneMagusDead;
bool bIsWaitingToAppear;
bool InVanish;
uint uiIsWaitingToAppearTimer;
uint uiIceNovaTimer;
uint uiFireBombTimer;
uint uiGravityWellTimer;
uint uiCooldown;
byte Phase;
byte splitPersonality;
long[] time = new long[3];
} }
public override CreatureAI GetAI(Creature creature) public override void SummonedCreatureDies(Creature summon, Unit killer)
{ {
return GetInstanceAI<boss_magus_telestraAI>(creature); if (summon.IsAlive())
return;
switch (summon.GetEntry())
{
case MagusTelestraConst.NpcFireMagus:
bFireMagusDead = true;
break;
case MagusTelestraConst.NpcFrostMagus:
bFrostMagusDead = true;
break;
case MagusTelestraConst.NpcArcaneMagus:
bArcaneMagusDead = true;
break;
}
byte i = 0;
while (time[i] != 0)
++i;
time[i] = Global.WorldMgr.GetGameTime();
if (i == 2 && (time[2] - time[1] < 5) && (time[1] - time[0] < 5))
++splitPersonality;
} }
InstanceScript instance;
bool bFireMagusDead;
bool bFrostMagusDead;
bool bArcaneMagusDead;
bool bIsWaitingToAppear;
bool InVanish;
uint uiIsWaitingToAppearTimer;
uint uiIceNovaTimer;
uint uiFireBombTimer;
uint uiGravityWellTimer;
uint uiCooldown;
byte Phase;
byte splitPersonality;
long[] time = new long[3];
} }
[Script] [Script]
@@ -325,25 +315,15 @@ namespace Scripts.Northrend.Nexus.Nexus
} }
[Script] [Script]
class spell_gravity_well_effect : SpellScriptLoader class spell_gravity_well_effect : SpellScript
{ {
public spell_gravity_well_effect() : base("spell_gravity_well_effect") { } void HandleDummy(uint index)
class spell_gravity_well_effect_SpellScript : SpellScript
{ {
void HandleDummy(uint index)
{
}
public override void Register()
{
}
} }
public override SpellScript GetSpellScript() public override void Register()
{ {
return new spell_gravity_well_effect_SpellScript();
} }
} }
} }
@@ -39,75 +39,65 @@ namespace Scripts.Northrend.Nexus.Nexus
} }
[Script] [Script]
class boss_nexus_commanders : CreatureScript class boss_nexus_commanders : BossAI
{ {
public boss_nexus_commanders() : base("boss_nexus_commanders") { } boss_nexus_commanders(Creature creature) : base(creature, DataTypes.Commander) { }
class boss_nexus_commandersAI : BossAI public override void EnterCombat(Unit who)
{ {
boss_nexus_commandersAI(Creature creature) : base(creature, DataTypes.Commander) { } _EnterCombat();
Talk(NexusCommandersConst.SayAggro);
me.RemoveAurasDueToSpell(NexusCommandersConst.SpellFrozenPrison);
DoCast(me, NexusCommandersConst.SpellBattleShout);
public override void EnterCombat(Unit who) //Charge
_scheduler.Schedule(TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(4), task =>
{ {
_EnterCombat(); Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100.0f, true);
Talk(NexusCommandersConst.SayAggro); if (target)
me.RemoveAurasDueToSpell(NexusCommandersConst.SpellFrozenPrison); DoCast(target, NexusCommandersConst.SpellCharge);
DoCast(me, NexusCommandersConst.SpellBattleShout);
//Charge task.Repeat(TimeSpan.FromSeconds(11), TimeSpan.FromSeconds(15));
_scheduler.Schedule(TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(4), task => });
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100.0f, true);
if (target)
DoCast(target, NexusCommandersConst.SpellCharge);
task.Repeat(TimeSpan.FromSeconds(11), TimeSpan.FromSeconds(15)); //Whirlwind
}); _scheduler.Schedule(TimeSpan.FromSeconds(6), TimeSpan.FromSeconds(8), task =>
//Whirlwind
_scheduler.Schedule(TimeSpan.FromSeconds(6), TimeSpan.FromSeconds(8), task =>
{
DoCast(me, NexusCommandersConst.SpellWhirlwind);
task.Repeat(TimeSpan.FromSeconds(19.5), TimeSpan.FromSeconds(25));
});
//Frightening Shout
_scheduler.Schedule(TimeSpan.FromSeconds(13), TimeSpan.FromSeconds(15), task =>
{
DoCastAOE(NexusCommandersConst.SpellFrighteningShout);
task.Repeat(TimeSpan.FromSeconds(45), TimeSpan.FromSeconds(55));
});
}
public override void JustDied(Unit killer)
{ {
_JustDied(); DoCast(me, NexusCommandersConst.SpellWhirlwind);
Talk(NexusCommandersConst.SayDeath); task.Repeat(TimeSpan.FromSeconds(19.5), TimeSpan.FromSeconds(25));
} });
public override void KilledUnit(Unit who) //Frightening Shout
_scheduler.Schedule(TimeSpan.FromSeconds(13), TimeSpan.FromSeconds(15), task =>
{ {
if (who.IsTypeId(TypeId.Player)) DoCastAOE(NexusCommandersConst.SpellFrighteningShout);
Talk(NexusCommandersConst.SayKill); task.Repeat(TimeSpan.FromSeconds(45), TimeSpan.FromSeconds(55));
} });
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
DoMeleeAttackIfReady();
}
} }
public override CreatureAI GetAI(Creature creature) public override void JustDied(Unit killer)
{ {
return GetInstanceAI<boss_nexus_commandersAI>(creature); _JustDied();
Talk(NexusCommandersConst.SayDeath);
}
public override void KilledUnit(Unit who)
{
if (who.IsTypeId(TypeId.Player))
Talk(NexusCommandersConst.SayKill);
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
DoMeleeAttackIfReady();
} }
} }
} }
+141 -171
View File
@@ -43,113 +43,103 @@ namespace Scripts.Northrend.Nexus.Nexus
} }
[Script] [Script]
class boss_ormorok : CreatureScript class boss_ormorok : BossAI
{ {
public boss_ormorok() : base("boss_ormorok") { } public boss_ormorok(Creature creature) : base(creature, DataTypes.Ormorok)
class boss_ormorokAI : BossAI
{ {
public boss_ormorokAI(Creature creature) : base(creature, DataTypes.Ormorok) Initialize();
{
Initialize();
}
void Initialize()
{
frenzy = false;
}
public override void Reset()
{
base.Reset();
Initialize();
}
public override void EnterCombat(Unit who)
{
_EnterCombat();
//Crystal Spikes
_scheduler.Schedule(TimeSpan.FromSeconds(12), task =>
{
Talk(OrmorokConst.SayCrystalSpikes);
DoCast(OrmorokConst.SpellCrystalSpikes);
task.Repeat(TimeSpan.FromSeconds(12));
});
//Trample
_scheduler.Schedule(TimeSpan.FromSeconds(10), task =>
{
DoCast(me, OrmorokConst.SpellTrample);
task.Repeat(TimeSpan.FromSeconds(10));
});
//Spell Reflection
_scheduler.Schedule(TimeSpan.FromSeconds(30), task =>
{
Talk(OrmorokConst.SayReflect);
DoCast(me, OrmorokConst.SpellReflection);
task.Repeat(TimeSpan.FromSeconds(30));
});
//Heroic Crystalline Tangler
if (IsHeroic())
{
_scheduler.Schedule(TimeSpan.FromSeconds(17), task =>
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0, new OrmorokTanglerPredicate(me));
if (target)
DoCast(target, OrmorokConst.SpellSummonCrystallineTangler);
task.Repeat(TimeSpan.FromSeconds(17));
});
}
Talk(OrmorokConst.SayAggro);
}
public override void DamageTaken(Unit attacker, ref uint damage)
{
if (!frenzy && HealthBelowPct(25))
{
Talk(OrmorokConst.SayFrenzy);
DoCast(me, OrmorokConst.SpellFrenzy);
frenzy = true;
}
}
public override void JustDied(Unit killer)
{
_JustDied();
Talk(OrmorokConst.SayDeath);
}
public override void KilledUnit(Unit who)
{
if (who.IsTypeId(TypeId.Player))
Talk(OrmorokConst.SayKill);
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
DoMeleeAttackIfReady();
}
bool frenzy;
} }
public override CreatureAI GetAI(Creature creature) void Initialize()
{ {
return GetInstanceAI<boss_ormorokAI>(creature); frenzy = false;
} }
public override void Reset()
{
base.Reset();
Initialize();
}
public override void EnterCombat(Unit who)
{
_EnterCombat();
//Crystal Spikes
_scheduler.Schedule(TimeSpan.FromSeconds(12), task =>
{
Talk(OrmorokConst.SayCrystalSpikes);
DoCast(OrmorokConst.SpellCrystalSpikes);
task.Repeat(TimeSpan.FromSeconds(12));
});
//Trample
_scheduler.Schedule(TimeSpan.FromSeconds(10), task =>
{
DoCast(me, OrmorokConst.SpellTrample);
task.Repeat(TimeSpan.FromSeconds(10));
});
//Spell Reflection
_scheduler.Schedule(TimeSpan.FromSeconds(30), task =>
{
Talk(OrmorokConst.SayReflect);
DoCast(me, OrmorokConst.SpellReflection);
task.Repeat(TimeSpan.FromSeconds(30));
});
//Heroic Crystalline Tangler
if (IsHeroic())
{
_scheduler.Schedule(TimeSpan.FromSeconds(17), task =>
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0, new OrmorokTanglerPredicate(me));
if (target)
DoCast(target, OrmorokConst.SpellSummonCrystallineTangler);
task.Repeat(TimeSpan.FromSeconds(17));
});
}
Talk(OrmorokConst.SayAggro);
}
public override void DamageTaken(Unit attacker, ref uint damage)
{
if (!frenzy && HealthBelowPct(25))
{
Talk(OrmorokConst.SayFrenzy);
DoCast(me, OrmorokConst.SpellFrenzy);
frenzy = true;
}
}
public override void JustDied(Unit killer)
{
_JustDied();
Talk(OrmorokConst.SayDeath);
}
public override void KilledUnit(Unit who)
{
if (who.IsTypeId(TypeId.Player))
Talk(OrmorokConst.SayKill);
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
DoMeleeAttackIfReady();
}
bool frenzy;
} }
class OrmorokTanglerPredicate : ISelector class OrmorokTanglerPredicate : ISelector
@@ -189,103 +179,83 @@ namespace Scripts.Northrend.Nexus.Nexus
} }
[Script] [Script]
class npc_crystal_spike_trigger : CreatureScript class npc_crystal_spike_trigger : ScriptedAI
{ {
public npc_crystal_spike_trigger() : base("npc_crystal_spike_trigger") { } public npc_crystal_spike_trigger(Creature creature) : base(creature) { }
class npc_crystal_spike_triggerAI : ScriptedAI public override void IsSummonedBy(Unit owner)
{ {
public npc_crystal_spike_triggerAI(Creature creature) : base(creature) { } switch (me.GetEntry())
public override void IsSummonedBy(Unit owner)
{ {
switch (me.GetEntry()) case CrystalSpikesConst.NpcCrystalSpikeInitial:
{ _count = 0;
case CrystalSpikesConst.NpcCrystalSpikeInitial: me.SetFacingToObject(owner);
_count = 0; break;
me.SetFacingToObject(owner); case CrystalSpikesConst.NpcCrystalSpikeTrigger:
break; Creature trigger = owner.ToCreature();
case CrystalSpikesConst.NpcCrystalSpikeTrigger: if (trigger)
Creature trigger = owner.ToCreature(); _count = trigger.GetAI().GetData(CrystalSpikesConst.DataCount) + 1;
if (trigger) break;
_count = trigger.GetAI().GetData(CrystalSpikesConst.DataCount) + 1; default:
break; _count = CrystalSpikesConst.MaxCount;
default: break;
_count = CrystalSpikesConst.MaxCount; }
break;
}
if (me.GetEntry() == CrystalSpikesConst.NpcCrystalSpikeTrigger)
{
GameObject trap = me.FindNearestGameObject(CrystalSpikesConst.GoCrystalSpikeTrap, 1.0f);
if (trap)
trap.Use(me);
}
//Despawn
_scheduler.Schedule(TimeSpan.FromSeconds(2), task =>
{
if (me.GetEntry() == CrystalSpikesConst.NpcCrystalSpikeTrigger) if (me.GetEntry() == CrystalSpikesConst.NpcCrystalSpikeTrigger)
{ {
GameObject trap = me.FindNearestGameObject(CrystalSpikesConst.GoCrystalSpikeTrap, 1.0f); GameObject trap = me.FindNearestGameObject(CrystalSpikesConst.GoCrystalSpikeTrap, 1.0f);
if (trap) if (trap)
trap.Use(me); trap.Delete();
} }
//Despawn me.DespawnOrUnsummon();
_scheduler.Schedule(TimeSpan.FromSeconds(2), task => });
{
if (me.GetEntry() == CrystalSpikesConst.NpcCrystalSpikeTrigger)
{
GameObject trap = me.FindNearestGameObject(CrystalSpikesConst.GoCrystalSpikeTrap, 1.0f);
if (trap)
trap.Delete();
}
me.DespawnOrUnsummon();
});
}
public override uint GetData(uint type)
{
return type == CrystalSpikesConst.DataCount ? _count : 0;
}
public override void UpdateAI(uint diff)
{
_scheduler.Update(diff);
}
uint _count;
} }
public override CreatureAI GetAI(Creature creature) public override uint GetData(uint type)
{ {
return new npc_crystal_spike_triggerAI(creature); return type == CrystalSpikesConst.DataCount ? _count : 0;
} }
public override void UpdateAI(uint diff)
{
_scheduler.Update(diff);
}
uint _count;
} }
[Script] [Script]
class spell_crystal_spike : SpellScriptLoader class spell_crystal_spike : AuraScript
{ {
public spell_crystal_spike() : base("spell_crystal_spike") { } void HandlePeriodic(AuraEffect aurEff)
class spell_crystal_spike_AuraScript : AuraScript
{ {
void HandlePeriodic(AuraEffect aurEff) Unit target = GetTarget();
if (target.GetEntry() == CrystalSpikesConst.NpcCrystalSpikeInitial || target.GetEntry() == CrystalSpikesConst.NpcCrystalSpikeTrigger)
{ {
Unit target = GetTarget(); Creature trigger = target.ToCreature();
if (target.GetEntry() == CrystalSpikesConst.NpcCrystalSpikeInitial || target.GetEntry() == CrystalSpikesConst.NpcCrystalSpikeTrigger) if (trigger)
{ {
Creature trigger = target.ToCreature(); uint spell = target.GetEntry() == CrystalSpikesConst.NpcCrystalSpikeInitial ? CrystalSpikesConst.CrystalSpikeSummon[0] : CrystalSpikesConst.CrystalSpikeSummon[RandomHelper.IRand(0, 2)];
if (trigger) if (trigger.GetAI().GetData(CrystalSpikesConst.DataCount) < CrystalSpikesConst.MaxCount)
{ trigger.CastSpell(trigger, spell, true);
uint spell = target.GetEntry() == CrystalSpikesConst.NpcCrystalSpikeInitial ? CrystalSpikesConst.CrystalSpikeSummon[0] : CrystalSpikesConst.CrystalSpikeSummon[RandomHelper.IRand(0, 2)];
if (trigger.GetAI().GetData(CrystalSpikesConst.DataCount) < CrystalSpikesConst.MaxCount)
trigger.CastSpell(trigger, spell, true);
}
} }
} }
public override void Register()
{
OnEffectPeriodic.Add(new EffectPeriodicHandler(HandlePeriodic, 0, AuraType.PeriodicDummy));
}
} }
public override AuraScript GetAuraScript() public override void Register()
{ {
return new spell_crystal_spike_AuraScript(); OnEffectPeriodic.Add(new EffectPeriodicHandler(HandlePeriodic, 0, AuraType.PeriodicDummy));
} }
} }
} }
@@ -359,10 +359,5 @@ namespace Scripts.Northrend.Nexus.Oculus
EventMap events = new EventMap(); EventMap events = new EventMap();
} }
public override InstanceScript GetInstanceScript(InstanceMap map) */
{
return new instance_oculus_InstanceMapScript(map);
}
}
*/
} }
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+3 -7
View File
@@ -30,13 +30,9 @@ namespace Scripts.Northrend.Ulduar
{ {
namespace Razorscale namespace Razorscale
{ {
/*class boss_razorscale_controller : CreatureScript /*class boss_razorscale_controller : BossAI
{
public boss_razorscale_controller() : base("boss_razorscale_controller") { }
class boss_razorscale_controllerAI : BossAI
{ {
public boss_razorscale_controllerAI(Creature creature) : base(creature, InstanceData.RazorscaleControl) public boss_razorscale_controller(Creature creature) : base(creature, InstanceData.RazorscaleControl)
{ {
me.SetDisplayId(me.GetCreatureTemplate().ModelId2); me.SetDisplayId(me.GetCreatureTemplate().ModelId2);
} }
@@ -152,7 +148,7 @@ namespace Scripts.Northrend.Ulduar
} }
} }
public override CreatureAI GetAI(Creature creature) public override CreatureAI Get(Creature creature)
{ {
return GetInstanceAI<boss_razorscale_controllerAI>(creature); return GetInstanceAI<boss_razorscale_controllerAI>(creature);
} }
+6
View File
@@ -377,6 +377,12 @@ namespace Scripts.Northrend.Ulduar
public const uint UniverseGlobe = 55; public const uint UniverseGlobe = 55;
public const uint AlgalonTrapdoor = 56; public const uint AlgalonTrapdoor = 56;
public const uint BrannBronzebeardAlg = 57; public const uint BrannBronzebeardAlg = 57;
// Misc
public const uint BrannBronzebeardIntro = 58;
public const uint LoreKeeperOfNorgannon = 59;
public const uint Dellorah = 60;
public const uint BronzebeardRadio = 61;
} }
struct InstanceWorldStates struct InstanceWorldStates
File diff suppressed because it is too large Load Diff
+20 -40
View File
@@ -24,65 +24,45 @@ using Game.Scripting;
namespace Scripts.Northrend namespace Scripts.Northrend
{ {
[Script] [Script]
class spell_wintergrasp_defender_teleport : SpellScriptLoader class spell_wintergrasp_defender_teleport : SpellScript
{ {
public spell_wintergrasp_defender_teleport() : base("spell_wintergrasp_defender_teleport") { } SpellCastResult CheckCast()
class spell_wintergrasp_defender_teleport_SpellScript : SpellScript
{ {
SpellCastResult CheckCast() BattleField wg = Global.BattleFieldMgr.GetBattlefieldByBattleId(1);
if (wg != null)
{ {
BattleField wg = Global.BattleFieldMgr.GetBattlefieldByBattleId(1); Player target = GetExplTargetUnit().ToPlayer();
if (wg != null) if (target)
{ // check if we are in Wintergrasp at all, SotA uses same teleport spells
Player target = GetExplTargetUnit().ToPlayer(); if ((target.GetZoneId() == 4197 && target.GetTeamId() != wg.GetDefenderTeam()) || target.HasAura(54643))
if (target) return SpellCastResult.BadTargets;
// check if we are in Wintergrasp at all, SotA uses same teleport spells
if ((target.GetZoneId() == 4197 && target.GetTeamId() != wg.GetDefenderTeam()) || target.HasAura(54643))
return SpellCastResult.BadTargets;
}
return SpellCastResult.SpellCastOk;
} }
public override void Register() return SpellCastResult.SpellCastOk;
{
OnCheckCast.Add(new CheckCastHandler(CheckCast));
}
} }
public override SpellScript GetSpellScript() public override void Register()
{ {
return new spell_wintergrasp_defender_teleport_SpellScript(); OnCheckCast.Add(new CheckCastHandler(CheckCast));
} }
} }
[Script] [Script]
class spell_wintergrasp_defender_teleport_trigger : SpellScriptLoader class spell_wintergrasp_defender_teleport_trigger : SpellScript
{ {
public spell_wintergrasp_defender_teleport_trigger() : base("spell_wintergrasp_defender_teleport_trigger") { } void HandleDummy(uint effindex)
class spell_wintergrasp_defender_teleport_trigger_SpellScript : SpellScript
{ {
void HandleDummy(uint effindex) Unit target = GetHitUnit();
if (target)
{ {
Unit target = GetHitUnit(); WorldLocation loc = target.GetWorldLocation();
if (target) SetExplTargetDest(loc);
{
WorldLocation loc = target.GetWorldLocation();
SetExplTargetDest(loc);
}
}
public override void Register()
{
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
} }
} }
public override SpellScript GetSpellScript() public override void Register()
{ {
return new spell_wintergrasp_defender_teleport_trigger_SpellScript(); OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
} }
} }
+191 -230
View File
@@ -36,81 +36,71 @@ namespace Scripts.Outlands
} }
[Script] [Script]
class npc_aeranas : CreatureScript class npc_aeranas : ScriptedAI
{ {
public npc_aeranas() : base("npc_aeranas") { } public npc_aeranas(Creature creature) : base(creature) { }
class npc_aeranasAI : ScriptedAI public override void Reset()
{ {
public npc_aeranasAI(Creature creature) : base(creature) { } faction_Timer = 8000;
envelopingWinds_Timer = 9000;
shock_Timer = 5000;
public override void Reset() me.RemoveFlag64(UnitFields.NpcFlags, NPCFlags.QuestGiver);
me.SetFaction(Aeranas.FactionFriendly);
Talk(Aeranas.SaySummon);
}
public override void UpdateAI(uint diff)
{
if (faction_Timer != 0)
{ {
faction_Timer = 8000; if (faction_Timer <= diff)
envelopingWinds_Timer = 9000; {
shock_Timer = 5000; me.SetFaction(Aeranas.FactionHostile);
faction_Timer = 0;
}
else
faction_Timer -= diff;
}
me.RemoveFlag64(UnitFields.NpcFlags, NPCFlags.QuestGiver); if (!UpdateVictim())
return;
if (HealthBelowPct(30))
{
me.SetFaction(Aeranas.FactionFriendly); me.SetFaction(Aeranas.FactionFriendly);
me.SetFlag64(UnitFields.NpcFlags, NPCFlags.QuestGiver);
Talk(Aeranas.SaySummon); me.RemoveAllAuras();
me.DeleteThreatList();
me.CombatStop(true);
Talk(Aeranas.SayFree);
return;
} }
public override void UpdateAI(uint diff) if (shock_Timer <= diff)
{ {
if (faction_Timer != 0) DoCastVictim(Aeranas.SpellShock);
{ shock_Timer = 10000;
if (faction_Timer <= diff)
{
me.SetFaction(Aeranas.FactionHostile);
faction_Timer = 0;
}
else
faction_Timer -= diff;
}
if (!UpdateVictim())
return;
if (HealthBelowPct(30))
{
me.SetFaction(Aeranas.FactionFriendly);
me.SetFlag64(UnitFields.NpcFlags, NPCFlags.QuestGiver);
me.RemoveAllAuras();
me.DeleteThreatList();
me.CombatStop(true);
Talk(Aeranas.SayFree);
return;
}
if (shock_Timer <= diff)
{
DoCastVictim(Aeranas.SpellShock);
shock_Timer = 10000;
}
else
shock_Timer -= diff;
if (envelopingWinds_Timer <= diff)
{
DoCastVictim(Aeranas.SpellEncelopingWinds);
envelopingWinds_Timer = 25000;
}
else
envelopingWinds_Timer -= diff;
DoMeleeAttackIfReady();
} }
else
shock_Timer -= diff;
uint faction_Timer; if (envelopingWinds_Timer <= diff)
uint envelopingWinds_Timer; {
uint shock_Timer; DoCastVictim(Aeranas.SpellEncelopingWinds);
envelopingWinds_Timer = 25000;
}
else
envelopingWinds_Timer -= diff;
DoMeleeAttackIfReady();
} }
public override CreatureAI GetAI(Creature creature) uint faction_Timer;
{ uint envelopingWinds_Timer;
return new npc_aeranasAI(creature); uint shock_Timer;
}
} }
struct AncestralWolf struct AncestralWolf
@@ -125,70 +115,118 @@ namespace Scripts.Outlands
} }
[Script] [Script]
class npc_ancestral_wolf : CreatureScript class npc_ancestral_wolf : npc_escortAI
{ {
public npc_ancestral_wolf() : base("npc_ancestral_wolf") { } public npc_ancestral_wolf(Creature creature) : base(creature)
class npc_ancestral_wolfAI : npc_escortAI
{ {
public npc_ancestral_wolfAI(Creature creature) : base(creature) if (creature.GetOwner() && creature.GetOwner().IsTypeId(TypeId.Player))
{ Start(false, false, creature.GetOwner().GetGUID());
if (creature.GetOwner() && creature.GetOwner().IsTypeId(TypeId.Player)) else
Start(false, false, creature.GetOwner().GetGUID()); Log.outError(LogFilter.Scripts, "Scripts: npc_ancestral_wolf can not obtain owner or owner is not a player.");
else
Log.outError(LogFilter.Scripts, "Scripts: npc_ancestral_wolf can not obtain owner or owner is not a player.");
creature.SetSpeed(UnitMoveType.Walk, 1.5f); creature.SetSpeed(UnitMoveType.Walk, 1.5f);
Reset(); Reset();
}
public override void Reset()
{
ryga = null;
DoCast(me, AncestralWolf.SpellAncestralWoldBuff, true);
}
public override void MoveInLineOfSight(Unit who)
{
if (!ryga && who.GetEntry() == AncestralWolf.NpcRyga && me.IsWithinDistInMap(who, 15.0f))
{
Creature temp = who.ToCreature();
if (temp)
ryga = temp;
}
base.MoveInLineOfSight(who);
}
public override void WaypointReached(uint waypointId)
{
switch (waypointId)
{
case 0:
Talk(AncestralWolf.EmoteWoldLiftHead);
break;
case 2:
Talk(AncestralWolf.EmoteWolfHowl);
break;
case 50:
if (ryga && ryga.IsAlive() && !ryga.IsInCombat())
ryga.GetAI().Talk(AncestralWolf.SayWolfWelcome);
break;
}
}
Creature ryga;
} }
public override CreatureAI GetAI(Creature creature) public override void Reset()
{ {
return new npc_ancestral_wolfAI(creature); ryga = null;
DoCast(me, AncestralWolf.SpellAncestralWoldBuff, true);
} }
public override void MoveInLineOfSight(Unit who)
{
if (!ryga && who.GetEntry() == AncestralWolf.NpcRyga && me.IsWithinDistInMap(who, 15.0f))
{
Creature temp = who.ToCreature();
if (temp)
ryga = temp;
}
base.MoveInLineOfSight(who);
}
public override void WaypointReached(uint waypointId)
{
switch (waypointId)
{
case 0:
Talk(AncestralWolf.EmoteWoldLiftHead);
break;
case 2:
Talk(AncestralWolf.EmoteWolfHowl);
break;
case 50:
if (ryga && ryga.IsAlive() && !ryga.IsInCombat())
ryga.GetAI().Talk(AncestralWolf.SayWolfWelcome);
break;
}
}
Creature ryga;
} }
[Script] [Script]
class npc_wounded_blood_elf : CreatureScript class npc_wounded_blood_elf : npc_escortAI
{ {
public npc_wounded_blood_elf(Creature creature) : base(creature) { }
public override void Reset() { }
public override void EnterCombat(Unit who)
{
if (HasEscortState(eEscortState.Escorting))
Talk(SAY_ELF_AGGRO);
}
public override void JustSummoned(Creature summoned)
{
summoned.GetAI().AttackStart(me);
}
public override void sQuestAccept(Player player, Quest quest)
{
if (quest.Id == QUEST_ROAD_TO_FALCON_WATCH)
{
me.SetFaction(FACTION_FALCON_WATCH_QUEST);
base.Start(true, false, player.GetGUID());
}
}
public override void WaypointReached(uint waypointId)
{
Player player = GetPlayerForEscort();
if (!player)
return;
switch (waypointId)
{
case 0:
Talk(SAY_ELF_START, player);
break;
case 9:
Talk(SAY_ELF_SUMMON1, player);
// Spawn two Haal'eshi Talonguard
DoSpawnCreature(NPC_HAALESHI_TALONGUARD, -15, -15, 0, 0, TempSummonType.TimedDespawnOOC, 5000);
DoSpawnCreature(NPC_HAALESHI_TALONGUARD, -17, -17, 0, 0, TempSummonType.TimedDespawnOOC, 5000);
break;
case 13:
Talk(SAY_ELF_RESTING, player);
break;
case 14:
Talk(SAY_ELF_SUMMON2, player);
// Spawn two Haal'eshi Windwalker
DoSpawnCreature(NPC_HAALESHI_WINDWALKER, -15, -15, 0, 0, TempSummonType.TimedDespawnOOC, 5000);
DoSpawnCreature(NPC_HAALESHI_WINDWALKER, -17, -17, 0, 0, TempSummonType.TimedDespawnOOC, 5000);
break;
case 27:
Talk(SAY_ELF_COMPLETE, player);
// Award quest credit
player.GroupEventHappens(QUEST_ROAD_TO_FALCON_WATCH, me);
break;
}
}
const uint SAY_ELF_START = 0; const uint SAY_ELF_START = 0;
const uint SAY_ELF_SUMMON1 = 1; const uint SAY_ELF_SUMMON1 = 1;
const uint SAY_ELF_RESTING = 2; const uint SAY_ELF_RESTING = 2;
@@ -199,142 +237,65 @@ namespace Scripts.Outlands
const uint NPC_HAALESHI_WINDWALKER = 16966; const uint NPC_HAALESHI_WINDWALKER = 16966;
const uint NPC_HAALESHI_TALONGUARD = 16967; const uint NPC_HAALESHI_TALONGUARD = 16967;
const uint FACTION_FALCON_WATCH_QUEST = 775; const uint FACTION_FALCON_WATCH_QUEST = 775;
public npc_wounded_blood_elf() : base("npc_wounded_blood_elf") { }
class npc_wounded_blood_elfAI : npc_escortAI
{
public npc_wounded_blood_elfAI(Creature creature) : base(creature) { }
public override void Reset() { }
public override void EnterCombat(Unit who)
{
if (HasEscortState(eEscortState.Escorting))
Talk(SAY_ELF_AGGRO);
}
public override void JustSummoned(Creature summoned)
{
summoned.GetAI().AttackStart(me);
}
public override void sQuestAccept(Player player, Quest quest)
{
if (quest.Id == QUEST_ROAD_TO_FALCON_WATCH)
{
me.SetFaction(FACTION_FALCON_WATCH_QUEST);
base.Start(true, false, player.GetGUID());
}
}
public override void WaypointReached(uint waypointId)
{
Player player = GetPlayerForEscort();
if (!player)
return;
switch (waypointId)
{
case 0:
Talk(SAY_ELF_START, player);
break;
case 9:
Talk(SAY_ELF_SUMMON1, player);
// Spawn two Haal'eshi Talonguard
DoSpawnCreature(NPC_HAALESHI_TALONGUARD, -15, -15, 0, 0, TempSummonType.TimedDespawnOOC, 5000);
DoSpawnCreature(NPC_HAALESHI_TALONGUARD, -17, -17, 0, 0, TempSummonType.TimedDespawnOOC, 5000);
break;
case 13:
Talk(SAY_ELF_RESTING, player);
break;
case 14:
Talk(SAY_ELF_SUMMON2, player);
// Spawn two Haal'eshi Windwalker
DoSpawnCreature(NPC_HAALESHI_WINDWALKER, -15, -15, 0, 0, TempSummonType.TimedDespawnOOC, 5000);
DoSpawnCreature(NPC_HAALESHI_WINDWALKER, -17, -17, 0, 0, TempSummonType.TimedDespawnOOC, 5000);
break;
case 27:
Talk(SAY_ELF_COMPLETE, player);
// Award quest credit
player.GroupEventHappens(QUEST_ROAD_TO_FALCON_WATCH, me);
break;
}
}
}
public override CreatureAI GetAI(Creature creature)
{
return new npc_wounded_blood_elfAI(creature);
}
} }
[Script] [Script]
class npc_fel_guard_hound : CreatureScript class npc_fel_guard_hound : ScriptedAI
{ {
const uint SPELL_SUMMON_POO = 37688; public npc_fel_guard_hound(Creature creature) : base(creature) { }
const uint NPC_DERANGED_HELBOAR = 16863;
public npc_fel_guard_hound() : base("npc_fel_guard_hound") { } public override void Reset()
class npc_fel_guard_houndAI : ScriptedAI
{ {
public npc_fel_guard_houndAI(Creature creature) : base(creature) { } checkTimer = 5000; //check for creature every 5 sec
helboarGUID.Clear();
}
public override void Reset() public override void MovementInform(MovementGeneratorType type, uint id)
{
if (type != MovementGeneratorType.Point || id != 1)
return;
Creature helboar = me.GetMap().GetCreature(helboarGUID);
if (helboar)
{ {
checkTimer = 5000; //check for creature every 5 sec helboar.RemoveCorpse();
helboarGUID.Clear(); DoCast(SPELL_SUMMON_POO);
Player owner = me.GetCharmerOrOwnerPlayerOrPlayerItself();
if (owner)
me.GetMotionMaster().MoveFollow(owner, 0.0f, 0.0f);
} }
}
public override void MovementInform(MovementGeneratorType type, uint id) public override void UpdateAI(uint diff)
{
if (checkTimer <= diff)
{ {
if (type != MovementGeneratorType.Point || id != 1) Creature helboar = me.FindNearestCreature(NPC_DERANGED_HELBOAR, 10.0f, false);
return;
Creature helboar = me.GetMap().GetCreature(helboarGUID);
if (helboar) if (helboar)
{ {
helboar.RemoveCorpse(); if (helboar.GetGUID() != helboarGUID && me.GetMotionMaster().GetCurrentMovementGeneratorType() != MovementGeneratorType.Point && !me.FindCurrentSpellBySpellId(SPELL_SUMMON_POO))
DoCast(SPELL_SUMMON_POO);
Player owner = me.GetCharmerOrOwnerPlayerOrPlayerItself();
if (owner)
me.GetMotionMaster().MoveFollow(owner, 0.0f, 0.0f);
}
}
public override void UpdateAI(uint diff)
{
if (checkTimer <= diff)
{
Creature helboar = me.FindNearestCreature(NPC_DERANGED_HELBOAR, 10.0f, false);
if (helboar)
{ {
if (helboar.GetGUID() != helboarGUID && me.GetMotionMaster().GetCurrentMovementGeneratorType() != MovementGeneratorType.Point && !me.FindCurrentSpellBySpellId(SPELL_SUMMON_POO)) helboarGUID = helboar.GetGUID();
{ me.GetMotionMaster().MovePoint(1, helboar.GetPositionX(), helboar.GetPositionY(), helboar.GetPositionZ());
helboarGUID = helboar.GetGUID();
me.GetMotionMaster().MovePoint(1, helboar.GetPositionX(), helboar.GetPositionY(), helboar.GetPositionZ());
}
} }
checkTimer = 5000;
} }
else checkTimer -= diff; checkTimer = 5000;
if (!UpdateVictim())
return;
DoMeleeAttackIfReady();
} }
else checkTimer -= diff;
uint checkTimer; if (!UpdateVictim())
ObjectGuid helboarGUID; return;
DoMeleeAttackIfReady();
} }
public override CreatureAI GetAI(Creature creature) uint checkTimer;
{ ObjectGuid helboarGUID;
return new npc_fel_guard_houndAI(creature);
} const uint SPELL_SUMMON_POO = 37688;
const uint NPC_DERANGED_HELBOAR = 16863;
} }
} }
+1 -67
View File
@@ -140,8 +140,7 @@ namespace Scripts.Outlands
class npc_cooshcooshAI : ScriptedAI class npc_cooshcooshAI : ScriptedAI
{ {
public npc_cooshcooshAI(Creature creature) public npc_cooshcooshAI(Creature creature) : base(creature)
: base(creature)
{ {
m_uiNormFaction = creature.getFaction(); m_uiNormFaction = creature.getFaction();
} }
@@ -263,32 +262,6 @@ namespace Scripts.Outlands
const string GOSSIP_ITEM_KUR3 = "I will tell them. Farewell, elder."; const string GOSSIP_ITEM_KUR3 = "I will tell them. Farewell, elder.";
} }
[Script]
class npc_mortog_steamhead : CreatureScript
{
public npc_mortog_steamhead() : base("npc_mortog_steamhead") { }
public override bool OnGossipHello(Player player, Creature creature)
{
if (creature.IsVendor() && player.GetReputationRank(942) == ReputationRank.Exalted)
player.ADD_GOSSIP_ITEM(GossipOptionIcon.Vendor, GOSSIP_TEXT_BROWSE_GOODS, eTradeskill.GossipSenderMain, eTradeskill.GossipActionTrade);
player.SEND_GOSSIP_MENU(player.GetGossipTextId(creature), creature.GetGUID());
return true;
}
public override bool OnGossipSelect(Player player, Creature creature, uint sender, uint action)
{
player.PlayerTalkClass.ClearMenus();
if (action == eTradeskill.GossipActionTrade)
player.GetSession().SendListInventory(creature.GetGUID());
return true;
}
const string GOSSIP_TEXT_BROWSE_GOODS = "I'd like to browse your goods.";
}
[Script] [Script]
class npc_kayra_longmane : CreatureScript class npc_kayra_longmane : CreatureScript
{ {
@@ -360,43 +333,4 @@ namespace Scripts.Outlands
const uint QUEST_ESCAPE_FROM = 9752; const uint QUEST_ESCAPE_FROM = 9752;
const uint NPC_SLAVEBINDER = 18042; const uint NPC_SLAVEBINDER = 18042;
} }
[Script]
class npc_timothy_daniels : CreatureScript
{
public npc_timothy_daniels() : base("npc_timothy_daniels") { }
public override bool OnGossipHello(Player player, Creature creature)
{
if (creature.IsQuestGiver())
player.PrepareQuestMenu(creature.GetGUID());
if (creature.IsVendor())
player.ADD_GOSSIP_ITEM(GossipOptionIcon.Vendor, GOSSIP_TEXT_BROWSE_POISONS, eTradeskill.GossipSenderMain, eTradeskill.GossipActionTrade);
player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GOSSIP_TIMOTHY_DANIELS_ITEM1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
player.SEND_GOSSIP_MENU(player.GetGossipTextId(creature), creature.GetGUID());
return true;
}
public override bool OnGossipSelect(Player player, Creature creature, uint sender, uint action)
{
player.PlayerTalkClass.ClearMenus();
switch (action)
{
case eTradeskill.GossipActionInfoDef + 1:
player.SEND_GOSSIP_MENU(GOSSIP_TEXTID_TIMOTHY_DANIELS1, creature.GetGUID());
break;
case eTradeskill.GossipActionTrade:
player.GetSession().SendListInventory(creature.GetGUID());
break;
}
return true;
}
const string GOSSIP_TIMOTHY_DANIELS_ITEM1 = "Specialist, eh? Just what kind of specialist are you, anyway?";
const string GOSSIP_TEXT_BROWSE_POISONS = "Let me browse your reagents and poison supplies.";
const uint GOSSIP_TEXTID_TIMOTHY_DANIELS1 = 9239;
}
} }
+67 -87
View File
@@ -27,111 +27,91 @@ using System.Collections.Generic;
namespace Scripts.Pets namespace Scripts.Pets
{ {
[Script] [Script]
class npc_pet_dk_ebon_gargoyle : CreatureScript class npc_pet_dk_ebon_gargoyle : CasterAI
{ {
public npc_pet_dk_ebon_gargoyle() : base("npc_pet_dk_ebon_gargoyle") { } public npc_pet_dk_ebon_gargoyle(Creature creature) : base(creature) { }
class npc_pet_dk_ebon_gargoyleAI : CasterAI public override void InitializeAI()
{ {
public npc_pet_dk_ebon_gargoyleAI(Creature creature) : base(creature) { } base.InitializeAI();
ObjectGuid ownerGuid = me.GetOwnerGUID();
if (ownerGuid.IsEmpty())
return;
public override void InitializeAI() // Find victim of Summon Gargoyle spell
List<Unit> targets = new List<Unit>();
var u_check = new AnyUnfriendlyUnitInObjectRangeCheck(me, me, 30.0f);
var searcher = new UnitListSearcher(me, targets, u_check);
Cell.VisitAllObjects(me, searcher, 30.0f);
foreach (var iter in targets)
{ {
base.InitializeAI(); if (iter.GetAura(SpellSummonGargoyle1, ownerGuid) != null)
ObjectGuid ownerGuid = me.GetOwnerGUID();
if (ownerGuid.IsEmpty())
return;
// Find victim of Summon Gargoyle spell
List<Unit> targets = new List<Unit>();
var u_check = new AnyUnfriendlyUnitInObjectRangeCheck(me, me, 30.0f);
var searcher = new UnitListSearcher(me, targets, u_check);
Cell.VisitAllObjects(me, searcher, 30.0f);
foreach (var iter in targets)
{ {
if (iter.GetAura(SpellSummonGargoyle1, ownerGuid) != null) me.Attack(iter, false);
{ break;
me.Attack(iter, false);
break;
}
} }
} }
public override void JustDied(Unit killer)
{
// Stop Feeding Gargoyle when it dies
Unit owner = me.GetOwner();
if (owner)
owner.RemoveAurasDueToSpell(SpellSummonGargoyle2);
}
// Fly away when dismissed
public override void SpellHit(Unit source, SpellInfo spell)
{
if (spell.Id != SpellDismissGargoyle || !me.IsAlive())
return;
Unit owner = me.GetOwner();
if (!owner || owner != source)
return;
// Stop Fighting
me.ApplyModFlag(UnitFields.Flags, UnitFlags.NonAttackable, true);
// Sanctuary
me.CastSpell(me, SpellSanctuary, true);
me.SetReactState(ReactStates.Passive);
//! HACK: Creature's can't have MOVEMENTFLAG_FLYING
// Fly Away
me.SetCanFly(true);
me.SetSpeedRate(UnitMoveType.Flight, 0.75f);
me.SetSpeedRate(UnitMoveType.Run, 0.75f);
float x = me.GetPositionX() + 20 * (float)Math.Cos(me.GetOrientation());
float y = me.GetPositionY() + 20 * (float)Math.Sin(me.GetOrientation());
float z = me.GetPositionZ() + 40;
me.GetMotionMaster().Clear(false);
me.GetMotionMaster().MovePoint(0, x, y, z);
// Despawn as soon as possible
me.DespawnOrUnsummon(4 * Time.InMilliseconds);
}
const uint SpellSummonGargoyle1 = 49206;
const uint SpellSummonGargoyle2 = 50514;
const uint SpellDismissGargoyle = 50515;
const uint SpellSanctuary = 54661;
} }
public override CreatureAI GetAI(Creature creature) public override void JustDied(Unit killer)
{ {
return new npc_pet_dk_ebon_gargoyleAI(creature); // Stop Feeding Gargoyle when it dies
Unit owner = me.GetOwner();
if (owner)
owner.RemoveAurasDueToSpell(SpellSummonGargoyle2);
} }
// Fly away when dismissed
public override void SpellHit(Unit source, SpellInfo spell)
{
if (spell.Id != SpellDismissGargoyle || !me.IsAlive())
return;
Unit owner = me.GetOwner();
if (!owner || owner != source)
return;
// Stop Fighting
me.ApplyModFlag(UnitFields.Flags, UnitFlags.NonAttackable, true);
// Sanctuary
me.CastSpell(me, SpellSanctuary, true);
me.SetReactState(ReactStates.Passive);
//! HACK: Creature's can't have MOVEMENTFLAG_FLYING
// Fly Away
me.SetCanFly(true);
me.SetSpeedRate(UnitMoveType.Flight, 0.75f);
me.SetSpeedRate(UnitMoveType.Run, 0.75f);
float x = me.GetPositionX() + 20 * (float)Math.Cos(me.GetOrientation());
float y = me.GetPositionY() + 20 * (float)Math.Sin(me.GetOrientation());
float z = me.GetPositionZ() + 40;
me.GetMotionMaster().Clear(false);
me.GetMotionMaster().MovePoint(0, x, y, z);
// Despawn as soon as possible
me.DespawnOrUnsummon(4 * Time.InMilliseconds);
}
const uint SpellSummonGargoyle1 = 49206;
const uint SpellSummonGargoyle2 = 50514;
const uint SpellDismissGargoyle = 50515;
const uint SpellSanctuary = 54661;
} }
[Script] [Script]
class npc_pet_dk_guardian : CreatureScript class npc_pet_dk_guardian : AggressorAI
{ {
public npc_pet_dk_guardian() : base("npc_pet_dk_guardian") { } public npc_pet_dk_guardian(Creature creature) : base(creature) { }
class npc_pet_dk_guardianAI : AggressorAI public override bool CanAIAttack(Unit target)
{ {
public npc_pet_dk_guardianAI(Creature creature) : base(creature) { } if (!target)
return false;
public override bool CanAIAttack(Unit target) Unit owner = me.GetOwner();
{ if (owner && !target.IsInCombatWith(owner))
if (!target) return false;
return false; return base.CanAIAttack(target);
Unit owner = me.GetOwner();
if (owner && !target.IsInCombatWith(owner))
return false;
return base.CanAIAttack(target);
}
}
public override CreatureAI GetAI(Creature creature)
{
return new npc_pet_dk_guardianAI(creature);
} }
} }
} }
+40 -50
View File
@@ -23,63 +23,53 @@ using Game.Scripting;
namespace Scripts.Pets namespace Scripts.Pets
{ {
[Script] [Script]
class npc_pet_gen_mojo : CreatureScript class npc_pet_gen_mojo : ScriptedAI
{ {
public npc_pet_gen_mojo() : base("npc_pet_gen_mojo") { } public npc_pet_gen_mojo(Creature creature) : base(creature) { }
class npc_pet_gen_mojoAI : ScriptedAI public override void Reset()
{ {
public npc_pet_gen_mojoAI(Creature creature) : base(creature) { } _victimGUID.Clear();
public override void Reset() Unit owner = me.GetOwner();
{ if (owner)
_victimGUID.Clear(); me.GetMotionMaster().MoveFollow(owner, 0.0f, 0.0f);
Unit owner = me.GetOwner();
if (owner)
me.GetMotionMaster().MoveFollow(owner, 0.0f, 0.0f);
}
public override void EnterCombat(Unit who) { }
public override void UpdateAI(uint diff) { }
public override void ReceiveEmote(Player player, TextEmotes emote)
{
me.HandleEmoteCommand((Emote)emote);
Unit owner = me.GetOwner();
if (emote != TextEmotes.Kiss || !owner || !owner.IsTypeId(TypeId.Player) ||
owner.ToPlayer().GetTeam() != player.GetTeam())
{
return;
}
Talk(SayMojo, player);
if (!_victimGUID.IsEmpty())
{
Player victim = Global.ObjAccessor.GetPlayer(me, _victimGUID);
if (victim)
victim.RemoveAura(SpellFeelingFroggy);
}
_victimGUID = player.GetGUID();
DoCast(player, SpellFeelingFroggy, true);
DoCast(me, SpellSeductionVisual, true);
me.GetMotionMaster().MoveFollow(player, 0.0f, 0.0f);
}
ObjectGuid _victimGUID;
const uint SayMojo = 0;
const uint SpellFeelingFroggy = 43906;
const uint SpellSeductionVisual = 43919;
} }
public override CreatureAI GetAI(Creature creature) public override void EnterCombat(Unit who) { }
public override void UpdateAI(uint diff) { }
public override void ReceiveEmote(Player player, TextEmotes emote)
{ {
return new npc_pet_gen_mojoAI(creature); me.HandleEmoteCommand((Emote)emote);
Unit owner = me.GetOwner();
if (emote != TextEmotes.Kiss || !owner || !owner.IsTypeId(TypeId.Player) ||
owner.ToPlayer().GetTeam() != player.GetTeam())
{
return;
}
Talk(SayMojo, player);
if (!_victimGUID.IsEmpty())
{
Player victim = Global.ObjAccessor.GetPlayer(me, _victimGUID);
if (victim)
victim.RemoveAura(SpellFeelingFroggy);
}
_victimGUID = player.GetGUID();
DoCast(player, SpellFeelingFroggy, true);
DoCast(me, SpellSeductionVisual, true);
me.GetMotionMaster().MoveFollow(player, 0.0f, 0.0f);
} }
ObjectGuid _victimGUID;
const uint SayMojo = 0;
const uint SpellFeelingFroggy = 43906;
const uint SpellSeductionVisual = 43919;
} }
} }
+65 -75
View File
@@ -23,100 +23,90 @@ using Game.Scripting;
namespace Scripts.Pets namespace Scripts.Pets
{ {
[Script] [Script]
class npc_pet_hunter_snake_trap : CreatureScript class npc_pet_hunter_snake_trap : ScriptedAI
{ {
public npc_pet_hunter_snake_trap() : base("npc_pet_hunter_snake_trap") { } public npc_pet_hunter_snake_trap(Creature creature) : base(creature) { }
class npc_pet_hunter_snake_trapAI : ScriptedAI public override void EnterCombat(Unit who) { }
public override void Reset()
{ {
public npc_pet_hunter_snake_trapAI(Creature creature) : base(creature) { } _spellTimer = 0;
public override void EnterCombat(Unit who) { } CreatureTemplate Info = me.GetCreatureTemplate();
public override void Reset() _isViper = Info.Entry == NpcViper ? true : false;
me.SetMaxHealth((uint)(107 * (me.getLevel() - 40) * 0.025f));
// Add delta to make them not all hit the same time
uint delta = (RandomHelper.Rand32() % 7) * 100;
me.SetStatFloatValue(UnitFields.BaseAttackTime, Info.BaseAttackTime + delta);
//me.SetStatFloatValue(UnitFields.RangedAttackPower, (float)Info.AttackPower);
// Start attacking attacker of owner on first ai update after spawn - move in line of sight may choose better target
if (!me.GetVictim() && me.IsSummon())
{ {
_spellTimer = 0; Unit owner = me.ToTempSummon().GetSummoner();
if (owner)
CreatureTemplate Info = me.GetCreatureTemplate(); if (owner.getAttackerForHelper())
AttackStart(owner.getAttackerForHelper());
_isViper = Info.Entry == NpcViper ? true : false;
me.SetMaxHealth((uint)(107 * (me.getLevel() - 40) * 0.025f));
// Add delta to make them not all hit the same time
uint delta = (RandomHelper.Rand32() % 7) * 100;
me.SetStatFloatValue(UnitFields.BaseAttackTime, Info.BaseAttackTime + delta);
//me.SetStatFloatValue(UnitFields.RangedAttackPower, (float)Info.AttackPower);
// Start attacking attacker of owner on first ai update after spawn - move in line of sight may choose better target
if (!me.GetVictim() && me.IsSummon())
{
Unit owner = me.ToTempSummon().GetSummoner();
if (owner)
if (owner.getAttackerForHelper())
AttackStart(owner.getAttackerForHelper());
}
if (!_isViper)
DoCast(me, SpellDeadlyPoisonPassive, true);
} }
// Redefined for random target selection: if (!_isViper)
public override void MoveInLineOfSight(Unit who) DoCast(me, SpellDeadlyPoisonPassive, true);
{ }
if (!me.GetVictim() && me.CanCreatureAttack(who))
{
if (me.GetDistanceZ(who) > SharedConst.CreatureAttackRangeZ)
return;
float attackRadius = me.GetAttackDistance(who); // Redefined for random target selection:
if (me.IsWithinDistInMap(who, attackRadius) && me.IsWithinLOSInMap(who)) public override void MoveInLineOfSight(Unit who)
{
if (!me.GetVictim() && me.CanCreatureAttack(who))
{
if (me.GetDistanceZ(who) > SharedConst.CreatureAttackRangeZ)
return;
float attackRadius = me.GetAttackDistance(who);
if (me.IsWithinDistInMap(who, attackRadius) && me.IsWithinLOSInMap(who))
{
if ((RandomHelper.Rand32() % 5) == 0)
{ {
if ((RandomHelper.Rand32() % 5) == 0) me.setAttackTimer(WeaponAttackType.BaseAttack, (RandomHelper.Rand32() % 10) * 100);
{ _spellTimer = (RandomHelper.Rand32() % 10) * 100;
me.setAttackTimer(WeaponAttackType.BaseAttack, (RandomHelper.Rand32() % 10) * 100); AttackStart(who);
_spellTimer = (RandomHelper.Rand32() % 10) * 100;
AttackStart(who);
}
} }
} }
} }
}
public override void UpdateAI(uint diff) public override void UpdateAI(uint diff)
{
if (!UpdateVictim() || !me.GetVictim())
return;
if (me.GetVictim().HasBreakableByDamageCrowdControlAura(me))
{ {
if (!UpdateVictim() || !me.GetVictim()) me.InterruptNonMeleeSpells(false);
return; return;
if (me.GetVictim().HasBreakableByDamageCrowdControlAura(me))
{
me.InterruptNonMeleeSpells(false);
return;
}
//Viper
if (_isViper)
{
if (_spellTimer <= diff)
{
if (RandomHelper.IRand(0, 2) == 0) //33% chance to cast
DoCastVictim(RandomHelper.RAND(SpellMindNumbingPoison, SpellCripplingPoison));
_spellTimer = 3000;
}
else
_spellTimer -= diff;
}
DoMeleeAttackIfReady();
} }
bool _isViper; //Viper
uint _spellTimer; if (_isViper)
{
if (_spellTimer <= diff)
{
if (RandomHelper.IRand(0, 2) == 0) //33% chance to cast
DoCastVictim(RandomHelper.RAND(SpellMindNumbingPoison, SpellCripplingPoison));
_spellTimer = 3000;
}
else
_spellTimer -= diff;
}
DoMeleeAttackIfReady();
} }
public override CreatureAI GetAI(Creature creature) bool _isViper;
{ uint _spellTimer;
return new npc_pet_hunter_snake_trapAI(creature);
}
const uint SpellCripplingPoison = 30981; // Viper const uint SpellCripplingPoison = 30981; // Viper
const uint SpellDeadlyPoisonPassive = 34657; // Venomous Snake const uint SpellDeadlyPoisonPassive = 34657; // Venomous Snake
+175 -186
View File
@@ -37,216 +37,205 @@ namespace Scripts.Pets
public const uint TimerMirrorImageFireBlast = 6000; public const uint TimerMirrorImageFireBlast = 6000;
} }
[Script] [Script]
class npc_pet_mage_mirror_image : CreatureScript class npc_pet_mage_mirror_image : CasterAI
{ {
public npc_pet_mage_mirror_image() : base("npc_pet_mage_mirror_image") { } public npc_pet_mage_mirror_image(Creature creature) : base(creature) { }
class npc_pet_mage_mirror_imageAI : CasterAI void Init()
{ {
public npc_pet_mage_mirror_imageAI(Creature creature) : base(creature) { } Unit owner = me.GetCharmerOrOwner();
void Init() List<Unit> targets = new List<Unit>();
var u_check = new AnyUnfriendlyUnitInObjectRangeCheck(me, me, 30.0f);
var searcher = new UnitListSearcher(me, targets, u_check);
Cell.VisitAllObjects(me, searcher, 40.0f);
Unit highestThreatUnit = null;
float highestThreat = 0.0f;
Unit nearestPlayer = null;
foreach (var unit in targets)
{ {
Unit owner = me.GetCharmerOrOwner(); // Consider only units without CC
if (!unit.HasBreakableByDamageCrowdControlAura(unit))
{
// Take first found unit
if (!highestThreatUnit && !unit.IsTypeId(TypeId.Player))
{
highestThreatUnit = unit;
continue;
}
if (!nearestPlayer && unit.IsTypeId(TypeId.Player))
{
nearestPlayer = unit;
continue;
}
// else compare best fit unit with current unit
var triggers = unit.GetThreatManager().getThreatList();
foreach (var reference in triggers)
{
// Try to find threat referenced to owner
if (reference.getTarget() == owner)
{
// Check if best fit hostile unit hs lower threat than this current unit
if (highestThreat < reference.getThreat())
{
// If so, update best fit unit
highestThreat = reference.getThreat();
highestThreatUnit = unit;
break;
}
}
}
// In case no unit with threat was found so far, always check for nearest unit (only for players)
if (unit.IsTypeId(TypeId.Player))
{
// If this player is closer than the previous one, update it
if (me.GetDistance(unit.GetPosition()) < me.GetDistance(nearestPlayer.GetPosition()))
nearestPlayer = unit;
}
}
}
// Prioritize units with threat referenced to owner
if (highestThreat > 0.0f && highestThreatUnit)
me.Attack(highestThreatUnit, false);
// If there is no such target, try to attack nearest hostile unit if such exists
else if (nearestPlayer)
me.Attack(nearestPlayer, false);
}
List<Unit> targets = new List<Unit>(); bool IsInThreatList(Unit target)
var u_check = new AnyUnfriendlyUnitInObjectRangeCheck(me, me, 30.0f); {
var searcher = new UnitListSearcher(me, targets, u_check); Unit owner = me.GetCharmerOrOwner();
Cell.VisitAllObjects(me, searcher, 40.0f);
Unit highestThreatUnit = null; List<Unit> targets = new List<Unit>();
float highestThreat = 0.0f; var u_check = new AnyUnfriendlyUnitInObjectRangeCheck(me, me, 30.0f);
Unit nearestPlayer = null; var searcher = new UnitListSearcher(me, targets, u_check);
foreach (var unit in targets) Cell.VisitAllObjects(me, searcher, 40.0f);
foreach (var unit in targets)
{
if (unit == target)
{ {
// Consider only units without CC // Consider only units without CC
if (!unit.HasBreakableByDamageCrowdControlAura(unit)) if (!unit.HasBreakableByDamageCrowdControlAura(unit))
{ {
// Take first found unit
if (!highestThreatUnit && !unit.IsTypeId(TypeId.Player))
{
highestThreatUnit = unit;
continue;
}
if (!nearestPlayer && unit.IsTypeId(TypeId.Player))
{
nearestPlayer = unit;
continue;
}
// else compare best fit unit with current unit
var triggers = unit.GetThreatManager().getThreatList(); var triggers = unit.GetThreatManager().getThreatList();
foreach (var reference in triggers) foreach (var reference in triggers)
{ {
// Try to find threat referenced to owner // Try to find threat referenced to owner
if (reference.getTarget() == owner) if (reference.getTarget() == owner)
{ return true;
// Check if best fit hostile unit hs lower threat than this current unit
if (highestThreat < reference.getThreat())
{
// If so, update best fit unit
highestThreat = reference.getThreat();
highestThreatUnit = unit;
break;
}
}
}
// In case no unit with threat was found so far, always check for nearest unit (only for players)
if (unit.IsTypeId(TypeId.Player))
{
// If this player is closer than the previous one, update it
if (me.GetDistance(unit.GetPosition()) < me.GetDistance(nearestPlayer.GetPosition()))
nearestPlayer = unit;
} }
} }
} }
// Prioritize units with threat referenced to owner
if (highestThreat > 0.0f && highestThreatUnit)
me.Attack(highestThreatUnit, false);
// If there is no such target, try to attack nearest hostile unit if such exists
else if (nearestPlayer)
me.Attack(nearestPlayer, false);
}
bool IsInThreatList(Unit target)
{
Unit owner = me.GetCharmerOrOwner();
List<Unit> targets = new List<Unit>();
var u_check = new AnyUnfriendlyUnitInObjectRangeCheck(me, me, 30.0f);
var searcher = new UnitListSearcher(me, targets, u_check);
Cell.VisitAllObjects(me, searcher, 40.0f);
foreach (var unit in targets)
{
if (unit == target)
{
// Consider only units without CC
if (!unit.HasBreakableByDamageCrowdControlAura(unit))
{
var triggers = unit.GetThreatManager().getThreatList();
foreach (var reference in triggers)
{
// Try to find threat referenced to owner
if (reference.getTarget() == owner)
return true;
}
}
}
}
return false;
}
public override void InitializeAI()
{
base.InitializeAI();
Unit owner = me.GetOwner();
if (!owner)
return;
// here mirror image casts on summoner spell (not present in client dbc) 49866
// here should be auras (not present in client dbc): 35657, 35658, 35659, 35660 selfcasted by mirror images (stats related?)
// Clone Me!
owner.CastSpell(me, PetMageConst.SpellCloneMe, false);
}
public override void EnterCombat(Unit victim)
{
if (me.GetVictim() && !me.GetVictim().HasBreakableByDamageCrowdControlAura(me))
{
me.CastSpell(victim, PetMageConst.SpellMageFireBlast, false);
_events.ScheduleEvent(PetMageConst.SpellMageFrostBolt, PetMageConst.TimerMirrorImageInit);
_events.ScheduleEvent(PetMageConst.SpellMageFireBlast, PetMageConst.TimerMirrorImageFireBlast);
}
else
EnterEvadeMode(EvadeReason.Other);
}
public override void Reset()
{
_events.Reset();
}
public override void UpdateAI(uint diff)
{
Unit owner = me.GetCharmerOrOwner();
if (!owner)
return;
Unit target = owner.getAttackerForHelper();
_events.Update(diff);
// prevent CC interrupts by images
if (me.GetVictim() && me.GetVictim().HasBreakableByDamageCrowdControlAura(me))
{
me.InterruptNonMeleeSpells(false);
return;
}
if (me.HasUnitState(UnitState.Casting))
return;
// assign target if image doesnt have any or the target is not actual
if (!target || me.GetVictim() != target)
{
Unit ownerTarget = null;
Player owner1 = me.GetCharmerOrOwner().ToPlayer();
if (owner1)
ownerTarget = owner1.GetSelectedUnit();
// recognize which victim will be choosen
if (ownerTarget && ownerTarget.IsTypeId(TypeId.Player))
{
if (!ownerTarget.HasBreakableByDamageCrowdControlAura(ownerTarget))
me.Attack(ownerTarget, false);
}
else if (ownerTarget && !ownerTarget.IsTypeId(TypeId.Player) && IsInThreatList(ownerTarget))
{
if (!ownerTarget.HasBreakableByDamageCrowdControlAura(ownerTarget))
me.Attack(ownerTarget, false);
}
else
Init();
}
_events.ExecuteEvents(spellId =>
{
if (spellId == PetMageConst.SpellMageFrostBolt)
{
_events.ScheduleEvent(PetMageConst.SpellMageFrostBolt, PetMageConst.TimerMirrorImageFrostBolt);
DoCastVictim(spellId);
}
else if (spellId == PetMageConst.SpellMageFireBlast)
{
DoCastVictim(spellId);
_events.ScheduleEvent(PetMageConst.SpellMageFireBlast, PetMageConst.TimerMirrorImageFireBlast);
}
});
}
// Do not reload Creature templates on evade mode enter - prevent visual lost
public override void EnterEvadeMode(EvadeReason why)
{
if (me.IsInEvadeMode() || !me.IsAlive())
return;
Unit owner = me.GetCharmerOrOwner();
me.CombatStop(true);
if (owner && !me.HasUnitState(UnitState.Follow))
{
me.GetMotionMaster().Clear(false);
me.GetMotionMaster().MoveFollow(owner, SharedConst.PetFollowDist, me.GetFollowAngle(), MovementSlot.Active);
}
Init();
} }
return false;
} }
public override CreatureAI GetAI(Creature creature) public override void InitializeAI()
{ {
return new npc_pet_mage_mirror_imageAI(creature); base.InitializeAI();
Unit owner = me.GetOwner();
if (!owner)
return;
// here mirror image casts on summoner spell (not present in client dbc) 49866
// here should be auras (not present in client dbc): 35657, 35658, 35659, 35660 selfcasted by mirror images (stats related?)
// Clone Me!
owner.CastSpell(me, PetMageConst.SpellCloneMe, false);
}
public override void EnterCombat(Unit victim)
{
if (me.GetVictim() && !me.GetVictim().HasBreakableByDamageCrowdControlAura(me))
{
me.CastSpell(victim, PetMageConst.SpellMageFireBlast, false);
_events.ScheduleEvent(PetMageConst.SpellMageFrostBolt, PetMageConst.TimerMirrorImageInit);
_events.ScheduleEvent(PetMageConst.SpellMageFireBlast, PetMageConst.TimerMirrorImageFireBlast);
}
else
EnterEvadeMode(EvadeReason.Other);
}
public override void Reset()
{
_events.Reset();
}
public override void UpdateAI(uint diff)
{
Unit owner = me.GetCharmerOrOwner();
if (!owner)
return;
Unit target = owner.getAttackerForHelper();
_events.Update(diff);
// prevent CC interrupts by images
if (me.GetVictim() && me.GetVictim().HasBreakableByDamageCrowdControlAura(me))
{
me.InterruptNonMeleeSpells(false);
return;
}
if (me.HasUnitState(UnitState.Casting))
return;
// assign target if image doesnt have any or the target is not actual
if (!target || me.GetVictim() != target)
{
Unit ownerTarget = null;
Player owner1 = me.GetCharmerOrOwner().ToPlayer();
if (owner1)
ownerTarget = owner1.GetSelectedUnit();
// recognize which victim will be choosen
if (ownerTarget && ownerTarget.IsTypeId(TypeId.Player))
{
if (!ownerTarget.HasBreakableByDamageCrowdControlAura(ownerTarget))
me.Attack(ownerTarget, false);
}
else if (ownerTarget && !ownerTarget.IsTypeId(TypeId.Player) && IsInThreatList(ownerTarget))
{
if (!ownerTarget.HasBreakableByDamageCrowdControlAura(ownerTarget))
me.Attack(ownerTarget, false);
}
else
Init();
}
_events.ExecuteEvents(spellId =>
{
if (spellId == PetMageConst.SpellMageFrostBolt)
{
_events.ScheduleEvent(PetMageConst.SpellMageFrostBolt, PetMageConst.TimerMirrorImageFrostBolt);
DoCastVictim(spellId);
}
else if (spellId == PetMageConst.SpellMageFireBlast)
{
DoCastVictim(spellId);
_events.ScheduleEvent(PetMageConst.SpellMageFireBlast, PetMageConst.TimerMirrorImageFireBlast);
}
});
}
// Do not reload Creature templates on evade mode enter - prevent visual lost
public override void EnterEvadeMode(EvadeReason why)
{
if (me.IsInEvadeMode() || !me.IsAlive())
return;
Unit owner = me.GetCharmerOrOwner();
me.CombatStop(true);
if (owner && !me.HasUnitState(UnitState.Follow))
{
me.GetMotionMaster().Clear(false);
me.GetMotionMaster().MoveFollow(owner, SharedConst.PetFollowDist, me.GetFollowAngle(), MovementSlot.Active);
}
Init();
} }
} }
} }
+15 -36
View File
@@ -30,54 +30,33 @@ namespace Scripts.Pets.Priest
} }
[Script] [Script]
class npc_pet_pri_lightwell : CreatureScript class npc_pet_pri_lightwell : PassiveAI
{ {
public npc_pet_pri_lightwell() : base("npc_pet_pri_lightwell") { } public npc_pet_pri_lightwell(Creature creature) : base(creature)
class npc_pet_pri_lightwellAI : PassiveAI
{ {
public npc_pet_pri_lightwellAI(Creature creature) : base(creature) DoCast(creature, SpellIds.LightWellCharges, false);
{
DoCast(creature, SpellIds.LightWellCharges, false);
}
public override void EnterEvadeMode(EvadeReason why)
{
if (!me.IsAlive())
return;
me.DeleteThreatList();
me.CombatStop(true);
me.ResetPlayerDamageReq();
}
} }
public override CreatureAI GetAI(Creature creature) public override void EnterEvadeMode(EvadeReason why)
{ {
return new npc_pet_pri_lightwellAI(creature); if (!me.IsAlive())
return;
me.DeleteThreatList();
me.CombatStop(true);
me.ResetPlayerDamageReq();
} }
} }
[Script] [Script]
class npc_pet_pri_shadowfiend : CreatureScript class npc_pet_pri_shadowfiend : PetAI
{ {
public npc_pet_pri_shadowfiend() : base("npc_pet_pri_shadowfiend") { } public npc_pet_pri_shadowfiend(Creature creature) : base(creature) { }
class npc_pet_pri_shadowfiendAI : PetAI public override void IsSummonedBy(Unit summoner)
{ {
public npc_pet_pri_shadowfiendAI(Creature creature) : base(creature) { } if (summoner.HasAura(SpellIds.GlyphOfShadowFiend))
DoCastAOE(SpellIds.ShadowFiendDeath);
public override void IsSummonedBy(Unit summoner)
{
if (summoner.HasAura(SpellIds.GlyphOfShadowFiend))
DoCastAOE(SpellIds.ShadowFiendDeath);
}
}
public override CreatureAI GetAI(Creature creature)
{
return new npc_pet_pri_shadowfiendAI(creature);
} }
} }
} }
+67 -87
View File
@@ -23,111 +23,91 @@ using Game.Scripting;
namespace Scripts.Pets namespace Scripts.Pets
{ {
[Script] [Script]
class npc_pet_shaman_earth_elemental : CreatureScript class npc_pet_shaman_earth_elemental : ScriptedAI
{ {
public npc_pet_shaman_earth_elemental() : base("npc_pet_shaman_earth_elemental") { } public npc_pet_shaman_earth_elemental(Creature creature) : base(creature) { }
class npc_pet_shaman_earth_elementalAI : ScriptedAI public override void Reset()
{ {
public npc_pet_shaman_earth_elementalAI(Creature creature) : base(creature) { } _events.Reset();
_events.ScheduleEvent(EventAngeredEarth, 0);
public override void Reset() me.ApplySpellImmune(0, SpellImmunity.School, SpellSchoolMask.Nature, true);
{
_events.Reset();
_events.ScheduleEvent(EventAngeredEarth, 0);
me.ApplySpellImmune(0, SpellImmunity.School, SpellSchoolMask.Nature, true);
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_events.Update(diff);
if (_events.ExecuteEvent() == EventAngeredEarth)
{
DoCastVictim(SpellAngeredEarth);
_events.ScheduleEvent(EventAngeredEarth, RandomHelper.URand(5000, 20000));
}
DoMeleeAttackIfReady();
}
const int EventAngeredEarth = 1;
const uint SpellAngeredEarth = 36213;
} }
public override CreatureAI GetAI(Creature creature) public override void UpdateAI(uint diff)
{ {
return new npc_pet_shaman_earth_elementalAI(creature); if (!UpdateVictim())
return;
_events.Update(diff);
if (_events.ExecuteEvent() == EventAngeredEarth)
{
DoCastVictim(SpellAngeredEarth);
_events.ScheduleEvent(EventAngeredEarth, RandomHelper.URand(5000, 20000));
}
DoMeleeAttackIfReady();
} }
const int EventAngeredEarth = 1;
const uint SpellAngeredEarth = 36213;
} }
[Script] [Script]
class npc_pet_shaman_fire_elemental : CreatureScript public class npc_pet_shaman_fire_elemental : ScriptedAI
{ {
public npc_pet_shaman_fire_elemental() : base("npc_pet_shaman_fire_elemental") { } public npc_pet_shaman_fire_elemental(Creature creature) : base(creature) { }
public class npc_pet_shaman_fire_elementalAI : ScriptedAI public override void Reset()
{ {
public npc_pet_shaman_fire_elementalAI(Creature creature) : base(creature) { } _events.Reset();
_events.ScheduleEvent(EventFireNova, RandomHelper.URand(5000, 20000));
_events.ScheduleEvent(EventFireBlast, RandomHelper.URand(5000, 20000));
_events.ScheduleEvent(EventFireShield, 0);
me.ApplySpellImmune(0, SpellImmunity.School, SpellSchoolMask.Fire, true);
}
public override void Reset() public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
if (me.HasUnitState(UnitState.Casting))
return;
_events.Update(diff);
_events.ExecuteEvents(eventId =>
{ {
_events.Reset(); switch (eventId)
_events.ScheduleEvent(EventFireNova, RandomHelper.URand(5000, 20000));
_events.ScheduleEvent(EventFireBlast, RandomHelper.URand(5000, 20000));
_events.ScheduleEvent(EventFireShield, 0);
me.ApplySpellImmune(0, SpellImmunity.School, SpellSchoolMask.Fire, true);
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
if (me.HasUnitState(UnitState.Casting))
return;
_events.Update(diff);
_events.ExecuteEvents(eventId =>
{ {
switch (eventId) case EventFireNova:
{ DoCastVictim(SpellFireNova);
case EventFireNova: _events.ScheduleEvent(EventFireNova, RandomHelper.URand(5000, 20000));
DoCastVictim(SpellFireNova); break;
_events.ScheduleEvent(EventFireNova, RandomHelper.URand(5000, 20000)); case EventFireShield:
break; DoCastVictim(SpellFireShield);
case EventFireShield: _events.ScheduleEvent(EventFireShield, 2000);
DoCastVictim(SpellFireShield); break;
_events.ScheduleEvent(EventFireShield, 2000); case EventFireBlast:
break; DoCastVictim(SpellFireBlast);
case EventFireBlast: _events.ScheduleEvent(EventFireBlast, RandomHelper.URand(5000, 20000));
DoCastVictim(SpellFireBlast); break;
_events.ScheduleEvent(EventFireBlast, RandomHelper.URand(5000, 20000)); default:
break; break;
default: }
break; });
}
});
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
}
const int EventFireNova = 1;
const int EventFireShield = 2;
const int EventFireBlast = 3;
const uint SpellFireBlast = 57984;
const uint SpellFireNova = 12470;
const uint SpellFireShield = 13376;
} }
public override CreatureAI GetAI(Creature creature) const int EventFireNova = 1;
{ const int EventFireShield = 2;
return new npc_pet_shaman_fire_elementalAI(creature); const int EventFireBlast = 3;
}
const uint SpellFireBlast = 57984;
const uint SpellFireNova = 12470;
const uint SpellFireShield = 13376;
} }
} }
File diff suppressed because it is too large Load Diff
+546 -814
View File
File diff suppressed because it is too large Load Diff
+2160 -2997
View File
File diff suppressed because it is too large Load Diff
+391 -587
View File
File diff suppressed because it is too large Load Diff
+421 -703
View File
File diff suppressed because it is too large Load Diff
+1762 -2729
View File
File diff suppressed because it is too large Load Diff
+441 -686
View File
File diff suppressed because it is too large Load Diff
+73 -103
View File
@@ -37,133 +37,103 @@ namespace Scripts.Spells.Monk
} }
[Script] // 117952 - Crackling Jade Lightning [Script] // 117952 - Crackling Jade Lightning
class spell_monk_crackling_jade_lightning : SpellScriptLoader class spell_monk_crackling_jade_lightning : AuraScript
{ {
public spell_monk_crackling_jade_lightning() : base("spell_monk_crackling_jade_lightning") { } public override bool Validate(SpellInfo spellInfo)
class spell_monk_crackling_jade_lightning_AuraScript : AuraScript
{ {
public override bool Validate(SpellInfo spellInfo) return ValidateSpellInfo(SpellIds.CracklingJadeLightningChiProc);
{
return ValidateSpellInfo(SpellIds.CracklingJadeLightningChiProc);
}
void OnTick(AuraEffect aurEff)
{
Unit caster = GetCaster();
if (caster)
if (caster.HasAura(SpellIds.StanceOfTheSpiritedCrane))
caster.CastSpell(caster, SpellIds.CracklingJadeLightningChiProc, TriggerCastFlags.FullMask);
}
public override void Register()
{
OnEffectPeriodic.Add(new EffectPeriodicHandler(OnTick, 0, Framework.Constants.AuraType.PeriodicDamage));
}
} }
public override AuraScript GetAuraScript() void OnTick(AuraEffect aurEff)
{ {
return new spell_monk_crackling_jade_lightning_AuraScript(); Unit caster = GetCaster();
if (caster)
if (caster.HasAura(SpellIds.StanceOfTheSpiritedCrane))
caster.CastSpell(caster, SpellIds.CracklingJadeLightningChiProc, TriggerCastFlags.FullMask);
}
public override void Register()
{
OnEffectPeriodic.Add(new EffectPeriodicHandler(OnTick, 0, Framework.Constants.AuraType.PeriodicDamage));
} }
} }
[Script] // 117959 - Crackling Jade Lightning [Script] // 117959 - Crackling Jade Lightning
class spell_monk_crackling_jade_lightning_knockback_proc_aura : SpellScriptLoader class spell_monk_crackling_jade_lightning_aura : AuraScript
{ {
public spell_monk_crackling_jade_lightning_knockback_proc_aura() : base("spell_monk_crackling_jade_lightning_knockback_proc_aura") { } public override bool Validate(SpellInfo spellInfo)
class spell_monk_crackling_jade_lightning_aura_AuraScript : AuraScript
{ {
public override bool Validate(SpellInfo spellInfo) return ValidateSpellInfo(SpellIds.CracklingJadeLightningKnockback, SpellIds.CracklingJadeLightningKnockbackCd);
{
return ValidateSpellInfo(SpellIds.CracklingJadeLightningKnockback, SpellIds.CracklingJadeLightningKnockbackCd);
}
bool CheckProc(ProcEventInfo eventInfo)
{
if (GetTarget().HasAura(SpellIds.CracklingJadeLightningKnockbackCd))
return false;
if (eventInfo.GetActor().HasAura(SpellIds.CracklingJadeLightningChannel, GetTarget().GetGUID()))
return false;
Spell currentChanneledSpell = GetTarget().GetCurrentSpell(CurrentSpellTypes.Channeled);
if (!currentChanneledSpell || currentChanneledSpell.GetSpellInfo().Id != SpellIds.CracklingJadeLightningChannel)
return false;
return true;
}
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
{
GetTarget().CastSpell(eventInfo.GetActor(), SpellIds.CracklingJadeLightningKnockback, TriggerCastFlags.FullMask);
GetTarget().CastSpell(GetTarget(), SpellIds.CracklingJadeLightningKnockbackCd, TriggerCastFlags.FullMask);
}
public override void Register()
{
DoCheckProc.Add(new CheckProcHandler(CheckProc));
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, Framework.Constants.AuraType.Dummy));
}
} }
public override AuraScript GetAuraScript() bool CheckProc(ProcEventInfo eventInfo)
{ {
return new spell_monk_crackling_jade_lightning_aura_AuraScript(); if (GetTarget().HasAura(SpellIds.CracklingJadeLightningKnockbackCd))
return false;
if (eventInfo.GetActor().HasAura(SpellIds.CracklingJadeLightningChannel, GetTarget().GetGUID()))
return false;
Spell currentChanneledSpell = GetTarget().GetCurrentSpell(CurrentSpellTypes.Channeled);
if (!currentChanneledSpell || currentChanneledSpell.GetSpellInfo().Id != SpellIds.CracklingJadeLightningChannel)
return false;
return true;
}
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
{
GetTarget().CastSpell(eventInfo.GetActor(), SpellIds.CracklingJadeLightningKnockback, TriggerCastFlags.FullMask);
GetTarget().CastSpell(GetTarget(), SpellIds.CracklingJadeLightningKnockbackCd, TriggerCastFlags.FullMask);
}
public override void Register()
{
DoCheckProc.Add(new CheckProcHandler(CheckProc));
OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, Framework.Constants.AuraType.Dummy));
} }
} }
[Script] // 115546 - Provoke [Script] // 115546 - Provoke
class spell_monk_provoke : SpellScriptLoader class spell_monk_provoke : SpellScript
{ {
public spell_monk_provoke() : base("spell_monk_provoke") { } const uint BlackOxStatusEntry = 61146;
class spell_monk_provoke_SpellScript : SpellScript public override bool Validate(SpellInfo spellInfo)
{ {
const uint BlackOxStatusEntry = 61146; if (!spellInfo.GetExplicitTargetMask().HasAnyFlag(SpellCastTargetFlags.UnitMask)) // ensure GetExplTargetUnit() will return something meaningful during CheckCast
return false;
public override bool Validate(SpellInfo spellInfo) return ValidateSpellInfo(SpellIds.ProvokeSingleTarget, SpellIds.ProvokeAoe);
{
if (!spellInfo.GetExplicitTargetMask().HasAnyFlag(SpellCastTargetFlags.UnitMask)) // ensure GetExplTargetUnit() will return something meaningful during CheckCast
return false;
return ValidateSpellInfo(SpellIds.ProvokeSingleTarget, SpellIds.ProvokeAoe);
}
SpellCastResult CheckExplicitTarget()
{
if (GetExplTargetUnit().GetEntry() != BlackOxStatusEntry)
{
SpellInfo singleTarget = Global.SpellMgr.GetSpellInfo(SpellIds.ProvokeSingleTarget);
SpellCastResult singleTargetExplicitResult = singleTarget.CheckExplicitTarget(GetCaster(), GetExplTargetUnit());
if (singleTargetExplicitResult != SpellCastResult.SpellCastOk)
return singleTargetExplicitResult;
}
else if (GetExplTargetUnit().GetOwnerGUID() != GetCaster().GetGUID())
return SpellCastResult.BadTargets;
return SpellCastResult.SpellCastOk;
}
void HandleDummy(uint effIndex)
{
PreventHitDefaultEffect(effIndex);
if (GetHitUnit().GetEntry() != BlackOxStatusEntry)
GetCaster().CastSpell(GetHitUnit(), SpellIds.ProvokeSingleTarget, true);
else
GetCaster().CastSpell(GetHitUnit(), SpellIds.ProvokeAoe, true);
}
public override void Register()
{
OnCheckCast.Add(new CheckCastHandler(CheckExplicitTarget));
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
}
} }
public override SpellScript GetSpellScript() SpellCastResult CheckExplicitTarget()
{ {
return new spell_monk_provoke_SpellScript(); if (GetExplTargetUnit().GetEntry() != BlackOxStatusEntry)
{
SpellInfo singleTarget = Global.SpellMgr.GetSpellInfo(SpellIds.ProvokeSingleTarget);
SpellCastResult singleTargetExplicitResult = singleTarget.CheckExplicitTarget(GetCaster(), GetExplTargetUnit());
if (singleTargetExplicitResult != SpellCastResult.SpellCastOk)
return singleTargetExplicitResult;
}
else if (GetExplTargetUnit().GetOwnerGUID() != GetCaster().GetGUID())
return SpellCastResult.BadTargets;
return SpellCastResult.SpellCastOk;
}
void HandleDummy(uint effIndex)
{
PreventHitDefaultEffect(effIndex);
if (GetHitUnit().GetEntry() != BlackOxStatusEntry)
GetCaster().CastSpell(GetHitUnit(), SpellIds.ProvokeSingleTarget, true);
else
GetCaster().CastSpell(GetHitUnit(), SpellIds.ProvokeAoe, true);
}
public override void Register()
{
OnCheckCast.Add(new CheckCastHandler(CheckExplicitTarget));
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy));
} }
} }
} }
+530 -759
View File
File diff suppressed because it is too large Load Diff
+687 -997
View File
File diff suppressed because it is too large Load Diff
+804 -1418
View File
File diff suppressed because it is too large Load Diff
+85 -130
View File
@@ -43,175 +43,130 @@ namespace Scripts.Spells.Rogue
} }
[Script] // 51690 - Killing Spree [Script] // 51690 - Killing Spree
class spell_rog_killing_spree : SpellScriptLoader class spell_rog_killing_spree : SpellScript
{ {
public spell_rog_killing_spree() : base("spell_rog_killing_spree") { } void FilterTargets(List<WorldObject> targets)
class spell_rog_killing_spree_SpellScript : SpellScript
{ {
void FilterTargets(List<WorldObject> targets) if (targets.Empty() || GetCaster().GetVehicleBase())
{ FinishCast(SpellCastResult.OutOfRange);
if (targets.Empty() || GetCaster().GetVehicleBase()) }
FinishCast(SpellCastResult.OutOfRange);
}
void HandleDummy(uint effIndex) void HandleDummy(uint effIndex)
{
Aura aura = GetCaster().GetAura(SpellIds.KillingSpree);
if (aura != null)
{ {
Aura aura = GetCaster().GetAura(SpellIds.KillingSpree); var script = aura.GetScript<spell_rog_killing_spree_AuraScript>(nameof(spell_rog_killing_spree_AuraScript));
if (aura != null) if (script != null)
{ script.AddTarget(GetHitUnit());
var script = aura.GetScript<spell_rog_killing_spree_AuraScript>(nameof(spell_rog_killing_spree_AuraScript));
if (script != null)
script.AddTarget(GetHitUnit());
}
}
public override void Register()
{
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 1, Targets.UnitDestAreaEnemy));
OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 1, SpellEffectName.Dummy));
} }
} }
public override SpellScript GetSpellScript() public override void Register()
{ {
return new spell_rog_killing_spree_SpellScript(); OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 1, Targets.UnitDestAreaEnemy));
} OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 1, SpellEffectName.Dummy));
public class spell_rog_killing_spree_AuraScript : AuraScript
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.KillingSpreeTeleport, SpellIds.KillingSpreeWeaponDmg, SpellIds.KillingSpreeDmgBuff);
}
void HandleApply(AuraEffect aurEff, AuraEffectHandleModes mode)
{
GetTarget().CastSpell(GetTarget(), SpellIds.KillingSpreeDmgBuff, true);
}
void HandleEffectPeriodic(AuraEffect aurEff)
{
while (!_targets.Empty())
{
ObjectGuid guid = _targets.SelectRandom();
Unit target = Global.ObjAccessor.GetUnit(GetTarget(), guid);
if (target)
{
GetTarget().CastSpell(target, SpellIds.KillingSpreeTeleport, true);
GetTarget().CastSpell(target, SpellIds.KillingSpreeWeaponDmg, true);
break;
}
else
_targets.Remove(guid);
}
}
void HandleRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
{
GetTarget().RemoveAurasDueToSpell(SpellIds.KillingSpreeDmgBuff);
}
public override void Register()
{
AfterEffectApply.Add(new EffectApplyHandler(HandleApply, 0, AuraType.Dummy, AuraEffectHandleModes.Real));
OnEffectPeriodic.Add(new EffectPeriodicHandler(HandleEffectPeriodic, 0, AuraType.PeriodicDummy));
AfterEffectRemove.Add(new EffectApplyHandler(HandleRemove, 0, AuraType.PeriodicDummy, AuraEffectHandleModes.Real));
}
public void AddTarget(Unit target)
{
_targets.Add(target.GetGUID());
}
List<ObjectGuid> _targets = new List<ObjectGuid>();
}
public override AuraScript GetAuraScript()
{
return new spell_rog_killing_spree_AuraScript();
} }
} }
[Script] // 70805 - Rogue T10 2P Bonus -- THIS SHOULD BE REMOVED WITH NEW PROC SYSTEM. public class spell_rog_killing_spree_AuraScript : AuraScript
class spell_rog_t10_2p_bonus : SpellScriptLoader
{ {
public spell_rog_t10_2p_bonus() : base("spell_rog_t10_2p_bonus") { } public override bool Validate(SpellInfo spellInfo)
class spell_rog_t10_2p_bonus_AuraScript : AuraScript
{ {
bool CheckProc(ProcEventInfo eventInfo) return ValidateSpellInfo(SpellIds.KillingSpreeTeleport, SpellIds.KillingSpreeWeaponDmg, SpellIds.KillingSpreeDmgBuff);
{ }
return eventInfo.GetActor() == eventInfo.GetActionTarget();
}
public override void Register() void HandleApply(AuraEffect aurEff, AuraEffectHandleModes mode)
{
GetTarget().CastSpell(GetTarget(), SpellIds.KillingSpreeDmgBuff, true);
}
void HandleEffectPeriodic(AuraEffect aurEff)
{
while (!_targets.Empty())
{ {
DoCheckProc.Add(new CheckProcHandler(CheckProc)); ObjectGuid guid = _targets.SelectRandom();
Unit target = Global.ObjAccessor.GetUnit(GetTarget(), guid);
if (target)
{
GetTarget().CastSpell(target, SpellIds.KillingSpreeTeleport, true);
GetTarget().CastSpell(target, SpellIds.KillingSpreeWeaponDmg, true);
break;
}
else
_targets.Remove(guid);
} }
} }
public override AuraScript GetAuraScript() void HandleRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
{ {
return new spell_rog_t10_2p_bonus_AuraScript(); GetTarget().RemoveAurasDueToSpell(SpellIds.KillingSpreeDmgBuff);
}
public override void Register()
{
AfterEffectApply.Add(new EffectApplyHandler(HandleApply, 0, AuraType.Dummy, AuraEffectHandleModes.Real));
OnEffectPeriodic.Add(new EffectPeriodicHandler(HandleEffectPeriodic, 0, AuraType.PeriodicDummy));
AfterEffectRemove.Add(new EffectApplyHandler(HandleRemove, 0, AuraType.PeriodicDummy, AuraEffectHandleModes.Real));
}
public void AddTarget(Unit target)
{
_targets.Add(target.GetGUID());
}
List<ObjectGuid> _targets = new List<ObjectGuid>();
}
[Script] // 70805 - Rogue T10 2P Bonus -- THIS SHOULD BE REMOVED WITH NEW PROC SYSTEM.
class spell_rog_t10_2p_bonus : AuraScript
{
bool CheckProc(ProcEventInfo eventInfo)
{
return eventInfo.GetActor() == eventInfo.GetActionTarget();
}
public override void Register()
{
DoCheckProc.Add(new CheckProcHandler(CheckProc));
} }
} }
[Script] // 2098 - Eviscerate [Script] // 2098 - Eviscerate
class spell_rog_eviscerate : SpellScriptLoader class spell_rog_eviscerate : SpellScript
{ {
public spell_rog_eviscerate() : base("spell_rog_eviscerate") { } void CalculateDamage(uint effIndex)
class spell_rog_eviscerate_SpellScript : SpellScript
{ {
void CalculateDamage(uint effIndex) int damagePerCombo = (int)(GetCaster().GetTotalAttackPowerValue(WeaponAttackType.BaseAttack) * 0.559f);
{ AuraEffect t5 = GetCaster().GetAuraEffect(SpellIds.T52pSetBonus, 0);
int damagePerCombo = (int)(GetCaster().GetTotalAttackPowerValue(WeaponAttackType.BaseAttack) * 0.559f); if (t5 != null)
AuraEffect t5 = GetCaster().GetAuraEffect(SpellIds.T52pSetBonus, 0); damagePerCombo += t5.GetAmount();
if (t5 != null)
damagePerCombo += t5.GetAmount();
SetEffectValue(GetEffectValue() + damagePerCombo * GetCaster().GetPower(PowerType.ComboPoints)); SetEffectValue(GetEffectValue() + damagePerCombo * GetCaster().GetPower(PowerType.ComboPoints));
}
public override void Register()
{
OnEffectLaunchTarget.Add(new EffectHandler(CalculateDamage, 0, SpellEffectName.SchoolDamage));
}
} }
public override SpellScript GetSpellScript() public override void Register()
{ {
return new spell_rog_eviscerate_SpellScript(); OnEffectLaunchTarget.Add(new EffectHandler(CalculateDamage, 0, SpellEffectName.SchoolDamage));
} }
} }
[Script] // 32645 - Envenom [Script] // 32645 - Envenom
class spell_rog_envenom : SpellScriptLoader class spell_rog_envenom : SpellScript
{ {
public spell_rog_envenom() : base("spell_rog_envenom") { } void CalculateDamage(uint effIndex)
class spell_rog_envenom_SpellScript : SpellScript
{ {
void CalculateDamage(uint effIndex) int damagePerCombo = (int)(GetCaster().GetTotalAttackPowerValue(WeaponAttackType.BaseAttack) * 0.417f);
{ AuraEffect t5 = GetCaster().GetAuraEffect(SpellIds.T52pSetBonus, 0);
int damagePerCombo = (int)(GetCaster().GetTotalAttackPowerValue(WeaponAttackType.BaseAttack) * 0.417f); if (t5 != null)
AuraEffect t5 = GetCaster().GetAuraEffect(SpellIds.T52pSetBonus, 0); damagePerCombo += t5.GetAmount();
if (t5 != null)
damagePerCombo += t5.GetAmount();
SetEffectValue(GetEffectValue() + damagePerCombo * GetCaster().GetPower(PowerType.ComboPoints)); SetEffectValue(GetEffectValue() + damagePerCombo * GetCaster().GetPower(PowerType.ComboPoints));
}
public override void Register()
{
OnEffectLaunchTarget.Add(new EffectHandler(CalculateDamage, 0, SpellEffectName.SchoolDamage));
}
} }
public override SpellScript GetSpellScript() public override void Register()
{ {
return new spell_rog_envenom_SpellScript(); OnEffectLaunchTarget.Add(new EffectHandler(CalculateDamage, 0, SpellEffectName.SchoolDamage));
} }
} }
} }
+530 -820
View File
File diff suppressed because it is too large Load Diff
+584 -908
View File
File diff suppressed because it is too large Load Diff
+510 -840
View File
File diff suppressed because it is too large Load Diff
+82 -122
View File
@@ -155,63 +155,53 @@ namespace Scripts.World.BossEmeraldDragons
} }
[Script] [Script]
class npc_dream_fog : CreatureScript class npc_dream_fog : ScriptedAI
{ {
public npc_dream_fog() : base("npc_dream_fog") { } public npc_dream_fog(Creature creature) : base(creature)
class npc_dream_fogAI : ScriptedAI
{ {
public npc_dream_fogAI(Creature creature) : base(creature) Initialize();
{ }
Initialize();
}
void Initialize() void Initialize()
{ {
_roamTimer = 0; _roamTimer = 0;
} }
public override void Reset() public override void Reset()
{ {
Initialize(); Initialize();
} }
public override void UpdateAI(uint diff) public override void UpdateAI(uint diff)
{ {
if (!UpdateVictim()) if (!UpdateVictim())
return; return;
if (_roamTimer == 0) if (_roamTimer == 0)
{
// Chase target, but don't attack - otherwise just roam around
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true);
if (target)
{ {
// Chase target, but don't attack - otherwise just roam around _roamTimer = RandomHelper.URand(15000, 30000);
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true); me.GetMotionMaster().Clear(false);
if (target) me.GetMotionMaster().MoveChase(target, 0.2f);
{
_roamTimer = RandomHelper.URand(15000, 30000);
me.GetMotionMaster().Clear(false);
me.GetMotionMaster().MoveChase(target, 0.2f);
}
else
{
_roamTimer = 2500;
me.GetMotionMaster().Clear(false);
me.GetMotionMaster().MoveRandom(25.0f);
}
// Seeping fog movement is slow enough for a player to be able to walk backwards and still outpace it
me.SetWalk(true);
me.SetSpeedRate(UnitMoveType.Walk, 0.75f);
} }
else else
_roamTimer -= diff; {
_roamTimer = 2500;
me.GetMotionMaster().Clear(false);
me.GetMotionMaster().MoveRandom(25.0f);
}
// Seeping fog movement is slow enough for a player to be able to walk backwards and still outpace it
me.SetWalk(true);
me.SetSpeedRate(UnitMoveType.Walk, 0.75f);
} }
else
uint _roamTimer; _roamTimer -= diff;
} }
public override CreatureAI GetAI(Creature creature) uint _roamTimer;
{
return new npc_dream_fogAI(creature);
}
} }
[Script] [Script]
@@ -334,36 +324,26 @@ namespace Scripts.World.BossEmeraldDragons
} }
[Script] [Script]
class npc_spirit_shade : CreatureScript class npc_spirit_shade : PassiveAI
{ {
public npc_spirit_shade() : base("npc_spirit_shade") { } public npc_spirit_shade(Creature creature) : base(creature) { }
class npc_spirit_shadeAI : PassiveAI public override void IsSummonedBy(Unit summoner)
{ {
public npc_spirit_shadeAI(Creature creature) : base(creature) { } _summonerGuid = summoner.GetGUID();
me.GetMotionMaster().MoveFollow(summoner, 0.0f, 0.0f);
public override void IsSummonedBy(Unit summoner)
{
_summonerGuid = summoner.GetGUID();
me.GetMotionMaster().MoveFollow(summoner, 0.0f, 0.0f);
}
public override void MovementInform(MovementGeneratorType moveType, uint data)
{
if (moveType == MovementGeneratorType.Follow && data == _summonerGuid.GetCounter())
{
me.CastSpell((Unit)null, Spells.DarkOffering, false);
me.DespawnOrUnsummon(1000);
}
}
ObjectGuid _summonerGuid;
} }
public override CreatureAI GetAI(Creature creature) public override void MovementInform(MovementGeneratorType moveType, uint data)
{ {
return new npc_spirit_shadeAI(creature); if (moveType == MovementGeneratorType.Follow && data == _summonerGuid.GetCounter())
{
me.CastSpell((Unit)null, Spells.DarkOffering, false);
me.DespawnOrUnsummon(1000);
}
} }
ObjectGuid _summonerGuid;
} }
[Script] [Script]
@@ -547,75 +527,55 @@ namespace Scripts.World.BossEmeraldDragons
} }
[Script] [Script]
class spell_dream_fog_sleep : SpellScriptLoader class spell_dream_fog_sleep : SpellScript
{ {
public spell_dream_fog_sleep() : base("spell_dream_fog_sleep") { } void FilterTargets(List<WorldObject> targets)
class spell_dream_fog_sleep_SpellScript : SpellScript
{ {
void FilterTargets(List<WorldObject> targets) targets.RemoveAll(obj =>
{ {
targets.RemoveAll(obj => Unit unit = obj.ToUnit();
{ if (unit)
Unit unit = obj.ToUnit(); return unit.HasAura(Spells.Sleep);
if (unit) return true;
return unit.HasAura(Spells.Sleep); });
return true;
});
}
public override void Register()
{
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitDestAreaEnemy));
}
} }
public override SpellScript GetSpellScript() public override void Register()
{ {
return new spell_dream_fog_sleep_SpellScript(); OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitDestAreaEnemy));
} }
} }
[Script] [Script]
class spell_mark_of_nature : SpellScriptLoader class spell_mark_of_nature : SpellScript
{ {
public spell_mark_of_nature() : base("spell_mark_of_nature") { } public override bool Validate(SpellInfo spellInfo)
class spell_mark_of_nature_SpellScript : SpellScript
{ {
public override bool Validate(SpellInfo spellInfo) return ValidateSpellInfo(Spells.MarkOfNature, Spells.AuraOfNature);
{
return ValidateSpellInfo(Spells.MarkOfNature, Spells.AuraOfNature);
}
void FilterTargets(List<WorldObject> targets)
{
targets.RemoveAll(obj =>
{
// return those not tagged or already under the influence of Aura of Nature
Unit unit = obj.ToUnit();
if (unit)
return !(unit.HasAura(Spells.MarkOfNature) && !unit.HasAura(Spells.AuraOfNature));
return true;
});
}
void HandleEffect(uint effIndex)
{
PreventHitDefaultEffect(effIndex);
GetHitUnit().CastSpell(GetHitUnit(), Spells.AuraOfNature, true);
}
public override void Register()
{
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitSrcAreaEnemy));
OnEffectHitTarget.Add(new EffectHandler(HandleEffect, 0, SpellEffectName.ApplyAura));
}
} }
public override SpellScript GetSpellScript() void FilterTargets(List<WorldObject> targets)
{ {
return new spell_mark_of_nature_SpellScript(); targets.RemoveAll(obj =>
{
// return those not tagged or already under the influence of Aura of Nature
Unit unit = obj.ToUnit();
if (unit)
return !(unit.HasAura(Spells.MarkOfNature) && !unit.HasAura(Spells.AuraOfNature));
return true;
});
}
void HandleEffect(uint effIndex)
{
PreventHitDefaultEffect(effIndex);
GetHitUnit().CastSpell(GetHitUnit(), Spells.AuraOfNature, true);
}
public override void Register()
{
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitSrcAreaEnemy));
OnEffectHitTarget.Add(new EffectHandler(HandleEffect, 0, SpellEffectName.ApplyAura));
} }
} }
} }
+1 -6
View File
@@ -313,7 +313,7 @@ namespace Scripts.World
{ {
FactionTemplateRecord pFaction = creature.GetFactionTemplateEntry(); FactionTemplateRecord pFaction = creature.GetFactionTemplateEntry();
if (pFaction != null) if (pFaction != null)
{ {
uint Spell = 0; uint Spell = 0;
switch (pFaction.Faction) switch (pFaction.Faction)
@@ -737,11 +737,6 @@ namespace Scripts.World
return false; return false;
} }
} }
public override GameObjectAI GetAI(GameObject go)
{
return new go_soulwellAI(go);
}
} }
[Script] //go_dragonflayer_cage [Script] //go_dragonflayer_cage
+241 -271
View File
@@ -47,336 +47,306 @@ namespace Scripts.World
} }
[Script] [Script]
class guard_generic : CreatureScript class guard_generic : GuardAI
{ {
public guard_generic() : base("guard_generic") { } public guard_generic(Creature creature) : base(creature) { }
class guard_genericAI : GuardAI public override void Reset()
{ {
public guard_genericAI(Creature creature) : base(creature) { } globalCooldown = 0;
buffTimer = 0;
}
public override void Reset() public override void EnterCombat(Unit who)
{ {
if (me.GetEntry() == CreatureIds.CenarionHoldIndantry)
Talk(GuardsConst.SaySilAggro, who);
SpellInfo spell = me.reachWithSpellAttack(who);
if (spell != null)
DoCast(who, spell.Id);
}
public override void UpdateAI(uint diff)
{
//Always decrease our global cooldown first
if (globalCooldown > diff)
globalCooldown -= diff;
else
globalCooldown = 0; globalCooldown = 0;
buffTimer = 0;
}
public override void EnterCombat(Unit who) //Buff timer (only buff when we are alive and not in combat
if (me.IsAlive() && !me.IsInCombat())
{ {
if (me.GetEntry() == CreatureIds.CenarionHoldIndantry) if (buffTimer <= diff)
Talk(GuardsConst.SaySilAggro, who);
SpellInfo spell = me.reachWithSpellAttack(who);
if (spell != null)
DoCast(who, spell.Id);
}
public override void UpdateAI(uint diff)
{
//Always decrease our global cooldown first
if (globalCooldown > diff)
globalCooldown -= diff;
else
globalCooldown = 0;
//Buff timer (only buff when we are alive and not in combat
if (me.IsAlive() && !me.IsInCombat())
{ {
if (buffTimer <= diff) //Find a spell that targets friendly and applies an aura (these are generally buffs)
{ SpellInfo info = SelectSpell(me, 0, 0, SelectTargetType.AnyFriend, 0, 0, SelectEffect.Aura);
//Find a spell that targets friendly and applies an aura (these are generally buffs)
SpellInfo info = SelectSpell(me, 0, 0, SelectTargetType.AnyFriend, 0, 0, SelectEffect.Aura);
if (info != null && globalCooldown == 0) if (info != null && globalCooldown == 0)
{ {
//Cast the buff spell //Cast the buff spell
DoCast(me, info.Id);
//Set our global cooldown
globalCooldown = GuardsConst.CreatureCooldown;
//Set our timer to 10 minutes before rebuff
buffTimer = 600000;
} //Try again in 30 seconds
else buffTimer = 30000;
}
else buffTimer -= diff;
}
//Return since we have no target
if (!UpdateVictim())
return;
// Make sure our attack is ready and we arn't currently casting
if (me.isAttackReady() && !me.IsNonMeleeSpellCast(false))
{
//If we are within range melee the target
if (me.IsWithinMeleeRange(me.GetVictim()))
{
bool healing = false;
SpellInfo info = null;
//Select a healing spell if less than 30% hp
if (me.HealthBelowPct(30))
info = SelectSpell(me, 0, 0, SelectTargetType.AnyFriend, 0, 0, SelectEffect.Healing);
//No healing spell available, select a hostile spell
if (info != null)
healing = true;
else
info = SelectSpell(me.GetVictim(), 0, 0, SelectTargetType.AnyEnemy, 0, 0, SelectEffect.DontCare);
//20% chance to replace our white hit with a spell
if (info != null && RandomHelper.IRand(0, 99) < 20 && globalCooldown == 0)
{
//Cast the spell
if (healing)
DoCast(me, info.Id); DoCast(me, info.Id);
else
DoCastVictim(info.Id);
//Set our global cooldown //Set our global cooldown
globalCooldown = GuardsConst.CreatureCooldown; globalCooldown = GuardsConst.CreatureCooldown;
//Set our timer to 10 minutes before rebuff
buffTimer = 600000;
} //Try again in 30 seconds
else buffTimer = 30000;
} }
else buffTimer -= diff; else
me.AttackerStateUpdate(me.GetVictim());
me.resetAttackTimer();
} }
}
//Return since we have no target else
if (!UpdateVictim()) {
return; //Only run this code if we arn't already casting
if (!me.IsNonMeleeSpellCast(false))
// Make sure our attack is ready and we arn't currently casting
if (me.isAttackReady() && !me.IsNonMeleeSpellCast(false))
{ {
//If we are within range melee the target bool healing = false;
if (me.IsWithinMeleeRange(me.GetVictim())) SpellInfo info = null;
//Select a healing spell if less than 30% hp ONLY 33% of the time
if (me.HealthBelowPct(30) && 33 > RandomHelper.IRand(0, 99))
info = SelectSpell(me, 0, 0, SelectTargetType.AnyFriend, 0, 0, SelectEffect.Healing);
//No healing spell available, See if we can cast a ranged spell (Range must be greater than ATTACK_DISTANCE)
if (info != null)
healing = true;
else
info = SelectSpell(me.GetVictim(), 0, 0, SelectTargetType.AnyEnemy, SharedConst.NominalMeleeRange, 0, SelectEffect.DontCare);
//Found a spell, check if we arn't on cooldown
if (info != null && globalCooldown == 0)
{ {
bool healing = false; //If we are currently moving stop us and set the movement generator
SpellInfo info = null; if (me.GetMotionMaster().GetCurrentMovementGeneratorType() != MovementGeneratorType.Idle)
//Select a healing spell if less than 30% hp
if (me.HealthBelowPct(30))
info = SelectSpell(me, 0, 0, SelectTargetType.AnyFriend, 0, 0, SelectEffect.Healing);
//No healing spell available, select a hostile spell
if (info != null)
healing = true;
else
info = SelectSpell(me.GetVictim(), 0, 0, SelectTargetType.AnyEnemy, 0, 0, SelectEffect.DontCare);
//20% chance to replace our white hit with a spell
if (info != null && RandomHelper.IRand(0, 99) < 20 && globalCooldown == 0)
{ {
//Cast the spell
if (healing)
DoCast(me, info.Id);
else
DoCastVictim(info.Id);
//Set our global cooldown
globalCooldown = GuardsConst.CreatureCooldown;
}
else
me.AttackerStateUpdate(me.GetVictim());
me.resetAttackTimer();
}
}
else
{
//Only run this code if we arn't already casting
if (!me.IsNonMeleeSpellCast(false))
{
bool healing = false;
SpellInfo info = null;
//Select a healing spell if less than 30% hp ONLY 33% of the time
if (me.HealthBelowPct(30) && 33 > RandomHelper.IRand(0, 99))
info = SelectSpell(me, 0, 0, SelectTargetType.AnyFriend, 0, 0, SelectEffect.Healing);
//No healing spell available, See if we can cast a ranged spell (Range must be greater than ATTACK_DISTANCE)
if (info != null)
healing = true;
else
info = SelectSpell(me.GetVictim(), 0, 0, SelectTargetType.AnyEnemy, SharedConst.NominalMeleeRange, 0, SelectEffect.DontCare);
//Found a spell, check if we arn't on cooldown
if (info != null && globalCooldown == 0)
{
//If we are currently moving stop us and set the movement generator
if (me.GetMotionMaster().GetCurrentMovementGeneratorType() != MovementGeneratorType.Idle)
{
me.GetMotionMaster().Clear(false);
me.GetMotionMaster().MoveIdle();
}
//Cast spell
if (healing)
DoCast(me, info.Id);
else
DoCastVictim(info.Id);
//Set our global cooldown
globalCooldown = GuardsConst.CreatureCooldown;
} //If no spells available and we arn't moving run to target
else if (me.GetMotionMaster().GetCurrentMovementGeneratorType() != MovementGeneratorType.Chase)
{
//Cancel our current spell and then mutate new movement generator
me.InterruptNonMeleeSpells(false);
me.GetMotionMaster().Clear(false); me.GetMotionMaster().Clear(false);
me.GetMotionMaster().MoveChase(me.GetVictim()); me.GetMotionMaster().MoveIdle();
} }
//Cast spell
if (healing)
DoCast(me, info.Id);
else
DoCastVictim(info.Id);
//Set our global cooldown
globalCooldown = GuardsConst.CreatureCooldown;
} //If no spells available and we arn't moving run to target
else if (me.GetMotionMaster().GetCurrentMovementGeneratorType() != MovementGeneratorType.Chase)
{
//Cancel our current spell and then mutate new movement generator
me.InterruptNonMeleeSpells(false);
me.GetMotionMaster().Clear(false);
me.GetMotionMaster().MoveChase(me.GetVictim());
} }
} }
DoMeleeAttackIfReady();
} }
public void DoReplyToTextEmote(TextEmotes emote) DoMeleeAttackIfReady();
{
switch (emote)
{
case TextEmotes.Kiss:
me.HandleEmoteCommand(Emote.OneshotBow);
break;
case TextEmotes.Wave:
me.HandleEmoteCommand(Emote.OneshotWave);
break;
case TextEmotes.Salute:
me.HandleEmoteCommand(Emote.OneshotSalute);
break;
case TextEmotes.Shy:
me.HandleEmoteCommand(Emote.OneshotFlex);
break;
case TextEmotes.Rude:
case TextEmotes.Chicken:
me.HandleEmoteCommand(Emote.OneshotPoint);
break;
}
}
public override void ReceiveEmote(Player player, TextEmotes textEmote)
{
switch (me.GetEntry())
{
case CreatureIds.StormwindCityGuard:
case CreatureIds.StormwindCityPatroller:
case CreatureIds.OrgimmarGrunt:
break;
default:
return;
}
if (!me.IsFriendlyTo(player))
return;
DoReplyToTextEmote(textEmote);
}
uint globalCooldown;
uint buffTimer;
} }
public override CreatureAI GetAI(Creature creature) public void DoReplyToTextEmote(TextEmotes emote)
{ {
return new guard_genericAI(creature); switch (emote)
{
case TextEmotes.Kiss:
me.HandleEmoteCommand(Emote.OneshotBow);
break;
case TextEmotes.Wave:
me.HandleEmoteCommand(Emote.OneshotWave);
break;
case TextEmotes.Salute:
me.HandleEmoteCommand(Emote.OneshotSalute);
break;
case TextEmotes.Shy:
me.HandleEmoteCommand(Emote.OneshotFlex);
break;
case TextEmotes.Rude:
case TextEmotes.Chicken:
me.HandleEmoteCommand(Emote.OneshotPoint);
break;
}
} }
public override void ReceiveEmote(Player player, TextEmotes textEmote)
{
switch (me.GetEntry())
{
case CreatureIds.StormwindCityGuard:
case CreatureIds.StormwindCityPatroller:
case CreatureIds.OrgimmarGrunt:
break;
default:
return;
}
if (!me.IsFriendlyTo(player))
return;
DoReplyToTextEmote(textEmote);
}
uint globalCooldown;
uint buffTimer;
} }
[Script] [Script]
class guard_shattrath_scryer : CreatureScript class guard_shattrath_scryer : GuardAI
{ {
public guard_shattrath_scryer() : base("guard_shattrath_scryer") { } public guard_shattrath_scryer(Creature creature) : base(creature) { }
class guard_shattrath_scryerAI : GuardAI public override void Reset()
{ {
public guard_shattrath_scryerAI(Creature creature) : base(creature) { } playerGUID.Clear();
canTeleport = false;
public override void Reset() _scheduler.Schedule(TimeSpan.FromSeconds(5), task =>
{ {
playerGUID.Clear(); Unit temp = me.GetVictim();
canTeleport = false; if (temp && temp.IsTypeId(TypeId.Player))
_scheduler.Schedule(TimeSpan.FromSeconds(5), task =>
{ {
Unit temp = me.GetVictim(); DoCast(temp, Spells.BanishedA);
if (temp && temp.IsTypeId(TypeId.Player)) playerGUID = temp.GetGUID();
{ if (!playerGUID.IsEmpty())
DoCast(temp, Spells.BanishedA); canTeleport = true;
playerGUID = temp.GetGUID();
if (!playerGUID.IsEmpty())
canTeleport = true;
task.Repeat(TimeSpan.FromSeconds(9)); task.Repeat(TimeSpan.FromSeconds(9));
} }
}); });
_scheduler.Schedule(TimeSpan.FromSeconds(8.5), task => _scheduler.Schedule(TimeSpan.FromSeconds(8.5), task =>
{
if (canTeleport)
{
Unit temp = Global.ObjAccessor.GetUnit(me, playerGUID);
if (temp)
{
temp.CastSpell(temp, Spells.Exile, true);
temp.CastSpell(temp, Spells.BanishTeleport, true);
}
playerGUID.Clear();
canTeleport = false;
task.Repeat();
}
});
}
public override void UpdateAI(uint diff)
{ {
if (!UpdateVictim()) if (canTeleport)
return; {
Unit temp = Global.ObjAccessor.GetUnit(me, playerGUID);
if (temp)
{
temp.CastSpell(temp, Spells.Exile, true);
temp.CastSpell(temp, Spells.BanishTeleport, true);
}
playerGUID.Clear();
canTeleport = false;
_scheduler.Update(diff); task.Repeat();
}
DoMeleeAttackIfReady(); });
}
ObjectGuid playerGUID;
bool canTeleport;
} }
public override CreatureAI GetAI(Creature creature) public override void UpdateAI(uint diff)
{ {
return new guard_shattrath_scryerAI(creature); if (!UpdateVictim())
return;
_scheduler.Update(diff);
DoMeleeAttackIfReady();
} }
ObjectGuid playerGUID;
bool canTeleport;
} }
[Script] [Script]
class guard_shattrath_aldor : CreatureScript class guard_shattrath_aldor : GuardAI
{ {
public guard_shattrath_aldor() : base("guard_shattrath_aldor") { } public guard_shattrath_aldor(Creature creature) : base(creature) { }
class guard_shattrath_aldorAI : GuardAI public override void Reset()
{ {
public guard_shattrath_aldorAI(Creature creature) : base(creature) { } playerGUID.Clear();
canTeleport = false;
public override void Reset() _scheduler.Schedule(TimeSpan.FromSeconds(5), task =>
{ {
playerGUID.Clear(); Unit temp = me.GetVictim();
canTeleport = false; if (temp && temp.IsTypeId(TypeId.Player))
_scheduler.Schedule(TimeSpan.FromSeconds(5), task =>
{ {
Unit temp = me.GetVictim(); DoCast(temp, Spells.BanishedA);
if (temp && temp.IsTypeId(TypeId.Player)) playerGUID = temp.GetGUID();
{ if (!playerGUID.IsEmpty())
DoCast(temp, Spells.BanishedA); canTeleport = true;
playerGUID = temp.GetGUID();
if (!playerGUID.IsEmpty())
canTeleport = true;
task.Repeat(TimeSpan.FromSeconds(9)); task.Repeat(TimeSpan.FromSeconds(9));
} }
}); });
_scheduler.Schedule(TimeSpan.FromSeconds(8.5), task => _scheduler.Schedule(TimeSpan.FromSeconds(8.5), task =>
{
if (canTeleport)
{
Unit temp = Global.ObjAccessor.GetUnit(me, playerGUID);
if (temp)
{
temp.CastSpell(temp, Spells.Exile, true);
temp.CastSpell(temp, Spells.BanishTeleport, true);
}
playerGUID.Clear();
canTeleport = false;
task.Repeat();
}
});
}
public override void UpdateAI(uint diff)
{ {
if (!UpdateVictim()) if (canTeleport)
return; {
Unit temp = Global.ObjAccessor.GetUnit(me, playerGUID);
if (temp)
{
temp.CastSpell(temp, Spells.Exile, true);
temp.CastSpell(temp, Spells.BanishTeleport, true);
}
playerGUID.Clear();
canTeleport = false;
_scheduler.Update(diff); task.Repeat();
}
DoMeleeAttackIfReady(); });
}
ObjectGuid playerGUID;
bool canTeleport;
} }
public override CreatureAI GetAI(Creature creature) public override void UpdateAI(uint diff)
{ {
return new guard_shattrath_aldorAI(creature); if (!UpdateVictim())
return;
_scheduler.Update(diff);
DoMeleeAttackIfReady();
} }
ObjectGuid playerGUID;
bool canTeleport;
} }
} }
+4 -2
View File
@@ -331,9 +331,11 @@ namespace Scripts.World
{ {
pLeviroth.GetAI().AttackStart(player); pLeviroth.GetAI().AttackStart(player);
return false; return false;
} else }
else
player.SendEquipError(InventoryResult.OutOfRange, item, null); player.SendEquipError(InventoryResult.OutOfRange, item, null);
} else }
else
player.SendEquipError(InventoryResult.ClientLockedOut, item, null); player.SendEquipError(InventoryResult.ClientLockedOut, item, null);
return true; return true;
} }
+12 -16
View File
@@ -23,25 +23,21 @@ using System;
namespace Scripts.World namespace Scripts.World
{ {
[Script] [Script]
class trigger_periodic : CreatureScript class trigger_periodic : NullCreatureAI
{
public trigger_periodic() : base("trigger_periodic") { }
class trigger_periodicAI : NullCreatureAI
{ {
public trigger_periodicAI(Creature creature) : base(creature) public trigger_periodic(Creature creature) : base(creature)
{
var interval = me.GetBaseAttackTime(Framework.Constants.WeaponAttackType.BaseAttack);
_scheduler.Schedule(TimeSpan.FromMilliseconds(interval), task =>
{ {
var interval = me.GetBaseAttackTime(Framework.Constants.WeaponAttackType.BaseAttack); me.CastSpell(me, me.m_spells[0], true);
_scheduler.Schedule(TimeSpan.FromMilliseconds(interval), task => task.Repeat(TimeSpan.FromMilliseconds(interval));
{ });
me.CastSpell(me, me.m_spells[0], true); }
task.Repeat(TimeSpan.FromMilliseconds(interval));
});
}
public override void UpdateAI(uint diff) public override void UpdateAI(uint diff)
{ {
_scheduler.Update(); _scheduler.Update();
} }
} }
+61 -71
View File
@@ -53,87 +53,77 @@ namespace Scripts.World
} }
[Script] //start menu multi profession trainer [Script] //start menu multi profession trainer
class npc_multi_profession_trainer : CreatureScript class npc_multi_profession_trainer : ScriptedAI
{ {
public npc_multi_profession_trainer() : base("npc_multi_profession_trainer") { } public npc_multi_profession_trainer(Creature creature) : base(creature) { }
class npc_multi_profession_trainerAI : ScriptedAI public override void sGossipSelect(Player player, uint menuId, uint gossipListId)
{ {
public npc_multi_profession_trainerAI(Creature creature) : base(creature) { } switch ((GossipOptionIds)gossipListId)
public override void sGossipSelect(Player player, uint menuId, uint gossipListId)
{ {
switch ((GossipOptionIds)gossipListId) case GossipOptionIds.Alchemy:
{ case GossipOptionIds.Blacksmithing:
case GossipOptionIds.Alchemy: case GossipOptionIds.Enchanting:
case GossipOptionIds.Blacksmithing: case GossipOptionIds.Engineering:
case GossipOptionIds.Enchanting: case GossipOptionIds.Herbalism:
case GossipOptionIds.Engineering: case GossipOptionIds.Inscription:
case GossipOptionIds.Herbalism: case GossipOptionIds.Jewelcrafting:
case GossipOptionIds.Inscription: case GossipOptionIds.Leatherworking:
case GossipOptionIds.Jewelcrafting: case GossipOptionIds.Mining:
case GossipOptionIds.Leatherworking: case GossipOptionIds.Skinning:
case GossipOptionIds.Mining: case GossipOptionIds.Tailoring:
case GossipOptionIds.Skinning: SendTrainerList(player, (GossipOptionIds)gossipListId);
case GossipOptionIds.Tailoring: break;
SendTrainerList(player, (GossipOptionIds)gossipListId); case GossipOptionIds.Multi:
break; {
case GossipOptionIds.Multi: switch ((GossipMenuIds)menuId)
{ {
switch ((GossipMenuIds)menuId) case GossipMenuIds.Herbalism:
{ SendTrainerList(player, GossipOptionIds.Herbalism);
case GossipMenuIds.Herbalism: break;
SendTrainerList(player, GossipOptionIds.Herbalism); case GossipMenuIds.Mining:
break; SendTrainerList(player, GossipOptionIds.Mining);
case GossipMenuIds.Mining: break;
SendTrainerList(player, GossipOptionIds.Mining); case GossipMenuIds.Skinning:
break; SendTrainerList(player, GossipOptionIds.Skinning);
case GossipMenuIds.Skinning: break;
SendTrainerList(player, GossipOptionIds.Skinning); case GossipMenuIds.Alchemy:
break; SendTrainerList(player, GossipOptionIds.Alchemy);
case GossipMenuIds.Alchemy: break;
SendTrainerList(player, GossipOptionIds.Alchemy); case GossipMenuIds.Blacksmithing:
break; SendTrainerList(player, GossipOptionIds.Blacksmithing);
case GossipMenuIds.Blacksmithing: break;
SendTrainerList(player, GossipOptionIds.Blacksmithing); case GossipMenuIds.Enchanting:
break; SendTrainerList(player, GossipOptionIds.Enchanting);
case GossipMenuIds.Enchanting: break;
SendTrainerList(player, GossipOptionIds.Enchanting); case GossipMenuIds.Engineering:
break; SendTrainerList(player, GossipOptionIds.Engineering);
case GossipMenuIds.Engineering: break;
SendTrainerList(player, GossipOptionIds.Engineering); case GossipMenuIds.Inscription:
break; SendTrainerList(player, GossipOptionIds.Inscription);
case GossipMenuIds.Inscription: break;
SendTrainerList(player, GossipOptionIds.Inscription); case GossipMenuIds.Jewelcrafting:
break; SendTrainerList(player, GossipOptionIds.Jewelcrafting);
case GossipMenuIds.Jewelcrafting: break;
SendTrainerList(player, GossipOptionIds.Jewelcrafting); case GossipMenuIds.Leatherworking:
break; SendTrainerList(player, GossipOptionIds.Leatherworking);
case GossipMenuIds.Leatherworking: break;
SendTrainerList(player, GossipOptionIds.Leatherworking); case GossipMenuIds.Tailoring:
break; SendTrainerList(player, GossipOptionIds.Tailoring);
case GossipMenuIds.Tailoring: break;
SendTrainerList(player, GossipOptionIds.Tailoring); default:
break; break;
default:
break;
}
} }
break; }
default: break;
break; default:
} break;
}
void SendTrainerList(Player player, GossipOptionIds Index)
{
player.GetSession().SendTrainerList(me.GetGUID(), (uint)Index + 1);
} }
} }
public override CreatureAI GetAI(Creature creature) void SendTrainerList(Player player, GossipOptionIds Index)
{ {
return new npc_multi_profession_trainerAI(creature); player.GetSession().SendTrainerList(me.GetGUID(), (uint)Index + 1);
} }
} }
} }
+1055 -1224
View File
File diff suppressed because it is too large Load Diff