Action cards (#194)
This commit is contained in:
parent
df380638db
commit
11688b02ea
125 changed files with 4346 additions and 450 deletions
|
|
@ -181,7 +181,7 @@ pub fn pay_advance_dialog(ap: &Payment, rc: &RenderContext) -> StateUpdate {
|
|||
if !matches!(update, StateUpdate::None) {
|
||||
// select a different advance
|
||||
return update;
|
||||
};
|
||||
}
|
||||
payment_dialog(rc, ap, true, ActiveDialog::AdvancePayment, |payment| {
|
||||
StateUpdate::Execute(Action::Playing(PlayingAction::Advance {
|
||||
advance: ap.name.to_string(),
|
||||
|
|
|
|||
|
|
@ -73,13 +73,13 @@ fn render(rc: &RenderContext, features: &Features) -> StateUpdate {
|
|||
return StateUpdate::CloseDialog;
|
||||
}
|
||||
return StateUpdate::OpenDialog(ActiveDialog::Log);
|
||||
};
|
||||
}
|
||||
if top_right_texture(rc, &rc.assets().advances, icon_pos(-2, 0), "Show advances") {
|
||||
if state.active_dialog.is_advance() {
|
||||
return StateUpdate::CloseDialog;
|
||||
}
|
||||
return StateUpdate::OpenDialog(ActiveDialog::AdvanceMenu);
|
||||
};
|
||||
}
|
||||
if top_right_texture(
|
||||
rc,
|
||||
&rc.assets().show_permanent_effects,
|
||||
|
|
@ -91,7 +91,7 @@ fn render(rc: &RenderContext, features: &Features) -> StateUpdate {
|
|||
},
|
||||
) {
|
||||
return StateUpdate::ToggleShowPermanentEffects;
|
||||
};
|
||||
}
|
||||
|
||||
let can_control = rc.can_control_shown_player();
|
||||
if can_control {
|
||||
|
|
|
|||
|
|
@ -183,13 +183,13 @@ impl ActiveDialog {
|
|||
.any(|d| matches!(d, MoveDestination::Tile(_, _)))
|
||||
{
|
||||
result.push("Click on a highlighted tile to move units".to_string());
|
||||
};
|
||||
}
|
||||
if destinations
|
||||
.iter()
|
||||
.any(|d| matches!(d, MoveDestination::Carrier(_)))
|
||||
{
|
||||
result.push("Click on a carrier to embark units".to_string());
|
||||
};
|
||||
}
|
||||
m.destinations.modifiers.iter().for_each(|m| {
|
||||
result.extend(event_help(rc, m));
|
||||
});
|
||||
|
|
@ -539,7 +539,7 @@ impl State {
|
|||
}
|
||||
PersistentEventRequest::SelectAdvance(r) => ActiveDialog::AdvanceRequest(r.clone()),
|
||||
PersistentEventRequest::SelectPositions(r) => {
|
||||
ActiveDialog::PositionRequest(MultiSelection::new(r.request.clone()))
|
||||
ActiveDialog::PositionRequest(MultiSelection::new(r.clone()))
|
||||
}
|
||||
PersistentEventRequest::SelectUnitType(r) => {
|
||||
ActiveDialog::UnitTypeRequest(r.clone())
|
||||
|
|
@ -585,7 +585,7 @@ impl State {
|
|||
}
|
||||
}
|
||||
PersistentEventRequest::SelectHandCards(r) => {
|
||||
ActiveDialog::HandCardsRequest(MultiSelection::new(r.request.clone()))
|
||||
ActiveDialog::HandCardsRequest(MultiSelection::new(r.clone()))
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ use server::collect::{
|
|||
tiles_used,
|
||||
};
|
||||
use server::content::custom_actions::CustomAction;
|
||||
use server::game::Game;
|
||||
use server::playing_actions::{Collect, PlayingAction};
|
||||
use server::position::Position;
|
||||
use server::resource::ResourceType;
|
||||
|
|
@ -50,7 +49,7 @@ impl CollectResources {
|
|||
}
|
||||
|
||||
pub fn help_text(&self, rc: &RenderContext) -> Vec<String> {
|
||||
let extra = self.extra_resources(rc.game);
|
||||
let extra = self.extra_resources();
|
||||
let mut r = vec![
|
||||
self.custom.title.clone(),
|
||||
"Click on a tile to collect resources".to_string(),
|
||||
|
|
@ -63,10 +62,8 @@ impl CollectResources {
|
|||
r
|
||||
}
|
||||
|
||||
pub fn extra_resources(&self, game: &Game) -> i8 {
|
||||
let city = game.city(self.player_index, self.city_position);
|
||||
city.mood_modified_size(game.player(self.player_index)) as i8
|
||||
- tiles_used(&self.collections) as i8
|
||||
pub fn extra_resources(&self) -> i8 {
|
||||
self.info.max_selection as i8 - tiles_used(&self.collections) as i8
|
||||
}
|
||||
|
||||
pub fn collected(&self) -> ResourcePile {
|
||||
|
|
@ -96,7 +93,7 @@ pub fn collect_dialog(rc: &RenderContext, collect: &CollectResources) -> StateUp
|
|||
);
|
||||
|
||||
if ok_button(rc, tooltip) {
|
||||
let extra = collect.extra_resources(game);
|
||||
let extra = collect.extra_resources();
|
||||
|
||||
let c = Collect {
|
||||
city_position: collect.city_position,
|
||||
|
|
@ -117,10 +114,10 @@ pub fn collect_dialog(rc: &RenderContext, collect: &CollectResources) -> StateUp
|
|||
},
|
||||
city,
|
||||
);
|
||||
};
|
||||
}
|
||||
if cancel_button(rc) {
|
||||
return StateUpdate::Cancel;
|
||||
};
|
||||
}
|
||||
StateUpdate::None
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -144,13 +144,13 @@ pub fn select_units_dialog(rc: &RenderContext, s: &UnitsSelection) -> StateUpdat
|
|||
#[derive(Clone)]
|
||||
pub struct MultiSelection<T>
|
||||
where
|
||||
T: Clone,
|
||||
T: Clone + PartialEq + Ord,
|
||||
{
|
||||
pub request: MultiRequest<T>,
|
||||
pub selected: Vec<T>,
|
||||
}
|
||||
|
||||
impl<T: Clone + PartialEq> MultiSelection<T> {
|
||||
impl<T: Clone + PartialEq + Ord> MultiSelection<T> {
|
||||
pub fn new(request: MultiRequest<T>) -> Self {
|
||||
MultiSelection {
|
||||
request,
|
||||
|
|
@ -172,19 +172,19 @@ impl<T: Clone + PartialEq> MultiSelection<T> {
|
|||
let mut new = self.clone();
|
||||
new.selected.push(value);
|
||||
return new;
|
||||
};
|
||||
}
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq)]
|
||||
#[derive(Clone, PartialEq, Eq, Ord, PartialOrd)]
|
||||
pub enum SelectedStructureStatus {
|
||||
Valid,
|
||||
Warn,
|
||||
Invalid,
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq)]
|
||||
#[derive(Clone, PartialEq, Eq, Ord, PartialOrd)]
|
||||
pub struct SelectedStructureInfo {
|
||||
pub position: Position,
|
||||
pub structure: Structure,
|
||||
|
|
@ -272,7 +272,7 @@ pub fn select_structures_dialog(
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn multi_select_tooltip<T: Clone>(
|
||||
pub(crate) fn multi_select_tooltip<T: Clone + PartialEq + Ord>(
|
||||
s: &MultiSelection<T>,
|
||||
valid: bool,
|
||||
name: &str,
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ pub fn add_increase_happiness(
|
|||
if *p == city.position {
|
||||
if let Some(r) = increase_happiness_steps(rc, city, old_steps) {
|
||||
return (*p, r);
|
||||
};
|
||||
}
|
||||
}
|
||||
(*p, old_steps)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ pub fn show_tile_menu(rc: &RenderContext, pos: Position) -> StateUpdate {
|
|||
if rc.shown_player.index == city.player_index {
|
||||
return show_city_menu(rc, city);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
let mut icons = move_units_buttons(rc, pos);
|
||||
if let Some(action) = found_city_button(rc, pos) {
|
||||
|
|
@ -310,7 +310,7 @@ pub fn explore_dialog(rc: &RenderContext, r: &ExploreResolutionConfig) -> StateU
|
|||
let mut new = r.clone();
|
||||
new.rotation = (r.rotation + 3).rem(6);
|
||||
return StateUpdate::OpenDialog(ActiveDialog::ExploreResolution(new));
|
||||
};
|
||||
}
|
||||
|
||||
StateUpdate::None
|
||||
}
|
||||
|
|
|
|||
|
|
@ -324,10 +324,10 @@ pub fn show_global_controls(rc: &RenderContext, features: &Features) -> StateUpd
|
|||
if features.import_export {
|
||||
if bottom_right_texture(rc, &assets.export, icon_pos(-1, -3), "Export") {
|
||||
return StateUpdate::Export;
|
||||
};
|
||||
}
|
||||
if bottom_right_texture(rc, &assets.import, icon_pos(-2, -3), "Import") {
|
||||
return StateUpdate::Import;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
StateUpdate::None
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ impl RenderContext<'_> {
|
|||
match self.camera_mode {
|
||||
CameraMode::Screen => set_default_camera(),
|
||||
CameraMode::World => set_camera(&self.state.camera),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ pub fn count_dialog<C, O: HasCountSelectableObject>(
|
|||
)
|
||||
{
|
||||
return plus(container, o);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if ok_button(rc, is_valid()) {
|
||||
|
|
@ -76,7 +76,7 @@ pub fn count_dialog<C, O: HasCountSelectableObject>(
|
|||
}
|
||||
if may_cancel && cancel_button(rc) {
|
||||
return StateUpdate::Cancel;
|
||||
};
|
||||
}
|
||||
|
||||
StateUpdate::None
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
[tools.rust]
|
||||
version = "1.85.1"
|
||||
version = "1.86.0"
|
||||
backend = "core:rust"
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
[tasks.test]
|
||||
description = "Run server tests"
|
||||
run = 'cargo test {{arg(name="test", default="")}}'
|
||||
dir = "server"
|
||||
|
||||
[tasks.update-tests]
|
||||
description = "Run server tests and update json files"
|
||||
run = 'cargo test {{arg(name="test", default="")}}'
|
||||
|
|
|
|||
|
|
@ -299,7 +299,7 @@ pub(crate) trait AbilityInitializerSetup: Sized {
|
|||
response: None,
|
||||
origin: origin.clone(),
|
||||
});
|
||||
};
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
@ -504,16 +504,12 @@ pub(crate) trait AbilityInitializerSetup: Sized {
|
|||
self.add_multi_choice_reward_request_listener::<E, Position, PositionRequest, V>(
|
||||
event,
|
||||
priority,
|
||||
|r| &r.request,
|
||||
|r| r,
|
||||
PersistentEventRequest::SelectPositions,
|
||||
|request, action| {
|
||||
if let PersistentEventRequest::SelectPositions(request) = &request {
|
||||
if let EventResponse::SelectPositions(reward) = action {
|
||||
return (
|
||||
request.request.choices.clone(),
|
||||
reward,
|
||||
request.request.needed.clone(),
|
||||
);
|
||||
return (request.choices.clone(), reward, request.needed.clone());
|
||||
}
|
||||
}
|
||||
panic!("Position request expected");
|
||||
|
|
@ -595,16 +591,12 @@ pub(crate) trait AbilityInitializerSetup: Sized {
|
|||
self.add_multi_choice_reward_request_listener::<E, HandCard, HandCardsRequest, V>(
|
||||
event,
|
||||
priority,
|
||||
|r| &r.request,
|
||||
|r| r,
|
||||
PersistentEventRequest::SelectHandCards,
|
||||
|request, action| {
|
||||
if let PersistentEventRequest::SelectHandCards(request) = &request {
|
||||
if let EventResponse::SelectHandCards(choices) = action {
|
||||
return (
|
||||
request.request.choices.clone(),
|
||||
choices,
|
||||
request.request.needed.clone(),
|
||||
);
|
||||
return (request.choices.clone(), choices, request.needed.clone());
|
||||
}
|
||||
}
|
||||
panic!("Hand Cards request expected");
|
||||
|
|
|
|||
|
|
@ -113,6 +113,7 @@ fn execute_without_undo(
|
|||
return Ok(game);
|
||||
}
|
||||
|
||||
game.current_action_log_index = Some(game.action_log_index);
|
||||
add_log_item_from_action(&mut game, &action);
|
||||
add_action_log_item(&mut game, action.clone());
|
||||
|
||||
|
|
@ -125,6 +126,7 @@ fn execute_without_undo(
|
|||
_ => execute_regular_action(&mut game, action, player_index),
|
||||
}?;
|
||||
check_for_waste(&mut game);
|
||||
game.current_action_log_index = None;
|
||||
Ok(game)
|
||||
}
|
||||
|
||||
|
|
@ -309,7 +311,7 @@ pub(crate) fn execute_movement_action(
|
|||
game.state = GameState::Playing;
|
||||
return Ok(());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
let state = get_move_state(game);
|
||||
let all_moves_used =
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ use action_cards::get_action_card;
|
|||
use serde::{Deserialize, Serialize};
|
||||
use std::slice::from_ref;
|
||||
|
||||
pub type CanPlayCard = Box<dyn Fn(&Game, &Player) -> bool>;
|
||||
pub type CanPlayCard = Box<dyn Fn(&Game, &Player, &ActionCardInfo) -> bool>;
|
||||
|
||||
pub struct CivilCard {
|
||||
pub name: String,
|
||||
|
|
@ -54,7 +54,7 @@ impl ActionCard {
|
|||
can_play: F,
|
||||
) -> ActionCardBuilder
|
||||
where
|
||||
F: Fn(&Game, &Player) -> bool + 'static,
|
||||
F: Fn(&Game, &Player, &ActionCardInfo) -> bool + 'static,
|
||||
{
|
||||
ActionCardBuilder {
|
||||
id,
|
||||
|
|
@ -122,8 +122,10 @@ impl AbilityInitializerSetup for ActionCardBuilder {
|
|||
|
||||
pub(crate) fn play_action_card(game: &mut Game, player_index: usize, id: u8) {
|
||||
discard_action_card(game, player_index, id);
|
||||
let mut satisfying_action: Option<usize> = None;
|
||||
if let Some(requirement) = get_civil_card(id).requirement {
|
||||
if let Some(action_log_index) = requirement.satisfying_action(game, id, true) {
|
||||
if let Some(action_log_index) = requirement.satisfying_action(game, id) {
|
||||
satisfying_action = Some(action_log_index);
|
||||
current_player_turn_log_mut(game).items[action_log_index]
|
||||
.civil_card_match
|
||||
.as_mut()
|
||||
|
|
@ -132,7 +134,11 @@ pub(crate) fn play_action_card(game: &mut Game, player_index: usize, id: u8) {
|
|||
.push(id);
|
||||
}
|
||||
}
|
||||
on_play_action_card(game, player_index, ActionCardInfo::new(id));
|
||||
on_play_action_card(
|
||||
game,
|
||||
player_index,
|
||||
ActionCardInfo::new(id, satisfying_action),
|
||||
);
|
||||
}
|
||||
|
||||
pub(crate) fn on_play_action_card(game: &mut Game, player_index: usize, i: ActionCardInfo) {
|
||||
|
|
@ -192,17 +198,21 @@ pub struct ActionCardInfo {
|
|||
#[serde(default)]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub answer: Option<bool>,
|
||||
#[serde(default)]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub satisfying_action: Option<usize>,
|
||||
}
|
||||
|
||||
impl ActionCardInfo {
|
||||
#[must_use]
|
||||
pub fn new(id: u8) -> Self {
|
||||
pub fn new(id: u8, satisfying_action: Option<usize>) -> Self {
|
||||
Self {
|
||||
id,
|
||||
selected_position: None,
|
||||
selected_positions: Vec::new(),
|
||||
selected_player: None,
|
||||
answer: None,
|
||||
satisfying_action,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -219,16 +229,28 @@ pub struct CivilCardMatch {
|
|||
#[serde(default)]
|
||||
#[serde(skip_serializing_if = "Vec::is_empty")]
|
||||
pub played_cards: Vec<u8>,
|
||||
#[serde(default)]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub opponent: Option<usize>,
|
||||
}
|
||||
|
||||
impl CivilCardMatch {
|
||||
#[must_use]
|
||||
pub fn new(opportunity: CivilCardOpportunity) -> Self {
|
||||
pub fn new(opportunity: CivilCardOpportunity, opponent: Option<usize>) -> Self {
|
||||
Self {
|
||||
opportunity,
|
||||
played_cards: Vec::new(),
|
||||
opponent,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn store(self, game: &mut Game) {
|
||||
current_player_turn_log_mut(game)
|
||||
.items
|
||||
.last_mut()
|
||||
.expect("no action log")
|
||||
.civil_card_match = Some(self);
|
||||
}
|
||||
}
|
||||
|
||||
pub struct CivilCardRequirement {
|
||||
|
|
@ -246,28 +268,28 @@ impl CivilCardRequirement {
|
|||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn satisfying_action(
|
||||
&self,
|
||||
game: &Game,
|
||||
action_card_id: u8,
|
||||
execute: bool,
|
||||
) -> Option<usize> {
|
||||
let l = ¤t_player_turn_log(game).items;
|
||||
let slice: &[ActionLogItem] = if self.just_before {
|
||||
let delta = if execute { 2 } else { 1 };
|
||||
if l.len() >= delta {
|
||||
from_ref(&l[l.len() - delta])
|
||||
} else {
|
||||
pub fn satisfying_action(&self, game: &Game, action_card_id: u8) -> Option<usize> {
|
||||
let mut l: &[ActionLogItem] = ¤t_player_turn_log(game).items;
|
||||
if let Some(c) = game.current_action_log_index {
|
||||
l = &l[..c];
|
||||
}
|
||||
if self.just_before {
|
||||
l = if l.is_empty() {
|
||||
&[]
|
||||
}
|
||||
} else {
|
||||
from_ref(&l[l.len() - 1])
|
||||
};
|
||||
}
|
||||
let sister_card = if action_card_id % 2 == 0 {
|
||||
action_card_id - 1
|
||||
} else {
|
||||
l
|
||||
action_card_id + 1
|
||||
};
|
||||
self.opportunities.iter().find_map(|o| {
|
||||
slice.iter().position(|a| {
|
||||
l.iter().position(|a| {
|
||||
if let Some(civil_card_match) = &a.civil_card_match {
|
||||
if civil_card_match.opportunity == *o
|
||||
&& !civil_card_match.played_cards.contains(&action_card_id)
|
||||
&& !civil_card_match.played_cards.contains(&sister_card)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ pub fn do_advance(game: &mut Game, advance: &Advance, player_index: usize) {
|
|||
player.advances.push(get_advance(&advance.name));
|
||||
}
|
||||
|
||||
pub(crate) fn gain_advance(
|
||||
pub(crate) fn gain_advance_without_payment(
|
||||
game: &mut Game,
|
||||
name: &str,
|
||||
player_index: usize,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ impl HandCardType {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Debug)]
|
||||
#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Ord, Debug, PartialOrd)]
|
||||
pub enum HandCard {
|
||||
ActionCard(u8),
|
||||
Wonder(String),
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ impl DestroyedStructuresData {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Eq, PartialEq, Hash, Clone, Debug, Copy)]
|
||||
#[derive(Serialize, Deserialize, Eq, PartialEq, Hash, Clone, Debug, Copy, PartialOrd, Ord)]
|
||||
pub enum Building {
|
||||
Academy,
|
||||
Market,
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ use crate::player_events::ActionInfo;
|
|||
use crate::playing_actions::Collect;
|
||||
use crate::position::Position;
|
||||
use crate::resource_pile::ResourcePile;
|
||||
use itertools::Itertools;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::iter;
|
||||
|
|
@ -61,21 +62,25 @@ pub fn get_total_collection(
|
|||
return Err("Not your city".to_string());
|
||||
}
|
||||
|
||||
if city.mood_modified_size(player) < tiles_used(collections) as usize {
|
||||
let mut i =
|
||||
possible_resource_collections(game, city_position, player_index, &Vec::new(), collections);
|
||||
if i.max_selection < tiles_used(collections) {
|
||||
return Err(format!(
|
||||
"You can only collect {} resources - got {}",
|
||||
city.mood_modified_size(player),
|
||||
i.max_selection,
|
||||
tiles_used(collections)
|
||||
));
|
||||
}
|
||||
let mut i =
|
||||
possible_resource_collections(game, city_position, player_index, &Vec::new(), collections);
|
||||
|
||||
if collections.iter().any(|c| c.times > i.max_per_tile) {
|
||||
return Err(format!(
|
||||
"You can only collect {} resources from each tile",
|
||||
i.max_per_tile,
|
||||
));
|
||||
for (_, group) in &collections.iter().chunk_by(|c| c.position) {
|
||||
let used = group.map(|c| c.times).sum::<u32>();
|
||||
|
||||
if used > i.max_per_tile {
|
||||
return Err(format!(
|
||||
"You can only collect {} resources from each tile",
|
||||
i.max_per_tile,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
for c in collections {
|
||||
|
|
@ -146,6 +151,7 @@ pub struct CollectInfo {
|
|||
pub city: Position,
|
||||
pub total: ResourcePile,
|
||||
pub max_per_tile: u32,
|
||||
pub max_selection: u32,
|
||||
pub(crate) info: ActionInfo,
|
||||
}
|
||||
|
||||
|
|
@ -162,6 +168,7 @@ impl CollectInfo {
|
|||
info: ActionInfo::new(player),
|
||||
city,
|
||||
max_per_tile: 1,
|
||||
max_selection: player.get_city(city).mood_modified_size(player) as u32,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,12 +10,11 @@ use crate::combat_roll::CombatStats;
|
|||
use crate::consts::SHIP_CAPACITY;
|
||||
use crate::content::persistent_events::PersistentEventType;
|
||||
use crate::game::Game;
|
||||
use crate::log::current_player_turn_log_mut;
|
||||
use crate::movement::{MoveUnits, MovementRestriction, move_units, stop_current_move};
|
||||
use crate::position::Position;
|
||||
use crate::resource_pile::ResourcePile;
|
||||
use crate::tactics_card::CombatRole;
|
||||
use crate::unit::UnitType;
|
||||
use crate::unit::{UnitType, Units, carried_units};
|
||||
use itertools::Itertools;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
|
@ -214,6 +213,32 @@ pub fn initiate_combat(
|
|||
|
||||
pub(crate) fn log_round(game: &mut Game, c: &Combat) {
|
||||
game.add_info_log_group(format!("Combat round {}", c.round));
|
||||
game.add_info_log_item(&format!(
|
||||
"Attackers: {}",
|
||||
c.attackers
|
||||
.iter()
|
||||
.flat_map(|u| {
|
||||
let p = game.player(c.attacker);
|
||||
let u = p.get_unit(*u);
|
||||
vec![u.unit_type]
|
||||
.into_iter()
|
||||
.chain(
|
||||
carried_units(u.id, p)
|
||||
.iter()
|
||||
.map(|u| p.get_unit(*u).unit_type),
|
||||
)
|
||||
.collect_vec()
|
||||
})
|
||||
.collect::<Units>()
|
||||
));
|
||||
game.add_info_log_item(&format!(
|
||||
"Defenders: {}",
|
||||
game.player(c.defender)
|
||||
.get_units(c.defender_position)
|
||||
.iter()
|
||||
.map(|u| u.unit_type)
|
||||
.collect::<Units>()
|
||||
));
|
||||
}
|
||||
|
||||
pub(crate) fn start_combat(game: &mut Game, combat: Combat) {
|
||||
|
|
@ -264,7 +289,7 @@ pub(crate) fn combat_loop(game: &mut Game, mut s: CombatRoundStart) {
|
|||
match combat_round_start(game, s) {
|
||||
Some(value) => s = value,
|
||||
None => return,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
let c = s.combat;
|
||||
|
|
@ -339,16 +364,7 @@ pub(crate) fn conquer_city(
|
|||
if attacker_is_human {
|
||||
game.players[new_player_index].gain_resources(ResourcePile::gold(size as u32));
|
||||
|
||||
let mut m = current_player_turn_log_mut(game)
|
||||
.items
|
||||
.last_mut()
|
||||
.expect("no action log")
|
||||
.civil_card_match
|
||||
.as_mut();
|
||||
if m.is_none() {
|
||||
// no battle for capturing city
|
||||
m.replace(&mut CivilCardMatch::new(CivilCardOpportunity::CaptureCity));
|
||||
}
|
||||
CivilCardMatch::new(CivilCardOpportunity::CaptureCity, Some(old_player_index)).store(game);
|
||||
}
|
||||
let take_over = game.player(new_player_index).is_city_available();
|
||||
|
||||
|
|
@ -530,6 +546,7 @@ pub mod tests {
|
|||
current_player_index: 0,
|
||||
action_log: vec![age],
|
||||
action_log_index: 0,
|
||||
current_action_log_index: None,
|
||||
log: Vec::new(),
|
||||
undo_limit: 0,
|
||||
actions_left: 3,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ use crate::content::builtin::Builtin;
|
|||
use crate::content::persistent_events::{PersistentEventType, PositionRequest, UnitsRequest};
|
||||
use crate::content::tactics_cards;
|
||||
use crate::game::Game;
|
||||
use crate::log::current_player_turn_log_mut;
|
||||
use crate::movement::move_units;
|
||||
use crate::player_events::{PersistentEvent, PersistentEvents};
|
||||
use crate::position::Position;
|
||||
|
|
@ -512,7 +511,7 @@ fn add_tactics_listener(
|
|||
card.name
|
||||
));
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn choose_fighter_casualties() -> Builtin {
|
||||
|
|
@ -683,12 +682,11 @@ pub(crate) fn combat_stats() -> Builtin {
|
|||
if let Some(winner) = r.winner() {
|
||||
let p = c.player(winner);
|
||||
if p == game.current_player_index && !c.is_sea_battle(game) {
|
||||
current_player_turn_log_mut(game)
|
||||
.items
|
||||
.last_mut()
|
||||
.expect("no action log")
|
||||
.civil_card_match =
|
||||
Some(CivilCardMatch::new(CivilCardOpportunity::WinLandBattle));
|
||||
CivilCardMatch::new(
|
||||
CivilCardOpportunity::WinLandBattle,
|
||||
Some(c.opponent(p)),
|
||||
)
|
||||
.store(game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -198,8 +198,8 @@ fn dice_roll_with_leader_reroll(
|
|||
}
|
||||
|
||||
fn add_roll_log_effect(roll_log: &mut [String], effect: &str) {
|
||||
let l = roll_log.len();
|
||||
roll_log[l - 1] += &format!("{effect})");
|
||||
use std::fmt::Write as _;
|
||||
let _ = write!(roll_log[roll_log.len() - 1], "{effect})");
|
||||
}
|
||||
|
||||
fn roll_die(game: &mut Game, roll_log: &mut Vec<String>) -> CombatDieRoll {
|
||||
|
|
|
|||
|
|
@ -4,10 +4,12 @@ mod inspiration;
|
|||
mod mercenaries;
|
||||
pub(crate) mod negotiation;
|
||||
pub mod spy;
|
||||
mod synergies;
|
||||
|
||||
use crate::action_card::{ActionCard, CivilCard};
|
||||
use crate::content::action_cards::inspiration::inspiration_action_cards;
|
||||
use crate::content::action_cards::negotiation::negotiation_action_cards;
|
||||
use crate::content::action_cards::synergies::synergies_action_cards;
|
||||
use crate::content::incidents;
|
||||
use development::development_action_cards;
|
||||
use itertools::Itertools;
|
||||
|
|
@ -18,6 +20,7 @@ pub(crate) fn get_all() -> Vec<ActionCard> {
|
|||
inspiration_action_cards(),
|
||||
development_action_cards(),
|
||||
negotiation_action_cards(),
|
||||
synergies_action_cards(),
|
||||
]
|
||||
.into_iter()
|
||||
.flatten()
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ pub(crate) fn cultural_takeover(id: u8, tactics_card: TacticsCardFactory) -> Act
|
|||
Replace one of the Barbarian units with a Settler or Infantry of your color. \
|
||||
Remove the other Barbarian units.",
|
||||
ActionType::free(),
|
||||
|_game, _p| true,
|
||||
|_game, _p, _| true,
|
||||
)
|
||||
.add_unit_type_request(
|
||||
|event| &mut event.play_action_card,
|
||||
|
|
@ -121,7 +121,7 @@ pub(crate) fn use_cultural_takeover() -> Builtin {
|
|||
)
|
||||
.is_some_and(|_| outcome.success)
|
||||
{
|
||||
let mut info = ActionCardInfo::new(15);
|
||||
let mut info = ActionCardInfo::new(15, None);
|
||||
info.selected_position = Some(outcome.position);
|
||||
on_play_action_card(game, outcome.player, info);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ fn city_development(id: u8, tactics_card: TacticsCardFactory) -> ActionCard {
|
|||
"City Development",
|
||||
"Construct a building without paying resources.",
|
||||
ActionType::regular_with_cost(ResourcePile::culture_tokens(1)),
|
||||
|_game, _player| true,
|
||||
|_game, _player, _| true,
|
||||
)
|
||||
.tactics_card(tactics_card)
|
||||
.add_simple_persistent_event_listener(
|
||||
|
|
@ -64,7 +64,7 @@ fn production_focus(id: u8, tactics_card: TacticsCardFactory) -> ActionCard {
|
|||
"For the next collect action, you may collect multiple times from the same tile. \
|
||||
The total amount of resources does not change.",
|
||||
ActionType::regular(),
|
||||
|_game, _player| true,
|
||||
|_game, _player, _| true,
|
||||
)
|
||||
.tactics_card(tactics_card)
|
||||
.add_simple_persistent_event_listener(
|
||||
|
|
@ -101,16 +101,20 @@ pub(crate) fn collect_only() -> Builtin {
|
|||
.add_transient_event_listener(
|
||||
|event| &mut event.collect_options,
|
||||
2,
|
||||
|c, context, game| {
|
||||
|c, _context, game| {
|
||||
if game
|
||||
.permanent_effects
|
||||
.iter()
|
||||
.any(|e| matches!(e, &PermanentEffect::Collect(CollectEffect::ProductionFocus)))
|
||||
{
|
||||
c.max_per_tile = game
|
||||
.any_city(context.city_position)
|
||||
.mood_modified_size(game.player(context.player_index))
|
||||
as u32;
|
||||
c.max_per_tile = c.max_selection;
|
||||
}
|
||||
if game
|
||||
.permanent_effects
|
||||
.iter()
|
||||
.any(|e| matches!(e, &PermanentEffect::Collect(CollectEffect::Overproduction)))
|
||||
{
|
||||
c.max_selection += 2;
|
||||
}
|
||||
},
|
||||
)
|
||||
|
|
@ -144,9 +148,8 @@ fn explorer(id: u8, tactics_card: TacticsCardFactory) -> ActionCard {
|
|||
"Explorer",
|
||||
"Construct a building without paying resources.",
|
||||
ActionType::regular_with_cost(ResourcePile::culture_tokens(1)),
|
||||
|game, player| {
|
||||
|game, player, _| {
|
||||
!action_explore_request(game, player.index)
|
||||
.request
|
||||
.choices
|
||||
.is_empty()
|
||||
},
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use crate::ability_initializer::AbilityInitializerSetup;
|
|||
use crate::action_card::{
|
||||
ActionCard, ActionCardBuilder, CivilCardOpportunity, CivilCardRequirement,
|
||||
};
|
||||
use crate::advance::gain_advance;
|
||||
use crate::advance::gain_advance_without_payment;
|
||||
use crate::city::MoodState;
|
||||
use crate::content::action_cards::spy::spy;
|
||||
use crate::content::advances;
|
||||
|
|
@ -43,7 +43,7 @@ fn advance(id: u8, tactics_card: TacticsCardFactory) -> ActionCard {
|
|||
"Advance",
|
||||
"Pay 1 culture token: Gain 1 advance without changing the Game Event counter.",
|
||||
ActionType::free(),
|
||||
|_game, player| {
|
||||
|_game, player, _| {
|
||||
player.resources.culture_tokens >= 1 && !possible_advances(player).is_empty()
|
||||
},
|
||||
)
|
||||
|
|
@ -54,7 +54,7 @@ fn advance(id: u8, tactics_card: TacticsCardFactory) -> ActionCard {
|
|||
|game, player, _| Some(AdvanceRequest::new(possible_advances(game.player(player)))),
|
||||
|game, sel, _| {
|
||||
let advance = sel.choice.clone();
|
||||
gain_advance(
|
||||
gain_advance_without_payment(
|
||||
game,
|
||||
&advance,
|
||||
sel.player_index,
|
||||
|
|
@ -85,7 +85,7 @@ fn inspiration(id: u8, tactics_card: TacticsCardFactory) -> ActionCard {
|
|||
"Gain 1 advance for free (without changing the Game Event counter) \
|
||||
that a player owns who has a unit or city within range 2 of your units or cities.",
|
||||
ActionType::free(),
|
||||
|game, player| !possible_inspiration_advances(game, player).is_empty(),
|
||||
|game, player, _| !possible_inspiration_advances(game, player).is_empty(),
|
||||
)
|
||||
.tactics_card(tactics_card)
|
||||
.add_advance_request(
|
||||
|
|
@ -99,7 +99,7 @@ fn inspiration(id: u8, tactics_card: TacticsCardFactory) -> ActionCard {
|
|||
},
|
||||
|game, sel, _| {
|
||||
let advance = sel.choice.clone();
|
||||
gain_advance(
|
||||
gain_advance_without_payment(
|
||||
game,
|
||||
&advance,
|
||||
sel.player_index,
|
||||
|
|
@ -162,10 +162,13 @@ fn hero_general(id: u8, tactics_card: TacticsCardFactory) -> ActionCard {
|
|||
"If you won a land battle this turn: Increase the mood in a city by 1. \
|
||||
You may pay 1 mood token to increase the mood in a city by 1.",
|
||||
ActionType::free(),
|
||||
|_game, player| !cities_where_mood_can_increase(player).is_empty(),
|
||||
|_game, player, _| !cities_where_mood_can_increase(player).is_empty(),
|
||||
)
|
||||
.requirement(CivilCardRequirement::new(
|
||||
vec![CivilCardOpportunity::WinLandBattle],
|
||||
vec![
|
||||
CivilCardOpportunity::WinLandBattle,
|
||||
CivilCardOpportunity::CaptureCity,
|
||||
],
|
||||
false,
|
||||
))
|
||||
.tactics_card(tactics_card);
|
||||
|
|
@ -244,7 +247,7 @@ fn ideas(id: u8, tactics_card: TacticsCardFactory) -> ActionCard {
|
|||
"Ideas",
|
||||
"Gain 1 idea per Academy you own.",
|
||||
ActionType::free(),
|
||||
|_game, player| academies(player) > 0,
|
||||
|_game, player, _| academies(player) > 0,
|
||||
)
|
||||
.tactics_card(tactics_card)
|
||||
.add_simple_persistent_event_listener(
|
||||
|
|
@ -274,7 +277,7 @@ fn great_ideas(id: u8, tactics_card: TacticsCardFactory) -> ActionCard {
|
|||
"Great Ideas",
|
||||
"After capturing a city or winning a land battle: Gain 2 ideas.",
|
||||
ActionType::free(),
|
||||
|_game, player| player.resources.ideas < player.resource_limit.ideas,
|
||||
|_game, player, _| player.resources.ideas < player.resource_limit.ideas,
|
||||
)
|
||||
.requirement(CivilCardRequirement::new(
|
||||
vec![
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ pub(crate) fn mercenaries(id: u8, tactics_card: TacticsCardFactory) -> ActionCar
|
|||
Pay 1 food, wood, ore, or culture token for each army up front. \
|
||||
Reinforce all Barbarian cities where you moved units out of according to the usual rules.",
|
||||
ActionType::regular(),
|
||||
|game, p| {
|
||||
|game, p, _| {
|
||||
!barbarian_army_positions_in_range2(game, p).is_empty() && max_mercenary_payment(p) > 0
|
||||
},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -2,10 +2,12 @@ use crate::ability_initializer::AbilityInitializerSetup;
|
|||
use crate::action::Action;
|
||||
use crate::action_card::ActionCard;
|
||||
use crate::content::builtin::Builtin;
|
||||
use crate::content::effects::PermanentEffect;
|
||||
use crate::content::effects::{CollectEffect, PermanentEffect};
|
||||
use crate::content::incidents::great_diplomat::{DiplomaticRelations, Negotiations};
|
||||
use crate::content::persistent_events::PlayerRequest;
|
||||
use crate::content::tactics_cards::{TacticsCardFactory, martyr, scout};
|
||||
use crate::content::tactics_cards::{
|
||||
TacticsCardFactory, archers, defensive_formation, encircled, high_ground, martyr, scout,
|
||||
};
|
||||
use crate::game::Game;
|
||||
use crate::log::current_player_turn_log;
|
||||
use crate::playing_actions::{ActionType, PlayingAction};
|
||||
|
|
@ -13,7 +15,16 @@ use crate::resource_pile::ResourcePile;
|
|||
use crate::utils::remove_element_by;
|
||||
|
||||
pub(crate) fn negotiation_action_cards() -> Vec<ActionCard> {
|
||||
vec![negotiations(23, scout), negotiations(24, martyr)]
|
||||
vec![
|
||||
negotiations(23, scout),
|
||||
negotiations(24, martyr),
|
||||
leadership(25, high_ground),
|
||||
leadership(26, archers),
|
||||
assassination(27, high_ground),
|
||||
assassination(28, archers),
|
||||
overproduction(29, defensive_formation),
|
||||
overproduction(30, encircled),
|
||||
]
|
||||
}
|
||||
|
||||
fn negotiations(id: u8, tactics_card: TacticsCardFactory) -> ActionCard {
|
||||
|
|
@ -23,7 +34,7 @@ fn negotiations(id: u8, tactics_card: TacticsCardFactory) -> ActionCard {
|
|||
"Select another player. This turn, you may not attack that player. \
|
||||
In their next turn, they may not attack you.",
|
||||
ActionType::cost(ResourcePile::culture_tokens(1)),
|
||||
move |game, _player| {
|
||||
move |game, _player, _| {
|
||||
!current_player_turn_log(game)
|
||||
.items
|
||||
.iter()
|
||||
|
|
@ -72,24 +83,31 @@ pub(crate) fn use_negotiations() -> Builtin {
|
|||
|game, player_index, player_name, ()| {
|
||||
if let Some(negotiations_partner) = negotiations_partner(game, player_index) {
|
||||
let partner_name = game.player_name(negotiations_partner);
|
||||
for e in &mut game.permanent_effects {
|
||||
|
||||
let mut delete = Vec::new();
|
||||
let mut remain = Vec::new();
|
||||
for (i, e) in &mut game.permanent_effects.iter_mut().enumerate() {
|
||||
if let PermanentEffect::Negotiations(d) = e {
|
||||
d.remaining_turns -= 1;
|
||||
if d.remaining_turns == 0 {
|
||||
game.add_info_log_item(&format!(
|
||||
"{player_name} may attack {partner_name} again.",
|
||||
));
|
||||
remove_element_by(&mut game.permanent_effects, |e| {
|
||||
matches!(e, PermanentEffect::Negotiations(_))
|
||||
});
|
||||
delete.push(i);
|
||||
} else {
|
||||
game.add_info_log_item(&format!(
|
||||
"{player_name} may not attack {partner_name} this turn.",
|
||||
));
|
||||
remain.push(i);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
// must be in reverse order to not mess up the indices during deletion
|
||||
for i in delete.iter().rev() {
|
||||
game.add_info_log_item(&format!(
|
||||
"{player_name} may attack {partner_name} again.",
|
||||
));
|
||||
game.permanent_effects.remove(*i);
|
||||
}
|
||||
for _ in remain {
|
||||
game.add_info_log_item(&format!(
|
||||
"{player_name} may not attack {partner_name} this turn.",
|
||||
));
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
|
|
@ -105,3 +123,125 @@ pub(crate) fn negotiations_partner(game: &Game, p: usize) -> Option<usize> {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
fn leadership(id: u8, tactics_card: TacticsCardFactory) -> ActionCard {
|
||||
ActionCard::builder(
|
||||
id,
|
||||
"Leadership",
|
||||
"Gain 1 action.",
|
||||
ActionType::cost(ResourcePile::culture_tokens(1)),
|
||||
move |_game, _player, _| true,
|
||||
)
|
||||
.tactics_card(tactics_card)
|
||||
.add_simple_persistent_event_listener(
|
||||
|e| &mut e.play_action_card,
|
||||
0,
|
||||
|game, _player_index, player_name, _| {
|
||||
game.add_info_log_item(&format!("{player_name} used Leadership to gain an action."));
|
||||
game.actions_left += 1;
|
||||
},
|
||||
)
|
||||
.build()
|
||||
}
|
||||
|
||||
fn assassination(id: u8, tactics_card: TacticsCardFactory) -> ActionCard {
|
||||
ActionCard::builder(
|
||||
id,
|
||||
"Assassination",
|
||||
"Select a player (not affected by Assassination already) \
|
||||
to lose an action in their next turn.",
|
||||
ActionType::cost(ResourcePile::culture_tokens(1)),
|
||||
move |game, p, _| !opponents_not_affected_by_assassination(game, p.index).is_empty(),
|
||||
)
|
||||
.tactics_card(tactics_card)
|
||||
.add_player_request(
|
||||
|e| &mut e.play_action_card,
|
||||
0,
|
||||
|game, player_index, _| {
|
||||
Some(PlayerRequest::new(
|
||||
opponents_not_affected_by_assassination(game, player_index),
|
||||
"Select a player to assassinate",
|
||||
))
|
||||
},
|
||||
|game, s, _| {
|
||||
game.permanent_effects
|
||||
.push(PermanentEffect::Assassination(s.choice));
|
||||
game.add_info_log_item(&format!(
|
||||
"{} has been assassinated by {}.",
|
||||
game.player_name(s.choice),
|
||||
s.player_name
|
||||
));
|
||||
},
|
||||
)
|
||||
.build()
|
||||
}
|
||||
|
||||
fn opponents_not_affected_by_assassination(game: &Game, player_index: usize) -> Vec<usize> {
|
||||
game.players
|
||||
.iter()
|
||||
.filter(|p| {
|
||||
let pi = p.index;
|
||||
pi != player_index
|
||||
&& p.is_human()
|
||||
&& !game
|
||||
.permanent_effects
|
||||
.iter()
|
||||
.any(|e| is_assassinated(e, pi))
|
||||
})
|
||||
.map(|p| p.index)
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub(crate) fn use_assassination() -> Builtin {
|
||||
Builtin::builder("Assassination", "")
|
||||
.add_simple_persistent_event_listener(
|
||||
|e| &mut e.turn_start,
|
||||
2,
|
||||
|game, player_index, player_name, ()| {
|
||||
if remove_element_by(&mut game.permanent_effects, |e| {
|
||||
is_assassinated(e, player_index)
|
||||
})
|
||||
.is_some()
|
||||
{
|
||||
game.actions_left -= 1;
|
||||
game.add_info_log_item(&format!(
|
||||
"{player_name} has lost an action due to assassination."
|
||||
));
|
||||
}
|
||||
},
|
||||
)
|
||||
.build()
|
||||
}
|
||||
|
||||
fn is_assassinated(e: &PermanentEffect, player: usize) -> bool {
|
||||
matches!(e, PermanentEffect::Assassination(p) if player == *p)
|
||||
}
|
||||
|
||||
fn overproduction(id: u8, tactics_card: TacticsCardFactory) -> ActionCard {
|
||||
ActionCard::builder(
|
||||
id,
|
||||
"Overproduction",
|
||||
"You may collect from 2 additional tiles this turn. \
|
||||
(Cannot combine with Production Focus or another Overproduction.)",
|
||||
ActionType::cost(ResourcePile::culture_tokens(1)),
|
||||
move |game, _p, _| {
|
||||
!game
|
||||
.permanent_effects
|
||||
.iter()
|
||||
.any(|e| matches!(e, PermanentEffect::Collect(_)))
|
||||
},
|
||||
)
|
||||
.tactics_card(tactics_card)
|
||||
.add_simple_persistent_event_listener(
|
||||
|e| &mut e.play_action_card,
|
||||
0,
|
||||
|game, _player_index, player_name, _| {
|
||||
game.permanent_effects
|
||||
.push(PermanentEffect::Collect(CollectEffect::Overproduction));
|
||||
game.add_info_log_item(&format!(
|
||||
"{player_name} can use Overproduction to collect from 2 additional tiles."
|
||||
));
|
||||
},
|
||||
)
|
||||
.build()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ pub(crate) fn spy(id: u8, tactics_card: TacticsCardFactory) -> ActionCard {
|
|||
"Look at all Wonder, Action, and Objective cards of another player. \
|
||||
You may swap one card of the same type.",
|
||||
ActionType::regular_with_cost(ResourcePile::culture_tokens(1)),
|
||||
|game, player| !players_with_cards(game, player.index).is_empty(),
|
||||
|game, player, _| !players_with_cards(game, player.index).is_empty(),
|
||||
)
|
||||
.add_player_request(
|
||||
|e| &mut e.play_action_card,
|
||||
|
|
|
|||
211
server/src/content/action_cards/synergies.rs
Normal file
211
server/src/content/action_cards/synergies.rs
Normal file
|
|
@ -0,0 +1,211 @@
|
|||
use crate::ability_initializer::AbilityInitializerSetup;
|
||||
use crate::action::Action;
|
||||
use crate::action_card::{
|
||||
ActionCard, ActionCardBuilder, ActionCardInfo, CivilCardMatch, CivilCardOpportunity,
|
||||
CivilCardRequirement,
|
||||
};
|
||||
use crate::advance::gain_advance_without_payment;
|
||||
use crate::content::advances;
|
||||
use crate::content::advances::get_advance;
|
||||
use crate::content::persistent_events::{AdvanceRequest, EventResponse, PaymentRequest};
|
||||
use crate::content::tactics_cards::{TacticsCardFactory, archers, defensive_formation};
|
||||
use crate::game::Game;
|
||||
use crate::log::current_player_turn_log;
|
||||
use crate::player::Player;
|
||||
use crate::playing_actions::ActionType;
|
||||
use crate::resource_pile::ResourcePile;
|
||||
use itertools::Itertools;
|
||||
|
||||
pub(crate) fn synergies_action_cards() -> Vec<ActionCard> {
|
||||
vec![
|
||||
//todo add "New Plans" when objective cards are implemented
|
||||
synergies(33, defensive_formation),
|
||||
synergies(34, archers),
|
||||
teach_us(35, defensive_formation),
|
||||
teach_us(36, archers),
|
||||
]
|
||||
}
|
||||
|
||||
fn synergies(id: u8, tactics_card: TacticsCardFactory) -> ActionCard {
|
||||
let mut b = ActionCard::builder(
|
||||
id,
|
||||
"Synergies",
|
||||
"Gain 2 advances from the same category without changing the Game Event counter. \
|
||||
Pay the price as usual.",
|
||||
ActionType::regular(),
|
||||
move |_game, p, _| !categories_with_2_affordable_advances(p).is_empty(),
|
||||
)
|
||||
.tactics_card(tactics_card)
|
||||
.add_advance_request(
|
||||
|e| &mut e.play_action_card,
|
||||
3,
|
||||
|game, p, _| {
|
||||
Some(AdvanceRequest::new(categories_with_2_affordable_advances(
|
||||
game.player(p),
|
||||
)))
|
||||
},
|
||||
|game, sel, _| {
|
||||
game.add_info_log_item(&format!(
|
||||
"{} selected {} as first advance for Synergies.",
|
||||
sel.player_name, sel.choice
|
||||
));
|
||||
},
|
||||
);
|
||||
b = pay_for_advance(b, 2);
|
||||
b = b.add_advance_request(
|
||||
|e| &mut e.play_action_card,
|
||||
1,
|
||||
|game, p, _| {
|
||||
let first = last_advance(game);
|
||||
Some(AdvanceRequest::new(
|
||||
advances::get_groups()
|
||||
.iter()
|
||||
.find(|g| g.advances.iter().any(|a| a.name == first))
|
||||
.expect("Advance group not found")
|
||||
.advances
|
||||
.iter()
|
||||
.filter(|a| game.player(p).can_advance(a))
|
||||
.map(|a| a.name.clone())
|
||||
.collect_vec(),
|
||||
))
|
||||
},
|
||||
|game, sel, _| {
|
||||
game.add_info_log_item(&format!(
|
||||
"{} selected {} as second advance for Synergies.",
|
||||
sel.player_name, sel.choice
|
||||
));
|
||||
},
|
||||
);
|
||||
b = pay_for_advance(b, 0);
|
||||
|
||||
b.build()
|
||||
}
|
||||
|
||||
fn pay_for_advance(b: ActionCardBuilder, priority: i32) -> ActionCardBuilder {
|
||||
b.add_payment_request_listener(
|
||||
|e| &mut e.play_action_card,
|
||||
priority,
|
||||
|game, player_index, _| {
|
||||
let p = game.player(player_index);
|
||||
let a = last_advance(game);
|
||||
Some(vec![PaymentRequest::new(
|
||||
p.advance_cost(&get_advance(&a), None).cost,
|
||||
&format!("Pay for {a}"),
|
||||
false,
|
||||
)])
|
||||
},
|
||||
|game, s, _| {
|
||||
let advance = last_advance(game);
|
||||
game.add_info_log_item(&format!(
|
||||
"{} paid {} for advance {advance}",
|
||||
s.player_name, s.choice[0]
|
||||
));
|
||||
gain_advance_without_payment(
|
||||
game,
|
||||
&advance,
|
||||
s.player_index,
|
||||
s.choice[0].clone(),
|
||||
false,
|
||||
);
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
fn last_advance(game: &Game) -> String {
|
||||
for i in current_player_turn_log(game).items.iter().rev() {
|
||||
if let Action::Response(EventResponse::SelectAdvance(a)) = &i.action {
|
||||
return a.clone();
|
||||
}
|
||||
}
|
||||
panic!("Advance action not found");
|
||||
}
|
||||
|
||||
fn categories_with_2_affordable_advances(p: &Player) -> Vec<String> {
|
||||
advances::get_groups()
|
||||
.iter()
|
||||
.flat_map(|g| {
|
||||
let vec = g
|
||||
.advances
|
||||
.iter()
|
||||
.filter(|a| !p.has_advance(&a.name))
|
||||
.collect_vec();
|
||||
if vec.len() < 2 {
|
||||
return vec![];
|
||||
}
|
||||
vec.iter()
|
||||
.permutations(2)
|
||||
.filter(|pair| {
|
||||
let a = pair[0];
|
||||
let b = pair[1];
|
||||
let mut cost = p.advance_cost(a, None).cost;
|
||||
cost.default += p.advance_cost(b, None).cost.default;
|
||||
p.can_afford(&cost) && p.can_advance_free(a) && p.can_advance_free(b)
|
||||
})
|
||||
.map(|pair| pair[0].name.clone())
|
||||
.collect_vec()
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn teach_us(id: u8, tactics_card: TacticsCardFactory) -> ActionCard {
|
||||
ActionCard::builder(
|
||||
id,
|
||||
"Teach Us",
|
||||
"If you just captured a city: Gain 1 advance from the loser for free \
|
||||
without changing the Game Event counter.",
|
||||
ActionType::free(),
|
||||
|game, player, a| !advances_to_copy_for_loser(game, player, a).is_empty(),
|
||||
)
|
||||
.requirement(CivilCardRequirement::new(
|
||||
vec![CivilCardOpportunity::CaptureCity],
|
||||
true,
|
||||
))
|
||||
.tactics_card(tactics_card)
|
||||
.add_advance_request(
|
||||
|e| &mut e.play_action_card,
|
||||
0,
|
||||
|game, player, a| {
|
||||
Some(AdvanceRequest::new(advances_to_copy_for_loser(
|
||||
game,
|
||||
game.player(player),
|
||||
a,
|
||||
)))
|
||||
},
|
||||
|game, sel, _| {
|
||||
let advance = &sel.choice;
|
||||
game.add_info_log_item(&format!(
|
||||
"{} selected {advance} as advance for Teach Us.",
|
||||
sel.player_name,
|
||||
));
|
||||
gain_advance_without_payment(
|
||||
game,
|
||||
advance,
|
||||
sel.player_index,
|
||||
ResourcePile::empty(),
|
||||
false,
|
||||
);
|
||||
},
|
||||
)
|
||||
.build()
|
||||
}
|
||||
|
||||
fn advances_to_copy_for_loser(game: &Game, winner: &Player, a: &ActionCardInfo) -> Vec<String> {
|
||||
let Some(action_log_index) = a.satisfying_action else {
|
||||
panic!("Satisfying action not found");
|
||||
};
|
||||
let Some(CivilCardMatch {
|
||||
opportunity: _,
|
||||
played_cards: _,
|
||||
opponent: Some(loser),
|
||||
}) = ¤t_player_turn_log(game).items[action_log_index].civil_card_match
|
||||
else {
|
||||
panic!("Capture city opportunity not found");
|
||||
};
|
||||
|
||||
game.player(*loser)
|
||||
.advances
|
||||
.iter()
|
||||
.filter(|a| !winner.has_advance(&a.name) && winner.can_advance_free(a))
|
||||
.map(|a| a.name.clone())
|
||||
.collect()
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
use crate::ability_initializer::AbilityInitializerSetup;
|
||||
use crate::advance::{Advance, AdvanceBuilder, gain_advance};
|
||||
use crate::advance::{Advance, AdvanceBuilder, gain_advance_without_payment};
|
||||
use crate::city_pieces::Building::Temple;
|
||||
use crate::consts::STACK_LIMIT;
|
||||
use crate::content::advances::{AdvanceGroup, advance_group_builder, get_group};
|
||||
|
|
@ -64,7 +64,13 @@ fn dogma() -> AdvanceBuilder {
|
|||
"{} {verb} {} as a reward for constructing a Temple",
|
||||
c.player_name, c.choice
|
||||
));
|
||||
gain_advance(game, &c.choice, c.player_index, ResourcePile::empty(), true);
|
||||
gain_advance_without_payment(
|
||||
game,
|
||||
&c.choice,
|
||||
c.player_index,
|
||||
ResourcePile::empty(),
|
||||
true,
|
||||
);
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use crate::combat_listeners::{
|
|||
};
|
||||
use crate::content::action_cards::cultural_takeover::use_cultural_takeover;
|
||||
use crate::content::action_cards::development::collect_only;
|
||||
use crate::content::action_cards::negotiation::use_negotiations;
|
||||
use crate::content::action_cards::negotiation::{use_assassination, use_negotiations};
|
||||
use crate::content::incidents::famine::pestilence_permanent_effect;
|
||||
use crate::content::incidents::great_builders::construct_only;
|
||||
use crate::content::incidents::great_diplomat::use_diplomatic_relations;
|
||||
|
|
@ -23,7 +23,7 @@ use crate::status_phase::{
|
|||
StatusPhaseState, complete_objectives, determine_first_player, draw_cards, free_advance,
|
||||
get_status_phase, may_change_government, raze_city,
|
||||
};
|
||||
use crate::unit::choose_carried_units_casualties;
|
||||
use crate::unit::choose_carried_units_to_remove;
|
||||
use crate::wonder::{build_wonder, on_draw_wonder_card};
|
||||
|
||||
pub struct Builtin {
|
||||
|
|
@ -81,10 +81,10 @@ pub fn get_all() -> Vec<Builtin> {
|
|||
explore_resolution(),
|
||||
on_draw_wonder_card(),
|
||||
build_wonder(),
|
||||
choose_carried_units_to_remove(),
|
||||
// combat related
|
||||
place_settler(),
|
||||
choose_fighter_casualties(),
|
||||
choose_carried_units_casualties(),
|
||||
offer_retreat(),
|
||||
combat_stats(),
|
||||
// incident related
|
||||
|
|
@ -102,6 +102,7 @@ pub fn get_all() -> Vec<Builtin> {
|
|||
collect_only(),
|
||||
use_cultural_takeover(),
|
||||
use_negotiations(),
|
||||
use_assassination(),
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ pub enum ConstructEffect {
|
|||
#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Debug)]
|
||||
pub enum CollectEffect {
|
||||
ProductionFocus,
|
||||
Overproduction,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)]
|
||||
|
|
@ -32,6 +33,7 @@ pub enum PermanentEffect {
|
|||
CulturalTakeover,
|
||||
DiplomaticRelations(DiplomaticRelations),
|
||||
Negotiations(Negotiations),
|
||||
Assassination(usize),
|
||||
}
|
||||
|
||||
impl PermanentEffect {
|
||||
|
|
@ -45,6 +47,7 @@ impl PermanentEffect {
|
|||
},
|
||||
PermanentEffect::Collect(c) => match c {
|
||||
CollectEffect::ProductionFocus => EventOrigin::CivilCard(19), // also 20
|
||||
CollectEffect::Overproduction => EventOrigin::Incident(29), // also 30
|
||||
},
|
||||
PermanentEffect::LoseAction(_) => EventOrigin::Incident(38),
|
||||
PermanentEffect::PublicWonderCard(_) => EventOrigin::Incident(40),
|
||||
|
|
@ -52,9 +55,10 @@ impl PermanentEffect {
|
|||
PermanentEffect::TrojanHorse => EventOrigin::Incident(42),
|
||||
PermanentEffect::Anarchy(_) => EventOrigin::Incident(44),
|
||||
PermanentEffect::DiplomaticRelations(_) => EventOrigin::Incident(DIPLOMAT_ID),
|
||||
PermanentEffect::Negotiations(_) => EventOrigin::CivilCard(23), // also 24
|
||||
// can also be 16, but that doesn't matter for the help text
|
||||
PermanentEffect::CulturalTakeover => EventOrigin::CivilCard(15),
|
||||
PermanentEffect::Negotiations(_) => EventOrigin::CivilCard(23), // also 24
|
||||
PermanentEffect::Assassination(_) => EventOrigin::CivilCard(27), // also 28
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ fn lose_action(game: &mut Game, player: usize) {
|
|||
} else {
|
||||
game.add_info_log_item(&format!("{name} lost an action"));
|
||||
game.actions_left -= 1;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::float_cmp)]
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ pub(crate) fn great_explorer() -> ActionCard {
|
|||
groups,
|
||||
|game, player| {
|
||||
!action_explore_request(game, player.index)
|
||||
.request
|
||||
.choices
|
||||
.is_empty()
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::ability_initializer::AbilityInitializerSetup;
|
||||
use crate::action_card::{ActionCard, ActionCardBuilder, gain_action_card_from_pile};
|
||||
use crate::advance::gain_advance;
|
||||
use crate::advance::gain_advance_without_payment;
|
||||
use crate::city::MoodState;
|
||||
use crate::city_pieces::Building;
|
||||
use crate::construct::{Construct, construct};
|
||||
|
|
@ -147,7 +147,7 @@ where
|
|||
name,
|
||||
description,
|
||||
action_type,
|
||||
can_play,
|
||||
move |game, player, _| can_play(game, player),
|
||||
)
|
||||
.add_advance_request(
|
||||
|e| &mut e.play_action_card,
|
||||
|
|
@ -165,7 +165,7 @@ where
|
|||
|game, s, _| {
|
||||
let name = &s.choice;
|
||||
game.add_info_log_item(&format!("{} gained {}", s.player_name, name));
|
||||
gain_advance(game, name, s.player_index, ResourcePile::empty(), false);
|
||||
gain_advance_without_payment(game, name, s.player_index, ResourcePile::empty(), false);
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ pub(crate) fn use_great_warlord() -> Builtin {
|
|||
if let Movement(m) = &mut game.state {
|
||||
if mem::replace(&mut m.great_warlord_used, false) {
|
||||
c.modifiers.push(CombatModifier::GreatWarlord);
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ fn black_death() -> Incident {
|
|||
let units = player.units.iter().map(|u| u.id).collect_vec();
|
||||
if units.len() < 4 {
|
||||
return None;
|
||||
};
|
||||
}
|
||||
|
||||
let mut needed = (units.len() / 4) as u8;
|
||||
if additional_sanitation_damage(player) {
|
||||
|
|
|
|||
|
|
@ -194,12 +194,14 @@ pub struct AdvanceRequest {
|
|||
|
||||
impl AdvanceRequest {
|
||||
#[must_use]
|
||||
pub fn new(choices: Vec<String>) -> Self {
|
||||
pub fn new(mut choices: Vec<String>) -> Self {
|
||||
choices.sort();
|
||||
choices.dedup();
|
||||
Self { choices }
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Debug)]
|
||||
#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Debug, PartialOrd, Ord)]
|
||||
pub struct SelectedStructure {
|
||||
pub position: Position,
|
||||
pub structure: Structure,
|
||||
|
|
@ -219,20 +221,7 @@ pub type StructuresRequest = MultiRequest<SelectedStructure>;
|
|||
|
||||
///
|
||||
/// If a player does not own a hand card, then it means that it's a swap card from another player
|
||||
#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Debug)]
|
||||
pub struct HandCardsRequest {
|
||||
#[serde(flatten)]
|
||||
pub request: MultiRequest<HandCard>,
|
||||
}
|
||||
|
||||
impl HandCardsRequest {
|
||||
#[must_use]
|
||||
pub fn new(cards: Vec<HandCard>, needed: RangeInclusive<u8>, description: &str) -> Self {
|
||||
HandCardsRequest {
|
||||
request: MultiRequest::new(cards, needed, description),
|
||||
}
|
||||
}
|
||||
}
|
||||
pub type HandCardsRequest = MultiRequest<HandCard>;
|
||||
|
||||
#[must_use]
|
||||
pub fn is_selected_structures_valid(game: &Game, selected: &[SelectedStructure]) -> bool {
|
||||
|
|
@ -249,21 +238,7 @@ pub fn is_selected_structures_valid(game: &Game, selected: &[SelectedStructure])
|
|||
})
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Debug)]
|
||||
pub struct PositionRequest {
|
||||
#[serde(flatten)]
|
||||
pub request: MultiRequest<Position>,
|
||||
}
|
||||
|
||||
impl PositionRequest {
|
||||
#[must_use]
|
||||
pub fn new(mut choices: Vec<Position>, needed: RangeInclusive<u8>, description: &str) -> Self {
|
||||
choices.sort();
|
||||
PositionRequest {
|
||||
request: MultiRequest::new(choices, needed, description),
|
||||
}
|
||||
}
|
||||
}
|
||||
pub type PositionRequest = MultiRequest<Position>;
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Debug)]
|
||||
pub struct UnitTypeRequest {
|
||||
|
|
@ -305,7 +280,7 @@ impl UnitsRequest {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Debug)]
|
||||
#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Debug, PartialOrd, Ord)]
|
||||
pub enum Structure {
|
||||
CityCenter,
|
||||
Building(Building),
|
||||
|
|
@ -330,9 +305,12 @@ pub struct MultiRequest<T> {
|
|||
pub description: String,
|
||||
}
|
||||
|
||||
impl<T> MultiRequest<T> {
|
||||
impl<T: PartialEq + Ord> MultiRequest<T> {
|
||||
#[must_use]
|
||||
pub fn new(choices: Vec<T>, needed: RangeInclusive<u8>, description: &str) -> Self {
|
||||
pub fn new(mut choices: Vec<T>, needed: RangeInclusive<u8>, description: &str) -> Self {
|
||||
choices.sort();
|
||||
choices.dedup();
|
||||
|
||||
Self {
|
||||
choices,
|
||||
needed,
|
||||
|
|
@ -380,7 +358,7 @@ impl EventResponse {
|
|||
let Some(s) = game.current_event_handler_mut() else {
|
||||
panic!("current custom phase event should be set")
|
||||
};
|
||||
s.response = Some(self.clone());
|
||||
s.response = Some(self);
|
||||
let details = game.current_event().event_type.clone();
|
||||
execute_custom_phase_action(game, player_index, details)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -356,7 +356,6 @@ pub(crate) fn scout(id: u8) -> TacticsCard {
|
|||
pub(crate) fn martyr(id: u8) -> TacticsCard {
|
||||
TacticsCard::builder(id, "Martyr", "todo")
|
||||
.fighter_any_requirement(&[FighterRequirement::Army, FighterRequirement::Ship])
|
||||
.target(TacticsCardTarget::AllPlayers)
|
||||
.add_units_request(
|
||||
|event| &mut event.combat_round_start_tactics,
|
||||
0,
|
||||
|
|
@ -389,3 +388,46 @@ pub(crate) fn martyr(id: u8) -> TacticsCard {
|
|||
)
|
||||
.build()
|
||||
}
|
||||
|
||||
pub(crate) fn archers(id: u8) -> TacticsCard {
|
||||
TacticsCard::builder(
|
||||
id,
|
||||
"Archers",
|
||||
"Roll a die: On a 5 or 6, the opponent loses 1 unit immediately.",
|
||||
)
|
||||
.fighter_requirement(FighterRequirement::Army)
|
||||
.add_units_request(
|
||||
|event| &mut event.combat_round_start_tactics,
|
||||
0,
|
||||
move |game, p, s| {
|
||||
if !s.is_active(p, id, TacticsCardTarget::Opponent) {
|
||||
return None;
|
||||
}
|
||||
|
||||
let roll = game.next_dice_roll().value;
|
||||
if roll >= 5 {
|
||||
game.add_info_log_item(&format!("Archers rolled a {roll} and scored a hit"));
|
||||
} else {
|
||||
game.add_info_log_item(&format!("Archers rolled a {roll} and did not score a hit"));
|
||||
return None;
|
||||
}
|
||||
|
||||
Some(UnitsRequest::new(
|
||||
p,
|
||||
s.combat.fighting_units(game, p),
|
||||
1..=1,
|
||||
"Select a unit to sacrifice for Archers",
|
||||
))
|
||||
},
|
||||
move |game, s, r| {
|
||||
let unit = s.choice[0];
|
||||
game.add_info_log_item(&format!(
|
||||
"{} sacrifices {} for Archers",
|
||||
game.player_name(s.player_index),
|
||||
a_or_an(game.player(s.player_index).get_unit(unit).unit_type.name())
|
||||
));
|
||||
kill_combat_units(game, &mut r.combat, s.player_index, &[unit]);
|
||||
},
|
||||
)
|
||||
.build()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,10 @@ pub struct Game {
|
|||
pub starting_player_index: usize,
|
||||
pub current_player_index: usize,
|
||||
pub action_log: Vec<ActionLogAge>,
|
||||
// index for the next action log
|
||||
pub action_log_index: usize,
|
||||
// transient to know what is the current action log
|
||||
pub(crate) current_action_log_index: Option<usize>,
|
||||
pub log: Vec<Vec<String>>,
|
||||
pub undo_limit: usize,
|
||||
pub actions_left: u32,
|
||||
|
|
@ -153,6 +156,7 @@ impl Game {
|
|||
current_player_index: starting_player,
|
||||
action_log: Vec::new(),
|
||||
action_log_index: 0,
|
||||
current_action_log_index: None,
|
||||
log: [String::from("The game has started")]
|
||||
.iter()
|
||||
.map(|s| vec![s.clone()])
|
||||
|
|
@ -209,6 +213,7 @@ impl Game {
|
|||
successful_cultural_influence: data.successful_cultural_influence,
|
||||
action_log: data.action_log,
|
||||
action_log_index: data.action_log_index,
|
||||
current_action_log_index: None,
|
||||
log: data.log,
|
||||
undo_limit: data.undo_limit,
|
||||
round: data.round,
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ pub fn strip_secret(mut game: Game, player_index: Option<usize>) -> Game {
|
|||
if let Some(handler) = &mut current_event_player.handler {
|
||||
if let PersistentEventRequest::SelectHandCards(c) = &mut handler.request {
|
||||
// player shouldn't see other player's hand cards
|
||||
c.request.choices.clear();
|
||||
c.choices.clear();
|
||||
}
|
||||
if let Some(EventResponse::SelectHandCards(c)) = &mut handler.response {
|
||||
// player shouldn't see other player's hand cards
|
||||
|
|
|
|||
|
|
@ -416,7 +416,7 @@ fn reachable_with_roads(player: &Player, units: &[u32], game: &Game) -> Vec<Move
|
|||
if map.is_sea(start) {
|
||||
// not for disembarking
|
||||
return vec![];
|
||||
};
|
||||
}
|
||||
|
||||
return start
|
||||
.neighbors()
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ impl Display for PaymentOptions {
|
|||
PaymentConversionType::MayNotOverpay(i) => {
|
||||
write!(f, " (limit: {i})")?;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -195,7 +195,13 @@ impl Player {
|
|||
.units
|
||||
.iter()
|
||||
// carried units are added to carriers
|
||||
.filter(|unit| unit.carrier_id.is_none())
|
||||
.filter(|unit| {
|
||||
if let Some(carrier_id) = unit.carrier_id {
|
||||
// satety check
|
||||
let _ = self.get_unit(carrier_id);
|
||||
}
|
||||
unit.carrier_id.is_none()
|
||||
})
|
||||
.sorted_by_key(|unit| unit.id)
|
||||
.map(|u| u.data(&self))
|
||||
.collect();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::action_card::play_action_card;
|
||||
use crate::advance::gain_advance;
|
||||
use crate::action_card::{ActionCardInfo, play_action_card};
|
||||
use crate::advance::gain_advance_without_payment;
|
||||
use crate::city::MoodState;
|
||||
use crate::collect::{PositionCollection, collect};
|
||||
use crate::construct::Construct;
|
||||
|
|
@ -94,14 +94,17 @@ impl PlayingActionType {
|
|||
}
|
||||
|
||||
let civil_card = get_civil_card(*id);
|
||||
if !(civil_card.can_play)(game, p) {
|
||||
return Err("Cannot play action card".to_string());
|
||||
}
|
||||
let mut satisfying_action: Option<usize> = None;
|
||||
if let Some(requirement) = civil_card.requirement {
|
||||
if requirement.satisfying_action(game, *id, false).is_none() {
|
||||
if let Some(action_log_index) = requirement.satisfying_action(game, *id) {
|
||||
satisfying_action = Some(action_log_index);
|
||||
} else {
|
||||
return Err("Requirement not met".to_string());
|
||||
}
|
||||
}
|
||||
if !(civil_card.can_play)(game, p, &ActionCardInfo::new(*id, satisfying_action)) {
|
||||
return Err("Cannot play action card".to_string());
|
||||
}
|
||||
}
|
||||
PlayingActionType::WonderCard(name) => {
|
||||
if !p.wonder_cards.contains(name) {
|
||||
|
|
@ -183,7 +186,7 @@ impl PlayingAction {
|
|||
game.player(player_index)
|
||||
.advance_cost(&a, Some(&payment))
|
||||
.pay(game, &payment);
|
||||
gain_advance(game, &advance, player_index, payment, true);
|
||||
gain_advance_without_payment(game, &advance, player_index, payment, true);
|
||||
}
|
||||
FoundCity { settler } => {
|
||||
let settler = game.players[player_index].remove_unit(settler);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::ability_initializer::AbilityInitializerSetup;
|
||||
use crate::action_card::gain_action_card_from_pile;
|
||||
use crate::advance::{do_advance, gain_advance, remove_advance};
|
||||
use crate::advance::{do_advance, gain_advance_without_payment, remove_advance};
|
||||
use crate::consts::AGES;
|
||||
use crate::content::builtin::{Builtin, status_phase_handler};
|
||||
use crate::content::persistent_events::{
|
||||
|
|
@ -126,7 +126,13 @@ pub(crate) fn free_advance() -> Builtin {
|
|||
"{} advanced {} for free",
|
||||
c.player_name, c.choice
|
||||
));
|
||||
gain_advance(game, &c.choice, c.player_index, ResourcePile::empty(), true);
|
||||
gain_advance_without_payment(
|
||||
game,
|
||||
&c.choice,
|
||||
c.player_index,
|
||||
ResourcePile::empty(),
|
||||
true,
|
||||
);
|
||||
},
|
||||
)
|
||||
.build()
|
||||
|
|
|
|||
|
|
@ -50,15 +50,18 @@ pub(crate) fn to_serde_value(game: &Game) -> Value {
|
|||
|
||||
pub fn redo(game: &mut Game, player_index: usize) -> Result<(), String> {
|
||||
let copy = current_player_turn_log(game).item(game).clone();
|
||||
game.current_action_log_index = Some(game.action_log_index);
|
||||
game.action_log_index += 1;
|
||||
add_log_item_from_action(game, ©.action);
|
||||
match ¤t_player_turn_log(game).item(game).action.clone() {
|
||||
Action::Playing(action) => action.clone().execute(game, player_index, true),
|
||||
Action::Movement(action) => execute_movement_action(game, action.clone(), player_index),
|
||||
Action::Response(action) => action.clone().redo(game, player_index),
|
||||
|
||||
match copy.action.clone() {
|
||||
Action::Playing(action) => action.execute(game, player_index, true),
|
||||
Action::Movement(action) => execute_movement_action(game, action, player_index),
|
||||
Action::Response(action) => action.redo(game, player_index),
|
||||
Action::Undo => return Err("undo action can't be redone".to_string()),
|
||||
Action::Redo => return Err("redo action can't be redone".to_string()),
|
||||
}?;
|
||||
game.action_log_index += 1;
|
||||
check_for_waste(game);
|
||||
game.current_action_log_index = None;
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ use UnitType::*;
|
|||
use itertools::Itertools;
|
||||
use num::Zero;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::iter;
|
||||
use std::{
|
||||
fmt::Display,
|
||||
ops::{AddAssign, SubAssign},
|
||||
|
|
@ -288,7 +287,7 @@ impl Units {
|
|||
#[must_use]
|
||||
pub fn to_vec(self) -> Vec<UnitType> {
|
||||
self.into_iter()
|
||||
.flat_map(|(u, c)| iter::repeat(u).take(c as usize))
|
||||
.flat_map(|(u, c)| std::iter::repeat_n(u, c as usize))
|
||||
.collect()
|
||||
}
|
||||
|
||||
|
|
@ -315,7 +314,7 @@ impl AddAssign<&UnitType> for Units {
|
|||
Cavalry => self.cavalry += 1,
|
||||
Elephant => self.elephants += 1,
|
||||
Leader => self.leaders += 1,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -328,7 +327,7 @@ impl SubAssign<&UnitType> for Units {
|
|||
Cavalry => self.cavalry -= 1,
|
||||
Elephant => self.elephants -= 1,
|
||||
Leader => self.leaders -= 1,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -556,7 +555,7 @@ fn save_carried_units(game: &mut Game, player: usize, pos: Position) {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn choose_carried_units_casualties() -> Builtin {
|
||||
pub(crate) fn choose_carried_units_to_remove() -> Builtin {
|
||||
Builtin::builder(
|
||||
"Choose Casualties (carried units)",
|
||||
"Choose which carried units to remove.",
|
||||
|
|
|
|||
|
|
@ -293,3 +293,91 @@ fn test_negotiations() {
|
|||
],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_assassination() {
|
||||
JSON.test(
|
||||
"assassination",
|
||||
vec![
|
||||
TestAction::undoable(0, Action::Playing(PlayingAction::ActionCard(27)))
|
||||
.without_json_comparison(),
|
||||
TestAction::not_undoable(0, Action::Playing(PlayingAction::EndTurn))
|
||||
.without_json_comparison(),
|
||||
TestAction::not_undoable(1, Action::Playing(PlayingAction::EndTurn)).with_pre_assert(
|
||||
|game| {
|
||||
assert_eq!(game.actions_left, 2);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_overproduction() {
|
||||
JSON.test(
|
||||
"overproduction",
|
||||
vec![
|
||||
TestAction::undoable(0, Action::Playing(PlayingAction::ActionCard(29)))
|
||||
.without_json_comparison(),
|
||||
TestAction::undoable(
|
||||
0,
|
||||
Action::Playing(PlayingAction::Collect(playing_actions::Collect {
|
||||
city_position: Position::from_offset("C2"),
|
||||
collections: vec![
|
||||
PositionCollection::new(Position::from_offset("B1"), ResourcePile::ore(1)),
|
||||
PositionCollection::new(Position::from_offset("B2"), ResourcePile::wood(1)),
|
||||
PositionCollection::new(
|
||||
Position::from_offset("C3"),
|
||||
ResourcePile::mood_tokens(1),
|
||||
),
|
||||
],
|
||||
})),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_synergies() {
|
||||
JSON.test(
|
||||
"synergies",
|
||||
vec![
|
||||
TestAction::undoable(0, Action::Playing(PlayingAction::ActionCard(34)))
|
||||
.without_json_comparison(),
|
||||
TestAction::undoable(
|
||||
0,
|
||||
Action::Response(EventResponse::SelectAdvance("Cartography".to_string())),
|
||||
)
|
||||
.without_json_comparison(),
|
||||
TestAction::undoable(
|
||||
0,
|
||||
Action::Response(EventResponse::Payment(vec![ResourcePile::ideas(2)])),
|
||||
)
|
||||
.without_json_comparison(),
|
||||
TestAction::undoable(
|
||||
0,
|
||||
Action::Response(EventResponse::SelectAdvance("War Ships".to_string())),
|
||||
)
|
||||
.without_json_comparison(),
|
||||
TestAction::undoable(
|
||||
0,
|
||||
Action::Response(EventResponse::Payment(vec![ResourcePile::ideas(2)])),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_teach_us() {
|
||||
JSON.test(
|
||||
"teach_us",
|
||||
vec![
|
||||
TestAction::not_undoable(
|
||||
0,
|
||||
move_action(vec![0, 1, 2, 3, 4, 5], Position::from_offset("C1")),
|
||||
)
|
||||
.without_json_comparison(),
|
||||
TestAction::undoable(0, Action::Playing(PlayingAction::ActionCard(35))),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -201,6 +201,32 @@ impl TestAction {
|
|||
}
|
||||
}
|
||||
|
||||
struct TestContext {
|
||||
name: String,
|
||||
index: usize,
|
||||
phase: String,
|
||||
}
|
||||
|
||||
impl TestContext {
|
||||
fn new(name: &str, index: usize, phase: &str) -> Self {
|
||||
Self {
|
||||
name: name.to_string(),
|
||||
index,
|
||||
phase: phase.to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for TestContext {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"name: {}, index: {}, phase: {}",
|
||||
self.name, self.index, self.phase
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn test_actions(test: &JsonTest, name: &str, actions: Vec<TestAction>) {
|
||||
let outcome: fn(name: &GamePath, i: usize) -> GamePath = |name, i| {
|
||||
let local = if i == 0 {
|
||||
|
|
@ -220,10 +246,19 @@ pub(crate) fn test_actions(test: &JsonTest, name: &str, actions: Vec<TestAction>
|
|||
outcome(&path, i - 1)
|
||||
};
|
||||
let compare = mem::replace(&mut last_json_compare, action.compare_json);
|
||||
let mut context = TestContext::new(name, i, "EXECUTE");
|
||||
game = catch_unwind(AssertUnwindSafe(|| {
|
||||
test_action_internal(game, name, &from, &outcome(&path, i), action, compare)
|
||||
test_action_internal(
|
||||
game,
|
||||
name,
|
||||
&from,
|
||||
&outcome(&path, i),
|
||||
action,
|
||||
compare,
|
||||
&mut context,
|
||||
)
|
||||
}))
|
||||
.unwrap_or_else(|e| panic!("test action {i} should not panic: {e:?}"));
|
||||
.unwrap_or_else(|e| panic!("{context}: {e:?}"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -234,6 +269,7 @@ fn test_action_internal(
|
|||
outcome: &GamePath,
|
||||
test: TestAction,
|
||||
last_json_compare: bool,
|
||||
context: &mut TestContext,
|
||||
) -> Game {
|
||||
let action = test.action;
|
||||
let a = serde_json::to_string(&action).expect("action should be serializable");
|
||||
|
|
@ -283,6 +319,7 @@ fn test_action_internal(
|
|||
} else {
|
||||
"".to_string()
|
||||
},
|
||||
context,
|
||||
);
|
||||
game
|
||||
}
|
||||
|
|
@ -337,7 +374,9 @@ fn undo_redo(
|
|||
original_path: &GamePath,
|
||||
outcome_path: &GamePath,
|
||||
expected_game: String,
|
||||
context: &mut TestContext,
|
||||
) {
|
||||
context.phase = "UNDO".to_string();
|
||||
let game = game_api::execute(game, Action::Undo, player_index);
|
||||
if compare_json {
|
||||
let mut trimmed_game = game.clone();
|
||||
|
|
@ -352,6 +391,7 @@ fn undo_redo(
|
|||
),
|
||||
);
|
||||
}
|
||||
context.phase = "REDO".to_string();
|
||||
let game = game_api::execute(game, Action::Redo, player_index);
|
||||
if compare_json {
|
||||
assert_eq_game_json(
|
||||
|
|
|
|||
|
|
@ -201,3 +201,22 @@ fn test_martyr() {
|
|||
],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_archers() {
|
||||
JSON.test(
|
||||
"archers",
|
||||
vec![
|
||||
TestAction::not_undoable(0, move_action(vec![0], Position::from_offset("C1")))
|
||||
.without_json_comparison(),
|
||||
TestAction::not_undoable(
|
||||
0,
|
||||
Action::Response(EventResponse::SelectHandCards(vec![HandCard::ActionCard(
|
||||
26,
|
||||
)])),
|
||||
)
|
||||
.without_json_comparison(),
|
||||
TestAction::not_undoable(1, Action::Response(EventResponse::SelectUnits(vec![1]))),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,21 +14,21 @@
|
|||
"request": {
|
||||
"SelectAdvance": {
|
||||
"choices": [
|
||||
"Storage",
|
||||
"Irrigation",
|
||||
"Husbandry",
|
||||
"Arts",
|
||||
"Bartering",
|
||||
"Draft",
|
||||
"Engineering",
|
||||
"Sanitation",
|
||||
"Roads",
|
||||
"Fishing",
|
||||
"Writing",
|
||||
"Husbandry",
|
||||
"Irrigation",
|
||||
"Math",
|
||||
"Myths",
|
||||
"Roads",
|
||||
"Sanitation",
|
||||
"Siegecraft",
|
||||
"Steel Weapons",
|
||||
"Draft",
|
||||
"Myths",
|
||||
"Bartering",
|
||||
"Arts",
|
||||
"Math"
|
||||
"Storage",
|
||||
"Writing"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
@ -291,4 +291,4 @@
|
|||
"Pyramids"
|
||||
],
|
||||
"action_cards_left": []
|
||||
}
|
||||
}
|
||||
|
|
@ -242,21 +242,21 @@
|
|||
"request": {
|
||||
"SelectAdvance": {
|
||||
"choices": [
|
||||
"Storage",
|
||||
"Irrigation",
|
||||
"Husbandry",
|
||||
"Arts",
|
||||
"Bartering",
|
||||
"Draft",
|
||||
"Engineering",
|
||||
"Sanitation",
|
||||
"Roads",
|
||||
"Fishing",
|
||||
"Writing",
|
||||
"Husbandry",
|
||||
"Irrigation",
|
||||
"Math",
|
||||
"Myths",
|
||||
"Roads",
|
||||
"Sanitation",
|
||||
"Siegecraft",
|
||||
"Steel Weapons",
|
||||
"Draft",
|
||||
"Myths",
|
||||
"Bartering",
|
||||
"Arts",
|
||||
"Math"
|
||||
"Storage",
|
||||
"Writing"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
280
server/tests/test_games/action_cards/assassination.json
Normal file
280
server/tests/test_games/action_cards/assassination.json
Normal file
|
|
@ -0,0 +1,280 @@
|
|||
{
|
||||
"state": "Playing",
|
||||
"players": [
|
||||
{
|
||||
"id": 0,
|
||||
"resources": {
|
||||
"food": 3,
|
||||
"wood": 6,
|
||||
"ore": 6,
|
||||
"gold": 7,
|
||||
"culture_tokens": 7
|
||||
},
|
||||
"resource_limit": {
|
||||
"food": 2,
|
||||
"wood": 7,
|
||||
"ore": 7,
|
||||
"ideas": 7,
|
||||
"gold": 7,
|
||||
"mood_tokens": 7,
|
||||
"culture_tokens": 7
|
||||
},
|
||||
"cities": [
|
||||
{
|
||||
"city_pieces": {
|
||||
"temple": 1
|
||||
},
|
||||
"mood_state": "Neutral",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "C2"
|
||||
},
|
||||
{
|
||||
"city_pieces": {},
|
||||
"mood_state": "Happy",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "C1"
|
||||
},
|
||||
{
|
||||
"city_pieces": {},
|
||||
"mood_state": "Happy",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "B2"
|
||||
},
|
||||
{
|
||||
"city_pieces": {},
|
||||
"mood_state": "Happy",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "B3"
|
||||
}
|
||||
],
|
||||
"units": [
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Infantry",
|
||||
"id": 0
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Infantry",
|
||||
"movement_restrictions": [
|
||||
"Battle"
|
||||
],
|
||||
"id": 1
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Elephant",
|
||||
"id": 3
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Settler",
|
||||
"id": 4
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Settler",
|
||||
"id": 5
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Settler",
|
||||
"id": 6
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Settler",
|
||||
"id": 7
|
||||
}
|
||||
],
|
||||
"civilization": "test0",
|
||||
"advances": [
|
||||
"Arts",
|
||||
"Bartering",
|
||||
"Currency",
|
||||
"Farming",
|
||||
"Mining",
|
||||
"Tactics"
|
||||
],
|
||||
"incident_tokens": 1,
|
||||
"action_cards": [
|
||||
27
|
||||
],
|
||||
"next_unit_id": 8
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"resources": {
|
||||
"food": 2,
|
||||
"wood": 7,
|
||||
"ore": 7,
|
||||
"ideas": 7,
|
||||
"gold": 7,
|
||||
"mood_tokens": 7,
|
||||
"culture_tokens": 7
|
||||
},
|
||||
"resource_limit": {
|
||||
"food": 2,
|
||||
"wood": 7,
|
||||
"ore": 7,
|
||||
"ideas": 7,
|
||||
"gold": 7,
|
||||
"mood_tokens": 7,
|
||||
"culture_tokens": 7
|
||||
},
|
||||
"cities": [
|
||||
{
|
||||
"city_pieces": {
|
||||
"fortress": 0
|
||||
},
|
||||
"mood_state": "Angry",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "A1"
|
||||
},
|
||||
{
|
||||
"city_pieces": {},
|
||||
"mood_state": "Happy",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "A3"
|
||||
},
|
||||
{
|
||||
"city_pieces": {
|
||||
"fortress": 0
|
||||
},
|
||||
"mood_state": "Happy",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "A4"
|
||||
}
|
||||
],
|
||||
"units": [
|
||||
{
|
||||
"position": "B1",
|
||||
"unit_type": "Infantry",
|
||||
"id": 0
|
||||
}
|
||||
],
|
||||
"civilization": "test1",
|
||||
"advances": [
|
||||
"Farming",
|
||||
"Mining"
|
||||
],
|
||||
"incident_tokens": 3,
|
||||
"next_unit_id": 2
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"resource_limit": {
|
||||
"food": 2,
|
||||
"wood": 7,
|
||||
"ore": 7,
|
||||
"ideas": 7,
|
||||
"gold": 7
|
||||
},
|
||||
"civilization": "Barbarians",
|
||||
"incident_tokens": 3,
|
||||
"next_unit_id": 0
|
||||
}
|
||||
],
|
||||
"map": {
|
||||
"tiles": [
|
||||
[
|
||||
"A1",
|
||||
"Fertile"
|
||||
],
|
||||
[
|
||||
"A2",
|
||||
"Water"
|
||||
],
|
||||
[
|
||||
"A3",
|
||||
"Mountain"
|
||||
],
|
||||
[
|
||||
"A4",
|
||||
"Mountain"
|
||||
],
|
||||
[
|
||||
"B1",
|
||||
"Mountain"
|
||||
],
|
||||
[
|
||||
"B2",
|
||||
"Forest"
|
||||
],
|
||||
[
|
||||
"B3",
|
||||
"Fertile"
|
||||
],
|
||||
[
|
||||
"C1",
|
||||
"Barren"
|
||||
],
|
||||
[
|
||||
"C2",
|
||||
"Forest"
|
||||
],
|
||||
[
|
||||
"C3",
|
||||
"Water"
|
||||
],
|
||||
[
|
||||
"D2",
|
||||
"Water"
|
||||
]
|
||||
]
|
||||
},
|
||||
"starting_player_index": 0,
|
||||
"current_player_index": 0,
|
||||
"action_log": [
|
||||
{
|
||||
"rounds": [
|
||||
{
|
||||
"players": [
|
||||
{
|
||||
"index": 0,
|
||||
"items": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"action_log_index": 0,
|
||||
"log": [],
|
||||
"undo_limit": 0,
|
||||
"actions_left": 3,
|
||||
"round": 1,
|
||||
"age": 1,
|
||||
"messages": [
|
||||
"The game has started"
|
||||
],
|
||||
"dice_roll_outcomes": [
|
||||
1,
|
||||
1,
|
||||
10,
|
||||
10,
|
||||
10,
|
||||
10,
|
||||
10,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"dice_roll_log": [
|
||||
10
|
||||
],
|
||||
"dropped_players": [],
|
||||
"wonders_left": [
|
||||
"Pyramids"
|
||||
],
|
||||
"action_cards_left": [],
|
||||
"incidents_left": [
|
||||
57
|
||||
]
|
||||
}
|
||||
326
server/tests/test_games/action_cards/assassination.outcome2.json
Normal file
326
server/tests/test_games/action_cards/assassination.outcome2.json
Normal file
|
|
@ -0,0 +1,326 @@
|
|||
{
|
||||
"state": "Playing",
|
||||
"players": [
|
||||
{
|
||||
"id": 0,
|
||||
"resources": {
|
||||
"food": 3,
|
||||
"wood": 6,
|
||||
"ore": 6,
|
||||
"gold": 7,
|
||||
"culture_tokens": 6
|
||||
},
|
||||
"resource_limit": {
|
||||
"food": 2,
|
||||
"wood": 7,
|
||||
"ore": 7,
|
||||
"ideas": 7,
|
||||
"gold": 7,
|
||||
"mood_tokens": 7,
|
||||
"culture_tokens": 7
|
||||
},
|
||||
"cities": [
|
||||
{
|
||||
"city_pieces": {
|
||||
"temple": 1
|
||||
},
|
||||
"mood_state": "Neutral",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "C2"
|
||||
},
|
||||
{
|
||||
"city_pieces": {},
|
||||
"mood_state": "Happy",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "C1"
|
||||
},
|
||||
{
|
||||
"city_pieces": {},
|
||||
"mood_state": "Happy",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "B2"
|
||||
},
|
||||
{
|
||||
"city_pieces": {},
|
||||
"mood_state": "Happy",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "B3"
|
||||
}
|
||||
],
|
||||
"units": [
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Infantry",
|
||||
"id": 0
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Infantry",
|
||||
"id": 1
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Elephant",
|
||||
"id": 3
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Settler",
|
||||
"id": 4
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Settler",
|
||||
"id": 5
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Settler",
|
||||
"id": 6
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Settler",
|
||||
"id": 7
|
||||
}
|
||||
],
|
||||
"civilization": "test0",
|
||||
"advances": [
|
||||
"Arts",
|
||||
"Bartering",
|
||||
"Currency",
|
||||
"Farming",
|
||||
"Mining",
|
||||
"Tactics"
|
||||
],
|
||||
"incident_tokens": 1,
|
||||
"next_unit_id": 8
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"resources": {
|
||||
"food": 2,
|
||||
"wood": 7,
|
||||
"ore": 7,
|
||||
"ideas": 7,
|
||||
"gold": 7,
|
||||
"mood_tokens": 7,
|
||||
"culture_tokens": 7
|
||||
},
|
||||
"resource_limit": {
|
||||
"food": 2,
|
||||
"wood": 7,
|
||||
"ore": 7,
|
||||
"ideas": 7,
|
||||
"gold": 7,
|
||||
"mood_tokens": 7,
|
||||
"culture_tokens": 7
|
||||
},
|
||||
"cities": [
|
||||
{
|
||||
"city_pieces": {
|
||||
"fortress": 0
|
||||
},
|
||||
"mood_state": "Angry",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "A1"
|
||||
},
|
||||
{
|
||||
"city_pieces": {},
|
||||
"mood_state": "Happy",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "A3"
|
||||
},
|
||||
{
|
||||
"city_pieces": {
|
||||
"fortress": 0
|
||||
},
|
||||
"mood_state": "Happy",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "A4"
|
||||
}
|
||||
],
|
||||
"units": [
|
||||
{
|
||||
"position": "B1",
|
||||
"unit_type": "Infantry",
|
||||
"id": 0
|
||||
}
|
||||
],
|
||||
"civilization": "test1",
|
||||
"advances": [
|
||||
"Farming",
|
||||
"Mining"
|
||||
],
|
||||
"incident_tokens": 3,
|
||||
"next_unit_id": 2
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"resource_limit": {
|
||||
"food": 2,
|
||||
"wood": 7,
|
||||
"ore": 7,
|
||||
"ideas": 7,
|
||||
"gold": 7
|
||||
},
|
||||
"civilization": "Barbarians",
|
||||
"incident_tokens": 3,
|
||||
"next_unit_id": 0
|
||||
}
|
||||
],
|
||||
"map": {
|
||||
"tiles": [
|
||||
[
|
||||
"A1",
|
||||
"Fertile"
|
||||
],
|
||||
[
|
||||
"A2",
|
||||
"Water"
|
||||
],
|
||||
[
|
||||
"A3",
|
||||
"Mountain"
|
||||
],
|
||||
[
|
||||
"A4",
|
||||
"Mountain"
|
||||
],
|
||||
[
|
||||
"B1",
|
||||
"Mountain"
|
||||
],
|
||||
[
|
||||
"B2",
|
||||
"Forest"
|
||||
],
|
||||
[
|
||||
"B3",
|
||||
"Fertile"
|
||||
],
|
||||
[
|
||||
"C1",
|
||||
"Barren"
|
||||
],
|
||||
[
|
||||
"C2",
|
||||
"Forest"
|
||||
],
|
||||
[
|
||||
"C3",
|
||||
"Water"
|
||||
],
|
||||
[
|
||||
"D2",
|
||||
"Water"
|
||||
]
|
||||
]
|
||||
},
|
||||
"starting_player_index": 0,
|
||||
"current_player_index": 0,
|
||||
"action_log": [
|
||||
{
|
||||
"rounds": [
|
||||
{
|
||||
"players": [
|
||||
{
|
||||
"index": 0,
|
||||
"items": [
|
||||
{
|
||||
"action": {
|
||||
"Playing": {
|
||||
"ActionCard": 27
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": {
|
||||
"Playing": "EndTurn"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"index": 1,
|
||||
"items": [
|
||||
{
|
||||
"action": {
|
||||
"Playing": "EndTurn"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"players": [
|
||||
{
|
||||
"index": 0,
|
||||
"items": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"action_log_index": 0,
|
||||
"log": [
|
||||
[
|
||||
"Player1 played the action card Assassination for 1 culture token",
|
||||
"Player2 has been assassinated by Player1."
|
||||
],
|
||||
[
|
||||
"Player1 ended their turn with 3 actions left"
|
||||
],
|
||||
[
|
||||
"It's Player2's turn",
|
||||
"Player2 has lost an action due to assassination."
|
||||
],
|
||||
[
|
||||
"Player2 ended their turn with 2 actions left"
|
||||
],
|
||||
[
|
||||
"Round 2/3"
|
||||
],
|
||||
[
|
||||
"It's Player1's turn"
|
||||
]
|
||||
],
|
||||
"undo_limit": 0,
|
||||
"actions_left": 3,
|
||||
"round": 2,
|
||||
"age": 1,
|
||||
"messages": [
|
||||
"The game has started"
|
||||
],
|
||||
"dice_roll_outcomes": [
|
||||
1,
|
||||
1,
|
||||
10,
|
||||
10,
|
||||
10,
|
||||
10,
|
||||
10,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"dice_roll_log": [
|
||||
10
|
||||
],
|
||||
"dropped_players": [],
|
||||
"wonders_left": [
|
||||
"Pyramids"
|
||||
],
|
||||
"action_cards_left": [],
|
||||
"incidents_left": [
|
||||
57
|
||||
]
|
||||
}
|
||||
|
|
@ -221,10 +221,11 @@
|
|||
}
|
||||
},
|
||||
"civil_card_match": {
|
||||
"opportunity": "WinLandBattle",
|
||||
"opportunity": "CaptureCity",
|
||||
"played_cards": [
|
||||
11
|
||||
]
|
||||
],
|
||||
"opponent": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -261,7 +262,9 @@
|
|||
"Player1 marched 2 settlers, 1 infantry, 1 cavalry, 1 elephant and a leader from C2 to C1"
|
||||
],
|
||||
[
|
||||
"Combat round 1"
|
||||
"Combat round 1",
|
||||
"Attackers: 2 settlers, 1 infantry, 1 cavalry, 1 elephant and a leader",
|
||||
"Defenders: 2 infantry"
|
||||
],
|
||||
[
|
||||
"Player1 did not play a Tactics Card",
|
||||
|
|
|
|||
|
|
@ -222,7 +222,8 @@
|
|||
}
|
||||
},
|
||||
"civil_card_match": {
|
||||
"opportunity": "WinLandBattle"
|
||||
"opportunity": "CaptureCity",
|
||||
"opponent": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -238,7 +239,9 @@
|
|||
"Player1 marched 2 settlers, 1 infantry, 1 cavalry, 1 elephant and a leader from C2 to C1"
|
||||
],
|
||||
[
|
||||
"Combat round 1"
|
||||
"Combat round 1",
|
||||
"Attackers: 2 settlers, 1 infantry, 1 cavalry, 1 elephant and a leader",
|
||||
"Defenders: 2 infantry"
|
||||
],
|
||||
[
|
||||
"Player1 did not play a Tactics Card",
|
||||
|
|
|
|||
|
|
@ -219,10 +219,11 @@
|
|||
}
|
||||
},
|
||||
"civil_card_match": {
|
||||
"opportunity": "WinLandBattle",
|
||||
"opportunity": "CaptureCity",
|
||||
"played_cards": [
|
||||
5
|
||||
]
|
||||
],
|
||||
"opponent": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -380,7 +381,8 @@
|
|||
"event_type": {
|
||||
"ActionCard": {
|
||||
"answer": true,
|
||||
"id": 5
|
||||
"id": 5,
|
||||
"satisfying_action": 1
|
||||
}
|
||||
},
|
||||
"handler": {
|
||||
|
|
@ -427,7 +429,9 @@
|
|||
"Player1 marched 2 settlers, 1 infantry, 1 cavalry, 1 elephant and a leader from C2 to C1"
|
||||
],
|
||||
[
|
||||
"Combat round 1"
|
||||
"Combat round 1",
|
||||
"Attackers: 2 settlers, 1 infantry, 1 cavalry, 1 elephant and a leader",
|
||||
"Defenders: 2 infantry"
|
||||
],
|
||||
[
|
||||
"Player1 did not play a Tactics Card",
|
||||
|
|
|
|||
|
|
@ -387,6 +387,8 @@
|
|||
],
|
||||
[
|
||||
"Combat round 1",
|
||||
"Attackers: 2 infantry and 1 elephant",
|
||||
"Defenders: 1 infantry",
|
||||
"Barbarians rolled 6 (Infantry, +1 combat value), 6 (Infantry, +1 combat value), 6 (Infantry, no bonus) for combined combat value of 20 and gets 1 hits against defending units.",
|
||||
"Player1 rolled 6 (Infantry, +1 combat value) for combined combat value of 7 and gets 1 hits against attacking units.",
|
||||
"Barbarians has to remove 1 of their attacking units",
|
||||
|
|
|
|||
|
|
@ -307,6 +307,8 @@
|
|||
],
|
||||
[
|
||||
"Combat round 1",
|
||||
"Attackers: 1 infantry",
|
||||
"Defenders: 1 infantry",
|
||||
"Player1 rolled 6 (Infantry, +1 combat value) for combined combat value of 7 and gets 1 hits against defending units.",
|
||||
"Player2 rolled 6 (Infantry, +1 combat value) for combined combat value of 7 and gets 1 hits against attacking units.",
|
||||
"Player1 has to remove all of their attacking units",
|
||||
|
|
|
|||
262
server/tests/test_games/action_cards/overproduction.json
Normal file
262
server/tests/test_games/action_cards/overproduction.json
Normal file
|
|
@ -0,0 +1,262 @@
|
|||
{
|
||||
"state": "Playing",
|
||||
"players": [
|
||||
{
|
||||
"id": 0,
|
||||
"resources": {
|
||||
"food": 1,
|
||||
"wood": 6,
|
||||
"ore": 5,
|
||||
"ideas": 5,
|
||||
"gold": 7,
|
||||
"mood_tokens": 8,
|
||||
"culture_tokens": 7
|
||||
},
|
||||
"resource_limit": {
|
||||
"food": 7,
|
||||
"wood": 7,
|
||||
"ore": 7,
|
||||
"ideas": 7,
|
||||
"gold": 7,
|
||||
"mood_tokens": 7,
|
||||
"culture_tokens": 7
|
||||
},
|
||||
"cities": [
|
||||
{
|
||||
"city_pieces": {},
|
||||
"mood_state": "Happy",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "A1"
|
||||
},
|
||||
{
|
||||
"city_pieces": {
|
||||
"port": 0
|
||||
},
|
||||
"mood_state": "Angry",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "C2",
|
||||
"port_position": "C3"
|
||||
}
|
||||
],
|
||||
"units": [
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Settler",
|
||||
"id": 4
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Settler",
|
||||
"id": 5
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Settler",
|
||||
"id": 6
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Settler",
|
||||
"id": 7
|
||||
}
|
||||
],
|
||||
"civilization": "test0",
|
||||
"advances": [
|
||||
"Farming",
|
||||
"Fishing",
|
||||
"Mining",
|
||||
"Storage",
|
||||
"Tactics"
|
||||
],
|
||||
"incident_tokens": 3,
|
||||
"action_cards": [
|
||||
29
|
||||
],
|
||||
"next_unit_id": 8
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"resources": {
|
||||
"food": 1,
|
||||
"mood_tokens": 1
|
||||
},
|
||||
"resource_limit": {
|
||||
"food": 2,
|
||||
"wood": 7,
|
||||
"ore": 7,
|
||||
"ideas": 7,
|
||||
"gold": 7,
|
||||
"mood_tokens": 7,
|
||||
"culture_tokens": 7
|
||||
},
|
||||
"cities": [
|
||||
{
|
||||
"city_pieces": {},
|
||||
"mood_state": "Angry",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "C1"
|
||||
}
|
||||
],
|
||||
"units": [
|
||||
{
|
||||
"position": "C1",
|
||||
"unit_type": "Infantry",
|
||||
"id": 0
|
||||
},
|
||||
{
|
||||
"position": "C1",
|
||||
"unit_type": "Infantry",
|
||||
"id": 1
|
||||
}
|
||||
],
|
||||
"civilization": "test1",
|
||||
"advances": [
|
||||
"Farming",
|
||||
"Fishing",
|
||||
"Mining"
|
||||
],
|
||||
"incident_tokens": 2,
|
||||
"action_cards": [
|
||||
18
|
||||
],
|
||||
"next_unit_id": 2
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"resource_limit": {
|
||||
"food": 2,
|
||||
"wood": 7,
|
||||
"ore": 7,
|
||||
"ideas": 7,
|
||||
"gold": 7
|
||||
},
|
||||
"cities": [
|
||||
{
|
||||
"city_pieces": {},
|
||||
"mood_state": "Neutral",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "B3"
|
||||
}
|
||||
],
|
||||
"units": [
|
||||
{
|
||||
"position": "D1",
|
||||
"unit_type": "Ship",
|
||||
"id": 5
|
||||
},
|
||||
{
|
||||
"position": "D1",
|
||||
"unit_type": "Ship",
|
||||
"id": 6
|
||||
},
|
||||
{
|
||||
"position": "A2",
|
||||
"unit_type": "Ship",
|
||||
"id": 9
|
||||
}
|
||||
],
|
||||
"civilization": "Pirates",
|
||||
"incident_tokens": 3,
|
||||
"next_unit_id": 11
|
||||
}
|
||||
],
|
||||
"map": {
|
||||
"tiles": [
|
||||
[
|
||||
"A1",
|
||||
"Fertile"
|
||||
],
|
||||
[
|
||||
"A2",
|
||||
"Water"
|
||||
],
|
||||
[
|
||||
"A3",
|
||||
"Mountain"
|
||||
],
|
||||
[
|
||||
"B1",
|
||||
"Mountain"
|
||||
],
|
||||
[
|
||||
"B2",
|
||||
"Forest"
|
||||
],
|
||||
[
|
||||
"B3",
|
||||
"Fertile"
|
||||
],
|
||||
[
|
||||
"C1",
|
||||
"Barren"
|
||||
],
|
||||
[
|
||||
"C2",
|
||||
"Forest"
|
||||
],
|
||||
[
|
||||
"C3",
|
||||
"Water"
|
||||
],
|
||||
[
|
||||
"D1",
|
||||
"Water"
|
||||
],
|
||||
[
|
||||
"D2",
|
||||
"Water"
|
||||
]
|
||||
]
|
||||
},
|
||||
"starting_player_index": 0,
|
||||
"current_player_index": 0,
|
||||
"action_log": [
|
||||
{
|
||||
"rounds": [
|
||||
{
|
||||
"players": [
|
||||
{
|
||||
"index": 0,
|
||||
"items": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"action_log_index": 0,
|
||||
"log": [],
|
||||
"undo_limit": 0,
|
||||
"actions_left": 3,
|
||||
"round": 1,
|
||||
"age": 2,
|
||||
"messages": [
|
||||
"The game has started"
|
||||
],
|
||||
"dice_roll_outcomes": [
|
||||
1,
|
||||
1,
|
||||
10,
|
||||
10,
|
||||
10,
|
||||
10,
|
||||
10,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"dice_roll_log": [
|
||||
10
|
||||
],
|
||||
"dropped_players": [],
|
||||
"wonders_left": [
|
||||
"Pyramids"
|
||||
],
|
||||
"action_cards_left": [],
|
||||
"incidents_left": [
|
||||
26
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,366 @@
|
|||
{
|
||||
"state": "Playing",
|
||||
"players": [
|
||||
{
|
||||
"id": 0,
|
||||
"resources": {
|
||||
"food": 1,
|
||||
"wood": 7,
|
||||
"ore": 6,
|
||||
"ideas": 5,
|
||||
"gold": 7,
|
||||
"mood_tokens": 9,
|
||||
"culture_tokens": 6
|
||||
},
|
||||
"resource_limit": {
|
||||
"food": 7,
|
||||
"wood": 7,
|
||||
"ore": 7,
|
||||
"ideas": 7,
|
||||
"gold": 7,
|
||||
"mood_tokens": 7,
|
||||
"culture_tokens": 7
|
||||
},
|
||||
"cities": [
|
||||
{
|
||||
"city_pieces": {},
|
||||
"mood_state": "Happy",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "A1"
|
||||
},
|
||||
{
|
||||
"city_pieces": {
|
||||
"port": 0
|
||||
},
|
||||
"mood_state": "Angry",
|
||||
"activations": 1,
|
||||
"angry_activation": true,
|
||||
"position": "C2",
|
||||
"port_position": "C3"
|
||||
}
|
||||
],
|
||||
"units": [
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Settler",
|
||||
"id": 4
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Settler",
|
||||
"id": 5
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Settler",
|
||||
"id": 6
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Settler",
|
||||
"id": 7
|
||||
}
|
||||
],
|
||||
"civilization": "test0",
|
||||
"advances": [
|
||||
"Farming",
|
||||
"Fishing",
|
||||
"Mining",
|
||||
"Storage",
|
||||
"Tactics"
|
||||
],
|
||||
"incident_tokens": 3,
|
||||
"next_unit_id": 8
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"resources": {
|
||||
"food": 1,
|
||||
"mood_tokens": 1
|
||||
},
|
||||
"resource_limit": {
|
||||
"food": 2,
|
||||
"wood": 7,
|
||||
"ore": 7,
|
||||
"ideas": 7,
|
||||
"gold": 7,
|
||||
"mood_tokens": 7,
|
||||
"culture_tokens": 7
|
||||
},
|
||||
"cities": [
|
||||
{
|
||||
"city_pieces": {},
|
||||
"mood_state": "Angry",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "C1"
|
||||
}
|
||||
],
|
||||
"units": [
|
||||
{
|
||||
"position": "C1",
|
||||
"unit_type": "Infantry",
|
||||
"id": 0
|
||||
},
|
||||
{
|
||||
"position": "C1",
|
||||
"unit_type": "Infantry",
|
||||
"id": 1
|
||||
}
|
||||
],
|
||||
"civilization": "test1",
|
||||
"advances": [
|
||||
"Farming",
|
||||
"Fishing",
|
||||
"Mining"
|
||||
],
|
||||
"incident_tokens": 2,
|
||||
"action_cards": [
|
||||
18
|
||||
],
|
||||
"next_unit_id": 2
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"resource_limit": {
|
||||
"food": 2,
|
||||
"wood": 7,
|
||||
"ore": 7,
|
||||
"ideas": 7,
|
||||
"gold": 7
|
||||
},
|
||||
"cities": [
|
||||
{
|
||||
"city_pieces": {},
|
||||
"mood_state": "Neutral",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "B3"
|
||||
}
|
||||
],
|
||||
"units": [
|
||||
{
|
||||
"position": "D1",
|
||||
"unit_type": "Ship",
|
||||
"id": 5
|
||||
},
|
||||
{
|
||||
"position": "D1",
|
||||
"unit_type": "Ship",
|
||||
"id": 6
|
||||
},
|
||||
{
|
||||
"position": "A2",
|
||||
"unit_type": "Ship",
|
||||
"id": 9
|
||||
}
|
||||
],
|
||||
"civilization": "Pirates",
|
||||
"incident_tokens": 3,
|
||||
"next_unit_id": 11
|
||||
}
|
||||
],
|
||||
"map": {
|
||||
"tiles": [
|
||||
[
|
||||
"A1",
|
||||
"Fertile"
|
||||
],
|
||||
[
|
||||
"A2",
|
||||
"Water"
|
||||
],
|
||||
[
|
||||
"A3",
|
||||
"Mountain"
|
||||
],
|
||||
[
|
||||
"B1",
|
||||
"Mountain"
|
||||
],
|
||||
[
|
||||
"B2",
|
||||
"Forest"
|
||||
],
|
||||
[
|
||||
"B3",
|
||||
"Fertile"
|
||||
],
|
||||
[
|
||||
"C1",
|
||||
"Barren"
|
||||
],
|
||||
[
|
||||
"C2",
|
||||
"Forest"
|
||||
],
|
||||
[
|
||||
"C3",
|
||||
"Water"
|
||||
],
|
||||
[
|
||||
"D1",
|
||||
"Water"
|
||||
],
|
||||
[
|
||||
"D2",
|
||||
"Water"
|
||||
]
|
||||
]
|
||||
},
|
||||
"starting_player_index": 0,
|
||||
"current_player_index": 0,
|
||||
"action_log": [
|
||||
{
|
||||
"rounds": [
|
||||
{
|
||||
"players": [
|
||||
{
|
||||
"index": 0,
|
||||
"items": [
|
||||
{
|
||||
"action": {
|
||||
"Playing": {
|
||||
"ActionCard": 29
|
||||
}
|
||||
},
|
||||
"undo": [
|
||||
{
|
||||
"op": "add",
|
||||
"path": "/players/0/action_cards",
|
||||
"value": [
|
||||
29
|
||||
]
|
||||
},
|
||||
{
|
||||
"op": "replace",
|
||||
"path": "/players/0/resources/culture_tokens",
|
||||
"value": 7
|
||||
},
|
||||
{
|
||||
"op": "remove",
|
||||
"path": "/permanent_effects"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"action": {
|
||||
"Playing": {
|
||||
"Collect": {
|
||||
"city_position": "C2",
|
||||
"collections": [
|
||||
{
|
||||
"position": "B1",
|
||||
"pile": {
|
||||
"ore": 1
|
||||
},
|
||||
"times": 1
|
||||
},
|
||||
{
|
||||
"position": "B2",
|
||||
"pile": {
|
||||
"wood": 1
|
||||
},
|
||||
"times": 1
|
||||
},
|
||||
{
|
||||
"position": "C3",
|
||||
"pile": {
|
||||
"mood_tokens": 1
|
||||
},
|
||||
"times": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"undo": [
|
||||
{
|
||||
"op": "replace",
|
||||
"path": "/actions_left",
|
||||
"value": 3
|
||||
},
|
||||
{
|
||||
"op": "add",
|
||||
"path": "/permanent_effects",
|
||||
"value": [
|
||||
{
|
||||
"Collect": "Overproduction"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"op": "replace",
|
||||
"path": "/players/0/cities/1/activations",
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"op": "replace",
|
||||
"path": "/players/0/cities/1/angry_activation",
|
||||
"value": false
|
||||
},
|
||||
{
|
||||
"op": "replace",
|
||||
"path": "/players/0/resources/mood_tokens",
|
||||
"value": 8
|
||||
},
|
||||
{
|
||||
"op": "replace",
|
||||
"path": "/players/0/resources/ore",
|
||||
"value": 5
|
||||
},
|
||||
{
|
||||
"op": "replace",
|
||||
"path": "/players/0/resources/wood",
|
||||
"value": 6
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"action_log_index": 2,
|
||||
"log": [
|
||||
[
|
||||
"Player1 played the action card Overproduction for 1 culture token",
|
||||
"Player1 can use Overproduction to collect from 2 additional tiles."
|
||||
],
|
||||
[
|
||||
"Player1 collects 1 ore, 1 wood and 1 mood token in the city at C2"
|
||||
]
|
||||
],
|
||||
"undo_limit": 0,
|
||||
"actions_left": 2,
|
||||
"round": 1,
|
||||
"age": 2,
|
||||
"messages": [
|
||||
"The game has started"
|
||||
],
|
||||
"dice_roll_outcomes": [
|
||||
1,
|
||||
1,
|
||||
10,
|
||||
10,
|
||||
10,
|
||||
10,
|
||||
10,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"dice_roll_log": [
|
||||
10
|
||||
],
|
||||
"dropped_players": [],
|
||||
"wonders_left": [
|
||||
"Pyramids"
|
||||
],
|
||||
"action_cards_left": [],
|
||||
"incidents_left": [
|
||||
26
|
||||
]
|
||||
}
|
||||
306
server/tests/test_games/action_cards/synergies.json
Normal file
306
server/tests/test_games/action_cards/synergies.json
Normal file
|
|
@ -0,0 +1,306 @@
|
|||
{
|
||||
"state": "Playing",
|
||||
"players": [
|
||||
{
|
||||
"id": 0,
|
||||
"resources": {
|
||||
"food": 1,
|
||||
"wood": 6,
|
||||
"ore": 5,
|
||||
"ideas": 5,
|
||||
"gold": 7,
|
||||
"mood_tokens": 8,
|
||||
"culture_tokens": 7
|
||||
},
|
||||
"resource_limit": {
|
||||
"food": 7,
|
||||
"wood": 7,
|
||||
"ore": 7,
|
||||
"ideas": 7,
|
||||
"gold": 7,
|
||||
"mood_tokens": 7,
|
||||
"culture_tokens": 7
|
||||
},
|
||||
"cities": [
|
||||
{
|
||||
"city_pieces": {},
|
||||
"mood_state": "Happy",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "A1"
|
||||
},
|
||||
{
|
||||
"city_pieces": {
|
||||
"port": 0
|
||||
},
|
||||
"mood_state": "Angry",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "C2",
|
||||
"port_position": "C3"
|
||||
}
|
||||
],
|
||||
"units": [
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Settler",
|
||||
"id": 4
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Settler",
|
||||
"id": 5
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Settler",
|
||||
"id": 6
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Settler",
|
||||
"id": 7
|
||||
}
|
||||
],
|
||||
"civilization": "test0",
|
||||
"advances": [
|
||||
"Farming",
|
||||
"Fishing",
|
||||
"Mining",
|
||||
"Storage",
|
||||
"Tactics"
|
||||
],
|
||||
"incident_tokens": 3,
|
||||
"action_cards": [
|
||||
34
|
||||
],
|
||||
"next_unit_id": 8
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"resources": {
|
||||
"food": 1,
|
||||
"mood_tokens": 1
|
||||
},
|
||||
"resource_limit": {
|
||||
"food": 2,
|
||||
"wood": 7,
|
||||
"ore": 7,
|
||||
"ideas": 7,
|
||||
"gold": 7,
|
||||
"mood_tokens": 7,
|
||||
"culture_tokens": 7
|
||||
},
|
||||
"cities": [
|
||||
{
|
||||
"city_pieces": {},
|
||||
"mood_state": "Angry",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "C1"
|
||||
}
|
||||
],
|
||||
"units": [
|
||||
{
|
||||
"position": "C1",
|
||||
"unit_type": "Infantry",
|
||||
"id": 0
|
||||
},
|
||||
{
|
||||
"position": "C1",
|
||||
"unit_type": "Infantry",
|
||||
"id": 1
|
||||
}
|
||||
],
|
||||
"civilization": "test1",
|
||||
"advances": [
|
||||
"Farming",
|
||||
"Fishing",
|
||||
"Mining"
|
||||
],
|
||||
"incident_tokens": 2,
|
||||
"action_cards": [
|
||||
18
|
||||
],
|
||||
"next_unit_id": 2
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"resource_limit": {
|
||||
"food": 2,
|
||||
"wood": 7,
|
||||
"ore": 7,
|
||||
"ideas": 7,
|
||||
"gold": 7
|
||||
},
|
||||
"cities": [
|
||||
{
|
||||
"city_pieces": {},
|
||||
"mood_state": "Neutral",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "B3"
|
||||
}
|
||||
],
|
||||
"units": [
|
||||
{
|
||||
"position": "D1",
|
||||
"unit_type": "Ship",
|
||||
"id": 5
|
||||
},
|
||||
{
|
||||
"position": "D1",
|
||||
"unit_type": "Ship",
|
||||
"id": 6
|
||||
},
|
||||
{
|
||||
"position": "A2",
|
||||
"unit_type": "Ship",
|
||||
"id": 9
|
||||
}
|
||||
],
|
||||
"civilization": "Pirates",
|
||||
"incident_tokens": 3,
|
||||
"next_unit_id": 11
|
||||
}
|
||||
],
|
||||
"map": {
|
||||
"tiles": [
|
||||
[
|
||||
"A1",
|
||||
"Fertile"
|
||||
],
|
||||
[
|
||||
"A2",
|
||||
"Water"
|
||||
],
|
||||
[
|
||||
"A3",
|
||||
"Mountain"
|
||||
],
|
||||
[
|
||||
"B1",
|
||||
"Mountain"
|
||||
],
|
||||
[
|
||||
"B2",
|
||||
"Forest"
|
||||
],
|
||||
[
|
||||
"B3",
|
||||
"Fertile"
|
||||
],
|
||||
[
|
||||
"C1",
|
||||
"Barren"
|
||||
],
|
||||
[
|
||||
"C2",
|
||||
"Forest"
|
||||
],
|
||||
[
|
||||
"C3",
|
||||
"Water"
|
||||
],
|
||||
[
|
||||
"D1",
|
||||
"Water"
|
||||
],
|
||||
[
|
||||
"D2",
|
||||
"Water"
|
||||
]
|
||||
]
|
||||
},
|
||||
"starting_player_index": 0,
|
||||
"current_player_index": 0,
|
||||
"action_log": [
|
||||
{
|
||||
"rounds": [
|
||||
{
|
||||
"players": [
|
||||
{
|
||||
"index": 0,
|
||||
"items": [
|
||||
{
|
||||
"action": {
|
||||
"Playing": {
|
||||
"ActionCard": 34
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": {
|
||||
"Response": {
|
||||
"SelectAdvance": "Cartography"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": {
|
||||
"Response": {
|
||||
"Payment": [
|
||||
{
|
||||
"ideas": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": {
|
||||
"Response": {
|
||||
"SelectAdvance": "War Ships"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": {
|
||||
"Response": {
|
||||
"Payment": [
|
||||
{
|
||||
"ideas": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"action_log_index": 0,
|
||||
"log": [],
|
||||
"undo_limit": 0,
|
||||
"actions_left": 3,
|
||||
"round": 1,
|
||||
"age": 2,
|
||||
"messages": [
|
||||
"The game has started"
|
||||
],
|
||||
"dice_roll_outcomes": [
|
||||
1,
|
||||
1,
|
||||
10,
|
||||
10,
|
||||
10,
|
||||
10,
|
||||
10,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"dice_roll_log": [
|
||||
10
|
||||
],
|
||||
"dropped_players": [],
|
||||
"wonders_left": [
|
||||
"Pyramids"
|
||||
],
|
||||
"action_cards_left": [],
|
||||
"incidents_left": [
|
||||
26
|
||||
]
|
||||
}
|
||||
564
server/tests/test_games/action_cards/synergies.outcome4.json
Normal file
564
server/tests/test_games/action_cards/synergies.outcome4.json
Normal file
|
|
@ -0,0 +1,564 @@
|
|||
{
|
||||
"state": "Playing",
|
||||
"players": [
|
||||
{
|
||||
"id": 0,
|
||||
"resources": {
|
||||
"food": 1,
|
||||
"wood": 6,
|
||||
"ore": 5,
|
||||
"ideas": 1,
|
||||
"gold": 7,
|
||||
"mood_tokens": 8,
|
||||
"culture_tokens": 8
|
||||
},
|
||||
"resource_limit": {
|
||||
"food": 7,
|
||||
"wood": 7,
|
||||
"ore": 7,
|
||||
"ideas": 7,
|
||||
"gold": 7,
|
||||
"mood_tokens": 7,
|
||||
"culture_tokens": 7
|
||||
},
|
||||
"cities": [
|
||||
{
|
||||
"city_pieces": {},
|
||||
"mood_state": "Happy",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "A1"
|
||||
},
|
||||
{
|
||||
"city_pieces": {
|
||||
"port": 0
|
||||
},
|
||||
"mood_state": "Angry",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "C2",
|
||||
"port_position": "C3"
|
||||
}
|
||||
],
|
||||
"units": [
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Settler",
|
||||
"id": 4
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Settler",
|
||||
"id": 5
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Settler",
|
||||
"id": 6
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Settler",
|
||||
"id": 7
|
||||
}
|
||||
],
|
||||
"civilization": "test0",
|
||||
"advances": [
|
||||
"Cartography",
|
||||
"Farming",
|
||||
"Fishing",
|
||||
"Mining",
|
||||
"Storage",
|
||||
"Tactics",
|
||||
"War Ships"
|
||||
],
|
||||
"incident_tokens": 3,
|
||||
"next_unit_id": 8
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"resources": {
|
||||
"food": 1,
|
||||
"mood_tokens": 1
|
||||
},
|
||||
"resource_limit": {
|
||||
"food": 2,
|
||||
"wood": 7,
|
||||
"ore": 7,
|
||||
"ideas": 7,
|
||||
"gold": 7,
|
||||
"mood_tokens": 7,
|
||||
"culture_tokens": 7
|
||||
},
|
||||
"cities": [
|
||||
{
|
||||
"city_pieces": {},
|
||||
"mood_state": "Angry",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "C1"
|
||||
}
|
||||
],
|
||||
"units": [
|
||||
{
|
||||
"position": "C1",
|
||||
"unit_type": "Infantry",
|
||||
"id": 0
|
||||
},
|
||||
{
|
||||
"position": "C1",
|
||||
"unit_type": "Infantry",
|
||||
"id": 1
|
||||
}
|
||||
],
|
||||
"civilization": "test1",
|
||||
"advances": [
|
||||
"Farming",
|
||||
"Fishing",
|
||||
"Mining"
|
||||
],
|
||||
"incident_tokens": 2,
|
||||
"action_cards": [
|
||||
18
|
||||
],
|
||||
"next_unit_id": 2
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"resource_limit": {
|
||||
"food": 2,
|
||||
"wood": 7,
|
||||
"ore": 7,
|
||||
"ideas": 7,
|
||||
"gold": 7
|
||||
},
|
||||
"cities": [
|
||||
{
|
||||
"city_pieces": {},
|
||||
"mood_state": "Neutral",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "B3"
|
||||
}
|
||||
],
|
||||
"units": [
|
||||
{
|
||||
"position": "D1",
|
||||
"unit_type": "Ship",
|
||||
"id": 5
|
||||
},
|
||||
{
|
||||
"position": "D1",
|
||||
"unit_type": "Ship",
|
||||
"id": 6
|
||||
},
|
||||
{
|
||||
"position": "A2",
|
||||
"unit_type": "Ship",
|
||||
"id": 9
|
||||
}
|
||||
],
|
||||
"civilization": "Pirates",
|
||||
"incident_tokens": 3,
|
||||
"next_unit_id": 11
|
||||
}
|
||||
],
|
||||
"map": {
|
||||
"tiles": [
|
||||
[
|
||||
"A1",
|
||||
"Fertile"
|
||||
],
|
||||
[
|
||||
"A2",
|
||||
"Water"
|
||||
],
|
||||
[
|
||||
"A3",
|
||||
"Mountain"
|
||||
],
|
||||
[
|
||||
"B1",
|
||||
"Mountain"
|
||||
],
|
||||
[
|
||||
"B2",
|
||||
"Forest"
|
||||
],
|
||||
[
|
||||
"B3",
|
||||
"Fertile"
|
||||
],
|
||||
[
|
||||
"C1",
|
||||
"Barren"
|
||||
],
|
||||
[
|
||||
"C2",
|
||||
"Forest"
|
||||
],
|
||||
[
|
||||
"C3",
|
||||
"Water"
|
||||
],
|
||||
[
|
||||
"D1",
|
||||
"Water"
|
||||
],
|
||||
[
|
||||
"D2",
|
||||
"Water"
|
||||
]
|
||||
]
|
||||
},
|
||||
"starting_player_index": 0,
|
||||
"current_player_index": 0,
|
||||
"action_log": [
|
||||
{
|
||||
"rounds": [
|
||||
{
|
||||
"players": [
|
||||
{
|
||||
"index": 0,
|
||||
"items": [
|
||||
{
|
||||
"action": {
|
||||
"Playing": {
|
||||
"ActionCard": 34
|
||||
}
|
||||
},
|
||||
"undo": [
|
||||
{
|
||||
"op": "replace",
|
||||
"path": "/actions_left",
|
||||
"value": 3
|
||||
},
|
||||
{
|
||||
"op": "add",
|
||||
"path": "/players/0/action_cards",
|
||||
"value": [
|
||||
34
|
||||
]
|
||||
},
|
||||
{
|
||||
"op": "remove",
|
||||
"path": "/events"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"action": {
|
||||
"Response": {
|
||||
"SelectAdvance": "Cartography"
|
||||
}
|
||||
},
|
||||
"undo": [
|
||||
{
|
||||
"op": "replace",
|
||||
"path": "/events/0/handler/priority",
|
||||
"value": 3
|
||||
},
|
||||
{
|
||||
"op": "add",
|
||||
"path": "/events/0/handler/request/SelectAdvance",
|
||||
"value": {
|
||||
"choices": [
|
||||
"Cartography",
|
||||
"Draft",
|
||||
"Engineering",
|
||||
"Husbandry",
|
||||
"Irrigation",
|
||||
"Navigation",
|
||||
"Roads",
|
||||
"Sanitation",
|
||||
"Siegecraft",
|
||||
"Steel Weapons",
|
||||
"War Ships"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "remove",
|
||||
"path": "/events/0/handler/request/Payment"
|
||||
},
|
||||
{
|
||||
"op": "replace",
|
||||
"path": "/events/0/last_priority_used",
|
||||
"value": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"action": {
|
||||
"Response": {
|
||||
"Payment": [
|
||||
{
|
||||
"ideas": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"undo": [
|
||||
{
|
||||
"op": "replace",
|
||||
"path": "/events/0/handler/priority",
|
||||
"value": 2
|
||||
},
|
||||
{
|
||||
"op": "add",
|
||||
"path": "/events/0/handler/request/Payment",
|
||||
"value": [
|
||||
{
|
||||
"cost": {
|
||||
"conversions": [
|
||||
{
|
||||
"from": [
|
||||
{
|
||||
"ideas": 1
|
||||
}
|
||||
],
|
||||
"to": {
|
||||
"food": 1
|
||||
},
|
||||
"type": "Unlimited"
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
{
|
||||
"food": 1
|
||||
}
|
||||
],
|
||||
"to": {
|
||||
"gold": 1
|
||||
},
|
||||
"type": "Unlimited"
|
||||
}
|
||||
],
|
||||
"default": {
|
||||
"ideas": 2
|
||||
}
|
||||
},
|
||||
"name": "Pay for Cartography",
|
||||
"optional": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"op": "remove",
|
||||
"path": "/events/0/handler/request/SelectAdvance"
|
||||
},
|
||||
{
|
||||
"op": "replace",
|
||||
"path": "/events/0/last_priority_used",
|
||||
"value": 2
|
||||
},
|
||||
{
|
||||
"op": "replace",
|
||||
"path": "/players/0/advances/0",
|
||||
"value": "Farming"
|
||||
},
|
||||
{
|
||||
"op": "replace",
|
||||
"path": "/players/0/advances/1",
|
||||
"value": "Fishing"
|
||||
},
|
||||
{
|
||||
"op": "replace",
|
||||
"path": "/players/0/advances/2",
|
||||
"value": "Mining"
|
||||
},
|
||||
{
|
||||
"op": "replace",
|
||||
"path": "/players/0/advances/3",
|
||||
"value": "Storage"
|
||||
},
|
||||
{
|
||||
"op": "replace",
|
||||
"path": "/players/0/advances/4",
|
||||
"value": "Tactics"
|
||||
},
|
||||
{
|
||||
"op": "remove",
|
||||
"path": "/players/0/advances/5"
|
||||
},
|
||||
{
|
||||
"op": "replace",
|
||||
"path": "/players/0/resources/culture_tokens",
|
||||
"value": 7
|
||||
},
|
||||
{
|
||||
"op": "replace",
|
||||
"path": "/players/0/resources/ideas",
|
||||
"value": 5
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"action": {
|
||||
"Response": {
|
||||
"SelectAdvance": "War Ships"
|
||||
}
|
||||
},
|
||||
"undo": [
|
||||
{
|
||||
"op": "replace",
|
||||
"path": "/events/0/handler/priority",
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"op": "add",
|
||||
"path": "/events/0/handler/request/SelectAdvance",
|
||||
"value": {
|
||||
"choices": [
|
||||
"Navigation",
|
||||
"War Ships"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "remove",
|
||||
"path": "/events/0/handler/request/Payment"
|
||||
},
|
||||
{
|
||||
"op": "replace",
|
||||
"path": "/events/0/last_priority_used",
|
||||
"value": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"action": {
|
||||
"Response": {
|
||||
"Payment": [
|
||||
{
|
||||
"ideas": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"undo": [
|
||||
{
|
||||
"op": "add",
|
||||
"path": "/events",
|
||||
"value": [
|
||||
{
|
||||
"event_type": {
|
||||
"ActionCard": {
|
||||
"id": 34
|
||||
}
|
||||
},
|
||||
"handler": {
|
||||
"origin": {
|
||||
"CivilCard": 34
|
||||
},
|
||||
"priority": 0,
|
||||
"request": {
|
||||
"Payment": [
|
||||
{
|
||||
"cost": {
|
||||
"conversions": [
|
||||
{
|
||||
"from": [
|
||||
{
|
||||
"ideas": 1
|
||||
}
|
||||
],
|
||||
"to": {
|
||||
"food": 1
|
||||
},
|
||||
"type": "Unlimited"
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
{
|
||||
"food": 1
|
||||
}
|
||||
],
|
||||
"to": {
|
||||
"gold": 1
|
||||
},
|
||||
"type": "Unlimited"
|
||||
}
|
||||
],
|
||||
"default": {
|
||||
"ideas": 2
|
||||
}
|
||||
},
|
||||
"name": "Pay for War Ships",
|
||||
"optional": false
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"last_priority_used": 0,
|
||||
"player": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"op": "remove",
|
||||
"path": "/players/0/advances/6"
|
||||
},
|
||||
{
|
||||
"op": "replace",
|
||||
"path": "/players/0/resources/ideas",
|
||||
"value": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"action_log_index": 5,
|
||||
"log": [
|
||||
[
|
||||
"Player1 played the action card Synergies as a regular action"
|
||||
],
|
||||
[
|
||||
"Player1 selected Cartography as first advance for Synergies."
|
||||
],
|
||||
[
|
||||
"Player1 paid 2 ideas for advance Cartography",
|
||||
"Player gained 1 culture token as advance bonus"
|
||||
],
|
||||
[
|
||||
"Player1 selected War Ships as second advance for Synergies."
|
||||
],
|
||||
[
|
||||
"Player1 paid 2 ideas for advance War Ships"
|
||||
]
|
||||
],
|
||||
"undo_limit": 0,
|
||||
"actions_left": 2,
|
||||
"round": 1,
|
||||
"age": 2,
|
||||
"messages": [
|
||||
"The game has started"
|
||||
],
|
||||
"dice_roll_outcomes": [
|
||||
1,
|
||||
1,
|
||||
10,
|
||||
10,
|
||||
10,
|
||||
10,
|
||||
10,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"dice_roll_log": [
|
||||
10
|
||||
],
|
||||
"dropped_players": [],
|
||||
"wonders_left": [
|
||||
"Pyramids"
|
||||
],
|
||||
"action_cards_left": [],
|
||||
"incidents_left": [
|
||||
26
|
||||
]
|
||||
}
|
||||
239
server/tests/test_games/action_cards/teach_us.json
Normal file
239
server/tests/test_games/action_cards/teach_us.json
Normal file
|
|
@ -0,0 +1,239 @@
|
|||
{
|
||||
"state": {
|
||||
"Movement": {
|
||||
"movement_actions_left": 1
|
||||
}
|
||||
},
|
||||
"players": [
|
||||
{
|
||||
"id": 0,
|
||||
"resources": {
|
||||
"food": 2,
|
||||
"wood": 7,
|
||||
"ore": 7,
|
||||
"ideas": 3,
|
||||
"gold": 7,
|
||||
"mood_tokens": 7,
|
||||
"culture_tokens": 7
|
||||
},
|
||||
"resource_limit": {
|
||||
"food": 2,
|
||||
"wood": 7,
|
||||
"ore": 7,
|
||||
"ideas": 7,
|
||||
"gold": 7,
|
||||
"mood_tokens": 7,
|
||||
"culture_tokens": 7
|
||||
},
|
||||
"cities": [
|
||||
{
|
||||
"city_pieces": {},
|
||||
"mood_state": "Happy",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "A1"
|
||||
},
|
||||
{
|
||||
"city_pieces": {},
|
||||
"mood_state": "Neutral",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "C2"
|
||||
}
|
||||
],
|
||||
"units": [
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Infantry",
|
||||
"id": 0
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Cavalry",
|
||||
"id": 1
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Leader",
|
||||
"id": 2
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Elephant",
|
||||
"id": 3
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Settler",
|
||||
"id": 4
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Settler",
|
||||
"id": 5
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Settler",
|
||||
"id": 6
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Settler",
|
||||
"id": 7
|
||||
}
|
||||
],
|
||||
"civilization": "test0",
|
||||
"advances": [
|
||||
"Farming",
|
||||
"Mining",
|
||||
"Tactics"
|
||||
],
|
||||
"incident_tokens": 2,
|
||||
"action_cards": [
|
||||
35
|
||||
],
|
||||
"next_unit_id": 8
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"resources": {
|
||||
"food": 2,
|
||||
"wood": 7,
|
||||
"ore": 7,
|
||||
"ideas": 7,
|
||||
"gold": 7,
|
||||
"mood_tokens": 7,
|
||||
"culture_tokens": 7
|
||||
},
|
||||
"resource_limit": {
|
||||
"food": 2,
|
||||
"wood": 7,
|
||||
"ore": 7,
|
||||
"ideas": 7,
|
||||
"gold": 7,
|
||||
"mood_tokens": 7,
|
||||
"culture_tokens": 7
|
||||
},
|
||||
"cities": [
|
||||
{
|
||||
"city_pieces": {},
|
||||
"mood_state": "Angry",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "C1"
|
||||
}
|
||||
],
|
||||
"units": [
|
||||
{
|
||||
"position": "C1",
|
||||
"unit_type": "Infantry",
|
||||
"id": 0
|
||||
},
|
||||
{
|
||||
"position": "C1",
|
||||
"unit_type": "Infantry",
|
||||
"id": 1
|
||||
}
|
||||
],
|
||||
"civilization": "test1",
|
||||
"advances": [
|
||||
"Fanaticism",
|
||||
"Farming",
|
||||
"Mining",
|
||||
"Storage",
|
||||
"Tactics"
|
||||
],
|
||||
"incident_tokens": 3,
|
||||
"next_unit_id": 2
|
||||
}
|
||||
],
|
||||
"map": {
|
||||
"tiles": [
|
||||
[
|
||||
"A1",
|
||||
"Fertile"
|
||||
],
|
||||
[
|
||||
"A2",
|
||||
"Water"
|
||||
],
|
||||
[
|
||||
"A3",
|
||||
{
|
||||
"Exhausted": "Forest"
|
||||
}
|
||||
],
|
||||
[
|
||||
"B1",
|
||||
"Mountain"
|
||||
],
|
||||
[
|
||||
"B2",
|
||||
"Forest"
|
||||
],
|
||||
[
|
||||
"B3",
|
||||
"Fertile"
|
||||
],
|
||||
[
|
||||
"C1",
|
||||
"Barren"
|
||||
],
|
||||
[
|
||||
"C2",
|
||||
"Forest"
|
||||
],
|
||||
[
|
||||
"C3",
|
||||
"Water"
|
||||
],
|
||||
[
|
||||
"D2",
|
||||
"Water"
|
||||
]
|
||||
]
|
||||
},
|
||||
"starting_player_index": 0,
|
||||
"current_player_index": 0,
|
||||
"action_log": [
|
||||
{
|
||||
"rounds": [
|
||||
{
|
||||
"players": [
|
||||
{
|
||||
"index": 0,
|
||||
"items": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"action_log_index": 0,
|
||||
"log": [],
|
||||
"undo_limit": 0,
|
||||
"actions_left": 3,
|
||||
"round": 2,
|
||||
"age": 1,
|
||||
"messages": [
|
||||
"The game has started"
|
||||
],
|
||||
"dice_roll_outcomes": [
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
11,
|
||||
11,
|
||||
11,
|
||||
11
|
||||
],
|
||||
"dice_roll_log": [],
|
||||
"dropped_players": [],
|
||||
"wonders_left": [
|
||||
"Pyramids"
|
||||
],
|
||||
"action_cards_left": []
|
||||
}
|
||||
312
server/tests/test_games/action_cards/teach_us.outcome1.json
Normal file
312
server/tests/test_games/action_cards/teach_us.outcome1.json
Normal file
|
|
@ -0,0 +1,312 @@
|
|||
{
|
||||
"state": "Playing",
|
||||
"players": [
|
||||
{
|
||||
"id": 0,
|
||||
"resources": {
|
||||
"food": 2,
|
||||
"wood": 7,
|
||||
"ore": 7,
|
||||
"ideas": 3,
|
||||
"gold": 7,
|
||||
"mood_tokens": 8,
|
||||
"culture_tokens": 7
|
||||
},
|
||||
"resource_limit": {
|
||||
"food": 7,
|
||||
"wood": 7,
|
||||
"ore": 7,
|
||||
"ideas": 7,
|
||||
"gold": 7,
|
||||
"mood_tokens": 7,
|
||||
"culture_tokens": 7
|
||||
},
|
||||
"cities": [
|
||||
{
|
||||
"city_pieces": {},
|
||||
"mood_state": "Happy",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "A1"
|
||||
},
|
||||
{
|
||||
"city_pieces": {},
|
||||
"mood_state": "Neutral",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "C2"
|
||||
},
|
||||
{
|
||||
"city_pieces": {},
|
||||
"mood_state": "Angry",
|
||||
"activations": 0,
|
||||
"angry_activation": false,
|
||||
"position": "C1"
|
||||
}
|
||||
],
|
||||
"units": [
|
||||
{
|
||||
"position": "C1",
|
||||
"unit_type": "Infantry",
|
||||
"movement_restrictions": [
|
||||
"Battle"
|
||||
],
|
||||
"id": 0
|
||||
},
|
||||
{
|
||||
"position": "C1",
|
||||
"unit_type": "Cavalry",
|
||||
"movement_restrictions": [
|
||||
"Battle"
|
||||
],
|
||||
"id": 1
|
||||
},
|
||||
{
|
||||
"position": "C1",
|
||||
"unit_type": "Leader",
|
||||
"movement_restrictions": [
|
||||
"Battle"
|
||||
],
|
||||
"id": 2
|
||||
},
|
||||
{
|
||||
"position": "C1",
|
||||
"unit_type": "Elephant",
|
||||
"movement_restrictions": [
|
||||
"Battle"
|
||||
],
|
||||
"id": 3
|
||||
},
|
||||
{
|
||||
"position": "C1",
|
||||
"unit_type": "Settler",
|
||||
"id": 4
|
||||
},
|
||||
{
|
||||
"position": "C1",
|
||||
"unit_type": "Settler",
|
||||
"id": 5
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Settler",
|
||||
"id": 6
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"unit_type": "Settler",
|
||||
"id": 7
|
||||
}
|
||||
],
|
||||
"civilization": "test0",
|
||||
"advances": [
|
||||
"Farming",
|
||||
"Mining",
|
||||
"Storage",
|
||||
"Tactics"
|
||||
],
|
||||
"incident_tokens": 2,
|
||||
"next_unit_id": 8
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"resources": {
|
||||
"food": 2,
|
||||
"wood": 7,
|
||||
"ore": 7,
|
||||
"ideas": 7,
|
||||
"gold": 7,
|
||||
"mood_tokens": 7,
|
||||
"culture_tokens": 7
|
||||
},
|
||||
"resource_limit": {
|
||||
"food": 2,
|
||||
"wood": 7,
|
||||
"ore": 7,
|
||||
"ideas": 7,
|
||||
"gold": 7,
|
||||
"mood_tokens": 7,
|
||||
"culture_tokens": 7
|
||||
},
|
||||
"civilization": "test1",
|
||||
"advances": [
|
||||
"Fanaticism",
|
||||
"Farming",
|
||||
"Mining",
|
||||
"Storage",
|
||||
"Tactics"
|
||||
],
|
||||
"incident_tokens": 3,
|
||||
"next_unit_id": 2
|
||||
}
|
||||
],
|
||||
"map": {
|
||||
"tiles": [
|
||||
[
|
||||
"A1",
|
||||
"Fertile"
|
||||
],
|
||||
[
|
||||
"A2",
|
||||
"Water"
|
||||
],
|
||||
[
|
||||
"A3",
|
||||
{
|
||||
"Exhausted": "Forest"
|
||||
}
|
||||
],
|
||||
[
|
||||
"B1",
|
||||
"Mountain"
|
||||
],
|
||||
[
|
||||
"B2",
|
||||
"Forest"
|
||||
],
|
||||
[
|
||||
"B3",
|
||||
"Fertile"
|
||||
],
|
||||
[
|
||||
"C1",
|
||||
"Barren"
|
||||
],
|
||||
[
|
||||
"C2",
|
||||
"Forest"
|
||||
],
|
||||
[
|
||||
"C3",
|
||||
"Water"
|
||||
],
|
||||
[
|
||||
"D2",
|
||||
"Water"
|
||||
]
|
||||
]
|
||||
},
|
||||
"starting_player_index": 0,
|
||||
"current_player_index": 0,
|
||||
"action_log": [
|
||||
{
|
||||
"rounds": [
|
||||
{
|
||||
"players": [
|
||||
{
|
||||
"index": 0,
|
||||
"items": [
|
||||
{
|
||||
"action": {
|
||||
"Movement": {
|
||||
"Move": {
|
||||
"units": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5
|
||||
],
|
||||
"destination": "C1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"civil_card_match": {
|
||||
"opportunity": "CaptureCity",
|
||||
"played_cards": [
|
||||
35
|
||||
],
|
||||
"opponent": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": {
|
||||
"Playing": {
|
||||
"ActionCard": 35
|
||||
}
|
||||
},
|
||||
"undo": [
|
||||
{
|
||||
"op": "add",
|
||||
"path": "/players/0/action_cards",
|
||||
"value": [
|
||||
35
|
||||
]
|
||||
},
|
||||
{
|
||||
"op": "replace",
|
||||
"path": "/players/0/advances/2",
|
||||
"value": "Tactics"
|
||||
},
|
||||
{
|
||||
"op": "remove",
|
||||
"path": "/players/0/advances/3"
|
||||
},
|
||||
{
|
||||
"op": "replace",
|
||||
"path": "/players/0/resource_limit/food",
|
||||
"value": 2
|
||||
},
|
||||
{
|
||||
"op": "replace",
|
||||
"path": "/players/0/resources/mood_tokens",
|
||||
"value": 7
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"action_log_index": 2,
|
||||
"log": [
|
||||
[
|
||||
"Player1 marched 2 settlers, 1 infantry, 1 cavalry, 1 elephant and a leader from C2 to C1"
|
||||
],
|
||||
[
|
||||
"Combat round 1",
|
||||
"Attackers: 2 settlers, 1 infantry, 1 cavalry, 1 elephant and a leader",
|
||||
"Defenders: 2 infantry",
|
||||
"Player1 rolled 6 (Infantry, +1 combat value), 6 (Infantry, no bonus), 6 (Infantry, no bonus), 6 (Infantry, no bonus) for combined combat value of 25 and gets 2 hits against defending units.",
|
||||
"Player2 rolled 1 (Leader, no bonus), 1 (Leader, no bonus) for combined combat value of 2 and gets 0 hits against attacking units.",
|
||||
"Player2 has to remove all of their defending units",
|
||||
"Player2 removed 2 infantry",
|
||||
"Attacker wins and captured Player2's city at C1",
|
||||
"Player1 could not store 1 gold"
|
||||
],
|
||||
[
|
||||
"Player1 played the action card Teach Us",
|
||||
"Player1 selected Storage as advance for Teach Us.",
|
||||
"Player gained 1 mood token as advance bonus"
|
||||
]
|
||||
],
|
||||
"undo_limit": 1,
|
||||
"actions_left": 3,
|
||||
"round": 2,
|
||||
"age": 1,
|
||||
"messages": [
|
||||
"The game has started"
|
||||
],
|
||||
"dice_roll_outcomes": [
|
||||
1,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"dice_roll_log": [
|
||||
11,
|
||||
11,
|
||||
11,
|
||||
11,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"dropped_players": [],
|
||||
"wonders_left": [
|
||||
"Pyramids"
|
||||
],
|
||||
"action_cards_left": []
|
||||
}
|
||||
|
|
@ -12,8 +12,8 @@
|
|||
"request": {
|
||||
"SelectAdvance": {
|
||||
"choices": [
|
||||
"Devotion",
|
||||
"Conversion",
|
||||
"Devotion",
|
||||
"Fanaticism"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -487,8 +487,8 @@
|
|||
"request": {
|
||||
"SelectAdvance": {
|
||||
"choices": [
|
||||
"Devotion",
|
||||
"Conversion",
|
||||
"Devotion",
|
||||
"Fanaticism"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
],
|
||||
"incident_tokens": 3,
|
||||
"action_cards": [
|
||||
9
|
||||
35
|
||||
],
|
||||
"next_unit_id": 1
|
||||
},
|
||||
|
|
@ -82,7 +82,7 @@
|
|||
],
|
||||
"incident_tokens": 3,
|
||||
"action_cards": [
|
||||
16
|
||||
4
|
||||
],
|
||||
"next_unit_id": 1
|
||||
},
|
||||
|
|
@ -428,7 +428,7 @@
|
|||
"messages": [
|
||||
"The game has started"
|
||||
],
|
||||
"rng": "300587582487038535816091650019807584138",
|
||||
"rng": "189318565595922686176055148586951451843",
|
||||
"dice_roll_log": [],
|
||||
"dropped_players": [],
|
||||
"wonders_left": [
|
||||
|
|
@ -436,85 +436,95 @@
|
|||
"Pyramids"
|
||||
],
|
||||
"action_cards_left": [
|
||||
18,
|
||||
8,
|
||||
23,
|
||||
22,
|
||||
3,
|
||||
4,
|
||||
13,
|
||||
6,
|
||||
5,
|
||||
10,
|
||||
14,
|
||||
24,
|
||||
1,
|
||||
15,
|
||||
19,
|
||||
11,
|
||||
2,
|
||||
7,
|
||||
1,
|
||||
12,
|
||||
21,
|
||||
20,
|
||||
17,
|
||||
12
|
||||
9,
|
||||
19,
|
||||
22,
|
||||
30,
|
||||
10,
|
||||
20,
|
||||
16,
|
||||
23,
|
||||
3,
|
||||
36,
|
||||
24,
|
||||
18,
|
||||
2,
|
||||
14,
|
||||
28,
|
||||
29,
|
||||
7,
|
||||
5,
|
||||
26,
|
||||
27,
|
||||
33,
|
||||
25,
|
||||
8,
|
||||
34,
|
||||
15,
|
||||
13,
|
||||
6
|
||||
],
|
||||
"incidents_left": [
|
||||
53,
|
||||
27,
|
||||
47,
|
||||
20,
|
||||
31,
|
||||
33,
|
||||
23,
|
||||
44,
|
||||
55,
|
||||
6,
|
||||
35,
|
||||
49,
|
||||
26,
|
||||
50,
|
||||
37,
|
||||
57,
|
||||
1,
|
||||
30,
|
||||
2,
|
||||
40,
|
||||
13,
|
||||
41,
|
||||
7,
|
||||
17,
|
||||
15,
|
||||
16,
|
||||
14,
|
||||
8,
|
||||
5,
|
||||
48,
|
||||
32,
|
||||
39,
|
||||
51,
|
||||
42,
|
||||
3,
|
||||
54,
|
||||
36,
|
||||
18,
|
||||
29,
|
||||
4,
|
||||
28,
|
||||
56,
|
||||
34,
|
||||
24,
|
||||
46,
|
||||
52,
|
||||
12,
|
||||
26,
|
||||
33,
|
||||
44,
|
||||
1,
|
||||
57,
|
||||
45,
|
||||
36,
|
||||
20,
|
||||
48,
|
||||
18,
|
||||
49,
|
||||
50,
|
||||
46,
|
||||
35,
|
||||
32,
|
||||
10,
|
||||
21,
|
||||
3,
|
||||
24,
|
||||
52,
|
||||
55,
|
||||
38,
|
||||
25,
|
||||
23,
|
||||
42,
|
||||
53,
|
||||
31,
|
||||
47,
|
||||
2,
|
||||
54,
|
||||
6,
|
||||
41,
|
||||
27,
|
||||
16,
|
||||
19,
|
||||
40,
|
||||
8,
|
||||
30,
|
||||
37,
|
||||
12,
|
||||
13,
|
||||
15,
|
||||
4,
|
||||
34,
|
||||
28,
|
||||
17,
|
||||
22,
|
||||
56,
|
||||
29,
|
||||
7,
|
||||
5,
|
||||
14,
|
||||
11,
|
||||
9,
|
||||
22,
|
||||
38,
|
||||
19
|
||||
51,
|
||||
21
|
||||
]
|
||||
}
|
||||
|
|
@ -350,7 +350,8 @@
|
|||
}
|
||||
},
|
||||
"civil_card_match": {
|
||||
"opportunity": "WinLandBattle"
|
||||
"opportunity": "CaptureCity",
|
||||
"opponent": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -367,6 +368,8 @@
|
|||
],
|
||||
[
|
||||
"Combat round 1",
|
||||
"Attackers: a leader",
|
||||
"Defenders: no units",
|
||||
"Player1 rolled 6 (Infantry, no bonus) for combined combat value of 6 and gets 0 hits against defending units.",
|
||||
"Player1 used the following combat modifiers: Kʼinich Janaab Pakal I ignores the first hit in a battle with an Obelisk",
|
||||
"Player2 rolled no dice for combined combat value of 0 and gets 0 hits against attacking units.",
|
||||
|
|
|
|||
|
|
@ -311,7 +311,8 @@
|
|||
}
|
||||
},
|
||||
"civil_card_match": {
|
||||
"opportunity": "WinLandBattle"
|
||||
"opportunity": "CaptureCity",
|
||||
"opponent": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -337,6 +338,8 @@
|
|||
],
|
||||
[
|
||||
"Combat round 1",
|
||||
"Attackers: a leader",
|
||||
"Defenders: no units",
|
||||
"Player1 rolled 6 (Infantry, no bonus) for combined combat value of 6 and gets 0 hits against defending units.",
|
||||
"Player1 used the following combat modifiers: Kʼinich Janaab Pakal I ignores the first hit in a battle with an Obelisk",
|
||||
"Player2 rolled no dice for combined combat value of 0 and gets 0 hits against attacking units.",
|
||||
|
|
|
|||
|
|
@ -317,7 +317,9 @@
|
|||
"Player1 marched 2 settlers, 1 infantry, 1 cavalry, 1 elephant and a leader from C2 to C1"
|
||||
],
|
||||
[
|
||||
"Combat round 1"
|
||||
"Combat round 1",
|
||||
"Attackers: 2 settlers, 1 infantry, 1 cavalry, 1 elephant and a leader",
|
||||
"Defenders: 2 infantry"
|
||||
]
|
||||
],
|
||||
"undo_limit": 1,
|
||||
|
|
|
|||
|
|
@ -353,7 +353,9 @@
|
|||
"Player1 marched 2 settlers, 1 infantry, 1 cavalry, 1 elephant and a leader from C2 to C1"
|
||||
],
|
||||
[
|
||||
"Combat round 1"
|
||||
"Combat round 1",
|
||||
"Attackers: 2 settlers, 1 infantry, 1 cavalry, 1 elephant and a leader",
|
||||
"Defenders: 2 infantry"
|
||||
],
|
||||
[
|
||||
"Player1 paid for steel weapons: 1 ore"
|
||||
|
|
|
|||
|
|
@ -347,7 +347,9 @@
|
|||
"Player1 marched 2 settlers, 1 infantry, 1 cavalry, 1 elephant and a leader from C2 to C1"
|
||||
],
|
||||
[
|
||||
"Combat round 1"
|
||||
"Combat round 1",
|
||||
"Attackers: 2 settlers, 1 infantry, 1 cavalry, 1 elephant and a leader",
|
||||
"Defenders: 2 infantry"
|
||||
],
|
||||
[
|
||||
"Player1 paid for steel weapons: 1 ore"
|
||||
|
|
|
|||
|
|
@ -360,7 +360,9 @@
|
|||
"Player1 marched 2 settlers, 1 infantry, 1 cavalry, 1 elephant and a leader from C2 to C1"
|
||||
],
|
||||
[
|
||||
"Combat round 1"
|
||||
"Combat round 1",
|
||||
"Attackers: 2 settlers, 1 infantry, 1 cavalry, 1 elephant and a leader",
|
||||
"Defenders: 2 infantry"
|
||||
],
|
||||
[
|
||||
"Player1 paid for steel weapons: 1 ore"
|
||||
|
|
|
|||
|
|
@ -375,7 +375,9 @@
|
|||
"Player1 marched 2 settlers, 1 infantry, 1 cavalry, 1 elephant and a leader from C2 to C1"
|
||||
],
|
||||
[
|
||||
"Combat round 1"
|
||||
"Combat round 1",
|
||||
"Attackers: 2 settlers, 1 infantry, 1 cavalry, 1 elephant and a leader",
|
||||
"Defenders: 2 infantry"
|
||||
],
|
||||
[
|
||||
"Player1 paid for steel weapons: 1 ore"
|
||||
|
|
|
|||
|
|
@ -361,7 +361,8 @@
|
|||
}
|
||||
},
|
||||
"civil_card_match": {
|
||||
"opportunity": "WinLandBattle"
|
||||
"opportunity": "WinLandBattle",
|
||||
"opponent": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -377,7 +378,9 @@
|
|||
"Player1 marched 2 settlers, 1 infantry, 1 cavalry, 1 elephant and a leader from C2 to C1"
|
||||
],
|
||||
[
|
||||
"Combat round 1"
|
||||
"Combat round 1",
|
||||
"Attackers: 2 settlers, 1 infantry, 1 cavalry, 1 elephant and a leader",
|
||||
"Defenders: 2 infantry"
|
||||
],
|
||||
[
|
||||
"Player1 paid for steel weapons: 1 ore"
|
||||
|
|
|
|||
|
|
@ -239,7 +239,8 @@
|
|||
}
|
||||
},
|
||||
"civil_card_match": {
|
||||
"opportunity": "WinLandBattle"
|
||||
"opportunity": "CaptureCity",
|
||||
"opponent": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -256,6 +257,8 @@
|
|||
],
|
||||
[
|
||||
"Combat round 1",
|
||||
"Attackers: 2 settlers, 1 infantry, 1 cavalry, 1 elephant and a leader",
|
||||
"Defenders: 2 infantry",
|
||||
"Player1 rolled 6 (Infantry, +1 combat value), 6 (Infantry, no bonus), 6 (Infantry, no bonus), 6 (Infantry, no bonus) for combined combat value of 25 and gets 2 hits against defending units.",
|
||||
"Player2 rolled 1 (Leader, no bonus), 1 (Leader, no bonus) for combined combat value of 4 and gets 0 hits against attacking units.",
|
||||
"Player2 used the following combat modifiers: Player gets +2 combat value for Fanaticism Advance",
|
||||
|
|
|
|||
|
|
@ -220,7 +220,8 @@
|
|||
}
|
||||
},
|
||||
"civil_card_match": {
|
||||
"opportunity": "WinLandBattle"
|
||||
"opportunity": "CaptureCity",
|
||||
"opponent": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -237,6 +238,8 @@
|
|||
],
|
||||
[
|
||||
"Combat round 1",
|
||||
"Attackers: 1 infantry, 1 cavalry, 1 elephant and a leader",
|
||||
"Defenders: 2 infantry",
|
||||
"Player1 rolled 6 (Infantry, +1 combat value), 6 (Infantry, no bonus), 6 (Infantry, no bonus), 6 (Infantry, no bonus) for combined combat value of 25 and gets 2 hits against defending units.",
|
||||
"Player2 rolled 1 (Leader, no bonus), 1 (Leader, no bonus), 1 (Leader, no bonus) for combined combat value of 3 and gets 0 hits against attacking units.",
|
||||
"Player2 used the following combat modifiers: fortress added one extra die, fortress cancelled one hit",
|
||||
|
|
|
|||
|
|
@ -222,7 +222,8 @@
|
|||
}
|
||||
},
|
||||
"civil_card_match": {
|
||||
"opportunity": "WinLandBattle"
|
||||
"opportunity": "CaptureCity",
|
||||
"opponent": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -239,6 +240,8 @@
|
|||
],
|
||||
[
|
||||
"Combat round 1",
|
||||
"Attackers: 1 infantry, 1 cavalry, 1 elephant and a leader",
|
||||
"Defenders: a leader",
|
||||
"Player1 rolled 2 (Elephant, -1 hits, no combat value), 2 (Elephant, no bonus), 2 (Elephant, no bonus), 1 (Leader, re-roll), 1 (Leader, re-roll), 6 (Infantry, +1 combat value) for combined combat value of 13 and gets 1 hits against defending units.",
|
||||
"Player1 used the following combat modifiers: steel weapons added 2 combat value",
|
||||
"Player2 rolled 6 (Infantry, no bonus) for combined combat value of 6 and gets 0 hits against attacking units.",
|
||||
|
|
|
|||
|
|
@ -220,7 +220,8 @@
|
|||
}
|
||||
},
|
||||
"civil_card_match": {
|
||||
"opportunity": "WinLandBattle"
|
||||
"opportunity": "CaptureCity",
|
||||
"opponent": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -237,6 +238,8 @@
|
|||
],
|
||||
[
|
||||
"Combat round 1",
|
||||
"Attackers: 1 infantry, 1 cavalry, 1 elephant and a leader",
|
||||
"Defenders: no units",
|
||||
"Player1 rolled 6 (Infantry, +1 combat value), 6 (Infantry, no bonus), 6 (Infantry, no bonus), 6 (Infantry, no bonus) for combined combat value of 25 and gets 0 hits against defending units.",
|
||||
"Player2 rolled 1 (Leader, no bonus) for combined combat value of 1 and gets 0 hits against attacking units.",
|
||||
"Player2 used the following combat modifiers: fortress added one extra die, fortress cancelled one hit",
|
||||
|
|
|
|||
|
|
@ -346,6 +346,8 @@
|
|||
],
|
||||
[
|
||||
"Combat round 1",
|
||||
"Attackers: 3 ships",
|
||||
"Defenders: 2 ships",
|
||||
"Player1 rolled 6 (Infantry, no bonus), 6 (Infantry, no bonus), 6 (Infantry, no bonus) for combined combat value of 18 and gets 2 hits against defending units.",
|
||||
"Pirates rolled 6 (Infantry, no bonus), 6 (Infantry, no bonus) for combined combat value of 12 and gets 2 hits against attacking units.",
|
||||
"Player1 gained 2 gold for destroying Pirate Ships",
|
||||
|
|
|
|||
|
|
@ -366,6 +366,8 @@
|
|||
],
|
||||
[
|
||||
"Combat round 1",
|
||||
"Attackers: 3 ships",
|
||||
"Defenders: 2 ships",
|
||||
"Player1 rolled 6 (Infantry, no bonus), 6 (Infantry, no bonus), 6 (Infantry, no bonus) for combined combat value of 18 and gets 2 hits against defending units.",
|
||||
"Pirates rolled 6 (Infantry, no bonus), 6 (Infantry, no bonus) for combined combat value of 12 and gets 2 hits against attacking units.",
|
||||
"Player1 gained 2 gold for destroying Pirate Ships",
|
||||
|
|
|
|||
|
|
@ -285,7 +285,8 @@
|
|||
}
|
||||
},
|
||||
"civil_card_match": {
|
||||
"opportunity": "WinLandBattle"
|
||||
"opportunity": "WinLandBattle",
|
||||
"opponent": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -302,6 +303,8 @@
|
|||
],
|
||||
[
|
||||
"Combat round 1",
|
||||
"Attackers: 1 infantry, 1 cavalry, 1 elephant and a leader",
|
||||
"Defenders: 2 infantry",
|
||||
"Player1 rolled 6 (Infantry, +1 combat value), 6 (Infantry, no bonus), 6 (Infantry, no bonus), 6 (Infantry, no bonus) for combined combat value of 25 and gets 2 hits against defending units.",
|
||||
"Player2 rolled 6 (Infantry, +1 combat value), 6 (Infantry, +1 combat value) for combined combat value of 14 and gets 2 hits against attacking units.",
|
||||
"Player1 has to remove 2 of their attacking units"
|
||||
|
|
|
|||
|
|
@ -201,7 +201,8 @@
|
|||
}
|
||||
},
|
||||
"civil_card_match": {
|
||||
"opportunity": "WinLandBattle"
|
||||
"opportunity": "WinLandBattle",
|
||||
"opponent": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -399,7 +400,8 @@
|
|||
}
|
||||
],
|
||||
"civil_card_match": {
|
||||
"opportunity": "WinLandBattle"
|
||||
"opportunity": "CaptureCity",
|
||||
"opponent": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -416,6 +418,8 @@
|
|||
],
|
||||
[
|
||||
"Combat round 1",
|
||||
"Attackers: 1 infantry, 1 cavalry, 1 elephant and a leader",
|
||||
"Defenders: 2 infantry",
|
||||
"Player1 rolled 6 (Infantry, +1 combat value), 6 (Infantry, no bonus), 6 (Infantry, no bonus), 6 (Infantry, no bonus) for combined combat value of 25 and gets 2 hits against defending units.",
|
||||
"Player2 rolled 6 (Infantry, +1 combat value), 6 (Infantry, +1 combat value) for combined combat value of 14 and gets 2 hits against attacking units.",
|
||||
"Player1 has to remove 2 of their attacking units"
|
||||
|
|
|
|||
|
|
@ -217,6 +217,8 @@
|
|||
],
|
||||
[
|
||||
"Combat round 1",
|
||||
"Attackers: 1 infantry",
|
||||
"Defenders: 2 infantry",
|
||||
"Player1 rolled 6 (Infantry, +1 combat value) for combined combat value of 7 and gets 1 hits against defending units.",
|
||||
"Player2 rolled 6 (Infantry, +1 combat value), 6 (Infantry, +1 combat value) for combined combat value of 14 and gets 1 hits against attacking units.",
|
||||
"Player1 has to remove all of their attacking units",
|
||||
|
|
|
|||
|
|
@ -263,6 +263,8 @@
|
|||
],
|
||||
[
|
||||
"Combat round 1",
|
||||
"Attackers: 1 infantry",
|
||||
"Defenders: 2 infantry",
|
||||
"Player1 rolled 1 (Leader, no bonus) for combined combat value of 1 and gets 0 hits against defending units.",
|
||||
"Player2 rolled 1 (Leader, no bonus), 1 (Leader, no bonus) for combined combat value of 2 and gets 0 hits against attacking units.",
|
||||
"Player1 can retreat"
|
||||
|
|
|
|||
|
|
@ -276,6 +276,8 @@
|
|||
],
|
||||
[
|
||||
"Combat round 1",
|
||||
"Attackers: 1 infantry",
|
||||
"Defenders: 2 infantry",
|
||||
"Player1 rolled 1 (Leader, no bonus) for combined combat value of 1 and gets 0 hits against defending units.",
|
||||
"Player2 rolled 1 (Leader, no bonus), 1 (Leader, no bonus) for combined combat value of 2 and gets 0 hits against attacking units.",
|
||||
"Player1 can retreat"
|
||||
|
|
|
|||
|
|
@ -263,6 +263,8 @@
|
|||
],
|
||||
[
|
||||
"Combat round 1",
|
||||
"Attackers: 1 infantry",
|
||||
"Defenders: 2 infantry",
|
||||
"Player1 rolled 1 (Leader, no bonus) for combined combat value of 1 and gets 0 hits against defending units.",
|
||||
"Player2 rolled 1 (Leader, no bonus), 1 (Leader, no bonus) for combined combat value of 2 and gets 0 hits against attacking units.",
|
||||
"Player1 can retreat"
|
||||
|
|
|
|||
|
|
@ -224,6 +224,8 @@
|
|||
],
|
||||
[
|
||||
"Combat round 1",
|
||||
"Attackers: 1 infantry",
|
||||
"Defenders: 2 infantry",
|
||||
"Player1 rolled 1 (Leader, no bonus) for combined combat value of 1 and gets 0 hits against defending units.",
|
||||
"Player2 rolled 1 (Leader, no bonus), 1 (Leader, no bonus) for combined combat value of 2 and gets 0 hits against attacking units.",
|
||||
"Player1 can retreat"
|
||||
|
|
@ -233,6 +235,8 @@
|
|||
],
|
||||
[
|
||||
"Combat round 2",
|
||||
"Attackers: 1 infantry",
|
||||
"Defenders: 2 infantry",
|
||||
"Player1 rolled 6 (Infantry, +1 combat value) for combined combat value of 7 and gets 1 hits against defending units.",
|
||||
"Player2 rolled 6 (Infantry, +1 combat value), 6 (Infantry, +1 combat value) for combined combat value of 14 and gets 1 hits against attacking units.",
|
||||
"Player1 has to remove all of their attacking units",
|
||||
|
|
|
|||
|
|
@ -50,9 +50,9 @@
|
|||
"SelectUnits": {
|
||||
"player": 0,
|
||||
"choices": [
|
||||
1,
|
||||
2,
|
||||
22,
|
||||
1
|
||||
22
|
||||
],
|
||||
"needed": {
|
||||
"start": 1,
|
||||
|
|
@ -351,6 +351,8 @@
|
|||
],
|
||||
[
|
||||
"Combat round 1",
|
||||
"Attackers: 1 settler, 2 ships, 1 cavalry and 1 elephant",
|
||||
"Defenders: 1 ship",
|
||||
"Player1 rolled 6 (Infantry, no bonus), 6 (Infantry, no bonus) for combined combat value of 12 and gets 1 hits against defending units.",
|
||||
"Player2 rolled 6 (Infantry, no bonus) for combined combat value of 6 and gets 1 hits against attacking units.",
|
||||
"Player1 has to remove 1 of their attacking units",
|
||||
|
|
|
|||
|
|
@ -298,6 +298,8 @@
|
|||
],
|
||||
[
|
||||
"Combat round 1",
|
||||
"Attackers: 1 settler, 2 ships, 1 cavalry and 1 elephant",
|
||||
"Defenders: 1 ship",
|
||||
"Player1 rolled 6 (Infantry, no bonus), 6 (Infantry, no bonus) for combined combat value of 12 and gets 1 hits against defending units.",
|
||||
"Player2 rolled 6 (Infantry, no bonus) for combined combat value of 6 and gets 1 hits against attacking units.",
|
||||
"Player1 has to remove 1 of their attacking units",
|
||||
|
|
|
|||
|
|
@ -340,6 +340,8 @@
|
|||
],
|
||||
[
|
||||
"Combat round 1",
|
||||
"Attackers: 2 ships, 1 cavalry and 1 elephant",
|
||||
"Defenders: 2 ships",
|
||||
"Player1 rolled 6 (Infantry, no bonus), 6 (Infantry, no bonus) for combined combat value of 12 and gets 1 hits against defending units.",
|
||||
"Player1 used the following combat modifiers: War Ships ignore the first hit in the first round of combat",
|
||||
"Player2 rolled 6 (Infantry, no bonus), 6 (Infantry, no bonus) for combined combat value of 12 and gets 1 hits against attacking units.",
|
||||
|
|
|
|||
|
|
@ -15,19 +15,19 @@
|
|||
"request": {
|
||||
"SelectAdvance": {
|
||||
"choices": [
|
||||
"Storage",
|
||||
"Irrigation",
|
||||
"Husbandry",
|
||||
"Engineering",
|
||||
"Sanitation",
|
||||
"Roads",
|
||||
"Fishing",
|
||||
"Writing",
|
||||
"Tactics",
|
||||
"Myths",
|
||||
"Bartering",
|
||||
"Arts",
|
||||
"Math"
|
||||
"Bartering",
|
||||
"Engineering",
|
||||
"Fishing",
|
||||
"Husbandry",
|
||||
"Irrigation",
|
||||
"Math",
|
||||
"Myths",
|
||||
"Roads",
|
||||
"Sanitation",
|
||||
"Storage",
|
||||
"Tactics",
|
||||
"Writing"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
@ -283,6 +283,8 @@
|
|||
],
|
||||
[
|
||||
"Combat round 1",
|
||||
"Attackers: 2 infantry and 1 elephant",
|
||||
"Defenders: 4 settlers",
|
||||
"Barbarians rolled 6 (Infantry, +1 combat value), 6 (Infantry, +1 combat value), 6 (Infantry, no bonus) for combined combat value of 20 and gets 0 hits against defending units.",
|
||||
"Player1 rolled 6 (Infantry, no bonus) for combined combat value of 6 and gets 1 hits against attacking units.",
|
||||
"Player1 used the following combat modifiers: fortress added one extra die, fortress cancelled one hit",
|
||||
|
|
|
|||
|
|
@ -15,19 +15,19 @@
|
|||
"request": {
|
||||
"SelectAdvance": {
|
||||
"choices": [
|
||||
"Storage",
|
||||
"Irrigation",
|
||||
"Husbandry",
|
||||
"Engineering",
|
||||
"Sanitation",
|
||||
"Roads",
|
||||
"Fishing",
|
||||
"Writing",
|
||||
"Tactics",
|
||||
"Myths",
|
||||
"Bartering",
|
||||
"Arts",
|
||||
"Math"
|
||||
"Bartering",
|
||||
"Engineering",
|
||||
"Fishing",
|
||||
"Husbandry",
|
||||
"Irrigation",
|
||||
"Math",
|
||||
"Myths",
|
||||
"Roads",
|
||||
"Sanitation",
|
||||
"Storage",
|
||||
"Tactics",
|
||||
"Writing"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -232,7 +232,8 @@
|
|||
}
|
||||
},
|
||||
"civil_card_match": {
|
||||
"opportunity": "WinLandBattle"
|
||||
"opportunity": "CaptureCity",
|
||||
"opponent": 2
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -249,6 +250,8 @@
|
|||
],
|
||||
[
|
||||
"Combat round 1",
|
||||
"Attackers: 4 elephants",
|
||||
"Defenders: 3 infantry",
|
||||
"Player1 rolled 6 (Infantry, no bonus), 6 (Infantry, no bonus), 6 (Infantry, no bonus), 1 (Leader, no bonus) for combined combat value of 19 and gets 3 hits against defending units.",
|
||||
"Barbarians rolled 1 (Leader, no bonus), 2 (Cavalry, no bonus), 6 (Infantry, +1 combat value) for combined combat value of 10 and gets 2 hits against attacking units.",
|
||||
"Player1 has to remove 2 of their attacking units",
|
||||
|
|
|
|||
|
|
@ -15,19 +15,19 @@
|
|||
"request": {
|
||||
"SelectAdvance": {
|
||||
"choices": [
|
||||
"Storage",
|
||||
"Irrigation",
|
||||
"Husbandry",
|
||||
"Engineering",
|
||||
"Sanitation",
|
||||
"Roads",
|
||||
"Fishing",
|
||||
"Writing",
|
||||
"Tactics",
|
||||
"Myths",
|
||||
"Bartering",
|
||||
"Arts",
|
||||
"Math"
|
||||
"Bartering",
|
||||
"Engineering",
|
||||
"Fishing",
|
||||
"Husbandry",
|
||||
"Irrigation",
|
||||
"Math",
|
||||
"Myths",
|
||||
"Roads",
|
||||
"Sanitation",
|
||||
"Storage",
|
||||
"Tactics",
|
||||
"Writing"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -14,6 +14,18 @@
|
|||
"request": {
|
||||
"SelectStructures": {
|
||||
"choices": [
|
||||
{
|
||||
"position": "B2",
|
||||
"structure": "CityCenter"
|
||||
},
|
||||
{
|
||||
"position": "B3",
|
||||
"structure": "CityCenter"
|
||||
},
|
||||
{
|
||||
"position": "C1",
|
||||
"structure": "CityCenter"
|
||||
},
|
||||
{
|
||||
"position": "C2",
|
||||
"structure": "CityCenter"
|
||||
|
|
@ -35,18 +47,6 @@
|
|||
"structure": {
|
||||
"Wonder": "Pyramids"
|
||||
}
|
||||
},
|
||||
{
|
||||
"position": "C1",
|
||||
"structure": "CityCenter"
|
||||
},
|
||||
{
|
||||
"position": "B2",
|
||||
"structure": "CityCenter"
|
||||
},
|
||||
{
|
||||
"position": "B3",
|
||||
"structure": "CityCenter"
|
||||
}
|
||||
],
|
||||
"needed": {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
"request": {
|
||||
"SelectPositions": {
|
||||
"choices": [
|
||||
"B1",
|
||||
"B1",
|
||||
"B2"
|
||||
],
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue