fix: production with free P.I.
This commit is contained in:
@@ -76,7 +76,7 @@ func (p Planet) Votes() float64 {
|
||||
return p.Population.F() / 1000.
|
||||
}
|
||||
|
||||
// Производственный потенциал
|
||||
// Производственный потенциал без учёта модернизации кораблей
|
||||
func (p Planet) ProductionCapacity() float64 {
|
||||
return PlanetProduction(p.Industry.F(), p.Population.F())
|
||||
}
|
||||
@@ -104,15 +104,14 @@ func ProducedMaterial(shipMass, progress float64) float64 {
|
||||
// [x] ind = (res * prod) / (5 * res + 1)
|
||||
// ind = 10 * 1000 / (5 * 10 + 1) = 10000 / 55 = 181.(81)
|
||||
// int = 10 * 500 / 55 = 5000 / 55
|
||||
func (p *Planet) ProduceIndustry() {
|
||||
production := p.ProductionCapacity()
|
||||
func (p *Planet) ProduceIndustry(freeProduction float64) {
|
||||
var ind float64
|
||||
if p.Material > 0 {
|
||||
ind = math.Min(production/5, p.Material.F())
|
||||
ind = math.Min(freeProduction/5, p.Material.F())
|
||||
p.Mat(p.Material.F() - ind)
|
||||
production -= ind * 5.
|
||||
freeProduction -= ind * 5.
|
||||
}
|
||||
ind += (production * p.Resources.F()) / (5.*p.Resources.F() + 1.)
|
||||
ind += (freeProduction * p.Resources.F()) / (5.*p.Resources.F() + 1.)
|
||||
p.Ind(p.Industry.F() + ind)
|
||||
if p.Industry > p.Population {
|
||||
p.Capital += p.Industry - p.Population
|
||||
@@ -121,8 +120,8 @@ func (p *Planet) ProduceIndustry() {
|
||||
}
|
||||
|
||||
// Производство материалов
|
||||
func (p *Planet) ProduceMaterial() {
|
||||
p.Material = p.Material.Add(p.ProductionCapacity() * p.Resources.F())
|
||||
func (p *Planet) ProduceMaterial(freeProduction float64) {
|
||||
p.Material = p.Material.Add(freeProduction * p.Resources.F())
|
||||
}
|
||||
|
||||
// Автоматическое увеличение населения на каждом ходу
|
||||
|
||||
Reference in New Issue
Block a user