Ledger v3 · C# · Godot 4.7 Get started

Turn

A turn's start giving back a unit's move and action; a move as long as its path

✓ 1 play, 15 steps, all passingFrom Tactics, content\rules.ledger
turn EVENTtakes Pathset POOLcost Moves 1

A turn's start giving back a unit's move and its action, lifted from the tactics slice's content\rules.ledger (TakesTurns, Move and the pools they spend) and its soldier from content\units.ledger. A move of the path's length, up to the unit's mobility, spends its one move; the path is the game's, handed with the order. The game raises TurnStarted of each unit of the side whose turn begins, which sets its move and action back to one.

content/cookbook/mechanics/turn.ledgerthe content
1# A turn's start giving back a unit's move and its action, lifted from the tactics slice's content\rules.ledger
2# (TakesTurns, Move and the pools they spend) and its soldier from content\units.ledger. A move of the path's length,
3# up to the unit's mobility, spends its one move; the path is the game's, handed with the order. The game raises
4# TurnStarted of each unit of the side whose turn begins, which sets its move and action back to one.
5
6rate 10
7link team
8allegiance team
9prop Path min 0
10stat Mobility
11pool Moves max 1 whole
12pool Actions max 1 whole
13event TurnStarted
14turn TurnStarted
16effect TakesTurns
17 after TurnStarted of holder
18 set Moves 1
19 set Actions 1
21ability Move
22 takes Path
23 requires event.Path <= holder.Mobility else "further than the unit's move"
24 cost Moves 1
26archetype Side
28archetype Soldier
29 base Mobility 5
30 with Moves = 1, Actions = 1
31 has TakesTurns
32 grants Move
content/cookbook/mechanics/turn.playwhat it must do
1catalog turn.ledger
2
3# The turn's numbers, from TakesTurns, Move and the Soldier: Mobility 5, one move and one action a turn.
4
5play "a move of 5 spends the move; 6 is too far; a second waits for the next turn, which gives back the move"
6 make squad Side
7 make s Soldier with team = squad at 0 0
8 act s Move with Path = 6
9 expect refused Requirement "further than the unit's move"
10 act s Move with Path = 5
11 expect done
12 expect s.Moves = 0 from content: 1 less the move's 1
13 act s Move with Path = 1
14 expect refused CannotAfford
15 save
16 raise TurnStarted of s
17 expect s.Moves = 1 from content: the turn sets it to 1
18 expect s.Actions = 1 from content: the turn sets it to 1
19 act s Move with Path = 1
20 expect done

Run it yourself

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