Skip to content

Commit

Permalink
残弾がマガジンサイズ以下のときのリロードバグ修正
Browse files Browse the repository at this point in the history
  • Loading branch information
meyason committed Oct 19, 2024
1 parent 5db92f0 commit fb3e10d
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,13 @@ public boolean startReload(int reloadTime, Player player) throws UserNotFoundExc

public void finishReload(Player player) throws UserNotFoundException, AmmoNotFoundException {
this.isReloading = false;
connector.setAmmoFromUserId(player, gun.getType(), getInventoryAmmo(player) + magazineAmmo);
if(this.inventoryAmmo <= gun.getMagazineSize()){
this.magazineAmmo = (int) this.inventoryAmmo;
long nowAllAmmo = getInventoryAmmo(player) + (long)magazineAmmo;
connector.setAmmoFromUserId(player, gun.getType(), nowAllAmmo);
if(nowAllAmmo <= gun.getMagazineSize()){
this.magazineAmmo = (int) nowAllAmmo;
setInventoryAmmo(player, 0);
} else {
setInventoryAmmo(player, this.inventoryAmmo - (gun.getMagazineSize() - magazineAmmo));
setInventoryAmmo(player, nowAllAmmo - (long)(gun.getMagazineSize()));
this.magazineAmmo = gun.getMagazineSize();
}
}
Expand Down

0 comments on commit fb3e10d

Please sign in to comment.