Commit d5eb3807 authored by mercury233's avatar mercury233

update test ai

parent b9b9761a
namespace WindBot.Game.AI.Decks using YGOSharp.OCGWrapper.Enums;
using System.Collections.Generic;
using WindBot;
using WindBot.Game;
using WindBot.Game.AI;
namespace WindBot.Game.AI.Decks
{ {
[Deck("Test", "AI_Test")] [Deck("Test", "AI_Test")]
public class DoEverythingExecutor : DefaultExecutor public class DoEverythingExecutor : DefaultExecutor
...@@ -12,13 +18,29 @@ ...@@ -12,13 +18,29 @@
public DoEverythingExecutor(GameAI ai, Duel duel) public DoEverythingExecutor(GameAI ai, Duel duel)
: base(ai, duel) : base(ai, duel)
{ {
AddExecutor(ExecutorType.SpSummon);
AddExecutor(ExecutorType.Activate, DontChainMyself); AddExecutor(ExecutorType.Activate, DontChainMyself);
AddExecutor(ExecutorType.SummonOrSet); AddExecutor(ExecutorType.SummonOrSet);
AddExecutor(ExecutorType.SpSummon);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos); AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
AddExecutor(ExecutorType.SpellSet); AddExecutor(ExecutorType.SpellSet);
} }
public override IList<ClientCard> OnSelectCard(IList<ClientCard> cards, int min, int max, bool cancelable)
{
IList<ClientCard> selected = new List<ClientCard>();
// select the last cards
for (int i = 1; i <= max; ++i)
selected.Add(cards[cards.Count-i]);
return selected;
}
public override int OnSelectOption(IList<int> options)
{
return Program.Rand.Next(options.Count);
}
private bool DontChainMyself() private bool DontChainMyself()
{ {
return LastChainPlayer != 0; return LastChainPlayer != 0;
......
...@@ -114,6 +114,11 @@ namespace WindBot.Game.AI ...@@ -114,6 +114,11 @@ namespace WindBot.Game.AI
return true; return true;
} }
public virtual int OnSelectOption(IList<int> options)
{
return -1;
}
public bool ChainContainsCard(int id) public bool ChainContainsCard(int id)
{ {
foreach (ClientCard card in CurrentChain) foreach (ClientCard card in CurrentChain)
......
...@@ -326,6 +326,11 @@ namespace WindBot.Game ...@@ -326,6 +326,11 @@ namespace WindBot.Game
{ {
if (m_option != -1) if (m_option != -1)
return m_option; return m_option;
int result = Executor.OnSelectOption(options);
if (result != -1)
return result;
return 0; // Always select the first option. return 0; // Always select the first option.
} }
......
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