forked from alaingilbert/ogame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcrystalMine.go
29 lines (24 loc) · 931 Bytes
/
crystalMine.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package ogame
import "math"
type crystalMine struct {
BaseBuilding
}
func newCrystalMine() *crystalMine {
b := new(crystalMine)
b.Name = "crystal mine"
b.ID = CrystalMineID
b.IncreaseFactor = 1.6
b.BaseCost = Resources{Metal: 48, Crystal: 24}
return b
}
// EnergyConsumption returns the building energy consumption
func (b *crystalMine) EnergyConsumption(level int64) int64 {
return int64(math.Ceil(10 * float64(level) * math.Pow(1.1, float64(level))))
}
// Production returns the crystal production of the mine
func (b *crystalMine) Production(universeSpeed int64, productionRatio, globalRatio float64, plasmaTech, level int64) int64 {
basicIncome := 15.0
levelProduction := 20 * float64(universeSpeed) * (1 + float64(plasmaTech)*0.0066) * float64(level) * math.Pow(1.1, float64(level))
production := int64(levelProduction*productionRatio*globalRatio + (basicIncome * float64(universeSpeed)))
return production
}