Meilleure gestion blessures graves vs endurance

This commit is contained in:
sladecraven 2021-10-29 20:58:57 +02:00
parent 909dd12cec
commit 21ad671ac7
8 changed files with 78 additions and 16 deletions

View File

@ -1541,10 +1541,9 @@ export class RdDActor extends Actor {
} }
if ( this.type == 'personnage') { if ( this.type == 'personnage') {
// Gestion blessure graves : -1 pt endurance // Gestion blessure graves : -1 pt endurance
let nbGraves = this.countBlessuresByName("graves"); let nbGraves = this.countBlessuresNonSoigneeByName( 'graves');
if ( nbGraves > 0) { if ( nbGraves > 0) {
await this.santeIncDec("endurance", -1 ); await this.santeIncDec("endurance", -1 );
ChatMessage.create({ content: `${this.name} a perdu 1 point d'Endurance à cause d'au moins une Blessure Grave` });
} }
} }
} }
@ -1583,6 +1582,10 @@ export class RdDActor extends Actor {
return this.countBlessures(Misc.templateData(this).blessures[name].liste); return this.countBlessures(Misc.templateData(this).blessures[name].liste);
} }
countBlessuresNonSoigneeByName(name) {
let blessures = Misc.templateData(this).blessures[name].liste;
return blessures.filter( b => b.active && b.premiers_soins < 0).length;
}
/* -------------------------------------------- */ /* -------------------------------------------- */
async testSiSonne(endurance) { async testSiSonne(endurance) {

View File

@ -221,16 +221,33 @@ export class RdDCalendrier extends Application {
this.updateDisplay(); this.updateDisplay();
} }
/* -------------------------------------------- */
checkMaladie( periode) {
for (let actor of game.actors) {
if (actor.type == 'personnage') {
let maladies = actor.filterItems( item => (item.type == 'maladie' || item.type == 'poison') && item.data.periodicite.toLowerCase().includes(periode) );
for (let maladie of maladies) {
ChatMessage.create({ content: `${actor.name} souffre de ${maladie.name} (${maladie.type}): vérifiez que les effets ne se sont pas aggravés !` });
}
}
}
}
/* -------------------------------------------- */ /* -------------------------------------------- */
async incrementTime(minutes = 0) { async incrementTime(minutes = 0) {
this.calendrier.minutesRelative += minutes; this.calendrier.minutesRelative += minutes;
this.checkMaladie("round");
this.checkMaladie("minute");
if (this.calendrier.minutesRelative >= RDD_MINUTES_PAR_HEURES) { if (this.calendrier.minutesRelative >= RDD_MINUTES_PAR_HEURES) {
this.calendrier.minutesRelative -= RDD_MINUTES_PAR_HEURES; this.calendrier.minutesRelative -= RDD_MINUTES_PAR_HEURES;
this.calendrier.heureRdD += 1; this.calendrier.heureRdD += 1;
this.checkMaladie("heure");
} }
if (this.calendrier.heureRdD >= RDD_HEURES_PAR_JOUR) { if (this.calendrier.heureRdD >= RDD_HEURES_PAR_JOUR) {
this.calendrier.heureRdD -= RDD_HEURES_PAR_JOUR; this.calendrier.heureRdD -= RDD_HEURES_PAR_JOUR;
await this.incrementerJour(); await this.incrementerJour();
this.checkMaladie("heure");
this.checkMaladie("jour");
} }
game.settings.set("foundryvtt-reve-de-dragon", "calendrier", duplicate(this.calendrier)); game.settings.set("foundryvtt-reve-de-dragon", "calendrier", duplicate(this.calendrier));
// Notification aux joueurs // Notification aux joueurs

View File

@ -1328,9 +1328,9 @@ export class RdDCombat {
isGrave: false, isGrave: false,
isCritique: false isCritique: false
} }
if (actor.countBlessuresByName("critiques") > 0) { // Pour éviter le cumul grave + critique if (actor.countBlessuresNonSoigneeByName("critiques") > 0) { // Pour éviter le cumul grave + critique
data.isCritique = true; data.isCritique = true;
} else if (actor.countBlessuresByName("graves") > 0) { } else if (actor.countBlessuresNonSoigneeByName("graves") > 0) {
data.isGrave = true; data.isGrave = true;
} }

View File

@ -378,6 +378,9 @@ export class RdDUtility {
formData.gemmes = this.checkNull(formData.itemsByType['gemme']); formData.gemmes = this.checkNull(formData.itemsByType['gemme']);
formData.recettescuisine = this.checkNull(formData.itemsByType['recettecuisine']); formData.recettescuisine = this.checkNull(formData.itemsByType['recettecuisine']);
formData.recettesAlchimiques = this.checkNull(formData.itemsByType['recettealchimique']); formData.recettesAlchimiques = this.checkNull(formData.itemsByType['recettealchimique']);
formData.maladies = this.checkNull(formData.itemsByType['maladie']);
formData.poisons = this.checkNull(formData.itemsByType['poison']);
formData.maladiesPoisons = formData.maladies.concat( formData.poisons);
formData.objets = formData.conteneurs.concat(formData.materiel) formData.objets = formData.conteneurs.concat(formData.materiel)
.concat(formData.armes) .concat(formData.armes)
.concat(formData.armures) .concat(formData.armures)

View File

@ -2,11 +2,11 @@
"name": "foundryvtt-reve-de-dragon", "name": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon", "title": "Rêve de Dragon",
"description": "Rêve de Dragon RPG for FoundryVTT", "description": "Rêve de Dragon RPG for FoundryVTT",
"version": "1.5.14", "version": "1.5.16",
"manifestPlusVersion": "1.0.0", "manifestPlusVersion": "1.0.0",
"minimumCoreVersion": "0.8.0", "minimumCoreVersion": "0.8.0",
"compatibleCoreVersion": "0.8.9", "compatibleCoreVersion": "0.8.9",
"templateVersion": 121, "templateVersion": 123,
"author": "LeRatierBretonnien", "author": "LeRatierBretonnien",
"authors": [ "authors": [
{ {

View File

@ -169,18 +169,18 @@
}, },
"blessures": { "blessures": {
"legeres": { "legeres": {
"liste": [ { "active": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "localisation": "" }, "liste": [ { "active": false, "premiers_soins": -1, "soins_complets": -1, "jours": 0, "localisation": "" },
{ "active": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "localisation": "" }, { "active": false, "premiers_soins": -1, "soins_complets": -1, "jours": 0, "localisation": "" },
{ "active": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "localisation": "" }, { "active": false, "premiers_soins": -1, "soins_complets": -1, "jours": 0, "localisation": "" },
{ "active": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "localisation": "" }, { "active": false, "premiers_soins": -1, "soins_complets": -1, "jours": 0, "localisation": "" },
{ "active": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "localisation": "" } ] { "active": false, "premiers_soins": -1, "soins_complets": -1, "jours": 0, "localisation": "" } ]
}, },
"graves": { "graves": {
"liste": [ { "active": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "localisation": "" }, "liste": [ { "active": false, "premiers_soins": -1, "soins_complets": -1, "jours": 0, "localisation": "" },
{ "active": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "localisation": "" } ] { "active": false, "premiers_soins": -1, "soins_complets": -1, "jours": 0, "localisation": "" } ]
}, },
"critiques": { "critiques": {
"liste": [ { "active": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "localisation": "" } ] "liste": [ { "active": false, "premiers_soins": -1, "soins_complets": -1, "jours": 0, "localisation": "" } ]
} }
}, },
"attributs": { "attributs": {
@ -878,16 +878,20 @@
"descriptionmj": "" "descriptionmj": ""
}, },
"maladie": { "maladie": {
"identifie": false,
"malignite": 0, "malignite": 0,
"periodicite": "", "periodicite": "",
"remedesconnus": false,
"remedes": "", "remedes": "",
"dommages":"", "dommages":"",
"description": "", "description": "",
"descriptionmj": "" "descriptionmj": ""
}, },
"poison": { "poison": {
"identifie": false,
"malignite": 0, "malignite": 0,
"periodicite": "", "periodicite": "",
"remedesconnus": false,
"remedes": "", "remedes": "",
"dommages":"", "dommages":"",
"description": "", "description": "",

View File

@ -293,6 +293,41 @@
<hr> <hr>
{{!-- Liste de blessures --}} {{!-- Liste de blessures --}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-liste-blessures-partial.html" this}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-liste-blessures-partial.html" this}}
{{!-- Maladies & Poison --}}
<h3 class="blessures-title">Maladies & Poisons:</h3>
<ul class="item-list alterne-list">
<li class="competence-header flexrow">
<span class="competence-title flex-grow competence-label">Nom</span>
<span class="competence-title competence-label">Type</span>
<span class="competence-title competence-value">Remèdes</span>
<span class="competence-title flex-grow competence-value">Edition</span>
</li>
{{#each maladiesPoisons as |maladie key|}}
<li class="item flexrow list-item" data-item-id="{{maladie._id}}">
<span class="competence-label">
{{#if maladie.data.identifie}}
{{maladie.name}}
{{else}}
Inconnue
{{/if}}
</span>
<span class="competence-label">{{maladie.type}}</span>
<span class="competence-label">
{{#if maladie.data.remedesconnus}}
{{maladie.data.remedes}}
{{else}}
Remèdes Inconnus
{{/if}}
</span>
<div class="item-controls">
<a class="item-control item-edit" title="Modifier"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
</div> </div>
{{!-- Connaissances Tab --}} {{!-- Connaissances Tab --}}

View File

@ -2,7 +2,7 @@
<div data-combatid="{{combatId}}" data-combatmessage="actor-turn-summary">{{blessuresStatus}}</div> <div data-combatid="{{combatId}}" data-combatmessage="actor-turn-summary">{{blessuresStatus}}</div>
<div>Son état général est de : {{etatGeneral}} {{#if isSonne}} et est <strong>sonné</strong>{{/if}}</div> <div>Son état général est de : {{etatGeneral}} {{#if isSonne}} et est <strong>sonné</strong>{{/if}}</div>
{{#if isGrave}} {{#if isGrave}}
<div>{{alias}} souffre de Blessure(s) Grave(s) : n'oubliez pas de faire un Jet de Vie toutes les SC ({{SConst}}) minutes, et de retirer 1 point d'endurance par blessure grave.</div> <div>{{alias}} souffre de Blessure(s) Grave(s) : n'oubliez pas de faire un Jet de Vie toutes les SC ({{SConst}}) minutes. Un point d'Endurance a été retiré automatiquement.</div>
{{/if}} {{/if}}
{{#if isCritique}} {{#if isCritique}}
<div>{{alias}} souffre d'une <strong>Blessure Critique</strong> : faites un <a id="chat-jet-vie" data-actorId="{{actorId}}">Jet de Vie.<a></div> <div>{{alias}} souffre d'une <strong>Blessure Critique</strong> : faites un <a id="chat-jet-vie" data-actorId="{{actorId}}">Jet de Vie.<a></div>