From 1c31de430a71867feadf391519da0a87436b3dd5 Mon Sep 17 00:00:00 2001 From: Steffen Date: Sat, 6 Feb 2021 22:24:46 +0100 Subject: [PATCH 1/3] allow selecting multiple characters (closes #77) --- src/components/modals/RolesModal.vue | 51 ++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/src/components/modals/RolesModal.vue b/src/components/modals/RolesModal.vue index 39f460b..671227a 100644 --- a/src/components/modals/RolesModal.vue +++ b/src/components/modals/RolesModal.vue @@ -7,16 +7,24 @@

Select the characters for {{ nonTravelers }} players:

@@ -64,7 +72,7 @@ export default { computed: { selectedRoles: function() { return Object.values(this.roleSelection) - .map(roles => roles.filter(role => role.selected).length) + .map(roles => roles.reduce((a, { selected }) => a + selected, 0)) .reduce((a, b) => a + b, 0); }, hasSelectedSetupRoles: function() { @@ -84,7 +92,7 @@ export default { this.$set(this.roleSelection, role.team, []); } this.roleSelection[role.team].push(role); - this.$set(role, "selected", false); + this.$set(role, "selected", 0); }); delete this.roleSelection["traveler"]; const playerCount = Math.max(5, this.nonTravelers); @@ -93,10 +101,10 @@ export default { for (let x = 0; x < composition[team]; x++) { if (this.roleSelection[team]) { const available = this.roleSelection[team].filter( - role => role.selected !== true + role => !role.selected ); if (available.length) { - randomElement(available).selected = true; + randomElement(available).selected = 1; } } } @@ -106,7 +114,12 @@ export default { if (this.selectedRoles <= this.nonTravelers && this.selectedRoles) { // generate list of selected roles and randomize it const roles = Object.values(this.roleSelection) - .map(roles => roles.filter(role => role.selected)) + .map(roles => + roles + // duplicate roles selected more than once and filter unselected + .reduce((a, r) => [...a, ...Array(r.selected).fill(r)], []) + ) + // flatten into a single array .reduce((a, b) => [...a, ...b], []) .map(a => [Math.random(), a]) .sort((a, b) => a[0] - b[0]) @@ -152,6 +165,9 @@ ul.tokens { transition: all 250ms; &.selected { opacity: 1; + .buttons { + display: flex; + } } &.townsfolk { box-shadow: 0 0 10px $townsfolk, 0 0 10px #004cff; @@ -172,6 +188,27 @@ ul.tokens { transform: scale(1.2); z-index: 10; } + .buttons { + display: none; + position: absolute; + top: 95%; + text-align: center; + width: 100%; + z-index: 30; + font-weight: bold; + filter: drop-shadow(0 0 5px rgba(0, 0, 0, 1)); + span { + flex-grow: 1; + } + svg { + opacity: 0.25; + cursor: pointer; + &:hover { + opacity: 1; + color: red; + } + } + } } .count { opacity: 1; From 5c4811ba91fc6374038b2f173b3e39164108a7ee Mon Sep 17 00:00:00 2001 From: Steffen Date: Sun, 7 Feb 2021 22:14:27 +0100 Subject: [PATCH 2/3] wrap up and changelog --- CHANGELOG.md | 11 +++++ src/components/modals/RolesModal.vue | 67 ++++++++++++++++++++++++---- src/main.js | 1 + 3 files changed, 71 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5afd997..9608391 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Release Notes +## Version 2.7.0 +- added support for assigning duplicate characters to more than one player (like Legion) +- further live session bandwidth optimizations +- sessions can now be joined by pasting the whole link into the popup (thanks @davotronic5000) +- fabled night order bug fixed +- added Legion to list of available characters (thanks @eddgabriel) +- added support for mp4/webm video backgrounds +- added tooltips to night order popup + +--- + ## Version 2.6.0 - night mode can be toggeled with [S] now (thanks @davotronic5000) - night order shows which players are dead diff --git a/src/components/modals/RolesModal.vue b/src/components/modals/RolesModal.vue index 671227a..2ed5e13 100644 --- a/src/components/modals/RolesModal.vue +++ b/src/components/modals/RolesModal.vue @@ -17,7 +17,7 @@ @click="role.selected = role.selected ? 0 : 1" > -
+
- Warning: there are characters selected that modify the game setup! The - randomizer does not account for these characters. + + + Warning: there are characters selected that modify the game setup! The + randomizer does not account for these characters. +
+
diff --git a/src/main.js b/src/main.js index d755fc4..aeebf6a 100644 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,7 @@ const faIcons = [ "Dice", "Dragon", "ExchangeAlt", + "ExclamationTriangle", "FileCode", "FileUpload", "HandPaper", From 9e6d14ec82aea619aa04a5bf8b4d6bc34d6beb84 Mon Sep 17 00:00:00 2001 From: Steffen Date: Sun, 7 Feb 2021 22:14:50 +0100 Subject: [PATCH 3/3] 2.7.0 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 55e9914..6f4d63e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "townsquare", - "version": "2.6.0", + "version": "2.7.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 4b379d7..abbaeff 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "townsquare", - "version": "2.6.0", + "version": "2.7.0", "description": "Blood on the Clocktower Town Square", "author": "Steffen Baumgart", "scripts": {