Ledger v3 · C# · Godot 4.7 Get started

Gather

Mining a patch in a windup and carrying the load home

✓ 2 plays, 29 steps, all passingFrom RTS, content\economy.ledger
windupmin(...)lose ... on targetdies at no POOL

Gathering: mining a patch and carrying the load home, lifted from the RTS slice's content\economy.ledger (Mine, Deposit, the OrePatch and its Spent, the Side's bank and the worker). A worker mines 5 in a windup of a second and a half, refused while it carries a load, and deposits it at a base of its side within 3, into the side's bank. A patch mined out dies. The walking between is the game's.

content/cookbook/mechanics/gather.ledgerthe content
1# Gathering: mining a patch and carrying the load home, lifted from the RTS slice's content\economy.ledger (Mine,
2# Deposit, the OrePatch and its Spent, the Side's bank and the worker). A worker mines 5 in a windup of a second and a
3# half, refused while it carries a load, and deposits it at a base of its side within 3, into the side's bank. A patch
4# mined out dies. The walking between is the game's.
5
6rate 20
7stat MaxHealth
8pool Health max MaxHealth
9pool Ore whole
10pool Load whole
11damage Health
12link team base
13allegiance team
14tags Unit Building Base Worker Mineral
16archetype Side
17 pools Ore
18 with Ore = 50
20archetype Base
21 tags Building Base
22 base MaxHealth 1500
23 full Health
25archetype OrePatch
26 tags Mineral
27 pools Ore
28 with Ore = 1500
29 has Spent
31effect Spent
32 dies at no Ore
34ability Mine
35 target one having Mineral within 1.5
36 requires holder.Load == 0 else "already carrying"
37 windup 1.5s
38 gain Load min(5, target.Ore)
39 lose Ore min(5, target.Ore) on target
41ability Deposit
42 target one ally having Base within 3
43 requires holder.Load > 0 else "nothing to carry"
44 gain Ore holder.Load on holder.team
45 set Load 0
47archetype Worker
48 tags Unit Worker
49 base MaxHealth 40
50 full Health
51 pools Load
52 grants Mine Deposit
content/cookbook/mechanics/gather.playwhat it must do
1catalog gather.ledger
2
3# The gathering's numbers, from Mine (5 in 1.5 s), Deposit, the OrePatch's 1,500 and the side's 50 to start.
4
5play "a worker mines 5 in 1.5 s, carries it to its base and deposits it in its side's bank"
6 make s Side
7 make b Base with team = s at 0 0
8 make w Worker with team = s, base = b at 2 0
9 make p OrePatch at 3 0
10 act w Mine at p
11 expect done
12 advance 1.4s
13 expect w.Load = 0 from content: the windup's 1.5 s not done
14 advance 0.1s
15 expect w.Load = 5 from content: a load is 5
16 expect p.Ore = 1495 from content: 1,500 less 5
17 act w Mine at p
18 expect refused Requirement "already carrying"
19 save
20 act w Deposit at b
21 expect done
22 expect s.Ore = 55 from content: the side's 50 to start, and 5
23 expect w.Load = 0 from content: set to 0 as it deposits
24 act w Deposit at b
25 expect refused Requirement "nothing to carry"
27play "a patch's last 3 are a load of 3, and it is gone"
28 make s Side
29 make b Base with team = s at 0 0
30 make w Worker with team = s, base = b at 2 0
31 make p OrePatch at 3 0
32 set p.Ore = 3
33 act w Mine at p
34 advance 1.5s
35 expect w.Load = 3 from content: min(5, the patch's 3)
36 expect p gone

Run it yourself

ledger check content/cookbook/mechanics/gather.ledger content/cookbook/mechanics/gather.play
ledger play content/cookbook/mechanics/gather.play