Esempio n. 1
0
        private bool SetUselessCards()
        {
            ClientField field = this.Bot;

            if (field.HasInSpellZone(CardId.FireFormationTenki))
            {
                return(false);
            }

            if (field.HasInSpellZone(CardId.AssaultTeleport))
            {
                return(false);
            }

            if (field.HasInSpellZone(CardId.CardsOfConsonance))
            {
                return(false);
            }

            if (field.HasInSpellZone(CardId.DragonsMirror))
            {
                return(false);
            }

            return(this.Bot.GetSpellCountWithoutField() < 4);
        }
Esempio n. 2
0
 public override bool ShouldExec(Executor exec, GameAI ai, Duel duel, ClientField bot, ClientField enemy, ClientCard card)
 {
     if (exec.ExecType == ExecutorType.Activate)
     {
         return(bot.LifePoints > 1000);
     }
     return(true);
 }
Esempio n. 3
0
        protected Executor(GameAI ai, Duel duel)
        {
            Duel      = duel;
            AI        = ai;
            Executors = new List <CardExecutor>();

            Bot   = Duel.Fields[0];
            Enemy = Duel.Fields[1];
        }
Esempio n. 4
0
        public static void SetClientField()
        {
            DataField field = new ClientField();

            if (!iClient.SetField(field))
            {
                Console.WriteLine("ERROR: field not found! Check layout and field creation.");
            }
        }
Esempio n. 5
0
        private bool AppatEffect()
        {
            ClientField Bot = Duel.Fields[0];

            if (Bot.HasInGraveyard((int)CardId.BlueEyesDragon))
            {
                AI.SelectCard((int)CardId.BlueEyesDragon);
            }
            return(true);
        }
Esempio n. 6
0
        private bool Pierre()
        {
            ClientField Bot = Duel.Fields[0];

            if (!Bot.HasInHand((int)CardId.Maiden) && !(Bot.HasInHand((int)CardId.DragonAppat) && Bot.HasInGraveyard((int)CardId.BlueEyesDragon)) && !(Bot.HasInHand((int)CardId.Kaibaman) || Bot.HasInHand((int)CardId.KomodoDragon) && Bot.HasInHand((int)CardId.BlueEyesDragon)))
            {
                return(true);
            }
            return(false);
        }
Esempio n. 7
0
        private bool DragonEtincelant1OuMirage()
        {
            ClientField Bot = Duel.Fields[0];

            if (Bot.HasInHand((int)CardId.DragonSombreMetalique) && !Bot.HasInHand((int)CardId.Pierre) && !Bot.HasInHand((int)CardId.Maiden) && !(Bot.HasInHand((int)CardId.DragonAppat) && Bot.HasInGraveyard((int)CardId.BlueEyesDragon)) && !(Bot.HasInHand((int)CardId.Kaibaman) || Bot.HasInHand((int)CardId.KomodoDragon) && Bot.HasInHand((int)CardId.BlueEyesDragon)))
            {
                return(true);
            }
            return(false);
        }
Esempio n. 8
0
        protected Executor(GameAI ai, Duel duel)
        {
            this.Duel      = duel;
            this.AI        = ai;
            this.Util      = new AIUtil(duel);
            this.Executors = new List <CardExecutor>();

            this.Bot   = this.Duel.Fields[0];
            this.Enemy = this.Duel.Fields[1];
        }
Esempio n. 9
0
        protected Executor(GameAI ai, Duel duel)
        {
            Rand      = new Random();
            Duel      = duel;
            AI        = ai;
            Util      = new AIUtil(duel);
            Executors = new List <CardExecutor>();

            Bot   = Duel.Fields[0];
            Enemy = Duel.Fields[1];
        }
Esempio n. 10
0
        protected Executor(GameAI ai, Duel duel)
        {
            Duel      = duel;
            AI        = ai;
            Executors = new List <CardExecutor>();

            LastChainPlayer = -1;
            CurrentChain    = new List <ClientCard>();

            Bot   = Duel.Fields[0];
            Enemy = Duel.Fields[1];
        }
        private void AddClient(Client c)
        {
            clients.Add(c);
            if (server is LocalServer)
            {
                (server as LocalServer).AddClient(c);
            }

            ClientField cf = new ClientField(c, clients.Count);

            cf.Position = new Vector2(100, 100 * clients.Count);
            Add(cf);
        }
Esempio n. 12
0
        private bool KomodoEffect()
        {
            ClientField Bot = Duel.Fields[0];

            if (Bot.HasInHand((int)CardId.BlueEyesDragon))
            {
                AI.SelectCard((int)CardId.BlueEyesDragon);
                return(true);
            }
            else if (Bot.HasInHand((int)CardId.DragonEtincelant1))
            {
                AI.SelectCard((int)CardId.DragonEtincelant1);
                return(true);
            }
            return(false);
        }
Esempio n. 13
0
        public CyberDragonExecutor(GameAI ai, Duel duel)
            : base(ai, duel)
        {
            Bot = Duel.Fields[0];

            AddExecutor(ExecutorType.SpellSet, DefaultSpellSet);
            AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);

            AddExecutor(ExecutorType.SpellSet, (int)CardId.Defusion);

            AddExecutor(ExecutorType.Activate, (int)CardId.CapsuleDuneAutreDimension, Capsule);
            AddExecutor(ExecutorType.Activate, (int)CardId.Raigeki, DefaultRaigeki);
            AddExecutor(ExecutorType.Activate, (int)CardId.Polymerisation, Polymeration);
            AddExecutor(ExecutorType.Activate, (int)CardId.LienDePuissance, LienDePuissance);
            AddExecutor(ExecutorType.Activate, (int)CardId.ExplosionDevolution, ExplosionDevolution);
            AddExecutor(ExecutorType.Activate, (int)CardId.DarkHole, DefaultDarkHole);
            AddExecutor(ExecutorType.Activate, (int)CardId.UniteDeGenerationPhotonique);
            AddExecutor(ExecutorType.Activate, (int)CardId.Defusion, Defusion);

            AddExecutor(ExecutorType.Activate, (int)CardId.TrappeSansFond, DefaultUniqueTrap);
            AddExecutor(ExecutorType.Activate, (int)CardId.ForceDeMirroir, DefaultUniqueTrap);
            AddExecutor(ExecutorType.Activate, (int)CardId.UniteReflectiveDattaque);
            AddExecutor(ExecutorType.Activate, (int)CardId.Disfonction);
            AddExecutor(ExecutorType.Activate, (int)CardId.AppelDeLetreHante, DefaultCallOfTheHaunted);

            AddExecutor(ExecutorType.SummonOrSet, (int)CardId.CyberDragonDrei, NoCyberDragonSpSummon);
            AddExecutor(ExecutorType.SummonOrSet, (int)CardId.CyberPhoenix, NoCyberDragonSpSummon);
            AddExecutor(ExecutorType.Summon, (int)CardId.NagaCyber, NoCyberDragonSpSummon);
            AddExecutor(ExecutorType.MonsterSet, (int)CardId.CyberDragonNoyau, NoCyberDragonSpSummon);
            AddExecutor(ExecutorType.MonsterSet, (int)CardId.CyberVouivre, CyberVouivre);
            AddExecutor(ExecutorType.SummonOrSet, (int)CardId.CyberDragonProto, CyberDragonProto);
            AddExecutor(ExecutorType.Summon, (int)CardId.CyberKirin, CyberKirin);

            AddExecutor(ExecutorType.SpSummon, (int)CardId.CyberDragon);
            AddExecutor(ExecutorType.SpSummon, (int)CardId.CyberDragonUltime);
            AddExecutor(ExecutorType.SpSummon, (int)CardId.CyberDragonJumele);
            AddExecutor(ExecutorType.SpSummon, (int)CardId.CyberDragonLaser);
            AddExecutor(ExecutorType.SpSummon, (int)CardId.CyberDragonBarriere);

            AddExecutor(ExecutorType.Activate, (int)CardId.CyberDragonLaser);
            AddExecutor(ExecutorType.Activate, (int)CardId.CyberDragonBarriere);
            AddExecutor(ExecutorType.Activate, (int)CardId.CyberDragonDrei);
            AddExecutor(ExecutorType.Activate, (int)CardId.CyberPhoenix);
            AddExecutor(ExecutorType.Activate, (int)CardId.CyberKirin);
            AddExecutor(ExecutorType.Activate, (int)CardId.CyberVouivre, CyberVouivreEffect);
            AddExecutor(ExecutorType.Activate, (int)CardId.NagaCyber);
        }
Esempio n. 14
0
        public CyberDragonExecutor(GameAI ai, Duel duel)
            : base(ai, duel)
        {
            Bot = Duel.Fields[0];

            AddExecutor(ExecutorType.SpellSet, DefaultSpellSet);
            AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);

            AddExecutor(ExecutorType.SpellSet, (int)CardId.Defusion);

            AddExecutor(ExecutorType.Activate, (int)CardId.CapsuleDuneAutreDimension, Capsule);
            AddExecutor(ExecutorType.Activate, (int)CardId.Raigeki, DefaultRaigeki);
            AddExecutor(ExecutorType.Activate, (int)CardId.Polymerisation, Polymeration);
            AddExecutor(ExecutorType.Activate, (int)CardId.LienDePuissance, LienDePuissance);
            AddExecutor(ExecutorType.Activate, (int)CardId.ExplosionDevolution, ExplosionDevolution);
            AddExecutor(ExecutorType.Activate, (int)CardId.DarkHole, DefaultDarkHole);
            AddExecutor(ExecutorType.Activate, (int)CardId.UniteDeGenerationPhotonique);
            AddExecutor(ExecutorType.Activate, (int)CardId.Defusion, Defusion);

            AddExecutor(ExecutorType.Activate, (int)CardId.TrappeSansFond, DefaultUniqueTrap);
            AddExecutor(ExecutorType.Activate, (int)CardId.ForceDeMirroir, DefaultUniqueTrap);
            AddExecutor(ExecutorType.Activate, (int)CardId.UniteReflectiveDattaque);
            AddExecutor(ExecutorType.Activate, (int)CardId.Disfonction);
            AddExecutor(ExecutorType.Activate, (int)CardId.AppelDeLetreHante, DefaultCallOfTheHaunted);

            AddExecutor(ExecutorType.SummonOrSet, (int)CardId.CyberDragonDrei, NoCyberDragonSpSummon);
            AddExecutor(ExecutorType.SummonOrSet, (int)CardId.CyberPhoenix, NoCyberDragonSpSummon);
            AddExecutor(ExecutorType.Summon, (int)CardId.NagaCyber, NoCyberDragonSpSummon);
            AddExecutor(ExecutorType.MonsterSet, (int)CardId.CyberDragonNoyau, NoCyberDragonSpSummon);
            AddExecutor(ExecutorType.MonsterSet, (int)CardId.CyberVouivre, CyberVouivre);
            AddExecutor(ExecutorType.SummonOrSet, (int)CardId.CyberDragonProto, CyberDragonProto);
            AddExecutor(ExecutorType.Summon, (int)CardId.CyberKirin, CyberKirin);

            AddExecutor(ExecutorType.SpSummon, (int)CardId.CyberDragon);
            AddExecutor(ExecutorType.SpSummon, (int)CardId.CyberDragonUltime);
            AddExecutor(ExecutorType.SpSummon, (int)CardId.CyberDragonJumele);
            AddExecutor(ExecutorType.SpSummon, (int)CardId.CyberDragonLaser);
            AddExecutor(ExecutorType.SpSummon, (int)CardId.CyberDragonBarriere);

            AddExecutor(ExecutorType.Activate, (int)CardId.CyberDragonLaser);
            AddExecutor(ExecutorType.Activate, (int)CardId.CyberDragonBarriere);
            AddExecutor(ExecutorType.Activate, (int)CardId.CyberDragonDrei);
            AddExecutor(ExecutorType.Activate, (int)CardId.CyberPhoenix);
            AddExecutor(ExecutorType.Activate, (int)CardId.CyberKirin);
            AddExecutor(ExecutorType.Activate, (int)CardId.CyberVouivre, CyberVouivreEffect);
            AddExecutor(ExecutorType.Activate, (int)CardId.NagaCyber);
        }
Esempio n. 15
0
        public CyberDragonExecutor(GameAI ai, Duel duel)
            : base(ai, duel)
        {
            Bot = Duel.Fields[0];

            AddExecutor(ExecutorType.SpellSet, (int)CardId.融合解除);

            AddExecutor(ExecutorType.Activate, (int)CardId.时间胶囊, Capsule);
            AddExecutor(ExecutorType.Activate, (int)CardId.Raigeki, DefaultRaigeki);
            AddExecutor(ExecutorType.Activate, (int)CardId.融合, 融合);
            AddExecutor(ExecutorType.Activate, (int)CardId.力量结合, 力量结合);
            AddExecutor(ExecutorType.Activate, (int)CardId.进化光焰, 进化光焰);
            AddExecutor(ExecutorType.Activate, (int)CardId.DarkHole, DefaultDarkHole);
            AddExecutor(ExecutorType.Activate, (int)CardId.光子发生装置);
            AddExecutor(ExecutorType.Activate, (int)CardId.融合解除, 融合解除);

            AddExecutor(ExecutorType.Activate, (int)CardId.奈落的落穴, DefaultUniqueTrap);
            AddExecutor(ExecutorType.Activate, (int)CardId.神圣防护罩反射镜力, DefaultUniqueTrap);
            AddExecutor(ExecutorType.Activate, (int)CardId.攻击反射装置);
            AddExecutor(ExecutorType.Activate, (int)CardId.盗贼的七道具, DefaultTrap);
            AddExecutor(ExecutorType.Activate, (int)CardId.活死人的呼声, DefaultCallOfTheHaunted);

            AddExecutor(ExecutorType.SummonOrSet, (int)CardId.电子龙三型, 没有电子龙可特殊召唤);
            AddExecutor(ExecutorType.SummonOrSet, (int)CardId.电子凤凰, 没有电子龙可特殊召唤);
            AddExecutor(ExecutorType.Summon, (int)CardId.电子多变龙, 没有电子龙可特殊召唤);
            AddExecutor(ExecutorType.MonsterSet, (int)CardId.电子龙核, 没有电子龙可特殊召唤);
            AddExecutor(ExecutorType.MonsterSet, (int)CardId.装甲电子翼, 装甲电子翼);
            AddExecutor(ExecutorType.SummonOrSet, (int)CardId.原始电子龙, 原始电子龙);
            AddExecutor(ExecutorType.Summon, (int)CardId.电子麒麟, 电子麒麟);

            AddExecutor(ExecutorType.SpSummon, (int)CardId.电子龙);
            AddExecutor(ExecutorType.SpSummon, (int)CardId.电子终结龙);
            AddExecutor(ExecutorType.SpSummon, (int)CardId.电子双生龙);
            AddExecutor(ExecutorType.SpSummon, (int)CardId.电子障壁龙);
            AddExecutor(ExecutorType.SpSummon, (int)CardId.电子镭射龙);

            AddExecutor(ExecutorType.Activate, (int)CardId.电子障壁龙);
            AddExecutor(ExecutorType.Activate, (int)CardId.电子镭射龙);
            AddExecutor(ExecutorType.Activate, (int)CardId.电子龙三型);
            AddExecutor(ExecutorType.Activate, (int)CardId.电子凤凰);
            AddExecutor(ExecutorType.Activate, (int)CardId.电子麒麟);
            AddExecutor(ExecutorType.Activate, (int)CardId.装甲电子翼, 装甲电子翼效果);
            AddExecutor(ExecutorType.Activate, (int)CardId.电子多变龙);

            AddExecutor(ExecutorType.SpellSet, DefaultSpellSet);
            AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
        }
Esempio n. 16
0
 public virtual int GetAppearPlace(Executor exec, GameAI ai, Duel duel, ClientField bot, ClientField enemy, int id, int player, CardLocation location, int available)
 {
     if (location == CardLocation.MonsterZone)
     {
         if ((available & ~bot.GetLinkedZones()) > 0)
         {
             available = available & ~bot.GetLinkedZones();
         }
         if ((available & Zones.MonsterZone1) > 0)
         {
             return(Zones.MonsterZone1);
         }
         return(available);
     }
     else
     {
         return(available);
     }
 }
Esempio n. 17
0
 public override bool ShouldExec(Executor exec, GameAI ai, Duel duel, ClientField bot, ClientField enemy, ClientCard card)
 {
     if (exec.ExecType == ExecutorType.Activate)
     {
         return(duel.Phase == DuelPhase.End);
     }
     if (exec.ExecType == ExecutorType.SpellSet)
     {
         var grave = bot.Graveyard;
         foreach (ClientCard c in grave)
         {
             if (c.BaseAttack < 1000)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Esempio n. 18
0
        private bool DestructionDeMain()
        {
            List <int>  SelectedCards = new List <int>();
            ClientField Bot           = Duel.Fields[0];

            if (Bot.HasInHand((int)CardId.KomodoDragon) && Bot.HasInHand((int)CardId.BlueEyesDragon) && Bot.Hand.Count > 2)
            {
                SelectedCards.Add((int)CardId.KomodoDragon);
                foreach (ClientCard card in Bot.Hand)
                {
                    if (card != null && card.Id != (int)CardId.BlueEyesDragon && SelectedCards.Count != 2)
                    {
                        SelectedCards.Add(card.Id);
                    }
                }
                AI.SelectCard(SelectedCards);
                return(true);
            }
            else if (Bot.HasInHand((int)CardId.DragonAppat) && !Bot.HasInGraveyard((int)CardId.BlueEyesDragon) && Bot.Hand.Count > 2)
            {
                SelectedCards.Add((int)CardId.BlueEyesDragon);
                foreach (ClientCard card in Bot.Hand)
                {
                    if (card != null && card.Id != (int)CardId.DragonAppat && SelectedCards.Count != 2)
                    {
                        SelectedCards.Add(card.Id);
                    }
                }
                AI.SelectCard(SelectedCards);
                return(true);
            }
            else if (Bot.HasInHand((int)CardId.Kaibaman) && Bot.HasInHand((int)CardId.BlueEyesDragon) || (Bot.HasInHand((int)CardId.SilverCry) || Bot.HasInHand((int)CardId.DragonAppat)) && Bot.HasInGraveyard((int)CardId.BlueEyesDragon))
            {
                return(false);
            }
            else if (Bot.HasInHand((int)CardId.Maiden) || Bot.HasInHand((int)CardId.DragonEtincelant1) && !AI.Utils.IsOneEnnemyBetterThanValue(1900, true) || Bot.HasInHand((int)CardId.Pierre) || Bot.HasInHand((int)CardId.DragonSombreMetalique))
            {
                return(false);
            }
            return(true);
        }
Esempio n. 19
0
        public void GivenIHaveLaunchedApplictionWithCredentials(string login, string password, string client)
        {
            //Start application
            EC4 = Application.Launch(@"D:\EchoContactClient.Host.exe.lnk");
            Window LoginWindow = EC4.GetWindow(SearchCriteria.ByClassName("Window"), InitializeOption.NoCache);

            //Set login
            LoginTextBox = LoginWindow.Get <TextBox>(SearchCriteria.ByAutomationId("LoginField"));
            LoginTextBox.SetTextToTextbox(login);
            //Set password
            PasswordField = LoginWindow.Get <TextBox>(SearchCriteria.ByAutomationId("PasswordField"));
            PasswordField.SetTextToTextbox(password);
            //Set client
            ClientField = LoginWindow.Get <TextBox>(SearchCriteria.ByAutomationId("ClientField"));
            ClientField.SetTextToTextbox(client);
            //Check if remember me check box isn't selected
            RememberMeCheckBox = LoginWindow.Get <CheckBox>(SearchCriteria.ByClassName("CheckBox"));
            if (!RememberMeCheckBox.Checked)
            {
                RememberMeCheckBox.Click();
            }
            //Click Login button to open Desk selection window
            LoginButton = LoginWindow.Get <Button>(SearchCriteria.ByAutomationId("LoginButton"));
            LoginButton.Click();
            //Wait till desk selection window appears
            Thread.Sleep(40000);
            DeskSelection = LoginWindow.Get <ComboBox>(SearchCriteria.ByAutomationId("deskSelectionCombobox"));
            //Select make me immediatly available option
            MakeMeImmediatlyAvailable = LoginWindow.Get <CheckBox>(SearchCriteria.ByAutomationId("makeMeImmediatelyAvailableCheckBox"));
            if (!MakeMeImmediatlyAvailable.Checked)
            {
                MakeMeImmediatlyAvailable.Click();
            }
            //Click OK to open agent dashboard window
            OkButton = LoginWindow.Get <Button>(SearchCriteria.ByAutomationId("OkButton"));
            OkButton.Click();
            Thread.Sleep(2000);
        }
Esempio n. 20
0
        /// <summary>
        /// Get the best ATK or DEF power of the field.
        /// </summary>
        /// <param name="field">Bot or Enemy.</param>
        /// <param name="onlyATK">Only calculate attack.</param>
        public int GetBestPower(ClientField field, bool onlyATK = false)
        {
            int bestPower = -1;

            for (int i = 0; i < 7; ++i)
            {
                ClientCard card = field.MonsterZone[i];
                if (card == null || card.Data == null)
                {
                    continue;
                }
                if (onlyATK && card.IsDefense())
                {
                    continue;
                }
                int newPower = card.GetDefensePower();
                if (newPower > bestPower)
                {
                    bestPower = newPower;
                }
            }
            return(bestPower);
        }
Esempio n. 21
0
        public int GetBestAttack(ClientField field, bool onlyatk)
        {
            int bestAtk = -1;

            for (int i = 0; i < 7; ++i)
            {
                ClientCard card = field.MonsterZone[i];
                if (card == null)
                {
                    continue;
                }
                if (onlyatk && card.IsDefense())
                {
                    continue;
                }
                int ennemyValue = card.GetDefensePower();
                if (ennemyValue > bestAtk)
                {
                    bestAtk = ennemyValue;
                }
            }
            return(bestAtk);
        }
Esempio n. 22
0
        private bool DragonSombre()
        {
            ClientField Bot      = Duel.Fields[0];
            int         Selected = 0;

            if (Bot.HasInGraveyard((int)CardId.BlueEyesDragon) || Bot.HasInHand((int)CardId.BlueEyesDragon))
            {
                Selected = (int)CardId.BlueEyesDragon;
            }
            else if (Bot.HasInGraveyard((int)CardId.DragonTonnerre) || Bot.HasInHand((int)CardId.DragonTonnerre))
            {
                Selected = (int)CardId.DragonTonnerre;
            }
            else if (Bot.HasInGraveyard((int)CardId.UltimeDragonBlanc) || Bot.HasInHand((int)CardId.UltimeDragonBlanc))
            {
                Selected = (int)CardId.UltimeDragonBlanc;
            }
            else if (Bot.HasInGraveyard((int)CardId.Dragon5Tetes) || Bot.HasInHand((int)CardId.Dragon5Tetes))
            {
                Selected = (int)CardId.Dragon5Tetes;
            }
            else if (Bot.HasInGraveyard((int)CardId.DragonMirage) || Bot.HasInHand((int)CardId.DragonMirage))
            {
                Selected = (int)CardId.DragonMirage;
            }
            else if (Bot.HasInGraveyard((int)CardId.DragonEtincelant1) || Bot.HasInHand((int)CardId.DragonEtincelant1))
            {
                Selected = (int)CardId.DragonEtincelant1;
            }
            if (Selected != 0)
            {
                AI.SelectCard(Selected);
                return(true);
            }
            return(false);
        }
Esempio n. 23
0
        public virtual CardPosition GetSummonPosition(Executor exec, GameAI ai, Duel duel, ClientField bot, ClientField enemy, ClientCard card)
        {
            int atk = 0;

            YGOSharp.OCGWrapper.NamedCard cardData = YGOSharp.OCGWrapper.NamedCard.Get(card.Id);
            if (cardData != null)
            {
                atk = cardData.Attack;
            }
            foreach (ClientCard c in enemy.GetMonsters())
            {
                if (c.RealPower <= atk)
                {
                    continue;
                }
                //Enemy atk is more than bot's
                if (c.IsLastAttacker)
                {
                    return(CardPosition.FaceUpAttack);
                }
                if (exec.Util.IsTurn1OrMain2()) //Can't attack -> defense
                {
                    return(CardPosition.FaceUpDefence);
                }
                else
                {
                    if (c.HasPosition(CardPosition.Defence) && c.Defense < atk)
                    {
                        return(CardPosition.FaceUpAttack);
                    }
                    else
                    {
                        if (exec.Util.GetWorstBotMonster(false).RealPower > atk)
                        {
                            return(CardPosition.FaceUpDefence);
                        }
                        if (c.Attack - atk > bot.LifePoints)
                        {
                            return(CardPosition.FaceUpDefence);
                        }
                    }
                }
            }
            return(CardPosition.Attack);
        }
Esempio n. 24
0
 public int GetBestAttack(ClientField field)
 {
     return(GetBestPower(field, true));
 }
Esempio n. 25
0
 /// <summary>
 /// Get the best ATK or DEF power of the field.
 /// </summary>
 /// <param name="field">Bot or Enemy.</param>
 /// <param name="onlyATK">Only calculate attack.</param>
 public int GetBestPower(ClientField field, bool onlyATK = false)
 {
     return(field.MonsterZone.GetMonsters()
            .Where(card => !onlyATK || card.IsAttack())
            .Max(card => (int?)card.GetDefensePower()) ?? -1);
 }
Esempio n. 26
0
 public AIUtil(Duel duel)
 {
     Duel  = duel;
     Bot   = Duel.Fields[0];
     Enemy = Duel.Fields[1];
 }
Esempio n. 27
0
 public override bool ShouldExec(Executor exec, GameAI ai, Duel duel, ClientField bot, ClientField enemy, ClientCard card)
 {
     ai.SelectCard(74644400, 3431737, 77036039, 49826746, 40048324);
     return(true);
 }
Esempio n. 28
0
 public AIFunctions(Duel duel)
 {
     Duel  = duel;
     Bot   = Duel.Fields[0];
     Enemy = Duel.Fields[1];
 }
Esempio n. 29
0
 public override CardPosition GetSummonPosition(Executor exec, GameAI ai, Duel duel, ClientField bot, ClientField enemy, ClientCard card)
 {
     if (card.Location == CardLocation.Grave)
     {
         return(CardPosition.FaceUpDefence);
     }
     return(CardPosition.FaceUpAttack);
 }
Esempio n. 30
0
        private bool DragonRavineEffect()
        {
            if (Card.Location != CardLocation.SpellZone)
            {
                return(false);
            }

            ClientField field = Duel.Fields[0];

            int tributeId = -1;

            if (field.HasInHand((int)CardId.DragunityPhalanx))
            {
                tributeId = (int)CardId.DragunityPhalanx;
            }
            else if (field.HasInHand((int)CardId.FireFormationTenki))
            {
                tributeId = (int)CardId.FireFormationTenki;
            }
            else if (field.HasInHand((int)CardId.Terraforming))
            {
                tributeId = (int)CardId.Terraforming;
            }
            else if (field.HasInHand((int)CardId.DragonRavine))
            {
                tributeId = (int)CardId.DragonRavine;
            }
            else if (field.HasInHand((int)CardId.AssaultTeleport))
            {
                tributeId = (int)CardId.AssaultTeleport;
            }
            else if (field.HasInHand((int)CardId.AssaultBeast))
            {
                tributeId = (int)CardId.AssaultBeast;
            }
            else if (field.HasInHand((int)CardId.DragunityArmaMysletainn))
            {
                tributeId = (int)CardId.DragunityArmaMysletainn;
            }
            else
            {
                int count = 0;
                foreach (ClientCard card in Duel.Fields[0].Hand)
                {
                    if (card.Id == (int)CardId.DragunityDux)
                    {
                        ++count;
                    }
                }
                if (count >= 2)
                {
                    tributeId = (int)CardId.DragunityDux;
                }
            }
            if (tributeId == -1 && field.HasInHand((int)CardId.StardustDragonAssaultMode))
            {
                tributeId = (int)CardId.StardustDragonAssaultMode;
            }

            if (tributeId == -1)
            {
                return(false);
            }

            int needId = -1;

            if (!field.HasInMonstersZone((int)CardId.DragunityPhalanx) &&
                !field.HasInGraveyard((int)CardId.DragunityPhalanx))
            {
                needId = (int)CardId.DragunityPhalanx;
            }
            else if (field.GetMonsterCount() == 0)
            {
                needId = (int)CardId.DragunityDux;
            }
            else
            {
                bool hasRealMonster = false;
                foreach (ClientCard card in field.GetMonsters())
                {
                    if (card.Id != (int)CardId.AssaultBeast)
                    {
                        hasRealMonster = true;
                        break;
                    }
                }
                if (!hasRealMonster || GetProblematicCard() != null)
                {
                    needId = (int)CardId.DragunityDux;
                }
            }

            if (needId == -1)
            {
                return(false);
            }

            int option;

            if (tributeId == (int)CardId.DragunityPhalanx)
            {
                needId = (int)CardId.DragunityDux;
            }

            int remaining = 3;

            foreach (ClientCard card in Duel.Fields[0].Hand)
            {
                if (card.Id == needId)
                {
                    remaining--;
                }
            }
            foreach (ClientCard card in Duel.Fields[0].Graveyard)
            {
                if (card.Id == needId)
                {
                    remaining--;
                }
            }
            foreach (ClientCard card in Duel.Fields[0].Banished)
            {
                if (card.Id == needId)
                {
                    remaining--;
                }
            }
            if (remaining <= 0)
            {
                return(false);
            }

            if (needId == (int)CardId.DragunityPhalanx)
            {
                option = 2;
            }
            else
            {
                option = 1;
            }

            if (ActivateDescription != (int)CardId.DragonRavine * 16 + option)
            {
                return(false);
            }

            AI.SelectCard(tributeId);
            AI.SelectNextCard(needId);

            return(true);
        }
Esempio n. 31
0
        private bool ScrapDragonEffect()
        {
            ClientCard invincible = GetProblematicCard();

            if (invincible == null && !AI.Utils.IsOneEnnemyBetterThanValue(2800 - 1, false))
            {
                return(false);
            }

            ClientField field = Duel.Fields[0];

            int tributeId = -1;

            if (field.HasInSpellZone((int)CardId.FireFormationTenki))
            {
                tributeId = (int)CardId.FireFormationTenki;
            }
            else if (field.HasInSpellZone((int)CardId.Terraforming))
            {
                tributeId = (int)CardId.Terraforming;
            }
            else if (field.HasInSpellZone((int)CardId.DragonsMirror))
            {
                tributeId = (int)CardId.DragonsMirror;
            }
            else if (field.HasInSpellZone((int)CardId.CardsOfConsonance))
            {
                tributeId = (int)CardId.CardsOfConsonance;
            }
            else if (field.HasInSpellZone((int)CardId.AssaultTeleport))
            {
                tributeId = (int)CardId.AssaultTeleport;
            }
            else if (field.HasInSpellZone((int)CardId.AssaultModeActivate))
            {
                tributeId = (int)CardId.AssaultModeActivate;
            }
            else if (field.HasInSpellZone((int)CardId.DragonRavine))
            {
                tributeId = (int)CardId.DragonRavine;
            }

            List <ClientCard> monsters = Duel.Fields[1].GetMonsters();

            monsters.Sort(AIFunctions.CompareCardAttack);

            ClientCard destroyCard = invincible;

            if (destroyCard == null)
            {
                for (int i = monsters.Count - 1; i >= 0; --i)
                {
                    if (monsters[i].IsAttack())
                    {
                        destroyCard = monsters[i];
                        break;
                    }
                }
            }

            if (destroyCard == null)
            {
                return(false);
            }

            if (tributeId != -1)
            {
                AI.SelectCard(tributeId);
            }

            AI.SelectNextCard(destroyCard);

            return(true);
        }