70 lines
2.3 KiB
Rust
70 lines
2.3 KiB
Rust
|
|
use core::num::NonZeroU8;
|
||
|
|
#[allow(unused)]
|
||
|
|
use pretty_assertions::{assert_eq, assert_ne, assert_str_eq};
|
||
|
|
|
||
|
|
use crate::{
|
||
|
|
game::{Game, GameSettings, SetupRole},
|
||
|
|
game_test::{ActionPromptTitleExt, ActionResultExt, GameExt, SettingsExt, gen_players},
|
||
|
|
message::night::{ActionPrompt, ActionPromptTitle},
|
||
|
|
};
|
||
|
|
|
||
|
|
#[test]
|
||
|
|
fn mason_recruits_decrement() {
|
||
|
|
let players = gen_players(1..10);
|
||
|
|
let mason_leader_player_id = players[0].player_id;
|
||
|
|
let wolf_player_id = players[1].player_id;
|
||
|
|
let sacrificial_wolf_player_id = players[2].player_id;
|
||
|
|
let mut settings = GameSettings::empty();
|
||
|
|
settings.add_and_assign(
|
||
|
|
SetupRole::MasonLeader {
|
||
|
|
recruits_available: NonZeroU8::new(1).unwrap(),
|
||
|
|
},
|
||
|
|
mason_leader_player_id,
|
||
|
|
);
|
||
|
|
settings.add_and_assign(SetupRole::Werewolf, wolf_player_id);
|
||
|
|
settings.add_and_assign(SetupRole::Werewolf, sacrificial_wolf_player_id);
|
||
|
|
settings.fill_remaining_slots_with_villagers(9);
|
||
|
|
let mut game = Game::new(&players, settings).unwrap();
|
||
|
|
game.r#continue().r#continue();
|
||
|
|
assert_eq!(game.next().title(), ActionPromptTitle::WolvesIntro);
|
||
|
|
game.r#continue().sleep();
|
||
|
|
game.next_expect_day();
|
||
|
|
|
||
|
|
assert_eq!(game.execute().title(), ActionPromptTitle::WolfPackKill);
|
||
|
|
game.mark(
|
||
|
|
game.living_villager_excl(mason_leader_player_id)
|
||
|
|
.character_id(),
|
||
|
|
);
|
||
|
|
game.r#continue().sleep();
|
||
|
|
|
||
|
|
let recruited = game.living_villager_excl(mason_leader_player_id);
|
||
|
|
assert_eq!(game.next().title(), ActionPromptTitle::MasonLeaderRecruit);
|
||
|
|
game.mark(recruited.character_id());
|
||
|
|
game.r#continue().r#continue();
|
||
|
|
assert_eq!(
|
||
|
|
game.next(),
|
||
|
|
ActionPrompt::MasonsWake {
|
||
|
|
character_id: game
|
||
|
|
.character_by_player_id(mason_leader_player_id)
|
||
|
|
.identity(),
|
||
|
|
masons: Box::new([game
|
||
|
|
.character_by_player_id(recruited.player_id())
|
||
|
|
.identity()])
|
||
|
|
}
|
||
|
|
);
|
||
|
|
game.r#continue().sleep();
|
||
|
|
game.next_expect_day();
|
||
|
|
|
||
|
|
assert_eq!(game.execute().title(), ActionPromptTitle::WolfPackKill);
|
||
|
|
game.mark(
|
||
|
|
game.living_villager_excl(recruited.player_id())
|
||
|
|
.character_id(),
|
||
|
|
);
|
||
|
|
game.r#continue().sleep();
|
||
|
|
|
||
|
|
game.next().title().masons_wake();
|
||
|
|
game.r#continue().sleep();
|
||
|
|
|
||
|
|
game.next_expect_day();
|
||
|
|
}
|