Start adding missing scripts Part4

This commit is contained in:
hondacrx
2022-07-08 11:43:58 -04:00
parent 7e01c50655
commit f42b21a6de
22 changed files with 3740 additions and 2 deletions
@@ -0,0 +1,113 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.AI;
using Game.Entities;
using Game.Scripting;
using Game.Spells;
using System;
namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.BaronGeddon
{
struct SpellIds
{
public const uint Inferno = 19695;
public const uint InfernoDmg = 19698;
public const uint IgniteMana = 19659;
public const uint LivingBomb = 20475;
public const uint Armageddon = 20478;
}
struct TextIds
{
public const uint EmoteService = 0;
}
[Script]
class boss_baron_geddon : BossAI
{
public boss_baron_geddon(Creature creature) : base(creature, BossIds.BaronGeddon) { }
public override void JustEngagedWith(Unit victim)
{
base.JustEngagedWith(victim);
_scheduler.Schedule(TimeSpan.FromSeconds(45), task =>
{
DoCast(me, SpellIds.Inferno);
task.Repeat(TimeSpan.FromSeconds(45));
});
_scheduler.Schedule(TimeSpan.FromSeconds(30), task =>
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 0.0f, true, true, -(int)SpellIds.IgniteMana);
if (target)
DoCast(target, SpellIds.IgniteMana);
task.Repeat(TimeSpan.FromSeconds(30));
});
_scheduler.Schedule(TimeSpan.FromSeconds(35), task =>
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 0.0f, true);
if (target)
DoCast(target, SpellIds.LivingBomb);
task.Repeat(TimeSpan.FromSeconds(35));
});
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
// If we are <2% hp cast Armageddon
if (!HealthAbovePct(2))
{
me.InterruptNonMeleeSpells(true);
DoCast(me, SpellIds.Armageddon);
Talk(TextIds.EmoteService);
return;
}
if (me.HasUnitState(UnitState.Casting))
return;
DoMeleeAttackIfReady();
}
}
[Script] // 19695 - Inferno
class spell_baron_geddon_inferno : AuraScript
{
void OnPeriodic(AuraEffect aurEff)
{
PreventDefaultAction();
int[] damageForTick = { 500, 500, 1000, 1000, 2000, 2000, 3000, 5000 };
CastSpellExtraArgs args = new CastSpellExtraArgs(TriggerCastFlags.FullMask);
args.TriggeringAura = aurEff;
args.AddSpellMod(SpellValueMod.BasePoint0, damageForTick[aurEff.GetTickNumber() - 1]);
GetTarget().CastSpell((WorldObject)null, SpellIds.InfernoDmg, args);
}
public override void Register()
{
OnEffectPeriodic.Add(new EffectPeriodicHandler(OnPeriodic, 0, AuraType.PeriodicTriggerSpell));
}
}
}
@@ -0,0 +1,131 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.AI;
using Game.Entities;
using Game.Scripting;
using Game.Spells;
using System;
namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.Garr
{
struct SpellIds
{
// Garr
public const uint AntimagicPulse = 19492;
public const uint MagmaShackles = 19496;
public const uint Enrage = 19516;
public const uint SeparationAnxiety = 23492;
// Adds
public const uint Eruption = 19497;
public const uint Immolate = 15732;
}
[Script]
class boss_garr : BossAI
{
public boss_garr(Creature creature) : base(creature, BossIds.Garr) { }
public override void JustEngagedWith(Unit victim)
{
base.JustEngagedWith(victim);
_scheduler.Schedule(TimeSpan.FromSeconds(25), task =>
{
DoCast(me, SpellIds.AntimagicPulse);
task.Repeat(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(15));
});
_scheduler.Schedule(TimeSpan.FromSeconds(15), task =>
{
DoCast(me, SpellIds.MagmaShackles);
task.Repeat(TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(12));
});
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff, () => DoMeleeAttackIfReady());
}
}
[Script]
class npc_firesworn : ScriptedAI
{
public npc_firesworn(Creature creature) : base(creature) { }
void ScheduleTasks()
{
// Timers for this are probably wrong
_scheduler.Schedule(TimeSpan.FromSeconds(4), task =>
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0);
if (target)
DoCast(target, SpellIds.Immolate);
task.Repeat(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(10));
});
// Separation Anxiety - Periodically check if Garr is nearby
// ...and enrage if he is not.
_scheduler.Schedule(TimeSpan.FromSeconds(3), task =>
{
if (!me.FindNearestCreature(MCCreatureIds.Garr, 20.0f))
DoCastSelf(SpellIds.SeparationAnxiety);
else if (me.HasAura(SpellIds.SeparationAnxiety))
me.RemoveAurasDueToSpell(SpellIds.SeparationAnxiety);
task.Repeat();
});
}
public override void Reset()
{
_scheduler.CancelAll();
}
public override void JustEngagedWith(Unit who)
{
ScheduleTasks();
}
public override void DamageTaken(Unit attacker, ref uint damage, DamageEffectType damageType, SpellInfo spellInfo = null)
{
ulong health10pct = me.CountPctFromMaxHealth(10);
ulong health = me.GetHealth();
if (health - damage < health10pct)
{
damage = 0;
DoCastVictim(SpellIds.Eruption);
me.DespawnOrUnsummon();
}
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff, () => DoMeleeAttackIfReady());
}
}
}
@@ -0,0 +1,71 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Game.AI;
using Game.Entities;
using Game.Scripting;
using System;
namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.Gehennas
{
struct SpellIds
{
public const uint GehennasCurse = 19716;
public const uint RainOfFire = 19717;
public const uint ShadowBolt = 19728;
}
[Script]
class boss_gehennas : BossAI
{
public boss_gehennas(Creature creature) : base(creature, BossIds.Gehennas) { }
public override void JustEngagedWith(Unit victim)
{
base.JustEngagedWith(victim);
_scheduler.Schedule(TimeSpan.FromSeconds(12), task =>
{
DoCastVictim(SpellIds.GehennasCurse);
task.Repeat(TimeSpan.FromSeconds(22), TimeSpan.FromSeconds(30));
});
_scheduler.Schedule(TimeSpan.FromSeconds(10), task =>
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0);
if (target)
DoCast(target, SpellIds.RainOfFire);
task.Repeat(TimeSpan.FromSeconds(4), TimeSpan.FromSeconds(12));
});
_scheduler.Schedule(TimeSpan.FromSeconds(6), task =>
{
Unit target = SelectTarget(SelectTargetMethod.Random, 1);
if (target)
DoCast(target, SpellIds.ShadowBolt);
task.Repeat(TimeSpan.FromSeconds(7));
});
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff, () => DoMeleeAttackIfReady());
}
}
}
@@ -0,0 +1,141 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.AI;
using Game.Entities;
using Game.Maps;
using Game.Scripting;
using Game.Spells;
using System;
namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.Golemagg
{
struct SpellIds
{
// Golemagg
public const uint Magmasplash = 13879;
public const uint Pyroblast = 20228;
public const uint Earthquake = 19798;
public const uint Enrage = 19953;
public const uint GolemaggTrust = 20553;
// Core Rager
public const uint Mangle = 19820;
}
struct TextIds
{
public const uint EmoteLowhp = 0;
}
[Script]
class boss_golemagg : BossAI
{
public boss_golemagg(Creature creature) : base(creature, BossIds.GolemaggTheIncinerator) { }
public override void Reset()
{
base.Reset();
DoCast(me, SpellIds.Magmasplash, new CastSpellExtraArgs(true));
}
public override void JustEngagedWith(Unit victim)
{
base.JustEngagedWith(victim);
_scheduler.Schedule(TimeSpan.FromSeconds(7), task =>
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0);
if (target)
DoCast(target, SpellIds.Pyroblast);
task.Repeat(TimeSpan.FromSeconds(7));
});
}
public override void DamageTaken(Unit attacker, ref uint damage, DamageEffectType damageType, SpellInfo spellInfo = null)
{
if (!HealthBelowPct(10) || me.HasAura(SpellIds.Enrage))
return;
DoCast(me, SpellIds.Enrage, new CastSpellExtraArgs(true));
_scheduler.Schedule(TimeSpan.FromSeconds(3), task =>
{
DoCastVictim(SpellIds.Earthquake);
task.Repeat(TimeSpan.FromSeconds(3));
});
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff, () => DoMeleeAttackIfReady());
}
}
[Script]
class npc_core_rager : ScriptedAI
{
InstanceScript _instance;
public npc_core_rager(Creature creature) : base(creature)
{
_instance = creature.GetInstanceScript();
}
public override void Reset()
{
_scheduler.CancelAll();
}
public override void JustEngagedWith(Unit who)
{
_scheduler.Schedule(TimeSpan.FromSeconds(7), task => // These times are probably wrong
{
DoCastVictim(SpellIds.Mangle);
task.Repeat(TimeSpan.FromSeconds(10));
});
}
public override void DamageTaken(Unit attacker, ref uint damage, DamageEffectType damageType, SpellInfo spellInfo = null)
{
if (HealthAbovePct(50) || _instance == null)
return;
Creature pGolemagg = ObjectAccessor.GetCreature(me, _instance.GetGuidData(BossIds.GolemaggTheIncinerator));
if (pGolemagg)
{
if (pGolemagg.IsAlive())
{
me.AddAura(SpellIds.GolemaggTrust, me);
Talk(TextIds.EmoteLowhp);
me.SetFullHealth();
}
}
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff, () => DoMeleeAttackIfReady());
}
}
}
@@ -0,0 +1,245 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.Entities;
using Game.Maps;
using Game.Scripting;
using System;
namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore
{
struct BossIds
{
public const uint Lucifron = 0;
public const uint Magmadar = 1;
public const uint Gehennas = 2;
public const uint Garr = 3;
public const uint Shazzrah = 4;
public const uint BaronGeddon = 5;
public const uint SulfuronHarbinger = 6;
public const uint GolemaggTheIncinerator = 7;
public const uint MajordomoExecutus = 8;
public const uint Ragnaros = 9;
public const uint MaxEncounter = 10;
}
struct ActionIds
{
public const int StartRagnaros = 0;
public const int StartRagnarosAlt = 1;
}
struct MCCreatureIds
{
public const uint Lucifron = 12118;
public const uint Magmadar = 11982;
public const uint Gehennas = 12259;
public const uint Garr = 12057;
public const uint Shazzrah = 12264;
public const uint BaronGeddon = 12056;
public const uint SulfuronHarbinger = 12098;
public const uint GolemaggTheIncinerator = 11988;
public const uint MajordomoExecutus = 12018;
public const uint Ragnaros = 11502;
public const uint FlamewakerHealer = 11663;
public const uint FlamewakerElite = 11664;
}
struct MCGameObjectIds
{
public const uint CacheOfTheFirelord = 179703;
}
struct MCMiscConst
{
public const uint DataRagnarosAdds = 0;
public static Position[] SummonPositions =
{
new Position(737.850f, -1145.35f, -120.288f, 4.71368f),
new Position(744.162f, -1151.63f, -119.726f, 4.58204f),
new Position(751.247f, -1152.82f, -119.744f, 4.49673f),
new Position(759.206f, -1155.09f, -120.051f, 4.30104f),
new Position(755.973f, -1152.33f, -120.029f, 4.25588f),
new Position(731.712f, -1147.56f, -120.195f, 4.95955f),
new Position(726.499f, -1149.80f, -120.156f, 5.24055f),
new Position(722.408f, -1152.41f, -120.029f, 5.33087f),
new Position(718.994f, -1156.36f, -119.805f, 5.75738f),
new Position(838.510f, -829.840f, -232.000f, 2.00000f),
};
public static Position RagnarosTelePos = new Position(829.159f, -815.773f, -228.972f, 5.30500f);
public static Position RagnarosSummonPos = new Position(838.510f, -829.840f, -232.000f, 2.00000f);
}
[Script]
class instance_molten_core : InstanceMapScript
{
public instance_molten_core() : base(nameof(instance_molten_core), 409) { }
class instance_molten_core_InstanceMapScript : InstanceScript
{
ObjectGuid _golemaggTheIncineratorGUID;
ObjectGuid _majordomoExecutusGUID;
ObjectGuid _cacheOfTheFirelordGUID;
bool _executusSchedule;
byte _ragnarosAddDeaths;
public instance_molten_core_InstanceMapScript(InstanceMap map) : base(map)
{
SetHeaders("MC");
SetBossNumber(BossIds.MaxEncounter);
_executusSchedule = false;
_ragnarosAddDeaths = 0;
}
public override void OnPlayerEnter(Player player)
{
if (_executusSchedule)
SummonMajordomoExecutus();
}
public override void OnCreatureCreate(Creature creature)
{
switch (creature.GetEntry())
{
case MCCreatureIds.GolemaggTheIncinerator:
_golemaggTheIncineratorGUID = creature.GetGUID();
break;
case MCCreatureIds.MajordomoExecutus:
_majordomoExecutusGUID = creature.GetGUID();
break;
default:
break;
}
}
public override void OnGameObjectCreate(GameObject go)
{
switch (go.GetEntry())
{
case MCGameObjectIds.CacheOfTheFirelord:
_cacheOfTheFirelordGUID = go.GetGUID();
break;
default:
break;
}
}
public override void SetData(uint type, uint data)
{
if (type == MCMiscConst.DataRagnarosAdds)
{
if (data == 1)
++_ragnarosAddDeaths;
else if (data == 0)
_ragnarosAddDeaths = 0;
}
}
public override uint GetData(uint type)
{
switch (type)
{
case MCMiscConst.DataRagnarosAdds:
return _ragnarosAddDeaths;
}
return 0;
}
public override ObjectGuid GetGuidData(uint type)
{
switch (type)
{
case BossIds.GolemaggTheIncinerator:
return _golemaggTheIncineratorGUID;
case BossIds.MajordomoExecutus:
return _majordomoExecutusGUID;
}
return ObjectGuid.Empty;
}
public override bool SetBossState(uint bossId, EncounterState state)
{
if (!base.SetBossState(bossId, state))
return false;
if (state == EncounterState.Done && bossId < BossIds.MajordomoExecutus)
if (CheckMajordomoExecutus())
SummonMajordomoExecutus();
if (bossId == BossIds.MajordomoExecutus && state == EncounterState.Done)
DoRespawnGameObject(_cacheOfTheFirelordGUID, TimeSpan.FromDays(7));
return true;
}
void SummonMajordomoExecutus()
{
_executusSchedule = false;
if (!_majordomoExecutusGUID.IsEmpty())
return;
if (GetBossState(BossIds.MajordomoExecutus) != EncounterState.Done)
{
instance.SummonCreature(MCCreatureIds.MajordomoExecutus, MCMiscConst.SummonPositions[0]);
instance.SummonCreature(MCCreatureIds.FlamewakerHealer, MCMiscConst.SummonPositions[1]);
instance.SummonCreature(MCCreatureIds.FlamewakerHealer, MCMiscConst.SummonPositions[2]);
instance.SummonCreature(MCCreatureIds.FlamewakerHealer, MCMiscConst.SummonPositions[3]);
instance.SummonCreature(MCCreatureIds.FlamewakerHealer, MCMiscConst.SummonPositions[4]);
instance.SummonCreature(MCCreatureIds.FlamewakerElite, MCMiscConst.SummonPositions[5]);
instance.SummonCreature(MCCreatureIds.FlamewakerElite, MCMiscConst.SummonPositions[6]);
instance.SummonCreature(MCCreatureIds.FlamewakerElite, MCMiscConst.SummonPositions[7]);
instance.SummonCreature(MCCreatureIds.FlamewakerElite, MCMiscConst.SummonPositions[8]);
}
else
{
TempSummon summon = instance.SummonCreature(MCCreatureIds.MajordomoExecutus, MCMiscConst.RagnarosTelePos);
if (summon)
summon.GetAI().DoAction(ActionIds.StartRagnarosAlt);
}
}
bool CheckMajordomoExecutus()
{
if (GetBossState(BossIds.Ragnaros) == EncounterState.Done)
return false;
for (byte i = 0; i < BossIds.MajordomoExecutus; ++i)
if (GetBossState(i) != EncounterState.Done)
return false;
return true;
}
void ReadSaveDataMore(string data)
{
if (CheckMajordomoExecutus())
_executusSchedule = true;
}
}
public override InstanceScript GetInstanceScript(InstanceMap map)
{
return new instance_molten_core_InstanceMapScript(map);
}
}
}
@@ -0,0 +1,67 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Game.AI;
using Game.Entities;
using Game.Scripting;
using System;
namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.Lucifron
{
struct SpellIds
{
public const uint ImpendingDoom = 19702;
public const uint LucifronCurse = 19703;
public const uint ShadowShock = 20603;
}
[Script]
class boss_lucifron : BossAI
{
public boss_lucifron(Creature creature) : base(creature, BossIds.Lucifron) { }
public override void JustEngagedWith(Unit victim)
{
base.JustEngagedWith(victim);
_scheduler.Schedule(TimeSpan.FromSeconds(10), task =>
{
DoCastVictim(SpellIds.ImpendingDoom);
task.Repeat(TimeSpan.FromSeconds(20));
});
_scheduler.Schedule(TimeSpan.FromSeconds(20), task =>
{
DoCastVictim(SpellIds.LucifronCurse);
task.Repeat(TimeSpan.FromSeconds(15));
});
_scheduler.Schedule(TimeSpan.FromSeconds(6), task =>
{
DoCastVictim(SpellIds.ShadowShock);
task.Repeat(TimeSpan.FromSeconds(6));
});
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff, () => DoMeleeAttackIfReady());
}
}
}
@@ -0,0 +1,83 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Game.AI;
using Game.Entities;
using Game.Scripting;
using Game.Spells;
using System;
namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.Magmadar
{
struct SpellIds
{
public const uint Frenzy = 19451;
public const uint MagmaSpit = 19449;
public const uint Panic = 19408;
public const uint LavaBomb = 19428;
}
struct TextIds
{
public const uint EmoteFrenzy = 0;
}
[Script]
class boss_magmadar : BossAI
{
public boss_magmadar(Creature creature) : base(creature, BossIds.Magmadar) { }
public override void Reset()
{
base.Reset();
DoCast(me, SpellIds.MagmaSpit, new CastSpellExtraArgs(true));
}
public override void JustEngagedWith(Unit victim)
{
base.JustEngagedWith(victim);
_scheduler.Schedule(TimeSpan.FromSeconds(30), task =>
{
Talk(TextIds.EmoteFrenzy);
DoCast(me, SpellIds.Frenzy);
task.Repeat(TimeSpan.FromSeconds(15));
});
_scheduler.Schedule(TimeSpan.FromSeconds(20), task =>
{
DoCastVictim(SpellIds.Panic);
task.Repeat(TimeSpan.FromSeconds(35));
});
_scheduler.Schedule(TimeSpan.FromSeconds(12), task =>
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 0.0f, true, true, -(int)SpellIds.LavaBomb);
if (target)
DoCast(target, SpellIds.LavaBomb);
task.Repeat(TimeSpan.FromSeconds(12));
});
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff, () => DoMeleeAttackIfReady());
}
}
}
@@ -0,0 +1,160 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.AI;
using Game.Entities;
using Game.Scripting;
using Game.Spells;
using System;
namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.Majordomo
{
struct SpellIds
{
public const uint SummonRagnaros = 19774;
public const uint BlastWave = 20229;
public const uint Teleport = 20618;
public const uint MagicReflection = 20619;
public const uint AegisOfRagnaros = 20620;
public const uint DamageReflection = 21075;
}
struct TextIds
{
public const uint SayAggro = 0;
public const uint SaySpawn = 1;
public const uint SaySlay = 2;
public const uint SaySpecial = 3;
public const uint SayDefeat = 4;
public const uint SaySummonMaj = 5;
public const uint SayArrival2Maj = 6;
public const uint OptionIdYouChallengedUs = 0;
public const uint MenuOptionYouChallengedUs = 4108;
}
[Script]
class boss_majordomo : BossAI
{
public boss_majordomo(Creature creature) : base(creature, BossIds.MajordomoExecutus) { }
public override void KilledUnit(Unit victim)
{
if (RandomHelper.URand(0, 99) < 25)
Talk(TextIds.SaySlay);
}
public override void JustEngagedWith(Unit who)
{
base.JustEngagedWith(who);
Talk(TextIds.SayAggro);
_scheduler.Schedule(TimeSpan.FromSeconds(30), task =>
{
DoCast(me, SpellIds.MagicReflection);
task.Repeat(TimeSpan.FromSeconds(30));
});
_scheduler.Schedule(TimeSpan.FromSeconds(15), task =>
{
DoCast(me, SpellIds.DamageReflection);
task.Repeat(TimeSpan.FromSeconds(30));
});
_scheduler.Schedule(TimeSpan.FromSeconds(10), task =>
{
DoCastVictim(SpellIds.BlastWave);
task.Repeat(TimeSpan.FromSeconds(10));
});
_scheduler.Schedule(TimeSpan.FromSeconds(20), task =>
{
Unit target = SelectTarget(SelectTargetMethod.Random, 1);
if (target)
DoCast(target, SpellIds.Teleport);
task.Repeat(TimeSpan.FromSeconds(20));
});
}
public override void UpdateAI(uint diff)
{
_scheduler.Update(diff);
if (instance.GetBossState(BossIds.MajordomoExecutus) != EncounterState.Done)
{
if (!UpdateVictim())
return;
if (!me.FindNearestCreature(MCCreatureIds.FlamewakerHealer, 100.0f) && !me.FindNearestCreature(MCCreatureIds.FlamewakerElite, 100.0f))
{
instance.UpdateEncounterStateForKilledCreature(me.GetEntry(), me);
me.SetFaction((uint)FactionTemplates.Friendly);
EnterEvadeMode();
Talk(TextIds.SayDefeat);
_JustDied();
_scheduler.Schedule(TimeSpan.FromSeconds(32), task =>
{
me.NearTeleportTo(MCMiscConst.RagnarosTelePos.GetPositionX(), MCMiscConst.RagnarosTelePos.GetPositionY(), MCMiscConst.RagnarosTelePos.GetPositionZ(), MCMiscConst.RagnarosTelePos.GetOrientation());
me.SetNpcFlag(NPCFlags.Gossip);
});
return;
}
if (me.HasUnitState(UnitState.Casting))
return;
if (HealthBelowPct(50))
DoCast(me, SpellIds.AegisOfRagnaros, new CastSpellExtraArgs(true));
DoMeleeAttackIfReady();
}
}
public override void DoAction(int action)
{
if (action == ActionIds.StartRagnaros)
{
me.RemoveNpcFlag(NPCFlags.Gossip);
Talk(TextIds.SaySummonMaj);
_scheduler.Schedule(TimeSpan.FromSeconds(8), task =>
{
instance.instance.SummonCreature(MCCreatureIds.Ragnaros, MCMiscConst.RagnarosSummonPos);
});
_scheduler.Schedule(TimeSpan.FromSeconds(24), task =>
{
Talk(TextIds.SayArrival2Maj);
});
}
else if (action == ActionIds.StartRagnarosAlt)
{
me.SetFaction((uint)FactionTemplates.Friendly);
me.SetNpcFlag(NPCFlags.Gossip);
}
}
public override bool OnGossipSelect(Player player, uint menuId, uint gossipListId)
{
if (menuId == TextIds.MenuOptionYouChallengedUs && gossipListId == TextIds.OptionIdYouChallengedUs)
{
player.CloseGossipMenu();
DoAction(ActionIds.StartRagnaros);
}
return false;
}
}
}
@@ -0,0 +1,342 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.AI;
using Game.Entities;
using Game.Maps;
using Game.Scripting;
using System;
namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore
{
struct SpellIds
{
public const uint HandOfRagnaros = 19780;
public const uint WrathOfRagnaros = 20566;
public const uint LavaBurst = 21158;
public const uint MagmaBlast = 20565; // Ranged attack
public const uint SonsOfFlameDummy = 21108; // Server side effect
public const uint Ragsubmerge = 21107; // Stealth aura
public const uint Ragemerge = 20568;
public const uint MeltWeapon = 21388;
public const uint ElementalFire = 20564;
public const uint Erruption = 17731;
}
struct TextIds
{
public const uint SaySummonMaj = 0;
public const uint SayArrival1Rag = 1;
public const uint SayArrival2Maj = 2;
public const uint SayArrival3Rag = 3;
public const uint SayArrival5Rag = 4;
public const uint SayReinforcements1 = 5;
public const uint SayReinforcements2 = 6;
public const uint SayHand = 7;
public const uint SayWrath = 8;
public const uint SayKill = 9;
public const uint SayMagmaburst = 10;
}
struct EventIds
{
public const uint Eruption = 1;
public const uint WrathOfRagnaros = 2;
public const uint HandOfRagnaros = 3;
public const uint LavaBurst = 4;
public const uint ElementalFire = 5;
public const uint MagmaBlast = 6;
public const uint Submerge = 7;
public const uint Intro1 = 8;
public const uint Intro2 = 9;
public const uint Intro3 = 10;
public const uint Intro4 = 11;
public const uint Intro5 = 12;
}
[Script]
class boss_ragnaros : BossAI
{
uint _emergeTimer;
byte _introState;
bool _hasYelledMagmaBurst;
bool _hasSubmergedOnce;
bool _isBanished;
public boss_ragnaros(Creature creature) : base(creature, BossIds.Ragnaros)
{
Initialize();
_introState = 0;
me.SetReactState(ReactStates.Passive);
me.SetUnitFlag(UnitFlags.NonAttackable);
SetCombatMovement(false);
}
void Initialize()
{
_emergeTimer = 90000;
_hasYelledMagmaBurst = false;
_hasSubmergedOnce = false;
_isBanished = false;
}
public override void Reset()
{
base.Reset();
Initialize();
me.SetEmoteState(Emote.OneshotNone);
}
public override void JustEngagedWith(Unit victim)
{
base.JustEngagedWith(victim);
_events.ScheduleEvent(EventIds.Eruption, TimeSpan.FromSeconds(15));
_events.ScheduleEvent(EventIds.WrathOfRagnaros, TimeSpan.FromSeconds(30));
_events.ScheduleEvent(EventIds.HandOfRagnaros, TimeSpan.FromSeconds(25));
_events.ScheduleEvent(EventIds.LavaBurst, TimeSpan.FromSeconds(10));
_events.ScheduleEvent(EventIds.ElementalFire, TimeSpan.FromSeconds(3));
_events.ScheduleEvent(EventIds.MagmaBlast, TimeSpan.FromSeconds(2));
_events.ScheduleEvent(EventIds.Submerge, TimeSpan.FromMinutes(3));
}
public override void KilledUnit(Unit victim)
{
if (RandomHelper.URand(0, 99) < 25)
Talk(TextIds.SayKill);
}
public override void UpdateAI(uint diff)
{
if (_introState != 2)
{
if (_introState == 0)
{
me.HandleEmoteCommand(Emote.OneshotEmerge);
_events.ScheduleEvent(EventIds.Intro1, TimeSpan.FromSeconds(4));
_events.ScheduleEvent(EventIds.Intro2, TimeSpan.FromSeconds(23));
_events.ScheduleEvent(EventIds.Intro3, TimeSpan.FromSeconds(42));
_events.ScheduleEvent(EventIds.Intro4, TimeSpan.FromSeconds(43));
_events.ScheduleEvent(EventIds.Intro5, TimeSpan.FromSeconds(53));
_introState = 1;
}
_events.Update(diff);
_events.ExecuteEvents(eventId =>
{
switch (eventId)
{
case EventIds.Intro1:
Talk(TextIds.SayArrival1Rag);
break;
case EventIds.Intro2:
Talk(TextIds.SayArrival3Rag);
break;
case EventIds.Intro3:
me.HandleEmoteCommand(Emote.OneshotAttack1h);
break;
case EventIds.Intro4:
Talk(TextIds.SayArrival5Rag);
Creature executus = ObjectAccessor.GetCreature(me, instance.GetGuidData(BossIds.MajordomoExecutus));
if (executus)
Unit.Kill(me, executus);
break;
case EventIds.Intro5:
me.SetReactState(ReactStates.Aggressive);
me.RemoveUnitFlag(UnitFlags.NonAttackable);
me.SetImmuneToPC(false);
_introState = 2;
break;
default:
break;
}
});
}
else
{
if (_isBanished && ((_emergeTimer <= diff) || (instance.GetData(MCMiscConst.DataRagnarosAdds)) > 8))
{
//Become unbanished again
me.SetReactState(ReactStates.Aggressive);
me.SetFaction((uint)FactionTemplates.Monster);
me.RemoveUnitFlag(UnitFlags.Uninteractible);
me.SetEmoteState(Emote.OneshotNone);
me.HandleEmoteCommand(Emote.OneshotEmerge);
Unit target = SelectTarget(SelectTargetMethod.Random, 0);
if (target)
AttackStart(target);
instance.SetData(MCMiscConst.DataRagnarosAdds, 0);
//DoCast(me, SpellRagemerge); //"phase spells" didnt worked correctly so Ive commented them and wrote solution witch doesnt need core support
_isBanished = false;
}
else if (_isBanished)
{
_emergeTimer -= diff;
//Do nothing while banished
return;
}
//Return since we have no target
if (!UpdateVictim())
return;
_events.Update(diff);
_events.ExecuteEvents(eventId =>
{
switch (eventId)
{
case EventIds.Eruption:
DoCastVictim(SpellIds.Erruption);
_events.ScheduleEvent(EventIds.Eruption, TimeSpan.FromSeconds(20), TimeSpan.FromSeconds(45));
break;
case EventIds.WrathOfRagnaros:
DoCastVictim(SpellIds.WrathOfRagnaros);
if (RandomHelper.URand(0, 1) != 0)
Talk(TextIds.SayWrath);
_events.ScheduleEvent(EventIds.WrathOfRagnaros, TimeSpan.FromSeconds(25));
break;
case EventIds.HandOfRagnaros:
DoCast(me, SpellIds.HandOfRagnaros);
if (RandomHelper.URand(0, 1) != 0)
Talk(TextIds.SayHand);
_events.ScheduleEvent(EventIds.HandOfRagnaros, TimeSpan.FromSeconds(20));
break;
case EventIds.LavaBurst:
DoCastVictim(SpellIds.LavaBurst);
_events.ScheduleEvent(EventIds.LavaBurst, TimeSpan.FromSeconds(10));
break;
case EventIds.ElementalFire:
DoCastVictim(SpellIds.ElementalFire);
_events.ScheduleEvent(EventIds.ElementalFire, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(14));
break;
case EventIds.MagmaBlast:
if (!me.IsWithinMeleeRange(me.GetVictim()))
{
DoCastVictim(SpellIds.MagmaBlast);
if (!_hasYelledMagmaBurst)
{
//Say our dialog
Talk(TextIds.SayMagmaburst);
_hasYelledMagmaBurst = true;
}
}
_events.ScheduleEvent(EventIds.MagmaBlast, TimeSpan.FromMilliseconds(2500));
break;
case EventIds.Submerge:
{
if (!_isBanished)
{
//Creature spawning and ragnaros becomming unattackable
//is not very well supported in the core //no it really isnt
//so added normaly spawning and banish workaround and attack again after 90 secs.
me.AttackStop();
ResetThreatList();
me.SetReactState(ReactStates.Passive);
me.InterruptNonMeleeSpells(false);
//Root self
//DoCast(me, 23973);
me.SetFaction((uint)FactionTemplates.Friendly);
me.SetUnitFlag(UnitFlags.Uninteractible);
me.SetEmoteState(Emote.StateSubmerged);
me.HandleEmoteCommand(Emote.OneshotSubmerge);
instance.SetData(MCMiscConst.DataRagnarosAdds, 0);
if (!_hasSubmergedOnce)
{
Talk(TextIds.SayReinforcements1);
// summon 8 elementals
for (byte i = 0; i < 8; ++i)
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0);
if (target != null)
{
Creature summoned = me.SummonCreature(12143, target.GetPositionX(), target.GetPositionY(), target.GetPositionZ(), 0.0f, TempSummonType.TimedOrCorpseDespawn, TimeSpan.FromMinutes(15));
if (summoned != null)
summoned.GetAI().AttackStart(target);
}
}
_hasSubmergedOnce = true;
_isBanished = true;
//DoCast(me, SpellRagsubmerge);
_emergeTimer = 90000;
}
else
{
Talk(TextIds.SayReinforcements2);
for (byte i = 0; i < 8; ++i)
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0);
if (target != null)
{
Creature summoned = me.SummonCreature(12143, target.GetPositionX(), target.GetPositionY(), target.GetPositionZ(), 0.0f, TempSummonType.TimedOrCorpseDespawn, TimeSpan.FromMinutes(15));
if (summoned != null)
summoned.GetAI().AttackStart(target);
}
}
_isBanished = true;
//DoCast(me, SpellRagsubmerge);
_emergeTimer = 90000;
}
}
_events.ScheduleEvent(EventIds.Submerge, TimeSpan.FromMinutes(3));
break;
}
default:
break;
}
});
DoMeleeAttackIfReady();
}
}
}
[Script]
class npc_son_of_flame : ScriptedAI //didnt work correctly in Eai for me...
{
InstanceScript instance;
public npc_son_of_flame(Creature creature) : base(creature)
{
instance = me.GetInstanceScript();
}
public override void JustDied(Unit killer)
{
instance.SetData(MCMiscConst.DataRagnarosAdds, 1);
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
DoMeleeAttackIfReady();
}
}
}
@@ -0,0 +1,156 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.AI;
using Game.Entities;
using Game.Scripting;
using Game.Spells;
using System;
using System.Collections.Generic;
namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.Shazzrah
{
struct SpellIds
{
public const uint ArcaneExplosion = 19712;
public const uint ShazzrahCurse = 19713;
public const uint MagicGrounding = 19714;
public const uint Counterspell = 19715;
public const uint ShazzrahGateDummy = 23138; // Teleports to and attacks a random target.
public const uint ShazzrahGate = 23139;
}
struct EventIds
{
public const uint ArcaneExplosion = 1;
public const uint ArcaneExplosionTriggered = 2;
public const uint ShazzrahCurse = 3;
public const uint MagicGrounding = 4;
public const uint Counterspell = 5;
public const uint ShazzrahGate = 6;
}
[Script]
class boss_shazzrah : BossAI
{
public boss_shazzrah(Creature creature) : base(creature, BossIds.Shazzrah) { }
public override void JustEngagedWith(Unit target)
{
base.JustEngagedWith(target);
_events.ScheduleEvent(EventIds.ArcaneExplosion, TimeSpan.FromSeconds(6));
_events.ScheduleEvent(EventIds.ShazzrahCurse, TimeSpan.FromSeconds(10));
_events.ScheduleEvent(EventIds.MagicGrounding, TimeSpan.FromSeconds(24));
_events.ScheduleEvent(EventIds.Counterspell, TimeSpan.FromSeconds(15));
_events.ScheduleEvent(EventIds.ShazzrahGate, TimeSpan.FromSeconds(45));
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_events.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
_events.ExecuteEvents(eventId =>
{
switch (eventId)
{
case EventIds.ArcaneExplosion:
DoCastVictim(SpellIds.ArcaneExplosion);
_events.ScheduleEvent(EventIds.ArcaneExplosion, TimeSpan.FromSeconds(4), TimeSpan.FromSeconds(7));
break;
// Triggered subsequent to using "Gate of Shazzrah".
case EventIds.ArcaneExplosionTriggered:
DoCastVictim(SpellIds.ArcaneExplosion);
break;
case EventIds.ShazzrahCurse:
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 0.0f, true, true, -(int)SpellIds.ShazzrahCurse);
if (target)
DoCast(target, SpellIds.ShazzrahCurse);
_events.ScheduleEvent(EventIds.ShazzrahCurse, TimeSpan.FromSeconds(25), TimeSpan.FromSeconds(30));
break;
case EventIds.MagicGrounding:
DoCast(me, SpellIds.MagicGrounding);
_events.ScheduleEvent(EventIds.MagicGrounding, TimeSpan.FromSeconds(35));
break;
case EventIds.Counterspell:
DoCastVictim(SpellIds.Counterspell);
_events.ScheduleEvent(EventIds.Counterspell, TimeSpan.FromSeconds(16), TimeSpan.FromSeconds(20));
break;
case EventIds.ShazzrahGate:
ResetThreatList();
DoCastAOE(SpellIds.ShazzrahGateDummy);
_events.ScheduleEvent(EventIds.ArcaneExplosionTriggered, TimeSpan.FromSeconds(2));
_events.RescheduleEvent(EventIds.ArcaneExplosion, TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(6));
_events.ScheduleEvent(EventIds.ShazzrahGate, TimeSpan.FromSeconds(45));
break;
default:
break;
}
if (me.HasUnitState(UnitState.Casting))
return;
});
DoMeleeAttackIfReady();
}
}
[Script] // 23138 - Gate of Shazzrah
class spell_shazzrah_gate_dummy : SpellScript
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.ShazzrahGate);
}
void FilterTargets(List<WorldObject> targets)
{
if (targets.Empty())
return;
WorldObject target = targets.SelectRandom();
targets.Clear();
targets.Add(target);
}
void HandleScript(uint effIndex)
{
Unit target = GetHitUnit();
if (target)
{
target.CastSpell(GetCaster(), SpellIds.ShazzrahGate, true);
Creature creature = GetCaster().ToCreature();
if (creature)
creature.GetAI().AttackStart(target); // Attack the target which caster will teleport to.
}
}
public override void Register()
{
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitSrcAreaEnemy));
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.Dummy));
}
}
}
@@ -0,0 +1,145 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Game.AI;
using Game.Entities;
using Game.Scripting;
using System;
using System.Collections.Generic;
namespace Scripts.EasternKingdoms.BlackrockMountain.MoltenCore.Sulfuron
{
struct SpellIds
{
// Sulfuron Harbringer
public const uint DarkStrike = 19777;
public const uint DemoralizingShout = 19778;
public const uint Inspire = 19779;
public const uint Knockdown = 19780;
public const uint Flamespear = 19781;
// Adds
public const uint Heal = 19775;
public const uint Shadowwordpain = 19776;
public const uint Immolate = 20294;
}
[Script]
class boss_sulfuron : BossAI
{
public boss_sulfuron(Creature creature) : base(creature, BossIds.SulfuronHarbinger) { }
public override void JustEngagedWith(Unit victim)
{
base.JustEngagedWith(victim);
_scheduler.Schedule(TimeSpan.FromSeconds(10), task =>
{
DoCast(me, SpellIds.DarkStrike);
task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(18));
});
_scheduler.Schedule(TimeSpan.FromSeconds(15), task =>
{
DoCastVictim(SpellIds.DemoralizingShout);
task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(20));
});
_scheduler.Schedule(TimeSpan.FromSeconds(13), task =>
{
List<Creature> healers = DoFindFriendlyMissingBuff(45.0f, SpellIds.Inspire);
if (!healers.Empty())
DoCast(healers.SelectRandom(), SpellIds.Inspire);
DoCast(me, SpellIds.Inspire);
task.Repeat(TimeSpan.FromSeconds(20), TimeSpan.FromSeconds(26));
});
_scheduler.Schedule(TimeSpan.FromSeconds(6), task =>
{
DoCastVictim(SpellIds.Knockdown);
task.Repeat(TimeSpan.FromSeconds(12), TimeSpan.FromSeconds(15));
});
_scheduler.Schedule(TimeSpan.FromSeconds(2), task =>
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 0.0f, true);
if (target)
DoCast(target, SpellIds.Flamespear);
task.Repeat(TimeSpan.FromSeconds(12), TimeSpan.FromSeconds(16));
});
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff, () => DoMeleeAttackIfReady());
}
}
[Script]
class npc_flamewaker_priest : ScriptedAI
{
public npc_flamewaker_priest(Creature creature) : base(creature)
{
}
public override void Reset()
{
_scheduler.CancelAll();
}
public override void JustDied(Unit killer)
{
_scheduler.CancelAll();
}
public override void JustEngagedWith(Unit victim)
{
base.JustEngagedWith(victim);
_scheduler.Schedule(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(30), task =>
{
Unit target = DoSelectLowestHpFriendly(60.0f, 1);
if (target)
DoCast(target, SpellIds.Heal);
task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(20));
});
_scheduler.Schedule(TimeSpan.FromSeconds(2), task =>
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 0.0f, true, true, -(int)SpellIds.Shadowwordpain);
if (target)
DoCast(target, SpellIds.Shadowwordpain);
task.Repeat(TimeSpan.FromSeconds(18), TimeSpan.FromSeconds(26));
});
_scheduler.Schedule(TimeSpan.FromSeconds(8), task =>
{
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 0.0f, true, true, -(int)SpellIds.Immolate);
if (target)
DoCast(target, SpellIds.Immolate);
task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(25));
});
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff, () => DoMeleeAttackIfReady());
}
}
}