Fixed sizing for evolved beastforms

This commit is contained in:
WBHarry 2025-12-21 03:05:23 +01:00
parent 989a6e3a2a
commit ce7020d8d5
6 changed files with 48 additions and 29 deletions

View file

@ -2262,7 +2262,9 @@
"hybridizeFeatureTitle": "Hybrid Features", "hybridizeFeatureTitle": "Hybrid Features",
"hybridizeDrag": "Drag a form here to hybridize it.", "hybridizeDrag": "Drag a form here to hybridize it.",
"mainTrait": "Main Trait", "mainTrait": "Main Trait",
"traitBonus": "Trait Bonus" "traitBonus": "Trait Bonus",
"evolvedTokenHint": "An evolved beastform's token is based on that of the form you evolve",
"evolvedImagePlaceholder": "The image for the form selected for evolution will be used"
}, },
"Class": { "Class": {
"hopeFeatures": "Hope Features", "hopeFeatures": "Hope Features",

View file

@ -77,7 +77,7 @@ export default class BeastformSheet extends DHBaseItemSheet {
name: context.document.system.advantageOn[key].value name: context.document.system.advantageOn[key].value
})) }))
); );
context.dimensionsDisabled = context.document.system.tokenSize.size === 'custom'; context.dimensionsDisabled = context.document.system.tokenSize.size !== 'custom';
break; break;
case 'effects': case 'effects':
context.effects.actives = context.effects.actives.map(effect => { context.effects.actives = context.effects.actives.map(effect => {

View file

@ -92,6 +92,18 @@ export default class BeastformField extends fields.SchemaField {
beastformEffect.changes = [...beastformEffect.changes, ...evolvedForm.changes]; beastformEffect.changes = [...beastformEffect.changes, ...evolvedForm.changes];
formData.system.features = [...formData.system.features, ...selectedForm.system.features.map(x => x.uuid)]; formData.system.features = [...formData.system.features, ...selectedForm.system.features.map(x => x.uuid)];
const baseSize = evolvedData.form.system.tokenSize.size;
const evolvedSize =
baseSize === 'custom'
? 'custom'
: (Object.keys(CONFIG.DH.ACTOR.tokenSize).find(
x => CONFIG.DH.ACTOR.tokenSize[x].value === CONFIG.DH.ACTOR.tokenSize[baseSize].value + 1
) ?? baseSize);
formData.system.tokenSize = {
...evolvedData.form.system.tokenSize,
size: evolvedSize
};
} }
if (selectedForm.system.beastformType === CONFIG.DH.ITEM.beastformTypes.hybrid.id) { if (selectedForm.system.beastformType === CONFIG.DH.ITEM.beastformTypes.hybrid.id) {

View file

@ -221,8 +221,8 @@ export default class DHBeastform extends BaseDataItem {
const { x, y } = game.system.api.documents.DhToken.getSnappedPositionInSquareGrid( const { x, y } = game.system.api.documents.DhToken.getSnappedPositionInSquareGrid(
token.object.scene.grid, token.object.scene.grid,
{ x: token.x, y: token.y, elevation: token.elevation }, { x: token.x, y: token.y, elevation: token.elevation },
width, width ?? token.width,
height height ?? token.height
); );
return { return {
...prototypeTokenUpdate, ...prototypeTokenUpdate,

View file

@ -5,5 +5,8 @@
flex-direction: column; flex-direction: column;
margin-top: 10px; margin-top: 10px;
} }
.hint {
font-style: italic;
}
} }
} }

View file

@ -22,31 +22,33 @@
<fieldset> <fieldset>
<legend>{{localize "DAGGERHEART.ITEMS.Beastform.tokenTitle"}}</legend> <legend>{{localize "DAGGERHEART.ITEMS.Beastform.tokenTitle"}}</legend>
{{#unless (eq source.system.beastformType 'evolved')}}
<div class="full-width">
{{formGroup systemFields.tokenImg value=source.system.tokenImg localize=true}}
</div>
<div class="full-width"> <div class="full-width">
{{formGroup systemFields.tokenImg value=source.system.tokenImg localize=true}} {{formGroup systemFields.tokenRingImg value=source.system.tokenRingImg localize=true}}
</div> </div>
<div class="nest-inputs">
<div class="full-width"> {{formGroup systemFields.tokenSize.fields.size value=source.system.tokenSize.size label=(localize "DAGGERHEART.GENERAL.tokenSize") localize=true }}
{{formGroup systemFields.tokenRingImg value=source.system.tokenRingImg localize=true}} {{formGroup
</div> systemFields.tokenSize.fields.height
value=source.system.tokenSize.height
<div class="nest-inputs"> localize=true
{{formGroup systemFields.tokenSize.fields.size value=source.system.tokenSize.size label=(localize "DAGGERHEART.GENERAL.tokenSize") localize=true }} placeholder=(localize (ifThen dimensionsDisabled "DAGGERHEART.ITEMS.Beastform.FIELDS.tokenSize.disabledPlaceholder" "DAGGERHEART.ITEMS.Beastform.FIELDS.tokenSize.placeholder"))
{{formGroup disabled=dimensionsDisabled
systemFields.tokenSize.fields.height }}
value=source.system.tokenSize.height {{formGroup
localize=true systemFields.tokenSize.fields.width
placeholder=(localize (ifThen dimensionsDisabled "DAGGERHEART.ITEMS.Beastform.FIELDS.tokenSize.disabledPlaceholder" "DAGGERHEART.ITEMS.Beastform.FIELDS.tokenSize.placeholder")) value=source.system.tokenSize.width
disabled=dimensionsDisabled localize=true
}} placeholder=(localize (ifThen dimensionsDisabled "DAGGERHEART.ITEMS.Beastform.FIELDS.tokenSize.disabledPlaceholder" "DAGGERHEART.ITEMS.Beastform.FIELDS.tokenSize.placeholder"))
{{formGroup disabled=dimensionsDisabled
systemFields.tokenSize.fields.width }}
value=source.system.tokenSize.width </div>
localize=true {{else}}
placeholder=(localize (ifThen dimensionsDisabled "DAGGERHEART.ITEMS.Beastform.FIELDS.tokenSize.disabledPlaceholder" "DAGGERHEART.ITEMS.Beastform.FIELDS.tokenSize.placeholder")) <span class="hint">{{localize "DAGGERHEART.ITEMS.Beastform.evolvedTokenHint"}}</span>
disabled=dimensionsDisabled {{/unless}}
}}
</div>
</fieldset> </fieldset>
</section> </section>