Fix great person effects, boarding movement and epic game length
This commit is contained in:
parent
92d68f83b2
commit
cf27e1a55a
38 changed files with 245 additions and 36 deletions
|
|
@ -432,6 +432,12 @@ pub(crate) fn can_play_civil_card(game: &Game, p: &Player, id: u8) -> Result<(),
|
|||
return Err("Action card not available".to_string());
|
||||
}
|
||||
|
||||
if id == crate::content::incidents::great_diplomat::DIPLOMAT_ID
|
||||
+ crate::content::incidents::great_persons::GREAT_PERSON_OFFSET
|
||||
&& game.context != crate::game::GameContext::Replay
|
||||
{
|
||||
return Err("Custom action cannot be played".into());
|
||||
}
|
||||
let civil_card = game.cache.get_civil_card(id);
|
||||
let mut satisfying_action: Option<usize> = None;
|
||||
if let Some(r) = &civil_card.combat_requirement {
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ pub fn get_all_uncached() -> Vec<Ability> {
|
|||
use_great_warlord(),
|
||||
construct_only(),
|
||||
use_diplomatic_relations(),
|
||||
crate::content::incidents::great_diplomat::end_diplomatic_relations_action(),
|
||||
// action card related
|
||||
collect_only(),
|
||||
use_cultural_takeover(),
|
||||
|
|
|
|||
|
|
@ -220,6 +220,7 @@ impl PlayingActionModifier {
|
|||
|
||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Copy, Hash, Debug)]
|
||||
pub enum CustomActionType {
|
||||
EndDiplomaticRelations,
|
||||
// Advances
|
||||
AbsolutePower,
|
||||
ForcedLabor,
|
||||
|
|
|
|||
|
|
@ -155,3 +155,27 @@ pub(crate) fn diplomatic_relations_partner(game: &Game, p: usize) -> Option<usiz
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// Discarding an already active treaty is not playing an Action card.
|
||||
pub(crate) fn end_diplomatic_relations_action() -> Ability {
|
||||
Ability::builder("End diplomatic relations", "Discard Great Diplomat and end its agreement. Costs 1 action.")
|
||||
.add_custom_action(
|
||||
crate::content::custom_actions::CustomActionType::EndDiplomaticRelations,
|
||||
|c| c.any_times().action().no_resources(),
|
||||
|b| b.add_simple_persistent_event_listener(
|
||||
|e| &mut e.custom_action, 0, |game, p, _| {
|
||||
remove_element_by(&mut game.permanent_effects, |e| {
|
||||
matches!(e, PermanentEffect::DiplomaticRelations(r) if r.active_player == p.index)
|
||||
});
|
||||
let card = DIPLOMAT_ID + GREAT_PERSON_OFFSET;
|
||||
if p.get(game).action_cards.contains(&card) {
|
||||
discard_action_card(game, p.index, card, &p.origin, HandCardLocation::DiscardPile);
|
||||
}
|
||||
p.log(game, "Ended diplomatic relations.");
|
||||
},
|
||||
),
|
||||
|game, p| game.permanent_effects.iter().any(|e| {
|
||||
matches!(e, PermanentEffect::DiplomaticRelations(r) if r.active_player == p.index)
|
||||
}),
|
||||
).build()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ impl GameLength {
|
|||
pub fn ages(&self) -> u32 {
|
||||
match self {
|
||||
Self::Standard => crate::consts::AGES,
|
||||
Self::Epic => 10,
|
||||
Self::Epic => 8,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -789,6 +789,20 @@ pub fn is_active(
|
|||
role: IncidentTarget,
|
||||
player: usize,
|
||||
) -> bool {
|
||||
// Claiming a Great Person ends the card offer, not the icon's effects on
|
||||
// later players. A sacrificed/replaced event still cancels its icon too.
|
||||
let mut base_info;
|
||||
let i = if priority >= BASE_EFFECT_PRIORITY
|
||||
&& i.consumed
|
||||
&& i.selected_player.is_some()
|
||||
&& !i.replaced_by_sacrifice
|
||||
{
|
||||
base_info = i.clone();
|
||||
base_info.consumed = false;
|
||||
&base_info
|
||||
} else {
|
||||
i
|
||||
};
|
||||
if !i.is_active_ignoring_protection(role, player) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -687,6 +687,12 @@ fn move_route_result(
|
|||
|
||||
is_valid_movement_type(game, units, carrier_position, dest)?;
|
||||
|
||||
// Embarking is still a land unit's move, even when several ships share
|
||||
// one group allocation. Only a continuing fleet may move the same units.
|
||||
if embark_carrier_id.is_some() && unit_ids.iter().any(|id| moved_units.contains(id)) {
|
||||
return Err("some units already moved".to_string());
|
||||
}
|
||||
|
||||
if matches!(current_move, CurrentMove::None)
|
||||
|| *current_move != get_current_move(game, unit_ids, start, dest, embark_carrier_id)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -120,8 +120,18 @@ pub fn replay(data: ReplayGameData, to: Option<usize>) -> Result<Game, String> {
|
|||
if item.action == Action::StartTurn {
|
||||
continue;
|
||||
}
|
||||
// Older saves recorded ending Great Diplomat as a card play, including
|
||||
// Subterfuge responses. Preserve those historical declarations only.
|
||||
let context = game.context.clone();
|
||||
if matches!(item.action, Action::Playing(crate::playing_actions::PlayingAction::ActionCard(id))
|
||||
if id == crate::content::incidents::great_diplomat::DIPLOMAT_ID
|
||||
+ crate::content::incidents::great_persons::GREAT_PERSON_OFFSET)
|
||||
{
|
||||
game.context = crate::game::GameContext::Replay;
|
||||
}
|
||||
game = try_execute_action(game, item.action.clone(), item.player)
|
||||
.map_err(|e| format!("Failed to replay move {}: {e}", i + 1))?;
|
||||
game.context = context;
|
||||
}
|
||||
if log_length(&game) != to {
|
||||
return Err(format!(
|
||||
|
|
|
|||
|
|
@ -353,7 +353,7 @@ pub fn movement(game: &Game, seat: usize, units: Vec<u32>) -> Result<Value, Stri
|
|||
}
|
||||
|
||||
pub fn cards(game: &Game, seat: usize, can_play: bool) -> Vec<Value> {
|
||||
game.player(seat).action_cards.iter().filter(|id|**id!=0).map(|id| {
|
||||
game.player(seat).action_cards.iter().filter(|id|**id!=0 && **id != crate::content::incidents::great_diplomat::DIPLOMAT_ID + crate::content::incidents::great_persons::GREAT_PERSON_OFFSET).map(|id| {
|
||||
let c = game.cache.get_action_card(*id);
|
||||
let reason = action_reason(game,seat,can_play,PlayingActionType::ActionCard(*id));
|
||||
json!({"id":id,"name":c.civil_card.name,"description":c.civil_card.description,"free":PlayingActionType::ActionCard(*id).cost(game,seat).free,
|
||||
|
|
@ -367,6 +367,12 @@ pub fn cards(game: &Game, seat: usize, can_play: bool) -> Vec<Value> {
|
|||
pub fn special(game: &Game, seat: usize, can_play: bool) -> Vec<Value> {
|
||||
use crate::content::custom_actions::{CustomAction, SpecialActionExecution};
|
||||
game.player(seat).special_actions.values().flat_map(|info| {
|
||||
if info.action == crate::content::custom_actions::SpecialAction::Custom(
|
||||
crate::content::custom_actions::CustomActionType::EndDiplomaticRelations
|
||||
) && !game.permanent_effects.iter().any(|effect| matches!(effect,
|
||||
crate::content::effects::PermanentEffect::DiplomaticRelations(r) if r.active_player == seat)) {
|
||||
return vec![];
|
||||
}
|
||||
let SpecialActionExecution::Action(execution) = &info.execution else { return vec![]; };
|
||||
let mut reason = if seat != game.active_player() {
|
||||
Some("Wait for your turn".to_string())
|
||||
|
|
|
|||
|
|
@ -124,9 +124,9 @@ fn test_keep_government() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn epic_continues_after_six_ages_and_ends_after_ten() {
|
||||
fn epic_continues_after_six_ages_and_ends_after_eight() {
|
||||
use server::game::{GameLength, GameState};
|
||||
for (age, finished) in [(6, false), (9, false), (10, true)] {
|
||||
for (age, finished) in [(6, false), (7, false), (8, true), (9, true)] {
|
||||
let mut game = JSON.load_game("end_game");
|
||||
game.options.length = GameLength::Epic;
|
||||
game.age = age;
|
||||
|
|
@ -163,7 +163,7 @@ fn length_defaults_to_standard_and_survives_save_load() {
|
|||
let cache = server::cache::Cache::new(&data.options);
|
||||
let restored = server::game::Game::from_data(data, cache, server::game::GameContext::Play);
|
||||
assert!(restored.options.length == GameLength::Epic);
|
||||
assert_eq!(restored.options.length.ages(), 10);
|
||||
assert_eq!(restored.options.length.ages(), 8);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ The protocol dependency is AGPL-3.0-only. The engine retains its existing licens
|
|||
|
||||
Viewer releases: see [uploading the complete viewer build](docs/viewer-publishing.md).
|
||||
|
||||
Game length defaults to six ages. Epic games use ten ages; existing saves without a length option retain six. The viewer age track follows the saved option. Publish an engine that supports the length option alongside the setup metadata.
|
||||
Game length defaults to six ages. Epic games use eight ages; existing saves without a length option retain six. The viewer age track follows the saved option. Publish an engine that supports the length option alongside the setup metadata.
|
||||
|
||||
The opt-in `skipRazeCity` player setting is saved in the game by the engine. End-of-age processing keeps that player's cities automatically, including when another player advances the game while they are offline. Analysis branches clear automation settings. The viewer migrates an existing enabled account preference the first time the player opens each game after upgrading (an explicit per-game opt-out takes priority). The decision checkbox saves the setting and explicitly answers the current choice after acknowledgement; loading saved preferences or settings never submits a move.
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,6 @@
|
|||
"default": "Standard",
|
||||
"items": [
|
||||
{ "name": "Standard", "label": "Standard — 6 ages" },
|
||||
{ "name": "Epic", "label": "Epic — 10 ages" }
|
||||
{ "name": "Epic", "label": "Epic — 8 ages" }
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -487,3 +487,13 @@ Acamapichtli's Tributes only enables collection when he occupies an owned city
|
|||
of size 3 or less that can still activate. At zero actions, being outside a city
|
||||
no longer enables the Collect button. Verified eligible, oversized and exhausted
|
||||
cities, normal paid collection, all 856 tests, locales, type checking and build.
|
||||
|
||||
### 0.1.166 / engine 0.4.113 — Diplomacy, boarding, pirate raids and Epic length
|
||||
|
||||
Great Diplomat leaves the playable hand and has a separate regular action to end
|
||||
its treaty, without Subterfuge or Shogunate. Historical card declarations remain
|
||||
replayable. Boarding across several ships cannot move a land unit twice in one
|
||||
Move action. Claiming a Great Person no longer skips pirate raids on later players.
|
||||
Epic now ends after 8 ages; setup labels, the age track and final-turn warnings agree.
|
||||
Verified regression tests, reported-game local reproductions, locale validation,
|
||||
Svelte checking, status-phase tests and the production build. No live saves edited.
|
||||
|
|
|
|||
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.165",
|
||||
"version": "0.1.166",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.165",
|
||||
"version": "0.1.166",
|
||||
"dependencies": {
|
||||
"@boardgamers/protocol": "0.9.0",
|
||||
"lucide-svelte": "^0.577.0",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.165",
|
||||
"version": "0.1.166",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -11,12 +11,9 @@ test('held Elder Statesman shows its playable effect and ordinary cards retain a
|
|||
const elder = cards.find((card: { name: string }) => card.name === 'Elder Statesman');
|
||||
assert.ok(elder);
|
||||
const diplomat = cards.find((card: { name: string }) => card.name === 'Great Diplomat');
|
||||
assert.ok(diplomat);
|
||||
assert.equal(handCardDescription(diplomat.description),
|
||||
'Choose another player. You cannot attack each other, unless you pay 2 culture tokens. Discard this card if either player attacks the other. You may discard the card as a regular action.');
|
||||
assert.equal(diplomat, undefined, 'the public treaty is not a playable hand card');
|
||||
for (const card of cards) {
|
||||
const [prefix, effect] = card.description.split('Action card: ');
|
||||
if (card === diplomat) continue;
|
||||
if (!effect) {
|
||||
assert.equal(handCardDescription(card.description), card.description);
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -69,3 +69,60 @@ test('attacking barbarians preserves diplomatic relations with another player an
|
|||
assert.ok(after.players[1].action_cards.includes(157));
|
||||
assert.ok(!after.action_cards_discarded?.includes(157));
|
||||
});
|
||||
|
||||
for (const missingCard of [false, true]) test(`ending diplomacy is a regular action, immune to Subterfuge (legacy missing card ${missingCard})`, () => {
|
||||
const game = fixture();
|
||||
game.state = 'Playing';
|
||||
game.actions_left = 2;
|
||||
game.players[1].civilization = 'Japan';
|
||||
game.players[1].advances.push('Tactics');
|
||||
game.players[1].action_cards = [13];
|
||||
if (missingCard) {
|
||||
game.players[0].action_cards = [];
|
||||
game.action_cards_discarded = [157];
|
||||
}
|
||||
const view = JSON.parse(engine.webView(engine.stripSecret(JSON.stringify(game), 0), 0));
|
||||
assert.ok(!view.actionCards.some((c: any) => c.id === 157));
|
||||
assert.ok(view.specialActions.some((a: any) => a.name === 'End diplomatic relations' && !a.free));
|
||||
assert.throws(() => move(game, { Playing: { ActionCard: 157 } }));
|
||||
const after = move(game, { Playing: { Custom: { action: 'EndDiplomaticRelations' } } });
|
||||
assert.equal(after.actions_left, 1);
|
||||
assert.ok(!after.events?.length);
|
||||
assert.ok(!after.permanent_effects?.some((e: any) => e.DiplomaticRelations));
|
||||
assert.deepEqual(after.players[1].action_cards, [13]);
|
||||
assert.ok(!after.players[0].action_cards?.includes(157));
|
||||
assert.equal(after.action_cards_discarded.filter((id: number) => id === 157).length, 1);
|
||||
game.actions_left = 0;
|
||||
game.players[0].civilization = 'Japan';
|
||||
game.players[0].advances.push('Voting');
|
||||
assert.throws(() => move(game, { Playing: { Custom: { action: 'EndDiplomaticRelations' } } }));
|
||||
});
|
||||
|
||||
test('only the treaty owner can end diplomatic relations', () => {
|
||||
const game = fixture(1);
|
||||
game.state = 'Playing';
|
||||
assert.throws(() => move(game, { Playing: { Custom: { action: 'EndDiplomaticRelations' } } }));
|
||||
});
|
||||
|
||||
for (const warlord of [false, true]) test(`boarding another ship cannot move a land unit twice (Great Warlord ${warlord})`, () => {
|
||||
const game = JSON.parse(readFileSync(new URL('../../server/tests/test_games/movement/ship_embark.json', import.meta.url), 'utf8'));
|
||||
game.players.push(...structuredClone(npcs));
|
||||
game.players[0].civilization = 'Japan';
|
||||
game.players[0].advances.push('Tactics');
|
||||
game.players[0].units = [
|
||||
{ id: 0, unit_type: { Leader: 'GoToba' }, position: 'B3' },
|
||||
{ id: 1, unit_type: 'Infantry', position: 'B3' },
|
||||
{ id: 2, unit_type: 'Infantry', position: 'B3' },
|
||||
{ id: 3, unit_type: 'Settler', position: 'B3' },
|
||||
{ id: 7, unit_type: 'Ship', position: 'C3' },
|
||||
{ id: 8, unit_type: 'Ship', position: 'C3' },
|
||||
];
|
||||
game.state = { Movement: { movement_actions_left: 2, moved_units: [0], great_warlord_used: warlord } };
|
||||
const embark = (units: number[], carrier: number) => ({ Movement: { Move: { units, destination: 'C3', embark_carrier_id: carrier } } });
|
||||
const after = move(game, embark([1, 2], 7));
|
||||
assert.throws(() => move(after, embark([0], 8)));
|
||||
const offers = JSON.parse(engine.webQuery(engine.stripSecret(JSON.stringify(after), 0), 0, JSON.stringify({kind:'movement',units:[0]}))).destinations;
|
||||
assert.equal(offers.length, 0);
|
||||
const valid = move(after, embark([3], 8));
|
||||
assert.equal(valid.state.Movement.movement_actions_left, 1, 'fresh passengers share the same group move');
|
||||
});
|
||||
|
|
|
|||
|
|
@ -105,8 +105,12 @@ test('Great Seer explains the pirate raid and exposes the later card price befor
|
|||
if (!decision) break;
|
||||
const context = decision.eventContext!;
|
||||
assert.equal(context.name, 'Great Seer');
|
||||
assert.deepEqual(context.card!.cost, { culture_tokens: seat === 0 ? 1 : 2 });
|
||||
assert.match(context.card!.description, /Draw 1 objective card per player/);
|
||||
if (!sawPurchase) {
|
||||
assert.deepEqual(context.card!.cost, { culture_tokens: seat === 0 ? 1 : 2 });
|
||||
assert.match(context.card!.description, /Draw 1 objective card per player/);
|
||||
} else {
|
||||
assert.equal(context.card, null, 'claimed cards are not offered to later raid victims');
|
||||
}
|
||||
if (decision.options.length) {
|
||||
placements++;
|
||||
assert.equal(decision.name, 'Place pirates');
|
||||
|
|
@ -116,7 +120,7 @@ test('Great Seer explains the pirate raid and exposes the later card price befor
|
|||
assert.match(context.placement!, /Place 2 pirate ships/);
|
||||
} else if (decision.fields.some((f) => f.name.includes('bribe'))) {
|
||||
sawBribe = true;
|
||||
assert.ok(context.card!.later);
|
||||
if (!sawPurchase) assert.ok(context.card!.later);
|
||||
assert.equal(decision.name, 'Pirate raid');
|
||||
assert.match(decision.description, /Pay 1 resource or token total/);
|
||||
assert.equal(context.raid, null);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import type { Game } from './types.ts';
|
||||
|
||||
export function ageCount(game: Game | null) {
|
||||
return game?.options?.length === 'Epic' ? 10 : 6;
|
||||
return game?.options?.length === 'Epic' ? 8 : 6;
|
||||
}
|
||||
export function ageLabel(age: number) {
|
||||
return ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X'][age - 1] ?? String(age);
|
||||
|
|
|
|||
|
|
@ -4754,5 +4754,7 @@
|
|||
"action cards": "handlingskort",
|
||||
"Click the destination again to explore the highlighted region.": "Klik på destinationen igen for at udforske det fremhævede område.",
|
||||
"No collection or Trade Routes on this sea tile.": "Ingen indsamling eller handelsruter på dette havfelt.",
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "Bevæger sig mod den valgte spillers byer. Kan ingen hær flytte, kan en by opstå i stedet."
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "Bevæger sig mod den valgte spillers byer. Kan ingen hær flytte, kan en by opstå i stedet.",
|
||||
"End diplomatic relations": "Afslut diplomatiske forbindelser",
|
||||
"Discard Great Diplomat and end its agreement. Costs 1 action.": "Kassér Den store diplomat og afslut aftalen. Koster 1 handling."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4754,5 +4754,7 @@
|
|||
"action cards": "Aktionskarten",
|
||||
"Click the destination again to explore the highlighted region.": "Klicke erneut auf das Ziel, um die hervorgehobene Region zu erkunden.",
|
||||
"No collection or Trade Routes on this sea tile.": "Auf diesem Seefeld sind weder Sammeln noch Handelsrouten möglich.",
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "Bewegt sich auf die Städte des gewählten Spielers zu. Kann keine Armee ziehen, kann stattdessen eine Stadt entstehen."
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "Bewegt sich auf die Städte des gewählten Spielers zu. Kann keine Armee ziehen, kann stattdessen eine Stadt entstehen.",
|
||||
"End diplomatic relations": "Diplomatische Beziehungen beenden",
|
||||
"Discard Great Diplomat and end its agreement. Costs 1 action.": "Lege den Großen Diplomaten ab und beende das Abkommen. Kostet 1 Aktion."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4754,5 +4754,7 @@
|
|||
"action cards": "κάρτες ενέργειας",
|
||||
"Click the destination again to explore the highlighted region.": "Κάντε ξανά κλικ στον προορισμό για να εξερευνήσετε την επισημασμένη περιοχή.",
|
||||
"No collection or Trade Routes on this sea tile.": "Δεν επιτρέπεται η συλλογή πόρων ή η χρήση Εμπορικών Οδών σε αυτή τη θαλάσσια θέση.",
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "Κινούνται προς τις πόλεις του επιλεγμένου παίκτη. Αν κανένας στρατός δεν μπορεί να κινηθεί, μπορεί να εμφανιστεί μια πόλη."
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "Κινούνται προς τις πόλεις του επιλεγμένου παίκτη. Αν κανένας στρατός δεν μπορεί να κινηθεί, μπορεί να εμφανιστεί μια πόλη.",
|
||||
"End diplomatic relations": "Τερματισμός διπλωματικών σχέσεων",
|
||||
"Discard Great Diplomat and end its agreement. Costs 1 action.": "Απόρριψε τον Μεγάλο Διπλωμάτη και τερμάτισε τη συμφωνία. Κόστος: 1 ενέργεια."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4754,5 +4754,7 @@
|
|||
"action cards": "action cards",
|
||||
"Click the destination again to explore the highlighted region.": "Click the destination again to explore the highlighted region.",
|
||||
"No collection or Trade Routes on this sea tile.": "No collection or Trade Routes on this sea tile.",
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "Moves toward the selected player's cities. If no army can move, a city may spawn instead."
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "Moves toward the selected player's cities. If no army can move, a city may spawn instead.",
|
||||
"End diplomatic relations": "End diplomatic relations",
|
||||
"Discard Great Diplomat and end its agreement. Costs 1 action.": "Discard Great Diplomat and end its agreement. Costs 1 action."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4754,5 +4754,7 @@
|
|||
"action cards": "کارتهای اقدام",
|
||||
"Click the destination again to explore the highlighted region.": "برای کاوش منطقهٔ مشخصشده، دوباره روی مقصد کلیک کنید.",
|
||||
"No collection or Trade Routes on this sea tile.": "در این خانهٔ دریایی نمیتوان منابع جمعآوری کرد یا از مسیرهای تجاری استفاده کرد.",
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "بهسوی شهرهای بازیکن انتخابشده حرکت میکنند. اگر هیچ ارتشی نتواند حرکت کند، ممکن است بهجای آن شهری ظاهر شود."
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "بهسوی شهرهای بازیکن انتخابشده حرکت میکنند. اگر هیچ ارتشی نتواند حرکت کند، ممکن است بهجای آن شهری ظاهر شود.",
|
||||
"End diplomatic relations": "پایان روابط دیپلماتیک",
|
||||
"Discard Great Diplomat and end its agreement. Costs 1 action.": "دیپلمات بزرگ را دور بیندازید و توافق را پایان دهید. هزینه: ۱ اقدام."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4754,5 +4754,7 @@
|
|||
"action cards": "cartes Action",
|
||||
"Click the destination again to explore the highlighted region.": "Cliquez à nouveau sur la destination pour explorer la région en surbrillance.",
|
||||
"No collection or Trade Routes on this sea tile.": "Aucune collecte ni route commerciale sur cette case de mer.",
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "Avance vers les villes du joueur choisi. Si aucune armée ne peut bouger, une ville peut apparaître à la place."
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "Avance vers les villes du joueur choisi. Si aucune armée ne peut bouger, une ville peut apparaître à la place.",
|
||||
"End diplomatic relations": "Rompre les relations diplomatiques",
|
||||
"Discard Great Diplomat and end its agreement. Costs 1 action.": "Défaussez Grand Diplomate pour mettre fin à son accord. Coûte 1 action."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4754,5 +4754,7 @@
|
|||
"action cards": "ऐक्शन कार्ड",
|
||||
"Click the destination again to explore the highlighted region.": "हाइलाइट किए गए क्षेत्र की खोज करने के लिए गंतव्य पर फिर से क्लिक करें।",
|
||||
"No collection or Trade Routes on this sea tile.": "इस समुद्री खाने पर संसाधन एकत्र नहीं कर सकते और व्यापार मार्गों का उपयोग नहीं कर सकते।",
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "चुने हुए खिलाड़ी के शहरों की ओर बढ़ते हैं। यदि कोई सेना नहीं चल सकती, तो उसकी जगह एक शहर आ सकता है।"
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "चुने हुए खिलाड़ी के शहरों की ओर बढ़ते हैं। यदि कोई सेना नहीं चल सकती, तो उसकी जगह एक शहर आ सकता है।",
|
||||
"End diplomatic relations": "राजनयिक संबंध समाप्त करें",
|
||||
"Discard Great Diplomat and end its agreement. Costs 1 action.": "महान राजनयिक को त्यागकर समझौता समाप्त करें। लागत: 1 कार्रवाई।"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4754,5 +4754,7 @@
|
|||
"action cards": "carte Azione",
|
||||
"Click the destination again to explore the highlighted region.": "Fai di nuovo clic sulla destinazione per esplorare la regione evidenziata.",
|
||||
"No collection or Trade Routes on this sea tile.": "Non puoi raccogliere risorse né usare Rotte Commerciali in questo spazio di mare.",
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "Si muovono verso le città del giocatore scelto. Se nessun esercito può muoversi, può comparire una città."
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "Si muovono verso le città del giocatore scelto. Se nessun esercito può muoversi, può comparire una città.",
|
||||
"End diplomatic relations": "Termina le relazioni diplomatiche",
|
||||
"Discard Great Diplomat and end its agreement. Costs 1 action.": "Scarta il Grande Diplomatico e termina l’accordo. Costa 1 azione."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4754,5 +4754,7 @@
|
|||
"action cards": "행동 카드",
|
||||
"Click the destination again to explore the highlighted region.": "강조된 지역을 탐험하려면 목적지를 다시 클릭하세요.",
|
||||
"No collection or Trade Routes on this sea tile.": "이 바다 칸에서는 자원을 수집하거나 교역로를 이용할 수 없습니다.",
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "선택한 플레이어의 도시를 향해 이동합니다. 이동할 수 있는 군대가 없으면 대신 도시가 생길 수 있습니다."
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "선택한 플레이어의 도시를 향해 이동합니다. 이동할 수 있는 군대가 없으면 대신 도시가 생길 수 있습니다.",
|
||||
"End diplomatic relations": "외교 관계 종료",
|
||||
"Discard Great Diplomat and end its agreement. Costs 1 action.": "위대한 외교관을 버리고 협정을 종료합니다. 행동 1회를 소모합니다."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4754,5 +4754,7 @@
|
|||
"action cards": "actiekaarten",
|
||||
"Click the destination again to explore the highlighted region.": "Klik nogmaals op de bestemming om het gemarkeerde gebied te verkennen.",
|
||||
"No collection or Trade Routes on this sea tile.": "Op dit zeeveld kun je geen grondstoffen verzamelen of handelsroutes gebruiken.",
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "Bewegen naar de steden van de gekozen speler. Kan geen leger bewegen, dan kan er in plaats daarvan een stad verschijnen."
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "Bewegen naar de steden van de gekozen speler. Kan geen leger bewegen, dan kan er in plaats daarvan een stad verschijnen.",
|
||||
"End diplomatic relations": "Diplomatieke betrekkingen beëindigen",
|
||||
"Discard Great Diplomat and end its agreement. Costs 1 action.": "Leg de Grote Diplomaat af en beëindig de overeenkomst. Kost 1 actie."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4754,5 +4754,7 @@
|
|||
"action cards": "karty akcji",
|
||||
"Click the destination again to explore the highlighted region.": "Kliknij ponownie miejsce docelowe, aby zbadać podświetlony region.",
|
||||
"No collection or Trade Routes on this sea tile.": "Na tym polu morskim nie można zbierać zasobów ani korzystać ze szlaków handlowych.",
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "Ruch w stronę miast wybranego gracza. Jeśli żadna armia nie może się ruszyć, zamiast tego może powstać miasto."
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "Ruch w stronę miast wybranego gracza. Jeśli żadna armia nie może się ruszyć, zamiast tego może powstać miasto.",
|
||||
"End diplomatic relations": "Zakończ stosunki dyplomatyczne",
|
||||
"Discard Great Diplomat and end its agreement. Costs 1 action.": "Odrzuć Wielkiego Dyplomatę i zakończ porozumienie. Koszt: 1 akcja."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4754,5 +4754,7 @@
|
|||
"action cards": "cartas de ação",
|
||||
"Click the destination again to explore the highlighted region.": "Clique novamente no destino para explorar a região destacada.",
|
||||
"No collection or Trade Routes on this sea tile.": "Não é possível coletar recursos nem usar Rotas Comerciais neste espaço de mar.",
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "Move em direção às cidades do jogador selecionado. Se nenhum exército puder mover, uma cidade poderá surgir."
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "Move em direção às cidades do jogador selecionado. Se nenhum exército puder mover, uma cidade poderá surgir.",
|
||||
"End diplomatic relations": "Encerrar relações diplomáticas",
|
||||
"Discard Great Diplomat and end its agreement. Costs 1 action.": "Descarte o Grande Diplomata e encerre o acordo. Custa 1 ação."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4754,5 +4754,7 @@
|
|||
"action cards": "cărți de acțiune",
|
||||
"Click the destination again to explore the highlighted region.": "Apasă din nou pe destinație pentru a explora regiunea evidențiată.",
|
||||
"No collection or Trade Routes on this sea tile.": "Nu poți colecta resurse sau folosi Rute Comerciale pe acest spațiu de mare.",
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "Se deplasează spre orașele jucătorului selectat. Dacă nicio armată nu se poate mișca, poate apărea un oraș."
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "Se deplasează spre orașele jucătorului selectat. Dacă nicio armată nu se poate mișca, poate apărea un oraș.",
|
||||
"End diplomatic relations": "Încheie relațiile diplomatice",
|
||||
"Discard Great Diplomat and end its agreement. Costs 1 action.": "Decartează Marele Diplomat și încheie acordul. Costă 1 acțiune."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4754,5 +4754,7 @@
|
|||
"action cards": "карты действий",
|
||||
"Click the destination again to explore the highlighted region.": "Нажмите на место назначения ещё раз, чтобы исследовать выделенную область.",
|
||||
"No collection or Trade Routes on this sea tile.": "На этой морской клетке нельзя собирать ресурсы или использовать торговые пути.",
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "Движутся к городам выбранного игрока. Если ни одна армия не может двигаться, вместо этого может появиться город."
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "Движутся к городам выбранного игрока. Если ни одна армия не может двигаться, вместо этого может появиться город.",
|
||||
"End diplomatic relations": "Прекратить дипломатические отношения",
|
||||
"Discard Great Diplomat and end its agreement. Costs 1 action.": "Сбросьте Великого дипломата и прекратите соглашение. Стоимость: 1 действие."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4754,5 +4754,7 @@
|
|||
"action cards": "thẻ hành động",
|
||||
"Click the destination again to explore the highlighted region.": "Nhấp lại vào điểm đến để khám phá vùng được tô sáng.",
|
||||
"No collection or Trade Routes on this sea tile.": "Không thể thu thập tài nguyên hoặc sử dụng Tuyến Thương Mại trên ô biển này.",
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "Di chuyển về các thành phố của người chơi đã chọn. Nếu không đội quân nào có thể di chuyển, một thành phố có thể xuất hiện thay thế."
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "Di chuyển về các thành phố của người chơi đã chọn. Nếu không đội quân nào có thể di chuyển, một thành phố có thể xuất hiện thay thế.",
|
||||
"End diplomatic relations": "Chấm dứt quan hệ ngoại giao",
|
||||
"Discard Great Diplomat and end its agreement. Costs 1 action.": "Bỏ Nhà ngoại giao vĩ đại và chấm dứt thỏa thuận. Tốn 1 hành động."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4754,5 +4754,7 @@
|
|||
"action cards": "行动牌",
|
||||
"Click the destination again to explore the highlighted region.": "再次点击目的地,探索高亮区域。",
|
||||
"No collection or Trade Routes on this sea tile.": "此海洋板块不能采集或建立贸易路线。",
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "朝所选玩家的城市移动。若没有军队能移动,可能改为生成城市。"
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "朝所选玩家的城市移动。若没有军队能移动,可能改为生成城市。",
|
||||
"End diplomatic relations": "结束外交关系",
|
||||
"Discard Great Diplomat and end its agreement. Costs 1 action.": "弃掉伟大外交家并终止协议。花费1次行动。"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4754,5 +4754,7 @@
|
|||
"action cards": "行動牌",
|
||||
"Click the destination again to explore the highlighted region.": "再次點擊目的地以探索標示的區域。",
|
||||
"No collection or Trade Routes on this sea tile.": "此海洋格無法採集資源或使用貿易路線。",
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "朝所選玩家的城市移動。若沒有軍隊可以移動,則可能改為生成一座城市。"
|
||||
"Moves toward the selected player's cities. If no army can move, a city may spawn instead.": "朝所選玩家的城市移動。若沒有軍隊可以移動,則可能改為生成一座城市。",
|
||||
"End diplomatic relations": "結束外交關係",
|
||||
"Discard Great Diplomat and end its agreement. Costs 1 action.": "棄掉偉大外交家並終止協議。花費1次行動。"
|
||||
}
|
||||
|
|
|
|||
39
web-client/src/pirate-great-person.test.ts
Normal file
39
web-client/src/pirate-great-person.test.ts
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { createRequire } from 'node:module';
|
||||
const engine = createRequire(import.meta.url)('../.engine/server.js');
|
||||
const npcs = JSON.parse(await engine.init(2, [], {}, 'pirate-great-person', {})).players.slice(2);
|
||||
for (const card of [55, 56, 58]) for (const poor of [false, true]) test(`claiming Great Person ${card} during status does not skip the other player's pirate raid (no resources ${poor})`, () => {
|
||||
const g = JSON.parse(readFileSync(new URL('../../server/tests/test_games/incidents/pirates_spawn.json', import.meta.url), 'utf8'));
|
||||
g.players = [...g.players.slice(0, 2), ...structuredClone(npcs)];
|
||||
g.players[0].civilization = 'Phoenicia';
|
||||
g.players[1].civilization = 'Vikings';
|
||||
g.players[1].resources = poor ? {} : { food: 2 };
|
||||
g.players[1].cities[0].mood_state = 'Happy';
|
||||
g.incidents_left = [card];
|
||||
let raw = JSON.stringify(g);
|
||||
const apply = (action: unknown) => { raw = engine.tryMove(raw, JSON.stringify(action), engine.currentPlayer(raw)); };
|
||||
const request = () => JSON.parse(raw).events?.at(-1)?.handler?.request;
|
||||
apply({Response:{SelectAdvance:'Storage'}});
|
||||
apply({Response:{SelectPositions:['A2']}});
|
||||
apply({Response:{SelectPositions:['D1']}});
|
||||
assert.equal(engine.currentPlayer(raw), 0);
|
||||
assert.ok(request().Payment[0].name.includes('pirates'));
|
||||
apply({Response:{Payment:[{food:1}]}});
|
||||
apply({Response:{Payment:[{culture_tokens:1}]}});
|
||||
assert.equal(engine.currentPlayer(raw), 1, 'the next affected player must resolve the raid');
|
||||
if (poor) {
|
||||
if (request()?.SelectPositions) {
|
||||
assert.ok(request().SelectPositions.choices.includes('C1'));
|
||||
apply({Response:{SelectPositions:['C1']}});
|
||||
}
|
||||
assert.equal(JSON.parse(raw).players[1].cities[0].mood_state, 'Neutral');
|
||||
} else {
|
||||
assert.ok(request().Payment[0].name.includes('pirates'));
|
||||
apply({Response:{Payment:[{food:1}]}});
|
||||
assert.equal(JSON.parse(raw).players[1].resources.food, 1);
|
||||
}
|
||||
assert.ok(JSON.parse(raw).players[0].action_cards.includes(card + 100));
|
||||
assert.ok(!JSON.stringify(request()).includes('Pay to gain the Action Card'));
|
||||
});
|
||||
|
|
@ -78,7 +78,7 @@ test('no warning without usable routes, with an expired borrowed advance, or aft
|
|||
assert.ok(view(borrowedCurrency).endTurnTradeWarning, 'Borrowed Currency expires before the next turn');
|
||||
for (const [length, age] of [
|
||||
['Standard', 6],
|
||||
['Epic', 10],
|
||||
['Epic', 8],
|
||||
] as const) {
|
||||
const last = trading();
|
||||
last.options = { ...last.options, length };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue