Commit 00071a3b authored by nanahira's avatar nanahira

Merge branch 'change-side'

parents ca6c267e f368dda6
Pipeline #2624 passed with stages
in 51 seconds
using YGOSharp.OCGWrapper.Enums;
using System.Collections.Generic;
using WindBot;
using WindBot.Game;
using WindBot.Game.AI;
namespace WindBot.Game.AI.Decks
{
[Deck("Lucky", "AI_Test", "Test")]
public class LuckyExecutor : DefaultExecutor
{
public LuckyExecutor(GameAI ai, Duel duel)
: base(ai, duel)
{
AddExecutor(ExecutorType.SpSummon, ImFeelingLucky);
AddExecutor(ExecutorType.Activate, ImFeelingLucky);
AddExecutor(ExecutorType.SummonOrSet, ImFeelingLucky);
AddExecutor(ExecutorType.SpellSet, ImFeelingLucky);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
AddExecutor(ExecutorType.Activate, _CardId.MysticalSpaceTyphoon, DefaultMysticalSpaceTyphoon);
AddExecutor(ExecutorType.Activate, _CardId.CosmicCyclone, DefaultCosmicCyclone);
AddExecutor(ExecutorType.Activate, _CardId.GalaxyCyclone, DefaultGalaxyCyclone);
AddExecutor(ExecutorType.Activate, _CardId.BookOfMoon, DefaultBookOfMoon);
AddExecutor(ExecutorType.Activate, _CardId.CompulsoryEvacuationDevice, DefaultCompulsoryEvacuationDevice);
AddExecutor(ExecutorType.Activate, _CardId.CallOfTheHaunted, DefaultCallOfTheHaunted);
AddExecutor(ExecutorType.Activate, _CardId.Scapegoat, DefaultScapegoat);
AddExecutor(ExecutorType.Activate, _CardId.MaxxC, DefaultMaxxC);
AddExecutor(ExecutorType.Activate, _CardId.AshBlossom, DefaultAshBlossomAndJoyousSpring);
AddExecutor(ExecutorType.Activate, _CardId.GhostOgreAndSnowRabbit, DefaultGhostOgreAndSnowRabbit);
AddExecutor(ExecutorType.Activate, _CardId.GhostBelle, DefaultGhostBelleAndHauntedMansion);
AddExecutor(ExecutorType.Activate, _CardId.EffectVeiler, DefaultEffectVeiler);
AddExecutor(ExecutorType.Activate, _CardId.CalledByTheGrave, DefaultCalledByTheGrave);
AddExecutor(ExecutorType.Activate, _CardId.InfiniteImpermanence, DefaultInfiniteImpermanence);
AddExecutor(ExecutorType.Activate, _CardId.BreakthroughSkill, DefaultBreakthroughSkill);
AddExecutor(ExecutorType.Activate, _CardId.SolemnJudgment, DefaultSolemnJudgment);
AddExecutor(ExecutorType.Activate, _CardId.SolemnWarning, DefaultSolemnWarning);
AddExecutor(ExecutorType.Activate, _CardId.SolemnStrike, DefaultSolemnStrike);
AddExecutor(ExecutorType.Activate, _CardId.TorrentialTribute, DefaultTorrentialTribute);
AddExecutor(ExecutorType.Activate, _CardId.HeavyStorm, DefaultHeavyStorm);
AddExecutor(ExecutorType.Activate, _CardId.HarpiesFeatherDuster, DefaultHarpiesFeatherDusterFirst);
AddExecutor(ExecutorType.Activate, _CardId.HammerShot, DefaultHammerShot);
AddExecutor(ExecutorType.Activate, _CardId.DarkHole, DefaultDarkHole);
AddExecutor(ExecutorType.Activate, _CardId.Raigeki, DefaultRaigeki);
AddExecutor(ExecutorType.Activate, _CardId.SmashingGround, DefaultSmashingGround);
AddExecutor(ExecutorType.Activate, _CardId.PotOfDesires, DefaultPotOfDesires);
AddExecutor(ExecutorType.Activate, _CardId.AllureofDarkness, DefaultAllureofDarkness);
AddExecutor(ExecutorType.Activate, _CardId.DimensionalBarrier, DefaultDimensionalBarrier);
AddExecutor(ExecutorType.Activate, _CardId.InterruptedKaijuSlumber, DefaultInterruptedKaijuSlumber);
AddExecutor(ExecutorType.SpSummon, _CardId.JizukirutheStarDestroyingKaiju, DefaultKaijuSpsummon);
AddExecutor(ExecutorType.SpSummon, _CardId.GadarlatheMysteryDustKaiju, DefaultKaijuSpsummon);
AddExecutor(ExecutorType.SpSummon, _CardId.GamecieltheSeaTurtleKaiju, DefaultKaijuSpsummon);
AddExecutor(ExecutorType.SpSummon, _CardId.RadiantheMultidimensionalKaiju, DefaultKaijuSpsummon);
AddExecutor(ExecutorType.SpSummon, _CardId.KumongoustheStickyStringKaiju, DefaultKaijuSpsummon);
AddExecutor(ExecutorType.SpSummon, _CardId.ThunderKingtheLightningstrikeKaiju, DefaultKaijuSpsummon);
AddExecutor(ExecutorType.SpSummon, _CardId.DogorantheMadFlameKaiju, DefaultKaijuSpsummon);
AddExecutor(ExecutorType.SpSummon, _CardId.SuperAntiKaijuWarMachineMechaDogoran, DefaultKaijuSpsummon);
AddExecutor(ExecutorType.SpSummon, _CardId.EvilswarmExcitonKnight, DefaultEvilswarmExcitonKnightSummon);
AddExecutor(ExecutorType.Activate, _CardId.EvilswarmExcitonKnight, DefaultEvilswarmExcitonKnightEffect);
}
public override IList<ClientCard> OnSelectCard(IList<ClientCard> _cards, int min, int max, int hint, bool cancelable)
{
if (Duel.Phase == DuelPhase.BattleStart)
return null;
if (AI.HaveSelectedCards())
return null;
IList<ClientCard> cards = new List<ClientCard>(_cards);
IList<ClientCard> selected = new List<ClientCard>();
if (max > cards.Count)
max = cards.Count;
// select random cards
while (selected.Count < max)
{
ClientCard card = cards[Program.Rand.Next(cards.Count)];
selected.Add(card);
cards.Remove(card);
}
return selected;
}
public override int OnSelectOption(IList<int> options)
{
return Program.Rand.Next(options.Count);
}
private bool ImFeelingLucky()
{
return Program.Rand.Next(9) >= 3 && DefaultDontChainMyself();
}
}
}
\ No newline at end of file
...@@ -36,8 +36,27 @@ namespace WindBot.Game.AI ...@@ -36,8 +36,27 @@ namespace WindBot.Game.AI
public const int DarkMagicAttack = 2314238; public const int DarkMagicAttack = 2314238;
public const int MysticalSpaceTyphoon = 5318639; public const int MysticalSpaceTyphoon = 5318639;
public const int CosmicCyclone = 8267140; public const int CosmicCyclone = 8267140;
public const int ChickenGame = 67616300; public const int GalaxyCyclone = 5133471;
public const int BookOfMoon = 14087893;
public const int CompulsoryEvacuationDevice = 94192409;
public const int CallOfTheHaunted = 97077563;
public const int Scapegoat = 73915051;
public const int BreakthroughSkill = 78474168;
public const int SolemnJudgment = 41420027;
public const int SolemnWarning = 84749824;
public const int SolemnStrike = 40605147;
public const int TorrentialTribute = 53582587;
public const int HeavyStorm = 19613556;
public const int HammerShot = 26412047;
public const int DarkHole = 53129443;
public const int Raigeki = 12580477;
public const int SmashingGround = 97169186;
public const int PotOfDesires = 35261759;
public const int AllureofDarkness = 1475311;
public const int DimensionalBarrier = 83326048;
public const int InterruptedKaijuSlumber = 99330325;
public const int ChickenGame = 67616300;
public const int SantaClaws = 46565218; public const int SantaClaws = 46565218;
public const int CastelTheSkyblasterMusketeer = 82633039; public const int CastelTheSkyblasterMusketeer = 82633039;
......
...@@ -951,6 +951,11 @@ namespace WindBot.Game ...@@ -951,6 +951,11 @@ namespace WindBot.Game
m_materialSelector = null; m_materialSelector = null;
} }
public bool HaveSelectedCards()
{
return m_selector.Count > 0 || m_materialSelector != null;
}
public CardSelector GetSelectedCards() public CardSelector GetSelectedCards()
{ {
CardSelector selected = null; CardSelector selected = null;
......
...@@ -47,9 +47,10 @@ namespace WindBot.Game ...@@ -47,9 +47,10 @@ namespace WindBot.Game
_ai = new GameAI(Game, _duel); _ai = new GameAI(Game, _duel);
_ai.Executor = DecksManager.Instantiate(_ai, _duel); _ai.Executor = DecksManager.Instantiate(_ai, _duel);
Deck = Deck.Load(_ai.Executor.Deck); string deckName = Game.DeckFile ?? _ai.Executor.Deck;
DeckForWin = Deck.Load("Win/" + _ai.Executor.Deck); Deck = Deck.Load(deckName);
DeckForLose = Deck.Load("Lose/" + _ai.Executor.Deck); DeckForWin = Deck.Load("Win/" + deckName);
DeckForLose = Deck.Load("Lose/" + deckName);
_select_hint = 0; _select_hint = 0;
lastDuelResult = 2; lastDuelResult = 2;
} }
......
...@@ -13,6 +13,7 @@ namespace WindBot.Game ...@@ -13,6 +13,7 @@ namespace WindBot.Game
public YGOClient Connection { get; private set; } public YGOClient Connection { get; private set; }
public string Username; public string Username;
public string Deck; public string Deck;
public string DeckFile;
public string Dialog; public string Dialog;
public int Hand; public int Hand;
public bool Debug; public bool Debug;
...@@ -29,6 +30,7 @@ namespace WindBot.Game ...@@ -29,6 +30,7 @@ namespace WindBot.Game
{ {
Username = Info.Name; Username = Info.Name;
Deck = Info.Deck; Deck = Info.Deck;
DeckFile = Info.DeckFile;
Dialog = Info.Dialog; Dialog = Info.Dialog;
Hand = Info.Hand; Hand = Info.Hand;
Debug = Info.Debug; Debug = Info.Debug;
......
...@@ -68,6 +68,7 @@ namespace WindBot ...@@ -68,6 +68,7 @@ namespace WindBot
WindBotInfo Info = new WindBotInfo(); WindBotInfo Info = new WindBotInfo();
Info.Name = Config.GetString("Name", Info.Name); Info.Name = Config.GetString("Name", Info.Name);
Info.Deck = Config.GetString("Deck", Info.Deck); Info.Deck = Config.GetString("Deck", Info.Deck);
Info.DeckFile = Config.GetString("DeckFile", Info.DeckFile);
Info.Dialog = Config.GetString("Dialog", Info.Dialog); Info.Dialog = Config.GetString("Dialog", Info.Dialog);
Info.Host = Config.GetString("Host", Info.Host); Info.Host = Config.GetString("Host", Info.Host);
Info.Port = Config.GetInt("Port", Info.Port); Info.Port = Config.GetInt("Port", Info.Port);
...@@ -104,6 +105,9 @@ namespace WindBot ...@@ -104,6 +105,9 @@ namespace WindBot
string port = HttpUtility.ParseQueryString(RawUrl).Get("port"); string port = HttpUtility.ParseQueryString(RawUrl).Get("port");
if (port != null) if (port != null)
Info.Port = Int32.Parse(port); Info.Port = Int32.Parse(port);
string deckfile = HttpUtility.ParseQueryString(RawUrl).Get("deckfile");
if (deckfile != null)
Info.DeckFile = deckfile;
string dialog = HttpUtility.ParseQueryString(RawUrl).Get("dialog"); string dialog = HttpUtility.ParseQueryString(RawUrl).Get("dialog");
if (dialog != null) if (dialog != null)
Info.Dialog = dialog; Info.Dialog = dialog;
......
...@@ -20,6 +20,11 @@ The nickname for the bot. ...@@ -20,6 +20,11 @@ The nickname for the bot.
`Deck` `Deck`
The deck to be used by the bot. Available decks are listed below. Keep empty to use random deck. The deck to be used by the bot. Available decks are listed below. Keep empty to use random deck.
`DeckFile`
The deck file (.ydk) to be used by the bot. Will be set by `Deck` automatically, but you can override it.
Note: Most cards not in the original deck are unknown to the bot, and won't be summoned or activated in the duel.
`Dialog` `Dialog`
The dialog texts to be used by the bot. See Dialogs folder for list. The dialog texts to be used by the bot. See Dialogs folder for list.
......
...@@ -72,6 +72,7 @@ ...@@ -72,6 +72,7 @@
<Compile Include="Game\AI\Decks\AltergeistExecutor.cs" /> <Compile Include="Game\AI\Decks\AltergeistExecutor.cs" />
<Compile Include="Game\AI\Decks\FamiliarPossessedExecutor.cs" /> <Compile Include="Game\AI\Decks\FamiliarPossessedExecutor.cs" />
<Compile Include="Game\AI\Decks\BlackwingExecutor.cs" /> <Compile Include="Game\AI\Decks\BlackwingExecutor.cs" />
<Compile Include="Game\AI\Decks\LuckyExecutor.cs" />
<Compile Include="Game\AI\Decks\MathMechExecutor.cs" /> <Compile Include="Game\AI\Decks\MathMechExecutor.cs" />
<Compile Include="Game\AI\Decks\PureWindsExecutor.cs" /> <Compile Include="Game\AI\Decks\PureWindsExecutor.cs" />
<Compile Include="Game\AI\Decks\DragunExecutor.cs" /> <Compile Include="Game\AI\Decks\DragunExecutor.cs" />
......
...@@ -6,6 +6,7 @@ namespace WindBot ...@@ -6,6 +6,7 @@ namespace WindBot
{ {
public string Name { get; set; } public string Name { get; set; }
public string Deck { get; set; } public string Deck { get; set; }
public string DeckFile { get; set; }
public string Dialog { get; set; } public string Dialog { get; set; }
public string Host { get; set; } public string Host { get; set; }
public int Port { get; set; } public int Port { get; set; }
...@@ -18,6 +19,7 @@ namespace WindBot ...@@ -18,6 +19,7 @@ namespace WindBot
{ {
Name = "WindBot"; Name = "WindBot";
Deck = null; Deck = null;
DeckFile = null;
Dialog = "default"; Dialog = "default";
Host = "127.0.0.1"; Host = "127.0.0.1";
Port = 7911; Port = 7911;
......
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