Prototype for TablePolicy
This commit is contained in:
@@ -164,3 +164,50 @@ func NewKoboldMine() *KoboldMine {
|
||||
Secrecy: 95,
|
||||
}
|
||||
}
|
||||
|
||||
type FieldLabel string
|
||||
|
||||
const (
|
||||
BasePopulation FieldLabel = "BasePopulation"
|
||||
Scavenging FieldLabel = "Scavenging"
|
||||
Militarism FieldLabel = "Militarism"
|
||||
FoodSupply FieldLabel = "FoodSupply"
|
||||
ForeignRelations FieldLabel = "ForeignRelations"
|
||||
Rebellion FieldLabel = "Rebellion"
|
||||
Madness FieldLabel = "Madness"
|
||||
Cruelty FieldLabel = "Cruelty"
|
||||
Authoritarianism FieldLabel = "Authoritarianism"
|
||||
)
|
||||
|
||||
func (k *KoboldMine) Add(which FieldLabel, amount float64) error {
|
||||
switch(which) {
|
||||
case BasePopulation:
|
||||
k.BasePopulation += amount
|
||||
return nil
|
||||
case Scavenging:
|
||||
k.Scavenging += amount
|
||||
return nil
|
||||
case Militarism:
|
||||
k.Militarism += amount
|
||||
return nil
|
||||
case FoodSupply:
|
||||
k.FoodSupply += amount
|
||||
return nil
|
||||
case ForeignRelations:
|
||||
k.ForeignRelations += amount
|
||||
return nil
|
||||
case Rebellion:
|
||||
k.Rebellion += amount
|
||||
return nil
|
||||
case Madness:
|
||||
k.Madness += amount
|
||||
return nil
|
||||
case Cruelty:
|
||||
k.Cruelty += amount
|
||||
return nil
|
||||
case Authoritarianism:
|
||||
k.Authoritarianism += amount
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("cannot add %d to %q: %w", amount, which, ErrNoFieldLabel)
|
||||
}
|
||||
|
Reference in New Issue
Block a user