Ledger v3 · C# · Godot 4.7 Get started

Arrows

Taking an arrow out of the air, a flight as an actor.

✓ 2 plays, 42 steps, all passingFrom v2's cookbook

v2's cookbook, taking an arrow out of the air (G264-G265). An arrow is an actor and its flight an effect lasting its distance over its speed, so its landing is the flight's end (DESIGN.md, challenge 1). The game reports an arrow it draws crossing a wall; a deflection turns the flight back from where the arrow is, and its hit is the deflector's.

content/cookbook/arrows.ledgerthe content
1# v2's cookbook, taking an arrow out of the air (G264-G265). An arrow is an actor and its flight an effect lasting its
2# distance over its speed, so its landing is the flight's end (DESIGN.md, challenge 1). The game reports an arrow it
3# draws crossing a wall; a deflection turns the flight back from where the arrow is, and its hit is the deflector's.
4
5rate 60
6stat MaxHealth
7stat Armor
8pool Health max MaxHealth
9pool Charges max 3
10pool Payload
11damage Health
12link owner
13link victim
14tags Physical
15event Arrived Crossed
17effect Flight
18 lasts 1s * distance(holder.owner, holder.victim) / 10
19 expire
20 raise Arrived of holder.victim by holder
22effect Arrowhead
23 after Arrived by holder
24 deal holder.Payload Physical to event.subject from holder.owner
25 destroy holder
27archetype Arrow
28 pools Payload
29 has Flight
30 has Arrowhead
32ability Loose
33 target one within 100
34 create Arrow with owner = holder, victim = target, Payload = 10
36archetype Archer
37 base MaxHealth 100
38 full Health
39 grants Loose
41# ---- G264 the wind wall: each arrow the game says crossed it is taken out of the air, no hit and no miss, a charge
42# each; the third takes the wall ----
44effect WindWall
45 after Crossed of holder
46 destroy event.source
47 lose Charges 1
48 after Depleted Charges of holder
49 destroy holder
51archetype Wall
52 full Charges
53 has WindWall
55# ---- G265 deflecting: an arrow arriving is turned back at its shooter, flying from here, its hit the deflector's; each
56# turn-back is 5 armour for 10 seconds, refreshed by the next ----
58effect Deflecting
59 before Arrived of holder credit holder
60 prevent
61 set link victim on event.source to event.source.owner
62 set link owner on event.source to holder
63 apply Flight to event.source
64 apply Guarded
66effect Guarded
67 stack refresh
68 lasts 10s
69 Armor + 5
content/cookbook/arrows.playwhat it must do
1catalog arrows.ledger
2row G264 Flight Arrowhead WindWall Loose Arrow Archer Wall
3row G265 Flight Arrowhead Deflecting Guarded Loose Arrow Archer
4
5play G264 "Four arrows fly 10 paces a second at an archer 50 off; a wind wall halfway takes each the game says crossed it out of the air, a charge each, and goes with its third; the fourth lands for 10. An arrow taken already is taken again for nothing"
6 make s Archer at 0
7 make t Archer at 50
8 make w Wall at 25
9 act s Loose at t
10 find a1 Arrow
11 act s Loose at t
12 find a2 Arrow
13 act s Loose at t
14 find a3 Arrow
15 act s Loose at t
16 find a4 Arrow
17 advance 2.5s
18 raise Crossed of w by a1
19 expect a1 gone
20 expect w.Charges = 2 from G264: "three charges" - count "Crossed of w"
21 raise Crossed of w by a2
22 save
23 raise Crossed of w by a3
24 expect w gone
25 advance 2.5s
26 expect t.Health = 90 from content: G264 gives no health and leaves open whether a hit due exactly as the 5 s run out counts; the content lands it, 10 off its 100
27 expect a4 gone
28 destroy a1
29 expect already
31play G265 "Deflecting, an archer 30 off turns each arrow back as it arrives, 3 seconds out and 3 back, and it lands on its shooter for 10, the deflector's; each turn-back is 5 armour for 10 seconds, the second refreshing it"
32 make s Archer at 0
33 make d Archer at 30
34 apply Deflecting to d
35 act s Loose at d
36 advance 1s
37 act s Loose at d
38 advance 2s
39 expect d.Health = 100 from G265: d.Health
40 expect d.Armor = 5 from G265: "5 armor"
41 expect d remaining Guarded = 10s from G265: "for 10 s"
42 save
43 advance 1s
44 expect d remaining Guarded = 10s from G265: "for 10 s"
45 advance 2s
46 expect s.Health = 90 from G265: s.Health - "for 10 damage"
47 expect event Change of s credited to d tagged Damage
48 advance 1s
49 expect s.Health = 80 from G265: s.Health - count "s Loose at d" * "for 10 damage"

Run it yourself

ledger check content/cookbook/arrows.ledger content/cookbook/arrows.play
ledger play content/cookbook/arrows.play