Ledger v3 · C# · Godot 4.7 Get started

Sometimes

Bonuses that count only sometimes.

✓ 5 plays, 61 steps, all passingFrom v2's cookbook

v2's cookbook, only sometimes (G251-G256): bonuses that count for one kind of skill, one kind of target, one kind of roll or one state of the target. A bonus a stat doesn't hold leaves the character sheet alone, and a preview of the skill shows it; flat bonuses come before percentages; a critical hit leaves out the bad stages by tag.

content/cookbook/sometimes.ledgerthe content
1# v2's cookbook, only sometimes (G251-G256): bonuses that count for one kind of skill, one kind of target, one kind of
2# roll or one state of the target. A bonus a stat doesn't hold leaves the character sheet alone, and a preview of the
3# skill shows it; flat bonuses come before percentages; a critical hit leaves out the bad stages by tag.
4
5rate 60
6stat MaxHealth
7stat Attack
8stat AttackStage min -6 max 6
9stat DefenseStage min -6 max 6
10pool Health max MaxHealth
11damage Health
12stages Add Multiply
13tags Frost Undead Lowered Raised Critical
15curve Stage
16 -6 0.25
17 -5 0.285714
18 -4 0.333333
19 -3 0.4
20 -2 0.5
21 -1 0.666667
22 0 1
23 1 1.5
24 2 2
25 3 2.5
26 4 3
27 5 3.5
28 6 4
30archetype Fighter
31 base MaxHealth 100
32 base Attack 20
33 full Health
34 grants Frostbite Cleave SwordsDance StormThrow Blow Finisher
36archetype Ghoul
37 tags Undead
38 base MaxHealth 300
39 full Health
41archetype Golem
42 base MaxHealth 330
43 full Health
45# ---- G251 the frost codex: half again on the frost kind's hits, which the sheet's attack doesn't show and a preview of
46# frostbite does ----
48effect FrostCodex
49 before Damage by holder having Frost at Multiply
50 scale 1.5
52ability Frostbite
53 tags Frost
54 target one
55 deal holder.Attack Frost to target
57ability Cleave
58 target one
59 deal holder.Attack to target
61# ---- G252 the silver blade: 10 more against the undead, added before any percentage ----
63effect SilverBlade
64 before Damage by holder at Add when has(event.subject, Undead)
65 add 10
67# ---- G253 stages: an attack stage is half again a step up, a third off a step down, six at most either way; swords
68# dance is two up. A blow is the attacker's attack by its stage over the target's defence stage ----
70effect AttackUp
71 stack add
72 AttackStage + 1
74effect DefenseUp
75 tags Raised
76 stack add
77 DefenseStage + 1
79ability SwordsDance
80 target self
81 apply AttackUp 2
83ability Blow
84 target one
85 deal holder.Attack * Stage(holder.AttackStage) / Stage(target.DefenseStage) to target
87# ---- G254 a critical hit goes past the attacker's lowered stages and the target's raised ones, effect by effect:
88# the stage it reads leaves out the terms of effects carrying those tags ----
90effect Intimidated
91 tags Lowered
92 AttackStage - 1
94ability StormThrow
95 tags Critical
96 target one
97 deal 1.5 * holder.Attack * Stage(holder.AttackStage except Lowered) / Stage(target.DefenseStage except Raised) Critical to target
99# ---- G255 G256 a blow does double on a target at or below a third of its health; the finisher's own 100 lands only
100# there, while the swing before it lands anyway ----
102effect Cruel
103 before Damage by holder at Multiply when event.subject.Health <= event.subject.MaxHealth / 3
104 scale 2
106ability Finisher
107 target one
108 deal holder.Attack to target
109 if target.Health <= target.MaxHealth / 3
110 deal 100 to target
content/cookbook/sometimes.playwhat it must do
1catalog sometimes.ledger
2row G251 FrostCodex Frostbite Cleave Fighter
3row G252 SilverBlade Frostbite Cleave Fighter Ghoul
4row G253 AttackUp DefenseUp SwordsDance Blow Fighter Golem
5row G254 DefenseUp Intimidated Blow StormThrow Golem
6row G255 Cruel Golem
7row G256 Cruel Finisher Golem
8
9play G251 "The frost codex makes frostbite's 20 a 30, and a cleave stays 20; the sheet's attack is still 20, and a preview of frostbite shows the 30"
10 make f Fighter
11 apply FrostCodex to f
12 make g Golem
13 expect f.Attack = 20 from G251: "20-damage"
14 expect preview f Frostbite at g g.Health = 300 from G251: g.Health - "Frostbite hits for 30"
15 act f Frostbite at g
16 expect g.Health = 300 from G251: g.Health - "Frostbite hits for 30"
17 save
18 act f Cleave at g
19 expect g.Health = 280 from G251: g.Health - "Frostbite hits for 30" - "cleave stays 20"
21play G252 G251 "The silver blade's 10 against the undead: a cleave on a ghoul is 30; with the codex, frostbite on it is 20 and 10, half again, 45; on a golem a cleave is 20"
22 make f Fighter
23 apply SilverBlade to f
24 apply FrostCodex to f
25 make h Ghoul
26 make g Golem
27 act f Cleave at h
28 expect h.Health = 270 from G252: h.Health - "Cleave hits a ghoul for 30"
29 act f Frostbite at h
30 expect h.Health = 225 from G252: h.Health - "Cleave hits a ghoul for 30" - "45, flat"
31 save
32 act f Cleave at g
33 expect g.Health = 310 from G252: g.Health - "cleave stays 20" in G251
35play G253 "Swords dance is two stages up: twice is four, and a blow of 20 is 60; four times is capped at six, 80. Two stages of defence halve it"
36 make f Fighter
37 make g Golem
38 act f SwordsDance
39 act f SwordsDance
40 expect f.AttackStage = 4 from G253: "+4 steps"
41 act f Blow at g
42 expect g.Health = 270 from G253: g.Health - "becomes 60"
43 act f SwordsDance
44 act f SwordsDance
45 expect f.AttackStage = 6 from G253: "capped at +6"
46 save
47 act f Blow at g
48 expect g.Health = 190 from G253: g.Health - "becomes 60" - "so 80"
49 apply DefenseUp 2 to g
50 act f Blow at g
51 expect g.Health = 150 from content: G253 divides by two defense steps the same way, but none of its words hold the 2 that +2 steps divide by; the blow's 80 halved to 40, off the content's 190
53play G254 "Intimidated, an attacker's blow of 20 is 13.33; a golem's iron defence, two stages, makes another's 10; the intimidated attacker's critical storm throw on the iron golem, 30, goes past both"
54 make f Fighter
55 make e Fighter
56 make g Golem
57 make k Golem
58 apply Intimidated to f
59 act f Blow at g
60 expect g.Health = 316.66666 from content: G254 gives the intimidated blow's 13.3 but leaves open its rounding and the golem's health; the content's 330 less 20 x 0.666667
61 apply DefenseUp 2 to k
62 act e Blow at k
63 expect k.Health = 320 from G254: k.Health - "golem takes 10"
64 save
65 act f StormThrow at k
66 expect k.Health = 290 from G254: k.Health - "golem takes 10" - "does 30"
68play G255 G256 "Cruel, a blow is doubled on a target at or below a third of its health. The finisher on a golem of 330 at 300 is a swing of 20 and nothing; at 110 it is a swing of 40 and 200 more"
69 make f Fighter
70 apply Cruel to f
71 make g Golem
72 deal 30 to g
73 act f Finisher at g
74 expect g.Health = 280 from G256: "330-health" - "deal 30" - "20 x"
75 save
76 deal 170 to g
77 act f Finisher at g
78 expect g.Health = 0 from content: G256 gives the 240 against the 110 left but leaves open whether health stops at none; the content's does

What a change to Health meets

Every rule in this recipe a change to Health passes through, in order. Each line is a link to the rule.

> ledger pipeline content/cookbook/sometimes.ledger Health
Health: a change to it meets 3 rules, in this order
before, at Add
  SilverBlade: Damage by holder at Add when has(event.subject, Undead) (content/cookbook/sometimes.ledger:64)
    adds to it; held by no archetype and applied by no content: the game or a play puts it on
before, at Multiply
  FrostCodex: Damage by holder having Frost at Multiply (content/cookbook/sometimes.ledger:49)
    scales it; held by no archetype and applied by no content: the game or a play puts it on
  Cruel: Damage by holder at Multiply when event.subject.Health <= event.subject.MaxHealth / 3 (content/cookbook/sometimes.ledger:103)
    scales it; held by no archetype and applied by no content: the game or a play puts it on
no archetype lacks a layer its like hold

Run it yourself

ledger check content/cookbook/sometimes.ledger content/cookbook/sometimes.play
ledger play content/cookbook/sometimes.play
ledger pipeline content/cookbook/sometimes.ledger Health