Only add 'faction2_code' if the card has a second class

This commit is contained in:
Adam Goldsmith 2021-09-07 23:22:39 -04:00
parent f2a9f81834
commit 1d21b1e10c

View File

@ -54,7 +54,6 @@ var card_data = {
// TODO: could be derived?
deck_limit: 2,
faction_code: String(Component.settings.get('CardClass')).toLowerCase(),
faction2_code: String(Component.settings.get('CardClass2')).toLowerCase(),
flavor: String(Component.settings.get('Flavor')),
health: parseInt(Component.settings.get('Stamina')) || null,
illustrator: String(Component.settings.get('Artist')),
@ -77,6 +76,10 @@ var card_data = {
will: skills["Willpower"],
};
if (Component.settings.get('CardClass2') != 'None') {
card_data.faction2_code = String(Component.settings.get('CardClass2')).toLowerCase();
}
if (card_types[Component.getFrontTemplateKey()] == 'enemy') {
// TODO: "weakness" or "basicweakness"
card_data.subtype_code = "basicweakness";