mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Max Cards loadout switch & Homebrew setting (#412)
* Max Cards loadout switch & Homebrew setting * Fixes * Fixes
This commit is contained in:
parent
2a4777f1a0
commit
dddee78356
6 changed files with 42 additions and 4 deletions
|
|
@ -259,7 +259,12 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
name: 'toLoadout',
|
||||
icon: 'fa-solid fa-arrow-up',
|
||||
condition: target => getDocFromElement(target).system.inVault,
|
||||
callback: target => getDocFromElement(target).update({ 'system.inVault': false })
|
||||
callback: target => {
|
||||
const doc = getDocFromElement(target),
|
||||
actorLoadout = doc.actor.system.loadoutSlot;
|
||||
if(actorLoadout.available) return doc.update({ 'system.inVault': false });
|
||||
ui.notifications.warn(game.i18n.format('DAGGERHEART.UI.Notifications.loadoutMaxReached', { max: actorLoadout.max }))
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'toVault',
|
||||
|
|
@ -729,7 +734,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
const item = await Item.implementation.fromDropData(data);
|
||||
const itemData = item.toObject();
|
||||
|
||||
if (item.type === 'domainCard' && this.document.system.domainCards.loadout.length >= 5) {
|
||||
if (item.type === 'domainCard' && !this.document.system.loadoutSlot.available) {
|
||||
itemData.system.inVault = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -310,6 +310,10 @@ export default function DHApplicationMixin(Base) {
|
|||
options.unshift({
|
||||
name: 'DAGGERHEART.APPLICATIONS.ContextMenu.useItem',
|
||||
icon: 'fa-solid fa-burst',
|
||||
condition: target => {
|
||||
const doc = getDocFromElement(target);
|
||||
return !(doc.type === 'domainCard' && doc.system.inVault)
|
||||
},
|
||||
callback: (target, event) => getDocFromElement(target).use(event)
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -202,6 +202,11 @@ export default class DhCharacter extends BaseDataActor {
|
|||
hint: 'DAGGERHEART.GENERAL.Bonuses.rest.longRest.longRestMoves.hint'
|
||||
})
|
||||
})
|
||||
}),
|
||||
maxLoadout : new fields.NumberField({
|
||||
integer: true,
|
||||
initial: 0,
|
||||
label: 'DAGGERHEART.GENERAL.Bonuses.maxLoadout.label'
|
||||
})
|
||||
}),
|
||||
companion: new ForeignDocumentUUIDField({ type: 'Actor', nullable: true, initial: null }),
|
||||
|
|
@ -321,6 +326,17 @@ export default class DhCharacter extends BaseDataActor {
|
|||
};
|
||||
}
|
||||
|
||||
get loadoutSlot() {
|
||||
const loadoutCount = this.domainCards.loadout?.length ?? 0,
|
||||
max = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).maxLoadout + this.bonuses.maxLoadout;
|
||||
|
||||
return {
|
||||
current: loadoutCount,
|
||||
available: Math.max(max - loadoutCount, 0),
|
||||
max
|
||||
}
|
||||
}
|
||||
|
||||
get armor() {
|
||||
return this.parent.items.find(x => x.type === 'armor' && x.system.equipped);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,13 @@ export default class DhHomebrew extends foundry.abstract.DataModel {
|
|||
initial: 12,
|
||||
label: 'DAGGERHEART.SETTINGS.Homebrew.FIELDS.maxFear.label'
|
||||
}),
|
||||
maxLoadout: new fields.NumberField({
|
||||
required: true,
|
||||
integer: true,
|
||||
min: 0,
|
||||
initial: 5,
|
||||
label: 'DAGGERHEART.SETTINGS.Homebrew.FIELDS.maxLoadout.label'
|
||||
}),
|
||||
traitArray: new fields.ArrayField(new fields.NumberField({ required: true, integer: true }), {
|
||||
initial: () => [2, 1, 1, 0, 0, -1]
|
||||
}),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue