mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-11 19:25:21 +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",
|
||||
"vaultActive": "Active In Vault",
|
||||
"loadoutIgnore": "Doesn't Count For Loadout",
|
||||
"domainTouched": "Domain Touched",
|
||||
"domainTouchedPlaceholder": "loadout {domain} requirement",
|
||||
"foundationTitle": "Foundation",
|
||||
"specializationTitle": "Specialization",
|
||||
"masteryTitle": "Mastery"
|
||||
|
|
@ -2785,7 +2787,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": {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,10 @@ export default class DHDomainCard extends BaseDataItem {
|
|||
required: true,
|
||||
nullable: 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);
|
||||
}
|
||||
|
||||
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 */
|
||||
|
|
|
|||
|
|
@ -20,7 +20,10 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -94,7 +94,8 @@
|
|||
"source": "Daggerheart SRD",
|
||||
"page": 131,
|
||||
"artist": ""
|
||||
}
|
||||
},
|
||||
"domainTouched": 4
|
||||
},
|
||||
"flags": {},
|
||||
"_id": "VOSFaQHZbmhMyXwi",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
{{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" }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue