Moved extra rest options from rules to bonuses

This commit is contained in:
WBHarry 2025-07-17 23:20:03 +02:00
parent b870d4016a
commit 6a4bce8ffe
4 changed files with 80 additions and 70 deletions

View file

@ -1014,6 +1014,30 @@
"singular": "Adversary",
"plural": "Adversaries"
},
"Bonuses": {
"rest": {
"shortRest": {
"shortRestMoves": {
"label": "Short Rest: Bonus Short Rest Moves",
"hint": "The number of extra Short Rest Moves the character can take during a Short Rest."
},
"longRestMoves": {
"label": "Short Rest: Bonus Long Rest Moves",
"hint": "The number of extra Long Rest Moves the character can take during a Short Rest."
}
},
"longRest": {
"shortRestMoves": {
"label": "Long Rest: Bonus Short Rest Moves",
"hint": "The number of extra Short Rest Moves the character can take during a Long Rest."
},
"longRestMoves": {
"label": "Long Rest: Bonus Long Rest Moves",
"hint": "The number of extra Long Rest Moves the character can take during a Long Rest."
}
}
}
},
"Character": {
"singular": "Character",
"plural": "Characters"
@ -1163,28 +1187,6 @@
"hint": "The cost in stress you can pay to reduce minor damage to none."
}
}
},
"rest": {
"shortRest": {
"shortRestMoves": {
"label": "Short Rest: Short Rest Moves",
"hint": "The number of Short Rest Moves the character can take during a Short Rest."
},
"longRestMoves": {
"label": "Short Rest: Long Rest Moves",
"hint": "The number of Long Rest Moves the character can take during a Short Rest."
}
},
"longRest": {
"shortRestMoves": {
"label": "Long Rest: Short Rest Moves",
"hint": "The number of Short Rest Moves the character can take during a Long Rest."
},
"longRestMoves": {
"label": "Long Rest: Long Rest Moves",
"hint": "The number of Long Rest Moves the character can take during a Long Rest."
}
}
}
},
"Tabs": {

View file

@ -7,13 +7,19 @@ export default class DhpDowntime extends HandlebarsApplicationMixin(ApplicationV
this.actor = actor;
this.shortrest = shortrest;
this.moveData = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).restMoves;
this.moveData = foundry.utils.deepClone(
game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).restMoves
);
this.nrChoices = {
shortRest: {
max: actor.system.rules.rest[`${shortrest ? 'short' : 'long'}Rest`].shortMoves
max:
(shortrest ? this.moveData.shortRest.nrChoices : 0) +
actor.system.bonuses.rest[`${shortrest ? 'short' : 'long'}Rest`].shortMoves
},
longRest: {
max: actor.system.rules.rest[`${shortrest ? 'short' : 'long'}Rest`].longMoves
max:
(!shortrest ? this.moveData.longRest.nrChoices : 0) +
actor.system.bonuses.rest[`${shortrest ? 'short' : 'long'}Rest`].longMoves
}
};
this.nrChoices.total = { max: this.nrChoices.shortRest.max + this.nrChoices.longRest.max };
@ -45,7 +51,7 @@ export default class DhpDowntime extends HandlebarsApplicationMixin(ApplicationV
super._attachPartListeners(partId, htmlElement, options);
htmlElement
.querySelectorAll('.activity-select-section')
.querySelectorAll('.activity-container')
.forEach(element => element.addEventListener('contextmenu', this.deselectMove.bind(this)));
}
@ -106,7 +112,7 @@ export default class DhpDowntime extends HandlebarsApplicationMixin(ApplicationV
}
deselectMove(event) {
const button = event.target.closest('.activity-select-section');
const button = event.target.closest('.activity-container');
const move = button.dataset.move;
this.moveData[button.dataset.category].moves[move].selected = this.moveData[button.dataset.category].moves[move]
.selected
@ -118,7 +124,9 @@ export default class DhpDowntime extends HandlebarsApplicationMixin(ApplicationV
static async takeDowntime() {
const moves = Object.values(this.moveData).flatMap(category => {
return Object.values(category.moves).filter(x => x.selected);
return Object.values(category.moves)
.filter(x => x.selected)
.flatMap(move => [...Array(move.selected).keys()].map(_ => move));
});
const cls = getDocumentClass('ChatMessage');

View file

@ -126,6 +126,44 @@ export default class DhCharacter extends BaseDataActor {
}),
rally: new fields.ArrayField(new fields.StringField(), {
label: 'DAGGERHEART.CLASS.Feature.rallyDice'
}),
rest: new fields.SchemaField({
shortRest: new fields.SchemaField({
shortMoves: new fields.NumberField({
required: true,
integer: true,
min: 0,
initial: 0,
label: 'DAGGERHEART.GENERAL.Bonuses.rest.shortRest.shortRestMoves.label',
hint: 'DAGGERHEART.GENERAL.Bonuses.rest.shortRest.shortRestMoves.hint'
}),
longMoves: new fields.NumberField({
required: true,
integer: true,
min: 0,
initial: 0,
label: 'DAGGERHEART.GENERAL.Bonuses.rest.shortRest.longRestMoves.label',
hint: 'DAGGERHEART.GENERAL.Bonuses.rest.shortRest.longRestMoves.hint'
})
}),
longRest: new fields.SchemaField({
shortMoves: new fields.NumberField({
required: true,
integer: true,
min: 0,
initial: 0,
label: 'DAGGERHEART.GENERAL.Bonuses.rest.longRest.shortRestMoves.label',
hint: 'DAGGERHEART.GENERAL.Bonuses.rest.longRest.shortRestMoves.hint'
}),
longMoves: new fields.NumberField({
required: true,
integer: true,
min: 0,
initial: 0,
label: 'DAGGERHEART.GENERAL.Bonuses.rest.longRest.longRestMoves.label',
hint: 'DAGGERHEART.GENERAL.Bonuses.rest.longRest.longRestMoves.hint'
})
})
})
}),
companion: new ForeignDocumentUUIDField({ type: 'Actor', nullable: true, initial: null }),
@ -173,44 +211,6 @@ export default class DhCharacter extends BaseDataActor {
*/
flipMinDiceValue: new fields.BooleanField({ intial: false })
}),
rest: new fields.SchemaField({
shortRest: new fields.SchemaField({
shortMoves: new fields.NumberField({
required: true,
integer: true,
min: 1,
initial: 2,
label: 'DAGGERHEART.GENERAL.Rules.rest.shortRest.shortRestMoves.label',
hint: 'DAGGERHEART.GENERAL.Rules.rest.shortRest.shortRestMoves.hint'
}),
longMoves: new fields.NumberField({
required: true,
integer: true,
min: 0,
initial: 0,
label: 'DAGGERHEART.GENERAL.Rules.rest.shortRest.longRestMoves.label',
hint: 'DAGGERHEART.GENERAL.Rules.rest.shortRest.longRestMoves.hint'
})
}),
longRest: new fields.SchemaField({
shortMoves: new fields.NumberField({
required: true,
integer: true,
min: 0,
initial: 0,
label: 'DAGGERHEART.GENERAL.Rules.rest.longRest.shortRestMoves.label',
hint: 'DAGGERHEART.GENERAL.Rules.rest.longRest.shortRestMoves.hint'
}),
longMoves: new fields.NumberField({
required: true,
integer: true,
min: 1,
initial: 2,
label: 'DAGGERHEART.GENERAL.Rules.rest.longRest.longRestMoves.label',
hint: 'DAGGERHEART.GENERAL.Rules.rest.longRest.longRestMoves.hint'
})
})
}),
runeWard: new fields.BooleanField({ initial: false })
})
};

View file

@ -3,16 +3,16 @@
<div class="activities-container">
{{#each moves as |move key|}}
<div class="activity-container">
<a class="activity-container" data-action="selectMove" data-category="{{../category}}" data-move="{{key}}" data-tooltip="{{concat "#" ../category "#" key}}">
<div class="activity-inner-container">
<i class="{{#if move.selected}}fa-solid{{else}}fa-regular{{/if}} fa-circle activity-marker"></i>
<a class="activity-select-section" data-action="selectMove" data-category="{{../category}}" data-move="{{key}}" data-tooltip="{{concat "#" ../category "#" key}}">
<div class="activity-select-section">
<i class="{{move.icon}} activity-icon"></i>
<div>{{move.name}}</div>
</a>
</div>
</div>
{{#if move.selected}}<div class="activity-selected-marker">{{move.selected}}</div>{{/if}}
</div>
</a>
{{/each}}
</div>
</fieldset>