cmd: planet production
This commit is contained in:
+12
-15
@@ -43,26 +43,23 @@ type Fleet struct {
|
||||
ShipGroups []ShipGroup `json:"group"`
|
||||
}
|
||||
|
||||
// TODO: test on real values
|
||||
func (st ShipType) EmptyMass() float64 {
|
||||
shipMass := st.DriveMass() + st.ShieldsMass() + st.CargoMass() + st.WeaponsMass()
|
||||
shipMass := st.Drive + st.Shields + st.Cargo + st.WeaponsMass()
|
||||
return shipMass
|
||||
}
|
||||
|
||||
func (st ShipType) DriveMass() float64 {
|
||||
return st.Drive
|
||||
}
|
||||
|
||||
func (st ShipType) ShieldsMass() float64 {
|
||||
return st.Shields
|
||||
}
|
||||
|
||||
func (st ShipType) CargoMass() float64 {
|
||||
return st.Cargo
|
||||
}
|
||||
|
||||
func (st ShipType) WeaponsMass() float64 {
|
||||
return float64(st.Armament)*(st.Weapons/2) + st.Weapons/2
|
||||
if st.Armament == 0 || st.Weapons == 0 {
|
||||
return 0
|
||||
}
|
||||
return float64(st.Armament+1) * (st.Weapons / 2)
|
||||
}
|
||||
|
||||
// ProductionCost returns Material (MAT) and Population (POP) to produce this [ShipType]
|
||||
func (st ShipType) ProductionCost() (mat float64, pop float64) {
|
||||
mat = st.EmptyMass()
|
||||
pop = mat * 10
|
||||
return
|
||||
}
|
||||
|
||||
// Грузоподъёмность
|
||||
|
||||
Reference in New Issue
Block a user