diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 1cea003..48cbb0d 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -76,6 +76,12 @@ void Human::FillMFObjectFull(cs::MFObjectFull* full_data) p->set_chest(chest); curr_weapon->ToPB(p->mutable_weapon()); p->set_energy_shield(energy_shield); + #if 1 + { + int max_energy_shield = MetaMgr::Instance()->GetSysParamAsInt("max_energy_shield"); + p->set_max_energy_shield(max_energy_shield); + } + #endif p->set_vip(vip); p->set_sdmg(sdmg); } @@ -486,9 +492,13 @@ void Human::BeKill(int killer_id, const std::string& killer_name) void Human::DecHP(float dec_hp, int killer_id, const std::string& killer_name) { - health = std::max(0.0f, health - dec_hp); - if (health <= 0.0001f) { - BeKill(killer_id, killer_name); + if (energy_shield > 0.001f) { + energy_shield = std::max(0.0f, energy_shield - dec_hp); + } else { + health = std::max(0.0f, health - dec_hp); + if (health <= 0.0001f) { + BeKill(killer_id, killer_name); + } } SyncAroundPlayers(); } diff --git a/server/gameserver/player.cc b/server/gameserver/player.cc index ec9dde7..642a28f 100644 --- a/server/gameserver/player.cc +++ b/server/gameserver/player.cc @@ -887,6 +887,13 @@ void Player::FillMFActivePlayerData(cs::MFActivePlayerData* player_data) p->set_left_time(left_time); p->set_lasting_time(anodyne_max_time * 1000); } + player_data->set_energy_shield(energy_shield); + #if 1 + { + int max_energy_shield = MetaMgr::Instance()->GetSysParamAsInt("max_energy_shield"); + player_data->set_max_energy_shield(max_energy_shield); + } + #endif } void Player::FillMFGasData(cs::MFGasData* gas_data) diff --git a/server/tools/protobuild/cs_proto.proto b/server/tools/protobuild/cs_proto.proto index e572855..f4d7ffa 100755 --- a/server/tools/protobuild/cs_proto.proto +++ b/server/tools/protobuild/cs_proto.proto @@ -157,6 +157,7 @@ message MFPlayerFull optional int32 energy_shield = 19; //能量护盾 optional int32 vip = 20; //vip optional int32 sdmg = 21; + optional int32 max_energy_shield = 22; //最大能量护盾 } //阻挡物-部分 @@ -384,6 +385,9 @@ message MFActivePlayerData optional int32 cur_weapon_idx = 15; //当前武器索引 0-4 repeated MFWeapon weapons = 16; //武器列表1-4 0:拳头 1:枪 2:枪 3:手雷 4:烟雾弹 + optional int32 energy_shield = 40; //能量护盾 + optional int32 max_energy_shield = 41; //最大能量护盾 + optional int32 spectator_count = 20; repeated MFBodyState states = 27; //角色状态 }