public void LogAndAnnounceVotes(DayInstruction di) { var subject = di.Actor; var stakeWhom = di.StakeVote; if (stakeWhom != null) { var sv = new GameEvent() { EventType = EventTypeEnum.VoteStake, Speaker = subject, Whom = stakeWhom }; AddToLog(sv); AnnounceEventToAIs(sv); } var jailWhom = di.JailVote; if (jailWhom != null) { var jv = new GameEvent() { EventType = EventTypeEnum.VoteJail, Speaker = subject, Whom = jailWhom }; AddToLog(jv); AnnounceEventToAIs(jv); // currently they don't care } }
public void ProcessDayInstruction(DayInstruction i) { var logevent = new GameEvent(); if (CurrentTurn().DayInstructions.Any()) { var existing = CurrentTurn().DayInstructions.Where(x => x.Actor == i.Actor).FirstOrDefault(); if (existing != null) { throw new Exception("Day instructions already given for player & turn."); } } CurrentTurn().DayInstructions.Add(i); Hub.DisplayVotes(this, VotesNeeded); if (CurrentTurn().DayInstructions.Count() == MobilePlayers .Where(m => m.Strategy == StrategyEnum.Human) .Count()) { // all human orders entered GetDayInstructionsFromAIs(); } if (CurrentTurn().DayInstructions.Count() == LivingPlayers.Count()) { FinishDay(); } }
public void GetDayInstructionsFromAIs() { foreach (var p in MobilePlayers.Where(p => p.Strategy == StrategyEnum.AI)) { var inst = p.AI.GetDayInstruction(MobilePlayers.Select(m => m.Id).ToList(), CurrentTurn().Id); var inst2 = new DayInstruction(this, inst); ProcessDayInstruction(inst2); } }