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

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