update tests in line with new changes
This commit is contained in:
parent
54f065be1e
commit
082f0bba38
|
|
@ -71,7 +71,10 @@ impl Village {
|
|||
|
||||
pub fn wolf_revert_prompt(&self) -> Option<ActionPrompt> {
|
||||
self.killing_wolf()
|
||||
.filter(|killing_wolf| RoleTitle::Werewolf != killing_wolf.role_title())
|
||||
.filter(|killing_wolf| {
|
||||
RoleTitle::Werewolf != killing_wolf.role_title()
|
||||
&& !killing_wolf.role_title().killing_wolf()
|
||||
})
|
||||
.map(|killing_wolf| ActionPrompt::RoleChange {
|
||||
character_id: killing_wolf.identity(),
|
||||
new_role: RoleTitle::Werewolf,
|
||||
|
|
|
|||
|
|
@ -83,9 +83,13 @@ pub trait ActionPromptTitleExt {
|
|||
fn insomniac(&self);
|
||||
fn power_seer(&self);
|
||||
fn mortician(&self);
|
||||
fn elder_reveal(&self);
|
||||
}
|
||||
|
||||
impl ActionPromptTitleExt for ActionPromptTitle {
|
||||
fn elder_reveal(&self) {
|
||||
assert_eq!(*self, ActionPromptTitle::ElderReveal);
|
||||
}
|
||||
fn mortician(&self) {
|
||||
assert_eq!(*self, ActionPromptTitle::Mortician);
|
||||
}
|
||||
|
|
@ -1065,21 +1069,29 @@ fn big_game_test_based_on_story_test() {
|
|||
game.living_villager_excl(protect.player_id())
|
||||
.character_id(),
|
||||
);
|
||||
assert_eq!(
|
||||
game.execute(),
|
||||
ActionPrompt::RoleChange {
|
||||
character_id: game.character_by_player_id(shapeshifter).identity(),
|
||||
new_role: RoleTitle::Werewolf
|
||||
}
|
||||
);
|
||||
game.r#continue().sleep();
|
||||
|
||||
game.next().title().vindicator();
|
||||
game.execute().title().vindicator();
|
||||
game.mark(game.character_by_player_id(shapeshifter).character_id());
|
||||
game.r#continue().sleep();
|
||||
|
||||
game.next().title().wolf_pack_kill();
|
||||
game.mark(game.character_by_player_id(empath).character_id());
|
||||
game.r#continue().r#continue();
|
||||
|
||||
game.next().title().shapeshifter();
|
||||
game.process(HostGameMessage::Night(HostNightMessage::ActionResponse(
|
||||
ActionResponse::Shapeshift,
|
||||
)))
|
||||
.expect("shapeshift");
|
||||
// game.r#continue().r#continue();
|
||||
|
||||
assert_eq!(
|
||||
game.next(),
|
||||
ActionPrompt::RoleChange {
|
||||
character_id: game.character_by_player_id(empath).identity(),
|
||||
new_role: RoleTitle::Werewolf
|
||||
}
|
||||
);
|
||||
game.r#continue().sleep();
|
||||
|
||||
game.next().title().seer();
|
||||
|
|
@ -1142,23 +1154,23 @@ fn big_game_test_based_on_story_test() {
|
|||
|
||||
game.next().title().arcanist();
|
||||
game.mark(game.character_by_player_id(insomniac).character_id());
|
||||
game.mark(game.character_by_player_id(shapeshifter).character_id());
|
||||
game.mark(game.character_by_player_id(empath).character_id());
|
||||
game.r#continue().arcanist();
|
||||
game.r#continue().sleep();
|
||||
|
||||
game.next().title().adjudicator();
|
||||
game.mark(game.character_by_player_id(shapeshifter).character_id());
|
||||
game.mark(game.character_by_player_id(empath).character_id());
|
||||
game.r#continue().adjudicator();
|
||||
game.r#continue().sleep();
|
||||
|
||||
game.next().title().power_seer();
|
||||
game.mark(game.character_by_player_id(shapeshifter).character_id());
|
||||
game.mark(game.character_by_player_id(empath).character_id());
|
||||
game.r#continue().power_seer();
|
||||
game.r#continue().sleep();
|
||||
|
||||
game.next().title().gravedigger();
|
||||
game.mark(game.character_by_player_id(empath).character_id());
|
||||
assert_eq!(game.r#continue().gravedigger(), Some(RoleTitle::Empath));
|
||||
game.mark(game.character_by_player_id(shapeshifter).character_id());
|
||||
assert_eq!(game.r#continue().gravedigger(), None);
|
||||
game.r#continue().sleep();
|
||||
|
||||
game.next().title().mortician();
|
||||
|
|
@ -1174,7 +1186,7 @@ fn big_game_test_based_on_story_test() {
|
|||
game.r#continue().sleep();
|
||||
|
||||
game.next().title().hunter();
|
||||
game.mark(game.character_by_player_id(shapeshifter).character_id());
|
||||
game.mark(game.character_by_player_id(empath).character_id());
|
||||
game.r#continue().sleep();
|
||||
|
||||
game.next().title().insomniac();
|
||||
|
|
|
|||
|
|
@ -23,12 +23,7 @@ use crate::{
|
|||
|
||||
#[test]
|
||||
fn sole_non_werewolf_wolves_revert() {
|
||||
const REVERTING_WOLVES: &[SetupRole] = &[
|
||||
SetupRole::DireWolf,
|
||||
SetupRole::LoneWolf,
|
||||
SetupRole::AlphaWolf,
|
||||
SetupRole::Shapeshifter,
|
||||
];
|
||||
const REVERTING_WOLVES: &[SetupRole] = &[SetupRole::DireWolf];
|
||||
init_log();
|
||||
for wolf_role in REVERTING_WOLVES {
|
||||
let role_title = Into::<RoleTitle>::into(wolf_role.clone());
|
||||
|
|
@ -72,12 +67,7 @@ fn sole_non_werewolf_wolves_revert() {
|
|||
|
||||
#[test]
|
||||
fn wolves_revert_on_werewolf_death() {
|
||||
const REVERTING_WOLVES: &[SetupRole] = &[
|
||||
SetupRole::DireWolf,
|
||||
SetupRole::LoneWolf,
|
||||
SetupRole::AlphaWolf,
|
||||
SetupRole::Shapeshifter,
|
||||
];
|
||||
const REVERTING_WOLVES: &[SetupRole] = &[SetupRole::DireWolf];
|
||||
init_log();
|
||||
for wolf_role in REVERTING_WOLVES {
|
||||
let role_title = Into::<RoleTitle>::into(wolf_role.clone());
|
||||
|
|
|
|||
|
|
@ -99,20 +99,15 @@ fn doesnt_die_first_try_night_knows() {
|
|||
game.r#continue().sleep();
|
||||
game.next_expect_day();
|
||||
|
||||
game.execute().title().wolf_pack_kill();
|
||||
game.execute().title().elder_reveal();
|
||||
game.r#continue().sleep();
|
||||
|
||||
game.next().title().wolf_pack_kill();
|
||||
let elder = game.character_by_player_id(elder_player_id);
|
||||
|
||||
game.mark_and_check(elder.character_id());
|
||||
game.r#continue().sleep();
|
||||
|
||||
assert_eq!(
|
||||
game.next(),
|
||||
ActionPrompt::ElderReveal {
|
||||
character_id: elder.identity()
|
||||
},
|
||||
);
|
||||
game.r#continue().sleep();
|
||||
|
||||
game.next_expect_day();
|
||||
|
||||
let elder = game.character_by_player_id(elder_player_id);
|
||||
|
|
@ -236,7 +231,10 @@ fn elder_executed_knows_no_powers_incl_hunter_activation() {
|
|||
|
||||
game.next_expect_day();
|
||||
|
||||
game.execute().title().wolf_pack_kill();
|
||||
game.execute().title().elder_reveal();
|
||||
game.r#continue().sleep();
|
||||
|
||||
game.next().title().wolf_pack_kill();
|
||||
game.mark(villagers.next().unwrap());
|
||||
game.r#continue().sleep();
|
||||
|
||||
|
|
@ -249,14 +247,6 @@ fn elder_executed_knows_no_powers_incl_hunter_activation() {
|
|||
game.mark(game.character_by_player_id(wolf_player_id).character_id());
|
||||
game.r#continue().sleep();
|
||||
|
||||
assert_eq!(
|
||||
game.next(),
|
||||
ActionPrompt::ElderReveal {
|
||||
character_id: game.character_by_player_id(elder_player_id).identity()
|
||||
}
|
||||
);
|
||||
game.r#continue().sleep();
|
||||
|
||||
game.next_expect_day();
|
||||
|
||||
assert_eq!(
|
||||
|
|
|
|||
|
|
@ -118,8 +118,20 @@ fn redeemed_scapegoat_role_changes() {
|
|||
night: NonZero::new(1).unwrap()
|
||||
}
|
||||
);
|
||||
assert_eq!(
|
||||
game.execute(),
|
||||
ActionPrompt::RoleChange {
|
||||
character_id: game.character_by_player_id(scapegoat_player_id).identity(),
|
||||
new_role: RoleTitle::Seer
|
||||
}
|
||||
);
|
||||
game.r#continue().r#continue();
|
||||
game.next().title().seer();
|
||||
game.mark(game.character_by_player_id(wolf_player_id).character_id());
|
||||
assert_eq!(game.r#continue().seer(), Alignment::Wolves);
|
||||
game.r#continue().sleep();
|
||||
|
||||
assert_eq!(game.execute().title(), ActionPromptTitle::WolfPackKill);
|
||||
assert_eq!(game.next().title(), ActionPromptTitle::WolfPackKill);
|
||||
let wolf_target_2 = game
|
||||
.village()
|
||||
.characters()
|
||||
|
|
@ -129,21 +141,6 @@ fn redeemed_scapegoat_role_changes() {
|
|||
.character_id();
|
||||
game.mark_and_check(wolf_target_2);
|
||||
game.r#continue().sleep();
|
||||
let scapegoat = game
|
||||
.village()
|
||||
.characters()
|
||||
.into_iter()
|
||||
.find(|c| c.player_id() == scapegoat_player_id)
|
||||
.unwrap()
|
||||
.clone();
|
||||
assert_eq!(
|
||||
game.next(),
|
||||
ActionPrompt::RoleChange {
|
||||
character_id: scapegoat.identity(),
|
||||
new_role: RoleTitle::Seer
|
||||
}
|
||||
);
|
||||
game.r#continue().sleep();
|
||||
|
||||
game.next_expect_day();
|
||||
|
||||
|
|
|
|||
|
|
@ -247,11 +247,13 @@ pub enum Role {
|
|||
#[checks(Killer::Killer)]
|
||||
#[checks(Powerful::Powerful)]
|
||||
#[checks("wolf")]
|
||||
#[checks("killing_wolf")]
|
||||
Werewolf,
|
||||
#[checks(Alignment::Wolves)]
|
||||
#[checks(Killer::Killer)]
|
||||
#[checks(Powerful::Powerful)]
|
||||
#[checks("wolf")]
|
||||
#[checks("killing_wolf")]
|
||||
AlphaWolf { killed: Option<CharacterId> },
|
||||
#[checks(Alignment::Village)]
|
||||
#[checks(Killer::Killer)]
|
||||
|
|
@ -262,6 +264,7 @@ pub enum Role {
|
|||
#[checks(Killer::Killer)]
|
||||
#[checks(Powerful::Powerful)]
|
||||
#[checks("wolf")]
|
||||
#[checks("killing_wolf")]
|
||||
Shapeshifter { shifted_into: Option<CharacterId> },
|
||||
#[checks(Alignment::Wolves)]
|
||||
#[checks(Killer::Killer)]
|
||||
|
|
@ -274,7 +277,9 @@ impl Role {
|
|||
/// [RoleTitle] as shown to the player on role assignment
|
||||
pub const fn initial_shown_role(&self) -> RoleTitle {
|
||||
match self {
|
||||
Role::Apprentice(_) | Role::Elder { .. } | Role::Insomniac => RoleTitle::Villager,
|
||||
Role::Scapegoat { .. } | Role::Apprentice(_) | Role::Elder { .. } | Role::Insomniac => {
|
||||
RoleTitle::Villager
|
||||
}
|
||||
_ => self.title(),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -350,21 +350,29 @@ pub fn test_story() -> GameStory {
|
|||
game.living_villager_excl(protect.player_id())
|
||||
.character_id(),
|
||||
);
|
||||
assert_eq!(
|
||||
game.execute(),
|
||||
ActionPrompt::RoleChange {
|
||||
character_id: game.character_by_player_id(shapeshifter).identity(),
|
||||
new_role: RoleTitle::Werewolf
|
||||
}
|
||||
);
|
||||
game.r#continue().sleep();
|
||||
|
||||
game.next().title().vindicator();
|
||||
game.execute().title().vindicator();
|
||||
game.mark(game.character_by_player_id(shapeshifter).character_id());
|
||||
game.r#continue().sleep();
|
||||
|
||||
game.next().title().wolf_pack_kill();
|
||||
game.mark(game.character_by_player_id(empath).character_id());
|
||||
game.r#continue().r#continue();
|
||||
|
||||
game.next().title().shapeshifter();
|
||||
game.process(HostGameMessage::Night(HostNightMessage::ActionResponse(
|
||||
ActionResponse::Shapeshift,
|
||||
)))
|
||||
.expect("shapeshift");
|
||||
// game.r#continue().r#continue();
|
||||
|
||||
assert_eq!(
|
||||
game.next(),
|
||||
ActionPrompt::RoleChange {
|
||||
character_id: game.character_by_player_id(empath).identity(),
|
||||
new_role: RoleTitle::Werewolf
|
||||
}
|
||||
);
|
||||
game.r#continue().sleep();
|
||||
|
||||
game.next().title().seer();
|
||||
|
|
@ -427,23 +435,23 @@ pub fn test_story() -> GameStory {
|
|||
|
||||
game.next().title().arcanist();
|
||||
game.mark(game.character_by_player_id(insomniac).character_id());
|
||||
game.mark(game.character_by_player_id(shapeshifter).character_id());
|
||||
game.mark(game.character_by_player_id(empath).character_id());
|
||||
game.r#continue().arcanist();
|
||||
game.r#continue().sleep();
|
||||
|
||||
game.next().title().adjudicator();
|
||||
game.mark(game.character_by_player_id(shapeshifter).character_id());
|
||||
game.mark(game.character_by_player_id(empath).character_id());
|
||||
game.r#continue().adjudicator();
|
||||
game.r#continue().sleep();
|
||||
|
||||
game.next().title().power_seer();
|
||||
game.mark(game.character_by_player_id(shapeshifter).character_id());
|
||||
game.mark(game.character_by_player_id(empath).character_id());
|
||||
game.r#continue().power_seer();
|
||||
game.r#continue().sleep();
|
||||
|
||||
game.next().title().gravedigger();
|
||||
game.mark(game.character_by_player_id(empath).character_id());
|
||||
assert_eq!(game.r#continue().gravedigger(), Some(RoleTitle::Empath));
|
||||
game.mark(game.character_by_player_id(shapeshifter).character_id());
|
||||
assert_eq!(game.r#continue().gravedigger(), None);
|
||||
game.r#continue().sleep();
|
||||
|
||||
game.next().title().mortician();
|
||||
|
|
@ -459,7 +467,7 @@ pub fn test_story() -> GameStory {
|
|||
game.r#continue().sleep();
|
||||
|
||||
game.next().title().hunter();
|
||||
game.mark(game.character_by_player_id(shapeshifter).character_id());
|
||||
game.mark(game.character_by_player_id(empath).character_id());
|
||||
game.r#continue().sleep();
|
||||
|
||||
game.next().title().insomniac();
|
||||
|
|
|
|||
Loading…
Reference in New Issue