From 05ef071a0ede693f6e5a9532005d07541083662f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=90=99PiperYxzzy?= Date: Wed, 2 Nov 2022 15:11:15 +0200 Subject: [PATCH] init, basic structure, putting into a script for easy card builds --- cards/actions.json | 59 ++++++++++++++++++++++++++++++++++++++ cards/finals.json | 32 +++++++++++++++++++++ cards/missions.json | 11 +++++++ cards/stances.json | 42 +++++++++++++++++++++++++++ go.mod | 3 ++ i18n/en.json | 3 ++ main.go | 70 +++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 220 insertions(+) create mode 100644 cards/actions.json create mode 100644 cards/finals.json create mode 100644 cards/missions.json create mode 100644 cards/stances.json create mode 100644 go.mod create mode 100644 i18n/en.json create mode 100644 main.go diff --git a/cards/actions.json b/cards/actions.json new file mode 100644 index 0000000..d87c496 --- /dev/null +++ b/cards/actions.json @@ -0,0 +1,59 @@ +[ + { + "Name": { + "en": "Nil" + }, + "Description": { + "en": "All players must immediately play a Stance card." + }, + "Copies": 1 + }, + { + "Name": { + "en": "Curiosity" + }, + "Description": { + "en": "All players holding at least one Betrayal must raise their hands. You may swap any held Stance of yours for a Betrayal of their choice." + }, + "Copies": 1 + }, + { + "Name": { + "en": "Cacophony" + }, + "Description": { + "en": "All players must immediately reveal their Cacophony cards. If there are 3 or fewer other Cacophony cards revealed, gain that many points. Otherwise, discard all your Action cards." + }, + "Copies": 5 + }, + { + "Name": { + "en": "Misery" + }, + "Description": { + "en": "All other players discard two Action cards. If Joy is in play, double this effect." + }, + "Copies": 1, + "Persistent": true + }, + { + "Name": { + "en": "Joy" + }, + "Description": { + "en": "You may play two Action cards immediately. If Misery has been played this round, you may play three Action cards immediately instead." + }, + "Copies": 1, + "Persistent": true + }, + { + "Name": { + "en": "Implosion" + }, + "Description": { + "en": "Cancel the effects of another player's Action." + }, + "Copies": 1, + "Instant": true + } +] \ No newline at end of file diff --git a/cards/finals.json b/cards/finals.json new file mode 100644 index 0000000..ca2c8bc --- /dev/null +++ b/cards/finals.json @@ -0,0 +1,32 @@ +[ + { + "Name": { + "en": "Entropy" + }, + "Description": { + "en": "Cancel the effects of all Final cards this round." + }, + "Copies": 1, + "Priority": 0 + }, + { + "Name": { + "en": "Cursed Deck" + }, + "Description": { + "en": "Swap two played Stances between any two players other than yourself." + }, + "Copies": 1, + "Priority": 1 + }, + { + "Name": { + "en": "Stoic Hymnal" + }, + "Description": { + "en": "Your Stances cannot be changed by any future Final effects this round." + }, + "Copies": 1, + "Priority": 2 + } +] \ No newline at end of file diff --git a/cards/missions.json b/cards/missions.json new file mode 100644 index 0000000..2c3284c --- /dev/null +++ b/cards/missions.json @@ -0,0 +1,11 @@ +[ + { + "Name": { + "en": "Masochism Tango" + }, + "Description": { + "en": "If you are Betrayed while trying to Bargain three times in a single round, +8 points." + }, + "Copies": 1 + } +] \ No newline at end of file diff --git a/cards/stances.json b/cards/stances.json new file mode 100644 index 0000000..941a8a9 --- /dev/null +++ b/cards/stances.json @@ -0,0 +1,42 @@ +[ + { + "Name": { + "en": "" + }, + "Description": { + "en": "If played against a Bargain, +3 points. If played against a Betrayal, -1 point." + }, + "Type": "Bargain", + "Copies": 20 + }, + { + "Name": { + "en": "" + }, + "Description": { + "en": "If played against a Bargain, +2 points." + }, + "Type": "Betrayal", + "Copies": 20 + }, + { + "Name": { + "en": "Symbiosis" + }, + "Description": { + "en": "If played against a Bargain, +3 points, and an addition +2 points to both players. If played against a Betrayal, -1 point." + }, + "Type": "Bargain", + "Copies": 1 + }, + { + "Name": { + "en": "Excommunication" + }, + "Description": { + "en": "If played against a Bargain, +4 points. This card must be played face-up." + }, + "Type": "Betrayal", + "Copies": 1 + } +] \ No newline at end of file diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..0261b77 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/yxzzy-wtf/conspiracy-card-game + +go 1.18 diff --git a/i18n/en.json b/i18n/en.json new file mode 100644 index 0000000..544b7b4 --- /dev/null +++ b/i18n/en.json @@ -0,0 +1,3 @@ +{ + +} \ No newline at end of file diff --git a/main.go b/main.go new file mode 100644 index 0000000..03d62fa --- /dev/null +++ b/main.go @@ -0,0 +1,70 @@ +package main + +import ( + "encoding/json" + "os" +) + +type Card struct { + Name map[string]string + Description map[string]string + Copies int +} + +type Action struct { + Card + Instant bool + Persistent bool +} + +type Mission struct { + Card +} + +type Stance struct { + Card + Type string + BetrayBetray int + BargainBargain int + BetrayBargain int + BargainBetray int +} + +type Final struct { + Card + Priority int +} + +func main() { + a, _ := os.Open("cards/actions.json") + defer a.Close() + dec := json.NewDecoder(a) + actions := []Action{} + if err := dec.Decode(&actions); err != nil { + panic(err) + } + + s, _ := os.Open("cards/stances.json") + defer s.Close() + dec = json.NewDecoder(s) + stances := []Stance{} + if err := dec.Decode(&stances); err != nil { + panic(err) + } + + f, _ := os.Open("cards/finals.json") + defer f.Close() + dec = json.NewDecoder(f) + finals := []Final{} + if err := dec.Decode(&finals); err != nil { + panic(err) + } + + m, _ := os.Open("cards/missions.json") + defer f.Close() + dec = json.NewDecoder(m) + missions := []Mission{} + if err := dec.Decode(&missions); err != nil { + panic(err) + } +}