ShamanZombie.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using Server.MirDatabase;
  2. using Server.MirEnvir;
  3. using S = ServerPackets;
  4. namespace Server.MirObjects.Monsters
  5. {
  6. public class ShamanZombie : MonsterObject
  7. {
  8. protected internal ShamanZombie(MonsterInfo info)
  9. : base(info)
  10. {
  11. }
  12. protected override bool InAttackRange()
  13. {
  14. if (Target.CurrentMap != CurrentMap) return false;
  15. if (Target.CurrentLocation == CurrentLocation) return false;
  16. int x = Math.Abs(Target.CurrentLocation.X - CurrentLocation.X);
  17. int y = Math.Abs(Target.CurrentLocation.Y - CurrentLocation.Y);
  18. if (x > 6 || y > 6) return false;
  19. return (x == 0) || (y == 0) || (x == y);
  20. }
  21. protected override void Attack()
  22. {
  23. ShockTime = 0;
  24. if (!Target.IsAttackTarget(this))
  25. {
  26. Target = null;
  27. return;
  28. }
  29. AttackTime = Envir.Time + AttackSpeed;
  30. ActionTime = Envir.Time + 300;
  31. Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation);
  32. Broadcast(new S.ObjectRangeAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation });
  33. int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]);
  34. if (damage == 0) return;
  35. LineAttack(damage, 6, 300, DefenceType.MACAgility);
  36. }
  37. protected override void ProcessTarget()
  38. {
  39. if (Target == null) return;
  40. if (InAttackRange() && CanAttack)
  41. {
  42. Attack();
  43. if (Target.Dead)
  44. FindTarget();
  45. return;
  46. }
  47. if (Envir.Time < ShockTime)
  48. {
  49. Target = null;
  50. return;
  51. }
  52. MoveTo(Target.CurrentLocation);
  53. }
  54. }
  55. }