Compare commits

...

6 commits

8 changed files with 40 additions and 41 deletions

View file

@ -57,6 +57,7 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV
let returnMessage = game.i18n.localize('DAGGERHEART.UI.Chat.deathMove.avoidScar');
if (config.roll.fate.value <= this.actor.system.levelData.level.current) {
const maxHope = this.actor.system.resources.hope.max + this.actor.system.scars;
const newScarAmount = this.actor.system.scars + 1;
await this.actor.update({
system: {
@ -64,7 +65,7 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV
}
});
if (newScarAmount >= this.actor.system.resources.hope.max) {
if (newScarAmount >= maxHope) {
await this.actor.setDeathMoveDefeated(CONFIG.DH.GENERAL.defeatedConditionChoices.dead.id);
return game.i18n.format('DAGGERHEART.UI.Chat.deathMove.journeysEnd', { scars: newScarAmount });
}

View file

@ -124,7 +124,9 @@ export default class DHTokenHUD extends foundry.applications.hud.TokenHUD {
const animationDuration = 500;
const scene = game.scenes.get(game.user.viewedScene);
/* getDependentTokens returns already removed tokens with id = null. Need to filter that until it's potentially fixed from Foundry */
const activeTokens = actors.flatMap(member => member.getDependentTokens({ scenes: scene }).filter(x => x._id));
const activeTokens = actors.flatMap(member =>
member.getDependentTokens({ scenes: scene }).filter(x => x._id && !x._destroyed)
);
const { x: actorX, y: actorY } = this.document;
if (activeTokens.length > 0) {
for (let token of activeTokens) {

View file

@ -840,12 +840,13 @@ export default class DhCharacter extends DhCreature {
const newHopeMax = this.resources.hope.max + diff;
const newHopeValue = Math.min(newHopeMax, this.resources.hope.value);
if (newHopeValue != this.resources.hope.value) {
if (!changes.system.resources.hope) changes.system.resources.hope = { value: 0 };
changes.system.resources.hope = {
...changes.system.resources.hope,
value: changes.system.resources.hope.value + newHopeValue
};
changes.system = foundry.utils.mergeObject(changes.system ?? {}, {
resources: {
hope: {
value: (changes.system?.resources?.hope?.value ?? 0) + newHopeMax
}
}
});
}
}

View file

@ -141,16 +141,6 @@ export default class DHArmor extends AttachableItem {
}
}
_onUpdate(a, b, c) {
super._onUpdate(a, b, c);
if (this.actor?.type === 'character') {
for (const party of this.actor.parties) {
party.render();
}
}
}
/** @inheritDoc */
static migrateDocumentData(source) {
if (!source.system.armor) {

View file

@ -112,10 +112,22 @@ export default class DhpActor extends Actor {
this.updateSource(update);
}
/** Perform a render, debounced in order to prevent overloading repeat render requests */
renderDebounced = foundry.utils.debounce(options => {
return this.render(options);
}, 10);
_onUpdateDescendantDocuments(parent, collection, documents, changes, options, userId) {
super._onUpdateDescendantDocuments(parent, collection, documents, changes, options, userId);
for (const party of this.parties) {
party.renderDebounced({ parts: ['partyMembers'] });
}
}
_onUpdate(changes, options, userId) {
super._onUpdate(changes, options, userId);
for (const party of this.parties) {
party.render({ parts: ['partyMembers'] });
party.renderDebounced({ parts: ['partyMembers'] });
}
}
@ -134,7 +146,7 @@ export default class DhpActor extends Actor {
_onDelete(options, userId) {
super._onDelete(options, userId);
for (const party of this.parties) {
party.render({ parts: ['partyMembers'] });
party.renderDebounced({ parts: ['partyMembers'] });
}
}

View file

@ -2,16 +2,6 @@
@import '../../../utils/fonts.less';
@import '../../../utils/mixin.less';
body.game:is(.performance-low, .noblur) {
.application.sheet.daggerheart.actor.dh-style.party .tab.resources .actors-list .actor-resources {
background: light-dark(@dark-blue, @dark-golden);
.actor-name {
background: light-dark(@dark-blue, @dark-golden);
}
}
}
.application.sheet.daggerheart.actor.dh-style.party .tab.partyMembers {
overflow: auto;

View file

@ -4,7 +4,7 @@
"description": "An unofficial implementation of the Daggerheart system",
"version": "2.2.5",
"compatibility": {
"minimum": "14.359",
"minimum": "14.361",
"verified": "14.361",
"maximum": "14"
},

View file

@ -4,10 +4,6 @@
<input type="text" name="elevation" value="{{elevation}}" {{disabled (or locked (and isGamePaused (not isGM)))}}>
</div>
<button type="button" class="control-icon" data-action="sort" data-tooltip="HUD.ToFrontOrBack">
<i class="fa-solid fa-arrow-down-arrow-up" inert></i>
</button>
{{#if canChangeLevel}}
<button type="button" class="control-icon" data-action="togglePalette" data-palette="levels"
aria-label="{{ localize "HUD.ChangeLevel" }}" data-tooltip>
@ -20,6 +16,10 @@
</div>
{{/if}}
<button type="button" class="control-icon" data-action="sort" data-tooltip aria-label="HUD.ToFrontOrBack">
<i class="fa-solid fa-arrow-down-arrow-up" inert></i>
</button>
{{#if hasCompanion}}
<button type="button" class="control-icon clown-car" data-action="toggleCompanions" data-tooltip="{{#if companionOnCanvas}}{{localize "DAGGERHEART.APPLICATIONS.HUD.tokenHUD.retrieveCompanionTokens"}}{{else}}{{localize "DAGGERHEART.APPLICATIONS.HUD.tokenHUD.depositCompanionTokens"}}{{/if}}">
<img {{#if companionOnCanvas}}class="flipped"{{/if}} src="{{icons.toggleClowncar}}">
@ -27,7 +27,7 @@
{{/if}}
{{#if canConfigure}}
<button type="button" class="control-icon" data-action="config" data-tooltip="HUD.OpenConfig">
<button type="button" class="control-icon" data-action="config" data-tooltip aria-label="HUD.OpenConfig">
<i class="fa-solid fa-gear" inert></i>
</button>
{{/if}}
@ -49,8 +49,9 @@
<div class="col right">
{{#if isGM}}
<button type="button" class="control-icon {{visibilityClass}}" data-action="visibility" data-tooltip="HUD.ToggleVis">
<img src="{{icons.visibility}}">
<button type="button" class="control-icon {{visibilityClass}}" data-action="visibility"
data-tooltip aria-label="{{localize (ifThen visibilityClass "HUD.Show" "HUD.Hide")}}">
<i class="fa-solid {{ifThen hidden "fa-eye-slash" "fa-eye"}}" inert></i>
</button>
{{/if}}
@ -119,13 +120,15 @@
{{/each}}
</div>
<button type="button" class="control-icon {{targetClass}}" data-action="target" data-tooltip="HUD.ToggleTargetState">
<button type="button" class="control-icon {{targetClass}}" data-action="target"
data-tooltip aria-label="{{localize (ifThen targetClass "HUD.Untarget" "HUD.Target")}}">
<i class="fa-solid fa-bullseye" inert></i>
</button>
{{#if canToggleCombat}}
<button type="button" class="control-icon {{combatClass}}" data-action="combat" data-tooltip="HUD.ToggleCombatState">
<img src="{{icons.combat}}">
<button type="button" class="control-icon {{combatClass}}" data-action="combat"
data-tooltip aria-label="{{localize (ifThen combatClass "HUD.ExitCombat" "HUD.EnterCombat")}}">
<i class="fa-solid fa-swords" inert></i>
</button>
{{/if}}
</div>