Misc. changes to powdering workings

Items no longer have powders array defined by default (only weapons/armors)
This commit is contained in:
hppeng 2022-06-26 01:07:43 -07:00
parent 58555f232c
commit 056ff84972
3 changed files with 15 additions and 9 deletions

View file

@ -218,7 +218,6 @@ function expandItem(item) {
}
expandedItem.set("minRolls",minRolls);
expandedItem.set("maxRolls",maxRolls);
expandedItem.set("powders", []);
return expandedItem;
}

View file

@ -203,13 +203,11 @@ class ItemInputNode extends InputNode {
type_match = item.statMap.get('type') === this.none_item.statMap.get('type');
}
if (type_match) {
if (powdering !== undefined) {
if (item.statMap.get('category') === 'armor') {
applyArmorPowders(item.statMap, powdering);
}
else if (item.statMap.get('category') === 'weapon') {
apply_weapon_powders(item.statMap, powdering);
}
if (item.statMap.get('category') === 'armor') {
applyArmorPowders(item.statMap, powdering);
}
else if (item.statMap.get('category') === 'weapon') {
apply_weapon_powders(item.statMap, powdering);
}
return item;
}
@ -247,6 +245,7 @@ class ItemInputDisplayNode extends ComputeNode {
this.input_field = document.getElementById(eq+"-choice");
this.health_field = document.getElementById(eq+"-health");
this.level_field = document.getElementById(eq+"-lv");
this.powder_field = document.getElementById(eq+"-powder"); // possibly None
this.image = item_image;
this.fail_cb = true;
}
@ -271,10 +270,18 @@ class ItemInputDisplayNode extends ComputeNode {
this.input_field.classList.add("is-invalid");
return null;
}
if (item.statMap.has('powders')) {
this.powder_field.placeholder = "powders";
}
if (item.statMap.has('NONE')) {
return null;
}
if (item.statMap.has('powders')) {
this.powder_field.placeholder = item.statMap.get('slots') + ' slots';
}
const tier = item.statMap.get('tier');
this.input_field.classList.add(tier);
if (this.health_field) {

View file

@ -419,7 +419,7 @@ function displayExpandedItem(item, parent_id){
}
}
//Show powder specials ;-;
let nonConsumables = ["relik", "wand", "bow", "spear", "dagger", "chestplate", "helmet", "leggings", "boots", "ring", "bracelet", "necklace"];
let nonConsumables = ["relik", "wand", "bow", "spear", "dagger", "chestplate", "helmet", "leggings", "boots"];//, "ring", "bracelet", "necklace"];
if(nonConsumables.includes(item.get("type"))) {
let powder_special = document.createElement("div");
powder_special.classList.add("col");