pushing current
This commit is contained in:
@@ -35,6 +35,7 @@ type Balance struct {
|
||||
AttackRange float64 `yaml:"attackRange"`
|
||||
AttackCooldown float64 `yaml:"attackCooldown"`
|
||||
PlayerDamage float64 `yaml:"playerDamage"`
|
||||
CriticalMultiplier float64 `yaml:"criticalMultiplier"`
|
||||
SpearDamage float64 `yaml:"spearDamage"`
|
||||
GatherRange float64 `yaml:"gatherRange"`
|
||||
GatherCooldown float64 `yaml:"gatherCooldown"`
|
||||
@@ -59,6 +60,8 @@ type Balance struct {
|
||||
BandageHealing float64 `yaml:"bandageHealing"`
|
||||
Progression *Progression `yaml:"progression"`
|
||||
Titles []Title `yaml:"titles"`
|
||||
Stats *StatsRules `yaml:"stats"`
|
||||
Items []ItemDefinition `yaml:"items"`
|
||||
}
|
||||
|
||||
func Load() (Balance, error) { return Parse(balance) }
|
||||
@@ -72,6 +75,17 @@ func Parse(data []byte) (Balance, error) {
|
||||
return b, b.Validate()
|
||||
}
|
||||
func (b Balance) Validate() error {
|
||||
if b.Stats == nil {
|
||||
return fmt.Errorf("stats rules are required")
|
||||
}
|
||||
if err := b.Stats.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
for _, item := range b.Items {
|
||||
if err := item.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err := b.validateProgression(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user