Don't include a faction if the card type doesn't have one

ie treachery weaknesses
This commit is contained in:
Adam Goldsmith 2021-09-08 22:34:13 -04:00
parent 1508e727bf
commit d67d1192cf

View File

@ -101,7 +101,6 @@ function build_card(component) {
var card_data = {
code: String(code),
deck_limit: 2, // TODO: could be derived?
faction_code: String(component.settings.get('CardClass')).toLowerCase(),
flavor: substitute_tags(String(component.settings.get('Flavor'))),
illustrator: String(component.settings.get('Artist')),
is_unique: component.settings.getBoolean('Unique'),
@ -165,9 +164,13 @@ function build_card(component) {
card_data.subname = String(subtitle);
}
var faction2 = component.settings.get('CardClass2');
if (faction2 && faction2 != 'None') {
card_data.faction2_code = String(faction2).toLowerCase();
var faction = component.settings.get('CardClass');
if (faction) {
card_data.faction_code = String(faction).toLowerCase();
var faction2 = component.settings.get('CardClass2');
if (faction2 && faction2 != 'None') {
card_data.faction2_code = String(faction2).toLowerCase();
}
}
if (card_types[component.getFrontTemplateKey()] == 'enemy') {