Fix spells

This commit is contained in:
2024-09-12 22:43:09 +02:00
parent 133f7aa428
commit 819548567b
99 changed files with 338 additions and 326 deletions

View File

@ -27,7 +27,7 @@ export class BoLActor extends Actor {
}
weapon.system.properties.attackModifiers = 1
weapon.system.properties.damage = "1d6M"
data.items = [ weapon ]
data.items = [weapon]
data.img = "systems/bol/ui/icons/icon-horde-token.webp"
data.prototypeToken = { texture: "systems/bol/ui/icons/icon-horde-token.webp" }
@ -79,10 +79,12 @@ export class BoLActor extends Actor {
// Configure prototype token settings
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 === "character") {
Object.assign(prototypeToken, {
sight: { enabled: true }, actorLink: true, disposition: CONST.TOKEN_DISPOSITIONS.FRIENDLY
});
this.updateSource({ prototypeToken });
}
}
/* -------------------------------------------- */
@ -948,16 +950,16 @@ export class BoLActor extends Actor {
this.checkNumeric(data.system.resources)
}
// Apply changes in Horde size to Token width/height
if (this.type == "horde" ) {
if (this.type == "horde") {
if (data?.system?.hordesize) { // If horde size is changed}
let newHP = data.system.hordesize * this.system.hordebasehp
if (newHP != this.system.resources.hp.value) {
data.system.resources = { hp: { value: newHP, max: newHP } } // Update HP
}
let tokenSize = this.getTokenSizeFromHordeSize(data?.system?.hordesize)
if (this.isToken && (tokenSize !== this.token.width)) {
if (this.isToken && (tokenSize !== this.token.width)) {
this.token.update({ width: tokenSize, height: tokenSize })
} else {
} else {
if (tokenSize && (tokenSize !== this.prototypeToken.width)) {
if (!foundry.utils.hasProperty(data, "prototypeToken.width")) {
data.prototypeToken ||= {};
@ -970,7 +972,7 @@ export class BoLActor extends Actor {
if (data?.system?.hordebasehp) {
let newHP = this.system.hordesize * data.system.hordebasehp
if (newHP != this.system.resources.hp.value) {
data.system.resources = { hp: { value : newHP, max: newHP} }
data.system.resources = { hp: { value: newHP, max: newHP } }
}
}
}
@ -1084,12 +1086,13 @@ export class BoLActor extends Actor {
}
/* -------------------------------------------- */
rollProtection(itemId) {
async rollProtection(itemId) {
let armor = foundry.utils.duplicate(this.items.get(itemId))
if (armor) {
let armorFormula = "max(" + armor.system.properties.soak.formula + ", 0)"
let rollArmor = new Roll(armorFormula)
rollArmor.roll({ async: false }).toMessage()
await rollArmor.roll()
rollArmor.toMessage()
}
}