Larger changes, setting up card templates

* Action card template now works, alongside Stance template
* Modified data structures slightly to allow for a more concise notation
This commit is contained in:
🐙PiperYxzzy
2022-11-05 13:05:57 +02:00
parent 6a6f901eff
commit 981e31b5da
7 changed files with 176 additions and 26 deletions

View File

@@ -54,7 +54,9 @@
"en": "Cancel the effects of another player's Action." "en": "Cancel the effects of another player's Action."
}, },
"Copies": 1, "Copies": 1,
"Instant": true "Instant": {
"en": "At any point while a player is playing an Action."
}
}, },
{ {
"Name": { "Name": {

View File

@@ -4,9 +4,11 @@
"en": "" "en": ""
}, },
"Description": { "Description": {
"en": "If played against a Bargain, +3 points. If played against a Betrayal, -1 point." "en": ""
}, },
"Type": "Bargain", "Type": "Bargain",
"AgainstBetrayal": -1,
"AgainstBargain": 3,
"Copies": 20 "Copies": 20
}, },
{ {
@@ -17,6 +19,7 @@
"en": "If played against a Bargain, +2 points." "en": "If played against a Bargain, +2 points."
}, },
"Type": "Betrayal", "Type": "Betrayal",
"AgainstBargain": 2,
"Copies": 20 "Copies": 20
}, },
{ {
@@ -24,9 +27,11 @@
"en": "Symbiosis" "en": "Symbiosis"
}, },
"Description": { "Description": {
"en": "If played against a Bargain, +3 points, and an additional +2 points to both players. If played against a Betrayal, -1 point." "en": "If played against a Bargain both players gain an additional 2 points."
}, },
"Type": "Bargain", "Type": "Bargain",
"AgainstBetrayal": -1,
"AgainstBargain": 3,
"Copies": 1 "Copies": 1
}, },
{ {
@@ -34,9 +39,10 @@
"en": "Excommunication" "en": "Excommunication"
}, },
"Description": { "Description": {
"en": "If played against a Bargain, +4 points. This card must be played face-up." "en": "This card must be played face-up."
}, },
"Type": "Betrayal", "Type": "Betrayal",
"AgainstBargain": 4,
"Copies": 1 "Copies": 1
}, },
{ {
@@ -44,9 +50,11 @@
"en": "Quid Pro Quo" "en": "Quid Pro Quo"
}, },
"Description": { "Description": {
"en": "If played against a Bargain, +3 points. If played against a Betrayal, -1 point. At any time once played, this card can be flipped face-up to negate a player's Action." "en": "At any time once played, this card can be flipped face-up to negate a player's Action."
}, },
"Type": "Bargain", "Type": "Bargain",
"AgainstBetrayal": -1,
"AgainstBargain": 3,
"Copies": 1 "Copies": 1
}, },
{ {
@@ -54,9 +62,10 @@
"en": "Assassination" "en": "Assassination"
}, },
"Description": { "Description": {
"en": "If played against a Bargain, +1 point, and the Bargaining player loses 3 points." "en": "If played against a Bargain, the Bargaining player loses 2 additional points."
}, },
"Type": "Betrayal", "Type": "Betrayal",
"AgainstBargain": 1,
"Copies": 1 "Copies": 1
}, },
{ {
@@ -64,9 +73,11 @@
"en": "A Fair Deal" "en": "A Fair Deal"
}, },
"Description": { "Description": {
"en": "If played against a Bargain, +4 points. If played against a Betrayal, -1 point. This card must be played face-up." "en": "This card must be played face-up."
}, },
"Type": "Bargain", "Type": "Bargain",
"AgainstBetrayal": -1,
"AgainstBargain": 4,
"Copies": 1 "Copies": 1
}, },
{ {
@@ -74,9 +85,10 @@
"en": "Coup d'Etat" "en": "Coup d'Etat"
}, },
"Description": { "Description": {
"en": "If played against a Bargain, +2 points. If played against the player with the most points, they lose 2 points." "en": "If played against the player with the most points in the last round, they lose 2 additional points."
}, },
"Type": "Betrayal", "Type": "Betrayal",
"AgainstBargain": 2,
"Copies": 1 "Copies": 1
}, },
{ {
@@ -84,9 +96,11 @@
"en": "Contractual Obligations" "en": "Contractual Obligations"
}, },
"Description": { "Description": {
"en": "If played against a Bargain, +1 points. If played against a Betrayal, +1 point, and the Betrayer loses 3 points." "en": "If played against a Betrayal, the Betrayer loses 3 points."
}, },
"Type": "Bargain", "Type": "Bargain",
"AgainstBetrayal": 1,
"AgainstBargain": 1,
"Copies": 1 "Copies": 1
}, },
{ {
@@ -94,9 +108,11 @@
"en": "A True Name, Spoken Softly" "en": "A True Name, Spoken Softly"
}, },
"Description": { "Description": {
"en": "If played against a Bargain or a Betrayal, +1 point." "en": ""
}, },
"Type": "Betrayal", "Type": "Betrayal",
"AgainstBetrayal": 1,
"AgainstBargain": 1,
"Copies": 1 "Copies": 1
}, },
{ {
@@ -104,9 +120,11 @@
"en": "Peacekeeping" "en": "Peacekeeping"
}, },
"Description": { "Description": {
"en": "If played against a Bargain, +3 points. If played against a Betrayal, -1 point, and you may take all Action and Final cards of the other player." "en": "If played against a Betrayal, you may take all Action and Final cards of the other player."
}, },
"Type": "Bargain", "Type": "Bargain",
"AgainstBetrayal": -1,
"AgainstBargain": 3,
"Copies": 1 "Copies": 1
}, },
{ {
@@ -114,9 +132,10 @@
"en": "“Peacekeeping”" "en": "“Peacekeeping”"
}, },
"Description": { "Description": {
"en": "If played against a Bargain, +2 points and take all the Action cards of the other player." "en": "If played against a Bargain, take all the Action cards of the other player."
}, },
"Type": "Betrayal", "Type": "Betrayal",
"AgainstBargain": 2,
"Copies": 1 "Copies": 1
}, },
{ {
@@ -124,9 +143,11 @@
"en": "Cameraderie" "en": "Cameraderie"
}, },
"Description": { "Description": {
"en": "If played against a Bargain, +4 points. If played against a Betrayal, -2 points." "en": ""
}, },
"Type": "Bargain", "Type": "Bargain",
"AgainstBetrayal": -2,
"AgainstBargain": 4,
"Copies": 1 "Copies": 1
}, },
{ {
@@ -134,9 +155,10 @@
"en": "Bitter Taste" "en": "Bitter Taste"
}, },
"Description": { "Description": {
"en": "If played against a Bargain, +2 points. The other player must also redraw all their Bargain cards at the beginning of the next round." "en": "The other player must also redraw all their Bargain cards at the beginning of the next round."
}, },
"Type": "Betrayal", "Type": "Betrayal",
"AgainstBargain": 2,
"Copies": 1 "Copies": 1
}, },
{ {
@@ -144,9 +166,11 @@
"en": "Love-Tackle" "en": "Love-Tackle"
}, },
"Description": { "Description": {
"en": "If played against a Bargain, +3 points. If played against a Betrayal, -1 point. If a player reveals this card during the game, it is flipped face-up, and they must give you all their Action cards." "en": "If a player reveals this card during the game, it is flipped face-up, and they must give you all their Action cards."
}, },
"Type": "Bargain", "Type": "Bargain",
"AgainstBetrayal": -1,
"AgainstBargain": 3,
"Copies": 1 "Copies": 1
}, },
{ {

2
cards/template/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
cards.aux
cards.log

BIN
cards/template/cards.pdf Normal file

Binary file not shown.

129
cards/template/cards.tex Normal file
View File

@@ -0,0 +1,129 @@
\documentclass{scrartcl}
% Compiled with assistance from a wonderful guide by Brett Witty: https://www.brettwitty.net/how-to-design-cards-1.html; https://www.brettwitty.net/how-to-design-cards-2.html; https://www.brettwitty.net/how-to-design-cards-3.html
\usepackage{pdflscape}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{pifont}
\usepackage{graphicx}
\usepackage{etoolbox}
\usepackage[utf8]{inputenc}
\usepackage{multicol}
\usepackage[margin=8mm]{geometry}
\usepackage{nopageno}
\usepackage{graphicx, txfonts}
\usepackage{anyfontsize}
\usepackage{ifthen}
\RequirePackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength{\PreviewBorder}{0.125in}
% All cards
\newcommand{\cardmargin}{2mm}
\newcommand{\cardcorners}{4mm}
\newcommand{\cardwidth}{63mm}
\newcommand{\cardheight}{88mm}
\newcommand{\cardnameheight}{10mm}
\newcommand{\carddescriptionheight}{30mm}
\newcommand{\carddescriptionmargin}{4mm}
\newcommand{\card}[1]{\textbf{#1}}
\newcommand{\act}{\textbf{Action}}
\newcommand{\stn}{\textbf{Stance}}
\newcommand{\fin}{\textbf{Final}}
\newcommand{\mis}{\textbf{Mission}}
\newcommand{\brg}{\bargainheartoutline}
\newcommand{\btr}{\betrayalheart}
% Actions
\newcommand{\action}[4]{ % Name, Description, Instant?, Persistent?
\begin{tikzpicture}
\draw[rounded corners = \cardcorners] (0,0) rectangle (\cardwidth - \cardmargin, \cardheight - \cardmargin);
\node (name) at (0.5 * \cardwidth - 0.5 * \cardmargin, \carddescriptionheight + \cardnameheight) [text width = \cardwidth - 2 * \cardmargin, minimum height = \cardnameheight, align = center] {\LARGE #1};
\node (description) at (0.5 * \cardwidth - 0.5 * \cardmargin, 0.5 * \carddescriptionheight + \carddescriptionmargin) [draw = gray, fill = lightgray, thick, text width = \cardwidth - 3 * \carddescriptionmargin, minimum height = \carddescriptionheight, align = center] {
\ifstrempty{#3}{}{
% Instant, add the instant icon
\small \textbf{Instant} \textit{#3}.
}\ifstrempty{#4}{}{
% Persistent, add the instant icon
\small \textbf{Persistent}.
}
\small #2.
};
\end{tikzpicture}
}
% Stances
\newcommand{\stancetypeheight}{10mm}
\newcommand{\bargainheart}{\ensuremath\varheartsuit}
\newcommand{\bargainheartoutline}{\ensuremath\heartsuit}
\newcommand{\betrayalheart}{\rotatebox[origin=c]{180}{\ensuremath\varheartsuit}}
\newcommand{\heart}[1]{
\ifthenelse{\equal{#1}{BARGAIN}}
{\bargainheartoutline}
{\betrayalheart}
}
\newcommand{\stance}[5]{ % Name, Description, Type, AgainstBargain, AgainstBetrayal
\begin{tikzpicture}
\draw[rounded corners = \cardcorners] (0,0) rectangle (\cardwidth - \cardmargin, \cardheight - \cardmargin);
\node (type) at (0.12 * \cardwidth, 0.88 * \cardheight) [align = center] {\fontsize{65}{80px} \heart{#3}};
\node (basevsbargain) at (0.75 * \cardwidth, 0.88 * \cardheight + 1.1mm) [rounded corners = \cardcorners, align = center] {\textcolor{white}{\fontsize{50px}{60px} \bargainheart{}}};
\node (basevsbargainoutline) at (0.75 * \cardwidth, 0.88 * \cardheight + 1.1mm) [rounded corners = \cardcorners, align = center] {\fontsize{50px}{60px} \bargainheartoutline{}};
\node (basevsbetrayal) at (0.86 * \cardwidth, 0.88 * \cardheight - 1.1mm) [rounded corners = \cardcorners, align = center] {\fontsize{50px}{60px} \betrayalheart{}};
\node (basevsbargaintext) at (0.75 * \cardwidth + 0.5mm, 0.88 * \cardheight + 1.5mm) [rounded corners = \cardcorners, align = center] {#4};
\node (basevsbetrayaltext) at (0.86 * \cardwidth + 0.5mm, 0.88 * \cardheight - 1mm) [rounded corners = \cardcorners, align = center] {\textcolor{white}{#5}};
\ifstrempty{#2}
{
\node (name) at (0.5 * \cardwidth - 0.5 * \cardmargin, 0.5 * \cardnameheight) [text width = \cardwidth - 2 * \cardmargin, minimum height = \cardnameheight, align = center] {\LARGE #1};
}
{
\node (name) at (0.5 * \cardwidth - 0.5 * \cardmargin, \carddescriptionheight + \cardnameheight) [text width = \cardwidth - 2 * \cardmargin, minimum height = \cardnameheight, align = center] {\LARGE #1};
\node (description) at (0.5 * \cardwidth - 0.5 * \cardmargin, 0.5 * \carddescriptionheight + \carddescriptionmargin) [draw = gray, fill = lightgray, thick, text width = \cardwidth - 3 * \carddescriptionmargin, minimum height = \carddescriptionheight, align = center] {\small #2.};
}
\end{tikzpicture}
}
%TODO Finals
%TODO Missions
%TODO images
\begin{document}
\thispagestyle{empty}
% TODO autogenerate the below
% Actions
\action{DUPLICITY}{You may swap two of your played \stn{} cards}{}{}
% Stances
\stance{BARGAIN}{}{BARGAIN}{3}{-1}
\stance{BETRAYAL}{}{BETRAYAL}{2}{0}
\stance{LOVE-TACKLE}{If a player reveals this card during the game, it is flipped face-up, and they must give you all their \act{} cards}{BARGAIN}{3}{-1}
\stance{“PEACEKEEPING”}{If played against a \brg{}, take all the Action cards of the other player.}{BETRAYAL}{2}{0}
\stance{BITTER TASTE}{The other player must also redraw all their \brg{} cards at the beginning of the next round}{BETRAYAL}{2}{0}
\end{document}

View File

@@ -1,3 +0,0 @@
{
}

12
main.go
View File

@@ -13,7 +13,7 @@ type Card struct {
type Action struct { type Action struct {
Card Card
Instant bool Instant map[string]string
Persistent bool Persistent bool
} }
@@ -24,11 +24,9 @@ type Mission struct {
type Stance struct { type Stance struct {
Card Card
Type string Type string
BetrayBetray int AgainstBetrayal int
BargainBargain int AgainstBargain int
BetrayBargain int
BargainBetray int
} }
type Final struct { type Final struct {
@@ -45,8 +43,6 @@ func main() {
panic(err) panic(err)
} }
s, _ := os.Open("cards/stances.json") s, _ := os.Open("cards/stances.json")
defer s.Close() defer s.Close()
dec = json.NewDecoder(s) dec = json.NewDecoder(s)