This commit is contained in:
Dapoolp 2025-07-24 23:48:05 +02:00
parent 9da6a13009
commit 192c739a58
13 changed files with 35 additions and 29 deletions

View file

@ -9,7 +9,8 @@ export default class DHArmor extends AttachableItem {
label: 'TYPES.Item.armor',
type: 'armor',
hasDescription: true,
isInventoryItem: true
isInventoryItem: true,
hasActions: true
});
}
@ -38,8 +39,7 @@ export default class DHArmor extends AttachableItem {
baseThresholds: new fields.SchemaField({
major: new fields.NumberField({ integer: true, initial: 0 }),
severe: new fields.NumberField({ integer: true, initial: 0 })
}),
actions: new ActionsField()
})
};
}

View file

@ -8,6 +8,8 @@
* @property {boolean} isInventoryItem- Indicates whether items of this type is a Inventory Item
*/
import { ActionsField } from "../fields/actionField.mjs";
const fields = foundry.data.fields;
export default class BaseDataItem extends foundry.abstract.TypeDataModel {
@ -69,6 +71,9 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
if (this.metadata.isQuantifiable)
schema.quantity = new fields.NumberField({ integer: true, initial: 1, min: 0, required: true });
if (this.metadata.hasActions)
schema.actions = new ActionsField()
return schema;
}

View file

@ -9,7 +9,8 @@ export default class DHConsumable extends BaseDataItem {
type: 'consumable',
hasDescription: true,
isQuantifiable: true,
isInventoryItem: true
isInventoryItem: true,
hasActions: true
});
}
@ -18,8 +19,7 @@ export default class DHConsumable extends BaseDataItem {
const fields = foundry.data.fields;
return {
...super.defineSchema(),
consumeOnUse: new fields.BooleanField({ initial: false }),
actions: new fields.ArrayField(new ActionField())
consumeOnUse: new fields.BooleanField({ initial: false })
};
}
}

View file

@ -8,7 +8,8 @@ export default class DHDomainCard extends BaseDataItem {
label: 'TYPES.Item.domainCard',
type: 'domainCard',
hasDescription: true,
hasResource: true
hasResource: true,
hasActions: true
});
}
@ -29,8 +30,7 @@ export default class DHDomainCard extends BaseDataItem {
required: true,
initial: CONFIG.DH.DOMAIN.cardTypes.ability.id
}),
inVault: new fields.BooleanField({ initial: false }),
actions: new fields.ArrayField(new ActionField())
inVault: new fields.BooleanField({ initial: false })
};
}

View file

@ -8,7 +8,8 @@ export default class DHFeature extends BaseDataItem {
label: 'TYPES.Item.feature',
type: 'feature',
hasDescription: true,
hasResource: true
hasResource: true,
hasActions: true
});
}
@ -24,8 +25,7 @@ export default class DHFeature extends BaseDataItem {
}),
subType: new fields.StringField({ choices: CONFIG.DH.ITEM.featureSubTypes, nullable: true, initial: null }),
originId: new fields.StringField({ nullable: true, initial: null }),
identifier: new fields.StringField(),
actions: new ActionsField()
identifier: new fields.StringField()
};
}

View file

@ -9,16 +9,15 @@ export default class DHMiscellaneous extends BaseDataItem {
type: 'miscellaneous',
hasDescription: true,
isQuantifiable: true,
isInventoryItem: true
isInventoryItem: true,
hasActions: true
});
}
/** @inheritDoc */
static defineSchema() {
const fields = foundry.data.fields;
return {
...super.defineSchema(),
actions: new fields.ArrayField(new ActionField())
...super.defineSchema()
};
}
}

View file

@ -8,8 +8,8 @@ export default class DHWeapon extends AttachableItem {
label: 'TYPES.Item.weapon',
type: 'weapon',
hasDescription: true,
isInventoryItem: true
// hasInitialAction: true
isInventoryItem: true,
hasActions: true
});
}
@ -63,13 +63,12 @@ export default class DHWeapon extends AttachableItem {
]
}
}
}),
actions: new ActionsField()
})
};
}
get actionsList() {
return new Set([this.attack, ...this.actions]);
return [this.attack, ...this.actions];
}
get customActions() {