cmd: planet production

This commit is contained in:
Ilia Denisov
2025-10-02 02:05:00 +03:00
parent 8a7e2f57c7
commit 0890bf3009
7 changed files with 160 additions and 19 deletions
+12 -15
View File
@@ -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
}
// Грузоподъёмность