mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-06-05 20:34:15 +02:00
Fix usable checks on adversary features and locked compendium actors (#1934)
This commit is contained in:
parent
ccc4186e42
commit
b9416ead5a
3 changed files with 11 additions and 5 deletions
|
|
@ -148,10 +148,14 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
|||
: null;
|
||||
}
|
||||
|
||||
/** Returns true if the action is usable */
|
||||
/**
|
||||
* Returns true if the action is usable.
|
||||
* An action is usable on any actor type. For example, an adversary might have a base attack action.
|
||||
*/
|
||||
get usable() {
|
||||
const actor = this.actor;
|
||||
return this.isOwner && actor?.type === 'character';
|
||||
const pack = actor?.pack ? game.packs.get(actor.pack) : null;
|
||||
return !pack?.locked && this.isOwner;
|
||||
}
|
||||
|
||||
static getRollType(parent) {
|
||||
|
|
|
|||
|
|
@ -73,8 +73,10 @@ export default class DHItem extends foundry.documents.Item {
|
|||
/** Returns true if the item can be used */
|
||||
get usable() {
|
||||
const actor = this.actor;
|
||||
const actionsList = this.system.actionsList;
|
||||
return this.isOwner && actor?.type === 'character' && (actionsList?.size || actionsList?.length);
|
||||
const pack = actor?.pack ? game.packs.get(actor.pack) : null;
|
||||
const hasActions = this.system.actionsList?.size || this.system.actionsList?.length;
|
||||
const isValidType = actor?.type === 'character' || this.type === 'feature';
|
||||
return !pack?.locked && this.isOwner && isValidType && hasActions;
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue