Football.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using System.Drawing;
  2. using Server.MirDatabase;
  3. namespace Server.MirObjects.Monsters
  4. {
  5. public class Football : MonsterObject
  6. {
  7. protected override bool CanAttack { get { return false; }}
  8. private int _ballMoveDistance = 4;
  9. protected internal Football(MonsterInfo info)
  10. : base(info)
  11. {
  12. }
  13. protected override void FindTarget() { }
  14. protected override void ProcessTarget() { }
  15. public override bool IsAttackTarget(MonsterObject attacker) { return false; }
  16. public override int Attacked(HumanObject attacker, int damage, DefenceType type = DefenceType.ACAgility, bool damageWeapon = true)
  17. {
  18. int currentMoveDistance = 0;
  19. Point target = Functions.PointMove(CurrentLocation, attacker.Direction, _ballMoveDistance);
  20. MirDirection dir = Functions.DirectionFromPoint(CurrentLocation, target);
  21. while (currentMoveDistance < _ballMoveDistance)
  22. {
  23. Point location = Functions.PointMove(CurrentLocation, dir, 1);
  24. if (location.X < 0 || location.Y < 0 || location.X >= CurrentMap.Width || location.Y >= CurrentMap.Height) break;
  25. currentMoveDistance++;
  26. if (!CurrentMap.GetCell(location).Valid)
  27. {
  28. dir = Functions.ReverseDirection(dir);
  29. continue;
  30. }
  31. Walk(dir);
  32. MoveTime = 0;
  33. ActionTime = 0;
  34. }
  35. return 0;
  36. }
  37. public override int Attacked(MonsterObject attacker, int damage, DefenceType type = DefenceType.ACAgility) { throw new NotSupportedException(); }
  38. public override int Struck(int damage, DefenceType type = DefenceType.ACAgility)
  39. {
  40. return 0;
  41. }
  42. public override void Die() { }
  43. }
  44. }