Merge branch 'main' into feature/action-areas

This commit is contained in:
Carlos Fernandez 2026-04-20 20:19:58 -04:00
commit f348b64aae
53 changed files with 1240 additions and 288 deletions

View file

@ -13,7 +13,7 @@ export default class DHAttackAction extends DHDamageAction {
if (!!this.item?.system?.attack) {
if (this.damage.includeBase) {
const baseDamage = this.getParentDamage();
this.damage.parts.unshift(new DHDamageData(baseDamage));
this.damage.parts.hitPoints = new DHDamageData(baseDamage);
}
if (this.roll.useDefault) {
this.roll.trait = this.item.system.attack.roll.trait;

View file

@ -110,6 +110,11 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
return this._id;
}
/** Returns true if the current user is the owner of the containing item */
get isOwner() {
return this.item?.isOwner ?? true;
}
/**
* Return Item the action is attached too.
*/
@ -143,6 +148,12 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
: null;
}
/** Returns true if the action is usable */
get usable() {
const actor = this.actor;
return this.isOwner && actor?.type === 'character';
}
static getRollType(parent) {
return 'trait';
}

View file

@ -20,7 +20,7 @@ export default class DhCharacter extends DhCreature {
settingSheet: DHCharacterSettings,
isNPC: false,
hasInventory: true,
quantifiable: ["loot", "consumable"]
quantifiable: ['loot', 'consumable']
});
}
@ -302,7 +302,7 @@ export default class DhCharacter extends DhCreature {
choices: CONFIG.DH.GENERAL.dieFaces,
initial: null,
label: 'DAGGERHEART.ACTORS.Character.defaultDisadvantageDice'
}),
})
})
})
};
@ -449,7 +449,7 @@ export default class DhCharacter extends DhCreature {
/* All items are valid on characters */
isItemValid() {
return true;
return true;
}
/** @inheritDoc */

View file

@ -78,7 +78,7 @@ export default class DhCompanion extends DhCreature {
choices: CONFIG.DH.GENERAL.dieFaces,
initial: null,
label: 'DAGGERHEART.ACTORS.Character.defaultDisadvantageDice'
}),
})
})
}),
attack: new ActionField({

View file

@ -9,7 +9,7 @@ export default class DhParty extends BaseDataActor {
static get metadata() {
return foundry.utils.mergeObject(super.metadata, {
hasInventory: true,
quantifiable: ["weapon", "armor", "loot", "consumable"]
quantifiable: ['weapon', 'armor', 'loot', 'consumable']
});
}

View file

@ -40,9 +40,7 @@ export default class DHSummonField extends fields.ArrayField {
const roll = new Roll(itemAbleRollParse(summon.count, this.actor, this.item));
await roll.evaluate();
const count = roll.total;
if (!roll.isDeterministic && game.modules.get('dice-so-nice')?.active)
rolls.push(roll);
if (!roll.isDeterministic && game.modules.get('dice-so-nice')?.active) rolls.push(roll);
const actor = await DHSummonField.getWorldActor(await foundry.utils.fromUuid(summon.actorUUID));
/* Extending summon data in memory so it's available in actionField.toChat. Think it's harmless, but ugly. Could maybe find a better way. */

View file

@ -108,6 +108,8 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
}
get actionsList() {
// No actions on non-characters
if (this.actor && this.actor.type !== 'character') return [];
return this.actions;
}

View file

@ -99,7 +99,9 @@ export default class DHWeapon extends AttachableItem {
/* -------------------------------------------- */
get actionsList() {
return [this.attack, ...this.actions];
// No actions on non-characters
if (this.actor && this.actor.type !== 'character') return [];
return [this.attack, ...super.actionsList];
}
get customActions() {