Ajout de macros RdD

This commit is contained in:
Vincent Vandemeulebrouck
2022-12-17 00:21:02 +01:00
parent 944120b524
commit e0b6957bc6
8 changed files with 97 additions and 17 deletions

View File

@ -36,6 +36,7 @@ import { DialogValidationEncaissement } from "./dialog-validation-encaissement.j
import { RdDRencontre } from "./item-rencontre.js";
import { SystemCompendiums } from "./settings/system-compendiums.js";
import { Targets } from "./targets.js";
import { DialogRepos } from "./dialog-repos.js";
const POSSESSION_SANS_DRACONIC = {
img: 'systems/foundryvtt-reve-de-dragon/icons/entites/possession.webp',
@ -446,6 +447,38 @@ export class RdDActor extends Actor {
return '';
}
/* -------------------------------------------- */
async roll() {
const carac = mergeObject(
duplicate(this.system.carac),
{
'reve-actuel': this.getCaracReveActuel(),
'chance-actuelle': this.getCaracChanceActuelle()
});
let rollData = {
carac: carac,
selectedCarac: carac.apparence,
selectedCaracName: 'apparence',
competences: this.itemTypes['competence']
};
const dialog = await RdDRoll.create(this, rollData,
{ html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll.html' },
{
name: `jet-${this.id}`,
label: `Jet de ${this.name}`,
callbacks: [
this.createCallbackExperience(),
this.createCallbackAppelAuMoral(),
{ action: r => this._onRollCaracResult(r) }
]
}
);
dialog.render(true);
}
async repos() {
await DialogRepos.create(this.actor);
}
/* -------------------------------------------- */
async grisReve(nGrisReve) {
@ -3182,21 +3215,29 @@ export class RdDActor extends Actor {
getCaracByName(name) {
switch (Grammar.toLowerCaseNoAccent(name)) {
case 'reve-actuel': case 'reve actuel':
return {
label: 'Rêve actuel',
value: this.getReveActuel(),
type: "number"
};
return this.getCaracReveActuel();
case 'chance-actuelle': case 'chance-actuelle':
return {
label: 'Chance actuelle',
value: this.getChanceActuel(),
type: "number"
};
return this.getCaracChanceActuelle();
}
return RdDActor._findCaracByName(this.system.carac, name);
}
getCaracChanceActuelle() {
return {
label: 'Chance actuelle',
value: this.getChanceActuel(),
type: "number"
};
}
getCaracReveActuel() {
return {
label: 'Rêve actuel',
value: this.getReveActuel(),
type: "number"
};
}
/* -------------------------------------------- */
static _findCaracByName(carac, name) {
name = Grammar.toLowerCaseNoAccent(name);