Exemplo n.º 1
0
        /// <summary>
        /// Chain the enemy monster, or disable monster like Rescue Rabbit.
        /// </summary>
        protected bool DefaultBreakthroughSkill()
        {
            if (!DefaultUniqueTrap())
            {
                return(false);
            }

            if (Duel.Player == 1)
            {
                foreach (ClientCard target in Enemy.GetMonsters())
                {
                    if (target.IsMonsterShouldBeDisabledBeforeItUseEffect())
                    {
                        AI.SelectCard(target);
                        return(true);
                    }
                }
            }

            ClientCard LastChainCard = AI.Utils.GetLastChainCard();

            if (LastChainCard == null)
            {
                return(false);
            }
            if (LastChainCard.Controller != 1 || LastChainCard.Location != CardLocation.MonsterZone ||
                LastChainCard.IsDisabled() || LastChainCard.IsShouldNotBeTarget() || LastChainCard.IsShouldNotBeSpellTrapTarget())
            {
                return(false);
            }
            AI.SelectCard(LastChainCard);
            return(true);
        }
Exemplo n.º 2
0
        //装甲 至宝黄金叉 效果
        private bool MzhibaohuangjinchaEffect()
        {
            List <ClientCard> bot_monsters = Bot.GetMonsters();

            bot_monsters.Sort(CardContainer.CompareCardAttack);
            bot_monsters.Reverse();
            if (Bot.GetMonsters().Count > 1)
            {
                for (int i = 0; i < bot_monsters.Count; i++)
                {
                    ClientCard card = bot_monsters[i];
                    if (card.IsCode(CardId.Zdongfengdaqi) && !card.IsDisabled())
                    {
                        bot_monsters.Add(card);
                    }
                }
                AI.SelectCard(bot_monsters);
                return(true);
            }
            else
            {
                AI.SelectCard(bot_monsters);
                return(true);
            }
        }
Exemplo n.º 3
0
 public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
 {
     if (attacker.Id == CardId.Linkuriboh && defender.IsFacedown())
     {
         return(false);
     }
     if (attacker.Id == CardId.SandaionTheTimelord && !attacker.IsDisabled())
     {
         attacker.RealPower = 9999;
         return(true);
     }
     if (attacker.Id == CardId.MichionTimelord && !attacker.IsDisabled())
     {
         attacker.RealPower = 9999;
         return(true);
     }
     return(base.OnPreBattleBetween(attacker, defender));
 }
Exemplo n.º 4
0
        /// <summary>
        /// Decide whether to declare attack between attacker and defender.
        /// Can be overrided to update the RealPower of attacker for cards like Honest.
        /// </summary>
        /// <param name="attacker">Card that attack.</param>
        /// <param name="defender">Card that defend.</param>
        /// <returns>false if the attack can't be done.</returns>
        public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
        {
            if (attacker.RealPower <= 0)
            {
                return(false);
            }

            if (!attacker.IsMonsterHasPreventActivationEffectInBattle())
            {
                if (defender.IsMonsterDangerous() || (defender.IsMonsterInvincible() && defender.IsDefense()))
                {
                    return(false);
                }

                if (defender.Id == _CardId.CrystalWingSynchroDragon && defender.IsAttack() && !defender.IsDisabled() && attacker.Level >= 5)
                {
                    return(false);
                }

                if (defender.Id == _CardId.NumberS39UtopiaTheLightning && defender.IsAttack() && !defender.IsDisabled() && defender.HasXyzMaterial(2, _CardId.Number39Utopia))
                {
                    defender.RealPower = 5000;
                }
            }

            if (!defender.IsMonsterHasPreventActivationEffectInBattle())
            {
                if (attacker.Id == _CardId.NumberS39UtopiaTheLightning && !attacker.IsDisabled() && attacker.HasXyzMaterial(2, _CardId.Number39Utopia))
                {
                    attacker.RealPower = 5000;
                }
            }

            if (Enemy.HasInMonstersZone(_CardId.DupeFrog, true) && defender.Id != _CardId.DupeFrog)
            {
                return(false);
            }

            if (Enemy.HasInMonstersZone(_CardId.MaraudingCaptain, true) && defender.Id != _CardId.MaraudingCaptain && defender.Race == (int)CardRace.Warrior)
            {
                return(false);
            }

            if (defender.Id == _CardId.UltimayaTzolkin && !defender.IsDisabled())
            {
                List <ClientCard> monsters = Enemy.GetMonsters();
                foreach (ClientCard monster in monsters)
                {
                    if (monster.HasType(CardType.Synchro))
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
 // update stats for battle prediction based on effects
 public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
 {
     if (!defender.IsMonsterHasPreventActivationEffectInBattle())
     {
         if (attacker.IsCode(CardId.ShaddollConstruct) && !attacker.IsDisabled() && defender.IsSpecialSummoned) // NOTE: Possible to check destruction immunity?
         {
             attacker.RealPower = 9999;
         }
         if (attacker.IsCode(CardId.DragmaFleur) && !attacker.IsDisabled() && !FleurAttackUsed)
         {
             attacker.RealPower += 500;
         }
         if (attacker.HasType(CardType.Fusion) && Bot.HasInHand(CardId.InvokedAleister))
         {
             attacker.RealPower += 1000;
         }
     }
     return(base.OnPreBattleBetween(attacker, defender));
 }
Exemplo n.º 6
0
 public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
 {
     if (!defender.IsMonsterHasPreventActivationEffectInBattle())
     {
         if (attacker.IsCode(CardId.HiSpeedroidChanbara) && !attacker.IsDisabled())
         {
             attacker.RealPower = attacker.RealPower + 200;
         }
     }
     return(base.OnPreBattleBetween(attacker, defender));
 }
 public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
 {
     if (!defender.IsMonsterHasPreventActivationEffectInBattle())
     {
         if (attacker.Id == CardId.UltimateConductorTytanno && !attacker.IsDisabled() && defender.IsDefense())
         {
             attacker.RealPower = 9999;
         }
     }
     return(base.OnPreBattleBetween(attacker, defender));
 }
Exemplo n.º 8
0
 public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
 {
     if (!defender.IsMonsterHasPreventActivationEffectInBattle())
     {
         if (attacker.IsCode(CardId.SkyCavalryCentaurea) && !attacker.IsDisabled() && attacker.HasXyzMaterial())
         {
             attacker.RealPower = Bot.LifePoints + attacker.Attack;
         }
     }
     return(base.OnPreBattleBetween(attacker, defender));
 }
Exemplo n.º 9
0
 public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
 {
     if (!defender.IsMonsterHasPreventActivationEffectInBattle())
     {
         if (!attacker.IsDisabled() && (attacker.IsCode(CardId.MekkKnightCrusadiaAstram) && defender.IsSpecialSummoned ||
                                        attacker.IsCode(CardId.CrystalWingSynchroDragon) && defender.Level >= 5))
         {
             attacker.RealPower = attacker.RealPower + defender.Attack;
         }
     }
     return(base.OnPreBattleBetween(attacker, defender));
 }
Exemplo n.º 10
0
        public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
        {
            if (!defender.IsMonsterHasPreventActivationEffectInBattle())
            {
                if (attacker.IsCode(CardId.TrickstarCandina) && Bot.HasInHand(CardId.TrickstarCarobein))
                {
                    attacker.RealPower = attacker.RealPower + 1800;
                }

                if (attacker.IsCode(CardId.BorrelswordDragon) && !attacker.IsDisabled() && !BorrelswordDragonUsed)
                {
                    attacker.RealPower = attacker.RealPower + defender.GetDefensePower() / 2;
                    defender.RealPower = defender.RealPower - defender.GetDefensePower() / 2;
                }
            }
            return(base.OnPreBattleBetween(attacker, defender));
        }
Exemplo n.º 11
0
        /// <summary>
        /// Default InfiniteImpermanence effect
        /// </summary>
        protected bool DefaultInfiniteImpermanence()
        {
            ClientCard target = Enemy.MonsterZone.GetShouldBeDisabledBeforeItUseEffectMonster();

            if (target != null)
            {
                AI.SelectCard(target);
                return(true);
            }
            if (Duel.LastChainPlayer == 1)
            {
                foreach (ClientCard check in Enemy.GetMonsters())
                {
                    if (AI.Utils.GetLastChainCard() == check)
                    {
                        target = check;
                        break;
                    }
                }
                if (target != null && !target.IsDisabled())
                {
                    AI.SelectCard(target);
                    return(true);
                }
            }
            if (Bot.BattlingMonster != null && Enemy.BattlingMonster != null)
            {
                if (Enemy.BattlingMonster.IsDisabled())
                {
                    return(false);
                }
                if (Enemy.BattlingMonster.Id == _CardId.EaterOfMillions)
                {
                    AI.SelectCard(Enemy.BattlingMonster);
                    return(true);
                }
            }
            if (Duel.Phase == DuelPhase.BattleStart && Duel.Player == 1 &&
                Enemy.HasInMonstersZone(_CardId.NumberS39UtopiaTheLightning, true))
            {
                AI.SelectCard(_CardId.NumberS39UtopiaTheLightning);
                return(UniqueFaceupSpell());
            }
            return(false);
        }
Exemplo n.º 12
0
 public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
 {
     if (defender.IsMonsterInvincible())
     {
         if (defender.IsMonsterDangerous() || defender.IsDefense())
         {
             return(false);
         }
     }
     if (!(defender.Id == (int)CardId.闪光No39希望皇霍普电光皇))
     {
         if (attacker.Id == (int)CardId.神骑矢车菊圣人马 && !attacker.IsDisabled() && attacker.HasXyzMaterial())
         {
             attacker.RealPower = Duel.LifePoints[0] + attacker.Attack;
         }
     }
     return(attacker.RealPower >= defender.GetDefensePower());
 }
Exemplo n.º 13
0
        public override ClientCard OnSelectAttacker(IList <ClientCard> attackers, IList <ClientCard> defenders)
        {
            List <ClientCard> att = new List <ClientCard>();

            foreach (ClientCard tc in attackers)
            {
                att.Add(tc);
            }
            if (att.Count > 0)
            {
                att.Sort(CardContainer.CompareCardAttack);
                att.Reverse();
                for (int i = 0; i < attackers.Count; i++)
                {
                    ClientCard attacker = attackers[i];
                    if (attacker.IsCode(13701) && !attacker.IsDisabled() &&
                        (Bot.GetMonsters().GetMatchingCardsCount(card => card.IsAttack() && card.HasSetcode(0x14b)) > 0 && (attacker.HasXyzMaterial() || (Bot.GetFieldSpellCard().IsFaceup() && !Bot.GetFieldSpellCard().IsDisabled() && Bot.GetFieldSpellCard().IsCode(12201, 13706))) ||
                         Bot.SpellZone.GetMatchingCardsCount(card => card.IsAttack() && card.HasSetcode(0x14b)) > 0 && (attacker.HasXyzMaterial() || (Bot.GetFieldSpellCard().IsFaceup() && !Bot.GetFieldSpellCard().IsDisabled() && Bot.GetFieldSpellCard().IsCode(12201, 13706)))))
                    {
                        att.Remove(attacker); att.Add(attacker); attackers.Remove(attacker); attackers.Add(attacker);
                    }
                }
                for (int i = 0; i < attackers.Count; i++)
                {
                    ClientCard attacker = attackers[i];
                    if ((attacker.IsCode(13702) || attacker.IsCode(13703) || attacker.IsCode(13704)) && !attacker.IsDisabled() &&
                        Bot.GetMonsters().GetMatchingCardsCount(card => card.IsAttack() && card.HasSetcode(0x14b)) > 0 && (attacker.HasXyzMaterial() || (Bot.GetFieldSpellCard().IsFaceup() && !Bot.GetFieldSpellCard().IsDisabled() && Bot.GetFieldSpellCard().IsCode(12201, 13706))) ||
                        (Bot.SpellZone.GetMatchingCardsCount(card => card.IsAttack() && card.HasSetcode(0x14b)) > 0 && (attacker.HasXyzMaterial() || (Bot.GetFieldSpellCard().IsFaceup() && !Bot.GetFieldSpellCard().IsDisabled() && Bot.GetFieldSpellCard().IsCode(12201, 13706)))))
                    {
                        att.Remove(attacker); att.Add(attacker); attackers.Remove(attacker); attackers.Add(attacker);
                    }
                }
                att.Reverse();
            }
            for (int i = 0; i < att.Count; ++i)
            {
                ClientCard attacker = attackers[i];
                Logger.DebugWriteLine(attacker.Name);
                return(attacker);
            }
            return(base.OnSelectAttacker(attackers, defenders));
        }
Exemplo n.º 14
0
 public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
 {
     if (defender.IsMonsterInvincible())
     {
         if (defender.IsMonsterDangerous() || defender.IsDefense())
         {
             return(false);
         }
     }
     if (!(defender.Id == (int)CardId.闪光No39希望皇霍普电光皇))
     {
         //if (attacker.HasType(CardType.Fusion) && Bot.HasInHand((int)CardId.召唤师阿莱斯特))
         //    attacker.RealPower = attacker.RealPower + 1000;
         if (attacker.Id == (int)CardId.闪光No39希望皇霍普电光皇 && !attacker.IsDisabled() && attacker.HasXyzMaterial(2, (int)CardId.No39希望皇霍普))
         {
             attacker.RealPower = 5000;
         }
     }
     return(attacker.RealPower > defender.GetDefensePower());
 }
Exemplo n.º 15
0
 public override BattlePhaseAction OnSelectAttackTarget(ClientCard attacker, IList <ClientCard> defenders)
 {
     if (attacker.IsCode(CardId.BlueEyesChaosMaxDragon) && !attacker.IsDisabled() &&
         Enemy.HasInMonstersZone(new[] { CardId.DeviritualTalismandra, CardId.DevirrtualCandoll }))
     {
         for (int i = 0; i < defenders.Count; i++)
         {
             ClientCard defender = defenders[i];
             attacker.RealPower = attacker.Attack;
             defender.RealPower = defender.GetDefensePower();
             if (!OnPreBattleBetween(attacker, defender))
             {
                 continue;
             }
             if (defender.IsCode(CardId.DevirrtualCandoll, CardId.DeviritualTalismandra))
             {
                 return(AI.Attack(attacker, defender));
             }
         }
     }
     return(base.OnSelectAttackTarget(attacker, defenders));
 }
Exemplo n.º 16
0
 public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
 {
     if (defender.IsMonsterInvincible())
     {
         if (defender.IsMonsterDangerous() || defender.IsDefense())
         {
             return(false);
         }
     }
     if (!(defender.Id == (int)CardId.闪光No39希望皇霍普电光皇))
     {
         if (attacker.Id == (int)CardId.闪光No39希望皇霍普电光皇 && !attacker.IsDisabled() && attacker.HasXyzMaterial(2, (int)CardId.No39希望皇霍普))
         {
             attacker.RealPower = 5000;
         }
         if (Duel.Fields[0].HasInMonstersZone((int)CardId.No37希望织龙蜘蛛鲨, true, true))
         {
             attacker.RealPower = attacker.RealPower + 1000;
         }
     }
     return(attacker.RealPower > defender.GetDefensePower());
 }
Exemplo n.º 17
0
        /// <summary>
        /// Chain the enemy monster, or disable monster like Rescue Rabbit.
        /// </summary>
        protected bool DefaultDisableMonster()
        {
            if (Duel.Player == 1)
            {
                ClientCard target = Enemy.MonsterZone.GetShouldBeDisabledBeforeItUseEffectMonster();
                if (target != null)
                {
                    AI.SelectCard(target);
                    return(true);
                }
            }

            ClientCard LastChainCard = Util.GetLastChainCard();

            if (LastChainCard != null && LastChainCard.Controller == 1 && LastChainCard.Location == CardLocation.MonsterZone &&
                !LastChainCard.IsDisabled() && !LastChainCard.IsShouldNotBeTarget() && !LastChainCard.IsShouldNotBeSpellTrapTarget())
            {
                AI.SelectCard(LastChainCard);
                return(true);
            }

            if (Bot.BattlingMonster != null && Enemy.BattlingMonster != null)
            {
                if (!Enemy.BattlingMonster.IsDisabled() && Enemy.BattlingMonster.IsCode(_CardId.EaterOfMillions))
                {
                    AI.SelectCard(Enemy.BattlingMonster);
                    return(true);
                }
            }

            if (Duel.Phase == DuelPhase.BattleStart && Duel.Player == 1 &&
                Enemy.HasInMonstersZone(_CardId.NumberS39UtopiaTheLightning, true))
            {
                AI.SelectCard(_CardId.NumberS39UtopiaTheLightning);
                return(true);
            }

            return(false);
        }
Exemplo n.º 18
0
 public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
 {
     if (defender.IsMonsterInvincible())
     {
         if (defender.IsMonsterDangerous() || defender.IsDefense())
         {
             return(false);
         }
     }
     if (!(defender.Id == (int)CardId.闪光No39希望皇霍普电光皇))
     {
         if (attacker.Attribute == (int)CardAttribute.Light && Duel.Fields[0].HasInHand((int)CardId.欧尼斯特))
         {
             attacker.RealPower = attacker.RealPower + defender.Attack;
         }
         if (attacker.Id == (int)CardId.闪光No39希望皇霍普电光皇 && !attacker.IsDisabled() && attacker.HasXyzMaterial(2, (int)CardId.No39希望皇霍普))
         {
             attacker.RealPower = 5000;
         }
     }
     return(attacker.RealPower > defender.GetDefensePower());
 }
Exemplo n.º 19
0
 public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
 {
     if (defender.IsMonsterInvincible())
     {
         if (defender.IsMonsterDangerous() || defender.IsDefense())
         {
             return(false);
         }
     }
     if (!(defender.Id == (int)CardId.NumberS39UtopiatheLightning))
     {
         if (attacker.Attribute == (int)CardAttribute.Light && Bot.HasInHand((int)CardId.Honest))
         {
             attacker.RealPower = attacker.RealPower + defender.Attack;
         }
         if (attacker.Id == (int)CardId.NumberS39UtopiatheLightning && !attacker.IsDisabled() && attacker.HasXyzMaterial(2, (int)CardId.Number39Utopia))
         {
             attacker.RealPower = 5000;
         }
     }
     return(attacker.RealPower > defender.GetDefensePower());
 }
Exemplo n.º 20
0
        public override ClientCard OnSelectAttacker(IList <ClientCard> attackers, IList <ClientCard> defenders)
        {
            // attack with Winda first because if summoned by Ruq it cannot attack directly
            ClientCard windaCard = attackers.GetFirstMatchingCard(card => card.IsCode(CardId.ShaddollWinda));

            if (!(windaCard == null) && defenders.IsExistingMatchingCard(card => card.Attack < windaCard.Attack))
            {
                return(windaCard);
            }

            // attack with Construct first because if summoned by Ruq it cannot attack directly, and to use its effect
            ClientCard constructCard = attackers.GetFirstMatchingCard(card => card.IsCode(CardId.ShaddollConstruct));

            if (!(constructCard == null) && !constructCard.IsDisabled() &&
                defenders.IsExistingMatchingCard(card => (card.IsSpecialSummoned && !card.IsMonsterHasPreventActivationEffectInBattle()) ||
                                                 card.Attack < constructCard.Attack))
            {
                return(constructCard);
            }

            // attack with Fleur-de-lis first to get attack buff on all Dragmas
            ClientCard fleurCard = attackers.GetFirstMatchingCard(card => card.IsCode(CardId.DragmaFleur));

            if (!(fleurCard == null))
            {
                if (defenders.IsExistingMatchingCard(card => card.Attack < fleurCard.RealPower))
                {
                    return(fleurCard);
                }
            }

            // if caliga is restricting attacks, swing with the strongest first
            if (attackers.ContainsCardWithId(CardId.InvokedCaliga))
            {
                return(Util.GetBestBotMonster());
            }

            return(base.OnSelectAttacker(attackers, defenders));
        }
Exemplo n.º 21
0
        private bool WidowAnchorEffect()
        {
            if (DefaultBreakthroughSkill())
            {
                WidowAnchorTarget = Util.GetLastChainCard();
                return(true);
            }

            if (!HaveThreeSpellsInGrave() || Duel.Player == 1 || Duel.Phase < DuelPhase.Main1 || Duel.Phase >= DuelPhase.Main2 || Util.ChainContainsCard(CardId.WidowAnchor))
            {
                return(false);
            }

            ClientCard target = Util.GetBestEnemyMonster(true, true);

            if (target != null && !target.IsDisabled() && !target.HasType(CardType.Normal))
            {
                WidowAnchorTarget = target;
                AI.SelectCard(target);
                return(true);
            }
            return(false);
        }
Exemplo n.º 22
0
        protected bool DefaultDimensionalBarrier()
        {
            if (Duel.Player != 0)
            {
                List <ClientCard> monsters = Duel.Fields[1].GetMonsters();
                int[]             levels   = new int[13];
                bool tuner    = false;
                bool nontuner = false;
                foreach (ClientCard monster in monsters)
                {
                    if (monster.HasType(CardType.Tuner))
                    {
                        tuner = true;
                    }
                    else if (!monster.HasType(CardType.Xyz))
                    {
                        nontuner = true;
                    }
                    if (monster.IsOneForXyz())
                    {
                        AI.SelectOption(3);
                        return(true);
                    }
                    levels[monster.Level] = levels[monster.Level] + 1;
                }
                if (tuner && nontuner)
                {
                    AI.SelectOption(2);
                    return(true);
                }
                for (int i = 1; i <= 12; i++)
                {
                    if (levels[i] > 1)
                    {
                        AI.SelectOption(3);
                        return(true);
                    }
                }
                ClientCard l = Duel.Fields[1].SpellZone[6];
                ClientCard r = Duel.Fields[1].SpellZone[7];
                if (l != null && r != null && l.LScale != r.RScale)
                {
                    AI.SelectOption(4);
                    return(true);
                }
            }
            ClientCard lastchaincard = GetLastChainCard();

            if (LastChainPlayer == 1 && lastchaincard != null && !lastchaincard.IsDisabled())
            {
                if (lastchaincard.HasType(CardType.Ritual))
                {
                    AI.SelectOption(0);
                    return(true);
                }
                if (lastchaincard.HasType(CardType.Fusion))
                {
                    AI.SelectOption(1);
                    return(true);
                }
                if (lastchaincard.HasType(CardType.Synchro))
                {
                    AI.SelectOption(2);
                    return(true);
                }
                if (lastchaincard.HasType(CardType.Xyz))
                {
                    AI.SelectOption(3);
                    return(true);
                }
                if (lastchaincard.IsFusionSpell())
                {
                    AI.SelectOption(1);
                    return(true);
                }
            }
            foreach (ClientCard card in Duel.ChainTargets)
            {
                if (Card.Equals(card))
                {
                    AI.SelectOption(3);
                    return(true);
                }
            }
            return(false);
        }
Exemplo n.º 23
0
        /// <summary>
        /// Clever enough.
        /// </summary>
        protected bool DefaultDimensionalBarrier()
        {
            const int RITUAL   = 0;
            const int FUSION   = 1;
            const int SYNCHRO  = 2;
            const int XYZ      = 3;
            const int PENDULUM = 4;

            if (Duel.Player != 0)
            {
                List <ClientCard> monsters = Enemy.GetMonsters();
                int[]             levels   = new int[13];
                bool tuner    = false;
                bool nontuner = false;
                foreach (ClientCard monster in monsters)
                {
                    if (monster.HasType(CardType.Tuner))
                    {
                        tuner = true;
                    }
                    else if (!monster.HasType(CardType.Xyz) && !monster.HasType(CardType.Link))
                    {
                        nontuner = true;
                        levels[monster.Level] = levels[monster.Level] + 1;
                    }

                    if (monster.IsOneForXyz())
                    {
                        AI.SelectOption(XYZ);
                        return(true);
                    }
                }
                if (tuner && nontuner)
                {
                    AI.SelectOption(SYNCHRO);
                    return(true);
                }
                for (int i = 1; i <= 12; i++)
                {
                    if (levels[i] > 1)
                    {
                        AI.SelectOption(XYZ);
                        return(true);
                    }
                }
                ClientCard l = Enemy.SpellZone[6];
                ClientCard r = Enemy.SpellZone[7];
                if (l != null && r != null && l.LScale != r.RScale)
                {
                    AI.SelectOption(PENDULUM);
                    return(true);
                }
            }
            ClientCard lastchaincard = Util.GetLastChainCard();

            if (Duel.LastChainPlayer == 1 && lastchaincard != null && !lastchaincard.IsDisabled())
            {
                if (lastchaincard.HasType(CardType.Ritual))
                {
                    AI.SelectOption(RITUAL);
                    return(true);
                }
                if (lastchaincard.HasType(CardType.Fusion))
                {
                    AI.SelectOption(FUSION);
                    return(true);
                }
                if (lastchaincard.HasType(CardType.Synchro))
                {
                    AI.SelectOption(SYNCHRO);
                    return(true);
                }
                if (lastchaincard.HasType(CardType.Xyz))
                {
                    AI.SelectOption(XYZ);
                    return(true);
                }
                if (lastchaincard.IsFusionSpell())
                {
                    AI.SelectOption(FUSION);
                    return(true);
                }
            }
            if (Util.IsChainTarget(Card))
            {
                AI.SelectOption(XYZ);
                return(true);
            }
            return(false);
        }
Exemplo n.º 24
0
        /// <summary>
        /// Decide whether to declare attack between attacker and defender.
        /// Can be overrided to update the RealPower of attacker for cards like Honest.
        /// </summary>
        /// <param name="attacker">Card that attack.</param>
        /// <param name="defender">Card that defend.</param>
        /// <returns>false if the attack shouldn't be done.</returns>
        public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
        {
            if (attacker.RealPower <= 0)
            {
                return(false);
            }

            if (!attacker.IsMonsterHasPreventActivationEffectInBattle())
            {
                if (defender.IsMonsterInvincible() && defender.IsDefense())
                {
                    return(false);
                }

                if (defender.IsMonsterDangerous())
                {
                    bool canIgnoreIt = !attacker.IsDisabled() && (
                        attacker.IsCode(_CardId.UltimateConductorTytanno) && defender.IsDefense() ||
                        attacker.IsCode(_CardId.ElShaddollConstruct) && defender.IsSpecialSummoned ||
                        attacker.IsCode(_CardId.AllyOfJusticeCatastor) && !defender.HasAttribute(CardAttribute.Dark));
                    if (!canIgnoreIt)
                    {
                        return(false);
                    }
                }

                foreach (ClientCard equip in defender.EquipCards)
                {
                    if (equip.IsCode(_CardId.MoonMirrorShield) && !equip.IsDisabled())
                    {
                        return(false);
                    }
                }

                if (!defender.IsDisabled())
                {
                    if (defender.IsCode(_CardId.MekkKnightCrusadiaAstram) && defender.IsAttack() && attacker.IsSpecialSummoned)
                    {
                        return(false);
                    }

                    if (defender.IsCode(_CardId.CrystalWingSynchroDragon) && defender.IsAttack() && attacker.Level >= 5)
                    {
                        return(false);
                    }

                    if (defender.IsCode(_CardId.AllyOfJusticeCatastor) && !attacker.HasAttribute(CardAttribute.Dark))
                    {
                        return(false);
                    }

                    if (defender.IsCode(_CardId.NumberS39UtopiaTheLightning) && defender.IsAttack() && defender.HasXyzMaterial(2, _CardId.Number39Utopia))
                    {
                        defender.RealPower = 5000;
                    }

                    if (defender.IsCode(_CardId.VampireFraeulein))
                    {
                        defender.RealPower += (Enemy.LifePoints > 3000) ? 3000 : (Enemy.LifePoints - 100);
                    }

                    if (defender.IsCode(_CardId.InjectionFairyLily) && Enemy.LifePoints > 2000)
                    {
                        defender.RealPower += 3000;
                    }
                }
            }

            if (!defender.IsMonsterHasPreventActivationEffectInBattle())
            {
                if (attacker.IsCode(_CardId.NumberS39UtopiaTheLightning) && !attacker.IsDisabled() && attacker.HasXyzMaterial(2, _CardId.Number39Utopia))
                {
                    attacker.RealPower = 5000;
                }

                foreach (ClientCard equip in attacker.EquipCards)
                {
                    if (equip.IsCode(_CardId.MoonMirrorShield) && !equip.IsDisabled())
                    {
                        attacker.RealPower = defender.RealPower + 100;
                    }
                }
            }

            if (Enemy.HasInMonstersZone(_CardId.MekkKnightCrusadiaAstram, true) && !(defender).IsCode(_CardId.MekkKnightCrusadiaAstram))
            {
                return(false);
            }

            if (Enemy.HasInMonstersZone(_CardId.DupeFrog, true) && !(defender).IsCode(_CardId.DupeFrog))
            {
                return(false);
            }

            if (Enemy.HasInMonstersZone(_CardId.MaraudingCaptain, true) && !defender.IsCode(_CardId.MaraudingCaptain) && defender.Race == (int)CardRace.Warrior)
            {
                return(false);
            }

            if (defender.IsCode(_CardId.UltimayaTzolkin) && !defender.IsDisabled() && Enemy.GetMonsters().Any(monster => !monster.Equals(defender) && monster.HasType(CardType.Synchro)))
            {
                return(false);
            }

            if (defender.OwnTargets.Any(card => card.IsCode(_CardId.PhantomKnightsFogBlade) && !card.IsDisabled()))
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 25
0
 /// <summary>
 /// Do this monster prevents activation of opponent's effect monsters in battle?
 /// </summary>
 public static bool IsMonsterHasPreventActivationEffectInBattle(this ClientCard card)
 {
     return(!card.IsDisabled() && Enum.IsDefined(typeof(PreventActivationEffectInBattle), card.Id));
 }
Exemplo n.º 26
0
 public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
 {
     if (attacker.IsCode(_CardId.EaterOfMillions) && (Bot.HasInMonstersZone(CardId.InspectBoarder) && eater_eff) && !attacker.IsDisabled())
     {
         attacker.RealPower = 9999;
         return(true);
     }
     if (attacker.IsCode(_CardId.EaterOfMillions) && !Bot.HasInMonstersZone(CardId.InspectBoarder) && !attacker.IsDisabled())
     {
         attacker.RealPower = 9999;
         return(true);
     }
     return(base.OnPreBattleBetween(attacker, defender));
 }
Exemplo n.º 27
0
 /// <summary>
 /// Is this monster is dangerous to attack?
 /// </summary>
 public static bool IsMonsterDangerous(this ClientCard card)
 {
     return(!card.IsDisabled() && Enum.IsDefined(typeof(DangerousMonster), card.Id));
 }
Exemplo n.º 28
0
        //苍穹 菲娜
        private bool CfeinaEffect()
        {
            ClientCard LastChainCard = base.Util.GetLastChainCard();
            bool       flag          = LastChainCard != null && LastChainCard.Location == CardLocation.MonsterZone && !LastChainCard.IsDisabled();
            bool       result;

            if (flag)
            {
                base.AI.SelectCard(CardId.Cmei);
                base.AI.SelectNextCard(LastChainCard);
                result = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }
Exemplo n.º 29
0
 /// <summary>
 /// Is this monster is invincible to battle?
 /// </summary>
 public static bool IsMonsterInvincible(this ClientCard card)
 {
     return(!card.IsDisabled() && Enum.IsDefined(typeof(InvincibleMonster), card.Id));
 }
Exemplo n.º 30
0
 public override BattlePhaseAction OnSelectAttackTarget(ClientCard attacker, IList <ClientCard> defenders)
 {
     for (int i = 0; i < defenders.Count; ++i)
     {
         ClientCard defender = defenders[i];
         attacker.RealPower = attacker.Attack;
         defender.RealPower = defender.GetDefensePower();
         if (defender.IsCode(732) && defender.IsAttack())
         {
             defender.RealPower = defender.Attack * 2;
         }
         if (attacker.IsCode(CardId.Number100Dragon, CardId.CNumber100Dragon, 592) && !attacker.IsDisabled())
         {
             defender.RealPower = 0;
         }
         if (defender.IsCode(CardId.Number100Dragon, CardId.CNumber100Dragon, 592) && !defender.IsDisabled())
         {
             attacker.RealPower = 0;
         }
         if (attacker.IsCode(13701) && attacker.RealPower < defender.RealPower && Bot.LifePoints > defender.RealPower - attacker.RealPower && Bot.HasInHand(13717) && Bot.HasInExtra(CardId.CNo1000) && Bot.Graveyard.GetMatchingCardsCount(card => card.HasSetcode(0x48) || card.IsCode(12201, 13706)) + Bot.Banished.GetMatchingCardsCount(card => (card.HasSetcode(0x48) || card.IsCode(12201, 13706)) && card.IsFaceup()) > 4)
         {
             return(AI.Attack(attacker, defender));
         }
         if (!OnPreBattleBetween(attacker, defender))
         {
             continue;
         }
         if (attacker.RealPower >= defender.RealPower || (attacker.RealPower >= defender.RealPower && ((attacker.HasSetcode(0x48) && !attacker.IsDisabled() && !(defender.HasSetcode(0x48) && !defender.IsDisabled())) || attacker.IsLastAttacker && defender.IsAttack())))
         {
             return(AI.Attack(attacker, defender));
         }
     }
     if (Enemy.GetMonsterCount() == 0 || attacker.CanDirectAttack)
     {
         return(AI.Attack(attacker, null));
     }
     return(null);
 }