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(() => {
|
||||
this.consumeResource(result?.costs);
|
||||
}, 50);
|
||||
// setTimeout(() => {
|
||||
// this.consumeResource(result?.costs);
|
||||
// }, 50);
|
||||
}
|
||||
|
||||
async consumeResource(costs) {
|
||||
|
|
|
|||
|
|
@ -208,6 +208,7 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
|||
}
|
||||
|
||||
async consume(config, successCost = false) {
|
||||
console.log("Action consume", config)
|
||||
const usefulResources = {
|
||||
...foundry.utils.deepClone(this.actor.system.resources),
|
||||
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);
|
||||
if (
|
||||
config.uses?.enabled &&
|
||||
|
|
|
|||
|
|
@ -222,26 +222,29 @@ export const registerRollDiceHooks = () => {
|
|||
)
|
||||
return;
|
||||
|
||||
const actor = await fromUuid(config.source.actor),
|
||||
updates = [];
|
||||
const actor = await fromUuid(config.source.actor);
|
||||
let updates = [];
|
||||
if (!actor) return;
|
||||
if (config.roll.isCritical || config.roll.result.duality === 1) updates.push({ key: 'hope', value: 1 });
|
||||
if (config.roll.isCritical) updates.push({ key: 'stress', value: -1 });
|
||||
if (config.roll.result.duality === -1) updates.push({ key: 'fear', 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, total: 1, enabled: true });
|
||||
if (config.roll.result.duality === -1) updates.push({ key: 'fear', value: 1, total: -1, enabled: true });
|
||||
|
||||
if (config.rerolledRoll) {
|
||||
if (config.rerolledRoll.isCritical || config.rerolledRoll.result.duality === 1)
|
||||
updates.push({ key: 'hope', value: -1 });
|
||||
if (config.rerolledRoll.isCritical) updates.push({ key: 'stress', value: 1 });
|
||||
if (config.rerolledRoll.result.duality === -1) updates.push({ key: 'fear', value: -1 });
|
||||
updates.push({ key: 'hope', value: -1, total: 1, enabled: true });
|
||||
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, total: 1, enabled: true });
|
||||
}
|
||||
|
||||
if (updates.length) {
|
||||
const target = actor.system.partner ?? actor;
|
||||
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);
|
||||
}, 50);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -254,5 +257,7 @@ export const registerRollDiceHooks = () => {
|
|||
const currentCombatant = game.combat.combatants.get(game.combat.current?.combatantId);
|
||||
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) {
|
||||
const applyButtons = html.querySelector(".apply-buttons");
|
||||
applyButtons.remove();
|
||||
applyButtons?.remove();
|
||||
if(!this.isAuthor && !this.speakerActor?.isOwner) {
|
||||
const buttons = html.querySelectorAll(".ability-card-footer > .ability-use-button");
|
||||
buttons.forEach(b => b.remove());
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<legend>
|
||||
{{localize "DAGGERHEART.UI.Chat.dicePool.title"}}
|
||||
</legend>
|
||||
<div class="roll-dice">
|
||||
<div class="roll-dice">{{log @root}}
|
||||
{{#each parts}}
|
||||
{{#each rolls}}
|
||||
<div class="roll-die">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue