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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  1. #pragma once
  2. #ifndef STRUCTURES_H
  3. #define STRUCTURES_H
  4. #include <cstdint>
  5. #include <array>
  6. #include <map>
  7. #include <vector>
  8. #include <string>
  9. #undef GetMessage
  10. #undef SendMessage
  11. #undef PeekMessage
  12. namespace THUAI6
  13. {
  14. // 游戏状态
  15. enum class GameState : unsigned char
  16. {
  17. NullGameState = 0,
  18. GameStart = 1,
  19. GameRunning = 2,
  20. GameEnd = 3,
  21. };
  22. // 所有NullXXXType均为错误类型,其余为可能出现的正常类型
  23. // 位置标志
  24. enum class PlaceType : unsigned char
  25. {
  26. NullPlaceType = 0,
  27. Land = 1,
  28. Wall = 2,
  29. Grass = 3,
  30. ClassRoom = 4,
  31. Gate = 5,
  32. HiddenGate = 6,
  33. Window = 7,
  34. Door3 = 8,
  35. Door5 = 9,
  36. Door6 = 10,
  37. Chest = 11,
  38. };
  39. // 形状标志
  40. enum class ShapeType : unsigned char
  41. {
  42. NullShapeType = 0,
  43. Circle = 1,
  44. Square = 2,
  45. };
  46. // 道具类型
  47. enum class PropType : unsigned char
  48. {
  49. NullPropType = 0,
  50. Key3 = 1,
  51. Key5 = 2,
  52. Key6 = 3,
  53. AddSpeed = 4,
  54. AddLifeOrClairaudience = 5,
  55. AddHpOrAp = 6,
  56. ShieldOrSpear = 7,
  57. RecoveryFromDizziness = 8,
  58. };
  59. enum class BulletType : unsigned char
  60. {
  61. NullBulletType = 0,
  62. FlyingKnife = 1,
  63. CommonAttackOfTricker = 2,
  64. BombBomb = 3,
  65. JumpyDumpty = 4,
  66. AtomBomb = 5,
  67. };
  68. // 玩家类型
  69. enum class PlayerType : unsigned char
  70. {
  71. NullPlayerType = 0,
  72. StudentPlayer = 1,
  73. TrickerPlayer = 2,
  74. };
  75. // 学生类型
  76. enum class StudentType : unsigned char
  77. {
  78. NullStudentType = 0,
  79. Athlete = 1,
  80. Teacher = 2,
  81. StraightAStudent = 3,
  82. Robot = 4,
  83. TechOtaku = 5,
  84. Sunshine = 6,
  85. };
  86. // 捣蛋鬼类型
  87. enum class TrickerType : unsigned char
  88. {
  89. NullTrickerType = 0,
  90. Assassin = 1,
  91. Klee = 2,
  92. ANoisyPerson = 3,
  93. Idol = 4,
  94. };
  95. // 学生Buff类型
  96. enum class StudentBuffType : unsigned char
  97. {
  98. NullStudentBuffType = 0,
  99. AddSpeed = 1,
  100. AddLife = 2,
  101. Shield = 3,
  102. Invisible = 4,
  103. };
  104. enum class TrickerBuffType : unsigned char
  105. {
  106. NullTrickerBuffType = 0,
  107. AddSpeed = 1,
  108. Spear = 2,
  109. AddAp = 3,
  110. Clairaudience = 4,
  111. Invisible = 5,
  112. };
  113. // 学生状态枚举
  114. enum class PlayerState : unsigned char
  115. {
  116. NullState = 0,
  117. Idle = 1,
  118. Learning = 2,
  119. Addicted = 3,
  120. Quit = 4,
  121. Graduated = 5,
  122. Encouraged = 6,
  123. Roused = 7,
  124. Stunned = 8,
  125. Encouraging = 9,
  126. Rousing = 10,
  127. Swinging = 11,
  128. Attacking = 12,
  129. Locking = 13,
  130. // Rummaging = 14,
  131. Climbing = 15,
  132. OpeningAChest = 16,
  133. UsingSpecialSkill = 17,
  134. OpeningAGate = 18,
  135. };
  136. enum class MessageOfObj : unsigned char
  137. {
  138. NullMessageOfObj = 0,
  139. StudentMessage = 1,
  140. TrickerMessage = 2,
  141. PropMessage = 3,
  142. BulletMessage = 4,
  143. BombedBulletMessage = 5,
  144. ClassroomMessage = 6,
  145. DoorMessage = 7,
  146. GateMessage = 8,
  147. ChestMessage = 9,
  148. MapMessage = 10,
  149. NewsMessage = 11,
  150. HiddenGateMessage = 12,
  151. };
  152. enum class HiddenGateState : unsigned char
  153. {
  154. Null = 0,
  155. Refreshed = 1,
  156. Opened = 2,
  157. };
  158. enum class NewsType : unsigned char
  159. {
  160. NullNewsType = 0,
  161. TextMessage = 1,
  162. BinaryMessage = 2,
  163. };
  164. // 玩家类
  165. struct Player
  166. {
  167. int32_t x; // x坐标
  168. int32_t y; // y坐标
  169. int32_t speed; // 移动速度
  170. int32_t viewRange; // 视野范围
  171. int64_t playerID; // 玩家ID
  172. int64_t guid; // 全局唯一ID
  173. int32_t radius; // 圆形物体的半径或正方形物体的内切圆半径
  174. int32_t score; // 分数
  175. double facingDirection; // 朝向
  176. std::vector<double> timeUntilSkillAvailable; // 技能冷却时间
  177. PlayerType playerType; // 玩家类型
  178. std::vector<PropType> props;
  179. PlaceType place; // 所处格子的类型
  180. BulletType bulletType;
  181. PlayerState playerState;
  182. };
  183. struct Student : public Player
  184. {
  185. StudentType studentType;
  186. int32_t determination; // 剩余毅力
  187. int32_t addiction; // 沉迷程度
  188. int32_t learningSpeed;
  189. int32_t encourageSpeed;
  190. int32_t encourageProgress;
  191. int32_t rouseProgress;
  192. double dangerAlert;
  193. std::vector<StudentBuffType> buff; // buff
  194. };
  195. struct Tricker : public Player
  196. {
  197. double trickDesire;
  198. double classVolume;
  199. TrickerType trickerType; // 捣蛋鬼类型
  200. std::vector<TrickerBuffType> buff; // buff
  201. };
  202. struct Bullet
  203. {
  204. BulletType bulletType; // 子弹类型
  205. int32_t x; // x坐标
  206. int32_t y; // y坐标
  207. double facingDirection; // 朝向
  208. int64_t guid; // 全局唯一ID
  209. PlayerType team; // 子弹所属队伍
  210. PlaceType place; // 所处格子的类型
  211. double bombRange; // 炸弹爆炸范围
  212. int32_t speed; // 子弹速度
  213. };
  214. struct BombedBullet
  215. {
  216. BulletType bulletType;
  217. int32_t x;
  218. int32_t y;
  219. double facingDirection;
  220. int64_t mappingID;
  221. double bombRange;
  222. };
  223. struct Prop
  224. {
  225. int32_t x;
  226. int32_t y;
  227. int64_t guid;
  228. PropType type;
  229. PlaceType place;
  230. double facingDirection; // 朝向
  231. };
  232. struct GameMap
  233. {
  234. std::map<std::pair<int32_t, int32_t>, int32_t> classRoomState;
  235. std::map<std::pair<int32_t, int32_t>, int32_t> gateState;
  236. std::map<std::pair<int32_t, int32_t>, bool> doorState;
  237. std::map<std::pair<int32_t, int32_t>, int32_t> doorProgress;
  238. std::map<std::pair<int32_t, int32_t>, int32_t> chestState;
  239. std::map<std::pair<int32_t, int32_t>, HiddenGateState> hiddenGateState;
  240. };
  241. struct GameInfo
  242. {
  243. int32_t gameTime;
  244. int32_t subjectFinished;
  245. int32_t studentGraduated;
  246. int32_t studentQuited;
  247. int32_t studentScore;
  248. int32_t trickerScore;
  249. };
  250. // 仅供DEBUG使用,名称可改动
  251. // 还没写完,后面待续
  252. inline std::map<GameState, std::string> gameStateDict{
  253. {GameState::NullGameState, "NullGameState"},
  254. {GameState::GameStart, "GameStart"},
  255. {GameState::GameRunning, "GameRunning"},
  256. {GameState::GameEnd, "GameEnd"},
  257. };
  258. inline std::map<StudentType, std::string> studentTypeDict{
  259. {StudentType::NullStudentType, "NullStudentType"},
  260. {StudentType::Athlete, "Athlete"},
  261. {StudentType::Teacher, "Teacher"},
  262. {StudentType::StraightAStudent, "StraightAStudent"},
  263. {StudentType::Robot, "Robot"},
  264. {StudentType::TechOtaku, "TechOtaku"},
  265. {StudentType::Sunshine, "Sunshine"},
  266. };
  267. inline std::map<TrickerType, std::string> trickerTypeDict{
  268. {TrickerType::NullTrickerType, "NullTrickerType"},
  269. {TrickerType::Assassin, "Assassin"},
  270. {TrickerType::Klee, "Klee"},
  271. {TrickerType::ANoisyPerson, "ANoisyPerson"},
  272. {TrickerType::Idol, "Idol"},
  273. };
  274. inline std::map<PlayerState, std::string> playerStateDict{
  275. {PlayerState::NullState, "NullState"},
  276. {PlayerState::Idle, "Idle"},
  277. {PlayerState::Learning, "Learning"},
  278. {PlayerState::Addicted, "Addicted"},
  279. {PlayerState::Quit, "Quit"},
  280. {PlayerState::Graduated, "Graduated"},
  281. {PlayerState::Encouraged, "Encouraged"},
  282. {PlayerState::Roused, "Roused"},
  283. {PlayerState::Stunned, "Stunned"},
  284. {PlayerState::Encouraging, "Encouraging"},
  285. {PlayerState::Rousing, "Rousing"},
  286. {PlayerState::Swinging, "Swinging"},
  287. {PlayerState::Attacking, "Attacking"},
  288. {PlayerState::Locking, "Locking"},
  289. // {PlayerState::Rummaging, "Rummaging"},
  290. {PlayerState::Climbing, "Climbing"},
  291. {PlayerState::OpeningAChest, "OpeningAChest"},
  292. {PlayerState::UsingSpecialSkill, "UsingSpecialSkill"},
  293. {PlayerState::OpeningAGate, "OpeningAGate"},
  294. };
  295. inline std::map<PlayerType, std::string> playerTypeDict{
  296. {PlayerType::NullPlayerType, "NullPlayerType"},
  297. {PlayerType::StudentPlayer, "StudentPlayer"},
  298. {PlayerType::TrickerPlayer, "TrickerPlayer"},
  299. };
  300. inline std::map<PlaceType, std::string> placeTypeDict{
  301. {PlaceType::NullPlaceType, "NullPlaceType"},
  302. {PlaceType::Land, "Land"},
  303. {PlaceType::Wall, "Wall"},
  304. {PlaceType::Grass, "Grass"},
  305. {PlaceType::ClassRoom, "ClassRoom"},
  306. {PlaceType::Gate, "Gate"},
  307. {PlaceType::HiddenGate, "HiddenGate"},
  308. {PlaceType::Door3, "Door3"},
  309. {PlaceType::Door5, "Door5"},
  310. {PlaceType::Door6, "Door6"},
  311. {PlaceType::Window, "Window"},
  312. {PlaceType::Chest, "Chest"},
  313. };
  314. inline std::map<PropType, std::string> propTypeDict{
  315. {PropType::NullPropType, "NullPropType"},
  316. {PropType::Key3, "Key3"},
  317. {PropType::Key5, "Key5"},
  318. {PropType::Key6, "Key6"},
  319. {PropType::AddSpeed, "AddSpeed"},
  320. {PropType::AddLifeOrClairaudience, "AddLifeOrClairaudience"},
  321. {PropType::AddHpOrAp, "AddHpOrAp"},
  322. {PropType::ShieldOrSpear, "ShieldOrSpear"},
  323. {PropType::RecoveryFromDizziness, "RecoveryFromDizziness"},
  324. };
  325. inline std::map<BulletType, std::string> bulletTypeDict{
  326. {BulletType::NullBulletType, "NullBulletType"},
  327. {BulletType::FlyingKnife, "FlyingKnife"},
  328. {BulletType::CommonAttackOfTricker, "CommonAttackOfTricker"},
  329. {BulletType::BombBomb, "BombBomb"},
  330. {BulletType::JumpyDumpty, "JumpyDumpty"},
  331. {BulletType::AtomBomb, "AtomBomb"},
  332. };
  333. inline std::map<StudentBuffType, std::string> studentBuffDict{
  334. {StudentBuffType::NullStudentBuffType, "NullStudentBuffType"},
  335. {StudentBuffType::AddSpeed, "AddSpeed"},
  336. {StudentBuffType::AddLife, "AddLife"},
  337. {StudentBuffType::Shield, "Shield"},
  338. {StudentBuffType::Invisible, "Invisible"},
  339. };
  340. inline std::map<TrickerBuffType, std::string> trickerBuffDict{
  341. {TrickerBuffType::NullTrickerBuffType, "NullTrickerBuffType"},
  342. {TrickerBuffType::AddSpeed, "AddSpeed"},
  343. {TrickerBuffType::Spear, "Spear"},
  344. {TrickerBuffType::Clairaudience, "Clairaudience"},
  345. {TrickerBuffType::AddAp, "AddAp"},
  346. {TrickerBuffType::Invisible, "Invisible"},
  347. };
  348. inline std::map<MessageOfObj, std::string> messageOfObjDict{
  349. {MessageOfObj::NullMessageOfObj, "NullMessageOfObj"},
  350. {MessageOfObj::StudentMessage, "StudentMessage"},
  351. {MessageOfObj::TrickerMessage, "TrickerMessage"},
  352. {MessageOfObj::PropMessage, "PropMessage"},
  353. {MessageOfObj::BulletMessage, "BulletMessage"},
  354. {MessageOfObj::BombedBulletMessage, "BombedBulletMessage"},
  355. {MessageOfObj::NullMessageOfObj, "NullMessageOfObj"},
  356. {MessageOfObj::ClassroomMessage, "ClassroomMessage"},
  357. {MessageOfObj::DoorMessage, "DoorMessage"},
  358. {MessageOfObj::GateMessage, "GateMessage"},
  359. {MessageOfObj::ChestMessage, "ChestMessage"},
  360. {MessageOfObj::MapMessage, "MapMessage"},
  361. {MessageOfObj::NewsMessage, "NewsMessage"},
  362. {MessageOfObj::HiddenGateMessage, "HiddenGateMessage"},
  363. };
  364. } // namespace THUAI6
  365. #endif