2020-08-09 19:28:38 +00:00
|
|
|
<template>
|
|
|
|
<Modal v-show="modals.fabled && fabled.length" @close="toggleModal('fabled')">
|
|
|
|
<h3>
|
|
|
|
Choose a fabled character to add to the game
|
|
|
|
</h3>
|
|
|
|
<ul class="tokens">
|
|
|
|
<li v-for="role in fabled" v-bind:key="role.id" @click="setFabled(role)">
|
|
|
|
<Token :role="role" />
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</Modal>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { mapMutations, mapState } from "vuex";
|
|
|
|
import Modal from "./Modal";
|
|
|
|
import Token from "../Token";
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: { Token, Modal },
|
|
|
|
computed: {
|
|
|
|
...mapState(["modals", "fabled", "grimoire"]),
|
|
|
|
fabled() {
|
|
|
|
const fabled = [];
|
|
|
|
this.$store.state.fabled.forEach(role => {
|
|
|
|
// don't show fabled that are already in play
|
|
|
|
if (
|
2020-11-29 21:17:02 +00:00
|
|
|
!this.$store.state.players.fabled.some(fable => fable.id === role.id)
|
2020-08-09 19:28:38 +00:00
|
|
|
) {
|
|
|
|
fabled.push(role);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return fabled;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
setFabled(role) {
|
2020-11-29 21:17:02 +00:00
|
|
|
this.$store.commit("players/setFabled", {
|
2020-08-09 19:28:38 +00:00
|
|
|
fabled: role
|
|
|
|
});
|
2020-08-09 20:02:02 +00:00
|
|
|
this.$store.commit("toggleModal", "fabled");
|
2020-08-09 19:28:38 +00:00
|
|
|
},
|
|
|
|
...mapMutations(["toggleModal"])
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
@import "../../vars.scss";
|
|
|
|
|
|
|
|
ul.tokens li {
|
|
|
|
border-radius: 50%;
|
2020-08-09 20:02:02 +00:00
|
|
|
width: 8vw;
|
|
|
|
margin: 0.5%;
|
2020-08-09 19:28:38 +00:00
|
|
|
transition: transform 500ms ease;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
transform: scale(1.2);
|
|
|
|
z-index: 10;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|