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
|
|
@ -1243,6 +1243,9 @@
|
||||||
"attack": {
|
"attack": {
|
||||||
"damage": {
|
"damage": {
|
||||||
"value": { "label": "Base Attack: Damage" }
|
"value": { "label": "Base Attack: Damage" }
|
||||||
|
},
|
||||||
|
"roll": {
|
||||||
|
"trait": { "label": "Base Attack: Trait" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -1593,6 +1596,10 @@
|
||||||
"hint": "test"
|
"hint": "test"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"ResetSettings": {
|
||||||
|
"resetConfirmationTitle": "Reset Settings",
|
||||||
|
"resetConfirmationText": "Are you sure you want to reset the {settings}?"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"UI": {
|
"UI": {
|
||||||
|
|
|
||||||
|
|
@ -136,10 +136,14 @@ export default class DhHomebrewSettings extends HandlebarsApplicationMixin(Appli
|
||||||
...move,
|
...move,
|
||||||
name: game.i18n.localize(move.name),
|
name: game.i18n.localize(move.name),
|
||||||
description: game.i18n.localize(move.description),
|
description: game.i18n.localize(move.description),
|
||||||
actions: move.actions.map(action => ({
|
actions: move.actions.reduce((acc, key) => {
|
||||||
...action,
|
const action = move.actions[key];
|
||||||
name: game.i18n.localize(action.name)
|
acc[key] = {
|
||||||
}))
|
...action,
|
||||||
|
name: game.i18n.localize(action.name)
|
||||||
|
};
|
||||||
|
return acc;
|
||||||
|
}, {})
|
||||||
};
|
};
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
|
|
@ -165,8 +169,18 @@ export default class DhHomebrewSettings extends HandlebarsApplicationMixin(Appli
|
||||||
}
|
}
|
||||||
|
|
||||||
static async reset() {
|
static async reset() {
|
||||||
|
const confirmed = await foundry.applications.api.DialogV2.confirm({
|
||||||
|
window: {
|
||||||
|
title: game.i18n.format('DAGGERHEART.SETTINGS.ResetSettings.resetConfirmationTitle')
|
||||||
|
},
|
||||||
|
content: game.i18n.format('DAGGERHEART.SETTINGS.ResetSettings.resetConfirmationText', {
|
||||||
|
settings: game.i18n.localize('DAGGERHEART.SETTINGS.Menu.homebrew.name')
|
||||||
|
})
|
||||||
|
});
|
||||||
|
if (!confirmed) return;
|
||||||
|
|
||||||
const resetSettings = new DhHomebrew();
|
const resetSettings = new DhHomebrew();
|
||||||
let localizedSettings = this.localizeObject(resetSettings);
|
let localizedSettings = this.localizeObject(resetSettings.toObject());
|
||||||
this.settings.updateSource(localizedSettings);
|
this.settings.updateSource(localizedSettings);
|
||||||
this.render();
|
this.render();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,7 @@ export default class BeastformSheet extends DHBaseItemSheet {
|
||||||
case 'effects':
|
case 'effects':
|
||||||
context.effects.actives = context.effects.actives.map(effect => {
|
context.effects.actives = context.effects.actives.map(effect => {
|
||||||
const data = effect.toObject();
|
const data = effect.toObject();
|
||||||
|
data.uuid = effect.uuid;
|
||||||
data.id = effect.id;
|
data.id = effect.id;
|
||||||
if (effect.type === 'beastform') data.mandatory = true;
|
if (effect.type === 'beastform') data.mandatory = true;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -141,6 +141,7 @@ export const defaultRestOptions = {
|
||||||
actions: {
|
actions: {
|
||||||
tendToWounds: {
|
tendToWounds: {
|
||||||
type: 'healing',
|
type: 'healing',
|
||||||
|
systemPath: 'restMoves.shortRest.moves.tendToWounds.actions',
|
||||||
name: game.i18n.localize('DAGGERHEART.APPLICATIONS.Downtime.shortRest.tendToWounds.name'),
|
name: game.i18n.localize('DAGGERHEART.APPLICATIONS.Downtime.shortRest.tendToWounds.name'),
|
||||||
img: 'icons/magic/life/cross-worn-green.webp',
|
img: 'icons/magic/life/cross-worn-green.webp',
|
||||||
actionType: 'action',
|
actionType: 'action',
|
||||||
|
|
@ -166,6 +167,7 @@ export const defaultRestOptions = {
|
||||||
actions: {
|
actions: {
|
||||||
clearStress: {
|
clearStress: {
|
||||||
type: 'healing',
|
type: 'healing',
|
||||||
|
systemPath: 'restMoves.shortRest.moves.clearStress.actions',
|
||||||
name: game.i18n.localize('DAGGERHEART.APPLICATIONS.Downtime.shortRest.clearStress.name'),
|
name: game.i18n.localize('DAGGERHEART.APPLICATIONS.Downtime.shortRest.clearStress.name'),
|
||||||
img: 'icons/magic/perception/eye-ringed-green.webp',
|
img: 'icons/magic/perception/eye-ringed-green.webp',
|
||||||
actionType: 'action',
|
actionType: 'action',
|
||||||
|
|
@ -191,6 +193,7 @@ export const defaultRestOptions = {
|
||||||
actions: {
|
actions: {
|
||||||
repairArmor: {
|
repairArmor: {
|
||||||
type: 'healing',
|
type: 'healing',
|
||||||
|
systemPath: 'restMoves.shortRest.moves.repairArmor.actions',
|
||||||
name: game.i18n.localize('DAGGERHEART.APPLICATIONS.Downtime.shortRest.repairArmor.name'),
|
name: game.i18n.localize('DAGGERHEART.APPLICATIONS.Downtime.shortRest.repairArmor.name'),
|
||||||
img: 'icons/skills/trades/smithing-anvil-silver-red.webp',
|
img: 'icons/skills/trades/smithing-anvil-silver-red.webp',
|
||||||
actionType: 'action',
|
actionType: 'action',
|
||||||
|
|
@ -226,6 +229,7 @@ export const defaultRestOptions = {
|
||||||
actions: {
|
actions: {
|
||||||
tendToWounds: {
|
tendToWounds: {
|
||||||
type: 'healing',
|
type: 'healing',
|
||||||
|
systemPath: 'restMoves.longRest.moves.tendToWounds.actions',
|
||||||
name: game.i18n.localize('DAGGERHEART.APPLICATIONS.Downtime.longRest.tendToWounds.name'),
|
name: game.i18n.localize('DAGGERHEART.APPLICATIONS.Downtime.longRest.tendToWounds.name'),
|
||||||
img: 'icons/magic/life/cross-worn-green.webp',
|
img: 'icons/magic/life/cross-worn-green.webp',
|
||||||
actionType: 'action',
|
actionType: 'action',
|
||||||
|
|
@ -251,6 +255,7 @@ export const defaultRestOptions = {
|
||||||
actions: {
|
actions: {
|
||||||
clearStress: {
|
clearStress: {
|
||||||
type: 'healing',
|
type: 'healing',
|
||||||
|
systemPath: 'restMoves.longRest.moves.clearStress.actions',
|
||||||
name: game.i18n.localize('DAGGERHEART.APPLICATIONS.Downtime.longRest.clearStress.name'),
|
name: game.i18n.localize('DAGGERHEART.APPLICATIONS.Downtime.longRest.clearStress.name'),
|
||||||
img: 'icons/magic/perception/eye-ringed-green.webp',
|
img: 'icons/magic/perception/eye-ringed-green.webp',
|
||||||
actionType: 'action',
|
actionType: 'action',
|
||||||
|
|
@ -276,6 +281,7 @@ export const defaultRestOptions = {
|
||||||
actions: {
|
actions: {
|
||||||
repairArmor: {
|
repairArmor: {
|
||||||
type: 'healing',
|
type: 'healing',
|
||||||
|
systemPath: 'restMoves.longRest.moves.repairArmor.actions',
|
||||||
name: game.i18n.localize('DAGGERHEART.APPLICATIONS.Downtime.longRest.repairArmor.name'),
|
name: game.i18n.localize('DAGGERHEART.APPLICATIONS.Downtime.longRest.repairArmor.name'),
|
||||||
img: 'icons/skills/trades/smithing-anvil-silver-red.webp',
|
img: 'icons/skills/trades/smithing-anvil-silver-red.webp',
|
||||||
actionType: 'action',
|
actionType: 'action',
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@ export default class DhCharacter extends BaseDataActor {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
maxLoadout : new fields.NumberField({
|
maxLoadout: new fields.NumberField({
|
||||||
integer: true,
|
integer: true,
|
||||||
initial: 0,
|
initial: 0,
|
||||||
label: 'DAGGERHEART.GENERAL.Bonuses.maxLoadout.label'
|
label: 'DAGGERHEART.GENERAL.Bonuses.maxLoadout.label'
|
||||||
|
|
@ -249,6 +249,15 @@ export default class DhCharacter extends BaseDataActor {
|
||||||
initial: '@profd4',
|
initial: '@profd4',
|
||||||
label: 'DAGGERHEART.GENERAL.Rules.attack.damage.value.label'
|
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({
|
weapon: new fields.SchemaField({
|
||||||
|
|
@ -329,13 +338,15 @@ export default class DhCharacter extends BaseDataActor {
|
||||||
|
|
||||||
get loadoutSlot() {
|
get loadoutSlot() {
|
||||||
const loadoutCount = this.domainCards.loadout?.length ?? 0,
|
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 {
|
return {
|
||||||
current: loadoutCount,
|
current: loadoutCount,
|
||||||
available: Math.max(max - loadoutCount, 0),
|
available: Math.max(max - loadoutCount, 0),
|
||||||
max
|
max
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
get armor() {
|
get armor() {
|
||||||
|
|
@ -535,6 +546,7 @@ export default class DhCharacter extends BaseDataActor {
|
||||||
prepareDerivedData() {
|
prepareDerivedData() {
|
||||||
const baseHope = this.resources.hope.value + (this.companion?.system?.resources?.hope ?? 0);
|
const baseHope = this.resources.hope.value + (this.companion?.system?.resources?.hope ?? 0);
|
||||||
this.resources.hope.value = Math.min(baseHope, this.resources.hope.max);
|
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() {
|
getRollData() {
|
||||||
|
|
|
||||||
|
|
@ -215,7 +215,10 @@ export function ActionMixin(Base) {
|
||||||
await this.parent.updateSource({ [path]: updates }, options);
|
await this.parent.updateSource({ [path]: updates }, options);
|
||||||
result = this.parent;
|
result = this.parent;
|
||||||
} else {
|
} 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
|
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) {
|
async _preUpdate(changes, options, user) {
|
||||||
const allowed = await super._preUpdate(changes, options, user);
|
const allowed = await super._preUpdate(changes, options, user);
|
||||||
if (allowed === false) return false;
|
if (allowed === false) return false;
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,8 @@ export default class DhActiveEffect extends ActiveEffect {
|
||||||
}
|
}
|
||||||
|
|
||||||
static applyField(model, change, field) {
|
static applyField(model, change, field) {
|
||||||
change.value = this.effectSafeEval(itemAbleRollParse(change.value, model, change.effect.parent));
|
const evalValue = this.effectSafeEval(itemAbleRollParse(change.value, model, change.effect.parent));
|
||||||
|
change.value = evalValue ?? change.value;
|
||||||
super.applyField(model, change, field);
|
super.applyField(model, change, field);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue