mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-07 14:36:13 +01:00
Merge branch 'v14-Dev' into v14/effect-stacking
This commit is contained in:
commit
26e650e8f6
81 changed files with 503 additions and 140 deletions
|
|
@ -190,6 +190,10 @@ export default class DhpAdversary extends DhCreature {
|
|||
}
|
||||
}
|
||||
|
||||
prepareDerivedData() {
|
||||
this.attack.roll.isStandardAttack = true;
|
||||
}
|
||||
|
||||
_getTags() {
|
||||
const tags = [
|
||||
game.i18n.localize(`DAGGERHEART.GENERAL.Tiers.${this.tier}`),
|
||||
|
|
|
|||
|
|
@ -670,7 +670,7 @@ export default class DhCharacter extends DhCreature {
|
|||
};
|
||||
|
||||
const globalHopeMax = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).maxHope;
|
||||
this.resources.hope.max = globalHopeMax - this.scars;
|
||||
this.resources.hope.max = globalHopeMax;
|
||||
this.resources.hitPoints.max += this.class.value?.system?.hitPoints ?? 0;
|
||||
|
||||
/* Companion Related Data */
|
||||
|
|
@ -694,6 +694,7 @@ export default class DhCharacter extends DhCreature {
|
|||
}
|
||||
}
|
||||
|
||||
this.resources.hope.max -= this.scars;
|
||||
this.resources.hope.value = Math.min(baseHope, this.resources.hope.max);
|
||||
this.attack.roll.trait = this.rules.attack.roll.trait ?? this.attack.roll.trait;
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ export default class DhEnvironment extends BaseDataActor {
|
|||
potentialAdversaries: new fields.TypedObjectField(
|
||||
new fields.SchemaField({
|
||||
label: new fields.StringField(),
|
||||
adversaries: new ForeignDocumentUUIDArrayField({ type: 'Actor' })
|
||||
adversaries: new ForeignDocumentUUIDArrayField({ type: 'Actor' }, { required: false, initial: [] })
|
||||
})
|
||||
),
|
||||
notes: new fields.HTMLField()
|
||||
|
|
|
|||
|
|
@ -165,7 +165,8 @@ export default class DamageField extends fields.SchemaField {
|
|||
if (data.hasRoll && part.resultBased && data.roll.result.duality === -1) return part.valueAlt;
|
||||
|
||||
const isAdversary = this.actor.type === 'adversary';
|
||||
if (isAdversary && this.actor.system.type === CONFIG.DH.ACTOR.adversaryTypes.horde.id) {
|
||||
const isHorde = this.actor.system.type === CONFIG.DH.ACTOR.adversaryTypes.horde.id;
|
||||
if (isAdversary && isHorde && this.roll?.isStandardAttack) {
|
||||
const hasHordeDamage = this.actor.effects.find(x => x.type === 'horde');
|
||||
if (hasHordeDamage && !hasHordeDamage.disabled) return part.valueAlt;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ export default class ForeignDocumentUUIDArrayField extends foundry.data.fields.A
|
|||
|
||||
/** @inheritdoc */
|
||||
initialize(value, model, options = {}) {
|
||||
const v = super.initialize(value, model, options);
|
||||
const v = super.initialize(value ?? [], model, options);
|
||||
return () => {
|
||||
const data = v.map(entry => (typeof entry === 'function' ? entry() : entry));
|
||||
return this.options.prune ? data.filter(d => !!d) : data;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import BaseDataItem from './base.mjs';
|
||||
import ItemLinkFields from '../../data/fields/itemLinkFields.mjs';
|
||||
import { getFeaturesHTMLData } from '../../helpers/utils.mjs';
|
||||
|
||||
export default class DHAncestry extends BaseDataItem {
|
||||
/** @inheritDoc */
|
||||
|
|
@ -19,7 +20,6 @@ export default class DHAncestry extends BaseDataItem {
|
|||
};
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**@override */
|
||||
|
|
@ -42,4 +42,18 @@ export default class DHAncestry extends BaseDataItem {
|
|||
get secondaryFeature() {
|
||||
return this.features.find(x => x.type === CONFIG.DH.ITEM.featureSubTypes.secondary)?.item;
|
||||
}
|
||||
|
||||
/**@inheritdoc */
|
||||
async getDescriptionData() {
|
||||
const baseDescription = this.description;
|
||||
const features = await getFeaturesHTMLData(this.features);
|
||||
|
||||
if (!features.length) return { prefix: null, value: baseDescription, suffix: null };
|
||||
const suffix = await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/sheets/items/description.hbs',
|
||||
{ label: 'DAGGERHEART.ITEMS.Ancestry.featuresLabel', features }
|
||||
);
|
||||
|
||||
return { prefix: null, value: baseDescription, suffix };
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,11 +59,10 @@ export default class DHArmor extends AttachableItem {
|
|||
const baseDescription = this.description;
|
||||
const allFeatures = CONFIG.DH.ITEM.allArmorFeatures();
|
||||
const features = this.armorFeatures.map(x => allFeatures[x.value]);
|
||||
if (!features.length) return { prefix: null, value: baseDescription, suffix: null };
|
||||
|
||||
const prefix = await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/sheets/items/armor/description.hbs',
|
||||
{ features }
|
||||
{ item: this.parent, features }
|
||||
);
|
||||
|
||||
return { prefix, value: baseDescription, suffix: null };
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import BaseDataItem from './base.mjs';
|
|||
import ForeignDocumentUUIDField from '../fields/foreignDocumentUUIDField.mjs';
|
||||
import ForeignDocumentUUIDArrayField from '../fields/foreignDocumentUUIDArrayField.mjs';
|
||||
import ItemLinkFields from '../fields/itemLinkFields.mjs';
|
||||
import { addLinkedItemsDiff, updateLinkedItemApps } from '../../helpers/utils.mjs';
|
||||
import { addLinkedItemsDiff, getFeaturesHTMLData, updateLinkedItemApps } from '../../helpers/utils.mjs';
|
||||
|
||||
export default class DHClass extends BaseDataItem {
|
||||
/** @inheritDoc */
|
||||
|
|
@ -163,4 +163,56 @@ export default class DHClass extends BaseDataItem {
|
|||
|
||||
updateLinkedItemApps(options, this.parent.sheet);
|
||||
}
|
||||
|
||||
/**@inheritdoc */
|
||||
async getDescriptionData() {
|
||||
const baseDescription = this.description;
|
||||
|
||||
const getDomainLabel = domain => {
|
||||
const data = CONFIG.DH.DOMAIN.allDomains()[domain];
|
||||
return data ? game.i18n.localize(data.label) : '';
|
||||
};
|
||||
let domainsLabel = '';
|
||||
if (this.domains.length) {
|
||||
if (this.domains.length === 1) domainsLabel = getDomainLabel(this.domains[0]);
|
||||
else {
|
||||
const firstDomains = this.domains
|
||||
.slice(0, this.domains.length - 1)
|
||||
.map(getDomainLabel)
|
||||
.join(', ');
|
||||
const lastDomain = getDomainLabel(this.domains[this.domains.length - 1]);
|
||||
domainsLabel = game.i18n.format('DAGGERHEART.GENERAL.thingsAndThing', {
|
||||
things: firstDomains,
|
||||
thing: lastDomain
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const classItems = [];
|
||||
for (const itemData of this.inventory.choiceB) {
|
||||
const linkData = [
|
||||
undefined,
|
||||
'UUID', // type
|
||||
itemData.uuid // target
|
||||
];
|
||||
const contentLink = await foundry.applications.ux.TextEditor.implementation._createContentLink(linkData);
|
||||
classItems.push(contentLink.outerHTML);
|
||||
}
|
||||
|
||||
const hopeFeatures = await getFeaturesHTMLData(this.hopeFeatures);
|
||||
const classFeatures = await getFeaturesHTMLData(this.classFeatures);
|
||||
|
||||
const suffix = await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/sheets/items/class/description.hbs',
|
||||
{
|
||||
class: this.parent,
|
||||
domains: domainsLabel,
|
||||
classItems,
|
||||
hopeFeatures,
|
||||
classFeatures
|
||||
}
|
||||
);
|
||||
|
||||
return { prefix: null, value: baseDescription, suffix };
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getFeaturesHTMLData } from '../../helpers/utils.mjs';
|
||||
import ForeignDocumentUUIDArrayField from '../fields/foreignDocumentUUIDArrayField.mjs';
|
||||
import BaseDataItem from './base.mjs';
|
||||
|
||||
|
|
@ -24,4 +25,17 @@ export default class DHCommunity extends BaseDataItem {
|
|||
/**@override */
|
||||
static DEFAULT_ICON = 'systems/daggerheart/assets/icons/documents/items/village.svg';
|
||||
|
||||
/**@inheritdoc */
|
||||
async getDescriptionData() {
|
||||
const baseDescription = this.description;
|
||||
const features = await getFeaturesHTMLData(this.features);
|
||||
|
||||
if (!features.length) return { prefix: null, value: baseDescription, suffix: null };
|
||||
const suffix = await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/sheets/items/description.hbs',
|
||||
{ label: 'DAGGERHEART.ITEMS.Community.featuresLabel', features }
|
||||
);
|
||||
|
||||
return { prefix: null, value: baseDescription, suffix };
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getFeaturesHTMLData } from '../../helpers/utils.mjs';
|
||||
import ForeignDocumentUUIDField from '../fields/foreignDocumentUUIDField.mjs';
|
||||
import ItemLinkFields from '../fields/itemLinkFields.mjs';
|
||||
import BaseDataItem from './base.mjs';
|
||||
|
|
@ -89,4 +90,28 @@ export default class DHSubclass extends BaseDataItem {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**@inheritdoc */
|
||||
async getDescriptionData() {
|
||||
const baseDescription = this.description;
|
||||
|
||||
const spellcastTrait = this.spellcastingTrait
|
||||
? game.i18n.localize(CONFIG.DH.ACTOR.abilities[this.spellcastingTrait].label)
|
||||
: null;
|
||||
const foundationFeatures = await getFeaturesHTMLData(this.foundationFeatures);
|
||||
const specializationFeatures = await getFeaturesHTMLData(this.specializationFeatures);
|
||||
const masteryFeatures = await getFeaturesHTMLData(this.masteryFeatures);
|
||||
|
||||
const suffix = await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/sheets/items/subclass/description.hbs',
|
||||
{
|
||||
spellcastTrait,
|
||||
foundationFeatures,
|
||||
specializationFeatures,
|
||||
masteryFeatures
|
||||
}
|
||||
);
|
||||
|
||||
return { prefix: null, value: baseDescription, suffix };
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,13 +113,26 @@ export default class DHWeapon extends AttachableItem {
|
|||
/**@inheritdoc */
|
||||
async getDescriptionData() {
|
||||
const baseDescription = this.description;
|
||||
|
||||
const tier = game.i18n.localize(`DAGGERHEART.GENERAL.Tiers.${this.tier}`);
|
||||
const trait = game.i18n.localize(CONFIG.DH.ACTOR.abilities[this.attack.roll.trait].label);
|
||||
const range = game.i18n.localize(`DAGGERHEART.CONFIG.Range.${this.attack.range}.name`);
|
||||
const damage = Roll.replaceFormulaData(this.attack.damageFormula, this.parent.parent ?? this.parent);
|
||||
const burden = game.i18n.localize(CONFIG.DH.GENERAL.burden[this.burden].label);
|
||||
|
||||
const allFeatures = CONFIG.DH.ITEM.allWeaponFeatures();
|
||||
const features = this.weaponFeatures.map(x => allFeatures[x.value]);
|
||||
if (!features.length) return { prefix: null, value: baseDescription, suffix: null };
|
||||
|
||||
const prefix = await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/sheets/items/weapon/description.hbs',
|
||||
{ features }
|
||||
{
|
||||
features,
|
||||
tier,
|
||||
trait,
|
||||
range,
|
||||
damage,
|
||||
burden
|
||||
}
|
||||
);
|
||||
|
||||
return { prefix, value: baseDescription, suffix: null };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue