public void Simulate() { // Debug.Log(actions); foreach (Action action in actions) { if (action.GetActionType() == Action.move) { if (action.GetActionSubject().GetComponent <provincegen>().state == action.GetActionObject().GetComponent <provincegen>().state) { action.GetActionObject().GetComponent <provincegen>().army += action.GetQuantity(); } else { provincegen oc = action.GetActionSubject().GetComponent <provincegen>(); provincegen def = action.GetActionObject().GetComponent <provincegen>(); // Debug.LogError(string.Format("equality of ")); int ocArm = action.GetQuantity(); int defArm = def.army; int ocTech = oc.state.GetComponent <stategen>().GetCurrentTechLevel(); int defTech = def.state.GetComponent <stategen>().GetCurrentTechLevel(); // Debug.Log(string.Format("defTech = {0}", defTech)); int ocLoyality = (150 - oc.separatism); int defLoyality = (150 - def.separatism); int ocRes = ocArm * ocTech * ocLoyality; int defRes = (int)(defArm * defTech * defLoyality * (1 + (float)def.defensive_ability / 100f)); if (oc.state == intendant.ProtagonistState) { // Debug.LogError("contact"); Debug.LogError(string.Format("{0}, {1}", ocRes, defRes)); } if (ocRes > defRes) { Debug.Log("captured"); // Debug.Log(string.Format("{0}, {1}, {2}, {3}, {4}", defRes, defArm, defTech, defLoyality, (1 + (float)def.defensive_ability / 100f))); // Debug.Log(string.Format("{0}, {1}", def.GetId(), oc.state.GetComponent<stategen>().GetId())); intendant.CaptureProvince(def.gameObject, oc.state); def.army = ocArm - defArm; } else { def.army = defArm - ocArm; } } } } } }