Merge branch 'combat-extract' into 'dev_1.1'

Fixes suite aux test de combat

See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!72
This commit is contained in:
Leratier Bretonnien 2020-12-15 07:33:59 +00:00
commit d1c9bfe4b0
10 changed files with 184 additions and 120 deletions

View File

@ -17,7 +17,6 @@ import { RdDRollTables } from "./rdd-rolltables.js";
import { ChatUtility } from "./chat-utility.js";
import { RdDItemSort } from "./item-sort.js";
import { Grammar } from "./grammar.js";
import { RdDCalendrier } from "./rdd-calendrier.js";
import { RdDItemArme } from "./item-arme.js";
import { RdDCombat } from "./rdd-combat.js";
@ -120,10 +119,16 @@ export class RdDActor extends Actor {
return this.data.data.compteurs.chance.value;
}
/* -------------------------------------------- */
getForceValue() {
return this.data.data.carac.force ? this.data.data.carac.force.value : this.data.data.carac.reve.value;
}
/* -------------------------------------------- */
getBonusDegat() {
return parseInt(this.data.data.attributs.plusdom.value);
}
/* -------------------------------------------- */
getCompetence(compName) {
return RdDUtility.findCompetence(this.data.items, compName);
@ -156,7 +161,7 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */
async performRoll(rollData, attacker = undefined) {
rollData.demiSurprise = this.isDemiSurprise();
rollData.surprise = this.getSurprise();
// Manage weapon categories when parrying (cf. page 115 )
if (rollData.arme && rollData.attackerRoll) { // Manage parade depending on weapon type, and change roll results
@ -240,13 +245,13 @@ export class RdDActor extends Actor {
let recul = await RdDResolutionTable.roll( 10, reculNiveau );
let msg = "";
if (recul.isSuccess) {
msg = "Jet de Recul réussi, aucun effet !";
msg = this.data.name + " - Jet de Recul réussi, aucun effet !";
} else {
let chute = await RdDResolutionTable.roll( this.data.data.carac.agilite.value, reculNiveau );
if ( !chute.isSuccess || recul.isETotal ) {
msg = "Jet de Recul : Vous subissez le recul du coup, et vous chutez au sol ! Vous ne pouvez plus attaquer ce round.";
msg = this.data.name + " - Jet de Recul : Vous subissez le recul du coup, et vous chutez au sol ! Vous ne pouvez plus attaquer ce round.";
} else {
msg = "Jet de Recul : Vous subissez le recul du coup, et vous reculez de quelques mètres ! Vous ne pouvez plus attaquer ce round.";
msg = this.data.name + " - Jet de Recul : Vous subissez le recul du coup, et vous reculez de quelques mètres ! Vous ne pouvez plus attaquer ce round.";
}
}
ChatMessage.create( {content: msg,
@ -262,7 +267,7 @@ export class RdDActor extends Actor {
let quality = rolled.quality
console.log(">>> ROLL", rollData, rolled);
let xpmsg = RdDResolutionTable.buildXpMessage(rolled, rollData.finalLevel);
this._appliquerAjoutExperience(rollData)
let resumeCompetence = (rollData.competence) ? rollData.competence.name : (rollData.diffLibre + rollData.diffConditions);
let explications = "<br>Points de taches : " + rolled.ptTache + ", ajustement qualité: " + rolled.ptQualite;
@ -296,9 +301,8 @@ export class RdDActor extends Actor {
ChatMessage.create( { content: "Vous avez attaqué en Rapidité. Ce cas n'est pas géré autmatiquement, donc suivez les directives de votre MJ pour gérer ce cas.",
whisper: ChatMessage.getWhisperRecipients( this.name ) } );
}
rollData.domArmePlusDom = this._calculBonusDegats(rollData);
rollData.degats = new Roll("2d10").roll().total + rollData.domArmePlusDom; // Dégats totaux
rollData.loc = RdDUtility.getLocalisation();
rollData.dmg = RdDCombat.calculBonusDegats(rollData, this);
if (target)
{
@ -306,7 +310,7 @@ export class RdDActor extends Actor {
defenseMsg = RdDUtility.buildDefenseChatCard(this, target, rollData);
explications += "<br><strong>Cible</strong> : " + target.actor.data.name;
}
explications += "<br>Encaissement : " + rollData.degats + "<br>Localisation : " + rollData.loc.label;
explications += "<br>Encaissement : " + rollData.degats + "<br>Localisation : " + rollData.dmg.loc.label;
} else {
explications = "<br>Echec ! Pas de dégâts";
}
@ -321,8 +325,7 @@ export class RdDActor extends Actor {
content: "<strong>Test : " + rollData.selectedCarac.label + " / " + resumeCompetence + "</strong>"
+ "<br>Difficultés <strong>libre : " + rollData.diffLibre + "</strong> / conditions : " + Misc.toSignedString(rollData.diffConditions) +" / état : " + rollData.etat
+ RdDResolutionTable.explain(rolled)
+ "<br><strong>" + quality + "</strong>"
+ explications + xpmsg
+ explications
}
ChatUtility.chatWithRollMode(chatOptions, this.name)
@ -355,7 +358,6 @@ export class RdDActor extends Actor {
if (this.isEntiteCauchemar()) {
return '';
}
// TODO: gestion des conditions de demi-surprise
if ( this.data.data.sante.sonne.value) {
return 'demi';
}
@ -379,26 +381,6 @@ export class RdDActor extends Actor {
return mortalite;
}
/* -------------------------------------------- */
_calculBonusDegats(rollData) {
if ( rollData.arme.name.toLowerCase() == "esquive") return 0; // Specific case management
const dmgConditions = rollData.isCharge ? 2 : 0;
const dmgParticuliere = rollData.particuliereAttaque == 'force' ? 5 : 0;
const dmgArme = parseInt(rollData.arme.data.dommages);
const dmgPerso = this._calculBonusDegatsActor(rollData.selectedCarac.label, dmgArme);
return dmgArme + dmgPerso + dmgConditions + dmgParticuliere;
}
_calculBonusDegatsActor(caracName, dmgArme) {
const dmgPerso = parseInt(this.data.data.attributs.plusdom.value);
switch (caracName) {
case "Tir": return 0;
case "Lancer": return Math.max(0, Math.min(dmgArme, dmgPerso));
}
return dmgPerso;
}
/* -------------------------------------------- */
async dormirChateauDormant() {
let message = {
@ -455,7 +437,7 @@ export class RdDActor extends Actor {
if (!retrograde) {
return false;
}
mergeObject(retrograde, { "active": true, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "localisation": blessure.localisation });
mergeObject(retrograde, { "active": true, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "loc": blessure.loc });
}
this._supprimerBlessure(blessure);
return true;
@ -463,7 +445,7 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */
_supprimerBlessure(blessure) {
mergeObject(blessure, { "active": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "localisation": "" });
mergeObject(blessure, { "active": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "loc": "" });
}
/* -------------------------------------------- */
@ -509,6 +491,7 @@ export class RdDActor extends Actor {
whisper: ChatUtility.getWhisperRecipientsAndGMs( this.name ),
content : "Remise à neuf de " + this.name
};
if (this.data.data.blessures){
const blessures = duplicate(this.data.data.blessures);
for (let listeBlessures of [blessures.legeres.liste, blessures.graves.liste, blessures.critiques.liste]) {
for (let blessure of listeBlessures) {
@ -516,11 +499,14 @@ export class RdDActor extends Actor {
}
}
await this.update( {"data.blessures": blessures } );
}
await this.santeIncDec("vie", this.data.data.sante.vie.max - this.data.data.sante.vie.value);
await this.santeIncDec("endurance", this.data.data.sante.endurance.max - this.data.data.sante.endurance.value);
if (this.data.data.sante.fatigue){
let fatigue = duplicate(this.data.data.sante.fatigue)
fatigue.value = 0;
await this.update( {"data.sante.fatigue": fatigue } );
}
ChatMessage.create( message );
}
@ -1121,7 +1107,7 @@ export class RdDActor extends Actor {
blessure.premiers_soins = 0;
blessure.soins_complets = 0;
blessure.jours = 0;
blessure.localisation = "";
blessure.loc = "";
}
//console.log("Blessure update", bType, index, blessure, bList );
await this.update( { 'data.blessures': bList } );
@ -1134,7 +1120,7 @@ export class RdDActor extends Actor {
blessure.premiers_soins = psoins;
blessure.soins_complets = pcomplets;
blessure.jours = jours;
blessure.localisation = loc;
blessure.loc = loc;
await this.update( { 'data.blessures': bList } );
}
@ -1555,6 +1541,9 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */
ajustementAstrologique() {
if (this.isCreature()) {
return 0;
}
// selon l'heure de naissance...
return game.system.rdd.calendrier.getAjustementAstrologique(this.data.data.heure);
}
@ -1580,8 +1569,15 @@ export class RdDActor extends Actor {
let xp = Math.abs(rolled.finalLevel);
let xpCarac = Math.floor(xp / 2); // impair: arrondi inférieur en carac
let xpComp;
if (competenceName) {
xpComp = xp - xpCarac;
}
else {
xpComp = 0;
xpCarac = Math.max(xpCarac, 1);
let xpComp = xp - xpCarac;
}
if ( competenceName ) {
let competence = duplicate( RdDUtility.findCompetence( this.data.items, competenceName ) );
@ -1810,8 +1806,8 @@ export class RdDActor extends Actor {
}
/* -------------------------------------------- */
computeArmure( locData, domArmePlusDom )
{
computeArmure( locData, domArmePlusDom, arme = undefined ) {
// TODO: arc ignore armure
let protection = 0;
for (const item of this.data.items) {
if (item.type == "armure" && item.data.equipe) {
@ -1839,28 +1835,32 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */
async encaisserDommages( attackerRoll, attacker = undefined ) {
if (attacker && !await attacker.accorder(this, 'avant-encaissement')) {
return;
}
console.log("encaisserDommages", attackerRoll )
const armure = this.computeArmure( attackerRoll.loc, attackerRoll.domArmePlusDom);
let degatsReel = attackerRoll.degats - armure;
const armure = this.computeArmure( attackerRoll.loc, attackerRoll.domArmePlusDom, attackerRoll.arme);
let result = RdDUtility.computeBlessuresSante(degatsReel, attackerRoll.mortalite);
const rollEncaissement = new Roll("2d10 + @dmg - @armure",{
dmg: attackerRoll.dmg.total,
armure: armure
}).roll();
RdDDice.show(rollEncaissement, )
let result = RdDUtility.computeBlessuresSante(rollEncaissement.total, attackerRoll.mortalite, attackerRoll.dmg.loc);
result.endurance = Math.max(result.endurance, -Number(this.data.data.sante.endurance.value));
await this.santeIncDec("vie", result.vie);
await this.santeIncDec("endurance", result.endurance, (result.critiques > 0));
result.locName = (attackerRoll.loc) ? attackerRoll.loc.label : "Corps";
this.manageBlessures(result); // Will upate the result table
const blessureLegere = (result.legeres > 0 ? "une blessure légère" : "");
const blessureGrave = (result.graves > 0 ? "une blessure grave" : "");
const blessureCritique = (result.critiques > 0 ? "une blessure critique" : "");
let commonMsg = { title: "Blessures !", content: this.data.name + " a encaissé : " +
"<br>Encaissement final : " + degatsReel +
"<br>" + blessureLegere + blessureGrave + blessureCritique }
let commonMsg = {
title: "Blessures !",
roll: rollEncaissement ,
content: this.data.name + " a encaissé " + blessureLegere + blessureGrave + blessureCritique
}
let addonMsg = "<br>Et a perdu : <br>" + result.endurance + " Endurance et " + result.vie + " Points de Vie";
if ( this.hasPlayerOwner ) {
commonMsg.content += addonMsg; // Message pour tout le monde

View File

@ -46,7 +46,8 @@ export class RdDItemArme extends Item {
static armeUneOuDeuxMains(arme, aUneMain) {
arme.data.unemain = arme.data.unemain || !arme.data.deuxmains;
const uneOuDeuxMains = arme.data.unemain && arme.data.deuxmains;
if (arme.data.dommages.includes("/")) { // Sanity check
const containsSlash = !Number.isInteger(arme.data.dommages) && arme.data.dommages.includes("/");
if (containsSlash) { // Sanity check
arme = duplicate(arme);
const tableauDegats = arme.data.dommages.split("/");
@ -59,10 +60,7 @@ export class RdDItemArme extends Item {
arme.data.dommagesReels = Number(arme.data.dommages);
}
if (
(uneOuDeuxMains && !arme.data.dommages.includes("/")) ||
(!uneOuDeuxMains && arme.data.dommages.includes("/")))
{
if (uneOuDeuxMains != containsSlash) {
ui.notifications.info("Les dommages de l'arme à 1/2 mains " + arme.name + " ne sont pas corrects (ie sous la forme X/Y)");
}
return arme;

View File

@ -17,7 +17,7 @@ export class RdDCombat {
static createUsingTarget(attacker) {
const target = RdDCombat.getTarget();
if (target == undefined) {
ui.notifications.warn("Vous devriez choisir une cible à attaquer!");
ui.notifications.warn("Vous devez choisir une seule cible à attaquer!");
}
return this.create(attacker, target ? target.actor : undefined, target)
}
@ -112,11 +112,11 @@ export class RdDCombat {
let rollData = {
coupsNonMortels: false,
competence: competence,
demiSurprise: this.attacker.isDemiSurprise()
surprise: this.attacker.getSurprise()
};
if (this.attacker.isCreature()) {
this._prepareRollDataCreature(rollData, competence);
this._modifieRollDataCreature(rollData, competence);
}
else {
// Usual competence
@ -125,7 +125,7 @@ export class RdDCombat {
return rollData;
}
_prepareRollDataCreature(rollData, competence) {
_modifieRollDataCreature(rollData, competence) {
competence = duplicate(competence);
competence.data.defaut_carac = "carac_creature";
competence.data.categorie = "creature";
@ -171,16 +171,13 @@ export class RdDCombat {
whisper: ChatMessage.getWhisperRecipients(this.attacker.name)
});
}
rollData.domArmePlusDom = this.attacker._calculBonusDegats(rollData);
rollData.degats = new Roll("2d10").roll().total + rollData.domArmePlusDom; // Dégats totaux
rollData.loc = RdDUtility.getLocalisation();
rollData.dmg = RdDCombat.calculBonusDegats(rollData, this.attacker);
if (this.target) {
rollData.mortalite = this._calculMortaliteEncaissement(rollData);
explications += "<br><strong>Cible</strong> : " + this.defender.data.name;
}
explications += "<br>Encaissement : " + rollData.degats + "<br>Localisation : " + rollData.loc.label;
explications += "<br>Encaissement à "+ Misc.toSignedString(rollData.dmg.total)+ " (" + rollData.dmg.loc.label+")";
// Save rollData for defender
game.system.rdd.rollDataHandler[this.attackerId] = duplicate(rollData);
@ -202,7 +199,7 @@ export class RdDCombat {
_messageDefenseur(rollData) {
console.log("RdDCombat._messageDefenseur", rollData, " / ", this.attacker, this.target, this.target.actor.isToken, this.attacker.data._id, rollData.competence.data.categorie);
let content = "<strong>" + this.defender.name + "</strong> doit se défendre : <br><span class='chat-card-button-area'>";
let content = "<strong>" + this.defender.name + "</strong> doit se défendre :<span class='chat-card-button-area'>";
// parades
let filterArmesParade = this._getFilterArmesParade(rollData.competence.data.categorie);
@ -216,8 +213,7 @@ export class RdDCombat {
}
// encaisser
content += "<br><a class='chat-card-button' id='encaisser-button' data-attackerId='" + this.attackerId + "' data-defenderTokenId='" + this.defenderTokenId + "'>Encaisser !</a>";
content += "<br><a class='chat-card-button' id='encaisser-button' data-attackerId='" + this.attackerId + "' data-defenderTokenId='" + this.defenderTokenId + "'>Encaisser à " + Misc.toSignedString(rollData.dmg.total) + " !</a>";
content += "</span>"
let defense = {
@ -271,12 +267,11 @@ export class RdDCombat {
_onAttaqueEchec(rollData) {
console.log("RdDCombat.onAttaqueEchec >>>", rollData);
let target = this._getTarget();
let chatOptions = {
content: "<strong>Test : " + rollData.selectedCarac.label + " / " + rollData.competence.name + "</strong>"
+ "<br>Difficultés <strong>libre : " + rollData.diffLibre + "</strong> / conditions : " + Misc.toSignedString(rollData.diffConditions) + " / état : " + rollData.etat
+ RdDResolutionTable.explain(rolled)
+ (target ? "<br><strong>Cible</strong> : " + this.defender.data.name : "")
+ RdDResolutionTable.explain(rollData.rolled)
+ (this.target ? "<br><strong>Cible</strong> : " + this.defender.data.name : "")
}
ChatUtility.chatWithRollMode(chatOptions, this.attacker.name)
}
@ -329,13 +324,13 @@ export class RdDCombat {
attackerRoll: attackerRoll,
competence: competence,
arme: arme.data,
demiSurprise: this.defender.isDemiSurprise(),
surprise: this.defender.getSurprise(),
needSignificative: this._needSignificative(attackerRoll) || RdDItemArme.needParadeSignificative(armeAttaque, armeParade),
needResist: this._needResist(armeAttaque, armeParade),
carac: this.defender.data.data.carac
};
if (isCreature) {
this._prepareRollDataCreature(rollData, competence);
this._modifieRollDataCreature(rollData, competence);
}
return rollData;
}
@ -399,10 +394,8 @@ export class RdDCombat {
async _onParadeEchec(rollData) {
console.log("RdDCombat._onParadeEchec >>>", rollData);
let explications = "<br><strong>Parade échouée, encaissement !</strong>";
if (rollData.demiSurprise) {
explications += " Demi surprise!";
}
let explications = "<br><strong>Parade échouée, encaissement !</strong> ";
explications += this.descriptionSurprise(rollData.surprise);
if (rollData.needSignificative) {
explications += " Significative nécessaire!";
}
@ -452,13 +445,13 @@ export class RdDCombat {
diffLibre: attackerRoll.diffLibre,
attackerRoll: attackerRoll,
competence: competence,
demiSurprise: this.defender.isDemiSurprise(),
surprise: this.defender.getSurprise(),
needSignificative: this._needSignificative(attackerRoll),
carac: this.defender.data.data.carac
};
if (this.defender.isCreature()) {
this._prepareRollDataCreature(rollData, competence);
this._modifieRollDataCreature(rollData, competence);
}
return rollData;
}
@ -497,10 +490,8 @@ export class RdDCombat {
async _onEsquiveEchec(rollData) {
console.log("RdDCombat._onEsquiveEchec >>>", rollData);
let explications = "<br><strong>Esquive échouée, encaissement !</strong>";
if (rollData.demiSurprise) {
explications += " Demi surprise!";
}
let explications = "<br><strong>Esquive échouée, encaissement !</strong> ";
explications += RdDCombat.descriptionSurprise(rollData.surprise);
if (rollData.needSignificative) {
explications += " Significative nécessaire!";
}
@ -517,6 +508,7 @@ export class RdDCombat {
await this.defender.computeRecul(rollData, true);
this.encaisser(rollData.attackerRoll);
}
/* -------------------------------------------- */
encaisser(attackerRoll) {
// TODO: gestion message pour chance/encaissement
@ -569,4 +561,65 @@ export class RdDCombat {
return rolled.isSuccess;
}
/* -------------------------------------------- */
static calculBonusDegats(rollData, actor) {
let dmg = { total: 0, loc: RdDUtility.getLocalisation() };
if (rollData.arme.name.toLowerCase() == "esquive") {
// Specific case management
ui.notifications.warn("Calcul de bonus dégats sur eswquive")
return dmg;
}
dmg.dmgArme = RdDCombat._dmgArme(rollData);
dmg.ignoreArmure = 0; // TODO: calculer pour arcs et arbaletes, gérer pour lmes créatures
dmg.dmgTactique= RdDCombat._dmgTactique(rollData);
dmg.dmgParticuliere= RdDCombat._dmgParticuliere(rollData);
dmg.dmgSurprise= RdDCombat._dmgSurprise(rollData);
dmg.dmgActor = RdDCombat._dmgActor(actor.getBonusDegat(), rollData.selectedCarac.label, dmg.dmgArme);
dmg.total = dmg.dmgSurprise + dmg.dmgTactique + dmg.dmgArme + dmg.dmgActor + dmg.dmgParticuliere;
return dmg;
}
static _dmgArme(rollData) {
return parseInt(rollData.arme.data.dommages);
}
static _dmgActor(bonusDegat, categorie, dmgArme) {
switch (categorie) {
case "Tir": return 0;
case "Lancer": return Math.max(0, Math.min(dmgArme, bonusDegat));
}
return bonusDegat;
}
static _dmgTactique(rollData) {
return rollData.isCharge ? 2 : 0;
}
static _dmgParticuliere(rollData) {
return rollData.particuliereAttaque == 'force' ? 5 : 0;
}
static _dmgSurprise(rollData) {
if (rollData.surprise) {
switch (rollData.surprise) {
case 'demi': return 1;
case 'totale': return 10;
}
}
return 0;
}
/* -------------------------------------------- */
static descriptionSurprise(surprise) {
if (surprise) {
switch (surprise) {
case 'demi': return 'demi-surprise';
case 'totale': return 'surprise totale';
}
}
return '';
}
}

View File

@ -40,7 +40,6 @@ const specialResults = [
{ part: 20, epart: 100, etotal: 100, min: 96, max: 100 }
];
const reussites = [
{ code: "etotal", isPart: false, isSign: false, isSuccess: false, isEchec: true, isEPart: true, isETotal: true, ptTache: -4, ptQualite: -6, quality: "Echec total", condition: (target, roll) => roll >= target.etotal && roll <= 100 },
{ code: "epart", isPart: false, isSign: false, isSuccess: false, isEchec: true, isEPart: true, isETotal: false, ptTache: -2, ptQualite: -4, quality: "Echec particulier", condition: (target, roll) => (roll >= target.epart && roll < target.etotal) },
@ -149,19 +148,33 @@ export class RdDResolutionTable {
/* -------------------------------------------- */
static isEchec(rollData) {
return rollData.demiSurprise ? !rollData.rolled.isSign : rollData.rolled.isEchec;
switch (rollData.surprise) {
case 'demi': return !rollData.rolled.isSign;
case 'totale': return true;
}
/* -------------------------------------------- */
return rollData.rolled.isEchec;
}
static isEchecTotal(rollData) {
return (rollData.demiSurprise && rollData.arme) ? rollData.rolled.isEchec : rollData.rolled.isETotal;
if (rollData.arme && rollData.surprise == 'demi') {
return rollData.rolled.isEchec;
}
/* -------------------------------------------- */
return rollData.rolled.isETotal;
}
static isParticuliere(rollData) {
return (rollData.demiSurprise && rollData.arme) ? false : rollData.rolled.isPart;
if (rollData.arme && rollData.surprise) {
return false;
}
/* -------------------------------------------- */
return rollData.rolled.isPart;
}
static isReussite(rollData) {
return rollData.demiSurprise ? rollData.rolled.isSign : rollData.rolled.isSuccess;
switch (rollData.surprise) {
case 'demi': return rollData.rolled.isSign;
case 'totale': return false;
}
return rollData.rolled.isSuccess;
}
/* -------------------------------------------- */

View File

@ -33,12 +33,11 @@ export class RdDEncaisser extends Dialog {
/* -------------------------------------------- */
performEncaisser(html, mortalite = "mortel") {
const ajustement = Number(this.modifier);
const encaissement = new Roll("2d10").roll().total + ajustement;
this.actor.encaisserDommages({
degats: encaissement,
domArmePlusDom: ajustement,
dmg:{
total: Number(this.modifier),
loc: { result: 0, label: "Corps" },
},
mortalite: mortalite
});
}

View File

@ -325,10 +325,10 @@ export class RdDTMRDialog extends Dialog {
return;
}
if (cellDescr.type == "lac" || cellDescr.type == "fleuve" || cellDescr.type == "marais") {
// TODO: permettre de choisir la voie de draconic?
let draconic = this.actor.getBestDraconic();
let carac = this.actor.getReveActuel();
// TODO: ajouter l'état général?
const etatGeneral = this.actor.data.data.compteurs.etat.value
let difficulte = draconic.data.niveau - 7;
let rolled = await RdDResolutionTable.roll(carac, difficulte);
@ -357,7 +357,7 @@ export class RdDTMRDialog extends Dialog {
}
if (rolled.isPart) {
explication += "<br>Vous avez fait une Réussite Particulière";
explication += RdDResolutionTable.buildXpMessage(rolled, difficulte);
this.actor._appliquerAjoutExperience({ rolled: rolled, seletedCarac: {label: 'reve'}, competence: draconic.name })
msg2MJ += "<br>Et a fait une réussite particulière";
}

View File

@ -581,11 +581,12 @@ export class RdDUtility {
}
/* -------------------------------------------- */
static computeBlessuresSante( degats, mortalite="mortel" ) {
static computeBlessuresSante( degats, mortalite, loc) {
let encaissement = RdDUtility.selectEncaissement(degats, mortalite)
let over20 = Math.max(degats - 20, 0);
encaissement.endurance = - RdDUtility._evaluatePerte(encaissement.endurance, over20);
encaissement.vie = - RdDUtility._evaluatePerte(encaissement.vie, over20);
encaissement.locName = loc ? loc.label : "Corps";
return encaissement;
}
@ -837,9 +838,9 @@ export class RdDUtility {
/* -------------------------------------------- */
static _handleMsgEncaisser(data) {
if (game.user.isGM) { // Seul le GM effectue l'encaissement sur la fiche
let rollData = game.system.rdd.rollDataHandler[data.attackerId]; // Retrieve the rolldata from the store
let attackerRoll = game.system.rdd.rollDataHandler[data.attackerId]; // Retrieve the rolldata from the store
let defenderToken = canvas.tokens.get(data.defenderTokenId);
defenderToken.actor.encaisserDommages(rollData);
defenderToken.actor.encaisserDommages(attackerRoll);
}
}

View File

@ -131,7 +131,7 @@
Jours <input class="blessures-soins" type="text" name='jours' data-dtype="number" value="{{this.jours}}" />
-
Loc. <input class="blessures-soins" type="text" name='localisation' data-dtype="String"
value="{{this.localisation}}" />
value="{{this.loc}}" />
</li>
{{/each}}
</div>
@ -149,7 +149,7 @@
Jours <input class="blessures-soins" type="text" name="jours" data-dtype="number" value="{{bless.jours}}" />
-
Loc. <input class="blessures-soins" type="text" name="localisation" data-dtype="String"
value="{{bless.localisation}}" />
value="{{bless.loc}}" />
</li>
{{/each}}
</div>
@ -167,7 +167,7 @@
Jours <input class="blessures-soins" type="text" name="jours" data-dtype="number" value="{{bless.jours}}" />
-
Loc. <input class="blessures-soins" type="text" name="localisation" data-dtype="String"
value="{{bless.localisation}}" />
value="{{bless.loc}}" />
</li>
</li>
{{/each}}

View File

@ -131,7 +131,7 @@
Jours <input class="blessures-soins" type="text" name='jours' data-dtype="number" value="{{this.jours}}" />
-
Loc. <input class="blessures-soins" type="text" name='localisation' data-dtype="String"
value="{{this.localisation}}" />
value="{{this.loc}}" />
</li>
{{/each}}
</div>
@ -149,7 +149,7 @@
Jours <input class="blessures-soins" type="text" name="jours" data-dtype="number" value="{{bless.jours}}" />
-
Loc. <input class="blessures-soins" type="text" name="localisation" data-dtype="String"
value="{{bless.localisation}}" />
value="{{bless.loc}}" />
</li>
{{/each}}
</div>
@ -167,7 +167,7 @@
Jours <input class="blessures-soins" type="text" name="jours" data-dtype="number" value="{{bless.jours}}" />
-
Loc. <input class="blessures-soins" type="text" name="localisation" data-dtype="String"
value="{{bless.localisation}}" />
value="{{bless.loc}}" />
</li>
</li>
{{/each}}

View File

@ -394,7 +394,7 @@
</li>
<li>
Loc.
<input class="blessures-soins" type="text" name="localisation" data-dtype="String" value="{{bless.localisation}}"/>
<input class="blessures-soins" type="text" name="localisation" data-dtype="String" value="{{bless.loc}}"/>
</li>
</ul>
</li>
@ -426,7 +426,7 @@
</li>
<li>
Loc.
<input class="blessures-soins" type="text" name="localisation" data-dtype="String" value="{{bless.localisation}}"/>
<input class="blessures-soins" type="text" name="localisation" data-dtype="String" value="{{bless.loc}}"/>
</li>
</ul>
</li>
@ -458,7 +458,7 @@
</li>
<li>
Loc.
<input class="blessures-soins" type="text" name="localisation" data-dtype="String" value="{{bless.localisation}}"/>
<input class="blessures-soins" type="text" name="localisation" data-dtype="String" value="{{bless.loc}}"/>
</li>
</ul>
</li>