This commit is contained in:
Judah 2026-04-01 18:02:15 -06:00
commit 98d007c3de
10 changed files with 363 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.DS_Store

62
docs/CardList.json Normal file
View file

@ -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
}
}

72
docs/Game.json Normal file
View file

@ -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
}
}
}
}
}
}

BIN
docs/blue-base.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 703 KiB

BIN
docs/card-base.af Normal file

Binary file not shown.

BIN
docs/green-base.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 970 KiB

BIN
docs/passive-base.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 928 KiB

BIN
docs/red-base.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 469 KiB

3
go.mod Normal file
View file

@ -0,0 +1,3 @@
module tcg
go 1.26.1

225
main.go Normal file
View file

@ -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))]
}