on block -> marked

This commit is contained in:
nicfreeman1209 2021-05-05 15:20:37 +01:00
parent 8dacfea0cb
commit 205bd0ba79
6 changed files with 27 additions and 27 deletions

View File

@ -330,7 +330,7 @@ export default {
toggleNight() {
this.$store.commit("toggleNight");
if (this.grimoire.isNight) {
this.$store.commit("players/setOnBlock", -1);
this.$store.commit("players/setMarked", -1);
}
},
...mapMutations([

View File

@ -101,7 +101,7 @@
<!-- On block icon -->
<font-awesome-icon
icon="skull"
v-if="player.isOnBlock"
v-if="player.isMarked"
class="on-block"
/>
@ -267,8 +267,8 @@ export default {
if (this.grimoire.isPublic) {
if (!this.player.isDead) {
this.updatePlayer("isDead", true);
if (this.player.isOnBlock) {
this.updatePlayer("isOnBlock", false);
if (this.player.isMarked) {
this.updatePlayer("isMarked", false);
}
} else if (this.player.isVoteless) {
this.updatePlayer("isVoteless", false);
@ -278,8 +278,8 @@ export default {
}
} else {
this.updatePlayer("isDead", !this.player.isDead);
if (this.player.isOnBlock) {
this.updatePlayer("isOnBlock", false);
if (this.player.isMarked) {
this.updatePlayer("isMarked", false);
}
if (this.player.isVoteless) {
this.updatePlayer("isVoteless", false);

View File

@ -203,10 +203,10 @@ export default {
this.nominate = -1;
},
toggleOnBlock(playerIndex) {
if (this.players[playerIndex].isOnBlock) {
this.$store.commit("players/setOnBlock", -1);
if (this.players[playerIndex].isMarked) {
this.$store.commit("players/setMarked", -1);
} else {
this.$store.commit("players/setOnBlock", playerIndex);
this.$store.commit("players/setMarked", playerIndex);
}
}
}

View File

@ -67,11 +67,11 @@
class="button-group"
v-if="session.lockedVote && !session.isVoteInProgress"
>
<div class="button demon" @click="setOnBlock">
Put on block
<div class="button demon" @click="setMarked">
Mark nominee
</div>
<div class="button demon" @click="emptyBlock">
Empty block
<div class="button demon" @click="removeMarked">
Clear mark
</div>
</div>
</template>
@ -249,12 +249,12 @@ export default {
this.$store.commit("session/setVotingSpeed", speed);
}
},
setOnBlock() {
this.$store.commit("players/setOnBlock", this.session.nomination[1]);
setMarked() {
this.$store.commit("players/setMarked", this.session.nomination[1]);
this.finish();
},
emptyBlock() {
this.$store.commit("players/setOnBlock", -1);
removeMarked() {
this.$store.commit("players/setMarked", -1);
this.finish();
}
}

View File

@ -5,7 +5,7 @@ const NEWPLAYER = {
reminders: [],
isVoteless: false,
isDead: false,
isOnBlock: false,
isMarked: false,
pronouns: ""
};
@ -137,12 +137,12 @@ const mutations = {
move(state, [from, to]) {
state.players.splice(to, 0, state.players.splice(from, 1)[0]);
},
setOnBlock(state, playerIndex) {
setMarked(state, playerIndex) {
state.players.forEach(player => {
player.isOnBlock = false;
player.isMarked = false;
});
if (playerIndex >= 0) {
state.players[playerIndex].isOnBlock = true;
state.players[playerIndex].isMarked = true;
}
},
setBluff(state, { index, role } = {}) {

View File

@ -170,7 +170,7 @@ class LiveSession {
break;
case "onBlock":
if (!this._isSpectator) return;
this._store.commit("players/setOnBlock", params);
this._store.commit("players/setMarked", params);
break;
case "isNight":
if (!this._isSpectator) return;
@ -255,7 +255,7 @@ class LiveSession {
id: player.id,
isDead: player.isDead,
isVoteless: player.isVoteless,
isOnBlock: player.isOnBlock,
isMarked: player.isMarked,
pronouns: player.pronouns,
...(player.role && player.role.team === "traveler"
? { roleId: player.role.id }
@ -317,7 +317,7 @@ class LiveSession {
const player = players[x];
const { roleId } = state;
// update relevant properties
["name", "id", "isDead", "isVoteless", "isOnBlock", "pronouns"].forEach(
["name", "id", "isDead", "isVoteless", "isMarked", "pronouns"].forEach(
property => {
const value = state[property];
if (player[property] !== value) {
@ -708,7 +708,7 @@ class LiveSession {
* Set which player is on the block. ST only
* @param id, player id or -1 for empty
*/
setOnBlock(playerIndex) {
setMarked(playerIndex) {
if (this._isSpectator) return;
this._send("onBlock", playerIndex);
}
@ -865,8 +865,8 @@ export default store => {
case "players/setFabled":
session.sendFabled();
break;
case "players/setOnBlock":
session.setOnBlock(payload);
case "players/setMarked":
session.setMarked(payload);
break;
case "players/swap":
session.swapPlayer(payload);