Commit f2f54c2a authored by mercury233's avatar mercury233
parents b489285e c53428bc
...@@ -247,7 +247,7 @@ namespace WindBot.Game.AI ...@@ -247,7 +247,7 @@ namespace WindBot.Game.AI
foreach (ClientCard ecard in spells) foreach (ClientCard ecard in spells)
{ {
if (ecard.IsFaceup()) if (ecard.IsFaceup() && ecard.HasType(CardType.Continuous))
return ecard; return ecard;
} }
...@@ -296,5 +296,85 @@ namespace WindBot.Game.AI ...@@ -296,5 +296,85 @@ namespace WindBot.Game.AI
return Duel.ChainTargets.Count == 1 && card.Equals(Duel.ChainTargets[0]); return Duel.ChainTargets.Count == 1 && card.Equals(Duel.ChainTargets[0]);
} }
/// <summary>
/// Select cards listed in preferred.
/// </summary>
public void SelectPreferredCards(IList<ClientCard> selected, ClientCard preferred, IList<ClientCard> cards, int min, int max)
{
if (cards.IndexOf(preferred) > 0 && selected.Count < max)
{
selected.Add(preferred);
}
}
/// <summary>
/// Select cards listed in preferred.
/// </summary>
public void SelectPreferredCards(IList<ClientCard> selected, int preferred, IList<ClientCard> cards, int min, int max)
{
foreach (ClientCard card in cards)
{
if (card.Id== preferred && selected.Count < max)
selected.Add(card);
}
}
/// <summary>
/// Select cards listed in preferred.
/// </summary>
public void SelectPreferredCards(IList<ClientCard> selected, IList<ClientCard> preferred, IList<ClientCard> cards, int min, int max)
{
IList<ClientCard> avail = new List<ClientCard>();
foreach (ClientCard card in cards)
{
// clone
avail.Add(card);
}
while (preferred.Count > 0 && avail.IndexOf(preferred[0]) > 0 && selected.Count < max)
{
ClientCard card = preferred[0];
preferred.Remove(card);
avail.Remove(card);
selected.Add(card);
}
}
/// <summary>
/// Select cards listed in preferred.
/// </summary>
public void SelectPreferredCards(IList<ClientCard> selected, IList<int> preferred, IList<ClientCard> cards, int min, int max)
{
for (int i = 0; i < preferred.Count; i++)
{
foreach (ClientCard card in cards)
{
if (card.Id == preferred[i] && selected.Count < max && selected.IndexOf(card) <= 0)
selected.Add(card);
}
if (selected.Count >= max)
break;
}
}
/// <summary>
/// Check and fix selected to make sure it meet the count requirement.
/// </summary>
public void CheckSelectCount(IList<ClientCard> selected, IList<ClientCard> cards, int min, int max)
{
if (selected.Count < min)
{
foreach (ClientCard card in cards)
{
if (!selected.Contains(card))
selected.Add(card);
if (selected.Count >= max)
break;
}
}
while (selected.Count > max)
{
selected.RemoveAt(selected.Count - 1);
}
}
} }
} }
\ No newline at end of file
...@@ -132,7 +132,7 @@ namespace WindBot.Game.AI.Decks ...@@ -132,7 +132,7 @@ namespace WindBot.Game.AI.Decks
SoulChargeUsed = false; SoulChargeUsed = false;
} }
public override IList<ClientCard> OnSelectCard(IList<ClientCard> cards, int min, int max, bool cancelable) public override IList<ClientCard> OnSelectCard(IList<ClientCard> cards, int min, int max, int hint, bool cancelable)
{ {
Logger.DebugWriteLine("OnSelectCard " + cards.Count + " " + min + " " + max); Logger.DebugWriteLine("OnSelectCard " + cards.Count + " " + min + " " + max);
if (max == 2 && cards[0].Location == CardLocation.Deck) if (max == 2 && cards[0].Location == CardLocation.Deck)
...@@ -157,60 +157,26 @@ namespace WindBot.Game.AI.Decks ...@@ -157,60 +157,26 @@ namespace WindBot.Game.AI.Decks
result.Add(card); result.Add(card);
} }
} }
if (result.Count < min) AI.Utils.CheckSelectCount(result, cards, min, max);
{
foreach (ClientCard card in cards)
{
if (!result.Contains(card))
result.Add(card);
if (result.Count >= min)
break;
}
}
while (result.Count > max)
{
result.RemoveAt(result.Count - 1);
}
return result;
}
if (max == 2 && min == 2 && cards[0].Location == CardLocation.MonsterZone)
{
Logger.DebugWriteLine("OnSelectCard XYZ");
IList<ClientCard> avail = new List<ClientCard>();
foreach (ClientCard card in cards)
{
// clone
avail.Add(card);
}
IList<ClientCard> result = new List<ClientCard>();
while (UsedAlternativeWhiteDragon.Count > 0 && avail.IndexOf(UsedAlternativeWhiteDragon[0]) > 0)
{
Logger.DebugWriteLine("select UsedAlternativeWhiteDragon");
ClientCard card = UsedAlternativeWhiteDragon[0];
UsedAlternativeWhiteDragon.Remove(card);
avail.Remove(card);
result.Add(card);
}
if (result.Count < 2)
{
foreach (ClientCard card in cards)
{
if (!result.Contains(card))
result.Add(card);
if (result.Count >= 2)
break;
}
}
return result; return result;
} }
Logger.DebugWriteLine("Use default."); Logger.DebugWriteLine("Use default.");
return null; return null;
} }
public override IList<ClientCard> OnSelectSum(IList<ClientCard> cards, int sum, int min, int max, bool mode) public override IList<ClientCard> OnSelectXyzMaterial(IList<ClientCard> cards, int min, int max)
{
Logger.DebugWriteLine("OnSelectXyzMaterial " + cards.Count + " " + min + " " + max);
IList<ClientCard> result = new List<ClientCard>();
AI.Utils.SelectPreferredCards(result, UsedAlternativeWhiteDragon, cards, min, max);
AI.Utils.CheckSelectCount(result, cards, min, max);
return result;
}
public override IList<ClientCard> OnSelectSynchroMaterial(IList<ClientCard> cards, int sum, int min, int max)
{ {
Logger.DebugWriteLine("OnSelectSum " + cards.Count + " " + sum + " " + min + " " + max); Logger.DebugWriteLine("OnSelectSynchroMaterial " + cards.Count + " " + sum + " " + min + " " + max);
if (sum != 8 || !mode) if (sum != 8)
return null; return null;
foreach (ClientCard AlternativeWhiteDragon in UsedAlternativeWhiteDragon) foreach (ClientCard AlternativeWhiteDragon in UsedAlternativeWhiteDragon)
......
using YGOSharp.OCGWrapper.Enums; using YGOSharp.OCGWrapper.Enums;
using System.Collections.Generic; using System.Collections.Generic;
using WindBot; using WindBot;
using WindBot.Game; using WindBot.Game;
using WindBot.Game.AI; using WindBot.Game.AI;
namespace WindBot.Game.AI.Decks namespace WindBot.Game.AI.Decks
{ {
[Deck("Test", "AI_Test", "Test")] [Deck("Test", "AI_Test", "Test")]
public class DoEverythingExecutor : DefaultExecutor public class DoEverythingExecutor : DefaultExecutor
{ {
public class CardId public class CardId
{ {
public const int LeoWizard = 4392470; public const int LeoWizard = 4392470;
public const int Bunilla = 69380702; public const int Bunilla = 69380702;
} }
public DoEverythingExecutor(GameAI ai, Duel duel) public DoEverythingExecutor(GameAI ai, Duel duel)
: base(ai, duel) : base(ai, duel)
{ {
AddExecutor(ExecutorType.SpSummon); AddExecutor(ExecutorType.SpSummon);
AddExecutor(ExecutorType.Activate, DefaultDontChainMyself); AddExecutor(ExecutorType.Activate, DefaultDontChainMyself);
AddExecutor(ExecutorType.SummonOrSet); AddExecutor(ExecutorType.SummonOrSet);
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) public override IList<ClientCard> OnSelectCard(IList<ClientCard> cards, int min, int max, int hint, bool cancelable)
{ {
if (Duel.Phase == DuelPhase.BattleStart) if (Duel.Phase == DuelPhase.BattleStart)
return null; return null;
IList<ClientCard> selected = new List<ClientCard>(); IList<ClientCard> selected = new List<ClientCard>();
// select the last cards // select the last cards
for (int i = 1; i <= max; ++i) for (int i = 1; i <= max; ++i)
selected.Add(cards[cards.Count-i]); selected.Add(cards[cards.Count-i]);
return selected; return selected;
} }
public override int OnSelectOption(IList<int> options) public override int OnSelectOption(IList<int> options)
{ {
return Program.Rand.Next(options.Count); return Program.Rand.Next(options.Count);
} }
} }
} }
\ No newline at end of file
...@@ -103,39 +103,19 @@ namespace WindBot.Game.AI.Decks ...@@ -103,39 +103,19 @@ namespace WindBot.Game.AI.Decks
return base.OnPreBattleBetween(attacker, defender); return base.OnPreBattleBetween(attacker, defender);
} }
public override IList<ClientCard> OnSelectCard(IList<ClientCard> cards, int min, int max, bool cancelable) public override IList<ClientCard> OnSelectXyzMaterial(IList<ClientCard> cards, int min, int max)
{ {
if (max == 2 && min == 2 && cards[0].Location == CardLocation.MonsterZone) Logger.DebugWriteLine("OnSelectXyzMaterial " + cards.Count + " " + min + " " + max);
IList<ClientCard> result = new List<ClientCard>();
foreach (ClientCard card in cards)
{ {
Logger.DebugWriteLine("OnSelectCard XYZ"); if (!result.Contains(card) && (!ClownUsed || card.Id != CardId.PerformageTrickClown))
IList<ClientCard> avail = new List<ClientCard>(); result.Add(card);
foreach (ClientCard card in cards) if (result.Count >= max)
{ break;
// clone
avail.Add(card);
}
IList<ClientCard> result = new List<ClientCard>();
foreach (ClientCard card in cards)
{
if (!result.Contains(card) && (!ClownUsed || card.Id != CardId.PerformageTrickClown))
result.Add(card);
if (result.Count >= 2)
break;
}
if (result.Count < 2)
{
foreach (ClientCard card in cards)
{
if (!result.Contains(card))
result.Add(card);
if (result.Count >= 2)
break;
}
}
return result;
} }
Logger.DebugWriteLine("Use default."); AI.Utils.CheckSelectCount(result, cards, min, max);
return null; return result;
} }
private bool ReinforcementOfTheArmyEffect() private bool ReinforcementOfTheArmyEffect()
......
...@@ -132,14 +132,10 @@ namespace WindBot.Game.AI.Decks ...@@ -132,14 +132,10 @@ namespace WindBot.Game.AI.Decks
CardOfDemiseUsed = false; CardOfDemiseUsed = false;
} }
public override IList<ClientCard> OnSelectCard(IList<ClientCard> cards, int min, int max, bool cancelable) public override IList<ClientCard> OnSelectPendulumSummon(IList<ClientCard> cards, int max)
{ {
if (max <= min) Logger.DebugWriteLine("OnSelectPendulumSummon");
{ // select the last cards
return null;
}
// pendulum summon, select the last cards
IList<ClientCard> selected = new List<ClientCard>(); IList<ClientCard> selected = new List<ClientCard>();
for (int i = 1; i <= max; ++i) for (int i = 1; i <= max; ++i)
......
using YGOSharp.OCGWrapper.Enums; using YGOSharp.OCGWrapper.Enums;
using System.Collections.Generic; using System.Collections.Generic;
using WindBot; using WindBot;
using WindBot.Game; using WindBot.Game;
using WindBot.Game.AI; using WindBot.Game.AI;
namespace WindBot.Game.AI.Decks namespace WindBot.Game.AI.Decks
{ {
[Deck("Rainbow", "AI_Rainbow")] [Deck("Rainbow", "AI_Rainbow")]
class RainbowExecutor : DefaultExecutor class RainbowExecutor : DefaultExecutor
{ {
public class CardId public class CardId
{ {
public const int MysteryShellDragon = 18108166; public const int MysteryShellDragon = 18108166;
public const int PhantomGryphon = 74852097; public const int PhantomGryphon = 74852097;
public const int MasterPendulumTheDracoslayer = 75195825; public const int MasterPendulumTheDracoslayer = 75195825;
public const int AngelTrumpeter = 87979586; public const int AngelTrumpeter = 87979586;
public const int MetalfoesGoldriver = 33256280; public const int MetalfoesGoldriver = 33256280;
public const int MegalosmasherX = 81823360; public const int MegalosmasherX = 81823360;
public const int RescueRabbit = 85138716; public const int RescueRabbit = 85138716;
public const int UnexpectedDai = 911883; public const int UnexpectedDai = 911883;
public const int HarpiesFeatherDuster = 18144506; public const int HarpiesFeatherDuster = 18144506;
public const int PotOfDesires = 35261759; public const int PotOfDesires = 35261759;
public const int MonsterReborn = 83764718; public const int MonsterReborn = 83764718;
public const int SmashingGround = 97169186; public const int SmashingGround = 97169186;
public const int QuakingMirrorForce = 40838625; public const int QuakingMirrorForce = 40838625;
public const int DrowningMirrorForce = 47475363; public const int DrowningMirrorForce = 47475363;
public const int BlazingMirrorForce = 75249652; public const int BlazingMirrorForce = 75249652;
public const int StormingMirrorForce = 5650082; public const int StormingMirrorForce = 5650082;
public const int MirrorForce = 44095762; public const int MirrorForce = 44095762;
public const int DarkMirrorForce = 20522190; public const int DarkMirrorForce = 20522190;
public const int BottomlessTrapHole = 29401950; public const int BottomlessTrapHole = 29401950;
public const int TraptrixTrapHoleNightmare = 29616929; public const int TraptrixTrapHoleNightmare = 29616929;
public const int StarlightRoad = 58120309; public const int StarlightRoad = 58120309;
public const int ScarlightRedDragonArchfiend = 80666118; public const int ScarlightRedDragonArchfiend = 80666118;
public const int IgnisterProminenceTheBlastingDracoslayer = 18239909; public const int IgnisterProminenceTheBlastingDracoslayer = 18239909;
public const int StardustDragon = 44508094; public const int StardustDragon = 44508094;
public const int NumberS39UtopiatheLightning = 56832966; public const int NumberS39UtopiatheLightning = 56832966;
public const int Number37HopeWovenDragonSpiderShark = 37279508; public const int Number37HopeWovenDragonSpiderShark = 37279508;
public const int Number39Utopia = 84013237; public const int Number39Utopia = 84013237;
public const int EvolzarLaggia = 74294676; public const int EvolzarLaggia = 74294676;
public const int Number59CrookedCook = 82697249; public const int Number59CrookedCook = 82697249;
public const int CastelTheSkyblasterMusketeer = 82633039; public const int CastelTheSkyblasterMusketeer = 82633039;
public const int StarliegePaladynamo = 61344030; public const int StarliegePaladynamo = 61344030;
public const int LightningChidori = 22653490; public const int LightningChidori = 22653490;
public const int EvilswarmExcitonKnight = 46772449; public const int EvilswarmExcitonKnight = 46772449;
public const int GagagaCowboy = 12014404; public const int GagagaCowboy = 12014404;
public const int EvilswarmNightmare = 359563; public const int EvilswarmNightmare = 359563;
public const int TraptrixRafflesia = 6511113; public const int TraptrixRafflesia = 6511113;
} }
private bool NormalSummoned = false; private bool NormalSummoned = false;
public RainbowExecutor(GameAI ai, Duel duel) public RainbowExecutor(GameAI ai, Duel duel)
: base(ai, duel) : base(ai, duel)
{ {
AddExecutor(ExecutorType.Activate, CardId.HarpiesFeatherDuster); AddExecutor(ExecutorType.Activate, CardId.HarpiesFeatherDuster);
AddExecutor(ExecutorType.Activate, CardId.UnexpectedDai, UnexpectedDaiEffect); AddExecutor(ExecutorType.Activate, CardId.UnexpectedDai, UnexpectedDaiEffect);
AddExecutor(ExecutorType.Summon, CardId.RescueRabbit); AddExecutor(ExecutorType.Summon, CardId.RescueRabbit);
AddExecutor(ExecutorType.Activate, CardId.RescueRabbit, RescueRabbitEffect); AddExecutor(ExecutorType.Activate, CardId.RescueRabbit, RescueRabbitEffect);
AddExecutor(ExecutorType.Activate, CardId.PotOfDesires, DefaultPotOfDesires); AddExecutor(ExecutorType.Activate, CardId.PotOfDesires, DefaultPotOfDesires);
AddExecutor(ExecutorType.Summon, CardId.AngelTrumpeter, AngelTrumpeterSummon); AddExecutor(ExecutorType.Summon, CardId.AngelTrumpeter, AngelTrumpeterSummon);
AddExecutor(ExecutorType.Summon, CardId.MegalosmasherX, MegalosmasherXSummon); AddExecutor(ExecutorType.Summon, CardId.MegalosmasherX, MegalosmasherXSummon);
AddExecutor(ExecutorType.Summon, CardId.MasterPendulumTheDracoslayer, MasterPendulumTheDracoslayerSummon); AddExecutor(ExecutorType.Summon, CardId.MasterPendulumTheDracoslayer, MasterPendulumTheDracoslayerSummon);
AddExecutor(ExecutorType.Summon, CardId.MysteryShellDragon, MysteryShellDragonSummon); AddExecutor(ExecutorType.Summon, CardId.MysteryShellDragon, MysteryShellDragonSummon);
AddExecutor(ExecutorType.Summon, CardId.PhantomGryphon, PhantomGryphonSummon); AddExecutor(ExecutorType.Summon, CardId.PhantomGryphon, PhantomGryphonSummon);
AddExecutor(ExecutorType.Summon, CardId.MetalfoesGoldriver, MetalfoesGoldriverSummon); AddExecutor(ExecutorType.Summon, CardId.MetalfoesGoldriver, MetalfoesGoldriverSummon);
AddExecutor(ExecutorType.Summon, NormalSummon); AddExecutor(ExecutorType.Summon, NormalSummon);
AddExecutor(ExecutorType.SpSummon, CardId.IgnisterProminenceTheBlastingDracoslayer, IgnisterProminenceTheBlastingDracoslayerSummon); AddExecutor(ExecutorType.SpSummon, CardId.IgnisterProminenceTheBlastingDracoslayer, IgnisterProminenceTheBlastingDracoslayerSummon);
AddExecutor(ExecutorType.Activate, CardId.IgnisterProminenceTheBlastingDracoslayer, IgnisterProminenceTheBlastingDracoslayerEffect); AddExecutor(ExecutorType.Activate, CardId.IgnisterProminenceTheBlastingDracoslayer, IgnisterProminenceTheBlastingDracoslayerEffect);
AddExecutor(ExecutorType.SpSummon, CardId.GagagaCowboy, GagagaCowboySummon); AddExecutor(ExecutorType.SpSummon, CardId.GagagaCowboy, GagagaCowboySummon);
AddExecutor(ExecutorType.Activate, CardId.GagagaCowboy); AddExecutor(ExecutorType.Activate, CardId.GagagaCowboy);
AddExecutor(ExecutorType.SpSummon, CardId.EvilswarmExcitonKnight, DefaultEvilswarmExcitonKnightSummon); AddExecutor(ExecutorType.SpSummon, CardId.EvilswarmExcitonKnight, DefaultEvilswarmExcitonKnightSummon);
AddExecutor(ExecutorType.Activate, CardId.EvilswarmExcitonKnight, DefaultEvilswarmExcitonKnightEffect); AddExecutor(ExecutorType.Activate, CardId.EvilswarmExcitonKnight, DefaultEvilswarmExcitonKnightEffect);
AddExecutor(ExecutorType.SpSummon, CardId.EvolzarLaggia, EvolzarLaggiaSummon); AddExecutor(ExecutorType.SpSummon, CardId.EvolzarLaggia, EvolzarLaggiaSummon);
AddExecutor(ExecutorType.Activate, CardId.EvolzarLaggia, EvolzarLaggiaEffect); AddExecutor(ExecutorType.Activate, CardId.EvolzarLaggia, EvolzarLaggiaEffect);
AddExecutor(ExecutorType.SpSummon, CardId.EvilswarmNightmare, EvilswarmNightmareSummon); AddExecutor(ExecutorType.SpSummon, CardId.EvilswarmNightmare, EvilswarmNightmareSummon);
AddExecutor(ExecutorType.Activate, CardId.EvilswarmNightmare); AddExecutor(ExecutorType.Activate, CardId.EvilswarmNightmare);
AddExecutor(ExecutorType.SpSummon, CardId.StarliegePaladynamo, StarliegePaladynamoSummon); AddExecutor(ExecutorType.SpSummon, CardId.StarliegePaladynamo, StarliegePaladynamoSummon);
AddExecutor(ExecutorType.Activate, CardId.StarliegePaladynamo, StarliegePaladynamoEffect); AddExecutor(ExecutorType.Activate, CardId.StarliegePaladynamo, StarliegePaladynamoEffect);
AddExecutor(ExecutorType.SpSummon, CardId.LightningChidori, LightningChidoriSummon); AddExecutor(ExecutorType.SpSummon, CardId.LightningChidori, LightningChidoriSummon);
AddExecutor(ExecutorType.Activate, CardId.LightningChidori, LightningChidoriEffect); AddExecutor(ExecutorType.Activate, CardId.LightningChidori, LightningChidoriEffect);
AddExecutor(ExecutorType.SpSummon, CardId.Number37HopeWovenDragonSpiderShark, Number37HopeWovenDragonSpiderSharkSummon); AddExecutor(ExecutorType.SpSummon, CardId.Number37HopeWovenDragonSpiderShark, Number37HopeWovenDragonSpiderSharkSummon);
AddExecutor(ExecutorType.Activate, CardId.Number37HopeWovenDragonSpiderShark); AddExecutor(ExecutorType.Activate, CardId.Number37HopeWovenDragonSpiderShark);
AddExecutor(ExecutorType.SpSummon, CardId.TraptrixRafflesia, TraptrixRafflesiaSummon); AddExecutor(ExecutorType.SpSummon, CardId.TraptrixRafflesia, TraptrixRafflesiaSummon);
AddExecutor(ExecutorType.Activate, CardId.TraptrixRafflesia); AddExecutor(ExecutorType.Activate, CardId.TraptrixRafflesia);
AddExecutor(ExecutorType.Activate, CardId.SmashingGround, DefaultSmashingGround); AddExecutor(ExecutorType.Activate, CardId.SmashingGround, DefaultSmashingGround);
AddExecutor(ExecutorType.SpSummon, CardId.CastelTheSkyblasterMusketeer, DefaultCastelTheSkyblasterMusketeerSummon); AddExecutor(ExecutorType.SpSummon, CardId.CastelTheSkyblasterMusketeer, DefaultCastelTheSkyblasterMusketeerSummon);
AddExecutor(ExecutorType.Activate, CardId.CastelTheSkyblasterMusketeer, DefaultCastelTheSkyblasterMusketeerEffect); AddExecutor(ExecutorType.Activate, CardId.CastelTheSkyblasterMusketeer, DefaultCastelTheSkyblasterMusketeerEffect);
AddExecutor(ExecutorType.SpSummon, CardId.IgnisterProminenceTheBlastingDracoslayer, IgnisterProminenceTheBlastingDracoslayerSummon); AddExecutor(ExecutorType.SpSummon, CardId.IgnisterProminenceTheBlastingDracoslayer, IgnisterProminenceTheBlastingDracoslayerSummon);
AddExecutor(ExecutorType.Activate, CardId.IgnisterProminenceTheBlastingDracoslayer, IgnisterProminenceTheBlastingDracoslayerEffect); AddExecutor(ExecutorType.Activate, CardId.IgnisterProminenceTheBlastingDracoslayer, IgnisterProminenceTheBlastingDracoslayerEffect);
AddExecutor(ExecutorType.SpSummon, CardId.ScarlightRedDragonArchfiend, DefaultScarlightRedDragonArchfiendSummon); AddExecutor(ExecutorType.SpSummon, CardId.ScarlightRedDragonArchfiend, DefaultScarlightRedDragonArchfiendSummon);
AddExecutor(ExecutorType.Activate, CardId.ScarlightRedDragonArchfiend, DefaultScarlightRedDragonArchfiendEffect); AddExecutor(ExecutorType.Activate, CardId.ScarlightRedDragonArchfiend, DefaultScarlightRedDragonArchfiendEffect);
AddExecutor(ExecutorType.SpSummon, CardId.Number39Utopia, DefaultNumberS39UtopiaTheLightningSummon); AddExecutor(ExecutorType.SpSummon, CardId.Number39Utopia, DefaultNumberS39UtopiaTheLightningSummon);
AddExecutor(ExecutorType.SpSummon, CardId.NumberS39UtopiatheLightning); AddExecutor(ExecutorType.SpSummon, CardId.NumberS39UtopiatheLightning);
AddExecutor(ExecutorType.Activate, CardId.NumberS39UtopiatheLightning); AddExecutor(ExecutorType.Activate, CardId.NumberS39UtopiatheLightning);
AddExecutor(ExecutorType.SpSummon, CardId.StardustDragon, DefaultStardustDragonSummon); AddExecutor(ExecutorType.SpSummon, CardId.StardustDragon, DefaultStardustDragonSummon);
AddExecutor(ExecutorType.Activate, CardId.StardustDragon, DefaultStardustDragonEffect); AddExecutor(ExecutorType.Activate, CardId.StardustDragon, DefaultStardustDragonEffect);
AddExecutor(ExecutorType.SpSummon, CardId.Number59CrookedCook, Number59CrookedCookSummon); AddExecutor(ExecutorType.SpSummon, CardId.Number59CrookedCook, Number59CrookedCookSummon);
AddExecutor(ExecutorType.Activate, CardId.Number59CrookedCook, Number59CrookedCookEffect); AddExecutor(ExecutorType.Activate, CardId.Number59CrookedCook, Number59CrookedCookEffect);
AddExecutor(ExecutorType.SpellSet, CardId.StarlightRoad, TrapSet); AddExecutor(ExecutorType.SpellSet, CardId.StarlightRoad, TrapSet);
AddExecutor(ExecutorType.SpellSet, CardId.QuakingMirrorForce, TrapSet); AddExecutor(ExecutorType.SpellSet, CardId.QuakingMirrorForce, TrapSet);
AddExecutor(ExecutorType.SpellSet, CardId.DrowningMirrorForce, TrapSet); AddExecutor(ExecutorType.SpellSet, CardId.DrowningMirrorForce, TrapSet);
AddExecutor(ExecutorType.SpellSet, CardId.BlazingMirrorForce, TrapSet); AddExecutor(ExecutorType.SpellSet, CardId.BlazingMirrorForce, TrapSet);
AddExecutor(ExecutorType.SpellSet, CardId.StormingMirrorForce, TrapSet); AddExecutor(ExecutorType.SpellSet, CardId.StormingMirrorForce, TrapSet);
AddExecutor(ExecutorType.SpellSet, CardId.MirrorForce, TrapSet); AddExecutor(ExecutorType.SpellSet, CardId.MirrorForce, TrapSet);
AddExecutor(ExecutorType.SpellSet, CardId.DarkMirrorForce, TrapSet); AddExecutor(ExecutorType.SpellSet, CardId.DarkMirrorForce, TrapSet);
AddExecutor(ExecutorType.SpellSet, CardId.BottomlessTrapHole, TrapSet); AddExecutor(ExecutorType.SpellSet, CardId.BottomlessTrapHole, TrapSet);
AddExecutor(ExecutorType.SpellSet, CardId.TraptrixTrapHoleNightmare, TrapSet); AddExecutor(ExecutorType.SpellSet, CardId.TraptrixTrapHoleNightmare, TrapSet);
AddExecutor(ExecutorType.Activate, CardId.StarlightRoad, DefaultTrap); AddExecutor(ExecutorType.Activate, CardId.StarlightRoad, DefaultTrap);
AddExecutor(ExecutorType.Activate, CardId.QuakingMirrorForce, DefaultUniqueTrap); AddExecutor(ExecutorType.Activate, CardId.QuakingMirrorForce, DefaultUniqueTrap);
AddExecutor(ExecutorType.Activate, CardId.DrowningMirrorForce, DefaultUniqueTrap); AddExecutor(ExecutorType.Activate, CardId.DrowningMirrorForce, DefaultUniqueTrap);
AddExecutor(ExecutorType.Activate, CardId.BlazingMirrorForce, DefaultUniqueTrap); AddExecutor(ExecutorType.Activate, CardId.BlazingMirrorForce, DefaultUniqueTrap);
AddExecutor(ExecutorType.Activate, CardId.StormingMirrorForce, DefaultUniqueTrap); AddExecutor(ExecutorType.Activate, CardId.StormingMirrorForce, DefaultUniqueTrap);
AddExecutor(ExecutorType.Activate, CardId.MirrorForce, DefaultUniqueTrap); AddExecutor(ExecutorType.Activate, CardId.MirrorForce, DefaultUniqueTrap);
AddExecutor(ExecutorType.Activate, CardId.DarkMirrorForce, DefaultUniqueTrap); AddExecutor(ExecutorType.Activate, CardId.DarkMirrorForce, DefaultUniqueTrap);
AddExecutor(ExecutorType.Activate, CardId.BottomlessTrapHole, DefaultUniqueTrap); AddExecutor(ExecutorType.Activate, CardId.BottomlessTrapHole, DefaultUniqueTrap);
AddExecutor(ExecutorType.Activate, CardId.TraptrixTrapHoleNightmare, DefaultUniqueTrap); AddExecutor(ExecutorType.Activate, CardId.TraptrixTrapHoleNightmare, DefaultUniqueTrap);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos); AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
} }
public override void OnNewTurn() public override void OnNewTurn()
{ {
NormalSummoned = false; NormalSummoned = false;
} }
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender) public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
{ {
if (!defender.IsMonsterHasPreventActivationEffectInBattle()) if (!defender.IsMonsterHasPreventActivationEffectInBattle())
{ {
if (Bot.HasInMonstersZone(CardId.Number37HopeWovenDragonSpiderShark, true, true)) if (Bot.HasInMonstersZone(CardId.Number37HopeWovenDragonSpiderShark, true, true))
attacker.RealPower = attacker.RealPower + 1000; attacker.RealPower = attacker.RealPower + 1000;
} }
return base.OnPreBattleBetween(attacker, defender); return base.OnPreBattleBetween(attacker, defender);
} }
private bool UnexpectedDaiEffect() public override IList<ClientCard> OnSelectXyzMaterial(IList<ClientCard> cards, int min, int max)
{ {
if (Bot.HasInHand(CardId.RescueRabbit) || NormalSummoned) // select cards with same name (summoned by rescue rabbit)
AI.SelectCard(new[] Logger.DebugWriteLine("OnSelectXyzMaterial " + cards.Count + " " + min + " " + max);
{ IList<ClientCard> result = new List<ClientCard>();
CardId.MysteryShellDragon, foreach (ClientCard card1 in cards)
CardId.PhantomGryphon, {
CardId.MegalosmasherX foreach (ClientCard card2 in cards)
}); {
else if (AI.Utils.IsTurn1OrMain2()) if (card1.Id == card2.Id && !card1.Equals(card2))
{ {
if (Bot.HasInHand(CardId.MysteryShellDragon)) result.Add(card1);
AI.SelectCard(CardId.MysteryShellDragon); result.Add(card2);
else if (Bot.HasInHand(CardId.MegalosmasherX)) break;
AI.SelectCard(CardId.MegalosmasherX); }
else if (Bot.HasInHand(CardId.AngelTrumpeter)) }
AI.SelectCard(CardId.AngelTrumpeter); if (result.Count > 0)
} break;
else }
{ AI.Utils.CheckSelectCount(result, cards, min, max);
if (Bot.HasInHand(CardId.MegalosmasherX)) return result;
AI.SelectCard(CardId.MegalosmasherX); }
else if (Bot.HasInHand(CardId.MasterPendulumTheDracoslayer))
AI.SelectCard(CardId.MasterPendulumTheDracoslayer); private bool UnexpectedDaiEffect()
else if (Bot.HasInHand(CardId.PhantomGryphon)) {
AI.SelectCard(CardId.PhantomGryphon); if (Bot.HasInHand(CardId.RescueRabbit) || NormalSummoned)
else if (Bot.HasInHand(CardId.AngelTrumpeter)) AI.SelectCard(new[]
AI.SelectCard(new[] {
{ CardId.MysteryShellDragon,
CardId.MetalfoesGoldriver, CardId.PhantomGryphon,
CardId.MasterPendulumTheDracoslayer CardId.MegalosmasherX
}); });
} else if (AI.Utils.IsTurn1OrMain2())
return true; {
} if (Bot.HasInHand(CardId.MysteryShellDragon))
AI.SelectCard(CardId.MysteryShellDragon);
private bool RescueRabbitEffect() else if (Bot.HasInHand(CardId.MegalosmasherX))
{ AI.SelectCard(CardId.MegalosmasherX);
if (AI.Utils.IsTurn1OrMain2()) else if (Bot.HasInHand(CardId.AngelTrumpeter))
{ AI.SelectCard(CardId.AngelTrumpeter);
AI.SelectCard(new[] }
{ else
CardId.MegalosmasherX, {
CardId.MysteryShellDragon if (Bot.HasInHand(CardId.MegalosmasherX))
}); AI.SelectCard(CardId.MegalosmasherX);
} else if (Bot.HasInHand(CardId.MasterPendulumTheDracoslayer))
else AI.SelectCard(CardId.MasterPendulumTheDracoslayer);
{ else if (Bot.HasInHand(CardId.PhantomGryphon))
AI.SelectCard(new[] AI.SelectCard(CardId.PhantomGryphon);
{ else if (Bot.HasInHand(CardId.AngelTrumpeter))
CardId.MasterPendulumTheDracoslayer, AI.SelectCard(new[]
CardId.PhantomGryphon, {
CardId.MegalosmasherX, CardId.MetalfoesGoldriver,
CardId.MetalfoesGoldriver, CardId.MasterPendulumTheDracoslayer
CardId.AngelTrumpeter });
}); }
} return true;
return true; }
}
private bool RescueRabbitEffect()
private bool MysteryShellDragonSummon() {
{ if (AI.Utils.IsTurn1OrMain2())
return Bot.HasInMonstersZone(CardId.MysteryShellDragon); {
} AI.SelectCard(new[]
private bool PhantomGryphonSummon() {
{ CardId.MegalosmasherX,
return Bot.HasInMonstersZone(CardId.PhantomGryphon); CardId.MysteryShellDragon
} });
private bool MasterPendulumTheDracoslayerSummon() }
{ else
return Bot.HasInMonstersZone(CardId.MasterPendulumTheDracoslayer); {
} AI.SelectCard(new[]
private bool AngelTrumpeterSummon() {
{ CardId.MasterPendulumTheDracoslayer,
return Bot.HasInMonstersZone(CardId.AngelTrumpeter); CardId.PhantomGryphon,
} CardId.MegalosmasherX,
private bool MetalfoesGoldriverSummon() CardId.MetalfoesGoldriver,
{ CardId.AngelTrumpeter
return Bot.HasInMonstersZone(CardId.MetalfoesGoldriver); });
} }
private bool MegalosmasherXSummon() return true;
{ }
return Bot.HasInMonstersZone(CardId.MegalosmasherX);
} private bool MysteryShellDragonSummon()
private bool NormalSummon() {
{ return Bot.HasInMonstersZone(CardId.MysteryShellDragon);
return true; }
} private bool PhantomGryphonSummon()
{
private bool GagagaCowboySummon() return Bot.HasInMonstersZone(CardId.PhantomGryphon);
{ }
if (Duel.LifePoints[1] <= 800) private bool MasterPendulumTheDracoslayerSummon()
{ {
AI.SelectPosition(CardPosition.FaceUpDefence); return Bot.HasInMonstersZone(CardId.MasterPendulumTheDracoslayer);
return true; }
} private bool AngelTrumpeterSummon()
return false; {
} return Bot.HasInMonstersZone(CardId.AngelTrumpeter);
}
private bool IgnisterProminenceTheBlastingDracoslayerSummon() private bool MetalfoesGoldriverSummon()
{ {
return AI.Utils.GetProblematicEnemyCard() != null; return Bot.HasInMonstersZone(CardId.MetalfoesGoldriver);
} }
private bool MegalosmasherXSummon()
private bool IgnisterProminenceTheBlastingDracoslayerEffect() {
{ return Bot.HasInMonstersZone(CardId.MegalosmasherX);
if (ActivateDescription == AI.Utils.GetStringId(CardId.IgnisterProminenceTheBlastingDracoslayer, 1)) }
return true; private bool NormalSummon()
ClientCard target1 = null; {
ClientCard target2 = AI.Utils.GetProblematicEnemyCard(); return true;
List<ClientCard> spells = Enemy.GetSpells(); }
foreach (ClientCard spell in spells)
{ private bool GagagaCowboySummon()
if (spell.HasType(CardType.Pendulum) && !spell.Equals(target2)) {
{ if (Duel.LifePoints[1] <= 800)
target1 = spell; {
break; AI.SelectPosition(CardPosition.FaceUpDefence);
} return true;
} }
List<ClientCard> monsters = Enemy.GetMonsters(); return false;
foreach (ClientCard monster in monsters) }
{
if (monster.HasType(CardType.Pendulum) && !monster.Equals(target2)) private bool IgnisterProminenceTheBlastingDracoslayerSummon()
{ {
target1 = monster; return AI.Utils.GetProblematicEnemyCard() != null;
break; }
}
} private bool IgnisterProminenceTheBlastingDracoslayerEffect()
if (target2 == null && target1 != null) {
{ if (ActivateDescription == AI.Utils.GetStringId(CardId.IgnisterProminenceTheBlastingDracoslayer, 1))
foreach (ClientCard spell in spells) return true;
{ ClientCard target1 = null;
if (!spell.Equals(target1)) ClientCard target2 = AI.Utils.GetProblematicEnemyCard();
{ List<ClientCard> spells = Enemy.GetSpells();
target2 = spell; foreach (ClientCard spell in spells)
break; {
} if (spell.HasType(CardType.Pendulum) && !spell.Equals(target2))
} {
foreach (ClientCard monster in monsters) target1 = spell;
{ break;
if (!monster.Equals(target1)) }
{ }
target2 = monster; List<ClientCard> monsters = Enemy.GetMonsters();
break; foreach (ClientCard monster in monsters)
} {
} if (monster.HasType(CardType.Pendulum) && !monster.Equals(target2))
} {
if (target2 == null) target1 = monster;
return false; break;
AI.SelectCard(target1); }
AI.SelectNextCard(target2); }
return true; if (target2 == null && target1 != null)
} {
foreach (ClientCard spell in spells)
private bool Number37HopeWovenDragonSpiderSharkSummon() {
{ if (!spell.Equals(target1))
return AI.Utils.IsAllEnemyBetterThanValue(1700, false) && !AI.Utils.IsOneEnemyBetterThanValue(3600, true); {
} target2 = spell;
break;
private bool LightningChidoriSummon() }
{ }
foreach (ClientCard monster in Enemy.GetMonsters()) foreach (ClientCard monster in monsters)
{ {
if (monster.IsFacedown()) if (!monster.Equals(target1))
{ {
return true; target2 = monster;
} break;
} }
foreach (ClientCard spell in Enemy.GetSpells()) }
{ }
if (spell.IsFacedown()) if (target2 == null)
{ return false;
return true; AI.SelectCard(target1);
} AI.SelectNextCard(target2);
} return true;
}
return AI.Utils.GetProblematicEnemyCard() != null;
} private bool Number37HopeWovenDragonSpiderSharkSummon()
{
private bool LightningChidoriEffect() return AI.Utils.IsAllEnemyBetterThanValue(1700, false) && !AI.Utils.IsOneEnemyBetterThanValue(3600, true);
{ }
ClientCard problematicCard = AI.Utils.GetProblematicEnemyCard();
AI.SelectNextCard(problematicCard); private bool LightningChidoriSummon()
return true; {
} foreach (ClientCard monster in Enemy.GetMonsters())
{
private bool EvolzarLaggiaSummon() if (monster.IsFacedown())
{ {
return (AI.Utils.IsAllEnemyBetterThanValue(2000, false) && !AI.Utils.IsOneEnemyBetterThanValue(2400, true)) || AI.Utils.IsTurn1OrMain2(); return true;
} }
}
private bool EvilswarmNightmareSummon() foreach (ClientCard spell in Enemy.GetSpells())
{ {
if (AI.Utils.IsTurn1OrMain2()) if (spell.IsFacedown())
{ {
AI.SelectPosition(CardPosition.FaceUpDefence); return true;
return true; }
} }
return false;
} return AI.Utils.GetProblematicEnemyCard() != null;
}
private bool TraptrixRafflesiaSummon()
{ private bool LightningChidoriEffect()
if (AI.Utils.IsTurn1OrMain2() && (Bot.GetRemainingCount(CardId.BottomlessTrapHole, 1) + Bot.GetRemainingCount(CardId.TraptrixTrapHoleNightmare, 1)) > 0) {
{ ClientCard problematicCard = AI.Utils.GetProblematicEnemyCard();
AI.SelectPosition(CardPosition.FaceUpDefence); AI.SelectNextCard(problematicCard);
return true; return true;
} }
return false;
} private bool EvolzarLaggiaSummon()
{
private bool Number59CrookedCookSummon() return (AI.Utils.IsAllEnemyBetterThanValue(2000, false) && !AI.Utils.IsOneEnemyBetterThanValue(2400, true)) || AI.Utils.IsTurn1OrMain2();
{ }
return ((Bot.GetMonsterCount() + Bot.GetSpellCount() - 2) <= 1) &&
((AI.Utils.IsOneEnemyBetter() && !AI.Utils.IsOneEnemyBetterThanValue(2300, true)) || AI.Utils.IsTurn1OrMain2()); private bool EvilswarmNightmareSummon()
} {
if (AI.Utils.IsTurn1OrMain2())
private bool Number59CrookedCookEffect() {
{ AI.SelectPosition(CardPosition.FaceUpDefence);
if (Duel.Player == 0) return true;
{ }
if (AI.Utils.IsChainTarget(Card)) return false;
return true; }
}
else private bool TraptrixRafflesiaSummon()
{ {
if ((Bot.GetMonsterCount() + Bot.GetSpellCount() -1) <= 1) if (AI.Utils.IsTurn1OrMain2() && (Bot.GetRemainingCount(CardId.BottomlessTrapHole, 1) + Bot.GetRemainingCount(CardId.TraptrixTrapHoleNightmare, 1)) > 0)
return true; {
} AI.SelectPosition(CardPosition.FaceUpDefence);
return false; return true;
} }
return false;
private bool EvolzarLaggiaEffect() }
{
return DefaultTrap(); private bool Number59CrookedCookSummon()
} {
return ((Bot.GetMonsterCount() + Bot.GetSpellCount() - 2) <= 1) &&
private bool StarliegePaladynamoSummon() ((AI.Utils.IsOneEnemyBetter() && !AI.Utils.IsOneEnemyBetterThanValue(2300, true)) || AI.Utils.IsTurn1OrMain2());
{ }
return StarliegePaladynamoEffect();
} private bool Number59CrookedCookEffect()
{
private bool StarliegePaladynamoEffect() if (Duel.Player == 0)
{ {
ClientCard result = AI.Utils.GetOneEnemyBetterThanValue(2000, true); if (AI.Utils.IsChainTarget(Card))
if (result != null) return true;
{ }
AI.SelectNextCard(result); else
return true; {
} if ((Bot.GetMonsterCount() + Bot.GetSpellCount() -1) <= 1)
return false; return true;
} }
return false;
private bool TrapSet() }
{
return !Bot.HasInMonstersZone(CardId.Number59CrookedCook, true, true); private bool EvolzarLaggiaEffect()
} {
} return DefaultTrap();
} }
private bool StarliegePaladynamoSummon()
{
return StarliegePaladynamoEffect();
}
private bool StarliegePaladynamoEffect()
{
ClientCard result = AI.Utils.GetOneEnemyBetterThanValue(2000, true);
if (result != null)
{
AI.SelectNextCard(result);
return true;
}
return false;
}
private bool TrapSet()
{
return !Bot.HasInMonstersZone(CardId.Number59CrookedCook, true, true);
}
}
}
...@@ -118,6 +118,19 @@ namespace WindBot.Game.AI.Decks ...@@ -118,6 +118,19 @@ namespace WindBot.Game.AI.Decks
Number61VolcasaurusUsed = false; Number61VolcasaurusUsed = false;
} }
public override IList<ClientCard> OnSelectXyzMaterial(IList<ClientCard> cards, int min, int max)
{
IList<ClientCard> result = new List<ClientCard>();
AI.Utils.SelectPreferredCards(result, new[] {
CardId.MistArchfiend,
CardId.PanzerDragon,
CardId.SolarWindJammer,
CardId.StarDrawing
}, cards, min, max);
AI.Utils.CheckSelectCount(result, cards, min, max);
return result;
}
private bool NormalSummon() private bool NormalSummon()
{ {
NormalSummoned = true; NormalSummoned = true;
......
using YGOSharp.OCGWrapper.Enums; using YGOSharp.OCGWrapper.Enums;
using System.Collections.Generic; using System.Collections.Generic;
using WindBot; using WindBot;
using WindBot.Game; using WindBot.Game;
using WindBot.Game.AI; using WindBot.Game.AI;
namespace WindBot.Game.AI.Decks namespace WindBot.Game.AI.Decks
{ {
[Deck("Toadally Awesome", "AI_ToadallyAwesome", "OutDated")] [Deck("Toadally Awesome", "AI_ToadallyAwesome", "OutDated")]
public class ToadallyAwesomeExecutor : DefaultExecutor public class ToadallyAwesomeExecutor : DefaultExecutor
{ {
public class CardId public class CardId
{ {
public const int CryomancerOfTheIceBarrier = 23950192; public const int CryomancerOfTheIceBarrier = 23950192;
public const int DewdarkOfTheIceBarrier = 90311614; public const int DewdarkOfTheIceBarrier = 90311614;
public const int SwapFrog = 9126351; public const int SwapFrog = 9126351;
public const int PriorOfTheIceBarrier = 50088247; public const int PriorOfTheIceBarrier = 50088247;
public const int Ronintoadin = 1357146; public const int Ronintoadin = 1357146;
public const int DupeFrog = 46239604; public const int DupeFrog = 46239604;
public const int GraydleSlimeJr = 80250319; public const int GraydleSlimeJr = 80250319;
public const int GalaxyCyclone = 5133471; public const int GalaxyCyclone = 5133471;
public const int HarpiesFeatherDuster = 18144506; public const int HarpiesFeatherDuster = 18144506;
public const int Surface = 33057951; public const int Surface = 33057951;
public const int DarkHole = 53129443; public const int DarkHole = 53129443;
public const int CardDestruction = 72892473; public const int CardDestruction = 72892473;
public const int FoolishBurial = 81439173; public const int FoolishBurial = 81439173;
public const int MonsterReborn = 83764718; public const int MonsterReborn = 83764718;
public const int MedallionOfTheIceBarrier = 84206435; public const int MedallionOfTheIceBarrier = 84206435;
public const int Salvage = 96947648; public const int Salvage = 96947648;
public const int AquariumStage = 29047353; public const int AquariumStage = 29047353;
public const int HeraldOfTheArcLight = 79606837; public const int HeraldOfTheArcLight = 79606837;
public const int ToadallyAwesome = 90809975; public const int ToadallyAwesome = 90809975;
public const int SkyCavalryCentaurea = 36776089; public const int SkyCavalryCentaurea = 36776089;
public const int DaigustoPhoenix = 2766877; public const int DaigustoPhoenix = 2766877;
public const int CatShark = 84224627; public const int CatShark = 84224627;
public const int MysticalSpaceTyphoon = 5318639; public const int MysticalSpaceTyphoon = 5318639;
public const int BookOfMoon = 14087893; public const int BookOfMoon = 14087893;
public const int CallOfTheHaunted = 97077563; public const int CallOfTheHaunted = 97077563;
public const int TorrentialTribute = 53582587; public const int TorrentialTribute = 53582587;
} }
public ToadallyAwesomeExecutor(GameAI ai, Duel duel) public ToadallyAwesomeExecutor(GameAI ai, Duel duel)
: base(ai, duel) : base(ai, duel)
{ {
AddExecutor(ExecutorType.Activate, CardId.HarpiesFeatherDuster, DefaultHarpiesFeatherDusterFirst); AddExecutor(ExecutorType.Activate, CardId.HarpiesFeatherDuster, DefaultHarpiesFeatherDusterFirst);
AddExecutor(ExecutorType.Activate, CardId.GalaxyCyclone, DefaultGalaxyCyclone); AddExecutor(ExecutorType.Activate, CardId.GalaxyCyclone, DefaultGalaxyCyclone);
AddExecutor(ExecutorType.Activate, CardId.HarpiesFeatherDuster); AddExecutor(ExecutorType.Activate, CardId.HarpiesFeatherDuster);
AddExecutor(ExecutorType.Activate, CardId.DarkHole, DefaultDarkHole); AddExecutor(ExecutorType.Activate, CardId.DarkHole, DefaultDarkHole);
AddExecutor(ExecutorType.Activate, CardId.AquariumStage, AquariumStageEffect); AddExecutor(ExecutorType.Activate, CardId.AquariumStage, AquariumStageEffect);
AddExecutor(ExecutorType.Activate, CardId.MedallionOfTheIceBarrier, MedallionOfTheIceBarrierEffect); AddExecutor(ExecutorType.Activate, CardId.MedallionOfTheIceBarrier, MedallionOfTheIceBarrierEffect);
AddExecutor(ExecutorType.Activate, CardId.FoolishBurial, FoolishBurialEffect); AddExecutor(ExecutorType.Activate, CardId.FoolishBurial, FoolishBurialEffect);
AddExecutor(ExecutorType.SpSummon, CardId.PriorOfTheIceBarrier); AddExecutor(ExecutorType.SpSummon, CardId.PriorOfTheIceBarrier);
AddExecutor(ExecutorType.Summon, CardId.GraydleSlimeJr, GraydleSlimeJrSummon); AddExecutor(ExecutorType.Summon, CardId.GraydleSlimeJr, GraydleSlimeJrSummon);
AddExecutor(ExecutorType.SpSummon, CardId.SwapFrog, SwapFrogSpsummon); AddExecutor(ExecutorType.SpSummon, CardId.SwapFrog, SwapFrogSpsummon);
AddExecutor(ExecutorType.Activate, CardId.SwapFrog, SwapFrogEffect); AddExecutor(ExecutorType.Activate, CardId.SwapFrog, SwapFrogEffect);
AddExecutor(ExecutorType.Activate, CardId.GraydleSlimeJr, GraydleSlimeJrEffect); AddExecutor(ExecutorType.Activate, CardId.GraydleSlimeJr, GraydleSlimeJrEffect);
AddExecutor(ExecutorType.Activate, CardId.Ronintoadin, RonintoadinEffect); AddExecutor(ExecutorType.Activate, CardId.Ronintoadin, RonintoadinEffect);
AddExecutor(ExecutorType.Activate, CardId.PriorOfTheIceBarrier); AddExecutor(ExecutorType.Activate, CardId.PriorOfTheIceBarrier);
AddExecutor(ExecutorType.Activate, CardId.DupeFrog); AddExecutor(ExecutorType.Activate, CardId.DupeFrog);
AddExecutor(ExecutorType.Activate, CardId.Surface, SurfaceEffect); AddExecutor(ExecutorType.Activate, CardId.Surface, SurfaceEffect);
AddExecutor(ExecutorType.Activate, CardId.MonsterReborn, SurfaceEffect); AddExecutor(ExecutorType.Activate, CardId.MonsterReborn, SurfaceEffect);
AddExecutor(ExecutorType.Activate, CardId.Salvage, SalvageEffect); AddExecutor(ExecutorType.Activate, CardId.Salvage, SalvageEffect);
AddExecutor(ExecutorType.Summon, CardId.SwapFrog); AddExecutor(ExecutorType.Summon, CardId.SwapFrog);
AddExecutor(ExecutorType.Summon, CardId.DewdarkOfTheIceBarrier, IceBarrierSummon); AddExecutor(ExecutorType.Summon, CardId.DewdarkOfTheIceBarrier, IceBarrierSummon);
AddExecutor(ExecutorType.Summon, CardId.CryomancerOfTheIceBarrier, IceBarrierSummon); AddExecutor(ExecutorType.Summon, CardId.CryomancerOfTheIceBarrier, IceBarrierSummon);
AddExecutor(ExecutorType.Activate, CardId.CardDestruction); AddExecutor(ExecutorType.Activate, CardId.CardDestruction);
AddExecutor(ExecutorType.Summon, CardId.GraydleSlimeJr, NormalSummon); AddExecutor(ExecutorType.Summon, CardId.GraydleSlimeJr, NormalSummon);
AddExecutor(ExecutorType.Summon, CardId.PriorOfTheIceBarrier, NormalSummon); AddExecutor(ExecutorType.Summon, CardId.PriorOfTheIceBarrier, NormalSummon);
AddExecutor(ExecutorType.Summon, CardId.Ronintoadin, NormalSummon); AddExecutor(ExecutorType.Summon, CardId.Ronintoadin, NormalSummon);
AddExecutor(ExecutorType.Summon, CardId.DupeFrog, NormalSummon); AddExecutor(ExecutorType.Summon, CardId.DupeFrog, NormalSummon);
AddExecutor(ExecutorType.Summon, CardId.PriorOfTheIceBarrier, PriorOfTheIceBarrierSummon); AddExecutor(ExecutorType.Summon, CardId.PriorOfTheIceBarrier, PriorOfTheIceBarrierSummon);
AddExecutor(ExecutorType.SpSummon, CardId.CatShark, CatSharkSummon); AddExecutor(ExecutorType.SpSummon, CardId.CatShark, CatSharkSummon);
AddExecutor(ExecutorType.Activate, CardId.CatShark, CatSharkEffect); AddExecutor(ExecutorType.Activate, CardId.CatShark, CatSharkEffect);
AddExecutor(ExecutorType.SpSummon, CardId.SkyCavalryCentaurea, SkyCavalryCentaureaSummon); AddExecutor(ExecutorType.SpSummon, CardId.SkyCavalryCentaurea, SkyCavalryCentaureaSummon);
AddExecutor(ExecutorType.Activate, CardId.SkyCavalryCentaurea); AddExecutor(ExecutorType.Activate, CardId.SkyCavalryCentaurea);
AddExecutor(ExecutorType.SpSummon, CardId.DaigustoPhoenix, DaigustoPhoenixSummon); AddExecutor(ExecutorType.SpSummon, CardId.DaigustoPhoenix, DaigustoPhoenixSummon);
AddExecutor(ExecutorType.Activate, CardId.DaigustoPhoenix); AddExecutor(ExecutorType.Activate, CardId.DaigustoPhoenix);
AddExecutor(ExecutorType.SpSummon, CardId.ToadallyAwesome); AddExecutor(ExecutorType.SpSummon, CardId.ToadallyAwesome);
AddExecutor(ExecutorType.Activate, CardId.ToadallyAwesome, ToadallyAwesomeEffect); AddExecutor(ExecutorType.Activate, CardId.ToadallyAwesome, ToadallyAwesomeEffect);
AddExecutor(ExecutorType.SpSummon, CardId.HeraldOfTheArcLight, HeraldOfTheArcLightSummon); AddExecutor(ExecutorType.SpSummon, CardId.HeraldOfTheArcLight, HeraldOfTheArcLightSummon);
AddExecutor(ExecutorType.Activate, CardId.HeraldOfTheArcLight); AddExecutor(ExecutorType.Activate, CardId.HeraldOfTheArcLight);
AddExecutor(ExecutorType.MonsterSet, CardId.GraydleSlimeJr); AddExecutor(ExecutorType.MonsterSet, CardId.GraydleSlimeJr);
AddExecutor(ExecutorType.MonsterSet, CardId.DupeFrog); AddExecutor(ExecutorType.MonsterSet, CardId.DupeFrog);
AddExecutor(ExecutorType.MonsterSet, CardId.Ronintoadin); AddExecutor(ExecutorType.MonsterSet, CardId.Ronintoadin);
AddExecutor(ExecutorType.Repos, Repos); AddExecutor(ExecutorType.Repos, Repos);
// cards got by Toadall yAwesome // cards got by Toadally Awesome
AddExecutor(ExecutorType.Activate, CardId.MysticalSpaceTyphoon, DefaultMysticalSpaceTyphoon); AddExecutor(ExecutorType.Activate, CardId.MysticalSpaceTyphoon, DefaultMysticalSpaceTyphoon);
AddExecutor(ExecutorType.Activate, CardId.BookOfMoon, DefaultBookOfMoon); AddExecutor(ExecutorType.Activate, CardId.BookOfMoon, DefaultBookOfMoon);
AddExecutor(ExecutorType.Activate, CardId.CallOfTheHaunted, SurfaceEffect); AddExecutor(ExecutorType.Activate, CardId.CallOfTheHaunted, SurfaceEffect);
AddExecutor(ExecutorType.Activate, CardId.TorrentialTribute, DefaultTorrentialTribute); AddExecutor(ExecutorType.Activate, CardId.TorrentialTribute, DefaultTorrentialTribute);
AddExecutor(ExecutorType.Activate, OtherSpellEffect); AddExecutor(ExecutorType.Activate, OtherSpellEffect);
AddExecutor(ExecutorType.Activate, OtherTrapEffect); AddExecutor(ExecutorType.Activate, OtherTrapEffect);
AddExecutor(ExecutorType.Activate, OtherMonsterEffect); AddExecutor(ExecutorType.Activate, OtherMonsterEffect);
} }
public override bool OnSelectHand() public override bool OnSelectHand()
{ {
return true; return true;
} }
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender) public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
{ {
if (!defender.IsMonsterHasPreventActivationEffectInBattle()) if (!defender.IsMonsterHasPreventActivationEffectInBattle())
{ {
if (attacker.Id == CardId.SkyCavalryCentaurea && !attacker.IsDisabled() && attacker.HasXyzMaterial()) if (attacker.Id == CardId.SkyCavalryCentaurea && !attacker.IsDisabled() && attacker.HasXyzMaterial())
attacker.RealPower = Duel.LifePoints[0] + attacker.Attack; attacker.RealPower = Duel.LifePoints[0] + attacker.Attack;
} }
return base.OnPreBattleBetween(attacker, defender); return base.OnPreBattleBetween(attacker, defender);
} }
private bool MedallionOfTheIceBarrierEffect() private bool MedallionOfTheIceBarrierEffect()
{ {
if (Bot.HasInHand(new[] if (Bot.HasInHand(new[]
{ {
CardId.CryomancerOfTheIceBarrier, CardId.CryomancerOfTheIceBarrier,
CardId.DewdarkOfTheIceBarrier CardId.DewdarkOfTheIceBarrier
}) || Bot.HasInMonstersZone(new[] }) || Bot.HasInMonstersZone(new[]
{ {
CardId.CryomancerOfTheIceBarrier, CardId.CryomancerOfTheIceBarrier,
CardId.DewdarkOfTheIceBarrier CardId.DewdarkOfTheIceBarrier
})) }))
{ {
AI.SelectCard(CardId.PriorOfTheIceBarrier); AI.SelectCard(CardId.PriorOfTheIceBarrier);
} }
else else
{ {
AI.SelectCard(new[] AI.SelectCard(new[]
{ {
CardId.CryomancerOfTheIceBarrier, CardId.CryomancerOfTheIceBarrier,
CardId.DewdarkOfTheIceBarrier CardId.DewdarkOfTheIceBarrier
}); });
} }
return true; return true;
} }
private bool SurfaceEffect() private bool SurfaceEffect()
{ {
AI.SelectCard(new[] AI.SelectCard(new[]
{ {
CardId.ToadallyAwesome, CardId.ToadallyAwesome,
CardId.HeraldOfTheArcLight, CardId.HeraldOfTheArcLight,
CardId.SwapFrog, CardId.SwapFrog,
CardId.DewdarkOfTheIceBarrier, CardId.DewdarkOfTheIceBarrier,
CardId.CryomancerOfTheIceBarrier, CardId.CryomancerOfTheIceBarrier,
CardId.DupeFrog, CardId.DupeFrog,
CardId.Ronintoadin, CardId.Ronintoadin,
CardId.GraydleSlimeJr CardId.GraydleSlimeJr
}); });
return true; return true;
} }
private bool AquariumStageEffect() private bool AquariumStageEffect()
{ {
if (Card.Location == CardLocation.Grave) if (Card.Location == CardLocation.Grave)
{ {
AI.SelectPosition(CardPosition.FaceUpDefence); AI.SelectPosition(CardPosition.FaceUpDefence);
return SurfaceEffect(); return SurfaceEffect();
} }
return true; return true;
} }
private bool FoolishBurialEffect() private bool FoolishBurialEffect()
{ {
if (Bot.HasInHand(CardId.GraydleSlimeJr) && !Bot.HasInGraveyard(CardId.GraydleSlimeJr)) if (Bot.HasInHand(CardId.GraydleSlimeJr) && !Bot.HasInGraveyard(CardId.GraydleSlimeJr))
AI.SelectCard(CardId.GraydleSlimeJr); AI.SelectCard(CardId.GraydleSlimeJr);
else if (Bot.HasInGraveyard(CardId.Ronintoadin) && !Bot.HasInGraveyard(CardId.DupeFrog)) else if (Bot.HasInGraveyard(CardId.Ronintoadin) && !Bot.HasInGraveyard(CardId.DupeFrog))
AI.SelectCard(CardId.DupeFrog); AI.SelectCard(CardId.DupeFrog);
else if (Bot.HasInGraveyard(CardId.DupeFrog) && !Bot.HasInGraveyard(CardId.Ronintoadin)) else if (Bot.HasInGraveyard(CardId.DupeFrog) && !Bot.HasInGraveyard(CardId.Ronintoadin))
AI.SelectCard(CardId.Ronintoadin); AI.SelectCard(CardId.Ronintoadin);
else else
AI.SelectCard(new[] AI.SelectCard(new[]
{ {
CardId.GraydleSlimeJr, CardId.GraydleSlimeJr,
CardId.Ronintoadin, CardId.Ronintoadin,
CardId.DupeFrog, CardId.DupeFrog,
CardId.CryomancerOfTheIceBarrier, CardId.CryomancerOfTheIceBarrier,
CardId.DewdarkOfTheIceBarrier, CardId.DewdarkOfTheIceBarrier,
CardId.PriorOfTheIceBarrier, CardId.PriorOfTheIceBarrier,
CardId.SwapFrog CardId.SwapFrog
}); });
return true; return true;
} }
private bool SalvageEffect() private bool SalvageEffect()
{ {
AI.SelectCard(new[] AI.SelectCard(new[]
{ {
CardId.SwapFrog, CardId.SwapFrog,
CardId.PriorOfTheIceBarrier, CardId.PriorOfTheIceBarrier,
CardId.GraydleSlimeJr CardId.GraydleSlimeJr
}); });
return true; return true;
} }
private bool SwapFrogSpsummon() private bool SwapFrogSpsummon()
{ {
if (Bot.GetCountCardInZone(Bot.Hand, CardId.GraydleSlimeJr)>=2 && !Bot.HasInGraveyard(CardId.GraydleSlimeJr)) if (Bot.GetCountCardInZone(Bot.Hand, CardId.GraydleSlimeJr)>=2 && !Bot.HasInGraveyard(CardId.GraydleSlimeJr))
AI.SelectCard(CardId.GraydleSlimeJr); AI.SelectCard(CardId.GraydleSlimeJr);
else if (Bot.HasInGraveyard(CardId.Ronintoadin) && !Bot.HasInGraveyard(CardId.DupeFrog)) else if (Bot.HasInGraveyard(CardId.Ronintoadin) && !Bot.HasInGraveyard(CardId.DupeFrog))
AI.SelectCard(CardId.DupeFrog); AI.SelectCard(CardId.DupeFrog);
else if (Bot.HasInGraveyard(CardId.DupeFrog) && !Bot.HasInGraveyard(CardId.Ronintoadin)) else if (Bot.HasInGraveyard(CardId.DupeFrog) && !Bot.HasInGraveyard(CardId.Ronintoadin))
AI.SelectCard(CardId.Ronintoadin); AI.SelectCard(CardId.Ronintoadin);
else else
AI.SelectCard(new[] AI.SelectCard(new[]
{ {
CardId.Ronintoadin, CardId.Ronintoadin,
CardId.DupeFrog, CardId.DupeFrog,
CardId.CryomancerOfTheIceBarrier, CardId.CryomancerOfTheIceBarrier,
CardId.DewdarkOfTheIceBarrier, CardId.DewdarkOfTheIceBarrier,
CardId.PriorOfTheIceBarrier, CardId.PriorOfTheIceBarrier,
CardId.GraydleSlimeJr, CardId.GraydleSlimeJr,
CardId.SwapFrog CardId.SwapFrog
}); });
return true; return true;
} }
private bool SwapFrogEffect() private bool SwapFrogEffect()
{ {
if (ActivateDescription == -1) if (ActivateDescription == -1)
{ {
return FoolishBurialEffect(); return FoolishBurialEffect();
} }
else else
{ {
if (Bot.HasInHand(CardId.DupeFrog)) if (Bot.HasInHand(CardId.DupeFrog))
{ {
AI.SelectCard(new[] AI.SelectCard(new[]
{ {
CardId.PriorOfTheIceBarrier, CardId.PriorOfTheIceBarrier,
CardId.GraydleSlimeJr, CardId.GraydleSlimeJr,
CardId.SwapFrog CardId.SwapFrog
}); });
return true; return true;
} }
} }
return false; return false;
} }
private bool GraydleSlimeJrSummon() private bool GraydleSlimeJrSummon()
{ {
return Bot.HasInGraveyard(CardId.GraydleSlimeJr); return Bot.HasInGraveyard(CardId.GraydleSlimeJr);
} }
private bool GraydleSlimeJrEffect() private bool GraydleSlimeJrEffect()
{ {
AI.SelectCard(CardId.GraydleSlimeJr); AI.SelectCard(CardId.GraydleSlimeJr);
AI.SelectPosition(CardPosition.FaceUpDefence); AI.SelectPosition(CardPosition.FaceUpDefence);
AI.SelectNextCard(new[] AI.SelectNextCard(new[]
{ {
CardId.SwapFrog, CardId.SwapFrog,
CardId.CryomancerOfTheIceBarrier, CardId.CryomancerOfTheIceBarrier,
CardId.DewdarkOfTheIceBarrier, CardId.DewdarkOfTheIceBarrier,
CardId.Ronintoadin, CardId.Ronintoadin,
CardId.DupeFrog, CardId.DupeFrog,
CardId.PriorOfTheIceBarrier, CardId.PriorOfTheIceBarrier,
CardId.GraydleSlimeJr CardId.GraydleSlimeJr
}); });
return true; return true;
} }
private bool RonintoadinEffect() private bool RonintoadinEffect()
{ {
AI.SelectPosition(CardPosition.FaceUpDefence); AI.SelectPosition(CardPosition.FaceUpDefence);
return true; return true;
} }
private bool NormalSummon() private bool NormalSummon()
{ {
foreach (ClientCard monster in Bot.GetMonsters()) foreach (ClientCard monster in Bot.GetMonsters())
{ {
if (monster.Level==2) if (monster.Level==2)
{ {
return true; return true;
} }
} }
return false; return false;
} }
private bool IceBarrierSummon() private bool IceBarrierSummon()
{ {
return Bot.GetCountCardInZone(Bot.Hand, CardId.PriorOfTheIceBarrier) > 0; return Bot.GetCountCardInZone(Bot.Hand, CardId.PriorOfTheIceBarrier) > 0;
} }
private bool PriorOfTheIceBarrierSummon() private bool PriorOfTheIceBarrierSummon()
{ {
return Bot.GetCountCardInZone(Bot.Hand, CardId.PriorOfTheIceBarrier) >= 2; return Bot.GetCountCardInZone(Bot.Hand, CardId.PriorOfTheIceBarrier) >= 2;
} }
private bool ToadallyAwesomeEffect() private bool ToadallyAwesomeEffect()
{ {
if (CurrentChain.Count > 0) if (CurrentChain.Count > 0)
{ {
// negate effect, select a cost for it // negate effect, select a cost for it
List<ClientCard> monsters = Bot.GetMonsters(); List<ClientCard> monsters = Bot.GetMonsters();
IList<int> suitableCost = new[] { IList<int> suitableCost = new[] {
CardId.SwapFrog, CardId.SwapFrog,
CardId.Ronintoadin, CardId.Ronintoadin,
CardId.GraydleSlimeJr, CardId.GraydleSlimeJr,
CardId.CryomancerOfTheIceBarrier, CardId.CryomancerOfTheIceBarrier,
CardId.DewdarkOfTheIceBarrier CardId.DewdarkOfTheIceBarrier
}; };
foreach (ClientCard monster in monsters) foreach (ClientCard monster in monsters)
{ {
if (suitableCost.Contains(monster.Id)) if (suitableCost.Contains(monster.Id))
{ {
AI.SelectCard(monster); AI.SelectCard(monster);
return true; return true;
} }
} }
if (!Bot.HasInSpellZone(CardId.AquariumStage, true)) if (!Bot.HasInSpellZone(CardId.AquariumStage, true))
{ {
foreach (ClientCard monster in monsters) foreach (ClientCard monster in monsters)
{ {
if (monster.Id == CardId.DupeFrog) if (monster.Id == CardId.DupeFrog)
{ {
AI.SelectCard(monster); AI.SelectCard(monster);
return true; return true;
} }
} }
} }
List<ClientCard> hands = Bot.Hand.GetMonsters(); List<ClientCard> hands = Bot.Hand.GetMonsters();
if (Bot.GetCountCardInZone(Bot.Hand, CardId.GraydleSlimeJr) >= 2) if (Bot.GetCountCardInZone(Bot.Hand, CardId.GraydleSlimeJr) >= 2)
{ {
foreach (ClientCard monster in hands) foreach (ClientCard monster in hands)
{ {
if (monster.Id == CardId.GraydleSlimeJr) if (monster.Id == CardId.GraydleSlimeJr)
{ {
AI.SelectCard(monster); AI.SelectCard(monster);
return true; return true;
} }
} }
} }
if (Bot.HasInGraveyard(CardId.Ronintoadin) && !Bot.HasInGraveyard(CardId.DupeFrog) && !Bot.HasInGraveyard(CardId.SwapFrog)) if (Bot.HasInGraveyard(CardId.Ronintoadin) && !Bot.HasInGraveyard(CardId.DupeFrog) && !Bot.HasInGraveyard(CardId.SwapFrog))
{ {
foreach (ClientCard monster in hands) foreach (ClientCard monster in hands)
{ {
if (monster.Id == CardId.DupeFrog) if (monster.Id == CardId.DupeFrog)
{ {
AI.SelectCard(monster); AI.SelectCard(monster);
return true; return true;
} }
} }
} }
foreach (ClientCard monster in hands) foreach (ClientCard monster in hands)
{ {
if (monster.Id == CardId.Ronintoadin || monster.Id == CardId.DupeFrog) if (monster.Id == CardId.Ronintoadin || monster.Id == CardId.DupeFrog)
{ {
AI.SelectCard(monster); AI.SelectCard(monster);
return true; return true;
} }
} }
foreach (ClientCard monster in hands) foreach (ClientCard monster in hands)
{ {
AI.SelectCard(monster); AI.SelectCard(monster);
return true; return true;
} }
return true; return true;
} }
else if (Card.Location == CardLocation.Grave) else if (Card.Location == CardLocation.Grave)
{ {
if (!Bot.HasInExtra(CardId.ToadallyAwesome)) if (!Bot.HasInExtra(CardId.ToadallyAwesome))
{ {
AI.SelectCard(CardId.ToadallyAwesome); AI.SelectCard(CardId.ToadallyAwesome);
} }
else else
{ {
AI.SelectCard(new[] AI.SelectCard(new[]
{ {
CardId.SwapFrog, CardId.SwapFrog,
CardId.PriorOfTheIceBarrier, CardId.PriorOfTheIceBarrier,
CardId.GraydleSlimeJr CardId.GraydleSlimeJr
}); });
} }
return true; return true;
} }
else if (Duel.Phase == DuelPhase.Standby) else if (Duel.Phase == DuelPhase.Standby)
{ {
SelectXYZDetach(Card.Overlays); SelectXYZDetach(Card.Overlays);
if (Duel.Player == 0) if (Duel.Player == 0)
{ {
AI.SelectNextCard(new[] AI.SelectNextCard(new[]
{ {
CardId.SwapFrog, CardId.SwapFrog,
CardId.CryomancerOfTheIceBarrier, CardId.CryomancerOfTheIceBarrier,
CardId.DewdarkOfTheIceBarrier, CardId.DewdarkOfTheIceBarrier,
CardId.Ronintoadin, CardId.Ronintoadin,
CardId.DupeFrog, CardId.DupeFrog,
CardId.GraydleSlimeJr CardId.GraydleSlimeJr
}); });
} }
else else
{ {
AI.SelectNextCard(new[] AI.SelectNextCard(new[]
{ {
CardId.DupeFrog, CardId.DupeFrog,
CardId.SwapFrog, CardId.SwapFrog,
CardId.Ronintoadin, CardId.Ronintoadin,
CardId.GraydleSlimeJr, CardId.GraydleSlimeJr,
CardId.CryomancerOfTheIceBarrier, CardId.CryomancerOfTheIceBarrier,
CardId.DewdarkOfTheIceBarrier CardId.DewdarkOfTheIceBarrier
}); });
AI.SelectPosition(CardPosition.FaceUpDefence); AI.SelectPosition(CardPosition.FaceUpDefence);
} }
return true; return true;
} }
return true; return true;
} }
private bool CatSharkSummon() private bool CatSharkSummon()
{ {
if (Bot.HasInMonstersZone(CardId.ToadallyAwesome) if (Bot.HasInMonstersZone(CardId.ToadallyAwesome)
&& ((AI.Utils.IsOneEnemyBetter(true) && ((AI.Utils.IsOneEnemyBetter(true)
&& !Bot.HasInMonstersZone(new[] && !Bot.HasInMonstersZone(new[]
{ {
CardId.CatShark, CardId.CatShark,
CardId.SkyCavalryCentaurea CardId.SkyCavalryCentaurea
}, true, true)) }, true, true))
|| !Bot.HasInExtra(CardId.ToadallyAwesome))) || !Bot.HasInExtra(CardId.ToadallyAwesome)))
{ {
AI.SelectPosition(CardPosition.FaceUpDefence); AI.SelectPosition(CardPosition.FaceUpDefence);
return true; return true;
} }
return false; return false;
} }
private bool CatSharkEffect() private bool CatSharkEffect()
{ {
List<ClientCard> monsters = Bot.GetMonsters(); List<ClientCard> monsters = Bot.GetMonsters();
foreach (ClientCard monster in monsters) foreach (ClientCard monster in monsters)
{ {
if (monster.Id == CardId.ToadallyAwesome && monster.Attack <= 2200) if (monster.Id == CardId.ToadallyAwesome && monster.Attack <= 2200)
{ {
SelectXYZDetach(Card.Overlays); SelectXYZDetach(Card.Overlays);
AI.SelectNextCard(monster); AI.SelectNextCard(monster);
return true; return true;
} }
} }
foreach (ClientCard monster in monsters) foreach (ClientCard monster in monsters)
{ {
if (monster.Id == CardId.SkyCavalryCentaurea && monster.Attack <= 2000) if (monster.Id == CardId.SkyCavalryCentaurea && monster.Attack <= 2000)
{ {
SelectXYZDetach(Card.Overlays); SelectXYZDetach(Card.Overlays);
AI.SelectNextCard(monster); AI.SelectNextCard(monster);
return true; return true;
} }
} }
foreach (ClientCard monster in monsters) foreach (ClientCard monster in monsters)
{ {
if (monster.Id == CardId.DaigustoPhoenix && monster.Attack <= 1500) if (monster.Id == CardId.DaigustoPhoenix && monster.Attack <= 1500)
{ {
SelectXYZDetach(Card.Overlays); SelectXYZDetach(Card.Overlays);
AI.SelectNextCard(monster); AI.SelectNextCard(monster);
return true; return true;
} }
} }
return false; return false;
} }
private bool SkyCavalryCentaureaSummon() private bool SkyCavalryCentaureaSummon()
{ {
int num = 0; int num = 0;
foreach (ClientCard monster in Bot.GetMonsters()) foreach (ClientCard monster in Bot.GetMonsters())
{ {
if (monster.Level ==2) if (monster.Level ==2)
{ {
num++; num++;
} }
} }
return AI.Utils.IsOneEnemyBetter(true) return AI.Utils.IsOneEnemyBetter(true)
&& AI.Utils.GetBestAttack(Enemy) > 2200 && AI.Utils.GetBestAttack(Enemy) > 2200
&& num < 4 && num < 4
&& !Bot.HasInMonstersZone(new[] && !Bot.HasInMonstersZone(new[]
{ {
CardId.SkyCavalryCentaurea CardId.SkyCavalryCentaurea
}, true, true); }, true, true);
} }
private bool DaigustoPhoenixSummon() private bool DaigustoPhoenixSummon()
{ {
if (Duel.Turn != 1) if (Duel.Turn != 1)
{ {
int attack = 0; int attack = 0;
int defence = 0; int defence = 0;
foreach (ClientCard monster in Bot.GetMonsters()) foreach (ClientCard monster in Bot.GetMonsters())
{ {
if (!monster.IsDefense()) if (!monster.IsDefense())
{ {
attack += monster.Attack; attack += monster.Attack;
} }
} }
foreach (ClientCard monster in Enemy.GetMonsters()) foreach (ClientCard monster in Enemy.GetMonsters())
{ {
defence += monster.GetDefensePower(); defence += monster.GetDefensePower();
} }
if (attack - 2000 - defence > Duel.LifePoints[1] && !AI.Utils.IsOneEnemyBetter(true)) if (attack - 2000 - defence > Duel.LifePoints[1] && !AI.Utils.IsOneEnemyBetter(true))
return true; return true;
} }
return false; return false;
} }
private bool HeraldOfTheArcLightSummon() private bool HeraldOfTheArcLightSummon()
{ {
AI.SelectPosition(CardPosition.FaceUpDefence); AI.SelectPosition(CardPosition.FaceUpDefence);
return true; return true;
} }
private bool Repos() private bool Repos()
{ {
if (Card.IsFacedown()) if (Card.IsFacedown())
return true; return true;
if (Card.IsDefense() && !AI.Utils.IsAllEnemyBetter(true) && Card.Attack >= Card.Defense) if (Card.IsDefense() && !AI.Utils.IsAllEnemyBetter(true) && Card.Attack >= Card.Defense)
return true; return true;
return false; return false;
} }
private bool OtherSpellEffect() private bool OtherSpellEffect()
{ {
foreach (CardExecutor exec in Executors) foreach (CardExecutor exec in Executors)
{ {
if (exec.Type == Type && exec.CardId == Card.Id) if (exec.Type == Type && exec.CardId == Card.Id)
return false; return false;
} }
return Card.IsSpell(); return Card.IsSpell();
} }
private bool OtherTrapEffect() private bool OtherTrapEffect()
{ {
foreach (CardExecutor exec in Executors) foreach (CardExecutor exec in Executors)
{ {
if (exec.Type == Type && exec.CardId == Card.Id) if (exec.Type == Type && exec.CardId == Card.Id)
return false; return false;
} }
return Card.IsTrap() && DefaultTrap(); return Card.IsTrap() && DefaultTrap();
} }
private bool OtherMonsterEffect() private bool OtherMonsterEffect()
{ {
foreach (CardExecutor exec in Executors) foreach (CardExecutor exec in Executors)
{ {
if (exec.Type == Type && exec.CardId == Card.Id) if (exec.Type == Type && exec.CardId == Card.Id)
return false; return false;
} }
return Card.IsMonster(); return Card.IsMonster();
} }
private void SelectXYZDetach(List<int> Overlays) private void SelectXYZDetach(List<int> Overlays)
{ {
if (Overlays.Contains(CardId.GraydleSlimeJr) && Bot.HasInHand(CardId.GraydleSlimeJr) && !Bot.HasInGraveyard(CardId.GraydleSlimeJr)) if (Overlays.Contains(CardId.GraydleSlimeJr) && Bot.HasInHand(CardId.GraydleSlimeJr) && !Bot.HasInGraveyard(CardId.GraydleSlimeJr))
AI.SelectCard(CardId.GraydleSlimeJr); AI.SelectCard(CardId.GraydleSlimeJr);
else if (Overlays.Contains(CardId.DupeFrog) && Bot.HasInGraveyard(CardId.Ronintoadin) && !Bot.HasInGraveyard(CardId.DupeFrog)) else if (Overlays.Contains(CardId.DupeFrog) && Bot.HasInGraveyard(CardId.Ronintoadin) && !Bot.HasInGraveyard(CardId.DupeFrog))
AI.SelectCard(CardId.DupeFrog); AI.SelectCard(CardId.DupeFrog);
else if (Overlays.Contains(CardId.Ronintoadin) && Bot.HasInGraveyard(CardId.DupeFrog) && !Bot.HasInGraveyard(CardId.Ronintoadin)) else if (Overlays.Contains(CardId.Ronintoadin) && Bot.HasInGraveyard(CardId.DupeFrog) && !Bot.HasInGraveyard(CardId.Ronintoadin))
AI.SelectCard(CardId.Ronintoadin); AI.SelectCard(CardId.Ronintoadin);
else else
AI.SelectCard(new[] AI.SelectCard(new[]
{ {
CardId.GraydleSlimeJr, CardId.GraydleSlimeJr,
CardId.Ronintoadin, CardId.Ronintoadin,
CardId.DupeFrog, CardId.DupeFrog,
CardId.CryomancerOfTheIceBarrier, CardId.CryomancerOfTheIceBarrier,
CardId.DewdarkOfTheIceBarrier, CardId.DewdarkOfTheIceBarrier,
CardId.PriorOfTheIceBarrier, CardId.PriorOfTheIceBarrier,
CardId.SwapFrog CardId.SwapFrog
}); });
} }
} }
} }
using YGOSharp.OCGWrapper.Enums; using YGOSharp.OCGWrapper.Enums;
using System.Collections.Generic; using System.Collections.Generic;
using WindBot; using WindBot;
using WindBot.Game; using WindBot.Game;
using WindBot.Game.AI; using WindBot.Game.AI;
namespace WindBot.Game.AI.Decks namespace WindBot.Game.AI.Decks
{ {
[Deck("Yosenju", "AI_Yosenju")] [Deck("Yosenju", "AI_Yosenju")]
public class YosenjuExecutor : DefaultExecutor public class YosenjuExecutor : DefaultExecutor
{ {
public class CardId public class CardId
{ {
public const int YosenjuKama1 = 65247798; public const int YosenjuKama1 = 65247798;
public const int YosenjuKama2 = 92246806; public const int YosenjuKama2 = 92246806;
public const int YosenjuKama3 = 28630501; public const int YosenjuKama3 = 28630501;
public const int YosenjuTsujik = 25244515; public const int YosenjuTsujik = 25244515;
public const int HarpiesFeatherDuster = 18144507; public const int HarpiesFeatherDuster = 18144507;
public const int DarkHole = 53129443; public const int DarkHole = 53129443;
public const int CardOfDemise = 59750328; public const int CardOfDemise = 59750328;
public const int PotOfDuality = 98645731; public const int PotOfDuality = 98645731;
public const int CosmicCyclone = 8267140; public const int CosmicCyclone = 8267140;
public const int QuakingMirrorForce = 40838625; public const int QuakingMirrorForce = 40838625;
public const int DrowningMirrorForce = 47475363; public const int DrowningMirrorForce = 47475363;
public const int StarlightRoad = 58120309; public const int StarlightRoad = 58120309;
public const int VanitysEmptiness = 5851097; public const int VanitysEmptiness = 5851097;
public const int MacroCosmos = 30241314; public const int MacroCosmos = 30241314;
public const int SolemnStrike = 40605147; public const int SolemnStrike = 40605147;
public const int SolemnWarning = 84749824; public const int SolemnWarning = 84749824;
public const int SolemnJudgment = 41420027; public const int SolemnJudgment = 41420027;
public const int MagicDrain = 59344077; public const int MagicDrain = 59344077;
public const int StardustDragon = 44508094; public const int StardustDragon = 44508094;
public const int NumberS39UtopiatheLightning = 56832966; public const int NumberS39UtopiatheLightning = 56832966;
public const int NumberS39UtopiaOne = 86532744; public const int NumberS39UtopiaOne = 86532744;
public const int DarkRebellionXyzDragon = 16195942; public const int DarkRebellionXyzDragon = 16195942;
public const int Number39Utopia = 84013237; public const int Number39Utopia = 84013237;
public const int Number103Ragnazero = 94380860; public const int Number103Ragnazero = 94380860;
public const int BrotherhoodOfTheFireFistTigerKing = 96381979; public const int BrotherhoodOfTheFireFistTigerKing = 96381979;
public const int Number106GiantHand = 63746411; public const int Number106GiantHand = 63746411;
public const int CastelTheSkyblasterMusketeer = 82633039; public const int CastelTheSkyblasterMusketeer = 82633039;
public const int DiamondDireWolf = 95169481; public const int DiamondDireWolf = 95169481;
public const int LightningChidori = 22653490; public const int LightningChidori = 22653490;
public const int EvilswarmExcitonKnight = 46772449; public const int EvilswarmExcitonKnight = 46772449;
public const int AbyssDweller = 21044178; public const int AbyssDweller = 21044178;
public const int GagagaCowboy = 12014404; public const int GagagaCowboy = 12014404;
} }
bool CardOfDemiseUsed = false; bool CardOfDemiseUsed = false;
public YosenjuExecutor(GameAI ai, Duel duel) public YosenjuExecutor(GameAI ai, Duel duel)
: base(ai, duel) : base(ai, duel)
{ {
// do the end phase effect of Card Of Demise before Yosenjus return to hand // do the end phase effect of Card Of Demise before Yosenjus return to hand
AddExecutor(ExecutorType.Activate, CardId.CardOfDemise, CardOfDemiseEPEffect); AddExecutor(ExecutorType.Activate, CardId.CardOfDemise, CardOfDemiseEPEffect);
// burn if enemy's LP is below 800 // burn if enemy's LP is below 800
AddExecutor(ExecutorType.SpSummon, CardId.GagagaCowboy, GagagaCowboySummon); AddExecutor(ExecutorType.SpSummon, CardId.GagagaCowboy, GagagaCowboySummon);
AddExecutor(ExecutorType.Activate, CardId.GagagaCowboy); AddExecutor(ExecutorType.Activate, CardId.GagagaCowboy);
AddExecutor(ExecutorType.Activate, CardId.HarpiesFeatherDuster, DefaultHarpiesFeatherDusterFirst); AddExecutor(ExecutorType.Activate, CardId.HarpiesFeatherDuster, DefaultHarpiesFeatherDusterFirst);
AddExecutor(ExecutorType.Activate, CardId.CosmicCyclone, DefaultCosmicCyclone); AddExecutor(ExecutorType.Activate, CardId.CosmicCyclone, DefaultCosmicCyclone);
AddExecutor(ExecutorType.Activate, CardId.HarpiesFeatherDuster); AddExecutor(ExecutorType.Activate, CardId.HarpiesFeatherDuster);
AddExecutor(ExecutorType.Activate, CardId.DarkHole, DefaultDarkHole); AddExecutor(ExecutorType.Activate, CardId.DarkHole, DefaultDarkHole);
AddExecutor(ExecutorType.Activate, CardId.PotOfDuality, PotOfDualityEffect); AddExecutor(ExecutorType.Activate, CardId.PotOfDuality, PotOfDualityEffect);
AddExecutor(ExecutorType.Summon, CardId.YosenjuKama1, HaveAnotherYosenjuWithSameNameInHand); AddExecutor(ExecutorType.Summon, CardId.YosenjuKama1, HaveAnotherYosenjuWithSameNameInHand);
AddExecutor(ExecutorType.Summon, CardId.YosenjuKama2, HaveAnotherYosenjuWithSameNameInHand); AddExecutor(ExecutorType.Summon, CardId.YosenjuKama2, HaveAnotherYosenjuWithSameNameInHand);
AddExecutor(ExecutorType.Summon, CardId.YosenjuKama3, HaveAnotherYosenjuWithSameNameInHand); AddExecutor(ExecutorType.Summon, CardId.YosenjuKama3, HaveAnotherYosenjuWithSameNameInHand);
AddExecutor(ExecutorType.Summon, CardId.YosenjuKama1); AddExecutor(ExecutorType.Summon, CardId.YosenjuKama1);
AddExecutor(ExecutorType.Summon, CardId.YosenjuKama2); AddExecutor(ExecutorType.Summon, CardId.YosenjuKama2);
AddExecutor(ExecutorType.Summon, CardId.YosenjuKama3); AddExecutor(ExecutorType.Summon, CardId.YosenjuKama3);
AddExecutor(ExecutorType.Summon, CardId.YosenjuTsujik); AddExecutor(ExecutorType.Summon, CardId.YosenjuTsujik);
AddExecutor(ExecutorType.Activate, CardId.YosenjuKama1, YosenjuEffect); AddExecutor(ExecutorType.Activate, CardId.YosenjuKama1, YosenjuEffect);
AddExecutor(ExecutorType.Activate, CardId.YosenjuKama2, YosenjuEffect); AddExecutor(ExecutorType.Activate, CardId.YosenjuKama2, YosenjuEffect);
AddExecutor(ExecutorType.Activate, CardId.YosenjuKama3, YosenjuEffect); AddExecutor(ExecutorType.Activate, CardId.YosenjuKama3, YosenjuEffect);
AddExecutor(ExecutorType.Activate, CardId.YosenjuTsujik, YosenjuEffect); AddExecutor(ExecutorType.Activate, CardId.YosenjuTsujik, YosenjuEffect);
AddExecutor(ExecutorType.SpellSet, CardId.SolemnJudgment, TrapSetUnique); AddExecutor(ExecutorType.SpellSet, CardId.SolemnJudgment, TrapSetUnique);
AddExecutor(ExecutorType.SpellSet, CardId.SolemnStrike, TrapSetUnique); AddExecutor(ExecutorType.SpellSet, CardId.SolemnStrike, TrapSetUnique);
AddExecutor(ExecutorType.SpellSet, CardId.SolemnWarning, TrapSetUnique); AddExecutor(ExecutorType.SpellSet, CardId.SolemnWarning, TrapSetUnique);
AddExecutor(ExecutorType.SpellSet, CardId.MacroCosmos, TrapSetUnique); AddExecutor(ExecutorType.SpellSet, CardId.MacroCosmos, TrapSetUnique);
AddExecutor(ExecutorType.SpellSet, CardId.VanitysEmptiness, TrapSetUnique); AddExecutor(ExecutorType.SpellSet, CardId.VanitysEmptiness, TrapSetUnique);
AddExecutor(ExecutorType.SpellSet, CardId.MagicDrain, TrapSetUnique); AddExecutor(ExecutorType.SpellSet, CardId.MagicDrain, TrapSetUnique);
AddExecutor(ExecutorType.SpellSet, CardId.DrowningMirrorForce, TrapSetUnique); AddExecutor(ExecutorType.SpellSet, CardId.DrowningMirrorForce, TrapSetUnique);
AddExecutor(ExecutorType.SpellSet, CardId.QuakingMirrorForce, TrapSetUnique); AddExecutor(ExecutorType.SpellSet, CardId.QuakingMirrorForce, TrapSetUnique);
AddExecutor(ExecutorType.SpellSet, CardId.StarlightRoad, TrapSetUnique); AddExecutor(ExecutorType.SpellSet, CardId.StarlightRoad, TrapSetUnique);
AddExecutor(ExecutorType.SpellSet, CardId.SolemnJudgment, TrapSetWhenZoneFree); AddExecutor(ExecutorType.SpellSet, CardId.SolemnJudgment, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.SolemnStrike, TrapSetWhenZoneFree); AddExecutor(ExecutorType.SpellSet, CardId.SolemnStrike, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.SolemnWarning, TrapSetWhenZoneFree); AddExecutor(ExecutorType.SpellSet, CardId.SolemnWarning, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.MacroCosmos, TrapSetWhenZoneFree); AddExecutor(ExecutorType.SpellSet, CardId.MacroCosmos, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.VanitysEmptiness, TrapSetWhenZoneFree); AddExecutor(ExecutorType.SpellSet, CardId.VanitysEmptiness, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.MagicDrain, TrapSetWhenZoneFree); AddExecutor(ExecutorType.SpellSet, CardId.MagicDrain, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.DrowningMirrorForce, TrapSetWhenZoneFree); AddExecutor(ExecutorType.SpellSet, CardId.DrowningMirrorForce, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.QuakingMirrorForce, TrapSetWhenZoneFree); AddExecutor(ExecutorType.SpellSet, CardId.QuakingMirrorForce, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.StarlightRoad, TrapSetWhenZoneFree); AddExecutor(ExecutorType.SpellSet, CardId.StarlightRoad, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.HarpiesFeatherDuster, TrapSetWhenZoneFree); AddExecutor(ExecutorType.SpellSet, CardId.HarpiesFeatherDuster, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.DarkHole, TrapSetWhenZoneFree); AddExecutor(ExecutorType.SpellSet, CardId.DarkHole, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.PotOfDuality, TrapSetWhenZoneFree); AddExecutor(ExecutorType.SpellSet, CardId.PotOfDuality, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.CosmicCyclone, TrapSetWhenZoneFree); AddExecutor(ExecutorType.SpellSet, CardId.CosmicCyclone, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.CardOfDemise); AddExecutor(ExecutorType.SpellSet, CardId.CardOfDemise);
AddExecutor(ExecutorType.Activate, CardId.CardOfDemise, CardOfDemiseEffect); AddExecutor(ExecutorType.Activate, CardId.CardOfDemise, CardOfDemiseEffect);
AddExecutor(ExecutorType.SpellSet, CardId.SolemnJudgment, CardOfDemiseAcivated); AddExecutor(ExecutorType.SpellSet, CardId.SolemnJudgment, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.SolemnStrike, CardOfDemiseAcivated); AddExecutor(ExecutorType.SpellSet, CardId.SolemnStrike, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.SolemnWarning, CardOfDemiseAcivated); AddExecutor(ExecutorType.SpellSet, CardId.SolemnWarning, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.MacroCosmos, CardOfDemiseAcivated); AddExecutor(ExecutorType.SpellSet, CardId.MacroCosmos, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.VanitysEmptiness, CardOfDemiseAcivated); AddExecutor(ExecutorType.SpellSet, CardId.VanitysEmptiness, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.MagicDrain, CardOfDemiseAcivated); AddExecutor(ExecutorType.SpellSet, CardId.MagicDrain, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.DrowningMirrorForce, CardOfDemiseAcivated); AddExecutor(ExecutorType.SpellSet, CardId.DrowningMirrorForce, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.QuakingMirrorForce, CardOfDemiseAcivated); AddExecutor(ExecutorType.SpellSet, CardId.QuakingMirrorForce, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.StarlightRoad, CardOfDemiseAcivated); AddExecutor(ExecutorType.SpellSet, CardId.StarlightRoad, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.HarpiesFeatherDuster, CardOfDemiseAcivated); AddExecutor(ExecutorType.SpellSet, CardId.HarpiesFeatherDuster, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.DarkHole, CardOfDemiseAcivated); AddExecutor(ExecutorType.SpellSet, CardId.DarkHole, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.PotOfDuality, CardOfDemiseAcivated); AddExecutor(ExecutorType.SpellSet, CardId.PotOfDuality, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.CosmicCyclone, CardOfDemiseAcivated); AddExecutor(ExecutorType.SpellSet, CardId.CosmicCyclone, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpSummon, CardId.EvilswarmExcitonKnight, DefaultEvilswarmExcitonKnightSummon); AddExecutor(ExecutorType.SpSummon, CardId.EvilswarmExcitonKnight, DefaultEvilswarmExcitonKnightSummon);
AddExecutor(ExecutorType.Activate, CardId.EvilswarmExcitonKnight, DefaultEvilswarmExcitonKnightEffect); AddExecutor(ExecutorType.Activate, CardId.EvilswarmExcitonKnight, DefaultEvilswarmExcitonKnightEffect);
AddExecutor(ExecutorType.SpSummon, CardId.DarkRebellionXyzDragon, DarkRebellionXyzDragonSummon); AddExecutor(ExecutorType.SpSummon, CardId.DarkRebellionXyzDragon, DarkRebellionXyzDragonSummon);
AddExecutor(ExecutorType.Activate, CardId.DarkRebellionXyzDragon, DarkRebellionXyzDragonEffect); AddExecutor(ExecutorType.Activate, CardId.DarkRebellionXyzDragon, DarkRebellionXyzDragonEffect);
AddExecutor(ExecutorType.SpSummon, CardId.Number39Utopia, DefaultNumberS39UtopiaTheLightningSummon); AddExecutor(ExecutorType.SpSummon, CardId.Number39Utopia, DefaultNumberS39UtopiaTheLightningSummon);
AddExecutor(ExecutorType.SpSummon, CardId.NumberS39UtopiaOne); AddExecutor(ExecutorType.SpSummon, CardId.NumberS39UtopiaOne);
AddExecutor(ExecutorType.SpSummon, CardId.NumberS39UtopiatheLightning); AddExecutor(ExecutorType.SpSummon, CardId.NumberS39UtopiatheLightning);
AddExecutor(ExecutorType.Activate, CardId.NumberS39UtopiatheLightning); AddExecutor(ExecutorType.Activate, CardId.NumberS39UtopiatheLightning);
AddExecutor(ExecutorType.Activate, CardId.StardustDragon, DefaultStardustDragonEffect); AddExecutor(ExecutorType.Activate, CardId.StardustDragon, DefaultStardustDragonEffect);
AddExecutor(ExecutorType.Activate, CardId.StarlightRoad, DefaultTrap); AddExecutor(ExecutorType.Activate, CardId.StarlightRoad, DefaultTrap);
AddExecutor(ExecutorType.Activate, CardId.MagicDrain); AddExecutor(ExecutorType.Activate, CardId.MagicDrain);
AddExecutor(ExecutorType.Activate, CardId.SolemnWarning, DefaultSolemnWarning); AddExecutor(ExecutorType.Activate, CardId.SolemnWarning, DefaultSolemnWarning);
AddExecutor(ExecutorType.Activate, CardId.SolemnStrike, DefaultSolemnStrike); AddExecutor(ExecutorType.Activate, CardId.SolemnStrike, DefaultSolemnStrike);
AddExecutor(ExecutorType.Activate, CardId.SolemnJudgment, DefaultSolemnJudgment); AddExecutor(ExecutorType.Activate, CardId.SolemnJudgment, DefaultSolemnJudgment);
AddExecutor(ExecutorType.Activate, CardId.MacroCosmos, DefaultUniqueTrap); AddExecutor(ExecutorType.Activate, CardId.MacroCosmos, DefaultUniqueTrap);
AddExecutor(ExecutorType.Activate, CardId.VanitysEmptiness, DefaultUniqueTrap); AddExecutor(ExecutorType.Activate, CardId.VanitysEmptiness, DefaultUniqueTrap);
AddExecutor(ExecutorType.Activate, CardId.DrowningMirrorForce, DefaultUniqueTrap); AddExecutor(ExecutorType.Activate, CardId.DrowningMirrorForce, DefaultUniqueTrap);
AddExecutor(ExecutorType.Activate, CardId.QuakingMirrorForce, DefaultUniqueTrap); AddExecutor(ExecutorType.Activate, CardId.QuakingMirrorForce, DefaultUniqueTrap);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos); AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
} }
public override bool OnSelectHand() public override bool OnSelectHand()
{ {
// go first // go first
return true; return true;
} }
public override void OnNewTurn() public override void OnNewTurn()
{ {
CardOfDemiseUsed = false; CardOfDemiseUsed = false;
} }
public override bool OnSelectYesNo(int desc) public override bool OnSelectYesNo(int desc)
{ {
// Yosenju Kama 2 shouldn't attack directly at most times // Yosenju Kama 2 shouldn't attack directly at most times
if (Card == null) if (Card == null)
return true; return true;
// Logger.DebugWriteLine(Card.Name); // Logger.DebugWriteLine(Card.Name);
if (Card.Id == CardId.YosenjuKama2) if (Card.Id == CardId.YosenjuKama2)
return Card.ShouldDirectAttack; return Card.ShouldDirectAttack;
else else
return true; return true;
} }
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender) public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
{ {
if (!defender.IsMonsterHasPreventActivationEffectInBattle()) if (!defender.IsMonsterHasPreventActivationEffectInBattle())
{ {
if (attacker.Attribute == (int)CardAttribute.Wind && Bot.HasInHand(CardId.YosenjuTsujik)) if (attacker.Attribute == (int)CardAttribute.Wind && Bot.HasInHand(CardId.YosenjuTsujik))
attacker.RealPower = attacker.RealPower + 1000; attacker.RealPower = attacker.RealPower + 1000;
} }
return base.OnPreBattleBetween(attacker, defender); return base.OnPreBattleBetween(attacker, defender);
} }
private bool PotOfDualityEffect() public override IList<ClientCard> OnSelectXyzMaterial(IList<ClientCard> cards, int min, int max)
{ {
if (CardOfDemiseUsed) IList<ClientCard> result = new List<ClientCard>();
{ AI.Utils.SelectPreferredCards(result, CardId.YosenjuTsujik, cards, min, max);
AI.SelectCard(new[] AI.Utils.CheckSelectCount(result, cards, min, max);
{ return result;
CardId.StarlightRoad, }
CardId.MagicDrain,
CardId.SolemnJudgment, private bool PotOfDualityEffect()
CardId.VanitysEmptiness, {
CardId.HarpiesFeatherDuster, if (CardOfDemiseUsed)
CardId.DrowningMirrorForce, {
CardId.QuakingMirrorForce, AI.SelectCard(new[]
CardId.SolemnStrike, {
CardId.SolemnWarning, CardId.StarlightRoad,
CardId.MacroCosmos, CardId.MagicDrain,
CardId.CardOfDemise CardId.SolemnJudgment,
}); CardId.VanitysEmptiness,
} CardId.HarpiesFeatherDuster,
else CardId.DrowningMirrorForce,
{ CardId.QuakingMirrorForce,
AI.SelectCard(new[] CardId.SolemnStrike,
{ CardId.SolemnWarning,
CardId.YosenjuKama3, CardId.MacroCosmos,
CardId.YosenjuKama1, CardId.CardOfDemise
CardId.YosenjuKama2, });
CardId.StarlightRoad, }
CardId.MagicDrain, else
CardId.VanitysEmptiness, {
CardId.HarpiesFeatherDuster, AI.SelectCard(new[]
CardId.DrowningMirrorForce, {
CardId.QuakingMirrorForce, CardId.YosenjuKama3,
CardId.SolemnStrike, CardId.YosenjuKama1,
CardId.SolemnJudgment, CardId.YosenjuKama2,
CardId.SolemnWarning, CardId.StarlightRoad,
CardId.MacroCosmos, CardId.MagicDrain,
CardId.CardOfDemise, CardId.VanitysEmptiness,
}); CardId.HarpiesFeatherDuster,
} CardId.DrowningMirrorForce,
return true; CardId.QuakingMirrorForce,
} CardId.SolemnStrike,
CardId.SolemnJudgment,
private bool CardOfDemiseEffect() CardId.SolemnWarning,
{ CardId.MacroCosmos,
if (AI.Utils.IsTurn1OrMain2()) CardId.CardOfDemise,
{ });
CardOfDemiseUsed = true; }
return true; return true;
} }
return false;
} private bool CardOfDemiseEffect()
{
private bool HaveAnotherYosenjuWithSameNameInHand() if (AI.Utils.IsTurn1OrMain2())
{ {
foreach (ClientCard card in Bot.Hand.GetMonsters()) CardOfDemiseUsed = true;
{ return true;
if (!card.Equals(Card) && card.Id == Card.Id) }
return true; return false;
} }
return false;
} private bool HaveAnotherYosenjuWithSameNameInHand()
{
private bool TrapSetUnique() foreach (ClientCard card in Bot.Hand.GetMonsters())
{ {
foreach (ClientCard card in Bot.GetSpells()) if (!card.Equals(Card) && card.Id == Card.Id)
{ return true;
if (card.Id == Card.Id) }
return false; return false;
} }
return TrapSetWhenZoneFree();
} private bool TrapSetUnique()
{
private bool TrapSetWhenZoneFree() foreach (ClientCard card in Bot.GetSpells())
{ {
return Bot.GetSpellCountWithoutField() < 4; if (card.Id == Card.Id)
} return false;
}
private bool CardOfDemiseAcivated() return TrapSetWhenZoneFree();
{ }
return CardOfDemiseUsed;
} private bool TrapSetWhenZoneFree()
{
private bool YosenjuEffect() return Bot.GetSpellCountWithoutField() < 4;
{ }
// Don't activate the return to hand effect first
if (Duel.Phase == DuelPhase.End) private bool CardOfDemiseAcivated()
return false; {
AI.SelectCard(new[] return CardOfDemiseUsed;
{ }
CardId.YosenjuKama1,
CardId.YosenjuKama2, private bool YosenjuEffect()
CardId.YosenjuKama3 {
}); // Don't activate the return to hand effect first
return true; if (Duel.Phase == DuelPhase.End)
} return false;
AI.SelectCard(new[]
private bool CardOfDemiseEPEffect() {
{ CardId.YosenjuKama1,
// do the end phase effect of Card Of Demise before Yosenjus return to hand CardId.YosenjuKama2,
return Duel.Phase == DuelPhase.End; CardId.YosenjuKama3
} });
return true;
private bool GagagaCowboySummon() }
{
if (Duel.LifePoints[1] <= 800 || (Bot.GetMonsterCount()>=4 && Duel.LifePoints[1] <= 1600)) private bool CardOfDemiseEPEffect()
{ {
AI.SelectPosition(CardPosition.FaceUpDefence); // do the end phase effect of Card Of Demise before Yosenjus return to hand
return true; return Duel.Phase == DuelPhase.End;
} }
return false;
} private bool GagagaCowboySummon()
{
private bool DarkRebellionXyzDragonSummon() if (Duel.LifePoints[1] <= 800 || (Bot.GetMonsterCount()>=4 && Duel.LifePoints[1] <= 1600))
{ {
int selfBestAttack = AI.Utils.GetBestAttack(Bot); AI.SelectPosition(CardPosition.FaceUpDefence);
int oppoBestAttack = AI.Utils.GetBestAttack(Enemy); return true;
return selfBestAttack <= oppoBestAttack; }
} return false;
}
private bool DarkRebellionXyzDragonEffect()
{ private bool DarkRebellionXyzDragonSummon()
int oppoBestAttack = AI.Utils.GetBestAttack(Enemy); {
ClientCard target = AI.Utils.GetOneEnemyBetterThanValue(oppoBestAttack, true); int selfBestAttack = AI.Utils.GetBestAttack(Bot);
if (target != null) int oppoBestAttack = AI.Utils.GetBestAttack(Enemy);
{ return selfBestAttack <= oppoBestAttack;
AI.SelectNextCard(target); }
}
return true; private bool DarkRebellionXyzDragonEffect()
} {
} int oppoBestAttack = AI.Utils.GetBestAttack(Enemy);
ClientCard target = AI.Utils.GetOneEnemyBetterThanValue(oppoBestAttack, true);
if (target != null)
{
AI.SelectNextCard(target);
}
return true;
}
}
} }
\ No newline at end of file
...@@ -136,6 +136,18 @@ namespace WindBot.Game.AI.Decks ...@@ -136,6 +136,18 @@ namespace WindBot.Game.AI.Decks
return base.OnPreBattleBetween(attacker, defender); return base.OnPreBattleBetween(attacker, defender);
} }
public override IList<ClientCard> OnSelectXyzMaterial(IList<ClientCard> cards, int min, int max)
{
IList<ClientCard> result = new List<ClientCard>();
AI.Utils.SelectPreferredCards(result, new[] {
CardId.StarDrawing,
CardId.SolarWindJammer,
CardId.Goblindbergh
}, cards, min, max);
AI.Utils.CheckSelectCount(result, cards, min, max);
return result;
}
private bool Number39Utopia() private bool Number39Utopia()
{ {
if (!HasChainedTrap(0) && Duel.Player == 1 && Duel.Phase == DuelPhase.BattleStart && Card.HasXyzMaterial(2)) if (!HasChainedTrap(0) && Duel.Player == 1 && Duel.Phase == DuelPhase.BattleStart && Card.HasXyzMaterial(2))
...@@ -271,7 +283,7 @@ namespace WindBot.Game.AI.Decks ...@@ -271,7 +283,7 @@ namespace WindBot.Game.AI.Decks
private bool MonsterRepos() private bool MonsterRepos()
{ {
if (Card.Id == CardId.NumberS39UtopiatheLightning) if (Card.Id == CardId.NumberS39UtopiatheLightning && Card.IsAttack())
return false; return false;
return base.DefaultMonsterRepos(); return base.DefaultMonsterRepos();
} }
......
...@@ -168,6 +168,12 @@ namespace WindBot.Game.AI.Decks ...@@ -168,6 +168,12 @@ namespace WindBot.Game.AI.Decks
return true; return true;
IList<ClientCard> materials0 = Bot.Graveyard; IList<ClientCard> materials0 = Bot.Graveyard;
IList<ClientCard> materials1 = Enemy.Graveyard; IList<ClientCard> materials1 = Enemy.Graveyard;
IList<ClientCard> mats = new List<ClientCard>();
ClientCard aleister = GetAleisterInGrave();
if (aleister != null)
{
mats.Add(aleister);
}
ClientCard mat = null; ClientCard mat = null;
foreach (ClientCard card in materials0) foreach (ClientCard card in materials0)
{ {
...@@ -187,9 +193,9 @@ namespace WindBot.Game.AI.Decks ...@@ -187,9 +193,9 @@ namespace WindBot.Game.AI.Decks
} }
if (mat != null) if (mat != null)
{ {
mats.Add(mat);
AI.SelectCard(CardId.InvokedMechaba); AI.SelectCard(CardId.InvokedMechaba);
SelectAleisterInGrave(); AI.SelectMaterials(mats);
AI.SelectThirdCard(mat);
AI.SelectPosition(CardPosition.FaceUpAttack); AI.SelectPosition(CardPosition.FaceUpAttack);
return true; return true;
} }
...@@ -211,41 +217,39 @@ namespace WindBot.Game.AI.Decks ...@@ -211,41 +217,39 @@ namespace WindBot.Game.AI.Decks
} }
if (mat != null) if (mat != null)
{ {
mats.Add(mat);
AI.SelectCard(CardId.InvokedMagellanica); AI.SelectCard(CardId.InvokedMagellanica);
SelectAleisterInGrave(); AI.SelectMaterials(mats);
AI.SelectThirdCard(mat);
AI.SelectPosition(CardPosition.FaceUpAttack); AI.SelectPosition(CardPosition.FaceUpAttack);
return true; return true;
} }
return false; return false;
} }
private void SelectAleisterInGrave() private ClientCard GetAleisterInGrave()
{ {
foreach (ClientCard card in Enemy.Graveyard) foreach (ClientCard card in Enemy.Graveyard)
{ {
if (card.Id == CardId.AleisterTheInvoker) if (card.Id == CardId.AleisterTheInvoker)
{ {
AI.SelectNextCard(card); return card;
return;
} }
} }
foreach (ClientCard card in Bot.Graveyard) foreach (ClientCard card in Bot.Graveyard)
{ {
if (card.Id == CardId.AleisterTheInvoker) if (card.Id == CardId.AleisterTheInvoker)
{ {
AI.SelectNextCard(card); return card;
return;
} }
} }
AI.SelectNextCard(CardId.AleisterTheInvoker); return null;
} }
private bool ChakanineSummon() private bool ChakanineSummon()
{ {
if (Bot.HasInMonstersZone(CardId.Ratpier) && !ChakanineSpsummoned) if (Bot.HasInMonstersZone(CardId.Ratpier) && !ChakanineSpsummoned)
{ {
AI.SelectCard(CardId.Ratpier); AI.SelectMaterials(CardId.Ratpier);
AI.SelectYesNo(true); AI.SelectYesNo(true);
AI.SelectPosition(CardPosition.FaceUpDefence); AI.SelectPosition(CardPosition.FaceUpDefence);
ChakanineSpsummoned = true; ChakanineSpsummoned = true;
...@@ -253,7 +257,7 @@ namespace WindBot.Game.AI.Decks ...@@ -253,7 +257,7 @@ namespace WindBot.Game.AI.Decks
} }
if (Bot.HasInMonstersZone(CardId.Broadbull) && !ChakanineSpsummoned) if (Bot.HasInMonstersZone(CardId.Broadbull) && !ChakanineSpsummoned)
{ {
AI.SelectCard(CardId.Broadbull); AI.SelectMaterials(CardId.Broadbull);
AI.SelectYesNo(true); AI.SelectYesNo(true);
AI.SelectPosition(CardPosition.FaceUpDefence); AI.SelectPosition(CardPosition.FaceUpDefence);
ChakanineSpsummoned = true; ChakanineSpsummoned = true;
...@@ -289,7 +293,7 @@ namespace WindBot.Game.AI.Decks ...@@ -289,7 +293,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Bot.HasInMonstersZone(CardId.Chakanine) && !TigermortarSpsummoned) if (Bot.HasInMonstersZone(CardId.Chakanine) && !TigermortarSpsummoned)
{ {
AI.SelectCard(CardId.Chakanine); AI.SelectMaterials(CardId.Chakanine);
AI.SelectYesNo(true); AI.SelectYesNo(true);
AI.SelectPosition(CardPosition.FaceUpDefence); AI.SelectPosition(CardPosition.FaceUpDefence);
TigermortarSpsummoned = true; TigermortarSpsummoned = true;
...@@ -297,7 +301,7 @@ namespace WindBot.Game.AI.Decks ...@@ -297,7 +301,7 @@ namespace WindBot.Game.AI.Decks
} }
if (Bot.HasInMonstersZone(CardId.Ratpier) && !TigermortarSpsummoned) if (Bot.HasInMonstersZone(CardId.Ratpier) && !TigermortarSpsummoned)
{ {
AI.SelectCard(CardId.Ratpier); AI.SelectMaterials(CardId.Ratpier);
AI.SelectYesNo(true); AI.SelectYesNo(true);
AI.SelectPosition(CardPosition.FaceUpDefence); AI.SelectPosition(CardPosition.FaceUpDefence);
TigermortarSpsummoned = true; TigermortarSpsummoned = true;
...@@ -310,7 +314,7 @@ namespace WindBot.Game.AI.Decks ...@@ -310,7 +314,7 @@ namespace WindBot.Game.AI.Decks
CardId.Ratpier CardId.Ratpier
})) }))
{ {
AI.SelectCard(CardId.Thoroughblade); AI.SelectMaterials(CardId.Thoroughblade);
AI.SelectYesNo(true); AI.SelectYesNo(true);
TigermortarSpsummoned = true; TigermortarSpsummoned = true;
return true; return true;
...@@ -318,7 +322,7 @@ namespace WindBot.Game.AI.Decks ...@@ -318,7 +322,7 @@ namespace WindBot.Game.AI.Decks
if (Bot.HasInMonstersZone(CardId.Whiptail) && !TigermortarSpsummoned if (Bot.HasInMonstersZone(CardId.Whiptail) && !TigermortarSpsummoned
&& Bot.HasInGraveyard(CardId.Ratpier)) && Bot.HasInGraveyard(CardId.Ratpier))
{ {
AI.SelectCard(CardId.Whiptail); AI.SelectMaterials(CardId.Whiptail);
AI.SelectYesNo(true); AI.SelectYesNo(true);
TigermortarSpsummoned = true; TigermortarSpsummoned = true;
return true; return true;
...@@ -345,7 +349,7 @@ namespace WindBot.Game.AI.Decks ...@@ -345,7 +349,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Bot.HasInMonstersZone(CardId.Tigermortar) && !BroadbullSpsummoned) if (Bot.HasInMonstersZone(CardId.Tigermortar) && !BroadbullSpsummoned)
{ {
AI.SelectCard(CardId.Tigermortar); AI.SelectMaterials(CardId.Tigermortar);
AI.SelectYesNo(true); AI.SelectYesNo(true);
AI.SelectPosition(CardPosition.FaceUpDefence); AI.SelectPosition(CardPosition.FaceUpDefence);
BroadbullSpsummoned = true; BroadbullSpsummoned = true;
...@@ -353,7 +357,7 @@ namespace WindBot.Game.AI.Decks ...@@ -353,7 +357,7 @@ namespace WindBot.Game.AI.Decks
} }
if (Bot.HasInMonstersZone(CardId.Chakanine) && !BroadbullSpsummoned) if (Bot.HasInMonstersZone(CardId.Chakanine) && !BroadbullSpsummoned)
{ {
AI.SelectCard(CardId.Chakanine); AI.SelectMaterials(CardId.Chakanine);
AI.SelectYesNo(true); AI.SelectYesNo(true);
AI.SelectPosition(CardPosition.FaceUpDefence); AI.SelectPosition(CardPosition.FaceUpDefence);
BroadbullSpsummoned = true; BroadbullSpsummoned = true;
...@@ -361,7 +365,7 @@ namespace WindBot.Game.AI.Decks ...@@ -361,7 +365,7 @@ namespace WindBot.Game.AI.Decks
} }
if (Bot.HasInMonstersZone(CardId.Ratpier) && !BroadbullSpsummoned) if (Bot.HasInMonstersZone(CardId.Ratpier) && !BroadbullSpsummoned)
{ {
AI.SelectCard(CardId.Ratpier); AI.SelectMaterials(CardId.Ratpier);
AI.SelectYesNo(true); AI.SelectYesNo(true);
AI.SelectPosition(CardPosition.FaceUpDefence); AI.SelectPosition(CardPosition.FaceUpDefence);
BroadbullSpsummoned = true; BroadbullSpsummoned = true;
...@@ -369,7 +373,7 @@ namespace WindBot.Game.AI.Decks ...@@ -369,7 +373,7 @@ namespace WindBot.Game.AI.Decks
} }
if (Bot.HasInMonstersZone(CardId.Thoroughblade) && !BroadbullSpsummoned) if (Bot.HasInMonstersZone(CardId.Thoroughblade) && !BroadbullSpsummoned)
{ {
AI.SelectCard(CardId.Thoroughblade); AI.SelectMaterials(CardId.Thoroughblade);
AI.SelectYesNo(true); AI.SelectYesNo(true);
AI.SelectPosition(CardPosition.FaceUpDefence); AI.SelectPosition(CardPosition.FaceUpDefence);
BroadbullSpsummoned = true; BroadbullSpsummoned = true;
...@@ -399,7 +403,7 @@ namespace WindBot.Game.AI.Decks ...@@ -399,7 +403,7 @@ namespace WindBot.Game.AI.Decks
{ {
AI.SelectYesNo(false); AI.SelectYesNo(false);
AI.SelectPosition(CardPosition.FaceUpDefence); AI.SelectPosition(CardPosition.FaceUpDefence);
AI.SelectCard(new[] AI.SelectMaterials(new[]
{ {
CardId.Ratpier, CardId.Ratpier,
CardId.PhotonThrasher, CardId.PhotonThrasher,
...@@ -411,7 +415,7 @@ namespace WindBot.Game.AI.Decks ...@@ -411,7 +415,7 @@ namespace WindBot.Game.AI.Decks
private bool DridentSummon() private bool DridentSummon()
{ {
AI.SelectCard(new[] AI.SelectMaterials(new[]
{ {
CardId.Broadbull, CardId.Broadbull,
CardId.Tigermortar, CardId.Tigermortar,
...@@ -502,6 +506,11 @@ namespace WindBot.Game.AI.Decks ...@@ -502,6 +506,11 @@ namespace WindBot.Game.AI.Decks
private bool DaigustoEmeralSummon() private bool DaigustoEmeralSummon()
{ {
AI.SelectMaterials(new[]
{
CardId.PhotonThrasher,
CardId.AleisterTheInvoker
});
return Bot.GetGraveyardMonsters().Count >= 3; return Bot.GetGraveyardMonsters().Count >= 3;
} }
...@@ -595,7 +604,7 @@ namespace WindBot.Game.AI.Decks ...@@ -595,7 +604,7 @@ namespace WindBot.Game.AI.Decks
private bool MonsterRepos() private bool MonsterRepos()
{ {
if (Card.Id == CardId.NumberS39UtopiatheLightning) if (Card.Id == CardId.NumberS39UtopiatheLightning && Card.IsAttack())
return false; return false;
return base.DefaultMonsterRepos(); return base.DefaultMonsterRepos();
} }
......
...@@ -58,10 +58,10 @@ namespace WindBot.Game.AI ...@@ -58,10 +58,10 @@ namespace WindBot.Game.AI
if (defender.IsMonsterDangerous() || (defender.IsMonsterInvincible() && defender.IsDefense())) if (defender.IsMonsterDangerous() || (defender.IsMonsterInvincible() && defender.IsDefense()))
return false; return false;
if (defender.Id == _CardId.CrystalWingSynchroDragon && !defender.IsDisabled() && attacker.Level >= 5) if (defender.Id == _CardId.CrystalWingSynchroDragon && defender.IsAttack() && !defender.IsDisabled() && attacker.Level >= 5)
return false; return false;
if (defender.Id == _CardId.NumberS39UtopiaTheLightning && !defender.IsDisabled() && defender.HasXyzMaterial(2, _CardId.Number39Utopia)) if (defender.Id == _CardId.NumberS39UtopiaTheLightning && defender.IsAttack() && !defender.IsDisabled() && defender.HasXyzMaterial(2, _CardId.Number39Utopia))
defender.RealPower = 5000; defender.RealPower = 5000;
} }
......
...@@ -124,13 +124,49 @@ namespace WindBot.Game.AI ...@@ -124,13 +124,49 @@ namespace WindBot.Game.AI
// Some AI need do something on new turn // Some AI need do something on new turn
} }
public virtual IList<ClientCard> OnSelectCard(IList<ClientCard> cards, int min, int max, bool cancelable) public virtual IList<ClientCard> OnSelectCard(IList<ClientCard> cards, int min, int max, int hint, bool cancelable)
{ {
// For overriding // For overriding
return null; return null;
} }
public virtual IList<ClientCard> OnSelectSum(IList<ClientCard> cards, int sum, int min, int max, bool mode) public virtual IList<ClientCard> OnSelectSum(IList<ClientCard> cards, int sum, int min, int max, int hint, bool mode)
{
// For overriding
return null;
}
public virtual IList<ClientCard> OnSelectFusionMaterial(IList<ClientCard> cards, int min, int max)
{
// For overriding
return null;
}
public virtual IList<ClientCard> OnSelectSynchroMaterial(IList<ClientCard> cards, int sum, int min, int max)
{
// For overriding
return null;
}
public virtual IList<ClientCard> OnSelectXyzMaterial(IList<ClientCard> cards, int min, int max)
{
// For overriding
return null;
}
public virtual IList<ClientCard> OnSelectLinkMaterial(IList<ClientCard> cards, int min, int max)
{
// For overriding
return null;
}
public virtual IList<ClientCard> OnSelectRitualTribute(IList<ClientCard> cards, int sum, int min, int max)
{
// For overriding
return null;
}
public virtual IList<ClientCard> OnSelectPendulumSummon(IList<ClientCard> cards, int max)
{ {
// For overriding // For overriding
return null; return null;
......
...@@ -85,6 +85,8 @@ namespace WindBot.Game ...@@ -85,6 +85,8 @@ namespace WindBot.Game
{ {
m_selector = null; m_selector = null;
m_nextSelector = null; m_nextSelector = null;
m_thirdSelector = null;
m_materialSelector = null;
m_option = -1; m_option = -1;
m_yesno = -1; m_yesno = -1;
m_position = CardPosition.FaceUpAttack; m_position = CardPosition.FaceUpAttack;
...@@ -158,17 +160,60 @@ namespace WindBot.Game ...@@ -158,17 +160,60 @@ namespace WindBot.Game
/// <param name="cards">List of available cards.</param> /// <param name="cards">List of available cards.</param>
/// <param name="min">Minimal quantity.</param> /// <param name="min">Minimal quantity.</param>
/// <param name="max">Maximal quantity.</param> /// <param name="max">Maximal quantity.</param>
/// <param name="hint">The hint message of the select.</param>
/// <param name="cancelable">True if you can return an empty list.</param> /// <param name="cancelable">True if you can return an empty list.</param>
/// <returns>A new list containing the selected cards.</returns> /// <returns>A new list containing the selected cards.</returns>
public IList<ClientCard> OnSelectCard(IList<ClientCard> cards, int min, int max, bool cancelable) public IList<ClientCard> OnSelectCard(IList<ClientCard> cards, int min, int max, int hint, bool cancelable)
{ {
const int HINTMSG_FMATERIAL = 511;
const int HINTMSG_SMATERIAL = 512;
const int HINTMSG_XMATERIAL = 513;
const int HINTMSG_LMATERIAL = 533;
const int HINTMSG_SPSUMMON = 509;
// Check for the executor. // Check for the executor.
IList<ClientCard> result = Executor.OnSelectCard(cards, min, max, cancelable); IList<ClientCard> result = Executor.OnSelectCard(cards, min, max, hint, cancelable);
if (result != null) if (result != null)
return result; return result;
// Update the next selector. if (hint == HINTMSG_SPSUMMON && min == 1 && max > min) // pendulum summon
CardSelector selector = GetSelectedCards(); {
result = Executor.OnSelectPendulumSummon(cards, max);
if (result != null)
return result;
}
CardSelector selector = null;
if (hint == HINTMSG_FMATERIAL || hint == HINTMSG_SMATERIAL || hint == HINTMSG_XMATERIAL || hint == HINTMSG_LMATERIAL)
{
if (m_materialSelector != null)
{
//Logger.DebugWriteLine("m_materialSelector");
selector = m_materialSelector;
}
else
{
if (hint == HINTMSG_FMATERIAL)
result = Executor.OnSelectFusionMaterial(cards, min, max);
if (hint == HINTMSG_SMATERIAL)
result = Executor.OnSelectSynchroMaterial(cards, 0, min, max);
if (hint == HINTMSG_XMATERIAL)
result = Executor.OnSelectXyzMaterial(cards, min, max);
if (hint == HINTMSG_LMATERIAL)
result = Executor.OnSelectLinkMaterial(cards, min, max);
if (result != null)
return result;
// Update the next selector.
selector = GetSelectedCards();
}
}
else
{
// Update the next selector.
selector = GetSelectedCards();
}
// If we selected a card, use this card. // If we selected a card, use this card.
if (selector != null) if (selector != null)
...@@ -373,14 +418,45 @@ namespace WindBot.Game ...@@ -373,14 +418,45 @@ namespace WindBot.Game
/// <param name="max">Maximum cards.</param> /// <param name="max">Maximum cards.</param>
/// <param name="mode">True for exact equal.</param> /// <param name="mode">True for exact equal.</param>
/// <returns></returns> /// <returns></returns>
public IList<ClientCard> OnSelectSum(IList<ClientCard> cards, int sum, int min, int max, bool mode) public IList<ClientCard> OnSelectSum(IList<ClientCard> cards, int sum, int min, int max, int hint, bool mode)
{ {
IList<ClientCard> selected = Executor.OnSelectSum(cards, sum, min, max, mode); const int HINTMSG_RELEASE = 500;
const int HINTMSG_SMATERIAL = 512;
IList<ClientCard> selected = Executor.OnSelectSum(cards, sum, min, max, hint, mode);
if (selected != null) if (selected != null)
{ {
return selected; return selected;
} }
if (hint == HINTMSG_RELEASE || hint == HINTMSG_SMATERIAL)
{
if (m_materialSelector != null)
{
selected = m_materialSelector.Select(cards, min, max);
}
else
{
if (hint == HINTMSG_SMATERIAL)
selected = Executor.OnSelectSynchroMaterial(cards, sum, min, max);
if (hint == HINTMSG_RELEASE)
selected = Executor.OnSelectRitualTribute(cards, sum, min, max);
}
if (selected != null)
{
int s1 = 0, s2 = 0;
foreach (ClientCard card in selected)
{
s1 += card.OpParam1;
s2 += (card.OpParam2 != 0) ? card.OpParam2 : card.OpParam1;
}
if ((mode && (s1 == sum || s2 == sum)) || (!mode && (s1 >= sum || s2 >= sum)))
{
return selected;
}
}
}
if (mode) if (mode)
{ {
// equal // equal
...@@ -497,9 +573,10 @@ namespace WindBot.Game ...@@ -497,9 +573,10 @@ namespace WindBot.Game
/// <param name="cards">List of available cards.</param> /// <param name="cards">List of available cards.</param>
/// <param name="min">Minimal quantity.</param> /// <param name="min">Minimal quantity.</param>
/// <param name="max">Maximal quantity.</param> /// <param name="max">Maximal quantity.</param>
/// <param name="hint">The hint message of the select.</param>
/// <param name="cancelable">True if you can return an empty list.</param> /// <param name="cancelable">True if you can return an empty list.</param>
/// <returns>A new list containing the tributed cards.</returns> /// <returns>A new list containing the tributed cards.</returns>
public IList<ClientCard> OnSelectTribute(IList<ClientCard> cards, int min, int max, bool cancelable) public IList<ClientCard> OnSelectTribute(IList<ClientCard> cards, int min, int max, int hint, bool cancelable)
{ {
// Always choose the minimum and lowest atk. // Always choose the minimum and lowest atk.
List<ClientCard> sorted = new List<ClientCard>(); List<ClientCard> sorted = new List<ClientCard>();
...@@ -543,6 +620,7 @@ namespace WindBot.Game ...@@ -543,6 +620,7 @@ namespace WindBot.Game
private CardSelector m_selector; private CardSelector m_selector;
private CardSelector m_nextSelector; private CardSelector m_nextSelector;
private CardSelector m_thirdSelector; private CardSelector m_thirdSelector;
private CardSelector m_materialSelector;
private CardPosition m_position = CardPosition.FaceUpAttack; private CardPosition m_position = CardPosition.FaceUpAttack;
private int m_option; private int m_option;
private int m_number; private int m_number;
...@@ -626,6 +704,36 @@ namespace WindBot.Game ...@@ -626,6 +704,36 @@ namespace WindBot.Game
m_thirdSelector = new CardSelector(loc); m_thirdSelector = new CardSelector(loc);
} }
public void SelectMaterials(ClientCard card)
{
m_materialSelector = new CardSelector(card);
}
public void SelectMaterials(IList<ClientCard> cards)
{
m_materialSelector = new CardSelector(cards);
}
public void SelectMaterials(int cardId)
{
m_materialSelector = new CardSelector(cardId);
}
public void SelectMaterials(IList<int> ids)
{
m_materialSelector = new CardSelector(ids);
}
public void SelectMaterials(CardLocation loc)
{
m_materialSelector = new CardSelector(loc);
}
public void CleanSelectMaterials()
{
m_materialSelector = null;
}
public CardSelector GetSelectedCards() public CardSelector GetSelectedCards()
{ {
CardSelector selected = m_selector; CardSelector selected = m_selector;
......
...@@ -25,6 +25,7 @@ namespace WindBot.Game ...@@ -25,6 +25,7 @@ namespace WindBot.Game
private Room _room; private Room _room;
private Duel _duel; private Duel _duel;
private int _hand; private int _hand;
private int _select_hint;
public GameBehavior(GameClient game) public GameBehavior(GameClient game)
{ {
...@@ -42,6 +43,8 @@ namespace WindBot.Game ...@@ -42,6 +43,8 @@ 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); Deck = Deck.Load(_ai.Executor.Deck);
_select_hint = 0;
} }
public int GetLocalPlayer(int player) public int GetLocalPlayer(int player)
...@@ -80,6 +83,7 @@ namespace WindBot.Game ...@@ -80,6 +83,7 @@ namespace WindBot.Game
_messages.Add(GameMessage.Retry, OnRetry); _messages.Add(GameMessage.Retry, OnRetry);
_messages.Add(GameMessage.Start, OnStart); _messages.Add(GameMessage.Start, OnStart);
_messages.Add(GameMessage.Hint, OnHint);
_messages.Add(GameMessage.Win, OnWin); _messages.Add(GameMessage.Win, OnWin);
_messages.Add(GameMessage.Draw, OnDraw); _messages.Add(GameMessage.Draw, OnDraw);
_messages.Add(GameMessage.ShuffleDeck, OnShuffleDeck); _messages.Add(GameMessage.ShuffleDeck, OnShuffleDeck);
...@@ -120,6 +124,9 @@ namespace WindBot.Game ...@@ -120,6 +124,9 @@ namespace WindBot.Game
_messages.Add(GameMessage.AnnounceRace, OnAnnounceRace); _messages.Add(GameMessage.AnnounceRace, OnAnnounceRace);
_messages.Add(GameMessage.AnnounceCardFilter, OnAnnounceCard); _messages.Add(GameMessage.AnnounceCardFilter, OnAnnounceCard);
_messages.Add(GameMessage.RockPaperScissors, OnRockPaperScissors); _messages.Add(GameMessage.RockPaperScissors, OnRockPaperScissors);
_messages.Add(GameMessage.SpSummoning, OnSpSummon);
_messages.Add(GameMessage.SpSummoned, OnSpSummon);
} }
private void OnJoinGame(BinaryReader packet) private void OnJoinGame(BinaryReader packet)
...@@ -295,6 +302,17 @@ namespace WindBot.Game ...@@ -295,6 +302,17 @@ namespace WindBot.Game
throw new Exception("Got MSG_RETRY."); throw new Exception("Got MSG_RETRY.");
} }
private void OnHint(BinaryReader packet)
{
int type = packet.ReadByte();
int player = packet.ReadByte();
int data = packet.ReadInt32();
if (type == 3) // HINT_SELECTMSG
{
_select_hint = data;
}
}
private void OnStart(BinaryReader packet) private void OnStart(BinaryReader packet)
{ {
int type = packet.ReadByte(); int type = packet.ReadByte();
...@@ -643,7 +661,7 @@ namespace WindBot.Game ...@@ -643,7 +661,7 @@ namespace WindBot.Game
Connection.Send(CtosMessage.Response, _ai.OnSelectBattleCmd(battle).ToValue()); Connection.Send(CtosMessage.Response, _ai.OnSelectBattleCmd(battle).ToValue());
} }
private void InternalOnSelectCard(BinaryReader packet, Func<IList<ClientCard>, int, int, bool, IList<ClientCard>> func) private void InternalOnSelectCard(BinaryReader packet, Func<IList<ClientCard>, int, int, int, bool, IList<ClientCard>> func)
{ {
packet.ReadByte(); // player packet.ReadByte(); // player
bool cancelable = packet.ReadByte() != 0; bool cancelable = packet.ReadByte() != 0;
...@@ -670,7 +688,8 @@ namespace WindBot.Game ...@@ -670,7 +688,8 @@ namespace WindBot.Game
cards.Add(card); cards.Add(card);
} }
IList<ClientCard> selected = func(cards, min, max, cancelable); IList<ClientCard> selected = func(cards, min, max, _select_hint, cancelable);
_select_hint = 0;
if (selected.Count == 0 && cancelable) if (selected.Count == 0 && cancelable)
{ {
...@@ -1027,7 +1046,8 @@ namespace WindBot.Game ...@@ -1027,7 +1046,8 @@ namespace WindBot.Game
sumval -= mandatoryCards[k].OpParam1; sumval -= mandatoryCards[k].OpParam1;
} }
IList<ClientCard> selected = _ai.OnSelectSum(cards, sumval, min, max, mode); IList<ClientCard> selected = _ai.OnSelectSum(cards, sumval, min, max, _select_hint, mode);
_select_hint = 0;
byte[] result = new byte[mandatoryCards.Count + selected.Count + 1]; byte[] result = new byte[mandatoryCards.Count + selected.Count + 1];
int index = 0; int index = 0;
...@@ -1125,5 +1145,10 @@ namespace WindBot.Game ...@@ -1125,5 +1145,10 @@ namespace WindBot.Game
result = _ai.OnRockPaperScissors(); result = _ai.OnRockPaperScissors();
Connection.Send(CtosMessage.Response, result); Connection.Send(CtosMessage.Response, result);
} }
private void OnSpSummon(BinaryReader packet)
{
_ai.CleanSelectMaterials();
}
} }
} }
\ No newline at end of file
...@@ -111,6 +111,40 @@ The parameters are same as commandlines, but low cased. ...@@ -111,6 +111,40 @@ The parameters are same as commandlines, but low cased.
* If one chain includes two activation that use `AI.SelectCard`, the second one won't select correctly. * If one chain includes two activation that use `AI.SelectCard`, the second one won't select correctly.
### Changelog
#### v0x1340 (2017-11-06)
- Update YGOPro protrol to 0x1340
- Add support for the New Master Rule
- Decks update
- New commandline parameters
- Add support for Match and TAG duel
- Add server mode
- Bot dialogs now customable
- Only use normal deck when random picking decks
- Send sorry when the AI did something wrong that make the duel can't continue (for example, selected illegal card)
- Send info when the deck of the AI is illegal (for example, lflist dismatch)
- Fix the issue that the bot will attack _Dupe Frog_ with low attack monster when there is monster next to _Dupe Frog_
- Fix the issue that synchro summon stuck in some condition [\#7](https://github.com/IceYGO/windbot/issues/7)
- Fix C#6.0 (VS2015) support
- Fix `OnUpdateData`
- New and updated `DefaultExecutor`
- New and updated `AI.Utils`, `ClientCard`, `ClientField` functions
- Add `OnNewTurn`, `AI.SelectYesNo`, `AI.SelectThirdCard`, `Duel.ChainTargets`, `Duel.LastSummonPlayer`
- Shortcut `Bot` for `Duel.Fields[0]`, `Enemy` for `Duel.Fields[1]`
- `CardId` is now class instead of enum so `(int)` is no longer needed
- Update the known card enums, add `Floodgate`, `OneForXyz`, `FusionSpell`, `MonsterHasPreventActivationEffectInBattle`
- Update `OnPreBattleBetween` to calculate the ATK of cards like _Number S39: Utopia the Lightning_
- Update direct attack handling
#### v0x133D (2017-09-24)
- Update YGOPro protrol to 0x133D
- Use the latest YGOSharp.Network to improve performances
- Update the namespace of `YGOSharp.OCGWrapper`
- Fix the default trap cards not always activating
### TODO list ### TODO list
* More decks * More decks
......
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