show reminders from roles selected as bluff/other

This commit is contained in:
Steffen 2020-12-07 21:53:20 +01:00
parent faf378dca3
commit dcabc505fe
1 changed files with 16 additions and 2 deletions

View File

@ -36,8 +36,9 @@ export default {
computed: {
availableReminders() {
let reminders = [];
const players = this.$store.state.players.players;
const { players, bluffs } = this.$store.state.players;
this.$store.state.roles.forEach(role => {
// add reminders from player roles
if (players.some(p => p.role.id === role.id)) {
reminders = [
...reminders,
@ -48,7 +49,19 @@ export default {
}))
];
}
if (role.remindersGlobal && role.remindersGlobal.length) {
// add reminders from bluff/other roles
else if (bluffs.some(bluff => bluff.id === role.id)) {
reminders = [
...reminders,
...role.reminders.map(name => ({
role: role.id,
image: role.image,
name
}))
];
}
// add global reminders
else if (role.remindersGlobal && role.remindersGlobal.length) {
reminders = [
...reminders,
...role.remindersGlobal.map(name => ({
@ -59,6 +72,7 @@ export default {
];
}
});
// add fabled reminders
this.$store.state.players.fabled.forEach(role => {
reminders = [
...reminders,