[Feature] Armor/Weapon Compendiums (#459)

* Fixed localization

* .

* Added all Secondary Weapons

* Added all armors

* Added Tier1 weapons

* Tier2 Physical

* Tier 2 magical

* Tier 3 Physical

* Tier 3 Magical

* Tier 4 Physical

* Tier 4 Magical

* Added wheelchairs
This commit is contained in:
WBHarry 2025-07-30 15:33:00 +02:00 committed by GitHub
parent 8e516df7cb
commit 2c4d3bd4a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
277 changed files with 34221 additions and 431 deletions

View file

@ -203,7 +203,7 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
async consume(config) {
const usefulResources = foundry.utils.deepClone(this.actor.system.resources);
for (var cost of config.costs) {
if (cost.keyIsID) {
usefulResources[cost.key] = {
@ -224,10 +224,9 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
keyIsID: resource.keyIsID
};
});
console.log(resources)
console.log(resources);
await this.actor.modifyResource(resources);
if (config.uses?.enabled)
this.update({ 'uses.value': this.uses.value + 1 });
if (config.uses?.enabled) this.update({ 'uses.value': this.uses.value + 1 });
}
/* */

View file

@ -26,19 +26,20 @@ export default class CostField extends fields.ArrayField {
}
static calcCosts(costs) {
console.log(costs, CostField.getResources.call(this, costs))
console.log(costs, CostField.getResources.call(this, costs));
const resources = CostField.getResources.call(this, costs);
return costs.map(c => {
c.scale = c.scale ?? 1;
c.step = c.step ?? 1;
c.total = c.value + ((c.scale - 1) * c.step);
c.total = c.value + (c.scale - 1) * c.step;
c.enabled = c.hasOwnProperty('enabled') ? c.enabled : true;
c.max = c.key === 'fear'
? game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Resources.Fear)
: resources[c.key].isReversed
? resources[c.key].max
: resources[c.key].value
if(c.scalable) c.maxStep = Math.floor(c.max / c.step);
c.max =
c.key === 'fear'
? game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Resources.Fear)
: resources[c.key].isReversed
? resources[c.key].max
: resources[c.key].value;
if (c.scalable) c.maxStep = Math.floor(c.max / c.step);
return c;
});
}

View file

@ -69,34 +69,34 @@ export class DHActionRollData extends foundry.abstract.DataModel {
getModifier() {
const modifiers = [];
if(!this.parent?.actor) return modifiers;
if (!this.parent?.actor) return modifiers;
switch (this.parent.actor.type) {
case 'character':
const trait = this.useDefault || !this.trait ? (this.parent.item.system.attack.roll.trait ?? 'agility') : this.trait;
if(this.type === CONFIG.DH.GENERAL.rollTypes.attack.id || this.type === CONFIG.DH.GENERAL.rollTypes.trait.id)
modifiers.push(
{
label: `DAGGERHEART.CONFIG.Traits.${trait}.name`,
value: this.parent.actor.system.traits[trait].value
}
)
else if(this.type === CONFIG.DH.GENERAL.rollTypes.spellcast.id)
modifiers.push(
{
label: `DAGGERHEART.CONFIG.RollTypes.spellcast.name`,
value: this.parent.actor.system.spellcastModifier
}
)
const trait =
this.useDefault || !this.trait
? (this.parent.item.system.attack.roll.trait ?? 'agility')
: this.trait;
if (
this.type === CONFIG.DH.GENERAL.rollTypes.attack.id ||
this.type === CONFIG.DH.GENERAL.rollTypes.trait.id
)
modifiers.push({
label: `DAGGERHEART.CONFIG.Traits.${trait}.name`,
value: this.parent.actor.system.traits[trait].value
});
else if (this.type === CONFIG.DH.GENERAL.rollTypes.spellcast.id)
modifiers.push({
label: `DAGGERHEART.CONFIG.RollTypes.spellcast.name`,
value: this.parent.actor.system.spellcastModifier
});
break;
case 'companion':
case 'adversary':
if(this.type === CONFIG.DH.GENERAL.rollTypes.attack.id)
modifiers.push(
{
label: 'Bonus to Hit',
value: this.bonus ?? this.parent.actor.system.attack.roll.bonus
}
)
if (this.type === CONFIG.DH.GENERAL.rollTypes.attack.id)
modifiers.push({
label: 'Bonus to Hit',
value: this.bonus ?? this.parent.actor.system.attack.roll.bonus
});
break;
default:
break;

View file

@ -1,4 +1,4 @@
import FormulaField from "../formulaField.mjs";
import FormulaField from '../formulaField.mjs';
const fields = foundry.data.fields;
@ -36,7 +36,7 @@ export default class UsesField extends fields.SchemaField {
static hasUses(uses) {
if (!uses) return true;
let max = uses.max ?? 0;
if(isNaN(max)) {
if (isNaN(max)) {
const roll = new Roll(Roll.replaceFormulaData(uses.max, this.getRollData())).evaluateSync();
max = roll.total;
}

View file

@ -71,13 +71,14 @@ export default class DHArmor extends AttachableItem {
for (var feature of added) {
const featureData = armorFeatures[feature.value];
if (featureData.effects?.length > 0) {
const embeddedItems = await this.parent.createEmbeddedDocuments('ActiveEffect', [
{
name: game.i18n.localize(featureData.label),
description: game.i18n.localize(featureData.description),
changes: featureData.effects.flatMap(x => x.changes)
}
]);
const embeddedItems = await this.parent.createEmbeddedDocuments(
'ActiveEffect',
featureData.effects.map(effect => ({
...effect,
name: game.i18n.localize(effect.name),
description: game.i18n.localize(effect.description)
}))
);
feature.effectIds = embeddedItems.map(x => x.id);
}
@ -93,6 +94,7 @@ export default class DHArmor extends AttachableItem {
description: game.i18n.localize(effect.description)
}))
);
feature.effectIds = [...(feature.effectIds ?? []), ...embeddedEffects.map(x => x.id)];
const cls = game.system.api.models.actions.actionsTypes[action.type];
const actionId = foundry.utils.randomID();

View file

@ -118,13 +118,14 @@ export default class DHWeapon extends AttachableItem {
for (let weaponFeature of added) {
const featureData = CONFIG.DH.ITEM.weaponFeatures[weaponFeature.value];
if (featureData.effects?.length > 0) {
const embeddedItems = await this.parent.createEmbeddedDocuments('ActiveEffect', [
{
name: game.i18n.localize(featureData.label),
description: game.i18n.localize(featureData.description),
changes: featureData.effects.flatMap(x => x.changes)
}
]);
const embeddedItems = await this.parent.createEmbeddedDocuments(
'ActiveEffect',
featureData.effects.map(effect => ({
...effect,
name: game.i18n.localize(effect.name),
description: game.i18n.localize(effect.description)
}))
);
weaponFeature.effectIds = embeddedItems.map(x => x.id);
}
@ -140,6 +141,10 @@ export default class DHWeapon extends AttachableItem {
description: game.i18n.localize(effect.description)
}))
);
weaponFeature.effectIds = [
...(weaponFeature.effectIds ?? []),
...embeddedEffects.map(x => x.id)
];
const cls = game.system.api.models.actions.actionsTypes[action.type];
const actionId = foundry.utils.randomID();