public override IEnumerable<int> ChooseEffects(EffectChoiceType choiceType, IEnumerable<CardModel> cardInfo, string choiceText, int minChoices, int maxChoices, string[] choices, string[] choiceDescriptions) { maxChoices = Math.Min(maxChoices, choices.Count()); int howMany = Randomizer.Next(minChoices, maxChoices + 1); List<int> indexes = new List<int>(); for (int i = 0; i < choices.Count(); i++) { indexes.Add(i); } return indexes.OrderBy(c => Randomizer.Next()).Take(howMany); }
protected int Overpay(GameModel gameModel, EffectChoiceType effectChoiceType, string choiceDescription) { int max = gameModel.CurrentPlayer.Coin; if (max > 0) { string[] choices = new string[max + 1]; for (int i = 0; i <= max; i++) { choices[i] = i.ToString(); } int result = gameModel.CurrentPlayer.Chooser.ChooseOneEffect(effectChoiceType, choiceDescription, choices, choices); gameModel.CurrentPlayer.AddActionCoin(-result); return result; } return 0; }
public IEnumerable<int> ChooseSeveralEffects(EffectChoiceType choiceType, IEnumerable<CardModel> cardInfo, string choiceText, int minChoices, int maxChoices, string[] choices, string[] choiceDescriptions) { return this.ChooseEffects(choiceType, cardInfo, choiceText, minChoices, maxChoices, choices, choiceDescriptions); }
public int ChooseOneEffect(EffectChoiceType choiceType, string choiceText, string[] choices, string[] choiceDescriptions) { return this.ChooseEffects(choiceType, new CardModel[] { }, choiceText, 1, 1, choices, choiceDescriptions).First(); }
public int ChooseOneEffect(EffectChoiceType choiceType, IEnumerable<CardModel> cardInfo, string choiceText, string[] choices, string[] choiceDescriptions) { return this.ChooseEffects(choiceType, cardInfo, choiceText, 1, 1, choices, choiceDescriptions).First(); }
public abstract IEnumerable<int> ChooseEffects(EffectChoiceType choiceType, IEnumerable<CardModel> cardInfo, string choiceText, int minChoices, int maxChoices, string[] choices, string[] choiceDescriptions);
public override IEnumerable<int> ChooseEffects(EffectChoiceType choiceType, IEnumerable<CardModel> cardInfo, string choiceText, int minChoices, int maxChoices, string[] choices, string[] choiceDescriptions) { List<int> ret = new List<int>(); for (int i = 0; i < minChoices; i++) { ret.Add(i); } return ret; }
public override IEnumerable<int> ChooseEffects(EffectChoiceType choiceType, IEnumerable<CardModel> cardInfo, string choiceText, int minChoices, int maxChoices, string[] choices, string[] choiceDescriptions) { IEnumerable<string> chosen = this.MakeEffectChoice(choiceText, minChoices, maxChoices,choices, choiceDescriptions); return from c in chosen select Array.IndexOf(choices, c); }