Easy is a square 4 x 4 picture drawn for each player, with green outlines, where any two pieces swap; it is scored against the free minimum and pays 5 plus 1 per move left. The three mirrors open one after another (Easy, Normal, Hard) and the Guild quest is done with all three. Migration 31 rebuilds mirror_games to accept the new mode. The mirror page shows three illustrated cards, Easy painted with Codex. Bravery now places a misplaced piece for free, since swapping anywhere means nothing in Easy. Each of the five companions can help once per game instead of two in all. Mirror styles now win over the global button hover, so placed pieces keep their green outline. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
58 lines
4 KiB
JavaScript
58 lines
4 KiB
JavaScript
// Rôle : recense les quêtes que la Guilde des Veilleurs propose au joueur et celles qui l'attendent.
|
|
// Chaque quête (Carte du jour, Expéditions…) s'ajoute à cette liste avec sa tuile dans GuildPanel.
|
|
|
|
// Expéditions en attente : un butin à récupérer, un groupe que le joueur peut rejoindre, ou aucune expédition lancée aujourd'hui
|
|
// alors qu'il a de quoi partir. Au plus un rappel par jour, plus les retours et les groupes ; sans cartes jouables, aucun rappel.
|
|
export function expeditionsPending(summary, now = Date.now()) {
|
|
if (!summary) return false;
|
|
if (summary.returned > 0 || (summary.nextReturnAt != null && summary.nextReturnAt <= now)) return true;
|
|
if (summary.joinableGroups > 0) return true;
|
|
return summary.enabled && !summary.running && !summary.forming && !summary.launchedToday && summary.eligible >= 1;
|
|
}
|
|
|
|
// Une quête : identifiant (qui choisit sa tuile), état fourni par le serveur et `pending` tant qu'elle attend le joueur.
|
|
// Les Expéditions n'apparaissent que si elles sont ouvertes, ou tant qu'une expédition du joueur n'est pas terminée.
|
|
export function guildQuests(state, now = Date.now()) {
|
|
const quests = [];
|
|
if (state.daily) quests.push({ id: "daily", pending: state.daily.status === "playing" || Boolean(state.daily.rewardPending), summary: state.daily });
|
|
// L'Équipe du jour n'apparaît que si elle est ouverte, ou tant qu'un recrutement n'est pas terminé.
|
|
const team = state.team;
|
|
if (team && (team.enabled || team.status === "recruiting")) quests.push({ id: "team", pending: team.status !== "ready", summary: team });
|
|
// La Course attend une équipe et sa propre ouverture ; une course commencée se termine même si elle ferme.
|
|
if (team && ((team.raceEnabled && team.status === "ready") || team.race === "running")) quests.push({ id: "race", pending: team.race !== "finished", summary: team });
|
|
// Le Miroir brisé n'apparaît que s'il est ouvert, ou tant qu'une partie du jour n'est pas terminée.
|
|
const mirror = state.mirror;
|
|
if (mirror && (mirror.enabled || ["easy", "normal", "hard"].some((mode) => mirror[mode] === "playing"))) quests.push({ id: "mirror", pending: !mirrorDone(mirror), summary: mirror });
|
|
const expeditions = state.expeditions;
|
|
if (expeditions && (expeditions.enabled || expeditions.running || expeditions.returned || expeditions.forming)) quests.push({ id: "expeditions", pending: expeditionsPending(expeditions, now), summary: expeditions });
|
|
return quests;
|
|
}
|
|
|
|
export const pendingQuestCount = (state) => guildQuests(state).filter((quest) => quest.pending).length;
|
|
|
|
// Miroir brisé terminé : le Facile, le Normal puis le Difficile joués jusqu'au bout, gagnés ou non.
|
|
const finishedGame = (status) => status === "won" || status === "lost";
|
|
export const mirrorDone = (mirror) => ["easy", "normal", "hard"].every((mode) => finishedGame(mirror[mode]));
|
|
|
|
// Quête quotidienne terminée aujourd'hui.
|
|
export function questDone({ id, summary }) {
|
|
if (id === "daily") return summary.status !== "playing" && !summary.rewardPending;
|
|
if (id === "race") return summary.race === "finished";
|
|
if (id === "mirror") return mirrorDone(summary);
|
|
return false;
|
|
}
|
|
|
|
// Ce que dit la Guilde au comptoir : la prochaine chose à faire, dans l'ordre du tableau (seul d'abord, puis en équipe), puis le
|
|
// butin d'une expédition revenue.
|
|
export function guildGreeting(state, now = Date.now()) {
|
|
const { daily, team, mirror, expeditions } = state;
|
|
const teamOpen = Boolean(team?.enabled);
|
|
if (daily?.rewardPending) return "reward";
|
|
if (daily?.status === "playing") return teamOpen && team.status !== "ready" ? "dailyFirst" : "daily";
|
|
if (mirror?.enabled && !mirrorDone(mirror)) return "mirror";
|
|
if (teamOpen && team.status === "recruiting") return "recruiting";
|
|
if (teamOpen && team.status !== "ready") return "recruit";
|
|
if (teamOpen && team.raceEnabled && team.race !== "finished") return "race";
|
|
if (expeditions && (expeditions.returned > 0 || (expeditions.nextReturnAt != null && expeditions.nextReturnAt <= now))) return "loot";
|
|
return "done";
|
|
}
|