Commit 36a6568b authored by nanahira's avatar nanahira

Merge branch 'master' of github.com:moecube/windbot

parents 1e5a7764 67ef67af
...@@ -178,4 +178,3 @@ AI_LV3 SUPPORT_NEW_MASTER_RULE ...@@ -178,4 +178,3 @@ AI_LV3 SUPPORT_NEW_MASTER_RULE
Name=彩音 Deck=DarkMagician Dialog=ayane.zh-CN Name=彩音 Deck=DarkMagician Dialog=ayane.zh-CN
黑魔术师卡组。 黑魔术师卡组。
AI_LV3 SUPPORT_NEW_MASTER_RULE AI_LV3 SUPPORT_NEW_MASTER_RULE
#created by ...
#main
93920420
5560911
4055337
4055337
98169343
61283655
57835716
57835716
57835716
28985331
21441617
4334811
90432163
36426778
14558127
14558127
73642296
73642296
23434538
23434538
23434538
9742784
32807846
63166095
63166095
73628505
81439173
24224830
24224830
24224830
25733157
52340444
35371948
35371948
35371948
90351981
98827725
25542642
25542642
703897
#extra
27548199
68431965
93854893
93854893
85289965
76145142
26692769
2857636
30741503
30741503
30741503
50588353
63288573
3679218
60303245
!side
82385847
82385847
78661338
78661338
78661338
34267821
34267821
34267821
18144506
37520316
37520316
37520316
43898403
43898403
43898403
#created by ygopro2
#main
97268402
97268402
97268402
94620082
94620082
94620082
26889158
26889158
26889158
89662401
14558127
14558127
20618081
56003780
52277807
52277807
52277807
23434538
23434538
23434538
16188701
16188701
16188701
52155219
52155219
52155219
24224830
24224830
24224830
81439174
18144507
1295111
14934922
51339637
51339637
10045474
10045474
10045474
41420027
41420027
#extra
6983839
87327776
87327776
87871125
87871125
87871125
31833038
14812471
14812471
14812471
41463182
41463182
48815792
2857636
85289965
!side
64178424
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
"我的超主流卡组需要{0}才能玩。" "我的超主流卡组需要{0}才能玩。"
], ],
"duelstart": [ "duelstart": [
"闪刀姬卡组测试中,渣操是正常情况,请多指教。", "自奏圣乐卡组测试中,渣操是正常情况,请多指教。",
"超主流是游戏王的一环,不爽不要玩。", "超主流是游戏王的一环,不爽不要玩。",
"抄主流是游戏王的一环,不爽不要玩。", "抄主流是游戏王的一环,不爽不要玩。",
"抄来的卡组不会用,怎么办?" "抄来的卡组不会用,怎么办?"
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
"出来吧,{0}!", "出来吧,{0}!",
"出现吧,{0}!", "出现吧,{0}!",
"我召唤了美丽的{0}!", "我召唤了美丽的{0}!",
"我召唤了强大的{0}!",
"我呼唤{0}参加战斗!", "我呼唤{0}参加战斗!",
"我呼唤出{0}。", "我呼唤出{0}。",
"让我召唤{0}。" "让我召唤{0}。"
......
{
"welcome": [
"今天又是谁来拜访本茶会啦?",
"最近茶会总是没有人,怎么办呢"
],
"deckerror": [
"我的超主流卡组需要{0}才能玩。"
],
"duelstart": [
"那么,本小姐要上啦!",
"本小姐没那么容易被打败的!",
"本小姐的牌技还是不错的!",
"大家为本小姐加油哦。"
],
"newturn": [
"到我的回合了,抽卡!",
"我的回合,抽卡!",
"我抽了一张卡。"
],
"endturn": [
"回合结束。",
"我的回合结束了。",
"轮到你啦!快点!",
"轮到你了。"
],
"directattack": [
"{0},直接攻击!",
"{0},给我上!",
"{0},给本小姐上!",
"{0},不要停,给我上!",
"{0},给我上,有糖吃。",
"{0},给我上,这局赢定啦!",
"对面没怪了?好,{0},给我上!"
],
"attack": [
"{0},给我打倒{1}!",
"{0},替本小姐打倒{1}!",
"{0},打倒{1}!",
"{0},冲向那只{1}!",
"{0},把你的力量释放到{1}上吧!"
],
"ondirectattack": [
"这么可怕的吗…",
"本小姐这次让你一回。",
"果然本小姐还是太弱了……"
],
"facedownmonstername": "怪兽",
"activate": [
"本小姐发动{0}。",
"本小姐使用{0}。"
],
"summon": [
"我召唤{0}。",
"本小姐召唤{0}。",
"出来吧,{0}!",
"出现吧,{0}!",
"给我出来,{0}!",
"给本小姐出来,{0}!"
],
"setmonster": [
"我放置了一只怪兽。",
"我里侧表示放置了一只怪兽。"
],
"chaining": [
"本小姐发动{0}!",
"本小姐使用{0}!",
"本小姐使用{0},惊喜吗?",
"送给你一个大惊喜。本小姐发动{0}!",
"没留意吧!本小姐要使用{0}了!"
]
}
using System.Collections.Generic; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using YGOSharp.OCGWrapper.Enums; using YGOSharp.OCGWrapper.Enums;
namespace WindBot.Game.AI namespace WindBot.Game.AI
{ {
public class AIFunctions public class AIUtil
{ {
public Duel Duel { get; private set; } public Duel Duel { get; private set; }
public ClientField Bot { get; private set; } public ClientField Bot { get; private set; }
public ClientField Enemy { get; private set; } public ClientField Enemy { get; private set; }
public AIFunctions(Duel duel) public AIUtil(Duel duel)
{ {
Duel = duel; Duel = duel;
Bot = Duel.Fields[0]; Bot = Duel.Fields[0];
Enemy = Duel.Fields[1]; Enemy = Duel.Fields[1];
} }
public static int CompareCardAttack(ClientCard cardA, ClientCard cardB)
{
if (cardA.Attack < cardB.Attack)
return -1;
if (cardA.Attack == cardB.Attack)
return 0;
return 1;
}
public static int CompareDefensePower(ClientCard cardA, ClientCard cardB)
{
if (cardA == null && cardB == null)
return 0;
if (cardA == null)
return -1;
if (cardB == null)
return 1;
int powerA = cardA.GetDefensePower();
int powerB = cardB.GetDefensePower();
if (powerA < powerB)
return -1;
if (powerA == powerB)
return 0;
return 1;
}
/// <summary> /// <summary>
/// Get the total ATK Monster of the player. /// Get the total ATK Monster of the player.
/// </summary> /// </summary>
...@@ -129,7 +104,7 @@ namespace WindBot.Game.AI ...@@ -129,7 +104,7 @@ namespace WindBot.Game.AI
public ClientCard GetOneEnemyBetterThanValue(int value, bool onlyATK = false, bool canBeTarget = false) public ClientCard GetOneEnemyBetterThanValue(int value, bool onlyATK = false, bool canBeTarget = false)
{ {
return Enemy.MonsterZone.GetMonsters() return Enemy.MonsterZone.GetMonsters()
.FirstOrDefault(card => card.GetDefensePower() > value && (!onlyATK || card.IsAttack()) && (!canBeTarget || !card.IsShouldNotBeTarget())); .FirstOrDefault(card => card.GetDefensePower() >= value && (!onlyATK || card.IsAttack()) && (!canBeTarget || !card.IsShouldNotBeTarget()));
} }
public ClientCard GetOneEnemyBetterThanMyBest(bool onlyATK = false, bool canBeTarget = false) public ClientCard GetOneEnemyBetterThanMyBest(bool onlyATK = false, bool canBeTarget = false)
...@@ -248,11 +223,11 @@ namespace WindBot.Game.AI ...@@ -248,11 +223,11 @@ namespace WindBot.Game.AI
{ {
if (Duel.IsNewRule) if (Duel.IsNewRule)
{ {
return Duel.Fields[player].SpellZone[id*4]; return Duel.Fields[player].SpellZone[id * 4];
} }
else else
{ {
return Duel.Fields[player].SpellZone[6+id]; return Duel.Fields[player].SpellZone[6 + id];
} }
} }
...@@ -266,57 +241,70 @@ namespace WindBot.Game.AI ...@@ -266,57 +241,70 @@ namespace WindBot.Game.AI
return Duel.Turn == 1 || Duel.Phase == DuelPhase.Main2; return Duel.Turn == 1 || Duel.Phase == DuelPhase.Main2;
} }
internal bool inListOrNull(ClientCard card, IList<ClientCard> list) public int GetBotAvailZonesFromExtraDeck(IList<ClientCard> remove)
{
ClientCard[] BotMZone = (ClientCard[])Bot.MonsterZone.Clone();
ClientCard[] EnemyMZone = (ClientCard[])Enemy.MonsterZone.Clone();
for (int i = 0; i < 7; i++)
{ {
return card == null || list.Contains(card); if (remove.Contains(BotMZone[i])) BotMZone[i] = null;
if (remove.Contains(EnemyMZone[i])) EnemyMZone[i] = null;
} }
public int GetBotAvailZonesFromExtraDeck(IList<ClientCard> remove)
{
if (!Duel.IsNewRule) if (!Duel.IsNewRule)
return Zones.MainMonsterZones; return Zones.MainMonsterZones;
int result = 0; int result = 0;
if (inListOrNull(Bot.MonsterZone[5], remove) && inListOrNull(Bot.MonsterZone[6], remove) && if (BotMZone[5] == null && BotMZone[6] == null)
(inListOrNull(Enemy.MonsterZone[5], remove) || inListOrNull(Enemy.MonsterZone[6], remove))) {
result |= Zones.ExtraMonsterZones; if (EnemyMZone[5] == null)
result |= Zones.z6;
if (inListOrNull(Bot.MonsterZone[0], remove) && if (EnemyMZone[6] == null)
(!inListOrNull(Bot.MonsterZone[1], remove) && Bot.MonsterZone[1].HasLinkMarker(CardLinkMarker.Left) || result |= Zones.z5;
!inListOrNull(Bot.MonsterZone[5], remove) && Bot.MonsterZone[5].HasLinkMarker(CardLinkMarker.BottomLeft) || }
!inListOrNull(Enemy.MonsterZone[6], remove) && Enemy.MonsterZone[6].HasLinkMarker(CardLinkMarker.TopRight)))
result += Zones.z0; if (BotMZone[0] == null &&
if (inListOrNull(Bot.MonsterZone[1], remove) && ((BotMZone[1]?.HasLinkMarker(CardLinkMarker.Left) ?? false) ||
(!inListOrNull(Bot.MonsterZone[0], remove) && Bot.MonsterZone[0].HasLinkMarker(CardLinkMarker.Right) || (BotMZone[5]?.HasLinkMarker(CardLinkMarker.BottomLeft) ?? false) ||
!inListOrNull(Bot.MonsterZone[2], remove) && Bot.MonsterZone[2].HasLinkMarker(CardLinkMarker.Left) || (EnemyMZone[6]?.HasLinkMarker(CardLinkMarker.TopRight) ?? false)))
!inListOrNull(Bot.MonsterZone[5], remove) && Bot.MonsterZone[5].HasLinkMarker(CardLinkMarker.Bottom) || result |= Zones.z0;
!inListOrNull(Enemy.MonsterZone[6], remove) && Enemy.MonsterZone[6].HasLinkMarker(CardLinkMarker.Top)))
result += Zones.z1; if (BotMZone[1] == null &&
if (inListOrNull(Bot.MonsterZone[2], remove) && ((BotMZone[0]?.HasLinkMarker(CardLinkMarker.Right) ?? false) ||
(!inListOrNull(Bot.MonsterZone[1], remove) && Bot.MonsterZone[1].HasLinkMarker(CardLinkMarker.Right) || (BotMZone[2]?.HasLinkMarker(CardLinkMarker.Left) ?? false) ||
!inListOrNull(Bot.MonsterZone[3], remove) && Bot.MonsterZone[3].HasLinkMarker(CardLinkMarker.Left) || (BotMZone[5]?.HasLinkMarker(CardLinkMarker.Bottom) ?? false) ||
!inListOrNull(Bot.MonsterZone[5], remove) && Bot.MonsterZone[5].HasLinkMarker(CardLinkMarker.BottomRight) || (EnemyMZone[6]?.HasLinkMarker(CardLinkMarker.Top) ?? false)))
!inListOrNull(Enemy.MonsterZone[6], remove) && Enemy.MonsterZone[6].HasLinkMarker(CardLinkMarker.TopLeft) || result |= Zones.z1;
!inListOrNull(Bot.MonsterZone[6], remove) && Bot.MonsterZone[6].HasLinkMarker(CardLinkMarker.BottomLeft) ||
!inListOrNull(Enemy.MonsterZone[5], remove) && Enemy.MonsterZone[5].HasLinkMarker(CardLinkMarker.TopRight))) if (BotMZone[2] == null &&
result += Zones.z2; ((BotMZone[1]?.HasLinkMarker(CardLinkMarker.Right) ?? false) ||
if (inListOrNull(Bot.MonsterZone[3], remove) && (BotMZone[3]?.HasLinkMarker(CardLinkMarker.Left) ?? false) ||
(!inListOrNull(Bot.MonsterZone[2], remove) && Bot.MonsterZone[2].HasLinkMarker(CardLinkMarker.Right) || (BotMZone[5]?.HasLinkMarker(CardLinkMarker.BottomRight) ?? false) ||
!inListOrNull(Bot.MonsterZone[4], remove) && Bot.MonsterZone[4].HasLinkMarker(CardLinkMarker.Left) || (EnemyMZone[6]?.HasLinkMarker(CardLinkMarker.TopLeft) ?? false) ||
!inListOrNull(Bot.MonsterZone[6], remove) && Bot.MonsterZone[6].HasLinkMarker(CardLinkMarker.Bottom) || (BotMZone[6]?.HasLinkMarker(CardLinkMarker.BottomLeft) ?? false) ||
!inListOrNull(Enemy.MonsterZone[5], remove) && Enemy.MonsterZone[5].HasLinkMarker(CardLinkMarker.Top))) (EnemyMZone[5]?.HasLinkMarker(CardLinkMarker.TopRight) ?? false)))
result += Zones.z3; result |= Zones.z2;
if (inListOrNull(Bot.MonsterZone[4], remove) &&
(!inListOrNull(Bot.MonsterZone[3], remove) && Bot.MonsterZone[3].HasLinkMarker(CardLinkMarker.Right) || if (BotMZone[3] == null &&
!inListOrNull(Bot.MonsterZone[6], remove) && Bot.MonsterZone[6].HasLinkMarker(CardLinkMarker.BottomRight) || ((BotMZone[2]?.HasLinkMarker(CardLinkMarker.Right) ?? false) ||
!inListOrNull(Enemy.MonsterZone[5], remove) && Enemy.MonsterZone[5].HasLinkMarker(CardLinkMarker.TopLeft))) (BotMZone[4]?.HasLinkMarker(CardLinkMarker.Left) ?? false) ||
result += Zones.z4; (BotMZone[6]?.HasLinkMarker(CardLinkMarker.Bottom) ?? false) ||
(EnemyMZone[5]?.HasLinkMarker(CardLinkMarker.Top) ?? false)))
result |= Zones.z3;
if (BotMZone[4] == null &&
((BotMZone[3]?.HasLinkMarker(CardLinkMarker.Right) ?? false) ||
(BotMZone[6]?.HasLinkMarker(CardLinkMarker.BottomRight) ?? false) ||
(EnemyMZone[5]?.HasLinkMarker(CardLinkMarker.TopLeft) ?? false)))
result |= Zones.z4;
return result; return result;
} }
public int GetBotAvailZonesFromExtraDeck(ClientCard remove) public int GetBotAvailZonesFromExtraDeck(ClientCard remove)
{ {
return GetBotAvailZonesFromExtraDeck(new [] { remove }); return GetBotAvailZonesFromExtraDeck(new[] { remove });
} }
public int GetBotAvailZonesFromExtraDeck() public int GetBotAvailZonesFromExtraDeck()
......
...@@ -7,6 +7,41 @@ namespace WindBot.Game.AI ...@@ -7,6 +7,41 @@ namespace WindBot.Game.AI
{ {
public static class CardContainer public static class CardContainer
{ {
public static int CompareCardAttack(ClientCard cardA, ClientCard cardB)
{
if (cardA.Attack < cardB.Attack)
return -1;
if (cardA.Attack == cardB.Attack)
return 0;
return 1;
}
public static int CompareCardLevel(ClientCard cardA, ClientCard cardB)
{
if (cardA.Level < cardB.Level)
return -1;
if (cardA.Level == cardB.Level)
return 0;
return 1;
}
public static int CompareDefensePower(ClientCard cardA, ClientCard cardB)
{
if (cardA == null && cardB == null)
return 0;
if (cardA == null)
return -1;
if (cardB == null)
return 1;
int powerA = cardA.GetDefensePower();
int powerB = cardB.GetDefensePower();
if (powerA < powerB)
return -1;
if (powerA == powerB)
return 0;
return 1;
}
public static ClientCard GetHighestAttackMonster(this IEnumerable<ClientCard> cards, bool canBeTarget = false) public static ClientCard GetHighestAttackMonster(this IEnumerable<ClientCard> cards, bool canBeTarget = false)
{ {
return cards return cards
...@@ -90,6 +125,21 @@ namespace WindBot.Game.AI ...@@ -90,6 +125,21 @@ namespace WindBot.Game.AI
return cards.FirstOrDefault(card => card?.Data != null && card.IsFaceup() && filter.Invoke(card)); return cards.FirstOrDefault(card => card?.Data != null && card.IsFaceup() && filter.Invoke(card));
} }
public static IList<ClientCard> GetMatchingCards(this IEnumerable<ClientCard> cards, Func<ClientCard, bool> filter)
{
return cards.Where(card => card?.Data != null && filter.Invoke(card)).ToList();
}
public static int GetMatchingCardsCount(this IEnumerable<ClientCard> cards, Func<ClientCard, bool> filter)
{
return cards.Count(card => card?.Data != null && filter.Invoke(card));
}
public static bool IsExistingMatchingCard(this IEnumerable<ClientCard> cards, Func<ClientCard, bool> filter, int count = 1)
{
return cards.GetMatchingCardsCount(filter) >= count;
}
public static ClientCard GetShouldBeDisabledBeforeItUseEffectMonster(this IEnumerable<ClientCard> cards, bool canBeTarget = true) public static ClientCard GetShouldBeDisabledBeforeItUseEffectMonster(this IEnumerable<ClientCard> cards, bool canBeTarget = true)
{ {
return cards.FirstOrDefault(card => card?.Data != null && card.IsMonsterShouldBeDisabledBeforeItUseEffect() && card.IsFaceup() && (!canBeTarget || !card.IsShouldNotBeTarget())); return cards.FirstOrDefault(card => card?.Data != null && card.IsMonsterShouldBeDisabledBeforeItUseEffect() && card.IsFaceup() && (!canBeTarget || !card.IsShouldNotBeTarget()));
......
This diff is collapsed.
...@@ -93,7 +93,7 @@ namespace WindBot.Game.AI.Decks ...@@ -93,7 +93,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Card.Location == CardLocation.Hand && Bot.HasInSpellZone(Card.Id)) if (Card.Location == CardLocation.Hand && Bot.HasInSpellZone(Card.Id))
return false; return false;
if (ActivateDescription == AI.Utils.GetStringId((int)Card.Id,0)) if (ActivateDescription == Util.GetStringId((int)Card.Id,0))
AI.SelectCard(CardId.GaleTheWhirlwind); AI.SelectCard(CardId.GaleTheWhirlwind);
return true; return true;
} }
......
...@@ -143,7 +143,7 @@ namespace WindBot.Game.AI.Decks ...@@ -143,7 +143,7 @@ namespace WindBot.Game.AI.Decks
if (!Bot.HasInHand(CardId.WhiteDragon)) if (!Bot.HasInHand(CardId.WhiteDragon))
result.AddRange(cards.Where(card => card.IsCode(CardId.WhiteDragon)).Take(1)); result.AddRange(cards.Where(card => card.IsCode(CardId.WhiteDragon)).Take(1));
result.AddRange(cards.Where(card => card.IsCode(CardId.AlternativeWhiteDragon))); result.AddRange(cards.Where(card => card.IsCode(CardId.AlternativeWhiteDragon)));
return AI.Utils.CheckSelectCount(result, cards, min, max); return Util.CheckSelectCount(result, cards, min, max);
} }
Logger.DebugWriteLine("Use default."); Logger.DebugWriteLine("Use default.");
return null; return null;
...@@ -152,8 +152,8 @@ namespace WindBot.Game.AI.Decks ...@@ -152,8 +152,8 @@ namespace WindBot.Game.AI.Decks
public override IList<ClientCard> OnSelectXyzMaterial(IList<ClientCard> cards, int min, int max) public override IList<ClientCard> OnSelectXyzMaterial(IList<ClientCard> cards, int min, int max)
{ {
Logger.DebugWriteLine("OnSelectXyzMaterial " + cards.Count + " " + min + " " + max); Logger.DebugWriteLine("OnSelectXyzMaterial " + cards.Count + " " + min + " " + max);
IList<ClientCard> result = AI.Utils.SelectPreferredCards(UsedAlternativeWhiteDragon, cards, min, max); IList<ClientCard> result = Util.SelectPreferredCards(UsedAlternativeWhiteDragon, cards, min, max);
return AI.Utils.CheckSelectCount(result, cards, min, max); return Util.CheckSelectCount(result, cards, min, max);
} }
public override IList<ClientCard> OnSelectSynchroMaterial(IList<ClientCard> cards, int sum, int min, int max) public override IList<ClientCard> OnSelectSynchroMaterial(IList<ClientCard> cards, int sum, int min, int max)
...@@ -259,16 +259,24 @@ namespace WindBot.Game.AI.Decks ...@@ -259,16 +259,24 @@ namespace WindBot.Game.AI.Decks
private bool AlternativeWhiteDragonEffect() private bool AlternativeWhiteDragonEffect()
{ {
ClientCard target = AI.Utils.GetProblematicEnemyMonster(Card.GetDefensePower()); ClientCard target = Util.GetProblematicEnemyMonster(Card.GetDefensePower());
if (target != null) if (target != null)
{ {
AI.SelectCard(target); AI.SelectCard(target);
UsedAlternativeWhiteDragon.Add(Card); UsedAlternativeWhiteDragon.Add(Card);
return true; return true;
} }
if (CanDealWithUsedAlternativeWhiteDragon()) if (Util.GetBotAvailZonesFromExtraDeck(Card) > 0
&& (Bot.HasInMonstersZone(new[]
{ {
target = AI.Utils.GetBestEnemyMonster(false, true); CardId.SageWithEyesOfBlue,
CardId.WhiteStoneOfAncients,
CardId.WhiteStoneOfLegend,
CardId.WhiteDragon,
CardId.DragonSpiritOfWhite
}) || Bot.GetCountCardInZone(Bot.MonsterZone, CardId.AlternativeWhiteDragon) >= 2))
{
target = Util.GetBestEnemyMonster(false, true);
AI.SelectCard(target); AI.SelectCard(target);
UsedAlternativeWhiteDragon.Add(Card); UsedAlternativeWhiteDragon.Add(Card);
return true; return true;
...@@ -389,7 +397,7 @@ namespace WindBot.Game.AI.Decks ...@@ -389,7 +397,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (ActivateDescription == -1) if (ActivateDescription == -1)
{ {
ClientCard target = AI.Utils.GetBestEnemySpell(); ClientCard target = Util.GetBestEnemySpell();
AI.SelectCard(target); AI.SelectCard(target);
return true; return true;
} }
...@@ -405,7 +413,7 @@ namespace WindBot.Game.AI.Decks ...@@ -405,7 +413,7 @@ namespace WindBot.Game.AI.Decks
&& !Bot.HasInGraveyard(CardId.DragonSpiritOfWhite) && !Bot.HasInGraveyard(CardId.DragonSpiritOfWhite)
&& !Bot.HasInGraveyard(CardId.WhiteDragon); && !Bot.HasInGraveyard(CardId.WhiteDragon);
} }
if (AI.Utils.IsChainTarget(Card)) if (Util.IsChainTarget(Card))
{ {
return true; return true;
} }
...@@ -415,7 +423,7 @@ namespace WindBot.Game.AI.Decks ...@@ -415,7 +423,7 @@ namespace WindBot.Game.AI.Decks
private bool BlueEyesSpiritDragonEffect() private bool BlueEyesSpiritDragonEffect()
{ {
if (ActivateDescription == -1 || ActivateDescription == AI.Utils.GetStringId(CardId.BlueEyesSpiritDragon, 0)) if (ActivateDescription == -1 || ActivateDescription == Util.GetStringId(CardId.BlueEyesSpiritDragon, 0))
{ {
return Duel.LastChainPlayer == 1; return Duel.LastChainPlayer == 1;
} }
...@@ -426,7 +434,7 @@ namespace WindBot.Game.AI.Decks ...@@ -426,7 +434,7 @@ namespace WindBot.Game.AI.Decks
} }
else else
{ {
if (AI.Utils.IsChainTarget(Card)) if (Util.IsChainTarget(Card))
{ {
AI.SelectCard(CardId.AzureEyesSilverDragon); AI.SelectCard(CardId.AzureEyesSilverDragon);
return true; return true;
...@@ -437,7 +445,7 @@ namespace WindBot.Game.AI.Decks ...@@ -437,7 +445,7 @@ namespace WindBot.Game.AI.Decks
private bool HopeHarbingerDragonTitanicGalaxyEffect() private bool HopeHarbingerDragonTitanicGalaxyEffect()
{ {
if (ActivateDescription == -1 || ActivateDescription == AI.Utils.GetStringId(CardId.HopeHarbingerDragonTitanicGalaxy, 0)) if (ActivateDescription == -1 || ActivateDescription == Util.GetStringId(CardId.HopeHarbingerDragonTitanicGalaxy, 0))
{ {
return Duel.LastChainPlayer == 1; return Duel.LastChainPlayer == 1;
} }
...@@ -446,7 +454,7 @@ namespace WindBot.Game.AI.Decks ...@@ -446,7 +454,7 @@ namespace WindBot.Game.AI.Decks
private bool WhiteStoneOfAncientsEffect() private bool WhiteStoneOfAncientsEffect()
{ {
if (ActivateDescription == AI.Utils.GetStringId(CardId.WhiteStoneOfAncients, 0)) if (ActivateDescription == Util.GetStringId(CardId.WhiteStoneOfAncients, 0))
{ {
if (Bot.HasInHand(CardId.TradeIn) if (Bot.HasInHand(CardId.TradeIn)
&& !Bot.HasInHand(CardId.WhiteDragon) && !Bot.HasInHand(CardId.WhiteDragon)
...@@ -538,7 +546,7 @@ namespace WindBot.Game.AI.Decks ...@@ -538,7 +546,7 @@ namespace WindBot.Game.AI.Decks
{ {
return false; return false;
} }
if (AI.Utils.IsOneEnemyBetterThanValue(2999, false)) if (Util.IsOneEnemyBetterThanValue(2999, false))
{ {
return true; return true;
} }
...@@ -561,7 +569,7 @@ namespace WindBot.Game.AI.Decks ...@@ -561,7 +569,7 @@ namespace WindBot.Game.AI.Decks
} }
if (Bot.HasInMonstersZone(CardId.GalaxyEyesPrimePhotonDragon)) if (Bot.HasInMonstersZone(CardId.GalaxyEyesPrimePhotonDragon))
{ {
if (!AI.Utils.IsOneEnemyBetterThanValue(4000, false)) if (!Util.IsOneEnemyBetterThanValue(4000, false))
{ {
AI.SelectCard(CardId.GalaxyEyesPrimePhotonDragon); AI.SelectCard(CardId.GalaxyEyesPrimePhotonDragon);
return true; return true;
...@@ -572,7 +580,7 @@ namespace WindBot.Game.AI.Decks ...@@ -572,7 +580,7 @@ namespace WindBot.Game.AI.Decks
private bool GalaxyEyesCipherBladeDragonSummon() private bool GalaxyEyesCipherBladeDragonSummon()
{ {
if (Bot.HasInMonstersZone(CardId.GalaxyEyesFullArmorPhotonDragon) && AI.Utils.GetProblematicEnemyCard() != null) if (Bot.HasInMonstersZone(CardId.GalaxyEyesFullArmorPhotonDragon) && Util.GetProblematicEnemyCard() != null)
{ {
AI.SelectCard(CardId.GalaxyEyesFullArmorPhotonDragon); AI.SelectCard(CardId.GalaxyEyesFullArmorPhotonDragon);
return true; return true;
...@@ -622,13 +630,13 @@ namespace WindBot.Game.AI.Decks ...@@ -622,13 +630,13 @@ namespace WindBot.Game.AI.Decks
private bool GalaxyEyesFullArmorPhotonDragonEffect() private bool GalaxyEyesFullArmorPhotonDragonEffect()
{ {
ClientCard target = AI.Utils.GetProblematicEnemySpell(); ClientCard target = Util.GetProblematicEnemySpell();
if (target != null) if (target != null)
{ {
AI.SelectCard(target); AI.SelectCard(target);
return true; return true;
} }
target = AI.Utils.GetProblematicEnemyMonster(); target = Util.GetProblematicEnemyMonster();
if (target != null) if (target != null)
{ {
AI.SelectCard(target); AI.SelectCard(target);
...@@ -679,7 +687,7 @@ namespace WindBot.Game.AI.Decks ...@@ -679,7 +687,7 @@ namespace WindBot.Game.AI.Decks
{ {
return true; return true;
} }
ClientCard target = AI.Utils.GetProblematicEnemyCard(); ClientCard target = Util.GetProblematicEnemyCard();
if (target != null) if (target != null)
{ {
AI.SelectCard(target); AI.SelectCard(target);
...@@ -737,8 +745,8 @@ namespace WindBot.Game.AI.Decks ...@@ -737,8 +745,8 @@ namespace WindBot.Game.AI.Decks
{ {
if (Duel.Phase != DuelPhase.Main1 || Duel.Turn == 1 || SoulChargeUsed) if (Duel.Phase != DuelPhase.Main1 || Duel.Turn == 1 || SoulChargeUsed)
return false; return false;
int bestSelfAttack = AI.Utils.GetBestAttack(Bot); int bestSelfAttack = Util.GetBestAttack(Bot);
int bestEnemyAttack = AI.Utils.GetBestPower(Enemy); int bestEnemyAttack = Util.GetBestPower(Enemy);
return bestSelfAttack <= bestEnemyAttack && bestEnemyAttack > 2500 && bestEnemyAttack <= 3100; return bestSelfAttack <= bestEnemyAttack && bestEnemyAttack > 2500 && bestEnemyAttack <= 3100;
} }
...@@ -856,7 +864,7 @@ namespace WindBot.Game.AI.Decks ...@@ -856,7 +864,7 @@ namespace WindBot.Game.AI.Decks
private bool Repos() private bool Repos()
{ {
bool enemyBetter = AI.Utils.IsAllEnemyBetter(true); bool enemyBetter = Util.IsAllEnemyBetter(true);
if (Card.IsAttack() && enemyBetter) if (Card.IsAttack() && enemyBetter)
return true; return true;
...@@ -887,18 +895,6 @@ namespace WindBot.Game.AI.Decks ...@@ -887,18 +895,6 @@ namespace WindBot.Game.AI.Decks
return num >= 2; return num >= 2;
} }
private bool CanDealWithUsedAlternativeWhiteDragon()
{
return Bot.HasInMonstersZone(new[]
{
CardId.SageWithEyesOfBlue,
CardId.WhiteStoneOfAncients,
CardId.WhiteStoneOfLegend,
CardId.WhiteDragon,
CardId.DragonSpiritOfWhite
}) || Bot.GetCountCardInZone(Bot.MonsterZone, CardId.AlternativeWhiteDragon)>=2 ;
}
private bool HaveEnoughWhiteDragonInHand() private bool HaveEnoughWhiteDragonInHand()
{ {
return HasTwoInHand(CardId.WhiteDragon) || ( return HasTwoInHand(CardId.WhiteDragon) || (
......
...@@ -128,32 +128,32 @@ namespace WindBot.Game.AI.Decks ...@@ -128,32 +128,32 @@ namespace WindBot.Game.AI.Decks
{ {
if(Duel.LastChainPlayer==1) if(Duel.LastChainPlayer==1)
{ {
ClientCard lastCard = AI.Utils.GetLastChainCard(); ClientCard lastCard = Util.GetLastChainCard();
if (lastCard.IsCode(CardId.MaxxC)) if (lastCard.IsCode(CardId.MaxxC))
{ {
AI.SelectCard(CardId.MaxxC); AI.SelectCard(CardId.MaxxC);
if(AI.Utils.ChainContainsCard(CardId.TheMelodyOfAwakeningDragon)) if(Util.ChainContainsCard(CardId.TheMelodyOfAwakeningDragon))
AI.SelectNextCard(CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesAlternativeWhiteDragon); AI.SelectNextCard(CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesAlternativeWhiteDragon);
return UniqueFaceupSpell(); return UniqueFaceupSpell();
} }
if (lastCard.IsCode(CardId.LockBird)) if (lastCard.IsCode(CardId.LockBird))
{ {
AI.SelectCard(CardId.LockBird); AI.SelectCard(CardId.LockBird);
if (AI.Utils.ChainContainsCard(CardId.TheMelodyOfAwakeningDragon)) if (Util.ChainContainsCard(CardId.TheMelodyOfAwakeningDragon))
AI.SelectNextCard(CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesAlternativeWhiteDragon); AI.SelectNextCard(CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesAlternativeWhiteDragon);
return UniqueFaceupSpell(); return UniqueFaceupSpell();
} }
if (lastCard.IsCode(CardId.Ghost)) if (lastCard.IsCode(CardId.Ghost))
{ {
AI.SelectCard(CardId.Ghost); AI.SelectCard(CardId.Ghost);
if (AI.Utils.ChainContainsCard(CardId.TheMelodyOfAwakeningDragon)) if (Util.ChainContainsCard(CardId.TheMelodyOfAwakeningDragon))
AI.SelectNextCard(CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesAlternativeWhiteDragon); AI.SelectNextCard(CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesAlternativeWhiteDragon);
return UniqueFaceupSpell(); return UniqueFaceupSpell();
} }
if (lastCard.IsCode(CardId.AshBlossom)) if (lastCard.IsCode(CardId.AshBlossom))
{ {
AI.SelectCard(CardId.AshBlossom); AI.SelectCard(CardId.AshBlossom);
if (AI.Utils.ChainContainsCard(CardId.TheMelodyOfAwakeningDragon)) if (Util.ChainContainsCard(CardId.TheMelodyOfAwakeningDragon))
AI.SelectNextCard(CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesAlternativeWhiteDragon); AI.SelectNextCard(CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesAlternativeWhiteDragon);
return UniqueFaceupSpell(); return UniqueFaceupSpell();
} }
...@@ -170,9 +170,9 @@ namespace WindBot.Game.AI.Decks ...@@ -170,9 +170,9 @@ namespace WindBot.Game.AI.Decks
} }
else else
{ {
if(AI.Utils.GetProblematicEnemyMonster(3000,true)!=null) if(Util.GetProblematicEnemyMonster(3000,true)!=null)
{ {
AI.SelectCard(AI.Utils.GetProblematicEnemyMonster(3000, true)); AI.SelectCard(Util.GetProblematicEnemyMonster(3000, true));
return true; return true;
} }
} }
...@@ -464,7 +464,7 @@ namespace WindBot.Game.AI.Decks ...@@ -464,7 +464,7 @@ namespace WindBot.Game.AI.Decks
private bool Linkuriboheff() private bool Linkuriboheff()
{ {
if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard().IsCode(CardId.Linkuriboh)) return false; if (Duel.LastChainPlayer == 0 && Util.GetLastChainCard().IsCode(CardId.Linkuriboh)) return false;
return true; return true;
} }
private bool BirrelswordDragonsp() private bool BirrelswordDragonsp()
...@@ -498,11 +498,11 @@ namespace WindBot.Game.AI.Decks ...@@ -498,11 +498,11 @@ namespace WindBot.Game.AI.Decks
private bool BirrelswordDragoneff() private bool BirrelswordDragoneff()
{ {
if (ActivateDescription == AI.Utils.GetStringId(CardId.BirrelswordDragon, 0)) if (ActivateDescription == Util.GetStringId(CardId.BirrelswordDragon, 0))
{ {
if (AI.Utils.IsChainTarget(Card) && AI.Utils.GetBestEnemyMonster(true, true) != null) if (Util.IsChainTarget(Card) && Util.GetBestEnemyMonster(true, true) != null)
{ {
AI.SelectCard(AI.Utils.GetBestEnemyMonster(true, true)); AI.SelectCard(Util.GetBestEnemyMonster(true, true));
return true; return true;
} }
if (Duel.Player == 1 && Bot.BattlingMonster == Card) if (Duel.Player == 1 && Bot.BattlingMonster == Card)
......
...@@ -415,7 +415,7 @@ namespace WindBot.Game.AI.Decks ...@@ -415,7 +415,7 @@ namespace WindBot.Game.AI.Decks
private bool must_chain() private bool must_chain()
{ {
if (AI.Utils.IsChainTarget(Card)) return true; if (Util.IsChainTarget(Card)) return true;
foreach (ClientCard card in Enemy.GetSpells()) foreach (ClientCard card in Enemy.GetSpells())
{ {
if (card.IsCode(CardId.HarpiesFeatherDuster)&&card.IsFaceup()) if (card.IsCode(CardId.HarpiesFeatherDuster)&&card.IsFaceup())
...@@ -509,7 +509,7 @@ namespace WindBot.Game.AI.Decks ...@@ -509,7 +509,7 @@ namespace WindBot.Game.AI.Decks
} }
private bool BattleFadereff() private bool BattleFadereff()
{ {
if (AI.Utils.ChainContainsCard(CardId.BlazingMirrorForce) || AI.Utils.ChainContainsCard(CardId.MagicCylinder)) if (Util.ChainContainsCard(CardId.BlazingMirrorForce) || Util.ChainContainsCard(CardId.MagicCylinder))
return false; return false;
if (prevent_used || Duel.Player == 0) return false; if (prevent_used || Duel.Player == 0) return false;
AI.SelectPosition(CardPosition.FaceUpDefence); AI.SelectPosition(CardPosition.FaceUpDefence);
...@@ -545,11 +545,11 @@ namespace WindBot.Game.AI.Decks ...@@ -545,11 +545,11 @@ namespace WindBot.Game.AI.Decks
} }
public bool Ring_act() public bool Ring_act()
{ {
if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard() != null ) return false; if (Duel.LastChainPlayer == 0 && Util.GetLastChainCard() != null ) return false;
ClientCard target = AI.Utils.GetProblematicEnemyMonster(); ClientCard target = Util.GetProblematicEnemyMonster();
if (target == null && AI.Utils.IsChainTarget(Card)) if (target == null && Util.IsChainTarget(Card))
{ {
target = AI.Utils.GetBestEnemyMonster(true, true); target = Util.GetBestEnemyMonster(true, true);
} }
if (target != null) if (target != null)
{ {
...@@ -569,7 +569,7 @@ namespace WindBot.Game.AI.Decks ...@@ -569,7 +569,7 @@ namespace WindBot.Game.AI.Decks
count++; count++;
} }
bool Demiseused = AI.Utils.ChainContainsCard(CardId.CardOfDemise); bool Demiseused = Util.ChainContainsCard(CardId.CardOfDemise);
if (drawfirst) return UniqueFaceupSpell(); if (drawfirst) return UniqueFaceupSpell();
if (DefaultOnBecomeTarget() && count > 1) return true; if (DefaultOnBecomeTarget() && count > 1) return true;
if (Demiseused) return false; if (Demiseused) return false;
...@@ -724,8 +724,8 @@ namespace WindBot.Game.AI.Decks ...@@ -724,8 +724,8 @@ namespace WindBot.Game.AI.Decks
return true; return true;
if (GetTotalATK(newlist) / 2 >= Enemy.LifePoints && Bot.HasInSpellZone(CardId.BlazingMirrorForce)) if (GetTotalATK(newlist) / 2 >= Enemy.LifePoints && Bot.HasInSpellZone(CardId.BlazingMirrorForce))
return false; return false;
if (AI.Utils.GetLastChainCard() == null) return true; if (Util.GetLastChainCard() == null) return true;
if (AI.Utils.GetLastChainCard().IsCode(CardId.Linkuriboh)) return false; if (Util.GetLastChainCard().IsCode(CardId.Linkuriboh)) return false;
return true; return true;
} }
public bool MonsterRepos() public bool MonsterRepos()
......
...@@ -126,7 +126,7 @@ namespace WindBot.Game.AI.Decks ...@@ -126,7 +126,7 @@ namespace WindBot.Game.AI.Decks
private bool EvolutionBurstEffect() private bool EvolutionBurstEffect()
{ {
ClientCard bestMy = Bot.GetMonsters().GetHighestAttackMonster(); ClientCard bestMy = Bot.GetMonsters().GetHighestAttackMonster();
if (bestMy == null || !AI.Utils.IsOneEnemyBetterThanValue(bestMy.Attack, false)) if (bestMy == null || !Util.IsOneEnemyBetterThanValue(bestMy.Attack, false))
return false; return false;
else else
AI.SelectCard(Enemy.MonsterZone.GetHighestAttackMonster()); AI.SelectCard(Enemy.MonsterZone.GetHighestAttackMonster());
...@@ -142,7 +142,7 @@ namespace WindBot.Game.AI.Decks ...@@ -142,7 +142,7 @@ namespace WindBot.Game.AI.Decks
private bool ArmoredCybernSet() private bool ArmoredCybernSet()
{ {
if (CyberDragonInHand() && (Bot.GetMonsterCount() == 0 && Enemy.GetMonsterCount() != 0) || (Bot.HasInHand(CardId.CyberDragonDrei) || Bot.HasInHand(CardId.CyberPhoenix)) && !AI.Utils.IsOneEnemyBetterThanValue(1800,true)) if (CyberDragonInHand() && (Bot.GetMonsterCount() == 0 && Enemy.GetMonsterCount() != 0) || (Bot.HasInHand(CardId.CyberDragonDrei) || Bot.HasInHand(CardId.CyberPhoenix)) && !Util.IsOneEnemyBetterThanValue(1800,true))
return false; return false;
return true; return true;
} }
...@@ -151,7 +151,7 @@ namespace WindBot.Game.AI.Decks ...@@ -151,7 +151,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Bot.GetCountCardInZone(Bot.Hand, CardId.CyberDragon) + Bot.GetCountCardInZone(Bot.MonsterZone, CardId.CyberDragon) + Bot.GetCountCardInZone(Bot.MonsterZone, CardId.CyberDragonCore) >= 1 && Bot.HasInHand(CardId.Polymerization) || Bot.GetCountCardInZone(Bot.Hand, CardId.CyberDragon) + Bot.GetCountCardInZone(Bot.MonsterZone, CardId.CyberDragon) + Bot.GetCountCardInZone(Bot.Graveyard, CardId.CyberDragon) + Bot.GetCountCardInZone(Bot.Graveyard, CardId.CyberDragonCore) >= 1 && Bot.HasInHand(CardId.PowerBond)) if (Bot.GetCountCardInZone(Bot.Hand, CardId.CyberDragon) + Bot.GetCountCardInZone(Bot.MonsterZone, CardId.CyberDragon) + Bot.GetCountCardInZone(Bot.MonsterZone, CardId.CyberDragonCore) >= 1 && Bot.HasInHand(CardId.Polymerization) || Bot.GetCountCardInZone(Bot.Hand, CardId.CyberDragon) + Bot.GetCountCardInZone(Bot.MonsterZone, CardId.CyberDragon) + Bot.GetCountCardInZone(Bot.Graveyard, CardId.CyberDragon) + Bot.GetCountCardInZone(Bot.Graveyard, CardId.CyberDragonCore) >= 1 && Bot.HasInHand(CardId.PowerBond))
return true; return true;
if (CyberDragonInHand() && (Bot.GetMonsterCount() == 0 && Enemy.GetMonsterCount() != 0) || (Bot.HasInHand(CardId.CyberDragonDrei) || Bot.HasInHand(CardId.CyberPhoenix)) && !AI.Utils.IsOneEnemyBetterThanValue(1800, true)) if (CyberDragonInHand() && (Bot.GetMonsterCount() == 0 && Enemy.GetMonsterCount() != 0) || (Bot.HasInHand(CardId.CyberDragonDrei) || Bot.HasInHand(CardId.CyberPhoenix)) && !Util.IsOneEnemyBetterThanValue(1800, true))
return false; return false;
return true; return true;
} }
...@@ -167,8 +167,8 @@ namespace WindBot.Game.AI.Decks ...@@ -167,8 +167,8 @@ namespace WindBot.Game.AI.Decks
return true; return true;
else if (Card.Location == CardLocation.SpellZone) else if (Card.Location == CardLocation.SpellZone)
{ {
if (AI.Utils.IsOneEnemyBetterThanValue(Bot.GetMonsters().GetHighestAttackMonster().Attack, true)) if (Util.IsOneEnemyBetterThanValue(Bot.GetMonsters().GetHighestAttackMonster().Attack, true))
if (ActivateDescription == AI.Utils.GetStringId(CardId.ArmoredCybern, 2)) if (ActivateDescription == Util.GetStringId(CardId.ArmoredCybern, 2))
return true; return true;
return false; return false;
} }
......
This diff is collapsed.
...@@ -170,7 +170,7 @@ namespace WindBot.Game.AI.Decks ...@@ -170,7 +170,7 @@ namespace WindBot.Game.AI.Decks
break; break;
} }
} }
if (!hasRealMonster || AI.Utils.GetProblematicCard() != null)*/ if (!hasRealMonster || Util.GetProblematicCard() != null)*/
needId = CardId.DragunityDux; needId = CardId.DragunityDux;
} }
...@@ -200,7 +200,7 @@ namespace WindBot.Game.AI.Decks ...@@ -200,7 +200,7 @@ namespace WindBot.Game.AI.Decks
else else
option = 1; option = 1;
if (ActivateDescription != AI.Utils.GetStringId(CardId.DragonRavine, option)) if (ActivateDescription != Util.GetStringId(CardId.DragonRavine, option))
return false; return false;
AI.SelectCard(tributeId); AI.SelectCard(tributeId);
...@@ -253,8 +253,8 @@ namespace WindBot.Game.AI.Decks ...@@ -253,8 +253,8 @@ namespace WindBot.Game.AI.Decks
private bool MonsterReborn() private bool MonsterReborn()
{ {
List<ClientCard> cards = new List<ClientCard>(Bot.Graveyard); List<ClientCard> cards = new List<ClientCard>(Bot.Graveyard.GetMatchingCards(card => card.IsCanRevive()));
cards.Sort(AIFunctions.CompareCardAttack); cards.Sort(CardContainer.CompareCardAttack);
ClientCard selectedCard = null; ClientCard selectedCard = null;
for (int i = cards.Count - 1; i >= 0; --i) for (int i = cards.Count - 1; i >= 0; --i)
{ {
...@@ -269,8 +269,8 @@ namespace WindBot.Game.AI.Decks ...@@ -269,8 +269,8 @@ namespace WindBot.Game.AI.Decks
break; break;
} }
} }
cards = new List<ClientCard>(Enemy.Graveyard); cards = new List<ClientCard>(Enemy.Graveyard.GetMatchingCards(card => card.IsCanRevive()));
cards.Sort(AIFunctions.CompareCardAttack); cards.Sort(CardContainer.CompareCardAttack);
for (int i = cards.Count - 1; i >= 0; --i) for (int i = cards.Count - 1; i >= 0; --i)
{ {
ClientCard card = cards[i]; ClientCard card = cards[i];
...@@ -333,16 +333,16 @@ namespace WindBot.Game.AI.Decks ...@@ -333,16 +333,16 @@ namespace WindBot.Game.AI.Decks
private bool ScrapDragonSummon() private bool ScrapDragonSummon()
{ {
//if (AI.Utils.IsOneEnemyBetterThanValue(2500, true)) //if (Util.IsOneEnemyBetterThanValue(2500, true))
// return true; // return true;
ClientCard invincible = AI.Utils.GetProblematicEnemyCard(3000); ClientCard invincible = Util.GetProblematicEnemyCard(3000);
return invincible != null; return invincible != null;
} }
private bool ScrapDragonEffect() private bool ScrapDragonEffect()
{ {
ClientCard invincible = AI.Utils.GetProblematicEnemyCard(3000); ClientCard invincible = Util.GetProblematicEnemyCard(3000);
if (invincible == null && !AI.Utils.IsOneEnemyBetterThanValue(2800 - 1, false)) if (invincible == null && !Util.IsOneEnemyBetterThanValue(2800 - 1, false))
return false; return false;
int tributeId = -1; int tributeId = -1;
...@@ -362,7 +362,7 @@ namespace WindBot.Game.AI.Decks ...@@ -362,7 +362,7 @@ namespace WindBot.Game.AI.Decks
tributeId = CardId.DragonRavine; tributeId = CardId.DragonRavine;
List<ClientCard> monsters = Enemy.GetMonsters(); List<ClientCard> monsters = Enemy.GetMonsters();
monsters.Sort(AIFunctions.CompareCardAttack); monsters.Sort(CardContainer.CompareCardAttack);
ClientCard destroyCard = invincible; ClientCard destroyCard = invincible;
if (destroyCard == null) if (destroyCard == null)
...@@ -432,7 +432,7 @@ namespace WindBot.Game.AI.Decks ...@@ -432,7 +432,7 @@ namespace WindBot.Game.AI.Decks
|| Bot.HasInHand(CardId.DragunitySpearOfDestiny)) || Bot.HasInHand(CardId.DragunitySpearOfDestiny))
{ {
List<ClientCard> monster_sorted = Bot.GetMonsters(); List<ClientCard> monster_sorted = Bot.GetMonsters();
monster_sorted.Sort(AIFunctions.CompareCardAttack); monster_sorted.Sort(CardContainer.CompareCardAttack);
foreach (ClientCard monster in monster_sorted) foreach (ClientCard monster in monster_sorted)
{ {
AI.SelectMaterials(monster); AI.SelectMaterials(monster);
......
...@@ -87,7 +87,7 @@ namespace WindBot.Game.AI.Decks ...@@ -87,7 +87,7 @@ namespace WindBot.Game.AI.Decks
private bool SwapFrogSummon() private bool SwapFrogSummon()
{ {
int atk = Card.Attack + GetSpellBonus(); int atk = Card.Attack + GetSpellBonus();
if (AI.Utils.IsAllEnemyBetterThanValue(atk, true)) if (Util.IsAllEnemyBetterThanValue(atk, true))
return false; return false;
AI.SelectCard(CardId.Ronintoadin); AI.SelectCard(CardId.Ronintoadin);
...@@ -120,7 +120,7 @@ namespace WindBot.Game.AI.Decks ...@@ -120,7 +120,7 @@ namespace WindBot.Game.AI.Decks
{ {
m_flipFlopFrogSummoned = -1; m_flipFlopFrogSummoned = -1;
List<ClientCard> monsters = Enemy.GetMonsters(); List<ClientCard> monsters = Enemy.GetMonsters();
monsters.Sort(AIFunctions.CompareCardAttack); monsters.Sort(CardContainer.CompareCardAttack);
monsters.Reverse(); monsters.Reverse();
AI.SelectCard(monsters); AI.SelectCard(monsters);
return true; return true;
...@@ -144,7 +144,7 @@ namespace WindBot.Game.AI.Decks ...@@ -144,7 +144,7 @@ namespace WindBot.Game.AI.Decks
{ {
int atk = Card.Attack + GetSpellBonus(); int atk = Card.Attack + GetSpellBonus();
if (AI.Utils.IsOneEnemyBetterThanValue(atk, true)) if (Util.IsOneEnemyBetterThanValue(atk, true))
return false; return false;
if (Card.IsCode(CardId.SwapFrog)) if (Card.IsCode(CardId.SwapFrog))
...@@ -156,7 +156,7 @@ namespace WindBot.Game.AI.Decks ...@@ -156,7 +156,7 @@ namespace WindBot.Game.AI.Decks
{ {
List<int> cards = new List<int>(); List<int> cards = new List<int>();
if (AI.Utils.IsOneEnemyBetter()) if (Util.IsOneEnemyBetter())
{ {
cards.Add(CardId.FlipFlopFrog); cards.Add(CardId.FlipFlopFrog);
} }
...@@ -213,7 +213,7 @@ namespace WindBot.Game.AI.Decks ...@@ -213,7 +213,7 @@ namespace WindBot.Game.AI.Decks
if (Card.IsCode(CardId.DewdarkOfTheIceBarrier)) if (Card.IsCode(CardId.DewdarkOfTheIceBarrier))
return Card.IsDefense(); return Card.IsDefense();
bool enemyBetter = AI.Utils.IsOneEnemyBetterThanValue(Card.Attack + (Card.IsFacedown() ? GetSpellBonus() : 0), true); bool enemyBetter = Util.IsOneEnemyBetterThanValue(Card.Attack + (Card.IsFacedown() ? GetSpellBonus() : 0), true);
if (Card.Attack < 800) if (Card.Attack < 800)
enemyBetter = true; enemyBetter = true;
bool result = false; bool result = false;
......
...@@ -130,7 +130,7 @@ namespace WindBot.Game.AI.Decks ...@@ -130,7 +130,7 @@ namespace WindBot.Game.AI.Decks
private bool GravekeepersDescendantEffect() private bool GravekeepersDescendantEffect()
{ {
int bestatk = Bot.GetMonsters().GetHighestAttackMonster().Attack; int bestatk = Bot.GetMonsters().GetHighestAttackMonster().Attack;
if (AI.Utils.IsOneEnemyBetterThanValue(bestatk, true)) if (Util.IsOneEnemyBetterThanValue(bestatk, true))
{ {
AI.SelectCard(Enemy.GetMonsters().GetHighestAttackMonster()); AI.SelectCard(Enemy.GetMonsters().GetHighestAttackMonster());
return true; return true;
......
...@@ -183,14 +183,14 @@ namespace WindBot.Game.AI.Decks ...@@ -183,14 +183,14 @@ namespace WindBot.Game.AI.Decks
targets.Add(check); targets.Add(check);
} }
if (AI.Utils.GetPZone(1, 0) != null && AI.Utils.GetPZone(1, 0).Type == 16777218) if (Util.GetPZone(1, 0) != null && Util.GetPZone(1, 0).Type == 16777218)
{ {
targets.Add(AI.Utils.GetPZone(1, 0)); targets.Add(Util.GetPZone(1, 0));
} }
if (AI.Utils.GetPZone(1, 1) != null && AI.Utils.GetPZone(1, 1).Type == 16777218) if (Util.GetPZone(1, 1) != null && Util.GetPZone(1, 1).Type == 16777218)
{ {
targets.Add(AI.Utils.GetPZone(1, 1)); targets.Add(Util.GetPZone(1, 1));
} }
foreach (ClientCard check in Enemy.GetSpells()) foreach (ClientCard check in Enemy.GetSpells())
{ {
...@@ -208,9 +208,9 @@ namespace WindBot.Game.AI.Decks ...@@ -208,9 +208,9 @@ namespace WindBot.Game.AI.Decks
if (check.Type == 16777218) if (check.Type == 16777218)
count++; count++;
} }
if(AI.Utils.GetLastChainCard()!=null && if(Util.GetLastChainCard()!=null &&
(AI.Utils.GetLastChainCard().HasType(CardType.Continuous)|| (Util.GetLastChainCard().HasType(CardType.Continuous)||
AI.Utils.GetLastChainCard().HasType(CardType.Field) || count==2) && Util.GetLastChainCard().HasType(CardType.Field) || count==2) &&
Duel.LastChainPlayer==1) Duel.LastChainPlayer==1)
{ {
AI.SelectCard(targets); AI.SelectCard(targets);
...@@ -235,9 +235,9 @@ namespace WindBot.Game.AI.Decks ...@@ -235,9 +235,9 @@ namespace WindBot.Game.AI.Decks
} }
if(count==2) if(count==2)
{ {
if (AI.Utils.GetPZone(1, 1) != null && AI.Utils.GetPZone(1, 1).Type == 16777218) if (Util.GetPZone(1, 1) != null && Util.GetPZone(1, 1).Type == 16777218)
{ {
card=AI.Utils.GetPZone(1, 1); card=Util.GetPZone(1, 1);
} }
} }
...@@ -251,27 +251,27 @@ namespace WindBot.Game.AI.Decks ...@@ -251,27 +251,27 @@ namespace WindBot.Game.AI.Decks
private bool DarkBribeeff() private bool DarkBribeeff()
{ {
if (AI.Utils.GetLastChainCard()!=null && AI.Utils.GetLastChainCard().IsCode(CardId.UpstartGoblin)) if (Util.GetLastChainCard()!=null && Util.GetLastChainCard().IsCode(CardId.UpstartGoblin))
return false; return false;
return true; return true;
} }
private bool ImperialOrderfirst() private bool ImperialOrderfirst()
{ {
if (AI.Utils.GetLastChainCard() != null && AI.Utils.GetLastChainCard().IsCode(CardId.UpstartGoblin)) if (Util.GetLastChainCard() != null && Util.GetLastChainCard().IsCode(CardId.UpstartGoblin))
return false; return false;
return DefaultOnBecomeTarget() && AI.Utils.GetLastChainCard().HasType(CardType.Spell); return DefaultOnBecomeTarget() && Util.GetLastChainCard().HasType(CardType.Spell);
} }
private bool ImperialOrdereff() private bool ImperialOrdereff()
{ {
if (AI.Utils.GetLastChainCard() != null && AI.Utils.GetLastChainCard().IsCode(CardId.UpstartGoblin)) if (Util.GetLastChainCard() != null && Util.GetLastChainCard().IsCode(CardId.UpstartGoblin))
return false; return false;
if (Duel.LastChainPlayer == 1) if (Duel.LastChainPlayer == 1)
{ {
foreach(ClientCard check in Enemy.GetSpells()) foreach(ClientCard check in Enemy.GetSpells())
{ {
if (AI.Utils.GetLastChainCard() == check) if (Util.GetLastChainCard() == check)
return true; return true;
} }
} }
...@@ -284,7 +284,7 @@ namespace WindBot.Game.AI.Decks ...@@ -284,7 +284,7 @@ namespace WindBot.Game.AI.Decks
if(Enemy.BattlingMonster.Attack-Bot.LifePoints>=1000) if(Enemy.BattlingMonster.Attack-Bot.LifePoints>=1000)
return DefaultUniqueTrap(); return DefaultUniqueTrap();
} }
if (AI.Utils.GetTotalAttackingMonsterAttack(1) >= Bot.LifePoints) if (Util.GetTotalAttackingMonsterAttack(1) >= Bot.LifePoints)
return DefaultUniqueTrap(); return DefaultUniqueTrap();
if (Enemy.GetMonsterCount() >= 2) if (Enemy.GetMonsterCount() >= 2)
return DefaultUniqueTrap(); return DefaultUniqueTrap();
...@@ -307,7 +307,7 @@ namespace WindBot.Game.AI.Decks ...@@ -307,7 +307,7 @@ namespace WindBot.Game.AI.Decks
if (card.HasType(CardType.Monster)) if (card.HasType(CardType.Monster))
count++; count++;
} }
if(AI.Utils.GetBestEnemyMonster()!=null && AI.Utils.GetBestEnemyMonster().Attack>=1900) if(Util.GetBestEnemyMonster()!=null && Util.GetBestEnemyMonster().Attack>=1900)
AI.SelectCard( AI.SelectCard(
CardId.EaterOfMillions, CardId.EaterOfMillions,
CardId.PotOfDesires, CardId.PotOfDesires,
...@@ -473,7 +473,7 @@ namespace WindBot.Game.AI.Decks ...@@ -473,7 +473,7 @@ namespace WindBot.Game.AI.Decks
} }
return true; return true;
}; };
ClientCard BestEnemy = AI.Utils.GetBestEnemyMonster(true); ClientCard BestEnemy = Util.GetBestEnemyMonster(true);
ClientCard WorstBot = Bot.GetMonsters().GetLowestAttackMonster(); ClientCard WorstBot = Bot.GetMonsters().GetLowestAttackMonster();
if (BestEnemy == null || BestEnemy.HasPosition(CardPosition.FaceDown)) return false; if (BestEnemy == null || BestEnemy.HasPosition(CardPosition.FaceDown)) return false;
if (WorstBot == null || WorstBot.HasPosition(CardPosition.FaceDown)) return false; if (WorstBot == null || WorstBot.HasPosition(CardPosition.FaceDown)) return false;
...@@ -493,9 +493,9 @@ namespace WindBot.Game.AI.Decks ...@@ -493,9 +493,9 @@ namespace WindBot.Game.AI.Decks
AI.SelectPlace(Zones.z4); AI.SelectPlace(Zones.z4);
if (Enemy.HasInMonstersZone(CardId.KnightmareGryphon, true)) return false; if (Enemy.HasInMonstersZone(CardId.KnightmareGryphon, true)) return false;
if (Bot.HasInMonstersZone(CardId.InspectBoarder) && !eater_eff) return false; if (Bot.HasInMonstersZone(CardId.InspectBoarder) && !eater_eff) return false;
if (AI.Utils.GetProblematicEnemyMonster() == null && Bot.ExtraDeck.Count < 5) return false; if (Util.GetProblematicEnemyMonster() == null && Bot.ExtraDeck.Count < 5) return false;
if (Bot.GetMonstersInMainZone().Count >= 5) return false; if (Bot.GetMonstersInMainZone().Count >= 5) return false;
if (AI.Utils.IsTurn1OrMain2()) return false; if (Util.IsTurn1OrMain2()) return false;
AI.SelectPosition(CardPosition.FaceUpAttack); AI.SelectPosition(CardPosition.FaceUpAttack);
IList<ClientCard> targets = new List<ClientCard>(); IList<ClientCard> targets = new List<ClientCard>();
foreach (ClientCard e_c in Bot.ExtraDeck) foreach (ClientCard e_c in Bot.ExtraDeck)
...@@ -588,7 +588,7 @@ namespace WindBot.Game.AI.Decks ...@@ -588,7 +588,7 @@ namespace WindBot.Game.AI.Decks
private bool Linkuriboheff() private bool Linkuriboheff()
{ {
if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard().IsCode(CardId.Linkuriboh)) return false; if (Duel.LastChainPlayer == 0 && Util.GetLastChainCard().IsCode(CardId.Linkuriboh)) return false;
return true; return true;
} }
private bool MonsterRepos() private bool MonsterRepos()
......
...@@ -97,7 +97,7 @@ namespace WindBot.Game.AI.Decks ...@@ -97,7 +97,7 @@ namespace WindBot.Game.AI.Decks
return false; return false;
List<ClientCard> cards = new List<ClientCard>(Bot.Graveyard); List<ClientCard> cards = new List<ClientCard>(Bot.Graveyard);
cards.Sort(AIFunctions.CompareCardAttack); cards.Sort(CardContainer.CompareCardAttack);
for (int i = cards.Count - 1; i >= 0; --i) for (int i = cards.Count - 1; i >= 0; --i)
{ {
ClientCard card = cards[i]; ClientCard card = cards[i];
...@@ -114,8 +114,8 @@ namespace WindBot.Game.AI.Decks ...@@ -114,8 +114,8 @@ namespace WindBot.Game.AI.Decks
private bool MonsterReborn() private bool MonsterReborn()
{ {
List<ClientCard> cards = new List<ClientCard>(Bot.Graveyard); List<ClientCard> cards = new List<ClientCard>(Bot.Graveyard.GetMatchingCards(card => card.IsCanRevive()));
cards.Sort(AIFunctions.CompareCardAttack); cards.Sort(CardContainer.CompareCardAttack);
ClientCard selectedCard = null; ClientCard selectedCard = null;
for (int i = cards.Count - 1; i >= 0; --i) for (int i = cards.Count - 1; i >= 0; --i)
{ {
...@@ -128,8 +128,8 @@ namespace WindBot.Game.AI.Decks ...@@ -128,8 +128,8 @@ namespace WindBot.Game.AI.Decks
break; break;
} }
} }
cards = new List<ClientCard>(Enemy.Graveyard); cards = new List<ClientCard>(Enemy.Graveyard.GetMatchingCards(card => card.IsCanRevive()));
cards.Sort(AIFunctions.CompareCardAttack); cards.Sort(CardContainer.CompareCardAttack);
for (int i = cards.Count - 1; i >= 0; --i) for (int i = cards.Count - 1; i >= 0; --i)
{ {
ClientCard card = cards[i]; ClientCard card = cards[i];
...@@ -152,7 +152,7 @@ namespace WindBot.Game.AI.Decks ...@@ -152,7 +152,7 @@ namespace WindBot.Game.AI.Decks
private bool WhiteNightDragon() private bool WhiteNightDragon()
{ {
// We should summon Horus the Black Flame Dragon LV6 if he can lvlup. // We should summon Horus the Black Flame Dragon LV6 if he can lvlup.
if (Enemy.GetMonsterCount() != 0 && !AI.Utils.IsAllEnemyBetterThanValue(2300 - 1, false)) if (Enemy.GetMonsterCount() != 0 && !Util.IsAllEnemyBetterThanValue(2300 - 1, false))
foreach (ClientCard card in Main.SummonableCards) foreach (ClientCard card in Main.SummonableCards)
if (card.IsCode(11224103)) if (card.IsCode(11224103))
return false; return false;
...@@ -170,7 +170,7 @@ namespace WindBot.Game.AI.Decks ...@@ -170,7 +170,7 @@ namespace WindBot.Game.AI.Decks
List<ClientCard> cards = new List<ClientCard>(Bot.GetMonsters()); List<ClientCard> cards = new List<ClientCard>(Bot.GetMonsters());
if (cards.Count == 0) if (cards.Count == 0)
return false; return false;
cards.Sort(AIFunctions.CompareCardAttack); cards.Sort(CardContainer.CompareCardAttack);
ClientCard tributeCard = null; ClientCard tributeCard = null;
foreach (ClientCard monster in cards) foreach (ClientCard monster in cards)
{ {
...@@ -190,7 +190,7 @@ namespace WindBot.Game.AI.Decks ...@@ -190,7 +190,7 @@ namespace WindBot.Game.AI.Decks
cards.AddRange(Bot.Graveyard); cards.AddRange(Bot.Graveyard);
if (cards.Count == 0) if (cards.Count == 0)
return false; return false;
cards.Sort(AIFunctions.CompareCardAttack); cards.Sort(CardContainer.CompareCardAttack);
ClientCard summonCard = null; ClientCard summonCard = null;
for (int i = cards.Count - 1; i >= 0; --i) for (int i = cards.Count - 1; i >= 0; --i)
{ {
......
...@@ -116,7 +116,7 @@ namespace WindBot.Game.AI.Decks ...@@ -116,7 +116,7 @@ namespace WindBot.Game.AI.Decks
break; break;
} }
return AI.Utils.CheckSelectCount(result, cards, min, max); return Util.CheckSelectCount(result, cards, min, max);
} }
private bool ReinforcementOfTheArmyEffect() private bool ReinforcementOfTheArmyEffect()
...@@ -222,10 +222,10 @@ namespace WindBot.Game.AI.Decks ...@@ -222,10 +222,10 @@ namespace WindBot.Game.AI.Decks
{ {
IList<ClientCard> targets = new List<ClientCard>(); IList<ClientCard> targets = new List<ClientCard>();
ClientCard target1 = AI.Utils.GetBestEnemyMonster(); ClientCard target1 = Util.GetBestEnemyMonster();
if (target1 != null) if (target1 != null)
targets.Add(target1); targets.Add(target1);
ClientCard target2 = AI.Utils.GetBestEnemySpell(); ClientCard target2 = Util.GetBestEnemySpell();
if (target2 != null) if (target2 != null)
targets.Add(target2); targets.Add(target2);
......
...@@ -479,7 +479,7 @@ namespace WindBot.Game.AI.Decks ...@@ -479,7 +479,7 @@ namespace WindBot.Game.AI.Decks
private bool FairyTailSnowsummon() private bool FairyTailSnowsummon()
{ {
ClientCard target = AI.Utils.GetBestEnemyMonster(true, true); ClientCard target = Util.GetBestEnemyMonster(true, true);
if(target != null) if(target != null)
{ {
return true; return true;
...@@ -493,7 +493,7 @@ namespace WindBot.Game.AI.Decks ...@@ -493,7 +493,7 @@ namespace WindBot.Game.AI.Decks
if (Card.Location == CardLocation.MonsterZone) if (Card.Location == CardLocation.MonsterZone)
{ {
AI.SelectCard(AI.Utils.GetBestEnemyMonster(true, true)); AI.SelectCard(Util.GetBestEnemyMonster(true, true));
return true; return true;
} }
else else
...@@ -524,14 +524,14 @@ namespace WindBot.Game.AI.Decks ...@@ -524,14 +524,14 @@ namespace WindBot.Game.AI.Decks
all.Add(check); all.Add(check);
} }
} }
if (AI.Utils.ChainContainsCard(CardId.FairyTailSnow)) return false; if (Util.ChainContainsCard(CardId.FairyTailSnow)) return false;
if ( Duel.Player == 1 && Duel.Phase == DuelPhase.BattleStart && Bot.BattlingMonster == null && Enemy_atk >=Bot.LifePoints || if ( Duel.Player == 1 && Duel.Phase == DuelPhase.BattleStart && Bot.BattlingMonster == null && Enemy_atk >=Bot.LifePoints ||
Duel.Player == 0 && Duel.Phase==DuelPhase.BattleStart && Enemy.BattlingMonster == null && Enemy.LifePoints<=1850 Duel.Player == 0 && Duel.Phase==DuelPhase.BattleStart && Enemy.BattlingMonster == null && Enemy.LifePoints<=1850
) )
{ {
AI.SelectCard(all); AI.SelectCard(all);
AI.SelectNextCard(AI.Utils.GetBestEnemyMonster()); AI.SelectNextCard(Util.GetBestEnemyMonster());
return true; return true;
} }
} }
...@@ -602,7 +602,7 @@ namespace WindBot.Game.AI.Decks ...@@ -602,7 +602,7 @@ namespace WindBot.Game.AI.Decks
AI.SelectCard(CardId.UltimateConductorTytanno); AI.SelectCard(CardId.UltimateConductorTytanno);
return true; return true;
} }
if (!AI.Utils.IsOneEnemyBetter(true)) return false; if (!Util.IsOneEnemyBetter(true)) return false;
IList<int> targets = new[] { IList<int> targets = new[] {
CardId.ElShaddollConstruct, CardId.ElShaddollConstruct,
CardId.DogorantheMadFlameKaiju, CardId.DogorantheMadFlameKaiju,
...@@ -752,7 +752,7 @@ namespace WindBot.Game.AI.Decks ...@@ -752,7 +752,7 @@ namespace WindBot.Game.AI.Decks
return true; return true;
} }
} }
if (!AI.Utils.IsOneEnemyBetter()) return false; if (!Util.IsOneEnemyBetter()) return false;
foreach (ClientCard monster in Bot.Hand) foreach (ClientCard monster in Bot.Hand)
...@@ -830,7 +830,7 @@ namespace WindBot.Game.AI.Decks ...@@ -830,7 +830,7 @@ namespace WindBot.Game.AI.Decks
ShaddollSquamata_used = true; ShaddollSquamata_used = true;
if (Card.Location != CardLocation.MonsterZone) if (Card.Location != CardLocation.MonsterZone)
{ {
if(AI.Utils.ChainContainsCard(CardId.ElShaddollConstruct)) if(Util.ChainContainsCard(CardId.ElShaddollConstruct))
{ {
if (!Bot.HasInHand(CardId.ShaddollFusion) && Bot.HasInGraveyard(CardId.ShaddollFusion)) if (!Bot.HasInHand(CardId.ShaddollFusion) && Bot.HasInGraveyard(CardId.ShaddollFusion))
AI.SelectNextCard(CardId.ShaddollCore); AI.SelectNextCard(CardId.ShaddollCore);
...@@ -851,7 +851,7 @@ namespace WindBot.Game.AI.Decks ...@@ -851,7 +851,7 @@ namespace WindBot.Game.AI.Decks
else else
{ {
if (Enemy.GetMonsterCount() == 0) return false; if (Enemy.GetMonsterCount() == 0) return false;
ClientCard target = AI.Utils.GetBestEnemyMonster(); ClientCard target = Util.GetBestEnemyMonster();
AI.SelectCard(target); AI.SelectCard(target);
} }
return true; return true;
...@@ -890,7 +890,7 @@ namespace WindBot.Game.AI.Decks ...@@ -890,7 +890,7 @@ namespace WindBot.Game.AI.Decks
ShaddollHedgehog_used = true; ShaddollHedgehog_used = true;
if (Card.Location != CardLocation.MonsterZone) if (Card.Location != CardLocation.MonsterZone)
{ {
if (AI.Utils.ChainContainsCard(CardId.ElShaddollConstruct)) if (Util.ChainContainsCard(CardId.ElShaddollConstruct))
{ {
AI.SelectNextCard( AI.SelectNextCard(
CardId.ShaddollFalco, CardId.ShaddollFalco,
...@@ -924,14 +924,14 @@ namespace WindBot.Game.AI.Decks ...@@ -924,14 +924,14 @@ namespace WindBot.Game.AI.Decks
ShaddollDragon_used = true; ShaddollDragon_used = true;
if (Card.Location == CardLocation.MonsterZone) if (Card.Location == CardLocation.MonsterZone)
{ {
ClientCard target = AI.Utils.GetBestEnemyCard(); ClientCard target = Util.GetBestEnemyCard();
AI.SelectCard(target); AI.SelectCard(target);
return true; return true;
} }
else else
{ {
if (Enemy.GetSpellCount() == 0) return false; if (Enemy.GetSpellCount() == 0) return false;
ClientCard target = AI.Utils.GetBestEnemySpell(); ClientCard target = Util.GetBestEnemySpell();
AI.SelectCard(target); AI.SelectCard(target);
return true; return true;
} }
...@@ -996,7 +996,7 @@ namespace WindBot.Game.AI.Decks ...@@ -996,7 +996,7 @@ namespace WindBot.Game.AI.Decks
if (Card.Location == CardLocation.Grave) if (Card.Location == CardLocation.Grave)
return true; return true;
if (Bot.LifePoints <= 1000) return false; if (Bot.LifePoints <= 1000) return false;
ClientCard select = AI.Utils.GetBestEnemyCard(); ClientCard select = Util.GetBestEnemyCard();
if (select == null) return false; if (select == null) return false;
if(select!=null) if(select!=null)
{ {
...@@ -1018,10 +1018,10 @@ namespace WindBot.Game.AI.Decks ...@@ -1018,10 +1018,10 @@ namespace WindBot.Game.AI.Decks
{ {
IList<ClientCard> targets = new List<ClientCard>(); IList<ClientCard> targets = new List<ClientCard>();
ClientCard target1 = AI.Utils.GetBestEnemyMonster(); ClientCard target1 = Util.GetBestEnemyMonster();
if (target1 != null) if (target1 != null)
targets.Add(target1); targets.Add(target1);
ClientCard target2 = AI.Utils.GetBestEnemySpell(); ClientCard target2 = Util.GetBestEnemySpell();
if (target2 != null) if (target2 != null)
targets.Add(target2); targets.Add(target2);
...@@ -1106,16 +1106,16 @@ namespace WindBot.Game.AI.Decks ...@@ -1106,16 +1106,16 @@ namespace WindBot.Game.AI.Decks
return true; return true;
} }
else if (DarkHole || AI.Utils.IsChainTarget(Card) || AI.Utils.GetProblematicEnemySpell() != null) else if (DarkHole || Util.IsChainTarget(Card) || Util.GetProblematicEnemySpell() != null)
{ {
AI.SelectCard(CardId.TG_WonderMagician); AI.SelectCard(CardId.TG_WonderMagician);
return true; return true;
} }
else if (Duel.Player == 1 && Duel.Phase == DuelPhase.BattleStart && AI.Utils.IsOneEnemyBetterThanValue(1500, true)) else if (Duel.Player == 1 && Duel.Phase == DuelPhase.BattleStart && Util.IsOneEnemyBetterThanValue(1500, true))
{ {
AI.SelectCard(CardId.TG_WonderMagician); AI.SelectCard(CardId.TG_WonderMagician);
if (AI.Utils.IsOneEnemyBetterThanValue(1900, true)) if (Util.IsOneEnemyBetterThanValue(1900, true))
{ {
AI.SelectPosition(CardPosition.FaceUpDefence); AI.SelectPosition(CardPosition.FaceUpDefence);
} }
...@@ -1136,7 +1136,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1136,7 +1136,7 @@ namespace WindBot.Game.AI.Decks
private bool ScarlightRedDragoneff() private bool ScarlightRedDragoneff()
{ {
IList<ClientCard> targets = new List<ClientCard>(); IList<ClientCard> targets = new List<ClientCard>();
ClientCard target1 = AI.Utils.GetBestEnemyMonster(); ClientCard target1 = Util.GetBestEnemyMonster();
if (target1 != null) if (target1 != null)
{ {
targets.Add(target1); targets.Add(target1);
...@@ -1160,8 +1160,8 @@ namespace WindBot.Game.AI.Decks ...@@ -1160,8 +1160,8 @@ namespace WindBot.Game.AI.Decks
AI.SelectCard(Useless_List()); AI.SelectCard(Useless_List());
return true; return true;
} }
//if (ActivateDescription == AI.Utils.GetStringId(CardId.snake, 2)) return true; //if (ActivateDescription == Util.GetStringId(CardId.snake, 2)) return true;
if (ActivateDescription == AI.Utils.GetStringId(CardId.snake, 1)) if (ActivateDescription == Util.GetStringId(CardId.snake, 1))
{ {
foreach (ClientCard hand in Bot.Hand) foreach (ClientCard hand in Bot.Hand)
{ {
...@@ -1186,7 +1186,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1186,7 +1186,7 @@ namespace WindBot.Game.AI.Decks
private bool BlackRoseMoonlightDragoneff() private bool BlackRoseMoonlightDragoneff()
{ {
IList<ClientCard> targets = new List<ClientCard>(); IList<ClientCard> targets = new List<ClientCard>();
ClientCard target1 = AI.Utils.GetBestEnemyMonster(); ClientCard target1 = Util.GetBestEnemyMonster();
if (target1 != null) if (target1 != null)
{ {
targets.Add(target1); targets.Add(target1);
...@@ -1224,18 +1224,18 @@ namespace WindBot.Game.AI.Decks ...@@ -1224,18 +1224,18 @@ namespace WindBot.Game.AI.Decks
return true; return true;
IList<ClientCard> targets = new List<ClientCard>(); IList<ClientCard> targets = new List<ClientCard>();
ClientCard target1 = AI.Utils.GetBestEnemyMonster(); ClientCard target1 = Util.GetBestEnemyMonster();
if (target1 != null) if (target1 != null)
targets.Add(target1); targets.Add(target1);
ClientCard target2 = AI.Utils.GetBestEnemySpell(); ClientCard target2 = Util.GetBestEnemySpell();
if (target2 != null) if (target2 != null)
targets.Add(target2); targets.Add(target2);
else if (AI.Utils.IsChainTarget(Card) || AI.Utils.GetProblematicEnemySpell() != null) else if (Util.IsChainTarget(Card) || Util.GetProblematicEnemySpell() != null)
{ {
AI.SelectCard(targets); AI.SelectCard(targets);
return true; return true;
} }
else if (Duel.Player == 1 && Duel.Phase == DuelPhase.BattleStart && AI.Utils.IsOneEnemyBetterThanValue(2400, true)) else if (Duel.Player == 1 && Duel.Phase == DuelPhase.BattleStart && Util.IsOneEnemyBetterThanValue(2400, true))
{ {
AI.SelectCard(targets); AI.SelectCard(targets);
return true; return true;
......
...@@ -159,7 +159,7 @@ namespace WindBot.Game.AI.Decks ...@@ -159,7 +159,7 @@ namespace WindBot.Game.AI.Decks
private bool DecisiveArmorEffect() private bool DecisiveArmorEffect()
{ {
if (AI.Utils.IsAllEnemyBetterThanValue(3300, true)) if (Util.IsAllEnemyBetterThanValue(3300, true))
{ {
AI.SelectCard(CardId.DecisiveArmor); AI.SelectCard(CardId.DecisiveArmor);
return true; return true;
...@@ -176,7 +176,7 @@ namespace WindBot.Game.AI.Decks ...@@ -176,7 +176,7 @@ namespace WindBot.Game.AI.Decks
private bool GungnirEffect() private bool GungnirEffect()
{ {
if (AI.Utils.IsOneEnemyBetter(true) && Duel.Phase == DuelPhase.Main1) if (Util.IsOneEnemyBetter(true) && Duel.Phase == DuelPhase.Main1)
{ {
AI.SelectCard(Enemy.GetMonsters().GetHighestAttackMonster()); AI.SelectCard(Enemy.GetMonsters().GetHighestAttackMonster());
return true; return true;
...@@ -196,12 +196,12 @@ namespace WindBot.Game.AI.Decks ...@@ -196,12 +196,12 @@ namespace WindBot.Game.AI.Decks
AI.SelectCard(CardId.Mirror); AI.SelectCard(CardId.Mirror);
return true; return true;
} }
else if (AI.Utils.IsOneEnemyBetterThanValue(3300, true) && !Bot.HasInHand(CardId.Trishula)) else if (Util.IsOneEnemyBetterThanValue(3300, true) && !Bot.HasInHand(CardId.Trishula))
{ {
AI.SelectCard(CardId.Trishula); AI.SelectCard(CardId.Trishula);
return true; return true;
} }
else if (AI.Utils.IsAllEnemyBetterThanValue(2700,true) && !Bot.HasInHand(CardId.DecisiveArmor)) else if (Util.IsAllEnemyBetterThanValue(2700,true) && !Bot.HasInHand(CardId.DecisiveArmor))
{ {
AI.SelectCard(CardId.DecisiveArmor); AI.SelectCard(CardId.DecisiveArmor);
return true; return true;
...@@ -221,12 +221,12 @@ namespace WindBot.Game.AI.Decks ...@@ -221,12 +221,12 @@ namespace WindBot.Game.AI.Decks
private bool ThousandHandsEffect() private bool ThousandHandsEffect()
{ {
if (AI.Utils.IsOneEnemyBetterThanValue(3300, true) && !Bot.HasInHand(CardId.Trishula)) if (Util.IsOneEnemyBetterThanValue(3300, true) && !Bot.HasInHand(CardId.Trishula))
{ {
AI.SelectCard(CardId.Trishula); AI.SelectCard(CardId.Trishula);
return true; return true;
} }
else if (AI.Utils.IsAllEnemyBetterThanValue(2700, true) && !Bot.HasInHand(CardId.DecisiveArmor)) else if (Util.IsAllEnemyBetterThanValue(2700, true) && !Bot.HasInHand(CardId.DecisiveArmor))
{ {
AI.SelectCard(CardId.DecisiveArmor); AI.SelectCard(CardId.DecisiveArmor);
return true; return true;
...@@ -277,7 +277,7 @@ namespace WindBot.Game.AI.Decks ...@@ -277,7 +277,7 @@ namespace WindBot.Game.AI.Decks
foreach (int Id in NekrozCard) foreach (int Id in NekrozCard)
{ {
if (Id == CardId.Trishula && AI.Utils.IsAllEnemyBetterThanValue(2700, true) && Bot.HasInHand(CardId.DecisiveArmor)) if (Id == CardId.Trishula && Util.IsAllEnemyBetterThanValue(2700, true) && Bot.HasInHand(CardId.DecisiveArmor))
{ {
AI.SelectCard(CardId.Trishula); AI.SelectCard(CardId.Trishula);
return true; return true;
......
...@@ -104,7 +104,7 @@ namespace WindBot.Game.AI.Decks ...@@ -104,7 +104,7 @@ namespace WindBot.Game.AI.Decks
if (handCard.IsFacedown()) if (handCard.IsFacedown())
return true; return true;
} }
return AI.Utils.IsOneEnemyBetter(true); return Util.IsOneEnemyBetter(true);
} }
} }
} }
\ No newline at end of file
This diff is collapsed.
...@@ -117,11 +117,13 @@ namespace WindBot.Game.AI.Decks ...@@ -117,11 +117,13 @@ namespace WindBot.Game.AI.Decks
bool summon_used = false; bool summon_used = false;
bool CardOfDemiseeff_used = false; bool CardOfDemiseeff_used = false;
bool SeaStealthAttackeff_used = false; bool SeaStealthAttackeff_used = false;
int City_count = 0;
public override void OnNewTurn() public override void OnNewTurn()
{ {
summon_used = false; summon_used = false;
CardOfDemiseeff_used = false; CardOfDemiseeff_used = false;
SeaStealthAttackeff_used = false; SeaStealthAttackeff_used = false;
City_count = 0;
base.OnNewTurn(); base.OnNewTurn();
} }
private bool PreventFeatherDustereff() private bool PreventFeatherDustereff()
...@@ -133,7 +135,7 @@ namespace WindBot.Game.AI.Decks ...@@ -133,7 +135,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Enemy.GetMonsterCount() == 0) if (Enemy.GetMonsterCount() == 0)
{ {
if (AI.Utils.GetTotalAttackingMonsterAttack(0) >= Enemy.LifePoints) if (Util.GetTotalAttackingMonsterAttack(0) >= Enemy.LifePoints)
{ {
return true; return true;
} }
...@@ -145,7 +147,7 @@ namespace WindBot.Game.AI.Decks ...@@ -145,7 +147,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (DefaultOnBecomeTarget() && Card.Location==CardLocation.SpellZone) if (DefaultOnBecomeTarget() && Card.Location==CardLocation.SpellZone)
{ {
AI.SelectCard(AI.Utils.GetBestEnemyCard(false,true)); AI.SelectCard(Util.GetBestEnemyCard(false,true));
return true; return true;
} }
if(Enemy.HasInSpellZone(CardId.EternalSoul)) if(Enemy.HasInSpellZone(CardId.EternalSoul))
...@@ -159,17 +161,17 @@ namespace WindBot.Game.AI.Decks ...@@ -159,17 +161,17 @@ namespace WindBot.Game.AI.Decks
return UniqueFaceupSpell(); return UniqueFaceupSpell();
} }
if (Bot.GetMonsterCount() > 0 && !Bot.HasInSpellZone(CardId.SeaStealthAttack) && if (Bot.GetMonsterCount() > 0 && !Bot.HasInSpellZone(CardId.SeaStealthAttack) &&
AI.Utils.IsOneEnemyBetterThanValue(2000, false) && Duel.Phase==DuelPhase.BattleStart) Util.IsOneEnemyBetterThanValue(2000, false) && Duel.Phase==DuelPhase.BattleStart)
{ {
AI.SelectCard(AI.Utils.GetBestEnemyMonster(true,true)); AI.SelectCard(Util.GetBestEnemyMonster(true,true));
return UniqueFaceupSpell(); return UniqueFaceupSpell();
} }
if (AI.Utils.GetProblematicEnemyCard(9999,true)!=null) if (Util.GetProblematicEnemyCard(9999,true)!=null)
{ {
if (AI.Utils.GetProblematicEnemyCard(9999, true).IsCode(CardId.ElShaddollWinda) && if (Util.GetProblematicEnemyCard(9999, true).IsCode(CardId.ElShaddollWinda) &&
!AI.Utils.GetProblematicEnemyCard(9999, true).IsDisabled()) !Util.GetProblematicEnemyCard(9999, true).IsDisabled())
return false; return false;
AI.SelectCard(AI.Utils.GetProblematicEnemyCard(9999, true)); AI.SelectCard(Util.GetProblematicEnemyCard(9999, true));
return UniqueFaceupSpell(); return UniqueFaceupSpell();
} }
return false; return false;
...@@ -201,7 +203,7 @@ namespace WindBot.Game.AI.Decks ...@@ -201,7 +203,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (m.IsAttack()) count++; if (m.IsAttack()) count++;
} }
if (AI.Utils.GetTotalAttackingMonsterAttack(1) >= Bot.LifePoints) if (Util.GetTotalAttackingMonsterAttack(1) >= Bot.LifePoints)
return true; return true;
return count >= 2; return count >= 2;
} }
...@@ -239,7 +241,7 @@ namespace WindBot.Game.AI.Decks ...@@ -239,7 +241,7 @@ namespace WindBot.Game.AI.Decks
private bool SkillDraineff() private bool SkillDraineff()
{ {
if (Duel.LastChainPlayer == 1 && AI.Utils.GetLastChainCard().Location == CardLocation.MonsterZone) if (Duel.LastChainPlayer == 1 && Util.GetLastChainCard().Location == CardLocation.MonsterZone)
return UniqueFaceupSpell(); return UniqueFaceupSpell();
return false; return false;
} }
...@@ -354,6 +356,9 @@ namespace WindBot.Game.AI.Decks ...@@ -354,6 +356,9 @@ namespace WindBot.Game.AI.Decks
} }
else else
{ {
if (City_count > 10)
return false;
ClientCard target = null; ClientCard target = null;
foreach(ClientCard s in Bot.GetSpells()) foreach(ClientCard s in Bot.GetSpells())
{ {
...@@ -369,12 +374,13 @@ namespace WindBot.Game.AI.Decks ...@@ -369,12 +374,13 @@ namespace WindBot.Game.AI.Decks
{ {
if (target != null && !SeaStealthAttackeff_used) if (target != null && !SeaStealthAttackeff_used)
{ {
if (AI.Utils.IsChainTarget(Card) || AI.Utils.IsChainTarget(target)) if (Util.IsChainTarget(Card) || Util.IsChainTarget(target))
return false; return false;
} }
break; break;
} }
} }
City_count++;
AI.SelectPlace(Zones.z1 | Zones.z3); AI.SelectPlace(Zones.z1 | Zones.z3);
AI.SelectCard(CardId.PhantasmSprialBattle); AI.SelectCard(CardId.PhantasmSprialBattle);
return true; return true;
...@@ -421,11 +427,11 @@ namespace WindBot.Game.AI.Decks ...@@ -421,11 +427,11 @@ namespace WindBot.Game.AI.Decks
private bool BorrelswordDragoneff() private bool BorrelswordDragoneff()
{ {
if (ActivateDescription == AI.Utils.GetStringId(CardId.BorrelswordDragon, 0)) if (ActivateDescription == Util.GetStringId(CardId.BorrelswordDragon, 0))
{ {
if (AI.Utils.IsChainTarget(Card) && AI.Utils.GetBestEnemyMonster(true, true) != null) if (Util.IsChainTarget(Card) && Util.GetBestEnemyMonster(true, true) != null)
{ {
AI.SelectCard(AI.Utils.GetBestEnemyMonster(true, true)); AI.SelectCard(Util.GetBestEnemyMonster(true, true));
return true; return true;
} }
if (Duel.Player == 1 && Bot.BattlingMonster == Card) if (Duel.Player == 1 && Bot.BattlingMonster == Card)
...@@ -461,9 +467,9 @@ namespace WindBot.Game.AI.Decks ...@@ -461,9 +467,9 @@ namespace WindBot.Game.AI.Decks
else else
AI.SelectPlace(Zones.z3); AI.SelectPlace(Zones.z3);
if (Enemy.HasInMonstersZone(CardId.KnightmareGryphon, true)) return false; if (Enemy.HasInMonstersZone(CardId.KnightmareGryphon, true)) return false;
if (AI.Utils.GetProblematicEnemyMonster() == null && Bot.ExtraDeck.Count < 5) return false; if (Util.GetProblematicEnemyMonster() == null && Bot.ExtraDeck.Count < 5) return false;
if (Bot.GetMonstersInMainZone().Count >= 5) return false; if (Bot.GetMonstersInMainZone().Count >= 5) return false;
if (AI.Utils.IsTurn1OrMain2()) return false; if (Util.IsTurn1OrMain2()) return false;
AI.SelectPosition(CardPosition.FaceUpAttack); AI.SelectPosition(CardPosition.FaceUpAttack);
IList<ClientCard> material_list = new List<ClientCard>(); IList<ClientCard> material_list = new List<ClientCard>();
if(Bot.HasInExtra(CardId.BorreloadDragon)) if(Bot.HasInExtra(CardId.BorreloadDragon))
...@@ -538,7 +544,7 @@ namespace WindBot.Game.AI.Decks ...@@ -538,7 +544,7 @@ namespace WindBot.Game.AI.Decks
private bool Linkuriboheff() private bool Linkuriboheff()
{ {
if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard().IsCode(CardId.Linkuriboh)) return false; if (Duel.LastChainPlayer == 0 && Util.GetLastChainCard().IsCode(CardId.Linkuriboh)) return false;
return true; return true;
} }
private bool SeaStealthAttackeff() private bool SeaStealthAttackeff()
...@@ -591,12 +597,12 @@ namespace WindBot.Game.AI.Decks ...@@ -591,12 +597,12 @@ namespace WindBot.Game.AI.Decks
if (s.IsCode(CardId.PacifisThePhantasmCity)) if (s.IsCode(CardId.PacifisThePhantasmCity))
target = s; target = s;
} }
if (target != null && AI.Utils.IsChainTarget(target)) if (target != null && Util.IsChainTarget(target))
{ {
SeaStealthAttackeff_used = true; SeaStealthAttackeff_used = true;
return true; return true;
} }
target = AI.Utils.GetLastChainCard(); target = Util.GetLastChainCard();
if(target!=null) if(target!=null)
{ {
if(target.IsCode(CardId.BrandishSkillAfterburner)) if(target.IsCode(CardId.BrandishSkillAfterburner))
......
...@@ -183,7 +183,7 @@ namespace WindBot.Game.AI.Decks ...@@ -183,7 +183,7 @@ namespace WindBot.Game.AI.Decks
private bool CardOfDemiseEffect() private bool CardOfDemiseEffect()
{ {
if (AI.Utils.IsTurn1OrMain2() && !ShouldPendulum()) if (Util.IsTurn1OrMain2() && !ShouldPendulum())
{ {
CardOfDemiseUsed = true; CardOfDemiseUsed = true;
return true; return true;
...@@ -215,8 +215,8 @@ namespace WindBot.Game.AI.Decks ...@@ -215,8 +215,8 @@ namespace WindBot.Game.AI.Decks
{ {
if (Card.Location == CardLocation.Grave) if (Card.Location == CardLocation.Grave)
{ {
ClientCard l = AI.Utils.GetPZone(0, 0); ClientCard l = Util.GetPZone(0, 0);
ClientCard r = AI.Utils.GetPZone(0, 1); ClientCard r = Util.GetPZone(0, 1);
if (l == null && r == null) if (l == null && r == null)
AI.SelectCard(CardId.Scout); AI.SelectCard(CardId.Scout);
} }
...@@ -227,8 +227,8 @@ namespace WindBot.Game.AI.Decks ...@@ -227,8 +227,8 @@ namespace WindBot.Game.AI.Decks
{ {
if (Card.Location != CardLocation.Hand) if (Card.Location != CardLocation.Hand)
return false; return false;
ClientCard l = AI.Utils.GetPZone(0, 0); ClientCard l = Util.GetPZone(0, 0);
ClientCard r = AI.Utils.GetPZone(0, 1); ClientCard r = Util.GetPZone(0, 1);
if (l == null && r == null) if (l == null && r == null)
return true; return true;
if (l == null && r.RScale != Card.LScale) if (l == null && r.RScale != Card.LScale)
...@@ -252,8 +252,8 @@ namespace WindBot.Game.AI.Decks ...@@ -252,8 +252,8 @@ namespace WindBot.Game.AI.Decks
{ {
count++; count++;
} }
ClientCard l = AI.Utils.GetPZone(0, 0); ClientCard l = Util.GetPZone(0, 0);
ClientCard r = AI.Utils.GetPZone(0, 1); ClientCard r = Util.GetPZone(0, 1);
if (l == null && r == null) if (l == null && r == null)
{ {
if (CardOfDemiseUsed) if (CardOfDemiseUsed)
...@@ -316,7 +316,7 @@ namespace WindBot.Game.AI.Decks ...@@ -316,7 +316,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Card.Location == CardLocation.Hand) if (Card.Location == CardLocation.Hand)
return false; return false;
ClientCard target = AI.Utils.GetBestEnemyCard(); ClientCard target = Util.GetBestEnemyCard();
if (target != null) if (target != null)
{ {
AI.SelectCard(target); AI.SelectCard(target);
...@@ -329,7 +329,7 @@ namespace WindBot.Game.AI.Decks ...@@ -329,7 +329,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Card.Location == CardLocation.Hand) if (Card.Location == CardLocation.Hand)
return false; return false;
ClientCard target = AI.Utils.GetBestEnemyMonster(); ClientCard target = Util.GetBestEnemyMonster();
if (target != null) if (target != null)
{ {
AI.SelectCard(target); AI.SelectCard(target);
...@@ -342,7 +342,7 @@ namespace WindBot.Game.AI.Decks ...@@ -342,7 +342,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Card.Location == CardLocation.Hand) if (Card.Location == CardLocation.Hand)
return false; return false;
ClientCard target = AI.Utils.GetBestEnemySpell(); ClientCard target = Util.GetBestEnemySpell();
if (target != null) if (target != null)
{ {
AI.SelectCard(target); AI.SelectCard(target);
...@@ -353,8 +353,8 @@ namespace WindBot.Game.AI.Decks ...@@ -353,8 +353,8 @@ namespace WindBot.Game.AI.Decks
private bool ShouldPendulum() private bool ShouldPendulum()
{ {
ClientCard l = AI.Utils.GetPZone(0, 0); ClientCard l = Util.GetPZone(0, 0);
ClientCard r = AI.Utils.GetPZone(0, 1); ClientCard r = Util.GetPZone(0, 1);
if (l != null && r != null && l.LScale != r.RScale) if (l != null && r != null && l.LScale != r.RScale)
{ {
int count = 0; int count = 0;
......
using YGOSharp.OCGWrapper.Enums; using System;
using YGOSharp.OCGWrapper.Enums;
using System.Collections.Generic; using System.Collections.Generic;
using WindBot; using WindBot;
using WindBot.Game; using WindBot.Game;
...@@ -61,7 +62,7 @@ namespace WindBot.Game.AI.Decks ...@@ -61,7 +62,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.UnexpectedDai, UnexpectedDaiEffect); AddExecutor(ExecutorType.Activate, CardId.UnexpectedDai, UnexpectedDaiEffect);
AddExecutor(ExecutorType.Summon, CardId.RescueRabbit); AddExecutor(ExecutorType.Summon, CardId.RescueRabbit, RescueRabbitSummon);
AddExecutor(ExecutorType.Activate, CardId.RescueRabbit, RescueRabbitEffect); AddExecutor(ExecutorType.Activate, CardId.RescueRabbit, RescueRabbitEffect);
AddExecutor(ExecutorType.Activate, CardId.PotOfDesires, DefaultPotOfDesires); AddExecutor(ExecutorType.Activate, CardId.PotOfDesires, DefaultPotOfDesires);
...@@ -173,7 +174,7 @@ namespace WindBot.Game.AI.Decks ...@@ -173,7 +174,7 @@ namespace WindBot.Game.AI.Decks
break; break;
} }
return AI.Utils.CheckSelectCount(result, cards, min, max); return Util.CheckSelectCount(result, cards, min, max);
} }
private bool UnexpectedDaiEffect() private bool UnexpectedDaiEffect()
...@@ -184,7 +185,7 @@ namespace WindBot.Game.AI.Decks ...@@ -184,7 +185,7 @@ namespace WindBot.Game.AI.Decks
CardId.PhantomGryphon, CardId.PhantomGryphon,
CardId.MegalosmasherX CardId.MegalosmasherX
); );
else if (AI.Utils.IsTurn1OrMain2()) else if (Util.IsTurn1OrMain2())
{ {
if (Bot.HasInHand(CardId.MysteryShellDragon)) if (Bot.HasInHand(CardId.MysteryShellDragon))
AI.SelectCard(CardId.MysteryShellDragon); AI.SelectCard(CardId.MysteryShellDragon);
...@@ -207,9 +208,16 @@ namespace WindBot.Game.AI.Decks ...@@ -207,9 +208,16 @@ namespace WindBot.Game.AI.Decks
return true; return true;
} }
private bool RescueRabbitSummon()
{
return Util.GetBotAvailZonesFromExtraDeck() > 0
|| !Enemy.MonsterZone.IsExistingMatchingCard(card => card.GetDefensePower() >= 1900)
|| Enemy.MonsterZone.GetMatchingCardsCount(card => card.GetDefensePower() < 1900) > Bot.MonsterZone.GetMatchingCardsCount(card => card.Attack >= 1900);
}
private bool RescueRabbitEffect() private bool RescueRabbitEffect()
{ {
if (AI.Utils.IsTurn1OrMain2()) if (Util.IsTurn1OrMain2())
{ {
AI.SelectCard( AI.SelectCard(
CardId.MegalosmasherX, CardId.MegalosmasherX,
...@@ -255,7 +263,7 @@ namespace WindBot.Game.AI.Decks ...@@ -255,7 +263,7 @@ namespace WindBot.Game.AI.Decks
} }
private bool NormalSummon() private bool NormalSummon()
{ {
return true; return Card.Id != CardId.RescueRabbit;
} }
private bool GagagaCowboySummon() private bool GagagaCowboySummon()
...@@ -270,15 +278,15 @@ namespace WindBot.Game.AI.Decks ...@@ -270,15 +278,15 @@ namespace WindBot.Game.AI.Decks
private bool IgnisterProminenceTheBlastingDracoslayerSummon() private bool IgnisterProminenceTheBlastingDracoslayerSummon()
{ {
return AI.Utils.GetProblematicEnemyCard() != null; return Util.GetProblematicEnemyCard() != null;
} }
private bool IgnisterProminenceTheBlastingDracoslayerEffect() private bool IgnisterProminenceTheBlastingDracoslayerEffect()
{ {
if (ActivateDescription == AI.Utils.GetStringId(CardId.IgnisterProminenceTheBlastingDracoslayer, 1)) if (ActivateDescription == Util.GetStringId(CardId.IgnisterProminenceTheBlastingDracoslayer, 1))
return true; return true;
ClientCard target1 = null; ClientCard target1 = null;
ClientCard target2 = AI.Utils.GetProblematicEnemyCard(); ClientCard target2 = Util.GetProblematicEnemyCard();
List<ClientCard> spells = Enemy.GetSpells(); List<ClientCard> spells = Enemy.GetSpells();
foreach (ClientCard spell in spells) foreach (ClientCard spell in spells)
{ {
...@@ -325,7 +333,7 @@ namespace WindBot.Game.AI.Decks ...@@ -325,7 +333,7 @@ namespace WindBot.Game.AI.Decks
private bool Number37HopeWovenDragonSpiderSharkSummon() private bool Number37HopeWovenDragonSpiderSharkSummon()
{ {
return AI.Utils.IsAllEnemyBetterThanValue(1700, false) && !AI.Utils.IsOneEnemyBetterThanValue(3600, true); return Util.IsAllEnemyBetterThanValue(1700, false) && !Util.IsOneEnemyBetterThanValue(3600, true);
} }
private bool LightningChidoriSummon() private bool LightningChidoriSummon()
...@@ -345,12 +353,12 @@ namespace WindBot.Game.AI.Decks ...@@ -345,12 +353,12 @@ namespace WindBot.Game.AI.Decks
} }
} }
return AI.Utils.GetProblematicEnemyCard() != null; return Util.GetProblematicEnemyCard() != null;
} }
private bool LightningChidoriEffect() private bool LightningChidoriEffect()
{ {
ClientCard problematicCard = AI.Utils.GetProblematicEnemyCard(); ClientCard problematicCard = Util.GetProblematicEnemyCard();
AI.SelectCard(0); AI.SelectCard(0);
AI.SelectNextCard(problematicCard); AI.SelectNextCard(problematicCard);
return true; return true;
...@@ -358,12 +366,12 @@ namespace WindBot.Game.AI.Decks ...@@ -358,12 +366,12 @@ namespace WindBot.Game.AI.Decks
private bool EvolzarLaggiaSummon() private bool EvolzarLaggiaSummon()
{ {
return (AI.Utils.IsAllEnemyBetterThanValue(2000, false) && !AI.Utils.IsOneEnemyBetterThanValue(2400, true)) || AI.Utils.IsTurn1OrMain2(); return (Util.IsAllEnemyBetterThanValue(2000, false) && !Util.IsOneEnemyBetterThanValue(2400, true)) || Util.IsTurn1OrMain2();
} }
private bool EvilswarmNightmareSummon() private bool EvilswarmNightmareSummon()
{ {
if (AI.Utils.IsTurn1OrMain2()) if (Util.IsTurn1OrMain2())
{ {
AI.SelectPosition(CardPosition.FaceUpDefence); AI.SelectPosition(CardPosition.FaceUpDefence);
return true; return true;
...@@ -373,7 +381,7 @@ namespace WindBot.Game.AI.Decks ...@@ -373,7 +381,7 @@ namespace WindBot.Game.AI.Decks
private bool TraptrixRafflesiaSummon() private bool TraptrixRafflesiaSummon()
{ {
if (AI.Utils.IsTurn1OrMain2() && (Bot.GetRemainingCount(CardId.BottomlessTrapHole, 1) + Bot.GetRemainingCount(CardId.TraptrixTrapHoleNightmare, 1)) > 0) if (Util.IsTurn1OrMain2() && (Bot.GetRemainingCount(CardId.BottomlessTrapHole, 1) + Bot.GetRemainingCount(CardId.TraptrixTrapHoleNightmare, 1)) > 0)
{ {
AI.SelectPosition(CardPosition.FaceUpDefence); AI.SelectPosition(CardPosition.FaceUpDefence);
return true; return true;
...@@ -384,14 +392,14 @@ namespace WindBot.Game.AI.Decks ...@@ -384,14 +392,14 @@ namespace WindBot.Game.AI.Decks
private bool Number59CrookedCookSummon() private bool Number59CrookedCookSummon()
{ {
return ((Bot.GetMonsterCount() + Bot.GetSpellCount() - 2) <= 1) && return ((Bot.GetMonsterCount() + Bot.GetSpellCount() - 2) <= 1) &&
((AI.Utils.IsOneEnemyBetter() && !AI.Utils.IsOneEnemyBetterThanValue(2300, true)) || AI.Utils.IsTurn1OrMain2()); ((Util.IsOneEnemyBetter() && !Util.IsOneEnemyBetterThanValue(2300, true)) || Util.IsTurn1OrMain2());
} }
private bool Number59CrookedCookEffect() private bool Number59CrookedCookEffect()
{ {
if (Duel.Player == 0) if (Duel.Player == 0)
{ {
if (AI.Utils.IsChainTarget(Card)) if (Util.IsChainTarget(Card))
return true; return true;
} }
else else
...@@ -414,7 +422,7 @@ namespace WindBot.Game.AI.Decks ...@@ -414,7 +422,7 @@ namespace WindBot.Game.AI.Decks
private bool StarliegePaladynamoEffect() private bool StarliegePaladynamoEffect()
{ {
ClientCard result = AI.Utils.GetOneEnemyBetterThanValue(2000, true); ClientCard result = Util.GetOneEnemyBetterThanValue(2000, true);
if (result != null) if (result != null)
{ {
AI.SelectCard(0); AI.SelectCard(0);
......
...@@ -120,13 +120,13 @@ namespace WindBot.Game.AI.Decks ...@@ -120,13 +120,13 @@ namespace WindBot.Game.AI.Decks
public override IList<ClientCard> OnSelectXyzMaterial(IList<ClientCard> cards, int min, int max) public override IList<ClientCard> OnSelectXyzMaterial(IList<ClientCard> cards, int min, int max)
{ {
IList<ClientCard> result = AI.Utils.SelectPreferredCards(new[] { IList<ClientCard> result = Util.SelectPreferredCards(new[] {
CardId.MistArchfiend, CardId.MistArchfiend,
CardId.PanzerDragon, CardId.PanzerDragon,
CardId.SolarWindJammer, CardId.SolarWindJammer,
CardId.StarDrawing CardId.StarDrawing
}, cards, min, max); }, cards, min, max);
return AI.Utils.CheckSelectCount(result, cards, min, max); return Util.CheckSelectCount(result, cards, min, max);
} }
private bool NormalSummon() private bool NormalSummon()
...@@ -181,6 +181,8 @@ namespace WindBot.Game.AI.Decks ...@@ -181,6 +181,8 @@ namespace WindBot.Game.AI.Decks
{ {
if (HaveOtherLV5OnField()) if (HaveOtherLV5OnField())
return true; return true;
if (Util.GetBotAvailZonesFromExtraDeck() == 0)
return false;
int lv5Count = 0; int lv5Count = 0;
foreach (ClientCard card in Bot.Hand) foreach (ClientCard card in Bot.Hand)
{ {
...@@ -216,10 +218,10 @@ namespace WindBot.Game.AI.Decks ...@@ -216,10 +218,10 @@ namespace WindBot.Game.AI.Decks
return false; return false;
if (Bot.HasInHand(new[] if (Bot.HasInHand(new[]
{ {
CardId.MistArchfiend,
CardId.WindUpSoldier, CardId.WindUpSoldier,
CardId.StarDrawing, CardId.StarDrawing,
CardId.ChronomalyGoldenJet CardId.ChronomalyGoldenJet,
CardId.MistArchfiend
})) }))
{ {
NormalSummoned = false; NormalSummoned = false;
...@@ -236,7 +238,7 @@ namespace WindBot.Game.AI.Decks ...@@ -236,7 +238,7 @@ namespace WindBot.Game.AI.Decks
private bool CyberDragonNovaEffect() private bool CyberDragonNovaEffect()
{ {
if (ActivateDescription == AI.Utils.GetStringId(CardId.CyberDragonNova, 0)) if (ActivateDescription == Util.GetStringId(CardId.CyberDragonNova, 0))
{ {
return true; return true;
} }
...@@ -282,12 +284,12 @@ namespace WindBot.Game.AI.Decks ...@@ -282,12 +284,12 @@ namespace WindBot.Game.AI.Decks
private bool Number61VolcasaurusSummon() private bool Number61VolcasaurusSummon()
{ {
return AI.Utils.IsOneEnemyBetterThanValue(2000, false); return Util.IsOneEnemyBetterThanValue(2000, false);
} }
private bool Number61VolcasaurusEffect() private bool Number61VolcasaurusEffect()
{ {
ClientCard target = AI.Utils.GetProblematicEnemyMonster(2000); ClientCard target = Util.GetProblematicEnemyMonster(2000);
if (target != null) if (target != null)
{ {
AI.SelectCard(CardId.CyberDragon); AI.SelectCard(CardId.CyberDragon);
...@@ -300,9 +302,9 @@ namespace WindBot.Game.AI.Decks ...@@ -300,9 +302,9 @@ namespace WindBot.Game.AI.Decks
private bool TirasKeeperOfGenesisEffect() private bool TirasKeeperOfGenesisEffect()
{ {
ClientCard target = AI.Utils.GetProblematicEnemyCard(); ClientCard target = Util.GetProblematicEnemyCard();
if (target == null) if (target == null)
target = AI.Utils.GetBestEnemyCard(); target = Util.GetBestEnemyCard();
if (target != null) if (target != null)
{ {
AI.SelectCard(target); AI.SelectCard(target);
...@@ -357,7 +359,7 @@ namespace WindBot.Game.AI.Decks ...@@ -357,7 +359,7 @@ namespace WindBot.Game.AI.Decks
private bool PanzerDragonEffect() private bool PanzerDragonEffect()
{ {
ClientCard target = AI.Utils.GetBestEnemyCard(); ClientCard target = Util.GetBestEnemyCard();
if (target != null) if (target != null)
{ {
AI.SelectCard(target); AI.SelectCard(target);
...@@ -384,9 +386,10 @@ namespace WindBot.Game.AI.Decks ...@@ -384,9 +386,10 @@ namespace WindBot.Game.AI.Decks
{ {
if (monster.HasType(CardType.Monster) && if (monster.HasType(CardType.Monster) &&
!monster.HasType(CardType.Xyz) && !monster.HasType(CardType.Xyz) &&
Util.GetBotAvailZonesFromExtraDeck(monster) > 0 &&
(monster.Level == 5 (monster.Level == 5
|| monster.IsCode(CardId.StarDrawing) || monster.IsCode(CardId.StarDrawing)
|| (monster.IsCode(CardId.WindUpSoldier)) && !monster.Equals(Card))) || monster.IsCode(CardId.WindUpSoldier) && !monster.Equals(Card)))
return true; return true;
} }
return false; return false;
......
...@@ -189,7 +189,7 @@ namespace WindBot.Game.AI.Decks ...@@ -189,7 +189,7 @@ namespace WindBot.Game.AI.Decks
private bool MindControlEffect() private bool MindControlEffect()
{ {
ClientCard target = AI.Utils.GetBestEnemyMonster(); ClientCard target = Util.GetBestEnemyMonster();
if (target != null) if (target != null)
{ {
AI.SelectCard(target); AI.SelectCard(target);
...@@ -461,8 +461,8 @@ namespace WindBot.Game.AI.Decks ...@@ -461,8 +461,8 @@ namespace WindBot.Game.AI.Decks
private bool LinkSummon() private bool LinkSummon()
{ {
return (AI.Utils.IsTurn1OrMain2() || AI.Utils.IsOneEnemyBetter()) return (Util.IsTurn1OrMain2() || Util.IsOneEnemyBetter())
&& AI.Utils.GetBestAttack(Bot) < Card.Attack; && Util.GetBestAttack(Bot) < Card.Attack;
} }
} }
} }
\ No newline at end of file
This diff is collapsed.
...@@ -114,7 +114,7 @@ namespace WindBot.Game.AI.Decks ...@@ -114,7 +114,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.SpSummon, CardId.Hayate, HayateSummon); AddExecutor(ExecutorType.SpSummon, CardId.Hayate, HayateSummon);
AddExecutor(ExecutorType.Activate, CardId.Hayate, HayateEffect); AddExecutor(ExecutorType.Activate, CardId.Hayate, HayateEffect);
AddExecutor(ExecutorType.SpSummon, CardId.TopologicBomberDragon, AI.Utils.IsTurn1OrMain2); AddExecutor(ExecutorType.SpSummon, CardId.TopologicBomberDragon, Util.IsTurn1OrMain2);
AddExecutor(ExecutorType.Summon, CardId.Raye, RayeSummon); AddExecutor(ExecutorType.Summon, CardId.Raye, RayeSummon);
...@@ -160,15 +160,15 @@ namespace WindBot.Game.AI.Decks ...@@ -160,15 +160,15 @@ namespace WindBot.Game.AI.Decks
public override bool OnSelectYesNo(int desc) public override bool OnSelectYesNo(int desc)
{ {
if (desc == AI.Utils.GetStringId(CardId.SummonSorceress, 2)) // summon to the field of opponent? if (desc == Util.GetStringId(CardId.SummonSorceress, 2)) // summon to the field of opponent?
return false; return false;
if (desc == AI.Utils.GetStringId(CardId.Engage, 0)) // draw card? if (desc == Util.GetStringId(CardId.Engage, 0)) // draw card?
return true; return true;
if (desc == AI.Utils.GetStringId(CardId.WidowAnchor, 0)) // get control? if (desc == Util.GetStringId(CardId.WidowAnchor, 0)) // get control?
return true; return true;
if (desc == AI.Utils.GetStringId(CardId.JammingWave, 0)) // destroy monster? if (desc == Util.GetStringId(CardId.JammingWave, 0)) // destroy monster?
{ {
ClientCard target = AI.Utils.GetBestEnemyMonster(); ClientCard target = Util.GetBestEnemyMonster();
if (target != null) if (target != null)
{ {
AI.SelectCard(target); AI.SelectCard(target);
...@@ -177,9 +177,9 @@ namespace WindBot.Game.AI.Decks ...@@ -177,9 +177,9 @@ namespace WindBot.Game.AI.Decks
else else
return false; return false;
} }
if (desc == AI.Utils.GetStringId(CardId.Afterburners, 0)) // destroy spell & trap? if (desc == Util.GetStringId(CardId.Afterburners, 0)) // destroy spell & trap?
{ {
ClientCard target = AI.Utils.GetBestEnemySpell(); ClientCard target = Util.GetBestEnemySpell();
if (target != null) if (target != null)
{ {
AI.SelectCard(target); AI.SelectCard(target);
...@@ -199,7 +199,7 @@ namespace WindBot.Game.AI.Decks ...@@ -199,7 +199,7 @@ namespace WindBot.Game.AI.Decks
private bool TwinTwistersEffect() private bool TwinTwistersEffect()
{ {
if (AI.Utils.ChainContainsCard(CardId.TwinTwisters)) if (Util.ChainContainsCard(CardId.TwinTwisters))
return false; return false;
IList<ClientCard> targets = new List<ClientCard>(); IList<ClientCard> targets = new List<ClientCard>();
foreach (ClientCard target in Enemy.GetSpells()) foreach (ClientCard target in Enemy.GetSpells())
...@@ -261,7 +261,7 @@ namespace WindBot.Game.AI.Decks ...@@ -261,7 +261,7 @@ namespace WindBot.Game.AI.Decks
private bool AfterburnersEffect() private bool AfterburnersEffect()
{ {
ClientCard target = AI.Utils.GetBestEnemyMonster(true, true); ClientCard target = Util.GetBestEnemyMonster(true, true);
if (target != null) if (target != null)
{ {
AI.SelectCard(target); AI.SelectCard(target);
...@@ -291,9 +291,9 @@ namespace WindBot.Game.AI.Decks ...@@ -291,9 +291,9 @@ namespace WindBot.Game.AI.Decks
private bool WidowAnchorEffectFirst() private bool WidowAnchorEffectFirst()
{ {
if (AI.Utils.ChainContainsCard(CardId.WidowAnchor)) if (Util.ChainContainsCard(CardId.WidowAnchor))
return false; return false;
ClientCard target = AI.Utils.GetProblematicEnemyMonster(0, true); ClientCard target = Util.GetProblematicEnemyMonster(0, true);
if (target != null) if (target != null)
{ {
WidowAnchorTarget = target; WidowAnchorTarget = target;
...@@ -359,7 +359,7 @@ namespace WindBot.Game.AI.Decks ...@@ -359,7 +359,7 @@ namespace WindBot.Game.AI.Decks
return true; return true;
if (Bot.HasInMonstersZone(CardId.TopologicBomberDragon) && Enemy.GetMonsterCount() > 1) if (Bot.HasInMonstersZone(CardId.TopologicBomberDragon) && Enemy.GetMonsterCount() > 1)
return true; return true;
if (!AI.Utils.IsTurn1OrMain2()) if (!Util.IsTurn1OrMain2())
{ {
foreach (ClientCard card in Bot.Hand) foreach (ClientCard card in Bot.Hand)
{ {
...@@ -375,14 +375,14 @@ namespace WindBot.Game.AI.Decks ...@@ -375,14 +375,14 @@ namespace WindBot.Game.AI.Decks
{ {
if (DefaultBreakthroughSkill()) if (DefaultBreakthroughSkill())
{ {
WidowAnchorTarget = AI.Utils.GetLastChainCard(); WidowAnchorTarget = Util.GetLastChainCard();
return true; return true;
} }
if (!HaveThreeSpellsInGrave() || Duel.Player == 1 || Duel.Phase < DuelPhase.Main1 || Duel.Phase >= DuelPhase.Main2 || AI.Utils.ChainContainsCard(CardId.WidowAnchor)) if (!HaveThreeSpellsInGrave() || Duel.Player == 1 || Duel.Phase < DuelPhase.Main1 || Duel.Phase >= DuelPhase.Main2 || Util.ChainContainsCard(CardId.WidowAnchor))
return false; return false;
ClientCard target = AI.Utils.GetBestEnemyMonster(true, true); ClientCard target = Util.GetBestEnemyMonster(true, true);
if (target != null && !target.IsDisabled() && !target.HasType(CardType.Normal)) if (target != null && !target.IsDisabled() && !target.HasType(CardType.Normal))
{ {
WidowAnchorTarget = target; WidowAnchorTarget = target;
...@@ -410,9 +410,9 @@ namespace WindBot.Game.AI.Decks ...@@ -410,9 +410,9 @@ namespace WindBot.Game.AI.Decks
} }
else else
{ {
if (AI.Utils.IsTurn1OrMain2()) if (Util.IsTurn1OrMain2())
return false; return false;
ClientCard bestBotMonster = AI.Utils.GetBestBotMonster(true); ClientCard bestBotMonster = Util.GetBestBotMonster(true);
if (bestBotMonster != null) if (bestBotMonster != null)
{ {
int bestPower = bestBotMonster.Attack; int bestPower = bestBotMonster.Attack;
...@@ -527,7 +527,7 @@ namespace WindBot.Game.AI.Decks ...@@ -527,7 +527,7 @@ namespace WindBot.Game.AI.Decks
{ {
return false; return false;
} }
if (AI.Utils.IsChainTarget(Card)) if (Util.IsChainTarget(Card))
{ {
RayeSelectTarget(); RayeSelectTarget();
return true; return true;
...@@ -582,11 +582,11 @@ namespace WindBot.Game.AI.Decks ...@@ -582,11 +582,11 @@ namespace WindBot.Game.AI.Decks
private bool KagariEffect() private bool KagariEffect()
{ {
if (EmptyMainMonsterZone() && AI.Utils.GetProblematicEnemyMonster() != null && Bot.HasInGraveyard(CardId.Afterburners)) if (EmptyMainMonsterZone() && Util.GetProblematicEnemyMonster() != null && Bot.HasInGraveyard(CardId.Afterburners))
{ {
AI.SelectCard(CardId.Afterburners); AI.SelectCard(CardId.Afterburners);
} }
else if (EmptyMainMonsterZone() && AI.Utils.GetProblematicEnemySpell() != null && Bot.HasInGraveyard(CardId.JammingWave)) else if (EmptyMainMonsterZone() && Util.GetProblematicEnemySpell() != null && Bot.HasInGraveyard(CardId.JammingWave))
{ {
AI.SelectCard(CardId.JammingWave); AI.SelectCard(CardId.JammingWave);
} }
...@@ -597,7 +597,7 @@ namespace WindBot.Game.AI.Decks ...@@ -597,7 +597,7 @@ namespace WindBot.Game.AI.Decks
private bool ShizukuSummon() private bool ShizukuSummon()
{ {
if (AI.Utils.IsTurn1OrMain2()) if (Util.IsTurn1OrMain2())
{ {
ShizukuSummoned = true; ShizukuSummoned = true;
return true; return true;
...@@ -617,7 +617,7 @@ namespace WindBot.Game.AI.Decks ...@@ -617,7 +617,7 @@ namespace WindBot.Game.AI.Decks
private bool HayateSummon() private bool HayateSummon()
{ {
if (AI.Utils.IsTurn1OrMain2()) if (Util.IsTurn1OrMain2())
return false; return false;
HayateSummoned = true; HayateSummoned = true;
return true; return true;
...@@ -641,14 +641,14 @@ namespace WindBot.Game.AI.Decks ...@@ -641,14 +641,14 @@ namespace WindBot.Game.AI.Decks
CardId.EffectVeiler, CardId.EffectVeiler,
CardId.GhostRabbit, CardId.GhostRabbit,
CardId.JetSynchron CardId.JetSynchron
}) && !AI.Utils.IsTurn1OrMain2() }) && !Util.IsTurn1OrMain2()
&& Bot.GetMonsterCount() > 0 && Bot.GetMonsterCount() > 0
&& Bot.HasInExtra(CardId.CrystronNeedlefiber); && Bot.HasInExtra(CardId.CrystronNeedlefiber);
} }
private bool CrystronNeedlefiberSummon() private bool CrystronNeedlefiberSummon()
{ {
return !AI.Utils.IsTurn1OrMain2(); return !Util.IsTurn1OrMain2();
} }
private bool CrystronNeedlefiberEffect() private bool CrystronNeedlefiberEffect()
...@@ -701,15 +701,15 @@ namespace WindBot.Game.AI.Decks ...@@ -701,15 +701,15 @@ namespace WindBot.Game.AI.Decks
{ {
return CardId.HornetDrones; return CardId.HornetDrones;
} }
else if (AI.Utils.GetProblematicEnemyMonster() != null && Bot.GetRemainingCount(CardId.WidowAnchor, 3) > 0) else if (Util.GetProblematicEnemyMonster() != null && Bot.GetRemainingCount(CardId.WidowAnchor, 3) > 0)
{ {
return CardId.WidowAnchor; return CardId.WidowAnchor;
} }
else if (EmptyMainMonsterZone() && AI.Utils.GetProblematicEnemyMonster() != null && Bot.GetRemainingCount(CardId.Afterburners, 1) > 0) else if (EmptyMainMonsterZone() && Util.GetProblematicEnemyMonster() != null && Bot.GetRemainingCount(CardId.Afterburners, 1) > 0)
{ {
return CardId.Afterburners; return CardId.Afterburners;
} }
else if (EmptyMainMonsterZone() && AI.Utils.GetProblematicEnemySpell() != null && Bot.GetRemainingCount(CardId.JammingWave, 1) > 0) else if (EmptyMainMonsterZone() && Util.GetProblematicEnemySpell() != null && Bot.GetRemainingCount(CardId.JammingWave, 1) > 0)
{ {
return CardId.JammingWave; return CardId.JammingWave;
} }
......
...@@ -413,7 +413,7 @@ namespace WindBot.Game.AI.Decks ...@@ -413,7 +413,7 @@ namespace WindBot.Game.AI.Decks
private bool CatSharkSummon() private bool CatSharkSummon()
{ {
if (Bot.HasInMonstersZone(CardId.ToadallyAwesome) if (Bot.HasInMonstersZone(CardId.ToadallyAwesome)
&& ((AI.Utils.IsOneEnemyBetter(true) && ((Util.IsOneEnemyBetter(true)
&& !Bot.HasInMonstersZone(new[] && !Bot.HasInMonstersZone(new[]
{ {
CardId.CatShark, CardId.CatShark,
...@@ -470,8 +470,8 @@ namespace WindBot.Game.AI.Decks ...@@ -470,8 +470,8 @@ namespace WindBot.Game.AI.Decks
num++; num++;
} }
} }
return AI.Utils.IsOneEnemyBetter(true) return Util.IsOneEnemyBetter(true)
&& AI.Utils.GetBestAttack(Enemy) > 2200 && Util.GetBestAttack(Enemy) > 2200
&& num < 4 && num < 4
&& !Bot.HasInMonstersZone(new[] && !Bot.HasInMonstersZone(new[]
{ {
...@@ -496,7 +496,7 @@ namespace WindBot.Game.AI.Decks ...@@ -496,7 +496,7 @@ namespace WindBot.Game.AI.Decks
{ {
defence += monster.GetDefensePower(); defence += monster.GetDefensePower();
} }
if (attack - 2000 - defence > Enemy.LifePoints && !AI.Utils.IsOneEnemyBetter(true)) if (attack - 2000 - defence > Enemy.LifePoints && !Util.IsOneEnemyBetter(true))
return true; return true;
} }
return false; return false;
...@@ -512,7 +512,7 @@ namespace WindBot.Game.AI.Decks ...@@ -512,7 +512,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Card.IsFacedown()) if (Card.IsFacedown())
return true; return true;
if (Card.IsDefense() && !AI.Utils.IsAllEnemyBetter(true) && Card.Attack >= Card.Defense) if (Card.IsDefense() && !Util.IsAllEnemyBetter(true) && Card.Attack >= Card.Defense)
return true; return true;
return false; return false;
} }
......
This diff is collapsed.
...@@ -181,8 +181,8 @@ namespace WindBot.Game.AI.Decks ...@@ -181,8 +181,8 @@ namespace WindBot.Game.AI.Decks
public override IList<ClientCard> OnSelectXyzMaterial(IList<ClientCard> cards, int min, int max) public override IList<ClientCard> OnSelectXyzMaterial(IList<ClientCard> cards, int min, int max)
{ {
IList<ClientCard> result = AI.Utils.SelectPreferredCards(CardId.YosenjuTsujik, cards, min, max); IList<ClientCard> result = Util.SelectPreferredCards(CardId.YosenjuTsujik, cards, min, max);
return AI.Utils.CheckSelectCount(result, cards, min, max); return Util.CheckSelectCount(result, cards, min, max);
} }
private bool PotOfDualityEffect() private bool PotOfDualityEffect()
...@@ -227,7 +227,7 @@ namespace WindBot.Game.AI.Decks ...@@ -227,7 +227,7 @@ namespace WindBot.Game.AI.Decks
private bool CardOfDemiseEffect() private bool CardOfDemiseEffect()
{ {
if (AI.Utils.IsTurn1OrMain2()) if (Util.IsTurn1OrMain2())
{ {
CardOfDemiseUsed = true; CardOfDemiseUsed = true;
return true; return true;
...@@ -292,15 +292,15 @@ namespace WindBot.Game.AI.Decks ...@@ -292,15 +292,15 @@ namespace WindBot.Game.AI.Decks
private bool DarkRebellionXyzDragonSummon() private bool DarkRebellionXyzDragonSummon()
{ {
int selfBestAttack = AI.Utils.GetBestAttack(Bot); int selfBestAttack = Util.GetBestAttack(Bot);
int oppoBestAttack = AI.Utils.GetBestAttack(Enemy); int oppoBestAttack = Util.GetBestAttack(Enemy);
return selfBestAttack <= oppoBestAttack; return selfBestAttack <= oppoBestAttack;
} }
private bool DarkRebellionXyzDragonEffect() private bool DarkRebellionXyzDragonEffect()
{ {
int oppoBestAttack = AI.Utils.GetBestAttack(Enemy); int oppoBestAttack = Util.GetBestAttack(Enemy);
ClientCard target = AI.Utils.GetOneEnemyBetterThanValue(oppoBestAttack, true); ClientCard target = Util.GetOneEnemyBetterThanValue(oppoBestAttack, true);
if (target != null) if (target != null)
{ {
AI.SelectCard(0); AI.SelectCard(0);
......
...@@ -79,9 +79,9 @@ namespace WindBot.Game.AI.Decks ...@@ -79,9 +79,9 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.Number61Volcasaurus); AddExecutor(ExecutorType.Activate, CardId.Number61Volcasaurus);
// Weapons // Weapons
AddExecutor(ExecutorType.Activate, CardId.ZwTornadoBringer); AddExecutor(ExecutorType.Activate, CardId.ZwTornadoBringer, ZwWeapon);
AddExecutor(ExecutorType.Activate, CardId.ZwLightningBlade); AddExecutor(ExecutorType.Activate, CardId.ZwLightningBlade, ZwWeapon);
AddExecutor(ExecutorType.Activate, CardId.ZwAsuraStrike); AddExecutor(ExecutorType.Activate, CardId.ZwAsuraStrike, ZwWeapon);
// Special summons // Special summons
...@@ -122,6 +122,13 @@ namespace WindBot.Game.AI.Decks ...@@ -122,6 +122,13 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.SolemnStrike, DefaultSolemnStrike); AddExecutor(ExecutorType.Activate, CardId.SolemnStrike, DefaultSolemnStrike);
} }
private int ZwCount = 0;
public override void OnNewTurn()
{
ZwCount = 0;
}
public override bool OnSelectHand() public override bool OnSelectHand()
{ {
return false; return false;
...@@ -139,35 +146,41 @@ namespace WindBot.Game.AI.Decks ...@@ -139,35 +146,41 @@ namespace WindBot.Game.AI.Decks
public override IList<ClientCard> OnSelectXyzMaterial(IList<ClientCard> cards, int min, int max) public override IList<ClientCard> OnSelectXyzMaterial(IList<ClientCard> cards, int min, int max)
{ {
IList<ClientCard> result = AI.Utils.SelectPreferredCards(new[] { IList<ClientCard> result = Util.SelectPreferredCards(new[] {
CardId.StarDrawing, CardId.StarDrawing,
CardId.SolarWindJammer, CardId.SolarWindJammer,
CardId.Goblindbergh CardId.Goblindbergh
}, cards, min, max); }, cards, min, max);
return AI.Utils.CheckSelectCount(result, cards, min, max); return Util.CheckSelectCount(result, cards, min, max);
} }
private bool Number39Utopia() private bool Number39Utopia()
{ {
if (!AI.Utils.HasChainedTrap(0) && Duel.Player == 1 && Duel.Phase == DuelPhase.BattleStart && Card.HasXyzMaterial(2)) if (!Util.HasChainedTrap(0) && Duel.Player == 1 && Duel.Phase == DuelPhase.BattleStart && Card.HasXyzMaterial(2))
return true; return true;
return false; return false;
} }
private bool Number61Volcasaurus() private bool Number61Volcasaurus()
{ {
return AI.Utils.IsOneEnemyBetterThanValue(2000, false); return Util.IsOneEnemyBetterThanValue(2000, false);
} }
private bool ZwLionArms() private bool ZwLionArms()
{ {
if (ActivateDescription == AI.Utils.GetStringId(CardId.ZwLionArms, 0)) if (ActivateDescription == Util.GetStringId(CardId.ZwLionArms, 0))
return true; return true;
if (ActivateDescription == AI.Utils.GetStringId(CardId.ZwLionArms, 1)) if (ActivateDescription == Util.GetStringId(CardId.ZwLionArms, 1))
return !Card.IsDisabled(); return !Card.IsDisabled() && ZwWeapon();
return false; return false;
} }
private bool ZwWeapon()
{
ZwCount++;
return ZwCount < 10;
}
private bool ReinforcementOfTheArmy() private bool ReinforcementOfTheArmy()
{ {
AI.SelectCard( AI.SelectCard(
...@@ -234,7 +247,7 @@ namespace WindBot.Game.AI.Decks ...@@ -234,7 +247,7 @@ namespace WindBot.Game.AI.Decks
private bool KagetokageEffect() private bool KagetokageEffect()
{ {
var lastChainCard = AI.Utils.GetLastChainCard(); var lastChainCard = Util.GetLastChainCard();
if (lastChainCard == null) return true; if (lastChainCard == null) return true;
return !lastChainCard.IsCode(CardId.Goblindbergh, CardId.TinGoldfish); return !lastChainCard.IsCode(CardId.Goblindbergh, CardId.TinGoldfish);
} }
......
...@@ -157,7 +157,7 @@ namespace WindBot.Game.AI.Decks ...@@ -157,7 +157,7 @@ namespace WindBot.Game.AI.Decks
|| Duel.Phase == DuelPhase.Damage)) || Duel.Phase == DuelPhase.Damage))
return false; return false;
return Duel.Player==0 return Duel.Player==0
|| AI.Utils.IsOneEnemyBetter(); || Util.IsOneEnemyBetter();
} }
return true; return true;
} }
...@@ -419,7 +419,7 @@ namespace WindBot.Game.AI.Decks ...@@ -419,7 +419,7 @@ namespace WindBot.Game.AI.Decks
private bool RatpierMaterialEffect() private bool RatpierMaterialEffect()
{ {
if (ActivateDescription == AI.Utils.GetStringId(CardId.Ratpier, 1)) if (ActivateDescription == Util.GetStringId(CardId.Ratpier, 1))
{ {
AI.SelectPosition(CardPosition.FaceUpDefence); AI.SelectPosition(CardPosition.FaceUpDefence);
return true; return true;
...@@ -479,7 +479,7 @@ namespace WindBot.Game.AI.Decks ...@@ -479,7 +479,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Duel.LastChainPlayer == 0) if (Duel.LastChainPlayer == 0)
return false; return false;
ClientCard target = AI.Utils.GetBestEnemyCard(true); ClientCard target = Util.GetBestEnemyCard(true);
if (target == null) if (target == null)
return false; return false;
AI.SelectCard( AI.SelectCard(
......
This diff is collapsed.
...@@ -22,5 +22,6 @@ ...@@ -22,5 +22,6 @@
EaterOfMillions = 63845230, EaterOfMillions = 63845230,
ElShaddollConstruct = 20366274, ElShaddollConstruct = 20366274,
ZushintheSleepingGiant = 67547370, ZushintheSleepingGiant = 67547370,
Heart_eartHDragon = 97403510,
} }
} }
...@@ -80,6 +80,7 @@ ...@@ -80,6 +80,7 @@
CyberDragonInfinity = 10443957, CyberDragonInfinity = 10443957,
ImperialCustom = 9995766, ImperialCustom = 9995766,
InspectorBoarder = 15397015, InspectorBoarder = 15397015,
Mashoudou = 76375976 Mashoudou = 76375976,
EternalSoul = 48680970
} }
} }
...@@ -14,6 +14,7 @@ namespace WindBot.Game.AI ...@@ -14,6 +14,7 @@ namespace WindBot.Game.AI
public Duel Duel { get; private set; } public Duel Duel { get; private set; }
public IList<CardExecutor> Executors { get; private set; } public IList<CardExecutor> Executors { get; private set; }
public GameAI AI { get; private set; } public GameAI AI { get; private set; }
public AIUtil Util { get; private set; }
protected MainPhase Main { get; private set; } protected MainPhase Main { get; private set; }
protected BattlePhase Battle { get; private set; } protected BattlePhase Battle { get; private set; }
...@@ -29,6 +30,7 @@ namespace WindBot.Game.AI ...@@ -29,6 +30,7 @@ namespace WindBot.Game.AI
{ {
Duel = duel; Duel = duel;
AI = ai; AI = ai;
Util = new AIUtil(duel);
Executors = new List<CardExecutor>(); Executors = new List<CardExecutor>();
Bot = Duel.Fields[0]; Bot = Duel.Fields[0];
...@@ -168,7 +170,7 @@ namespace WindBot.Game.AI ...@@ -168,7 +170,7 @@ namespace WindBot.Game.AI
return -1; return -1;
} }
public virtual int OnSelectPlace(int cardId, int player, int location, int available) public virtual int OnSelectPlace(int cardId, int player, CardLocation location, int available)
{ {
// For overriding // For overriding
return 0; return 0;
......
This diff is collapsed.
...@@ -150,12 +150,17 @@ namespace WindBot.Game ...@@ -150,12 +150,17 @@ namespace WindBot.Game
public List<ClientCard> GetMonstersInExtraZone() public List<ClientCard> GetMonstersInExtraZone()
{ {
return GetMonsters().Where((card, i) => i >= 5).ToList(); return GetMonsters().Where(card => card.Sequence >= 5).ToList();
} }
public List<ClientCard> GetMonstersInMainZone() public List<ClientCard> GetMonstersInMainZone()
{ {
return GetMonsters().Where((card, i) => i < 5).ToList(); return GetMonsters().Where(card => card.Sequence < 5).ToList();
}
public ClientCard GetFieldSpellCard()
{
return SpellZone[5];
} }
public bool HasInHand(int cardId) public bool HasInHand(int cardId)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment