mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-21 23:13:39 +02:00
Some checks are pending
Project CI / build (24.x) (push) Waiting to run
* Functioning setup * . * Fixes * Completed * Apply suggestions from code review Co-authored-by: Carlos Fernandez <CarlosFdez@users.noreply.github.com> * using function.call instead of function.bind * Run lint fix on action areas PR (#1820) * . * . * Restructured getTemplateShape to be a lot more readable * . * . * Changed from 'area' to 'areas' * . * Moved the areas button to the left * Fix regression with actions list * Updated all SRD adversaries --------- Co-authored-by: Carlos Fernandez <CarlosFdez@users.noreply.github.com> Co-authored-by: Carlos Fernandez <cfern1990@gmail.com>
37 lines
1.2 KiB
JavaScript
37 lines
1.2 KiB
JavaScript
export default class DHAbilityUse extends foundry.abstract.TypeDataModel {
|
|
static defineSchema() {
|
|
const fields = foundry.data.fields;
|
|
|
|
return {
|
|
origin: new fields.StringField({}),
|
|
img: new fields.StringField({}),
|
|
name: new fields.StringField({}),
|
|
description: new fields.StringField({}),
|
|
source: new fields.SchemaField({
|
|
actor: new fields.StringField(),
|
|
item: new fields.StringField(),
|
|
action: new fields.StringField()
|
|
})
|
|
};
|
|
}
|
|
|
|
get actionActor() {
|
|
if (!this.source.actor) return null;
|
|
return fromUuidSync(this.source.actor);
|
|
}
|
|
|
|
get actionItem() {
|
|
const actionActor = this.actionActor;
|
|
if (!actionActor || !this.source.item) return null;
|
|
|
|
const item = actionActor.items.get(this.source.item);
|
|
return item ? item.system.actions?.find(a => a.id === this.source.action) : null;
|
|
}
|
|
|
|
get action() {
|
|
const { actionItem: itemAction } = this;
|
|
if (!this.source.action) return null;
|
|
if (itemAction) return itemAction;
|
|
return null;
|
|
}
|
|
}
|