Commit 553b988e authored by 苍蓝's avatar 苍蓝

update 超可爱执行者

parent 2ad318ae
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup> </startup>
</configuration> </configuration>
...@@ -24,6 +24,11 @@ Name=最强战旗 Deck=SaikyoBattleFlag Dialog=rd-d ...@@ -24,6 +24,11 @@ Name=最强战旗 Deck=SaikyoBattleFlag Dialog=rd-d
机械卡组。 机械卡组。
SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020
!光天女
Name=光天女 Deck=Excutie Dialog=Excutie.zh-CN
强力的超可爱执行者卡组。
SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020
!传说子 !传说子
Name=传说子 Deck=TheLegend Dialog=rd Name=传说子 Deck=TheLegend Dialog=rd
大量传说卡堆成的卡组。需勾选不检查卡组才能对战。 大量传说卡堆成的卡组。需勾选不检查卡组才能对战。
......
#created by ... #created by ...
#main #main
120120000 46986414
120120000 46986414
120120000 74677422
120170000 74677422
120170000 67300516
120110001 10802915
120110001 10802915
120155000 26202165
120194001 91646304
120194002 14558127
120194002 14558127
120194002 72291078
120194003 72291078
120194003 72291078
120194003 23434538
120151010 23434538
120151010 23434538
120110009 97631303
120110009 97631303
120110009 97631303
120170035 1845204
120170035 1845204
120120017 6172122
120120017 6172122
120120017 6172122
120194004 11827244
120151023 11827244
120151023 18144506
120151023 81439173
120181003 83764718
120181003 92353449
120181003 92353449
120151018 24224830
120151018 24224830
120194005 24224830
120194005 10045474
120194005 10045474
120150019 10045474
120150019 40605147
120150019 40605147
#extra #extra
37818794
37818794
37818794
96334243
63519819
50588353
70369116
70369116
98978921
98978921
31226177
31226177
60303245
60303245
60303245
!side !side
#created by ...
#main
120231034
120231034
120231034
120231031
120231031
120231031
120231033
120231033
120231033
120231035
120235019
120235019
120235019
120231032
120231032
120231036
120231037
120231037
120231037
120223102
120226013
120226013
120199032
120199032
120199032
120222036
120222036
120222036
120231039
120231039
120231065
120231069
120238006
120238006
120198003
120231041
120231041
120231068
120231068
120235065
#extra
!side
#created by ...
#main
37343995
37343995
37343995
16889337
16889337
16889337
16474916
16474916
16474916
67972302
67972302
67972302
79858629
79858629
43863925
43863925
43863925
5352328
5352328
14558127
14558127
14558127
23434538
23434538
23434538
84211599
84211599
4408198
24224830
24224830
77913594
77913594
77913594
197042
197042
10045474
10045474
77891946
77891946
77891946
#extra
90448279
59242457
59242457
9272381
42741437
42741437
42741437
78135071
78135071
41524885
41524885
46772449
5530780
58858807
8728498
!side
74689476
#created by ...
#main
27204311
68304193
68304193
68304193
32909498
32909498
32909498
4928565
78534861
78534861
91800273
91800273
72090076
31149212
31149212
31149212
14558127
14558127
14558127
23434538
23434538
31480215
34447918
34447918
34447918
73628505
84211599
84211599
24224830
24224830
65681983
69540484
69540484
69540484
71832012
71832012
71832012
10045474
10045474
33925864
#extra
15291624
27548199
21915012
48626373
48626373
95474755
95474755
95474755
10389142
73542331
73542331
21887175
44097050
22423493
65741786
!side
#created by ... #created by ...
#main #main
120181011 8567955
120181011 8567955
120181011 8567955
120181001 89743495
120181001 89743495
120181001 27182739
120155015 27182739
120155015 27182739
120155015 53577438
120193002 53577438
120193002 53577438
120193002 16360142
120183002 16360142
120183002 16360142
120183002 80965043
120183024 80965043
120183024 80965043
120183030 52354896
120183030 52354896
120183030 12580477
120151010 14025912
120151010 14532163
120183031 14532163
120183031 35261759
120193003 35261759
120193003 35261759
120193003 57160136
120130039 57160136
120130039 57160136
120183054 70368879
120183054 70368879
120183054 70368879
120151023 81439173
120155060 93104632
120155060 93104632
120183062 8267140
120183063 41410651
120183063 36361633
120170061 36361633
120183064 36361633
#extra #extra
42632209
42632209
42632209
15248594
15248594
15248594
61399402
61399402
61399402
85692042
85692042
85692042
88021907
88021907
88021907
!side !side
#created by ...
#main
3717252
77723643
572850
572850
572850
73956664
73956664
25926710
25926710
25926710
99937011
99937011
99937011
62320425
62320425
62320425
63542003
63542003
97518132
37961969
37961969
37961969
74078255
74078255
74078255
92919429
92919429
92919429
17266660
17266660
17266660
21074344
21074344
21074344
40177746
6767771
77103950
77103950
74920585
74920585
#extra
28226490
84330567
69946549
92731385
92731385
94977269
80532587
84815190
33158448
21044178
98127546
21887175
38342335
27381364
65741786
!side
#created by ...
#main
120231034
120231034
120231034
120231031
120231031
120231031
120231033
120231033
120231033
120231035
120235019
120235019
120235019
120231032
120231032
120231036
120231037
120231037
120231037
120223102
120226013
120226013
120199032
120199032
120199032
120222036
120222036
120222036
120231039
120231039
120231065
120231069
120238006
120238006
120198003
120231041
120231041
120231068
120231068
120235065
#extra
!side
{
"welcome": [
"你好,我是光天女,为了保护世界的和平,我和我的伙伴们正在执行正义的使命。",
"超巨大财团的大小姐,光天女,来了!",
"我们的目标是保护这个美好的世界,为此我们不惜一切代价。",
"超技术的力量,为了正义而战!",
"我们是超可爱执行者,为了美好的世界而战!",
"AI功能正在测试中,遇到问题请及时反馈。"
],
"deckerror": [
"我的卡组需要{0}才能发挥最大威力。"
],
"duelstart": [
"超可爱执行者紧急出动!",
"为了正义而战!",
"超主流卡组?那可不是我的风格。",
"抄袭他人的卡组,怎么能称之为胜利呢?",
"我的卡组可不是那么好对付的。"
],
"newturn": [
"到我了,抽卡!",
"我的回合,抽卡!",
"我抽到5张卡。"
],
"endturn": [
"回合结束。",
"我的回合结束了。",
"这一回合,我又更接近胜利了。",
"轮到你了。",
"茶休时间~"
],
"directattack": [
"{0},直接攻击!",
"{0},直接攻击对手!",
"{0},这就是我的正义哦!",
"{0},攻击对手的生命值!",
"{0},直接攻击对手的生命值!",
"{0},通过直接攻击打倒对手!",
"{0},释放你的力量吧!",
"正义执行!",
"向对手展示你的力量吧,{0}!",
"接受制裁吧!{0},攻击!"
],
"attack": [
"{0},向那只{1}发起攻击!",
"{0},消灭罪恶!",
"这就是我的正义哦!",
"{0},对{1}降下制裁!",
"{0},冲向那只{1}!",
"{0},正义执行!"
],
"ondirectattack": [
"可恶……",
"不过是{0}而已!",
"正义无法执行了吗……"
],
"facedownmonstername": "怪兽",
"activate": [
"我发动{0}。",
"我使用{0}的效果。",
"我使用{0}的力量。"
],
"summon": [
"我召唤{0}。",
"出来吧,我的伙伴,{0}!",
"出现吧,{0}!",
"我召唤了美丽的{0}!",
"我召唤了强大的{0}!",
"我呼唤{0}参加战斗!",
"我呼唤出{0}。",
"让我召唤{0}。"
],
"setmonster": [
"我放置了一只怪兽。",
"我里侧表示放置了一只怪兽。"
],
"chaining": [
"看这里!我发动{0}!",
"我使用{0}的力量。",
"准备!我使用{0}!",
"看样子你忘了我的{0}!",
"你考虑过我有{0}吗?",
"不会让你得逞!我发动{0}!",
"我会用{0}打败你的!",
"你的邪恶行径必须受到制裁!{0}!",
]
}
...@@ -44,8 +44,7 @@ namespace WindBot.Game.AI ...@@ -44,8 +44,7 @@ namespace WindBot.Game.AI
public bool IsOneEnemyBetterThanValue(int value, bool onlyATK) public bool IsOneEnemyBetterThanValue(int value, bool onlyATK)
{ {
return Enemy.MonsterZone.GetMonsters() return Enemy.MonsterZone.GetMonsters()
// .Any(card => card.GetDefensePower() > value && (!onlyATK || card.IsAttack())); .Any(card => card.GetDefensePower() > value && (!onlyATK || card.IsAttack()));
.Any(card => card.GetDefensePower() > value && (!onlyATK ));
} }
public bool IsAllEnemyBetterThanValue(int value, bool onlyATK) public bool IsAllEnemyBetterThanValue(int value, bool onlyATK)
...@@ -425,7 +424,7 @@ namespace WindBot.Game.AI ...@@ -425,7 +424,7 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
public IList<ClientCard> CheckSelectCount(IList<ClientCard> _selected, IList<ClientCard> cards, int min, int max) public IList<ClientCard> CheckSelectCount(IList<ClientCard> _selected, IList<ClientCard> cards, int min, int max)
{ {
var selected = _selected.ToList(); var selected = _selected.Distinct().ToList();
if (selected.Count < min) if (selected.Count < min)
{ {
foreach (ClientCard card in cards) foreach (ClientCard card in cards)
......
...@@ -15,6 +15,10 @@ namespace WindBot.Game.AI ...@@ -15,6 +15,10 @@ namespace WindBot.Game.AI
(card.Controller == 0 && Enum.IsDefined(typeof(InvincibleBotMonster), card.Id) || (card.Controller == 0 && Enum.IsDefined(typeof(InvincibleBotMonster), card.Id) ||
card.Controller == 1 && Enum.IsDefined(typeof(InvincibleEnemyMonster), card.Id)); card.Controller == 1 && Enum.IsDefined(typeof(InvincibleEnemyMonster), card.Id));
} }
public static bool IsMonsterImmuneTrap(this ClientCard card)
{
return !card.IsDisabled() && Enum.IsDefined(typeof(ImmuneTrapMonster), card.Id);
}
/// <summary> /// <summary>
/// Is this monster is dangerous to attack? /// Is this monster is dangerous to attack?
...@@ -23,10 +27,7 @@ namespace WindBot.Game.AI ...@@ -23,10 +27,7 @@ namespace WindBot.Game.AI
{ {
return !card.IsDisabled() && Enum.IsDefined(typeof(DangerousMonster), card.Id); return !card.IsDisabled() && Enum.IsDefined(typeof(DangerousMonster), card.Id);
} }
public static bool IsMonsterImmuneTrap(this ClientCard card)
{
return !card.IsDisabled() && Enum.IsDefined(typeof(ImmuneTrapMonster), card.Id);
}
/// <summary> /// <summary>
/// Do this monster prevents activation of opponent's effect monsters in battle? /// Do this monster prevents activation of opponent's effect monsters in battle?
/// </summary> /// </summary>
......
...@@ -80,7 +80,137 @@ namespace WindBot.Game.AI.Decks ...@@ -80,7 +80,137 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Repos, 圣防Repos); AddExecutor(ExecutorType.Repos, 圣防Repos);
//AddExecutor(ExecutorType.Activate, DefaultDontChainMyself); //AddExecutor(ExecutorType.Activate, DefaultDontChainMyself);
} }
private List<int> HintMsgForEnemy = new List<int>
{
HintMsg.Release, HintMsg.Destroy, HintMsg.Remove, HintMsg.ToGrave, HintMsg.ReturnToHand, HintMsg.ToDeck,
HintMsg.FusionMaterial, HintMsg.SynchroMaterial, HintMsg.XyzMaterial, HintMsg.LinkMaterial, HintMsg.Disable
};
private List<int> HintMsgForDeck = new List<int>
{
HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.Remove, HintMsg.AddToHand, HintMsg.FusionMaterial
};
private List<int> HintMsgForExtra = new List<int>
{
HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.Remove, HintMsg.AddToHand, HintMsg.FusionMaterial
};
private List<int> HintMsgForSelf = new List<int>
{
HintMsg.Equip
};
private List<int> HintMsgForMaterial = new List<int>
{
HintMsg.FusionMaterial, HintMsg.SynchroMaterial, HintMsg.XyzMaterial, HintMsg.LinkMaterial, HintMsg.Release
};
private List<int> HintMsgForMaxSelect = new List<int>
{
HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.AddToHand, HintMsg.FusionMaterial, HintMsg.Destroy, HintMsg.Equip ,HintMsg.Confirm
};
public override IList<ClientCard> OnSelectCard(IList<ClientCard> _cards, int min, int max, int hint, bool cancelable)
{
if (Duel.Phase == DuelPhase.BattleStart)
return null;
if (AI.HaveSelectedCards())
return null;
IList<ClientCard> selected = new List<ClientCard>();
IList<ClientCard> cards = new List<ClientCard>(_cards);
if (max > cards.Count)
max = cards.Count;
if (HintMsgForEnemy.Contains(hint))
{
IList<ClientCard> enemyCards = cards.Where(card => card.Controller == 1).ToList();
// select enemy's card first
while (enemyCards.Count > 0 && selected.Count < max)
{
ClientCard card = enemyCards[Program.Rand.Next(enemyCards.Count)];
selected.Add(card);
enemyCards.Remove(card);
cards.Remove(card);
}
}
if (HintMsgForDeck.Contains(hint))
{
IList<ClientCard> deckCards = cards.Where(card => card.Location == CardLocation.Deck).ToList();
// select deck's card first
while (deckCards.Count > 0 && selected.Count < max)
{
ClientCard card = deckCards[Program.Rand.Next(deckCards.Count)];
selected.Add(card);
deckCards.Remove(card);
cards.Remove(card);
}
}
if (HintMsgForExtra.Contains(hint))
{
IList<ClientCard> ExtraCards = cards.Where(card => card.Location == CardLocation.Extra).ToList();
// select extra's card first
while (ExtraCards.Count > 0 && selected.Count < max)
{
ClientCard card = ExtraCards[Program.Rand.Next(ExtraCards.Count)];
selected.Add(card);
ExtraCards.Remove(card);
cards.Remove(card);
}
}
if (HintMsgForSelf.Contains(hint))
{
IList<ClientCard> botCards = cards.Where(card => card.Controller == 0).ToList();
// select bot's card first
while (botCards.Count > 0 && selected.Count < max)
{
ClientCard card = botCards[Program.Rand.Next(botCards.Count)];
selected.Add(card);
botCards.Remove(card);
cards.Remove(card);
}
}
if (HintMsgForMaterial.Contains(hint))
{
IList<ClientCard> materials = cards.OrderBy(card => card.Attack).ToList();
// select low attack first
while (materials.Count > 0 && selected.Count < min)
{
ClientCard card = materials[0];
selected.Add(card);
materials.Remove(card);
cards.Remove(card);
}
}
// select random cards
while (selected.Count < min)
{
ClientCard card = cards[Program.Rand.Next(cards.Count)];
selected.Add(card);
cards.Remove(card);
}
if (HintMsgForMaxSelect.Contains(hint))
{
// select max cards
while (selected.Count < max)
{
ClientCard card = cards[Program.Rand.Next(cards.Count)];
selected.Add(card);
cards.Remove(card);
}
}
return selected;
}
private bool 大恐龙驾Effect() private bool 大恐龙驾Effect()
{ {
{ {
...@@ -135,54 +265,6 @@ namespace WindBot.Game.AI.Decks ...@@ -135,54 +265,6 @@ namespace WindBot.Game.AI.Decks
return true; return true;
} }
private List<int> HintMsgForEnemy = new List<int>
{
HintMsg.Release, HintMsg.Destroy, HintMsg.Remove, HintMsg.ToGrave, HintMsg.ReturnToHand, HintMsg.ToDeck,
HintMsg.FusionMaterial, HintMsg.SynchroMaterial, HintMsg.XyzMaterial, HintMsg.LinkMaterial, HintMsg.Disable
};
private List<int> HintMsgForMaxSelect = new List<int>
{
HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.AddToHand, HintMsg.ToDeck, HintMsg.Destroy
};
public override IList<ClientCard> OnSelectCard(IList<ClientCard> _cards, int min, int max, int hint, bool cancelable)
{
if (Duel.Phase == DuelPhase.BattleStart)
return null;
if (AI.HaveSelectedCards())
return null;
IList<ClientCard> selected = new List<ClientCard>();
IList<ClientCard> cards = new List<ClientCard>(_cards);
if (max > cards.Count)
max = cards.Count;
if (HintMsgForEnemy.Contains(hint))
{
IList<ClientCard> enemyCards = cards.Where(card => card.Controller == 1).ToList();
// select enemy's card first
while (enemyCards.Count > 0 && selected.Count < max)
{
ClientCard card = enemyCards[Program.Rand.Next(enemyCards.Count)];
selected.Add(card);
enemyCards.Remove(card);
cards.Remove(card);
}
}
if (HintMsgForMaxSelect.Contains(hint))
{
// select max cards
while (selected.Count < max)
{
ClientCard card = cards[Program.Rand.Next(cards.Count)];
selected.Add(card);
cards.Remove(card);
}
}
return selected;
}
public override bool OnSelectHand() public override bool OnSelectHand()
{ {
// go first // go first
......
using YGOSharp.OCGWrapper.Enums; using System;
using YGOSharp.OCGWrapper.Enums;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using WindBot; using WindBot;
using WindBot.Game; using WindBot.Game;
using WindBot.Game.AI; using WindBot.Game.AI;
using System; using System.Linq;
namespace WindBot.Game.AI.Decks namespace WindBot.Game.AI.Decks
{ {
[Deck("Dragun", "AI_Dragun")] [Deck("Dragun", "AI_Dragun")]
public class DragunExecutor : DefaultExecutor class DragunExecutor : DefaultExecutor
{ {
public class CardId public class CardId
{ {
public const int 青眼白龙 = 120120000; public const int DarkMagician = 46986414;
public const int 破坏之剑士 = 120170000; public const int RedEyesBDragon = 74677422;
public const int 连击龙 = 120110001; public const int RedEyesWyvern = 67300516;
public const int 人造人 = 120155000; public const int TourGuideFromTheUnderworld = 10802915;
public const int 千年盾 = 120194001; public const int Sangan = 26202165;
public const int 血腥魔兽人 = 120194002; public const int CrusadiaArboria = 91646304;
public const int 圣精灵 = 120194003; public const int AshBlossomJoyousSpring = 14558127;
public const int MechaPhantomBeastOLion = 72291078;
public const int 成金恐龙王 = 120151010; public const int MechaPhantomBeastOLionToken = 72291079;
public const int 机器栗子 = 120120017; public const int MaxxC = 23434538;
public const int 斗牛士 = 120170035; public const int MagiciansSouls = 97631303;
public const int 凤凰龙 = 120110009;
public const int 死苏 = 120194004; public const int InstantFusion = 1845204;
public const int 成金哥布林 = 120151018; public const int RedEyesFusion = 6172122;
public const int 强欲之壶 = 120181003; public const int MagicalizedFusion = 11827244;
public const int 对死者的供奉 = 120151023; public const int HarpiesFeatherDuster = 18144506;
public const int 落穴 = 120150019; public const int FoolishBurial = 81439173;
public const int 圣防 = 120198003; public const int MonsterReborn = 83764718;
public const int 炸甲 = 120194005; public const int RedEyesInsight = 92353449;
public const int 暗黑释放 = 120105013; public const int CalledbyTheGrave = 24224830;
public const int InfiniteImpermanence = 10045474;
public const int SolemnStrike = 40605147;
public const int DragunofRedEyes = 37818794;
public const int SeaMonsterofTheseus = 96334243;
public const int ThousandEyesRestrict = 63519819;
public const int CrystronHalqifibrax = 50588353;
public const int PredaplantVerteAnaconda = 70369116;
public const int LinkSpider = 98978921;
public const int ImdukTheWorldChaliceDragon = 31226177;
public const int SalamangreatAlmiraj = 60303245;
} }
public DragunExecutor(GameAI ai, Duel duel) public DragunExecutor(GameAI ai, Duel duel)
: base(ai, duel) : base(ai, duel)
{ {
AddExecutor(ExecutorType.SpSummon); // counter
AddExecutor(ExecutorType.Activate, CardId.强欲之壶); AddExecutor(ExecutorType.Activate, CardId.AshBlossomJoyousSpring, DefaultAshBlossomAndJoyousSpring);
AddExecutor(ExecutorType.Activate, CardId.成金哥布林); AddExecutor(ExecutorType.Activate, CardId.CalledbyTheGrave, DefaultCalledByTheGrave);
AddExecutor(ExecutorType.Activate, CardId.成金恐龙王, 成金恐龙王Effect); AddExecutor(ExecutorType.Activate, CardId.InfiniteImpermanence, DefaultInfiniteImpermanence);
AddExecutor(ExecutorType.Activate, CardId.机器栗子); AddExecutor(ExecutorType.Activate, CardId.SolemnStrike, DefaultSolemnStrike);
AddExecutor(ExecutorType.Activate, CardId.连击龙); AddExecutor(ExecutorType.Activate, CardId.DragunofRedEyes, DragunofRedEyesCounter);
AddExecutor(ExecutorType.Activate, CardId.斗牛士, 斗牛士Effect);
AddExecutor(ExecutorType.Repos, CardId.斗牛士, DefaultMonsterRepos);
AddExecutor(ExecutorType.SummonOrSet, CardId.青眼白龙, DefaultMonsterSummon);
AddExecutor(ExecutorType.Summon, CardId.破坏之剑士, DefaultMonsterSummon);
AddExecutor(ExecutorType.SummonOrSet, CardId.连击龙, DefaultMonsterSummon);
AddExecutor(ExecutorType.SummonOrSet, CardId.人造人, DefaultMonsterSummon);
AddExecutor(ExecutorType.MonsterSet, CardId.千年盾, DefaultMonsterSummon);
AddExecutor(ExecutorType.Summon, CardId.机器栗子, 栗子summon);
AddExecutor(ExecutorType.Repos, CardId.机器栗子, 栗子summon2);
//AddExecutor(ExecutorType.Activate, CardId.死苏, 死苏effect);
AddExecutor(ExecutorType.Activate, CardId.死苏, 死苏effect2);
AddExecutor(ExecutorType.MonsterSet, CardId.斗牛士, Monsterset);
AddExecutor(ExecutorType.Summon, CardId.斗牛士);
AddExecutor(ExecutorType.Activate, CardId.凤凰龙);
AddExecutor(ExecutorType.Activate, CardId.对死者的供奉, 死供Effect);
AddExecutor(ExecutorType.Repos, CardId.青眼白龙, DefaultMonsterRepos);
AddExecutor(ExecutorType.Repos, CardId.破坏之剑士, DefaultMonsterRepos);
AddExecutor(ExecutorType.Repos, CardId.连击龙, DefaultMonsterRepos);
AddExecutor(ExecutorType.Repos, CardId.人造人, DefaultMonsterRepos);
AddExecutor(ExecutorType.Repos, CardId.成金恐龙王, 成金恐龙王Summon);
AddExecutor(ExecutorType.Summon, CardId.成金恐龙王, 成金恐龙王Summon);
AddExecutor(ExecutorType.SummonOrSet, CardId.血腥魔兽人);
AddExecutor(ExecutorType.Summon, CardId.凤凰龙, 凤凰龙summon);
AddExecutor(ExecutorType.SpellSet, CardId.圣防);
AddExecutor(ExecutorType.SpellSet, CardId.落穴);
AddExecutor(ExecutorType.Activate, CardId.落穴, 落穴Effect);
AddExecutor(ExecutorType.Activate, CardId.圣防, 圣防Effect);
AddExecutor(ExecutorType.Activate, CardId.炸甲, 炸甲Effect);
AddExecutor(ExecutorType.SpellSet, CardId.对死者的供奉);
AddExecutor(ExecutorType.MonsterSet, CardId.圣精灵);
AddExecutor(ExecutorType.MonsterSet, CardId.凤凰龙);
AddExecutor(ExecutorType.MonsterSet, CardId.成金恐龙王);
AddExecutor(ExecutorType.MonsterSet, CardId.机器栗子);
AddExecutor(ExecutorType.Activate, DefaultDontChainMyself);
AddExecutor(ExecutorType.Repos, CardId.青眼白龙, 圣防Repos);
AddExecutor(ExecutorType.Repos, CardId.破坏之剑士, 圣防Repos);
AddExecutor(ExecutorType.SummonOrSet, DefaultMonsterSummon);
AddExecutor(ExecutorType.SpellSet);
//AddExecutor(ExecutorType.Activate, CardId.sionmax, sionmaxEffect);
}
private List<int> HintMsgForEnemy = new List<int>
{
HintMsg.Release, HintMsg.Destroy, HintMsg.Remove, HintMsg.ToGrave, HintMsg.ReturnToHand, HintMsg.ToDeck,
HintMsg.FusionMaterial, HintMsg.SynchroMaterial, HintMsg.XyzMaterial, HintMsg.LinkMaterial, HintMsg.Disable
};
private List<int> HintMsgForMaxSelect = new List<int>
{
HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.AddToHand, HintMsg.ToDeck, HintMsg.Destroy
};
public override IList<ClientCard> OnSelectCard(IList<ClientCard> _cards, int min, int max, int hint, bool cancelable) AddExecutor(ExecutorType.Activate, CardId.MaxxC, DefaultMaxxC);
{ AddExecutor(ExecutorType.Activate, CardId.HarpiesFeatherDuster);
if (Duel.Phase == DuelPhase.BattleStart)
return null; AddExecutor(ExecutorType.Activate, CardId.DragunofRedEyes, DragunofRedEyesDestroy);
if (AI.HaveSelectedCards()) AddExecutor(ExecutorType.Activate, CardId.ThousandEyesRestrict, ThousandEyesRestrictEffect);
return null;
AddExecutor(ExecutorType.Activate, CardId.RedEyesInsight, RedEyesInsightEffect);
AddExecutor(ExecutorType.Activate, CardId.RedEyesFusion, RedEyesFusionEffect);
AddExecutor(ExecutorType.Repos, MonsterRepos);
AddExecutor(ExecutorType.Summon, CardId.TourGuideFromTheUnderworld, TourGuideFromTheUnderworldSummon);
AddExecutor(ExecutorType.Activate, CardId.TourGuideFromTheUnderworld, TourGuideFromTheUnderworldEffect);
AddExecutor(ExecutorType.Summon, CardId.Sangan, SanganSummon);
AddExecutor(ExecutorType.Activate, CardId.Sangan, SanganEffect);
AddExecutor(ExecutorType.Summon, CardId.MechaPhantomBeastOLion);
AddExecutor(ExecutorType.Activate, CardId.MechaPhantomBeastOLion, MechaPhantomBeastOLionEffect);
AddExecutor(ExecutorType.SpSummon, CardId.SalamangreatAlmiraj, SalamangreatAlmirajSummon);
AddExecutor(ExecutorType.SpSummon, CardId.ImdukTheWorldChaliceDragon, ImdukTheWorldChaliceDragonSummon);
AddExecutor(ExecutorType.SpSummon, CardId.LinkSpider, LinkSpiderSummon);
AddExecutor(ExecutorType.SpSummon, CardId.CrusadiaArboria);
AddExecutor(ExecutorType.Activate, CardId.InstantFusion, InstantFusionEffect);
AddExecutor(ExecutorType.Summon, CardId.RedEyesWyvern);
AddExecutor(ExecutorType.Summon, CardId.CrusadiaArboria, SummonForMaterial);
AddExecutor(ExecutorType.Summon, CardId.AshBlossomJoyousSpring, SummonForMaterial);
AddExecutor(ExecutorType.Summon, CardId.MaxxC, SummonForMaterial);
AddExecutor(ExecutorType.Activate, CardId.FoolishBurial, FoolishBurialEffect);
AddExecutor(ExecutorType.Activate, CardId.MonsterReborn, MonsterRebornEffect);
IList<ClientCard> selected = new List<ClientCard>(); AddExecutor(ExecutorType.Activate, CardId.MagiciansSouls, MagiciansSoulsEffect);
IList<ClientCard> cards = new List<ClientCard>(_cards); AddExecutor(ExecutorType.Summon, CardId.MagiciansSouls, SummonForMaterial);
if (max > cards.Count)
max = cards.Count;
if (HintMsgForEnemy.Contains(hint)) AddExecutor(ExecutorType.SpSummon, CardId.CrystronHalqifibrax, CrystronNeedlefiberSummon);
AddExecutor(ExecutorType.Activate, CardId.CrystronHalqifibrax, CrystronNeedlefiberEffect);
AddExecutor(ExecutorType.SpSummon, CardId.PredaplantVerteAnaconda, PredaplantVerteAnacondaSummon);
AddExecutor(ExecutorType.Activate, CardId.MagicalizedFusion, MagicalizedFusionEffect);
AddExecutor(ExecutorType.Activate, CardId.PredaplantVerteAnaconda, PredaplantVerteAnacondaEffect);
AddExecutor(ExecutorType.SpellSet, CardId.InfiniteImpermanence, TrapSet);
AddExecutor(ExecutorType.SpellSet, CardId.SolemnStrike, TrapSet);
AddExecutor(ExecutorType.MonsterSet, CardId.Sangan);
}
private bool BeastOLionUsed = false;
private bool RedEyesFusionUsed = false;
public override bool OnSelectHand()
{ {
IList<ClientCard> enemyCards = cards.Where(card => card.Controller == 1).ToList(); // go first
return true;
}
// select enemy's card first public override void OnNewTurn()
while (enemyCards.Count > 0 && selected.Count < max)
{ {
ClientCard card = enemyCards[Program.Rand.Next(enemyCards.Count)]; BeastOLionUsed = false;
selected.Add(card); RedEyesFusionUsed = false;
enemyCards.Remove(card);
cards.Remove(card);
} }
public override CardPosition OnSelectPosition(int cardId, IList<CardPosition> positions)
{
YGOSharp.OCGWrapper.NamedCard cardData = YGOSharp.OCGWrapper.NamedCard.Get(cardId);
if (cardData != null)
{
if (cardData.Attack <= 1000)
return CardPosition.FaceUpDefence;
}
return 0;
} }
if (HintMsgForMaxSelect.Contains(hint)) public override int OnSelectPlace(int cardId, int player, CardLocation location, int available)
{ {
// select max cards if (location == CardLocation.MonsterZone)
while (selected.Count < max)
{ {
ClientCard card = cards[Program.Rand.Next(cards.Count)]; return available & ~Bot.GetLinkedZones();
selected.Add(card);
cards.Remove(card);
} }
return 0;
} }
return selected; private bool DragunofRedEyesCounter()
{
if (ActivateDescription != -1 && ActivateDescription != Util.GetStringId(CardId.DragunofRedEyes, 1))
return false;
if (Duel.LastChainPlayer != 1)
return false;
AI.SelectCard(new[] {
CardId.RedEyesWyvern,
CardId.MechaPhantomBeastOLion
});
return true;
} }
public override bool OnSelectHand()
private bool DragunofRedEyesDestroy()
{ {
// go first if (ActivateDescription == -1 || ActivateDescription == Util.GetStringId(CardId.DragunofRedEyes, 1))
return false;
AI.SelectCard(Util.GetBestEnemyMonster());
return true; return true;
} }
public bool Monsterset()
private bool ThousandEyesRestrictEffect()
{ {
if (Duel.Turn == 1) AI.SelectCard(Util.GetBestEnemyMonster());
return true;
}
private bool RedEyesInsightEffect()
{ {
if (Bot.HasInHand(CardId.RedEyesFusion))
return false;
if (Bot.GetRemainingCount(CardId.RedEyesWyvern, 1) == 0 && Bot.GetRemainingCount(CardId.RedEyesBDragon, 2) == 1 && !Bot.HasInHand(CardId.RedEyesBDragon))
return false;
AI.SelectCard(CardId.RedEyesWyvern);
return true; return true;
} }
else if (Bot.HasInHand(new[] {
CardId.连击龙, private bool RedEyesFusionEffect()
CardId.青眼白龙, {
CardId.人造人, if (Bot.HasInMonstersZone(new[] { CardId.DragunofRedEyes, CardId.RedEyesBDragon }))
CardId.破坏之剑士, { // you don't want to use DragunofRedEyes which is treated as RedEyesBDragon as fusion material
if (Util.GetBotAvailZonesFromExtraDeck() == 0)
return false;
if (Bot.GetRemainingCount(CardId.RedEyesBDragon, 2) == 0 && !Bot.HasInHand(CardId.RedEyesBDragon))
return false;
}
AI.SelectMaterials(CardLocation.Deck);
RedEyesFusionUsed = true;
return true;
}
})) private bool TourGuideFromTheUnderworldSummon()
{
if (Bot.GetRemainingCount(CardId.TourGuideFromTheUnderworld, 2) == 0 && Bot.GetRemainingCount(CardId.Sangan, 2) == 0)
return false; return false;
return true; return true;
} }
private bool 落穴Effect() private bool TourGuideFromTheUnderworldEffect()
{ {
foreach (ClientCard n in Duel.LastSummonedCards) AI.SelectCard(CardId.Sangan);
return true;
}
private bool SanganSummon()
{ {
if (n.Attack >= 1900)
return true; return true;
} }
return false; private bool SanganEffect()
{
if (Bot.HasInMonstersZone(CardId.SalamangreatAlmiraj) && !Bot.HasInHand(CardId.CrusadiaArboria))
AI.SelectCard(CardId.CrusadiaArboria);
else if (!Bot.HasInHand(CardId.MaxxC))
AI.SelectCard(CardId.MaxxC);
else if (!Bot.HasInHand(CardId.AshBlossomJoyousSpring))
AI.SelectCard(CardId.AshBlossomJoyousSpring);
else if (!Bot.HasInHand(CardId.MagiciansSouls))
AI.SelectCard(CardId.MagiciansSouls);
else if (!Bot.HasInHand(CardId.CrusadiaArboria))
AI.SelectCard(CardId.CrusadiaArboria);
else
AI.SelectCard(new[] {
CardId.AshBlossomJoyousSpring,
CardId.MaxxC,
CardId.CrusadiaArboria
});
return true;
} }
private bool 圣防Effect()
private bool SalamangreatAlmirajSummon()
{ {
if (Util.GetTotalAttackingMonsterAttack(1) > 1900) int[] materials = new[] {
return true; CardId.Sangan,
CardId.MechaPhantomBeastOLion
};
if (Bot.MonsterZone.GetMatchingCardsCount(card => card.IsCode(materials) && !card.IsSpecialSummoned) == 0)
return false; return false;
AI.SelectMaterials(materials);
return true;
} }
private bool 炸甲Effect()
private bool ImdukTheWorldChaliceDragonSummon()
{ {
if (Enemy.BattlingMonster.Attack > 1500) return true; if (Bot.HasInMonstersZone(CardId.PredaplantVerteAnaconda, true) || !Bot.HasInExtra(CardId.PredaplantVerteAnaconda))
if (Bot.LifePoints <= Enemy.BattlingMonster.Attack) return true; return false;
if (!Util.IsOneEnemyBetterThanValue(1500, true) && Bot.GetSpellCountWithoutField() == 3) return true; if (Bot.Graveyard.GetMatchingCardsCount(card => (card.Race & (int)CardRace.Dragon) > 0) >= 0)
return false; return false;
if (Bot.GetMonsterCount() == 1 && Bot.Hand.GetMatchingCardsCount(card => card.Level <= 4) == 0 && !Util.IsTurn1OrMain2())
return false;
if (Bot.GetMonsterCount() >= 2 && Bot.MonsterZone.GetMatchingCardsCount(card => card.Level >= 8) > 0)
return false;
return true;
} }
private bool 死苏effect()
private bool LinkSpiderSummon()
{ {
IList<int> targets = new[] { if (!Bot.HasInMonstersZone(CardId.MechaPhantomBeastOLionToken))
CardId.青眼白龙, return false;
CardId.破坏之剑士, AI.SelectMaterials(CardId.MechaPhantomBeastOLionToken);
CardId.连击龙, return true;
CardId.人造人, }
};
if (!Bot.HasInGraveyard(targets) && !Enemy.HasInGraveyard(targets)) private bool NeedMonster()
{ {
if (Bot.HasInMonstersZone(CardId.PredaplantVerteAnaconda, true) || !Bot.HasInExtra(CardId.PredaplantVerteAnaconda))
return false; return false;
if (Bot.MonsterZone.GetMatchingCardsCount(card => card.Level >= 8) > 0)
return false;
if (Bot.GetMonsterCount() == 0 && Bot.Hand.GetMatchingCardsCount(card => card.Level <= 4) == 0)
return false;
if (Bot.GetMonsterCount() >= 2)
return false;
return true;
} }
AI.SelectCard(targets);
private bool InstantFusionEffect()
{
if (!NeedMonster())
return false;
if (Enemy.GetMonsterCount() > 0)
AI.SelectCard(CardId.ThousandEyesRestrict);
else
AI.SelectCard(CardId.SeaMonsterofTheseus);
return true; return true;
} }
private bool 死苏effect2()
private bool SummonForMaterial()
{ {
List<ClientCard> cards = new List<ClientCard>(Bot.Graveyard.GetMatchingCards(card => card.IsCanRevive())); if (Bot.HasInMonstersZone(CardId.PredaplantVerteAnaconda, true) || !Bot.HasInExtra(CardId.PredaplantVerteAnaconda))
cards.Sort(CardContainer.CompareCardAttack); return false;
ClientCard selectedCard = null; if (Bot.MonsterZone.GetMatchingCardsCount(card => (card.HasType(CardType.Effect) || card.IsTuner()) && card.Level < 8) == 1)
for (int i = cards.Count - 1; i >= 0; --i) return true;
if (Bot.HasInHand(CardId.MagiciansSouls))
return true;
return false;
}
private bool MagiciansSoulsEffect()
{ {
ClientCard card = cards[i]; if (Card.Location == CardLocation.Hand)
if (card.Attack < 2000)
break;
if (card.IsMonster())
{ {
selectedCard = card; if (RedEyesFusionUsed)
break; return false;
} if (Bot.GetMonsterCount() >= 2)
return false;
AI.SelectOption(1);
AI.SelectYesNo(true);
return true;
} }
cards = new List<ClientCard>(Enemy.Graveyard.GetMatchingCards(card => card.IsCanRevive())); else
cards.Sort(CardContainer.CompareCardAttack);
for (int i = cards.Count - 1; i >= 0; --i)
{ {
ClientCard card = cards[i]; int[] costs = new[] {
if (card.Attack < 2000) CardId.RedEyesInsight,
break; CardId.RedEyesFusion
if (card.IsMonster() && card.HasType(CardType.Normal) && (selectedCard == null || card.Attack > selectedCard.Attack)) };
if (Bot.HasInHand(costs))
{ {
selectedCard = card; AI.SelectCard(costs);
break; return true;
}
return false;
} }
} }
if (selectedCard != null)
private bool PredaplantVerteAnacondaSummon()
{
if (Bot.HasInMonstersZone(CardId.PredaplantVerteAnaconda, true))
return false;
int[] materials = new[] {
CardId.ImdukTheWorldChaliceDragon,
CardId.Sangan,
CardId.TourGuideFromTheUnderworld,
CardId.CrusadiaArboria,
CardId.MechaPhantomBeastOLion,
CardId.MagiciansSouls,
CardId.SalamangreatAlmiraj,
CardId.LinkSpider,
CardId.ThousandEyesRestrict,
CardId.AshBlossomJoyousSpring,
CardId.MaxxC,
CardId.RedEyesWyvern,
CardId.CrystronHalqifibrax
};
if (Bot.MonsterZone.GetMatchingCardsCount(card => card.IsCode(materials)) >= 2)
{ {
AI.SelectCard(selectedCard); AI.SelectMaterials(materials);
return true; return true;
} }
return false; return false;
} }
private bool 成金恐龙王Effect()
private bool MagicalizedFusionEffect()
{ {
AI.SelectCard(CardId.成金哥布林); if (Bot.HasInMonstersZone(new[] { CardId.DragunofRedEyes, CardId.RedEyesBDragon }))
{ // you don't want to use DragunofRedEyes which is treated as RedEyesBDragon as fusion material
if (Util.GetBotAvailZonesFromExtraDeck() == 0)
return false;
if (Bot.Graveyard.GetMatchingCardsCount(card => (card.Race & (int)CardRace.Dragon) > 0) == 0)
return false;
}
AI.SelectMaterials(CardLocation.Grave);
return true; return true;
} }
private bool 成金恐龙王Summon()
private bool PredaplantVerteAnacondaEffect()
{ {
if (Enemy.GetHandCount() < 1) return true; if (ActivateDescription == Util.GetStringId(CardId.PredaplantVerteAnaconda, 0))
return false; return false;
AI.SelectCard(CardId.RedEyesFusion);
AI.SelectMaterials(CardLocation.Deck);
return true;
} }
private bool 栗子summon()
private bool FoolishBurialEffect()
{ {
if (Bot.HasInGraveyard(CardId.机器栗子) && Bot.GetMonstersInMainZone().Count == 0) if (RedEyesFusionUsed)
return true;
return false; return false;
if (Bot.HasInHand(CardId.MagicalizedFusion))
{
if (Bot.HasInGraveyard(CardId.DarkMagician) && Bot.Graveyard.GetMatchingCardsCount(card => (card.Race & (int)CardRace.Dragon) > 0) == 0)
{
AI.SelectCard(new[]
{
CardId.RedEyesWyvern,
CardId.RedEyesBDragon
});
return true;
} }
private bool 栗子summon2() if (!Bot.HasInGraveyard(CardId.DarkMagician) && Bot.Graveyard.GetMatchingCardsCount(card => (card.Race & (int)CardRace.Dragon) > 0) > 0)
{ {
if (Bot.HasInGraveyard(CardId.机器栗子) && Bot.GetMonstersInMainZone().Count == 1) AI.SelectCard(CardId.DarkMagician);
return true; return true;
}
}
if (!NeedMonster())
return false; return false;
AI.SelectCard(new[] {
CardId.MechaPhantomBeastOLion
});
return true;
} }
private bool 凤凰龙summon()
private bool MonsterRebornEffect()
{ {
if (Bot.HasInGraveyard(new[] { CardId.连击龙, CardId.青眼白龙 }) && if (Bot.HasInGraveyard(CardId.DragunofRedEyes))
Bot.MonsterZone.GetMatchingCardsCount(card => card.Level > 4) < 2 &&
(Bot.MonsterZone.GetMatchingCardsCount(card => card.Level < 5) + Bot.Hand.GetMatchingCardsCount(card => card.Level < 5)) <= 2)
{ {
AI.SelectCard(CardId.DragunofRedEyes);
return true; return true;
} }
else
{
if (!NeedMonster())
return false; return false;
AI.SelectCard(new[] {
CardId.PredaplantVerteAnaconda,
CardId.Sangan,
CardId.ThousandEyesRestrict,
CardId.MechaPhantomBeastOLion,
CardId.CrusadiaArboria,
CardId.AshBlossomJoyousSpring
});
return true;
}
} }
private bool 死供Effect() private bool MechaPhantomBeastOLionEffect()
{ {
if (Util.IsOneEnemyBetterThanValue(1900, false)) if (ActivateDescription == -1)
{ {
foreach (ClientCard m in Bot.Hand) BeastOLionUsed = true;
AI.SelectCard(m);
foreach (ClientCard mon in Enemy.GetMonsters())
if (mon.Level >= 9)
AI.SelectNextCard(mon);
else if (mon.Level >= 8)
AI.SelectNextCard(mon);
else if (mon.Level >= 7)
AI.SelectNextCard(mon);
return true; return true;
} }
return false; return !BeastOLionUsed;
} }
private bool 斗牛士Effect()
private bool CrystronNeedlefiberSummon()
{ {
if (Bot.HasInMonstersZone(CardId.PredaplantVerteAnaconda, true))
return false;
//if (Util.IsOneEnemyBetterThanValue(1900, false)) int[] materials = new[] {
CardId.CrusadiaArboria,
CardId.MechaPhantomBeastOLion,
CardId.AshBlossomJoyousSpring,
CardId.SeaMonsterofTheseus,
CardId.MechaPhantomBeastOLionToken,
CardId.DarkMagician,
CardId.ImdukTheWorldChaliceDragon,
CardId.Sangan,
CardId.TourGuideFromTheUnderworld,
CardId.MagiciansSouls,
CardId.SalamangreatAlmiraj,
CardId.LinkSpider,
CardId.ThousandEyesRestrict,
CardId.SeaMonsterofTheseus,
CardId.MaxxC,
CardId.RedEyesWyvern
};
if (Bot.MonsterZone.GetMatchingCardsCount(card => card.IsCode(materials)) >= 2)
{ {
foreach (ClientCard o in Bot.Graveyard) AI.SelectMaterials(materials);
AI.SelectCard(o);
if (Enemy.GetMonsters().GetHighestAttackMonster() == null)
AI.SelectNextCard(Enemy.MonsterZone.GetHighestAttackMonster());
return true; return true;
} }
// return false; return false;
} }
private bool 圣防Repos()
private bool CrystronNeedlefiberEffect()
{ {
if (Enemy.Graveyard.GetMatchingCardsCount(card => (card.Race & (int)CardRace.SpellCaster) > 0) >= 4 && Enemy.GetSpellCountWithoutField() >= 1 && !Bot.HasInMonstersZone(CardId.人造人) && Enemy.Graveyard.GetMatchingCardsCount(card => card.IsCode(CardId.暗黑释放)) < 3) if (Duel.Player == 0)
{ {
if (Bot.MonsterZone.GetMatchingCardsCount(card => card.IsAttack() && card.Level >= 5) >= 2 && !Bot.HasDefendingMonster()) AI.SelectCard(CardId.MechaPhantomBeastOLion);
return true; return true;
} }
return false; else
{
return true;
} }
} }
}
private bool TrapSet()
{
if (Bot.HasInMonstersZone(new[] { CardId.DragunofRedEyes, CardId.RedEyesBDragon }) && Bot.GetHandCount() == 1)
return false;
AI.SelectPlace(Zones.z0 + Zones.z1 + Zones.z3 + Zones.z4);
return true;
}
private bool MonsterRepos()
{
if (Card.IsFacedown())
return true;
return DefaultMonsterRepos();
}
}
}
using YGOSharp.OCGWrapper.Enums;
using System.Collections.Generic;
using System.Linq;
using WindBot;
using WindBot.Game;
using WindBot.Game.AI;
using System;
namespace WindBot.Game.AI.Decks
{
[Deck("Excutie", "AI_Excutie")]
public class ExcutieExecutor : DefaultExecutor
{
public class CardId
{
public const int 夜魔女 = 120231034;
public const int 光天女 = 120231031;
public const int 浮游女 = 120231033;
public const int 遥控女 = 120231035;
public const int 救火女 = 120235019;
public const int 细剑女 = 120231032;
public const int 主存女 = 120231036;
public const int 花草女 = 120231037;
public const int 劈裂史莱姆 = 120222036;
public const int 紧急出动 = 120231039;
public const int 天之选别 = 120231065;
public const int 紧急事态 = 120231040;
public const int 幻影咆哮 = 120235065;
}
public ExcutieExecutor(GameAI ai, Duel duel)
: base(ai, duel)
{
AddExecutor(ExecutorType.Activate, _CardId.黑洞, 黑洞Effect);
AddExecutor(ExecutorType.Activate, _CardId.傲慢之壶);
AddExecutor(ExecutorType.Activate, CardId.天之选别);
AddExecutor(ExecutorType.Activate, _CardId.圣防, 圣防Effect);
AddExecutor(ExecutorType.Activate, _CardId.捕获, 圣塔Effect);
AddExecutor(ExecutorType.Activate, _CardId.亚龙地狱, 亚龙地狱Effect);
AddExecutor(ExecutorType.Activate, CardId.紧急事态);
AddExecutor(ExecutorType.Activate, CardId.幻影咆哮);
AddExecutor(ExecutorType.SpSummon, CardId.夜魔女);
AddExecutor(ExecutorType.SpSummon, CardId.光天女);
AddExecutor(ExecutorType.SpSummon, CardId.细剑女);
AddExecutor(ExecutorType.SpSummon, CardId.救火女);
AddExecutor(ExecutorType.SpSummon, CardId.花草女);
AddExecutor(ExecutorType.Activate, CardId.紧急出动, 紧急出动Effect);
AddExecutor(ExecutorType.SpellSet, _CardId.黑洞);
AddExecutor(ExecutorType.SpellSet, _CardId.圣防);
AddExecutor(ExecutorType.SpellSet, _CardId.傲慢之壶);
AddExecutor(ExecutorType.SpSummon, CardId.救火女, 救火女Sp);
AddExecutor(ExecutorType.Activate, CardId.花草女);
AddExecutor(ExecutorType.Activate, CardId.遥控女, 遥控女Effect1);
AddExecutor(ExecutorType.Activate, CardId.浮游女, 浮游女Effect);
AddExecutor(ExecutorType.Activate, CardId.光天女, 光天女Effect);
AddExecutor(ExecutorType.Activate, CardId.主存女, 主存女Effect);
AddExecutor(ExecutorType.Activate, _CardId.海龙骑士, 海龙骑士Effect);
AddExecutor(ExecutorType.Activate, CardId.劈裂史莱姆, 劈裂史莱姆Effect);
AddExecutor(ExecutorType.Summon, CardId.夜魔女, 超可爱summon);
AddExecutor(ExecutorType.Summon, CardId.浮游女, 超可爱summon);
AddExecutor(ExecutorType.Summon, CardId.浮游女, 超可爱summon3);
AddExecutor(ExecutorType.Summon, CardId.光天女, 超可爱summon);
AddExecutor(ExecutorType.Summon, _CardId.幻影之龙);
AddExecutor(ExecutorType.Summon, CardId.救火女, 超可爱summon);
AddExecutor(ExecutorType.Summon, CardId.细剑女, 超可爱summon);
AddExecutor(ExecutorType.Summon, CardId.遥控女, 超可爱summon2);
AddExecutor(ExecutorType.Summon, CardId.主存女, 超可爱summon2);
AddExecutor(ExecutorType.Activate, CardId.紧急出动, 紧急出动Effect2);
AddExecutor(ExecutorType.Activate, CardId.救火女, 救火女Effect1);
AddExecutor(ExecutorType.MonsterSet, _CardId.海龙骑士,海龙set);
AddExecutor(ExecutorType.MonsterSet, _CardId.结界像,结界像set);
AddExecutor(ExecutorType.MonsterSet, CardId.劈裂史莱姆);
AddExecutor(ExecutorType.Summon, _CardId.海龙骑士);
AddExecutor(ExecutorType.Summon, _CardId.结界像);
AddExecutor(ExecutorType.Summon, CardId.劈裂史莱姆);
AddExecutor(ExecutorType.Activate, CardId.遥控女, 遥控女Effect2);
AddExecutor(ExecutorType.Activate, CardId.救火女, 救火女Effect2);
AddExecutor(ExecutorType.Activate, DefaultDontChainMyself);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
AddExecutor(ExecutorType.Repos, CardId.花草女, 圣防Repos);
AddExecutor(ExecutorType.Repos, CardId.主存女, 圣防Repos);
AddExecutor(ExecutorType.Repos, CardId.细剑女, 圣防Repos);
AddExecutor(ExecutorType.Repos, CardId.救火女, 圣防Repos);
AddExecutor(ExecutorType.Repos, CardId.遥控女, 圣防Repos);
AddExecutor(ExecutorType.Repos, CardId.浮游女, 圣防Repos);
AddExecutor(ExecutorType.Repos, CardId.光天女, 圣防Repos);
AddExecutor(ExecutorType.Repos, CardId.夜魔女, 圣防Repos);
AddExecutor(ExecutorType.SummonOrSet, ImFeelingLazy);
AddExecutor(ExecutorType.SpellSet);
}
bool atkup = false;
public override void OnNewTurn()
{
atkup = false;
}
private IList<int> targets = new[] {
CardId.夜魔女, CardId.光天女, CardId.细剑女, CardId.救火女, CardId.遥控女, CardId.主存女, CardId.花草女};
private IList<int> tar = new[] {
CardId.花草女, CardId.主存女, CardId.遥控女, CardId.救火女, CardId.浮游女,CardId.光天女,CardId.细剑女};
private bool 救火女Sp()
{
int topattack = (Bot.MonsterZone.GetMatchingCardsCount(card => card.Level == 6) + Enemy.MonsterZone.GetMatchingCardsCount(card => card.Level == 6)) * 600 + 1700;
if (Util.IsOneEnemyBetter() && !atkup &&
Util.GetBestAttack(Enemy) < topattack)
return true;
return false;
}
private bool 超可爱summon3()
{
int tributecount = 1;
IList<int> ssmon = new[] {
CardId.花草女, CardId.细剑女, CardId.救火女, CardId.夜魔女};
if ((Bot.MonsterZone.GetMonsters().Count <= 2) && (Bot.HasInMonstersZoneOrInGraveyard(ssmon)))
for (int j = 0; j < 7; ++j)
{
ClientCard tributeCard = Bot.MonsterZone[j];
if (tributeCard == null) continue;
if (tributeCard.IsCode(ssmon))
tributecount--;
}
return tributecount <= 0;
}
private bool 超可爱summon2()
{
int tributecount = 1;
for (int j = 0; j < 7; ++j)
{
ClientCard tributeCard = Bot.MonsterZone[j];
if (tributeCard == null) continue;
if (tributeCard.GetDefensePower() < 1500)
tributecount--;
}
return tributecount <= 0;
}
private bool 超可爱summon()
{
int tributecount = 1;
for (int j = 0; j < 7; ++j)
{
ClientCard tributeCard = Bot.MonsterZone[j];
if (tributeCard == null) continue;
if (tributeCard.GetDefensePower() < 1550)
tributecount--;
}
return tributecount <= 0;
}
private bool 救火女Effect1()
{
int topattack = (Bot.MonsterZone.GetMatchingCardsCount(card => card.Level == 6) + Enemy.MonsterZone.GetMatchingCardsCount(card => card.Level == 6)) * 600 + 1700;
if (Util.IsOneEnemyBetter() && !atkup &&
Util.GetBestAttack(Enemy) < topattack)
{
foreach (ClientCard m in Bot.Hand)
AI.SelectCard(m);
atkup = true;
return true;
}
return false;
}
private bool 救火女Effect2()
{
if (!atkup)
{
int topattack = (Bot.MonsterZone.GetMatchingCardsCount(card => card.Level == 6) + Enemy.MonsterZone.GetMatchingCardsCount(card => card.Level == 6)) * 600 +1700;
if (Util.GetTotalAttackingMonsterAttack(0) < topattack ||
(topattack >= Enemy.LifePoints + Enemy.GetMonsters().GetLowestAttackMonster().Attack))
{
foreach (ClientCard m in Bot.Hand)
AI.SelectCard(m);
atkup = true;
return true;
}
}
return false;
}
private bool 光天女Effect()
{
var mon = Enemy.MonsterZone.GetMatchingCards(card => card.Level == 7 || card.Level == 8).OrderByDescending(card => card.Attack).FirstOrDefault();
if (mon != null)
{
AI.SelectCard(tar);
AI.SelectNextCard(mon);
return true;
}
return false;
}
private bool 主存女Effect()
{
AI.SelectCard(tar);
AI.SelectNextCard(Enemy.GetSpells());
return true;
}
private bool 浮游女Effect()
{
AI.SelectCard(targets);
return true;
}
private bool 遥控女Effect2()
{
foreach (ClientCard mon in Enemy.GetMonsters())
if (mon.IsFacedown())
{
AI.SelectCard(targets);
AI.SelectNextCard(mon);
return true;
}
return false;
}
private bool 遥控女Effect1()
{
var mon = Enemy.MonsterZone.GetHighestAttackMonster();
if(mon.Attack > 1800 && mon.Defense < Util.GetBestBotMonster().Attack)
AI.SelectCard(targets);
AI.SelectNextCard(mon);
return true;
}
private bool 紧急出动Effect()
{
if(Bot.HasInGraveyard(targets)|| (Bot.GetMonsterCount() == 0 && Bot.HasInHandOrInGraveyard(targets)))
AI.SelectCard(targets);
return true;
}
private bool 紧急出动Effect2()
{
if (Bot.HasInHand(targets))
AI.SelectCard(CardId.夜魔女, CardId.光天女, CardId.细剑女);
return true;
}
private bool 劈裂史莱姆Effect()
{
var mon = Enemy.MonsterZone.GetHighestAttackMonster();
int att = Bot.MonsterZone.GetHighestAttackMonster().Attack;
if (mon.Attack <= att + 1000 && mon.Attack > att)
{
AI.SelectCard(tar);
AI.SelectNextCard(mon);
AI.SelectThirdCard(_CardId.幻影之龙);
return true;
}
if ((Bot.HasInMonstersZone(CardId.花草女) || Bot.HasInMonstersZone(CardId.主存女)) && Bot.HasInGraveyard(_CardId.幻影之龙))
{
AI.SelectCard(CardId.花草女,CardId.主存女);
AI.SelectNextCard(mon);
AI.SelectThirdCard(_CardId.幻影之龙);
return true;
}
return false;
}
private bool 结界像set()
{
return Util.IsOneEnemyBetter();
}
private bool 海龙set()
{
if ((Util.IsOneEnemyBetter() || Duel.Turn == 1))
{
if (Enemy.GetSpellCount() ==0 || Bot.GetSpellCount() < 2)
return true;
}
return false;
}
private List<int> HintMsgForEnemy = new List<int>
{
HintMsg.Release, HintMsg.Destroy, HintMsg.Remove, HintMsg.ToGrave, HintMsg.ReturnToHand, HintMsg.ToDeck,
HintMsg.FusionMaterial, HintMsg.SynchroMaterial, HintMsg.XyzMaterial, HintMsg.LinkMaterial, HintMsg.Disable
};
private List<int> HintMsgForDeck = new List<int>
{
HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.Remove, HintMsg.AddToHand, HintMsg.FusionMaterial
};
private List<int> HintMsgForExtra = new List<int>
{
HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.Remove, HintMsg.AddToHand, HintMsg.FusionMaterial
};
private List<int> HintMsgForSelf = new List<int>
{
HintMsg.Equip
};
private List<int> HintMsgForMaterial = new List<int>
{
HintMsg.FusionMaterial, HintMsg.SynchroMaterial, HintMsg.XyzMaterial, HintMsg.LinkMaterial, HintMsg.Release
};
private List<int> HintMsgForMaxSelect = new List<int>
{
HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.AddToHand, HintMsg.FusionMaterial, HintMsg.Destroy, HintMsg.Equip ,HintMsg.Confirm
};
public override IList<ClientCard> OnSelectCard(IList<ClientCard> _cards, int min, int max, int hint, bool cancelable)
{
if (Duel.Phase == DuelPhase.BattleStart)
return null;
if (AI.HaveSelectedCards())
return null;
IList<ClientCard> selected = new List<ClientCard>();
IList<ClientCard> cards = new List<ClientCard>(_cards);
if (max > cards.Count)
max = cards.Count;
if (HintMsgForEnemy.Contains(hint))
{
IList<ClientCard> enemyCards = cards.Where(card => card.Controller == 1).ToList();
// select enemy's card first
while (enemyCards.Count > 0 && selected.Count < max)
{
ClientCard card = enemyCards[Program.Rand.Next(enemyCards.Count)];
selected.Add(card);
enemyCards.Remove(card);
cards.Remove(card);
}
}
if (HintMsgForDeck.Contains(hint))
{
IList<ClientCard> deckCards = cards.Where(card => card.Location == CardLocation.Deck).ToList();
// select deck's card first
while (deckCards.Count > 0 && selected.Count < max)
{
ClientCard card = deckCards[Program.Rand.Next(deckCards.Count)];
selected.Add(card);
deckCards.Remove(card);
cards.Remove(card);
}
}
if (HintMsgForExtra.Contains(hint))
{
IList<ClientCard> ExtraCards = cards.Where(card => card.Location == CardLocation.Extra).ToList();
// select extra's card first
while (ExtraCards.Count > 0 && selected.Count < max)
{
ClientCard card = ExtraCards[Program.Rand.Next(ExtraCards.Count)];
selected.Add(card);
ExtraCards.Remove(card);
cards.Remove(card);
}
}
if (HintMsgForSelf.Contains(hint))
{
IList<ClientCard> botCards = cards.Where(card => card.Controller == 0).ToList();
// select bot's card first
while (botCards.Count > 0 && selected.Count < max)
{
ClientCard card = botCards[Program.Rand.Next(botCards.Count)];
selected.Add(card);
botCards.Remove(card);
cards.Remove(card);
}
}
if (HintMsgForMaterial.Contains(hint))
{
IList<ClientCard> materials = cards.OrderBy(card => card.Attack).ToList();
// select low attack first
while (materials.Count > 0 && selected.Count < min)
{
ClientCard card = materials[0];
selected.Add(card);
materials.Remove(card);
cards.Remove(card);
}
}
// select random cards
while (selected.Count < min)
{
ClientCard card = cards[Program.Rand.Next(cards.Count)];
selected.Add(card);
cards.Remove(card);
}
if (HintMsgForMaxSelect.Contains(hint))
{
// select max cards
while (selected.Count < max)
{
ClientCard card = cards[Program.Rand.Next(cards.Count)];
selected.Add(card);
cards.Remove(card);
}
}
return selected;
}
public override int OnSelectOption(IList<int> options)
{
return Program.Rand.Next(options.Count);
}
public override CardPosition OnSelectPosition(int cardId, IList<CardPosition> positions)
{
YGOSharp.OCGWrapper.NamedCard cardData = YGOSharp.OCGWrapper.NamedCard.Get(cardId);
if (cardData != null)
{
if (cardData.Attack < 0)
return CardPosition.FaceUpAttack;
if (cardData.Attack <= 1000)
return CardPosition.FaceUpDefence;
}
return 0;
}
public override bool OnSelectHand()
{
// go first
return true;
}
public void RandomSort(List<ClientCard> list)
{
int n = list.Count;
while (n-- > 1)
{
int index = Program.Rand.Next(n + 1);
ClientCard temp = list[index];
list[index] = list[n];
list[n] = temp;
}
}
public ClientCard GetBestEnemyCard_random()
{
// monsters
ClientCard card = Util.GetProblematicEnemyMonster(0, true);
if (card != null)
return card;
if (Util.GetOneEnemyBetterThanMyBest() != null)
{
card = Enemy.MonsterZone.GetHighestAttackMonster(true);
if (card != null)
return card;
}
// spells
List<ClientCard> enemy_spells = Enemy.GetSpells();
RandomSort(enemy_spells);
foreach (ClientCard sp in enemy_spells)
{
if (sp.IsFaceup() && !sp.IsDisabled()) return sp;
}
if (enemy_spells.Count > 0) return enemy_spells[0];
List<ClientCard> monsters = Enemy.GetMonsters();
if (monsters.Count > 0)
{
RandomSort(monsters);
return monsters[0];
}
return null;
}
private bool ImFeelingLazy()
{
if (Executors.Any(exec => (exec.Type == ExecutorType.SummonOrSet || exec.Type == ExecutorType.Summon || exec.Type == ExecutorType.MonsterSet) && exec.CardId == Card.Id))
return false;
return DefaultMonsterSummon();
}
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
using YGOSharp.OCGWrapper.Enums;
using System.Collections.Generic;
using System.Linq;
using WindBot;
using WindBot.Game;
using WindBot.Game.AI;
namespace WindBot.Game.AI.Decks
{
[Deck("Kashtira", "AI_Kashtira")]
class KashtiraExecutor : DefaultExecutor
{
public class CardId
{
public const int Nibiru = 27204311;
public const int KashtiraUnicorn = 68304193;
public const int KashtiraFenrir = 32909498;
public const int KashtiraTearlaments = 4928565;
public const int KashtiraScareclaw = 78534861;
public const int DimensionShifter = 91800273;
public const int NemesesCorridor = 72090076;
public const int KashtiraRiseheart = 31149212;
public const int G = 23434538;
public const int AshBlossom = 14558127;
public const int MechaPhantom = 31480215;
public const int Terraforming = 73628505;
public const int PotofProsperity = 84211599;
public const int KashtiraPapiyas = 34447918;
public const int CalledbytheGrave = 24224830;
public const int CrossoutDesignator = 65681983;
public const int KashtiraBirth = 69540484;
public const int PrimePlanetParaisos = 71832012;
public const int KashtiraBigBang = 33925864;
public const int InfiniteImpermanence = 10045474;
public const int ThunderDragonColossus = 15291624;
public const int BorreloadSavageDragon = 27548199;
public const int CupidPitch = 21915012;
public const int KashtiraAriseHeart = 48626373;
public const int DiablosistheMindHacker = 95474755;
public const int KashtiraShangriIra = 73542331;
public const int GalaxyTomahawk = 10389142;
public const int BagooskatheTerriblyTiredTapir = 90590303;
public const int MekkKnightCrusadiaAvramax = 21887175;
public const int MechaPhantomBeastAuroradon = 44097050;
public const int QliphortGenius = 22423493;
public const int IP = 65741786;
public const int Token = 10389143;
public const int Token_2 = 44097051;
}
bool isSummoned = false;
bool onlyXyzSummon = false;
bool activate_KashtiraUnicorn_1 = false;
bool activate_KashtiraFenrir_1 = false;
bool activate_KashtiraRiseheart_1 = false;
bool activate_KashtiraRiseheart_2 = false;
bool activate_PrimePlanetParaisos = false;
bool activate_KashtiraScareclaw_1 = false;
bool activate_KashtiraShangriIra = false;
bool activate_KashtiraTearlaments_1 = false;
bool activate_DimensionShifter = false;
bool activate_pre_PrimePlanetParaisos = false;
bool activate_pre_PrimePlanetParaisos_2 = false;
bool active_KashtiraPapiyas_1 = false;
bool active_KashtiraPapiyas_2 = false;
bool active_KashtiraBirth = false;
bool active_NemesesCorridor = false;
bool select_CalledbytheGrave = false;
bool summon_KashtiraUnicorn = false;
bool summon_KashtiraFenrir = false;
bool link_mode = false;
bool opt_0 = false;
bool opt_1 = false;
bool opt_2 = false;
int flag = -1;
int pre_link_mode = -1;
List<ClientCard> select_Cards = new List<ClientCard>();
List<int> Impermanence_list = new List<int>();
List<int> should_not_negate = new List<int>
{
81275020, 28985331
};
public KashtiraExecutor(GameAI ai, Duel duel)
: base(ai, duel)
{
AddExecutor(ExecutorType.Activate, CardId.ThunderDragonColossus);
AddExecutor(ExecutorType.SpSummon, CardId.ThunderDragonColossus);
AddExecutor(ExecutorType.Activate, CardId.Nibiru, NibiruEffect);
AddExecutor(ExecutorType.Activate, CardId.InfiniteImpermanence, Impermanence_activate);
AddExecutor(ExecutorType.Activate, CardId.DimensionShifter, DimensionShifterEffect);
AddExecutor(ExecutorType.Activate, CardId.G, DefaultMaxxC);
AddExecutor(ExecutorType.Activate, CardId.AshBlossom, DefaultAshBlossomAndJoyousSpring);
AddExecutor(ExecutorType.Activate, CardId.CalledbytheGrave, CalledbytheGraveEffect);
AddExecutor(ExecutorType.Activate, CardId.BorreloadSavageDragon, BorreloadSavageDragonEffect);
AddExecutor(ExecutorType.Activate, CardId.CrossoutDesignator, CrossoutDesignatorEffect);
AddExecutor(ExecutorType.Activate, CardId.Terraforming, TerraformingEffect);
AddExecutor(ExecutorType.Activate, CardId.PotofProsperity, PotofProsperityEffect);
AddExecutor(ExecutorType.Activate, CardId.KashtiraUnicorn, KashtiraUnicornEffect);
AddExecutor(ExecutorType.Activate, CardId.KashtiraFenrir, KashtiraFenrirEffect);
AddExecutor(ExecutorType.Activate, CardId.PrimePlanetParaisos, PrimePlanetParaisosEffect);
AddExecutor(ExecutorType.Activate, CardId.KashtiraBirth, KashtiraBirthEffect);
AddExecutor(ExecutorType.Activate, CardId.DiablosistheMindHacker, DiablosistheMindHackerEffect);
AddExecutor(ExecutorType.SpSummon, CardId.KashtiraFenrir, KashtiraFenrirSummon);
AddExecutor(ExecutorType.SpSummon, CardId.KashtiraUnicorn,() => { summon_KashtiraUnicorn = true; return true; });
AddExecutor(ExecutorType.SpSummon, CardId.KashtiraFenrir, () => { summon_KashtiraFenrir = true; return true; });
AddExecutor(ExecutorType.Summon, CardId.KashtiraUnicorn, DefaultSummon);
AddExecutor(ExecutorType.Summon, CardId.KashtiraFenrir, DefaultSummon);
AddExecutor(ExecutorType.Activate, CardId.KashtiraPapiyas, KashtiraPapiyasEffect);
AddExecutor(ExecutorType.Activate, CardId.KashtiraTearlaments, KashtiraTearlamentsEffect);
AddExecutor(ExecutorType.Activate, CardId.KashtiraScareclaw, KashtiraScareclawEffect);
AddExecutor(ExecutorType.Activate, CardId.KashtiraBirth, KashtiraBirthEffect_2);
AddExecutor(ExecutorType.Activate, CardId.GalaxyTomahawk);
AddExecutor(ExecutorType.SpSummon, CardId.GalaxyTomahawk, GalaxyTomahawkSummon);
AddExecutor(ExecutorType.SpSummon, CardId.KashtiraShangriIra, KashtiraShangriIraSummon);
AddExecutor(ExecutorType.Activate, CardId.KashtiraShangriIra, KashtiraShangriIraEffect);
AddExecutor(ExecutorType.SpSummon, CardId.KashtiraAriseHeart, KashtiraAriseHeartSummon_2);
AddExecutor(ExecutorType.SpSummon, CardId.DiablosistheMindHacker, DiablosistheMindHackerSummon_2);
AddExecutor(ExecutorType.Activate, CardId.KashtiraAriseHeart, KashtiraAriseHeartEffect);
AddExecutor(ExecutorType.SpSummon, CardId.KashtiraAriseHeart, KashtiraAriseHeartSummon);
AddExecutor(ExecutorType.SpSummon, CardId.DiablosistheMindHacker, DiablosistheMindHackerSummon);
//link mode
AddExecutor(ExecutorType.SpSummon, CardId.QliphortGenius, QliphortGeniusSummon);
AddExecutor(ExecutorType.SpSummon, CardId.IP, IPSummon);
AddExecutor(ExecutorType.Activate, CardId.IP, IPEffect);
AddExecutor(ExecutorType.SpSummon, CardId.MechaPhantomBeastAuroradon, MechaPhantomBeastAuroradonSummon);
AddExecutor(ExecutorType.Activate, CardId.MechaPhantomBeastAuroradon, MechaPhantomBeastAuroradonEffect);
AddExecutor(ExecutorType.SpSummon, CardId.CupidPitch, CupidPitchSummon);
AddExecutor(ExecutorType.Activate, CardId.CupidPitch);
AddExecutor(ExecutorType.SpSummon, CardId.BorreloadSavageDragon, BorreloadSavageDragonSummon);
AddExecutor(ExecutorType.Activate, CardId.NemesesCorridor, NemesesCorridorEffect);
AddExecutor(ExecutorType.SpSummon, CardId.MekkKnightCrusadiaAvramax, MekkKnightCrusadiaAvramaxSummon);
AddExecutor(ExecutorType.Activate, CardId.MekkKnightCrusadiaAvramax, MekkKnightCrusadiaAvramaxEffect);
//link mode
AddExecutor(ExecutorType.Activate, CardId.KashtiraRiseheart, KashtiraRiseheartEffect_2);
AddExecutor(ExecutorType.Activate, CardId.KashtiraRiseheart, KashtiraRiseheartEffect);
AddExecutor(ExecutorType.Activate, CardId.KashtiraBigBang, KashtiraBigBangEffect);
AddExecutor(ExecutorType.Activate, CardId.KashtiraPapiyas, KashtiraPapiyasEffect_2);
AddExecutor(ExecutorType.Activate, CardId.KashtiraBirth, KashtiraBirthEffect_3);
AddExecutor(ExecutorType.Summon, CardId.KashtiraRiseheart, KashtiraRiseheartSummon);
AddExecutor(ExecutorType.Summon, CardId.KashtiraTearlaments, DefaultSummon);
AddExecutor(ExecutorType.SpellSet, SpellSet);
AddExecutor(ExecutorType.Repos, DefaultRepos);
}
public override bool OnSelectHand()
{
// go first
return true;
}
public override void OnNewTurn()
{
if (pre_link_mode < 0) pre_link_mode = Program.Rand.Next(2);
isSummoned = false;
onlyXyzSummon = false;
activate_KashtiraUnicorn_1 = false;
activate_KashtiraFenrir_1 = false;
activate_KashtiraRiseheart_1 = false;
activate_KashtiraRiseheart_2 = false;
activate_PrimePlanetParaisos = false;
activate_KashtiraScareclaw_1 = false;
activate_KashtiraTearlaments_1 = false;
activate_KashtiraShangriIra = false;
activate_pre_PrimePlanetParaisos_2 = false;
active_KashtiraPapiyas_1 = false;
active_KashtiraPapiyas_2 = false;
active_KashtiraBirth = false;
active_NemesesCorridor = false;
link_mode = false;
summon_KashtiraUnicorn = false;
summon_KashtiraFenrir = false;
opt_0 = false;
opt_1 = false;
opt_2 = false;
if (flag >= 0) ++flag;
if (flag >= 2) { flag = -1; activate_DimensionShifter = false; }
}
public override bool OnSelectYesNo(int desc)
{
if (desc == 1149312192)
{
activate_pre_PrimePlanetParaisos = true;
}
return base.OnSelectYesNo(desc);
}
public override CardPosition OnSelectPosition(int cardId, IList<CardPosition> positions)
{
if (cardId == 27204312|| cardId==CardId.MechaPhantom)
{
return CardPosition.FaceUpDefence;
}
return base.OnSelectPosition(cardId, positions);
}
public override int OnSelectOption(IList<int> options)
{
if (options.Count == 2 && options[1] == Util.GetStringId(CardId.KashtiraBirth, 0))
return 1;
if (options.Count == 2 && options.Contains(Util.GetStringId(CardId.KashtiraTearlaments, 1)))
{
return (isEffectByRemove() || Enemy.Deck.Count <= 3) ? 1 : 0;
}
if (options.Contains(Util.GetStringId(CardId.MechaPhantomBeastAuroradon, 3)))
{
if (opt_1) return options.IndexOf(Util.GetStringId(CardId.MechaPhantomBeastAuroradon, 3));
else if (opt_0) return 0;
return options[options.Count - 1];
}
return base.OnSelectOption(options);
}
public override int OnSelectPlace(int cardId, int player, CardLocation location, int available)
{
if (cardId == 0 && player == 1)
{
int zone = 0;
for (int i = 4; i >= 0; --i)
{
zone = (int)System.Math.Pow(2, i);
if ((available & zone) > 0) return zone;
}
}
if (cardId == CardId.GalaxyTomahawk)
{
if ((available & Zones.z5) > 0) return Zones.z5;
if ((available & Zones.z6) > 0) return Zones.z6;
}
return base.OnSelectPlace(cardId, player, location, available);
}
public override IList<ClientCard> OnSelectCard(IList<ClientCard> cards, int min, int max, int hint, bool cancelable)
{
if (cards.Any(card => card != null && card.Location == CardLocation.Extra
&& hint == HintMsg.Remove && min == 1 && max == 1))
{
//Can't get card info in enemy extral.
int index = Program.Rand.Next(cards.Count());
if (index < 0 || index >= cards.Count()) return null;
IList<ClientCard> res = new List<ClientCard>();
res.Add(cards.ElementAtOrDefault(index));
return Util.CheckSelectCount(res, cards, min, max);
}
if (cards.Any(card => card != null && card.Location == CardLocation.Grave && card.Controller == 1)
&& hint == HintMsg.Remove && ((min == 1 && max == 1) || (min == 3 && max == 3)))
{
if (select_CalledbytheGrave) { select_CalledbytheGrave = false; return null; }
List<ClientCard> copyCards = new List<ClientCard>(cards);
List<int> keyCardsId = new List<int>()
{
44097050,15291624,63288573,70369116,83152482,72329844,
24094258,86066372,74997493,85289965,21887175,11738489,
98127546,50588353,10389142,90590303,27548199,
};
List<ClientCard> preCards = new List<ClientCard>();
List<ClientCard> resCards = new List<ClientCard>();
foreach (var card in copyCards)
{
if (card != null && (keyCardsId.Contains(card.Id) || (card.Alias != 0 && keyCardsId.Contains(card.Alias))))
preCards.Add(card);
else resCards.Add(card);
}
if (preCards.Count > 0) return Util.CheckSelectCount(preCards, cards, min, max);
resCards = FilterdRepeatIdCards(resCards);
if (resCards != null)
{
resCards.Sort(CardContainer.CompareCardAttack);
resCards.Reverse();
return Util.CheckSelectCount(resCards, cards, min, max);
}
copyCards.Sort(CardContainer.CompareCardAttack);
copyCards.Reverse();
return Util.CheckSelectCount(copyCards, cards, min, max);
}
if (cards.Any(card => card != null && card.Location == CardLocation.Extra && card.Controller == 0)
&& hint == HintMsg.Remove && min == 3 && max == 3)
{
//pre_link_mode == 0 xyz_mode
//pre_link_mode == 1 link_mode
List<ClientCard> repeatIdCards = FilterdRepeatIdCards(cards);
if (repeatIdCards?.Count >= 3)
{
if (pre_link_mode == 1) return Util.CheckSelectCount(repeatIdCards, cards, min, max);
}
List<ClientCard> resCards = new List<ClientCard>();
List<int> cardsId = new List<int>()
{
CardId.BagooskatheTerriblyTiredTapir,CardId.BorreloadSavageDragon,CardId.CupidPitch,
CardId.QliphortGenius,CardId.IP,CardId.MechaPhantomBeastAuroradon,CardId.MekkKnightCrusadiaAvramax,
CardId.ThunderDragonColossus
};
List<ClientCard> filterCards = CardsIdToClientCards(cardsId, cards).ToList();
if (repeatIdCards?.Count > 0 && pre_link_mode == 0) resCards.AddRange(repeatIdCards);
if (filterCards?.Count > 0) resCards.AddRange(filterCards);
if (repeatIdCards?.Count > 0 && pre_link_mode == 1) resCards.AddRange(repeatIdCards);
if (resCards.Count > 0)
{
return Util.CheckSelectCount(resCards, cards, min, max);
}
return null;
}
if (hint == HintMsg.Remove && cards.Any(card => card != null && (card.Location == CardLocation.Hand || card.Location == CardLocation.Grave) && card.Controller == 0) && min == 1 && max == 1)
{
if (select_Cards.Count > 0)
{
return Util.CheckSelectCount(select_Cards, cards, min, max);
}
else
{
IList<ClientCard> grave_cards = cards.GetMatchingCards(card => card != null && card.Location == CardLocation.Grave);
if (grave_cards.Count > 0) return Util.CheckSelectCount(grave_cards, cards, min, max);
return null;
}
}
if (hint == HintMsg.XyzMaterial && cards.Any(card => card != null && card.Location == CardLocation.Removed) && min == 1 && max == 1)
{
List<ClientCard> m_cards = new List<ClientCard>();
List<ClientCard> e_cards_u = new List<ClientCard>();
List<ClientCard> e_cards_d = new List<ClientCard>();
foreach (var card in cards)
{
if (card != null && card.Controller == 0)
m_cards.Add(card);
if (card != null && card.Controller == 1 && card.IsFaceup())
e_cards_u.Add(card);
if (card != null && card.Controller == 1 && card.IsFacedown())
e_cards_d.Add(card);
}
List<ClientCard> res = new List<ClientCard>();
if (e_cards_u.Count >= 0)
{
e_cards_u.Sort(CardContainer.CompareCardAttack);
e_cards_u.Reverse();
res.AddRange(e_cards_u);
}
IList<int> cardsId = new List<int>() { CardId.KashtiraBigBang, CardId.KashtiraPapiyas };
IList<ClientCard> m_pre_cards = CardsIdToClientCards(cardsId, m_cards, false);
if (m_pre_cards?.Count >= 0) res.AddRange(m_pre_cards);
else if (m_cards.Count >= 0) res.AddRange(m_cards);
if (e_cards_d.Count >= 0) res.AddRange(e_cards_d);
if (res.Count <= 0) return null;
return Util.CheckSelectCount(res, cards, min, max);
}
if (hint == HintMsg.Release && cards.Any(card => card != null && card.Location == CardLocation.MonsterZone))
{
List<ClientCard> tRelease = new List<ClientCard>();
List<ClientCard> nRelease = new List<ClientCard>();
foreach (var card in cards)
{
if (card == null || (card.IsExtraCard() && card.Id != CardId.DiablosistheMindHacker) || card.IsFacedown()) continue;
if (card.Id == CardId.Token || card.Id == CardId.Token_2)
tRelease.Add(card);
else nRelease.Add(card);
}
if (opt_1)
{
IList<int> cardsId = new List<int>() { CardId.Token, CardId.Token_2 };
tRelease = CardsIdToClientCards(cardsId, tRelease, false).ToList();
if(tRelease?.Count > 0) nRelease.AddRange(tRelease);
if (nRelease.Count <= 0) return null;
return Util.CheckSelectCount(nRelease, cards, min, max);
}
else
{
tRelease.AddRange(nRelease);
if(tRelease.Count <= 0) return null;
return Util.CheckSelectCount(tRelease, cards, min, max);
}
}
if (hint == HintMsg.Destroy && cards.Any(card => card != null && card.Controller == 1 && (card.Location & CardLocation.Onfield) > 0) && min==1 && max==1)
{
ClientCard card = Util.GetBestEnemyCard();
List<ClientCard> res = new List<ClientCard>();
if (card != null && cards.Contains(card))
{
res.Add(card);
return Util.CheckSelectCount(res, cards, min, max);
}
res = cards.Where(_card => _card != null && _card.Controller == 1).ToList();
if (res.Count <= 0) return null;
res.Sort(CardContainer.CompareCardAttack);
res.Reverse();
return Util.CheckSelectCount(res, cards, min, max);
}
if (activate_pre_PrimePlanetParaisos)
{
activate_pre_PrimePlanetParaisos = false;
IList<int> cardsId = new List<int>();
if (!Bot.HasInHand(CardId.KashtiraUnicorn) && !activate_KashtiraUnicorn_1 && CheckRemainInDeck(CardId.KashtiraUnicorn) > 0) cardsId.Add(CardId.KashtiraUnicorn);
if (!Bot.HasInHand(CardId.KashtiraFenrir) && !activate_KashtiraFenrir_1 && CheckRemainInDeck(CardId.KashtiraFenrir) > 0) cardsId.Add(CardId.KashtiraFenrir);
if (!Bot.HasInHand(CardId.KashtiraScareclaw) && !activate_KashtiraScareclaw_1 && CheckRemainInDeck(CardId.KashtiraScareclaw) > 0) cardsId.Add(CardId.KashtiraScareclaw);
if (!Bot.HasInHand(CardId.KashtiraTearlaments) && !activate_KashtiraTearlaments_1 && CheckRemainInDeck(CardId.KashtiraTearlaments) > 0) cardsId.Add(CardId.KashtiraTearlaments);
if (!Bot.HasInHand(CardId.KashtiraRiseheart) && (!activate_KashtiraRiseheart_2 || !activate_KashtiraRiseheart_1) && CheckRemainInDeck(CardId.KashtiraRiseheart) > 0) cardsId.Add(CardId.KashtiraRiseheart);
IList<ClientCard> copyCards = new List<ClientCard>(cards);
IList<ClientCard> res = CardsIdToClientCards(cardsId, copyCards);
if (res?.Count <= 0) return null;
return Util.CheckSelectCount(res, cards, min, max);
}
return base.OnSelectCard(cards, min, max, hint, cancelable);
}
private int CheckRemainInDeck(int id)
{
switch (id)
{
case CardId.Nibiru:
return Bot.GetRemainingCount(CardId.Nibiru, 1);
case CardId.KashtiraUnicorn:
return Bot.GetRemainingCount(CardId.KashtiraUnicorn, 3);
case CardId.KashtiraFenrir:
return Bot.GetRemainingCount(CardId.KashtiraFenrir, 3);
case CardId.KashtiraTearlaments:
return Bot.GetRemainingCount(CardId.KashtiraTearlaments, 1);
case CardId.KashtiraScareclaw:
return Bot.GetRemainingCount(CardId.KashtiraScareclaw, 2);
case CardId.DimensionShifter:
return Bot.GetRemainingCount(CardId.DimensionShifter, 2);
case CardId.NemesesCorridor:
return Bot.GetRemainingCount(CardId.NemesesCorridor, 1);
case CardId.KashtiraRiseheart:
return Bot.GetRemainingCount(CardId.KashtiraRiseheart, 3);
case CardId.G:
return Bot.GetRemainingCount(CardId.G, 2);
case CardId.AshBlossom:
return Bot.GetRemainingCount(CardId.AshBlossom, 3);
case CardId.MechaPhantom:
return Bot.GetRemainingCount(CardId.MechaPhantom, 1);
case CardId.Terraforming:
return Bot.GetRemainingCount(CardId.Terraforming, 1);
case CardId.PotofProsperity:
return Bot.GetRemainingCount(CardId.PotofProsperity, 2);
case CardId.KashtiraPapiyas:
return Bot.GetRemainingCount(CardId.KashtiraPapiyas, 3);
case CardId.CalledbytheGrave:
return Bot.GetRemainingCount(CardId.CalledbytheGrave, 2);
case CardId.CrossoutDesignator:
return Bot.GetRemainingCount(CardId.CrossoutDesignator, 1);
case CardId.KashtiraBirth:
return Bot.GetRemainingCount(CardId.KashtiraBirth, 3);
case CardId.PrimePlanetParaisos:
return Bot.GetRemainingCount(CardId.PrimePlanetParaisos, 3);
case CardId.KashtiraBigBang:
return Bot.GetRemainingCount(CardId.KashtiraBigBang, 1);
case CardId.InfiniteImpermanence:
return Bot.GetRemainingCount(CardId.InfiniteImpermanence, 2);
default:
return 0;
}
}
#region CopyImpermanence
public bool Impermanence_activate()
{
// negate before effect used
foreach (ClientCard m in Enemy.GetMonsters())
{
if (m.IsMonsterShouldBeDisabledBeforeItUseEffect() && !m.IsDisabled() && Duel.LastChainPlayer != 0)
{
if (Card.Location == CardLocation.SpellZone)
{
for (int i = 0; i < 5; ++i)
{
if (Bot.SpellZone[i] == Card)
{
Impermanence_list.Add(i);
break;
}
}
}
if (Card.Location == CardLocation.Hand)
{
AI.SelectPlace(SelectSTPlace(Card, true));
}
AI.SelectCard(m);
return true;
}
}
ClientCard LastChainCard = Util.GetLastChainCard();
// negate spells
if (Card.Location == CardLocation.SpellZone)
{
int this_seq = -1;
int that_seq = -1;
for (int i = 0; i < 5; ++i)
{
if (Bot.SpellZone[i] == Card) this_seq = i;
if (LastChainCard != null
&& LastChainCard.Controller == 1 && LastChainCard.Location == CardLocation.SpellZone && Enemy.SpellZone[i] == LastChainCard) that_seq = i;
else if (Duel.Player == 0 && Util.GetProblematicEnemySpell() != null
&& Enemy.SpellZone[i] != null && Enemy.SpellZone[i].IsFloodgate()) that_seq = i;
}
if ((this_seq * that_seq >= 0 && this_seq + that_seq == 4)
|| (Util.IsChainTarget(Card))
|| (LastChainCard != null && LastChainCard.Controller == 1 && LastChainCard.IsCode(_CardId.HarpiesFeatherDuster)))
{
List<ClientCard> enemy_monsters = Enemy.GetMonsters();
enemy_monsters.Sort(CardContainer.CompareCardAttack);
enemy_monsters.Reverse();
foreach (ClientCard card in enemy_monsters)
{
if (card.IsFaceup() && !card.IsShouldNotBeTarget() && !card.IsShouldNotBeSpellTrapTarget())
{
AI.SelectCard(card);
Impermanence_list.Add(this_seq);
return true;
}
}
}
}
if ((LastChainCard == null || LastChainCard.Controller != 1 || LastChainCard.Location != CardLocation.MonsterZone
|| LastChainCard.IsDisabled() || LastChainCard.IsShouldNotBeTarget() || LastChainCard.IsShouldNotBeSpellTrapTarget()))
return false;
// negate monsters
if (is_should_not_negate() && LastChainCard.Location == CardLocation.MonsterZone) return false;
if (Card.Location == CardLocation.SpellZone)
{
for (int i = 0; i < 5; ++i)
{
if (Bot.SpellZone[i] == Card)
{
Impermanence_list.Add(i);
break;
}
}
}
if (Card.Location == CardLocation.Hand)
{
AI.SelectPlace(SelectSTPlace(Card, true));
}
if (LastChainCard != null) AI.SelectCard(LastChainCard);
else
{
List<ClientCard> enemy_monsters = Enemy.GetMonsters();
enemy_monsters.Sort(CardContainer.CompareCardAttack);
enemy_monsters.Reverse();
foreach (ClientCard card in enemy_monsters)
{
if (card.IsFaceup() && !card.IsShouldNotBeTarget() && !card.IsShouldNotBeSpellTrapTarget())
{
AI.SelectCard(card);
return true;
}
}
}
return true;
}
public int SelectSTPlace(ClientCard card = null, bool avoid_Impermanence = false)
{
List<int> list = new List<int> { 0, 1, 2, 3, 4 };
int n = list.Count;
while (n-- > 1)
{
int index = Program.Rand.Next(n + 1);
int temp = list[index];
list[index] = list[n];
list[n] = temp;
}
foreach (int seq in list)
{
int zone = (int)System.Math.Pow(2, seq);
if (Bot.SpellZone[seq] == null)
{
if (card != null && card.Location == CardLocation.Hand && avoid_Impermanence && Impermanence_list.Contains(seq)) continue;
return zone;
};
}
return 0;
}
public bool is_should_not_negate()
{
ClientCard last_card = Util.GetLastChainCard();
if (last_card != null
&& last_card.Controller == 1 && last_card.IsCode(should_not_negate))
return true;
return false;
}
#endregion
private List<ClientCard> FilterdRepeatIdCards(IList<ClientCard> cards)
{
IList<ClientCard> temp = new List<ClientCard>();
List<ClientCard> res = new List<ClientCard>();
foreach (var card in cards)
{
if (card == null) continue;
if (temp.Count(_card => _card != null && _card.Id == card.Id) > 0 && res.Count(_card=>_card != null && _card.Id == card.Id) <= 0)
res.Add(card);
else
temp.Add(card);
}
return res.Count < 0 ? null : res;
}
private IList<ClientCard> CardsIdToClientCards(IList<int> cardsId, IList<ClientCard> cardsList, bool uniqueId = true, bool alias = true)
{
if (cardsList?.Count() <= 0 || cardsId?.Count() <= 0) return new List<ClientCard>();
List<ClientCard> res = new List<ClientCard>();
foreach (var cardid in cardsId)
{
List<ClientCard> cards = cardsList.Where(card => card != null && (card.Id == cardid || ((card.Alias != 0 && cardid == card.Alias) & alias))).ToList();
if (cards?.Count <= 0) continue;
cards.Sort(CardContainer.CompareCardAttack);
if (uniqueId) res.Add(cards.First());
else res.AddRange(cards);
}
return res;
}
private IList<int> ClientCardsToCardsId(IList<ClientCard> cardsList, bool uniqueId = false, bool alias = false)
{
if (cardsList == null) return null;
if (cardsList.Count <= 0) return new List<int>();
IList<int> res = new List<int>();
foreach (var card in cardsList)
{
if (card == null) continue;
if (card.Alias != 0 && alias && !(res.Contains(card.Alias) & uniqueId)) res.Add(card.Alias);
else if (card.Id != 0 && !(res.Contains(card.Id) & uniqueId)) res.Add(card.Id);
}
return res.Count < 0 ? null : res;
}
private bool DefaultRepos()
{
if (Card.Id == CardId.KashtiraScareclaw || (Card.Id == CardId.KashtiraShangriIra && Card.Attack<2000)) return false;
return DefaultMonsterRepos();
}
private bool CrossoutDesignatorCheck(ClientCard LastChainCard, int id)
{
if (LastChainCard.IsCode(id) && CheckRemainInDeck(id) > 0)
{
AI.SelectAnnounceID(id);
return true;
}
return false;
}
private bool CrossoutDesignatorEffect()
{
ClientCard LastChainCard = Util.GetLastChainCard();
if (LastChainCard == null || Duel.LastChainPlayer != 1) return false;
if (CrossoutDesignatorCheck(LastChainCard, CardId.Nibiru)
|| CrossoutDesignatorCheck(LastChainCard, CardId.AshBlossom)
|| CrossoutDesignatorCheck(LastChainCard, CardId.G)
|| CrossoutDesignatorCheck(LastChainCard, CardId.NemesesCorridor)
|| CrossoutDesignatorCheck(LastChainCard, CardId.InfiniteImpermanence)
|| CrossoutDesignatorCheck(LastChainCard, CardId.CalledbytheGrave)
|| CrossoutDesignatorCheck(LastChainCard, CardId.Terraforming)
|| CrossoutDesignatorCheck(LastChainCard, CardId.PotofProsperity)
|| CrossoutDesignatorCheck(LastChainCard, CardId.KashtiraPapiyas)
|| CrossoutDesignatorCheck(LastChainCard, CardId.KashtiraUnicorn)
|| CrossoutDesignatorCheck(LastChainCard, CardId.KashtiraFenrir)
|| CrossoutDesignatorCheck(LastChainCard, CardId.KashtiraBirth))
{
if (Card.Location == CardLocation.Hand)
{
AI.SelectPlace(SelectSTPlace(Card, true));
}
return true;
}
return false;
}
private bool MekkKnightCrusadiaAvramaxEffect()
{
if (Card.Location == CardLocation.Grave)
{
List<ClientCard> cards = Enemy.GetMonsters();
cards.Sort(CardContainer.CompareCardAttack);
cards.Reverse();
cards.AddRange(Enemy.GetSpells());
if (cards.Count <= 0) return false;
AI.SelectCard(cards);
return true;
}
else return true;
}
private bool SpellSet()
{
return Card.HasType(CardType.QuickPlay) || Card.HasType(CardType.Trap);
}
private bool NibiruEffect()
{
if (Bot.HasInMonstersZone(CardId.KashtiraAriseHeart, true, false, true) && Util.GetBestAttack(Bot) > Util.GetBestAttack(Enemy)) return false;
return Bot.GetMonsterCount() <= 0 || Bot.GetMonsterCount() < Enemy.GetMonsterCount();
}
private bool CalledbytheGraveEffect()
{
ClientCard card = Util.GetLastChainCard();
if (card == null) return false;
int id = card.Id;
List<ClientCard> g_cards = Enemy.GetGraveyardMonsters().Where(g_card => g_card != null && g_card.Id == id).ToList();
if (Duel.LastChainPlayer != 0 && card != null)
{
if (Card.Location == CardLocation.Hand)
{
AI.SelectPlace(SelectSTPlace(Card, true));
}
if (card.Location == CardLocation.Grave && card.HasType(CardType.Monster))
{
AI.SelectCard(card);
}
else if (g_cards.Count() > 0 && card.HasType(CardType.Monster))
{
AI.SelectCard(g_cards);
}
else return false;
select_CalledbytheGrave = true;
return true;
}
return false;
}
private bool CupidPitchSummon()
{
if (!Bot.HasInMonstersZone(CardId.Token_2) && !Bot.HasInMonstersZone(CardId.MechaPhantom)) return false;
IList<int> cardsId = new List<int>() { CardId.MechaPhantom, CardId.Token_2 };
IList<ClientCard> cards = CardsIdToClientCards(cardsId, Bot.GetMonsters(), false);
if (cards?.Count <= 0) return false;
AI.SelectMaterials(cards);
return true;
}
private bool BorreloadSavageDragonSummon()
{
if (!Bot.HasInMonstersZone(CardId.Token_2) && !Bot.HasInMonstersZone(CardId.CupidPitch)) return false;
IList<int> cardsId = new List<int>() { CardId.CupidPitch, CardId.Token_2 };
IList<ClientCard> cards = CardsIdToClientCards(cardsId, Bot.GetMonsters(), false);
if (cards?.Count <= 0) return false;
AI.SelectMaterials(cards);
link_mode = false;
return true;
}
private bool BorreloadSavageDragonEffect()
{
if (ActivateDescription == -1)
{
AI.SelectCard(new[] { CardId.MekkKnightCrusadiaAvramax, CardId.MechaPhantomBeastAuroradon, CardId.IP, CardId.QliphortGenius});
return true;
}
return true;
}
private bool IPSummon()
{
if (!Bot.HasInMonstersZone(CardId.Token) && !Bot.HasInMonstersZone(CardId.Token_2)) return false;
if (!Bot.HasInExtra(CardId.MechaPhantomBeastAuroradon) || !(Bot.HasInExtra(CardId.MekkKnightCrusadiaAvramax) && (Bot.HasInExtra(CardId.QliphortGenius) || Bot.HasInMonstersZone(CardId.QliphortGenius, false, false, true)))) return false;
List<ClientCard> cards = Bot.GetMonsters().Where(card => card != null && !card.HasType(CardType.Link) && card.IsFaceup() && card.HasType(CardType.Monster) && !card.HasType(CardType.Xyz)).ToList();
if (cards?.Count < 2 && !link_mode) return false;
IList<int> cardsId = new List<int> { CardId.GalaxyTomahawk, CardId.Token };
IList<ClientCard> pre_cards = CardsIdToClientCards(cardsId, cards, false);
if (pre_cards?.Count >= 2) { AI.SelectMaterials(pre_cards); return true; }
cards.Sort(CardContainer.CompareCardAttack);
AI.SelectMaterials(cards);
return true;
}
private bool IPEffect()
{
if (!Bot.HasInExtra(CardId.MekkKnightCrusadiaAvramax) && !(Bot.HasInMonstersZone(CardId.QliphortGenius,false,false,true) ||
Bot.HasInMonstersZone(CardId.MechaPhantomBeastAuroradon, false, false, true))) return false;
AI.SelectCard(CardId.MekkKnightCrusadiaAvramax);
IList<int> cardsId = new List<int> {CardId.MechaPhantomBeastAuroradon,CardId.IP,CardId.QliphortGenius};
List<ClientCard> m = new List<ClientCard>();
IList<ClientCard> pre_m = CardsIdToClientCards(cardsId,Bot.GetMonsters());
if (pre_m?.Count <= 0) return false;
int link_count = 0;
foreach (var card in pre_m)
{
m.Add(card);
link_count += (card.HasType(CardType.Link)) ? card.LinkCount : 1;
if (link_count >= 4) break;
}
if (link_count < 4) return false;
AI.SelectMaterials(m);
return true;
}
private bool MechaPhantomBeastAuroradonEffect()
{
if (ActivateDescription == -1) return true;
else
{
if (CheckRemainInDeck(CardId.MechaPhantom) <= 0
&& GetEnemyOnFields().Count <= 0 && Bot.Graveyard.Count(card => card != null && card.HasType(CardType.Trap))<=0) return false;
List<ClientCard> tRelease = new List<ClientCard>();
List<ClientCard> nRelease = new List<ClientCard>();
foreach (var card in Bot.GetMonsters())
{
if (card == null || (card.IsExtraCard() && card.Id != CardId.DiablosistheMindHacker) || card.IsFacedown()) continue;
if (card.Id == CardId.Token || card.Id == CardId.Token_2)
tRelease.Add(card);
else nRelease.Add(card);
}
int count = tRelease.Count() + nRelease.Count();
opt_0 = false;
opt_1 = false;
opt_2 = false;
if (count >= 3 && Bot.Graveyard.Count(card => card != null && card.HasType(CardType.Trap)) >0 ) opt_2 = true;
if (count >= 2 && CheckRemainInDeck(CardId.MechaPhantom) > 0) opt_1 = true;
if (count >= 1 && GetEnemyOnFields().Count > 0) opt_0 = true;
if (!opt_0 && !opt_1 && !opt_2) return false;
return true;
}
}
private bool QliphortGeniusSummon()
{
List<ClientCard> cards = Bot.GetMonsters().Where(card => card != null && card.Id==CardId.Token).ToList();
if (cards.Count <= 2) return false;
AI.SelectMaterials(cards);
return true;
}
private bool MekkKnightCrusadiaAvramaxSummon()
{
IList<int> cardsId = new List<int>() {CardId.MechaPhantomBeastAuroradon,CardId.IP,CardId.QliphortGenius};
List<ClientCard> cards = CardsIdToClientCards(cardsId,Bot.GetMonsters()).ToList();
if (cards.Count <= 0) return false;
List<ClientCard> m = new List<ClientCard>();
int link_count = 0;
foreach (var card in cards)
{
m.Add(card);
link_count += (card.HasType(CardType.Link)) ? card.LinkCount : 1;
if (link_count >= 4) break;
}
if (link_count < 4 || m.Count<2) return false;
AI.SelectMaterials(m);
return true;
}
private bool MechaPhantomBeastAuroradonSummon()
{
if (!Bot.HasInMonstersZone(CardId.QliphortGenius,false,false,true) && !Bot.HasInMonstersZone(CardId.Token, false, false, true)) return false;
List<ClientCard> m = new List<ClientCard>();
List<ClientCard> m1 = Bot.GetMonsters().Where(card => card != null && card.Id == CardId.QliphortGenius).ToList();
List<ClientCard> m2 = Bot.GetMonsters().Where(card => card != null && card.Id == CardId.Token).ToList();
if (m1.Count > 0) m.AddRange(m1);
if (m2.Count > 0) m.AddRange(m2);
m1.Clear();
int link_count = 0;
foreach (var card in m)
{
m1.Add(card);
link_count += (card.HasType(CardType.Link)) ? card.LinkCount : 1;
if (link_count >= 3) break;
}
if (link_count < 3) return false;
AI.SelectMaterials(m1);
return true;
}
private bool KashtiraFenrirSummon()
{
if (Bot.HasInHandOrInSpellZone(CardId.KashtiraBirth) && Bot.HasInHandOrInSpellZone(CardId.KashtiraPapiyas)) { summon_KashtiraFenrir = true; return true; }
return false;
}
private bool DiablosistheMindHackerEffect()
{
AI.SelectCard(CardId.KashtiraFenrir, CardId.KashtiraUnicorn, CardId.KashtiraScareclaw, CardId.KashtiraTearlaments);
return true;
}
private bool KashtiraRiseheartSummon()
{
isSummoned = true;
return !activate_KashtiraRiseheart_2;
}
private bool DimensionShifterEffect()
{
if (activate_DimensionShifter) return false;
flag = -1;
++flag;
activate_DimensionShifter = true;
return true;
}
private bool KashtiraBigBangEffect()
{
if (Card.Location == CardLocation.Removed)
{
AI.SelectCard(CardId.KashtiraShangriIra);
AI.SelectNextCard(CardId.KashtiraUnicorn,CardId.KashtiraFenrir,CardId.KashtiraTearlaments,CardId.KashtiraScareclaw);
return true;
}
else if(Card.Location==CardLocation.SpellZone)
{
if (Enemy.GetMonsterCount() <= 0) return false;
if (Bot.GetMonsterCount() <= 1) return true;
return Bot.GetMonsterCount()< Enemy.GetMonsterCount();
}
return false;
}
private bool SpellActivate()
{
return Card.Location == CardLocation.Hand || (Card.IsFacedown() && (Card.Location == CardLocation.SpellZone || Card.Location == CardLocation.FieldZone));
}
private bool PrimePlanetParaisosEffect()
{
if (SpellActivate()) { activate_pre_PrimePlanetParaisos_2 = true; return true; }
if (activate_pre_PrimePlanetParaisos_2 || activate_pre_PrimePlanetParaisos) return false;
List<ClientCard> cards = GetEnemyOnFields().Where(card => card != null && !card.IsShouldNotBeTarget()).ToList();
if (cards == null || cards.Count <= 0) return false;
return true;
}
private bool DiablosistheMindHackerSummon()
{
List<ClientCard> cards = Bot.GetMonsters();
cards.Sort(CardContainer.CompareCardAttack);
AI.SelectMaterials(cards);
return true;
}
private bool XyzCheck()
{
if (Bot.GetMonsters().Count(card => card != null && card.IsFaceup() && card.Level == 7) >= 4 && Bot.HasInExtra(CardId.KashtiraShangriIra)) return false;
if ((active_KashtiraPapiyas_1 || !Bot.HasInHandOrInSpellZone(CardId.KashtiraPapiyas))
&& (activate_KashtiraUnicorn_1 || !Bot.HasInHand(CardId.KashtiraUnicorn) || isSummoned || !Bot.HasInSpellZone(CardId.KashtiraBirth, true, true))
&& (activate_KashtiraFenrir_1 || !Bot.HasInHand(CardId.KashtiraFenrir) || isSummoned || !Bot.HasInSpellZone(CardId.KashtiraBirth, true, true))
&& (activate_KashtiraScareclaw_1 || !Bot.HasInHand(CardId.KashtiraScareclaw) || isSummoned || !Bot.HasInSpellZone(CardId.KashtiraBirth, true, true))
&& (activate_KashtiraTearlaments_1 || !Bot.HasInHand(CardId.KashtiraTearlaments) || isSummoned || !Bot.HasInSpellZone(CardId.KashtiraBirth, true, true))
&& (activate_KashtiraRiseheart_2 || !Bot.HasInHand(CardId.KashtiraRiseheart) || activate_KashtiraRiseheart_1 || isSummoned)) return true;
return false;
}
private bool GalaxyTomahawkSummon()
{
if (CheckRemainInDeck(CardId.MechaPhantom) <= 0) return false;
if (Bot.GetMonsterCount() >= 4) return false;
if (onlyXyzSummon || activate_DimensionShifter || Bot.HasInMonstersZone(CardId.KashtiraAriseHeart,true,false,true)) return false;
if (!Bot.HasInExtra(CardId.MekkKnightCrusadiaAvramax) && !(Bot.HasInExtra(CardId.CupidPitch) || Bot.HasInExtra(CardId.BorreloadSavageDragon))) return false;
//if (!XyzCheck()) return false;
link_mode = true;
return DiablosistheMindHackerSummon();
}
private bool DiablosistheMindHackerSummon_2()
{
if (Bot.HasInMonstersZone(CardId.DiablosistheMindHacker)) return false;
return DiablosistheMindHackerSummon();
}
private bool isEffectByRemove()
{
return activate_DimensionShifter || Bot.HasInMonstersZone(CardId.KashtiraAriseHeart, true, false, true) || Enemy.HasInMonstersZone(CardId.KashtiraAriseHeart, true, false, true);
}
private bool NemesesCorridorEffect()
{
if (Card.Location == CardLocation.Hand)
{
if(Bot.GetMonsterCount()<=0) return true;
if (onlyXyzSummon || !Bot.HasInExtra(CardId.ThunderDragonColossus)) return false;
else return true;
}
return false;
}
private bool KashtiraTearlamentsEffect()
{
if (Card.Location == CardLocation.Hand)
{
if (Duel.Player != 0) return false;
if (Duel.CurrentChain.Count > 0) return false;
if (!ActivateLimit(Card.Id)) return false;
activate_KashtiraTearlaments_1 = true;
return true;
}
if (Card.Location == CardLocation.MonsterZone)
{
if (isEffectByRemove() && Enemy.Deck.Count >= 3) return true;
if (!isEffectByRemove() && Bot.Deck.Count > 10) return true;
return false;
}
if (Card.Location == CardLocation.Grave)
{
if (isEffectByRemove()) return false;
return Bot.Deck.Count > 10;
}
return false;
}
private bool ActivateLimit(int cardId)
{
if (Bot.MonsterZone.Count() <= 0
&& ((Bot.HasInHand(CardId.KashtiraFenrir) && !activate_KashtiraFenrir_1)
|| (Bot.HasInHand(CardId.KashtiraUnicorn) && !activate_KashtiraUnicorn_1))) return false;
if (Bot.HasInHand(CardId.PrimePlanetParaisos) && !activate_pre_PrimePlanetParaisos_2) return false;
List<ClientCard> cards = new List<ClientCard>();
List<ClientCard> hand_cards = Bot.Hand.GetMatchingCards(card=>card!=null && card.HasSetcode(0x189)).ToList();
List<ClientCard> grave_cards = Bot.Graveyard.GetMatchingCards(card => card != null && card.HasSetcode(0x189)).ToList();
List<int> cardsid = new List<int>();
if (grave_cards.Count <= 0)
{
if ((Bot.HasInSpellZone(CardId.KashtiraBirth, true, true) && hand_cards.Count(card=>card!=null && card.Id == CardId.KashtiraBirth)>0)
|| hand_cards.Count(card => card != null && card.Id == CardId.KashtiraBirth) > 1)
cardsid.Add(CardId.KashtiraBirth);
if ((active_KashtiraPapiyas_1 && hand_cards.Count(card => card != null && card.Id == CardId.KashtiraPapiyas) > 0)
|| hand_cards.Count(card => card != null && card.Id == CardId.KashtiraPapiyas) > 1)
cardsid.Add(CardId.KashtiraPapiyas);
if (((activate_KashtiraFenrir_1 || summon_KashtiraFenrir) && hand_cards.Count(card => card != null && card.Id == CardId.KashtiraFenrir) > 0)
|| hand_cards.Count(card => card != null && card.Id == CardId.KashtiraFenrir) > 1)
cardsid.Add(CardId.KashtiraFenrir);
if (((activate_KashtiraUnicorn_1 || summon_KashtiraUnicorn) && hand_cards.Count(card => card != null && card.Id == CardId.KashtiraUnicorn) > 0)
|| hand_cards.Count(card => card != null && card.Id == CardId.KashtiraUnicorn) > 1)
cardsid.Add(CardId.KashtiraUnicorn);
if ((cardId != CardId.KashtiraScareclaw && hand_cards.Count(card => card != null && card.Id == CardId.KashtiraScareclaw) > 0)
|| (hand_cards.Count(card => card != null && card.Id == CardId.KashtiraScareclaw) > 1))
cardsid.Add(CardId.KashtiraScareclaw);
if ((activate_KashtiraRiseheart_2 && hand_cards.Count(card => card != null && card.Id == CardId.KashtiraRiseheart) > 0)
|| hand_cards.Count(card => card != null && card.Id == CardId.KashtiraRiseheart) > 1)
cardsid.Add(CardId.KashtiraRiseheart);
if (cardId != CardId.KashtiraTearlaments && hand_cards.Count(card => card != null && card.Id == CardId.KashtiraTearlaments) > 0)
cardsid.Add(CardId.KashtiraTearlaments);
if(hand_cards.Count(card => card != null && card.Id == CardId.KashtiraBigBang) > 0)
cardsid.Add(CardId.KashtiraBigBang);
if (cardsid.Count <= 0) return false;
}
if (Bot.HasInHand(CardId.KashtiraFenrir) && !activate_KashtiraFenrir_1 && Bot.GetMonsterCount() <= 0) return false;
if (Bot.HasInHand(CardId.KashtiraUnicorn) && !activate_KashtiraUnicorn_1 && Bot.GetMonsterCount() <= 0) return false;
select_Cards.Clear();
select_Cards.AddRange(grave_cards);
select_Cards.AddRange(CardsIdToClientCards(cardsid, hand_cards,false));
return true;
}
private bool KashtiraScareclawEffect()
{
if (Card.Location == CardLocation.Hand)
{
if (Duel.Player != 0) return false;
if (Duel.CurrentChain.Count > 0) return false;
if (!ActivateLimit(Card.Id)) return false;
activate_KashtiraScareclaw_1 = true;
return true;
}
return false;
}
private bool KashtiraAriseHeartEffect()
{
if (Card.IsDisabled()) return false;
if (ActivateDescription == Util.GetStringId(CardId.KashtiraAriseHeart, 1))
{
return true;
}
else
{
return SelectEnemyCard(false,true);
}
}
private bool KashtiraAriseHeartSummon_2()
{
int xcount = 0;
int xcount_2 = 0;
int xcount_3 = 0;
foreach (var card in Bot.GetMonsters())
{
if (card == null || card.IsFacedown()) continue;
if (card.Level == 7) ++xcount;
if (card.Level == 7 && card.HasSetcode(0x189))++xcount_2;
if (card.Level != 7 && card.HasSetcode(0x189) && !card.HasType(CardType.Xyz)) ++xcount_3;
}
if (xcount >= 2 && (xcount_3 > 0 || xcount - xcount_2 > 0)) return KashtiraAriseHeartSummon();
return false;
}
private bool KashtiraAriseHeartSummon()
{
if (Bot.HasInMonstersZone(CardId.KashtiraShangriIra,false,false,true) && !activate_KashtiraShangriIra) return false;
if (activate_KashtiraShangriIra)
{
List<ClientCard> materials = Bot.GetMonsters().GetMatchingCards(card => !card.IsExtraCard() && card.IsFaceup() && Card.HasSetcode(0x189)).ToList();
if (materials.Count() <= 0) return false;
materials.Sort(CardContainer.CompareCardAttack);
materials.Sort(CardContainer.CompareCardLevel);
AI.SelectMaterials(materials);
return true;
}
else
{
return DiablosistheMindHackerSummon();
}
}
private bool DefaultSummon()
{
if (Bot.HasInSpellZone(CardId.KashtiraBirth, true, true) && Bot.GetMonstersInMainZone().Count<5)
{
isSummoned = true;
if (Card.Id == CardId.KashtiraUnicorn) summon_KashtiraUnicorn = true;
else if(Card.Id == CardId.KashtiraFenrir) summon_KashtiraFenrir = true;
return true;
}
return false;
}
private bool KashtiraShangriIraSummon()
{
if (Bot.HasInMonstersZone(CardId.KashtiraShangriIra, true, false, true)) return false;
List<ClientCard> materials = new List<ClientCard>();
foreach (var card in Bot.GetMonsters())
{
if (materials.Count() >= 2) break;
if (card != null && card.IsFaceup() && card.Level == 7)
{
materials.Add(card);
}
}
if (materials.Count() < 2) return false;
materials.Sort(CardContainer.CompareCardAttack);
AI.SelectMaterials(materials);
return true;
}
private List<ClientCard> GetEnemyOnFields()
{
List<ClientCard> res = new List<ClientCard>();
List<ClientCard> m_cards = Enemy.GetMonsters();
List<ClientCard> s_cards = Enemy.GetSpells();
if (m_cards.Count > 0) res.AddRange(m_cards);
if(s_cards.Count > 0) res.AddRange(s_cards);
return res;
}
private bool KashtiraShangriIraEffect()
{
if (!Bot.HasInMonstersZone(CardId.KashtiraUnicorn, true, false, true) && Enemy.ExtraDeck.Count > 0 && CheckRemainInDeck(CardId.KashtiraUnicorn) > 0)
{
AI.SelectCard(CardId.KashtiraUnicorn);
}
else if (!Bot.HasInMonstersZone(CardId.KashtiraFenrir, true, false, true) && CheckRemainInDeck(CardId.KashtiraFenrir) > 0)
{
AI.SelectCard(CardId.KashtiraFenrir);
}
else if (!Bot.HasInMonstersZone(CardId.KashtiraScareclaw, true, false, true) && CheckRemainInDeck(CardId.KashtiraScareclaw) > 0)
{
AI.SelectCard(CardId.KashtiraScareclaw);
}
else
{
AI.SelectCard(CardId.KashtiraTearlaments, CardId.KashtiraUnicorn, CardId.KashtiraFenrir, CardId.KashtiraScareclaw);
}
activate_KashtiraShangriIra = true;
return true;
}
private void DefaultAddCardId(List<int> cardsid)
{
if (!Bot.HasInHand(CardId.KashtiraUnicorn) && !activate_KashtiraUnicorn_1) cardsid.Add(CardId.KashtiraUnicorn);
if (!Bot.HasInHand(CardId.KashtiraFenrir) && !activate_KashtiraFenrir_1) cardsid.Add(CardId.KashtiraFenrir);
if (!Bot.HasInHand(CardId.KashtiraRiseheart) && !activate_KashtiraRiseheart_2) cardsid.Add(CardId.KashtiraRiseheart);
if (!Bot.HasInHand(CardId.KashtiraTearlaments) && !activate_KashtiraTearlaments_1) cardsid.Add(CardId.KashtiraTearlaments);
if (!Bot.HasInHand(CardId.KashtiraScareclaw) && !activate_KashtiraScareclaw_1) cardsid.Add(CardId.KashtiraScareclaw);
}
private bool KashtiraPapiyasEffect_2()
{
if (Card.Location == CardLocation.Removed)
{
List<int> cardsid = new List<int>();
DefaultAddCardId(cardsid);
if (!Bot.HasInExtra(CardId.KashtiraAriseHeart)) cardsid.Add(CardId.KashtiraAriseHeart);
if (!Bot.HasInExtra(CardId.KashtiraShangriIra)) cardsid.Add(CardId.KashtiraShangriIra);
cardsid.AddRange(new List<int>() { CardId.KashtiraBigBang, CardId.KashtiraUnicorn, CardId.KashtiraFenrir, CardId.KashtiraRiseheart, CardId.KashtiraScareclaw, CardId.KashtiraTearlaments });
AI.SelectCard(cardsid);
active_KashtiraPapiyas_2 = true;
return true;
}
else
{
AI.SelectCard(CardId.KashtiraFenrir);
List<int> cardsid = new List<int>();
DefaultAddCardId(cardsid);
cardsid.AddRange(new List<int>() { CardId.KashtiraUnicorn, CardId.KashtiraFenrir, CardId.KashtiraRiseheart, CardId.KashtiraScareclaw, CardId.KashtiraTearlaments });
AI.SelectNextCard(cardsid);
if (Card.Location == CardLocation.Hand)
{
AI.SelectPlace(SelectSTPlace(Card, true));
}
active_KashtiraPapiyas_1 = true;
onlyXyzSummon = true;
return true;
}
}
private bool KashtiraPapiyasEffect()
{
if (link_mode) return false;
return KashtiraPapiyasEffect_2();
}
private bool SelectEnemyCard(bool faceUp = true, bool isXyz= false)
{
ClientCard card = Util.GetLastChainCard();
if (card != null && card.Controller == 1 && card.IsFaceup() && (card.HasType(CardType.Monster)
|| card.HasType(CardType.Continuous) || card.HasType(CardType.Equip) || card.HasType(CardType.Field))
&& (card.Location & CardLocation.Onfield)>0 && !card.IsShouldNotBeTarget())
{ AI.SelectCard(card);if (isXyz)AI.SelectNextCard(card); return true; }
if (GetEnemyOnFields().Count(_card => _card != null && !_card.IsShouldNotBeTarget() && !(faceUp & !_card.IsFaceup()) && !_card.HasType(CardType.Token)) <= 0) return false;
ClientCard dcard = GetEnemyOnFields().GetDangerousMonster(true);
if (Duel.Phase >= DuelPhase.BattleStart || Util.GetBestAttack(Enemy) >= Util.GetBestAttack(Bot) || dcard != null)
{
if (dcard != null) { AI.SelectCard(dcard); if(isXyz)AI.SelectNextCard(dcard) ; return true; }
List<ClientCard> cards = GetEnemyOnFields().Where(_card => _card != null && !_card.IsShouldNotBeTarget() && !(!_card.IsFaceup() & faceUp)).ToList();
cards.Sort(CardContainer.CompareCardAttack);
cards.Reverse();
if (cards.Count <= 0) return false;
AI.SelectCard(cards);
if (isXyz) AI.SelectNextCard(cards);
return true;
}
return false;
}
private bool KashtiraFenrirEffect()
{
if (Card.IsDisabled()) return false;
if (ActivateDescription == Util.GetStringId(CardId.KashtiraFenrir, 1))
{
IList<int> cardsId = new List<int>();
if ((!Bot.HasInHandOrInSpellZone(CardId.KashtiraBirth) || isSummoned)
&& !Bot.HasInHand(CardId.KashtiraRiseheart) && (!activate_KashtiraRiseheart_2 && (!activate_KashtiraRiseheart_1 || !isSummoned)) && CheckRemainInDeck(CardId.KashtiraRiseheart) > 0)
cardsId.Add(CardId.KashtiraRiseheart);
if (Bot.HasInHandOrInSpellZone(CardId.KashtiraBirth) && !isSummoned && !Bot.HasInHand(CardId.KashtiraUnicorn) && !activate_KashtiraUnicorn_1 && CheckRemainInDeck(CardId.KashtiraUnicorn) > 0)
cardsId.Add(CardId.KashtiraUnicorn);
if (!Bot.HasInHand(CardId.KashtiraTearlaments) && !activate_KashtiraTearlaments_1 && CheckRemainInDeck(CardId.KashtiraTearlaments) > 0)
cardsId.Add(CardId.KashtiraTearlaments);
if (!Bot.HasInHand(CardId.KashtiraScareclaw) && !activate_KashtiraScareclaw_1 && CheckRemainInDeck(CardId.KashtiraScareclaw) > 0)
cardsId.Add(CardId.KashtiraScareclaw);
cardsId.Add(CardId.KashtiraUnicorn);
cardsId.Add(CardId.KashtiraRiseheart);
activate_KashtiraFenrir_1 = true;
AI.SelectCard(cardsId);
return true;
}
else
{
if (Duel.LastChainPlayer == 0 && Util.GetLastChainCard() != null &&
Util.GetLastChainCard().Id == CardId.PrimePlanetParaisos) return false;
List<ClientCard> cards = GetEnemyOnFields().Where(card => card != null && card.IsFaceup()).ToList();
if (cards.Count > 0)
{
cards.Sort(CardContainer.CompareCardAttack);
cards.Reverse();
AI.SelectCard(cards);
}
return true;
}
}
private bool TerraformingEffect()
{
if (Card.Location == CardLocation.Hand)
{
AI.SelectPlace(SelectSTPlace(Card, true));
}
return true;
}
private bool PotofProsperityEffect()
{
if (Bot.ExtraDeck.Count <= 3) return false;
List<int> cardsId = new List<int>();
if (!Bot.HasInHandOrInSpellZone(CardId.PrimePlanetParaisos) && !activate_PrimePlanetParaisos)
cardsId.Add(CardId.PrimePlanetParaisos);
if (!Bot.HasInHandOrInSpellZone(CardId.PrimePlanetParaisos) && !activate_PrimePlanetParaisos && CheckRemainInDeck(CardId.PrimePlanetParaisos) > 0)
cardsId.Add(CardId.Terraforming);
if (!Bot.HasInHand(CardId.KashtiraUnicorn) && !activate_KashtiraUnicorn_1)
cardsId.Add(CardId.KashtiraUnicorn);
if(!Bot.HasInHand(CardId.KashtiraFenrir) && !activate_KashtiraFenrir_1)
cardsId.Add(CardId.KashtiraFenrir);
if (!Bot.HasInHand(CardId.KashtiraPapiyas) && !active_KashtiraPapiyas_1)
cardsId.Add(CardId.KashtiraPapiyas);
if (!Bot.HasInHand(CardId.KashtiraRiseheart) && !activate_KashtiraRiseheart_2)
cardsId.Add(CardId.KashtiraRiseheart);
if(!Bot.HasInHandOrInSpellZone(CardId.KashtiraBirth))
cardsId.Add(CardId.KashtiraBirth);
if(!Bot.HasInHand(CardId.KashtiraScareclaw) && !activate_KashtiraScareclaw_1)
cardsId.Add(CardId.KashtiraScareclaw);
if(!Bot.HasInHand(CardId.KashtiraTearlaments) && !activate_KashtiraTearlaments_1)
cardsId.Add(CardId.KashtiraTearlaments);
if (Bot.HasInExtra(CardId.ThunderDragonColossus) && Bot.Banished.Count(card=>card!=null && card.IsFaceup() && card.HasType(CardType.Monster))>0)
cardsId.Add(CardId.NemesesCorridor);
if (!Bot.HasInHand(CardId.G))
cardsId.Add(CardId.G);
if (!Bot.HasInHand(CardId.AshBlossom))
cardsId.Add(CardId.AshBlossom);
cardsId.AddRange(new List<int>() { CardId.CrossoutDesignator, CardId.CalledbytheGrave, CardId.Nibiru, CardId.InfiniteImpermanence });
if (Card.Location == CardLocation.Hand)
{
AI.SelectPlace(SelectSTPlace(Card, true));
}
AI.SelectCard(cardsId);
return true;
}
private bool KashtiraRiseheartEffect_2()
{
if (Card.Location != CardLocation.Hand)
{
if (CheckRemainInDeck(CardId.KashtiraBigBang) > 0 && Bot.GetMonsters().GetMatchingCards(card => card != null && card.HasType(CardType.Xyz)
&& card.HasSetcode(0x189) && card.IsFaceup() && card.Overlays.Count > 0).Count > 0)
{
AI.SelectCard(CardId.KashtiraBigBang);
}
else if (Bot.HasInHandOrInSpellZone(CardId.KashtiraBirth) && !active_KashtiraBirth)
{
if (!Bot.HasInGraveyardOrInBanished(CardId.KashtiraUnicorn) && !activate_KashtiraUnicorn_1
&& CheckRemainInDeck(CardId.KashtiraUnicorn) > 0 && !active_KashtiraPapiyas_1
&& !Bot.HasInHand(CardId.KashtiraPapiyas) && CheckRemainInDeck(CardId.KashtiraPapiyas) > 0)
AI.SelectCard(CardId.KashtiraUnicorn);
else if (!Bot.HasInGraveyardOrInBanished(CardId.KashtiraFenrir) && !activate_KashtiraFenrir_1
&& CheckRemainInDeck(CardId.KashtiraFenrir) > 0)
AI.SelectCard(CardId.KashtiraFenrir);
else if (!Bot.HasInGraveyardOrInBanished(CardId.KashtiraUnicorn) && !activate_KashtiraUnicorn_1
&& CheckRemainInDeck(CardId.KashtiraUnicorn) > 0)
AI.SelectCard(CardId.KashtiraFenrir);
else if (Bot.Graveyard.Count(card => card != null && card.HasType(CardType.Monster) && card.HasSetcode(0x189) && !card.HasType(CardType.Xyz))
+ Bot.Banished.Count(card_2 => card_2 != null && card_2.HasType(CardType.Monster) && card_2.HasSetcode(0x189) && !card_2.HasType(CardType.Xyz)) <= 0)
AI.SelectCard(CardId.KashtiraFenrir, CardId.KashtiraUnicorn, CardId.KashtiraScareclaw, CardId.KashtiraTearlaments, CardId.KashtiraRiseheart);
else
AI.SelectCard(CardId.KashtiraFenrir, CardId.KashtiraUnicorn, CardId.KashtiraScareclaw, CardId.KashtiraTearlaments, CardId.KashtiraRiseheart);
}
else if (Bot.HasInHand(CardId.NemesesCorridor) && !active_NemesesCorridor &&
Bot.Banished.Count(card_2 => card_2 != null && card_2.HasType(CardType.Monster)) <= 0 && Bot.HasInExtra(CardId.ThunderDragonColossus))
{
AI.SelectCard(CardId.KashtiraFenrir, CardId.KashtiraUnicorn, CardId.KashtiraScareclaw, CardId.KashtiraTearlaments, CardId.KashtiraRiseheart);
}
else if (!active_KashtiraPapiyas_2 && CheckRemainInDeck(CardId.KashtiraPapiyas) > 0 && Bot.Banished.GetMatchingCardsCount(card => card != null && card.IsFaceup() && card.HasSetcode(0x189) && card.Id != CardId.KashtiraPapiyas) > 0)
{
AI.SelectCard(CardId.KashtiraPapiyas, CardId.KashtiraFenrir, CardId.KashtiraUnicorn, CardId.KashtiraScareclaw, CardId.KashtiraTearlaments, CardId.KashtiraRiseheart);
}
else
{
AI.SelectCard(CardId.KashtiraFenrir, CardId.KashtiraUnicorn, CardId.KashtiraScareclaw, CardId.KashtiraTearlaments, CardId.KashtiraRiseheart);
}
activate_KashtiraRiseheart_2 = true;
return true;
}
return false;
}
private bool KashtiraRiseheartEffect()
{
if (Card.Location == CardLocation.Hand)
{
activate_KashtiraRiseheart_1 = true;
onlyXyzSummon = true;
return true;
}
return false;
}
private bool KashtiraBirthEffect()
{
if ((Card.Location == CardLocation.Hand || (Card.Location==CardLocation.SpellZone && Card.IsFacedown()))
&& !Bot.HasInSpellZone(CardId.KashtiraBirth, true, true))
{
if (Card.Location == CardLocation.Hand)
{
AI.SelectPlace(SelectSTPlace(Card, true));
}
return true;
}
return false;
}
private bool KashtiraBirthEffect_2()
{
if (link_mode) return false;
return KashtiraBirthEffect_3();
}
private bool KashtiraBirthEffect_3()
{
if (Card.Location == CardLocation.Hand || (Card.Location == CardLocation.SpellZone && Card.IsFacedown())) return false;
List<int> cardsid = new List<int>();
if (!activate_KashtiraUnicorn_1 && !active_KashtiraPapiyas_1 && (Bot.HasInHand(CardId.KashtiraPapiyas) || CheckRemainInDeck(CardId.KashtiraPapiyas) > 0)) cardsid.Add(CardId.KashtiraPapiyas);
if (!activate_KashtiraFenrir_1) cardsid.Add(CardId.KashtiraFenrir);
if (!activate_KashtiraUnicorn_1) cardsid.Add(CardId.KashtiraUnicorn);
if (!activate_KashtiraRiseheart_2) cardsid.Add(CardId.KashtiraRiseheart);
cardsid.Add(CardId.KashtiraFenrir);
cardsid.Add(CardId.KashtiraUnicorn);
cardsid.Add(CardId.KashtiraTearlaments);
cardsid.Add(CardId.KashtiraScareclaw);
cardsid.Add(CardId.KashtiraRiseheart);
AI.SelectCard(cardsid);
return true;
}
private bool KashtiraUnicornEffect()
{
if (Card.IsDisabled()) return false;
if (ActivateDescription == Util.GetStringId(CardId.KashtiraUnicorn, 1))
{
if ((!Bot.HasInHand(CardId.KashtiraPapiyas) && !active_KashtiraPapiyas_1)
||(Bot.HasInHandOrInSpellZone(CardId.KashtiraBirth) && !Bot.HasInHand(CardId.KashtiraPapiyas)))
AI.SelectCard(CardId.KashtiraPapiyas, CardId.KashtiraBirth);
else
AI.SelectCard(CardId.KashtiraBirth, CardId.KashtiraPapiyas);
activate_KashtiraUnicorn_1 = true;
return true;
}
else
{
return true;
}
}
}
}
...@@ -14,6 +14,21 @@ namespace WindBot.Game.AI.Decks ...@@ -14,6 +14,21 @@ namespace WindBot.Game.AI.Decks
: base(ai, duel) : base(ai, duel)
{ {
AddExecutor(ExecutorType.Activate, _CardId.黑洞, 黑洞Effect); AddExecutor(ExecutorType.Activate, _CardId.黑洞, 黑洞Effect);
AddExecutor(ExecutorType.Activate, _CardId.傲慢之壶);
AddExecutor(ExecutorType.Activate, _CardId.大风暴, 大风暴Effect);
AddExecutor(ExecutorType.Activate, _CardId.大灾害, 大风暴Effect);
AddExecutor(ExecutorType.Activate, _CardId.魔法筒, 魔法筒Effect);
AddExecutor(ExecutorType.Activate, _CardId.炸甲, 炸甲Effect);
AddExecutor(ExecutorType.Activate, _CardId.落穴, 落穴Effect);
AddExecutor(ExecutorType.Activate, _CardId.圣塔, 圣塔Effect);
AddExecutor(ExecutorType.Activate, _CardId.捕获, 圣塔Effect);
AddExecutor(ExecutorType.Activate, _CardId.遮盖罩, 圣塔Effect);
AddExecutor(ExecutorType.Activate, _CardId.亚龙地狱, 亚龙地狱Effect);
AddExecutor(ExecutorType.Activate, _CardId.激流葬, 激流葬Effect);
AddExecutor(ExecutorType.Activate, _CardId.真空湮灭, 真空湮灭Effect);
AddExecutor(ExecutorType.Activate, _CardId.圣防, 圣防Effect);
AddExecutor(ExecutorType.Activate, _CardId.暗黑释放, 圣防Effect);
AddExecutor(ExecutorType.Activate, ImFeelingLucky); AddExecutor(ExecutorType.Activate, ImFeelingLucky);
AddExecutor(ExecutorType.SpSummon, ImFeelingLucky); AddExecutor(ExecutorType.SpSummon, ImFeelingLucky);
AddExecutor(ExecutorType.SpSummon, ImFeelingUnlucky); AddExecutor(ExecutorType.SpSummon, ImFeelingUnlucky);
...@@ -23,13 +38,9 @@ namespace WindBot.Game.AI.Decks ...@@ -23,13 +38,9 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, _CardId.苍救降, 苍救降Effect); AddExecutor(ExecutorType.Activate, _CardId.苍救降, 苍救降Effect);
AddExecutor(ExecutorType.Activate, _CardId.传说战士, 传说战士Effect); AddExecutor(ExecutorType.Activate, _CardId.传说战士, 传说战士Effect);
AddExecutor(ExecutorType.Activate, _CardId.海龙骑士, 海龙骑士Effect); AddExecutor(ExecutorType.Activate, _CardId.海龙骑士, 海龙骑士Effect);
AddExecutor(ExecutorType.Activate, _CardId.大风暴, 大风暴Effect);
AddExecutor(ExecutorType.Activate, _CardId.魔法筒, 魔法筒Effect);
AddExecutor(ExecutorType.Activate, _CardId.炸甲, 炸甲Effect);
AddExecutor(ExecutorType.Activate, _CardId.落穴, 落穴Effect);
AddExecutor(ExecutorType.Activate, _CardId.激流葬, 激流葬Effect);
AddExecutor(ExecutorType.Activate, _CardId.圣防, 圣防Effect);
AddExecutor(ExecutorType.Activate, _CardId.暗黑释放, 圣防Effect);
AddExecutor(ExecutorType.Activate, _CardId.手枪龙, 手枪龙Effect); AddExecutor(ExecutorType.Activate, _CardId.手枪龙, 手枪龙Effect);
AddExecutor(ExecutorType.Activate, _CardId.最强战旗, 最强战旗Eff); AddExecutor(ExecutorType.Activate, _CardId.最强战旗, 最强战旗Eff);
//AddExecutor(ExecutorType.Activate, _CardId.升阵, 装备act); //AddExecutor(ExecutorType.Activate, _CardId.升阵, 装备act);
...@@ -104,6 +115,7 @@ namespace WindBot.Game.AI.Decks ...@@ -104,6 +115,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Summon, _CardId.伟大魔兽, 伟大魔兽Sum); AddExecutor(ExecutorType.Summon, _CardId.伟大魔兽, 伟大魔兽Sum);
AddExecutor(ExecutorType.MonsterSet, _CardId.千年盾, DefaultMonsterSummon); AddExecutor(ExecutorType.MonsterSet, _CardId.千年盾, DefaultMonsterSummon);
AddExecutor(ExecutorType.Activate, _CardId.死供, 死供Effect); AddExecutor(ExecutorType.Activate, _CardId.死供, 死供Effect);
AddExecutor(ExecutorType.Activate, _CardId.活杀, 活杀Effect);
AddExecutor(ExecutorType.Activate, _CardId.耳语妖精, 耳语妖精Effect); AddExecutor(ExecutorType.Activate, _CardId.耳语妖精, 耳语妖精Effect);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos); AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
AddExecutor(ExecutorType.Repos, 圣防Repos); AddExecutor(ExecutorType.Repos, 圣防Repos);
...@@ -242,7 +254,10 @@ namespace WindBot.Game.AI.Decks ...@@ -242,7 +254,10 @@ namespace WindBot.Game.AI.Decks
return selected; return selected;
} }
public override bool OnSelectHand()
{
return true;
}
public override int OnSelectOption(IList<int> options) public override int OnSelectOption(IList<int> options)
{ {
return Program.Rand.Next(options.Count); return Program.Rand.Next(options.Count);
......
using YGOSharp.OCGWrapper.Enums; using System;
using YGOSharp.OCGWrapper.Enums;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Diagnostics;
using WindBot; using WindBot;
using WindBot.Game; using WindBot.Game;
using WindBot.Game.AI; using WindBot.Game.AI;
using System; using System.Linq;
namespace WindBot.Game.AI.Decks namespace WindBot.Game.AI.Decks
{ {
[Deck("MathMech", "AI_Mathmech")] [Deck("MathMech", "AI_Mathmech")]
public class MathMechExecutor : DefaultExecutor public class MathmechExecutor : DefaultExecutor
{ {
public class CardId public class CardId
{ {
public const int 最强战旗 = 120181001; public const int MathmechNebla = 53577438;
public const int 钢机神 = 120155015; public const int MathmechSigma = 27182739;
public const int 连击龙 = 120110001; public const int MathmechDivision = 89743495;
public const int 恶德 = 120183024; public const int MathmechAddition = 80965043;
public const int 旗兽 = 120193002; public const int MathmechSubtra = 16360142;
public const int 社员 = 120183002; public const int Mathmechdouble = 52354896;
public const int MathmechFinalSigma = 42632209;
public const int 成金恐龙王 = 120151010; public const int Mathmechalem = 85692042;
public const int 突击坦克 = 120183031; public const int MathmechMagma = 15248594;
public const int 工匠无人机 = 120183030; public const int BalancerLord = 08567955;
public const int 双角兽 = 120181011; public const int LightDragon = 61399402;
public const int 瞄准鹰 = 120193003;
public const int 死苏 = 120194004; // spells
public const int 世纪末兽机界 = 120130039; public const int upstartGoblin = 70368879;
public const int 铁之重击 = 120183054; public const int raigeki = 12580477;
public const int 对死者的供奉 = 120151023; public const int cynetmining = 57160136;
public const int PotOfDesires= 35261759;
public const int 兽之拳 = 120155060; public const int lightningStorm = 14532163;
public const int 减俸 = 120183062; public const int cosmicCyclone = 08267140;
public const int 左迁 = 120183063; public const int foolishBurial = 81439173;
public const int 冻结 = 120183064; public const int OneTimePasscode = 93104632;
public const int 暗黑释放 = 120105013; public const int mathmechEquation = 14025912;
} //traps
public const int threanteningRoar = 36361633;
public MathMechExecutor(GameAI ai, Duel duel) //tokens
public const int securitytoken = 93104633;
}
public MathmechExecutor(GameAI ai, Duel duel)
: base(ai, duel) : base(ai, duel)
{ {
AddExecutor(ExecutorType.SpSummon); AddExecutor(ExecutorType.Activate, CardId.raigeki ,when_raigeki);
AddExecutor(ExecutorType.Activate, CardId.铁之重击); AddExecutor(ExecutorType.Activate, CardId.upstartGoblin);
AddExecutor(ExecutorType.Activate, CardId.成金恐龙王); AddExecutor(ExecutorType.Activate, CardId.OneTimePasscode);
AddExecutor(ExecutorType.Activate, CardId.恶德, 恶德Effect); AddExecutor(ExecutorType.SpellSet, CardId.threanteningRoar);
AddExecutor(ExecutorType.Activate, CardId.对死者的供奉, 死供Eff); AddExecutor(ExecutorType.Activate,CardId.cosmicCyclone , when_cosmic);
AddExecutor(ExecutorType.Activate, CardId.最强战旗, 最强战旗Eff); AddExecutor(ExecutorType.Activate,CardId.lightningStorm ,lightstorm_target);
AddExecutor(ExecutorType.Activate, CardId.突击坦克, 突击坦克Effect); AddExecutor(ExecutorType.Activate,CardId.foolishBurial,foolish_burial_target);
AddExecutor(ExecutorType.Activate, CardId.瞄准鹰, 瞄准鹰Effect); AddExecutor(ExecutorType.Activate,CardId.mathmechEquation,mathmech_equation_target);
AddExecutor(ExecutorType.Activate, CardId.双角兽, 双角兽Effect); AddExecutor(ExecutorType.Activate,CardId.PotOfDesires);
AddExecutor(ExecutorType.Repos, CardId.双角兽, 双角兽summon);
AddExecutor(ExecutorType.Repos, CardId.瞄准鹰, 瞄准鹰summon);
AddExecutor(ExecutorType.Repos, CardId.最强战旗, DefaultMonsterRepos); AddExecutor(ExecutorType.Summon, CardId.MathmechNebla);
AddExecutor(ExecutorType.Repos, CardId.钢机神, DefaultMonsterRepos); AddExecutor(ExecutorType.Summon,CardId.BalancerLord );
AddExecutor(ExecutorType.Repos, CardId.恶德, DefaultMonsterRepos); AddExecutor(ExecutorType.Summon, CardId.Mathmechdouble);
AddExecutor(ExecutorType.Summon, CardId.最强战旗, DefaultDoubleSummon); AddExecutor(ExecutorType.Summon, CardId.MathmechSubtra);
AddExecutor(ExecutorType.Summon, CardId.钢机神, DefaultDoubleSummon); AddExecutor(ExecutorType.Summon, CardId.MathmechAddition);
AddExecutor(ExecutorType.Summon, CardId.恶德, DefaultDoubleSummon); AddExecutor(ExecutorType.Summon, CardId.MathmechDivision);
AddExecutor(ExecutorType.Summon, CardId.最强战旗, DefaultMonsterSummon); AddExecutor(ExecutorType.Summon, CardId.MathmechDivision);
AddExecutor(ExecutorType.Summon, CardId.钢机神, DefaultMonsterSummon); AddExecutor(ExecutorType.Activate, CardId.MathmechSigma);
AddExecutor(ExecutorType.Summon, CardId.恶德, DefaultMonsterSummon); AddExecutor(ExecutorType.Activate,CardId.threanteningRoar);
AddExecutor(ExecutorType.Summon, CardId.双角兽, 双角兽summon); //xyz summons
AddExecutor(ExecutorType.Summon, CardId.成金恐龙王, 成金恐龙王Summon); AddExecutor(ExecutorType.SpSummon, CardId.Mathmechalem, when_Mathmechalem);
AddExecutor(ExecutorType.Summon, CardId.瞄准鹰, 瞄准鹰summon); //xyz effects
AddExecutor(ExecutorType.Summon, CardId.瞄准鹰, 瞄准鹰summon2); AddExecutor(ExecutorType.Activate, CardId.Mathmechalem, mathchalenEffect);
AddExecutor(ExecutorType.Summon, CardId.瞄准鹰, 瞄准鹰summon3); //Synchro
AddExecutor(ExecutorType.Summon, CardId.双角兽, 瞄准鹰双角兽summon); AddExecutor(ExecutorType.SpSummon, CardId.MathmechFinalSigma , FinalSigmaSummon);
AddExecutor(ExecutorType.Summon, CardId.成金恐龙王, 瞄准鹰成金恐龙王summon);
AddExecutor(ExecutorType.Summon, CardId.突击坦克, 瞄准鹰坦克summon); AddExecutor(ExecutorType.Activate, CardId.Mathmechdouble, doubleEffect);
AddExecutor(ExecutorType.Summon, CardId.最强战旗, DefaultOverSummon);
AddExecutor(ExecutorType.Summon, CardId.钢机神, DefaultOverSummon); //normal effects
AddExecutor(ExecutorType.Activate, CardId.死苏, 死苏effect); AddExecutor(ExecutorType.Activate, CardId.MathmechNebla, NeblaEffect);
AddExecutor(ExecutorType.Activate, CardId.最强战旗, 最强战旗Effect); AddExecutor(ExecutorType.Activate,CardId.MathmechDivision , divisionEffect);
AddExecutor(ExecutorType.Activate, CardId.对死者的供奉, 死供Effect); AddExecutor(ExecutorType.Activate,CardId.BalancerLord , active_balancer);
AddExecutor(ExecutorType.Activate, CardId.钢机神, 钢机神Effect); AddExecutor(ExecutorType.Activate, CardId.MathmechSubtra , whom_subtra);
//AddExecutor(ExecutorType.Activate, CardId.钢机神, 钢机神1Effect); AddExecutor(ExecutorType.Activate, CardId.MathmechAddition , whom_addition);
AddExecutor(ExecutorType.MonsterSet, CardId.成金恐龙王); //spell effects
AddExecutor(ExecutorType.Activate, CardId.工匠无人机, 无人机Effect); AddExecutor(ExecutorType.Activate, CardId.cynetmining , how_to_cynet_mine);
AddExecutor(ExecutorType.Summon, CardId.工匠无人机, 无人机summon); AddExecutor(ExecutorType.SpSummon, CardId.MathmechMagma, MagmaSummon);
AddExecutor(ExecutorType.Summon, CardId.突击坦克, 突击坦克summon); AddExecutor(ExecutorType.Activate,CardId.MathmechFinalSigma);
; AddExecutor(ExecutorType.Activate,CardId.MathmechMagma);
AddExecutor(ExecutorType.MonsterSet, CardId.工匠无人机);
AddExecutor(ExecutorType.MonsterSet, CardId.突击坦克);
AddExecutor(ExecutorType.Summon, CardId.旗兽, 突击坦克summon); //function
AddExecutor(ExecutorType.Summon, CardId.社员, 突击坦克summon);
AddExecutor(ExecutorType.MonsterSet, CardId.旗兽);
AddExecutor(ExecutorType.MonsterSet, CardId.社员);
AddExecutor(ExecutorType.MonsterSet, CardId.瞄准鹰);
AddExecutor(ExecutorType.MonsterSet, CardId.双角兽);
AddExecutor(ExecutorType.Activate, CardId.世纪末兽机界, DefaultField);
AddExecutor(ExecutorType.Activate, CardId.兽之拳);
AddExecutor(ExecutorType.Activate, CardId.左迁, 左迁1Effect);
AddExecutor(ExecutorType.Activate, CardId.减俸);
AddExecutor(ExecutorType.Activate, CardId.左迁, 左迁2Effect);
AddExecutor(ExecutorType.Activate, CardId.冻结, 冻结Effect);
AddExecutor(ExecutorType.Activate, DefaultDontChainMyself);
AddExecutor(ExecutorType.Repos, CardId.最强战旗, 圣防Repos);
AddExecutor(ExecutorType.Repos, CardId.钢机神, 圣防Repos);
AddExecutor(ExecutorType.SummonOrSet, DefaultMonsterSummon);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
AddExecutor(ExecutorType.SpellSet, DefaultSpellSet);
AddExecutor(ExecutorType.SpellSet, CardId.铁之重击);
AddExecutor(ExecutorType.SpellSet, CardId.死苏);
AddExecutor(ExecutorType.SpellSet, CardId.对死者的供奉);
AddExecutor(ExecutorType.Activate, CardId.世纪末兽机界, DefaultField2);
}
private List<int> HintMsgForEnemy = new List<int>
{
HintMsg.Release, HintMsg.Destroy, HintMsg.Remove, HintMsg.ToGrave, HintMsg.ReturnToHand, HintMsg.ToDeck,
HintMsg.FusionMaterial, HintMsg.SynchroMaterial, HintMsg.XyzMaterial, HintMsg.LinkMaterial, HintMsg.Disable
};
private List<int> HintMsgForMaxSelect = new List<int>
{
HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.AddToHand, HintMsg.ToDeck, HintMsg.Destroy
};
public override IList<ClientCard> OnSelectCard(IList<ClientCard> _cards, int min, int max, int hint, bool cancelable)
{
if (Duel.Phase == DuelPhase.BattleStart)
return null;
if (AI.HaveSelectedCards())
return null;
IList<ClientCard> selected = new List<ClientCard>();
IList<ClientCard> cards = new List<ClientCard>(_cards);
if (max > cards.Count)
max = cards.Count;
if (HintMsgForEnemy.Contains(hint))
{
IList<ClientCard> enemyCards = cards.Where(card => card.Controller == 1).ToList();
// select enemy's card first
while (enemyCards.Count > 0 && selected.Count < max)
{
ClientCard card = enemyCards[Program.Rand.Next(enemyCards.Count)];
selected.Add(card);
enemyCards.Remove(card);
cards.Remove(card);
}
} }
if (HintMsgForMaxSelect.Contains(hint)) public override bool OnSelectHand()
{
//select max cards
while (selected.Count < max)
{ {
ClientCard card = cards[Program.Rand.Next(cards.Count)]; return false;
selected.Add(card);
cards.Remove(card);
}
}
return selected;
} }
private bool when_cosmic()
{
public override bool OnSelectHand() if (Enemy.GetSpellCount() > 1)
{ {
// go first AI.SelectCard(Util.GetBestEnemySpell());
return true; return true;
} }
else
bool DoubleTribute = false;
public override void OnNewTurn()
{ {
DoubleTribute = false; return false;
} }
private bool DefaultDoubleSummon() }
private bool divisionEffect()
{ {
if (!DoubleTribute) return false; if (Enemy.GetMonsterCount() > 0)
else {
AI.SelectMaterials(CardId.双角兽); AI.SelectCard(Util.GetBestEnemyMonster(canBeTarget:true,onlyFaceup:true));
DoubleTribute = false;
return true; return true;
} }
private bool DefaultOverSummon() else
{ {
if (Bot.Hand.Count >= 6 && Bot.HasInMonstersZone(CardId.恶德)) return true; return false;
else return false; }
} }
private bool 左迁1Effect()
{
if (Enemy.BattlingMonster.Attack > 2000) private bool when_raigeki()
{
if (Enemy.GetMonsterCount() > 3)
{ {
AI.SelectCard(Enemy.BattlingMonster);
return true; return true;
} }
else
{
return false; return false;
} }
private bool 左迁2Effect() }
private bool whom_addition()
{ {
ClientCard target = Util.GetBestEnemyMonster(true, true); AI.SelectCard(Util.GetBestBotMonster(onlyATK:true));
if (target != null)
AI.SelectCard(target);
return true; return true;
} }
private bool 冻结Effect()
{ private bool whom_subtra()
foreach (ClientCard monster in Bot.GetMonsters())
{ {
if (monster.IsFacedown()) try
{ {
AI.SelectCard(monster); AI.SelectCard(Util.GetBestEnemyMonster(onlyFaceup: true, canBeTarget: true));
return true; return true;
} }
else if (monster.IsDefense()) catch (Exception e)
{ {
AI.SelectCard(monster);
return true; return true;
} }
} }
AI.SelectCard(Bot.MonsterZone.GetLowestAttackMonster());
return true; private bool active_balancer()
}
private bool 钢机神Effect()
{ {
if (Duel.Turn == 1) if (Bot.HasInHand(CardId.MathmechNebla))
{ {
return false; AI.SelectCard(CardId.MathmechNebla);
}
else
//if (Enemy.HasAttackingMonster() || Enemy.GetMonsterCount() < 1)
AI.SelectCard(CardId.最强战旗, CardId.钢机神, CardId.恶德, CardId.旗兽, CardId.突击坦克, CardId.工匠无人机, CardId.社员, CardId.双角兽, CardId.瞄准鹰);
//else AI.SelectCard(Bot.Graveyard.GetHighestLevelMonster());
return true; return true;
} }
else
private bool 钢机神1Effect()
{
if (Enemy.HasDefendingMonster() && Enemy.GetMonsterCount() >= 1 && Duel.Turn > 1)
AI.SelectCard(Bot.Graveyard.GetMonsters());
/*{
List<ClientCard> cards = new List<ClientCard>(Bot.Graveyard.GetMatchingCards(card => (card.Race & (int)CardRace.Machine) > 0));
cards.Sort(CardContainer.CompareCardLevel); ClientCard selectedCard = null;
for (int i = cards.Count - 1; i >= 0; --i)
{
ClientCard card = cards[i];
if ((selectedCard == null || card.Attack > selectedCard.Attack))
{ {
selectedCard = card; return true;
break;
} }
} }
if (selectedCard != null) private bool lightstorm_target()
{ {
AI.SelectCard(selectedCard); if ((Enemy.MonsterZone.ToList().Count > Enemy.SpellZone.ToList().Count ) && Enemy.MonsterZone.ToList().Count>3)
return true; {
} AI.SelectPlace(Zones.MonsterZones);
}*/
return true; return true;
} }
private bool 恶德Effect() else
{ {
foreach (ClientCard m in Bot.Hand) AI.SelectPlace(Zones.SpellZones);
AI.SelectCard(m);
AI.SelectNextCard(CardId.左迁, CardId.减俸);
AI.SelectNextCard(CardId.左迁, CardId.减俸);
return true; return true;
} }
private bool 死苏effect()
{
List<ClientCard> cards = new List<ClientCard>(Bot.Graveyard.GetMatchingCards(card => card.IsCanRevive()));
cards.Sort(CardContainer.CompareCardAttack);
ClientCard selectedCard = null;
for (int i = cards.Count - 1; i >= 0; --i)
{
ClientCard card = cards[i];
if (card.Attack < 2000)
break;
if (card.IsMonster())
{
selectedCard = card;
break;
}
} }
cards = new List<ClientCard>(Enemy.Graveyard.GetMatchingCards(card => card.IsCanRevive()));
cards.Sort(CardContainer.CompareCardAttack); private bool mathmech_equation_target()
for (int i = cards.Count - 1; i >= 0; --i)
{ {
ClientCard card = cards[i]; if (Bot.HasInGraveyard(CardId.MathmechNebla))
if (card.Attack < 2000)
break;
if (card.IsMonster() && card.HasType(CardType.Normal) && (selectedCard == null || card.Attack > selectedCard.Attack))
{ {
selectedCard = card; AI.SelectCard(CardId.MathmechNebla);
break; return true;
}
} }
if (selectedCard != null) else
{ {
AI.SelectCard(selectedCard); AI.SelectCard((Util.GetBestBotMonster(onlyATK: true)));
return true; return true;
} }
return false;
} }
private bool 成金恐龙王Summon()
private bool foolish_burial_target()
{ {
if (Enemy.GetHandCount() < 1) return true; AI.SelectCard(CardId.MathmechNebla);
return false;
}
private bool 死供Effect()
{
if (Util.IsOneEnemyBetterThanValue(1900, false))
{
foreach (ClientCard m in Bot.Hand)
AI.SelectCard(m);
foreach (ClientCard mon in Enemy.GetMonsters())
if (mon.Level >= 9)
AI.SelectNextCard(mon);
else if (mon.Level >= 8)
AI.SelectNextCard(mon);
else if (mon.Level >= 7)
AI.SelectNextCard(mon);
else if (mon.Level >= 5)
AI.SelectNextCard(mon);
return true; return true;
} }
return false; private bool how_to_cynet_mine()
}
private bool 死供Eff()
{ {
if (Util.IsOneEnemyBetterThanValue(2600, false)) AI.SelectCard(Util.GetWorstBotMonster());
if (!Bot.HasInHandOrInMonstersZoneOrInGraveyard(CardId.MathmechSigma))
{ {
foreach (ClientCard m in Bot.Hand) AI.SelectNextCard(CardId.MathmechSigma);
AI.SelectCard(m);
foreach (ClientCard mon in Enemy.GetMonsters())
if (mon.Level >= 8)
AI.SelectNextCard(mon);
else if (mon.Level >= 7)
AI.SelectNextCard(mon);
else if (mon.Level >= 5)
AI.SelectNextCard(mon);
return true; return true;
} }
return false;
}
private bool 突击坦克Effect()
{
foreach (ClientCard mon in Enemy.GetMonsters())
if (mon.Level >= 9)
AI.SelectCard(mon);
else if (mon.Level >= 8)
AI.SelectCard(mon);
else if (mon.Level >= 6)
AI.SelectCard(mon);
else if (mon.Level >= 4)
AI.SelectCard(mon);
else if (mon.Level >= 2)
AI.SelectCard(mon);
else if (mon.Level >= 1)
AI.SelectCard(mon);
return true; return true;
} }
private bool 突击坦克summon() private bool when_Mathmechalem()
{ {
if (Bot.MonsterZone.GetMatchingCardsCount(card => (card.Race & (int)CardRace.Machine) > 0) == 2 || Util.GetOneEnemyBetterThanMyBest(true, true) ==null) return true; if (Bot.HasInMonstersZone(CardId.MathmechNebla)){
return false; return false;
} }
private bool 无人机summon() else if(Bot.HasInMonstersZone(CardId.MathmechSigma) && Bot.HasInMonstersZone(CardId.Mathmechdouble))
{ {
if (Bot.Hand.GetMatchingCardsCount(card => (card.Race & (int)CardRace.Machine) > 0) >= 1 || Util.GetOneEnemyBetterThanMyBest(true, true) == null)
return true;
return false; return false;
} }
else if (Bot.HasInMonstersZone(CardId.Mathmechalem))
private bool 双角兽summon()
{ {
if (Bot.Graveyard.GetMatchingCardsCount(card => (card.Race & (int)CardRace.Machine) > 0) >= 3 && Bot.HasInHand(new[] { CardId.最强战旗, CardId.钢机神, CardId.恶德 }))
return true;
return false; return false;
} }
private bool 双角兽Effect() else
{
if (Bot.HasInHand(new[] { CardId.最强战旗, CardId.钢机神, CardId.恶德 }) && !Bot.HasInMonstersZone(new[] { CardId.最强战旗, CardId.钢机神 }))
{ {
AI.SelectCard(CardId.瞄准鹰, CardId.双角兽, CardId.工匠无人机, CardId.突击坦克, CardId.社员, CardId.旗兽, CardId.恶德, CardId.钢机神, CardId.最强战旗);
DoubleTribute = true;
return true; return true;
} }
return false;
} }
private bool 瞄准鹰双角兽summon() private bool FinalSigmaSummon()
{
if (Duel.Turn < 1)
{ {
if (Bot.HasInMonstersZone(CardId.瞄准鹰) && Bot.HasInHand(new[] { CardId.最强战旗, CardId.钢机神, CardId.恶德 }))
return true;
return false; return false;
} }
private bool 瞄准鹰坦克summon() if ((Bot.HasInMonstersZone(CardId.Mathmechdouble) && (( Bot.HasInMonstersZone(CardId.MathmechSigma)) || Bot.HasInMonstersZone(CardId.MathmechNebla))))
{ {
if (Bot.HasInMonstersZone(CardId.瞄准鹰) && Bot.HasInHand(new[] { CardId.最强战旗, CardId.钢机神, CardId.恶德 })) AI.SelectPosition(CardPosition.Attack);
try { AI.SelectPlace(Zones.ExtraMonsterZones); }
catch { }
return true; return true;
return false;
} }
private bool 瞄准鹰成金恐龙王summon() else
{ {
if (Bot.HasInMonstersZone(CardId.瞄准鹰) && Bot.HasInHand(new[] { CardId.最强战旗, CardId.钢机神, CardId.恶德 }))
return true; return true;
return false;
} }
private bool 瞄准鹰summon()
}
private bool NeblaEffect()
{ {
foreach (ClientCard m in Bot.GetMonsters()) bool a = Bot.HasInMonstersZone(CardId.MathmechSubtra) || Bot.HasInMonstersZone(CardId.securitytoken) || Bot.HasInMonstersZone(CardId.MathmechSigma) || Bot.HasInMonstersZone(CardId.MathmechAddition) || Bot.HasInMonstersZone(CardId.Mathmechalem) || Bot.HasInMonstersZone(CardId.MathmechDivision);
if (m.HasAttribute(CardAttribute.Light) && m.Level <= 4 && m.IsFaceup()) if (a)
if (Bot.HasInHand(new[] { CardId.最强战旗, CardId.钢机神, CardId.恶德 })) {
if (Enemy.MonsterZone.GetMatchingCardsCount(card => card.Level >= 7) > 0) List<int> cards = new List<int>();
return true; cards.Add(CardId.MathmechSigma);
return false; cards.Add(CardId.MathmechSubtra);
cards.Add(CardId.MathmechAddition);
cards.Add(item:CardId.MathmechDivision);
cards.Add(item:CardId.Mathmechalem);
cards.Add(CardId.securitytoken);
int u = 0;
List<ClientCard> monsters = Bot.GetMonstersInMainZone();
for (int i = 0; i < monsters.Count; i++)
{
if (cards.Contains(monsters[i].Id))
{
u = monsters[i].Id;
break;
} }
private bool 瞄准鹰summon2() else
{ {
if (Bot.GetCountCardInZone(Bot.Hand, CardId.瞄准鹰) >= 2) u = CardId.securitytoken;
if (Bot.HasInHand(new[] { CardId.最强战旗, CardId.钢机神, CardId.恶德 })) }
if (Enemy.MonsterZone.GetMatchingCardsCount(card => card.Level >= 7) > 0) }
AI.SelectCard(CardId.securitytoken);
AI.SelectNextCard(CardId.Mathmechdouble);
return true; return true;
return false;
} }
private bool 瞄准鹰summon3() if (Card.Location == CardLocation.Grave)
{ {
if (Bot.HasInHand(CardId.双角兽) || Bot.HasInHand(CardId.突击坦克) || Bot.HasInHand(CardId.成金恐龙王))
if (Bot.HasInHand(new[] { CardId.最强战旗, CardId.钢机神, CardId.恶德 }))
if (Enemy.MonsterZone.GetMatchingCardsCount(card => card.Level >= 7) > 0)
return true; return true;
}
else
{
return false; return false;
} }
private bool 瞄准鹰Effect() }
private bool doubleEffect()
{ {
if (Bot.HasInMonstersZone(CardId.MathmechNebla) || Bot.HasInMonstersZone(CardId.MathmechSigma))
if (Bot.MonsterZone.GetMatchingCardsCount(card => card.Level <= 4 && card.IsFaceup()) >= 2 && Bot.HasInHand(new[] { CardId.最强战旗, CardId.钢机神, CardId.恶德, CardId.旗兽, CardId.社员 })) {
return true;
};
if (Card.Location == CardLocation.Grave )
{ {
AI.SelectCard(CardId.瞄准鹰, CardId.突击坦克, CardId.成金恐龙王, CardId.社员, CardId.旗兽);
AI.SelectNextCard(CardId.瞄准鹰, CardId.突击坦克, CardId.成金恐龙王, CardId.社员, CardId.旗兽);
AI.SelectThirdCard(CardId.最强战旗, CardId.钢机神, CardId.恶德, CardId.旗兽, CardId.社员);
return true; return true;
} }
else
{
return false; return false;
} }
private bool 无人机Effect() }
{
private bool mathchalenEffect()
if ((Bot.MonsterZone.GetMatchingCardsCount(card => card.Level < 5) + Bot.Hand.GetMatchingCardsCount(card => card.Level < 5)) <= 2)
{ {
if (Bot.Hand.GetMatchingCardsCount(card => card.Level > 5) > 2) if (Duel.Turn < 1)
AI.SelectCard(CardId.最强战旗, CardId.钢机神, CardId.恶德);
else if (Bot.Hand.GetMatchingCardsCount(card => card.Level > 5) == 1 && (Bot.MonsterZone.GetMatchingCardsCount(card => card.Level < 5) + Bot.Hand.GetMatchingCardsCount(card => card.Level < 5)) == 1)
{ {
AI.SelectCard(CardId.最强战旗, CardId.钢机神, CardId.恶德);
return true;
}
return false; return false;
} }
else if ( (Bot.HasInHandOrInGraveyard(CardId.MathmechNebla) && !Bot.HasInMonstersZone(CardId.MathmechNebla)) && (Card.Location == CardLocation.FieldZone && Card.HasXyzMaterial(0)) )
AI.SelectCard(CardId.瞄准鹰, CardId.突击坦克, CardId.工匠无人机, CardId.社员, CardId.旗兽); {
AI.SelectCard(CardId.Mathmechalem);
AI.SelectNextCard(CardId.MathmechNebla);
return true; return true;
} }
private bool 最强战旗Effect()
{ if (Bot.HasInHandOrInGraveyard(CardId.Mathmechdouble) &&
if (Util.IsOneEnemyBetterThanValue(1900, false)) (Bot.HasInMonstersZone(CardId.MathmechNebla) || Bot.HasInMonstersZone(CardId.MathmechSigma)) &&
{ Card.Location == CardLocation.FieldZone && Card.HasXyzMaterial(0))
foreach (ClientCard m in Bot.Hand) {
AI.SelectCard(m); AI.SelectCard(CardId.Mathmechalem);
foreach (ClientCard mon in Enemy.GetMonsters()) AI.SelectNextCard(CardId.Mathmechdouble);
if (mon.Level >= 9)
AI.SelectNextCard(mon);
else if (mon.Level >= 8)
AI.SelectNextCard(mon);
else if (mon.Level >= 7)
AI.SelectNextCard(mon);
else if (mon.Level >= 5)
AI.SelectNextCard(mon);
return true; return true;
} }
return false; if (!Bot.HasInHandOrInGraveyard(CardId.MathmechNebla) && Card.HasXyzMaterial(2))
{
AI.SelectCard(CardId.MathmechNebla);
AI.SelectThirdCard(CardId.MathmechNebla);
return true;
} }
private bool 最强战旗Eff()
{ if (!Bot.HasInHandOrInGraveyard(CardId.MathmechSigma) && Card.HasXyzMaterial(2))
if (Util.IsOneEnemyBetterThanValue(2500, false)) {
{ AI.SelectCard(CardId.MathmechSigma);
foreach (ClientCard m in Bot.Hand) AI.SelectThirdCard(CardId.MathmechSigma);
AI.SelectCard(m);
foreach (ClientCard mon in Enemy.GetMonsters())
if (mon.Level >= 9)
AI.SelectNextCard(mon);
else if (mon.Level >= 8)
AI.SelectNextCard(mon);
else if (mon.Level >= 7)
AI.SelectNextCard(mon);
else if (mon.Level >= 5)
AI.SelectNextCard(mon);
return true; return true;
} }
else
{
return false; return false;
};
} }
private bool DefaultField2()
private bool MagmaSummon()
{ {
if( Bot.GetHandCount() >= 2) if (Bot.HasInMonstersZone(CardId.MathmechNebla))
{ {
return true;
}
return false; return false;
} }
private bool 圣防Repos()
if (Bot.HasInMonstersZone(CardId.MathmechSigma) && Bot.HasInMonstersZone(CardId.Mathmechdouble))
{ {
if (Enemy.Graveyard.GetMatchingCardsCount(card => (card.Race & (int)CardRace.SpellCaster) > 0) >= 4 && Enemy.GetSpellCountWithoutField() >= 1 && Enemy.Graveyard.GetMatchingCardsCount(card => card.IsCode(CardId.暗黑释放)) < 3) return false;
}
else
{ {
if (Bot.MonsterZone.GetMatchingCardsCount(card => card.IsAttack() && card.Level >= 5) >= 2 && !Bot.HasDefendingMonster())
return true; return true;
} }
return false;
} }
public override int OnSelectPlace(int cardId, int player, CardLocation location, int available)
{
if (cardId == CardId.MathmechFinalSigma)
{
if ((Zones.z5 & available) > 0) return Zones.z5;
if ((Zones.z6 & available) > 0) return Zones.z6;
}
return base.OnSelectPlace(cardId, player, location, available);
} }
}
}
}
\ No newline at end of file
...@@ -63,14 +63,15 @@ namespace WindBot.Game.AI.Decks ...@@ -63,14 +63,15 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.起重龙); AddExecutor(ExecutorType.Activate, CardId.起重龙);
AddExecutor(ExecutorType.Activate, CardId.建造龙, 建造龙Effect); AddExecutor(ExecutorType.Activate, CardId.建造龙, 建造龙Effect);
AddExecutor(ExecutorType.Activate, CardId.镐头龙, 镐头龙Effect); AddExecutor(ExecutorType.Activate, CardId.镐头龙, 镐头龙Effect);
AddExecutor(ExecutorType.Summon, _CardId.伟大魔兽, 伟大魔兽Summon);
AddExecutor(ExecutorType.Summon, 幻刃急攻Summon);
AddExecutor(ExecutorType.Summon, CardId.镐头龙, 镐头龙Summon); AddExecutor(ExecutorType.Summon, CardId.镐头龙, 镐头龙Summon);
AddExecutor(ExecutorType.Summon, CardId.搅拌龙, 搅拌龙Summon); AddExecutor(ExecutorType.Summon, CardId.搅拌龙, 搅拌龙Summon);
AddExecutor(ExecutorType.MonsterSet, 幻刃急攻Set); AddExecutor(ExecutorType.MonsterSet, 幻刃急攻Set);
AddExecutor(ExecutorType.Summon, 幻刃急攻Summon);
AddExecutor(ExecutorType.SummonOrSet, DefaultMonsterSummon);
AddExecutor(ExecutorType.Activate, CardId.死者苏生, 死苏Effect); AddExecutor(ExecutorType.Activate, CardId.死者苏生, 死苏Effect);
AddExecutor(ExecutorType.Activate, CardId.贯通, 贯通Effect); AddExecutor(ExecutorType.Activate, CardId.贯通, 贯通Effect);
AddExecutor(ExecutorType.Summon, _CardId.伟大魔兽, 伟大魔兽Sum); AddExecutor(ExecutorType.SummonOrSet, DefaultMonsterSummon);
AddExecutor(ExecutorType.Activate, CardId.幻刃复归, 幻刃复归Effect); AddExecutor(ExecutorType.Activate, CardId.幻刃复归, 幻刃复归Effect);
AddExecutor(ExecutorType.Activate, CardId.幻刃封锁, 幻刃封锁Effect); AddExecutor(ExecutorType.Activate, CardId.幻刃封锁, 幻刃封锁Effect);
AddExecutor(ExecutorType.Activate, CardId.幻刃急攻, 幻刃急攻Effect); AddExecutor(ExecutorType.Activate, CardId.幻刃急攻, 幻刃急攻Effect);
...@@ -106,7 +107,7 @@ namespace WindBot.Game.AI.Decks ...@@ -106,7 +107,7 @@ namespace WindBot.Game.AI.Decks
private List<int> HintMsgForMaterial = new List<int> private List<int> HintMsgForMaterial = new List<int>
{ {
HintMsg.FusionMaterial, HintMsg.SynchroMaterial, HintMsg.XyzMaterial, HintMsg.LinkMaterial, HintMsg.Release HintMsg.FusionMaterial, HintMsg.SynchroMaterial, HintMsg.XyzMaterial, HintMsg.LinkMaterial, HintMsg.Tribute
}; };
private List<int> HintMsgForMaxSelect = new List<int> private List<int> HintMsgForMaxSelect = new List<int>
...@@ -321,10 +322,24 @@ namespace WindBot.Game.AI.Decks ...@@ -321,10 +322,24 @@ namespace WindBot.Game.AI.Decks
{ {
return 搅拌龙Effect(false); return 搅拌龙Effect(false);
} }
// protected override IList<ClientCard> OnSelectTribute(IList<ClientCard> cards, int min, int max)
protected bool 伟大魔兽Summon()
{
int[] materials = new[] { CardId.幻刃破龙, CardId.建造龙, CardId.幻龙重骑, CardId.起重龙 };
if (Bot.HasInMonstersZone(materials))
{
AI.SelectTribute(materials);
return true;
}
return false;
}
private bool 幻刃急攻Summon() private bool 幻刃急攻Summon()
{ {
if (Card.Level < 5 && (Card.Race & (int)CardRace.Wyrm) > 0 && if (Card.Level < 5 && (Card.Race & (int)CardRace.Wyrm) > 0 &&
Bot.HasInSpellZone(CardId.幻刃急攻) && !isUpperMonSummon()) Bot.HasInSpellZone(CardId.幻刃急攻) && !IsUpperMonSummon())
{ {
IList<ClientCard> lowerList = IList<ClientCard> lowerList =
Bot.Hand.GetMatchingCards(card => (card.Level < 5 && ((card.Race & (int)CardRace.Wyrm) > 0))); Bot.Hand.GetMatchingCards(card => (card.Level < 5 && ((card.Race & (int)CardRace.Wyrm) > 0)));
...@@ -352,7 +367,7 @@ namespace WindBot.Game.AI.Decks ...@@ -352,7 +367,7 @@ namespace WindBot.Game.AI.Decks
private bool 幻刃急攻Set() private bool 幻刃急攻Set()
{ {
if (Card.Level < 5 && (Card.Race & (int)CardRace.Wyrm) > 0 && if (Card.Level < 5 && (Card.Race & (int)CardRace.Wyrm) > 0 &&
Bot.HasInSpellZone(CardId.幻刃急攻) && !isUpperMonSummon()) Bot.HasInSpellZone(CardId.幻刃急攻) && !IsUpperMonSummon())
{ {
IList<ClientCard> lowerList = IList<ClientCard> lowerList =
Bot.Hand.GetMatchingCards(card => (card.Level < 5 && ((card.Race & (int)CardRace.Wyrm) > 0))); Bot.Hand.GetMatchingCards(card => (card.Level < 5 && ((card.Race & (int)CardRace.Wyrm) > 0)));
...@@ -416,7 +431,7 @@ namespace WindBot.Game.AI.Decks ...@@ -416,7 +431,7 @@ namespace WindBot.Game.AI.Decks
return tributeAllow >= (_card.Level > 6 ? 2 : 1); return tributeAllow >= (_card.Level > 6 ? 2 : 1);
} }
private bool isUpperMonSummon() //检查手卡是否有怪兽可以上级召唤 private bool IsUpperMonSummon() //检查手卡是否有怪兽可以上级召唤
{ {
foreach(ClientCard c in Bot.Hand.GetMatchingCards(card=>card.Level>4)) foreach(ClientCard c in Bot.Hand.GetMatchingCards(card=>card.Level>4))
{ {
...@@ -636,7 +651,7 @@ namespace WindBot.Game.AI.Decks ...@@ -636,7 +651,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (isAISelect) if (isAISelect)
{ {
int[] localList = new int[] { CardId.建造龙, CardId.龙重骑, CardId.起重龙 }; int[] localList = new int[] { CardId.建造龙, CardId.刃破龙, CardId.起重龙 };
if (Bot.HasInMonstersZone(CardId.建造龙) && 建造龙Effect(true, false)) if (Bot.HasInMonstersZone(CardId.建造龙) && 建造龙Effect(true, false))
{ {
if (Bot.HasInGraveyard(localList[0]) || Bot.HasInGraveyard(localList[1])) if (Bot.HasInGraveyard(localList[0]) || Bot.HasInGraveyard(localList[1]))
......
...@@ -102,10 +102,11 @@ namespace WindBot.Game.AI.Decks ...@@ -102,10 +102,11 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.MonsterSet, CardId.瞄准鹰); AddExecutor(ExecutorType.MonsterSet, CardId.瞄准鹰);
AddExecutor(ExecutorType.MonsterSet, CardId.双角兽); AddExecutor(ExecutorType.MonsterSet, CardId.双角兽);
AddExecutor(ExecutorType.Activate, CardId.世纪末兽机界, DefaultField); AddExecutor(ExecutorType.Activate, CardId.世纪末兽机界, DefaultField);
AddExecutor(ExecutorType.Activate, CardId.兽之拳); AddExecutor(ExecutorType.Activate, CardId.兽之拳, 兽之拳Effect);
AddExecutor(ExecutorType.Activate, CardId.左迁, 左迁1Effect); AddExecutor(ExecutorType.Activate, CardId.左迁, 左迁1Effect);
AddExecutor(ExecutorType.Activate, CardId.减俸); AddExecutor(ExecutorType.Activate, CardId.减俸);
AddExecutor(ExecutorType.Activate, CardId.左迁,左迁2Effect); AddExecutor(ExecutorType.Activate, CardId.左迁,左迁2Effect);
AddExecutor(ExecutorType.Activate, CardId.兽之拳);
AddExecutor(ExecutorType.Activate, CardId.冻结,冻结Effect); AddExecutor(ExecutorType.Activate, CardId.冻结,冻结Effect);
AddExecutor(ExecutorType.Activate, _CardId.魔法筒, 魔法筒Effect); AddExecutor(ExecutorType.Activate, _CardId.魔法筒, 魔法筒Effect);
AddExecutor(ExecutorType.Activate, _CardId.炸甲, 炸甲Effect); AddExecutor(ExecutorType.Activate, _CardId.炸甲, 炸甲Effect);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
using YGOSharp.OCGWrapper.Enums; using YGOSharp.OCGWrapper.Enums;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System;
using WindBot; using WindBot;
using WindBot.Game; using WindBot.Game;
using WindBot.Game.AI; using WindBot.Game.AI;
...@@ -62,13 +61,12 @@ namespace WindBot.Game.AI.Decks ...@@ -62,13 +61,12 @@ namespace WindBot.Game.AI.Decks
ChaosSpace_2, ChaosSpace_2,
ThunderDragonColossus, ThunderDragonColossus,
AccesscodeTalker, AccesscodeTalker,
DestroyReplace, DestroyReplace
ThunderDragonTitan
}; };
private const int THUNDER_COUNTD = 18; private const int THUNDER_COUNTD = 18;
List<bool> selectFlag = new List<bool>() List<bool> selectFlag = new List<bool>()
{ {
false,false,false,false,false,false,false,false false,false,false,false,false,false,false
}; };
List<bool> selectAtt = new List<bool>() List<bool> selectAtt = new List<bool>()
{ {
...@@ -250,6 +248,13 @@ namespace WindBot.Game.AI.Decks ...@@ -250,6 +248,13 @@ namespace WindBot.Game.AI.Decks
} }
} }
#endregion #endregion
public override bool OnSelectHand()
{
// go first
return true;
}
public override void OnNewTurn() public override void OnNewTurn()
{ {
handActivated = false; handActivated = false;
...@@ -274,6 +279,93 @@ namespace WindBot.Game.AI.Decks ...@@ -274,6 +279,93 @@ namespace WindBot.Game.AI.Decks
for (int i = 0; i < selectAtt.Count; i++) for (int i = 0; i < selectAtt.Count; i++)
selectAtt[i] = false; selectAtt[i] = false;
} }
private bool IsAvailableZone(int seq)
{
ClientCard card = Bot.MonsterZone[seq];
if (seq == 5 && Bot.MonsterZone[6] != null && Bot.MonsterZone[6].Controller == 0) return false;
if (seq == 6 && Bot.MonsterZone[5] != null && Bot.MonsterZone[5].Controller == 0) return false;
if (card == null) return true;
if (card.Controller != 0) return false;
if (card.IsFacedown()) return false;
if (card.IsDisabled()) return true;
if (card.Id == CardId.ThunderDragonColossus
|| card.Id == CardId.ThunderDragonTitan
|| card.Id == CardId.UnderworldGoddessoftheClosedWorld
|| card.Id == CardId.MekkKnightCrusadiaAvramax
|| card.Id == CardId.AccesscodeTalker
|| (card.Id == CardId.BowoftheGoddess && card.Attack > 800)
|| (card.Id == CardId.UnionCarrier && summon_UnionCarrier)) return false;
return true;
}
private bool IsAvailableLinkZone()
{
int zones = 0;
List<ClientCard> cards = Bot.GetMonstersInMainZone().Where(card => card != null && card.IsFaceup()).ToList();
foreach (var card in cards)
{
zones |= card.GetLinkedZones();
}
ClientCard e_card = Bot.MonsterZone[5];
if (e_card != null && e_card.IsFaceup() && e_card.HasType(CardType.Link))
{
if (e_card.Controller == 0)
{
if (e_card.HasLinkMarker(CardLinkMarker.BottomLeft))
zones |= 1 << 0;
if (e_card.HasLinkMarker(CardLinkMarker.Bottom))
zones |= 1 << 1;
if (e_card.HasLinkMarker(CardLinkMarker.BottomRight))
zones |= 1 << 2;
}
if (e_card.Controller == 1)
{
if (e_card.HasLinkMarker(CardLinkMarker.TopLeft))
zones |= 1 << 2;
if (e_card.HasLinkMarker(CardLinkMarker.Top))
zones |= 1 << 1;
if (e_card.HasLinkMarker(CardLinkMarker.TopRight))
zones |= 1 << 0;
}
}
e_card = Bot.MonsterZone[6];
if (e_card != null && e_card.IsFaceup() && e_card.HasType(CardType.Link))
{
if (e_card.Controller == 0)
{
if (e_card.HasLinkMarker(CardLinkMarker.BottomLeft))
zones |= 1 << 2;
if (e_card.HasLinkMarker(CardLinkMarker.Bottom))
zones |= 1 << 3;
if (e_card.HasLinkMarker(CardLinkMarker.BottomRight))
zones |= 1 << 4;
}
if (e_card.Controller == 1)
{
if (e_card.HasLinkMarker(CardLinkMarker.TopLeft))
zones |= 1 << 4;
if (e_card.HasLinkMarker(CardLinkMarker.Top))
zones |= 1 << 3;
if (e_card.HasLinkMarker(CardLinkMarker.TopRight))
zones |= 1 << 2;
}
}
zones &= 0x7f;
if ((zones & Zones.z0) > 0 && IsAvailableZone(0)) return true;
if ((zones & Zones.z1) > 0 && IsAvailableZone(1)) return true;
if ((zones & Zones.z2) > 0 && IsAvailableZone(2)) return true;
if ((zones & Zones.z3) > 0 && IsAvailableZone(3)) return true;
if ((zones & Zones.z4) > 0 && IsAvailableZone(4)) return true;
if (IsAvailableZone(5)) return true;
if (IsAvailableZone(6)) return true;
return false;
}
private void ResetFlag()
{
for (int i = 0; i < selectFlag.Count; ++i)
{
selectFlag[i] = false;
}
}
public override int OnSelectPlace(int cardId, int player, CardLocation location, int available) public override int OnSelectPlace(int cardId, int player, CardLocation location, int available)
{ {
if (player == 0 && location==CardLocation.MonsterZone) if (player == 0 && location==CardLocation.MonsterZone)
...@@ -301,11 +393,6 @@ namespace WindBot.Game.AI.Decks ...@@ -301,11 +393,6 @@ namespace WindBot.Game.AI.Decks
if ((Zones.z0 & available) > 0) return Zones.z0; if ((Zones.z0 & available) > 0) return Zones.z0;
if ((Zones.z4 & available) > 0) return Zones.z4; if ((Zones.z4 & available) > 0) return Zones.z4;
} }
if ((Bot.HasInMonstersZone(CardId.ThunderDragonTitan, false, false, true) || Bot.HasInMonstersZone(CardId.ThunderDragonColossus, false, false, true)) && Bot.HasInMonstersZone(CardId.CrossSheep, false, false, true))
{
if ((Zones.z1 & available) > 0) return Zones.z1;
if ((Zones.z3 & available) > 0) return Zones.z3;
}
if (place_Link_4) if (place_Link_4)
{ {
place_Link_4 = false; place_Link_4 = false;
...@@ -340,14 +427,15 @@ namespace WindBot.Game.AI.Decks ...@@ -340,14 +427,15 @@ namespace WindBot.Game.AI.Decks
} }
else else
{ {
for (int i = 0; i < selectFlag.Count; ++i) ResetFlag();
selectFlag[i] = false;
return null; return null;
} }
} }
if (selectFlag[(int)Select.NormalThunderDragon]) if (selectFlag[(int)Select.NormalThunderDragon])
{ {
selectFlag[(int)Select.NormalThunderDragon] = false; selectFlag[(int)Select.NormalThunderDragon] = false;
//ThunderDragonTitan
if (cards.Any(card => card != null && card.Controller != 0)) return null;
if (cards.Count <= 1) return null; if (cards.Count <= 1) return null;
if (Bot.HasInHand(CardId.ChaosSpace) && !activate_ChaosSpace_hand) if (Bot.HasInHand(CardId.ChaosSpace) && !activate_ChaosSpace_hand)
return Util.CheckSelectCount(cards, cards, max, max); return Util.CheckSelectCount(cards, cards, max, max);
...@@ -550,6 +638,9 @@ namespace WindBot.Game.AI.Decks ...@@ -550,6 +638,9 @@ namespace WindBot.Game.AI.Decks
List<ClientCard> grave_2 = cards.Where(card => card != null && card.Location == CardLocation.Grave && (card.Id == CardId.ThunderDragonroar || card.Id == CardId.ThunderDragondark)).ToList(); List<ClientCard> grave_2 = cards.Where(card => card != null && card.Location == CardLocation.Grave && (card.Id == CardId.ThunderDragonroar || card.Id == CardId.ThunderDragondark)).ToList();
if (grave_1.Count > 0) res.AddRange(grave_1); if (grave_1.Count > 0) res.AddRange(grave_1);
if (grave_2.Count > 0) res.AddRange(grave_2); if (grave_2.Count > 0) res.AddRange(grave_2);
List<ClientCard> monsters = cards.Where(card => card != null && card.Location == CardLocation.MonsterZone).ToList();
monsters.Sort(CardContainer.CompareCardAttack);
if (monsters.Count > 0) res.AddRange(monsters);
if (res.Count > 0) return Util.CheckSelectCount(res, cards, min, max); if (res.Count > 0) return Util.CheckSelectCount(res, cards, min, max);
return null; return null;
} }
...@@ -601,6 +692,10 @@ namespace WindBot.Game.AI.Decks ...@@ -601,6 +692,10 @@ namespace WindBot.Game.AI.Decks
} }
private bool BrandedRegainedEffect() private bool BrandedRegainedEffect()
{ {
if (Card.Location == CardLocation.Hand)
{
AI.SelectPlace(SelectSTPlace(Card, true));
}
AI.SelectCard(CardId.BystialDruiswurm, CardId.BystialMagnamhut, CardId.TheBystialLubellion); AI.SelectCard(CardId.BystialDruiswurm, CardId.BystialMagnamhut, CardId.TheBystialLubellion);
return true; return true;
} }
...@@ -768,7 +863,7 @@ namespace WindBot.Game.AI.Decks ...@@ -768,7 +863,7 @@ namespace WindBot.Game.AI.Decks
{ {
IList<CardAttribute> attributes = new List<CardAttribute>(); IList<CardAttribute> attributes = new List<CardAttribute>();
for (int i = 0; i < selectAtt.Count; ++i) for (int i = 0; i < selectAtt.Count; ++i)
if (selectAtt[i]) attributes.Add((CardAttribute)(Math.Pow(2, i))); if (selectAtt[i]) attributes.Add((CardAttribute)(System.Math.Pow(2, i)));
if (attributes.Count > 0) return attributes; if (attributes.Count > 0) return attributes;
return null; return null;
} }
...@@ -804,6 +899,20 @@ namespace WindBot.Game.AI.Decks ...@@ -804,6 +899,20 @@ namespace WindBot.Game.AI.Decks
return 0; return 0;
return 1; return 1;
} }
private IList<ClientCard> CardsIdToClientCards(IList<int> cardsId, IList<ClientCard> cardsList, bool uniqueId = true, bool alias = true)
{
if (cardsList?.Count() <= 0 || cardsId?.Count() <= 0) return new List<ClientCard>();
List<ClientCard> res = new List<ClientCard>();
foreach (var cardid in cardsId)
{
List<ClientCard> cards = cardsList.Where(card => card != null && (card.Id == cardid || ((card.Alias != 0 && cardid == card.Alias) & alias))).ToList();
if (cards?.Count <= 0) continue;
cards.Sort(CardContainer.CompareCardAttack);
if (uniqueId) res.Add(cards.First());
else res.AddRange(cards);
}
return res;
}
private bool IPEffect() private bool IPEffect()
{ {
if (Duel.LastChainPlayer == 0) return false; if (Duel.LastChainPlayer == 0) return false;
...@@ -813,10 +922,21 @@ namespace WindBot.Game.AI.Decks ...@@ -813,10 +922,21 @@ namespace WindBot.Game.AI.Decks
CardId.UnionCarrier, CardId.UnionCarrier,
CardId.CrossSheep CardId.CrossSheep
}; };
if (Bot.MonsterZone.GetMatchingCardsCount(card => card.IsCode(materials)) >= 1 && Bot.HasInExtra(CardId.MekkKnightCrusadiaAvramax)) if (Bot.HasInExtra(CardId.MekkKnightCrusadiaAvramax))
{ {
List<ClientCard> m = new List<ClientCard>();
IList<ClientCard> pre_m = CardsIdToClientCards(materials, Bot.GetMonsters().Where(card=>card!=null && card.IsFaceup()).ToList());
if (pre_m?.Count <= 0) return false;
int link_count = 0;
foreach (var card in pre_m)
{
m.Add(card);
link_count += (card.HasType(CardType.Link)) ? card.LinkCount : 1;
if (link_count >= 4) break;
}
if (link_count < 4) return false;
AI.SelectCard(CardId.MekkKnightCrusadiaAvramax); AI.SelectCard(CardId.MekkKnightCrusadiaAvramax);
AI.SelectMaterials(materials); AI.SelectMaterials(m);
return true; return true;
} }
else if (Bot.HasInExtra(CardId.KnightmareUnicorn)) else if (Bot.HasInExtra(CardId.KnightmareUnicorn))
...@@ -831,24 +951,25 @@ namespace WindBot.Game.AI.Decks ...@@ -831,24 +951,25 @@ namespace WindBot.Game.AI.Decks
{ {
if (card == null) continue; if (card == null) continue;
if (card.Id == CardId.UnionCarrier && summon_UnionCarrier) continue; if (card.Id == CardId.UnionCarrier && summon_UnionCarrier) continue;
if ((GetLinkMark(card.Id) < 3 || card.Id == CardId.BowoftheGoddess && card.Attack <= 800) && card.Id != CardId.ThunderDragonTitan if ((GetLinkMark(card.Id) < 3 || (card.Id == CardId.BowoftheGoddess && card.Attack <= 800)) && card.Id != CardId.ThunderDragonTitan
&& card.Id != CardId.ThunderDragonColossus && card.IsFaceup() && materials_2.Count(_card => _card != null && _card.Id == card.Id) <= 0) && card.Id != CardId.ThunderDragonColossus && card.IsFaceup() && materials_2.Count(_card => _card != null && _card.Id == card.Id) <= 0)
materials_2.Add(card); materials_2.Add(card);
} }
int link_count = 0; int link_count = 0;
materials_2.Sort(CardContainer.CompareCardAttack); materials_2.Sort(CardContainer.CompareCardAttack);
materials_2.Sort(CompareCardLink); materials_2.Sort(CompareCardLink);
materials_2.Reverse();
if (materials_2.Count <= 0) return false; if (materials_2.Count <= 0) return false;
foreach (var card in materials_2) foreach (var card in materials_2)
{ {
if (!resMaterials.Contains(card)) if (!resMaterials.Contains(card))
{ {
resMaterials.Add(card); resMaterials.Add(card);
link_count += 1; link_count += (card.HasType(CardType.Link)) ? card.LinkCount : 1;
if (link_count >= 1) break; if (link_count >= 3) break;
} }
} }
if (link_count >= 1) { AI.SelectCard(CardId.KnightmareUnicorn); AI.SelectMaterials(resMaterials); return true; } if (link_count >= 3) { AI.SelectCard(CardId.KnightmareUnicorn); AI.SelectMaterials(resMaterials); return true; }
} }
return false; return false;
} }
...@@ -859,8 +980,9 @@ namespace WindBot.Game.AI.Decks ...@@ -859,8 +980,9 @@ namespace WindBot.Game.AI.Decks
if (Card.IsDisabled()) return false; if (Card.IsDisabled()) return false;
if (Bot.Graveyard.Count(card => card != null && card.HasType(CardType.Link)) <= 0) return false; if (Bot.Graveyard.Count(card => card != null && card.HasType(CardType.Link)) <= 0) return false;
IList<CardAttribute> attributes = GetAttUsed(); IList<CardAttribute> attributes = GetAttUsed();
if (attributes == null || attributes.Count <= 0) { selectFlag[(int)Select.AccesscodeTalker] = true; return true; } if (attributes == null || attributes.Count <= 0) { ResetFlag(); selectFlag[(int)Select.AccesscodeTalker] = true; return true; }
if (Bot.Graveyard.Count(card => card != null && card.HasType(CardType.Link) && !attributes.Contains((CardAttribute)card.Attribute)) <= 0) return false; if (Bot.Graveyard.Count(card => card != null && card.HasType(CardType.Link) && !attributes.Contains((CardAttribute)card.Attribute)) <= 0) return false;
ResetFlag();
selectFlag[(int)Select.AccesscodeTalker] = true; selectFlag[(int)Select.AccesscodeTalker] = true;
return true; return true;
} }
...@@ -876,10 +998,24 @@ namespace WindBot.Game.AI.Decks ...@@ -876,10 +998,24 @@ namespace WindBot.Game.AI.Decks
private bool CalledbytheGraveEffect() private bool CalledbytheGraveEffect()
{ {
ClientCard card = Util.GetLastChainCard(); ClientCard card = Util.GetLastChainCard();
if (Duel.LastChainPlayer != 0 && card != null && card.Location == CardLocation.Grave if (card == null) return false;
&& card.HasType(CardType.Monster)) int id = card.Id;
List<ClientCard> g_cards = Enemy.GetGraveyardMonsters().Where(g_card => g_card != null && g_card.Id == id).ToList();
if (Duel.LastChainPlayer != 0 && card != null)
{
if (Card.Location == CardLocation.Hand)
{
AI.SelectPlace(SelectSTPlace(Card, true));
}
if (card.Location == CardLocation.Grave && card.HasType(CardType.Monster))
{ {
AI.SelectCard(card); AI.SelectCard(card);
}
else if (g_cards.Count() > 0 && card.HasType(CardType.Monster))
{
AI.SelectCard(g_cards);
}
else return false;
return true; return true;
} }
return false; return false;
...@@ -952,7 +1088,6 @@ namespace WindBot.Game.AI.Decks ...@@ -952,7 +1088,6 @@ namespace WindBot.Game.AI.Decks
res.AddRange(mcards); res.AddRange(mcards);
res.AddRange(scards); res.AddRange(scards);
AI.SelectCard(res); AI.SelectCard(res);
selectFlag[(int)Select.ThunderDragonTitan] = true;
return true; return true;
} }
else else
...@@ -967,7 +1102,7 @@ namespace WindBot.Game.AI.Decks ...@@ -967,7 +1102,7 @@ namespace WindBot.Game.AI.Decks
if (ActivateDescription == Util.GetStringId(CardId.PredaplantVerteAnaconda, 1)) if (ActivateDescription == Util.GetStringId(CardId.PredaplantVerteAnaconda, 1))
{ {
if (CheckRemainInDeck(CardId.ThunderDragonFusion) <= 0) return false; if (CheckRemainInDeck(CardId.ThunderDragonFusion) <= 0) return false;
if (Bot.GetMonstersInMainZone().Count > 4 && Bot.GetMonstersInMainZone().Count(card => card != null && !card.IsExtraCard() && card.HasSetcode(0x11c) && card.HasType(CardType.Monster)) <= 0) return false; if (Bot.GetMonstersInMainZone().Count > 4 && Bot.GetMonstersInMainZone().Count(card => card != null && !card.IsExtraCard() && card.HasSetcode(0x11c) && card.HasType(CardType.Monster) && card.IsFaceup()) <= 0) return false;
List<ClientCard> g_card = Bot.Graveyard.ToList(); List<ClientCard> g_card = Bot.Graveyard.ToList();
List<ClientCard> b_card = Bot.Banished.ToList(); List<ClientCard> b_card = Bot.Banished.ToList();
g_card.AddRange(b_card); g_card.AddRange(b_card);
...@@ -1070,24 +1205,6 @@ namespace WindBot.Game.AI.Decks ...@@ -1070,24 +1205,6 @@ namespace WindBot.Game.AI.Decks
} }
return false; return false;
} }
private bool LinkZoneCheck()
{
bool res = false;
foreach (var card in Bot.GetMonstersInMainZone())
{
if (card == null) continue;
if (card.Id != CardId.ThunderDragonTitan && card.Id != CardId.ThunderDragonColossus && (card.LinkCount < 3 || (card.Id == CardId.BowoftheGoddess && card.Attack <= 800)))
{
if (Util.GetBotAvailZonesFromExtraDeck(card) > 0)
{
res = true;
break;
}
}
}
if (!res) return false;
return true;
}
private bool PredaplantVerteAnacondaSummon() private bool PredaplantVerteAnacondaSummon()
{ {
if (CheckRemainInDeck(CardId.ThunderDragonFusion) <= 0) return false; if (CheckRemainInDeck(CardId.ThunderDragonFusion) <= 0) return false;
...@@ -1104,7 +1221,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1104,7 +1221,7 @@ namespace WindBot.Game.AI.Decks
if (card.IsCode(CardId.NormalThunderDragon)) if (card.IsCode(CardId.NormalThunderDragon))
++Lcount; ++Lcount;
} }
if (!LinkZoneCheck()) return false; if (!IsAvailableLinkZone()) return false;
if ((count >= 3 && Bot.HasInExtra(CardId.ThunderDragonTitan)) || if ((count >= 3 && Bot.HasInExtra(CardId.ThunderDragonTitan)) ||
(Bot.HasInExtra(CardId.ThunderDragonColossus) && Lcount > 0 && g_card.Count(card => card != null && card.HasRace(CardRace.Thunder)) > 1)) (Bot.HasInExtra(CardId.ThunderDragonColossus) && Lcount > 0 && g_card.Count(card => card != null && card.HasRace(CardRace.Thunder)) > 1))
{ {
...@@ -1124,6 +1241,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1124,6 +1241,7 @@ namespace WindBot.Game.AI.Decks
private bool KnightmareUnicornSummon() private bool KnightmareUnicornSummon()
{ {
if (Bot.Hand.Count <= 0) return false; if (Bot.Hand.Count <= 0) return false;
if (!IsAvailableLinkZone()) return false;
List<ClientCard> pre_cards = Enemy.GetMonsters(); List<ClientCard> pre_cards = Enemy.GetMonsters();
pre_cards.AddRange(Enemy.GetSpells()); pre_cards.AddRange(Enemy.GetSpells());
if (pre_cards.Count(card => card != null && !card.IsShouldNotBeTarget()) <= 0) return false; if (pre_cards.Count(card => card != null && !card.IsShouldNotBeTarget()) <= 0) return false;
...@@ -1224,6 +1342,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1224,6 +1342,7 @@ namespace WindBot.Game.AI.Decks
} }
private bool BowoftheGoddessSummon() private bool BowoftheGoddessSummon()
{ {
if (!IsAvailableLinkZone()) return false;
if (Card.Id == CardId.AccesscodeTalker) if (Card.Id == CardId.AccesscodeTalker)
{ {
if (Duel.Turn == 0 || Enemy.GetMonsterCount() + Enemy.GetSpellCount() <= 0) return false; if (Duel.Turn == 0 || Enemy.GetMonsterCount() + Enemy.GetSpellCount() <= 0) return false;
...@@ -1244,7 +1363,6 @@ namespace WindBot.Game.AI.Decks ...@@ -1244,7 +1363,6 @@ namespace WindBot.Game.AI.Decks
&& card.Id != CardId.ThunderDragonColossus && card.IsFaceup() && !card.HasType(CardType.Token)) && card.Id != CardId.ThunderDragonColossus && card.IsFaceup() && !card.HasType(CardType.Token))
tempmaterials.Add(card); tempmaterials.Add(card);
} }
if (!LinkZoneCheck()) return false;
int link_count = 0; int link_count = 0;
List<ClientCard> materials = new List<ClientCard>(); List<ClientCard> materials = new List<ClientCard>();
List<ClientCard> link_materials = tempmaterials.Where(card => card != null && (card.LinkCount == 3 || card.LinkCount == 2)).ToList(); List<ClientCard> link_materials = tempmaterials.Where(card => card != null && (card.LinkCount == 3 || card.LinkCount == 2)).ToList();
...@@ -1324,6 +1442,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1324,6 +1442,7 @@ namespace WindBot.Game.AI.Decks
} }
private bool ThunderDragonColossusSummon() private bool ThunderDragonColossusSummon()
{ {
ResetFlag();
selectFlag[(int)Select.ThunderDragonColossus] = true; selectFlag[(int)Select.ThunderDragonColossus] = true;
place_ThunderDragonColossus = true; place_ThunderDragonColossus = true;
return true; return true;
...@@ -1341,12 +1460,14 @@ namespace WindBot.Game.AI.Decks ...@@ -1341,12 +1460,14 @@ namespace WindBot.Game.AI.Decks
} }
private bool IPSummon() private bool IPSummon()
{ {
if (Duel.Turn > 0 && Duel.Phase < DuelPhase.Main2) return false;
if (Bot.GetMonsterCount() <= 2) return false;
if (Bot.HasInMonstersZone(CardId.ThunderDragonColossus) && Bot.GetMonsterCount() <= 3) return false; if (Bot.HasInMonstersZone(CardId.ThunderDragonColossus) && Bot.GetMonsterCount() <= 3) return false;
if (!Bot.HasInExtra(CardId.KnightmareUnicorn) && !Bot.HasInExtra(CardId.BowoftheGoddess) if (!Bot.HasInExtra(CardId.KnightmareUnicorn) && !Bot.HasInExtra(CardId.BowoftheGoddess)
&& !Bot.HasInExtra(CardId.MekkKnightCrusadiaAvramax) && !Bot.HasInExtra(CardId.AccesscodeTalker) && !Bot.HasInExtra(CardId.UnderworldGoddessoftheClosedWorld)) return false; && !Bot.HasInExtra(CardId.MekkKnightCrusadiaAvramax) && !Bot.HasInExtra(CardId.AccesscodeTalker) && !Bot.HasInExtra(CardId.UnderworldGoddessoftheClosedWorld)) return false;
List<ClientCard> cards = Bot.GetMonsters().Where(card => card != null && GetLinkMark(card.Id) < 3 && card.Id != CardId.ThunderDragonTitan && card.Id != CardId.ThunderDragonColossus && !card.HasType(CardType.Link) && card.Attack <= 2500 && card.EquipCards.Count(ecard=> ecard != null && ecard.Id==CardId.DragonBusterDestructionSword && !ecard.IsDisabled())<=0).ToList(); List<ClientCard> cards = Bot.GetMonsters().Where(card => card != null && GetLinkMark(card.Id) < 3 && card.Id != CardId.ThunderDragonTitan && card.Id != CardId.ThunderDragonColossus && !card.HasType(CardType.Link) && card.Attack <= 2500 && card.EquipCards.Count(ecard=> ecard != null && ecard.Id==CardId.DragonBusterDestructionSword && !ecard.IsDisabled())<=0).ToList();
if (cards.Count < 2) return false; if (cards.Count < 2) return false;
if (!LinkZoneCheck()) return false; if (!IsAvailableLinkZone()) return false;
cards.Sort(CardContainer.CompareCardAttack); cards.Sort(CardContainer.CompareCardAttack);
List<int> cardsId = new List<int>(); List<int> cardsId = new List<int>();
if (HasInZoneNoActivate(CardId.ThunderDragonroar, CardLocation.MonsterZone)) if (HasInZoneNoActivate(CardId.ThunderDragonroar, CardLocation.MonsterZone))
...@@ -1362,6 +1483,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1362,6 +1483,7 @@ namespace WindBot.Game.AI.Decks
} }
private bool ThunderDragonlordSummon() private bool ThunderDragonlordSummon()
{ {
if (Bot.GetMonstersInMainZone().Count > 4 && Bot.GetMonstersInMainZone().Count(card => card != null && card.Level <= 8 && card.HasType(CardType.Tuner) && !card.IsExtraCard() && card.IsFaceup()) <= 0) return false;
IList<int> cardsId = new List<int>(); IList<int> cardsId = new List<int>();
if (HasInZoneNoActivate(CardId.ThunderDragonroar, CardLocation.Hand) if (HasInZoneNoActivate(CardId.ThunderDragonroar, CardLocation.Hand)
|| HasInZoneNoActivate(CardId.ThunderDragonroar, CardLocation.MonsterZone, true)) || HasInZoneNoActivate(CardId.ThunderDragonroar, CardLocation.MonsterZone, true))
...@@ -1372,17 +1494,21 @@ namespace WindBot.Game.AI.Decks ...@@ -1372,17 +1494,21 @@ namespace WindBot.Game.AI.Decks
if (HasInZoneNoActivate(CardId.ThunderDragonmatrix, CardLocation.Hand) if (HasInZoneNoActivate(CardId.ThunderDragonmatrix, CardLocation.Hand)
|| HasInZoneNoActivate(CardId.ThunderDragonmatrix, CardLocation.MonsterZone, true)) || HasInZoneNoActivate(CardId.ThunderDragonmatrix, CardLocation.MonsterZone, true))
cardsId.Add(CardId.ThunderDragonmatrix); cardsId.Add(CardId.ThunderDragonmatrix);
List<ClientCard> handCards = Bot.Hand.ToList(); List<ClientCard> handCards = Bot.Hand.Where(card=>card != null).ToList();
handCards.Sort(CardContainer.CompareCardLevel); handCards.Sort(CardContainer.CompareCardLevel);
List<ClientCard> monsterCards = Bot.GetMonsters().ToList(); List<ClientCard> monsterCards = Bot.GetMonsters().ToList();
monsterCards.Sort(CardContainer.CompareCardAttack); monsterCards.Sort(CardContainer.CompareCardAttack);
foreach (var card in handCards) foreach (var card in handCards)
if(card != null && card.HasRace(CardRace.Thunder) && card.Level <= 8) {
if (card != null && card.HasRace(CardRace.Thunder) && card.Level <= 8)
cardsId.Add(card.Id); cardsId.Add(card.Id);
}
foreach (var card in monsterCards) foreach (var card in monsterCards)
{
if (card != null && card.HasRace(CardRace.Thunder) && card.Level <= 8 if (card != null && card.HasRace(CardRace.Thunder) && card.Level <= 8
&& card.Id != CardId.ThunderDragonColossus && card.IsFaceup()) && card.Id != CardId.ThunderDragonColossus && card.IsFaceup())
cardsId.Add(card.Id); cardsId.Add(card.Id);
}
if (cardsId.Count <= 0) return false; if (cardsId.Count <= 0) return false;
AI.SelectCard(cardsId); AI.SelectCard(cardsId);
return true; return true;
...@@ -1445,7 +1571,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1445,7 +1571,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Bot.ExtraDeck.Count(card => card != null && card.LinkCount == 2) <= 0) return false; if (Bot.ExtraDeck.Count(card => card != null && card.LinkCount == 2) <= 0) return false;
} }
if (Card.Id == CardId.ThunderDragonroar || Card.Id == CardId.ThunderDragondark) if (Card.Id == CardId.ThunderDragonroar || Card.Id == CardId.ThunderDragondark || Card.Id == CardId.NormalThunderDragon)
{ {
if (!Bot.HasInExtra(CardId.ThunderDragonColossus) || !handActivated) return false; if (!Bot.HasInExtra(CardId.ThunderDragonColossus) || !handActivated) return false;
} }
...@@ -1544,6 +1670,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1544,6 +1670,7 @@ namespace WindBot.Game.AI.Decks
} }
private bool GoldSarcophagusEffect() private bool GoldSarcophagusEffect()
{ {
if (GetRemainingThunderCount() <= 0) return false;
if (HasInZoneNoActivate(CardId.ThunderDragonroar, CardLocation.Deck) && Bot.GetMonstersInMainZone().Count < 5) if (HasInZoneNoActivate(CardId.ThunderDragonroar, CardLocation.Deck) && Bot.GetMonstersInMainZone().Count < 5)
AI.SelectCard(CardId.ThunderDragonroar); AI.SelectCard(CardId.ThunderDragonroar);
else if (HasInZoneNoActivate(CardId.ThunderDragondark, CardLocation.Deck)) else if (HasInZoneNoActivate(CardId.ThunderDragondark, CardLocation.Deck))
...@@ -1551,6 +1678,10 @@ namespace WindBot.Game.AI.Decks ...@@ -1551,6 +1678,10 @@ namespace WindBot.Game.AI.Decks
else if (HasInZoneNoActivate(CardId.ThunderDragonmatrix, CardLocation.Deck)) else if (HasInZoneNoActivate(CardId.ThunderDragonmatrix, CardLocation.Deck))
AI.SelectCard(CardId.ThunderDragonmatrix); AI.SelectCard(CardId.ThunderDragonmatrix);
else AI.SelectCard(CardId.ThunderDragonmatrix); else AI.SelectCard(CardId.ThunderDragonmatrix);
if (Card.Location == CardLocation.Hand)
{
AI.SelectPlace(SelectSTPlace(Card, true));
}
return true; return true;
} }
private bool UnionCarrierSummon() private bool UnionCarrierSummon()
...@@ -1626,6 +1757,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1626,6 +1757,7 @@ namespace WindBot.Game.AI.Decks
&& raceThunderCards.Count() < 2 && raceDragonCards.Count() < 2 && raceBeastCards.Count() < 2) && raceThunderCards.Count() < 2 && raceDragonCards.Count() < 2 && raceBeastCards.Count() < 2)
return false; return false;
if (!LinkCheck(false) || !LinkCheck(true)) return false; if (!LinkCheck(false) || !LinkCheck(true)) return false;
if (!IsAvailableLinkZone()) return false;
if (Bot.MonsterZone[6] != null && Bot.MonsterZone[6].Controller == 0 && GetLinkMark(Bot.MonsterZone[6].Id) > 1) return false; if (Bot.MonsterZone[6] != null && Bot.MonsterZone[6].Controller == 0 && GetLinkMark(Bot.MonsterZone[6].Id) > 1) return false;
int[] materials = new[] { int[] materials = new[] {
CardId.StrikerDragon,CardId.BatterymanToken,CardId.BatterymanSolar, CardId.StrikerDragon,CardId.BatterymanToken,CardId.BatterymanSolar,
...@@ -1790,6 +1922,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1790,6 +1922,7 @@ namespace WindBot.Game.AI.Decks
pre_res.Add(mcard); pre_res.Add(mcard);
} }
} }
if (res.Count() <= 0) return false;
if (pre_res.Count > 0) res.AddRange(pre_res); if (pre_res.Count > 0) res.AddRange(pre_res);
AI.SelectCard(res); AI.SelectCard(res);
} }
...@@ -1845,6 +1978,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1845,6 +1978,7 @@ namespace WindBot.Game.AI.Decks
if (!isShoudlSummon_1) return false; if (!isShoudlSummon_1) return false;
} }
if (!IsAvailableLinkZone()) return false;
IList<int> cardsid = GetZoneRepeatCardsId(0, Bot.MonsterZone,true); IList<int> cardsid = GetZoneRepeatCardsId(0, Bot.MonsterZone,true);
if (!cardsid.Contains(-1) && Bot.MonsterZone.Count(card => card != null && card.IsFaceup() && !card.IsOriginalCode(CardId.ThunderDragonColossus) && GetLinkMark(card.Id) <= 1) if (!cardsid.Contains(-1) && Bot.MonsterZone.Count(card => card != null && card.IsFaceup() && !card.IsOriginalCode(CardId.ThunderDragonColossus) && GetLinkMark(card.Id) <= 1)
- cardsid.Count() < 2) return false; - cardsid.Count() < 2) return false;
...@@ -2148,6 +2282,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2148,6 +2282,7 @@ namespace WindBot.Game.AI.Decks
} }
else else
{ {
if (Bot.GetMonstersInMainZone().Count > 4 && Bot.GetMonstersInMainZone().Count(card => card != null && !card.IsExtraCard() && card.HasSetcode(0x11c) && card.HasType(CardType.Monster) && card.IsFaceup()) <= 0) return false;
List<ClientCard> cards = Bot.Graveyard.ToList(); List<ClientCard> cards = Bot.Graveyard.ToList();
IList<ClientCard> banish = Bot.Banished; IList<ClientCard> banish = Bot.Banished;
cards.AddRange(banish); cards.AddRange(banish);
...@@ -2162,6 +2297,10 @@ namespace WindBot.Game.AI.Decks ...@@ -2162,6 +2297,10 @@ namespace WindBot.Game.AI.Decks
AI.SelectCard(CardId.ThunderDragonColossus, CardId.ThunderDragonTitan); AI.SelectCard(CardId.ThunderDragonColossus, CardId.ThunderDragonTitan);
return true; return true;
} }
if (Card.Location == CardLocation.Hand)
{
AI.SelectPlace(SelectSTPlace(Card, true));
}
return false; return false;
} }
} }
...@@ -2203,8 +2342,13 @@ namespace WindBot.Game.AI.Decks ...@@ -2203,8 +2342,13 @@ namespace WindBot.Game.AI.Decks
(card.HasAttribute(CardAttribute.Dark) || card.HasAttribute(CardAttribute.Light)) (card.HasAttribute(CardAttribute.Dark) || card.HasAttribute(CardAttribute.Light))
&& !card.IsCode(CardId.ThunderDragonroar) && !card.IsCode(CardId.ThunderDragondark) && !card.IsCode(CardId.ThunderDragonhawk) && !card.IsCode(CardId.ThunderDragonroar) && !card.IsCode(CardId.ThunderDragondark) && !card.IsCode(CardId.ThunderDragonhawk)
&& !card.IsCode(CardId.NormalThunderDragon))) return false; && !card.IsCode(CardId.NormalThunderDragon))) return false;
ResetFlag();
selectFlag[(int)Select.ChaosSpace_1] = true; selectFlag[(int)Select.ChaosSpace_1] = true;
activate_ChaosSpace_hand = true; activate_ChaosSpace_hand = true;
if (Card.Location == CardLocation.Hand)
{
AI.SelectPlace(SelectSTPlace(Card, true));
}
return true; return true;
} }
return false; return false;
...@@ -2266,6 +2410,10 @@ namespace WindBot.Game.AI.Decks ...@@ -2266,6 +2410,10 @@ namespace WindBot.Game.AI.Decks
cardsid.AddRange(cardsid_2); cardsid.AddRange(cardsid_2);
AI.SelectCard(cardsid); AI.SelectCard(cardsid);
} }
if (Card.Location == CardLocation.Hand)
{
AI.SelectPlace(SelectSTPlace(Card, true));
}
return true; return true;
} }
private bool ThunderDragondarkEffect_2() private bool ThunderDragondarkEffect_2()
...@@ -2351,6 +2499,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2351,6 +2499,7 @@ namespace WindBot.Game.AI.Decks
private bool NormalThunderDragonEffect() private bool NormalThunderDragonEffect()
{ {
handActivated = true; handActivated = true;
ResetFlag();
selectFlag[(int)Select.NormalThunderDragon] = true; selectFlag[(int)Select.NormalThunderDragon] = true;
return true; return true;
} }
......
...@@ -25,20 +25,30 @@ namespace WindBot.Game.AI ...@@ -25,20 +25,30 @@ namespace WindBot.Game.AI
public const int 武枪 = 120231052; public const int 武枪 = 120231052;
public const int 连击龙 = 120110001; public const int 连击龙 = 120110001;
public const int 活杀= 120199055;
public const int 疾风弹 = 120203028;
public const int HMD = 120130041;
public const int 死苏 = 120194004; public const int 死苏 = 120194004;
public const int 死苏2 = 120195004; public const int 死苏2 = 120195004;
public const int 死供 = 120151023; public const int 死供 = 120151023;
public const int 强欲之壶 = 120181003; public const int 强欲之壶 = 120181003;
public const int 傲慢之壶 = 120238006;
public const int 黑洞 = 120231069; public const int 黑洞 = 120231069;
public const int 大风暴 = 120229003; public const int 大风暴 = 120229003;
public const int 魔法筒 = 120232005; public const int 魔法筒 = 120232005;
public const int 圣防 = 120198003; public const int 圣防 = 120198003;
public const int 激流葬 = 1202223105; public const int 激流葬 = 1202223105;
public const int 大灾害 = 120238028;
public const int 炸甲 = 120194005; public const int 炸甲 = 120194005;
public const int 万能地雷 = 120234005;
public const int 万能地雷2 = 120237001;
public const int 落穴 = 120150019; public const int 落穴 = 120150019;
public const int 暗黑释放 = 120105013; public const int 暗黑释放 = 120105013;
public const int 疾风弹 = 120203028; public const int 真空湮灭 = 120216026;
public const int HMD = 120130041; public const int 亚龙地狱 = 120231068;
public const int 圣塔 = 120208065;
public const int 捕获 = 120231041;
public const int 遮盖罩 = 120227029;
public const int 人造人 = 120155000; public const int 人造人 = 120155000;
public const int 狼人 = 120214004; public const int 狼人 = 120214004;
...@@ -542,18 +552,35 @@ namespace WindBot.Game.AI ...@@ -542,18 +552,35 @@ namespace WindBot.Game.AI
} }
protected bool 圣防Repos() protected bool 圣防Repos()
{ {
if (Enemy.Graveyard.GetMatchingCardsCount(card => (card.Race & (int)CardRace.SpellCaster) > 0) >= 4 && Enemy.GetSpellCountWithoutField() >= 1
&& !Bot.HasInMonstersZone(new[]{_CardId.人造人, _CardId.狼人, _CardId.武枪, _CardId.幻影之龙}) && Enemy.Graveyard.GetMatchingCardsCount(card => card.IsCode(_CardId.暗黑释放)) < 3) if (Enemy.GetSpellCountWithoutField() >= 1 && !Bot.HasInMonstersZone(new[]{_CardId.人造人, _CardId.狼人, _CardId.武枪, _CardId.幻影之龙}) && !Bot.HasDefendingMonster())
{ {
if (Bot.MonsterZone.GetMatchingCardsCount(card => card.IsAttack() && card.Level > 5) >= 2 && !Bot.HasDefendingMonster()) List<int> LegendTrap = new List<int>{
_CardId.圣防,
_CardId.落穴,
_CardId.炸甲,
_CardId.魔法筒,
_CardId.万能地雷,
_CardId.万能地雷2,
_CardId.大灾害,
_CardId.激流葬};
if (Bot.MonsterZone.GetMatchingCardsCount(card => card.IsAttack() && card.Level > 5) >= 2
&& Enemy.Graveyard.GetMatchingCardsCount(card => (card.Race & (int)CardRace.SpellCaster) > 0) >= 4
&& Enemy.Graveyard.GetMatchingCardsCount(card => card.IsCode(_CardId.暗黑释放)) < 3)
return true;
if (Bot.MonsterZone.GetMatchingCardsCount(card => card.IsAttack()
&& card.Attack >= Enemy.LifePoints) >= 2
&& Enemy.GetMonsterCount() == 0
&& Enemy.Graveyard.GetMatchingCardsCount(card => card.IsCode(LegendTrap)) == 0)
return true; return true;
} }
return false; return false;
} }
protected bool 装备Effect() protected bool 装备Effect()
{ {
//if (Executors.Any(exec => exec.Type == Type && exec.CardId == Card.Id)) if (Executors.Any(exec => exec.Type == Type && exec.CardId == Card.Id))
// return false; return false;
if (!Card.HasType(CardType.Equip)) if (!Card.HasType(CardType.Equip))
return false; return false;
List<ClientCard> cards = new List<ClientCard>(Bot.MonsterZone.GetMonsters()); List<ClientCard> cards = new List<ClientCard>(Bot.MonsterZone.GetMonsters());
...@@ -636,7 +663,7 @@ namespace WindBot.Game.AI ...@@ -636,7 +663,7 @@ namespace WindBot.Game.AI
} }
protected bool 大风暴Effect() protected bool 大风暴Effect()
{ {
return Enemy.GetSpellCount() - Bot.GetSpellCount() >= 2; return Enemy.GetSpellCount() - Bot.GetSpellCount() >= 1;
} }
protected bool HMDEffect() protected bool HMDEffect()
{ {
...@@ -644,11 +671,23 @@ namespace WindBot.Game.AI ...@@ -644,11 +671,23 @@ namespace WindBot.Game.AI
} }
protected bool 黑洞Effect() protected bool 黑洞Effect()
{ {
return Util.IsOneEnemyBetter() && Util.GetTotalAttackingMonsterAttack(1) >= 3400 && !Enemy.HasInMonstersZone(_CardId.终焰魔神); return (Util.IsOneEnemyBetter() && Util.GetTotalAttackingMonsterAttack(1) >= 3000 && !Enemy.HasInMonstersZone(_CardId.终焰魔神) ) || Enemy.GetMonsterCount() == 3;
} }
protected bool 疾风弹Effect() protected bool 疾风弹Effect()
{ {
return Util.GetTotalAttackingMonsterAttack(1) >= 3400 && !Enemy.HasInMonstersZone(_CardId.终焰魔神); return (Util.GetTotalAttackingMonsterAttack(1) >= 3000 && !Enemy.HasInMonstersZone(_CardId.终焰魔神)) || Enemy.GetMonsterCount() == 3 ;
}
protected bool 活杀Effect()
{
if (Duel.Turn == 1)
{
return false;
}
if (Util.IsOneEnemyBetter() && Util.GetBestAttack(Enemy) - Util.GetBestAttack(Bot) <= 300 * (Enemy.GetHandCount()+ Bot.GetHandCount()))
{ AI.SelectCard(Bot.GetMonsters().GetHighestAttackMonster());
return true;
}
return false;
} }
protected bool 死供Effect() protected bool 死供Effect()
{ {
...@@ -686,6 +725,49 @@ namespace WindBot.Game.AI ...@@ -686,6 +725,49 @@ namespace WindBot.Game.AI
if (Util.GetTotalAttackingMonsterAttack(1) - Util.GetTotalAttackingMonsterAttack(0) > Bot.LifePoints && !Bot.HasDefendingMonster()) return true; if (Util.GetTotalAttackingMonsterAttack(1) - Util.GetTotalAttackingMonsterAttack(0) > Bot.LifePoints && !Bot.HasDefendingMonster()) return true;
return false; return false;
} }
protected bool 真空湮灭Effect()
{
IList<ClientCard> targets = new List<ClientCard>();
foreach (ClientCard card in Enemy.MonsterZone.GetMonsters())
{
if (card.Level >= 7)
targets.Add(card);
if (card.Level >= 5)
targets.Add(card);
if (card.Level >= 3)
targets.Add(card);
else
targets.Add(card);
}
AI.SelectCard(targets);
return true;
}
protected bool 圣塔Effect()
{
foreach (ClientCard mon in Enemy.GetMonsters())
{
if (mon.Level >= 9)
{ AI.SelectCard(mon); return true;}
if (mon.Level >= 8)
{ AI.SelectCard(mon); return true;}
if (mon.Level >= 7)
{ AI.SelectCard(mon); return true; }
if (mon.Level >= 6)
{ AI.SelectCard(mon); return true; }
}
return false;
}
protected bool 亚龙地狱Effect()
{
foreach (ClientCard n in Enemy.GetMonsters())
if (n.Level >= 7)
return true;
else if (n.Level == 6 && Bot.MonsterZone.GetMatchingCardsCount(card => card.Level == 6) < Enemy.MonsterZone.GetMatchingCardsCount(card => card.Level == 6))
return true;
else if (Enemy.MonsterZone.GetMatchingCardsCount(card => card.Level == 6) == 3)
return true;
return false;
}
protected bool 落穴Effect() protected bool 落穴Effect()
{ {
foreach (ClientCard n in Duel.LastSummonedCards) foreach (ClientCard n in Duel.LastSummonedCards)
...@@ -697,7 +779,7 @@ namespace WindBot.Game.AI ...@@ -697,7 +779,7 @@ namespace WindBot.Game.AI
} }
protected bool 激流葬Effect() protected bool 激流葬Effect()
{ {
return !Util.HasChainedTrap(0) && Util.IsAllEnemyBetter(true) && (Enemy.GetMonsters().GetImmuneTrapMonster() == null); return !Util.HasChainedTrap(0) && Util.IsAllEnemyBetter(true) && (Enemy.GetMonsters().GetImmuneTrapMonster() == null) || Enemy.GetMonsterCount() == 3;
} }
protected bool 炸甲Effect() protected bool 炸甲Effect()
...@@ -1112,12 +1194,25 @@ namespace WindBot.Game.AI ...@@ -1112,12 +1194,25 @@ namespace WindBot.Game.AI
protected bool 伟大魔兽Sum() protected bool 伟大魔兽Sum()
{ {
int tributecount = 1; int tributecount = 1;
int maxAttack = 0;
for (int k = 0; k < 7; ++k) for (int k = 0; k < 7; ++k)
{ {
ClientCard tributeCard2 = Bot.MonsterZone[k]; ClientCard tributeCard2 = Bot.MonsterZone[k];
if (tributeCard2 == null) continue; if (tributeCard2 == null) continue;
if (tributeCard2.GetDefensePower() > Card.Attack && tributeCard2.Attack > 1500) if (tributeCard2.Attack > maxAttack && tributeCard2.Attack > 1600)
{
maxAttack = tributeCard2.Attack;
}
}
for (int k = 0; k < 7; ++k)
{
ClientCard tributeCard2 = Bot.MonsterZone[k];
if (tributeCard2 == null) continue;
if (tributeCard2.Attack == maxAttack)
{
tributecount--; tributecount--;
AI.SelectMaterials(tributeCard2);
}
} }
return tributecount <= 0; return tributecount <= 0;
} }
......
...@@ -42,4 +42,5 @@ ...@@ -42,4 +42,5 @@
武枪 = 120231052, 武枪 = 120231052,
极乐鹰巨人 = 120227001, 极乐鹰巨人 = 120227001,
} }
} }
...@@ -106,6 +106,99 @@ ...@@ -106,6 +106,99 @@
AdamancipatorRisenDragite = 9464441, AdamancipatorRisenDragite = 9464441,
TeardroptheRikkaQueen = 33779875, TeardroptheRikkaQueen = 33779875,
CeruleanSkyFire = 54828837, CeruleanSkyFire = 54828837,
SacredBeastAwakening = 53701259 SacredBeastAwakening = 53701259,
GrandSpiritualArtIchirin = 38057522,
DualAvatarFeetArmoredUnGyo = 7631534,
VirtualWorldKyubiShenshen = 92519087,
VirtualWorldGateChuche = 13364097,
DragunityKnightAreadbhair = 88234821,
AiwasstheMagistusSpellSpirit = 35877582,
OneirostheDreamMirrorErlking = 35187185,
PlunderPatrollshipBrann = 94253655,
PlunderPatrollshipMoerk = 20248754,
PlunderPatrollshipLys = 18832779,
HollowGiants = 15462014,
GrozaTyrantofThunder = 45420955,
SpringansCaptainSargas = 29601381,
S_ForceOrrafist = 95974848,
AncientWarriors_RebelliousLuFeng = 82791472,
OneirostheDreamMirrorTormentor = 37678339,
SacredTreeBeastHyperyton = 9349094,
S_ForceJustify = 35334193,
UnderworldGoddessoftheClosedWorld = 98127546,
VampireVoivode = 4918855,
NekrozofAreadbhair = 39468724,
NekrozofUnicore = 89463537,
BenghalancertheResurgent = 73345237,
UrsarcticSeptentrion = 53087962,
TheIrisSwordsoul = 62849088,
AntihumanIntelligenceME_PSY_YA = 58844135,
MagikeyMechmortar_Garesglasser = 45877457,
ShootingMajesticStarDragon = 40939228,
StellarWindWolfrayet = 3322931,
ChronomalyVimana = 2609443,
CyberdarknessDragon = 18967507,
ClearWingSynchroDragon = 82044279,
CrystalClearWingSynchroDragon = 59765225,
BaronnedeFleur = 84815190,
Lyrilusc_EnsemblueRobin = 72971064,
Number4StealthKragen = 67557908,
Floowandereeze_Snowl = 53212882,
Floowandereeze_Empen = 80611581,
MasqueradetheBlazingDragon = 6855503,
DestinyHERO_DestroyerPhoenixEnforcer = 60461804,
SwordsoulGrandmaster_Chixiao = 69248256,
ZoroatheMagistusConflagrantCalamity = 95911373,
MasterflareHyperion = 63101468,
FallenSanctuary = 90312154,
MyutantBeast = 34695290,
MyutantArsenal = 7574904,
MyutantUltimus = 6182103,
Underdog = 5779502,
IcejadeKosmochlor = 3355732,
IllusionofChaos = 12266229,
SwordsoulSinisterSovereign_QixingLongyuan = 47710198,
DDDDeviserKingDeusMachinex = 46593546,
IcejadeErosion = 46593546,
NordicRelicSvalinn = 64797746,
OceanDragonLord_Kairyu_Shin = 23931679,
MarincessAquaArgonaut = 20934852,
MirrorjadetheIcebladeDragon = 44146295,
WitchcrafterVice_Madame = 9603252,
Therion_King_Regulus = 10604644,
StarvingVenomPredapowerFusionDragon = 39915560,
DinomorphiaRexterm = 92798873,
ExosistersMagnifica = 59242457,
IcejadeCurse = 83670388,
MamonakatheVaylantzUnited = 40680521,
LabrynthLabyrinth = 33407125,
RunickFountain = 92107604,
SprightRed = 75922381,
SprightCarrot = 2311090,
RikkaKonkon = 76869711,
PowerToolBraverDragon = 63265554,
MagikeyDeity_Ashtartu = 26988374,
RainbowOverdragon = 37440988,
TheBystialAlbaLos = 69120785,
KashtiraFenrir = 32909498,
MitsutheInsectNinja = 67282505,
VeratheVernusylphGoddess = 55125728,
TearlamentsRulkallos = 84330567,
Black_WingedAssaultDragon = 73218989,
BrandedBeast = 32756828,
GraphaDragonOverlordofDarkWorld = 39552584,
EpurrelyBeauty = 98049934,
ExpurrelyNoir = 83827392,
BeetrooperScaleBomber = 39041550,
EvigishkiNeremanas = 88926295,
ArktosXII_ChronochasmVaylantz = 50687050,
IcejadeGymirAegirine = 86682165,
KashtiraArise_Heart = 48626373,
LaevateinGeneraiderBossofShadows = 74615388,
SynchroZone = 60306277,
BystialDisPater = 27572350,
DespianLuluwalilith = 53971455,
FirewallDragonSingularity = 21637210,
BrandedEtude = 45675980
} }
} }
...@@ -51,9 +51,37 @@ ...@@ -51,9 +51,37 @@
FusionGate = 33550694, FusionGate = 33550694,
DFusion = 26841274, DFusion = 26841274,
FusionDestiny = 52947044,
PyroxeneFusion = 55824220, PyroxeneFusion = 55824220,
FragmentFusion = 72029628, FragmentFusion = 72029628,
NecroFusion = 81223446, NecroFusion = 81223446,
PredaplantVerteAnaconda = 70369116, PredaplantVerteAnaconda = 70369116,
DreamMirrorofChaos = 98570539,
PlunderPatrollShipshapeShipsShipping = 44227727,
FireFormationIngen = 29143457,
ParametalfoesFusion = 58549532,
ReadyFusion = 63854005,
BrandedinWhite = 34995106,
BrandedinRed = 82738008,
FaceCardFusion = 29062925,
MyutantFusion = 42577802,
MyutantCry = 31855260,
GreaterPolymerization = 7614732,
UltimateFusion = 71143015,
BrandedFusion = 44362883,
GhostFusion = 35705817,
WitchcrafterConfusionConfession = 35098357,
BrandedBanishment = 6763530,
DinomorphiaDomain = 26631975,
DinomorphiaFrenzy = 78420796,
SouloftheSupremeKing = 92428405,
InstantContact = 16169772,
ScatterFusion = 40597694,
FavoriteContact = 75047173,
AmazonessSecretArts = 86758746,
DarkWorldAccession = 65956182,
BeetrooperLanding = 13234975,
FusionReproduction = 43331750
} }
} }
...@@ -25,7 +25,9 @@ ...@@ -25,7 +25,9 @@
DaigustoSphreez = 29552709, DaigustoSphreez = 29552709,
Number92HearteartHDragon = 97403510, Number92HearteartHDragon = 97403510,
NumberC96DarkStorm = 77205367, NumberC96DarkStorm = 77205367,
Number54LionHeart = 54366836 Number54LionHeart = 54366836,
Number2NinjaShadowMosquito = 32453837,
OhimetheManifestedMikanko = 81260679
} }
/// <summary> /// <summary>
/// Cards that are invincible to battle. /// Cards that are invincible to battle.
...@@ -93,6 +95,12 @@ ...@@ -93,6 +95,12 @@
GoukiTheGiantOgre = 47946130, GoukiTheGiantOgre = 47946130,
BorrelswordDragon = 85289965, BorrelswordDragon = 85289965,
NumberF0UtopicFutureDragon = 26973555, NumberF0UtopicFutureDragon = 26973555,
BorrelendDragon = 98630720 BorrelendDragon = 98630720,
MimickingMan_EaterBug = 72427512,
ShiningPiecephilia = 49776811,
BrigrandtheGloryDragon = 34848821,
AmazonessQueen = 15951532,
Number2NinjaShadowMosquito = 32453837,
OhimetheManifestedMikanko = 81260679
} }
} }
...@@ -11,5 +11,10 @@ ...@@ -11,5 +11,10 @@
SamuraiDestroyer = 40509732, SamuraiDestroyer = 40509732,
ArmadesKeeperOfBoundaries = 88033975, ArmadesKeeperOfBoundaries = 88033975,
NumberS39UtopiaTheLightning = 56832966, NumberS39UtopiaTheLightning = 56832966,
DualAvatarEmpoweredKonGyo = 33026283,
GGolemRockHammer = 98875863,
WishDragon = 64583600,
ChaosWitch = 30327674,
FissioningMotherSpider = 34034150
} }
} }
...@@ -56,6 +56,9 @@ ...@@ -56,6 +56,9 @@
ShiranuiSolitaire = 94801854, ShiranuiSolitaire = 94801854,
Mixeroid = 71340250, Mixeroid = 71340250,
LonefireBlossom = 48686504, LonefireBlossom = 48686504,
BrotherhoodoftheFireFist_Leopard = 39699564 BrotherhoodoftheFireFist_Leopard = 39699564,
SpringansPedor = 56818977,
GizmekNaganakitheSunriseSignaler = 96399967,
MyutantMutant = 26561172
} }
} }
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
PaleozoicAnomalocaris = 61307542, PaleozoicAnomalocaris = 61307542,
PaleozoicOpabinia = 37649320, PaleozoicOpabinia = 37649320,
BorreloadDragon = 31833038, BorreloadDragon = 31833038,
BorrelendDragon = 98630720 BorrelendDragon = 98630720,
DrytronMeteonisDraconids = 69815951,
MyutantBeast = 34695290
} }
} }
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
ApoqliphortTowers = 27279764, ApoqliphortTowers = 27279764,
ApoqliphortSkybase = 40061558, ApoqliphortSkybase = 40061558,
TheLegendaryFishermanIII = 44968687, TheLegendaryFishermanIII = 44968687,
ChaosAncientGearGiant = 51788412 ChaosAncientGearGiant = 51788412,
DrytronMeteonisQuadrantids = 95209656
} }
} }
...@@ -147,6 +147,11 @@ namespace WindBot.Game.AI ...@@ -147,6 +147,11 @@ namespace WindBot.Game.AI
// For overriding // For overriding
return null; return null;
} }
public virtual IList<ClientCard> OnSelectTribute(IList<ClientCard> cards, int min, int max)
{
// For overriding
return null;
}
public virtual IList<ClientCard> OnSelectRitualTribute(IList<ClientCard> cards, int sum, int min, int max) public virtual IList<ClientCard> OnSelectRitualTribute(IList<ClientCard> cards, int sum, int min, int max)
{ {
...@@ -165,6 +170,10 @@ namespace WindBot.Game.AI ...@@ -165,6 +170,10 @@ namespace WindBot.Game.AI
// For overriding // For overriding
return null; return null;
} }
public virtual void OnSelectChain(IList<ClientCard> cards)
{
return;
}
public virtual bool OnSelectYesNo(int desc) public virtual bool OnSelectYesNo(int desc)
{ {
......
...@@ -18,8 +18,10 @@ namespace WindBot.Game ...@@ -18,8 +18,10 @@ namespace WindBot.Game
public BattlePhase BattlePhase { get; set; } public BattlePhase BattlePhase { get; set; }
public int LastChainPlayer { get; set; } public int LastChainPlayer { get; set; }
public CardLocation LastChainLocation { get; set; }
public IList<ClientCard> CurrentChain { get; set; } public IList<ClientCard> CurrentChain { get; set; }
public IList<ClientCard> ChainTargets { get; set; } public IList<ClientCard> ChainTargets { get; set; }
public IList<ClientCard> LastChainTargets { get; set; }
public IList<ClientCard> ChainTargetOnly { get; set; } public IList<ClientCard> ChainTargetOnly { get; set; }
public int LastSummonPlayer { get; set; } public int LastSummonPlayer { get; set; }
public IList<ClientCard> SummoningCards { get; set; } public IList<ClientCard> SummoningCards { get; set; }
...@@ -31,8 +33,10 @@ namespace WindBot.Game ...@@ -31,8 +33,10 @@ namespace WindBot.Game
Fields[0] = new ClientField(); Fields[0] = new ClientField();
Fields[1] = new ClientField(); Fields[1] = new ClientField();
LastChainPlayer = -1; LastChainPlayer = -1;
LastChainLocation = 0;
CurrentChain = new List<ClientCard>(); CurrentChain = new List<ClientCard>();
ChainTargets = new List<ClientCard>(); ChainTargets = new List<ClientCard>();
LastChainTargets = new List<ClientCard>();
ChainTargetOnly = new List<ClientCard>(); ChainTargetOnly = new List<ClientCard>();
LastSummonPlayer = -1; LastSummonPlayer = -1;
SummoningCards = new List<ClientCard>(); SummoningCards = new List<ClientCard>();
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using WindBot.Game.AI; using WindBot.Game.AI;
using YGOSharp.OCGWrapper.Enums; using YGOSharp.OCGWrapper.Enums;
using System;
namespace WindBot.Game namespace WindBot.Game
{ {
...@@ -241,7 +242,7 @@ namespace WindBot.Game ...@@ -241,7 +242,7 @@ namespace WindBot.Game
} }
CardSelector selector = null; CardSelector selector = null;
if (hint == HintMsg.FusionMaterial || hint == HintMsg.SynchroMaterial || hint == HintMsg.XyzMaterial || hint == HintMsg.LinkMaterial) if (hint == HintMsg.FusionMaterial || hint == HintMsg.SynchroMaterial || hint == HintMsg.XyzMaterial || hint == HintMsg.LinkMaterial || hint == HintMsg.Tribute)
{ {
if (m_materialSelector != null) if (m_materialSelector != null)
{ {
...@@ -258,7 +259,6 @@ namespace WindBot.Game ...@@ -258,7 +259,6 @@ namespace WindBot.Game
result = Executor.OnSelectXyzMaterial(cards, min, max); result = Executor.OnSelectXyzMaterial(cards, min, max);
if (hint == HintMsg.LinkMaterial) if (hint == HintMsg.LinkMaterial)
result = Executor.OnSelectLinkMaterial(cards, min, max); result = Executor.OnSelectLinkMaterial(cards, min, max);
if (result != null) if (result != null)
return result; return result;
...@@ -304,6 +304,7 @@ namespace WindBot.Game ...@@ -304,6 +304,7 @@ namespace WindBot.Game
/// <returns>Index of the activated card or -1.</returns> /// <returns>Index of the activated card or -1.</returns>
public int OnSelectChain(IList<ClientCard> cards, IList<int> descs, bool forced) public int OnSelectChain(IList<ClientCard> cards, IList<int> descs, bool forced)
{ {
Executor.OnSelectChain(cards);
foreach (CardExecutor exec in Executor.Executors) foreach (CardExecutor exec in Executor.Executors)
{ {
for (int i = 0; i < cards.Count; ++i) for (int i = 0; i < cards.Count; ++i)
...@@ -367,6 +368,7 @@ namespace WindBot.Game ...@@ -367,6 +368,7 @@ namespace WindBot.Game
return result; return result;
} }
/// <summary> /// <summary>
/// Called when the AI has to choose to activate or not an effect. /// Called when the AI has to choose to activate or not an effect.
/// </summary> /// </summary>
...@@ -766,6 +768,36 @@ namespace WindBot.Game ...@@ -766,6 +768,36 @@ namespace WindBot.Game
private int m_selector_pointer = -1; private int m_selector_pointer = -1;
private IList<CardRace> m_races = new List<CardRace>(); private IList<CardRace> m_races = new List<CardRace>();
public void SelectTribute(ClientCard card)
{
m_selector_pointer = m_selector.Count();
m_selector.Add(new CardSelector(card));
}
public void SelectTribute(IList<ClientCard> cards)
{
m_selector_pointer = m_selector.Count();
m_selector.Add(new CardSelector(cards));
}
public void SelectTribute(int cardId)
{
m_selector_pointer = m_selector.Count();
m_selector.Add(new CardSelector(cardId));
}
public void SelectTribute(IList<int> materials)
{
m_selector_pointer = m_selector.Count();
m_selector.Add(new CardSelector(materials));
}
public void SelectTribute(params int[] materials)
{
m_selector_pointer = m_selector.Count();
m_selector.Add(new CardSelector(materials));
}
public void SelectCard(ClientCard card) public void SelectCard(ClientCard card)
{ {
m_selector_pointer = m_selector.Count(); m_selector_pointer = m_selector.Count();
......
...@@ -728,7 +728,8 @@ namespace WindBot.Game ...@@ -728,7 +728,8 @@ namespace WindBot.Game
card.SetId(cardId); card.SetId(cardId);
int cc = GetLocalPlayer(packet.ReadByte()); int cc = GetLocalPlayer(packet.ReadByte());
if (_debug) if (_debug)
if (card != null) Logger.WriteLine("(" + cc.ToString() + " 's " + (card.Name ?? "UnKnowCard") + " activate effect)"); if (card != null) Logger.WriteLine("(" + cc.ToString() + " 's " + (card.Name ?? "UnKnowCard") + " activate effect from " + (CardLocation)pcl + ")");
_duel.LastChainLocation = (CardLocation)pcl;
_ai.OnChaining(card, cc); _ai.OnChaining(card, cc);
//_duel.ChainTargets.Clear(); //_duel.ChainTargets.Clear();
_duel.ChainTargetOnly.Clear(); _duel.ChainTargetOnly.Clear();
...@@ -742,8 +743,10 @@ namespace WindBot.Game ...@@ -742,8 +743,10 @@ namespace WindBot.Game
{ {
_ai.OnChainEnd(); _ai.OnChainEnd();
_duel.LastChainPlayer = -1; _duel.LastChainPlayer = -1;
_duel.LastChainLocation = 0;
_duel.CurrentChain.Clear(); _duel.CurrentChain.Clear();
_duel.ChainTargets.Clear(); _duel.ChainTargets.Clear();
_duel.LastChainTargets.Clear();
_duel.ChainTargetOnly.Clear(); _duel.ChainTargetOnly.Clear();
} }
...@@ -856,6 +859,7 @@ namespace WindBot.Game ...@@ -856,6 +859,7 @@ namespace WindBot.Game
private void OnBecomeTarget(BinaryReader packet) private void OnBecomeTarget(BinaryReader packet)
{ {
_duel.LastChainTargets.Clear();
int count = packet.ReadByte(); int count = packet.ReadByte();
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
{ {
...@@ -868,6 +872,7 @@ namespace WindBot.Game ...@@ -868,6 +872,7 @@ namespace WindBot.Game
if (_debug) if (_debug)
Logger.WriteLine("(" + (CardLocation)loc + " 's " + (card.Name ?? "UnKnowCard") + " become target)"); Logger.WriteLine("(" + (CardLocation)loc + " 's " + (card.Name ?? "UnKnowCard") + " become target)");
_duel.ChainTargets.Add(card); _duel.ChainTargets.Add(card);
_duel.LastChainTargets.Add(card);
_duel.ChainTargetOnly.Add(card); _duel.ChainTargetOnly.Add(card);
} }
} }
...@@ -1150,7 +1155,96 @@ namespace WindBot.Game ...@@ -1150,7 +1155,96 @@ namespace WindBot.Game
private void OnSelectDisfield(BinaryReader packet) private void OnSelectDisfield(BinaryReader packet)
{ {
OnSelectPlace(packet); packet.ReadByte(); // player
packet.ReadByte(); // TODO: min
int field = ~packet.ReadInt32();
int player;
CardLocation location;
int filter;
if ((field & 0x7f0000) != 0)
{
player = 1;
location = CardLocation.MonsterZone;
filter = (field >> 16) & Zones.MonsterZones;
}
else if ((field & 0x1f000000) != 0)
{
player = 1;
location = CardLocation.SpellZone;
filter = (field >> 24) & Zones.SpellZones;
}
else if ((field & 0x7f) != 0)
{
player = 0;
location = CardLocation.MonsterZone;
filter = field & Zones.MonsterZones;
}
else if ((field & 0x1f00) != 0)
{
player = 0;
location = CardLocation.SpellZone;
filter = (field >> 8) & Zones.SpellZones;
}
else if ((field & 0x2000) != 0)
{
player = 0;
location = CardLocation.FieldZone;
filter = Zones.FieldZone;
}
else if ((field & 0xc000) != 0)
{
player = 0;
location = CardLocation.PendulumZone;
filter = (field >> 14) & Zones.PendulumZones;
}
else if ((field & 0x20000000) != 0)
{
player = 1;
location = CardLocation.FieldZone;
filter = Zones.FieldZone;
}
else
{
player = 1;
location = CardLocation.PendulumZone;
filter = (field >> 30) & Zones.PendulumZones;
}
int selected = _ai.OnSelectPlace(_select_hint, player, location, filter);
_select_hint = 0;
byte[] resp = new byte[3];
resp[0] = (byte)GetLocalPlayer(player);
if (location != CardLocation.PendulumZone && location != CardLocation.FieldZone)
{
resp[1] = (byte)location;
if ((selected & filter) > 0)
filter &= selected;
if ((filter & Zones.z2) != 0) resp[2] = 2;
else if ((filter & Zones.z1) != 0) resp[2] = 1;
else if ((filter & Zones.z3) != 0) resp[2] = 3;
else if ((filter & Zones.z0) != 0) resp[2] = 0;
else if ((filter & Zones.z4) != 0) resp[2] = 4;
else if ((filter & Zones.z6) != 0) resp[2] = 6;
else if ((filter & Zones.z5) != 0) resp[2] = 5;
}
else
{
resp[1] = (byte)CardLocation.SpellZone;
if ((selected & filter) > 0)
filter &= selected;
if ((filter & Zones.FieldZone) != 0) resp[2] = 5;
if ((filter & Zones.z0) != 0) resp[2] = 6; // left pendulum zone
if ((filter & Zones.z1) != 0) resp[2] = 7; // right pendulum zone
}
BinaryWriter reply = GamePacketFactory.Create(CtosMessage.Response);
reply.Write(resp);
Connection.Send(reply);
} }
private void OnSelectEffectYn(BinaryReader packet) private void OnSelectEffectYn(BinaryReader packet)
......
...@@ -73,9 +73,13 @@ ...@@ -73,9 +73,13 @@
<Compile Include="Game\AI\DeckAttribute.cs" /> <Compile Include="Game\AI\DeckAttribute.cs" />
<Compile Include="Game\AI\DecksManager.cs" /> <Compile Include="Game\AI\DecksManager.cs" />
<Compile Include="Game\AI\Decks\AltergeistExecutor.cs" /> <Compile Include="Game\AI\Decks\AltergeistExecutor.cs" />
<Compile Include="Game\AI\Decks\BraveExecutor.cs" />
<Compile Include="Game\AI\Decks\DinocarriageDynarmixExecutor.cs" /> <Compile Include="Game\AI\Decks\DinocarriageDynarmixExecutor.cs" />
<Compile Include="Game\AI\Decks\ExcutieExecutor.cs" />
<Compile Include="Game\AI\Decks\ExosisterExecutor.cs" />
<Compile Include="Game\AI\Decks\FamiliarPossessedExecutor.cs" /> <Compile Include="Game\AI\Decks\FamiliarPossessedExecutor.cs" />
<Compile Include="Game\AI\Decks\BlackwingExecutor.cs" /> <Compile Include="Game\AI\Decks\BlackwingExecutor.cs" />
<Compile Include="Game\AI\Decks\KashtiraExecutor.cs" />
<Compile Include="Game\AI\Decks\LuckyExecutor.cs" /> <Compile Include="Game\AI\Decks\LuckyExecutor.cs" />
<Compile Include="Game\AI\Decks\MathMechExecutor.cs" /> <Compile Include="Game\AI\Decks\MathMechExecutor.cs" />
<Compile Include="Game\AI\Decks\MituziExecutor.cs" /> <Compile Include="Game\AI\Decks\MituziExecutor.cs" />
...@@ -90,7 +94,9 @@ ...@@ -90,7 +94,9 @@
<Compile Include="Game\AI\Decks\SkyStrikerExecutor.cs" /> <Compile Include="Game\AI\Decks\SkyStrikerExecutor.cs" />
<Compile Include="Game\AI\Decks\MokeyMokeyKingExecutor.cs" /> <Compile Include="Game\AI\Decks\MokeyMokeyKingExecutor.cs" />
<Compile Include="Game\AI\Decks\MokeyMokeyExecutor.cs" /> <Compile Include="Game\AI\Decks\MokeyMokeyExecutor.cs" />
<Compile Include="Game\AI\Decks\TearlamentsExecutor.cs" />
<Compile Include="Game\AI\Decks\TheLegendExecutor.cs" /> <Compile Include="Game\AI\Decks\TheLegendExecutor.cs" />
<Compile Include="Game\AI\Decks\ThunderDragonExecutor.cs" />
<Compile Include="Game\AI\Decks\TimeThiefExecutor.cs" /> <Compile Include="Game\AI\Decks\TimeThiefExecutor.cs" />
<Compile Include="Game\AI\Decks\ToadallyAwesomeExecutor.cs" /> <Compile Include="Game\AI\Decks\ToadallyAwesomeExecutor.cs" />
<Compile Include="Game\AI\Decks\NekrozExecutor.cs" /> <Compile Include="Game\AI\Decks\NekrozExecutor.cs" />
...@@ -157,6 +163,7 @@ ...@@ -157,6 +163,7 @@
<ItemGroup> <ItemGroup>
<None Include="App.config" /> <None Include="App.config" />
<None Include="Decks\AI_Mituzi.ydk" /> <None Include="Decks\AI_Mituzi.ydk" />
<None Include="Decks\AI_Test.ydk" />
<None Include="Dialogs\Mituzi.zh-CN.json" /> <None Include="Dialogs\Mituzi.zh-CN.json" />
<None Include="Dialogs\rd-c.json" /> <None Include="Dialogs\rd-c.json" />
<None Include="Dialogs\rd-d.json" /> <None Include="Dialogs\rd-d.json" />
......
...@@ -26,6 +26,11 @@ ...@@ -26,6 +26,11 @@
"deck": "TheLegend", "deck": "TheLegend",
"dialog": "rd" "dialog": "rd"
}, },
{
"name": "光天女",
"deck": "Excutie",
"dialog": "Excutie.zh-CN"
},
{ {
"name": "幻宇子", "name": "幻宇子",
"deck": "Mituzi", "deck": "Mituzi",
......
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