mirror of
https://github.com/bra1n/townsquare.git
synced 2025-04-04 22:24:36 +00:00
Removed travelers from majority calculation
This commit is contained in:
parent
f98b43e304
commit
7a7b478a9f
3 changed files with 8 additions and 2 deletions
|
@ -121,7 +121,7 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
...mapState("players", ["players"]),
|
...mapState("players", ["players"]),
|
||||||
...mapState(["session", "grimoire"]),
|
...mapState(["session", "grimoire"]),
|
||||||
...mapGetters({ alive: "players/alive" }),
|
...mapGetters({ alive: "players/aliveNonTravelers" }),
|
||||||
nominator: function() {
|
nominator: function() {
|
||||||
return this.players[this.session.nomination[0]];
|
return this.players[this.session.nomination[0]];
|
||||||
},
|
},
|
||||||
|
|
|
@ -24,6 +24,12 @@ const getters = {
|
||||||
);
|
);
|
||||||
return Math.min(nonTravelers.length, 15);
|
return Math.min(nonTravelers.length, 15);
|
||||||
},
|
},
|
||||||
|
aliveNonTravelers({ players }) {
|
||||||
|
const nonTravelers = players.filter(
|
||||||
|
player => !player.isDead && player.role.team !== "traveler"
|
||||||
|
);
|
||||||
|
return Math.min(nonTravelers.length, 15);
|
||||||
|
},
|
||||||
// calculate a Map of player => night order
|
// calculate a Map of player => night order
|
||||||
nightOrder({ players, fabled }) {
|
nightOrder({ players, fabled }) {
|
||||||
const firstNight = [0];
|
const firstNight = [0];
|
||||||
|
|
|
@ -84,7 +84,7 @@ const mutations = {
|
||||||
nominee: players[state.nomination[1]].name,
|
nominee: players[state.nomination[1]].name,
|
||||||
type: isExile ? "Exile" : "Execution",
|
type: isExile ? "Exile" : "Execution",
|
||||||
majority: Math.ceil(
|
majority: Math.ceil(
|
||||||
players.filter(player => !player.isDead || isExile).length / 2
|
players.filter(player => (!player.isDead && player.role.team !== "traveler") || isExile).length / 2
|
||||||
),
|
),
|
||||||
votes: players
|
votes: players
|
||||||
.filter((player, index) => state.votes[index])
|
.filter((player, index) => state.votes[index])
|
||||||
|
|
Loading…
Add table
Reference in a new issue