cmd: disassebmle group

This commit is contained in:
Ilia Denisov
2025-12-25 21:32:19 +03:00
parent d0d5bc3c88
commit 6157c07a35
4 changed files with 194 additions and 19 deletions
+13 -5
View File
@@ -18,7 +18,7 @@ type UninhabitedPlanet struct {
UnidentifiedPlanet
Size float64 `json:"size"`
Name string `json:"name"`
Resources float64 `json:"resources"` // R - Ресурсы / сырьё
Resources float64 `json:"resources"` // R - Ресурсы
Capital float64 `json:"capital"` // CAP $ - Запасы промышленности
Material float64 `json:"material"` // MAT M - Запасы ресурсов / сырья
}
@@ -70,13 +70,21 @@ func (p *Planet) IncreaseMaterial() {
// Автоматическое увеличение населения на каждом ходу
func (p *Planet) IncreasePopulation() {
p.Population *= 1.08
var extraPopulation = p.Size - p.Population
if extraPopulation > 0 {
p.Colonists += extraPopulation / 8
p.Population -= extraPopulation
if p.Population > p.Size {
p.Colonists += (p.Population - p.Size) / 8
p.Population = p.Size
}
}
func UnloadColonists(p Planet, v float64) Planet {
p.Population += v * 8
if p.Population > p.Size {
p.Colonists += (p.Population - p.Size) / 8
p.Population = p.Size
}
return p
}
func (g Game) RenamePlanet(raceName string, planetNumber int, typeName string) error {
ri, err := g.raceIndex(raceName)
if err != nil {