Commit bff848b5 authored by jwyxym's avatar jwyxym Committed by GitHub

Update AutoChessExecutor.cs

parent 967694d3
...@@ -96,9 +96,24 @@ namespace WindBot.Game.AI.Decks ...@@ -96,9 +96,24 @@ namespace WindBot.Game.AI.Decks
}; };
//非常愚蠢的穷举函数 //非常愚蠢的穷举函数
private bool BlackmailAttackerSunmmon(int cardId)//黑手!(其实是碰瓷) private bool BlackmailAttackerSunmmon(ClientCard card)//黑手!(其实是碰瓷)
{
int[] cardsname = new[] {34031284, 35494087, 54366836, 94004268, 97403510, 59627393, 93730230, 69058960, 95442074, 24874631};
foreach(int cardname in cardsname)
{
if (card.Id == cardname) return true;
}
if ((card.HasSetcode(0x10) && GetZoneCards(CardLocation.MonsterZone, Bot).Any(scard => scard != null && scard.Id == 29552709 && scard.IsFaceup() && !scard.IsDisabled()) && Duel.Player == 0) || card.HasSetcode(0x2a) || card.HasSetcode(0x1a5) || card.HasSetcode(0x18d) || card.HasSetcode(0x4a))
return true;
return false;
}
private bool BlackmailAttackerSunmmon2(int cardId)
{ {
YGOSharp.OCGWrapper.NamedCard card = YGOSharp.OCGWrapper.NamedCard.Get(cardId); YGOSharp.OCGWrapper.NamedCard card = YGOSharp.OCGWrapper.NamedCard.Get(cardId);
if (card == null) return false;
int[] cardsname = new[] {34031284, 35494087, 54366836, 94004268, 97403510, 59627393, 93730230, 69058960, 95442074, 24874631}; int[] cardsname = new[] {34031284, 35494087, 54366836, 94004268, 97403510, 59627393, 93730230, 69058960, 95442074, 24874631};
foreach(int cardname in cardsname) foreach(int cardname in cardsname)
{ {
...@@ -139,9 +154,8 @@ namespace WindBot.Game.AI.Decks ...@@ -139,9 +154,8 @@ namespace WindBot.Game.AI.Decks
} }
private bool DontSummon(int cardId)//别通召这些 private bool DontSummon(ClientCard card)//别通召这些
{ {
YGOSharp.OCGWrapper.NamedCard card = YGOSharp.OCGWrapper.NamedCard.Get(cardId);
if (card.HasSetcode(0x40) || card.HasSetcode(0xa4) || card.HasSetcode(0xd3)) return true; if (card.HasSetcode(0x40) || card.HasSetcode(0xa4) || card.HasSetcode(0xd3)) return true;
int[] cardsname = new[] {74762582, 90179822, 16759958, 26964762, 42352091, 2511, 74018812, 76214441, 62886670, 69105797, 32391566, 94076521, 73625877, 1980574, 42090294, 68823957, 34976176, 89785779, 76133574, 3248469, 87102774 int[] cardsname = new[] {74762582, 90179822, 16759958, 26964762, 42352091, 2511, 74018812, 76214441, 62886670, 69105797, 32391566, 94076521, 73625877, 1980574, 42090294, 68823957, 34976176, 89785779, 76133574, 3248469, 87102774
, 57647597, 37961969, 51993760, 87988305, 38339996, 37629703, 58131925, 71133680, 42790071, 34475451, 63009228, 24725825, 48427163, 86028783, 51852507, 29280589, 87462901, 73640163, 68120130, 84813516, 55461064, 59042331, 26775203, 89169343 , 57647597, 37961969, 51993760, 87988305, 38339996, 37629703, 58131925, 71133680, 42790071, 34475451, 63009228, 24725825, 48427163, 86028783, 51852507, 29280589, 87462901, 73640163, 68120130, 84813516, 55461064, 59042331, 26775203, 89169343
...@@ -154,21 +168,32 @@ namespace WindBot.Game.AI.Decks ...@@ -154,21 +168,32 @@ namespace WindBot.Game.AI.Decks
}; };
foreach(int cardname in cardsname) foreach(int cardname in cardsname)
{ {
if (cardId == cardname) return true; if (card.Id == cardname) return true;
} }
return false; return false;
} }
private bool FilpMonster(int cardId)//反转 private bool FilpMonster(ClientCard card)//反转
{ {
YGOSharp.OCGWrapper.NamedCard card = YGOSharp.OCGWrapper.NamedCard.Get(cardId);
if (card.HasType(CardType.Flip)) return true; if (card.HasType(CardType.Flip)) return true;
int[] cardsname = new[] {20073910, 89707961, 41753322, 86346363, 75421661, 87483942, 40659562, 41039846, 72370114, 92693205, 22134079, 16509093, 96352326, 923596, 47111934, 81306586, 26016357, 52323207, 64804316, 75209824, 71071546, 92736188, 16279989, 97584500, 72913666, 71415349, 51196805, 85463083, 41872150, 75109441, 3510565, 15383415, 2326738, 80885284, 84472026, 93294869, 27491571, 54490275, 36239585, 2694423, 81278754, 24101897, 46925518, 99641328, 61318483, 54512827, 81907872, 98707192 int[] cardsname = new[] {20073910, 89707961, 41753322, 86346363, 75421661, 87483942, 40659562, 41039846, 72370114, 92693205, 22134079, 16509093, 96352326, 923596, 47111934, 81306586, 26016357, 52323207, 64804316, 75209824, 71071546, 92736188, 16279989, 97584500, 72913666, 71415349, 51196805, 85463083, 41872150, 75109441, 3510565, 15383415, 2326738, 80885284, 84472026, 93294869, 27491571, 54490275, 36239585, 2694423, 81278754, 24101897, 46925518, 99641328, 61318483, 54512827, 81907872, 98707192
}; };
foreach(int cardname in cardsname) foreach(int cardname in cardsname)
{ {
if (cardId == cardname) return true; if (card.Id == cardname) return true;
}
return false;
}
private bool EquipForEnemy(ClientCard card)//装备给对手
{
int[] cardsname = new[] {33453260, 79912449, 32919136, 45986603, 45247637, 44092304, 46967601, 94303232, 56948373, 69954399, 83584898, 62472614, 75560629, 23842445, 24668830, 98867329, 50152549, 62472614
};
foreach(int cardname in cardsname)
{
if (card.Id == cardname) return true;
} }
return false; return false;
...@@ -362,7 +387,7 @@ namespace WindBot.Game.AI.Decks ...@@ -362,7 +387,7 @@ namespace WindBot.Game.AI.Decks
} }
return false; return false;
} }
else if (Card.Id == 6203182 || Card.Id == 69954399 || Card.Id == 33453260) else if (EquipForEnemy(Card))
{ {
cards = GetZoneCards(CardLocation.MonsterZone, Enemy).Where(card => card != null && card.IsFaceup() && !card.IsShouldNotBeTarget()).ToList(); cards = GetZoneCards(CardLocation.MonsterZone, Enemy).Where(card => card != null && card.IsFaceup() && !card.IsShouldNotBeTarget()).ToList();
if (cards.Count() > 0) if (cards.Count() > 0)
...@@ -502,8 +527,10 @@ namespace WindBot.Game.AI.Decks ...@@ -502,8 +527,10 @@ namespace WindBot.Game.AI.Decks
YGOSharp.OCGWrapper.NamedCard cardData = YGOSharp.OCGWrapper.NamedCard.Get(cardId); YGOSharp.OCGWrapper.NamedCard cardData = YGOSharp.OCGWrapper.NamedCard.Get(cardId);
if (cardData != null) if (cardData != null)
{ {
if (BlackmailAttackerSunmmon(cardId)) if (BlackmailAttackerSunmmon2(cardId))
return CardPosition.FaceUpAttack; return CardPosition.FaceUpAttack;
else if (Duel.Player == 1 && Duel.Phase == DuelPhase.Battle)
return CardPosition.FaceUpDefence;
if (Bot.LifePoints <= 1500) if (Bot.LifePoints <= 1500)
{ {
...@@ -586,7 +613,7 @@ namespace WindBot.Game.AI.Decks ...@@ -586,7 +613,7 @@ namespace WindBot.Game.AI.Decks
private bool MonsterRepos() private bool MonsterRepos()
{ {
if (Duel.Phase == DuelPhase.Main1 && (FilpMonster(Card.Id)) && Card.IsFacedown()) if (Duel.Phase == DuelPhase.Main1 && (FilpMonster(Card)) && Card.IsFacedown())
{ {
return true; return true;
} }
...@@ -615,12 +642,12 @@ namespace WindBot.Game.AI.Decks ...@@ -615,12 +642,12 @@ namespace WindBot.Game.AI.Decks
} }
private bool MonsterSummon() private bool MonsterSummon()
{ {
if (DontSummon(Card.Id)) if (DontSummon(Card))
return false; return false;
if (BlackmailAttackerSunmmon(Card.Id)) if (BlackmailAttackerSunmmon(Card))
return DefaultMonsterSummon(); return DefaultMonsterSummon();
else if (FilpMonster(Card.Id)) else if (FilpMonster(Card))
return false; return false;
else if (Card.Level > 4 || Bot.LifePoints > 1500) else if (Card.Level > 4 || Bot.LifePoints > 1500)
return DefaultMonsterSummon(); return DefaultMonsterSummon();
...@@ -631,7 +658,7 @@ namespace WindBot.Game.AI.Decks ...@@ -631,7 +658,7 @@ namespace WindBot.Game.AI.Decks
} }
private bool MonsterSet() private bool MonsterSet()
{ {
if (FilpMonster(Card.Id)) if (FilpMonster(Card))
return DefaultMonsterSummon(); return DefaultMonsterSummon();
if (Card.HasSetcode(0x40)) return false; if (Card.HasSetcode(0x40)) return false;
return DefaultMonsterSummon() && (Bot.LifePoints <= 1500 || (GetZoneCards(CardLocation.MonsterZone, Bot).Count() == 0 && Bot.LifePoints <= 4000)); return DefaultMonsterSummon() && (Bot.LifePoints <= 1500 || (GetZoneCards(CardLocation.MonsterZone, Bot).Count() == 0 && Bot.LifePoints <= 4000));
......
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