From fe8ac7eeacbb573dc4cb74e4b4ae52d18e4f85c8 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sat, 4 Mar 2023 18:01:52 +0800 Subject: [PATCH] 1 --- server/gameserver/buff/mark_tag.cc | 17 ++++++++ server/gameserver/creature.cc | 67 ++++++++++++++++++++++++++++++ server/gameserver/creature.h | 5 +++ 3 files changed, 89 insertions(+) diff --git a/server/gameserver/buff/mark_tag.cc b/server/gameserver/buff/mark_tag.cc index 85e1031b..a9f3b078 100644 --- a/server/gameserver/buff/mark_tag.cc +++ b/server/gameserver/buff/mark_tag.cc @@ -10,6 +10,23 @@ void MarkTagBuff::Activate() { + switch (meta->_int_buff_param1) { + case 1: + { + owner->SetBuffTag(meta->_int_buff_param2, meta->_int_buff_param3); + } + break; + case 2: + { + owner->IncBuffTag(meta->_int_buff_param2, meta->_int_buff_param3); + } + break; + case 3: + { + owner->UnSetBuffTag(meta->_int_buff_param2); + } + break; + } } void MarkTagBuff::Deactivate() diff --git a/server/gameserver/creature.cc b/server/gameserver/creature.cc index dc0ef121..3abb2ce3 100644 --- a/server/gameserver/creature.cc +++ b/server/gameserver/creature.cc @@ -171,6 +171,47 @@ int Creature::AddBuff(Creature* caster, return 0; } } + if (buff_meta->buff_effect() == kBET_CondTag) { + switch (buff_meta->_int_buff_param1) { + case 1: + { + if (!(GetBuffTag(buff_meta->_int_buff_param2) > + buff_meta->_int_buff_param3)) { + return 0; + } + } + break; + case 2: + { + if (!(GetBuffTag(buff_meta->_int_buff_param2) < + buff_meta->_int_buff_param3)) { + return 0; + } + } + break; + case 3: + { + if (!(GetBuffTag(buff_meta->_int_buff_param2) == + buff_meta->_int_buff_param3)) { + return 0; + } + } + break; + case 4: + { + if (!(GetBuffTag(buff_meta->_int_buff_param2) != + buff_meta->_int_buff_param3)) { + return 0; + } + } + break; + default: + { + return 0; + } + break; + } + } if (buff_meta->no_immune()) { no_check_immune = 1; } @@ -2818,3 +2859,29 @@ void Creature::RemoveSkillObstacle(const mt::Skill* skill_meta) ob.Get()->Destory(); } } + +void Creature::SetBuffTag(int tag, int val) +{ + buff_tags_[tag] = val; +} + +int Creature::GetBuffTag(int tag) +{ + auto itr = buff_tags_.find(tag); + return itr != buff_tags_.end() ? itr->second : 0; +} + +void Creature::IncBuffTag(int tag, int val) +{ + auto itr = buff_tags_.find(tag); + if (itr != buff_tags_.end()) { + itr->second += val; + } else { + buff_tags_[tag] = val; + } +} + +void Creature::UnSetBuffTag(int tag) +{ + buff_tags_.erase(tag); +} diff --git a/server/gameserver/creature.h b/server/gameserver/creature.h index d7424c76..2808112a 100644 --- a/server/gameserver/creature.h +++ b/server/gameserver/creature.h @@ -321,6 +321,10 @@ class Creature : public MoveableEntity void MarkSyncActivePlayer(const char* file, int line, const char* func); void CheckBulletHitHoldShield(IBullet* bullet, bool& eat); void RemoveSkillObstacle(const mt::Skill* skill_meta); + void SetBuffTag(int tag, int val); + int GetBuffTag(int tag); + void IncBuffTag(int tag, int val); + void UnSetBuffTag(int tag); protected: virtual void OnBuffRemove(Buff& buff); @@ -388,6 +392,7 @@ private: a8::XTimerWp auto_switch_weapon_timer_; a8::XTimerWp reload_delay_timer_; int follow_times_ = 0; + std::map buff_tags_; int disable_move_dir_times_ = 0; int disable_attack_dir_times_ = 0;