mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-13 12:11:07 +01:00
[Feature] Advanced Effect Settings (#1523)
* Added VaultActive and LoadoutIgnore * Added DomainTouched support * Naming change * . * Improved labels
This commit is contained in:
parent
27b7758f7d
commit
d823501d91
29 changed files with 102 additions and 41 deletions
|
|
@ -2320,6 +2320,9 @@
|
|||
"DomainCard": {
|
||||
"type": "Type",
|
||||
"recallCost": "Recall Cost",
|
||||
"vaultActive": "Active In Vault",
|
||||
"loadoutIgnore": "Ignores Loadout Limits",
|
||||
"domainTouched": "Domain Touched",
|
||||
"foundationTitle": "Foundation",
|
||||
"specializationTitle": "Specialization",
|
||||
"masteryTitle": "Mastery"
|
||||
|
|
@ -2820,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": {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
@ -829,7 +829,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'));
|
||||
}
|
||||
|
||||
|
|
@ -907,32 +907,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
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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,19 @@ export default class DHDomainCard extends BaseDataItem {
|
|||
return game.i18n.localize(allDomainData[this.domain].label);
|
||||
}
|
||||
|
||||
get isVaultSupressed() {
|
||||
return this.inVault && !this.vaultActive;
|
||||
}
|
||||
|
||||
get isDomainTouchedSuppressed() {
|
||||
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;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**@override */
|
||||
|
|
|
|||
|
|
@ -20,7 +20,10 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
|
|||
}
|
||||
|
||||
if (this.parent?.type === 'domainCard') {
|
||||
return this.parent.system.inVault;
|
||||
const isVaultSupressed = this.parent.system.isVaultSupressed;
|
||||
const domainTouchedSupressed = this.parent.system.isDomainTouchedSuppressed;
|
||||
|
||||
return isVaultSupressed || domainTouchedSupressed;
|
||||
}
|
||||
|
||||
return super.isSuppressed;
|
||||
|
|
|
|||
|
|
@ -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,16 @@ export default class DHItem extends foundry.documents.Item {
|
|||
/* -------------------------------------------- */
|
||||
|
||||
async use(event) {
|
||||
/* DomainCard check. Can be expanded or made neater */
|
||||
if (this.system.isDomainTouchedSuppressed) {
|
||||
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)
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
const actions = new Set(this.system.actionsList);
|
||||
if (actions?.size) {
|
||||
let action = actions.first();
|
||||
|
|
|
|||
|
|
@ -54,7 +54,8 @@
|
|||
"source": "Daggerheart SRD",
|
||||
"page": 120,
|
||||
"artist": ""
|
||||
}
|
||||
},
|
||||
"domainTouched": 4
|
||||
},
|
||||
"flags": {},
|
||||
"_id": "5PvMQKCjrgSxzstn",
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@
|
|||
"source": "Daggerheart SRD",
|
||||
"page": 121,
|
||||
"artist": ""
|
||||
}
|
||||
},
|
||||
"domainTouched": 4
|
||||
},
|
||||
"flags": {},
|
||||
"_id": "Gb5bqpFSBiuBxUix",
|
||||
|
|
|
|||
|
|
@ -46,7 +46,8 @@
|
|||
"source": "Daggerheart SRD",
|
||||
"page": 123,
|
||||
"artist": ""
|
||||
}
|
||||
},
|
||||
"domainTouched": 4
|
||||
},
|
||||
"flags": {},
|
||||
"_id": "ON5bvnoQBy0SYc9Y",
|
||||
|
|
|
|||
|
|
@ -71,7 +71,8 @@
|
|||
"source": "Daggerheart SRD",
|
||||
"page": 125,
|
||||
"artist": ""
|
||||
}
|
||||
},
|
||||
"domainTouched": 4
|
||||
},
|
||||
"flags": {},
|
||||
"_id": "7Pu83ABdMukTxu3e",
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
},
|
||||
"flags": {},
|
||||
"_id": "BFWN2cObMdlk9uVz",
|
||||
"sort": 3400000,
|
||||
"sort": 3500000,
|
||||
"effects": [
|
||||
{
|
||||
"name": "Get Back Up",
|
||||
|
|
|
|||
|
|
@ -96,7 +96,8 @@
|
|||
"source": "Daggerheart SRD",
|
||||
"page": 127,
|
||||
"artist": ""
|
||||
}
|
||||
},
|
||||
"domainTouched": 4
|
||||
},
|
||||
"flags": {},
|
||||
"_id": "KAuNb51AwhD8KEXk",
|
||||
|
|
|
|||
|
|
@ -111,7 +111,8 @@
|
|||
"source": "Daggerheart SRD",
|
||||
"page": 129,
|
||||
"artist": ""
|
||||
}
|
||||
},
|
||||
"domainTouched": 4
|
||||
},
|
||||
"flags": {},
|
||||
"_id": "uSyGKVxOJcnp28po",
|
||||
|
|
|
|||
|
|
@ -44,7 +44,8 @@
|
|||
"source": "Daggerheart SRD",
|
||||
"page": 127,
|
||||
"artist": ""
|
||||
}
|
||||
},
|
||||
"loadoutIgnore": true
|
||||
},
|
||||
"flags": {},
|
||||
"_id": "IqxzvvjZiYbgx21A",
|
||||
|
|
|
|||
|
|
@ -94,7 +94,8 @@
|
|||
"source": "Daggerheart SRD",
|
||||
"page": 131,
|
||||
"artist": ""
|
||||
}
|
||||
},
|
||||
"domainTouched": 4
|
||||
},
|
||||
"flags": {},
|
||||
"_id": "VOSFaQHZbmhMyXwi",
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@
|
|||
},
|
||||
"flags": {},
|
||||
"_id": "4uAFGp3LxiC07woC",
|
||||
"sort": 3400000,
|
||||
"sort": 3500000,
|
||||
"effects": [],
|
||||
"ownership": {
|
||||
"default": 0
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@
|
|||
"source": "Daggerheart SRD",
|
||||
"page": 133,
|
||||
"artist": ""
|
||||
}
|
||||
},
|
||||
"domainTouched": 4
|
||||
},
|
||||
"flags": {},
|
||||
"_id": "JT5dM3gVL6chDBYU",
|
||||
|
|
|
|||
|
|
@ -82,7 +82,8 @@
|
|||
"source": "Daggerheart SRD",
|
||||
"page": 134,
|
||||
"artist": ""
|
||||
}
|
||||
},
|
||||
"domainTouched": 4
|
||||
},
|
||||
"flags": {},
|
||||
"_id": "k1AtYd3lSchIymBr",
|
||||
|
|
|
|||
|
|
@ -51,7 +51,8 @@
|
|||
"source": "Daggerheart SRD",
|
||||
"page": 121,
|
||||
"artist": ""
|
||||
}
|
||||
},
|
||||
"vaultActive": true
|
||||
},
|
||||
"flags": {},
|
||||
"_id": "sWUlSPOJEaXyQLCj",
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
"sorting": "a",
|
||||
"_id": "7pKKYgRQAKlQAksV",
|
||||
"description": "",
|
||||
"sort": 1000000,
|
||||
"sort": 950000,
|
||||
"flags": {},
|
||||
"_key": "!folders!7pKKYgRQAKlQAksV"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
"sorting": "a",
|
||||
"_id": "9Xc6KzNyjDtTGZkp",
|
||||
"description": "",
|
||||
"sort": 100000,
|
||||
"sort": 700000,
|
||||
"flags": {},
|
||||
"_key": "!folders!9Xc6KzNyjDtTGZkp"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
"sorting": "a",
|
||||
"_id": "o7t2fsAmRxKLoHrO",
|
||||
"description": "",
|
||||
"sort": 200000,
|
||||
"sort": 800000,
|
||||
"flags": {},
|
||||
"_key": "!folders!o7t2fsAmRxKLoHrO"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
"sorting": "a",
|
||||
"_id": "wWL9mV6i2EGX5xHS",
|
||||
"description": "",
|
||||
"sort": 300000,
|
||||
"sort": 850000,
|
||||
"flags": {},
|
||||
"_key": "!folders!wWL9mV6i2EGX5xHS"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
"sorting": "a",
|
||||
"_id": "yalAnCU3SndrYImF",
|
||||
"description": "",
|
||||
"sort": 400000,
|
||||
"sort": 900000,
|
||||
"flags": {},
|
||||
"_key": "!folders!yalAnCU3SndrYImF"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
"sorting": "a",
|
||||
"_id": "Emnx4o1DWGTVKoAg",
|
||||
"description": "",
|
||||
"sort": 500000,
|
||||
"sort": 901563,
|
||||
"flags": {},
|
||||
"_key": "!folders!Emnx4o1DWGTVKoAg"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
"sorting": "a",
|
||||
"_id": "EiP5dLozOFZKIeWN",
|
||||
"description": "",
|
||||
"sort": 600000,
|
||||
"sort": 903125,
|
||||
"flags": {},
|
||||
"_key": "!folders!EiP5dLozOFZKIeWN"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
"sorting": "a",
|
||||
"_id": "HAGbPLHwm0UozDeG",
|
||||
"description": "",
|
||||
"sort": 700000,
|
||||
"sort": 906250,
|
||||
"flags": {},
|
||||
"_key": "!folders!HAGbPLHwm0UozDeG"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
"sorting": "a",
|
||||
"_id": "me7ywrVh38j6T8Sm",
|
||||
"description": "",
|
||||
"sort": 800000,
|
||||
"sort": 912500,
|
||||
"flags": {},
|
||||
"_key": "!folders!me7ywrVh38j6T8Sm"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
"sorting": "a",
|
||||
"_id": "QYdeGsmVYIF34kZR",
|
||||
"description": "",
|
||||
"sort": 900000,
|
||||
"sort": 925000,
|
||||
"flags": {},
|
||||
"_key": "!folders!QYdeGsmVYIF34kZR"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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=0 }}
|
||||
</fieldset>
|
||||
|
||||
{{> "systems/daggerheart/templates/sheets/global/partials/resource-section/resource-section.hbs" }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue