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:
@@ -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(),
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user