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.2 kB

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