-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmake_card_description.py
executable file
·82 lines (67 loc) · 2.58 KB
/
make_card_description.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/env python
import sys
import json
# Anything printed in this script becomes part of the card description
card = json.loads(sys.argv[1])
prefix = "";
if "familiar" in card['card_type']:
print("Sacrifice Action:")
prefix = " "
# Conditionals
if card["requires_hot_gt"]:
print(f"Requires {card['requires_hot_gt']} HOT:")
prefix = " "
if card["requires_light_gt"]:
print(f"Requires {card['requires_light_gt']} LIGHT:")
prefix = " "
if card["requires_cold_gt"]:
print(f"Requires {card['requires_cold_gt']} COLD:")
prefix = " "
if card["requires_dark_gt"]:
print(f"Requires {card['requires_dark_gt']} DARK:")
prefix = " "
# Power, Chaos, barriers deltas
if card["power_delta"]:
print(prefix+"{0:+} POWER".format(int(card["power_delta"])))
if card["chaos_delta"]:
print(prefix+"{0:+} CHAOS".format(int(card["chaos_delta"])))
if card["barriers_delta"]:
if int(card["barriers_delta"]) > 0:
print(prefix+f"Rebuild {card['barriers_delta']} barrier up to a maximum of 3")
else:
print(prefix+f"Destroy {card['barriers_delta']} barrier")
# elemental deltas
if card["hotcold_delta"]:
if int(card["hotcold_delta"]) > 0:
print(prefix+f"+{card['hotcold_delta']} HOT")
else:
print(prefix+f"+{abs(int(card['hotcold_delta']))} COLD")
if card["lightdark_delta"]:
if int(card["lightdark_delta"]) > 0:
print(prefix+f"+{card['lightdark_delta']} LIGHT")
else:
print(prefix+f"+{abs(int(card['lightdark_delta']))} DARK")
# elemental swaps
if card["swaps_lightdark"]:
print(prefix+"Swap LIGHT and DARK stats")
if card["swaps_hotcold"]:
print(prefix+"Swap HOT and COLD stats")
# fallbacks (e.g. else arms for conditionals)
if card["power_delta_fallback"] or card["chaos_delta_fallback"] or card["hotcold_delta_fallback"] or card["lightdark_delta_fallback"]:
print("Else:")
prefix = " "
if card["power_delta_fallback"]:
print(prefix+"{0:+} POWER".format(int(card["power_delta_fallback"])))
if card["chaos_delta_fallback"]:
print(prefix+"{0:+} CHAOS".format(int(card["chaos_delta_fallback"])))
# elemental delta_fallbacks
if card["hotcold_delta_fallback"]:
if int(card["hotcold_delta_fallback"]) > 0:
print(prefix+f"+{card['hotcold_delta_fallback']} HOT")
else:
print(prefix+f"+{abs(int(card['hotcold_delta_fallback']))} COLD")
if card["lightdark_delta_fallback"]:
if int(card["lightdark_delta_fallback"]) > 0:
print(prefix+f"+{card['lightdark_delta_fallback']} LIGHT")
else:
print(prefix+f"+{abs(int(card['lightdark_delta_fallback']))} DARK")