Commit b225efae authored by mercury233's avatar mercury233

update ai util functions

parent fc10fcec
This diff is collapsed.
...@@ -12,7 +12,7 @@ namespace WindBot.Game.AI ...@@ -12,7 +12,7 @@ namespace WindBot.Game.AI
ClientCard selected = null; ClientCard selected = null;
foreach (ClientCard card in cards) foreach (ClientCard card in cards)
{ {
if (card == null || card.Data == null) continue; if (card == null || card.Data == null || card.IsFacedown()) continue;
if (card.HasType(CardType.Monster) && card.Attack > highestAtk) if (card.HasType(CardType.Monster) && card.Attack > highestAtk)
{ {
highestAtk = card.Attack; highestAtk = card.Attack;
...@@ -28,7 +28,7 @@ namespace WindBot.Game.AI ...@@ -28,7 +28,7 @@ namespace WindBot.Game.AI
ClientCard selected = null; ClientCard selected = null;
foreach (ClientCard card in cards) foreach (ClientCard card in cards)
{ {
if (card == null || card.Data == null) continue; if (card == null || card.Data == null || card.IsFacedown()) continue;
if (card.HasType(CardType.Monster) && card.Defense > highestDef) if (card.HasType(CardType.Monster) && card.Defense > highestDef)
{ {
highestDef = card.Defense; highestDef = card.Defense;
...@@ -44,7 +44,7 @@ namespace WindBot.Game.AI ...@@ -44,7 +44,7 @@ namespace WindBot.Game.AI
ClientCard selected = null; ClientCard selected = null;
foreach (ClientCard card in cards) foreach (ClientCard card in cards)
{ {
if (card == null || card.Data == null) continue; if (card == null || card.Data == null || card.IsFacedown()) continue;
if (lowestAtk == 0 && card.HasType(CardType.Monster) || if (lowestAtk == 0 && card.HasType(CardType.Monster) ||
card.HasType(CardType.Monster) && card.Attack < lowestAtk) card.HasType(CardType.Monster) && card.Attack < lowestAtk)
{ {
...@@ -61,7 +61,7 @@ namespace WindBot.Game.AI ...@@ -61,7 +61,7 @@ namespace WindBot.Game.AI
ClientCard selected = null; ClientCard selected = null;
foreach (ClientCard card in cards) foreach (ClientCard card in cards)
{ {
if (card == null || card.Data == null) continue; if (card == null || card.Data == null || card.IsFacedown()) continue;
if (lowestDef == 0 && card.HasType(CardType.Monster) || if (lowestDef == 0 && card.HasType(CardType.Monster) ||
card.HasType(CardType.Monster) && card.Defense < lowestDef) card.HasType(CardType.Monster) && card.Defense < lowestDef)
{ {
...@@ -131,36 +131,39 @@ namespace WindBot.Game.AI ...@@ -131,36 +131,39 @@ namespace WindBot.Game.AI
continue; continue;
if (card.HasType(CardType.Monster)) if (card.HasType(CardType.Monster))
cardlist.Add(card); cardlist.Add(card);
} }
return cardlist; return cardlist;
} }
public static ClientCard GetInvincibleMonster(this IEnumerable<ClientCard> cards) public static IList<ClientCard> GetFaceupPendulumMonsters(this IEnumerable<ClientCard> cards)
{ {
IList<ClientCard> cardlist = new List<ClientCard>();
foreach (ClientCard card in cards) foreach (ClientCard card in cards)
{ {
if (card != null && card.IsMonsterInvincible()) if (card == null)
return card; continue;
if (card.HasType(CardType.Monster) && card.IsFaceup() && card.HasType(CardType.Pendulum))
cardlist.Add(card);
} }
return null; return cardlist;
} }
public static ClientCard GetDangerousMonster(this IEnumerable<ClientCard> cards) public static ClientCard GetInvincibleMonster(this IEnumerable<ClientCard> cards)
{ {
foreach (ClientCard card in cards) foreach (ClientCard card in cards)
{ {
if (card != null && card.IsMonsterDangerous()) if (card != null && card.IsMonsterInvincible() && card.IsFaceup())
return card; return card;
} }
return null; return null;
} }
public static ClientCard GetNegateAttackSpell(this IEnumerable<ClientCard> cards) public static ClientCard GetDangerousMonster(this IEnumerable<ClientCard> cards)
{ {
foreach (ClientCard card in cards) foreach (ClientCard card in cards)
{ {
if (card != null && card.IsSpellNegateAttack()) if (card != null && card.IsMonsterDangerous() && card.IsFaceup())
return card; return card;
} }
return null; return null;
...@@ -170,7 +173,7 @@ namespace WindBot.Game.AI ...@@ -170,7 +173,7 @@ namespace WindBot.Game.AI
{ {
foreach (ClientCard card in cards) foreach (ClientCard card in cards)
{ {
if (card != null && card.IsFloodgate()) if (card != null && card.IsFloodgate() && card.IsFaceup())
return card; return card;
} }
return null; return null;
......
...@@ -5,21 +5,22 @@ namespace WindBot.Game.AI ...@@ -5,21 +5,22 @@ namespace WindBot.Game.AI
{ {
public static class CardExtension public static class CardExtension
{ {
/// <summary>
/// Is this monster is invincible to battle?
/// </summary>
public static bool IsMonsterInvincible(this ClientCard card) public static bool IsMonsterInvincible(this ClientCard card)
{ {
return Enum.IsDefined(typeof(InvincibleMonster), card.Id); return Enum.IsDefined(typeof(InvincibleMonster), card.Id);
} }
/// <summary>
/// Is this monster is dangerous to attack?
/// </summary>
public static bool IsMonsterDangerous(this ClientCard card) public static bool IsMonsterDangerous(this ClientCard card)
{ {
return Enum.IsDefined(typeof(DangerousMonster), card.Id); return Enum.IsDefined(typeof(DangerousMonster), card.Id);
} }
public static bool IsSpellNegateAttack(this ClientCard card)
{
return Enum.IsDefined(typeof(NegateAttackSpell), card.Id);
}
public static bool IsFloodgate(this ClientCard card) public static bool IsFloodgate(this ClientCard card)
{ {
return Enum.IsDefined(typeof(Floodgate), card.Id); return Enum.IsDefined(typeof(Floodgate), card.Id);
......
...@@ -99,10 +99,10 @@ namespace WindBot.Game.AI.Decks ...@@ -99,10 +99,10 @@ namespace WindBot.Game.AI.Decks
// special summon from extra // special summon from extra
AddExecutor(ExecutorType.SpSummon, (int)CardId.GalaxyEyesCipherDragon, GalaxyEyesCipherDragonSummon); AddExecutor(ExecutorType.SpSummon, (int)CardId.GalaxyEyesCipherDragon, GalaxyEyesCipherDragonSummon);
AddExecutor(ExecutorType.SpSummon, (int)CardId.GalaxyEyesPrimePhotonDragon, GalaxyEyesPrimePhotonDragonSumom); AddExecutor(ExecutorType.SpSummon, (int)CardId.GalaxyEyesPrimePhotonDragon, GalaxyEyesPrimePhotonDragonSummon);
AddExecutor(ExecutorType.SpSummon, (int)CardId.GalaxyEyesFullArmorPhotonDragon, GalaxyEyesFullArmorPhotonDragonSummon); AddExecutor(ExecutorType.SpSummon, (int)CardId.GalaxyEyesFullArmorPhotonDragon, GalaxyEyesFullArmorPhotonDragonSummon);
AddExecutor(ExecutorType.SpSummon, (int)CardId.GalaxyEyesCipherBladeDragon, GalaxyEyesCipherBladeDragonSummon); AddExecutor(ExecutorType.SpSummon, (int)CardId.GalaxyEyesCipherBladeDragon, GalaxyEyesCipherBladeDragonSummon);
AddExecutor(ExecutorType.SpSummon, (int)CardId.GalaxyEyesDarkMatterDragon, GalaxyEyesDarkMatterDragonSummom); AddExecutor(ExecutorType.SpSummon, (int)CardId.GalaxyEyesDarkMatterDragon, GalaxyEyesDarkMatterDragonSummon);
AddExecutor(ExecutorType.SpSummon, (int)CardId.Giganticastle, GiganticastleSummon); AddExecutor(ExecutorType.SpSummon, (int)CardId.Giganticastle, GiganticastleSummon);
AddExecutor(ExecutorType.SpSummon, (int)CardId.BlueEyesSpiritDragon, BlueEyesSpiritDragonSummon); AddExecutor(ExecutorType.SpSummon, (int)CardId.BlueEyesSpiritDragon, BlueEyesSpiritDragonSummon);
AddExecutor(ExecutorType.SpSummon, (int)CardId.HopeHarbingerDragonTitanicGalaxy, HopeHarbingerDragonTitanicGalaxySummon); AddExecutor(ExecutorType.SpSummon, (int)CardId.HopeHarbingerDragonTitanicGalaxy, HopeHarbingerDragonTitanicGalaxySummon);
...@@ -332,28 +332,7 @@ namespace WindBot.Game.AI.Decks ...@@ -332,28 +332,7 @@ namespace WindBot.Game.AI.Decks
private bool AlternativeWhiteDragonEffect() private bool AlternativeWhiteDragonEffect()
{ {
ClientCard card = Enemy.MonsterZone.GetFloodgate(); ClientCard card = AI.Utils.GetProblematicEnemyMonster(Card.GetDefensePower());
if (card != null)
{
AI.SelectCard(card);
UsedAlternativeWhiteDragon.Add(Card);
return true;
}
card = Enemy.MonsterZone.GetInvincibleMonster();
if (card != null)
{
AI.SelectCard(card);
UsedAlternativeWhiteDragon.Add(Card);
return true;
}
card = Enemy.MonsterZone.GetDangerousMonster();
if (card != null)
{
AI.SelectCard(card);
UsedAlternativeWhiteDragon.Add(Card);
return true;
}
card = AI.Utils.GetOneEnemyBetterThanValue(Card.GetDefensePower(), false);
if (card != null) if (card != null)
{ {
AI.SelectCard(card); AI.SelectCard(card);
...@@ -362,6 +341,8 @@ namespace WindBot.Game.AI.Decks ...@@ -362,6 +341,8 @@ namespace WindBot.Game.AI.Decks
} }
if (CanDealWithUsedAlternativeWhiteDragon()) if (CanDealWithUsedAlternativeWhiteDragon())
{ {
card = AI.Utils.GetBestEnemyMonster();
AI.SelectCard(card);
UsedAlternativeWhiteDragon.Add(Card); UsedAlternativeWhiteDragon.Add(Card);
return true; return true;
} }
...@@ -487,7 +468,7 @@ namespace WindBot.Game.AI.Decks ...@@ -487,7 +468,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (ActivateDescription == -1) if (ActivateDescription == -1)
{ {
ClientCard target = Enemy.SpellZone.GetFloodgate(); ClientCard target = AI.Utils.GetBestEnemySpell();
AI.SelectCard(target); AI.SelectCard(target);
return true; return true;
} }
...@@ -504,12 +485,9 @@ namespace WindBot.Game.AI.Decks ...@@ -504,12 +485,9 @@ namespace WindBot.Game.AI.Decks
&& !Bot.HasInGraveyard((int)CardId.DragonSpiritOfWhite) && !Bot.HasInGraveyard((int)CardId.DragonSpiritOfWhite)
&& !Bot.HasInGraveyard((int)CardId.WhiteDragon); && !Bot.HasInGraveyard((int)CardId.WhiteDragon);
} }
foreach (ClientCard card in Duel.ChainTargets) if (AI.Utils.IsChainTarget(Card))
{ {
if (Card.Equals(card)) return HaveEnoughWhiteDragonInHand();
{
return HaveEnoughWhiteDragonInHand();
}
} }
return false; return false;
} }
...@@ -528,13 +506,10 @@ namespace WindBot.Game.AI.Decks ...@@ -528,13 +506,10 @@ namespace WindBot.Game.AI.Decks
} }
else else
{ {
foreach (ClientCard card in Duel.ChainTargets) if (AI.Utils.IsChainTarget(Card))
{ {
if (Card.Equals(card)) AI.SelectCard((int)CardId.AzureEyesSilverDragon);
{ return true;
AI.SelectCard((int)CardId.AzureEyesSilverDragon);
return true;
}
} }
return false; return false;
} }
...@@ -638,7 +613,7 @@ namespace WindBot.Game.AI.Decks ...@@ -638,7 +613,7 @@ namespace WindBot.Game.AI.Decks
return false; return false;
} }
private bool GalaxyEyesPrimePhotonDragonSumom() private bool GalaxyEyesPrimePhotonDragonSummon()
{ {
if (Duel.Turn == 1) if (Duel.Turn == 1)
{ {
...@@ -679,7 +654,7 @@ namespace WindBot.Game.AI.Decks ...@@ -679,7 +654,7 @@ namespace WindBot.Game.AI.Decks
private bool GalaxyEyesCipherBladeDragonSummon() private bool GalaxyEyesCipherBladeDragonSummon()
{ {
if (Bot.HasInMonstersZone((int)CardId.GalaxyEyesFullArmorPhotonDragon) && AI.Utils.GetProblematicCard() != null) if (Bot.HasInMonstersZone((int)CardId.GalaxyEyesFullArmorPhotonDragon) && AI.Utils.GetProblematicEnemyCard() != null)
{ {
AI.SelectCard((int)CardId.GalaxyEyesFullArmorPhotonDragon); AI.SelectCard((int)CardId.GalaxyEyesFullArmorPhotonDragon);
return true; return true;
...@@ -687,7 +662,7 @@ namespace WindBot.Game.AI.Decks ...@@ -687,7 +662,7 @@ namespace WindBot.Game.AI.Decks
return false; return false;
} }
private bool GalaxyEyesDarkMatterDragonSummom() private bool GalaxyEyesDarkMatterDragonSummon()
{ {
if (Bot.HasInMonstersZone((int)CardId.GalaxyEyesFullArmorPhotonDragon)) if (Bot.HasInMonstersZone((int)CardId.GalaxyEyesFullArmorPhotonDragon))
{ {
...@@ -729,22 +704,22 @@ namespace WindBot.Game.AI.Decks ...@@ -729,22 +704,22 @@ namespace WindBot.Game.AI.Decks
private bool GalaxyEyesFullArmorPhotonDragonEffect() private bool GalaxyEyesFullArmorPhotonDragonEffect()
{ {
ClientCard floodgate = Enemy.SpellZone.GetFloodgate(); ClientCard target = AI.Utils.GetProblematicEnemySpell();
if (floodgate != null) if (target != null)
{ {
AI.SelectCard(floodgate); AI.SelectCard(target);
return true; return true;
} }
floodgate = Enemy.MonsterZone.GetFloodgate(); target = AI.Utils.GetProblematicEnemyMonster();
if (floodgate != null) if (target != null)
{ {
AI.SelectCard(floodgate); AI.SelectCard(target);
return true; return true;
} }
List<ClientCard> spells = Enemy.GetSpells(); List<ClientCard> spells = Enemy.GetSpells();
foreach (ClientCard spell in spells) foreach (ClientCard spell in spells)
{ {
if (!spell.IsFacedown()) if (spell.IsFaceup())
{ {
AI.SelectCard(spell); AI.SelectCard(spell);
return true; return true;
...@@ -787,7 +762,7 @@ namespace WindBot.Game.AI.Decks ...@@ -787,7 +762,7 @@ namespace WindBot.Game.AI.Decks
{ {
return true; return true;
} }
ClientCard target = AI.Utils.GetProblematicCard(); ClientCard target = AI.Utils.GetProblematicEnemyCard();
if (target != null) if (target != null)
{ {
AI.SelectCard(target); AI.SelectCard(target);
...@@ -847,8 +822,8 @@ namespace WindBot.Game.AI.Decks ...@@ -847,8 +822,8 @@ namespace WindBot.Game.AI.Decks
{ {
if (Duel.Phase != DuelPhase.Main1 || Duel.Turn == 1 || SoulChargeUsed) if (Duel.Phase != DuelPhase.Main1 || Duel.Turn == 1 || SoulChargeUsed)
return false; return false;
int bestSelfAttack = AI.Utils.GetBestAttack(Bot, false); int bestSelfAttack = AI.Utils.GetBestAttack(Bot);
int bestEnemyAttack = AI.Utils.GetBestAttack(Enemy, false); int bestEnemyAttack = AI.Utils.GetBestPower(Enemy);
return bestSelfAttack <= bestEnemyAttack && bestEnemyAttack > 2500 && bestEnemyAttack <= 3100; return bestSelfAttack <= bestEnemyAttack && bestEnemyAttack > 2500 && bestEnemyAttack <= 3100;
} }
...@@ -973,7 +948,7 @@ namespace WindBot.Game.AI.Decks ...@@ -973,7 +948,7 @@ namespace WindBot.Game.AI.Decks
private bool Repos() private bool Repos()
{ {
bool enemyBetter = AI.Utils.IsEnemyBetter(true, true); bool enemyBetter = AI.Utils.IsAllEnemyBetter(true);
if (Card.IsAttack() && enemyBetter) if (Card.IsAttack() && enemyBetter)
return true; return true;
......
...@@ -344,32 +344,30 @@ namespace WindBot.Game.AI.Decks ...@@ -344,32 +344,30 @@ namespace WindBot.Game.AI.Decks
{ {
//if (AI.Utils.IsOneEnemyBetterThanValue(2500, true)) //if (AI.Utils.IsOneEnemyBetterThanValue(2500, true))
// return true; // return true;
ClientCard invincible = AI.Utils.GetProblematicCard(); ClientCard invincible = AI.Utils.GetProblematicEnemyCard();
return invincible != null; return invincible != null;
} }
private bool ScrapDragonEffect() private bool ScrapDragonEffect()
{ {
ClientCard invincible = AI.Utils.GetProblematicCard(); ClientCard invincible = AI.Utils.GetProblematicEnemyCard();
if (invincible == null && !AI.Utils.IsOneEnemyBetterThanValue(2800 - 1, false)) if (invincible == null && !AI.Utils.IsOneEnemyBetterThanValue(2800 - 1, false))
return false; return false;
ClientField field = Bot;
int tributeId = -1; int tributeId = -1;
if (field.HasInSpellZone((int)CardId.FireFormationTenki)) if (Bot.HasInSpellZone((int)CardId.FireFormationTenki))
tributeId = (int)CardId.FireFormationTenki; tributeId = (int)CardId.FireFormationTenki;
else if (field.HasInSpellZone((int)CardId.Terraforming)) else if (Bot.HasInSpellZone((int)CardId.Terraforming))
tributeId = (int)CardId.Terraforming; tributeId = (int)CardId.Terraforming;
else if (field.HasInSpellZone((int)CardId.DragonsMirror)) else if (Bot.HasInSpellZone((int)CardId.DragonsMirror))
tributeId = (int)CardId.DragonsMirror; tributeId = (int)CardId.DragonsMirror;
else if (field.HasInSpellZone((int)CardId.CardsOfConsonance)) else if (Bot.HasInSpellZone((int)CardId.CardsOfConsonance))
tributeId = (int)CardId.CardsOfConsonance; tributeId = (int)CardId.CardsOfConsonance;
else if (field.HasInSpellZone((int)CardId.AssaultTeleport)) else if (Bot.HasInSpellZone((int)CardId.AssaultTeleport))
tributeId = (int)CardId.AssaultTeleport; tributeId = (int)CardId.AssaultTeleport;
else if (field.HasInSpellZone((int)CardId.AssaultModeActivate)) else if (Bot.HasInSpellZone((int)CardId.AssaultModeActivate))
tributeId = (int)CardId.AssaultModeActivate; tributeId = (int)CardId.AssaultModeActivate;
else if (field.HasInSpellZone((int)CardId.DragonRavine)) else if (Bot.HasInSpellZone((int)CardId.DragonRavine))
tributeId = (int)CardId.DragonRavine; tributeId = (int)CardId.DragonRavine;
List<ClientCard> monsters = Enemy.GetMonsters(); List<ClientCard> monsters = Enemy.GetMonsters();
......
...@@ -165,7 +165,7 @@ namespace WindBot.Game.AI.Decks ...@@ -165,7 +165,7 @@ namespace WindBot.Game.AI.Decks
{ {
List<int> cards = new List<int>(); List<int> cards = new List<int>();
if (AI.Utils.IsEnemyBetter(false, false)) if (AI.Utils.IsOneEnemyBetter())
{ {
cards.Add((int)CardId.FlipFlopFrog); cards.Add((int)CardId.FlipFlopFrog);
} }
......
...@@ -74,7 +74,7 @@ namespace WindBot.Game.AI.Decks ...@@ -74,7 +74,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.SpSummon, (int)CardId.EvilswarmExcitonKnight, EvilswarmExcitonKnightSummon); AddExecutor(ExecutorType.SpSummon, (int)CardId.EvilswarmExcitonKnight, EvilswarmExcitonKnightSummon);
AddExecutor(ExecutorType.Activate, (int)CardId.EvilswarmExcitonKnight, EvilswarmExcitonKnightEffect); AddExecutor(ExecutorType.Activate, (int)CardId.EvilswarmExcitonKnight, EvilswarmExcitonKnightEffect);
AddExecutor(ExecutorType.SpSummon, (int)CardId.CastelTheSkyblasterMusketeer, CastelTheSkyblasterMusketeerSummom); AddExecutor(ExecutorType.SpSummon, (int)CardId.CastelTheSkyblasterMusketeer, CastelTheSkyblasterMusketeerSummon);
AddExecutor(ExecutorType.Activate, (int)CardId.CastelTheSkyblasterMusketeer, CastelTheSkyblasterMusketeerEffect); AddExecutor(ExecutorType.Activate, (int)CardId.CastelTheSkyblasterMusketeer, CastelTheSkyblasterMusketeerEffect);
AddExecutor(ExecutorType.SpSummon, (int)CardId.ScarlightRedDragonArchfiend, ScarlightRedDragonArchfiendSummon); AddExecutor(ExecutorType.SpSummon, (int)CardId.ScarlightRedDragonArchfiend, ScarlightRedDragonArchfiendSummon);
AddExecutor(ExecutorType.Activate, (int)CardId.ScarlightRedDragonArchfiend, ScarlightRedDragonArchfiendEffect); AddExecutor(ExecutorType.Activate, (int)CardId.ScarlightRedDragonArchfiend, ScarlightRedDragonArchfiendEffect);
...@@ -249,8 +249,8 @@ namespace WindBot.Game.AI.Decks ...@@ -249,8 +249,8 @@ namespace WindBot.Game.AI.Decks
private bool ScarlightRedDragonArchfiendSummon() private bool ScarlightRedDragonArchfiendSummon()
{ {
int selfBestAttack = AI.Utils.GetBestAttack(Bot, true); int selfBestAttack = AI.Utils.GetBestAttack(Bot);
int oppoBestAttack = AI.Utils.GetBestAttack(Enemy, false); int oppoBestAttack = AI.Utils.GetBestPower(Enemy);
return (selfBestAttack <= oppoBestAttack && oppoBestAttack <= 3000) || ScarlightRedDragonArchfiendEffect(); return (selfBestAttack <= oppoBestAttack && oppoBestAttack <= 3000) || ScarlightRedDragonArchfiendEffect();
} }
...@@ -275,22 +275,22 @@ namespace WindBot.Game.AI.Decks ...@@ -275,22 +275,22 @@ namespace WindBot.Game.AI.Decks
return (oppoCount > 0 && selfCount <= oppoCount) || oppoCount > 2; return (oppoCount > 0 && selfCount <= oppoCount) || oppoCount > 2;
} }
private bool CastelTheSkyblasterMusketeerSummom() private bool CastelTheSkyblasterMusketeerSummon()
{ {
return AI.Utils.GetProblematicCard() != null; return AI.Utils.GetProblematicEnemyCard() != null;
} }
private bool CastelTheSkyblasterMusketeerEffect() private bool CastelTheSkyblasterMusketeerEffect()
{ {
if (ActivateDescription == AI.Utils.GetStringId((int)CardId.CastelTheSkyblasterMusketeer, 0)) if (ActivateDescription == AI.Utils.GetStringId((int)CardId.CastelTheSkyblasterMusketeer, 0))
return false; return false;
AI.SelectNextCard(AI.Utils.GetProblematicCard()); AI.SelectNextCard(AI.Utils.GetProblematicEnemyCard());
return true; return true;
} }
private bool NumberS39UtopiatheLightningSummon() private bool NumberS39UtopiatheLightningSummon()
{ {
return AI.Utils.IsEnemyBetter(false, false); return AI.Utils.IsOneEnemyBetter();
} }
} }
} }
\ No newline at end of file
...@@ -72,7 +72,7 @@ namespace WindBot.Game.AI.Decks ...@@ -72,7 +72,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.SummonOrSet, (int)CardId.DancePrincess, DancePrincessSummon); AddExecutor(ExecutorType.SummonOrSet, (int)CardId.DancePrincess, DancePrincessSummon);
AddExecutor(ExecutorType.MonsterSet, (int)CardId.Shurit, ShuritSet); AddExecutor(ExecutorType.MonsterSet, (int)CardId.Shurit, ShuritSet);
AddExecutor(ExecutorType.Summon, (int)CardId.ThousandHands, ThousandHandsSummom); AddExecutor(ExecutorType.Summon, (int)CardId.ThousandHands, ThousandHandsSummon);
AddExecutor(ExecutorType.Summon, (int)CardId.TenThousandHands, TenThousandHandsSummon); AddExecutor(ExecutorType.Summon, (int)CardId.TenThousandHands, TenThousandHandsSummon);
AddExecutor(ExecutorType.Summon, (int)CardId.PhantomOfChaos, PhantomOfChaosSummon); AddExecutor(ExecutorType.Summon, (int)CardId.PhantomOfChaos, PhantomOfChaosSummon);
...@@ -101,7 +101,7 @@ namespace WindBot.Game.AI.Decks ...@@ -101,7 +101,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.SpSummon, (int)CardId.EvilswarmExcitonKnight, EvilswarmExcitonKnightSummon); AddExecutor(ExecutorType.SpSummon, (int)CardId.EvilswarmExcitonKnight, EvilswarmExcitonKnightSummon);
} }
private bool ThousandHandsSummom() private bool ThousandHandsSummon()
{ {
if (!Bot.HasInHand(NekrozRituelCard) || Bot.HasInHand((int)CardId.Shurit) || !Bot.HasInHand(NekrozSpellCard)) if (!Bot.HasInHand(NekrozRituelCard) || Bot.HasInHand((int)CardId.Shurit) || !Bot.HasInHand(NekrozSpellCard))
return true; return true;
...@@ -190,7 +190,7 @@ namespace WindBot.Game.AI.Decks ...@@ -190,7 +190,7 @@ namespace WindBot.Game.AI.Decks
private bool GungnirEffect() private bool GungnirEffect()
{ {
if (AI.Utils.IsEnemyBetter(true, false) && Duel.Phase == DuelPhase.Main1) if (AI.Utils.IsOneEnemyBetter(true) && Duel.Phase == DuelPhase.Main1)
{ {
AI.SelectCard(Enemy.GetMonsters().GetHighestAttackMonster()); AI.SelectCard(Enemy.GetMonsters().GetHighestAttackMonster());
return true; return true;
......
...@@ -91,7 +91,7 @@ namespace WindBot.Game.AI.Decks ...@@ -91,7 +91,7 @@ namespace WindBot.Game.AI.Decks
if (handCard.IsFacedown()) if (handCard.IsFacedown())
return true; return true;
} }
return AI.Utils.IsEnemyBetter(true, false); return AI.Utils.IsOneEnemyBetter(true);
} }
} }
} }
\ No newline at end of file
...@@ -244,10 +244,9 @@ namespace WindBot.Game.AI.Decks ...@@ -244,10 +244,9 @@ namespace WindBot.Game.AI.Decks
if (!Card.Equals(card)) if (!Card.Equals(card))
count++; count++;
} }
foreach (ClientCard card in Bot.ExtraDeck.GetMonsters()) foreach (ClientCard card in Bot.ExtraDeck.GetFaceupPendulumMonsters())
{ {
if (card.HasType(CardType.Pendulum) && card.IsFaceup()) count++;
count++;
} }
ClientCard l = AI.Utils.GetPZone(0, 0); ClientCard l = AI.Utils.GetPZone(0, 0);
ClientCard r = AI.Utils.GetPZone(0, 1); ClientCard r = AI.Utils.GetPZone(0, 1);
...@@ -290,10 +289,9 @@ namespace WindBot.Game.AI.Decks ...@@ -290,10 +289,9 @@ namespace WindBot.Game.AI.Decks
{ {
fieldcount++; fieldcount++;
} }
foreach (ClientCard card in Bot.ExtraDeck.GetMonsters()) foreach (ClientCard card in Bot.ExtraDeck.GetFaceupPendulumMonsters())
{ {
if (card.HasType(CardType.Pendulum) && card.IsFaceup()) count++;
count++;
} }
if (count>0 && !Bot.HasInHand(LowScaleCards)) if (count>0 && !Bot.HasInHand(LowScaleCards))
{ {
...@@ -319,32 +317,12 @@ namespace WindBot.Game.AI.Decks ...@@ -319,32 +317,12 @@ namespace WindBot.Game.AI.Decks
{ {
if (Card.Location == CardLocation.Hand) if (Card.Location == CardLocation.Hand)
return false; return false;
ClientCard target = AI.Utils.GetProblematicCard(); ClientCard target = AI.Utils.GetBestEnemyCard();
if (target != null) if (target != null)
{ {
AI.SelectCard(target); AI.SelectCard(target);
return true; return true;
} }
List<ClientCard> monsters = Enemy.GetMonsters();
foreach (ClientCard monster in monsters)
{
AI.SelectCard(monster);
return true;
}
List<ClientCard> spells = Enemy.GetSpells();
foreach (ClientCard spell in spells)
{
if (spell.IsFacedown())
{
AI.SelectCard(spell);
return true;
}
}
foreach (ClientCard spell in spells)
{
AI.SelectCard(spell);
return true;
}
return false; return false;
} }
...@@ -352,18 +330,12 @@ namespace WindBot.Game.AI.Decks ...@@ -352,18 +330,12 @@ namespace WindBot.Game.AI.Decks
{ {
if (Card.Location == CardLocation.Hand) if (Card.Location == CardLocation.Hand)
return false; return false;
ClientCard target = AI.Utils.GetProblematicMonsterCard(); ClientCard target = AI.Utils.GetBestEnemyMonster();
if (target != null) if (target != null)
{ {
AI.SelectCard(target); AI.SelectCard(target);
return true; return true;
} }
List<ClientCard> monsters = Enemy.GetMonsters();
foreach (ClientCard monster in monsters)
{
AI.SelectCard(monster);
return true;
}
return false; return false;
} }
...@@ -371,26 +343,12 @@ namespace WindBot.Game.AI.Decks ...@@ -371,26 +343,12 @@ namespace WindBot.Game.AI.Decks
{ {
if (Card.Location == CardLocation.Hand) if (Card.Location == CardLocation.Hand)
return false; return false;
ClientCard target = AI.Utils.GetProblematicSpellCard(); ClientCard target = AI.Utils.GetBestEnemySpell();
if (target != null) if (target != null)
{ {
AI.SelectCard(target); AI.SelectCard(target);
return true; return true;
} }
List<ClientCard> spells = Enemy.GetSpells();
foreach (ClientCard spell in spells)
{
if (spell.IsFacedown())
{
AI.SelectCard(spell);
return true;
}
}
foreach (ClientCard spell in spells)
{
AI.SelectCard(spell);
return true;
}
return false; return false;
} }
...@@ -405,10 +363,9 @@ namespace WindBot.Game.AI.Decks ...@@ -405,10 +363,9 @@ namespace WindBot.Game.AI.Decks
{ {
count++; count++;
} }
foreach (ClientCard card in Bot.ExtraDeck.GetMonsters()) foreach (ClientCard card in Bot.ExtraDeck.GetFaceupPendulumMonsters())
{ {
if (card.HasType(CardType.Pendulum) && card.IsFaceup()) count++;
count++;
} }
return count > 1; return count > 1;
} }
......
...@@ -290,8 +290,8 @@ namespace WindBot.Game.AI.Decks ...@@ -290,8 +290,8 @@ namespace WindBot.Game.AI.Decks
private bool ScarlightRedDragonArchfiendSummon() private bool ScarlightRedDragonArchfiendSummon()
{ {
int selfBestAttack = AI.Utils.GetBestAttack(Bot, true); int selfBestAttack = AI.Utils.GetBestAttack(Bot);
int oppoBestAttack = AI.Utils.GetBestAttack(Enemy, false); int oppoBestAttack = AI.Utils.GetBestPower(Enemy);
return (selfBestAttack <= oppoBestAttack && oppoBestAttack <= 3000) || ScarlightRedDragonArchfiendEffect(); return (selfBestAttack <= oppoBestAttack && oppoBestAttack <= 3000) || ScarlightRedDragonArchfiendEffect();
} }
...@@ -319,20 +319,20 @@ namespace WindBot.Game.AI.Decks ...@@ -319,20 +319,20 @@ namespace WindBot.Game.AI.Decks
private bool CastelTheSkyblasterMusketeerSummon() private bool CastelTheSkyblasterMusketeerSummon()
{ {
return AI.Utils.GetProblematicCard() != null; return AI.Utils.GetProblematicEnemyCard() != null;
} }
private bool CastelTheSkyblasterMusketeerEffect() private bool CastelTheSkyblasterMusketeerEffect()
{ {
if (ActivateDescription == AI.Utils.GetStringId((int)CardId.CastelTheSkyblasterMusketeer, 0)) if (ActivateDescription == AI.Utils.GetStringId((int)CardId.CastelTheSkyblasterMusketeer, 0))
return false; return false;
AI.SelectNextCard(AI.Utils.GetProblematicCard()); AI.SelectNextCard(AI.Utils.GetProblematicEnemyCard());
return true; return true;
} }
private bool IgnisterProminenceTheBlastingDracoslayerSummon() private bool IgnisterProminenceTheBlastingDracoslayerSummon()
{ {
return AI.Utils.GetProblematicCard() != null; return AI.Utils.GetProblematicEnemyCard() != null;
} }
private bool IgnisterProminenceTheBlastingDracoslayerEffect() private bool IgnisterProminenceTheBlastingDracoslayerEffect()
...@@ -340,7 +340,7 @@ namespace WindBot.Game.AI.Decks ...@@ -340,7 +340,7 @@ namespace WindBot.Game.AI.Decks
if (ActivateDescription == AI.Utils.GetStringId((int)CardId.IgnisterProminenceTheBlastingDracoslayer, 1)) if (ActivateDescription == AI.Utils.GetStringId((int)CardId.IgnisterProminenceTheBlastingDracoslayer, 1))
return true; return true;
ClientCard target1 = null; ClientCard target1 = null;
ClientCard target2 = AI.Utils.GetProblematicCard(); ClientCard target2 = AI.Utils.GetProblematicEnemyCard();
List<ClientCard> spells = Enemy.GetSpells(); List<ClientCard> spells = Enemy.GetSpells();
foreach (ClientCard spell in spells) foreach (ClientCard spell in spells)
{ {
...@@ -409,19 +409,19 @@ namespace WindBot.Game.AI.Decks ...@@ -409,19 +409,19 @@ namespace WindBot.Game.AI.Decks
} }
} }
return AI.Utils.GetProblematicCard() != null; return AI.Utils.GetProblematicEnemyCard() != null;
} }
private bool LightningChidoriEffect() private bool LightningChidoriEffect()
{ {
ClientCard problematicCard = AI.Utils.GetProblematicCard(); ClientCard problematicCard = AI.Utils.GetProblematicEnemyCard();
AI.SelectNextCard(problematicCard); AI.SelectNextCard(problematicCard);
return true; return true;
} }
private bool StardustDragonSummon() private bool StardustDragonSummon()
{ {
return (AI.Utils.IsEnemyBetter(false, false) && !AI.Utils.IsOneEnemyBetterThanValue(2400, true)) || AI.Utils.IsTurn1OrMain2(); return (AI.Utils.IsOneEnemyBetter() && !AI.Utils.IsOneEnemyBetterThanValue(2400, true)) || AI.Utils.IsTurn1OrMain2();
} }
private bool StardustDragonEffect() private bool StardustDragonEffect()
...@@ -457,18 +457,15 @@ namespace WindBot.Game.AI.Decks ...@@ -457,18 +457,15 @@ namespace WindBot.Game.AI.Decks
private bool Number59CrookedCookSummon() private bool Number59CrookedCookSummon()
{ {
return ((Bot.GetMonsterCount() + Bot.GetSpellCount() - 2) <= 1) && return ((Bot.GetMonsterCount() + Bot.GetSpellCount() - 2) <= 1) &&
((AI.Utils.IsEnemyBetter(false, false) && !AI.Utils.IsOneEnemyBetterThanValue(2300, true)) || AI.Utils.IsTurn1OrMain2()); ((AI.Utils.IsOneEnemyBetter() && !AI.Utils.IsOneEnemyBetterThanValue(2300, true)) || AI.Utils.IsTurn1OrMain2());
} }
private bool Number59CrookedCookEffect() private bool Number59CrookedCookEffect()
{ {
if (Duel.Player == 0) if (Duel.Player == 0)
{ {
foreach (ClientCard card in Duel.ChainTargets) if (AI.Utils.IsChainTarget(Card))
{ return true;
if (Card.Equals(card))
return true;
}
} }
else else
{ {
...@@ -501,7 +498,7 @@ namespace WindBot.Game.AI.Decks ...@@ -501,7 +498,7 @@ namespace WindBot.Game.AI.Decks
private bool NumberS39UtopiatheLightningSummon() private bool NumberS39UtopiatheLightningSummon()
{ {
return AI.Utils.IsEnemyBetter(false, false); return AI.Utils.IsOneEnemyBetter(true);
} }
private bool TrapSet() private bool TrapSet()
......
...@@ -276,9 +276,7 @@ namespace WindBot.Game.AI.Decks ...@@ -276,9 +276,7 @@ namespace WindBot.Game.AI.Decks
private bool Number61VolcasaurusEffect() private bool Number61VolcasaurusEffect()
{ {
ClientCard target = Enemy.MonsterZone.GetFloodgate(); ClientCard target = AI.Utils.GetProblematicEnemyMonster(2000);
if (target == null)
target = AI.Utils.GetOneEnemyBetterThanValue(2000, false);
if (target != null) if (target != null)
{ {
AI.SelectCard((int)CardId.CyberDragon); AI.SelectCard((int)CardId.CyberDragon);
...@@ -291,7 +289,7 @@ namespace WindBot.Game.AI.Decks ...@@ -291,7 +289,7 @@ namespace WindBot.Game.AI.Decks
private bool TirasKeeperOfGenesisEffect() private bool TirasKeeperOfGenesisEffect()
{ {
ClientCard target = AI.Utils.GetProblematicCard(); ClientCard target = AI.Utils.GetProblematicEnemyCard();
if (target != null) if (target != null)
{ {
AI.SelectCard(target); AI.SelectCard(target);
...@@ -346,32 +344,12 @@ namespace WindBot.Game.AI.Decks ...@@ -346,32 +344,12 @@ namespace WindBot.Game.AI.Decks
private bool PanzerDragonEffect() private bool PanzerDragonEffect()
{ {
ClientCard target = AI.Utils.GetProblematicCard(); ClientCard target = AI.Utils.GetBestEnemyCard();
if (target != null) if (target != null)
{ {
AI.SelectCard(target); AI.SelectCard(target);
return true; return true;
} }
List<ClientCard> monsters = Enemy.GetMonsters();
foreach (ClientCard monster in monsters)
{
AI.SelectCard(monster);
return true;
}
List<ClientCard> spells = Enemy.GetSpells();
foreach (ClientCard spell in spells)
{
if (spell.IsFacedown())
{
AI.SelectCard(spell);
return true;
}
}
foreach (ClientCard spell in spells)
{
AI.SelectCard(spell);
return true;
}
return false; return false;
} }
......
...@@ -189,7 +189,7 @@ namespace WindBot.Game.AI.Decks ...@@ -189,7 +189,7 @@ namespace WindBot.Game.AI.Decks
private bool MindControlEffect() private bool MindControlEffect()
{ {
ClientCard target = AI.Utils.GetAnyEnemyMonster(); ClientCard target = AI.Utils.GetBestEnemyMonster();
if (target != null) if (target != null)
{ {
AI.SelectCard(target); AI.SelectCard(target);
...@@ -470,8 +470,8 @@ namespace WindBot.Game.AI.Decks ...@@ -470,8 +470,8 @@ namespace WindBot.Game.AI.Decks
private bool LinkSummon() private bool LinkSummon()
{ {
return (AI.Utils.IsTurn1OrMain2() || AI.Utils.IsEnemyBetter(false, false)) return (AI.Utils.IsTurn1OrMain2() || AI.Utils.IsOneEnemyBetter())
&& AI.Utils.GetBestAttack(Bot, true) < Card.Attack; && AI.Utils.GetBestAttack(Bot) < Card.Attack;
} }
} }
} }
\ No newline at end of file
...@@ -426,7 +426,7 @@ namespace WindBot.Game.AI.Decks ...@@ -426,7 +426,7 @@ namespace WindBot.Game.AI.Decks
private bool CatSharkSummon() private bool CatSharkSummon()
{ {
bool should = Bot.HasInMonstersZone((int)CardId.ToadallyAwesome) bool should = Bot.HasInMonstersZone((int)CardId.ToadallyAwesome)
&& ((AI.Utils.IsEnemyBetter(true, false) && ((AI.Utils.IsOneEnemyBetter(true)
&& !Bot.HasInMonstersZone(new List<int> && !Bot.HasInMonstersZone(new List<int>
{ {
(int)CardId.CatShark, (int)CardId.CatShark,
...@@ -485,8 +485,8 @@ namespace WindBot.Game.AI.Decks ...@@ -485,8 +485,8 @@ namespace WindBot.Game.AI.Decks
num++; num++;
} }
} }
return AI.Utils.IsEnemyBetter(true, false) return AI.Utils.IsOneEnemyBetter(true)
&& AI.Utils.GetBestAttack(Enemy, true) > 2200 && AI.Utils.GetBestAttack(Enemy) > 2200
&& num < 4 && num < 4
&& !Bot.HasInMonstersZone(new List<int> && !Bot.HasInMonstersZone(new List<int>
{ {
...@@ -513,7 +513,7 @@ namespace WindBot.Game.AI.Decks ...@@ -513,7 +513,7 @@ namespace WindBot.Game.AI.Decks
{ {
defence += monster.GetDefensePower(); defence += monster.GetDefensePower();
} }
if (attack - 2000 - defence > Duel.LifePoints[1] && !AI.Utils.IsEnemyBetter(true, false)) if (attack - 2000 - defence > Duel.LifePoints[1] && !AI.Utils.IsOneEnemyBetter(true))
return true; return true;
} }
return false; return false;
...@@ -527,7 +527,7 @@ namespace WindBot.Game.AI.Decks ...@@ -527,7 +527,7 @@ namespace WindBot.Game.AI.Decks
private bool Repos() private bool Repos()
{ {
bool enemyBetter = AI.Utils.IsEnemyBetter(true, true); bool enemyBetter = AI.Utils.IsAllEnemyBetter(true);
if (Card.IsFacedown()) if (Card.IsFacedown())
return true; return true;
......
...@@ -314,14 +314,14 @@ namespace WindBot.Game.AI.Decks ...@@ -314,14 +314,14 @@ namespace WindBot.Game.AI.Decks
private bool DarkRebellionXyzDragonSummon() private bool DarkRebellionXyzDragonSummon()
{ {
int selfBestAttack = AI.Utils.GetBestAttack(Bot, true); int selfBestAttack = AI.Utils.GetBestAttack(Bot);
int oppoBestAttack = AI.Utils.GetBestAttack(Enemy, true); int oppoBestAttack = AI.Utils.GetBestAttack(Enemy);
return selfBestAttack <= oppoBestAttack; return selfBestAttack <= oppoBestAttack;
} }
private bool DarkRebellionXyzDragonEffect() private bool DarkRebellionXyzDragonEffect()
{ {
int oppoBestAttack = AI.Utils.GetBestAttack(Enemy, true); int oppoBestAttack = AI.Utils.GetBestAttack(Enemy);
ClientCard target = AI.Utils.GetOneEnemyBetterThanValue(oppoBestAttack, true); ClientCard target = AI.Utils.GetOneEnemyBetterThanValue(oppoBestAttack, true);
if (target != null) if (target != null)
{ {
...@@ -332,8 +332,8 @@ namespace WindBot.Game.AI.Decks ...@@ -332,8 +332,8 @@ namespace WindBot.Game.AI.Decks
private bool NumberS39UtopiatheLightningSummon() private bool NumberS39UtopiatheLightningSummon()
{ {
int selfBestAttack = AI.Utils.GetBestAttack(Bot, true); int selfBestAttack = AI.Utils.GetBestAttack(Bot);
int oppoBestAttack = AI.Utils.GetBestAttack(Enemy, false); int oppoBestAttack = AI.Utils.GetBestPower(Enemy);
return selfBestAttack <= oppoBestAttack; return selfBestAttack <= oppoBestAttack;
} }
......
...@@ -90,9 +90,9 @@ namespace WindBot.Game.AI.Decks ...@@ -90,9 +90,9 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.SpSummon, (int)CardId.Drident, DridentSummon); AddExecutor(ExecutorType.SpSummon, (int)CardId.Drident, DridentSummon);
AddExecutor(ExecutorType.Summon, (int)CardId.Ratpier); AddExecutor(ExecutorType.Summon, (int)CardId.Ratpier);
AddExecutor(ExecutorType.Activate, (int)CardId.Ratpier, Ratpier); AddExecutor(ExecutorType.Activate, (int)CardId.Ratpier, RatpierEffect);
AddExecutor(ExecutorType.Summon, (int)CardId.Thoroughblade); AddExecutor(ExecutorType.Summon, (int)CardId.Thoroughblade);
AddExecutor(ExecutorType.Activate, (int)CardId.Thoroughblade, Ratpier); AddExecutor(ExecutorType.Activate, (int)CardId.Thoroughblade, RatpierEffect);
AddExecutor(ExecutorType.Summon, (int)CardId.AleisterTheInvoker); AddExecutor(ExecutorType.Summon, (int)CardId.AleisterTheInvoker);
AddExecutor(ExecutorType.Activate, (int)CardId.AleisterTheInvoker, AleisterTheInvokerEffect); AddExecutor(ExecutorType.Activate, (int)CardId.AleisterTheInvoker, AleisterTheInvokerEffect);
...@@ -151,8 +151,8 @@ namespace WindBot.Game.AI.Decks ...@@ -151,8 +151,8 @@ namespace WindBot.Game.AI.Decks
private bool NumberS39UtopiatheLightningSummon() private bool NumberS39UtopiatheLightningSummon()
{ {
int selfBestAttack = AI.Utils.GetBestAttack(Bot, true); int selfBestAttack = AI.Utils.GetBestAttack(Bot);
int oppoBestAttack = AI.Utils.GetBestAttack(Enemy, false); int oppoBestAttack = AI.Utils.GetBestPower(Enemy);
return selfBestAttack < oppoBestAttack; return selfBestAttack < oppoBestAttack;
} }
...@@ -172,7 +172,7 @@ namespace WindBot.Game.AI.Decks ...@@ -172,7 +172,7 @@ namespace WindBot.Game.AI.Decks
|| Duel.Phase == DuelPhase.Damage)) || Duel.Phase == DuelPhase.Damage))
return false; return false;
return Duel.Player==0 return Duel.Player==0
|| AI.Utils.IsEnemyBetter(false, false); || AI.Utils.IsOneEnemyBetter();
} }
return true; return true;
} }
...@@ -486,7 +486,7 @@ namespace WindBot.Game.AI.Decks ...@@ -486,7 +486,7 @@ namespace WindBot.Game.AI.Decks
return true; return true;
} }
private bool Ratpier() private bool RatpierEffect()
{ {
AI.SelectCard(new[] AI.SelectCard(new[]
{ {
...@@ -501,46 +501,7 @@ namespace WindBot.Game.AI.Decks ...@@ -501,46 +501,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (LastChainPlayer == 0) if (LastChainPlayer == 0)
return false; return false;
ClientCard target = AI.Utils.GetProblematicCard(); ClientCard target = AI.Utils.GetBestEnemyCard(true);
if (target == null)
{
List<ClientCard> monsters = Enemy.GetMonsters();
foreach (ClientCard monster in monsters)
{
if (monster.IsFaceup())
{
target=monster;
break;
}
}
}
if (target == null)
{
List<ClientCard> spells = Enemy.GetSpells();
foreach (ClientCard spell in spells)
{
if (spell.IsFaceup() && spell.IsSpellNegateAttack())
{
target = spell;
break;
}
}
}
if (target == null)
{
List<ClientCard> spells = Enemy.GetSpells();
foreach (ClientCard spell in spells)
{
if (spell.IsFaceup() && (spell.HasType(CardType.Continuous)
|| spell.HasType(CardType.Equip)
|| spell.HasType(CardType.Field)
|| spell.HasType(CardType.Pendulum)))
{
target = spell;
break;
}
}
}
if (target == null) if (target == null)
return false; return false;
AI.SelectCard(new[] AI.SelectCard(new[]
......
...@@ -124,7 +124,7 @@ namespace WindBot.Game.AI ...@@ -124,7 +124,7 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool DefaultBookOfMoon() protected bool DefaultBookOfMoon()
{ {
if (AI.Utils.IsEnemyBetter(true, true)) if (AI.Utils.IsAllEnemyBetter(true))
{ {
ClientCard monster = Enemy.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))
...@@ -141,22 +141,19 @@ namespace WindBot.Game.AI ...@@ -141,22 +141,19 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool DefaultCompulsoryEvacuationDevice() protected bool DefaultCompulsoryEvacuationDevice()
{ {
ClientCard target = AI.Utils.GetProblematicMonsterCard(); ClientCard target = AI.Utils.GetProblematicEnemyMonster();
if (target != null) if (target != null)
{ {
AI.SelectCard(target); AI.SelectCard(target);
return true; return true;
} }
foreach (ClientCard card in Duel.ChainTargets) if (AI.Utils.IsChainTarget(Card))
{ {
if (Card.Equals(card)) ClientCard monster = AI.Utils.GetBestEnemyMonster();
if (monster != null)
{ {
ClientCard monster = AI.Utils.GetAnyEnemyMonster(); AI.SelectCard(monster);
if (monster != null) return true;
{
AI.SelectCard(monster);
return true;
}
} }
} }
return false; return false;
...@@ -167,7 +164,7 @@ namespace WindBot.Game.AI ...@@ -167,7 +164,7 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool DefaultCallOfTheHaunted() protected bool DefaultCallOfTheHaunted()
{ {
if (!AI.Utils.IsEnemyBetter(true, true)) if (!AI.Utils.IsAllEnemyBetter(true))
return false; return false;
ClientCard selected = null; ClientCard selected = null;
int BestAtk = 0; int BestAtk = 0;
...@@ -201,7 +198,7 @@ namespace WindBot.Game.AI ...@@ -201,7 +198,7 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool DefaultSolemnJudgment() protected bool DefaultSolemnJudgment()
{ {
return !(Duel.ChainTargets.Count == 1 && Card.Equals(Duel.ChainTargets[0])) && !(Duel.Player == 0 && LastChainPlayer == -1) && DefaultTrap(); return !AI.Utils.IsChainTargetOnly(Card) && !(Duel.Player == 0 && LastChainPlayer == -1) && DefaultTrap();
} }
/// <summary> /// <summary>
...@@ -225,7 +222,7 @@ namespace WindBot.Game.AI ...@@ -225,7 +222,7 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool DefaultTorrentialTribute() protected bool DefaultTorrentialTribute()
{ {
return !HasChainedTrap(0) && AI.Utils.IsEnemyBetter(true, true); return !HasChainedTrap(0) && AI.Utils.IsAllEnemyBetter(true);
} }
/// <summary> /// <summary>
...@@ -249,7 +246,7 @@ namespace WindBot.Game.AI ...@@ -249,7 +246,7 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool DefaultHammerShot() protected bool DefaultHammerShot()
{ {
return AI.Utils.IsEnemyBetter(true, false); return AI.Utils.IsOneEnemyBetter(true);
} }
/// <summary> /// <summary>
...@@ -257,7 +254,7 @@ namespace WindBot.Game.AI ...@@ -257,7 +254,7 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool DefaultDarkHole() protected bool DefaultDarkHole()
{ {
return AI.Utils.IsEnemyBetter(false, false); return AI.Utils.IsOneEnemyBetter();
} }
/// <summary> /// <summary>
...@@ -265,7 +262,7 @@ namespace WindBot.Game.AI ...@@ -265,7 +262,7 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool DefaultRaigeki() protected bool DefaultRaigeki()
{ {
return AI.Utils.IsEnemyBetter(false, false); return AI.Utils.IsOneEnemyBetter();
} }
/// <summary> /// <summary>
...@@ -273,7 +270,7 @@ namespace WindBot.Game.AI ...@@ -273,7 +270,7 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool DefaultSmashingGround() protected bool DefaultSmashingGround()
{ {
return AI.Utils.IsEnemyBetter(false, false); return AI.Utils.IsOneEnemyBetter();
} }
/// <summary> /// <summary>
...@@ -328,7 +325,7 @@ namespace WindBot.Game.AI ...@@ -328,7 +325,7 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool DefaultMonsterRepos() protected bool DefaultMonsterRepos()
{ {
bool enemyBetter = AI.Utils.IsEnemyBetter(true, true); bool enemyBetter = AI.Utils.IsAllEnemyBetter(true);
if (Card.IsAttack() && enemyBetter) if (Card.IsAttack() && enemyBetter)
return true; return true;
...@@ -476,13 +473,10 @@ namespace WindBot.Game.AI ...@@ -476,13 +473,10 @@ namespace WindBot.Game.AI
return true; return true;
} }
} }
foreach (ClientCard card in Duel.ChainTargets) if (AI.Utils.IsChainTarget(Card))
{ {
if (Card.Equals(card)) AI.SelectOption(XYZ);
{ return true;
AI.SelectOption(XYZ);
return true;
}
} }
return false; return false;
} }
...@@ -552,7 +546,7 @@ namespace WindBot.Game.AI ...@@ -552,7 +546,7 @@ namespace WindBot.Game.AI
AI.SelectCard(card); AI.SelectCard(card);
return true; return true;
} }
card = AI.Utils.GetOneEnemyBetterThanValue(Card.GetDefensePower(), false); card = AI.Utils.GetOneEnemyBetterThanValue(Card.GetDefensePower());
if (card != null) if (card != null)
{ {
AI.SelectCard(card); AI.SelectCard(card);
......
namespace WindBot.Game.AI.Enums namespace WindBot.Game.AI.Enums
{ {
/// <summary>
/// Cards that are dangerous to attack.
/// </summary>
public enum DangerousMonster public enum DangerousMonster
{ {
LionHeart = 54366836, LionHeart = 54366836,
Yubel = 78371393, Yubel = 78371393,
YubelIncarnate = 4779091, YubelIncarnate = 4779091,
YubelNightmare = 31764700, YubelNightmare = 31764700,
MetaionTheTimelord = 74530899, MetaionTheTimelord = 74530899
Number39Utopia = 84013237,
NumberS39UtopiatheLightning = 56832966
} }
} }
namespace WindBot.Game.AI.Enums namespace WindBot.Game.AI.Enums
{ {
/// <summary>
/// Cards that restrict player from performing some action. Bot will preferentially destroy them.
/// </summary>
public enum Floodgate public enum Floodgate
{ {
BarrierStatueoftheTorrent = 10963799, BarrierStatueoftheTorrent = 10963799,
...@@ -24,11 +27,13 @@ ...@@ -24,11 +27,13 @@
LevelLimitAreaB = 3136426, LevelLimitAreaB = 3136426,
DimensionalFissure = 81674782, DimensionalFissure = 81674782,
Necrovalley = 47355498, Necrovalley = 47355498,
SavageColosseum = 32391631,
SecretVillageoftheSpellcasters = 68462976, SecretVillageoftheSpellcasters = 68462976,
SwordsofRevealingLight = 72302403, SwordsofRevealingLight = 72302403,
MessengerofPeace = 44656491, MessengerofPeace = 44656491,
KaiserColosseum = 35059553, KaiserColosseum = 35059553,
DomainoftheTrueMonarchs = 84171830, DomainoftheTrueMonarchs = 84171830,
ZombieWorld = 4064256,
ImperialOrder = 61740673, ImperialOrder = 61740673,
MacroCosmos = 30241314, MacroCosmos = 30241314,
MindDrain = 68937720, MindDrain = 68937720,
...@@ -41,6 +46,7 @@ ...@@ -41,6 +46,7 @@
LightImprisoningMirror = 53341729, LightImprisoningMirror = 53341729,
ShadowImprisoningMirror = 99735427, ShadowImprisoningMirror = 99735427,
WallofRevealingLight = 17078030, WallofRevealingLight = 17078030,
GravityBind = 85742772,
VanitysEmptiness = 5851097, VanitysEmptiness = 5851097,
Lose1Turn = 24348804, Lose1Turn = 24348804,
Reqliate = 20426907, Reqliate = 20426907,
......
namespace WindBot.Game.AI.Enums namespace WindBot.Game.AI.Enums
{ {
/// <summary>
/// Cards that are invincible to battle.
/// </summary>
public enum InvincibleMonster public enum InvincibleMonster
{ {
SpiritReaper = 23205979, SpiritReaper = 23205979,
......
namespace WindBot.Game.AI.Enums
{
public enum NegateAttackSpell
{
MessengerOfPeace = 44656491,
SavageColosseum = 32391631,
GravityBind = 85742772,
LevelLimitAreaB = 3136426
}
}
namespace WindBot.Game.AI.Enums
{
public enum NegatesEffects
{
SkillDrain = 82732705,
SoulDrain = 73599290
}
}
namespace WindBot.Game.AI.Enums
{
public enum NegatesSpells
{
HorusLv6 = 11224103,
HorusLv8 = 48229808
}
}
namespace WindBot.Game.AI.Enums
{
public enum NegatesSummons
{
Necrovalley = 47355498,
ImperialIronWall = 30459350,
ZombieWorld = 4064256,
DnaSurgery = 74701381,
MacroCosmos = 30241314,
DimensionalFissure = 81674782
}
}
namespace WindBot.Game.AI.Enums
{
public enum NegatesTraps
{
Jinzo = 77585513,
RoyalDecree = 51452091
}
}
...@@ -304,7 +304,7 @@ namespace WindBot.Game ...@@ -304,7 +304,7 @@ namespace WindBot.Game
} }
if (ShouldExecute(exec, card, ExecutorType.SummonOrSet)) if (ShouldExecute(exec, card, ExecutorType.SummonOrSet))
{ {
if (Utils.IsEnemyBetter(true, true) && Utils.IsAllEnemyBetterThanValue(card.Attack + 300, false) && if (Utils.IsAllEnemyBetter(true) && Utils.IsAllEnemyBetterThanValue(card.Attack + 300, false) &&
main.MonsterSetableCards.Contains(card)) main.MonsterSetableCards.Contains(card))
{ {
_dialogs.SendSetMonster(); _dialogs.SendSetMonster();
......
...@@ -125,4 +125,6 @@ The parameters are same as commandlines, but low cased. ...@@ -125,4 +125,6 @@ The parameters are same as commandlines, but low cased.
* Better new master rule support * Better new master rule support
* Update the known card enums
* More default common cards executor * More default common cards executor
...@@ -114,11 +114,6 @@ ...@@ -114,11 +114,6 @@
<Compile Include="Game\AI\Enums\OneForXyz.cs" /> <Compile Include="Game\AI\Enums\OneForXyz.cs" />
<Compile Include="Game\AI\Enums\InvincibleMonster.cs" /> <Compile Include="Game\AI\Enums\InvincibleMonster.cs" />
<Compile Include="Game\AI\Enums\Floodgate.cs" /> <Compile Include="Game\AI\Enums\Floodgate.cs" />
<Compile Include="Game\AI\Enums\NegateAttackSpell.cs" />
<Compile Include="Game\AI\Enums\NegatesEffects.cs" />
<Compile Include="Game\AI\Enums\NegatesSpells.cs" />
<Compile Include="Game\AI\Enums\NegatesSummons.cs" />
<Compile Include="Game\AI\Enums\NegatesTraps.cs" />
<Compile Include="Game\AI\Executor.cs" /> <Compile Include="Game\AI\Executor.cs" />
<Compile Include="Game\AI\ExecutorType.cs" /> <Compile Include="Game\AI\ExecutorType.cs" />
<Compile Include="Game\BattlePhase.cs" /> <Compile Include="Game\BattlePhase.cs" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment