diff --git a/module.json b/module.json index 8f8ee2e..7c240de 100644 --- a/module.json +++ b/module.json @@ -1,7 +1,7 @@ { "id": "dh-importer", "title": "Daggerheart Statblock Importer", - "version": "1.1.0", + "version": "1.1.1", "compatibility": { "minimum": "13", "verified": "13" @@ -34,5 +34,5 @@ "description": "Imports Adversaries and Environments from text blocks into the Daggerheart system.", "url": "https://github.com/cptn-cosmo/dh-importer", "manifest": "https://git.geeks.gay/cosmo/dh-importer/raw/branch/main/module.json", - "download": "https://git.geeks.gay/cosmo/dh-importer/releases/download/1.1.0/dh-importer.zip" + "download": "https://git.geeks.gay/cosmo/dh-importer/releases/download/1.1.1/dh-importer.zip" } \ No newline at end of file diff --git a/scripts/importer.js b/scripts/importer.js index cbc5cd4..2ad4f3b 100644 --- a/scripts/importer.js +++ b/scripts/importer.js @@ -241,7 +241,10 @@ export class DHImporter { // Ranges: Melee, Very Close, Close, Far, Very Far const rangeMatch = rest.match(/^(Melee|Very Close|Close|Far|Very Far)/i); if (rangeMatch) { - data.system.attack.range = rangeMatch[1].toLowerCase(); + let rangeVal = rangeMatch[1].toLowerCase(); + if (rangeVal === "very close") rangeVal = "veryClose"; + if (rangeVal === "very far") rangeVal = "veryFar"; + data.system.attack.range = rangeVal; rest = rest.substring(rangeMatch[0].length).trim(); } @@ -260,7 +263,7 @@ export class DHImporter { formula = dmgMatch[1]; type = dmgMatch[2].toLowerCase(); if (type === "phy") type = "physical"; - else if (type === "mag") type = "magic"; + else if (type === "mag" || type === "magic") type = "magical"; } data.system.attack.damage.parts.push({ @@ -324,7 +327,7 @@ export class DHImporter { damage: { parts: [], includeBase: false, direct: false }, range: "", roll: { - type: "action", // Default to action, switch to attack if detected + type: "attack", // Default to attack diceRolling: { multiplier: "flat", dice: "d6" } } }; @@ -361,7 +364,11 @@ export class DHImporter { // Parse Range const rangeMatch = buffer.description.match(/(Melee|Very Close|Close|Far|Very Far)/i); if (rangeMatch) { - action.range = rangeMatch[1].toLowerCase(); + let rangeVal = rangeMatch[1].toLowerCase(); + if (rangeVal === "very close") rangeVal = "veryClose"; + if (rangeVal === "very far") rangeVal = "veryFar"; + + action.range = rangeVal; } // Parse Damage: "deal 3d4+10 direct physical damage" @@ -376,7 +383,7 @@ export class DHImporter { // Map short codes if (type === "phy") type = "physical"; - else if (type === "mag") type = "magic"; + else if (type === "mag" || type === "magic") type = "magical"; action.damage.direct = isDirect; action.damage.parts.push({