Beispiel #1
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);
        }
Beispiel #2
0
 private bool 装甲电子翼效果()
 {
     if (Card.Location == CardLocation.Hand)
     {
         return(true);
     }
     else if (Card.Location == CardLocation.SpellZone)
     {
         if (AI.Utils.IsOneEnnemyBetterThanValue(Bot.GetMonsters().GetHighestAttackMonster().Attack, true))
         {
             if (ActivateDescription == AI.Utils.GetStringId((int)CardId.装甲电子翼, 2))
             {
                 return(true);
             }
         }
         return(false);
     }
     return(false);
 }
Beispiel #3
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);
        }