Cap collection destinations in the daily expedition draw and always give a Watchers' starter destination
The daily draw now proposes at most day.maxCollectionDestinations (default 2) destinations linked to a collection, unless the player lacks other destinations to fill the day. The starter destination card is now granted to any player without a Watchers' Logbooks destination, even if they already own collection destination cards from packs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
e3749d60b6
commit
3dcc0b6f12
9 changed files with 74 additions and 14 deletions
|
|
@ -121,6 +121,11 @@ test("players receive a starter destination card, then find more on expeditions
|
|||
assert.equal(service.getState(player.id).history.filter((entry) => entry.type === "destination_starter").length, 1);
|
||||
assert.ok(service.expeditions.unlockedDestinationIds(player.id).has("light-currents"));
|
||||
assert.equal(service.expeditions.unlockedDestinationIds(player.id).has("dawn-shore"), false);
|
||||
// Une carte de destination de paquet ne compte pas : un joueur qui n'a que celle du Cœur du Nuage reçoit aussi sa carte de départ.
|
||||
const packOnly = service.upsertPlayer({ discordId: "expedition-pack-only", displayName: "Pack only" });
|
||||
database.transaction(() => service.addCard(packOnly.id, "cosmic-cloud-heart-standard"));
|
||||
service.expeditions.getExpeditions(packOnly.id);
|
||||
assert.deepEqual(destinationCardsOf(service, packOnly.id).sort(), ["cosmic-cloud-heart-standard", "light-currents-standard"]);
|
||||
// Un groupe vers les Courants : le second joueur, sans leur carte, la gagne ; le créateur gagne une carte qu'il n'a pas.
|
||||
const view = service.expeditions.getExpeditions(player.id);
|
||||
const destination = view.destinations.find((item) => item.id === "light-currents");
|
||||
|
|
|
|||
|
|
@ -318,6 +318,40 @@ test("destination specialties raise one or two rewards and lower the others", ()
|
|||
assert.equal(drawCollectionCard({ ...mini, collections: [{ ...mini.collections[0], active: false }] }, "c", () => 0), null);
|
||||
});
|
||||
|
||||
// Destinations de collection : au plus `day.maxCollectionDestinations` par jour, sauf si le joueur n'a pas assez d'autres destinations.
|
||||
test("the daily draw caps destinations linked to a collection, unless nothing else can fill the day", () => {
|
||||
const linked = new Set(destinations.filter((destination) => destination.rewardCollectionId != null).map((destination) => destination.id));
|
||||
assert.deepEqual([...linked].sort(), ["cosmic-cloud-heart", "grand-astral-hall", "level-isles", "reunited-isles-feast"]);
|
||||
assert.equal(settings.day.maxCollectionDestinations, 2);
|
||||
const linkedIn = (draw) => draw.filter((entry) => linked.has(entry.destinationId)).length;
|
||||
const randoms = [() => 0, (max) => max - 1, (max) => Math.floor(max / 2)];
|
||||
// Les quatre destinations de collection et deux autres : deux de collection au plus, et toujours les deux autres.
|
||||
const six = new Set([...linked, "light-currents", "great-void"]);
|
||||
for (const random of randoms) {
|
||||
const draw = drawExpeditionDay(destinations, settings, [], random, six);
|
||||
assert.equal(draw.length, 4);
|
||||
assert.equal(linkedIn(draw), 2);
|
||||
assert.ok(draw.some((entry) => entry.destinationId === "light-currents") && draw.some((entry) => entry.destinationId === "great-void"));
|
||||
assert.deepEqual(draw.map((entry) => entry.level).sort(), [0, 1, 2, 3]);
|
||||
}
|
||||
// Le plafond passe avant le délai de retour : la destination d'hier revient plutôt qu'une troisième destination de collection.
|
||||
const again = drawExpeditionDay(destinations, settings, ["light-currents", "great-void"], () => 0, six);
|
||||
assert.equal(linkedIn(again), 2);
|
||||
// Une seule autre destination : le tirage reste complet avec trois destinations de collection.
|
||||
const five = new Set([...linked, "light-currents"]);
|
||||
for (const random of randoms) {
|
||||
const draw = drawExpeditionDay(destinations, settings, [], random, five);
|
||||
assert.equal(draw.length, 4);
|
||||
assert.equal(linkedIn(draw), 3);
|
||||
assert.ok(draw.some((entry) => entry.destinationId === "light-currents"));
|
||||
}
|
||||
assert.equal(drawExpeditionDay(destinations, settings, [], () => 0, linked).length, 4);
|
||||
// Avec toutes les destinations, à 0 aucune destination de collection.
|
||||
const none = { ...settings, day: { ...settings.day, maxCollectionDestinations: 0 } };
|
||||
for (const random of randoms) assert.equal(linkedIn(drawExpeditionDay(destinations, none, [], random)), 0);
|
||||
assert.match(validateExpeditionSettings({ ...settings, day: { ...settings.day, maxCollectionDestinations: -1 } }, destinationIds), /day\.maxCollectionDestinations/);
|
||||
});
|
||||
|
||||
// La difficulté se tire avec les destinations : un niveau de chaque, puis la suite recommence. Un niveau donne les mêmes étoiles,
|
||||
// qu'on parte seul ou en groupe.
|
||||
test("each daily destination draws a difficulty level, one of each", () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue