Commit f0e083d5 authored by mercury233's avatar mercury233

shortcut for Duel.Fields

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