You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

Item.cs 2.7 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. using Preparation.Interface;
  2. using Preparation.Utility;
  3. using System.Threading;
  4. namespace GameClass.GameObj
  5. {
  6. public abstract class Item : ObjOfCharacter
  7. {
  8. public override bool IsRigid => true;
  9. public override bool IgnoreCollideExecutor(IGameObj targetObj) => false;
  10. public override ShapeType Shape => ShapeType.Square;
  11. public abstract PropType GetPropType();
  12. public Item(XY initPos, int radius = GameData.propRadius) :
  13. base(initPos, radius, GameObjType.Item)
  14. {
  15. this.ReSetCanMove(false);
  16. this.MoveSpeed = 0;
  17. }
  18. }
  19. ///// <summary>
  20. ///// 坑人地雷
  21. ///// </summary>
  22. // public abstract class DebuffMine : Gadget
  23. //{
  24. // public DebuffMine(XYPosition initPos) : base(initPos) { }
  25. // }
  26. public sealed class CraftingBench : Item
  27. {
  28. public CraftingBench(XY initPos, Character character, int num) :
  29. base(initPos)
  30. {
  31. Parent = character;
  32. this.num = num;
  33. }
  34. private readonly int num;
  35. private long parentStateNum;
  36. public long ParentStateNum
  37. {
  38. get => Interlocked.Read(ref parentStateNum);
  39. set => Interlocked.Exchange(ref parentStateNum, value);
  40. }
  41. public void StopSkill()
  42. {
  43. ((SummonGolem)Parent!.FindActiveSkill(ActiveSkillType.SummonGolem)).DeleteGolem((int)num);
  44. }
  45. public void TryStopSkill()
  46. {
  47. lock (Parent!.ActionLock)
  48. {
  49. if (Parent!.StateNum == parentStateNum)
  50. {
  51. Parent!.SetPlayerState();
  52. }
  53. }
  54. }
  55. public override PropType GetPropType() => PropType.CraftingBench;
  56. }
  57. // #region 所有坑人地雷
  58. ///// <summary>
  59. ///// 减速
  60. ///// </summary>
  61. // public sealed class MinusSpeed : DebuffMine
  62. //{
  63. // public MinusSpeed(XYPosition initPos) : base(initPos) { }
  64. // public override PropType GetPropType() => PropType.minusSpeed;
  65. // }
  66. ///// <summary>
  67. ///// 减少攻击力
  68. ///// </summary>
  69. // public sealed class MinusAP : DebuffMine
  70. //{
  71. // public MinusAP(XYPosition initPos) : base(initPos) { }
  72. // public override PropType GetPropType() => PropType.minusAP;
  73. // }
  74. ///// <summary>
  75. ///// 增加冷却
  76. ///// </summary>
  77. // public sealed class AddCD : DebuffMine
  78. //{
  79. // public AddCD(XYPosition initPos) : base(initPos) { }
  80. // public override PropType GetPropType() => PropType.addCD;
  81. // }
  82. // #endregion
  83. }