public void respondToProvinceRiots(Nation nation, Province prov) { Debug.Log("Respond to Province Riots"); int numberOfDisruptedProvinces = PlayerCalculator.getNumberOfDisrputedProvinces(nation); bool sameCulture = true; int nationWithSameCulture = nation.getIndex(); EventRegister eventLogic = State.eventRegister; App app = UnityEngine.Object.FindObjectOfType <App>(); int humanIndex = app.GetHumanIndex(); Nation human = State.getNations()[humanIndex]; if (!nation.culture.Equals(prov.getCulture())) { sameCulture = false; nationWithSameCulture = Utilities.findNationWithThisCulture(prov.getCulture()); } if (prov.isColony) { if (nation.GetColonialPoints() > 0) { //crack down on riots nation.SpendColonialPoints(1); } else { prov.setRioting(true); } } else if (!prov.isColony) { if (sameCulture) { if (nation.InfulencePoints > 0) { standardProvinceResponse(nation, prov, -1, -1); } else { prov.setRioting(true); } } // Now consider cases where the prov is not a colony and does not share the same culture as its owner else if (!prov.isColony && !sameCulture) { if (nation.InfulencePoints > 0) { Debug.Log("Not colony and not same culture"); //Consider who might get angry with the crackdown int otherNationIndex = Utilities.findNationWithThisCulture(prov.getCulture()); Nation otherNation = State.getNation(otherNationIndex); Debug.Log("Other Nation is: " + otherNation.getName()); int minorNationIndex = -1; Nation minorNation = new Nation(); if (otherNation.getType() == MyEnum.NationType.minor) { minorNationIndex = otherNation.getIndex(); minorNation = otherNation; otherNationIndex = PlayerCalculator.getMostFavouredMajorNation(otherNation); // The other nation is the guardian, not the owner of the nation otherNation = State.getNation(otherNationIndex); } int otherStrength = 0; int selfStrength = PlayerCalculator.CalculateArmyScore(nation); // Will anger another great power int relations = nation.Relations[otherNationIndex]; //This value is just for tests if (relations < 85) { Debug.Log("here"); standardProvinceResponse(nation, prov, otherNationIndex, minorNationIndex); } else { if (State.mapUtilities.shareLandBorder(nation, otherNation)) { otherStrength = PlayerCalculator.CalculateArmyScore(otherNation); } else { otherStrength = PlayerCalculator.CalculateNavalProjection(otherNation); } if (otherStrength * 1.15 < selfStrength) { //Not too afraid standardProvinceResponse(nation, prov, otherNationIndex, minorNationIndex); if (demandReferendum(otherNation, nation, prov)) { if (acceptRefDemand(nation, otherNation, prov)) { referendum(nation, otherNation, prov); } else { //nation refuses to hold a referendum if (warOverRejection(otherNation, nation, prov)) { War war = new War(otherNation, nation, prov.getIndex(), minorNationIndex); war.warBetweenAI(otherNation, nation); } else if (boycottOverRefDemandRejection(otherNation)) { otherNation.addBoycott(nation.getIndex()); //.................... } else { // Backdown PlayerPayer.loseFace(otherNation); } } } } if (otherStrength * 1.3 < selfStrength) { // Prefer not to provicate other nation, but might do so if situation calls for it int roll = Random.Range(1, 100); if (roll < 50) { nation.InfulencePoints--; prov.adjustDiscontentment(1); if (otherNation.getIndex() == humanIndex) { DecisionEvent newEvent = new DecisionEvent(); if (minorNationIndex == -1) { eventLogic.initalizeInformedOfCrackdownEvent(newEvent, human, nation, prov); } else { eventLogic.initalizeInformedOfCrackdownEvent(newEvent, human, nation, prov, minorNationIndex); } eventLogic.DecisionEvents.Enqueue(newEvent); } else if (demandReferendum(otherNation, nation, prov)) { if (acceptRefDemand(nation, otherNation, prov)) { referendum(nation, otherNation, prov); } else { if (warOverRejection(otherNation, nation, prov)) { War war = new War(otherNation, nation, prov.getIndex(), minorNationIndex); war.warBetweenAI(otherNation, nation); } } } else { prov.setRioting(true); } } else { prov.setRioting(true); } } else { // Don't want to f**k with these guys prov.setRioting(true); } } } else { Debug.Log("No Influence Points"); prov.setRioting(true); // Just for now nation.InfulencePoints++; } } } }