commit 98d007c3de338874ba1986f70322deeda6159bcd Author: Judah Date: Wed Apr 1 18:02:15 2026 -0600 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..496ee2c --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store \ No newline at end of file diff --git a/docs/CardList.json b/docs/CardList.json new file mode 100644 index 0000000..10dc882 --- /dev/null +++ b/docs/CardList.json @@ -0,0 +1,62 @@ +{ + "000": { + "id": "000", + "face": { + "front": { + "name": "Rapid Response", + "type": "Passive", + "cost": 0, + "image": "https://media.discordapp.net/attachments/1093017032812929024/1489048592743141426/passive-base.png?ex=69cf0011\u0026is=69cdae91\u0026hm=9e673eb63e15f33d7b5579596b247e1832ccc76bee59477602fa6fd8cc544d73\u0026=\u0026format=webp\u0026quality=lossless\u0026width=2078\u0026height=1488", + "isHorizontal": true + } + }, + "name": "Rapid Response", + "type": "Passive", + "cost": 0, + "isToken": false, + "Lane": "⬜ Any", + "Entropy": 0, + "Force": 0, + "_legal": true + }, + "001": { + "id": "001", + "face": { + "front": { + "name": "Breaker", + "type": "Passive", + "cost": 0, + "image": "https://media.discordapp.net/attachments/1093017032812929024/1489048592743141426/passive-base.png?ex=69cf0011\u0026is=69cdae91\u0026hm=9e673eb63e15f33d7b5579596b247e1832ccc76bee59477602fa6fd8cc544d73\u0026=\u0026format=webp\u0026quality=lossless\u0026width=2078\u0026height=1488", + "isHorizontal": true + } + }, + "name": "Breaker", + "type": "Passive", + "cost": 0, + "isToken": false, + "Lane": "⬜ Any", + "Entropy": 0, + "Force": 0, + "_legal": true + }, + "002": { + "id": "002", + "face": { + "front": { + "name": "Inverse Entropy", + "type": "Passive", + "cost": 0, + "image": "https://media.discordapp.net/attachments/1093017032812929024/1489048592743141426/passive-base.png?ex=69cf0011\u0026is=69cdae91\u0026hm=9e673eb63e15f33d7b5579596b247e1832ccc76bee59477602fa6fd8cc544d73\u0026=\u0026format=webp\u0026quality=lossless\u0026width=2078\u0026height=1488", + "isHorizontal": true + } + }, + "name": "Inverse Entropy", + "type": "Passive", + "cost": 0, + "isToken": false, + "Lane": "⬜ Any", + "Entropy": 0, + "Force": 0, + "_legal": true + } +} \ No newline at end of file diff --git a/docs/Game.json b/docs/Game.json new file mode 100644 index 0000000..e9e584b --- /dev/null +++ b/docs/Game.json @@ -0,0 +1,72 @@ +{ + "name": "Entropy", + "menuBackgroundImage": "", + "defaultRessources": { + "backgrounds": [], + "decksUrl": "" + }, + "customHelp": "", + "cardRotation": 45, + "cards": { + "dataUrl": "", + "cardBack": "" + }, + "deckBuilding": { + "mainFilters": [], + "formats": [] + }, + "gameplay": { + "Classic": { + "mulligan": { + "info": "", + "startingHandSize": 7, + "drawNewHand": true, + "putSelectionAtBottom": false, + "drawNewSelectedCards": false + }, + "newTurn": { + "drawOnStart": false, + "sharedTurn": false, + "firstPlayerTokenName": "", + "drawPerTurn": 1 + }, + "defaultNotes": "", + "tokens": [], + "countersStartingValues": [ + 0 + ], + "hideFacedDownCards": false, + "sections": { + "customSections": [ + "Mana" + ], + "layout": { + "direction": "row", + "isSymetricalForOpponents": false, + "content": [] + }, + "categoriesAlreadyOnBoard": [], + "autoPlayFromHand": {}, + "autoPlayFromStack": {}, + "sectionsDict": { + "Mana": { + "title": "Mana", + "isHidden": "yes", + "height": "SMALL", + "alignment": "START", + "opponentAlignment": false, + "noAutoPayTo": "true", + "isHorizontalAllowed": false, + "displayedTitle": "Ressources", + "enterTapped": false, + "enterSpun": false, + "isGroupForbidden": false, + "keepTappedNewTurn": false, + "showHiddenCardInHistory": false, + "noQuickActions": false + } + } + } + } + } +} \ No newline at end of file diff --git a/docs/blue-base.png b/docs/blue-base.png new file mode 100644 index 0000000..78ff4ac Binary files /dev/null and b/docs/blue-base.png differ diff --git a/docs/card-base.af b/docs/card-base.af new file mode 100644 index 0000000..865d90a Binary files /dev/null and b/docs/card-base.af differ diff --git a/docs/green-base.png b/docs/green-base.png new file mode 100644 index 0000000..6cf4446 Binary files /dev/null and b/docs/green-base.png differ diff --git a/docs/passive-base.png b/docs/passive-base.png new file mode 100644 index 0000000..68fd2dc Binary files /dev/null and b/docs/passive-base.png differ diff --git a/docs/red-base.png b/docs/red-base.png new file mode 100644 index 0000000..29ef8eb Binary files /dev/null and b/docs/red-base.png differ diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..161af64 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module tcg + +go 1.26.1 diff --git a/main.go b/main.go new file mode 100644 index 0000000..e8d0022 --- /dev/null +++ b/main.go @@ -0,0 +1,225 @@ +package main + +import ( + "encoding/json" + "fmt" + "math/rand/v2" + "os" +) + +var Cards = []struct { + lane Lane + typ Type + entropy int + recovery int + force int + name string + desc string +}{ + {typ: Passive, recovery: 3, + name: `Rapid Response`, desc: `Your {{spell}}s cost {{1 hp}} less.`}, + {typ: Passive, recovery: 2, + name: `Breaker`, desc: `The first {{unit}} you play per turn costs {{1 entropy}} less.`}, + {typ: Passive, recovery: 0, + name: `Inverse Entropy`, desc: `Add {{1 hp}} to all {{lifesteal}} bonuses`}, +} + +type Lane int + +const ( + Any Lane = iota + Red + Green + Blue +) + +type Type int + +const ( + Unit Type = iota + Spell + Passive + Token +) + +func (l Lane) String() string { + switch l { + case Any: + return "⬜ Any" + case Red: + return "🟥 Red" + case Green: + return "🟩 Green" + case Blue: + return "🟦 Blue" + default: + panic("unknwon") + } +} + +func (t Type) String() string { + switch t { + case Unit: + return "Unit" + case Passive: + return "Passive" + case Token: + return "Token" + default: + panic("unknown") + } +} + +func main() { + type ( + jsonfront struct { + Name string `json:"name"` + Type string `json:"type"` + Cost int `json:"cost"` + Image string `json:"image"` + Horizontal bool `json:"isHorizontal"` + } + jsoncard struct { + // required + Id string `json:"id"` + Face struct { + Front jsonfront `json:"front"` + } `json:"face"` + Name string `json:"name"` + Type string `json:"type"` + Cost int `json:"cost"` + Token bool `json:"isToken"` + + // custom + Lane string `json:"Lane"` + Entropy int `json:"Entropy"` + Force int `json:"Force"` + Legal bool `json:"_legal"` + } + ) + + thejson := make(map[string]jsoncard) + for i := range len(Cards) { + card := &Cards[i] + if len(card.name) == 0 { + card.name = generateTemporaryName() + } + + var imgurl string + switch card.lane { + case Red: + imgurl = "https://media.discordapp.net/attachments/1093017032812929024/1489047949337038959/red-base.png?ex=69ceff78&is=69cdadf8&hm=7d2ba991862426bf6fe97f9ccbb0c8c60e6dd5e3c7d32f2a8e206130aad3c37e&=&format=webp&quality=lossless&width=2078&height=1488" + case Blue: + imgurl = "https://media.discordapp.net/attachments/1093017032812929024/1489047948531597432/blue-base.png?ex=69ceff78&is=69cdadf8&hm=4cf2d26b195780d4d044702d51f2d6423034978f1245cf49e4b43ea5f998632e&=&format=webp&quality=lossless&width=2078&height=1488" + case Green: + imgurl = "https://media.discordapp.net/attachments/1093017032812929024/1489047948959547483/green-base.png?ex=69ceff78&is=69cdadf8&hm=ffb7d13f9c86bf501b22cf8121f88cf1dd49b3696ef92ba6655934f61cae7448&=&format=webp&quality=lossless&width=2078&height=1488" + default: + imgurl = "https://media.discordapp.net/attachments/1093017032812929024/1489048592743141426/passive-base.png?ex=69cf0011&is=69cdae91&hm=9e673eb63e15f33d7b5579596b247e1832ccc76bee59477602fa6fd8cc544d73&=&format=webp&quality=lossless&width=2078&height=1488" + } + + id := fmt.Sprintf("%03d", i) + thejson[id] = jsoncard{ + Id: id, + Face: struct { + Front jsonfront `json:"front"` + }{ + jsonfront{ + Name: card.name, + Type: card.typ.String(), + Image: imgurl, + Cost: card.entropy, + Horizontal: true, + }, + }, + Token: card.typ == Token, + Name: card.name, + Type: card.typ.String(), + Cost: card.entropy, + + Entropy: card.entropy, + Force: card.force, + Lane: card.lane.String(), + Legal: true, + } + } + + enc, err := json.MarshalIndent(thejson, "", " ") + if err != nil { + panic(err) + } + + if err := os.WriteFile("docs/CardList.json", enc, 0644); err != nil { + panic(err) + } +} + +func generateTemporaryName() string { + var ( + adjectives = []string{ + "Absent", + "Ambient", + "Bare", + "Blunt", + "Civic", + "Composite", + "Concave", + "Dull", + "Errant", + "Excess", + "Flat", + "Former", + "Gross", + "Inland", + "Lateral", + "Live", + "Lucid", + "Moot", + "Nominal", + "Oblique", + "Partial", + "Passive", + "Petit", + "Polar", + "Residual", + "Rote", + "Soft", + "Spent", + "Terminal", + "Warm", + } + nouns = []string{ + "Aperture", + "Axis", + "Bulk", + "Cartilage", + "Compact", + "Contour", + "Conviction", + "Cortex", + "Deficit", + "Dividend", + "Dosage", + "Envelope", + "Filament", + "Gesture", + "Gradient", + "Inlet", + "Lapse", + "Mandate", + "Membrane", + "Morale", + "Offset", + "Posture", + "Precinct", + "Prospect", + "Rapport", + "Reflex", + "Substrate", + "Surplus", + "Tendon", + "Volume", + } + ) + + return adjectives[rand.IntN(len(adjectives))] + nouns[rand.IntN(len(nouns))] +}