From 4efd559043e71bdcd67d40169de176c7b9c31abb Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 13 Apr 2021 16:43:36 +0800 Subject: [PATCH] 1 --- server/gameserver/creature.cc | 1 + server/gameserver/human.cc | 2 ++ server/gameserver/molotor_cocktail_mitask.cc | 3 +++ server/gameserver/posiongas_mitask.cc | 3 +++ server/gameserver/room.cc | 5 +++++ server/gameserver/room.h | 1 + server/tools/protobuild/cs_proto.proto | 2 ++ 7 files changed, 17 insertions(+) diff --git a/server/gameserver/creature.cc b/server/gameserver/creature.cc index 6da8f6c..04ef185 100644 --- a/server/gameserver/creature.cc +++ b/server/gameserver/creature.cc @@ -501,6 +501,7 @@ void Creature::DoSkill(int skill_id, skill_distance_ = skill_distance; curr_skill_ = skill; playing_skill = true; + buff_vec2_param1 = GetPos() + skill_dir_ * skill_distance_; CurrentSkill()->last_use_frameno = room->GetFrameNo(); if (CurrentSkill()->meta->i->skill_target() == kST_Self ) { diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 76f1bcd..6a5f124 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -696,6 +696,8 @@ void Human::FillSMGameOver(cs::SMGameOver& msg) msg.set_game_over(room->IsGameOver()); msg.set_victory(!dead); msg.set_room_uuid(a8::XValue(room->GetRoomUuid())); + msg.set_total_human_num(room->GetHumanNum()); + msg.set_alive_human_num(room->AliveCount()); { for (auto& itr : *team_members) { diff --git a/server/gameserver/molotor_cocktail_mitask.cc b/server/gameserver/molotor_cocktail_mitask.cc index 60d472b..3d65a2e 100644 --- a/server/gameserver/molotor_cocktail_mitask.cc +++ b/server/gameserver/molotor_cocktail_mitask.cc @@ -64,11 +64,14 @@ void MolotorCocktailMiTask::Check() } } ); + a8::Vec2 old_buff_vec2_param1 = sender.Get()->buff_vec2_param1; + sender.Get()->buff_vec2_param1 = sender.Get()->GetPos(); for (Creature* target : objects) { if (!target->GetBuffById(meta->i->buffid())) { target->MustBeAddBuff(sender.Get(), meta->i->buffid()); } } + sender.Get()->buff_vec2_param1 = old_buff_vec2_param1; } } diff --git a/server/gameserver/posiongas_mitask.cc b/server/gameserver/posiongas_mitask.cc index f580c25..9a4efc3 100644 --- a/server/gameserver/posiongas_mitask.cc +++ b/server/gameserver/posiongas_mitask.cc @@ -64,11 +64,14 @@ void PosionGasMiTask::Check() } } ); + a8::Vec2 old_buff_vec2_param1 = sender.Get()->buff_vec2_param1; + sender.Get()->buff_vec2_param1 = sender.Get()->GetPos(); for (Creature* target : objects) { if (!target->GetBuffById(meta->i->buffid())) { target->MustBeAddBuff(sender.Get(), meta->i->buffid()); } } + sender.Get()->buff_vec2_param1 = old_buff_vec2_param1; } } diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index 5db96d0..d872b61 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -171,6 +171,11 @@ int Room::GetPlayerNum() return accountid_hash_.size(); } +int Room::GetHumanNum() +{ + return human_hash_.size(); +} + Player* Room::GetPlayerByAccountId(const std::string& accountid) { auto itr = accountid_hash_.find(accountid); diff --git a/server/gameserver/room.h b/server/gameserver/room.h index e4144bd..0697126 100644 --- a/server/gameserver/room.h +++ b/server/gameserver/room.h @@ -74,6 +74,7 @@ public: #endif int GetPlayerNum(); + int GetHumanNum(); int AliveCount(); long long AliveCountChgFrameNo() { return alive_count_chged_frameno_; }; inline int RealAliveCount() { return alive_human_hash_.size(); } diff --git a/server/tools/protobuild/cs_proto.proto b/server/tools/protobuild/cs_proto.proto index 9fb908c..9fbfd35 100755 --- a/server/tools/protobuild/cs_proto.proto +++ b/server/tools/protobuild/cs_proto.proto @@ -1066,6 +1066,8 @@ message SMGameOver optional int32 team_allcnt = 3; optional bool game_over = 4; //是否结束 optional bool victory = 5; //是否胜利 + optional int32 total_human_num = 12; //房间总人数 + optional int32 alive_human_num = 13; //房间剩余存活人数 repeated MFPlayerStats player_stats = 6; //玩家信息统计 optional string room_uuid = 7; //房间唯一id