/// <summary> /// argument is NOT men, but they strength /// </summary> private int takeLossUnconverted(float lossStrenght, IWayOfLifeChange reason) { int totalMenLoss = 0; if (lossStrenght > 0f) { float streghtLoss; int menLoss; var armyStrenghtModifier = getStrenghtModifier(); float totalStrenght = getStrenght(armyStrenghtModifier); if (totalStrenght > 0f) { foreach (var corp in personal.ToList()) { var corpsStrenght = corp.Value.Type.getStrenght(); if (corpsStrenght * armyStrenghtModifier > 0)//(corp.Value.Type.getStrenght() > 0f) { streghtLoss = corp.Value.getStrenght(this, armyStrenghtModifier) * (lossStrenght / totalStrenght); menLoss = Mathf.RoundToInt(streghtLoss / (corpsStrenght * armyStrenghtModifier)); // corp.Value.Type.getStrenght()); totalMenLoss += corp.Value.TakeLoss(menLoss, reason); } } } } return(totalMenLoss); }
internal int TakeLoss(int loss, IWayOfLifeChange reason) { int alive = size - loss; if (alive > 0) { size = alive; origin.takeLoss(loss, reason); return(loss); } else { int wasSize = size; origin.takeLoss(size, reason); size = 0; return(wasSize); } }
//public void setOwner(Staff country) //{ // owner = country; //} private int takeLoss(int loss, IWayOfLifeChange reason) { int totalLoss = 0; if (loss > 0) { int totalSize = getSize(); int currentLoss; foreach (var corp in personal.Values.ToList()) { if (totalSize > 0) { currentLoss = Mathf.RoundToInt(corp.getSize() * loss / (float)totalSize); corp.TakeLoss(currentLoss, reason); totalLoss += currentLoss; } } } return(totalLoss); }
public Workers(PopUnit pop, int sizeOfNewPop, Province where, Culture culture, IWayOfLifeChange oldLife) : base(pop, sizeOfNewPop, PopType.Workers, where, culture, oldLife) { }
protected GrainGetter(PopUnit source, int sizeOfNewPop, PopType newPopType, Province where, Culture culture, IWayOfLifeChange oldLife) : base(source, sizeOfNewPop, newPopType, where, culture, oldLife) { changeProductionType(Product.Grain); //sentToMarket = new Storage(Product.Grain); }
protected CattleGetter(PopUnit source, int sizeOfNewPop, PopType newPopType, Province where, Culture culture, IWayOfLifeChange oldLife) : base(source, sizeOfNewPop, newPopType, where, culture, oldLife) { //storage = new Storage(Product.Cattle); //gainGoodsThisTurn = new Storage(Product.Cattle); //sentToMarket = new Storage(Product.Cattle); changeProductionType(Product.Cattle); }
protected Investor(PopUnit source, int sizeOfNewPop, PopType newPopType, Province where, Culture culture, IWayOfLifeChange oldLife) : base(source, sizeOfNewPop, newPopType, where, culture, oldLife) { }
public Capitalists(PopUnit pop, int sizeOfNewPop, Province where, Culture culture, IWayOfLifeChange oldLife) : base(pop, sizeOfNewPop, PopType.Capitalists, where, culture, oldLife) { }
public Tribesmen(PopUnit pop, int sizeOfNewPop, Province where, Culture culture, IWayOfLifeChange oldLife) : base(pop, sizeOfNewPop, PopType.Tribesmen, where, culture, oldLife) { }
public Artisans(PopUnit pop, int sizeOfNewPop, Province where, Culture culture, IWayOfLifeChange oldLife) : base(pop, sizeOfNewPop, PopType.Artisans, where, culture, oldLife) { changeProductionType(); }