Skip to content

Commit

Permalink
Fix #903: Allow 0 shots + 1 (or more) in chamber
Browse files Browse the repository at this point in the history
  • Loading branch information
richardwilkes committed Nov 24, 2024
1 parent 3c27ddb commit bf0799d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions model/gurps/weapon_shots.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ func (ws WeaponShots) String() string {
if ws.Thrown {
buffer.WriteByte('T')
} else {
if ws.Count <= 0 {
if ws.Count <= 0 && ws.InChamber <= 0 {
return ""
}
buffer.WriteString(ws.Count.String())
buffer.WriteString(ws.Count.Max(0).String())
if ws.InChamber > 0 {
buffer.WriteByte('+')
buffer.WriteString(ws.InChamber.String())
Expand Down Expand Up @@ -203,12 +203,11 @@ func (ws *WeaponShots) Validate() {
return
}
ws.Count = ws.Count.Max(0)
if ws.Count == 0 {
ws.InChamber = 0
ws.InChamber = ws.InChamber.Max(0)
if ws.Count == 0 && ws.InChamber == 0 {
ws.Duration = 0
ws.ReloadTime = 0
return
}
ws.InChamber = ws.InChamber.Max(0)
ws.Duration = ws.Duration.Max(0)
}

0 comments on commit bf0799d

Please sign in to comment.