mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-07 22:46:12 +01:00
Fixed basic beastform
This commit is contained in:
parent
978d45b931
commit
3186468f28
18 changed files with 231 additions and 21 deletions
|
|
@ -271,8 +271,13 @@ export class DHBaseAction extends foundry.abstract.DataModel {
|
|||
}
|
||||
|
||||
if (this instanceof DhBeastformAction) {
|
||||
config = await BeastformDialog.configure(config);
|
||||
if (!config) return;
|
||||
const abort = await this.handleActiveTransformations();
|
||||
if (abort) return;
|
||||
|
||||
const beastformUuid = await BeastformDialog.configure(config);
|
||||
if (!beastformUuid) return;
|
||||
|
||||
await this.transform(beastformUuid);
|
||||
}
|
||||
|
||||
if (this.doFollowUp()) {
|
||||
|
|
@ -774,4 +779,24 @@ export class DhBeastformAction extends DHBaseAction {
|
|||
})
|
||||
};
|
||||
}
|
||||
|
||||
async transform(beastformUuid) {
|
||||
const beastform = await foundry.utils.fromUuid(beastformUuid);
|
||||
this.actor.createEmbeddedDocuments('Item', [beastform.toObject()]);
|
||||
}
|
||||
|
||||
async handleActiveTransformations() {
|
||||
const activeBeastforms = this.actor.items.filter(x => x.type === 'beastform');
|
||||
if (activeBeastforms.length > 0) {
|
||||
for (let form of activeBeastforms) {
|
||||
await form.delete();
|
||||
}
|
||||
|
||||
this.actor.effects.filter(x => x.type === 'beastform').forEach(x => x.delete());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue