[Feature] Beastform Types (#372)

* Temp

* Finished Evolved

* Fixed hybrid

* Changed generalConfig.tiers to be number based

* Weaponhandling while in beastform

* Added unarmed strike in sidebar

* Added DamageEnricher

* Added effect enricher

* Corrected downtime buttons and actions

* Added BeastformTooltip

* Split the BeastformDialog into parts with tabs

* Added temp beastform features

* rollData change

* Improvement

* character.getRollData cleanup
This commit is contained in:
WBHarry 2025-07-20 21:56:22 +02:00 committed by GitHub
parent 867947c2c5
commit 42a705a870
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
93 changed files with 2795 additions and 538 deletions

View file

@ -72,10 +72,10 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
secrets: this.item.isOwner
});
break;
case "effects":
await this._prepareEffectsContext(context, options)
case 'effects':
await this._prepareEffectsContext(context, options);
break;
case "features":
case 'features':
context.isGM = game.user.isGM;
break;
}
@ -93,7 +93,7 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
async _prepareEffectsContext(context, _options) {
context.effects = {
actives: [],
inactives: [],
inactives: []
};
for (const effect of this.item.effects) {
@ -113,30 +113,30 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
* @protected
*/
static #getFeatureContextOptions() {
const options = this._getContextMenuCommonOptions({ usable: true, toChat: true, deletable: false })
options.push(
{
name: 'CONTROLS.CommonDelete',
icon: '<i class="fa-solid fa-trash"></i>',
callback: async (target) => {
const feature = getDocFromElement(target);
if (!feature) return;
const confirmed = await foundry.applications.api.DialogV2.confirm({
window: {
title: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.title', {
type: game.i18n.localize(`TYPES.Item.feature`),
name: feature.name
})
},
content: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.text', { name: feature.name })
});
if (!confirmed) return;
await this.document.update({
'system.features': this.document.system.toObject().features.filter(uuid => uuid !== feature.uuid)
});
},
const options = this._getContextMenuCommonOptions({ usable: true, toChat: true, deletable: false });
options.push({
name: 'CONTROLS.CommonDelete',
icon: '<i class="fa-solid fa-trash"></i>',
callback: async target => {
const feature = getDocFromElement(target);
if (!feature) return;
const confirmed = await foundry.applications.api.DialogV2.confirm({
window: {
title: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.title', {
type: game.i18n.localize(`TYPES.Item.feature`),
name: feature.name
})
},
content: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.text', {
name: feature.name
})
});
if (!confirmed) return;
await this.document.update({
'system.features': this.document.system.toObject().features.filter(uuid => uuid !== feature.uuid)
});
}
)
});
return options;
}
@ -153,7 +153,7 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
const actionIndex = button.closest('[data-index]').dataset.index;
const action = this.document.system.actions[actionIndex];
if(!event.shiftKey) {
if (!event.shiftKey) {
const confirmed = await foundry.applications.api.DialogV2.confirm({
window: {
title: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.title', {
@ -166,7 +166,6 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
if (!confirmed) return;
}
await this.document.update({
'system.actions': this.document.system.actions.filter((_, index) => index !== Number.parseInt(actionIndex))
});
@ -180,9 +179,9 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
const { type } = target.dataset;
const cls = foundry.documents.Item.implementation;
const feature = await cls.create({
type: 'feature',
name: cls.defaultName({ type: 'feature' }),
"system.subType": CONFIG.DH.ITEM.featureSubTypes[type]
'type': 'feature',
'name': cls.defaultName({ type: 'feature' }),
'system.subType': CONFIG.DH.ITEM.featureSubTypes[type]
});
await this.document.update({
'system.features': [...this.document.system.features, feature].map(f => f.uuid)
@ -198,9 +197,7 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
if (!feature) return ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.featureIsMissing'));
await feature.update({ 'system.subType': null });
await this.document.update({
'system.features': this.document.system.features
.map(x => x.uuid)
.filter(uuid => uuid !== feature.uuid)
'system.features': this.document.system.features.map(x => x.uuid).filter(uuid => uuid !== feature.uuid)
});
}