Ejemplo n.º 1
0
 private DiscoverTask(DiscoverType type, Card enchantmentCard, ISimpleTask afterDiscoverTask, int number)
 {
     _discoverType    = type;
     _enchantmentCard = enchantmentCard;
     _taskTodo        = afterDiscoverTask;
     _numberOfChoices = number;
 }
Ejemplo n.º 2
0
 public DiscoverTask(DiscoverType discoverType, string enchantmentId = null)
 {
     DiscoverType = discoverType;
     if (enchantmentId != null)
     {
         _enchantmentCard = Cards.FromId(enchantmentId);
     }
 }
Ejemplo n.º 3
0
 public DiscoverTask(DiscoverType discoverType, string enchantmentId = null, int numberOfChoices = 3)
 {
     _discoverType    = discoverType;
     _numberOfChoices = numberOfChoices;
     if (enchantmentId != null)
     {
         _enchantmentCard = Cards.FromId(enchantmentId);
     }
 }
Ejemplo n.º 4
0
 public override Card PickDiscoverChoices(DiscoverType type, IEntity source, IEntity target, List <Card> cards)
 {
     RandomHappened = true;
     try
     {
         Card cardPicked = cards.Where(card => card.Name == cardsToDiscover[0].Card.Name).First();
         cardsToDiscover.RemoveAt(0);
         return(cardPicked);
     }
     catch (Exception e)
     {
         System.Diagnostics.Debugger.Break();
         throw e;
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="VideoDiscoverer"/> class.
        /// </summary>
        /// <param name="type">Where to look for the files.</param>
        public VideoDiscoverer( DiscoverType type = DiscoverType.Videos )
        {
            switch ( type ) {
                case DiscoverType.Videos:
                    _parentFolder = Environment.GetFolderPath ( Environment.SpecialFolder.MyVideos );
                    break;
                case DiscoverType.Downloads:
                    _parentFolder = Environment.GetFolderPath ( Environment.SpecialFolder.UserProfile ) + "\\Downloads";
                    break;
                case DiscoverType.Library:
                    _parentFolder = Environment.GetFolderPath ( Environment.SpecialFolder.UserProfile );
                    break;
                case DiscoverType.Full:
                    _parentFolder = Path.GetPathRoot ( Environment.CurrentDirectory );
                    break;

            }
        }
Ejemplo n.º 6
0
 public DiscoverTask(DiscoverType discoverType, Enchantment enchantment = null)
 {
     DiscoverType = discoverType;
     Enchantment  = enchantment;
 }
Ejemplo n.º 7
0
        private List <Card>[] Discovery(DiscoverType discoverType, out ChoiceAction choiceAction)
        {
            if (!CachedDiscoverySets.TryGetValue(discoverType, out Tuple <List <Card>[], ChoiceAction> result))
            {
                switch (discoverType)
                {
                case DiscoverType.DRUID_ROGUE_SHAMAN:
                {
                    choiceAction = ChoiceAction.HAND;
                    List <Card>[] listArray = GetTriClass(CardClass.DRUID, CardClass.ROGUE, CardClass.SHAMAN);
                    var           output    = new Tuple <List <Card>[], ChoiceAction>(listArray, choiceAction);
                    CachedDiscoverySets.TryAdd(discoverType, output);
                    return(listArray);
                }

                case DiscoverType.MAGE_PRIEST_WARLOCK:
                {
                    choiceAction = ChoiceAction.HAND;
                    List <Card>[] listArray = GetTriClass(CardClass.MAGE, CardClass.PRIEST, CardClass.WARLOCK);
                    var           output    = new Tuple <List <Card>[], ChoiceAction>(listArray, choiceAction);
                    CachedDiscoverySets.TryAdd(discoverType, output);
                    return(listArray);
                }


                case DiscoverType.HUNTER_PALADIN_WARRIOR:
                {
                    choiceAction = ChoiceAction.HAND;
                    List <Card>[] listArray = GetTriClass(CardClass.HUNTER, CardClass.PALADIN, CardClass.WARRIOR);
                    var           output    = new Tuple <List <Card>[], ChoiceAction>(listArray, choiceAction);
                    CachedDiscoverySets.TryAdd(discoverType, output);
                    return(listArray);
                }

                case DiscoverType.BASIC_HEROPOWERS:
                {
                    choiceAction = ChoiceAction.HEROPOWER;
                    List <Card>[] listArray = new[] { Cards.HeroCards().Where(p => p != Controller.Hero.Card).Select(p => Cards.FromAssetId(p[GameTag.HERO_POWER])).ToList() };
                    var           output    = new Tuple <List <Card>[], ChoiceAction>(listArray, choiceAction);
                    CachedDiscoverySets.TryAdd(discoverType, output);
                    return(listArray);
                }

                case DiscoverType.DRAGON:
                {
                    choiceAction = ChoiceAction.HAND;
                    List <Card>[] listArray = GetFilter(list => list.Where(p => p.Race == Race.DRAGON));
                    var           output    = new Tuple <List <Card>[], ChoiceAction>(listArray, choiceAction);
                    CachedDiscoverySets.TryAdd(discoverType, output);
                    return(listArray);
                }


                case DiscoverType.OVERLOAD:
                {
                    choiceAction = ChoiceAction.HAND;
                    IEnumerable <Card> cardSet   = Cards.FormatTypeCards(Game.FormatType);
                    List <Card>[]      listArray = new[] { cardSet.Where(p => p.HasOverload).ToList() };
                    var output = new Tuple <List <Card>[], ChoiceAction>(listArray, choiceAction);
                    CachedDiscoverySets.TryAdd(discoverType, output);
                    return(listArray);
                }


                case DiscoverType.TAUNT:
                {
                    choiceAction = ChoiceAction.HAND;
                    List <Card>[] listArray = GetFilter(list => list.Where(p => p[GameTag.TAUNT] == 1));
                    var           output    = new Tuple <List <Card>[], ChoiceAction>(listArray, choiceAction);
                    CachedDiscoverySets.TryAdd(discoverType, output);
                    return(listArray);
                }


                case DiscoverType.SECRET:
                {
                    choiceAction = ChoiceAction.HAND;
                    CardClass classForSecret =
                        Controller.BaseClass == CardClass.PALADIN ||
                        Controller.BaseClass == CardClass.MAGE ||
                        Controller.BaseClass == CardClass.HUNTER
                                                        ? Controller.BaseClass
                                                        : CardClass.PALADIN;
                    List <Card>[] listArray = GetClassCard(classForSecret, list => list.Where(p => p[GameTag.SECRET] == 1));
                    var           output    = new Tuple <List <Card>[], ChoiceAction>(listArray, choiceAction);
                    CachedDiscoverySets.TryAdd(discoverType, output);
                    return(listArray);
                }


                case DiscoverType.BEAST:
                {
                    choiceAction = ChoiceAction.HAND;
                    List <Card>[] listArray = GetFilter(list => list.Where(p => p.Race == Race.BEAST));
                    var           output    = new Tuple <List <Card>[], ChoiceAction>(listArray, choiceAction);
                    CachedDiscoverySets.TryAdd(discoverType, output);
                    return(listArray);
                }


                case DiscoverType.MURLOC:
                {
                    choiceAction = ChoiceAction.HAND;
                    List <Card>[] listArray = GetFilter(list => list.Where(p => p.Race == Race.MURLOC));
                    var           output    = new Tuple <List <Card>[], ChoiceAction>(listArray, choiceAction);
                    CachedDiscoverySets.TryAdd(discoverType, output);
                    return(listArray);
                }


                case DiscoverType.ELEMENTAL:
                {
                    choiceAction = ChoiceAction.HAND;
                    List <Card>[] listArray = GetFilter(list => list.Where(p => p.Race == Race.ELEMENTAL));
                    var           output    = new Tuple <List <Card>[], ChoiceAction>(listArray, choiceAction);
                    CachedDiscoverySets.TryAdd(discoverType, output);
                    return(listArray);
                }


                case DiscoverType.MECHANICAL:
                {
                    choiceAction = ChoiceAction.HAND;
                    List <Card>[] listArray = GetFilter(list => list.Where(p => p.Race == Race.MECHANICAL));
                    var           output    = new Tuple <List <Card>[], ChoiceAction>(listArray, choiceAction);
                    CachedDiscoverySets.TryAdd(discoverType, output);
                    return(listArray);
                }


                case DiscoverType.ALL:
                {
                    choiceAction = ChoiceAction.HAND;
                    List <Card>[] listArray = GetFilter(list => list.Where(p => p.Cost >= 0));
                    var           output    = new Tuple <List <Card>[], ChoiceAction>(listArray, choiceAction);
                    CachedDiscoverySets.TryAdd(discoverType, output);
                    return(listArray);
                }


                case DiscoverType.ARTIFACT:
                {
                    choiceAction = ChoiceAction.HAND;
                    List <Card>[] listArray = new[]
                    {
                        new List <Card>
                        {
                            Cards.FromId("LOEA16_3"),
                            Cards.FromId("LOEA16_4"),
                            Cards.FromId("LOEA16_5")
                        }
                    };
                    var output = new Tuple <List <Card>[], ChoiceAction>(listArray, choiceAction);
                    CachedDiscoverySets.TryAdd(discoverType, output);
                    return(listArray);
                }


                case DiscoverType.ELEMENTAL_INVOCATION:
                {
                    choiceAction = ChoiceAction.SPELL;
                    List <Card>[] listArray = new[]
                    {
                        new List <Card>
                        {
                            Cards.FromId("UNG_211a"),
                            Cards.FromId("UNG_211b"),
                            Cards.FromId("UNG_211c"),
                            Cards.FromId("UNG_211d")
                        }
                    };
                    var output = new Tuple <List <Card>[], ChoiceAction>(listArray, choiceAction);
                    CachedDiscoverySets.TryAdd(discoverType, output);
                    return(listArray);
                }


                case DiscoverType.TRACKING:
                {
                    choiceAction = ChoiceAction.TRACKING;
                    var cards = new List <Card>();
                    int n     = Controller.DeckZone.Count >= 3 ? 3 : Controller.DeckZone.Count;
                    for (int i = 0; i < n; i++)
                    {
                        IPlayable item = Controller.DeckZone[0];
                        Generic.RemoveFromZone(Controller, item);
                        Controller.SetasideZone.Add(item);
                        cards.Add(item.Card);
                    }
                    List <Card>[] listArray = new[] { cards };
                    return(listArray);
                }

                case DiscoverType.MINION:
                {
                    choiceAction = ChoiceAction.HAND;
                    List <Card>[] listArray = GetFilter(list => list.Where(p => p.Type == CardType.MINION));
                    var           output    = new Tuple <List <Card>[], ChoiceAction>(listArray, choiceAction);
                    CachedDiscoverySets.TryAdd(discoverType, output);
                    return(listArray);
                }


                case DiscoverType.DECK_MINION:
                {
                    choiceAction = ChoiceAction.HAND;
                    List <Card>[] listArray = new[] { Controller.DeckZone.Where(p => p is Minion).Select(p => p.Card).ToList() };
                    return(listArray);
                }


                case DiscoverType.DEATHRATTLE:
                {
                    choiceAction = ChoiceAction.HAND;
                    List <Card>[] listArray = GetFilter(list => list.Where(p => p[GameTag.DEATHRATTLE] == 1));
                    var           output    = new Tuple <List <Card>[], ChoiceAction>(listArray, choiceAction);
                    CachedDiscoverySets.TryAdd(discoverType, output);
                    return(listArray);
                }


                case DiscoverType.ONE_COST:
                {
                    choiceAction = ChoiceAction.HAND;
                    List <Card>[] listArray = GetFilter(list => list.Where(p => p.Cost == 1));
                    var           output    = new Tuple <List <Card>[], ChoiceAction>(listArray, choiceAction);
                    CachedDiscoverySets.TryAdd(discoverType, output);
                    return(listArray);
                }


                case DiscoverType.THREE_COST:
                {
                    choiceAction = ChoiceAction.HAND;
                    List <Card>[] listArray = GetFilter(list => list.Where(p => p.Cost == 3));
                    var           output    = new Tuple <List <Card>[], ChoiceAction>(listArray, choiceAction);
                    CachedDiscoverySets.TryAdd(discoverType, output);
                    return(listArray);
                }


                case DiscoverType.SPELL:
                {
                    choiceAction = ChoiceAction.HAND;
                    List <Card>[] listArray = GetFilter(list => list.Where(p => p.Type == CardType.SPELL));
                    var           output    = new Tuple <List <Card>[], ChoiceAction>(listArray, choiceAction);
                    CachedDiscoverySets.TryAdd(discoverType, output);
                    return(listArray);
                }


                case DiscoverType.OWN_SPELL:
                {
                    choiceAction = ChoiceAction.HAND;
                    List <Card>[] listArray = new[] { Controller.DeckZone.Where(p => p is Spell).Select(p => p.Card).ToList() };
                    return(listArray);
                }


                case DiscoverType.BASIC_TOTEM:
                {
                    choiceAction = ChoiceAction.SUMMON;
                    List <Card>[] listArray = new[]
                    {
                        new List <Card>
                        {
                            Cards.FromId("AT_132_SHAMANa"),
                            Cards.FromId("AT_132_SHAMANb"),
                            Cards.FromId("AT_132_SHAMANc"),
                            Cards.FromId("AT_132_SHAMANd")
                        }
                    };
                    var output = new Tuple <List <Card>[], ChoiceAction>(listArray, choiceAction);
                    CachedDiscoverySets.TryAdd(discoverType, output);
                    return(listArray);
                }


                case DiscoverType.COST_8_MORE_SUMMON:
                {
                    choiceAction = ChoiceAction.SUMMON;
                    List <Card>[] listArray = GetFilter(list => list.Where(p => p.Cost >= 8 && p.Type == CardType.MINION));
                    var           output    = new Tuple <List <Card>[], ChoiceAction>(listArray, choiceAction);
                    CachedDiscoverySets.TryAdd(discoverType, output);
                    return(listArray);
                }


                case DiscoverType.OP_DECK:
                {
                    choiceAction = ChoiceAction.HAND;
                    List <Card>[] listArray = new[] { Controller.Opponent.DeckZone.Select(p => p.Card).ToList() };
                    return(listArray);
                }


                case DiscoverType.OP_HERO:
                {
                    choiceAction = ChoiceAction.HAND;
                    List <Card>[] listArray = GetClassCard(Controller.Opponent.HeroClass, list => list);
                    var           output    = new Tuple <List <Card>[], ChoiceAction>(listArray, choiceAction);
                    CachedDiscoverySets.TryAdd(discoverType, output);
                    return(listArray);
                }


                case DiscoverType.DIED_THIS_GAME:
                {
                    choiceAction = ChoiceAction.SUMMON;
                    List <Card>[] listArray = new[] { Controller.GraveyardZone.Where(p => p.ToBeDestroyed && p.Card.Type == CardType.MINION).Select(p => p.Card).ToList() };
                    return(listArray);
                }


                default:
                    throw new ArgumentOutOfRangeException(nameof(discoverType), discoverType, null);
                }
            }
            else
            {
                choiceAction = result.Item2;
                return(result.Item1);
            }
        }
Ejemplo n.º 8
0
        private List <Card>[] Discovery(DiscoverType discoverType, out ChoiceAction choiceAction)
        {
            switch (discoverType)
            {
            case DiscoverType.DRUID_ROGUE_SHAMAN:
                choiceAction = ChoiceAction.HAND;
                return(GetTriClass(CardClass.DRUID, CardClass.ROGUE, CardClass.SHAMAN));

            case DiscoverType.MAGE_PRIEST_WARLOCK:
                choiceAction = ChoiceAction.HAND;
                return(GetTriClass(CardClass.MAGE, CardClass.PRIEST, CardClass.WARLOCK));

            case DiscoverType.HUNTER_PALADIN_WARRIOR:
                choiceAction = ChoiceAction.HAND;
                return(GetTriClass(CardClass.HUNTER, CardClass.PALADIN, CardClass.WARRIOR));

            case DiscoverType.BASIC_HEROPOWERS:
                choiceAction = ChoiceAction.HEROPOWER;
                return(new[] { Cards.HeroCards().Where(p => p != Controller.Hero.Card).Select(p => Cards.FromAssetId(p[GameTag.HERO_POWER])).ToList() });

            case DiscoverType.DRAGON:
                choiceAction = ChoiceAction.HAND;
                return(GetFilter(list => list.Where(p => p.Race == Race.DRAGON)));

            case DiscoverType.OVERLOAD:
                choiceAction = ChoiceAction.HAND;
                var cardSet = Cards.FormatTypeCards(Game.FormatType);
                return(new[] { cardSet.Where(p => p.HasOverload).ToList() });

            case DiscoverType.TAUNT:
                choiceAction = ChoiceAction.HAND;
                return(GetFilter(list => list.Where(p => p[GameTag.TAUNT] == 1)));

            case DiscoverType.SECRET:
                choiceAction = ChoiceAction.HAND;
                var classForSecret =
                    Controller.HeroClass == CardClass.PALADIN ||
                    Controller.HeroClass == CardClass.MAGE ||
                    Controller.HeroClass == CardClass.HUNTER
                                                ? Controller.HeroClass
                                                : CardClass.PALADIN;
                return(GetClassCard(classForSecret, list => list.Where(p => p[GameTag.SECRET] == 1)));

            case DiscoverType.BEAST:
                choiceAction = ChoiceAction.HAND;
                return(GetFilter(list => list.Where(p => p.Race == Race.BEAST)));

            case DiscoverType.MURLOC:
                choiceAction = ChoiceAction.HAND;
                return(GetFilter(list => list.Where(p => p.Race == Race.MURLOC)));

            case DiscoverType.ELEMENTAL:
                choiceAction = ChoiceAction.HAND;
                return(GetFilter(list => list.Where(p => p.Race == Race.ELEMENTAL)));

            case DiscoverType.MECHANICAL:
                choiceAction = ChoiceAction.HAND;
                return(GetFilter(list => list.Where(p => p.Race == Race.MECHANICAL)));

            case DiscoverType.ALL:
                choiceAction = ChoiceAction.HAND;
                return(GetFilter(list => list.Where(p => p.Cost >= 0)));

            case DiscoverType.ARTIFACT:
                choiceAction = ChoiceAction.HAND;
                return(new[]
                {
                    new List <Card>
                    {
                        Cards.FromId("LOEA16_3"),
                        Cards.FromId("LOEA16_4"),
                        Cards.FromId("LOEA16_5")
                    }
                });

            case DiscoverType.ELEMENTAL_INVOCATION:
                choiceAction = ChoiceAction.HAND;
                return(new[]
                {
                    new List <Card>
                    {
                        Cards.FromId("UNG_211a"),
                        Cards.FromId("UNG_211b"),
                        Cards.FromId("UNG_211c"),
                        Cards.FromId("UNG_211d")
                    }
                });

            case DiscoverType.TRACKING:
                choiceAction = ChoiceAction.TRACKING;
                var cards = new List <Card>();
                Controller.DeckZone.GetAll.Take(3).ToList().ForEach(p =>
                {
                    Generic.RemoveFromZone(Controller, p);
                    Controller.SetasideZone.Add(p);
                    cards.Add(p.Card);
                });
                return(new[] { cards });

            case DiscoverType.MINION:
                choiceAction = ChoiceAction.HAND;
                return(GetFilter(list => list.Where(p => p.Type == CardType.MINION)));

            case DiscoverType.DEATHRATTLE:
                choiceAction = ChoiceAction.HAND;
                return(GetFilter(list => list.Where(p => p[GameTag.DEATHRATTLE] == 1)));

            case DiscoverType.ONE_COST:
                choiceAction = ChoiceAction.HAND;
                return(GetFilter(list => list.Where(p => p.Cost == 1)));

            case DiscoverType.THREE_COST:
                choiceAction = ChoiceAction.HAND;
                return(GetFilter(list => list.Where(p => p.Cost == 3)));

            case DiscoverType.SPELL:
                choiceAction = ChoiceAction.HAND;
                return(GetFilter(list => list.Where(p => p.Type == CardType.SPELL)));

            case DiscoverType.OWN_SPELL:
                choiceAction = ChoiceAction.HAND;
                return(new[] { Controller.DeckZone.Where(p => p is Spell).Select(p => p.Card).ToList() });

            case DiscoverType.BASIC_TOTEM:
                choiceAction = ChoiceAction.SUMMON;
                return(new[]
                {
                    new List <Card>
                    {
                        Cards.FromId("AT_132_SHAMANa"),
                        Cards.FromId("AT_132_SHAMANb"),
                        Cards.FromId("AT_132_SHAMANc"),
                        Cards.FromId("AT_132_SHAMANd")
                    }
                });

            case DiscoverType.COST_8_MORE_SUMMON:
                choiceAction = ChoiceAction.SUMMON;
                return(GetFilter(list => list.Where(p => p.Cost >= 8 && p.Type == CardType.MINION)));

            case DiscoverType.OP_DECK:
                choiceAction = ChoiceAction.HAND;
                return(new[] { Controller.Opponent.DeckZone.Select(p => p.Card).ToList() });

            case DiscoverType.OP_HERO:
                choiceAction = ChoiceAction.HAND;
                return(GetClassCard(Controller.Opponent.HeroClass, list => list));

            default:
                throw new ArgumentOutOfRangeException(nameof(discoverType), discoverType, null);
            }
        }
Ejemplo n.º 9
0
 public DiscoverTask(DiscoverType discoverType, ISimpleTask afterDiscoverTask)
 {
     _discoverType = discoverType;
     _taskTodo     = afterDiscoverTask;
 }
Ejemplo n.º 10
0
 /// <summary>
 /// returns a list of URLs to the corresponding FGSMS services or an empty list if none are found
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public static List<String> DiscoverViaDNS(DiscoverType type)
 {
     return discover("FGSMS-" + type.ToString().ToLower());
 }
        private bool DoAutoDiscoverRaw(
            DiscoverType oDiscoverType,
            ref InMemoryListener oIML,
            string sEmail,
            NetworkCredential oNetworkCredential,
            int iMaxHops,
            bool bAllowSelfSignedCerts,
            bool bTraceCertificateInformation
            )
        {
            bool bRet = false;

            try
            {
                // Identifies the maximum number of redirections through either SCP pointer or Autodiscover redirects.

                AutodiscoverRaw oAutodiscoverRaw = new AutodiscoverRaw();
                AutodiscoverRaw.AutodiscoverResponseXml response = null;

                if (oDiscoverType == DiscoverType.Scp)
                {
                    // Call Autodiscover service.
                    response =
                        oAutodiscoverRaw.DiscoverScp(
                            ref oIML,
                            sEmail,
                            oNetworkCredential,
                            ref iMaxHops,
                            bAllowSelfSignedCerts,
                            bTraceCertificateInformation
                            );
                }

                if (oDiscoverType == DiscoverType.Pox)
                {
                    // Call Autodiscover service.
                    response =
                        oAutodiscoverRaw.DiscoverPox(
                            ref oIML,
                            sEmail,
                            oNetworkCredential,
                            ref iMaxHops,
                            bAllowSelfSignedCerts,
                            bTraceCertificateInformation
                            );
                }

                if (oDiscoverType == DiscoverType.Soap)
                {
                    // Call Autodiscover service.
                    //string sUrl = string.Empty;
                    response =
                        oAutodiscoverRaw.TryDiscoverSoap(
                            ref oIML,
                            sEmail,
                            oNetworkCredential,
                            ref iMaxHops,
                            bAllowSelfSignedCerts,
                            bTraceCertificateInformation
                            );
                    //if (sUrl == string.Empty)
                    //    response =  false;
                    //else
                    //    response = true;
                }

                // Write response to console.
                WriteResponse(response);

                bRet = true;
            }
            catch (System.Exception e)
            {
                oIML.WriteLine("Error: " + e.ToString());
                //MessageBox.Show(e.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                //System.Console.WriteLine(e.ToString());
                bRet = false;
            }

            return(bRet);
        }
Ejemplo n.º 12
0
 /// <summary>
 /// returns a list of URLs to the corresponding FGSMS services or an empty list if none are found
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public static List <String> DiscoverViaDNS(DiscoverType type)
 {
     return(discover("FGSMS-" + type.ToString().ToLower()));
 }
Ejemplo n.º 13
0
 private DiscoverTask(DiscoverType type, Card enchantmentCard, ISimpleTask afterDiscoverTask)
 {
     DiscoverType     = type;
     _enchantmentCard = enchantmentCard;
     _taskTodo        = afterDiscoverTask;
 }