refactor: planet industry production
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package game
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
@@ -42,8 +44,8 @@ func (st ShipType) DriveBlockMass() float64 {
|
||||
}
|
||||
|
||||
func (st ShipType) WeaponsBlockMass() float64 {
|
||||
if st.Armament == 0 || st.Weapons == 0 {
|
||||
return 0
|
||||
if (st.Armament == 0 && st.Weapons != 0) || (st.Armament != 0 && st.Weapons == 0) {
|
||||
panic(fmt.Sprintf("ship class invalid design: A=%d W=%.03f", st.Armament, st.Weapons))
|
||||
}
|
||||
return float64(st.Armament+1) * (st.Weapons.F() / 2)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user