mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-11 19:25:21 +01:00
[Feature/Fixes] Adversary Touchups (#359)
* Added support for automatic horde damage * Active effects are shown on the token * Fixed logic * Fixed d20 dice lightmode color
This commit is contained in:
parent
727cb692b4
commit
b40d053201
19 changed files with 134 additions and 24 deletions
|
|
@ -1,4 +1,5 @@
|
|||
export { default as DhMeasuredTemplate } from './measuredTemplate.mjs';
|
||||
export { default as DhRuler } from './ruler.mjs';
|
||||
export { default as DhTemplateLayer } from './templateLayer.mjs';
|
||||
export { default as DhTokenPlaceable } from './token.mjs';
|
||||
export { default as DhTokenRuler } from './tokenRuler.mjs';
|
||||
|
|
|
|||
36
module/canvas/placeables/token.mjs
Normal file
36
module/canvas/placeables/token.mjs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
export default class DhTokenPlaceable extends foundry.canvas.placeables.Token {
|
||||
/** @inheritDoc */
|
||||
async _drawEffects() {
|
||||
this.effects.renderable = false;
|
||||
|
||||
// Clear Effects Container
|
||||
this.effects.removeChildren().forEach(c => c.destroy());
|
||||
this.effects.bg = this.effects.addChild(new PIXI.Graphics());
|
||||
this.effects.bg.zIndex = -1;
|
||||
this.effects.overlay = null;
|
||||
|
||||
// Categorize effects
|
||||
const activeEffects = this.actor ? Array.from(this.actor.effects).filter(x => !x.disabled) : [];
|
||||
const overlayEffect = activeEffects.findLast(e => e.img && e.getFlag('core', 'overlay'));
|
||||
|
||||
// Draw effects
|
||||
const promises = [];
|
||||
for (const [i, effect] of activeEffects.entries()) {
|
||||
if (!effect.img) continue;
|
||||
const promise =
|
||||
effect === overlayEffect
|
||||
? this._drawOverlay(effect.img, effect.tint)
|
||||
: this._drawEffect(effect.img, effect.tint);
|
||||
promises.push(
|
||||
promise.then(e => {
|
||||
if (e) e.zIndex = i;
|
||||
})
|
||||
);
|
||||
}
|
||||
await Promise.allSettled(promises);
|
||||
|
||||
this.effects.sortChildren();
|
||||
this.effects.renderable = true;
|
||||
this.renderFlags.set({ refreshEffects: true });
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue