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

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