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

Update AutoChessExecutor.cs

parent 30073258
......@@ -248,55 +248,37 @@ namespace WindBot.Game.AI.Decks
return false;
}
private bool EnemyCardTarget(ClientCard card, bool chkc, CardLocation loc, CardType[] type, CardPosition[] pos)
{
int a = 0;
int b = 0;
int[] cardsname;
foreach (CardType ty in type)
{
if (ty == CardType.Spell)
a++;
if (ty == CardType.Trap)
a = a + 2;
if (ty == CardType.Spell || ty == CardType.Trap || ty == CardType.Monster)
a = a + 3;
}
foreach (CardPosition po in pos)
{
if (po == CardPosition.FaceUp)
b++;
if (po == CardPosition.FaceDown)
b = b + 2;
}
if ((loc & CardLocation.MonsterZone) > 0 && (loc & CardLocation.SpellZone) > 0)
{
if (chkc)
{
if (a == 1 && b == 1)
private bool EnemyCardTargetSpellFaceUp(ClientCard card)
{
if (card.Id == 76137614)
return true;
return false;
}
else if (a == 2 && b == 1)
private bool EnemyCardTargetTrapFaceUp(ClientCard card)
{
if (card.Id == 5640330 && ActivateDescription == Util.GetStringId(5640330, 1))
return true;
return false;
}
else if (a == 3 && b == 1)
private bool EnemyCardTargetSpellAndTrapFaceUp(ClientCard card)
{
cardsname = new[] {10071151, 14883228, 43785278, 44852429, 69452756, 76137614, 80019195, 80275707, 84565800, 85800949
int[] cardsname = new[] {10071151, 14883228, 43785278, 44852429, 69452756, 76137614, 80019195, 80275707, 84565800, 85800949
};
foreach(int cardname in cardsname)
{
if (card.Id == cardname) return true;
}
if ((card.Id == 5133471 && ActivateDescription == Util.GetStringId(5133471, 1)) || (card.Id == 17241941 && ActivateDescription == Util.GetStringId(17241941, 2)))
if ((card.Id == 5133471 && ActivateDescription == Util.GetStringId(5133471, 1))
|| (card.Id == 17241941 && ActivateDescription == Util.GetStringId(17241941, 2)))
return true;
return false;
}
else if (a == 3 && b == 2)
private bool EnemyCardTargetSpellAndTrapFaceDown(ClientCard card)
{
cardsname = new[] {25955749, 18489208, 20351153, 40736921, 61831093, 76515293
int[] cardsname = new[] {25955749, 18489208, 20351153, 40736921, 61831093, 76515293
};
foreach(int cardname in cardsname)
{
......@@ -307,10 +289,12 @@ namespace WindBot.Game.AI.Decks
|| (card.Id == 73213494 && ActivateDescription == Util.GetStringId(73213494, 1))
)
return true;
return false;
}
else if (a == 3 && b == 3)
private bool EnemyCardTargetSpellAndTrap(ClientCard card)
{
cardsname = new[] {5318639, 51232472, 6983839, 8267140, 22923081, 29223325, 71413901, 76471944, 89172051, 43898403
int[] cardsname = new[] {5318639, 51232472, 6983839, 8267140, 22923081, 29223325, 71413901, 76471944, 89172051
};
foreach(int cardname in cardsname)
{
......@@ -341,10 +325,12 @@ namespace WindBot.Game.AI.Decks
|| (card.Id == 60362066 && card.Location != CardLocation.Grave)
)
return true;
return false;
}
else if (a == 6 && b == 1)
private bool EnemyCardTargetFaceUp(ClientCard card)
{
cardsname = new[] {744887, 20403123, 20745268, 23204029, 38694052, 38904695, 43892408, 48905153, 89883517, 93379652,
int[] cardsname = new[] {744887, 20403123, 20745268, 23204029, 38694052, 38904695, 43892408, 48905153, 89883517, 93379652,
};
foreach(int cardname in cardsname)
{
......@@ -364,10 +350,12 @@ namespace WindBot.Game.AI.Decks
|| (card.Id == 38761908 && card.Location == CardLocation.SpellZone)
)
return true;
return false;
}
else if (a == 6 && b == 2)
private bool EnemyCardTargetFaceDown(ClientCard card)
{
cardsname = new[] {60229110, 93554166, 99940363, 15545291, 58475908
int[] cardsname = new[] {60229110, 93554166, 99940363, 15545291, 58475908
};
foreach(int cardname in cardsname)
{
......@@ -378,10 +366,12 @@ namespace WindBot.Game.AI.Decks
|| (card.Id == 32912040 && ActivateDescription == Util.GetStringId(32912040, 0))
)
return true;
return false;
}
else if (a == 6 && b == 3)
private bool EnemyCardTarget(ClientCard card)
{
cardsname = new[] {744887, 4178474, 5168381, 9765723, 13298352, 18318842, 19943114, 22850702, 28016193, 28112535, 28423537, 28711704, 29477860, 29479265, 32785578, 33846209, 33964637
int[] cardsname = new[] {744887, 4178474, 5168381, 9765723, 13298352, 18318842, 19943114, 22850702, 28016193, 28112535, 28423537, 28711704, 29477860, 29479265, 32785578, 33846209, 33964637
, 35252119, 35330871, 38265153, 38342335, 43215738, 43912676, 44553392, 47264717, 48626373, 55794644, 56804361, 65192027, 65892310, 68182934, 69764158, 71279983, 72959823, 73964868
, 76552147, 77449773, 83102080, 84125619, 84453939, 89211486, 97317530, 14154221, 17494901, 31677606, 66789970, 72044448, 78156759, 84290642, 85893201
};
......@@ -425,7 +415,6 @@ namespace WindBot.Game.AI.Decks
|| (card.Id == 90579153 && ActivateDescription == Util.GetStringId(90579153, 1))
|| (card.Id == 95207988 && ActivateDescription == Util.GetStringId(95207988, 1))
|| (card.Id == 5973663 && ActivateDescription == Util.GetStringId(5973663, 1))
|| (card.Id == 11132674 && ActivateDescription == Util.GetStringId(11132674, 2))
|| (card.Id == 28798938 && ActivateDescription == Util.GetStringId(28798938, 2))
|| (card.Id == 30989084 && ActivateDescription == Util.GetStringId(30989084, 2))
......@@ -459,11 +448,6 @@ namespace WindBot.Game.AI.Decks
|| (card.Id == 28865322 && card.Location != CardLocation.Hand)
)
return true;
}
}
}
return false;
}
......@@ -499,8 +483,6 @@ namespace WindBot.Game.AI.Decks
{
if (Card.HasType(CardType.Pendulum) && Card.Location == CardLocation.Hand && ActivateDescription == 1160)
{
if (Card.Location != CardLocation.Hand || Bot.HasInSpellZone(Card.Id))
return false;
ClientCard l = Util.GetPZone(0, 0);
ClientCard r = Util.GetPZone(0, 1);
......@@ -591,72 +573,67 @@ namespace WindBot.Game.AI.Decks
}
private bool EquipEffectActivateFunction()
{
if (Card.HasType(CardType.Equip))
{
List<ClientCard> cards = new List<ClientCard>();
if(Card.Location == CardLocation.SpellZone)
{
if (Card.Id == 43527730)
{
if (Card.Location == CardLocation.SpellZone && Card.Id == 43527730)
return !Card.EquipTarget.HasSetcode(0x18d);
return false;
}
if (Card.Id == 32939238)
private bool ActivateFunction()
{
cards = GetZoneCards(CardLocation.Onfield, Enemy).Where(card => card != null && !card.IsShouldNotBeTarget()).ToList();
if ((Card.HasType(CardType.Pendulum) && Card.Location == CardLocation.Hand && ActivateDescription == 1160)
|| (Card.HasType(CardType.Equip) && Card.Location == CardLocation.Hand)
|| (Card.Id == 43527730 && Card.Location == CardLocation.SpellZone)
)
return false;
IList<ClientCard> cards = new List<ClientCard>();
if (EnemyCardTargetSpellFaceUp(Card))
{
cards = GetZoneCards(CardLocation.Onfield, Enemy).Where(card => card != null && !card.IsShouldNotBeTarget() && card.IsFaceup() && ((card.HasType(CardType.Spell) && (card.HasType(CardType.Field) || card.HasType(CardType.Continuous) || card.HasType(CardType.Equip))) || (card.HasType(CardType.Pendulum) && card.Location == CardLocation.SpellZone))).ToList();
return cards.Count() > 0;
}
if (Card.Id == 57736667 || Card.Id == 36148308)
else if (EnemyCardTargetTrapFaceUp(Card))
{
cards = GetZoneCards(CardLocation.Onfield, Enemy).Where(card => card != null && !card.IsShouldNotBeTarget()).ToList();
cards = GetZoneCards(CardLocation.Onfield, Enemy).Where(card => card != null && !card.IsShouldNotBeTarget() && (card.HasType(CardType.Trap) && card.IsFaceup()) && (card.HasType(CardType.Continuous))).ToList();
return cards.Count() > 0;
}
if (Card.Id == 99013397 || Card.Id == 70423794 || Card.Id == 22147147)
else if (EnemyCardTargetSpellAndTrapFaceUp(Card))
{
cards = GetZoneCards(CardLocation.Onfield, Enemy).Where(card => card != null && !card.IsShouldNotBeTarget() && (card.HasType(CardType.Spell) || card.HasType(CardType.Trap))).ToList();
cards = GetZoneCards(CardLocation.Onfield, Enemy).Where(card => card != null && !card.IsShouldNotBeTarget() && card.IsFaceup() && (card.HasType(CardType.Field) || card.HasType(CardType.Continuous) || card.HasType(CardType.Equip) || (card.HasType(CardType.Pendulum) && card.Location == CardLocation.SpellZone))).ToList();
return cards.Count() > 0;
}
return DefaultDontChainMyself();
}
else if (Card.Location == CardLocation.Grave || Card.Location == CardLocation.Removed)
{
if (Card.Id == 64867422)
else if (EnemyCardTargetSpellAndTrapFaceDown(Card))
{
cards = GetZoneCards(CardLocation.MonsterZone, Enemy).Where(card => card != null && !card.IsShouldNotBeTarget() && card.IsFaceup()).ToList();
cards = GetZoneCards(CardLocation.Onfield, Enemy).Where(card => card != null && !card.IsShouldNotBeTarget() && card.IsFacedown()).ToList();
return cards.Count() > 0;
}
if (Card.Id == 66947913)
else if (EnemyCardTargetSpellAndTrap(Card))
{
cards = GetZoneCards(CardLocation.MonsterZone, Enemy).Where(card => card != null && !card.IsShouldNotBeTarget()).ToList();
cards = GetZoneCards(CardLocation.Onfield, Enemy).Where(card => card != null && !card.IsShouldNotBeTarget() && (card.HasType(CardType.Field) || card.HasType(CardType.Continuous) || card.HasType(CardType.Equip) || (card.IsFacedown() && card.Location == CardLocation.SpellZone) || (card.HasType(CardType.Pendulum) && card.Location == CardLocation.SpellZone))).ToList();
return cards.Count() > 0;
}
return DefaultDontChainMyself();
else if (EnemyCardTargetFaceUp(Card))
{
cards = GetZoneCards(CardLocation.Onfield, Enemy).Where(card => card != null && !card.IsShouldNotBeTarget() && card.IsFaceup() && (card.HasType(CardType.Field) || card.HasType(CardType.Continuous) || card.HasType(CardType.Equip) || (card.HasType(CardType.Pendulum) && card.Location == CardLocation.SpellZone) || card.Location == CardLocation.MonsterZone)).ToList();
return cards.Count() > 0;
}
return false;
else if (EnemyCardTargetFaceDown(Card))
{
cards = GetZoneCards(CardLocation.Onfield, Enemy).Where(card => card != null && !card.IsShouldNotBeTarget() && card.IsFacedown()).ToList();
return cards.Count() > 0;
}
return false;
else if (EnemyCardTarget(Card))
{
cards = GetZoneCards(CardLocation.Onfield, Enemy).Where(card => card != null && !card.IsShouldNotBeTarget() && (card.HasType(CardType.Field) || card.HasType(CardType.Continuous) || card.HasType(CardType.Equip) || (card.HasType(CardType.Pendulum) && card.Location == CardLocation.SpellZone) || (card.IsFacedown() && card.Location == CardLocation.SpellZone) || card.Location == CardLocation.MonsterZone)).ToList();
return cards.Count() > 0;
}
private bool ActivateFunction()
else if (Card.Id == 43898403)
{
IList<ClientCard> cards = new List<ClientCard>();
if (Card.HasType(CardType.Equip) || (Card.HasType(CardType.Pendulum) && Card.Location == CardLocation.Hand && ActivateDescription == 1160))
return false;
if (EnemyCardTarget(Card, true, CardLocation.Onfield, new[] { CardType.Spell, CardType.Trap }, new[] { CardPosition.FaceUp }))
return GetZoneCards(CardLocation.Onfield, Enemy).Any(card => card != null && (card.HasType(CardType.Spell) || card.HasType(CardType.Trap)) && card.IsFaceup() && !card.IsShouldNotBeTarget());
if (EnemyCardTarget(Card, true, CardLocation.Onfield, new[] { CardType.Spell, CardType.Trap }, new[] { CardPosition.FaceDown }))
return GetZoneCards(CardLocation.Onfield, Enemy).Any(card => card != null && (card.HasType(CardType.Spell) || card.HasType(CardType.Trap)) && card.IsFacedown() && !card.IsShouldNotBeTarget());
if (EnemyCardTarget(Card, true, CardLocation.Onfield, new[] { CardType.Spell, CardType.Trap }, new[] { CardPosition.FaceUp, CardPosition.FaceDown }))
return GetZoneCards(CardLocation.Onfield, Enemy).Any(card => card != null && (card.HasType(CardType.Spell) || card.HasType(CardType.Trap)) && !card.IsShouldNotBeTarget());
if (EnemyCardTarget(Card, true, CardLocation.Onfield, new[] { CardType.Spell, CardType.Trap, CardType.Monster }, new[] { CardPosition.FaceUp }))
return GetZoneCards(CardLocation.Onfield, Enemy).Any(card => card != null && card.IsFaceup() && !card.IsShouldNotBeTarget());
if (EnemyCardTarget(Card, true, CardLocation.Onfield, new[] { CardType.Spell, CardType.Trap, CardType.Monster }, new[] { CardPosition.FaceDown }))
return GetZoneCards(CardLocation.Onfield, Enemy).Any(card => card != null && card.IsFacedown() && !card.IsShouldNotBeTarget());
if (EnemyCardTarget(Card, true, CardLocation.Onfield, new[] { CardType.Spell, CardType.Trap, CardType.Monster }, new[] { CardPosition.FaceUp, CardPosition.FaceDown }))
return GetZoneCards(CardLocation.Onfield, Enemy).Any(card => card != null && !card.IsShouldNotBeTarget());
//优化单卡是怎么想的啊喂(#`O′)
if (Card.Id == 60461804)
cards = GetZoneCards(CardLocation.Onfield, Enemy).Where(card => card != null && !card.IsShouldNotBeTarget() && (card.HasType(CardType.Field) || card.HasType(CardType.Continuous) || card.HasType(CardType.Equip) || (card.IsFacedown() && card.Location == CardLocation.SpellZone) || (card.HasType(CardType.Pendulum) && card.Location == CardLocation.SpellZone))).ToList();
return cards.Count() >= 2;
}
else if (Card.Id == 60461804)
{
if (Card.Location == CardLocation.Grave)
{
......
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