Commit 80710541 authored by mercury233's avatar mercury233

update GetBotAvailZonesFromExtraDeck

parent 0ef27ba1
...@@ -92,7 +92,7 @@ namespace WindBot.Game.AI ...@@ -92,7 +92,7 @@ namespace WindBot.Game.AI
.OrderByDescending(card => card.GetDefensePower()) .OrderByDescending(card => card.GetDefensePower())
.FirstOrDefault(); .FirstOrDefault();
} }
public ClientCard GetWorstBotMonster(bool onlyATK = false) public ClientCard GetWorstBotMonster(bool onlyATK = false)
{ {
return Bot.MonsterZone.GetMonsters() return Bot.MonsterZone.GetMonsters()
...@@ -223,11 +223,11 @@ namespace WindBot.Game.AI ...@@ -223,11 +223,11 @@ namespace WindBot.Game.AI
{ {
if (Duel.IsNewRule) if (Duel.IsNewRule)
{ {
return Duel.Fields[player].SpellZone[id*4]; return Duel.Fields[player].SpellZone[id * 4];
} }
else else
{ {
return Duel.Fields[player].SpellZone[6+id]; return Duel.Fields[player].SpellZone[6 + id];
} }
} }
...@@ -241,57 +241,70 @@ namespace WindBot.Game.AI ...@@ -241,57 +241,70 @@ namespace WindBot.Game.AI
return Duel.Turn == 1 || Duel.Phase == DuelPhase.Main2; return Duel.Turn == 1 || Duel.Phase == DuelPhase.Main2;
} }
internal bool inListOrNull(ClientCard card, IList<ClientCard> list)
{
return card == null || list.Contains(card);
}
public int GetBotAvailZonesFromExtraDeck(IList<ClientCard> remove) public int GetBotAvailZonesFromExtraDeck(IList<ClientCard> remove)
{ {
ClientCard[] BotMZone = (ClientCard[])Bot.MonsterZone.Clone();
ClientCard[] EnemyMZone = (ClientCard[])Enemy.MonsterZone.Clone();
for (int i = 0; i < 7; i++)
{
if (remove.Contains(BotMZone[i])) BotMZone[i] = null;
if (remove.Contains(EnemyMZone[i])) EnemyMZone[i] = null;
}
if (!Duel.IsNewRule) if (!Duel.IsNewRule)
return Zones.MainMonsterZones; return Zones.MainMonsterZones;
int result = 0; int result = 0;
if (inListOrNull(Bot.MonsterZone[5], remove) && inListOrNull(Bot.MonsterZone[6], remove) && if (BotMZone[5] == null && BotMZone[6] == null)
(inListOrNull(Enemy.MonsterZone[5], remove) || inListOrNull(Enemy.MonsterZone[6], remove))) {
result |= Zones.ExtraMonsterZones; if (EnemyMZone[5] == null)
result |= Zones.z6;
if (inListOrNull(Bot.MonsterZone[0], remove) && if (EnemyMZone[6] == null)
(!inListOrNull(Bot.MonsterZone[1], remove) && Bot.MonsterZone[1].HasLinkMarker(CardLinkMarker.Left) || result |= Zones.z5;
!inListOrNull(Bot.MonsterZone[5], remove) && Bot.MonsterZone[5].HasLinkMarker(CardLinkMarker.BottomLeft) || }
!inListOrNull(Enemy.MonsterZone[6], remove) && Enemy.MonsterZone[6].HasLinkMarker(CardLinkMarker.TopRight)))
result += Zones.z0; if (BotMZone[0] == null &&
if (inListOrNull(Bot.MonsterZone[1], remove) && ((BotMZone[1]?.HasLinkMarker(CardLinkMarker.Left) ?? false) ||
(!inListOrNull(Bot.MonsterZone[0], remove) && Bot.MonsterZone[0].HasLinkMarker(CardLinkMarker.Right) || (BotMZone[5]?.HasLinkMarker(CardLinkMarker.BottomLeft) ?? false) ||
!inListOrNull(Bot.MonsterZone[2], remove) && Bot.MonsterZone[2].HasLinkMarker(CardLinkMarker.Left) || (EnemyMZone[6]?.HasLinkMarker(CardLinkMarker.TopRight) ?? false)))
!inListOrNull(Bot.MonsterZone[5], remove) && Bot.MonsterZone[5].HasLinkMarker(CardLinkMarker.Bottom) || result |= Zones.z0;
!inListOrNull(Enemy.MonsterZone[6], remove) && Enemy.MonsterZone[6].HasLinkMarker(CardLinkMarker.Top)))
result += Zones.z1; if (BotMZone[1] == null &&
if (inListOrNull(Bot.MonsterZone[2], remove) && ((BotMZone[0]?.HasLinkMarker(CardLinkMarker.Right) ?? false) ||
(!inListOrNull(Bot.MonsterZone[1], remove) && Bot.MonsterZone[1].HasLinkMarker(CardLinkMarker.Right) || (BotMZone[2]?.HasLinkMarker(CardLinkMarker.Left) ?? false) ||
!inListOrNull(Bot.MonsterZone[3], remove) && Bot.MonsterZone[3].HasLinkMarker(CardLinkMarker.Left) || (BotMZone[5]?.HasLinkMarker(CardLinkMarker.Bottom) ?? false) ||
!inListOrNull(Bot.MonsterZone[5], remove) && Bot.MonsterZone[5].HasLinkMarker(CardLinkMarker.BottomRight) || (EnemyMZone[6]?.HasLinkMarker(CardLinkMarker.Top) ?? false)))
!inListOrNull(Enemy.MonsterZone[6], remove) && Enemy.MonsterZone[6].HasLinkMarker(CardLinkMarker.TopLeft) || result |= Zones.z1;
!inListOrNull(Bot.MonsterZone[6], remove) && Bot.MonsterZone[6].HasLinkMarker(CardLinkMarker.BottomLeft) ||
!inListOrNull(Enemy.MonsterZone[5], remove) && Enemy.MonsterZone[5].HasLinkMarker(CardLinkMarker.TopRight))) if (BotMZone[2] == null &&
result += Zones.z2; ((BotMZone[1]?.HasLinkMarker(CardLinkMarker.Right) ?? false) ||
if (inListOrNull(Bot.MonsterZone[3], remove) && (BotMZone[3]?.HasLinkMarker(CardLinkMarker.Left) ?? false) ||
(!inListOrNull(Bot.MonsterZone[2], remove) && Bot.MonsterZone[2].HasLinkMarker(CardLinkMarker.Right) || (BotMZone[5]?.HasLinkMarker(CardLinkMarker.BottomRight) ?? false) ||
!inListOrNull(Bot.MonsterZone[4], remove) && Bot.MonsterZone[4].HasLinkMarker(CardLinkMarker.Left) || (EnemyMZone[6]?.HasLinkMarker(CardLinkMarker.TopLeft) ?? false) ||
!inListOrNull(Bot.MonsterZone[6], remove) && Bot.MonsterZone[6].HasLinkMarker(CardLinkMarker.Bottom) || (BotMZone[6]?.HasLinkMarker(CardLinkMarker.BottomLeft) ?? false) ||
!inListOrNull(Enemy.MonsterZone[5], remove) && Enemy.MonsterZone[5].HasLinkMarker(CardLinkMarker.Top))) (EnemyMZone[5]?.HasLinkMarker(CardLinkMarker.TopRight) ?? false)))
result += Zones.z3; result |= Zones.z2;
if (inListOrNull(Bot.MonsterZone[4], remove) &&
(!inListOrNull(Bot.MonsterZone[3], remove) && Bot.MonsterZone[3].HasLinkMarker(CardLinkMarker.Right) || if (BotMZone[3] == null &&
!inListOrNull(Bot.MonsterZone[6], remove) && Bot.MonsterZone[6].HasLinkMarker(CardLinkMarker.BottomRight) || ((BotMZone[2]?.HasLinkMarker(CardLinkMarker.Right) ?? false) ||
!inListOrNull(Enemy.MonsterZone[5], remove) && Enemy.MonsterZone[5].HasLinkMarker(CardLinkMarker.TopLeft))) (BotMZone[4]?.HasLinkMarker(CardLinkMarker.Left) ?? false) ||
result += Zones.z4; (BotMZone[6]?.HasLinkMarker(CardLinkMarker.Bottom) ?? false) ||
(EnemyMZone[5]?.HasLinkMarker(CardLinkMarker.Top) ?? false)))
result |= Zones.z3;
if (BotMZone[4] == null &&
((BotMZone[3]?.HasLinkMarker(CardLinkMarker.Right) ?? false) ||
(BotMZone[6]?.HasLinkMarker(CardLinkMarker.BottomRight) ?? false) ||
(EnemyMZone[5]?.HasLinkMarker(CardLinkMarker.TopLeft) ?? false)))
result |= Zones.z4;
return result; return result;
} }
public int GetBotAvailZonesFromExtraDeck(ClientCard remove) public int GetBotAvailZonesFromExtraDeck(ClientCard remove)
{ {
return GetBotAvailZonesFromExtraDeck(new [] { remove }); return GetBotAvailZonesFromExtraDeck(new[] { remove });
} }
public int GetBotAvailZonesFromExtraDeck() public int GetBotAvailZonesFromExtraDeck()
......
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