Ejemplo n.º 1
0
    // buy logic
    // implementation for food
    protected virtual void considerBuy()
    {
        RTMarket foodMarket = ((VillageSim)(Simulation.SimInstance)).Markets[(int)Profession.Farmer];

        if (Inventory[(int)Profession.Farmer] < 2)
        {
            decimal lastLogPrice = foodMarket.getLastPrice();

            int buyAmmount = (int)(Cash / lastLogPrice);
            if (buyAmmount > 3)
            {
                buyAmmount = 3;
            }
            // buy max possible ammount or 3 at 0.1 more than market price
            foodMarket.searchOffer(this, (int)Profession.Farmer, buyAmmount, lastLogPrice + 10m);
        }
    }