public bool HasJobsFor(PopType type, Province province)
 {
     //if (this == Workers || this == Farmers || this == Tribesmen)
     if (this == Workers)
     {
         return(province.getUnemployment(x => x == Workers).isSmallerThan(MigrationUnemploymentLimit));
     }
     else if (this == Farmers || this == Tribesmen)
     {
         return(province.GetOverpopulation().isSmallerThan(Procent.HundredProcent));
     }
     else
     {
         return(true);
     }
 }
Example #2
0
        public override void produce()
        {
            Storage producedAmount;
            var     overpopulation = Province.GetOverpopulation();

            if (overpopulation.isSmallerOrEqual(Procent.HundredProcent)) // all is OK
            {
                producedAmount = new Storage(Type.getBasicProduction().Product, Type.getBasicProduction().Multiply(population.Get()).Divide(1000));
            }
            else
            {
                producedAmount = new Storage(Type.getBasicProduction().Product, Type.getBasicProduction().Multiply(population.Get()).Divide(1000).Divide(overpopulation));
            }

            if (producedAmount.isNotZero())
            {
                storage.add(producedAmount);
                addProduct(producedAmount);
                calcStatistics();
            }
        }