Easelm

Untitled

May 20th, 2012
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 8.22 KB | None | 0 0
  1. using WCell.Constants.NPCs;
  2. using WCell.Constants.Spells;
  3. using WCell.Constants.World;
  4. using WCell.Core.Initialization;
  5. using WCell.RealmServer.AI.Actions.Combat;
  6. using WCell.RealmServer.AI.Brains;
  7. using WCell.RealmServer.Entities;
  8. using WCell.RealmServer.Instances;
  9. using WCell.RealmServer.NPCs;
  10. using WCell.RealmServer.Spells;
  11. ///
  12. /// This file was automatically created, using WCell's CodeFileWriter
  13. /// Date: 6/11/2009
  14. ///
  15.  
  16. namespace WCell.Addons.Default.Instances
  17. {
  18.     public class ZulFarrak : BaseInstance
  19.     {
  20.         #region Content (General)
  21.         #region Npc Entries
  22.         private static NPCEntry _antusulEntry;
  23.         private static NPCEntry _antusulAddsEntry;
  24.         //private static NPCEntry _antusulTriggerEntry;
  25.         private NPC Antusul;
  26.         #endregion
  27.  
  28.         [Initialization]
  29.         [DependentInitialization(typeof(NPCMgr))]
  30.         public static void InitNPCs()
  31.         {
  32.             /*
  33.             _antusulTriggerEntry = NPCMgr.GetEntry(133337);
  34.             _antusulTriggerEntry.BrainCreator = _antusulTrigger => new AntusulTriggerBrain(_antusulTrigger);
  35.              * */
  36.             SetupAntusul();
  37.         }
  38.         #endregion
  39.  
  40.         #region Antu'sul
  41.         private static void SetupAntusul()
  42.         {
  43.             _antusulEntry = NPCMgr.GetEntry(NPCId.Antusul);
  44.             _antusulEntry.BrainCreator = antusul => new AntusulBrain(antusul);
  45.             _antusulAddsEntry = NPCMgr.GetEntry(NPCId.SulLithuzBroodling);
  46.  
  47.             _antusulEntry.AddSpell(SpellId.ChainLightning);
  48.             SpellHandler.Apply(spell => { spell.CooldownTime = 14000; },
  49.                 SpellId.ChainLightning);
  50.  
  51.             _antusulEntry.Activated += antusul =>
  52.             {
  53.                 var instance = antusul.Map as ZulFarrak;
  54.                 if (instance == null || antusul.SpawnPoint == null)
  55.                     return;
  56.  
  57.                 ((BaseBrain)antusul.Brain).DefaultCombatAction.Strategy = new AntusulAttackAction(antusul);
  58.             };
  59.         }
  60.  
  61.         public class AntusulBrain : MobBrain
  62.         {
  63.             const string TEXT_ENTERCOMBAT = "Lunch has arrived, my beautiful childern. Tear them to pieces!";
  64.  
  65.             public AntusulBrain(NPC antusul)
  66.                 : base(antusul)
  67.             {
  68.             }
  69.  
  70.             public override bool ScanAndAttack()
  71.             {
  72.                 return base.ScanAndAttack();
  73.             }
  74.  
  75.             public override void OnEnterCombat()
  76.             {
  77.                 m_owner.Yell(TEXT_ENTERCOMBAT);
  78.                 // This mob doesn't attack
  79.                 //m_owner.SpellCast.TriggerSelf(SpellHandler.Get(SpellId.AntusulsMinion));
  80.                 base.OnEnterCombat();
  81.             }
  82.  
  83.             /// <summary>
  84.             /// Resets the cave trigger
  85.             /// </summary>
  86.             void ResetTrigger()
  87.             {
  88.             }
  89.         }
  90.  
  91.         #region Antusul Attack Action
  92.         public class AntusulAttackAction : AIAttackAction
  93.         {
  94.             internal static Spell ChainLighting, EarthShock, EarthgrabTotem, FireNovaTotem, HealingWard, HealingWaveOfAntusul;
  95.             const string TEXT_SUMMON_1 = "Rise and defend your master!";
  96.             const string TEXT_SUMMON_2 = "The children of Sul will protect their master. Rise once more Sul'ithuz!";
  97.             private int phase = 1;
  98.             //private readonly NPC[] AntusulBroodlingsServants = new NPC[4];
  99.             private bool firstSpawns = false;
  100.  
  101.             [Initialization(InitializationPass.Second)]
  102.             public static void InitAntusul()
  103.             {
  104.                 /* Guesstimating the spells by how they cast/deal damage */
  105.                 ChainLighting = SpellHandler.Get(SpellId.ChainLightning);
  106.                 ChainLighting.AISettings.SetCooldownRange(14000, 17000);
  107.                 ChainLighting.AISettings.IdleTimeAfterCastMillis = 1000;
  108.  
  109.                 EarthShock = SpellHandler.Get(SpellId.EarthShock_3);
  110.                 EarthShock.AISettings.SetCooldownRange(8000, 12000);
  111.                 EarthShock.AISettings.IdleTimeAfterCastMillis = 1000;
  112.  
  113.                 EarthgrabTotem = SpellHandler.Get(SpellId.EarthgrabTotem);
  114.                 EarthgrabTotem.AISettings.SetCooldownRange(30000);
  115.                 EarthgrabTotem.AISettings.IdleTimeAfterCastMillis = 1000;
  116.  
  117.                 FireNovaTotem = SpellHandler.Get(SpellId.FireNovaTotem);
  118.                 FireNovaTotem.AISettings.SetCooldownRange(15000);
  119.  
  120.                 HealingWard = SpellHandler.Get(SpellId.HealingWard);
  121.                 HealingWard.AISettings.SetCooldownRange(40000);
  122.                 HealingWard.AISettings.IdleTimeAfterCastMillis = 1000;
  123.  
  124.                 HealingWaveOfAntusul = SpellHandler.Get(SpellId.HealingWaveOfAntusul);
  125.                 HealingWaveOfAntusul.AISettings.SetCooldownRange(10000, 18000);
  126.                 HealingWaveOfAntusul.AISettings.IdleTimeAfterCastMillis = 1000;
  127.             }
  128.  
  129.             public AntusulAttackAction(NPC antusul)
  130.                 : base(antusul)
  131.             {
  132.             }
  133.  
  134.             public override void Start()
  135.             {
  136.                 base.Start();
  137.             }
  138.  
  139.             public override void Update()
  140.             {
  141.                 Character _char = m_owner.GetNearbyRandomHostileCharacter();
  142.                 NPC totems = null;
  143.                 int healthPCT = m_owner.HealthPct;
  144.                 if (phase == 1)
  145.                 {
  146.                     phase = 2;
  147.                     m_owner.SpellCast.Trigger(ChainLighting, _char);
  148.                     m_owner.SpellCast.Trigger(EarthgrabTotem);
  149.                     totems = m_owner.GetNearbyNPC(NPCId.EarthgrabTotem);
  150.                     if (totems != null)
  151.                         totems.Faction.Id = m_owner.FactionId;
  152.                     if (_char.IsUsingSpell)
  153.                         m_owner.SpellCast.Trigger(EarthShock, _char);
  154.                 }
  155.                 else if (healthPCT <= 75 && firstSpawns == false) // Spawn Broodlings
  156.                 {
  157.                     phase = 3;
  158.                     m_owner.Yell(TEXT_SUMMON_1);
  159.                     m_owner.SpellCast.Trigger(FireNovaTotem);
  160.                     totems = m_owner.GetNearbyNPC(NPCId.FireNovaTotemVII);
  161.                     if (totems != null)
  162.                         totems.Faction.Id = m_owner.FactionId;
  163.                     // Servants don't attack
  164.                     //m_owner.SpellCast.TriggerSelf(SpellHandler.Get(SpellId.AntusulsMinion));
  165.                     firstSpawns = true;
  166.                 }
  167.                 else if (healthPCT <= 25 && phase == 3)
  168.                 {
  169.                     phase = 4;
  170.                     m_owner.Yell(TEXT_SUMMON_2);
  171.                     m_owner.SpellCast.Trigger(HealingWaveOfAntusul, m_owner);
  172.                     m_owner.SpellCast.Trigger(HealingWard);
  173.                     totems = m_owner.GetNearbyNPC(NPCId.GreaterHealingWard);
  174.                     if (totems != null)
  175.                         totems.Faction.Id = m_owner.FactionId;
  176.                     // Servants don't attack
  177.                     // m_owner.SpellCast.TriggerSelf(SpellHandler.Get(SpellId.AntusulsMinion));
  178.                 }
  179.                 totems = null;
  180.                 base.Update();
  181.             }
  182.  
  183.             public override void Stop()
  184.             {
  185.                 base.Stop();
  186.             }
  187.         }
  188.         #endregion
  189.  
  190.         // Waiting for Trigger to be spawned in the world. Postponed.
  191.         #region Antu'sul Trigger
  192.         /*
  193.         public class AntusulTriggerBrain : MobBrain
  194.         {
  195.             public AntusulTriggerBrain(NPC antusul)
  196.                 : base(antusul)
  197.             {
  198.             }
  199.  
  200.             public override void OnEnterCombat()
  201.             {
  202.                 NPC antusul = m_owner.GetNearbyNPC(NPCId.Antusul);
  203.                 if (antusul != null && !antusul.IsDead)
  204.                     antusul.MayAttack(m_owner.Target);
  205.                 m_owner.SetUInt64(UnitFields.FLAGS, 0x02000000);
  206.                 m_owner.Faction.Id = Constants.Factions.FactionId.Friendly;
  207.                 base.OnEnterCombat();
  208.             }
  209.         }*/
  210.         #endregion
  211.         #endregion
  212.  
  213.         #region Overrides
  214.         protected override void SpawnNPCs()
  215.         {
  216.             base.SpawnNPCs();
  217.         }
  218.         #endregion
  219.     }
  220. }
Advertisement
Add Comment
Please, Sign In to add comment