Feat : a good start

This commit is contained in:
2024-07-01 01:42:33 +02:00
parent 857dff5d42
commit ae825d7f5d
122 changed files with 8419 additions and 249 deletions
+48
View File
@@ -0,0 +1,48 @@
from dataclasses import dataclass
from typing import TypedDict
@dataclass
class Translation(TypedDict):
card_type: dict[str, str]
effects: dict[str, str]
@dataclass
class SkinData(TypedDict):
title: str
flavor_text_type: str | None
image_path: str
@dataclass
class SkinFile(TypedDict):
skin_name: str
cards: dict[str, SkinData]
@dataclass
class EffectType(TypedDict):
id: str
amount: str | None
faction: str | None
@dataclass
class Effect(TypedDict):
effect: str
amount: int
effect_type: str | EffectType | None
@dataclass
class Card(TypedDict):
id: int
name: str
role: str
effects: list[Effect] | None
faction: str
card_type: str
cost: int | None
guard: bool | None
defense: int | None
+75
View File
@@ -0,0 +1,75 @@
{
"cards": [
{
"id": 59,
"role": "personal",
"card_type": "item",
"faction": "base",
"name": "Ruby",
"effects": [
{
"effect": "gold",
"amount": 2
}
]
},
{
"id": 58,
"role": "personal",
"card_type": "item",
"faction": "base",
"name": "Dagger",
"effects": [
{
"effect": "damage"
}
]
},
{
"id": 57,
"role": "personal",
"card_type": "item",
"faction": "base",
"name": "Shortsword",
"effects": [
{
"effect": "damage",
"amount": 2
}
]
},
{
"id": 56,
"role": "personal",
"card_type": "item",
"faction": "base",
"name": "Gold",
"init_amount": 7,
"effects": [
{
"effect": "gold"
}
]
},
{
"id": 55,
"role": "fire_gem",
"card_type": "item",
"faction": "base",
"name": "Fire Gem",
"cost": 2,
"init_amount": 16,
"effects": [
{
"effect": "gold",
"amount": 2
},
{
"effect": "damage",
"amount": 3,
"effect_type": "suicide"
}
]
}
]
}
+290
View File
@@ -0,0 +1,290 @@
{
"cards": [
{
"id": 28,
"role": "market",
"card_type": "champion",
"faction": "blue",
"name": "Street Thug",
"cost": 3,
"defense": 4,
"guard": false,
"init_amount": 2,
"effects": [
{
"effect": "gold",
"effect_type": "champion_action",
"mutex": 1
},
{
"effect": "damage",
"amount": 2,
"effect_type": "champion_action",
"mutex": 1
}
]
},
{
"id": 15,
"role": "market",
"card_type": "champion",
"faction": "blue",
"name": "borg, ogre mercenary",
"cost": 6,
"defense": 6,
"guard": true,
"effects": [
{
"effect": "damage",
"amount": 4,
"effect_type": "champion_action"
}
]
},
{
"id": 16,
"role": "market",
"card_type": "action",
"faction": "blue",
"name": "bribe",
"cost": 3,
"init_amount": 3,
"effects": [
{
"effect": "gold",
"amount": 3
},
{
"effect": "stack_next_action_bought",
"effect_type": "faction_combo"
}
]
},
{
"id": 17,
"role": "market",
"card_type": "action",
"faction": "blue",
"name": "death threat",
"cost": 3,
"effects": [
{
"effect": "damage"
},
{
"effect": "draw"
},
{
"effect": "stun",
"effect_type": "faction_combo"
}
]
},
{
"id": 18,
"role": "market",
"card_type": "action",
"faction": "blue",
"name": "deception",
"cost": 5,
"effects": [
{
"effect": "gold",
"amount": 2
},
{
"effect": "draw"
},
{
"effect": "play_next_card_bought",
"effect_type": "faction_combo"
}
]
},
{
"id": 19,
"role": "market",
"card_type": "action",
"faction": "blue",
"name": "fire bomb",
"cost": 8,
"effects": [
{
"effect": "damage",
"amount": 8
},
{
"effect": "stun"
},
{
"effect": "draw"
},
{
"effect": "damage",
"amount": 5,
"effect_type": "suicide"
}
]
},
{
"id": 20,
"role": "market",
"card_type": "action",
"faction": "blue",
"name": "tit job",
"cost": 4,
"effects": [
{
"effect": "damage",
"amount": 7
},
{
"effect": "stun",
"effect_type": "faction_combo"
}
]
},
{
"id": 21,
"role": "market",
"card_type": "action",
"faction": "blue",
"name": "intimidation",
"cost": 2,
"init_amount": 2,
"effects": [
{
"effect": "damage",
"amount": 5
},
{
"effect": "gold",
"amount": 2,
"effect_type": "faction_combo"
}
]
},
{
"id": 22,
"role": "market",
"card_type": "champion",
"faction": "blue",
"name": "myros, guild mage",
"cost": 5,
"defense": 3,
"guard": true,
"effects": [
{
"effect": "gold",
"amount": 3,
"effect_type": "champion_action"
},
{
"effect": "damage",
"amount": 4,
"effect_type": "faction_combo"
}
]
},
{
"id": 23,
"role": "market",
"card_type": "champion",
"faction": "blue",
"name": "parov, the enforcer",
"cost": 5,
"defense": 5,
"guard": true,
"effects": [
{
"effect": "damage",
"amount": 3,
"effect_type": "champion_action"
},
{
"effect": "draw",
"effect_type": "faction_combo"
}
]
},
{
"id": 24,
"role": "market",
"card_type": "action",
"faction": "blue",
"name": "profit",
"cost": 1,
"init_amount": 3,
"effects": [
{
"effect": "gold",
"amount": 2
},
{
"effect": "damage",
"amount": 4,
"effect_type": "faction_combo"
}
]
},
{
"id": 25,
"role": "market",
"card_type": "champion",
"faction": "blue",
"name": "rake, master assassin",
"cost": 7,
"defense": 7,
"guard": false,
"effects": [
{
"effect": "damage",
"amount": 4,
"effect_type": "champion_action"
},
{
"effect": "stun",
"effect_type": "champion_action"
}
]
},
{
"id": 26,
"role": "market",
"card_type": "champion",
"faction": "blue",
"name": "rasmus, the smuggler",
"cost": 4,
"defense": 5,
"guard": false,
"effects": [
{
"effect": "gold",
"amount": 2,
"effect_type": "champion_action"
},
{
"effect": "stack_next_card_bought",
"effect_type": "faction_combo"
}
]
},
{
"id": 27,
"role": "market",
"card_type": "action",
"faction": "blue",
"name": "smash and grab",
"cost": 6,
"effects": [
{
"effect": "damage",
"amount": 6
},
{
"effect": "restack_discarded_card"
}
]
}
]
}
+343
View File
@@ -0,0 +1,343 @@
{
"cards": [
{
"id": 1,
"role": "market",
"card_type": "champion",
"faction": "yellow",
"name": "Arkus, Imperial Dragon",
"cost": 8,
"defense": 6,
"guard": true,
"effects": [
{
"effect": "draw",
"effect_type": "champion_action"
},
{
"effect": "damage",
"amount": 5,
"effect_type": "champion_action"
},
{
"effect": "heal",
"amount": 6,
"effect_type": "faction_combo"
}
]
},
{
"id": 2,
"role": "market",
"card_type": "action",
"faction": "yellow",
"name": "Close Ranks",
"cost": 3,
"effects": [
{
"effect": "damage",
"amount": 5
},
{
"effect": "damage",
"amount": 2,
"per": "champion"
},
{
"effect": "heal",
"amount": 6,
"effect_type": "faction_combo"
}
]
},
{
"id": 3,
"role": "market",
"card_type": "action",
"faction": "yellow",
"name": "Command",
"cost": 5,
"effects": [
{
"effect": "draw"
},
{
"effect": "damage",
"amount": 3
},
{
"effect": "gold",
"amount": 2
},
{
"effect": "heal",
"amount": 4
}
]
},
{
"id": 4,
"role": "market",
"card_type": "champion",
"faction": "yellow",
"name": "Darian , War Mage",
"cost": 4,
"defense": 5,
"guard": false,
"effects": [
{
"effect": "damage",
"amount": 3,
"effect_type": "champion_action",
"mutex": 1
},
{
"effect": "heal",
"amount": 4,
"effect_type": "champion_action",
"mutex": 1
}
]
},
{
"id": 5,
"role": "market",
"card_type": "action",
"faction": "yellow",
"name": "Domination",
"cost": 7,
"effects": [
{
"effect": "heal",
"amount": 6
},
{
"effect": "damage",
"amount": 6
},
{
"effect": "draw"
},
{
"effect": "prepare",
"effect_type": "faction_combo"
}
]
},
{
"id": 6,
"role": "market",
"card_type": "champion",
"faction": "yellow",
"name": "Cristov, the Just",
"cost": 5,
"defense": 5,
"guard": true,
"effects": [
{
"effect": "damage",
"amount": 2,
"effect_type": "champion_action"
},
{
"effect": "heal",
"amount": 3,
"effect_type": "champion_action"
},
{
"effect": "draw",
"effect_type": "faction_combo"
}
]
},
{
"id": 7,
"role": "market",
"card_type": "champion",
"faction": "yellow",
"name": "Kraka, High Priest",
"cost": 6,
"defense": 6,
"guard": false,
"effects": [
{
"effect": "heal",
"amount": 2,
"effect_type": "champion_action"
},
{
"effect": "draw",
"effect_type": "champion_action"
},
{
"effect": "heal",
"amount": 2,
"effect_type": "faction_combo",
"per": "champion"
}
]
},
{
"id": 8,
"role": "market",
"card_type": "champion",
"faction": "yellow",
"name": "Man-at-Arms",
"cost": 3,
"defense": 4,
"guard": true,
"init_amount": 2,
"effects": [
{
"effect": "damage",
"amount": 2,
"effect_type": "champion_action"
},
{
"effect": "damage",
"per": "other_guard",
"effect_type": "champion_action"
}
]
},
{
"id": 9,
"role": "market",
"card_type": "champion",
"faction": "yellow",
"name": "Master Weyan",
"cost": 4,
"defense": 4,
"guard": true,
"effects": [
{
"effect": "damage",
"amount": 3,
"effect_type": "champion_action"
},
{
"effect": "damage",
"per": "other_champion",
"effect_type": "champion_action"
}
]
},
{
"id": 10,
"role": "market",
"card_type": "action",
"faction": "yellow",
"name": "Rally the Troops",
"cost": 4,
"effects": [
{
"effect": "heal",
"amount": 5
},
{
"effect": "damage",
"amount": 5
},
{
"effect": "prepare",
"effect_type": "faction_combo"
}
]
},
{
"id": 11,
"role": "market",
"card_type": "action",
"faction": "yellow",
"name": "Recruit",
"cost": 2,
"init_amount": 3,
"effects": [
{
"effect": "gold",
"amount": 2
},
{
"effect": "heal",
"amount": 3
},
{
"effect": "heal",
"per": "champion"
},
{
"effect": "gold",
"effect_type": "faction_combo"
}
]
},
{
"id": 12,
"role": "market",
"card_type": "champion",
"faction": "yellow",
"name": "Tits Priest",
"cost": 2,
"defense": 3,
"guard": false,
"init_amount": 2,
"effects": [
{
"effect": "gold",
"effect_type": "champion_action",
"mutex": 1
},
{
"effect": "heal",
"effect_type": "champion_action",
"mutex": 1,
"per": "champion"
}
]
},
{
"id": 13,
"role": "market",
"card_type": "action",
"faction": "yellow",
"name": "Taxation",
"cost": 1,
"init_amount": 3,
"effects": [
{
"effect": "gold",
"amount": 2
},
{
"effect": "heal",
"amount": 6,
"effect_type": "faction_combo"
}
]
},
{
"id": 14,
"role": "market",
"card_type": "action",
"faction": "yellow",
"name": "Word of Power",
"cost": 6,
"effects": [
{
"effect": "draw",
"amount": 2
},
{
"effect": "heal",
"amount": 5,
"effect_type": "faction_combo"
},
{
"effect": "damage",
"amount": 5,
"effect_type": "suicide"
}
]
}
]
}
+298
View File
@@ -0,0 +1,298 @@
{
"cards": [
{
"id": 38,
"role": "market",
"card_type": "champion",
"faction": "red",
"name": "Lys, the Unseen",
"cost": 6,
"defense": 5,
"guard": true,
"effects": [
{
"effect": "damage",
"amount": 2,
"effect_type": "champion_action"
},
{
"effect": "sacrifice",
"effect_type": "champion_action",
"sub_effects": [
{
"effect": "damage",
"amount": 2
}
]
}
]
},
{
"id": 29,
"role": "market",
"card_type": "champion",
"faction": "red",
"name": "Ass Priest",
"cost": 3,
"defense": 4,
"guard": false,
"init_amount": 2,
"effects": [
{
"effect": "gold",
"effect_type": "champion_action",
"mutex": 1
},
{
"effect": "damage",
"effect_type": "champion_action",
"mutex": 1
},
{
"effect": "damage",
"amount": 4,
"effect_type": "faction_combo"
}
]
},
{
"id": 30,
"role": "market",
"card_type": "action",
"faction": "red",
"name": "dark energy",
"cost": 4,
"effects": [
{
"effect": "damage",
"amount": 7
},
{
"effect": "draw",
"effect_type": "faction_combo"
}
]
},
{
"id": 31,
"role": "market",
"card_type": "action",
"faction": "red",
"name": "dark reward",
"cost": 5,
"effects": [
{
"effect": "gold",
"amount": 3
},
{
"effect": "sacrifice"
},
{
"effect": "damage",
"amount": 6,
"effect_type": "faction_combo"
}
]
},
{
"id": 32,
"role": "market",
"card_type": "champion",
"faction": "red",
"name": "death cultist",
"cost": 2,
"defense": 3,
"guard": true,
"init_amount": 2,
"effects": [
{
"effect": "damage",
"amount": 2,
"effect_type": "champion_action"
}
]
},
{
"id": 33,
"role": "market",
"card_type": "action",
"faction": "red",
"name": "death touch",
"cost": 1,
"init_amount": 3,
"effects": [
{
"effect": "damage",
"amount": 2
},
{
"effect": "sacrifice"
},
{
"effect": "damage",
"amount": 2,
"effect_type": "faction_combo"
}
]
},
{
"id": 34,
"role": "market",
"card_type": "champion",
"faction": "red",
"name": "rayla, endweaver",
"cost": 4,
"defense": 4,
"guard": false,
"effects": [
{
"effect": "damage",
"amount": 3,
"effect_type": "champion_action"
},
{
"effect": "draw",
"effect_type": "faction_combo"
}
]
},
{
"id": 35,
"role": "market",
"card_type": "action",
"faction": "red",
"name": "influence",
"cost": 2,
"init_amount": 3,
"effects": [
{
"effect": "gold",
"amount": 3
},
{
"effect": "damage",
"amount": 3,
"effect_type": "suicide"
}
]
},
{
"id": 36,
"role": "market",
"card_type": "champion",
"faction": "red",
"name": "krythos, master vampire",
"cost": "7",
"defense": 6,
"guard": false,
"effects": [
{
"effect": "damage",
"amount": 3,
"effect_type": "champion_action"
},
{
"effect": "sacrifice",
"effect_type": "champion_action",
"sub_effects": [
{
"effect": "damage",
"amount": 3
}
]
}
]
},
{
"id": 37,
"role": "market",
"card_type": "action",
"faction": "red",
"name": "life drain",
"cost": 6,
"effects": [
{
"effect": "damage",
"amount": 8
},
{
"effect": "sacrifice"
},
{
"effect": "draw",
"effect_type": "faction_combo"
}
]
},
{
"id": 39,
"role": "market",
"card_type": "action",
"faction": "red",
"name": "the rot",
"cost": 3,
"init_amount": 2,
"effects": [
{
"effect": "damage",
"amount": 4
},
{
"effect": "sacrifice"
},
{
"effect": "damage",
"amount": 3,
"effect_type": "faction_combo"
}
]
},
{
"id": 40,
"role": "market",
"card_type": "champion",
"faction": "red",
"name": "tyrannor, the devourer",
"cost": 8,
"defense": 6,
"guard": true,
"effects": [
{
"effect": "damage",
"amount": 4,
"effect_type": "champion_action"
},
{
"effect": "sacrifice",
"times": 2,
"effect_type": "champion_action"
},
{
"effect": "draw",
"effect_type": "faction_combo"
}
]
},
{
"id": 41,
"role": "market",
"card_type": "champion",
"faction": "red",
"name": "varrick, the necromancer",
"cost": 5,
"defense": 3,
"guard": false,
"effects": [
{
"effect": "restack_discarded_champion",
"effect_type": "champion_action"
},
{
"effect": "draw",
"effect_type": "faction_combo"
}
]
}
]
}
+291
View File
@@ -0,0 +1,291 @@
{
"cards": [
{
"id": 42,
"role": "market",
"card_type": "champion",
"faction": "green",
"name": "broelyn, loreweaver",
"cost": 4,
"defense": 6,
"guard": false,
"effects": [
{
"effect": "gold",
"amount": 2,
"effect_type": "champion_action"
},
{
"effect": "make_discard",
"effect_type": "faction_combo"
}
]
},
{
"id": 43,
"role": "market",
"card_type": "champion",
"faction": "green",
"name": "cron, the berserker",
"cost": 6,
"defense": 6,
"guard": false,
"effects": [
{
"effect": "damage",
"amount": 5,
"effect_type": "champion_action"
},
{
"effect": "draw",
"effect_type": "faction_combo"
}
]
},
{
"id": 44,
"role": "market",
"card_type": "champion",
"faction": "green",
"name": "dire wolf",
"cost": 5,
"defense": 5,
"guard": true,
"effects": [
{
"effect": "damage",
"amount": 3,
"effect_type": "champion_action"
},
{
"effect": "damage",
"amount": 4,
"effect_type": "faction_combo"
}
]
},
{
"id": 45,
"role": "market",
"card_type": "action",
"faction": "green",
"name": "elven curse",
"cost": 3,
"init_amount": 2,
"effects": [
{
"effect": "damage",
"amount": 6
},
{
"effect": "make_discard"
},
{
"effect": "damage",
"amount": 3,
"effect_type": "faction_combo"
}
]
},
{
"id": 46,
"role": "market",
"card_type": "action",
"faction": "green",
"name": "elven gift",
"cost": 2,
"init_amount": 3,
"effects": [
{
"effect": "gold",
"amount": 2
},
{
"effect": "draw_and_discard"
},
{
"effect": "damage",
"amount": 4,
"effect_type": "faction_combo"
}
]
},
{
"id": 47,
"role": "market",
"card_type": "champion",
"faction": "green",
"name": "grak, storm giant",
"cost": 8,
"defense": 7,
"guard": true,
"effects": [
{
"effect": "damage",
"amount": 6,
"effect_type": "champion_action"
},
{
"effect": "draw_and_discard",
"effect_type": "champion_action"
},
{
"effect": "draw_and_discard",
"effect_type": "faction_combo"
}
]
},
{
"id": 48,
"role": "market",
"card_type": "action",
"faction": "green",
"name": "nature's bounty",
"cost": 4,
"effects": [
{
"effect": "gold",
"amount": 4
},
{
"effect": "make_discard",
"effect_type": "faction_combo"
},
{
"effect": "damage",
"amount": 4,
"effect_type": "suicide"
}
]
},
{
"id": 49,
"role": "market",
"card_type": "champion",
"faction": "green",
"name": "orc grunt",
"cost": 3,
"defense": 3,
"guard": true,
"init_amount": 2,
"effects": [
{
"effect": "damage",
"amount": 2,
"effect_type": "champion_action"
},
{
"effect": "draw",
"effect_type": "faction_combo"
}
]
},
{
"id": 50,
"role": "market",
"card_type": "action",
"faction": "green",
"name": "rampage",
"cost": 6,
"effects": [
{
"effect": "damage",
"amount": 6
},
{
"effect": "draw_and_discard",
"times": 2
}
]
},
{
"id": 51,
"role": "market",
"card_type": "champion",
"faction": "green",
"name": "torgen rocksplitter",
"cost": 7,
"defense": 7,
"guard": true,
"effects": [
{
"effect": "damage",
"amount": 4,
"effect_type": "champion_action"
},
{
"effect": "make_discard",
"effect_type": "champion_action"
}
]
},
{
"id": 52,
"role": "market",
"card_type": "action",
"faction": "green",
"name": "spark",
"cost": 1,
"init_amount": 3,
"effects": [
{
"effect": "damage",
"amount": 3
},
{
"effect": "make_discard"
},
{
"effect": "damage",
"amount": 2,
"effect_type": "faction_combo"
}
]
},
{
"id": 53,
"role": "market",
"card_type": "action",
"faction": "green",
"name": "wolf form",
"cost": 5,
"effects": [
{
"effect": "damage",
"amount": 8
},
{
"effect": "make_discard"
},
{
"effect": "make_discard",
"effect_type": "suicide"
}
]
},
{
"id": 54,
"role": "market",
"card_type": "champion",
"faction": "green",
"name": "wolf shaman",
"cost": 2,
"defense": 4,
"guard": false,
"init_amount": 2,
"effects": [
{
"effect": "damage",
"amount": 2,
"effect_type": "champion_action"
},
{
"effect": "damage",
"amount": 1,
"per": "other_card_of_same_faction",
"effect_type": "champion_action"
}
]
}
]
}
+172
View File
@@ -0,0 +1,172 @@
{
"cards": [
{
"id": 68,
"role": "hunter",
"card_type": "action",
"faction": "yellow",
"name": "Confiscate",
"cost": 3,
"init_amount": 2,
"effects": [
{
"effect": "buy_for_free",
"amount": 4
},
{
"effect": "heal",
"amount": 6,
"effect_type": "faction_combo"
}
]
},
{
"id": 69,
"role": "hunter",
"card_type": "action",
"faction": "red",
"name": "Demonic Cloud",
"cost": 7,
"effects": [
{
"effect": "damage",
"amount": 7
},
{
"effect": "damage_all_champions",
"amount": 4
},
{
"effect": "draw"
},
{
"effect": "sacrifice",
"effect_type": "faction_combo"
}
]
},
{
"id": 70,
"role": "hunter",
"card_type": "action",
"faction": "green",
"name": "Pack’s Fury",
"cost": 7,
"effects": [
{
"effect": "damage",
"amount": 7
},
{
"effect": "discard_x_and_draw_x"
}
]
},
{
"id": 71,
"role": "hunter",
"card_type": "action",
"faction": "blue",
"name": "Thrash",
"cost": 2,
"init_amount": 2,
"effects": [
{
"effect": "damage",
"amount": 4,
"mutex": 1
},
{
"effect": "stun",
"mutex": 1
}
]
},
{
"id": 72,
"role": "hunter",
"card_type": "champion",
"faction": "yellow",
"name": "Andor, the Valiant",
"cost": 6,
"defense": 5,
"guard": true,
"effects": [
{
"effect": "damage",
"amount": 2,
"effect_type": "champion_action"
},
{
"effect": "draw",
"effect_type": "champion_action"
},
{
"effect": "prepare_another_champion",
"effect_type": "faction_combo"
}
]
},
{
"id": 73,
"role": "hunter",
"card_type": "champion",
"faction": "red",
"name": "Fettered Imp",
"cost": 2,
"defense": 5,
"guard": true,
"init_amount": 2,
"effects": [
{
"effect": "sacrifice",
"effect_type": "champion_action"
}
]
},
{
"id": 74,
"role": "hunter",
"card_type": "champion",
"faction": "blue",
"name": "Lenka, the Hunter",
"cost": 5,
"defense": 5,
"guard": false,
"effects": [
{
"effect": "damage",
"amount": 4,
"effect_type": "champion_action"
},
{
"effect": "stun",
"effect_type": "faction_combo"
}
]
},
{
"id": 75,
"role": "hunter",
"card_type": "champion",
"faction": "green",
"name": "Pathfinder",
"cost": 3,
"defense": 4,
"guard": false,
"init_amount": 2,
"effects": [
{
"effect": "damage",
"amount": 2,
"effect_type": "champion_action"
},
{
"effect": "gold",
"amount": 2,
"effect_type": "faction_combo"
}
]
}
]
}
@@ -0,0 +1,185 @@
{
"cards": [
{
"id": 60,
"role": "traveler",
"card_type": "action",
"faction": "blue",
"name": "Bounty Collection",
"cost": 7,
"effects": [
{
"effect": "gold",
"amount": 3
},
{
"effect": "play_next_card_bought"
},
{
"effect": "draw",
"effect_type": "faction_combo"
}
]
},
{
"id": 61,
"role": "traveler",
"card_type": "action",
"faction": "green",
"name": "Daring Escape",
"cost": 3,
"init_amount": 2,
"effects": [
{
"effect": "make_discard"
},
{
"effect": "restack_discarded_card"
},
{
"effect": "draw",
"effect_type": "suicide"
}
]
},
{
"id": 62,
"role": "traveler",
"card_type": "action",
"faction": "yellow",
"name": "Fearless Charge",
"cost": 8,
"effects": [
{
"effect": "damage",
"amount": 5
},
{
"effect": "heal",
"amount": 5
},
{
"effect": "draw",
"amount": 2
},
{
"effect": "prepare_all_champions",
"effect_type": "suicide"
}
]
},
{
"id": 63,
"role": "traveler",
"card_type": "action",
"faction": "red",
"name": "Sway",
"cost": 3,
"init_amount": 2,
"effects": [
{
"effect": "gold",
"amount": 3
},
{
"effect": "cheaper_champions_passive"
},
{
"effect": "control_opposing_champion_passive",
"effect_type": "suicide"
}
]
},
{
"id": 64,
"role": "traveler",
"card_type": "champion",
"faction": "blue",
"name": "Con Artist",
"cost": 2,
"defense": 2,
"guard": false,
"init_amount": 2,
"effects": [
{
"effect": "damage",
"amount": 2,
"effect_type": "champion_action",
"mutex": 1
},
{
"effect": "gold",
"per": "stunned_champion",
"effect_type": "champion_action",
"mutex": 1
}
]
},
{
"id": 65,
"role": "traveler",
"card_type": "champion",
"faction": "red",
"name": "Olara, the Slayer",
"cost": 4,
"defense": 5,
"guard": false,
"effects": [
{
"effect": "gold",
"amount": 2,
"effect_type": "champion_action",
"mutex": 1
},
{
"effect": "damage_all_champions",
"amount": 2,
"effect_type": "champion_action",
"mutex": 1
}
]
},
{
"id": 66,
"role": "traveler",
"card_type": "champion",
"faction": "green",
"name": "Pelleas, the Seeker",
"cost": 5,
"defense": 4,
"guard": true,
"effects": [
{
"effect": "damage",
"amount": 3,
"effect_type": "champion_action",
"mutex": 1
},
{
"effect": "restack_discarded_action",
"effect_type": "champion_action",
"mutex": 1
}
]
},
{
"id": 67,
"role": "traveler",
"card_type": "champion",
"faction": "yellow",
"name": "Veteran Squire",
"cost": 3,
"defense": 3,
"guard": false,
"init_amount": 2,
"effects": [
{
"effect": "damage",
"amount": 2,
"per": "champion_of_same_faction",
"effect_type": "champion_action"
}
]
}
]
}
@@ -0,0 +1,97 @@
{
"cards": [
{
"id": 87,
"role": "cleric",
"card_type": "champion",
"faction": "base",
"name": "Follower A",
"defense": 1,
"guard": true,
"effects": [
{
"effect": "damage"
}
]
},
{
"id": 88,
"role": "cleric",
"card_type": "champion",
"faction": "base",
"name": "Follower B",
"defense": 1,
"guard": true,
"effects": [
{
"effect": "damage"
}
]
},
{
"id": 89,
"role": "cleric",
"card_type": "item",
"faction": "base",
"name": "Spiked Mace",
"effects": [
{
"effect": "damage",
"amount": 2
}
]
},
{
"id": 90,
"role": "cleric",
"card_type": "item",
"faction": "base",
"name": "Prayer Beads",
"effects": [
{
"effect": "gold",
"amount": 2,
"sub_effects": [
{
"effect": "heal",
"amount": 5,
"effect_type": {
"id": "champion_amount",
"amount": 2
}
}
],
"mutex": 1
},
{
"effect": "heal",
"amount": 5,
"sub_effects": [
{
"effect": "gold",
"amount": 2,
"effect_type": {
"id": "champion_amount",
"amount": 2
}
}
],
"mutex": 1
}
]
},
{
"id": 56,
"role": "cleric",
"card_type": "item",
"faction": "base",
"name": "Gold",
"init_amount": 6,
"effects": [
{
"effect": "gold"
}
]
}
]
}
@@ -0,0 +1,72 @@
{
"cards": [
{
"id": 84,
"role": "fighter",
"card_type": "item",
"faction": "base",
"name": "Longsword",
"effects": [
{
"effect": "damage",
"amount": 3
}
]
},
{
"id": 85,
"role": "fighter",
"card_type": "champion",
"faction": "base",
"name": "Shield Bearer",
"defense": 3,
"guard": true
},
{
"id": 86,
"role": "fighter",
"card_type": "item",
"faction": "base",
"name": "Throwing Axe",
"effects": [
{
"effect": "damage",
"amount": 2
},
{
"effect": "draw",
"effect_type": {
"id": "total_damage",
"amount": 7
}
}
]
},
{
"id": 56,
"role": "fighter",
"card_type": "item",
"faction": "base",
"name": "Gold",
"init_amount": 1,
"effects": [
{
"effect": "gold"
}
]
},
{
"id": 59,
"role": "fighter",
"card_type": "item",
"faction": "base",
"name": "Ruby",
"effects": [
{
"effect": "gold",
"amount": 2
}
]
}
]
}
@@ -0,0 +1,78 @@
{
"cards": [
{
"id": 81,
"role": "ranger",
"card_type": "item",
"faction": "base",
"name": "Black Arrow",
"init_amount": 2,
"effects": [
{
"effect": "damage"
},
{
"effect": "draw",
"effect_type": {
"id": "card_amount",
"card_id": 83
}
}
]
},
{
"id": 82,
"role": "ranger",
"card_type": "item",
"faction": "base",
"name": "Horn of Calling",
"effects": [
{
"effect": "gold"
},
{
"effect": "cheaper_champion"
}
]
},
{
"id": 83,
"role": "ranger",
"card_type": "item",
"faction": "base",
"name": "Hunting Bow",
"effects": [
{
"effect": "damage",
"amount": 2
}
]
},
{
"id": 56,
"role": "ranger",
"card_type": "item",
"faction": "base",
"name": "Gold",
"init_amount": 5,
"effects": [
{
"effect": "gold"
}
]
},
{
"id": 59,
"role": "ranger",
"card_type": "item",
"faction": "base",
"name": "Ruby",
"effects": [
{
"effect": "gold",
"amount": 2
}
]
}
]
}
+49
View File
@@ -0,0 +1,49 @@
{
"cards": [
{
"id": 80,
"role": "thief",
"card_type": "item",
"faction": "base",
"name": "Throwing Knife",
"init_amount": 3,
"effects": [
{
"effect": "damage"
},
{
"effect": "damage",
"amount": 2,
"per": "other_knife_played"
}
]
},
{
"id": 56,
"role": "thief",
"card_type": "item",
"faction": "base",
"name": "Gold",
"init_amount": 5,
"effects": [
{
"effect": "gold"
}
]
},
{
"id": 59,
"role": "thief",
"card_type": "item",
"faction": "base",
"name": "Ruby",
"init_amount": 2,
"effects": [
{
"effect": "gold",
"amount": 2
}
]
}
]
}
@@ -0,0 +1,88 @@
{
"cards": [
{
"id": 76,
"role": "wizard",
"card_type": "champion",
"faction": "base",
"name": "Cat Familiar",
"defense": 2,
"guard": false,
"effects": [
{
"effect": "damage",
"mutex": 1
},
{
"effect": "gold",
"mutex": 1
},
{
"effect": "heal",
"mutex": 1
}
]
},
{
"id": 77,
"role": "wizard",
"card_type": "action",
"faction": "base",
"name": "Ignite",
"init_amount": 2,
"effects": [
{
"effect": "damage",
"amount": 2
}
]
},
{
"id": 78,
"role": "wizard",
"card_type": "item",
"faction": "base",
"name": "Spell Components",
"effects": [
{
"effect": "gold"
},
{
"effect": "cheaper_action"
}
]
},
{
"id": 79,
"role": "wizard",
"card_type": "item",
"faction": "base",
"name": "Fire Staff",
"effects": [
{
"effect": "damage"
},
{
"effect": "draw",
"effect_type": {
"id": "action_amount",
"amount": 2
}
}
]
},
{
"id": 56,
"role": "wizard",
"card_type": "item",
"faction": "base",
"name": "Gold",
"init_amount": 5,
"effects": [
{
"effect": "gold"
}
]
}
]
}
+188
View File
@@ -0,0 +1,188 @@
{
"cards": [
{
"id": 91,
"role": "half-demon",
"card_type": "action",
"faction": "red",
"name": "Demon Blood",
"effects": [
{
"effect": "gold",
"mutex": 1
},
{
"effect": "sacrifice",
"mutex": 1
}
]
},
{
"id": 92,
"role": "half-demon",
"card_type": "action",
"faction": "base",
"name": "Demonic Strength",
"effects": [
{
"effect": "damage",
"amount": 2
},
{
"effect": "keep_in_hand",
"effect_type": {
"id": "faction_combo",
"faction": "red"
}
}
]
},
{
"id": 93,
"role": "dwarf",
"card_type": "item",
"faction": "base",
"name": "Hammer",
"effects": [
{
"effect": "damage",
"amount": 3
}
]
},
{
"id": 94,
"role": "dwarf",
"card_type": "item",
"faction": "base",
"name": "Pick",
"effects": [
{
"effect": "damage",
"amount": 2,
"mutex": 1
},
{
"effect": "buy_gem_for_free",
"amount": 2,
"mutex": 1
}
]
},
{
"id": 95,
"role": "elf",
"card_type": "action",
"faction": "base",
"name": "Elven Grace",
"effects": [
{
"effect": "cheaper_skills_passive"
},
{
"effect": "draw"
}
]
},
{
"id": 96,
"role": "elf",
"card_type": "item",
"faction": "base",
"name": "Sunstone Brooch",
"effects": [
{
"effect": "gold",
"mutex": 1
},
{
"effect": "heal",
"amount": 2,
"mutex": 1
}
]
},
{
"id": 97,
"role": "ogre",
"card_type": "item",
"faction": "base",
"name": "Shiny Rock",
"effects": [
{
"effect": "gold",
"amount": 2
}
]
},
{
"id": 98,
"role": "ogre",
"card_type": "item",
"faction": "base",
"name": "War Club",
"effects": [
{
"effect": "damage",
"amount": 5
}
]
},
{
"id": 99,
"role": "orc",
"card_type": "action",
"faction": "base",
"name": "Bully",
"effects": [
{
"effect": "buy_for_free",
"amount": 3
}
]
},
{
"id": 100,
"role": "orc",
"card_type": "item",
"faction": "base",
"name": "Ragged Blade",
"effects": [
{
"effect": "damage",
"amount": 3
}
]
},
{
"id": 101,
"role": "smallfolk",
"card_type": "action",
"faction": "base",
"name": "Burgle",
"effects": [
{
"effect": "cheaper_card_if_higher_price"
},
{
"effect": "draw"
}
]
},
{
"id": 102,
"role": "smallfolk",
"card_type": "action",
"faction": "base",
"name": "Friendly Banter",
"effects": [
{
"effect": "gold"
},
{
"effect": "pick_faction"
}
]
}
]
}
-76
View File
@@ -1,76 +0,0 @@
{
"cards": [
{
"id": 1,
"role": "market",
"card_type": "champion",
"faction": "yellow",
"name": "Arkus, Imperial Dragon",
"cost": 8,
"defense": 6,
"guard": true,
"init_amount": 1,
"effects": [
{
"effect": "draw",
"amount": 1,
"effect_type": "champion_action"
},
{
"effect": "damage",
"amount": 5,
"effect_type": "champion_action"
},
{
"effect": "heal",
"amount": 6,
"effect_type": "faction_combo"
}
]
},
{
"id": 13,
"role": "market",
"card_type": "action",
"faction": "yellow",
"name": "Taxation",
"cost": 1,
"init_amount": 3,
"effects": [
{
"effect": "gold",
"amount": 2
},
{
"effect": "heal",
"amount": 6,
"effect_type": "faction_combo"
}
]
},
{
"id": 10,
"role": "market",
"card_type": "action",
"faction": "yellow",
"name": "Rally the Troops",
"cost": 4,
"init_amount": 1,
"effects": [
{
"effect": "heal",
"amount": 5
},
{
"effect": "damage",
"amount": 5
},
{
"effect": "prepare",
"amount": 1,
"effect_type": "faction_combo"
}
]
}
]
}
+12 -9
View File
@@ -1,15 +1,18 @@
{
"skin_name": "heron",
"10": {
"title": "Rallier les Troupes",
"flavor_text_type": "Charme",
"image_path": "../../img/skins/heron/010.png"
},
"13": {
"title": "Caprisun",
"flavor_text_type": "20cl",
"image_path": "lancersiz3.png"
"cards":{
"10": {
"title": "Rallier les Troupes",
"flavor_text_type": "Charme",
"image_path": "../../img/skins/heron/010.png"
},
"13": {
"title": "Caprisun",
"flavor_text_type": "20cl",
"image_path": "lancersiz3.png"
}
}
}
+8 -1
View File
@@ -4,7 +4,14 @@
"champion":"Champion"
},
"effects":{
"draw":"Piochez une carte"
"draw":"Piochez une carte.",
"stun":"Assomez le champion ciblé.",
"stack_next_card_bought":"Mettez la prochaine carte dont vous faites l'acquisition\nau dessus de votre pioche.",
"sacrifice":"Vous pouvez sacrifier une carte de votre main ou de votre défausse.",
"restack_discarded_champion":"Mettez un champion de votre défausse au dessus de votre pioche.",
"make_discard":"L'adversaire ciblé se défausse d'une carte",
"draw_and_discard":"Vous pouvez piocher une carte.\nSi vous faites ainsi, défaussez vous d'une carte.",
"play_next_card_bought":"Mettez dans votre main la prochaine carte dont vous faites l'acquisition.",
}
}
+324 -15
View File
@@ -1,29 +1,338 @@
from typing import List
from math import sin, cos, pi
import drawsvg as dw
import json
from itertools import groupby
from card_types import Card, Effect, Translation
stats_radius = 20
effect_text_size = 14
circle_icon = dw.Circle(cx=0, cy=0, r=stats_radius)
with open("src/data/translation_fr.json", encoding="utf-8") as f:
translation_fr: Translation = json.load(f)
with open('src/data/translation_fr.json', encoding="utf-8") as f:
translation_fr: dict = json.load(f)
def is_base_effect(array: dict):
return not 'effect_type' in array.keys() or array['effect_type'] == 'champion_action'
def is_base_effect(effect: Effect):
return not "effect_type" in effect or effect["effect_type"] == "champion_action"
def create_icon(amount: int, fill_circle: str, fill_text: str = "black"):
def create_icon(
amount: int,
fill_circle: str,
fill_text: str = "black",
radius: float = stats_radius,
):
group = dw.Group()
group.append(dw.Use(circle_icon, fill=fill_circle,x=0,y=0))
group.append(dw.Text(str(amount), x=0, y=9, text_anchor="middle", fill=fill_text, font_size=24, font_weight="bold", font_family='Helvetica'))
group.append(dw.Circle(cx=0, cy=0, r=radius, fill=fill_circle, x=0, y=0))
group.append(
dw.Text(
str(amount),
x=0,
y=9,
text_anchor="middle",
fill=fill_text,
font_size=24,
font_weight="bold",
font_family="Helvetica",
)
)
return group
def create_damage_icon(amount: int):
return create_icon(amount, "red", "white")
def create_heal_icon(amount: int):
return create_icon(amount, "green")
def create_damage_icon(amount: int, radius: float = stats_radius):
return create_icon(amount, radius=radius, fill_circle="red", fill_text="white")
def create_gold_icon(amount: int):
return create_icon(amount, "yellow")
def create_heal_icon(amount: int, radius: float = stats_radius):
return create_icon(amount, radius=radius, fill_circle="green", fill_text="white")
def create_gold_icon(amount: int, radius: float = stats_radius):
return create_icon(amount, radius=radius, fill_circle="yellow")
def create_pentagon(cx: int, cy: int, radius: int):
points: list[float] = []
for i in range(5):
x = cx + radius * cos(2 * pi * i / 5 + (pi / 2))
y = cy + radius * sin(2 * pi * i / 5 + (pi / 2))
points.append(x)
points.append(y)
return points
def draw_champion_shield(card_data: Card, border_width_x: int):
group = dw.Group(id="champion_shield")
pentagon = dw.Lines(
*create_pentagon(cx=border_width_x - 15, cy=-30, radius=28),
close=True,
stroke_width=2,
)
defense_text = dw.Text(
str(card_data["defense"]),
font_size="28px",
font_weight="bold",
font_family="Helvetica",
text_anchor="middle",
x=border_width_x - 15,
y=-20,
)
if not card_data["guard"]:
group.append(
dw.Use(
pentagon,
0,
0,
fill="darkgrey",
stroke="#eee",
)
)
group.append(dw.Use(defense_text, 0, 0, fill="black"))
else:
group.append(
dw.Use(
pentagon,
0,
0,
fill="black",
stroke="lightgrey",
)
)
group.append(
dw.Rectangle(
x=border_width_x - 40,
y=-72,
width=49,
height=17,
fill="black",
stroke="lightgrey",
stroke_width=2,
)
)
group.append(
dw.Text(
"Garde",
x=border_width_x - 15,
y=-59,
text_anchor="middle",
fill="white",
font_size="12px",
font_weight="bold",
font_family="Helvetica",
)
)
group.append(dw.Use(defense_text, 0, 0, fill="white"))
return group
def create_champion_action_icon():
pass
# if card_data.card_type == "champion":
# row_1_icon_x = border_width_x + 35
# dwg.add(
# dwg.circle(
# center=(row_1_icon_x + 1, row_1_base_y + 20 + 1), r=15, fill="#111"
# )
# )
# dwg.add(dwg.circle(center=(row_1_icon_x, row_1_base_y + 20), r=15, fill="#555"))
resourceIcons = {
"gold": create_gold_icon,
"heal": create_heal_icon,
"damage": create_damage_icon,
}
def create_effect_row(effects: list[Effect], type: str, height: int, width: int):
group = dw.Group()
if type == "faction_combo":
group.append(
dw.Circle(
cx=35,
cy=height / 2,
r=15,
fill="url(#grad2)",
filter="url(#drop-shadow)",
)
)
elif type == "suicide":
group.append(
dw.Circle(
cx=35,
cy=height / 2,
r=15,
fill="black",
filter="url(#drop-shadow)",
)
)
elif type == "champion_action":
group.append(
dw.Circle(
cx=35,
cy=height / 2,
r=15,
fill="gray",
filter="url(#drop-shadow)",
)
)
effect_with_icons = list(
filter(lambda x: x.get("effect") in resourceIcons, effects)
)
effect_with_text = list(
filter(lambda x: x.get("effect") not in resourceIcons, effects)
)
text_y_pos = height - effect_text_size / 2
if len(effect_with_icons) == 0:
text_y_pos = height / 2
icon_y_pos = (height / 2) - effect_text_size / 2
if len(effect_with_text) == 0:
icon_y_pos = height / 2
effect_text = ""
for e in effect_with_text:
if effect_text != "":
effect_text += " "
effect_text += translation_fr.get("effects").get(
e.get("effect"), e.get("effect")
)
group.append(
dw.Text(
effect_text,
x=width / 2,
y=text_y_pos,
text_anchor="middle",
fill="black",
font_size=effect_text_size,
font_family="Helvetica",
)
)
icon_radius = min(height / 3, stats_radius)
for [i, e] in enumerate(effect_with_icons):
f = resourceIcons.get(e.get("effect"))
if f is not None:
group.append(
dw.Use(
f(int(e.get("amount", 1)), radius=icon_radius),
(width / 2)
- ((len(effect_with_icons) - 1) * icon_radius * 1.5)
+ (i * icon_radius * 3),
icon_y_pos,
)
)
return group
def get_effect_type(effect: Effect):
effect_type = effect.get("effect_type")
if type(effect_type) is str:
return effect_type
if type(effect_type) is dict:
return effect_type.get("id")
return ""
def create_effects(effects: list[Effect], height: int, width: int):
group = dw.Group(id="effects")
grouped_effects = {
k: list(g)
for k, g in groupby(
sorted(effects, key=lambda x: get_effect_type(x)),
lambda x: get_effect_type(x),
)
}
effect_types = list(grouped_effects.keys())
if len(grouped_effects) == 1:
group.append(
dw.Use(
create_effect_row(
grouped_effects[effect_types[0]], effect_types[0], height, width
),
0,
0,
)
)
if len(grouped_effects) == 2:
group.append(
dw.Line(sx=10, sy=80, ex=width - 10, ey=80, stroke="black", stroke_width=1)
)
group.append(
dw.Use(
create_effect_row(
grouped_effects[effect_types[0]], effect_types[0], 80, width
),
0,
0,
)
)
group.append(
dw.Use(
create_effect_row(
grouped_effects[effect_types[1]],
effect_types[1],
height - 80,
width,
),
0,
80,
)
)
if len(grouped_effects) == 3:
group.append(
dw.Line(sx=10, sy=45, ex=width - 10, ey=45, stroke="black", stroke_width=1)
)
group.append(
dw.Line(sx=10, sy=90, ex=width - 10, ey=90, stroke="black", stroke_width=1)
)
group.append(
dw.Use(
create_effect_row(
grouped_effects[effect_types[0]], effect_types[0], 45, width
),
0,
0,
)
)
group.append(
dw.Use(
create_effect_row(
grouped_effects[effect_types[1]],
effect_types[1],
45,
width,
),
0,
45,
)
)
group.append(
dw.Use(
create_effect_row(
grouped_effects[effect_types[1]],
effect_types[2],
45,
width,
),
0,
90,
)
)
return group
+86 -121
View File
@@ -1,34 +1,40 @@
import drawsvg as dw
import json
from typing import List
import os
from draw_functions import create_gold_icon
from typing import cast
from pathlib import Path
from draw_functions import create_gold_icon, create_effects, draw_champion_shield
from card_types import Card, SkinData, SkinFile, Translation
from drawsvg.drawing import Drawing
with open("src/data/translation_fr.json", encoding="utf-8") as f:
translation_fr: dict = json.load(f)
translation_fr: Translation = json.load(f)
with open("src/data/heron_skin.json", encoding="utf-8") as f:
all_skin_data: dict = json.load(f)
all_skin_data: SkinFile = json.load(f)
cards: list[Card] = []
for p in Path('src/data/cards').glob('*.json'):
with open(p, encoding="utf-8") as f:
temp: list[Card] = json.load(f)["cards"]
cards.extend(temp)
# Params
x_width = 298
y_height = 417
border_width_x = 12
border_width_y = 17
x_internal_width = x_width - (border_width_x*2)
border_upper_offset = 5
title_y_offset = 24
title_font_size = 19
title_font_size_small = 16
subtitle_font_size = 13
cost_right_offset = 38
effect_text_size = 14
row_1_base_y = 280
row_2_base_y = 375
row_1_to_2_separator_y = 345
row_1_to_2_separator_shorten_by = 20
background_colors = {
"blue": "lightblue",
@@ -38,28 +44,22 @@ background_colors = {
"base": "lightgrey",
}
gradient_colors = {"red": "red", "blue": "blue", "yellow": "yellow", "green": "green"}
icon_colors = {"yellow": ["#ff9935", "#ffe744"]}
with open("src/data/cards_data.json", encoding="utf-8") as f:
cards: List = json.load(f)["cards"]
gradient_colors = {"red": "red", "blue": "blue", "yellow": "yellow", "green": "green", "base":"gray"}
icon_colors = {
"yellow": ["#ff9935", "#ffe744"],
"blue": ["#ff9935", "#ffe744"],
"red": ["#ff9935", "#ffe744"],
"green": ["#ff9935", "#ffe744"],
"base": ["#ff9935", "#ffe744"]
}
shadowFilter = dw.Filter(id="drop-shadow")
shadowFilter.append(dw.FilterItem("feDropShadow", dx=1, dy=1, stdDeviation=0))
# Draw faction icon
faction_icon = dw.Group(id="faction_icon")
faction_icon.append(
dw.Circle(
cx=1,
cy=1,
r=20,
fill="black",
filter=shadowFilter
)
)
faction_icon.append(dw.Circle(cx=1, cy=1, r=20, fill="black", filter=shadowFilter))
faction_icon.append(
dw.Circle(
cx=0,
@@ -72,64 +72,70 @@ faction_icon.append(
for card_data in cards:
# Get card skin data
try:
card_skin_data = all_skin_data[str(card_data["id"])]
card_skin_data = all_skin_data["cards"][str(card_data["id"])]
except KeyError:
print(
"Missing skin data for card id:", card_data["id"], "using default skin data"
print("Missing skin data for card id:", card_data["id"], "using default skin data")
card_skin_data = SkinData(
title=card_data["name"],
image_path="../../img/missing.png",
flavor_text_type=None,
)
card_skin_data = {
"title": card_data["name"],
"image_path": "../../img/missing.png",
}
# Create a new SVG drawing
output_dir = "output/" + all_skin_data["skin_name"]
os.makedirs(output_dir, exist_ok=True)
d = dw.Drawing(x_width, y_height)
d = Drawing(x_width, y_height)
d.append(shadowFilter)
# Define linear colored gradient
gradient = dw.LinearGradient(0, 0, 1, 0, gradientUnits="objectBoundingBox",id="grad1")
gradient = dw.LinearGradient(
0, 0, 1, 0, gradientUnits="objectBoundingBox", id="grad1"
)
gradient.add_stop(0, gradient_colors[card_data["faction"]], opacity=1)
gradient.add_stop(1, gradient_colors[card_data["faction"]], opacity=0)
d.append(dw.Use(gradient, None, None))
d.append_def(gradient)
# Define linear colored gradient for faction icon
gradient_faction_icon = dw.LinearGradient(0, 1, 0, 0, gradientUnits="objectBoundingBox",id="grad2")
gradient_faction_icon = dw.LinearGradient(
0, 1, 0, 0, gradientUnits="objectBoundingBox", id="grad2"
)
gradient_faction_icon.add_stop(0, icon_colors[card_data["faction"]][0], opacity=1)
gradient_faction_icon.add_stop(1, icon_colors[card_data["faction"]][1], opacity=1)
d.append(dw.Use(gradient_faction_icon, None, None))
d.append_def(gradient_faction_icon)
# Draw card background
d.append(dw.Rectangle(0, 0, x_width, y_height, rx=15, ry=18, fill="black"))
d.append(
background = dw.Group(id="background")
background.append(dw.Rectangle(0, 0, x_width, y_height, rx=15, ry=18, fill="black"))
background.append(
dw.Rectangle(
border_width_x,
border_width_y - border_upper_offset,
x_width - border_width_x * 2,
x_internal_width,
y_height - border_width_y * 2 + border_upper_offset,
rx=0,
ry=0,
fill=background_colors[card_data["faction"]],
)
)
d.append(background)
# Draw title area
# dwg.add(dwg.rect(insert=(0, 0), size=(str(x_width) + 'px', '50px'), fill='white'))
title = dw.Group(id="title")
card_title = card_skin_data["title"]
TEMP_TITLE_FONT_SIZE = title_font_size
if len(card_title) > 20:
TEMP_TITLE_FONT_SIZE = title_font_size_small
if len(card_title) > 23:
TEMP_TITLE_FONT_SIZE = title_font_size_small - 2
d.append(
temp_title_font_size = title_font_size_small
elif len(card_title) > 23:
temp_title_font_size = title_font_size_small - 2
else:
temp_title_font_size = title_font_size
title.append(
dw.Text(
card_title,
x=x_width / 2,
y=title_y_offset + border_width_y - border_upper_offset,
text_anchor="middle",
fill="black",
font_size=TEMP_TITLE_FONT_SIZE,
font_size=temp_title_font_size,
font_weight="bold",
font_family="Helvetica",
)
@@ -138,9 +144,9 @@ for card_data in cards:
card_type_text = translation_fr["card_type"].get(
card_data["card_type"], card_data["card_type"]
)
if "flavor_text_type" in card_skin_data.keys():
card_type_text += ", " + card_skin_data["flavor_text_type"]
d.append(
if card_skin_data.get("flavor_text_type") is not None:
card_type_text += ", " + str(card_skin_data["flavor_text_type"])
title.append(
dw.Text(
card_type_text,
font_size=subtitle_font_size,
@@ -151,86 +157,45 @@ for card_data in cards:
font_family="Helvetica",
)
)
d.append(title)
d.append(dw.Use(faction_icon, border_width_x + 23 + 1,border_width_y - border_upper_offset + 20 + 4 + 1 ))
# dwg.add(dwg.image(card_data['faction_icon'], insert=(x_width - 30 - 15, 30 - 15), size=(30, 30)))
# Draw cost circle
# dwg.add(
# dwg.circle(
# center=(x_width - cost_right_offset + 2, 19 + border_width_y + 2),
# r=21,
# fill="rgb(202, 129, 25)",
# )
# )
# dwg.add(
# dwg.circle(
# center=(x_width - cost_right_offset, 19 + border_width_y),
# r=20,
# fill="yellow",
# )
# )
# dwg.add(
# dwg.text(
# str(card_data["cost"]),
# insert=(x_width - cost_right_offset, 26 + border_width_y),
# text_anchor="middle",
# fill="black",
# font_size="24px",
# font_weight="bold",
# font_family="Helvetica",
# )
# )
d.append(dw.Use(create_gold_icon(card_data["cost"]), x_width - cost_right_offset, 19 + border_width_y))
d.save_svg(
"output/"
+ all_skin_data["skin_name"]
+ "/"
+ str(card_data["id"]).zfill(3)
+ ".svg"
)
continue
# Draw image area
dwg.add(dwg.rect(insert=(0, 65), size=(str(x_width) + "px", "200px"), fill="black"))
dwg.add(
dwg.image(card_skin_data["image_path"], insert=(0, 65), size=(x_width, 200))
)
dwg.add(
dwg.rect(
insert=(border_width_x, 265),
size=(str(30) + "px", str(y_height - 265 - border_width_y) + "px"),
fill="url(#grad1)",
# Draw faction icon
d.append(
dw.Use(
faction_icon,
border_width_x + 23 + 1,
border_width_y - border_upper_offset + 20 + 4 + 1,
)
)
# If champion, draw champion action icon
if card_data["card_type"] == "champion":
row_1_icon_x = border_width_x + 35
dwg.add(
dwg.circle(
center=(row_1_icon_x + 1, row_1_base_y + 20 + 1), r=15, fill="#111"
# Draw card cost
if card_data.get("cost") is not None:
d.append(
dw.Use(
create_gold_icon(cast(int,card_data.get("cost"))),
x_width - cost_right_offset,
19 + border_width_y,
)
)
dwg.add(dwg.circle(center=(row_1_icon_x, row_1_base_y + 20), r=15, fill="#555"))
draw_effects(
dwg=dwg,
card_effects=card_data["effects"],
border_width_x=border_width_x,
effect_text_size=effect_text_size,
row_1_base_y=row_1_base_y,
row_1_to_2_separator_shorten_by=row_1_to_2_separator_shorten_by,
row_1_to_2_separator_y=row_1_to_2_separator_y,
row_2_base_y=row_2_base_y,
x_width=x_width,
)
d.append(dw.Rectangle(x=0, y=65, width=x_width, height=200))
d.append(dw.Image(x=0, y=65, width=x_width, height=200,path=card_skin_data["image_path"]))
# Draw effects
effects = card_data.get("effects")
if effects is not None:
effects = create_effects(
effects=effects,
height=135,
width=x_internal_width
)
d.append(dw.Use(effects, border_width_x,265))
# If champion, draw champion shield with defense
if card_data["card_type"] == "champion":
draw_champion_shield(dwg, card_data, x_width, y_height, border_width_x)
shield = draw_champion_shield(card_data, border_width_x)
d.append(dw.Use(shield,x_width-30, y_height))
# Save the SVG file
dwg.save()
d.save_svg(f"output/{all_skin_data['skin_name']}/{str(card_data["id"]).zfill(3)}.svg")