Lecture des signes draconiques
This commit is contained in:
parent
25a3903478
commit
94968cf5bb
119
module/actor.js
119
module/actor.js
@ -19,6 +19,7 @@ import { RdDItemArme } from "./item-arme.js";
|
|||||||
import { RdDAlchimie } from "./rdd-alchimie.js";
|
import { RdDAlchimie } from "./rdd-alchimie.js";
|
||||||
import { StatusEffects } from "./status-effects.js";
|
import { StatusEffects } from "./status-effects.js";
|
||||||
import { RdDItemCompetenceCreature } from "./item-competencecreature.js";
|
import { RdDItemCompetenceCreature } from "./item-competencecreature.js";
|
||||||
|
import { RdDItemSigneDraconique } from "./item-signedraconique.js";
|
||||||
import { ReglesOptionelles } from "./regles-optionelles.js";
|
import { ReglesOptionelles } from "./regles-optionelles.js";
|
||||||
import { TMRRencontres } from "./tmr-rencontres.js";
|
import { TMRRencontres } from "./tmr-rencontres.js";
|
||||||
import { Poetique } from "./poetique.js";
|
import { Poetique } from "./poetique.js";
|
||||||
@ -1691,7 +1692,7 @@ export class RdDActor extends Actor {
|
|||||||
// enduranceLostRoll.showDice = true;
|
// enduranceLostRoll.showDice = true;
|
||||||
RdDDice.show(enduranceLostRoll);
|
RdDDice.show(enduranceLostRoll);
|
||||||
let enduranceLost = enduranceLostRoll.total;
|
let enduranceLost = enduranceLostRoll.total;
|
||||||
let perteEndurance = await this.santeIncDec("endurance", -enduranceLost, {ethylisme: true});
|
let perteEndurance = await this.santeIncDec("endurance", -enduranceLost, { ethylisme: true });
|
||||||
let jetEnduranceView = {
|
let jetEnduranceView = {
|
||||||
ethylismeEtape: 'Endurance',
|
ethylismeEtape: 'Endurance',
|
||||||
enduranceLost: perteEndurance.perte,
|
enduranceLost: perteEndurance.perte,
|
||||||
@ -1725,7 +1726,7 @@ export class RdDActor extends Actor {
|
|||||||
RdDResolutionTable.displayRollData(jetVolonteView, this, 'chat-resultat-ethylisme.html');
|
RdDResolutionTable.displayRollData(jetVolonteView, this, 'chat-resultat-ethylisme.html');
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.update({'data.compteurs.ethylisme': ethylisme});
|
await this.update({ 'data.compteurs.ethylisme': ethylisme });
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -2283,7 +2284,7 @@ export class RdDActor extends Actor {
|
|||||||
RdDResolutionTable.displayRollData(rollData, this)
|
RdDResolutionTable.displayRollData(rollData, this)
|
||||||
return rollData.rolled;
|
return rollData.rolled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
_appliquerExperienceRollData(rollData) {
|
_appliquerExperienceRollData(rollData) {
|
||||||
const callback = this.createCallbackExperience();
|
const callback = this.createCallbackExperience();
|
||||||
@ -2319,6 +2320,11 @@ export class RdDActor extends Actor {
|
|||||||
});
|
});
|
||||||
dialog.render(true);
|
dialog.render(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
async _competenceResult(rollData) {
|
||||||
|
RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-competence.html')
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async creerTacheDepuisLivre(item, options = { renderSheet: true }) {
|
async creerTacheDepuisLivre(item, options = { renderSheet: true }) {
|
||||||
@ -2544,24 +2550,15 @@ export class RdDActor extends Actor {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async rollMeditation(id) {
|
async rollMeditation(id) {
|
||||||
let meditation = Misc.data(this.getMeditation(id));
|
let meditation = Misc.data(this.getMeditation(id));
|
||||||
let competence = Misc.data(this.getCompetence(meditation.data.competence));
|
|
||||||
competence.data.defaut_carac = "intellect"; // Meditation = tjs avec intellect
|
|
||||||
let meditationData = {
|
let meditationData = {
|
||||||
competence: competence,
|
competence: duplicate(Misc.data(this.getCompetence(meditation.data.competence))),
|
||||||
meditation: meditation,
|
meditation: duplicate(meditation),
|
||||||
conditionMeditation: {
|
conditionMeditation: { isHeure: false, isVeture: false, isComportement: false, isPurification: false },
|
||||||
isHeure: false,
|
|
||||||
isVeture: false,
|
|
||||||
isComportement: false,
|
|
||||||
isPurification: false,
|
|
||||||
},
|
|
||||||
diffConditions: 0,
|
diffConditions: 0,
|
||||||
use: { libre: false, conditions: true, },
|
use: { libre: false, conditions: true, },
|
||||||
carac: {}
|
carac: { "intellect": Misc.templateData(this).carac.intellect }
|
||||||
};
|
};
|
||||||
meditationData.carac["intellect"] = Misc.templateData(this).carac["intellect"];
|
meditationData.competence.data.defaut_carac = "intellect"; // Meditation = tjs avec intellect
|
||||||
|
|
||||||
console.log("rollMeditation !!!", meditationData);
|
|
||||||
|
|
||||||
const dialog = await RdDRoll.create(this, meditationData,
|
const dialog = await RdDRoll.create(this, meditationData,
|
||||||
{
|
{
|
||||||
@ -2584,27 +2581,92 @@ export class RdDActor extends Actor {
|
|||||||
async _meditationResult(meditationData) {
|
async _meditationResult(meditationData) {
|
||||||
this.santeIncDec("fatigue", 2);
|
this.santeIncDec("fatigue", 2);
|
||||||
|
|
||||||
meditationData.diffLecture = -7;
|
const signeData = RdDItemSigneDraconique.prepareSigneDraconiqueMeditation(meditationData.meditation, meditationData.rolled)
|
||||||
if (meditationData.rolled.isPart)
|
if (signeData) {
|
||||||
meditationData.diffLecture = 0;
|
await this.createEmbeddedDocuments("Item", [signeData]);
|
||||||
else if (meditationData.rolled.isSign)
|
}
|
||||||
meditationData.diffLecture = -3;
|
|
||||||
|
|
||||||
RdDResolutionTable.displayRollData(meditationData, this.name, 'chat-resultat-meditation.html');
|
RdDResolutionTable.displayRollData(meditationData, this.name, 'chat-resultat-meditation.html');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
_meditationEPart(meditationData) {
|
_meditationEPart(meditationData) {
|
||||||
meditationData.meditation.data.malus--;
|
this.updateEmbeddedDocuments('Item', [{ _id: meditation._id, 'data.malus': meditationData.meditation.data.malus - 1 }]);
|
||||||
this.updateEmbeddedDocuments('Item', [meditationData.meditation]);
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
_getSignesDraconiques(coord) {
|
||||||
|
const type = TMRUtility.getTMRType(coord);
|
||||||
|
return this.listItemsData("signedraconique").filter(it => it.data.typesTMR.includes(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async _competenceResult(rollData) {
|
isResonanceSigneDraconique(coord) {
|
||||||
RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-competence.html')
|
return this._getSignesDraconiques(coord).length > 0;
|
||||||
}
|
}
|
||||||
async _moralDecrease(rollData) {
|
|
||||||
RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-competence.html')
|
/* -------------------------------------------- */
|
||||||
|
async rollLireSigneDraconique(coord) {
|
||||||
|
if (!this.isHautRevant()) {
|
||||||
|
ui.notifications.info("Seul un haut rêvant peut lire un signe draconique!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let signes = this._getSignesDraconiques(coord);
|
||||||
|
if (signes.length == 0) {
|
||||||
|
ui.notifications.info(`Aucun signe draconiques en ${coord} !`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.currentTMR) this.currentTMR.minimize(); // Hide
|
||||||
|
|
||||||
|
let draconicList = this.getDraconicList()
|
||||||
|
.map(draconic => duplicate(Misc.data(draconic)))
|
||||||
|
.map(draconic => { draconic.data.defaut_carac = "intellect"; return draconic; });
|
||||||
|
|
||||||
|
const intellect = Misc.templateData(this).carac.intellect;
|
||||||
|
let rollData = {
|
||||||
|
carac: { 'intellect': intellect },
|
||||||
|
selectedCarac: intellect,
|
||||||
|
competence: draconicList[0],
|
||||||
|
draconicList: draconicList,
|
||||||
|
signe: signes[0],
|
||||||
|
signes: signes,
|
||||||
|
tmr: TMRUtility.getTMR(coord),
|
||||||
|
diffLibre: Misc.data(signes[0]).data.difficulte,
|
||||||
|
}
|
||||||
|
|
||||||
|
const dialog = await RdDRoll.create(this, rollData,
|
||||||
|
{
|
||||||
|
html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-signedraconique.html',
|
||||||
|
options: { height: 600 },
|
||||||
|
close: html => { this.currentTMR.maximize() } // Re-display TMR
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'lire-signe-draconique',
|
||||||
|
label: 'Lire le signe draconique',
|
||||||
|
callbacks: [
|
||||||
|
this.createCallbackExperience(),
|
||||||
|
{ action: r => this._rollLireSigneDraconique(r) }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
);
|
||||||
|
dialog.render(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
async _rollLireSigneDraconique(rollData) {
|
||||||
|
const compData = rollData.competence;
|
||||||
|
if (!RdDItemCompetence.isDraconic(compData)) {
|
||||||
|
ui.notifications.error(`La compétence ${compData.name} n'est pas une compétence draconique`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
rollData.xpSort = RdDItemSigneDraconique.getXpSortSigneDraconique(rollData.rolled.code, rollData.signe);
|
||||||
|
if (rollData.xpSort > 0) {
|
||||||
|
await this.updateEmbeddedDocuments("Item", [{ _id: compData._id, 'data.xp_sort': Misc.toInt(compData.data.xp_sort) + rollData.xpSort }]);
|
||||||
|
}
|
||||||
|
await this.deleteEmbeddedDocuments("Item", [rollData.signe._id]);
|
||||||
|
RdDResolutionTable.displayRollData(rollData, this.name, 'chat-resultat-lecture-signedraconique.html');
|
||||||
|
this.currentTMR.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -2840,6 +2902,7 @@ export class RdDActor extends Actor {
|
|||||||
fatigue: RdDUtility.calculFatigueHtml(fatigue, endurance),
|
fatigue: RdDUtility.calculFatigueHtml(fatigue, endurance),
|
||||||
draconic: this.getDraconicList(),
|
draconic: this.getDraconicList(),
|
||||||
sort: this.getSortList(),
|
sort: this.getSortList(),
|
||||||
|
signes: this.listItemsData("signedraconique"),
|
||||||
caracReve: actorData.data.carac.reve.value,
|
caracReve: actorData.data.carac.reve.value,
|
||||||
pointsReve: this.getReveActuel(),
|
pointsReve: this.getReveActuel(),
|
||||||
isRapide: isRapide
|
isRapide: isRapide
|
||||||
|
@ -205,6 +205,11 @@ export class RdDRoll extends Dialog {
|
|||||||
this.updateRollResult();
|
this.updateRollResult();
|
||||||
$("#diffLibre").val(this.rollData.diffLibre);
|
$("#diffLibre").val(this.rollData.diffLibre);
|
||||||
});
|
});
|
||||||
|
html.find('.roll-signedraconique').change((event) => {
|
||||||
|
let sortKey = Misc.toInt(event.currentTarget.value);
|
||||||
|
this.setSelectedSigneDraconique(this.rollData.signes[sortKey]);
|
||||||
|
this.updateRollResult();
|
||||||
|
});
|
||||||
html.find('#ptreve-variable').change((event) => {
|
html.find('#ptreve-variable').change((event) => {
|
||||||
let ptreve = Misc.toInt(event.currentTarget.value);
|
let ptreve = Misc.toInt(event.currentTarget.value);
|
||||||
this.rollData.selectedSort.data.ptreve_reel = ptreve;
|
this.rollData.selectedSort.data.ptreve_reel = ptreve;
|
||||||
@ -276,6 +281,12 @@ export class RdDRoll extends Dialog {
|
|||||||
HtmlUtility._showControlWhen($(".div-sort-ptreve-fixe"), !coutVariable);
|
HtmlUtility._showControlWhen($(".div-sort-ptreve-fixe"), !coutVariable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async setSelectedSigneDraconique(signe){
|
||||||
|
this.rollData.signe = signe;
|
||||||
|
this.rollData.diffLibre = Misc.data(signe).data.difficulte,
|
||||||
|
$(".signe-difficulte").text(Misc.toSignedString(this.rollData.diffLibre));
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async updateRollResult() {
|
async updateRollResult() {
|
||||||
let rollData = this.rollData;
|
let rollData = this.rollData;
|
||||||
|
@ -183,22 +183,25 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
async activateListeners(html) {
|
async activateListeners(html) {
|
||||||
super.activateListeners(html);
|
super.activateListeners(html);
|
||||||
|
|
||||||
HtmlUtility._showControlWhen($(".appliquerFatigue"), ReglesOptionelles.isUsing("appliquer-fatigue"));
|
|
||||||
document.getElementById("tmrrow1").insertCell(0).append(this.pixiApp.view);
|
document.getElementById("tmrrow1").insertCell(0).append(this.pixiApp.view);
|
||||||
|
|
||||||
if (this.viewOnly) {
|
if (this.viewOnly) {
|
||||||
html.find('#lancer-sort').remove();
|
html.find('.lancer-sort').remove();
|
||||||
}
|
html.find('.lire-signe-draconique').remove();
|
||||||
else {
|
|
||||||
// Roll Sort
|
|
||||||
html.find('#lancer-sort').click((event) => {
|
|
||||||
this.actor.rollUnSort(Misc.data(this.actor).data.reve.tmrpos.coord);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (this.viewOnly) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HtmlUtility._showControlWhen($(".appliquerFatigue"), ReglesOptionelles.isUsing("appliquer-fatigue"));
|
||||||
|
HtmlUtility._showControlWhen($(".lire-signe-draconique"), this.actor.isResonanceSigneDraconique(this._getActorCoord()));
|
||||||
|
|
||||||
|
// Roll Sort
|
||||||
|
html.find('.lancer-sort').click((event) => {
|
||||||
|
this.actor.rollUnSort(this._getActorCoord());
|
||||||
|
});
|
||||||
|
html.find('.lire-signe-draconique').click((event) => {
|
||||||
|
this.actor.rollLireSigneDraconique(this._getActorCoord());
|
||||||
|
});
|
||||||
|
|
||||||
html.find('#dir-top').click((event) => {
|
html.find('#dir-top').click((event) => {
|
||||||
this.moveFromKey("top");
|
this.moveFromKey("top");
|
||||||
});
|
});
|
||||||
@ -235,6 +238,9 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
updateValuesDisplay() {
|
updateValuesDisplay() {
|
||||||
|
Array.from(document.getElementsByClassName("lire-signe-draconique"))
|
||||||
|
.forEach(it => HtmlUtility._showControlWhen(it, this.actor.isResonanceSigneDraconique(this._getActorCoord())));
|
||||||
|
|
||||||
let ptsreve = document.getElementById("tmr-pointsreve-value");
|
let ptsreve = document.getElementById("tmr-pointsreve-value");
|
||||||
const actorData = Misc.data(this.actor);
|
const actorData = Misc.data(this.actor);
|
||||||
ptsreve.innerHTML = actorData.data.reve.reve.value;
|
ptsreve.innerHTML = actorData.data.reve.reve.value;
|
||||||
|
11
templates/chat-resultat-lecture-signedraconique.html
Normal file
11
templates/chat-resultat-lecture-signedraconique.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<img class="chat-icon" src="{{competence.img}}" alt="{{competence.name}}" />
|
||||||
|
<h4>{{alias}} lit le signe {{signe.name}}</h4>
|
||||||
|
{{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.html"}}
|
||||||
|
<hr>
|
||||||
|
<div>
|
||||||
|
{{#if rolled.isSuccess}}
|
||||||
|
Vous avez gagné {{xpSort}} points d'expérience en sorts dans la {{competence.name}}.
|
||||||
|
{{else}}
|
||||||
|
Vous n'avez pas pu interpréter le signe draconique.
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
@ -6,11 +6,10 @@
|
|||||||
<hr>
|
<hr>
|
||||||
<div>
|
<div>
|
||||||
{{#if rolled.isSuccess}}
|
{{#if rolled.isSuccess}}
|
||||||
{{alias}} aperçoit un signe Draconique fugitif, qu'il faut aller lire en <strong>{{meditation.data.tmr}}</strong> en réussissant un test <strong>d'INTELLECT/Draconic à {{diffLecture}}</strong>.
|
Vous apercevez un signe draconique éphémère, qu'il faut aller lire en <strong>{{meditation.data.tmr}}</strong>.
|
||||||
Selon le résultat de votre lecture, vous gagnerez les points suivants en Sort: 3 pour une Normale, 5 pour une Significative, 10 pour une Particulière.
|
|
||||||
{{else}}
|
{{else}}
|
||||||
{{alias}} a échoué dans sa méditation et ne voit aucun signe Draconique.
|
Votre méditation ne porte pas ses fruits, vous ne voyez aucun signe Draconique.
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<br><span>Vous vous êtes fatigué de 2 cases.</span>
|
<br><span>Vous vous êtes fatigué de 2 cases.</span>
|
||||||
{{#if rolled.isETotal}}<br><span>Votre échec total augmente de 1 la difficulté de la méditation!</span>{{/if~}}
|
{{#if rolled.isEPart}}<br><span>Votre échec {{#if rolled.isETotal}}total{{else}}particulier{{/if}} augmente de 1 la difficulté de la méditation!</span>{{/if~}}
|
||||||
</div>
|
</div>
|
||||||
|
48
templates/dialog-roll-signedraconique.html
Normal file
48
templates/dialog-roll-signedraconique.html
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
{{log 'lecture signe draconique' this}}
|
||||||
|
<form class="dialog-roll-sort">
|
||||||
|
<h2>Lire le signe draconique
|
||||||
|
<select name="signe-draconique" class="roll-signedraconique flex-grow" data-dtype="String">
|
||||||
|
{{#select signe}}
|
||||||
|
{{#each signes as |signe key|}}
|
||||||
|
<option value={{key}}>{{this.name}}</option>
|
||||||
|
{{/each}}
|
||||||
|
{{/select}}
|
||||||
|
</select>
|
||||||
|
</h2>
|
||||||
|
<img class="chat-icon" src="{{competence.img}}" alt="{{competence.name}}" />
|
||||||
|
<div class="grid grid-2col">
|
||||||
|
<div class="flex-group-left">
|
||||||
|
<div class="flexrow">
|
||||||
|
<label for="tmr">TMR - {{tmr.coord}}:</label><label name="tmr">{{tmr.label}}</label>
|
||||||
|
</div>
|
||||||
|
<div class="flexrow">
|
||||||
|
<label for="carac">{{selectedCarac.label}}:</label><label name="carac">{{selectedCarac.value}}</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex-group-left">
|
||||||
|
<div class="flexrow">
|
||||||
|
<label for="competence">Draconic:</label>
|
||||||
|
<select name="competence" class="roll-draconic" data-dtype="String">
|
||||||
|
{{#select draconic}}
|
||||||
|
{{#each draconicList as |draconic key|}}
|
||||||
|
<option value={{key}}>{{draconic.name}} : {{numberFormat draconic.data.niveau decimals=0 sign=true}}
|
||||||
|
</option>
|
||||||
|
{{/each}}
|
||||||
|
{{/select}}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="flexrow">
|
||||||
|
<label>Difficulté</label>
|
||||||
|
<label class="signe-difficulte">{{diffLibre}}</label>
|
||||||
|
</div>
|
||||||
|
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
|
||||||
|
<div id="tableAjustements" class="flexrow"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="tableResolution"></div>
|
||||||
|
<div id="tableProbaReussite"></div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
</script>
|
@ -14,8 +14,11 @@
|
|||||||
<img class="small-button-direction" id='dir-bottom' src='systems/foundryvtt-reve-de-dragon/styles/img/ui/dir-bottom.svg'>
|
<img class="small-button-direction" id='dir-bottom' src='systems/foundryvtt-reve-de-dragon/styles/img/ui/dir-bottom.svg'>
|
||||||
<img class="small-button-direction" id='dir-bottom-right' src='systems/foundryvtt-reve-de-dragon/styles/img/ui/dir-bottom-right.svg'>
|
<img class="small-button-direction" id='dir-bottom-right' src='systems/foundryvtt-reve-de-dragon/styles/img/ui/dir-bottom-right.svg'>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-group-center">
|
<div class="flex-group-center lire-signe-draconique">
|
||||||
<a id="lancer-sort">Lancer un Sort</a>
|
<a>Lire un signe draconique</a>
|
||||||
|
</div>
|
||||||
|
<div class="flex-group-center lancer-sort">
|
||||||
|
<a>Lancer un Sort</a>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
<div class="flex-group-center">
|
<div class="flex-group-center">
|
||||||
|
Loading…
Reference in New Issue
Block a user