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.º 2
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.º 3
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.º 4
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.º 5
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.º 6
0
        public override int OnAnnounceCard(IList <int> avail)
        {
            ClientCard orica           = Bot.GetFieldSpellCard();
            ClientCard last_chain_card = Util.GetLastChainCard();

            if (orica == null && avail.Contains(CardId.Oricha))
            {
                return(CardId.Oricha);
            }

            if (last_chain_card != null && last_chain_card.IsCode(CardId.CNo1000))
            {
                if ((Bot.MonsterZone.GetMonsters().ContainsCardWithId(CardId.CNumber100Dragon) || Bot.SpellZone.GetMonsters().ContainsCardWithId(CardId.CNumber100Dragon)))
                {
                    return(CardId.CNo1000);
                }
                return(CardId.CNumber100Dragon);
            }

            IList <ClientCard> last_cards = Bot.Graveyard.GetMatchingCards(card => card.Sequence == Bot.Graveyard.Count - 1);

            if (orica != null && orica.IsCode(CardId.Oricha) && last_chain_card != null && last_chain_card == orica)
            {
                if (ActivateDescription == Util.GetStringId(12744567, 0) || (ActivateDescription == -1 && !(orica.HasXyzMaterial(1, 13706))))
                {
                    if (!(orica.HasXyzMaterial(1, 13706)) && avail.Contains(13706))
                    {
                        return(13706);
                    }
                    else if (!(orica.HasXyzMaterial(1, 12)) && avail.Contains(12))
                    {
                        return(12);
                    }
                    else if (!(orica.HasXyzMaterial(1, 10)) && avail.Contains(10))
                    {
                        return(10);
                    }
                    else if (!(orica.HasXyzMaterial(1, 160000107)) && avail.Contains(160000107))
                    {
                        return(160000107);
                    }
                    else if (!(orica.HasXyzMaterial(1, 100000382)) && avail.Contains(100000382))
                    {
                        return(100000382);
                    }
                    else if (!(orica.HasXyzMaterial(1, 146)) && avail.Contains(146))
                    {
                        return(146);
                    }
                    else if (avail.Contains(11))
                    {
                        return(11);
                    }
                }

                if (last_cards.Count > 0)
                {
                    ClientCard last_card = last_cards[0];
                    if (last_card.IsCode(593))
                    {
                        return(CardId.No1000);
                    }
                    else if (last_card.IsCode(588))
                    {
                        return(CardId.CNo1000);
                    }
                    else
                    {
                        No1annouce++;
                        return(13701);
                    }
                }
            }

            return(Program.Rand.Next(avail.Count));
        }
Exemplo n.º 7
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.º 8
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);
        }
Exemplo n.º 9
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 = false;
                    if (attacker.Id == _CardId.UltimateConductorTytanno && !attacker.IsDisabled() && defender.IsDefense())
                    {
                        canignoreit = true;
                    }
                    if (!canignoreit)
                    {
                        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.Id == _CardId.VampireFräulein && !defender.IsDisabled())
                {
                    defender.RealPower += (Enemy.LifePoints > 3000) ? 3000 : (Enemy.LifePoints - 100);
                }

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

            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);
        }
Exemplo n.º 10
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.º 11
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());
 }