コード例 #1
0
        public override void produce()
        {
            // artisan shouldn't work with PE
            if (getCountry().economy.getValue() == Economy.PlannedEconomy)
            {
                artisansProduction = null;
            }
            else
            {
                if (Game.Random.Next(Options.ArtisansChangeProductionRate) == 1
                    )// && (artisansProduction==null
                     //|| (artisansProduction !=null && needsFulfilled.isSmallerThan(Options.ArtisansChangeProductionLevel))))
                {
                    changeProductionType();
                }

                if (artisansProduction != null)
                {
                    if (artisansProduction.isAllInputProductsCollected())
                    {
                        artisansProduction.produce();
                        if (Economy.isMarket.checkIftrue(getCountry()))
                        {
                            sell(getGainGoodsThisTurn());
                            //sentToMarket.set(gainGoodsThisTurn);
                            //storage.setZero();
                            //Game.market.sentToMarket.add(gainGoodsThisTurn);
                        }
                        else if (getCountry().economy.getValue() == Economy.NaturalEconomy)
                        {
                            // send to market?
                            sell(getGainGoodsThisTurn());
                            //sentToMarket.set(gainGoodsThisTurn);
                            //storage.setZero();
                            //Game.market.sentToMarket.add(gainGoodsThisTurn);
                        }
                        else if (getCountry().economy.getValue() == Economy.PlannedEconomy)
                        {
                            storage.sendAll(getCountry().countryStorageSet);
                        }
                    }
                    //else
                    //   changeProductionType();
                }
            }
        }
コード例 #2
0
 public override void produce()
 {
     // artisan shouldn't work with PE
     if (Country.economy.getValue() == Economy.PlannedEconomy)
     {
         artisansProduction = null;
     }
     else
     {
         Rand.Call(() => checkProfit(), 10);                    // changes production type if needed
         if (Rand.Chance(Options.ArtisansChangeProductionRate)) // check if it's best production type so far
         {
             changeProductionType();
         }
         if (artisansProduction != null)
         {
             //if (artisansProduction.isAllInputProductsCollected())
             {
                 artisansProduction.produce();
                 if (Economy.isMarket.checkIfTrue(Country))
                 {
                     if (getGainGoodsThisTurn().isNotZero())
                     {
                         sell(getGainGoodsThisTurn());
                     }
                 }
                 else if (Country.economy.getValue() == Economy.NaturalEconomy)
                 {
                     // send to market?
                     if (getGainGoodsThisTurn().isNotZero())
                     {
                         sell(getGainGoodsThisTurn());
                     }
                 }
                 else if (Country.economy.getValue() == Economy.PlannedEconomy)
                 {
                     storage.sendAll(Country.countryStorageSet);
                 }
             }
             //else
             //   changeProductionType();
         }
     }
 }