fix negative nightOrder numbers causing a mess (fixes #193)

This commit is contained in:
Steffen 2021-07-14 13:57:02 +02:00
parent ff217761ff
commit 3d696c85de
No known key found for this signature in database
GPG Key ID: 764D74E98267DFC6
2 changed files with 5 additions and 2 deletions

View File

@ -90,7 +90,8 @@ For base game characters, it is sufficient to only provide the ID, similar to wh
_Note_: custom images will only be visible after enabling them in the Grimoire menu! _Note_: custom images will only be visible after enabling them in the Grimoire menu!
- **edition**: the ID of the edition for this character. can be left blank or "custom" - **edition**: the ID of the edition for this character. can be left blank or "custom"
- **firstNight** / **otherNight**: the position that this character acts on the first / other nights, compared to all - **firstNight** / **otherNight**: the position that this character acts on the first / other nights, compared to all
other characters other characters<br>
_Note_: must be a positive number or zero, with zero being treated as "does not act during the night"
- **firstNightReminder** / **otherNightReminder**: reminder text for first / other nights - **firstNightReminder** / **otherNightReminder**: reminder text for first / other nights
- **reminders**: reminder tokens, should be an empty array `[]` if none - **reminders**: reminder tokens, should be an empty array `[]` if none
- **remindersGlobal**: global reminder tokens that will always be available, no matter if the character is assigned to a player or not - **remindersGlobal**: global reminder tokens that will always be available, no matter if the character is assigned to a player or not

View File

@ -214,7 +214,7 @@ export default new Vuex.Store({
state.roles.get(role.id) || state.roles.get(role.id) ||
Object.assign({}, customRole, role) Object.assign({}, customRole, role)
) )
// default empty icons and placeholders // default empty icons and placeholders, clean up firstNight / otherNight
.map(role => { .map(role => {
if (rolesJSONbyId.get(role.id)) return role; if (rolesJSONbyId.get(role.id)) return role;
role.imageAlt = // map team to generic icon role.imageAlt = // map team to generic icon
@ -225,6 +225,8 @@ export default new Vuex.Store({
demon: "evil", demon: "evil",
fabled: "fabled" fabled: "fabled"
}[role.team] || "custom"; }[role.team] || "custom";
role.firstNight = Math.abs(role.firstNight);
role.otherNight = Math.abs(role.otherNight);
return role; return role;
}) })
// filter out roles that don't match an existing role and also don't have name/ability/team // filter out roles that don't match an existing role and also don't have name/ability/team