Commit 917f7f5d authored by mercury233's avatar mercury233

add AI.Utils.GetWorstBotMonster and ChainContainPlayer

by handsomekiwi
parent 168f4385
using System.Collections.Generic; using System.Collections.Generic;
using YGOSharp.OCGWrapper.Enums; using YGOSharp.OCGWrapper.Enums;
namespace WindBot.Game.AI namespace WindBot.Game.AI
{ {
public class AIFunctions public class AIFunctions
...@@ -150,7 +149,26 @@ namespace WindBot.Game.AI ...@@ -150,7 +149,26 @@ namespace WindBot.Game.AI
} }
return bestMonster; return bestMonster;
} }
public ClientCard GetWorstBotMonster(bool onlyATK = false)
{
int WorstPower = -1;
ClientCard WorstMonster = null;
for (int i = 0; i < 7; ++i)
{
ClientCard card = Bot.MonsterZone[i];
if (card == null || card.Data == null) continue;
if (onlyATK && card.IsDefense()) continue;
int newPower = card.GetDefensePower();
if (newPower < WorstPower)
{
WorstPower = newPower;
WorstMonster = card;
}
}
return WorstMonster;
}
public ClientCard GetOneEnemyBetterThanValue(int value, bool onlyATK = false, bool canBeTarget = false) public ClientCard GetOneEnemyBetterThanValue(int value, bool onlyATK = false, bool canBeTarget = false)
{ {
ClientCard bestCard = null; ClientCard bestCard = null;
...@@ -256,6 +274,25 @@ namespace WindBot.Game.AI ...@@ -256,6 +274,25 @@ namespace WindBot.Game.AI
return null; return null;
} }
public ClientCard GetWorstEnemyMonster(bool onlyATK = false)
{
int WorstPower = -1;
ClientCard WorstMonster = null;
for (int i = 0; i < 7; ++i)
{
ClientCard card = Enemy.MonsterZone[i];
if (card == null || card.Data == null) continue;
if (onlyATK && card.IsDefense()) continue;
int newPower = card.GetDefensePower();
if (newPower < WorstPower)
{
WorstPower = newPower;
WorstMonster = card;
}
}
return WorstMonster;
}
public ClientCard GetBestEnemySpell(bool onlyFaceup = false) public ClientCard GetBestEnemySpell(bool onlyFaceup = false)
{ {
ClientCard card = GetProblematicEnemySpell(); ClientCard card = GetProblematicEnemySpell();
...@@ -337,6 +374,16 @@ namespace WindBot.Game.AI ...@@ -337,6 +374,16 @@ namespace WindBot.Game.AI
return count; return count;
} }
public bool ChainContainPlayer(int player)
{
foreach (ClientCard card in Duel.CurrentChain)
{
if (card.Controller == player)
return true;
}
return false;
}
public bool HasChainedTrap(int player) public bool HasChainedTrap(int player)
{ {
foreach (ClientCard card in Duel.CurrentChain) foreach (ClientCard card in Duel.CurrentChain)
......
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