Don't include health/sanity if it is 'None'

This commit is contained in:
Adam Goldsmith 2021-09-08 20:08:17 -04:00
parent c7b81daa01
commit 1a9c236c01
1 changed files with 9 additions and 2 deletions

View File

@ -99,7 +99,6 @@ function build_card(component) {
deck_limit: 2, // TODO: could be derived?
faction_code: String(component.settings.get('CardClass')).toLowerCase(),
flavor: substitute_tags(String(component.settings.get('Flavor'))),
health: int_or_null(component.settings.get('Stamina')),
illustrator: String(component.settings.get('Artist')),
is_unique: component.settings.getBoolean('Unique'),
name: substitute_tags(String(component.getName())),
@ -107,7 +106,6 @@ function build_card(component) {
position: int_or_null(component.settings.get('CollectionNumber')),
quantity: 2, // TODO
//restrictions: null, // TODO
sanity: int_or_null(component.settings.get('Sanity')),
// TODO: should also handle "Victory" field
text: substitute_tags(String(
component.settings.get('Keywords') + '\n' + component.settings.get('Rules'))),
@ -116,6 +114,15 @@ function build_card(component) {
xp: int_or_null(component.settings.get('Level')),
};
var raw_health = component.settings.get('Stamina');
if (raw_health && raw_health != 'None') {
card_data.health = int_or_null(raw_health);
}
var raw_sanity = component.settings.get('Sanity');
if (raw_sanity && raw_sanity != 'None') {
card_data.health = int_or_null(raw_health);
}
var skills = {
Agility: 0,
Intellect: 0,