Jet V2 pour les créatures
This commit is contained in:
@@ -12,7 +12,7 @@ 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_TACHE, ROLL_TYPE_MEDITATION, ROLL_TYPE_CUISINE, ROLL_TYPE_OEUVRE, ROLL_TYPE_JEU]
|
||||
export const DEFAULT_ROLL_TYPES = [ROLL_TYPE_COMP, ROLL_TYPE_ATTAQUE, ROLL_TYPE_TACHE, ROLL_TYPE_MEDITATION, ROLL_TYPE_CUISINE, ROLL_TYPE_OEUVRE, ROLL_TYPE_JEU]
|
||||
|
||||
|
||||
export const DIFF = {
|
||||
|
||||
@@ -36,7 +36,7 @@ export class RollPartAttaque extends RollPartSelect {
|
||||
restore(rollData) {
|
||||
const saved = this.getSaved(rollData)
|
||||
super.restore(rollData)
|
||||
if (saved.dmg) {
|
||||
if (saved.dmg != undefined) {
|
||||
this.getCurrent(rollData).dmg = this.getSaved(rollData).dmg
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,22 +12,30 @@ export class RollPartCarac extends RollPartSelect {
|
||||
|
||||
loadRefs(rollData) {
|
||||
const refs = this.getRefs(rollData)
|
||||
refs.all = this.$getActorCaracs(rollData)
|
||||
const actor = rollData.active.actor
|
||||
refs.all = [...this.$getActorCaracs(actor), ...this.$getCaracCompetenceCreature(actor)]
|
||||
refs.caracs = refs.all
|
||||
this.$selectCarac(rollData)
|
||||
}
|
||||
|
||||
choices(refs) { return refs.caracs }
|
||||
|
||||
$getActorCaracs(rollData) {
|
||||
return Object.entries(rollData.active.actor.getCarac())
|
||||
$getActorCaracs(actor) {
|
||||
return Object.entries(actor.getCarac())
|
||||
.filter(([key, c]) => key != 'taille')
|
||||
/* TODO: filter by context */
|
||||
.map(([key, carac]) => {
|
||||
return RollPartCarac.$extractCarac(key, carac)
|
||||
})
|
||||
}
|
||||
|
||||
$getCaracCompetenceCreature(actor) {
|
||||
if (actor.isPersonnage()) {
|
||||
return []
|
||||
}
|
||||
return actor.getCompetences()
|
||||
.map(it => { return { key: it.name, label: it.name, value: parseInt(it.system.carac_value) } })
|
||||
}
|
||||
|
||||
static $extractCarac(key, carac) {
|
||||
return {
|
||||
key: key,
|
||||
@@ -40,7 +48,6 @@ export class RollPartCarac extends RollPartSelect {
|
||||
allowed = allowed.filter(it => it != undefined)
|
||||
const refs = this.getRefs(rollData)
|
||||
refs.caracs = allowed.length > 0
|
||||
// ? refs.all.filter(it => allowed.includes(Grammar.toLowerCaseNoAccent(it.key)))
|
||||
? refs.all.filter(it => allowed.includes(it.key))
|
||||
: refs.all
|
||||
this.$selectCarac(rollData)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { ITEM_TYPES } from "../constants.js"
|
||||
import { Grammar } from "../grammar.js"
|
||||
import { CARACS, RdDCarac } from "../rdd-carac.js"
|
||||
import { CARACS } from "../rdd-carac.js"
|
||||
import { RdDTimestamp } from "../time/rdd-timestamp.js"
|
||||
import { TMRUtility } from "../tmr-utility.js"
|
||||
import { ROLL_TYPE_MEDITATION } from "./roll-constants.mjs"
|
||||
import { PART_CARAC } from "./roll-part-carac.mjs"
|
||||
import { PART_CARAC, RollPartCarac } from "./roll-part-carac.mjs"
|
||||
import { PART_COMP } from "./roll-part-comp.mjs"
|
||||
import { RollPartSelect } from "./roll-part-select.mjs"
|
||||
import { ROLLDIALOG_SECTION } from "./roll-part.mjs"
|
||||
@@ -34,8 +34,9 @@ export class RollPartMeditation extends RollPartSelect {
|
||||
|
||||
loadRefs(rollData) {
|
||||
const refs = this.getRefs(rollData)
|
||||
refs.meditations = rollData.active.actor.itemTypes[ITEM_TYPES.meditation]
|
||||
.map(it => RollPartMeditation.$extractMeditation(it, rollData.active.actor))
|
||||
const actor = rollData.active.actor
|
||||
refs.meditations = actor.itemTypes[ITEM_TYPES.meditation]
|
||||
.map(it => RollPartMeditation.$extractMeditation(it, actor))
|
||||
|
||||
if (refs.meditations.length > 0) {
|
||||
this.$selectMeditation(rollData)
|
||||
|
||||
Reference in New Issue
Block a user