mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 11:41:08 +01:00
Added support for adversary actor sizes
This commit is contained in:
parent
9b4249b100
commit
d38b924cad
15 changed files with 180 additions and 5 deletions
|
|
@ -41,7 +41,8 @@ export default class BaseDataActor extends foundry.abstract.TypeDataModel {
|
|||
settingSheet: null,
|
||||
hasResistances: true,
|
||||
hasAttribution: false,
|
||||
hasLimitedView: true
|
||||
hasLimitedView: true,
|
||||
usesSize: true
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -76,6 +77,13 @@ export default class BaseDataActor extends foundry.abstract.TypeDataModel {
|
|||
'DAGGERHEART.GENERAL.DamageResistance.magicalReduction'
|
||||
)
|
||||
});
|
||||
if (this.metadata.usesSize)
|
||||
schema.size = new fields.StringField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
choices: CONFIG.DH.ACTOR.tokenSize,
|
||||
initial: CONFIG.DH.ACTOR.tokenSize.medium.id
|
||||
});
|
||||
return schema;
|
||||
}
|
||||
|
||||
|
|
@ -138,6 +146,14 @@ export default class BaseDataActor extends foundry.abstract.TypeDataModel {
|
|||
options.scrollingTextData = textData;
|
||||
}
|
||||
|
||||
if (!this.parent.isToken && changes.system?.size) {
|
||||
const tokenSizes = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).tokenSizes;
|
||||
this.parent.prototypeToken.update({
|
||||
width: tokenSizes[changes.system.size],
|
||||
height: tokenSizes[changes.system.size]
|
||||
});
|
||||
}
|
||||
|
||||
if (changes.system?.resources) {
|
||||
const defeatedSettings = game.settings.get(
|
||||
CONFIG.DH.id,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,13 @@ import BaseDataActor from './base.mjs';
|
|||
import ForeignDocumentUUIDArrayField from '../fields/foreignDocumentUUIDArrayField.mjs';
|
||||
|
||||
export default class DhParty extends BaseDataActor {
|
||||
/**@inheritdoc */
|
||||
static get metadata() {
|
||||
return foundry.utils.mergeObject(super.metadata, {
|
||||
usesSize: false
|
||||
});
|
||||
}
|
||||
|
||||
/**@inheritdoc */
|
||||
static defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
|
|
@ -26,7 +33,7 @@ export default class DhParty extends BaseDataActor {
|
|||
/* -------------------------------------------- */
|
||||
|
||||
isItemValid(source) {
|
||||
return ["weapon", "armor", "consumable", "loot"].includes(source.type);
|
||||
return ['weapon', 'armor', 'consumable', 'loot'].includes(source.type);
|
||||
}
|
||||
|
||||
prepareBaseData() {
|
||||
|
|
|
|||
|
|
@ -40,6 +40,38 @@ export default class DhHomebrew extends foundry.abstract.DataModel {
|
|||
traitArray: new fields.ArrayField(new fields.NumberField({ required: true, integer: true }), {
|
||||
initial: () => [2, 1, 1, 0, 0, -1]
|
||||
}),
|
||||
tokenSizes: new fields.SchemaField({
|
||||
tiny: new fields.NumberField({
|
||||
integer: false,
|
||||
initial: 0.4,
|
||||
label: 'DAGGERHEART.CONFIG.TokenSize.tiny'
|
||||
}),
|
||||
small: new fields.NumberField({
|
||||
integer: false,
|
||||
initial: 0.6,
|
||||
label: 'DAGGERHEART.CONFIG.TokenSize.small'
|
||||
}),
|
||||
medium: new fields.NumberField({
|
||||
integer: false,
|
||||
initial: 1,
|
||||
label: 'DAGGERHEART.CONFIG.TokenSize.medium'
|
||||
}),
|
||||
large: new fields.NumberField({
|
||||
integer: false,
|
||||
initial: 2,
|
||||
label: 'DAGGERHEART.CONFIG.TokenSize.large'
|
||||
}),
|
||||
huge: new fields.NumberField({
|
||||
integer: false,
|
||||
initial: 3,
|
||||
label: 'DAGGERHEART.CONFIG.TokenSize.huge'
|
||||
}),
|
||||
gargantuan: new fields.NumberField({
|
||||
integer: false,
|
||||
initial: 4,
|
||||
label: 'DAGGERHEART.CONFIG.TokenSize.gargantuan'
|
||||
})
|
||||
}),
|
||||
currency: new fields.SchemaField({
|
||||
title: new fields.StringField({
|
||||
required: true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue