Exemplo n.º 1
0
        public ActionResult SubmitComms(CommsFormModel model)
        {
            var theGame = Game.GetGame(model.GameId);
            var player  = theGame.GetPlayer(model.ActorId);
            var comms   = new CommsEvent(player, model.CommsType, false, theGame.GetPlayer(model.WhomId), theGame.GetPlayer(model.WhereId));

            theGame.Hub.AnnounceComms(theGame, comms);
            return(Content(null));
        }
Exemplo n.º 2
0
        public void AnnounceComms(Game game, CommsEvent comms, bool accusing = false, string customMessage = null)
        {
            System.Threading.Thread.Sleep(300);
            string lied = accusing ? " lied! -- " : " ";

            game.AddToLog(comms);
            game.AnnounceToAIs(comms);
            string msg = comms.Speaker.NameSpan + "> ";

            if (customMessage != null)
            {
                Announce(game, msg + customMessage);
            }
            else
            {
                switch (comms.EventType)
                {
                case CommsTypeEnum.IWasBitten:
                    msg += "I've been bitten!";
                    break;

                case CommsTypeEnum.WillSleep:
                    msg += "I'm staying at home";
                    break;

                case CommsTypeEnum.Slept:
                    msg += comms.Whom.NameSpan + lied + " they stayed at home";
                    break;

                case CommsTypeEnum.GenericLie:
                    msg += comms.Whom.NameSpan + " is a liar!";
                    break;

                case CommsTypeEnum.WentOut:
                    if (comms.Where == null)
                    {
                        msg += comms.Whom.NameSpan + lied + " they went out";
                    }
                    else
                    {
                        msg += comms.Whom.NameSpan + lied + " they were at " + comms.Where.NameSpan + "'s";
                    }
                    break;
                }
                Announce(game, msg);
            }
        }