Example #1
0
 //internal bool canBuildNewFactory(FactoryType type)
 //{
 //    if (HaveFactory(type))
 //        return false;
 //    if (type.isResourceGathering() && type.basicProduction.getProduct() != this.resource
 //        || !type.basicProduction.getProduct().isInventedBy(getCountry())
 //        || type.isManufacture() && !getCountry().isInvented(Invention.Manufactories)
 //        || (type.basicProduction.getProduct() == Product.Cattle && !getCountry().isInvented(Invention.Domestication))
 //        )
 //        return false;
 //    return true;
 //}
 internal bool canBuildNewFactory(Province where)
 {
     if (where.hasFactory(this))
     {
         return(false);
     }
     if (isResourceGathering() && basicProduction.getProduct() != where.getResource() ||
         !basicProduction.getProduct().isInventedBy(where.getCountry()) ||
         isManufacture() && !where.getCountry().isInvented(Invention.Manufactures) ||
         (basicProduction.getProduct() == Product.Cattle && !where.getCountry().isInvented(Invention.Domestication))
         )
     {
         return(false);
     }
     return(true);
 }
Example #2
0
        //internal Army getVirtualArmy(Procent howMuchShouldBeInSecondArmy)
        //{
        //    if (howMuchShouldBeInSecondArmy.get() == 1f)
        //    {
        //        return this;
        //        //this.personal.Clear();
        //    }
        //    else
        //    {
        //        Army secondArmy = new Army(this.getOwner());
        //        //Army sumArmy = new Army();
        //        //sumArmy.add(this);
        //        //this.joinin(secondArmy);
        //        int secondArmyExpectedSize = howMuchShouldBeInSecondArmy.getProcent(this.getSize());

        //        //secondArmy.clear();

        //        int needToFullFill = secondArmyExpectedSize;
        //        while (needToFullFill > 0)
        //        {
        //            var corpsToBalance = this.getBiggestCorpsSmallerThan(needToFullFill);
        //            if (corpsToBalance == null)
        //                break;
        //            else
        //                //this.move(corpsToBalance, secondArmy);
        //                secondArmy.add(new Corps(corpsToBalance));
        //            needToFullFill = secondArmyExpectedSize - secondArmy.getSize();
        //        }
        //        return secondArmy;
        //    }

        //}
        internal BattleResult attack(Province prov)
        {
            var enemy = prov.getCountry();

            if (enemy == Country.NullCountry)
            {
                prov.mobilize();
            }
            else
            {
                enemy.mobilize(enemy.ownedProvinces);
            }
            enemy.consolidateArmies();
            return(attack(enemy.getDefenceForces()));
        }
Example #3
0
 protected Producer(Province province) : base(province.getCountry().getBank(), province)
 {
 }
Example #4
0
 virtual public Country getCountry()
 {
     return(province.getCountry());
 }