mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-19 08:20:30 +01:00
FIX: formula lables for attacks and weapons
This commit is contained in:
parent
9d0cfdd927
commit
e154d8610c
4 changed files with 22 additions and 18 deletions
|
|
@ -50,23 +50,21 @@ export default class DHAttackAction extends DHDamageAction {
|
||||||
_getLabels() {
|
_getLabels() {
|
||||||
const labels = [];
|
const labels = [];
|
||||||
const { roll, range, damage } = this;
|
const { roll, range, damage } = this;
|
||||||
|
|
||||||
if (roll.trait) labels.push(game.i18n.localize(`DAGGERHEART.CONFIG.Traits.${roll.trait}.short`))
|
if (roll.trait) labels.push(game.i18n.localize(`DAGGERHEART.CONFIG.Traits.${roll.trait}.short`))
|
||||||
labels.push(game.i18n.localize(`DAGGERHEART.CONFIG.Range.${range}.short`));
|
if (range) labels.push(game.i18n.localize(`DAGGERHEART.CONFIG.Range.${range}.short`));
|
||||||
|
|
||||||
for (const { value, type } of damage.parts) {
|
for (const { value, type } of damage.parts) {
|
||||||
const str = [value.dice];
|
const str = Roll.replaceFormulaData(value.getFormula(), this.actor?.getRollData() ?? {});
|
||||||
if (value.bonus) str.push(value.bonus.signedString());
|
|
||||||
|
|
||||||
const icons = Array.from(type)
|
const icons = Array.from(type)
|
||||||
.map(t => CONFIG.DH.GENERAL.damageTypes[t]?.icon)
|
.map(t => CONFIG.DH.GENERAL.damageTypes[t]?.icon)
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
|
|
||||||
const labelValue = str.join('');
|
|
||||||
if (icons.length === 0) {
|
if (icons.length === 0) {
|
||||||
labels.push(labelValue);
|
labels.push(str);
|
||||||
} else {
|
} else {
|
||||||
labels.push({ value: labelValue, icons });
|
labels.push({ value: str, icons });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,8 @@ export default class DHArmor extends AttachableItem {
|
||||||
* @returns {(string | { value: string, icons: string[] })[]} An array of localized strings and damage label objects.
|
* @returns {(string | { value: string, icons: string[] })[]} An array of localized strings and damage label objects.
|
||||||
*/
|
*/
|
||||||
_getLabels() {
|
_getLabels() {
|
||||||
const labels = [`${game.i18n.localize('DAGGERHEART.ITEMS.Armor.baseScore')}: ${this.baseScore}`];
|
const labels = [];
|
||||||
|
if(this.baseScore) labels.push(`${game.i18n.localize('DAGGERHEART.ITEMS.Armor.baseScore')}: ${this.baseScore}`)
|
||||||
return labels;
|
return labels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ export default class DHDomainCard extends BaseDataItem {
|
||||||
*/
|
*/
|
||||||
_getLabels() {
|
_getLabels() {
|
||||||
const labels = [
|
const labels = [
|
||||||
game.i18n.localize(`DAGGERHEART.CONFIG.DomainCardTypes.${this.type}`),
|
,
|
||||||
this.domainLabel,
|
this.domainLabel,
|
||||||
{
|
{
|
||||||
value: `${this.recallCost}`, //converts the number to a string
|
value: `${this.recallCost}`, //converts the number to a string
|
||||||
|
|
@ -97,6 +97,14 @@ export default class DHDomainCard extends BaseDataItem {
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (this.type) labels.push(game.i18n.localize(`DAGGERHEART.CONFIG.DomainCardTypes.${this.type}`));
|
||||||
|
if (this.domainLabel) labels.push(this.domainLabel);
|
||||||
|
if (this.recallCost) {
|
||||||
|
labels.push({
|
||||||
|
value: `${this.recallCost}`, //converts the number to a string
|
||||||
|
icons: ['fa-bolt']
|
||||||
|
});
|
||||||
|
}
|
||||||
return labels;
|
return labels;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -209,26 +209,23 @@ export default class DHWeapon extends AttachableItem {
|
||||||
* @returns {(string | { value: string, icons: string[] })[]} An array of localized strings and damage label objects.
|
* @returns {(string | { value: string, icons: string[] })[]} An array of localized strings and damage label objects.
|
||||||
*/
|
*/
|
||||||
_getLabels() {
|
_getLabels() {
|
||||||
|
const labels = [];
|
||||||
const { roll, range, damage } = this.attack;
|
const { roll, range, damage } = this.attack;
|
||||||
|
|
||||||
const labels = [
|
if (roll.trait) labels.push(game.i18n.localize(`DAGGERHEART.CONFIG.Traits.${roll.trait}.short`))
|
||||||
game.i18n.localize(`DAGGERHEART.CONFIG.Traits.${roll.trait}.short`),
|
if (range) labels.push(game.i18n.localize(`DAGGERHEART.CONFIG.Range.${range}.short`));
|
||||||
game.i18n.localize(`DAGGERHEART.CONFIG.Range.${range}.short`)
|
|
||||||
];
|
|
||||||
|
|
||||||
for (const { value, type } of damage.parts) {
|
for (const { value, type } of damage.parts) {
|
||||||
const str = [value.dice];
|
const str = Roll.replaceFormulaData(value.getFormula(), this.actor?.getRollData() ?? {});
|
||||||
if (value.bonus) str.push(value.bonus.signedString());
|
|
||||||
|
|
||||||
const icons = Array.from(type)
|
const icons = Array.from(type)
|
||||||
.map(t => CONFIG.DH.GENERAL.damageTypes[t]?.icon)
|
.map(t => CONFIG.DH.GENERAL.damageTypes[t]?.icon)
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
|
|
||||||
const labelValue = str.join('');
|
|
||||||
if (icons.length === 0) {
|
if (icons.length === 0) {
|
||||||
labels.push(labelValue);
|
labels.push(str);
|
||||||
} else {
|
} else {
|
||||||
labels.push({ value: labelValue, icons });
|
labels.push({ value: str, icons });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue