1
This commit is contained in:
parent
1d30de1f06
commit
c7f92ec486
@ -673,13 +673,17 @@ void Creature::RemoveBuffByEffectId(int buff_effect_id)
|
||||
|
||||
void Creature::ClearBuffList()
|
||||
{
|
||||
for (auto buff : buff_list_) {
|
||||
list_del_init(&buff->effect_entry);
|
||||
OnBuffRemove(*buff.get());
|
||||
if (room->IsDestorying()) {
|
||||
buff_list_.clear();
|
||||
} else {
|
||||
for (auto buff : buff_list_) {
|
||||
list_del_init(&buff->effect_entry);
|
||||
OnBuffRemove(*buff.get());
|
||||
}
|
||||
buff_list_.clear();
|
||||
buff_effect_ = {};
|
||||
RecalcBuffAttr();
|
||||
}
|
||||
buff_list_.clear();
|
||||
buff_effect_ = {};
|
||||
RecalcBuffAttr();
|
||||
}
|
||||
|
||||
void Creature::AddPassiveSkill(int skill_id)
|
||||
@ -3170,3 +3174,62 @@ Obstacle* Creature::InternalSummonObstacle(Buff* buff, const mt::MapThing* thing
|
||||
}
|
||||
return ob;
|
||||
}
|
||||
|
||||
bool Creature::CanShot(bool try_reload)
|
||||
{
|
||||
if (!GetCurrWeapon()->meta) {
|
||||
return false;
|
||||
}
|
||||
if (downed) {
|
||||
return false;
|
||||
}
|
||||
if (!GetCurrWeapon()->meta) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (HasBuffEffect(kBET_Jump) ||
|
||||
HasBuffEffect(kBET_Fly)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GetAbility()->GetSwitchTimes(kDisableShotTimes) > 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GetCurrWeapon()->weapon_idx != 0 &&
|
||||
GetCurrWeapon()->ammo <= 0) {
|
||||
if (try_reload) {
|
||||
CheckLoadingBullet();
|
||||
}
|
||||
//AutoLoadingBullet();
|
||||
return false;
|
||||
}
|
||||
if (action_type == AT_Reload) {
|
||||
return false;
|
||||
}
|
||||
if (action_type == AT_Reload ||
|
||||
action_type == AT_Rescue ||
|
||||
action_type == AT_UseItem ||
|
||||
action_type == AT_Relive) {
|
||||
if (try_reload) {
|
||||
CancelAction();
|
||||
}
|
||||
}
|
||||
|
||||
if (IsCar()) {
|
||||
if (room->GetFrameNo() - last_shot_frameno_ > 0) {
|
||||
if ((room->GetFrameNo() - last_shot_frameno_) * (1000 / SERVER_FRAME_RATE) <
|
||||
GetCurrWeapon()->GetFireRate(this)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ((room->GetFrameNo() - last_shot_frameno_) * (1000 / SERVER_FRAME_RATE) <
|
||||
GetCurrWeapon()->GetFireRate(this)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -347,6 +347,7 @@ class Creature : public MoveableEntity
|
||||
std::shared_ptr<std::set<int>> CalcReporterList(bool is_trace_bullet,
|
||||
const mt::Equip* weapon_meta,
|
||||
const mt::Equip* bullet_meta);
|
||||
bool CanShot(bool try_reload);
|
||||
|
||||
protected:
|
||||
virtual void OnBuffRemove(Buff& buff);
|
||||
|
Loading…
x
Reference in New Issue
Block a user