public void newGameCards() { if (RemainingCards == null) { RemainingCards = new List <Card>(); } else { RemainingCards.Clear(); } RemainingCards.AddRange(new Card[] { new Card(CardType.Fascist), new Card(CardType.Fascist), new Card(CardType.Liberal), new Card(CardType.Fascist), new Card(CardType.Liberal), new Card(CardType.Fascist), new Card(CardType.Fascist), new Card(CardType.Fascist), new Card(CardType.Liberal), new Card(CardType.Fascist), new Card(CardType.Liberal), new Card(CardType.Liberal), new Card(CardType.Fascist), new Card(CardType.Fascist), new Card(CardType.Fascist), new Card(CardType.Liberal), new Card(CardType.Fascist) }); RemainingCards.Shuffle(); }
public void MakeActionBeforeEnd() { try { if (FascistCardsOnBoard == 6) { CurrentRound.RoundState = RoundState.End; GameResult = new GameResult() { Fascists = Players.Where(p => p.Role != Role.Liberal).ToList(), WinningTeam = CardType.Fascist, Reason = "Six fascit Cards Placed on Board" }; } else if (CardsOnBoard.Where(c => c.CardType == CardType.Liberal).Count() == 5) { CurrentRound.RoundState = RoundState.End; GameResult = new GameResult() { Fascists = Players.Where(p => p.Role != Role.Liberal).ToList(), WinningTeam = CardType.Fascist, Reason = "Six fascit Cards Placed on Board" }; } else if (Players.Count == 9 || Players.Count == 10) { if (FascistCardsOnBoard == 1 && fascistCardPlacedNbre == 0) { fascistCardPlacedNbre++; CurrentRound.RoundState = RoundState.InvestigateMembership; } else if (FascistCardsOnBoard == 2 && fascistCardPlacedNbre == 1) { fascistCardPlacedNbre++; CurrentRound.RoundState = RoundState.InvestigateMembership; } else if (FascistCardsOnBoard == 3 && fascistCardPlacedNbre == 2) { fascistCardPlacedNbre++; CurrentRound.RoundState = RoundState.PickNextPresident; } else if (FascistCardsOnBoard == 4 && fascistCardPlacedNbre == 3) { CurrentRound.RoundState = RoundState.KillMember; } else if (FascistCardsOnBoard == 5 && fascistCardPlacedNbre == 4) { CurrentRound.RoundState = RoundState.KillMember; } else { MoveToNextTurn(); } } else if (Players.Count == 7 || Players.Count == 8) { if (FascistCardsOnBoard == 2 && fascistCardPlacedNbre == 0) { fascistCardPlacedNbre++; CurrentRound.RoundState = RoundState.InvestigateMembership; } else if (FascistCardsOnBoard == 3 && fascistCardPlacedNbre == 1) { fascistCardPlacedNbre++; CurrentRound.RoundState = RoundState.PickNextPresident; } else if (FascistCardsOnBoard == 4 && fascistCardPlacedNbre == 2) { CurrentRound.RoundState = RoundState.KillMember; } else if (FascistCardsOnBoard == 5 && fascistCardPlacedNbre == 3) { CurrentRound.RoundState = RoundState.KillMember; } else { MoveToNextTurn(); } } else { if (FascistCardsOnBoard == 3 && fascistCardPlacedNbre == 0) { fascistCardPlacedNbre++; CurrentRound.RoundState = RoundState.PeekNextCards; CurrentRound.CardsInHand.Clear(); if (RemainingCards.Count < 3) { DiscardedCards.Shuffle(); RemainingCards.AddRange(DiscardedCards); DiscardedCards.Clear(); } CurrentRound.CardsInHand.Add(RemainingCards[0]); CurrentRound.CardsInHand.Add(RemainingCards[1]); CurrentRound.CardsInHand.Add(RemainingCards[2]); } else if (FascistCardsOnBoard == 4 && fascistCardPlacedNbre == 1) { CurrentRound.RoundState = RoundState.KillMember; } else if (FascistCardsOnBoard == 5 && fascistCardPlacedNbre == 2) { CurrentRound.RoundState = RoundState.KillMember; } else { MoveToNextTurn(); } } } catch (Exception ex) { Console.WriteLine("ProceedAfterDiscard.ex: " + ex.Message); } }
public void ProceedAfterVote() { try { if (CurrentRound.VoteResults.Result) { //Update round: CurrentRound.ElectChancellor(); if (FascistCardsOnBoard >= 3 && playersDict[CurrentRound.ChancellorId].Role == Role.Hitler) { CurrentRound.RoundState = RoundState.End; GameResult = new GameResult() { Fascists = Players.Where(p => p.Role != Role.Liberal).ToList(), WinningTeam = CardType.Fascist, Reason = "Hitler elected after three fascit Cards Placed on Board" }; } else { if (RemainingCards.Count < 3) { DiscardedCards.Shuffle(); RemainingCards.AddRange(DiscardedCards); DiscardedCards.Clear(); } var cards = new List <Card>() { RemainingCards[0], RemainingCards[1], RemainingCards[2] }; RemainingCards.RemoveRange(0, 3); CurrentRound.PreparePresidentToDiscard(cards); } } else { CurrentRound.NbreOfFailedVotes++; if (CurrentRound.NbreOfFailedVotes == 3) { if (RemainingCards.Count < 1) { DiscardedCards.Shuffle(); RemainingCards.AddRange(DiscardedCards); DiscardedCards.Clear(); } Card card = RemainingCards[0]; RemainingCards.RemoveAt(0); CardsOnBoard.Add(card); CurrentRound.NbreOfFailedVotes = 0; MakeActionBeforeEnd(); } else { MoveToNextTurn(); } } } catch (Exception ex) { Console.WriteLine("ProceedAfterVote.ex : " + ex.Message); } }