PlagueCrab.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using Server.MirDatabase;
  2. using Server.MirEnvir;
  3. using S = ServerPackets;
  4. namespace Server.MirObjects.Monsters
  5. {
  6. public class PlagueCrab : MonsterObject
  7. {
  8. protected internal PlagueCrab(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 > 4 || y > 4) return false;
  19. return (x == 0) || (y == 0) || (x == y);
  20. }
  21. protected override void Attack()
  22. {
  23. if (!Target.IsAttackTarget(this))
  24. {
  25. Target = null;
  26. return;
  27. }
  28. Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation);
  29. ActionTime = Envir.Time + 300;
  30. AttackTime = Envir.Time + AttackSpeed + 500;
  31. ShockTime = 0;
  32. Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 0 });
  33. int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]);
  34. if (damage == 0) return;
  35. LineAttack(damage, 4, 500, DefenceType.MACAgility);
  36. }
  37. }
  38. }