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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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. // 所有NullXXXType均为错误类型,其余为可能出现的正常类型
  10. // 位置标志
  11. enum class PlaceType : unsigned char
  12. {
  13. NullPlaceType = 0,
  14. Land = 1,
  15. Wall = 2,
  16. Grass = 3,
  17. Machine = 4,
  18. Gate = 5,
  19. HiddenGate = 6,
  20. };
  21. // 形状标志
  22. enum class ShapeType : unsigned char
  23. {
  24. NullShapeType = 0,
  25. Circle = 1,
  26. Square = 2,
  27. };
  28. // 道具类型
  29. enum class PropType : unsigned char
  30. {
  31. NullPropType = 0,
  32. PropType1 = 1,
  33. PropType2 = 2,
  34. PropType3 = 3,
  35. PropType4 = 4,
  36. };
  37. // 玩家类型
  38. enum class PlayerType : unsigned char
  39. {
  40. NullPlayerType = 0,
  41. HumanPlayer = 1,
  42. ButcherType = 2,
  43. };
  44. // 人类类型
  45. enum class HumanType : unsigned char
  46. {
  47. NullHumanType = 0,
  48. HumanType1 = 1,
  49. HumanType2 = 2,
  50. HumanType3 = 3,
  51. HumanType4 = 4,
  52. };
  53. // 屠夫类型
  54. enum class ButcherType : unsigned char
  55. {
  56. NullButcherType = 0,
  57. ButcherType1 = 1,
  58. ButcherType2 = 2,
  59. ButcherType3 = 3,
  60. ButcherType4 = 4,
  61. };
  62. // 人类Buff类型
  63. enum class HumanBuffType : unsigned char
  64. {
  65. NullHumanBuffType = 0,
  66. HumanBuffType1 = 1,
  67. HumanBuffType2 = 2,
  68. HumanBuffType3 = 3,
  69. HumanBuffType4 = 4,
  70. };
  71. // 玩家类
  72. struct Player
  73. {
  74. int32_t x; // x坐标
  75. int32_t y; // y坐标
  76. uint32_t speed; // 移动速度
  77. uint32_t viewRange; // 视野范围
  78. uint64_t playerID; // 玩家ID
  79. uint64_t guid; // 全局唯一ID
  80. uint16_t radius; // 圆形物体的半径或正方形物体的内切圆半径
  81. double timeUntilSkillAvailable; // 技能冷却时间
  82. PlayerType playerType; // 玩家类型
  83. PropType prop; // 手上的道具类型
  84. PlaceType place; // 所处格子的类型
  85. };
  86. struct Human : public Player
  87. {
  88. bool onChair; // 是否被挂
  89. bool onGround; // 是否倒地
  90. uint32_t life; // 剩余生命(本次倒地之前还能承受的伤害)
  91. uint32_t hangedTime; // 被挂的次数
  92. HumanType humanType; // 人类类型
  93. std::vector<HumanBuffType> buff; // buff
  94. };
  95. struct Butcher : public Player
  96. {
  97. uint32_t damage; // 攻击伤害
  98. bool movable; // 是否处在攻击后摇中
  99. ButcherType butcherType; // 屠夫类型
  100. std::vector<ButcherBuffType> buff; // buff
  101. };
  102. struct Prop
  103. {
  104. int32_t x;
  105. int32_t y;
  106. uint32_t size;
  107. uint64_t guid;
  108. PropType type;
  109. PlaceType place;
  110. double facingDirection; // 朝向
  111. bool isMoving;
  112. };
  113. // 仅供DEBUG使用,名称可改动
  114. // 还没写完,后面待续
  115. inline std::map<PlaceType, std::string> placeDict{
  116. {PlaceType::NullPlaceType, "NullPlaceType"},
  117. {PlaceType::Land, "Land"},
  118. {PlaceType::Wall, "Wall"},
  119. {PlaceType::Grass, "Grass"},
  120. {PlaceType::Machine, "Machine"},
  121. {PlaceType::Gate, "Gate"},
  122. {PlaceType::HiddenGate, "HiddenGate"},
  123. };
  124. inline std::map<PropType, std::string> propDict{
  125. {PropType::NullPropType, "NullPropType"},
  126. };
  127. } // namespace THUAI6
  128. #endif