#5 Encaissement des dommages libre
This commit is contained in:
parent
2ba20aa615
commit
397f140cb3
@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
import { RdDUtility } from "./rdd-utility.js";
|
||||
import { RdDEncaisser } from "./rdd-roll-encaisser.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class RdDActorSheet extends ActorSheet {
|
||||
@ -123,7 +124,13 @@ export class RdDActorSheet extends ActorSheet {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async displayDialogEncaisser( ) {
|
||||
let data = { bonusmalusTable: CONFIG.RDD.bonusmalus };
|
||||
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-encaisser.html', data );
|
||||
new RdDEncaisser(html, this.actor ).render(true);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/** @override */
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
@ -148,9 +155,7 @@ export class RdDActorSheet extends ActorSheet {
|
||||
|
||||
// Update Inventory Item
|
||||
html.find('.encaisser-direct').click(ev => {
|
||||
let result = new Roll("2d10").roll().result;
|
||||
const item = this.actor.encaisserDommagesHorsCombat(result);
|
||||
console.log("ENCAISSER:", result);
|
||||
this.displayDialogEncaisser()
|
||||
});
|
||||
|
||||
// Blessure control
|
||||
|
@ -842,7 +842,7 @@ export class RdDActor extends Actor {
|
||||
encaisserDommagesHorsCombat( degats )
|
||||
{
|
||||
let degatsReel = degats - this.computeArmure("Corps", 0);
|
||||
console.log("Enciasser dommages", degatsReel);
|
||||
console.log("Enciasser dommages", degatsReel, this.computeArmure("Corps", 0), degats);
|
||||
|
||||
let result = RdDUtility.computeBlessuresSante(degatsReel);
|
||||
this.santeIncDec("vie", result.vie);
|
||||
|
@ -6,7 +6,7 @@
|
||||
export class RdDEncaisser extends Dialog {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
constructor(mode, html, rollData, actor) {
|
||||
constructor(html, actor) {
|
||||
let myButtons = { rollButton: {
|
||||
label: "Lancer",
|
||||
callback: html => this.performEncaisser(html, false)
|
||||
@ -21,23 +21,35 @@ export class RdDEncaisser extends Dialog {
|
||||
|
||||
// Select proper roll dialog template and stuff
|
||||
dialogConf.title = "Jet d'Encaissement",
|
||||
dialogOptions.width = 600;
|
||||
dialogOptions.height = 360;
|
||||
dialogOptions.width = 320;
|
||||
dialogOptions.height = 160;
|
||||
super(dialogConf, dialogOptions);
|
||||
|
||||
this.mode = mode;
|
||||
this.rollData = rollData;
|
||||
this.actor = actor;
|
||||
this.modifier = 0;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
performEncaisser (html, isReserve=false) {
|
||||
|
||||
//console.log("On va encaisser !!", this.modifier);
|
||||
let result = Number(new Roll("2d10").roll().result);
|
||||
result += Number(this.modifier);
|
||||
this.actor.encaisserDommagesHorsCombat(result);
|
||||
//console.log("ENCAISSER:", result);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
// Setup everything onload
|
||||
$(function() {
|
||||
$("#modificateurDegats").val( "0" );
|
||||
});
|
||||
|
||||
html.find('#modificateurDegats').click((event) => {
|
||||
this.modifier = event.currentTarget.value; // Update the selected bonus/malus
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -107,7 +107,7 @@ export class RdDUtility {
|
||||
'systems/foundryvtt-reve-de-dragon/templates/item-livre-sheet.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/item-tache-sheet.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/item-potion-sheet.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/item-rentontresTMR-sheet.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/item-rencontresTMR-sheet.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/item-queue-sheet.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/item-souffle-sheet.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/item-tarot-sheet.html',
|
||||
@ -126,6 +126,7 @@ export class RdDUtility {
|
||||
'systems/foundryvtt-reve-de-dragon/templates/dialog-competence.html',
|
||||
'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-tmr.html',
|
||||
// Calendrier
|
||||
'systems/foundryvtt-reve-de-dragon/templates/calendar_template.html'
|
||||
|
@ -370,7 +370,8 @@ export class TMRUtility {
|
||||
await pack.getIndex();
|
||||
let entry = pack.index.find(e => e.name === tableName);
|
||||
let rollQueues = await pack.getEntity(entry._id);
|
||||
let result = rollQueues.draw( { displayChat: toChat } );
|
||||
let result = await rollQueues.draw( { displayChat: toChat } );
|
||||
console.log("CAT", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -2,9 +2,9 @@
|
||||
"name": "foundryvtt-reve-de-dragon",
|
||||
"title": "Rêve de Dragon",
|
||||
"description": "Rêve de Dragon RPG for FoundryVTT",
|
||||
"version": "0.9.27",
|
||||
"minimumCoreVersion": "0.6.0",
|
||||
"compatibleCoreVersion": "0.7.5",
|
||||
"version": "0.9.28",
|
||||
"minimumCoreVersion": "0.7.5",
|
||||
"compatibleCoreVersion": "0.7.6",
|
||||
"templateVersion": 41,
|
||||
"author": "LeRatierBretonnien",
|
||||
"esmodules": [ "module/rdd-main.js", "module/hook-renderChatLog.js" ],
|
||||
|
@ -256,14 +256,7 @@
|
||||
{{!-- Combat Tab --}}
|
||||
<div class="tab combat" data-group="primary" data-tab="combat">
|
||||
<div>
|
||||
<span class="encaisser-direct"><a>Encaisser des dommages : </a></span>
|
||||
<select name="degatsmodifier" id="degatsmodifier" data-dtype="String">
|
||||
{{#select degatsmodifier}}
|
||||
{{#each bonusmalusTable as |bmvalue key|}}
|
||||
<option value="{{bmvalue}}"}>{{numberFormat bmvalue decimals=0 sign=true}}</option>
|
||||
{{/each}}
|
||||
{{/select}}
|
||||
</select>
|
||||
<span class="encaisser-direct"><a>Encaisser des dommages</a></span>
|
||||
</div>
|
||||
<header class="competence-header flexrow">
|
||||
<span class="competence-title">Armes</span>
|
||||
|
16
templates/dialog-roll-encaisser.html
Normal file
16
templates/dialog-roll-encaisser.html
Normal file
@ -0,0 +1,16 @@
|
||||
<form class="encaisse-roll-dialog">
|
||||
<h2 class="encaisserdialog" id="encaisserTitle"></h2>
|
||||
<div class="form-group">
|
||||
<label class="competence-label">Modificateurs aux Dommages:</label>
|
||||
<select class="competence-value" name="modificateurDegats" id="modificateurDegats" data-dtype="number">
|
||||
{{#select modificateurDegats}}
|
||||
{{#each bonusmalusTable as |bmvalue key|}}
|
||||
<option value={{bmvalue}}>{{numberFormat bmvalue decimals=0 sign=true}}</option>
|
||||
{{/each}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user