package koboldsim import ( "git.chromaticdragon.app/kistaro/CardSimEngine/cardsim" ) // KoboldMine is the state of a kobold mine. type KoboldMine struct { Kobolds cardsim.Stored[int64] SectorMiningIncome cardsim.Stored[float64] SectorScavengingIncome cardsim.Stored[float64] GovBureaucracyExpense cardsim.Stored[float64] GovWarExpense cardsim.Stored[float64] } func (k *KoboldMine) ProductivityFunc(s *cardsim.Stored[float64]) func() float64 { return func() float64 { return s.Value * float64(k.Kobolds.Value) } } func (k *KoboldMine) TotalSectorProductivity() float64 { return float64(k.Kobolds.Value) * (k.SectorMiningIncome.Value + k.SectorScavengingIncome.Value) } func (k *KoboldMine) TotalGovProductivity() float64 { return float64(k.Kobolds.Value) * (k.GovBureaucracyExpense.Value + k.GovWarExpense.Value) } func (k *KoboldMine) Stats() []cardsim.Stat { stats := cardsim.ExtractStats(k) funcs := []cardsim.Stat{ cardsim.StatFunc( "Total Sector Mining Income", k.ProductivityFunc(&k.SectorMiningIncome), ), cardsim.StatFunc( "Total Sector Scavenging Income", k.ProductivityFunc(&k.SectorScavengingIncome), ), cardsim.StatFunc( "Total Government Bureaucracy Expense", k.ProductivityFunc(&k.GovBureaucracyExpense), ), cardsim.StatFunc( "Total Government War Expense", k.ProductivityFunc(&k.GovWarExpense), ), cardsim.StatFunc( "Total Sector Income", k.TotalSectorProductivity, ), cardsim.StatFunc( "Total Government Expense", k.TotalGovProductivity, ), } stats = append(stats, funcs...) cardsim.SortStats(stats) return stats } func NewKoboldMine() *KoboldMine { return &KoboldMine{ Kobolds: cardsim.Stored[int64]{ Name: "Kobolds", Value: 1000, }, SectorMiningIncome: cardsim.Stored[float64]{ Name: "Sector Mining Income", Value: 0.15, }, SectorScavengingIncome: cardsim.Stored[float64]{ Name: "Sector Scavening Income", Value: 0.1, }, GovBureaucracyExpense: cardsim.Stored[float64]{ Name: "Government Bureaucracy Expense", Value: 0.05, }, GovWarExpense: cardsim.Stored[float64]{ Name: "Government War Expense", Value: 0.1, }, } }