Gestion des maladies/poisons

This commit is contained in:
sladecraven 2021-10-29 21:31:58 +02:00
parent 21ad671ac7
commit 36be368dfd
6 changed files with 112 additions and 33 deletions

View File

@ -3382,6 +3382,8 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */
_setBlessure(blessure, encaissement) {
blessure.active = true;
blessure.premiers_soins = -1;
blessure.soins_complets = -1;
blessure.loc = encaissement.locName;
}

View File

@ -229,12 +229,13 @@ export class RdDItem extends Item {
ChatMessage.create(RdDUtility.chatDataSetup(html));
}
/* -------------------------------------------- */
getProprietes() {
return this[`_${Misc.data(this).type}ChatData`]();
}
/* -------------------------------------------- */
async postItem() {
async postItem( modeOverride ) {
console.log(this);
let chatData = duplicate(Misc.data(this));
const properties = this.getProprietes();
@ -317,7 +318,7 @@ export class RdDItem extends Item {
});
renderTemplate('systems/foundryvtt-reve-de-dragon/templates/post-item.html', chatData).then(html => {
let chatOptions = RdDUtility.chatDataSetup(html);
let chatOptions = RdDUtility.chatDataSetup(html, modeOverride);
ChatMessage.create(chatOptions)
});
}
@ -558,5 +559,43 @@ export class RdDItem extends Item {
]
return properties;
}
/* -------------------------------------------- */
_maladieChatData() {
const tplData = Misc.templateData(this);
let properties
if (tplData.identifie) {
properties = [
`<b>Malignité</b>: ${tplData.malignite}`,
`<b>Périodicité</b>: ${tplData.periodicite}`,
`<b>Dommages</b>: ${tplData.dommages}`
]
if (tplData.remedesconnus) {
properties.push(`<b>Remedes</b>: ${tplData.remedes}` )
}
} else {
properties = [
`<b>Inconnue</b>` ]
}
return properties;
}
/* -------------------------------------------- */
_poisonChatData() {
return this._maladieChatData();
}
/* -------------------------------------------- */
_gemmeChatData() {
const tplData = Misc.templateData(this);
let properties = [
`<b>Pureté</b>: ${tplData.purete}`,
`<b>Taille</b>: ${tplData.taille}`,
`<b>Inertie</b>: ${tplData.inertie}`,
`<b>Enchantabilité</b>: ${tplData.enchantabilite}`,
`<b>Prix</b>: ${tplData.cout}`,
]
return properties;
}
}

View File

@ -227,7 +227,13 @@ export class RdDCalendrier extends Application {
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 !` });
if ( maladie.data.identifie) {
ChatMessage.create({ content: `${actor.name} souffre de ${maladie.name} (${maladie.type}): vérifiez que les effets ne se sont pas aggravés !` });
} else {
ChatMessage.create({ content: `${actor.name} souffre d'un mal inconnu (${maladie.type}): vérifiez que les effets ne se sont pas aggravés !` });
}
let itemMaladie = actor.getObjet(maladie.id)
itemMaladie.postItem( 'gmroll');
}
}
}

View File

@ -2,7 +2,7 @@
"name": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon",
"description": "Rêve de Dragon RPG for FoundryVTT",
"version": "1.5.16",
"version": "1.5.17",
"manifestPlusVersion": "1.0.0",
"minimumCoreVersion": "0.8.0",
"compatibleCoreVersion": "0.8.9",

View File

@ -2,12 +2,21 @@
<header class="sheet-header">
<img class="profile-img" src="{{img}}" data-edit="img" title="{{name}}"/>
<div class="header-fields">
{{#if (or isGM data.identifie)}}
<h1 class="charname"><input name="name" type="text" value="{{name}}" placeholder="Name"/></h1>
</div>
{{else}}
<h1 class="charname">Inconnue</h1>
{{/if}}
</div>
</header>
{{!-- Sheet Body --}}
<section class="sheet-body">
{{#if (or isGM data.identifie)}}
<div class="form-group">
<label for="xp">Identifiée ? </label>
<input class="attribute-value" type="checkbox" name="data.identifie" {{#if data.identifie}}checked{{/if}}/>
</div>
<div class="form-group">
<label for="xp">Malignité </label>
<input class="attribute-value" type="text" name="data.malignite" value="{{data.malignite}}" data-dtype="Number"/>
@ -20,10 +29,17 @@
<label for="xp">Dommages</label>
<input class="attribute-value" type="text" name="data.dommages" value="{{data.dommages}}" data-dtype="String"/>
</div>
<div class="form-group">
<label for="xp">Remedes Connus ? </label>
<input class="attribute-value" type="checkbox" name="data.remedesconnus" {{#if data.remedesconnus}}checked{{/if}}/>
</div>
{{#if (or isGM data.remedesconnus)}}
<div class="form-group">
<label for="xp">Remèdes </label>
<input class="attribute-value" type="text" name="data.remedes" value="{{data.remedes}}" data-dtype="String"/>
</div>
{{/if}}
{{/if}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}}

View File

@ -1,32 +1,48 @@
<form class="{{cssClass}}" autocomplete="off">
<header class="sheet-header">
<img class="profile-img" src="{{img}}" data-edit="img" title="{{name}}"/>
<div class="header-fields">
<h1 class="charname"><input name="name" type="text" value="{{name}}" placeholder="Name"/></h1>
<header class="sheet-header">
<img class="profile-img" src="{{img}}" data-edit="img" title="{{name}}"/>
<div class="header-fields">
{{#if (or isGM data.identifie)}}
<h1 class="charname"><input name="name" type="text" value="{{name}}" placeholder="Name"/></h1>
{{else}}
<h1 class="charname">Inconnue</h1>
{{/if}}
</div>
</header>
{{!-- Sheet Body --}}
<section class="sheet-body">
<div class="form-group">
<label for="xp">Malignité </label>
<input class="attribute-value" type="text" name="data.malignite" value="{{data.malignite}}" data-dtype="Number"/>
</div>
<div class="form-group">
<label for="xp">Périodicité</label>
<input class="attribute-value" type="text" name="data.periodicite" value="{{data.periodicite}}" data-dtype="String"/>
</div>
<div class="form-group">
<label for="xp">Dommages</label>
<input class="attribute-value" type="text" name="data.dommages" value="{{data.dommages}}" data-dtype="String"/>
</div>
<div class="form-group">
<label for="xp">Remèdes </label>
<input class="attribute-value" type="text" name="data.remedes" value="{{data.remedes}}" data-dtype="String"/>
</div>
</header>
{{!-- Sheet Body --}}
<section class="sheet-body">
{{#if (or isGM data.identifie)}}
<div class="form-group">
<label for="xp">Identifiée ? </label>
<input class="attribute-value" type="checkbox" name="data.identifie" {{#if data.identifie}}checked{{/if}}/>
</div>
<div class="form-group">
<label for="xp">Malignité </label>
<input class="attribute-value" type="text" name="data.malignite" value="{{data.malignite}}" data-dtype="Number"/>
</div>
<div class="form-group">
<label for="xp">Périodicité</label>
<input class="attribute-value" type="text" name="data.periodicite" value="{{data.periodicite}}" data-dtype="String"/>
</div>
<div class="form-group">
<label for="xp">Dommages</label>
<input class="attribute-value" type="text" name="data.dommages" value="{{data.dommages}}" data-dtype="String"/>
</div>
<div class="form-group">
<label for="xp">Remedes Connus ? </label>
<input class="attribute-value" type="checkbox" name="data.remedesconnus" {{#if data.remedesconnus}}checked{{/if}}/>
</div>
{{#if (or isGM data.remedesconnus)}}
<div class="form-group">
<label for="xp">Remèdes </label>
<input class="attribute-value" type="text" name="data.remedes" value="{{data.remedes}}" data-dtype="String"/>
</div>
{{/if}}
{{/if}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}}
</section>
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}}
</section>
</form>