This commit is contained in:
aozhiwei 2024-01-17 11:57:43 +08:00
parent 2d597fc5b8
commit 3048b8a193
2 changed files with 4 additions and 5 deletions

View File

@ -1557,9 +1557,6 @@ behaviac::EBTStatus HeroAgent::ThrowItem(int slot)
bomb_dir, bomb_dir,
fly_distance, fly_distance,
0); 0);
if (owner_->IsHuman()) {
owner_->AsHuman()->stats->IncWeaponUseTimes(weapon.meta->id(), 1);
}
last_throw_item_frameno_ = owner_->room->GetFrameNo(); last_throw_item_frameno_ = owner_->room->GetFrameNo();
return behaviac::BT_SUCCESS; return behaviac::BT_SUCCESS;
} }

View File

@ -2551,7 +2551,7 @@ void SyncObject::FillSMSyncPosition(cs::SMSyncPosition& sync_msg)
} }
int Creature::Throw(int slot, const glm::vec3& bomb_pos, const glm::vec3& bomb_dir, int Creature::Throw(int slot, const glm::vec3& bomb_pos, const glm::vec3& bomb_dir,
float fly_distance, int estimated_time) float fly_distance, int estimated_time)
{ {
if (!IsHuman()) { if (!IsHuman()) {
return 0; return 0;
@ -2559,11 +2559,13 @@ int Creature::Throw(int slot, const glm::vec3& bomb_pos, const glm::vec3& bomb_d
if (slot < 0 || slot >= weapons.size()) { if (slot < 0 || slot >= weapons.size()) {
return 0; return 0;
} }
Weapon& weapon = weapons.at(slot); Weapon& weapon = weapons.at(slot);
if (weapon.weapon_idx != 0 && if (weapon.weapon_idx != 0 &&
weapon.meta && weapon.meta &&
weapon.ammo > 0) { weapon.ammo > 0) {
if (IsHuman()) {
AsHuman()->stats->IncWeaponUseTimes(weapon.meta->id(), 1);
}
if (HasBuffEffect(kBET_Hide)) { if (HasBuffEffect(kBET_Hide)) {
RemoveHideEffect(kShotReason); RemoveHideEffect(kShotReason);
} }