This commit is contained in:
aozhiwei 2019-07-25 14:56:40 +08:00
parent 48cf9c6c2a
commit e065184b05
4 changed files with 12 additions and 2 deletions

View File

@ -215,7 +215,7 @@ void AndroidAI::Shot(Human* enemy)
return;
}
if (((HumMaster()->room->frameno - HumMaster()->last_shot_frameno_) * (1000 / kSERVER_FRAME_RATE)) >=
HumMaster()->curr_weapon->meta->i->fire_rate()
HumMaster()->GetFireRate()
) {
a8::Vec2 shot_dir = enemy->pos - HumMaster()->pos;
if (std::abs(shot_dir.x) > FLT_EPSILON ||

View File

@ -1650,6 +1650,15 @@ float Human::BuffAttrRate(int buff_effect_id)
}
}
float Human::GetFireRate()
{
if (curr_weapon) {
return curr_weapon->meta->i->fire_rate() + ability.fire_rate;
} else {
return ability.fire_rate;
}
}
void Human::_UpdateMove(int speed)
{
for (int i = 0; i < speed; ++i) {

View File

@ -202,6 +202,7 @@ class Human : public Entity
void SendGameOver();
float BuffAttrAbs(int buff_effect_id);
float BuffAttrRate(int buff_effect_id);
float GetFireRate();
protected:
void _UpdateMove(int speed);

View File

@ -143,7 +143,7 @@ void Player::UpdateShot()
if (last_shot_frameno_ == 0 ||
(
(room->frameno - last_shot_frameno_) * (1000 / kSERVER_FRAME_RATE)) >=
curr_weapon->meta->i->fire_rate()
GetFireRate()
) {
Shot();
}