Unify XP progression and enable ability ranks

This commit is contained in:
dingo
2026-09-10 06:08:49 -04:00
parent 906a07ff66
commit ac695b3270
17 changed files with 313 additions and 43 deletions
+5 -5
View File
@@ -22,7 +22,7 @@ func TestLevelUpsBankPointsAndCap(t *testing.T) {
t.Fatal("premature level")
}
w.grantXP(c, 151)
if c.View.Level != 3 || c.View.Experience != 0 || c.View.StatPoints != 20 || c.View.ExperienceToNextLevel != 200 {
if c.View.Level != 3 || c.View.Experience != 40 || c.View.StatPoints != 20 || c.View.ExperienceToNextLevel != 140 {
t.Fatalf("multi-level award lost points or XP: %+v", c.View)
}
c.Progression.MaxLevel = 4
@@ -110,7 +110,7 @@ func TestProgressionSurvivesRestartDeathAndTransfer(t *testing.T) {
t.Fatal(err)
}
loaded := restored.Characters[c.View.Entity.ID]
if loaded.View.Level != 3 || loaded.View.Experience != 25 || loaded.View.StatPoints != 20 || !reflect.DeepEqual(loaded.View.Titles, c.View.Titles) {
if loaded.View.Level != 3 || loaded.View.Experience != 65 || loaded.View.StatPoints != 20 || !reflect.DeepEqual(loaded.View.Titles, c.View.Titles) {
t.Fatal("restart reset progression")
}
loaded.View.Entity.State = "eligible"
@@ -123,12 +123,12 @@ func TestProgressionSurvivesRestartDeathAndTransfer(t *testing.T) {
if err = destination.Import(loaded); err != nil {
t.Fatal(err)
}
if loaded.View.ExperienceToNextLevel != 200 || loaded.Progression.StatPointsPerLevel != 10 || loaded.DailySeconds != 123 || loaded.WorldKills != 0 || loaded.View.StatPoints != 20 || len(loaded.View.Titles) != 1 {
if loaded.View.ExperienceToNextLevel != 140 || loaded.Progression.StatPointsPerLevel != 10 || loaded.DailySeconds != 123 || loaded.WorldKills != 0 || loaded.View.StatPoints != 20 || len(loaded.View.Titles) != 1 {
t.Fatal("transfer altered progression, titles, or daily budget")
}
destination.kill(loaded, "test death")
destination.grantXP(loaded, 1000)
if loaded.View.StatPoints != 20 || loaded.View.Experience != 25 || len(loaded.View.Titles) != 1 {
if loaded.View.StatPoints != 20 || loaded.View.Experience != 65 || len(loaded.View.Titles) != 1 {
t.Fatal("death erased progression or allowed postmortem XP")
}
replacement, err := destination.Join(loaded.Account, "Replacement")
@@ -252,7 +252,7 @@ func TestBossXPAndSurvivalMilestoneGrantedOnce(t *testing.T) {
if err := w.Intent(c.View.Entity.ID, p.Intent{Op: "attack", Seq: 1, Target: "boss"}); err != nil {
t.Fatal(err)
}
if c.BossKills != 1 || c.WorldsSurvived != 1 || offline.WorldsSurvived != 1 || dead.WorldsSurvived != 0 || c.View.Level != 4 || c.View.Experience != 50 || c.View.StatPoints != 30 {
if c.BossKills != 1 || c.WorldsSurvived != 1 || offline.WorldsSurvived != 1 || dead.WorldsSurvived != 0 || c.View.Level != 4 || c.View.Experience != 150 || c.View.StatPoints != 30 {
t.Fatal("incorrect boss progression")
}
if w.Intent(c.View.Entity.ID, p.Intent{Op: "attack", Seq: 2, Target: "boss"}) == nil {