Fix deck length calculation for environment decks
This commit is contained in:
parent
a1e5b21189
commit
4a9e3db726
|
@ -102,15 +102,17 @@ def makeDoubleSidedFace(outSVG, cardsPerRow, cardNum, deckType, cardFile,
|
||||||
|
|
||||||
def makeCards(deckJson, outfile, outdir, host):
|
def makeCards(deckJson, outfile, outdir, host):
|
||||||
# number of cards in x and y direction
|
# number of cards in x and y direction
|
||||||
cardsPerRow = math.ceil(math.sqrt(len(deckJson['deck']) + len(deckJson['character']) * 2))
|
deckType = deckJson["type"]
|
||||||
|
if deckType in ["hero", "villain"]:
|
||||||
|
cardsPerRow = math.ceil(math.sqrt(len(deckJson['deck']) + len(deckJson['character']) * 2))
|
||||||
|
else:
|
||||||
|
cardsPerRow = math.ceil(math.sqrt(len(deckJson['deck']) * 2))
|
||||||
outSVG = etree.ElementTree(
|
outSVG = etree.ElementTree(
|
||||||
etree.Element('svg', attrib={'width': str(cardsPerRow * CARD_WIDTH) + "pt",
|
etree.Element('svg', attrib={'width': str(cardsPerRow * CARD_WIDTH) + "pt",
|
||||||
'height': str(cardsPerRow * CARD_HEIGHT) + "pt",
|
'height': str(cardsPerRow * CARD_HEIGHT) + "pt",
|
||||||
'version': "1.2",
|
'version': "1.2",
|
||||||
'xmlns': "http://www.w3.org/2000/svg"}))
|
'xmlns': "http://www.w3.org/2000/svg"}))
|
||||||
|
|
||||||
deckType = deckJson["type"]
|
|
||||||
|
|
||||||
with open(bundle_dir + "/templates/deck.json") as f:
|
with open(bundle_dir + "/templates/deck.json") as f:
|
||||||
outJson = json.load(f)
|
outJson = json.load(f)
|
||||||
outJson['ObjectStates'][0]['CustomDeck']['1'].update(
|
outJson['ObjectStates'][0]['CustomDeck']['1'].update(
|
||||||
|
|
Reference in New Issue