Guest User

Untitled

a guest
Nov 19th, 2018
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 11.37 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Reflection;
  5. using DOL.Database;
  6. using DOL.Events;
  7. using DOL.GS;
  8. using DOL.GS.Scripts;
  9. using DOL.GS.Effects;
  10. using DOL.GS.PacketHandler;
  11. using DOL.GS.SkillHandler;
  12. using log4net;
  13. using DOL.AI;
  14. using DOL.AI.Brain;
  15. using DOL.GS.RealmAbilities;
  16.  
  17. namespace DOL.GS
  18. {
  19.     public class HealerMob : FaithMob
  20.     {
  21.         public HealerMob()
  22.             : base()
  23.         {
  24.             SetOwnBrain(new HealerAI());
  25.         }
  26.         public override bool AddToWorld()
  27.         {
  28.             if (this.Name == "PoCAlbHeal")
  29.             {
  30.                 int random = Util.Random(1, 8);
  31.                 switch (random) // 32;35;42;45;52;55;62;65
  32.                 {
  33.                     case 1:
  34.                         this.Model = 32;
  35.                         this.Name = "Accursed Marauder";
  36.                         break;
  37.                     case 2:
  38.                         this.Model = 35;
  39.                         this.Name = "Accursed Marauder";
  40.                         break;
  41.                     case 3:
  42.                         this.Model = 42;
  43.                         this.Name = "Accursed Marauder";
  44.                         break;
  45.                     case 4:
  46.                         this.Model = 45;
  47.                         this.Name = "Accursed Marauder";
  48.                         break;
  49.                     case 5:
  50.                         this.Model = 52;
  51.                         this.Name = "Accursed Marauder";
  52.                         break;
  53.                     case 6:
  54.                         this.Model = 55;
  55.                         this.Name = "Accursed Marauder";
  56.                         break;
  57.                     case 7:
  58.                         this.Model = 62;
  59.                         this.Name = "Accursed Marauder";
  60.                         break;
  61.                     case 8:
  62.                         this.Model = 65;
  63.                         this.Name = "Accursed Marauder";
  64.                         break;
  65.                 }
  66.  
  67.                 int randlevel = Util.Random(1, 5);
  68.                 switch (randlevel) // 53;55;57;59;61
  69.                 {
  70.                     case 1:
  71.                         this.Level = 53;
  72.                         break;
  73.                     case 2:
  74.                         this.Level = 55;
  75.                         break;
  76.                     case 3:
  77.                         this.Level = 57;
  78.                         break;
  79.                     case 4:
  80.                         this.Level = 59;
  81.                         break;
  82.                     case 5:
  83.                         this.Level = 61;
  84.                         break;
  85.                 }
  86.                
  87.                
  88.             }
  89.             if (this.Name == "PoCMidHeal")
  90.             {
  91.                 int random = Util.Random(1, 8);
  92.                 switch (random) // 153;163;143;145;165;175;172
  93.                 {
  94.                     case 1:
  95.                         this.Model = 153;
  96.                         this.Name = "Accursed Marauder";
  97.                         break;
  98.                     case 2:
  99.                         this.Model = 163;
  100.                         this.Name = "Accursed Marauder";
  101.                         break;
  102.                     case 3:
  103.                         this.Model = 143;
  104.                         this.Name = "Accursed Marauder";
  105.                         break;
  106.                     case 4:
  107.                         this.Model = 145;
  108.                         this.Name = "Accursed Marauder";
  109.                         break;
  110.                     case 5:
  111.                         this.Model = 165;
  112.                         this.Name = "Accursed Marauder";
  113.                         break;
  114.                     case 6:
  115.                         this.Model = 55;
  116.                         this.Name = "Accursed Marauder";
  117.                         break;
  118.                     case 7:
  119.                         this.Model = 175;
  120.                         this.Name = "Accursed Marauder";
  121.                         break;
  122.                     case 8:
  123.                         this.Model = 172;
  124.                         this.Name = "Accursed Marauder";
  125.                         break;
  126.                 }
  127.  
  128.                 int randlevel = Util.Random(1, 5);
  129.                 switch (randlevel) // 53;55;57;59;61
  130.                 {
  131.                     case 1:
  132.                         this.Level = 53;
  133.                         break;
  134.                     case 2:
  135.                         this.Level = 55;
  136.                         break;
  137.                     case 3:
  138.                         this.Level = 57;
  139.                         break;
  140.                     case 4:
  141.                         this.Level = 59;
  142.                         break;
  143.                     case 5:
  144.                         this.Level = 61;
  145.                         break;
  146.                 }
  147.                
  148.                
  149.             }
  150.             if (this.Name == "PoCHibHeal")
  151.             {
  152.                 int random = Util.Random(1, 7);
  153.                 switch (random) // 302;314;320;334;340;354;360
  154.                 {
  155.                     case 1:
  156.                         this.Model = 302;
  157.                         this.Name = "Accursed Marauder";
  158.                         break;
  159.                     case 2:
  160.                         this.Model = 314;
  161.                         this.Name = "Accursed Marauder";
  162.                         break;
  163.                     case 3:
  164.                         this.Model = 320;
  165.                         this.Name = "Accursed Marauder";
  166.                         break;
  167.                     case 4:
  168.                         this.Model = 334;
  169.                         this.Name = "Accursed Marauder";
  170.                         break;
  171.                     case 5:
  172.                         this.Model = 340;
  173.                         this.Name = "Accursed Marauder";
  174.                         break;
  175.                     case 6:
  176.                         this.Model = 354;
  177.                         this.Name = "Accursed Marauder";
  178.                         break;
  179.                     case 7:
  180.                         this.Model = 360;
  181.                         this.Name = "Accursed Marauder";
  182.                         break;                    
  183.                 }
  184.  
  185.                 int randlevel = Util.Random(1, 5);
  186.                 switch (randlevel) // 53;55;57;59;61
  187.                 {
  188.                     case 1:
  189.                         this.Level = 53;
  190.                         break;
  191.                     case 2:
  192.                         this.Level = 55;
  193.                         break;
  194.                     case 3:
  195.                         this.Level = 57;
  196.                         break;
  197.                     case 4:
  198.                         this.Level = 59;
  199.                         break;
  200.                     case 5:
  201.                         this.Level = 61;
  202.                         break;
  203.                 }
  204.                
  205.                
  206.             }
  207.             return base.AddToWorld();
  208.         }
  209.     }
  210. }
  211. namespace DOL.AI.Brain
  212. {
  213.     /// <summary>
  214.     /// Healer Mob Brain
  215.     /// </summary>
  216.     public class HealerAI : FaithMobAI
  217.     {
  218.         public HealerAI()
  219.             : base()
  220.         {
  221.             AggroLevel = 90;
  222.             AggroRange = 1500;
  223.             ThinkInterval = 2000;
  224.         }
  225.  
  226.         /// <summary>
  227.         /// Brain Think Method
  228.         /// </summary>
  229.         public override void Think()
  230.         {
  231.             if (this.Body.InCombat)
  232.             {
  233.                 if (Util.Chance(10))
  234.                 {
  235.                     MasteryofConcentrationAbility moc = new MasteryofConcentrationAbility(SkillBase.GetDBAbility("Mastery of Concentration"), 3);
  236.                     moc.Execute(this.Body);
  237.                 }
  238.             }
  239.             if (!CheckAreaForAoEStun())
  240.             {
  241.                 CheckAreaForHeals();
  242.             }
  243.             base.Think();
  244.         }
  245.        
  246.         public bool CheckAreaForHeals()
  247.         {
  248.             if (Body == null || Body.IsCasting) return false;
  249.  
  250.             GameLiving target = null;
  251.  
  252.             foreach (GameNPC npc in Body.GetNPCsInRadius((ushort)this.AggroRange))
  253.             {
  254.                 if (npc == null) continue;
  255.  
  256.                 if (npc.HealthPercent < 100)
  257.                 {
  258.                     target = npc;
  259.                     break;
  260.                 }
  261.             }
  262.  
  263.             if (target == null || HealSmallSpell == null) return false;
  264.             Body.LastAttackTickPvE = Body.CurrentRegion.Time;
  265.             target.LastAttackedByEnemyTickPvE = Body.CurrentRegion.Time;
  266.             Body.StopAttack();
  267.             Body.TargetObject = target;
  268.             Body.CastSpell(HealSmallSpell, SkillBase.GetSpellLine(GlobalSpellsLines.Mob_Spells));
  269.             return true;
  270.         }
  271.         public bool CheckAreaForAoEStun()
  272.         {
  273.             if (Body == null || Body.IsCasting) return false;
  274.  
  275.             GameLiving target = null;
  276.             foreach (GamePlayer player in Body.GetPlayersInRadius((ushort)this.AggroRange))
  277.             {
  278.                 if (player == null) continue;
  279.  
  280.                 if (LivingHasEffect(player, StunSpell) == false)
  281.                 {
  282.                     if (GameServer.ServerRules.IsAllowedToAttack(this.Body, player, true))
  283.                     {
  284.                         target = player;
  285.                         break;
  286.                     }
  287.                 }
  288.             }
  289.  
  290.             if (target == null || HealSmallSpell == null) return false;
  291.             Body.LastAttackTickPvE = Body.CurrentRegion.Time;
  292.             target.LastAttackedByEnemyTickPvE = Body.CurrentRegion.Time;
  293.             Body.StopAttack();
  294.             Body.TargetObject = target;
  295.             Body.CastSpell(StunSpell, SkillBase.GetSpellLine(GlobalSpellsLines.Mob_Spells));
  296.             return true;
  297.         }
  298.  
  299.         private Spell m_HealSmallSpell;
  300.         /// <summary>
  301.         /// The heal spell
  302.         /// </summary>
  303.         public Spell HealSmallSpell
  304.         {
  305.             get
  306.             {
  307.  
  308.                 DBSpell spell = new DBSpell();
  309.                 spell.AllowAdd = false;
  310.                 spell.CastTime = 3;
  311.                 spell.ClientEffect = 1340;
  312.                 spell.Value = this.Body.Level * 10;
  313.                 spell.Name = "The Heal";
  314.                 spell.Range = 2000;
  315.                 spell.SpellID = 90004;
  316.                 spell.Target = "Realm";
  317.                 spell.Type = "Heal";
  318.                 //spell.Interruptable = 1;
  319.                 return new Spell(spell, 50);
  320.  
  321.             }
  322.         }
  323.  
  324.         private Spell m_StunSpell;
  325.         /// <summary>
  326.         /// The stun spell
  327.         /// </summary>
  328.         public Spell StunSpell
  329.         {
  330.             get
  331.             {
  332.  
  333.                 DBSpell spell = new DBSpell();
  334.                 spell.AllowAdd = false;
  335.                 spell.CastTime = 2.5;
  336.                 spell.ClientEffect = 3379;
  337.                 spell.Icon = 3379;
  338.                 spell.Value = 0;
  339.                 spell.Duration = this.Body.Level / 5;
  340.                 spell.Name = "The Stun";
  341.                 spell.Range = 2000;
  342.                 spell.SpellID = 90006;
  343.                 spell.Target = "Enemy";
  344.                 spell.Type = "Stun";
  345.                 spell.Radius = 300;
  346.                 spell.EffectGroup = 20;
  347.                 //spell.Interruptable = 1;
  348.                 return new Spell(spell, 50);
  349.  
  350.             }
  351.         }
  352.     }
  353. }
Add Comment
Please, Sign In to add comment