Skip to content

Commit

Permalink
Fix rejectStart, fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack-Papel committed Dec 18, 2023
1 parent 023e1be commit 06f7ac6
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion client/src/game/gameManager.d.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DoomsayerGuess } from "../menu/game/gameScreenContent/RoleSpecificMenus/LargeDoomsayerMenu";
import GameState, { Phase, PhaseTimes, PlayerID, PlayerIndex, State, Verdict } from "./gameState.d";
import { Phase, PhaseTimes, PlayerID, PlayerIndex, State, Verdict } from "./gameState.d";
import { ToClientPacket, ToServerPacket } from "./packet";
import { RoleOutline } from "./roleListState.d";

Expand Down
2 changes: 1 addition & 1 deletion server/src/game/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ impl Game {

//if there are no teams left and multiple amnesiacs alive then the game is not over
if
remaining_teams.len() == 0 &&
remaining_teams.is_empty() &&
PlayerReference::all_players(self).into_iter()
.filter(|p|p.alive(self) && p.role_state(self).role() == role::Role::Amnesiac)
.collect::<Vec<_>>().len() > 1
Expand Down
2 changes: 1 addition & 1 deletion server/src/game/phase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ impl PhaseState {
// TODO send no trials left
Self::Evening { player_on_trial: None }
}else{
Self::Voting { trials_left: trials_left }
Self::Voting { trials_left }
}
},
&PhaseState::Evening { player_on_trial } => {
Expand Down
2 changes: 2 additions & 0 deletions server/src/game/role/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::single_match)]

use crate::game::player::PlayerReference;
use crate::game::visit::Visit;
use crate::game::Game;
Expand Down
6 changes: 3 additions & 3 deletions server/src/game/role/psychic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ impl RoleStateImpl for Psychic {
.filter(|p|p!=non_townie)
.collect::<Vec<_>>()
.choose_multiple(&mut rng, 2)
.map(|p|*p)
.copied()
.collect();

if let Some(random_player0) = random_players.get(0){
if let Some(random_player1) = random_players.get(1){

let mut out = vec![non_townie, random_player0, random_player1];
let mut out = [non_townie, random_player0, random_player1];
out.shuffle(&mut rng);
break 'a ChatMessage::PsychicEvil { players: [out[0].index(), out[1].index(), out[2].index()] }
}
Expand All @@ -77,7 +77,7 @@ impl RoleStateImpl for Psychic {
.collect::<Vec<_>>()
.choose(&mut rand::thread_rng()){

let mut out = vec![townie, random_player];
let mut out = [townie, random_player];
out.shuffle(&mut rng);

break 'a ChatMessage::PsychicGood { players: [out[0].index(), out[1].index()] }
Expand Down
2 changes: 1 addition & 1 deletion server/src/game/role_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ pub enum RoleOutline {
impl RoleOutline{
pub fn get_all_possible_roles(&self, excluded_roles: &[RoleOutline], taken_roles: &[Role]) -> Vec<Role> {
match self {
RoleOutline::Exact { role } => vec![role.clone()],
RoleOutline::Exact { role } => vec![*role],
RoleOutline::FactionAlignment { faction_alignment } => {
Role::values().into_iter()
.filter(|r|r.faction_alignment() == *faction_alignment)
Expand Down
2 changes: 1 addition & 1 deletion server/src/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl Listener{
}else{
false
}
).map(|p|p.0.clone())
).map(|p| *p.0)
}

pub fn on_connect(&mut self, connection: &Connection) {
Expand Down

1 comment on commit 06f7ac6

@vercel
Copy link

@vercel vercel bot commented on 06f7ac6 Dec 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

mafia-game – ./

mafia-game-itssammym.vercel.app
mafia-game-git-00x-main-itssammym.vercel.app
mafia-game.vercel.app

Please sign in to comment.