forked from public/foundryvtt-reve-de-dragon
Petites améliorations
This commit is contained in:
@@ -163,10 +163,10 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getDemiReve() { return this.system.reve.tmrpos.coord }
|
||||
getDraconicList() { return this.itemTypes[ITEM_TYPES.competence].filter(it => it.system.categorie == 'draconic') }
|
||||
getBestDraconic() { return foundry.utils.duplicate([...this.getDraconicList(), PAS_DE_DRACONIC].sort(Misc.descending(it => it.system.niveau)).find(it => true)) }
|
||||
getDraconics() { return this.itemTypes[ITEM_TYPES.competence].filter(it => it.system.categorie == 'draconic') }
|
||||
getBestDraconic() { return foundry.utils.duplicate([...this.getDraconics(), PAS_DE_DRACONIC].sort(Misc.descending(it => it.system.niveau)).find(it => true)) }
|
||||
getDraconicOuPossession() {
|
||||
return [...this.getDraconicList().filter(it => it.system.niveau >= 0), POSSESSION_SANS_DRACONIC]
|
||||
return [...this.getDraconics().filter(it => it.system.niveau >= 0), POSSESSION_SANS_DRACONIC]
|
||||
.sort(Misc.descending(it => it.system.niveau))
|
||||
.find(it => true)
|
||||
}
|
||||
@@ -703,11 +703,12 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async combattreReveDeDragon(force) {
|
||||
const rencontre = await game.system.rdd.rencontresTMR.getReveDeDragon(force);
|
||||
let rollData = {
|
||||
actor: this,
|
||||
competence: this.getDraconicOuPossession(),
|
||||
canClose: false,
|
||||
rencontre: await game.system.rdd.rencontresTMR.getReveDeDragon(force),
|
||||
rencontre: rencontre,
|
||||
tmr: true,
|
||||
use: { libre: false, conditions: false },
|
||||
forceCarac: { 'reve-actuel': { label: "Rêve Actuel", value: this.getReveActuel() } }
|
||||
@@ -1688,7 +1689,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
computeDraconicAndSortIndex(sortList) {
|
||||
let draconicList = this.getDraconicList();
|
||||
let draconicList = this.getDraconics();
|
||||
for (let sort of sortList) {
|
||||
let draconicsSort = RdDItemSort.getDraconicsSort(draconicList, sort).map(it => it.name);
|
||||
for (let index = 0; index < draconicList.length && sort.system.listIndex == undefined; index++) {
|
||||
@@ -2114,7 +2115,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
ui.notifications.info(`Aucun signe draconiques en ${coord} !`);
|
||||
return;
|
||||
}
|
||||
let draconicList = this.getDraconicList()
|
||||
let draconicList = this.getDraconics()
|
||||
.map(draconic => {
|
||||
let draconicLecture = foundry.utils.duplicate(draconic);
|
||||
draconicLecture.system.defaut_carac = "intellect";
|
||||
@@ -2395,7 +2396,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
return
|
||||
}
|
||||
if (mode != 'visu' && this.isDemiReve()) {
|
||||
ui.notifications.warn("Les personnage est déjà dans les Terres Médianes, elles s'affichent en visualisation")
|
||||
ui.notifications.warn("Le personnage est déjà dans les Terres Médianes, elles s'affichent en visualisation")
|
||||
mode = "visu"; // bascule le mode en visu automatiquement
|
||||
}
|
||||
if (mode == 'visu') {
|
||||
@@ -2434,7 +2435,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
let tmrFormData = {
|
||||
mode: mode,
|
||||
fatigue: RdDUtility.calculFatigueHtml(fatigue, endurance),
|
||||
draconic: this.getDraconicList(),
|
||||
draconic: this.getDraconics(),
|
||||
sort: this.itemTypes['sort'],
|
||||
signes: this.itemTypes['signedraconique'],
|
||||
caracReve: parseInt(this.system.carac.reve.value),
|
||||
|
@@ -6,8 +6,8 @@ const tableEffets = [
|
||||
{ code: "passeur", resultat: "succes", description: "Déplacer le demi-rêve à (force) cases", method: EffetsRencontre.passeur},
|
||||
{ code: "reve+f", resultat: "succes", description: "Gain de (force) points de rêve" , method: EffetsRencontre.reve_plus_force},
|
||||
{ code: "teleport", resultat: "succes", description: "Déplacer le demi-rêve (même type)", method: EffetsRencontre.teleportation_typecase },
|
||||
{ code: "part+tete", resultat: "succes", description: "Tête de dragon sur réussite particulière", method: EffetsRencontre.rdd_part_tete },
|
||||
{ code: "part+xp", resultat: "succes", description: "Expérience sur réussite particulière", method: EffetsRencontre.experience_particuliere },
|
||||
{ code: "part+tete", resultat: "succes", description: "Tête de dragon sur particulière", method: EffetsRencontre.rdd_part_tete },
|
||||
{ code: "part+xp", resultat: "succes", description: "Expérience sur particulière", method: EffetsRencontre.experience_particuliere },
|
||||
{ code: "seuil", resultat: "succes", description: "Récupération de seuil de rêve", method: EffetsRencontre.regain_seuil },
|
||||
|
||||
{ code: "reve-1", resultat: "echec", description: "Perte de 1 point de rêve", method: EffetsRencontre.reve_moins_1 },
|
||||
@@ -19,7 +19,7 @@ const tableEffets = [
|
||||
{ code: "aleatoire", resultat: "echec", description: "Déplacement aléatoire", method: EffetsRencontre.deplacement_aleatoire },
|
||||
{ code: "sort-aleatoire", resultat: "echec", description: "Déclenche un sort en réserve aléatoire", method: EffetsRencontre.sort_aleatoire },
|
||||
{ code: "rompu", resultat: "echec", description: "Demi-rêve interrompu", method: EffetsRencontre.demireve_rompu },
|
||||
{ code: "echec-queue", resultat: "echec", description: "Queue(s) de dragon sur échec", method: EffetsRencontre.rdd_echec_queue },
|
||||
{ code: "echec-queue", resultat: "echec", description: "Queue(s) de dragon", method: EffetsRencontre.rdd_echec_queue },
|
||||
|
||||
{ code: "reve+1", resultat: "succes", description: "Gain de 1 point de rêve", method: EffetsRencontre.reve_plus_1 },
|
||||
{ code: "vie-f", resultat: "echec", description: "Perte de (force) points de vie", method: EffetsRencontre.vie_moins_force },
|
||||
|
@@ -98,7 +98,8 @@ export default class ChatRollResult {
|
||||
|
||||
async buildRollHtml(roll) {
|
||||
const template = `systems/foundryvtt-reve-de-dragon/templates/roll/result/chat-${roll.type.current}.hbs`
|
||||
return await renderTemplate(template, roll)
|
||||
const html = await renderTemplate(template, roll)
|
||||
return await RdDTextEditor.enrichHTML(html, undefined, { showLink: false })
|
||||
}
|
||||
|
||||
async chatListeners(html) {
|
||||
|
@@ -1,10 +1,10 @@
|
||||
|
||||
export const ROLL_TYPE_ATTAQUE = 'attaque'
|
||||
export const ROLL_TYPE_COMP = 'comp'
|
||||
export const ROLL_TYPE_CUISINE = 'cuisine'
|
||||
export const ROLL_TYPE_DEFENSE = 'defense'
|
||||
export const ROLL_TYPE_JEU = 'jeu'
|
||||
export const ROLL_TYPE_MEDITATION = 'meditation'
|
||||
export const ROLL_TYPE_CUISINE = 'cuisine'
|
||||
export const ROLL_TYPE_OEUVRE = 'oeuvre'
|
||||
export const ROLL_TYPE_SORT = 'sort'
|
||||
export const ROLL_TYPE_TACHE = 'tache'
|
||||
@@ -12,11 +12,10 @@ export const ROLL_TYPE_TACHE = 'tache'
|
||||
export const ATTAQUE_ROLL_TYPES = [ROLL_TYPE_ATTAQUE]
|
||||
export const COMBAT_ROLL_TYPES = [ROLL_TYPE_ATTAQUE, ROLL_TYPE_DEFENSE]
|
||||
export const DEMIREVE_ROLL_TYPES = [ROLL_TYPE_SORT]
|
||||
export const DEFAULT_ROLL_TYPES = [ROLL_TYPE_COMP, ROLL_TYPE_JEU, ROLL_TYPE_MEDITATION, ROLL_TYPE_CUISINE, ROLL_TYPE_OEUVRE, ROLL_TYPE_TACHE]
|
||||
export const DEFAULT_ROLL_TYPES = [ROLL_TYPE_COMP, ROLL_TYPE_TACHE, ROLL_TYPE_MEDITATION, ROLL_TYPE_CUISINE, ROLL_TYPE_OEUVRE, ROLL_TYPE_JEU]
|
||||
export const ALL_ROLL_TYPES = [...DEFAULT_ROLL_TYPES, ...COMBAT_ROLL_TYPES, ...DEMIREVE_ROLL_TYPES]
|
||||
|
||||
|
||||
|
||||
export const DIFF = {
|
||||
LIBRE: 'libre',
|
||||
ATTAQUE: 'attaque',
|
||||
|
@@ -67,7 +67,7 @@ export class RollDialogAdapter {
|
||||
if (rollData.ajustements == undefined) {
|
||||
rollData.ajustements = {}
|
||||
}
|
||||
rollData.selectedCarac = rollData.active.actor.system.carac[rollData.current.carac.key]
|
||||
rollData.selectedCarac = rollData.active.actor.getCaracByName(rollData.current.carac.key)
|
||||
|
||||
const compKey = rollData.current.comp?.key
|
||||
if (compKey) {
|
||||
|
@@ -24,7 +24,6 @@ export class RollPartComp extends RollPartSelect {
|
||||
Grammar.includesLowerCaseNoAccent(comp.name, selected.key)
|
||||
: comp.key == '')
|
||||
)
|
||||
|
||||
refs.comps = refs.all
|
||||
this.$selectComp(rollData)
|
||||
}
|
||||
@@ -52,12 +51,16 @@ export class RollPartComp extends RollPartSelect {
|
||||
}
|
||||
}
|
||||
|
||||
filterComps(rollData, allowed = []) {
|
||||
filterComps(rollData, allowed = [], sorting = undefined) {
|
||||
const sans = allowed.includes('')
|
||||
allowed = allowed.filter(it => it != undefined)
|
||||
const refs = this.getRefs(rollData)
|
||||
refs.comps = allowed.length > 0
|
||||
? refs.all.filter(it => allowed.includes(it.label))
|
||||
? refs.all.filter(it => allowed.includes(it.label) || (sans && it.key == ''))
|
||||
: refs.all
|
||||
if (sorting && refs.comps.length > 0) {
|
||||
refs.comps.sort(sorting)
|
||||
}
|
||||
this.$selectComp(rollData)
|
||||
}
|
||||
|
||||
|
@@ -1,10 +1,15 @@
|
||||
import { DIFF, DIFFS, ROLL_TYPE_MEDITATION, ROLL_TYPE_OEUVRE, ROLL_TYPE_SORT, ROLL_TYPE_TACHE } from "./roll-constants.mjs";
|
||||
import { DIFF, DIFFS, ROLL_TYPE_CUISINE, ROLL_TYPE_MEDITATION, ROLL_TYPE_OEUVRE, ROLL_TYPE_SORT, ROLL_TYPE_TACHE } from "./roll-constants.mjs";
|
||||
import { ROLLDIALOG_SECTION, RollPart } from "./roll-part.mjs";
|
||||
import { Misc } from "../misc.js";
|
||||
|
||||
export const PART_DIFF = "diff"
|
||||
|
||||
const EXCLUDED_ROLL_TYPES = [ROLL_TYPE_TACHE, ROLL_TYPE_MEDITATION, ROLL_TYPE_SORT, ROLL_TYPE_OEUVRE]
|
||||
const EXCLUDED_ROLL_TYPES = [
|
||||
ROLL_TYPE_TACHE,
|
||||
ROLL_TYPE_MEDITATION,
|
||||
ROLL_TYPE_SORT,
|
||||
ROLL_TYPE_CUISINE,
|
||||
ROLL_TYPE_OEUVRE]
|
||||
|
||||
export class RollPartDiff extends RollPart {
|
||||
|
||||
@@ -53,8 +58,8 @@ export class RollPartDiff extends RollPart {
|
||||
|
||||
setDiff(rollData, diff) {
|
||||
const current = this.getCurrent(rollData)
|
||||
current.value = diff.diff
|
||||
current.type = diff.type
|
||||
current.value = diff.diff ?? current.value
|
||||
current.type = diff.type ?? current.type
|
||||
}
|
||||
|
||||
getAjustements(rollData) {
|
||||
|
@@ -27,7 +27,7 @@ export class RollPartSelect extends RollPart {
|
||||
const current = this.getCurrent(rollData)
|
||||
const newChoice = (choices.length == 0)
|
||||
? { key: '', value: defValue }
|
||||
: this.$getSelectedChoice(choices, key ?? current?.key ?? refs?.key ?? '')
|
||||
: this.$getSelectedChoice(choices, key ?? current?.key ?? refs?.key ?? choices[0].key)
|
||||
this.setCurrent(rollData, newChoice)
|
||||
return newChoice
|
||||
}
|
||||
|
@@ -11,9 +11,11 @@ import { CARACS } from "../rdd-carac.js"
|
||||
export const PART_SORT = "sort"
|
||||
|
||||
export class RollPartSort extends RollPartSelect {
|
||||
|
||||
onReady() {
|
||||
// TODO: utiliser un hook pour écouter les déplacements dans les TMRs?
|
||||
}
|
||||
|
||||
get code() { return PART_SORT }
|
||||
get section() { return ROLLDIALOG_SECTION.CHOIX }
|
||||
|
||||
@@ -23,7 +25,7 @@ export class RollPartSort extends RollPartSelect {
|
||||
loadRefs(rollData) {
|
||||
const refs = this.getRefs(rollData)
|
||||
const coord = rollData.active.actor.system.reve.tmrpos.coord
|
||||
const draconics = rollData.active.actor.getDraconicList()
|
||||
const draconics = rollData.active.actor.getDraconics()
|
||||
const sorts = rollData.active.actor.itemTypes[ITEM_TYPES.sort]
|
||||
.map(s => RollPartSort.$extractSort(s, coord, draconics))
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { ROLL_TYPE_COMP } from "./roll-constants.mjs"
|
||||
import { DIFF, ROLL_TYPE_COMP } from "./roll-constants.mjs"
|
||||
import { RollType } from "./roll-type.mjs"
|
||||
|
||||
export class RollTypeComp extends RollType {
|
||||
@@ -7,4 +7,9 @@ export class RollTypeComp extends RollType {
|
||||
|
||||
title(rollData) { return `fait un jet ${rollData.type.opposed ? ' contre ' : ''}` }
|
||||
|
||||
|
||||
onSelect(rollData) {
|
||||
this.setDiffType(rollData, DIFF.LIBRE)
|
||||
}
|
||||
|
||||
}
|
@@ -2,7 +2,6 @@ import { renderTemplate } from "./constants.js";
|
||||
import { Grammar } from "./grammar.js";
|
||||
import { Misc } from "./misc.js";
|
||||
import { RdDDice } from "./rdd-dice.js";
|
||||
import { RdDUtility } from "./rdd-utility.js";
|
||||
import { SystemCompendiums, CompendiumTable, CompendiumTableHelpers } from "./settings/system-compendiums.js";
|
||||
import { TMRUtility } from "./tmr-utility.js";
|
||||
|
||||
|
@@ -28,16 +28,7 @@ export class EffetsRencontre {
|
||||
static reve_plus_1 = async (dialog, context) => { await EffetsRencontre.$reve_plus(context.actor, 1) }
|
||||
static reve_moins_force = async (dialog, context) => { await EffetsRencontre.$reve_plus(context.actor, -context.rencontre.system.force) }
|
||||
static reve_moins_1 = async (dialog, context) => { await EffetsRencontre.$reve_plus(context.actor, -1) }
|
||||
static $reve_plus = async (actor, reve) => {
|
||||
if (!ReglesOptionnelles.isUsing("recuperation-reve") && reve < 0) {
|
||||
ChatMessage.create({
|
||||
whisper: ChatUtility.getOwners(actor),
|
||||
content: `Pas de récupération de rêve (${reve} points ignorés)`
|
||||
});
|
||||
return
|
||||
}
|
||||
await actor.reveActuelIncDec(reve)
|
||||
}
|
||||
static $reve_plus = async (actor, reve) => { await actor.reveActuelIncDec(reve) }
|
||||
|
||||
static vie_moins_1 = async (dialog, context) => { await EffetsRencontre.$vie_plus(context.actor, -1) }
|
||||
static vie_moins_force = async (dialog, context) => { await EffetsRencontre.$vie_plus(context.actor, -context.rencontre.system.force) }
|
||||
|
@@ -10,7 +10,6 @@
|
||||
"gulp": "gulp",
|
||||
"run": "npx vite serve",
|
||||
"packCompendiumsToDist": "node ./tools/packCompendiumsToDist.mjs",
|
||||
"packCompendiumsToPublic": "node ./tools/packCompendiumsToPublic.mjs",
|
||||
"unpackCompendiumsFromPublic": "node ./tools/unpackCompendiumsFromPublic.mjs"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
name: Rêve de Dragon
|
||||
type: rencontre
|
||||
img: systems/foundryvtt-reve-de-dragon/assets/rdd_pause.webp
|
||||
img: systems/foundryvtt-reve-de-dragon/assets/ui/rdd_pause.webp
|
||||
system:
|
||||
description: ''
|
||||
descriptionmj: ''
|
||||
|
@@ -23,6 +23,7 @@
|
||||
{{> 'partial-info-appel-moral'}}
|
||||
{{> "systems/foundryvtt-reve-de-dragon/templates/chat-description.hbs" current.cuisine.recette.system}}
|
||||
</div>
|
||||
|
||||
<div class="chat-buttons">
|
||||
{{> 'partial-appel-chance'}}
|
||||
</div>
|
||||
|
@@ -0,0 +1,30 @@
|
||||
<div class="roll-chat">
|
||||
<div class="chat-img">
|
||||
<img src="{{active.img}}" data-tooltip="{{active.name}}" />
|
||||
<img src="{{current.comp.img}}" data-tooltip="{{current.comp.name}}" />
|
||||
</div>
|
||||
<div class="chat-header">
|
||||
{{active.name}} {{current.oeuvre.art.action}}: {{current.oeuvre.label}} (de niveau {{current.oeuvre.oeuvre.system.niveau}})
|
||||
</div>
|
||||
|
||||
<div class="chat-resume">
|
||||
{{current.carac.label}} / {{current.comp.label}} à {{current.diff.value}}
|
||||
<br>{{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.hbs"}}
|
||||
</div>
|
||||
|
||||
<div class="chat-details">
|
||||
<p>
|
||||
{{active.name}}
|
||||
{{#if rolled.isSuccess}}réussit son interprétation avec
|
||||
{{else}}manque d'inspiration, son interprétation a
|
||||
{{/if}}
|
||||
une qualité de {{result.qualite}}.
|
||||
</p>
|
||||
{{> 'partial-info-appel-moral'}}
|
||||
{{> "systems/foundryvtt-reve-de-dragon/templates/chat-description.hbs" current.oeuvre.oeuvre.system}}
|
||||
</div>
|
||||
|
||||
<div class="chat-buttons">
|
||||
{{> 'partial-appel-chance'}}
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -23,6 +23,7 @@
|
||||
{{> 'partial-info-appel-moral'}}
|
||||
{{> "systems/foundryvtt-reve-de-dragon/templates/chat-description.hbs" current.oeuvre.oeuvre.system}}
|
||||
</div>
|
||||
|
||||
<div class="chat-buttons">
|
||||
{{> 'partial-appel-chance'}}
|
||||
</div>
|
||||
|
@@ -15,7 +15,6 @@
|
||||
<div class="chat-details">
|
||||
<hr>
|
||||
<p>
|
||||
{{log 'tache' this }}
|
||||
{{#if rolled.isSuccess}}
|
||||
{{active.name}} a obtenu {{rolled.ptTache}} point{{~#unless (eq rolled.ptTache 1)}}s{{/unless}} de tâche,
|
||||
{{else if (or rolled.isETotal rolled.isEPart)}}
|
||||
@@ -53,5 +52,6 @@
|
||||
</div>
|
||||
|
||||
<div class="chat-buttons">
|
||||
{{> 'partial-appel-chance'}}
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user