Start adding missing scripts Part2
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,270 @@
|
||||
/*
|
||||
* 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;
|
||||
using Game.Entities;
|
||||
using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using Game.AI;
|
||||
using Game.DataStorage;
|
||||
using Game.Maps;
|
||||
using System;
|
||||
|
||||
namespace Scripts.EasternKingdoms.BaradinHold.Alizabal
|
||||
{
|
||||
struct SpellIds
|
||||
{
|
||||
public const uint BladeDance = 105784;
|
||||
public const uint BladeDanceDummy = 105828;
|
||||
public const uint SeethingHate = 105067;
|
||||
public const uint Skewer = 104936;
|
||||
public const uint Berserk = 47008;
|
||||
}
|
||||
|
||||
struct TextIds
|
||||
{
|
||||
public const uint SayIntro = 1;
|
||||
public const uint SayAggro = 2;
|
||||
public const uint SayHate = 3;
|
||||
public const uint SaySkewer = 4;
|
||||
public const uint SaySkewerAnnounce = 5;
|
||||
public const uint SayBladeStorm = 6;
|
||||
public const uint SaySlay = 10;
|
||||
public const uint SayDeath = 12;
|
||||
}
|
||||
|
||||
struct ActionIds
|
||||
{
|
||||
public const int Intro = 1;
|
||||
}
|
||||
|
||||
struct PointIds
|
||||
{
|
||||
public const uint Storm = 1;
|
||||
}
|
||||
|
||||
struct EventIds
|
||||
{
|
||||
public const uint RandomCast = 1;
|
||||
public const uint StopStorm = 2;
|
||||
public const uint MoveStorm = 3;
|
||||
public const uint CastStorm = 4;
|
||||
}
|
||||
|
||||
[Script]
|
||||
class at_alizabal_intro : AreaTriggerScript
|
||||
{
|
||||
public at_alizabal_intro() : base("at_alizabal_intro") { }
|
||||
|
||||
public override bool OnTrigger(Player player, AreaTriggerRecord areaTrigger)
|
||||
{
|
||||
InstanceScript instance = player.GetInstanceScript();
|
||||
if (instance != null)
|
||||
{
|
||||
Creature alizabal = ObjectAccessor.GetCreature(player, instance.GetGuidData(DataTypes.Alizabal));
|
||||
if (alizabal)
|
||||
alizabal.GetAI().DoAction(ActionIds.Intro);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class boss_alizabal : BossAI
|
||||
{
|
||||
bool _intro;
|
||||
bool _hate;
|
||||
bool _skewer;
|
||||
|
||||
public boss_alizabal(Creature creature) : base(creature, DataTypes.Alizabal) { }
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
_Reset();
|
||||
_hate = false;
|
||||
_skewer = false;
|
||||
}
|
||||
|
||||
public override void JustEngagedWith(Unit who)
|
||||
{
|
||||
base.JustEngagedWith(who);
|
||||
Talk(TextIds.SayAggro);
|
||||
instance.SendEncounterUnit(EncounterFrameType.Engage, me);
|
||||
_events.ScheduleEvent(EventIds.RandomCast, TimeSpan.FromSeconds(10));
|
||||
}
|
||||
|
||||
public override void JustDied(Unit killer)
|
||||
{
|
||||
_JustDied();
|
||||
Talk(TextIds.SayDeath);
|
||||
instance.SendEncounterUnit(EncounterFrameType.Disengage, me);
|
||||
}
|
||||
|
||||
public override void KilledUnit(Unit who)
|
||||
{
|
||||
if (who.IsPlayer())
|
||||
Talk(TextIds.SaySlay);
|
||||
}
|
||||
|
||||
public override void EnterEvadeMode(EvadeReason why)
|
||||
{
|
||||
instance.SendEncounterUnit(EncounterFrameType.Disengage, me);
|
||||
me.GetMotionMaster().MoveTargetedHome();
|
||||
_DespawnAtEvade();
|
||||
}
|
||||
|
||||
public override void DoAction(int action)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case ActionIds.Intro:
|
||||
if (!_intro)
|
||||
{
|
||||
Talk(TextIds.SayIntro);
|
||||
_intro = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void MovementInform(MovementGeneratorType type, uint pointId)
|
||||
{
|
||||
switch (pointId)
|
||||
{
|
||||
case PointIds.Storm:
|
||||
_events.ScheduleEvent(EventIds.CastStorm, TimeSpan.FromMilliseconds(1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
_events.Update(diff);
|
||||
|
||||
_events.ExecuteEvents(eventId =>
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case EventIds.RandomCast:
|
||||
{
|
||||
switch (RandomHelper.URand(0, 1))
|
||||
{
|
||||
case 0:
|
||||
if (!_skewer)
|
||||
{
|
||||
Unit target = SelectTarget(SelectTargetMethod.MaxThreat, 0);
|
||||
if (target)
|
||||
{
|
||||
DoCast(target, SpellIds.Skewer, new CastSpellExtraArgs(true));
|
||||
Talk(TextIds.SaySkewer);
|
||||
Talk(TextIds.SaySkewerAnnounce, target);
|
||||
}
|
||||
_skewer = true;
|
||||
_events.ScheduleEvent(EventIds.RandomCast, TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(10));
|
||||
}
|
||||
else if (!_hate)
|
||||
{
|
||||
Unit target = SelectTarget(SelectTargetMethod.Random, 0, new NonTankTargetSelector(me));
|
||||
if (target)
|
||||
{
|
||||
DoCast(target, SpellIds.SeethingHate, new CastSpellExtraArgs(true));
|
||||
Talk(TextIds.SayHate);
|
||||
}
|
||||
_hate = true;
|
||||
_events.ScheduleEvent(EventIds.RandomCast, TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(10));
|
||||
}
|
||||
else if (_hate && _skewer)
|
||||
{
|
||||
Talk(TextIds.SayBladeStorm);
|
||||
DoCastAOE(SpellIds.BladeDanceDummy);
|
||||
DoCastAOE(SpellIds.BladeDance);
|
||||
_events.ScheduleEvent(EventIds.RandomCast, TimeSpan.FromSeconds(21));
|
||||
_events.ScheduleEvent(EventIds.MoveStorm, TimeSpan.FromMilliseconds(4050));
|
||||
_events.ScheduleEvent(EventIds.StopStorm, TimeSpan.FromSeconds(13));
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (!_hate)
|
||||
{
|
||||
Unit target = SelectTarget(SelectTargetMethod.Random, 0, new NonTankTargetSelector(me));
|
||||
if (target)
|
||||
{
|
||||
DoCast(target, SpellIds.SeethingHate, new CastSpellExtraArgs(true));
|
||||
Talk(TextIds.SayHate);
|
||||
}
|
||||
_hate = true;
|
||||
_events.ScheduleEvent(EventIds.RandomCast, TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(10));
|
||||
}
|
||||
else if (!_skewer)
|
||||
{
|
||||
Unit target = SelectTarget(SelectTargetMethod.MaxThreat, 0);
|
||||
if (target)
|
||||
{
|
||||
DoCast(target, SpellIds.Skewer, new CastSpellExtraArgs(true));
|
||||
Talk(TextIds.SaySkewer);
|
||||
Talk(TextIds.SaySkewerAnnounce, target);
|
||||
}
|
||||
_skewer = true;
|
||||
_events.ScheduleEvent(EventIds.RandomCast, TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(10));
|
||||
}
|
||||
else if (_hate && _skewer)
|
||||
{
|
||||
Talk(TextIds.SayBladeStorm);
|
||||
DoCastAOE(SpellIds.BladeDanceDummy);
|
||||
DoCastAOE(SpellIds.BladeDance);
|
||||
_events.ScheduleEvent(EventIds.RandomCast, TimeSpan.FromSeconds(21));
|
||||
_events.ScheduleEvent(EventIds.MoveStorm, TimeSpan.FromMilliseconds(4050));
|
||||
_events.ScheduleEvent(EventIds.StopStorm, TimeSpan.FromSeconds(13));
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EventIds.MoveStorm:
|
||||
{
|
||||
me.SetSpeedRate(UnitMoveType.Run, 4.0f);
|
||||
me.SetSpeedRate(UnitMoveType.Walk, 4.0f);
|
||||
Unit target = SelectTarget(SelectTargetMethod.Random, 0, new NonTankTargetSelector(me));
|
||||
if (target)
|
||||
me.GetMotionMaster().MovePoint(PointIds.Storm, target.GetPositionX(), target.GetPositionY(), target.GetPositionZ());
|
||||
_events.ScheduleEvent(EventIds.MoveStorm, TimeSpan.FromMilliseconds(4050));
|
||||
break;
|
||||
}
|
||||
case EventIds.StopStorm:
|
||||
me.RemoveAura(SpellIds.BladeDance);
|
||||
me.RemoveAura(SpellIds.BladeDanceDummy);
|
||||
me.SetSpeedRate(UnitMoveType.Walk, 1.0f);
|
||||
me.SetSpeedRate(UnitMoveType.Run, 1.14f);
|
||||
me.GetMotionMaster().MoveChase(me.GetVictim());
|
||||
_hate = false;
|
||||
_skewer = false;
|
||||
break;
|
||||
case EventIds.CastStorm:
|
||||
DoCastAOE(SpellIds.BladeDance);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
namespace Scripts.EasternKingdoms.BaradinHold
|
||||
{
|
||||
struct DataTypes
|
||||
{
|
||||
public const uint Argaloth = 0;
|
||||
public const uint Occuthar = 1;
|
||||
public const uint Alizabal = 2;
|
||||
}
|
||||
|
||||
struct CreatureIds
|
||||
{
|
||||
public const uint EyeOfOccuthar = 52389;
|
||||
public const uint FocusFireDummy = 52369;
|
||||
public const uint OccutharEye = 52368;
|
||||
}
|
||||
|
||||
struct BossIds
|
||||
{
|
||||
public const uint Argaloth = 47120;
|
||||
public const uint Occuthar = 52363;
|
||||
public const uint Alizabal = 55869;
|
||||
}
|
||||
|
||||
struct GameObjectIds
|
||||
{
|
||||
public const uint ArgalothDoor = 207619;
|
||||
public const uint OccutharDoor = 208953;
|
||||
public const uint AlizabalDoor = 209849;
|
||||
}
|
||||
|
||||
[Script]
|
||||
class instance_baradin_hold : InstanceMapScript
|
||||
{
|
||||
static DoorData[] doorData =
|
||||
{
|
||||
new DoorData(GameObjectIds.ArgalothDoor, DataTypes.Argaloth, DoorType.Room),
|
||||
new DoorData(GameObjectIds.OccutharDoor, DataTypes.Occuthar, DoorType.Room),
|
||||
new DoorData(GameObjectIds.AlizabalDoor, DataTypes.Alizabal, DoorType.Room),
|
||||
};
|
||||
|
||||
public instance_baradin_hold() : base(nameof(instance_baradin_hold), 757) { }
|
||||
|
||||
class instance_baradin_hold_InstanceMapScript : InstanceScript
|
||||
{
|
||||
ObjectGuid ArgalothGUID;
|
||||
ObjectGuid OccutharGUID;
|
||||
ObjectGuid AlizabalGUID;
|
||||
|
||||
public instance_baradin_hold_InstanceMapScript(InstanceMap map) : base(map)
|
||||
{
|
||||
SetHeaders("BH");
|
||||
SetBossNumber(3);
|
||||
LoadDoorData(doorData);
|
||||
}
|
||||
|
||||
public override void OnCreatureCreate(Creature creature)
|
||||
{
|
||||
switch (creature.GetEntry())
|
||||
{
|
||||
case BossIds.Argaloth:
|
||||
ArgalothGUID = creature.GetGUID();
|
||||
break;
|
||||
case BossIds.Occuthar:
|
||||
OccutharGUID = creature.GetGUID();
|
||||
break;
|
||||
case BossIds.Alizabal:
|
||||
AlizabalGUID = creature.GetGUID();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnGameObjectCreate(GameObject go)
|
||||
{
|
||||
switch (go.GetEntry())
|
||||
{
|
||||
case GameObjectIds.ArgalothDoor:
|
||||
case GameObjectIds.OccutharDoor:
|
||||
case GameObjectIds.AlizabalDoor:
|
||||
AddDoor(go, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override ObjectGuid GetGuidData(uint data)
|
||||
{
|
||||
switch (data)
|
||||
{
|
||||
case DataTypes.Argaloth:
|
||||
return ArgalothGUID;
|
||||
case DataTypes.Occuthar:
|
||||
return OccutharGUID;
|
||||
case DataTypes.Alizabal:
|
||||
return AlizabalGUID;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ObjectGuid.Empty;
|
||||
}
|
||||
|
||||
public override void OnGameObjectRemove(GameObject go)
|
||||
{
|
||||
switch (go.GetEntry())
|
||||
{
|
||||
case GameObjectIds.ArgalothDoor:
|
||||
case GameObjectIds.OccutharDoor:
|
||||
case GameObjectIds.AlizabalDoor:
|
||||
AddDoor(go, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override InstanceScript GetInstanceScript(InstanceMap map)
|
||||
{
|
||||
return new instance_baradin_hold_InstanceMapScript(map);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,297 @@
|
||||
/*
|
||||
* 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;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Scripts.EasternKingdoms.BaradinHold.Occuthar
|
||||
{
|
||||
struct SpellIds
|
||||
{
|
||||
public const uint SearingShadows = 96913;
|
||||
public const uint FocusedFireFirstDamage = 97212;
|
||||
public const uint FocusedFireTrigger = 96872;
|
||||
public const uint FocusedFireVisual = 96886;
|
||||
public const uint FocusedFire = 96884;
|
||||
public const uint EyesOfOccuthar = 96920;
|
||||
public const uint GazeOfOccuthar = 96942;
|
||||
public const uint OccutharsDestuction = 96968;
|
||||
public const uint Berserk = 47008;
|
||||
}
|
||||
|
||||
struct EventIds
|
||||
{
|
||||
public const uint SearingShadows = 1;
|
||||
public const uint FocusedFire = 2;
|
||||
public const uint EyesOfOccuthar = 3;
|
||||
public const uint Berserk = 4;
|
||||
|
||||
public const uint FocusedFireFirstDamage = 1;
|
||||
}
|
||||
|
||||
struct MiscConst
|
||||
{
|
||||
public const uint MaxOccutharVehicleSeats = 7;
|
||||
}
|
||||
|
||||
[Script]
|
||||
class boss_occuthar : BossAI
|
||||
{
|
||||
Vehicle _vehicle;
|
||||
|
||||
public boss_occuthar(Creature creature) : base(creature, DataTypes.Occuthar)
|
||||
{
|
||||
_vehicle = me.GetVehicleKit();
|
||||
Cypher.Assert(_vehicle != null);
|
||||
}
|
||||
|
||||
public override void JustEngagedWith(Unit who)
|
||||
{
|
||||
base.JustEngagedWith(who);
|
||||
instance.SendEncounterUnit(EncounterFrameType.Engage, me);
|
||||
_events.ScheduleEvent(EventIds.SearingShadows, TimeSpan.FromSeconds(8));
|
||||
_events.ScheduleEvent(EventIds.FocusedFire, TimeSpan.FromSeconds(15));
|
||||
_events.ScheduleEvent(EventIds.EyesOfOccuthar, TimeSpan.FromSeconds(30));
|
||||
_events.ScheduleEvent(EventIds.Berserk, TimeSpan.FromMinutes(5));
|
||||
}
|
||||
|
||||
public override void EnterEvadeMode(EvadeReason why)
|
||||
{
|
||||
base.EnterEvadeMode(why);
|
||||
instance.SendEncounterUnit(EncounterFrameType.Disengage, me);
|
||||
_DespawnAtEvade();
|
||||
}
|
||||
|
||||
public override void JustDied(Unit killer)
|
||||
{
|
||||
_JustDied();
|
||||
instance.SendEncounterUnit(EncounterFrameType.Disengage, me);
|
||||
}
|
||||
|
||||
public override void JustSummoned(Creature summon)
|
||||
{
|
||||
summons.Summon(summon);
|
||||
|
||||
if (summon.GetEntry() == CreatureIds.FocusFireDummy)
|
||||
{
|
||||
DoCast(summon, SpellIds.FocusedFire);
|
||||
|
||||
for (sbyte i = 0; i < MiscConst.MaxOccutharVehicleSeats; ++i)
|
||||
{
|
||||
Unit vehicle = _vehicle.GetPassenger(i);
|
||||
if (vehicle)
|
||||
vehicle.CastSpell(summon, SpellIds.FocusedFireVisual);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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.SearingShadows:
|
||||
DoCastAOE(SpellIds.SearingShadows);
|
||||
_events.ScheduleEvent(EventIds.SearingShadows, TimeSpan.FromSeconds(25));
|
||||
break;
|
||||
case EventIds.FocusedFire:
|
||||
DoCastAOE(SpellIds.FocusedFireTrigger, new CastSpellExtraArgs(true));
|
||||
_events.ScheduleEvent(EventIds.FocusedFire, TimeSpan.FromSeconds(15));
|
||||
break;
|
||||
case EventIds.EyesOfOccuthar:
|
||||
DoCastAOE(SpellIds.EyesOfOccuthar);
|
||||
_events.RescheduleEvent(EventIds.FocusedFire, TimeSpan.FromSeconds(15));
|
||||
_events.ScheduleEvent(EventIds.EyesOfOccuthar, TimeSpan.FromSeconds(60));
|
||||
break;
|
||||
case EventIds.Berserk:
|
||||
DoCast(me, SpellIds.Berserk, new CastSpellExtraArgs(true));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class npc_eyestalk : ScriptedAI
|
||||
{
|
||||
InstanceScript _instance;
|
||||
byte _damageCount;
|
||||
|
||||
public npc_eyestalk(Creature creature) : base(creature)
|
||||
{
|
||||
_instance = creature.GetInstanceScript();
|
||||
}
|
||||
|
||||
public override void IsSummonedBy(WorldObject summoner)
|
||||
{
|
||||
// player is the spellcaster so register summon manually
|
||||
Creature occuthar = ObjectAccessor.GetCreature(me, _instance.GetGuidData(DataTypes.Occuthar));
|
||||
if (occuthar != null)
|
||||
occuthar.GetAI().JustSummoned(me);
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
_events.Reset();
|
||||
_events.ScheduleEvent(EventIds.FocusedFireFirstDamage, TimeSpan.FromSeconds(0));
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
_events.Update(diff);
|
||||
|
||||
if (_events.ExecuteEvent() == EventIds.FocusedFireFirstDamage)
|
||||
{
|
||||
DoCastAOE(SpellIds.FocusedFireFirstDamage);
|
||||
if (++_damageCount < 2)
|
||||
_events.ScheduleEvent(EventIds.FocusedFireFirstDamage, TimeSpan.FromSeconds(1));
|
||||
}
|
||||
}
|
||||
|
||||
public override void EnterEvadeMode(EvadeReason why) { } // Never evade
|
||||
}
|
||||
|
||||
[Script] // 96872 - Focused Fire
|
||||
class spell_occuthar_focused_fire_SpellScript : SpellScript
|
||||
{
|
||||
void FilterTargets(List<WorldObject> targets)
|
||||
{
|
||||
if (targets.Count < 2)
|
||||
return;
|
||||
|
||||
targets.RemoveAll(target => GetCaster().GetVictim() == target);
|
||||
|
||||
if (targets.Count >= 2)
|
||||
targets.RandomResize(1);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitSrcAreaEnemy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // Id - 96931 Eyes of Occu'thar
|
||||
class spell_occuthar_eyes_of_occuthar_SpellScript : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return !spellInfo.GetEffects().Empty() && ValidateSpellInfo((uint)spellInfo.GetEffect(0).CalcValue());
|
||||
}
|
||||
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster().IsPlayer();
|
||||
}
|
||||
|
||||
void FilterTargets(List<WorldObject> targets)
|
||||
{
|
||||
if (targets.Empty())
|
||||
return;
|
||||
|
||||
targets.RandomResize(1);
|
||||
}
|
||||
|
||||
void HandleScript(uint effIndex)
|
||||
{
|
||||
GetHitUnit().CastSpell(GetCaster(), (uint)GetEffectValue(), true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitSrcAreaEntry));
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // Id - 96932 Eyes of Occu'thar
|
||||
class spell_occuthar_eyes_of_occuthar_vehicle_SpellScript : SpellScript
|
||||
{
|
||||
public override bool Load()
|
||||
{
|
||||
InstanceMap instance = GetCaster().GetMap().ToInstanceMap();
|
||||
if (instance != null)
|
||||
return instance.GetScriptName() == nameof(instance_baradin_hold);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void HandleScript()
|
||||
{
|
||||
Position pos = GetHitUnit().GetPosition();
|
||||
|
||||
Creature occuthar = ObjectAccessor.GetCreature(GetCaster(), GetCaster().GetInstanceScript().GetGuidData(DataTypes.Occuthar));
|
||||
if (occuthar != null)
|
||||
{
|
||||
Creature creature = occuthar.SummonCreature(CreatureIds.EyeOfOccuthar, pos);
|
||||
if (creature != null)
|
||||
creature.CastSpell(GetHitUnit(), SpellIds.GazeOfOccuthar, false);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterHit.Add(new HitHandler(HandleScript));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 96942 / 101009 - Gaze of Occu'thar
|
||||
class spell_occuthar_occuthars_destruction_AuraScript : AuraScript
|
||||
{
|
||||
public override bool Load()
|
||||
{
|
||||
return GetCaster() && GetCaster().GetTypeId() == TypeId.Unit;
|
||||
}
|
||||
|
||||
void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (caster)
|
||||
{
|
||||
if (IsExpired())
|
||||
caster.CastSpell((WorldObject)null, SpellIds.OccutharsDestuction, new CastSpellExtraArgs(aurEff));
|
||||
|
||||
caster.ToCreature().DespawnOrUnsummon(TimeSpan.FromMilliseconds(500));
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectRemove.Add(new EffectApplyHandler(OnRemove, 2, AuraType.PeriodicTriggerSpell, AuraEffectHandleModes.Real));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* 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.BaradinHold.PitLordArgaloth
|
||||
{
|
||||
struct SpellIds
|
||||
{
|
||||
public const uint MeteorSlash = 88942;
|
||||
public const uint ConsumingDarkness = 88954;
|
||||
public const uint FelFirestorm = 88972;
|
||||
public const uint Berserk = 47008;
|
||||
}
|
||||
|
||||
[Script]
|
||||
class boss_pit_lord_argaloth : BossAI
|
||||
{
|
||||
boss_pit_lord_argaloth(Creature creature) : base(creature, DataTypes.Argaloth) { }
|
||||
|
||||
public override void JustEngagedWith(Unit who)
|
||||
{
|
||||
base.JustEngagedWith(who);
|
||||
instance.SendEncounterUnit(EncounterFrameType.Engage, me);
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(20), task =>
|
||||
{
|
||||
DoCastAOE(SpellIds.MeteorSlash);
|
||||
task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(20));
|
||||
});
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(20), TimeSpan.FromSeconds(25), task =>
|
||||
{
|
||||
DoCastAOE(SpellIds.ConsumingDarkness, new CastSpellExtraArgs(true));
|
||||
task.Repeat(TimeSpan.FromSeconds(20), TimeSpan.FromSeconds(25));
|
||||
});
|
||||
_scheduler.Schedule(TimeSpan.FromMinutes(5), task =>
|
||||
{
|
||||
DoCast(me, SpellIds.Berserk, new CastSpellExtraArgs(true));
|
||||
});
|
||||
}
|
||||
|
||||
public override void EnterEvadeMode(EvadeReason why)
|
||||
{
|
||||
instance.SendEncounterUnit(EncounterFrameType.Disengage, me);
|
||||
_DespawnAtEvade();
|
||||
}
|
||||
|
||||
public override void DamageTaken(Unit attacker, ref uint damage, DamageEffectType damageType, SpellInfo spellInfo = null)
|
||||
{
|
||||
if (me.HealthBelowPctDamaged(33, damage) ||
|
||||
me.HealthBelowPctDamaged(66, damage))
|
||||
{
|
||||
DoCastAOE(SpellIds.FelFirestorm);
|
||||
}
|
||||
}
|
||||
|
||||
public override void JustDied(Unit killer)
|
||||
{
|
||||
_JustDied();
|
||||
instance.SendEncounterUnit(EncounterFrameType.Disengage, me);
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
_scheduler.Update(diff, () => DoMeleeAttackIfReady());
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 88954 / 95173 - Consuming Darkness
|
||||
class spell_argaloth_consuming_darkness_SpellScript : SpellScript
|
||||
{
|
||||
void FilterTargets(List<WorldObject> targets)
|
||||
{
|
||||
targets.RandomResize(GetCaster().GetMap().Is25ManRaid() ? 8 : 3u);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitSrcAreaEnemy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 88942 / 95172 - Meteor Slash
|
||||
class spell_argaloth_meteor_slash_SpellScript : SpellScript
|
||||
{
|
||||
int _targetCount;
|
||||
|
||||
void CountTargets(List<WorldObject> targets)
|
||||
{
|
||||
_targetCount = targets.Count;
|
||||
}
|
||||
|
||||
void SplitDamage()
|
||||
{
|
||||
if (_targetCount == 0)
|
||||
return;
|
||||
|
||||
SetHitDamage((GetHitDamage() / _targetCount));
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(CountTargets, 0, Targets.UnitConeCasterToDestEnemy));
|
||||
OnHit.Add(new HitHandler(SplitDamage));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user