Uncommited changes of unknown quality

This commit is contained in:
Louis Burke 2021-11-24 19:52:32 -05:00
parent 9e6cd3d4ea
commit 9089c78aec
12 changed files with 1041 additions and 28 deletions

View file

@ -82,7 +82,7 @@ instructions.pdf: instructions.tex instructions-anatomy.pdf
mini: decks
pdfunite outputs/*.pdf tmp.pdf
pdfnup --nup 3x3 tmp.pdf --no-landscape --delta '0.5cm 0.5cm' --scale 0.9 -o outputs/mini_printrun.pdf
pdfjam --nup 3x3 tmp.pdf --no-landscape --delta '0.5cm 0.5cm' --scale 0.9 -o outputs/mini_printrun.pdf
rm tmp.pdf
force-make:

9
README.md Normal file
View file

@ -0,0 +1,9 @@
# Iditacards!
This is the "source code" for the Iditacards card game.
This README file is intended to explain the organization and methodology of the
project.
If you just want to create all necessary assets, a simple `make all` should do
the trick.

BIN
cards.db Normal file

Binary file not shown.

833
cards.yaml Normal file
View file

@ -0,0 +1,833 @@
# 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
Legdecks:
- name: First
legs:
- *farm
- *fishing_hole
- *hospital
- *new_moon
# TODO: add legs

5
ideas
View file

@ -1,3 +1,8 @@
Add "blank" cards for people to put their own dogs on!
Use a more legible/accessible database format. Perhaps a custom format with easy
tooling or a csv-like format.
6 of each type of stretch:
First: Daydraw+3(HH), free dogs(SH), free personal(HS), free sleds(SS), no hypo(SS), no starve(HH)

View file

@ -256,6 +256,10 @@
\node [rectangle, anchor=center, minimum width=1.5cm, minimum height=1.5cm, text centered, text width=1.5cm, inner sep=0mm] at (\legcoordx{#1},\legcoordy{#1}) {#2};
}
\newcommand{\legspaceicon}[1]{%
\includegraphics[width=1cm]{icons/#1.png}
}
\newcommand{\legeffect}[1]{%
\node [rectangle, anchor=center, text centered, inner sep=0mm] at (3.175, 5.0) {\fontsize{16}{16}\bebas Effect};
\node [rectangle, anchor=center, text centered, inner sep=0mm] at (3.175, 3.85) {#1};

View file

@ -9,6 +9,9 @@
\usepackage{fancybox}
\usepackage{wrapfig}
\usepackage{subfig}
\usepackage{fontspec}
\newfontfamily\bebas{Bebas Neue Regular}
\titleformat{name=\section}[display]{}{\thetitle.}{0.8em}{\Heading\Large}
%\titlespacing{\section}{0pt}{0pt plus 4pt minus 4pt}{0pt plus 4pt minus 4pt}
@ -93,11 +96,11 @@ bottom right corner:
\begin{itemize}
\setlength\itemsep{-1em}
\item 4 Starter Decks - \input "|echo SELECT 'SUM(Amount)' FROM Deck_Cards JOIN Decks ON Decks.id = Deck_Cards.Deck WHERE Decks.Name = \'starter1\' | sqlite3 -init cards.sql" cards each (\includegraphics[width=1em]{images/deck/starter1.png} \includegraphics[width=1em]{images/deck/starter2.png} \includegraphics[width=1em]{images/deck/starter3.png} \includegraphics[width=1em]{images/deck/starter4.png})
\item 1 Legendary Deck - \input "|echo SELECT 'SUM(Amount)' FROM Deck_Cards JOIN Decks ON Decks.id = Deck_Cards.Deck WHERE Decks.Name = \'legendary\' | sqlite3 -init cards.sql" cards (\includegraphics[width=1em]{images/deck/legendary.png})
\item 1 Survival Deck - \input "|echo SELECT 'SUM(Amount)' FROM Deck_Cards JOIN Decks ON Decks.id = Deck_Cards.Deck WHERE Decks.Name = \'survival\' | sqlite3 -init cards.sql" cards (\includegraphics[width=1em]{images/deck/survival.png}
\item 1 Race Deck - \input "|echo SELECT 'SUM(Amount)' FROM Deck_Cards JOIN Decks ON Decks.id = Deck_Cards.Deck WHERE Decks.Name = \'race\' | sqlite3 -init cards.sql" cards (\includegraphics[width=1em]{images/deck/race.png}
\item 1 Damage Deck - \input "|echo SELECT 'SUM(Amount)' FROM Deck_Cards JOIN Decks ON Decks.id = Deck_Cards.Deck WHERE Decks.Name = \'damage\' | sqlite3 -init cards.sql" cards (\includegraphics[width=1em]{images/deck/damage.png})
\item 4 Starter Decks - \input "|./scripts/lscardswhere.sh starter1" cards each (\includegraphics[width=1em]{images/deck/starter1.png} \includegraphics[width=1em]{images/deck/starter2.png} \includegraphics[width=1em]{images/deck/starter3.png} \includegraphics[width=1em]{images/deck/starter4.png})
\item 1 Legendary Deck - \input "|./scripts/lscardswhere.sh legendary" cards (\includegraphics[width=1em]{images/deck/legendary.png})
\item 1 Survival Deck - \input "|./scripts/lscardswhere.sh survival" cards (\includegraphics[width=1em]{images/deck/survival.png})
\item 1 Race Deck - \input "|./scripts/lscardswhere.sh race" cards (\includegraphics[width=1em]{images/deck/race.png})
\item 1 Damage Deck - \input "|./scripts/lscardswhere.sh damage" cards (\includegraphics[width=1em]{images/deck/damage.png})
\end{itemize}
Additionally there are 18 leg cards.
@ -107,7 +110,6 @@ The game also contains:
\begin{itemize}
\setlength\itemsep{-1em}
\item This manual
\item The box the game came with
\item One weather die with special symbols on it
\item One folding board
\item 4 player tokens
@ -120,8 +122,8 @@ The game also contains:
Every turn each player will move forward one space. The cards they play will
increase this, while the places they encounter will work to decrease it. When
the first player reaches the finish line the game ends and they win. The finish
line is the square \emph{after} the last square on the board.
the first player reaches the finish line the game ends. The finish line is the
square \emph{after} the last square on the board.
\section{Setup}
% How to get the game ready for play. There shouldnt be anything in here that mentions what components are used for or why they are important--save that for the 'Gameplay' section. Just make sure that in this section everything is laid out clearly--if diagrams are necessary (they almost always are) dont be afraid to put those in!
@ -146,14 +148,14 @@ weather die goes first. They roll it, then take their turn.
% The main gameplay section tells you how the game is broken up (rounds, turns, phases, etc.) and summarizes what players do in each of those stages. This section should explain the flow of the game from start to completion.
The game is broken into turns. Each turn you may either play a card, or take
a new day. At the end of your turn you move automatically a distance equal to
a new day. At the end of your turn you automatically move a distance equal to
your speed. After you finish moving the player to your left begins their turn.
During gameplay you will often discard cards. It is important to note that
discarded cards will be returned to your deck frequently. This is in contrast
to destroyed cards which are removed from the game permanently.
Many cards effect the size of your initial hand as well. There is no hard upper
Many cards affect the size of your initial hand as well. There is no hard upper
limit on hand size, however if there aren't enough cards in your deck to fill
your hand, then your hand will consist only of however many cards are available
to be drawn.
@ -170,6 +172,9 @@ called 'passing' the space.
If you pass another player they move back one space and you take one damage
(damage will be explained later).
Passing a \includegraphics[height=1em]{images/icons/damage.png} space also incurs
a damage.
If you pass a cold space (\includegraphics[width=2em]{images/icons/hypo.png})
then you get hypothermia.
@ -207,8 +212,7 @@ it.
The second cost to be paid is the ``health'' cost. Health cost is paid by
discarding cards from the top of the deck. For example if the health cost of
a card is 3, then you must select 3 cards to discard from your hand to pay for
it.
a card is 3, then you must discard the top 3 cards of your deck to pay for it.
\subsubsection{Risk}
@ -296,11 +300,11 @@ If you have either hypothermia or starvation then you do not move automatically
at the end of your turn. If you have both hypothermia and starvation then you
move backwards a distance equal to your speed, rather than forwards.
Whenever you play a {\color{personal}personal} card you reduce your hypothermia
by one, even if you fail to pay for it.
Whenever you play a {\color{personal}personal} card you remove your hypothermia
even if you fail to pay for it.
Similarly, whenever you play a {\color{food}food} card you reduce your
starvation by one, even if you fail to pay for it.
Similarly, whenever you play a {\color{food}food} card you remove your
starvation, even if you fail to pay for it.
\subsection{Legendary Addition}
@ -318,9 +322,6 @@ even though you have enough cards in your deck if they show up.
Luckily damage cards can be played as a normal card, and when you do so you
destroy the damage card.
Passing a \includegraphics[height=1em]{images/icons/damage.png} space also incurs
a damage.
\section{Card Types}
There are 6 unique types of playing cards in the game. This section describes
@ -337,8 +338,10 @@ space for other dogs.
Common effects dogs have include:
- \daydraw{X} Draw an extra \emph{X} cards when you take a new day.
- \speed{X} Move an extra \emph{X} spaces whenever you move.
\begin{itemize}
\item \daydraw{X} Draw an extra \emph{X} cards when you take a new day.
\item \speed{X} Move an extra \emph{X} spaces whenever you move.
\end{itemize}
\subsection{\color{attachment} Attachments}
@ -347,9 +350,6 @@ one attachment each. If you have no dogs in play then attachments are discarded
when played, to no effect. You may discard your own attachments whenever you
wish. When the dog an attachment is on dies, that attachment is discarded.
Armour is a particular attachment that can protect a dog even when you are
instructed to sacrifice it.
\subsection{\color{sled} Sled}
\label{sec:sled}

120
make.py Executable file
View file

@ -0,0 +1,120 @@
#!/usr/bin/env python3
"""
Used as a tool by the Makefile.
Updates only those files whose contents are changed by changes to the given yaml
file.
"""
import sys
from textwrap import dedent
import yaml
def read_cards(filename=None):
"""
Reads the given file as yaml into card information data.
"""
if filename is not None:
with open(filename, 'r') as yaml_file:
data = yaml.load(yaml_file, Loader=yaml.FullLoader)
else:
data = yaml.load(sys.stdin, Loader=yaml.FullLoader)
return data
def card_to_tex(card, deck, rarity):
"""
Returns a card's LaTeX as a string.
"""
head = f"""\
\\documentclass{{iditacard}}
\\cardtype{{{card['type']}}}
\\rarity{{{rarity}}}
\\deck{{{deck}}}
\\begin{{document}}
\\begin{{card}}
\\art{{{card['image']}}}
"""
effect_text = "\\quad".join(card['effects'] if 'effects' in card else [])
tail = f"""\
\\name{{{card['name']}}}
\\text{{{effect_text}}}
\\flava{{{card['flavour']}}}
\\type{{{card['type']}}}
\\end{{card}}
\\end{{document}}\
"""
costs = card["costs"]
costr = ""
if 'energy' in costs and costs['energy'] != 0:
costr += f" \\energy{{{costs['energy']}}}\n"
if 'health' in costs and costs['health'] != 0:
costr += f" \\health{{{costs['health']}}}\n"
if 'risk' in costs and costs['risk'] != 0:
costr += f" \\risk{{{costs['risk']}}}\n"
return dedent(head) + costr + dedent(tail)
def leg_to_tex(leg, level):
"""
Returns a leg's LaTeX as a string.
"""
head = f"""\
\\documentclass{{iditacard}}
\\leglevel{{{level}}}
\\begin{{document}}
\\begin{{leg}}
\\legname{{{leg['name']}}}
"""
spaces = ""
for space in range(1, 11):
if str(space) in leg['spaces']:
icon = f"\\legspaceicon{{{leg['spaces'][space]}}}"
spaces += f" \\onlegspace{{{space}}}{{{icon}}}\n"
effect_text = "\\quad".join(leg['effects'] if 'effects' in leg else [])
tail = f"""\
\\legeffect{{{effect_text}}}
\\end{{leg}}
\\end{{document}}\
"""
return dedent(head) + spaces + dedent(tail)
def dump_decks_to(decks, directory):
"""
Dumps all tex from decks to the given directory.
For each deck in decks it will generate:
- a directory within the given directory with the same name
- .tex files for each card in the deck in the above directory
- .list file in the given directory with the same name as the deck
- one line in the list file for each pdf that would go into said deck
"""
return 'TODO'
# TODO: fill out dump_decks_to, create dump_legs_to and call them with the
# appropriate directory in main (using sys.argv)
#
# also write a script to extract all deck names for use in the makefile (to be
# assigned to the DECK_LIST/DECK_DEPENDENCIES variables
def main():
"""
Main entry point.
"""
cards = read_cards()
print(card_to_tex(cards['cards'][0], "thedeck", "therarity"))
if __name__ == '__main__':
main()

31
scripts/cards.jq Normal file
View file

@ -0,0 +1,31 @@
# This is a jq module to be included
# TODO: since jq I/O sucks, try either using pyyaml or writing a writeto script
# that only writes to a file if the new contents are different
# Pass a specific card and it produces a string with its latex
def card2tex(deck; rarity):
. as $card
| (.costs // {}) as $costs
| (.effects | join("\\quad ")) as $effect
| [
"\\documentclass{iditacard}",
"",
"\\cardtype{\(.type)}",
"\\rarity{\(rarity)}",
"\\deck{\(deck)}",
"",
"\\begin{document}",
"\\begin{card}",
" \\art{\(.image)}",
($costs.energy // empty | " \\energy{\(.)}"),
($costs.health // empty | " \\health{\(.)}"),
($costs.risk // empty | " \\risk{\(.)}"),
" \\name{\(.name)}",
" \\text{\($effect)}",
" \\flava{\(.flavour)}",
" \\type{\(.type)}",
"\\end{card}",
"\\end{document}"
] | join("\n")
;

View file

@ -1,5 +1,3 @@
#!/bin/bash
sqlite3 -init cards.sql <<EOF | sed 's/ /_/g'
SELECT Name FROM Decks JOIN Deck_Cards ON Deck_Cards.Deck = Decks.id GROUP BY Name;
EOF
yq r -j cards.yaml | jq -r '.decks | map(.name)[]'

9
scripts/generate_cards.jq Executable file
View file

@ -0,0 +1,9 @@
#!/usr/bin/jq -rf
# Main issue: can't create multiple files as before, instead use in similar form
# as generate_cards.sh, maybe even use the same read -r format
.decks[] |
.name as $name |
(.cards[] |
.deck = $name)

4
scripts/lscardswhere.sh Executable file
View file

@ -0,0 +1,4 @@
#!/bin/bash
# Counts the number of cards in the given deck.
yq r -j cards.yaml | jq -r --arg deckname "$1" '.decks[] | select(.name | test($deckname; "i")) | .cards | length'