diff --git a/CAPI/API/include/structures.h b/CAPI/API/include/structures.h index bdeab2e..436e1e7 100644 --- a/CAPI/API/include/structures.h +++ b/CAPI/API/include/structures.h @@ -87,7 +87,7 @@ namespace THUAI6 ButcherBuffType4 = 4, }; - //人类状态枚举 + // 人类状态枚举 enum class HumanState : unsigned char { NullHumanState = 0, @@ -118,8 +118,7 @@ namespace THUAI6 struct Human : public Player { - bool onChair; // 是否被挂 - bool onGround; // 是否倒地 + HumanState state; // 人类状态 int32_t life; // 剩余生命(本次倒地之前还能承受的伤害) int32_t hangedTime; // 被挂的次数 diff --git a/CAPI/API/include/utils.hpp b/CAPI/API/include/utils.hpp index 1f5a5f9..d73d333 100644 --- a/CAPI/API/include/utils.hpp +++ b/CAPI/API/include/utils.hpp @@ -76,6 +76,15 @@ namespace Proto2THUAI6 {protobuf::ButcherBuffType::BBUFFTYPE4, THUAI6::ButcherBuffType::ButcherBuffType4}, }; + inline std::map humanStateDict{ + {protobuf::HumanState::NULL_STATUS, THUAI6::HumanState::NullHumanState}, + {protobuf::HumanState::IDLE, THUAI6::HumanState::Idle}, + {protobuf::HumanState::FIXING, THUAI6::HumanState::Fixing}, + {protobuf::HumanState::DYING, THUAI6::HumanState::Dying}, + {protobuf::HumanState::ON_CHAIR, THUAI6::HumanState::OnChair}, + {protobuf::HumanState::DEAD, THUAI6::HumanState::Dead}, + }; + // 用于将Protobuf中的类转换为THUAI6的类 inline std::shared_ptr Protobuf2THUAI6Butcher(const protobuf::MessageOfButcher& butcherMsg) { @@ -115,8 +124,7 @@ namespace Proto2THUAI6 human->playerType = THUAI6::PlayerType::HumanPlayer; human->prop = propTypeDict[humanMsg.prop()]; human->place = placeTypeDict[humanMsg.place()]; - human->onChair = humanMsg.on_chair(); - human->onGround = humanMsg.on_ground(); + human->state = humanStateDict[humanMsg.state()]; human->life = humanMsg.life(); human->hangedTime = humanMsg.hanged_time(); human->humanType = humanTypeDict[humanMsg.human_type()];