Gestion des signes draconiques #455

Closed
vincent.vandeme wants to merge 233 commits from v1.4-signes-draconiques into master
4 changed files with 104 additions and 5 deletions
Showing only changes of commit f7c1ed0749 - Show all commits

View File

@ -27,6 +27,7 @@ import { EffetsDraconiques } from "./tmr/effets-draconiques.js";
import { Draconique } from "./tmr/draconique.js"; import { Draconique } from "./tmr/draconique.js";
import { RdDCarac } from "./rdd-carac.js"; import { RdDCarac } from "./rdd-carac.js";
import { Monnaie } from "./item-monnaie.js"; import { Monnaie } from "./item-monnaie.js";
import { RdDHerbes } from "./rdd-herbes.js";
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -619,6 +620,7 @@ export class RdDActor extends Actor {
dialog.render(true); dialog.render(true);
} }
/* -------------------------------------------- */
async resultCombatReveDeDragon(rollData) { async resultCombatReveDeDragon(rollData) {
rollData.queues = []; rollData.queues = [];
if (rollData.rolled.isEchec) { if (rollData.rolled.isEchec) {
@ -3051,9 +3053,85 @@ export class RdDActor extends Actor {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
consommerPotion( potion ) { async buildPotionGuerisonList( pointsGuerison) {
let pointsGuerisonInitial = pointsGuerison;
let myData = Misc.templateData(this);
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)");
}
}
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)");
}
}
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({ "data.blessures": blessures });
let pvManquants = myData.sante.vie.max - myData.sante.vie.value;
let pvSoignees = Math.min(pvManquants, Math.floor(pointsGuerison / 2 ));
guerisonData.list.push( pvSoignees + " Points de Vie soignés");
await this.santeIncDec('vie', +pvSoignees, false);
guerisonData.pointsConsommes = pointsGuerisonInitial - pointsGuerison;
return guerisonData;
}
/* -------------------------------------------- */
async consommerPotionSoin(potionData) {
if (potionData.data.categorie.includes('Enchante')) {
potionData.pointsGuerison = RdDHerbes.calculePointsGuerison( potionData.data);
potionData.alias = this.name;
potionData.enchanteTexte = "enchantée";
potionData.isEnchante = true;
ChatMessage.create({
whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name),
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-consommer-potion-soin.html`, potionData )
});
// Gestion de la résistance:
let rolled = await RdDResolutionTable.roll(this.getReveActuel(), -8 );
if (!rolled.isSuccess) {
await this.reveActuelIncDec(-1);
potionData.guerisonData = await this.buildPotionGuerisonList(potionData.pointsGuerison);
potionData.guerisonMinutes = potionData.guerisonData.pointsConsommes * 5;
ChatMessage.create({
whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name),
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-appliquer-potion-soin.html`, potionData )
});
} else {
}
} else {
}
}
/* -------------------------------------------- */
async consommerPotion( potion ) {
const potionData = Misc.data(potion); const potionData = Misc.data(potion);
console.log("Potion consommée", potionData);
if ( potionData.data.categorie.includes('Soin')) {
this.consommerPotionSoin( potionData);
} else if( potion.data.categorie.includes('Repos')) {
//TODO
} else {
//TODO
}
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

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.4.1", "version": "1.4.2",
"manifestPlusVersion": "1.0.0", "manifestPlusVersion": "1.0.0",
"minimumCoreVersion": "0.7.5", "minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.7.9", "compatibleCoreVersion": "0.7.9",
"templateVersion": 111, "templateVersion": 112,
"author": "LeRatierBretonnien", "author": "LeRatierBretonnien",
"authors": [ "authors": [
{ {

View File

@ -726,6 +726,7 @@
"herbe": "", "herbe": "",
"herbebrins": 0, "herbebrins": 0,
"herbebonus": 0, "herbebonus": 0,
"reposalchimique": false,
"pr": 0, "pr": 0,
"prpermanent": false, "prpermanent": false,
"prdate": 0, "prdate": 0,

View File

@ -5,7 +5,7 @@
<h1 class="charname"><input name="name" type="text" value="{{name}}" placeholder="Name" /></h1> <h1 class="charname"><input name="name" type="text" value="{{name}}" placeholder="Name" /></h1>
{{#if isOwned}} {{#if isOwned}}
<div class="form-group"> <div class="form-group">
<span for="xp"><a class="consommer-potion chat-card-button" data-actor-id="{{actorId}}">Consommer cette potion</a></span> <span for="xp"><a class="consommer-potion chat-card-button" data-actor-id="{{actorId}}">Consommer cette potion et appliquer ses effets</a></span>
</div> </div>
{{/if}} {{/if}}
</div> </div>
@ -57,6 +57,26 @@
<input class="attribute-value" type="text" name="data.herbebonus" value="{{data.herbebonus}}" data-dtype="Number" /> <input class="attribute-value" type="text" name="data.herbebonus" value="{{data.herbebonus}}" data-dtype="Number" />
</div> </div>
{{/if}} {{/if}}
{{#if isRepos}}
<div class="form-group">
<label>Herbe</label>
<select name="data.herbe" class="herbe" data-dtype="String">
{{selectOptions herbesRepos selected=data.herbe localize=false}}
</select>
</div>
<div class="form-group">
<label>Nombre de brins</label>
<input class="attribute-value" type="text" name="data.herbebrins" value="{{data.herbebrins}}" data-dtype="Number" />
</div>
<div class="form-group">
<label>Bonus</label>
<input class="attribute-value" type="text" name="data.herbebonus" value="{{data.herbebonus}}" data-dtype="Number" />
</div>
<div class="form-group">
<label>Repos Alchimique ?</label>
<input class="attribute-value" type="checkbox" name="data.reposalchimique" {{#if data.reposalchimique}}checked{{/if}}/>
</div>
{{/if}}
{{#if isEnchante}} {{#if isEnchante}}
<div class="form-group"> <div class="form-group">
<label>Points de rêve</label> <label>Points de rêve</label>