|
|
|
@ -2013,130 +2013,88 @@ export class RdDActor extends Actor {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
async rollChant( id ) {
|
|
|
|
|
let chant = duplicate(this.getChant(id));
|
|
|
|
|
let competence = duplicate(this.getCompetence("chant"));
|
|
|
|
|
competence.data.defaut_carac = "ouie";
|
|
|
|
|
let chantData = {
|
|
|
|
|
competence: competence,
|
|
|
|
|
chant: chant,
|
|
|
|
|
diffLibre: -chant.data.niveau,
|
|
|
|
|
async _rollArt(artData, selectedCarac, competence, oeuvre) {
|
|
|
|
|
mergeObject(artData, {
|
|
|
|
|
oeuvre: oeuvre,
|
|
|
|
|
competence: duplicate(competence),
|
|
|
|
|
diffLibre: -oeuvre.data.niveau,
|
|
|
|
|
diffConditions: 0,
|
|
|
|
|
use: { libre: false, conditions: true, },
|
|
|
|
|
carac: {}
|
|
|
|
|
};
|
|
|
|
|
chantData.carac["ouie"] = duplicate(this.data.data.carac["ouie"]);
|
|
|
|
|
selectedCarac: duplicate(this.data.data.carac[selectedCarac]),
|
|
|
|
|
forceCarac: {}
|
|
|
|
|
});
|
|
|
|
|
artData.competence.data.defaut_carac = selectedCarac;
|
|
|
|
|
artData.forceCarac[selectedCarac] = duplicate(this.data.data.carac[selectedCarac]);
|
|
|
|
|
|
|
|
|
|
console.log("rollChant !!!", chantData);
|
|
|
|
|
console.log("rollArtiste !!!", artData);
|
|
|
|
|
|
|
|
|
|
const dialog = await RdDRoll.create(this, chantData, { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-chant.html' }, {
|
|
|
|
|
name: 'jet-chant',
|
|
|
|
|
label: 'Chanter ' + chant.name,
|
|
|
|
|
const dialog = await RdDRoll.create(this, artData, { html: `systems/foundryvtt-reve-de-dragon/templates/dialog-roll-${artData.art}.html` }, {
|
|
|
|
|
name: `jet-${artData.art}`,
|
|
|
|
|
label: `${artData.verbe} ${oeuvre.name}`,
|
|
|
|
|
height: 600,
|
|
|
|
|
callbacks: [
|
|
|
|
|
this.createCallbackExperience(),
|
|
|
|
|
{ action: r => this._chantResult(r) }
|
|
|
|
|
{ action: r => this._resultArt(r) }
|
|
|
|
|
]
|
|
|
|
|
});
|
|
|
|
|
dialog.render(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
async _chantResult(chantData) {
|
|
|
|
|
if ( chantData.rolled.isSuccess) {
|
|
|
|
|
chantData.qualiteFinale = chantData.danse.data.niveau + chantData.rolled.ptQualite;
|
|
|
|
|
} else {
|
|
|
|
|
chantData.qualiteFinale = chantData.competence.data.niveau + chantData.rolled.ptQualite;
|
|
|
|
|
}
|
|
|
|
|
console.log("CHAN", chantData)
|
|
|
|
|
RdDResolutionTable.displayRollData(chantData, this.name, 'chat-resultat-chant.html');
|
|
|
|
|
async _resultArt(artData) {
|
|
|
|
|
const baseQualite = (artData.rolled.isSuccess ? artData.oeuvre.data.niveau : artData.competence.data.niveau);
|
|
|
|
|
artData.qualiteFinale = Math.min(baseQualite, artData.oeuvre.data.niveau) + artData.rolled.ptQualite;
|
|
|
|
|
|
|
|
|
|
console.log("OEUVRE", artData.art, artData)
|
|
|
|
|
RdDResolutionTable.displayRollData(artData, this.name, `chat-resultat-${artData.art}.html`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
async rollDanse(id) {
|
|
|
|
|
let danse = duplicate(this.getDanse(id));
|
|
|
|
|
let competence = duplicate(this.getCompetence("danse"));
|
|
|
|
|
let danseData = {
|
|
|
|
|
competence: competence,
|
|
|
|
|
danse: danse,
|
|
|
|
|
diffLibre: -danse.data.niveau,
|
|
|
|
|
diffConditions: 0,
|
|
|
|
|
use: { libre: false, conditions: true, },
|
|
|
|
|
forceCarac: {}
|
|
|
|
|
};
|
|
|
|
|
if ( danse.data.agilite) {
|
|
|
|
|
competence.data.defaut_carac = "agilite";
|
|
|
|
|
danseData.selectedCarac = duplicate(this.data.data.carac["agilite"]);
|
|
|
|
|
danseData.forceCarac["agilite"] = duplicate(this.data.data.carac["agilite"]);
|
|
|
|
|
}
|
|
|
|
|
if ( danse.data.apparence) {
|
|
|
|
|
competence.data.defaut_carac = "apparence";
|
|
|
|
|
danseData.selectedCarac = duplicate(this.data.data.carac["apparence"]);
|
|
|
|
|
danseData.forceCarac["apparence"] = duplicate(this.data.data.carac["apparence"]);
|
|
|
|
|
const oeuvre = duplicate(this.getDanse(id));
|
|
|
|
|
const competence = this.getCompetence("danse");
|
|
|
|
|
const selectedCarac = this._getCaracDanse(oeuvre, competence);
|
|
|
|
|
const artData = { art: 'danse', verbe: 'Danser' };
|
|
|
|
|
await this._rollArt(artData, selectedCarac, competence, oeuvre);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log("rollDanse !!!", danseData);
|
|
|
|
|
|
|
|
|
|
const dialog = await RdDRoll.create(this, danseData, { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-danse.html' }, {
|
|
|
|
|
name: 'jet-danse',
|
|
|
|
|
label: 'Danser ' + danse.name,
|
|
|
|
|
height: 600,
|
|
|
|
|
callbacks: [
|
|
|
|
|
this.createCallbackExperience(),
|
|
|
|
|
{ action: r => this._danseResult(r) }
|
|
|
|
|
]
|
|
|
|
|
});
|
|
|
|
|
dialog.render(true);
|
|
|
|
|
}
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
async _danseResult(danseData) {
|
|
|
|
|
if ( danseData.rolled.isSuccess) {
|
|
|
|
|
danseData.qualiteFinale = danseData.danse.data.niveau + danseData.rolled.ptQualite;
|
|
|
|
|
} else {
|
|
|
|
|
danseData.qualiteFinale = danseData.competence.data.niveau + danseData.rolled.ptQualite;
|
|
|
|
|
}
|
|
|
|
|
console.log("CHAN", danseData)
|
|
|
|
|
RdDResolutionTable.displayRollData(danseData, this.name, 'chat-resultat-danse.html');
|
|
|
|
|
_getCaracDanse(oeuvre, competence) {
|
|
|
|
|
if (oeuvre.data.agilite) { return "agilite"; }
|
|
|
|
|
else if (oeuvre.data.apparence) { return "apparence"; }
|
|
|
|
|
return competence.data.defaut_carac;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
async rollMusique(id) {
|
|
|
|
|
let musique = duplicate(this.getMusique(id));
|
|
|
|
|
let competence = duplicate(this.getCompetence("musique"));
|
|
|
|
|
competence.data.defaut_carac = "ouie";
|
|
|
|
|
let musiqueData = {
|
|
|
|
|
competence: competence,
|
|
|
|
|
musique: musique,
|
|
|
|
|
diffLibre: -musique.data.niveau,
|
|
|
|
|
diffConditions: 0,
|
|
|
|
|
use: { libre: false, conditions: true, },
|
|
|
|
|
carac: {}
|
|
|
|
|
};
|
|
|
|
|
musiqueData.carac["ouie"] = duplicate(this.data.data.carac["ouie"]);
|
|
|
|
|
|
|
|
|
|
console.log("rollMusique !!!", musiqueData);
|
|
|
|
|
|
|
|
|
|
const dialog = await RdDRoll.create(this, musiqueData, { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-musique.html' }, {
|
|
|
|
|
name: 'jet-musique',
|
|
|
|
|
label: 'Jouer ' + musique.name,
|
|
|
|
|
height: 600,
|
|
|
|
|
callbacks: [
|
|
|
|
|
this.createCallbackExperience(),
|
|
|
|
|
{ action: r => this._musiqueResult(r) }
|
|
|
|
|
]
|
|
|
|
|
});
|
|
|
|
|
dialog.render(true);
|
|
|
|
|
const oeuvre = duplicate(this.getMusique(id));
|
|
|
|
|
const competence = this.getCompetence("musique");
|
|
|
|
|
const selectedCarac = "ouie";
|
|
|
|
|
const artData = { art: 'musique', verbe: 'Jouer' };
|
|
|
|
|
await this._rollArt(artData, selectedCarac, competence, oeuvre);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
async _musiqueResult(musiqueData) {
|
|
|
|
|
if ( musiqueData.rolled.isSuccess) {
|
|
|
|
|
musiqueData.qualiteFinale = musiqueData.musique.data.niveau + musiqueData.rolled.ptQualite;
|
|
|
|
|
} else {
|
|
|
|
|
musiqueData.qualiteFinale = musiqueData.competence.data.niveau + musiqueData.rolled.ptQualite;
|
|
|
|
|
async rollRecetteCuisine(id) {
|
|
|
|
|
const oeuvre = duplicate(this.getRecetteCuisine(id));
|
|
|
|
|
const competence = this.getCompetence("cuisine");
|
|
|
|
|
const selectedCarac = 'odoratgout';
|
|
|
|
|
const artData = { art: 'cuisine', verbe: 'Cuisiner' };
|
|
|
|
|
await this._rollArt(artData, selectedCarac, competence, oeuvre);
|
|
|
|
|
}
|
|
|
|
|
console.log("MUSIQUE", musiqueData)
|
|
|
|
|
RdDResolutionTable.displayRollData(musiqueData, this.name, 'chat-resultat-musique.html');
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
async rollJeu(id) {
|
|
|
|
|
const oeuvre = duplicate(this.getJeu(id));
|
|
|
|
|
const competence = this.getCompetence("jeu");
|
|
|
|
|
const selectedCarac = competence.data.defaut_carac;
|
|
|
|
|
const artData = {
|
|
|
|
|
art: 'jeu', verbe: 'Jeu',
|
|
|
|
|
use: { libre: true, conditions: true, },
|
|
|
|
|
};
|
|
|
|
|
await this._rollArt(artData, selectedCarac, competence, oeuvre);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
async rollJeu( id ) {
|
|
|
|
|
let jeu = duplicate(this.getJeu(id));
|
|
|
|
@ -2169,45 +2127,6 @@ export class RdDActor extends Actor {
|
|
|
|
|
RdDResolutionTable.displayRollData(jeudData, this.name, 'chat-resultat-jeu.html');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
async rollRecetteCuisine( id ) {
|
|
|
|
|
let cuisine = duplicate(this.getRecetteCuisine(id));
|
|
|
|
|
let competence = duplicate(this.getCompetence("cuisine"));
|
|
|
|
|
competence.data.defaut_carac = "odoratgout";
|
|
|
|
|
let cuisineData = {
|
|
|
|
|
competence: competence,
|
|
|
|
|
cuisine: cuisine,
|
|
|
|
|
diffLibre: -cuisine.data.niveau,
|
|
|
|
|
diffConditions: 0,
|
|
|
|
|
use: { libre: true, conditions: true, },
|
|
|
|
|
carac: {}
|
|
|
|
|
};
|
|
|
|
|
cuisineData.carac["odoratgout"] = duplicate(this.data.data.carac["odoratgout"]);
|
|
|
|
|
|
|
|
|
|
console.log("rollRecetteCuisine !!!", cuisineData);
|
|
|
|
|
|
|
|
|
|
const dialog = await RdDRoll.create(this, cuisineData, { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-cuisine.html' }, {
|
|
|
|
|
name: 'jet-jeu',
|
|
|
|
|
label: 'Cuisiner ' + cuisine.name,
|
|
|
|
|
height: 600,
|
|
|
|
|
callbacks: [
|
|
|
|
|
this.createCallbackExperience(),
|
|
|
|
|
{ action: r => this._recetteCuisineResult(r) }
|
|
|
|
|
]
|
|
|
|
|
});
|
|
|
|
|
dialog.render(true);
|
|
|
|
|
}
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
async _recetteCuisineResult(cuisineData) {
|
|
|
|
|
if ( cuisineData.rolled.isSuccess) {
|
|
|
|
|
cuisineData.qualiteFinale = cuisineData.cuisine.data.niveau + cuisineData.rolled.ptQualite;
|
|
|
|
|
} else {
|
|
|
|
|
cuisineData.qualiteFinale = cuisineData.competence.data.niveau + cuisineData.rolled.ptQualite;
|
|
|
|
|
}
|
|
|
|
|
console.log("Cuisine", cuisineData)
|
|
|
|
|
RdDResolutionTable.displayRollData(cuisineData, this.name, 'chat-resultat-cuisine.html');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
async rollMeditation(id) {
|
|
|
|
|