Ledger v3 · C# · Godot 4.7 Get started

Outcome

A match won when the other side's last base falls

✓ 2 plays, 23 steps, all passingFrom RTS, content\match.ledger
link match globalafter Died of anyonecount(all actors having TAG when ...)

A match's outcome, lifted from the RTS slice's content\match.ledger (Judges and the Match), with death from content\rules.ledger (Mortal) and the base from content\economy.ledger. The match is an actor the game reads by the global link match: its Winner is 0 while each side has a base standing; a side whose last base dies loses, and the other wins, 1 for the home side and 2 for the other. The dying base is heard whole, before it is destroyed, so it is left out of its side's count. The game only stops once the winner is set.

content/cookbook/mechanics/outcome.ledgerthe content
1# A match's outcome, lifted from the RTS slice's content\match.ledger (Judges and the Match), with death from
2# content\rules.ledger (Mortal) and the base from content\economy.ledger. The match is an actor the game reads by the
3# global link match: its Winner is 0 while each side has a base standing; a side whose last base dies loses, and the
4# other wins, 1 for the home side and 2 for the other. The dying base is heard whole, before it is destroyed, so it is
5# left out of its side's count. The game only stops once the winner is set.
6
7rate 20
8stat MaxHealth
9pool Health max MaxHealth
10pool Winner whole max 2
11damage Health
12link team
13link match global
14link home
15allegiance team
16tags Building Base
17event Died
19effect Mortal
20 dies at no Health raising Died
22effect Judges
23 after Died of anyone
24 if holder.Winner == 0 and has(event.subject, Base) and count(all actors having Base when it.team == event.subject.team and it != event.subject) == 0
25 if event.subject.team == holder.home
26 set Winner 2
27 else
28 set Winner 1
30archetype Match
31 pools Winner
32 has Judges
34archetype Side
36archetype Base
37 tags Building Base
38 base MaxHealth 1500
39 full Health
40 has Mortal
content/cookbook/mechanics/outcome.playwhat it must do
1catalog outcome.ledger
2
3# The outcome's numbers, from Judges: 0 while each side has a base, 1 when the other side's last falls, 2 when the
4# home side's does. Side one is home; each side has bases of 1,500.
5
6play "the other side's first base falls and nothing is decided; its last falls and the home side wins, 1"
7 make one Side
8 make two Side
9 make m Match with home = one
10 link match m
11 make h Base with team = one
12 make x Base with team = two
13 make y Base with team = two
14 deal 1500 to x
15 expect x gone
16 expect m.Winner = 0 from content: side two still has a base, y
17 save
18 deal 1500 to y
19 expect m.Winner = 1 from content: side two's last base fell, so the home side wins
20 deal 1500 to h
21 expect m.Winner = 1 from content: set once, and kept
23play "the home side's last base falls: the other side wins, 2"
24 make one Side
25 make two Side
26 make m Match with home = one
27 link match m
28 make h Base with team = one
29 make x Base with team = two
30 deal 1500 to h
31 expect m.Winner = 2 from content: the home side's last base fell

Run it yourself

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