Merge VK branch
This commit is contained in:
commit
fcc7c4202e
@ -100,7 +100,7 @@ export class RdDActorSheet extends ActorSheet {
|
||||
|
||||
// Gestion du lock/unlock des zones éditables (carac+compétences)
|
||||
data.data.editCaracComp = this.options.editCaracComp;
|
||||
data.data.lockUnlockText = (this.options.editCaracComp) ? "Bloquer" : "Debloquer";
|
||||
data.data.lockUnlockText = (this.options.editCaracComp) ? "Bloquer" : "Débloquer";
|
||||
|
||||
// low is normal, this the base used to compute the grid.
|
||||
data.data.fatigue = {
|
||||
@ -118,7 +118,7 @@ export class RdDActorSheet extends ActorSheet {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async displayDialogEncaisser( ) {
|
||||
let data = { ajustementsConditions: CONFIG.RDD.ajustementsConditions /* techniquement on peut encaisser à +20 */ };
|
||||
let data = { ajustementsEncaissement: RdDUtility.getAjustementsEncaissement() };
|
||||
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-encaisser.html', data );
|
||||
new RdDEncaisser(html, this.actor ).render(true);
|
||||
}
|
||||
@ -160,6 +160,12 @@ export class RdDActorSheet extends ActorSheet {
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
if (game.user.isGM) {
|
||||
$(".gm-only").show();
|
||||
} else {
|
||||
$(".gm-only").hide();
|
||||
}
|
||||
|
||||
// Everything below here is only needed if the sheet is editable
|
||||
if (!this.options.editable) return;
|
||||
|
||||
@ -176,11 +182,16 @@ export class RdDActorSheet extends ActorSheet {
|
||||
this.confirmerSuppression( li );
|
||||
});
|
||||
|
||||
// Update Inventory Item
|
||||
html.find('.encaisser-direct').click(ev => {
|
||||
html.find('#encaisser-direct').click(ev => {
|
||||
this.displayDialogEncaisser()
|
||||
});
|
||||
|
||||
html.find('#remise-a-neuf').click(ev => {
|
||||
if (game.user.isGM) {
|
||||
this.actor.remiseANeuf();
|
||||
}
|
||||
});
|
||||
|
||||
// Blessure control
|
||||
html.find('.blessure-control').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item");
|
||||
@ -234,24 +245,24 @@ export class RdDActorSheet extends ActorSheet {
|
||||
this.actor.rollArme( armeName, competenceName);
|
||||
});
|
||||
// Display TMR, normal
|
||||
html.find('.visu-tmr a').click((event) => {
|
||||
html.find('#visu-tmr').click((event) => {
|
||||
this.actor.displayTMR( "visu");
|
||||
});
|
||||
|
||||
// Display TMR, normal
|
||||
html.find('.monte-tmr a').click((event) => {
|
||||
html.find('#monte-tmr').click((event) => {
|
||||
this.actor.displayTMR( "normal" );
|
||||
});
|
||||
|
||||
// Display TMR, fast
|
||||
html.find('.monte-tmr-rapide a').click((event) => {
|
||||
html.find('#monte-tmr-rapide').click((event) => {
|
||||
this.actor.displayTMR( "rapide" );
|
||||
});
|
||||
|
||||
html.find('.dormir-une-heure').click((event) => {
|
||||
html.find('#dormir-une-heure').click((event) => {
|
||||
this.actor.dormir(1);
|
||||
});
|
||||
html.find('.dormir-chateau-dormant').click((event) => {
|
||||
html.find('#dormir-chateau-dormant').click((event) => {
|
||||
this.actor.dormirChateauDormant();
|
||||
});
|
||||
|
||||
|
@ -391,10 +391,14 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
mergeObject(retrograde, { "active": true, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "localisation": blessure.localisation });
|
||||
}
|
||||
mergeObject(blessure, { "active": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "localisation": "" });
|
||||
this._supprimerBlessure(blessure);
|
||||
return true;
|
||||
}
|
||||
|
||||
_supprimerBlessure(blessure) {
|
||||
mergeObject(blessure, { "active": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "localisation": "" });
|
||||
}
|
||||
|
||||
async _recupererVie(message) {
|
||||
let blessures = [].concat(this.data.data.blessures.legeres.liste).concat(this.data.data.blessures.graves.liste).concat(this.data.data.blessures.critiques.liste);
|
||||
let nbBlessures = blessures.filter(b => b.active);
|
||||
@ -430,6 +434,28 @@ export class RdDActor extends Actor {
|
||||
return rolled;
|
||||
}
|
||||
|
||||
|
||||
async remiseANeuf() {
|
||||
let message = {
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs( this.name ),
|
||||
content : "Remise à neuf de " + this.name
|
||||
};
|
||||
const blessures = duplicate(this.data.data.blessures);
|
||||
for (let listeBlessures of [blessures.legeres.liste, blessures.graves.liste, blessures.critiques.liste]) {
|
||||
for (let blessure of listeBlessures) {
|
||||
this._supprimerBlessure(blessure);
|
||||
}
|
||||
}
|
||||
await this.update( {"data.blessures": blessures } );
|
||||
await this.santeIncDec("vie", this.data.data.sante.vie.max - this.data.data.sante.vie.value);
|
||||
await this.santeIncDec("endurance", this.data.data.sante.endurance.max - this.data.data.sante.endurance.value);
|
||||
let fatigue = duplicate(this.data.data.sante.fatigue)
|
||||
fatigue.value = 0;
|
||||
await this.update( {"data.sante.fatigue": fatigue } );
|
||||
ChatMessage.create( message );
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async dormir(heures=1) {
|
||||
let message = {
|
||||
@ -890,12 +916,15 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async santeIncDec(name, inc, isCritique = false ) {
|
||||
async santeIncDec(name, inc, isCritique = false) {
|
||||
const sante = duplicate(this.data.data.sante);
|
||||
let data = sante[name];
|
||||
let minValue = 0;
|
||||
if (this.type == 'personnage')
|
||||
minValue = name == "vie" ? Number(-this.data.data.attributs.sconst.value) : 0;
|
||||
if (this.type == 'personnage') {
|
||||
// TODO: les animaux/humanoïdes on théoriquement aussi un sconst, mais la SPA n'est pas passé par là
|
||||
minValue = name == "vie" ? -Number(this.data.data.attributs.sconst.value) : 0;
|
||||
}
|
||||
|
||||
let newValue = Math.max(minValue, Math.min(data.value + inc, data.max));
|
||||
//console.log("New value ", inc, minValue, newValue);
|
||||
|
||||
@ -1298,9 +1327,8 @@ export class RdDActor extends Actor {
|
||||
let degatsReel = attackerRoll.degats - armure;
|
||||
|
||||
let result = RdDUtility.computeBlessuresSante(degatsReel, attackerRoll.mortalite);
|
||||
if ( this.data.type != 'entite') // Pas de PV chez les entités
|
||||
await this.santeIncDec("vie", result.vie, (result.critiques > 0) );
|
||||
await this.santeIncDec("endurance", result.endurance, (result.critiques > 0) );
|
||||
await this.santeIncDec("vie", result.vie);
|
||||
await this.santeIncDec("endurance", result.endurance, (result.critiques > 0));
|
||||
result.locName = (attackerRoll.loc) ? attackerRoll.loc.label : "Corps";
|
||||
|
||||
this.manageBlessures(result); // Will upate the result table
|
||||
|
@ -28,6 +28,8 @@ const competence_xp_par_niveau = [ 5, 5, 5, 10, 10, 10, 10, 15, 15, 15, 15, 20,
|
||||
const carac_array = [ "taille", "apparence", "constitution", "force", "agilite", "dexterite", "vue", "ouie", "odoratgout", "volonte", "intellect", "empathie", "reve", "chance", "melee", "tir", "lancer", "derobee"];
|
||||
const difficultesLibres = [0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10];
|
||||
const ajustementsConditions = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, +1, +2, +3, +4, +5, +6, +7, +8, +9, +10];
|
||||
const ajustementsEncaissement = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, +1, +2, +3, +4, +5, +6, +7, +8, +9, +10, +11, +12, +13, +14, +15, +16, +17, +18, +19, +20, +21, +22, +23, +24, +25];
|
||||
|
||||
|
||||
function _buildAllSegmentsFatigue(max) {
|
||||
const cycle = [5, 2, 4, 1, 3, 0];
|
||||
@ -298,6 +300,10 @@ export class RdDUtility {
|
||||
{
|
||||
return ajustementsConditions;
|
||||
}
|
||||
static getAjustementsEncaissement()
|
||||
{
|
||||
return ajustementsEncaissement;
|
||||
}
|
||||
|
||||
static getDefinitionsBlessures() {
|
||||
return definitionsBlessures;
|
||||
|
@ -58,12 +58,13 @@
|
||||
</ul>
|
||||
<div class="flex-group-center flex-actions-bar">
|
||||
<div>
|
||||
<span class="encaisser-direct"><a title="Encaisser des dommages"><img class="button-img" src="icons/svg/bones.svg" alt="Encaisser des dommages"/></a></span>
|
||||
<span class="dormir-une-heure"><a title="Dormir une heure"><img class="button-img" src="icons/svg/sleep.svg" alt="Dormir une heure"/></a></span>
|
||||
<span class="dormir-chateau-dormant"><a title="Chateau Dormant"><img class="button-img" src="systems/foundryvtt-reve-de-dragon/icons/heures/hd12.svg" alt="Chateau Dormant"/></a></span>
|
||||
<span class="monte-tmr"><a title="Montée dans les Terres Médianes !"><img class="button-img" src="systems/foundryvtt-reve-de-dragon/styles/img/ui/icon-tmr-normal.svg" alt="Montée dans les Terres Médianes !"/></a></span>
|
||||
<span class="monte-tmr-rapide"><a title="Montée accélérée dans les Terres Médianes !"><img class="button-img" src="systems/foundryvtt-reve-de-dragon/styles/img/ui/icon-tmr-rapide.svg" alt="Montée accélérée dans les Terres Médianes !"/></a></span>
|
||||
<span class="visu-tmr"><a title="Regarder les Terres Médianes"><img class="button-img" src="systems/foundryvtt-reve-de-dragon/styles/img/ui/icon-tmr-view.svg" alt="Regarder les Terres Médianes"/></a></span>
|
||||
<span id="encaisser-direct"><a title="Encaisser des dommages"><img class="button-img" src="icons/svg/bones.svg" alt="Encaisser des dommages"/></a></span>
|
||||
<span id="remise-a-neuf" class="gm-only"><a title="Remise à neuf"><img class="button-img" src="icons/svg/regen.svg" alt="Remise à neuf"/></a></span>
|
||||
<span id="dormir-une-heure"><a title="Dormir une heure"><img class="button-img" src="icons/svg/sleep.svg" alt="Dormir une heure"/></a></span>
|
||||
<span id="dormir-chateau-dormant"><a title="Chateau Dormant"><img class="button-img" src="systems/foundryvtt-reve-de-dragon/icons/heures/hd12.svg" alt="Chateau Dormant"/></a></span>
|
||||
<span id="monte-tmr"><a title="Montée dans les Terres Médianes !"><img class="button-img" src="systems/foundryvtt-reve-de-dragon/styles/img/ui/icon-tmr-normal.svg" alt="Montée dans les Terres Médianes !"/></a></span>
|
||||
<span id="monte-tmr-rapide"><a title="Montée accélérée dans les Terres Médianes !"><img class="button-img" src="systems/foundryvtt-reve-de-dragon/styles/img/ui/icon-tmr-rapide.svg" alt="Montée accélérée dans les Terres Médianes !"/></a></span>
|
||||
<span id="visu-tmr"><a title="Regarder les Terres Médianes"><img class="button-img" src="systems/foundryvtt-reve-de-dragon/styles/img/ui/icon-tmr-view.svg" alt="Regarder les Terres Médianes"/></a></span>
|
||||
</div>
|
||||
<div class="flexrow">
|
||||
<span class="tooltip">Malus de fatigue : {{data.fatigue.malus}}
|
||||
|
@ -4,7 +4,7 @@
|
||||
<label class="competence-label">Modificateurs aux Dommages:</label>
|
||||
<select class="competence-value" name="modificateurDegats" id="modificateurDegats" data-dtype="number">
|
||||
{{#select modificateurDegats}}
|
||||
{{#each ajustementsConditions as |key|}}
|
||||
{{#each ajustementsEncaissement as |key|}}
|
||||
<option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option>
|
||||
{{/each}}
|
||||
{{/select}}
|
||||
|
Loading…
Reference in New Issue
Block a user