Prevent Great People duplication across discard piles
This commit is contained in:
parent
97d79a58f9
commit
529b2f2e73
18 changed files with 44 additions and 40 deletions
|
|
@ -125,6 +125,8 @@ fn incident(
|
|||
s.log(game, "Declined to gain the Action Card");
|
||||
return;
|
||||
}
|
||||
// This is the event card itself, not a second physical card.
|
||||
game.incidents_discarded.retain(|discarded| *discarded != id);
|
||||
game.player_mut(s.player_index).action_cards.push(card_id);
|
||||
log_card_transfer(
|
||||
game,
|
||||
|
|
|
|||
|
|
@ -737,7 +737,11 @@ pub(crate) fn draw_and_discard_incident_card_from_pile(
|
|||
player,
|
||||
"Events",
|
||||
|g| &mut g.incidents_left,
|
||||
|g| g.cache.get_incidents().iter().map(|i| i.id).collect_vec(),
|
||||
|g| {
|
||||
g.cache.get_incidents().iter()
|
||||
.filter(|i| !g.action_cards_discarded.contains(&(i.id + GREAT_PERSON_OFFSET)))
|
||||
.map(|i| i.id).collect_vec()
|
||||
},
|
||||
|p| {
|
||||
p.action_cards
|
||||
.iter()
|
||||
|
|
|
|||
|
|
@ -467,8 +467,5 @@
|
|||
],
|
||||
"action_cards_discarded": [
|
||||
155
|
||||
],
|
||||
"incidents_discarded": [
|
||||
55
|
||||
]
|
||||
}
|
||||
|
|
@ -391,8 +391,5 @@
|
|||
],
|
||||
"wonders_left": [
|
||||
"Pyramids"
|
||||
],
|
||||
"incidents_discarded": [
|
||||
19
|
||||
]
|
||||
}
|
||||
|
|
@ -414,8 +414,5 @@
|
|||
],
|
||||
"wonders_left": [
|
||||
"Pyramids"
|
||||
],
|
||||
"incidents_discarded": [
|
||||
19
|
||||
]
|
||||
}
|
||||
|
|
@ -494,8 +494,5 @@
|
|||
],
|
||||
"action_cards_discarded": [
|
||||
119
|
||||
],
|
||||
"incidents_discarded": [
|
||||
19
|
||||
]
|
||||
}
|
||||
|
|
@ -473,8 +473,5 @@
|
|||
],
|
||||
"action_cards_discarded": [
|
||||
156
|
||||
],
|
||||
"incidents_discarded": [
|
||||
56
|
||||
]
|
||||
}
|
||||
|
|
@ -599,8 +599,5 @@
|
|||
],
|
||||
"action_cards_discarded": [
|
||||
157
|
||||
],
|
||||
"incidents_discarded": [
|
||||
57
|
||||
]
|
||||
}
|
||||
|
|
@ -570,8 +570,5 @@
|
|||
],
|
||||
"action_cards_discarded": [
|
||||
126
|
||||
],
|
||||
"incidents_discarded": [
|
||||
26
|
||||
]
|
||||
}
|
||||
|
|
@ -880,8 +880,5 @@
|
|||
],
|
||||
"action_cards_discarded": [
|
||||
118
|
||||
],
|
||||
"incidents_discarded": [
|
||||
18
|
||||
]
|
||||
}
|
||||
|
|
@ -486,8 +486,5 @@
|
|||
],
|
||||
"action_cards_discarded": [
|
||||
125
|
||||
],
|
||||
"incidents_discarded": [
|
||||
25
|
||||
]
|
||||
}
|
||||
|
|
@ -570,8 +570,5 @@
|
|||
],
|
||||
"action_cards_discarded": [
|
||||
120
|
||||
],
|
||||
"incidents_discarded": [
|
||||
20
|
||||
]
|
||||
}
|
||||
|
|
@ -549,9 +549,6 @@
|
|||
23,
|
||||
24
|
||||
],
|
||||
"incidents_discarded": [
|
||||
58
|
||||
],
|
||||
"permanent_effects": [
|
||||
{
|
||||
"GreatSeer": {
|
||||
|
|
|
|||
|
|
@ -899,8 +899,5 @@
|
|||
],
|
||||
"action_cards_discarded": [
|
||||
124
|
||||
],
|
||||
"incidents_discarded": [
|
||||
24
|
||||
]
|
||||
}
|
||||
|
|
@ -395,3 +395,5 @@ Viewer 0.1.137 aligns recipient food counts beside the selection checkbox rather
|
|||
Viewer 0.1.140 adds the Market trade-income bonus and its per-opponent-turn limit to the compact building description in every supported language.
|
||||
|
||||
Viewer 0.1.141 adds arrows from sea spaces to every adjacent unexplored hex in the sea-route guide, alongside existing Navigation perimeter routes.
|
||||
|
||||
Viewer 0.1.142 / engine 0.4.99 removes claimed Great People from the Event discard and excludes Great People in the Action discard from Event reshuffles. Existing saved games are not migrated.
|
||||
|
|
|
|||
4
web-client/package-lock.json
generated
4
web-client/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.141",
|
||||
"version": "0.1.142",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.141",
|
||||
"version": "0.1.142",
|
||||
"dependencies": {
|
||||
"@boardgamers/protocol": "0.9.0",
|
||||
"lucide-svelte": "^0.577.0",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.141",
|
||||
"version": "0.1.142",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -117,3 +117,35 @@ test('Great Engineer explains the cost of constructing and the consequence of sk
|
|||
const accepted = move(game, decision.choices[0].action);
|
||||
assert.ok(accepted.permanent_effects.some((e: any) => e.Construct === 'GreatEngineer'));
|
||||
});
|
||||
|
||||
|
||||
test('claiming and playing a Great Person moves one card between zones', () => {
|
||||
let game = fixture('incidents/great_persons/great_engineer');
|
||||
game = move(game, { Playing: { Advance: { advance: 'Storage', payment: { food: 2 } } } });
|
||||
assert((game.incidents_discarded ?? []).includes(26));
|
||||
game = move(game, { Response: { Payment: [{ culture_tokens: 1 }] } });
|
||||
assert(!(game.incidents_discarded ?? []).includes(26), 'claimed event leaves the event discard');
|
||||
assert((game.players[0].action_cards ?? []).includes(126));
|
||||
game = move(game, { Playing: { ActionCard: 126 } });
|
||||
game = move(game, { Response: { SelectAdvance: 'Engineering' } });
|
||||
game = move(game, view(game).choiceDecision.choices[1].action);
|
||||
assert(!(game.players[0].action_cards ?? []).includes(126));
|
||||
assert(!(game.incidents_discarded ?? []).includes(26));
|
||||
assert.equal(game.action_cards_discarded.filter((id: number) => id === 126).length, 1);
|
||||
const reshuffle = structuredClone(game);
|
||||
reshuffle.players[0].incident_tokens = 1;
|
||||
reshuffle.incidents_left = [];
|
||||
const afterReshuffle = move(reshuffle, view(reshuffle).advances.find((a: any) => a.id === 'Math').action);
|
||||
assert(!afterReshuffle.incidents_left.includes(26), 'event reshuffle cannot duplicate the discarded action card');
|
||||
assert(!afterReshuffle.events.some((e: any) => e.event_type.Incident?.incident_id === 26));
|
||||
|
||||
game.players[0].cities[0].city_pieces ??= {};
|
||||
game.players[0].cities[0].city_pieces.wonders = ['GreatMausoleum'];
|
||||
game.players[0].incident_tokens = 3;
|
||||
game = move(game, view(game).advances.find((a: any) => a.id === 'Writing').action);
|
||||
assert.match(JSON.stringify(game.events), /Great Mausoleum/);
|
||||
game = move(game, { Response: { Bool: true } });
|
||||
assert((game.players[0].action_cards ?? []).includes(126), 'Mausoleum recovers the one discarded card');
|
||||
assert(!(game.action_cards_discarded ?? []).includes(126));
|
||||
assert(!(game.incidents_discarded ?? []).includes(26));
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue