public void turnTick() { if (settlement != null) { settlement.turnTick(); } foreach (Property p in properties) { p.proto.turnTick(this); } checkPropertiesEndOfTurn(); }
public void turnTick() { if (map.locations[index] != this) { throw new Exception("Assertion failed: locations not consistent"); } if (settlement != null) { settlement.turnTick(); } foreach (Property p in properties) { p.proto.turnTick(p, this); } checkPropertiesEndOfTurn(); foreach (Evidence e in evidence) { if (e.pointsTo != null && e.pointsTo.isEnthralled()) { map.hintSystem.popHint(HintSystem.hintType.EVIDENCE); } } if (soc != null && soc is Society) { foreach (Evidence e in evidence) { if (e.assignedInvestigator != null) { if (map.units.Contains(e.assignedInvestigator) == false) { e.assignedInvestigator = null; } //Dead else if (e.assignedInvestigator.location != this && e.assignedInvestigator.task is Task_GoToClue == false) { e.assignedInvestigator = null;//Disrupted } } e.rumourCounter += 1; if (e.rumourCounter > 4) { e.rumourCounter = 0; if (!e.reportedToSociety)//Evidence self-submits to the local society, to allow folks without investigators to have a chance { Society socSoc = (Society)soc; socSoc.evidenceSubmitted.Add(e); socSoc.lastEvidenceSubmission = map.turn; e.turnSubmitted = map.turn; e.locationFound = this; //double deltaFear = World.staticMap.param.threat_evidencePresented; if (socSoc.isDarkEmpire == false) { addAgentDreadAroundThisLocation(); //socSoc.dread_agents_evidenceFound += deltaFear; } } e.reportedToSociety = true; if (e.assignedInvestigator == null && e.pointsTo != null && e.pointsTo.person != null) { double minDist = 0; Unit bestU = null; foreach (Unit u in map.units) { if ( u is Unit_Investigator && u.person != null && u.person.state != Person.personState.enthralledAgent && u.person.getRelation(e.pointsTo.person).suspicion > 0 && u.task is Task_Wander && u.location.evidence.Count == 0) { double dist = map.getDist(u.location, this); dist *= Eleven.random.NextDouble(); if (dist < minDist || bestU == null) { bestU = u; minDist = dist; } } } if (bestU != null) { e.assignedInvestigator = bestU; bestU.task = new Task_GoToClue(this); map.world.prefabStore.popMsgAgent(bestU, e.pointsTo, bestU.getName() + " has learnt of evidence in " + this.getName() + " and is travelling to investigate." + " They recognised the methods of " + e.pointsTo.getName() + ", whom they were already suspicious of."); } } } } } bool needDeletion = false; foreach (Unit u in units) { if (u.location != this) { throw new Exception("Unit at wrong location: " + u.getName() + " at " + this.getName()); } if (map.units.Contains(u) == false) { needDeletion = true; //throw new Exception("Badly handled unit"); } } //A horrific hack, because units were, for whatever reason, getting left behind in locations //They called "disband", removed themselves from the main unit list, and even checked to ensure they were gone. For whatever reason, either they were not or they were re-added later //Bad times, can't fix, sad times // //Might have been fixed a while ago, I realise. Feel free to try removing this and seeing what it does. Or changing it to an assert if (needDeletion) { List <Unit> rems = new List <Unit>(); foreach (Unit u in units) { if (map.units.Contains(u) == false) { rems.Add(u); } } foreach (Unit u in rems) { units.Remove(u); } } recomputeLinkDisabling(); }