Files
fvtt-oath-hammer/module/documents/actor.mjs

32 lines
871 B
JavaScript

export default class OathHammerActor extends Actor {
async _preCreate(data, options, user) {
await super._preCreate(data, options, user)
const prototypeToken = {}
if (this.type === "character") {
Object.assign(prototypeToken, {
sight: { enabled: true },
actorLink: true,
disposition: CONST.TOKEN_DISPOSITIONS.FRIENDLY,
})
this.updateSource({ prototypeToken })
}
if (this.type === "npc") {
Object.assign(prototypeToken, {
sight: { enabled: false },
actorLink: false,
disposition: CONST.TOKEN_DISPOSITIONS.HOSTILE,
})
this.updateSource({ prototypeToken })
}
}
getArmorValue() {
for (const item of this.items) {
if (item.type === "armor" && item.system.equipped) {
return Number(item.system.armorValue) || 0
}
}
return 0
}
}