mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
[Fix] Beastform Effect Size Issue (#1368)
* Fixed so beastform effects handle actors being smaller than 1 * .
This commit is contained in:
parent
6d8d773a26
commit
c3cb9121af
2 changed files with 38 additions and 2 deletions
|
|
@ -19,8 +19,8 @@ export default class BeastformEffect extends BaseEffect {
|
||||||
base64: false
|
base64: false
|
||||||
}),
|
}),
|
||||||
tokenSize: new fields.SchemaField({
|
tokenSize: new fields.SchemaField({
|
||||||
height: new fields.NumberField({ integer: true, nullable: true }),
|
height: new fields.NumberField({ integer: false, nullable: true }),
|
||||||
width: new fields.NumberField({ integer: true, nullable: true })
|
width: new fields.NumberField({ integer: false, nullable: true })
|
||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
advantageOn: new fields.ArrayField(new fields.StringField()),
|
advantageOn: new fields.ArrayField(new fields.StringField()),
|
||||||
|
|
@ -29,6 +29,14 @@ export default class BeastformEffect extends BaseEffect {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @inheritDoc */
|
||||||
|
static migrateData(source) {
|
||||||
|
if (!source.characterTokenData.tokenSize.height) source.characterTokenData.tokenSize.height = 1;
|
||||||
|
if (!source.characterTokenData.tokenSize.width) source.characterTokenData.tokenSize.width = 1;
|
||||||
|
|
||||||
|
return super.migrateData(source);
|
||||||
|
}
|
||||||
|
|
||||||
async _onCreate(_data, _options, userId) {
|
async _onCreate(_data, _options, userId) {
|
||||||
if (userId !== game.user.id) return;
|
if (userId !== game.user.id) return;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -877,4 +877,32 @@ export default class DhpActor extends Actor {
|
||||||
return acc;
|
return acc;
|
||||||
}, []);
|
}, []);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Temporarily copying the foundry method to add a fix to a bug with scenes
|
||||||
|
https://discord.com/channels/170995199584108546/1296292044011995136/1446693077443149856
|
||||||
|
*/
|
||||||
|
getDependentTokens({ scenes, linked = false } = {}) {
|
||||||
|
if (this.isToken && !scenes) return [this.token];
|
||||||
|
if (scenes) scenes = Array.isArray(scenes) ? scenes : [scenes];
|
||||||
|
else scenes = Array.from(this._dependentTokens.keys());
|
||||||
|
|
||||||
|
/* Code to filter out nonexistant scenes */
|
||||||
|
scenes = scenes.filter(scene => game.scenes.some(x => x.id === scene.id));
|
||||||
|
|
||||||
|
if (this.isToken) {
|
||||||
|
const parent = this.token.parent;
|
||||||
|
return scenes.includes(parent) ? [this.token] : [];
|
||||||
|
}
|
||||||
|
|
||||||
|
const allTokens = [];
|
||||||
|
for (const scene of scenes) {
|
||||||
|
if (!scene) continue;
|
||||||
|
const tokens = this._dependentTokens.get(scene);
|
||||||
|
for (const token of tokens ?? []) {
|
||||||
|
if (!linked || token.actorLink) allTokens.push(token);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return allTokens;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue