Updating night order print (#108)

This commit is contained in:
MRegnard 2024-02-05 00:46:59 +01:00 committed by GitHub
parent efde95a34a
commit 3f666ce5f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 155 additions and 31 deletions

View file

@ -1,7 +1,8 @@
# Release Notes
## Upcomming Version
Correcting automatic adding/deletion of Fabled
- Updating night order (and its print)
- Correcting automatic adding/deletion of Fabled
### Version 3.17.0

BIN
src/assets/icons/dawn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

BIN
src/assets/icons/dusk.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

View file

@ -36,6 +36,17 @@
}}</small
>
</span>
<span
class="player"
v-if="
(role.id == 'dawn' || role.team == 'fabled') &&
!session.isSpectator &&
players.length && players[0].role.id
"
>
<br />
<small> </small>
</span>
</span>
<span
class="icon"
@ -92,6 +103,19 @@
}}</small
>
</span>
<span
class="player"
v-if="
(role.id == 'dawn' ||
role.id == 'dusk' ||
role.team == 'fabled') &&
!session.isSpectator &&
players.length && players[0].role.id
"
>
<br />
<small> </small>
</span>
</span>
<span class="reminder" v-if="role.otherNightReminder">
{{ role.otherNightReminder }}
@ -113,13 +137,54 @@ export default {
computed: {
rolesFirstNight: function () {
const rolesFirstNight = [];
// Ajouter le matin à l'ordre nocturne
rolesFirstNight.push({
id: "dawn",
name: this.locale.modal.nightOrder.dawn,
firstNight: 60,
team: "default",
players: [],
firstNightReminder: this.locale.modal.nightOrder.dawnDescription1
});
var toymaker = false;
// Ajout des fabuleux
this.fabled.forEach(fabled => {
if (fabled.firstNight) {
rolesFirstNight.push(Object.assign({ players: [] }, fabled));
} else if (fabled.id == "toymaker") {
toymaker = true;
}
});
this.roles.forEach(role => {
const players = this.players.filter(p => p.role.id === role.id);
if (role.firstNight && role.team !== "traveler") {
rolesFirstNight.push(Object.assign({ players }, role));
}
});
// Ajout des Voyageurs, en n'ajoutant qu'une fois ceux en double
const seenTravelers = [];
var nbTravelers = 0;
this.players.forEach(player => {
if (player.role.team == "traveler") {
nbTravelers++;
if (!seenTravelers.includes(player.role.id)) {
seenTravelers.push(player.role.id);
if (player.role.firstNight) {
const players = this.players.filter(
p => p.role.id === player.role.id
);
rolesFirstNight.push(Object.assign({ players }, player.role));
}
}
}
});
// Ajouter minion / demon infos à l'ordre nocturne
if (this.players.length > 6) {
if (this.players.length - nbTravelers > 6 || toymaker) {
rolesFirstNight.push(
{
id: "evil",
id: "minion",
name: this.locale.modal.nightOrder.minionInfo,
firstNight: 5,
firstNight: 7,
team: "minion",
players: this.players.filter((p) => p.role.team === "minion"),
firstNightReminder:
@ -128,7 +193,7 @@ export default {
{
id: "evil",
name: this.locale.modal.nightOrder.demonInfo,
firstNight: 8,
firstNight: 10,
team: "demon",
players: this.players.filter((p) => p.role.team === "demon"),
firstNightReminder:
@ -136,38 +201,68 @@ export default {
},
);
}
this.roles.forEach((role) => {
const players = this.players.filter((p) => p.role.id === role.id);
if (role.firstNight && (role.team !== "traveler" || players.length)) {
rolesFirstNight.push(Object.assign({ players }, role));
}
});
this.fabled
.filter(({ firstNight }) => firstNight)
.forEach((fabled) => {
rolesFirstNight.push(Object.assign({ players: [] }, fabled));
});
rolesFirstNight.sort((a, b) => a.firstNight - b.firstNight);
return rolesFirstNight;
},
rolesOtherNight: function () {
const rolesOtherNight = [];
this.roles.forEach((role) => {
const players = this.players.filter((p) => p.role.id === role.id);
if (role.otherNight && (role.team !== "traveler" || players.length)) {
rolesOtherNight.push(Object.assign({ players }, role));
rolesOtherNight.push(
{
id: "dusk",
name: this.locale.modal.nightOrder.dusk,
team: "default",
otherNight: 1,
players: [],
otherNightReminder: this.locale.modal.nightOrder.duskDescription
},
{
id: "dawn",
name: this.locale.modal.nightOrder.dawn,
team: "default",
otherNight: Infinity,
players: [],
otherNightReminder: this.locale.modal.nightOrder.dawnDescription2
}
});
);
this.fabled
.filter(({ otherNight }) => otherNight)
.forEach((fabled) => {
rolesOtherNight.push(Object.assign({ players: [] }, fabled));
});
this.roles.forEach(role => {
const players = this.players.filter(p => p.role.id === role.id);
if (role.otherNight && role.team !== "traveler") {
rolesOtherNight.push(Object.assign({ players }, role));
}
});
// Ajout des Voyageurs, en n'ajoutant qu'une fois ceux en double
const seenTravelers = [];
this.players.forEach(player => {
if (
player.role.otherNight &&
player.role.team == "traveler" &&
!seenTravelers.includes(player.role.id)
) {
const players = this.players.filter(
p => p.role.id === player.role.id
);
seenTravelers.push(player.role.id);
rolesOtherNight.push(Object.assign({ players }, player.role));
}
});
rolesOtherNight.sort((a, b) => a.otherNight - b.otherNight);
return rolesOtherNight;
},
...mapState(["roles", "modals", "edition", "grimoire", "locale"]),
...mapState("players", ["players", "fabled"]),
...mapState([
"roles",
"modals",
"edition",
"grimoire",
"locale",
"session"
]),
...mapState("players", ["players", "fabled"])
},
methods: {
...mapMutations(["toggleModal"]),
@ -255,15 +350,32 @@ h4 {
}
}
}
.traveler {
.name {
background: linear-gradient(90deg, $traveler, transparent 35%);
.night .other & {
background: linear-gradient(-90deg, $traveler, transparent 35%);
}
}
}
.default {
.name {
background: linear-gradient(90deg, $default, transparent 35%);
.night .other & {
background: linear-gradient(-90deg, $default, transparent 35%);
}
}
}
ul {
li {
display: flex;
width: 100%;
margin-bottom: 3px;
.icon {
width: 6vh;
background-size: cover;
background-position: 0 0;
width: 5vh;
background-size: 100% auto;
background-position: center center;
background-repeat: no-repeat;
flex-grow: 0;
flex-shrink: 0;
text-align: center;
@ -277,7 +389,7 @@ ul {
.name {
flex-grow: 0;
flex-shrink: 0;
width: 15%;
width: 5%;
text-align: right;
font-size: 110%;
padding: 5px;

View file

@ -200,9 +200,14 @@
"firstNight": "First Night",
"otherNights": "Other Nights",
"minionInfo": "Minion info",
"minionInfoDescription": "If more than one Minion, they all make eye contact with each other. Show the “This is the Demon” card. Point to the Demon.",
"minionInfoDescription": "If more than one Minion, they all make eye contact with each other. Show the “This is the Demon” card. Point to the Demon.",
"demonInfo": "Demon info & bluffs",
"demonInfoDescription": "• Show the “These are your minions” card. Point to each Minion. • Show the “These characters are not in play” card. Show 3 character tokens of good characters not in play."
"demonInfoDescription": "Show the “These are your minions” card. Point to each Minion. Show the “These characters are not in play” card. Show 3 character tokens of good characters not in play.",
"dawn": "Dawn",
"dawnDescription1": "Wake all players.",
"dawnDescription2": "Wake all players, then announce who died this night.",
"dusk": "Dusk",
"duskDescription": "End the day, and put all players to sleep."
},
"reference": {
"title": "Character Reference",

View file

@ -200,9 +200,14 @@
"firstNight": "Première Nuit",
"otherNights": "Autres Nuits",
"minionInfo": "Informations Serviteurs",
"minionInfoDescription": "S'il y a plusieurs Serviteurs, ils apprennent qui sont les autres Serviteurs. Indiquez aux Serviteurs qui est le Démon.",
"minionInfoDescription": "S'il y a plusieurs Serviteurs, ils apprennent qui sont les autres Serviteurs. Indiquez aux Serviteurs qui est le Démon.",
"demonInfo": "Info & Bluffs Démon",
"demonInfoDescription": "• Indiquez au Démon qui sont ses serviteurs.• Indiquez les rôles de 3 personnages Bons qui ne sont pas en jeu."
"demonInfoDescription": "Indiquez au Démon qui sont ses serviteurs. Indiquez les rôles de 3 personnages bons qui ne sont pas en jeu.",
"dawn": "Matin",
"dawnDescription1": "Réveillez les joueurs.",
"dawnDescription2": "Réveillez les joueurs, puis annoncez qui est mort cette nuit",
"dusk": "Tombée de la nuit",
"duskDescription": "Terminez la journée, et endormez les joueurs."
},
"reference": {
"title": "Réference de rôles",

View file

@ -4,3 +4,4 @@ $outsider: #46d5ff;
$minion: #ff6900;
$demon: #ce0100;
$traveler: #cc04ff;
$default: #4E4E4E;