public Procent getAverageMorale() { Procent result = new Procent(0); int calculatedSize = 0; foreach (var item in allArmies) { result.addPoportionally(calculatedSize, item.getSize(), item.getAverageMorale()); calculatedSize += item.getSize(); } return(result); }
//public bool canWinUprising() //{ // var defence = country.getDefenceForces(); // if (defence == null) // return true; // else // return getMembership() > defence.getSize(); //} private Procent getAverageLoyalty() { Procent result = new Procent(0); int calculatedSize = 0; foreach (var item in members) { result.addPoportionally(calculatedSize, item.getPopulation(), item.loyalty); calculatedSize += item.getPopulation(); } return(result); }
public Procent getAverageLoyalty() { Procent result = new Procent(0f); int calculatedPopulation = 0; foreach (PopUnit pop in allPopUnits) { result.addPoportionally(calculatedPopulation, pop.getPopulation(), pop.loyalty); calculatedPopulation += pop.getPopulation(); } return(result); }
/// <summary> /// Gets average unemployment from all pop units /// </summary> /// <returns></returns> public Procent getUnemployment(Predicate <PopType> predicate) { Procent result = new Procent(0f); int calculatedBase = 0; foreach (var item in allPopUnits) { if (predicate(item.popType)) { if (item.popType.canBeUnemployed()) { result.addPoportionally(calculatedBase, item.getPopulation(), item.getUnemployedProcent()); } calculatedBase += item.getPopulation(); } } return(result); }
internal void add(Corps another) { size += another.getSize(); morale.addPoportionally(getSize(), another.getSize(), Procent.ZeroProcent); }