diff --git a/src/module/data/actor/CharacterDataModel.js b/src/module/data/actor/CharacterDataModel.js index a4c5eea6..5faff8d3 100644 --- a/src/module/data/actor/CharacterDataModel.js +++ b/src/module/data/actor/CharacterDataModel.js @@ -20,6 +20,7 @@ export default class CharacterDataModel extends foundry.abstract.DataModel { attributes: attributes(), characteristics: characteristics(type), isPC: makeBoolField(true), + fastturn: makeBoolField(), level: makeIntField(), ancestry: makeStringField(), // Unused religion: new foundry.data.fields.SchemaField({ diff --git a/src/module/data/actor/CreatureDataModel.js b/src/module/data/actor/CreatureDataModel.js index 34837043..667a5ad4 100644 --- a/src/module/data/actor/CreatureDataModel.js +++ b/src/module/data/actor/CreatureDataModel.js @@ -19,7 +19,7 @@ export default class CreatureDataModel extends foundry.abstract.DataModel { enrichedDescription: makeHtmlField(), attributes: attributes(), characteristics: characteristics(type), - + fastturn: makeBoolField(), difficulty: makeIntField(), frightening: makeBoolField(), horrifying: makeBoolField(), diff --git a/src/module/data/actor/VehicleDataModel.js b/src/module/data/actor/VehicleDataModel.js index cacfc713..79515b63 100644 --- a/src/module/data/actor/VehicleDataModel.js +++ b/src/module/data/actor/VehicleDataModel.js @@ -4,6 +4,7 @@ import { } from '../common.js' import { + makeBoolField, makeIntField, makeStringField, makeHtmlField @@ -18,7 +19,7 @@ export default class VehicleDataModel extends foundry.abstract.DataModel { enrichedDescription: makeHtmlField(), attributes: attributes(), characteristics: characteristics(type), - + fastturn: makeBoolField(), descriptor: makeStringField(), speedtraits: makeStringField(), price: makeStringField(), diff --git a/src/module/data/common.js b/src/module/data/common.js index ebbc437f..3a01c533 100644 --- a/src/module/data/common.js +++ b/src/module/data/common.js @@ -6,7 +6,7 @@ export function attributes() { agility: makeAttribute('agility'), intellect: makeAttribute('intellect'), will: makeAttribute('will'), - perception: makeAttribute('perception') + perception: makeAttribute('perception', 25) }) } @@ -19,7 +19,7 @@ export function characteristics(actorType) { insanity: makeInsanity(), corruption: makeCorruption(), power: makeIntField(), - size: makeStringField(), + size: makeStringField("1"), speed: makeIntField(10), fortune: makeIntField() }) @@ -30,7 +30,7 @@ export function characteristics(actorType) { insanity: makeInsanity(), corruption: makeCorruption(), power: makeIntField(), - size: makeStringField(), + size: makeStringField("1"), speed: makeIntField(10), speedtraits: makeStringField(), difficulty: makeIntField(), @@ -44,7 +44,7 @@ export function characteristics(actorType) { return new foundry.data.fields.SchemaField({ defense: makeIntField(), health: makeHealth(), - size: makeStringField(), + size: makeStringField("1"), speed: makeIntField(10), speedtraits: makeStringField(), descriptor: makeStringField("object (vehicle)"), diff --git a/src/module/data/helpers.js b/src/module/data/helpers.js index e17476ae..9ea884a5 100644 --- a/src/module/data/helpers.js +++ b/src/module/data/helpers.js @@ -6,7 +6,7 @@ export function makeBoolField(init = false) { }) } -export function makeNumberField(init = 1, max = 20, min = 0) { +export function makeNumberField(init = 1, max, min) { return new foundry.data.fields.NumberField({ required: true, initial: init, @@ -16,7 +16,7 @@ export function makeNumberField(init = 1, max = 20, min = 0) { }) } -export function makeIntField(init = 0, max = 20, min = 0) { +export function makeIntField(init = 0, max, min) { return new foundry.data.fields.NumberField({ required: true, initial: init, @@ -46,14 +46,14 @@ export function makeObjectField() { }) } -export function makeAttribute(attribute) { +export function makeAttribute(attribute, max = 20) { return new foundry.data.fields.SchemaField({ key: makeStringField(attribute), label: makeStringField(game.i18n.localize(`DL.Attribute${capitalize(attribute)}`)), - value: makeIntField(10), + value: makeIntField(10, max, 1), modifier: makeIntField(), min: makeIntField(), - max: makeIntField(20), + max: makeIntField(max), immune: makeBoolField() }) } @@ -61,7 +61,7 @@ export function makeAttribute(attribute) { export function makeHealth() { return new foundry.data.fields.SchemaField({ max: makeIntField(), - value: makeIntField(), + value: makeIntField(0), injured: makeBoolField(), healingrate: makeIntField() }) diff --git a/src/module/data/item/AncestryDataModel.js b/src/module/data/item/AncestryDataModel.js index 1e3f3d7f..d0e8432a 100644 --- a/src/module/data/item/AncestryDataModel.js +++ b/src/module/data/item/AncestryDataModel.js @@ -64,7 +64,7 @@ export default class AncestryDataModel extends foundry.abstract.DataModel { }) }), level4: new foundry.data.fields.SchemaField({ - healthbonuses: makeIntField(), + healthbonus: makeIntField(), option1: makeBoolField(true), option1text: makeStringField(), talent: new foundry.data.fields.ArrayField(levelItem(makeTalentSchema)), @@ -81,8 +81,6 @@ export default class AncestryDataModel extends foundry.abstract.DataModel { } static migrateData(source) { - console.log(source) - if (parseInt(source.characteristics?.insanity)) { const insanity = parseInt(source.characteristics.insanity) source.characteristics.insanity = { diff --git a/src/module/data/item/EndOfTheRoundDataModel.js b/src/module/data/item/EndOfTheRoundDataModel.js index f92b0516..d0a432a0 100644 --- a/src/module/data/item/EndOfTheRoundDataModel.js +++ b/src/module/data/item/EndOfTheRoundDataModel.js @@ -1,5 +1,5 @@ -import { action } from '../common.js' +import { action, activatedEffect } from '../common.js' import { makeHtmlField, @@ -10,7 +10,8 @@ export default class EndOfTheRoundDataModel extends foundry.abstract.DataModel { return { description: makeHtmlField(), enrichedDescription: makeHtmlField(), - action: action() + action: action(), + activatedEffect: activatedEffect(), } } } @@ -19,6 +20,7 @@ export function makeEndOfTheRoundSchema() { return new foundry.data.fields.SchemaField({ description: makeHtmlField(), enrichedDescription: makeHtmlField(), - action: action() + action: action(), + activatedEffect: activatedEffect(), }) } \ No newline at end of file diff --git a/src/module/data/item/WeaponDataModel.js b/src/module/data/item/WeaponDataModel.js index 08d24b37..a64eefff 100644 --- a/src/module/data/item/WeaponDataModel.js +++ b/src/module/data/item/WeaponDataModel.js @@ -1,4 +1,4 @@ -import { action } from '../common.js' +import { action, activatedEffect } from '../common.js' import { makeBoolField, makeHtmlField, makeIntField, makeStringField } from '../helpers.js' export default class WeaponDataModel extends foundry.abstract.DataModel { @@ -6,6 +6,7 @@ export default class WeaponDataModel extends foundry.abstract.DataModel { return { description: makeHtmlField(), action: action(), + activatedEffect: activatedEffect(), enrichedDescription: makeHtmlField(), hands: makeStringField(), properties: makeStringField(), @@ -25,6 +26,7 @@ export function makeWeaponSchema() { return new foundry.data.fields.SchemaField({ description: makeHtmlField(), action: action(), + activatedEffect: activatedEffect(), enrichedDescription: makeHtmlField(), hands: makeStringField(), properties: makeStringField(), diff --git a/src/module/demonlord.js b/src/module/demonlord.js index ce34b0bf..2788f330 100644 --- a/src/module/demonlord.js +++ b/src/module/demonlord.js @@ -207,6 +207,7 @@ Hooks.once('setup', function () { * Set default values for new actors' tokens */ Hooks.on('createActor', async (actor, _options, _id) => { + if (!actor.isOwner) return let disposition = CONST.TOKEN_DISPOSITIONS.NEUTRAL if (actor.type === 'creature') disposition = CONST.TOKEN_DISPOSITIONS.HOSTILE @@ -231,6 +232,7 @@ Hooks.on('createToken', async _tokenDocument => { }) Hooks.on('updateActor', async (actor, updateData) => { + if (!actor.isOwner) return // Update the combat initiative if the actor has changed its turn speed const isUpdateTurn = typeof updateData?.system?.fastturn !== 'undefined' && updateData?.system?.fastturn !== null if (!(isUpdateTurn && (game.user.isGM || actor.isOwner) && game.combat)) return diff --git a/src/module/pixi/token-manager.js b/src/module/pixi/token-manager.js index 4d37ea28..14701386 100644 --- a/src/module/pixi/token-manager.js +++ b/src/module/pixi/token-manager.js @@ -18,7 +18,7 @@ export class TokenManager { } getTokenByActorId(actorId) { - return canvas.tokens.placeables.find(token => token.actor.id === actorId) + return canvas.tokens.placeables.find(token => token?.actor?.id === actorId) } warnNotSelected() {