Carrrièes, stat patch et log
This commit is contained in:
@ -34,7 +34,7 @@ import WFRP_Utility from "/systems/wfrp4e/modules/system/utility-wfrp4e.js";
|
||||
import "./xregexp-all.js";
|
||||
const us_carac = 'm\\s+ws\\s+bs\\s+s\\s+t\\s+i\\s+agi?\\s+dex\\s+int\\s+\\wp\\s+fel\\s+w';
|
||||
const fr_carac = 'm\\s+ws\\s+bs\\s+s\\s+t\\s+i\\s+agi?\\s+dex\\s+int\\s+\\wp\\s+fel\\s+w';
|
||||
const carac_val = '(?<m>[0-9-]+)\\s+(?<ws>[0-9-]+)\\s+(?<bs>[0-9-]+)\\s+(?<s>[0-9-]+)\\s+(?<t>[0-9-]+)\\s+(?<i>[0-9-]+)\\s+(?<ag>[0-9-]+)\\s+(?<dex>[0-9-]+)\\s+(?<int>[0-9-]+)\\s+(?<wp>[0-9-]+)\\s+(?<fel>[0-9-]+)\\s+(?<w>[0-9-\*]+)';
|
||||
const carac_val = '(?<m>[0-9\\-]+)\\s+(?<ws>[0-9\\-]+)\\s+(?<bs>[0-9\\-]+)\\s+(?<s>[0-9\\-]+)\\s+(?<t>[0-9\\-]+)\\s+(?<i>[0-9\\-]+)\\s+(?<ag>[0-9\\-]+)\\s+(?<dex>[0-9\\-]+)\\s+(?<int>[0-9\\-]+)\\s+(?<wp>[0-9\\-]+)\\s+(?<fel>[0-9\\-]+)\\s+(?<w>[0-9\\-\*]+)';
|
||||
const name_val = '(?<name>[a-zA-Z\\s\\-,]*)[\\s\\r\\na-zA-Z]*(?<tiers>.*|[\\(\\)a-z0-9]+)';
|
||||
let sectionData = [
|
||||
{ name: "trait", toFind: "Traits\\s*:", secondParse: '(?<name>[a-z\\s]*)[\\s\\+]*(?<value>.*|[\\+0-9]+)', index: -1 },
|
||||
@ -164,6 +164,9 @@ function __patchName ( name) {
|
||||
export default async function statParserFR(statString, type = "npc") {
|
||||
let model = duplicate(game.system.model.Actor[type]);
|
||||
|
||||
// Patch wront/strange carac value before processing
|
||||
statString = statString.replace(/ –/g, " 0")
|
||||
|
||||
let reg1 = XRegExp(us_carac, 'gi');
|
||||
let res = reg1.test(statString);
|
||||
if (res) { //stat block identified go on
|
||||
@ -196,7 +199,8 @@ export default async function statParserFR(statString, type = "npc") {
|
||||
let resCarac = XRegExp.exec(statString, reg2); // resr contains all carac found
|
||||
|
||||
// Setup carac
|
||||
if (resCarac["Agi"]) resCarac["Ag"] = resCarac["Agi"]; // Auto patch
|
||||
//console.log("CARAC", resCarac)
|
||||
if (resCarac["Agi"]) resCarac["Ag"] = resCarac["Agi"] // Auto patch
|
||||
model.details.move.value = Number(resCarac["m"]);
|
||||
for (let key in model.characteristics) {
|
||||
if (resCarac[key] === '-') resCarac[key] = 0;
|
||||
|
Reference in New Issue
Block a user