aboutsummaryrefslogtreecommitdiff
path: root/internal/game/sys_energy_test.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-07-17 19:23:23 -0400
committerhistoria <[not public]>2026-07-17 19:23:23 -0400
commited0d9332def127b2fefebe80a4992a875cc7e521 (patch)
tree745dc622e448ca7a16da11f1684d5ba819d6da97 /internal/game/sys_energy_test.go
parent3d90a18c15ca54f262cfa61edba4866c91f29802 (diff)
downloadthehouseoficarus-ed0d9332def127b2fefebe80a4992a875cc7e521.tar.gz
refactor: return (ticks, usesEnergy) in moveTicks, remove old flee code
Diffstat (limited to 'internal/game/sys_energy_test.go')
-rw-r--r--internal/game/sys_energy_test.go30
1 files changed, 15 insertions, 15 deletions
diff --git a/internal/game/sys_energy_test.go b/internal/game/sys_energy_test.go
index ff897f0..a1a5dab 100644
--- a/internal/game/sys_energy_test.go
+++ b/internal/game/sys_energy_test.go
@@ -45,48 +45,48 @@ func TestMoveTicks(t *testing.T) {
// Single move, energy present -> 1 tick, uses energy.
p := player.New("a")
- if ticks := g.moveTicks(p, false); ticks != 1 {
+ if ticks, usesEnergy := g.moveTicks(p, false); ticks != 1 {
t.Errorf("single move with energy: ticks=%d want 1", ticks)
- } else if !p.MoveUsesEnergy {
+ } else if !usesEnergy {
t.Error("single move with energy should set MoveUsesEnergy")
}
// Single move, no energy -> 2 ticks, no drain.
p2 := player.New("b")
p2.RunEnergy = 0
- if ticks := g.moveTicks(p2, false); ticks != 2 {
+ if ticks, usesEnergy := g.moveTicks(p2, false); ticks != 2 {
t.Errorf("single move no energy: ticks=%d want 2", ticks)
- } else if p2.MoveUsesEnergy {
+ } else if usesEnergy {
t.Error("single move no energy should not set MoveUsesEnergy")
}
// Walk without full graceful set -> 2 ticks, no drain.
p3 := player.New("c")
p3.RunEnergy = 10
- if ticks := g.moveTicks(p3, true); ticks != 2 {
+ if ticks, usesEnergy := g.moveTicks(p3, true); ticks != 2 {
t.Errorf("walk no full set: ticks=%d want 2", ticks)
- } else if p3.MoveUsesEnergy {
+ } else if usesEnergy {
t.Error("walk without full set should not drain energy")
}
// Cape of Agility -> 0 ticks, no drain regardless of walk.
p4 := player.New("d")
p4.Equipment[item.SlotBack] = capeOfAgilityID
- if ticks := g.moveTicks(p4, false); ticks != 0 {
+ if ticks, usesEnergy := g.moveTicks(p4, false); ticks != 0 {
t.Errorf("cape single move: ticks=%d want 0", ticks)
- } else if p4.MoveUsesEnergy {
+ } else if usesEnergy {
t.Error("cape should not drain energy")
}
- if ticks := g.moveTicks(p4, true); ticks != 0 {
+ if ticks, _ := g.moveTicks(p4, true); ticks != 0 {
t.Errorf("cape walk: ticks=%d want 0", ticks)
}
// GodMode -> 0 ticks, no drain.
p5 := player.New("e")
p5.GodMode = true
- if ticks := g.moveTicks(p5, false); ticks != 0 {
+ if ticks, usesEnergy := g.moveTicks(p5, false); ticks != 0 {
t.Errorf("godmode: ticks=%d want 0", ticks)
- } else if p5.MoveUsesEnergy {
+ } else if usesEnergy {
t.Error("godmode should not drain energy")
}
@@ -101,9 +101,9 @@ func TestMoveTicks(t *testing.T) {
if got := gracefulCount(p6); got != 6 {
t.Fatalf("gracefulCount=%d want 6", got)
}
- if ticks := g.moveTicks(p6, true); ticks != 1 {
+ if ticks, usesEnergy := g.moveTicks(p6, true); ticks != 1 {
t.Errorf("full-set walk with energy: ticks=%d want 1", ticks)
- } else if !p6.MoveUsesEnergy {
+ } else if !usesEnergy {
t.Error("full-set walk with energy should drain")
}
@@ -113,9 +113,9 @@ func TestMoveTicks(t *testing.T) {
p7.Equipment[slot] = id
}
p7.RunEnergy = 0
- if ticks := g.moveTicks(p7, true); ticks != 2 {
+ if ticks, usesEnergy := g.moveTicks(p7, true); ticks != 2 {
t.Errorf("full-set walk no energy: ticks=%d want 2", ticks)
- } else if p7.MoveUsesEnergy {
+ } else if usesEnergy {
t.Error("full-set walk with no energy should not drain")
}
}