This commit is contained in:
aozhiwei 2021-05-06 15:11:29 +08:00
parent 73490d8119
commit b52a2f4778
2 changed files with 14 additions and 4 deletions

View File

@ -177,6 +177,7 @@ bool Buff::FreezeOperate()
void Buff::ProcBecome(Creature* caster)
{
hold_curr_weapon_idx_ = caster->GetCurrWeapon()->weapon_idx;
if (caster->IsHuman() && meta->param2 > 0.01) {
std::vector<std::string> strings;
a8::Split(meta->i->buff_param2(), strings, ':');
@ -216,6 +217,7 @@ void Buff::ProcRemoveBecome(Creature* caster)
void Buff::ProcDriver(Creature* caster)
{
hold_curr_weapon_idx_ = caster->GetCurrWeapon()->weapon_idx;
if (caster->IsHuman()) {
Human* hum = (Human*)caster;
if (hum->GetCar() && hum->GetCar()->GetCurrWeapon()) {
@ -244,10 +246,17 @@ void Buff::RecoverHoldWeapons(Creature* caster)
caster->weapons[weapon.weapon_idx] = weapon;
}
}
if (!hold_weapons_.empty()) {
Weapon* next_weapon = caster->AutoChgWeapon();
if (next_weapon) {
caster->SetCurrWeapon(next_weapon);
if (hold_curr_weapon_idx_ >=0 &&
hold_curr_weapon_idx_ <= caster->weapons.size() &&
caster->weapons[hold_curr_weapon_idx_].weapon_id != 0) {
Weapon* next_weapon = &caster->weapons[hold_curr_weapon_idx_];
caster->SetCurrWeapon(next_weapon);
} else {
if (!hold_weapons_.empty()) {
Weapon* next_weapon = caster->AutoChgWeapon();
if (next_weapon) {
caster->SetCurrWeapon(next_weapon);
}
}
}
hold_weapons_.clear();

View File

@ -49,5 +49,6 @@ private:
void RecoverHoldWeapons(Creature* caster);
private:
int hold_curr_weapon_idx_ = 0;
std::list<Weapon> hold_weapons_;
};