This commit is contained in:
aozhiwei 2023-02-20 13:51:46 +08:00
parent 651e5c38f4
commit 67a954d0db
3 changed files with 9 additions and 1 deletions

View File

@ -1601,6 +1601,7 @@ void Creature::SetCurrWeapon(Weapon* weapon)
room->xtimer.Delete(auto_switch_weapon_timer_); room->xtimer.Delete(auto_switch_weapon_timer_);
} }
if (curr_weapon_ != weapon) { if (curr_weapon_ != weapon) {
GetCurrWeapon()->CalcGraspBuffList(this);
GetTrigger()->TakeonWeapon(curr_weapon_, weapon); GetTrigger()->TakeonWeapon(curr_weapon_, weapon);
} }
curr_weapon_ = weapon; curr_weapon_ = weapon;

View File

@ -15,6 +15,7 @@ void Weapon::Clear()
meta = nullptr; meta = nullptr;
bullet_meta = nullptr; bullet_meta = nullptr;
skill_meta = nullptr; skill_meta = nullptr;
grasp_buff_list.clear();
} }
void Weapon::Recalc() void Weapon::Recalc()
@ -48,3 +49,8 @@ int Weapon::GetReloadTime(Creature* c)
return meta ? meta->reload_time() :0; return meta ? meta->reload_time() :0;
} }
} }
void Weapon::CalcGraspBuffList(Creature* c)
{
grasp_buff_list.clear();
}

View File

@ -17,7 +17,7 @@ class Weapon
const mt::Equip* meta = nullptr; const mt::Equip* meta = nullptr;
const mt::Equip* bullet_meta = nullptr; const mt::Equip* bullet_meta = nullptr;
const mt::Skill* skill_meta = nullptr; const mt::Skill* skill_meta = nullptr;
std::vector<mt::Grasp*> grasp_list; std::vector<const mt::GraspBuff*> grasp_buff_list;
void Clear(); void Clear();
void ToPB(Creature* c, cs::MFWeapon* pb_obj); void ToPB(Creature* c, cs::MFWeapon* pb_obj);
@ -25,6 +25,7 @@ class Weapon
int GetClipVolume(Creature* c); int GetClipVolume(Creature* c);
int GetFireRate(Creature* c); int GetFireRate(Creature* c);
int GetReloadTime(Creature* c); int GetReloadTime(Creature* c);
void CalcGraspBuffList(Creature* c);
friend class PBUtils; friend class PBUtils;
}; };