[Fix] Beastform Fixes (#1288)

* Fixed Beastforms getting stuck

* Made the wildcard image select dialog scrollable

* Beastform button shifts to cancelBeastform
This commit is contained in:
WBHarry 2025-11-15 17:51:01 +01:00 committed by GitHub
parent 91b1b92d19
commit fcb9c032ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 40 additions and 30 deletions

View file

@ -216,7 +216,8 @@
}, },
"viewLevelups": "View Levelups", "viewLevelups": "View Levelups",
"InvalidOldCharacterImportTitle": "Old Character Import", "InvalidOldCharacterImportTitle": "Old Character Import",
"InvalidOldCharacterImportText": "Character data exported prior to system version 1.1 will not generate a complete character. Do you wish to continue?" "InvalidOldCharacterImportText": "Character data exported prior to system version 1.1 will not generate a complete character. Do you wish to continue?",
"cancelBeastform": "Cancel Beastform"
}, },
"Companion": { "Companion": {
"FIELDS": { "FIELDS": {
@ -316,8 +317,7 @@
"toLoadout": "Send to Loadout", "toLoadout": "Send to Loadout",
"toVault": "Send to Vault", "toVault": "Send to Vault",
"unequip": "Unequip", "unequip": "Unequip",
"useItem": "Use Item", "useItem": "Use Item"
"cancelBeastform": "Cancel Beastform"
}, },
"Countdown": { "Countdown": {
"addCountdown": "Add Countdown", "addCountdown": "Add Countdown",

View file

@ -12,7 +12,7 @@ export default class ImageSelectDialog extends HandlebarsApplicationMixin(Applic
tag: 'form', tag: 'form',
classes: ['daggerheart', 'dialog', 'dh-style', 'image-select'], classes: ['daggerheart', 'dialog', 'dh-style', 'image-select'],
position: { position: {
width: 600, width: 612,
height: 'auto' height: 'auto'
}, },
window: { window: {
@ -30,7 +30,10 @@ export default class ImageSelectDialog extends HandlebarsApplicationMixin(Applic
/** @override */ /** @override */
static PARTS = { static PARTS = {
main: { template: 'systems/daggerheart/templates/dialogs/image-select/main.hbs' }, main: {
template: 'systems/daggerheart/templates/dialogs/image-select/main.hbs',
scrollable: ['.images-container']
},
footer: { template: 'systems/daggerheart/templates/dialogs/image-select/footer.hbs' } footer: { template: 'systems/daggerheart/templates/dialogs/image-select/footer.hbs' }
}; };

View file

@ -31,6 +31,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
toggleEquipItem: CharacterSheet.#toggleEquipItem, toggleEquipItem: CharacterSheet.#toggleEquipItem,
toggleResourceDice: CharacterSheet.#toggleResourceDice, toggleResourceDice: CharacterSheet.#toggleResourceDice,
handleResourceDice: CharacterSheet.#handleResourceDice, handleResourceDice: CharacterSheet.#handleResourceDice,
cancelBeastform: CharacterSheet.#cancelBeastform,
useDowntime: this.useDowntime useDowntime: this.useDowntime
}, },
window: { window: {
@ -219,6 +220,8 @@ export default class CharacterSheet extends DHBaseActorSheet {
} }
}; };
context.beastformActive = this.document.effects.find(x => x.type === 'beastform');
const homebrewCurrency = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).currency; const homebrewCurrency = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).currency;
if (homebrewCurrency.enabled) { if (homebrewCurrency.enabled) {
context.inventory.currency = homebrewCurrency; context.inventory.currency = homebrewCurrency;
@ -848,6 +851,15 @@ export default class CharacterSheet extends DHBaseActorSheet {
}); });
} }
/**
*
*/
static async #cancelBeastform(_, target) {
const item = await getDocFromElement(target);
if (!item) return;
game.system.api.fields.ActionFields.BeastformField.handleActiveTransformations.call(item);
}
/** /**
* Open the downtime application. * Open the downtime application.
* @type {ApplicationClickAction} * @type {ApplicationClickAction}

View file

@ -420,19 +420,6 @@ export default function DHApplicationMixin(Base) {
]; ];
if (usable) { if (usable) {
options.unshift({
name: 'DAGGERHEART.APPLICATIONS.ContextMenu.cancelBeastform',
icon: 'fa-solid fa-ban',
condition: target => {
const doc = getDocFromElementSync(target);
return doc && doc.system?.actions?.some(a => a.type === 'beastform');
},
callback: async target =>
game.system.api.fields.ActionFields.BeastformField.handleActiveTransformations.call(
await getDocFromElement(target)
)
});
options.unshift({ options.unshift({
name: 'DAGGERHEART.GENERAL.damage', name: 'DAGGERHEART.GENERAL.damage',
icon: 'fa-solid fa-explosion', icon: 'fa-solid fa-explosion',

View file

@ -41,9 +41,6 @@ export default class BeastformField extends fields.SchemaField {
* @param {object} config Object that contains workflow datas. Usually made from Action Fields prepareConfig methods. * @param {object} config Object that contains workflow datas. Usually made from Action Fields prepareConfig methods.
*/ */
static async execute(config) { static async execute(config) {
// Should not be useful anymore here
await BeastformField.handleActiveTransformations.call(this);
const { selected, evolved, hybrid } = await BeastformDialog.configure(config, this.item); const { selected, evolved, hybrid } = await BeastformDialog.configure(config, this.item);
if (!selected) return false; if (!selected) return false;

View file

@ -257,9 +257,10 @@ export const updateActorTokens = async (actor, update) => {
/* Update the tokens in all scenes belonging to Actor */ /* Update the tokens in all scenes belonging to Actor */
for (let token of actor.getDependentTokens()) { for (let token of actor.getDependentTokens()) {
const tokenActor = token.baseActor ?? token.actor; const tokenActor = token.baseActor ?? token.actor;
if (tokenActor?.id === actor.id) { if (token.id && tokenActor?.id === actor.id) {
await token.update({ await token.update({
...update ...update,
_id: token.id
}); });
} }
} }

View file

@ -6,6 +6,8 @@
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
gap: 8px; gap: 8px;
max-height: 420px;
overflow: auto;
img { img {
width: 136px; width: 136px;

View file

@ -1,5 +1,7 @@
<div class="images-container"> <div>
<div class="images-container">
{{#each images as |image|}} {{#each images as |image|}}
<a data-action="selectImage"><img {{#if (eq image @root.selectedImage)}}class="selected"{{/if}} src="{{image}}" data-image="{{image}}" /></a> <a data-action="selectImage"><img {{#if (eq image @root.selectedImage)}}class="selected"{{/if}} src="{{image}}" data-image="{{image}}" /></a>
{{/each}} {{/each}}
</div>
</div> </div>

View file

@ -139,9 +139,15 @@ Parameters:
<div class="item-buttons"> <div class="item-buttons">
{{#each item.system.actions as | action |}} {{#each item.system.actions as | action |}}
<div class="item-button"> <div class="item-button">
{{#if (and (eq action.type 'beastform') @root.beastformActive)}}
<button type="button" data-action="cancelBeastform" data-item-uuid="{{action.uuid}}">
{{localize "DAGGERHEART.ACTORS.Character.cancelBeastform"}}
</button>
{{else}}
<button type="button" data-action="useItem" data-item-uuid="{{action.uuid}}"> <button type="button" data-action="useItem" data-item-uuid="{{action.uuid}}">
{{action.name}} {{action.name}}
</button> </button>
{{/if}}
{{#if action.uses.max}} {{#if action.uses.max}}
<div class="spacer"></div> <div class="spacer"></div>
<button type="button" class="action-uses-button" data-action="increaseActionUses" data-item-uuid="{{action.uuid}}"> <button type="button" class="action-uses-button" data-action="increaseActionUses" data-item-uuid="{{action.uuid}}">