From 7057ebc05c28217d8bc54a2c177eaeadec59eeb4 Mon Sep 17 00:00:00 2001 From: Draconas Date: Wed, 19 Oct 2022 19:23:23 +0100 Subject: [PATCH 1/3] Migration Fix and Template Changes Migration null pointed for me on line 263 as the check was using lazy or instead of lazy and, so evaluated the 2nd statement even if the first failed and hit a null. Template changes to support Fox Lee's new mosnter sheet: -Players and monsters gain a "conditionImmunities" list. Initially this will be a list of string primarily used by the new monster sheet for monsters that are flat out immune to certain conditions. A list rather than single string to make any form of automation easier at a later date. -Monsters get details.equipment, default empty string. Humanoid monster statblocks usually include a quick equipment list for loot / descriptive purposes. This is much easier to keep as a basic string than trying to do anything clever with the actual equipment section. --- module/migration.js | 2 +- template.json | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/module/migration.js b/module/migration.js index 9bc324bf..2c65ec43 100644 --- a/module/migration.js +++ b/module/migration.js @@ -260,7 +260,7 @@ export const getMigrationData = async function() { if(!ad) return updateData; const old = ad?.attributes?.hp?.temphp; - const hasOld = old !== undefined || ad.attributes[`hp-=temphp`] !== undefined; + const hasOld = old !== undefined && ad.attributes[`hp-=temphp`] !== undefined; if ( hasOld ) { // If new data is not present, migrate the old data if (old !== undefined && ad.attributes?.temphp?.value !== old && (typeof old === "number") ) { diff --git a/template.json b/template.json index 5c04f72a..08f52cac 100644 --- a/template.json +++ b/template.json @@ -516,6 +516,7 @@ } }, + "conditionImmunities": [], "encumbrance": { "value": null, "max": null, @@ -569,6 +570,7 @@ "weight": "", "alignment": "", "deity": "", + "equipment": "", "secondwind": false, "deathsaves": 3, From 859595cb5c5f10f4c038524338fce0cbcc386ada Mon Sep 17 00:00:00 2001 From: Draconas Date: Thu, 20 Oct 2022 22:44:13 +0100 Subject: [PATCH 2/3] Added conditionResistances for other misc free text resistances that weirdass monsters get --- template.json | 1 + 1 file changed, 1 insertion(+) diff --git a/template.json b/template.json index 08f52cac..6c813e03 100644 --- a/template.json +++ b/template.json @@ -516,6 +516,7 @@ } }, + "conditionResistances": [], "conditionImmunities": [], "encumbrance": { "value": null, From c91868499aac2904db4ef46d76f7840071bc65db Mon Sep 17 00:00:00 2001 From: Draconas Date: Sun, 23 Oct 2022 10:48:35 +0100 Subject: [PATCH 3/3] After some time talking with Fox and looking at what differnt monsters had, rationalised the untyped stuff to its own object with resistances, immunities and vulnerabilities. This should be the last commit on this change as I ahve actually written the exporter code! --- template.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/template.json b/template.json index 6c813e03..cbd3d180 100644 --- a/template.json +++ b/template.json @@ -516,8 +516,11 @@ } }, - "conditionResistances": [], - "conditionImmunities": [], + "untypedResistances": { + "resistances" : [], + "vulnerabilities" : [], + "immunities" : [] + }, "encumbrance": { "value": null, "max": null,