mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-11 19:25:21 +01:00
merge main to development (#1244)
* Fixed typo of defi ant to defiant (#1175) Co-authored-by: Chris Ryan <chrisr@blackhole> * Add dice value support to Advesaries and Environments (#1186) Co-authored-by: Chris Ryan <chrisr@blackhole> * Update Powerful Beast for Errata changes (#1185) Co-authored-by: Chris Ryan <chrisr@blackhole> * Remove unnecessary chatDisplay (#1171) * Remove dupe weapon (#1167) Co-authored-by: Chris Ryan <chrisr@blackhole> * Rune Ward reduces damage with flat 1d8 (#1191) Co-authored-by: Chris Ryan <chrisr@blackhole> * Fix adv hand crossbow to d6 damage, not d4 (#1208) Co-authored-by: Chris Ryan <chrisr@blackhole> * Fix advantages for Armored Sentry (#1210) Co-authored-by: Chris Ryan <chrisr@blackhole> * Change the damage to use d8 instead of d6 (#1211) Co-authored-by: Chris Ryan <chrisr@blackhole> * [PR] Compendium fixes and Typo checks - 26 Oct (#1233) * PR fixes and Typo checks - 26 Oct * removed dwarf tough skin action as it was unecessary * Fix the damage output of the Takedown Beastform feature (#1240) Co-authored-by: Chris Ryan <chrisr@blackhole> --------- Co-authored-by: Chris Ryan <chrisr@blackhole> Co-authored-by: UsernameIsInUse <49582925+UsernameIsInUse@users.noreply.github.com> Co-authored-by: Nikhil Nagarajan <potter.nikhil@gmail.com>
This commit is contained in:
parent
3aaae26ba1
commit
bccedffbca
88 changed files with 3270 additions and 559 deletions
|
|
@ -10,7 +10,9 @@ export default class AdversarySheet extends DHBaseActorSheet {
|
|||
position: { width: 660, height: 766 },
|
||||
window: { resizable: true },
|
||||
actions: {
|
||||
reactionRoll: AdversarySheet.#reactionRoll
|
||||
reactionRoll: AdversarySheet.#reactionRoll,
|
||||
toggleResourceDice: AdversarySheet.#toggleResourceDice,
|
||||
handleResourceDice: AdversarySheet.#handleResourceDice
|
||||
},
|
||||
window: {
|
||||
resizable: true,
|
||||
|
|
@ -173,6 +175,40 @@ export default class AdversarySheet extends DHBaseActorSheet {
|
|||
this.actor.diceRoll(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle the used state of a resource dice.
|
||||
* @type {ApplicationClickAction}
|
||||
*/
|
||||
static async #toggleResourceDice(event, target) {
|
||||
const item = await getDocFromElement(target);
|
||||
|
||||
const { dice } = event.target.closest('.item-resource').dataset;
|
||||
const diceState = item.system.resource.diceStates[dice];
|
||||
|
||||
await item.update({
|
||||
[`system.resource.diceStates.${dice}.used`]: diceState ? !diceState.used : true
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the roll values of resource dice.
|
||||
* @type {ApplicationClickAction}
|
||||
*/
|
||||
static async #handleResourceDice(_, target) {
|
||||
const item = await getDocFromElement(target);
|
||||
if (!item) return;
|
||||
|
||||
const rollValues = await game.system.api.applications.dialogs.ResourceDiceDialog.create(item, this.document);
|
||||
if (!rollValues) return;
|
||||
|
||||
await item.update({
|
||||
'system.resource.diceStates': rollValues.reduce((acc, state, index) => {
|
||||
acc[index] = { value: state.value, used: state.used };
|
||||
return acc;
|
||||
}, {})
|
||||
});
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Application Listener Actions */
|
||||
/* -------------------------------------------- */
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getDocFromElement } from '../../../helpers/utils.mjs';
|
||||
import DHBaseActorSheet from '../api/base-actor.mjs';
|
||||
|
||||
/**@typedef {import('@client/applications/_types.mjs').ApplicationClickAction} ApplicationClickAction */
|
||||
|
|
@ -20,7 +21,10 @@ export default class DhpEnvironment extends DHBaseActorSheet {
|
|||
}
|
||||
]
|
||||
},
|
||||
actions: {},
|
||||
actions: {
|
||||
toggleResourceDice: DhpEnvironment.#toggleResourceDice,
|
||||
handleResourceDice: DhpEnvironment.#handleResourceDice
|
||||
},
|
||||
dragDrop: [{ dragSelector: '.action-section .inventory-item', dropSelector: null }]
|
||||
};
|
||||
|
||||
|
|
@ -134,4 +138,44 @@ export default class DhpEnvironment extends DHBaseActorSheet {
|
|||
event.dataTransfer.setDragImage(item, 60, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Application Clicks Actions */
|
||||
/* -------------------------------------------- */
|
||||
|
||||
|
||||
/**
|
||||
* Toggle the used state of a resource dice.
|
||||
* @type {ApplicationClickAction}
|
||||
*/
|
||||
static async #toggleResourceDice(event, target) {
|
||||
const item = await getDocFromElement(target);
|
||||
|
||||
const { dice } = event.target.closest('.item-resource').dataset;
|
||||
const diceState = item.system.resource.diceStates[dice];
|
||||
|
||||
await item.update({
|
||||
[`system.resource.diceStates.${dice}.used`]: diceState ? !diceState.used : true
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the roll values of resource dice.
|
||||
* @type {ApplicationClickAction}
|
||||
*/
|
||||
static async #handleResourceDice(_, target) {
|
||||
const item = await getDocFromElement(target);
|
||||
if (!item) return;
|
||||
|
||||
const rollValues = await game.system.api.applications.dialogs.ResourceDiceDialog.create(item, this.document);
|
||||
if (!rollValues) return;
|
||||
|
||||
await item.update({
|
||||
'system.resource.diceStates': rollValues.reduce((acc, state, index) => {
|
||||
acc[index] = { value: state.value, used: state.used };
|
||||
return acc;
|
||||
}, {})
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue