public static List <Action> ReadyToBuildProjectActions(this Player p) { var actionProjectsCanBuild = new List <Action>(); List <Card> bonusCards = p.BonusActionCards.OnlyBuildAnyPojectBonuses(); List <Card> availableCards = p.NormalActionAvailable() ? p.Cards.JoinWith(bonusCards) : bonusCards; foreach (Card card in availableCards) { foreach (Card project in p.ProjectArea) { int workersNeeded = LogicHelper.HowManyWorkersNeeded(card.Dice, project.Dice); if (workersNeeded <= p.WorkersCount) { Action item = new Action(ActionType.BuildProject, card, project, workersNeeded, 0, 0); actionProjectsCanBuild.Add(item); } } } return(actionProjectsCanBuild); }
public static List <Action> ReadyToTakeProjectActions(this Player p, List <ProjectCard> availableProjects) { var actionProjectsCanTake = new List <Action>(); List <Card> bonusCards = p.BonusActionCards.OnlySilverAndCastleBonuses(); List <Card> availableCards = p.NormalActionAvailable() ? p.Cards.JoinWith(bonusCards) : bonusCards; foreach (ProjectCard project in availableProjects) { foreach (Card card in availableCards) { int workersNeeded = LogicHelper.HowManyWorkersNeeded(card.Dice, project.TakeProjectDice); if (workersNeeded <= p.WorkersCount) { var action = new Action(ActionType.TakeProject, card, project.Card, workersNeeded); actionProjectsCanTake.Add(action); } } } return(actionProjectsCanTake); }