Commit f2f54c2a authored by mercury233's avatar mercury233
parents b489285e c53428bc
......@@ -247,7 +247,7 @@ namespace WindBot.Game.AI
foreach (ClientCard ecard in spells)
{
if (ecard.IsFaceup())
if (ecard.IsFaceup() && ecard.HasType(CardType.Continuous))
return ecard;
}
......@@ -296,5 +296,85 @@ namespace WindBot.Game.AI
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
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);
if (max == 2 && cards[0].Location == CardLocation.Deck)
......@@ -157,60 +157,26 @@ namespace WindBot.Game.AI.Decks
result.Add(card);
}
}
if (result.Count < min)
{
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;
}
}
AI.Utils.CheckSelectCount(result, cards, min, max);
return result;
}
Logger.DebugWriteLine("Use default.");
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);
if (sum != 8 || !mode)
Logger.DebugWriteLine("OnSelectSynchroMaterial " + cards.Count + " " + sum + " " + min + " " + max);
if (sum != 8)
return null;
foreach (ClientCard AlternativeWhiteDragon in UsedAlternativeWhiteDragon)
......
using YGOSharp.OCGWrapper.Enums;
using System.Collections.Generic;
using WindBot;
using WindBot.Game;
using WindBot.Game.AI;
namespace WindBot.Game.AI.Decks
{
[Deck("Test", "AI_Test", "Test")]
public class DoEverythingExecutor : DefaultExecutor
{
public class CardId
{
public const int LeoWizard = 4392470;
public const int Bunilla = 69380702;
}
public DoEverythingExecutor(GameAI ai, Duel duel)
: base(ai, duel)
{
AddExecutor(ExecutorType.SpSummon);
AddExecutor(ExecutorType.Activate, DefaultDontChainMyself);
AddExecutor(ExecutorType.SummonOrSet);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
AddExecutor(ExecutorType.SpellSet);
}
public override IList<ClientCard> OnSelectCard(IList<ClientCard> cards, int min, int max, bool cancelable)
{
if (Duel.Phase == DuelPhase.BattleStart)
return null;
IList<ClientCard> selected = new List<ClientCard>();
// select the last cards
for (int i = 1; i <= max; ++i)
selected.Add(cards[cards.Count-i]);
return selected;
}
public override int OnSelectOption(IList<int> options)
{
return Program.Rand.Next(options.Count);
}
}
using YGOSharp.OCGWrapper.Enums;
using System.Collections.Generic;
using WindBot;
using WindBot.Game;
using WindBot.Game.AI;
namespace WindBot.Game.AI.Decks
{
[Deck("Test", "AI_Test", "Test")]
public class DoEverythingExecutor : DefaultExecutor
{
public class CardId
{
public const int LeoWizard = 4392470;
public const int Bunilla = 69380702;
}
public DoEverythingExecutor(GameAI ai, Duel duel)
: base(ai, duel)
{
AddExecutor(ExecutorType.SpSummon);
AddExecutor(ExecutorType.Activate, DefaultDontChainMyself);
AddExecutor(ExecutorType.SummonOrSet);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
AddExecutor(ExecutorType.SpellSet);
}
public override IList<ClientCard> OnSelectCard(IList<ClientCard> cards, int min, int max, int hint, bool cancelable)
{
if (Duel.Phase == DuelPhase.BattleStart)
return null;
IList<ClientCard> selected = new List<ClientCard>();
// select the last cards
for (int i = 1; i <= max; ++i)
selected.Add(cards[cards.Count-i]);
return selected;
}
public override int OnSelectOption(IList<int> options)
{
return Program.Rand.Next(options.Count);
}
}
}
\ No newline at end of file
......@@ -103,39 +103,19 @@ namespace WindBot.Game.AI.Decks
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");
IList<ClientCard> avail = new List<ClientCard>();
foreach (ClientCard card in cards)
{
// 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;
if (!result.Contains(card) && (!ClownUsed || card.Id != CardId.PerformageTrickClown))
result.Add(card);
if (result.Count >= max)
break;
}
Logger.DebugWriteLine("Use default.");
return null;
AI.Utils.CheckSelectCount(result, cards, min, max);
return result;
}
private bool ReinforcementOfTheArmyEffect()
......
......@@ -132,14 +132,10 @@ namespace WindBot.Game.AI.Decks
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)
{
return null;
}
// pendulum summon, select the last cards
Logger.DebugWriteLine("OnSelectPendulumSummon");
// select the last cards
IList<ClientCard> selected = new List<ClientCard>();
for (int i = 1; i <= max; ++i)
......
using YGOSharp.OCGWrapper.Enums;
using System.Collections.Generic;
using WindBot;
using WindBot.Game;
using WindBot.Game.AI;
namespace WindBot.Game.AI.Decks
{
[Deck("Rainbow", "AI_Rainbow")]
class RainbowExecutor : DefaultExecutor
{
public class CardId
{
public const int MysteryShellDragon = 18108166;
public const int PhantomGryphon = 74852097;
public const int MasterPendulumTheDracoslayer = 75195825;
public const int AngelTrumpeter = 87979586;
public const int MetalfoesGoldriver = 33256280;
public const int MegalosmasherX = 81823360;
public const int RescueRabbit = 85138716;
public const int UnexpectedDai = 911883;
public const int HarpiesFeatherDuster = 18144506;
public const int PotOfDesires = 35261759;
public const int MonsterReborn = 83764718;
public const int SmashingGround = 97169186;
public const int QuakingMirrorForce = 40838625;
public const int DrowningMirrorForce = 47475363;
public const int BlazingMirrorForce = 75249652;
public const int StormingMirrorForce = 5650082;
public const int MirrorForce = 44095762;
public const int DarkMirrorForce = 20522190;
public const int BottomlessTrapHole = 29401950;
public const int TraptrixTrapHoleNightmare = 29616929;
public const int StarlightRoad = 58120309;
public const int ScarlightRedDragonArchfiend = 80666118;
public const int IgnisterProminenceTheBlastingDracoslayer = 18239909;
public const int StardustDragon = 44508094;
public const int NumberS39UtopiatheLightning = 56832966;
public const int Number37HopeWovenDragonSpiderShark = 37279508;
public const int Number39Utopia = 84013237;
public const int EvolzarLaggia = 74294676;
public const int Number59CrookedCook = 82697249;
public const int CastelTheSkyblasterMusketeer = 82633039;
public const int StarliegePaladynamo = 61344030;
public const int LightningChidori = 22653490;
public const int EvilswarmExcitonKnight = 46772449;
public const int GagagaCowboy = 12014404;
public const int EvilswarmNightmare = 359563;
public const int TraptrixRafflesia = 6511113;
}
private bool NormalSummoned = false;
public RainbowExecutor(GameAI ai, Duel duel)
: base(ai, duel)
{
AddExecutor(ExecutorType.Activate, CardId.HarpiesFeatherDuster);
AddExecutor(ExecutorType.Activate, CardId.UnexpectedDai, UnexpectedDaiEffect);
AddExecutor(ExecutorType.Summon, CardId.RescueRabbit);
AddExecutor(ExecutorType.Activate, CardId.RescueRabbit, RescueRabbitEffect);
AddExecutor(ExecutorType.Activate, CardId.PotOfDesires, DefaultPotOfDesires);
AddExecutor(ExecutorType.Summon, CardId.AngelTrumpeter, AngelTrumpeterSummon);
AddExecutor(ExecutorType.Summon, CardId.MegalosmasherX, MegalosmasherXSummon);
AddExecutor(ExecutorType.Summon, CardId.MasterPendulumTheDracoslayer, MasterPendulumTheDracoslayerSummon);
AddExecutor(ExecutorType.Summon, CardId.MysteryShellDragon, MysteryShellDragonSummon);
AddExecutor(ExecutorType.Summon, CardId.PhantomGryphon, PhantomGryphonSummon);
AddExecutor(ExecutorType.Summon, CardId.MetalfoesGoldriver, MetalfoesGoldriverSummon);
AddExecutor(ExecutorType.Summon, NormalSummon);
AddExecutor(ExecutorType.SpSummon, CardId.IgnisterProminenceTheBlastingDracoslayer, IgnisterProminenceTheBlastingDracoslayerSummon);
AddExecutor(ExecutorType.Activate, CardId.IgnisterProminenceTheBlastingDracoslayer, IgnisterProminenceTheBlastingDracoslayerEffect);
AddExecutor(ExecutorType.SpSummon, CardId.GagagaCowboy, GagagaCowboySummon);
AddExecutor(ExecutorType.Activate, CardId.GagagaCowboy);
AddExecutor(ExecutorType.SpSummon, CardId.EvilswarmExcitonKnight, DefaultEvilswarmExcitonKnightSummon);
AddExecutor(ExecutorType.Activate, CardId.EvilswarmExcitonKnight, DefaultEvilswarmExcitonKnightEffect);
AddExecutor(ExecutorType.SpSummon, CardId.EvolzarLaggia, EvolzarLaggiaSummon);
AddExecutor(ExecutorType.Activate, CardId.EvolzarLaggia, EvolzarLaggiaEffect);
AddExecutor(ExecutorType.SpSummon, CardId.EvilswarmNightmare, EvilswarmNightmareSummon);
AddExecutor(ExecutorType.Activate, CardId.EvilswarmNightmare);
AddExecutor(ExecutorType.SpSummon, CardId.StarliegePaladynamo, StarliegePaladynamoSummon);
AddExecutor(ExecutorType.Activate, CardId.StarliegePaladynamo, StarliegePaladynamoEffect);
AddExecutor(ExecutorType.SpSummon, CardId.LightningChidori, LightningChidoriSummon);
AddExecutor(ExecutorType.Activate, CardId.LightningChidori, LightningChidoriEffect);
AddExecutor(ExecutorType.SpSummon, CardId.Number37HopeWovenDragonSpiderShark, Number37HopeWovenDragonSpiderSharkSummon);
AddExecutor(ExecutorType.Activate, CardId.Number37HopeWovenDragonSpiderShark);
AddExecutor(ExecutorType.SpSummon, CardId.TraptrixRafflesia, TraptrixRafflesiaSummon);
AddExecutor(ExecutorType.Activate, CardId.TraptrixRafflesia);
AddExecutor(ExecutorType.Activate, CardId.SmashingGround, DefaultSmashingGround);
AddExecutor(ExecutorType.SpSummon, CardId.CastelTheSkyblasterMusketeer, DefaultCastelTheSkyblasterMusketeerSummon);
AddExecutor(ExecutorType.Activate, CardId.CastelTheSkyblasterMusketeer, DefaultCastelTheSkyblasterMusketeerEffect);
AddExecutor(ExecutorType.SpSummon, CardId.IgnisterProminenceTheBlastingDracoslayer, IgnisterProminenceTheBlastingDracoslayerSummon);
AddExecutor(ExecutorType.Activate, CardId.IgnisterProminenceTheBlastingDracoslayer, IgnisterProminenceTheBlastingDracoslayerEffect);
AddExecutor(ExecutorType.SpSummon, CardId.ScarlightRedDragonArchfiend, DefaultScarlightRedDragonArchfiendSummon);
AddExecutor(ExecutorType.Activate, CardId.ScarlightRedDragonArchfiend, DefaultScarlightRedDragonArchfiendEffect);
AddExecutor(ExecutorType.SpSummon, CardId.Number39Utopia, DefaultNumberS39UtopiaTheLightningSummon);
AddExecutor(ExecutorType.SpSummon, CardId.NumberS39UtopiatheLightning);
AddExecutor(ExecutorType.Activate, CardId.NumberS39UtopiatheLightning);
AddExecutor(ExecutorType.SpSummon, CardId.StardustDragon, DefaultStardustDragonSummon);
AddExecutor(ExecutorType.Activate, CardId.StardustDragon, DefaultStardustDragonEffect);
AddExecutor(ExecutorType.SpSummon, CardId.Number59CrookedCook, Number59CrookedCookSummon);
AddExecutor(ExecutorType.Activate, CardId.Number59CrookedCook, Number59CrookedCookEffect);
AddExecutor(ExecutorType.SpellSet, CardId.StarlightRoad, TrapSet);
AddExecutor(ExecutorType.SpellSet, CardId.QuakingMirrorForce, TrapSet);
AddExecutor(ExecutorType.SpellSet, CardId.DrowningMirrorForce, TrapSet);
AddExecutor(ExecutorType.SpellSet, CardId.BlazingMirrorForce, TrapSet);
AddExecutor(ExecutorType.SpellSet, CardId.StormingMirrorForce, TrapSet);
AddExecutor(ExecutorType.SpellSet, CardId.MirrorForce, TrapSet);
AddExecutor(ExecutorType.SpellSet, CardId.DarkMirrorForce, TrapSet);
AddExecutor(ExecutorType.SpellSet, CardId.BottomlessTrapHole, TrapSet);
AddExecutor(ExecutorType.SpellSet, CardId.TraptrixTrapHoleNightmare, TrapSet);
AddExecutor(ExecutorType.Activate, CardId.StarlightRoad, DefaultTrap);
AddExecutor(ExecutorType.Activate, CardId.QuakingMirrorForce, DefaultUniqueTrap);
AddExecutor(ExecutorType.Activate, CardId.DrowningMirrorForce, DefaultUniqueTrap);
AddExecutor(ExecutorType.Activate, CardId.BlazingMirrorForce, DefaultUniqueTrap);
AddExecutor(ExecutorType.Activate, CardId.StormingMirrorForce, DefaultUniqueTrap);
AddExecutor(ExecutorType.Activate, CardId.MirrorForce, DefaultUniqueTrap);
AddExecutor(ExecutorType.Activate, CardId.DarkMirrorForce, DefaultUniqueTrap);
AddExecutor(ExecutorType.Activate, CardId.BottomlessTrapHole, DefaultUniqueTrap);
AddExecutor(ExecutorType.Activate, CardId.TraptrixTrapHoleNightmare, DefaultUniqueTrap);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
}
public override void OnNewTurn()
{
NormalSummoned = false;
}
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
{
if (!defender.IsMonsterHasPreventActivationEffectInBattle())
{
if (Bot.HasInMonstersZone(CardId.Number37HopeWovenDragonSpiderShark, true, true))
attacker.RealPower = attacker.RealPower + 1000;
}
return base.OnPreBattleBetween(attacker, defender);
}
private bool UnexpectedDaiEffect()
{
if (Bot.HasInHand(CardId.RescueRabbit) || NormalSummoned)
AI.SelectCard(new[]
{
CardId.MysteryShellDragon,
CardId.PhantomGryphon,
CardId.MegalosmasherX
});
else if (AI.Utils.IsTurn1OrMain2())
{
if (Bot.HasInHand(CardId.MysteryShellDragon))
AI.SelectCard(CardId.MysteryShellDragon);
else if (Bot.HasInHand(CardId.MegalosmasherX))
AI.SelectCard(CardId.MegalosmasherX);
else if (Bot.HasInHand(CardId.AngelTrumpeter))
AI.SelectCard(CardId.AngelTrumpeter);
}
else
{
if (Bot.HasInHand(CardId.MegalosmasherX))
AI.SelectCard(CardId.MegalosmasherX);
else if (Bot.HasInHand(CardId.MasterPendulumTheDracoslayer))
AI.SelectCard(CardId.MasterPendulumTheDracoslayer);
else if (Bot.HasInHand(CardId.PhantomGryphon))
AI.SelectCard(CardId.PhantomGryphon);
else if (Bot.HasInHand(CardId.AngelTrumpeter))
AI.SelectCard(new[]
{
CardId.MetalfoesGoldriver,
CardId.MasterPendulumTheDracoslayer
});
}
return true;
}
private bool RescueRabbitEffect()
{
if (AI.Utils.IsTurn1OrMain2())
{
AI.SelectCard(new[]
{
CardId.MegalosmasherX,
CardId.MysteryShellDragon
});
}
else
{
AI.SelectCard(new[]
{
CardId.MasterPendulumTheDracoslayer,
CardId.PhantomGryphon,
CardId.MegalosmasherX,
CardId.MetalfoesGoldriver,
CardId.AngelTrumpeter
});
}
return true;
}
private bool MysteryShellDragonSummon()
{
return Bot.HasInMonstersZone(CardId.MysteryShellDragon);
}
private bool PhantomGryphonSummon()
{
return Bot.HasInMonstersZone(CardId.PhantomGryphon);
}
private bool MasterPendulumTheDracoslayerSummon()
{
return Bot.HasInMonstersZone(CardId.MasterPendulumTheDracoslayer);
}
private bool AngelTrumpeterSummon()
{
return Bot.HasInMonstersZone(CardId.AngelTrumpeter);
}
private bool MetalfoesGoldriverSummon()
{
return Bot.HasInMonstersZone(CardId.MetalfoesGoldriver);
}
private bool MegalosmasherXSummon()
{
return Bot.HasInMonstersZone(CardId.MegalosmasherX);
}
private bool NormalSummon()
{
return true;
}
private bool GagagaCowboySummon()
{
if (Duel.LifePoints[1] <= 800)
{
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
}
return false;
}
private bool IgnisterProminenceTheBlastingDracoslayerSummon()
{
return AI.Utils.GetProblematicEnemyCard() != null;
}
private bool IgnisterProminenceTheBlastingDracoslayerEffect()
{
if (ActivateDescription == AI.Utils.GetStringId(CardId.IgnisterProminenceTheBlastingDracoslayer, 1))
return true;
ClientCard target1 = null;
ClientCard target2 = AI.Utils.GetProblematicEnemyCard();
List<ClientCard> spells = Enemy.GetSpells();
foreach (ClientCard spell in spells)
{
if (spell.HasType(CardType.Pendulum) && !spell.Equals(target2))
{
target1 = spell;
break;
}
}
List<ClientCard> monsters = Enemy.GetMonsters();
foreach (ClientCard monster in monsters)
{
if (monster.HasType(CardType.Pendulum) && !monster.Equals(target2))
{
target1 = monster;
break;
}
}
if (target2 == null && target1 != null)
{
foreach (ClientCard spell in spells)
{
if (!spell.Equals(target1))
{
target2 = spell;
break;
}
}
foreach (ClientCard monster in monsters)
{
if (!monster.Equals(target1))
{
target2 = monster;
break;
}
}
}
if (target2 == null)
return false;
AI.SelectCard(target1);
AI.SelectNextCard(target2);
return true;
}
private bool Number37HopeWovenDragonSpiderSharkSummon()
{
return AI.Utils.IsAllEnemyBetterThanValue(1700, false) && !AI.Utils.IsOneEnemyBetterThanValue(3600, true);
}
private bool LightningChidoriSummon()
{
foreach (ClientCard monster in Enemy.GetMonsters())
{
if (monster.IsFacedown())
{
return true;
}
}
foreach (ClientCard spell in Enemy.GetSpells())
{
if (spell.IsFacedown())
{
return true;
}
}
return AI.Utils.GetProblematicEnemyCard() != null;
}
private bool LightningChidoriEffect()
{
ClientCard problematicCard = AI.Utils.GetProblematicEnemyCard();
AI.SelectNextCard(problematicCard);
return true;
}
private bool EvolzarLaggiaSummon()
{
return (AI.Utils.IsAllEnemyBetterThanValue(2000, false) && !AI.Utils.IsOneEnemyBetterThanValue(2400, true)) || AI.Utils.IsTurn1OrMain2();
}
private bool EvilswarmNightmareSummon()
{
if (AI.Utils.IsTurn1OrMain2())
{
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
}
return false;
}
private bool TraptrixRafflesiaSummon()
{
if (AI.Utils.IsTurn1OrMain2() && (Bot.GetRemainingCount(CardId.BottomlessTrapHole, 1) + Bot.GetRemainingCount(CardId.TraptrixTrapHoleNightmare, 1)) > 0)
{
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
}
return false;
}
private bool Number59CrookedCookSummon()
{
return ((Bot.GetMonsterCount() + Bot.GetSpellCount() - 2) <= 1) &&
((AI.Utils.IsOneEnemyBetter() && !AI.Utils.IsOneEnemyBetterThanValue(2300, true)) || AI.Utils.IsTurn1OrMain2());
}
private bool Number59CrookedCookEffect()
{
if (Duel.Player == 0)
{
if (AI.Utils.IsChainTarget(Card))
return true;
}
else
{
if ((Bot.GetMonsterCount() + Bot.GetSpellCount() -1) <= 1)
return true;
}
return false;
}
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);
}
}
}
using YGOSharp.OCGWrapper.Enums;
using System.Collections.Generic;
using WindBot;
using WindBot.Game;
using WindBot.Game.AI;
namespace WindBot.Game.AI.Decks
{
[Deck("Rainbow", "AI_Rainbow")]
class RainbowExecutor : DefaultExecutor
{
public class CardId
{
public const int MysteryShellDragon = 18108166;
public const int PhantomGryphon = 74852097;
public const int MasterPendulumTheDracoslayer = 75195825;
public const int AngelTrumpeter = 87979586;
public const int MetalfoesGoldriver = 33256280;
public const int MegalosmasherX = 81823360;
public const int RescueRabbit = 85138716;
public const int UnexpectedDai = 911883;
public const int HarpiesFeatherDuster = 18144506;
public const int PotOfDesires = 35261759;
public const int MonsterReborn = 83764718;
public const int SmashingGround = 97169186;
public const int QuakingMirrorForce = 40838625;
public const int DrowningMirrorForce = 47475363;
public const int BlazingMirrorForce = 75249652;
public const int StormingMirrorForce = 5650082;
public const int MirrorForce = 44095762;
public const int DarkMirrorForce = 20522190;
public const int BottomlessTrapHole = 29401950;
public const int TraptrixTrapHoleNightmare = 29616929;
public const int StarlightRoad = 58120309;
public const int ScarlightRedDragonArchfiend = 80666118;
public const int IgnisterProminenceTheBlastingDracoslayer = 18239909;
public const int StardustDragon = 44508094;
public const int NumberS39UtopiatheLightning = 56832966;
public const int Number37HopeWovenDragonSpiderShark = 37279508;
public const int Number39Utopia = 84013237;
public const int EvolzarLaggia = 74294676;
public const int Number59CrookedCook = 82697249;
public const int CastelTheSkyblasterMusketeer = 82633039;
public const int StarliegePaladynamo = 61344030;
public const int LightningChidori = 22653490;
public const int EvilswarmExcitonKnight = 46772449;
public const int GagagaCowboy = 12014404;
public const int EvilswarmNightmare = 359563;
public const int TraptrixRafflesia = 6511113;
}
private bool NormalSummoned = false;
public RainbowExecutor(GameAI ai, Duel duel)
: base(ai, duel)
{
AddExecutor(ExecutorType.Activate, CardId.HarpiesFeatherDuster);
AddExecutor(ExecutorType.Activate, CardId.UnexpectedDai, UnexpectedDaiEffect);
AddExecutor(ExecutorType.Summon, CardId.RescueRabbit);
AddExecutor(ExecutorType.Activate, CardId.RescueRabbit, RescueRabbitEffect);
AddExecutor(ExecutorType.Activate, CardId.PotOfDesires, DefaultPotOfDesires);
AddExecutor(ExecutorType.Summon, CardId.AngelTrumpeter, AngelTrumpeterSummon);
AddExecutor(ExecutorType.Summon, CardId.MegalosmasherX, MegalosmasherXSummon);
AddExecutor(ExecutorType.Summon, CardId.MasterPendulumTheDracoslayer, MasterPendulumTheDracoslayerSummon);
AddExecutor(ExecutorType.Summon, CardId.MysteryShellDragon, MysteryShellDragonSummon);
AddExecutor(ExecutorType.Summon, CardId.PhantomGryphon, PhantomGryphonSummon);
AddExecutor(ExecutorType.Summon, CardId.MetalfoesGoldriver, MetalfoesGoldriverSummon);
AddExecutor(ExecutorType.Summon, NormalSummon);
AddExecutor(ExecutorType.SpSummon, CardId.IgnisterProminenceTheBlastingDracoslayer, IgnisterProminenceTheBlastingDracoslayerSummon);
AddExecutor(ExecutorType.Activate, CardId.IgnisterProminenceTheBlastingDracoslayer, IgnisterProminenceTheBlastingDracoslayerEffect);
AddExecutor(ExecutorType.SpSummon, CardId.GagagaCowboy, GagagaCowboySummon);
AddExecutor(ExecutorType.Activate, CardId.GagagaCowboy);
AddExecutor(ExecutorType.SpSummon, CardId.EvilswarmExcitonKnight, DefaultEvilswarmExcitonKnightSummon);
AddExecutor(ExecutorType.Activate, CardId.EvilswarmExcitonKnight, DefaultEvilswarmExcitonKnightEffect);
AddExecutor(ExecutorType.SpSummon, CardId.EvolzarLaggia, EvolzarLaggiaSummon);
AddExecutor(ExecutorType.Activate, CardId.EvolzarLaggia, EvolzarLaggiaEffect);
AddExecutor(ExecutorType.SpSummon, CardId.EvilswarmNightmare, EvilswarmNightmareSummon);
AddExecutor(ExecutorType.Activate, CardId.EvilswarmNightmare);
AddExecutor(ExecutorType.SpSummon, CardId.StarliegePaladynamo, StarliegePaladynamoSummon);
AddExecutor(ExecutorType.Activate, CardId.StarliegePaladynamo, StarliegePaladynamoEffect);
AddExecutor(ExecutorType.SpSummon, CardId.LightningChidori, LightningChidoriSummon);
AddExecutor(ExecutorType.Activate, CardId.LightningChidori, LightningChidoriEffect);
AddExecutor(ExecutorType.SpSummon, CardId.Number37HopeWovenDragonSpiderShark, Number37HopeWovenDragonSpiderSharkSummon);
AddExecutor(ExecutorType.Activate, CardId.Number37HopeWovenDragonSpiderShark);
AddExecutor(ExecutorType.SpSummon, CardId.TraptrixRafflesia, TraptrixRafflesiaSummon);
AddExecutor(ExecutorType.Activate, CardId.TraptrixRafflesia);
AddExecutor(ExecutorType.Activate, CardId.SmashingGround, DefaultSmashingGround);
AddExecutor(ExecutorType.SpSummon, CardId.CastelTheSkyblasterMusketeer, DefaultCastelTheSkyblasterMusketeerSummon);
AddExecutor(ExecutorType.Activate, CardId.CastelTheSkyblasterMusketeer, DefaultCastelTheSkyblasterMusketeerEffect);
AddExecutor(ExecutorType.SpSummon, CardId.IgnisterProminenceTheBlastingDracoslayer, IgnisterProminenceTheBlastingDracoslayerSummon);
AddExecutor(ExecutorType.Activate, CardId.IgnisterProminenceTheBlastingDracoslayer, IgnisterProminenceTheBlastingDracoslayerEffect);
AddExecutor(ExecutorType.SpSummon, CardId.ScarlightRedDragonArchfiend, DefaultScarlightRedDragonArchfiendSummon);
AddExecutor(ExecutorType.Activate, CardId.ScarlightRedDragonArchfiend, DefaultScarlightRedDragonArchfiendEffect);
AddExecutor(ExecutorType.SpSummon, CardId.Number39Utopia, DefaultNumberS39UtopiaTheLightningSummon);
AddExecutor(ExecutorType.SpSummon, CardId.NumberS39UtopiatheLightning);
AddExecutor(ExecutorType.Activate, CardId.NumberS39UtopiatheLightning);
AddExecutor(ExecutorType.SpSummon, CardId.StardustDragon, DefaultStardustDragonSummon);
AddExecutor(ExecutorType.Activate, CardId.StardustDragon, DefaultStardustDragonEffect);
AddExecutor(ExecutorType.SpSummon, CardId.Number59CrookedCook, Number59CrookedCookSummon);
AddExecutor(ExecutorType.Activate, CardId.Number59CrookedCook, Number59CrookedCookEffect);
AddExecutor(ExecutorType.SpellSet, CardId.StarlightRoad, TrapSet);
AddExecutor(ExecutorType.SpellSet, CardId.QuakingMirrorForce, TrapSet);
AddExecutor(ExecutorType.SpellSet, CardId.DrowningMirrorForce, TrapSet);
AddExecutor(ExecutorType.SpellSet, CardId.BlazingMirrorForce, TrapSet);
AddExecutor(ExecutorType.SpellSet, CardId.StormingMirrorForce, TrapSet);
AddExecutor(ExecutorType.SpellSet, CardId.MirrorForce, TrapSet);
AddExecutor(ExecutorType.SpellSet, CardId.DarkMirrorForce, TrapSet);
AddExecutor(ExecutorType.SpellSet, CardId.BottomlessTrapHole, TrapSet);
AddExecutor(ExecutorType.SpellSet, CardId.TraptrixTrapHoleNightmare, TrapSet);
AddExecutor(ExecutorType.Activate, CardId.StarlightRoad, DefaultTrap);
AddExecutor(ExecutorType.Activate, CardId.QuakingMirrorForce, DefaultUniqueTrap);
AddExecutor(ExecutorType.Activate, CardId.DrowningMirrorForce, DefaultUniqueTrap);
AddExecutor(ExecutorType.Activate, CardId.BlazingMirrorForce, DefaultUniqueTrap);
AddExecutor(ExecutorType.Activate, CardId.StormingMirrorForce, DefaultUniqueTrap);
AddExecutor(ExecutorType.Activate, CardId.MirrorForce, DefaultUniqueTrap);
AddExecutor(ExecutorType.Activate, CardId.DarkMirrorForce, DefaultUniqueTrap);
AddExecutor(ExecutorType.Activate, CardId.BottomlessTrapHole, DefaultUniqueTrap);
AddExecutor(ExecutorType.Activate, CardId.TraptrixTrapHoleNightmare, DefaultUniqueTrap);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
}
public override void OnNewTurn()
{
NormalSummoned = false;
}
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
{
if (!defender.IsMonsterHasPreventActivationEffectInBattle())
{
if (Bot.HasInMonstersZone(CardId.Number37HopeWovenDragonSpiderShark, true, true))
attacker.RealPower = attacker.RealPower + 1000;
}
return base.OnPreBattleBetween(attacker, defender);
}
public override IList<ClientCard> OnSelectXyzMaterial(IList<ClientCard> cards, int min, int max)
{
// select cards with same name (summoned by rescue rabbit)
Logger.DebugWriteLine("OnSelectXyzMaterial " + cards.Count + " " + min + " " + max);
IList<ClientCard> result = new List<ClientCard>();
foreach (ClientCard card1 in cards)
{
foreach (ClientCard card2 in cards)
{
if (card1.Id == card2.Id && !card1.Equals(card2))
{
result.Add(card1);
result.Add(card2);
break;
}
}
if (result.Count > 0)
break;
}
AI.Utils.CheckSelectCount(result, cards, min, max);
return result;
}
private bool UnexpectedDaiEffect()
{
if (Bot.HasInHand(CardId.RescueRabbit) || NormalSummoned)
AI.SelectCard(new[]
{
CardId.MysteryShellDragon,
CardId.PhantomGryphon,
CardId.MegalosmasherX
});
else if (AI.Utils.IsTurn1OrMain2())
{
if (Bot.HasInHand(CardId.MysteryShellDragon))
AI.SelectCard(CardId.MysteryShellDragon);
else if (Bot.HasInHand(CardId.MegalosmasherX))
AI.SelectCard(CardId.MegalosmasherX);
else if (Bot.HasInHand(CardId.AngelTrumpeter))
AI.SelectCard(CardId.AngelTrumpeter);
}
else
{
if (Bot.HasInHand(CardId.MegalosmasherX))
AI.SelectCard(CardId.MegalosmasherX);
else if (Bot.HasInHand(CardId.MasterPendulumTheDracoslayer))
AI.SelectCard(CardId.MasterPendulumTheDracoslayer);
else if (Bot.HasInHand(CardId.PhantomGryphon))
AI.SelectCard(CardId.PhantomGryphon);
else if (Bot.HasInHand(CardId.AngelTrumpeter))
AI.SelectCard(new[]
{
CardId.MetalfoesGoldriver,
CardId.MasterPendulumTheDracoslayer
});
}
return true;
}
private bool RescueRabbitEffect()
{
if (AI.Utils.IsTurn1OrMain2())
{
AI.SelectCard(new[]
{
CardId.MegalosmasherX,
CardId.MysteryShellDragon
});
}
else
{
AI.SelectCard(new[]
{
CardId.MasterPendulumTheDracoslayer,
CardId.PhantomGryphon,
CardId.MegalosmasherX,
CardId.MetalfoesGoldriver,
CardId.AngelTrumpeter
});
}
return true;
}
private bool MysteryShellDragonSummon()
{
return Bot.HasInMonstersZone(CardId.MysteryShellDragon);
}
private bool PhantomGryphonSummon()
{
return Bot.HasInMonstersZone(CardId.PhantomGryphon);
}
private bool MasterPendulumTheDracoslayerSummon()
{
return Bot.HasInMonstersZone(CardId.MasterPendulumTheDracoslayer);
}
private bool AngelTrumpeterSummon()
{
return Bot.HasInMonstersZone(CardId.AngelTrumpeter);
}
private bool MetalfoesGoldriverSummon()
{
return Bot.HasInMonstersZone(CardId.MetalfoesGoldriver);
}
private bool MegalosmasherXSummon()
{
return Bot.HasInMonstersZone(CardId.MegalosmasherX);
}
private bool NormalSummon()
{
return true;
}
private bool GagagaCowboySummon()
{
if (Duel.LifePoints[1] <= 800)
{
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
}
return false;
}
private bool IgnisterProminenceTheBlastingDracoslayerSummon()
{
return AI.Utils.GetProblematicEnemyCard() != null;
}
private bool IgnisterProminenceTheBlastingDracoslayerEffect()
{
if (ActivateDescription == AI.Utils.GetStringId(CardId.IgnisterProminenceTheBlastingDracoslayer, 1))
return true;
ClientCard target1 = null;
ClientCard target2 = AI.Utils.GetProblematicEnemyCard();
List<ClientCard> spells = Enemy.GetSpells();
foreach (ClientCard spell in spells)
{
if (spell.HasType(CardType.Pendulum) && !spell.Equals(target2))
{
target1 = spell;
break;
}
}
List<ClientCard> monsters = Enemy.GetMonsters();
foreach (ClientCard monster in monsters)
{
if (monster.HasType(CardType.Pendulum) && !monster.Equals(target2))
{
target1 = monster;
break;
}
}
if (target2 == null && target1 != null)
{
foreach (ClientCard spell in spells)
{
if (!spell.Equals(target1))
{
target2 = spell;
break;
}
}
foreach (ClientCard monster in monsters)
{
if (!monster.Equals(target1))
{
target2 = monster;
break;
}
}
}
if (target2 == null)
return false;
AI.SelectCard(target1);
AI.SelectNextCard(target2);
return true;
}
private bool Number37HopeWovenDragonSpiderSharkSummon()
{
return AI.Utils.IsAllEnemyBetterThanValue(1700, false) && !AI.Utils.IsOneEnemyBetterThanValue(3600, true);
}
private bool LightningChidoriSummon()
{
foreach (ClientCard monster in Enemy.GetMonsters())
{
if (monster.IsFacedown())
{
return true;
}
}
foreach (ClientCard spell in Enemy.GetSpells())
{
if (spell.IsFacedown())
{
return true;
}
}
return AI.Utils.GetProblematicEnemyCard() != null;
}
private bool LightningChidoriEffect()
{
ClientCard problematicCard = AI.Utils.GetProblematicEnemyCard();
AI.SelectNextCard(problematicCard);
return true;
}
private bool EvolzarLaggiaSummon()
{
return (AI.Utils.IsAllEnemyBetterThanValue(2000, false) && !AI.Utils.IsOneEnemyBetterThanValue(2400, true)) || AI.Utils.IsTurn1OrMain2();
}
private bool EvilswarmNightmareSummon()
{
if (AI.Utils.IsTurn1OrMain2())
{
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
}
return false;
}
private bool TraptrixRafflesiaSummon()
{
if (AI.Utils.IsTurn1OrMain2() && (Bot.GetRemainingCount(CardId.BottomlessTrapHole, 1) + Bot.GetRemainingCount(CardId.TraptrixTrapHoleNightmare, 1)) > 0)
{
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
}
return false;
}
private bool Number59CrookedCookSummon()
{
return ((Bot.GetMonsterCount() + Bot.GetSpellCount() - 2) <= 1) &&
((AI.Utils.IsOneEnemyBetter() && !AI.Utils.IsOneEnemyBetterThanValue(2300, true)) || AI.Utils.IsTurn1OrMain2());
}
private bool Number59CrookedCookEffect()
{
if (Duel.Player == 0)
{
if (AI.Utils.IsChainTarget(Card))
return true;
}
else
{
if ((Bot.GetMonsterCount() + Bot.GetSpellCount() -1) <= 1)
return true;
}
return false;
}
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
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()
{
NormalSummoned = true;
......
using YGOSharp.OCGWrapper.Enums;
using System.Collections.Generic;
using WindBot;
using WindBot.Game;
using WindBot.Game.AI;
namespace WindBot.Game.AI.Decks
{
[Deck("Toadally Awesome", "AI_ToadallyAwesome", "OutDated")]
public class ToadallyAwesomeExecutor : DefaultExecutor
{
public class CardId
{
public const int CryomancerOfTheIceBarrier = 23950192;
public const int DewdarkOfTheIceBarrier = 90311614;
public const int SwapFrog = 9126351;
public const int PriorOfTheIceBarrier = 50088247;
public const int Ronintoadin = 1357146;
public const int DupeFrog = 46239604;
public const int GraydleSlimeJr = 80250319;
public const int GalaxyCyclone = 5133471;
public const int HarpiesFeatherDuster = 18144506;
public const int Surface = 33057951;
public const int DarkHole = 53129443;
public const int CardDestruction = 72892473;
public const int FoolishBurial = 81439173;
public const int MonsterReborn = 83764718;
public const int MedallionOfTheIceBarrier = 84206435;
public const int Salvage = 96947648;
public const int AquariumStage = 29047353;
public const int HeraldOfTheArcLight = 79606837;
public const int ToadallyAwesome = 90809975;
public const int SkyCavalryCentaurea = 36776089;
public const int DaigustoPhoenix = 2766877;
public const int CatShark = 84224627;
public const int MysticalSpaceTyphoon = 5318639;
public const int BookOfMoon = 14087893;
public const int CallOfTheHaunted = 97077563;
public const int TorrentialTribute = 53582587;
}
public ToadallyAwesomeExecutor(GameAI ai, Duel duel)
: base(ai, duel)
{
AddExecutor(ExecutorType.Activate, CardId.HarpiesFeatherDuster, DefaultHarpiesFeatherDusterFirst);
AddExecutor(ExecutorType.Activate, CardId.GalaxyCyclone, DefaultGalaxyCyclone);
AddExecutor(ExecutorType.Activate, CardId.HarpiesFeatherDuster);
AddExecutor(ExecutorType.Activate, CardId.DarkHole, DefaultDarkHole);
AddExecutor(ExecutorType.Activate, CardId.AquariumStage, AquariumStageEffect);
AddExecutor(ExecutorType.Activate, CardId.MedallionOfTheIceBarrier, MedallionOfTheIceBarrierEffect);
AddExecutor(ExecutorType.Activate, CardId.FoolishBurial, FoolishBurialEffect);
AddExecutor(ExecutorType.SpSummon, CardId.PriorOfTheIceBarrier);
AddExecutor(ExecutorType.Summon, CardId.GraydleSlimeJr, GraydleSlimeJrSummon);
AddExecutor(ExecutorType.SpSummon, CardId.SwapFrog, SwapFrogSpsummon);
AddExecutor(ExecutorType.Activate, CardId.SwapFrog, SwapFrogEffect);
AddExecutor(ExecutorType.Activate, CardId.GraydleSlimeJr, GraydleSlimeJrEffect);
AddExecutor(ExecutorType.Activate, CardId.Ronintoadin, RonintoadinEffect);
AddExecutor(ExecutorType.Activate, CardId.PriorOfTheIceBarrier);
AddExecutor(ExecutorType.Activate, CardId.DupeFrog);
AddExecutor(ExecutorType.Activate, CardId.Surface, SurfaceEffect);
AddExecutor(ExecutorType.Activate, CardId.MonsterReborn, SurfaceEffect);
AddExecutor(ExecutorType.Activate, CardId.Salvage, SalvageEffect);
AddExecutor(ExecutorType.Summon, CardId.SwapFrog);
AddExecutor(ExecutorType.Summon, CardId.DewdarkOfTheIceBarrier, IceBarrierSummon);
AddExecutor(ExecutorType.Summon, CardId.CryomancerOfTheIceBarrier, IceBarrierSummon);
AddExecutor(ExecutorType.Activate, CardId.CardDestruction);
AddExecutor(ExecutorType.Summon, CardId.GraydleSlimeJr, NormalSummon);
AddExecutor(ExecutorType.Summon, CardId.PriorOfTheIceBarrier, NormalSummon);
AddExecutor(ExecutorType.Summon, CardId.Ronintoadin, NormalSummon);
AddExecutor(ExecutorType.Summon, CardId.DupeFrog, NormalSummon);
AddExecutor(ExecutorType.Summon, CardId.PriorOfTheIceBarrier, PriorOfTheIceBarrierSummon);
AddExecutor(ExecutorType.SpSummon, CardId.CatShark, CatSharkSummon);
AddExecutor(ExecutorType.Activate, CardId.CatShark, CatSharkEffect);
AddExecutor(ExecutorType.SpSummon, CardId.SkyCavalryCentaurea, SkyCavalryCentaureaSummon);
AddExecutor(ExecutorType.Activate, CardId.SkyCavalryCentaurea);
AddExecutor(ExecutorType.SpSummon, CardId.DaigustoPhoenix, DaigustoPhoenixSummon);
AddExecutor(ExecutorType.Activate, CardId.DaigustoPhoenix);
AddExecutor(ExecutorType.SpSummon, CardId.ToadallyAwesome);
AddExecutor(ExecutorType.Activate, CardId.ToadallyAwesome, ToadallyAwesomeEffect);
AddExecutor(ExecutorType.SpSummon, CardId.HeraldOfTheArcLight, HeraldOfTheArcLightSummon);
AddExecutor(ExecutorType.Activate, CardId.HeraldOfTheArcLight);
AddExecutor(ExecutorType.MonsterSet, CardId.GraydleSlimeJr);
AddExecutor(ExecutorType.MonsterSet, CardId.DupeFrog);
AddExecutor(ExecutorType.MonsterSet, CardId.Ronintoadin);
AddExecutor(ExecutorType.Repos, Repos);
// cards got by Toadall yAwesome
AddExecutor(ExecutorType.Activate, CardId.MysticalSpaceTyphoon, DefaultMysticalSpaceTyphoon);
AddExecutor(ExecutorType.Activate, CardId.BookOfMoon, DefaultBookOfMoon);
AddExecutor(ExecutorType.Activate, CardId.CallOfTheHaunted, SurfaceEffect);
AddExecutor(ExecutorType.Activate, CardId.TorrentialTribute, DefaultTorrentialTribute);
AddExecutor(ExecutorType.Activate, OtherSpellEffect);
AddExecutor(ExecutorType.Activate, OtherTrapEffect);
AddExecutor(ExecutorType.Activate, OtherMonsterEffect);
}
public override bool OnSelectHand()
{
return true;
}
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
{
if (!defender.IsMonsterHasPreventActivationEffectInBattle())
{
if (attacker.Id == CardId.SkyCavalryCentaurea && !attacker.IsDisabled() && attacker.HasXyzMaterial())
attacker.RealPower = Duel.LifePoints[0] + attacker.Attack;
}
return base.OnPreBattleBetween(attacker, defender);
}
private bool MedallionOfTheIceBarrierEffect()
{
if (Bot.HasInHand(new[]
{
CardId.CryomancerOfTheIceBarrier,
CardId.DewdarkOfTheIceBarrier
}) || Bot.HasInMonstersZone(new[]
{
CardId.CryomancerOfTheIceBarrier,
CardId.DewdarkOfTheIceBarrier
}))
{
AI.SelectCard(CardId.PriorOfTheIceBarrier);
}
else
{
AI.SelectCard(new[]
{
CardId.CryomancerOfTheIceBarrier,
CardId.DewdarkOfTheIceBarrier
});
}
return true;
}
private bool SurfaceEffect()
{
AI.SelectCard(new[]
{
CardId.ToadallyAwesome,
CardId.HeraldOfTheArcLight,
CardId.SwapFrog,
CardId.DewdarkOfTheIceBarrier,
CardId.CryomancerOfTheIceBarrier,
CardId.DupeFrog,
CardId.Ronintoadin,
CardId.GraydleSlimeJr
});
return true;
}
private bool AquariumStageEffect()
{
if (Card.Location == CardLocation.Grave)
{
AI.SelectPosition(CardPosition.FaceUpDefence);
return SurfaceEffect();
}
return true;
}
private bool FoolishBurialEffect()
{
if (Bot.HasInHand(CardId.GraydleSlimeJr) && !Bot.HasInGraveyard(CardId.GraydleSlimeJr))
AI.SelectCard(CardId.GraydleSlimeJr);
else if (Bot.HasInGraveyard(CardId.Ronintoadin) && !Bot.HasInGraveyard(CardId.DupeFrog))
AI.SelectCard(CardId.DupeFrog);
else if (Bot.HasInGraveyard(CardId.DupeFrog) && !Bot.HasInGraveyard(CardId.Ronintoadin))
AI.SelectCard(CardId.Ronintoadin);
else
AI.SelectCard(new[]
{
CardId.GraydleSlimeJr,
CardId.Ronintoadin,
CardId.DupeFrog,
CardId.CryomancerOfTheIceBarrier,
CardId.DewdarkOfTheIceBarrier,
CardId.PriorOfTheIceBarrier,
CardId.SwapFrog
});
return true;
}
private bool SalvageEffect()
{
AI.SelectCard(new[]
{
CardId.SwapFrog,
CardId.PriorOfTheIceBarrier,
CardId.GraydleSlimeJr
});
return true;
}
private bool SwapFrogSpsummon()
{
if (Bot.GetCountCardInZone(Bot.Hand, CardId.GraydleSlimeJr)>=2 && !Bot.HasInGraveyard(CardId.GraydleSlimeJr))
AI.SelectCard(CardId.GraydleSlimeJr);
else if (Bot.HasInGraveyard(CardId.Ronintoadin) && !Bot.HasInGraveyard(CardId.DupeFrog))
AI.SelectCard(CardId.DupeFrog);
else if (Bot.HasInGraveyard(CardId.DupeFrog) && !Bot.HasInGraveyard(CardId.Ronintoadin))
AI.SelectCard(CardId.Ronintoadin);
else
AI.SelectCard(new[]
{
CardId.Ronintoadin,
CardId.DupeFrog,
CardId.CryomancerOfTheIceBarrier,
CardId.DewdarkOfTheIceBarrier,
CardId.PriorOfTheIceBarrier,
CardId.GraydleSlimeJr,
CardId.SwapFrog
});
return true;
}
private bool SwapFrogEffect()
{
if (ActivateDescription == -1)
{
return FoolishBurialEffect();
}
else
{
if (Bot.HasInHand(CardId.DupeFrog))
{
AI.SelectCard(new[]
{
CardId.PriorOfTheIceBarrier,
CardId.GraydleSlimeJr,
CardId.SwapFrog
});
return true;
}
}
return false;
}
private bool GraydleSlimeJrSummon()
{
return Bot.HasInGraveyard(CardId.GraydleSlimeJr);
}
private bool GraydleSlimeJrEffect()
{
AI.SelectCard(CardId.GraydleSlimeJr);
AI.SelectPosition(CardPosition.FaceUpDefence);
AI.SelectNextCard(new[]
{
CardId.SwapFrog,
CardId.CryomancerOfTheIceBarrier,
CardId.DewdarkOfTheIceBarrier,
CardId.Ronintoadin,
CardId.DupeFrog,
CardId.PriorOfTheIceBarrier,
CardId.GraydleSlimeJr
});
return true;
}
private bool RonintoadinEffect()
{
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
}
private bool NormalSummon()
{
foreach (ClientCard monster in Bot.GetMonsters())
{
if (monster.Level==2)
{
return true;
}
}
return false;
}
private bool IceBarrierSummon()
{
return Bot.GetCountCardInZone(Bot.Hand, CardId.PriorOfTheIceBarrier) > 0;
}
private bool PriorOfTheIceBarrierSummon()
{
return Bot.GetCountCardInZone(Bot.Hand, CardId.PriorOfTheIceBarrier) >= 2;
}
private bool ToadallyAwesomeEffect()
{
if (CurrentChain.Count > 0)
{
// negate effect, select a cost for it
List<ClientCard> monsters = Bot.GetMonsters();
IList<int> suitableCost = new[] {
CardId.SwapFrog,
CardId.Ronintoadin,
CardId.GraydleSlimeJr,
CardId.CryomancerOfTheIceBarrier,
CardId.DewdarkOfTheIceBarrier
};
foreach (ClientCard monster in monsters)
{
if (suitableCost.Contains(monster.Id))
{
AI.SelectCard(monster);
return true;
}
}
if (!Bot.HasInSpellZone(CardId.AquariumStage, true))
{
foreach (ClientCard monster in monsters)
{
if (monster.Id == CardId.DupeFrog)
{
AI.SelectCard(monster);
return true;
}
}
}
List<ClientCard> hands = Bot.Hand.GetMonsters();
if (Bot.GetCountCardInZone(Bot.Hand, CardId.GraydleSlimeJr) >= 2)
{
foreach (ClientCard monster in hands)
{
if (monster.Id == CardId.GraydleSlimeJr)
{
AI.SelectCard(monster);
return true;
}
}
}
if (Bot.HasInGraveyard(CardId.Ronintoadin) && !Bot.HasInGraveyard(CardId.DupeFrog) && !Bot.HasInGraveyard(CardId.SwapFrog))
{
foreach (ClientCard monster in hands)
{
if (monster.Id == CardId.DupeFrog)
{
AI.SelectCard(monster);
return true;
}
}
}
foreach (ClientCard monster in hands)
{
if (monster.Id == CardId.Ronintoadin || monster.Id == CardId.DupeFrog)
{
AI.SelectCard(monster);
return true;
}
}
foreach (ClientCard monster in hands)
{
AI.SelectCard(monster);
return true;
}
return true;
}
else if (Card.Location == CardLocation.Grave)
{
if (!Bot.HasInExtra(CardId.ToadallyAwesome))
{
AI.SelectCard(CardId.ToadallyAwesome);
}
else
{
AI.SelectCard(new[]
{
CardId.SwapFrog,
CardId.PriorOfTheIceBarrier,
CardId.GraydleSlimeJr
});
}
return true;
}
else if (Duel.Phase == DuelPhase.Standby)
{
SelectXYZDetach(Card.Overlays);
if (Duel.Player == 0)
{
AI.SelectNextCard(new[]
{
CardId.SwapFrog,
CardId.CryomancerOfTheIceBarrier,
CardId.DewdarkOfTheIceBarrier,
CardId.Ronintoadin,
CardId.DupeFrog,
CardId.GraydleSlimeJr
});
}
else
{
AI.SelectNextCard(new[]
{
CardId.DupeFrog,
CardId.SwapFrog,
CardId.Ronintoadin,
CardId.GraydleSlimeJr,
CardId.CryomancerOfTheIceBarrier,
CardId.DewdarkOfTheIceBarrier
});
AI.SelectPosition(CardPosition.FaceUpDefence);
}
return true;
}
return true;
}
private bool CatSharkSummon()
{
if (Bot.HasInMonstersZone(CardId.ToadallyAwesome)
&& ((AI.Utils.IsOneEnemyBetter(true)
&& !Bot.HasInMonstersZone(new[]
{
CardId.CatShark,
CardId.SkyCavalryCentaurea
}, true, true))
|| !Bot.HasInExtra(CardId.ToadallyAwesome)))
{
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
}
return false;
}
private bool CatSharkEffect()
{
List<ClientCard> monsters = Bot.GetMonsters();
foreach (ClientCard monster in monsters)
{
if (monster.Id == CardId.ToadallyAwesome && monster.Attack <= 2200)
{
SelectXYZDetach(Card.Overlays);
AI.SelectNextCard(monster);
return true;
}
}
foreach (ClientCard monster in monsters)
{
if (monster.Id == CardId.SkyCavalryCentaurea && monster.Attack <= 2000)
{
SelectXYZDetach(Card.Overlays);
AI.SelectNextCard(monster);
return true;
}
}
foreach (ClientCard monster in monsters)
{
if (monster.Id == CardId.DaigustoPhoenix && monster.Attack <= 1500)
{
SelectXYZDetach(Card.Overlays);
AI.SelectNextCard(monster);
return true;
}
}
return false;
}
private bool SkyCavalryCentaureaSummon()
{
int num = 0;
foreach (ClientCard monster in Bot.GetMonsters())
{
if (monster.Level ==2)
{
num++;
}
}
return AI.Utils.IsOneEnemyBetter(true)
&& AI.Utils.GetBestAttack(Enemy) > 2200
&& num < 4
&& !Bot.HasInMonstersZone(new[]
{
CardId.SkyCavalryCentaurea
}, true, true);
}
private bool DaigustoPhoenixSummon()
{
if (Duel.Turn != 1)
{
int attack = 0;
int defence = 0;
foreach (ClientCard monster in Bot.GetMonsters())
{
if (!monster.IsDefense())
{
attack += monster.Attack;
}
}
foreach (ClientCard monster in Enemy.GetMonsters())
{
defence += monster.GetDefensePower();
}
if (attack - 2000 - defence > Duel.LifePoints[1] && !AI.Utils.IsOneEnemyBetter(true))
return true;
}
return false;
}
private bool HeraldOfTheArcLightSummon()
{
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
}
private bool Repos()
{
if (Card.IsFacedown())
return true;
if (Card.IsDefense() && !AI.Utils.IsAllEnemyBetter(true) && Card.Attack >= Card.Defense)
return true;
return false;
}
private bool OtherSpellEffect()
{
foreach (CardExecutor exec in Executors)
{
if (exec.Type == Type && exec.CardId == Card.Id)
return false;
}
return Card.IsSpell();
}
private bool OtherTrapEffect()
{
foreach (CardExecutor exec in Executors)
{
if (exec.Type == Type && exec.CardId == Card.Id)
return false;
}
return Card.IsTrap() && DefaultTrap();
}
private bool OtherMonsterEffect()
{
foreach (CardExecutor exec in Executors)
{
if (exec.Type == Type && exec.CardId == Card.Id)
return false;
}
return Card.IsMonster();
}
private void SelectXYZDetach(List<int> Overlays)
{
if (Overlays.Contains(CardId.GraydleSlimeJr) && Bot.HasInHand(CardId.GraydleSlimeJr) && !Bot.HasInGraveyard(CardId.GraydleSlimeJr))
AI.SelectCard(CardId.GraydleSlimeJr);
else if (Overlays.Contains(CardId.DupeFrog) && Bot.HasInGraveyard(CardId.Ronintoadin) && !Bot.HasInGraveyard(CardId.DupeFrog))
AI.SelectCard(CardId.DupeFrog);
else if (Overlays.Contains(CardId.Ronintoadin) && Bot.HasInGraveyard(CardId.DupeFrog) && !Bot.HasInGraveyard(CardId.Ronintoadin))
AI.SelectCard(CardId.Ronintoadin);
else
AI.SelectCard(new[]
{
CardId.GraydleSlimeJr,
CardId.Ronintoadin,
CardId.DupeFrog,
CardId.CryomancerOfTheIceBarrier,
CardId.DewdarkOfTheIceBarrier,
CardId.PriorOfTheIceBarrier,
CardId.SwapFrog
});
}
}
}
using YGOSharp.OCGWrapper.Enums;
using System.Collections.Generic;
using WindBot;
using WindBot.Game;
using WindBot.Game.AI;
namespace WindBot.Game.AI.Decks
{
[Deck("Toadally Awesome", "AI_ToadallyAwesome", "OutDated")]
public class ToadallyAwesomeExecutor : DefaultExecutor
{
public class CardId
{
public const int CryomancerOfTheIceBarrier = 23950192;
public const int DewdarkOfTheIceBarrier = 90311614;
public const int SwapFrog = 9126351;
public const int PriorOfTheIceBarrier = 50088247;
public const int Ronintoadin = 1357146;
public const int DupeFrog = 46239604;
public const int GraydleSlimeJr = 80250319;
public const int GalaxyCyclone = 5133471;
public const int HarpiesFeatherDuster = 18144506;
public const int Surface = 33057951;
public const int DarkHole = 53129443;
public const int CardDestruction = 72892473;
public const int FoolishBurial = 81439173;
public const int MonsterReborn = 83764718;
public const int MedallionOfTheIceBarrier = 84206435;
public const int Salvage = 96947648;
public const int AquariumStage = 29047353;
public const int HeraldOfTheArcLight = 79606837;
public const int ToadallyAwesome = 90809975;
public const int SkyCavalryCentaurea = 36776089;
public const int DaigustoPhoenix = 2766877;
public const int CatShark = 84224627;
public const int MysticalSpaceTyphoon = 5318639;
public const int BookOfMoon = 14087893;
public const int CallOfTheHaunted = 97077563;
public const int TorrentialTribute = 53582587;
}
public ToadallyAwesomeExecutor(GameAI ai, Duel duel)
: base(ai, duel)
{
AddExecutor(ExecutorType.Activate, CardId.HarpiesFeatherDuster, DefaultHarpiesFeatherDusterFirst);
AddExecutor(ExecutorType.Activate, CardId.GalaxyCyclone, DefaultGalaxyCyclone);
AddExecutor(ExecutorType.Activate, CardId.HarpiesFeatherDuster);
AddExecutor(ExecutorType.Activate, CardId.DarkHole, DefaultDarkHole);
AddExecutor(ExecutorType.Activate, CardId.AquariumStage, AquariumStageEffect);
AddExecutor(ExecutorType.Activate, CardId.MedallionOfTheIceBarrier, MedallionOfTheIceBarrierEffect);
AddExecutor(ExecutorType.Activate, CardId.FoolishBurial, FoolishBurialEffect);
AddExecutor(ExecutorType.SpSummon, CardId.PriorOfTheIceBarrier);
AddExecutor(ExecutorType.Summon, CardId.GraydleSlimeJr, GraydleSlimeJrSummon);
AddExecutor(ExecutorType.SpSummon, CardId.SwapFrog, SwapFrogSpsummon);
AddExecutor(ExecutorType.Activate, CardId.SwapFrog, SwapFrogEffect);
AddExecutor(ExecutorType.Activate, CardId.GraydleSlimeJr, GraydleSlimeJrEffect);
AddExecutor(ExecutorType.Activate, CardId.Ronintoadin, RonintoadinEffect);
AddExecutor(ExecutorType.Activate, CardId.PriorOfTheIceBarrier);
AddExecutor(ExecutorType.Activate, CardId.DupeFrog);
AddExecutor(ExecutorType.Activate, CardId.Surface, SurfaceEffect);
AddExecutor(ExecutorType.Activate, CardId.MonsterReborn, SurfaceEffect);
AddExecutor(ExecutorType.Activate, CardId.Salvage, SalvageEffect);
AddExecutor(ExecutorType.Summon, CardId.SwapFrog);
AddExecutor(ExecutorType.Summon, CardId.DewdarkOfTheIceBarrier, IceBarrierSummon);
AddExecutor(ExecutorType.Summon, CardId.CryomancerOfTheIceBarrier, IceBarrierSummon);
AddExecutor(ExecutorType.Activate, CardId.CardDestruction);
AddExecutor(ExecutorType.Summon, CardId.GraydleSlimeJr, NormalSummon);
AddExecutor(ExecutorType.Summon, CardId.PriorOfTheIceBarrier, NormalSummon);
AddExecutor(ExecutorType.Summon, CardId.Ronintoadin, NormalSummon);
AddExecutor(ExecutorType.Summon, CardId.DupeFrog, NormalSummon);
AddExecutor(ExecutorType.Summon, CardId.PriorOfTheIceBarrier, PriorOfTheIceBarrierSummon);
AddExecutor(ExecutorType.SpSummon, CardId.CatShark, CatSharkSummon);
AddExecutor(ExecutorType.Activate, CardId.CatShark, CatSharkEffect);
AddExecutor(ExecutorType.SpSummon, CardId.SkyCavalryCentaurea, SkyCavalryCentaureaSummon);
AddExecutor(ExecutorType.Activate, CardId.SkyCavalryCentaurea);
AddExecutor(ExecutorType.SpSummon, CardId.DaigustoPhoenix, DaigustoPhoenixSummon);
AddExecutor(ExecutorType.Activate, CardId.DaigustoPhoenix);
AddExecutor(ExecutorType.SpSummon, CardId.ToadallyAwesome);
AddExecutor(ExecutorType.Activate, CardId.ToadallyAwesome, ToadallyAwesomeEffect);
AddExecutor(ExecutorType.SpSummon, CardId.HeraldOfTheArcLight, HeraldOfTheArcLightSummon);
AddExecutor(ExecutorType.Activate, CardId.HeraldOfTheArcLight);
AddExecutor(ExecutorType.MonsterSet, CardId.GraydleSlimeJr);
AddExecutor(ExecutorType.MonsterSet, CardId.DupeFrog);
AddExecutor(ExecutorType.MonsterSet, CardId.Ronintoadin);
AddExecutor(ExecutorType.Repos, Repos);
// cards got by Toadally Awesome
AddExecutor(ExecutorType.Activate, CardId.MysticalSpaceTyphoon, DefaultMysticalSpaceTyphoon);
AddExecutor(ExecutorType.Activate, CardId.BookOfMoon, DefaultBookOfMoon);
AddExecutor(ExecutorType.Activate, CardId.CallOfTheHaunted, SurfaceEffect);
AddExecutor(ExecutorType.Activate, CardId.TorrentialTribute, DefaultTorrentialTribute);
AddExecutor(ExecutorType.Activate, OtherSpellEffect);
AddExecutor(ExecutorType.Activate, OtherTrapEffect);
AddExecutor(ExecutorType.Activate, OtherMonsterEffect);
}
public override bool OnSelectHand()
{
return true;
}
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
{
if (!defender.IsMonsterHasPreventActivationEffectInBattle())
{
if (attacker.Id == CardId.SkyCavalryCentaurea && !attacker.IsDisabled() && attacker.HasXyzMaterial())
attacker.RealPower = Duel.LifePoints[0] + attacker.Attack;
}
return base.OnPreBattleBetween(attacker, defender);
}
private bool MedallionOfTheIceBarrierEffect()
{
if (Bot.HasInHand(new[]
{
CardId.CryomancerOfTheIceBarrier,
CardId.DewdarkOfTheIceBarrier
}) || Bot.HasInMonstersZone(new[]
{
CardId.CryomancerOfTheIceBarrier,
CardId.DewdarkOfTheIceBarrier
}))
{
AI.SelectCard(CardId.PriorOfTheIceBarrier);
}
else
{
AI.SelectCard(new[]
{
CardId.CryomancerOfTheIceBarrier,
CardId.DewdarkOfTheIceBarrier
});
}
return true;
}
private bool SurfaceEffect()
{
AI.SelectCard(new[]
{
CardId.ToadallyAwesome,
CardId.HeraldOfTheArcLight,
CardId.SwapFrog,
CardId.DewdarkOfTheIceBarrier,
CardId.CryomancerOfTheIceBarrier,
CardId.DupeFrog,
CardId.Ronintoadin,
CardId.GraydleSlimeJr
});
return true;
}
private bool AquariumStageEffect()
{
if (Card.Location == CardLocation.Grave)
{
AI.SelectPosition(CardPosition.FaceUpDefence);
return SurfaceEffect();
}
return true;
}
private bool FoolishBurialEffect()
{
if (Bot.HasInHand(CardId.GraydleSlimeJr) && !Bot.HasInGraveyard(CardId.GraydleSlimeJr))
AI.SelectCard(CardId.GraydleSlimeJr);
else if (Bot.HasInGraveyard(CardId.Ronintoadin) && !Bot.HasInGraveyard(CardId.DupeFrog))
AI.SelectCard(CardId.DupeFrog);
else if (Bot.HasInGraveyard(CardId.DupeFrog) && !Bot.HasInGraveyard(CardId.Ronintoadin))
AI.SelectCard(CardId.Ronintoadin);
else
AI.SelectCard(new[]
{
CardId.GraydleSlimeJr,
CardId.Ronintoadin,
CardId.DupeFrog,
CardId.CryomancerOfTheIceBarrier,
CardId.DewdarkOfTheIceBarrier,
CardId.PriorOfTheIceBarrier,
CardId.SwapFrog
});
return true;
}
private bool SalvageEffect()
{
AI.SelectCard(new[]
{
CardId.SwapFrog,
CardId.PriorOfTheIceBarrier,
CardId.GraydleSlimeJr
});
return true;
}
private bool SwapFrogSpsummon()
{
if (Bot.GetCountCardInZone(Bot.Hand, CardId.GraydleSlimeJr)>=2 && !Bot.HasInGraveyard(CardId.GraydleSlimeJr))
AI.SelectCard(CardId.GraydleSlimeJr);
else if (Bot.HasInGraveyard(CardId.Ronintoadin) && !Bot.HasInGraveyard(CardId.DupeFrog))
AI.SelectCard(CardId.DupeFrog);
else if (Bot.HasInGraveyard(CardId.DupeFrog) && !Bot.HasInGraveyard(CardId.Ronintoadin))
AI.SelectCard(CardId.Ronintoadin);
else
AI.SelectCard(new[]
{
CardId.Ronintoadin,
CardId.DupeFrog,
CardId.CryomancerOfTheIceBarrier,
CardId.DewdarkOfTheIceBarrier,
CardId.PriorOfTheIceBarrier,
CardId.GraydleSlimeJr,
CardId.SwapFrog
});
return true;
}
private bool SwapFrogEffect()
{
if (ActivateDescription == -1)
{
return FoolishBurialEffect();
}
else
{
if (Bot.HasInHand(CardId.DupeFrog))
{
AI.SelectCard(new[]
{
CardId.PriorOfTheIceBarrier,
CardId.GraydleSlimeJr,
CardId.SwapFrog
});
return true;
}
}
return false;
}
private bool GraydleSlimeJrSummon()
{
return Bot.HasInGraveyard(CardId.GraydleSlimeJr);
}
private bool GraydleSlimeJrEffect()
{
AI.SelectCard(CardId.GraydleSlimeJr);
AI.SelectPosition(CardPosition.FaceUpDefence);
AI.SelectNextCard(new[]
{
CardId.SwapFrog,
CardId.CryomancerOfTheIceBarrier,
CardId.DewdarkOfTheIceBarrier,
CardId.Ronintoadin,
CardId.DupeFrog,
CardId.PriorOfTheIceBarrier,
CardId.GraydleSlimeJr
});
return true;
}
private bool RonintoadinEffect()
{
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
}
private bool NormalSummon()
{
foreach (ClientCard monster in Bot.GetMonsters())
{
if (monster.Level==2)
{
return true;
}
}
return false;
}
private bool IceBarrierSummon()
{
return Bot.GetCountCardInZone(Bot.Hand, CardId.PriorOfTheIceBarrier) > 0;
}
private bool PriorOfTheIceBarrierSummon()
{
return Bot.GetCountCardInZone(Bot.Hand, CardId.PriorOfTheIceBarrier) >= 2;
}
private bool ToadallyAwesomeEffect()
{
if (CurrentChain.Count > 0)
{
// negate effect, select a cost for it
List<ClientCard> monsters = Bot.GetMonsters();
IList<int> suitableCost = new[] {
CardId.SwapFrog,
CardId.Ronintoadin,
CardId.GraydleSlimeJr,
CardId.CryomancerOfTheIceBarrier,
CardId.DewdarkOfTheIceBarrier
};
foreach (ClientCard monster in monsters)
{
if (suitableCost.Contains(monster.Id))
{
AI.SelectCard(monster);
return true;
}
}
if (!Bot.HasInSpellZone(CardId.AquariumStage, true))
{
foreach (ClientCard monster in monsters)
{
if (monster.Id == CardId.DupeFrog)
{
AI.SelectCard(monster);
return true;
}
}
}
List<ClientCard> hands = Bot.Hand.GetMonsters();
if (Bot.GetCountCardInZone(Bot.Hand, CardId.GraydleSlimeJr) >= 2)
{
foreach (ClientCard monster in hands)
{
if (monster.Id == CardId.GraydleSlimeJr)
{
AI.SelectCard(monster);
return true;
}
}
}
if (Bot.HasInGraveyard(CardId.Ronintoadin) && !Bot.HasInGraveyard(CardId.DupeFrog) && !Bot.HasInGraveyard(CardId.SwapFrog))
{
foreach (ClientCard monster in hands)
{
if (monster.Id == CardId.DupeFrog)
{
AI.SelectCard(monster);
return true;
}
}
}
foreach (ClientCard monster in hands)
{
if (monster.Id == CardId.Ronintoadin || monster.Id == CardId.DupeFrog)
{
AI.SelectCard(monster);
return true;
}
}
foreach (ClientCard monster in hands)
{
AI.SelectCard(monster);
return true;
}
return true;
}
else if (Card.Location == CardLocation.Grave)
{
if (!Bot.HasInExtra(CardId.ToadallyAwesome))
{
AI.SelectCard(CardId.ToadallyAwesome);
}
else
{
AI.SelectCard(new[]
{
CardId.SwapFrog,
CardId.PriorOfTheIceBarrier,
CardId.GraydleSlimeJr
});
}
return true;
}
else if (Duel.Phase == DuelPhase.Standby)
{
SelectXYZDetach(Card.Overlays);
if (Duel.Player == 0)
{
AI.SelectNextCard(new[]
{
CardId.SwapFrog,
CardId.CryomancerOfTheIceBarrier,
CardId.DewdarkOfTheIceBarrier,
CardId.Ronintoadin,
CardId.DupeFrog,
CardId.GraydleSlimeJr
});
}
else
{
AI.SelectNextCard(new[]
{
CardId.DupeFrog,
CardId.SwapFrog,
CardId.Ronintoadin,
CardId.GraydleSlimeJr,
CardId.CryomancerOfTheIceBarrier,
CardId.DewdarkOfTheIceBarrier
});
AI.SelectPosition(CardPosition.FaceUpDefence);
}
return true;
}
return true;
}
private bool CatSharkSummon()
{
if (Bot.HasInMonstersZone(CardId.ToadallyAwesome)
&& ((AI.Utils.IsOneEnemyBetter(true)
&& !Bot.HasInMonstersZone(new[]
{
CardId.CatShark,
CardId.SkyCavalryCentaurea
}, true, true))
|| !Bot.HasInExtra(CardId.ToadallyAwesome)))
{
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
}
return false;
}
private bool CatSharkEffect()
{
List<ClientCard> monsters = Bot.GetMonsters();
foreach (ClientCard monster in monsters)
{
if (monster.Id == CardId.ToadallyAwesome && monster.Attack <= 2200)
{
SelectXYZDetach(Card.Overlays);
AI.SelectNextCard(monster);
return true;
}
}
foreach (ClientCard monster in monsters)
{
if (monster.Id == CardId.SkyCavalryCentaurea && monster.Attack <= 2000)
{
SelectXYZDetach(Card.Overlays);
AI.SelectNextCard(monster);
return true;
}
}
foreach (ClientCard monster in monsters)
{
if (monster.Id == CardId.DaigustoPhoenix && monster.Attack <= 1500)
{
SelectXYZDetach(Card.Overlays);
AI.SelectNextCard(monster);
return true;
}
}
return false;
}
private bool SkyCavalryCentaureaSummon()
{
int num = 0;
foreach (ClientCard monster in Bot.GetMonsters())
{
if (monster.Level ==2)
{
num++;
}
}
return AI.Utils.IsOneEnemyBetter(true)
&& AI.Utils.GetBestAttack(Enemy) > 2200
&& num < 4
&& !Bot.HasInMonstersZone(new[]
{
CardId.SkyCavalryCentaurea
}, true, true);
}
private bool DaigustoPhoenixSummon()
{
if (Duel.Turn != 1)
{
int attack = 0;
int defence = 0;
foreach (ClientCard monster in Bot.GetMonsters())
{
if (!monster.IsDefense())
{
attack += monster.Attack;
}
}
foreach (ClientCard monster in Enemy.GetMonsters())
{
defence += monster.GetDefensePower();
}
if (attack - 2000 - defence > Duel.LifePoints[1] && !AI.Utils.IsOneEnemyBetter(true))
return true;
}
return false;
}
private bool HeraldOfTheArcLightSummon()
{
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
}
private bool Repos()
{
if (Card.IsFacedown())
return true;
if (Card.IsDefense() && !AI.Utils.IsAllEnemyBetter(true) && Card.Attack >= Card.Defense)
return true;
return false;
}
private bool OtherSpellEffect()
{
foreach (CardExecutor exec in Executors)
{
if (exec.Type == Type && exec.CardId == Card.Id)
return false;
}
return Card.IsSpell();
}
private bool OtherTrapEffect()
{
foreach (CardExecutor exec in Executors)
{
if (exec.Type == Type && exec.CardId == Card.Id)
return false;
}
return Card.IsTrap() && DefaultTrap();
}
private bool OtherMonsterEffect()
{
foreach (CardExecutor exec in Executors)
{
if (exec.Type == Type && exec.CardId == Card.Id)
return false;
}
return Card.IsMonster();
}
private void SelectXYZDetach(List<int> Overlays)
{
if (Overlays.Contains(CardId.GraydleSlimeJr) && Bot.HasInHand(CardId.GraydleSlimeJr) && !Bot.HasInGraveyard(CardId.GraydleSlimeJr))
AI.SelectCard(CardId.GraydleSlimeJr);
else if (Overlays.Contains(CardId.DupeFrog) && Bot.HasInGraveyard(CardId.Ronintoadin) && !Bot.HasInGraveyard(CardId.DupeFrog))
AI.SelectCard(CardId.DupeFrog);
else if (Overlays.Contains(CardId.Ronintoadin) && Bot.HasInGraveyard(CardId.DupeFrog) && !Bot.HasInGraveyard(CardId.Ronintoadin))
AI.SelectCard(CardId.Ronintoadin);
else
AI.SelectCard(new[]
{
CardId.GraydleSlimeJr,
CardId.Ronintoadin,
CardId.DupeFrog,
CardId.CryomancerOfTheIceBarrier,
CardId.DewdarkOfTheIceBarrier,
CardId.PriorOfTheIceBarrier,
CardId.SwapFrog
});
}
}
}
using YGOSharp.OCGWrapper.Enums;
using System.Collections.Generic;
using WindBot;
using WindBot.Game;
using WindBot.Game.AI;
namespace WindBot.Game.AI.Decks
{
[Deck("Yosenju", "AI_Yosenju")]
public class YosenjuExecutor : DefaultExecutor
{
public class CardId
{
public const int YosenjuKama1 = 65247798;
public const int YosenjuKama2 = 92246806;
public const int YosenjuKama3 = 28630501;
public const int YosenjuTsujik = 25244515;
public const int HarpiesFeatherDuster = 18144507;
public const int DarkHole = 53129443;
public const int CardOfDemise = 59750328;
public const int PotOfDuality = 98645731;
public const int CosmicCyclone = 8267140;
public const int QuakingMirrorForce = 40838625;
public const int DrowningMirrorForce = 47475363;
public const int StarlightRoad = 58120309;
public const int VanitysEmptiness = 5851097;
public const int MacroCosmos = 30241314;
public const int SolemnStrike = 40605147;
public const int SolemnWarning = 84749824;
public const int SolemnJudgment = 41420027;
public const int MagicDrain = 59344077;
public const int StardustDragon = 44508094;
public const int NumberS39UtopiatheLightning = 56832966;
public const int NumberS39UtopiaOne = 86532744;
public const int DarkRebellionXyzDragon = 16195942;
public const int Number39Utopia = 84013237;
public const int Number103Ragnazero = 94380860;
public const int BrotherhoodOfTheFireFistTigerKing = 96381979;
public const int Number106GiantHand = 63746411;
public const int CastelTheSkyblasterMusketeer = 82633039;
public const int DiamondDireWolf = 95169481;
public const int LightningChidori = 22653490;
public const int EvilswarmExcitonKnight = 46772449;
public const int AbyssDweller = 21044178;
public const int GagagaCowboy = 12014404;
}
bool CardOfDemiseUsed = false;
public YosenjuExecutor(GameAI ai, Duel duel)
: base(ai, duel)
{
// do the end phase effect of Card Of Demise before Yosenjus return to hand
AddExecutor(ExecutorType.Activate, CardId.CardOfDemise, CardOfDemiseEPEffect);
// burn if enemy's LP is below 800
AddExecutor(ExecutorType.SpSummon, CardId.GagagaCowboy, GagagaCowboySummon);
AddExecutor(ExecutorType.Activate, CardId.GagagaCowboy);
AddExecutor(ExecutorType.Activate, CardId.HarpiesFeatherDuster, DefaultHarpiesFeatherDusterFirst);
AddExecutor(ExecutorType.Activate, CardId.CosmicCyclone, DefaultCosmicCyclone);
AddExecutor(ExecutorType.Activate, CardId.HarpiesFeatherDuster);
AddExecutor(ExecutorType.Activate, CardId.DarkHole, DefaultDarkHole);
AddExecutor(ExecutorType.Activate, CardId.PotOfDuality, PotOfDualityEffect);
AddExecutor(ExecutorType.Summon, CardId.YosenjuKama1, HaveAnotherYosenjuWithSameNameInHand);
AddExecutor(ExecutorType.Summon, CardId.YosenjuKama2, HaveAnotherYosenjuWithSameNameInHand);
AddExecutor(ExecutorType.Summon, CardId.YosenjuKama3, HaveAnotherYosenjuWithSameNameInHand);
AddExecutor(ExecutorType.Summon, CardId.YosenjuKama1);
AddExecutor(ExecutorType.Summon, CardId.YosenjuKama2);
AddExecutor(ExecutorType.Summon, CardId.YosenjuKama3);
AddExecutor(ExecutorType.Summon, CardId.YosenjuTsujik);
AddExecutor(ExecutorType.Activate, CardId.YosenjuKama1, YosenjuEffect);
AddExecutor(ExecutorType.Activate, CardId.YosenjuKama2, YosenjuEffect);
AddExecutor(ExecutorType.Activate, CardId.YosenjuKama3, YosenjuEffect);
AddExecutor(ExecutorType.Activate, CardId.YosenjuTsujik, YosenjuEffect);
AddExecutor(ExecutorType.SpellSet, CardId.SolemnJudgment, TrapSetUnique);
AddExecutor(ExecutorType.SpellSet, CardId.SolemnStrike, TrapSetUnique);
AddExecutor(ExecutorType.SpellSet, CardId.SolemnWarning, TrapSetUnique);
AddExecutor(ExecutorType.SpellSet, CardId.MacroCosmos, TrapSetUnique);
AddExecutor(ExecutorType.SpellSet, CardId.VanitysEmptiness, TrapSetUnique);
AddExecutor(ExecutorType.SpellSet, CardId.MagicDrain, TrapSetUnique);
AddExecutor(ExecutorType.SpellSet, CardId.DrowningMirrorForce, TrapSetUnique);
AddExecutor(ExecutorType.SpellSet, CardId.QuakingMirrorForce, TrapSetUnique);
AddExecutor(ExecutorType.SpellSet, CardId.StarlightRoad, TrapSetUnique);
AddExecutor(ExecutorType.SpellSet, CardId.SolemnJudgment, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.SolemnStrike, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.SolemnWarning, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.MacroCosmos, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.VanitysEmptiness, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.MagicDrain, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.DrowningMirrorForce, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.QuakingMirrorForce, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.StarlightRoad, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.HarpiesFeatherDuster, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.DarkHole, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.PotOfDuality, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.CosmicCyclone, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.CardOfDemise);
AddExecutor(ExecutorType.Activate, CardId.CardOfDemise, CardOfDemiseEffect);
AddExecutor(ExecutorType.SpellSet, CardId.SolemnJudgment, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.SolemnStrike, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.SolemnWarning, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.MacroCosmos, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.VanitysEmptiness, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.MagicDrain, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.DrowningMirrorForce, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.QuakingMirrorForce, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.StarlightRoad, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.HarpiesFeatherDuster, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.DarkHole, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.PotOfDuality, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.CosmicCyclone, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpSummon, CardId.EvilswarmExcitonKnight, DefaultEvilswarmExcitonKnightSummon);
AddExecutor(ExecutorType.Activate, CardId.EvilswarmExcitonKnight, DefaultEvilswarmExcitonKnightEffect);
AddExecutor(ExecutorType.SpSummon, CardId.DarkRebellionXyzDragon, DarkRebellionXyzDragonSummon);
AddExecutor(ExecutorType.Activate, CardId.DarkRebellionXyzDragon, DarkRebellionXyzDragonEffect);
AddExecutor(ExecutorType.SpSummon, CardId.Number39Utopia, DefaultNumberS39UtopiaTheLightningSummon);
AddExecutor(ExecutorType.SpSummon, CardId.NumberS39UtopiaOne);
AddExecutor(ExecutorType.SpSummon, CardId.NumberS39UtopiatheLightning);
AddExecutor(ExecutorType.Activate, CardId.NumberS39UtopiatheLightning);
AddExecutor(ExecutorType.Activate, CardId.StardustDragon, DefaultStardustDragonEffect);
AddExecutor(ExecutorType.Activate, CardId.StarlightRoad, DefaultTrap);
AddExecutor(ExecutorType.Activate, CardId.MagicDrain);
AddExecutor(ExecutorType.Activate, CardId.SolemnWarning, DefaultSolemnWarning);
AddExecutor(ExecutorType.Activate, CardId.SolemnStrike, DefaultSolemnStrike);
AddExecutor(ExecutorType.Activate, CardId.SolemnJudgment, DefaultSolemnJudgment);
AddExecutor(ExecutorType.Activate, CardId.MacroCosmos, DefaultUniqueTrap);
AddExecutor(ExecutorType.Activate, CardId.VanitysEmptiness, DefaultUniqueTrap);
AddExecutor(ExecutorType.Activate, CardId.DrowningMirrorForce, DefaultUniqueTrap);
AddExecutor(ExecutorType.Activate, CardId.QuakingMirrorForce, DefaultUniqueTrap);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
}
public override bool OnSelectHand()
{
// go first
return true;
}
public override void OnNewTurn()
{
CardOfDemiseUsed = false;
}
public override bool OnSelectYesNo(int desc)
{
// Yosenju Kama 2 shouldn't attack directly at most times
if (Card == null)
return true;
// Logger.DebugWriteLine(Card.Name);
if (Card.Id == CardId.YosenjuKama2)
return Card.ShouldDirectAttack;
else
return true;
}
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
{
if (!defender.IsMonsterHasPreventActivationEffectInBattle())
{
if (attacker.Attribute == (int)CardAttribute.Wind && Bot.HasInHand(CardId.YosenjuTsujik))
attacker.RealPower = attacker.RealPower + 1000;
}
return base.OnPreBattleBetween(attacker, defender);
}
private bool PotOfDualityEffect()
{
if (CardOfDemiseUsed)
{
AI.SelectCard(new[]
{
CardId.StarlightRoad,
CardId.MagicDrain,
CardId.SolemnJudgment,
CardId.VanitysEmptiness,
CardId.HarpiesFeatherDuster,
CardId.DrowningMirrorForce,
CardId.QuakingMirrorForce,
CardId.SolemnStrike,
CardId.SolemnWarning,
CardId.MacroCosmos,
CardId.CardOfDemise
});
}
else
{
AI.SelectCard(new[]
{
CardId.YosenjuKama3,
CardId.YosenjuKama1,
CardId.YosenjuKama2,
CardId.StarlightRoad,
CardId.MagicDrain,
CardId.VanitysEmptiness,
CardId.HarpiesFeatherDuster,
CardId.DrowningMirrorForce,
CardId.QuakingMirrorForce,
CardId.SolemnStrike,
CardId.SolemnJudgment,
CardId.SolemnWarning,
CardId.MacroCosmos,
CardId.CardOfDemise,
});
}
return true;
}
private bool CardOfDemiseEffect()
{
if (AI.Utils.IsTurn1OrMain2())
{
CardOfDemiseUsed = true;
return true;
}
return false;
}
private bool HaveAnotherYosenjuWithSameNameInHand()
{
foreach (ClientCard card in Bot.Hand.GetMonsters())
{
if (!card.Equals(Card) && card.Id == Card.Id)
return true;
}
return false;
}
private bool TrapSetUnique()
{
foreach (ClientCard card in Bot.GetSpells())
{
if (card.Id == Card.Id)
return false;
}
return TrapSetWhenZoneFree();
}
private bool TrapSetWhenZoneFree()
{
return Bot.GetSpellCountWithoutField() < 4;
}
private bool CardOfDemiseAcivated()
{
return CardOfDemiseUsed;
}
private bool YosenjuEffect()
{
// Don't activate the return to hand effect first
if (Duel.Phase == DuelPhase.End)
return false;
AI.SelectCard(new[]
{
CardId.YosenjuKama1,
CardId.YosenjuKama2,
CardId.YosenjuKama3
});
return true;
}
private bool CardOfDemiseEPEffect()
{
// do the end phase effect of Card Of Demise before Yosenjus return to hand
return Duel.Phase == DuelPhase.End;
}
private bool GagagaCowboySummon()
{
if (Duel.LifePoints[1] <= 800 || (Bot.GetMonsterCount()>=4 && Duel.LifePoints[1] <= 1600))
{
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
}
return false;
}
private bool DarkRebellionXyzDragonSummon()
{
int selfBestAttack = AI.Utils.GetBestAttack(Bot);
int oppoBestAttack = AI.Utils.GetBestAttack(Enemy);
return selfBestAttack <= oppoBestAttack;
}
private bool DarkRebellionXyzDragonEffect()
{
int oppoBestAttack = AI.Utils.GetBestAttack(Enemy);
ClientCard target = AI.Utils.GetOneEnemyBetterThanValue(oppoBestAttack, true);
if (target != null)
{
AI.SelectNextCard(target);
}
return true;
}
}
using YGOSharp.OCGWrapper.Enums;
using System.Collections.Generic;
using WindBot;
using WindBot.Game;
using WindBot.Game.AI;
namespace WindBot.Game.AI.Decks
{
[Deck("Yosenju", "AI_Yosenju")]
public class YosenjuExecutor : DefaultExecutor
{
public class CardId
{
public const int YosenjuKama1 = 65247798;
public const int YosenjuKama2 = 92246806;
public const int YosenjuKama3 = 28630501;
public const int YosenjuTsujik = 25244515;
public const int HarpiesFeatherDuster = 18144507;
public const int DarkHole = 53129443;
public const int CardOfDemise = 59750328;
public const int PotOfDuality = 98645731;
public const int CosmicCyclone = 8267140;
public const int QuakingMirrorForce = 40838625;
public const int DrowningMirrorForce = 47475363;
public const int StarlightRoad = 58120309;
public const int VanitysEmptiness = 5851097;
public const int MacroCosmos = 30241314;
public const int SolemnStrike = 40605147;
public const int SolemnWarning = 84749824;
public const int SolemnJudgment = 41420027;
public const int MagicDrain = 59344077;
public const int StardustDragon = 44508094;
public const int NumberS39UtopiatheLightning = 56832966;
public const int NumberS39UtopiaOne = 86532744;
public const int DarkRebellionXyzDragon = 16195942;
public const int Number39Utopia = 84013237;
public const int Number103Ragnazero = 94380860;
public const int BrotherhoodOfTheFireFistTigerKing = 96381979;
public const int Number106GiantHand = 63746411;
public const int CastelTheSkyblasterMusketeer = 82633039;
public const int DiamondDireWolf = 95169481;
public const int LightningChidori = 22653490;
public const int EvilswarmExcitonKnight = 46772449;
public const int AbyssDweller = 21044178;
public const int GagagaCowboy = 12014404;
}
bool CardOfDemiseUsed = false;
public YosenjuExecutor(GameAI ai, Duel duel)
: base(ai, duel)
{
// do the end phase effect of Card Of Demise before Yosenjus return to hand
AddExecutor(ExecutorType.Activate, CardId.CardOfDemise, CardOfDemiseEPEffect);
// burn if enemy's LP is below 800
AddExecutor(ExecutorType.SpSummon, CardId.GagagaCowboy, GagagaCowboySummon);
AddExecutor(ExecutorType.Activate, CardId.GagagaCowboy);
AddExecutor(ExecutorType.Activate, CardId.HarpiesFeatherDuster, DefaultHarpiesFeatherDusterFirst);
AddExecutor(ExecutorType.Activate, CardId.CosmicCyclone, DefaultCosmicCyclone);
AddExecutor(ExecutorType.Activate, CardId.HarpiesFeatherDuster);
AddExecutor(ExecutorType.Activate, CardId.DarkHole, DefaultDarkHole);
AddExecutor(ExecutorType.Activate, CardId.PotOfDuality, PotOfDualityEffect);
AddExecutor(ExecutorType.Summon, CardId.YosenjuKama1, HaveAnotherYosenjuWithSameNameInHand);
AddExecutor(ExecutorType.Summon, CardId.YosenjuKama2, HaveAnotherYosenjuWithSameNameInHand);
AddExecutor(ExecutorType.Summon, CardId.YosenjuKama3, HaveAnotherYosenjuWithSameNameInHand);
AddExecutor(ExecutorType.Summon, CardId.YosenjuKama1);
AddExecutor(ExecutorType.Summon, CardId.YosenjuKama2);
AddExecutor(ExecutorType.Summon, CardId.YosenjuKama3);
AddExecutor(ExecutorType.Summon, CardId.YosenjuTsujik);
AddExecutor(ExecutorType.Activate, CardId.YosenjuKama1, YosenjuEffect);
AddExecutor(ExecutorType.Activate, CardId.YosenjuKama2, YosenjuEffect);
AddExecutor(ExecutorType.Activate, CardId.YosenjuKama3, YosenjuEffect);
AddExecutor(ExecutorType.Activate, CardId.YosenjuTsujik, YosenjuEffect);
AddExecutor(ExecutorType.SpellSet, CardId.SolemnJudgment, TrapSetUnique);
AddExecutor(ExecutorType.SpellSet, CardId.SolemnStrike, TrapSetUnique);
AddExecutor(ExecutorType.SpellSet, CardId.SolemnWarning, TrapSetUnique);
AddExecutor(ExecutorType.SpellSet, CardId.MacroCosmos, TrapSetUnique);
AddExecutor(ExecutorType.SpellSet, CardId.VanitysEmptiness, TrapSetUnique);
AddExecutor(ExecutorType.SpellSet, CardId.MagicDrain, TrapSetUnique);
AddExecutor(ExecutorType.SpellSet, CardId.DrowningMirrorForce, TrapSetUnique);
AddExecutor(ExecutorType.SpellSet, CardId.QuakingMirrorForce, TrapSetUnique);
AddExecutor(ExecutorType.SpellSet, CardId.StarlightRoad, TrapSetUnique);
AddExecutor(ExecutorType.SpellSet, CardId.SolemnJudgment, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.SolemnStrike, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.SolemnWarning, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.MacroCosmos, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.VanitysEmptiness, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.MagicDrain, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.DrowningMirrorForce, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.QuakingMirrorForce, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.StarlightRoad, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.HarpiesFeatherDuster, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.DarkHole, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.PotOfDuality, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.CosmicCyclone, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.CardOfDemise);
AddExecutor(ExecutorType.Activate, CardId.CardOfDemise, CardOfDemiseEffect);
AddExecutor(ExecutorType.SpellSet, CardId.SolemnJudgment, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.SolemnStrike, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.SolemnWarning, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.MacroCosmos, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.VanitysEmptiness, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.MagicDrain, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.DrowningMirrorForce, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.QuakingMirrorForce, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.StarlightRoad, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.HarpiesFeatherDuster, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.DarkHole, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.PotOfDuality, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpellSet, CardId.CosmicCyclone, CardOfDemiseAcivated);
AddExecutor(ExecutorType.SpSummon, CardId.EvilswarmExcitonKnight, DefaultEvilswarmExcitonKnightSummon);
AddExecutor(ExecutorType.Activate, CardId.EvilswarmExcitonKnight, DefaultEvilswarmExcitonKnightEffect);
AddExecutor(ExecutorType.SpSummon, CardId.DarkRebellionXyzDragon, DarkRebellionXyzDragonSummon);
AddExecutor(ExecutorType.Activate, CardId.DarkRebellionXyzDragon, DarkRebellionXyzDragonEffect);
AddExecutor(ExecutorType.SpSummon, CardId.Number39Utopia, DefaultNumberS39UtopiaTheLightningSummon);
AddExecutor(ExecutorType.SpSummon, CardId.NumberS39UtopiaOne);
AddExecutor(ExecutorType.SpSummon, CardId.NumberS39UtopiatheLightning);
AddExecutor(ExecutorType.Activate, CardId.NumberS39UtopiatheLightning);
AddExecutor(ExecutorType.Activate, CardId.StardustDragon, DefaultStardustDragonEffect);
AddExecutor(ExecutorType.Activate, CardId.StarlightRoad, DefaultTrap);
AddExecutor(ExecutorType.Activate, CardId.MagicDrain);
AddExecutor(ExecutorType.Activate, CardId.SolemnWarning, DefaultSolemnWarning);
AddExecutor(ExecutorType.Activate, CardId.SolemnStrike, DefaultSolemnStrike);
AddExecutor(ExecutorType.Activate, CardId.SolemnJudgment, DefaultSolemnJudgment);
AddExecutor(ExecutorType.Activate, CardId.MacroCosmos, DefaultUniqueTrap);
AddExecutor(ExecutorType.Activate, CardId.VanitysEmptiness, DefaultUniqueTrap);
AddExecutor(ExecutorType.Activate, CardId.DrowningMirrorForce, DefaultUniqueTrap);
AddExecutor(ExecutorType.Activate, CardId.QuakingMirrorForce, DefaultUniqueTrap);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
}
public override bool OnSelectHand()
{
// go first
return true;
}
public override void OnNewTurn()
{
CardOfDemiseUsed = false;
}
public override bool OnSelectYesNo(int desc)
{
// Yosenju Kama 2 shouldn't attack directly at most times
if (Card == null)
return true;
// Logger.DebugWriteLine(Card.Name);
if (Card.Id == CardId.YosenjuKama2)
return Card.ShouldDirectAttack;
else
return true;
}
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
{
if (!defender.IsMonsterHasPreventActivationEffectInBattle())
{
if (attacker.Attribute == (int)CardAttribute.Wind && Bot.HasInHand(CardId.YosenjuTsujik))
attacker.RealPower = attacker.RealPower + 1000;
}
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, CardId.YosenjuTsujik, cards, min, max);
AI.Utils.CheckSelectCount(result, cards, min, max);
return result;
}
private bool PotOfDualityEffect()
{
if (CardOfDemiseUsed)
{
AI.SelectCard(new[]
{
CardId.StarlightRoad,
CardId.MagicDrain,
CardId.SolemnJudgment,
CardId.VanitysEmptiness,
CardId.HarpiesFeatherDuster,
CardId.DrowningMirrorForce,
CardId.QuakingMirrorForce,
CardId.SolemnStrike,
CardId.SolemnWarning,
CardId.MacroCosmos,
CardId.CardOfDemise
});
}
else
{
AI.SelectCard(new[]
{
CardId.YosenjuKama3,
CardId.YosenjuKama1,
CardId.YosenjuKama2,
CardId.StarlightRoad,
CardId.MagicDrain,
CardId.VanitysEmptiness,
CardId.HarpiesFeatherDuster,
CardId.DrowningMirrorForce,
CardId.QuakingMirrorForce,
CardId.SolemnStrike,
CardId.SolemnJudgment,
CardId.SolemnWarning,
CardId.MacroCosmos,
CardId.CardOfDemise,
});
}
return true;
}
private bool CardOfDemiseEffect()
{
if (AI.Utils.IsTurn1OrMain2())
{
CardOfDemiseUsed = true;
return true;
}
return false;
}
private bool HaveAnotherYosenjuWithSameNameInHand()
{
foreach (ClientCard card in Bot.Hand.GetMonsters())
{
if (!card.Equals(Card) && card.Id == Card.Id)
return true;
}
return false;
}
private bool TrapSetUnique()
{
foreach (ClientCard card in Bot.GetSpells())
{
if (card.Id == Card.Id)
return false;
}
return TrapSetWhenZoneFree();
}
private bool TrapSetWhenZoneFree()
{
return Bot.GetSpellCountWithoutField() < 4;
}
private bool CardOfDemiseAcivated()
{
return CardOfDemiseUsed;
}
private bool YosenjuEffect()
{
// Don't activate the return to hand effect first
if (Duel.Phase == DuelPhase.End)
return false;
AI.SelectCard(new[]
{
CardId.YosenjuKama1,
CardId.YosenjuKama2,
CardId.YosenjuKama3
});
return true;
}
private bool CardOfDemiseEPEffect()
{
// do the end phase effect of Card Of Demise before Yosenjus return to hand
return Duel.Phase == DuelPhase.End;
}
private bool GagagaCowboySummon()
{
if (Duel.LifePoints[1] <= 800 || (Bot.GetMonsterCount()>=4 && Duel.LifePoints[1] <= 1600))
{
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
}
return false;
}
private bool DarkRebellionXyzDragonSummon()
{
int selfBestAttack = AI.Utils.GetBestAttack(Bot);
int oppoBestAttack = AI.Utils.GetBestAttack(Enemy);
return selfBestAttack <= oppoBestAttack;
}
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
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()
{
if (!HasChainedTrap(0) && Duel.Player == 1 && Duel.Phase == DuelPhase.BattleStart && Card.HasXyzMaterial(2))
......@@ -271,7 +283,7 @@ namespace WindBot.Game.AI.Decks
private bool MonsterRepos()
{
if (Card.Id == CardId.NumberS39UtopiatheLightning)
if (Card.Id == CardId.NumberS39UtopiatheLightning && Card.IsAttack())
return false;
return base.DefaultMonsterRepos();
}
......
......@@ -168,6 +168,12 @@ namespace WindBot.Game.AI.Decks
return true;
IList<ClientCard> materials0 = Bot.Graveyard;
IList<ClientCard> materials1 = Enemy.Graveyard;
IList<ClientCard> mats = new List<ClientCard>();
ClientCard aleister = GetAleisterInGrave();
if (aleister != null)
{
mats.Add(aleister);
}
ClientCard mat = null;
foreach (ClientCard card in materials0)
{
......@@ -187,9 +193,9 @@ namespace WindBot.Game.AI.Decks
}
if (mat != null)
{
mats.Add(mat);
AI.SelectCard(CardId.InvokedMechaba);
SelectAleisterInGrave();
AI.SelectThirdCard(mat);
AI.SelectMaterials(mats);
AI.SelectPosition(CardPosition.FaceUpAttack);
return true;
}
......@@ -211,41 +217,39 @@ namespace WindBot.Game.AI.Decks
}
if (mat != null)
{
mats.Add(mat);
AI.SelectCard(CardId.InvokedMagellanica);
SelectAleisterInGrave();
AI.SelectThirdCard(mat);
AI.SelectMaterials(mats);
AI.SelectPosition(CardPosition.FaceUpAttack);
return true;
}
return false;
}
private void SelectAleisterInGrave()
private ClientCard GetAleisterInGrave()
{
foreach (ClientCard card in Enemy.Graveyard)
{
if (card.Id == CardId.AleisterTheInvoker)
{
AI.SelectNextCard(card);
return;
return card;
}
}
foreach (ClientCard card in Bot.Graveyard)
{
if (card.Id == CardId.AleisterTheInvoker)
{
AI.SelectNextCard(card);
return;
return card;
}
}
AI.SelectNextCard(CardId.AleisterTheInvoker);
return null;
}
private bool ChakanineSummon()
{
if (Bot.HasInMonstersZone(CardId.Ratpier) && !ChakanineSpsummoned)
{
AI.SelectCard(CardId.Ratpier);
AI.SelectMaterials(CardId.Ratpier);
AI.SelectYesNo(true);
AI.SelectPosition(CardPosition.FaceUpDefence);
ChakanineSpsummoned = true;
......@@ -253,7 +257,7 @@ namespace WindBot.Game.AI.Decks
}
if (Bot.HasInMonstersZone(CardId.Broadbull) && !ChakanineSpsummoned)
{
AI.SelectCard(CardId.Broadbull);
AI.SelectMaterials(CardId.Broadbull);
AI.SelectYesNo(true);
AI.SelectPosition(CardPosition.FaceUpDefence);
ChakanineSpsummoned = true;
......@@ -289,7 +293,7 @@ namespace WindBot.Game.AI.Decks
{
if (Bot.HasInMonstersZone(CardId.Chakanine) && !TigermortarSpsummoned)
{
AI.SelectCard(CardId.Chakanine);
AI.SelectMaterials(CardId.Chakanine);
AI.SelectYesNo(true);
AI.SelectPosition(CardPosition.FaceUpDefence);
TigermortarSpsummoned = true;
......@@ -297,7 +301,7 @@ namespace WindBot.Game.AI.Decks
}
if (Bot.HasInMonstersZone(CardId.Ratpier) && !TigermortarSpsummoned)
{
AI.SelectCard(CardId.Ratpier);
AI.SelectMaterials(CardId.Ratpier);
AI.SelectYesNo(true);
AI.SelectPosition(CardPosition.FaceUpDefence);
TigermortarSpsummoned = true;
......@@ -310,7 +314,7 @@ namespace WindBot.Game.AI.Decks
CardId.Ratpier
}))
{
AI.SelectCard(CardId.Thoroughblade);
AI.SelectMaterials(CardId.Thoroughblade);
AI.SelectYesNo(true);
TigermortarSpsummoned = true;
return true;
......@@ -318,7 +322,7 @@ namespace WindBot.Game.AI.Decks
if (Bot.HasInMonstersZone(CardId.Whiptail) && !TigermortarSpsummoned
&& Bot.HasInGraveyard(CardId.Ratpier))
{
AI.SelectCard(CardId.Whiptail);
AI.SelectMaterials(CardId.Whiptail);
AI.SelectYesNo(true);
TigermortarSpsummoned = true;
return true;
......@@ -345,7 +349,7 @@ namespace WindBot.Game.AI.Decks
{
if (Bot.HasInMonstersZone(CardId.Tigermortar) && !BroadbullSpsummoned)
{
AI.SelectCard(CardId.Tigermortar);
AI.SelectMaterials(CardId.Tigermortar);
AI.SelectYesNo(true);
AI.SelectPosition(CardPosition.FaceUpDefence);
BroadbullSpsummoned = true;
......@@ -353,7 +357,7 @@ namespace WindBot.Game.AI.Decks
}
if (Bot.HasInMonstersZone(CardId.Chakanine) && !BroadbullSpsummoned)
{
AI.SelectCard(CardId.Chakanine);
AI.SelectMaterials(CardId.Chakanine);
AI.SelectYesNo(true);
AI.SelectPosition(CardPosition.FaceUpDefence);
BroadbullSpsummoned = true;
......@@ -361,7 +365,7 @@ namespace WindBot.Game.AI.Decks
}
if (Bot.HasInMonstersZone(CardId.Ratpier) && !BroadbullSpsummoned)
{
AI.SelectCard(CardId.Ratpier);
AI.SelectMaterials(CardId.Ratpier);
AI.SelectYesNo(true);
AI.SelectPosition(CardPosition.FaceUpDefence);
BroadbullSpsummoned = true;
......@@ -369,7 +373,7 @@ namespace WindBot.Game.AI.Decks
}
if (Bot.HasInMonstersZone(CardId.Thoroughblade) && !BroadbullSpsummoned)
{
AI.SelectCard(CardId.Thoroughblade);
AI.SelectMaterials(CardId.Thoroughblade);
AI.SelectYesNo(true);
AI.SelectPosition(CardPosition.FaceUpDefence);
BroadbullSpsummoned = true;
......@@ -399,7 +403,7 @@ namespace WindBot.Game.AI.Decks
{
AI.SelectYesNo(false);
AI.SelectPosition(CardPosition.FaceUpDefence);
AI.SelectCard(new[]
AI.SelectMaterials(new[]
{
CardId.Ratpier,
CardId.PhotonThrasher,
......@@ -411,7 +415,7 @@ namespace WindBot.Game.AI.Decks
private bool DridentSummon()
{
AI.SelectCard(new[]
AI.SelectMaterials(new[]
{
CardId.Broadbull,
CardId.Tigermortar,
......@@ -502,6 +506,11 @@ namespace WindBot.Game.AI.Decks
private bool DaigustoEmeralSummon()
{
AI.SelectMaterials(new[]
{
CardId.PhotonThrasher,
CardId.AleisterTheInvoker
});
return Bot.GetGraveyardMonsters().Count >= 3;
}
......@@ -595,7 +604,7 @@ namespace WindBot.Game.AI.Decks
private bool MonsterRepos()
{
if (Card.Id == CardId.NumberS39UtopiatheLightning)
if (Card.Id == CardId.NumberS39UtopiatheLightning && Card.IsAttack())
return false;
return base.DefaultMonsterRepos();
}
......
......@@ -58,10 +58,10 @@ namespace WindBot.Game.AI
if (defender.IsMonsterDangerous() || (defender.IsMonsterInvincible() && defender.IsDefense()))
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;
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;
}
......
......@@ -124,13 +124,49 @@ namespace WindBot.Game.AI
// 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
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
return null;
......
......@@ -85,6 +85,8 @@ namespace WindBot.Game
{
m_selector = null;
m_nextSelector = null;
m_thirdSelector = null;
m_materialSelector = null;
m_option = -1;
m_yesno = -1;
m_position = CardPosition.FaceUpAttack;
......@@ -158,17 +160,60 @@ namespace WindBot.Game
/// <param name="cards">List of available cards.</param>
/// <param name="min">Minimal 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>
/// <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.
IList<ClientCard> result = Executor.OnSelectCard(cards, min, max, cancelable);
IList<ClientCard> result = Executor.OnSelectCard(cards, min, max, hint, cancelable);
if (result != null)
return result;
// Update the next selector.
CardSelector selector = GetSelectedCards();
if (hint == HINTMSG_SPSUMMON && min == 1 && max > min) // pendulum summon
{
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 (selector != null)
......@@ -373,14 +418,45 @@ namespace WindBot.Game
/// <param name="max">Maximum cards.</param>
/// <param name="mode">True for exact equal.</param>
/// <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)
{
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)
{
// equal
......@@ -497,9 +573,10 @@ namespace WindBot.Game
/// <param name="cards">List of available cards.</param>
/// <param name="min">Minimal 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>
/// <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.
List<ClientCard> sorted = new List<ClientCard>();
......@@ -543,6 +620,7 @@ namespace WindBot.Game
private CardSelector m_selector;
private CardSelector m_nextSelector;
private CardSelector m_thirdSelector;
private CardSelector m_materialSelector;
private CardPosition m_position = CardPosition.FaceUpAttack;
private int m_option;
private int m_number;
......@@ -626,6 +704,36 @@ namespace WindBot.Game
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()
{
CardSelector selected = m_selector;
......
......@@ -25,6 +25,7 @@ namespace WindBot.Game
private Room _room;
private Duel _duel;
private int _hand;
private int _select_hint;
public GameBehavior(GameClient game)
{
......@@ -42,6 +43,8 @@ namespace WindBot.Game
_ai = new GameAI(Game, _duel);
_ai.Executor = DecksManager.Instantiate(_ai, _duel);
Deck = Deck.Load(_ai.Executor.Deck);
_select_hint = 0;
}
public int GetLocalPlayer(int player)
......@@ -80,6 +83,7 @@ namespace WindBot.Game
_messages.Add(GameMessage.Retry, OnRetry);
_messages.Add(GameMessage.Start, OnStart);
_messages.Add(GameMessage.Hint, OnHint);
_messages.Add(GameMessage.Win, OnWin);
_messages.Add(GameMessage.Draw, OnDraw);
_messages.Add(GameMessage.ShuffleDeck, OnShuffleDeck);
......@@ -120,6 +124,9 @@ namespace WindBot.Game
_messages.Add(GameMessage.AnnounceRace, OnAnnounceRace);
_messages.Add(GameMessage.AnnounceCardFilter, OnAnnounceCard);
_messages.Add(GameMessage.RockPaperScissors, OnRockPaperScissors);
_messages.Add(GameMessage.SpSummoning, OnSpSummon);
_messages.Add(GameMessage.SpSummoned, OnSpSummon);
}
private void OnJoinGame(BinaryReader packet)
......@@ -295,6 +302,17 @@ namespace WindBot.Game
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)
{
int type = packet.ReadByte();
......@@ -643,7 +661,7 @@ namespace WindBot.Game
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
bool cancelable = packet.ReadByte() != 0;
......@@ -670,7 +688,8 @@ namespace WindBot.Game
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)
{
......@@ -1027,7 +1046,8 @@ namespace WindBot.Game
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];
int index = 0;
......@@ -1125,5 +1145,10 @@ namespace WindBot.Game
result = _ai.OnRockPaperScissors();
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.
* 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
* 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