Initial import
This commit is contained in:
35
module/documents/actor.mjs
Normal file
35
module/documents/actor.mjs
Normal file
@@ -0,0 +1,35 @@
|
||||
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 })
|
||||
}
|
||||
}
|
||||
|
||||
getArmorRating() {
|
||||
let rating = 0
|
||||
for (const item of this.items) {
|
||||
if (item.type === "armor" && item.system.equipped) {
|
||||
rating += Number(item.system.armorRating) || 0
|
||||
}
|
||||
if (item.type === "shield" && item.system.equipped) {
|
||||
rating += Number(item.system.shieldBonus) || 0
|
||||
}
|
||||
}
|
||||
return rating
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user