diff --git a/server/gameserver/constant.h b/server/gameserver/constant.h index e2ce0cc..f7b37fd 100755 --- a/server/gameserver/constant.h +++ b/server/gameserver/constant.h @@ -166,6 +166,7 @@ enum HumanAttrType_e kHAT_FireRate = 9, kHAT_Volume = 10, kHAT_MaxHp = 11, + kHAT_ReloadTime = 14, kHAT_BulletAngle = 20, kHAT_End }; diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 8457009..1b9349a 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -829,7 +829,7 @@ void Human::AutoLoadingBullet(bool manual) on_loading_bullet(); } StartAction(AT_Reload, - p_weapon->meta->i->reload_time(), + p_weapon->GetAttrValue(kHAT_ReloadTime), p_weapon->weapon_id, p_weapon->weapon_idx); } @@ -848,6 +848,7 @@ void Human::StartAction(ActionType_e action_type, this->action_target_id == target_id) { return; } + action_duration = std::max(0, action_duration); this->action_type = action_type; this->action_frameno = room->GetFrameNo(); this->action_duration = action_duration; diff --git a/server/gameserver/types.cc b/server/gameserver/types.cc index 6065e3a..8e5f606 100644 --- a/server/gameserver/types.cc +++ b/server/gameserver/types.cc @@ -57,6 +57,12 @@ float Weapon::GetAttrValue(HumanAttrType_e attr_type) (upgrade_meta ? upgrade_meta->GetAttrValue(weapon_lv, attr_type) : 0); } break; + case kHAT_ReloadTime: + { + return meta->i->reload_time() - + (upgrade_meta ? upgrade_meta->GetAttrValue(weapon_lv, attr_type) : 0); + } + break; default: return 0; }