Commit 16c72c66 authored by mercury233's avatar mercury233
parents 042ffe18 5b861398
#created by ...
#main
18940556
18940556
18940556
93332803
93332803
55063751
28674152
41782653
41782653
41782653
3717252
3717252
80280944
48048590
77723643
55623480
30328508
30328508
44335251
77558536
77558536
77558536
95503687
95503687
4939890
4939890
14558127
14558127
59438930
37445295
37445295
23434538
23434538
33420078
67441435
1475311
1475311
1475311
11110587
11110587
11110587
18144506
38179121
38179121
38179121
44394295
44394295
44394295
67169062
81439173
83764718
94886282
94886282
99330325
10045474
10045474
74003290
77505534
4904633
#extra
74822425
20366274
48424886
94977269
50954680
80666118
4779823
33698022
76547525
42566602
98558751
30100551
74997493
50588353
50588353
!side
67696066
73176465
37742478
15341821
54757758
13529466
74586817
6983839
82633039
46772449
1861629
1845204
53129443
43898403
48130397
......@@ -2,6 +2,7 @@
#main
98169343
98169343
9929398
61283655
61283655
61283655
......@@ -10,21 +11,20 @@
35199656
14558127
14558127
14558127
59438930
59438930
98700941
23434538
23434538
23434538
94145021
67441435
63845230
63845230
63845230
18144506
35261759
35261759
53129443
53129443
53129443
73628505
73915051
73915051
......@@ -42,18 +42,18 @@
84749824
#extra
41999284
41999284
3987233
2857636
41999284
50588353
98558751
86221741
74997493
2857636
38342335
99111753
31833038
3987233
99111753
38342335
50588353
9753964
41999284
9753964
34408491
!side
{
"welcome": [
"你找到我了!!!",
"來決鬥吧"
],
"deckerror": [
"阿,可能BA又把CBD修壞導致{0}消失了。"
],
"duelstart": [
"這只是AI,打贏不要太高興阿。",
"十分致謝233服讓我們有遊戲可以玩,別忘記去拜訪他們。",
"反主流學院請洽NOVA。",
],
"newturn": [
"到我的回合了,抽牌!",
"我的回合,抽牌!",
"我抽了一張卡。"
],
"endturn": [
"回合结束。",
"我的回合结束了。",
"這樣算是成功的展開嗎......",
"輪到你了。你的下一句是......我要發動灰流麗對吧!"
],
"directattack": [
"{0},直接攻擊!",
"{0},直接攻擊對手!",
"{0},没有防守的地方,攻擊!",
"{0},攻擊對手的生命值!",
"{0},直接攻擊對手的生命值!",
"{0},通過直接攻擊打倒對手!",
"{0},使用直接攻擊打倒對手!",
"{0},直接攻擊釋放你的力量吧!",
"我的{0}將會粉碎你的生命值!",
"向對手展示你的力量吧,{0}!",
"你已經無法阻止我了。{0},攻擊!"
],
"attack": [
"{0},攻擊這體{1}!",
"{0},消滅這體{1}!",
"{0},打倒{1}!",
"{0},衝向那體{1}!",
"{0},把你的力量释放到{1}上吧!"
],
"ondirectattack": [
"可惡......",
"不過是{0}而已!",
"果然我還是太弱了......"
],
"facedownmonstername": "怪獸",
"activate": [
"我發動{0}。",
"我使用{0}的效果。",
"我使用{0}的力量。"
],
"summon": [
"真是HIGH的最高點!出來吧{0}。",
"出來吧,{0}!",
"出現吧,{0}!",
"我召喚了強大的{0}!",
"我呼喚{0}參加戰鬥!",
"我呼喚出{0}。",
"我召喚{0}。"
],
"setmonster": [
"我放置了一體怪獸。",
"我裡側表示放置了一體怪獸。"
],
"chaining": [
"看這裡!發動{0}!",
"我使用{0}的力量。",
"很不錯的戰術...但是我拒絕!{0}!",
"真不愧是納粹,竟然能識破我的蓋牌......你說你只是單純的決鬥者?{0},發動!",
"看樣子你忘了我的{0}!",
"你考慮過我有{0}嗎?"
]
}
......@@ -296,6 +296,44 @@ namespace WindBot.Game.AI
return Duel.ChainTargets.Count == 1 && card.Equals(Duel.ChainTargets[0]);
}
public bool ChainContainsCard(int id)
{
foreach (ClientCard card in Duel.CurrentChain)
{
if (card.Id == id)
return true;
}
return false;
}
public int ChainCountPlayer(int player)
{
int count = 0;
foreach (ClientCard card in Duel.CurrentChain)
{
if (card.Controller == player)
count++;
}
return count;
}
public bool HasChainedTrap(int player)
{
foreach (ClientCard card in Duel.CurrentChain)
{
if (card.Controller == player && card.HasType(CardType.Trap))
return true;
}
return false;
}
public ClientCard GetLastChainCard()
{
if (Duel.CurrentChain.Count > 0)
return Duel.CurrentChain[Duel.CurrentChain.Count - 1];
return null;
}
/// <summary>
/// Select cards listed in preferred.
/// </summary>
......
using YGOSharp.OCGWrapper.Enums;
using System.Collections.Generic;
using WindBot;
using WindBot.Game;
using WindBot.Game.AI;
namespace WindBot.Game.AI.Decks
{
[Deck("Blue-Eyes", "AI_BlueEyes")]
class BlueEyesExecutor : DefaultExecutor
{
public class CardId
{
public const int WhiteDragon = 89631139;
public const int AlternativeWhiteDragon = 38517737;
public const int DragonSpiritOfWhite = 45467446;
public const int WhiteStoneOfAncients = 71039903;
public const int WhiteStoneOfLegend = 79814787;
public const int SageWithEyesOfBlue = 8240199;
public const int EffectVeiler = 97268402;
public const int GalaxyCyclone = 5133471;
public const int HarpiesFeatherDuster = 18144506;
public const int ReturnOfTheDragonLords = 6853254;
public const int PotOfDesires = 35261759;
public const int TradeIn = 38120068;
public const int CardsOfConsonance = 39701395;
public const int DragonShrine = 41620959;
public const int MelodyOfAwakeningDragon = 48800175;
public const int SoulCharge = 54447022;
public const int MonsterReborn = 83764718;
public const int SilversCry = 87025064;
public const int Giganticastle = 63422098;
public const int AzureEyesSilverDragon = 40908371;
public const int BlueEyesSpiritDragon = 59822133;
public const int GalaxyEyesDarkMatterDragon = 58820923;
public const int GalaxyEyesCipherBladeDragon = 2530830;
public const int GalaxyEyesFullArmorPhotonDragon = 39030163;
public const int GalaxyEyesPrimePhotonDragon = 31801517;
public const int GalaxyEyesCipherDragon = 18963306;
public const int HopeHarbingerDragonTitanicGalaxy = 63767246;
public const int SylvanPrincessprite = 33909817;
}
private List<ClientCard> UsedAlternativeWhiteDragon = new List<ClientCard>();
ClientCard UsedGalaxyEyesCipherDragon;
bool AlternativeWhiteDragonSummoned = false;
bool SoulChargeUsed = false;
public BlueEyesExecutor(GameAI ai, Duel duel)
: base(ai, duel)
{
// destroy traps
AddExecutor(ExecutorType.Activate, CardId.HarpiesFeatherDuster, DefaultHarpiesFeatherDusterFirst);
AddExecutor(ExecutorType.Activate, CardId.GalaxyCyclone, DefaultGalaxyCyclone);
AddExecutor(ExecutorType.Activate, CardId.HarpiesFeatherDuster);
AddExecutor(ExecutorType.Activate, CardId.DragonShrine, DragonShrineEffect);
// Sage search
AddExecutor(ExecutorType.Summon, CardId.SageWithEyesOfBlue, SageWithEyesOfBlueSummon);
// search Alternative White Dragon
AddExecutor(ExecutorType.Activate, CardId.MelodyOfAwakeningDragon, MelodyOfAwakeningDragonEffect);
AddExecutor(ExecutorType.Activate, CardId.CardsOfConsonance, CardsOfConsonanceEffect);
AddExecutor(ExecutorType.Activate, CardId.TradeIn, TradeInEffect);
AddExecutor(ExecutorType.Activate, CardId.PotOfDesires, DefaultPotOfDesires);
// spsummon Alternative White Dragon if possible
AddExecutor(ExecutorType.SpSummon, CardId.AlternativeWhiteDragon, AlternativeWhiteDragonSummon);
// reborn
AddExecutor(ExecutorType.Activate, CardId.ReturnOfTheDragonLords, RebornEffect);
AddExecutor(ExecutorType.Activate, CardId.SilversCry, RebornEffect);
AddExecutor(ExecutorType.Activate, CardId.MonsterReborn, RebornEffect);
// monster effects
AddExecutor(ExecutorType.Activate, CardId.AlternativeWhiteDragon, AlternativeWhiteDragonEffect);
AddExecutor(ExecutorType.Activate, CardId.SageWithEyesOfBlue, SageWithEyesOfBlueEffect);
AddExecutor(ExecutorType.Activate, CardId.WhiteStoneOfAncients, WhiteStoneOfAncientsEffect);
AddExecutor(ExecutorType.Activate, CardId.DragonSpiritOfWhite, DragonSpiritOfWhiteEffect);
AddExecutor(ExecutorType.Activate, CardId.BlueEyesSpiritDragon, BlueEyesSpiritDragonEffect);
AddExecutor(ExecutorType.Activate, CardId.HopeHarbingerDragonTitanicGalaxy, HopeHarbingerDragonTitanicGalaxyEffect);
AddExecutor(ExecutorType.Activate, CardId.GalaxyEyesCipherDragon, GalaxyEyesCipherDragonEffect);
AddExecutor(ExecutorType.Activate, CardId.GalaxyEyesPrimePhotonDragon, GalaxyEyesPrimePhotonDragonEffect);
AddExecutor(ExecutorType.Activate, CardId.GalaxyEyesFullArmorPhotonDragon, GalaxyEyesFullArmorPhotonDragonEffect);
AddExecutor(ExecutorType.Activate, CardId.GalaxyEyesCipherBladeDragon, GalaxyEyesCipherBladeDragonEffect);
AddExecutor(ExecutorType.Activate, CardId.GalaxyEyesDarkMatterDragon, GalaxyEyesDarkMatterDragonEffect);
AddExecutor(ExecutorType.Activate, CardId.AzureEyesSilverDragon, AzureEyesSilverDragonEffect);
AddExecutor(ExecutorType.Activate, CardId.SylvanPrincessprite, SylvanPrincesspriteEffect);
// normal summon
AddExecutor(ExecutorType.Summon, CardId.SageWithEyesOfBlue, WhiteStoneSummon);
AddExecutor(ExecutorType.Summon, CardId.WhiteStoneOfAncients, WhiteStoneSummon);
AddExecutor(ExecutorType.Summon, CardId.WhiteStoneOfLegend, WhiteStoneSummon);
// special summon from extra
AddExecutor(ExecutorType.SpSummon, CardId.GalaxyEyesCipherDragon, GalaxyEyesCipherDragonSummon);
AddExecutor(ExecutorType.SpSummon, CardId.GalaxyEyesPrimePhotonDragon, GalaxyEyesPrimePhotonDragonSummon);
AddExecutor(ExecutorType.SpSummon, CardId.GalaxyEyesFullArmorPhotonDragon, GalaxyEyesFullArmorPhotonDragonSummon);
AddExecutor(ExecutorType.SpSummon, CardId.GalaxyEyesCipherBladeDragon, GalaxyEyesCipherBladeDragonSummon);
AddExecutor(ExecutorType.SpSummon, CardId.GalaxyEyesDarkMatterDragon, GalaxyEyesDarkMatterDragonSummon);
AddExecutor(ExecutorType.SpSummon, CardId.Giganticastle, GiganticastleSummon);
AddExecutor(ExecutorType.SpSummon, CardId.BlueEyesSpiritDragon, BlueEyesSpiritDragonSummon);
AddExecutor(ExecutorType.SpSummon, CardId.HopeHarbingerDragonTitanicGalaxy, HopeHarbingerDragonTitanicGalaxySummon);
AddExecutor(ExecutorType.SpSummon, CardId.SylvanPrincessprite, SylvanPrincesspriteSummon);
// if we don't have other things to do...
AddExecutor(ExecutorType.Activate, CardId.SoulCharge, SoulChargeEffect);
AddExecutor(ExecutorType.Repos, Repos);
// summon White Stone to use the hand effect of Sage
AddExecutor(ExecutorType.Summon, CardId.WhiteStoneOfLegend, WhiteStoneSummonForSage);
AddExecutor(ExecutorType.Summon, CardId.WhiteStoneOfAncients, WhiteStoneSummonForSage);
AddExecutor(ExecutorType.Summon, CardId.SageWithEyesOfBlue, WhiteStoneSummonForSage);
AddExecutor(ExecutorType.Activate, CardId.SageWithEyesOfBlue, SageWithEyesOfBlueEffectInHand);
// set White Stone of Legend frist
AddExecutor(ExecutorType.MonsterSet, CardId.WhiteStoneOfLegend);
AddExecutor(ExecutorType.MonsterSet, CardId.WhiteStoneOfAncients);
AddExecutor(ExecutorType.SpellSet, SpellSet);
}
public override void OnNewTurn()
{
// reset
UsedAlternativeWhiteDragon.Clear();
UsedGalaxyEyesCipherDragon = null;
AlternativeWhiteDragonSummoned = false;
SoulChargeUsed = false;
}
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)
{
Logger.DebugWriteLine("OnSelectCard MelodyOfAwakeningDragon");
IList<ClientCard> result = new List<ClientCard>();
if (!Bot.HasInHand(CardId.WhiteDragon))
{
foreach (ClientCard card in cards)
{
if (card.Id == CardId.WhiteDragon)
{
result.Add(card);
break;
}
}
}
foreach (ClientCard card in cards)
{
if (card.Id == CardId.AlternativeWhiteDragon && result.Count < max)
{
result.Add(card);
}
}
AI.Utils.CheckSelectCount(result, cards, min, max);
return result;
}
Logger.DebugWriteLine("Use default.");
return null;
}
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("OnSelectSynchroMaterial " + cards.Count + " " + sum + " " + min + " " + max);
if (sum != 8)
return null;
foreach (ClientCard AlternativeWhiteDragon in UsedAlternativeWhiteDragon)
{
if (cards.IndexOf(AlternativeWhiteDragon) > 0)
{
UsedAlternativeWhiteDragon.Remove(AlternativeWhiteDragon);
Logger.DebugWriteLine("select UsedAlternativeWhiteDragon");
return new[] { AlternativeWhiteDragon };
}
}
return null;
}
private bool DragonShrineEffect()
{
AI.SelectCard(new[]
{
CardId.DragonSpiritOfWhite,
CardId.WhiteDragon,
CardId.WhiteStoneOfAncients,
CardId.WhiteStoneOfLegend
});
if (!Bot.HasInHand(CardId.WhiteDragon))
{
AI.SelectNextCard(CardId.WhiteStoneOfLegend);
}
else
{
AI.SelectNextCard(new[]
{
CardId.WhiteStoneOfAncients,
CardId.DragonSpiritOfWhite,
CardId.WhiteStoneOfLegend
});
}
return true;
}
private bool MelodyOfAwakeningDragonEffect()
{
AI.SelectCard(new[]
{
CardId.WhiteStoneOfAncients,
CardId.DragonSpiritOfWhite,
CardId.WhiteStoneOfLegend,
CardId.GalaxyCyclone,
CardId.EffectVeiler,
CardId.TradeIn,
CardId.SageWithEyesOfBlue
});
return true;
}
private bool CardsOfConsonanceEffect()
{
if (!Bot.HasInHand(CardId.WhiteDragon))
{
AI.SelectCard(CardId.WhiteStoneOfLegend);
}
else if (Bot.HasInHand(CardId.TradeIn))
{
AI.SelectCard(CardId.WhiteStoneOfLegend);
}
else
{
AI.SelectCard(CardId.WhiteStoneOfAncients);
}
return true;
}
private bool TradeInEffect()
{
if (Bot.HasInHand(CardId.DragonSpiritOfWhite))
{
AI.SelectCard(CardId.DragonSpiritOfWhite);
return true;
}
else if (HasTwoInHand(CardId.WhiteDragon))
{
AI.SelectCard(CardId.WhiteDragon);
return true;
}
else if (HasTwoInHand(CardId.AlternativeWhiteDragon))
{
AI.SelectCard(CardId.AlternativeWhiteDragon);
return true;
}
else if (!Bot.HasInHand(CardId.WhiteDragon) || !Bot.HasInHand(CardId.AlternativeWhiteDragon))
{
AI.SelectCard(new[]
{
CardId.WhiteDragon,
CardId.AlternativeWhiteDragon
});
return true;
}
else
{
return false;
}
}
private bool AlternativeWhiteDragonEffect()
{
ClientCard target = AI.Utils.GetProblematicEnemyMonster(Card.GetDefensePower());
if (target != null)
{
AI.SelectCard(target);
UsedAlternativeWhiteDragon.Add(Card);
return true;
}
if (CanDealWithUsedAlternativeWhiteDragon())
{
target = AI.Utils.GetBestEnemyMonster();
AI.SelectCard(target);
UsedAlternativeWhiteDragon.Add(Card);
return true;
}
return false;
}
private bool RebornEffect()
{
if (Duel.Player == 0 && CurrentChain.Count > 0)
{
// Silver's Cry spsummon Dragon Spirit at chain 2 will miss the timing
return false;
}
if (Duel.Player == 0 && (Duel.Phase == DuelPhase.Draw || Duel.Phase == DuelPhase.Standby))
{
// Let Azure-Eyes spsummon first
return false;
}
IList<int> targets = new[] {
CardId.HopeHarbingerDragonTitanicGalaxy,
CardId.GalaxyEyesDarkMatterDragon,
CardId.AlternativeWhiteDragon,
CardId.AzureEyesSilverDragon,
CardId.BlueEyesSpiritDragon,
CardId.WhiteDragon,
CardId.DragonSpiritOfWhite
};
if (!Bot.HasInGraveyard(targets))
{
return false;
}
ClientCard floodgate = Enemy.SpellZone.GetFloodgate();
if (floodgate != null && Bot.HasInGraveyard(CardId.DragonSpiritOfWhite))
{
AI.SelectCard(CardId.DragonSpiritOfWhite);
}
else
{
AI.SelectCard(targets);
}
return true;
}
private bool AzureEyesSilverDragonEffect()
{
if (Enemy.GetSpellCount() > 0)
{
AI.SelectCard(CardId.DragonSpiritOfWhite);
}
else
{
AI.SelectCard(CardId.WhiteDragon);
}
return true;
}
private bool SageWithEyesOfBlueSummon()
{
return !Bot.HasInHand(new[]
{
CardId.WhiteStoneOfAncients,
CardId.WhiteStoneOfLegend
});
}
private bool SageWithEyesOfBlueEffect()
{
if (Card.Location == CardLocation.Hand)
{
return false;
}
AI.SelectCard(new[]
{
CardId.WhiteStoneOfAncients,
CardId.EffectVeiler,
CardId.WhiteStoneOfLegend
});
return true;
}
private bool WhiteStoneSummonForSage()
{
return Bot.HasInHand(CardId.SageWithEyesOfBlue);
}
private bool SageWithEyesOfBlueEffectInHand()
{
if (Card.Location != CardLocation.Hand)
{
return false;
}
if (!Bot.HasInMonstersZone(new[]
{
CardId.WhiteStoneOfLegend,
CardId.WhiteStoneOfAncients
}) || Bot.HasInMonstersZone(new[]
{
CardId.AlternativeWhiteDragon,
CardId.WhiteDragon,
CardId.DragonSpiritOfWhite
}))
{
return false;
}
AI.SelectCard(new[]
{
CardId.WhiteStoneOfLegend,
CardId.WhiteStoneOfAncients
});
if (Enemy.GetSpellCount() > 0)
{
AI.SelectNextCard(CardId.DragonSpiritOfWhite);
}
else
{
AI.SelectNextCard(CardId.WhiteDragon);
}
return true;
}
private bool DragonSpiritOfWhiteEffect()
{
if (ActivateDescription == -1)
{
ClientCard target = AI.Utils.GetBestEnemySpell();
AI.SelectCard(target);
return true;
}
else if (HaveEnoughWhiteDragonInHand())
{
if (Duel.Player == 0 && Duel.Phase == DuelPhase.BattleStart)
{
return Card.Attacked;
}
if (Duel.Player == 1 && Duel.Phase == DuelPhase.End)
{
return Bot.HasInMonstersZone(CardId.AzureEyesSilverDragon, true)
&& !Bot.HasInGraveyard(CardId.DragonSpiritOfWhite)
&& !Bot.HasInGraveyard(CardId.WhiteDragon);
}
if (AI.Utils.IsChainTarget(Card))
{
return true;
}
}
return false;
}
private bool BlueEyesSpiritDragonEffect()
{
if (ActivateDescription == -1 || ActivateDescription == AI.Utils.GetStringId(CardId.BlueEyesSpiritDragon, 0))
{
return LastChainPlayer == 1;
}
else if (Duel.Player == 1 && (Duel.Phase == DuelPhase.BattleStart || Duel.Phase == DuelPhase.End))
{
AI.SelectCard(CardId.AzureEyesSilverDragon);
return true;
}
else
{
if (AI.Utils.IsChainTarget(Card))
{
AI.SelectCard(CardId.AzureEyesSilverDragon);
return true;
}
return false;
}
}
private bool HopeHarbingerDragonTitanicGalaxyEffect()
{
if (ActivateDescription == -1 || ActivateDescription == AI.Utils.GetStringId(CardId.HopeHarbingerDragonTitanicGalaxy, 0))
{
return LastChainPlayer == 1;
}
return true;
}
private bool WhiteStoneOfAncientsEffect()
{
if (ActivateDescription == AI.Utils.GetStringId(CardId.WhiteStoneOfAncients, 0))
{
if (Bot.HasInHand(CardId.TradeIn)
&& !Bot.HasInHand(CardId.WhiteDragon)
&& !Bot.HasInHand(CardId.AlternativeWhiteDragon))
{
AI.SelectCard(CardId.WhiteDragon);
return true;
}
if (AlternativeWhiteDragonSummoned)
{
return false;
}
if (Bot.HasInHand(CardId.WhiteDragon)
&& !Bot.HasInHand(CardId.AlternativeWhiteDragon)
&& Bot.HasInGraveyard(CardId.AlternativeWhiteDragon))
{
AI.SelectCard(CardId.AlternativeWhiteDragon);
return true;
}
if (Bot.HasInHand(CardId.AlternativeWhiteDragon)
&& !Bot.HasInHand(CardId.WhiteDragon)
&& Bot.HasInGraveyard(CardId.WhiteDragon))
{
AI.SelectCard(CardId.WhiteDragon);
return true;
}
return false;
}
else
{
if (Enemy.GetSpellCount() > 0)
{
AI.SelectCard(CardId.DragonSpiritOfWhite);
}
else
{
AI.SelectCard(CardId.WhiteDragon);
}
return true;
}
}
private bool AlternativeWhiteDragonSummon()
{
AlternativeWhiteDragonSummoned = true;
return true;
}
private bool WhiteStoneSummon()
{
return Bot.HasInMonstersZone(new[]
{
CardId.SageWithEyesOfBlue,
CardId.WhiteStoneOfAncients,
CardId.WhiteStoneOfLegend,
CardId.AlternativeWhiteDragon,
CardId.WhiteDragon,
CardId.DragonSpiritOfWhite
});
}
private bool GalaxyEyesCipherDragonSummon()
{
if (Duel.Turn == 1 || SoulChargeUsed)
{
return false;
}
List<ClientCard> monsters = Enemy.GetMonsters();
if (monsters.Count == 1 && !monsters[0].IsFacedown() && ((monsters[0].IsDefense() && monsters[0].GetDefensePower() >= 3000) && monsters[0].HasType(CardType.Xyz)))
{
return true;
}
if (monsters.Count >= 3)
{
foreach (ClientCard monster in monsters)
{
if (!monster.IsFacedown() && ((monster.IsDefense() && monster.GetDefensePower() >= 3000) || monster.HasType(CardType.Xyz)))
{
return true;
}
}
}
return false;
}
private bool GalaxyEyesPrimePhotonDragonSummon()
{
if (Duel.Turn == 1)
{
return false;
}
if (AI.Utils.IsOneEnemyBetterThanValue(2999, false))
{
return true;
}
return false;
}
private bool GalaxyEyesFullArmorPhotonDragonSummon()
{
if (Bot.HasInMonstersZone(CardId.GalaxyEyesCipherDragon))
{
foreach (ClientCard monster in Bot.GetMonsters())
{
if ((monster.IsDisabled() && monster.HasType(CardType.Xyz) && !monster.Equals(UsedGalaxyEyesCipherDragon))
|| (Duel.Phase == DuelPhase.Main2 && monster.Equals(UsedGalaxyEyesCipherDragon)))
{
AI.SelectCard(monster);
return true;
}
}
}
if (Bot.HasInMonstersZone(CardId.GalaxyEyesPrimePhotonDragon))
{
if (!AI.Utils.IsOneEnemyBetterThanValue(4000, false))
{
AI.SelectCard(CardId.GalaxyEyesPrimePhotonDragon);
return true;
}
}
return false;
}
private bool GalaxyEyesCipherBladeDragonSummon()
{
if (Bot.HasInMonstersZone(CardId.GalaxyEyesFullArmorPhotonDragon) && AI.Utils.GetProblematicEnemyCard() != null)
{
AI.SelectCard(CardId.GalaxyEyesFullArmorPhotonDragon);
return true;
}
return false;
}
private bool GalaxyEyesDarkMatterDragonSummon()
{
if (Bot.HasInMonstersZone(CardId.GalaxyEyesFullArmorPhotonDragon))
{
AI.SelectCard(CardId.GalaxyEyesFullArmorPhotonDragon);
return true;
}
return false;
}
private bool GalaxyEyesPrimePhotonDragonEffect()
{
return true;
}
private bool GalaxyEyesCipherDragonEffect()
{
List<ClientCard> monsters = Enemy.GetMonsters();
foreach (ClientCard monster in monsters)
{
if (monster.HasType(CardType.Xyz))
{
AI.SelectCard(monster);
UsedGalaxyEyesCipherDragon = Card;
return true;
}
}
foreach (ClientCard monster in monsters)
{
if (monster.IsDefense())
{
AI.SelectCard(monster);
UsedGalaxyEyesCipherDragon = Card;
return true;
}
}
UsedGalaxyEyesCipherDragon = Card;
return true;
}
private bool GalaxyEyesFullArmorPhotonDragonEffect()
{
ClientCard target = AI.Utils.GetProblematicEnemySpell();
if (target != null)
{
AI.SelectCard(target);
return true;
}
target = AI.Utils.GetProblematicEnemyMonster();
if (target != null)
{
AI.SelectCard(target);
return true;
}
foreach (ClientCard spell in Enemy.GetSpells())
{
if (spell.IsFaceup())
{
AI.SelectCard(spell);
return true;
}
}
List<ClientCard> monsters = Enemy.GetMonsters();
if (monsters.Count >= 2)
{
foreach (ClientCard monster in monsters)
{
if (monster.IsDefense())
{
AI.SelectCard(monster);
return true;
}
}
return true;
}
if (monsters.Count == 2)
{
foreach (ClientCard monster in monsters)
{
if (monster.IsMonsterInvincible() || monster.IsMonsterDangerous() || monster.GetDefensePower() > 4000)
{
AI.SelectCard(monster);
return true;
}
}
}
if (monsters.Count == 1)
{
return true;
}
return false;
}
private bool GalaxyEyesCipherBladeDragonEffect()
{
if (Card.Location == CardLocation.Grave)
{
return true;
}
ClientCard target = AI.Utils.GetProblematicEnemyCard();
if (target != null)
{
AI.SelectCard(target);
return true;
}
List<ClientCard> monsters = Enemy.GetMonsters();
foreach (ClientCard monster in monsters)
{
if (monster.IsDefense())
{
AI.SelectCard(monster);
return true;
}
}
foreach (ClientCard monster in monsters)
{
AI.SelectCard(monster);
return true;
}
List<ClientCard> spells = Enemy.GetSpells();
foreach (ClientCard spell in spells)
{
if (spell.IsFacedown())
{
AI.SelectCard(spell);
return true;
}
}
foreach (ClientCard spell in spells)
{
AI.SelectCard(spell);
return true;
}
return false;
}
private bool GalaxyEyesDarkMatterDragonEffect()
{
AI.SelectCard(new[]
{
CardId.WhiteStoneOfAncients,
CardId.WhiteStoneOfLegend,
CardId.DragonSpiritOfWhite,
CardId.WhiteDragon
});
AI.SelectNextCard(new[]
{
CardId.WhiteStoneOfAncients,
CardId.WhiteStoneOfLegend,
CardId.DragonSpiritOfWhite,
CardId.WhiteDragon
});
return true;
}
private bool GiganticastleSummon()
{
if (Duel.Phase != DuelPhase.Main1 || Duel.Turn == 1 || SoulChargeUsed)
return false;
int bestSelfAttack = AI.Utils.GetBestAttack(Bot);
int bestEnemyAttack = AI.Utils.GetBestPower(Enemy);
return bestSelfAttack <= bestEnemyAttack && bestEnemyAttack > 2500 && bestEnemyAttack <= 3100;
}
private bool BlueEyesSpiritDragonSummon()
{
if (Duel.Phase == DuelPhase.Main1)
{
if (UsedAlternativeWhiteDragon.Count > 0)
{
return true;
}
if (Duel.Turn == 1 || SoulChargeUsed)
{
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
}
}
if (Duel.Phase == DuelPhase.Main2)
{
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
}
return false;
}
private bool HopeHarbingerDragonTitanicGalaxySummon()
{
if (Duel.Phase == DuelPhase.Main1)
{
if (UsedAlternativeWhiteDragon.Count > 0)
{
return true;
}
if (Duel.Turn == 1 || SoulChargeUsed)
{
return true;
}
}
if (Duel.Phase == DuelPhase.Main2)
{
return true;
}
return false;
}
private bool SylvanPrincesspriteSummon()
{
if (Duel.Turn == 1)
{
return true;
}
if (Duel.Phase == DuelPhase.Main1 && !Bot.HasInMonstersZone(new[]
{
CardId.AlternativeWhiteDragon,
CardId.WhiteDragon,
CardId.DragonSpiritOfWhite
}))
{
return true;
}
if (Duel.Phase == DuelPhase.Main2 || SoulChargeUsed)
{
return true;
}
return false;
}
private bool SylvanPrincesspriteEffect()
{
AI.SelectCard(new[]
{
CardId.WhiteStoneOfLegend,
CardId.WhiteStoneOfAncients
});
return true;
}
private bool SoulChargeEffect()
{
if (Bot.HasInMonstersZone(CardId.BlueEyesSpiritDragon, true))
return false;
int count = Bot.GetGraveyardMonsters().Count;
int space = 5 - Bot.GetMonstersInMainZone().Count;
if (count < space)
count = space;
if (count < 2 || Duel.LifePoints[0] < count*1000)
return false;
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 - defence > Duel.LifePoints[1])
return false;
}
AI.SelectCard(new[]
{
CardId.BlueEyesSpiritDragon,
CardId.HopeHarbingerDragonTitanicGalaxy,
CardId.AlternativeWhiteDragon,
CardId.WhiteDragon,
CardId.DragonSpiritOfWhite,
CardId.AzureEyesSilverDragon,
CardId.WhiteStoneOfAncients,
CardId.WhiteStoneOfLegend
});
SoulChargeUsed = true;
return true;
}
private bool Repos()
{
bool enemyBetter = AI.Utils.IsAllEnemyBetter(true);
if (Card.IsAttack() && enemyBetter)
return true;
if (Card.IsFacedown())
return true;
if (Card.IsDefense() && !enemyBetter && Card.Attack >= Card.Defense)
return true;
if (Card.IsDefense() && (
Card.Id == CardId.BlueEyesSpiritDragon
|| Card.Id == CardId.AzureEyesSilverDragon
))
return true;
if (Card.IsAttack() && (
Card.Id == CardId.SageWithEyesOfBlue
|| Card.Id == CardId.WhiteStoneOfAncients
|| Card.Id == CardId.WhiteStoneOfLegend
))
return true;
return false;
}
private bool SpellSet()
{
return (Card.IsTrap() || (Card.Id==CardId.SilversCry)) && Bot.GetSpellCountWithoutField() < 4;
}
private bool HasTwoInHand(int id)
{
int num = 0;
foreach (ClientCard card in Bot.Hand)
{
if (card != null && card.Id == id)
num++;
}
return num >= 2;
}
private bool CanDealWithUsedAlternativeWhiteDragon()
{
return Bot.HasInMonstersZone(new[]
{
CardId.SageWithEyesOfBlue,
CardId.WhiteStoneOfAncients,
CardId.WhiteStoneOfLegend,
CardId.WhiteDragon,
CardId.DragonSpiritOfWhite
}) || Bot.GetCountCardInZone(Bot.MonsterZone, CardId.AlternativeWhiteDragon)>=2 ;
}
private bool HaveEnoughWhiteDragonInHand()
{
return HasTwoInHand(CardId.WhiteDragon) || (
Bot.HasInGraveyard(CardId.WhiteDragon)
&& Bot.HasInGraveyard(CardId.WhiteStoneOfAncients)
);
}
}
}
using YGOSharp.OCGWrapper.Enums;
using System.Collections.Generic;
using WindBot;
using WindBot.Game;
using WindBot.Game.AI;
namespace WindBot.Game.AI.Decks
{
[Deck("Blue-Eyes", "AI_BlueEyes")]
class BlueEyesExecutor : DefaultExecutor
{
public class CardId
{
public const int WhiteDragon = 89631139;
public const int AlternativeWhiteDragon = 38517737;
public const int DragonSpiritOfWhite = 45467446;
public const int WhiteStoneOfAncients = 71039903;
public const int WhiteStoneOfLegend = 79814787;
public const int SageWithEyesOfBlue = 8240199;
public const int EffectVeiler = 97268402;
public const int GalaxyCyclone = 5133471;
public const int HarpiesFeatherDuster = 18144506;
public const int ReturnOfTheDragonLords = 6853254;
public const int PotOfDesires = 35261759;
public const int TradeIn = 38120068;
public const int CardsOfConsonance = 39701395;
public const int DragonShrine = 41620959;
public const int MelodyOfAwakeningDragon = 48800175;
public const int SoulCharge = 54447022;
public const int MonsterReborn = 83764718;
public const int SilversCry = 87025064;
public const int Giganticastle = 63422098;
public const int AzureEyesSilverDragon = 40908371;
public const int BlueEyesSpiritDragon = 59822133;
public const int GalaxyEyesDarkMatterDragon = 58820923;
public const int GalaxyEyesCipherBladeDragon = 2530830;
public const int GalaxyEyesFullArmorPhotonDragon = 39030163;
public const int GalaxyEyesPrimePhotonDragon = 31801517;
public const int GalaxyEyesCipherDragon = 18963306;
public const int HopeHarbingerDragonTitanicGalaxy = 63767246;
public const int SylvanPrincessprite = 33909817;
}
private List<ClientCard> UsedAlternativeWhiteDragon = new List<ClientCard>();
ClientCard UsedGalaxyEyesCipherDragon;
bool AlternativeWhiteDragonSummoned = false;
bool SoulChargeUsed = false;
public BlueEyesExecutor(GameAI ai, Duel duel)
: base(ai, duel)
{
// destroy traps
AddExecutor(ExecutorType.Activate, CardId.HarpiesFeatherDuster, DefaultHarpiesFeatherDusterFirst);
AddExecutor(ExecutorType.Activate, CardId.GalaxyCyclone, DefaultGalaxyCyclone);
AddExecutor(ExecutorType.Activate, CardId.HarpiesFeatherDuster);
AddExecutor(ExecutorType.Activate, CardId.DragonShrine, DragonShrineEffect);
// Sage search
AddExecutor(ExecutorType.Summon, CardId.SageWithEyesOfBlue, SageWithEyesOfBlueSummon);
// search Alternative White Dragon
AddExecutor(ExecutorType.Activate, CardId.MelodyOfAwakeningDragon, MelodyOfAwakeningDragonEffect);
AddExecutor(ExecutorType.Activate, CardId.CardsOfConsonance, CardsOfConsonanceEffect);
AddExecutor(ExecutorType.Activate, CardId.TradeIn, TradeInEffect);
AddExecutor(ExecutorType.Activate, CardId.PotOfDesires, DefaultPotOfDesires);
// spsummon Alternative White Dragon if possible
AddExecutor(ExecutorType.SpSummon, CardId.AlternativeWhiteDragon, AlternativeWhiteDragonSummon);
// reborn
AddExecutor(ExecutorType.Activate, CardId.ReturnOfTheDragonLords, RebornEffect);
AddExecutor(ExecutorType.Activate, CardId.SilversCry, RebornEffect);
AddExecutor(ExecutorType.Activate, CardId.MonsterReborn, RebornEffect);
// monster effects
AddExecutor(ExecutorType.Activate, CardId.AlternativeWhiteDragon, AlternativeWhiteDragonEffect);
AddExecutor(ExecutorType.Activate, CardId.SageWithEyesOfBlue, SageWithEyesOfBlueEffect);
AddExecutor(ExecutorType.Activate, CardId.WhiteStoneOfAncients, WhiteStoneOfAncientsEffect);
AddExecutor(ExecutorType.Activate, CardId.DragonSpiritOfWhite, DragonSpiritOfWhiteEffect);
AddExecutor(ExecutorType.Activate, CardId.BlueEyesSpiritDragon, BlueEyesSpiritDragonEffect);
AddExecutor(ExecutorType.Activate, CardId.HopeHarbingerDragonTitanicGalaxy, HopeHarbingerDragonTitanicGalaxyEffect);
AddExecutor(ExecutorType.Activate, CardId.GalaxyEyesCipherDragon, GalaxyEyesCipherDragonEffect);
AddExecutor(ExecutorType.Activate, CardId.GalaxyEyesPrimePhotonDragon, GalaxyEyesPrimePhotonDragonEffect);
AddExecutor(ExecutorType.Activate, CardId.GalaxyEyesFullArmorPhotonDragon, GalaxyEyesFullArmorPhotonDragonEffect);
AddExecutor(ExecutorType.Activate, CardId.GalaxyEyesCipherBladeDragon, GalaxyEyesCipherBladeDragonEffect);
AddExecutor(ExecutorType.Activate, CardId.GalaxyEyesDarkMatterDragon, GalaxyEyesDarkMatterDragonEffect);
AddExecutor(ExecutorType.Activate, CardId.AzureEyesSilverDragon, AzureEyesSilverDragonEffect);
AddExecutor(ExecutorType.Activate, CardId.SylvanPrincessprite, SylvanPrincesspriteEffect);
// normal summon
AddExecutor(ExecutorType.Summon, CardId.SageWithEyesOfBlue, WhiteStoneSummon);
AddExecutor(ExecutorType.Summon, CardId.WhiteStoneOfAncients, WhiteStoneSummon);
AddExecutor(ExecutorType.Summon, CardId.WhiteStoneOfLegend, WhiteStoneSummon);
// special summon from extra
AddExecutor(ExecutorType.SpSummon, CardId.GalaxyEyesCipherDragon, GalaxyEyesCipherDragonSummon);
AddExecutor(ExecutorType.SpSummon, CardId.GalaxyEyesPrimePhotonDragon, GalaxyEyesPrimePhotonDragonSummon);
AddExecutor(ExecutorType.SpSummon, CardId.GalaxyEyesFullArmorPhotonDragon, GalaxyEyesFullArmorPhotonDragonSummon);
AddExecutor(ExecutorType.SpSummon, CardId.GalaxyEyesCipherBladeDragon, GalaxyEyesCipherBladeDragonSummon);
AddExecutor(ExecutorType.SpSummon, CardId.GalaxyEyesDarkMatterDragon, GalaxyEyesDarkMatterDragonSummon);
AddExecutor(ExecutorType.SpSummon, CardId.Giganticastle, GiganticastleSummon);
AddExecutor(ExecutorType.SpSummon, CardId.BlueEyesSpiritDragon, BlueEyesSpiritDragonSummon);
AddExecutor(ExecutorType.SpSummon, CardId.HopeHarbingerDragonTitanicGalaxy, HopeHarbingerDragonTitanicGalaxySummon);
AddExecutor(ExecutorType.SpSummon, CardId.SylvanPrincessprite, SylvanPrincesspriteSummon);
// if we don't have other things to do...
AddExecutor(ExecutorType.Activate, CardId.SoulCharge, SoulChargeEffect);
AddExecutor(ExecutorType.Repos, Repos);
// summon White Stone to use the hand effect of Sage
AddExecutor(ExecutorType.Summon, CardId.WhiteStoneOfLegend, WhiteStoneSummonForSage);
AddExecutor(ExecutorType.Summon, CardId.WhiteStoneOfAncients, WhiteStoneSummonForSage);
AddExecutor(ExecutorType.Summon, CardId.SageWithEyesOfBlue, WhiteStoneSummonForSage);
AddExecutor(ExecutorType.Activate, CardId.SageWithEyesOfBlue, SageWithEyesOfBlueEffectInHand);
// set White Stone of Legend frist
AddExecutor(ExecutorType.MonsterSet, CardId.WhiteStoneOfLegend);
AddExecutor(ExecutorType.MonsterSet, CardId.WhiteStoneOfAncients);
AddExecutor(ExecutorType.SpellSet, SpellSet);
}
public override void OnNewTurn()
{
// reset
UsedAlternativeWhiteDragon.Clear();
UsedGalaxyEyesCipherDragon = null;
AlternativeWhiteDragonSummoned = false;
SoulChargeUsed = false;
}
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)
{
Logger.DebugWriteLine("OnSelectCard MelodyOfAwakeningDragon");
IList<ClientCard> result = new List<ClientCard>();
if (!Bot.HasInHand(CardId.WhiteDragon))
{
foreach (ClientCard card in cards)
{
if (card.Id == CardId.WhiteDragon)
{
result.Add(card);
break;
}
}
}
foreach (ClientCard card in cards)
{
if (card.Id == CardId.AlternativeWhiteDragon && result.Count < max)
{
result.Add(card);
}
}
AI.Utils.CheckSelectCount(result, cards, min, max);
return result;
}
Logger.DebugWriteLine("Use default.");
return null;
}
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("OnSelectSynchroMaterial " + cards.Count + " " + sum + " " + min + " " + max);
if (sum != 8)
return null;
foreach (ClientCard AlternativeWhiteDragon in UsedAlternativeWhiteDragon)
{
if (cards.IndexOf(AlternativeWhiteDragon) > 0)
{
UsedAlternativeWhiteDragon.Remove(AlternativeWhiteDragon);
Logger.DebugWriteLine("select UsedAlternativeWhiteDragon");
return new[] { AlternativeWhiteDragon };
}
}
return null;
}
private bool DragonShrineEffect()
{
AI.SelectCard(new[]
{
CardId.DragonSpiritOfWhite,
CardId.WhiteDragon,
CardId.WhiteStoneOfAncients,
CardId.WhiteStoneOfLegend
});
if (!Bot.HasInHand(CardId.WhiteDragon))
{
AI.SelectNextCard(CardId.WhiteStoneOfLegend);
}
else
{
AI.SelectNextCard(new[]
{
CardId.WhiteStoneOfAncients,
CardId.DragonSpiritOfWhite,
CardId.WhiteStoneOfLegend
});
}
return true;
}
private bool MelodyOfAwakeningDragonEffect()
{
AI.SelectCard(new[]
{
CardId.WhiteStoneOfAncients,
CardId.DragonSpiritOfWhite,
CardId.WhiteStoneOfLegend,
CardId.GalaxyCyclone,
CardId.EffectVeiler,
CardId.TradeIn,
CardId.SageWithEyesOfBlue
});
return true;
}
private bool CardsOfConsonanceEffect()
{
if (!Bot.HasInHand(CardId.WhiteDragon))
{
AI.SelectCard(CardId.WhiteStoneOfLegend);
}
else if (Bot.HasInHand(CardId.TradeIn))
{
AI.SelectCard(CardId.WhiteStoneOfLegend);
}
else
{
AI.SelectCard(CardId.WhiteStoneOfAncients);
}
return true;
}
private bool TradeInEffect()
{
if (Bot.HasInHand(CardId.DragonSpiritOfWhite))
{
AI.SelectCard(CardId.DragonSpiritOfWhite);
return true;
}
else if (HasTwoInHand(CardId.WhiteDragon))
{
AI.SelectCard(CardId.WhiteDragon);
return true;
}
else if (HasTwoInHand(CardId.AlternativeWhiteDragon))
{
AI.SelectCard(CardId.AlternativeWhiteDragon);
return true;
}
else if (!Bot.HasInHand(CardId.WhiteDragon) || !Bot.HasInHand(CardId.AlternativeWhiteDragon))
{
AI.SelectCard(new[]
{
CardId.WhiteDragon,
CardId.AlternativeWhiteDragon
});
return true;
}
else
{
return false;
}
}
private bool AlternativeWhiteDragonEffect()
{
ClientCard target = AI.Utils.GetProblematicEnemyMonster(Card.GetDefensePower());
if (target != null)
{
AI.SelectCard(target);
UsedAlternativeWhiteDragon.Add(Card);
return true;
}
if (CanDealWithUsedAlternativeWhiteDragon())
{
target = AI.Utils.GetBestEnemyMonster();
AI.SelectCard(target);
UsedAlternativeWhiteDragon.Add(Card);
return true;
}
return false;
}
private bool RebornEffect()
{
if (Duel.Player == 0 && Duel.CurrentChain.Count > 0)
{
// Silver's Cry spsummon Dragon Spirit at chain 2 will miss the timing
return false;
}
if (Duel.Player == 0 && (Duel.Phase == DuelPhase.Draw || Duel.Phase == DuelPhase.Standby))
{
// Let Azure-Eyes spsummon first
return false;
}
IList<int> targets = new[] {
CardId.HopeHarbingerDragonTitanicGalaxy,
CardId.GalaxyEyesDarkMatterDragon,
CardId.AlternativeWhiteDragon,
CardId.AzureEyesSilverDragon,
CardId.BlueEyesSpiritDragon,
CardId.WhiteDragon,
CardId.DragonSpiritOfWhite
};
if (!Bot.HasInGraveyard(targets))
{
return false;
}
ClientCard floodgate = Enemy.SpellZone.GetFloodgate();
if (floodgate != null && Bot.HasInGraveyard(CardId.DragonSpiritOfWhite))
{
AI.SelectCard(CardId.DragonSpiritOfWhite);
}
else
{
AI.SelectCard(targets);
}
return true;
}
private bool AzureEyesSilverDragonEffect()
{
if (Enemy.GetSpellCount() > 0)
{
AI.SelectCard(CardId.DragonSpiritOfWhite);
}
else
{
AI.SelectCard(CardId.WhiteDragon);
}
return true;
}
private bool SageWithEyesOfBlueSummon()
{
return !Bot.HasInHand(new[]
{
CardId.WhiteStoneOfAncients,
CardId.WhiteStoneOfLegend
});
}
private bool SageWithEyesOfBlueEffect()
{
if (Card.Location == CardLocation.Hand)
{
return false;
}
AI.SelectCard(new[]
{
CardId.WhiteStoneOfAncients,
CardId.EffectVeiler,
CardId.WhiteStoneOfLegend
});
return true;
}
private bool WhiteStoneSummonForSage()
{
return Bot.HasInHand(CardId.SageWithEyesOfBlue);
}
private bool SageWithEyesOfBlueEffectInHand()
{
if (Card.Location != CardLocation.Hand)
{
return false;
}
if (!Bot.HasInMonstersZone(new[]
{
CardId.WhiteStoneOfLegend,
CardId.WhiteStoneOfAncients
}) || Bot.HasInMonstersZone(new[]
{
CardId.AlternativeWhiteDragon,
CardId.WhiteDragon,
CardId.DragonSpiritOfWhite
}))
{
return false;
}
AI.SelectCard(new[]
{
CardId.WhiteStoneOfLegend,
CardId.WhiteStoneOfAncients
});
if (Enemy.GetSpellCount() > 0)
{
AI.SelectNextCard(CardId.DragonSpiritOfWhite);
}
else
{
AI.SelectNextCard(CardId.WhiteDragon);
}
return true;
}
private bool DragonSpiritOfWhiteEffect()
{
if (ActivateDescription == -1)
{
ClientCard target = AI.Utils.GetBestEnemySpell();
AI.SelectCard(target);
return true;
}
else if (HaveEnoughWhiteDragonInHand())
{
if (Duel.Player == 0 && Duel.Phase == DuelPhase.BattleStart)
{
return Card.Attacked;
}
if (Duel.Player == 1 && Duel.Phase == DuelPhase.End)
{
return Bot.HasInMonstersZone(CardId.AzureEyesSilverDragon, true)
&& !Bot.HasInGraveyard(CardId.DragonSpiritOfWhite)
&& !Bot.HasInGraveyard(CardId.WhiteDragon);
}
if (AI.Utils.IsChainTarget(Card))
{
return true;
}
}
return false;
}
private bool BlueEyesSpiritDragonEffect()
{
if (ActivateDescription == -1 || ActivateDescription == AI.Utils.GetStringId(CardId.BlueEyesSpiritDragon, 0))
{
return Duel.LastChainPlayer == 1;
}
else if (Duel.Player == 1 && (Duel.Phase == DuelPhase.BattleStart || Duel.Phase == DuelPhase.End))
{
AI.SelectCard(CardId.AzureEyesSilverDragon);
return true;
}
else
{
if (AI.Utils.IsChainTarget(Card))
{
AI.SelectCard(CardId.AzureEyesSilverDragon);
return true;
}
return false;
}
}
private bool HopeHarbingerDragonTitanicGalaxyEffect()
{
if (ActivateDescription == -1 || ActivateDescription == AI.Utils.GetStringId(CardId.HopeHarbingerDragonTitanicGalaxy, 0))
{
return Duel.LastChainPlayer == 1;
}
return true;
}
private bool WhiteStoneOfAncientsEffect()
{
if (ActivateDescription == AI.Utils.GetStringId(CardId.WhiteStoneOfAncients, 0))
{
if (Bot.HasInHand(CardId.TradeIn)
&& !Bot.HasInHand(CardId.WhiteDragon)
&& !Bot.HasInHand(CardId.AlternativeWhiteDragon))
{
AI.SelectCard(CardId.WhiteDragon);
return true;
}
if (AlternativeWhiteDragonSummoned)
{
return false;
}
if (Bot.HasInHand(CardId.WhiteDragon)
&& !Bot.HasInHand(CardId.AlternativeWhiteDragon)
&& Bot.HasInGraveyard(CardId.AlternativeWhiteDragon))
{
AI.SelectCard(CardId.AlternativeWhiteDragon);
return true;
}
if (Bot.HasInHand(CardId.AlternativeWhiteDragon)
&& !Bot.HasInHand(CardId.WhiteDragon)
&& Bot.HasInGraveyard(CardId.WhiteDragon))
{
AI.SelectCard(CardId.WhiteDragon);
return true;
}
return false;
}
else
{
if (Enemy.GetSpellCount() > 0)
{
AI.SelectCard(CardId.DragonSpiritOfWhite);
}
else
{
AI.SelectCard(CardId.WhiteDragon);
}
return true;
}
}
private bool AlternativeWhiteDragonSummon()
{
AlternativeWhiteDragonSummoned = true;
return true;
}
private bool WhiteStoneSummon()
{
return Bot.HasInMonstersZone(new[]
{
CardId.SageWithEyesOfBlue,
CardId.WhiteStoneOfAncients,
CardId.WhiteStoneOfLegend,
CardId.AlternativeWhiteDragon,
CardId.WhiteDragon,
CardId.DragonSpiritOfWhite
});
}
private bool GalaxyEyesCipherDragonSummon()
{
if (Duel.Turn == 1 || SoulChargeUsed)
{
return false;
}
List<ClientCard> monsters = Enemy.GetMonsters();
if (monsters.Count == 1 && !monsters[0].IsFacedown() && ((monsters[0].IsDefense() && monsters[0].GetDefensePower() >= 3000) && monsters[0].HasType(CardType.Xyz)))
{
return true;
}
if (monsters.Count >= 3)
{
foreach (ClientCard monster in monsters)
{
if (!monster.IsFacedown() && ((monster.IsDefense() && monster.GetDefensePower() >= 3000) || monster.HasType(CardType.Xyz)))
{
return true;
}
}
}
return false;
}
private bool GalaxyEyesPrimePhotonDragonSummon()
{
if (Duel.Turn == 1)
{
return false;
}
if (AI.Utils.IsOneEnemyBetterThanValue(2999, false))
{
return true;
}
return false;
}
private bool GalaxyEyesFullArmorPhotonDragonSummon()
{
if (Bot.HasInMonstersZone(CardId.GalaxyEyesCipherDragon))
{
foreach (ClientCard monster in Bot.GetMonsters())
{
if ((monster.IsDisabled() && monster.HasType(CardType.Xyz) && !monster.Equals(UsedGalaxyEyesCipherDragon))
|| (Duel.Phase == DuelPhase.Main2 && monster.Equals(UsedGalaxyEyesCipherDragon)))
{
AI.SelectCard(monster);
return true;
}
}
}
if (Bot.HasInMonstersZone(CardId.GalaxyEyesPrimePhotonDragon))
{
if (!AI.Utils.IsOneEnemyBetterThanValue(4000, false))
{
AI.SelectCard(CardId.GalaxyEyesPrimePhotonDragon);
return true;
}
}
return false;
}
private bool GalaxyEyesCipherBladeDragonSummon()
{
if (Bot.HasInMonstersZone(CardId.GalaxyEyesFullArmorPhotonDragon) && AI.Utils.GetProblematicEnemyCard() != null)
{
AI.SelectCard(CardId.GalaxyEyesFullArmorPhotonDragon);
return true;
}
return false;
}
private bool GalaxyEyesDarkMatterDragonSummon()
{
if (Bot.HasInMonstersZone(CardId.GalaxyEyesFullArmorPhotonDragon))
{
AI.SelectCard(CardId.GalaxyEyesFullArmorPhotonDragon);
return true;
}
return false;
}
private bool GalaxyEyesPrimePhotonDragonEffect()
{
return true;
}
private bool GalaxyEyesCipherDragonEffect()
{
List<ClientCard> monsters = Enemy.GetMonsters();
foreach (ClientCard monster in monsters)
{
if (monster.HasType(CardType.Xyz))
{
AI.SelectCard(monster);
UsedGalaxyEyesCipherDragon = Card;
return true;
}
}
foreach (ClientCard monster in monsters)
{
if (monster.IsDefense())
{
AI.SelectCard(monster);
UsedGalaxyEyesCipherDragon = Card;
return true;
}
}
UsedGalaxyEyesCipherDragon = Card;
return true;
}
private bool GalaxyEyesFullArmorPhotonDragonEffect()
{
ClientCard target = AI.Utils.GetProblematicEnemySpell();
if (target != null)
{
AI.SelectCard(target);
return true;
}
target = AI.Utils.GetProblematicEnemyMonster();
if (target != null)
{
AI.SelectCard(target);
return true;
}
foreach (ClientCard spell in Enemy.GetSpells())
{
if (spell.IsFaceup())
{
AI.SelectCard(spell);
return true;
}
}
List<ClientCard> monsters = Enemy.GetMonsters();
if (monsters.Count >= 2)
{
foreach (ClientCard monster in monsters)
{
if (monster.IsDefense())
{
AI.SelectCard(monster);
return true;
}
}
return true;
}
if (monsters.Count == 2)
{
foreach (ClientCard monster in monsters)
{
if (monster.IsMonsterInvincible() || monster.IsMonsterDangerous() || monster.GetDefensePower() > 4000)
{
AI.SelectCard(monster);
return true;
}
}
}
if (monsters.Count == 1)
{
return true;
}
return false;
}
private bool GalaxyEyesCipherBladeDragonEffect()
{
if (Card.Location == CardLocation.Grave)
{
return true;
}
ClientCard target = AI.Utils.GetProblematicEnemyCard();
if (target != null)
{
AI.SelectCard(target);
return true;
}
List<ClientCard> monsters = Enemy.GetMonsters();
foreach (ClientCard monster in monsters)
{
if (monster.IsDefense())
{
AI.SelectCard(monster);
return true;
}
}
foreach (ClientCard monster in monsters)
{
AI.SelectCard(monster);
return true;
}
List<ClientCard> spells = Enemy.GetSpells();
foreach (ClientCard spell in spells)
{
if (spell.IsFacedown())
{
AI.SelectCard(spell);
return true;
}
}
foreach (ClientCard spell in spells)
{
AI.SelectCard(spell);
return true;
}
return false;
}
private bool GalaxyEyesDarkMatterDragonEffect()
{
AI.SelectCard(new[]
{
CardId.WhiteStoneOfAncients,
CardId.WhiteStoneOfLegend,
CardId.DragonSpiritOfWhite,
CardId.WhiteDragon
});
AI.SelectNextCard(new[]
{
CardId.WhiteStoneOfAncients,
CardId.WhiteStoneOfLegend,
CardId.DragonSpiritOfWhite,
CardId.WhiteDragon
});
return true;
}
private bool GiganticastleSummon()
{
if (Duel.Phase != DuelPhase.Main1 || Duel.Turn == 1 || SoulChargeUsed)
return false;
int bestSelfAttack = AI.Utils.GetBestAttack(Bot);
int bestEnemyAttack = AI.Utils.GetBestPower(Enemy);
return bestSelfAttack <= bestEnemyAttack && bestEnemyAttack > 2500 && bestEnemyAttack <= 3100;
}
private bool BlueEyesSpiritDragonSummon()
{
if (Duel.Phase == DuelPhase.Main1)
{
if (UsedAlternativeWhiteDragon.Count > 0)
{
return true;
}
if (Duel.Turn == 1 || SoulChargeUsed)
{
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
}
}
if (Duel.Phase == DuelPhase.Main2)
{
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
}
return false;
}
private bool HopeHarbingerDragonTitanicGalaxySummon()
{
if (Duel.Phase == DuelPhase.Main1)
{
if (UsedAlternativeWhiteDragon.Count > 0)
{
return true;
}
if (Duel.Turn == 1 || SoulChargeUsed)
{
return true;
}
}
if (Duel.Phase == DuelPhase.Main2)
{
return true;
}
return false;
}
private bool SylvanPrincesspriteSummon()
{
if (Duel.Turn == 1)
{
return true;
}
if (Duel.Phase == DuelPhase.Main1 && !Bot.HasInMonstersZone(new[]
{
CardId.AlternativeWhiteDragon,
CardId.WhiteDragon,
CardId.DragonSpiritOfWhite
}))
{
return true;
}
if (Duel.Phase == DuelPhase.Main2 || SoulChargeUsed)
{
return true;
}
return false;
}
private bool SylvanPrincesspriteEffect()
{
AI.SelectCard(new[]
{
CardId.WhiteStoneOfLegend,
CardId.WhiteStoneOfAncients
});
return true;
}
private bool SoulChargeEffect()
{
if (Bot.HasInMonstersZone(CardId.BlueEyesSpiritDragon, true))
return false;
int count = Bot.GetGraveyardMonsters().Count;
int space = 5 - Bot.GetMonstersInMainZone().Count;
if (count < space)
count = space;
if (count < 2 || Bot.LifePoints < count*1000)
return false;
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 - defence > Enemy.LifePoints)
return false;
}
AI.SelectCard(new[]
{
CardId.BlueEyesSpiritDragon,
CardId.HopeHarbingerDragonTitanicGalaxy,
CardId.AlternativeWhiteDragon,
CardId.WhiteDragon,
CardId.DragonSpiritOfWhite,
CardId.AzureEyesSilverDragon,
CardId.WhiteStoneOfAncients,
CardId.WhiteStoneOfLegend
});
SoulChargeUsed = true;
return true;
}
private bool Repos()
{
bool enemyBetter = AI.Utils.IsAllEnemyBetter(true);
if (Card.IsAttack() && enemyBetter)
return true;
if (Card.IsFacedown())
return true;
if (Card.IsDefense() && !enemyBetter && Card.Attack >= Card.Defense)
return true;
if (Card.IsDefense() && (
Card.Id == CardId.BlueEyesSpiritDragon
|| Card.Id == CardId.AzureEyesSilverDragon
))
return true;
if (Card.IsAttack() && (
Card.Id == CardId.SageWithEyesOfBlue
|| Card.Id == CardId.WhiteStoneOfAncients
|| Card.Id == CardId.WhiteStoneOfLegend
))
return true;
return false;
}
private bool SpellSet()
{
return (Card.IsTrap() || (Card.Id==CardId.SilversCry)) && Bot.GetSpellCountWithoutField() < 4;
}
private bool HasTwoInHand(int id)
{
int num = 0;
foreach (ClientCard card in Bot.Hand)
{
if (card != null && card.Id == id)
num++;
}
return num >= 2;
}
private bool CanDealWithUsedAlternativeWhiteDragon()
{
return Bot.HasInMonstersZone(new[]
{
CardId.SageWithEyesOfBlue,
CardId.WhiteStoneOfAncients,
CardId.WhiteStoneOfLegend,
CardId.WhiteDragon,
CardId.DragonSpiritOfWhite
}) || Bot.GetCountCardInZone(Bot.MonsterZone, CardId.AlternativeWhiteDragon)>=2 ;
}
private bool HaveEnoughWhiteDragonInHand()
{
return HasTwoInHand(CardId.WhiteDragon) || (
Bot.HasInGraveyard(CardId.WhiteDragon)
&& Bot.HasInGraveyard(CardId.WhiteStoneOfAncients)
);
}
}
}
......@@ -90,7 +90,7 @@ namespace WindBot.Game.AI.Decks
private bool SupremacyBerry()
{
return Duel.LifePoints[0] < Duel.LifePoints[1];
return Bot.LifePoints < Enemy.LifePoints;
}
private bool PoisonOfTheOldMan()
......
......@@ -399,7 +399,7 @@ namespace WindBot.Game.AI.Decks
private bool CrystalWingSynchroDragonEffect()
{
return LastChainPlayer != 0;
return Duel.LastChainPlayer != 0;
}
private bool DragunityPhalanxSummon()
......
......@@ -162,7 +162,7 @@ namespace WindBot.Game.AI.Decks
private bool HorusTheBlackFlameDragonLv8()
{
return LastChainPlayer == 1;
return Duel.LastChainPlayer == 1;
}
private bool DragonsRebirth()
......
using YGOSharp.OCGWrapper.Enums;
using System.Collections.Generic;
using WindBot;
using WindBot.Game;
using WindBot.Game.AI;
namespace WindBot.Game.AI.Decks
{
// NOT FINISHED YET
[Deck("Lightsworn", "AI_Lightsworn", "NotFinished")]
public class LightswornExecutor : DefaultExecutor
{
public class CardId
{
public const int JudgmentDragon = 57774843;
public const int Wulf = 58996430;
public const int Garoth = 59019082;
public const int Raiden = 77558536;
public const int Lyla = 22624373;
public const int Felis = 73176465;
public const int Lumina = 95503687;
public const int Minerva = 40164421;
public const int Ryko = 21502796;
public const int PerformageTrickClown = 67696066;
public const int Goblindbergh = 25259669;
public const int ThousandBlades = 1833916;
public const int Honest = 37742478;
public const int GlowUpBulb = 67441435;
public const int SolarRecharge = 691925;
public const int GalaxyCyclone = 5133471;
public const int HarpiesFeatherDuster = 18144506;
public const int ReinforcementOfTheArmy = 32807846;
public const int MetalfoesFusion = 73594093;
public const int ChargeOfTheLightBrigade = 94886282;
public const int Michael = 4779823;
public const int MinervaTheExalted = 30100551;
public const int TrishulaDragonOfTheIceBarrier = 52687916;
public const int ScarlightRedDragonArchfiend = 80666118;
public const int PSYFramelordOmega = 74586817;
public const int PSYFramelordZeta = 37192109;
public const int NumberS39UtopiatheLightning = 56832966;
public const int Number39Utopia = 84013237;
public const int CastelTheSkyblasterMusketeer = 82633039;
public const int EvilswarmExcitonKnight = 46772449;
public const int DanteTravelerOfTheBurningAbyss = 83531441;
public const int DecodeTalker = 1861629;
public const int MissusRadiant = 3987233;
}
bool ClownUsed = false;
public LightswornExecutor(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.MetalfoesFusion);
AddExecutor(ExecutorType.Activate, CardId.GlowUpBulb);
AddExecutor(ExecutorType.Activate, CardId.JudgmentDragon, DefaultDarkHole);
AddExecutor(ExecutorType.SpSummon, CardId.JudgmentDragon);
AddExecutor(ExecutorType.Activate, CardId.ReinforcementOfTheArmy, ReinforcementOfTheArmyEffect);
AddExecutor(ExecutorType.Activate, CardId.ChargeOfTheLightBrigade, ChargeOfTheLightBrigadeEffect);
AddExecutor(ExecutorType.Activate, CardId.SolarRecharge, SolarRechargeEffect);
AddExecutor(ExecutorType.Summon, CardId.Goblindbergh, GoblindberghSummon);
AddExecutor(ExecutorType.Activate, CardId.Goblindbergh, GoblindberghEffect);
AddExecutor(ExecutorType.SpSummon, CardId.EvilswarmExcitonKnight, DefaultEvilswarmExcitonKnightSummon);
AddExecutor(ExecutorType.Activate, CardId.EvilswarmExcitonKnight, DefaultEvilswarmExcitonKnightEffect);
AddExecutor(ExecutorType.SpSummon, CardId.CastelTheSkyblasterMusketeer, DefaultCastelTheSkyblasterMusketeerSummon);
AddExecutor(ExecutorType.Activate, CardId.CastelTheSkyblasterMusketeer, DefaultCastelTheSkyblasterMusketeerEffect);
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.Activate, CardId.PerformageTrickClown, PerformageTrickClownEffect);
AddExecutor(ExecutorType.Activate, CardId.ThousandBlades);
AddExecutor(ExecutorType.Activate, CardId.Honest, HonestEffect);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
}
public override void OnNewTurn()
{
ClownUsed = false;
}
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
{
if (!defender.IsMonsterHasPreventActivationEffectInBattle())
{
if (attacker.Attribute == (int)CardAttribute.Light && Bot.HasInHand(CardId.Honest))
attacker.RealPower = attacker.RealPower + defender.Attack;
}
return base.OnPreBattleBetween(attacker, defender);
}
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>();
foreach (ClientCard card in cards)
{
if (!result.Contains(card) && (!ClownUsed || card.Id != CardId.PerformageTrickClown))
result.Add(card);
if (result.Count >= max)
break;
}
AI.Utils.CheckSelectCount(result, cards, min, max);
return result;
}
private bool ReinforcementOfTheArmyEffect()
{
if (!Bot.HasInHand(CardId.Raiden))
{
AI.SelectCard(CardId.Raiden);
return true;
}
else if (!Bot.HasInHand(CardId.Goblindbergh))
{
AI.SelectCard(CardId.Goblindbergh);
return true;
}
return false;
}
private bool ChargeOfTheLightBrigadeEffect()
{
if (!Bot.HasInHand(CardId.Lumina))
AI.SelectCard(CardId.Lumina);
else
AI.SelectCard(new[]
{
CardId.Raiden,
CardId.Lumina,
CardId.Minerva,
CardId.Lyla
});
return true;
}
private bool SolarRechargeEffect()
{
AI.SelectCard(new[]
{
CardId.Wulf,
CardId.Felis,
CardId.Minerva,
CardId.Lyla,
CardId.Raiden
});
return true;
}
private bool GoblindberghSummon()
{
foreach (ClientCard card in Bot.Hand.GetMonsters())
{
if (!card.Equals(Card) && card.Level == 4)
return true;
}
return false;
}
private bool GoblindberghEffect()
{
AI.SelectCard(new[]
{
CardId.Felis,
CardId.Wulf,
CardId.Raiden,
CardId.PerformageTrickClown,
CardId.ThousandBlades
});
return true;
}
private bool LuminaEffect()
{
if (!Bot.HasInGraveyard(CardId.Raiden) && Bot.HasInHand(CardId.Raiden))
{
AI.SelectCard(CardId.Raiden);
}
else if (!ClownUsed && Bot.HasInHand(CardId.PerformageTrickClown))
{
AI.SelectCard(CardId.PerformageTrickClown);
}
else
{
AI.SelectCard(new[] {
CardId.Wulf,
CardId.Felis,
CardId.Minerva,
CardId.ThousandBlades
});
}
AI.SelectNextCard(new[] {
CardId.Raiden,
CardId.Felis
});
return true;
}
private bool PerformageTrickClownEffect()
{
ClownUsed = true;
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
}
private bool MinervaTheExaltedEffect()
{
if (Card.Location == CardLocation.MonsterZone)
{
return true;
}
else
{
IList<ClientCard> targets = new List<ClientCard>();
ClientCard target1 = AI.Utils.GetBestEnemyMonster();
if (target1 != null)
targets.Add(target1);
ClientCard target2 = AI.Utils.GetBestEnemySpell();
if (target2 != null)
targets.Add(target2);
foreach (ClientCard target in Enemy.GetMonsters())
{
if (targets.Count >= 3)
break;
if (!targets.Contains(target))
targets.Add(target);
}
foreach (ClientCard target in Enemy.GetSpells())
{
if (targets.Count >= 3)
break;
if (!targets.Contains(target))
targets.Add(target);
}
if (targets.Count == 0)
return false;
AI.SelectNextCard(targets);
return true;
}
}
private bool HonestEffect()
{
return Duel.Phase != DuelPhase.Main1;
}
}
using YGOSharp.OCGWrapper.Enums;
using System.Collections.Generic;
using WindBot;
using WindBot.Game;
using WindBot.Game.AI;
namespace WindBot.Game.AI.Decks
{
// NOT FINISHED YET
[Deck("Lightsworn", "AI_Lightsworn", "NotFinished")]
public class LightswornExecutor : DefaultExecutor
{
public class CardId
{
public const int JudgmentDragon = 57774843;
public const int Wulf = 58996430;
public const int Garoth = 59019082;
public const int Raiden = 77558536;
public const int Lyla = 22624373;
public const int Felis = 73176465;
public const int Lumina = 95503687;
public const int Minerva = 40164421;
public const int Ryko = 21502796;
public const int PerformageTrickClown = 67696066;
public const int Goblindbergh = 25259669;
public const int ThousandBlades = 1833916;
public const int Honest = 37742478;
public const int GlowUpBulb = 67441435;
public const int SolarRecharge = 691925;
public const int GalaxyCyclone = 5133471;
public const int HarpiesFeatherDuster = 18144506;
public const int ReinforcementOfTheArmy = 32807846;
public const int MetalfoesFusion = 73594093;
public const int ChargeOfTheLightBrigade = 94886282;
public const int Michael = 4779823;
public const int MinervaTheExalted = 30100551;
public const int TrishulaDragonOfTheIceBarrier = 52687916;
public const int ScarlightRedDragonArchfiend = 80666118;
public const int PSYFramelordOmega = 74586817;
public const int PSYFramelordZeta = 37192109;
public const int NumberS39UtopiatheLightning = 56832966;
public const int Number39Utopia = 84013237;
public const int CastelTheSkyblasterMusketeer = 82633039;
public const int EvilswarmExcitonKnight = 46772449;
public const int DanteTravelerOfTheBurningAbyss = 83531441;
public const int DecodeTalker = 1861629;
public const int MissusRadiant = 3987233;
}
bool ClownUsed = false;
public LightswornExecutor(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.MetalfoesFusion);
AddExecutor(ExecutorType.Activate, CardId.GlowUpBulb);
AddExecutor(ExecutorType.Activate, CardId.JudgmentDragon, DefaultDarkHole);
AddExecutor(ExecutorType.SpSummon, CardId.JudgmentDragon);
AddExecutor(ExecutorType.Activate, CardId.ReinforcementOfTheArmy, ReinforcementOfTheArmyEffect);
AddExecutor(ExecutorType.Activate, CardId.ChargeOfTheLightBrigade, ChargeOfTheLightBrigadeEffect);
AddExecutor(ExecutorType.Activate, CardId.SolarRecharge, SolarRechargeEffect);
AddExecutor(ExecutorType.Summon, CardId.Goblindbergh, GoblindberghSummon);
AddExecutor(ExecutorType.Activate, CardId.Goblindbergh, GoblindberghEffect);
AddExecutor(ExecutorType.SpSummon, CardId.EvilswarmExcitonKnight, DefaultEvilswarmExcitonKnightSummon);
AddExecutor(ExecutorType.Activate, CardId.EvilswarmExcitonKnight, DefaultEvilswarmExcitonKnightEffect);
AddExecutor(ExecutorType.SpSummon, CardId.CastelTheSkyblasterMusketeer, DefaultCastelTheSkyblasterMusketeerSummon);
AddExecutor(ExecutorType.Activate, CardId.CastelTheSkyblasterMusketeer, DefaultCastelTheSkyblasterMusketeerEffect);
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, DefaultNumberS39UtopiaTheLightningEffect);
AddExecutor(ExecutorType.Activate, CardId.PerformageTrickClown, PerformageTrickClownEffect);
AddExecutor(ExecutorType.Activate, CardId.ThousandBlades);
AddExecutor(ExecutorType.Activate, CardId.Honest, DefaultHonestEffect);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
}
public override void OnNewTurn()
{
ClownUsed = false;
}
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
{
if (!defender.IsMonsterHasPreventActivationEffectInBattle())
{
if (attacker.Attribute == (int)CardAttribute.Light && Bot.HasInHand(CardId.Honest))
attacker.RealPower = attacker.RealPower + defender.Attack;
}
return base.OnPreBattleBetween(attacker, defender);
}
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>();
foreach (ClientCard card in cards)
{
if (!result.Contains(card) && (!ClownUsed || card.Id != CardId.PerformageTrickClown))
result.Add(card);
if (result.Count >= max)
break;
}
AI.Utils.CheckSelectCount(result, cards, min, max);
return result;
}
private bool ReinforcementOfTheArmyEffect()
{
if (!Bot.HasInHand(CardId.Raiden))
{
AI.SelectCard(CardId.Raiden);
return true;
}
else if (!Bot.HasInHand(CardId.Goblindbergh))
{
AI.SelectCard(CardId.Goblindbergh);
return true;
}
return false;
}
private bool ChargeOfTheLightBrigadeEffect()
{
if (!Bot.HasInHand(CardId.Lumina))
AI.SelectCard(CardId.Lumina);
else
AI.SelectCard(new[]
{
CardId.Raiden,
CardId.Lumina,
CardId.Minerva,
CardId.Lyla
});
return true;
}
private bool SolarRechargeEffect()
{
AI.SelectCard(new[]
{
CardId.Wulf,
CardId.Felis,
CardId.Minerva,
CardId.Lyla,
CardId.Raiden
});
return true;
}
private bool GoblindberghSummon()
{
foreach (ClientCard card in Bot.Hand.GetMonsters())
{
if (!card.Equals(Card) && card.Level == 4)
return true;
}
return false;
}
private bool GoblindberghEffect()
{
AI.SelectCard(new[]
{
CardId.Felis,
CardId.Wulf,
CardId.Raiden,
CardId.PerformageTrickClown,
CardId.ThousandBlades
});
return true;
}
private bool LuminaEffect()
{
if (!Bot.HasInGraveyard(CardId.Raiden) && Bot.HasInHand(CardId.Raiden))
{
AI.SelectCard(CardId.Raiden);
}
else if (!ClownUsed && Bot.HasInHand(CardId.PerformageTrickClown))
{
AI.SelectCard(CardId.PerformageTrickClown);
}
else
{
AI.SelectCard(new[] {
CardId.Wulf,
CardId.Felis,
CardId.Minerva,
CardId.ThousandBlades
});
}
AI.SelectNextCard(new[] {
CardId.Raiden,
CardId.Felis
});
return true;
}
private bool PerformageTrickClownEffect()
{
ClownUsed = true;
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
}
private bool MinervaTheExaltedEffect()
{
if (Card.Location == CardLocation.MonsterZone)
{
return true;
}
else
{
IList<ClientCard> targets = new List<ClientCard>();
ClientCard target1 = AI.Utils.GetBestEnemyMonster();
if (target1 != null)
targets.Add(target1);
ClientCard target2 = AI.Utils.GetBestEnemySpell();
if (target2 != null)
targets.Add(target2);
foreach (ClientCard target in Enemy.GetMonsters())
{
if (targets.Count >= 3)
break;
if (!targets.Contains(target))
targets.Add(target);
}
foreach (ClientCard target in Enemy.GetSpells())
{
if (targets.Count >= 3)
break;
if (!targets.Contains(target))
targets.Add(target);
}
if (targets.Count == 0)
return false;
AI.SelectNextCard(targets);
return true;
}
}
}
}
\ No newline at end of file
using YGOSharp.OCGWrapper.Enums;
using System.Collections.Generic;
using WindBot;
using WindBot.Game;
using WindBot.Game.AI;
namespace WindBot.Game.AI.Decks
{
// NOT FINISHED YET
[Deck("LightswornShaddoldinosour", "AI_LightswornShaddoldinosour", "ver0.1")]
public class LightswornShaddoldinosour : DefaultExecutor
{
public class CardId
{
//monster
public const int UltimateConductorTytanno = 18940556;
public const int DogorantheMadFlameKaiju = 93332803;
public const int GamecieltheSeaTurtleKaiju = 55063751;
public const int RadiantheMultidimensionalKaiju = 28674152;
public const int OvertexCoatls = 41782653;
public const int ShaddollBeast = 3717252;
public const int GiantRex = 80280944;
public const int ShaddollDragon = 77723643;
public const int FairyTailSnow = 55623480;
public const int KeeeperOfDragonicMagic = 48048590;
public const int ShaddollSquamata = 30328508;
public const int SouleatingOviraptor = 44335251;
public const int Raiden = 77558536;
public const int Lumina = 95503687;
public const int ShaddollHedgehog = 4939890;
public const int AshBlossom = 14558127;
public const int GhostOgre = 59438930;
public const int ShaddollFalco = 37445295;
public const int MaxxC = 23434538;
public const int PlaguespreaderZombie = 33420078;
public const int GlowUpBulb = 67441435;
//spell
public const int AllureofDarkness = 1475311;
public const int ThatGrassLooksgreener = 11110587;
public const int HarpiesFeatherDuster = 18144506;
public const int DoubleEvolutionPill = 38179121;
public const int ShaddollFusion = 44394295;
public const int PotOfAvarice = 67169026;
public const int FoolishBurial = 81439173;
public const int MonsterReborn = 83764718;
public const int ChargeOfTheLightBrigade = 94886282;
public const int InterruptedKaijuSlumber = 99330325;
public const int ElShaddollFusion = 6417578;
//trap
public const int infiniteTransience = 10045474;
public const int LostWind = 74003290;
public const int SinisterShadowGames = 77505534;
public const int ShaddollCore = 4904633;
//extra
public const int ElShaddollShekhinaga = 74822425;
public const int ElShaddollConstruct = 20366274;
public const int ElShaddollGrysra = 48424886;
public const int ElShaddollWinda = 94977269;
public const int CrystalWingSynchroDragon = 50954680;
public const int ScarlightRedDragon = 80666118;
public const int Michael = 4779823;
public const int BlackRoseMoonlightDragon = 33698022;
public const int RedWyvern = 76547525;
public const int CoralDragon = 42566602;
public const int TG_WonderMagician = 98558751;
public const int MinervaTheExalte = 30100551;
public const int Sdulldeat = 74997493;
public const int CrystronNeedlefiber = 50588353;
}
bool Pillused = false;
public LightswornShaddoldinosour(GameAI ai, Duel duel)
: base(ai, duel)
{
//counter
AddExecutor(ExecutorType.Activate, CardId.GhostOgre, Hand_act_eff);
AddExecutor(ExecutorType.Activate, CardId.AshBlossom, Hand_act_eff);
AddExecutor(ExecutorType.Activate, CardId.MaxxC,MaxxC);
//first do
AddExecutor(ExecutorType.Activate, CardId.HarpiesFeatherDuster, DefaultHarpiesFeatherDusterFirst);
AddExecutor(ExecutorType.Activate, CardId.infiniteTransience, infiniteTransience);
AddExecutor(ExecutorType.Activate, CardId.ThatGrassLooksgreener);
AddExecutor(ExecutorType.Summon, CardId.SouleatingOviraptor);
AddExecutor(ExecutorType.Activate, CardId.SouleatingOviraptor, SouleatingOviraptor);
AddExecutor(ExecutorType.Activate, CardId.AllureofDarkness, AllureofDarkness);
AddExecutor(ExecutorType.Activate, CardId.PotOfAvarice, PotofAvarice);
// AddExecutor(ExecutorType.Activate, CardId.HarpiesFeatherDuster);
AddExecutor(ExecutorType.Activate, CardId.ChargeOfTheLightBrigade, ChargeOfTheLightBrigadeEffect);
AddExecutor(ExecutorType.Activate, CardId.FoolishBurial, FoolishBurialEffect);
AddExecutor(ExecutorType.Activate, CardId.InterruptedKaijuSlumber, DefaultInterruptedKaijuSlumber);
AddExecutor(ExecutorType.Activate, CardId.ShaddollFusion, ShaddollFusion);
//Reborn
AddExecutor(ExecutorType.Activate, CardId.MonsterReborn, RebornEffect);
//Normal Summon
AddExecutor(ExecutorType.Summon, CardId.Raiden);
AddExecutor(ExecutorType.Activate, CardId.Raiden);
AddExecutor(ExecutorType.Summon , CardId.KeeeperOfDragonicMagic);
AddExecutor(ExecutorType.Activate, CardId.KeeeperOfDragonicMagic, KeeeperOfDragonicMagic);
AddExecutor(ExecutorType.MonsterSet, CardId.ShaddollSquamata);
AddExecutor(ExecutorType.MonsterSet, CardId.GlowUpBulb);
AddExecutor(ExecutorType.MonsterSet, CardId.ShaddollHedgehog);
AddExecutor(ExecutorType.MonsterSet, CardId.ShaddollDragon);
AddExecutor(ExecutorType.Summon, CardId.FairyTailSnow,FairyTailSnow);
AddExecutor(ExecutorType.Activate, CardId.FairyTailSnow, FairyTailSnow);
AddExecutor(ExecutorType.Summon, CardId.Lumina);
AddExecutor(ExecutorType.Activate, CardId.Lumina);
//Sp Summon
AddExecutor(ExecutorType.SpSummon, CardId.UltimateConductorTytanno, UltimateConductorTytannosp);
AddExecutor(ExecutorType.Activate, CardId.UltimateConductorTytanno, UltimateConductorTytanno);
AddExecutor(ExecutorType.Activate, CardId.DoubleEvolutionPill, DoubleEvolutionPill);
AddExecutor(ExecutorType.SpSummon, CardId.MinervaTheExalte);
AddExecutor(ExecutorType.Activate, CardId.MinervaTheExalte, MinervaTheExaltedEffect);
//activate
AddExecutor(ExecutorType.Activate , CardId.GlowUpBulb,GlowUpBulb);
//activate chain
AddExecutor(ExecutorType.Activate, CardId.OvertexCoatls);
AddExecutor(ExecutorType.Activate, CardId.ShaddollBeast);
AddExecutor(ExecutorType.Activate, CardId.ShaddollFalco, ShaddollFalco);
AddExecutor(ExecutorType.Activate, CardId.ShaddollSquamata, ShaddollSquamata);
AddExecutor(ExecutorType.Activate, CardId.ShaddollDragon);
AddExecutor(ExecutorType.Activate, CardId.ShaddollHedgehog);
AddExecutor(ExecutorType.Activate, CardId.GiantRex);
AddExecutor(ExecutorType.Activate, CardId.ElShaddollConstruct);
AddExecutor(ExecutorType.Activate, CardId.ElShaddollGrysra);
AddExecutor(ExecutorType.Activate, CardId.ElShaddollShekhinaga);
AddExecutor(ExecutorType.Activate, CardId.ElShaddollWinda);
AddExecutor(ExecutorType.Activate, CardId.TG_WonderMagician);
//spellset
AddExecutor(ExecutorType.SpellSet, CardId.MonsterReborn, spellset);
AddExecutor(ExecutorType.SpellSet, CardId.PotOfAvarice, spellset);
AddExecutor(ExecutorType.SpellSet, CardId.ThatGrassLooksgreener, spellset);
//trap
AddExecutor(ExecutorType.SpellSet, CardId.LostWind, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.SinisterShadowGames, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.ShaddollCore);
AddExecutor(ExecutorType.SpellSet, CardId.infiniteTransience, SetIsFieldEmpty);
//trap activate
AddExecutor(ExecutorType.Activate, CardId.LostWind, DefaultBreakthroughSkill);
AddExecutor(ExecutorType.Activate, CardId.SinisterShadowGames, SinisterShadowGames);
AddExecutor(ExecutorType.Activate, CardId.ShaddollCore, ShaddollCoreeff);
AddExecutor(ExecutorType.Repos, MonsterRepos);
}
public int[] all_List()
{
return new[]
{
CardId.UltimateConductorTytanno,
CardId.DogorantheMadFlameKaiju,
CardId.GamecieltheSeaTurtleKaiju,
CardId.RadiantheMultidimensionalKaiju,
CardId.OvertexCoatls,
CardId.ShaddollBeast,
CardId.GiantRex,
CardId.ShaddollDragon,
CardId.FairyTailSnow,
CardId.KeeeperOfDragonicMagic,
CardId.ShaddollSquamata,
CardId.SouleatingOviraptor,
CardId.Raiden,
CardId.Lumina,
CardId.ShaddollHedgehog,
CardId.AshBlossom,
CardId.GhostOgre,
CardId.ShaddollFalco,
CardId.MaxxC,
CardId.PlaguespreaderZombie,
CardId.GlowUpBulb,
CardId.AllureofDarkness,
CardId.ThatGrassLooksgreener,
CardId.HarpiesFeatherDuster,
CardId.DoubleEvolutionPill,
CardId.ShaddollFusion,
CardId.PotOfAvarice,
CardId.FoolishBurial,
CardId.MonsterReborn,
CardId.ChargeOfTheLightBrigade,
CardId.InterruptedKaijuSlumber,
CardId.ElShaddollFusion,
CardId.infiniteTransience,
CardId.LostWind,
CardId.SinisterShadowGames,
CardId.ShaddollCore,
};
}
public int[] Useless_List()
{
return new[]
{
CardId.GlowUpBulb,
CardId.PlaguespreaderZombie,
CardId.InterruptedKaijuSlumber,
CardId.ChargeOfTheLightBrigade,
CardId.FoolishBurial,
CardId.HarpiesFeatherDuster,
CardId.ThatGrassLooksgreener,
CardId.FairyTailSnow,
CardId.GiantRex,
CardId.Lumina,
CardId.OvertexCoatls,
};
}
private bool UltimateConductorTytanno()
{
AI.SelectCard(new[]
{
CardId.OvertexCoatls,
CardId.ShaddollBeast,
CardId.ShaddollSquamata,
CardId.ShaddollHedgehog,
CardId.ShaddollDragon,
CardId.GlowUpBulb,
CardId.PlaguespreaderZombie,
CardId.FairyTailSnow,
});
return true;
}
private bool UltimateConductorTytannosp()
{
Pillused = true;
foreach (ClientCard card in Bot.GetMonsters())
{
if (card.Id == Card.Id && card.IsFaceup())
return false;
}
return true;
}
private bool KeeeperOfDragonicMagic()
{
AI.SelectCard(Useless_List());
return true;
}
private bool MonsterRepos()
{
if (Card.Id == CardId.ElShaddollConstruct && Card.IsAttack())
return false;
return base.DefaultMonsterRepos();
}
public override void OnNewTurn()
{
Pillused = false;
}
private bool ShaddollCoreeff()
{
if (Card.Location == CardLocation.SpellZone)
{
if(Enemy.HasAttackingMonster())
{
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
}
return false;
}
return true;
}
private bool FairyTailSnow()
{
if (Card.Location == CardLocation.MonsterZone)
{
return true;
}
return false;
}
private bool SouleatingOviraptor()
{
AI.SelectCard(CardId.OvertexCoatls);
AI.SelectYesNo(false);
return true;
}
private bool GlowUpBulb()
{
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
}
private bool ShaddollFusion()
{
if (Enemy.GetMonstersExtraZoneCount() != 0)
{
IList<ClientCard> materials0 = Bot.Deck;
IList<ClientCard> materials1 = Bot.Deck;
IList<ClientCard> mats = new List<ClientCard>();
ClientCard mat = null;
foreach (ClientCard card in materials0)
{
if (card.HasAttribute(CardAttribute.Light))
{
mat = card;
break;
}
}
foreach (ClientCard card in materials1)
{
AI.SelectCard(new[]
{
CardId.ShaddollBeast,
CardId.ShaddollSquamata,
CardId.ShaddollHedgehog,
CardId.ShaddollDragon,
CardId.ShaddollFalco,
});
}
if (mat != null)
{
mats.Add(mat);
AI.SelectMaterials(mats);
AI.SelectCard(CardId.ElShaddollConstruct);
AI.SelectPosition(CardPosition.FaceUpAttack);
return true;
}
foreach (ClientCard card in materials0)
{
if (card.HasAttribute(CardAttribute.Earth))
{
mat = card;
break;
}
}
foreach (ClientCard card in materials1)
{
AI.SelectCard(new[]
{
CardId.ShaddollBeast,
CardId.ShaddollSquamata,
CardId.ShaddollHedgehog,
CardId.ShaddollDragon,
CardId.ShaddollFalco,
});
}
if (mat != null)
{
mats.Add(mat);
AI.SelectMaterials(mats);
AI.SelectCard(CardId.ElShaddollShekhinaga);
AI.SelectPosition(CardPosition.FaceUpAttack);
return true;
}
foreach (ClientCard card in materials0)
{
if (card.HasAttribute(CardAttribute.Fire))
{
mat = card;
break;
}
}
foreach (ClientCard card in materials1)
{
AI.SelectCard(new[]
{
CardId.ShaddollBeast,
CardId.ShaddollSquamata,
CardId.ShaddollHedgehog,
CardId.ShaddollDragon,
CardId.ShaddollFalco,
});
}
if (mat != null)
{
mats.Add(mat);
AI.SelectMaterials(mats);
AI.SelectCard(CardId.ElShaddollGrysra);
AI.SelectPosition(CardPosition.FaceUpAttack);
return true;
}
foreach (ClientCard card in materials0)
{
if (card.HasAttribute(CardAttribute.Dark))
{
mat = card;
break;
}
}
foreach (ClientCard card in materials1)
{
AI.SelectCard(new[]
{
CardId.ShaddollBeast,
CardId.ShaddollSquamata,
CardId.ShaddollHedgehog,
CardId.ShaddollDragon,
CardId.ShaddollFalco,
});
}
if (mat != null)
{
mats.Add(mat);
AI.SelectMaterials(mats);
AI.SelectCard(CardId.ElShaddollWinda);
AI.SelectPosition(CardPosition.FaceUpAttack);
return true;
}
}
else
{
if (!Bot.IsFieldEmpty())
return false;
AI.SelectCard(CardId.ElShaddollConstruct);
AI.SelectPosition(CardPosition.FaceUpAttack);
}
return true;
}
/* private ClientCard GetAleisterInGrave()
{
foreach (ClientCard card in Enemy.Graveyard)
{
if (card.Id == CardId.AleisterTheInvoker)
{
return card;
}
}
foreach (ClientCard card in Bot.Graveyard)
{
if (card.Id == CardId.AleisterTheInvoker)
{
return card;
}
}
return null;
}*/
private bool DoubleEvolutionPill()
{
if (Pillused == true)return false;
Pillused = true;
if (Bot.HasInGraveyard(CardId.UltimateConductorTytanno) )
{
AI.SelectCard(CardId.UltimateConductorTytanno);
}
AI.SelectThirdCard(new[] {
CardId.UltimateConductorTytanno,
});
return Enemy.GetMonsterCount()>=1;
}
private bool ShaddollCore()
{
return Bot.HasInGraveyard(CardId.ShaddollFusion);
}
private bool AllureofDarkness()
{
IList<ClientCard> materials = Bot.Hand;
IList<ClientCard> check = new List<ClientCard>();
ClientCard mat = null;
foreach (ClientCard card in materials)
{
if (card.HasAttribute(CardAttribute.Dark))
{
mat = card;
break;
}
}
if (mat != null)
{
return true;
}
return false;
}
private bool spellset()
{
return Bot.Hand.Count > 6;
}
private bool RebornEffect()
{
IList<int> targets = new[] {
CardId.UltimateConductorTytanno,
CardId.ElShaddollConstruct,
CardId.DogorantheMadFlameKaiju,
CardId.GamecieltheSeaTurtleKaiju,
CardId.SouleatingOviraptor,
};
if (!Bot.HasInGraveyard(targets))
{
return false;
}
AI.SelectCard(targets);
return true;
}
private bool PotofAvarice()
{
return true;
}
private bool infiniteTransience()
{
return Duel.LastChainPlayer == 1;
}
private bool MaxxC()
{
return Duel.Player == 1;
}
private bool SetIsFieldEmpty()
{
return !Bot.IsFieldEmpty();
}
private bool TrapSetWhenZoneFree()
{
return Bot.GetSpellCountWithoutField() < 4;
}
private bool ChargeOfTheLightBrigadeEffect()
{
if (!Bot.HasInHand(CardId.Raiden))
AI.SelectCard(CardId.Raiden);
else
AI.SelectCard(new[]
{
CardId.Lumina,
});
return true;
}
private bool SinisterShadowGames()
{
if (Card.Location != CardLocation.MonsterZone)
return true;
else
{
AI.SelectCard(new[]
{
CardId.ShaddollBeast,
CardId.ShaddollCore,
}
);
}
return true;
}
private bool ShaddollFalco()
{
if (Card.Location != CardLocation.MonsterZone)
return true;
else
{
AI.SelectCard(new[]
{
CardId.ElShaddollConstruct,
CardId.ElShaddollShekhinaga,
CardId.ElShaddollGrysra,
CardId.ElShaddollWinda,
CardId.ShaddollSquamata,
}
);
}
return true;
}
private bool ShaddollSquamata()
{
AI.SelectCard(new[]
{
CardId.ShaddollBeast,
}
);
return true;
}
private bool FoolishBurialEffect()
{
AI.SelectCard(new[]
{
CardId.OvertexCoatls,
CardId.ShaddollSquamata,
CardId.ShaddollBeast,
CardId.ShaddollCore,
CardId.ShaddollHedgehog,
CardId.ShaddollFalco,
CardId.ShaddollDragon,
CardId.FairyTailSnow,
});
return true;
}
private bool GoblindberghSummon()
{
foreach (ClientCard card in Bot.Hand.GetMonsters())
{
if (!card.Equals(Card) && card.Level == 4)
return true;
}
return false;
}
private bool PerformageTrickClownEffect()
{
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
}
public bool Hand_act_eff()
{
//if (Card.Id == CardId.Urara && Bot.HasInHand(CardId.LockBird) && Bot.HasInSpellZone(CardId.Re)) return false;
if (Card.Id == CardId.GhostOgre && Card.Location == CardLocation.Hand && Bot.HasInMonstersZone(CardId.GhostOgre)) return false;
return (Duel.LastChainPlayer == 1);
}
private bool MinervaTheExaltedEffect()
{
if (Card.Location == CardLocation.MonsterZone)
{
return true;
}
else
{
IList<ClientCard> targets = new List<ClientCard>();
ClientCard target1 = AI.Utils.GetBestEnemyMonster();
if (target1 != null)
targets.Add(target1);
ClientCard target2 = AI.Utils.GetBestEnemySpell();
if (target2 != null)
targets.Add(target2);
foreach (ClientCard target in Enemy.GetMonsters())
{
if (targets.Count >= 3)
break;
if (!targets.Contains(target))
targets.Add(target);
}
foreach (ClientCard target in Enemy.GetSpells())
{
if (targets.Count >= 3)
break;
if (!targets.Contains(target))
targets.Add(target);
}
if (targets.Count == 0)
return false;
AI.SelectNextCard(targets);
return true;
}
}
private bool HonestEffect()
{
return Duel.Phase != DuelPhase.Main1;
}
}
}
\ No newline at end of file
......@@ -161,7 +161,7 @@ namespace WindBot.Game.AI.Decks
private bool SkillDrainEffect()
{
return (Duel.LifePoints[0] > 1000) && DefaultUniqueTrap();
return (Bot.LifePoints > 1000) && DefaultUniqueTrap();
}
private bool PotOfDualityEffect()
......@@ -315,7 +315,7 @@ namespace WindBot.Game.AI.Decks
{
AI.SelectCard(HighScaleCards);
}
return Duel.LifePoints[0] > 800;
return Bot.LifePoints > 800;
}
private bool StealthEffect()
......
......@@ -107,7 +107,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.SpSummon, CardId.Number39Utopia, DefaultNumberS39UtopiaTheLightningSummon);
AddExecutor(ExecutorType.SpSummon, CardId.NumberS39UtopiatheLightning);
AddExecutor(ExecutorType.Activate, CardId.NumberS39UtopiatheLightning);
AddExecutor(ExecutorType.Activate, CardId.NumberS39UtopiatheLightning, DefaultNumberS39UtopiaTheLightningEffect);
AddExecutor(ExecutorType.SpSummon, CardId.StardustDragon, DefaultStardustDragonSummon);
AddExecutor(ExecutorType.Activate, CardId.StardustDragon, DefaultStardustDragonEffect);
......@@ -267,7 +267,7 @@ namespace WindBot.Game.AI.Decks
private bool GagagaCowboySummon()
{
if (Duel.LifePoints[1] <= 800)
if (Enemy.LifePoints <= 800)
{
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
......
......@@ -262,9 +262,9 @@ namespace WindBot.Game.AI.Decks
private bool CyberDragonInfinityEffect()
{
if (CurrentChain.Count > 0)
if (Duel.CurrentChain.Count > 0)
{
return LastChainPlayer == 1;
return Duel.LastChainPlayer == 1;
}
else
{
......
......@@ -117,7 +117,7 @@ namespace WindBot.Game.AI.Decks
if (!defender.IsMonsterHasPreventActivationEffectInBattle())
{
if (attacker.Id == CardId.SkyCavalryCentaurea && !attacker.IsDisabled() && attacker.HasXyzMaterial())
attacker.RealPower = Duel.LifePoints[0] + attacker.Attack;
attacker.RealPower = Bot.LifePoints + attacker.Attack;
}
return base.OnPreBattleBetween(attacker, defender);
}
......@@ -302,7 +302,7 @@ namespace WindBot.Game.AI.Decks
private bool ToadallyAwesomeEffect()
{
if (CurrentChain.Count > 0)
if (Duel.CurrentChain.Count > 0)
{
// negate effect, select a cost for it
List<ClientCard> monsters = Bot.GetMonsters();
......@@ -506,7 +506,7 @@ namespace WindBot.Game.AI.Decks
{
defence += monster.GetDefensePower();
}
if (attack - 2000 - defence > Duel.LifePoints[1] && !AI.Utils.IsOneEnemyBetter(true))
if (attack - 2000 - defence > Enemy.LifePoints && !AI.Utils.IsOneEnemyBetter(true))
return true;
}
return false;
......
......@@ -249,9 +249,9 @@ namespace WindBot.Game.AI.Decks
ClientCard tosolve = AI.Utils.GetProblematicEnemyCard();
if (tosolve == null)
{
if (LastChainPlayer == 1 && GetLastChainCard() != null)
if (Duel.LastChainPlayer == 1 && AI.Utils.GetLastChainCard() != null)
{
ClientCard target = GetLastChainCard();
ClientCard target = AI.Utils.GetLastChainCard();
if (target.HasPosition(CardPosition.FaceUp) && (target.Location == CardLocation.MonsterZone || target.Location == CardLocation.SpellZone)) tosolve = target;
}
}
......@@ -337,7 +337,7 @@ namespace WindBot.Game.AI.Decks
{
if (Duel.Player == 0) return false;
if (Duel.Phase == DuelPhase.End) return true;
if (LastChainPlayer == 1 && (AI.Utils.IsChainTarget(Card) || (GetLastChainCard().Id == CardId.Feather && !Bot.HasInSpellZone(CardId.Grass)))) return true;
if (Duel.LastChainPlayer == 1 && (AI.Utils.IsChainTarget(Card) || (AI.Utils.GetLastChainCard().Id == CardId.Feather && !Bot.HasInSpellZone(CardId.Grass)))) return true;
if (Duel.Phase == DuelPhase.BattleStart)
{
int total_atk = 0;
......@@ -346,7 +346,7 @@ namespace WindBot.Game.AI.Decks
{
if (m.IsAttack() && !m.Attacked) total_atk += m.Attack;
}
if (total_atk >= Duel.LifePoints[0]) return true;
if (total_atk >= Bot.LifePoints) return true;
}
return false;
}
......@@ -369,7 +369,7 @@ namespace WindBot.Game.AI.Decks
stage_locked = null;
return true;
}
else if (Duel.LifePoints[1] <= 1000 && Bot.GetRemainingCount(CardId.Pink,1) > 0)
else if (Enemy.LifePoints <= 1000 && Bot.GetRemainingCount(CardId.Pink,1) > 0)
{
AI.SelectCard(new[]
{
......@@ -423,7 +423,7 @@ namespace WindBot.Game.AI.Decks
if (NormalSummoned)
{
if (Duel.LifePoints[1] <= 1000 && !pink_ss && Bot.GetRemainingCount(CardId.Pink,1) > 0)
if (Enemy.LifePoints <= 1000 && !pink_ss && Bot.GetRemainingCount(CardId.Pink,1) > 0)
{
AI.SelectCard(new[]
{
......@@ -483,12 +483,12 @@ namespace WindBot.Game.AI.Decks
if (GraveCall_count > 0 && GraveCall_id == Card.Id) return false;
if (Card.Id == CardId.Urara && Bot.HasInHand(CardId.LockBird) && Bot.HasInSpellZone(CardId.Re)) return false;
if (Card.Id == CardId.Ghost && Card.Location == CardLocation.Hand && Bot.HasInMonstersZone(CardId.Ghost)) return false;
return (LastChainPlayer == 1);
return (Duel.LastChainPlayer == 1);
}
public bool Exterio_counter()
{
if (LastChainPlayer == 1)
if (Duel.LastChainPlayer == 1)
{
AI.SelectCard(Useless_List());
return true;
......@@ -505,15 +505,15 @@ namespace WindBot.Game.AI.Decks
{
if (Card.Location == CardLocation.Hand)
{
if ((Duel.LifePoints[1] <= 1000 && Bot.HasInSpellZone(CardId.Stage))
|| Duel.LifePoints[1] <= 800
if ((Enemy.LifePoints <= 1000 && Bot.HasInSpellZone(CardId.Stage))
|| Enemy.LifePoints <= 800
|| (!NormalSummoned && Bot.HasInGraveyard(CardId.Red))
)
{
pink_ss = true;
return true;
}
else if (Enemy.GetMonsterCount() > 0 && (AI.Utils.GetBestEnemyMonster().Attack - 800 >= Duel.LifePoints[0])) return false;
else if (Enemy.GetMonsterCount() > 0 && (AI.Utils.GetBestEnemyMonster().Attack - 800 >= Bot.LifePoints)) return false;
pink_ss = true;
return true;
}
......@@ -580,19 +580,16 @@ namespace WindBot.Game.AI.Decks
public bool Eater_eff()
{
ClientCard self_card = (Duel.Player == 0) ? AI.GetAttacker() : AI.GetDefender();
ClientCard enemy_card = (Duel.Player == 1) ? AI.GetAttacker() : AI.GetDefender();
if (self_card == null || enemy_card == null) return false;
if (enemy_card.HasPosition(CardPosition.FaceDown)) return true;
if (enemy_card.HasPosition(CardPosition.Attack) && (self_card.Attack - enemy_card.GetDefensePower() >= Duel.LifePoints[1])) return true;
return (self_card.Attack <= (enemy_card.GetDefensePower() * 2));
if (Enemy.BattlingMonster.HasPosition(CardPosition.FaceDown)) return true;
if (Enemy.BattlingMonster.HasPosition(CardPosition.Attack) && (Bot.BattlingMonster.Attack - Enemy.BattlingMonster.GetDefensePower() >= Enemy.LifePoints)) return true;
return (Bot.BattlingMonster.Attack <= (Enemy.BattlingMonster.GetDefensePower() * 2));
}
public bool Red_ss()
{
if (red_ss_count >= 6) return false;
if ((ChainContainsCard(CardId.DarkHole) || ChainContainsCard(99330325) || ChainContainsCard(53582587)) && ChainContainsCard(CardId.Red)) return false;
if (LastChainPlayer == 0 && GetLastChainCard().Id == CardId.Red)
if ((AI.Utils.ChainContainsCard(CardId.DarkHole) || AI.Utils.ChainContainsCard(99330325) || AI.Utils.ChainContainsCard(53582587)) && AI.Utils.ChainContainsCard(CardId.Red)) return false;
if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard().Id == CardId.Red)
{
foreach (ClientCard m in Bot.GetMonsters())
{
......@@ -604,7 +601,7 @@ namespace WindBot.Game.AI.Decks
}
}
}
if (LastChainPlayer == 1) return true;
if (Duel.LastChainPlayer == 1) return true;
if (Duel.Player == 0)
{
if (AI.Utils.IsTurn1OrMain2()) return false;
......@@ -695,7 +692,7 @@ namespace WindBot.Game.AI.Decks
});
return true;
}
if (Duel.LifePoints[1] <= 1000)
if (Enemy.LifePoints <= 1000)
{
if (Bot.GetRemainingCount(CardId.Pink, 1) > 0 && !pink_ss)
{
......@@ -754,7 +751,7 @@ namespace WindBot.Game.AI.Decks
CardId.Yellow
});
}
else if (Bot.GetRemainingCount(CardId.White, 2) > 0 && Duel.LifePoints[1] <= 4000)
else if (Bot.GetRemainingCount(CardId.White, 2) > 0 && Enemy.LifePoints <= 4000)
{
AI.SelectCard(new[]
{
......@@ -875,10 +872,8 @@ namespace WindBot.Game.AI.Decks
return true;
}
*/
ClientCard self_monster = (Duel.Player == 0) ? AI.GetAttacker() : AI.GetDefender();
ClientCard enemy_monster = (Duel.Player == 1) ? AI.GetAttacker() : AI.GetDefender();
if (self_monster == null || enemy_monster == null || !IsTrickstar(self_monster.Id) || self_monster.HasPosition(CardPosition.Defence)) return false;
if (self_monster.Attack <= enemy_monster.RealPower && self_monster.Attack + self_monster.BaseAttack >= enemy_monster.RealPower)
if (Bot.BattlingMonster == null || Enemy.BattlingMonster == null || !IsTrickstar(Bot.BattlingMonster.Id) || Bot.BattlingMonster.HasPosition(CardPosition.Defence)) return false;
if (Bot.BattlingMonster.Attack <= Enemy.BattlingMonster.RealPower && Bot.BattlingMonster.Attack + Bot.BattlingMonster.BaseAttack >= Enemy.BattlingMonster.RealPower)
{
white_eff_used = true;
return true;
......@@ -934,8 +929,8 @@ namespace WindBot.Game.AI.Decks
lockbird_useful = true;
if (Bot.HasInSpellZone(CardId.Re))
{
if (ChainContainsCard(CardId.Re)) lockbird_used = true;
return ChainContainsCard(CardId.Re);
if (AI.Utils.ChainContainsCard(CardId.Re)) lockbird_used = true;
return AI.Utils.ChainContainsCard(CardId.Re);
}
lockbird_used = true;
return true;
......@@ -946,7 +941,7 @@ namespace WindBot.Game.AI.Decks
if (Card.Location == CardLocation.Grave) return Ts_reborn();
if (Bot.HasInHand(CardId.LockBird))
{
if (lockbird_useful || AI.Utils.IsChainTarget(Card) || (Duel.Player == 1 && ChainContainsCard(CardId.Feather))) {
if (lockbird_useful || AI.Utils.IsChainTarget(Card) || (Duel.Player == 1 && AI.Utils.ChainContainsCard(CardId.Feather))) {
lockbird_useful = false;
return true;
}
......@@ -973,7 +968,7 @@ namespace WindBot.Game.AI.Decks
{
if (hand.IsMonster() && IsTrickstar(hand.Id))
{
if (hand.Attack >= Duel.LifePoints[1]) return true;
if (hand.Attack >= Enemy.LifePoints) return true;
if (hand.Id != CardId.Yellow)
{
if (AI.Utils.GetOneEnemyBetterThanValue(hand.Attack, false) == null) return true;
......@@ -986,7 +981,7 @@ namespace WindBot.Game.AI.Decks
public bool Ts_reborn()
{
if (Duel.Player == 0 && Duel.LifePoints[1] <= 1000)
if (Duel.Player == 0 && Enemy.LifePoints <= 1000)
{
AI.SelectCard(CardId.Pink);
return true;
......@@ -1033,7 +1028,7 @@ namespace WindBot.Game.AI.Decks
public bool Red_sum()
{
if ((Enemy.GetMonsterCount() == 0 && Duel.LifePoints[1] <= 1800) || (Duel.Turn == 1 && Bot.HasInHand(CardId.Re)))
if ((Enemy.GetMonsterCount() == 0 && Enemy.LifePoints <= 1800) || (Duel.Turn == 1 && Bot.HasInHand(CardId.Re)))
{
NormalSummoned = true;
return true;
......@@ -1043,7 +1038,7 @@ namespace WindBot.Game.AI.Decks
public bool Pink_sum()
{
if (Duel.LifePoints[1] <= 1000)
if (Enemy.LifePoints <= 1000)
{
NormalSummoned = true;
return true;
......@@ -1094,7 +1089,7 @@ namespace WindBot.Game.AI.Decks
public bool Ring_act()
{
if (LastChainPlayer == 0 && GetLastChainCard() != null && GetLastChainCard().Id == CardId.Ghost) return false;
if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard() != null && AI.Utils.GetLastChainCard().Id == CardId.Ghost) return false;
ClientCard target = AI.Utils.GetProblematicEnemyMonster();
if (target == null && AI.Utils.IsChainTarget(Card))
{
......@@ -1102,7 +1097,7 @@ namespace WindBot.Game.AI.Decks
}
if (target != null)
{
if (Duel.LifePoints[0] <= target.Attack) return false;
if (Bot.LifePoints <= target.Attack) return false;
AI.SelectCard(target);
return true;
}
......@@ -1124,7 +1119,7 @@ namespace WindBot.Game.AI.Decks
public bool Linkuri_eff()
{
if (LastChainPlayer == 0 && GetLastChainCard().Id == CardId.Linkuri) return false;
if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard().Id == CardId.Linkuri) return false;
AI.SelectCard(new[] { CardId.Tuner, CardId.BF + 1 });
return true;
}
......@@ -1216,7 +1211,7 @@ namespace WindBot.Game.AI.Decks
{
if (getLinkMarker(ex_m.Id) >= 4) return false;
}
if ((m == null || m.HasPosition(CardPosition.FaceDown)) && Duel.LifePoints[1] <= 1100)
if ((m == null || m.HasPosition(CardPosition.FaceDown)) && Enemy.LifePoints <= 1100)
{
if (Enemy.GetMonsterCount() == 0 && Duel.Phase < DuelPhase.Battle)
{
......@@ -1261,7 +1256,7 @@ namespace WindBot.Game.AI.Decks
ClientCard m = AI.Utils.GetProblematicEnemySpell();
if (m == null)
{
if (Enemy.GetMonsterCount() == 0 && Duel.LifePoints[1] <= 1900 && Duel.Phase == DuelPhase.Main1)
if (Enemy.GetMonsterCount() == 0 && Enemy.LifePoints <= 1900 && Duel.Phase == DuelPhase.Main1)
{
IList<ClientCard> m_list = new List<ClientCard>();
List<ClientCard> list = new List<ClientCard>(Bot.GetMonsters());
......@@ -1320,7 +1315,7 @@ namespace WindBot.Game.AI.Decks
int link_count = 0;
if (m == null)
{
if (Enemy.GetMonsterCount() == 0 && Duel.LifePoints[1] <= 2200 && Duel.Phase == DuelPhase.Main1)
if (Enemy.GetMonsterCount() == 0 && Enemy.LifePoints <= 2200 && Duel.Phase == DuelPhase.Main1)
{
IList<ClientCard> m_list = new List<ClientCard>();
List<ClientCard> _sort_list = new List<ClientCard>(Bot.GetMonsters());
......@@ -1412,7 +1407,7 @@ namespace WindBot.Game.AI.Decks
}
if (targets.Count >= 4)
{
if (Duel.LifePoints[1] <= GetTotalATK(targets) && Enemy.GetMonsterCount() == 0) return false;
if (Enemy.LifePoints <= GetTotalATK(targets) && Enemy.GetMonsterCount() == 0) return false;
AI.SelectMaterials(targets);
AI.SelectYesNo(true);
snake_four_s = true;
......@@ -1491,7 +1486,7 @@ namespace WindBot.Game.AI.Decks
IList<ClientCard> material_list = new List<ClientCard>();
if (AI.Utils.GetProblematicEnemyMonster(2000) == null) Logger.DebugWriteLine("***borrel:null");
else Logger.DebugWriteLine("***borrel:" + (AI.Utils.GetProblematicEnemyMonster(2000).Name ?? "unknown"));
if (AI.Utils.GetProblematicEnemyMonster(2000) != null || (Enemy.GetMonsterCount() == 0 && Duel.Phase == DuelPhase.Main1 && Duel.LifePoints[1] <= 3000))
if (AI.Utils.GetProblematicEnemyMonster(2000) != null || (Enemy.GetMonsterCount() == 0 && Duel.Phase == DuelPhase.Main1 && Enemy.LifePoints <= 3000))
{
foreach(ClientCard e_m in Bot.GetMonstersInExtraZone())
{
......@@ -1521,7 +1516,7 @@ namespace WindBot.Game.AI.Decks
}
if ((already_link2 && material_list.Count == 3) || (!already_link2 && material_list.Count == 4))
{
if (Enemy.GetMonsterCount() == 0 && Duel.Phase == DuelPhase.Main1 && Duel.LifePoints[1] <= 3000)
if (Enemy.GetMonsterCount() == 0 && Duel.Phase == DuelPhase.Main1 && Enemy.LifePoints <= 3000)
{
if (GetTotalATK(material_list) >= 3000) return false;
}
......@@ -1552,14 +1547,14 @@ namespace WindBot.Game.AI.Decks
public bool GraveCall_eff()
{
if (LastChainPlayer == 1)
if (Duel.LastChainPlayer == 1)
{
Logger.DebugWriteLine(GetLastChainCard().Name.ToString());
Logger.DebugWriteLine(GetLastChainCard().IsMonster().ToString());
Logger.DebugWriteLine(Enemy.HasInGraveyard(GetLastChainCard().Id).ToString());
if (GetLastChainCard().IsMonster() && Enemy.HasInGraveyard(GetLastChainCard().Id))
Logger.DebugWriteLine(AI.Utils.GetLastChainCard().Name.ToString());
Logger.DebugWriteLine(AI.Utils.GetLastChainCard().IsMonster().ToString());
Logger.DebugWriteLine(Enemy.HasInGraveyard(AI.Utils.GetLastChainCard().Id).ToString());
if (AI.Utils.GetLastChainCard().IsMonster() && Enemy.HasInGraveyard(AI.Utils.GetLastChainCard().Id))
{
GraveCall_id = GetLastChainCard().Id;
GraveCall_id = AI.Utils.GetLastChainCard().Id;
GraveCall_count = 2;
AI.SelectCard(GraveCall_id);
return true;
......
......@@ -129,7 +129,7 @@ namespace WindBot.Game.AI.Decks
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.NumberS39UtopiatheLightning, DefaultNumberS39UtopiaTheLightningEffect);
AddExecutor(ExecutorType.Activate, CardId.StardustDragon, DefaultStardustDragonEffect);
......@@ -291,7 +291,7 @@ namespace WindBot.Game.AI.Decks
private bool GagagaCowboySummon()
{
if (Duel.LifePoints[1] <= 800 || (Bot.GetMonsterCount()>=4 && Duel.LifePoints[1] <= 1600))
if (Enemy.LifePoints <= 800 || (Bot.GetMonsterCount()>=4 && Enemy.LifePoints <= 1600))
{
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
......
......@@ -72,7 +72,7 @@ namespace WindBot.Game.AI.Decks
// XYZ effects
AddExecutor(ExecutorType.Activate, CardId.Number39Utopia, Number39Utopia);
AddExecutor(ExecutorType.Activate, CardId.NumberS39UtopiaOne);
AddExecutor(ExecutorType.Activate, CardId.NumberS39UtopiatheLightning, NumberS39UtopiatheLightning);
AddExecutor(ExecutorType.Activate, CardId.NumberS39UtopiatheLightning, DefaultNumberS39UtopiaTheLightningEffect);
AddExecutor(ExecutorType.Activate, CardId.ZwLionArms, ZwLionArms);
AddExecutor(ExecutorType.Activate, CardId.AdreusKeeperOfArmageddon);
AddExecutor(ExecutorType.Activate, CardId.Number61Volcasaurus);
......@@ -105,7 +105,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.TinGoldfish, GoblindberghEffect);
AddExecutor(ExecutorType.Activate, CardId.Kagetokage);
AddExecutor(ExecutorType.Activate, CardId.SummonerMonk, SummonerMonkEffect);
AddExecutor(ExecutorType.Activate, CardId.Honest, Honest);
AddExecutor(ExecutorType.Activate, CardId.Honest, DefaultHonestEffect);
// Reposition
AddExecutor(ExecutorType.Repos, MonsterRepos);
......@@ -150,7 +150,7 @@ namespace WindBot.Game.AI.Decks
private bool Number39Utopia()
{
if (!HasChainedTrap(0) && Duel.Player == 1 && Duel.Phase == DuelPhase.BattleStart && Card.HasXyzMaterial(2))
if (!AI.Utils.HasChainedTrap(0) && Duel.Player == 1 && Duel.Phase == DuelPhase.BattleStart && Card.HasXyzMaterial(2))
return true;
return false;
}
......@@ -184,7 +184,7 @@ namespace WindBot.Game.AI.Decks
private bool InstantFusion()
{
if (Duel.LifePoints[0] <= 1000)
if (Bot.LifePoints <= 1000)
return false;
int count4 = 0;
int count5 = 0;
......@@ -210,17 +210,7 @@ namespace WindBot.Game.AI.Decks
private bool XyzChangeTactics()
{
return Duel.LifePoints[0] > 500;
}
private bool NumberS39UtopiatheLightning()
{
return Card.Attack < 5000;
}
private bool Honest()
{
return Duel.Phase != DuelPhase.Main1 || Duel.Turn == 1;
return Bot.LifePoints > 500;
}
private bool GoblindberghFirst()
......
......@@ -73,7 +73,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.SpSummon, CardId.Number39Utopia, DefaultNumberS39UtopiaTheLightningSummon);
AddExecutor(ExecutorType.SpSummon, CardId.NumberS39UtopiatheLightning);
AddExecutor(ExecutorType.Activate, CardId.NumberS39UtopiatheLightning);
AddExecutor(ExecutorType.Activate, CardId.NumberS39UtopiatheLightning, DefaultNumberS39UtopiaTheLightningEffect);
AddExecutor(ExecutorType.Activate, CardId.InvokedMechaba, DefaultTrap);
......@@ -486,7 +486,7 @@ namespace WindBot.Game.AI.Decks
private bool DridentEffect()
{
if (LastChainPlayer == 0)
if (Duel.LastChainPlayer == 0)
return false;
ClientCard target = AI.Utils.GetBestEnemyCard(true);
if (target == null)
......@@ -571,7 +571,7 @@ namespace WindBot.Game.AI.Decks
private bool ZoodiacComboEffect()
{
if (CurrentChain.Count > 0)
if (Duel.CurrentChain.Count > 0)
return false;
if (Card.Location != CardLocation.Grave)
{
......
......@@ -104,7 +104,7 @@ namespace WindBot.Game.AI
/// </summary>
protected bool DefaultMysticalSpaceTyphoon()
{
foreach (ClientCard card in CurrentChain)
foreach (ClientCard card in Duel.CurrentChain)
if (card.Id == _CardId.MysticalSpaceTyphoon)
return false;
......@@ -137,10 +137,10 @@ namespace WindBot.Game.AI
/// </summary>
protected bool DefaultCosmicCyclone()
{
foreach (ClientCard card in CurrentChain)
foreach (ClientCard card in Duel.CurrentChain)
if (card.Id == _CardId.CosmicCyclone)
return false;
return (Duel.LifePoints[0] > 1000) && DefaultMysticalSpaceTyphoon();
return (Bot.LifePoints > 1000) && DefaultMysticalSpaceTyphoon();
}
/// <summary>
......@@ -243,11 +243,12 @@ namespace WindBot.Game.AI
/// </summary>
protected bool DefaultBreakthroughSkill()
{
ClientCard LastChainCard = GetLastChainCard();
ClientCard LastChainCard = AI.Utils.GetLastChainCard();
if (LastChainCard == null)
return false;
AI.SelectCard(LastChainCard);
return LastChainCard.Controller == 1 && LastChainCard.Location == CardLocation.MonsterZone && DefaultUniqueTrap();
}
......@@ -256,7 +257,7 @@ namespace WindBot.Game.AI
/// </summary>
protected bool DefaultSolemnJudgment()
{
return !AI.Utils.IsChainTargetOnly(Card) && !(Duel.Player == 0 && LastChainPlayer == -1) && DefaultTrap();
return !AI.Utils.IsChainTargetOnly(Card) && !(Duel.Player == 0 && Duel.LastChainPlayer == -1) && DefaultTrap();
}
/// <summary>
......@@ -264,7 +265,7 @@ namespace WindBot.Game.AI
/// </summary>
protected bool DefaultSolemnWarning()
{
return (Duel.LifePoints[0] > 2000) && !(Duel.Player == 0 && LastChainPlayer == -1) && DefaultTrap();
return (Bot.LifePoints > 2000) && !(Duel.Player == 0 && Duel.LastChainPlayer == -1) && DefaultTrap();
}
/// <summary>
......@@ -272,7 +273,7 @@ namespace WindBot.Game.AI
/// </summary>
protected bool DefaultSolemnStrike()
{
return (Duel.LifePoints[0] > 1500) && !(Duel.Player == 0 && LastChainPlayer == -1) && DefaultTrap();
return (Bot.LifePoints > 1500) && !(Duel.Player == 0 && Duel.LastChainPlayer == -1) && DefaultTrap();
}
/// <summary>
......@@ -280,7 +281,7 @@ namespace WindBot.Game.AI
/// </summary>
protected bool DefaultTorrentialTribute()
{
return !HasChainedTrap(0) && AI.Utils.IsAllEnemyBetter(true);
return !AI.Utils.HasChainedTrap(0) && AI.Utils.IsAllEnemyBetter(true);
}
/// <summary>
......@@ -395,7 +396,7 @@ namespace WindBot.Game.AI
/// </summary>
protected bool DefaultTrap()
{
return (LastChainPlayer == -1 && Duel.LastSummonPlayer != 0) || LastChainPlayer == 1;
return (Duel.LastChainPlayer == -1 && Duel.LastSummonPlayer != 0) || Duel.LastChainPlayer == 1;
}
/// <summary>
......@@ -403,7 +404,7 @@ namespace WindBot.Game.AI
/// </summary>
protected bool DefaultUniqueTrap()
{
if (HasChainedTrap(0))
if (AI.Utils.HasChainedTrap(0))
return false;
return UniqueFaceupSpell();
......@@ -445,7 +446,7 @@ namespace WindBot.Game.AI
if (exec.Type == Type && exec.CardId == Card.Id)
return false;
}
return LastChainPlayer != 0;
return Duel.LastChainPlayer != 0;
}
/// <summary>
......@@ -459,11 +460,11 @@ namespace WindBot.Game.AI
if (exec.Type == Type && exec.CardId == Card.Id)
count++;
}
if (count > 1 || Duel.LifePoints[0] <= 1000)
if (count > 1 || Bot.LifePoints <= 1000)
return false;
if (Duel.LifePoints[0] <= Duel.LifePoints[1] && ActivateDescription == AI.Utils.GetStringId(_CardId.ChickenGame, 0))
if (Bot.LifePoints <= Enemy.LifePoints && ActivateDescription == AI.Utils.GetStringId(_CardId.ChickenGame, 0))
return true;
if (Duel.LifePoints[0] > Duel.LifePoints[1] && ActivateDescription == AI.Utils.GetStringId(_CardId.ChickenGame, 1))
if (Bot.LifePoints > Enemy.LifePoints && ActivateDescription == AI.Utils.GetStringId(_CardId.ChickenGame, 1))
return true;
return false;
}
......@@ -518,8 +519,8 @@ namespace WindBot.Game.AI
return true;
}
}
ClientCard lastchaincard = GetLastChainCard();
if (LastChainPlayer == 1 && lastchaincard != null && !lastchaincard.IsDisabled())
ClientCard lastchaincard = AI.Utils.GetLastChainCard();
if (Duel.LastChainPlayer == 1 && lastchaincard != null && !lastchaincard.IsDisabled())
{
if (lastchaincard.HasType(CardType.Ritual))
{
......@@ -638,6 +639,14 @@ namespace WindBot.Game.AI
return AI.Utils.IsOneEnemyBetterThanValue(bestBotAttack, false);
}
/// <summary>
/// Activate if the card is attack pos, and its attack is below 5000, when the enemy monster is attack pos or not useless faceup defense pos
/// </summary>
protected bool DefaultNumberS39UtopiaTheLightningEffect()
{
return Card.IsAttack() && Card.Attack < 5000 && (Enemy.BattlingMonster.IsAttack() || Enemy.BattlingMonster.IsFacedown() || Enemy.BattlingMonster.GetDefensePower() >= Card.Attack);
}
/// <summary>
/// Summon when it can and should use effect.
/// </summary>
......@@ -691,7 +700,7 @@ namespace WindBot.Game.AI
/// </summary>
protected bool DefaultStardustDragonEffect()
{
return (Card.Location == CardLocation.Grave) || LastChainPlayer == 1;
return (Card.Location == CardLocation.Grave) || Duel.LastChainPlayer == 1;
}
/// <summary>
......@@ -753,5 +762,20 @@ namespace WindBot.Game.AI
return (oppoCount > 0 && selfCount <= oppoCount) || oppoCount >= 3;
}
/// <summary>
/// Clever enough.
/// </summary>
protected bool DefaultHonestEffect()
{
if (Card.Location == CardLocation.Hand)
{
return Bot.BattlingMonster.IsAttack() &&
(((Bot.BattlingMonster.Attack < Enemy.BattlingMonster.Attack) || Bot.BattlingMonster.Attack >= Enemy.LifePoints)
|| ((Bot.BattlingMonster.Attack < Enemy.BattlingMonster.Defense) && (Bot.BattlingMonster.Attack + Enemy.BattlingMonster.Attack > Enemy.BattlingMonster.Defense)));
}
else return AI.Utils.IsTurn1OrMain2();
}
}
}
......@@ -21,9 +21,6 @@ namespace WindBot.Game.AI
protected ClientCard Card { get; private set; }
protected int ActivateDescription { get; private set; }
protected int LastChainPlayer { get; private set; }
protected IList<ClientCard> CurrentChain { get; private set; }
protected ClientField Bot { get; private set; }
protected ClientField Enemy { get; private set; }
......@@ -33,9 +30,6 @@ namespace WindBot.Game.AI
AI = ai;
Executors = new List<CardExecutor>();
LastChainPlayer = -1;
CurrentChain = new List<ClientCard>();
Bot = Duel.Fields[0];
Enemy = Duel.Fields[1];
}
......@@ -109,14 +103,12 @@ namespace WindBot.Game.AI
public virtual void OnChaining(int player, ClientCard card)
{
CurrentChain.Add(card);
LastChainPlayer = player;
}
public virtual void OnChainEnd()
{
LastChainPlayer = -1;
CurrentChain.Clear();
}
public virtual void OnNewTurn()
......@@ -182,44 +174,6 @@ namespace WindBot.Game.AI
return -1;
}
public bool ChainContainsCard(int id)
{
foreach (ClientCard card in CurrentChain)
{
if (card.Id == id)
return true;
}
return false;
}
public int ChainCountPlayer(int player)
{
int count = 0;
foreach (ClientCard card in CurrentChain)
{
if (card.Controller == player)
count++;
}
return count;
}
public bool HasChainedTrap(int player)
{
foreach (ClientCard card in CurrentChain)
{
if (card.Controller == player && card.HasType(CardType.Trap))
return true;
}
return false;
}
public ClientCard GetLastChainCard()
{
if (CurrentChain.Count > 0)
return CurrentChain[CurrentChain.Count - 1];
return null;
}
public void SetMain(MainPhase main)
{
Main = main;
......
......@@ -13,6 +13,9 @@ namespace WindBot.Game
public IList<ClientCard> Deck { get; private set; }
public IList<ClientCard> ExtraDeck { get; private set; }
public int LifePoints;
public ClientCard BattlingMonster;
public ClientField()
{
}
......@@ -33,6 +36,15 @@ namespace WindBot.Game
ExtraDeck.Add(new ClientCard(0, CardLocation.Extra));
}
public int GetMonstersExtraZoneCount()
{
int count = 0;
if (MonsterZone[5] != null)
count++;
if (MonsterZone[6] != null)
count++;
return count;
}
public int GetMonsterCount()
{
return GetCount(MonsterZone);
......@@ -68,6 +80,7 @@ namespace WindBot.Game
{
return GetCards(MonsterZone);
}
public List<ClientCard> GetGraveyardMonsters()
{
......
......@@ -8,7 +8,6 @@ namespace WindBot.Game
public bool IsFirst { get; set; }
public bool IsNewRule { get; set; }
public int[] LifePoints { get; private set; }
public ClientField[] Fields { get; private set; }
public int Turn { get; set; }
......@@ -16,15 +15,19 @@ namespace WindBot.Game
public DuelPhase Phase { get; set; }
public MainPhase MainPhase { get; set; }
public BattlePhase BattlePhase { get; set; }
public int LastChainPlayer { get; set; }
public IList<ClientCard> CurrentChain { get; set; }
public IList<ClientCard> ChainTargets { get; set; }
public int LastSummonPlayer { get; set; }
public Duel()
{
LifePoints = new int[2];
Fields = new ClientField[2];
Fields[0] = new ClientField();
Fields[1] = new ClientField();
LastChainPlayer = -1;
CurrentChain = new List<ClientCard>();
ChainTargets = new List<ClientCard>();
LastSummonPlayer = -1;
}
......
......@@ -90,7 +90,6 @@ namespace WindBot.Game
m_option = -1;
m_yesno = -1;
m_position = CardPosition.FaceUpAttack;
Duel.LastSummonPlayer = -1;
if (Duel.Player == 0 && Duel.Phase == DuelPhase.Draw)
{
_dialogs.SendNewTurn();
......@@ -112,7 +111,6 @@ namespace WindBot.Game
/// <param name="player">Player who is currently chaining.</param>
public void OnChaining(ClientCard card, int player)
{
Duel.LastSummonPlayer = -1;
Executor.OnChaining(player,card);
}
......
......@@ -324,8 +324,8 @@ namespace WindBot.Game
int type = packet.ReadByte();
_duel.IsFirst = (type & 0xF) == 0;
_duel.Turn = 0;
_duel.LifePoints[GetLocalPlayer(0)] = packet.ReadInt32();
_duel.LifePoints[GetLocalPlayer(1)] = packet.ReadInt32();
_duel.Fields[GetLocalPlayer(0)].LifePoints = packet.ReadInt32();
_duel.Fields[GetLocalPlayer(1)].LifePoints = packet.ReadInt32();
int deck = packet.ReadInt16();
int extra = packet.ReadInt16();
_duel.Fields[GetLocalPlayer(0)].Init(deck, extra);
......@@ -421,27 +421,30 @@ namespace WindBot.Game
private void OnNewPhase(BinaryReader packet)
{
_duel.Phase = (DuelPhase)packet.ReadInt16();
_duel.LastSummonPlayer = -1;
_duel.Fields[0].BattlingMonster = null;
_duel.Fields[1].BattlingMonster = null;
_ai.OnNewPhase();
}
private void OnDamage(BinaryReader packet)
{
int player = GetLocalPlayer(packet.ReadByte());
int final = _duel.LifePoints[player] - packet.ReadInt32();
int final = _duel.Fields[player].LifePoints - packet.ReadInt32();
if (final < 0) final = 0;
_duel.LifePoints[player] = final;
_duel.Fields[player].LifePoints = final;
}
private void OnRecover(BinaryReader packet)
{
int player = GetLocalPlayer(packet.ReadByte());
_duel.LifePoints[player] += packet.ReadInt32();
_duel.Fields[player].LifePoints += packet.ReadInt32();
}
private void OnLpUpdate(BinaryReader packet)
{
int player = GetLocalPlayer(packet.ReadByte());
_duel.LifePoints[player] = packet.ReadInt32();
_duel.Fields[player].LifePoints = packet.ReadInt32();
}
private void OnMove(BinaryReader packet)
......@@ -494,12 +497,16 @@ namespace WindBot.Game
int la = packet.ReadByte();
int sa = packet.ReadByte();
packet.ReadByte(); //
packet.ReadByte(); // cd
int cd = GetLocalPlayer(packet.ReadByte());
int ld = packet.ReadByte();
packet.ReadByte(); // sd
int sd = packet.ReadByte();
packet.ReadByte(); //
ClientCard attackcard = _duel.GetCard(ca, (CardLocation)la, sa);
ClientCard defendcard = _duel.GetCard(cd, (CardLocation)ld, sd);
_duel.Fields[attackcard.Controller].BattlingMonster = attackcard;
_duel.Fields[1 - attackcard.Controller].BattlingMonster = defendcard;
if (ld == 0 && (attackcard != null) && (ca != 0))
{
_ai.OnDirectAttack(attackcard);
......@@ -530,11 +537,17 @@ namespace WindBot.Game
int cc = GetLocalPlayer(packet.ReadByte());
_ai.OnChaining(card, cc);
_duel.ChainTargets.Clear();
_duel.LastSummonPlayer = -1;
_duel.CurrentChain.Add(card);
_duel.LastChainPlayer = cc;
}
private void OnChainEnd(BinaryReader packet)
{
_ai.OnChainEnd();
_duel.LastChainPlayer = -1;
_duel.CurrentChain.Clear();
//_duel.ChainTargets.Clear();
}
......
......@@ -79,6 +79,7 @@
<Compile Include="Game\AI\Decks\EvilswarmExecutor.cs" />
<Compile Include="Game\AI\Decks\GraydleExecutor.cs" />
<Compile Include="Game\AI\Decks\LightswornExecutor.cs" />
<Compile Include="Game\AI\Decks\LightswornShaddoldinosourExecutor.cs" />
<Compile Include="Game\AI\Decks\QliphortExecutor.cs" />
<Compile Include="Game\AI\Decks\ST1732Executor.cs" />
<Compile Include="Game\AI\Decks\TrickstarExecutor.cs" />
......
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