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",
"hybridizeDrag": "Drag a form here to hybridize it.",
"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": {
"hopeFeatures": "Hope Features",

View file

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

View file

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

View file

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

View file

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