This commit is contained in:
WBHarry 2026-01-11 11:58:35 +01:00 committed by GitHub
commit c7dba71a79
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 123 additions and 50 deletions

View file

@ -2321,6 +2321,10 @@
"DomainCard": {
"type": "Type",
"recallCost": "Recall Cost",
"vaultActive": "Active In Vault",
"loadoutIgnore": "Doesn't Count For Loadout",
"domainTouched": "Domain Touched",
"domainTouchedPlaceholder": "loadout {domain} requirement",
"foundationTitle": "Foundation",
"specializationTitle": "Specialization",
"masteryTitle": "Mastery"
@ -2819,7 +2823,8 @@
"noActorOwnership": "You do not have permissions for this character",
"documentIsMissing": "The {documentType} is missing from the world.",
"tokenActorMissing": "{name} is missing an Actor",
"tokenActorsMissing": "[{names}] missing Actors"
"tokenActorsMissing": "[{names}] missing Actors",
"domainTouchRequirement": "This domain card requires {nr} {domain} cards in the loadout to be used"
},
"Sidebar": {
"actorDirectory": {

View file

@ -33,7 +33,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
advanceResourceDie: CharacterSheet.#advanceResourceDie,
cancelBeastform: CharacterSheet.#cancelBeastform,
useDowntime: this.useDowntime,
viewParty: CharacterSheet.#viewParty,
viewParty: CharacterSheet.#viewParty
},
window: {
resizable: true,
@ -338,15 +338,20 @@ export default class CharacterSheet extends DHBaseActorSheet {
}
const type = 'effect';
const cls = game.system.api.models.actions.actionsTypes[type];
const action = new cls({
...cls.getSourceConfig(doc.system),
type: type,
chatDisplay: false,
cost: [{
key: 'stress',
value: doc.system.recallCost
}]
}, { parent: doc.system });
const action = new cls(
{
...cls.getSourceConfig(doc.system),
type: type,
chatDisplay: false,
cost: [
{
key: 'stress',
value: doc.system.recallCost
}
]
},
{ parent: doc.system }
);
const config = await action.use(event);
if (config) {
return doc.update({ 'system.inVault': false });
@ -822,7 +827,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
static async #toggleVault(_event, button) {
const doc = await getDocFromElement(button);
const { available } = this.document.system.loadoutSlot;
if (doc.system.inVault && !available) {
if (doc.system.inVault && !available && !doc.system.loadoutIgnore) {
return ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.loadoutMaxReached'));
}
@ -900,32 +905,32 @@ export default class CharacterSheet extends DHBaseActorSheet {
return;
}
const buttons = parties.map((p) => {
const button = document.createElement("button");
button.type = "button";
button.classList.add("plain");
const img = document.createElement("img");
const buttons = parties.map(p => {
const button = document.createElement('button');
button.type = 'button';
button.classList.add('plain');
const img = document.createElement('img');
img.src = p.img;
button.append(img);
const name = document.createElement("span");
const name = document.createElement('span');
name.textContent = p.name;
button.append(name);
button.addEventListener("click", () => {
button.addEventListener('click', () => {
p.sheet?.render({ force: true });
game.tooltip.dismissLockedTooltips();
});
return button;
});
const html = document.createElement("div");
html.classList.add("party-list");
const html = document.createElement('div');
html.classList.add('party-list');
html.append(...buttons);
game.tooltip.dismissLockedTooltips();
game.tooltip.activate(target, {
html,
locked: true,
})
locked: true
});
}
/**

View file

@ -39,6 +39,9 @@ export default class DomainCardSheet extends DHBaseItemSheet {
const context = await super._prepareContext(options);
context.domain = CONFIG.DH.DOMAIN.allDomains()[this.document.system.domain];
context.domainChoices = CONFIG.DH.DOMAIN.orderedDomains();
context.domainTouchedPlaceholder = game.i18n.format('DAGGERHEART.ITEMS.DomainCard.domainTouchedPlaceholder', {
domain: game.i18n.localize(context.domain.label)
});
return context;
}

View file

@ -29,7 +29,21 @@ export default class DHDomainCard extends BaseDataItem {
required: true,
initial: CONFIG.DH.DOMAIN.cardTypes.ability.id
}),
inVault: new fields.BooleanField({ initial: false })
inVault: new fields.BooleanField({ initial: false }),
vaultActive: new fields.BooleanField({
required: true,
nullable: false,
initial: false
}),
loadoutIgnore: new fields.BooleanField({
required: true,
nullable: false,
initial: false
}),
domainTouched: new fields.NumberField({
nullable: true,
initial: null
})
};
}
@ -38,6 +52,30 @@ export default class DHDomainCard extends BaseDataItem {
return game.i18n.localize(allDomainData[this.domain].label);
}
get vaultSupressed() {
return this.inVault && !this.vaultActive;
}
get domainTouchedSuppressed() {
if (!this.parent.system.domainTouched || this.parent.parent?.type !== 'character') return false;
const matchingDomainCards = this.parent.parent.items.filter(
item => !item.system.inVault && item.system.domain === this.parent.system.domain
).length;
return matchingDomainCards < this.parent.system.domainTouched;
}
get cannotUse() {
if (this.domainTouchedSuppressed) {
return ui.notifications.warn(
game.i18n.format('DAGGERHEART.UI.Notifications.domainTouchRequirement', {
nr: this.domainTouched,
domain: game.i18n.localize(CONFIG.DH.DOMAIN.allDomains()[this.domain].label)
})
);
}
}
/* -------------------------------------------- */
/**@override */

View file

@ -20,7 +20,10 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
}
if (this.parent?.type === 'domainCard') {
return this.parent.system.inVault;
const vaultSupressed = this.parent.system.vaultSupressed;
const domainTouchedSupressed = this.parent.system.domainTouchedSuppressed;
return vaultSupressed || domainTouchedSupressed;
}
return super.isSuppressed;

View file

@ -31,7 +31,7 @@ export default class DHItem extends foundry.documents.Item {
static async createDocuments(sources, operation) {
// Ensure that items being created are valid to the actor its being added to
const actor = operation.parent;
sources = actor?.system?.isItemValid ? sources.filter((s) => actor.system.isItemValid(s)) : sources;
sources = actor?.system?.isItemValid ? sources.filter(s => actor.system.isItemValid(s)) : sources;
return super.createDocuments(sources, operation);
}
@ -146,6 +146,8 @@ export default class DHItem extends foundry.documents.Item {
/* -------------------------------------------- */
async use(event) {
if (this.system.cannotUse) return;
const actions = new Set(this.system.actionsList);
if (actions?.size) {
let action = actions.first();

View file

@ -54,7 +54,8 @@
"source": "Daggerheart SRD",
"page": 120,
"artist": ""
}
},
"domainTouched": 4
},
"flags": {},
"_id": "5PvMQKCjrgSxzstn",

View file

@ -13,7 +13,8 @@
"source": "Daggerheart SRD",
"page": 121,
"artist": ""
}
},
"domainTouched": 4
},
"flags": {},
"_id": "Gb5bqpFSBiuBxUix",

View file

@ -46,7 +46,8 @@
"source": "Daggerheart SRD",
"page": 123,
"artist": ""
}
},
"domainTouched": 4
},
"flags": {},
"_id": "ON5bvnoQBy0SYc9Y",

View file

@ -71,7 +71,8 @@
"source": "Daggerheart SRD",
"page": 125,
"artist": ""
}
},
"domainTouched": 4
},
"flags": {},
"_id": "7Pu83ABdMukTxu3e",

View file

@ -18,7 +18,7 @@
},
"flags": {},
"_id": "BFWN2cObMdlk9uVz",
"sort": 3400000,
"sort": 3500000,
"effects": [
{
"name": "Get Back Up",

View file

@ -96,7 +96,8 @@
"source": "Daggerheart SRD",
"page": 127,
"artist": ""
}
},
"domainTouched": 4
},
"flags": {},
"_id": "KAuNb51AwhD8KEXk",

View file

@ -111,7 +111,8 @@
"source": "Daggerheart SRD",
"page": 129,
"artist": ""
}
},
"domainTouched": 4
},
"flags": {},
"_id": "uSyGKVxOJcnp28po",

View file

@ -44,7 +44,8 @@
"source": "Daggerheart SRD",
"page": 127,
"artist": ""
}
},
"loadoutIgnore": true
},
"flags": {},
"_id": "IqxzvvjZiYbgx21A",

View file

@ -94,7 +94,8 @@
"source": "Daggerheart SRD",
"page": 131,
"artist": ""
}
},
"domainTouched": 4
},
"flags": {},
"_id": "VOSFaQHZbmhMyXwi",

View file

@ -95,7 +95,7 @@
},
"flags": {},
"_id": "4uAFGp3LxiC07woC",
"sort": 3400000,
"sort": 3500000,
"effects": [],
"ownership": {
"default": 0

View file

@ -13,7 +13,8 @@
"source": "Daggerheart SRD",
"page": 133,
"artist": ""
}
},
"domainTouched": 4
},
"flags": {},
"_id": "JT5dM3gVL6chDBYU",

View file

@ -82,7 +82,8 @@
"source": "Daggerheart SRD",
"page": 134,
"artist": ""
}
},
"domainTouched": 4
},
"flags": {},
"_id": "k1AtYd3lSchIymBr",

View file

@ -51,7 +51,8 @@
"source": "Daggerheart SRD",
"page": 121,
"artist": ""
}
},
"vaultActive": true
},
"flags": {},
"_id": "sWUlSPOJEaXyQLCj",

View file

@ -6,7 +6,7 @@
"sorting": "a",
"_id": "7pKKYgRQAKlQAksV",
"description": "",
"sort": 1000000,
"sort": 950000,
"flags": {},
"_key": "!folders!7pKKYgRQAKlQAksV"
}

View file

@ -6,7 +6,7 @@
"sorting": "a",
"_id": "9Xc6KzNyjDtTGZkp",
"description": "",
"sort": 100000,
"sort": 700000,
"flags": {},
"_key": "!folders!9Xc6KzNyjDtTGZkp"
}

View file

@ -6,7 +6,7 @@
"sorting": "a",
"_id": "o7t2fsAmRxKLoHrO",
"description": "",
"sort": 200000,
"sort": 800000,
"flags": {},
"_key": "!folders!o7t2fsAmRxKLoHrO"
}

View file

@ -6,7 +6,7 @@
"sorting": "a",
"_id": "wWL9mV6i2EGX5xHS",
"description": "",
"sort": 300000,
"sort": 850000,
"flags": {},
"_key": "!folders!wWL9mV6i2EGX5xHS"
}

View file

@ -6,7 +6,7 @@
"sorting": "a",
"_id": "yalAnCU3SndrYImF",
"description": "",
"sort": 400000,
"sort": 900000,
"flags": {},
"_key": "!folders!yalAnCU3SndrYImF"
}

View file

@ -6,7 +6,7 @@
"sorting": "a",
"_id": "Emnx4o1DWGTVKoAg",
"description": "",
"sort": 500000,
"sort": 901563,
"flags": {},
"_key": "!folders!Emnx4o1DWGTVKoAg"
}

View file

@ -6,7 +6,7 @@
"sorting": "a",
"_id": "EiP5dLozOFZKIeWN",
"description": "",
"sort": 600000,
"sort": 903125,
"flags": {},
"_key": "!folders!EiP5dLozOFZKIeWN"
}

View file

@ -6,7 +6,7 @@
"sorting": "a",
"_id": "HAGbPLHwm0UozDeG",
"description": "",
"sort": 700000,
"sort": 906250,
"flags": {},
"_key": "!folders!HAGbPLHwm0UozDeG"
}

View file

@ -6,7 +6,7 @@
"sorting": "a",
"_id": "me7ywrVh38j6T8Sm",
"description": "",
"sort": 800000,
"sort": 912500,
"flags": {},
"_key": "!folders!me7ywrVh38j6T8Sm"
}

View file

@ -6,7 +6,7 @@
"sorting": "a",
"_id": "QYdeGsmVYIF34kZR",
"description": "",
"sort": 900000,
"sort": 925000,
"flags": {},
"_key": "!folders!QYdeGsmVYIF34kZR"
}

View file

@ -14,6 +14,12 @@
{{formField systemFields.level value=source.system.level data-dtype="Number"}}
<span>{{localize "DAGGERHEART.ITEMS.DomainCard.recallCost"}}</span>
{{formField systemFields.recallCost value=source.system.recallCost data-dtype="Number"}}
<span>{{localize "DAGGERHEART.ITEMS.DomainCard.vaultActive"}}</span>
{{formField systemFields.vaultActive value=source.system.vaultActive}}
<span>{{localize "DAGGERHEART.ITEMS.DomainCard.loadoutIgnore"}}</span>
{{formField systemFields.loadoutIgnore value=source.system.loadoutIgnore}}
<span>{{localize "DAGGERHEART.ITEMS.DomainCard.domainTouched"}}</span>
{{formField systemFields.domainTouched value=source.system.domainTouched placeholder=domainTouchedPlaceholder }}
</fieldset>
{{> "systems/daggerheart/templates/sheets/global/partials/resource-section/resource-section.hbs" }}