mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-22 23:43:37 +02:00
Merged with feature/custom-resources
This commit is contained in:
commit
5e6b0f9a75
10 changed files with 28 additions and 31 deletions
|
|
@ -187,6 +187,7 @@ export default class DhpAdversary extends DhCreature {
|
|||
}
|
||||
|
||||
prepareDerivedData() {
|
||||
super.prepareDerivedData();
|
||||
this.attack.roll.isStandardAttack = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ export default class BaseDataActor extends foundry.abstract.TypeDataModel {
|
|||
const textData = Object.keys(changes.system.resources).reduce((acc, key) => {
|
||||
const resource = changes.system.resources[key];
|
||||
if (resource.value !== undefined && resource.value !== this.resources[key].value) {
|
||||
acc.push(getScrollTextData(this.resources, resource, key, this.parent.type));
|
||||
acc.push(getScrollTextData(this.parent, resource, key));
|
||||
}
|
||||
|
||||
return acc;
|
||||
|
|
|
|||
|
|
@ -658,6 +658,7 @@ export default class DhCharacter extends DhCreature {
|
|||
}
|
||||
|
||||
prepareDerivedData() {
|
||||
super.prepareDerivedData();
|
||||
let baseHope = this.resources.hope.value;
|
||||
if (this.companion) {
|
||||
for (let levelKey in this.companion.system.levelData.levelups) {
|
||||
|
|
@ -677,6 +678,7 @@ export default class DhCharacter extends DhCreature {
|
|||
this.attack.roll.trait = this.rules.attack.roll.trait ?? this.attack.roll.trait;
|
||||
|
||||
this.resources.armor = {
|
||||
label: 'DAGGERHEART.GENERAL.armor',
|
||||
value: this.armor?.system?.marks?.value ?? 0,
|
||||
max: this.armorScore,
|
||||
isReversed: true
|
||||
|
|
|
|||
|
|
@ -157,6 +157,7 @@ export default class DhCompanion extends DhCreature {
|
|||
}
|
||||
|
||||
prepareDerivedData() {
|
||||
super.prepareDerivedData();
|
||||
/* Partner Related Setup */
|
||||
if (this.partner) {
|
||||
this.levelData.level.changed = this.partner.system.levelData.level.current;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ export default class DhCreature extends BaseDataActor {
|
|||
resource.max,
|
||||
resource.initial,
|
||||
resource.label,
|
||||
resource.reverse,
|
||||
resource.maxLabel
|
||||
);
|
||||
} else {
|
||||
|
|
@ -57,6 +56,17 @@ export default class DhCreature extends BaseDataActor {
|
|||
return !vulnerableAppliedByOther;
|
||||
}
|
||||
|
||||
prepareDerivedData() {
|
||||
super.prepareDerivedData();
|
||||
const resources = CONFIG.DH.RESOURCE[`all${this.parent.type.capitalize()}Resources`]();
|
||||
if (resources) {
|
||||
for (const [key, value] of Object.entries(this.resources)) {
|
||||
value.label = resources[key]?.label;
|
||||
value.isReversed = resources[key]?.reverse;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async _preUpdate(changes, options, userId) {
|
||||
const allowed = await super._preUpdate(changes, options, userId);
|
||||
if (allowed === false) return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue