mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-18 07:59:03 +01:00
k
This commit is contained in:
parent
e4badd93d0
commit
5d6eb4b145
5 changed files with 22 additions and 15 deletions
|
|
@ -639,9 +639,9 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(() => {
|
// setTimeout(() => {
|
||||||
this.consumeResource(result?.costs);
|
// this.consumeResource(result?.costs);
|
||||||
}, 50);
|
// }, 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
async consumeResource(costs) {
|
async consumeResource(costs) {
|
||||||
|
|
|
||||||
|
|
@ -208,6 +208,7 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
||||||
}
|
}
|
||||||
|
|
||||||
async consume(config, successCost = false) {
|
async consume(config, successCost = false) {
|
||||||
|
console.log("Action consume", config)
|
||||||
const usefulResources = {
|
const usefulResources = {
|
||||||
...foundry.utils.deepClone(this.actor.system.resources),
|
...foundry.utils.deepClone(this.actor.system.resources),
|
||||||
fear: {
|
fear: {
|
||||||
|
|
@ -246,6 +247,7 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
console.log(resources)
|
||||||
await (this.actor.system.partner ?? this.actor).modifyResource(resources);
|
await (this.actor.system.partner ?? this.actor).modifyResource(resources);
|
||||||
if (
|
if (
|
||||||
config.uses?.enabled &&
|
config.uses?.enabled &&
|
||||||
|
|
|
||||||
|
|
@ -222,26 +222,29 @@ export const registerRollDiceHooks = () => {
|
||||||
)
|
)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const actor = await fromUuid(config.source.actor),
|
const actor = await fromUuid(config.source.actor);
|
||||||
updates = [];
|
let updates = [];
|
||||||
if (!actor) return;
|
if (!actor) return;
|
||||||
if (config.roll.isCritical || config.roll.result.duality === 1) updates.push({ key: 'hope', value: 1 });
|
if (config.roll.isCritical || config.roll.result.duality === 1) updates.push({ key: 'hope', value: 1, total: -1, enabled: true });
|
||||||
if (config.roll.isCritical) updates.push({ key: 'stress', value: -1 });
|
if (config.roll.isCritical) updates.push({ key: 'stress', value: -1, total: 1, enabled: true });
|
||||||
if (config.roll.result.duality === -1) updates.push({ key: 'fear', value: 1 });
|
if (config.roll.result.duality === -1) updates.push({ key: 'fear', value: 1, total: -1, enabled: true });
|
||||||
|
|
||||||
if (config.rerolledRoll) {
|
if (config.rerolledRoll) {
|
||||||
if (config.rerolledRoll.isCritical || config.rerolledRoll.result.duality === 1)
|
if (config.rerolledRoll.isCritical || config.rerolledRoll.result.duality === 1)
|
||||||
updates.push({ key: 'hope', value: -1 });
|
updates.push({ key: 'hope', value: -1, total: 1, enabled: true });
|
||||||
if (config.rerolledRoll.isCritical) updates.push({ key: 'stress', value: 1 });
|
if (config.rerolledRoll.isCritical) updates.push({ key: 'stress', value: 1, total: -1, enabled: true });
|
||||||
if (config.rerolledRoll.result.duality === -1) updates.push({ key: 'fear', value: -1 });
|
if (config.rerolledRoll.result.duality === -1) updates.push({ key: 'fear', value: -1, total: 1, enabled: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updates.length) {
|
if (updates.length) {
|
||||||
const target = actor.system.partner ?? actor;
|
const target = actor.system.partner ?? actor;
|
||||||
if (!['dead', 'unconscious'].some(x => actor.statuses.has(x))) {
|
if (!['dead', 'unconscious'].some(x => actor.statuses.has(x))) {
|
||||||
setTimeout(() => {
|
console.log(config.costs, updates)
|
||||||
|
updates = [...(config.costs ?? []), ...updates];
|
||||||
|
if(config.source.action)
|
||||||
|
config.costs = updates;
|
||||||
|
else
|
||||||
target.modifyResource(updates);
|
target.modifyResource(updates);
|
||||||
}, 50);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -254,5 +257,7 @@ export const registerRollDiceHooks = () => {
|
||||||
const currentCombatant = game.combat.combatants.get(game.combat.current?.combatantId);
|
const currentCombatant = game.combat.combatants.get(game.combat.current?.combatantId);
|
||||||
if (currentCombatant?.actorId == actor.id) ui.combat.setCombatantSpotlight(currentCombatant.id);
|
if (currentCombatant?.actorId == actor.id) ui.combat.setCombatantSpotlight(currentCombatant.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
|
||||||
|
|
||||||
if(!game.user.isGM) {
|
if(!game.user.isGM) {
|
||||||
const applyButtons = html.querySelector(".apply-buttons");
|
const applyButtons = html.querySelector(".apply-buttons");
|
||||||
applyButtons.remove();
|
applyButtons?.remove();
|
||||||
if(!this.isAuthor && !this.speakerActor?.isOwner) {
|
if(!this.isAuthor && !this.speakerActor?.isOwner) {
|
||||||
const buttons = html.querySelectorAll(".ability-card-footer > .ability-use-button");
|
const buttons = html.querySelectorAll(".ability-card-footer > .ability-use-button");
|
||||||
buttons.forEach(b => b.remove());
|
buttons.forEach(b => b.remove());
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<legend>
|
<legend>
|
||||||
{{localize "DAGGERHEART.UI.Chat.dicePool.title"}}
|
{{localize "DAGGERHEART.UI.Chat.dicePool.title"}}
|
||||||
</legend>
|
</legend>
|
||||||
<div class="roll-dice">
|
<div class="roll-dice">{{log @root}}
|
||||||
{{#each parts}}
|
{{#each parts}}
|
||||||
{{#each rolls}}
|
{{#each rolls}}
|
||||||
<div class="roll-die">
|
<div class="roll-die">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue