Implement generic script loaders to greatly reduce code duplication
This commit is contained in:
@@ -43,221 +43,191 @@ namespace Scripts.Northrend.DraktharonKeep.KingDred
|
||||
}
|
||||
|
||||
[Script]
|
||||
class boss_king_dred : CreatureScript
|
||||
class boss_king_dred : BossAI
|
||||
{
|
||||
public boss_king_dred() : base("boss_king_dred") { }
|
||||
|
||||
class boss_king_dredAI : BossAI
|
||||
public boss_king_dred(Creature creature) : base(creature, DTKDataTypes.KingDred)
|
||||
{
|
||||
public boss_king_dredAI(Creature creature) : base(creature, DTKDataTypes.KingDred)
|
||||
{
|
||||
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;
|
||||
Initialize();
|
||||
}
|
||||
|
||||
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]
|
||||
class npc_drakkari_gutripper : CreatureScript
|
||||
class npc_drakkari_gutripper : ScriptedAI
|
||||
{
|
||||
public npc_drakkari_gutripper() : base("npc_drakkari_gutripper") { }
|
||||
|
||||
class npc_drakkari_gutripperAI : ScriptedAI
|
||||
public npc_drakkari_gutripper(Creature creature) : base(creature)
|
||||
{
|
||||
public npc_drakkari_gutripperAI(Creature creature) : base(creature)
|
||||
{
|
||||
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;
|
||||
Initialize();
|
||||
instance = me.GetInstanceScript();
|
||||
}
|
||||
|
||||
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]
|
||||
class npc_drakkari_scytheclaw : CreatureScript
|
||||
class npc_drakkari_scytheclaw : ScriptedAI
|
||||
{
|
||||
public npc_drakkari_scytheclaw() : base("npc_drakkari_scytheclaw") { }
|
||||
|
||||
class npc_drakkari_scytheclawAI : ScriptedAI
|
||||
public npc_drakkari_scytheclaw(Creature creature) : base(creature)
|
||||
{
|
||||
public npc_drakkari_scytheclawAI(Creature creature) : base(creature)
|
||||
{
|
||||
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;
|
||||
Initialize();
|
||||
instance = me.GetInstanceScript();
|
||||
}
|
||||
|
||||
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]
|
||||
|
||||
@@ -98,303 +98,283 @@ namespace Scripts.Northrend.DraktharonKeep.Novos
|
||||
}
|
||||
|
||||
[Script]
|
||||
class boss_novos : CreatureScript
|
||||
class boss_novos : BossAI
|
||||
{
|
||||
public boss_novos() : base("boss_novos") { }
|
||||
|
||||
class boss_novosAI : BossAI
|
||||
public boss_novos(Creature creature) : base(creature, DTKDataTypes.Novos)
|
||||
{
|
||||
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();
|
||||
_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);
|
||||
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;
|
||||
|
||||
_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]
|
||||
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();
|
||||
_crystalHandlerCount = 0;
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
_events.Update(diff);
|
||||
|
||||
_events.ExecuteEvents(eventId =>
|
||||
switch (eventId)
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case Misc.EventSummonCrystalHandler:
|
||||
me.SummonCreature(DTKCreatureIds.CrystalHandler, Misc.SummonPositions[_crystalHandlerCount++]);
|
||||
if (_crystalHandlerCount < 4)
|
||||
_events.Repeat(TimeSpan.FromSeconds(15));
|
||||
break;
|
||||
case Misc.EventSummonRisenShadowcaster:
|
||||
DoCast(SpellIds.SummonRisenShadowcaster);
|
||||
_events.Repeat(TimeSpan.FromSeconds(7));
|
||||
break;
|
||||
case Misc.EventSummonFetidTrollCorpse:
|
||||
DoCast(SpellIds.SummonFetidTrollCorpse);
|
||||
_events.Repeat(TimeSpan.FromSeconds(3));
|
||||
break;
|
||||
case Misc.EventSummonHulkingCorpse:
|
||||
DoCast(SpellIds.SummonHulkingCorpse);
|
||||
_events.Repeat(TimeSpan.FromSeconds(30));
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
case Misc.EventSummonCrystalHandler:
|
||||
me.SummonCreature(DTKCreatureIds.CrystalHandler, Misc.SummonPositions[_crystalHandlerCount++]);
|
||||
if (_crystalHandlerCount < 4)
|
||||
_events.Repeat(TimeSpan.FromSeconds(15));
|
||||
break;
|
||||
case Misc.EventSummonRisenShadowcaster:
|
||||
DoCast(SpellIds.SummonRisenShadowcaster);
|
||||
_events.Repeat(TimeSpan.FromSeconds(7));
|
||||
break;
|
||||
case Misc.EventSummonFetidTrollCorpse:
|
||||
DoCast(SpellIds.SummonFetidTrollCorpse);
|
||||
_events.Repeat(TimeSpan.FromSeconds(3));
|
||||
break;
|
||||
case Misc.EventSummonHulkingCorpse:
|
||||
DoCast(SpellIds.SummonHulkingCorpse);
|
||||
_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));
|
||||
}
|
||||
|
||||
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);
|
||||
if (!guid.IsEmpty())
|
||||
{
|
||||
ObjectGuid guid = instance.GetGuidData(DTKDataTypes.Novos);
|
||||
if (!guid.IsEmpty())
|
||||
{
|
||||
Creature novos = ObjectAccessor.GetCreature(me, guid);
|
||||
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)
|
||||
{
|
||||
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;
|
||||
if (summon)
|
||||
summon.GetMotionMaster().MovePath(summon.GetEntry() * 100, false);
|
||||
}
|
||||
|
||||
public override CreatureAI GetAI(Creature creature)
|
||||
{
|
||||
return GetInstanceAI<npc_crystal_channel_targetAI>(creature);
|
||||
}
|
||||
uint _crystalHandlerCount;
|
||||
}
|
||||
|
||||
[Script]
|
||||
@@ -409,32 +389,22 @@ namespace Scripts.Northrend.DraktharonKeep.Novos
|
||||
}
|
||||
|
||||
[Script]
|
||||
class spell_novos_summon_minions : SpellScriptLoader
|
||||
class spell_novos_summon_minions : SpellScript
|
||||
{
|
||||
public spell_novos_summon_minions() : base("spell_novos_summon_minions") { }
|
||||
|
||||
class spell_novos_summon_minions_SpellScript : SpellScript
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
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));
|
||||
}
|
||||
return ValidateSpellInfo(SpellIds.SummonCopyOfMinions);
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,178 +74,158 @@ namespace Scripts.Northrend.DraktharonKeep.TharonJa
|
||||
}
|
||||
|
||||
[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();
|
||||
me.RestoreDisplayId();
|
||||
}
|
||||
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);
|
||||
|
||||
public override void EnterCombat(Unit who)
|
||||
{
|
||||
Talk(TextIds.SayAggro);
|
||||
_EnterCombat();
|
||||
_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.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);
|
||||
_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;
|
||||
});
|
||||
|
||||
_events.ExecuteEvents(eventId =>
|
||||
{
|
||||
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);
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
}
|
||||
|
||||
[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") { }
|
||||
|
||||
class spell_tharon_ja_clear_gift_of_tharon_ja_SpellScript : SpellScript
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
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));
|
||||
}
|
||||
return ValidateSpellInfo(SpellIds.GiftOfTharonJa);
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,256 +59,206 @@ namespace Scripts.Northrend.DraktharonKeep.Trollgore
|
||||
}
|
||||
|
||||
[Script]
|
||||
class boss_trollgore : CreatureScript
|
||||
class boss_trollgore : BossAI
|
||||
{
|
||||
public boss_trollgore() : base("boss_trollgore") { }
|
||||
|
||||
class boss_trollgoreAI : BossAI
|
||||
public boss_trollgore(Creature creature) : base(creature, DTKDataTypes.Trollgore)
|
||||
{
|
||||
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();
|
||||
Initialize();
|
||||
}
|
||||
Talk(TextIds.SayExplode);
|
||||
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();
|
||||
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 =>
|
||||
for (byte i = 0; i < 3; ++i)
|
||||
{
|
||||
DoCastVictim(SpellIds.Crush);
|
||||
task.Repeat(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(15));
|
||||
});
|
||||
|
||||
_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;
|
||||
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());
|
||||
}
|
||||
|
||||
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;
|
||||
task.Repeat();
|
||||
});
|
||||
}
|
||||
|
||||
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]
|
||||
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) { }
|
||||
|
||||
public override void MovementInform(MovementGeneratorType type, uint pointId)
|
||||
if (type == MovementGeneratorType.Point && pointId == Misc.PointLanding)
|
||||
{
|
||||
if (type == MovementGeneratorType.Point && pointId == Misc.PointLanding)
|
||||
{
|
||||
me.Dismount();
|
||||
me.RemoveFlag(UnitFields.Flags, UnitFlags.ImmuneToPc | UnitFlags.ImmuneToNpc);
|
||||
DoCastAOE(SpellIds.InvaderTaunt);
|
||||
}
|
||||
me.Dismount();
|
||||
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
|
||||
class spell_trollgore_consume : SpellScriptLoader
|
||||
class spell_trollgore_consume : SpellScript
|
||||
{
|
||||
public spell_trollgore_consume() : base("spell_trollgore_consume") { }
|
||||
|
||||
class spell_trollgore_consume_SpellScript : SpellScript
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
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));
|
||||
}
|
||||
return ValidateSpellInfo(SpellIds.ConsumeBuff);
|
||||
}
|
||||
|
||||
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
|
||||
class spell_trollgore_corpse_explode : SpellScriptLoader
|
||||
class spell_trollgore_corpse_explode : AuraScript
|
||||
{
|
||||
public spell_trollgore_corpse_explode() : base("spell_trollgore_corpse_explode") { }
|
||||
|
||||
class spell_trollgore_corpse_explode_AuraScript : AuraScript
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
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)
|
||||
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));
|
||||
Unit caster = GetCaster();
|
||||
if (caster)
|
||||
caster.CastSpell(GetTarget(), SpellIds.CorpseExplodeDamage, true, null, aurEff);
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
class spell_trollgore_invader_taunt : SpellScriptLoader
|
||||
class spell_trollgore_invader_taunt : SpellScript
|
||||
{
|
||||
public spell_trollgore_invader_taunt() : base("spell_trollgore_invader_taunt") { }
|
||||
|
||||
class spell_trollgore_invader_taunt_SpellScript : SpellScript
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
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));
|
||||
}
|
||||
return ValidateSpellInfo((uint)spellInfo.GetEffect(0).CalcValue());
|
||||
}
|
||||
|
||||
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();
|
||||
if (Trollgore)
|
||||
if (Trollgore.GetAI().GetData(Misc.DataConsumptionJunction) != 0)
|
||||
return true;
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user