From a7fc32cd265e4027b471db7a0b8bcc6ffcb0e355 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 7 Aug 2020 10:49:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8D=A2=E5=BC=B9=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/gameserver/constant.h | 1 + server/gameserver/human.cc | 3 ++- server/gameserver/types.cc | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) 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; }