This commit is contained in:
aozhiwei 2023-05-22 11:37:05 +08:00
parent 299d4da380
commit 9402eeef84
3 changed files with 13 additions and 13 deletions

View File

@ -55,19 +55,24 @@ bool Compose::CanAdd()
void Compose::IncNum()
{
++num_;
if (num_ % 3 == 0 && num_ <= 9) {
TakeOnWeapon(owner_->GetCurrWeapon());
}
}
void Compose::TakeOnWeapon(Weapon* weapon)
{
std::set<int>* buffs = mt::MergeItem::GetBuffs(weapon->meta->id(),
num_);
Clear();
auto merge_item_meta = mt::MergeItem::GetById(weapon->meta->id());
if (merge_item_meta) {
std::set<int>* buffs = merge_item_meta->GetBuffs(num_);
if (buffs) {
for (int buff_id : *buffs) {
hold_buffs_.push_back(owner_->TryAddBuff(owner_, buff_id, nullptr));
}
}
}
}
void Compose::Reset()
{

View File

@ -3,7 +3,6 @@
#include "mt/MergeItem.h"
IMPL_TABLE(mt::MergeItem)
std::map<int, std::set<int>> mt::MergeItem::gun_num_buff_hash_;
namespace mt
{
@ -12,7 +11,7 @@ namespace mt
{
}
std::set<int>* MergeItem::GetBuffs(int gun_id, int num)
std::set<int>* MergeItem::GetBuffs(int num)
{
return nullptr;
}

View File

@ -13,14 +13,10 @@ namespace mt
void Init1();
static std::set<int>* GetBuffs(int gun_id, int num);
std::set<int>* GetBuffs(int num);
private:
static std::map<int, std::set<int>> gun_num_buff_hash_;
std::set<int> _add_buff_list;
std::set<int> _remove_buff_list;
std::map<int, std::set<int>> gun_num_buff_hash_;
};
}