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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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. // 玩家类型
  47. enum class PlayerType : unsigned char
  48. {
  49. NullPlayerType = 0,
  50. StudentPlayer = 1,
  51. TrickerPlayer = 2,
  52. };
  53. // 学生类型
  54. enum class StudentType : unsigned char
  55. {
  56. NullStudentType = 0,
  57. StudentType1 = 1,
  58. StudentType2 = 2,
  59. StudentType3 = 3,
  60. StudentType4 = 4,
  61. };
  62. // 捣蛋鬼类型
  63. enum class TrickerType : unsigned char
  64. {
  65. NullTrickerType = 0,
  66. TrickerType1 = 1,
  67. TrickerType2 = 2,
  68. TrickerType3 = 3,
  69. TrickerType4 = 4,
  70. };
  71. // 学生Buff类型
  72. enum class StudentBuffType : unsigned char
  73. {
  74. NullStudentBuffType = 0,
  75. StudentBuffType1 = 1,
  76. StudentBuffType2 = 2,
  77. StudentBuffType3 = 3,
  78. StudentBuffType4 = 4,
  79. };
  80. enum class TrickerBuffType : unsigned char
  81. {
  82. NullTrickerBuffType = 0,
  83. TrickerBuffType1 = 1,
  84. TrickerBuffType2 = 2,
  85. TrickerBuffType3 = 3,
  86. TrickerBuffType4 = 4,
  87. };
  88. // 学生状态枚举
  89. enum class StudentState : unsigned char
  90. {
  91. NullStudentState = 0,
  92. Idle = 1,
  93. Learning = 2,
  94. Addicted = 3,
  95. Quit = 4,
  96. Graduated = 5,
  97. };
  98. // 玩家类
  99. struct Player
  100. {
  101. int32_t x; // x坐标
  102. int32_t y; // y坐标
  103. int32_t speed; // 移动速度
  104. int32_t viewRange; // 视野范围
  105. int64_t playerID; // 玩家ID
  106. int64_t guid; // 全局唯一ID
  107. int16_t radius; // 圆形物体的半径或正方形物体的内切圆半径
  108. int32_t damage; // 攻击伤害
  109. double timeUntilSkillAvailable; // 技能冷却时间
  110. PlayerType playerType; // 玩家类型
  111. PropType prop; // 手上的道具类型
  112. PlaceType place; // 所处格子的类型
  113. };
  114. struct Student : public Player
  115. {
  116. StudentState state; // 学生状态
  117. int32_t determination; // 剩余毅力(本次Emo之前还能承受的伤害)
  118. int32_t failNum; // 挂科数量
  119. double failTime; // 挂科时间
  120. double emoTime; // EMO时间
  121. StudentType studentType; // 学生类型
  122. std::vector<StudentBuffType> buff; // buff
  123. };
  124. struct Tricker : public Player
  125. {
  126. bool movable; // 是否处在攻击后摇中
  127. TrickerType trickerType; // 捣蛋鬼类型
  128. std::vector<TrickerBuffType> buff; // buff
  129. };
  130. struct Prop
  131. {
  132. int32_t x;
  133. int32_t y;
  134. int32_t size;
  135. int64_t guid;
  136. PropType type;
  137. PlaceType place;
  138. double facingDirection; // 朝向
  139. bool isMoving;
  140. };
  141. // 仅供DEBUG使用,名称可改动
  142. // 还没写完,后面待续
  143. inline std::map<GameState, std::string> gameStateDict{
  144. {GameState::NullGameState, "NullGameState"},
  145. {GameState::GameStart, "GameStart"},
  146. {GameState::GameRunning, "GameRunning"},
  147. {GameState::GameEnd, "GameEnd"},
  148. };
  149. inline std::map<StudentState, std::string> studentStateDict{
  150. {StudentState::NullStudentState, "NullStudentState"},
  151. {StudentState::Idle, "Idle"},
  152. {StudentState::Learning, "Learning"},
  153. {StudentState::Addicted, "Addicted"},
  154. {StudentState::Quit, "Quit"},
  155. {StudentState::Graduated, "Graduated"},
  156. };
  157. inline std::map<PlayerType, std::string> playerTypeDict{
  158. {PlayerType::NullPlayerType, "NullPlayerType"},
  159. {PlayerType::StudentPlayer, "StudentPlayer"},
  160. {PlayerType::TrickerPlayer, "TrickerPlayer"},
  161. };
  162. inline std::map<PlaceType, std::string> placeTypeDict{
  163. {PlaceType::NullPlaceType, "NullPlaceType"},
  164. {PlaceType::Land, "Land"},
  165. {PlaceType::Wall, "Wall"},
  166. {PlaceType::Grass, "Grass"},
  167. {PlaceType::ClassRoom, "ClassRoom"},
  168. {PlaceType::Gate, "Gate"},
  169. {PlaceType::HiddenGate, "HiddenGate"},
  170. };
  171. inline std::map<PropType, std::string> propTypeDict{
  172. {PropType::NullPropType, "NullPropType"},
  173. };
  174. inline std::map<StudentBuffType, std::string> studentBuffDict{
  175. {StudentBuffType::NullStudentBuffType, "NullStudentBuffType"},
  176. };
  177. inline std::map<TrickerBuffType, std::string> trickerBuffDict{
  178. {TrickerBuffType::NullTrickerBuffType, "NullTrickerBuffType"},
  179. };
  180. } // namespace THUAI6
  181. #endif