From 194360aed822d80d604a5600ad39e417d0142095 Mon Sep 17 00:00:00 2001 From: azw Date: Tue, 7 Nov 2023 01:57:50 +0000 Subject: [PATCH] 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;