mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 15:39:02 +01:00
Moved extra rest options from rules to bonuses
This commit is contained in:
parent
b870d4016a
commit
6a4bce8ffe
4 changed files with 80 additions and 70 deletions
46
lang/en.json
46
lang/en.json
|
|
@ -1014,6 +1014,30 @@
|
||||||
"singular": "Adversary",
|
"singular": "Adversary",
|
||||||
"plural": "Adversaries"
|
"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": {
|
"Character": {
|
||||||
"singular": "Character",
|
"singular": "Character",
|
||||||
"plural": "Characters"
|
"plural": "Characters"
|
||||||
|
|
@ -1163,28 +1187,6 @@
|
||||||
"hint": "The cost in stress you can pay to reduce minor damage to none."
|
"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": {
|
"Tabs": {
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,19 @@ export default class DhpDowntime extends HandlebarsApplicationMixin(ApplicationV
|
||||||
this.actor = actor;
|
this.actor = actor;
|
||||||
this.shortrest = shortrest;
|
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 = {
|
this.nrChoices = {
|
||||||
shortRest: {
|
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: {
|
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 };
|
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);
|
super._attachPartListeners(partId, htmlElement, options);
|
||||||
|
|
||||||
htmlElement
|
htmlElement
|
||||||
.querySelectorAll('.activity-select-section')
|
.querySelectorAll('.activity-container')
|
||||||
.forEach(element => element.addEventListener('contextmenu', this.deselectMove.bind(this)));
|
.forEach(element => element.addEventListener('contextmenu', this.deselectMove.bind(this)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -106,7 +112,7 @@ export default class DhpDowntime extends HandlebarsApplicationMixin(ApplicationV
|
||||||
}
|
}
|
||||||
|
|
||||||
deselectMove(event) {
|
deselectMove(event) {
|
||||||
const button = event.target.closest('.activity-select-section');
|
const button = event.target.closest('.activity-container');
|
||||||
const move = button.dataset.move;
|
const move = button.dataset.move;
|
||||||
this.moveData[button.dataset.category].moves[move].selected = this.moveData[button.dataset.category].moves[move]
|
this.moveData[button.dataset.category].moves[move].selected = this.moveData[button.dataset.category].moves[move]
|
||||||
.selected
|
.selected
|
||||||
|
|
@ -118,7 +124,9 @@ export default class DhpDowntime extends HandlebarsApplicationMixin(ApplicationV
|
||||||
|
|
||||||
static async takeDowntime() {
|
static async takeDowntime() {
|
||||||
const moves = Object.values(this.moveData).flatMap(category => {
|
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');
|
const cls = getDocumentClass('ChatMessage');
|
||||||
|
|
|
||||||
|
|
@ -126,6 +126,44 @@ export default class DhCharacter extends BaseDataActor {
|
||||||
}),
|
}),
|
||||||
rally: new fields.ArrayField(new fields.StringField(), {
|
rally: new fields.ArrayField(new fields.StringField(), {
|
||||||
label: 'DAGGERHEART.CLASS.Feature.rallyDice'
|
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 }),
|
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 })
|
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 })
|
runeWard: new fields.BooleanField({ initial: false })
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -3,16 +3,16 @@
|
||||||
|
|
||||||
<div class="activities-container">
|
<div class="activities-container">
|
||||||
{{#each moves as |move key|}}
|
{{#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">
|
<div class="activity-inner-container">
|
||||||
<i class="{{#if move.selected}}fa-solid{{else}}fa-regular{{/if}} fa-circle activity-marker"></i>
|
<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>
|
<i class="{{move.icon}} activity-icon"></i>
|
||||||
<div>{{move.name}}</div>
|
<div>{{move.name}}</div>
|
||||||
</a>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{#if move.selected}}<div class="activity-selected-marker">{{move.selected}}</div>{{/if}}
|
{{#if move.selected}}<div class="activity-selected-marker">{{move.selected}}</div>{{/if}}
|
||||||
</div>
|
</a>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue