forked from public/foundryvtt-reve-de-dragon
Nouvelle fenêtre: attaque/defense
quelques améliorations préparation pour gérer les messages de résultats en fonction du type de jet (attaque/compétence/...) quelques corrections (suppression du filtre de compétences quand on change de type de jet, astrologie, ..)
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { DIFF_MODE, DIFF_MODES, ROLL_MODE_MEDITATION, ROLL_MODE_OEUVRE, ROLL_MODE_SORT, ROLL_MODE_TACHE } from "./roll-constants.mjs";
|
||||
import { DIFF, DIFFS, ROLL_TYPE_MEDITATION, ROLL_TYPE_OEUVRE, ROLL_TYPE_SORT, ROLL_TYPE_TACHE } from "./roll-constants.mjs";
|
||||
import { ROLLDIALOG_SECTION, RollPart } from "./roll-part.mjs";
|
||||
|
||||
export const PART_DIFF = "diff"
|
||||
|
||||
const EXCLUDED_ROLL_MODES = [ROLL_MODE_TACHE, ROLL_MODE_MEDITATION, ROLL_MODE_SORT, ROLL_MODE_OEUVRE]
|
||||
const EXCLUDED_ROLL_TYPES = [ROLL_TYPE_TACHE, ROLL_TYPE_MEDITATION, ROLL_TYPE_SORT, ROLL_TYPE_OEUVRE]
|
||||
|
||||
export class RollPartDiff extends RollPart {
|
||||
|
||||
@@ -14,37 +14,37 @@ export class RollPartDiff extends RollPart {
|
||||
const current = this.getCurrent(rollData)
|
||||
const saved = this.getSaved(rollData)
|
||||
current.value = saved?.value ?? current.value ?? 0
|
||||
current.mode = saved?.mode ?? current.mode
|
||||
current.type = saved?.type ?? current.type
|
||||
}
|
||||
|
||||
store(rollData, targetData) {
|
||||
const current = this.getCurrent(rollData)
|
||||
this.setSaved(targetData, {
|
||||
value: current.value,
|
||||
mode: current.mode
|
||||
type: current.type
|
||||
})
|
||||
}
|
||||
|
||||
visible(rollData) {
|
||||
if (EXCLUDED_ROLL_MODES.includes(rollData.mode.current)) {
|
||||
if (EXCLUDED_ROLL_TYPES.includes(rollData.type.current)) {
|
||||
return false
|
||||
}
|
||||
const current = this.getCurrent(rollData)
|
||||
/* TODO: affiner les cas où afficher ou non. devrait s'afficher pour les jets basiques (même si pas d'opposant sélectionné)*/
|
||||
return Object.values(DIFF_MODE).includes(current.mode)
|
||||
return Object.values(DIFF).includes(current.type)
|
||||
}
|
||||
|
||||
prepareContext(rollData) {
|
||||
const current = this.getCurrent(rollData)
|
||||
const diffMode = DIFF_MODES[current.mode] ?? DIFF_MODES[DIFF_MODE.AUCUN]
|
||||
const diffType = DIFFS[current.type] ?? DIFFS[DIFF.AUCUN]
|
||||
foundry.utils.mergeObject(current,
|
||||
{
|
||||
mode: diffMode.key,
|
||||
label: diffMode?.label ?? '',
|
||||
type: diffType.key,
|
||||
label: diffType?.label ?? '',
|
||||
value: current.value ?? 0,
|
||||
disabled: !diffMode.libre,
|
||||
disabled: !diffType.libre,
|
||||
min: -10,
|
||||
max: diffMode.max
|
||||
max: diffType.max
|
||||
},
|
||||
{ inplace: true }
|
||||
)
|
||||
@@ -53,7 +53,7 @@ export class RollPartDiff extends RollPart {
|
||||
setDiff(rollData, diffDefense) {
|
||||
const current = this.getCurrent(rollData)
|
||||
current.value = diffDefense.diff
|
||||
current.mode = diffDefense.mode
|
||||
current.type = diffDefense.type
|
||||
}
|
||||
|
||||
getAjustements(rollData) {
|
||||
|
Reference in New Issue
Block a user