RhinoPriest.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. using Server.MirDatabase;
  2. using S = ServerPackets;
  3. namespace Server.MirObjects.Monsters
  4. {
  5. public class RhinoPriest : AxeSkeleton
  6. {
  7. protected internal RhinoPriest(MonsterInfo info)
  8. : base(info)
  9. {
  10. }
  11. protected override void Attack()
  12. {
  13. if (!Target.IsAttackTarget(this))
  14. {
  15. Target = null;
  16. return;
  17. }
  18. ShockTime = 0;
  19. Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation);
  20. bool range = CurrentLocation == Target.CurrentLocation || !Functions.InRange(CurrentLocation, Target.CurrentLocation, 1);
  21. ActionTime = Envir.Time + 300;
  22. AttackTime = Envir.Time + AttackSpeed;
  23. if (!range)
  24. {
  25. Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 0 });
  26. int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]);
  27. if (damage == 0) return;
  28. DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 600, Target, damage, DefenceType.ACAgility);
  29. ActionList.Add(action);
  30. }
  31. else
  32. {
  33. AttackTime = Envir.Time + AttackSpeed + 500;
  34. int damage = GetAttackPower(Stats[Stat.MinMC], Stats[Stat.MaxMC]);
  35. if (damage == 0) return;
  36. if (Envir.Random.Next(3) > 0)
  37. {
  38. //Rhino Ranged Attack
  39. Broadcast(new S.ObjectRangeAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, TargetID = Target.ObjectID, Type = 0 });
  40. DelayedAction action = new DelayedAction(DelayedType.RangeDamage, Envir.Time + 600, Target, damage, DefenceType.MACAgility, false);
  41. ActionList.Add(action);
  42. }
  43. else
  44. {
  45. //Blue Circle Attack
  46. Broadcast(new S.ObjectRangeAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, TargetID = Target.ObjectID, Type = 1 });
  47. DelayedAction action = new DelayedAction(DelayedType.RangeDamage, Envir.Time + 500, Target, damage, DefenceType.MAC, true);
  48. ActionList.Add(action);
  49. }
  50. }
  51. }
  52. protected override void CompleteRangeAttack(IList<object> data)
  53. {
  54. MapObject target = (MapObject)data[0];
  55. int damage = (int)data[1];
  56. DefenceType defence = (DefenceType)data[2];
  57. bool poison = (bool)data[3];
  58. if (target == null || !target.IsAttackTarget(this) || target.CurrentMap != CurrentMap || target.Node == null) return;
  59. if (target.Attacked(this, damage, defence) <= 0) return;
  60. if (poison)
  61. {
  62. if (Envir.Random.Next(4) > 0)
  63. {
  64. PoisonTarget(target, 2, 5, PoisonType.Slow, 1000);
  65. }
  66. else
  67. {
  68. PoisonTarget(target, 4, 5, PoisonType.Frozen, 1000);
  69. }
  70. }
  71. else
  72. {
  73. var stats = new Stats
  74. {
  75. [Stat.MaxDC] = damage * -1,
  76. [Stat.MaxMC] = damage * -1,
  77. [Stat.MaxSC] = damage * -1
  78. };
  79. target.AddBuff(BuffType.RhinoPriestDebuff, this, Settings.Second * (5 + damage), stats);
  80. }
  81. }
  82. }
  83. }