mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Added DomainTouched support
This commit is contained in:
parent
7429369212
commit
8ab795b6ba
15 changed files with 62 additions and 12 deletions
|
|
@ -2296,6 +2296,8 @@
|
||||||
"recallCost": "Recall Cost",
|
"recallCost": "Recall Cost",
|
||||||
"vaultActive": "Active In Vault",
|
"vaultActive": "Active In Vault",
|
||||||
"loadoutIgnore": "Doesn't Count For Loadout",
|
"loadoutIgnore": "Doesn't Count For Loadout",
|
||||||
|
"domainTouched": "Domain Touched",
|
||||||
|
"domainTouchedPlaceholder": "loadout {domain} requirement",
|
||||||
"foundationTitle": "Foundation",
|
"foundationTitle": "Foundation",
|
||||||
"specializationTitle": "Specialization",
|
"specializationTitle": "Specialization",
|
||||||
"masteryTitle": "Mastery"
|
"masteryTitle": "Mastery"
|
||||||
|
|
@ -2785,7 +2787,8 @@
|
||||||
"noActorOwnership": "You do not have permissions for this character",
|
"noActorOwnership": "You do not have permissions for this character",
|
||||||
"documentIsMissing": "The {documentType} is missing from the world.",
|
"documentIsMissing": "The {documentType} is missing from the world.",
|
||||||
"tokenActorMissing": "{name} is missing an Actor",
|
"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": {
|
"Sidebar": {
|
||||||
"actorDirectory": {
|
"actorDirectory": {
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,9 @@ export default class DomainCardSheet extends DHBaseItemSheet {
|
||||||
const context = await super._prepareContext(options);
|
const context = await super._prepareContext(options);
|
||||||
context.domain = CONFIG.DH.DOMAIN.allDomains()[this.document.system.domain];
|
context.domain = CONFIG.DH.DOMAIN.allDomains()[this.document.system.domain];
|
||||||
context.domainChoices = CONFIG.DH.DOMAIN.orderedDomains();
|
context.domainChoices = CONFIG.DH.DOMAIN.orderedDomains();
|
||||||
|
context.domainTouchedPlaceholder = game.i18n.format('DAGGERHEART.ITEMS.DomainCard.domainTouchedPlaceholder', {
|
||||||
|
domain: game.i18n.localize(context.domain.label)
|
||||||
|
});
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,10 @@ export default class DHDomainCard extends BaseDataItem {
|
||||||
required: true,
|
required: true,
|
||||||
nullable: false,
|
nullable: false,
|
||||||
initial: false
|
initial: false
|
||||||
|
}),
|
||||||
|
domainTouched: new fields.NumberField({
|
||||||
|
nullable: true,
|
||||||
|
initial: null
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -48,6 +52,30 @@ export default class DHDomainCard extends BaseDataItem {
|
||||||
return game.i18n.localize(allDomainData[this.domain].label);
|
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 */
|
/**@override */
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,10 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.parent?.type === 'domainCard') {
|
if (this.parent?.type === 'domainCard') {
|
||||||
return this.parent.system.inVault && !this.parent.system.vaultActive;
|
const vaultSupressed = this.parent.system.vaultSupressed;
|
||||||
|
const domainTouchedSupressed = this.parent.system.domainTouchedSuppressed;
|
||||||
|
|
||||||
|
return vaultSupressed || domainTouchedSupressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.isSuppressed;
|
return super.isSuppressed;
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ export default class DHItem extends foundry.documents.Item {
|
||||||
static async createDocuments(sources, operation) {
|
static async createDocuments(sources, operation) {
|
||||||
// Ensure that items being created are valid to the actor its being added to
|
// Ensure that items being created are valid to the actor its being added to
|
||||||
const actor = operation.parent;
|
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);
|
return super.createDocuments(sources, operation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -146,6 +146,8 @@ export default class DHItem extends foundry.documents.Item {
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
async use(event) {
|
async use(event) {
|
||||||
|
if (this.system.cannotUse) return;
|
||||||
|
|
||||||
const actions = new Set(this.system.actionsList);
|
const actions = new Set(this.system.actionsList);
|
||||||
if (actions?.size) {
|
if (actions?.size) {
|
||||||
let action = actions.first();
|
let action = actions.first();
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,8 @@
|
||||||
"source": "Daggerheart SRD",
|
"source": "Daggerheart SRD",
|
||||||
"page": 120,
|
"page": 120,
|
||||||
"artist": ""
|
"artist": ""
|
||||||
}
|
},
|
||||||
|
"domainTouched": 4
|
||||||
},
|
},
|
||||||
"flags": {},
|
"flags": {},
|
||||||
"_id": "5PvMQKCjrgSxzstn",
|
"_id": "5PvMQKCjrgSxzstn",
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,8 @@
|
||||||
"source": "Daggerheart SRD",
|
"source": "Daggerheart SRD",
|
||||||
"page": 121,
|
"page": 121,
|
||||||
"artist": ""
|
"artist": ""
|
||||||
}
|
},
|
||||||
|
"domainTouched": 4
|
||||||
},
|
},
|
||||||
"flags": {},
|
"flags": {},
|
||||||
"_id": "Gb5bqpFSBiuBxUix",
|
"_id": "Gb5bqpFSBiuBxUix",
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,8 @@
|
||||||
"source": "Daggerheart SRD",
|
"source": "Daggerheart SRD",
|
||||||
"page": 123,
|
"page": 123,
|
||||||
"artist": ""
|
"artist": ""
|
||||||
}
|
},
|
||||||
|
"domainTouched": 4
|
||||||
},
|
},
|
||||||
"flags": {},
|
"flags": {},
|
||||||
"_id": "ON5bvnoQBy0SYc9Y",
|
"_id": "ON5bvnoQBy0SYc9Y",
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,8 @@
|
||||||
"source": "Daggerheart SRD",
|
"source": "Daggerheart SRD",
|
||||||
"page": 125,
|
"page": 125,
|
||||||
"artist": ""
|
"artist": ""
|
||||||
}
|
},
|
||||||
|
"domainTouched": 4
|
||||||
},
|
},
|
||||||
"flags": {},
|
"flags": {},
|
||||||
"_id": "7Pu83ABdMukTxu3e",
|
"_id": "7Pu83ABdMukTxu3e",
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,8 @@
|
||||||
"source": "Daggerheart SRD",
|
"source": "Daggerheart SRD",
|
||||||
"page": 127,
|
"page": 127,
|
||||||
"artist": ""
|
"artist": ""
|
||||||
}
|
},
|
||||||
|
"domainTouched": 4
|
||||||
},
|
},
|
||||||
"flags": {},
|
"flags": {},
|
||||||
"_id": "KAuNb51AwhD8KEXk",
|
"_id": "KAuNb51AwhD8KEXk",
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,8 @@
|
||||||
"source": "Daggerheart SRD",
|
"source": "Daggerheart SRD",
|
||||||
"page": 129,
|
"page": 129,
|
||||||
"artist": ""
|
"artist": ""
|
||||||
}
|
},
|
||||||
|
"domainTouched": 4
|
||||||
},
|
},
|
||||||
"flags": {},
|
"flags": {},
|
||||||
"_id": "uSyGKVxOJcnp28po",
|
"_id": "uSyGKVxOJcnp28po",
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,8 @@
|
||||||
"source": "Daggerheart SRD",
|
"source": "Daggerheart SRD",
|
||||||
"page": 131,
|
"page": 131,
|
||||||
"artist": ""
|
"artist": ""
|
||||||
}
|
},
|
||||||
|
"domainTouched": 4
|
||||||
},
|
},
|
||||||
"flags": {},
|
"flags": {},
|
||||||
"_id": "VOSFaQHZbmhMyXwi",
|
"_id": "VOSFaQHZbmhMyXwi",
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,8 @@
|
||||||
"source": "Daggerheart SRD",
|
"source": "Daggerheart SRD",
|
||||||
"page": 133,
|
"page": 133,
|
||||||
"artist": ""
|
"artist": ""
|
||||||
}
|
},
|
||||||
|
"domainTouched": 4
|
||||||
},
|
},
|
||||||
"flags": {},
|
"flags": {},
|
||||||
"_id": "JT5dM3gVL6chDBYU",
|
"_id": "JT5dM3gVL6chDBYU",
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,8 @@
|
||||||
"source": "Daggerheart SRD",
|
"source": "Daggerheart SRD",
|
||||||
"page": 134,
|
"page": 134,
|
||||||
"artist": ""
|
"artist": ""
|
||||||
}
|
},
|
||||||
|
"domainTouched": 4
|
||||||
},
|
},
|
||||||
"flags": {},
|
"flags": {},
|
||||||
"_id": "k1AtYd3lSchIymBr",
|
"_id": "k1AtYd3lSchIymBr",
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@
|
||||||
{{formField systemFields.vaultActive value=source.system.vaultActive}}
|
{{formField systemFields.vaultActive value=source.system.vaultActive}}
|
||||||
<span>{{localize "DAGGERHEART.ITEMS.DomainCard.loadoutIgnore"}}</span>
|
<span>{{localize "DAGGERHEART.ITEMS.DomainCard.loadoutIgnore"}}</span>
|
||||||
{{formField systemFields.loadoutIgnore value=source.system.loadoutIgnore}}
|
{{formField systemFields.loadoutIgnore value=source.system.loadoutIgnore}}
|
||||||
|
<span>{{localize "DAGGERHEART.ITEMS.DomainCard.domainTouched"}}</span>
|
||||||
|
{{formField systemFields.domainTouched value=source.system.domainTouched placeholder=domainTouchedPlaceholder }}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
{{> "systems/daggerheart/templates/sheets/global/partials/resource-section/resource-section.hbs" }}
|
{{> "systems/daggerheart/templates/sheets/global/partials/resource-section/resource-section.hbs" }}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue