Minor fixes + compute function
This commit is contained in:
parent
8e80c7a005
commit
e6e1cbd073
@ -36,83 +36,23 @@ Hooks.once('init', () => {
|
|||||||
game.wfrp4e.apps.StatBlockParser.parseStatBlock = async function( statString, type = "npc") {
|
game.wfrp4e.apps.StatBlockParser.parseStatBlock = async function( statString, type = "npc") {
|
||||||
return statParserFR( statString, type);
|
return statParserFR( statString, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------*/
|
|
||||||
game.wfrp4e.utility.handleConditionClick = function(event) {
|
|
||||||
let cond = $(event.currentTarget).attr("data-cond")
|
|
||||||
if (!cond)
|
|
||||||
cond = event.target.text;
|
|
||||||
cond = cond.trim();
|
|
||||||
let condkey
|
|
||||||
// En vo, les noms d'états sont égaux aux clés en minuscules
|
|
||||||
if ( game.wfrp4e.config.conditions[cond.toLowerCase()] ) {
|
|
||||||
condkey = cond.toLowerCase();
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
condkey = game.wfrp4e.utility.findKey(cond.toLowerCase(), game.wfrp4e.config.conditions, {caseInsensitive: true});
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
ui.notifications.error("L'état est inconnu : " + cond);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let condName = game.wfrp4e.config.conditions[condkey];
|
|
||||||
let condDescr = game.wfrp4e.config.conditionDescriptions[condkey];
|
|
||||||
let messageContent = `<b>${condName}</b><br>${condDescr}`
|
|
||||||
|
|
||||||
let chatData = game.wfrp4e.utility.chatDataSetup(messageContent)
|
|
||||||
ChatMessage.create(chatData);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------*/
|
|
||||||
game.wfrp4e.entities.ActorWfrp4e.prototype.calculateRangeOrDamage = function(formula)
|
|
||||||
{
|
|
||||||
//console.log("FR function calculateRangeOrDamage !", formula);
|
|
||||||
let actorData = this.data
|
|
||||||
try
|
|
||||||
{
|
|
||||||
formula = formula.toLowerCase();
|
|
||||||
// Iterate through characteristics
|
|
||||||
for(let ch in actorData.data.characteristics)
|
|
||||||
{
|
|
||||||
// Determine if the formula includes the characteristic's abbreviation + B (SB, WPB, etc.)
|
|
||||||
if (formula.includes(ch.concat('b')))
|
|
||||||
{
|
|
||||||
// Replace that abbreviation with the Bonus value
|
|
||||||
formula = formula.replace(ch.concat('b'), actorData.data.characteristics[ch].bonus.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (formula.includes("yard") )
|
|
||||||
formula = formula.replace('yard', "mètre" );
|
|
||||||
if (formula.includes("yds") )
|
|
||||||
formula = formula.replace('yds', "m." );
|
|
||||||
// To evaluate multiplication, replace x with *
|
|
||||||
formula = formula.replace('x', '*');
|
|
||||||
//console.log("FOEM", formula);
|
|
||||||
return eval(formula);
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
//console.log("FOEM2", formula);
|
|
||||||
return formula;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------*/
|
|
||||||
game.wfrp4e.entities.ActorWfrp4e.prototype.calculateSpellDamage = function(formula, isMagicMissile) {
|
|
||||||
//console.log("Compute FR")
|
|
||||||
let actorData = this.data
|
|
||||||
formula = formula.toLowerCase();
|
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------*/
|
||||||
|
game.wfrp4e.entities.ItemWfrp4e.prototype.computeSpellDamage = function(formula, isMagicMissile) {
|
||||||
|
try {
|
||||||
|
|
||||||
|
formula = formula.toLowerCase();
|
||||||
|
|
||||||
if (isMagicMissile) // If it's a magic missile, damage includes willpower bonus
|
if (isMagicMissile) // If it's a magic missile, damage includes willpower bonus
|
||||||
{
|
{
|
||||||
formula += "+ " + actorData.data.characteristics["wp"].bonus
|
formula += "+ " + this.actor.characteristics["wp"].bonus
|
||||||
}
|
}
|
||||||
|
|
||||||
// Specific case, to avoid wrong matching with "Force"
|
// Specific case, to avoid wrong matching with "Force"
|
||||||
if (formula.includes("toughness bonus")) {
|
if (formula.includes("toughness bonus")) {
|
||||||
formula = formula.replace( "toughness bonus", actorData.data.characteristics["t"].bonus);
|
formula = formula.replace( "toughness bonus", actorData.data.characteristics["t"].bonus);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Specific case, to avoid wrong matching with "Force"
|
// Specific case, to avoid wrong matching with "Force"
|
||||||
if (formula.includes("force mentale"))
|
if (formula.includes("force mentale"))
|
||||||
{
|
{
|
||||||
@ -123,7 +63,7 @@ Hooks.once('init', () => {
|
|||||||
} else
|
} else
|
||||||
formula = formula.replace("force mentale", actorData.data.characteristics["wp"].value);
|
formula = formula.replace("force mentale", actorData.data.characteristics["wp"].value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Iterate through characteristics
|
// Iterate through characteristics
|
||||||
for(let ch in actorData.data.characteristics)
|
for(let ch in actorData.data.characteristics)
|
||||||
{
|
{
|
||||||
@ -139,13 +79,20 @@ Hooks.once('init', () => {
|
|||||||
formula = formula.replace(game.wfrp4e.config.characteristics[ch].toLowerCase(), actorData.data.characteristics[ch].value);
|
formula = formula.replace(game.wfrp4e.config.characteristics[ch].toLowerCase(), actorData.data.characteristics[ch].value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//console.log("calculateSpellDamage -> " + formula );
|
return eval(formula);
|
||||||
return eval(formula);
|
}
|
||||||
}
|
catch (e) {
|
||||||
|
throw ui.notifications.error("Error: could not parse spell damage. See console for details")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
game.wfrp4e.entities.ActorWfrp4e.prototype.calculateSpellAttributes = function(formula, aoe=false) {
|
game.wfrp4e.entities.ItemWfrp4e.prototype.computeSpellPrayerFormula = function(type, aoe=false, formulaOverride) {
|
||||||
|
let formula = formulaOverride || this[type]?.value
|
||||||
|
if (Number.isNumeric(formula))
|
||||||
|
return formula
|
||||||
|
|
||||||
//console.log("Compute FR")
|
//console.log("Compute FR")
|
||||||
let actorData = this.data
|
let actorData = this.data
|
||||||
formula = formula.toLowerCase();
|
formula = formula.toLowerCase();
|
||||||
|
4
fr.json
4
fr.json
@ -561,7 +561,8 @@
|
|||||||
"CHAT.CommandLine.Help.Corruption.Usage.Command" : "/corruption",
|
"CHAT.CommandLine.Help.Corruption.Usage.Command" : "/corruption",
|
||||||
"CHAT.CommandLine.Help.Corruption.Usage.Example" : "<br>/corruption minor<br>/corruption moderate",
|
"CHAT.CommandLine.Help.Corruption.Usage.Example" : "<br>/corruption minor<br>/corruption moderate",
|
||||||
"CHAT.CommandLine.Help.Corruption.Usage.Note" : "Utilisez cette commande pour demander à vos joueurs de faire un jet contres les influences corruptrices.",
|
"CHAT.CommandLine.Help.Corruption.Usage.Note" : "Utilisez cette commande pour demander à vos joueurs de faire un jet contres les influences corruptrices.",
|
||||||
|
"CHAT.EndCombat": "Statut de fin de combat",
|
||||||
|
"CHAT.InfectionReminder": " Ces personnages ont reçus une blessure critique and doivent réussir un <b>Test de Résistance Trés Facile (+60)</b> ou recevoir une @Compendium[wfrp4e-core.diseases.1hQuVFZt9QnnbWzg]{Infection Mineure}.",
|
||||||
"CHAT.TestModifiers.AttackingLarger": "Bonus de +10 à <b>{attacker}</b>pour l'attaque d'une créature plus grande",
|
"CHAT.TestModifiers.AttackingLarger": "Bonus de +10 à <b>{attacker}</b>pour l'attaque d'une créature plus grande",
|
||||||
"CHAT.TestModifiers.WeaponLength": "Pénalité de -10 à <b>{attacker}</b> à cause d'une arme plus courte.",
|
"CHAT.TestModifiers.WeaponLength": "Pénalité de -10 à <b>{attacker}</b> à cause d'une arme plus courte.",
|
||||||
"CHAT.TestModifiers.ShootingLarger": "Bonus de +{bonus} à <b>{attacker}</b> pour tir sur une cible plus grande",
|
"CHAT.TestModifiers.ShootingLarger": "Bonus de +{bonus} à <b>{attacker}</b> pour tir sur une cible plus grande",
|
||||||
@ -1410,6 +1411,7 @@
|
|||||||
"Home": "Revenir à la maison",
|
"Home": "Revenir à la maison",
|
||||||
"Male": "Homme",
|
"Male": "Homme",
|
||||||
"Female": "Femme",
|
"Female": "Femme",
|
||||||
|
"Update": "Mise à jour",
|
||||||
|
|
||||||
"TRAVEL.TravelMessageBase": "De <b>{from}</b> à <b>{to}</b> : ",
|
"TRAVEL.TravelMessageBase": "De <b>{from}</b> à <b>{to}</b> : ",
|
||||||
"TRAVEL.TravelMessageRoad": "<br><b>Route</b> : {road_distance} km<br> En chariot : {road_days} jours, danger {road_danger_string}<br> A Cheval : {road_horse_heavy_days} jours, danger {road_danger_string}<br> A Cheval (Rapide) : {road_horse_fast_days} jours, danger {road_danger_string}<br> A Pied : {road_feet_days} jours, danger {road_danger_feet_string}",
|
"TRAVEL.TravelMessageRoad": "<br><b>Route</b> : {road_distance} km<br> En chariot : {road_days} jours, danger {road_danger_string}<br> A Cheval : {road_horse_heavy_days} jours, danger {road_danger_string}<br> A Cheval (Rapide) : {road_horse_fast_days} jours, danger {road_danger_string}<br> A Pied : {road_feet_days} jours, danger {road_danger_feet_string}",
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"name": "WH4-fr-translation",
|
"name": "WH4-fr-translation",
|
||||||
"title": "WFRP4e - Core Module en français.",
|
"title": "WFRP4e - Core Module en français.",
|
||||||
"description": "Traduction Française pour Warhammer v4.",
|
"description": "Traduction Française pour Warhammer v4.",
|
||||||
"version": "4.0.8",
|
"version": "4.0.9",
|
||||||
"minimumCoreVersion" : "0.8.0",
|
"minimumCoreVersion" : "0.8.0",
|
||||||
"compatibleCoreVersion": "0.8.8",
|
"compatibleCoreVersion": "0.8.8",
|
||||||
"author": "LeRatierBretonnien",
|
"author": "LeRatierBretonnien",
|
||||||
|
Loading…
Reference in New Issue
Block a user