Implement generic script loaders to greatly reduce code duplication
This commit is contained in:
@@ -66,379 +66,349 @@ namespace Scripts.Northrend.Gundrak.DrakkariColossus
|
||||
}
|
||||
|
||||
[Script]
|
||||
class boss_drakkari_colossus : CreatureScript
|
||||
class boss_drakkari_colossus : BossAI
|
||||
{
|
||||
public boss_drakkari_colossus() : base("boss_drakkari_colossus") { }
|
||||
|
||||
class boss_drakkari_colossusAI : BossAI
|
||||
public boss_drakkari_colossus(Creature creature) : base(creature, GDDataTypes.DrakkariColossus)
|
||||
{
|
||||
public boss_drakkari_colossusAI(Creature creature) : base(creature, GDDataTypes.DrakkariColossus)
|
||||
Initialize();
|
||||
me.SetReactState(ReactStates.Passive);
|
||||
introDone = false;
|
||||
}
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
phase = Misc.ColossusPhaseNormal;
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
_Reset();
|
||||
|
||||
if (GetData(Misc.DataIntroDone) != 0)
|
||||
{
|
||||
Initialize();
|
||||
me.SetReactState(ReactStates.Passive);
|
||||
introDone = false;
|
||||
}
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
phase = Misc.ColossusPhaseNormal;
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
_Reset();
|
||||
|
||||
if (GetData(Misc.DataIntroDone) != 0)
|
||||
{
|
||||
me.SetReactState(ReactStates.Aggressive);
|
||||
me.RemoveFlag(UnitFields.Flags, UnitFlags.ImmuneToPc);
|
||||
me.RemoveAura(SpellIds.FreezeAnim);
|
||||
}
|
||||
|
||||
_scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting));
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(30), task =>
|
||||
{
|
||||
DoCastVictim(SpellIds.MightyBlow);
|
||||
task.Repeat(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(15));
|
||||
});
|
||||
|
||||
Initialize();
|
||||
}
|
||||
|
||||
public override void EnterCombat(Unit who)
|
||||
{
|
||||
_EnterCombat();
|
||||
me.SetReactState(ReactStates.Aggressive);
|
||||
me.RemoveFlag(UnitFields.Flags, UnitFlags.ImmuneToPc);
|
||||
me.RemoveAura(SpellIds.FreezeAnim);
|
||||
}
|
||||
|
||||
public override void JustDied(Unit killer)
|
||||
_scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting));
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(30), task =>
|
||||
{
|
||||
_JustDied();
|
||||
DoCastVictim(SpellIds.MightyBlow);
|
||||
task.Repeat(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(15));
|
||||
});
|
||||
|
||||
Initialize();
|
||||
}
|
||||
|
||||
public override void EnterCombat(Unit who)
|
||||
{
|
||||
_EnterCombat();
|
||||
me.RemoveAura(SpellIds.FreezeAnim);
|
||||
}
|
||||
|
||||
public override void JustDied(Unit killer)
|
||||
{
|
||||
_JustDied();
|
||||
}
|
||||
|
||||
public override void DoAction(int action)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case Misc.ActionSummonElemental:
|
||||
DoCast(SpellIds.Emerge);
|
||||
break;
|
||||
case Misc.ActionFreezeColossus:
|
||||
me.GetMotionMaster().Clear();
|
||||
me.GetMotionMaster().MoveIdle();
|
||||
|
||||
me.SetReactState(ReactStates.Passive);
|
||||
me.SetFlag(UnitFields.Flags, UnitFlags.ImmuneToPc);
|
||||
DoCast(me, SpellIds.FreezeAnim);
|
||||
break;
|
||||
case Misc.ActionUnfreezeColossus:
|
||||
if (me.GetReactState() == ReactStates.Aggressive)
|
||||
return;
|
||||
|
||||
me.SetReactState(ReactStates.Aggressive);
|
||||
me.RemoveFlag(UnitFields.Flags, UnitFlags.ImmuneToPc);
|
||||
me.RemoveAura(SpellIds.FreezeAnim);
|
||||
|
||||
me.SetInCombatWithZone();
|
||||
|
||||
if (me.GetVictim())
|
||||
me.GetMotionMaster().MoveChase(me.GetVictim(), 0, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void DoAction(int action)
|
||||
public override void DamageTaken(Unit attacker, ref uint damage)
|
||||
{
|
||||
if (me.HasFlag(UnitFields.Flags, UnitFlags.ImmuneToPc))
|
||||
damage = 0;
|
||||
|
||||
if (phase == Misc.ColossusPhaseNormal ||
|
||||
phase == Misc.ColossusPhaseFirstElementalSummon)
|
||||
{
|
||||
switch (action)
|
||||
if (HealthBelowPct(phase == Misc.ColossusPhaseNormal ? 50 : 5))
|
||||
{
|
||||
case Misc.ActionSummonElemental:
|
||||
DoCast(SpellIds.Emerge);
|
||||
break;
|
||||
case Misc.ActionFreezeColossus:
|
||||
me.GetMotionMaster().Clear();
|
||||
me.GetMotionMaster().MoveIdle();
|
||||
|
||||
me.SetReactState(ReactStates.Passive);
|
||||
me.SetFlag(UnitFields.Flags, UnitFlags.ImmuneToPc);
|
||||
DoCast(me, SpellIds.FreezeAnim);
|
||||
break;
|
||||
case Misc.ActionUnfreezeColossus:
|
||||
if (me.GetReactState() == ReactStates.Aggressive)
|
||||
return;
|
||||
|
||||
me.SetReactState(ReactStates.Aggressive);
|
||||
me.RemoveFlag(UnitFields.Flags, UnitFlags.ImmuneToPc);
|
||||
me.RemoveAura(SpellIds.FreezeAnim);
|
||||
|
||||
me.SetInCombatWithZone();
|
||||
|
||||
if (me.GetVictim())
|
||||
me.GetMotionMaster().MoveChase(me.GetVictim(), 0, 0);
|
||||
break;
|
||||
damage = 0;
|
||||
phase = (phase == Misc.ColossusPhaseNormal ? Misc.ColossusPhaseFirstElementalSummon : Misc.ColossusPhaseSecondElementalSummon);
|
||||
DoAction(Misc.ActionFreezeColossus);
|
||||
DoAction(Misc.ActionSummonElemental);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void DamageTaken(Unit attacker, ref uint damage)
|
||||
public override uint GetData(uint data)
|
||||
{
|
||||
if (data == Misc.DataColossusPhase)
|
||||
return phase;
|
||||
else if (data == Misc.DataIntroDone)
|
||||
return introDone ? 1 : 0u;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override void SetData(uint type, uint data)
|
||||
{
|
||||
if (type == Misc.DataIntroDone)
|
||||
introDone = data != 0;
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
_scheduler.Update(diff);
|
||||
|
||||
if (me.HasUnitState(UnitState.Casting))
|
||||
return;
|
||||
|
||||
if (me.GetReactState() == ReactStates.Aggressive)
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
public override void JustSummoned(Creature summon)
|
||||
{
|
||||
summon.SetInCombatWithZone();
|
||||
|
||||
if (phase == Misc.ColossusPhaseSecondElementalSummon)
|
||||
summon.SetHealth(summon.GetMaxHealth() / 2);
|
||||
}
|
||||
|
||||
byte phase;
|
||||
bool introDone;
|
||||
}
|
||||
|
||||
[Script]
|
||||
class boss_drakkari_elemental : ScriptedAI
|
||||
{
|
||||
public boss_drakkari_elemental(Creature creature) : base(creature)
|
||||
{
|
||||
DoCast(me, SpellIds.ElementalSpawnEffect);
|
||||
instance = creature.GetInstanceScript();
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
_scheduler.CancelAll();
|
||||
_scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting));
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(15), task =>
|
||||
{
|
||||
if (me.HasFlag(UnitFields.Flags, UnitFlags.ImmuneToPc))
|
||||
damage = 0;
|
||||
DoCast(SpellIds.SurgeVisual);
|
||||
Unit target = SelectTarget(SelectAggroTarget.Random, 1, 0.0f, true);
|
||||
if (target)
|
||||
DoCast(target, SpellIds.Surge);
|
||||
task.Repeat(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(15));
|
||||
});
|
||||
|
||||
if (phase == Misc.ColossusPhaseNormal ||
|
||||
phase == Misc.ColossusPhaseFirstElementalSummon)
|
||||
me.AddAura(SpellIds.MojoVolley, me);
|
||||
}
|
||||
|
||||
public override void JustDied(Unit killer)
|
||||
{
|
||||
Talk(TextIds.EmoteActivateAltar);
|
||||
|
||||
Creature colossus = instance.GetCreature(GDDataTypes.DrakkariColossus);
|
||||
if (colossus)
|
||||
killer.Kill(colossus);
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
_scheduler.Update(diff);
|
||||
|
||||
if (me.HasUnitState(UnitState.Casting))
|
||||
return;
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
public override void DoAction(int action)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case Misc.ActionReturnToColossus:
|
||||
Talk(TextIds.EmoteMojo);
|
||||
DoCast(SpellIds.SurgeVisual);
|
||||
Creature colossus = instance.GetCreature(GDDataTypes.DrakkariColossus);
|
||||
if (colossus)
|
||||
// what if the elemental is more than 80 yards from drakkari colossus ?
|
||||
DoCast(colossus, SpellIds.Merge, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void DamageTaken(Unit attacker, ref uint damage)
|
||||
{
|
||||
if (HealthBelowPct(50))
|
||||
{
|
||||
Creature colossus = instance.GetCreature(GDDataTypes.DrakkariColossus);
|
||||
if (colossus)
|
||||
{
|
||||
if (HealthBelowPct(phase == Misc.ColossusPhaseNormal ? 50 : 5))
|
||||
if (colossus.GetAI().GetData(Misc.DataColossusPhase) == Misc.ColossusPhaseFirstElementalSummon)
|
||||
{
|
||||
damage = 0;
|
||||
phase = (phase == Misc.ColossusPhaseNormal ? Misc.ColossusPhaseFirstElementalSummon : Misc.ColossusPhaseSecondElementalSummon);
|
||||
DoAction(Misc.ActionFreezeColossus);
|
||||
DoAction(Misc.ActionSummonElemental);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override uint GetData(uint data)
|
||||
{
|
||||
if (data == Misc.DataColossusPhase)
|
||||
return phase;
|
||||
else if (data == Misc.DataIntroDone)
|
||||
return introDone ? 1 : 0u;
|
||||
// to prevent spell spaming
|
||||
if (me.HasUnitState(UnitState.Charging))
|
||||
return;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override void SetData(uint type, uint data)
|
||||
{
|
||||
if (type == Misc.DataIntroDone)
|
||||
introDone = data != 0;
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
_scheduler.Update(diff);
|
||||
|
||||
if (me.HasUnitState(UnitState.Casting))
|
||||
return;
|
||||
|
||||
if (me.GetReactState() == ReactStates.Aggressive)
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
public override void JustSummoned(Creature summon)
|
||||
{
|
||||
summon.SetInCombatWithZone();
|
||||
|
||||
if (phase == Misc.ColossusPhaseSecondElementalSummon)
|
||||
summon.SetHealth(summon.GetMaxHealth() / 2);
|
||||
}
|
||||
|
||||
byte phase;
|
||||
bool introDone;
|
||||
}
|
||||
|
||||
public override CreatureAI GetAI(Creature creature)
|
||||
{
|
||||
return GetInstanceAI<boss_drakkari_colossusAI>(creature);
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class boss_drakkari_elemental : CreatureScript
|
||||
{
|
||||
public boss_drakkari_elemental() : base("boss_drakkari_elemental") { }
|
||||
|
||||
class boss_drakkari_elementalAI : ScriptedAI
|
||||
{
|
||||
public boss_drakkari_elementalAI(Creature creature) : base(creature)
|
||||
{
|
||||
DoCast(me, SpellIds.ElementalSpawnEffect);
|
||||
instance = creature.GetInstanceScript();
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
_scheduler.CancelAll();
|
||||
_scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting));
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(15), task =>
|
||||
{
|
||||
DoCast(SpellIds.SurgeVisual);
|
||||
Unit target = SelectTarget(SelectAggroTarget.Random, 1, 0.0f, true);
|
||||
if (target)
|
||||
DoCast(target, SpellIds.Surge);
|
||||
task.Repeat(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(15));
|
||||
});
|
||||
|
||||
me.AddAura(SpellIds.MojoVolley, me);
|
||||
}
|
||||
|
||||
public override void JustDied(Unit killer)
|
||||
{
|
||||
Talk(TextIds.EmoteActivateAltar);
|
||||
|
||||
Creature colossus = instance.GetCreature(GDDataTypes.DrakkariColossus);
|
||||
if (colossus)
|
||||
killer.Kill(colossus);
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
_scheduler.Update(diff);
|
||||
|
||||
if (me.HasUnitState(UnitState.Casting))
|
||||
return;
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
public override void DoAction(int action)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case Misc.ActionReturnToColossus:
|
||||
Talk(TextIds.EmoteMojo);
|
||||
DoCast(SpellIds.SurgeVisual);
|
||||
Creature colossus = instance.GetCreature(GDDataTypes.DrakkariColossus);
|
||||
if (colossus)
|
||||
// what if the elemental is more than 80 yards from drakkari colossus ?
|
||||
DoCast(colossus, SpellIds.Merge, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void DamageTaken(Unit attacker, ref uint damage)
|
||||
{
|
||||
if (HealthBelowPct(50))
|
||||
{
|
||||
Creature colossus = instance.GetCreature(GDDataTypes.DrakkariColossus);
|
||||
if (colossus)
|
||||
{
|
||||
if (colossus.GetAI().GetData(Misc.DataColossusPhase) == Misc.ColossusPhaseFirstElementalSummon)
|
||||
// not sure about this, the idea of this code is to prevent bug the elemental
|
||||
// if it is not in a acceptable distance to cast the charge spell.
|
||||
if (me.GetDistance(colossus) > 80.0f)
|
||||
{
|
||||
damage = 0;
|
||||
|
||||
// to prevent spell spaming
|
||||
if (me.HasUnitState(UnitState.Charging))
|
||||
if (me.GetMotionMaster().GetCurrentMovementGeneratorType() == MovementGeneratorType.Point)
|
||||
return;
|
||||
|
||||
// not sure about this, the idea of this code is to prevent bug the elemental
|
||||
// if it is not in a acceptable distance to cast the charge spell.
|
||||
if (me.GetDistance(colossus) > 80.0f)
|
||||
{
|
||||
if (me.GetMotionMaster().GetCurrentMovementGeneratorType() == MovementGeneratorType.Point)
|
||||
return;
|
||||
|
||||
me.GetMotionMaster().MovePoint(0, colossus.GetPositionX(), colossus.GetPositionY(), colossus.GetPositionZ());
|
||||
return;
|
||||
}
|
||||
DoAction(Misc.ActionReturnToColossus);
|
||||
me.GetMotionMaster().MovePoint(0, colossus.GetPositionX(), colossus.GetPositionY(), colossus.GetPositionZ());
|
||||
return;
|
||||
}
|
||||
DoAction(Misc.ActionReturnToColossus);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void EnterEvadeMode(EvadeReason why)
|
||||
{
|
||||
me.DespawnOrUnsummon();
|
||||
}
|
||||
|
||||
public override void SpellHitTarget(Unit target, SpellInfo spell)
|
||||
{
|
||||
if (spell.Id == SpellIds.Merge)
|
||||
{
|
||||
Creature colossus = target.ToCreature();
|
||||
if (colossus)
|
||||
{
|
||||
colossus.GetAI().DoAction(Misc.ActionUnfreezeColossus);
|
||||
me.DespawnOrUnsummon();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
InstanceScript instance;
|
||||
}
|
||||
|
||||
public override CreatureAI GetAI(Creature creature)
|
||||
public override void EnterEvadeMode(EvadeReason why)
|
||||
{
|
||||
return GetInstanceAI<boss_drakkari_elementalAI>(creature);
|
||||
me.DespawnOrUnsummon();
|
||||
}
|
||||
|
||||
public override void SpellHitTarget(Unit target, SpellInfo spell)
|
||||
{
|
||||
if (spell.Id == SpellIds.Merge)
|
||||
{
|
||||
Creature colossus = target.ToCreature();
|
||||
if (colossus)
|
||||
{
|
||||
colossus.GetAI().DoAction(Misc.ActionUnfreezeColossus);
|
||||
me.DespawnOrUnsummon();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
InstanceScript instance;
|
||||
}
|
||||
|
||||
[Script]
|
||||
class npc_living_mojo : CreatureScript
|
||||
class npc_living_mojo : ScriptedAI
|
||||
{
|
||||
public npc_living_mojo() : base("npc_living_mojo") { }
|
||||
|
||||
class npc_living_mojoAI : ScriptedAI
|
||||
public npc_living_mojo(Creature creature) : base(creature)
|
||||
{
|
||||
public npc_living_mojoAI(Creature creature) : base(creature)
|
||||
{
|
||||
instance = creature.GetInstanceScript();
|
||||
}
|
||||
instance = creature.GetInstanceScript();
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
public override void Reset()
|
||||
{
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(2), task =>
|
||||
{
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(2), task =>
|
||||
{
|
||||
DoCastVictim(SpellIds.MojoWave);
|
||||
task.Repeat(TimeSpan.FromSeconds(15));
|
||||
});
|
||||
DoCastVictim(SpellIds.MojoWave);
|
||||
task.Repeat(TimeSpan.FromSeconds(15));
|
||||
});
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(7), task =>
|
||||
{
|
||||
DoCastVictim(SpellIds.MojoPuddle);
|
||||
task.Repeat(TimeSpan.FromSeconds(18));
|
||||
});
|
||||
}
|
||||
|
||||
void MoveMojos(Creature boss)
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(7), task =>
|
||||
{
|
||||
List<Creature> mojosList = new List<Creature>();
|
||||
boss.GetCreatureListWithEntryInGrid(mojosList, me.GetEntry(), 12.0f);
|
||||
if (!mojosList.Empty())
|
||||
DoCastVictim(SpellIds.MojoPuddle);
|
||||
task.Repeat(TimeSpan.FromSeconds(18));
|
||||
});
|
||||
}
|
||||
|
||||
void MoveMojos(Creature boss)
|
||||
{
|
||||
List<Creature> mojosList = new List<Creature>();
|
||||
boss.GetCreatureListWithEntryInGrid(mojosList, me.GetEntry(), 12.0f);
|
||||
if (!mojosList.Empty())
|
||||
{
|
||||
foreach (var mojo in mojosList)
|
||||
{
|
||||
foreach (var mojo in mojosList)
|
||||
{
|
||||
if (mojo)
|
||||
mojo.GetMotionMaster().MovePoint(1, boss.GetHomePosition());
|
||||
}
|
||||
if (mojo)
|
||||
mojo.GetMotionMaster().MovePoint(1, boss.GetHomePosition());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void MovementInform(MovementGeneratorType type, uint id)
|
||||
public override void MovementInform(MovementGeneratorType type, uint id)
|
||||
{
|
||||
if (type != MovementGeneratorType.Point)
|
||||
return;
|
||||
|
||||
if (id == 1)
|
||||
{
|
||||
if (type != MovementGeneratorType.Point)
|
||||
return;
|
||||
|
||||
if (id == 1)
|
||||
{
|
||||
Creature colossus = instance.GetCreature(GDDataTypes.DrakkariColossus);
|
||||
if (colossus)
|
||||
{
|
||||
colossus.GetAI().DoAction(Misc.ActionUnfreezeColossus);
|
||||
if (colossus.GetAI().GetData(Misc.DataIntroDone) == 0)
|
||||
colossus.GetAI().SetData(Misc.DataIntroDone, 1);
|
||||
colossus.SetInCombatWithZone();
|
||||
me.DespawnOrUnsummon();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void AttackStart(Unit attacker)
|
||||
{
|
||||
if (me.GetMotionMaster().GetCurrentMovementGeneratorType() == MovementGeneratorType.Point)
|
||||
return;
|
||||
|
||||
// we do this checks to see if the creature is one of the creatures that sorround the boss
|
||||
Creature colossus = instance.GetCreature(GDDataTypes.DrakkariColossus);
|
||||
if (colossus)
|
||||
{
|
||||
Position homePosition = me.GetHomePosition();
|
||||
|
||||
float distance = homePosition.GetExactDist(colossus.GetHomePosition());
|
||||
|
||||
if (distance < 12.0f)
|
||||
{
|
||||
MoveMojos(colossus);
|
||||
me.SetReactState(ReactStates.Passive);
|
||||
}
|
||||
else
|
||||
base.AttackStart(attacker);
|
||||
colossus.GetAI().DoAction(Misc.ActionUnfreezeColossus);
|
||||
if (colossus.GetAI().GetData(Misc.DataIntroDone) == 0)
|
||||
colossus.GetAI().SetData(Misc.DataIntroDone, 1);
|
||||
colossus.SetInCombatWithZone();
|
||||
me.DespawnOrUnsummon();
|
||||
}
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
//Return since we have no target
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
_scheduler.Update(diff);
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
InstanceScript instance;
|
||||
}
|
||||
|
||||
public override CreatureAI GetAI(Creature creature)
|
||||
public override void AttackStart(Unit attacker)
|
||||
{
|
||||
return GetInstanceAI<npc_living_mojoAI>(creature);
|
||||
if (me.GetMotionMaster().GetCurrentMovementGeneratorType() == MovementGeneratorType.Point)
|
||||
return;
|
||||
|
||||
// we do this checks to see if the creature is one of the creatures that sorround the boss
|
||||
Creature colossus = instance.GetCreature(GDDataTypes.DrakkariColossus);
|
||||
if (colossus)
|
||||
{
|
||||
Position homePosition = me.GetHomePosition();
|
||||
|
||||
float distance = homePosition.GetExactDist(colossus.GetHomePosition());
|
||||
|
||||
if (distance < 12.0f)
|
||||
{
|
||||
MoveMojos(colossus);
|
||||
me.SetReactState(ReactStates.Passive);
|
||||
}
|
||||
else
|
||||
base.AttackStart(attacker);
|
||||
}
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
//Return since we have no target
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
_scheduler.Update(diff);
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
InstanceScript instance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,91 +38,81 @@ namespace Scripts.Northrend.Gundrak.EckTheFerocious
|
||||
}
|
||||
|
||||
[Script]
|
||||
class boss_eck : CreatureScript
|
||||
class boss_eck : BossAI
|
||||
{
|
||||
public boss_eck() : base("boss_eck") { }
|
||||
|
||||
class boss_eckAI : BossAI
|
||||
public boss_eck(Creature creature) : base(creature, GDDataTypes.EckTheFerocious)
|
||||
{
|
||||
public boss_eckAI(Creature creature) : base(creature, GDDataTypes.EckTheFerocious)
|
||||
{
|
||||
Initialize();
|
||||
Talk(TextIds.EmoteSpawn);
|
||||
}
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
_berserk = false;
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
_Reset();
|
||||
Initialize();
|
||||
}
|
||||
|
||||
public override void EnterCombat(Unit who)
|
||||
{
|
||||
_EnterCombat();
|
||||
|
||||
_scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting));
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(5), task =>
|
||||
{
|
||||
DoCastVictim(SpellIds.Bite);
|
||||
task.Repeat(TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(12));
|
||||
});
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(10), task =>
|
||||
{
|
||||
DoCastVictim(SpellIds.Spit);
|
||||
task.Repeat(TimeSpan.FromSeconds(6), TimeSpan.FromSeconds(14));
|
||||
});
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(8), task =>
|
||||
{
|
||||
Unit target = SelectTarget(SelectAggroTarget.Random, 1, 35.0f, true);
|
||||
if (target)
|
||||
DoCast(target, RandomHelper.RAND(SpellIds.Spring1, SpellIds.Spring2));
|
||||
task.Repeat(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(10));
|
||||
});
|
||||
|
||||
// 60-90 secs according to wowwiki
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(60), TimeSpan.FromSeconds(90), 1, task =>
|
||||
{
|
||||
DoCast(me, SpellIds.Berserk);
|
||||
_berserk = true;
|
||||
});
|
||||
}
|
||||
|
||||
public override void DamageTaken(Unit attacker, ref uint damage)
|
||||
{
|
||||
if (!_berserk && me.HealthBelowPctDamaged(20, damage))
|
||||
{
|
||||
_scheduler.RescheduleGroup(1, TimeSpan.FromSeconds(1));
|
||||
_berserk = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
_scheduler.Update(diff);
|
||||
|
||||
if (me.HasUnitState(UnitState.Casting))
|
||||
return;
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
bool _berserk;
|
||||
Initialize();
|
||||
Talk(TextIds.EmoteSpawn);
|
||||
}
|
||||
|
||||
public override CreatureAI GetAI(Creature creature)
|
||||
void Initialize()
|
||||
{
|
||||
return GetInstanceAI<boss_eckAI>(creature);
|
||||
_berserk = false;
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
_Reset();
|
||||
Initialize();
|
||||
}
|
||||
|
||||
public override void EnterCombat(Unit who)
|
||||
{
|
||||
_EnterCombat();
|
||||
|
||||
_scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting));
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(5), task =>
|
||||
{
|
||||
DoCastVictim(SpellIds.Bite);
|
||||
task.Repeat(TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(12));
|
||||
});
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(10), task =>
|
||||
{
|
||||
DoCastVictim(SpellIds.Spit);
|
||||
task.Repeat(TimeSpan.FromSeconds(6), TimeSpan.FromSeconds(14));
|
||||
});
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(8), task =>
|
||||
{
|
||||
Unit target = SelectTarget(SelectAggroTarget.Random, 1, 35.0f, true);
|
||||
if (target)
|
||||
DoCast(target, RandomHelper.RAND(SpellIds.Spring1, SpellIds.Spring2));
|
||||
task.Repeat(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(10));
|
||||
});
|
||||
|
||||
// 60-90 secs according to wowwiki
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(60), TimeSpan.FromSeconds(90), 1, task =>
|
||||
{
|
||||
DoCast(me, SpellIds.Berserk);
|
||||
_berserk = true;
|
||||
});
|
||||
}
|
||||
|
||||
public override void DamageTaken(Unit attacker, ref uint damage)
|
||||
{
|
||||
if (!_berserk && me.HealthBelowPctDamaged(20, damage))
|
||||
{
|
||||
_scheduler.RescheduleGroup(1, TimeSpan.FromSeconds(1));
|
||||
_berserk = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
_scheduler.Update(diff);
|
||||
|
||||
if (me.HasUnitState(UnitState.Casting))
|
||||
return;
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
bool _berserk;
|
||||
}
|
||||
}
|
||||
@@ -322,7 +322,7 @@ namespace Scripts.Northrend.Gundrak
|
||||
|
||||
public override void ReadSaveDataMore(StringArguments data)
|
||||
{
|
||||
SladRanStatueState = (GameObjectState)data.NextUInt32();
|
||||
SladRanStatueState = (GameObjectState)data.NextUInt32();
|
||||
DrakkariColossusStatueState = (GameObjectState)data.NextUInt32();
|
||||
MoorabiStatueState = (GameObjectState)data.NextUInt32();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user