Ledger v3 · C# · Godot 4.7 Get started

Prices

Prices, scaled, cut and turned away.

✓ 7 plays, 90 steps, all passingFrom v2's cookbook

v2's cookbook, prices (G257-G263). A price is a change to its payer's pool that carries the ability's tags, so a rule the payer holds can scale it, take a flat sum off it after the percentages, or turn it away; a stock of charges refills by itself a charge at a time; a free shot is a round given back once it was paid, so an empty gun can't fire.

content/cookbook/prices.ledgerthe content
1# v2's cookbook, prices (G257-G263). A price is a change to its payer's pool that carries the ability's tags, so a rule
2# the payer holds can scale it, take a flat sum off it after the percentages, or turn it away; a stock of charges
3# refills by itself a charge at a time; a free shot is a round given back once it was paid, so an empty gun can't fire.
4
5rate 60
6stat MaxHealth
7stat CostCut
8pool Health max MaxHealth
9pool Mana max 100
10pool Charges max 2 refill 1 every 5s
11pool Actions max 2
12pool Ammo max 5
13damage Health
14stages Percent Flat
15tags Spell Move Shot
16event TurnEnded
18archetype Mage
19 base MaxHealth 100
20 full Health Mana
21 has Thrifty
22 grants Frostbolt
24archetype Dummy
25 base MaxHealth 500
26 full Health
28ability Frostbolt
29 tags Spell
30 target one
31 cost Mana 40
32 deal 10 to target
34# ---- G257 innervate: for 8 seconds every spell is free ----
36effect Innervated
37 lasts 8s
38 before Cost Mana by holder having Spell
39 scale 0
41# ---- G258 clearcasting: the next spell in 15 seconds is free, and is spent by it, innervated or not; a rule before a
42# cost changes the cost and nothing else, so it spends itself after the cost (09-abilities.md, iteration 3j, b6) ----
44effect Clearcasting
45 lasts 15s
46 before Cost Mana by holder having Spell
47 scale 0
48 after Cost Mana by holder having Spell
49 remove self
51# ---- G259 the arcane rune: 30% off for 50 seconds; discounts add into the one rule every caster holds, and a preview
52# shows the price ----
54effect Thrifty
55 before Cost Mana by holder at Percent
56 scale 1 - holder.CostCut
58effect ArcaneRune
59 lasts 50s
60 CostCut + 0.3
62effect FrugalTalent
63 CostCut + 0.1
65# ---- G260 preparation: the next spell in 30 seconds costs 20 less, after the percentages ----
67effect Preparation
68 lasts 30s
69 before Cost Mana by holder having Spell at Flat
70 reduce 20
71 after Cost Mana by holder having Spell
72 remove self
74# ---- G261 a dash spends one of two charges, which come back a charge every 5 seconds ----
76ability Dash
77 target self
78 cost Charges 1
80archetype Skirmisher
81 base MaxHealth 100
82 full Health Charges
83 grants Dash
85# ---- G262 a free move: this turn's next move costs no action, and the turn's end takes it ----
87ability Move
88 tags Move
89 target self
90 cost Actions 1
92effect FreeMove
93 ends on TurnEnded of holder
94 before Cost Actions by holder having Move
95 prevent
96 after Cost Actions by holder having Move prevented
97 remove self
99archetype Ranger
100 base MaxHealth 100
101 full Health Actions
102 grants Move
104# ---- G263 the ammo box: a fifth of shots give their round back; the round is paid first, so an empty gun can't fire ----
106ability Shoot
107 tags Shot
108 target one
109 cost Ammo 1
110 deal 10 to target
112effect AmmoBox
113 after Activate by holder having Shot when chance(20%)
114 gain Ammo 1
116archetype Gunner
117 base MaxHealth 100
118 full Health Ammo
119 grants Shoot
content/cookbook/prices.playwhat it must do
1catalog prices.ledger
2row G257 Innervated Frostbolt Mage Dummy
3row G258 Innervated Clearcasting Frostbolt Mage
4row G259 Thrifty ArcaneRune FrugalTalent Frostbolt Mage
5row G260 Preparation Frostbolt Mage
6row G261 Dash Skirmisher
7row G262 FreeMove Move Ranger
8row G263 AmmoBox Shoot Gunner
9
10play G257 "A frostbolt costs 40 mana; innervated, nothing for 8 seconds, and then 40 again"
11 make m Mage
12 make t Dummy
13 act m Frostbolt at t
14 expect m.Mana = 60 from G257: m.Mana - Frostbolt.cost
15 apply Innervated to m
16 act m Frostbolt at t
17 expect m.Mana = 60 from G257: m.Mana - Frostbolt.cost
18 save
19 advance 8s
20 act m Frostbolt at t
21 expect m.Mana = 20 from content: G257 leaves open whether a cast at the 8th second is inside the window; the content's window has closed, so the content's 40 is paid: 60 - 40 = 20
23play G258 G257 "Clearcasting makes the next spell free and is spent by it; innervated as well, the spell is free once over and the proc still spent"
24 make m Mage
25 make t Dummy
26 apply Clearcasting to m
27 act m Frostbolt at t
28 expect m.Mana = 100 from G258: m.Mana
29 expect m lacks Clearcasting
30 act m Frostbolt at t
31 expect m.Mana = 60 from G258: m.Mana - Frostbolt.cost
32 save
33 apply Clearcasting to m
34 apply Innervated to m
35 act m Frostbolt at t
36 expect m.Mana = 60 from G258: m.Mana - Frostbolt.cost
37 expect m lacks Clearcasting
38 expect m has Innervated
40play G259 "The arcane rune takes 30% off: a frostbolt of 40 costs 28, and a preview shows it; a frugal talent's 10% more adds to it, 24"
41 make m Mage
42 make t Dummy
43 apply ArcaneRune to m
44 expect preview m Frostbolt at t m.Mana = 72 from G259: m.Mana - Frostbolt.cost * (1 - "30% less")
45 act m Frostbolt at t
46 expect m.Mana = 72 from G259: m.Mana - Frostbolt.cost * (1 - "30% less")
47 save
48 apply FrugalTalent to m
49 act m Frostbolt at t
50 expect m.Mana = 48 from content: G259 adds discounts into one multiplier but gives the frugal talent no amount; the content's 10% with the rune's 30% makes 40 cost 24: 72 - 24 = 48
52play G260 G259 "Preparation takes 20 off the next spell after the rune's 30%: 40 is 28, less 20, 8; the one after is 28"
53 make m Mage
54 make t Dummy
55 apply ArcaneRune to m
56 apply Preparation to m
57 act m Frostbolt at t
58 expect m.Mana = 92 from G260: m.Mana - (Frostbolt.cost * (1 - "30% less" in G259) - "costs 20 less")
59 expect m lacks Preparation
60 save
61 act m Frostbolt at t
62 expect m.Mana = 64 from G260: m.Mana - (Frostbolt.cost * (1 - "30% less" in G259) - "costs 20 less") - Frostbolt.cost * (1 - "30% less" in G259)
64play G261 "A dash spends one of two charges; with both spent it is refused until 5 seconds bring one back"
65 make s Skirmisher
66 act s Dash
67 act s Dash
68 expect s.Charges = 0 from G261: "two charges" - count "act s Dash"
69 act s Dash
70 expect refused CannotAfford
71 save
72 advance 4.9s
73 act s Dash
74 expect refused CannotAfford
75 advance 0.1s
76 act s Dash
77 expect done
78 expect s.Charges = 0 from G261: "refills one charge" - "dash that uses one"
80play G262 "With a free move the turn's next move costs no action of two, and the move spends it; one unused goes with the turn's end"
81 make r Ranger
82 apply FreeMove to r
83 act r Move
84 expect r.Actions = 2 from G262: "point (of two)"
85 expect r lacks FreeMove
86 act r Move
87 expect r.Actions = 1 from G262: "point (of two)" - Move.cost
88 save
89 apply FreeMove to r
90 raise TurnEnded of r
91 expect r lacks FreeMove
93play G263 "With the ammo box a fifth of shots give their round back: of five rounds, this gunner fires seven, and with none left it can't fire"
94 seed 6 # a run's: the draws under it fall as the play says
95 make g Gunner
96 apply AmmoBox to g
97 make t Dummy
98 act g Shoot at t
99 act g Shoot at t
100 act g Shoot at t
101 act g Shoot at t
102 act g Shoot at t
103 act g Shoot at t
104 act g Shoot at t
105 expect t.Health = 430 from a run: under seed 6 the gunner's 1st and 3rd shots draw free, so 7 shots of the content's 10 land on the dummy's 500: 500 - 70 = 430
106 expect g.Ammo = 0 from a run: under seed 6 two of the 7 shots draw free, so the 5 rounds are all spent: 5 - 7 + 2 = 0
107 save
108 act g Shoot at t
109 expect refused CannotAfford
110 expect coverage AmmoBox rule 1 heard = 7 from a run: under seed 6 the 5-round gun fires 7 shots, the 1st and 3rd drawing free, and the ammo box's rule hears each one
111 expect coverage AmmoBox rule 1 fired = 2 from a run: under seed 6 the ammo box's draw comes up free on the 1st and 3rd of the gunner's shots, and on no other
112 expect coverage Shoot used = 7 from a run: under seed 6 the 1st and 3rd shots give their round back, so the 5 rounds carry 7 shots
113 expect coverage Shoot refused = 1 from a run: under seed 6 the 7 shots spend all 5 rounds, so the 8th order is refused
114 covers gap 6

Run it yourself

ledger check content/cookbook/prices.ledger content/cookbook/prices.play
ledger play content/cookbook/prices.play