towards generation

This commit is contained in:
Ilia Denisov
2023-08-08 21:57:53 +03:00
parent d95ecbc20c
commit ffecb5d90c
9 changed files with 193 additions and 96 deletions
+100
View File
@@ -0,0 +1,100 @@
package game
type GameIdentifier string
type RaceIdentifier string
type Game struct {
Id GameIdentifier
Name string
Schedule string // TODO: implement somehow
Turn uint
Races []Race
Planets []Planet
WarState map[RaceIdentifier]RaceIdentifier
}
type Race struct {
Id RaceIdentifier
Name string
Drive float64
Weapons float64
Shields float64
Cargo float64
}
type PlanetProduction string
const (
ProductionMaterial PlanetProduction = "MAT"
ProductionCapital PlanetProduction = "CAP"
ProductionDrive PlanetProduction = "DRIVE"
ProductionWeapons PlanetProduction = "WEAPONS"
ProductionShields PlanetProduction = "SHIELDS"
ProductionCargo PlanetProduction = "CARGO"
ProductionScience PlanetProduction = "SCIENCE"
ProductionShip PlanetProduction = "SHIP"
)
type ProductionType struct {
Production PlanetProduction
SubjectName string
}
type Planet struct {
Number uint
Name string
Position Coordinate
Size float64
Owner RaceIdentifier
Production ProductionType
Resources float64 // Сырьё
Industry float64 // Промышленность
Population float64 // Население
Capital float64 // CAP $ - Запасы промышленности
Material float64 // MAT M - Запасы сырья
Colonists float64 // COL C - Количество колонистов
// Параметр "L" означает количество свободных производственных единиц.
}
func (p *Planet) setOwner(id RaceIdentifier) {
p.Owner = id
}
type Coordinate struct {
X, Y float64
}
type Science struct {
Name string
Drive float64
Weapons float64
Shields float64
Cargo float64
}
type ShipType struct {
Name string
Drive float64 // [0], [1...]
Armament uint
Weapons float64 // [0], [1...]
Shields float64 // [0], [1...]
Cargo float64 // [0], [1...]
}
type ShipGroup struct {
Type ShipType
Number uint
State string // TODO: kinda enum: In_Orbit, In_Space, Transfer_State, Upgrade
Load float64 // Cargo loaded - "Масса груза"
Drive float64
Weapons float64
Shields float64
Cargo float64
}
type Fleet struct {
ShipGroups []ShipGroup
}