Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
davotronic5000 committed Apr 26, 2024
2 parents dcc27b9 + ba399ee commit 2584421
Show file tree
Hide file tree
Showing 13 changed files with 83 additions and 16 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Release Notes

### Version 3.2.0

- Adding Squid
- ST can now change the maximum number of votes a player can use to vote with
- A player with a non-one maximum vote can select how many votes to add to a vote.
- Fixed return to townsquare gong
- Also added Banshee

### Version 3.1.1

- Adding Summoner
Expand Down
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export default {
break;
case "t":
if (this.session.isSpectator) return;
this.$refs.menu.returnToTown();
this.$refs.menu.toggleReturnToTown();
break;
case "v":
if (this.session.voteHistory.length || !this.session.isSpectator) {
Expand Down
Binary file added src/assets/icons/classic/banshee.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/icons/classic/squid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/icons/modern/banshee.webp
Binary file not shown.
Binary file added src/assets/icons/modern/squid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/icons/modern/squid.webp
Binary file not shown.
24 changes: 24 additions & 0 deletions src/components/Player.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
<!-- Overlay icons -->
<div class="overlay" @click="vote()">
<font-awesome-icon icon="hand-paper" class="vote" title="Hand UP" />
<span v-show="session.votes[index] && session.votes[index] !== 1" class="vote-count">{{session.votes[index]}}</span>
</div>
<div class="overlay" @click="vote()">
<font-awesome-icon icon="xmark" class="vote" title="Hand DOWN" />
Expand Down Expand Up @@ -159,6 +160,18 @@
Nomination
</li>
</template>
<li>
Change vote count
<em>
<span :style="{ pointerEvents: player.maxVoteCount > -9 ? 'auto' : 'none' }" @click="updatePlayer('maxVoteCount', player.maxVoteCount - 1 , false)">
<font-awesome-icon icon="minus-circle" />
</span>
{{ player.maxVoteCount }}
<span :style="{ pointerEvents: player.maxVoteCount < 9 ? 'auto' : 'none' }" @click="updatePlayer('maxVoteCount', player.maxVoteCount + 1 , false)">
<font-awesome-icon icon="plus-circle" />
</span>
</em>
</li>
</template>
<li
@click="claimSeat"
Expand Down Expand Up @@ -587,6 +600,17 @@ export default {
display: block;
padding-top: 100%;
}
.vote-count {
z-index: 100;
border-radius: 50%;
background-color: purple;
width: 30px;
height: 30px;
display: flex;
justify-content: center;
align-items: center;
border: 2px solid white;
}
}
.player .overlay svg {
position: absolute;
Expand Down
31 changes: 20 additions & 11 deletions src/components/Vote.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
>!
<br />
<em class="blue">
{{ voters.length }} vote{{ voters.length !== 1 ? "s" : "" }}
{{ voters }} vote{{ voters !== 1 ? "s" : "" }}
</em>
in favor
<em v-if="nominee.role.team !== 'traveler'">
Expand Down Expand Up @@ -79,19 +79,29 @@
<div class="button-group">
<div
class="button townsfolk"
@click="vote(false)"
@click="vote(0)"
:class="{ disabled: !currentVote }"
>
Hand DOWN
</div>
<div
class="button demon"
@click="vote(true)"
@click="vote(playerCurrentVoteCount)"
:class="{ disabled: currentVote }"
>
Hand UP
</div>
</div>
<div v-show="!player.isVoteCountHidden && (player.maxVoteCount !== 1 || player.maxVoteCount !== 0)">
Vote Count:
<span :style="{ pointerEvents: (player.maxVoteCount > 0 && playerCurrentVoteCount > 1) || (player.maxVoteCount < 0 && playerCurrentVoteCount > player.maxVoteCount) ? 'auto' : 'none' }" @click="playerCurrentVoteCount = playerCurrentVoteCount - 1">
<font-awesome-icon icon="minus-circle" />
</span>
{{ playerCurrentVoteCount }}
<span :style="{ pointerEvents: (player.maxVoteCount > 0 && playerCurrentVoteCount < player.maxVoteCount) || (player.maxVoteCount < 0 && playerCurrentVoteCount < 1) ? 'auto' : 'none' }" @click="playerCurrentVoteCount = playerCurrentVoteCount + 1">
<font-awesome-icon icon="plus-circle" />
</span>
</div>
</template>
<div v-else-if="!player">Please claim a seat to vote.</div>
</div>
Expand Down Expand Up @@ -159,6 +169,7 @@ export default {
if (!this.player) return false;
if (this.player.isVoteless && this.nominee.role.team !== "traveler")
return false;
//TODO: Add logic here for banshee
const session = this.session;
const players = this.players.length;
const index = this.players.indexOf(this.player);
Expand All @@ -168,25 +179,23 @@ export default {
},
voters: function () {
const nomination = this.session.nomination[1];
const voters = Array(this.players.length)
.fill("")
.map((x, index) =>
this.session.votes[index] ? this.players[index].name : ""
);
const reorder = [
...voters.slice(nomination + 1),
...voters.slice(0, nomination + 1),
...this.session.votes.slice(nomination + 1),
...this.session.votes.slice(0, nomination + 1),
];
return (
this.session.lockedVote
? reorder.slice(0, this.session.lockedVote - 1)
: reorder
).filter((n) => !!n);
).filter((n) => !!n)
.reduce((acc, cur) => acc + cur, 0);
},
},
data() {
return {
voteTimer: null,
playerCurrentVoteCount: 1,
};
},
methods: {
Expand Down
9 changes: 7 additions & 2 deletions src/components/modals/VoteHistoryModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<td>{{ vote.nominee }}</td>
<td>{{ vote.type }}</td>
<td>
{{ vote.votes.length }}
{{ vote.votes.reduce((acc, curr) => acc + curr.voteCount, 0) }}
<font-awesome-icon icon="hand-paper" />
</td>
<td>
Expand All @@ -80,7 +80,12 @@
/>
</td>
<td>
{{ vote.votes.join(", ") }}
{{ vote.votes.map(({ name, voteCount }) => {
if (voteCount !== 1) {
return `${name} (${voteCount})`
}
return name;
}).join(", ") }}
</td>
</tr>
</tbody>
Expand Down
16 changes: 16 additions & 0 deletions src/roles.json
Original file line number Diff line number Diff line change
Expand Up @@ -2248,6 +2248,22 @@
"name": "Summoner",
"team": "minion",
"ability": "You get 3 bluffs. On the 3rd night, choose a player: they become an evil Demon of your choice. [No Demon]"
},
{
"id": "banshee",
"otherNight": 42.1,
"otherNightReminder": "Announce that the Banshee has died.",
"reminders": ["Has Ability"],
"name": "Banshee",
"team": "townsfolk",
"ability": "If the Demon kills you, all players learn this. From now on, you may nominate twice per day and vote twice per nomination."
},
{
"id": "squid",
"name": "Squid",
"team": "Traveler",
"reminders": [],
"ability": "You can vote with as many limbs as you can raise."
}
]

2 changes: 2 additions & 0 deletions src/store/modules/players.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const NEWPLAYER = {
pronouns: "",
isEmote: false,
emoteType: "hand",
maxVoteCount: 1,
isVoteCountHidden: false,
};

const state = () => ({
Expand Down
7 changes: 5 additions & 2 deletions src/store/modules/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,11 @@ const mutations = {
players.filter((player) => !player.isDead || isExile).length / 2
),
votes: players
.filter((player, index) => state.votes[index])
.map(({ name }) => name),
.map((player, index) => {
const votes = state.votes[index];
return { name: player.name, voteCount: votes };
})
.filter(({ voteCount }) => voteCount),
});
},
clearVoteHistory(state) {
Expand Down

0 comments on commit 2584421

Please sign in to comment.