Added the NPC Actor

This commit is contained in:
WBHarry 2026-05-30 19:20:15 +02:00
parent 2bc1c04c93
commit f24d37e935
21 changed files with 461 additions and 1 deletions

View file

@ -1,15 +1,17 @@
import DhCharacter from './character.mjs';
import DhCompanion from './companion.mjs';
import DhAdversary from './adversary.mjs';
import DhNPC from './npc.mjs';
import DhEnvironment from './environment.mjs';
import DhParty from './party.mjs';
export { DhCharacter, DhCompanion, DhAdversary, DhEnvironment, DhParty };
export { DhCharacter, DhCompanion, DhAdversary, DhNPC, DhEnvironment, DhParty };
export const config = {
character: DhCharacter,
companion: DhCompanion,
adversary: DhAdversary,
npc: DhNPC,
environment: DhEnvironment,
party: DhParty
};

38
module/data/actor/npc.mjs Normal file
View file

@ -0,0 +1,38 @@
import DHNPCSettings from '../../applications/sheets-configs/npc-settings.mjs';
import BaseDataActor from './base.mjs';
export default class DhpNPC extends BaseDataActor {
static LOCALIZATION_PREFIXES = ['DAGGERHEART.ACTORS.NPC'];
static get metadata() {
return foundry.utils.mergeObject(super.metadata, {
label: 'TYPES.Actor.npc',
type: 'npc',
settingSheet: DHNPCSettings,
hasResistances: false,
hasAttribution: true
});
}
static defineSchema() {
const fields = foundry.data.fields;
return {
...super.defineSchema(),
difficulty: new fields.NumberField({ nullable: true, initial: null, integer: true }),
description: new fields.StringField(),
motive: new fields.StringField(),
notes: new fields.HTMLField()
};
}
/**@inheritdoc */
static DEFAULT_ICON = 'systems/daggerheart/assets/icons/documents/actors/dragon-head.svg';
get features() {
return this.parent.items.filter(x => x.type === 'feature');
}
isItemValid(source) {
return super.isItemValid(source) || source.type === 'feature';
}
}