Merge branch 'amelioration-encaissement' into 'v1.2'
#100 Amélioration messages encaissement See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!109
This commit is contained in:
commit
0290b182ca
321
module/actor.js
321
module/actor.js
@ -216,8 +216,7 @@ export class RdDActor extends Actor {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getBestDraconic() {
|
getBestDraconic() {
|
||||||
const list = this.getDraconicList().sort((a, b) => b.data.niveau - a.data.niveau);
|
const list = this.getDraconicList().sort((a, b) => b.data.niveau - a.data.niveau);
|
||||||
if (list.length==0)
|
if (list.length == 0) {
|
||||||
{
|
|
||||||
return { name: "none", niveau: -11 };
|
return { name: "none", niveau: -11 };
|
||||||
}
|
}
|
||||||
return duplicate(list[0]);
|
return duplicate(list[0]);
|
||||||
@ -241,11 +240,8 @@ export class RdDActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getSurprise() {
|
getSurprise() {
|
||||||
if (this.isEntiteCauchemar()) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
// TODO: gérer une liste de flags demi-surprise (avec icône sur le token)?
|
// TODO: gérer une liste de flags demi-surprise (avec icône sur le token)?
|
||||||
if ( this.data.data.sante.sonne && this.data.data.sante.sonne.value) {
|
if (this.getSonne()) {
|
||||||
return 'demi';
|
return 'demi';
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
@ -277,7 +273,7 @@ export class RdDActor extends Actor {
|
|||||||
await this._recupererVie(message);
|
await this._recupererVie(message);
|
||||||
await this.transformerStress(message);
|
await this.transformerStress(message);
|
||||||
await this.retourSeuilDeReve(message);
|
await this.retourSeuilDeReve(message);
|
||||||
message.content = "A la fin Chateau Dormant, " + message.content +"<br>Un nouveau jour se lève";
|
message.content = `A la fin Chateau Dormant, ${message.content}<br>Un nouveau jour se lève`;
|
||||||
ChatMessage.create(message);
|
ChatMessage.create(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,16 +287,16 @@ export class RdDActor extends Actor {
|
|||||||
let rolled = await this._jetRecuperationConstitution(Misc.toInt(blessure.soins_complets), message);
|
let rolled = await this._jetRecuperationConstitution(Misc.toInt(blessure.soins_complets), message);
|
||||||
blessure.soins_complets = 0;
|
blessure.soins_complets = 0;
|
||||||
if (rolled.isSuccess && this._retrograderBlessure(type, blessure, moindres)) {
|
if (rolled.isSuccess && this._retrograderBlessure(type, blessure, moindres)) {
|
||||||
message.content += " -- une blessure " + type + " cicatrise";
|
message.content += ` -- une blessure ${type} cicatrise`;
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
else if (rolled.isETotal) {
|
else if (rolled.isETotal) {
|
||||||
message.content += " -- une blessure " + type + " s'infecte (temps de guérison augmenté de " + definition.facteur + " jours, perte de vie)";
|
message.content += ` -- une blessure ${type} s'infecte (temps de guérison augmenté de ${definition.facteur} jours, perte de vie)`;
|
||||||
blessure.jours = 0;
|
blessure.jours = 0;
|
||||||
await this.santeIncDec("vie", -1);
|
await this.santeIncDec("vie", -1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
message.content += " -- une blessure " + type + " reste stable";
|
message.content += ` -- une blessure ${type} reste stable`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -310,8 +306,7 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
_retrograderBlessure(type, blessure, blessuresMoindres)
|
_retrograderBlessure(type, blessure, blessuresMoindres) {
|
||||||
{
|
|
||||||
if (type != "legere") {
|
if (type != "legere") {
|
||||||
let retrograde = blessuresMoindres.find(b => !b.active);
|
let retrograde = blessuresMoindres.find(b => !b.active);
|
||||||
if (!retrograde) {
|
if (!retrograde) {
|
||||||
@ -335,8 +330,7 @@ export class RdDActor extends Actor {
|
|||||||
let vieManquante = this.data.data.sante.vie.max - this.data.data.sante.vie.value;
|
let vieManquante = this.data.data.sante.vie.max - this.data.data.sante.vie.value;
|
||||||
if (nbBlessures == 0 && vieManquante > 0) {
|
if (nbBlessures == 0 && vieManquante > 0) {
|
||||||
let bonusSoins = 0;
|
let bonusSoins = 0;
|
||||||
for (let b of blessures)
|
for (let b of blessures) {
|
||||||
{
|
|
||||||
bonusSoins = Math.max(bonusSoins, Misc.toInt(b.soins_complets));
|
bonusSoins = Math.max(bonusSoins, Misc.toInt(b.soins_complets));
|
||||||
}
|
}
|
||||||
let rolled = await this._jetRecuperationConstitution(bonusSoins, message)
|
let rolled = await this._jetRecuperationConstitution(bonusSoins, message)
|
||||||
@ -418,8 +412,7 @@ export class RdDActor extends Actor {
|
|||||||
let ethylisme = duplicate(this.data.data.compteurs.ethylisme);
|
let ethylisme = duplicate(this.data.data.compteurs.ethylisme);
|
||||||
ethylisme.nb_doses = 0;
|
ethylisme.nb_doses = 0;
|
||||||
ethylisme.jet_moral = false;
|
ethylisme.jet_moral = false;
|
||||||
if (ethylisme.value < 1)
|
if (ethylisme.value < 1) {
|
||||||
{
|
|
||||||
ethylisme.value = Math.min(ethylisme.value + 1, 1);
|
ethylisme.value = Math.min(ethylisme.value + 1, 1);
|
||||||
if (ethylisme.value <= 0) {
|
if (ethylisme.value <= 0) {
|
||||||
message.content += `<br>Vous dégrisez un peu (${RdDUtility.getNomEthylisme(ethylisme.value)})`;
|
message.content += `<br>Vous dégrisez un peu (${RdDUtility.getNomEthylisme(ethylisme.value)})`;
|
||||||
@ -448,23 +441,20 @@ export class RdDActor extends Actor {
|
|||||||
fatigue.value = Math.max(fatigueMin, this._calculRecuperationSegment(fatigue.value));
|
fatigue.value = Math.max(fatigueMin, this._calculRecuperationSegment(fatigue.value));
|
||||||
console.log("recupererFatigue", fatigue)
|
console.log("recupererFatigue", fatigue)
|
||||||
await this.update({ "data.sante.fatigue": fatigue });
|
await this.update({ "data.sante.fatigue": fatigue });
|
||||||
if (fatigue.value == 0)
|
if (fatigue.value == 0) {
|
||||||
{
|
|
||||||
message.content += "<br>Vous êtes bien reposé";
|
message.content += "<br>Vous êtes bien reposé";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
_calculRecuperationSegment(actuel)
|
_calculRecuperationSegment(actuel) {
|
||||||
{
|
|
||||||
const segments = RdDUtility.getSegmentsFatigue(this.data.data.sante.endurance.max);
|
const segments = RdDUtility.getSegmentsFatigue(this.data.data.sante.endurance.max);
|
||||||
let cumul = 0;
|
let cumul = 0;
|
||||||
let i;
|
let i;
|
||||||
for (i = 0; i < 11; i++) {
|
for (i = 0; i < 11; i++) {
|
||||||
cumul += segments[i];
|
cumul += segments[i];
|
||||||
let diff = cumul - actuel;
|
let diff = cumul - actuel;
|
||||||
if (diff >= 0)
|
if (diff >= 0) {
|
||||||
{
|
|
||||||
const limit2Segments = Math.floor(segments[i] / 2);
|
const limit2Segments = Math.floor(segments[i] / 2);
|
||||||
if (diff > limit2Segments && i > 0) {
|
if (diff > limit2Segments && i > 0) {
|
||||||
cumul -= segments[i - 1]; // le segment est à moins de la moitié, il est récupéré
|
cumul -= segments[i - 1]; // le segment est à moins de la moitié, il est récupéré
|
||||||
@ -486,8 +476,7 @@ export class RdDActor extends Actor {
|
|||||||
else {
|
else {
|
||||||
let deRecuperation = (await DeDraconique.ddr("selfroll")).total;
|
let deRecuperation = (await DeDraconique.ddr("selfroll")).total;
|
||||||
console.log("recuperationReve", deRecuperation);
|
console.log("recuperationReve", deRecuperation);
|
||||||
if (deRecuperation>=7)
|
if (deRecuperation >= 7) {
|
||||||
{
|
|
||||||
// Rêve de Dragon !
|
// Rêve de Dragon !
|
||||||
message.content += `<br>Vous faites un <strong>Rêve de Dragon</strong> de ${deRecuperation} Points de rêve`;
|
message.content += `<br>Vous faites un <strong>Rêve de Dragon</strong> de ${deRecuperation} Points de rêve`;
|
||||||
message.content += await this.combattreReveDeDragon(deRecuperation);
|
message.content += await this.combattreReveDeDragon(deRecuperation);
|
||||||
@ -553,8 +542,7 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async updateCarac( caracName, caracValue )
|
async updateCarac(caracName, caracValue) {
|
||||||
{
|
|
||||||
let caracpath = "data.carac." + caracName + ".value"
|
let caracpath = "data.carac." + caracName + ".value"
|
||||||
if (caracName == "reve") {
|
if (caracName == "reve") {
|
||||||
if (caracValue > Misc.toInt(this.data.data.reve.seuil.value)) {
|
if (caracValue > Misc.toInt(this.data.data.reve.seuil.value)) {
|
||||||
@ -565,16 +553,14 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async updateCaracXP( caracName, caracXP )
|
async updateCaracXP(caracName, caracXP) {
|
||||||
{
|
|
||||||
let caracpath = "data.carac." + caracName + ".xp";
|
let caracpath = "data.carac." + caracName + ".xp";
|
||||||
await this.update({ [caracpath]: caracXP });
|
await this.update({ [caracpath]: caracXP });
|
||||||
this.checkCaracXP(caracName);
|
this.checkCaracXP(caracName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async updateCreatureCompetence( compName, fieldName, compValue )
|
async updateCreatureCompetence(compName, fieldName, compValue) {
|
||||||
{
|
|
||||||
let comp = this.getCompetence(compName);
|
let comp = this.getCompetence(compName);
|
||||||
console.log(comp);
|
console.log(comp);
|
||||||
if (comp) {
|
if (comp) {
|
||||||
@ -591,8 +577,7 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async updateCompetence( compName, compValue )
|
async updateCompetence(compName, compValue) {
|
||||||
{
|
|
||||||
let comp = this.getCompetence(compName);
|
let comp = this.getCompetence(compName);
|
||||||
if (comp) {
|
if (comp) {
|
||||||
let troncList = RdDUtility.isTronc(compName);
|
let troncList = RdDUtility.isTronc(compName);
|
||||||
@ -604,7 +589,8 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
ChatMessage.create({
|
ChatMessage.create({
|
||||||
whisper: ChatMessage.getWhisperRecipients(game.user.name),
|
whisper: ChatMessage.getWhisperRecipients(game.user.name),
|
||||||
content: message } );
|
content: message
|
||||||
|
});
|
||||||
}
|
}
|
||||||
const update = { _id: comp._id, 'data.niveau': maxNiveau };
|
const update = { _id: comp._id, 'data.niveau': maxNiveau };
|
||||||
const updated = await this.updateEmbeddedEntity("OwnedItem", update); // Updates one EmbeddedEntity
|
const updated = await this.updateEmbeddedEntity("OwnedItem", update); // Updates one EmbeddedEntity
|
||||||
@ -614,8 +600,7 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async updateCompetenceXP( compName, compValue )
|
async updateCompetenceXP(compName, compValue) {
|
||||||
{
|
|
||||||
let comp = this.getCompetence(compName);
|
let comp = this.getCompetence(compName);
|
||||||
if (comp) {
|
if (comp) {
|
||||||
const update = { _id: comp._id, 'data.xp': compValue };
|
const update = { _id: comp._id, 'data.xp': compValue };
|
||||||
@ -626,8 +611,7 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async updateCompetenceArchetype( compName, compValue )
|
async updateCompetenceArchetype(compName, compValue) {
|
||||||
{
|
|
||||||
let comp = this.getCompetence(compName);
|
let comp = this.getCompetence(compName);
|
||||||
if (comp) {
|
if (comp) {
|
||||||
const update = { _id: comp._id, 'data.niveau_archetype': compValue };
|
const update = { _id: comp._id, 'data.niveau_archetype': compValue };
|
||||||
@ -638,8 +622,7 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async updateCompteurValue( fieldName, fieldValue )
|
async updateCompteurValue(fieldName, fieldValue) {
|
||||||
{
|
|
||||||
//console.log("Update", fieldName, fieldValue);
|
//console.log("Update", fieldName, fieldValue);
|
||||||
let compteurs = duplicate(this.data.data.compteurs);
|
let compteurs = duplicate(this.data.data.compteurs);
|
||||||
compteurs[fieldName].value = fieldValue;
|
compteurs[fieldName].value = fieldValue;
|
||||||
@ -647,8 +630,7 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async updateProtectionValue( fieldName, fieldValue )
|
async updateProtectionValue(fieldName, fieldValue) {
|
||||||
{
|
|
||||||
let attributs = duplicate(this.data.data.attributs);
|
let attributs = duplicate(this.data.data.attributs);
|
||||||
attributs[fieldName].value = fieldValue;
|
attributs[fieldName].value = fieldValue;
|
||||||
await this.update({ "data.attributs": attributs });
|
await this.update({ "data.attributs": attributs });
|
||||||
@ -855,8 +837,7 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
computeEtatGeneral( )
|
computeEtatGeneral() {
|
||||||
{
|
|
||||||
let data = this.data.data;
|
let data = this.data.data;
|
||||||
// Pas d'état général pour les entités forçage à 0
|
// Pas d'état général pour les entités forçage à 0
|
||||||
if (this.data.type == 'entite') {
|
if (this.data.type == 'entite') {
|
||||||
@ -1031,10 +1012,7 @@ export class RdDActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getSonne() {
|
getSonne() {
|
||||||
if ( !this.isEntiteCauchemar() && this.data.data.sante.sonne ) {
|
return !this.isEntiteCauchemar() && (this.data.data.sante.sonne?.value ?? false);
|
||||||
return this.data.data.sante.sonne.value;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -1047,29 +1025,32 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
testSiSonne( sante, endurance )
|
testSiSonne(sante, endurance) {
|
||||||
{
|
const roll = new Roll("1d20").roll();
|
||||||
let result = new Roll("1d20").roll().total;
|
roll.showDice = true;
|
||||||
if ( result <= endurance)
|
RdDDice.show(roll);
|
||||||
sante.sonne.value = false;
|
let result = {
|
||||||
if ( result > endurance || result == 20) // 20 is always a failure
|
roll: roll,
|
||||||
sante.sonne.value = true;
|
sonne: roll.total > endurance || roll.total == 20
|
||||||
if (result == 1) {
|
}
|
||||||
sante.sonne.value = false;
|
if (roll.total == 1) {
|
||||||
let xp = Misc.toInt(this.data.data.carac.constitution.xp) + 1;
|
let xp = Misc.toInt(this.data.data.carac.constitution.xp) + 1;
|
||||||
this.update({ "data.carac.constitution.xp": xp }); // +1 XP !
|
this.update({ "data.carac.constitution.xp": xp }); // +1 XP !
|
||||||
// TODO : Output to chat
|
// TODO : Output to chat
|
||||||
}
|
}
|
||||||
|
if (result.sonne) {
|
||||||
|
// 20 is always a failure
|
||||||
|
sante.sonne.value = true;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
countBlessures( blessuresListe )
|
countBlessures(blessuresListe) {
|
||||||
{
|
|
||||||
return blessuresListe.filter(b => b.active).length
|
return blessuresListe.filter(b => b.active).length
|
||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
countBlessuresByName( name )
|
countBlessuresByName(name) {
|
||||||
{
|
|
||||||
return this.countBlessures(this.data.data.blessures[name].liste);
|
return this.countBlessures(this.data.data.blessures[name].liste);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1101,45 +1082,54 @@ export class RdDActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async santeIncDec(name, inc, isCritique = false) {
|
async santeIncDec(name, inc, isCritique = false) {
|
||||||
|
|
||||||
const sante = duplicate(this.data.data.sante);
|
const sante = duplicate(this.data.data.sante);
|
||||||
let data = sante[name];
|
let data = sante[name];
|
||||||
if (data==undefined) {
|
if (!data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
let result = {
|
||||||
|
sonne: false,
|
||||||
|
};
|
||||||
|
|
||||||
let minValue = 0;
|
let minValue = 0;
|
||||||
if (this.type == 'personnage') {
|
if (this.type == 'personnage') {
|
||||||
// TODO: les animaux/humanoïdes on théoriquement aussi un sconst, mais la SPA n'est pas passé par là
|
// TODO: les animaux/humanoïdes on théoriquement aussi un sconst, mais la SPA n'est pas passé par là
|
||||||
minValue = name == "vie" ? -Number(this.data.data.attributs.sconst.value) : 0;
|
minValue = name == "vie" ? -Number(this.data.data.attributs.sconst.value) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
let newValue = Math.max(minValue, Math.min(data.value + inc, data.max));
|
result.newValue = Math.max(minValue, Math.min(data.value + inc, data.max));
|
||||||
//console.log("New value ", inc, minValue, newValue);
|
//console.log("New value ", inc, minValue, result.newValue);
|
||||||
|
|
||||||
if (name == "endurance" && this.data.type != 'entite') {
|
if (name == "endurance" && this.data.type != 'entite') {
|
||||||
if (sante.fatigue && inc < 0) { // Each endurance lost -> fatigue lost
|
if (sante.fatigue && inc < 0) { // Each endurance lost -> fatigue lost
|
||||||
sante.fatigue.value = sante.fatigue.value - inc
|
sante.fatigue.value = sante.fatigue.value - inc
|
||||||
}
|
}
|
||||||
if ( !isCritique && newValue == 0 && inc < 0) { // perte endurance et endurance devient 0 -> -1 vie sauf si coup critique
|
if (!isCritique && result.newValue == 0 && inc < 0) { // perte endurance et endurance devient 0 -> -1 vie sauf si coup critique
|
||||||
sante.vie.value = sante.vie.value - 1;
|
sante.vie.value = sante.vie.value - 1;
|
||||||
}
|
}
|
||||||
newValue = Math.max(0, newValue);
|
result.newValue = Math.max(0, result.newValue);
|
||||||
if (inc > 0) { // le max d'endurance s'applique seulement à la récupération
|
if (inc > 0) { // le max d'endurance s'applique seulement à la récupération
|
||||||
newValue = Math.min(newValue, this._computeEnduranceMax())
|
result.newValue = Math.min(result.newValue, this._computeEnduranceMax())
|
||||||
}
|
}
|
||||||
if (data.value - newValue > 1) {
|
if (data.value - result.newValue > 1) {
|
||||||
this.testSiSonne(sante, newValue); // Peut-être sonné si 2 points d'endurance perdus d'un coup
|
// Peut-être sonné si 2 points d'endurance perdus d'un coup
|
||||||
} else if (inc>0) {
|
const testIsSonne = this.testSiSonne(sante, result.newValue);
|
||||||
|
result.sonne = testIsSonne.sonne;
|
||||||
|
result.jetEndurance = testIsSonne.roll.total;
|
||||||
|
} else if (inc > 0 && !this.isEntiteCauchemar()) {
|
||||||
sante.sonne.value = false;
|
sante.sonne.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data.value = newValue;
|
data.value = result.newValue;
|
||||||
//console.log(name, inc, data.value, newValue, minValue, data.max);
|
//console.log(name, inc, data.value, result.newValue, minValue, data.max);
|
||||||
if (sante.fatigue) { // If endurance lost, then the same amount of fatigue cannot be recovered
|
if (sante.fatigue) { // If endurance lost, then the same amount of fatigue cannot be recovered
|
||||||
sante.fatigue.value = Math.max(sante.fatigue.value, this._computeFatigueMin());
|
sante.fatigue.value = Math.max(sante.fatigue.value, this._computeFatigueMin());
|
||||||
}
|
}
|
||||||
//console.log("SANTE::::", sante);
|
//console.log("SANTE::::", sante);
|
||||||
|
|
||||||
await this.update({ "data.sante": sante });
|
await this.update({ "data.sante": sante });
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -1411,8 +1401,9 @@ export class RdDActor extends Actor {
|
|||||||
value: carac.value,
|
value: carac.value,
|
||||||
xp: carac.xp
|
xp: carac.xp
|
||||||
}
|
}
|
||||||
let content = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-carac-xp.html`, xpData);
|
ChatUtility.createChatMessage(this.name, "default", {
|
||||||
ChatUtility.createChatMessage({ content: content }, "default", this.name);
|
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-carac-xp.html`, xpData)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1436,8 +1427,9 @@ export class RdDActor extends Actor {
|
|||||||
archetype: competence.data.niveau_archetype,
|
archetype: competence.data.niveau_archetype,
|
||||||
archetypeWarning: competence.data.niveau > competence.data.niveau_archetype
|
archetypeWarning: competence.data.niveau > competence.data.niveau_archetype
|
||||||
}
|
}
|
||||||
let content = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-competence-xp.html`, xpData);
|
ChatUtility.createChatMessage(this.name, "default", {
|
||||||
ChatUtility.createChatMessage({ content: content }, "default", this.name);
|
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-competence-xp.html`, xpData)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1464,8 +1456,7 @@ export class RdDActor extends Actor {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async rollUnSort(coord) {
|
async rollUnSort(coord) {
|
||||||
let sortList = duplicate(this.getSortList()); // Duplication car les pts de reve sont modifiés dans le sort
|
let sortList = duplicate(this.getSortList()); // Duplication car les pts de reve sont modifiés dans le sort
|
||||||
if (!sortList || sortList.length == 0)
|
if (!sortList || sortList.length == 0) {
|
||||||
{
|
|
||||||
ui.notifications.info("Aucun sort disponible!");
|
ui.notifications.info("Aucun sort disponible!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1484,7 +1475,8 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const dialog = await RdDRoll.create(this, rollData,
|
const dialog = await RdDRoll.create(this, rollData,
|
||||||
{ html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-sort.html',
|
{
|
||||||
|
html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-sort.html',
|
||||||
close: html => { this.currentTMR.maximize() } // Re-display TMR
|
close: html => { this.currentTMR.maximize() } // Re-display TMR
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1521,7 +1513,8 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
ChatMessage.create({
|
ChatMessage.create({
|
||||||
content: "Vous êtes sous le coup d'une Mauvaise Rencontre en Persective." + addMsg,
|
content: "Vous êtes sous le coup d'une Mauvaise Rencontre en Persective." + addMsg,
|
||||||
whisper: ChatMessage.getWhisperRecipients(game.user.name) } );
|
whisper: ChatMessage.getWhisperRecipients(game.user.name)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return rencSpecial;
|
return rencSpecial;
|
||||||
}
|
}
|
||||||
@ -1532,7 +1525,8 @@ export class RdDActor extends Actor {
|
|||||||
if (inertieDraconique) {
|
if (inertieDraconique) {
|
||||||
ChatMessage.create({
|
ChatMessage.create({
|
||||||
content: "Vous êtes sous le coup d'une Inertie Draconique : vous perdez 2 cases de Fatigue par déplacement au lieu d'1.",
|
content: "Vous êtes sous le coup d'une Inertie Draconique : vous perdez 2 cases de Fatigue par déplacement au lieu d'1.",
|
||||||
whisper: ChatMessage.getWhisperRecipients(game.user.name) } );
|
whisper: ChatMessage.getWhisperRecipients(game.user.name)
|
||||||
|
});
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
@ -1555,7 +1549,8 @@ export class RdDActor extends Actor {
|
|||||||
if (resistFleuve) {
|
if (resistFleuve) {
|
||||||
ChatMessage.create({
|
ChatMessage.create({
|
||||||
content: "Vous êtes sous le coup d'une Double Résistance du Fleuve : vous devez maîtriser 2 fois chaque case humide, un second jet est donc effectué.",
|
content: "Vous êtes sous le coup d'une Double Résistance du Fleuve : vous devez maîtriser 2 fois chaque case humide, un second jet est donc effectué.",
|
||||||
whisper: ChatMessage.getWhisperRecipients(game.user.name) } );
|
whisper: ChatMessage.getWhisperRecipients(game.user.name)
|
||||||
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -1568,7 +1563,8 @@ export class RdDActor extends Actor {
|
|||||||
await this.reveActuelIncDec(-1);
|
await this.reveActuelIncDec(-1);
|
||||||
ChatMessage.create({
|
ChatMessage.create({
|
||||||
content: "Vous êtes sous le coup d'un Péage : l'entrée sur cette case vous coûte 1 Point de Rêve (déduit automatiquement).",
|
content: "Vous êtes sous le coup d'un Péage : l'entrée sur cette case vous coûte 1 Point de Rêve (déduit automatiquement).",
|
||||||
whisper: ChatMessage.getWhisperRecipients(game.user.name) } );
|
whisper: ChatMessage.getWhisperRecipients(game.user.name)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1587,7 +1583,8 @@ export class RdDActor extends Actor {
|
|||||||
if (pontHumide && cellDescr.type == 'pont') {
|
if (pontHumide && cellDescr.type == 'pont') {
|
||||||
ChatMessage.create({
|
ChatMessage.create({
|
||||||
content: "Vous êtes sous le coup d'une Impraticabilité des Ponts : ils doivent être maîtrisés comme des cases humides.",
|
content: "Vous êtes sous le coup d'une Impraticabilité des Ponts : ils doivent être maîtrisés comme des cases humides.",
|
||||||
whisper: ChatMessage.getWhisperRecipients(game.user.name) } );
|
whisper: ChatMessage.getWhisperRecipients(game.user.name)
|
||||||
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Débordement ?
|
// Débordement ?
|
||||||
@ -1714,7 +1711,8 @@ export class RdDActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async creerTacheDepuisLivre(item) {
|
async creerTacheDepuisLivre(item) {
|
||||||
let tache = { name: "Lire " + item.name, type: 'tache',
|
let tache = {
|
||||||
|
name: "Lire " + item.name, type: 'tache',
|
||||||
data: {
|
data: {
|
||||||
carac: 'intellect',
|
carac: 'intellect',
|
||||||
competence: 'Ecriture',
|
competence: 'Ecriture',
|
||||||
@ -1836,8 +1834,7 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async rollAppelChance(onSuccess = () => {}, onEchec = () => {})
|
async rollAppelChance(onSuccess = () => { }, onEchec = () => { }) {
|
||||||
{
|
|
||||||
let rollData = { selectedCarac: this.getCaracByName('chance-actuelle'), surprise: '' };
|
let rollData = { selectedCarac: this.getCaracByName('chance-actuelle'), surprise: '' };
|
||||||
const dialog = await RdDRoll.create(this, rollData,
|
const dialog = await RdDRoll.create(this, rollData,
|
||||||
{ html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html' },
|
{ html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html' },
|
||||||
@ -1907,8 +1904,10 @@ export class RdDActor extends Actor {
|
|||||||
if (rolled.isPart && rolled.finalLevel < 0) {
|
if (rolled.isPart && rolled.finalLevel < 0) {
|
||||||
// Cas de désir lancinant, pas d'expérience sur particulière
|
// Cas de désir lancinant, pas d'expérience sur particulière
|
||||||
if (this.checkDesirLancinant()) {
|
if (this.checkDesirLancinant()) {
|
||||||
ChatMessage.create( { content: `Vous souffrez au moins d'un Désir Lancinant, vous ne pouvez pas gagner d'expérience sur une Particulière tant que le désir n'est pas assouvi`,
|
ChatMessage.create({
|
||||||
whisper: ChatMessage.getWhisperRecipients(game.user.name) } );
|
content: `Vous souffrez au moins d'un Désir Lancinant, vous ne pouvez pas gagner d'expérience sur une Particulière tant que le désir n'est pas assouvi`,
|
||||||
|
whisper: ChatMessage.getWhisperRecipients(game.user.name)
|
||||||
|
});
|
||||||
return { result: false, xpcarac: 0, xpCompetence: 0 };
|
return { result: false, xpcarac: 0, xpCompetence: 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1931,8 +1930,10 @@ export class RdDActor extends Actor {
|
|||||||
selectedCarac.xp = Misc.toInt(selectedCarac.xp) + xpCarac;
|
selectedCarac.xp = Misc.toInt(selectedCarac.xp) + xpCarac;
|
||||||
await this.update({ "data.carac": carac });
|
await this.update({ "data.carac": carac });
|
||||||
} else {
|
} else {
|
||||||
ChatMessage.create( { content: `Vous avez ${xpCarac} à répartir pour la caractérisque dérivée ${caracName}. Vous devez le faire manuellement.`,
|
ChatMessage.create({
|
||||||
whisper: ChatMessage.getWhisperRecipients(game.user.name) } );
|
content: `Vous avez ${xpCarac} à répartir pour la caractérisque dérivée ${caracName}. Vous devez le faire manuellement.`,
|
||||||
|
whisper: ChatMessage.getWhisperRecipients(game.user.name)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return { result: true, xpCarac: xpCarac, xpCompetence: xpComp }; //XP
|
return { result: true, xpCarac: xpCarac, xpCompetence: xpComp }; //XP
|
||||||
@ -1948,8 +1949,10 @@ export class RdDActor extends Actor {
|
|||||||
this._appliquerAjoutExperience(data);
|
this._appliquerAjoutExperience(data);
|
||||||
|
|
||||||
// Ajout du nombre astral
|
// Ajout du nombre astral
|
||||||
const item = {name: "Nombre Astral", type: "nombreastral", data:
|
const item = {
|
||||||
{ value: data.nbAstral, istrue: data.isvalid, jourindex: Number(data.date), jourlabel: game.system.rdd.calendrier.getDateFromIndex( Number(data.date) ) } };
|
name: "Nombre Astral", type: "nombreastral", data:
|
||||||
|
{ value: data.nbAstral, istrue: data.isvalid, jourindex: Number(data.date), jourlabel: game.system.rdd.calendrier.getDateFromIndex(Number(data.date)) }
|
||||||
|
};
|
||||||
await this.createEmbeddedEntity("OwnedItem", item);
|
await this.createEmbeddedEntity("OwnedItem", item);
|
||||||
|
|
||||||
// Suppression des anciens nombres astraux
|
// Suppression des anciens nombres astraux
|
||||||
@ -1970,8 +1973,7 @@ export class RdDActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getCaracByName(caracName) {
|
getCaracByName(caracName) {
|
||||||
switch (caracName)
|
switch (caracName) {
|
||||||
{
|
|
||||||
case 'reve-actuel': case 'Rêve actuel':
|
case 'reve-actuel': case 'Rêve actuel':
|
||||||
return {
|
return {
|
||||||
label: 'Rêve actuel',
|
label: 'Rêve actuel',
|
||||||
@ -1990,8 +1992,7 @@ export class RdDActor extends Actor {
|
|||||||
|
|
||||||
static _findCaracByName(carac, name) {
|
static _findCaracByName(carac, name) {
|
||||||
name = name.toLowerCase();
|
name = name.toLowerCase();
|
||||||
switch (name)
|
switch (name) {
|
||||||
{
|
|
||||||
case 'reve-actuel': case 'rêve actuel':
|
case 'reve-actuel': case 'rêve actuel':
|
||||||
return carac.reve;
|
return carac.reve;
|
||||||
case 'chance-actuelle': case 'chance actuelle':
|
case 'chance-actuelle': case 'chance actuelle':
|
||||||
@ -2021,23 +2022,23 @@ export class RdDActor extends Actor {
|
|||||||
if (monteLaborieuse) {
|
if (monteLaborieuse) {
|
||||||
ChatMessage.create({
|
ChatMessage.create({
|
||||||
content: "Vous êtes sous le coup d'une Montée Laborieuse : vos montées en TMR coûtent 1 Point de Rêve de plus.",
|
content: "Vous êtes sous le coup d'une Montée Laborieuse : vos montées en TMR coûtent 1 Point de Rêve de plus.",
|
||||||
whisper: ChatMessage.getWhisperRecipients(game.user.name) } );
|
whisper: ChatMessage.getWhisperRecipients(game.user.name)
|
||||||
|
});
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async displayTMR(mode="normal")
|
async displayTMR(mode = "normal") {
|
||||||
{
|
|
||||||
let isRapide = mode == "rapide";
|
let isRapide = mode == "rapide";
|
||||||
if (mode != "visu")
|
if (mode != "visu") {
|
||||||
{
|
|
||||||
let minReveValue = (isRapide) ? 3 : 2;
|
let minReveValue = (isRapide) ? 3 : 2;
|
||||||
if (this.getReveActuel() < minReveValue) {
|
if (this.getReveActuel() < minReveValue) {
|
||||||
ChatMessage.create({
|
ChatMessage.create({
|
||||||
content: "Vous n'avez plus assez de Points de Reve pour monter dans les Terres Médianes",
|
content: "Vous n'avez plus assez de Points de Reve pour monter dans les Terres Médianes",
|
||||||
whisper: ChatMessage.getWhisperRecipients(game.user.name) } );
|
whisper: ChatMessage.getWhisperRecipients(game.user.name)
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2108,7 +2109,6 @@ export class RdDActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
computeArmure(attackerRoll) {
|
computeArmure(attackerRoll) {
|
||||||
let locData = attackerRoll.loc;
|
|
||||||
let dmg = attackerRoll.dmg.dmgArme + attackerRoll.dmg.dmgActor;
|
let dmg = attackerRoll.dmg.dmgArme + attackerRoll.dmg.dmgActor;
|
||||||
let arme = attackerRoll.arme;
|
let arme = attackerRoll.arme;
|
||||||
// TODO: arc ignore armure
|
// TODO: arc ignore armure
|
||||||
@ -2126,8 +2126,7 @@ export class RdDActor extends Actor {
|
|||||||
update.data.protection = "1d" + update.data.protection;
|
update.data.protection = "1d" + update.data.protection;
|
||||||
// if ( update.data.protection.toString().length == 1 )
|
// if ( update.data.protection.toString().length == 1 )
|
||||||
// update.data.protection = "1d"+update.data.protection;
|
// update.data.protection = "1d"+update.data.protection;
|
||||||
else if (res = /(\d+d\d+)(\-\d+)?/.exec( update.data.protection ))
|
else if (res = /(\d+d\d+)(\-\d+)?/.exec(update.data.protection)) {
|
||||||
{
|
|
||||||
let malus = Misc.toInt(res[2]) - 1;
|
let malus = Misc.toInt(res[2]) - 1;
|
||||||
update.data.protection = res[1] + malus;
|
update.data.protection = res[1] + malus;
|
||||||
}
|
}
|
||||||
@ -2139,6 +2138,7 @@ export class RdDActor extends Actor {
|
|||||||
this.updateEmbeddedEntity("OwnedItem", update);
|
this.updateEmbeddedEntity("OwnedItem", update);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// TODO: max armure (chutes)
|
||||||
const penetration = arme ? Misc.toInt(arme.data.penetration) : 0;
|
const penetration = arme ? Misc.toInt(arme.data.penetration) : 0;
|
||||||
protection = Math.max(protection - penetration, 0);
|
protection = Math.max(protection - penetration, 0);
|
||||||
protection += this.getProtectionNaturelle();
|
protection += this.getProtectionNaturelle();
|
||||||
@ -2153,13 +2153,6 @@ export class RdDActor extends Actor {
|
|||||||
new RdDEncaisser(html, this).render(true);
|
new RdDEncaisser(html, this).render(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
|
||||||
async encaisser( ) {
|
|
||||||
let data = { ajustementsEncaissement: RdDUtility.getAjustementsEncaissement() };
|
|
||||||
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-encaisser.html', data );
|
|
||||||
new RdDEncaisser(html, this).render(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async encaisserDommages(attackerRoll, attacker = undefined) {
|
async encaisserDommages(attackerRoll, attacker = undefined) {
|
||||||
if (attacker && !await attacker.accorder(this, 'avant-encaissement')) {
|
if (attacker && !await attacker.accorder(this, 'avant-encaissement')) {
|
||||||
@ -2168,62 +2161,67 @@ export class RdDActor extends Actor {
|
|||||||
|
|
||||||
console.log("encaisserDommages", attackerRoll)
|
console.log("encaisserDommages", attackerRoll)
|
||||||
|
|
||||||
|
let santeOrig = duplicate(this.data.data.sante);
|
||||||
let encaissement = this.jetEncaissement(attackerRoll);
|
let encaissement = this.jetEncaissement(attackerRoll);
|
||||||
|
|
||||||
this.ajouterBlessure(encaissement); // Will upate the result table
|
this.ajouterBlessure(encaissement); // Will upate the result table
|
||||||
|
const perteVie = await this.santeIncDec("vie", - encaissement.vie);
|
||||||
await this.santeIncDec("vie", encaissement.vie);
|
const perteEndurance = await this.santeIncDec("endurance", -encaissement.endurance, (encaissement.critiques > 0));
|
||||||
await this.santeIncDec("endurance", encaissement.endurance, (encaissement.critiques > 0));
|
|
||||||
|
|
||||||
const blessureLegere = (encaissement.legeres > 0 ? "une blessure légère" : "");
|
|
||||||
const blessureGrave = (encaissement.graves > 0 ? "une blessure grave" : "");
|
|
||||||
const blessureCritique = (encaissement.critiques > 0 ? "une blessure critique" : "");
|
|
||||||
|
|
||||||
let commonMsg = {
|
|
||||||
title: "Blessures !",
|
|
||||||
roll: encaissement.roll,
|
|
||||||
content: `${this.data.name} a encaissé ${blessureLegere}${blessureGrave}${blessureCritique} (${encaissement.locName})`
|
|
||||||
}
|
|
||||||
let addonMsg = "<br>Et a perdu : <br>" + encaissement.endurance + " Endurance et " + encaissement.vie + " Points de Vie";
|
|
||||||
if ( this.hasPlayerOwner ) {
|
|
||||||
commonMsg.content += addonMsg; // Message pour tout le monde
|
|
||||||
ChatMessage.create( commonMsg );
|
|
||||||
} else { // Le defenseur n'est pas un PJ, donc message complet uniquement pour le MJ
|
|
||||||
ChatMessage.create( commonMsg ); // Message pour tout le monde
|
|
||||||
let gmMsg = duplicate(commonMsg);
|
|
||||||
gmMsg.content = addonMsg; // Et message complémentaire uniquement pour le MJ
|
|
||||||
gmMsg.whisper = ChatMessage.getWhisperRecipients( "GM" );
|
|
||||||
ChatMessage.create( gmMsg );
|
|
||||||
}
|
|
||||||
|
|
||||||
this.computeEtatGeneral();
|
this.computeEtatGeneral();
|
||||||
this.sheet.render(false);
|
this.sheet.render(false);
|
||||||
|
|
||||||
|
let santeActuelle = duplicate(this.data.data.sante);
|
||||||
|
|
||||||
|
encaissement.alias = this.data.name;
|
||||||
|
encaissement.hasPlayerOwner = this.hasPlayerOwner;
|
||||||
|
encaissement.resteEndurance = santeActuelle.endurance.value
|
||||||
|
encaissement.sonne = perteEndurance.sonne;
|
||||||
|
encaissement.jetEndurance = perteEndurance.jetEndurance,
|
||||||
|
encaissement.endurance = santeOrig.endurance.value - perteEndurance.newValue;
|
||||||
|
encaissement.vie = santeOrig.vie.value - perteVie.newValue;
|
||||||
|
|
||||||
|
ChatUtility.createChatWithRollMode(this.name, {
|
||||||
|
roll: encaissement.roll,
|
||||||
|
content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-resultat-encaissement.html', encaissement)
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!encaissement.hasPlayerOwner && encaissement.endurance != 0) {
|
||||||
|
encaissement = duplicate(encaissement);
|
||||||
|
encaissement.isGM = true;
|
||||||
|
ChatMessage.create({
|
||||||
|
whisper: ChatMessage.getWhisperRecipients("GM"),
|
||||||
|
content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-resultat-encaissement.html', encaissement)
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
jetEncaissement(rollData) {
|
jetEncaissement(rollData) {
|
||||||
|
const roll = new Roll("2d10").roll();
|
||||||
rollData.dmg.loc = rollData.dmg.loc?? RdDUtility.getLocalisation();
|
roll.showDice = true;
|
||||||
|
|
||||||
const roll = new Roll("2d10 + @dmg - @armure", {
|
|
||||||
dmg: rollData.dmg.total,
|
|
||||||
armure: this.computeArmure( rollData )
|
|
||||||
}).roll();
|
|
||||||
RdDDice.show(roll, game.settings.get("core", "rollMode"));
|
RdDDice.show(roll, game.settings.get("core", "rollMode"));
|
||||||
|
|
||||||
let encaissement = RdDUtility.selectEncaissement(roll.total, rollData.dmg.mortalite)
|
const armure = this.computeArmure(rollData);
|
||||||
let over20 = Math.max(roll.total - 20, 0);
|
const jetTotal = roll.total + rollData.dmg.total - armure;
|
||||||
|
|
||||||
|
let encaissement = RdDUtility.selectEncaissement(jetTotal, rollData.dmg.mortalite)
|
||||||
|
let over20 = Math.max(jetTotal - 20, 0);
|
||||||
|
encaissement.dmg = rollData.dmg;
|
||||||
|
encaissement.dmg.loc = rollData.dmg.loc ?? RdDUtility.getLocalisation();
|
||||||
|
encaissement.dmg.loc.label = encaissement.dmg.loc.label ?? 'Corps;'
|
||||||
encaissement.roll = roll;
|
encaissement.roll = roll;
|
||||||
encaissement.vie = - RdDUtility._evaluatePerte(encaissement.vie, over20);
|
encaissement.armure = armure;
|
||||||
encaissement.endurance = - RdDUtility._evaluatePerte(encaissement.endurance, over20);
|
encaissement.total = jetTotal;
|
||||||
encaissement.loc = rollData.dmg.loc;
|
encaissement.vie = RdDUtility._evaluatePerte(encaissement.vie, over20);
|
||||||
encaissement.locName = rollData.dmg.loc.label ?? "Corps";
|
encaissement.endurance = RdDUtility._evaluatePerte(encaissement.endurance, over20);
|
||||||
|
encaissement.penetration = rollData.arme?.data.penetration ?? 0;
|
||||||
|
|
||||||
return encaissement;
|
return encaissement;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
ajouterBlessure( encaissement )
|
ajouterBlessure(encaissement) {
|
||||||
{
|
|
||||||
// Fast exit
|
// Fast exit
|
||||||
if (this.data.type == 'entite') return; // Une entité n'a pas de blessures
|
if (this.data.type == 'entite') return; // Une entité n'a pas de blessures
|
||||||
if (encaissement.legeres + encaissement.graves + encaissement.critiques == 0) return;
|
if (encaissement.legeres + encaissement.graves + encaissement.critiques == 0) return;
|
||||||
@ -2296,18 +2294,15 @@ export class RdDActor extends Actor {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
/* -- entites -- */
|
/* -- entites -- */
|
||||||
/* retourne true si on peut continuer, false si on ne peut pas continuer */
|
/* retourne true si on peut continuer, false si on ne peut pas continuer */
|
||||||
async targetEntiteNonAccordee(target, when='avant-encaissement')
|
async targetEntiteNonAccordee(target, when = 'avant-encaissement') {
|
||||||
{
|
if (target) {
|
||||||
if (target)
|
|
||||||
{
|
|
||||||
return !await this.accorder(target.actor, when);
|
return !await this.accorder(target.actor, when);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async accorder(entite, when = 'avant-encaissement')
|
async accorder(entite, when = 'avant-encaissement') {
|
||||||
{
|
|
||||||
if (when != game.settings.get("foundryvtt-reve-de-dragon", "accorder-entite-cauchemar")
|
if (when != game.settings.get("foundryvtt-reve-de-dragon", "accorder-entite-cauchemar")
|
||||||
|| !entite.isEntiteCauchemar()
|
|| !entite.isEntiteCauchemar()
|
||||||
|| entite.isEntiteCauchemarAccordee(this)) {
|
|| entite.isEntiteCauchemarAccordee(this)) {
|
||||||
@ -2334,22 +2329,19 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
isEntiteCauchemar()
|
isEntiteCauchemar() {
|
||||||
{
|
|
||||||
return this.data.type == 'entite';
|
return this.data.type == 'entite';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
isEntiteCauchemarAccordee(attaquant)
|
isEntiteCauchemarAccordee(attaquant) {
|
||||||
{
|
|
||||||
if (!this.isEntiteCauchemar()) { return true; }
|
if (!this.isEntiteCauchemar()) { return true; }
|
||||||
let resonnance = this.data.data.sante.resonnance;
|
let resonnance = this.data.data.sante.resonnance;
|
||||||
return (resonnance.actors.find(it => it == attaquant._id));
|
return (resonnance.actors.find(it => it == attaquant._id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async setEntiteReveAccordee(attaquant)
|
async setEntiteReveAccordee(attaquant) {
|
||||||
{
|
|
||||||
if (!this.isEntiteCauchemar()) {
|
if (!this.isEntiteCauchemar()) {
|
||||||
ui.notifications.error("Impossible de s'accorder à " + this.name + ": ce n'est pas une entite de cauchemer/rêve");
|
ui.notifications.error("Impossible de s'accorder à " + this.name + ": ce n'est pas une entite de cauchemer/rêve");
|
||||||
return;
|
return;
|
||||||
@ -2463,7 +2455,8 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const dialog = await RdDRoll.create(this, rollData,
|
const dialog = await RdDRoll.create(this, rollData,
|
||||||
{ html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-alchimie.html',
|
{
|
||||||
|
html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-alchimie.html',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'tache-alchimique',
|
name: 'tache-alchimique',
|
||||||
|
@ -3,21 +3,20 @@
|
|||||||
* Class providing helper methods to get the list of users, and
|
* Class providing helper methods to get the list of users, and
|
||||||
*/
|
*/
|
||||||
export class ChatUtility {
|
export class ChatUtility {
|
||||||
|
/* -------------------------------------------- */
|
||||||
static removeMyChatMessageContaining(part) {
|
static removeMyChatMessageContaining(part) {
|
||||||
const toDelete = game.messages.filter(it => it.user._id == game.user._id)
|
const toDelete = game.messages.filter(it => it.user._id == game.user._id)
|
||||||
.filter(it => it.data.content.includes(part));
|
.filter(it => it.data.content.includes(part));
|
||||||
toDelete.forEach(it => it.delete());
|
toDelete.forEach(it => it.delete());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static chatWithRollMode(chatOptions, name) {
|
static createChatWithRollMode(name, chatOptions) {
|
||||||
let rollMode = game.settings.get("core", "rollMode");
|
ChatUtility.createChatMessage(name, game.settings.get("core", "rollMode"), chatOptions);
|
||||||
ChatUtility.createChatMessage(chatOptions, rollMode, name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static createChatMessage(chatOptions, rollMode, name) {
|
static createChatMessage(name, rollMode, chatOptions) {
|
||||||
switch (rollMode) {
|
switch (rollMode) {
|
||||||
case "blindroll": // GM only
|
case "blindroll": // GM only
|
||||||
if (!game.user.isGM) {
|
if (!game.user.isGM) {
|
||||||
|
@ -136,7 +136,6 @@ export class RdDCombat {
|
|||||||
}
|
}
|
||||||
const defenderTokenId = event.currentTarget.attributes['data-defenderTokenId'].value;
|
const defenderTokenId = event.currentTarget.attributes['data-defenderTokenId'].value;
|
||||||
|
|
||||||
let defenderRoll = this._getDefense(attackerRoll.passeArme);
|
|
||||||
const armeParadeId = event.currentTarget.attributes['data-armeid']?.value;
|
const armeParadeId = event.currentTarget.attributes['data-armeid']?.value;
|
||||||
|
|
||||||
switch (button) {
|
switch (button) {
|
||||||
@ -150,13 +149,13 @@ export class RdDCombat {
|
|||||||
() => this.attaqueChanceuse(attackerRoll),
|
() => this.attaqueChanceuse(attackerRoll),
|
||||||
() => this._onEchecTotal(attackerRoll));
|
() => this._onEchecTotal(attackerRoll));
|
||||||
case '#appel-chance-defense': return this.defender.rollAppelChance(
|
case '#appel-chance-defense': return this.defender.rollAppelChance(
|
||||||
() => this.defenseChanceuse(attackerRoll, defenderRoll),
|
() => this.defenseChanceuse(attackerRoll),
|
||||||
() => this.afficherOptionsDefense(attackerRoll, { defenseChance: true }));
|
() => this.afficherOptionsDefense(attackerRoll, { defenseChance: true }));
|
||||||
case '#appel-destinee-attaque': return this.attacker.appelDestinee(
|
case '#appel-destinee-attaque': return this.attacker.appelDestinee(
|
||||||
() => this.attaqueSignificative(attackerRoll),
|
() => this.attaqueSignificative(attackerRoll),
|
||||||
() => { });
|
() => { });
|
||||||
case '#appel-destinee-defense': return this.defender.appelDestinee(
|
case '#appel-destinee-defense': return this.defender.appelDestinee(
|
||||||
() => this.defenseDestinee(defenderRoll),
|
() => this.defenseDestinee(attackerRoll),
|
||||||
() => { });
|
() => { });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -194,7 +193,7 @@ export class RdDCombat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
defenseChanceuse(attackerRoll, defenderRoll) {
|
defenseChanceuse(attackerRoll) {
|
||||||
ui.notifications.info("La défense est rejouée grâce à la chance")
|
ui.notifications.info("La défense est rejouée grâce à la chance")
|
||||||
attackerRoll.essais.defenseChance = true;
|
attackerRoll.essais.defenseChance = true;
|
||||||
attackerRoll.essais.defense = false;
|
attackerRoll.essais.defense = false;
|
||||||
@ -203,7 +202,9 @@ export class RdDCombat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
defenseDestinee(defenderRoll) {
|
defenseDestinee(attackerRoll) {
|
||||||
|
let defenderRoll = this._getDefense(attackerRoll.passeArme);
|
||||||
|
if (defenderRoll) {
|
||||||
ui.notifications.info('Défense significative grâce à la destinée')
|
ui.notifications.info('Défense significative grâce à la destinée')
|
||||||
RdDResolutionTable.forceSignificative(defenderRoll.rolled);
|
RdDResolutionTable.forceSignificative(defenderRoll.rolled);
|
||||||
this.removeChatMessageActionsPasseArme(defenderRoll.passeArme);
|
this.removeChatMessageActionsPasseArme(defenderRoll.passeArme);
|
||||||
@ -214,6 +215,10 @@ export class RdDCombat {
|
|||||||
this._onEsquiveNormale(defenderRoll);
|
this._onEsquiveNormale(defenderRoll);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
ui.notifications.warn("Appel à la destinée impossible, la passe d'armes est déjà terminée!")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
afficherOptionsDefense(attackerRoll, essais) {
|
afficherOptionsDefense(attackerRoll, essais) {
|
||||||
@ -417,9 +422,9 @@ export class RdDCombat {
|
|||||||
const arme = rollData.arme;
|
const arme = rollData.arme;
|
||||||
const avecArme = arme?.data.categorie_parade != 'sans-armes';
|
const avecArme = arme?.data.categorie_parade != 'sans-armes';
|
||||||
const action = (rollData.attackerRoll ? (arme ? "la parade" : "l'esquive") : "l'attaque");
|
const action = (rollData.attackerRoll ? (arme ? "la parade" : "l'esquive") : "l'attaque");
|
||||||
ChatUtility.chatWithRollMode({
|
ChatUtility.createChatWithRollMode(this.defender.name, {
|
||||||
content: `<strong>Echec total à ${action}!</strong> ` + await RdDRollTables.getMaladresse({ arme: avecArme })
|
content: `<strong>Echec total à ${action}!</strong> ` + await RdDRollTables.getMaladresse({ arme: avecArme })
|
||||||
}, this.defender.name)
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -489,45 +494,45 @@ export class RdDCombat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
_getDiviseurSignificative(rollData) {
|
_getDiviseurSignificative(defenderRoll) {
|
||||||
let facteurSign = (this.defender.isDemiSurprise() || rollData.needParadeSignificative) ? 2 : 1;
|
let facteurSign = (this.defender.isDemiSurprise() || defenderRoll.needParadeSignificative) ? 2 : 1;
|
||||||
if (RdDBonus.isDefenseAttaqueFinesse(rollData)) {
|
if (RdDBonus.isDefenseAttaqueFinesse(defenderRoll)) {
|
||||||
facteurSign *= 2;
|
facteurSign *= 2;
|
||||||
}
|
}
|
||||||
return facteurSign;
|
return facteurSign;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
_onParadeParticuliere(rollData) {
|
_onParadeParticuliere(defenderRoll) {
|
||||||
console.log("RdDCombat._onParadeParticuliere >>>", rollData);
|
console.log("RdDCombat._onParadeParticuliere >>>", defenderRoll);
|
||||||
if (!rollData.attackerRoll.isPart) {
|
if (!defenderRoll.attackerRoll.isPart) {
|
||||||
// TODO: attaquant doit jouer résistance et peut être désarmé p132
|
// TODO: attaquant doit jouer résistance et peut être désarmé p132
|
||||||
ChatUtility.chatWithRollMode({
|
ChatUtility.createChatWithRollMode(this.defender.name, {
|
||||||
content: `(à gérer) L'attaquant doit jouer résistance et peut être désarmé (p132)`
|
content: `(à gérer) L'attaquant doit jouer résistance et peut être désarmé (p132)`
|
||||||
}, this.defender.name)
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async _onParadeNormale(rollData) {
|
async _onParadeNormale(defenderRoll) {
|
||||||
console.log("RdDCombat._onParadeNormale >>>", rollData);
|
console.log("RdDCombat._onParadeNormale >>>", defenderRoll);
|
||||||
|
|
||||||
this._consumeDefense(rollData.passeArme);
|
this._consumeDefense(defenderRoll.passeArme);
|
||||||
await this.computeRecul(rollData);
|
await this.computeRecul(defenderRoll);
|
||||||
await this.computeDeteriorationArme(rollData);
|
await this.computeDeteriorationArme(defenderRoll);
|
||||||
|
|
||||||
await RdDResolutionTable.displayRollData(rollData, this.defender, 'chat-resultat-parade.html');
|
await RdDResolutionTable.displayRollData(defenderRoll, this.defender, 'chat-resultat-parade.html');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async _onParadeEchec(rollData) {
|
async _onParadeEchec(defenderRoll) {
|
||||||
console.log("RdDCombat._onParadeEchec >>>", rollData);
|
console.log("RdDCombat._onParadeEchec >>>", defenderRoll);
|
||||||
|
|
||||||
await RdDResolutionTable.displayRollData(rollData, this.defender, 'chat-resultat-parade.html');
|
await RdDResolutionTable.displayRollData(defenderRoll, this.defender, 'chat-resultat-parade.html');
|
||||||
|
|
||||||
this.removeChatMessageActionsPasseArme(rollData.passeArme);
|
this.removeChatMessageActionsPasseArme(defenderRoll.passeArme);
|
||||||
this._sendMessageDefense(rollData.attackerRoll, { defense: true });
|
this._sendMessageDefense(defenderRoll.attackerRoll, { defense: true });
|
||||||
this._storeDefense(rollData);
|
this._storeDefense(defenderRoll);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -579,10 +584,9 @@ export class RdDCombat {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
_onEsquiveParticuliere(rollData) {
|
_onEsquiveParticuliere(rollData) {
|
||||||
console.log("RdDCombat._onEsquiveParticuliere >>>", rollData);
|
console.log("RdDCombat._onEsquiveParticuliere >>>", rollData);
|
||||||
let chatOptions = {
|
ChatUtility.createChatWithRollMode(this.defender.name, {
|
||||||
content: "<strong>Vous pouvez esquiver une deuxième esquive!</strong>"
|
content: "<strong>Vous pouvez esquiver une deuxième esquive!</strong>"
|
||||||
}
|
});
|
||||||
ChatUtility.chatWithRollMode(chatOptions, this.defender.name)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -651,11 +655,11 @@ export class RdDCombat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async computeRecul(rollData) { // Calcul du recul (p. 132)
|
async computeRecul(defenderRoll) { // Calcul du recul (p. 132)
|
||||||
const attaque = rollData.attackerRoll;
|
const attackerRoll = defenderRoll.attackerRoll;
|
||||||
if (this._isAttaqueCauseRecul(attaque)) {
|
if (this._isAttaqueCauseRecul(attackerRoll)) {
|
||||||
|
|
||||||
let impactRecul = this._computeImpactRecul(attaque);
|
let impactRecul = this._computeImpactRecul(attackerRoll);
|
||||||
const agilite = this.defender.isEntiteCauchemar()
|
const agilite = this.defender.isEntiteCauchemar()
|
||||||
? this.defender.data.data.carac.reve.value
|
? this.defender.data.data.carac.reve.value
|
||||||
: this.defender.data.data.carac.agilite.value;
|
: this.defender.data.data.carac.agilite.value;
|
||||||
@ -663,13 +667,13 @@ export class RdDCombat {
|
|||||||
let rollRecul = await RdDResolutionTable.rollData({ caracValue: 10, finalLevel: impactRecul, showDice: false });
|
let rollRecul = await RdDResolutionTable.rollData({ caracValue: 10, finalLevel: impactRecul, showDice: false });
|
||||||
|
|
||||||
if (rollRecul.isSuccess) {
|
if (rollRecul.isSuccess) {
|
||||||
rollData.show.recul = 'encaisse';
|
defenderRoll.show.recul = 'encaisse';
|
||||||
} else if (rollRecul.isETotal) {
|
} else if (rollRecul.isETotal) {
|
||||||
rollData.show.recul = 'chute';
|
defenderRoll.show.recul = 'chute';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let chute = await RdDResolutionTable.rollData({ caracValue: agilite, finalLevel: impactRecul, showDice: false });
|
let chute = await RdDResolutionTable.rollData({ caracValue: agilite, finalLevel: impactRecul, showDice: false });
|
||||||
rollData.show.recul = (chute.isSuccess)
|
defenderRoll.show.recul = (chute.isSuccess)
|
||||||
? 'recul'
|
? 'recul'
|
||||||
: 'chute';
|
: 'chute';
|
||||||
}
|
}
|
||||||
@ -696,7 +700,13 @@ export class RdDCombat {
|
|||||||
console.log("RdDCombat.encaisser >>>", attackerRoll, defenderTokenId);
|
console.log("RdDCombat.encaisser >>>", attackerRoll, defenderTokenId);
|
||||||
|
|
||||||
let defenderRoll = this._consumeDefense(attackerRoll.passeArme);
|
let defenderRoll = this._consumeDefense(attackerRoll.passeArme);
|
||||||
if (defenderRoll && RdDCombat.isEchecTotal(defenderRoll)) {
|
if (!defenderRoll) {
|
||||||
|
defenderRoll = {
|
||||||
|
attackerRoll: attackerRoll,
|
||||||
|
show: {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else if (RdDCombat.isEchecTotal(defenderRoll)) {
|
||||||
// TODO: echec total!!!
|
// TODO: echec total!!!
|
||||||
this._onEchecTotal(defenderRoll);
|
this._onEchecTotal(defenderRoll);
|
||||||
}
|
}
|
||||||
@ -746,7 +756,6 @@ export class RdDCombat {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static async displayActorCombatStatus(actor) {
|
static async displayActorCombatStatus(actor) {
|
||||||
let rollMode = game.settings.get("core", "rollMode");
|
|
||||||
let rollData = {
|
let rollData = {
|
||||||
alias: actor.name,
|
alias: actor.name,
|
||||||
etatGeneral: actor.getEtatGeneral(),
|
etatGeneral: actor.getEtatGeneral(),
|
||||||
@ -762,8 +771,9 @@ export class RdDCombat {
|
|||||||
} else if (actor.countBlessuresByName("graves") > 0) {
|
} else if (actor.countBlessuresByName("graves") > 0) {
|
||||||
rollData.isGrave = true;
|
rollData.isGrave = true;
|
||||||
}
|
}
|
||||||
let content = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-turn-summary.html`, rollData);
|
ChatUtility.createChatWithRollMode(actor.name, {
|
||||||
ChatUtility.createChatMessage({ content: content }, rollMode, actor.name);
|
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-turn-summary.html`, rollData)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
@ -192,15 +192,14 @@ export class RdDCommands {
|
|||||||
};
|
};
|
||||||
await RdDResolutionTable.rollData(rollData);
|
await RdDResolutionTable.rollData(rollData);
|
||||||
msg.content = await RdDResolutionTable.buildRollDataHtml(rollData);
|
msg.content = await RdDResolutionTable.buildRollDataHtml(rollData);
|
||||||
ChatUtility.chatWithRollMode(msg, game.user.name);
|
ChatUtility.createChatWithRollMode(game.user.name, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
async rollDeDraconique(msg) {
|
async rollDeDraconique(msg) {
|
||||||
let rollMode = game.settings.get("core", "rollMode");
|
|
||||||
let ddr = new DeDraconique().evaluate();
|
let ddr = new DeDraconique().evaluate();
|
||||||
await RdDDice.show(ddr, rollMode);
|
await RdDDice.show(ddr, rollMode);
|
||||||
msg.content = `Lancer d'un Dé draconique: ${ddr.total}`;
|
msg.content = `Lancer d'un Dé draconique: ${ddr.total}`;
|
||||||
ChatUtility.createChatMessage(msg, rollMode, game.user.name);
|
ChatUtility.createChatWithRollMode(game.user.name, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ export class RdDDice {
|
|||||||
if (game.modules.get("dice-so-nice") && game.modules.get("dice-so-nice").active) {
|
if (game.modules.get("dice-so-nice") && game.modules.get("dice-so-nice").active) {
|
||||||
let whisper = null;
|
let whisper = null;
|
||||||
let blind = false;
|
let blind = false;
|
||||||
rollMode = rollMode || game.settings.get("core", "rollMode");
|
rollMode = rollMode ?? game.settings.get("core", "rollMode");
|
||||||
switch (rollMode) {
|
switch (rollMode) {
|
||||||
case "blindroll": //GM only
|
case "blindroll": //GM only
|
||||||
blind = true;
|
blind = true;
|
||||||
|
@ -91,9 +91,9 @@ export class RdDResolutionTable {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static async displayRollData(rollData, actor = undefined, template = 'chat-resultat-general.html') {
|
static async displayRollData(rollData, actor = undefined, template = 'chat-resultat-general.html') {
|
||||||
ChatUtility.chatWithRollMode(
|
ChatUtility.createChatWithRollMode(actor?.userName ?? game.user.name, {
|
||||||
{ content: await RdDResolutionTable.buildRollDataHtml(rollData, actor, template) },
|
content: await RdDResolutionTable.buildRollDataHtml(rollData, actor, template)
|
||||||
actor?.userName ?? game.user.name)
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
@ -98,25 +98,25 @@ const nomEthylisme = ["Emeché", "Gris", "Pinté", "Pas frais", "Ivre", "Bu", "C
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
const definitionsEncaissement = {
|
const definitionsEncaissement = {
|
||||||
"mortel": [
|
"mortel": [
|
||||||
{ minimum: undefined, maximum: 0, endurance: "0", vie: "0", legeres: 0, graves: 0, critiques: 0 },
|
{ minimum: undefined, maximum: 0, endurance: "0", vie: "0", eraflures: 0, legeres: 0, graves: 0, critiques: 0 },
|
||||||
{ minimum: 1, maximum: 10, endurance: "1d4", vie: "0", legeres: 0, graves: 0, critiques: 0 },
|
{ minimum: 1, maximum: 10, endurance: "1d4", vie: "0", eraflures: 1, legeres: 0, graves: 0, critiques: 0 },
|
||||||
{ minimum: 11, maximum: 15, endurance: "1d6", vie: "0", legeres: 1, graves: 0, critiques: 0 },
|
{ minimum: 11, maximum: 15, endurance: "1d6", vie: "0", eraflures: 0, legeres: 1, graves: 0, critiques: 0 },
|
||||||
{ minimum: 16, maximum: 19, endurance: "2d6", vie: "2", legeres: 0, graves: 1, critiques: 0 },
|
{ minimum: 16, maximum: 19, endurance: "2d6", vie: "2", eraflures: 0, legeres: 0, graves: 1, critiques: 0 },
|
||||||
{ minimum: 20, maximum: undefined, endurance: "100", vie: "4 + @over20", legeres: 0, graves: 0, critiques: 1 },
|
{ minimum: 20, maximum: undefined, endurance: "100", vie: "4 + @over20", eraflures: 0, legeres: 0, graves: 0, critiques: 1 },
|
||||||
],
|
],
|
||||||
"non-mortel": [
|
"non-mortel": [
|
||||||
{ minimum: undefined, maximum: 0, endurance: "0", vie: "0", legeres: 0, graves: 0, critiques: 0 },
|
{ minimum: undefined, maximum: 0, endurance: "0", vie: "0", eraflures: 0, legeres: 0, graves: 0, critiques: 0 },
|
||||||
{ minimum: 1, maximum: 10, endurance: "1d4", vie: "0", legeres: 0, graves: 0, critiques: 0 },
|
{ minimum: 1, maximum: 10, endurance: "1d4", vie: "0", eraflures: 1, legeres: 0, graves: 0, critiques: 0 },
|
||||||
{ minimum: 11, maximum: 15, endurance: "1d6", vie: "0", legeres: 0, graves: 0, critiques: 0 },
|
{ minimum: 11, maximum: 15, endurance: "1d6", vie: "0", eraflures: 1, legeres: 0, graves: 0, critiques: 0 },
|
||||||
{ minimum: 16, maximum: 19, endurance: "2d6", vie: "0", legeres: 1, graves: 0, critiques: 0 },
|
{ minimum: 16, maximum: 19, endurance: "2d6", vie: "0", eraflures: 0, legeres: 1, graves: 0, critiques: 0 },
|
||||||
{ minimum: 20, maximum: undefined, endurance: "100", vie: "1", legeres: 1, graves: 0, critiques: 0 },
|
{ minimum: 20, maximum: undefined, endurance: "100", vie: "0", eraflures: 0, legeres: 1, graves: 0, critiques: 0 },
|
||||||
],
|
],
|
||||||
"cauchemar": [
|
"cauchemar": [
|
||||||
{ minimum: undefined, maximum: 0, endurance: "0", vie: "0", legeres: 0, graves: 0, critiques: 0 },
|
{ minimum: undefined, maximum: 0, endurance: "0", vie: "0", eraflures: 0, legeres: 0, graves: 0, critiques: 0 },
|
||||||
{ minimum: 1, maximum: 10, endurance: "1d4", vie: "0", legeres: 0, graves: 0, critiques: 0 },
|
{ minimum: 1, maximum: 10, endurance: "1d4", vie: "0", eraflures: 1, legeres: 0, graves: 0, critiques: 0 },
|
||||||
{ minimum: 11, maximum: 15, endurance: "1d6", vie: "0", legeres: 0, graves: 0, critiques: 0 },
|
{ minimum: 11, maximum: 15, endurance: "1d6", vie: "0", eraflures: 1, legeres: 0, graves: 0, critiques: 0 },
|
||||||
{ minimum: 16, maximum: 19, endurance: "2d6", vie: "0", legeres: 0, graves: 0, critiques: 0 },
|
{ minimum: 16, maximum: 19, endurance: "2d6", vie: "0", eraflures: 1, legeres: 0, graves: 0, critiques: 0 },
|
||||||
{ minimum: 20, maximum: undefined, endurance: "3d6 + @over20", vie: "0", legeres: 0, graves: 0, critiques: 0 },
|
{ minimum: 20, maximum: undefined, endurance: "3d6 + @over20", vie: "0", eraflures: 1, legeres: 0, graves: 0, critiques: 0 },
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -193,6 +193,7 @@ export class RdDUtility {
|
|||||||
'systems/foundryvtt-reve-de-dragon/templates/chat-demande-attaque-etotal.html',
|
'systems/foundryvtt-reve-de-dragon/templates/chat-demande-attaque-etotal.html',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/chat-resultat-appelchance.html',
|
'systems/foundryvtt-reve-de-dragon/templates/chat-resultat-appelchance.html',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/chat-resultat-attaque.html',
|
'systems/foundryvtt-reve-de-dragon/templates/chat-resultat-attaque.html',
|
||||||
|
'systems/foundryvtt-reve-de-dragon/templates/chat-resultat-encaissement.html',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/chat-resultat-parade.html',
|
'systems/foundryvtt-reve-de-dragon/templates/chat-resultat-parade.html',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/chat-resultat-esquive.html',
|
'systems/foundryvtt-reve-de-dragon/templates/chat-resultat-esquive.html',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/chat-resultat-competence.html',
|
'systems/foundryvtt-reve-de-dragon/templates/chat-resultat-competence.html',
|
||||||
@ -551,10 +552,10 @@ export class RdDUtility {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static _evaluatePerte(formula, over20) {
|
static _evaluatePerte(formula, over20) {
|
||||||
console.log("_evaluatePerte", formula, over20)
|
console.log("_evaluatePerte", formula, over20);
|
||||||
let perte = new Roll(formula, { over20: over20 })
|
let perte = new Roll(formula, { over20: over20 });
|
||||||
perte.evaluate()
|
perte.evaluate();
|
||||||
return perte.total
|
return perte.total;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{{#if (eq surprise 'totale')}}
|
{{#if (eq surprise 'totale')}}
|
||||||
<span><strong>{{defender.name}}</strong> est totalement surpris</span>
|
<span><strong>{{defender.name}}</strong> est totalement surpris</span>
|
||||||
{{else if essais.defense}}
|
{{else if essais.defense}}
|
||||||
<span><strong>{{defender.name}}</strong> doit</span>
|
<span><strong>{{defender.name}}</strong> doit :</span>
|
||||||
{{else}}
|
{{else}}
|
||||||
<span><strong>{{defender.name}}</strong> doit se défendre
|
<span><strong>{{defender.name}}</strong> doit se défendre
|
||||||
{{#if (eq surprise 'demi')}} avec une significative {{/if}} :
|
{{#if (eq surprise 'demi')}} avec une significative {{/if}} :
|
||||||
@ -12,7 +12,6 @@
|
|||||||
<br>
|
<br>
|
||||||
{{#unless (eq surprise 'totale')}}
|
{{#unless (eq surprise 'totale')}}
|
||||||
{{#if essais.defense}}
|
{{#if essais.defense}}
|
||||||
<br>
|
|
||||||
{{#unless essais.defenseChance}}
|
{{#unless essais.defenseChance}}
|
||||||
{{#if (eq defender.data.type 'personnage')}}
|
{{#if (eq defender.data.type 'personnage')}}
|
||||||
<a class='chat-card-button' id='appel-chance-defense' data-attackerId='{{attackerId}}'
|
<a class='chat-card-button' id='appel-chance-defense' data-attackerId='{{attackerId}}'
|
||||||
@ -20,7 +19,6 @@
|
|||||||
</a>
|
</a>
|
||||||
<br>
|
<br>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/unless}}
|
|
||||||
{{#if (eq defender.data.type 'personnage')}}
|
{{#if (eq defender.data.type 'personnage')}}
|
||||||
{{#if (gt defender.data.data.compteurs.destinee.value 0)}}
|
{{#if (gt defender.data.data.compteurs.destinee.value 0)}}
|
||||||
<a class='chat-card-button' id='appel-destinee-defense' data-attackerId='{{attackerId}}'
|
<a class='chat-card-button' id='appel-destinee-defense' data-attackerId='{{attackerId}}'
|
||||||
@ -29,6 +27,7 @@
|
|||||||
<br>
|
<br>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{/unless}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#each armes as |arme key|}}
|
{{#each armes as |arme key|}}
|
||||||
<a class='chat-card-button' id='parer-button' data-attackerId='{{../attackerId}}' data-defenderTokenId='{{../defenderTokenId}}' data-armeid='{{arme._id }}'>
|
<a class='chat-card-button' id='parer-button' data-attackerId='{{../attackerId}}' data-defenderTokenId='{{../defenderTokenId}}' data-armeid='{{arme._id }}'>
|
||||||
|
42
templates/chat-resultat-encaissement.html
Normal file
42
templates/chat-resultat-encaissement.html
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
{{#if isGM}}
|
||||||
|
<span>
|
||||||
|
{{#if (gt endurance 0)}}
|
||||||
|
De plus, {{alias}} a perdu {{endurance}} points d'endurance
|
||||||
|
{{#if (ne vie 0)}}et <span class="rdd-roll-echec">{{vie}} points de vie</span>{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
</span>
|
||||||
|
{{else}}
|
||||||
|
<h4>{{alias}} encaisse à
|
||||||
|
<span>
|
||||||
|
{{numberFormat dmg.total decimals=0 sign=true}}
|
||||||
|
{{#if (eq dmg.mortalite 'non-mortel')~}}(coups non mortels)
|
||||||
|
{{~else if (eq dmg.mortalite 'cauchemar')}}(entité de cauchemar)
|
||||||
|
{{~/if}}
|
||||||
|
</span>
|
||||||
|
</h4>
|
||||||
|
<div>
|
||||||
|
Je d'encaissement de {{roll.total}}
|
||||||
|
{{#unless (eq armure 0)}}, l'armure a protègé de {{armure}} {{#unless (eq penetration 0)}}(pénétration de {{penetration}})
|
||||||
|
{{/unless}}
|
||||||
|
{{/unless}}, total: <span class="rdd-roll-echec">{{total}}</span>
|
||||||
|
<br>
|
||||||
|
{{alias}} subit
|
||||||
|
{{#if (gt eraflures 0)}}une contusion
|
||||||
|
{{else if (gt legeres 0)}}une blessure légère
|
||||||
|
{{else if (gt graves 0)}}une blessure grave
|
||||||
|
{{else if (gt critique 0)}}une blessure critique
|
||||||
|
{{else}}Rien du tout
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
({{dmg.loc.label}})
|
||||||
|
{{#if (gt endurance 0)}}
|
||||||
|
{{#if hasPlayerOwner}}, a perdu {{endurance}} points d'endurance
|
||||||
|
{{#if (ne vie 0)}}, <span class="rdd-roll-echec">{{vie}} points de vie</span>{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
{{#if (gt endurance 1)}}
|
||||||
|
et {{#if sonne}}est <strong>sonné</strong><img class="chat-icon" src="icons/svg/stoned.svg" alt="charge" height="16" width="16" /> jusqu'à la fin du prochain round{{else}}n'est pas sonné{{/if}}
|
||||||
|
({{jetEndurance}} / {{resteEndurance}})!
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
Loading…
Reference in New Issue
Block a user