From 3acbed4368c7d897f248f1b2c5a86fa3330ac595 Mon Sep 17 00:00:00 2001 From: azw Date: Mon, 6 Nov 2023 08:02:21 +0000 Subject: [PATCH 01/11] 1 --- server/gameserver/constant_export.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/gameserver/constant_export.h b/server/gameserver/constant_export.h index 72889954..28ab1339 100644 --- a/server/gameserver/constant_export.h +++ b/server/gameserver/constant_export.h @@ -48,7 +48,7 @@ A8_DECLARE_ENUM(BuffEffectType_e, kBET_ModifyAttr = 13, kBET_PlayShotAni = 14, //播放射击动画 kBET_Vertigo = 15, //眩晕 - kBET_UnUse16 = 16, + kBET_Floating = 16, //浮空 kBET_PullDone = 17, //拖拽到目的地 kBET_DelayAddBuff = 18, //延迟加buff kBET_ModifyBaseAttr = 19, From 59abd5958b0a08f38e0b201fdfdb1a20b2b58400 Mon Sep 17 00:00:00 2001 From: azw Date: Mon, 6 Nov 2023 08:39:33 +0000 Subject: [PATCH 02/11] 1 --- server/gameserver/buff/callfunc.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/server/gameserver/buff/callfunc.cc b/server/gameserver/buff/callfunc.cc index 898b1900..72459389 100644 --- a/server/gameserver/buff/callfunc.cc +++ b/server/gameserver/buff/callfunc.cc @@ -273,6 +273,7 @@ void CallFuncBuff::ProcAddMinorMode() if (owner_ptr.Get()) { if (action == 1) { owner_ptr.Get()->TryAddBuff(owner_ptr.Get(), meta_ptr->_int_buff_param4, skill_meta_ptr); + owner_ptr.Get()->RemoveBuffById(meta_ptr->_int_buff_param6); } else if (action == 0) { owner_ptr.Get()->TryAddBuff(owner_ptr.Get(), meta_ptr->_int_buff_param5, skill_meta_ptr); } From 194360aed822d80d604a5600ad39e417d0142095 Mon Sep 17 00:00:00 2001 From: azw Date: Tue, 7 Nov 2023 01:57:50 +0000 Subject: [PATCH 03/11] 1 --- server/gameserver/buff/callfunc.cc | 85 ++++++++++++++++++++++++++++++ server/gameserver/buff/callfunc.h | 4 ++ 2 files changed, 89 insertions(+) diff --git a/server/gameserver/buff/callfunc.cc b/server/gameserver/buff/callfunc.cc index 72459389..1ff8a587 100644 --- a/server/gameserver/buff/callfunc.cc +++ b/server/gameserver/buff/callfunc.cc @@ -172,6 +172,12 @@ void CallFuncBuff::Activate() { SummonCarSpecPoint(); } + break; + case BuffCallFunc_e::kRangeHoldBuff: + { + RangeHoldBuff(); + } + break; default: { } @@ -964,3 +970,82 @@ void CallFuncBuff::SummonCarSpecPoint() }, &owner->room->xtimer_attacher_); } + +void CallFuncBuff::RangeHoldBuff() +{ + struct InnerObject + { + CreatureWeakPtr c; + std::set buff_uniids; + + void OnEnter() + { + + } + + void OnLeave() + { + } + + }; + + auto context = A8_MAKE_ANON_STRUCT_SHARED + ( + std::map in_human_infos; + int keep_buff_uniid = 0; + ); + + auto on_enter = + [this, context] (Human* hum) + { + if (context->in_human_infos.find(hum->GetUniId()) != context->in_human_infos.end()) { + abort(); + } + //context->in_human_infos[hum->GetUniId()] = o; + //context->in_human_infos[hum->GetUniId()].OnEnter(); + }; + auto on_stay = + [this, context] (Human* hum) + { + }; + auto on_leave = + [this, context] (Human* hum) + { + auto itr = context->in_human_infos.find(hum->GetUniId()); + if (itr == context->in_human_infos.end()) { + abort(); + } + for (int buff_uniid : itr->second.buff_uniids) { + hum->RemoveBuffByUniId(buff_uniid); + } + itr->second.OnLeave(); + }; + auto check_cb = + [this, context, on_enter, on_stay, on_leave] + () + { + if (owner->HasBuffEffect(kBET_Fly) || + owner->HasBuffEffect(kBET_Jump)) { + return; + } + if (!owner->dead) { + + }; + }; + { + event_handlers_.push_back(owner->GetTrigger()->AddListener + ( + kDieEvent, + [this, context] (const a8::Args& args) mutable + { + if (context->keep_buff_uniid) { + owner->RemoveBuffByUniId(context->keep_buff_uniid); + context->keep_buff_uniid = 0; + } + } + )); + } + { + context->keep_buff_uniid = owner->TryAddBuff(GetCaster().Get(), meta->_int_buff_param4, skill_meta); + } +} diff --git a/server/gameserver/buff/callfunc.h b/server/gameserver/buff/callfunc.h index 1cf1f86a..f090fde9 100644 --- a/server/gameserver/buff/callfunc.h +++ b/server/gameserver/buff/callfunc.h @@ -29,6 +29,9 @@ A8_DECLARE_CLASS_ENUM(BuffCallFunc_e, int, kAddMaxHp = 29, kSummonCarSpecPoint = 30, kBossAnimi = 31, + kAntiHide = 32, + kDisableClientSkill = 33, + kRangeHoldBuff = 34, ); @@ -59,6 +62,7 @@ class CallFuncBuff : public Buff void ClearSummonObstacle(); void DecSkillCd(); void SummonCarSpecPoint(); + void RangeHoldBuff(); float hold_param2_ = 0.0; Weapon* hold_weapon_ = nullptr; From af44ab08ceb80ef9b716d12d33c095604ffe971a Mon Sep 17 00:00:00 2001 From: azw Date: Tue, 7 Nov 2023 01:59:10 +0000 Subject: [PATCH 04/11] 1 --- server/gameserver/buff/callfunc.cc | 6 ------ 1 file changed, 6 deletions(-) diff --git a/server/gameserver/buff/callfunc.cc b/server/gameserver/buff/callfunc.cc index 1ff8a587..0babbb1c 100644 --- a/server/gameserver/buff/callfunc.cc +++ b/server/gameserver/buff/callfunc.cc @@ -1001,8 +1001,6 @@ void CallFuncBuff::RangeHoldBuff() if (context->in_human_infos.find(hum->GetUniId()) != context->in_human_infos.end()) { abort(); } - //context->in_human_infos[hum->GetUniId()] = o; - //context->in_human_infos[hum->GetUniId()].OnEnter(); }; auto on_stay = [this, context] (Human* hum) @@ -1024,10 +1022,6 @@ void CallFuncBuff::RangeHoldBuff() [this, context, on_enter, on_stay, on_leave] () { - if (owner->HasBuffEffect(kBET_Fly) || - owner->HasBuffEffect(kBET_Jump)) { - return; - } if (!owner->dead) { }; From 2a5cf678eafedeb26c8dcc3901a6b89c4a8fdf1a Mon Sep 17 00:00:00 2001 From: azw Date: Tue, 7 Nov 2023 02:02:49 +0000 Subject: [PATCH 05/11] 1 --- server/gameserver/buff/callfunc.cc | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/server/gameserver/buff/callfunc.cc b/server/gameserver/buff/callfunc.cc index 0babbb1c..655466e3 100644 --- a/server/gameserver/buff/callfunc.cc +++ b/server/gameserver/buff/callfunc.cc @@ -973,6 +973,9 @@ void CallFuncBuff::SummonCarSpecPoint() void CallFuncBuff::RangeHoldBuff() { + if (owner->dead) { + return; + } struct InnerObject { CreatureWeakPtr c; @@ -992,7 +995,6 @@ void CallFuncBuff::RangeHoldBuff() auto context = A8_MAKE_ANON_STRUCT_SHARED ( std::map in_human_infos; - int keep_buff_uniid = 0; ); auto on_enter = @@ -1018,28 +1020,13 @@ void CallFuncBuff::RangeHoldBuff() } itr->second.OnLeave(); }; - auto check_cb = - [this, context, on_enter, on_stay, on_leave] - () - { - if (!owner->dead) { - - }; - }; { event_handlers_.push_back(owner->GetTrigger()->AddListener ( kDieEvent, [this, context] (const a8::Args& args) mutable { - if (context->keep_buff_uniid) { - owner->RemoveBuffByUniId(context->keep_buff_uniid); - context->keep_buff_uniid = 0; - } } )); } - { - context->keep_buff_uniid = owner->TryAddBuff(GetCaster().Get(), meta->_int_buff_param4, skill_meta); - } } From 426034fb59900dd9553782125df20c269fe1a3b1 Mon Sep 17 00:00:00 2001 From: azw Date: Tue, 7 Nov 2023 02:08:47 +0000 Subject: [PATCH 06/11] 1 --- server/gameserver/buff/callfunc.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/server/gameserver/buff/callfunc.cc b/server/gameserver/buff/callfunc.cc index 655466e3..60ce5493 100644 --- a/server/gameserver/buff/callfunc.cc +++ b/server/gameserver/buff/callfunc.cc @@ -1020,6 +1020,22 @@ void CallFuncBuff::RangeHoldBuff() } itr->second.OnLeave(); }; + auto check_cb = + [this, context, on_enter, on_stay, on_leave] + () + { + }; + owner->room->xtimer.SetIntervalWpEx + ( + SERVER_FRAME_RATE, + [this, context, on_enter, on_stay, on_leave, check_cb] + (int event, const a8::Args* args) mutable + { + if (a8::TIMER_EXEC_EVENT == event) { + check_cb(); + } + }, + &owner->xtimer_attacher); { event_handlers_.push_back(owner->GetTrigger()->AddListener ( From 022bdfe5b01dab54ccee05f049c4b6d1ac14ab29 Mon Sep 17 00:00:00 2001 From: azw Date: Tue, 7 Nov 2023 02:14:30 +0000 Subject: [PATCH 07/11] 1 --- server/gameserver/buff/callfunc.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server/gameserver/buff/callfunc.cc b/server/gameserver/buff/callfunc.cc index 60ce5493..c36c1674 100644 --- a/server/gameserver/buff/callfunc.cc +++ b/server/gameserver/buff/callfunc.cc @@ -1024,6 +1024,16 @@ void CallFuncBuff::RangeHoldBuff() [this, context, on_enter, on_stay, on_leave] () { + float range = meta->GetBuffParam2(this); + owner->room->TraverseAliveHumanList + ( + [this, range] (Human* hum) + { + if (Collision::CheckCC(owner, owner->GetRadius(), + hum, range)) { + } + return true; + }); }; owner->room->xtimer.SetIntervalWpEx ( From 6a46d2ce0d4a6ee9aaaaa140ac377f579b743262 Mon Sep 17 00:00:00 2001 From: azw Date: Tue, 7 Nov 2023 02:18:28 +0000 Subject: [PATCH 08/11] 1 --- server/gameserver/buff/callfunc.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/server/gameserver/buff/callfunc.cc b/server/gameserver/buff/callfunc.cc index c36c1674..bbc76887 100644 --- a/server/gameserver/buff/callfunc.cc +++ b/server/gameserver/buff/callfunc.cc @@ -1025,6 +1025,7 @@ void CallFuncBuff::RangeHoldBuff() () { float range = meta->GetBuffParam2(this); + std::vector hit_humans; owner->room->TraverseAliveHumanList ( [this, range] (Human* hum) @@ -1034,6 +1035,22 @@ void CallFuncBuff::RangeHoldBuff() } return true; }); + std::vector leave_humans; + for (auto& pair : context->in_human_infos) { + bool found = false; + #if 0 + for (int i = 0; i < size; ++i){ + if (hit_humans[i] == pair.second.c.Get()) { + found = true; + break; + } + } + #endif + if (!found) { + on_leave(pair.second.c.Get()->AsHuman()); + leave_humans.push_back(pair.second.c.Get()->AsHuman()); + } + } }; owner->room->xtimer.SetIntervalWpEx ( From 97c500ed87b215e2a57db792bee59262ae135acb Mon Sep 17 00:00:00 2001 From: azw Date: Tue, 7 Nov 2023 02:22:18 +0000 Subject: [PATCH 09/11] 1 --- server/gameserver/buff/callfunc.cc | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/server/gameserver/buff/callfunc.cc b/server/gameserver/buff/callfunc.cc index bbc76887..32098727 100644 --- a/server/gameserver/buff/callfunc.cc +++ b/server/gameserver/buff/callfunc.cc @@ -1025,7 +1025,7 @@ void CallFuncBuff::RangeHoldBuff() () { float range = meta->GetBuffParam2(this); - std::vector hit_humans; + std::set hit_humans; owner->room->TraverseAliveHumanList ( [this, range] (Human* hum) @@ -1037,16 +1037,7 @@ void CallFuncBuff::RangeHoldBuff() }); std::vector leave_humans; for (auto& pair : context->in_human_infos) { - bool found = false; - #if 0 - for (int i = 0; i < size; ++i){ - if (hit_humans[i] == pair.second.c.Get()) { - found = true; - break; - } - } - #endif - if (!found) { + if (hit_humans.find(pair.second.c.Get()) == hit_humans.end()) { on_leave(pair.second.c.Get()->AsHuman()); leave_humans.push_back(pair.second.c.Get()->AsHuman()); } From 2257b8fdcb7521b1dfbe2d30d7f3bce2e2a21a29 Mon Sep 17 00:00:00 2001 From: azw Date: Tue, 7 Nov 2023 02:45:17 +0000 Subject: [PATCH 10/11] 1 --- server/gameserver/buff/callfunc.cc | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/server/gameserver/buff/callfunc.cc b/server/gameserver/buff/callfunc.cc index 32098727..0f3c68c9 100644 --- a/server/gameserver/buff/callfunc.cc +++ b/server/gameserver/buff/callfunc.cc @@ -998,18 +998,23 @@ void CallFuncBuff::RangeHoldBuff() ); auto on_enter = - [this, context] (Human* hum) + [this, context] (Creature* hum) { if (context->in_human_infos.find(hum->GetUniId()) != context->in_human_infos.end()) { abort(); } + InnerObject o; + o.c = hum->GetWeakPtrRef(); + + context->in_human_infos[hum->GetUniId()] = o; + context->in_human_infos[hum->GetUniId()].OnEnter(); }; auto on_stay = - [this, context] (Human* hum) + [this, context] (Creature* hum) { }; auto on_leave = - [this, context] (Human* hum) + [this, context] (Creature* hum) { auto itr = context->in_human_infos.find(hum->GetUniId()); if (itr == context->in_human_infos.end()) { @@ -1042,6 +1047,18 @@ void CallFuncBuff::RangeHoldBuff() leave_humans.push_back(pair.second.c.Get()->AsHuman()); } } + for (Human* hum : leave_humans) { + context->in_human_infos.erase(hum->GetUniId()); + } + for (Creature* hum : hit_humans) { + if (context->in_human_infos.find(hum->GetUniId()) == + context->in_human_infos.end()) { + on_enter(hum); + on_stay(hum); + } else { + on_stay(hum); + } + } }; owner->room->xtimer.SetIntervalWpEx ( From 022d4c5e5c55b6e0aff51e318da1aab07a65874e Mon Sep 17 00:00:00 2001 From: azw Date: Tue, 7 Nov 2023 02:50:25 +0000 Subject: [PATCH 11/11] 1 --- server/gameserver/buff/callfunc.cc | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/server/gameserver/buff/callfunc.cc b/server/gameserver/buff/callfunc.cc index 0f3c68c9..19b1329d 100644 --- a/server/gameserver/buff/callfunc.cc +++ b/server/gameserver/buff/callfunc.cc @@ -979,7 +979,7 @@ void CallFuncBuff::RangeHoldBuff() struct InnerObject { CreatureWeakPtr c; - std::set buff_uniids; + std::vector buff_uniids; void OnEnter() { @@ -1006,6 +1006,16 @@ void CallFuncBuff::RangeHoldBuff() InnerObject o; o.c = hum->GetWeakPtrRef(); + if (owner->team_id == hum->team_id) { + for (int buff_id : meta->_buff_param3_int_list) { + o.buff_uniids.push_back(hum->TryAddBuff(GetCaster().Get(), buff_id, skill_meta)); + } + } else { + for (int buff_id : meta->_buff_param4_int_list) { + o.buff_uniids.push_back(hum->TryAddBuff(GetCaster().Get(), buff_id, skill_meta)); + } + } + context->in_human_infos[hum->GetUniId()] = o; context->in_human_infos[hum->GetUniId()].OnEnter(); }; @@ -1077,6 +1087,13 @@ void CallFuncBuff::RangeHoldBuff() kDieEvent, [this, context] (const a8::Args& args) mutable { + for (auto& pair : context->in_human_infos) { + for (int buff_uniid : pair.second.buff_uniids) { + if (pair.second.c.Get()) { + pair.second.c.Get()->RemoveBuffByUniId(buff_uniid); + } + } + } } )); }