Complete player stats inventory and Control content editors

This commit is contained in:
dingo
2026-09-08 06:02:13 -04:00
parent 2df1f6ab38
commit b6ce3bc292
27 changed files with 960 additions and 267 deletions
+11 -2
View File
@@ -31,7 +31,9 @@ func (w *World) orderedCharacters() []*Character {
}
func (w *World) restoreProgression(c *Character) error {
if c.StatsVersion < 0 || c.StatsVersion > 1 { return errors.New("unsupported character stats version") }
if c.StatsVersion < 0 || c.StatsVersion > 1 {
return errors.New("unsupported character stats version")
}
if c.View.Level == 0 {
c.View.Level = 1
}
@@ -45,7 +47,9 @@ func (w *World) restoreProgression(c *Character) error {
c.View.StatPoints += (c.View.Level - 1) * (w.Balance.Progression.StatPointsPerLevel - rules.StatPointsPerLevel)
}
// Preserve any older, more generous grant curve rather than deleting points.
if rules.StatPointsPerLevel < w.Balance.Progression.StatPointsPerLevel { rules.StatPointsPerLevel = w.Balance.Progression.StatPointsPerLevel }
if rules.StatPointsPerLevel < w.Balance.Progression.StatPointsPerLevel {
rules.StatPointsPerLevel = w.Balance.Progression.StatPointsPerLevel
}
rules.StaminaPerLevel = w.Balance.Progression.StaminaPerLevel
rules.VitalPointsPerChoice = w.Balance.Progression.VitalPointsPerChoice
c.Progression = &rules
@@ -69,6 +73,11 @@ func (w *World) restoreProgression(c *Character) error {
if c.View.Titles == nil {
c.View.Titles = []p.TitleAward{}
}
for i := range c.View.Titles {
if c.View.Titles[i].Effects.Modifiers == nil {
c.View.Titles[i].Effects.Modifiers = []p.StatModifier{}
}
}
return nil
}