Converting cards to TablePolicy
This commit is contained in:
@@ -170,27 +170,43 @@ func NewKoboldMine() *KoboldMine {
|
||||
type FieldLabel string
|
||||
|
||||
const (
|
||||
Authoritarianism FieldLabel = "Authoritarianism"
|
||||
BasePopulation FieldLabel = "BasePopulation"
|
||||
Scavenging FieldLabel = "Scavenging"
|
||||
Militarism FieldLabel = "Militarism"
|
||||
Bureaucracy FieldLabel = "Bureaucracy"
|
||||
Construction FieldLabel = "Construction"
|
||||
Cruelty FieldLabel = "Cruelty"
|
||||
Education FieldLabel = "Education"
|
||||
FoodSupply FieldLabel = "FoodSupply"
|
||||
ForeignRelations FieldLabel = "ForeignRelations"
|
||||
Rebellion FieldLabel = "Rebellion"
|
||||
Gullibility FieldLabel = "Gullibility"
|
||||
Madness FieldLabel = "Madness"
|
||||
Cruelty FieldLabel = "Cruelty"
|
||||
Authoritarianism FieldLabel = "Authoritarianism"
|
||||
Manufacturing FieldLabel = "Manufacturing"
|
||||
Mining FieldLabel = "Mining"
|
||||
Militarism FieldLabel = "Militarism"
|
||||
Rebellion FieldLabel = "Rebellion"
|
||||
Scavenging FieldLabel = "Scavenging"
|
||||
Secrecy FieldLabel = "Secrecy"
|
||||
)
|
||||
|
||||
func (k *KoboldMine) Add(which FieldLabel, amount float64) error {
|
||||
switch which {
|
||||
case Authoritarianism:
|
||||
k.Authoritarianism += amount
|
||||
return nil
|
||||
case BasePopulation:
|
||||
k.BasePopulation += amount
|
||||
return nil
|
||||
case Scavenging:
|
||||
k.Scavenging += amount
|
||||
case Bureaucracy:
|
||||
k.Bureaucracy += amount
|
||||
return nil
|
||||
case Militarism:
|
||||
k.Militarism += amount
|
||||
case Construction:
|
||||
k.Construction += amount
|
||||
return nil
|
||||
case Cruelty:
|
||||
k.Cruelty += amount
|
||||
return nil
|
||||
case Education:
|
||||
k.Education += amount
|
||||
return nil
|
||||
case FoodSupply:
|
||||
k.FoodSupply += amount
|
||||
@@ -198,17 +214,29 @@ func (k *KoboldMine) Add(which FieldLabel, amount float64) error {
|
||||
case ForeignRelations:
|
||||
k.ForeignRelations += amount
|
||||
return nil
|
||||
case Rebellion:
|
||||
k.Rebellion += amount
|
||||
case Gullibility:
|
||||
k.Gullibility += amount
|
||||
return nil
|
||||
case Madness:
|
||||
k.Madness += amount
|
||||
return nil
|
||||
case Cruelty:
|
||||
k.Cruelty += amount
|
||||
case Manufacturing:
|
||||
k.Manufacturing += amount
|
||||
return nil
|
||||
case Authoritarianism:
|
||||
k.Authoritarianism += amount
|
||||
case Mining:
|
||||
k.Mining += amount
|
||||
return nil
|
||||
case Militarism:
|
||||
k.Militarism += amount
|
||||
return nil
|
||||
case Rebellion:
|
||||
k.Rebellion += amount
|
||||
return nil
|
||||
case Scavenging:
|
||||
k.Scavenging += amount
|
||||
return nil
|
||||
case Secrecy:
|
||||
k.Secrecy += amount
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("cannot add %f to %q: %w", amount, which, ErrNoFieldLabel)
|
||||
|
Reference in New Issue
Block a user