Finished Evolved

This commit is contained in:
WBHarry 2025-07-18 15:05:12 +02:00
parent 9f22545f7d
commit 011f5d2b14
16 changed files with 378 additions and 162 deletions

View file

@ -10,10 +10,10 @@ export default class DhBeastformAction extends DHBaseAction {
const abort = await this.handleActiveTransformations();
if (abort) return;
const beastformUuid = await BeastformDialog.configure(beastformConfig);
if (!beastformUuid) return;
const { selected, evolved, hybrid } = await BeastformDialog.configure(beastformConfig);
if (!selected) return;
await this.transform(beastformUuid);
await this.transform(selected, evolved, hybrid);
}
prepareBeastformConfig(config) {
@ -29,9 +29,26 @@ export default class DhBeastformAction extends DHBaseAction {
};
}
async transform(beastformUuid) {
const beastform = await foundry.utils.fromUuid(beastformUuid);
this.actor.createEmbeddedDocuments('Item', [beastform.toObject()]);
async transform(selectedForm, evolvedData, hybridData) {
const formData = evolvedData?.form ? evolvedData.form.toObject() : selectedForm.toObject();
const beastformEffect = formData.effects.find(x => x.type === 'beastform');
if (!beastformEffect) {
ui.notifications.error('DAGGERHEART.UI.Notifications.beastformMissingEffect');
return;
}
if (evolvedData?.form) {
const evolvedForm = selectedForm.effects.find(x => x.type === 'beastform');
if (!evolvedForm) {
ui.notifications.error('DAGGERHEART.UI.Notifications.beastformMissingEffect');
return;
}
beastformEffect.changes = [...beastformEffect.changes, ...evolvedForm.changes];
formData.system.features = [...formData.system.features, ...selectedForm.system.features.map(x => x.uuid)];
}
this.actor.createEmbeddedDocuments('Item', [formData]);
}
async handleActiveTransformations() {