Translate effects

This commit is contained in:
2021-02-06 21:50:08 +01:00
parent 7187eec819
commit d243fa9de3
15 changed files with 5412 additions and 5597 deletions

View File

@ -108,6 +108,11 @@ Hooks.once('init', () => {
formula += "+ " + actorData.data.characteristics["wp"].bonus
}
// Specific case, to avoid wrong matching with "Force"
if (formula.includes("toughness bonus")) {
formula = formula.replace( "toughness bonus", actorData.data.characteristics["t"].bonus);
}
// Specific case, to avoid wrong matching with "Force"
if (formula.includes("force mentale"))
{
@ -135,7 +140,7 @@ Hooks.once('init', () => {
}
}
console.log("calculateSpellDamage -> " + formula );
//console.log("calculateSpellDamage -> " + formula );
return eval(formula);
}
@ -185,7 +190,7 @@ Hooks.once('init', () => {
if (aoe)
formula = "AoE (" + formula.capitalize() + ")";
console.log("calculateSpellAttributes -> " + formula );
//console.log("calculateSpellAttributes -> " + formula );
return formula.capitalize();
}
@ -475,6 +480,30 @@ Hooks.once('init', () => {
value = value.replace("to all Sociabilité tests", "à tout les Tests de Sociabilité");
return value;
},
"talent_name": (name, translation) => {
console.log("NAME !!!", name, translation);
},
"effects": (effects, translations) => {
for (let i=0; i<effects.length; i++) {
let effect = effects[i];
effect.label = translations['label'+i];
}
return effects
},
"diseases_effects": (effects, translations) => {
for (let i=0; i<effects.length; i++) {
let effect = effects[i];
let label = effect.label;
let gravity = "";
if ( label.includes("(") && label.includes(")") ) { // Then process specific skills name with (xxxx) inside
var re = /(.*) +\((.*)\)/i;
var res = re.exec( label );
label = res[1].trim(); // Get the gravity
gravity = " (" + game.i18n.localize( res[2].trim() ) + ")"; // And the special keyword
}
effect.label = game.i18n.localize( label ) + gravity;
}
},
// Auto-translate duration
"spells_duration_range_target_damage": (value) => {
//console.log("Spell duration/range/damage/target :", value);