Addnew sheets (armor, weapons, malefica) and v13 support
This commit is contained in:
@@ -10,25 +10,11 @@ export default class HellbornActor extends foundry.abstract.TypeDataModel {
|
||||
schema.description = new fields.HTMLField({ required: true, textSearch: true })
|
||||
schema.notes = new fields.HTMLField({ required: true, textSearch: true })
|
||||
schema.name = new fields.StringField({ required: true, nullable: false, initial: "" })
|
||||
schema.concept = new fields.StringField({ required: true, nullable: false, initial: "" })
|
||||
schema.pronouns = new fields.StringField({ required: true, nullable: false, initial: "" })
|
||||
schema.species = new fields.StringField({ required: true, nullable: false, initial: "" })
|
||||
schema.archetype = new fields.StringField({ required: true, nullable: false, initial: "" })
|
||||
|
||||
// Carac
|
||||
const skillField = (label) => {
|
||||
const schema = {
|
||||
value: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0, max: 5 }),
|
||||
label: new fields.StringField({ required: true, nullable: false, initial: label })
|
||||
}
|
||||
return new fields.SchemaField(schema, { label })
|
||||
}
|
||||
|
||||
schema.skills = new fields.SchemaField(
|
||||
Object.values(SYSTEM.SKILLS).reduce((obj, characteristic) => {
|
||||
obj[characteristic.id] = skillField(characteristic.label)
|
||||
return obj
|
||||
}, {}),
|
||||
)
|
||||
schema.trait = new fields.StringField({ required: true, nullable: false, initial: "" })
|
||||
schema.upright = new fields.StringField({ required: true, nullable: false, initial: "" })
|
||||
schema.reversed = new fields.StringField({ required: true, nullable: false, initial: "" })
|
||||
|
||||
schema.heroPoints = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
|
||||
|
||||
@@ -77,30 +63,6 @@ export default class HellbornActor extends foundry.abstract.TypeDataModel {
|
||||
prepareDerivedData() {
|
||||
super.prepareDerivedData();
|
||||
|
||||
let encMax = 10 + (2*this.skills.physical.value)
|
||||
if (encMax !== this.enc.max) {
|
||||
this.enc.max = encMax
|
||||
}
|
||||
let enc = 0
|
||||
let armor = 0
|
||||
for (let i of this.parent.items) {
|
||||
if (i.system?.enc) {
|
||||
enc += i.system.enc
|
||||
}
|
||||
if ( i.system?.protection) {
|
||||
armor += i.system.protection
|
||||
}
|
||||
}
|
||||
if (enc !== this.enc.value) {
|
||||
this.enc.value = enc
|
||||
}
|
||||
if (armor !== this.armor.value) {
|
||||
this.armor.value = armor
|
||||
}
|
||||
let staminaMax = 14 + (3*this.skills.physical.value)
|
||||
if (staminaMax !== this.health.staminaMax) {
|
||||
this.health.staminaMax = staminaMax
|
||||
}
|
||||
}
|
||||
|
||||
isEncumbered() {
|
||||
@@ -125,7 +87,6 @@ export default class HellbornActor extends foundry.abstract.TypeDataModel {
|
||||
actorName: this.parent.name,
|
||||
actorImage: this.parent.img,
|
||||
talents: this.parent.items.filter(i => i.type === "talent" && i.system.isAdvantage),
|
||||
isEncumbered: this.isEncumbered(),
|
||||
hasTarget,
|
||||
target: opponentTarget
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user