Commit c6693bfb authored by mercury233's avatar mercury233

Merge branch 'master' of https://github.com/IceYGO/windbot

parents 1fd695cb 6d33997d
#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
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>
...@@ -117,7 +92,7 @@ namespace WindBot.Game.AI ...@@ -117,7 +92,7 @@ namespace WindBot.Game.AI
.OrderByDescending(card => card.GetDefensePower()) .OrderByDescending(card => card.GetDefensePower())
.FirstOrDefault(); .FirstOrDefault();
} }
public ClientCard GetWorstBotMonster(bool onlyATK = false) public ClientCard GetWorstBotMonster(bool onlyATK = false)
{ {
return Bot.MonsterZone.GetMonsters() return Bot.MonsterZone.GetMonsters()
...@@ -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)
{
return card == null || list.Contains(card);
}
public int GetBotAvailZonesFromExtraDeck(IList<ClientCard> remove) 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++)
{
if (remove.Contains(BotMZone[i])) BotMZone[i] = null;
if (remove.Contains(EnemyMZone[i])) EnemyMZone[i] = null;
}
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,32 @@ namespace WindBot.Game.AI ...@@ -7,6 +7,32 @@ 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 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 +116,21 @@ namespace WindBot.Game.AI ...@@ -90,6 +116,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()));
......
...@@ -271,7 +271,7 @@ namespace WindBot.Game.AI.Decks ...@@ -271,7 +271,7 @@ namespace WindBot.Game.AI.Decks
public bool is_should_not_negate() public bool is_should_not_negate()
{ {
ClientCard last_card = AI.Utils.GetLastChainCard(); ClientCard last_card = Util.GetLastChainCard();
if (last_card != null if (last_card != null
&& last_card.Controller == 1 && last_card.IsCode(should_not_negate)) && last_card.Controller == 1 && last_card.IsCode(should_not_negate))
return true; return true;
...@@ -479,7 +479,7 @@ namespace WindBot.Game.AI.Decks ...@@ -479,7 +479,7 @@ namespace WindBot.Game.AI.Decks
if (card != null) if (card != null)
return card; return card;
List<ClientCard> enemy_monsters = Enemy.GetMonsters(); List<ClientCard> enemy_monsters = Enemy.GetMonsters();
enemy_monsters.Sort(AIFunctions.CompareCardAttack); enemy_monsters.Sort(CardContainer.CompareCardAttack);
enemy_monsters.Reverse(); enemy_monsters.Reverse();
foreach(ClientCard target in enemy_monsters) foreach(ClientCard target in enemy_monsters)
{ {
...@@ -496,10 +496,10 @@ namespace WindBot.Game.AI.Decks ...@@ -496,10 +496,10 @@ namespace WindBot.Game.AI.Decks
public ClientCard GetBestEnemyCard_random() public ClientCard GetBestEnemyCard_random()
{ {
// monsters // monsters
ClientCard card = AI.Utils.GetProblematicEnemyMonster(0, true); ClientCard card = Util.GetProblematicEnemyMonster(0, true);
if (card != null) if (card != null)
return card; return card;
if (AI.Utils.GetOneEnemyBetterThanMyBest() != null) if (Util.GetOneEnemyBetterThanMyBest() != null)
{ {
card = Enemy.MonsterZone.GetHighestAttackMonster(true); card = Enemy.MonsterZone.GetHighestAttackMonster(true);
if (card != null) if (card != null)
...@@ -619,11 +619,11 @@ namespace WindBot.Game.AI.Decks ...@@ -619,11 +619,11 @@ namespace WindBot.Game.AI.Decks
if (!spell_trap_activate()) return false; if (!spell_trap_activate()) return false;
if (Bot.LifePoints <= 1000) if (Bot.LifePoints <= 1000)
return false; return false;
if (Bot.LifePoints - 1000 <= Enemy.LifePoints && ActivateDescription == AI.Utils.GetStringId(_CardId.ChickenGame, 0)) if (Bot.LifePoints - 1000 <= Enemy.LifePoints && ActivateDescription == Util.GetStringId(_CardId.ChickenGame, 0))
{ {
return true; return true;
} }
if (Bot.LifePoints - 1000 > Enemy.LifePoints && ActivateDescription == AI.Utils.GetStringId(_CardId.ChickenGame, 1)) if (Bot.LifePoints - 1000 > Enemy.LifePoints && ActivateDescription == Util.GetStringId(_CardId.ChickenGame, 1))
{ {
return true; return true;
} }
...@@ -693,11 +693,11 @@ namespace WindBot.Game.AI.Decks ...@@ -693,11 +693,11 @@ namespace WindBot.Game.AI.Decks
public bool SolemnJudgment_activate() public bool SolemnJudgment_activate()
{ {
if (AI.Utils.IsChainTargetOnly(Card) && (Bot.HasInHand(CardId.Multifaker) || Multifaker_candeckss())) return false; if (Util.IsChainTargetOnly(Card) && (Bot.HasInHand(CardId.Multifaker) || Multifaker_candeckss())) return false;
if (!Should_counter()) return false; if (!Should_counter()) return false;
if ((DefaultSolemnJudgment() && spell_trap_activate(true))) if ((DefaultSolemnJudgment() && spell_trap_activate(true)))
{ {
ClientCard target = AI.Utils.GetLastChainCard(); ClientCard target = Util.GetLastChainCard();
if (target != null && !target.IsMonster() && !spell_trap_activate(false, target)) return false; if (target != null && !target.IsMonster() && !spell_trap_activate(false, target)) return false;
return true; return true;
} }
...@@ -733,7 +733,7 @@ namespace WindBot.Game.AI.Decks ...@@ -733,7 +733,7 @@ namespace WindBot.Game.AI.Decks
} }
} }
ClientCard LastChainCard = AI.Utils.GetLastChainCard(); ClientCard LastChainCard = Util.GetLastChainCard();
if (LastChainCard == null if (LastChainCard == null
&& !(Duel.Player == 1 && Duel.Phase > DuelPhase.Main2 && Bot.HasInHand(CardId.Multifaker) && Multifaker_candeckss() && !Multifaker_ssfromhand)) && !(Duel.Player == 1 && Duel.Phase > DuelPhase.Main2 && Bot.HasInHand(CardId.Multifaker) && Multifaker_candeckss() && !Multifaker_ssfromhand))
...@@ -748,16 +748,16 @@ namespace WindBot.Game.AI.Decks ...@@ -748,16 +748,16 @@ namespace WindBot.Game.AI.Decks
if (Bot.SpellZone[i] == Card) this_seq = i; if (Bot.SpellZone[i] == Card) this_seq = i;
if (LastChainCard != null if (LastChainCard != null
&& LastChainCard.Controller == 1 && LastChainCard.Location == CardLocation.SpellZone && Enemy.SpellZone[i] == LastChainCard) that_seq = i; && LastChainCard.Controller == 1 && LastChainCard.Location == CardLocation.SpellZone && Enemy.SpellZone[i] == LastChainCard) that_seq = i;
else if (Duel.Player == 0 && AI.Utils.GetProblematicEnemySpell() != null else if (Duel.Player == 0 && Util.GetProblematicEnemySpell() != null
&& Enemy.SpellZone[i] != null && Enemy.SpellZone[i].IsFloodgate()) that_seq = i; && Enemy.SpellZone[i] != null && Enemy.SpellZone[i].IsFloodgate()) that_seq = i;
} }
if ( (this_seq * that_seq >= 0 && this_seq + that_seq == 4) if ( (this_seq * that_seq >= 0 && this_seq + that_seq == 4)
|| (AI.Utils.IsChainTarget(Card)) || (Util.IsChainTarget(Card))
|| (LastChainCard != null && LastChainCard.Controller == 1 && LastChainCard.IsCode(_CardId.HarpiesFeatherDuster)) || (LastChainCard != null && LastChainCard.Controller == 1 && LastChainCard.IsCode(_CardId.HarpiesFeatherDuster))
|| (Duel.Player == 1 && Duel.Phase > DuelPhase.Main2 && Bot.HasInHand(CardId.Multifaker) && Multifaker_candeckss() && !Multifaker_ssfromhand)) || (Duel.Player == 1 && Duel.Phase > DuelPhase.Main2 && Bot.HasInHand(CardId.Multifaker) && Multifaker_candeckss() && !Multifaker_ssfromhand))
{ {
List<ClientCard> enemy_monsters = Enemy.GetMonsters(); List<ClientCard> enemy_monsters = Enemy.GetMonsters();
enemy_monsters.Sort(AIFunctions.CompareCardAttack); enemy_monsters.Sort(CardContainer.CompareCardAttack);
enemy_monsters.Reverse(); enemy_monsters.Reverse();
foreach(ClientCard card in enemy_monsters) foreach(ClientCard card in enemy_monsters)
{ {
...@@ -795,7 +795,7 @@ namespace WindBot.Game.AI.Decks ...@@ -795,7 +795,7 @@ namespace WindBot.Game.AI.Decks
else else
{ {
List<ClientCard> enemy_monsters = Enemy.GetMonsters(); List<ClientCard> enemy_monsters = Enemy.GetMonsters();
enemy_monsters.Sort(AIFunctions.CompareCardAttack); enemy_monsters.Sort(CardContainer.CompareCardAttack);
enemy_monsters.Reverse(); enemy_monsters.Reverse();
foreach (ClientCard card in enemy_monsters) foreach (ClientCard card in enemy_monsters)
{ {
...@@ -990,7 +990,7 @@ namespace WindBot.Game.AI.Decks ...@@ -990,7 +990,7 @@ namespace WindBot.Game.AI.Decks
public bool Feather_activate() public bool Feather_activate()
{ {
if (!spell_trap_activate()) return false; if (!spell_trap_activate()) return false;
if (AI.Utils.GetProblematicEnemySpell() != null) if (Util.GetProblematicEnemySpell() != null)
{ {
AI.SelectPlace(SelectSTPlace(Card, true)); AI.SelectPlace(SelectSTPlace(Card, true));
return true; return true;
...@@ -1039,8 +1039,8 @@ namespace WindBot.Game.AI.Decks ...@@ -1039,8 +1039,8 @@ namespace WindBot.Game.AI.Decks
} }
if (Duel.Phase == DuelPhase.End if (Duel.Phase == DuelPhase.End
|| activate_immediately >= 2 || activate_immediately >= 2
|| (AI.Utils.IsChainTarget(Card) || (Util.IsChainTarget(Card)
|| (AI.Utils.GetLastChainCard() != null && AI.Utils.GetLastChainCard().Controller == 1 && AI.Utils.GetLastChainCard().IsCode(_CardId.HarpiesFeatherDuster)))) || (Util.GetLastChainCard() != null && Util.GetLastChainCard().Controller == 1 && Util.GetLastChainCard().IsCode(_CardId.HarpiesFeatherDuster))))
{ {
if (select_list.Count > 0) if (select_list.Count > 0)
{ {
...@@ -1057,7 +1057,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1057,7 +1057,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Duel.Phase > DuelPhase.Main1 && Duel.Phase < DuelPhase.Main2) if (Duel.Phase > DuelPhase.Main1 && Duel.Phase < DuelPhase.Main2)
{ {
if (AI.Utils.ChainContainsCard(CardId.Linkuriboh)) return false; if (Util.ChainContainsCard(CardId.Linkuriboh)) return false;
if (Bot.BattlingMonster == null || (Enemy.BattlingMonster.Attack >= Bot.BattlingMonster.GetDefensePower()) || Enemy.BattlingMonster.IsMonsterDangerous()) if (Bot.BattlingMonster == null || (Enemy.BattlingMonster.Attack >= Bot.BattlingMonster.GetDefensePower()) || Enemy.BattlingMonster.IsMonsterDangerous())
{ {
AI.SelectPosition(CardPosition.FaceUpDefence); AI.SelectPosition(CardPosition.FaceUpDefence);
...@@ -1137,19 +1137,19 @@ namespace WindBot.Game.AI.Decks ...@@ -1137,19 +1137,19 @@ namespace WindBot.Game.AI.Decks
} }
} }
} }
if (!AI.Utils.IsTurn1OrMain2()) if (!Util.IsTurn1OrMain2())
{ {
ClientCard self_best = AI.Utils.GetBestBotMonster(); ClientCard self_best = Util.GetBestBotMonster();
ClientCard enemy_best = AI.Utils.GetProblematicEnemyCard(self_best.Attack, true); ClientCard enemy_best = Util.GetProblematicEnemyCard(self_best.Attack, true);
ClientCard enemy_target = GetProblematicEnemyCard_Alter(true,false); ClientCard enemy_target = GetProblematicEnemyCard_Alter(true,false);
if ((enemy_best != null || enemy_target != null) if ((enemy_best != null || enemy_target != null)
&& Bot.HasInGraveyard(CardId.Meluseek)) next_card = CardId.Meluseek; && Bot.HasInGraveyard(CardId.Meluseek)) next_card = CardId.Meluseek;
else if (Enemy.GetMonsterCount() <= 1 && Bot.HasInGraveyard(CardId.Meluseek) && Enemy.GetFieldCount() > 0) next_card = CardId.Meluseek; else if (Enemy.GetMonsterCount() <= 1 && Bot.HasInGraveyard(CardId.Meluseek) && Enemy.GetFieldCount() > 0) next_card = CardId.Meluseek;
else if (Bot.HasInGraveyard(CardId.Hexstia) && AI.Utils.GetProblematicEnemySpell() == null && AI.Utils.GetOneEnemyBetterThanValue(3100, true) == null && can_choose_other) else if (Bot.HasInGraveyard(CardId.Hexstia) && Util.GetProblematicEnemySpell() == null && Util.GetOneEnemyBetterThanValue(3100, true) == null && can_choose_other)
{ {
next_card = CardId.Hexstia; next_card = CardId.Hexstia;
choose_other = (AI.Utils.GetOneEnemyBetterThanMyBest(true) != null); choose_other = (Util.GetOneEnemyBetterThanMyBest(true) != null);
} }
} }
else else
...@@ -1210,18 +1210,18 @@ namespace WindBot.Game.AI.Decks ...@@ -1210,18 +1210,18 @@ namespace WindBot.Game.AI.Decks
AI.SelectCard(CardId.Protocol); AI.SelectCard(CardId.Protocol);
AI.SelectNextCard(next_card); AI.SelectNextCard(next_card);
Marionetter_reborn = true; Marionetter_reborn = true;
if (next_card == CardId.Meluseek && AI.Utils.IsTurn1OrMain2()) AI.SelectPosition(CardPosition.FaceUpDefence); if (next_card == CardId.Meluseek && Util.IsTurn1OrMain2()) AI.SelectPosition(CardPosition.FaceUpDefence);
return true; return true;
} }
List<ClientCard> list = Bot.GetMonsters(); List<ClientCard> list = Bot.GetMonsters();
list.Sort(AIFunctions.CompareCardAttack); list.Sort(CardContainer.CompareCardAttack);
foreach (ClientCard card in list) foreach (ClientCard card in list)
{ {
if (isAltergeist(card) && !(choose_other && card == Card)) if (isAltergeist(card) && !(choose_other && card == Card))
{ {
AI.SelectCard(card); AI.SelectCard(card);
AI.SelectNextCard(next_card); AI.SelectNextCard(next_card);
if (next_card == CardId.Meluseek && AI.Utils.IsTurn1OrMain2()) AI.SelectPosition(CardPosition.FaceUpDefence); if (next_card == CardId.Meluseek && Util.IsTurn1OrMain2()) AI.SelectPosition(CardPosition.FaceUpDefence);
Marionetter_reborn = true; Marionetter_reborn = true;
return true; return true;
} }
...@@ -1239,7 +1239,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1239,7 +1239,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Card.Location == CardLocation.MonsterZone && Duel.LastChainPlayer != 0 && (Protocol_activing() || !Card.IsDisabled())) if (Card.Location == CardLocation.MonsterZone && Duel.LastChainPlayer != 0 && (Protocol_activing() || !Card.IsDisabled()))
{ {
ClientCard target = AI.Utils.GetLastChainCard(); ClientCard target = Util.GetLastChainCard();
if (target != null && !spell_trap_activate(false, target)) return false; if (target != null && !spell_trap_activate(false, target)) return false;
if (!Should_counter()) return false; if (!Should_counter()) return false;
// check // check
...@@ -1256,7 +1256,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1256,7 +1256,7 @@ namespace WindBot.Game.AI.Decks
} }
return true; return true;
} }
if (ActivateDescription == AI.Utils.GetStringId(CardId.Hexstia,0)) return false; if (ActivateDescription == Util.GetStringId(CardId.Hexstia,0)) return false;
if (Enemy.HasInSpellZone(82732705) && Bot.GetRemainingCount(CardId.Protocol,3) > 0 && !Bot.HasInHandOrInSpellZone(CardId.Protocol)) if (Enemy.HasInSpellZone(82732705) && Bot.GetRemainingCount(CardId.Protocol,3) > 0 && !Bot.HasInHandOrInSpellZone(CardId.Protocol))
{ {
AI.SelectCard(CardId.Protocol); AI.SelectCard(CardId.Protocol);
...@@ -1301,7 +1301,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1301,7 +1301,7 @@ namespace WindBot.Game.AI.Decks
public bool Meluseek_eff() public bool Meluseek_eff()
{ {
if (ActivateDescription == AI.Utils.GetStringId(CardId.Meluseek,0) if (ActivateDescription == Util.GetStringId(CardId.Meluseek,0)
|| (ActivateDescription == -1 && Card.Location == CardLocation.MonsterZone)) || (ActivateDescription == -1 && Card.Location == CardLocation.MonsterZone))
{ {
attacked_Meluseek.Add(Card); attacked_Meluseek.Add(Card);
...@@ -1311,7 +1311,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1311,7 +1311,7 @@ namespace WindBot.Game.AI.Decks
AI.SelectCard(target); AI.SelectCard(target);
return true; return true;
} }
target = AI.Utils.GetOneEnemyBetterThanMyBest(true, true); target = Util.GetOneEnemyBetterThanMyBest(true, true);
if (target != null) if (target != null)
{ {
AI.SelectCard(target); AI.SelectCard(target);
...@@ -1384,7 +1384,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1384,7 +1384,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (!Multifaker_candeckss() || Card.Location != CardLocation.Hand) return false; if (!Multifaker_candeckss() || Card.Location != CardLocation.Hand) return false;
Multifaker_ssfromhand = true; Multifaker_ssfromhand = true;
if (Duel.Player != 0 && AI.Utils.GetOneEnemyBetterThanMyBest() != null) AI.SelectPosition(CardPosition.FaceUpDefence); if (Duel.Player != 0 && Util.GetOneEnemyBetterThanMyBest() != null) AI.SelectPosition(CardPosition.FaceUpDefence);
return true; return true;
} }
...@@ -1429,7 +1429,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1429,7 +1429,7 @@ namespace WindBot.Game.AI.Decks
public bool Silquitous_eff() public bool Silquitous_eff()
{ {
if (ActivateDescription != AI.Utils.GetStringId(CardId.Silquitous,0)) if (ActivateDescription != Util.GetStringId(CardId.Silquitous,0))
{ {
if (!Bot.HasInHandOrInSpellZone(CardId.Manifestation) && Bot.HasInGraveyard(CardId.Manifestation)) if (!Bot.HasInHandOrInSpellZone(CardId.Manifestation) && Bot.HasInGraveyard(CardId.Manifestation))
{ {
...@@ -1461,7 +1461,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1461,7 +1461,7 @@ namespace WindBot.Game.AI.Decks
} }
} }
if (spell.IsCode(CardId.Manifestation) && spell.IsFaceup()) faceup_Manifestation = spell; if (spell.IsCode(CardId.Manifestation) && spell.IsFaceup()) faceup_Manifestation = spell;
if (Duel.LastChainPlayer != 0 && AI.Utils.IsChainTarget(spell) && spell.IsFaceup() && isAltergeist(spell)) if (Duel.LastChainPlayer != 0 && Util.IsChainTarget(spell) && spell.IsFaceup() && isAltergeist(spell))
{ {
selected_target = spell; selected_target = spell;
} }
...@@ -1479,12 +1479,12 @@ namespace WindBot.Game.AI.Decks ...@@ -1479,12 +1479,12 @@ namespace WindBot.Game.AI.Decks
ClientCard faceup_Multifaker = null; ClientCard faceup_Multifaker = null;
ClientCard faceup_monster = null; ClientCard faceup_monster = null;
List<ClientCard> monster_list = Bot.GetMonsters(); List<ClientCard> monster_list = Bot.GetMonsters();
monster_list.Sort(AIFunctions.CompareCardAttack); monster_list.Sort(CardContainer.CompareCardAttack);
foreach(ClientCard card in monster_list) foreach(ClientCard card in monster_list)
{ {
if (card.IsFaceup() && isAltergeist(card) && card != Card) if (card.IsFaceup() && isAltergeist(card) && card != Card)
{ {
if (Duel.LastChainPlayer != 0 && AI.Utils.IsChainTarget(card) && card.IsFaceup()) if (Duel.LastChainPlayer != 0 && Util.IsChainTarget(card) && card.IsFaceup())
{ {
selected_target = card; selected_target = card;
} }
...@@ -1512,13 +1512,13 @@ namespace WindBot.Game.AI.Decks ...@@ -1512,13 +1512,13 @@ namespace WindBot.Game.AI.Decks
if (Duel.LastChainPlayer != 0) if (Duel.LastChainPlayer != 0)
{ {
Logger.DebugWriteLine("Silquitous: battle"); Logger.DebugWriteLine("Silquitous: battle");
if (AI.Utils.ChainContainsCard(CardId.Linkuriboh) || Bot.HasInHand(CardId.Kunquery)) return false; if (Util.ChainContainsCard(CardId.Linkuriboh) || Bot.HasInHand(CardId.Kunquery)) return false;
if (Enemy.BattlingMonster != null && Bot.BattlingMonster != null && Enemy.BattlingMonster.GetDefensePower() >= Bot.BattlingMonster.GetDefensePower()) if (Enemy.BattlingMonster != null && Bot.BattlingMonster != null && Enemy.BattlingMonster.GetDefensePower() >= Bot.BattlingMonster.GetDefensePower())
{ {
if (Bot.HasInMonstersZone(CardId.Kunquery)) AI.SelectCard(CardId.Kunquery); if (Bot.HasInMonstersZone(CardId.Kunquery)) AI.SelectCard(CardId.Kunquery);
else AI.SelectCard(bounce_self); else AI.SelectCard(bounce_self);
List<ClientCard> enemy_list = Enemy.GetMonsters(); List<ClientCard> enemy_list = Enemy.GetMonsters();
enemy_list.Sort(AIFunctions.CompareCardAttack); enemy_list.Sort(CardContainer.CompareCardAttack);
enemy_list.Reverse(); enemy_list.Reverse();
foreach(ClientCard target in enemy_list) foreach(ClientCard target in enemy_list)
{ {
...@@ -1567,8 +1567,8 @@ namespace WindBot.Game.AI.Decks ...@@ -1567,8 +1567,8 @@ namespace WindBot.Game.AI.Decks
{ {
if (Card.Location == CardLocation.Grave) if (Card.Location == CardLocation.Grave)
{ {
if (AI.Utils.ChainContainsCard(CardId.Silquitous)) return false; if (Util.ChainContainsCard(CardId.Silquitous)) return false;
if (!Bot.HasInHandOrInSpellZone(CardId.Protocol) && !AI.Utils.ChainContainsCard(CardId.Protocol)) if (!Bot.HasInHandOrInSpellZone(CardId.Protocol) && !Util.ChainContainsCard(CardId.Protocol))
{ {
AI.SelectCard(CardId.Protocol); AI.SelectCard(CardId.Protocol);
return true; return true;
...@@ -1577,8 +1577,8 @@ namespace WindBot.Game.AI.Decks ...@@ -1577,8 +1577,8 @@ namespace WindBot.Game.AI.Decks
} }
else else
{ {
if (AI.Utils.ChainContainsCard(CardId.Manifestation) || AI.Utils.ChainContainsCard(CardId.Spoofing)) return false; if (Util.ChainContainsCard(CardId.Manifestation) || Util.ChainContainsCard(CardId.Spoofing)) return false;
if (Duel.LastChainPlayer == 0 && !(AI.Utils.GetLastChainCard() != null && AI.Utils.GetLastChainCard().IsCode(CardId.Hexstia))) return false; if (Duel.LastChainPlayer == 0 && !(Util.GetLastChainCard() != null && Util.GetLastChainCard().IsCode(CardId.Hexstia))) return false;
if (Bot.HasInMonstersZone(CardId.Hexstia)) if (Bot.HasInMonstersZone(CardId.Hexstia))
{ {
...@@ -1644,9 +1644,9 @@ namespace WindBot.Game.AI.Decks ...@@ -1644,9 +1644,9 @@ namespace WindBot.Game.AI.Decks
public bool Protocol_negate_better() public bool Protocol_negate_better()
{ {
// skip if no one of enemy's monsters is better // skip if no one of enemy's monsters is better
if (ActivateDescription == AI.Utils.GetStringId(CardId.Protocol, 1)) if (ActivateDescription == Util.GetStringId(CardId.Protocol, 1))
{ {
if (AI.Utils.GetOneEnemyBetterThanMyBest(true) == null) return false; if (Util.GetOneEnemyBetterThanMyBest(true) == null) return false;
} }
return Protocol_negate(); return Protocol_negate();
} }
...@@ -1654,7 +1654,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1654,7 +1654,7 @@ namespace WindBot.Game.AI.Decks
public bool Protocol_negate() public bool Protocol_negate()
{ {
// negate // negate
if (ActivateDescription == AI.Utils.GetStringId(CardId.Protocol, 1) && (!Card.IsDisabled() || Protocol_activing())) if (ActivateDescription == Util.GetStringId(CardId.Protocol, 1) && (!Card.IsDisabled() || Protocol_activing()))
{ {
if (!Should_counter()) return false; if (!Should_counter()) return false;
if (is_should_not_negate()) return false; if (is_should_not_negate()) return false;
...@@ -1690,7 +1690,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1690,7 +1690,7 @@ namespace WindBot.Game.AI.Decks
} }
} }
List<int> cost_list = new List<int>(); List<int> cost_list = new List<int>();
if (AI.Utils.ChainContainsCard(CardId.Manifestation)) cost_list.Add(CardId.Manifestation); if (Util.ChainContainsCard(CardId.Manifestation)) cost_list.Add(CardId.Manifestation);
if (!Card.IsDisabled()) cost_list.Add(CardId.Protocol); if (!Card.IsDisabled()) cost_list.Add(CardId.Protocol);
cost_list.Add(CardId.Multifaker); cost_list.Add(CardId.Multifaker);
cost_list.Add(CardId.Marionetter); cost_list.Add(CardId.Marionetter);
...@@ -1718,7 +1718,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1718,7 +1718,7 @@ namespace WindBot.Game.AI.Decks
} }
if (!Silquitous_bounced) cost_list.Add(CardId.Silquitous); if (!Silquitous_bounced) cost_list.Add(CardId.Silquitous);
if (!Meluseek_searched) cost_list.Add(CardId.Meluseek); if (!Meluseek_searched) cost_list.Add(CardId.Meluseek);
if (!AI.Utils.ChainContainsCard(CardId.Manifestation)) cost_list.Add(CardId.Manifestation); if (!Util.ChainContainsCard(CardId.Manifestation)) cost_list.Add(CardId.Manifestation);
AI.SelectCard(cost_list); AI.SelectCard(cost_list);
return true; return true;
} }
...@@ -1727,10 +1727,10 @@ namespace WindBot.Game.AI.Decks ...@@ -1727,10 +1727,10 @@ namespace WindBot.Game.AI.Decks
public bool Protocol_activate_not_use() public bool Protocol_activate_not_use()
{ {
if (AI.Utils.GetLastChainCard() != null && AI.Utils.GetLastChainCard().Controller == 0 && AI.Utils.GetLastChainCard().IsTrap()) return false; if (Util.GetLastChainCard() != null && Util.GetLastChainCard().Controller == 0 && Util.GetLastChainCard().IsTrap()) return false;
if (ActivateDescription != AI.Utils.GetStringId(CardId.Protocol, 1)) if (ActivateDescription != Util.GetStringId(CardId.Protocol, 1))
{ {
if (AI.Utils.IsChainTarget(Card) && Card.IsFacedown()) return true; if (Util.IsChainTarget(Card) && Card.IsFacedown()) return true;
if (Should_activate_Protocol()) return true; if (Should_activate_Protocol()) return true;
if (!Multifaker_ssfromhand && Multifaker_candeckss() && (Bot.HasInHand(CardId.Multifaker) || Bot.HasInSpellZone(CardId.Spoofing))) if (!Multifaker_ssfromhand && Multifaker_candeckss() && (Bot.HasInHand(CardId.Multifaker) || Bot.HasInSpellZone(CardId.Spoofing)))
{ {
...@@ -1760,7 +1760,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1760,7 +1760,7 @@ namespace WindBot.Game.AI.Decks
} }
} }
if (can_bounce == 10 || should_disnegate) return true; if (can_bounce == 10 || should_disnegate) return true;
if (Duel.Phase > DuelPhase.Main1 && Duel.Phase < DuelPhase.Main2 && Bot.HasInHand(CardId.Kunquery) && AI.Utils.GetOneEnemyBetterThanMyBest() != null) return true; if (Duel.Phase > DuelPhase.Main1 && Duel.Phase < DuelPhase.Main2 && Bot.HasInHand(CardId.Kunquery) && Util.GetOneEnemyBetterThanMyBest() != null) return true;
} }
return false; return false;
} }
...@@ -1783,7 +1783,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1783,7 +1783,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (int id in list) foreach (int id in list)
{ {
if (card.IsCode(id) && !(id == CardId.Multifaker && AI.Utils.GetLastChainCard() == card)) if (card.IsCode(id) && !(id == CardId.Multifaker && Util.GetLastChainCard() == card))
{ {
AI.SelectCard(card); AI.SelectCard(card);
return; return;
...@@ -1817,9 +1817,9 @@ namespace WindBot.Game.AI.Decks ...@@ -1817,9 +1817,9 @@ namespace WindBot.Game.AI.Decks
public bool Spoofing_eff() public bool Spoofing_eff()
{ {
if (AI.Utils.ChainContainsCard(CardId.Spoofing)) return false; if (Util.ChainContainsCard(CardId.Spoofing)) return false;
if (Card.IsDisabled()) return false; if (Card.IsDisabled()) return false;
if (!AI.Utils.ChainContainPlayer(0) && !Multifaker_ssfromhand && Multifaker_candeckss() && Bot.HasInHand(CardId.Multifaker) && Card.HasPosition(CardPosition.FaceDown)) if (!Util.ChainContainPlayer(0) && !Multifaker_ssfromhand && Multifaker_candeckss() && Bot.HasInHand(CardId.Multifaker) && Card.HasPosition(CardPosition.FaceDown))
{ {
AI.SelectYesNo(false); AI.SelectYesNo(false);
return true; return true;
...@@ -1913,9 +1913,9 @@ namespace WindBot.Game.AI.Decks ...@@ -1913,9 +1913,9 @@ namespace WindBot.Game.AI.Decks
} }
else else
{ {
ClientCard self_best = AI.Utils.GetBestBotMonster(); ClientCard self_best = Util.GetBestBotMonster();
int best_atk = self_best == null ? 0 : self_best.Attack; int best_atk = self_best == null ? 0 : self_best.Attack;
ClientCard enemy_best = AI.Utils.GetProblematicEnemyCard(best_atk, true); ClientCard enemy_best = Util.GetProblematicEnemyCard(best_atk, true);
ClientCard enemy_target = GetProblematicEnemyCard_Alter(true, false); ClientCard enemy_target = GetProblematicEnemyCard_Alter(true, false);
if (!Multifaker_ssfromhand && Multifaker_candeckss() && can_ss_Multifaker) if (!Multifaker_ssfromhand && Multifaker_candeckss() && can_ss_Multifaker)
...@@ -2019,7 +2019,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2019,7 +2019,7 @@ namespace WindBot.Game.AI.Decks
bool go = false; bool go = false;
foreach(ClientCard card in Bot.GetSpells()) foreach(ClientCard card in Bot.GetSpells())
{ {
if ( (AI.Utils.ChainContainsCard(_CardId.HarpiesFeatherDuster) || AI.Utils.IsChainTarget(card)) if ( (Util.ChainContainsCard(_CardId.HarpiesFeatherDuster) || Util.IsChainTarget(card))
&& card.IsFaceup() && Duel.LastChainPlayer != 0 && isAltergeist(card)) && card.IsFaceup() && Duel.LastChainPlayer != 0 && isAltergeist(card))
{ {
AI.SelectCard(card); AI.SelectCard(card);
...@@ -2031,7 +2031,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2031,7 +2031,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard card in Bot.GetMonsters()) foreach (ClientCard card in Bot.GetMonsters())
{ {
if ( (AI.Utils.IsChainTarget(card) || AI.Utils.ChainContainsCard(CardId.DarkHole) || (!Protocol_activing() && card.IsDisabled())) if ( (Util.IsChainTarget(card) || Util.ChainContainsCard(CardId.DarkHole) || (!Protocol_activing() && card.IsDisabled()))
&& card.IsFaceup() && Duel.LastChainPlayer != 0 && isAltergeist(card)) && card.IsFaceup() && Duel.LastChainPlayer != 0 && isAltergeist(card))
{ {
Logger.DebugWriteLine("Spoofing target:" + card?.Name); Logger.DebugWriteLine("Spoofing target:" + card?.Name);
...@@ -2065,7 +2065,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2065,7 +2065,7 @@ namespace WindBot.Game.AI.Decks
CardId.Kunquery, CardId.Kunquery,
CardId.GO_SR CardId.GO_SR
); );
if (AI.Utils.IsTurn1OrMain2()) AI.SelectPosition(CardPosition.FaceUpDefence); if (Util.IsTurn1OrMain2()) AI.SelectPosition(CardPosition.FaceUpDefence);
return true; return true;
} }
if (!summoned && !Meluseek_searched && !Bot.HasInHand(CardId.Marionetter)) if (!summoned && !Meluseek_searched && !Bot.HasInHand(CardId.Marionetter))
...@@ -2272,7 +2272,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2272,7 +2272,7 @@ namespace WindBot.Game.AI.Decks
public bool Linkuriboh_ss() public bool Linkuriboh_ss()
{ {
if (Bot.GetMonstersExtraZoneCount() > 0) return false; if (Bot.GetMonstersExtraZoneCount() > 0) return false;
if (AI.Utils.IsTurn1OrMain2() && !Meluseek_searched) if (Util.IsTurn1OrMain2() && !Meluseek_searched)
{ {
AI.SelectPlace(Zones.z5); AI.SelectPlace(Zones.z5);
ss_other_monster = true; ss_other_monster = true;
...@@ -2283,8 +2283,8 @@ namespace WindBot.Game.AI.Decks ...@@ -2283,8 +2283,8 @@ namespace WindBot.Game.AI.Decks
public bool Linkuriboh_eff() public bool Linkuriboh_eff()
{ {
if (AI.Utils.ChainContainsCard(CardId.Linkuriboh)) return false; if (Util.ChainContainsCard(CardId.Linkuriboh)) return false;
if (AI.Utils.ChainContainsCard(CardId.Multifaker)) return false; if (Util.ChainContainsCard(CardId.Multifaker)) return false;
if (Duel.Player == 1) if (Duel.Player == 1)
{ {
if (Card.Location == CardLocation.Grave) if (Card.Location == CardLocation.Grave)
...@@ -2311,7 +2311,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2311,7 +2311,7 @@ namespace WindBot.Game.AI.Decks
AI.SelectPlace(Zones.z0 | Zones.z4); AI.SelectPlace(Zones.z0 | Zones.z4);
return true; return true;
} }
else if (AI.Utils.IsTurn1OrMain2()) else if (Util.IsTurn1OrMain2())
{ {
AI.SelectCard(new[] { CardId.Meluseek }); AI.SelectCard(new[] { CardId.Meluseek });
ss_other_monster = true; ss_other_monster = true;
...@@ -2340,7 +2340,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2340,7 +2340,7 @@ namespace WindBot.Game.AI.Decks
{ {
List<ClientCard> targets = new List<ClientCard>(); List<ClientCard> targets = new List<ClientCard>();
List<ClientCard> list = Bot.GetMonsters(); List<ClientCard> list = Bot.GetMonsters();
list.Sort(AIFunctions.CompareCardAttack); list.Sort(CardContainer.CompareCardAttack);
//list.Reverse(); //list.Reverse();
bool Meluseek_selected = false; bool Meluseek_selected = false;
bool Silquitous_selected = false; bool Silquitous_selected = false;
...@@ -2405,7 +2405,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2405,7 +2405,7 @@ namespace WindBot.Game.AI.Decks
public bool TripleBurstDragon_eff() public bool TripleBurstDragon_eff()
{ {
if (ActivateDescription != AI.Utils.GetStringId(CardId.TripleBurstDragon,0)) return false; if (ActivateDescription != Util.GetStringId(CardId.TripleBurstDragon,0)) return false;
return (Duel.LastChainPlayer != 0); return (Duel.LastChainPlayer != 0);
} }
...@@ -2413,9 +2413,9 @@ namespace WindBot.Game.AI.Decks ...@@ -2413,9 +2413,9 @@ namespace WindBot.Game.AI.Decks
{ {
if (!Enemy.HasInGraveyard(CardId.Raye)) if (!Enemy.HasInGraveyard(CardId.Raye))
{ {
ClientCard self_best = AI.Utils.GetBestBotMonster(true); ClientCard self_best = Util.GetBestBotMonster(true);
int self_power = (self_best != null) ? self_best.Attack : 0; int self_power = (self_best != null) ? self_best.Attack : 0;
ClientCard enemy_best = AI.Utils.GetBestEnemyMonster(true); ClientCard enemy_best = Util.GetBestEnemyMonster(true);
int enemy_power = (enemy_best != null) ? enemy_best.GetDefensePower() : 0; int enemy_power = (enemy_best != null) ? enemy_best.GetDefensePower() : 0;
if (enemy_power <= self_power) return false; if (enemy_power <= self_power) return false;
Logger.DebugWriteLine("Three: enemy: " + enemy_power.ToString() + ", bot: " + self_power.ToString()); Logger.DebugWriteLine("Three: enemy: " + enemy_power.ToString() + ", bot: " + self_power.ToString());
...@@ -2440,7 +2440,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2440,7 +2440,7 @@ namespace WindBot.Game.AI.Decks
} }
} }
List<ClientCard> monsters = Bot.GetMonsters(); List<ClientCard> monsters = Bot.GetMonsters();
monsters.Sort(AIFunctions.CompareCardAttack); monsters.Sort(CardContainer.CompareCardAttack);
//monsters.Reverse(); //monsters.Reverse();
foreach(ClientCard card in monsters) foreach(ClientCard card in monsters)
{ {
...@@ -2465,9 +2465,9 @@ namespace WindBot.Game.AI.Decks ...@@ -2465,9 +2465,9 @@ namespace WindBot.Game.AI.Decks
{ {
if (!Enemy.HasInGraveyard(CardId.Raye)) if (!Enemy.HasInGraveyard(CardId.Raye))
{ {
ClientCard self_best = AI.Utils.GetBestBotMonster(true); ClientCard self_best = Util.GetBestBotMonster(true);
int self_power = (self_best != null) ? self_best.Attack : 0; int self_power = (self_best != null) ? self_best.Attack : 0;
ClientCard enemy_best = AI.Utils.GetBestEnemyMonster(true); ClientCard enemy_best = Util.GetBestEnemyMonster(true);
int enemy_power = (enemy_best != null) ? enemy_best.GetDefensePower() : 0; int enemy_power = (enemy_best != null) ? enemy_best.GetDefensePower() : 0;
if (enemy_power < self_power) return false; if (enemy_power < self_power) return false;
if (Bot.GetMonsterCount() <= 2 && enemy_power >= 2401) return false; if (Bot.GetMonsterCount() <= 2 && enemy_power >= 2401) return false;
...@@ -2478,7 +2478,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2478,7 +2478,7 @@ namespace WindBot.Game.AI.Decks
} }
List<ClientCard> material_list = new List<ClientCard>(); List<ClientCard> material_list = new List<ClientCard>();
List<ClientCard> monsters = Bot.GetMonsters(); List<ClientCard> monsters = Bot.GetMonsters();
monsters.Sort(AIFunctions.CompareCardAttack); monsters.Sort(CardContainer.CompareCardAttack);
//monsters.Reverse(); //monsters.Reverse();
foreach(ClientCard t in monsters) foreach(ClientCard t in monsters)
{ {
...@@ -2515,9 +2515,9 @@ namespace WindBot.Game.AI.Decks ...@@ -2515,9 +2515,9 @@ namespace WindBot.Game.AI.Decks
{ {
if (Duel.Phase != DuelPhase.Main1) return false; if (Duel.Phase != DuelPhase.Main1) return false;
ClientCard self_best = AI.Utils.GetBestBotMonster(true); ClientCard self_best = Util.GetBestBotMonster(true);
int self_power = (self_best != null) ? self_best.Attack : 0; int self_power = (self_best != null) ? self_best.Attack : 0;
ClientCard enemy_best = AI.Utils.GetBestEnemyMonster(true); ClientCard enemy_best = Util.GetBestEnemyMonster(true);
int enemy_power = (enemy_best != null) ? enemy_best.GetDefensePower() : 0; int enemy_power = (enemy_best != null) ? enemy_best.GetDefensePower() : 0;
if (enemy_power < self_power) return false; if (enemy_power < self_power) return false;
...@@ -2528,7 +2528,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2528,7 +2528,7 @@ namespace WindBot.Game.AI.Decks
List<ClientCard> material_list = new List<ClientCard>(); List<ClientCard> material_list = new List<ClientCard>();
List<ClientCard> bot_monster = Bot.GetMonsters(); List<ClientCard> bot_monster = Bot.GetMonsters();
bot_monster.Sort(AIFunctions.CompareCardAttack); bot_monster.Sort(CardContainer.CompareCardAttack);
//bot_monster.Reverse(); //bot_monster.Reverse();
int link_count = 0; int link_count = 0;
foreach(ClientCard card in bot_monster) foreach(ClientCard card in bot_monster)
...@@ -2553,10 +2553,10 @@ namespace WindBot.Game.AI.Decks ...@@ -2553,10 +2553,10 @@ namespace WindBot.Game.AI.Decks
public bool Borrelsword_eff() public bool Borrelsword_eff()
{ {
if (ActivateDescription == -1) return true; if (ActivateDescription == -1) return true;
else if ((Duel.Phase > DuelPhase.Main1 && Duel.Phase < DuelPhase.Main2) || AI.Utils.IsChainTarget(Card)) else if ((Duel.Phase > DuelPhase.Main1 && Duel.Phase < DuelPhase.Main2) || Util.IsChainTarget(Card))
{ {
List<ClientCard> enemy_list = Enemy.GetMonsters(); List<ClientCard> enemy_list = Enemy.GetMonsters();
enemy_list.Sort(AIFunctions.CompareCardAttack); enemy_list.Sort(CardContainer.CompareCardAttack);
enemy_list.Reverse(); enemy_list.Reverse();
foreach(ClientCard card in enemy_list) foreach(ClientCard card in enemy_list)
{ {
...@@ -2567,7 +2567,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2567,7 +2567,7 @@ namespace WindBot.Game.AI.Decks
} }
} }
List<ClientCard> bot_list = Bot.GetMonsters(); List<ClientCard> bot_list = Bot.GetMonsters();
bot_list.Sort(AIFunctions.CompareCardAttack); bot_list.Sort(CardContainer.CompareCardAttack);
//bot_list.Reverse(); //bot_list.Reverse();
foreach (ClientCard card in bot_list) foreach (ClientCard card in bot_list)
{ {
...@@ -2590,9 +2590,9 @@ namespace WindBot.Game.AI.Decks ...@@ -2590,9 +2590,9 @@ namespace WindBot.Game.AI.Decks
} }
if (!Enemy.HasInGraveyard(CardId.Raye)) if (!Enemy.HasInGraveyard(CardId.Raye))
{ {
ClientCard self_best = AI.Utils.GetBestBotMonster(true); ClientCard self_best = Util.GetBestBotMonster(true);
int self_power = (self_best != null) ? self_best.Attack : 0; int self_power = (self_best != null) ? self_best.Attack : 0;
ClientCard enemy_best = AI.Utils.GetBestEnemyMonster(true); ClientCard enemy_best = Util.GetBestEnemyMonster(true);
int enemy_power = (enemy_best != null) ? enemy_best.GetDefensePower() : 0; int enemy_power = (enemy_best != null) ? enemy_best.GetDefensePower() : 0;
Logger.DebugWriteLine("Tuner: enemy: " + enemy_power.ToString() + ", bot: " + self_power.ToString()); Logger.DebugWriteLine("Tuner: enemy: " + enemy_power.ToString() + ", bot: " + self_power.ToString());
if (enemy_power < self_power || enemy_power == 0) return false; if (enemy_power < self_power || enemy_power == 0) return false;
...@@ -2671,7 +2671,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2671,7 +2671,7 @@ namespace WindBot.Game.AI.Decks
if (isAltergeist(Card) && Bot.HasInHandOrInSpellZone(CardId.Protocol) && Card.IsFacedown()) if (isAltergeist(Card) && Bot.HasInHandOrInSpellZone(CardId.Protocol) && Card.IsFacedown())
return true; return true;
bool enemyBetter = AI.Utils.IsAllEnemyBetter(true); bool enemyBetter = Util.IsAllEnemyBetter(true);
if (Card.IsAttack() && enemyBetter) if (Card.IsAttack() && enemyBetter)
return true; return true;
if (Card.IsDefense() && !enemyBetter) if (Card.IsDefense() && !enemyBetter)
...@@ -2681,12 +2681,12 @@ namespace WindBot.Game.AI.Decks ...@@ -2681,12 +2681,12 @@ namespace WindBot.Game.AI.Decks
public bool MonsterSet() public bool MonsterSet()
{ {
if (AI.Utils.GetOneEnemyBetterThanMyBest() == null && Bot.GetMonsterCount() > 0) return false; if (Util.GetOneEnemyBetterThanMyBest() == null && Bot.GetMonsterCount() > 0) return false;
if (Card.Level > 4) return false; if (Card.Level > 4) return false;
int rest_lp = Bot.LifePoints; int rest_lp = Bot.LifePoints;
int count = Bot.GetMonsterCount(); int count = Bot.GetMonsterCount();
List<ClientCard> list = Enemy.GetMonsters(); List<ClientCard> list = Enemy.GetMonsters();
list.Sort(AIFunctions.CompareCardAttack); list.Sort(CardContainer.CompareCardAttack);
foreach(ClientCard card in list) foreach(ClientCard card in list)
{ {
if (!card.HasPosition(CardPosition.Attack)) continue; if (!card.HasPosition(CardPosition.Attack)) continue;
...@@ -2712,7 +2712,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2712,7 +2712,7 @@ namespace WindBot.Game.AI.Decks
if (EvenlyMatched_ready()) if (EvenlyMatched_ready())
{ {
List<ClientCard> enemy_m = Enemy.GetMonsters(); List<ClientCard> enemy_m = Enemy.GetMonsters();
enemy_m.Sort(AIFunctions.CompareCardAttack); enemy_m.Sort(CardContainer.CompareCardAttack);
//enemy_m.Reverse(); //enemy_m.Reverse();
foreach (ClientCard e_card in enemy_m) foreach (ClientCard e_card in enemy_m)
{ {
...@@ -2748,7 +2748,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2748,7 +2748,7 @@ namespace WindBot.Game.AI.Decks
int HIINT_TOGRAVE = 504; int HIINT_TOGRAVE = 504;
if (max == 1 && cards[0].Location == CardLocation.Deck if (max == 1 && cards[0].Location == CardLocation.Deck
&& AI.Utils.GetLastChainCard() != null && AI.Utils.GetLastChainCard().IsCode(23002292) && Bot.GetRemainingCount(CardId.WakingtheDragon,1) > 0) && Util.GetLastChainCard() != null && Util.GetLastChainCard().IsCode(23002292) && Bot.GetRemainingCount(CardId.WakingtheDragon,1) > 0)
{ {
IList<ClientCard> result = new List<ClientCard>(); IList<ClientCard> result = new List<ClientCard>();
foreach (ClientCard card in cards) foreach (ClientCard card in cards)
...@@ -2762,14 +2762,14 @@ namespace WindBot.Game.AI.Decks ...@@ -2762,14 +2762,14 @@ namespace WindBot.Game.AI.Decks
} }
if (result.Count > 0) return result; if (result.Count > 0) return result;
} }
else if (AI.Utils.GetLastChainCard() != null && AI.Utils.GetLastChainCard().IsCode(CardId.EvenlyMatched) && Duel.LastChainPlayer != 0) else if (Util.GetLastChainCard() != null && Util.GetLastChainCard().IsCode(CardId.EvenlyMatched) && Duel.LastChainPlayer != 0)
{ {
Logger.DebugWriteLine("EvenlyMatched: min=" + min.ToString() + ", max=" + max.ToString()); Logger.DebugWriteLine("EvenlyMatched: min=" + min.ToString() + ", max=" + max.ToString());
} }
else if (cards[0].Location == CardLocation.Hand && cards[cards.Count - 1].Location == CardLocation.Hand else if (cards[0].Location == CardLocation.Hand && cards[cards.Count - 1].Location == CardLocation.Hand
&& (hint == 501 || hint == HIINT_TOGRAVE) && min == max) && (hint == 501 || hint == HIINT_TOGRAVE) && min == max)
{ {
if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard().IsCode(CardId.OneForOne)) return null; if (Duel.LastChainPlayer == 0 && Util.GetLastChainCard().IsCode(CardId.OneForOne)) return null;
Logger.DebugWriteLine("Hand drop except OneForOne"); Logger.DebugWriteLine("Hand drop except OneForOne");
int todrop = min; int todrop = min;
IList<ClientCard> result = new List<ClientCard>(); IList<ClientCard> result = new List<ClientCard>();
...@@ -2807,7 +2807,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2807,7 +2807,7 @@ namespace WindBot.Game.AI.Decks
public override CardPosition OnSelectPosition(int cardId, IList<CardPosition> positions) public override CardPosition OnSelectPosition(int cardId, IList<CardPosition> positions)
{ {
if (AI.Utils.IsTurn1OrMain2() if (Util.IsTurn1OrMain2()
&& (cardId == CardId.Meluseek || cardId == CardId.Silquitous)) && (cardId == CardId.Meluseek || cardId == CardId.Silquitous))
{ {
return CardPosition.FaceUpDefence; return CardPosition.FaceUpDefence;
...@@ -2815,15 +2815,15 @@ namespace WindBot.Game.AI.Decks ...@@ -2815,15 +2815,15 @@ namespace WindBot.Game.AI.Decks
return 0; return 0;
} }
public override int OnSelectPlace(int cardId, int player, int location, int available) public override int OnSelectPlace(int cardId, int player, CardLocation location, int available)
{ {
if (player == 0) if (player == 0)
{ {
if (location == (int)CardLocation.SpellZone) if (location == CardLocation.SpellZone)
{ {
// unfinished // unfinished
} }
else if (location == (int)CardLocation.MonsterZone) else if (location == CardLocation.MonsterZone)
{ {
if(cardId == CardId.Linkuriboh) if(cardId == CardId.Linkuriboh)
{ {
......
...@@ -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[]
{
CardId.SageWithEyesOfBlue,
CardId.WhiteStoneOfAncients,
CardId.WhiteStoneOfLegend,
CardId.WhiteDragon,
CardId.DragonSpiritOfWhite
}) || Bot.GetCountCardInZone(Bot.MonsterZone, CardId.AlternativeWhiteDragon) >= 2))
{ {
target = AI.Utils.GetBestEnemyMonster(false, true); 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;
} }
......
...@@ -235,7 +235,7 @@ namespace WindBot.Game.AI.Decks ...@@ -235,7 +235,7 @@ namespace WindBot.Game.AI.Decks
bool CrystalWingSynchroDragon_used = false; bool CrystalWingSynchroDragon_used = false;
public override void OnNewPhase() public override void OnNewPhase()
{ {
//AI.Utils.UpdateLinkedZone(); //Util.UpdateLinkedZone();
//Logger.DebugWriteLine("Zones.CheckLinkedPointZones= " + Zones.CheckLinkedPointZones); //Logger.DebugWriteLine("Zones.CheckLinkedPointZones= " + Zones.CheckLinkedPointZones);
//Logger.DebugWriteLine("Zones.CheckMutualEnemyZoneCount= " + Zones.CheckMutualEnemyZoneCount); //Logger.DebugWriteLine("Zones.CheckMutualEnemyZoneCount= " + Zones.CheckMutualEnemyZoneCount);
plan_C = false; plan_C = false;
...@@ -478,12 +478,12 @@ namespace WindBot.Game.AI.Decks ...@@ -478,12 +478,12 @@ namespace WindBot.Game.AI.Decks
private bool OddEyesAbsoluteDragoneff() private bool OddEyesAbsoluteDragoneff()
{ {
Logger.DebugWriteLine("OddEyesAbsoluteDragonef 1"); Logger.DebugWriteLine("OddEyesAbsoluteDragonef 1");
if (Card.Location == CardLocation.MonsterZone/*ActivateDescription == AI.Utils.GetStringId(CardId.OddEyesAbsoluteDragon, 0)*/) if (Card.Location == CardLocation.MonsterZone/*ActivateDescription == Util.GetStringId(CardId.OddEyesAbsoluteDragon, 0)*/)
{ {
Logger.DebugWriteLine("OddEyesAbsoluteDragonef 2"); Logger.DebugWriteLine("OddEyesAbsoluteDragonef 2");
return Duel.Player == 1; return Duel.Player == 1;
} }
else if (Card.Location == CardLocation.Grave/*ActivateDescription == AI.Utils.GetStringId(CardId.OddEyesAbsoluteDragon, 0)*/) else if (Card.Location == CardLocation.Grave/*ActivateDescription == Util.GetStringId(CardId.OddEyesAbsoluteDragon, 0)*/)
{ {
Logger.DebugWriteLine("OddEyesAbsoluteDragonef 3"); Logger.DebugWriteLine("OddEyesAbsoluteDragonef 3");
AI.SelectCard(CardId.OddEyesWingDragon); AI.SelectCard(CardId.OddEyesWingDragon);
...@@ -501,8 +501,8 @@ namespace WindBot.Game.AI.Decks ...@@ -501,8 +501,8 @@ namespace WindBot.Game.AI.Decks
private bool ChainEnemy() private bool ChainEnemy()
{ {
if (AI.Utils.GetLastChainCard() != null && if (Util.GetLastChainCard() != null &&
AI.Utils.GetLastChainCard().IsCode(CardId.UpstartGoblin)) Util.GetLastChainCard().IsCode(CardId.UpstartGoblin))
return false; return false;
return Duel.LastChainPlayer == 1; return Duel.LastChainPlayer == 1;
} }
...@@ -589,7 +589,7 @@ namespace WindBot.Game.AI.Decks ...@@ -589,7 +589,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;
if (Bot.HasInMonstersZone(CardId.WindwitchSnowBell)) return false; if (Bot.HasInMonstersZone(CardId.WindwitchSnowBell)) return false;
return true; return true;
} }
...@@ -617,7 +617,7 @@ namespace WindBot.Game.AI.Decks ...@@ -617,7 +617,7 @@ namespace WindBot.Game.AI.Decks
} }
return true; return true;
}; };
ClientCard BestEnemy = AI.Utils.GetBestEnemyMonster(true,true); ClientCard BestEnemy = Util.GetBestEnemyMonster(true,true);
if (BestEnemy == null || BestEnemy.HasPosition(CardPosition.FaceDown)) return false; if (BestEnemy == null || BestEnemy.HasPosition(CardPosition.FaceDown)) return false;
AI.SelectCard(BestEnemy); AI.SelectCard(BestEnemy);
return true; return true;
...@@ -641,12 +641,12 @@ namespace WindBot.Game.AI.Decks ...@@ -641,12 +641,12 @@ namespace WindBot.Game.AI.Decks
magician.Add(check); magician.Add(check);
} }
} }
if (AI.Utils.IsChainTarget(Card) && Bot.GetMonsterCount() == 0) if (Util.IsChainTarget(Card) && Bot.GetMonsterCount() == 0)
{ {
AI.SelectYesNo(false); AI.SelectYesNo(false);
return true; return true;
} }
if (AI.Utils.ChainCountPlayer(0) > 0) return false; if (Util.ChainCountPlayer(0) > 0) return false;
if (Enemy.HasInSpellZone(CardId.HarpiesFeatherDuster) && Card.IsFacedown()) if (Enemy.HasInSpellZone(CardId.HarpiesFeatherDuster) && Card.IsFacedown())
return false; return false;
...@@ -782,7 +782,7 @@ namespace WindBot.Game.AI.Decks ...@@ -782,7 +782,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard check in Enemy.GetSpells()) foreach (ClientCard check in Enemy.GetSpells())
{ {
if (AI.Utils.GetLastChainCard() == check) if (Util.GetLastChainCard() == check)
{ {
spell.Add(check); spell.Add(check);
spell_act = true; spell_act = true;
...@@ -804,11 +804,11 @@ namespace WindBot.Game.AI.Decks ...@@ -804,11 +804,11 @@ namespace WindBot.Game.AI.Decks
AI.SelectCard(spell); AI.SelectCard(spell);
return true; return true;
} }
if (AI.Utils.IsChainTarget(Card)) if (Util.IsChainTarget(Card))
{ {
AI.SelectPlace(Zones.z0 | Zones.z4); AI.SelectPlace(Zones.z0 | Zones.z4);
AI.SelectCard(CardId.DarkMagician); AI.SelectCard(CardId.DarkMagician);
ClientCard check = AI.Utils.GetOneEnemyBetterThanValue(2500, true); ClientCard check = Util.GetOneEnemyBetterThanValue(2500, true);
if (check != null) if (check != null)
AI.SelectNextCard(CardId.ApprenticeLllusionMagician, CardId.DarkMagician, CardId.MagicianOfLllusion); AI.SelectNextCard(CardId.ApprenticeLllusionMagician, CardId.DarkMagician, CardId.MagicianOfLllusion);
else else
...@@ -820,7 +820,7 @@ namespace WindBot.Game.AI.Decks ...@@ -820,7 +820,7 @@ namespace WindBot.Game.AI.Decks
{ {
AI.SelectPlace(Zones.z0 | Zones.z4); AI.SelectPlace(Zones.z0 | Zones.z4);
AI.SelectCard(CardId.DarkMagician); AI.SelectCard(CardId.DarkMagician);
ClientCard check = AI.Utils.GetOneEnemyBetterThanValue(2500, true); ClientCard check = Util.GetOneEnemyBetterThanValue(2500, true);
if (check != null) if (check != null)
AI.SelectNextCard(CardId.ApprenticeLllusionMagician, CardId.DarkMagician, CardId.MagicianOfLllusion); AI.SelectNextCard(CardId.ApprenticeLllusionMagician, CardId.DarkMagician, CardId.MagicianOfLllusion);
else else
...@@ -832,7 +832,7 @@ namespace WindBot.Game.AI.Decks ...@@ -832,7 +832,7 @@ namespace WindBot.Game.AI.Decks
{ {
AI.SelectPlace(Zones.z0 | Zones.z4); AI.SelectPlace(Zones.z0 | Zones.z4);
AI.SelectCard(CardId.DarkMagician); AI.SelectCard(CardId.DarkMagician);
ClientCard check = AI.Utils.GetOneEnemyBetterThanValue(2500, true); ClientCard check = Util.GetOneEnemyBetterThanValue(2500, true);
if (check != null) if (check != null)
AI.SelectNextCard(CardId.ApprenticeLllusionMagician, CardId.DarkMagician, CardId.MagicianOfLllusion); AI.SelectNextCard(CardId.ApprenticeLllusionMagician, CardId.DarkMagician, CardId.MagicianOfLllusion);
else else
...@@ -846,7 +846,7 @@ namespace WindBot.Game.AI.Decks ...@@ -846,7 +846,7 @@ namespace WindBot.Game.AI.Decks
{ {
AI.SelectPlace(Zones.z0 | Zones.z4); AI.SelectPlace(Zones.z0 | Zones.z4);
AI.SelectCard(CardId.DarkMagician); AI.SelectCard(CardId.DarkMagician);
ClientCard check = AI.Utils.GetOneEnemyBetterThanValue(2500, true); ClientCard check = Util.GetOneEnemyBetterThanValue(2500, true);
if (check != null) if (check != null)
AI.SelectNextCard(CardId.ApprenticeLllusionMagician, CardId.DarkMagician, CardId.MagicianOfLllusion); AI.SelectNextCard(CardId.ApprenticeLllusionMagician, CardId.DarkMagician, CardId.MagicianOfLllusion);
else else
...@@ -860,7 +860,7 @@ namespace WindBot.Game.AI.Decks ...@@ -860,7 +860,7 @@ namespace WindBot.Game.AI.Decks
{ {
AI.SelectPlace(Zones.z0 | Zones.z4); AI.SelectPlace(Zones.z0 | Zones.z4);
AI.SelectCard(CardId.DarkMagician); AI.SelectCard(CardId.DarkMagician);
ClientCard check = AI.Utils.GetOneEnemyBetterThanValue(2500, true); ClientCard check = Util.GetOneEnemyBetterThanValue(2500, true);
if (check != null) if (check != null)
AI.SelectNextCard(CardId.ApprenticeLllusionMagician, CardId.DarkMagician, CardId.MagicianOfLllusion); AI.SelectNextCard(CardId.ApprenticeLllusionMagician, CardId.DarkMagician, CardId.MagicianOfLllusion);
else else
...@@ -884,9 +884,9 @@ namespace WindBot.Game.AI.Decks ...@@ -884,9 +884,9 @@ namespace WindBot.Game.AI.Decks
{ {
if (magician_sp) if (magician_sp)
{ {
AI.SelectCard(AI.Utils.GetBestEnemyCard(false, true)); AI.SelectCard(Util.GetBestEnemyCard(false, true));
if (AI.Utils.GetBestEnemyCard(false, true) != null) if (Util.GetBestEnemyCard(false, true) != null)
Logger.DebugWriteLine("*************SelectCard= " + AI.Utils.GetBestEnemyCard(false, true).Id); Logger.DebugWriteLine("*************SelectCard= " + Util.GetBestEnemyCard(false, true).Id);
magician_sp = false; magician_sp = false;
} }
} }
...@@ -932,7 +932,7 @@ namespace WindBot.Game.AI.Decks ...@@ -932,7 +932,7 @@ namespace WindBot.Game.AI.Decks
} }
if (ghost_count != ghost_done) if (ghost_count != ghost_done)
{ {
if (Duel.CurrentChain.Count >= 2 && AI.Utils.GetLastChainCard().IsCode(0)) if (Duel.CurrentChain.Count >= 2 && Util.GetLastChainCard().IsCode(0))
{ {
AI.SelectCard(CardId.MagiciansRod); AI.SelectCard(CardId.MagiciansRod);
AI.SelectNextCard(CardId.DarkMagician, CardId.DarkMagician); AI.SelectNextCard(CardId.DarkMagician, CardId.DarkMagician);
...@@ -942,7 +942,7 @@ namespace WindBot.Game.AI.Decks ...@@ -942,7 +942,7 @@ namespace WindBot.Game.AI.Decks
int count = 0; int count = 0;
foreach (ClientCard m in Bot.GetMonsters()) foreach (ClientCard m in Bot.GetMonsters())
{ {
if (AI.Utils.IsChainTarget(m)) if (Util.IsChainTarget(m))
{ {
count++; count++;
target = m; target = m;
...@@ -1128,14 +1128,14 @@ namespace WindBot.Game.AI.Decks ...@@ -1128,14 +1128,14 @@ namespace WindBot.Game.AI.Decks
if (Duel.Turn != 1) if (Duel.Turn != 1)
{ {
if (Duel.Phase == DuelPhase.Main1 && Enemy.GetSpellCountWithoutField() == 0 && if (Duel.Phase == DuelPhase.Main1 && Enemy.GetSpellCountWithoutField() == 0 &&
AI.Utils.GetBestEnemyMonster(true, true) == null) Util.GetBestEnemyMonster(true, true) == null)
return false; return false;
if (Duel.Phase == DuelPhase.Main1 && Enemy.GetSpellCountWithoutField() == 0 && if (Duel.Phase == DuelPhase.Main1 && Enemy.GetSpellCountWithoutField() == 0 &&
AI.Utils.GetBestEnemyMonster().IsFacedown()) Util.GetBestEnemyMonster().IsFacedown())
return true; return true;
if (Duel.Phase == DuelPhase.Main1 && Enemy.GetSpellCountWithoutField() == 0 && if (Duel.Phase == DuelPhase.Main1 && Enemy.GetSpellCountWithoutField() == 0 &&
AI.Utils.GetBestBotMonster(true) != null && Util.GetBestBotMonster(true) != null &&
AI.Utils.GetBestBotMonster(true).Attack > AI.Utils.GetBestEnemyMonster(true).Attack) Util.GetBestBotMonster(true).Attack > Util.GetBestEnemyMonster(true).Attack)
return false; return false;
} }
return true; return true;
...@@ -1209,7 +1209,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1209,7 +1209,7 @@ namespace WindBot.Game.AI.Decks
} }
private bool ApprenticeLllusionMagicianeff() private bool ApprenticeLllusionMagicianeff()
{ {
if (AI.Utils.ChainContainsCard(CardId.ApprenticeLllusionMagician)) return false; if (Util.ChainContainsCard(CardId.ApprenticeLllusionMagician)) return false;
if (Duel.Phase == DuelPhase.Battle || if (Duel.Phase == DuelPhase.Battle ||
Duel.Phase == DuelPhase.BattleStart || Duel.Phase == DuelPhase.BattleStart ||
Duel.Phase == DuelPhase.BattleStep || Duel.Phase == DuelPhase.BattleStep ||
...@@ -1434,9 +1434,9 @@ namespace WindBot.Game.AI.Decks ...@@ -1434,9 +1434,9 @@ namespace WindBot.Game.AI.Decks
IList<ClientCard> list_1 = new List<ClientCard>(); IList<ClientCard> list_1 = new List<ClientCard>();
foreach (ClientCard monster in Bot.GetMonsters()) foreach (ClientCard monster in Bot.GetMonsters())
{ {
if (AI.Utils.GetWorstBotMonster(true) != null) if (Util.GetWorstBotMonster(true) != null)
{ {
if (monster.IsAttack() && monster.Id != AI.Utils.GetWorstBotMonster(true).Id) if (monster.IsAttack() && monster.Id != Util.GetWorstBotMonster(true).Id)
list_1.Add(monster); list_1.Add(monster);
} }
} }
...@@ -1477,7 +1477,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1477,7 +1477,7 @@ namespace WindBot.Game.AI.Decks
private bool BigEyesp() private bool BigEyesp()
{ {
if (plan_C) return false; if (plan_C) return false;
if (AI.Utils.IsOneEnemyBetterThanValue(2500, false) && if (Util.IsOneEnemyBetterThanValue(2500, false) &&
!Bot.HasInHandOrHasInMonstersZone(CardId.ApprenticeLllusionMagician)) !Bot.HasInHandOrHasInMonstersZone(CardId.ApprenticeLllusionMagician))
{ {
//AI.SelectPlace(Zones.z5, Zones.ExtraMonsterZones); //AI.SelectPlace(Zones.z5, Zones.ExtraMonsterZones);
...@@ -1489,7 +1489,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1489,7 +1489,7 @@ namespace WindBot.Game.AI.Decks
private bool BigEyeeff() private bool BigEyeeff()
{ {
ClientCard target = AI.Utils.GetBestEnemyMonster(false, true); ClientCard target = Util.GetBestEnemyMonster(false, true);
if (target != null && target.Attack >= 2500) if (target != null && target.Attack >= 2500)
{ {
AI.SelectCard(CardId.DarkMagician); AI.SelectCard(CardId.DarkMagician);
...@@ -1502,7 +1502,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1502,7 +1502,7 @@ namespace WindBot.Game.AI.Decks
private bool Dracossacksp() private bool Dracossacksp()
{ {
if (plan_C) return false; if (plan_C) return false;
if (AI.Utils.IsOneEnemyBetterThanValue(2500, false) && if (Util.IsOneEnemyBetterThanValue(2500, false) &&
!Bot.HasInHandOrHasInMonstersZone(CardId.ApprenticeLllusionMagician)) !Bot.HasInHandOrHasInMonstersZone(CardId.ApprenticeLllusionMagician))
{ {
//AI.SelectPlace(Zones.z5, Zones.ExtraMonsterZones); //AI.SelectPlace(Zones.z5, Zones.ExtraMonsterZones);
...@@ -1514,13 +1514,13 @@ namespace WindBot.Game.AI.Decks ...@@ -1514,13 +1514,13 @@ namespace WindBot.Game.AI.Decks
private bool Dracossackeff() private bool Dracossackeff()
{ {
if (ActivateDescription == AI.Utils.GetStringId(CardId.Dracossack, 0)) if (ActivateDescription == Util.GetStringId(CardId.Dracossack, 0))
{ {
AI.SelectCard(CardId.DarkMagician); AI.SelectCard(CardId.DarkMagician);
return true; return true;
} }
ClientCard target = AI.Utils.GetBestEnemyCard(false, true); ClientCard target = Util.GetBestEnemyCard(false, true);
if (target != null) if (target != null)
{ {
AI.SelectCard(CardId.Dracossack + 1); AI.SelectCard(CardId.Dracossack + 1);
...@@ -1624,11 +1624,11 @@ namespace WindBot.Game.AI.Decks ...@@ -1624,11 +1624,11 @@ namespace WindBot.Game.AI.Decks
Logger.DebugWriteLine("++++++++SpellZone[" + i + "]= " + Bot.SpellZone[i].Id); Logger.DebugWriteLine("++++++++SpellZone[" + i + "]= " + Bot.SpellZone[i].Id);
}*/ }*/
if ((Duel.CurrentChain.Count >= 1 && AI.Utils.GetLastChainCard().Id == 0) || if ((Duel.CurrentChain.Count >= 1 && Util.GetLastChainCard().Id == 0) ||
(Duel.CurrentChain.Count == 2 && !AI.Utils.ChainContainPlayer(0) && Duel.CurrentChain[0].Id == 0)) (Duel.CurrentChain.Count == 2 && !Util.ChainContainPlayer(0) && Duel.CurrentChain[0].Id == 0))
{ {
Logger.DebugWriteLine("current chain = " + Duel.CurrentChain.Count); Logger.DebugWriteLine("current chain = " + Duel.CurrentChain.Count);
Logger.DebugWriteLine("******last chain card= " + AI.Utils.GetLastChainCard().Id); Logger.DebugWriteLine("******last chain card= " + Util.GetLastChainCard().Id);
int maxxc_count = 0; int maxxc_count = 0;
foreach (ClientCard check in Enemy.Graveyard) foreach (ClientCard check in Enemy.Graveyard)
{ {
...@@ -1637,7 +1637,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1637,7 +1637,7 @@ namespace WindBot.Game.AI.Decks
} }
if (maxxc_count != maxxc_done) if (maxxc_count != maxxc_done)
{ {
Logger.DebugWriteLine("************************last chain card= " + AI.Utils.GetLastChainCard().Id); Logger.DebugWriteLine("************************last chain card= " + Util.GetLastChainCard().Id);
maxxc_used = true; maxxc_used = true;
} }
int lockbird_count = 0; int lockbird_count = 0;
...@@ -1648,7 +1648,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1648,7 +1648,7 @@ namespace WindBot.Game.AI.Decks
} }
if (lockbird_count != lockbird_done) if (lockbird_count != lockbird_done)
{ {
Logger.DebugWriteLine("************************last chain card= " + AI.Utils.GetLastChainCard().Id); Logger.DebugWriteLine("************************last chain card= " + Util.GetLastChainCard().Id);
lockbird_used = true; lockbird_used = true;
} }
int ghost_count = 0; int ghost_count = 0;
...@@ -1659,10 +1659,10 @@ namespace WindBot.Game.AI.Decks ...@@ -1659,10 +1659,10 @@ namespace WindBot.Game.AI.Decks
} }
if (ghost_count != ghost_done) if (ghost_count != ghost_done)
{ {
Logger.DebugWriteLine("************************last chain card= " + AI.Utils.GetLastChainCard().Id); Logger.DebugWriteLine("************************last chain card= " + Util.GetLastChainCard().Id);
ghost_used = true; ghost_used = true;
} }
if (ghost_used && AI.Utils.ChainContainsCard(CardId.WindwitchGlassBell)) if (ghost_used && Util.ChainContainsCard(CardId.WindwitchGlassBell))
{ {
AI.SelectCard(CardId.WindwitchIceBell); AI.SelectCard(CardId.WindwitchIceBell);
Logger.DebugWriteLine("***********WindwitchGlassBell*********************"); Logger.DebugWriteLine("***********WindwitchGlassBell*********************");
......
...@@ -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
using System;
using YGOSharp.OCGWrapper.Enums;
using System.Collections.Generic;
using WindBot;
using WindBot.Game;
using WindBot.Game.AI;
using System.Linq;
namespace WindBot.Game.AI.Decks
{
[Deck("Orcust", "AI_Orcust")]
class OrcustExecutor : DefaultExecutor
{
public class CardId
{
public const int OrcustKnightmare = 4055337;
public const int OrcustHarpHorror = 57835716;
public const int OrcustCymbalSkeleton = 21441617;
public const int WorldLegacyWorldWand = 93920420;
public const int ThePhantomKnightsofAncientCloak = 90432163;
public const int ThePhantomKnightsofSilentBoots = 36426778;
public const int TrickstarCarobein = 98169343;
public const int TrickstarCandina = 61283655;
public const int ArmageddonKnight = 28985331;
public const int ScrapRecycler = 4334811;
public const int DestrudoTheLostDragonsFrisson = 5560911;
public const int JetSynchron = 9742784;
public const int AshBlossomJoyousSpring = 14558127;
public const int GhostBelleHauntedMansion = 73642296;
public const int MaxxC = 23434538;
public const int SkyStrikerMobilizeEngage = 63166095;
public const int SkyStrikerMechaEagleBooster = 25733157;
public const int SkyStrikerMechaHornetDrones = 52340444;
public const int SkyStrikerMechaHornetDronesToken = 52340445;
public const int TrickstarLightStage = 35371948;
public const int OrcustratedBabel = 90351981;
public const int ReinforcementofTheArmy = 32807846;
public const int Terraforming = 73628505;
public const int FoolishBurial = 81439173;
public const int CalledbyTheGrave = 24224830;
public const int ThePhantomKnightsofShadeBrigandine = 98827725;
public const int PhantomKnightsFogBlade = 25542642;
public const int OrcustratedClimax = 703897;
public const int BorreloadSavageDragon = 27548199;
public const int ShootingRiserDragon = 68431965;
public const int SheorcustDingirsu = 93854893;
public const int BorrelswordDragon = 85289965;
public const int LongirsuTheOrcustOrchestrator = 76145142;
public const int ThePhantomKnightsofRustyBardiche = 26692769;
public const int KnightmarePhoenix = 2857636;
public const int GalateaTheOrcustAutomaton = 30741503;
public const int CrystronNeedlefiber = 50588353;
public const int SkyStrikerAceKagari = 63288573;
public const int KnightmareMermaid = 3679218;
public const int SalamangreatAlmiraj = 60303245;
}
public OrcustExecutor(GameAI ai, Duel duel)
: base(ai, duel)
{
AddExecutor(ExecutorType.Activate, CardId.MaxxC, DefaultMaxxC);
AddExecutor(ExecutorType.Activate, CardId.AshBlossomJoyousSpring, DefaultAshBlossomAndJoyousSpring);
AddExecutor(ExecutorType.Activate, CardId.GhostBelleHauntedMansion, DefaultGhostBelleAndHauntedMansion);
AddExecutor(ExecutorType.Activate, CardId.CalledbyTheGrave, DefaultCalledByTheGrave);
AddExecutor(ExecutorType.Activate, CardId.Terraforming, TerraformingEffect);
AddExecutor(ExecutorType.Activate, CardId.ReinforcementofTheArmy, ReinforcementofTheArmyEffect);
AddExecutor(ExecutorType.Activate, CardId.FoolishBurial, FoolishBurialEffect);
AddExecutor(ExecutorType.Activate, CardId.TrickstarLightStage, LightStageEffect);
AddExecutor(ExecutorType.Activate, CardId.SkyStrikerMobilizeEngage, EngageEffect);
AddExecutor(ExecutorType.Activate, CardId.SkyStrikerMechaHornetDrones, DronesEffectFirst);
AddExecutor(ExecutorType.SpSummon, CardId.SkyStrikerAceKagari);
AddExecutor(ExecutorType.Activate, CardId.SkyStrikerAceKagari);
AddExecutor(ExecutorType.SpSummon, CardId.TrickstarCarobein, CarobeinSummon);
AddExecutor(ExecutorType.Activate, CardId.TrickstarCarobein);
AddExecutor(ExecutorType.SpellSet, CardId.ThePhantomKnightsofShadeBrigandine);
AddExecutor(ExecutorType.Summon, CardId.ArmageddonKnight, ArmageddonKnightSummon);
AddExecutor(ExecutorType.Activate, CardId.ArmageddonKnight, ArmageddonKnightEffect);
AddExecutor(ExecutorType.Summon, CardId.ScrapRecycler, ScrapRecyclerSummon);
AddExecutor(ExecutorType.Activate, CardId.ScrapRecycler, ScrapRecyclerEffect);
AddExecutor(ExecutorType.Activate, CardId.SkyStrikerMechaHornetDrones, DronesEffect);
AddExecutor(ExecutorType.Summon, CardId.JetSynchron, JetSynchronSummon);
AddExecutor(ExecutorType.Activate, CardId.DestrudoTheLostDragonsFrisson, DestrudoSummon);
AddExecutor(ExecutorType.SpSummon, CardId.CrystronNeedlefiber, NeedlefiberSummonFirst);
AddExecutor(ExecutorType.Activate, CardId.CrystronNeedlefiber, NeedlefiberEffect);
AddExecutor(ExecutorType.Summon, CardId.TrickstarCandina, CandinaSummon);
AddExecutor(ExecutorType.Activate, CardId.TrickstarCandina, CandinaEffect);
AddExecutor(ExecutorType.Summon, CardId.JetSynchron, OtherSummon);
AddExecutor(ExecutorType.Summon, CardId.ThePhantomKnightsofAncientCloak, OtherSummon);
AddExecutor(ExecutorType.Summon, CardId.ThePhantomKnightsofSilentBoots, OtherSummon);
AddExecutor(ExecutorType.SpSummon, CardId.SalamangreatAlmiraj, AlmirajSummon);
AddExecutor(ExecutorType.Activate, CardId.ThePhantomKnightsofShadeBrigandine, ShadeBrigandineSummonFirst);
AddExecutor(ExecutorType.SpSummon, CardId.KnightmarePhoenix, KnightmarePhoenixSummon);
AddExecutor(ExecutorType.Activate, CardId.KnightmarePhoenix, KnightmarePhoenixEffect);
AddExecutor(ExecutorType.SpSummon, CardId.KnightmareMermaid, KnightmareMermaidSummon);
AddExecutor(ExecutorType.Activate, CardId.KnightmareMermaid, KnightmareMermaidEffect);
AddExecutor(ExecutorType.SpSummon, CardId.GalateaTheOrcustAutomaton, GalateaSummonFirst);
AddExecutor(ExecutorType.Activate, CardId.JetSynchron, JetSynchronEffect);
AddExecutor(ExecutorType.Activate, CardId.OrcustKnightmare, OrcustKnightmareEffect);
AddExecutor(ExecutorType.Activate, CardId.OrcustHarpHorror, HarpHorrorEffect);
AddExecutor(ExecutorType.Activate, CardId.WorldLegacyWorldWand, WorldWandEffect);
AddExecutor(ExecutorType.Activate, CardId.ThePhantomKnightsofAncientCloak, AncientCloakEffect);
AddExecutor(ExecutorType.SpSummon, CardId.ThePhantomKnightsofRustyBardiche, RustyBardicheSummon);
AddExecutor(ExecutorType.Activate, CardId.ThePhantomKnightsofRustyBardiche, RustyBardicheEffect);
AddExecutor(ExecutorType.Activate, CardId.OrcustCymbalSkeleton, CymbalSkeletonEffect);
AddExecutor(ExecutorType.Activate, CardId.GalateaTheOrcustAutomaton, GalateaEffect);
AddExecutor(ExecutorType.SpSummon, CardId.SheorcustDingirsu, SheorcustDingirsuSummon);
AddExecutor(ExecutorType.Activate, CardId.SheorcustDingirsu, SheorcustDingirsuEffect);
AddExecutor(ExecutorType.SpSummon, CardId.ThePhantomKnightsofSilentBoots, SilentBootsSummon);
AddExecutor(ExecutorType.Activate, CardId.ThePhantomKnightsofShadeBrigandine, ShadeBrigandineSummonSecond);
AddExecutor(ExecutorType.SpSummon, CardId.BorreloadSavageDragon);
AddExecutor(ExecutorType.Activate, CardId.BorreloadSavageDragon, BorreloadSavageDragonEffect);
AddExecutor(ExecutorType.SpSummon, CardId.GalateaTheOrcustAutomaton, GalateaSummonSecond);
AddExecutor(ExecutorType.Activate, CardId.ThePhantomKnightsofSilentBoots, SilentBootsEffect);
AddExecutor(ExecutorType.Summon, CardId.OrcustHarpHorror, OtherSummon);
AddExecutor(ExecutorType.Summon, CardId.OrcustCymbalSkeleton, OtherSummon);
AddExecutor(ExecutorType.Summon, CardId.GhostBelleHauntedMansion, OtherSummon);
AddExecutor(ExecutorType.Summon, CardId.AshBlossomJoyousSpring, OtherSummon);
AddExecutor(ExecutorType.Summon, CardId.MaxxC, OtherSummon);
AddExecutor(ExecutorType.SpellSet, CardId.PhantomKnightsFogBlade);
AddExecutor(ExecutorType.Activate, CardId.PhantomKnightsFogBlade, FogBladeEffect);
AddExecutor(ExecutorType.SpellSet, CardId.OrcustratedClimax);
AddExecutor(ExecutorType.Activate, CardId.OrcustratedClimax, ClimaxEffect);
AddExecutor(ExecutorType.Activate, CardId.OrcustratedBabel, BabelEffect);
AddExecutor(ExecutorType.Activate, CardId.SkyStrikerMechaEagleBooster, EagleBoosterEffect);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
}
private bool NormalSummoned = false;
private bool SheorcustDingirsuSummoned = false;
private bool HarpHorrorUsed = false;
private bool CymbalSkeletonUsed = false;
private ClientCard RustyBardicheTarget = null;
private ClientCard LightStageTarget = null;
private int[] HandCosts = new[]
{
CardId.OrcustCymbalSkeleton,
CardId.OrcustKnightmare,
CardId.DestrudoTheLostDragonsFrisson,
CardId.WorldLegacyWorldWand,
CardId.OrcustHarpHorror,
CardId.ThePhantomKnightsofAncientCloak,
CardId.ThePhantomKnightsofSilentBoots,
CardId.JetSynchron,
CardId.TrickstarLightStage,
CardId.SkyStrikerMobilizeEngage,
CardId.Terraforming,
CardId.ReinforcementofTheArmy,
CardId.MaxxC,
CardId.GhostBelleHauntedMansion
};
public override void OnNewTurn()
{
NormalSummoned = false;
SheorcustDingirsuSummoned = false;
HarpHorrorUsed = false;
CymbalSkeletonUsed = false;
RustyBardicheTarget = null;
LightStageTarget = null;
}
public override CardPosition OnSelectPosition(int cardId, IList<CardPosition> positions)
{
YGOSharp.OCGWrapper.NamedCard cardData = YGOSharp.OCGWrapper.NamedCard.Get(cardId);
if (cardData != null)
{
if (cardData.Attack <= 1000)
return CardPosition.FaceUpDefence;
}
return 0;
}
public override int OnSelectPlace(int cardId, int player, CardLocation location, int available)
{
if (location == CardLocation.SpellZone)
{
if(cardId==CardId.KnightmarePhoenix || cardId == CardId.CrystronNeedlefiber)
{
ClientCard b = Bot.MonsterZone.GetFirstMatchingCard(card => card.Id == CardId.BorreloadSavageDragon);
int zone = (1 << (b?.Sequence ?? 0)) & available;
if (zone > 0)
return zone;
}
if ((available & Zones.z0) > 0)
return Zones.z0;
if ((available & Zones.z1) > 0)
return Zones.z1;
if ((available & Zones.z2) > 0)
return Zones.z2;
if ((available & Zones.z3) > 0)
return Zones.z3;
if ((available & Zones.z4) > 0)
return Zones.z4;
}
if (location == CardLocation.MonsterZone)
{
if (cardId == CardId.SheorcustDingirsu)
{
ClientCard l = Bot.MonsterZone.GetFirstMatchingCard(card => card.Id == CardId.ThePhantomKnightsofRustyBardiche);
int zones = (l?.GetLinkedZones() ?? 0) & available;
if ((zones & Zones.z4) > 0)
return Zones.z4;
if ((zones & Zones.z3) > 0)
return Zones.z3;
if ((zones & Zones.z2) > 0)
return Zones.z2;
if ((zones & Zones.z1) > 0)
return Zones.z1;
if ((zones & Zones.z0) > 0)
return Zones.z0;
}
if(cardId == CardId.GalateaTheOrcustAutomaton)
{
int zones = Bot.GetLinkedZones() & available;
if ((zones & Zones.z0) > 0)
return Zones.z0;
if ((zones & Zones.z2) > 0)
return Zones.z2;
if ((zones & Zones.z1) > 0)
return Zones.z1;
if ((zones & Zones.z3) > 0)
return Zones.z3;
if ((zones & Zones.z4) > 0)
return Zones.z4;
}
if ((available & Zones.z1) > 0)
return Zones.z1;
if ((available & Zones.z3) > 0)
return Zones.z3;
if ((available & Zones.z0) > 0)
return Zones.z0;
if ((available & Zones.z4) > 0)
return Zones.z4;
if ((available & Zones.z2) > 0)
return Zones.z2;
}
return 0;
}
private bool TerraformingEffect()
{
AI.SelectCard(CardId.TrickstarLightStage);
return true;
}
private bool ReinforcementofTheArmyEffect()
{
AI.SelectCard(CardId.ArmageddonKnight);
return true;
}
private bool FoolishBurialEffect()
{
AI.SelectCard(new[] {
CardId.DestrudoTheLostDragonsFrisson,
CardId.JetSynchron,
CardId.OrcustHarpHorror,
CardId.OrcustCymbalSkeleton
});
return true;
}
private bool LightStageEffect()
{
if (Card.Location == CardLocation.Hand || Card.IsFacedown())
{
ClientCard field = Bot.GetFieldSpellCard();
if ((field?.IsCode(CardId.OrcustratedBabel) ?? false) && Bot.GetMonsterCount() > 1)
return false;
if ((field?.IsCode(CardId.TrickstarLightStage) ?? false) && Bot.HasInHandOrInMonstersZoneOrInGraveyard(CardId.TrickstarCandina) && Bot.HasInHandOrInMonstersZoneOrInGraveyard(CardId.TrickstarCarobein))
return false;
AI.SelectYesNo(true);
if (Bot.HasInHandOrHasInMonstersZone(CardId.TrickstarCandina))
AI.SelectCard(CardId.TrickstarCarobein);
else
AI.SelectCard(CardId.TrickstarCandina);
return true;
}
ClientCard target = Enemy.SpellZone.GetFirstMatchingCard(card => card.IsFacedown());
LightStageTarget = target;
AI.SelectCard(target);
return true;
}
private bool CarobeinSummon()
{
if (Bot.HasInMonstersZone(CardId.TrickstarCandina))
{
// TODO: beat mode
return Bot.HasInExtra(CardId.KnightmarePhoenix);
}
else
{
return !NormalSummoned && Bot.Hand.IsExistingMatchingCard(card => card.Level <= 4);
}
}
private bool EngageEffect()
{
bool needProtect = false;
if (Bot.HasInHand(CardId.ArmageddonKnight))
needProtect = true;
else if (Bot.HasInHandOrInGraveyard(CardId.DestrudoTheLostDragonsFrisson) && Bot.Hand.IsExistingMatchingCard(card => card.Level <= 4))
needProtect = true;
else if (Bot.HasInHand(CardId.TrickstarCandina))
needProtect = true;
if (needProtect)
AI.SelectCard(CardId.SkyStrikerMechaEagleBooster);
else
AI.SelectCard(CardId.SkyStrikerMechaHornetDrones);
AI.SelectYesNo(true);
return true;
}
private bool DronesEffectFirst()
{
return Bot.GetMonsterCount() == 0;
}
private bool DronesEffect()
{
return !Bot.HasInHand(CardId.ArmageddonKnight);
}
private bool CandinaSummon()
{
NormalSummoned = true;
return true;
}
private bool CandinaEffect()
{
AI.SelectCard(CardId.TrickstarLightStage);
return true;
}
private bool ArmageddonKnightSummon()
{
NormalSummoned = true;
return true;
}
private bool ArmageddonKnightEffect()
{
AI.SelectCard(new[] {
CardId.DestrudoTheLostDragonsFrisson,
CardId.OrcustHarpHorror
});
return true;
}
private bool ScrapRecyclerSummon()
{
NormalSummoned = true;
return true;
}
private bool ScrapRecyclerEffect()
{
AI.SelectCard(new[] {
CardId.JetSynchron,
CardId.OrcustHarpHorror
});
return true;
}
private bool JetSynchronSummon()
{
if (Bot.GetMonsterCount() > 0)
{
NormalSummoned = true;
return true;
}
return false;
}
private bool JetSynchronEffect()
{
AI.SelectCard(HandCosts);
return true;
}
private bool AlmirajSummon()
{
if (Bot.GetMonsterCount() > 1)
return false;
ClientCard mat = Bot.GetMonsters().First();
if(mat.IsCode(new[] {
CardId.JetSynchron,
CardId.ThePhantomKnightsofAncientCloak,
CardId.ThePhantomKnightsofSilentBoots
}))
{
AI.SelectMaterials(mat);
return true;
}
return false;
}
private bool DestrudoSummon()
{
return Bot.GetMonsterCount() > 0 && Bot.HasInExtra(new[] { CardId.CrystronNeedlefiber, CardId.KnightmarePhoenix });
}
private bool NeedlefiberSummonFirst()
{
if (!Bot.HasInExtra(CardId.BorreloadSavageDragon))
return false;
if (!Bot.HasInHand(CardId.JetSynchron) && Bot.GetRemainingCount(CardId.JetSynchron, 1) == 0)
return false;
int[] firstMats = new[] {
CardId.DestrudoTheLostDragonsFrisson,
CardId.AshBlossomJoyousSpring,
CardId.GhostBelleHauntedMansion,
CardId.ArmageddonKnight,
CardId.ScrapRecycler,
CardId.SkyStrikerMechaHornetDronesToken,
CardId.SkyStrikerAceKagari,
CardId.TrickstarCandina,
CardId.TrickstarCarobein,
CardId.OrcustHarpHorror,
CardId.OrcustCymbalSkeleton,
CardId.ThePhantomKnightsofAncientCloak,
CardId.ThePhantomKnightsofSilentBoots
};
if (Bot.MonsterZone.GetMatchingCardsCount(card => card.IsCode(firstMats)) >= 2)
{
AI.SelectMaterials(firstMats);
return true;
}
return false;
}
private bool NeedlefiberEffect()
{
AI.SelectCard(CardId.JetSynchron);
return true;
}
private bool KnightmarePhoenixSummon()
{
if (!KnightmareMermaidSummon())
return false;
if (!Bot.HasInExtra(CardId.KnightmareMermaid))
return false;
int[] firstMats = new[] {
CardId.JetSynchron,
CardId.CrystronNeedlefiber,
CardId.SkyStrikerMechaHornetDronesToken,
CardId.ThePhantomKnightsofShadeBrigandine,
CardId.ScrapRecycler,
CardId.SkyStrikerAceKagari,
CardId.ArmageddonKnight,
CardId.TrickstarCandina,
CardId.TrickstarCarobein
};
if(Bot.MonsterZone.GetMatchingCardsCount(card => card.IsCode(firstMats)) >= 2)
{
AI.SelectMaterials(firstMats);
PhoenixSelectPlace();
return true;
}
int[] secondMats = new[] {
CardId.OrcustCymbalSkeleton,
CardId.OrcustHarpHorror,
CardId.DestrudoTheLostDragonsFrisson,
CardId.JetSynchron,
CardId.AshBlossomJoyousSpring,
CardId.GhostBelleHauntedMansion,
CardId.ThePhantomKnightsofSilentBoots,
CardId.ThePhantomKnightsofAncientCloak,
CardId.MaxxC,
CardId.SalamangreatAlmiraj
};
int[] mats = firstMats.Concat(secondMats).ToArray();
if (Bot.MonsterZone.GetMatchingCardsCount(card => card.IsCode(mats)) >= 2)
{
AI.SelectMaterials(mats);
PhoenixSelectPlace();
return true;
}
return false;
}
private void PhoenixSelectPlace()
{
if (Enemy.MonsterZone[5]?.HasLinkMarker(CardLinkMarker.Top) ?? false)
AI.SelectPlace(Zones.z3);
if (Enemy.MonsterZone[6]?.HasLinkMarker(CardLinkMarker.Top) ?? false)
AI.SelectPlace(Zones.z1);
}
private bool KnightmarePhoenixEffect()
{
IList<ClientCard> costCards = Bot.Hand.GetMatchingCards(card => card.IsCode(HandCosts));
ClientCard target = Enemy.SpellZone.GetFloodgate();
if (costCards.Count > 1 || (Bot.GetHandCount() > 1 && target != null))
{
AI.SelectCard(HandCosts);
if (target == null)
target = Enemy.SpellZone.GetFirstMatchingCard(card => card != LightStageTarget);
AI.SelectNextCard(target);
return true;
}
return false;
}
private bool KnightmareMermaidSummon()
{
if (Bot.GetHandCount() == 0)
return false;
if (Bot.GetRemainingCount(CardId.OrcustKnightmare, 2) == 0)
return false;
AI.SelectPlace(Zones.ExtraMonsterZones);
return true;
}
private bool KnightmareMermaidEffect()
{
AI.SelectCard(HandCosts);
return true;
}
private bool GalateaSummonFirst()
{
// only summon with Mermaid and Orcust Knightmare
IList<ClientCard> mats = Bot.MonsterZone.GetMatchingCards(card => card.IsCode(CardId.KnightmareMermaid, CardId.OrcustKnightmare));
if (mats.Count >= 2)
{
AI.SelectMaterials(mats);
return true;
}
return false;
}
private bool OrcustKnightmareEffect()
{
if (!Bot.HasInGraveyard(CardId.OrcustHarpHorror))
{
AI.SelectCard(CardId.GalateaTheOrcustAutomaton);
AI.SelectNextCard(CardId.OrcustHarpHorror);
return true;
}
else if (!Bot.HasInGraveyard(CardId.WorldLegacyWorldWand) && Bot.GetRemainingCount(CardId.WorldLegacyWorldWand, 1) > 0)
{
AI.SelectCard(CardId.GalateaTheOrcustAutomaton);
AI.SelectNextCard(CardId.WorldLegacyWorldWand);
return true;
}
else if(!Bot.HasInGraveyard(CardId.OrcustCymbalSkeleton) && Bot.GetRemainingCount(CardId.OrcustCymbalSkeleton, 1) > 0 && Bot.HasInGraveyard(CardId.SheorcustDingirsu) && !SheorcustDingirsuSummoned)
{
AI.SelectCard(CardId.GalateaTheOrcustAutomaton);
AI.SelectNextCard(CardId.OrcustCymbalSkeleton);
return true;
}
return false;
}
private bool HarpHorrorEffect()
{
HarpHorrorUsed = true;
AI.SelectCard(CardId.OrcustCymbalSkeleton);
return true;
}
private bool WorldWandEffect()
{
AI.SelectCard(CardId.OrcustCymbalSkeleton);
return true;
}
private bool RustyBardicheSummon()
{
//if (Bot.GetRemainingCount(CardId.ThePhantomKnightsofAncientCloak, 1) == 0 && Bot.GetRemainingCount(CardId.ThePhantomKnightsofSilentBoots, 1) == 0)
// return false;
//if (Bot.GetRemainingCount(CardId.ThePhantomKnightsofShadeBrigandine, 1) == 0 && Bot.GetRemainingCount(CardId.PhantomKnightsFogBlade, 2) == 0)
// return false;
IList<ClientCard> mats = Bot.MonsterZone.GetMatchingCards(card => card.IsCode(CardId.GalateaTheOrcustAutomaton));
ClientCard mat2 = Bot.MonsterZone.GetMatchingCards(card => card.IsCode(CardId.OrcustCymbalSkeleton)).FirstOrDefault();
if (mat2 != null)
mats.Add(mat2);
AI.SelectMaterials(mats);
AI.SelectPlace(Zones.ExtraMonsterZones);
return true;
}
private bool RustyBardicheEffect()
{
if (ActivateDescription == -1 || ActivateDescription == Util.GetStringId(CardId.ThePhantomKnightsofRustyBardiche, 0))
{
ClientCard target = Util.GetBestEnemyCard(false, true);
if (target == null)
return false;
RustyBardicheTarget = target;
AI.SelectCard(target);
return true;
}
else
{
AI.SelectCard(CardId.ThePhantomKnightsofAncientCloak);
if (Bot.HasInMonstersZone(CardId.JetSynchron) && !Bot.MonsterZone.IsExistingMatchingCard(card => card.Level == 4))
AI.SelectNextCard(CardId.ThePhantomKnightsofShadeBrigandine);
else
AI.SelectNextCard(CardId.PhantomKnightsFogBlade);
return true;
}
}
private bool CymbalSkeletonEffect()
{
int[] botTurnTargets = new[] { CardId.GalateaTheOrcustAutomaton, CardId.SheorcustDingirsu };
int[] emenyTurnTargets = new[] { CardId.SheorcustDingirsu, CardId.GalateaTheOrcustAutomaton };
if (Duel.Player == 0 && Bot.HasInGraveyard(CardId.GalateaTheOrcustAutomaton) && !Bot.HasInMonstersZone(CardId.GalateaTheOrcustAutomaton))
{
AI.SelectCard(botTurnTargets);
CymbalSkeletonUsed = true;
return true;
}
else if (Duel.Player == 0 && Bot.HasInGraveyard(CardId.SheorcustDingirsu) && !SheorcustDingirsuSummoned)
{
AI.SelectCard(botTurnTargets);
SheorcustDingirsuSummoned = true;
CymbalSkeletonUsed = true;
return true;
}
if (Duel.Player == 1 && Bot.HasInGraveyard(CardId.SheorcustDingirsu) && !SheorcustDingirsuSummoned &&
(Util.GetProblematicEnemyCard() != null || Duel.Phase == DuelPhase.End))
{
AI.SelectCard(emenyTurnTargets);
CymbalSkeletonUsed = true;
SheorcustDingirsuSummoned = true;
return true;
}
return false;
}
private bool SheorcustDingirsuSummon()
{
SheorcustDingirsuSummoned = true;
return true;
}
private bool SheorcustDingirsuEffect()
{
ClientCard target;
target = Util.GetProblematicEnemyMonster();
if (target != null && target != RustyBardicheTarget)
{
AI.SelectOption(0);
AI.SelectCard(target);
return true;
}
target = Util.GetProblematicEnemySpell();
if (target != null && target != RustyBardicheTarget)
{
AI.SelectOption(0);
AI.SelectCard(target);
return true;
}
AI.SelectOption(1);
AI.SelectCard(CardId.OrcustCymbalSkeleton);
return true;
}
private bool AncientCloakEffect()
{
if (Bot.HasInMonstersZone(CardId.SalamangreatAlmiraj) && Bot.HasInExtra(CardId.KnightmarePhoenix))
AI.SelectCard(CardId.ThePhantomKnightsofShadeBrigandine);
else
AI.SelectCard(CardId.ThePhantomKnightsofSilentBoots);
return true;
}
private bool SilentBootsSummon()
{
return true;
}
private bool SilentBootsEffect()
{
if (Bot.HasInMonstersZone(CardId.SalamangreatAlmiraj) && Bot.HasInExtra(CardId.KnightmarePhoenix))
AI.SelectCard(CardId.ThePhantomKnightsofShadeBrigandine);
else
AI.SelectCard(CardId.PhantomKnightsFogBlade);
return true;
}
private bool ShadeBrigandineSummonSecond()
{
return (Bot.HasInMonstersZone(CardId.SalamangreatAlmiraj) && Bot.HasInExtra(CardId.KnightmarePhoenix)) ||
(Bot.HasInMonstersZone(CardId.JetSynchron) && Bot.HasInMonstersZone(CardId.ThePhantomKnightsofSilentBoots));
}
private bool GalateaSummonSecond()
{
if (!Util.IsTurn1OrMain2())
return false;
if (Bot.HasInMonstersZone(CardId.GalateaTheOrcustAutomaton))
return false;
IList<ClientCard> mats = Bot.MonsterZone.GetMatchingCards(card => card.IsCode(CardId.SheorcustDingirsu) || (card.Level > 0 && card.Level <= 7));
if (mats.Count >= 2)
{
AI.SelectMaterials(new[] {
CardId.SkyStrikerMechaHornetDronesToken,
CardId.ThePhantomKnightsofShadeBrigandine,
CardId.ThePhantomKnightsofSilentBoots,
CardId.ThePhantomKnightsofAncientCloak,
CardId.OrcustCymbalSkeleton,
CardId.OrcustHarpHorror,
CardId.CrystronNeedlefiber,
CardId.SkyStrikerAceKagari,
CardId.ArmageddonKnight
});
return true;
}
return false;
}
private bool GalateaEffect()
{
if (Duel.Player == 0)
{
AI.SelectCard(CardId.OrcustKnightmare);
AI.SelectNextCard(CardId.OrcustratedBabel);
}
if (Duel.Player == 1)
{
AI.SelectCard(CardId.OrcustKnightmare);
AI.SelectNextCard(CardId.OrcustratedClimax);
}
return true;
}
private bool BabelEffect()
{
if (Card.Location == CardLocation.Grave)
{
IList<ClientCard> costCards = Bot.Hand.GetMatchingCards(card => card.IsCode(HandCosts));
if (costCards.Count > 0)
{
AI.SelectCard(HandCosts);
return true;
}
return false;
}
return Bot.HasInMonstersZoneOrInGraveyard(new[] {
CardId.OrcustCymbalSkeleton,
CardId.OrcustHarpHorror,
CardId.OrcustKnightmare,
CardId.GalateaTheOrcustAutomaton,
CardId.LongirsuTheOrcustOrchestrator,
CardId.SheorcustDingirsu
});
}
private bool ShadeBrigandineSummonFirst()
{
return Bot.GetMonsterCount() < 2;
}
private bool OtherSummon()
{
NormalSummoned = true;
return true;
}
private bool BorreloadSavageDragonEffect()
{
if (Duel.CurrentChain.Count == 0)
{
AI.SelectCard(new[] { CardId.KnightmarePhoenix, CardId.CrystronNeedlefiber });
return true;
}
else
{
return true;
}
}
private bool FogBladeEffect()
{
if (Card.Location == CardLocation.SpellZone)
{
return !Util.HasChainedTrap(0) && DefaultDisableMonster();
}
else if (Bot.HasInGraveyard(CardId.ThePhantomKnightsofRustyBardiche) || Bot.GetMonsterCount() < 2)
{
AI.SelectCard(CardId.ThePhantomKnightsofRustyBardiche);
return true;
}
return false;
}
private bool ClimaxEffect()
{
if (Card.Location == CardLocation.SpellZone)
{
return Duel.LastChainPlayer == 1;
}
// TODO
return false;
}
private bool EagleBoosterEffect()
{
if (Duel.LastChainPlayer != 1)
return false;
ClientCard target = Bot.GetMonstersInExtraZone().GetFirstMatchingCard(
card => Duel.CurrentChain.Contains(card) || card.IsCode(CardId.KnightmareMermaid));
if (target != null)
{
AI.SelectCard(target);
return true;
}
return false;
}
}
}
...@@ -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;
} }
...@@ -353,7 +355,10 @@ namespace WindBot.Game.AI.Decks ...@@ -353,7 +355,10 @@ namespace WindBot.Game.AI.Decks
return true; return true;
} }
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,11 +218,10 @@ namespace WindBot.Game.AI.Decks ...@@ -216,11 +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
})) }) || (Bot.HasInHand(CardId.MistArchfiend) && NeedLV5()))
{ {
NormalSummoned = false; NormalSummoned = false;
DoubleSummonUsed = true; DoubleSummonUsed = true;
...@@ -236,7 +237,7 @@ namespace WindBot.Game.AI.Decks ...@@ -236,7 +237,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 +283,12 @@ namespace WindBot.Game.AI.Decks ...@@ -282,12 +283,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 +301,9 @@ namespace WindBot.Game.AI.Decks ...@@ -300,9 +301,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 +358,7 @@ namespace WindBot.Game.AI.Decks ...@@ -357,7 +358,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 +385,10 @@ namespace WindBot.Game.AI.Decks ...@@ -384,9 +385,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
...@@ -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;
} }
......
...@@ -325,7 +325,7 @@ namespace WindBot.Game.AI.Decks ...@@ -325,7 +325,7 @@ namespace WindBot.Game.AI.Decks
// can ss from exdeck // can ss from exdeck
if (judge) if (judge)
{ {
bool fornextss = AI.Utils.ChainContainsCard(CardId.Awaken); bool fornextss = Util.ChainContainsCard(CardId.Awaken);
IList<ClientCard> ex = Bot.ExtraDeck; IList<ClientCard> ex = Bot.ExtraDeck;
ClientCard ex_best = null; ClientCard ex_best = null;
foreach (ClientCard ex_card in ex) foreach (ClientCard ex_card in ex)
...@@ -389,7 +389,7 @@ namespace WindBot.Game.AI.Decks ...@@ -389,7 +389,7 @@ namespace WindBot.Game.AI.Decks
AI.SelectCard(ex_best); AI.SelectCard(ex_best);
} }
} }
if (!judge || AI.Utils.ChainContainsCard(CardId.Awaken)) if (!judge || Util.ChainContainsCard(CardId.Awaken))
{ {
// cannot ss from exdeck or have more than 1 grass in chain // cannot ss from exdeck or have more than 1 grass in chain
int[] secondselect = new[] int[] secondselect = new[]
...@@ -405,7 +405,7 @@ namespace WindBot.Game.AI.Decks ...@@ -405,7 +405,7 @@ namespace WindBot.Game.AI.Decks
CardId.Yellow, CardId.Yellow,
CardId.Pink CardId.Pink
}; };
if (!AI.Utils.ChainContainsCard(CardId.Awaken)) if (!Util.ChainContainsCard(CardId.Awaken))
{ {
if (!judge && Bot.GetRemainingCount(CardId.Ghost, 2) > 0) if (!judge && Bot.GetRemainingCount(CardId.Ghost, 2) > 0)
{ {
...@@ -437,12 +437,12 @@ namespace WindBot.Game.AI.Decks ...@@ -437,12 +437,12 @@ namespace WindBot.Game.AI.Decks
// counter // counter
if (!Enemy.HasInMonstersZone(CardId.Ghost) || Enemy.GetHandCount() <= 1) if (!Enemy.HasInMonstersZone(CardId.Ghost) || Enemy.GetHandCount() <= 1)
{ {
ClientCard tosolve = AI.Utils.GetProblematicEnemyCard(); ClientCard tosolve = Util.GetProblematicEnemyCard();
if (tosolve == null) if (tosolve == null)
{ {
if (Duel.LastChainPlayer == 1 && AI.Utils.GetLastChainCard() != null) if (Duel.LastChainPlayer == 1 && Util.GetLastChainCard() != null)
{ {
ClientCard target = AI.Utils.GetLastChainCard(); ClientCard target = Util.GetLastChainCard();
if (target.HasPosition(CardPosition.FaceUp) && (target.Location == CardLocation.MonsterZone || target.Location == CardLocation.SpellZone)) tosolve = target; if (target.HasPosition(CardPosition.FaceUp) && (target.Location == CardLocation.MonsterZone || target.Location == CardLocation.SpellZone)) tosolve = target;
} }
} }
...@@ -494,7 +494,7 @@ namespace WindBot.Game.AI.Decks ...@@ -494,7 +494,7 @@ namespace WindBot.Game.AI.Decks
ClientCard selected = null; ClientCard selected = null;
if (Card.Location == CardLocation.Grave) if (Card.Location == CardLocation.Grave)
{ {
selected = AI.Utils.GetBestEnemySpell(true); selected = Util.GetBestEnemySpell(true);
} }
else else
{ {
...@@ -524,7 +524,7 @@ namespace WindBot.Game.AI.Decks ...@@ -524,7 +524,7 @@ namespace WindBot.Game.AI.Decks
public bool Feather_Act() public bool Feather_Act()
{ {
if (!spell_trap_activate()) return false; if (!spell_trap_activate()) return false;
if (AI.Utils.GetProblematicEnemySpell() != null) if (Util.GetProblematicEnemySpell() != null)
{ {
List<ClientCard> grave = Bot.GetGraveyardSpells(); List<ClientCard> grave = Bot.GetGraveyardSpells();
foreach (ClientCard self_card in grave) foreach (ClientCard self_card in grave)
...@@ -547,7 +547,7 @@ namespace WindBot.Game.AI.Decks ...@@ -547,7 +547,7 @@ namespace WindBot.Game.AI.Decks
if (!spell_trap_activate()) return false; if (!spell_trap_activate()) return false;
if (Duel.Player == 0) return false; if (Duel.Player == 0) return false;
if (Duel.Phase == DuelPhase.End) return true; if (Duel.Phase == DuelPhase.End) return true;
if (Duel.LastChainPlayer == 1 && (AI.Utils.IsChainTarget(Card) || (AI.Utils.GetLastChainCard().IsCode(CardId.Feather) && !Bot.HasInSpellZone(CardId.Awaken)))) return true; if (Duel.LastChainPlayer == 1 && (Util.IsChainTarget(Card) || (Util.GetLastChainCard().IsCode(CardId.Feather) && !Bot.HasInSpellZone(CardId.Awaken)))) return true;
if (Duel.Phase > DuelPhase.Main1 && Duel.Phase < DuelPhase.Main2) if (Duel.Phase > DuelPhase.Main1 && Duel.Phase < DuelPhase.Main2)
{ {
int total_atk = 0; int total_atk = 0;
...@@ -585,7 +585,7 @@ namespace WindBot.Game.AI.Decks ...@@ -585,7 +585,7 @@ namespace WindBot.Game.AI.Decks
stage_locked = null; stage_locked = null;
return true; return true;
} }
else if (Enemy.GetMonsterCount() > 0 && AI.Utils.GetBestEnemyMonster().Attack >= AI.Utils.GetBestAttack(Bot)) else if (Enemy.GetMonsterCount() > 0 && Util.GetBestEnemyMonster().Attack >= Util.GetBestAttack(Bot))
{ {
AI.SelectCard(CardId.White, CardId.Yellow, CardId.Pink, CardId.Red); AI.SelectCard(CardId.White, CardId.Yellow, CardId.Pink, CardId.Red);
stage_locked = null; stage_locked = null;
...@@ -608,7 +608,7 @@ namespace WindBot.Game.AI.Decks ...@@ -608,7 +608,7 @@ namespace WindBot.Game.AI.Decks
stage_locked = null; stage_locked = null;
return true; return true;
} }
if (Enemy.GetMonsterCount() > 0 && AI.Utils.GetBestEnemyMonster().Attack >= AI.Utils.GetBestAttack(Bot) && !Bot.HasInHand(CardId.White)) if (Enemy.GetMonsterCount() > 0 && Util.GetBestEnemyMonster().Attack >= Util.GetBestAttack(Bot) && !Bot.HasInHand(CardId.White))
{ {
AI.SelectCard(CardId.White, CardId.Yellow, CardId.Pink, CardId.Red); AI.SelectCard(CardId.White, CardId.Yellow, CardId.Pink, CardId.Red);
stage_locked = null; stage_locked = null;
...@@ -674,7 +674,7 @@ namespace WindBot.Game.AI.Decks ...@@ -674,7 +674,7 @@ namespace WindBot.Game.AI.Decks
pink_ss = true; pink_ss = true;
return true; return true;
} }
else if (Enemy.GetMonsterCount() > 0 && (AI.Utils.GetBestEnemyMonster().Attack - 800 >= Bot.LifePoints)) return false; else if (Enemy.GetMonsterCount() > 0 && (Util.GetBestEnemyMonster().Attack - 800 >= Bot.LifePoints)) return false;
pink_ss = true; pink_ss = true;
return true; return true;
} }
...@@ -695,9 +695,9 @@ namespace WindBot.Game.AI.Decks ...@@ -695,9 +695,9 @@ namespace WindBot.Game.AI.Decks
public bool Eater_ss() public bool Eater_ss()
{ {
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>();
if (Bot.SpellZone[5] != null && !Bot.SpellZone[5].IsCode(CardId.Stage)) if (Bot.SpellZone[5] != null && !Bot.SpellZone[5].IsCode(CardId.Stage))
...@@ -742,7 +742,7 @@ namespace WindBot.Game.AI.Decks ...@@ -742,7 +742,7 @@ namespace WindBot.Game.AI.Decks
if (Duel.Player == 0) if (Duel.Player == 0)
{ {
List<ClientCard> monster_list = Bot.GetMonsters(); List<ClientCard> monster_list = Bot.GetMonsters();
monster_list.Sort(AIFunctions.CompareCardAttack); monster_list.Sort(CardContainer.CompareCardAttack);
monster_list.Reverse(); monster_list.Reverse();
foreach(ClientCard card in monster_list) foreach(ClientCard card in monster_list)
{ {
...@@ -753,7 +753,7 @@ namespace WindBot.Game.AI.Decks ...@@ -753,7 +753,7 @@ namespace WindBot.Game.AI.Decks
} else if (card.RealPower >= self_power) self_power = card.RealPower; } else if (card.RealPower >= self_power) self_power = card.RealPower;
} }
} }
ClientCard bestenemy = AI.Utils.GetOneEnemyBetterThanValue(self_power, true); ClientCard bestenemy = Util.GetOneEnemyBetterThanValue(self_power, true);
if (bestenemy != null) AI.SelectPosition(CardPosition.FaceUpDefence); if (bestenemy != null) AI.SelectPosition(CardPosition.FaceUpDefence);
else AI.SelectPosition(CardPosition.FaceUpAttack); else AI.SelectPosition(CardPosition.FaceUpAttack);
return; return;
...@@ -762,12 +762,12 @@ namespace WindBot.Game.AI.Decks ...@@ -762,12 +762,12 @@ namespace WindBot.Game.AI.Decks
public bool Red_ss() public bool Red_ss()
{ {
if (red_ss_count >= 6) return false; if (red_ss_count >= 6) return false;
if ((AI.Utils.ChainContainsCard(CardId.DarkHole) || AI.Utils.ChainContainsCard(99330325) || AI.Utils.ChainContainsCard(53582587)) && AI.Utils.ChainContainsCard(CardId.Red)) return false; if ((Util.ChainContainsCard(CardId.DarkHole) || Util.ChainContainsCard(99330325) || Util.ChainContainsCard(53582587)) && Util.ChainContainsCard(CardId.Red)) return false;
if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard().IsCode(CardId.Red)) if (Duel.LastChainPlayer == 0 && Util.GetLastChainCard().IsCode(CardId.Red))
{ {
foreach (ClientCard m in Bot.GetMonsters()) foreach (ClientCard m in Bot.GetMonsters())
{ {
if (AI.Utils.IsChainTarget(m) && IsTrickstar(m.Id)) if (Util.IsChainTarget(m) && IsTrickstar(m.Id))
{ {
red_ss_count += 1; red_ss_count += 1;
AI.SelectCard(m); AI.SelectCard(m);
...@@ -779,11 +779,11 @@ namespace WindBot.Game.AI.Decks ...@@ -779,11 +779,11 @@ namespace WindBot.Game.AI.Decks
if (Duel.LastChainPlayer == 1) return true; if (Duel.LastChainPlayer == 1) return true;
if (Duel.Player == 0) if (Duel.Player == 0)
{ {
if (AI.Utils.IsTurn1OrMain2()) return false; if (Util.IsTurn1OrMain2()) return false;
if (Duel.Phase > DuelPhase.Main1 && Duel.Phase < DuelPhase.Main2) if (Duel.Phase > DuelPhase.Main1 && Duel.Phase < DuelPhase.Main2)
{ {
List<ClientCard> self_m = Bot.GetMonsters(); List<ClientCard> self_m = Bot.GetMonsters();
ClientCard tosolve_enemy = AI.Utils.GetOneEnemyBetterThanMyBest(); ClientCard tosolve_enemy = Util.GetOneEnemyBetterThanMyBest();
foreach (ClientCard c in self_m) foreach (ClientCard c in self_m)
{ {
if (IsTrickstar(c.Id) && !c.IsCode(CardId.Red)) if (IsTrickstar(c.Id) && !c.IsCode(CardId.Red))
...@@ -838,10 +838,10 @@ namespace WindBot.Game.AI.Decks ...@@ -838,10 +838,10 @@ namespace WindBot.Game.AI.Decks
{ {
if (Duel.Phase > DuelPhase.Main1 && Duel.Phase < DuelPhase.Main2) if (Duel.Phase > DuelPhase.Main1 && Duel.Phase < DuelPhase.Main2)
{ {
if (AI.Utils.GetOneEnemyBetterThanMyBest() != null) if (Util.GetOneEnemyBetterThanMyBest() != null)
{ {
List<ClientCard> self_monster = Bot.GetMonsters(); List<ClientCard> self_monster = Bot.GetMonsters();
self_monster.Sort(AIFunctions.CompareDefensePower); self_monster.Sort(CardContainer.CompareDefensePower);
foreach(ClientCard card in self_monster) foreach(ClientCard card in self_monster)
{ {
if (IsTrickstar(card.Id) && !card.IsCode(CardId.Red)) if (IsTrickstar(card.Id) && !card.IsCode(CardId.Red))
...@@ -878,7 +878,7 @@ namespace WindBot.Game.AI.Decks ...@@ -878,7 +878,7 @@ namespace WindBot.Game.AI.Decks
return true; return true;
} }
} }
if (Enemy.GetMonsterCount() == 0 && !AI.Utils.IsTurn1OrMain2()) if (Enemy.GetMonsterCount() == 0 && !Util.IsTurn1OrMain2())
{ {
if (Bot.HasInGraveyard(CardId.Red) && Bot.GetRemainingCount(CardId.Pink, 1) > 0 && !pink_ss) if (Bot.HasInGraveyard(CardId.Red) && Bot.GetRemainingCount(CardId.Pink, 1) > 0 && !pink_ss)
{ {
...@@ -902,9 +902,9 @@ namespace WindBot.Game.AI.Decks ...@@ -902,9 +902,9 @@ namespace WindBot.Game.AI.Decks
} }
return true; return true;
} }
if (AI.Utils.GetProblematicEnemyMonster() != null) if (Util.GetProblematicEnemyMonster() != null)
{ {
int power = AI.Utils.GetProblematicEnemyMonster().GetDefensePower(); int power = Util.GetProblematicEnemyMonster().GetDefensePower();
if (power >= 1800 && power <= 3600 && Bot.GetRemainingCount(CardId.White, 2) > 0 && !Bot.HasInHand(CardId.White)) if (power >= 1800 && power <= 3600 && Bot.GetRemainingCount(CardId.White, 2) > 0 && !Bot.HasInHand(CardId.White))
{ {
AI.SelectCard(CardId.White, CardId.Red, CardId.Pink, CardId.Re, CardId.Stage, CardId.Crown, CardId.Yellow); AI.SelectCard(CardId.White, CardId.Red, CardId.Pink, CardId.Re, CardId.Stage, CardId.Crown, CardId.Yellow);
...@@ -937,13 +937,13 @@ namespace WindBot.Game.AI.Decks ...@@ -937,13 +937,13 @@ namespace WindBot.Game.AI.Decks
return false; return false;
} else } else
{ {
if (Enemy.GetMonsterCount() == 0 && !AI.Utils.IsTurn1OrMain2()) { if (Enemy.GetMonsterCount() == 0 && !Util.IsTurn1OrMain2()) {
white_eff_used = true; white_eff_used = true;
return true; return true;
} }
else if (Enemy.GetMonsterCount() != 0) else if (Enemy.GetMonsterCount() != 0)
{ {
ClientCard tosolve = AI.Utils.GetBestEnemyMonster(true); ClientCard tosolve = Util.GetBestEnemyMonster(true);
ClientCard self_card = Bot.GetMonsters().GetHighestAttackMonster(); ClientCard self_card = Bot.GetMonsters().GetHighestAttackMonster();
if (tosolve == null || self_card == null || (tosolve != null && self_card != null && !IsTrickstar(self_card.Id))) if (tosolve == null || self_card == null || (tosolve != null && self_card != null && !IsTrickstar(self_card.Id)))
{ {
...@@ -985,8 +985,8 @@ namespace WindBot.Game.AI.Decks ...@@ -985,8 +985,8 @@ namespace WindBot.Game.AI.Decks
lockbird_useful = true; lockbird_useful = true;
if (Bot.HasInSpellZone(CardId.Re)) if (Bot.HasInSpellZone(CardId.Re))
{ {
if (AI.Utils.ChainContainsCard(CardId.Re)) lockbird_used = true; if (Util.ChainContainsCard(CardId.Re)) lockbird_used = true;
return AI.Utils.ChainContainsCard(CardId.Re); return Util.ChainContainsCard(CardId.Re);
} }
lockbird_used = true; lockbird_used = true;
return true; return true;
...@@ -998,7 +998,7 @@ namespace WindBot.Game.AI.Decks ...@@ -998,7 +998,7 @@ namespace WindBot.Game.AI.Decks
if (!spell_trap_activate()) return false; if (!spell_trap_activate()) return false;
if (Bot.HasInHand(CardId.LockBird)) if (Bot.HasInHand(CardId.LockBird))
{ {
if (lockbird_useful || AI.Utils.IsChainTarget(Card) || (Duel.Player == 1 && AI.Utils.ChainContainsCard(CardId.Feather))) { if (lockbird_useful || Util.IsChainTarget(Card) || (Duel.Player == 1 && Util.ChainContainsCard(CardId.Feather))) {
lockbird_useful = false; lockbird_useful = false;
return true; return true;
} }
...@@ -1033,7 +1033,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1033,7 +1033,7 @@ namespace WindBot.Game.AI.Decks
if (hand.Attack >= Enemy.LifePoints) return true; if (hand.Attack >= Enemy.LifePoints) return true;
if (!hand.IsCode(CardId.Yellow)) if (!hand.IsCode(CardId.Yellow))
{ {
if (AI.Utils.GetOneEnemyBetterThanValue(hand.Attack, false) == null) return true; if (Util.GetOneEnemyBetterThanValue(hand.Attack, false) == null) return true;
} }
} }
} }
...@@ -1043,7 +1043,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1043,7 +1043,7 @@ namespace WindBot.Game.AI.Decks
public bool Ts_reborn() public bool Ts_reborn()
{ {
if (AI.Utils.IsTurn1OrMain2()) return false; if (Util.IsTurn1OrMain2()) return false;
if (Duel.Player == 0 && Enemy.LifePoints <= 1000) if (Duel.Player == 0 && Enemy.LifePoints <= 1000)
{ {
AI.SelectCard(CardId.Pink); AI.SelectCard(CardId.Pink);
...@@ -1094,7 +1094,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1094,7 +1094,7 @@ namespace WindBot.Game.AI.Decks
NormalSummoned = true; NormalSummoned = true;
return true; return true;
} }
else if (!AI.Utils.IsTurn1OrMain2() && (Bot.HasInGraveyard(CardId.Yellow) || Bot.HasInGraveyard(CardId.Red))) else if (!Util.IsTurn1OrMain2() && (Bot.HasInGraveyard(CardId.Yellow) || Bot.HasInGraveyard(CardId.Red)))
{ {
NormalSummoned = true; NormalSummoned = true;
return true; return true;
...@@ -1140,12 +1140,12 @@ namespace WindBot.Game.AI.Decks ...@@ -1140,12 +1140,12 @@ namespace WindBot.Game.AI.Decks
public bool Ring_act() public bool Ring_act()
{ {
if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard() != null && AI.Utils.GetLastChainCard().IsCode(CardId.Ghost)) return false; if (Duel.LastChainPlayer == 0 && Util.GetLastChainCard() != null && Util.GetLastChainCard().IsCode(CardId.Ghost)) return false;
if (!spell_trap_activate()) return false; if (!spell_trap_activate()) 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(); target = Util.GetBestEnemyMonster();
} }
if (target != null) if (target != null)
{ {
...@@ -1171,7 +1171,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1171,7 +1171,7 @@ namespace WindBot.Game.AI.Decks
public bool Linkuri_eff() public bool Linkuri_eff()
{ {
if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard().IsCode(CardId.Linkuri)) return false; if (Duel.LastChainPlayer == 0 && Util.GetLastChainCard().IsCode(CardId.Linkuri)) return false;
AI.SelectCard(CardId.Tuner, CardId.BF + 1); AI.SelectCard(CardId.Tuner, CardId.BF + 1);
return true; return true;
} }
...@@ -1200,7 +1200,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1200,7 +1200,7 @@ namespace WindBot.Game.AI.Decks
} }
if (targets.Count == 0) return false; if (targets.Count == 0) return false;
List<ClientCard> m_list = new List<ClientCard>(Bot.GetMonsters()); List<ClientCard> m_list = new List<ClientCard>(Bot.GetMonsters());
m_list.Sort(AIFunctions.CompareCardAttack); m_list.Sort(CardContainer.CompareCardAttack);
foreach (ClientCard e_check in m_list) foreach (ClientCard e_check in m_list)
{ {
if (e_check.IsFacedown()) continue; if (e_check.IsFacedown()) continue;
...@@ -1223,9 +1223,9 @@ namespace WindBot.Game.AI.Decks ...@@ -1223,9 +1223,9 @@ namespace WindBot.Game.AI.Decks
AI.SelectCard(CardId.Tuner, CardId.Ghost, CardId.Urara); AI.SelectCard(CardId.Tuner, CardId.Ghost, CardId.Urara);
return true; return true;
} }
else if (AI.Utils.IsChainTarget(Card) || AI.Utils.GetProblematicEnemySpell() != null) return true; else if (Util.IsChainTarget(Card) || Util.GetProblematicEnemySpell() != null) 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)) {
if (AI.Utils.IsOneEnemyBetterThanValue(1900, true)) if (Util.IsOneEnemyBetterThanValue(1900, true))
{ {
AI.SelectPosition(CardPosition.FaceUpDefence); AI.SelectPosition(CardPosition.FaceUpDefence);
} }
...@@ -1241,7 +1241,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1241,7 +1241,7 @@ namespace WindBot.Game.AI.Decks
public bool TG_eff() public bool TG_eff()
{ {
if (Card.Location != CardLocation.MonsterZone) return true; if (Card.Location != CardLocation.MonsterZone) return true;
ClientCard target = AI.Utils.GetProblematicEnemySpell(); ClientCard target = Util.GetProblematicEnemySpell();
IList<ClientCard> list = new List<ClientCard>(); IList<ClientCard> list = new List<ClientCard>();
if (target != null) list.Add(target); if (target != null) list.Add(target);
foreach(ClientCard spells in Enemy.GetSpells()) foreach(ClientCard spells in Enemy.GetSpells())
...@@ -1254,8 +1254,8 @@ namespace WindBot.Game.AI.Decks ...@@ -1254,8 +1254,8 @@ namespace WindBot.Game.AI.Decks
public bool Safedragon_ss() public bool Safedragon_ss()
{ {
if (AI.Utils.IsTurn1OrMain2()) return false; if (Util.IsTurn1OrMain2()) return false;
ClientCard m = AI.Utils.GetProblematicEnemyMonster(); ClientCard m = Util.GetProblematicEnemyMonster();
foreach(ClientCard ex_m in Bot.GetMonstersInExtraZone()) foreach(ClientCard ex_m in Bot.GetMonstersInExtraZone())
{ {
if (getLinkMarker(ex_m.Id) >= 4) return false; if (getLinkMarker(ex_m.Id) >= 4) return false;
...@@ -1302,14 +1302,14 @@ namespace WindBot.Game.AI.Decks ...@@ -1302,14 +1302,14 @@ namespace WindBot.Game.AI.Decks
public bool Phoneix_ss() public bool Phoneix_ss()
{ {
ClientCard m = AI.Utils.GetProblematicEnemySpell(); ClientCard m = Util.GetProblematicEnemySpell();
if (m == null) if (m == null)
{ {
if (Enemy.GetMonsterCount() == 0 && Enemy.LifePoints <= 1900 && Duel.Phase == DuelPhase.Main1) if (Enemy.GetMonsterCount() == 0 && Enemy.LifePoints <= 1900 && Duel.Phase == DuelPhase.Main1)
{ {
IList<ClientCard> m_list = new List<ClientCard>(); IList<ClientCard> m_list = new List<ClientCard>();
List<ClientCard> list = new List<ClientCard>(Bot.GetMonsters()); List<ClientCard> list = new List<ClientCard>(Bot.GetMonsters());
list.Sort(AIFunctions.CompareCardAttack); list.Sort(CardContainer.CompareCardAttack);
foreach(ClientCard monster in list) foreach(ClientCard monster in list)
{ {
if (getLinkMarker(monster.Id) == 1 && monster.IsFaceup()) m_list.Add(monster); if (getLinkMarker(monster.Id) == 1 && monster.IsFaceup()) m_list.Add(monster);
...@@ -1326,7 +1326,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1326,7 +1326,7 @@ namespace WindBot.Game.AI.Decks
if (Bot.Hand.Count == 0) return false; if (Bot.Hand.Count == 0) return false;
IList<ClientCard> targets = new List<ClientCard>(); IList<ClientCard> targets = new List<ClientCard>();
List<ClientCard> main_list = new List<ClientCard>(Bot.GetMonstersInMainZone()); List<ClientCard> main_list = new List<ClientCard>(Bot.GetMonstersInMainZone());
main_list.Sort(AIFunctions.CompareCardAttack); main_list.Sort(CardContainer.CompareCardAttack);
foreach (ClientCard s_m in main_list) foreach (ClientCard s_m in main_list)
{ {
if (s_m.IsFacedown()) continue; if (s_m.IsFacedown()) continue;
...@@ -1356,7 +1356,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1356,7 +1356,7 @@ namespace WindBot.Game.AI.Decks
public bool Phoneix_eff() public bool Phoneix_eff()
{ {
AI.SelectCard(Useless_List()); AI.SelectCard(Useless_List());
ClientCard target = AI.Utils.GetProblematicEnemySpell(); ClientCard target = Util.GetProblematicEnemySpell();
if (target != null) if (target != null)
{ {
AI.SelectNextCard(target); AI.SelectNextCard(target);
...@@ -1373,7 +1373,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1373,7 +1373,7 @@ namespace WindBot.Game.AI.Decks
} }
public bool Unicorn_ss() { public bool Unicorn_ss() {
ClientCard m = AI.Utils.GetProblematicEnemyCard(); ClientCard m = Util.GetProblematicEnemyCard();
int link_count = 0; int link_count = 0;
if (m == null) if (m == null)
{ {
...@@ -1381,7 +1381,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1381,7 +1381,7 @@ namespace WindBot.Game.AI.Decks
{ {
IList<ClientCard> m_list = new List<ClientCard>(); IList<ClientCard> m_list = new List<ClientCard>();
List<ClientCard> _sort_list = new List<ClientCard>(Bot.GetMonsters()); List<ClientCard> _sort_list = new List<ClientCard>(Bot.GetMonsters());
_sort_list.Sort(AIFunctions.CompareCardAttack); _sort_list.Sort(CardContainer.CompareCardAttack);
foreach(ClientCard monster in _sort_list) foreach(ClientCard monster in _sort_list)
{ {
if (getLinkMarker(monster.Id) == 2) if (getLinkMarker(monster.Id) == 2)
...@@ -1406,7 +1406,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1406,7 +1406,7 @@ namespace WindBot.Game.AI.Decks
if (Bot.Hand.Count == 0) return false; if (Bot.Hand.Count == 0) return false;
IList<ClientCard> targets = new List<ClientCard>(); IList<ClientCard> targets = new List<ClientCard>();
List<ClientCard> sort_list = Bot.GetMonsters(); List<ClientCard> sort_list = Bot.GetMonsters();
sort_list.Sort(AIFunctions.CompareCardAttack); sort_list.Sort(CardContainer.CompareCardAttack);
foreach (ClientCard s_m in sort_list) foreach (ClientCard s_m in sort_list)
{ {
if ((!s_m.IsCode(CardId.Eater) || (s_m.IsCode(CardId.Eater) && m.IsMonsterHasPreventActivationEffectInBattle())) && getLinkMarker(s_m.Id) <= 2 && s_m.IsFaceup()) if ((!s_m.IsCode(CardId.Eater) || (s_m.IsCode(CardId.Eater) && m.IsMonsterHasPreventActivationEffectInBattle())) && getLinkMarker(s_m.Id) <= 2 && s_m.IsFaceup())
...@@ -1426,7 +1426,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1426,7 +1426,7 @@ namespace WindBot.Game.AI.Decks
public bool Unicorn_eff() public bool Unicorn_eff()
{ {
ClientCard m = AI.Utils.GetProblematicEnemyCard(); ClientCard m = Util.GetProblematicEnemyCard();
if (m == null) return false; if (m == null) return false;
// avoid cards that cannot target. // avoid cards that cannot target.
AI.SelectCard(Useless_List()); AI.SelectCard(Useless_List());
...@@ -1466,7 +1466,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1466,7 +1466,7 @@ namespace WindBot.Game.AI.Decks
} }
} }
List<ClientCard> sort_main_list = new List<ClientCard>(Bot.GetMonstersInMainZone()); List<ClientCard> sort_main_list = new List<ClientCard>(Bot.GetMonstersInMainZone());
sort_main_list.Sort(AIFunctions.CompareCardAttack); sort_main_list.Sort(CardContainer.CompareCardAttack);
foreach (ClientCard m in sort_main_list) foreach (ClientCard m in sort_main_list)
{ {
if (m.Attack < 1900 && !targets.ContainsCardWithId(m.Id) && m.IsFaceup()) if (m.Attack < 1900 && !targets.ContainsCardWithId(m.Id) && m.IsFaceup())
...@@ -1493,8 +1493,8 @@ namespace WindBot.Game.AI.Decks ...@@ -1493,8 +1493,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)
{ {
...@@ -1525,11 +1525,11 @@ namespace WindBot.Game.AI.Decks ...@@ -1525,11 +1525,11 @@ namespace WindBot.Game.AI.Decks
if (material_list.Count == 2) break; if (material_list.Count == 2) break;
} }
if (material_list.Count < 2) return false; if (material_list.Count < 2) return false;
if (Enemy.GetMonsterCount() == 0 || AI.Utils.GetProblematicEnemyMonster(2000) == null) if (Enemy.GetMonsterCount() == 0 || Util.GetProblematicEnemyMonster(2000) == null)
{ {
AI.SelectMaterials(material_list); AI.SelectMaterials(material_list);
return true; return true;
} else if (AI.Utils.GetProblematicEnemyMonster(2000) != null && Bot.HasInExtra(CardId.Borrel) && !Bot.HasInMonstersZone(CardId.Missus)) } else if (Util.GetProblematicEnemyMonster(2000) != null && Bot.HasInExtra(CardId.Borrel) && !Bot.HasInMonstersZone(CardId.Missus))
{ {
AI.SelectMaterials(material_list); AI.SelectMaterials(material_list);
return true; return true;
...@@ -1547,9 +1547,9 @@ namespace WindBot.Game.AI.Decks ...@@ -1547,9 +1547,9 @@ namespace WindBot.Game.AI.Decks
{ {
bool already_link2 = false; bool already_link2 = false;
IList<ClientCard> material_list = new List<ClientCard>(); IList<ClientCard> material_list = new List<ClientCard>();
if (AI.Utils.GetProblematicEnemyMonster(2000) == null) Logger.DebugWriteLine("***borrel:null"); if (Util.GetProblematicEnemyMonster(2000) == null) Logger.DebugWriteLine("***borrel:null");
else Logger.DebugWriteLine("***borrel:" + (AI.Utils.GetProblematicEnemyMonster(2000).Name ?? "unknown")); else Logger.DebugWriteLine("***borrel:" + (Util.GetProblematicEnemyMonster(2000).Name ?? "unknown"));
if (AI.Utils.GetProblematicEnemyMonster(2000) != null || (Enemy.GetMonsterCount() == 0 && Duel.Phase == DuelPhase.Main1 && Enemy.LifePoints <= 3000)) if (Util.GetProblematicEnemyMonster(2000) != null || (Enemy.GetMonsterCount() == 0 && Duel.Phase == DuelPhase.Main1 && Enemy.LifePoints <= 3000))
{ {
foreach(ClientCard e_m in Bot.GetMonstersInExtraZone()) foreach(ClientCard e_m in Bot.GetMonstersInExtraZone())
{ {
...@@ -1560,7 +1560,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1560,7 +1560,7 @@ namespace WindBot.Game.AI.Decks
} }
} }
List<ClientCard> sort_list = new List<ClientCard>(Bot.GetMonstersInMainZone()); List<ClientCard> sort_list = new List<ClientCard>(Bot.GetMonstersInMainZone());
sort_list.Sort(AIFunctions.CompareCardAttack); sort_list.Sort(CardContainer.CompareCardAttack);
foreach(ClientCard m in sort_list) foreach(ClientCard m in sort_list)
{ {
...@@ -1600,7 +1600,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1600,7 +1600,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;
...@@ -1618,9 +1618,9 @@ namespace WindBot.Game.AI.Decks ...@@ -1618,9 +1618,9 @@ namespace WindBot.Game.AI.Decks
if (!spell_trap_activate()) return false; if (!spell_trap_activate()) return false;
if (Duel.LastChainPlayer == 1) if (Duel.LastChainPlayer == 1)
{ {
if (AI.Utils.GetLastChainCard().IsMonster() && Enemy.HasInGraveyard(AI.Utils.GetLastChainCard().Id)) if (Util.GetLastChainCard().IsMonster() && Enemy.HasInGraveyard(Util.GetLastChainCard().Id))
{ {
GraveCall_id = AI.Utils.GetLastChainCard().Id; GraveCall_id = Util.GetLastChainCard().Id;
GraveCall_count = 2; GraveCall_count = 2;
AI.SelectCard(GraveCall_id); AI.SelectCard(GraveCall_id);
return true; return true;
...@@ -1671,7 +1671,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1671,7 +1671,7 @@ namespace WindBot.Game.AI.Decks
if (newPower > bestPower) if (newPower > bestPower)
bestPower = newPower; bestPower = newPower;
} }
return AI.Utils.IsAllEnemyBetterThanValue(bestPower,true); return Util.IsAllEnemyBetterThanValue(bestPower,true);
} }
public bool MonsterRepos() public bool MonsterRepos()
......
...@@ -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);
......
...@@ -139,31 +139,31 @@ namespace WindBot.Game.AI.Decks ...@@ -139,31 +139,31 @@ 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();
return false; return false;
} }
...@@ -234,7 +234,7 @@ namespace WindBot.Game.AI.Decks ...@@ -234,7 +234,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(
......
...@@ -43,6 +43,7 @@ namespace WindBot.Game.AI ...@@ -43,6 +43,7 @@ namespace WindBot.Game.AI
public const int NumberS39UtopiaTheLightning = 56832966; public const int NumberS39UtopiaTheLightning = 56832966;
public const int Number39Utopia = 84013237; public const int Number39Utopia = 84013237;
public const int UltimayaTzolkin = 1686814; public const int UltimayaTzolkin = 1686814;
public const int MekkKnightCrusadiaAstram = 21887175;
public const int MoonMirrorShield = 19508728; public const int MoonMirrorShield = 19508728;
public const int PhantomKnightsFogBlade = 25542642; public const int PhantomKnightsFogBlade = 25542642;
...@@ -148,6 +149,9 @@ namespace WindBot.Game.AI ...@@ -148,6 +149,9 @@ namespace WindBot.Game.AI
if (!defender.IsDisabled()) if (!defender.IsDisabled())
{ {
if (defender.IsCode(_CardId.MekkKnightCrusadiaAstram) && defender.IsAttack() && attacker.IsSpecialSummoned)
return false;
if (defender.IsCode(_CardId.CrystalWingSynchroDragon) && defender.IsAttack() && attacker.Level >= 5) if (defender.IsCode(_CardId.CrystalWingSynchroDragon) && defender.IsAttack() && attacker.Level >= 5)
return false; return false;
...@@ -179,6 +183,9 @@ namespace WindBot.Game.AI ...@@ -179,6 +183,9 @@ namespace WindBot.Game.AI
} }
} }
if (Enemy.HasInMonstersZone(_CardId.MekkKnightCrusadiaAstram, true) && !(defender).IsCode(_CardId.MekkKnightCrusadiaAstram))
return false;
if (Enemy.HasInMonstersZone(_CardId.DupeFrog, true) && !(defender).IsCode(_CardId.DupeFrog)) if (Enemy.HasInMonstersZone(_CardId.DupeFrog, true) && !(defender).IsCode(_CardId.DupeFrog))
return false; return false;
...@@ -216,7 +223,7 @@ namespace WindBot.Game.AI ...@@ -216,7 +223,7 @@ namespace WindBot.Game.AI
if (Bot.BattlingMonster == null) if (Bot.BattlingMonster == null)
return false; return false;
List<ClientCard> defenders = new List<ClientCard>(Duel.Fields[1].GetMonsters()); List<ClientCard> defenders = new List<ClientCard>(Duel.Fields[1].GetMonsters());
defenders.Sort(AIFunctions.CompareDefensePower); defenders.Sort(CardContainer.CompareDefensePower);
defenders.Reverse(); defenders.Reverse();
BattlePhaseAction result = OnSelectAttackTarget(Bot.BattlingMonster, defenders); BattlePhaseAction result = OnSelectAttackTarget(Bot.BattlingMonster, defenders);
if (result != null && result.Action == BattlePhaseAction.BattleAction.Attack) if (result != null && result.Action == BattlePhaseAction.BattleAction.Attack)
...@@ -285,7 +292,7 @@ namespace WindBot.Game.AI ...@@ -285,7 +292,7 @@ namespace WindBot.Game.AI
if (Card.Location == CardLocation.Grave) if (Card.Location == CardLocation.Grave)
{ {
selected = AI.Utils.GetBestEnemySpell(true); selected = Util.GetBestEnemySpell(true);
} }
else else
{ {
...@@ -304,7 +311,7 @@ namespace WindBot.Game.AI ...@@ -304,7 +311,7 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool DefaultBookOfMoon() protected bool DefaultBookOfMoon()
{ {
if (AI.Utils.IsAllEnemyBetter(true)) if (Util.IsAllEnemyBetter(true))
{ {
ClientCard monster = Enemy.GetMonsters().GetHighestAttackMonster(true); ClientCard monster = Enemy.GetMonsters().GetHighestAttackMonster(true);
if (monster != null && monster.HasType(CardType.Effect) && !monster.HasType(CardType.Link) && (monster.HasType(CardType.Xyz) || monster.Level > 4)) if (monster != null && monster.HasType(CardType.Effect) && !monster.HasType(CardType.Link) && (monster.HasType(CardType.Xyz) || monster.Level > 4))
...@@ -321,15 +328,15 @@ namespace WindBot.Game.AI ...@@ -321,15 +328,15 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool DefaultCompulsoryEvacuationDevice() protected bool DefaultCompulsoryEvacuationDevice()
{ {
ClientCard target = AI.Utils.GetProblematicEnemyMonster(0, true); ClientCard target = Util.GetProblematicEnemyMonster(0, true);
if (target != null) if (target != null)
{ {
AI.SelectCard(target); AI.SelectCard(target);
return true; return true;
} }
if (AI.Utils.IsChainTarget(Card)) if (Util.IsChainTarget(Card))
{ {
ClientCard monster = AI.Utils.GetBestEnemyMonster(false, true); ClientCard monster = Util.GetBestEnemyMonster(false, true);
if (monster != null) if (monster != null)
{ {
AI.SelectCard(monster); AI.SelectCard(monster);
...@@ -344,9 +351,9 @@ namespace WindBot.Game.AI ...@@ -344,9 +351,9 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool DefaultCallOfTheHaunted() protected bool DefaultCallOfTheHaunted()
{ {
if (!AI.Utils.IsAllEnemyBetter(true)) if (!Util.IsAllEnemyBetter(true))
return false; return false;
ClientCard selected = Bot.Graveyard.OrderByDescending(card => card.Attack).FirstOrDefault(); ClientCard selected = Bot.Graveyard.GetMatchingCards(card => card.IsCanRevive()).OrderByDescending(card => card.Attack).FirstOrDefault();
AI.SelectCard(selected); AI.SelectCard(selected);
return true; return true;
} }
...@@ -370,7 +377,7 @@ namespace WindBot.Game.AI ...@@ -370,7 +377,7 @@ namespace WindBot.Game.AI
_CardId.UltimateAncientGearGolem, _CardId.UltimateAncientGearGolem,
_CardId.RedDragonArchfiend _CardId.RedDragonArchfiend
}, true)) return false; }, true)) return false;
if (AI.Utils.GetTotalAttackingMonsterAttack(1) >= Bot.LifePoints) return true; if (Util.GetTotalAttackingMonsterAttack(1) >= Bot.LifePoints) return true;
} }
return false; return false;
} }
...@@ -391,7 +398,7 @@ namespace WindBot.Game.AI ...@@ -391,7 +398,7 @@ namespace WindBot.Game.AI
_CardId.UpstartGoblin, _CardId.UpstartGoblin,
_CardId.CyberEmergency _CardId.CyberEmergency
}; };
if (AI.Utils.GetLastChainCard().IsCode(ignoreList)) if (Util.GetLastChainCard().IsCode(ignoreList))
return false; return false;
return Duel.LastChainPlayer == 1; return Duel.LastChainPlayer == 1;
} }
...@@ -400,7 +407,7 @@ namespace WindBot.Game.AI ...@@ -400,7 +407,7 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool DefaultGhostOgreAndSnowRabbit() protected bool DefaultGhostOgreAndSnowRabbit()
{ {
if (AI.Utils.GetLastChainCard() != null && AI.Utils.GetLastChainCard().IsDisabled()) if (Util.GetLastChainCard() != null && Util.GetLastChainCard().IsDisabled())
return false; return false;
return DefaultTrap(); return DefaultTrap();
} }
...@@ -416,8 +423,8 @@ namespace WindBot.Game.AI ...@@ -416,8 +423,8 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool DefaultEffectVeiler() protected bool DefaultEffectVeiler()
{ {
if (AI.Utils.GetLastChainCard() != null && AI.Utils.GetLastChainCard().IsCode(_CardId.GalaxySoldier) && Enemy.Hand.Count >= 3) return false; if (Util.GetLastChainCard() != null && Util.GetLastChainCard().IsCode(_CardId.GalaxySoldier) && Enemy.Hand.Count >= 3) return false;
if (AI.Utils.ChainContainsCard(_CardId.EffectVeiler)) if (Util.ChainContainsCard(_CardId.EffectVeiler))
return false; return false;
return DefaultBreakthroughSkill(); return DefaultBreakthroughSkill();
} }
...@@ -438,7 +445,7 @@ namespace WindBot.Game.AI ...@@ -438,7 +445,7 @@ namespace WindBot.Game.AI
{ {
foreach (int id in targetList) foreach (int id in targetList)
{ {
if (AI.Utils.GetLastChainCard().IsCode(id)) if (Util.GetLastChainCard().IsCode(id))
{ {
AI.SelectCard(id); AI.SelectCard(id);
return UniqueFaceupSpell(); return UniqueFaceupSpell();
...@@ -451,9 +458,11 @@ namespace WindBot.Game.AI ...@@ -451,9 +458,11 @@ namespace WindBot.Game.AI
/// Default InfiniteImpermanence effect /// Default InfiniteImpermanence effect
/// </summary> /// </summary>
protected bool DefaultInfiniteImpermanence() protected bool DefaultInfiniteImpermanence()
{ {
// TODO: disable s & t // TODO: disable s & t
return DefaultBreakthroughSkill(); if (!DefaultUniqueTrap())
return false;
return DefaultDisableMonster();
} }
/// <summary> /// <summary>
/// Chain the enemy monster, or disable monster like Rescue Rabbit. /// Chain the enemy monster, or disable monster like Rescue Rabbit.
...@@ -462,7 +471,13 @@ namespace WindBot.Game.AI ...@@ -462,7 +471,13 @@ namespace WindBot.Game.AI
{ {
if (!DefaultUniqueTrap()) if (!DefaultUniqueTrap())
return false; return false;
return DefaultDisableMonster();
}
/// <summary>
/// Chain the enemy monster, or disable monster like Rescue Rabbit.
/// </summary>
protected bool DefaultDisableMonster()
{
if (Duel.Player == 1) if (Duel.Player == 1)
{ {
ClientCard target = Enemy.MonsterZone.GetShouldBeDisabledBeforeItUseEffectMonster(); ClientCard target = Enemy.MonsterZone.GetShouldBeDisabledBeforeItUseEffectMonster();
...@@ -473,7 +488,7 @@ namespace WindBot.Game.AI ...@@ -473,7 +488,7 @@ namespace WindBot.Game.AI
} }
} }
ClientCard LastChainCard = AI.Utils.GetLastChainCard(); ClientCard LastChainCard = Util.GetLastChainCard();
if (LastChainCard != null && LastChainCard.Controller == 1 && LastChainCard.Location == CardLocation.MonsterZone && if (LastChainCard != null && LastChainCard.Controller == 1 && LastChainCard.Location == CardLocation.MonsterZone &&
!LastChainCard.IsDisabled() && !LastChainCard.IsShouldNotBeTarget() && !LastChainCard.IsShouldNotBeSpellTrapTarget()) !LastChainCard.IsDisabled() && !LastChainCard.IsShouldNotBeTarget() && !LastChainCard.IsShouldNotBeSpellTrapTarget())
...@@ -506,7 +521,7 @@ namespace WindBot.Game.AI ...@@ -506,7 +521,7 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool DefaultSolemnJudgment() protected bool DefaultSolemnJudgment()
{ {
return !AI.Utils.IsChainTargetOnly(Card) && !(Duel.Player == 0 && Duel.LastChainPlayer == -1) && DefaultTrap(); return !Util.IsChainTargetOnly(Card) && !(Duel.Player == 0 && Duel.LastChainPlayer == -1) && DefaultTrap();
} }
/// <summary> /// <summary>
...@@ -530,7 +545,7 @@ namespace WindBot.Game.AI ...@@ -530,7 +545,7 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool DefaultTorrentialTribute() protected bool DefaultTorrentialTribute()
{ {
return !AI.Utils.HasChainedTrap(0) && AI.Utils.IsAllEnemyBetter(true); return !Util.HasChainedTrap(0) && Util.IsAllEnemyBetter(true);
} }
/// <summary> /// <summary>
...@@ -554,7 +569,7 @@ namespace WindBot.Game.AI ...@@ -554,7 +569,7 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool DefaultHammerShot() protected bool DefaultHammerShot()
{ {
return AI.Utils.IsOneEnemyBetter(true); return Util.IsOneEnemyBetter(true);
} }
/// <summary> /// <summary>
...@@ -562,7 +577,7 @@ namespace WindBot.Game.AI ...@@ -562,7 +577,7 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool DefaultDarkHole() protected bool DefaultDarkHole()
{ {
return AI.Utils.IsOneEnemyBetter(); return Util.IsOneEnemyBetter();
} }
/// <summary> /// <summary>
...@@ -570,7 +585,7 @@ namespace WindBot.Game.AI ...@@ -570,7 +585,7 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool DefaultRaigeki() protected bool DefaultRaigeki()
{ {
return AI.Utils.IsOneEnemyBetter(); return Util.IsOneEnemyBetter();
} }
/// <summary> /// <summary>
...@@ -578,7 +593,7 @@ namespace WindBot.Game.AI ...@@ -578,7 +593,7 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool DefaultSmashingGround() protected bool DefaultSmashingGround()
{ {
return AI.Utils.IsOneEnemyBetter(); return Util.IsOneEnemyBetter();
} }
/// <summary> /// <summary>
...@@ -639,7 +654,7 @@ namespace WindBot.Game.AI ...@@ -639,7 +654,7 @@ namespace WindBot.Game.AI
(4000 - Card.Defense) * 2 > (4000 - Card.Attack)) (4000 - Card.Defense) * 2 > (4000 - Card.Attack))
return true; return true;
bool enemyBetter = AI.Utils.IsAllEnemyBetter(true); bool enemyBetter = Util.IsAllEnemyBetter(true);
if (Card.IsAttack() && enemyBetter) if (Card.IsAttack() && enemyBetter)
return true; return true;
if (Card.IsDefense() && !enemyBetter && Card.Attack >= Card.Defense) if (Card.IsDefense() && !enemyBetter && Card.Attack >= Card.Defense)
...@@ -677,7 +692,7 @@ namespace WindBot.Game.AI ...@@ -677,7 +692,7 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool DefaultOnBecomeTarget() protected bool DefaultOnBecomeTarget()
{ {
if (AI.Utils.IsChainTarget(Card)) return true; if (Util.IsChainTarget(Card)) return true;
int[] destroyAllList = int[] destroyAllList =
{ {
_CardId.EvilswarmExcitonKnight, _CardId.EvilswarmExcitonKnight,
...@@ -691,7 +706,7 @@ namespace WindBot.Game.AI ...@@ -691,7 +706,7 @@ namespace WindBot.Game.AI
_CardId.DarkMagicAttack _CardId.DarkMagicAttack
}; };
if (AI.Utils.ChainContainsCard(destroyAllList)) return true; if (Util.ChainContainsCard(destroyAllList)) return true;
if (Enemy.HasInSpellZone(destroyAllOpponentList, true)) return true; if (Enemy.HasInSpellZone(destroyAllOpponentList, true)) return true;
// TODO: ChainContainsCard(id, player) // TODO: ChainContainsCard(id, player)
return false; return false;
...@@ -709,7 +724,7 @@ namespace WindBot.Game.AI ...@@ -709,7 +724,7 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool DefaultUniqueTrap() protected bool DefaultUniqueTrap()
{ {
if (AI.Utils.HasChainedTrap(0)) if (Util.HasChainedTrap(0))
return false; return false;
return UniqueFaceupSpell(); return UniqueFaceupSpell();
...@@ -750,9 +765,9 @@ namespace WindBot.Game.AI ...@@ -750,9 +765,9 @@ namespace WindBot.Game.AI
return false; return false;
if (Bot.LifePoints <= 1000) if (Bot.LifePoints <= 1000)
return false; return false;
if (Bot.LifePoints <= Enemy.LifePoints && ActivateDescription == AI.Utils.GetStringId(_CardId.ChickenGame, 0)) if (Bot.LifePoints <= Enemy.LifePoints && ActivateDescription == Util.GetStringId(_CardId.ChickenGame, 0))
return true; return true;
if (Bot.LifePoints > Enemy.LifePoints && ActivateDescription == AI.Utils.GetStringId(_CardId.ChickenGame, 1)) if (Bot.LifePoints > Enemy.LifePoints && ActivateDescription == Util.GetStringId(_CardId.ChickenGame, 1))
return true; return true;
return false; return false;
} }
...@@ -819,7 +834,7 @@ namespace WindBot.Game.AI ...@@ -819,7 +834,7 @@ namespace WindBot.Game.AI
return true; return true;
} }
} }
ClientCard lastchaincard = AI.Utils.GetLastChainCard(); ClientCard lastchaincard = Util.GetLastChainCard();
if (Duel.LastChainPlayer == 1 && lastchaincard != null && !lastchaincard.IsDisabled()) if (Duel.LastChainPlayer == 1 && lastchaincard != null && !lastchaincard.IsDisabled())
{ {
if (lastchaincard.HasType(CardType.Ritual)) if (lastchaincard.HasType(CardType.Ritual))
...@@ -848,7 +863,7 @@ namespace WindBot.Game.AI ...@@ -848,7 +863,7 @@ namespace WindBot.Game.AI
return true; return true;
} }
} }
if (AI.Utils.IsChainTarget(Card)) if (Util.IsChainTarget(Card))
{ {
AI.SelectOption(XYZ); AI.SelectOption(XYZ);
return true; return true;
...@@ -933,7 +948,7 @@ namespace WindBot.Game.AI ...@@ -933,7 +948,7 @@ namespace WindBot.Game.AI
AI.SelectCard(card); AI.SelectCard(card);
return true; return true;
} }
card = AI.Utils.GetOneEnemyBetterThanValue(Card.GetDefensePower()); card = Util.GetOneEnemyBetterThanValue(Card.GetDefensePower());
if (card != null) if (card != null)
{ {
AI.SelectCard(card); AI.SelectCard(card);
...@@ -947,8 +962,8 @@ namespace WindBot.Game.AI ...@@ -947,8 +962,8 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool DefaultNumberS39UtopiaTheLightningSummon() protected bool DefaultNumberS39UtopiaTheLightningSummon()
{ {
int bestBotAttack = AI.Utils.GetBestAttack(Bot); int bestBotAttack = Util.GetBestAttack(Bot);
return AI.Utils.IsOneEnemyBetterThanValue(bestBotAttack, false); return Util.IsOneEnemyBetterThanValue(bestBotAttack, false);
} }
/// <summary> /// <summary>
...@@ -991,9 +1006,9 @@ namespace WindBot.Game.AI ...@@ -991,9 +1006,9 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool DefaultStardustDragonSummon() protected bool DefaultStardustDragonSummon()
{ {
int selfBestAttack = AI.Utils.GetBestAttack(Bot); int selfBestAttack = Util.GetBestAttack(Bot);
int oppoBestAttack = AI.Utils.GetBestPower(Enemy); int oppoBestAttack = Util.GetBestPower(Enemy);
return (selfBestAttack <= oppoBestAttack && oppoBestAttack <= 2500) || AI.Utils.IsTurn1OrMain2(); return (selfBestAttack <= oppoBestAttack && oppoBestAttack <= 2500) || Util.IsTurn1OrMain2();
} }
/// <summary> /// <summary>
...@@ -1009,7 +1024,7 @@ namespace WindBot.Game.AI ...@@ -1009,7 +1024,7 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool DefaultCastelTheSkyblasterMusketeerSummon() protected bool DefaultCastelTheSkyblasterMusketeerSummon()
{ {
return AI.Utils.GetProblematicEnemyCard() != null; return Util.GetProblematicEnemyCard() != null;
} }
/// <summary> /// <summary>
...@@ -1017,9 +1032,9 @@ namespace WindBot.Game.AI ...@@ -1017,9 +1032,9 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool DefaultCastelTheSkyblasterMusketeerEffect() protected bool DefaultCastelTheSkyblasterMusketeerEffect()
{ {
if (ActivateDescription == AI.Utils.GetStringId(_CardId.CastelTheSkyblasterMusketeer, 0)) if (ActivateDescription == Util.GetStringId(_CardId.CastelTheSkyblasterMusketeer, 0))
return false; return false;
ClientCard target = AI.Utils.GetProblematicEnemyCard(); ClientCard target = Util.GetProblematicEnemyCard();
if (target != null) if (target != null)
{ {
AI.SelectCard(0); AI.SelectCard(0);
...@@ -1034,8 +1049,8 @@ namespace WindBot.Game.AI ...@@ -1034,8 +1049,8 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool DefaultScarlightRedDragonArchfiendSummon() protected bool DefaultScarlightRedDragonArchfiendSummon()
{ {
int selfBestAttack = AI.Utils.GetBestAttack(Bot); int selfBestAttack = Util.GetBestAttack(Bot);
int oppoBestAttack = AI.Utils.GetBestPower(Enemy); int oppoBestAttack = Util.GetBestPower(Enemy);
return (selfBestAttack <= oppoBestAttack && oppoBestAttack <= 3000) || DefaultScarlightRedDragonArchfiendEffect(); return (selfBestAttack <= oppoBestAttack && oppoBestAttack <= 3000) || DefaultScarlightRedDragonArchfiendEffect();
} }
...@@ -1061,7 +1076,7 @@ namespace WindBot.Game.AI ...@@ -1061,7 +1076,7 @@ namespace WindBot.Game.AI
|| ((Bot.BattlingMonster.Attack < Enemy.BattlingMonster.Defense) && (Bot.BattlingMonster.Attack + Enemy.BattlingMonster.Attack > Enemy.BattlingMonster.Defense))); || ((Bot.BattlingMonster.Attack < Enemy.BattlingMonster.Defense) && (Bot.BattlingMonster.Attack + Enemy.BattlingMonster.Attack > Enemy.BattlingMonster.Defense)));
} }
if (AI.Utils.IsTurn1OrMain2() && HonestEffectCount <= 5) if (Util.IsTurn1OrMain2() && HonestEffectCount <= 5)
{ {
HonestEffectCount++; HonestEffectCount++;
return true; return true;
......
...@@ -22,5 +22,6 @@ ...@@ -22,5 +22,6 @@
EaterOfMillions = 63845230, EaterOfMillions = 63845230,
ElShaddollConstruct = 20366274, ElShaddollConstruct = 20366274,
ZushintheSleepingGiant = 67547370, ZushintheSleepingGiant = 67547370,
Heart_eartHDragon = 97403510,
} }
} }
...@@ -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;
......
...@@ -34,6 +34,7 @@ namespace WindBot.Game ...@@ -34,6 +34,7 @@ namespace WindBot.Game
public int Owner { get; private set; } public int Owner { get; private set; }
public int Controller { get; private set; } public int Controller { get; private set; }
public int Disabled { get; private set; } public int Disabled { get; private set; }
public int ProcCompleted { get; private set; }
public int SelectSeq { get; set; } public int SelectSeq { get; set; }
public int OpParam1 { get; set; } public int OpParam1 { get; set; }
public int OpParam2 { get; set; } public int OpParam2 { get; set; }
...@@ -145,7 +146,10 @@ namespace WindBot.Game ...@@ -145,7 +146,10 @@ namespace WindBot.Game
Owner = duel.GetLocalPlayer(packet.ReadInt32()); Owner = duel.GetLocalPlayer(packet.ReadInt32());
if ((flag & (int)Query.Status) != 0) { if ((flag & (int)Query.Status) != 0) {
int status = packet.ReadInt32(); int status = packet.ReadInt32();
Disabled = status & 0x0001; const int STATUS_DISABLED = 0x0001;
const int STATUS_PROC_COMPLETE = 0x0008;
Disabled = status & STATUS_DISABLED;
ProcCompleted = status & STATUS_PROC_COMPLETE;
} }
if ((flag & (int)Query.LScale) != 0) if ((flag & (int)Query.LScale) != 0)
LScale = packet.ReadInt32(); LScale = packet.ReadInt32();
...@@ -312,6 +316,11 @@ namespace WindBot.Game ...@@ -312,6 +316,11 @@ namespace WindBot.Game
return Disabled != 0; return Disabled != 0;
} }
public bool IsCanRevive()
{
return ProcCompleted != 0 || !(IsExtraCard() || HasType(CardType.Ritual) || HasType(CardType.SpSummon));
}
public bool IsCode(int id) public bool IsCode(int id)
{ {
return Id == id || Alias != 0 && Alias == id; return Id == id || Alias != 0 && Alias == id;
......
...@@ -158,6 +158,11 @@ namespace WindBot.Game ...@@ -158,6 +158,11 @@ namespace WindBot.Game
return GetMonsters().Where((card, i) => i < 5).ToList(); return GetMonsters().Where((card, i) => i < 5).ToList();
} }
public ClientCard GetFieldSpellCard()
{
return SpellZone[5];
}
public bool HasInHand(int cardId) public bool HasInHand(int cardId)
{ {
return HasInCards(Hand, cardId); return HasInCards(Hand, cardId);
......
...@@ -10,7 +10,6 @@ namespace WindBot.Game ...@@ -10,7 +10,6 @@ namespace WindBot.Game
public GameClient Game { get; private set; } public GameClient Game { get; private set; }
public Duel Duel { get; private set; } public Duel Duel { get; private set; }
public Executor Executor { get; set; } public Executor Executor { get; set; }
public AIFunctions Utils { get; private set; }
private Dialogs _dialogs; private Dialogs _dialogs;
...@@ -18,7 +17,6 @@ namespace WindBot.Game ...@@ -18,7 +17,6 @@ namespace WindBot.Game
{ {
Game = game; Game = game;
Duel = duel; Duel = duel;
Utils = new AIFunctions(duel);
_dialogs = new Dialogs(game); _dialogs = new Dialogs(game);
} }
...@@ -165,11 +163,11 @@ namespace WindBot.Game ...@@ -165,11 +163,11 @@ namespace WindBot.Game
// Sort the attackers and defenders, make monster with higher attack go first. // Sort the attackers and defenders, make monster with higher attack go first.
List<ClientCard> attackers = new List<ClientCard>(battle.AttackableCards); List<ClientCard> attackers = new List<ClientCard>(battle.AttackableCards);
attackers.Sort(AIFunctions.CompareCardAttack); attackers.Sort(CardContainer.CompareCardAttack);
attackers.Reverse(); attackers.Reverse();
List<ClientCard> defenders = new List<ClientCard>(Duel.Fields[1].GetMonsters()); List<ClientCard> defenders = new List<ClientCard>(Duel.Fields[1].GetMonsters());
defenders.Sort(AIFunctions.CompareDefensePower); defenders.Sort(CardContainer.CompareDefensePower);
defenders.Reverse(); defenders.Reverse();
// Let executor decide which card should attack first. // Let executor decide which card should attack first.
...@@ -440,7 +438,7 @@ namespace WindBot.Game ...@@ -440,7 +438,7 @@ namespace WindBot.Game
} }
if (ShouldExecute(exec, card, ExecutorType.SummonOrSet)) if (ShouldExecute(exec, card, ExecutorType.SummonOrSet))
{ {
if (Utils.IsAllEnemyBetter(true) && Utils.IsAllEnemyBetterThanValue(card.Attack + 300, false) && if (Executor.Util.IsAllEnemyBetter(true) && Executor.Util.IsAllEnemyBetterThanValue(card.Attack + 300, false) &&
main.MonsterSetableCards.Contains(card)) main.MonsterSetableCards.Contains(card))
{ {
_dialogs.SendSetMonster(); _dialogs.SendSetMonster();
...@@ -481,7 +479,7 @@ namespace WindBot.Game ...@@ -481,7 +479,7 @@ namespace WindBot.Game
return 0; // Always select the first option. return 0; // Always select the first option.
} }
public int OnSelectPlace(int cardId, int player, int location, int available) public int OnSelectPlace(int cardId, int player, CardLocation location, int available)
{ {
int selector_selected = m_place; int selector_selected = m_place;
m_place = 0; m_place = 0;
...@@ -702,7 +700,7 @@ namespace WindBot.Game ...@@ -702,7 +700,7 @@ namespace WindBot.Game
// Always choose the minimum and lowest atk. // Always choose the minimum and lowest atk.
List<ClientCard> sorted = new List<ClientCard>(); List<ClientCard> sorted = new List<ClientCard>();
sorted.AddRange(cards); sorted.AddRange(cards);
sorted.Sort(AIFunctions.CompareCardAttack); sorted.Sort(CardContainer.CompareCardAttack);
IList<ClientCard> selected = new List<ClientCard>(); IList<ClientCard> selected = new List<ClientCard>();
......
...@@ -506,6 +506,7 @@ namespace WindBot.Game ...@@ -506,6 +506,7 @@ namespace WindBot.Game
_duel.Fields[1].BattlingMonster = null; _duel.Fields[1].BattlingMonster = null;
_duel.Fields[0].UnderAttack = false; _duel.Fields[0].UnderAttack = false;
_duel.Fields[1].UnderAttack = false; _duel.Fields[1].UnderAttack = false;
_select_hint = 0;
_ai.OnNewPhase(); _ai.OnNewPhase();
} }
...@@ -982,7 +983,6 @@ namespace WindBot.Game ...@@ -982,7 +983,6 @@ namespace WindBot.Game
} }
IList<ClientCard> selected = func(cards, (finishable ? 0 : 1), 1, _select_hint, cancelable); IList<ClientCard> selected = func(cards, (finishable ? 0 : 1), 1, _select_hint, cancelable);
_select_hint = 0;
if (selected.Count == 0 && cancelable) if (selected.Count == 0 && cancelable)
{ {
...@@ -1210,48 +1210,44 @@ namespace WindBot.Game ...@@ -1210,48 +1210,44 @@ namespace WindBot.Game
packet.ReadByte(); // min packet.ReadByte(); // min
int field = ~packet.ReadInt32(); int field = ~packet.ReadInt32();
const int LOCATION_MZONE = 0x4;
const int LOCATION_SZONE = 0x8;
const int LOCATION_PZONE = 0x200;
int player; int player;
int location; CardLocation location;
int filter; int filter;
if ((field & 0x7f) != 0) if ((field & 0x7f) != 0)
{ {
player = 0; player = 0;
location = LOCATION_MZONE; location = CardLocation.MonsterZone;
filter = field & Zones.MonsterZones; filter = field & Zones.MonsterZones;
} }
else if ((field & 0x1f00) != 0) else if ((field & 0x1f00) != 0)
{ {
player = 0; player = 0;
location = LOCATION_SZONE; location = CardLocation.SpellZone;
filter = (field >> 8) & Zones.SpellZones; filter = (field >> 8) & Zones.SpellZones;
} }
else if ((field & 0xc000) != 0) else if ((field & 0xc000) != 0)
{ {
player = 0; player = 0;
location = LOCATION_PZONE; location = CardLocation.PendulumZone;
filter = (field >> 14) & Zones.PendulumZones; filter = (field >> 14) & Zones.PendulumZones;
} }
else if ((field & 0x7f0000) != 0) else if ((field & 0x7f0000) != 0)
{ {
player = 1; player = 1;
location = LOCATION_MZONE; location = CardLocation.MonsterZone;
filter = (field >> 16) & Zones.MonsterZones; filter = (field >> 16) & Zones.MonsterZones;
} }
else if ((field & 0x1f000000) != 0) else if ((field & 0x1f000000) != 0)
{ {
player = 1; player = 1;
location = LOCATION_SZONE; location = CardLocation.SpellZone;
filter = (field >> 24) & Zones.SpellZones; filter = (field >> 24) & Zones.SpellZones;
} }
else else
{ {
player = 1; player = 1;
location = LOCATION_PZONE; location = CardLocation.PendulumZone;
filter = (field >> 30) & Zones.PendulumZones; filter = (field >> 30) & Zones.PendulumZones;
} }
...@@ -1261,7 +1257,7 @@ namespace WindBot.Game ...@@ -1261,7 +1257,7 @@ namespace WindBot.Game
byte[] resp = new byte[3]; byte[] resp = new byte[3];
resp[0] = (byte)GetLocalPlayer(player); resp[0] = (byte)GetLocalPlayer(player);
if (location != LOCATION_PZONE) if (location != CardLocation.PendulumZone)
{ {
resp[1] = (byte)location; resp[1] = (byte)location;
if ((selected & filter) > 0) if ((selected & filter) > 0)
...@@ -1277,7 +1273,7 @@ namespace WindBot.Game ...@@ -1277,7 +1273,7 @@ namespace WindBot.Game
} }
else else
{ {
resp[1] = (byte)LOCATION_SZONE; resp[1] = (byte)CardLocation.SpellZone;
if ((selected & filter) > 0) if ((selected & filter) > 0)
filter &= selected; filter &= selected;
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Config.cs" /> <Compile Include="Config.cs" />
<Compile Include="Game\AI\AIFunctions.cs" /> <Compile Include="Game\AI\AIUtil.cs" />
<Compile Include="Game\AI\CardContainer.cs" /> <Compile Include="Game\AI\CardContainer.cs" />
<Compile Include="Game\AI\CardExecutor.cs" /> <Compile Include="Game\AI\CardExecutor.cs" />
<Compile Include="Game\AI\CardExtension.cs" /> <Compile Include="Game\AI\CardExtension.cs" />
...@@ -70,6 +70,7 @@ ...@@ -70,6 +70,7 @@
<Compile Include="Game\AI\Decks\BlackwingExecutor.cs" /> <Compile Include="Game\AI\Decks\BlackwingExecutor.cs" />
<Compile Include="Game\AI\Decks\CyberDragonExecutor.cs" /> <Compile Include="Game\AI\Decks\CyberDragonExecutor.cs" />
<Compile Include="Game\AI\Decks\DarkMagicianExecutor.cs" /> <Compile Include="Game\AI\Decks\DarkMagicianExecutor.cs" />
<Compile Include="Game\AI\Decks\OrcustExecutor.cs" />
<Compile Include="Game\AI\Decks\SkyStrikerExecutor.cs" /> <Compile Include="Game\AI\Decks\SkyStrikerExecutor.cs" />
<Compile Include="Game\AI\Decks\MokeyMokeyKingExecutor.cs" /> <Compile Include="Game\AI\Decks\MokeyMokeyKingExecutor.cs" />
<Compile Include="Game\AI\Decks\MokeyMokeyExecutor.cs" /> <Compile Include="Game\AI\Decks\MokeyMokeyExecutor.cs" />
......
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