完成变身逻辑

This commit is contained in:
aozhiwei 2021-04-28 14:49:00 +08:00
parent 6aeda0b548
commit b8c76dc6af
6 changed files with 30 additions and 12 deletions

View File

@ -169,6 +169,11 @@ bool Buff::NeedSync(Human* hum)
return !meta->i->only_server() || !(meta->i->only_self() && owner == hum); return !meta->i->only_server() || !(meta->i->only_self() && owner == hum);
} }
bool Buff::FreezeOperate()
{
return meta->i->buff_effect() == kBET_Become && !hold_weapons_.empty();
}
void Buff::ProcBecome(Creature* caster) void Buff::ProcBecome(Creature* caster)
{ {
if (caster->IsHuman() && meta->param2 > 0.01) { if (caster->IsHuman() && meta->param2 > 0.01) {

View File

@ -31,6 +31,7 @@ class Buff
int GetLastingTime(); int GetLastingTime();
bool NeedSync(Human* hum); bool NeedSync(Human* hum);
void FillMFBuff(cs::MFBuff* buff_pb); void FillMFBuff(cs::MFBuff* buff_pb);
bool FreezeOperate();
void ProcDelayAddBuff(Creature* caster); void ProcDelayAddBuff(Creature* caster);
void ProcIntervalAddBuff(Creature* caster); void ProcIntervalAddBuff(Creature* caster);

View File

@ -1537,3 +1537,9 @@ void Creature::SummonHero(const a8::Vec2& pos,
} }
} }
} }
bool Creature::FreezeOperate()
{
Buff* buff = GetBuffByEffectId(kBET_Become);
return buff && !buff->FreezeOperate();
}

View File

@ -145,6 +145,7 @@ class Creature : public MoveableEntity
void SetCurrWeapon(Weapon* weapon); void SetCurrWeapon(Weapon* weapon);
void ResetAllSkillCd(); void ResetAllSkillCd();
void UpdateSkill(); void UpdateSkill();
bool FreezeOperate();
private: private:

View File

@ -2290,7 +2290,9 @@ void Human::DeadDrop()
#endif #endif
}; };
if (GetRace() == kHumanRace && !HasBuffEffect(kBET_Terminator)) { if (GetRace() == kHumanRace &&
!HasBuffEffect(kBET_Terminator) &&
!(HasBuffEffect(kBET_Become) && GetBuffByEffectId(kBET_Become)->FreezeOperate())) {
for (auto& weapon : weapons) { for (auto& weapon : weapons) {
if (weapon.weapon_id != 0 && weapon.weapon_id != default_weapon.weapon_id) { if (weapon.weapon_id != 0 && weapon.weapon_id != default_weapon.weapon_id) {
a8::Vec2 drop_pos = GetPos(); a8::Vec2 drop_pos = GetPos();

View File

@ -218,6 +218,7 @@ void Player::UpdateShot()
void Player::UpdateSelectWeapon() void Player::UpdateSelectWeapon()
{ {
if (!FreezeOperate()) {
if (selected_weapon_idx >= 0 && selected_weapon_idx < weapons.size()) { if (selected_weapon_idx >= 0 && selected_weapon_idx < weapons.size()) {
Weapon* old_weapon = GetCurrWeapon(); Weapon* old_weapon = GetCurrWeapon();
Weapon* weapon = &weapons[selected_weapon_idx]; Weapon* weapon = &weapons[selected_weapon_idx];
@ -231,6 +232,7 @@ void Player::UpdateSelectWeapon()
} }
} }
} }
}
select_weapon = false; select_weapon = false;
selected_weapon_idx = 0; selected_weapon_idx = 0;
if (HasBuffEffect(kBET_Camouflage)) { if (HasBuffEffect(kBET_Camouflage)) {
@ -1119,7 +1121,8 @@ void Player::UpdateDropWeapon()
{ {
if (drop_weapon_idx >= 0 && if (drop_weapon_idx >= 0 &&
drop_weapon_idx < weapons.size() && drop_weapon_idx < weapons.size() &&
!HasBuffEffect(kBET_Terminator)) { !HasBuffEffect(kBET_Terminator) &&
!FreezeOperate()) {
bool drop_ok = false; bool drop_ok = false;
Weapon* weapon = &weapons[drop_weapon_idx]; Weapon* weapon = &weapons[drop_weapon_idx];
int weapon_id = weapon->weapon_id; int weapon_id = weapon->weapon_id;