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') {
// Gestion blessure graves : -1 pt endurance
let nbGraves = this.countBlessuresByName("graves");
let nbGraves = this.countBlessuresNonSoigneeByName( 'graves');
if ( nbGraves > 0) {
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);
}
countBlessuresNonSoigneeByName(name) {
let blessures = Misc.templateData(this).blessures[name].liste;
return blessures.filter( b => b.active && b.premiers_soins < 0).length;
}
/* -------------------------------------------- */
async testSiSonne(endurance) {

View File

@ -221,16 +221,33 @@ export class RdDCalendrier extends Application {
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) {
this.calendrier.minutesRelative += minutes;
this.checkMaladie("round");
this.checkMaladie("minute");
if (this.calendrier.minutesRelative >= RDD_MINUTES_PAR_HEURES) {
this.calendrier.minutesRelative -= RDD_MINUTES_PAR_HEURES;
this.calendrier.heureRdD += 1;
}
this.checkMaladie("heure");
}
if (this.calendrier.heureRdD >= RDD_HEURES_PAR_JOUR) {
this.calendrier.heureRdD -= RDD_HEURES_PAR_JOUR;
await this.incrementerJour();
this.checkMaladie("heure");
this.checkMaladie("jour");
}
game.settings.set("foundryvtt-reve-de-dragon", "calendrier", duplicate(this.calendrier));
// Notification aux joueurs

View File

@ -1328,9 +1328,9 @@ export class RdDCombat {
isGrave: 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;
} else if (actor.countBlessuresByName("graves") > 0) {
} else if (actor.countBlessuresNonSoigneeByName("graves") > 0) {
data.isGrave = true;
}

View File

@ -378,6 +378,9 @@ export class RdDUtility {
formData.gemmes = this.checkNull(formData.itemsByType['gemme']);
formData.recettescuisine = this.checkNull(formData.itemsByType['recettecuisine']);
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)
.concat(formData.armes)
.concat(formData.armures)

View File

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

View File

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

View File

@ -293,6 +293,41 @@
<hr>
{{!-- Liste de blessures --}}
{{> "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>
{{!-- Connaissances Tab --}}

View File

@ -2,7 +2,7 @@
<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>
{{#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 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>