fixed range detection for actions
This commit is contained in:
parent
fd0e718a1c
commit
b6a1af9926
2 changed files with 14 additions and 7 deletions
|
|
@ -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({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue