Ajout des options d'appréciation
L'appréciation utilise: - un niveau de qualité (qui réutilise la qualité sur les items en ayant) - un bon moment (coeur/musique/...) - un niveau de jet de moral - une caractéristique (perception) - une compétence Les bon moments passés sont remis à zéro lors du passage de château dormant. Ajout des jets de moral très heureux. Ajout de jet d'appréciation sur les résultats des oeuvres et des jeux.
This commit is contained in:
@@ -18,6 +18,7 @@ import { RdDBaseActorSangSheet } from "./actor/base-actor-sang-sheet.js";
|
||||
import { RdDCoeur } from "./coeur/rdd-coeur.js";
|
||||
import { AppPersonnageAleatoire } from "./actor/random/app-personnage-aleatoire.js";
|
||||
import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
|
||||
import { MORAL } from "./moral/apprecier.mjs";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/**
|
||||
@@ -275,9 +276,9 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
|
||||
this.html.find('.seuil-reve-value').change(async event => await this.actor.setPointsDeSeuil(event.currentTarget.value))
|
||||
|
||||
this.html.find('.stress-test').click(async event => await this.actor.transformerStress())
|
||||
this.html.find('.moral-malheureux').click(async event => await this.actor.jetDeMoral('malheureuse'))
|
||||
this.html.find('.moral-neutre').click(async event => await this.actor.jetDeMoral('neutre'))
|
||||
this.html.find('.moral-heureux').click(async event => await this.actor.jetDeMoral('heureuse'))
|
||||
this.html.find('.moral-malheureux').click(async event => await this.actor.jetDeMoral(MORAL.MALHEUREUX))
|
||||
this.html.find('.moral-neutre').click(async event => await this.actor.jetDeMoral(MORAL.NEUTRE))
|
||||
this.html.find('.moral-heureux').click(async event => await this.actor.jetDeMoral(MORAL.HEUREUX))
|
||||
this.html.find('.button-ethylisme').click(async event => await this.actor.jetEthylisme())
|
||||
|
||||
this.html.find('.ptreve-actuel-plus').click(async event => await this.actor.reveActuelIncDec(1))
|
||||
|
||||
@@ -19,7 +19,7 @@ import { DialogConsommer } from "./dialog-item-consommer.js";
|
||||
import { DialogFabriquerPotion } from "./dialog-fabriquer-potion.js";
|
||||
import { RollDataAjustements } from "./rolldata-ajustements-v1.js";
|
||||
import { RdDPossession } from "./rdd-possession.js";
|
||||
import { ACTOR_TYPES, RDD_CONFIG, renderTemplate, SHOW_DICE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js";
|
||||
import { ACTOR_TYPES, renderTemplate, SHOW_DICE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js";
|
||||
import { RdDConfirm } from "./rdd-confirm.js";
|
||||
import { DialogRepos } from "./sommeil/dialog-repos.js";
|
||||
import { RdDBaseActor } from "./actor/base-actor.js";
|
||||
@@ -53,6 +53,7 @@ import { PART_COMP } from "./roll/roll-part-comp.mjs";
|
||||
import { PART_OEUVRE } from "./roll/roll-part-oeuvre.mjs";
|
||||
import { PART_CUISINE } from "./roll/roll-part-cuisine.mjs";
|
||||
import { RdDPossessionV2 } from "./rdd-possession-v2.mjs";
|
||||
import { MORAL, SITUATION_MORAL } from "./moral/apprecier.mjs";
|
||||
|
||||
export const MAINS_DIRECTRICES = ['Droitier', 'Gaucher', 'Ambidextre']
|
||||
|
||||
@@ -362,15 +363,15 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
content: ""
|
||||
};
|
||||
|
||||
await this._recuperationSante(message);
|
||||
await this._recupereMoralChateauDormant(message);
|
||||
await this._recupereChance();
|
||||
await this.transformerStress();
|
||||
await this.retourSeuilDeReve(message);
|
||||
await this.setBonusPotionSoin(0);
|
||||
await this.retourSust(message);
|
||||
await this.$perteReveEnchantementsChateauDormants();
|
||||
await this.$suppressionLancementsSort();
|
||||
await this._recuperationSante(message)
|
||||
await this._recupereMoralChateauDormant(message)
|
||||
await this._recupereChance()
|
||||
await this.transformerStress()
|
||||
await this.retourSeuilDeReve(message)
|
||||
await this.setBonusPotionSoin(0)
|
||||
await this.retourSust(message)
|
||||
await this.$perteReveEnchantementsChateauDormants()
|
||||
await this.$suppressionLancementsSort()
|
||||
await RdDCoeur.applyCoeurChateauDormant(this, message);
|
||||
if (message.content != "") {
|
||||
message.content = `A la fin Chateau Dormant, ${message.content}<br>Un nouveau jour se lève`;
|
||||
@@ -414,11 +415,13 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
}
|
||||
|
||||
async _recupereMoralChateauDormant(message) {
|
||||
await this.update({ 'system.compteurs.bonmoments': [] }, { render: false })
|
||||
|
||||
if (!ReglesOptionnelles.isUsing("recuperation-moral")) { return }
|
||||
|
||||
const etatMoral = this.system.sommeil?.moral ?? 'neutre';
|
||||
const jetMoral = await this._jetDeMoral(etatMoral);
|
||||
message.content += ` -- le jet de moral est ${etatMoral}, le moral ` + this._messageAjustementMoral(jetMoral.ajustement);
|
||||
const etatMoral = this.system.sommeil?.moral ?? MORAL.NEUTRE
|
||||
const jetMoral = await this._jetDeMoral(etatMoral)
|
||||
message.content += ` -- le jet de moral est ${etatMoral}, le moral ` + this._messageAjustementMoral(jetMoral.ajustement)
|
||||
}
|
||||
|
||||
_messageAjustementMoral(ajustement) {
|
||||
@@ -1195,17 +1198,21 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async jetDeMoral(situation, messageReussi = undefined, messageManque = undefined) {
|
||||
const jetMoral = await this._jetDeMoral(situation);
|
||||
const finMessage = (jetMoral.succes ? messageReussi : messageManque) ?? (jetMoral.ajustement == 0 ? "Vous gardez votre moral" : jetMoral.ajustement > 0 ? "Vous gagnez du moral" : "Vous perdez du moral");
|
||||
async jetDeMoral(situation, bonmoment = "") {
|
||||
if (bonmoment != "" && bonmoment != undefined && this.system.compteurs.bonmoments.includes(bonmoment)) {
|
||||
ui.notifications.info(`${this.name} a déjà gagné du moral après avoir passé un bon moment (${bonmoment}) pendant la journée, pas de gain de moral`)
|
||||
return
|
||||
}
|
||||
const jetMoral = await this._jetDeMoral(situation, bonmoment)
|
||||
const finMessage = (jetMoral.ajustement == 0 ? "Vous gardez votre moral" : jetMoral.ajustement > 0 ? "Vous gagnez du moral" : "Vous perdez du moral");
|
||||
ChatMessage.create({
|
||||
whisper: ChatUtility.getOwners(this),
|
||||
content: `${finMessage} - jet ${jetMoral.succes ? "réussi" : "manqué"} en situation ${situation} (${jetMoral.jet}/${jetMoral.difficulte}).`
|
||||
});
|
||||
return jetMoral.ajustement;
|
||||
content: `${finMessage} - jet ${jetMoral.succes ? "réussi" : "manqué"} en situation ${SITUATION_MORAL[situation] ?? situation} (${jetMoral.jet}/${jetMoral.difficulte}).`
|
||||
})
|
||||
return jetMoral.ajustement
|
||||
}
|
||||
|
||||
async _jetDeMoral(situation) {
|
||||
async _jetDeMoral(situation, bonmoment = "") {
|
||||
const moralActuel = Misc.toInt(this.system.compteurs.moral.value);
|
||||
const jet = await RdDDice.rollTotal("1d20");
|
||||
const difficulte = 10 + moralActuel;
|
||||
@@ -1217,14 +1224,18 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
difficulte: difficulte,
|
||||
succes: succes,
|
||||
ajustement: this._calculAjustementMoral(succes, moralActuel, situation)
|
||||
};
|
||||
await this.moralIncDec(jetMoral.ajustement);
|
||||
}
|
||||
await this.moralIncDec(jetMoral.ajustement, bonmoment);
|
||||
return jetMoral;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async moralIncDec(ajustementMoral) {
|
||||
async moralIncDec(ajustementMoral, bonmoment = "") {
|
||||
if (ajustementMoral != 0) {
|
||||
if (ajustementMoral > 0 && bonmoment != "" && bonmoment != undefined) {
|
||||
const bonmoments = [...this.system.compteurs.bonmoments, bonmoment]
|
||||
await this.update({ 'system.compteurs.bonmoments': bonmoments }, { render: false })
|
||||
}
|
||||
const startMoral = parseInt(this.system.compteurs.moral.value)
|
||||
const moralTheorique = startMoral + ajustementMoral
|
||||
if (moralTheorique > 3) { // exaltation
|
||||
@@ -1245,13 +1256,14 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
/* -------------------------------------------- */
|
||||
_calculAjustementMoral(succes, moral, situation) {
|
||||
switch (situation) {
|
||||
case 'heureux': case 'heureuse': return succes ? 1 : 0;
|
||||
case 'malheureuse': case 'malheureux': return succes ? 0 : -1;
|
||||
case 'neutre':
|
||||
if (succes && moral < 0) return 1;
|
||||
if (!succes && moral > 0) return -1;
|
||||
case MORAL.TRESHEUREUX: return succes ? 2 : 1
|
||||
case MORAL.HEUREUX: case 'heureuse': return succes ? 1 : 0
|
||||
case MORAL.MALHEUREUX: case 'malheureuse': return succes ? 0 : -1
|
||||
case MORAL.NEUTRE:
|
||||
if (succes && moral < 0) return 1
|
||||
if (!succes && moral > 0) return -1
|
||||
}
|
||||
return 0;
|
||||
return 0
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@@ -1331,7 +1343,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
await this.apprecier(CARACS.ODORATGOUT, 'cuisine', item.system.qualite, item.system.boisson ? "apprécie la boisson" : "apprécie le plat");
|
||||
}
|
||||
else if (seForcer) {
|
||||
await this.jetDeMoral('malheureux');
|
||||
await this.jetDeMoral(MORAL.MALHEUREUX);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
@@ -1362,7 +1374,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
}
|
||||
const rolled = await this.doRollCaracCompetence(carac, undefined, 0, { title });
|
||||
if (rolled?.isSuccess) {
|
||||
await this.jetDeMoral('heureux');
|
||||
await this.jetDeMoral(MORAL.HEUREUX);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1429,7 +1441,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
ethylismeData.perteEndurance = await this.santeIncDec("endurance", -perte);
|
||||
|
||||
if (!ethylisme.jet_moral) {
|
||||
ethylismeData.jetMoral = await this._jetDeMoral('heureuse');
|
||||
ethylismeData.jetMoral = await this._jetDeMoral(MORAL.HEUREUX, "Ethylisme");
|
||||
if (ethylismeData.jetMoral.ajustement == 1) {
|
||||
ethylismeData.moralAlcool = 'heureux';
|
||||
ethylisme.jet_moral = true;
|
||||
@@ -1437,7 +1449,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
ethylismeData.jetMoral.ajustement = -1;
|
||||
ethylismeData.moralAlcool = 'triste';
|
||||
ethylisme.jet_moral = true;
|
||||
await this.moralIncDec(-1);
|
||||
await this.moralIncDec(-1, "Ethylisme");
|
||||
}
|
||||
}
|
||||
if (ethylisme.value < 0) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { RdDBaseActor } from "../actor/base-actor.js";
|
||||
import { ChatUtility } from "../chat-utility.js";
|
||||
import { renderTemplate } from "../constants.js";
|
||||
import { MORAL } from "../moral/apprecier.mjs";
|
||||
|
||||
const INFO_COEUR = 'info-coeur';
|
||||
|
||||
@@ -122,7 +123,7 @@ export class RdDCoeur {
|
||||
const diff = Math.abs(infoCoeur.source.jetTendre - infoCoeur.target.jetTendre)
|
||||
for (let amoureux of [infoCoeur.source, infoCoeur.target]) {
|
||||
const actorAmoureux = game.actors.get(amoureux.actor.id);
|
||||
amoureux.situation = diff <= amoureux.coeur ? 'heureux' : 'neutre'
|
||||
amoureux.situation = diff <= amoureux.coeur ? MORAL.HEUREUX : MORAL.NEUTRE
|
||||
amoureux.gainMoral = await actorAmoureux.jetDeMoral(amoureux.situation)
|
||||
}
|
||||
const chatHtml = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/coeur/chat-accepter-tendre-moment.hbs`, infoCoeur)
|
||||
|
||||
@@ -3,6 +3,7 @@ import { renderTemplate } from "./constants.js"
|
||||
export class DialogSelect extends Dialog {
|
||||
static extractIdNameImg(it) { return { id: it.id, name: it.name, img: it.img } }
|
||||
|
||||
|
||||
static async select(selectionData, onSelectChoice) {
|
||||
const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/dialog-select.hbs", selectionData)
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ import { RdDTimestamp } from "./time/rdd-timestamp.js";
|
||||
import { FLEUVE_COORD, TMRUtility } from "./tmr-utility.js";
|
||||
import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
|
||||
import { ItemAction } from "./item/item-actions.js";
|
||||
import { SANS_COMPETENCE } from "./item/base-items.js";
|
||||
import { Apprecier } from "./moral/apprecier.mjs";
|
||||
|
||||
/**
|
||||
* Extend the basic ItemSheet for RdD specific items
|
||||
@@ -89,6 +91,7 @@ export class RdDItemSheetV1 extends foundry.appv1.sheets.ItemSheet {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async getData() {
|
||||
const competences = (await SystemCompendiums.getCompetences(ACTOR_TYPES.personnage))
|
||||
let formData = {
|
||||
title: this.item.name,
|
||||
id: this.item.id,
|
||||
@@ -101,8 +104,9 @@ export class RdDItemSheetV1 extends foundry.appv1.sheets.ItemSheet {
|
||||
descriptionmj: await RdDTextEditor.enrichHTML(this.item.system.descriptionmj, this.item),
|
||||
isComestible: this.item.getUtilisationCuisine(),
|
||||
options: RdDSheetUtility.mergeDocumentRights({}, this.item, this.isEditable),
|
||||
competences: await SystemCompendiums.getCompetences(ACTOR_TYPES.personnage),
|
||||
competences: [SANS_COMPETENCE, ...competences],
|
||||
categories: RdDItem.getCategories(this.item.type),
|
||||
isAppreciable: Apprecier.isAppreciable(this.item)
|
||||
}
|
||||
|
||||
if (this.item.type == ITEM_TYPES.competencecreature) {
|
||||
|
||||
@@ -28,7 +28,7 @@ const typesInventaireMateriel = [
|
||||
]
|
||||
const typesInventaire = {
|
||||
materiel: typesInventaireMateriel,
|
||||
all: ['service'].concat(typesInventaireMateriel),
|
||||
all: [ITEM_TYPES.service].concat(typesInventaireMateriel),
|
||||
}
|
||||
|
||||
const typesObjetsOeuvres = [ITEM_TYPES.oeuvre, ITEM_TYPES.recettecuisine, ITEM_TYPES.musique, ITEM_TYPES.chant, ITEM_TYPES.danse, ITEM_TYPES.jeu]
|
||||
@@ -36,6 +36,10 @@ const typesObjetsDraconiques = [ITEM_TYPES.queue, ITEM_TYPES.ombre, ITEM_TYPES.s
|
||||
const typesObjetsConnaissance = [ITEM_TYPES.meditation, ITEM_TYPES.recettealchimique, ITEM_TYPES.sort]
|
||||
const typesObjetsEffet = [ITEM_TYPES.possession, ITEM_TYPES.poison, ITEM_TYPES.maladie, ITEM_TYPES.blessure]
|
||||
const typesObjetsCompetence = [ITEM_TYPES.competence, ITEM_TYPES.competencecreature]
|
||||
const typesAppreciable = [
|
||||
ITEM_TYPES.oeuvre, ITEM_TYPES.musique, ITEM_TYPES.chant, ITEM_TYPES.danse, ITEM_TYPES.nourritureboisson,
|
||||
ITEM_TYPES.jeu, ITEM_TYPES.service
|
||||
]
|
||||
const typesObjetsTemporels = [ITEM_TYPES.blessure, ITEM_TYPES.poison, ITEM_TYPES.maladie, ITEM_TYPES.queue, ITEM_TYPES.ombre, ITEM_TYPES.souffle, ITEM_TYPES.signedraconique, ITEM_TYPES.rencontre]
|
||||
const typesObjetsEquipable = [ITEM_TYPES.arme, ITEM_TYPES.armure, ITEM_TYPES.objet];
|
||||
const typesEnvironnement = typesInventaireMateriel;
|
||||
@@ -96,14 +100,14 @@ export class RdDItem extends Item {
|
||||
switch (field) {
|
||||
case 'quantite':
|
||||
if (ITEM_TYPES.conteneur == type) {
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
break;
|
||||
case 'cout':
|
||||
if (ITEM_TYPES.monnaie == type) {
|
||||
return game.user.isGM;
|
||||
}
|
||||
break;
|
||||
break
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -180,10 +184,10 @@ export class RdDItem extends Item {
|
||||
|
||||
isCompetencePersonnage() { return this.type == ITEM_TYPES.competence }
|
||||
isCompetenceCreature() { return this.type == ITEM_TYPES.competencecreature }
|
||||
isConteneur() { return this.type == ITEM_TYPES.conteneur; }
|
||||
isMonnaie() { return this.type == ITEM_TYPES.monnaie; }
|
||||
isConteneur() { return this.type == ITEM_TYPES.conteneur }
|
||||
isMonnaie() { return this.type == ITEM_TYPES.monnaie }
|
||||
isNourritureBoisson() { return this.type == ITEM_TYPES.nourritureboisson; }
|
||||
isService() { return this.type == ITEM_TYPES.service; }
|
||||
isService() { return this.type == ITEM_TYPES.service }
|
||||
isAttaque() { return false }
|
||||
isParade() { return false }
|
||||
isBouclier() { return false }
|
||||
@@ -214,6 +218,7 @@ export class RdDItem extends Item {
|
||||
isConnaissance() { return typesObjetsConnaissance.includes(this.type) }
|
||||
|
||||
isInventaire(mode = 'materiel') { return RdDItem.getItemTypesInventaire(mode).includes(this.type); }
|
||||
isAppreciable() { return typesAppreciable.includes(this.type) }
|
||||
isBoisson() { return this.isNourritureBoisson() && this.system.boisson; }
|
||||
isAlcool() { return this.isNourritureBoisson() && this.system.boisson && this.system.alcoolise; }
|
||||
isHerbeAPotion() { return this.type == ITEM_TYPES.herbe && (this.system.categorie == 'Soin' || this.system.categorie == 'Repos'); }
|
||||
|
||||
@@ -8,6 +8,7 @@ import { RdDTimestamp } from "./time/rdd-timestamp.js";
|
||||
import { RdDRaretes } from "./item/raretes.js";
|
||||
import { VOIES_DRACONIC } from "./item-sort.js";
|
||||
import { SystemCompendiums } from "./settings/system-compendiums.js";
|
||||
import { APPRECIATION } from "./moral/apprecier.mjs";
|
||||
|
||||
class Migration {
|
||||
get code() { return "sample"; }
|
||||
@@ -33,7 +34,6 @@ class Migration {
|
||||
await Item.updateDocuments(itemUpdates);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class _1_5_34_migrationPngWebp {
|
||||
@@ -662,6 +662,37 @@ class _13_0_7_FixNiveauOeuvres extends Migration {
|
||||
}
|
||||
}
|
||||
|
||||
class _13_0_21_AjoutAppreciation extends Migration {
|
||||
get code() { return "ajout-appreciation" }
|
||||
get version() { return "13.0.21" }
|
||||
|
||||
async migrate() {
|
||||
await this.applyItemsUpdates(items => items
|
||||
.filter(it => it.isAppreciable())
|
||||
.filter(it => this.getBaseAppreciation(it))
|
||||
.map(it => {
|
||||
return { _id: it.id, 'system.appreciation': this.getBaseAppreciation(it) }
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
getBaseAppreciation(item) {
|
||||
switch (item.type) {
|
||||
case ITEM_TYPES.nourritureboisson: return APPRECIATION.CUISINE
|
||||
case ITEM_TYPES.service: return APPRECIATION.SERVICE
|
||||
case ITEM_TYPES.musique: return APPRECIATION.MUSIQUE
|
||||
case ITEM_TYPES.chant: return APPRECIATION.CHANT
|
||||
case ITEM_TYPES.danse: return APPRECIATION.DANSE
|
||||
case ITEM_TYPES.oeuvre: {
|
||||
const appreciation = foundry.utils.duplicate(APPRECIATION.OEUVRE)
|
||||
appreciation.competence = item.system.competence
|
||||
return appreciation
|
||||
}
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
export class Migrations {
|
||||
static getMigrations() {
|
||||
return [
|
||||
@@ -687,6 +718,7 @@ export class Migrations {
|
||||
new _12_0_38_TachesEcriture(),
|
||||
new _13_0_4_FixReveActuel(),
|
||||
new _13_0_7_FixNiveauOeuvres(),
|
||||
new _13_0_21_AjoutAppreciation(),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -707,7 +739,10 @@ export class Migrations {
|
||||
}
|
||||
if (foundry.utils.isNewerVersion(game.system.version, currentVersion)) {
|
||||
// if (true) { /* comment previous and uncomment here to test before upgrade */
|
||||
const migrations = Migrations.getMigrations().filter(m => foundry.utils.isNewerVersion(m.version, currentVersion));
|
||||
const migrations = Migrations.getMigrations().filter(m => foundry.utils.isNewerVersion(m.version, currentVersion)
|
||||
/* uncomment and set the version to migrate to to force a migration */
|
||||
// ||m.version == "13.0.21"
|
||||
)
|
||||
if (migrations.length > 0) {
|
||||
migrations.sort((a, b) => this.compareVersions(a, b));
|
||||
migrations.forEach(async (m) => {
|
||||
|
||||
166
module/moral/apprecier.mjs
Normal file
166
module/moral/apprecier.mjs
Normal file
@@ -0,0 +1,166 @@
|
||||
import { ITEM_TYPES } from "../constants.js"
|
||||
import { SANS_COMPETENCE } from "../item/base-items.js"
|
||||
import { CARACS } from "../rdd-carac.js"
|
||||
import { RdDUtility } from "../rdd-utility.js"
|
||||
import { DIFF } from "../roll/roll-constants.mjs"
|
||||
import RollDialog from "../roll/roll-dialog.mjs"
|
||||
import { PART_COMP } from "../roll/roll-part-comp.mjs"
|
||||
|
||||
export const MORAL = {
|
||||
MALHEUREUX: "malheureux",
|
||||
NEUTRE: "neutre",
|
||||
HEUREUX: "heureux",
|
||||
TRESHEUREUX: "très heureux"
|
||||
}
|
||||
export const SITUATION_MORAL = {
|
||||
[MORAL.MALHEUREUX]: "malheureuse",
|
||||
[MORAL.NEUTRE]: "neutre",
|
||||
[MORAL.HEUREUX]: "heureuse",
|
||||
[MORAL.TRESHEUREUX]: "très heureuse",
|
||||
}
|
||||
export const APPRECIATION = {
|
||||
CUISINE: {
|
||||
bonmoment: "Cuisine", carac: CARACS.ODORATGOUT, competence: "Cuisine",
|
||||
moral: MORAL.HEUREUX, jetComp: false, jetQualite: false, compMinimum: true
|
||||
},
|
||||
MUSIQUE: {
|
||||
bonmoment: "Musique", carac: CARACS.OUIE, competence: "Musique",
|
||||
moral: MORAL.HEUREUX, jetComp: false, jetQualite: false, compMinimum: true
|
||||
},
|
||||
CHANT: {
|
||||
bonmoment: "Musique", carac: CARACS.OUIE, competence: "Chant",
|
||||
moral: MORAL.HEUREUX, jetComp: false, jetQualite: false, compMinimum: true
|
||||
},
|
||||
DANSE: {
|
||||
bonmoment: "Spectacle", carac: CARACS.EMPATHIE, competence: "Danse",
|
||||
moral: MORAL.HEUREUX, jetComp: false, jetQualite: false, compMinimum: true
|
||||
},
|
||||
JEU: {
|
||||
bonmoment: "Jeu", carac: CARACS.EMPATHIE, competence: "Jeu",
|
||||
moral: MORAL.HEUREUX, jetComp: false, jetQualite: false, compMinimum: true
|
||||
},
|
||||
OEUVRE: {
|
||||
bonmoment: "Spectacle", carac: CARACS.EMPATHIE, competence: "",
|
||||
moral: MORAL.HEUREUX, jetComp: false, jetQualite: false, compMinimum: true
|
||||
},
|
||||
SERVICE: {
|
||||
bonmoment: "Confort", carac: CARACS.EMPATHIE, competence: "",
|
||||
moral: MORAL.HEUREUX, jetComp: false, jetQualite: false, compMinimum: false
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
export class Apprecier {
|
||||
|
||||
static isAppreciable(item) {
|
||||
switch (item.type) {
|
||||
case ITEM_TYPES.nourritureboisson:
|
||||
case ITEM_TYPES.service:
|
||||
return item.system.qualite > 0
|
||||
case ITEM_TYPES.chant:
|
||||
case ITEM_TYPES.musique:
|
||||
case ITEM_TYPES.danse:
|
||||
case ITEM_TYPES.oeuvre:
|
||||
case ITEM_TYPES.jeu:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
static qualite(qualite, roll = undefined, comp = undefined) {
|
||||
if (roll && comp) {
|
||||
return roll.rolled.isSuccess ? qualite : Math.min(qualite, comp.system.niveau)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
static getAppreciation(qualite, appreciable, roll = undefined, comp = undefined) {
|
||||
return {
|
||||
qualite: (roll?.rolled.ptQualite ?? 0) + Apprecier.qualite(qualite, roll, comp),
|
||||
appreciation: foundry.utils.duplicate(appreciable.system.appreciation),
|
||||
messages: []
|
||||
}
|
||||
}
|
||||
|
||||
static onClickApprecier(roll) {
|
||||
const appreciation = roll.result.appreciation
|
||||
if (appreciation.moral == "") {
|
||||
return
|
||||
}
|
||||
RdDUtility.doWithSelectedActor(
|
||||
actor => new Apprecier(actor, appreciation, roll.result.qualite).apprecier(),
|
||||
actor => actor.isPersonnage())
|
||||
}
|
||||
|
||||
constructor(actor, appreciation, qualite) {
|
||||
this.actor = actor
|
||||
this.appreciation = foundry.utils.duplicate(appreciation)
|
||||
this.appreciation.situation = SITUATION_MORAL[appreciation.moral]
|
||||
this.qualite = qualite
|
||||
this.raisons = []
|
||||
}
|
||||
|
||||
apprecier() {
|
||||
if (this.qualite <= 0) {
|
||||
this.raisons.push(`la qualité ${this.qualite} est négative.`)
|
||||
}
|
||||
if (this.qualite <= this.actor.getMoralTotal()) {
|
||||
this.raisons.push(`la qualité de ${this.qualite} est inférieure au moral de ${this.actor.getMoralTotal()}.`)
|
||||
}
|
||||
const competence = this.actor.getCompetence(this.appreciation.competence) ?? SANS_COMPETENCE
|
||||
if (this.appreciation.compMinimum && this.qualite <= competence.system.niveau && competence.system.niveau > 0) {
|
||||
this.raisons.push(`la qualité ${this.qualite} est insuffisante pour le niveau ${competence.system.niveau} en ${this.appreciation.competence}`)
|
||||
}
|
||||
const bonmoment = this.appreciation.bonmoment
|
||||
if (!["", undefined].includes(bonmoment) && this.actor.system.compteurs.bonmoments.includes(bonmoment)) {
|
||||
this.raisons.push(`du moral a déjà été gagné pour cause de ${bonmoment}`)
|
||||
}
|
||||
|
||||
if (this.appreciation.carac != "") {
|
||||
this.rollAppreciation()
|
||||
}
|
||||
else {
|
||||
this.rollMoral()
|
||||
}
|
||||
}
|
||||
|
||||
rollAppreciation() {
|
||||
const competence = (this.appreciation.jetComp && this.appreciation.competence) ? this.appreciation.competence : ""
|
||||
const rollData = {
|
||||
ids: { actorId: this.actor.id },
|
||||
type: { allowed: [PART_COMP], current: PART_COMP, appreciation: true },
|
||||
selected: {
|
||||
carac: { key: this.appreciation.carac, forced: true },
|
||||
comp: { key: competence, forced: true },
|
||||
diff: { type: DIFF.IMPOSEE },
|
||||
apprecier: {
|
||||
appreciation: this.appreciation,
|
||||
qualite: this.qualite,
|
||||
raisons: this.raisons
|
||||
}
|
||||
}
|
||||
}
|
||||
RollDialog.create(rollData, { callbacks: [async r => await this.onRollAppreciation(r)] })
|
||||
}
|
||||
|
||||
async onRollAppreciation(roll) {
|
||||
if (roll.rolled.isSuccess) {
|
||||
await this.rollMoral()
|
||||
}
|
||||
else {
|
||||
if (this.appreciation.moral == MORAL.TRESHEUREUX) {
|
||||
await this.rollMoral(MORAL.HEUREUX)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async rollMoral(moral = undefined) {
|
||||
if (this.raisons.length > 0) {
|
||||
return
|
||||
}
|
||||
|
||||
moral = moral ?? this.appreciation.moral
|
||||
// TODO: jet de moral
|
||||
await this.actor.jetDeMoral(moral, this.appreciation.bonmoment)
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ import { RdDEmpoignade } from "./rdd-empoignade.js";
|
||||
import { ExperienceLog } from "./actor/experience-log.js";
|
||||
import { RdDCoeur } from "./coeur/rdd-coeur.js";
|
||||
import { APP_ASTROLOGIE_REFRESH } from "./sommeil/app-astrologie.js";
|
||||
import { ITEM_TYPES, RDD_CONFIG, SYSTEM_RDD } from "./constants.js";
|
||||
import { ACTOR_TYPES, ITEM_TYPES, RDD_CONFIG, SYSTEM_RDD } from "./constants.js";
|
||||
import { RdDBaseActor } from "./actor/base-actor.js";
|
||||
import { RdDCarac } from "./rdd-carac.js";
|
||||
import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
|
||||
@@ -26,6 +26,8 @@ import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
|
||||
import { RdDItemCompetence } from "./item-competence.js";
|
||||
import { Monnaie } from "./item-monnaie.js";
|
||||
import { ItemAction } from "./item/item-actions.js";
|
||||
import { Targets } from "./targets.js";
|
||||
import { DialogSelect } from "./dialog-select.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
// This table starts at 0 -> niveau -10
|
||||
@@ -180,9 +182,14 @@ export class RdDUtility {
|
||||
'systems/foundryvtt-reve-de-dragon/templates/item/partial-inventaire.hbs',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/item/partial-environnement.hbs',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/item/partial-tab-environnement.hbs',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/header-item.hbs',
|
||||
|
||||
'systems/foundryvtt-reve-de-dragon/templates/item/queue-sheet.hbs',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/item/partial-header.hbs',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/item/partial-hautrevant.hbs',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/item/partial-frequence.hbs',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/item/partial-description.hbs',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/item/partial-appreciable.hbs',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/item/enum-appreciation-bonmoment.hbs',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/item/enum-appreciation-carac.hbs',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/item/enum-appreciation-moral.hbs',
|
||||
// partial enums
|
||||
'systems/foundryvtt-reve-de-dragon/templates/enum-aspect-tarot.hbs',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/enum-base-competence.hbs',
|
||||
@@ -232,9 +239,6 @@ export class RdDUtility {
|
||||
'systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.hbs',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/partial-roll-surenc.hbs',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/partial-select-carac.hbs',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/partial-item-hautrevant.hbs',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/partial-item-frequence.hbs',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/partial-item-description.hbs',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/roll/explain.hbs',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/resolution-table.hbs',
|
||||
// Dialogs
|
||||
@@ -847,6 +851,26 @@ export class RdDUtility {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
static doWithSelectedActor(onSelected = () => { }, filter = actor => true) {
|
||||
const selected = RdDUtility.getSelectedActor()
|
||||
if (selected) {
|
||||
onSelected(selected)
|
||||
}
|
||||
else {
|
||||
const actors = game.actors
|
||||
.filter(it => it.getUserLevel(game.user) == CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER)
|
||||
.filter(it => ![ACTOR_TYPES.commerce, ACTOR_TYPES.vehicule].includes(it.type))
|
||||
.filter(filter)
|
||||
const selectData = {
|
||||
title: "Choisir un acteur",
|
||||
label: "Choisir un acteur",
|
||||
list: actors.map(it => Targets.extractActorData(it))
|
||||
};
|
||||
DialogSelect.select(selectData, it => onSelected(game.actors.get(it.id)))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static createMonnaie(name, cout, img = "", enc = 0.01) {
|
||||
let piece = {
|
||||
|
||||
@@ -15,6 +15,7 @@ import { RdDEmpoignade } from "../rdd-empoignade.js"
|
||||
import { Misc } from "../misc.js"
|
||||
import { RollBasicParts } from "./roll-basic-parts.mjs"
|
||||
import { RdDPossessionV2 } from "../rdd-possession-v2.mjs"
|
||||
import { Apprecier } from "../moral/apprecier.mjs"
|
||||
|
||||
export default class ChatRollResult {
|
||||
static init() {
|
||||
@@ -25,14 +26,16 @@ export default class ChatRollResult {
|
||||
|
||||
static onReady() {
|
||||
foundry.applications.handlebars.loadTemplates({
|
||||
'partial-infojet': 'systems/foundryvtt-reve-de-dragon/templates/roll/result/partial-infojet.hbs',
|
||||
'partial-appel-chance': 'systems/foundryvtt-reve-de-dragon/templates/roll/result/partial-appel-chance.hbs',
|
||||
'partial-apprecier': 'systems/foundryvtt-reve-de-dragon/templates/roll/result/partial-apprecier.hbs',
|
||||
'partial-appreciation': 'systems/foundryvtt-reve-de-dragon/templates/roll/result/partial-appreciation.hbs',
|
||||
'partial-attaque-particuliere': 'systems/foundryvtt-reve-de-dragon/templates/roll/result/partial-attaque-particuliere.hbs',
|
||||
'partial-choix-maladresse': 'systems/foundryvtt-reve-de-dragon/templates/roll/result/partial-choix-maladresse.hbs',
|
||||
'partial-maladresse': 'systems/foundryvtt-reve-de-dragon/templates/roll/result/partial-maladresse.hbs',
|
||||
'partial-encaissement': 'systems/foundryvtt-reve-de-dragon/templates/roll/result/partial-encaissement.hbs',
|
||||
'partial-recul-choc': 'systems/foundryvtt-reve-de-dragon/templates/roll/result/partial-recul-choc.hbs',
|
||||
'partial-infojet': 'systems/foundryvtt-reve-de-dragon/templates/roll/result/partial-infojet.hbs',
|
||||
'partial-info-appel-moral': 'systems/foundryvtt-reve-de-dragon/templates/roll/result/partial-info-appel-moral.hbs',
|
||||
'partial-maladresse': 'systems/foundryvtt-reve-de-dragon/templates/roll/result/partial-maladresse.hbs',
|
||||
'partial-recul-choc': 'systems/foundryvtt-reve-de-dragon/templates/roll/result/partial-recul-choc.hbs',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -64,7 +67,8 @@ export default class ChatRollResult {
|
||||
$isAppelChancePossible(roll) {
|
||||
return roll.active.actor.isPersonnage() &&
|
||||
roll.rolled.isEchec &&
|
||||
RdDCarac.isActionPhysique(roll.current.carac?.key)
|
||||
RdDCarac.isActionPhysique(roll.current.carac?.key) &&
|
||||
!roll.type.appreciation
|
||||
}
|
||||
|
||||
$isShowEncaissement(roll) {
|
||||
@@ -142,6 +146,7 @@ export default class ChatRollResult {
|
||||
$(html).on("click", '.resister-recul', event => this.onClickRecul(event))
|
||||
$(html).on("click", '.choix-particuliere', event => this.onClickChoixParticuliere(event))
|
||||
$(html).on("click", '.faire-gouter', event => this.onClickFaireGouter(event))
|
||||
$(html).on("click", '.apprecier', event => this.onClickApprecier(event))
|
||||
$(html).on("click", '.monter-tmr-normale', event => this.onClickMonteeTMR(event, 'normal'))
|
||||
$(html).on("click", '.monter-tmr-rapide', event => this.onClickMonteeTMR(event, 'rapide'))
|
||||
$(html).on("click", '.tirer-maladresse', event => this.onClickTirerMaladresse(event))
|
||||
@@ -313,6 +318,11 @@ export default class ChatRollResult {
|
||||
}
|
||||
await new RollTypeCuisine().onFaireGouter(savedRoll)
|
||||
}
|
||||
async onClickApprecier(event) {
|
||||
const chatMessage = ChatUtility.getChatMessage(event)
|
||||
const savedRoll = this.loadChatMessageRoll(chatMessage)
|
||||
await Apprecier.onClickApprecier(savedRoll)
|
||||
}
|
||||
|
||||
async onClickMonteeTMR(event, mode) {
|
||||
const chatMessage = ChatUtility.getChatMessage(event)
|
||||
|
||||
@@ -28,7 +28,7 @@ export const DIFF = {
|
||||
export const DIFFS = {
|
||||
[DIFF.LIBRE]: { key: DIFF.LIBRE, label: "Difficulté libre", libre: true, visible: true, max: 0 },
|
||||
[DIFF.ATTAQUE]: { key: DIFF.ATTAQUE, label: "Difficulté d'attaque", libre: true, visible: true, max: 0 },
|
||||
[DIFF.IMPOSEE]: { key: DIFF.IMPOSEE, label: "Difficulté imposée", libre: false, visible: true, max: 0 },
|
||||
[DIFF.IMPOSEE]: { key: DIFF.IMPOSEE, label: "Difficulté imposée", libre: false, visible: true, max: 20 },
|
||||
[DIFF.DEFENSE]: { key: DIFF.DEFENSE, label: "Difficulté défense", libre: false, visible: true, max: 0 },
|
||||
[DIFF.DEFAUT]: { key: DIFF.DEFAUT, label: "Difficulté", libre: true, visible: true, max: 5 },
|
||||
[DIFF.AUCUN]: { key: DIFF.AUCUN, label: "", libre: false, visible: false, max: 0 },
|
||||
|
||||
@@ -50,6 +50,7 @@ import { RollPartEcailles } from "./roll-part-ecailles.mjs";
|
||||
import { RollPartResistance } from "./roll-part-resistance.mjs";
|
||||
import { RollTypePossession } from "./roll-type-possession.mjs";
|
||||
import { RollPartPossession } from "./roll-part-possession.mjs";
|
||||
import { RollPartApprecier } from "./roll-part-apprecier.mjs";
|
||||
|
||||
|
||||
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api
|
||||
@@ -78,6 +79,7 @@ const ROLL_PARTS = [
|
||||
new RollPartComp(),
|
||||
|
||||
new RollPartDiff(),
|
||||
new RollPartApprecier(),
|
||||
new RollPartAttaque(),
|
||||
new RollPartPossession(),
|
||||
new RollPartDefense(),
|
||||
|
||||
32
module/roll/roll-part-apprecier.mjs
Normal file
32
module/roll/roll-part-apprecier.mjs
Normal file
@@ -0,0 +1,32 @@
|
||||
import { ROLLDIALOG_SECTION, RollPart } from "./roll-part.mjs";
|
||||
|
||||
export const PART_APPRECIER = "apprecier"
|
||||
|
||||
export class RollPartApprecier extends RollPart {
|
||||
|
||||
get code() { return PART_APPRECIER }
|
||||
get section() { return ROLLDIALOG_SECTION.CHOIX }
|
||||
|
||||
restore(rollData) {
|
||||
this.setCurrent(rollData, this.getSaved(rollData))
|
||||
}
|
||||
|
||||
store(rollData, targetData) {
|
||||
this.setSaved(targetData, this.getCurrent(rollData))
|
||||
}
|
||||
|
||||
visible(rollData) {
|
||||
return rollData.type.appreciation
|
||||
}
|
||||
|
||||
getAjustements(rollData) {
|
||||
const current = this.getCurrent(rollData)
|
||||
if (current.appreciation.jetQualite){
|
||||
return [{
|
||||
label: 'Qualité',
|
||||
value: Math.abs(current.qualite)
|
||||
}]
|
||||
}
|
||||
return []
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,12 @@ export class RollPartComp extends RollPartSelect {
|
||||
if (selected.forced) {
|
||||
refs.all = all.filter(comp => Grammar.equalsInsensitive(comp.label, selected.key))
|
||||
if (refs.all.length == 0) {
|
||||
refs.all = all.filter(comp => Grammar.includesLowerCaseNoAccent(comp.label, selected.key))
|
||||
if (selected.key.length > 0) {
|
||||
refs.all = all.filter(comp => Grammar.includesLowerCaseNoAccent(comp.label, selected.key))
|
||||
}
|
||||
else {
|
||||
refs.all = all.filter(comp => comp == SANS_COMPETENCE)
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -32,7 +32,7 @@ export class RollPartDiff extends RollPart {
|
||||
}
|
||||
|
||||
visible(rollData) {
|
||||
if (EXCLUDED_ROLL_TYPES.includes(rollData.type.current)) {
|
||||
if (EXCLUDED_ROLL_TYPES.includes(rollData.type.current) || rollData.type.appreciation) {
|
||||
return false
|
||||
}
|
||||
const current = this.getCurrent(rollData)
|
||||
|
||||
@@ -5,7 +5,12 @@ export class RollTypeComp extends RollType {
|
||||
get code() { return ROLL_TYPE_COMP }
|
||||
get name() { return `Jet de caractéristique / compétence` }
|
||||
|
||||
title(rollData) { return `fait un jet ${rollData.type.opposed ? ' contre ' : ''}` }
|
||||
title(rollData) {
|
||||
if (rollData.type.appreciation) {
|
||||
return "fait un jet d'appéciation"
|
||||
}
|
||||
return `fait un jet ${rollData.type.opposed ? ' contre ' : ''}`
|
||||
}
|
||||
|
||||
|
||||
onSelect(rollData) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { ITEM_TYPES } from "../constants.js"
|
||||
import { APPRECIATION } from "../moral/apprecier.mjs"
|
||||
import { RollBasicParts } from "./roll-basic-parts.mjs"
|
||||
import { DIFF, ROLL_TYPE_CUISINE } from "./roll-constants.mjs"
|
||||
import { PART_CUISINE } from "./roll-part-cuisine.mjs"
|
||||
@@ -49,7 +50,7 @@ export class RollTypeCuisine extends RollType {
|
||||
return result
|
||||
}
|
||||
onApplyImpacts(roll, impacts) {
|
||||
if (roll.result.plat) {
|
||||
if (roll.result.plat) {
|
||||
// le plat n'est pas créé immédiatement, il faut donc retrouver l'id
|
||||
roll.result.plat.id = impacts.findCreatedId('Item', roll.result.plat.id)
|
||||
}
|
||||
@@ -69,6 +70,7 @@ export class RollTypeCuisine extends RollType {
|
||||
quantite: current.proportions,
|
||||
qualite: result.qualite,
|
||||
cout: result.qualite > 0 ? (result.qualite * 0.01) : 0.01,
|
||||
appreciation: APPRECIATION.CUISINE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { PART_JEU, RollPartJeu } from "./roll-part-jeu.mjs"
|
||||
import { RollType } from "./roll-type.mjs"
|
||||
import { DIFF, ROLL_TYPE_JEU } from "./roll-constants.mjs"
|
||||
import { Apprecier } from "../moral/apprecier.mjs"
|
||||
|
||||
|
||||
export class RollTypeJeu extends RollType {
|
||||
@@ -20,4 +21,8 @@ export class RollTypeJeu extends RollType {
|
||||
RollPartJeu.forceCompJeu(rollData)
|
||||
}
|
||||
|
||||
}
|
||||
getResult(rollData, impacts) {
|
||||
const current = rollData.current[PART_JEU]
|
||||
return Apprecier.getAppreciation(current.qualite, current.jeu, rollData, current.comp)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { Apprecier } from "../moral/apprecier.mjs"
|
||||
import { DIFF, ROLL_TYPE_OEUVRE } from "./roll-constants.mjs"
|
||||
import { PART_OEUVRE } from "./roll-part-oeuvre.mjs"
|
||||
import { RollType } from "./roll-type.mjs"
|
||||
@@ -18,12 +19,7 @@ export class RollTypeOeuvre extends RollType {
|
||||
|
||||
getResult(rollData, impacts) {
|
||||
const current = rollData.current[PART_OEUVRE]
|
||||
const qualite = rollData.rolled.isSuccess ? current.qualite : Math.min(current.qualite, current.comp.system.niveau)
|
||||
return {
|
||||
qualite: qualite + rollData.rolled.ptQualite,
|
||||
messages: []
|
||||
}
|
||||
return Apprecier.getAppreciation(current.qualite, current.oeuvre, rollData, current.comp)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -68,18 +68,20 @@ export class SystemCompendiums extends FormApplication {
|
||||
if (pack?.metadata.type == docType) {
|
||||
return await pack.getDocuments();
|
||||
}
|
||||
return [];
|
||||
return []
|
||||
}
|
||||
|
||||
static async getCompetences(actorType) {
|
||||
switch (actorType ?? 'personnage') {
|
||||
case 'personnage':
|
||||
return await SystemCompendiums.getWorldOrCompendiumItems('competence', 'competences')
|
||||
.then(list => list.sort((a, b) => a.name.localeCompare(b.name)))
|
||||
case 'entite':
|
||||
case 'creature':
|
||||
return await SystemCompendiums.getWorldOrCompendiumItems('competencecreature', 'competences-creatures')
|
||||
case 'vehicule': return [];
|
||||
.then(list => list.sort((a, b) => a.name.localeCompare(b.name)))
|
||||
}
|
||||
return []
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
@@ -9,12 +9,12 @@ export class DialogRepos extends Dialog {
|
||||
return
|
||||
}
|
||||
if (!ReglesOptionnelles.isUsing("chateau-dormant-gardien") || !actor.hasPlayerOwner) {
|
||||
actor.system.sommeil = {
|
||||
foundry.utils.mergeObject(actor.system.sommeil, {
|
||||
"nouveaujour": true,
|
||||
"insomnie": EffetsDraconiques.isSujetInsomnie(actor),
|
||||
"moral": "neutre",
|
||||
"heures": 4
|
||||
}
|
||||
})
|
||||
}
|
||||
const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/sommeil/dialog-repos.hbs", actor);
|
||||
const dialog = new DialogRepos(html, actor);
|
||||
|
||||
@@ -18,6 +18,14 @@ export class Targets {
|
||||
}
|
||||
}
|
||||
|
||||
static extractActorData(actor) {
|
||||
return {
|
||||
id: actor.id,
|
||||
name: actor.prototypeToken?.name ?? actor.name,
|
||||
img: actor.prototypeToken?.texture.src ?? actor.img ?? 'icons/svg/mystery-man.svg'
|
||||
}
|
||||
}
|
||||
|
||||
static buildActorTokenData(tokenId, actor) {
|
||||
return { id: tokenId, name: actor.name, img: actor.img ?? 'icons/svg/mystery-man.svg' };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user