public void turnTickAI_Basic(Map map) { foreach (Evidence ev in evidenceCarried) { if (ev.pointsTo != null && ev.pointsTo != this) { if (huntableSuspects.Contains(ev.pointsTo) == false) { huntableSuspects.Add(ev.pointsTo); } } } if (this.location.soc == society) { sinceHome = 0; if (this.hp < maxHp && task == null && location.settlement != null) { task = new Task_Resupply(); } } else { sinceHome += 1; } if (task == null || task is Task_Wander) { bool onDisease = false; foreach (Property pr in location.properties) { if (pr.proto.isDisease) { onDisease = true; break; } } if (onDisease) { task = new Task_TreatDisease(); task.turnTick(this); return; } } if (task != null) { task.turnTick(this); return; } else if (society.isAtWar()) { task = new Task_SupportMilitary(); } else if (location.evidence.Count > 0) { task = new Task_Investigate(); } else if (sinceHome > wanderDur) { task = new Task_GoToSocialGroup(society); } else { task = new Task_Wander(); } task.turnTick(this); }
public void turnTickAI_Medic(Map map) { if (task == null) { bool onDisease = false; foreach (Property pr in location.properties) { if (pr.proto.isDisease) { onDisease = true; break; } } if (onDisease) { task = new Task_TreatDisease(); return; } double dist = 0; Location plagueLoc = null; foreach (Location loc in map.locations) { if (loc.soc == null || loc.soc.hostileTo(this)) { continue; } bool hasDisease = false; foreach (Property pr in loc.properties) { if (pr.proto.isDisease) { hasDisease = true; break; } } if (!hasDisease) { continue; } double d = map.getDist(loc.hex, location.hex); if (plagueLoc == null) { plagueLoc = loc; dist = d; } else if (plagueLoc.soc != this.society && loc.soc == this.society) { plagueLoc = loc; dist = d; } else if (plagueLoc.soc == this.society && loc.soc != this.society) { //Don't switch to prefer a foreign location } else if (d < dist) { dist = d; plagueLoc = loc; } } if (plagueLoc != null) { task = new Task_GoToLocation(plagueLoc); } } if (task != null) { task.turnTick(this); } }