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
public const int DarkMagicAttack = 2314238;
public const int MysticalSpaceTyphoon = 5318639;
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 CastelTheSkyblasterMusketeer = 82633039;
......
......@@ -951,6 +951,11 @@ namespace WindBot.Game
m_materialSelector = null;
}
public bool HaveSelectedCards()
{
return m_selector.Count > 0 || m_materialSelector != null;
}
public CardSelector GetSelectedCards()
{
CardSelector selected = null;
......
......@@ -47,9 +47,10 @@ namespace WindBot.Game
_ai = new GameAI(Game, _duel);
_ai.Executor = DecksManager.Instantiate(_ai, _duel);
Deck = Deck.Load(_ai.Executor.Deck);
DeckForWin = Deck.Load("Win/" + _ai.Executor.Deck);
DeckForLose = Deck.Load("Lose/" + _ai.Executor.Deck);
string deckName = Game.DeckFile ?? _ai.Executor.Deck;
Deck = Deck.Load(deckName);
DeckForWin = Deck.Load("Win/" + deckName);
DeckForLose = Deck.Load("Lose/" + deckName);
_select_hint = 0;
lastDuelResult = 2;
}
......
......@@ -13,6 +13,7 @@ namespace WindBot.Game
public YGOClient Connection { get; private set; }
public string Username;
public string Deck;
public string DeckFile;
public string Dialog;
public int Hand;
public bool Debug;
......@@ -29,6 +30,7 @@ namespace WindBot.Game
{
Username = Info.Name;
Deck = Info.Deck;
DeckFile = Info.DeckFile;
Dialog = Info.Dialog;
Hand = Info.Hand;
Debug = Info.Debug;
......
......@@ -68,6 +68,7 @@ namespace WindBot
WindBotInfo Info = new WindBotInfo();
Info.Name = Config.GetString("Name", Info.Name);
Info.Deck = Config.GetString("Deck", Info.Deck);
Info.DeckFile = Config.GetString("DeckFile", Info.DeckFile);
Info.Dialog = Config.GetString("Dialog", Info.Dialog);
Info.Host = Config.GetString("Host", Info.Host);
Info.Port = Config.GetInt("Port", Info.Port);
......@@ -104,6 +105,9 @@ namespace WindBot
string port = HttpUtility.ParseQueryString(RawUrl).Get("port");
if (port != null)
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");
if (dialog != null)
Info.Dialog = dialog;
......
......@@ -20,6 +20,11 @@ The nickname for the bot.
`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`
The dialog texts to be used by the bot. See Dialogs folder for list.
......
......@@ -72,6 +72,7 @@
<Compile Include="Game\AI\Decks\AltergeistExecutor.cs" />
<Compile Include="Game\AI\Decks\FamiliarPossessedExecutor.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\PureWindsExecutor.cs" />
<Compile Include="Game\AI\Decks\DragunExecutor.cs" />
......
......@@ -6,6 +6,7 @@ namespace WindBot
{
public string Name { get; set; }
public string Deck { get; set; }
public string DeckFile { get; set; }
public string Dialog { get; set; }
public string Host { get; set; }
public int Port { get; set; }
......@@ -18,6 +19,7 @@ namespace WindBot
{
Name = "WindBot";
Deck = null;
DeckFile = null;
Dialog = "default";
Host = "127.0.0.1";
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