| @@ -26,7 +26,7 @@ | |||
| #undef SendMessage | |||
| #undef PeekMessage | |||
| const constexpr int numOfGridPerCell = 1000; | |||
| const constexpr int32_t numOfGridPerCell = 1000; | |||
| class IAI; | |||
| @@ -67,7 +67,7 @@ public: | |||
| virtual bool WaitThread() = 0; | |||
| virtual int GetCounter() const = 0; | |||
| virtual int32_t GetCounter() const = 0; | |||
| // IStudentAPI使用的部分 | |||
| virtual bool Graduate() = 0; | |||
| @@ -88,7 +88,7 @@ public: | |||
| virtual std::vector<int64_t> GetPlayerGUIDs() const = 0; | |||
| [[nodiscard]] virtual bool HaveView(int gridX, int gridY, int selfX, int selfY, int viewRange) const = 0; | |||
| [[nodiscard]] virtual bool HaveView(int32_t gridX, int32_t gridY, int32_t selfX, int32_t selfY, int32_t viewRange) const = 0; | |||
| }; | |||
| class IAPI | |||
| @@ -153,23 +153,23 @@ public: | |||
| [[nodiscard]] virtual std::vector<int64_t> GetPlayerGUIDs() const = 0; | |||
| // 获取游戏目前所进行的帧数 | |||
| [[nodiscard]] virtual int GetFrameCount() const = 0; | |||
| [[nodiscard]] virtual int32_t GetFrameCount() const = 0; | |||
| /*****选手可能用的辅助函数*****/ | |||
| // 获取指定格子中心的坐标 | |||
| [[nodiscard]] static inline int CellToGrid(int cell) noexcept | |||
| [[nodiscard]] static inline int32_t CellToGrid(int32_t cell) noexcept | |||
| { | |||
| return cell * numOfGridPerCell + numOfGridPerCell / 2; | |||
| } | |||
| // 获取指定坐标点所位于的格子的 X 序号 | |||
| [[nodiscard]] static inline int GridToCell(int grid) noexcept | |||
| [[nodiscard]] static inline int32_t GridToCell(int32_t grid) noexcept | |||
| { | |||
| return grid / numOfGridPerCell; | |||
| } | |||
| [[nodiscard]] virtual bool HaveView(int gridX, int gridY) const = 0; | |||
| [[nodiscard]] virtual bool HaveView(int32_t gridX, int32_t gridY) const = 0; | |||
| // 用于DEBUG的输出函数,选手仅在开启Debug模式的情况下可以使用 | |||
| @@ -224,7 +224,7 @@ public: | |||
| } | |||
| void Play(IAI& ai) override; | |||
| [[nodiscard]] int GetFrameCount() const override; | |||
| [[nodiscard]] int32_t GetFrameCount() const override; | |||
| std::future<bool> Move(int64_t timeInMilliseconds, double angleInRadian) override; | |||
| @@ -281,7 +281,7 @@ public: | |||
| std::future<bool> Graduate() override; | |||
| [[nodiscard]] std::shared_ptr<const THUAI6::Student> GetSelfInfo() const override; | |||
| [[nodiscard]] bool HaveView(int gridX, int gridY) const override; | |||
| [[nodiscard]] bool HaveView(int32_t gridX, int32_t gridY) const override; | |||
| void Print(std::string str) const override | |||
| { | |||
| @@ -318,7 +318,7 @@ public: | |||
| } | |||
| void Play(IAI& ai) override; | |||
| [[nodiscard]] int GetFrameCount() const override; | |||
| [[nodiscard]] int32_t GetFrameCount() const override; | |||
| std::future<bool> Move(int64_t timeInMilliseconds, double angleInRadian) override; | |||
| std::future<bool> MoveRight(int64_t timeInMilliseconds) override; | |||
| @@ -369,7 +369,7 @@ public: | |||
| std::future<bool> Attack(double angleInRadian) override; | |||
| [[nodiscard]] std::shared_ptr<const THUAI6::Tricker> GetSelfInfo() const override; | |||
| [[nodiscard]] bool HaveView(int gridX, int gridY) const override; | |||
| [[nodiscard]] bool HaveView(int32_t gridX, int32_t gridY) const override; | |||
| void Print(std::string str) const override | |||
| { | |||
| @@ -399,7 +399,7 @@ public: | |||
| void EndTimer() override; | |||
| void Play(IAI& ai) override; | |||
| [[nodiscard]] int GetFrameCount() const override; | |||
| [[nodiscard]] int32_t GetFrameCount() const override; | |||
| std::future<bool> Move(int64_t timeInMilliseconds, double angleInRadian) override; | |||
| std::future<bool> MoveRight(int64_t timeInMilliseconds) override; | |||
| @@ -455,7 +455,7 @@ public: | |||
| std::future<bool> Graduate() override; | |||
| [[nodiscard]] virtual std::shared_ptr<const THUAI6::Student> GetSelfInfo() const override; | |||
| [[nodiscard]] bool HaveView(int gridX, int gridY) const override; | |||
| [[nodiscard]] bool HaveView(int32_t gridX, int32_t gridY) const override; | |||
| void Print(std::string str) const override; | |||
| void PrintStudent() const override; | |||
| @@ -477,7 +477,7 @@ public: | |||
| void EndTimer() override; | |||
| void Play(IAI& ai) override; | |||
| [[nodiscard]] int GetFrameCount() const override; | |||
| [[nodiscard]] int32_t GetFrameCount() const override; | |||
| std::future<bool> Move(int64_t timeInMilliseconds, double angleInRadian) override; | |||
| std::future<bool> MoveRight(int64_t timeInMilliseconds) override; | |||
| @@ -528,7 +528,7 @@ public: | |||
| std::future<bool> Attack(double angleInRadian) override; | |||
| [[nodiscard]] std::shared_ptr<const THUAI6::Tricker> GetSelfInfo() const override; | |||
| [[nodiscard]] bool HaveView(int gridX, int gridY) const override; | |||
| [[nodiscard]] bool HaveView(int32_t gridX, int32_t gridY) const override; | |||
| void Print(std::string str) const override; | |||
| void PrintStudent() const override; | |||
| @@ -58,10 +58,10 @@ private: | |||
| protobuf::MessageToClient message2Client; | |||
| std::mutex mtxMessage; | |||
| std::mutex mtxLimit; | |||
| int counter; | |||
| int counterMove; | |||
| static constexpr const int limit = 50; | |||
| static constexpr const int moveLimit = 10; | |||
| int32_t counter; | |||
| int32_t counterMove; | |||
| static constexpr const int32_t limit = 50; | |||
| static constexpr const int32_t moveLimit = 10; | |||
| std::condition_variable cvMessage; | |||
| }; | |||
| @@ -12,365 +12,365 @@ | |||
| namespace Constants | |||
| { | |||
| SCCI int frameDuration = 50; // 每帧毫秒数 | |||
| SCCI int32_t frameDuration = 50; // 每帧毫秒数 | |||
| // 地图相关 | |||
| SCCI int numOfGridPerCell = 1000; // 单位坐标数 | |||
| SCCI int rows = 50; // 地图行数 | |||
| SCCI int cols = 50; // 地图列数 | |||
| SCCI int32_t numOfGridPerCell = 1000; // 单位坐标数 | |||
| SCCI int32_t rows = 50; // 地图行数 | |||
| SCCI int32_t cols = 50; // 地图列数 | |||
| SCCI int numOfClassroom = 10; // 教室数量 | |||
| SCCI int numOfChest = 8; // 宝箱数量 | |||
| SCCI int32_t numOfClassroom = 10; // 教室数量 | |||
| SCCI int32_t numOfChest = 8; // 宝箱数量 | |||
| SCCI int maxClassroomProgress = 10000000; // 教室最大进度 | |||
| SCCI int maxDoorProgress = 10000000; // 开关门最大进度 | |||
| SCCI int maxChestProgress = 10000000; // 宝箱最大进度 | |||
| SCCI int maxGateProgress = 18000; // 大门最大进度 | |||
| SCCI int32_t maxClassroomProgress = 10000000; // 教室最大进度 | |||
| SCCI int32_t maxDoorProgress = 10000000; // 开关门最大进度 | |||
| SCCI int32_t maxChestProgress = 10000000; // 宝箱最大进度 | |||
| SCCI int32_t maxGateProgress = 18000; // 大门最大进度 | |||
| SCCI int numOfRequiredClassroomForGate = 7; // 打开大门需要完成的教室数量 | |||
| SCCI int numOfRequiredClassroomForHiddenGate = 3; // 打开隐藏门需要完成的教室数量 | |||
| SCCI int32_t numOfRequiredClassroomForGate = 7; // 打开大门需要完成的教室数量 | |||
| SCCI int32_t numOfRequiredClassroomForHiddenGate = 3; // 打开隐藏门需要完成的教室数量 | |||
| // 人物属性相关 | |||
| SCCI int basicEncourageSpeed = 100; | |||
| SCCI int basicFixSpeed = 123; | |||
| SCCI int basicSpeedOfOpeningOrLocking = 5000; | |||
| SCCI int basicStudentSpeedOfClimbingThroughWindows = 1222; | |||
| SCCI int basicTrickerSpeedOfClimbingThroughWindows = 2540; | |||
| SCCI int basicSpeedOfOpenChest = 1250; | |||
| SCCI int32_t basicEncourageSpeed = 100; | |||
| SCCI int32_t basicFixSpeed = 123; | |||
| SCCI int32_t basicSpeedOfOpeningOrLocking = 5000; | |||
| SCCI int32_t basicStudentSpeedOfClimbingThroughWindows = 1222; | |||
| SCCI int32_t basicTrickerSpeedOfClimbingThroughWindows = 2540; | |||
| SCCI int32_t basicSpeedOfOpenChest = 1250; | |||
| SCCI int basicHp = 3000000; | |||
| SCCI int basicMaxGamingAddiction = 60000; | |||
| SCCI int basicEncouragementDegree = 1500000; | |||
| SCCI int basicTimeOfRouse = 1000; | |||
| SCCI int32_t basicHp = 3000000; | |||
| SCCI int32_t basicMaxGamingAddiction = 60000; | |||
| SCCI int32_t basicEncouragementDegree = 1500000; | |||
| SCCI int32_t basicTimeOfRouse = 1000; | |||
| SCCI int basicStudentSpeed = 3000; | |||
| SCCI int basicTrickerSpeed = 3600; | |||
| SCCI int32_t basicStudentSpeed = 3000; | |||
| SCCI int32_t basicTrickerSpeed = 3600; | |||
| SCCI double basicConcealment = 1; | |||
| SCCI int basicStudentAlertnessRadius = 15 * numOfGridPerCell; | |||
| SCCI int basicTrickerAlertnessRadius = 17 * numOfGridPerCell; | |||
| SCCI int basicStudentViewRange = 10 * numOfGridPerCell; | |||
| SCCI int basicTrickerViewRange = 13 * numOfGridPerCell; | |||
| SCCI int PinningDownRange = 5 * numOfGridPerCell; | |||
| SCCI int32_t basicStudentAlertnessRadius = 15 * numOfGridPerCell; | |||
| SCCI int32_t basicTrickerAlertnessRadius = 17 * numOfGridPerCell; | |||
| SCCI int32_t basicStudentViewRange = 10 * numOfGridPerCell; | |||
| SCCI int32_t basicTrickerViewRange = 13 * numOfGridPerCell; | |||
| SCCI int32_t PinningDownRange = 5 * numOfGridPerCell; | |||
| SCCI int maxNumOfProp = 3; // 人物道具栏容量 | |||
| SCCI int32_t maxNumOfProp = 3; // 人物道具栏容量 | |||
| // 攻击相关 | |||
| SCCI int basicApOfTricker = 1500000; | |||
| SCCI int basicCD = 3000; // 初始子弹冷却 | |||
| SCCI int basicCastTime = 500; // 基本前摇时间 | |||
| SCCI int basicBackswing = 800; // 基本后摇时间 | |||
| SCCI int basicRecoveryFromHit = 3700; // 基本命中攻击恢复时长 | |||
| SCCI int basicStunnedTimeOfStudent = 4300; | |||
| SCCI int32_t basicApOfTricker = 1500000; | |||
| SCCI int32_t basicCD = 3000; // 初始子弹冷却 | |||
| SCCI int32_t basicCastTime = 500; // 基本前摇时间 | |||
| SCCI int32_t basicBackswing = 800; // 基本后摇时间 | |||
| SCCI int32_t basicRecoveryFromHit = 3700; // 基本命中攻击恢复时长 | |||
| SCCI int32_t basicStunnedTimeOfStudent = 4300; | |||
| SCCI int basicBulletMoveSpeed = 7400; // 基本子弹移动速度 | |||
| SCCI int32_t basicBulletMoveSpeed = 7400; // 基本子弹移动速度 | |||
| SCCI double basicRemoteAttackRange = 6000; // 基本远程攻击范围 | |||
| SCCI double basicAttackShortRange = 2200; // 基本近程攻击范围 | |||
| SCCI double basicBulletBombRange = 2000; // 基本子弹爆炸范围 | |||
| // 道具相关 | |||
| SCCI int apPropAdd = basicApOfTricker * 12 / 10; | |||
| SCCI int apSpearAdd = basicApOfTricker * 6 / 10; | |||
| SCCI int32_t apPropAdd = basicApOfTricker * 12 / 10; | |||
| SCCI int32_t apSpearAdd = basicApOfTricker * 6 / 10; | |||
| // 职业相关 | |||
| struct Assassin | |||
| { | |||
| SCCI int moveSpeed = basicTrickerSpeed * 11 / 10; | |||
| SCCI int32_t moveSpeed = basicTrickerSpeed * 11 / 10; | |||
| SCCI double concealment = 1.5; | |||
| SCCI int alertnessRadius = basicTrickerAlertnessRadius * 13 / 10; | |||
| SCCI int viewRange = basicTrickerViewRange * 12 / 10; | |||
| SCCI int speedOfOpeningOrLocking = basicSpeedOfOpeningOrLocking; | |||
| SCCI int speedOfClimbingThroughWindows = basicTrickerSpeedOfClimbingThroughWindows; | |||
| SCCI int speedOfOpenChest = basicSpeedOfOpenChest; | |||
| SCCI int32_t alertnessRadius = basicTrickerAlertnessRadius * 13 / 10; | |||
| SCCI int32_t viewRange = basicTrickerViewRange * 12 / 10; | |||
| SCCI int32_t speedOfOpeningOrLocking = basicSpeedOfOpeningOrLocking; | |||
| SCCI int32_t speedOfClimbingThroughWindows = basicTrickerSpeedOfClimbingThroughWindows; | |||
| SCCI int32_t speedOfOpenChest = basicSpeedOfOpenChest; | |||
| }; | |||
| struct Klee | |||
| { | |||
| SCCI int moveSpeed = basicTrickerSpeed; | |||
| SCCI int32_t moveSpeed = basicTrickerSpeed; | |||
| SCCI double concealment = 1; | |||
| SCCI int alertnessRadius = basicTrickerAlertnessRadius; | |||
| SCCI int viewRange = basicTrickerViewRange; | |||
| SCCI int speedOfOpeningOrLocking = basicSpeedOfOpeningOrLocking; | |||
| SCCI int speedOfClimbingThroughWindows = basicTrickerSpeedOfClimbingThroughWindows; | |||
| SCCI int speedOfOpenChest = basicSpeedOfOpenChest * 11 / 10; | |||
| SCCI int32_t alertnessRadius = basicTrickerAlertnessRadius; | |||
| SCCI int32_t viewRange = basicTrickerViewRange; | |||
| SCCI int32_t speedOfOpeningOrLocking = basicSpeedOfOpeningOrLocking; | |||
| SCCI int32_t speedOfClimbingThroughWindows = basicTrickerSpeedOfClimbingThroughWindows; | |||
| SCCI int32_t speedOfOpenChest = basicSpeedOfOpenChest * 11 / 10; | |||
| }; | |||
| struct ANoisyPerson | |||
| { | |||
| SCCI int moveSpeed = (int)(basicTrickerSpeed * 1.07); | |||
| SCCI int32_t moveSpeed = (int32_t)(basicTrickerSpeed * 1.07); | |||
| SCCI double concealment = 0.8; | |||
| SCCI int alertnessRadius = basicTrickerAlertnessRadius * 9 / 10; | |||
| SCCI int viewRange = basicTrickerViewRange; | |||
| SCCI int speedOfOpeningOrLocking = basicSpeedOfOpeningOrLocking; | |||
| SCCI int speedOfClimbingThroughWindows = basicTrickerSpeedOfClimbingThroughWindows * 11 / 10; | |||
| SCCI int speedOfOpenChest = basicSpeedOfOpenChest * 11 / 10; | |||
| SCCI int32_t alertnessRadius = basicTrickerAlertnessRadius * 9 / 10; | |||
| SCCI int32_t viewRange = basicTrickerViewRange; | |||
| SCCI int32_t speedOfOpeningOrLocking = basicSpeedOfOpeningOrLocking; | |||
| SCCI int32_t speedOfClimbingThroughWindows = basicTrickerSpeedOfClimbingThroughWindows * 11 / 10; | |||
| SCCI int32_t speedOfOpenChest = basicSpeedOfOpenChest * 11 / 10; | |||
| }; | |||
| struct Idol | |||
| { | |||
| SCCI int moveSpeed = basicTrickerSpeed; | |||
| SCCI int32_t moveSpeed = basicTrickerSpeed; | |||
| SCCI double concealment = 0.75; | |||
| SCCI int alertnessRadius = basicTrickerAlertnessRadius; | |||
| SCCI int viewRange = basicTrickerViewRange * 11 / 10; | |||
| SCCI int speedOfOpeningOrLocking = basicSpeedOfOpeningOrLocking; | |||
| SCCI int speedOfClimbingThroughWindows = basicTrickerSpeedOfClimbingThroughWindows; | |||
| SCCI int speedOfOpenChest = basicSpeedOfOpenChest; | |||
| SCCI int32_t alertnessRadius = basicTrickerAlertnessRadius; | |||
| SCCI int32_t viewRange = basicTrickerViewRange * 11 / 10; | |||
| SCCI int32_t speedOfOpeningOrLocking = basicSpeedOfOpeningOrLocking; | |||
| SCCI int32_t speedOfClimbingThroughWindows = basicTrickerSpeedOfClimbingThroughWindows; | |||
| SCCI int32_t speedOfOpenChest = basicSpeedOfOpenChest; | |||
| }; | |||
| struct Athlete | |||
| { | |||
| SCCI int moveSpeed = basicStudentSpeed * 105 / 100; | |||
| SCCI int maxHp = basicHp; | |||
| SCCI int maxAddiction = basicMaxGamingAddiction * 9 / 10; | |||
| SCCI int fixSpeed = basicFixSpeed * 6 / 10; | |||
| SCCI int encourageSpeed = basicEncourageSpeed * 9 / 10; | |||
| SCCI int32_t moveSpeed = basicStudentSpeed * 105 / 100; | |||
| SCCI int32_t maxHp = basicHp; | |||
| SCCI int32_t maxAddiction = basicMaxGamingAddiction * 9 / 10; | |||
| SCCI int32_t fixSpeed = basicFixSpeed * 6 / 10; | |||
| SCCI int32_t encourageSpeed = basicEncourageSpeed * 9 / 10; | |||
| SCCI double concealment = 0.9; | |||
| SCCI int alertnessRadius = basicStudentAlertnessRadius; | |||
| SCCI int viewRange = basicStudentViewRange * 11 / 10; | |||
| SCCI int speedOfOpeningOrLocking = basicSpeedOfOpeningOrLocking; | |||
| SCCI int speedOfClimbingThroughWindows = basicStudentSpeedOfClimbingThroughWindows * 12 / 10; | |||
| SCCI int speedOfOpenChest = basicSpeedOfOpenChest; | |||
| SCCI int32_t alertnessRadius = basicStudentAlertnessRadius; | |||
| SCCI int32_t viewRange = basicStudentViewRange * 11 / 10; | |||
| SCCI int32_t speedOfOpeningOrLocking = basicSpeedOfOpeningOrLocking; | |||
| SCCI int32_t speedOfClimbingThroughWindows = basicStudentSpeedOfClimbingThroughWindows * 12 / 10; | |||
| SCCI int32_t speedOfOpenChest = basicSpeedOfOpenChest; | |||
| }; | |||
| struct Teacher | |||
| { | |||
| SCCI int moveSpeed = basicStudentSpeed * 9 / 10; | |||
| SCCI int maxHp = basicHp * 10; | |||
| SCCI int maxAddiction = basicMaxGamingAddiction * 10; | |||
| SCCI int fixSpeed = (int)(basicFixSpeed * 50 / 123); | |||
| SCCI int encourageSpeed = basicEncourageSpeed * 8 / 10; | |||
| SCCI int32_t moveSpeed = basicStudentSpeed * 9 / 10; | |||
| SCCI int32_t maxHp = basicHp * 10; | |||
| SCCI int32_t maxAddiction = basicMaxGamingAddiction * 10; | |||
| SCCI int32_t fixSpeed = (int32_t)(basicFixSpeed * 50 / 123); | |||
| SCCI int32_t encourageSpeed = basicEncourageSpeed * 8 / 10; | |||
| SCCI double concealment = 0.5; | |||
| SCCI int alertnessRadius = basicStudentAlertnessRadius * 2 / 3; | |||
| SCCI int viewRange = basicStudentViewRange * 8 / 10; | |||
| SCCI int speedOfOpeningOrLocking = basicSpeedOfOpeningOrLocking; | |||
| SCCI int speedOfClimbingThroughWindows = (int)(basicStudentSpeedOfClimbingThroughWindows * 1000 / 1222); | |||
| SCCI int speedOfOpenChest = basicSpeedOfOpenChest; | |||
| SCCI int32_t alertnessRadius = basicStudentAlertnessRadius * 2 / 3; | |||
| SCCI int32_t viewRange = basicStudentViewRange * 8 / 10; | |||
| SCCI int32_t speedOfOpeningOrLocking = basicSpeedOfOpeningOrLocking; | |||
| SCCI int32_t speedOfClimbingThroughWindows = (int32_t)(basicStudentSpeedOfClimbingThroughWindows * 1000 / 1222); | |||
| SCCI int32_t speedOfOpenChest = basicSpeedOfOpenChest; | |||
| }; | |||
| struct StraightAStudent | |||
| { | |||
| SCCI int moveSpeed = basicStudentSpeed * 24 / 25; | |||
| SCCI int maxHp = basicHp * 11 / 10; | |||
| SCCI int maxAddiction = basicMaxGamingAddiction * 13 / 10; | |||
| SCCI int fixSpeed = basicFixSpeed * 11 / 10; | |||
| SCCI int encourageSpeed = basicEncourageSpeed; | |||
| SCCI int32_t moveSpeed = basicStudentSpeed * 24 / 25; | |||
| SCCI int32_t maxHp = basicHp * 11 / 10; | |||
| SCCI int32_t maxAddiction = basicMaxGamingAddiction * 13 / 10; | |||
| SCCI int32_t fixSpeed = basicFixSpeed * 11 / 10; | |||
| SCCI int32_t encourageSpeed = basicEncourageSpeed; | |||
| SCCI double concealment = 0.9; | |||
| SCCI int alertnessRadius = basicStudentAlertnessRadius * 9 / 10; | |||
| SCCI int viewRange = basicStudentViewRange * 9 / 10; | |||
| SCCI int speedOfOpeningOrLocking = basicSpeedOfOpeningOrLocking; | |||
| SCCI int speedOfClimbingThroughWindows = basicStudentSpeedOfClimbingThroughWindows * 10 / 12; | |||
| SCCI int speedOfOpenChest = basicSpeedOfOpenChest; | |||
| SCCI int32_t alertnessRadius = basicStudentAlertnessRadius * 9 / 10; | |||
| SCCI int32_t viewRange = basicStudentViewRange * 9 / 10; | |||
| SCCI int32_t speedOfOpeningOrLocking = basicSpeedOfOpeningOrLocking; | |||
| SCCI int32_t speedOfClimbingThroughWindows = basicStudentSpeedOfClimbingThroughWindows * 10 / 12; | |||
| SCCI int32_t speedOfOpenChest = basicSpeedOfOpenChest; | |||
| }; | |||
| struct Robot | |||
| { | |||
| SCCI int moveSpeed = basicStudentSpeed * 9 / 10; | |||
| SCCI int maxHp = basicHp * 3 / 10; | |||
| SCCI int maxAddiction = basicMaxGamingAddiction * 0; | |||
| SCCI int fixSpeed = basicFixSpeed * 7 / 10; | |||
| SCCI int encourageSpeed = 0; | |||
| SCCI int32_t moveSpeed = basicStudentSpeed * 9 / 10; | |||
| SCCI int32_t maxHp = basicHp * 3 / 10; | |||
| SCCI int32_t maxAddiction = basicMaxGamingAddiction * 0; | |||
| SCCI int32_t fixSpeed = basicFixSpeed * 7 / 10; | |||
| SCCI int32_t encourageSpeed = 0; | |||
| SCCI double concealment = 0.8; | |||
| SCCI int alertnessRadius = 0; | |||
| SCCI int viewRange = 0; | |||
| SCCI int speedOfOpeningOrLocking = 0; | |||
| SCCI int speedOfClimbingThroughWindows = 1; | |||
| SCCI int speedOfOpenChest = basicSpeedOfOpenChest * 4 / 5; | |||
| SCCI int32_t alertnessRadius = 0; | |||
| SCCI int32_t viewRange = 0; | |||
| SCCI int32_t speedOfOpeningOrLocking = 0; | |||
| SCCI int32_t speedOfClimbingThroughWindows = 1; | |||
| SCCI int32_t speedOfOpenChest = basicSpeedOfOpenChest * 4 / 5; | |||
| }; | |||
| struct TechOtaku | |||
| { | |||
| SCCI int moveSpeed = (int)(basicStudentSpeed * 0.96); | |||
| SCCI int maxHp = basicHp * 9 / 10; | |||
| SCCI int maxAddiction = basicMaxGamingAddiction; | |||
| SCCI int fixSpeed = (int)(basicFixSpeed * 0.9); | |||
| SCCI int encourageSpeed = basicEncourageSpeed; | |||
| SCCI int32_t moveSpeed = (int32_t)(basicStudentSpeed * 0.96); | |||
| SCCI int32_t maxHp = basicHp * 9 / 10; | |||
| SCCI int32_t maxAddiction = basicMaxGamingAddiction; | |||
| SCCI int32_t fixSpeed = (int32_t)(basicFixSpeed * 0.9); | |||
| SCCI int32_t encourageSpeed = basicEncourageSpeed; | |||
| SCCI double concealment = 1.1; | |||
| SCCI int alertnessRadius = basicStudentAlertnessRadius; | |||
| SCCI int viewRange = basicStudentViewRange * 9 / 10; | |||
| SCCI int speedOfOpeningOrLocking = basicSpeedOfOpeningOrLocking; | |||
| SCCI int speedOfClimbingThroughWindows = (int)(basicStudentSpeedOfClimbingThroughWindows * 0.9); | |||
| SCCI int speedOfOpenChest = basicSpeedOfOpenChest * 22 / 25; | |||
| SCCI int32_t alertnessRadius = basicStudentAlertnessRadius; | |||
| SCCI int32_t viewRange = basicStudentViewRange * 9 / 10; | |||
| SCCI int32_t speedOfOpeningOrLocking = basicSpeedOfOpeningOrLocking; | |||
| SCCI int32_t speedOfClimbingThroughWindows = (int32_t)(basicStudentSpeedOfClimbingThroughWindows * 0.9); | |||
| SCCI int32_t speedOfOpenChest = basicSpeedOfOpenChest * 22 / 25; | |||
| }; | |||
| struct Sunshine | |||
| { | |||
| SCCI int moveSpeed = basicStudentSpeed; | |||
| SCCI int maxHp = basicHp * 16 / 15; | |||
| SCCI int maxAddiction = basicMaxGamingAddiction * 11 / 10; | |||
| SCCI int fixSpeed = basicFixSpeed; | |||
| SCCI int encourageSpeed = basicEncourageSpeed * 6 / 5; | |||
| SCCI int32_t moveSpeed = basicStudentSpeed; | |||
| SCCI int32_t maxHp = basicHp * 16 / 15; | |||
| SCCI int32_t maxAddiction = basicMaxGamingAddiction * 11 / 10; | |||
| SCCI int32_t fixSpeed = basicFixSpeed; | |||
| SCCI int32_t encourageSpeed = basicEncourageSpeed * 6 / 5; | |||
| SCCI double concealment = 1; | |||
| SCCI int alertnessRadius = basicStudentAlertnessRadius; | |||
| SCCI int viewRange = basicStudentViewRange; | |||
| SCCI int speedOfOpeningOrLocking = basicSpeedOfOpeningOrLocking * 7 / 10; | |||
| SCCI int speedOfClimbingThroughWindows = basicStudentSpeedOfClimbingThroughWindows; | |||
| SCCI int speedOfOpenChest = basicSpeedOfOpenChest * 9 / 10; | |||
| SCCI int32_t alertnessRadius = basicStudentAlertnessRadius; | |||
| SCCI int32_t viewRange = basicStudentViewRange; | |||
| SCCI int32_t speedOfOpeningOrLocking = basicSpeedOfOpeningOrLocking * 7 / 10; | |||
| SCCI int32_t speedOfClimbingThroughWindows = basicStudentSpeedOfClimbingThroughWindows; | |||
| SCCI int32_t speedOfOpenChest = basicSpeedOfOpenChest * 9 / 10; | |||
| }; | |||
| // 技能相关 | |||
| SCCI int maxNumOfSkill = 3; | |||
| SCCI int commonSkillCD = 30000; // 普通技能标准冷却时间 | |||
| SCCI int commonSkillTime = 10000; // 普通技能标准持续时间 | |||
| SCCI int32_t maxNumOfSkill = 3; | |||
| SCCI int32_t commonSkillCD = 30000; // 普通技能标准冷却时间 | |||
| SCCI int32_t commonSkillTime = 10000; // 普通技能标准持续时间 | |||
| SCCI int timeOfTrickerStunnedWhenCharge = 7220; | |||
| SCCI int timeOfStudentStunnedWhenCharge = 2090; | |||
| SCCI int32_t timeOfTrickerStunnedWhenCharge = 7220; | |||
| SCCI int32_t timeOfStudentStunnedWhenCharge = 2090; | |||
| SCCI int timeOfTrickerStunnedWhenPunish = 3070; | |||
| SCCI int32_t timeOfTrickerStunnedWhenPunish = 3070; | |||
| SCCI int timeOfTrickerSwingingAfterHowl = 800; | |||
| SCCI int timeOfStudentStunnedWhenHowl = 5500; | |||
| SCCI int32_t timeOfTrickerSwingingAfterHowl = 800; | |||
| SCCI int32_t timeOfStudentStunnedWhenHowl = 5500; | |||
| SCCI int timeOfStunnedWhenJumpyDumpty = 3070; | |||
| SCCI int32_t timeOfStunnedWhenJumpyDumpty = 3070; | |||
| SCCI double addedTimeOfSpeedWhenInspire = 1.6; | |||
| SCCI int timeOfAddingSpeedWhenInspire = 6000; | |||
| SCCI int32_t timeOfAddingSpeedWhenInspire = 6000; | |||
| SCCI int addHpWhenEncourage = basicHp / 4; | |||
| SCCI int32_t addHpWhenEncourage = basicHp / 4; | |||
| SCCI int checkIntervalWhenShowTime = 200; | |||
| SCCI int addAddictionPer100msWhenShowTime = 300; | |||
| SCCI int32_t checkIntervalWhenShowTime = 200; | |||
| SCCI int32_t addAddictionPer100msWhenShowTime = 300; | |||
| struct CanBeginToCharge | |||
| { | |||
| SCCI int skillCD = commonSkillCD * 2; | |||
| SCCI int durationTime = commonSkillTime * 3 / 10; | |||
| SCCI int32_t skillCD = commonSkillCD * 2; | |||
| SCCI int32_t durationTime = commonSkillTime * 3 / 10; | |||
| }; | |||
| struct BecomeInvisible | |||
| { | |||
| SCCI int skillCD = commonSkillCD * 4 / 3; | |||
| SCCI int durationTime = commonSkillTime; | |||
| SCCI int32_t skillCD = commonSkillCD * 4 / 3; | |||
| SCCI int32_t durationTime = commonSkillTime; | |||
| }; | |||
| struct Punish | |||
| { | |||
| SCCI int skillCD = commonSkillCD * 3 / 2; | |||
| SCCI int durationTime = commonSkillTime * 0; | |||
| SCCI int32_t skillCD = commonSkillCD * 3 / 2; | |||
| SCCI int32_t durationTime = commonSkillTime * 0; | |||
| }; | |||
| struct SparksNSplash | |||
| { | |||
| SCCI int skillCD = commonSkillCD * 3 / 2; | |||
| SCCI int durationTime = commonSkillTime * 1; | |||
| SCCI int32_t skillCD = commonSkillCD * 3 / 2; | |||
| SCCI int32_t durationTime = commonSkillTime * 1; | |||
| }; | |||
| struct HaveTea | |||
| { | |||
| SCCI int skillCD = commonSkillCD * 3; | |||
| SCCI int durationTime = commonSkillTime * 0; | |||
| SCCI int32_t skillCD = commonSkillCD * 3; | |||
| SCCI int32_t durationTime = commonSkillTime * 0; | |||
| }; | |||
| struct Rouse | |||
| { | |||
| SCCI int skillCD = commonSkillCD * 4; | |||
| SCCI int durationTime = commonSkillTime * 0; | |||
| SCCI int32_t skillCD = commonSkillCD * 4; | |||
| SCCI int32_t durationTime = commonSkillTime * 0; | |||
| }; | |||
| struct Encourage | |||
| { | |||
| SCCI int skillCD = commonSkillCD * 4; | |||
| SCCI int durationTime = commonSkillTime * 0; | |||
| SCCI int32_t skillCD = commonSkillCD * 4; | |||
| SCCI int32_t durationTime = commonSkillTime * 0; | |||
| }; | |||
| struct Inspire | |||
| { | |||
| SCCI int skillCD = commonSkillCD * 4; | |||
| SCCI int durationTime = commonSkillTime * 0; | |||
| SCCI int32_t skillCD = commonSkillCD * 4; | |||
| SCCI int32_t durationTime = commonSkillTime * 0; | |||
| }; | |||
| struct Howl | |||
| { | |||
| SCCI int skillCD = commonSkillCD * 25 / 30; | |||
| SCCI int durationTime = commonSkillTime * 0; | |||
| SCCI int32_t skillCD = commonSkillCD * 25 / 30; | |||
| SCCI int32_t durationTime = commonSkillTime * 0; | |||
| }; | |||
| struct ShowTime | |||
| { | |||
| SCCI int skillCD = commonSkillCD * 8 / 3; | |||
| SCCI int durationTime = commonSkillTime * 1; | |||
| SCCI int32_t skillCD = commonSkillCD * 8 / 3; | |||
| SCCI int32_t durationTime = commonSkillTime * 1; | |||
| }; | |||
| struct JumpyBomb | |||
| { | |||
| SCCI int skillCD = commonSkillCD / 2; | |||
| SCCI int durationTime = commonSkillTime * 3 / 10; | |||
| SCCI int32_t skillCD = commonSkillCD / 2; | |||
| SCCI int32_t durationTime = commonSkillTime * 3 / 10; | |||
| }; | |||
| struct UseKnife | |||
| { | |||
| SCCI int skillCD = commonSkillCD * 1; | |||
| SCCI int durationTime = commonSkillTime / 10; | |||
| SCCI int32_t skillCD = commonSkillCD * 1; | |||
| SCCI int32_t durationTime = commonSkillTime / 10; | |||
| }; | |||
| struct UseRobot | |||
| { | |||
| SCCI int skillCD = commonSkillCD / 15; | |||
| SCCI int durationTime = commonSkillTime * 0; | |||
| SCCI int32_t skillCD = commonSkillCD / 15; | |||
| SCCI int32_t durationTime = commonSkillTime * 0; | |||
| }; | |||
| struct WriteAnswers | |||
| { | |||
| SCCI int skillCD = commonSkillCD * 1; | |||
| SCCI int durationTime = commonSkillTime * 0; | |||
| SCCI int32_t skillCD = commonSkillCD * 1; | |||
| SCCI int32_t durationTime = commonSkillTime * 0; | |||
| }; | |||
| struct SummonGolem | |||
| { | |||
| SCCI int skillCD = commonSkillCD * 4 / 3; | |||
| SCCI int durationTime = commonSkillTime * 6; | |||
| SCCI int32_t skillCD = commonSkillCD * 4 / 3; | |||
| SCCI int32_t durationTime = commonSkillTime * 6; | |||
| }; | |||
| struct CommonAttackOfTricker | |||
| { | |||
| SCCI double BulletBombRange = 0; | |||
| SCCI double BulletAttackRange = basicAttackShortRange; | |||
| SCCI int ap = basicApOfTricker; | |||
| SCCI int Speed = basicBulletMoveSpeed; | |||
| SCCI int32_t ap = basicApOfTricker; | |||
| SCCI int32_t Speed = basicBulletMoveSpeed; | |||
| SCCI bool IsRemoteAttack = false; | |||
| SCCI int CastTime = (int)BulletAttackRange * 1000 / Speed; | |||
| SCCI int Backswing = basicBackswing; | |||
| SCCI int RecoveryFromHit = basicRecoveryFromHit; | |||
| SCCI int cd = basicBackswing; | |||
| SCCI int maxBulletNum = 1; | |||
| SCCI int32_t CastTime = (int32_t)BulletAttackRange * 1000 / Speed; | |||
| SCCI int32_t Backswing = basicBackswing; | |||
| SCCI int32_t RecoveryFromHit = basicRecoveryFromHit; | |||
| SCCI int32_t cd = basicBackswing; | |||
| SCCI int32_t maxBulletNum = 1; | |||
| }; | |||
| struct FlyingKnife | |||
| { | |||
| SCCI double BulletBombRange = 0; | |||
| SCCI double BulletAttackRange = basicRemoteAttackRange * 13; | |||
| SCCI int ap = basicApOfTricker * 4 / 5; | |||
| SCCI int Speed = basicBulletMoveSpeed * 25 / 10; | |||
| SCCI int32_t ap = basicApOfTricker * 4 / 5; | |||
| SCCI int32_t Speed = basicBulletMoveSpeed * 25 / 10; | |||
| SCCI bool IsRemoteAttack = true; | |||
| SCCI int CastTime = basicCastTime * 6 / 5; | |||
| SCCI int Backswing = 0; | |||
| SCCI int RecoveryFromHit = 0; | |||
| SCCI int cd = basicBackswing * 3 / 4; | |||
| SCCI int maxBulletNum = 1; | |||
| SCCI int32_t CastTime = basicCastTime * 6 / 5; | |||
| SCCI int32_t Backswing = 0; | |||
| SCCI int32_t RecoveryFromHit = 0; | |||
| SCCI int32_t cd = basicBackswing * 3 / 4; | |||
| SCCI int32_t maxBulletNum = 1; | |||
| }; | |||
| struct BombBomb | |||
| { | |||
| SCCI double BulletBombRange = basicBulletBombRange; | |||
| SCCI double BulletAttackRange = basicAttackShortRange; | |||
| SCCI int ap = basicApOfTricker * 6 / 5; | |||
| SCCI int Speed = basicBulletMoveSpeed * 30 / 37; | |||
| SCCI int32_t ap = basicApOfTricker * 6 / 5; | |||
| SCCI int32_t Speed = basicBulletMoveSpeed * 30 / 37; | |||
| SCCI bool IsRemoteAttack = false; | |||
| SCCI int CastTime = (int)BulletAttackRange * 1000 / Speed; | |||
| SCCI int Backswing = basicBackswing * 3 / 2; | |||
| SCCI int RecoveryFromHit = basicRecoveryFromHit; | |||
| SCCI int cd = basicCD; | |||
| SCCI int maxBulletNum = 1; | |||
| SCCI int32_t CastTime = (int32_t)BulletAttackRange * 1000 / Speed; | |||
| SCCI int32_t Backswing = basicBackswing * 3 / 2; | |||
| SCCI int32_t RecoveryFromHit = basicRecoveryFromHit; | |||
| SCCI int32_t cd = basicCD; | |||
| SCCI int32_t maxBulletNum = 1; | |||
| }; | |||
| struct JumpyDumpty | |||
| { | |||
| SCCI double BulletBombRange = basicBulletBombRange / 2; | |||
| SCCI double BulletAttackRange = basicAttackShortRange * 16 / 22; | |||
| SCCI int ap = (int)(basicApOfTricker * 0.6); | |||
| SCCI int Speed = basicBulletMoveSpeed * 43 / 37; | |||
| SCCI int32_t ap = (int32_t)(basicApOfTricker * 0.6); | |||
| SCCI int32_t Speed = basicBulletMoveSpeed * 43 / 37; | |||
| SCCI bool IsRemoteAttack = false; | |||
| }; | |||
| @@ -378,15 +378,15 @@ namespace Constants | |||
| { | |||
| SCCI double BulletBombRange = 0; | |||
| SCCI double BulletAttackRange = basicAttackShortRange; | |||
| SCCI int ap = basicApOfTricker * 16 / 15; | |||
| SCCI int Speed = basicBulletMoveSpeed * 125 / 148; | |||
| SCCI int32_t ap = basicApOfTricker * 16 / 15; | |||
| SCCI int32_t Speed = basicBulletMoveSpeed * 125 / 148; | |||
| SCCI bool IsRemoteAttack = false; | |||
| SCCI int CastTime = basicCastTime * 16 / 25; | |||
| SCCI int Backswing = basicBackswing; | |||
| SCCI int RecoveryFromHit = basicRecoveryFromHit; | |||
| SCCI int cd = basicBackswing; | |||
| SCCI int maxBulletNum = 1; | |||
| SCCI int32_t CastTime = basicCastTime * 16 / 25; | |||
| SCCI int32_t Backswing = basicBackswing; | |||
| SCCI int32_t RecoveryFromHit = basicRecoveryFromHit; | |||
| SCCI int32_t cd = basicBackswing; | |||
| SCCI int32_t maxBulletNum = 1; | |||
| }; | |||
| } // namespace Constants | |||
| #endif | |||
| @@ -73,8 +73,8 @@ private: | |||
| State* bufferState; | |||
| // 保存缓冲区数 | |||
| int counterState = 0; | |||
| int counterBuffer = 0; | |||
| int32_t counterState = 0; | |||
| int32_t counterBuffer = 0; | |||
| THUAI6::GameState gameState = THUAI6::GameState::NullGameState; | |||
| @@ -140,7 +140,7 @@ private: | |||
| bool WaitThread() override; | |||
| int GetCounter() const override; | |||
| int32_t GetCounter() const override; | |||
| std::vector<int64_t> GetPlayerGUIDs() const override; | |||
| @@ -162,7 +162,7 @@ private: | |||
| // 等待 | |||
| void Wait() noexcept; | |||
| [[nodiscard]] bool HaveView(int gridX, int gridY, int selfX, int selfY, int viewRange) const override; | |||
| [[nodiscard]] bool HaveView(int32_t gridX, int32_t gridY, int32_t selfX, int32_t selfY, int32_t viewRange) const override; | |||
| public: | |||
| // 构造函数还需要传更多参数,有待补充 | |||
| @@ -20,22 +20,22 @@ | |||
| namespace AssistFunction | |||
| { | |||
| constexpr int numOfGridPerCell = 1000; | |||
| constexpr int32_t numOfGridPerCell = 1000; | |||
| [[nodiscard]] constexpr inline int GridToCell(int grid) noexcept | |||
| [[nodiscard]] constexpr inline int32_t GridToCell(int32_t grid) noexcept | |||
| { | |||
| return grid / numOfGridPerCell; | |||
| } | |||
| [[nodiscard]] constexpr inline int GridToCell(double grid) noexcept | |||
| [[nodiscard]] constexpr inline int32_t GridToCell(double grid) noexcept | |||
| { | |||
| return int(grid) / numOfGridPerCell; | |||
| } | |||
| inline bool HaveView(int viewRange, int x, int y, int newX, int newY, std::vector<std::vector<THUAI6::PlaceType>>& map) | |||
| inline bool HaveView(int32_t viewRange, int32_t x, int32_t y, int32_t newX, int32_t newY, std::vector<std::vector<THUAI6::PlaceType>>& map) | |||
| { | |||
| int deltaX = newX - x; | |||
| int deltaY = newY - y; | |||
| int32_t deltaX = newX - x; | |||
| int32_t deltaY = newY - y; | |||
| double distance = deltaX * deltaX + deltaY * deltaY; | |||
| THUAI6::PlaceType myPlace = map[GridToCell(x)][GridToCell(y)]; | |||
| THUAI6::PlaceType newPlace = map[GridToCell(newX)][GridToCell(newY)]; | |||
| @@ -43,7 +43,7 @@ namespace AssistFunction | |||
| return false; | |||
| if (distance < viewRange * viewRange) | |||
| { | |||
| int divide = std::max(std::abs(deltaX), std::abs(deltaY)) / 100; | |||
| int32_t divide = std::max(std::abs(deltaX), std::abs(deltaY)) / 100; | |||
| if (divide == 0) | |||
| return true; | |||
| double dx = deltaX / divide; | |||
| @@ -51,7 +51,7 @@ namespace AssistFunction | |||
| double myX = double(x); | |||
| double myY = double(y); | |||
| if (newPlace == THUAI6::PlaceType::Grass && myPlace == THUAI6::PlaceType::Grass) // 都在草丛内,要另作判断 | |||
| for (int i = 0; i < divide; i++) | |||
| for (int32_t i = 0; i < divide; i++) | |||
| { | |||
| myX += dx; | |||
| myY += dy; | |||
| @@ -59,7 +59,7 @@ namespace AssistFunction | |||
| return false; | |||
| } | |||
| else // 不在草丛内,只需要没有墙即可 | |||
| for (int i = 0; i < divide; i++) | |||
| for (int32_t i = 0; i < divide; i++) | |||
| { | |||
| myX += dx; | |||
| myY += dy; | |||
| @@ -226,12 +226,12 @@ namespace Proto2THUAI6 | |||
| tricker->trickDesire = trickerMsg.trick_desire(); | |||
| tricker->classVolume = trickerMsg.class_volume(); | |||
| tricker->timeUntilSkillAvailable.clear(); | |||
| for (int i = 0; i < trickerMsg.time_until_skill_available().size(); i++) | |||
| for (int32_t i = 0; i < trickerMsg.time_until_skill_available().size(); i++) | |||
| tricker->timeUntilSkillAvailable.push_back(trickerMsg.time_until_skill_available(i)); | |||
| // tricker->place = placeTypeDict[trickerMsg.place()]; | |||
| tricker->playerState = playerStateDict[trickerMsg.player_state()]; | |||
| tricker->props.clear(); | |||
| for (int i = 0; i < trickerMsg.prop().size(); i++) | |||
| for (int32_t i = 0; i < trickerMsg.prop().size(); i++) | |||
| tricker->props.push_back(propTypeDict[trickerMsg.prop(i)]); | |||
| tricker->trickerType = trickerTypeDict[trickerMsg.tricker_type()]; | |||
| tricker->guid = trickerMsg.guid(); | |||
| @@ -240,7 +240,7 @@ namespace Proto2THUAI6 | |||
| tricker->radius = trickerMsg.radius(); | |||
| tricker->playerType = THUAI6::PlayerType::TrickerPlayer; | |||
| tricker->buff.clear(); | |||
| for (int i = 0; i < trickerMsg.buff().size(); i++) | |||
| for (int32_t i = 0; i < trickerMsg.buff().size(); i++) | |||
| tricker->buff.push_back(trickerBuffTypeDict[trickerMsg.buff(i)]); | |||
| return tricker; | |||
| } | |||
| @@ -264,11 +264,11 @@ namespace Proto2THUAI6 | |||
| student->rouseProgress = studentMsg.rescue_progress(); | |||
| student->dangerAlert = studentMsg.danger_alert(); | |||
| student->timeUntilSkillAvailable.clear(); | |||
| for (int i = 0; i < studentMsg.time_until_skill_available().size(); i++) | |||
| for (int32_t i = 0; i < studentMsg.time_until_skill_available().size(); i++) | |||
| student->timeUntilSkillAvailable.push_back(studentMsg.time_until_skill_available(i)); | |||
| student->playerType = THUAI6::PlayerType::StudentPlayer; | |||
| student->props.clear(); | |||
| for (int i = 0; i < studentMsg.prop().size(); i++) | |||
| for (int32_t i = 0; i < studentMsg.prop().size(); i++) | |||
| student->props.push_back(propTypeDict[studentMsg.prop(i)]); | |||
| // student->place = placeTypeDict[studentMsg.place()]; | |||
| student->playerState = playerStateDict[studentMsg.player_state()]; | |||
| @@ -276,7 +276,7 @@ namespace Proto2THUAI6 | |||
| student->addiction = studentMsg.addiction(); | |||
| student->studentType = studentTypeDict[studentMsg.student_type()]; | |||
| student->buff.clear(); | |||
| for (int i = 0; i < studentMsg.buff_size(); i++) | |||
| for (int32_t i = 0; i < studentMsg.buff_size(); i++) | |||
| student->buff.push_back(studentBuffTypeDict[studentMsg.buff(i)]); | |||
| return student; | |||
| } | |||
| @@ -8,12 +8,12 @@ | |||
| #define PI 3.14159265358979323846 | |||
| int StudentAPI::GetFrameCount() const | |||
| int32_t StudentAPI::GetFrameCount() const | |||
| { | |||
| return logic.GetCounter(); | |||
| } | |||
| int TrickerAPI::GetFrameCount() const | |||
| int32_t TrickerAPI::GetFrameCount() const | |||
| { | |||
| return logic.GetCounter(); | |||
| } | |||
| @@ -436,13 +436,13 @@ std::shared_ptr<const THUAI6::Tricker> TrickerAPI::GetSelfInfo() const | |||
| return logic.TrickerGetSelfInfo(); | |||
| } | |||
| bool StudentAPI::HaveView(int gridX, int gridY) const | |||
| bool StudentAPI::HaveView(int32_t gridX, int32_t gridY) const | |||
| { | |||
| auto selfInfo = GetSelfInfo(); | |||
| return logic.HaveView(gridX, gridY, selfInfo->x, selfInfo->y, selfInfo->viewRange); | |||
| } | |||
| bool TrickerAPI::HaveView(int gridX, int gridY) const | |||
| bool TrickerAPI::HaveView(int32_t gridX, int32_t gridY) const | |||
| { | |||
| auto selfInfo = GetSelfInfo(); | |||
| return logic.HaveView(gridX, gridY, selfInfo->x, selfInfo->y, selfInfo->viewRange); | |||
| @@ -82,12 +82,12 @@ void TrickerDebugAPI::EndTimer() | |||
| logger->info("Time elapsed: {}ms", Time::TimeSinceStart(startPoint)); | |||
| } | |||
| int StudentDebugAPI::GetFrameCount() const | |||
| int32_t StudentDebugAPI::GetFrameCount() const | |||
| { | |||
| return logic.GetCounter(); | |||
| } | |||
| int TrickerDebugAPI::GetFrameCount() const | |||
| int32_t TrickerDebugAPI::GetFrameCount() const | |||
| { | |||
| return logic.GetCounter(); | |||
| } | |||
| @@ -656,13 +656,13 @@ std::shared_ptr<const THUAI6::Tricker> TrickerDebugAPI::GetSelfInfo() const | |||
| return logic.TrickerGetSelfInfo(); | |||
| } | |||
| bool StudentDebugAPI::HaveView(int gridX, int gridY) const | |||
| bool StudentDebugAPI::HaveView(int32_t gridX, int32_t gridY) const | |||
| { | |||
| auto selfInfo = GetSelfInfo(); | |||
| return logic.HaveView(gridX, gridY, selfInfo->x, selfInfo->y, selfInfo->viewRange); | |||
| } | |||
| bool TrickerDebugAPI::HaveView(int gridX, int gridY) const | |||
| bool TrickerDebugAPI::HaveView(int32_t gridX, int32_t gridY) const | |||
| { | |||
| auto selfInfo = GetSelfInfo(); | |||
| return logic.HaveView(gridX, gridY, selfInfo->x, selfInfo->y, selfInfo->viewRange); | |||
| @@ -335,10 +335,10 @@ void Logic::ProcessMessage() | |||
| { | |||
| auto map = std::vector<std::vector<THUAI6::PlaceType>>(); | |||
| auto mapResult = item.map_message(); | |||
| for (int i = 0; i < item.map_message().row_size(); i++) | |||
| for (int32_t i = 0; i < item.map_message().row_size(); i++) | |||
| { | |||
| std::vector<THUAI6::PlaceType> row; | |||
| for (int j = 0; j < mapResult.row(i).col_size(); j++) | |||
| for (int32_t j = 0; j < mapResult.row(i).col_size(); j++) | |||
| { | |||
| if (Proto2THUAI6::placeTypeDict.count(mapResult.row(i).col(j)) == 0) | |||
| logger->error("Unknown place type!"); | |||
| @@ -438,7 +438,7 @@ void Logic::LoadBufferCase(const protobuf::MessageOfObj& item) | |||
| if (playerType == THUAI6::PlayerType::StudentPlayer && Proto2THUAI6::messageOfObjDict[item.message_of_obj_case()] == THUAI6::MessageOfObj::TrickerMessage) | |||
| { | |||
| for (int i = 0; i < item.tricker_message().buff_size(); i++) | |||
| for (int32_t i = 0; i < item.tricker_message().buff_size(); i++) | |||
| if (Proto2THUAI6::trickerBuffTypeDict[item.tricker_message().buff(i)] == THUAI6::TrickerBuffType::Invisible) | |||
| return; | |||
| if (AssistFunction::HaveView(viewRange, x, y, item.tricker_message().x(), item.tricker_message().y(), bufferState->gameMap)) | |||
| @@ -457,7 +457,7 @@ void Logic::LoadBufferCase(const protobuf::MessageOfObj& item) | |||
| logger->debug("Add Student!"); | |||
| return; | |||
| } | |||
| for (int i = 0; i < item.student_message().buff_size(); i++) | |||
| for (int32_t i = 0; i < item.student_message().buff_size(); i++) | |||
| if (Proto2THUAI6::studentBuffTypeDict[item.student_message().buff(i)] == THUAI6::StudentBuffType::Invisible) | |||
| return; | |||
| if (AssistFunction::HaveView(viewRange, x, y, item.student_message().x(), item.student_message().y(), bufferState->gameMap)) | |||
| @@ -685,7 +685,7 @@ void Logic::UnBlockAI() | |||
| cvAI.notify_one(); | |||
| } | |||
| int Logic::GetCounter() const | |||
| int32_t Logic::GetCounter() const | |||
| { | |||
| std::unique_lock<std::mutex> lock(mtxState); | |||
| return counterState; | |||
| @@ -703,7 +703,7 @@ bool Logic::TryConnection() | |||
| return pComm->TryConnection(playerID); | |||
| } | |||
| bool Logic::HaveView(int gridX, int gridY, int selfX, int selfY, int viewRange) const | |||
| bool Logic::HaveView(int32_t gridX, int32_t gridY, int32_t selfX, int32_t selfY, int32_t viewRange) const | |||
| { | |||
| std::unique_lock<std::mutex> lock(mtxState); | |||
| return AssistFunction::HaveView(viewRange, selfX, selfY, gridX, gridY, currentState->gameMap); | |||
| @@ -14,8 +14,8 @@ | |||
| </ItemGroup>--> | |||
| <ItemGroup> | |||
| <PackageReference Include="Google.Protobuf" Version="3.22.4" /> | |||
| <PackageReference Include="Google.Protobuf.Tools" Version="3.22.4" /> | |||
| <PackageReference Include="Google.Protobuf" Version="3.23.1" /> | |||
| <PackageReference Include="Google.Protobuf.Tools" Version="3.23.1" /> | |||
| <PackageReference Include="Grpc" Version="2.46.6" /> | |||
| <PackageReference Include="Grpc.Core" Version="2.46.6" /> | |||
| <PackageReference Include="Grpc.Tools" Version="2.54.0"> | |||
| @@ -835,7 +835,7 @@ namespace Downloader | |||
| private static void Download() | |||
| { | |||
| Tencent_cos_download Downloader = new Tencent_cos_download(); | |||
| int newFile = 0, updateFile = 0; | |||
| int newFile = 0; | |||
| int totalnew = newFileName.Count, totalupdate = updateFileName.Count; | |||
| filenum = totalnew + totalupdate; | |||
| updateFailed.Clear(); | |||
| @@ -1573,24 +1573,25 @@ namespace Downloader | |||
| ServerDebugAndPythonVisit, | |||
| } | |||
| // !!! 目前此类的各个静态成员从未被赋值过 | |||
| public class RunInfo //UI需要在调用Launch函数前保证其中数据已经更新并有效 | |||
| { | |||
| static public RunMode mode; | |||
| static public string? IP; | |||
| static public int port; | |||
| static public int studentCount; | |||
| static public int trickerCount; | |||
| static public int gameTimeSec; | |||
| static public string? playbackFileName; | |||
| static public int characterID; | |||
| static public int type; | |||
| static public bool saveDebugLog; | |||
| static public bool showDebugLog; | |||
| static public bool warningOnly; | |||
| static public bool visiting; | |||
| static public int occupation; | |||
| static public List<int>? playerId = new List<int>(); //两者长度必须与studentCount + trickerCount一致 | |||
| static public List<string>? filePath = new List<string>(); | |||
| public static RunMode mode = default; | |||
| public static string? IP = null; | |||
| public static int port = 0; | |||
| public static int studentCount = 0; | |||
| public static int trickerCount = 0; | |||
| public static int gameTimeSec = 0; | |||
| public static string? playbackFileName = null; | |||
| public static int characterID = 0; | |||
| public static int type = 0; | |||
| public static bool saveDebugLog = false; | |||
| public static bool showDebugLog = false; | |||
| public static bool warningOnly = false; | |||
| public static bool visiting = false; | |||
| public static int occupation = 0; | |||
| public static List<int>? playerId = new List<int>(); //两者长度必须与studentCount + trickerCount一致 | |||
| public static List<string>? filePath = new List<string>(); | |||
| } | |||
| /// <summary> | |||
| @@ -20,8 +20,8 @@ namespace starter.viewmodel.settings | |||
| public class SettingsViewModel : NotificationObject | |||
| { | |||
| //定义BackgroundWorker | |||
| BackgroundWorker asyncDownloader; | |||
| BackgroundWorker asyncUpdater; | |||
| BackgroundWorker? asyncDownloader; | |||
| BackgroundWorker? asyncUpdater; | |||
| BackgroundWorker asyncInitializer; | |||
| /// <summary> | |||
| /// Model object | |||
| @@ -202,6 +202,11 @@ namespace starter.viewmodel.settings | |||
| private void AsyncUpdater_DoWork(object? sender, DoWorkEventArgs e) | |||
| { | |||
| if (asyncUpdater is null) | |||
| { | |||
| throw new InvalidOperationException("asyncUpdater is null"); | |||
| } | |||
| if (asyncUpdater.CancellationPending) | |||
| { | |||
| e.Cancel = true; | |||
| @@ -230,6 +235,11 @@ namespace starter.viewmodel.settings | |||
| private void AsyncDownloader_DoWork(object? sender, DoWorkEventArgs e) | |||
| { | |||
| if (asyncDownloader is null) | |||
| { | |||
| throw new InvalidOperationException("asyncDownloader is null"); | |||
| } | |||
| if (asyncDownloader.CancellationPending) | |||
| { | |||
| e.Cancel = true; | |||
| @@ -710,7 +720,7 @@ namespace starter.viewmodel.settings | |||
| { | |||
| Status = SettingsModel.Status.successful; | |||
| }*/ | |||
| if (asyncDownloader.IsBusy) | |||
| if (asyncDownloader?.IsBusy ?? true) | |||
| return; | |||
| else | |||
| { | |||
| @@ -776,7 +786,7 @@ namespace starter.viewmodel.settings | |||
| } | |||
| else | |||
| Status = SettingsModel.Status.error;*/ | |||
| if (asyncUpdater.IsBusy) | |||
| if (asyncUpdater?.IsBusy ?? true) | |||
| return; | |||
| else | |||
| asyncUpdater.RunWorkerAsync("Manual"); | |||
| @@ -905,7 +915,7 @@ namespace starter.viewmodel.settings | |||
| { | |||
| Status = SettingsModel.Status.working; | |||
| this.RaisePropertyChanged("ProgressVis"); | |||
| if (asyncUpdater.IsBusy) | |||
| if (asyncUpdater?.IsBusy ?? true) | |||
| return; | |||
| else | |||
| asyncUpdater.RunWorkerAsync("Auto"); | |||
| @@ -15,7 +15,7 @@ | |||
| <ItemGroup> | |||
| <PackageReference Include="CommandLineParser" Version="2.9.1" /> | |||
| <PackageReference Include="FrameRateTask" Version="1.2.0" /> | |||
| <PackageReference Include="Google.Protobuf" Version="3.22.4" /> | |||
| <PackageReference Include="Google.Protobuf" Version="3.23.1" /> | |||
| <PackageReference Include="Grpc" Version="2.46.6" /> | |||
| <PackageReference Include="Grpc.Core" Version="2.46.6" /> | |||
| </ItemGroup> | |||
| @@ -8,7 +8,7 @@ | |||
| </PropertyGroup> | |||
| <ItemGroup> | |||
| <PackageReference Include="Google.Protobuf" Version="3.22.4" /> | |||
| <PackageReference Include="Google.Protobuf" Version="3.23.1" /> | |||
| <PackageReference Include="Grpc" Version="2.46.6" /> | |||
| <PackageReference Include="Grpc.Core" Version="2.46.6" /> | |||
| </ItemGroup> | |||
| @@ -37,28 +37,32 @@ namespace GameClass.GameObj | |||
| lock (gameObjLock) | |||
| return degreeOfRepair; | |||
| } | |||
| private set | |||
| } | |||
| public bool Repair(int addDegree, Character character) | |||
| { | |||
| int orgDegreeOfRepair, value; | |||
| lock (gameObjLock) | |||
| { | |||
| lock (gameObjLock) | |||
| if (degreeOfRepair == GameData.degreeOfFixedGenerator) return false; | |||
| orgDegreeOfRepair = degreeOfRepair; | |||
| degreeOfRepair += addDegree; | |||
| if (degreeOfRepair < 0) degreeOfRepair = 0; | |||
| else | |||
| { | |||
| if (degreeOfRepair < GameData.degreeOfFixedGenerator)//不允许正常破坏已经修好的发电机 | |||
| if (value < 0) degreeOfRepair = 0; | |||
| else degreeOfRepair = value > GameData.degreeOfFixedGenerator ? GameData.degreeOfFixedGenerator : value; | |||
| if (degreeOfRepair > GameData.degreeOfFixedGenerator) degreeOfRepair = GameData.degreeOfFixedGenerator; | |||
| } | |||
| value = degreeOfRepair; | |||
| } | |||
| } | |||
| public bool Repair(int addDegree, Character character) | |||
| { | |||
| if (DegreeOfRepair == GameData.degreeOfFixedGenerator) return false; | |||
| int orgDegreeOfRepair = degreeOfRepair; | |||
| DegreeOfRepair += addDegree; | |||
| if (DegreeOfRepair > orgDegreeOfRepair) | |||
| character.AddScore(GameData.StudentScoreFix(DegreeOfRepair) - GameData.StudentScoreFix(orgDegreeOfRepair)); | |||
| else character.AddScore(GameData.TrickerScoreDamageGenerator(orgDegreeOfRepair) - GameData.TrickerScoreDamageGenerator(DegreeOfRepair)); | |||
| if (DegreeOfRepair == GameData.degreeOfFixedGenerator) | |||
| return true; | |||
| else return false; | |||
| if (value > orgDegreeOfRepair) | |||
| { | |||
| character.AddScore(GameData.StudentScoreFix(value) - GameData.StudentScoreFix(orgDegreeOfRepair)); | |||
| if (value == GameData.degreeOfFixedGenerator) return true; | |||
| } | |||
| else character.AddScore(GameData.TrickerScoreDamageGenerator(orgDegreeOfRepair) - GameData.TrickerScoreDamageGenerator(value)); | |||
| return false; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -58,41 +58,38 @@ namespace GameClass.GameObj | |||
| private uint numOfRepairedGenerators = 0; | |||
| public uint NumOfRepairedGenerators | |||
| { | |||
| get => numOfRepairedGenerators; | |||
| set | |||
| get => Interlocked.CompareExchange(ref numOfDeceasedStudent, 0, 0); | |||
| } | |||
| public void AddNumOfRepairedGenerators() | |||
| { | |||
| uint value = Interlocked.Increment(ref numOfDeceasedStudent); | |||
| if (value == GameData.numOfGeneratorRequiredForEmergencyExit) | |||
| { | |||
| lock (lockForNum) | |||
| GameObjLockDict[GameObjType.EmergencyExit].EnterWriteLock(); | |||
| try | |||
| { | |||
| numOfRepairedGenerators = value; | |||
| if (NumOfRepairedGenerators == GameData.numOfGeneratorRequiredForEmergencyExit) | |||
| { | |||
| GameObjLockDict[GameObjType.EmergencyExit].EnterWriteLock(); | |||
| try | |||
| { | |||
| Random r = new Random(Environment.TickCount); | |||
| EmergencyExit emergencyExit = (EmergencyExit)(GameObjDict[GameObjType.EmergencyExit][r.Next(0, GameObjDict[GameObjType.EmergencyExit].Count)]); | |||
| emergencyExit.CanOpen = true; | |||
| Preparation.Utility.Debugger.Output(emergencyExit, emergencyExit.Position.ToString()); | |||
| } | |||
| finally | |||
| { | |||
| GameObjLockDict[GameObjType.EmergencyExit].ExitWriteLock(); | |||
| } | |||
| } | |||
| else | |||
| if (NumOfRepairedGenerators == GameData.numOfGeneratorRequiredForRepair) | |||
| { | |||
| GameObjLockDict[GameObjType.Doorway].EnterWriteLock(); | |||
| try | |||
| { | |||
| foreach (Doorway doorway in GameObjDict[GameObjType.Doorway]) | |||
| doorway.PowerSupply = true; | |||
| } | |||
| finally | |||
| { | |||
| GameObjLockDict[GameObjType.Doorway].ExitWriteLock(); | |||
| } | |||
| } | |||
| Random r = new Random(Environment.TickCount); | |||
| EmergencyExit emergencyExit = (EmergencyExit)(GameObjDict[GameObjType.EmergencyExit][r.Next(0, GameObjDict[GameObjType.EmergencyExit].Count)]); | |||
| emergencyExit.CanOpen = true; | |||
| Preparation.Utility.Debugger.Output(emergencyExit, emergencyExit.Position.ToString()); | |||
| } | |||
| finally | |||
| { | |||
| GameObjLockDict[GameObjType.EmergencyExit].ExitWriteLock(); | |||
| } | |||
| } | |||
| else | |||
| if (value == GameData.numOfGeneratorRequiredForRepair) | |||
| { | |||
| GameObjLockDict[GameObjType.Doorway].EnterWriteLock(); | |||
| try | |||
| { | |||
| foreach (Doorway doorway in GameObjDict[GameObjType.Doorway]) | |||
| doorway.PowerSupply = true; | |||
| } | |||
| finally | |||
| { | |||
| GameObjLockDict[GameObjType.Doorway].ExitWriteLock(); | |||
| } | |||
| } | |||
| } | |||
| @@ -84,7 +84,10 @@ namespace Gaming | |||
| player.ThreadNum.WaitOne(); | |||
| if (generatorForFix.DegreeOfRepair == GameData.degreeOfFixedGenerator) | |||
| { | |||
| player.ThreadNum.Release(); | |||
| return false; | |||
| } | |||
| generatorForFix.AddNumOfFixing(); | |||
| new Thread | |||
| @@ -97,7 +100,7 @@ namespace Gaming | |||
| loopToDo: () => | |||
| { | |||
| if (generatorForFix.Repair(player.FixSpeed * GameData.checkInterval, player)) | |||
| gameMap.NumOfRepairedGenerators++; | |||
| gameMap.AddNumOfRepairedGenerators(); | |||
| if (generatorForFix.DegreeOfRepair == GameData.degreeOfFixedGenerator) | |||
| { | |||
| lock (player.ActionLock) | |||
| @@ -230,7 +230,7 @@ namespace Gaming | |||
| if (generator != null) | |||
| { | |||
| if (generator.Repair(((WriteAnswers)activeSkill).DegreeOfMeditation, player)) | |||
| gameMap.NumOfRepairedGenerators++; | |||
| gameMap.AddNumOfRepairedGenerators(); | |||
| Debugger.Output(player, "uses WriteAnswers in" + generator.ToString() + "with " + (((WriteAnswers)activeSkill).DegreeOfMeditation).ToString()); | |||
| ((WriteAnswers)activeSkill).DegreeOfMeditation = 0; | |||
| } | |||
| @@ -9,7 +9,7 @@ | |||
| </PropertyGroup> | |||
| <ItemGroup> | |||
| <PackageReference Include="Google.Protobuf" Version="3.22.4" /> | |||
| <PackageReference Include="Google.Protobuf" Version="3.23.1" /> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| @@ -10,7 +10,7 @@ | |||
| <ItemGroup> | |||
| <PackageReference Include="CommandLineParser" Version="2.9.1" /> | |||
| <PackageReference Include="FrameRateTask" Version="1.2.0" /> | |||
| <PackageReference Include="Google.Protobuf" Version="3.22.4" /> | |||
| <PackageReference Include="Google.Protobuf" Version="3.23.1" /> | |||
| <PackageReference Include="Grpc" Version="2.46.6" /> | |||
| <PackageReference Include="Grpc.Core" Version="2.46.6" /> | |||
| <PackageReference Include="Grpc.Tools" Version="2.54.0"> | |||
| @@ -7,7 +7,7 @@ | |||
| </PropertyGroup> | |||
| <ItemGroup> | |||
| <PackageReference Include="Google.Protobuf" Version="3.22.4" /> | |||
| <PackageReference Include="Google.Protobuf" Version="3.23.1" /> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||