Giant chesplate

This commit is contained in:
2026-10-01 16:58:30 -03:00
parent a7835261e1
commit 1fc92a7b00
21 changed files with 148 additions and 51 deletions
+6 -6
View File
@@ -12,12 +12,12 @@ Deno.test("exhaustion eats saturation first, then hunger", () => {
const vitals = new Vitals();
const noop = () => {};
vitals.add_exhaustion(4.1);
vitals.tick(20, noop, noop);
vitals.tick(20, 20, noop, noop);
assertEquals([vitals.food, vitals.saturation], [20, 4]);
vitals.saturation = 0;
vitals.add_exhaustion(4);
vitals.tick(20, noop, noop);
vitals.tick(20, 20, noop, noop);
assertEquals([vitals.food, vitals.saturation], [19, 0]);
});
@@ -29,7 +29,7 @@ Deno.test("a full stomach heals, fast with saturation and slowly without, and st
// full hunger and saturation: every 10 ticks, up to a whole heart, paid for with exhaustion
const fast = new Vitals();
for (let i = 0; i < 10; i++) fast.tick(10, heal, damage);
for (let i = 0; i < 10; i++) fast.tick(10, 20, heal, damage);
assertAlmostEquals(healed, 5 / 6);
assertEquals(fast.exhaustion, 5);
@@ -38,7 +38,7 @@ Deno.test("a full stomach heals, fast with saturation and slowly without, and st
const slow = new Vitals();
slow.food = 18;
slow.saturation = 0;
for (let i = 0; i < 80; i++) slow.tick(10, heal, damage);
for (let i = 0; i < 80; i++) slow.tick(10, 20, heal, damage);
assertEquals(healed, 1);
// starving: 1 every 4 seconds, never below 1 health
@@ -46,9 +46,9 @@ Deno.test("a full stomach heals, fast with saturation and slowly without, and st
starving.food = 0;
starving.saturation = 0;
let health = 2;
for (let i = 0; i < 80; i++) starving.tick(health, heal, (amount) => health -= amount);
for (let i = 0; i < 80; i++) starving.tick(health, 20, heal, (amount) => health -= amount);
assertEquals(health, 1);
for (let i = 0; i < 400; i++) starving.tick(health, heal, (amount) => health -= amount);
for (let i = 0; i < 400; i++) starving.tick(health, 20, heal, (amount) => health -= amount);
assertEquals(health, 1);
assertEquals(hurt, 0);
});