diff --git a/CHANGELOG.md b/CHANGELOG.md index 96db417..ec4ba22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Release Notes +### Version 2.15.4 +- added ability to run a non-nomination vote + ### Version 2.15.3 - add Huntsman/Damsel, Noble, Al-Hadikhia, Golem, Fearmonger to list of available characters diff --git a/src/components/Player.vue b/src/components/Player.vue index 8a52cd7..07f1e2f 100644 --- a/src/components/Player.vue +++ b/src/components/Player.vue @@ -155,6 +155,12 @@ Nomination </li> </template> + <template v-if="!session.nomination"> + <li @click="callVote(player)"> + <font-awesome-icon icon="vote-yea" /> + Call for Vote + </li> + </template> </template> <li @click="claimSeat" @@ -326,6 +332,13 @@ export default { this.isMenuOpen = false; this.$emit("trigger", ["nominatePlayer", player]); }, + callVote() { + this.isMenuOpen = false; + const votePrompt = "Vote Type (leave blank for no label)"; + const voteType = prompt(votePrompt) || "Vote"; + // console.log('voteType', voteType); + this.$emit("trigger", ["callVote", voteType, this.player]); + }, cancel() { this.$emit("trigger", ["cancel"]); }, diff --git a/src/components/TownSquare.vue b/src/components/TownSquare.vue index 4c34249..35de31c 100644 --- a/src/components/TownSquare.vue +++ b/src/components/TownSquare.vue @@ -247,6 +247,12 @@ export default { this.cancel(); } }, + callVote(player, voteType) { + if (this.session.isSpectator || this.session.lockedVote) return; + const nomination = [player, player, voteType || "Vote"]; + this.$store.commit("session/nomination", { nomination }); + this.cancel(); + }, cancel() { this.move = -1; this.swap = -1; diff --git a/src/components/Vote.vue b/src/components/Vote.vue index c37df21..91e8d1c 100644 --- a/src/components/Vote.vue +++ b/src/components/Vote.vue @@ -6,9 +6,16 @@ </div> <div class="overlay"> <audio src="../assets/sounds/countdown.mp3" preload="auto"></audio> - <em class="blue">{{ nominator.name }}</em> nominated - <em>{{ nominee.name }}</em - >! + <div v-if="isNomination"> + <em class="blue">{{ nominator.name }}</em> nominated + <em>{{ nominee.name }}</em + >! + </div> + <div v-else> + <em class="blue">{{ nominator.name }}</em> called a vote! + <br /> + {{ voteType ? "Vote Type: " + voteType : null }} + </div> <br /> <em class="blue"> {{ voters.length }} vote{{ voters.length !== 1 ? "s" : "" }} @@ -55,7 +62,10 @@ </template> <div class="button demon" @click="finish">Close</div> </div> - <div class="button-group mark" v-if="nominee.role.team !== 'traveler'"> + <div + class="button-group mark" + v-if="nominee.role.team !== 'traveler' && isNomination" + > <div class="button" :class="{ @@ -146,6 +156,18 @@ export default { transitionDuration: this.session.votingSpeed - 100 + "ms" }; }, + isNomination: function() { + return ( + this.session.nomination.length === 2 || !this.session.nomination[2] + ); + }, + voteType: function() { + if (this.isNomination || this.session.nomination[2] === "Vote") { + return null; + } + + return this.session.nomination[2]; + }, player: function() { return this.players.find(p => p.id === this.session.playerId); }, @@ -155,6 +177,7 @@ export default { }, canVote: function() { if (!this.player) return false; + if (this.session.nomination.length === 3) return true; if (this.player.isVoteless && this.nominee.role.team !== "traveler") return false; const session = this.session; diff --git a/src/store/modules/session.js b/src/store/modules/session.js index 884117a..acf7d47 100644 --- a/src/store/modules/session.js +++ b/src/store/modules/session.js @@ -77,12 +77,14 @@ const mutations = { addHistory(state, players) { if (!state.isVoteHistoryAllowed && state.isSpectator) return; if (!state.nomination || state.lockedVote <= players.length) return; + const nonNomination = state.nomination.length === 3; + const voteType = state.nomination[2] || "Vote"; const isExile = players[state.nomination[1]].role.team === "traveler"; state.voteHistory.push({ timestamp: new Date(), nominator: players[state.nomination[0]].name, - nominee: players[state.nomination[1]].name, - type: isExile ? "Exile" : "Execution", + nominee: nonNomination ? "" : players[state.nomination[1]].name, + type: nonNomination ? voteType : isExile ? "Exile" : "Execution", majority: Math.ceil( players.filter(player => !player.isDead || isExile).length / 2 ),