Commit f0e083d5 authored by mercury233's avatar mercury233

shortcut for Duel.Fields

parent ddbdbd85
...@@ -6,10 +6,14 @@ namespace WindBot.Game.AI ...@@ -6,10 +6,14 @@ namespace WindBot.Game.AI
public class AIFunctions public class AIFunctions
{ {
public Duel Duel { get; private set; } public Duel Duel { get; private set; }
public ClientField Bot { get; private set; }
public ClientField Enemy { get; private set; }
public AIFunctions(Duel duel) public AIFunctions(Duel duel)
{ {
Duel = duel; Duel = duel;
Bot = Duel.Fields[0];
Enemy = Duel.Fields[1];
} }
public static int CompareCardAttack(ClientCard cardA, ClientCard cardB) public static int CompareCardAttack(ClientCard cardA, ClientCard cardB)
...@@ -55,9 +59,9 @@ namespace WindBot.Game.AI ...@@ -55,9 +59,9 @@ namespace WindBot.Game.AI
public bool IsEnemyBetter(bool onlyatk, bool all) public bool IsEnemyBetter(bool onlyatk, bool all)
{ {
if (Duel.Fields[1].GetMonsterCount() == 0) if (Enemy.GetMonsterCount() == 0)
return false; return false;
List<ClientCard> monsters = Duel.Fields[0].GetMonsters(); List<ClientCard> monsters = Bot.GetMonsters();
monsters.Sort(CompareCardAttack); monsters.Sort(CompareCardAttack);
int bestAtk = -1; int bestAtk = -1;
if (monsters.Count > 0) if (monsters.Count > 0)
...@@ -73,7 +77,7 @@ namespace WindBot.Game.AI ...@@ -73,7 +77,7 @@ namespace WindBot.Game.AI
bool nomonster = true; bool nomonster = true;
for (int i = 0; i < 7; ++i) for (int i = 0; i < 7; ++i)
{ {
ClientCard card = Duel.Fields[1].MonsterZone[i]; ClientCard card = Enemy.MonsterZone[i];
if (card == null) continue; if (card == null) continue;
if (onlyatk && card.IsDefense()) continue; if (onlyatk && card.IsDefense()) continue;
nomonster = false; nomonster = false;
...@@ -90,7 +94,7 @@ namespace WindBot.Game.AI ...@@ -90,7 +94,7 @@ namespace WindBot.Game.AI
bool nomonster = true; bool nomonster = true;
for (int i = 0; i < 7; ++i) for (int i = 0; i < 7; ++i)
{ {
ClientCard card = Duel.Fields[1].MonsterZone[i]; ClientCard card = Enemy.MonsterZone[i];
if (card == null || card.Data == null) continue; if (card == null || card.Data == null) continue;
if (onlyatk && card.IsDefense()) continue; if (onlyatk && card.IsDefense()) continue;
nomonster = false; nomonster = false;
...@@ -105,7 +109,7 @@ namespace WindBot.Game.AI ...@@ -105,7 +109,7 @@ namespace WindBot.Game.AI
{ {
for (int i = 0; i < 7; ++i) for (int i = 0; i < 7; ++i)
{ {
ClientCard card = Duel.Fields[1].MonsterZone[i]; ClientCard card = Enemy.MonsterZone[i];
if (card == null) continue; if (card == null) continue;
if (onlyatk && card.IsDefense()) continue; if (onlyatk && card.IsDefense()) continue;
int enemyValue = card.GetDefensePower(); int enemyValue = card.GetDefensePower();
...@@ -117,39 +121,39 @@ namespace WindBot.Game.AI ...@@ -117,39 +121,39 @@ namespace WindBot.Game.AI
public ClientCard GetProblematicCard(int attack = 0) public ClientCard GetProblematicCard(int attack = 0)
{ {
ClientCard card = Duel.Fields[1].MonsterZone.GetInvincibleMonster(); ClientCard card = Enemy.MonsterZone.GetInvincibleMonster();
if (card != null) if (card != null)
return card; return card;
card = Duel.Fields[1].MonsterZone.GetFloodgate(); card = Enemy.MonsterZone.GetFloodgate();
if (card != null) if (card != null)
return card; return card;
card = Duel.Fields[1].SpellZone.GetFloodgate(); card = Enemy.SpellZone.GetFloodgate();
if (card != null) if (card != null)
return card; return card;
if (attack == 0) if (attack == 0)
attack = GetBestAttack(Duel.Fields[0], true); attack = GetBestAttack(Bot, true);
return GetOneEnemyBetterThanValue(attack, true); return GetOneEnemyBetterThanValue(attack, true);
} }
public ClientCard GetProblematicMonsterCard(int attack = 0) public ClientCard GetProblematicMonsterCard(int attack = 0)
{ {
ClientCard card = Duel.Fields[1].MonsterZone.GetInvincibleMonster(); ClientCard card = Enemy.MonsterZone.GetInvincibleMonster();
if (card != null) if (card != null)
return card; return card;
card = Duel.Fields[1].MonsterZone.GetFloodgate(); card = Enemy.MonsterZone.GetFloodgate();
if (card != null) if (card != null)
return card; return card;
if (attack == 0) if (attack == 0)
attack = GetBestAttack(Duel.Fields[0], true); attack = GetBestAttack(Bot, true);
return GetOneEnemyBetterThanValue(attack, true); return GetOneEnemyBetterThanValue(attack, true);
} }
public ClientCard GetProblematicSpellCard() public ClientCard GetProblematicSpellCard()
{ {
ClientCard card = Duel.Fields[1].SpellZone.GetNegateAttackSpell(); ClientCard card = Enemy.SpellZone.GetNegateAttackSpell();
if (card != null) if (card != null)
return card; return card;
card = Duel.Fields[1].SpellZone.GetFloodgate(); card = Enemy.SpellZone.GetFloodgate();
return card; return card;
} }
......
...@@ -90,14 +90,14 @@ namespace WindBot.Game.AI.Decks ...@@ -90,14 +90,14 @@ namespace WindBot.Game.AI.Decks
private bool 苍炎之修罗() private bool 苍炎之修罗()
{ {
if (Duel.Fields[0].HasInMonstersZone((int)CardId.晓之希洛克) && Duel.Fields[0].GetMonsters().GetHighestAttackMonster().Attack < 3800) if (Bot.HasInMonstersZone((int)CardId.晓之希洛克) && Bot.GetMonsters().GetHighestAttackMonster().Attack < 3800)
return true; return true;
return false; return false;
} }
private bool 黑旋风() private bool 黑旋风()
{ {
if (Card.Location == CardLocation.Hand && Duel.Fields[0].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 == AI.Utils.GetStringId((int)Card.Id,0))
AI.SelectCard((int)CardId.疾风之盖尔); AI.SelectCard((int)CardId.疾风之盖尔);
...@@ -106,8 +106,8 @@ namespace WindBot.Game.AI.Decks ...@@ -106,8 +106,8 @@ namespace WindBot.Game.AI.Decks
private bool 晓之希洛克() private bool 晓之希洛克()
{ {
int OpponentMonster = Duel.Fields[1].GetMonsterCount(); int OpponentMonster = Enemy.GetMonsterCount();
int AIMonster = Duel.Fields[0].GetMonsterCount(); int AIMonster = Bot.GetMonsterCount();
if (OpponentMonster != 0 && AIMonster == 0) if (OpponentMonster != 0 && AIMonster == 0)
return true; return true;
return false; return false;
...@@ -115,7 +115,7 @@ namespace WindBot.Game.AI.Decks ...@@ -115,7 +115,7 @@ namespace WindBot.Game.AI.Decks
private bool 黑枪之布拉斯特() private bool 黑枪之布拉斯特()
{ {
List<ClientCard> monster = Duel.Fields[0].GetMonsters(); List<ClientCard> monster = Bot.GetMonsters();
foreach (ClientCard card in monster) foreach (ClientCard card in monster)
if (card != null && card.Id == (int)CardId.残夜之波刃剑鸟 || card.Id == (int)CardId.月影之卡鲁特 || card.Id == (int)CardId.疾风之盖尔 || card.Id == (int)CardId.黑枪之布拉斯特 || card.Id == (int)CardId.晓之希洛克 || card.Id == (int)CardId.苍炎之修罗 || card.Id == (int)CardId.极北之布利扎德) if (card != null && card.Id == (int)CardId.残夜之波刃剑鸟 || card.Id == (int)CardId.月影之卡鲁特 || card.Id == (int)CardId.疾风之盖尔 || card.Id == (int)CardId.黑枪之布拉斯特 || card.Id == (int)CardId.晓之希洛克 || card.Id == (int)CardId.苍炎之修罗 || card.Id == (int)CardId.极北之布利扎德)
return true; return true;
...@@ -124,7 +124,7 @@ namespace WindBot.Game.AI.Decks ...@@ -124,7 +124,7 @@ namespace WindBot.Game.AI.Decks
private bool 月影之卡鲁特() private bool 月影之卡鲁特()
{ {
foreach (ClientCard card in Duel.Fields[0].Hand) foreach (ClientCard card in Bot.Hand)
if (card != null && card.Id == (int)CardId.残夜之波刃剑鸟 || card.Id == (int)CardId.疾风之盖尔 || card.Id == (int)CardId.黑枪之布拉斯特 || card.Id == (int)CardId.晓之希洛克 || card.Id == (int)CardId.苍炎之修罗 || card.Id == (int)CardId.极北之布利扎德) if (card != null && card.Id == (int)CardId.残夜之波刃剑鸟 || card.Id == (int)CardId.疾风之盖尔 || card.Id == (int)CardId.黑枪之布拉斯特 || card.Id == (int)CardId.晓之希洛克 || card.Id == (int)CardId.苍炎之修罗 || card.Id == (int)CardId.极北之布利扎德)
return false; return false;
return true; return true;
...@@ -132,7 +132,7 @@ namespace WindBot.Game.AI.Decks ...@@ -132,7 +132,7 @@ namespace WindBot.Game.AI.Decks
private bool 极北之布利扎德() private bool 极北之布利扎德()
{ {
foreach (ClientCard card in Duel.Fields[0].Graveyard) foreach (ClientCard card in Bot.Graveyard)
if (card != null && card.Id == (int)CardId.月影之卡鲁特 || card.Id == (int)CardId.黑枪之布拉斯特 || card.Id == (int)CardId.苍炎之修罗 || card.Id == (int)CardId.残夜之波刃剑鸟) if (card != null && card.Id == (int)CardId.月影之卡鲁特 || card.Id == (int)CardId.黑枪之布拉斯特 || card.Id == (int)CardId.苍炎之修罗 || card.Id == (int)CardId.残夜之波刃剑鸟)
return true; return true;
return false; return false;
...@@ -142,7 +142,7 @@ namespace WindBot.Game.AI.Decks ...@@ -142,7 +142,7 @@ namespace WindBot.Game.AI.Decks
{ {
int Count = 0; int Count = 0;
List<ClientCard> monster = Duel.Fields[0].GetMonsters(); List<ClientCard> monster = Bot.GetMonsters();
foreach (ClientCard card in monster) foreach (ClientCard card in monster)
if (card != null && card.Id == (int)CardId.残夜之波刃剑鸟 || card.Id == (int)CardId.月影之卡鲁特 || card.Id == (int)CardId.疾风之盖尔 || card.Id == (int)CardId.黑枪之布拉斯特 || card.Id == (int)CardId.晓之希洛克 || card.Id == (int)CardId.苍炎之修罗 || card.Id == (int)CardId.极北之布利扎德) if (card != null && card.Id == (int)CardId.残夜之波刃剑鸟 || card.Id == (int)CardId.月影之卡鲁特 || card.Id == (int)CardId.疾风之盖尔 || card.Id == (int)CardId.黑枪之布拉斯特 || card.Id == (int)CardId.晓之希洛克 || card.Id == (int)CardId.苍炎之修罗 || card.Id == (int)CardId.极北之布利扎德)
Count++; Count++;
...@@ -156,7 +156,7 @@ namespace WindBot.Game.AI.Decks ...@@ -156,7 +156,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Card.Position == (int)CardPosition.FaceUp) if (Card.Position == (int)CardPosition.FaceUp)
{ {
AI.SelectCard(Duel.Fields[1].GetMonsters().GetHighestAttackMonster()); AI.SelectCard(Enemy.GetMonsters().GetHighestAttackMonster());
return true; return true;
} }
return false; return false;
...@@ -164,11 +164,11 @@ namespace WindBot.Game.AI.Decks ...@@ -164,11 +164,11 @@ namespace WindBot.Game.AI.Decks
private bool 攻击力上升效果() private bool 攻击力上升效果()
{ {
if (Duel.Fields[1].GetMonsters().GetHighestAttackMonster().IsFacedown() || Duel.Fields[1].GetMonsters().GetHighestDefenseMonster().IsFacedown() || Duel.Fields[1].GetMonsterCount() == 0) if (Enemy.GetMonsters().GetHighestAttackMonster().IsFacedown() || Enemy.GetMonsters().GetHighestDefenseMonster().IsFacedown() || Enemy.GetMonsterCount() == 0)
return false; return false;
if (Duel.Fields[0].GetMonsters().GetHighestAttackMonster().Attack < Duel.Fields[1].GetMonsters().GetHighestAttackMonster().Attack) if (Bot.GetMonsters().GetHighestAttackMonster().Attack < Enemy.GetMonsters().GetHighestAttackMonster().Attack)
return true; return true;
if (Duel.Fields[0].GetMonsters().GetHighestAttackMonster().Attack < Duel.Fields[1].GetMonsters().GetHighestDefenseMonster().Defense) if (Bot.GetMonsters().GetHighestAttackMonster().Attack < Enemy.GetMonsters().GetHighestDefenseMonster().Defense)
return true; return true;
return false; return false;
} }
......
This diff is collapsed.
...@@ -81,7 +81,7 @@ namespace DevBot.Game.AI.Decks ...@@ -81,7 +81,7 @@ namespace DevBot.Game.AI.Decks
private bool SwordsOfRevealingLight() private bool SwordsOfRevealingLight()
{ {
int count = Duel.Fields[0].SpellZone.GetCardCount((int)CardId.SwordsOfRevealingLight); int count = Bot.SpellZone.GetCardCount((int)CardId.SwordsOfRevealingLight);
return count == 0; return count == 0;
} }
...@@ -98,12 +98,12 @@ namespace DevBot.Game.AI.Decks ...@@ -98,12 +98,12 @@ namespace DevBot.Game.AI.Decks
private bool ThunderShort() private bool ThunderShort()
{ {
return Duel.Fields[1].GetMonsterCount() >= 3; return Enemy.GetMonsterCount() >= 3;
} }
private bool SetInvincibleMonster() private bool SetInvincibleMonster()
{ {
foreach (ClientCard card in Duel.Fields[0].GetMonsters()) foreach (ClientCard card in Bot.GetMonsters())
{ {
if (card.Id == (int)CardId.Marshmallon || card.Id == (int)CardId.SpiritReaper) if (card.Id == (int)CardId.Marshmallon || card.Id == (int)CardId.SpiritReaper)
{ {
...@@ -116,7 +116,7 @@ namespace DevBot.Game.AI.Decks ...@@ -116,7 +116,7 @@ namespace DevBot.Game.AI.Decks
private bool LavaGolem() private bool LavaGolem()
{ {
bool found = false; bool found = false;
foreach (ClientCard card in Duel.Fields[1].GetMonsters()) foreach (ClientCard card in Enemy.GetMonsters())
{ {
if (card.Attack > 2000) if (card.Attack > 2000)
found = true; found = true;
...@@ -126,7 +126,7 @@ namespace DevBot.Game.AI.Decks ...@@ -126,7 +126,7 @@ namespace DevBot.Game.AI.Decks
private bool Ceasefire() private bool Ceasefire()
{ {
return Duel.Fields[0].GetMonsterCount() + Duel.Fields[1].GetMonsterCount() >= 3; return Bot.GetMonsterCount() + Enemy.GetMonsterCount() >= 3;
} }
private bool ReposEverything() private bool ReposEverything()
......
...@@ -9,7 +9,6 @@ namespace WindBot.Game.AI.Decks ...@@ -9,7 +9,6 @@ namespace WindBot.Game.AI.Decks
[Deck("CyberDragon", "AI_CyberDragon")] [Deck("CyberDragon", "AI_CyberDragon")]
public class CyberDragonExecutor : DefaultExecutor public class CyberDragonExecutor : DefaultExecutor
{ {
ClientField Bot;
bool 力量结合效果 = false; bool 力量结合效果 = false;
public enum CardId public enum CardId
...@@ -46,8 +45,6 @@ namespace WindBot.Game.AI.Decks ...@@ -46,8 +45,6 @@ namespace WindBot.Game.AI.Decks
public CyberDragonExecutor(GameAI ai, Duel duel) public CyberDragonExecutor(GameAI ai, Duel duel)
: base(ai, duel) : base(ai, duel)
{ {
Bot = Duel.Fields[0];
AddExecutor(ExecutorType.SpellSet, (int)CardId.融合解除); AddExecutor(ExecutorType.SpellSet, (int)CardId.融合解除);
AddExecutor(ExecutorType.Activate, (int)CardId.时间胶囊, Capsule); AddExecutor(ExecutorType.Activate, (int)CardId.时间胶囊, Capsule);
...@@ -91,10 +88,10 @@ namespace WindBot.Game.AI.Decks ...@@ -91,10 +88,10 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos); AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
} }
private bool CyberDragonInHand() { return Duel.Fields[0].HasInHand((int)CardId.电子龙); } private bool CyberDragonInHand() { return Bot.HasInHand((int)CardId.电子龙); }
private bool CyberDragonInGraveyard() { return Duel.Fields[0].HasInGraveyard((int)CardId.电子龙); } private bool CyberDragonInGraveyard() { return Bot.HasInGraveyard((int)CardId.电子龙); }
private bool CyberDragonInMonsterZone() { return Duel.Fields[0].HasInMonstersZone((int)CardId.电子龙); } private bool CyberDragonInMonsterZone() { return Bot.HasInMonstersZone((int)CardId.电子龙); }
private bool CyberDragonIsBanished() { return Duel.Fields[0].HasInBanished((int)CardId.电子龙); } private bool CyberDragonIsBanished() { return Bot.HasInBanished((int)CardId.电子龙); }
private bool Capsule() private bool Capsule()
{ {
...@@ -130,20 +127,20 @@ namespace WindBot.Game.AI.Decks ...@@ -130,20 +127,20 @@ namespace WindBot.Game.AI.Decks
if (!AI.Utils.IsOneEnemyBetterThanValue(Bot.MonsterZone.GetHighestAttackMonster().Attack, false)) if (!AI.Utils.IsOneEnemyBetterThanValue(Bot.MonsterZone.GetHighestAttackMonster().Attack, false))
return false; return false;
else else
AI.SelectCard(Duel.Fields[1].MonsterZone.GetHighestAttackMonster()); AI.SelectCard(Enemy.MonsterZone.GetHighestAttackMonster());
return true; return true;
} }
private bool 没有电子龙可特殊召唤() private bool 没有电子龙可特殊召唤()
{ {
if (CyberDragonInHand() && (Bot.GetMonsterCount() == 0 && Duel.Fields[1].GetMonsterCount() != 0)) if (CyberDragonInHand() && (Bot.GetMonsterCount() == 0 && Enemy.GetMonsterCount() != 0))
return false; return false;
return true; return true;
} }
private bool 装甲电子翼() private bool 装甲电子翼()
{ {
if (CyberDragonInHand() && (Bot.GetMonsterCount() == 0 && Duel.Fields[1].GetMonsterCount() != 0) || (Bot.HasInHand((int)CardId.电子龙三型) || Bot.HasInHand((int)CardId.电子凤凰)) && !AI.Utils.IsOneEnemyBetterThanValue(1800,true)) if (CyberDragonInHand() && (Bot.GetMonsterCount() == 0 && Enemy.GetMonsterCount() != 0) || (Bot.HasInHand((int)CardId.电子龙三型) || Bot.HasInHand((int)CardId.电子凤凰)) && !AI.Utils.IsOneEnemyBetterThanValue(1800,true))
return false; return false;
return true; return true;
} }
...@@ -152,7 +149,7 @@ namespace WindBot.Game.AI.Decks ...@@ -152,7 +149,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Bot.GetCountCardInZone(Bot.Hand, (int)CardId.电子龙) + Bot.GetCountCardInZone(Bot.MonsterZone, (int)CardId.电子龙) + Bot.GetCountCardInZone(Bot.MonsterZone, (int)CardId.电子龙核) >= 1 && Bot.HasInHand((int)CardId.融合) || Bot.GetCountCardInZone(Bot.Hand, (int)CardId.电子龙) + Bot.GetCountCardInZone(Bot.MonsterZone, (int)CardId.电子龙) + Bot.GetCountCardInZone(Bot.Graveyard, (int)CardId.电子龙) + Bot.GetCountCardInZone(Bot.Graveyard, (int)CardId.电子龙核) >= 1 && Bot.HasInHand((int)CardId.力量结合)) if (Bot.GetCountCardInZone(Bot.Hand, (int)CardId.电子龙) + Bot.GetCountCardInZone(Bot.MonsterZone, (int)CardId.电子龙) + Bot.GetCountCardInZone(Bot.MonsterZone, (int)CardId.电子龙核) >= 1 && Bot.HasInHand((int)CardId.融合) || Bot.GetCountCardInZone(Bot.Hand, (int)CardId.电子龙) + Bot.GetCountCardInZone(Bot.MonsterZone, (int)CardId.电子龙) + Bot.GetCountCardInZone(Bot.Graveyard, (int)CardId.电子龙) + Bot.GetCountCardInZone(Bot.Graveyard, (int)CardId.电子龙核) >= 1 && Bot.HasInHand((int)CardId.力量结合))
return true; return true;
if (CyberDragonInHand() && (Bot.GetMonsterCount() == 0 && Duel.Fields[1].GetMonsterCount() != 0) || (Bot.HasInHand((int)CardId.电子龙三型) || Bot.HasInHand((int)CardId.电子凤凰)) && !AI.Utils.IsOneEnemyBetterThanValue(1800, true)) if (CyberDragonInHand() && (Bot.GetMonsterCount() == 0 && Enemy.GetMonsterCount() != 0) || (Bot.HasInHand((int)CardId.电子龙三型) || Bot.HasInHand((int)CardId.电子凤凰)) && !AI.Utils.IsOneEnemyBetterThanValue(1800, true))
return false; return false;
return true; return true;
} }
......
This diff is collapsed.
...@@ -109,7 +109,7 @@ namespace DevBot.Game.AI.Decks ...@@ -109,7 +109,7 @@ namespace DevBot.Game.AI.Decks
return false; return false;
m_swapFrogSummoned = -1; m_swapFrogSummoned = -1;
if (Duel.Fields[0].GetRemainingCount((int)CardId.Ronintoadin, 2) == 0) if (Bot.GetRemainingCount((int)CardId.Ronintoadin, 2) == 0)
return false; return false;
AI.SelectCard((int)CardId.Ronintoadin); AI.SelectCard((int)CardId.Ronintoadin);
...@@ -127,7 +127,7 @@ namespace DevBot.Game.AI.Decks ...@@ -127,7 +127,7 @@ namespace DevBot.Game.AI.Decks
if (Card.IsDefense() || m_flipFlopFrogSummoned == Duel.Turn || Duel.Phase == DuelPhase.Main2) if (Card.IsDefense() || m_flipFlopFrogSummoned == Duel.Turn || Duel.Phase == DuelPhase.Main2)
{ {
m_flipFlopFrogSummoned = -1; m_flipFlopFrogSummoned = -1;
List<ClientCard> monsters = Duel.Fields[1].GetMonsters(); List<ClientCard> monsters = Enemy.GetMonsters();
monsters.Sort(AIFunctions.CompareCardAttack); monsters.Sort(AIFunctions.CompareCardAttack);
monsters.Reverse(); monsters.Reverse();
AI.SelectCard(monsters); AI.SelectCard(monsters);
...@@ -138,7 +138,7 @@ namespace DevBot.Game.AI.Decks ...@@ -138,7 +138,7 @@ namespace DevBot.Game.AI.Decks
private bool Ronintoadin() private bool Ronintoadin()
{ {
List<ClientCard> monsters = Duel.Fields[0].GetGraveyardMonsters(); List<ClientCard> monsters = Bot.GetGraveyardMonsters();
if (monsters.Count > 2) if (monsters.Count > 2)
{ {
if (GetSpellBonus() == 0) if (GetSpellBonus() == 0)
...@@ -169,7 +169,7 @@ namespace DevBot.Game.AI.Decks ...@@ -169,7 +169,7 @@ namespace DevBot.Game.AI.Decks
cards.Add((int)CardId.FlipFlopFrog); cards.Add((int)CardId.FlipFlopFrog);
} }
if (Duel.Fields[0].SpellZone[5] == null) if (Bot.SpellZone[5] == null)
{ {
cards.Add((int)CardId.Terraforming); cards.Add((int)CardId.Terraforming);
cards.Add((int)CardId.Wetlands); cards.Add((int)CardId.Wetlands);
...@@ -195,22 +195,22 @@ namespace DevBot.Game.AI.Decks ...@@ -195,22 +195,22 @@ namespace DevBot.Game.AI.Decks
private bool Terraforming() private bool Terraforming()
{ {
if (Duel.Fields[0].HasInHand((int)CardId.Wetlands)) if (Bot.HasInHand((int)CardId.Wetlands))
return false; return false;
if (Duel.Fields[0].SpellZone[5] != null) if (Bot.SpellZone[5] != null)
return false; return false;
return true; return true;
} }
private bool Solidarity() private bool Solidarity()
{ {
List<ClientCard> monsters = Duel.Fields[0].GetGraveyardMonsters(); List<ClientCard> monsters = Bot.GetGraveyardMonsters();
return monsters.Count != 0; return monsters.Count != 0;
} }
private bool GravityBind() private bool GravityBind()
{ {
List<ClientCard> spells = Duel.Fields[0].GetSpells(); List<ClientCard> spells = Bot.GetSpells();
foreach (ClientCard spell in spells) foreach (ClientCard spell in spells)
{ {
if (spell.Id == (int)CardId.GravityBind && !spell.IsFacedown()) if (spell.Id == (int)CardId.GravityBind && !spell.IsFacedown())
...@@ -235,7 +235,7 @@ namespace DevBot.Game.AI.Decks ...@@ -235,7 +235,7 @@ namespace DevBot.Game.AI.Decks
if (Card.IsDefense() && !enemyBetter) if (Card.IsDefense() && !enemyBetter)
result = true; result = true;
if (!result && Card.Id == (int)CardId.FlipFlopFrog && Duel.Fields[1].GetMonsterCount() > 0 && Card.IsFacedown()) if (!result && Card.Id == (int)CardId.FlipFlopFrog && Enemy.GetMonsterCount() > 0 && Card.IsFacedown())
result = true; result = true;
if (Card.Id == (int)CardId.FlipFlopFrog && Card.IsFacedown() && result) if (Card.Id == (int)CardId.FlipFlopFrog && Card.IsFacedown() && result)
...@@ -247,13 +247,13 @@ namespace DevBot.Game.AI.Decks ...@@ -247,13 +247,13 @@ namespace DevBot.Game.AI.Decks
private int GetSpellBonus() private int GetSpellBonus()
{ {
int atk = 0; int atk = 0;
if (Duel.Fields[0].SpellZone[5] != null) if (Bot.SpellZone[5] != null)
atk += 1200; atk += 1200;
List<ClientCard> monsters = Duel.Fields[0].GetGraveyardMonsters(); List<ClientCard> monsters = Bot.GetGraveyardMonsters();
if (monsters.Count != 0) if (monsters.Count != 0)
{ {
foreach (ClientCard card in Duel.Fields[0].GetSpells()) foreach (ClientCard card in Bot.GetSpells())
{ {
if (card.Id == (int)CardId.Solidarity) if (card.Id == (int)CardId.Solidarity)
atk += 800; atk += 800;
......
...@@ -83,28 +83,28 @@ namespace WindBot.Game.AI.Decks ...@@ -83,28 +83,28 @@ namespace WindBot.Game.AI.Decks
private bool 王家长眠之谷的祭殿() private bool 王家长眠之谷的祭殿()
{ {
if (Card.Location == CardLocation.Hand && Duel.Fields[0].HasInSpellZone((int)Card.Id)) if (Card.Location == CardLocation.Hand && Bot.HasInSpellZone((int)Card.Id))
return false; return false;
return true; return true;
} }
private bool 王家长眠之谷() private bool 王家长眠之谷()
{ {
if (Duel.Fields[0].SpellZone[5] != null) if (Bot.SpellZone[5] != null)
return false; return false;
return true; return true;
} }
private bool 罪星尘龙() private bool 罪星尘龙()
{ {
if (Duel.Fields[0].SpellZone[5] != null) if (Bot.SpellZone[5] != null)
return true; return true;
return false; return false;
} }
private bool 守墓的司令官() private bool 守墓的司令官()
{ {
if (!Duel.Fields[0].HasInHand((int)CardId.王家长眠之谷) && !Duel.Fields[0].HasInSpellZone((int)CardId.王家长眠之谷)) if (!Bot.HasInHand((int)CardId.王家长眠之谷) && !Bot.HasInSpellZone((int)CardId.王家长眠之谷))
return true; return true;
return false; return false;
} }
...@@ -118,7 +118,7 @@ namespace WindBot.Game.AI.Decks ...@@ -118,7 +118,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (!Card.IsAttack()) if (!Card.IsAttack())
return false; return false;
foreach (ClientCard card in Duel.Fields[1].MonsterZone) foreach (ClientCard card in Enemy.MonsterZone)
if (card != null && card.IsDefense() && card.Defense > 1500 && card.Attack < 1500 || card.Attack > 1500 && card.Defense < 1500) if (card != null && card.IsDefense() && card.Defense > 1500 && card.Attack < 1500 || card.Attack > 1500 && card.Defense < 1500)
return true; return true;
return false; return false;
...@@ -126,10 +126,10 @@ namespace WindBot.Game.AI.Decks ...@@ -126,10 +126,10 @@ namespace WindBot.Game.AI.Decks
private bool 守墓的末裔() private bool 守墓的末裔()
{ {
int bestatk = Duel.Fields[0].GetMonsters().GetHighestAttackMonster().Attack; int bestatk = Bot.GetMonsters().GetHighestAttackMonster().Attack;
if (AI.Utils.IsOneEnemyBetterThanValue(bestatk, true)) if (AI.Utils.IsOneEnemyBetterThanValue(bestatk, true))
{ {
AI.SelectCard(Duel.Fields[1].GetMonsters().GetHighestAttackMonster()); AI.SelectCard(Enemy.GetMonsters().GetHighestAttackMonster());
return true; return true;
} }
return false; return false;
......
...@@ -68,12 +68,12 @@ namespace WindBot.Game.AI.Decks ...@@ -68,12 +68,12 @@ namespace WindBot.Game.AI.Decks
private bool FoolishBurial() private bool FoolishBurial()
{ {
if (Duel.Fields[0].HasInGraveyard((int)CardId.WhiteNightDragon)) if (Bot.HasInGraveyard((int)CardId.WhiteNightDragon))
return false; return false;
if (Duel.Fields[0].HasInHand((int)CardId.WhiteNightDragon)) if (Bot.HasInHand((int)CardId.WhiteNightDragon))
return false; return false;
int remaining = 2; int remaining = 2;
foreach (ClientCard card in Duel.Fields[0].Banished) foreach (ClientCard card in Bot.Banished)
if (card.Id == (int)CardId.WhiteNightDragon) if (card.Id == (int)CardId.WhiteNightDragon)
remaining--; remaining--;
if (remaining > 0) if (remaining > 0)
...@@ -91,7 +91,7 @@ namespace WindBot.Game.AI.Decks ...@@ -91,7 +91,7 @@ namespace WindBot.Game.AI.Decks
if (Duel.Player == 1 && Duel.Phase == DuelPhase.End) if (Duel.Player == 1 && Duel.Phase == DuelPhase.End)
return false; return false;
List<ClientCard> cards = new List<ClientCard>(Duel.Fields[0].Graveyard); List<ClientCard> cards = new List<ClientCard>(Bot.Graveyard);
cards.Sort(AIFunctions.CompareCardAttack); cards.Sort(AIFunctions.CompareCardAttack);
for (int i = cards.Count - 1; i >= 0; --i) for (int i = cards.Count - 1; i >= 0; --i)
{ {
...@@ -109,7 +109,7 @@ namespace WindBot.Game.AI.Decks ...@@ -109,7 +109,7 @@ namespace WindBot.Game.AI.Decks
private bool MonsterReborn() private bool MonsterReborn()
{ {
List<ClientCard> cards = new List<ClientCard>(Duel.Fields[0].Graveyard); List<ClientCard> cards = new List<ClientCard>(Bot.Graveyard);
cards.Sort(AIFunctions.CompareCardAttack); cards.Sort(AIFunctions.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)
...@@ -123,7 +123,7 @@ namespace WindBot.Game.AI.Decks ...@@ -123,7 +123,7 @@ namespace WindBot.Game.AI.Decks
break; break;
} }
} }
cards = new List<ClientCard>(Duel.Fields[1].Graveyard); cards = new List<ClientCard>(Enemy.Graveyard);
cards.Sort(AIFunctions.CompareCardAttack); cards.Sort(AIFunctions.CompareCardAttack);
for (int i = cards.Count - 1; i >= 0; --i) for (int i = cards.Count - 1; i >= 0; --i)
{ {
...@@ -147,7 +147,7 @@ namespace WindBot.Game.AI.Decks ...@@ -147,7 +147,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 (Duel.Fields[1].GetMonsterCount() != 0 && !AI.Utils.IsAllEnemyBetterThanValue(2300 - 1, false)) if (Enemy.GetMonsterCount() != 0 && !AI.Utils.IsAllEnemyBetterThanValue(2300 - 1, false))
foreach (ClientCard card in Main.SummonableCards) foreach (ClientCard card in Main.SummonableCards)
if (card.Id == 11224103) if (card.Id == 11224103)
return false; return false;
...@@ -162,7 +162,7 @@ namespace WindBot.Game.AI.Decks ...@@ -162,7 +162,7 @@ namespace WindBot.Game.AI.Decks
private bool DragonsRebirth() private bool DragonsRebirth()
{ {
List<ClientCard> cards = new List<ClientCard>(Duel.Fields[0].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(AIFunctions.CompareCardAttack);
...@@ -181,8 +181,8 @@ namespace WindBot.Game.AI.Decks ...@@ -181,8 +181,8 @@ namespace WindBot.Game.AI.Decks
if (tributeCard == null) if (tributeCard == null)
return false; return false;
cards = new List<ClientCard>(Duel.Fields[0].Hand); cards = new List<ClientCard>(Bot.Hand);
cards.AddRange(Duel.Fields[0].Graveyard); cards.AddRange(Bot.Graveyard);
if (cards.Count == 0) if (cards.Count == 0)
return false; return false;
cards.Sort(AIFunctions.CompareCardAttack); cards.Sort(AIFunctions.CompareCardAttack);
......
...@@ -97,7 +97,7 @@ namespace WindBot.Game.AI.Decks ...@@ -97,7 +97,7 @@ namespace WindBot.Game.AI.Decks
} }
if (!(defender.Id == (int)CardId.闪光No39希望皇霍普电光皇)) if (!(defender.Id == (int)CardId.闪光No39希望皇霍普电光皇))
{ {
if (attacker.Attribute == (int)CardAttribute.Light && Duel.Fields[0].HasInHand((int)CardId.欧尼斯特)) if (attacker.Attribute == (int)CardAttribute.Light && Bot.HasInHand((int)CardId.欧尼斯特))
attacker.RealPower = attacker.RealPower + defender.Attack; attacker.RealPower = attacker.RealPower + defender.Attack;
if (attacker.Id == (int)CardId.闪光No39希望皇霍普电光皇 && !attacker.IsDisabled() && attacker.HasXyzMaterial(2, (int)CardId.No39希望皇霍普)) if (attacker.Id == (int)CardId.闪光No39希望皇霍普电光皇 && !attacker.IsDisabled() && attacker.HasXyzMaterial(2, (int)CardId.No39希望皇霍普))
attacker.RealPower = 5000; attacker.RealPower = 5000;
...@@ -142,16 +142,16 @@ namespace WindBot.Game.AI.Decks ...@@ -142,16 +142,16 @@ namespace WindBot.Game.AI.Decks
private bool 增援效果() private bool 增援效果()
{ {
if (!Duel.Fields[0].HasInHand((int)CardId.哥布林德伯格)) if (!Bot.HasInHand((int)CardId.哥布林德伯格))
AI.SelectCard((int)CardId.哥布林德伯格); AI.SelectCard((int)CardId.哥布林德伯格);
else if (!Duel.Fields[0].HasInHand((int)CardId.光道暗杀者莱登)) else if (!Bot.HasInHand((int)CardId.光道暗杀者莱登))
AI.SelectCard((int)CardId.光道暗杀者莱登); AI.SelectCard((int)CardId.光道暗杀者莱登);
return true; return true;
} }
private bool 光之援军效果() private bool 光之援军效果()
{ {
if (!Duel.Fields[0].HasInHand((int)CardId.光道召唤师露米娜丝)) if (!Bot.HasInHand((int)CardId.光道召唤师露米娜丝))
AI.SelectCard((int)CardId.光道召唤师露米娜丝); AI.SelectCard((int)CardId.光道召唤师露米娜丝);
else else
AI.SelectCard(new[] AI.SelectCard(new[]
...@@ -179,7 +179,7 @@ namespace WindBot.Game.AI.Decks ...@@ -179,7 +179,7 @@ namespace WindBot.Game.AI.Decks
private bool 哥布林德伯格通常召唤() private bool 哥布林德伯格通常召唤()
{ {
foreach (ClientCard card in Duel.Fields[0].Hand) foreach (ClientCard card in Bot.Hand)
{ {
if (card != Card && card.IsMonster() && card.Level == 4) if (card != Card && card.IsMonster() && card.Level == 4)
return true; return true;
...@@ -215,25 +215,25 @@ namespace WindBot.Game.AI.Decks ...@@ -215,25 +215,25 @@ namespace WindBot.Game.AI.Decks
private bool 励辉士入魔蝇王特殊召唤() private bool 励辉士入魔蝇王特殊召唤()
{ {
int selfCount = Duel.Fields[0].GetMonsterCount() + Duel.Fields[0].GetSpellCount() + Duel.Fields[0].GetHandCount(); int selfCount = Bot.GetMonsterCount() + Bot.GetSpellCount() + Bot.GetHandCount();
int oppoCount = Duel.Fields[1].GetMonsterCount() + Duel.Fields[1].GetSpellCount() + Duel.Fields[1].GetHandCount(); int oppoCount = Enemy.GetMonsterCount() + Enemy.GetSpellCount() + Enemy.GetHandCount();
return (selfCount - 1 < oppoCount) && 励辉士入魔蝇王效果(); return (selfCount - 1 < oppoCount) && 励辉士入魔蝇王效果();
} }
private bool 励辉士入魔蝇王效果() private bool 励辉士入魔蝇王效果()
{ {
int selfCount = Duel.Fields[0].GetMonsterCount() + Duel.Fields[0].GetSpellCount(); int selfCount = Bot.GetMonsterCount() + Bot.GetSpellCount();
int oppoCount = Duel.Fields[1].GetMonsterCount() + Duel.Fields[1].GetSpellCount(); int oppoCount = Enemy.GetMonsterCount() + Enemy.GetSpellCount();
int selfAttack = 0; int selfAttack = 0;
List<ClientCard> monsters = Duel.Fields[0].GetMonsters(); List<ClientCard> monsters = Bot.GetMonsters();
foreach (ClientCard monster in monsters) foreach (ClientCard monster in monsters)
{ {
selfAttack += monster.GetDefensePower(); selfAttack += monster.GetDefensePower();
} }
int oppoAttack = 0; int oppoAttack = 0;
monsters = Duel.Fields[1].GetMonsters(); monsters = Enemy.GetMonsters();
foreach (ClientCard monster in monsters) foreach (ClientCard monster in monsters)
{ {
oppoAttack += monster.GetDefensePower(); oppoAttack += monster.GetDefensePower();
...@@ -244,15 +244,15 @@ namespace WindBot.Game.AI.Decks ...@@ -244,15 +244,15 @@ namespace WindBot.Game.AI.Decks
private bool 红莲魔龙右红痕特殊召唤() private bool 红莲魔龙右红痕特殊召唤()
{ {
int selfBestAttack = AI.Utils.GetBestAttack(Duel.Fields[0], true); int selfBestAttack = AI.Utils.GetBestAttack(Bot, true);
int oppoBestAttack = AI.Utils.GetBestAttack(Duel.Fields[1], false); int oppoBestAttack = AI.Utils.GetBestAttack(Enemy, false);
return (selfBestAttack <= oppoBestAttack && oppoBestAttack <= 3000) || 红莲魔龙右红痕效果(); return (selfBestAttack <= oppoBestAttack && oppoBestAttack <= 3000) || 红莲魔龙右红痕效果();
} }
private bool 红莲魔龙右红痕效果() private bool 红莲魔龙右红痕效果()
{ {
int selfCount = 0; int selfCount = 0;
List<ClientCard> monsters = Duel.Fields[0].GetMonsters(); List<ClientCard> monsters = Bot.GetMonsters();
foreach (ClientCard monster in monsters) foreach (ClientCard monster in monsters)
{ {
if (!monster.Equals(Card) && monster.HasType(CardType.Effect) && monster.Attack <= Card.Attack) if (!monster.Equals(Card) && monster.HasType(CardType.Effect) && monster.Attack <= Card.Attack)
...@@ -260,7 +260,7 @@ namespace WindBot.Game.AI.Decks ...@@ -260,7 +260,7 @@ namespace WindBot.Game.AI.Decks
} }
int oppoCount = 0; int oppoCount = 0;
monsters = Duel.Fields[1].GetMonsters(); monsters = Enemy.GetMonsters();
foreach (ClientCard monster in monsters) foreach (ClientCard monster in monsters)
{ {
// 没有办法获取特殊召唤的状态,只好默认全部是特招的 // 没有办法获取特殊召唤的状态,只好默认全部是特招的
......
This diff is collapsed.
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
if (Main.SummonableCards.Count == 1 && Main.SummonableCards[0].Level < 5) if (Main.SummonableCards.Count == 1 && Main.SummonableCards[0].Level < 5)
{ {
bool canTribute = false; bool canTribute = false;
foreach (ClientCard handCard in Duel.Fields[0].Hand) foreach (ClientCard handCard in Bot.Hand)
{ {
if (handCard.IsMonster() && handCard.Level > 4 && handCard.Level < 6) if (handCard.IsMonster() && handCard.Level > 4 && handCard.Level < 6)
canTribute = true; canTribute = true;
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
} }
int monsters = 0; int monsters = 0;
foreach (ClientCard handCard in Duel.Fields[0].Hand) foreach (ClientCard handCard in Bot.Hand)
{ {
if (handCard.IsMonster()) if (handCard.IsMonster())
monsters++; monsters++;
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
private bool SwordsOfRevealingLight() private bool SwordsOfRevealingLight()
{ {
foreach (ClientCard handCard in Duel.Fields[1].GetMonsters()) foreach (ClientCard handCard in Enemy.GetMonsters())
{ {
if (handCard.IsFacedown()) if (handCard.IsFacedown())
return true; return true;
......
...@@ -199,7 +199,7 @@ namespace WindBot.Game.AI.Decks ...@@ -199,7 +199,7 @@ namespace WindBot.Game.AI.Decks
private bool 优先盖不重复的坑() private bool 优先盖不重复的坑()
{ {
foreach (ClientCard card in Duel.Fields[0].SpellZone) foreach (ClientCard card in Bot.SpellZone)
{ {
if (card != null && card.Id == Card.Id) if (card != null && card.Id == Card.Id)
return false; return false;
...@@ -209,7 +209,7 @@ namespace WindBot.Game.AI.Decks ...@@ -209,7 +209,7 @@ namespace WindBot.Game.AI.Decks
private bool 魔陷区有空余格子() private bool 魔陷区有空余格子()
{ {
return Duel.Fields[0].GetSpellCountWithoutField() < 4; return Bot.GetSpellCountWithoutField() < 4;
} }
private bool 已发动过削命() private bool 已发动过削命()
...@@ -249,12 +249,12 @@ namespace WindBot.Game.AI.Decks ...@@ -249,12 +249,12 @@ namespace WindBot.Game.AI.Decks
if (!Card.HasType(CardType.Pendulum) || Card.Location != CardLocation.Hand) if (!Card.HasType(CardType.Pendulum) || Card.Location != CardLocation.Hand)
return false; return false;
int count = 0; int count = 0;
foreach (ClientCard card in Duel.Fields[0].Hand.GetMonsters()) foreach (ClientCard card in Bot.Hand.GetMonsters())
{ {
if (!Card.Equals(card)) if (!Card.Equals(card))
count++; count++;
} }
foreach (ClientCard card in Duel.Fields[0].ExtraDeck.GetMonsters()) foreach (ClientCard card in Bot.ExtraDeck.GetMonsters())
{ {
if (card.HasType(CardType.Pendulum) && card.IsFaceup()) if (card.HasType(CardType.Pendulum) && card.IsFaceup())
count++; count++;
...@@ -266,7 +266,7 @@ namespace WindBot.Game.AI.Decks ...@@ -266,7 +266,7 @@ namespace WindBot.Game.AI.Decks
if (已发动削命) if (已发动削命)
return true; return true;
bool pair = false; bool pair = false;
foreach (ClientCard card in Duel.Fields[0].Hand.GetMonsters()) foreach (ClientCard card in Bot.Hand.GetMonsters())
{ {
if (card.RScale != Card.LScale) if (card.RScale != Card.LScale)
{ {
...@@ -291,21 +291,21 @@ namespace WindBot.Game.AI.Decks ...@@ -291,21 +291,21 @@ namespace WindBot.Game.AI.Decks
int count = 0; int count = 0;
int handcount = 0; int handcount = 0;
int fieldcount = 0; int fieldcount = 0;
foreach (ClientCard card in Duel.Fields[0].Hand.GetMonsters()) foreach (ClientCard card in Bot.Hand.GetMonsters())
{ {
count++; count++;
handcount++; handcount++;
} }
foreach (ClientCard card in Duel.Fields[0].MonsterZone.GetMonsters()) foreach (ClientCard card in Bot.MonsterZone.GetMonsters())
{ {
fieldcount++; fieldcount++;
} }
foreach (ClientCard card in Duel.Fields[0].ExtraDeck.GetMonsters()) foreach (ClientCard card in Bot.ExtraDeck.GetMonsters())
{ {
if (card.HasType(CardType.Pendulum) && card.IsFaceup()) if (card.HasType(CardType.Pendulum) && card.IsFaceup())
count++; count++;
} }
if (count>0 && !Duel.Fields[0].HasInHand(低刻度)) if (count>0 && !Bot.HasInHand(低刻度))
{ {
AI.SelectCard(低刻度); AI.SelectCard(低刻度);
} }
...@@ -335,13 +335,13 @@ namespace WindBot.Game.AI.Decks ...@@ -335,13 +335,13 @@ namespace WindBot.Game.AI.Decks
AI.SelectCard(target); AI.SelectCard(target);
return true; return true;
} }
List<ClientCard> monsters = Duel.Fields[1].GetMonsters(); List<ClientCard> monsters = Enemy.GetMonsters();
foreach (ClientCard monster in monsters) foreach (ClientCard monster in monsters)
{ {
AI.SelectCard(monster); AI.SelectCard(monster);
return true; return true;
} }
List<ClientCard> spells = Duel.Fields[1].GetSpells(); List<ClientCard> spells = Enemy.GetSpells();
foreach (ClientCard spell in spells) foreach (ClientCard spell in spells)
{ {
if (spell.IsFacedown()) if (spell.IsFacedown())
...@@ -368,7 +368,7 @@ namespace WindBot.Game.AI.Decks ...@@ -368,7 +368,7 @@ namespace WindBot.Game.AI.Decks
AI.SelectCard(target); AI.SelectCard(target);
return true; return true;
} }
List<ClientCard> monsters = Duel.Fields[1].GetMonsters(); List<ClientCard> monsters = Enemy.GetMonsters();
foreach (ClientCard monster in monsters) foreach (ClientCard monster in monsters)
{ {
AI.SelectCard(monster); AI.SelectCard(monster);
...@@ -387,7 +387,7 @@ namespace WindBot.Game.AI.Decks ...@@ -387,7 +387,7 @@ namespace WindBot.Game.AI.Decks
AI.SelectCard(target); AI.SelectCard(target);
return true; return true;
} }
List<ClientCard> spells = Duel.Fields[1].GetSpells(); List<ClientCard> spells = Enemy.GetSpells();
foreach (ClientCard spell in spells) foreach (ClientCard spell in spells)
{ {
if (spell.IsFacedown()) if (spell.IsFacedown())
...@@ -411,11 +411,11 @@ namespace WindBot.Game.AI.Decks ...@@ -411,11 +411,11 @@ namespace WindBot.Game.AI.Decks
if (l != null && r != null && l.LScale != r.RScale) if (l != null && r != null && l.LScale != r.RScale)
{ {
int count = 0; int count = 0;
foreach (ClientCard card in Duel.Fields[0].Hand.GetMonsters()) foreach (ClientCard card in Bot.Hand.GetMonsters())
{ {
count++; count++;
} }
foreach (ClientCard card in Duel.Fields[0].ExtraDeck.GetMonsters()) foreach (ClientCard card in Bot.ExtraDeck.GetMonsters())
{ {
if (card.HasType(CardType.Pendulum) && card.IsFaceup()) if (card.HasType(CardType.Pendulum) && card.IsFaceup())
count++; count++;
......
This diff is collapsed.
...@@ -120,7 +120,7 @@ namespace DevBot.Game.AI.Decks ...@@ -120,7 +120,7 @@ namespace DevBot.Game.AI.Decks
private bool 特殊召唤不重复的超量怪兽() private bool 特殊召唤不重复的超量怪兽()
{ {
List<ClientCard> monsters = Duel.Fields[0].GetMonsters(); List<ClientCard> monsters = Bot.GetMonsters();
foreach (ClientCard monster in monsters) foreach (ClientCard monster in monsters)
if (monster.Id == Card.Id) if (monster.Id == Card.Id)
return false; return false;
...@@ -179,12 +179,12 @@ namespace DevBot.Game.AI.Decks ...@@ -179,12 +179,12 @@ namespace DevBot.Game.AI.Decks
if (场上有5星怪兽()) if (场上有5星怪兽())
return true; return true;
int 其他的5星资源数量 = 0; int 其他的5星资源数量 = 0;
IList<ClientCard> hand = Duel.Fields[0].Hand; IList<ClientCard> hand = Bot.Hand;
foreach (ClientCard card in hand) foreach (ClientCard card in hand)
{ {
if (card.Id == (int)CardId.简易融合 && !已发动简易融合) if (card.Id == (int)CardId.简易融合 && !已发动简易融合)
++其他的5星资源数量; ++其他的5星资源数量;
if (card.Id == (int)CardId.速攻同调士 && Duel.Fields[0].Hand.ContainsMonsterWithLevel(4)) if (card.Id == (int)CardId.速攻同调士 && Bot.Hand.ContainsMonsterWithLevel(4))
++其他的5星资源数量; ++其他的5星资源数量;
if (card.Id == (int)CardId.迷雾恶魔 && !已通常召唤) if (card.Id == (int)CardId.迷雾恶魔 && !已通常召唤)
++其他的5星资源数量; ++其他的5星资源数量;
...@@ -210,7 +210,7 @@ namespace DevBot.Game.AI.Decks ...@@ -210,7 +210,7 @@ namespace DevBot.Game.AI.Decks
{ {
if (!已通常召唤 || 已发动二重召唤) if (!已通常召唤 || 已发动二重召唤)
return false; return false;
IList<ClientCard> hand = Duel.Fields[0].Hand; IList<ClientCard> hand = Bot.Hand;
foreach (ClientCard card in hand) foreach (ClientCard card in hand)
{ {
if (card.Id == (int)CardId.迷雾恶魔 || if (card.Id == (int)CardId.迷雾恶魔 ||
...@@ -262,7 +262,7 @@ namespace DevBot.Game.AI.Decks ...@@ -262,7 +262,7 @@ namespace DevBot.Game.AI.Decks
} }
else else
{ {
List<ClientCard> monsters = Duel.Fields[1].GetMonsters(); List<ClientCard> monsters = Enemy.GetMonsters();
ClientCard bestmonster = null; ClientCard bestmonster = null;
foreach (ClientCard monster in monsters) foreach (ClientCard monster in monsters)
{ {
...@@ -285,7 +285,7 @@ namespace DevBot.Game.AI.Decks ...@@ -285,7 +285,7 @@ namespace DevBot.Game.AI.Decks
private bool No61火山恐龙效果() private bool No61火山恐龙效果()
{ {
ClientCard target = Duel.Fields[1].MonsterZone.GetFloodgate(); ClientCard target = Enemy.MonsterZone.GetFloodgate();
if (target == null) if (target == null)
target = AI.Utils.GetOneEnemyBetterThanValue(2000, false); target = AI.Utils.GetOneEnemyBetterThanValue(2000, false);
if (target != null) if (target != null)
...@@ -310,12 +310,12 @@ namespace DevBot.Game.AI.Decks ...@@ -310,12 +310,12 @@ namespace DevBot.Game.AI.Decks
private bool 迅雷之骑士盖亚龙骑士特殊召唤() private bool 迅雷之骑士盖亚龙骑士特殊召唤()
{ {
if (已发动火山恐龙 && Duel.Fields[0].HasInMonstersZone((int)CardId.No61火山恐龙)) if (已发动火山恐龙 && Bot.HasInMonstersZone((int)CardId.No61火山恐龙))
{ {
AI.SelectCard((int)CardId.No61火山恐龙); AI.SelectCard((int)CardId.No61火山恐龙);
return true; return true;
} }
List<ClientCard> monsters = Duel.Fields[0].GetMonsters(); List<ClientCard> monsters = Bot.GetMonsters();
foreach (ClientCard monster in monsters) foreach (ClientCard monster in monsters)
{ {
if (monster.HasType(CardType.Xyz) && !monster.HasXyzMaterial()) if (monster.HasType(CardType.Xyz) && !monster.HasXyzMaterial())
...@@ -329,7 +329,7 @@ namespace DevBot.Game.AI.Decks ...@@ -329,7 +329,7 @@ namespace DevBot.Game.AI.Decks
private bool 超量苏生效果() private bool 超量苏生效果()
{ {
foreach (ClientCard card in Duel.Fields[0].SpellZone) foreach (ClientCard card in Bot.SpellZone)
{ {
if (card != null && if (card != null &&
card.Id == Card.Id && card.Id == Card.Id &&
...@@ -349,7 +349,7 @@ namespace DevBot.Game.AI.Decks ...@@ -349,7 +349,7 @@ namespace DevBot.Game.AI.Decks
private bool 超量组件效果() private bool 超量组件效果()
{ {
List<ClientCard> monsters = Duel.Fields[0].GetMonsters(); List<ClientCard> monsters = Bot.GetMonsters();
return monsters.Exists(p => p.HasType(CardType.Xyz)); return monsters.Exists(p => p.HasType(CardType.Xyz));
} }
...@@ -361,13 +361,13 @@ namespace DevBot.Game.AI.Decks ...@@ -361,13 +361,13 @@ namespace DevBot.Game.AI.Decks
AI.SelectCard(target); AI.SelectCard(target);
return true; return true;
} }
List<ClientCard> monsters = Duel.Fields[1].GetMonsters(); List<ClientCard> monsters = Enemy.GetMonsters();
foreach (ClientCard monster in monsters) foreach (ClientCard monster in monsters)
{ {
AI.SelectCard(monster); AI.SelectCard(monster);
return true; return true;
} }
List<ClientCard> spells = Duel.Fields[1].GetSpells(); List<ClientCard> spells = Enemy.GetSpells();
foreach (ClientCard spell in spells) foreach (ClientCard spell in spells)
{ {
if (spell.IsFacedown()) if (spell.IsFacedown())
...@@ -386,13 +386,13 @@ namespace DevBot.Game.AI.Decks ...@@ -386,13 +386,13 @@ namespace DevBot.Game.AI.Decks
private bool 超量遮护罩效果() private bool 超量遮护罩效果()
{ {
List<ClientCard> spells = Duel.Fields[0].GetSpells(); List<ClientCard> spells = Bot.GetSpells();
foreach (ClientCard spell in spells) foreach (ClientCard spell in spells)
{ {
if (spell.Id == (int)CardId.超量遮护罩 && !spell.IsFacedown()) if (spell.Id == (int)CardId.超量遮护罩 && !spell.IsFacedown())
return false; return false;
} }
List<ClientCard> monsters = Duel.Fields[0].GetMonsters(); List<ClientCard> monsters = Bot.GetMonsters();
foreach (ClientCard monster in monsters) foreach (ClientCard monster in monsters)
{ {
if (monster.HasType(CardType.Xyz)) if (monster.HasType(CardType.Xyz))
...@@ -403,7 +403,7 @@ namespace DevBot.Game.AI.Decks ...@@ -403,7 +403,7 @@ namespace DevBot.Game.AI.Decks
private bool 场上有5星怪兽() private bool 场上有5星怪兽()
{ {
List<ClientCard> monsters = Duel.Fields[0].GetMonsters(); List<ClientCard> monsters = Bot.GetMonsters();
foreach (ClientCard monster in monsters) foreach (ClientCard monster in monsters)
{ {
if (monster.HasType(CardType.Monster) && if (monster.HasType(CardType.Monster) &&
...@@ -421,10 +421,10 @@ namespace DevBot.Game.AI.Decks ...@@ -421,10 +421,10 @@ namespace DevBot.Game.AI.Decks
ClientCard card = AI.Utils.GetProblematicCard(); ClientCard card = AI.Utils.GetProblematicCard();
if (card != null) if (card != null)
return card; return card;
card = Duel.Fields[1].MonsterZone.GetHighestAttackMonster(); card = Enemy.MonsterZone.GetHighestAttackMonster();
if (card != null) if (card != null)
return card; return card;
List<ClientCard> spells = Duel.Fields[1].GetSpells(); List<ClientCard> spells = Enemy.GetSpells();
if (spells.Count > 0) if (spells.Count > 0)
return spells[0]; return spells[0];
return null; return null;
......
This diff is collapsed.
...@@ -184,7 +184,7 @@ namespace WindBot.Game.AI.Decks ...@@ -184,7 +184,7 @@ namespace WindBot.Game.AI.Decks
} }
if (!(defender.Id == (int)CardId.闪光No39希望皇霍普电光皇)) if (!(defender.Id == (int)CardId.闪光No39希望皇霍普电光皇))
{ {
if (attacker.Attribute == (int)CardAttribute.Wind && Duel.Fields[0].HasInHand((int)CardId.妖仙兽辻斩风)) if (attacker.Attribute == (int)CardAttribute.Wind && Bot.HasInHand((int)CardId.妖仙兽辻斩风))
attacker.RealPower = attacker.RealPower + 1000; attacker.RealPower = attacker.RealPower + 1000;
if (attacker.Id == (int)CardId.闪光No39希望皇霍普电光皇 && !attacker.IsDisabled() && attacker.HasXyzMaterial(2, (int)CardId.No39希望皇霍普)) if (attacker.Id == (int)CardId.闪光No39希望皇霍普电光皇 && !attacker.IsDisabled() && attacker.HasXyzMaterial(2, (int)CardId.No39希望皇霍普))
attacker.RealPower = 5000; attacker.RealPower = 5000;
...@@ -269,7 +269,7 @@ namespace WindBot.Game.AI.Decks ...@@ -269,7 +269,7 @@ namespace WindBot.Game.AI.Decks
private bool 优先出重复的妖仙兽() private bool 优先出重复的妖仙兽()
{ {
foreach (ClientCard card in Duel.Fields[0].Hand) foreach (ClientCard card in Bot.Hand)
{ {
if (card != null && !card.Equals(Card) && card.Id == Card.Id) if (card != null && !card.Equals(Card) && card.Id == Card.Id)
return true; return true;
...@@ -279,7 +279,7 @@ namespace WindBot.Game.AI.Decks ...@@ -279,7 +279,7 @@ namespace WindBot.Game.AI.Decks
private bool 优先盖不重复的坑() private bool 优先盖不重复的坑()
{ {
foreach (ClientCard card in Duel.Fields[0].SpellZone) foreach (ClientCard card in Bot.SpellZone)
{ {
if (card != null && card.Id == Card.Id) if (card != null && card.Id == Card.Id)
return false; return false;
...@@ -289,7 +289,7 @@ namespace WindBot.Game.AI.Decks ...@@ -289,7 +289,7 @@ namespace WindBot.Game.AI.Decks
private bool 魔陷区有空余格子() private bool 魔陷区有空余格子()
{ {
return Duel.Fields[0].GetSpellCountWithoutField() < 4; return Bot.GetSpellCountWithoutField() < 4;
} }
private bool 已发动过削命() private bool 已发动过削命()
...@@ -320,7 +320,7 @@ namespace WindBot.Game.AI.Decks ...@@ -320,7 +320,7 @@ namespace WindBot.Game.AI.Decks
private bool 我我我枪手特殊召唤() private bool 我我我枪手特殊召唤()
{ {
if (Duel.LifePoints[1] <= 800 || (Duel.Fields[0].GetMonsterCount()>=4 && Duel.LifePoints[1] <= 1600)) if (Duel.LifePoints[1] <= 800 || (Bot.GetMonsterCount()>=4 && Duel.LifePoints[1] <= 1600))
{ {
AI.SelectPosition(CardPosition.FaceUpDefence); AI.SelectPosition(CardPosition.FaceUpDefence);
return true; return true;
...@@ -330,28 +330,28 @@ namespace WindBot.Game.AI.Decks ...@@ -330,28 +330,28 @@ namespace WindBot.Game.AI.Decks
private bool 励辉士入魔蝇王特殊召唤() private bool 励辉士入魔蝇王特殊召唤()
{ {
int selfCount = Duel.Fields[0].GetMonsterCount() + Duel.Fields[0].GetSpellCount() + Duel.Fields[0].GetHandCount(); int selfCount = Bot.GetMonsterCount() + Bot.GetSpellCount() + Bot.GetHandCount();
int oppoCount = Duel.Fields[1].GetMonsterCount() + Duel.Fields[1].GetSpellCount() + Duel.Fields[1].GetHandCount(); int oppoCount = Enemy.GetMonsterCount() + Enemy.GetSpellCount() + Enemy.GetHandCount();
return (selfCount - 1 < oppoCount) && 励辉士入魔蝇王效果(); return (selfCount - 1 < oppoCount) && 励辉士入魔蝇王效果();
} }
private bool 励辉士入魔蝇王效果() private bool 励辉士入魔蝇王效果()
{ {
int selfCount = Duel.Fields[0].GetMonsterCount() + Duel.Fields[0].GetSpellCount(); int selfCount = Bot.GetMonsterCount() + Bot.GetSpellCount();
int oppoCount = Duel.Fields[1].GetMonsterCount() + Duel.Fields[1].GetSpellCount(); int oppoCount = Enemy.GetMonsterCount() + Enemy.GetSpellCount();
return selfCount < oppoCount; return selfCount < oppoCount;
} }
private bool 暗叛逆超量龙特殊召唤() private bool 暗叛逆超量龙特殊召唤()
{ {
int selfBestAttack = AI.Utils.GetBestAttack(Duel.Fields[0], true); int selfBestAttack = AI.Utils.GetBestAttack(Bot, true);
int oppoBestAttack = AI.Utils.GetBestAttack(Duel.Fields[1], true); int oppoBestAttack = AI.Utils.GetBestAttack(Enemy, true);
return selfBestAttack <= oppoBestAttack; return selfBestAttack <= oppoBestAttack;
} }
private bool 暗叛逆超量龙效果() private bool 暗叛逆超量龙效果()
{ {
int oppoBestAttack = AI.Utils.GetBestAttack(Duel.Fields[1], true); int oppoBestAttack = AI.Utils.GetBestAttack(Enemy, true);
ClientCard target = AI.Utils.GetOneEnemyBetterThanValue(oppoBestAttack, true); ClientCard target = AI.Utils.GetOneEnemyBetterThanValue(oppoBestAttack, true);
if (target != null) if (target != null)
{ {
...@@ -362,8 +362,8 @@ namespace WindBot.Game.AI.Decks ...@@ -362,8 +362,8 @@ namespace WindBot.Game.AI.Decks
private bool 电光皇特殊召唤() private bool 电光皇特殊召唤()
{ {
int selfBestAttack = AI.Utils.GetBestAttack(Duel.Fields[0], true); int selfBestAttack = AI.Utils.GetBestAttack(Bot, true);
int oppoBestAttack = AI.Utils.GetBestAttack(Duel.Fields[1], false); int oppoBestAttack = AI.Utils.GetBestAttack(Enemy, false);
return selfBestAttack <= oppoBestAttack; return selfBestAttack <= oppoBestAttack;
} }
......
...@@ -134,7 +134,7 @@ namespace DevBot.Game.AI.Decks ...@@ -134,7 +134,7 @@ namespace DevBot.Game.AI.Decks
} }
if (!(defender.Id == (int)CardId.NumberS39UtopiatheLightning)) if (!(defender.Id == (int)CardId.NumberS39UtopiatheLightning))
{ {
if (attacker.Attribute == (int)CardAttribute.Light && Duel.Fields[0].HasInHand((int)CardId.Honest)) if (attacker.Attribute == (int)CardAttribute.Light && Bot.HasInHand((int)CardId.Honest))
attacker.RealPower = attacker.RealPower + defender.Attack; attacker.RealPower = attacker.RealPower + defender.Attack;
if (attacker.Id == (int)CardId.NumberS39UtopiatheLightning && !attacker.IsDisabled() && attacker.HasXyzMaterial(2, (int)CardId.Number39Utopia)) if (attacker.Id == (int)CardId.NumberS39UtopiatheLightning && !attacker.IsDisabled() && attacker.HasXyzMaterial(2, (int)CardId.Number39Utopia))
attacker.RealPower = 5000; attacker.RealPower = 5000;
...@@ -180,7 +180,7 @@ namespace DevBot.Game.AI.Decks ...@@ -180,7 +180,7 @@ namespace DevBot.Game.AI.Decks
{ {
if (Duel.LifePoints[0] <= 1000) if (Duel.LifePoints[0] <= 1000)
return false; return false;
List<ClientCard> monsters = Duel.Fields[0].GetMonsters(); List<ClientCard> monsters = Bot.GetMonsters();
int count4 = 0; int count4 = 0;
int count5 = 0; int count5 = 0;
foreach (ClientCard card in monsters) foreach (ClientCard card in monsters)
...@@ -220,7 +220,7 @@ namespace DevBot.Game.AI.Decks ...@@ -220,7 +220,7 @@ namespace DevBot.Game.AI.Decks
private bool GoblindberghFirst() private bool GoblindberghFirst()
{ {
IList<ClientCard> hand = Duel.Fields[0].Hand; IList<ClientCard> hand = Bot.Hand;
foreach (ClientCard card in hand) foreach (ClientCard card in hand)
{ {
if (card != Card && card.IsMonster() && card.Level == 4) if (card != Card && card.IsMonster() && card.Level == 4)
...@@ -243,8 +243,8 @@ namespace DevBot.Game.AI.Decks ...@@ -243,8 +243,8 @@ namespace DevBot.Game.AI.Decks
private bool SummonerMonkEffect() private bool SummonerMonkEffect()
{ {
if (Duel.Fields[0].HasInHand((int)CardId.InstantFusion) || if (Bot.HasInHand((int)CardId.InstantFusion) ||
Duel.Fields[0].HasInHand((int)CardId.MysticalSpaceTyphoon)) Bot.HasInHand((int)CardId.MysticalSpaceTyphoon))
{ {
AI.SelectCard(new[] AI.SelectCard(new[]
{ {
...@@ -266,7 +266,7 @@ namespace DevBot.Game.AI.Decks ...@@ -266,7 +266,7 @@ namespace DevBot.Game.AI.Decks
private bool SolarWindJammer() private bool SolarWindJammer()
{ {
if (!Duel.Fields[0].HasInHand(new List<int> { if (!Bot.HasInHand(new List<int> {
(int)CardId.StarDrawing, (int)CardId.StarDrawing,
(int)CardId.InstantFusion (int)CardId.InstantFusion
})) }))
......
This diff is collapsed.
...@@ -29,11 +29,11 @@ namespace WindBot.Game.AI ...@@ -29,11 +29,11 @@ namespace WindBot.Game.AI
protected bool DefaultStampingDestruction() protected bool DefaultStampingDestruction()
{ {
List<ClientCard> spells = Duel.Fields[1].GetSpells(); List<ClientCard> spells = Enemy.GetSpells();
if (spells.Count == 0) if (spells.Count == 0)
return false; return false;
ClientCard selected = Duel.Fields[1].SpellZone.GetFloodgate(); ClientCard selected = Enemy.SpellZone.GetFloodgate();
if (selected == null) if (selected == null)
{ {
...@@ -55,14 +55,14 @@ namespace WindBot.Game.AI ...@@ -55,14 +55,14 @@ namespace WindBot.Game.AI
protected bool DefaultGalaxyCyclone() protected bool DefaultGalaxyCyclone()
{ {
List<ClientCard> spells = Duel.Fields[1].GetSpells(); List<ClientCard> spells = Enemy.GetSpells();
if (spells.Count == 0) if (spells.Count == 0)
return false; return false;
ClientCard selected = null; ClientCard selected = null;
if (Card.Location == CardLocation.Grave) if (Card.Location == CardLocation.Grave)
{ {
selected = Duel.Fields[1].SpellZone.GetFloodgate(); selected = Enemy.SpellZone.GetFloodgate();
if (selected == null) if (selected == null)
{ {
foreach (ClientCard card in spells) foreach (ClientCard card in spells)
...@@ -98,7 +98,7 @@ namespace WindBot.Game.AI ...@@ -98,7 +98,7 @@ namespace WindBot.Game.AI
{ {
if (AI.Utils.IsEnemyBetter(true, true)) if (AI.Utils.IsEnemyBetter(true, true))
{ {
ClientCard monster = Duel.Fields[1].GetMonsters().GetHighestAttackMonster(); ClientCard monster = Enemy.GetMonsters().GetHighestAttackMonster();
if (monster != null && monster.HasType(CardType.Effect) && (monster.HasType(CardType.Xyz) || monster.Level > 4)) if (monster != null && monster.HasType(CardType.Effect) && (monster.HasType(CardType.Xyz) || monster.Level > 4))
{ {
AI.SelectCard(monster); AI.SelectCard(monster);
...@@ -120,7 +120,7 @@ namespace WindBot.Game.AI ...@@ -120,7 +120,7 @@ namespace WindBot.Game.AI
{ {
if (Card.Equals(card)) if (Card.Equals(card))
{ {
List<ClientCard> monsters = Duel.Fields[1].GetMonsters(); List<ClientCard> monsters = Enemy.GetMonsters();
foreach (ClientCard monster in monsters) foreach (ClientCard monster in monsters)
{ {
AI.SelectCard(monster); AI.SelectCard(monster);
...@@ -137,7 +137,7 @@ namespace WindBot.Game.AI ...@@ -137,7 +137,7 @@ namespace WindBot.Game.AI
return false; return false;
ClientCard selected = null; ClientCard selected = null;
int BestAtk = 0; int BestAtk = 0;
foreach (ClientCard card in Duel.Fields[0].Graveyard) foreach (ClientCard card in Bot.Graveyard)
{ {
if (card.Attack > BestAtk) if (card.Attack > BestAtk)
{ {
...@@ -156,7 +156,7 @@ namespace WindBot.Game.AI ...@@ -156,7 +156,7 @@ namespace WindBot.Game.AI
protected bool DefaultHeavyStorm() protected bool DefaultHeavyStorm()
{ {
return Duel.Fields[0].GetSpellCount() < Duel.Fields[1].GetSpellCount(); return Bot.GetSpellCount() < Enemy.GetSpellCount();
} }
protected bool DefaultHammerShot() protected bool DefaultHammerShot()
...@@ -176,12 +176,12 @@ namespace WindBot.Game.AI ...@@ -176,12 +176,12 @@ namespace WindBot.Game.AI
protected bool DefaultSpellSet() protected bool DefaultSpellSet()
{ {
return Card.IsTrap() && Duel.Fields[0].GetSpellCountWithoutField() < 4; return Card.IsTrap() && Bot.GetSpellCountWithoutField() < 4;
} }
protected bool DefaultTributeSummon() protected bool DefaultTributeSummon()
{ {
foreach (ClientCard card in Duel.Fields[0].SpellZone) foreach (ClientCard card in Bot.SpellZone)
{ {
if (card != null && if (card != null &&
card.Id == Card.Id && card.Id == Card.Id &&
...@@ -191,7 +191,7 @@ namespace WindBot.Game.AI ...@@ -191,7 +191,7 @@ namespace WindBot.Game.AI
int tributecount = (int)Math.Ceiling((Card.Level - 4.0d) / 2.0d); int tributecount = (int)Math.Ceiling((Card.Level - 4.0d) / 2.0d);
for (int j = 0; j < 7; ++j) for (int j = 0; j < 7; ++j)
{ {
ClientCard tributeCard = Duel.Fields[0].MonsterZone[j]; ClientCard tributeCard = Bot.MonsterZone[j];
if (tributeCard == null) continue; if (tributeCard == null) continue;
if (tributeCard.Attack < Card.Attack) if (tributeCard.Attack < Card.Attack)
tributecount--; tributecount--;
...@@ -201,7 +201,7 @@ namespace WindBot.Game.AI ...@@ -201,7 +201,7 @@ namespace WindBot.Game.AI
protected bool DefaultField() protected bool DefaultField()
{ {
return Duel.Fields[0].SpellZone[5] == null; return Bot.SpellZone[5] == null;
} }
protected bool DefaultMonsterRepos() protected bool DefaultMonsterRepos()
...@@ -225,7 +225,7 @@ namespace WindBot.Game.AI ...@@ -225,7 +225,7 @@ namespace WindBot.Game.AI
if (HasChainedTrap(0)) if (HasChainedTrap(0))
return false; return false;
foreach (ClientCard card in Duel.Fields[0].SpellZone) foreach (ClientCard card in Bot.SpellZone)
{ {
if (card != null && if (card != null &&
card.Id == Card.Id && card.Id == Card.Id &&
...@@ -257,7 +257,7 @@ namespace WindBot.Game.AI ...@@ -257,7 +257,7 @@ namespace WindBot.Game.AI
{ {
if (Duel.Player != 0) if (Duel.Player != 0)
{ {
List<ClientCard> monsters = Duel.Fields[1].GetMonsters(); List<ClientCard> monsters = Enemy.GetMonsters();
int[] levels = new int[13]; int[] levels = new int[13];
bool tuner = false; bool tuner = false;
bool nontuner = false; bool nontuner = false;
...@@ -287,8 +287,8 @@ namespace WindBot.Game.AI ...@@ -287,8 +287,8 @@ namespace WindBot.Game.AI
return true; return true;
} }
} }
ClientCard l = Duel.Fields[1].SpellZone[6]; ClientCard l = Enemy.SpellZone[6];
ClientCard r = Duel.Fields[1].SpellZone[7]; ClientCard r = Enemy.SpellZone[7];
if (l != null && r != null && l.LScale != r.RScale) if (l != null && r != null && l.LScale != r.RScale)
{ {
AI.SelectOption(4); AI.SelectOption(4);
......
...@@ -19,7 +19,10 @@ namespace WindBot.Game.AI ...@@ -19,7 +19,10 @@ namespace WindBot.Game.AI
protected int ActivateDescription { get; private set; } protected int ActivateDescription { get; private set; }
protected int LastChainPlayer { get; private set; } protected int LastChainPlayer { get; private set; }
protected IList<ClientCard> CurrentChain { get; private set; } protected IList<ClientCard> CurrentChain { get; private set; }
public ClientField Bot { get; private set; }
public ClientField Enemy { get; private set; }
protected Executor(GameAI ai, Duel duel) protected Executor(GameAI ai, Duel duel)
{ {
...@@ -29,6 +32,9 @@ namespace WindBot.Game.AI ...@@ -29,6 +32,9 @@ namespace WindBot.Game.AI
LastChainPlayer = -1; LastChainPlayer = -1;
CurrentChain = new List<ClientCard>(); CurrentChain = new List<ClientCard>();
Bot = Duel.Fields[0];
Enemy = Duel.Fields[1];
} }
public virtual bool OnSelectHand() public virtual bool OnSelectHand()
......
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