Jet de compétence avec défauts
Utilisation de carac par défaut et difficulté par défaut à l'ouverture de la fenêtre de jet depuis une compétence
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
## 13.0.30 - Le pansement d'Illysis
|
## 13.0.30 - Le pansement d'Illysis
|
||||||
|
|
||||||
- les soins d'un joueur à l'autre fonctionne de nouveau
|
- les soins d'un joueur à l'autre fonctionne de nouveau
|
||||||
|
- la fenêtre de jet de compétence s'ouvre avec la caractéristique et la difficulté par défaut
|
||||||
|
|
||||||
## 13.0.29 - Le tricorne d'Illysis
|
## 13.0.29 - Le tricorne d'Illysis
|
||||||
|
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ export default class RollDialog extends HandlebarsApplicationMixin(ApplicationV2
|
|||||||
|
|
||||||
foundry.applications.handlebars.loadTemplates(ALL_ROLL_TYPES.map(m => m.chatResultTemplate))
|
foundry.applications.handlebars.loadTemplates(ALL_ROLL_TYPES.map(m => m.chatResultTemplate))
|
||||||
foundry.applications.handlebars.loadTemplates(ROLL_PARTS.map(p => p.template))
|
foundry.applications.handlebars.loadTemplates(ROLL_PARTS.map(p => p.template))
|
||||||
ROLL_PARTS.forEach(p => p.onReady())
|
ROLL_PARTS.forEach(p => p.onReady(ROLL_PARTS))
|
||||||
|
|
||||||
Handlebars.registerHelper('roll-centered-array', (base, show) => {
|
Handlebars.registerHelper('roll-centered-array', (base, show) => {
|
||||||
show = Math.abs(show)
|
show = Math.abs(show)
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import { Grammar } from "../grammar.js"
|
import { Grammar } from "../grammar.js"
|
||||||
import { Misc } from "../misc.js"
|
import { Misc } from "../misc.js"
|
||||||
|
import { PART_CARAC } from "./roll-part-carac.mjs"
|
||||||
|
import { PART_DIFF } from "./roll-part-diff.mjs"
|
||||||
import { RollPartSelect } from "./roll-part-select.mjs"
|
import { RollPartSelect } from "./roll-part-select.mjs"
|
||||||
import { ROLLDIALOG_SECTION } from "./roll-part.mjs"
|
import { ROLLDIALOG_SECTION } from "./roll-part.mjs"
|
||||||
|
|
||||||
@@ -15,15 +17,21 @@ export class RollPartComp extends RollPartSelect {
|
|||||||
get name() { return 'Compétences' }
|
get name() { return 'Compétences' }
|
||||||
get section() { return ROLLDIALOG_SECTION.COMP }
|
get section() { return ROLLDIALOG_SECTION.COMP }
|
||||||
|
|
||||||
|
onReady(rollParts) {
|
||||||
|
this.rollPartCarac = rollParts.find(it => it.code == PART_CARAC)
|
||||||
|
this.rollPartDiff = rollParts.find(it => it.code == PART_DIFF)
|
||||||
|
}
|
||||||
|
|
||||||
loadRefs(rollData) {
|
loadRefs(rollData) {
|
||||||
const refs = this.getRefs(rollData)
|
const refs = this.getRefs(rollData)
|
||||||
const selected = this.getSelected(rollData)
|
const selected = this.getSelected(rollData)
|
||||||
const all = this.$getActorComps(rollData)
|
const all = this.$getActorComps(rollData)
|
||||||
if (selected.forced) {
|
const selectedComp = selected.key
|
||||||
refs.all = all.filter(comp => Grammar.equalsInsensitive(comp.label, selected.key))
|
if (selected.forced && selectedComp) {
|
||||||
|
refs.all = all.filter(comp => Grammar.equalsInsensitive(comp.label, selectedComp))
|
||||||
if (refs.all.length == 0) {
|
if (refs.all.length == 0) {
|
||||||
if (selected.key && selected.key.length > 0) {
|
if (selected.key && selected.key.length > 0) {
|
||||||
refs.all = all.filter(comp => Grammar.includesLowerCaseNoAccent(comp.label, selected.key))
|
refs.all = all.filter(comp => Grammar.includesLowerCaseNoAccent(comp.label, selectedComp))
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
refs.all = all.filter(comp => comp == SANS_COMPETENCE)
|
refs.all = all.filter(comp => comp == SANS_COMPETENCE)
|
||||||
@@ -35,6 +43,11 @@ export class RollPartComp extends RollPartSelect {
|
|||||||
}
|
}
|
||||||
refs.comps = refs.all
|
refs.comps = refs.all
|
||||||
this.$selectComp(rollData)
|
this.$selectComp(rollData)
|
||||||
|
if (rollData.type.current == PART_COMP && selectedComp) {
|
||||||
|
const current = this.getCurrent(rollData)
|
||||||
|
this.rollPartCarac.selectByKey(rollData, current.comp.system.defaut_carac)
|
||||||
|
this.rollPartDiff.setDiff(rollData, current.comp.system.default_diffLibre)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
choices(refs) { return refs.comps }
|
choices(refs) { return refs.comps }
|
||||||
@@ -71,6 +84,7 @@ export class RollPartComp extends RollPartSelect {
|
|||||||
refs.comps.sort(sorting)
|
refs.comps.sort(sorting)
|
||||||
}
|
}
|
||||||
this.$selectComp(rollData)
|
this.$selectComp(rollData)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
prepareContext(rollData) {
|
prepareContext(rollData) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export class RollPartConditions extends RollPart {
|
|||||||
settingMin() { return RollPart.settingKey(this, 'min') }
|
settingMin() { return RollPart.settingKey(this, 'min') }
|
||||||
settingMax() { return RollPart.settingKey(this, 'max') }
|
settingMax() { return RollPart.settingKey(this, 'max') }
|
||||||
|
|
||||||
onReady() {
|
onReady(rollParts) {
|
||||||
game.settings.register(SYSTEM_RDD, this.settingMin(),
|
game.settings.register(SYSTEM_RDD, this.settingMin(),
|
||||||
{
|
{
|
||||||
name: "Malus maximal de conditions",
|
name: "Malus maximal de conditions",
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { ROLLDIALOG_SECTION, RollPart } from "./roll-part.mjs"
|
|||||||
export const PART_CUISINE = "cuisine"
|
export const PART_CUISINE = "cuisine"
|
||||||
|
|
||||||
export class RollPartCuisine extends RollPartSelect {
|
export class RollPartCuisine extends RollPartSelect {
|
||||||
onReady() {
|
onReady(rollParts) {
|
||||||
foundry.applications.handlebars.loadTemplates({ 'roll-oeuvre-recettecuisine': `systems/foundryvtt-reve-de-dragon/templates/roll/roll-oeuvre-recettecuisine.hbs` })
|
foundry.applications.handlebars.loadTemplates({ 'roll-oeuvre-recettecuisine': `systems/foundryvtt-reve-de-dragon/templates/roll/roll-oeuvre-recettecuisine.hbs` })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ const ARTS = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
export class RollPartOeuvre extends RollPartSelect {
|
export class RollPartOeuvre extends RollPartSelect {
|
||||||
onReady() {
|
onReady(rollParts) {
|
||||||
ARTS.forEach(art => art.label = Misc.typeName('Item', art.type))
|
ARTS.forEach(art => art.label = Misc.typeName('Item', art.type))
|
||||||
ARTS.map(it => `roll-oeuvre-${it.type}`)
|
ARTS.map(it => `roll-oeuvre-${it.type}`)
|
||||||
.forEach(art =>
|
.forEach(art =>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export const PART_SORT = "sort"
|
|||||||
|
|
||||||
export class RollPartSort extends RollPartSelect {
|
export class RollPartSort extends RollPartSelect {
|
||||||
|
|
||||||
onReady() {
|
onReady(rollParts) {
|
||||||
// TODO: utiliser un hook pour écouter les déplacements dans les TMRs?
|
// TODO: utiliser un hook pour écouter les déplacements dans les TMRs?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ const DEFAULT_DIFF_TYPES = [DIFF.LIBRE, DIFF.IMPOSEE, DIFF.DEFAUT]
|
|||||||
|
|
||||||
export class RollType {
|
export class RollType {
|
||||||
|
|
||||||
onReady() { }
|
|
||||||
|
|
||||||
get code() { throw new Error(`Pas de code défini pour ${this}`) }
|
get code() { throw new Error(`Pas de code défini pour ${this}`) }
|
||||||
get name() { return this.code }
|
get name() { return this.code }
|
||||||
get icon() { return `systems/foundryvtt-reve-de-dragon/assets/actions/${this.code}.svg` }
|
get icon() { return `systems/foundryvtt-reve-de-dragon/assets/actions/${this.code}.svg` }
|
||||||
|
|||||||
Reference in New Issue
Block a user