Refactor, new menu, issue feature update

It's now possible to make issue options enabled or disabled conditional upon having taken other actions with that issue before.
This commit is contained in:
2023-04-04 13:22:43 -07:00
parent ccd141ddc5
commit e0dad09045
6 changed files with 169 additions and 211 deletions

View File

@@ -6,48 +6,59 @@ import (
// KoboldMine is the state of a kobold mine.
type KoboldMine struct {
Kobolds cardsim.Stored[int64]
Kobolds int64 `cardsim:"stat"`
MiningIncome cardsim.Stored[float64]
ScavengingIncome cardsim.Stored[float64]
AlchemyIncome cardsim.Stored[float64]
HospitalityIncome cardsim.Stored[float64]
AgricultureIncome cardsim.Stored[float64]
ManufacturingIncome cardsim.Stored[float64]
PlanarIncome cardsim.Stored[float64]
PublishingIncome cardsim.Stored[float64]
FinanceIncome cardsim.Stored[float64]
GadgetryIncome cardsim.Stored[float64]
FishingIncome cardsim.Stored[float64]
ConstructionIncome cardsim.Stored[float64]
MiningIncome float64 `cardsim:"stat" cardsim_name:"Mining Productivity"`
ScavengingIncome float64 `cardsim:"stat" cardsim_name:"Scavenging Productivity"`
AlchemyIncome float64 `cardsim:"stat" cardsim_name:"Alchemy Productivity"`
HospitalityIncome float64 `cardsim:"stat" cardsim_name:"Hospitality Productivity"`
AgricultureIncome float64 `cardsim:"stat" cardsim_name:"Agriculture Productivity"`
ManufacturingIncome float64 `cardsim:"stat" cardsim_name:"Manufacturing Productivity"`
PlanarIncome float64 `cardsim:"stat" cardsim_name:"Planar Productivity"`
PublishingIncome float64 `cardsim:"stat" cardsim_name:"Publishing Productivity"`
FinanceIncome float64 `cardsim:"stat" cardsim_name:"Finance Productivity"`
GadgetryIncome float64 `cardsim:"stat" cardsim_name:"Gadgetry Productivity"`
FishingIncome float64 `cardsim:"stat" cardsim_name:"Fishing Productivity"`
ConstructionIncome float64 `cardsim:"stat" cardsim_name:"Construction Productivity"`
BureaucracyExpense cardsim.Stored[float64]
WarExpense cardsim.Stored[float64]
QoLExpense cardsim.Stored[float64]
LogisticsExpense cardsim.Stored[float64]
DragonSubsExpense cardsim.Stored[float64]
ResearchSubsExpense cardsim.Stored[float64]
EducationExpense cardsim.Stored[float64]
HealthcareExpense cardsim.Stored[float64]
ForeignRelExpense cardsim.Stored[float64]
PoliceExpense cardsim.Stored[float64]
EconPlanExpense cardsim.Stored[float64]
ParksExpense cardsim.Stored[float64]
FaithExpense cardsim.Stored[float64]
BureaucracyExpense float64 `cardsim:"stat" cardsim_name:"Bureaucracy Investment"`
WarExpense float64 `cardsim:"stat" cardsim_name:"War Investment"`
QoLExpense float64 `cardsim:"stat" cardsim_name:"QoL Investment"`
LogisticsExpense float64 `cardsim:"stat" cardsim_name:"Logistics Investment"`
DragonSubsExpense float64 `cardsim:"stat" cardsim_name:"Dragon Subsidies Investment"`
ResearchSubsExpense float64 `cardsim:"stat" cardsim_name:"Research Subsidies Investment"`
EducationExpense float64 `cardsim:"stat" cardsim_name:"Education Investment"`
HealthcareExpense float64 `cardsim:"stat" cardsim_name:"Healthcare Investment"`
ForeignRelExpense float64 `cardsim:"stat" cardsim_name:"Foreign Relations Investment"`
PoliceExpense float64 `cardsim:"stat" cardsim_name:"Law Enforcement Investment"`
EconPlanExpense float64 `cardsim:"stat" cardsim_name:"Economic Planning Investment"`
ParksExpense float64 `cardsim:"stat" cardsim_name:"Parks and Aesthetics Investment"`
FaithExpense float64 `cardsim:"stat" cardsim_name:"Faith Investment"`
// AnotherExpense float64 `cardsim:"hiddenround5"`
// A different way of adding stats that is slightly more empowering.
}
func (k *KoboldMine) ProductivityFunc(s *cardsim.Stored[float64]) func() float64 {
func (k *KoboldMine) ProductivityFunc(s *float64) func() float64 {
return func() float64 {
return s.Value * float64(k.Kobolds.Value)
return *s * float64(k.Kobolds)
}
}
func (k *KoboldMine) TotalSectorIncome() float64 {
return float64(k.Kobolds.Value) * (k.MiningIncome.Value + k.ScavengingIncome.Value + k.AlchemyIncome.Value + k.HospitalityIncome.Value + k.AgricultureIncome.Value + k.ManufacturingIncome.Value + k.PlanarIncome.Value + k.PublishingIncome.Value + k.FinanceIncome.Value + k.GadgetryIncome.Value + k.FishingIncome.Value + k.ConstructionIncome.Value)
return float64(k.Kobolds) * (k.MiningIncome + k.ScavengingIncome + k.AlchemyIncome + k.HospitalityIncome + k.AgricultureIncome + k.ManufacturingIncome + k.PlanarIncome + k.PublishingIncome + k.FinanceIncome + k.GadgetryIncome + k.FishingIncome + k.ConstructionIncome)
}
func (k *KoboldMine) TotalGovExpense() float64 {
return float64(k.Kobolds.Value) * (k.BureaucracyExpense.Value + k.WarExpense.Value + k.QoLExpense.Value + k.LogisticsExpense.Value + k.DragonSubsExpense.Value + k.ResearchSubsExpense.Value + k.EducationExpense.Value + k.HealthcareExpense.Value + k.ForeignRelExpense.Value + k.PoliceExpense.Value + k.EconPlanExpense.Value + k.ParksExpense.Value + k.FaithExpense.Value)
return float64(k.Kobolds) * (k.BureaucracyExpense + k.WarExpense + k.QoLExpense + k.LogisticsExpense + k.DragonSubsExpense + k.ResearchSubsExpense + k.EducationExpense + k.HealthcareExpense + k.ForeignRelExpense + k.PoliceExpense + k.EconPlanExpense + k.ParksExpense + k.FaithExpense)
}
func (k *KoboldMine) Taxation() float64 {
return (k.TotalGovExpense() / (k.TotalSectorIncome() + k.TotalGovExpense())) * 100
}
func (k *KoboldMine) StatTaxRate() float64 {
return k.Taxation()
}
func (k *KoboldMine) Stats() []cardsim.Stat {
@@ -169,109 +180,31 @@ func (k *KoboldMine) Stats() []cardsim.Stat {
func NewKoboldMine() *KoboldMine {
return &KoboldMine{
Kobolds: cardsim.Stored[int64]{
Name: "Kobolds",
Value: 1000,
},
MiningIncome: cardsim.Stored[float64]{
Name: "Mining Productivity",
Value: 0.15,
},
ScavengingIncome: cardsim.Stored[float64]{
Name: "Scavenging Productivity",
Value: 0.1,
},
AlchemyIncome: cardsim.Stored[float64]{
Name: "Alchemy Productivity",
Value: 0.01,
},
HospitalityIncome: cardsim.Stored[float64]{
Name: "Hospitality Productivity",
Value: 0.0,
},
AgricultureIncome: cardsim.Stored[float64]{
Name: "Agricultural Productivity",
Value: 0.0,
},
ManufacturingIncome: cardsim.Stored[float64]{
Name: "Manufacturing Productivity",
Value: 0.10,
},
PlanarIncome: cardsim.Stored[float64]{
Name: "Planar Harvesting Productivity",
Value: 0.00,
},
PublishingIncome: cardsim.Stored[float64]{
Name: "Book Publishing Productivity",
Value: 0.02,
},
FinanceIncome: cardsim.Stored[float64]{
Name: "Finance Productivity",
Value: 0.02,
},
GadgetryIncome: cardsim.Stored[float64]{
Name: "Gadgetry Productivity",
Value: 0.03,
},
FishingIncome: cardsim.Stored[float64]{
Name: "Fishing Productivity",
Value: 0.0,
},
ConstructionIncome: cardsim.Stored[float64]{
Name: "Construction Productivity",
Value: 0.05,
},
BureaucracyExpense: cardsim.Stored[float64]{
Name: "Bureaucracy Investment",
Value: 0.05,
},
WarExpense: cardsim.Stored[float64]{
Name: "War Investment",
Value: 0.1,
},
QoLExpense: cardsim.Stored[float64]{
Name: "QoL Investment",
Value: 0.01,
},
LogisticsExpense: cardsim.Stored[float64]{
Name: "Logistics Investment",
Value: 0.02,
},
DragonSubsExpense: cardsim.Stored[float64]{
Name: "Dragon Subsidies Investment",
Value: 0.0,
},
ResearchSubsExpense: cardsim.Stored[float64]{
Name: "Research Subsidies Investment",
Value: 0.0,
},
EducationExpense: cardsim.Stored[float64]{
Name: "Education Investment",
Value: 0.01,
},
HealthcareExpense: cardsim.Stored[float64]{
Name: "Healthcare Investment",
Value: 0.01,
},
ForeignRelExpense: cardsim.Stored[float64]{
Name: "Foreign Relations Investment",
Value: 0.0,
},
PoliceExpense: cardsim.Stored[float64]{
Name: "Law Enforcement Investment",
Value: 0.03,
},
EconPlanExpense: cardsim.Stored[float64]{
Name: "Economic Planning Investment",
Value: 0.02,
},
ParksExpense: cardsim.Stored[float64]{
Name: "Parks and Aesthetics Investment",
Value: 0.0,
},
FaithExpense: cardsim.Stored[float64]{
Name: "Faith Investment",
Value: 0.03,
},
Kobolds: 1000,
MiningIncome: 0.15,
ScavengingIncome: 0.1,
AlchemyIncome: 0.01,
HospitalityIncome: 0.0,
AgricultureIncome: 0.0,
ManufacturingIncome: 0.10,
PlanarIncome: 0.00,
PublishingIncome: 0.02,
FinanceIncome: 0.02,
GadgetryIncome: 0.03,
FishingIncome: 0.0,
ConstructionIncome: 0.05,
BureaucracyExpense: 0.05,
WarExpense: 0.1,
QoLExpense: 0.01,
LogisticsExpense: 0.02,
DragonSubsExpense: 0.0,
ResearchSubsExpense: 0.0,
EducationExpense: 0.01,
HealthcareExpense: 0.01,
ForeignRelExpense: 0.0,
PoliceExpense: 0.03,
EconPlanExpense: 0.02,
ParksExpense: 0.0,
FaithExpense: 0.03,
}
}