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
|
||||
|
||||
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()));
|
||||
switch (String(component.getFrontTemplateKey())) {
|
||||
case "AHLCG-Event-Default":
|
||||
|
@ -342,13 +350,15 @@ function build_card(component, pack_code, cycle_prefix, copies) {
|
|||
{ type_code: "event" },
|
||||
common_data(),
|
||||
player_card_common(),
|
||||
cost()
|
||||
cost(),
|
||||
overrides,
|
||||
));
|
||||
case "AHLCG-Skill-Default":
|
||||
return order_by_keys(Object.assign(
|
||||
{ type_code: "skill" },
|
||||
common_data(),
|
||||
player_card_common()
|
||||
player_card_common(),
|
||||
overrides,
|
||||
));
|
||||
case "AHLCG-Asset-Default":
|
||||
return order_by_keys(Object.assign(
|
||||
|
@ -359,7 +369,8 @@ function build_card(component, pack_code, cycle_prefix, copies) {
|
|||
subtitle(),
|
||||
is_unique(),
|
||||
health_and_sanity(),
|
||||
slots()
|
||||
slots(),
|
||||
overrides,
|
||||
));
|
||||
case "AHLCG-Investigator-Default":
|
||||
return order_by_keys(Object.assign(
|
||||
|
@ -369,13 +380,15 @@ function build_card(component, pack_code, cycle_prefix, copies) {
|
|||
subtitle(),
|
||||
health_and_sanity(),
|
||||
investigator(),
|
||||
overrides,
|
||||
));
|
||||
case "AHLCG-WeaknessEnemy-Default":
|
||||
return order_by_keys(Object.assign(
|
||||
{ type_code: "enemy", },
|
||||
common_data(),
|
||||
is_unique(),
|
||||
enemy()
|
||||
enemy(),
|
||||
overrides,
|
||||
));
|
||||
case "AHLCG-WeaknessTreachery-Default":
|
||||
return order_by_keys(Object.assign(
|
||||
|
@ -384,7 +397,8 @@ function build_card(component, pack_code, cycle_prefix, copies) {
|
|||
faction_code: "neutral",
|
||||
},
|
||||
common_data(),
|
||||
treachery_subtype()
|
||||
treachery_subtype(),
|
||||
overrides,
|
||||
));
|
||||
default:
|
||||
throw new UnsupportedComponentError();
|
||||
|
|
Loading…
Reference in New Issue