diff --git a/CardList.json b/CardList.json index 0efcff6..7bc0d26 100644 --- a/CardList.json +++ b/CardList.json @@ -6,7 +6,7 @@ "name": "Rapid Response", "type": "Passive", "cost": 0, - "image": "https://docs.brut.systems/judah/entropy/passive-base.png", + "image": "https://docs.brut.systems/judah/entropy/000.png", "isHorizontal": true } }, @@ -28,7 +28,7 @@ "name": "Breaker", "type": "Passive", "cost": 0, - "image": "https://docs.brut.systems/judah/entropy/passive-base.png", + "image": "https://docs.brut.systems/judah/entropy/001.png", "isHorizontal": true } }, @@ -50,7 +50,7 @@ "name": "Inverse Entropy", "type": "Passive", "cost": 0, - "image": "https://docs.brut.systems/judah/entropy/passive-base.png", + "image": "https://docs.brut.systems/judah/entropy/002.png", "isHorizontal": true } }, @@ -69,14 +69,14 @@ "id": "003", "face": { "front": { - "name": "SoftReflex", + "name": "SpentReflex", "type": "Unit", "cost": 1, - "image": "https://docs.brut.systems/judah/entropy/red-base.png", + "image": "https://docs.brut.systems/judah/entropy/003.png", "isHorizontal": true } }, - "name": "SoftReflex", + "name": "SpentReflex", "type": "Unit", "cost": 1, "isToken": false, @@ -91,14 +91,14 @@ "id": "004", "face": { "front": { - "name": "CivicContour", + "name": "InlandAperture", "type": "Unit", "cost": 2, - "image": "https://docs.brut.systems/judah/entropy/red-base.png", + "image": "https://docs.brut.systems/judah/entropy/004.png", "isHorizontal": true } }, - "name": "CivicContour", + "name": "InlandAperture", "type": "Unit", "cost": 2, "isToken": false, @@ -113,14 +113,14 @@ "id": "005", "face": { "front": { - "name": "FlatDividend", + "name": "ObliqueCortex", "type": "Unit", "cost": 3, - "image": "https://docs.brut.systems/judah/entropy/red-base.png", + "image": "https://docs.brut.systems/judah/entropy/005.png", "isHorizontal": true } }, - "name": "FlatDividend", + "name": "ObliqueCortex", "type": "Unit", "cost": 3, "isToken": false, @@ -135,14 +135,14 @@ "id": "006", "face": { "front": { - "name": "AbsentFilament", + "name": "FormerDividend", "type": "Unit", "cost": 4, - "image": "https://docs.brut.systems/judah/entropy/red-base.png", + "image": "https://docs.brut.systems/judah/entropy/006.png", "isHorizontal": true } }, - "name": "AbsentFilament", + "name": "FormerDividend", "type": "Unit", "cost": 4, "isToken": false, @@ -157,20 +157,20 @@ "id": "007", "face": { "front": { - "name": "SoftSubstrate", + "name": "SoftReflex", "type": "Unit", - "cost": 5, - "image": "https://docs.brut.systems/judah/entropy/red-base.png", + "cost": 10, + "image": "https://docs.brut.systems/judah/entropy/007.png", "isHorizontal": true } }, - "name": "SoftSubstrate", + "name": "SoftReflex", "type": "Unit", - "cost": 5, + "cost": 10, "isToken": false, "Lane": "🟥 Red", - "Entropy": 5, - "Force": 5, + "Entropy": 10, + "Force": 10, "_legal": { "playtest": true } diff --git a/cards.go b/cards.go index fd949f9..e8e1767 100644 --- a/cards.go +++ b/cards.go @@ -24,6 +24,6 @@ var CARDS = []struct { desc: ``}, {typ: Unit, lane: Red, entropy: 4, force: 4, desc: ``}, - {typ: Unit, lane: Red, entropy: 5, force: 5, + {typ: Unit, lane: Red, entropy: 10, force: 10, desc: ``}, } diff --git a/docs/000.png b/docs/000.png new file mode 100644 index 0000000..b605a79 Binary files /dev/null and b/docs/000.png differ diff --git a/docs/001.png b/docs/001.png new file mode 100644 index 0000000..24a4e32 Binary files /dev/null and b/docs/001.png differ diff --git a/docs/002.png b/docs/002.png new file mode 100644 index 0000000..75571b7 Binary files /dev/null and b/docs/002.png differ diff --git a/docs/003.png b/docs/003.png new file mode 100644 index 0000000..2ae4860 Binary files /dev/null and b/docs/003.png differ diff --git a/docs/004.png b/docs/004.png new file mode 100644 index 0000000..de55af7 Binary files /dev/null and b/docs/004.png differ diff --git a/docs/005.png b/docs/005.png new file mode 100644 index 0000000..5ab2489 Binary files /dev/null and b/docs/005.png differ diff --git a/docs/006.png b/docs/006.png new file mode 100644 index 0000000..bf0d811 Binary files /dev/null and b/docs/006.png differ diff --git a/docs/007.png b/docs/007.png new file mode 100644 index 0000000..26327f2 Binary files /dev/null and b/docs/007.png differ diff --git a/docs/Krungthep.ttf b/docs/Krungthep.ttf new file mode 100644 index 0000000..9415853 Binary files /dev/null and b/docs/Krungthep.ttf differ diff --git a/docs/SFCamera.ttf b/docs/SFCamera.ttf new file mode 100644 index 0000000..3526dce Binary files /dev/null and b/docs/SFCamera.ttf differ diff --git a/docs/base-blue.png b/docs/base-blue.png new file mode 100644 index 0000000..4c62cc9 Binary files /dev/null and b/docs/base-blue.png differ diff --git a/docs/base-green.png b/docs/base-green.png new file mode 100644 index 0000000..37b709a Binary files /dev/null and b/docs/base-green.png differ diff --git a/docs/base-passive.png b/docs/base-passive.png new file mode 100644 index 0000000..e3da410 Binary files /dev/null and b/docs/base-passive.png differ diff --git a/docs/base-red.png b/docs/base-red.png new file mode 100644 index 0000000..df6a9ff Binary files /dev/null and b/docs/base-red.png differ diff --git a/docs/blue-base.png b/docs/blue-base.png deleted file mode 100644 index 5959f0c..0000000 Binary files a/docs/blue-base.png and /dev/null differ diff --git a/docs/green-base.png b/docs/green-base.png deleted file mode 100644 index cf2a6a0..0000000 Binary files a/docs/green-base.png and /dev/null differ diff --git a/docs/passive-base.png b/docs/passive-base.png deleted file mode 100644 index cd69fda..0000000 Binary files a/docs/passive-base.png and /dev/null differ diff --git a/docs/red-base.png b/docs/red-base.png deleted file mode 100644 index 1d397ae..0000000 Binary files a/docs/red-base.png and /dev/null differ diff --git a/go.mod b/go.mod index 161af64..b55bf1e 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,9 @@ module tcg go 1.26.1 + +require ( + github.com/fogleman/gg v1.3.0 // indirect + github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect + golang.org/x/image v0.38.0 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..22afc51 --- /dev/null +++ b/go.sum @@ -0,0 +1,6 @@ +github.com/fogleman/gg v1.3.0 h1:/7zJX8F6AaYQc57WQCyN9cAIz+4bCJGO9B+dyW29am8= +github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= +github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= +github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= +golang.org/x/image v0.38.0 h1:5l+q+Y9JDC7mBOMjo4/aPhMDcxEptsX+Tt3GgRQRPuE= +golang.org/x/image v0.38.0/go.mod h1:/3f6vaXC+6CEanU4KJxbcUZyEePbyKbaLoDOe4ehFYY= diff --git a/main.go b/main.go index 32aa4fb..612f3f9 100644 --- a/main.go +++ b/main.go @@ -3,8 +3,12 @@ package main import ( "encoding/json" "fmt" + "math" "math/rand/v2" "os" + "strings" + + "github.com/fogleman/gg" ) type Lane int @@ -88,21 +92,77 @@ func main() { card.name = generateTemporaryName() } - baseurl := "https://docs.brut.systems/judah/entropy/" - - var imgurl string + var ( + baseimg string + color [3]float64 + ) switch card.lane { case Red: - imgurl = baseurl + "red-base.png" - case Blue: - imgurl = baseurl + "blue-base.png" + baseimg = "base-red.png" + color = [3]float64{248.0 / 255.0, 120.0 / 255.0, 143.0 / 255.0} case Green: - imgurl = baseurl + "green-base.png" + baseimg = "base-green.png" + color = [3]float64{120.0 / 255.0, 190.0 / 255.0, 248.0 / 255.0} + case Blue: + baseimg = "base-blue.png" + color = [3]float64{120.0 / 255.0, 248.0 / 255.0, 178.0 / 255.0} default: - imgurl = baseurl + "passive-base.png" + color = [3]float64{184.0 / 255.0, 184.0 / 255.0, 184.0 / 255.0} + baseimg = "base-passive.png" } + img, err := gg.LoadImage("docs/" + baseimg) + if err != nil { + panic(err) + } + + ctx := gg.NewContextForImage(img) + if err := ctx.LoadFontFace("docs/Krungthep.ttf", 48); err != nil { + panic(err) + } + + // Draw force + if card.typ != Passive { + ctx.SetRGB(1, 1, 1) + ctx.Push() + { + ctx.Translate(120, 115) + ctx.Rotate(270 * math.Pi / 180) + ctx.DrawStringAnchored(fmt.Sprintf("%d", card.force), 0, 0, 0.5, 0.5) + } + ctx.Pop() + } + + // Draw entropy + ctx.SetRGB(color[0], color[1], color[2]) + ctx.Push() + { + ctx.Translate(273, 115) + ctx.Rotate(270 * math.Pi / 180) + ctx.DrawStringAnchored(fmt.Sprintf("%d", card.entropy), 0, 0, 0.5, 0.5) + } + ctx.Pop() + + if err := ctx.LoadFontFace("docs/SFCamera.ttf", 30); err != nil { + panic(err) + } + + // Draw description + cleandesc := strings.NewReplacer("{{", "", "}}", "").Replace(card.desc) + ctx.SetRGBA(0, 0, 0, 0.9) + ctx.Push() + { + ctx.Translate(435, 985) + ctx.Rotate(270 * math.Pi / 180) + ctx.DrawStringWrapped(fmt.Sprintf("%s -\n%s", card.name, cleandesc), 0, 0, 0.0, 0.0, 900, 1.70, gg.AlignLeft) + } + ctx.Pop() + id := fmt.Sprintf("%03d", i) + if err := ctx.SavePNG("docs/" + id + ".png"); err != nil { + panic(err) + } + thejson[id] = jsoncard{ Id: id, Face: struct { @@ -111,7 +171,7 @@ func main() { jsonfront{ Name: card.name, Type: card.typ.String(), - Image: imgurl, + Image: fmt.Sprintf("https://docs.brut.systems/judah/entropy/%s.png", id), Cost: card.entropy, Horizontal: true, },