Weaponhandling while in beastform

This commit is contained in:
WBHarry 2025-07-19 03:36:32 +02:00
parent 721eb347db
commit 87f29c3bb3
4 changed files with 23 additions and 1 deletions

View file

@ -611,6 +611,12 @@ export default class CharacterSheet extends DHBaseActorSheet {
await item.update({ 'system.equipped': true });
break;
case 'weapon':
if (this.document.effects.find(x => x.type === 'beastform')) {
return ui.notifications.warn(
game.i18n.localize('DAGGERHEART.UI.Notifications.beastformEquipWeapon')
);
}
await this.document.system.constructor.unequipBeforeEquip.bind(this.document.system)(item);
await item.update({ 'system.equipped': true });

View file

@ -26,6 +26,13 @@ export default class BeastformEffect extends foundry.abstract.TypeDataModel {
};
}
async _onCreate() {
if (this.parent.parent?.type === 'character') {
this.parent.parent.system.primaryWeapon?.update?.({ 'system.equipped': false });
this.parent.parent.system.secondayWeapon?.update?.({ 'system.equipped': false });
}
}
async _preDelete() {
if (this.parent.parent.type === 'character') {
const update = {

View file

@ -325,6 +325,14 @@ export default class DhCharacter extends BaseDataActor {
return this.parent.items.find(x => x.type === 'armor' && x.system.equipped);
}
get activeBeastform() {
return this.parent.effects.find(x => x.type === 'beastform');
}
get unarmedIcon() {
return this.activeBeastform ? 'icons/creatures/claws/claw-straight-brown.webp' : this.attack.img;
}
get sheetLists() {
const ancestryFeatures = [],
communityFeatures = [],