Implement generic script loaders to greatly reduce code duplication
This commit is contained in:
@@ -85,484 +85,403 @@ namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheCrusader
|
||||
}
|
||||
|
||||
[Script]
|
||||
class boss_jaraxxus : CreatureScript
|
||||
class boss_jaraxxus : BossAI
|
||||
{
|
||||
public
|
||||
boss_jaraxxus() : base("boss_jaraxxus") { }
|
||||
public boss_jaraxxus(Creature creature) : base(creature, DataTypes.BossJaraxxus) { }
|
||||
|
||||
class boss_jaraxxusAI : BossAI
|
||||
public override void Reset()
|
||||
{
|
||||
public boss_jaraxxusAI(Creature creature) : base(creature, DataTypes.BossJaraxxus) { }
|
||||
_Reset();
|
||||
_events.ScheduleEvent(Jaraxxus.EventFelFireball, 5 * Time.InMilliseconds);
|
||||
_events.ScheduleEvent(Jaraxxus.EventFelLightning, RandomHelper.URand(10 * Time.InMilliseconds, 15 * Time.InMilliseconds));
|
||||
_events.ScheduleEvent(Jaraxxus.EventIncinerateFlesh, RandomHelper.URand(20 * Time.InMilliseconds, 25 * Time.InMilliseconds));
|
||||
_events.ScheduleEvent(Jaraxxus.EventNetherPower, 40 * Time.InMilliseconds);
|
||||
_events.ScheduleEvent(Jaraxxus.EventLegionFlame, 30 * Time.InMilliseconds);
|
||||
_events.ScheduleEvent(Jaraxxus.EventSummonoNetherPortal, 20 * Time.InMilliseconds);
|
||||
_events.ScheduleEvent(Jaraxxus.EventSummonInfernalEruption, 80 * Time.InMilliseconds);
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
public override void JustReachedHome()
|
||||
{
|
||||
_JustReachedHome();
|
||||
instance.SetBossState(DataTypes.BossJaraxxus, EncounterState.Fail);
|
||||
DoCast(me, Spells.JaraxxusChains);
|
||||
me.SetFlag(UnitFields.Flags, UnitFlags.NonAttackable);
|
||||
}
|
||||
|
||||
public override void KilledUnit(Unit who)
|
||||
{
|
||||
if (who.IsTypeId(TypeId.Player))
|
||||
{
|
||||
_Reset();
|
||||
_events.ScheduleEvent(Jaraxxus.EventFelFireball, 5 * Time.InMilliseconds);
|
||||
_events.ScheduleEvent(Jaraxxus.EventFelLightning, RandomHelper.URand(10 * Time.InMilliseconds, 15 * Time.InMilliseconds));
|
||||
_events.ScheduleEvent(Jaraxxus.EventIncinerateFlesh, RandomHelper.URand(20 * Time.InMilliseconds, 25 * Time.InMilliseconds));
|
||||
_events.ScheduleEvent(Jaraxxus.EventNetherPower, 40 * Time.InMilliseconds);
|
||||
_events.ScheduleEvent(Jaraxxus.EventLegionFlame, 30 * Time.InMilliseconds);
|
||||
_events.ScheduleEvent(Jaraxxus.EventSummonoNetherPortal, 20 * Time.InMilliseconds);
|
||||
_events.ScheduleEvent(Jaraxxus.EventSummonInfernalEruption, 80 * Time.InMilliseconds);
|
||||
Talk(Jaraxxus.SayKillPlayer);
|
||||
instance.SetData(DataTypes.TributeToImmortalityEligible, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public override void JustReachedHome()
|
||||
{
|
||||
_JustReachedHome();
|
||||
instance.SetBossState(DataTypes.BossJaraxxus, EncounterState.Fail);
|
||||
DoCast(me, Spells.JaraxxusChains);
|
||||
me.SetFlag(UnitFields.Flags, UnitFlags.NonAttackable);
|
||||
}
|
||||
public override void JustDied(Unit killer)
|
||||
{
|
||||
_JustDied();
|
||||
Talk(Jaraxxus.SayDeath);
|
||||
}
|
||||
|
||||
public override void KilledUnit(Unit who)
|
||||
public override void JustSummoned(Creature summoned)
|
||||
{
|
||||
summons.Summon(summoned);
|
||||
}
|
||||
|
||||
public override void EnterCombat(Unit who)
|
||||
{
|
||||
_EnterCombat();
|
||||
Talk(Jaraxxus.SayAggro);
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
_events.Update(diff);
|
||||
|
||||
if (me.HasUnitState(UnitState.Casting))
|
||||
return;
|
||||
|
||||
_events.ExecuteEvents(eventId =>
|
||||
{
|
||||
if (who.IsTypeId(TypeId.Player))
|
||||
switch (eventId)
|
||||
{
|
||||
Talk(Jaraxxus.SayKillPlayer);
|
||||
instance.SetData(DataTypes.TributeToImmortalityEligible, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public override void JustDied(Unit killer)
|
||||
{
|
||||
_JustDied();
|
||||
Talk(Jaraxxus.SayDeath);
|
||||
}
|
||||
|
||||
public override void JustSummoned(Creature summoned)
|
||||
{
|
||||
summons.Summon(summoned);
|
||||
}
|
||||
|
||||
public override void EnterCombat(Unit who)
|
||||
{
|
||||
_EnterCombat();
|
||||
Talk(Jaraxxus.SayAggro);
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
_events.Update(diff);
|
||||
|
||||
if (me.HasUnitState(UnitState.Casting))
|
||||
return;
|
||||
|
||||
_events.ExecuteEvents(eventId =>
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case Jaraxxus.EventFelFireball:
|
||||
DoCastVictim(Jaraxxus.SpellFelFireball);
|
||||
_events.ScheduleEvent(Jaraxxus.EventFelFireball, RandomHelper.URand(10 * Time.InMilliseconds, 15 * Time.InMilliseconds));
|
||||
return;
|
||||
case Jaraxxus.EventFelLightning:
|
||||
{
|
||||
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true, -Jaraxxus.SpellLordHittin);
|
||||
if (target)
|
||||
DoCast(target, Jaraxxus.SpellFelLighting);
|
||||
_events.ScheduleEvent(Jaraxxus.EventFelLightning, RandomHelper.URand(10 * Time.InMilliseconds, 15 * Time.InMilliseconds));
|
||||
return;
|
||||
}
|
||||
case Jaraxxus.EventIncinerateFlesh:
|
||||
{
|
||||
Unit target = SelectTarget(SelectAggroTarget.Random, 1, 0.0f, true, -Jaraxxus.SpellLordHittin);
|
||||
if (target)
|
||||
{
|
||||
Talk(Jaraxxus.EmoteIncinerate, target);
|
||||
Talk(Jaraxxus.SayIncinerate);
|
||||
DoCast(target, Jaraxxus.SpellInfernalEruption);
|
||||
}
|
||||
_events.ScheduleEvent(Jaraxxus.EventIncinerateFlesh, RandomHelper.URand(20 * Time.InMilliseconds, 25 * Time.InMilliseconds));
|
||||
return;
|
||||
}
|
||||
case Jaraxxus.EventNetherPower:
|
||||
me.CastCustomSpell(Jaraxxus.SpellNetherPower, SpellValueMod.AuraStack, RaidMode(5, 10, 5, 10), me, true);
|
||||
_events.ScheduleEvent(Jaraxxus.EventNetherPower, 40 * Time.InMilliseconds);
|
||||
return;
|
||||
case Jaraxxus.EventLegionFlame:
|
||||
{
|
||||
Unit target = SelectTarget(SelectAggroTarget.Random, 1, 0.0f, true, -Jaraxxus.SpellLordHittin);
|
||||
if (target)
|
||||
{
|
||||
Talk(Jaraxxus.EmoteLegionFlame, target);
|
||||
DoCast(target, Jaraxxus.SpellLegionFlame);
|
||||
}
|
||||
_events.ScheduleEvent(Jaraxxus.EventLegionFlame, 30 * Time.InMilliseconds);
|
||||
return;
|
||||
}
|
||||
case Jaraxxus.EventSummonoNetherPortal:
|
||||
Talk(Jaraxxus.EmoteNetherPortal);
|
||||
Talk(Jaraxxus.SayMistressOfPain);
|
||||
DoCast(Jaraxxus.SpellNetherPortal);
|
||||
_events.ScheduleEvent(Jaraxxus.EventSummonoNetherPortal, 2 * Time.Minute * Time.InMilliseconds);
|
||||
return;
|
||||
case Jaraxxus.EventSummonInfernalEruption:
|
||||
Talk(Jaraxxus.EmoteInfernalEruption);
|
||||
Talk(Jaraxxus.SayInfernalEruption);
|
||||
DoCast(Jaraxxus.SpellInfernalEruption);
|
||||
_events.ScheduleEvent(Jaraxxus.EventSummonInfernalEruption, 2 * Time.Minute * Time.InMilliseconds);
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
}
|
||||
|
||||
public override CreatureAI GetAI(Creature creature)
|
||||
{
|
||||
return GetInstanceAI<boss_jaraxxusAI>(creature);
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class npc_legion_flame : CreatureScript
|
||||
{
|
||||
public npc_legion_flame() : base("npc_legion_flame") { }
|
||||
|
||||
class npc_legion_flameAI : ScriptedAI
|
||||
{
|
||||
public npc_legion_flameAI(Creature creature) : base(creature)
|
||||
{
|
||||
SetCombatMovement(false);
|
||||
_instance = creature.GetInstanceScript();
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
me.SetFlag(UnitFields.Flags, UnitFlags.NonAttackable | UnitFlags.NotSelectable);
|
||||
me.SetInCombatWithZone();
|
||||
DoCast(Jaraxxus.SpellLegionFlameEffect);
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
UpdateVictim();
|
||||
if (_instance.GetBossState(DataTypes.BossJaraxxus) != EncounterState.InProgress)
|
||||
me.DespawnOrUnsummon();
|
||||
}
|
||||
|
||||
InstanceScript _instance;
|
||||
}
|
||||
|
||||
public override CreatureAI GetAI(Creature creature)
|
||||
{
|
||||
return GetInstanceAI<npc_legion_flameAI>(creature);
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class npc_infernal_volcano : CreatureScript
|
||||
{
|
||||
public npc_infernal_volcano() : base("npc_infernal_volcano") { }
|
||||
|
||||
class npc_infernal_volcanoAI : ScriptedAI
|
||||
{
|
||||
public npc_infernal_volcanoAI(Creature creature) : base(creature)
|
||||
{
|
||||
_summons = new SummonList(me);
|
||||
SetCombatMovement(false);
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
me.SetReactState(ReactStates.Passive);
|
||||
|
||||
if (!IsHeroic())
|
||||
me.SetFlag(UnitFields.Flags, UnitFlags.NonAttackable | UnitFlags.NotSelectable | UnitFlags.Pacified);
|
||||
else
|
||||
me.RemoveFlag(UnitFields.Flags, UnitFlags.NonAttackable | UnitFlags.NotSelectable | UnitFlags.Pacified);
|
||||
|
||||
_summons.DespawnAll();
|
||||
}
|
||||
|
||||
public override void IsSummonedBy(Unit summoner)
|
||||
{
|
||||
DoCast(Jaraxxus.SpellInfernalEruptionEffect);
|
||||
}
|
||||
|
||||
public override void JustSummoned(Creature summoned)
|
||||
{
|
||||
_summons.Summon(summoned);
|
||||
// makes immediate corpse despawn of summoned Felflame Infernals
|
||||
summoned.SetCorpseDelay(0);
|
||||
}
|
||||
|
||||
public override void JustDied(Unit killer)
|
||||
{
|
||||
// used to despawn corpse immediately
|
||||
me.DespawnOrUnsummon();
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff) { }
|
||||
|
||||
SummonList _summons;
|
||||
}
|
||||
|
||||
public override CreatureAI GetAI(Creature creature)
|
||||
{
|
||||
return new npc_infernal_volcanoAI(creature);
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class npc_fel_infernal : CreatureScript
|
||||
{
|
||||
public npc_fel_infernal() : base("npc_fel_infernal") { }
|
||||
|
||||
class npc_fel_infernalAI : ScriptedAI
|
||||
{
|
||||
public npc_fel_infernalAI(Creature creature) : base(creature)
|
||||
{
|
||||
_instance = creature.GetInstanceScript();
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
_felStreakTimer = 30 * Time.InMilliseconds;
|
||||
me.SetInCombatWithZone();
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
if (_instance.GetBossState(DataTypes.BossJaraxxus) != EncounterState.InProgress)
|
||||
{
|
||||
me.DespawnOrUnsummon();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if (_felStreakTimer <= diff)
|
||||
{
|
||||
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true);
|
||||
if (target)
|
||||
DoCast(target, Jaraxxus.SpellFelStreak);
|
||||
_felStreakTimer = 30 * Time.InMilliseconds;
|
||||
}
|
||||
else
|
||||
_felStreakTimer -= diff;
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
uint _felStreakTimer;
|
||||
InstanceScript _instance;
|
||||
}
|
||||
|
||||
public override CreatureAI GetAI(Creature creature)
|
||||
{
|
||||
return GetInstanceAI<npc_fel_infernalAI>(creature);
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class npc_nether_portal : CreatureScript
|
||||
{
|
||||
public npc_nether_portal() : base("npc_nether_portal") { }
|
||||
|
||||
class npc_nether_portalAI : ScriptedAI
|
||||
{
|
||||
public npc_nether_portalAI(Creature creature) : base(creature)
|
||||
{
|
||||
_summons = new SummonList(me);
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
me.SetReactState(ReactStates.Passive);
|
||||
|
||||
if (!IsHeroic())
|
||||
me.SetFlag(UnitFields.Flags, UnitFlags.NonAttackable | UnitFlags.NotSelectable | UnitFlags.Pacified);
|
||||
else
|
||||
me.RemoveFlag(UnitFields.Flags, UnitFlags.NonAttackable | UnitFlags.NotSelectable | UnitFlags.Pacified);
|
||||
|
||||
_summons.DespawnAll();
|
||||
}
|
||||
|
||||
public override void IsSummonedBy(Unit summoner)
|
||||
{
|
||||
DoCast(Jaraxxus.SpellNetherPortalEffect);
|
||||
}
|
||||
|
||||
public override void JustSummoned(Creature summoned)
|
||||
{
|
||||
_summons.Summon(summoned);
|
||||
// makes immediate corpse despawn of summoned Mistress of Pain
|
||||
summoned.SetCorpseDelay(0);
|
||||
}
|
||||
|
||||
public override void JustDied(Unit killer)
|
||||
{
|
||||
// used to despawn corpse immediately
|
||||
me.DespawnOrUnsummon();
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff) { }
|
||||
|
||||
SummonList _summons;
|
||||
}
|
||||
|
||||
public override CreatureAI GetAI(Creature creature)
|
||||
{
|
||||
return new npc_nether_portalAI(creature);
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class npc_mistress_of_pain : CreatureScript
|
||||
{
|
||||
public npc_mistress_of_pain() : base("npc_mistress_of_pain") { }
|
||||
|
||||
class npc_mistress_of_painAI : ScriptedAI
|
||||
{
|
||||
public npc_mistress_of_painAI(Creature creature) : base(creature)
|
||||
{
|
||||
_instance = creature.GetInstanceScript();
|
||||
_instance.SetData(DataTypes.MistressOfPainCount, DataTypes.Increase);
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
_events.ScheduleEvent(Jaraxxus.EventShivanSlash, 30 * Time.InMilliseconds);
|
||||
_events.ScheduleEvent(Jaraxxus.EventSpinningStrike, 30 * Time.InMilliseconds);
|
||||
if (IsHeroic())
|
||||
_events.ScheduleEvent(Jaraxxus.EventMistressKiss, 15 * Time.InMilliseconds);
|
||||
me.SetInCombatWithZone();
|
||||
}
|
||||
|
||||
public override void JustDied(Unit killer)
|
||||
{
|
||||
_instance.SetData(DataTypes.MistressOfPainCount, DataTypes.Decrease);
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
if (_instance.GetBossState(DataTypes.BossJaraxxus) != EncounterState.InProgress)
|
||||
{
|
||||
me.DespawnOrUnsummon();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
_events.Update(diff);
|
||||
|
||||
if (me.HasUnitState(UnitState.Casting))
|
||||
return;
|
||||
|
||||
_events.ExecuteEvents(eventId =>
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case Jaraxxus.EventShivanSlash:
|
||||
DoCastVictim(Jaraxxus.SpellShivanSlash);
|
||||
_events.ScheduleEvent(Jaraxxus.EventShivanSlash, 30 * Time.InMilliseconds);
|
||||
return;
|
||||
case Jaraxxus.EventSpinningStrike:
|
||||
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true);
|
||||
case Jaraxxus.EventFelFireball:
|
||||
DoCastVictim(Jaraxxus.SpellFelFireball);
|
||||
_events.ScheduleEvent(Jaraxxus.EventFelFireball, RandomHelper.URand(10 * Time.InMilliseconds, 15 * Time.InMilliseconds));
|
||||
return;
|
||||
case Jaraxxus.EventFelLightning:
|
||||
{
|
||||
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true, -Jaraxxus.SpellLordHittin);
|
||||
if (target)
|
||||
DoCast(target, Jaraxxus.SpellSpinningStrike);
|
||||
_events.ScheduleEvent(Jaraxxus.EventSpinningStrike, 30 * Time.InMilliseconds);
|
||||
DoCast(target, Jaraxxus.SpellFelLighting);
|
||||
_events.ScheduleEvent(Jaraxxus.EventFelLightning, RandomHelper.URand(10 * Time.InMilliseconds, 15 * Time.InMilliseconds));
|
||||
return;
|
||||
case Jaraxxus.EventMistressKiss:
|
||||
DoCast(me, Jaraxxus.SpellMistressKiss);
|
||||
_events.ScheduleEvent(Jaraxxus.EventMistressKiss, 30 * Time.InMilliseconds);
|
||||
}
|
||||
case Jaraxxus.EventIncinerateFlesh:
|
||||
{
|
||||
Unit target = SelectTarget(SelectAggroTarget.Random, 1, 0.0f, true, -Jaraxxus.SpellLordHittin);
|
||||
if (target)
|
||||
{
|
||||
Talk(Jaraxxus.EmoteIncinerate, target);
|
||||
Talk(Jaraxxus.SayIncinerate);
|
||||
DoCast(target, Jaraxxus.SpellInfernalEruption);
|
||||
}
|
||||
_events.ScheduleEvent(Jaraxxus.EventIncinerateFlesh, RandomHelper.URand(20 * Time.InMilliseconds, 25 * Time.InMilliseconds));
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
case Jaraxxus.EventNetherPower:
|
||||
me.CastCustomSpell(Jaraxxus.SpellNetherPower, SpellValueMod.AuraStack, RaidMode(5, 10, 5, 10), me, true);
|
||||
_events.ScheduleEvent(Jaraxxus.EventNetherPower, 40 * Time.InMilliseconds);
|
||||
return;
|
||||
case Jaraxxus.EventLegionFlame:
|
||||
{
|
||||
Unit target = SelectTarget(SelectAggroTarget.Random, 1, 0.0f, true, -Jaraxxus.SpellLordHittin);
|
||||
if (target)
|
||||
{
|
||||
Talk(Jaraxxus.EmoteLegionFlame, target);
|
||||
DoCast(target, Jaraxxus.SpellLegionFlame);
|
||||
}
|
||||
_events.ScheduleEvent(Jaraxxus.EventLegionFlame, 30 * Time.InMilliseconds);
|
||||
return;
|
||||
}
|
||||
case Jaraxxus.EventSummonoNetherPortal:
|
||||
Talk(Jaraxxus.EmoteNetherPortal);
|
||||
Talk(Jaraxxus.SayMistressOfPain);
|
||||
DoCast(Jaraxxus.SpellNetherPortal);
|
||||
_events.ScheduleEvent(Jaraxxus.EventSummonoNetherPortal, 2 * Time.Minute * Time.InMilliseconds);
|
||||
return;
|
||||
case Jaraxxus.EventSummonInfernalEruption:
|
||||
Talk(Jaraxxus.EmoteInfernalEruption);
|
||||
Talk(Jaraxxus.SayInfernalEruption);
|
||||
DoCast(Jaraxxus.SpellInfernalEruption);
|
||||
_events.ScheduleEvent(Jaraxxus.EventSummonInfernalEruption, 2 * Time.Minute * Time.InMilliseconds);
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
InstanceScript _instance;
|
||||
}
|
||||
|
||||
public override CreatureAI GetAI(Creature creature)
|
||||
{
|
||||
return GetInstanceAI<npc_mistress_of_painAI>(creature);
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class spell_mistress_kiss : SpellScriptLoader
|
||||
class npc_legion_flame : ScriptedAI
|
||||
{
|
||||
public spell_mistress_kiss() : base("spell_mistress_kiss") { }
|
||||
|
||||
class spell_mistress_kiss_AuraScript : AuraScript
|
||||
public npc_legion_flame(Creature creature) : base(creature)
|
||||
{
|
||||
public override bool Load()
|
||||
SetCombatMovement(false);
|
||||
_instance = creature.GetInstanceScript();
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
me.SetFlag(UnitFields.Flags, UnitFlags.NonAttackable | UnitFlags.NotSelectable);
|
||||
me.SetInCombatWithZone();
|
||||
DoCast(Jaraxxus.SpellLegionFlameEffect);
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
UpdateVictim();
|
||||
if (_instance.GetBossState(DataTypes.BossJaraxxus) != EncounterState.InProgress)
|
||||
me.DespawnOrUnsummon();
|
||||
}
|
||||
|
||||
InstanceScript _instance;
|
||||
}
|
||||
|
||||
[Script]
|
||||
class npc_infernal_volcano : ScriptedAI
|
||||
{
|
||||
public npc_infernal_volcano(Creature creature) : base(creature)
|
||||
{
|
||||
_summons = new SummonList(me);
|
||||
SetCombatMovement(false);
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
me.SetReactState(ReactStates.Passive);
|
||||
|
||||
if (!IsHeroic())
|
||||
me.SetFlag(UnitFields.Flags, UnitFlags.NonAttackable | UnitFlags.NotSelectable | UnitFlags.Pacified);
|
||||
else
|
||||
me.RemoveFlag(UnitFields.Flags, UnitFlags.NonAttackable | UnitFlags.NotSelectable | UnitFlags.Pacified);
|
||||
|
||||
_summons.DespawnAll();
|
||||
}
|
||||
|
||||
public override void IsSummonedBy(Unit summoner)
|
||||
{
|
||||
DoCast(Jaraxxus.SpellInfernalEruptionEffect);
|
||||
}
|
||||
|
||||
public override void JustSummoned(Creature summoned)
|
||||
{
|
||||
_summons.Summon(summoned);
|
||||
// makes immediate corpse despawn of summoned Felflame Infernals
|
||||
summoned.SetCorpseDelay(0);
|
||||
}
|
||||
|
||||
public override void JustDied(Unit killer)
|
||||
{
|
||||
// used to despawn corpse immediately
|
||||
me.DespawnOrUnsummon();
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff) { }
|
||||
|
||||
SummonList _summons;
|
||||
}
|
||||
|
||||
[Script]
|
||||
class npc_fel_infernal : ScriptedAI
|
||||
{
|
||||
public npc_fel_infernal(Creature creature) : base(creature)
|
||||
{
|
||||
_instance = creature.GetInstanceScript();
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
_felStreakTimer = 30 * Time.InMilliseconds;
|
||||
me.SetInCombatWithZone();
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
if (_instance.GetBossState(DataTypes.BossJaraxxus) != EncounterState.InProgress)
|
||||
{
|
||||
return ValidateSpellInfo(Jaraxxus.SpellMistressKissDamageSilence);
|
||||
me.DespawnOrUnsummon();
|
||||
return;
|
||||
}
|
||||
|
||||
void HandleDummyTick(AuraEffect aurEff)
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if (_felStreakTimer <= diff)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
Unit target = GetTarget();
|
||||
if (caster && target)
|
||||
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true);
|
||||
if (target)
|
||||
DoCast(target, Jaraxxus.SpellFelStreak);
|
||||
_felStreakTimer = 30 * Time.InMilliseconds;
|
||||
}
|
||||
else
|
||||
_felStreakTimer -= diff;
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
uint _felStreakTimer;
|
||||
InstanceScript _instance;
|
||||
}
|
||||
|
||||
[Script]
|
||||
class npc_nether_portal : ScriptedAI
|
||||
{
|
||||
public npc_nether_portal(Creature creature) : base(creature)
|
||||
{
|
||||
_summons = new SummonList(me);
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
me.SetReactState(ReactStates.Passive);
|
||||
|
||||
if (!IsHeroic())
|
||||
me.SetFlag(UnitFields.Flags, UnitFlags.NonAttackable | UnitFlags.NotSelectable | UnitFlags.Pacified);
|
||||
else
|
||||
me.RemoveFlag(UnitFields.Flags, UnitFlags.NonAttackable | UnitFlags.NotSelectable | UnitFlags.Pacified);
|
||||
|
||||
_summons.DespawnAll();
|
||||
}
|
||||
|
||||
public override void IsSummonedBy(Unit summoner)
|
||||
{
|
||||
DoCast(Jaraxxus.SpellNetherPortalEffect);
|
||||
}
|
||||
|
||||
public override void JustSummoned(Creature summoned)
|
||||
{
|
||||
_summons.Summon(summoned);
|
||||
// makes immediate corpse despawn of summoned Mistress of Pain
|
||||
summoned.SetCorpseDelay(0);
|
||||
}
|
||||
|
||||
public override void JustDied(Unit killer)
|
||||
{
|
||||
// used to despawn corpse immediately
|
||||
me.DespawnOrUnsummon();
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff) { }
|
||||
|
||||
SummonList _summons;
|
||||
}
|
||||
|
||||
[Script]
|
||||
class npc_mistress_of_pain : ScriptedAI
|
||||
{
|
||||
public npc_mistress_of_pain(Creature creature) : base(creature)
|
||||
{
|
||||
_instance = creature.GetInstanceScript();
|
||||
_instance.SetData(DataTypes.MistressOfPainCount, DataTypes.Increase);
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
_events.ScheduleEvent(Jaraxxus.EventShivanSlash, 30 * Time.InMilliseconds);
|
||||
_events.ScheduleEvent(Jaraxxus.EventSpinningStrike, 30 * Time.InMilliseconds);
|
||||
if (IsHeroic())
|
||||
_events.ScheduleEvent(Jaraxxus.EventMistressKiss, 15 * Time.InMilliseconds);
|
||||
me.SetInCombatWithZone();
|
||||
}
|
||||
|
||||
public override void JustDied(Unit killer)
|
||||
{
|
||||
_instance.SetData(DataTypes.MistressOfPainCount, DataTypes.Decrease);
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
if (_instance.GetBossState(DataTypes.BossJaraxxus) != EncounterState.InProgress)
|
||||
{
|
||||
me.DespawnOrUnsummon();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
_events.Update(diff);
|
||||
|
||||
if (me.HasUnitState(UnitState.Casting))
|
||||
return;
|
||||
|
||||
_events.ExecuteEvents(eventId =>
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
if (target.HasUnitState(UnitState.Casting))
|
||||
{
|
||||
caster.CastSpell(target, Jaraxxus.SpellMistressKissDamageSilence, true);
|
||||
target.RemoveAurasDueToSpell(GetSpellInfo().Id);
|
||||
}
|
||||
case Jaraxxus.EventShivanSlash:
|
||||
DoCastVictim(Jaraxxus.SpellShivanSlash);
|
||||
_events.ScheduleEvent(Jaraxxus.EventShivanSlash, 30 * Time.InMilliseconds);
|
||||
return;
|
||||
case Jaraxxus.EventSpinningStrike:
|
||||
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true);
|
||||
if (target)
|
||||
DoCast(target, Jaraxxus.SpellSpinningStrike);
|
||||
_events.ScheduleEvent(Jaraxxus.EventSpinningStrike, 30 * Time.InMilliseconds);
|
||||
return;
|
||||
case Jaraxxus.EventMistressKiss:
|
||||
DoCast(me, Jaraxxus.SpellMistressKiss);
|
||||
_events.ScheduleEvent(Jaraxxus.EventMistressKiss, 30 * Time.InMilliseconds);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
InstanceScript _instance;
|
||||
}
|
||||
|
||||
[Script]
|
||||
class spell_mistress_kiss : AuraScript
|
||||
{
|
||||
public override bool Load()
|
||||
{
|
||||
return ValidateSpellInfo(Jaraxxus.SpellMistressKissDamageSilence);
|
||||
}
|
||||
|
||||
void HandleDummyTick(AuraEffect aurEff)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
Unit target = GetTarget();
|
||||
if (caster && target)
|
||||
{
|
||||
if (target.HasUnitState(UnitState.Casting))
|
||||
{
|
||||
caster.CastSpell(target, Jaraxxus.SpellMistressKissDamageSilence, true);
|
||||
target.RemoveAurasDueToSpell(GetSpellInfo().Id);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(HandleDummyTick, 0, AuraType.PeriodicDummy));
|
||||
}
|
||||
}
|
||||
|
||||
public override AuraScript GetAuraScript()
|
||||
public override void Register()
|
||||
{
|
||||
return new spell_mistress_kiss_AuraScript();
|
||||
OnEffectPeriodic.Add(new EffectPeriodicHandler(HandleDummyTick, 0, AuraType.PeriodicDummy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class spell_mistress_kiss_area : SpellScriptLoader
|
||||
class spell_mistress_kiss_area : SpellScript
|
||||
{
|
||||
public spell_mistress_kiss_area() : base("spell_mistress_kiss_area") { }
|
||||
|
||||
class spell_mistress_kiss_area_SpellScript : SpellScript
|
||||
void FilterTargets(List<WorldObject> targets)
|
||||
{
|
||||
void FilterTargets(List<WorldObject> targets)
|
||||
{
|
||||
// get a list of players with mana
|
||||
targets.RemoveAll(unit => unit.IsTypeId(TypeId.Player) && unit.ToPlayer().getPowerType() == PowerType.Mana);
|
||||
if (targets.Empty())
|
||||
return;
|
||||
// get a list of players with mana
|
||||
targets.RemoveAll(unit => unit.IsTypeId(TypeId.Player) && unit.ToPlayer().getPowerType() == PowerType.Mana);
|
||||
if (targets.Empty())
|
||||
return;
|
||||
|
||||
WorldObject target = targets.SelectRandom();
|
||||
targets.Clear();
|
||||
targets.Add(target);
|
||||
}
|
||||
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
GetCaster().CastSpell(GetHitUnit(), (uint)GetEffectValue(), true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitSrcAreaEnemy));
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
WorldObject target = targets.SelectRandom();
|
||||
targets.Clear();
|
||||
targets.Add(target);
|
||||
}
|
||||
|
||||
public override SpellScript GetSpellScript()
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
return new spell_mistress_kiss_area_SpellScript();
|
||||
GetCaster().CastSpell(GetHitUnit(), (uint)GetEffectValue(), true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitSrcAreaEnemy));
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -270,7 +270,7 @@ namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheCrusader
|
||||
|
||||
public const uint DisplayIdDestroyedFloor = 9060;
|
||||
|
||||
public static BossBoundaryEntry[] boundaries =
|
||||
public static BossBoundaryEntry[] boundaries =
|
||||
{
|
||||
new BossBoundaryEntry(DataTypes.BossBeasts, new CircleBoundary(new Position(563.26f, 139.6f), 75.0)),
|
||||
new BossBoundaryEntry(DataTypes.BossJaraxxus, new CircleBoundary(new Position(563.26f, 139.6f), 75.0)),
|
||||
|
||||
Reference in New Issue
Block a user