Implement generic script loaders to greatly reduce code duplication
This commit is contained in:
@@ -25,129 +25,124 @@ using Game.Scripting;
|
||||
namespace Scripts.EasternKingdoms
|
||||
{
|
||||
[Script]
|
||||
class npc_apprentice_mirveda : CreatureScript
|
||||
class npc_apprentice_mirveda : ScriptedAI
|
||||
{
|
||||
public npc_apprentice_mirveda() : base("npc_apprentice_mirveda") { }
|
||||
|
||||
class npc_apprentice_mirvedaAI : ScriptedAI
|
||||
public npc_apprentice_mirveda(Creature creature)
|
||||
: base(creature)
|
||||
{
|
||||
public npc_apprentice_mirvedaAI(Creature creature)
|
||||
: 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;
|
||||
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;
|
||||
|
||||
const uint EventTalk = 1; // Quest 8487
|
||||
const uint EventAddQuestGiverFlag = 2; // Quest 8487
|
||||
const uint EventSummon = 3; // Quest 8488
|
||||
@@ -171,106 +166,90 @@ namespace Scripts.EasternKingdoms
|
||||
// Quest
|
||||
const uint QUEST_CORRUPTED_SOIL = 8487;
|
||||
const uint QUEST_UNEXPECTED_RESULT = 8488;
|
||||
|
||||
public override CreatureAI GetAI(Creature creature)
|
||||
{
|
||||
return new npc_apprentice_mirvedaAI(creature);
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class npc_infused_crystal : CreatureScript
|
||||
class npc_infused_crystal : ScriptedAI
|
||||
{
|
||||
public npc_infused_crystal() : base("npc_infused_crystal") { }
|
||||
|
||||
class npc_infused_crystalAI : ScriptedAI
|
||||
public npc_infused_crystal(Creature creature) : base(creature)
|
||||
{
|
||||
public npc_infused_crystalAI(Creature creature)
|
||||
: base(creature)
|
||||
{
|
||||
SetCombatMovement(false);
|
||||
}
|
||||
SetCombatMovement(false);
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
EndTimer = 0;
|
||||
Completed = false;
|
||||
Progress = false;
|
||||
PlayerGUID.Clear();
|
||||
WaveTimer = 0;
|
||||
}
|
||||
public override void Reset()
|
||||
{
|
||||
EndTimer = 0;
|
||||
Completed = false;
|
||||
Progress = false;
|
||||
PlayerGUID.Clear();
|
||||
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;
|
||||
EndTimer = 60000;
|
||||
Progress = true;
|
||||
}
|
||||
PlayerGUID = who.GetGUID();
|
||||
WaveTimer = 1000;
|
||||
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);
|
||||
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)
|
||||
{
|
||||
Talk(Emote);
|
||||
Completed = true;
|
||||
if (!PlayerGUID.IsEmpty())
|
||||
{
|
||||
Player player = Global.ObjAccessor.GetPlayer(me, PlayerGUID);
|
||||
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;
|
||||
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;
|
||||
}
|
||||
|
||||
uint EndTimer;
|
||||
uint WaveTimer;
|
||||
bool Completed;
|
||||
bool Progress;
|
||||
ObjectGuid PlayerGUID;
|
||||
else WaveTimer -= diff;
|
||||
}
|
||||
|
||||
public override CreatureAI GetAI(Creature creature)
|
||||
{
|
||||
return new npc_infused_crystalAI(creature);
|
||||
}
|
||||
uint EndTimer;
|
||||
uint WaveTimer;
|
||||
bool Completed;
|
||||
bool Progress;
|
||||
ObjectGuid PlayerGUID;
|
||||
|
||||
// Quest
|
||||
const uint QuestPoweringOurDefenses = 8490;
|
||||
|
||||
@@ -53,273 +53,253 @@ namespace Scripts.EasternKingdoms.Karazhan.Midnight
|
||||
}
|
||||
|
||||
[Script]
|
||||
class boss_attumen : CreatureScript
|
||||
public class boss_attumen : ScriptedAI
|
||||
{
|
||||
public boss_attumen() : base("boss_attumen") { }
|
||||
|
||||
public class boss_attumenAI : ScriptedAI
|
||||
public boss_attumen(Creature creature) : base(creature)
|
||||
{
|
||||
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);
|
||||
}
|
||||
else CleaveTimer -= diff;
|
||||
|
||||
if (CurseTimer <= diff)
|
||||
{
|
||||
DoCastVictim(SpellIds.IntangiblePresence);
|
||||
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;
|
||||
Midnight.Clear();
|
||||
Talk(TextIds.SayRandom);
|
||||
RandomYellTimer = RandomHelper.URand(30000, 60000);
|
||||
}
|
||||
else RandomYellTimer -= diff;
|
||||
|
||||
public override void EnterEvadeMode(EvadeReason why)
|
||||
if (me.GetUInt32Value(UnitFields.DisplayId) == Misc.MountedDisplayid)
|
||||
{
|
||||
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 (ChargeTimer <= diff)
|
||||
{
|
||||
if (ResetTimer <= diff)
|
||||
var t_list = me.GetThreatManager().getThreatList();
|
||||
List<Unit> target_list = new List<Unit>();
|
||||
foreach (var hostileRefe in t_list)
|
||||
{
|
||||
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();
|
||||
var unit = Global.ObjAccessor.GetUnit(me, hostileRefe.getUnitGuid());
|
||||
if (unit && !unit.IsWithinDist(me, SharedConst.AttackDistance, false))
|
||||
target_list.Add(unit);
|
||||
unit = null;
|
||||
}
|
||||
else ResetTimer -= diff;
|
||||
Unit target = null;
|
||||
if (!target_list.Empty())
|
||||
target = target_list.SelectRandom();
|
||||
|
||||
DoCast(target, SpellIds.BerserkerCharge);
|
||||
ChargeTimer = 20000;
|
||||
}
|
||||
|
||||
//Return since we have no target
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if (me.HasFlag(UnitFields.Flags, UnitFlags.NonAttackable | UnitFlags.NotSelectable))
|
||||
return;
|
||||
|
||||
if (CleaveTimer <= diff)
|
||||
else ChargeTimer -= diff;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (HealthBelowPct(25))
|
||||
{
|
||||
DoCastVictim(SpellIds.Shadowcleave);
|
||||
CleaveTimer = RandomHelper.URand(10000, 15000);
|
||||
}
|
||||
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)
|
||||
Creature pMidnight = ObjectAccessor.GetCreature(me, Midnight);
|
||||
if (pMidnight && pMidnight.IsTypeId(TypeId.Unit))
|
||||
{
|
||||
var t_list = me.GetThreatManager().getThreatList();
|
||||
List<Unit> target_list = new List<Unit>();
|
||||
foreach (var hostileRefe in t_list)
|
||||
{
|
||||
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();
|
||||
}
|
||||
((boss_midnight)pMidnight.GetAI()).Mount(me);
|
||||
me.SetHealth(pMidnight.GetHealth());
|
||||
DoResetThreat();
|
||||
}
|
||||
}
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
public override void SpellHit(Unit source, SpellInfo spell)
|
||||
{
|
||||
if (spell.Mechanic == Mechanics.Disarm)
|
||||
Talk(TextIds.SayDisarmed);
|
||||
}
|
||||
|
||||
public ObjectGuid Midnight;
|
||||
uint CleaveTimer;
|
||||
uint CurseTimer;
|
||||
uint RandomYellTimer;
|
||||
uint ChargeTimer; //only when mounted
|
||||
uint ResetTimer;
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
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]
|
||||
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;
|
||||
Attumen.Clear();
|
||||
mountTimer = 0;
|
||||
|
||||
me.RemoveFlag(UnitFields.Flags, UnitFlags.NonAttackable);
|
||||
me.SetVisible(true);
|
||||
Unit unit = Global.ObjAccessor.GetUnit(me, Attumen);
|
||||
if (unit)
|
||||
Talk(TextIds.SayMidnightKill, unit);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
if (unit)
|
||||
Talk(TextIds.SayMidnightKill, unit);
|
||||
Attumen = attumen.GetGUID();
|
||||
attumen.GetAI().AttackStart(me.GetVictim());
|
||||
SetMidnight(attumen, me.GetGUID());
|
||||
Talk(TextIds.SayAppear, attumen);
|
||||
}
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
else if (Phase == 2 && HealthBelowPct(25))
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if (Phase == 1 && HealthBelowPct(95))
|
||||
Unit pAttumen = Global.ObjAccessor.GetUnit(me, Attumen);
|
||||
if (pAttumen)
|
||||
Mount(pAttumen);
|
||||
}
|
||||
else if (Phase == 3)
|
||||
{
|
||||
if (mountTimer != 0)
|
||||
{
|
||||
Phase = 2;
|
||||
Creature attumen = me.SummonCreature(Misc.SummonAttumen, 0.0f, 0.0f, 0.0f, 0.0f, TempSummonType.TimedOrDeadDespawn, 30000);
|
||||
if (attumen)
|
||||
if (mountTimer <= diff)
|
||||
{
|
||||
Attumen = attumen.GetGUID();
|
||||
attumen.GetAI().AttackStart(me.GetVictim());
|
||||
SetMidnight(attumen, me.GetGUID());
|
||||
Talk(TextIds.SayAppear, attumen);
|
||||
}
|
||||
}
|
||||
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;
|
||||
me.SetVisible(false);
|
||||
me.GetMotionMaster().MoveIdle();
|
||||
Unit pAttumen = Global.ObjAccessor.GetUnit(me, Attumen);
|
||||
if (pAttumen)
|
||||
{
|
||||
mountTimer = 0;
|
||||
me.SetVisible(false);
|
||||
me.GetMotionMaster().MoveIdle();
|
||||
Unit pAttumen = Global.ObjAccessor.GetUnit(me, Attumen);
|
||||
if (pAttumen)
|
||||
pAttumen.SetDisplayId(Misc.MountedDisplayid);
|
||||
pAttumen.RemoveFlag(UnitFields.Flags, UnitFlags.NonAttackable);
|
||||
if (pAttumen.GetVictim())
|
||||
{
|
||||
pAttumen.SetDisplayId(Misc.MountedDisplayid);
|
||||
pAttumen.RemoveFlag(UnitFields.Flags, UnitFlags.NonAttackable);
|
||||
if (pAttumen.GetVictim())
|
||||
{
|
||||
pAttumen.GetMotionMaster().MoveChase(pAttumen.GetVictim());
|
||||
pAttumen.SetTarget(pAttumen.GetVictim().GetGUID());
|
||||
}
|
||||
pAttumen.SetObjectScale(1);
|
||||
pAttumen.GetMotionMaster().MoveChase(pAttumen.GetVictim());
|
||||
pAttumen.SetTarget(pAttumen.GetVictim().GetGUID());
|
||||
}
|
||||
pAttumen.SetObjectScale(1);
|
||||
}
|
||||
else mountTimer -= diff;
|
||||
}
|
||||
else mountTimer -= diff;
|
||||
}
|
||||
|
||||
if (Phase != 3)
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
public void Mount(Unit pAttumen)
|
||||
{
|
||||
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;
|
||||
if (Phase != 3)
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Curator
|
||||
}
|
||||
|
||||
struct SpellIds
|
||||
{
|
||||
{
|
||||
//Flare spell info
|
||||
public const uint AstralFlarePassive = 30234; //Visual effect + Flare damage
|
||||
|
||||
@@ -46,123 +46,113 @@ namespace Scripts.EasternKingdoms.Karazhan.Curator
|
||||
}
|
||||
|
||||
[Script]
|
||||
class boss_curator : CreatureScript
|
||||
class boss_curator : ScriptedAI
|
||||
{
|
||||
public boss_curator() : base("boss_curator") { }
|
||||
|
||||
class boss_curatorAI : ScriptedAI
|
||||
public boss_curator(Creature creature) : base(creature)
|
||||
{
|
||||
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
|
||||
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)
|
||||
{
|
||||
AstralFlare.CastSpell(AstralFlare, SpellIds.AstralFlarePassive, false);
|
||||
AstralFlare.GetAI().AttackStart(target);
|
||||
}
|
||||
if (AstralFlare && target)
|
||||
{
|
||||
AstralFlare.CastSpell(AstralFlare, SpellIds.AstralFlarePassive, false);
|
||||
AstralFlare.GetAI().AttackStart(target);
|
||||
}
|
||||
|
||||
//Reduce Mana by 10% of max health
|
||||
int mana = me.GetMaxPower(PowerType.Mana);
|
||||
if (mana != 0)
|
||||
{
|
||||
mana /= 10;
|
||||
me.ModifyPower(PowerType.Mana, -mana);
|
||||
if (mana != 0)
|
||||
{
|
||||
mana /= 10;
|
||||
me.ModifyPower(PowerType.Mana, -mana);
|
||||
|
||||
//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)
|
||||
{
|
||||
Talk(TextIds.SayEvocate);
|
||||
me.InterruptNonMeleeSpells(false);
|
||||
DoCast(me, SpellIds.Evocation);
|
||||
_scheduler.DelayAll(TimeSpan.FromSeconds(20));
|
||||
{
|
||||
Talk(TextIds.SayEvocate);
|
||||
me.InterruptNonMeleeSpells(false);
|
||||
DoCast(me, SpellIds.Evocation);
|
||||
_scheduler.DelayAll(TimeSpan.FromSeconds(20));
|
||||
//Evocating = true;
|
||||
//no AddTimer cooldown, this will make first flare appear instantly after evocate end, like expected
|
||||
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
|
||||
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);
|
||||
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
|
||||
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)
|
||||
{
|
||||
return new boss_curatorAI(creature);
|
||||
}
|
||||
bool Enraged;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ using Framework.IO;
|
||||
using Game.Entities;
|
||||
using Game.Maps;
|
||||
using Game.Scripting;
|
||||
using Game.AI;
|
||||
|
||||
namespace Scripts.EasternKingdoms.Karazhan
|
||||
{
|
||||
@@ -458,5 +459,10 @@ namespace Scripts.EasternKingdoms.Karazhan
|
||||
{
|
||||
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
@@ -33,240 +33,220 @@ namespace Scripts.EasternKingdoms
|
||||
}
|
||||
|
||||
[Script]
|
||||
class npc_unworthy_initiate : CreatureScript
|
||||
public class npc_unworthy_initiate : ScriptedAI
|
||||
{
|
||||
public npc_unworthy_initiate() : base("npc_unworthy_initiate") { }
|
||||
|
||||
public class npc_unworthy_initiateAI : ScriptedAI
|
||||
public npc_unworthy_initiate(Creature creature) : base(creature)
|
||||
{
|
||||
public npc_unworthy_initiateAI(Creature creature) : base(creature)
|
||||
{
|
||||
me.SetReactState(ReactStates.Passive);
|
||||
if (me.GetCurrentEquipmentId() == 0)
|
||||
me.SetCurrentEquipmentId((byte)me.GetOriginalEquipmentId());
|
||||
}
|
||||
me.SetReactState(ReactStates.Passive);
|
||||
if (me.GetCurrentEquipmentId() == 0)
|
||||
me.SetCurrentEquipmentId((byte)me.GetOriginalEquipmentId());
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
anchorGUID.Clear();
|
||||
phase = UnworthyInitiatePhase.Chained;
|
||||
_events.Reset();
|
||||
me.SetFaction(7);
|
||||
me.SetFlag(UnitFields.Flags, UnitFlags.ImmuneToPc);
|
||||
me.SetStandState(UnitStandStateType.Kneel);
|
||||
me.LoadEquipment(0, true);
|
||||
}
|
||||
public override void Reset()
|
||||
{
|
||||
anchorGUID.Clear();
|
||||
phase = UnworthyInitiatePhase.Chained;
|
||||
_events.Reset();
|
||||
me.SetFaction(7);
|
||||
me.SetFlag(UnitFields.Flags, UnitFlags.ImmuneToPc);
|
||||
me.SetStandState(UnitStandStateType.Kneel);
|
||||
me.LoadEquipment(0, true);
|
||||
}
|
||||
|
||||
public override void EnterCombat(Unit who)
|
||||
{
|
||||
_events.ScheduleEvent(EventIcyTouch, 1000, 1);
|
||||
_events.ScheduleEvent(EventPlagueStrike, 3000, 1);
|
||||
_events.ScheduleEvent(EventBloodStrike, 2000, 1);
|
||||
_events.ScheduleEvent(EventDeathCoil, 5000, 1);
|
||||
}
|
||||
public override void EnterCombat(Unit who)
|
||||
{
|
||||
_events.ScheduleEvent(EventIcyTouch, 1000, 1);
|
||||
_events.ScheduleEvent(EventPlagueStrike, 3000, 1);
|
||||
_events.ScheduleEvent(EventBloodStrike, 2000, 1);
|
||||
_events.ScheduleEvent(EventDeathCoil, 5000, 1);
|
||||
}
|
||||
|
||||
public override void MovementInform(MovementGeneratorType type, uint id)
|
||||
{
|
||||
if (type != MovementGeneratorType.Point)
|
||||
return;
|
||||
public override void MovementInform(MovementGeneratorType type, uint id)
|
||||
{
|
||||
if (type != MovementGeneratorType.Point)
|
||||
return;
|
||||
|
||||
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)
|
||||
if (id == 1)
|
||||
{
|
||||
wait_timer = 5000;
|
||||
phase = UnworthyInitiatePhase.ToEquip;
|
||||
me.CastSpell(me, SpellDKInitateVisual, true);
|
||||
|
||||
me.SetStandState(UnitStandStateType.Stand);
|
||||
me.RemoveAurasDueToSpell(SpellSoulPrisonChainSelf);
|
||||
me.RemoveAurasDueToSpell(SpellSoulPrisonChain);
|
||||
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);
|
||||
|
||||
float z;
|
||||
anchor.GetContactPoint(me, out anchorX, out anchorY, out z, 1.0f);
|
||||
|
||||
playerGUID = target.GetGUID();
|
||||
Talk(SayEventStart);
|
||||
phase = UnworthyInitiatePhase.ToAttack;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
if (anchor)
|
||||
{
|
||||
anchor.GetAI().SetGUID(me.GetGUID());
|
||||
anchor.CastSpell(me, SpellSoulPrisonChain, true);
|
||||
anchorGUID = anchor.GetGUID();
|
||||
}
|
||||
else
|
||||
Log.outError(LogFilter.Scripts, "npc_unworthy_initiateAI: unable to find anchor!");
|
||||
anchor.GetAI().SetGUID(me.GetGUID());
|
||||
anchor.CastSpell(me, SpellSoulPrisonChain, true);
|
||||
anchorGUID = anchor.GetGUID();
|
||||
}
|
||||
else
|
||||
Log.outError(LogFilter.Scripts, "npc_unworthy_initiateAI: unable to find anchor!");
|
||||
|
||||
float dist = 99.0f;
|
||||
GameObject prison = null;
|
||||
float dist = 99.0f;
|
||||
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 (temp_prison)
|
||||
if (me.IsWithinDist(temp_prison, dist, false))
|
||||
{
|
||||
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 (wait_timer != 0)
|
||||
|
||||
if (prison)
|
||||
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)
|
||||
wait_timer -= diff;
|
||||
else
|
||||
{
|
||||
me.GetMotionMaster().MovePoint(1, anchorX, anchorY, me.GetPositionZ());
|
||||
phase = UnworthyInitiatePhase.Equiping;
|
||||
wait_timer = 0;
|
||||
}
|
||||
me.GetMotionMaster().MovePoint(1, anchorX, anchorY, me.GetPositionZ());
|
||||
phase = UnworthyInitiatePhase.Equiping;
|
||||
wait_timer = 0;
|
||||
}
|
||||
break;
|
||||
case UnworthyInitiatePhase.ToAttack:
|
||||
if (wait_timer != 0)
|
||||
}
|
||||
break;
|
||||
case UnworthyInitiatePhase.ToAttack:
|
||||
if (wait_timer != 0)
|
||||
{
|
||||
if (wait_timer > diff)
|
||||
wait_timer -= diff;
|
||||
else
|
||||
{
|
||||
if (wait_timer > diff)
|
||||
wait_timer -= diff;
|
||||
else
|
||||
{
|
||||
me.SetFaction(14);
|
||||
me.RemoveFlag(UnitFields.Flags, UnitFlags.ImmuneToPc);
|
||||
phase = UnworthyInitiatePhase.Attacking;
|
||||
me.SetFaction(14);
|
||||
me.RemoveFlag(UnitFields.Flags, UnitFlags.ImmuneToPc);
|
||||
phase = UnworthyInitiatePhase.Attacking;
|
||||
|
||||
Player target = Global.ObjAccessor.GetPlayer(me, playerGUID);
|
||||
if (target)
|
||||
AttackStart(target);
|
||||
wait_timer = 0;
|
||||
}
|
||||
Player target = Global.ObjAccessor.GetPlayer(me, playerGUID);
|
||||
if (target)
|
||||
AttackStart(target);
|
||||
wait_timer = 0;
|
||||
}
|
||||
break;
|
||||
case UnworthyInitiatePhase.Attacking:
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case UnworthyInitiatePhase.Attacking:
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
_events.Update(diff);
|
||||
_events.ExecuteEvents(eventId =>
|
||||
_events.Update(diff);
|
||||
_events.ExecuteEvents(eventId =>
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case EventIcyTouch:
|
||||
DoCastVictim(SpellIcyTouch);
|
||||
_events.DelayEvents(1000, 1);
|
||||
_events.ScheduleEvent(EventIcyTouch, 5000, 1);
|
||||
break;
|
||||
case EventPlagueStrike:
|
||||
DoCastVictim(SpellPlagueStrike);
|
||||
_events.DelayEvents(1000, 1);
|
||||
_events.ScheduleEvent(EventPlagueStrike, 5000, 1);
|
||||
break;
|
||||
case EventBloodStrike:
|
||||
DoCastVictim(SpellBloodStrike);
|
||||
_events.DelayEvents(1000, 1);
|
||||
_events.ScheduleEvent(EventBloodStrike, 5000, 1);
|
||||
break;
|
||||
case EventDeathCoil:
|
||||
DoCastVictim(SpellDeathCoil);
|
||||
_events.DelayEvents(1000, 1);
|
||||
_events.ScheduleEvent(EventDeathCoil, 5000, 1);
|
||||
break;
|
||||
}
|
||||
});
|
||||
case EventIcyTouch:
|
||||
DoCastVictim(SpellIcyTouch);
|
||||
_events.DelayEvents(1000, 1);
|
||||
_events.ScheduleEvent(EventIcyTouch, 5000, 1);
|
||||
break;
|
||||
case EventPlagueStrike:
|
||||
DoCastVictim(SpellPlagueStrike);
|
||||
_events.DelayEvents(1000, 1);
|
||||
_events.ScheduleEvent(EventPlagueStrike, 5000, 1);
|
||||
break;
|
||||
case EventBloodStrike:
|
||||
DoCastVictim(SpellBloodStrike);
|
||||
_events.DelayEvents(1000, 1);
|
||||
_events.ScheduleEvent(EventBloodStrike, 5000, 1);
|
||||
break;
|
||||
case EventDeathCoil:
|
||||
DoCastVictim(SpellDeathCoil);
|
||||
_events.DelayEvents(1000, 1);
|
||||
_events.ScheduleEvent(EventDeathCoil, 5000, 1);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
DoMeleeAttackIfReady();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
ObjectGuid playerGUID;
|
||||
UnworthyInitiatePhase phase;
|
||||
uint wait_timer;
|
||||
float anchorX, anchorY;
|
||||
ObjectGuid anchorGUID;
|
||||
}
|
||||
|
||||
public const uint SpellSoulPrisonChainSelf = 54612;
|
||||
public const uint SpellSoulPrisonChain = 54613;
|
||||
public const uint SpellDKInitateVisual = 51519;
|
||||
ObjectGuid playerGUID;
|
||||
UnworthyInitiatePhase phase;
|
||||
uint wait_timer;
|
||||
float anchorX, anchorY;
|
||||
ObjectGuid anchorGUID;
|
||||
|
||||
public const uint SpellIcyTouch = 52372;
|
||||
public const uint SpellPlagueStrike = 52373;
|
||||
public const uint SpellBloodStrike = 52374;
|
||||
public const uint SpellDeathCoil = 52375;
|
||||
const uint SpellSoulPrisonChainSelf = 54612;
|
||||
const uint SpellSoulPrisonChain = 54613;
|
||||
const uint SpellDKInitateVisual = 51519;
|
||||
|
||||
public const uint SayEventStart = 0;
|
||||
public const uint SayEventAttack = 1;
|
||||
const uint SpellIcyTouch = 52372;
|
||||
const uint SpellPlagueStrike = 52373;
|
||||
const uint SpellBloodStrike = 52374;
|
||||
const uint SpellDeathCoil = 52375;
|
||||
|
||||
public const uint EventIcyTouch = 1;
|
||||
public const uint EventPlagueStrike = 2;
|
||||
public const uint EventBloodStrike = 3;
|
||||
public const uint EventDeathCoil = 4;
|
||||
const uint SayEventStart = 0;
|
||||
const uint SayEventAttack = 1;
|
||||
|
||||
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)
|
||||
{
|
||||
return new npc_unworthy_initiateAI(creature);
|
||||
}
|
||||
static uint[] acherus_soul_prison = { 191577, 191580, 191581, 191582, 191583, 191584, 191585, 191586, 191587, 191588, 191589, 191590 };
|
||||
}
|
||||
|
||||
[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) { }
|
||||
|
||||
public override void SetGUID(ObjectGuid guid, int id)
|
||||
{
|
||||
if (prisonerGUID.IsEmpty())
|
||||
prisonerGUID = guid;
|
||||
}
|
||||
|
||||
public override ObjectGuid GetGUID(int id)
|
||||
{
|
||||
return prisonerGUID;
|
||||
}
|
||||
|
||||
ObjectGuid prisonerGUID;
|
||||
if (prisonerGUID.IsEmpty())
|
||||
prisonerGUID = guid;
|
||||
}
|
||||
|
||||
public override CreatureAI GetAI(Creature creature)
|
||||
public override ObjectGuid GetGUID(int id)
|
||||
{
|
||||
return new npc_unworthy_initiate_anchorAI(creature);
|
||||
return prisonerGUID;
|
||||
}
|
||||
|
||||
ObjectGuid prisonerGUID;
|
||||
}
|
||||
|
||||
[Script]
|
||||
@@ -284,13 +264,12 @@ namespace Scripts.EasternKingdoms
|
||||
{
|
||||
Creature prisoner = ObjectAccessor.GetCreature(player, prisonerGUID);
|
||||
if (prisoner)
|
||||
((npc_unworthy_initiate.npc_unworthy_initiateAI)prisoner.GetAI()).EventStart(anchor, player);
|
||||
((npc_unworthy_initiate)prisoner.GetAI()).EventStart(anchor, player);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
struct EyeOfAcherus
|
||||
@@ -311,74 +290,64 @@ namespace Scripts.EasternKingdoms
|
||||
}
|
||||
|
||||
[Script]
|
||||
class npc_eye_of_acherus : CreatureScript
|
||||
class npc_eye_of_acherus : ScriptedAI
|
||||
{
|
||||
public npc_eye_of_acherus() : base("npc_eye_of_acherus") { }
|
||||
|
||||
class npc_eye_of_acherusAI : ScriptedAI
|
||||
public npc_eye_of_acherus(Creature creature) : base(creature)
|
||||
{
|
||||
public npc_eye_of_acherusAI(Creature creature) : base(creature)
|
||||
{
|
||||
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);
|
||||
}
|
||||
Reset();
|
||||
}
|
||||
|
||||
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]
|
||||
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();
|
||||
Talk(TextIds.SayPull);
|
||||
DoCastVictim(SpellIds.ViciousSlice);
|
||||
task.Repeat(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(14));
|
||||
});
|
||||
|
||||
_scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting));
|
||||
|
||||
_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)
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(2), task =>
|
||||
{
|
||||
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;
|
||||
DoCast(SpellIds.MaddeningCall);
|
||||
task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(20));
|
||||
});
|
||||
}
|
||||
|
||||
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]
|
||||
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) { }
|
||||
|
||||
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;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (type == MovementGeneratorType.Point && id == 0)
|
||||
_events.ScheduleEvent(Events.SayWarden1, TimeSpan.FromSeconds(1));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user