Exemplo n.º 1
0
    public static List <Action> ReadyToShipGoodsActions(this Player p)
    {
        var actionShipmentsReady = new List <Action>();

        List <Card> bonusCards     = p.BonusActionCards.OnlyShippableBonuses();
        List <Card> availableCards = p.NormalActionAvailable() ? p.Cards.JoinWith(bonusCards) : bonusCards;

        foreach (Card card in availableCards)
        {
            foreach (Card goods in p.Goods)
            {
                int workersNeeded = LogicHelper.HowManyWorkersNeededToShip(card.Dice, goods.Dice);

                if (workersNeeded <= p.WorkersCount)
                {
                    var action = new Action(ActionType.ShipGoods, card, goods, workersNeeded);
                    actionShipmentsReady.Add(action);
                }
            }
        }

        return(actionShipmentsReady);
    }