fortunes_foundation/liturgy.lua

78 lines
1.9 KiB
Lua
Raw Normal View History

2024-02-11 21:44:45 +00:00
liturgy={
2024-02-12 01:28:41 +00:00
holy_book=gsv[[rood 1`1,2
2024-02-11 21:44:45 +00:00
rood 2`3,4,5,6
2024-02-12 01:28:41 +00:00
rood 3`7,8,9,10]],
2024-02-11 21:44:45 +00:00
sacred_text_lines=gsv
[[1`come into this thicket.
1`i, o man, have a bright wreath.
1`my laurel is vibrant.
2`the hollow of a stone.
2`this, too, opens to the key.
2`the tone of music delights me.
2`the daisies.
3`whose angel is black like fish
3`is scarred like fish too.
3`i know the elk's bite.
4`a log does not eat.
4`nor does it suffer.
4`why write? why sing?
4`why answer for it?
5`a wolf that comes when called
5`is sheared of its fur.
5`distolerate sweet things.
6`they are a regiment.
6`gather them.
6`bury their warglaives.
6`burn their holy book.
6`plant them like seeds.
7`driftwood in a wash.
7`the water is speaking.
7`the bark is for beavers.
7`the twigs are for you.
8`the stormwater drowns an ox.
2024-02-11 21:52:34 +00:00
8`go to the canopy.
2024-02-12 04:12:49 +00:00
8`fire arrows down.
2024-02-11 21:44:45 +00:00
9`catching a leaf, ride it.
9`suture its veins.
9`scatter glass in the vineyard.
10`one day, the seas will boil.
10`no one will be born again.]]
}
function liturgy:init()
local verse_lines={}
for line in all(self.sacred_text_lines) do
local verse=tonum(line[1])
if (not verse_lines[verse]) verse_lines[verse]={}
add(verse_lines[verse], line[2])
end
local annotated_verses={}
for bookdata in all(self.holy_book) do
local name=bookdata[1]
local ix=1
for verse in all(split(bookdata[2])) do
local annotated_verse_name=name
local lines=verse_lines[verse]
annotated_verse_name..=":"..ix.."-"
ix+=#lines
annotated_verse_name..=ix
local annotated_verse=""
for l in all(lines) do
if (annotated_verse!="") annotated_verse..="\n"
annotated_verse..=l
end
annotated_verses[verse]={annotated_verse_name,annotated_verse}
end
end
self.annotated_verses=annotated_verses
end
liturgy:init()
function liturgy:suggest_verse(ruleset,card)
local meta=ruleset.deck.cards[card]
local i=2+meta.rank
if (meta.suit!="a") i=ruleset.preferred_verse or i
2024-02-12 01:28:41 +00:00
return i, unpack(liturgy.annotated_verses[i])
2024-02-11 21:44:45 +00:00
end