Nouveau roll-dialog: mode attaque / defense

This commit is contained in:
2025-09-21 00:15:21 +02:00
parent 607eedc6d2
commit 0730bdf240
52 changed files with 940 additions and 415 deletions

View File

@@ -19,14 +19,14 @@ export class RollPartTache extends RollPartSelect {
loadRefs(rollData) {
const refs = this.getRefs(rollData)
refs.taches = rollData.active.actor.itemTypes[ITEM_TYPES.tache]
.filter(tache => tache.system.points_de_tache_courant < tache.system.points_de_tache)
.map(tache => RollPartTache.$extractTache(tache, rollData.active.actor))
.filter(tache => tache.system.points_de_tache_courant < tache.system.points_de_tache)
.map(tache => RollPartTache.$extractTache(tache, rollData.active.actor))
if (refs.taches.length > 0) {
this.$selectTache(rollData)
}
}
choices(refs) { return refs.taches }
static $extractTache(tache, actor) {
return {
key: tache.id,
@@ -53,12 +53,12 @@ export class RollPartTache extends RollPartSelect {
})
}
getExternalPartsFilter(partCode, rollData) {
impactOtherPart(part, rollData) {
if (this.visible(rollData)) {
const current = this.getCurrent(rollData)
switch (partCode) {
case PART_CARAC: return p => Grammar.equalsInsensitive(p.key, current?.tache.system.carac)
case PART_COMP: return p => p.label == current?.comp.name
switch (part.code) {
case PART_CARAC: return part.filterCaracs(rollData, [current?.tache.system.carac])
case PART_COMP: return part.filterComps(rollData, [current.comp?.name])
}
}
return undefined