From 3e189cbe5f03690cafc38bf03b247c8cfad23db4 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Tue, 14 Mar 2023 02:38:21 +0100 Subject: [PATCH] Ajout des blessures sur encaissement --- icons/sante/blessure-mort.webp | Bin 0 -> 5190 bytes icons/sante/eraflure.webp | Bin 0 -> 4936 bytes icons/sante/mort.webp | Bin 0 -> 7766 bytes module/actor-sheet.js | 31 +- module/actor.js | 370 +++++++--------------- module/item/blessure.js | 143 +++++++-- module/rdd-bonus.js | 11 +- module/rdd-combat.js | 9 +- module/rdd-roll-encaisser.js | 5 +- module/rdd-token-hud.js | 5 +- module/rdd-utility.js | 55 ++-- styles/simple.css | 4 +- template.json | 6 +- templates/actor/blessure.hbs | 11 +- templates/actor/blessure.html | 27 -- templates/actor/blessures.html | 1 + templates/actor/header-effects.html | 4 +- templates/actor/header-etat.html | 6 +- templates/chat-resultat-encaissement.html | 18 +- templates/item-blessure-sheet.html | 15 +- 20 files changed, 304 insertions(+), 417 deletions(-) create mode 100644 icons/sante/blessure-mort.webp create mode 100644 icons/sante/eraflure.webp create mode 100644 icons/sante/mort.webp delete mode 100644 templates/actor/blessure.html diff --git a/icons/sante/blessure-mort.webp b/icons/sante/blessure-mort.webp new file mode 100644 index 0000000000000000000000000000000000000000..21294caf2e1bb163e4330e1e5549dc86a834a29f GIT binary patch literal 5190 zcmZ{obzD@>`p0Jp>0VNhmJlhIX6bGb36YjkSQeHJK|xwVkd{=7Hm4}c5E06pLW(l&M|r0xSXqrcw&JN=#p zkiVA6yMM>}-#-7ZO7g@WWd{I+5bGglhxG8ovIdrQd_0kVIT_1PJ13hbST4r0fCu&l zu{`xxxBWM7{$xlMw*SR;P9CmUpT9xja&_^--owAr-xPzK^a1V~{^ac~!i0zqsG{6GEwj?E18fE%{29kxUQ zKi~nJfg^ANoF<^cfaD2QPxz0-1p7yzF;|D)Na0#F|T0K+WO z#>3`c*TKb>I1UZ~92NmUW(EMw7y!iP|Be~f_SX&yW&k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w%!~rk9`+}FoZ@}!reJ|wL}arq7E}QcQLT2G~8uV{7{Ty9 zot3PvGqfSzvM(b)n}sv$5XTaa*I2w$D0?A{_AXWnIqWZEHM*gXOM;`A%7%xM97p1m zspK3AeV01zD7Lq#?b5B;#KGzs6tA^LkV7%Jvh|X31(HxQ9CEh+ED+EKFJ7^ ztm&fbSBKn;RwHmx-gs0e&4zp0-QSoE_f-(XA3!k8p)K>>d|FY2%UM9HHa%NclreMr zD;v+uUFB9prTz7n7n~QLEIU;iIX~&fqmOoW|OWY=~Qme zu2fIst%_%Tz%VMG_u0p4G^Iox)M*&M#*brC_)#c9wdp;78G@kY*zYt4l3}9xdPkGd zLB4V{(wm<1GD*9yFC)*PpAF82t5r8Y_XRn6N^?@JXG(C%1(+?z(x*+dsH~Gq!fsik zjd|^d-W`sQ9d4^%5gPda;~><~3n3npzRJ|57guEgL-ni8Ud$W~sg2C6Y@7WlW7}|$zx_yMIg9Seh;jF3#k`o~OaDpAPVbjH zc3Fz&J$d+@ny){N3(jLM`Kf0gE0UHkooU5t9*=x`(b<`CzU{KB%;g|2MA#A0L;uk< r$&TIT7=A8Af_Da$hK2OGhy^vafR@WM^V8c&{2aGNF#*`0Z{Ys`idZ1x literal 0 HcmV?d00001 diff --git a/icons/sante/eraflure.webp b/icons/sante/eraflure.webp new file mode 100644 index 0000000000000000000000000000000000000000..fc3b4a10258478daa9fd868853a854381039ae7c GIT binary patch literal 4936 zcmZ{kXIN9q7KS&WcQEu`6{NS&i-Z=MbP$ymN`L^NOEXc3NKsG_=|!pp=?ExDF9Onp zgGd*oDIi5aT5dS!$GJc5oxNwxJKtJs_RN~+*%mN8JuNT**y?JV*_bKWQ2_uTP3U-{ z%NGWPnpuGeQvhUzg!=@N5L`aKK>-%}+I)7m?D@#o0Ahd^UN5I& zx5K{xqD#+biOaSAcg+7)sa@Ry;Q&BHL5R?RqXL2mY(QY+&>++$rxKV6j&OD*a2bKc z0|*-=@WiF=@(-_Hvd2GscF6%&7Er?37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Zj z)s8y(x@S{c74~*iyT@4l32(WbtY3dZ`VXL;2b8xBxx=Fm#df%h+*>U^X#a+7n-0ne z+D%RLI>k141|v-ml}6S6C51zJTUoFHJL%) zQqfe2x0XSoCntGLM^x3bZ7fmn#X zcSp|baRgbCJ2+DS24P-cjc~lbZnafwkZp96t*UGOnvQWX?PNpx+av{dHYf!U1sk7z zS^oifahFSuu4)<+wYVQU6I*#Mw9%y73nzK_?M0}_hD&ni-D8Ky5qvQ9CqvQxxWEM!gQNIZM2NJ@iJOBUy literal 0 HcmV?d00001 diff --git a/icons/sante/mort.webp b/icons/sante/mort.webp new file mode 100644 index 0000000000000000000000000000000000000000..7bbe06269fc32d5020d92b7b0ab6b9dcc7a3a80f GIT binary patch literal 7766 zcmZ{oby!rvyT=dR-JnRTbfUEHbQn7T3V;Vt08D_Wg{2!rO-DiZpZEWrE`I??|18rS z|Hk^ieg0n+$I9Bx5&)1epFAWiA+GLEtn|dHUha^8obbe?mUb3aPh9fE?5oVRCfvczTEbPXA_tYwe_` z^HeiDN%eRd-TJAvdD5+)E(gHpU;Ll?J*EG|)y;;F_rE11Tp0jBTX}pu zV+H_>cmTMMeSEyjeSEyn0|1mI0O)f1Pk-ke01&=-(qsRlF=Yb)K?nde_WVZ!B?CZH zC;(6{KrCD>{`)y7PbIRA4FH@L0|4GT03ewJ0Bqy`iP@9wpB>1b0|4DmPfIlh0I6vJ z!1Clz@LpO~Q)wINX@v;5ABl)$JR1%i;fQK%u64Xvo{!wrDdiQP&jobRF{k1zL;OYk z*BQH#h<`p}+FB1|i2S{g+Ly*FJW)~L zE|HGYt4fUx!Wtp$Q{~TytCf3A@|I{+E7m3TSqhZ~7LQi)2zsRmW+~Fz`}!G{7i_az zo4rQ-CT}*~)}-qohno0Yz4VcgI3Y;(y3<;%JD--ZOXCAW8dgJbn_OhMzCU*seePcq?ss6ak5$HtfJv9{{@ACB+{Yg8-lqXS~sH2s1)lmC-@NB zN{$Q`Wc!lOXAmULZVx+-{F}~uhh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zq0@;@4{-MFW072pC_t$^9=Xq^v>3rgrx#a&zqz%K+j{oki=X9$#A&Af`FxCpUmn-+ zeSMShauJr>`QB-1HOY8izRV)&Onh_QbDmTGI7=x=wab+5+c3=)793jkIoZSzcPS=q z=JF6KzRmEe8O*d?#M8D#{uF1bau#HP{%ji;WIE~ zGMf8H=r5Hz0v)$Nhr2ZdVB;U6J0}wEm#t*Qt8{mLr)3jA088N6@7>bc^n6YqYH!r6 zea8_x&aSU0QrwjEmGQWtbSp@zD|=zuKaq~d?=4PS@Sz-UG{0v)ldD&?-mN*WQ4CeS zEDlu7-`lvtj;)%p0%y0bIILn}Bh0*Pw(DZMb z{4iQ5b$}7-gnG)!vdhhJ*9|6seNX_C+{TLSO1T%`eH@_Jiy&p4TZ}SaNqTkekhWSo WjCrhd>+U>1Jh>yU>#Rx$0RIIUyFU2< literal 0 HcmV?d00001 diff --git a/module/actor-sheet.js b/module/actor-sheet.js index e0101c55..5e33065a 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -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 } }); diff --git a/module/actor.js b/module/actor.js index 6dc88e88..f51ae2aa 100644 --- a/module/actor.js +++ b/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 blessures = this.filterItems(it => it.system.gravite > 0, 'blessure'); + if (blessures.length > 0) { + return + } 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 rolled = await this._jetRecuperationConstitution(bonusSoins, message) + 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,17 +590,13 @@ 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 }; - } + } + 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,35 +1110,31 @@ 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') - let resume = "Blessures:"; - if (nbCritiques > 0 || nbGraves > 0 || nbLegeres > 0) { - if (nbLegeres > 0) { - resume += " " + nbLegeres + " légère" + (nbLegeres > 1 ? "s" : ""); - } - if (nbGraves > 0) { - if (nbLegeres > 0) - resume += ","; - resume += " " + nbGraves + " grave" + (nbGraves > 1 ? "s" : ""); - } - if (nbCritiques > 0) { - if (nbGraves > 0 || nbLegeres > 0) - resume += ","; - resume += " une CRITIQUE !"; - } - return resume; - } - else { + 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 (nbLegeres > 0) { + resume += " " + nbLegeres + " légère" + (nbLegeres > 1 ? "s" : ""); + } + if (nbGraves > 0) { + if (nbLegeres > 0) + resume += ","; + resume += " " + nbGraves + " grave" + (nbGraves > 1 ? "s" : ""); + } + if (nbCritiques > 0) { + if (nbGraves > 0 || nbLegeres > 0) + resume += ","; + resume += " une CRITIQUE !"; + } + return resume; } recompute() { @@ -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) { @@ -3155,8 +3076,8 @@ export class RdDActor extends RdDBaseActor { tache: Math.max(0, tache.system.points_de_tache_courant) } }) - if (bonus>=0) { - await tache.delete() + if (bonus >= 0) { + 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; - } + const blessure = await RdDItemBlessure.createBlessure(this, encaissement.gravite, encaissement.dmg.loc.label); + if (blessure.isCritique()) { + encaissement.endurance = endActuelle; } - 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; - encaissement.endurance = endActuelle; - encaissement.vie = 4; - break; - } + if (blessure.isMort()) { + this.setEffect(STATUSES.StatusComma, true); + encaissement.mort = true; + ChatMessage.create({ + content: `charge + ${this.name} vient de succomber à une seconde blessure critique ! Que les Dragons gardent son Archétype en paix !` + }); } - - 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 - this.setEffect(STATUSES.StatusComma, true); - ChatMessage.create({ - content: `charge - ${this.name} vient de succomber à une seconde blessure critique ! Que les Dragons gardent son Archétype en paix !` - }); - 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)"); - } + 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); } - await this.update({ "system.blessures": blessures }); - - let pvManquants = myData.sante.vie.max - myData.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; diff --git a/module/item/blessure.js b/module/item/blessure.js index 0c71df22..063b7885 100644 --- a/module/item/blessure.js +++ b/module/item/blessure.js @@ -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() - } - - 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 - }); - } - - getImgSoins(soins) { - return `systems/foundryvtt-reve-de-dragon/icons/sante/${soins ? 'blessure-soins' : 'blessure'}.webp` + getImgSoins(gravite, soins) { + let img = 'blessure' + if (gravite > 6) { + img = 'mort' + } + if (gravite <= 0) { + img = 'eraflure' + } + return `systems/foundryvtt-reve-de-dragon/icons/sante/${soins ? 'blessure-soins' : img}.webp` } getLabelGravite() { - if (this.system.gravite >= 6) { - return 'Critique' - } - if (this.system.gravite >= 4) { - return 'Grave' - } - if (this.system.gravite >= 2) { - return 'Légère' - } - return 'Contusion/éraflure' + return RdDItemBlessure.getDefinition(this.system.gravite).labelGravite } -} \ No newline at end of file + + static getDefinition(gravite) { + return definitionsBlessures.sort(Misc.ascending(it => it.gravite)) + .find(it => it.gravite >= gravite); + } + static maxBlessures(gravite) { + return RdDItemBlessure.getDefinition(gravite).max + } + + 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 + } +} diff --git a/module/rdd-bonus.js b/module/rdd-bonus.js index 25bbdb3e..2516b0ff 100644 --- a/module/rdd-bonus.js +++ b/module/rdd-bonus.js @@ -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"; diff --git a/module/rdd-combat.js b/module/rdd-combat.js index 904384d6..435be56d 100644 --- a/module/rdd-combat.js +++ b/module/rdd-combat.js @@ -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, { diff --git a/module/rdd-roll-encaisser.js b/module/rdd-roll-encaisser.js index 4d98e413..a9fc2d84 100644 --- a/module/rdd-roll-encaisser.js +++ b/module/rdd-roll-encaisser.js @@ -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 } }); diff --git a/module/rdd-token-hud.js b/module/rdd-token-hud.js index d96bb139..12dcaf4d 100644 --- a/module/rdd-token-hud.js +++ b/module/rdd-token-hud.js @@ -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]'); diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 235d46ad..55e968de 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -19,7 +19,7 @@ import { RdDRaretes } from "./item/raretes.js"; /* -------------------------------------------- */ // This table starts at 0 -> niveau -10 const carac_array = ["taille", "apparence", "constitution", "force", "agilite", "dexterite", "vue", "ouie", "odoratgout", "volonte", "intellect", "empathie", "reve", "chance", "melee", "tir", "lancer", "derobee"]; -const difficultesLibres = Misc.intArray(0, -11); +const difficultesLibres = Misc.intArray(0, -11); const ajustementsConditions = Misc.intArray(-10, 11); const ajustementsEncaissement = Misc.intArray(-10, 26); @@ -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; } diff --git a/styles/simple.css b/styles/simple.css index df341346..f5144534 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -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; diff --git a/template.json b/template.json index 4d1cfd28..a58c064c 100644 --- a/template.json +++ b/template.json @@ -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": { diff --git a/templates/actor/blessure.hbs b/templates/actor/blessure.hbs index 7fed6645..16d9bc12 100644 --- a/templates/actor/blessure.hbs +++ b/templates/actor/blessure.hbs @@ -2,15 +2,18 @@ - {{system.labelGravite}} ({{system.localisation}}) + {{system.labelGravite}} + {{#if (gt system.gravite 6)}} + + + {{else}} {{#if system.premierssoins.done}} {{else}} - {{/if}} @@ -23,6 +26,10 @@ {{/if}} + {{/if}} + + {{system.localisation}} + diff --git a/templates/actor/blessure.html b/templates/actor/blessure.html deleted file mode 100644 index fb5b863d..00000000 --- a/templates/actor/blessure.html +++ /dev/null @@ -1,27 +0,0 @@ -
  • - - - {{title}} - - {{#if blessure.active}} - - - - - - - - - - - {{else}} - - - - - {{/if}} -
  • diff --git a/templates/actor/blessures.html b/templates/actor/blessures.html index f5ce7fa2..0974c2a0 100644 --- a/templates/actor/blessures.html +++ b/templates/actor/blessures.html @@ -3,6 +3,7 @@ Blessures Premiers soins Soins complets + Loc. Actions {{#each blessures as |blessure|}} diff --git a/templates/actor/header-effects.html b/templates/actor/header-effects.html index 3a94f93e..a1d52317 100644 --- a/templates/actor/header-effects.html +++ b/templates/actor/header-effects.html @@ -1,4 +1,4 @@ - +
    {{#if effects}} {{#each effects as |effect key|}} @@ -9,4 +9,4 @@ {{else}} Aucun effet actif {{/if}} - +
    diff --git a/templates/actor/header-etat.html b/templates/actor/header-etat.html index a2e30510..8d928cf5 100644 --- a/templates/actor/header-etat.html +++ b/templates/actor/header-etat.html @@ -1,8 +1,8 @@
    - {{system.compteurs.etat.label}}: {{system.compteurs.etat.value}} - Sur-encombrement: {{calc.surenc}} - {{calc.resumeBlessures}} +
    {{system.compteurs.etat.label}}: {{system.compteurs.etat.value}}
    +
    Sur-encombrement: {{calc.surenc}}
    +
    {{calc.resumeBlessures}}
    {{>"systems/foundryvtt-reve-de-dragon/templates/actor/header-effects.html"}}
    diff --git a/templates/chat-resultat-encaissement.html b/templates/chat-resultat-encaissement.html index 04d3ccd6..1950bf63 100644 --- a/templates/chat-resultat-encaissement.html +++ b/templates/chat-resultat-encaissement.html @@ -1,4 +1,5 @@ {{#if isGM}} +{{log this}} {{#if (gt endurance 0)}} De plus, {{alias}} a perdu {{endurance}} points d'endurance @@ -11,7 +12,7 @@ {{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}} @@ -22,15 +23,16 @@ {{~/unless}}, total: {{total}}
    {{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)}}, {{vie}} points de vie{{/if}} {{/if}} - {{#if (ne dmg.mortalite 'cauchemar')}} + {{#if (ne dmg.mortalite 'entiteincarnee')}} {{#if (gt endurance 1)}}et {{#if sonne}}est sonnécharge jusqu'à la fin du prochain round{{else}}n'est pas sonné{{/if}}! {{#if hasPlayerOwner}}Jet d'endurance : Jet d'endurance : {{jetEndurance}} / {{resteEndurance}}{{/if}} diff --git a/templates/item-blessure-sheet.html b/templates/item-blessure-sheet.html index a476506e..83037f2b 100644 --- a/templates/item-blessure-sheet.html +++ b/templates/item-blessure-sheet.html @@ -9,19 +9,19 @@ + {{/select}} - -
    - - -
    -
    + {{#if (lt system.gravite 7)}} +
    + + +
    - + {{#if system.premierssoins.done}}
    {{/if}} + {{/if}} {{#if options.isOwned}} {{>"systems/foundryvtt-reve-de-dragon/templates/item/temporel.hbs" this labeldebut="Obtenue" labelfin="Prochain jet"}}