Ajout des blessures sur encaissement
This commit is contained in:
parent
d0475e8677
commit
3e189cbe5f
BIN
icons/sante/blessure-mort.webp
Normal file
BIN
icons/sante/blessure-mort.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.1 KiB |
BIN
icons/sante/eraflure.webp
Normal file
BIN
icons/sante/eraflure.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.8 KiB |
BIN
icons/sante/mort.webp
Normal file
BIN
icons/sante/mort.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.6 KiB |
@ -153,43 +153,18 @@ export class RdDActorSheet extends RdDBaseActorSheet {
|
||||
this.createEmptyTache();
|
||||
});
|
||||
this.html.find('.creer-tache-blessure-legere').click(async event => {
|
||||
RdDItemBlessure.createTacheSoinBlessure(this.actor, 'legere');
|
||||
RdDItemBlessure.createTacheSoinBlessure(this.actor, 2);
|
||||
});
|
||||
this.html.find('.creer-tache-blessure-grave').click(async event => {
|
||||
RdDItemBlessure.createTacheSoinBlessure(this.actor, 'grave');
|
||||
RdDItemBlessure.createTacheSoinBlessure(this.actor, 4);
|
||||
});
|
||||
this.html.find('.creer-tache-blessure-critique').click(async event => {
|
||||
RdDItemBlessure.createTacheSoinBlessure(this.actor, 'critique');
|
||||
RdDItemBlessure.createTacheSoinBlessure(this.actor, 6);
|
||||
});
|
||||
this.html.find('.creer-une-oeuvre').click(async event => {
|
||||
this.selectTypeOeuvreToCreate();
|
||||
});
|
||||
|
||||
// Blessure control
|
||||
this.html.find('.blessure-control').click(async event => {
|
||||
const tr = this.html.find(event.currentTarget).parents(".item");
|
||||
let btype = tr.data("blessure-type");
|
||||
let index = tr.data('blessure-index');
|
||||
let active = this.html.find(event.currentTarget).data('blessure-active');
|
||||
//console.log(btype, index, active);
|
||||
await this.actor.manageBlessureFromSheet(btype, index, active);
|
||||
});
|
||||
|
||||
// Blessure data
|
||||
this.html.find('.blessure-soins').change(async event => {
|
||||
const tr = this.html.find(event.currentTarget).parents(".item");
|
||||
let btype = tr.data('blessure-type');
|
||||
let index = tr.data('blessure-index');
|
||||
let psoins = tr.find('.blessure-premiers_soins').val();
|
||||
let pcomplets = tr.find('.blessure-soins_complets').val();
|
||||
let jours = tr.find('.blessure-jours').val();
|
||||
let loc = tr.find('.blessure-localisation').val();
|
||||
let psdone = tr.find('.blessure-psdone:checked').val();
|
||||
let scdone = tr.find('.blessure-scdone:checked').val();
|
||||
console.log(btype, index, psoins, pcomplets, jours, loc, psdone, scdone);
|
||||
await this.actor.setDataBlessureFromSheet(btype, index, psoins, pcomplets, jours, loc, psdone, scdone);
|
||||
});
|
||||
|
||||
this.html.find('.blessure-premierssoins-done').change(async event => {
|
||||
const blessure = this.getBlessure(event);
|
||||
await blessure?.setSoinsBlessure({ premierssoins: { done: event.currentTarget.checked } });
|
||||
|
320
module/actor.js
320
module/actor.js
@ -26,7 +26,7 @@ import { DialogConsommer } from "./dialog-item-consommer.js";
|
||||
import { DialogFabriquerPotion } from "./dialog-fabriquer-potion.js";
|
||||
import { RollDataAjustements } from "./rolldata-ajustements.js";
|
||||
import { RdDPossession } from "./rdd-possession.js";
|
||||
import { ENTITE_BLURETTE, ENTITE_INCARNE, ENTITE_NONINCARNE, SHOW_DICE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js";
|
||||
import { ENTITE_INCARNE, ENTITE_NONINCARNE, SHOW_DICE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js";
|
||||
import { RdDConfirm } from "./rdd-confirm.js";
|
||||
import { DialogValidationEncaissement } from "./dialog-validation-encaissement.js";
|
||||
import { RdDRencontre } from "./item/rencontre.js";
|
||||
@ -46,7 +46,6 @@ const POSSESSION_SANS_DRACONIC = {
|
||||
}
|
||||
};
|
||||
|
||||
const PAS_DE_BLESSURE = { "active": false, "psdone": false, "scdone": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "loc": "" };
|
||||
export const MAINS_DIRECTRICES = ['Droitier', 'Gaucher', 'Ambidextre']
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -403,7 +402,7 @@ export class RdDActor extends RdDBaseActor {
|
||||
}
|
||||
await this._recupereChance();
|
||||
await this.transformerStress();
|
||||
this.bonusRecuperationPotion = 0; // Reset potion
|
||||
await this.setBonusPotionSoin(0);
|
||||
}
|
||||
await this.resetInfoSommeil()
|
||||
ChatMessage.create(message);
|
||||
@ -414,11 +413,8 @@ export class RdDActor extends RdDBaseActor {
|
||||
const maladiesPoisons = this._maladiePoisons(message);
|
||||
const isMaladeEmpoisonne = maladiesPoisons.length > 0;
|
||||
this._messageRecuperationMaladiePoisons(maladiesPoisons, message);
|
||||
const blessures = duplicate(this.system.blessures);
|
||||
await this._recupererBlessures(message, "legere", blessures.legeres.liste.filter(b => b.active), [], isMaladeEmpoisonne);
|
||||
await this._recupererBlessures(message, "grave", blessures.graves.liste.filter(b => b.active), blessures.legeres.liste, isMaladeEmpoisonne);
|
||||
await this._recupererBlessures(message, "critique", blessures.critiques.liste.filter(b => b.active), blessures.graves.liste, isMaladeEmpoisonne);
|
||||
await this.update({ "system.blessures": blessures });
|
||||
|
||||
await this._recuperationBlessures(message, isMaladeEmpoisonne);
|
||||
await this._recupererVie(message, isMaladeEmpoisonne);
|
||||
}
|
||||
|
||||
@ -460,7 +456,7 @@ export class RdDActor extends RdDBaseActor {
|
||||
await this._recupereChance();
|
||||
await this.transformerStress();
|
||||
await this.retourSeuilDeReve(message);
|
||||
this.bonusRecuperationPotion = 0; // Reset potion
|
||||
await this.setBonusPotionSoin(0);
|
||||
await this.retourSust(message);
|
||||
await this.verifierPotionsEnchantees();
|
||||
if (message.content != "") {
|
||||
@ -523,65 +519,36 @@ export class RdDActor extends RdDBaseActor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _recupererBlessures(message, type, liste, moindres, isMaladeEmpoisonne) {
|
||||
if (!this.bonusRecuperationPotion) this.bonusRecuperationPotion = 0;
|
||||
let count = 0;
|
||||
const definitions = RdDUtility.getDefinitionsBlessures();
|
||||
let definition = definitions.find(d => d.type == type);
|
||||
for (let blessure of liste) {
|
||||
if (blessure.jours >= definition.facteur) {
|
||||
let rolled = await this._jetRecuperationConstitution(Misc.toInt(blessure.soins_complets) + this.bonusRecuperationPotion, message);
|
||||
blessure.soins_complets = 0;
|
||||
if (!isMaladeEmpoisonne && rolled.isSuccess && this._retrograderBlessure(type, blessure, moindres)) {
|
||||
message.content += ` -- une blessure ${type} cicatrise`;
|
||||
count++;
|
||||
}
|
||||
else if (rolled.isETotal) {
|
||||
message.content += ` -- une blessure ${type} s'infecte (temps de guérison augmenté de ${definition.facteur} jours, perte de vie)`;
|
||||
blessure.jours = 0;
|
||||
await this.santeIncDec("vie", -1);
|
||||
}
|
||||
else {
|
||||
blessure.jours++;
|
||||
message.content += ` -- une blessure ${type} reste stable`;
|
||||
}
|
||||
}
|
||||
else {
|
||||
blessure.jours++;
|
||||
}
|
||||
}
|
||||
async _recuperationBlessures(message, isMaladeEmpoisonne) {
|
||||
const timestamp = game.system.rdd.calendrier.getTimestamp()
|
||||
const blessures = this.filterItems(it => it.gravite > 0, 'blessure').sort(Misc.ascending(it => it.system.gravite))
|
||||
|
||||
Promise.all(blessures.map(b => b.recuperationBlessure({
|
||||
actor: this,
|
||||
timestamp,
|
||||
message,
|
||||
isMaladeEmpoisonne,
|
||||
blessures
|
||||
})));
|
||||
await this.supprimerBlessures(filterToDelete);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_retrograderBlessure(type, blessure, blessuresMoindres) {
|
||||
if (type != "legere") {
|
||||
let retrograde = blessuresMoindres.find(b => !b.active);
|
||||
if (!retrograde) {
|
||||
return false;
|
||||
}
|
||||
mergeObject(retrograde, { "active": true, "psdone": blessure.psdone, "scdone": blessure.scdone, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "loc": blessure.loc });
|
||||
}
|
||||
this._supprimerBlessure(blessure);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_supprimerBlessure(blessure) {
|
||||
mergeObject(blessure, PAS_DE_BLESSURE);
|
||||
async supprimerBlessures(filterToDelete) {
|
||||
const toDelete = this.filterItems(filterToDelete, 'blessure')
|
||||
.map(it => it.id);
|
||||
await this.deleteEmbeddedDocuments('Item', toDelete);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _recupererVie(message, isMaladeEmpoisonne) {
|
||||
const tData = this.system
|
||||
let blessures = [].concat(tData.blessures.legeres.liste).concat(tData.blessures.graves.liste).concat(tData.blessures.critiques.liste);
|
||||
let nbBlessures = blessures.filter(b => b.active);
|
||||
let vieManquante = tData.sante.vie.max - tData.sante.vie.value;
|
||||
if (nbBlessures == 0 && vieManquante > 0) {
|
||||
let bonusSoins = 0;
|
||||
for (let b of blessures) {
|
||||
bonusSoins = Math.max(bonusSoins, Misc.toInt(b.soins_complets));
|
||||
let blessures = this.filterItems(it => it.system.gravite > 0, 'blessure');
|
||||
if (blessures.length > 0) {
|
||||
return
|
||||
}
|
||||
let rolled = await this._jetRecuperationConstitution(bonusSoins, message)
|
||||
let vieManquante = tData.sante.vie.max - tData.sante.vie.value;
|
||||
if (vieManquante > 0) {
|
||||
let rolled = await this.jetRecuperationConstitution(bonusSoins, message)
|
||||
if (!isMaladeEmpoisonne && rolled.isSuccess) {
|
||||
const gain = Math.min(rolled.isPart ? 2 : 1, vieManquante);
|
||||
message.content += " -- récupération de vie: " + gain;
|
||||
@ -598,7 +565,7 @@ export class RdDActor extends RdDBaseActor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _jetRecuperationConstitution(bonusSoins, message = undefined) {
|
||||
async jetRecuperationConstitution(bonusSoins, message = undefined) {
|
||||
let difficulte = Misc.toInt(bonusSoins) + Math.min(0, this.system.sante.vie.value - this.system.sante.vie.max);
|
||||
let rolled = await RdDResolutionTable.roll(this.system.carac.constitution.value, difficulte);
|
||||
if (message) {
|
||||
@ -623,18 +590,14 @@ export class RdDActor extends RdDBaseActor {
|
||||
const updates = {
|
||||
'system.sante.endurance.value': this.system.sante.endurance.max
|
||||
};
|
||||
if (!this.isEntite([ENTITE_INCARNE, ENTITE_BLURETTE])) {
|
||||
if (this.system.blessures) {
|
||||
updates['system.blessures.legeres.liste'] = [PAS_DE_BLESSURE, PAS_DE_BLESSURE, PAS_DE_BLESSURE, PAS_DE_BLESSURE, PAS_DE_BLESSURE];
|
||||
updates['system.blessures.graves.liste'] = [PAS_DE_BLESSURE, PAS_DE_BLESSURE];
|
||||
updates['system.blessures.critiques.liste'] = [PAS_DE_BLESSURE];
|
||||
}
|
||||
if (this.isPersonnage() || this.isCreature()) {
|
||||
await this.supprimerBlessures(it => true);
|
||||
updates['system.sante.vie.value'] = this.system.sante.vie.max;
|
||||
updates['system.sante.fatigue.value'] = 0;
|
||||
}
|
||||
if (this.isPersonnage()) {
|
||||
updates['system.compteurs.ethylisme'] = { value: 1, nb_doses: 0, jet_moral: false };
|
||||
}
|
||||
}
|
||||
await this.update(updates);
|
||||
await this.removeEffects(e => e.flags.core.statusId !== STATUSES.StatusDemiReve);
|
||||
}
|
||||
@ -1147,17 +1110,17 @@ export class RdDActor extends RdDBaseActor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
computeResumeBlessure(blessures = undefined) {
|
||||
blessures = blessures ?? this.system.blessures;
|
||||
if (!blessures) {
|
||||
return "Pas de blessures possibles";
|
||||
}
|
||||
let nbLegeres = this.countBlessures(blessures.legeres.liste);
|
||||
let nbGraves = this.countBlessures(blessures.graves.liste);
|
||||
let nbCritiques = this.countBlessures(blessures.critiques.liste);
|
||||
computeResumeBlessure() {
|
||||
const blessures = this.filterItems(it => it.system.gravite > 0, 'blessure')
|
||||
|
||||
const nbLegeres = blessures.filter(it => it.isLegere()).length;
|
||||
const nbGraves = blessures.filter(it => it.isGrave()).length;
|
||||
const nbCritiques = blessures.filter(it => it.isCritique()).length;
|
||||
|
||||
if (nbLegeres + nbGraves + nbCritiques == 0) {
|
||||
return "Aucune blessure";
|
||||
}
|
||||
let resume = "Blessures:";
|
||||
if (nbCritiques > 0 || nbGraves > 0 || nbLegeres > 0) {
|
||||
if (nbLegeres > 0) {
|
||||
resume += " " + nbLegeres + " légère" + (nbLegeres > 1 ? "s" : "");
|
||||
}
|
||||
@ -1173,10 +1136,6 @@ export class RdDActor extends RdDBaseActor {
|
||||
}
|
||||
return resume;
|
||||
}
|
||||
else {
|
||||
return "Aucune blessure";
|
||||
}
|
||||
}
|
||||
|
||||
recompute() {
|
||||
this.computeEtatGeneral();
|
||||
@ -1384,11 +1343,11 @@ export class RdDActor extends RdDBaseActor {
|
||||
ChatMessage.create({ content: `${this.name} n'est plus ${Misc.lowerFirst(game.i18n.localize(effect.system.label))} !` });
|
||||
}
|
||||
}
|
||||
if (this.type == 'personnage') {
|
||||
// Gestion blessure graves : -1 pt endurance
|
||||
let nbGraves = this.countBlessuresNonSoigneeByName('graves');
|
||||
if (this.isPersonnage() || this.isCreature()) {
|
||||
const nbGraves = this.filterItems(it => it.isGrave(), 'blessure').length
|
||||
if (nbGraves > 0) {
|
||||
await this.santeIncDec("endurance", -1);
|
||||
// Gestion blessure graves : -1 pt endurance par blessure grave
|
||||
await this.santeIncDec("endurance", - nbGraves);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1419,20 +1378,8 @@ export class RdDActor extends RdDBaseActor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
countBlessures(blessuresListe) {
|
||||
return blessuresListe.filter(b => b.active).length
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
countBlessuresByName(name) {
|
||||
return this.countBlessures(this.system.blessures[name].liste);
|
||||
}
|
||||
|
||||
countBlessuresNonSoigneeByName(name) {
|
||||
if (this.system.blessures) {
|
||||
let blessures = this.system.blessures[name].liste;
|
||||
return blessures.filter(b => b.active && !b.psdone).length;
|
||||
}
|
||||
return 0;
|
||||
countBlessures(filter = it => !it.isContusion()) {
|
||||
return this.filterItems(filter, 'blessure').length
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -1583,40 +1530,15 @@ export class RdDActor extends RdDBaseActor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_computeEnduranceMax() {
|
||||
let blessures = this.system.blessures;
|
||||
let diffVie = this.system.sante.vie.max - this.system.sante.vie.value;
|
||||
let maxEndVie = this.system.sante.endurance.max - (diffVie * 2);
|
||||
let nbGraves = this.countBlessures(blessures.graves.liste);
|
||||
let nbCritiques = this.countBlessures(blessures.critiques.liste);
|
||||
let maxEndGraves = Math.floor(this.system.sante.endurance.max / (2 * nbGraves));
|
||||
let maxEndCritiques = nbCritiques > 0 ? 1 : this.system.sante.endurance.max;
|
||||
const diffVie = this.system.sante.vie.max - this.system.sante.vie.value;
|
||||
const maxEndVie = this.system.sante.endurance.max - (diffVie * 2);
|
||||
const nbGraves = this.countBlessures(it => it.isGraves()) > 0
|
||||
const nbCritiques = this.countBlessures(it => it.isCritique()) > 0
|
||||
const maxEndGraves = Math.floor(this.system.sante.endurance.max / (2 * nbGraves));
|
||||
const maxEndCritiques = nbCritiques > 0 ? 1 : this.system.sante.endurance.max;
|
||||
return Math.max(0, Math.min(maxEndVie, maxEndGraves, maxEndCritiques));
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async manageBlessureFromSheet(gravite, index) {
|
||||
let listBlessures = duplicate(this.system.blessures);
|
||||
let blessure = listBlessures[gravite + "s"].liste[index];
|
||||
blessure.active = !blessure.active;
|
||||
if (!blessure.active) {
|
||||
this._supprimerBlessure(blessure);
|
||||
}
|
||||
await this.update({ 'system.blessures': listBlessures });
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async setDataBlessureFromSheet(gravite, index, psoins, pcomplets, jours, loc, psdone, scdone) {
|
||||
let listBlessures = duplicate(this.system.blessures);
|
||||
let blessure = listBlessures[gravite + "s"].liste[index];
|
||||
blessure.psdone = psdone;
|
||||
blessure.scdone = scdone;
|
||||
blessure.premiers_soins = psoins;
|
||||
blessure.soins_complets = pcomplets;
|
||||
blessure.jours = jours;
|
||||
blessure.loc = loc;
|
||||
await this.update({ 'system.blessures': listBlessures });
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async jetDeMoral(situation, messageReussi = undefined, messageManque = undefined) {
|
||||
const jetMoral = await this._jetDeMoral(situation);
|
||||
@ -2388,10 +2310,9 @@ export class RdDActor extends RdDBaseActor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async creerTacheDepuisLivre(item, options = { renderSheet: true }) {
|
||||
// TODO: déplacer vers Item pour livres
|
||||
const nomTache = "Lire " + item.name;
|
||||
const filterTacheLecture = it => it.name == nomTache;
|
||||
let tachesExistantes = this.filterItems(filterTacheLecture, 'tache');
|
||||
const filterTacheLecture = it => it.type == 'tache' && it.name == nomTache;
|
||||
let tachesExistantes = this.filterItems(filterTacheLecture);
|
||||
if (tachesExistantes.length == 0) {
|
||||
const tache = {
|
||||
name: nomTache, type: 'tache',
|
||||
@ -2407,14 +2328,14 @@ export class RdDActor extends RdDBaseActor {
|
||||
}
|
||||
}
|
||||
await this.createEmbeddedDocuments('Item', [tache], options);
|
||||
tachesExistantes = this.filterItems(filterTacheLecture, 'tache');
|
||||
tachesExistantes = this.filterItems(filterTacheLecture);
|
||||
}
|
||||
return tachesExistantes.length > 0 ? tachesExistantes[0] : undefined;
|
||||
}
|
||||
|
||||
blessuresASoigner() {
|
||||
// TODO or not TODO: filtrer les blessures poour lesquels on ne peut plus faire de premiers soins?
|
||||
return this.filterItems(it => it.system.gravite > 0 && !(it.system.premierssoins.done && it.system.soinscomplets.done), 'blessure')
|
||||
return this.filterItems(it => it.system.gravite > 0 && it.system.gravite <= 6 && !(it.system.premierssoins.done && it.system.soinscomplets.done), 'blessure')
|
||||
}
|
||||
|
||||
async getTacheBlessure(blesse, blessure) {
|
||||
@ -3156,7 +3077,7 @@ export class RdDActor extends RdDBaseActor {
|
||||
}
|
||||
})
|
||||
if (bonus >= 0) {
|
||||
await tache.delete()
|
||||
await this.deleteEmbeddedDocuments('Item', [tache.id])
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3311,11 +3232,11 @@ export class RdDActor extends RdDBaseActor {
|
||||
async _appliquerEncaissement(encaissement, show) {
|
||||
let santeOrig = duplicate(this.system.sante);
|
||||
|
||||
this.ajouterBlessure(encaissement); // Will upate the result table
|
||||
const blessure = await this.ajouterBlessure(encaissement); // Will upate the result table
|
||||
const perteVie = this.isEntite()
|
||||
? { newValue: 0 }
|
||||
: await this.santeIncDec("vie", -encaissement.vie);
|
||||
const perteEndurance = await this.santeIncDec("endurance", -encaissement.endurance, encaissement.critiques > 0);
|
||||
const perteEndurance = await this.santeIncDec("endurance", -encaissement.endurance, blessure?.isCritique());
|
||||
|
||||
mergeObject(encaissement, {
|
||||
alias: this.name,
|
||||
@ -3325,6 +3246,7 @@ export class RdDActor extends RdDBaseActor {
|
||||
jetEndurance: perteEndurance.jetEndurance,
|
||||
endurance: santeOrig.endurance.value - perteEndurance.newValue,
|
||||
vie: this.isEntite() ? 0 : (santeOrig.vie.value - perteVie.newValue),
|
||||
blessure: blessure,
|
||||
show: show ?? {}
|
||||
});
|
||||
|
||||
@ -3344,73 +3266,33 @@ export class RdDActor extends RdDBaseActor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
ajouterBlessure(encaissement) {
|
||||
if (this.type == 'entite') return; // Une entité n'a pas de blessures
|
||||
if (encaissement.legeres + encaissement.graves + encaissement.critiques == 0) return;
|
||||
|
||||
async ajouterBlessure(encaissement) {
|
||||
if (this.isEntite()) return; // Une entité n'a pas de blessures
|
||||
if (encaissement.gravite < 0) return;
|
||||
if (encaissement.gravite > 0) {
|
||||
while (this.countBlessures(it => it.system.gravite == encaissement.gravite) >= RdDItemBlessure.maxBlessures(encaissement.gravite) && encaissement.gravite <= 6) {
|
||||
// Aggravation
|
||||
encaissement.gravite += 2
|
||||
if (encaissement.gravite > 2) {
|
||||
encaissement.vie += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
const endActuelle = Number(this.system.sante.endurance.value);
|
||||
let blessures = duplicate(this.system.blessures);
|
||||
|
||||
let count = encaissement.legeres;
|
||||
// Manage blessures
|
||||
while (count > 0) {
|
||||
let legere = blessures.legeres.liste.find(it => !it.active);
|
||||
if (legere) {
|
||||
this._setBlessure(legere, encaissement);
|
||||
count--;
|
||||
}
|
||||
else {
|
||||
encaissement.graves += count;
|
||||
encaissement.legeres -= count;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
count = encaissement.graves;
|
||||
while (count > 0) {
|
||||
let grave = blessures.graves.liste.find(it => !it.active);
|
||||
if (grave) {
|
||||
this._setBlessure(grave, encaissement);
|
||||
count--;
|
||||
}
|
||||
else {
|
||||
encaissement.critiques += count;
|
||||
encaissement.graves -= count;
|
||||
const blessure = await RdDItemBlessure.createBlessure(this, encaissement.gravite, encaissement.dmg.loc.label);
|
||||
if (blessure.isCritique()) {
|
||||
encaissement.endurance = endActuelle;
|
||||
encaissement.vie = 4;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
count = encaissement.critiques;
|
||||
while (count > 0) {
|
||||
let critique = blessures.critiques.liste[0];
|
||||
if (!critique.active) {
|
||||
this._setBlessure(critique, encaissement);
|
||||
count--;
|
||||
} else {
|
||||
// TODO: status effect dead
|
||||
if (blessure.isMort()) {
|
||||
this.setEffect(STATUSES.StatusComma, true);
|
||||
encaissement.mort = true;
|
||||
ChatMessage.create({
|
||||
content: `<img class="chat-icon" src="icons/svg/skull.svg" alt="charge" />
|
||||
<strong>${this.name} vient de succomber à une seconde blessure critique ! Que les Dragons gardent son Archétype en paix !</strong>`
|
||||
});
|
||||
encaissement.critiques -= count;
|
||||
encaissement.mort = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
encaissement.endurance = Math.max(encaissement.endurance, -endActuelle);
|
||||
this.update({ "system.blessures": blessures });
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_setBlessure(blessure, encaissement) {
|
||||
blessure.active = true;
|
||||
blessure.psdone = false;
|
||||
blessure.scdone = false;
|
||||
blessure.loc = encaissement.locName;
|
||||
return blessure;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -3643,42 +3525,28 @@ export class RdDActor extends RdDBaseActor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async buildPotionGuerisonList(pointsGuerison) {
|
||||
let pointsGuerisonInitial = pointsGuerison;
|
||||
let myData = this.system;
|
||||
const blessures = duplicate(myData.blessures);
|
||||
let guerisonData = { list: [], pointsConsommes: 0 }
|
||||
|
||||
console.log(blessures);
|
||||
for (let critique of blessures.critiques.liste) {
|
||||
if (critique.active && pointsGuerison >= 6) {
|
||||
pointsGuerison -= 6;
|
||||
critique.active = false;
|
||||
guerisonData.list.push("1 Blessure Critique (6 points)");
|
||||
const pointsGuerisonInitial = pointsGuerison;
|
||||
const blessures = this.filterItems(it => it.isLegere() || it.isGrave() || it.isCritique()).sort(Misc.descending(it => it.system.gravite))
|
||||
const ids = []
|
||||
const guerisonData = { list: [], pointsConsommes: 0 }
|
||||
for (let blessure of blessures) {
|
||||
if (pointsGuerison >= blessure.system.gravite) {
|
||||
pointsGuerison -= blessure.system.gravite;
|
||||
guerisonData.list.push(`1 Blessure ${blessure.system.labelGravite} (${blessure.system.gravite} points)`);
|
||||
ids.push(blessure.id)
|
||||
}
|
||||
}
|
||||
for (let grave of blessures.graves.liste) {
|
||||
if (grave.active && pointsGuerison >= 4) {
|
||||
pointsGuerison -= 4;
|
||||
grave.active = false;
|
||||
guerisonData.list.push("1 Blessure Grave (4 points)");
|
||||
if (ids.length > 0) {
|
||||
await this.supprimerBlessures(it => ids.includes(it.id));
|
||||
}
|
||||
}
|
||||
for (let legere of blessures.legeres.liste) {
|
||||
if (legere.active && pointsGuerison >= 2) {
|
||||
pointsGuerison -= 2;
|
||||
legere.active = false;
|
||||
guerisonData.list.push("1 Blessure Légère (2 points)");
|
||||
}
|
||||
}
|
||||
await this.update({ "system.blessures": blessures });
|
||||
|
||||
let pvManquants = myData.sante.vie.max - myData.sante.vie.value;
|
||||
if (blessures.length == ids.length) {
|
||||
let pvManquants = this.system.sante.vie.max - this.system.sante.vie.value;
|
||||
let pvSoignees = Math.min(pvManquants, Math.floor(pointsGuerison / 2));
|
||||
pointsGuerison -= pvSoignees * 2;
|
||||
guerisonData.list.push(pvSoignees + " Points de Vie soignés");
|
||||
await this.santeIncDec('vie', +pvSoignees, false);
|
||||
}
|
||||
guerisonData.pointsConsommes = pointsGuerisonInitial - pointsGuerison;
|
||||
|
||||
return guerisonData;
|
||||
}
|
||||
|
||||
@ -3697,7 +3565,7 @@ export class RdDActor extends RdDBaseActor {
|
||||
}
|
||||
}
|
||||
if (!potionData.system.magique || potionData.rolled.isSuccess) {
|
||||
this.bonusRecuperationPotion = potionData.system.herbeBonus;
|
||||
await this.setBonusPotionSoin(potionData.system.herbeBonus);
|
||||
}
|
||||
ChatMessage.create({
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
|
||||
@ -3705,6 +3573,10 @@ export class RdDActor extends RdDBaseActor {
|
||||
});
|
||||
}
|
||||
|
||||
async setBonusPotionSoin(bonus) {
|
||||
await this.update({ 'sante.bonusPotion': bonus });
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async consommerPotionRepos(potionData) {
|
||||
potionData.alias = this.name;
|
||||
|
@ -1,4 +1,6 @@
|
||||
import { RdDItem } from "../item.js";
|
||||
import { Misc } from "../misc.js";
|
||||
import { RdDTimestamp } from "../rdd-timestamp.js";
|
||||
|
||||
const BASE_TACHE_SOIN_BLESSURE = {
|
||||
type: "tache",
|
||||
@ -6,20 +8,30 @@ const BASE_TACHE_SOIN_BLESSURE = {
|
||||
system: { carac: "dexterite", competence: "Chirurgie", periodicite: "1 round", fatigue: 0, }
|
||||
}
|
||||
const TACHES_SOIN_BLESSURE = {
|
||||
'critique': { name: 'Blessure critique', system: { difficulte: -6, points_de_tache: 6 } },
|
||||
'grave': { name: 'Blessure grave', system: { difficulte: -4, points_de_tache: 4 } },
|
||||
'legere': { name: 'Blessure légère', system: { difficulte: -2, points_de_tache: 2 } },
|
||||
6: { name: 'Blessure critique', system: { difficulte: -6, points_de_tache: 6 } },
|
||||
4: { name: 'Blessure grave', system: { difficulte: -4, points_de_tache: 4 } },
|
||||
2: { name: 'Blessure légère', system: { difficulte: -2, points_de_tache: 2 } },
|
||||
}
|
||||
|
||||
const definitionsBlessures = [
|
||||
{ type: "contusion", gravite: 0, labelGravite: 'Contusion/éraflure', max: 100, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/eraflure.webp" },
|
||||
{ type: "legere", gravite: 2, labelGravite: 'Légère', max: 5, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/blessure.webp" },
|
||||
{ type: "grave", gravite: 4, labelGravite: 'Grave', max: 2, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/blessure.webp" },
|
||||
{ type: "critique", gravite: 6, labelGravite: 'Critique', max: 1, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/blessure.webp" },
|
||||
{ type: "mort", gravite: 8, labelGravite: 'Mort', max: 1, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/mort.webp" }
|
||||
]
|
||||
|
||||
export class RdDItemBlessure extends RdDItem {
|
||||
|
||||
static get defaultIcon() {
|
||||
return "systems/foundryvtt-reve-de-dragon/icons/sante/blessure.webp";
|
||||
}
|
||||
|
||||
prepareDerivedData() {
|
||||
super.prepareDerivedData();
|
||||
this.system.labelGravite = this.getLabelGravite()
|
||||
}
|
||||
|
||||
static prepareTacheSoin(gravite) {
|
||||
const tache = TACHES_SOIN_BLESSURE[gravite]
|
||||
if (!tache) {
|
||||
@ -28,7 +40,22 @@ export class RdDItemBlessure extends RdDItem {
|
||||
}
|
||||
return mergeObject(duplicate(BASE_TACHE_SOIN_BLESSURE), tache)
|
||||
}
|
||||
static async createBlessure(actor, gravite, localisation) {
|
||||
const definition = RdDItemBlessure.getDefinition(gravite)
|
||||
const blessure = {
|
||||
name: definition.labelGravite,
|
||||
type: 'blessure',
|
||||
img: definition.icon,
|
||||
system: {
|
||||
gravite: gravite,
|
||||
difficulte: - gravite,
|
||||
localisation: localisation
|
||||
}
|
||||
}
|
||||
|
||||
const blessures = await actor.createEmbeddedDocuments('Item', [blessure])
|
||||
return blessures[0]
|
||||
}
|
||||
|
||||
static async createTacheSoinBlessure(actor, gravite) {
|
||||
const tache = RdDItemBlessure.prepareTacheSoin(gravite)
|
||||
@ -51,6 +78,54 @@ export class RdDItemBlessure extends RdDItem {
|
||||
}
|
||||
}
|
||||
|
||||
async setSoinsBlessure(systemUpdate = {}) {
|
||||
systemUpdate = mergeObject(systemUpdate, this.system, { overwrite: false }),
|
||||
systemUpdate.soinscomplets.done = systemUpdate.premierssoins.done && systemUpdate.soinscomplets.done
|
||||
await this.update({
|
||||
img: this.getImgSoins(systemUpdate.gravite, systemUpdate.soinscomplets.done),
|
||||
system: systemUpdate
|
||||
});
|
||||
}
|
||||
|
||||
async recuperationBlessure({ actor, timestamp, message, isMaladeEmpoisonne, blessures }) {
|
||||
if (this.parent != actor || actor == undefined) {
|
||||
return;
|
||||
}
|
||||
if (new RdDTimestamp(this.system.fin).isAfterIndexDate(timestamp)) {
|
||||
// attente periode
|
||||
return
|
||||
}
|
||||
if (this.system.gravite > 0) {
|
||||
const update = { premierssoins: { bonus: 0 }, soinscomplets: { bonus: 0 } }
|
||||
const gravite = this.system.gravite;
|
||||
const graviteMoindre = gravite - 2;
|
||||
const moindres = blessures.filter(it => it.system.gravite == graviteMoindre, 'blessures').length
|
||||
const labelGravite = RdDItemBlessure.getLabelGravite(gravite);
|
||||
|
||||
let rolled = await actor.jetRecuperationConstitution(Misc.toInt(this.system.soinscomplets.bonus) + actor.system.sante.bonusPotion, message);
|
||||
|
||||
if (rolled.isETotal) {
|
||||
message.content += ` -- une blessure ${labelGravite} s'infecte (temps de guérison augmenté de ${definition.facteur} jours, perte de vie)`;
|
||||
mergeObject(update, { fin: { indexDate: timestamp.addJours(gravite).indexDate } });
|
||||
await actor.santeIncDec("vie", -1);
|
||||
}
|
||||
else {
|
||||
if (!isMaladeEmpoisonne && rolled.isSuccess && this.peutRetrograder(graviteMoindre, moindres)) {
|
||||
message.content += ` -- une blessure ${labelGravite} cicatrise`;
|
||||
mergeObject(update, { gravite: graviteMoindre, fin: { indexDate: timestamp.addJours(graviteMoindre).indexDate } });
|
||||
}
|
||||
else {
|
||||
message.content += ` -- une blessure ${labelGravite} reste stable`;
|
||||
}
|
||||
}
|
||||
await this.update(update);
|
||||
}
|
||||
}
|
||||
|
||||
peutRetrograder(graviteMoindre, moindres) {
|
||||
return moindres < RdDItemBlessure.getDefinition(graviteMoindre).max
|
||||
}
|
||||
|
||||
async calculerFinPeriodeTemporel(debut) {
|
||||
return await debut.nouveauJour().addJours(this.system.gravite);
|
||||
}
|
||||
@ -61,34 +136,42 @@ export class RdDItemBlessure extends RdDItem {
|
||||
}
|
||||
}
|
||||
|
||||
prepareDerivedData() {
|
||||
super.prepareDerivedData();
|
||||
this.system.labelGravite = this.getLabelGravite()
|
||||
getImgSoins(gravite, soins) {
|
||||
let img = 'blessure'
|
||||
if (gravite > 6) {
|
||||
img = 'mort'
|
||||
}
|
||||
|
||||
async setSoinsBlessure(systemUpdate = {}) {
|
||||
systemUpdate = mergeObject(systemUpdate, this.system, { overwrite: false }),
|
||||
systemUpdate.soinscomplets.done = systemUpdate.premierssoins.done && systemUpdate.soinscomplets.done
|
||||
await this.update({
|
||||
img: this.getImgSoins(systemUpdate.soinscomplets.done),
|
||||
system: systemUpdate
|
||||
});
|
||||
if (gravite <= 0) {
|
||||
img = 'eraflure'
|
||||
}
|
||||
|
||||
getImgSoins(soins) {
|
||||
return `systems/foundryvtt-reve-de-dragon/icons/sante/${soins ? 'blessure-soins' : 'blessure'}.webp`
|
||||
return `systems/foundryvtt-reve-de-dragon/icons/sante/${soins ? 'blessure-soins' : img}.webp`
|
||||
}
|
||||
|
||||
getLabelGravite() {
|
||||
if (this.system.gravite >= 6) {
|
||||
return 'Critique'
|
||||
return RdDItemBlessure.getDefinition(this.system.gravite).labelGravite
|
||||
}
|
||||
if (this.system.gravite >= 4) {
|
||||
return 'Grave'
|
||||
|
||||
static getDefinition(gravite) {
|
||||
return definitionsBlessures.sort(Misc.ascending(it => it.gravite))
|
||||
.find(it => it.gravite >= gravite);
|
||||
}
|
||||
if (this.system.gravite >= 2) {
|
||||
return 'Légère'
|
||||
static maxBlessures(gravite) {
|
||||
return RdDItemBlessure.getDefinition(gravite).max
|
||||
}
|
||||
return 'Contusion/éraflure'
|
||||
|
||||
isContusion() {
|
||||
return this.system.gravite <= 0
|
||||
}
|
||||
isLegere() {
|
||||
return this.system.gravite > 0 && this.system.gravite <= 2
|
||||
}
|
||||
isGrave() {
|
||||
return this.system.gravite > 2 && this.system.gravite <= 4
|
||||
}
|
||||
isCritique() {
|
||||
return this.system.gravite > 4 && this.system.gravite <= 6
|
||||
}
|
||||
isMort() {
|
||||
return this.system.gravite > 6
|
||||
}
|
||||
}
|
@ -28,7 +28,7 @@ export class RdDBonus {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static dmg(rollData, dmgActor, isCauchemar = false) {
|
||||
static dmg(rollData, dmgActor, isEntiteIncarnee = false) {
|
||||
let dmg = { total: 0 };
|
||||
if (rollData.arme && rollData.arme.name.toLowerCase() == "esquive") {
|
||||
// Specific case management
|
||||
@ -41,7 +41,7 @@ export class RdDBonus {
|
||||
dmg.dmgSurprise = RdDBonus.dmgBonus(rollData.ajustements?.attaqueDefenseurSurpris.used);
|
||||
dmg.dmgActor = rollData.selectedCarac ? RdDBonus._dmgPerso(dmgActor, rollData.selectedCarac.label, dmg.dmgArme) : 0;
|
||||
dmg.total = dmg.dmgSurprise + dmg.dmgTactique + dmg.dmgArme + dmg.dmgActor + dmg.dmgParticuliere;
|
||||
dmg.mortalite = RdDBonus._calculMortalite(rollData, isCauchemar)
|
||||
dmg.mortalite = RdDBonus._calculMortalite(rollData, isEntiteIncarnee)
|
||||
}
|
||||
return dmg;
|
||||
}
|
||||
@ -62,11 +62,8 @@ export class RdDBonus {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static _calculMortalite(rollData, isCauchemar) {
|
||||
if (isCauchemar) {
|
||||
return "cauchemar";
|
||||
}
|
||||
return isCauchemar ? "cauchemar"
|
||||
static _calculMortalite(rollData, isEntiteIncarnee) {
|
||||
return isEntiteIncarnee ? "entiteincarnee"
|
||||
: rollData.dmg?.mortalite
|
||||
?? rollData.arme?.system.mortalite
|
||||
?? "mortel";
|
||||
|
@ -1295,13 +1295,8 @@ export class RdDCombat {
|
||||
blessuresStatus: actor.computeResumeBlessure(),
|
||||
SConst: actor.getSConst(),
|
||||
actorId: actor.id,
|
||||
isGrave: false,
|
||||
isCritique: false
|
||||
}
|
||||
if (actor.countBlessuresNonSoigneeByName("critiques") > 0) { // Pour éviter le cumul grave + critique
|
||||
formData.isCritique = true;
|
||||
} else if (actor.countBlessuresNonSoigneeByName("graves") > 0) {
|
||||
formData.isGrave = true;
|
||||
isGrave: actor.countBlessures(it => it.isGraves()) > 0,
|
||||
isCritique: actor.countBlessures(it => it.isCritique()) > 0
|
||||
}
|
||||
|
||||
ChatUtility.createChatWithRollMode(actor.name, {
|
||||
|
@ -30,9 +30,9 @@ export class RdDEncaisser extends Dialog {
|
||||
};
|
||||
}
|
||||
else if (actor.isEntite([ENTITE_BLURETTE, ENTITE_INCARNE])) {
|
||||
dialogConf.default = "cauchemar"
|
||||
dialogConf.default = "entiteincarnee"
|
||||
dialogConf.buttons = {
|
||||
"cauchemar": { label: "Cauchemar", callback: html => this.performEncaisser("cauchemar") }
|
||||
"entiteincarnee": { label: "Entité incarnée", callback: html => this.performEncaisser("entiteincarnee") }
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,7 +70,6 @@ export class RdDEncaisser extends Dialog {
|
||||
total: Number(this.modifier),
|
||||
ajustement: Number(this.modifier),
|
||||
encaisserSpecial: this.encaisserSpecial,
|
||||
loc: { result: 0, label: "" },
|
||||
mortalite: mortalite
|
||||
}
|
||||
});
|
||||
|
@ -88,10 +88,7 @@ export class RdDTokenHud {
|
||||
static async addExtensionHudSoins(html, sourceActor) {
|
||||
const target = Targets.getTarget({ warn: false });
|
||||
if (target?.actor) {
|
||||
const hudSoins = {
|
||||
targetActor: target.actor,
|
||||
blessures: target.actor.blessuresASoigner() ?? []
|
||||
};
|
||||
const hudSoins = { blessures: target.actor.blessuresASoigner() ?? [] };
|
||||
if (hudSoins.blessures.length > 0) {
|
||||
// soins
|
||||
const controlIconTarget = html.find('.control-icon[data-action=combat]');
|
||||
|
@ -66,38 +66,31 @@ const fatigueMarche = {
|
||||
"tresdifficile": { "4": 4, "6": 6 }
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
const definitionsBlessures = [
|
||||
{ type: "legere", facteur: 2 },
|
||||
{ type: "grave", facteur: 4 },
|
||||
{ type: "critique", facteur: 6 }
|
||||
]
|
||||
|
||||
/* -------------------------------------------- */
|
||||
const nomEthylisme = ["Emeché", "Gris", "Pinté", "Pas frais", "Ivre", "Bu", "Complètement fait", "Ivre mort"];
|
||||
|
||||
/* -------------------------------------------- */
|
||||
const definitionsEncaissement = {
|
||||
"mortel": [
|
||||
{ minimum: undefined, maximum: 0, endurance: "0", vie: "0", eraflures: 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", eraflures: 0, legeres: 1, graves: 0, 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", eraflures: 0, legeres: 0, graves: 0, critiques: 1 },
|
||||
{ minimum: undefined, maximum: 0, endurance: "0", vie: "0", gravite: -1},
|
||||
{ minimum: 1, maximum: 10, endurance: "1d4", vie: "0", gravite: 0},
|
||||
{ minimum: 11, maximum: 15, endurance: "1d6", vie: "0", gravite: 2},
|
||||
{ minimum: 16, maximum: 19, endurance: "2d6", vie: "2", gravite: 4},
|
||||
{ minimum: 20, maximum: undefined, endurance: "100", vie: "4 + @over20", gravite: 6},
|
||||
],
|
||||
"non-mortel": [
|
||||
{ minimum: undefined, maximum: 0, endurance: "0", vie: "0", eraflures: 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", eraflures: 1, legeres: 0, 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: "0", eraflures: 0, legeres: 1, graves: 0, critiques: 0 },
|
||||
{ minimum: undefined, maximum: 0, endurance: "0", vie: "0", gravite: -1},
|
||||
{ minimum: 1, maximum: 10, endurance: "1d4", vie: "0", gravite: 0 },
|
||||
{ minimum: 11, maximum: 15, endurance: "1d6", vie: "0", gravite: 0 },
|
||||
{ minimum: 16, maximum: 19, endurance: "2d6", vie: "0", gravite: 2 },
|
||||
{ minimum: 20, maximum: undefined, endurance: "100", vie: "0", gravite: 2 },
|
||||
],
|
||||
"cauchemar": [
|
||||
{ minimum: undefined, maximum: 0, endurance: "0", vie: "0", eraflures: 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", eraflures: 1, 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", eraflures: 1, legeres: 0, graves: 0, critiques: 0 },
|
||||
"entiteincarnee": [
|
||||
{ minimum: undefined, maximum: 0, endurance: "0", vie: "0", gravite: -1},
|
||||
{ minimum: 1, maximum: 10, endurance: "1d4", vie: "0", gravite: 0},
|
||||
{ minimum: 11, maximum: 15, endurance: "1d6", vie: "0", gravite: 0 },
|
||||
{ minimum: 16, maximum: 19, endurance: "2d6", vie: "0", gravite: 0 },
|
||||
{ minimum: 20, maximum: undefined, endurance: "3d6 + @over20", vie: "0", gravite: 0 },
|
||||
]
|
||||
};
|
||||
|
||||
@ -139,7 +132,6 @@ export class RdDUtility {
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/xp-competences.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/combat.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/blessures.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/blessure.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/blessure.hbs',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/maladies-poisons.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/possessions.html',
|
||||
@ -474,10 +466,6 @@ export class RdDUtility {
|
||||
return ajustementsEncaissement;
|
||||
}
|
||||
|
||||
static getDefinitionsBlessures() {
|
||||
return definitionsBlessures;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getSegmentsFatigue(maxEnd) {
|
||||
maxEnd = Math.max(maxEnd, 1);
|
||||
@ -618,17 +606,10 @@ export class RdDUtility {
|
||||
encaissement.dmg.loc.label = encaissement.dmg.loc.label ?? 'Corps;';
|
||||
encaissement.roll = roll;
|
||||
encaissement.armure = armure;
|
||||
encaissement.penetration = rollData.arme?.system.penetration ?? 0;
|
||||
encaissement.total = jetTotal;
|
||||
encaissement.vie = await RdDUtility._evaluatePerte(encaissement.vie, over20);
|
||||
encaissement.endurance = await RdDUtility._evaluatePerte(encaissement.endurance, over20);
|
||||
encaissement.penetration = rollData.arme?.system.penetration ?? 0;
|
||||
encaissement.blessures = (
|
||||
encaissement.critiques > 0 ? "Critique" :
|
||||
encaissement.graves > 0 ? "Grave" :
|
||||
encaissement.legeres > 0 ? "Légère" :
|
||||
encaissement.eraflures > 0 ? "Contusions/Eraflures" :
|
||||
'Aucune'
|
||||
);
|
||||
return encaissement;
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@ i:is(.fas, .far) {
|
||||
}
|
||||
|
||||
.system-foundryvtt-reve-de-dragon .sheet-header :is(.header-compteurs,.header-etats,.profile-img, .profile-img-token){
|
||||
padding: 0 3%;
|
||||
padding: 0 0.4rem;
|
||||
}
|
||||
|
||||
.system-foundryvtt-reve-de-dragon .sheet-header :is(.profile-img, .profile-img-token) {
|
||||
@ -213,11 +213,13 @@ i:is(.fas, .far) {
|
||||
}
|
||||
|
||||
.system-foundryvtt-reve-de-dragon .sheet-header .header-compteurs {
|
||||
width: calc(60% - 110px - 1rem);
|
||||
text-align: right;
|
||||
max-width: fit-content;
|
||||
}
|
||||
|
||||
.system-foundryvtt-reve-de-dragon .sheet-header div.header-etats {
|
||||
width: calc(40% - 32px - 1rem);
|
||||
height: 48px;
|
||||
max-width: fit-content;
|
||||
flex: initial;
|
||||
|
@ -179,7 +179,8 @@
|
||||
"value": 10,
|
||||
"label": "Endurance",
|
||||
"derivee": false
|
||||
}
|
||||
},
|
||||
"bonusPotion": 0
|
||||
},
|
||||
"attributs": {
|
||||
"plusdom": {
|
||||
@ -364,7 +365,8 @@
|
||||
"value": 0,
|
||||
"label": "Fatigue",
|
||||
"derivee": true
|
||||
}
|
||||
},
|
||||
"bonusPotion": 0
|
||||
},
|
||||
"attributs": {
|
||||
"sconst": {
|
||||
|
@ -2,15 +2,18 @@
|
||||
<span class="blessure-control">
|
||||
<img class="sheet-competence-img" src="{{img}}" />
|
||||
<i class="fas fa-skull-crossbones"></i>
|
||||
{{system.labelGravite}} ({{system.localisation}})
|
||||
{{system.labelGravite}}
|
||||
</span>
|
||||
{{#if (gt system.gravite 6)}}
|
||||
<span class="flexrow"></span>
|
||||
<span class="flexrow"></span>
|
||||
{{else}}
|
||||
<span class="flexrow">
|
||||
<input type="checkbox" class="blessure-premierssoins-done" name="blessure.{{id}}.premierssoins.done" {{#if system.premierssoins.done}}checked{{/if}}/>
|
||||
{{#if system.premierssoins.done}}
|
||||
<input type="text" class="blessure-premierssoins-bonus number-x2" name="blessure.{{id}}.premierssoins.bonus" data-dtype="number" value="{{system.premierssoins.bonus}}"/>
|
||||
{{else}}
|
||||
<label>{{system.premierssoins.tache}} / {{system.gravite}}</label>
|
||||
|
||||
{{/if}}
|
||||
</span>
|
||||
<span class="flexrow">
|
||||
@ -23,6 +26,10 @@
|
||||
<label>Difficulté {{system.difficulte}}</label>
|
||||
{{/if}}
|
||||
</span>
|
||||
{{/if}}
|
||||
<span>
|
||||
{{system.localisation}}
|
||||
</span>
|
||||
<span class="item-controls">
|
||||
<a class="item-edit" title="Editer"><i class="fas fa-edit"></i></a>
|
||||
<a class="item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
|
||||
|
@ -1,27 +0,0 @@
|
||||
<li class="item flexrow list-item {{#if blessure.active}}blessure-active-{{gravite}}{{else}}blessure-inactive{{/if}}"
|
||||
data-blessure-type="{{gravite}}"
|
||||
data-attribute={{key}}
|
||||
data-blessure-index="{{key}}"
|
||||
data-blessure-active="{{blessure.active}}">
|
||||
<span class="blessure-control" title="Blessure {{title}}">
|
||||
<i class="fas fa-skull-crossbones" name="blessure-{{gravite}}-{{key}}-active"></i>
|
||||
{{title}}
|
||||
</span>
|
||||
{{#if blessure.active}}
|
||||
<span class="blessure-soins flexrow">
|
||||
<input class="blessure-psdone" name="blessure-{{gravite}}-{{key}}-psdone" type="checkbox" name="blessure.psdone" {{#if blessure.psdone}}checked{{/if}}/>
|
||||
<input class="blessure-premiers_soins" type="text" name="blessure-{{gravite}}-{{key}}-premiers_soins" data-dtype="number" value="{{blessure.premiers_soins}}"/>
|
||||
</span>
|
||||
<span class="blessure-soins flexrow">
|
||||
<input class="blessure-scdone" name="blessure-{{gravite}}-{{key}}-scdone" type="checkbox" name="blessure.scdone" {{#if blessure.scdone}}checked{{/if}}/>
|
||||
<input class="blessure-soins_complets" type="text" name="blessure-{{gravite}}-{{key}}-soins_complets" data-dtype="number" value="{{blessure.soins_complets}}"/>
|
||||
</span>
|
||||
<input class="blessure-jours" type="text" name="blessure-{{gravite}}-{{key}}-jours" name="jours" data-dtype="number" value="{{blessure.jours}}"/>
|
||||
<input class="blessure-localisation" type="text" name="blessure-{{gravite}}-{{key}}-localisation" data-dtype="String" value="{{blessure.loc}}"/>
|
||||
{{else}}
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
{{/if}}
|
||||
</li>
|
@ -3,6 +3,7 @@
|
||||
<span>Blessures</span>
|
||||
<span>Premiers soins</span>
|
||||
<span>Soins complets</span>
|
||||
<span>Loc.</span>
|
||||
<span>Actions</span>
|
||||
</li>
|
||||
{{#each blessures as |blessure|}}
|
||||
|
@ -1,4 +1,4 @@
|
||||
<span>
|
||||
<div>
|
||||
{{#if effects}}
|
||||
{{#each effects as |effect key|}}
|
||||
<span class="active-effect" data-effect="{{effect.flags.core.statusId}}">
|
||||
@ -9,4 +9,4 @@
|
||||
{{else}}
|
||||
Aucun effet actif
|
||||
{{/if}}
|
||||
</span>
|
||||
</div>
|
||||
|
@ -1,8 +1,8 @@
|
||||
<div class="flex-group-left header-etats">
|
||||
<div class="flexcol">
|
||||
<span>{{system.compteurs.etat.label}}: {{system.compteurs.etat.value}}</span>
|
||||
<span>Sur-encombrement: {{calc.surenc}}</span>
|
||||
<span>{{calc.resumeBlessures}}</span>
|
||||
<div>{{system.compteurs.etat.label}}: {{system.compteurs.etat.value}}</div>
|
||||
<div>Sur-encombrement: {{calc.surenc}}</div>
|
||||
<div>{{calc.resumeBlessures}}</div>
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/header-effects.html"}}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,4 +1,5 @@
|
||||
{{#if isGM}}
|
||||
{{log this}}
|
||||
<span>
|
||||
{{#if (gt endurance 0)}}
|
||||
De plus, {{alias}} a perdu {{endurance}} points d'endurance
|
||||
@ -11,7 +12,7 @@
|
||||
<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)
|
||||
{{~else if (eq dmg.mortalite 'entiteincarnee')}}(entité incarnée)
|
||||
{{~/if}}
|
||||
</span>
|
||||
</h4>
|
||||
@ -22,15 +23,16 @@
|
||||
{{~/unless}}, total: <span class="rdd-roll-echec">{{total}}</span>
|
||||
<br>
|
||||
{{alias}}
|
||||
{{#if (eq dmg.mortalite 'cauchemar')}}subit le coup
|
||||
{{else if eraflures}}subit une contusion
|
||||
{{else if legeres}}subit une blessure légère
|
||||
{{else if graves}}subit une blessure grave
|
||||
{{else if critiques}}subit une blessure critique
|
||||
{{#if (eq dmg.mortalite 'entiteincarnee')}}subit le coup
|
||||
{{else if mort}}vient de mourir
|
||||
{{else if blessure}}
|
||||
{{#if (gt blessure.system.gravite 0)}}subit une blessure {{blessure.system.labelGravite}}
|
||||
{{else}}subit une contusion
|
||||
{{~/if~}}
|
||||
{{else}}s'en sort sans une égratignure
|
||||
{{~/if~}}
|
||||
{{~#unless (eq dmg.mortalite 'cauchemar')}}
|
||||
|
||||
{{~#unless (eq dmg.mortalite 'entiteincarnee')}}
|
||||
{{#if dmg.loc.label}}
|
||||
{{#if (gt roll.total 0)}}({{dmg.loc.label}}){{/if}}
|
||||
{{/if}}
|
||||
@ -39,7 +41,7 @@
|
||||
{{~#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 (ne dmg.mortalite 'cauchemar')}}
|
||||
{{#if (ne dmg.mortalite 'entiteincarnee')}}
|
||||
{{#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}}!
|
||||
{{#if hasPlayerOwner}}Jet d'endurance : Jet d'endurance : {{jetEndurance}} / {{resteEndurance}}{{/if}}
|
||||
|
@ -9,19 +9,19 @@
|
||||
<option value="2">Légère</option>
|
||||
<option value="4">Grave</option>
|
||||
<option value="6">Critique</option>
|
||||
<option value="8">Mort</option>
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="system.difficulte">Difficulté des soins</label>
|
||||
<input class="attribute-value number-x" type="text" name="system.difficulte" value="{{system.difficulte}}" data-dtype="Number"/>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="system.localisation">Localisation</label>
|
||||
<input class="attribute-value" type="text" name="system.localisation" value="{{system.localisation}}" data-dtype="String"/>
|
||||
</div>
|
||||
{{#if (lt system.gravite 7)}}
|
||||
<div class="form-group">
|
||||
<label for="system.difficulte">Difficulté des soins</label>
|
||||
<input class="attribute-value number-x" type="text" name="system.difficulte" value="{{system.difficulte}}" data-dtype="Number"/>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="premierssoins-done">Premiers soins
|
||||
@ -46,6 +46,7 @@
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{#if options.isOwned}}
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/item/temporel.hbs" this labeldebut="Obtenue" labelfin="Prochain jet"}}
|
||||
|
Loading…
Reference in New Issue
Block a user