Fix spell damage parsing + EiS actors

This commit is contained in:
2024-05-12 17:39:03 +02:00
parent 28b966b27c
commit 36616d648b
38 changed files with 212 additions and 201 deletions

View File

@@ -21,6 +21,13 @@ const vo_conditions = {
"defeated": "Defeated"
}
const __SELECT_BONUS_PREFIX_D = {
"initiative" : 1,
"intelligence" : 1,
"endurance" : 1,
"agilite": 1,
"agilité": 1
}
/************************************************************************************/
Hooks.once('init', () => {
@@ -37,6 +44,7 @@ Hooks.once('init', () => {
}
game.wfrp4e.apps.StatBlockParser.parseStatBlock = async function (statString, type = "npc") {
console.log("PARSER FR DONE");
return statParserFR(statString, type);
}
@@ -542,13 +550,15 @@ Hooks.once('init', () => {
if (value == "You") return "Vous"; // Hop !
if (value == "Instant") return "Instantané"; // Hop !
let translw = value;
let re = /(.*) Bonus (\w*)/i;
let re = /(.*)\s+Bonus\s*(\w*)/i;
let res = re.exec(value);
//console.log("RES1:", res);
// DEBUG : console.log("RES1:", res);
let unit = "";
if (res) { // Test "<charac> Bonus <unit>" pattern
if (res[1]) { // We have char name, then convert it
translw = "Bonus de " + game.i18n.localize(res[1].trim());
if (res[1]) { // We have char name, then convert it
translw = game.i18n.localize(res[1].trim());
let bonusPrefix = (translw.toLowerCase() in __SELECT_BONUS_PREFIX_D) ? "Bonus d'" : "Bonus de ";
translw = bonusPrefix + translw
}
unit = res[2];
} else {
@@ -572,11 +582,11 @@ Hooks.once('init', () => {
if (unit == "yard") unit = "mètre";
if (unit == "yards") unit = "mètres";
if (unit == "Bonus") { // Another weird management
console.log("Translating bonus", unit);
translw = "Bonus de " + translw;
} else {
translw += " " + unit;
}
//console.log("Spell duration/range/damage/target :", value, translw);
return translw;
}
});