Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix psychic vision timings #408

Merged
merged 1 commit into from
Jan 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 4 additions & 69 deletions client/src/resources/excludedRolePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,85 +193,20 @@
"role": "death"
}
],
"El opuesto de mi novio": [
"Draculas Palace": [
{
"type": "exact",
"role": "mayor"
},
{
"type": "exact",
"role": "transporter"
},

{
"type": "exact",
"role": "sheriff"
},
{
"type": "exact",
"role": "lookout"
},

{
"type": "exact",
"role": "tracker"
},
{
"type": "exact",
"role": "seer"
},

{
"type": "exact",
"role": "doctor"
},
{
"type": "exact",
"role": "crusader"
},

{
"type": "exact",
"role": "vigilante"
},
{
"type": "exact",
"role": "veteran"
},
{
"type": "exact",
"role": "deputy"
},

{
"type": "exact",
"role": "mafioso"
},
{
"type": "exact",
"role": "consort"
},
{
"type": "exact",
"role": "blackmailer"
"role": "bodyguard"
},

{
"type": "exact",
"role": "janitor"
"role": "spy"
},

{
"type": "exact",
"role": "jester"
},
{
"type": "exact",
"role": "executioner"
},
{
"type": "exact",
"role": "doomsayer"
"role": "death"
}
]

Expand Down
4 changes: 2 additions & 2 deletions client/src/resources/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@
"chatMessage.spyBug.protected":"Your target was protected from an attack.",
"chatMessage.spyBug.transported":"Your target was transported.",
"chatMessage.psychicGood":"At least one of these players is a townie: \\0",
"chatMessage.psychicEvil":"At least one of these players is not a townie: \\0",
"chatMessage.psychicEvil":"At least one of these players is evil: \\0",
"chatMessage.psychicFailed":"There are not enough living players to have a vision.",
"chatMessage.retributionistMessage":"Your target got the following message:",
"chatMessage.necromancerMessage":"Your target got the following message:",
Expand Down Expand Up @@ -523,7 +523,7 @@

"wiki.entry.role.medium.title": "Medium",
"wiki.entry.role.medium.abilities":"* You can talk with the dead during the night\n* After you died, you can seance a living player twice",
"wiki.entry.role.medium.attributes":"* You can talk to other mediums during the night as well\n* A seance lets you communicate with the living after you died\n* Seance has two uses",
"wiki.entry.role.medium.attributes":"* You can talk to other mediums during the night\n* A seance lets you communicate with a living player after you died\n* Seance has two uses",

"wiki.entry.role.retributionist.title": "Retributionist",
"wiki.entry.role.retributionist.abilities":"* Force a dead player to use their ability on a living one",
Expand Down
4 changes: 3 additions & 1 deletion server/src/game/role/psychic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ impl RoleStateImpl for Psychic {

let mut rng = rand::thread_rng();
actor_ref.push_night_message(game, 'a: {match game.day_number() % 2 {
0=>{
1=>{
//evil vision
let all_non_townies: Vec<_> = PlayerReference::all_players(game)
.into_iter()
.filter(|p|p.alive(game)&&*p!=actor_ref&&p.night_appeared_role(game).faction_alignment().faction()!=Faction::Town)
Expand All @@ -66,6 +67,7 @@ impl RoleStateImpl for Psychic {
ChatMessage::PsychicFailed
},
_=>{
//good vision
let all_townies: Vec<_> = PlayerReference::all_players(game)
.into_iter()
.filter(|p|p.alive(game)&&*p!=actor_ref&&p.night_appeared_role(game).faction_alignment().faction()==Faction::Town)
Expand Down
26 changes: 26 additions & 0 deletions server/tests/role.rs
Original file line number Diff line number Diff line change
Expand Up @@ -866,4 +866,30 @@ fn seer_cant_see_godfather() {
),
ChatMessage::SeerResult { enemies: false }
);
}

#[test]
fn vampire_convert_bodyguard() {
kit::scenario!(game in Night 1 where
vamp: Vampire,
bg: Bodyguard,
_bg2: Bodyguard
);

assert!(vamp.set_night_targets(vec![bg]));
assert!(bg.set_night_targets(vec![bg]));

game.next_phase();

assert!(vamp.role_state().role() == Role::Vampire);
assert!(bg.role_state().role() == Role::Bodyguard);

game.skip_to(PhaseType::Night, 2);

assert!(vamp.set_night_targets(vec![bg]));

game.next_phase();

assert!(vamp.role_state().role() == Role::Vampire);
assert!(bg.role_state().role() == Role::Vampire);
}
Loading