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:
2025-09-24 01:23:10 +02:00
parent 1f330c734e
commit d26ab59c51
65 changed files with 381 additions and 350 deletions

View File

@@ -4,7 +4,7 @@ import { ATTAQUE_TYPE, RdDItemArme } from "../item/arme.js"
import { RdDBonus } from "../rdd-bonus.js"
import { CARACS } from "../rdd-carac.js"
import { StatusEffects } from "../settings/status-effects.js"
import { DIFF_MODE, ROLL_MODE_DEFENSE } from "./roll-constants.mjs"
import { DIFF, ROLL_TYPE_DEFENSE } from "./roll-constants.mjs"
import { PART_CARAC } from "./roll-part-carac.mjs"
import { PART_COMP } from "./roll-part-comp.mjs"
import { PART_DIFF } from "./roll-part-diff.mjs"
@@ -18,7 +18,7 @@ export class RollPartDefense extends RollPartSelect {
get code() { return PART_DEFENSE }
get section() { return ROLLDIALOG_SECTION.CHOIX }
visible(rollData) { return this.isRollMode(rollData, ROLL_MODE_DEFENSE) }
visible(rollData) { return this.isRollType(rollData, ROLL_TYPE_DEFENSE) }
static getDiffAttaque(attackerRoll) {
// TODO: rollDataV2?
@@ -91,7 +91,6 @@ export class RollPartDefense extends RollPartSelect {
const selectOptions = e.currentTarget.options
const index = selectOptions.selectedIndex
this.$selectDefense(rollDialog.rollData, selectOptions[index]?.value)
rollDialog.setModeTitle()
rollDialog.render()
})
}
@@ -121,12 +120,12 @@ export class RollPartDefense extends RollPartSelect {
getDiffDefense(rollData) {
const current = this.getCurrent(rollData)
const refs = this.getRefs(rollData)
if (refs.isDistance) {
if (refs.isDistance || !rollData.attaque) {
// Déterminer la difficulté de parade
return { diff: 0, mode: DIFF_MODE.LIBRE }
return { diff: 0, type: DIFF.LIBRE }
}
else {
return { diff: rollData.attaque.diff, mode: DIFF_MODE.DEFENSE }
return { diff: rollData.attaque.diff ?? 0, type: DIFF.DEFENSE }
}
}
}