Correctly handle cards that do not have a slot

This commit is contained in:
Adam Goldsmith 2021-09-08 13:03:49 -04:00
parent b91b6a69ad
commit 5e25b42e2a

View File

@ -26,11 +26,6 @@ function renameSlot(slot) {
}
}
var slot = renameSlot(Component.settings.get('Slot'));
if (Component.settings.get('Slot2') != 'None') {
slot += '. ' + renameSlot(Component.settings.get('Slot2'));
}
const tag_replacements = {
"<fullname>": String(Component.getName()),
"<gua>": "[guardian]",
@ -111,7 +106,6 @@ var card_data = {
skill_intellect: skills["Intellect"],
skill_wild: skills["Wild"],
skill_willpower: skills["Willpower"],
slot: String(slot),
// TODO: should also handle "Victory" field
text: substitute_tags(String(
Component.settings.get('Keywords') + '\n' + Component.settings.get('Rules'))),
@ -120,6 +114,15 @@ var card_data = {
xp: parseInt(Component.settings.get('Level')) || null,
};
var raw_slot = Component.settings.get('Slot');
if (raw_slot) {
card_data.slot = renameSlot(String(raw_slot));
var raw_slot2 = Component.settings.get('Slot2');
if (raw_slot2 && raw_slot2 != 'None') {
card_data.slot += '. ' + renameSlot(raw_slot2);
}
}
var subtitle = Component.settings.get('Subtitle');
if (subtitle && subtitle != '') {
card_data.subname = subtitle;