Ledger v3 · C# · Godot 4.7 Get started

Turns

Whose turn it is, a readiness meter.

✓ 2 plays, 33 steps, all passingFrom v2's cookbook

v2's cookbook, whose turn it is (G335-G336): a readiness meter each fighter fills at its own speed, ready when full and emptied by the turn it takes; and haste and slow on that meter, felt at once. The game keeps the turn order: it hears Ready, and orders the turn.

content/cookbook/turns.ledgerthe content
1# v2's cookbook, whose turn it is (G335-G336): a readiness meter each fighter fills at its own speed, ready when full
2# and emptied by the turn it takes; and haste and slow on that meter, felt at once. The game keeps the turn order: it
3# hears Ready, and orders the turn.
4
5rate 60
6stat MaxHealth
7stat Speed
8stat ReadyRate
9pool Health max MaxHealth
10pool Readiness max 100 regen ReadyRate
11damage Health
12event Ready
14# ---- G335 the readiness meter: 10 a second at speed 1, ready at 100; a turn spends the 100 ----
16effect Waiting
17 after Filled Readiness of holder
18 raise Ready of holder
20ability TakeTurn
21 cost Readiness 100
23archetype Swordsman
24 base MaxHealth 100
25 base Speed 1
26 base ReadyRate 10 * holder.Speed
27 full Health
28 pools Readiness
29 has Waiting
30 grants TakeTurn
32archetype Courier
33 base MaxHealth 100
34 base Speed 2
35 base ReadyRate 10 * holder.Speed
36 full Health
37 pools Readiness
38 has Waiting
39 grants TakeTurn
41# ---- G336 haste: half again the speed for 10 seconds; slow: half of it ----
43effect Hasted
44 lasts 10s
45 Speed + 50%
47effect Slowed
48 lasts 10s
49 Speed - 50%
content/cookbook/turns.playwhat it must do
1catalog turns.ledger
2row G335 Waiting TakeTurn Swordsman Courier
3row G336 Hasted Slowed TakeTurn Swordsman
4
5play G335 "The courier is ready at 5 seconds and the swordsman at 10; a turn taken empties the meter, which fills again from nothing; one not ready can't take a turn"
6 make s Swordsman
7 make c Courier
8 act s TakeTurn
9 expect refused CannotAfford
10 advance 4.9s
11 expect no event Ready of c
12 advance 0.1s
13 expect event Ready of c 1 time from G335: ("advance 4.9s" + "advance 0.1s") / "courier is ready at 5 seconds"
14 act c TakeTurn
15 expect c.Readiness = 0 from G335: "100 at its own" - "spends 100"
16 save
17 advance 5s
18 expect event Ready of s 1 time from G335: ("advance 4.9s" + "advance 0.1s" + "advance 5s") / "swordsman at 10"
19 expect event Ready of c 1 time from G335: "advance 5s" / "courier is ready at 5 seconds"
20 act s TakeTurn
21 expect s.Readiness = 0 from G335: "100 at its own" - "spends 100"
23play G336 "Two seconds of haste on a half-full swordsman put its meter at 80, beside another's 70; slowed after its turn, the other is at 50 ten seconds on, half a turn lost, and full 5 seconds later"
24 make s Swordsman
25 make t Swordsman
26 advance 5s
27 apply Hasted to s
28 advance 2s
29 expect s.Readiness = 80 from G336: "meter at 80"
30 expect t.Readiness = 70 from G336: "10 per second" in G335 * ("advance 5s" + "advance 2s")
31 advance 3s
32 act t TakeTurn
33 expect done
34 apply Slowed to t
35 save
36 advance 10s
37 expect t.Readiness = 50 from G336: "10 per second" in G335 * (1 - "takes 50% off") * "advance 10s"
38 expect t lacks Slowed
39 advance 5s
40 expect t.Readiness = 100 from G336: "10 per second" in G335 * (1 - "takes 50% off") * "advance 10s" + "10 per second" in G335 * "advance 5s"

Run it yourself

ledger check content/cookbook/turns.ledger content/cookbook/turns.play
ledger play content/cookbook/turns.play