mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-16 05:31:07 +01:00
Fixed error where activeeffects were being created in the wrong place. Fixed error where characterCreation was failing subclass (#508)
This commit is contained in:
parent
66fc4e2854
commit
c2de25693f
2 changed files with 15 additions and 21 deletions
|
|
@ -416,17 +416,17 @@ export default function DHApplicationMixin(Base) {
|
||||||
static async #createDoc(event, target) {
|
static async #createDoc(event, target) {
|
||||||
const { documentClass, type, inVault, disabled } = target.dataset;
|
const { documentClass, type, inVault, disabled } = target.dataset;
|
||||||
const parentIsItem = this.document.documentName === 'Item';
|
const parentIsItem = this.document.documentName === 'Item';
|
||||||
const parent =
|
const featureOnCharacter = this.document.parent?.type === 'character' && type === 'feature';
|
||||||
this.document.parent?.type === 'character'
|
const parent = featureOnCharacter
|
||||||
? this.document.parent
|
? this.document.parent
|
||||||
: parentIsItem && documentClass === 'Item'
|
: parentIsItem && documentClass === 'Item'
|
||||||
? type === 'action'
|
? type === 'action'
|
||||||
? this.document.system
|
? this.document.system
|
||||||
: null
|
: null
|
||||||
: this.document;
|
: this.document;
|
||||||
|
|
||||||
let systemData = {};
|
let systemData = {};
|
||||||
if (parent?.type === 'character' && type === 'feature') {
|
if (featureOnCharacter) {
|
||||||
systemData = {
|
systemData = {
|
||||||
originItemType: this.document.type,
|
originItemType: this.document.type,
|
||||||
originId: this.document.id,
|
originId: this.document.id,
|
||||||
|
|
|
||||||
|
|
@ -47,16 +47,13 @@ export default class DHSubclass extends BaseDataItem {
|
||||||
ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.subclassesAlreadyPresent'));
|
ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.subclassesAlreadyPresent'));
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if (!this.actor.system.multiclass.value) {
|
const multiclass = this.actor.items.find(x => x.type === 'class' && x.system.isMulticlass);
|
||||||
|
if (!multiclass) {
|
||||||
ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.missingMulticlass'));
|
ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.missingMulticlass'));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (multiclass.system.subclasses.every(x => x.uuid !== (data.uuid ?? `Item.${data._id}`))) {
|
||||||
this.actor.system.multiclass.value.system.subclasses.every(
|
|
||||||
x => x.uuid !== (data.uuid ?? `Item.${data._id}`)
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
ui.notifications.error(
|
ui.notifications.error(
|
||||||
game.i18n.localize('DAGGERHEART.UI.Notifications.subclassNotInMulticlass')
|
game.i18n.localize('DAGGERHEART.UI.Notifications.subclassNotInMulticlass')
|
||||||
);
|
);
|
||||||
|
|
@ -66,15 +63,12 @@ export default class DHSubclass extends BaseDataItem {
|
||||||
await this.updateSource({ isMulticlass: true });
|
await this.updateSource({ isMulticlass: true });
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!this.actor.system.class.value) {
|
const actorClass = this.actor.items.find(x => x.type === 'class' && !x.system.isMulticlass);
|
||||||
|
if (!actorClass) {
|
||||||
ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.missingClass'));
|
ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.missingClass'));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (
|
if (actorClass.system.subclasses.every(x => x.uuid !== (data.uuid ?? `Item.${data._id}`))) {
|
||||||
this.actor.system.class.value.system.subclasses.every(
|
|
||||||
x => x.uuid !== (data.uuid ?? `Item.${data._id}`)
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
ui.notifications.error(game.i18n.localize('DAGGERHEART.UI.Notifications.subclassNotInClass'));
|
ui.notifications.error(game.i18n.localize('DAGGERHEART.UI.Notifications.subclassNotInClass'));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue