Esempio n. 1
0
        public ClientCard GetOneEnemyBetterThanValue(int value, bool onlyATK = false, bool canBeTarget = false)
        {
            ClientCard bestCard  = null;
            int        bestValue = value;

            for (int i = 0; i < 7; ++i)
            {
                ClientCard card = Enemy.MonsterZone[i];
                if (card == null || card.Data == null || (canBeTarget && card.IsShouldNotBeTarget()))
                {
                    continue;
                }
                if (onlyATK && card.IsDefense())
                {
                    continue;
                }
                int enemyValue = card.GetDefensePower();
                if (enemyValue >= bestValue)
                {
                    bestCard  = card;
                    bestValue = enemyValue;
                }
            }
            return(bestCard);
        }
Esempio n. 2
0
        public bool IsOneEnemyBetterThanValue(int value, bool onlyATK)
        {
            int  bestValue = -1;
            bool nomonster = true;

            for (int i = 0; i < 7; ++i)
            {
                ClientCard card = Enemy.MonsterZone[i];
                if (card == null || card.Data == null)
                {
                    continue;
                }
                if (onlyATK && card.IsDefense())
                {
                    continue;
                }
                nomonster = false;
                int enemyValue = card.GetDefensePower();
                if (enemyValue > bestValue)
                {
                    bestValue = enemyValue;
                }
            }
            if (nomonster)
            {
                return(false);
            }
            return(bestValue > value);
        }
Esempio n. 3
0
        public ClientCard GetBestBotMonster(bool onlyATK = false)
        {
            int        bestPower   = -1;
            ClientCard bestMonster = null;

            for (int i = 0; i < 7; ++i)
            {
                ClientCard card = Bot.MonsterZone[i];
                if (card == null || card.Data == null)
                {
                    continue;
                }
                if (onlyATK && card.IsDefense())
                {
                    continue;
                }
                int newPower = card.GetDefensePower();
                if (newPower > bestPower)
                {
                    bestPower   = newPower;
                    bestMonster = card;
                }
            }
            return(bestMonster);
        }
Esempio n. 4
0
        public ClientCard GetWorstEnemyMonster(bool onlyATK = false)
        {
            int        WorstPower   = -1;
            ClientCard WorstMonster = null;

            for (int i = 0; i < 7; ++i)
            {
                ClientCard card = Enemy.MonsterZone[i];
                if (card == null || card.Data == null)
                {
                    continue;
                }
                if (onlyATK && card.IsDefense())
                {
                    continue;
                }
                int newPower = card.GetDefensePower();
                if (newPower < WorstPower)
                {
                    WorstPower   = newPower;
                    WorstMonster = card;
                }
            }
            return(WorstMonster);
        }
Esempio n. 5
0
        public bool IsOneEnnemyBetterThanValue(int value, bool onlyatk)
        {
            int  bestValue = -1;
            bool nomonster = true;

            for (int i = 0; i < 5; ++i)
            {
                ClientCard card = Duel.Fields[1].MonsterZone[i];
                if (card == null)
                {
                    continue;
                }
                if (onlyatk && card.IsDefense())
                {
                    continue;
                }
                nomonster = false;
                int ennemyValue = card.GetDefensePower();
                if (ennemyValue > bestValue)
                {
                    bestValue = ennemyValue;
                }
            }
            if (nomonster)
            {
                return(false);
            }
            return(bestValue > value);
        }
Esempio n. 6
0
 public virtual bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
 {
     if (defender.IsMonsterInvincible())
     {
         if (defender.IsMonsterDangerous() || defender.IsDefense())
             return false;
     }
     return true;
 }
Esempio n. 7
0
 public virtual bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
 {
     if (defender.IsMonsterInvincible())
     {
         if (defender.IsMonsterDangerous() || defender.IsDefense())
         {
             return(false);
         }
     }
     return(true);
 }
Esempio n. 8
0
 public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
 {
     if (defender.IsMonsterInvincible())
     {
         if (defender.IsMonsterDangerous() || defender.IsDefense())
         {
             return(false);
         }
     }
     return(attacker.Attack > 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());
 }
Esempio 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.闪光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());
 }
Esempio n. 11
0
 public ClientCard GetOneEnnemyBetterThanValue(int value, bool onlyatk)
 {
     for (int i = 0; i < 7; ++i)
     {
         ClientCard card = Duel.Fields[1].MonsterZone[i];
         if (card == null)
         {
             continue;
         }
         if (onlyatk && card.IsDefense())
         {
             continue;
         }
         int ennemyValue = card.GetDefensePower();
         if (ennemyValue >= value)
         {
             return(card);
         }
     }
     return(null);
 }
Esempio 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.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());
 }
Esempio n. 13
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());
 }
Esempio 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.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());
 }
Esempio n. 15
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. 16
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. 17
0
        public bool IsAllEnnemyBetterThanValue(int value, bool onlyatk)
        {
            bool nomonster = true;

            for (int i = 0; i < 5; ++i)
            {
                ClientCard card = Duel.Fields[1].MonsterZone[i];
                if (card == null || card.Data == null)
                {
                    continue;
                }
                if (onlyatk && card.IsDefense())
                {
                    continue;
                }
                nomonster = false;
                int ennemyValue = card.GetDefensePower();
                if (ennemyValue <= value)
                {
                    return(false);
                }
            }
            return(!nomonster);
        }
Esempio n. 18
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);
        }
 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));
 }
Esempio n. 20
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);
        }
Esempio n. 21
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);
        }