mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
[Bug] Downtime Actions Fixes (#421)
* . * Added a temp fix for a bug in action healing section * Corrected rules.attack.roll.trait * .
This commit is contained in:
parent
e6bfe08d83
commit
a54f4e3831
8 changed files with 71 additions and 10 deletions
|
|
@ -204,7 +204,7 @@ export default class DhCharacter extends BaseDataActor {
|
|||
})
|
||||
})
|
||||
}),
|
||||
maxLoadout : new fields.NumberField({
|
||||
maxLoadout: new fields.NumberField({
|
||||
integer: true,
|
||||
initial: 0,
|
||||
label: 'DAGGERHEART.GENERAL.Bonuses.maxLoadout.label'
|
||||
|
|
@ -249,6 +249,15 @@ export default class DhCharacter extends BaseDataActor {
|
|||
initial: '@profd4',
|
||||
label: 'DAGGERHEART.GENERAL.Rules.attack.damage.value.label'
|
||||
})
|
||||
}),
|
||||
roll: new fields.SchemaField({
|
||||
trait: new fields.StringField({
|
||||
required: true,
|
||||
choices: CONFIG.DH.ACTOR.abilities,
|
||||
nullable: true,
|
||||
initial: null,
|
||||
label: 'DAGGERHEART.GENERAL.Rules.attack.roll.trait.label'
|
||||
})
|
||||
})
|
||||
}),
|
||||
weapon: new fields.SchemaField({
|
||||
|
|
@ -329,13 +338,15 @@ export default class DhCharacter extends BaseDataActor {
|
|||
|
||||
get loadoutSlot() {
|
||||
const loadoutCount = this.domainCards.loadout?.length ?? 0,
|
||||
max = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).maxLoadout + this.bonuses.maxLoadout;
|
||||
max =
|
||||
game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).maxLoadout +
|
||||
this.bonuses.maxLoadout;
|
||||
|
||||
return {
|
||||
current: loadoutCount,
|
||||
available: Math.max(max - loadoutCount, 0),
|
||||
max
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
get armor() {
|
||||
|
|
@ -535,6 +546,7 @@ export default class DhCharacter extends BaseDataActor {
|
|||
prepareDerivedData() {
|
||||
const baseHope = this.resources.hope.value + (this.companion?.system?.resources?.hope ?? 0);
|
||||
this.resources.hope.value = Math.min(baseHope, this.resources.hope.max);
|
||||
this.attack.roll.trait = this.rules.attack.roll.trait ?? this.attack.roll.trait;
|
||||
}
|
||||
|
||||
getRollData() {
|
||||
|
|
|
|||
|
|
@ -215,7 +215,10 @@ export function ActionMixin(Base) {
|
|||
await this.parent.updateSource({ [path]: updates }, options);
|
||||
result = this.parent;
|
||||
} else {
|
||||
result = await this.item.update({ [path]: updates }, options);
|
||||
/* Fix me - For some reason updating the "healing" section in particular doesn't work without this */
|
||||
await this.item.update({ [path]: updates }, options);
|
||||
await this.item.updateSource({ [path]: updates }, options);
|
||||
result = this.item;
|
||||
}
|
||||
|
||||
return this.inCollection
|
||||
|
|
|
|||
|
|
@ -63,6 +63,19 @@ export default class DHWeapon extends AttachableItem {
|
|||
]
|
||||
}
|
||||
}
|
||||
}),
|
||||
rules: new fields.SchemaField({
|
||||
attack: new fields.SchemaField({
|
||||
roll: new fields.SchemaField({
|
||||
trait: new fields.StringField({
|
||||
required: true,
|
||||
choices: CONFIG.DH.ACTOR.abilities,
|
||||
nullable: true,
|
||||
initial: null,
|
||||
label: 'DAGGERHEART.GENERAL.Rules.attack.roll.trait.label'
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
};
|
||||
}
|
||||
|
|
@ -77,6 +90,10 @@ export default class DHWeapon extends AttachableItem {
|
|||
);
|
||||
}
|
||||
|
||||
prepareDerivedData() {
|
||||
this.attack.roll.trait = this.rules.attack.roll.trait ?? this.attack.roll.trait;
|
||||
}
|
||||
|
||||
async _preUpdate(changes, options, user) {
|
||||
const allowed = await super._preUpdate(changes, options, user);
|
||||
if (allowed === false) return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue