public VoteIssue_DeclareWar(Society soc, SocialGroup target, Person proposer) : base(soc, proposer) { this.target = target; }
internal virtual void takeAssault(SocialGroup sg, SocialGroup defender, double theirLosses) { }
public void Add(SocialGroup key, double value) { add(key, value); }
public Unit(Location loc, Society soc) { this.location = loc; this.society = soc; loc.units.Add(this); }
public Task_GoToSocialGroup(SocialGroup sg) { this.target = sg; }
public War(Map map, SocialGroup att, SocialGroup def) { startTurn = map.turn; this.att = att; this.def = def; }
public virtual void takeLocationFromOther(SocialGroup def, Location taken) { this.temporaryThreat += map.param.threat_takeLocation; }
public bool ContainsKey(SocialGroup key) { return(keys.Contains(key.randID)); }
public void takeLocationFromOther(SocialGroup att, SocialGroup def, Location taken) { World.log(att.getName() + " takes " + taken.getName() + " from " + def.getName()); int priority = MsgEvent.LEVEL_YELLOW; bool benefit = !def.hasEnthralled(); if (att.hasEnthralled()) { priority = MsgEvent.LEVEL_GREEN; } else if (def.hasEnthralled()) { priority = MsgEvent.LEVEL_RED; } else { priority = MsgEvent.LEVEL_YELLOW; } turnMessages.Add(new MsgEvent(att.getName() + " takes " + taken.getName() + " from " + def.getName(), priority, benefit)); if (taken.settlement != null) { if (taken.settlement.isHuman == false) { taken.settlement = null;//Burn it down } else if (taken.settlement.title != null && taken.settlement.title.heldBy != null) { Person lord = taken.settlement.title.heldBy; if (att is Society) { Society socAtt = (Society)att; lord.prestige *= param.combat_prestigeLossFromConquest; if (socAtt.getSovreign() != null) { lord.getRelation(socAtt.getSovreign()).addLiking(param.person_likingFromBeingInvaded, "Their nation invaded mine", turn); } foreach (Title t in lord.titles) { t.heldBy = null; } lord.titles.Clear(); movePerson(lord, socAtt); } else { lord.die("Killed by " + att.getName() + " when " + taken.getName() + " fell"); } } } taken.soc = att; att.takeLocationFromOther(def, taken); bool hasRemainingTerritory = false; foreach (Location loc in locations) { if (loc.soc == def) { hasRemainingTerritory = true; break; } } if (!hasRemainingTerritory) { World.log("Last territory taken"); addMessage(def.getName() + " has lost its last holdings to " + att.getName()); /* * if (att is Society && def is Society) * { * Society sAtt = (Society)att; * Society sDef = (Society)def; * List<Person> toMove = new List<Person>(); * foreach (Person p in sDef.people) * { * if (p.title_land == null) * { * toMove.Add(p); * } * } * foreach (Person p in toMove) * { * movePerson(p, sAtt); * addMessage(p.getFullName() + " is now part of the court of " + att.getName(), MsgEvent.LEVEL_GRAY, false); * } * } */ } }
public Color getColor(Hex hex) { if (mask == maskType.NONE) { if (GraphicalMap.selectedSelectable != null && GraphicalMap.selectedSelectable is Unit) { if (hex.owner != null && hex.owner.hostileTo((Unit)GraphicalMap.selectedSelectable)) { return(new Color(0.5f, 0.0f, 0f, 0.5f)); } } return(Color.clear); } else if (mask == maskType.NATION) { if (hex.owner != null) { float r = hex.owner.color.r; float g = hex.owner.color.g; float b = hex.owner.color.b; Color color = new Color(r, g, b, 0.8f); return(color); } else { return(new Color(0.5f, 0.5f, 0.5f, 0.5f)); } } else if (mask == maskType.PROVINCE) { return(new Color(hex.province.cr, hex.province.cg, hex.province.cb, 0.5f)); } else if (mask == maskType.VOTE_EFFECT) { if (GraphicalMap.selectedHex != null && GraphicalMap.selectedHex.location != null && GraphicalMap.selectedHex.location.person() != null && hex.location != null && hex.location.soc != null) { if (GraphicalMap.selectedHex == hex) { return(new Color(1f, 1f, 1f, 0.5f)); } Person voter = GraphicalMap.selectedHex.location.person(); if (hex.location.soc == voter.society) { if (hex.location.person() != null && hex.location.soc is Society) { Society soc = (Society)hex.location.soc; if (soc.voteSession == null) { return(new Color(0f, 0f, 0f, 0.75f)); } VoteOption opt = null; foreach (VoteOption o2 in soc.voteSession.issue.options) { if (o2.votesFor.Contains(voter)) { opt = o2; break; } } if (opt == null) { soc.voteSession.assignVoters(); } foreach (VoteOption o2 in soc.voteSession.issue.options) { if (o2.votesFor.Contains(voter)) { opt = o2; break; } } if (soc.voteSession != null) { float delta = (float)soc.voteSession.issue.getLikingDelta(hex.location.person(), opt, soc.voteSession.issue); delta /= 25; if (delta > 1) { delta = 1f; } if (delta < -1) { delta = -1f; } if (delta >= 0) { return(new Color(0f, delta, 0f, 0.75f)); } else { return(new Color(-delta, 0f, 0f, 0.75f)); } } } } } return(new Color(0f, 0f, 0f, 0.75f)); } else if (mask == maskType.THREAT) { if (hex.location != null && GraphicalMap.selectedHex != null && GraphicalMap.selectedHex.location != null && GraphicalMap.selectedHex.location.settlement != null && GraphicalMap.selectedHex.location.settlement.title != null && GraphicalMap.selectedHex.location.settlement.title.heldBy != null) { SocialGroup group = GraphicalMap.selectedHex.location.soc; Person p = GraphicalMap.selectedHex.settlement.title.heldBy; double highestThreat = 0; foreach (ThreatItem item in p.threatEvaluations) { if (item.group != null && item.threat > highestThreat) { highestThreat = item.threat; } } if (highestThreat != 0) { if (hex.location.soc == null) { return(Color.black); } double threat = 0; foreach (ThreatItem item in p.threatEvaluations) { if (item.group == hex.location.soc) { threat = item.threat / highestThreat; break; } } float mult = (float)threat; mult = Mathf.Max(0, mult); mult = Mathf.Min(1, mult); //Color color = new Color(r, g, b, 0.8f); Color color = new Color(mult, 0, 0, 0.5f); return(color); } else { return(Color.black); } } else if (hex.location != null) { return(new Color(0f, 0f, 0f, 1f)); } else { return(new Color(0f, 0f, 0f, 0.75f)); } } else if (mask == maskType.LIKING_THEM) { Color c = new Color(0, 0, 0, 0.5f); try { Person me = null; if (GraphicalMap.selectedSelectable is Unit) { if (((Unit)GraphicalMap.selectedSelectable).person != null) { me = ((Unit)GraphicalMap.selectedSelectable).person; } } else { me = GraphicalMap.selectedHex.location.settlement.title.heldBy; } Person them = hex.location.settlement.title.heldBy; float liking = (float)them.getRelation(me).getLiking(); if (liking > 0) { if (liking > 100) { liking = 100; } liking /= 100; c = new Color(0, liking, 0, 0.5f); } else { liking *= -1; if (liking > 100) { liking = 100; } liking /= 100; c = new Color(liking, 0, 0, 0.5f); } } catch (NullReferenceException e) { } catch (ArgumentNullException e) { } return(c); } else if (mask == maskType.LIKING_ME) { Color c = new Color(0, 0, 0, 0.5f); try { Person me = null; if (GraphicalMap.selectedSelectable is Unit) { if (((Unit)GraphicalMap.selectedSelectable).person != null) { me = ((Unit)GraphicalMap.selectedSelectable).person; } } else { me = GraphicalMap.selectedHex.location.settlement.title.heldBy; } Person them = hex.location.settlement.title.heldBy; float liking = (float)me.getRelation(them).getLiking(); if (liking > 0) { if (liking > 100) { liking = 100; } liking /= 100; c = new Color(0, liking, 0, 0.5f); } else { liking *= -1; if (liking > 100) { liking = 100; } liking /= 100; c = new Color(liking, 0, 0, 0.5f); } } catch (NullReferenceException e) { } catch (ArgumentNullException e) { } return(c); } else if (mask == maskType.AWARENESS) { try { Person them = hex.settlement.title.heldBy; return(new Color((float)them.awareness, 0, 0, 0.9f)); } catch (Exception e) { return(new Color(0, 0, 0, 0.9f)); } } else if (mask == maskType.INFILTRATION) { try { float inf = (float)hex.settlement.infiltration; return(new Color(inf, inf, inf, 0.9f)); } catch (Exception e) { return(new Color(0, 0, 0, 0.9f)); } } else if (mask == maskType.SUSPICION) { try { Person me = GraphicalMap.selectedHex.settlement.title.heldBy; Person them = hex.settlement.title.heldBy; RelObj rel = me.getRelation(them); return(new Color((float)rel.suspicion, 0, 0, 0.5f)); }catch (Exception e) { return(new Color(0, 0, 0, 0.5f)); } } else if (mask == maskType.SUSPICION_FROM) { try { Person them = GraphicalMap.selectedHex.settlement.title.heldBy; Person me = hex.settlement.title.heldBy; RelObj rel = me.getRelation(them); return(new Color((float)rel.suspicion, 0, 0, 0.5f)); } catch (Exception e) { return(new Color(0, 0, 0, 0.5f)); } } else if (mask == maskType.TESTING) { if (hex.location != null) { if (hex.location.debugVal == map.turn) { return(new Color(1, 1, 1, 0.5f)); } else { return(new Color(0, 0, 0, 0.5f)); } } return(new Color(0f, 0f, 0f, 0.75f)); } else { return(new Color(0, 0, 0, 0)); } }
public void processWars() { //Every society decides which other to attack, assuming it is over threshold combat strength foreach (SocialGroup sg in socialGroups) { if (sg.lastBattle == turn) { continue; } //Only one battle permitted per social group (that they initiate, at least) if (checkDefensiveAttackHold(sg)) { continue; } //Should you stop attacking, to conserve strength? if (sg.currentMilitary < sg.maxMilitary * param.combat_thresholdAttackStrength) { continue; } //Below min strength sg.lastBattle = turn; int c = 0; Location attackFrom = null; Location attackTo = null; foreach (Location l in locations) { if (l.soc == sg) { foreach (Link link in l.links) { if (link.other(l).soc != null && link.other(l).soc != sg && link.other(l).soc.getRel(sg).state == DipRel.dipState.war) { if (link.other(l).lastTaken == turn) { continue; } //Can't retake on this turn c += 1; if (Eleven.random.Next(c) == 0) { attackFrom = l; attackTo = link.other(l); } } } } } if (attackFrom != null) { SocialGroup defender = attackTo.soc; //sg.lastBattle = turn; //defender.lastBattle = turn; World.log(sg.getName() + " attacking into " + attackTo.getName()); double myStr = sg.currentMilitary * Eleven.random.NextDouble(); double theirStr = defender.currentMilitary * Eleven.random.NextDouble(); if (myStr < 1) { myStr = Math.Min(1, sg.currentMilitary); } if (theirStr < 1) { theirStr = Math.Min(1, defender.currentMilitary); } //Note the defensive fortifications only reduce losses, not increase chance of taking territory double myLosses = theirStr * param.combat_lethality; sg.currentMilitary -= myLosses; if (sg.currentMilitary < 0) { sg.currentMilitary = 0; } double theirLosses = myStr * param.combat_lethality; theirLosses = computeDefensiveBonuses(theirLosses, sg, defender); theirLosses = attackTo.takeMilitaryDamage(theirLosses); defender.currentMilitary -= theirLosses; if (defender.currentMilitary < 0) { defender.currentMilitary = 0; } addMessage(sg.getName() + " attacks " + defender.getName() + ". Inflicts " + (int)(theirLosses) + " dmg, takes " + (int)(myLosses), MsgEvent.LEVEL_YELLOW, false); if (attackTo.settlement != null) { attackTo.settlement.takeAssault(sg, defender, theirLosses); } //Can only take land if there are no defenses in place if (myStr > theirStr * param.combat_takeLandThreshold && (attackTo.getMilitaryDefence() <= 0.01)) { takeLocationFromOther(sg, defender, attackTo); attackTo.lastTaken = turn; } if (sg is Society && defender is Society) { Property.addProperty(this, attackTo, "Recent Human Battle"); } world.prefabStore.particleCombat(attackFrom.hex, attackTo.hex); } } foreach (SocialGroup group in socialGroups) { foreach (DipRel rel in group.getAllRelations()) { if (rel.state == DipRel.dipState.war && rel.war.canTimeOut) { if (turn - rel.war.startTurn > param.war_defaultLength) { declarePeace(rel); } } } } }
public DipRel(Map map, SocialGroup a, SocialGroup b) { this.map = map; this.a = a; this.b = b; }
public void add(SocialGroup key, double value) { keys.Add(key); values.Add(value); }
public void Add(SocialGroup key, DipRel value) { add(key, value); }
public Color getColor(Hex hex) { if (mask == maskType.NATION) { if (hex.owner != null) { float r = hex.owner.color[0]; float g = hex.owner.color[1]; float b = hex.owner.color[2]; Color color = new Color(r, g, b, 0.8f); return(color); } else { return(new Color(0.5f, 0.5f, 0.5f, 0.5f)); } } else if (mask == maskType.PROVINCE) { return(new Color(hex.province.cr, hex.province.cg, hex.province.cb, 0.5f)); } else if (mask == maskType.INFORMATION) { if (hex.location != null && GraphicalMap.selectedHex != null && GraphicalMap.selectedHex.location != null && GraphicalMap.selectedHex.location.soc != null) { SocialGroup group = GraphicalMap.selectedHex.location.soc; float mult = (float)map.getInformationAvailability(hex.location, group); mult = Mathf.Max(0, mult); mult = Mathf.Min(1, mult); float r = mult; float g = mult; float b = mult; //Color color = new Color(r, g, b, 0.8f); Color color = new Color(0, 0, 0, (1 - mult)); return(color); } else if (hex.location != null) { return(new Color(0f, 0f, 0f, 1f)); } else { return(new Color(0f, 0f, 0f, 0.75f)); } } else if (mask == maskType.THREAT) { if (hex.location != null && GraphicalMap.selectedHex != null && GraphicalMap.selectedHex.location != null && GraphicalMap.selectedHex.location.settlement != null && GraphicalMap.selectedHex.location.settlement.title != null && GraphicalMap.selectedHex.location.settlement.title.heldBy != null) { SocialGroup group = GraphicalMap.selectedHex.location.soc; Person p = GraphicalMap.selectedHex.settlement.title.heldBy; double highestThreat = 0; foreach (ThreatItem item in p.threatEvaluations) { if (item.group != null && item.threat > highestThreat) { highestThreat = item.threat; } } if (highestThreat != 0) { if (hex.location.soc == null) { return(Color.black); } double threat = 0; foreach (ThreatItem item in p.threatEvaluations) { if (item.group == hex.location.soc) { threat = item.threat / highestThreat; break; } } float mult = (float)threat; mult = Mathf.Max(0, mult); mult = Mathf.Min(1, mult); float r = mult; float g = mult; float b = mult; //Color color = new Color(r, g, b, 0.8f); Color color = new Color(mult, 0, 0, 0.5f); return(color); } else { return(Color.black); } } else if (hex.location != null) { return(new Color(0f, 0f, 0f, 1f)); } else { return(new Color(0f, 0f, 0f, 0.75f)); } } else if (mask == maskType.LIKING_THEM) { Color c = new Color(0, 0, 0, 0.5f); try { Person me = GraphicalMap.selectedHex.location.settlement.title.heldBy; Person them = hex.location.settlement.title.heldBy; float liking = (float)them.getRelation(me).getLiking(); if (liking > 0) { if (liking > 100) { liking = 100; } liking /= 100; c = new Color(0, liking, 0, 0.5f); } else { liking *= -1; if (liking > 100) { liking = 100; } liking /= 100; c = new Color(liking, 0, 0, 0.5f); } } catch (NullReferenceException e) { } catch (ArgumentNullException e) { } return(c); } else if (mask == maskType.LIKING_ME) { Color c = new Color(0, 0, 0, 0.5f); try { Person me = GraphicalMap.selectedHex.location.settlement.title.heldBy; Person them = hex.location.settlement.title.heldBy; float liking = (float)me.getRelation(them).getLiking(); if (liking > 0) { if (liking > 100) { liking = 100; } liking /= 100; c = new Color(0, liking, 0, 0.5f); } else { liking *= -1; if (liking > 100) { liking = 100; } liking /= 100; c = new Color(liking, 0, 0, 0.5f); } } catch (NullReferenceException e) { } catch (ArgumentNullException e) { } return(c); } else if (mask == maskType.EVIDENCE) { try { Person them = hex.settlement.title.heldBy; return(new Color((float)them.evidence, 0, 0, 0.5f)); } catch (Exception e) { return(new Color(0, 0, 0, 0.5f)); } } else if (mask == maskType.SUSPICION) { try { Person me = GraphicalMap.selectedHex.settlement.title.heldBy; Person them = hex.settlement.title.heldBy; RelObj rel = me.getRelation(them); return(new Color((float)rel.suspicion, 0, 0, 0.5f)); }catch (Exception e) { return(new Color(0, 0, 0, 0.5f)); } } else if (mask == maskType.SUSPICION_FROM) { try { Person them = GraphicalMap.selectedHex.settlement.title.heldBy; Person me = hex.settlement.title.heldBy; RelObj rel = me.getRelation(them); return(new Color((float)rel.suspicion, 0, 0, 0.5f)); } catch (Exception e) { return(new Color(0, 0, 0, 0.5f)); } } else if (mask == maskType.TESTING) { if (hex.location != null) { if (hex.location.debugVal == map.turn) { return(new Color(1, 1, 1, 0.5f)); } else { return(new Color(0, 0, 0, 0.5f)); } } return(new Color(0f, 0f, 0f, 0.75f)); } else { return(new Color(0, 0, 0, 0)); } }
public void add(SocialGroup key, DipRel value) { keys.Add(key.randID); values.Add(value); }
public void processExpirables() { if (offensiveTarget != null && offensiveTarget.checkIsGone()) { offensiveTarget = null; } List <EconEffect> rems = new List <EconEffect>(); foreach (EconEffect effect in econEffects) { bool hasFrom = false; bool hasTo = false; foreach (Location loc in map.locations) { if (loc.soc == this && loc.settlement != null && loc.settlement.econTraits().Contains(effect.from)) { hasFrom = true; break; } } if (hasFrom == false) { effect.durationLeft = 0; } //No longer valid else { foreach (Location loc in map.locations) { if (loc.soc == this && loc.settlement != null && loc.settlement.econTraits().Contains(effect.to)) { hasTo = true; break; } } if (hasTo == false) { effect.durationLeft = 0; } //No longer valid } if (effect.durationLeft > 0) { effect.durationLeft -= 1; } if (effect.durationLeft == 0) { rems.Add(effect); } } foreach (EconEffect effect in rems) { econEffects.Remove(effect); } if (isRebellion) { if (!isAtWar()) { if (this.getCapital() != null) { isRebellion = false; World.log(this.getName() + " has successfully defended itself and broken away properly. Renaming now"); this.setName(this.getCapital().shortName); } } } }
public Location[] getEmptyPathTo(SocialGroup source, SocialGroup b) { HashSet <Location> seen = new HashSet <Location>(); List <Location> open = new List <Location>(); List <Location[]> paths = new List <Location[]>(); foreach (Location a in locations) { if (a.soc == source) { open.Add(a); seen.Add(a); paths.Add(new Location[] { a }); } } int nSteps = 0; Location loc; while (true) { List <Location> border = new List <Location>(); List <Location[]> newPaths = new List <Location[]>(); nSteps += 1; for (int i = 0; i < open.Count; i++) { loc = open[i]; foreach (Location l2 in getNeighbours(loc)) { if (seen.Contains(l2)) { continue; } if (l2.soc != null && l2.soc != b) { continue; } Location[] path = new Location[paths[i].Length + 1]; for (int j = 0; j < paths[i].Length; j++) { path[j] = paths[i][j]; } path[path.Length - 1] = l2; if (l2.soc == b) { return(path); } border.Add(l2); newPaths.Add(path); seen.Add(l2); } } if (border.Count == 0) { return(null); } //Can't reach without crossing through other nation's terrain open = border; paths = newPaths; if (nSteps > 128) { throw new Exception("Map discontinuity detected"); } } }
public override void castInner(Map map, Unit u) { Society soc = (Society)u.location.soc; SocialGroup enemy = null; foreach (SocialGroup sg in map.socialGroups) { if (sg.getRel(u.location.soc).state == DipRel.dipState.war) { bool controlled = false; if (sg is Society) { Society sgSoc = (Society)sg; if (sgSoc.isDarkEmpire) { controlled = true; } } else { controlled = sg.isDark(); } if (controlled && sg.currentMilitary > u.location.soc.currentMilitary) { enemy = sg; } } } if (enemy == null) { map.world.prefabStore.popMsg(soc.getName() + " is not at war with a superior military you control."); return; } HashSet <Person> targets = new HashSet <Person>(); foreach (Person p in soc.people) { targets.Add(p); } int nSaved = 0; foreach (Location loc in map.locations) { if (loc.soc == soc) { foreach (Location l2 in loc.getNeighbours()) { if (l2.soc != soc) { if (l2.person() != null) { targets.Add(l2.person()); } } } nSaved += 1; } } if (nSaved >= 10) { AchievementManager.unlockAchievement(SteamManager.achievement_key.SAVIOUR); } foreach (Person p in targets) { double boost = 100; //Let's not overcomplicate this one //foreach (ThreatItem item in p.threatEvaluations) //{ // if (item.group == enemy) // { // boost = item.threat; // } //} //if (boost > 150) { boost = 150; } //if (boost < 25) { boost = 25; } p.getRelation(u.person).addLiking(boost, "Our Saviour!", map.turn, RelObj.STACK_REPLACE, true); } DipRel rel = soc.getRel(enemy); if (rel.war != null) { rel.war.startTurn = map.turn; } List <Unit> rems = new List <Unit>(); foreach (Unit u2 in map.units) { if (u2.society == enemy && u2.isMilitary) { rems.Add(u2); } else if (u2.society == soc && u2 is Unit_Army) { u2.task = null;//Retask, to drop the 'defend the homeland' defensive task and go on the offensive } } foreach (Unit u2 in rems) { u2.die(map, "Killed by The Saviour"); } soc.posture = Society.militaryPosture.offensive;//Flip to assault mode to ruin the dark forces Evidence e2 = new Evidence(map.turn); e2.pointsTo = u; e2.weight = u.location.map.param.unit_majorEvidence; u.location.evidence.Add(e2); u.location.map.world.prefabStore.popImgMsg(u.getName() + " saves " + soc.getName() + " from invasion by " + enemy.getName() + "." + "\nNobles within the nation, and those adjacent to it gain liking for " + soc.getName() + ". " + targets.Count + " nobles affected. " + rems.Count + " units killed." + soc.getName() + " will now wage this war with renewed vigour, driving back their dark enemy", u.location.map.world.wordStore.lookup("ABILITY_SAVIOUR_INVASION"), 7); }
public VoteIssue_Vassalise(Society soc, Society target, Person proposer) : base(soc, proposer) { this.target = target; }
public void setTo(ThreatItem other) { group = other.group; form = other.form; }
public Unit_TesterDark(Location loc, SocialGroup soc) : base(loc, soc) { maxHp = 5; hp = 5; }
public void declareWar(SocialGroup att, SocialGroup def) { World.log(att.getName() + " declares war on " + def.getName()); int priority = MsgEvent.LEVEL_ORANGE; bool good = false; if (att.hasEnthralled()) { good = true; priority = MsgEvent.LEVEL_GREEN; } if (def.hasEnthralled()) { priority = MsgEvent.LEVEL_RED; } Location attLoc = null; foreach (Location loc in locations) { if (loc.soc == att) { attLoc = loc; } } Hex focusHex = null; if (attLoc != null) { focusHex = attLoc.hex; } turnMessages.Add(new MsgEvent(att.getName() + " launches an offensive against " + def.getName(), priority, good, focusHex)); att.getRel(def).state = DipRel.dipState.war; att.getRel(def).war = new War(this, att, def); if (def.getRel(att).state != DipRel.dipState.war) { throw new Exception("Asymmetric war"); } foreach (Location loc in locations) { if (loc.soc == att || loc.soc == def) { if (loc.settlement != null && loc.settlement.embeddedUnit != null) { loc.units.Add(loc.settlement.embeddedUnit); units.Add(loc.settlement.embeddedUnit); loc.settlement.embeddedUnit = null; } } } if (att is Society) { Society sAtt = (Society)att; sAtt.crisisWarLong = "We are at war, attacking " + def.getName() + ". We can discuss how to deploy our forces."; sAtt.crisisWarShort = "Crisis: At War"; //Get the agents moving early, or they'll stick around doing whatever nonsense they previously were foreach (Unit u in units) { if (u.society == def && u is Unit_Investigator && (((Unit_Investigator)u).state == Unit_Investigator.unitState.basic || ((Unit_Investigator)u).state == Unit_Investigator.unitState.knight) && (u.task is Task_Disrupted == false)) { u.task = new Task_DefendHomeland(); } } } att.addHistory("We declared war on " + def.getName()); if (def is Society) { Society sDef = (Society)def; sDef.crisisWarLong = att.getName() + " has attacked us, and we are at war. We must respond to this crisis."; sDef.crisisWarShort = "Crisis: At War"; //Get the agents moving early, or they'll stick around doing whatever nonsense they previously were foreach (Unit u in units) { if (u.society == def && u is Unit_Investigator && (((Unit_Investigator)u).state == Unit_Investigator.unitState.basic || ((Unit_Investigator)u).state == Unit_Investigator.unitState.knight) && (u.task is Task_Disrupted == false)) { u.task = new Task_DefendHomeland(); } } } def.addHistory(att.getName() + " declared war on us"); }