From a698ab16cbb4737111f4ab0b435b0d5a928b3d92 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 21 Nov 2023 11:49:23 +0800 Subject: [PATCH] 1 --- server/gameserver/roomobstacle.cc | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/server/gameserver/roomobstacle.cc b/server/gameserver/roomobstacle.cc index d714462a..2f2ce080 100644 --- a/server/gameserver/roomobstacle.cc +++ b/server/gameserver/roomobstacle.cc @@ -907,12 +907,21 @@ void RoomObstacle::ActiveFlameSurface() auto cb = [this, adjusted_pos] () { - std::set human_list; + std::vector human_list; room->grid_service->TraverseAllLayerHumanList (room->GetRoomIdx(), *grid_list_, [this, &human_list, &adjusted_pos] (Human* hum, bool& stop) { + if (hum->dead) { + return; + } + if (!master.Get()) { + return; + } + if (master.Get()->team_id == hum->team_id) { + return; + } if (Collision::Check2dRotationRectangle ( hum->GetPos().GetX(), @@ -920,13 +929,25 @@ void RoomObstacle::ActiveFlameSurface() hum->GetHitRadius(), adjusted_pos.x, adjusted_pos.z, - meta->width() / 2.0f, + meta->width(), meta->height() / 2.0f, GetRotate() * 180.f )) { + human_list.push_back(hum); } } ); + for (auto& hum : human_list) { + for (int buff_id : meta->_buff_list) { + if (!hum->GetBuffById(buff_id)) { + hum->TryAddBuff(master.Get(), + buff_id); +#ifdef MYDEBUG + a8::XPrintf("火焰枪地面命中\n", {}); +#endif + } + } + } }; room->xtimer.SetIntervalEx (