Ledger v3 · C# · Godot 4.7 Get started

Progress

Experience filling a bar, levels spilling over.

✓ 1 play, 23 steps, all passingFrom v2's cookbook

v2's cookbook, progress (G292): experience fills a bar 100 times the level wide; full, the level's price comes out and a level goes in, what spilled over carrying toward the next, again if it fills again; a wider bar isn't handed its new room; each level past the first is 10 health, read live.

content/cookbook/progress.ledgerthe content
1# v2's cookbook, progress (G292): experience fills a bar 100 times the level wide; full, the level's price comes out
2# and a level goes in, what spilled over carrying toward the next, again if it fills again; a wider bar isn't handed its
3# new room; each level past the first is 10 health, read live.
4
5rate 60
6stat MaxHealth
7stat Level
8stat XPCap
9stat XpWorth default 50
10pool Health max MaxHealth
11pool XP max XPCap
12damage Health
13event Died
15effect Mortal
16 after Depleted Health of holder
17 raise Died of holder
18 destroy holder
20# ---- G292 a kill is worth what the kill says, 50 unless it says otherwise; a full bar is a level, its spill kept ----
22effect Learning
23 after Died credited to holder
24 gain XP event.subject.XpWorth
25 after Change XP of holder having Gain when event.overflow > 0 or holder.XP >= holder.XPCap
26 let over = event.overflow
27 apply LevelUp
28 set XP 0
29 gain XP over
31effect LevelUp
32 stack add
33 Level + 1
35archetype Recruit
36 base Level 1
37 base XPCap 100 * holder.Level
38 base MaxHealth 100 + 10 * (holder.Level - 1)
39 full Health
40 pools XP
41 has Learning
43archetype Grunt
44 base MaxHealth 10
45 full Health
46 has Mortal
48archetype Warlord
49 base MaxHealth 10
50 base XpWorth 350
51 full Health
52 has Mortal
content/cookbook/progress.playwhat it must do
1catalog progress.ledger
2row G292 Mortal Learning LevelUp Recruit Grunt Warlord
3
4play G292 "Two grunts, 50 each, fill level 1's 100 and the recruit is level 2, 110 health; a warlord's 350 at level 2 fills 200 with 150 over, level 3 at 150 of 300; another warlord, level 4 with 200 of 400; a grunt more is 250"
5 make r Recruit
6 make g1 Grunt
7 make g2 Grunt
8 deal 10 to g1 from r
9 expect r.XP = 50 from G292: "50 by default"
10 deal 10 to g2 from r
11 expect r.Level = 2 from G292: r.Level + "one level is added"
12 expect r.XP = 0 from G292: "50 by default" + "50 by default" - "costs 100"
13 expect max r.XP = 200 from G292: "costs 200"
14 expect max r.Health = 110 from G292: max r.Health + "adds 10 max health"
15 make w1 Warlord
16 deal 10 to w1 from r
17 expect r.Level = 3 from G292: r.Level + "one level is added" + "one level is added"
18 expect r.XP = 150 from G292: w1.XpWorth - "costs 200"
19 save
20 make w2 Warlord
21 deal 10 to w2 from r
22 expect r.Level = 4 from G292: r.Level + "one level is added" + "one level is added" + "one level is added"
23 expect r.XP = 200 from G292: w1.XpWorth - "costs 200" + w2.XpWorth - "100 times" * "3 costs"
24 expect max r.Health = 130 from G292: max r.Health + "adds 10 max health" + "adds 10 max health" + "adds 10 max health"
25 make g3 Grunt
26 deal 10 to g3 from r
27 expect r.XP = 250 from G292: w1.XpWorth - "costs 200" + w2.XpWorth - "100 times" * "3 costs" + "50 by default"

Run it yourself

ledger check content/cookbook/progress.ledger content/cookbook/progress.play
ledger play content/cookbook/progress.play