pushing current

This commit is contained in:
dingo
2026-09-07 13:44:10 -04:00
parent bc0ffbbbe5
commit 3f58de5744
15 changed files with 872 additions and 60 deletions
+28 -19
View File
@@ -7,33 +7,36 @@ import (
)
type Progression struct {
BaseXP int64 `yaml:"baseXp"`
XPPerLevel int64 `yaml:"xpPerLevel"`
StatPointsPerLevel int64 `yaml:"statPointsPerLevel"`
MaxLevel int64 `yaml:"maxLevel"`
GatherXP int64 `yaml:"gatherXp"`
CraftXP int64 `yaml:"craftXp"`
MobKillXP int64 `yaml:"mobKillXp"`
BossKillXP int64 `yaml:"bossKillXp"`
BaseXP int64 `yaml:"baseXp"`
XPPerLevel int64 `yaml:"xpPerLevel"`
StatPointsPerLevel int64 `yaml:"statPointsPerLevel"`
StaminaPerLevel int64 `yaml:"staminaPerLevel"`
VitalPointsPerChoice int64 `yaml:"vitalPointsPerChoice"`
MaxLevel int64 `yaml:"maxLevel"`
GatherXP int64 `yaml:"gatherXp"`
CraftXP int64 `yaml:"craftXp"`
MobKillXP int64 `yaml:"mobKillXp"`
BossKillXP int64 `yaml:"bossKillXp"`
}
type TitleRequirement struct {
Metric string `yaml:"metric"`
AtLeast int64 `yaml:"atLeast"`
Metric string `json:"metric" yaml:"metric"`
AtLeast int64 `json:"atLeast" yaml:"atLeast"`
}
type TitleEffects struct {
Damage float64 `yaml:"damage"`
MoveSpeed float64 `yaml:"moveSpeed"`
Damage float64 `json:"damage" yaml:"damage"`
MoveSpeed float64 `json:"moveSpeed" yaml:"moveSpeed"`
Modifiers []StatModifier `json:"modifiers" yaml:"modifiers"`
}
type Title struct {
ID string `yaml:"id"`
Name string `yaml:"name"`
Description string `yaml:"description"`
Scope string `yaml:"scope"`
Requirements []TitleRequirement `yaml:"requirements"`
Effects TitleEffects `yaml:"effects"`
ID string `json:"id" yaml:"id"`
Name string `json:"name" yaml:"name"`
Description string `json:"description" yaml:"description"`
Scope string `json:"scope" yaml:"scope"`
Requirements []TitleRequirement `json:"requirements" yaml:"requirements"`
Effects TitleEffects `json:"effects" yaml:"effects"`
}
var titleID = regexp.MustCompile(`^[a-z][a-z0-9_-]{0,63}$`)
@@ -62,7 +65,7 @@ func (b Balance) validateProgression() error {
return fmt.Errorf("title %q needs bounded requirements", title.ID)
}
for _, r := range title.Requirements {
if !metrics[r.Metric] || r.AtLeast < 1 || r.AtLeast > 1000000000 {
if (!metrics[r.Metric] && !KnownStat(r.Metric)) || r.AtLeast < 1 || r.AtLeast > 1000000000 {
return fmt.Errorf("invalid title requirement for %q", title.ID)
}
}
@@ -71,11 +74,17 @@ func (b Balance) validateProgression() error {
return fmt.Errorf("invalid title effect for %q", title.ID)
}
}
if err := ValidateModifiers(title.Effects.Modifiers); err != nil {
return err
}
}
return nil
}
func (p Progression) Validate() error {
if p.StaminaPerLevel < 1 || p.StaminaPerLevel > 1000 || p.VitalPointsPerChoice < 1 || p.VitalPointsPerChoice > 1000 {
return fmt.Errorf("invalid stamina or vital level reward")
}
if p.BaseXP < 1 || p.BaseXP > 1000000000 || p.XPPerLevel < 0 || p.XPPerLevel > 1000000000 || p.StatPointsPerLevel < 1 || p.StatPointsPerLevel > 1000 || p.MaxLevel < 2 || p.MaxLevel > 10000 {
return fmt.Errorf("invalid progression curve or stat point grant")
}