Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
        //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);
        }
Exemplo n.º 4
0
 public Workers(PopUnit pop, int sizeOfNewPop, Province where, Culture culture, IWayOfLifeChange oldLife) : base(pop, sizeOfNewPop, PopType.Workers, where, culture, oldLife)
 {
 }
Exemplo n.º 5
0
 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);
 }
Exemplo n.º 6
0
 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);
 }
Exemplo n.º 7
0
 protected Investor(PopUnit source, int sizeOfNewPop, PopType newPopType, Province where, Culture culture, IWayOfLifeChange oldLife) : base(source, sizeOfNewPop, newPopType, where, culture, oldLife)
 {
 }
Exemplo n.º 8
0
 public Capitalists(PopUnit pop, int sizeOfNewPop, Province where, Culture culture, IWayOfLifeChange oldLife) : base(pop, sizeOfNewPop, PopType.Capitalists, where, culture, oldLife)
 {
 }
Exemplo n.º 9
0
 public Tribesmen(PopUnit pop, int sizeOfNewPop, Province where, Culture culture, IWayOfLifeChange oldLife) : base(pop, sizeOfNewPop, PopType.Tribesmen, where, culture, oldLife)
 {
 }
Exemplo n.º 10
0
 public Artisans(PopUnit pop, int sizeOfNewPop, Province where, Culture culture, IWayOfLifeChange oldLife) : base(pop, sizeOfNewPop, PopType.Artisans, where, culture, oldLife)
 {
     changeProductionType();
 }