minor bugfix for close button mainly

This commit is contained in:
CPTN Cosmo 2026-01-23 20:15:19 +01:00
parent 42ef160cf2
commit 9cacbbbad4
No known key found for this signature in database
4 changed files with 7 additions and 15 deletions

View file

@ -165,18 +165,12 @@ export class DHImporter {
} else if (prevLine.match(/STRESS:/i)) {
data.system.resources.stress.max = val;
} else if (prevLine.includes("minor") || prevPrevLine.includes("minor")) {
data.system.damageThresholds.minor = val; // System doesn't have minor usually?
// Wait, Daggerheart system model: major, severe. Minor is usually just 1 HP.
// But let's check input: "minor \n 1 HP \n 9". 9 is likely the threshold.
// However, data.system.damageThresholds usually only stores Major/Severe in Foundry system?
// Let's assume we ignore minor or map it if valid.
data.system.damageThresholds.minor = val;
} else if (prevLine.includes("major") || prevPrevLine.includes("major")) {
data.system.damageThresholds.major = val;
} else if (prevLine.includes("severe") || prevPrevLine.includes("severe")) {
data.system.damageThresholds.severe = val;
} else if (prevLine.includes("HP")) {
// "1 HP" / "2 HP" lines often precede thresholds
// If we see "9" after "1 HP", check if "minor" was before that.
if (prevPrevLine.includes("minor")) { /* ignore or store */ }
if (prevPrevLine.includes("major")) data.system.damageThresholds.major = val;
if (prevPrevLine.includes("severe")) data.system.damageThresholds.severe = val;
@ -225,8 +219,6 @@ export class DHImporter {
if (firstColon > -1) {
const name = line.substring(0, firstColon).trim();
const rest = line.substring(firstColon + 1).trim();
// "Melee 1d8+3 phy" -> split by first space? or known ranges?
// Heuristic: Range is usually one word (Melee, Close, Far)
const rangeMatch = rest.match(/^(\w+)\s+(.*)$/);
if (rangeMatch) {
parts = [name + ":" + rangeMatch[1], rangeMatch[2]];