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 6.6 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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. ClassRoom = 4,
  26. BlackRoom = 5,
  27. Gate = 6,
  28. HiddenGate = 7,
  29. };
  30. // 形状标志
  31. enum class ShapeType : unsigned char
  32. {
  33. NullShapeType = 0,
  34. Circle = 1,
  35. Square = 2,
  36. };
  37. // 道具类型
  38. enum class PropType : unsigned char
  39. {
  40. NullPropType = 0,
  41. PropType1 = 1,
  42. PropType2 = 2,
  43. PropType3 = 3,
  44. PropType4 = 4,
  45. };
  46. enum class BulletType : unsigned char
  47. {
  48. NullBulletType = 0,
  49. LineBullet = 1,
  50. CommonBullet = 2,
  51. FastBullet = 3,
  52. OrdinaryBullet = 4,
  53. AtomBomb = 5,
  54. };
  55. // 玩家类型
  56. enum class PlayerType : unsigned char
  57. {
  58. NullPlayerType = 0,
  59. StudentPlayer = 1,
  60. TrickerPlayer = 2,
  61. };
  62. // 学生类型
  63. enum class StudentType : unsigned char
  64. {
  65. NullStudentType = 0,
  66. StudentType1 = 1,
  67. StudentType2 = 2,
  68. StudentType3 = 3,
  69. StudentType4 = 4,
  70. };
  71. // 捣蛋鬼类型
  72. enum class TrickerType : unsigned char
  73. {
  74. NullTrickerType = 0,
  75. TrickerType1 = 1,
  76. TrickerType2 = 2,
  77. TrickerType3 = 3,
  78. TrickerType4 = 4,
  79. };
  80. // 学生Buff类型
  81. enum class StudentBuffType : unsigned char
  82. {
  83. NullStudentBuffType = 0,
  84. StudentBuffType1 = 1,
  85. StudentBuffType2 = 2,
  86. StudentBuffType3 = 3,
  87. StudentBuffType4 = 4,
  88. };
  89. enum class TrickerBuffType : unsigned char
  90. {
  91. NullTrickerBuffType = 0,
  92. TrickerBuffType1 = 1,
  93. TrickerBuffType2 = 2,
  94. TrickerBuffType3 = 3,
  95. TrickerBuffType4 = 4,
  96. };
  97. // 学生状态枚举
  98. enum class StudentState : unsigned char
  99. {
  100. NullStudentState = 0,
  101. Idle = 1,
  102. Learning = 2,
  103. Addicted = 3,
  104. Quit = 4,
  105. Graduated = 5,
  106. Treated = 6,
  107. Rescued = 7,
  108. Stunned = 8,
  109. Treating = 9,
  110. Rescuing = 10,
  111. };
  112. // 玩家类
  113. struct Player
  114. {
  115. int32_t x; // x坐标
  116. int32_t y; // y坐标
  117. int32_t speed; // 移动速度
  118. int32_t viewRange; // 视野范围
  119. int64_t playerID; // 玩家ID
  120. int64_t guid; // 全局唯一ID
  121. int16_t radius; // 圆形物体的半径或正方形物体的内切圆半径
  122. int32_t damage; // 攻击伤害
  123. double timeUntilSkillAvailable; // 技能冷却时间
  124. PlayerType playerType; // 玩家类型
  125. PropType prop; // 手上的道具类型
  126. PlaceType place; // 所处格子的类型
  127. };
  128. struct Student : public Player
  129. {
  130. StudentState state; // 学生状态
  131. int32_t determination; // 剩余毅力(本次Emo之前还能承受的伤害)
  132. int32_t failNum; // 挂科数量
  133. double failTime; // 挂科时间
  134. double emoTime; // EMO时间
  135. StudentType studentType; // 学生类型
  136. std::vector<StudentBuffType> buff; // buff
  137. };
  138. struct Tricker : public Player
  139. {
  140. bool movable; // 是否处在攻击后摇中
  141. TrickerType trickerType; // 捣蛋鬼类型
  142. std::vector<TrickerBuffType> buff; // buff
  143. };
  144. struct Bullet
  145. {
  146. BulletType bulletType; // 子弹类型
  147. int32_t x; // x坐标
  148. int32_t y; // y坐标
  149. double facingDirection; // 朝向
  150. int64_t guid; // 全局唯一ID
  151. PlayerType team; // 子弹所属队伍
  152. PlaceType place; // 所处格子的类型
  153. double bombRange; // 炸弹爆炸范围
  154. };
  155. struct BombedBullet
  156. {
  157. BulletType bulletType;
  158. int32_t x;
  159. int32_t y;
  160. double facingDirection;
  161. int64_t mappingID;
  162. double bombRange;
  163. };
  164. struct Prop
  165. {
  166. int32_t x;
  167. int32_t y;
  168. int32_t size;
  169. int64_t guid;
  170. PropType type;
  171. PlaceType place;
  172. double facingDirection; // 朝向
  173. bool isMoving;
  174. };
  175. // 仅供DEBUG使用,名称可改动
  176. // 还没写完,后面待续
  177. inline std::map<GameState, std::string> gameStateDict{
  178. {GameState::NullGameState, "NullGameState"},
  179. {GameState::GameStart, "GameStart"},
  180. {GameState::GameRunning, "GameRunning"},
  181. {GameState::GameEnd, "GameEnd"},
  182. };
  183. inline std::map<StudentState, std::string> studentStateDict{
  184. {StudentState::NullStudentState, "NullStudentState"},
  185. {StudentState::Idle, "Idle"},
  186. {StudentState::Learning, "Learning"},
  187. {StudentState::Addicted, "Addicted"},
  188. {StudentState::Quit, "Quit"},
  189. {StudentState::Graduated, "Graduated"},
  190. {StudentState::Treated, "Treated"},
  191. {StudentState::Rescued, "Rescued"},
  192. {StudentState::Stunned, "Stunned"},
  193. {StudentState::Treating, "Treating"},
  194. {StudentState::Rescuing, "Rescuing"},
  195. };
  196. inline std::map<PlayerType, std::string> playerTypeDict{
  197. {PlayerType::NullPlayerType, "NullPlayerType"},
  198. {PlayerType::StudentPlayer, "StudentPlayer"},
  199. {PlayerType::TrickerPlayer, "TrickerPlayer"},
  200. };
  201. inline std::map<PlaceType, std::string> placeTypeDict{
  202. {PlaceType::NullPlaceType, "NullPlaceType"},
  203. {PlaceType::Land, "Land"},
  204. {PlaceType::Wall, "Wall"},
  205. {PlaceType::Grass, "Grass"},
  206. {PlaceType::ClassRoom, "ClassRoom"},
  207. {PlaceType::Gate, "Gate"},
  208. {PlaceType::HiddenGate, "HiddenGate"},
  209. };
  210. inline std::map<PropType, std::string> propTypeDict{
  211. {PropType::NullPropType, "NullPropType"},
  212. };
  213. inline std::map<StudentBuffType, std::string> studentBuffDict{
  214. {StudentBuffType::NullStudentBuffType, "NullStudentBuffType"},
  215. };
  216. inline std::map<TrickerBuffType, std::string> trickerBuffDict{
  217. {TrickerBuffType::NullTrickerBuffType, "NullTrickerBuffType"},
  218. };
  219. } // namespace THUAI6
  220. #endif