Esempio n. 1
0
 private void Vote(Player player, Action action, Game game)
 {
     Player nominee = action.Target;
     if (nominee == null)
     {
         if (action.Text.Equals("no one") || action.Text.Equals("nobody") || action.Text.Equals("noone"))
         {
             Player NoOne = new Player("No one", "nobody");
             nominee = NoOne;
         }
         else
         {
             HandleBadAction(game, player, action, "You voted for an invalid player <b>" + action.Target + "</b> see the player's names below." + FlavorText.Divider + game.Status());
             return;
         }
     }
     if (nominee.Equals(player))
     {
         HandleBadAction(game, player, action, "You cannot vote for yourself.");
     }
     else if (!nominee.IsAlive)
     {
         HandleBadAction(game, player, action, nominee.Name.b() + " is already dead. See who's alive below:" + FlavorText.Divider + game.Status());
     }
     else
     {
         Action vote = new Action(ActionEnum.Vote);
         vote.Target = nominee;
         player.AddAction(vote);
         Gmail.MessagePlayer(player, game, "Registered your vote for <b>" + nominee.Name + "</b>.");
         game.CheckEndOfCycle();
     }
 }
Esempio n. 2
0
 private void RoleAction(Player player, Action action, Game game)
 {
     //As of now role actions only happen at night
     if (game.ActiveCycle == Game.Cycle.Night)
     {
         string result = player.Role.AddAction(player, action, game);
         if (!String.IsNullOrEmpty(result))
         {
             HandleBadAction(game, player, action, result);
             return;
         }
         game.CheckEndOfCycle();
     }
 }