BlockingObject.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. using Server.MirDatabase;
  2. using S = ServerPackets;
  3. namespace Server.MirObjects.Monsters
  4. {
  5. public class BlockingObject : MonsterObject
  6. {
  7. public MonsterObject Parent;
  8. public bool Visible;
  9. protected internal BlockingObject(MonsterObject parent, MonsterInfo info) : base(info)
  10. {
  11. Parent = parent;
  12. Visible = true;
  13. }
  14. public override bool Blocking
  15. {
  16. get
  17. {
  18. return Parent.Blocking;
  19. }
  20. }
  21. public override bool Walk(MirDirection dir) { return false; }
  22. public override bool IsAttackTarget(MonsterObject attacker)
  23. {
  24. return Parent.IsAttackTarget(attacker);
  25. }
  26. public override bool IsAttackTarget(HumanObject attacker)
  27. {
  28. return Parent.IsAttackTarget(attacker);
  29. }
  30. protected override void ProcessRoam() { }
  31. protected override void ProcessSearch() { }
  32. public override int Attacked(HumanObject attacker, int damage, DefenceType type = DefenceType.ACAgility, bool damageWeapon = true)
  33. {
  34. return Parent.Attacked(attacker, damage, type, damageWeapon);
  35. }
  36. public override void Spawned()
  37. {
  38. base.Spawned();
  39. }
  40. public override Packet GetInfo()
  41. {
  42. if (!Visible) return null;
  43. return base.GetInfo();
  44. }
  45. public void Hide()
  46. {
  47. Visible = false;
  48. if (CurrentMap == null) return;
  49. CurrentMap.Broadcast(new S.ObjectRemove { ObjectID = ObjectID }, CurrentLocation);
  50. }
  51. public void Show()
  52. {
  53. Visible = true;
  54. if (CurrentMap == null) return;
  55. Broadcast(GetInfo());
  56. }
  57. }
  58. }