Preservation commit before deciding on a data format

This commit is contained in:
Louis Burke 2024-09-16 00:38:22 -04:00
parent 9089c78aec
commit 33db092023
15 changed files with 1669 additions and 25 deletions

View file

@ -8,25 +8,9 @@ default: check decks
all: check decks export all: check decks export
prototype: mini prototype: mini
# Check existence of necessary executables ASSET_TOML=assets.toml
CONVERT:=$(shell command -v convert 2> /dev/null)
XELATEX:=$(shell command -v xelatex 2> /dev/null)
PDFTOPPM:=$(shell command -v pdftoppm 2> /dev/null)
PDFUNITE:=$(shell command -v pdfunite 2> /dev/null)
check: $(SENTINEL) include rules/*.mk
ifndef CONVERT
$(error "convert not found. Please install imagemagick")
endif
ifndef XELATEX
$(error "xelatex not found. Please install xetex")
endif
ifndef PDFTOPPM
$(error "pdftoppm not found. Please install poppler")
endif
ifndef PDFUNITE
$(error "pdfunite not found. Please install poppler")
endif
RAW_DECK_LIST=$(shell ./scripts/decklist.sh) first second third RAW_DECK_LIST=$(shell ./scripts/decklist.sh) first second third
DECK_LIST=$(RAW_DECK_LIST:%=$(GENERATED_DIR)/%) DECK_LIST=$(RAW_DECK_LIST:%=$(GENERATED_DIR)/%)
@ -59,13 +43,7 @@ $(SENTINEL): cards.sql
Makefile.deps: $(SENTINEL) $(DECK_DEPENDENCIES) Makefile.deps: $(SENTINEL) $(DECK_DEPENDENCIES)
cat $^ > $@ cat $^ > $@
include Makefile.deps #include Makefile.deps
outputs/iditaboard[face].png: iditaboard.pdf
$(PDFTOPPM) -scale-to-x 4875 -scale-to-y 3075 -png $< > $@
outputs/cardback.png: cardback.png
cp $< $@
export: outputs/cardback.png export: outputs/cardback.png
export: outputs/iditaboard[face].png export: outputs/iditaboard[face].png

44
assets.toml Normal file
View file

@ -0,0 +1,44 @@
# This file describes the assets of iditacards
# It is processed to produce the various source files that are then compiled
# into assets
# NOTE: [a. b] indicates that the object will be processed through the mako
# template templates/a.mako and output to generated/b. (templates/ and
# generated/ specified by arguments)
[card. "a_hat.tex"]
name = "A Hat"
costs.energy = 2
costs.health = 2
effects = { daydraw = "+1" }
image = "hat"
type = "attachment"
flavour = "I bet its a valve hat."
[card. "dog_chow.tex"]
name = "Dog Chow"
costs.energy = 3
cards.health = 3
effects = { speed = "+1" }
image = "dog_chow"
type = "attachment"
flavour = "A hungry dog is a slow dog."
[card. "good_dog.tex"]
name = "Good Dog"
costs.energy = 3
costs.health = 3
effects = { daydraw = "+1" }
image = "good_dog"
type = "dog"
flavour = "Good boy."
[deck. "starter1.mk"]
name = "starter1"
[deck. "starter1.mk". contents]
"A hat" = 1
"Breakfast" = 2

641
assets.yaml Normal file
View file

@ -0,0 +1,641 @@
# This file describes the assets of iditacards
# vim: fdm=marker
# It is processed to produce various source files that are then compiled into
# assets
# TODO: Change the system to be more like the toml. Just have a: b: generate
# b using a.mako, but a: -b does not. (except unlike l4den, yaml can't mix
# arrays and objects, so maybe use _: -b -c -...?)
# Any object with an "output" key will be processed to produce said output by
# using its "template" key as a mako template and passing "data" is data.
cards: # {{{
- &a_hat
name: 'A Hat'
costs:
energy: 2
health: 2
effects:
- '\daydraw{+1}'
image: hat
type: attachment
flavour: 'I bet its a valve hat.'
- &dog_chow
name: 'Dog Chow'
costs:
energy: 3
health: 3
effects:
- '\speed{+1}'
image: dog_chow
type: attachment
flavour: 'A hungry dog is a slow dog.'
- &good_dog
name: 'Good Dog'
costs:
energy: 3
health: 3
effects:
- '\daydraw{+1}'
image: good_dog
type: dog
flavour: 'Good boy.'
- &husky
name: 'Husky'
costs:
energy: 2
health: 2
risk: 2
effects:
- '\daydraw{+1}'
- '\speed{+1}'
image: husky
type: dog
flavour: 'Standard mushing fare.'
- &wheel_dog
name: 'Wheel Dog'
costs:
energy: 3
health: 3
effects:
- '\speed{+1}'
- '\discardonkill'
- '\inplayatstart'
image: wheel_dog
type: dog
flavour: 'The dog right in front of the sled. Strong and steady.'
- &breakfast
name: 'Breakfast'
costs:
health: 3
effects:
- '\draw{3}'
image: breakfast
type: food
flavour: 'The most important meal of the day.'
- &lunch
name: 'Lunch'
costs:
energy: 3
effects:
- '\draw{3}'
image: lunch
type: food
flavour: 'What about second breakfast?'
- &dinner
name: 'Dinner'
costs:
energy: 2
health: 2
effects:
- '\draw{7}'
image: dinner
type: food
flavour: 'I hope you like salted fish.'
- &move
name: 'Move'
effects:
- '\move{1}'
image: move
type: movement
flavour: 'Just another day.'
- &mush
name: 'Mush'
costs:
energy: 2
health: 2
risk: 1
effects:
- '\move{10}'
image: mush
type: movement
flavour: "Comes from the french word ``Marche''."
- &first_aid
name: First Aid
costs:
energy: 2
health: 2
effects:
- '\see{3}'
- '\destroy{1}'
image: first_aid
type: personal
flavour: 'Reduces swelling.'
- &grandma_soup
name: Grandma Soup
costs:
energy: 1
health: 2
risk: 1
effects:
- '\see{10}'
- '\destroy{2}'
image: grandma_soup
type: personal
flavour: 'Cures what ails you.'
- &repair_sled
name: Repair Sled
costs:
energy: 1
health: 3
effects:
- '\supply{1}'
- '\take{2}'
image: repair_sled
type: sled
flavour: "It doesn't need to be pretty. It just has to work."
- &upgrade_sled
name: Upgrade Sled
costs:
energy: 2
health: 2
effects:
- '\supply{3}'
- '\take{1}'
image: upgrade_sled
type: sled
flavour: 'You have to keep your ride in top shape.'
- &buffer_panel
name: Buffer Panel
costs:
energy: 2
health: 2
effects:
- '\immortal'
- '\safepass'
image: buffer_panel
type: attachment
flavour: 'Did the primary buffer panel just fall of my gorram ship for no apparent reason?'
- &nuclear_reactor
name: Nuclear Reactor
costs:
energy: 2
health: 2
effects:
- '\speed{+5}'
- '\passdie'
image: nuclear_reactor
type: attachment
flavour: 'What could go wrong?'
- &engineer_dog
name: Engineer Dog
costs:
energy: 3
health: 5
risk: 1
effects:
- '\speed{$\times 2$}'
- '\nohold'
image: engineer_dog
type: dog
flavour: 'Nails and Gears.'
- &moose
name: Moose
costs:
energy: 5
risk: 3
effects:
- '\speed{+5}'
- '\immortal'
image: moose
type: dog
flavour: 'Majestic creatures. Hard to tame.'
- &waffle
name: Waffle
effects:
- '\draw{2}'
image: waffles
type: food
flavour: 'Waffles are \textbf{delicious}.'
- &whale_meat
name: Whale Meat
costs:
energy: 1
health: 1
effects:
- '\draw{5}'
- '\nohypothermia'
image: whale_meat
type: food
flavour: "It's like rubber."
- &hitch_a_ride
name: Hitch a Ride
costs:
energy: 1
effects:
- '\move{6}'
- '\damage{1}'
image: hitch_a_ride
type: movement
flavour: 'Probably not in the spirit of the race.'
- &tactical_play
name: Tactical Play
costs:
energy: 1
risk: 1
effects:
- '\move{0}'
- '\doubledistance'
image: tactical_play
type: movement
flavour: 'Make the most of it.'
- &meditate
name: Meditate
costs:
energy: 1
health: 1
effects:
- '\see{all}'
- '\destroy{0}'
image: meditate
type: personal
flavour: 'It \textit{is} just sitting.'
- &diamorphine
name: Diamorphine
costs:
energy: 1
health: 1
risk: 1
effects:
- '\see{all}'
- '\destroy{all}'
image: diamorphine
type: personal
flavour: 'Highly addicting.'
- &desperate_times
name: Desperate Times
costs:
energy: all
effects:
- '\supply{10}'
- '\take{5}'
image: desparate_times
type: sled
flavour: 'Desperate measures hotline, how may I help you?'
- &lead_sled
name: Lead Sled
costs:
energy: 1
health: 1
risk: 1
effects:
- '\supply{10}'
- '\take{10}'
image: lead_sled
type: sled
flavour: "At least it's not a zeppelin."
- &damaged
name: Damaged
costs:
energy: 1
health: 1
effects:
- '\damagetext'
image: damaged
type: damage
flavour: 'You have been hurt.'
- &dog_shoes
name: Dog Shoes
costs:
energy: 2
health: 3
effects:
- '\speed{+2}'
image: dog_shoes
type: attachment
flavour: 'Dogs look cute in shoes.'
- &squirrel
name: Squirrel
costs:
energy: 2
health: 2
risk: 1
effects:
- '\speed{+3}'
image: squirrel
type: attachment
flavour: 'Dogs \emph{hate} squirrels.'
- &tiara
name: Tiara
costs:
energy: 2
health: 2
risk: 1
effects:
- '\daydraw{+1}'
- '\speed{+1}'
image: tiara
type: attachment
flavour: 'Makes the dog feel special.'
- &bear
name: Bear
costs:
energy: 2
health: 2
risk: 2
effects:
- '\speed{+5}'
image: bear
type: dog
flavour: 'In hindsight, not the best idea.'
- &big_dog
name: Big Dog
costs:
energy: 2
health: 2
effects:
- '\speed{+3}'
image: big_dog
type: dog
flavour: "He's not red though."
- &greyhound
name: Greyhound
costs:
risk: 2
effects:
- '\speed{+3}'
- '\nohold'
image: greyhound
type: dog
flavour: 'What happens when you mix the colours on a husky? You get a grey hound.'
- &malamute
name: Malamute
costs:
energy: 2
health: 2
risk: 1
effects:
- '\daydraw{+2}'
image: malamute
type: dog
flavour: 'A common sled hauling breed.'
- &problem_dog
name: Problem Dog
costs:
energy: 1
health: 1
risk: 1
effects:
- '\daydraw{-1}'
- '\speed{+3}'
image: problem_dog
type: dog
flavour: "I swear, if you weren't so fast."
- &bison
name: Bison
costs:
energy: 2
risk: 1
effects:
- '\draw{5}'
image: bison
type: food
flavour: "It's very lean."
- &poutine
name: Poutine
costs:
health: 2
effects:
- '\draw{1}'
- '\nohypothermia'
image: poutine
type: food
flavour: 'The great Canadian carb!'
- &venison
name: Venison
costs:
health: 2
effects:
- '\draw{3}'
image: venison
type: food
flavour: 'Better than breakfast.'
- &steak
name: Steak
effects:
- '\draw{1}'
image: steak
type: food
flavour: "Well aren't you fancy."
- &jerky
name: Jerky
costs:
energy: 1
health: 1
effects:
- '\draw{3}'
image: jerky
type: food
flavour: 'Watch your sodium!'
- &midnight_sun
name: Midnight Sun
costs:
energy: 1
health: 1
risk: 1
effects:
- '\move{10}'
image: midnight_sun
type: movement
flavour: 'Strange things are done in the midnight sun.'
- &push
name: Push
costs:
energy: 1
effects:
- '\move{5}'
image: push
type: movement
flavour: 'Not a full mush, but still putting in some effort.'
- &slow_and_steady
name: Slow and Steady
effects:
- '\draw{1}'
- '\move{0}'
image: slow_and_steady
type: movement
flavour: 'Maybe a bit too slow.'
- &band_aid
name: Band Aid
effects:
- '\see{1}'
- '\destroy{1}'
image: band_aid
type: personal
flavour: 'Not much.'
- &bandage
name: Bandage
costs:
energy: 1
effects:
- '\see{5}'
- '\destroy{1}'
image: bandage
type: personal
flavour: 'Make sure you wrap it tight.'
- &brandy
name: Brandy
costs:
risk: 1
effects:
- '\see{5}'
- '\destroy{1}'
image: brandy
type: personal
flavour: 'Brought by a St.\ Bernard'
- &caffeine
name: Caffeine
costs:
health: 2
effects:
- '\draw{1}'
- '\see{2}'
- '\destroy{1}'
image: caffeine
type: personal
flavour: 'The greatest addiction ever.'
- &improvise
name: Improvise
effects:
- '\take{1}'
image: improvise
type: sled
flavour: 'MacGyver of the north.'
- &makeshift_sled
name: Makeshift Sled
costs:
energy: 1
health: 1
effects:
- '\supply{2}'
- '\take{6}'
image: makeshift_sled
type: sled
flavour: "Rickety, but it'll hold."
- &salvage
name: Salvage
costs:
energy: 1
health: 1
effects:
- '\supply{3}'
- '\take{2}'
image: salvage
type: sled
flavour: 'Take the good with the bad.'
- &antique_sled
name: Antique Sled
costs:
health: 5
effects:
- '\supply{2}'
- '\take{8}'
image: antique_sled
type: sled
flavour: 'Withstood the test of the time.'
- &rush
name: Rush
costs:
health: 3
risk: 1
effects:
- '\move{8}'
image: rush
type: movement
flavour: 'Hurry up!'
- &supply_run
name: Supply Run
effects:
- '\move{3}'
image: supply_run
type: movement
flavour: 'Not as easy as dropping by the grocery store.'
# }}}
decks:
- name: Starter1
cards:
- &a_hat1
data:
<<: *a_hat
rarity: common
deck: Starter1
output: "cards/a_hat1.tex"
template: "templates/card.mako"
- *breakfast
- *breakfast
- *dinner
- *dog_chow
- *first_aid
- *first_aid
- *good_dog
- *grandma_soup
- *husky
- *lunch
- *lunch
- *move
- *move
- *move
- *move
- *mush
- *repair_sled
- *repair_sled
- *upgrade_sled
- *upgrade_sled
- *wheel_dog

838
cards.yaml.recovered Normal file
View file

@ -0,0 +1,838 @@
# The cards
cards:
- &a_hat
name: 'A Hat'
costs:
energy: 2
health: 2
effects:
- '\daydraw{+1}'
image: hat
type: attachment
flavour: 'I bet its a valve hat.'
- &dog_chow
name: 'Dog Chow'
costs:
energy: 3
health: 3
effects:
- '\speed{+1}'
image: dog_chow
type: attachment
flavour: 'A hungry dog is a slow dog.'
- &good_dog
name: 'Good Dog'
costs:
energy: 3
health: 3
effects:
- '\daydraw{+1}'
image: good_dog
type: dog
flavour: 'Good boy.'
- &husky
name: 'Husky'
costs:
energy: 2
health: 2
risk: 2
effects:
- '\daydraw{+1}'
- '\speed{+1}'
image: husky
type: dog
flavour: 'Standard mushing fare.'
- &wheel_dog
name: 'Wheel Dog'
costs:
energy: 3
health: 3
effects:
- '\speed{+1}'
- '\discardonkill'
- '\inplayatstart'
image: wheel_dog
type: dog
flavour: 'The dog right in front of the sled. Strong and steady.'
- &breakfast
name: 'Breakfast'
costs:
health: 3
effects:
- '\draw{3}'
image: breakfast
type: food
flavour: 'The most important meal of the day.'
- &lunch
name: 'Lunch'
costs:
energy: 3
effects:
- '\draw{3}'
image: lunch
type: food
flavour: 'What about second breakfast?'
- &dinner
name: 'Dinner'
costs:
energy: 2
health: 2
effects:
- '\draw{7}'
image: dinner
type: food
flavour: 'I hope you like salted fish.'
- &move
name: 'Move'
effects:
- '\move{1}'
image: move
type: movement
flavour: 'Just another day.'
- &mush
name: 'Mush'
costs:
energy: 2
health: 2
risk: 1
effects:
- '\move{10}'
image: mush
type: movement
flavour: "Comes from the french word ``Marche''."
- &first_aid
name: First Aid
costs:
energy: 2
health: 2
effects:
- '\see{3}'
- '\destroy{1}'
image: first_aid
type: personal
flavour: 'Reduces swelling.'
- &grandma_soup
name: Grandma Soup
costs:
energy: 1
health: 2
risk: 1
effects:
- '\see{10}'
- '\destroy{2}'
image: grandma_soup
type: personal
flavour: 'Cures what ails you.'
- &repair_sled
name: Repair Sled
costs:
energy: 1
health: 3
effects:
- '\supply{1}'
- '\take{2}'
image: repair_sled
type: sled
flavour: "It doesn't need to be pretty. It just has to work."
- &upgrade_sled
name: Upgrade Sled
costs:
energy: 2
health: 2
effects:
- '\supply{3}'
- '\take{1}'
image: upgrade_sled
type: sled
flavour: 'You have to keep your ride in top shape.'
- &buffer_panel
name: Buffer Panel
costs:
energy: 2
health: 2
effects:
- '\immortal'
- '\safepass'
image: buffer_panel
type: attachment
flavour: 'Did the primary buffer panel just fall of my gorram ship for no apparent reason?'
- &nuclear_reactor
name: Nuclear Reactor
costs:
energy: 2
health: 2
effects:
- '\speed{+5}'
- '\passdie'
image: nuclear_reactor
type: attachment
flavour: 'What could go wrong?'
- &engineer_dog
name: Engineer Dog
costs:
energy: 3
health: 5
risk: 1
effects:
- '\speed{$\times 2$}'
- '\nohold'
image: engineer_dog
type: dog
flavour: 'Nails and Gears.'
- &moose
name: Moose
costs:
energy: 5
risk: 3
effects:
- '\speed{+5}'
- '\immortal'
image: moose
type: dog
flavour: 'Majestic creatures. Hard to tame.'
- &waffle
name: Waffle
effects:
- '\draw{2}'
image: waffles
type: food
flavour: 'Waffles are \textbf{delicious}.'
- &whale_meat
name: Whale Meat
costs:
energy: 1
health: 1
effects:
- '\draw{5}'
- '\nohypothermia'
image: whale_meat
type: food
flavour: "It's like rubber."
- &hitch_a_ride
name: Hitch a Ride
costs:
energy: 1
effects:
- '\move{6}'
- '\damage{1}'
image: hitch_a_ride
type: movement
flavour: 'Probably not in the spirit of the race.'
- &tactical_play
name: Tactical Play
costs:
energy: 1
risk: 1
effects:
- '\move{0}'
- '\doubledistance'
image: tactical_play
type: movement
flavour: 'Make the most of it.'
- &meditate
name: Meditate
costs:
energy: 1
health: 1
effects:
- '\see{all}'
- '\destroy{0}'
image: meditate
type: personal
flavour: 'It \textit{is} just sitting.'
- &diamorphine
name: Diamorphine
costs:
energy: 1
health: 1
risk: 1
effects:
- '\see{all}'
- '\destroy{all}'
image: diamorphine
type: personal
flavour: 'Highly addicting.'
- &desperate_times
name: Desperate Times
costs:
energy: all
effects:
- '\supply{10}'
- '\take{5}'
image: desparate_times
type: sled
flavour: 'Desperate measures hotline, how may I help you?'
- &lead_sled
name: Lead Sled
costs:
energy: 1
health: 1
risk: 1
effects:
- '\supply{10}'
- '\take{10}'
image: lead_sled
type: sled
flavour: "At least it's not a zeppelin."
- &damaged
name: Damaged
costs:
energy: 1
health: 1
effects:
- '\damagetext'
image: damaged
type: damage
flavour: 'You have been hurt.'
- &dog_shoes
name: Dog Shoes
costs:
energy: 2
health: 3
effects:
- '\speed{+2}'
image: dog_shoes
type: attachment
flavour: 'Dogs look cute in shoes.'
- &squirrel
name: Squirrel
costs:
energy: 2
health: 2
risk: 1
effects:
- '\speed{+3}'
image: squirrel
type: attachment
flavour: 'Dogs \emph{hate} squirrels.'
- &tiara
name: Tiara
costs:
energy: 2
health: 2
risk: 1
effects:
- '\daydraw{+1}'
- '\speed{+1}'
image: tiara
type: attachment
flavour: 'Makes the dog feel special.'
- &bear
name: Bear
costs:
energy: 2
health: 2
risk: 2
effects:
- '\speed{+5}'
image: bear
type: dog
flavour: 'In hindsight, not the best idea.'
- &big_dog
name: Big Dog
costs:
energy: 2
health: 2
effects:
- '\speed{+3}'
image: big_dog
type: dog
flavour: "He's not red though."
- &greyhound
name: Greyhound
costs:
risk: 2
effects:
- '\speed{+3}'
- '\nohold'
image: greyhound
type: dog
flavour: 'What happens when you mix the colours on a husky? You get a grey hound.'
- &malamute
name: Malamute
costs:
energy: 2
health: 2
risk: 1
effects:
- '\daydraw{+2}'
image: malamute
type: dog
flavour: 'A common sled hauling breed.'
- &problem_dog
name: Problem Dog
costs:
energy: 1
health: 1
risk: 1
effects:
- '\daydraw{-1}'
- '\speed{+3}'
image: problem_dog
type: dog
flavour: "I swear, if you weren't so fast."
- &bison
name: Bison
costs:
energy: 2
risk: 1
effects:
- '\draw{5}'
image: bison
type: food
flavour: "It's very lean."
- &poutine
name: Poutine
costs:
health: 2
effects:
- '\draw{1}'
- '\nohypothermia'
image: poutine
type: food
flavour: 'The great Canadian carb!'
- &venison
name: Venison
costs:
health: 2
effects:
- '\draw{3}'
image: venison
type: food
flavour: 'Better than breakfast.'
- &steak
name: Steak
effects:
- '\draw{1}'
image: steak
type: food
flavour: "Well aren't you fancy."
- &jerky
name: Jerky
costs:
energy: 1
health: 1
effects:
- '\draw{3}'
image: jerky
type: food
flavour: 'Watch your sodium!'
- &midnight_sun
name: Midnight Sun
costs:
energy: 1
health: 1
risk: 1
effects:
- '\move{10}'
image: midnight_sun
type: movement
flavour: 'Strange things are done in the midnight sun.'
- &push
name: Push
costs:
energy: 1
effects:
- '\move{5}'
image: push
type: movement
flavour: 'Not a full mush, but still putting in some effort.'
- &slow_and_steady
name: Slow and Steady
effects:
- '\draw{1}'
- '\move{0}'
image: slow_and_steady
type: movement
flavour: 'Maybe a bit too slow.'
- &band_aid
name: Band Aid
effects:
- '\see{1}'
- '\destroy{1}'
image: band_aid
type: personal
flavour: 'Not much.'
- &bandage
name: Bandage
costs:
energy: 1
effects:
- '\see{5}'
- '\destroy{1}'
image: bandage
type: personal
flavour: 'Make sure you wrap it tight.'
- &brandy
name: Brandy
costs:
risk: 1
effects:
- '\see{5}'
- '\destroy{1}'
image: brandy
type: personal
flavour: 'Brought by a St.\ Bernard'
- &caffeine
name: Caffeine
costs:
health: 2
effects:
- '\draw{1}'
- '\see{2}'
- '\destroy{1}'
image: caffeine
type: personal
flavour: 'The greatest addiction ever.'
- &improvise
name: Improvise
effects:
- '\take{1}'
image: improvise
type: sled
flavour: 'MacGyver of the north.'
- &makeshift_sled
name: Makeshift Sled
costs:
energy: 1
health: 1
effects:
- '\supply{2}'
- '\take{6}'
image: makeshift_sled
type: sled
flavour: "Rickety, but it'll hold."
- &salvage
name: Salvage
costs:
energy: 1
health: 1
effects:
- '\supply{3}'
- '\take{2}'
image: salvage
type: sled
flavour: 'Take the good with the bad.'
- &antique_sled
name: Antique Sled
costs:
health: 5
effects:
- '\supply{2}'
- '\take{8}'
image: antique_sled
type: sled
flavour: 'Withstood the test of the time.'
- &rush
name: Rush
costs:
health: 3
risk: 1
effects:
- '\move{8}'
image: rush
type: movement
flavour: 'Hurry up!'
- &supply_run
name: Supply Run
effects:
- '\move{3}'
image: supply_run
type: movement
flavour: 'Not as easy as dropping by the grocery store.'
# The decks that the cards are in
# TODO: Add rarity?
decks:
- name: Starter1
cards:
- *a_hat
- *breakfast
- *breakfast
- *dinner
- *dog_chow
- *first_aid
- *first_aid
- *good_dog
- *grandma_soup
- *husky
- *lunch
- *lunch
- *move
- *move
- *move
- *move
- *mush
- *repair_sled
- *repair_sled
- *upgrade_sled
- *upgrade_sled
- *wheel_dog
- name: Starter2
cards:
- *a_hat
- *breakfast
- *breakfast
- *dinner
- *dog_chow
- *first_aid
- *first_aid
- *good_dog
- *grandma_soup
- *husky
- *lunch
- *lunch
- *move
- *move
- *move
- *move
- *mush
- *repair_sled
- *repair_sled
- *upgrade_sled
- *upgrade_sled
- *wheel_dog
- name: Starter3
cards:
- *a_hat
- *breakfast
- *breakfast
- *dinner
- *dog_chow
- *first_aid
- *first_aid
- *good_dog
- *grandma_soup
- *husky
- *lunch
- *lunch
- *move
- *move
- *move
- *move
- *mush
- *repair_sled
- *repair_sled
- *upgrade_sled
- *upgrade_sled
- *wheel_dog
- name: Starter4
cards:
- *a_hat
- *breakfast
- *breakfast
- *dinner
- *dog_chow
- *first_aid
- *first_aid
- *good_dog
- *grandma_soup
- *husky
- *lunch
- *lunch
- *move
- *move
- *move
- *move
- *mush
- *repair_sled
- *repair_sled
- *upgrade_sled
- *upgrade_sled
- *wheel_dog
- name: Damage
cards:
- *damaged
- *damaged
- *damaged
- *damaged
- *damaged
- *damaged
- *damaged
- *damaged
- *damaged
- *damaged
- name: Legendary
cards:
- *buffer_panel
- *desperate_times
- *diamorphine
- *engineer_dog
- *hitch_a_ride
- *lead_sled
- *meditate
- *moose
- *nuclear_reactor
- *tactical_play
- *waffle
- *whale_meat
- name: Race
cards:
- *bear
- *bear
- *big_dog
- *big_dog
- *dog_shoes
- *dog_shoes
- *greyhound
- *greyhound
- *improvise
- *improvise
- *midnight_sun
- *midnight_sun
- *problem_dog
- *problem_dog
- *push
- *push
- *rush
- *rush
- *slow_and_steady
- *slow_and_steady
- *squirrel
- *squirrel
- *supply_run
- *supply_run
- *tiara
- *tiara
- name: Survival
cards:
- *antique_sled
- *antique_sled
- *band_aid
- *band_aid
- *bandage
- *bandage
- *bison
- *bison
- *brandy
- *brandy
- *caffeine
- *caffeine
- *jerky
- *jerky
- *makeshift_sled
- *makeshift_sled
- *malamute
- *malamute
- *poutine
- *poutine
- *salvage
- *salvage
- *steak
- *steak
- *venison
- *venison
Legs:
- &farm
name: Farm
effects:
- '\allowednot{\includegraphics[width=1cm]{icons/starve.png}}'
spaces:
3: hypo
5: damage
7: hypo
- &fishing_hole
name: Fishing Hole
effects:
- '\daydraw{3}'
spaces:
3: damage
5: hypo
7: damage
- &hospital
name: Hospital
effects:
- '\freecardtype{personal}'
spaces:
3: starve
5: hypo
7: starve
- &new_moon
name: New Moon
effects:
- '\freecardtype{dog}'
spaces:
3: hypo
5: starve
7: hypo
- &repair_shop
name: Repair Shop
effects:
- '\freecardtype{sled}'
Legdecks:
- name: First
legs:
- *farm
- *fishing_hole
- *hospital
- *new_moon
# TODO: add legs

37
make_mako.py Normal file
View file

@ -0,0 +1,37 @@
#!/usr/bin/env python3
"""
Used as a tool by the Makefile to generate sources from the assets.toml file.
"""
import toml
from mako.template import Template
def update_file(fname, contents):
"""
Updates the given file with the given contents unless .fname.hash matches
hash(contents).
"""
try:
with open(f'.{fname}.hash', 'r') as fhash:
if fhash.read() == str(contents):
return
except:
pass
with open(fname, 'w') as f:
f.write(contents)
def main(infile, outdir):
"""
Entry point: generates outputs based on data in input files.
"""
with open(infile, 'r') as f:
data = toml.load(infile)
for template_name in data:
template = Template(filename=template_name)
for output_name in data[template_name]:
result = template.render(**data[template_name][output_name])
update_file(outdir + '/' + output_name, result)

18
rules/checks.mk Normal file
View file

@ -0,0 +1,18 @@
# Checks existence of necessary executables
CONVERT:=$(shell command -v convert 2> /dev/null)
XELATEX:=$(shell command -v xelatex 2> /dev/null)
PDFTOPPM:=$(shell command -v pdftoppm 2> /dev/null)
PDFUNITE:=$(shell command -v pdfunite 2> /dev/null)
ifndef CONVERT
$(error "convert not found. Please install imagemagick")
endif
ifndef XELATEX
$(error "xelatex not found. Please install xetex")
endif
ifndef PDFTOPPM
$(error "pdftoppm not found. Please install poppler")
endif
ifndef PDFUNITE
$(error "pdfunite not found. Please install poppler")
endif

6
rules/conversion.mk Normal file
View file

@ -0,0 +1,6 @@
%.pdf: %.tex
$(XELATEX) -interaction=batchmode -halt-on-error --shell-escape --output-directory=$(@D) $<
rm $*.aux
rm $*.log

6
rules/generated.mk Normal file
View file

@ -0,0 +1,6 @@
ASSET_NAMES=$(shell aq -it -oj -r '.[] | keys | .[]' < $(ASSET_TOML))
GENERATED_SOURCES=$(ASSET_NAMES:%=$(GENERATED_DIR)/%)
update_sources: $(ASSET_TOML)
./make_mako.py $^ $(GENERATED_DIR)

15
rules/mako.mk Normal file
View file

@ -0,0 +1,15 @@
ASSETS=$(shell aq -it -oj -r '.[] | keys[]' < $(ASSET_TOML))
GENERATED_ASSETS=$(patsubst %,generated/%,$(ASSETS))
MAKO_SCRIPT=from mako.template import Template; \
import json; \
import sys; \
print(Template(filename=sys.argv[1]).render(**json.load(sys.stdin)))
AQ_FIND_SCRIPT=to_entries[] | select(.value|has("$*"))
$(GENERATED_ASSETS): generated/%: $(ASSET_TOML)
TEMPLATE="templates/$$(aq -it -oj -r '$(AQ_FIND_SCRIPT) | .key' < $^).mako"; \
aq -it -oj '$(AQ_FIND_SCRIPT) | .value["$*"]' < $^ \
| python -c '$(MAKO_SCRIPT)' "$$TEMPLATE" > $@.raw
rsync --remove-source-files --checksum $@.raw $@

7
rules/outputs.mk Normal file
View file

@ -0,0 +1,7 @@
outputs/iditaboard[face].png: iditaboard.pdf
$(PDFTOPPM) -scale-to-x 4875 -scale-to-y 3075 -png $< > $@
outputs/cardback.png: cardback.png
cp $< $@

4
rules/rsync.mk Normal file
View file

@ -0,0 +1,4 @@
# Shorthand rule for copying the standard input to the result file
define rsync-copy
cat > $@.raw; rsync --remove-source-files --checksum $@.raw $@
endef

6
templates/card.mako Normal file
View file

@ -0,0 +1,6 @@
## % TODO: how to get the deck info?
\documentclass{iditacard}
\cardtype{${type}}
## \rarity{${rarity}}
## \deck{${deck}}

10
templates/deck.mako Normal file
View file

@ -0,0 +1,10 @@
<%
# Creates a flattened map of repeated elements
components = [x for (k, v) in contents.items() for x in [k]*v]
%>
outputs/${name}.pdf: ${' '.join(components)}; pdfunite $+ $@
% for (card, count) in contents.items():
export: outputs/generated/${name}/${card}[${count}].png
outputs/generated/${name}/${card}[${count}].png: generated/${card}.png; cp $^ $@
% endfor
decks: outputs/${name}.pdf

3
templates/test.mako Normal file
View file

@ -0,0 +1,3 @@
% for (k, v) in data.items():
${k} is ${v}!
% endfor

31
test.json Normal file
View file

@ -0,0 +1,31 @@
{
"data": {
"a_hat.tex": {
"name": "A Hat",
"costs": {
"energy": 2,
"health": 2
},
"effects": {
"daydraw": "+1"
},
"image": "hat",
"type": "attachment",
"flavour": "I bet its a valve hat."
},
"dog_chow.tex": {
"name": "Dog Chow",
"costs": {
"energy": 3
},
"cards": {
"health": 3
},
"effects": {
"speed": "+1"
},
"image": "dog_chow",
"type": "attachment",
"flavour": "A hungry dog is a slow dog."
}
}}