Allow overriding a card's JSON via the comments field
This commit is contained in:
parent
f8e5039833
commit
903253f5c8
|
@ -335,6 +335,14 @@ function build_card(component, pack_code, cycle_prefix, copies) {
|
||||||
|
|
||||||
// TODO: parse out some keywords into their own fields
|
// TODO: parse out some keywords into their own fields
|
||||||
|
|
||||||
|
let overrides = {};
|
||||||
|
try {
|
||||||
|
const comments_json = JSON.parse(component.comment);
|
||||||
|
if ("arkhamdb_override" in comments_json) {
|
||||||
|
overrides = comments_json["arkhamdb_override"];
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
|
||||||
println(String(component.getFrontTemplateKey()));
|
println(String(component.getFrontTemplateKey()));
|
||||||
switch (String(component.getFrontTemplateKey())) {
|
switch (String(component.getFrontTemplateKey())) {
|
||||||
case "AHLCG-Event-Default":
|
case "AHLCG-Event-Default":
|
||||||
|
@ -342,13 +350,15 @@ function build_card(component, pack_code, cycle_prefix, copies) {
|
||||||
{ type_code: "event" },
|
{ type_code: "event" },
|
||||||
common_data(),
|
common_data(),
|
||||||
player_card_common(),
|
player_card_common(),
|
||||||
cost()
|
cost(),
|
||||||
|
overrides,
|
||||||
));
|
));
|
||||||
case "AHLCG-Skill-Default":
|
case "AHLCG-Skill-Default":
|
||||||
return order_by_keys(Object.assign(
|
return order_by_keys(Object.assign(
|
||||||
{ type_code: "skill" },
|
{ type_code: "skill" },
|
||||||
common_data(),
|
common_data(),
|
||||||
player_card_common()
|
player_card_common(),
|
||||||
|
overrides,
|
||||||
));
|
));
|
||||||
case "AHLCG-Asset-Default":
|
case "AHLCG-Asset-Default":
|
||||||
return order_by_keys(Object.assign(
|
return order_by_keys(Object.assign(
|
||||||
|
@ -359,7 +369,8 @@ function build_card(component, pack_code, cycle_prefix, copies) {
|
||||||
subtitle(),
|
subtitle(),
|
||||||
is_unique(),
|
is_unique(),
|
||||||
health_and_sanity(),
|
health_and_sanity(),
|
||||||
slots()
|
slots(),
|
||||||
|
overrides,
|
||||||
));
|
));
|
||||||
case "AHLCG-Investigator-Default":
|
case "AHLCG-Investigator-Default":
|
||||||
return order_by_keys(Object.assign(
|
return order_by_keys(Object.assign(
|
||||||
|
@ -369,13 +380,15 @@ function build_card(component, pack_code, cycle_prefix, copies) {
|
||||||
subtitle(),
|
subtitle(),
|
||||||
health_and_sanity(),
|
health_and_sanity(),
|
||||||
investigator(),
|
investigator(),
|
||||||
|
overrides,
|
||||||
));
|
));
|
||||||
case "AHLCG-WeaknessEnemy-Default":
|
case "AHLCG-WeaknessEnemy-Default":
|
||||||
return order_by_keys(Object.assign(
|
return order_by_keys(Object.assign(
|
||||||
{ type_code: "enemy", },
|
{ type_code: "enemy", },
|
||||||
common_data(),
|
common_data(),
|
||||||
is_unique(),
|
is_unique(),
|
||||||
enemy()
|
enemy(),
|
||||||
|
overrides,
|
||||||
));
|
));
|
||||||
case "AHLCG-WeaknessTreachery-Default":
|
case "AHLCG-WeaknessTreachery-Default":
|
||||||
return order_by_keys(Object.assign(
|
return order_by_keys(Object.assign(
|
||||||
|
@ -384,7 +397,8 @@ function build_card(component, pack_code, cycle_prefix, copies) {
|
||||||
faction_code: "neutral",
|
faction_code: "neutral",
|
||||||
},
|
},
|
||||||
common_data(),
|
common_data(),
|
||||||
treachery_subtype()
|
treachery_subtype(),
|
||||||
|
overrides,
|
||||||
));
|
));
|
||||||
default:
|
default:
|
||||||
throw new UnsupportedComponentError();
|
throw new UnsupportedComponentError();
|
||||||
|
|
Loading…
Reference in New Issue