diff --git a/Scripts/Events/HallowsEnd.cs b/Scripts/Events/HallowsEnd.cs new file mode 100644 index 000000000..ddc49c984 --- /dev/null +++ b/Scripts/Events/HallowsEnd.cs @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2012-2017 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 . + */ + +using Framework.Constants; +using Game.Entities; +using Game.Scripting; +using Game.Spells; + +namespace Scripts.Events +{ + struct HallowsEnd + { + public const uint ItemWaterBucket = 32971; + public const uint SpellHasWaterBucket = 42336; + } + + [Script] + class spell_hallows_end_has_water_bucket : AuraScript + { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(HallowsEnd.SpellHasWaterBucket); + } + + void HandleEffectApply(AuraEffect aurEff, AuraEffectHandleModes mode) + { + Unit caster = GetCaster(); + if (caster) + if (caster.IsPlayer()) + if (!caster.ToPlayer().HasItemCount(HallowsEnd.ItemWaterBucket, 1, false)) + caster.RemoveAurasDueToSpell(HallowsEnd.SpellHasWaterBucket); + } + + public override void Register() + { + AfterEffectApply.Add(new EffectApplyHandler(HandleEffectApply, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); + } + } +} diff --git a/Scripts/Northrend/FrozenHalls/ForgeOfSouls/BossBronjahm.cs b/Scripts/Northrend/FrozenHalls/ForgeOfSouls/BossBronjahm.cs index 924a8f829..14a7b99ef 100644 --- a/Scripts/Northrend/FrozenHalls/ForgeOfSouls/BossBronjahm.cs +++ b/Scripts/Northrend/FrozenHalls/ForgeOfSouls/BossBronjahm.cs @@ -224,9 +224,9 @@ namespace Scripts.Northrend.FrozenHalls.ForgeOfSouls.Bronjahm } [Script] - class npc_corrupted_soul_fragmentAI : ScriptedAI + class npc_corrupted_soul_fragment : ScriptedAI { - public npc_corrupted_soul_fragmentAI(Creature creature) : base(creature) + public npc_corrupted_soul_fragment(Creature creature) : base(creature) { instance = me.GetInstanceScript(); } diff --git a/Scripts/Northrend/FrozenHalls/PitOfSaron/BossForgemasterGarfrost.cs b/Scripts/Northrend/FrozenHalls/PitOfSaron/BossForgemasterGarfrost.cs new file mode 100644 index 000000000..e9cfdd159 --- /dev/null +++ b/Scripts/Northrend/FrozenHalls/PitOfSaron/BossForgemasterGarfrost.cs @@ -0,0 +1,308 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Game.AI; +using Game.Entities; +using Framework.Constants; +using Game.Spells; +using Game.Scripting; + +namespace Scripts.Northrend.FrozenHalls.PitOfSaron.BossForgemasterGarfrost +{ + struct TextIds + { + public const uint SayAggro = 0; + public const uint SayPhase2 = 1; + public const uint SayPhase3 = 2; + public const uint SayDeath = 3; + public const uint SaySlay = 4; + public const uint SayThrowSaronite = 5; + public const uint SayCastDeepFreeze = 6; + + public const uint SayTyrannusDeath = 0; + } + + struct SpellIds + { + public const uint Permafrost = 70326; + public const uint ThrowSaronite = 68788; + public const uint ThunderingStomp = 68771; + public const uint ChillingWave = 68778; + public const uint DeepFreeze = 70381; + public const uint ForgeMace = 68785; + public const uint ForgeBlade = 68774; + + public const uint PermafrostAura = 68786; + } + + struct Misc + { + public const byte PhaseOne = 1; + public const byte PhaseTwo = 2; + public const byte PhaseThree = 3; + + public const int EquipIdSword = 49345; + public const int EquipIdMace = 49344; + public const uint AchievDoesntGoToEleven = 0; + public const uint PointForge = 0; + + public static Position northForgePos = new Position(722.5643f, -234.1615f, 527.182f, 2.16421f); + public static Position southForgePos = new Position(639.257f, -210.1198f, 529.015f, 0.523599f); + } + + struct Events + { + public const uint ThrowSaronite = 1; + public const uint ChillingWave = 2; + public const uint DeepFreeze = 3; + public const uint ForgeJump = 4; + public const uint ResumeAttack = 5; + } + + [Script] + class boss_garfrost : BossAI + { + public boss_garfrost(Creature creature) : base(creature, DataTypes.Garfrost) { } + + public override void Reset() + { + _Reset(); + _events.SetPhase(Misc.PhaseOne); + SetEquipmentSlots(true); + _permafrostStack = 0; + } + + public override void EnterCombat(Unit who) + { + _EnterCombat(); + Talk(TextIds.SayAggro); + DoCast(me, SpellIds.Permafrost); + me.CallForHelp(70.0f); + _events.ScheduleEvent(Events.ThrowSaronite, 7000); + } + + public override void KilledUnit(Unit victim) + { + if (victim.IsPlayer()) + Talk(TextIds.SaySlay); + } + + public override void JustDied(Unit killer) + { + _JustDied(); + Talk(TextIds.SayDeath); + me.RemoveAllGameObjects(); + + Creature tyrannus = ObjectAccessor.GetCreature(me, instance.GetGuidData(DataTypes.Tyrannus)); + if (tyrannus) + tyrannus.GetAI().Talk(TextIds.SayTyrannusDeath); + } + + public override void DamageTaken(Unit attacker, ref uint damage) + { + if (_events.IsInPhase(Misc.PhaseOne) && !HealthAbovePct(66)) + { + _events.SetPhase(Misc.PhaseTwo); + Talk(TextIds.SayPhase2); + _events.DelayEvents(8000); + DoCast(me, SpellIds.ThunderingStomp); + _events.ScheduleEvent(Events.ForgeJump, 1500); + return; + } + + if (_events.IsInPhase(Misc.PhaseTwo) && !HealthAbovePct(33)) + { + _events.SetPhase(Misc.PhaseThree); + Talk(TextIds.SayPhase3); + _events.DelayEvents(8000); + DoCast(me, SpellIds.ThunderingStomp); + _events.ScheduleEvent(Events.ForgeJump, 1500); + return; + } + } + + public override void MovementInform(MovementGeneratorType type, uint id) + { + if (type != MovementGeneratorType.Effect || id != Misc.PointForge) + return; + + if (_events.IsInPhase(Misc.PhaseTwo)) + { + DoCast(me, SpellIds.ForgeBlade); + SetEquipmentSlots(false, Misc.EquipIdSword); + } + if (_events.IsInPhase(Misc.PhaseThree)) + { + me.RemoveAurasDueToSpell(SpellIds.ForgeBlade); + DoCast(me, SpellIds.ForgeMace); + SetEquipmentSlots(false, Misc.EquipIdMace); + } + _events.ScheduleEvent(Events.ResumeAttack, 5000); + } + + public override void SpellHitTarget(Unit target, SpellInfo spell) + { + if (spell.Id == SpellIds.PermafrostAura) + { + Aura aura = target.GetAura(SpellIds.PermafrostAura); + if (aura != null) + _permafrostStack = Math.Max(_permafrostStack, aura.GetStackAmount()); + } + } + + public override uint GetData(uint type) + { + return _permafrostStack; + } + + public override void UpdateAI(uint diff) + { + if (!UpdateVictim()) + return; + + _events.Update(diff); + + if (me.HasUnitState(UnitState.Casting)) + return; + + _events.ExecuteEvents(eventId => + { + switch (eventId) + { + case Events.ThrowSaronite: + { + Unit target = SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true); + if (target) + { + Talk(TextIds.SayThrowSaronite, target); + DoCast(target, SpellIds.ThrowSaronite); + } + _events.ScheduleEvent(Events.ThrowSaronite, TimeSpan.FromSeconds(12.5), TimeSpan.FromSeconds(20)); + } + break; + case Events.ChillingWave: + DoCast(me, SpellIds.ChillingWave); + _events.ScheduleEvent(Events.ChillingWave, 40000, 0, Misc.PhaseTwo); + break; + case Events.DeepFreeze: + { + Unit target = SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true); + if (target) + { + Talk(TextIds.SayCastDeepFreeze, target); + DoCast(target, SpellIds.DeepFreeze); + } + _events.ScheduleEvent(Events.DeepFreeze, 35000, 0, Misc.PhaseThree); + } + break; + case Events.ForgeJump: + me.AttackStop(); + if (_events.IsInPhase(Misc.PhaseTwo)) + me.GetMotionMaster().MoveJump(Misc.northForgePos, 25.0f, 15.0f, Misc.PointForge); + else if (_events.IsInPhase(Misc.PhaseThree)) + me.GetMotionMaster().MoveJump(Misc.southForgePos, 25.0f, 15.0f, Misc.PointForge); + break; + case Events.ResumeAttack: + if (_events.IsInPhase(Misc.PhaseTwo)) + _events.ScheduleEvent(Events.ChillingWave, 5000, 0, Misc.PhaseTwo); + else if (_events.IsInPhase(Misc.PhaseThree)) + _events.ScheduleEvent(Events.DeepFreeze, 10000, 0, Misc.PhaseThree); + AttackStart(me.GetVictim()); + break; + default: + break; + } + + if (me.HasUnitState(UnitState.Casting)) + return; + }); + + DoMeleeAttackIfReady(); + } + + uint _permafrostStack; + } + + [Script] + class spell_garfrost_permafrost : SpellScript + { + public spell_garfrost_permafrost() + { + prevented = false; + } + + void PreventHitByLoS(SpellMissInfo missInfo) + { + if (missInfo != SpellMissInfo.None) + return; + + Unit target = GetHitUnit(); + if (target) + { + Unit caster = GetCaster(); + //Temporary Line of Sight Check + List blockList = new List(); + caster.GetGameObjectListWithEntryInGrid(blockList, GameObjectIds.SaroniteRock, 100.0f); + if (!blockList.Empty()) + { + foreach (var obj in blockList) + { + if (!obj.IsInvisibleDueToDespawn()) + { + if (obj.IsInBetween(caster, target, 4.0f)) + { + prevented = true; + target.ApplySpellImmune(GetSpellInfo().Id, SpellImmunity.Id, GetSpellInfo().Id, true); + PreventHitDefaultEffect(0); + PreventHitDefaultEffect(1); + PreventHitDefaultEffect(2); + PreventHitDamage(); + break; + } + } + } + } + } + } + + void RestoreImmunity() + { + Unit target = GetHitUnit(); + if (target) + { + target.ApplySpellImmune(GetSpellInfo().Id, SpellImmunity.Id, GetSpellInfo().Id, false); + if (prevented) + PreventHitAura(); + } + } + + public override void Register() + { + BeforeHit.Add(new BeforeHitHandler(PreventHitByLoS)); + AfterHit.Add(new HitHandler(RestoreImmunity)); + } + + bool prevented; + } + + [Script] + class achievement_doesnt_go_to_eleven : AchievementCriteriaScript + { + public achievement_doesnt_go_to_eleven() : base("achievement_doesnt_go_to_eleven") { } + + public override bool OnCheck(Player source, Unit target) + { + if (target) + { + Creature garfrost = target.ToCreature(); + if (garfrost) + if (garfrost.GetAI().GetData(Misc.AchievDoesntGoToEleven) <= 10) + return true; + } + + return false; + } + } +} diff --git a/Scripts/Northrend/FrozenHalls/PitOfSaron/BossKrickAndIck.cs b/Scripts/Northrend/FrozenHalls/PitOfSaron/BossKrickAndIck.cs new file mode 100644 index 000000000..4cb8e14ae --- /dev/null +++ b/Scripts/Northrend/FrozenHalls/PitOfSaron/BossKrickAndIck.cs @@ -0,0 +1,678 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Game.Entities; +using Game.Scripting; +using Game.AI; +using Framework.Constants; +using Game.Maps; +using Game.Spells; + +namespace Scripts.Northrend.FrozenHalls.PitOfSaron.BossKrickAndIck +{ + struct SpellIds + { + public const uint MightyKick = 69021; //Ick'S Spell + public const uint ShadowBolt = 69028; //Krick'S Spell + public const uint ToxicWaste = 69024; //Krick'S Spell + public const uint ExplosiveBarrageKrick = 69012; //Special Spell 1 + public const uint ExplosiveBarrageIck = 69263; //Special Spell 1 + public const uint PoisonNova = 68989; //Special Spell 2 + public const uint Pursuit = 68987; //Special Spell 3 + + public const uint ExplosiveBarrageSummon = 69015; + public const uint ExplodingOrb = 69017; //Visual On Exploding Orb + public const uint AutoGrow = 69020; //Grow Effect On Exploding Orb + public const uint HastyGrow = 44851; //Need To Check Growing Stacks + public const uint ExplosiveBarrageDamage = 69019; //Damage Done By Orb While Exploding + + public const uint Strangulating = 69413; //Krick'S Selfcast In Intro + public const uint Suicide = 7; + public const uint KrickKillCredit = 71308; + public const uint NecromanticPower = 69753; + } + + struct TextIds + { + // Krick + public const uint SayKrickAggro = 0; + public const uint SayKrickSlay = 1; + public const uint SayKrickBarrage1 = 2; + public const uint SayKrickBarrage2 = 3; + public const uint SayKrickPoisonNova = 4; + public const uint SayKrickChase = 5; + public const uint SayKrickOutro1 = 6; + public const uint SayKrickOutro3 = 7; + public const uint SayKrickOutro5 = 8; + public const uint SayKrickOutro8 = 9; + + // Ick + public const uint SayIckPoisonNova = 0; + public const uint SayIckChase1 = 1; + + // Outro + public const uint SayJaynaOutro2 = 0; + public const uint SayJaynaOutro4 = 1; + public const uint SayJaynaOutro10 = 2; + public const uint SaySylvanasOutro2 = 0; + public const uint SaySylvanasOutro4 = 1; + public const uint SaySylvanasOutro10 = 2; + public const uint SayTyrannusOutro7 = 1; + public const uint SayTyrannusOutro9 = 2; + } + + struct Events + { + public const uint MightyKick = 1; + public const uint ShadowBolt = 2; + public const uint ToxicWaste = 3; + public const uint Special = 4; //Special Spell Selection (One Of Event 5; 6 Or 7) + public const uint Pursuit = 5; + public const uint PoisonNova = 6; + public const uint ExplosiveBarrage = 7; + + // Krick Outro + public const uint Outro1 = 8; + public const uint Outro2 = 9; + public const uint Outro3 = 10; + public const uint Outro4 = 11; + public const uint Outro5 = 12; + public const uint Outro6 = 13; + public const uint Outro7 = 14; + public const uint Outro8 = 15; + public const uint Outro9 = 16; + public const uint Outro10 = 17; + public const uint Outro11 = 18; + public const uint Outro12 = 19; + public const uint Outro13 = 20; + public const uint OutroEnd = 21; + } + + enum KrickPhase + { + Combat = 1, + Outro = 2 + } + + struct Misc + { + public const int ActionOutro = 1; + + public const uint PointKrickIntro = 364770; + public const uint PointKrickDeath = 364771; + + public static Position[] outroPos = + { + new Position(828.9342f, 118.6247f, 509.5190f, 0.0000000f), // Krick's Outro Position + new Position( 841.0100f, 196.2450f, 573.9640f, 0.2046099f), // Scourgelord Tyrannus Outro Position (Tele to...) + new Position( 777.2274f, 119.5521f, 510.0363f, 6.0562930f), // Sylvanas / Jaine Outro Spawn Position (NPC_SYLVANAS_PART1) + new Position(823.3984f, 114.4907f, 509.4899f, 0.0000000f), // Sylvanas / Jaine Outro Move Position (1) + new Position( 835.5887f, 139.4345f, 530.9526f, 0.0000000f), // Tyrannus fly down Position (not sniffed) + new Position( 828.9342f, 118.6247f, 514.5190f, 0.0000000f), // Krick's Choke Position + new Position(828.9342f, 118.6247f, 509.4958f, 0.0000000f), // Kirck's Death Position + new Position(914.4820f, 143.1602f, 633.3624f, 0.0000000f) // Tyrannus fly up (not sniffed) + }; + } + + + [Script] + class boss_ick : BossAI + { + public boss_ick(Creature creature) : base(creature, DataTypes.Ick) + { + _tempThreat = 0; + } + + public override void Reset() + { + _events.Reset(); + instance.SetBossState(DataTypes.Ick, EncounterState.NotStarted); + } + + Creature GetKrick() + { + return ObjectAccessor.GetCreature(me, instance.GetGuidData(DataTypes.Krick)); + } + + public override void EnterCombat(Unit who) + { + _EnterCombat(); + + Creature krick = GetKrick(); + if (krick) + krick.GetAI().Talk(TextIds.SayKrickAggro); + + _events.ScheduleEvent(Events.MightyKick, 20000); + _events.ScheduleEvent(Events.ToxicWaste, 5000); + _events.ScheduleEvent(Events.ShadowBolt, 10000); + _events.ScheduleEvent(Events.Special, TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(35)); + } + + public override void EnterEvadeMode(EvadeReason why) + { + me.GetMotionMaster().Clear(); + base.EnterEvadeMode(why); + } + + public override void JustDied(Unit killer) + { + Creature krick = GetKrick(); + if (krick) + { + Vehicle vehicle = me.GetVehicleKit(); + if (vehicle) + vehicle.RemoveAllPassengers(); + if (krick.IsAIEnabled) + krick.GetAI().DoAction(Misc.ActionOutro); + } + + instance.SetBossState(DataTypes.Ick, EncounterState.Done); + } + + public void SetTempThreat(float threat) + { + _tempThreat = threat; + } + + public void _ResetThreat(Unit target) + { + DoModifyThreatPercent(target, -100); + me.AddThreat(target, _tempThreat); + } + + public override void UpdateAI(uint diff) + { + if (!me.IsInCombat()) + return; + + if (!me.GetVictim() && me.GetThreatManager().isThreatListEmpty()) + { + EnterEvadeMode(EvadeReason.NoHostiles); + return; + } + + _events.Update(diff); + + if (me.HasUnitState(UnitState.Casting)) + return; + + _events.ExecuteEvents(eventId => + { + switch (eventId) + { + case Events.ToxicWaste: + { + Creature krick = GetKrick(); + if (krick) + { + Unit target = SelectTarget(SelectAggroTarget.Random, 0); + if (target) + krick.CastSpell(target, SpellIds.ToxicWaste); + _events.ScheduleEvent(Events.ToxicWaste, TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(10)); + } + } + break; + case Events.ShadowBolt: + { + Creature krick = GetKrick(); + if (krick) + { + Unit target = SelectTarget(SelectAggroTarget.Random, 1); + if (target) + krick.CastSpell(target, SpellIds.ShadowBolt); + _events.ScheduleEvent(Events.ShadowBolt, 15000); + } + } + return; + case Events.MightyKick: + DoCastVictim(SpellIds.MightyKick); + _events.ScheduleEvent(Events.MightyKick, 25000); + return; + case Events.Special: + //select one of these three special _events + _events.ScheduleEvent(RandomHelper.RAND(Events.ExplosiveBarrage, Events.PoisonNova, Events.Pursuit), 1000); + _events.ScheduleEvent(Events.Special, TimeSpan.FromSeconds(23), TimeSpan.FromSeconds(28)); + break; + case Events.ExplosiveBarrage: + { + Creature krick = GetKrick(); + if (krick) + { + krick.GetAI().Talk(TextIds.SayKrickBarrage1); + krick.GetAI().Talk(TextIds.SayKrickBarrage2); + krick.CastSpell(krick, SpellIds.ExplosiveBarrageKrick, true); + DoCast(me, SpellIds.ExplosiveBarrageIck); + } + _events.DelayEvents(20000); + } + break; + case Events.PoisonNova: + { + Creature krick = GetKrick(); + if (krick) + krick.GetAI().Talk(TextIds.SayKrickPoisonNova); + + Talk(TextIds.SayIckPoisonNova); + DoCast(me, SpellIds.PoisonNova); + } + break; + case Events.Pursuit: + { + Creature krick = GetKrick(); + if (krick) + krick.GetAI().Talk(TextIds.SayKrickChase); + DoCast(me, SpellIds.Pursuit); + } + break; + default: + break; + } + + if (me.HasUnitState(UnitState.Casting)) + return; + }); + + DoMeleeAttackIfReady(); + } + + float _tempThreat; + } + + [Script] + class boss_krick : ScriptedAI + { + public boss_krick(Creature creature) : base(creature) + { + _instanceScript = creature.GetInstanceScript(); + _summons = new SummonList(creature); + Initialize(); + } + + void Initialize() + { + _phase = KrickPhase.Combat; + _outroNpcGUID.Clear(); + _tyrannusGUID.Clear(); + } + + public override void Reset() + { + _events.Reset(); + Initialize(); + + me.SetReactState(ReactStates.Passive); + me.SetFlag(UnitFields.Flags, UnitFlags.NonAttackable); + } + + Creature GetIck() + { + return ObjectAccessor.GetCreature(me, _instanceScript.GetGuidData(DataTypes.Ick)); + } + + public override void KilledUnit(Unit victim) + { + if (victim.IsPlayer()) + Talk(TextIds.SayKrickSlay); + } + + public override void JustSummoned(Creature summon) + { + _summons.Summon(summon); + if (summon.GetEntry() == CreatureIds.ExplodingOrb) + { + summon.CastSpell(summon, SpellIds.ExplodingOrb, true); + summon.CastSpell(summon, SpellIds.AutoGrow, true); + } + } + + public override void DoAction(int actionId) + { + if (actionId == Misc.ActionOutro) + { + Creature tyrannusPtr = ObjectAccessor.GetCreature(me, _instanceScript.GetGuidData(DataTypes.TyrannusEvent)); + if (tyrannusPtr) + tyrannusPtr.NearTeleportTo(Misc.outroPos[1].GetPositionX(), Misc.outroPos[1].GetPositionY(), Misc.outroPos[1].GetPositionZ(), Misc.outroPos[1].GetOrientation()); + else + tyrannusPtr = me.SummonCreature(CreatureIds.TyrannusEvents, Misc.outroPos[1], TempSummonType.ManualDespawn); + + tyrannusPtr.SetCanFly(true); + me.GetMotionMaster().MovePoint(Misc.PointKrickIntro, Misc.outroPos[0].GetPositionX(), Misc.outroPos[0].GetPositionY(), Misc.outroPos[0].GetPositionZ()); + tyrannusPtr.SetFacingToObject(me); + } + } + + public override void MovementInform(MovementGeneratorType type, uint id) + { + if (type != MovementGeneratorType.Point || id != Misc.PointKrickIntro) + return; + + Talk(TextIds.SayKrickOutro1); + _phase = KrickPhase.Outro; + _events.Reset(); + _events.ScheduleEvent(Events.Outro1, 1000); + } + + public override void UpdateAI(uint diff) + { + if (_phase != KrickPhase.Outro) + return; + + _events.Update(diff); + + _events.ExecuteEvents(eventId => + { + switch (eventId) + { + case Events.Outro1: + { + Creature temp = ObjectAccessor.GetCreature(me, _instanceScript.GetGuidData(DataTypes.JainaSylvanas1)); + if (temp) + temp.DespawnOrUnsummon(); + + Creature jainaOrSylvanas = null; + if (_instanceScript.GetData(DataTypes.TeamInInstance) == (uint)Team.Alliance) + jainaOrSylvanas = me.SummonCreature(CreatureIds.JainaPart1, Misc.outroPos[2], TempSummonType.ManualDespawn); + else + jainaOrSylvanas = me.SummonCreature(CreatureIds.SylvanasPart1, Misc.outroPos[2], TempSummonType.ManualDespawn); + + if (jainaOrSylvanas) + { + jainaOrSylvanas.GetMotionMaster().MovePoint(0, Misc.outroPos[3]); + _outroNpcGUID = jainaOrSylvanas.GetGUID(); + } + _events.ScheduleEvent(Events.Outro2, 6000); + break; + } + case Events.Outro2: + { + Creature jainaOrSylvanas = ObjectAccessor.GetCreature(me, _outroNpcGUID); + if (jainaOrSylvanas) + { + jainaOrSylvanas.SetFacingToObject(me); + me.SetFacingToObject(jainaOrSylvanas); + if (_instanceScript.GetData(DataTypes.TeamInInstance) == (uint)Team.Alliance) + jainaOrSylvanas.GetAI().Talk(TextIds.SayJaynaOutro2); + else + jainaOrSylvanas.GetAI().Talk(TextIds.SaySylvanasOutro2); + } + _events.ScheduleEvent(Events.Outro3, 5000); + } + break; + case Events.Outro3: + Talk(TextIds.SayKrickOutro3); + _events.ScheduleEvent(Events.Outro4, 18000); + break; + case Events.Outro4: + { + Creature jainaOrSylvanas = ObjectAccessor.GetCreature(me, _outroNpcGUID); + if (jainaOrSylvanas) + { + if (_instanceScript.GetData(DataTypes.TeamInInstance) == (uint)Team.Alliance) + jainaOrSylvanas.GetAI().Talk(TextIds.SayJaynaOutro4); + else + jainaOrSylvanas.GetAI().Talk(TextIds.SaySylvanasOutro4); + } + _events.ScheduleEvent(Events.Outro5, 5000); + } + break; + case Events.Outro5: + Talk(TextIds.SayKrickOutro5); + _events.ScheduleEvent(Events.Outro6, 1000); + break; + case Events.Outro6: + { + Creature tyrannus = ObjectAccessor.GetCreature(me, _instanceScript.GetGuidData(DataTypes.TyrannusEvent)); + if (tyrannus) + { + tyrannus.SetSpeedRate(UnitMoveType.Flight, 3.5f); + tyrannus.GetMotionMaster().MovePoint(1, Misc.outroPos[4]); + _tyrannusGUID = tyrannus.GetGUID(); + } + _events.ScheduleEvent(Events.Outro7, 5000); + } + break; + case Events.Outro7: + { + Creature tyrannus = ObjectAccessor.GetCreature(me, _tyrannusGUID); + if (tyrannus) + tyrannus.GetAI().Talk(TextIds.SayTyrannusOutro7); + _events.ScheduleEvent(Events.Outro8, 5000); + } + break; + case Events.Outro8: + //! HACK: Creature's can't have MOVEMENTFLAG_FLYING + me.AddUnitMovementFlag(MovementFlag.Flying); + me.GetMotionMaster().MovePoint(0, Misc.outroPos[5]); + DoCast(me, SpellIds.Strangulating); + _events.ScheduleEvent(Events.Outro9, 2000); + break; + case Events.Outro9: + { + Talk(TextIds.SayKrickOutro8); + /// @todo Tyrannus starts killing Krick. + // there shall be some visual spell effect + Creature tyrannus = ObjectAccessor.GetCreature(me, _tyrannusGUID); + if (tyrannus) + tyrannus.CastSpell(me, SpellIds.NecromanticPower, true); //not sure if it's the right spell :/ + _events.ScheduleEvent(Events.Outro10, 1000); + } + break; + case Events.Outro10: + //! HACK: Creature's can't have MOVEMENTFLAG_FLYING + me.RemoveUnitMovementFlag(MovementFlag.Flying); + me.AddUnitMovementFlag(MovementFlag.FallingFar); + me.GetMotionMaster().MovePoint(0, Misc.outroPos[6]); + _events.ScheduleEvent(Events.Outro11, 2000); + break; + case Events.Outro11: + DoCast(me, SpellIds.KrickKillCredit); // don't really know if we need it + me.SetStandState(UnitStandStateType.Dead); + me.SetHealth(0); + _events.ScheduleEvent(Events.Outro12, 3000); + break; + case Events.Outro12: + { + Creature tyrannus = ObjectAccessor.GetCreature(me, _tyrannusGUID); + if (tyrannus) + tyrannus.GetAI().Talk(TextIds.SayTyrannusOutro9); + _events.ScheduleEvent(Events.Outro13, 2000); + } + break; + case Events.Outro13: + { + Creature jainaOrSylvanas = ObjectAccessor.GetCreature(me, _outroNpcGUID); + if (jainaOrSylvanas) + { + if (_instanceScript.GetData(DataTypes.TeamInInstance) == (uint)Team.Alliance) + jainaOrSylvanas.GetAI().Talk(TextIds.SayJaynaOutro10); + else + jainaOrSylvanas.GetAI().Talk(TextIds.SaySylvanasOutro10); + } + // End of OUTRO. for now... + _events.ScheduleEvent(Events.OutroEnd, 3000); + + Creature tyrannus = ObjectAccessor.GetCreature(me, _tyrannusGUID); + if (tyrannus) + tyrannus.GetMotionMaster().MovePoint(0, Misc.outroPos[7]); + } + break; + case Events.OutroEnd: + { + Creature tyrannus = ObjectAccessor.GetCreature(me, _tyrannusGUID); + if (tyrannus) + tyrannus.DespawnOrUnsummon(); + + me.DisappearAndDie(); + } + break; + default: + break; + } + }); + } + + InstanceScript _instanceScript; + SummonList _summons; + + KrickPhase _phase; + ObjectGuid _outroNpcGUID; + ObjectGuid _tyrannusGUID; + } + + [Script] + class spell_krick_explosive_barrage : AuraScript + { + void HandlePeriodicTick(AuraEffect aurEff) + { + PreventDefaultAction(); + Unit caster = GetCaster(); + if (caster) + { + if (caster.IsCreature()) + { + var players = caster.GetMap().GetPlayers(); + foreach (var player in players) + { + if (player) + if (player.IsWithinDist(caster, 60.0f)) // don't know correct range + caster.CastSpell(player, SpellIds.ExplosiveBarrageSummon, true); + } + } + } + } + + public override void Register() + { + OnEffectPeriodic.Add(new EffectPeriodicHandler(HandlePeriodicTick, 0, AuraType.PeriodicTriggerSpell)); + } + } + + [Script] + class spell_ick_explosive_barrage : AuraScript + { + void HandleEffectApply(AuraEffect aurEff, AuraEffectHandleModes mode) + { + Unit caster = GetCaster(); + if (caster) + if (caster.IsCreature()) + caster.GetMotionMaster().MoveIdle(); + } + + void HandleEffectRemove(AuraEffect aurEff, AuraEffectHandleModes mode) + { + Unit caster = GetCaster(); + if (caster) + { + if (caster.IsCreature()) + { + caster.GetMotionMaster().Clear(); + caster.GetMotionMaster().MoveChase(caster.GetVictim()); + } + } + } + + public override void Register() + { + AfterEffectApply.Add(new EffectApplyHandler(HandleEffectApply, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); + AfterEffectRemove.Add(new EffectApplyHandler(HandleEffectRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); + } + } + + [Script] + class spell_exploding_orb_hasty_grow : AuraScript + { + void OnStackChange(AuraEffect aurEff, AuraEffectHandleModes mode) + { + if (GetStackAmount() == 15) + { + Unit target = GetTarget(); // store target because aura gets removed + target.CastSpell(target, SpellIds.ExplosiveBarrageDamage, false); + target.RemoveAurasDueToSpell(SpellIds.HastyGrow); + target.RemoveAurasDueToSpell(SpellIds.AutoGrow); + target.RemoveAurasDueToSpell(SpellIds.ExplodingOrb); + + Creature creature = target.ToCreature(); + if (creature) + creature.DespawnOrUnsummon(); + } + } + + public override void Register() + { + AfterEffectApply.Add(new EffectApplyHandler(OnStackChange, 0, AuraType.ModScale, AuraEffectHandleModes.Reapply)); + } + } + + [Script] + class spell_krick_pursuit : SpellScript + { + void HandleScriptEffect(uint effIndex) + { + if (GetCaster()) + { + Creature ick = GetCaster().ToCreature(); + if (ick) + { + Unit target = ick.GetAI().SelectTarget(SelectAggroTarget.Random, 0, 200.0f, true); + if (target) + { + ick.GetAI().Talk(TextIds.SayIckChase1, target); + ick.AddAura(GetSpellInfo().Id, target); + ick.GetAI().SetTempThreat(ick.GetThreatManager().getThreat(target)); + ick.AddThreat(target, GetEffectValue()); + target.AddThreat(ick, GetEffectValue()); + } + } + } + } + + public override void Register() + { + OnEffectHitTarget.Add(new EffectHandler(HandleScriptEffect, 1, SpellEffectName.ScriptEffect)); + } + } + + [Script] + class spell_krick_pursuit_AuraScript : AuraScript + { + void HandleExtraEffect(AuraEffect aurEff, AuraEffectHandleModes mode) + { + Unit caster = GetCaster(); + if (caster) + { + Creature creCaster = caster.ToCreature(); + if (creCaster) + creCaster.GetAI()._ResetThreat(GetTarget()); + } + } + + public override void Register() + { + AfterEffectRemove.Add(new EffectApplyHandler(HandleExtraEffect, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); + } + } + + [Script] + class spell_krick_pursuit_confusion : AuraScript + { + void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode) + { + GetTarget().ApplySpellImmune(0, SpellImmunity.State, AuraType.ModTaunt, true); + GetTarget().ApplySpellImmune(0, SpellImmunity.Effect, SpellEffectName.AttackMe, true); + } + + void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode) + { + GetTarget().ApplySpellImmune(0, SpellImmunity.State, AuraType.ModTaunt, false); + GetTarget().ApplySpellImmune(0, SpellImmunity.Effect, SpellEffectName.AttackMe, false); + } + + public override void Register() + { + OnEffectApply.Add(new EffectApplyHandler(OnApply, 2, AuraType.Linked, AuraEffectHandleModes.Real)); + OnEffectRemove.Add(new EffectApplyHandler(OnRemove, 2, AuraType.Linked, AuraEffectHandleModes.Real)); + } + } +} diff --git a/Scripts/Scripts.csproj b/Scripts/Scripts.csproj index abefa40bb..a901f0e7c 100644 --- a/Scripts/Scripts.csproj +++ b/Scripts/Scripts.csproj @@ -60,6 +60,7 @@ + @@ -73,6 +74,8 @@ + +