From 7cceaf511742a12cdbf16bd099c444fb05a4c2c0 Mon Sep 17 00:00:00 2001 From: mattburlage Date: Sat, 18 Sep 2021 17:22:52 -0400 Subject: [PATCH] Added non nomination voting feature --- CHANGELOG.md | 3 +++ src/components/Player.vue | 13 +++++++++++++ src/components/TownSquare.vue | 6 ++++++ src/components/Vote.vue | 31 +++++++++++++++++++++++++++---- src/store/modules/session.js | 6 ++++-- 5 files changed, 53 insertions(+), 6 deletions(-) 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 +
  • - {{ nominator.name }} nominated - {{ nominee.name }}! +
    + {{ nominator.name }} nominated + {{ nominee.name }}! +
    +
    + {{ nominator.name }} called a vote! +
    + {{ voteType ? "Vote Type: " + voteType : null }} +

    {{ voters.length }} vote{{ voters.length !== 1 ? "s" : "" }} @@ -55,7 +62,10 @@
    Close
    -
    +
    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 ),