#76 : Jets de dés assistés pour les méditations
This commit is contained in:
parent
35ec95a176
commit
544c0ba94b
@ -299,6 +299,11 @@ export class RdDActorSheet extends ActorSheet {
|
||||
let tacheId = li.data('item-id');
|
||||
this.actor.rollTache( tacheId );
|
||||
});
|
||||
html.find('.meditation-label a').click((event) => {
|
||||
const li = $(event.currentTarget).parents(".item");
|
||||
let meditationId = li.data('item-id');
|
||||
this.actor.rollMeditation( meditationId );
|
||||
});
|
||||
|
||||
// Points de reve actuel
|
||||
html.find('.ptreve-actuel a').click((event) => {
|
||||
|
@ -1708,7 +1708,7 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getTache ( id ) {
|
||||
getTacheMeditation ( id ) {
|
||||
return this.data.items.find( item => item._id == id );
|
||||
}
|
||||
|
||||
@ -1757,6 +1757,60 @@ export class RdDActor extends Actor {
|
||||
this.updateEmbeddedEntity( "OwnedItem", rollData.tache);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollMeditation( id ) {
|
||||
let meditation = duplicate( this.getTacheMeditation( id ) );
|
||||
let competence = duplicate(this.getCompetence(meditation.data.competence));
|
||||
competence.data.defaut_carac = "intellect"; // Meditation = tjs avec intellect
|
||||
let meditationData = {
|
||||
competence: competence,
|
||||
meditation: meditation,
|
||||
diffConditions: 0,
|
||||
editLibre: false,
|
||||
editConditions: true,
|
||||
isHeure: false,
|
||||
isVeture: false,
|
||||
isComportement: false,
|
||||
isPurification: false,
|
||||
carac : { }
|
||||
};
|
||||
meditationData.carac["intellect"] = duplicate(this.data.data.carac["intellect"]);
|
||||
|
||||
console.log("rollMedittion !!!", meditationData);
|
||||
|
||||
const dialog = await RdDRoll.create(this, meditationData, {html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-meditation.html'}, {
|
||||
name: 'jet-meditation',
|
||||
label: 'Jet de Meditation ' + meditation.name,
|
||||
height: 600,
|
||||
callbacks: [
|
||||
this.createCallbackExperience(),
|
||||
{ condition: r=> r.rolled.isETotal, action: r => this._meditationETotal(r)},
|
||||
{ action: r => this._meditationResult(r) }
|
||||
]
|
||||
} );
|
||||
dialog.render(true);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _meditationResult(meditationData) {
|
||||
this.santeIncDec( "fatigue", 2);
|
||||
|
||||
meditationData.diffLecture = -7;
|
||||
if (meditationData.rolled.isPart )
|
||||
meditationData.diffLecture = 0;
|
||||
else if (meditationData.rolled.isSign )
|
||||
meditationData.diffLecture = -3;
|
||||
|
||||
RdDResolutionTable.displayRollData(meditationData, this.name, 'chat-resultat-meditation.html');
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_meditationETotal(meditationData) {
|
||||
meditationData.meditation.data.malus--;
|
||||
this.updateEmbeddedEntity( "OwnedItem", meditationData.meditation);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _competenceResult(rollData) {
|
||||
RdDResolutionTable.displayRollData(rollData, this.name, 'chat-resultat-competence.html')
|
||||
|
@ -223,6 +223,7 @@ export class RdDResolutionTable {
|
||||
return duplicate(RdDResolutionTable.resolutionTable[caracValue][difficulte + 10]);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static isAjustementAstrologique(rollData) {
|
||||
if (rollData.selectedCarac && rollData.selectedCarac.label.toLowerCase().includes('chance')) {
|
||||
return true;
|
||||
|
@ -218,12 +218,44 @@ export class RdDRoll extends Dialog {
|
||||
this.rollData.useMalusEncTotal = event.currentTarget.checked;
|
||||
updateRollResult(rollData);
|
||||
});
|
||||
// Section Méditation
|
||||
html.find('#isHeure').change((event) => {
|
||||
this.rollData.isHeure = event.currentTarget.checked;
|
||||
updateRollResult(rollData);
|
||||
});
|
||||
html.find('#isPurification').change((event) => {
|
||||
this.rollData.isPurification = event.currentTarget.checked;
|
||||
updateRollResult(rollData);
|
||||
});
|
||||
html.find('#isVeture').change((event) => {
|
||||
this.rollData.isVeture = event.currentTarget.checked;
|
||||
updateRollResult(rollData);
|
||||
});
|
||||
html.find('#isComportement').change((event) => {
|
||||
this.rollData.isComportement = event.currentTarget.checked;
|
||||
updateRollResult(rollData);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_isIgnoreEtatGeneral(rollData) {
|
||||
return rollData.selectedCarac.ignoreEtatGeneral;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_computeDiffMeditation( rollData ) {
|
||||
let diff = 0;
|
||||
if ( rollData.meditation ) {
|
||||
diff = (!rollData.isHeure) ? diff - 2 : diff;
|
||||
diff = (!rollData.isVeture) ? diff - 2 : diff;
|
||||
diff = (!rollData.isComportement) ? diff - 2 : diff;
|
||||
diff = (!rollData.isisPuritication) ? diff - 2 : diff;
|
||||
diff = diff - rollData.meditation.data.malus; // Malus permanent éventuel
|
||||
}
|
||||
return diff;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_computeFinalLevel(rollData) {
|
||||
const etat = this._isIgnoreEtatGeneral(rollData) ? 0 : Misc.toInt(rollData.etat);
|
||||
@ -235,13 +267,15 @@ export class RdDRoll extends Dialog {
|
||||
// Gestion malus armure
|
||||
const malusArmureValue = this._computeMalusArmure(rollData);
|
||||
|
||||
const diffMeditation = this._computeDiffMeditation( rollData );
|
||||
const diffLibre = this._computeDiffLibre(rollData);
|
||||
const diffCompetence = this._computeDiffCompetence(rollData);
|
||||
const diffMoral = rollData.selectedCarac == this.actor.data.data.carac.volonte ? rollData.moral : 0;
|
||||
|
||||
return etat + diffCompetence + diffLibre + diffMoral + diffConditions + malusEnc + malusEncTotal + malusArmureValue + ajustementChance + bonusTactique;
|
||||
return etat + diffCompetence + diffLibre + diffMoral + diffConditions + malusEnc + malusEncTotal + malusArmureValue + diffMeditation + ajustementChance + bonusTactique;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_computeDiffCompetence(rollData) {
|
||||
if (rollData.competence) {
|
||||
return Misc.toInt(rollData.competence.data.niveau);
|
||||
@ -252,6 +286,7 @@ export class RdDRoll extends Dialog {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_computeDiffLibre(rollData) {
|
||||
let diffLibre = Misc.toInt(rollData.diffLibre);
|
||||
if (rollData.draconicList && rollData.selectedSort) {
|
||||
|
@ -188,6 +188,7 @@ export class RdDUtility {
|
||||
'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-sort.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-encaisser.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-meditation.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/dialog-tmr.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-surenc.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-enctotal.html',
|
||||
|
BIN
sounds/progession_xp.ogg
Normal file
BIN
sounds/progession_xp.ogg
Normal file
Binary file not shown.
15
templates/chat-resultat-meditation.html
Normal file
15
templates/chat-resultat-meditation.html
Normal file
@ -0,0 +1,15 @@
|
||||
<h4>
|
||||
{{alias}} a médité : {{meditation.name}}
|
||||
</h4>
|
||||
{{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.html"}}
|
||||
<hr>
|
||||
<div>
|
||||
{{#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>.
|
||||
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}}
|
||||
{{alias}} a échoué dans sa méditation et ne voit aucun signe Draconique.
|
||||
{{/if}}
|
||||
<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~}}
|
||||
</div>
|
66
templates/dialog-roll-meditation.html
Normal file
66
templates/dialog-roll-meditation.html
Normal file
@ -0,0 +1,66 @@
|
||||
<form class="dialog-roll-meditation">
|
||||
<div class="form-group">
|
||||
<ul class="item-list">
|
||||
<li class="item flexrow">
|
||||
<label for="categorie"><strong>Thème : {{meditation.data.theme}} </strong></label>
|
||||
<label for="categorie">Intellect {{numberFormat carac.intellect.value decimals=0 sign=false}} / {{competence.name}} {{numberFormat competence.data.niveau decimals=0 sign=true}}</label>
|
||||
</li>
|
||||
<li class="item flexrow">
|
||||
<label for="categorie">Sujet : {{competence.name}} ({{meditation.data.theme}})</label>
|
||||
<label for="categorie">Durée : 60 minutes</label>
|
||||
</li>
|
||||
<li class="item flexrow">
|
||||
<label for="categorie">Support : {{meditation.data.support}}</label>
|
||||
<label for="categorie">Malus spécial : {{meditation.data.malus}}</label>
|
||||
</li>
|
||||
<li class="item flexrow"><label for="categorie">Case TMR : {{meditation.data.tmr}}</label></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="categorie" class="h4"><strong>Conditions Optionnelles : </strong></label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<ul class="item-list">
|
||||
<li class="item flexrow">
|
||||
<label for="categorie">Heure : {{meditation.data.heure}}</label>
|
||||
<input class="attribute-value" type="checkbox" id="isHeure" name="isHeure" {{#if isHeure}}checked{{/if}}/>
|
||||
</li>
|
||||
<li class="item flexrow">
|
||||
<label for="categorie">Purification : {{meditation.data.purification}}</label>
|
||||
<input class="attribute-value" type="checkbox" id="isPurification" name="isPurification" {{#if isPurification}}checked{{/if}}/>
|
||||
</li>
|
||||
<li class="item flexrow">
|
||||
<label for="categorie">Vêture : {{meditation.data.veture}}</label>
|
||||
<input class="attribute-value" type="checkbox" id="isVeture" name="isVeture" {{#if isVeture}}checked{{/if}}/>
|
||||
</li>
|
||||
<li class="item flexrow">
|
||||
<label for="categorie">Comportement antérieur : {{meditation.data.comportement}})</label>
|
||||
<input class="attribute-value" type="checkbox" id="isComportement" name="isComportement" {{#if isComportement}}checked{{/if}}/>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<label for="categorie">Conditions supplémentaires : </label>
|
||||
<select name="diffConditions" id="diffConditions" data-dtype="number">
|
||||
{{#select diffConditions}}
|
||||
{{#each ajustementsConditions as |key|}}
|
||||
<option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option>
|
||||
{{/each}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="categorie">Ajustements</label>
|
||||
<label for="categorie" id="etat-general">Etat général: {{numberFormat etat decimals=0 sign=true}}</label>
|
||||
<label>Final: <label id="roll-param">10 / 0</label> <label name="addon-message" id="addon-message"></label></label>
|
||||
</div>
|
||||
<div id="resolutionTable">
|
||||
</div>
|
||||
<div id="resolutionValeurs">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
</script>
|
@ -28,8 +28,8 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="xp">Heure</label>
|
||||
<select name="data.defaut_carac" id="defaut_carac" data-dtype="String">
|
||||
{{#select item.data.defaut_carac}}
|
||||
<select name="data.heure" id="heure" data-dtype="String">
|
||||
{{#select item.data.heure}}
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/heures-select-option.html"}}
|
||||
{{/select}}
|
||||
</select>
|
||||
|
Loading…
Reference in New Issue
Block a user