88 lines
2.9 KiB
Rust
88 lines
2.9 KiB
Rust
|
|
#[allow(unused)]
|
||
|
|
use pretty_assertions::{assert_eq, assert_ne, assert_str_eq};
|
||
|
|
|
||
|
|
use crate::{
|
||
|
|
diedto::DiedTo,
|
||
|
|
game::{Game, GameSettings, OrRandom, SetupRole},
|
||
|
|
game_test::{ActionPromptTitleExt, ActionResultExt, GameExt, SettingsExt, gen_players},
|
||
|
|
message::night::ActionPromptTitle,
|
||
|
|
};
|
||
|
|
|
||
|
|
#[test]
|
||
|
|
fn no_kill_on_executing_wolf_aligned_villager() {
|
||
|
|
let players = gen_players(1..21);
|
||
|
|
let lone_wolf_player_id = players[0].player_id;
|
||
|
|
let wolf_player_id = players[1].player_id;
|
||
|
|
let scapegoat_player_id = players[2].player_id;
|
||
|
|
let mut settings = GameSettings::empty();
|
||
|
|
settings.add_and_assign(SetupRole::LoneWolf, lone_wolf_player_id);
|
||
|
|
settings.add_and_assign(SetupRole::Werewolf, wolf_player_id);
|
||
|
|
settings.add_and_assign(
|
||
|
|
SetupRole::Scapegoat {
|
||
|
|
redeemed: OrRandom::Determined(false),
|
||
|
|
},
|
||
|
|
scapegoat_player_id,
|
||
|
|
);
|
||
|
|
settings.fill_remaining_slots_with_villagers(20);
|
||
|
|
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();
|
||
|
|
game.mark_for_execution(
|
||
|
|
game.character_by_player_id(scapegoat_player_id)
|
||
|
|
.character_id(),
|
||
|
|
);
|
||
|
|
|
||
|
|
game.execute().title().wolf_pack_kill();
|
||
|
|
game.mark(game.living_villager().character_id());
|
||
|
|
game.r#continue().sleep();
|
||
|
|
|
||
|
|
game.next_expect_day();
|
||
|
|
}
|
||
|
|
|
||
|
|
#[test]
|
||
|
|
fn gets_a_kill_after_wolf_execution_and_can_kill_a_wolf() {
|
||
|
|
let players = gen_players(1..21);
|
||
|
|
let lone_wolf_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::LoneWolf, lone_wolf_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(20);
|
||
|
|
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();
|
||
|
|
game.mark_for_execution(
|
||
|
|
game.character_by_player_id(sacrificial_wolf_player_id)
|
||
|
|
.character_id(),
|
||
|
|
);
|
||
|
|
|
||
|
|
game.execute().title().wolf_pack_kill();
|
||
|
|
game.mark(game.living_villager().character_id());
|
||
|
|
game.r#continue().sleep();
|
||
|
|
|
||
|
|
game.next().title().lone_wolf();
|
||
|
|
game.mark(game.character_by_player_id(wolf_player_id).character_id());
|
||
|
|
game.r#continue().sleep();
|
||
|
|
|
||
|
|
game.next_expect_day();
|
||
|
|
assert_eq!(
|
||
|
|
game.character_by_player_id(wolf_player_id)
|
||
|
|
.died_to()
|
||
|
|
.cloned(),
|
||
|
|
Some(DiedTo::LoneWolf {
|
||
|
|
killer: game
|
||
|
|
.character_by_player_id(lone_wolf_player_id)
|
||
|
|
.character_id(),
|
||
|
|
night: 1
|
||
|
|
})
|
||
|
|
);
|
||
|
|
}
|