public CoachWindow() { ResourceDictionary Controls = new ResourceDictionary { Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml", UriKind.Absolute) }; ResourceDictionary Fonts = new ResourceDictionary { Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml", UriKind.Absolute) }; ResourceDictionary Colors = new ResourceDictionary { Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml", UriKind.Absolute) }; ResourceDictionary BlueAccent = new ResourceDictionary { Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml", UriKind.Absolute) }; ResourceDictionary BaseLightAccent = new ResourceDictionary { Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml", UriKind.Absolute) }; Application.Current.Resources.MergedDictionaries.Add(Fonts); Application.Current.Resources.MergedDictionaries.Add(Colors); Application.Current.Resources.MergedDictionaries.Add(BlueAccent); Application.Current.Resources.MergedDictionaries.Add(BaseLightAccent); Application.Current.Resources.MergedDictionaries.Add(Controls); InitializeComponent(); textBox1.IsReadOnly = true; DataContext = new MainViewModel(); minProb_procBar.Value = ValueReader.MinProbabilityToReplace; minProb_lbl.Content = ValueReader.MinProbabilityToReplace + " %"; ProbabilityCalculation probabilityCalculation = new ProbabilityCalculation(); Tuple <int, float> treeResult = probabilityCalculation.GenerateTreeWhiteListDraw(); realProb_procBar.Value = treeResult.Item2; realProb_lbl.Content = treeResult.Item2; int normalMinionCount = MainLists.HandCards_BoardCards.Count(x => new NeutralMinion(x).minionBoardCard != null && NeutralMinion.WouldTakeMinion(x) && !MainLists.whiteList.Contains(x.Id.ToString())); //less medium cards than actually having possible if (treeResult.Item1 /*prospective refused*/ < normalMinionCount) { int deltaReplaceCount = normalMinionCount - treeResult.Item1; int i = 1; // ReSharper disable once LoopCanBePartlyConvertedToQuery foreach (CardTemplate badCard in MainLists.HandCards_BoardCards. Where(x => new NeutralMinion(x).minionBoardCard != null && NeutralMinion.WouldTakeMinion(x) && !MainLists.whiteList.Contains(x.Id.ToString())). OrderBy(x => new NeutralMinion(x).thisCardValue).TakeWhile(x => i <= deltaReplaceCount)) { string cardString = badCard.Name + " (" + badCard.Id + ")"; textBox1.AppendText(cardString + "\n"); ++i; } replaceCount_info.Content = "...by being able to replace " + deltaReplaceCount + " cards in hand"; } }
private void ManageNeutralMinion(Card card, int maxMana, List<Card> HandCards) { //<= max mana var boardCard = new BoardCard(card); #region normalChecks if (boardCard.ResultingBoardCard.Quality >= ValueReader.MinCardQualityToInstantAddMinion) //epic by default chosenCards.Add(card); else if (boardCard.ResultingBoardCard.Cost <= ValueReader.MaxManaToInstantAddNeutralMinion) // min insta add cost chosenCards.Add(card); else { //card quality not hight enough and mana to high too if (!ValueReader.AttendMinionValue) chosenCards.Add(card); else if (boardCard.ResultingBoardCard.Cost >= ValueReader.MinManaCostToAttendValue) { if ((ValueReader.OnlyAddMinionIfHasEffect && boardCard.HasEffect) || !ValueReader.OnlyAddMinionIfHasEffect) { var minionCard = new NeutralMinion(card); NeutralMinion.Value resultingMinNeutralMinionValue = minionCard.BoardCard.IsMaxManaCard && ValueReader.IncreaseMinMinionValueIfMaxCost ? ValueReader.IncreasedMinNeutralMinionValue : ValueReader.MinNeutralMinionValue; if (minionCard.CardValue >= resultingMinNeutralMinionValue) chosenCards.Add(card); } } } #endregion normalChecks }
private void ManageNeutralMinion(Card card, int maxMana, List<Card> HandCards) { //<= max mana var boardCard = new BoardCard(card); if (boardCard.ResultingBoardCard.Quality >= ValueReader.MinCardQualityToInstantAddMinion) //epic by default chosenCards.Add(card); else if (boardCard.ResultingBoardCard.Cost <= ValueReader.MaxManaToInstantAddNeutralMinion) // min insta add cost chosenCards.Add(card); else { //card quality not hight enough and mana to high too if (!ValueReader.AttendMinionValue) chosenCards.Add(card); else if (boardCard.ResultingBoardCard.Cost >= ValueReader.MinManaCostToAttendValue) { if ((ValueReader.OnlyAddMinionIfHasEffect && boardCard.HasEffect) || !ValueReader.OnlyAddMinionIfHasEffect) { var minionCard = new NeutralMinion(card); NeutralMinion.Value resultingMinNeutralMinionValue = minionCard.BoardCard.IsMaxManaCard && ValueReader.IncreaseMinMinionValueIfMaxCost ? ValueReader.IncreasedMinNeutralMinionValue : ValueReader.MinNeutralMinionValue; int X_Config_Drop = ValueReader.ValueIgnorer.GetDrop(ValueReader.Lines.X_Drop); int Y_Config_Drop = ValueReader.ValueIgnorer.GetDrop(ValueReader.Lines.Y_Drop); int Z_Config_Drop = ValueReader.ValueIgnorer.GetDrop(ValueReader.Lines.Z_Drop); if (minionCard.CardValue >= resultingMinNeutralMinionValue) chosenCards.Add(card); else if (card.Cost == X_Config_Drop && HandCards.Count(x => new NeutralMinion(x).BoardCard != null && x.Cost == Y_Config_Drop) > 0 && HandCards.Count(x => new NeutralMinion(x).BoardCard != null && x.Cost <= Z_Config_Drop) > 0 && ValueReader.ValueIgnorer.IgnoreValueIfCardIsX_DropEtc) { //card is X drop and hand contain Y drop and Z drop (or below) if ( !ValueReader.ValueIgnorer.MakeIgnoringOnlyIfNotBadEffect || (ValueReader.ValueIgnorer.MakeIgnoringOnlyIfNotBadEffect && !CardProperties.HasBadEffect(card)) ) chosenCards.Add(card); } } } } }
private void ManageNeutralMinion(Card card, int maxMana, List<Card> HandCards) { //<= max mana var boardCard = new BoardCard(card); if (boardCard.ResultingBoardCard.Quality >= ValueReader.MinCardQualityToInstantAddMinion) //epic by default chosenCards.Add(card); else if (boardCard.ResultingBoardCard.Cost <= ValueReader.MaxManaToInstantAddNeutralMinion) // min insta add cost chosenCards.Add(card); else { //card quality not hight enough and mana to high too if (!ValueReader.AttendMinionValue) chosenCards.Add(card); else if (boardCard.ResultingBoardCard.Cost >= ValueReader.MinManaCostToAttendValue) { if ((ValueReader.OnlyAddMinionIfHasEffect && boardCard.HasEffect) || !ValueReader.OnlyAddMinionIfHasEffect) { var minionCard = new NeutralMinion(card); NeutralMinion.Value resultingMinNeutralMinionValue = minionCard.BoardCard.IsMaxManaCard && ValueReader.IncreaseMinMinionValueIfMaxCost ? ValueReader.IncreasedMinNeutralMinionValue : ValueReader.MinNeutralMinionValue; int X_Config_Drop = ValueReader.ValueIgnorer.GetXDrop; if (minionCard.CardValue >= resultingMinNeutralMinionValue) chosenCards.Add(card); else if (card.Cost == X_Config_Drop && HandCards.Count(x => new NeutralMinion(x).BoardCard != null && x.Cost == X_Config_Drop - 1) > 0 && HandCards.Count(x => new NeutralMinion(x).BoardCard != null && x.Cost == X_Config_Drop - 2) > 0 && ValueReader.ValueIgnorer.IgnoreValueIfCardIsX_DropEtc) { //card is X drop and hand contain "x - 1 drop" and "x - 2 drop" if ( !ValueReader.ValueIgnorer.MakeIgnoringOnlyIfNotBadEffect || (ValueReader.ValueIgnorer.MakeIgnoringOnlyIfNotBadEffect && !CardProperties.HasBadEffect(card)) ) { //add x drop chosenCards.Add(card); //add BEST x - 1 drop and x - 2 drop var bestX_1Drop = HandCards.Where(x => new NeutralMinion(x).BoardCard != null && x.Cost == X_Config_Drop - 1). OrderBy(x => new NeutralMinion(x).CardValue).First(); var bestX_2Drop = HandCards.Where(x => new NeutralMinion(x).BoardCard != null && x.Cost == X_Config_Drop - 2). OrderBy(x => new NeutralMinion(x).CardValue).First(); if (!chosenCards.Contains(bestX_1Drop)) { chosenCards.Add(bestX_1Drop); blackList.Add(bestX_1Drop.Name); } if (!chosenCards.Contains(bestX_2Drop)) { chosenCards.Add(bestX_2Drop); blackList.Add(bestX_2Drop.Name); } } } } } } }