Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using WCell.Constants.NPCs;
- using WCell.Constants.Spells;
- using WCell.Constants.World;
- using WCell.Core.Initialization;
- using WCell.RealmServer.AI.Actions.Combat;
- using WCell.RealmServer.AI.Brains;
- using WCell.RealmServer.Entities;
- using WCell.RealmServer.Instances;
- using WCell.RealmServer.NPCs;
- using WCell.RealmServer.Spells;
- ///
- /// This file was automatically created, using WCell's CodeFileWriter
- /// Date: 6/11/2009
- ///
- namespace WCell.Addons.Default.Instances
- {
- public class ZulFarrak : BaseInstance
- {
- #region Content (General)
- #region Npc Entries
- private static NPCEntry _antusulEntry;
- private static NPCEntry _antusulAddsEntry;
- //private static NPCEntry _antusulTriggerEntry;
- private NPC Antusul;
- #endregion
- [Initialization]
- [DependentInitialization(typeof(NPCMgr))]
- public static void InitNPCs()
- {
- /*
- _antusulTriggerEntry = NPCMgr.GetEntry(133337);
- _antusulTriggerEntry.BrainCreator = _antusulTrigger => new AntusulTriggerBrain(_antusulTrigger);
- * */
- SetupAntusul();
- }
- #endregion
- #region Antu'sul
- private static void SetupAntusul()
- {
- _antusulEntry = NPCMgr.GetEntry(NPCId.Antusul);
- _antusulEntry.BrainCreator = antusul => new AntusulBrain(antusul);
- _antusulAddsEntry = NPCMgr.GetEntry(NPCId.SulLithuzBroodling);
- _antusulEntry.AddSpell(SpellId.ChainLightning);
- SpellHandler.Apply(spell => { spell.CooldownTime = 14000; },
- SpellId.ChainLightning);
- _antusulEntry.Activated += antusul =>
- {
- var instance = antusul.Map as ZulFarrak;
- if (instance == null || antusul.SpawnPoint == null)
- return;
- ((BaseBrain)antusul.Brain).DefaultCombatAction.Strategy = new AntusulAttackAction(antusul);
- };
- }
- public class AntusulBrain : MobBrain
- {
- const string TEXT_ENTERCOMBAT = "Lunch has arrived, my beautiful childern. Tear them to pieces!";
- public AntusulBrain(NPC antusul)
- : base(antusul)
- {
- }
- public override bool ScanAndAttack()
- {
- return base.ScanAndAttack();
- }
- public override void OnEnterCombat()
- {
- m_owner.Yell(TEXT_ENTERCOMBAT);
- // This mob doesn't attack
- //m_owner.SpellCast.TriggerSelf(SpellHandler.Get(SpellId.AntusulsMinion));
- base.OnEnterCombat();
- }
- /// <summary>
- /// Resets the cave trigger
- /// </summary>
- void ResetTrigger()
- {
- }
- }
- #region Antusul Attack Action
- public class AntusulAttackAction : AIAttackAction
- {
- internal static Spell ChainLighting, EarthShock, EarthgrabTotem, FireNovaTotem, HealingWard, HealingWaveOfAntusul;
- const string TEXT_SUMMON_1 = "Rise and defend your master!";
- const string TEXT_SUMMON_2 = "The children of Sul will protect their master. Rise once more Sul'ithuz!";
- private int phase = 1;
- //private readonly NPC[] AntusulBroodlingsServants = new NPC[4];
- private bool firstSpawns = false;
- [Initialization(InitializationPass.Second)]
- public static void InitAntusul()
- {
- /* Guesstimating the spells by how they cast/deal damage */
- ChainLighting = SpellHandler.Get(SpellId.ChainLightning);
- ChainLighting.AISettings.SetCooldownRange(14000, 17000);
- ChainLighting.AISettings.IdleTimeAfterCastMillis = 1000;
- EarthShock = SpellHandler.Get(SpellId.EarthShock_3);
- EarthShock.AISettings.SetCooldownRange(8000, 12000);
- EarthShock.AISettings.IdleTimeAfterCastMillis = 1000;
- EarthgrabTotem = SpellHandler.Get(SpellId.EarthgrabTotem);
- EarthgrabTotem.AISettings.SetCooldownRange(30000);
- EarthgrabTotem.AISettings.IdleTimeAfterCastMillis = 1000;
- FireNovaTotem = SpellHandler.Get(SpellId.FireNovaTotem);
- FireNovaTotem.AISettings.SetCooldownRange(15000);
- HealingWard = SpellHandler.Get(SpellId.HealingWard);
- HealingWard.AISettings.SetCooldownRange(40000);
- HealingWard.AISettings.IdleTimeAfterCastMillis = 1000;
- HealingWaveOfAntusul = SpellHandler.Get(SpellId.HealingWaveOfAntusul);
- HealingWaveOfAntusul.AISettings.SetCooldownRange(10000, 18000);
- HealingWaveOfAntusul.AISettings.IdleTimeAfterCastMillis = 1000;
- }
- public AntusulAttackAction(NPC antusul)
- : base(antusul)
- {
- }
- public override void Start()
- {
- base.Start();
- }
- public override void Update()
- {
- Character _char = m_owner.GetNearbyRandomHostileCharacter();
- NPC totems = null;
- int healthPCT = m_owner.HealthPct;
- if (phase == 1)
- {
- phase = 2;
- m_owner.SpellCast.Trigger(ChainLighting, _char);
- m_owner.SpellCast.Trigger(EarthgrabTotem);
- totems = m_owner.GetNearbyNPC(NPCId.EarthgrabTotem);
- if (totems != null)
- totems.Faction.Id = m_owner.FactionId;
- if (_char.IsUsingSpell)
- m_owner.SpellCast.Trigger(EarthShock, _char);
- }
- else if (healthPCT <= 75 && firstSpawns == false) // Spawn Broodlings
- {
- phase = 3;
- m_owner.Yell(TEXT_SUMMON_1);
- m_owner.SpellCast.Trigger(FireNovaTotem);
- totems = m_owner.GetNearbyNPC(NPCId.FireNovaTotemVII);
- if (totems != null)
- totems.Faction.Id = m_owner.FactionId;
- // Servants don't attack
- //m_owner.SpellCast.TriggerSelf(SpellHandler.Get(SpellId.AntusulsMinion));
- firstSpawns = true;
- }
- else if (healthPCT <= 25 && phase == 3)
- {
- phase = 4;
- m_owner.Yell(TEXT_SUMMON_2);
- m_owner.SpellCast.Trigger(HealingWaveOfAntusul, m_owner);
- m_owner.SpellCast.Trigger(HealingWard);
- totems = m_owner.GetNearbyNPC(NPCId.GreaterHealingWard);
- if (totems != null)
- totems.Faction.Id = m_owner.FactionId;
- // Servants don't attack
- // m_owner.SpellCast.TriggerSelf(SpellHandler.Get(SpellId.AntusulsMinion));
- }
- totems = null;
- base.Update();
- }
- public override void Stop()
- {
- base.Stop();
- }
- }
- #endregion
- // Waiting for Trigger to be spawned in the world. Postponed.
- #region Antu'sul Trigger
- /*
- public class AntusulTriggerBrain : MobBrain
- {
- public AntusulTriggerBrain(NPC antusul)
- : base(antusul)
- {
- }
- public override void OnEnterCombat()
- {
- NPC antusul = m_owner.GetNearbyNPC(NPCId.Antusul);
- if (antusul != null && !antusul.IsDead)
- antusul.MayAttack(m_owner.Target);
- m_owner.SetUInt64(UnitFields.FLAGS, 0x02000000);
- m_owner.Faction.Id = Constants.Factions.FactionId.Friendly;
- base.OnEnterCombat();
- }
- }*/
- #endregion
- #endregion
- #region Overrides
- protected override void SpawnNPCs()
- {
- base.SpawnNPCs();
- }
- #endregion
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment