mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 15:39:02 +01:00
2
This commit is contained in:
parent
f2176c6238
commit
a32af32f3a
5 changed files with 45 additions and 7 deletions
|
|
@ -406,7 +406,11 @@
|
||||||
"rerollDice": "Reroll Dice"
|
"rerollDice": "Reroll Dice"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"CLASS": {
|
||||||
|
"Feature": {
|
||||||
|
"rallyDice": "Bardic Rally Dice"
|
||||||
|
}
|
||||||
|
},
|
||||||
"CONFIG": {
|
"CONFIG": {
|
||||||
"ActionType": {
|
"ActionType": {
|
||||||
"passive": "Passive",
|
"passive": "Passive",
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ export default class DhCharacter extends BaseDataActor {
|
||||||
physical: bonusField('DAGGERHEART.GENERAL.Damage.physicalDamage'),
|
physical: bonusField('DAGGERHEART.GENERAL.Damage.physicalDamage'),
|
||||||
magical: bonusField('DAGGERHEART.GENERAL.Damage.magicalDamage'),
|
magical: bonusField('DAGGERHEART.GENERAL.Damage.magicalDamage'),
|
||||||
primaryWeapon: bonusField('DAGGERHEART.GENERAL.Damage.primaryWeapon'),
|
primaryWeapon: bonusField('DAGGERHEART.GENERAL.Damage.primaryWeapon'),
|
||||||
secondaryWeapon: bonusField('DAGGERHEART.GENERAL.Damage.primaryWeapon')
|
secondaryWeapon: bonusField('DAGGERHEART.GENERAL.Damage.secondaryWeapon')
|
||||||
}),
|
}),
|
||||||
healing: bonusField('DAGGERHEART.GENERAL.Healing.healingAmount'),
|
healing: bonusField('DAGGERHEART.GENERAL.Healing.healingAmount'),
|
||||||
range: new fields.SchemaField({
|
range: new fields.SchemaField({
|
||||||
|
|
@ -121,7 +121,16 @@ export default class DhCharacter extends BaseDataActor {
|
||||||
initial: 0,
|
initial: 0,
|
||||||
label: 'DAGGERHEART.GENERAL.Range.other'
|
label: 'DAGGERHEART.GENERAL.Range.other'
|
||||||
})
|
})
|
||||||
})
|
}),
|
||||||
|
rally: new fields.ArrayField(
|
||||||
|
new fields.NumberField({
|
||||||
|
integer: true,
|
||||||
|
initial: 6
|
||||||
|
}),
|
||||||
|
{
|
||||||
|
label: 'DAGGERHEART.CLASS.Feature.rallyDice'
|
||||||
|
}
|
||||||
|
)
|
||||||
}),
|
}),
|
||||||
companion: new ForeignDocumentUUIDField({ type: 'Actor', nullable: true, initial: null }),
|
companion: new ForeignDocumentUUIDField({ type: 'Actor', nullable: true, initial: null }),
|
||||||
rules: new fields.SchemaField({
|
rules: new fields.SchemaField({
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,11 @@ const stressDamageReductionRule = localizationPath =>
|
||||||
|
|
||||||
const bonusField = label =>
|
const bonusField = label =>
|
||||||
new fields.SchemaField({
|
new fields.SchemaField({
|
||||||
bonus: new fields.NumberField({ integer: true, initial: 0, label }),
|
bonus: new fields.NumberField({ integer: true, initial: 0, label: `${game.i18n.localize(label)} Value` }),
|
||||||
dice: new fields.ArrayField(new fields.StringField())
|
dice: new fields.ArrayField(
|
||||||
|
new fields.StringField(),
|
||||||
|
{ label: `${game.i18n.localize(label)} Dice` }
|
||||||
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
export { attributeField, resourceField, stressDamageReductionRule, bonusField };
|
export { attributeField, resourceField, stressDamageReductionRule, bonusField };
|
||||||
|
|
|
||||||
|
|
@ -130,9 +130,9 @@ export default class D20Roll extends DHRoll {
|
||||||
value: this.options.roll.bonus
|
value: this.options.roll.bonus
|
||||||
});
|
});
|
||||||
|
|
||||||
modifiers.push(...this.getBonus(`roll.${this.options.type}`, `${this.options.type.capitalize()} Bonus`));
|
modifiers.push(...this.getBonus(`roll.${this.options.type}`, `${this.options.type?.capitalize()} Bonus`));
|
||||||
modifiers.push(
|
modifiers.push(
|
||||||
...this.getBonus(`roll.${this.options.roll.type}`, `${this.options.roll.type.capitalize()} Bonus`)
|
...this.getBonus(`roll.${this.options.roll.type}`, `${this.options.roll.type?.capitalize()} Bonus`)
|
||||||
);
|
);
|
||||||
|
|
||||||
return modifiers;
|
return modifiers;
|
||||||
|
|
|
||||||
|
|
@ -32,4 +32,26 @@ export default class DHToken extends TokenDocument {
|
||||||
|
|
||||||
return bars.concat(values);
|
return bars.concat(values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static _getTrackedAttributesFromSchema(schema, _path=[]) {
|
||||||
|
const attributes = {bar: [], value: []};
|
||||||
|
for ( const [name, field] of Object.entries(schema.fields) ) {
|
||||||
|
const p = _path.concat([name]);
|
||||||
|
if ( field instanceof foundry.data.fields.NumberField ) attributes.value.push(p);
|
||||||
|
if ( field instanceof foundry.data.fields.ArrayField ) attributes.value.push(p);
|
||||||
|
const isSchema = field instanceof foundry.data.fields.SchemaField;
|
||||||
|
const isModel = field instanceof foundry.data.fields.EmbeddedDataField;
|
||||||
|
if ( isSchema || isModel ) {
|
||||||
|
const schema = isModel ? field.model.schema : field;
|
||||||
|
const isBar = schema.has && schema.has("value") && schema.has("max");
|
||||||
|
if ( isBar ) attributes.bar.push(p);
|
||||||
|
else {
|
||||||
|
const inner = this.getTrackedAttributes(schema, p);
|
||||||
|
attributes.bar.push(...inner.bar);
|
||||||
|
attributes.value.push(...inner.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return attributes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue