mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-13 04:01:06 +01:00
Reworked Action storage
This commit is contained in:
parent
3333a9e00a
commit
ce593d02f3
16 changed files with 196 additions and 23 deletions
|
|
@ -130,7 +130,11 @@ export class DHBaseAction extends foundry.abstract.DataModel {
|
|||
}
|
||||
|
||||
get actor() {
|
||||
return this.item instanceof DhpActor ? this.item : this.item?.actor;
|
||||
return this.item instanceof DhpActor
|
||||
? this.item
|
||||
: this.item?.parent instanceof DhpActor
|
||||
? this.item.parent
|
||||
: this.item?.actor;
|
||||
}
|
||||
|
||||
get chatTemplate() {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { burden } from '../../config/generalConfig.mjs';
|
||||
import ActionField from '../fields/actionField.mjs';
|
||||
import ForeignDocumentUUIDField from '../fields/foreignDocumentUUIDField.mjs';
|
||||
import DhLevelData from '../levelData.mjs';
|
||||
import BaseDataActor from './base.mjs';
|
||||
|
|
@ -96,6 +97,7 @@ export default class DhCharacter extends BaseDataActor {
|
|||
value: new ForeignDocumentUUIDField({ type: 'Item', nullable: true }),
|
||||
subclass: new ForeignDocumentUUIDField({ type: 'Item', nullable: true })
|
||||
}),
|
||||
actions: new fields.ArrayField(new ActionField()),
|
||||
levelData: new fields.EmbeddedDataField(DhLevelData),
|
||||
bonuses: new fields.SchemaField({
|
||||
armorScore: new fields.NumberField({ integer: true, initial: 0 }),
|
||||
|
|
@ -155,6 +157,17 @@ export default class DhCharacter extends BaseDataActor {
|
|||
return this.parent.items.find(x => x.type === 'community') ?? null;
|
||||
}
|
||||
|
||||
// get actions() {
|
||||
// const generalActions = []; // Add in things like Sprint etc
|
||||
// const levelupActions = this.levelData.actions.filter(x => !x.partner).map(x => x.value);
|
||||
|
||||
// return [...generalActions, ...levelupActions];
|
||||
// }
|
||||
|
||||
get companionActions() {
|
||||
return this.companion ? this.companion.system.actions : [];
|
||||
}
|
||||
|
||||
get needsCharacterSetup() {
|
||||
return !this.class.value || !this.class.subclass;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ export default class DhCompanion extends BaseDataActor {
|
|||
}
|
||||
}
|
||||
}),
|
||||
actions: new fields.ArrayField(new ActionField()),
|
||||
levelData: new fields.EmbeddedDataField(DhLevelData)
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,8 @@ export default class DhLevelData extends foundry.abstract.DataModel {
|
|||
amount: new fields.NumberField({ integer: true }),
|
||||
data: new fields.ArrayField(new fields.StringField({ required: true })),
|
||||
secondaryData: new fields.TypedObjectField(new fields.StringField({ required: true })),
|
||||
itemUuid: new fields.StringField({ required: true })
|
||||
itemUuid: new fields.StringField({ required: true }),
|
||||
actionIds: new fields.ArrayField(new fields.StringField())
|
||||
})
|
||||
)
|
||||
})
|
||||
|
|
@ -50,6 +51,10 @@ export default class DhLevelData extends foundry.abstract.DataModel {
|
|||
};
|
||||
}
|
||||
|
||||
get actions() {
|
||||
return Object.values(this.levelups).flatMap(level => level.selections.flatMap(s => s.actions));
|
||||
}
|
||||
|
||||
get canLevelUp() {
|
||||
return this.level.current < this.level.changed;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,14 +65,29 @@ export const CompanionLevelOptionType = {
|
|||
},
|
||||
creatureComfort: {
|
||||
id: 'creatureComfort',
|
||||
label: 'Creature Comfort'
|
||||
// actions: [
|
||||
|
||||
// ],
|
||||
label: 'Creature Comfort',
|
||||
actions: [
|
||||
{
|
||||
name: 'DAGGERHEART.LevelUp.Actions.CreatureComfort.Name',
|
||||
img: 'icons/magic/life/heart-cross-purple-orange.webp',
|
||||
type: 'attack',
|
||||
actionType: 'passive',
|
||||
description: 'DAGGERHEART.LevelUp.Actions.CreatureComfort.Description'
|
||||
}
|
||||
]
|
||||
},
|
||||
armored: {
|
||||
id: 'armored',
|
||||
label: 'Armored'
|
||||
label: 'Armored',
|
||||
actions: [
|
||||
{
|
||||
name: 'DAGGERHEART.LevelUp.Actions.Armored.Name',
|
||||
img: 'icons/equipment/shield/kite-wooden-oak-glow.webp',
|
||||
type: 'attack',
|
||||
actionType: 'passive',
|
||||
description: 'DAGGERHEART.LevelUp.Actions.Armored.Description'
|
||||
}
|
||||
]
|
||||
},
|
||||
vicious: {
|
||||
id: 'vicious',
|
||||
|
|
@ -84,7 +99,16 @@ export const CompanionLevelOptionType = {
|
|||
},
|
||||
bonded: {
|
||||
id: 'bonded',
|
||||
label: 'Bonded'
|
||||
label: 'Bonded',
|
||||
actions: [
|
||||
{
|
||||
name: 'DAGGERHEART.LevelUp.Actions.Bonded.Name',
|
||||
img: 'icons/magic/life/heart-red-blue.webp',
|
||||
type: 'attack',
|
||||
actionType: 'passive',
|
||||
description: 'DAGGERHEART.LevelUp.Actions.Bonded.Description'
|
||||
}
|
||||
]
|
||||
},
|
||||
aware: {
|
||||
id: 'aware',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue