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.

structures.h 4.0 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. #pragma once
  2. #ifndef STRUCTURES_H
  3. #define STRUCTURES_H
  4. #include <cstdint>
  5. #include <array>
  6. #include <map>
  7. namespace THUAI6
  8. {
  9. // 所有NullXXXType均为错误类型,其余为可能出现的正常类型
  10. // 位置标志
  11. enum class PlaceType : unsigned char
  12. {
  13. NullPlaceType = 0,
  14. Land = 1,
  15. Wall = 2,
  16. Grass = 3,
  17. Machine = 4,
  18. Gate = 5,
  19. HiddenGate = 6,
  20. };
  21. // 形状标志
  22. enum class ShapeType : unsigned char
  23. {
  24. NullShapeType = 0,
  25. Circle = 1,
  26. Square = 2,
  27. };
  28. // 道具类型
  29. enum class PropType : unsigned char
  30. {
  31. NullPropType = 0,
  32. PropType1 = 1,
  33. PropType2 = 2,
  34. PropType3 = 3,
  35. PropType4 = 4,
  36. };
  37. // 玩家类型
  38. enum class PlayerType : unsigned char
  39. {
  40. NullPlayerType = 0,
  41. HumanPlayer = 1,
  42. ButcherPlayer = 2,
  43. };
  44. // 人类类型
  45. enum class HumanType : unsigned char
  46. {
  47. NullHumanType = 0,
  48. HumanType1 = 1,
  49. HumanType2 = 2,
  50. HumanType3 = 3,
  51. HumanType4 = 4,
  52. };
  53. // 屠夫类型
  54. enum class ButcherType : unsigned char
  55. {
  56. NullButcherType = 0,
  57. ButcherType1 = 1,
  58. ButcherType2 = 2,
  59. ButcherType3 = 3,
  60. ButcherType4 = 4,
  61. };
  62. // 人类Buff类型
  63. enum class HumanBuffType : unsigned char
  64. {
  65. NullHumanBuffType = 0,
  66. HumanBuffType1 = 1,
  67. HumanBuffType2 = 2,
  68. HumanBuffType3 = 3,
  69. HumanBuffType4 = 4,
  70. };
  71. enum class ButcherBuffType : unsigned char
  72. {
  73. NullButcherBuffType = 0,
  74. ButcherBuffType1 = 1,
  75. ButcherBuffType2 = 2,
  76. ButcherBuffType3 = 3,
  77. ButcherBuffType4 = 4,
  78. };
  79. // 人类状态枚举
  80. enum class HumanState : unsigned char
  81. {
  82. NullHumanState = 0,
  83. Idle = 1,
  84. Fixing = 2,
  85. Dying = 3,
  86. OnChair = 4,
  87. Dead = 5,
  88. };
  89. // 玩家类
  90. struct Player
  91. {
  92. int32_t x; // x坐标
  93. int32_t y; // y坐标
  94. int32_t speed; // 移动速度
  95. int32_t viewRange; // 视野范围
  96. int64_t playerID; // 玩家ID
  97. int64_t guid; // 全局唯一ID
  98. int16_t radius; // 圆形物体的半径或正方形物体的内切圆半径
  99. double timeUntilSkillAvailable; // 技能冷却时间
  100. PlayerType playerType; // 玩家类型
  101. PropType prop; // 手上的道具类型
  102. PlaceType place; // 所处格子的类型
  103. };
  104. struct Human : public Player
  105. {
  106. HumanState state; // 人类状态
  107. int32_t life; // 剩余生命(本次倒地之前还能承受的伤害)
  108. int32_t hangedTime; // 被挂的次数
  109. HumanType humanType; // 人类类型
  110. std::vector<HumanBuffType> buff; // buff
  111. };
  112. struct Butcher : public Player
  113. {
  114. int32_t damage; // 攻击伤害
  115. bool movable; // 是否处在攻击后摇中
  116. ButcherType butcherType; // 屠夫类型
  117. std::vector<ButcherBuffType> buff; // buff
  118. };
  119. struct Prop
  120. {
  121. int32_t x;
  122. int32_t y;
  123. int32_t size;
  124. int64_t guid;
  125. PropType type;
  126. PlaceType place;
  127. double facingDirection; // 朝向
  128. bool isMoving;
  129. };
  130. // 仅供DEBUG使用,名称可改动
  131. // 还没写完,后面待续
  132. inline std::map<PlaceType, std::string> placeDict{
  133. {PlaceType::NullPlaceType, "NullPlaceType"},
  134. {PlaceType::Land, "Land"},
  135. {PlaceType::Wall, "Wall"},
  136. {PlaceType::Grass, "Grass"},
  137. {PlaceType::Machine, "Machine"},
  138. {PlaceType::Gate, "Gate"},
  139. {PlaceType::HiddenGate, "HiddenGate"},
  140. };
  141. inline std::map<PropType, std::string> propDict{
  142. {PropType::NullPropType, "NullPropType"},
  143. };
  144. } // namespace THUAI6
  145. #endif