// will skip if already processed public void ProcessLie(string lier, CommsTypeEnum topic, string msg, CommsEvent fromComms) { if (CurrentTurnAlreadyProcessedComms.Contains(fromComms)) { return; } CurrentTurnAlreadyProcessedComms.Add(fromComms); KnownLies.Add(fromComms); Relation(lier).DarkSideSuspicion += 5; Trace(false, "Detect lie +5"); // can rat out a fellow vampire we don't like if (!Me.IsVampire || Relation(lier).Enmity > r.NextDouble() * 2) { if (Me.Strategy == StrategyEnum.AI) { var comms = new CommsEvent(Me, topic, false, Me.Game.GetPlayer(lier)); if (topic != CommsTypeEnum.LiedAboutSleeping) { // don't announce lied-about-sleeping because processed elsewhere //Me.Game.AddToLog(comms); Me.Game.Hub.AnnounceComms(Me.Game, comms, true, Me.Game.GetPlayer(lier).NameSpan + " lied! " + msg); } } } }
public void PreprocessAllComms() { // calculates LastNightWentOutProbability and detects contradictions foreach (var comm in CurrentTurnComms.Where(x => x.Speaker != Me)) { var thisRelation = Relation(comm.Speaker.Id); var aboutSamePerson = CurrentTurnComms.Where(x => x.Whom == comm.Whom && x != comm); if (aboutSamePerson.Any()) { foreach (var a in aboutSamePerson) { var otherTrust = MIstrustToMult(Relation(a.Speaker.Id).DarkSideSuspicion); if (KnownTruths.Contains(a)) { otherTrust = 100; } if (KnownLies.Contains(a)) { otherTrust -= 100; } if (AreMutuallyExclusive(a.EventType, comm.EventType) ) { thisRelation.ContradictionsThisTurn += otherTrust; thisRelation.SuspicionThisTurn += otherTrust * .5; } else if (AreEquivalent(a.EventType, comm.EventType)) { if (a.Where == comm.Where || a.Where == null || comm.Where == null) // could be null - that's fine { thisRelation.ContradictionsThisTurn -= otherTrust * .5; thisRelation.SuspicionThisTurn -= otherTrust * .2; } else if (a.Where != comm.Where) { thisRelation.ContradictionsThisTurn += otherTrust; thisRelation.SuspicionThisTurn += otherTrust * .5; } } // else the two assertions are orthoganal } } } foreach (var comm in CurrentTurnComms.Where(x => x.Speaker != Me)) { var thisRelation = Relation(comm.Speaker.Id); var trust = TrustThisTurn(comm.Speaker.Id); switch (comm.EventType) { case CommsTypeEnum.Slept: case CommsTypeEnum.WillSleep: if (comm.Whom.Id != Me.Id) { LastNightWentOutProbability[comm.Whom.Id] -= trust * .5; } break; case CommsTypeEnum.WentOut: if (comm.Whom.Id != Me.Id) { LastNightWentOutProbability[comm.Whom.Id] += trust * .5; } break; } } }