Commit 63ecd7ee authored by 苍蓝's avatar 苍蓝

update

parent d434f809
Pipeline #38406 failed with stage
in 1 minute and 6 seconds
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
</configuration>
......@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BotWrapper</RootNamespace>
<AssemblyName>Bot</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
......
......@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("IceYGO")]
[assembly: AssemblyProduct("WindBot")]
[assembly: AssemblyCopyright("Copyright © IceYGO 2017")]
[assembly: AssemblyCopyright("Copyright © IceYGO 2015-2025")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
......
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
#created by ...
#main
32731036
25451383
60242223
62962630
62962630
62962630
68468459
68468459
45484331
45883110
95515789
19096726
14558127
14558127
14558127
23434538
23434538
23434538
36577931
1984618
1984618
6498706
6498706
34995106
44362883
75500286
81439173
24224830
24224830
29948294
36637374
65681983
82738008
18973184
10045474
10045474
10045474
19271881
32756828
17751597
#extra
11321089
38811586
44146295
44146295
92892239
70534340
3410461
24915933
72272462
1906812
41373230
51409648
87746184
87746184
53971455
!side
56787189
55273561
68468460
72554664
95515790
\ No newline at end of file
#created by ...
#main
51522296
51522296
62849088
69680031
69680031
95679145
72270339
60303688
60303688
60303688
14558127
14558127
14558127
23434538
23434538
23434538
10158145
10158145
10158145
1984618
1984618
1984618
31002402
60921537
16240772
24224830
24224830
65681983
80845034
80845034
80845034
35569555
35569555
35569555
10045474
10045474
10045474
82956214
82956214
82956214
#extra
24915933
41373230
11765832
11765832
80532587
80532587
80532587
53971455
53971455
74586817
79606837
93039339
2220237
24842059
60303245
!side
\ No newline at end of file
#created by ...
#main
81497285
81497285
2347656
41165831
73602965
73602965
75730490
1225009
1225009
1225009
37629703
37629703
37629703
14558127
14558127
14558127
23434538
23434538
23434538
74018812
74018812
74018812
2511
2511
2511
49238328
49238328
5380979
5380979
6351147
6351147
10045474
10045474
10045474
30748475
53417695
83326048
92714517
92714517
92714517
#extra
22850702
22850702
93039339
93039339
29479265
93084621
93084621
24269961
24269961
24269961
67680512
67680512
29301450
71607202
94259633
!side
#created by ...
#main
8633261
8633261
8633261
35844557
35844557
35844557
72238166
34022970
34022970
34022970
42141493
42141493
84192580
87126721
14558127
14558127
14558127
59438930
59438930
23434538
23434538
94145021
97268402
97268402
97268402
7477101
7477101
7477101
25311006
35261759
35261759
85106525
24224830
24224830
60394026
65681983
6798031
10045474
10045474
10045474
#extra
9940036
34909328
34909328
2061963
7511613
7511613
45852939
45852939
6983839
90590303
46772449
16643334
21044178
66011101
8728498
!side
20292186
34267821
34267821
34267821
67173574
18144507
19613556
35269904
15693423
83326048
83326048
83326048
41420027
41420027
41420027
#created by ...
#main
83334932
83334932
83334932
82112494
82112494
82112494
19510093
19510093
34496660
34496660
34496660
90361010
90361010
90361010
78391364
78391364
56727340
56727340
14624296
95500396
10604644
23434538
23434538
23434538
14558127
14558127
14558127
49036338
38814750
38814750
97268402
97268402
73642296
73642296
59438930
59438930
59438930
94145021
94145021
94145021
#extra
64193046
84815190
30983281
44508094
27548199
76471944
74586817
28912357
38342335
27381364
22423493
65741786
33918636
33918636
33918636
!side
#created by ...
#main
27204311
87052196
87052196
23431858
93490856
93490856
93490856
56495147
56495147
56495147
20001443
20001443
20001443
55273560
55273560
55273560
14558127
14558127
14558127
23434538
23434538
23434538
97268402
97268402
97268402
98159737
35261759
35261759
56465981
56465981
56465981
93850690
24224830
24224830
65681983
10045474
10045474
10045474
14821890
14821890
#extra
42632209
60465049
96633955
84815190
47710198
9464441
5041348
69248256
69248256
83755611
43202238
78917791
32519092
32519092
32519092
!side
#created by ...
#main
49036338
29432356
29432356
29432356
3611830
76794549
5560911
96227613
96227613
27354732
58990362
58990362
58990362
20773176
22617205
69610326
14785765
95401059
31314549
96223501
52159691
21495657
21495657
57777714
92559258
92559258
92559258
38814750
38814750
38814750
72291078
23434538
23434538
23434538
94693857
9742784
19580308
11609969
61488417
2295440
23581825
38943357
38943357
38943357
41620959
41620959
41620959
73628505
74580251
74580251
74580251
81439173
24224830
24224830
46372010
32354768
32354768
32354768
35561352
57831349
#extra
27548199
74586817
80696379
33158448
65536818
79606837
88581108
96157835
73347079
74997493
44097050
24094258
50588353
36429703
41999284
!side
......@@ -50,5 +50,10 @@
"乎,我发动{0}!",
"不好意思拉,我有{0}",
"哈哈,发动{0}的效果!"
],
"custom": [
"呱!本体出征!",
"凸(艹皿艹 )卡手不玩拉!!!",
"嘿不慌,还有摆子场( ̄y▽ ̄)╭"
]
}
......@@ -64,5 +64,11 @@
"Before you do that, I'll chain {0}!",
"Nice try, but I have {0}!",
"Didn't expect {0}, did you?"
],
"surrender": [
"I surrender.",
"You win this time.",
"I can't win this duel.",
"Good game."
]
}
\ No newline at end of file
{
"welcome": [
"这里就是大灵峰吗?",
"这里是教导龙国。",
"这里是开放的大地。"
],
"deckerror": [
"{0}被冰水咒缚了!"
],
"duelstart": [
"走了好久,肚子饿了……",
"前方会遇到怎样的同伴呢?",
"有阿不思在一起的话……"
],
"newturn": [
"我的回合!"
],
"endturn": [
"姐姐到底在哪里……",
"阿不思的干粮也吃完了啊。",
"什么时候开饭呢?"
],
"directattack": [
"{0},直接攻击!",
"开饭!"
],
"attack": [
"用{0}攻击{1}!"
],
"ondirectattack": [
"好饿……",
"呜呜……",
"姐姐……"
],
"facedownmonstername": "怪兽",
"activate": [
"发动{0}的效果!"
],
"summon": [
"{0}召唤!",
"出来吧,{0}!"
],
"setmonster": [
"……"
],
"chaining": [
"发动{0}的效果!",
"{0}!"
]
}
......@@ -55,5 +55,10 @@
"但我鸽了",
"无此服务",
"可怕"
],
"surrender": [
"太可怕了(跑路",
"这游戏好难玩(跑路",
"还好我不玩游戏王(跑路"
]
}
{
"welcome": [
"是宵夜哒哟!",
"什么灵摆卡组都会玩的哟!",
"什么?你说超重不是灵摆卡组?"
],
"deckerror": [
"{0}的数量不对!快去改成无禁限模式!。"
],
"duelstart": [
"给你展现一下超重的魅力!"
],
"newturn": [
"抽卡!弁庆你别上手救我了!",
"抽卡!P身子你别上手救我了!"
],
"endturn": [
"哼哼,到你的回合了!",
"喜不喜欢我的展开呢?"
],
"directattack": [
"我用{0}直接攻击!"
],
"attack": [
"我用{0}攻击{1}!"
],
"ondirectattack": [
"不许打!不许打呀!",
"呜哇!要被打倒惹~"
],
"facedownmonstername": "怪兽",
"activate": [
"呼呼呼,{0}的效果太厉害了!",
"呼呼呼,我使用{0}的效果。"
],
"summon": [
"呼呼呼,我召唤{0}!"
],
"setmonster": [
"呼呼呼,我盖放了一只怪兽。"
],
"chaining": [
"此刻!{0}的效果发动!"
]
}
......@@ -71,5 +71,9 @@
"我不认同。{0},发动!",
"看样子你忘了我的{0}!",
"你考虑过我有{0}吗?"
],
"surrender": [
"我认输。",
"我承认你的胜利。"
]
}
......@@ -434,6 +434,15 @@ namespace WindBot.Game.AI
if (selected.Count >= max)
break;
}
if (selected.Count < min)
{
#if DEBUG
throw new Exception("Not enough cards to CheckSelectCount");
#else
Logger.WriteErrorLine("Not enough cards to CheckSelectCount, using default");
return null;
#endif
}
}
while (selected.Count > max)
{
......@@ -442,5 +451,115 @@ namespace WindBot.Game.AI
return selected;
}
/// <summary>
/// Get all xyz materials lists that xyz monster required level in the 'pre_materials' list
/// </summary>
/// <param name="param_pre_materials">Original materials</param>
/// <param name="level">Xyz monster required level</param>
/// <param name="material_count">SpSummon rule:number of xyz materials</param>
/// <param name="material_count_above">More xyz materials</param>
/// <param name="material_func">Filter xyz materials func</param>
/// <returns></returns>
public List<List<ClientCard>> GetXyzMaterials(IList<ClientCard> param_pre_materials, int level, int material_count, bool material_count_above = false, Func<ClientCard, bool> material_func = null)
{
List<List<ClientCard>> result = new List<List<ClientCard>>();
List<ClientCard> pre_materials = param_pre_materials?.Where(card => card != null && !(card.IsFacedown() & card.Location == CardLocation.MonsterZone) && card.Level == level && !card.IsMonsterNotBeXyzMaterial()).ToList();
if (pre_materials?.Count() < material_count) return result;
Func<ClientCard, bool> default_func = card => true;
material_func = material_func ?? default_func;
for (int i = 1; i < Math.Pow(2, pre_materials.Count); i++)
{
List<ClientCard> temp_materials = new List<ClientCard>();
string binaryString = Convert.ToString(i, 2).PadLeft(pre_materials.Count, '0');
char[] reversedBinaryChars = binaryString.Reverse().ToArray();
for (int j = 0; j < pre_materials.Count; j++)
{
if (reversedBinaryChars[j] == '1' && material_func(pre_materials[j]))
{
temp_materials.Add(pre_materials[j]);
}
}
if (material_count_above ? temp_materials.Count >= material_count : temp_materials.Count == material_count)
{
result.Add(temp_materials);
}
}
return result;
}
/// <summary>
/// Get all synchro materials lists that synchro monster level == param 'level' in the 'pre_materials' list
/// </summary>
/// <param name="pre_materials">Original materials</param>
/// <param name="level">Synchro monster level</param>
/// <param name="tuner_count">SpSummon rule:number of tuner monsters </param>
/// <param name="n_tuner_count">SpSummon rule:number of non-tuner monsters count</param>
/// <param name="tuner_count_above">More tuner monsters</param>
/// <param name="n_tuner_count_above">More non-tuner monsters</param>
/// <param name="tuner_func">Filter tuner monsters func</param>
/// <param name="n_tuner_func">Filter non-tuner monsters func</param>
/// <returns></returns>
public List<List<ClientCard>> GetSynchroMaterials(IList<ClientCard> param_pre_materials, int level, int tuner_count, int n_tuner_count, bool tuner_count_above = false, bool n_tuner_count_above = true, Func<ClientCard, bool> tuner_func = null, Func<ClientCard, bool> n_tuner_func = null)
{
List<List<ClientCard>> t_result = new List<List<ClientCard>>();
List<ClientCard> pre_materials = param_pre_materials?.Where(card => card != null && !(card.IsFacedown() & card.Location == CardLocation.MonsterZone) && card.Level > 0 && !card.IsMonsterNotBeSynchroMaterial()).ToList();
if (pre_materials?.Count() < tuner_count + n_tuner_count) return t_result;
Func<ClientCard, bool> default_func = card => true;
tuner_func = tuner_func ?? default_func;
n_tuner_func = n_tuner_func ?? default_func;
pre_materials.Sort(CardContainer.CompareCardLevel);
Stack<object[]> materials_stack = new Stack<object[]>();
for (var i = 0; i < pre_materials.Count; i++)
{
if (pre_materials[i].Level > level) break;
materials_stack.Push(new object[] { pre_materials[i].Level, i, pre_materials[i].Level, new List<ClientCard> { pre_materials[i] } });
}
while (materials_stack.Count > 0)
{
object[] data = materials_stack.Pop();
int num = (int)data[0];
int index = (int)data[1];
int sum = (int)data[2];
List<ClientCard> temp_materials = (List<ClientCard>)data[3];
if (sum == level)
{
t_result.Add(temp_materials);
}
else if (sum < level)
{
for (var i = index + 1; i < pre_materials.Count; i++)
{
if (pre_materials[i].Level > level - sum) break;
if (i > index + 1 && pre_materials[i].Level == pre_materials[i - 1].Level) continue;
var new_temp_materials = new List<ClientCard>(temp_materials);
new_temp_materials.Add(pre_materials[i]);
materials_stack.Push(new object[] { pre_materials[i].Level, i, sum + pre_materials[i].Level, new_temp_materials });
}
}
}
List<List<ClientCard>> result = new List<List<ClientCard>>();
for (int i = 0; i < t_result.Count; i++)
{
List<ClientCard> materials = t_result[i];
List<ClientCard> tuner_materials = new List<ClientCard>();
List<ClientCard> n_tuner_materials = new List<ClientCard>();
foreach (ClientCard material in materials)
{
if (material.HasType(CardType.Tuner) && tuner_func(material))
{
tuner_materials.Add(material);
}
else if (material.Level > 0 && n_tuner_func(material))
{
n_tuner_materials.Add(material);
}
}
if ((tuner_count_above ? tuner_materials.Count >= tuner_count : tuner_materials.Count == tuner_count)
&& (n_tuner_count_above ? n_tuner_materials.Count >= n_tuner_count : n_tuner_materials.Count == n_tuner_count))
result.Add(materials);
}
return result;
}
}
}
\ No newline at end of file
......@@ -25,6 +25,15 @@ namespace WindBot.Game.AI
return 1;
}
public static int CompareCardLink(ClientCard cardA, ClientCard cardB)
{
if (cardA.LinkCount < cardB.LinkCount)
return -1;
if (cardA.LinkCount == cardB.LinkCount)
return 0;
return 1;
}
public static int CompareDefensePower(ClientCard cardA, ClientCard cardB)
{
if (cardA == null && cardB == null)
......@@ -46,39 +55,45 @@ namespace WindBot.Game.AI
{
return cards
.Where(card => card?.Data != null && card.HasType(CardType.Monster) && card.IsFaceup() && !(canBeTarget && card.IsShouldNotBeTarget()))
.OrderBy(card => card.Attack).FirstOrDefault();
.OrderByDescending(card => card.Attack)
.FirstOrDefault();
}
public static ClientCard GetHighestLevelMonster(this IEnumerable<ClientCard> cards, bool canBeTarget = false)
public static ClientCard GetHighestDefenseMonster(this IEnumerable<ClientCard> cards, bool canBeTarget = false)
{
return cards
.Where(card => card?.Data != null && card.HasType(CardType.Monster) && !(canBeTarget && card.IsShouldNotBeTarget()))
.OrderBy(card => card.Level).FirstOrDefault();
.Where(card => card?.Data != null && card.HasType(CardType.Monster) && card.IsFaceup() && !(canBeTarget && card.IsShouldNotBeTarget()))
.OrderByDescending(card => card.Defense)
.FirstOrDefault();
}
public static ClientCard GetLowestLevelMonster(this IEnumerable<ClientCard> cards, bool canBeTarget = false)
public static ClientCard GetHighestLevelMonster(this IEnumerable<ClientCard> cards, bool canBeTarget = false)
{
return cards
.Where(card => card?.Data != null && card.HasType(CardType.Monster) && !(canBeTarget && card.IsShouldNotBeTarget()))
.OrderByDescending(card => card.Level).FirstOrDefault();
.Where(card => card?.Data != null && card.HasType(CardType.Monster) && card.IsFaceup() && !(canBeTarget && card.IsShouldNotBeTarget()))
.OrderByDescending(card => card.Level)
.FirstOrDefault();
}
public static ClientCard GetHighestDefenseMonster(this IEnumerable<ClientCard> cards, bool canBeTarget = false)
public static ClientCard GetLowestAttackMonster(this IEnumerable<ClientCard> cards, bool canBeTarget = false)
{
return cards
.Where(card => card?.Data != null && card.HasType(CardType.Monster) && card.IsFaceup() && !(canBeTarget && card.IsShouldNotBeTarget()))
.OrderBy(card => card.Defense).FirstOrDefault();
.OrderBy(card => card.Attack)
.FirstOrDefault();
}
public static ClientCard GetLowestAttackMonster(this IEnumerable<ClientCard> cards, bool canBeTarget = false)
public static ClientCard GetLowestDefenseMonster(this IEnumerable<ClientCard> cards, bool canBeTarget = false)
{
return cards
.Where(card => card?.Data != null && card.HasType(CardType.Monster) && card.IsFaceup() && !(canBeTarget && card.IsShouldNotBeTarget()))
.OrderByDescending(card => card.Attack).FirstOrDefault();
.OrderBy(card => card.Defense)
.FirstOrDefault();
}
public static ClientCard GetLowestDefenseMonster(this IEnumerable<ClientCard> cards, bool canBeTarget = false)
public static ClientCard GetLowestLevelMonster(this IEnumerable<ClientCard> cards, bool canBeTarget = false)
{
return cards
.Where(card => card?.Data != null && card.HasType(CardType.Monster) && card.IsFaceup() && !(canBeTarget && card.IsShouldNotBeTarget()))
.OrderByDescending(card => card.Defense).FirstOrDefault();
.OrderBy(card => card.Level)
.FirstOrDefault();
}
public static bool ContainsMonsterWithLevel(this IEnumerable<ClientCard> cards, int level)
......@@ -115,6 +130,7 @@ namespace WindBot.Game.AI
{
return cards.FirstOrDefault(card => card?.Data != null && card.IsMonsterInvincible() && card.IsFaceup() && (!canBeTarget || !card.IsShouldNotBeTarget()));
}
public static ClientCard GetImmuneTrapMonster(this IEnumerable<ClientCard> cards, bool canBeTarget = false)
{
return cards.FirstOrDefault(card => card?.Data != null && card.IsMonsterImmuneTrap() && card.IsFaceup() && (!canBeTarget || !card.IsShouldNotBeTarget()));
......
......@@ -15,17 +15,18 @@ namespace WindBot.Game.AI
(card.Controller == 0 && Enum.IsDefined(typeof(InvincibleBotMonster), 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>
/// Is this monster is dangerous to attack?
/// </summary>
public static bool IsMonsterDangerous(this ClientCard card)
{
return !card.IsDisabled() && Enum.IsDefined(typeof(DangerousMonster), card.Id);
return !card.IsDisabled() &&
(Enum.IsDefined(typeof(DangerousMonster), card.Id) || (card.HasSetcode(0x18d) && (card.HasType(CardType.Ritual) || card.EquipCards.Count > 0)));
}
/// <summary>
......@@ -82,5 +83,21 @@ namespace WindBot.Game.AI
{
return Enum.IsDefined(typeof(FusionSpell), card.Id);
}
/// <summary>
/// Is this monster not be synchro material?
/// </summary>
public static bool IsMonsterNotBeSynchroMaterial(this ClientCard card)
{
return Enum.IsDefined(typeof(NotBeSynchroMaterialMonster), card.Id);
}
/// <summary>
/// Is this monster not be xyz material?
/// </summary>
public static bool IsMonsterNotBeXyzMaterial(this ClientCard card)
{
return Enum.IsDefined(typeof(NotBeXyzMaterialMonster), card.Id);
}
}
}
\ No newline at end of file
This diff is collapsed.
......@@ -3,6 +3,7 @@ using System.Collections.Generic;
using WindBot;
using WindBot.Game;
using WindBot.Game.AI;
using System.Linq;
namespace WindBot.Game.AI.Decks
{
......@@ -220,8 +221,7 @@ namespace WindBot.Game.AI.Decks
public bool isAltergeist(ClientCard card)
{
return card.IsCode(CardId.Marionetter, CardId.Hexstia, CardId.Protocol, CardId.Multifaker, CardId.Meluseek,
CardId.Kunquery, CardId.Manifestation, CardId.Silquitous);
return card != null && card.HasSetcode(0x103);
}
public int GetSequence(ClientCard card)
......@@ -324,23 +324,37 @@ namespace WindBot.Game.AI.Decks
public int SelectSTPlace(ClientCard card=null, bool avoid_Impermanence = false)
{
List<int> list = new List<int> { 0, 1, 2, 3, 4 };
if (card == null) card = Card;
List<int> list = new List<int>();
for (int seq = 0; seq < 5; ++seq)
{
if (Bot.SpellZone[seq] == null)
{
if (card != null && card.Location == CardLocation.Hand && avoid_Impermanence && Impermanence_list.Contains(seq)) continue;
list.Add(seq);
}
}
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;
int index = Program.Rand.Next(list.Count);
int nextIndex = (index + Program.Rand.Next(list.Count - 1)) % list.Count;
int tempInt = list[index];
list[index] = list[nextIndex];
list[nextIndex] = tempInt;
}
if (avoid_Impermanence && Bot.GetMonsters().Any(c => c.IsFaceup() && !c.IsDisabled()))
{
foreach (int seq in list)
{
int zone = (int)System.Math.Pow(2, seq);
if (Bot.SpellZone[seq] == null)
ClientCard enemySpell = Enemy.SpellZone[4 - seq];
if (enemySpell != null && enemySpell.IsFacedown()) continue;
return (int)System.Math.Pow(2, seq);
}
}
foreach (int seq in list)
{
if (card != null && card.Location == CardLocation.Hand && avoid_Impermanence && Impermanence_list.Contains(seq)) continue;
return zone;
};
return (int)System.Math.Pow(2, seq);
}
return 0;
}
......@@ -376,6 +390,7 @@ namespace WindBot.Game.AI.Decks
public bool spell_trap_activate(bool isCounter = false, ClientCard target = null)
{
if (target == null) target = Card;
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (target.Location != CardLocation.SpellZone && target.Location != CardLocation.Hand) return true;
if (Enemy.HasInMonstersZone(CardId.NaturalExterio, true) && !Bot.HasInHandOrHasInMonstersZone(CardId.GO_SR) && !isCounter && !Bot.HasInSpellZone(CardId.SolemnStrike)) return false;
if (target.IsSpell())
......@@ -649,7 +664,7 @@ namespace WindBot.Game.AI.Decks
public bool G_activate()
{
return (Duel.Player == 1);
return (Duel.Player == 1) && !DefaultCheckWhetherCardIsNegated(Card);
}
public bool NaturalExterio_eff()
......@@ -806,6 +821,7 @@ namespace WindBot.Game.AI.Decks
public bool Hand_act_eff()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Card.IsCode(CardId.AB_JS) && Util.GetLastChainCard().HasSetcode(0x11e) && Util.GetLastChainCard().Location == CardLocation.Hand) // Danger! archtype hand effect
return false;
if (Card.IsCode(CardId.GO_SR) && Card.Location == CardLocation.Hand && Bot.HasInMonstersZone(CardId.GO_SR)) return false;
......@@ -886,6 +902,7 @@ namespace WindBot.Game.AI.Decks
public bool GR_WC_activate()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
int warrior_count = 0;
int pendulum_count = 0;
int link_count = 0;
......@@ -1248,7 +1265,7 @@ namespace WindBot.Game.AI.Decks
if (linked_card != null && linked_card.IsCode(CardId.Hexstia))
{
int next_seq = get_Hexstia_linkzone(this_seq);
if (next_seq != -1 && Bot.MonsterZone[next_seq] != null && isAltergeist(Bot.MonsterZone[next_seq].Id)) return false;
if (next_seq != -1 && Bot.MonsterZone[next_seq] != null && isAltergeist(Bot.MonsterZone[next_seq])) return false;
}
}
return true;
......@@ -1675,7 +1692,7 @@ namespace WindBot.Game.AI.Decks
if (target.IsCode(CardId.Hexstia))
{
int next_index = get_Hexstia_linkzone(i);
if (next_index != -1 && Bot.MonsterZone[next_index] != null && Bot.MonsterZone[next_index].IsFaceup() && isAltergeist(Bot.MonsterZone[next_index].Id)) continue;
if (next_index != -1 && Bot.MonsterZone[next_index] != null && Bot.MonsterZone[next_index].IsFaceup() && isAltergeist(Bot.MonsterZone[next_index])) continue;
}
if (!get_linked_by_Hexstia(i))
{
......@@ -2654,6 +2671,28 @@ namespace WindBot.Game.AI.Decks
ss_other_monster = false;
Impermanence_list.Clear();
attacked_Meluseek.Clear();
base.OnNewTurn();
}
public override void OnChaining(int player, ClientCard card)
{
if (card == null) return;
if (player == 1)
{
if (card.IsCode(_CardId.InfiniteImpermanence))
{
for (int i = 0; i < 5; ++i)
{
if (Enemy.SpellZone[i] == card)
{
Impermanence_list.Add(4-i);
break;
}
}
}
}
base.OnChaining(player, card);
}
public bool MonsterRepos()
......@@ -2797,7 +2836,8 @@ namespace WindBot.Game.AI.Decks
// throw all??
return null;
}
return null;
return base.OnSelectCard(cards, min, max, hint, cancelable);
}
public override CardPosition OnSelectPosition(int cardId, IList<CardPosition> positions)
......@@ -2853,16 +2893,16 @@ namespace WindBot.Game.AI.Decks
if (cardId == CardId.Hexstia)
{
// ex zone
if ((Zones.z5 & available) > 0 && Bot.MonsterZone[1] != null && isAltergeist(Bot.MonsterZone[1].Id)) return Zones.z5;
if ((Zones.z6 & available) > 0 && Bot.MonsterZone[3] != null && isAltergeist(Bot.MonsterZone[3].Id)) return Zones.z6;
if ( ((Zones.z6 & available) > 0 && Bot.MonsterZone[3] != null && !isAltergeist(Bot.MonsterZone[3].Id))
if ((Zones.z5 & available) > 0 && Bot.MonsterZone[1] != null && isAltergeist(Bot.MonsterZone[1])) return Zones.z5;
if ((Zones.z6 & available) > 0 && Bot.MonsterZone[3] != null && isAltergeist(Bot.MonsterZone[3])) return Zones.z6;
if ( ((Zones.z6 & available) > 0 && Bot.MonsterZone[3] != null && !isAltergeist(Bot.MonsterZone[3]))
|| ((Zones.z5 & available) > 0 && Bot.MonsterZone[1] == null) ) return Zones.z5;
if (((Zones.z5 & available) > 0 && Bot.MonsterZone[1] != null && !isAltergeist(Bot.MonsterZone[1].Id))
if (((Zones.z5 & available) > 0 && Bot.MonsterZone[1] != null && !isAltergeist(Bot.MonsterZone[1]))
|| ((Zones.z6 & available) > 0 && Bot.MonsterZone[3] == null)) return Zones.z6;
// main zone
for (int i = 1; i < 5; ++i)
{
if (Bot.MonsterZone[i] != null && isAltergeist(Bot.MonsterZone[i].Id))
if (Bot.MonsterZone[i] != null && isAltergeist(Bot.MonsterZone[i]))
{
if ((available & (int)System.Math.Pow(2, i - 1)) > 0) return (int)System.Math.Pow(2, i - 1);
}
......@@ -2876,5 +2916,15 @@ namespace WindBot.Game.AI.Decks
}
return base.OnSelectPlace(cardId, player, location, available);
}
protected override bool DefaultSetForDiabellze()
{
if (base.DefaultSetForDiabellze())
{
AI.SelectPlace(SelectSTPlace(Card, true));
return true;
}
return false;
}
}
}
\ No newline at end of file
......@@ -131,6 +131,7 @@ namespace WindBot.Game.AI.Decks
UsedGalaxyEyesCipherDragon = null;
AlternativeWhiteDragonSummoned = false;
SoulChargeUsed = false;
base.OnNewTurn();
}
public override IList<ClientCard> OnSelectCard(IList<ClientCard> cards, int min, int max, int hint, bool cancelable)
......@@ -146,7 +147,8 @@ namespace WindBot.Game.AI.Decks
return Util.CheckSelectCount(result, cards, min, max);
}
Logger.DebugWriteLine("Use default.");
return null;
return base.OnSelectCard(cards, min, max, hint, cancelable);
}
public override IList<ClientCard> OnSelectXyzMaterial(IList<ClientCard> cards, int min, int max)
......@@ -175,6 +177,22 @@ namespace WindBot.Game.AI.Decks
return null;
}
public override void OnSpSummoned()
{
// not special summoned by chain
if (Duel.GetCurrentSolvingChainCard() == null)
{
foreach (ClientCard card in Duel.LastSummonedCards)
{
if (card.Controller == 0 && card.IsCode(CardId.AlternativeWhiteDragon))
{
AlternativeWhiteDragonSummoned = true;
}
}
}
base.OnSpSummoned();
}
private bool DragonShrineEffect()
{
AI.SelectCard(
......@@ -499,7 +517,6 @@ namespace WindBot.Game.AI.Decks
private bool AlternativeWhiteDragonSummon()
{
AlternativeWhiteDragonSummoned = true;
return true;
}
......
......@@ -121,6 +121,7 @@ namespace WindBot.Game.AI.Decks
private bool MaxxCeff()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
return Duel.Player == 1;
}
......@@ -464,6 +465,7 @@ namespace WindBot.Game.AI.Decks
private bool Linkuriboheff()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Duel.LastChainPlayer == 0 && Util.GetLastChainCard().IsCode(CardId.Linkuriboh)) return false;
return true;
}
......
......@@ -180,6 +180,7 @@ namespace WindBot.Game.AI.Decks
FusionDestinyUsed = false;
PhoenixTarget = null;
PhoenixSelectingTarget = 0;
base.OnNewTurn();
}
public override CardPosition OnSelectPosition(int cardId, IList<CardPosition> positions)
......@@ -479,6 +480,7 @@ namespace WindBot.Game.AI.Decks
private bool AquamancerOfTheSanctuarySearchEffect()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Card.Location == CardLocation.Grave)
{
AI.SelectCard(CardLocation.Deck);
......@@ -626,6 +628,7 @@ namespace WindBot.Game.AI.Decks
private bool JetSynchronEffect()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
int[] materials = new[] {
CardId.MechaPhantomBeastToken
};
......@@ -786,6 +789,7 @@ namespace WindBot.Game.AI.Decks
private bool PredaplantVerteAnacondaEffect()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (ActivateDescription == Util.GetStringId(CardId.PredaplantVerteAnaconda, 0))
return false;
FusionDestinyUsed = true;
......@@ -858,6 +862,7 @@ namespace WindBot.Game.AI.Decks
private bool DestinyHeroCelestialEffect()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (!Bot.HasInGraveyard(CardId.DestinyHeroDasher))
return false;
AI.SelectCard(CardId.DestinyHeroDasher);
......@@ -971,6 +976,7 @@ namespace WindBot.Game.AI.Decks
private bool VirtualWorldKyubiShenshenEffect()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Card.Location == CardLocation.MonsterZone && Bot.HasInBanished(CardId.AquamancerOfTheSanctuary))
{
AI.SelectCard(CardId.AquamancerOfTheSanctuary);
......
......@@ -265,6 +265,7 @@ namespace WindBot.Game.AI.Decks
prevent_used = false;
Linkuribohused = true;
Timelord_check = false;
base.OnNewTurn();
}
public override void OnNewPhase()
{
......
......@@ -316,6 +316,7 @@ namespace WindBot.Game.AI.Decks
big_attack = false;
big_attack_used = false;
soul_used = false;
base.OnNewTurn();
}
public int GetTotalATK(IList<ClientCard> list)
{
......@@ -496,11 +497,13 @@ namespace WindBot.Game.AI.Decks
{
if (Bot.LifePoints > 1500 && Duel.LastChainPlayer == 1)
return true;
if (DefaultOnlyHorusSpSummoning()) return false;
return false;
}
private bool ChainEnemy()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Util.GetLastChainCard() != null &&
Util.GetLastChainCard().IsCode(CardId.UpstartGoblin))
return false;
......@@ -519,6 +522,7 @@ namespace WindBot.Game.AI.Decks
private bool MaxxCeff()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
return Duel.Player == 1;
}
/*
......@@ -1417,6 +1421,7 @@ namespace WindBot.Game.AI.Decks
}
else
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Bot.HasInMonstersZone(CardId.VentriloauistsClaraAndLucika))
{
AI.SelectCard(CardId.VentriloauistsClaraAndLucika);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -123,6 +123,7 @@ namespace WindBot.Game.AI.Decks
{
BeastOLionUsed = false;
RedEyesFusionUsed = false;
base.OnNewTurn();
}
public override CardPosition OnSelectPosition(int cardId, IList<CardPosition> positions)
......@@ -198,6 +199,7 @@ namespace WindBot.Game.AI.Decks
private bool TourGuideFromTheUnderworldSummon()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Bot.GetRemainingCount(CardId.TourGuideFromTheUnderworld, 2) == 0 && Bot.GetRemainingCount(CardId.Sangan, 2) == 0)
return false;
return true;
......@@ -307,6 +309,7 @@ namespace WindBot.Game.AI.Decks
private bool MagiciansSoulsEffect()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Card.Location == CardLocation.Hand)
{
if (RedEyesFusionUsed)
......@@ -375,6 +378,7 @@ namespace WindBot.Game.AI.Decks
private bool PredaplantVerteAnacondaEffect()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (ActivateDescription == Util.GetStringId(CardId.PredaplantVerteAnaconda, 0))
return false;
AI.SelectCard(CardId.RedEyesFusion);
......
......@@ -456,6 +456,7 @@ namespace WindBot.Game.AI.Decks
private bool AssaultBeast()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (!Bot.HasInSpellZone(CardId.AssaultModeActivate))
return true;
return false;
......
This diff is collapsed.
......@@ -135,6 +135,7 @@ namespace WindBot.Game.AI.Decks
private bool Ronintoadin()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
List<ClientCard> monsters = Bot.GetGraveyardMonsters();
if (monsters.Count > 2)
{
......
......@@ -128,6 +128,7 @@ namespace WindBot.Game.AI.Decks
{
eater_eff = false;
CardOfDemiseeff_used = false;
base.OnNewTurn();
}
public override void OnNewPhase()
......@@ -437,6 +438,7 @@ namespace WindBot.Game.AI.Decks
private bool ThunderKingRaiOheff()
{
if (DefaultOnlyHorusSpSummoning()) return false;
if(Duel.SummoningCards.Count > 0)
{
foreach(ClientCard m in Duel.SummoningCards)
......@@ -570,6 +572,7 @@ namespace WindBot.Game.AI.Decks
private bool MetalSnakesp()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (ActivateDescription == Util.GetStringId(CardId.MetalSnake, 0) && !Bot.HasInMonstersZone(CardId.MetalSnake))
{
if(Duel.Player == 1 && Duel.Phase >= DuelPhase.BattleStart )
......
......@@ -153,7 +153,7 @@ namespace WindBot.Game.AI.Decks
{
// We should summon Horus the Black Flame Dragon LV6 if he can lvlup.
if (Enemy.GetMonsterCount() != 0 && !Util.IsAllEnemyBetterThanValue(2300 - 1, false))
foreach (ClientCard card in Main.SummonableCards)
foreach (ClientCard card in Duel.MainPhase.SummonableCards)
if (card.IsCode(11224103))
return false;
......
......@@ -175,6 +175,7 @@ namespace WindBot.Game.AI.Decks
opt_2 = false;
if (flag >= 0) ++flag;
if (flag >= 2) { flag = -1; activate_DimensionShifter = false; }
base.OnNewTurn();
}
public override bool OnSelectYesNo(int desc)
{
......
This diff is collapsed.
......@@ -217,11 +217,12 @@ namespace WindBot.Game.AI.Decks
JetSynchronUsed = false;
ScrapWyvernUsed = false;
MaskedChameleonUsed = false;
base.OnNewTurn();
}
public override void OnChainEnd()
{
base.OnChainEnd();
}
public override CardPosition OnSelectPosition(int cardId, IList<CardPosition> positions)
......
......@@ -274,6 +274,7 @@ namespace WindBot.Game.AI.Decks
ShaddollSquamata_used = false;
ShaddollDragon_used = false;
ShaddollHedgehog_used = false;
base.OnNewTurn();
}
private bool Luminasummon()
......@@ -290,6 +291,7 @@ namespace WindBot.Game.AI.Decks
}
private bool Luminaeff()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Bot.HasInGraveyard(CardId.Raiden))
{
AI.SelectCard(Useless_List());
......@@ -555,6 +557,7 @@ namespace WindBot.Game.AI.Decks
private bool GlowUpBulbeff()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
IList<ClientCard> check = Bot.GetMonstersInExtraZone();
foreach (ClientCard monster in check)
if (monster.HasType(CardType.Fusion)) return false;
......@@ -627,6 +630,7 @@ namespace WindBot.Game.AI.Decks
private bool MaxxC()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
return Duel.Player == 1;
}
......@@ -977,6 +981,7 @@ namespace WindBot.Game.AI.Decks
public bool Hand_act_eff()
{
//if (Card.IsCode(CardId.Urara) && Bot.HasInHand(CardId.LockBird) && Bot.HasInSpellZone(CardId.Re)) return false;
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Card.IsCode(CardId.GhostOgre) && Card.Location == CardLocation.Hand && Bot.HasInMonstersZone(CardId.GhostOgre)) return false;
return (Duel.LastChainPlayer == 1);
}
......@@ -998,6 +1003,7 @@ namespace WindBot.Game.AI.Decks
if (Card.Location == CardLocation.Grave)
return true;
if (Bot.LifePoints <= 1000) return false;
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
ClientCard select = Util.GetBestEnemyCard();
if (select == null) return false;
if(select!=null)
......
......@@ -13,40 +13,16 @@ namespace WindBot.Game.AI.Decks
public LuckyExecutor(GameAI ai, Duel duel)
: base(ai, duel)
{
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, _CardId.暗黑释放, 圣防Effect);
AddExecutor(ExecutorType.Activate, ImFeelingLucky);
AddExecutor(ExecutorType.SpSummon, ImFeelingLucky);
AddExecutor(ExecutorType.SpSummon, ImFeelingUnlucky);
AddExecutor(ExecutorType.Activate, ImFeelingUnlucky);
AddExecutor(ExecutorType.Activate, _CardId.苍救升, 苍救升Effect);
AddExecutor(ExecutorType.Activate, _CardId.苍救降, 苍救降Effect);
AddExecutor(ExecutorType.Activate, _CardId.传说战士, 传说战士Effect);
AddExecutor(ExecutorType.Activate, _CardId.海龙骑士, 海龙骑士Effect);
AddExecutor(ExecutorType.SummonOrSet, ImFeelingLazy);
AddExecutor(ExecutorType.SpellSet, DefaultSpellSet);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
AddExecutor(ExecutorType.Activate, _CardId.手枪龙, 手枪龙Effect);
AddExecutor(ExecutorType.Activate, _CardId.最强战旗, 最强战旗Eff);
//AddExecutor(ExecutorType.Activate, _CardId.升阵, 装备act);
//AddExecutor(ExecutorType.Activate, _CardId.苍救之证, 装备act);
AddExecutor(ExecutorType.Activate, 装备Effect);
AddExecutor(ExecutorType.Activate, _CardId.MysticalSpaceTyphoon, DefaultMysticalSpaceTyphoon);
AddExecutor(ExecutorType.Activate, _CardId.CosmicCyclone, DefaultCosmicCyclone);
AddExecutor(ExecutorType.Activate, _CardId.GalaxyCyclone, DefaultGalaxyCyclone);
......@@ -76,9 +52,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, _CardId.AllureofDarkness, DefaultAllureofDarkness);
AddExecutor(ExecutorType.Activate, _CardId.DimensionalBarrier, DefaultDimensionalBarrier);
AddExecutor(ExecutorType.Activate, _CardId.InterruptedKaijuSlumber, DefaultInterruptedKaijuSlumber);
AddExecutor(ExecutorType.Summon, _CardId.苍救降);
AddExecutor(ExecutorType.Summon, _CardId.苍救升);
AddExecutor(ExecutorType.SummonOrSet, ImFeelingLazy);
AddExecutor(ExecutorType.SpSummon, _CardId.JizukirutheStarDestroyingKaiju, DefaultKaijuSpsummon);
AddExecutor(ExecutorType.SpSummon, _CardId.GadarlatheMysteryDustKaiju, DefaultKaijuSpsummon);
AddExecutor(ExecutorType.SpSummon, _CardId.GamecieltheSeaTurtleKaiju, DefaultKaijuSpsummon);
......@@ -107,22 +81,6 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Summon, _CardId.LeftLegofTheForbiddenOne, JustDontIt);
AddExecutor(ExecutorType.Summon, _CardId.RightArmofTheForbiddenOne, JustDontIt);
AddExecutor(ExecutorType.Summon, _CardId.ExodiaTheForbiddenOne, JustDontIt);
AddExecutor(ExecutorType.Activate, _CardId.死苏, 死苏Effect);
AddExecutor(ExecutorType.Activate, _CardId.死苏2, 死苏Effect);
AddExecutor(ExecutorType.Activate, _CardId.斗牛士, 斗牛士Effect);
AddExecutor(ExecutorType.Activate, _CardId.最强战旗, 最强战旗Effect);
AddExecutor(ExecutorType.Activate, _CardId.钢机神, 钢机神1Effect);
AddExecutor(ExecutorType.Activate, _CardId.钢机神, 钢机神Effect);
AddExecutor(ExecutorType.Summon, _CardId.伟大魔兽, 伟大魔兽Sum);
AddExecutor(ExecutorType.MonsterSet, _CardId.千年盾, DefaultMonsterSummon);
AddExecutor(ExecutorType.Activate, _CardId.死供, 死供Effect);
AddExecutor(ExecutorType.Activate, _CardId.活杀, 活杀Effect);
AddExecutor(ExecutorType.Activate, _CardId.耳语妖精, 耳语妖精Effect);
AddExecutor(ExecutorType.Repos, 反转Repos2);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
AddExecutor(ExecutorType.Repos, 圣防Repos);
AddExecutor(ExecutorType.SpellSet, DefaultSpellSet);
}
private List<int> HintMsgForEnemy = new List<int>
......@@ -135,10 +93,7 @@ namespace WindBot.Game.AI.Decks
{
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
......@@ -151,7 +106,7 @@ namespace WindBot.Game.AI.Decks
private List<int> HintMsgForMaxSelect = new List<int>
{
HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.AddToHand, HintMsg.FusionMaterial, HintMsg.Destroy, HintMsg.Equip ,HintMsg.Confirm
HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.AddToHand, HintMsg.FusionMaterial, HintMsg.Destroy
};
public override IList<ClientCard> OnSelectCard(IList<ClientCard> _cards, int min, int max, int hint, bool cancelable)
......@@ -193,19 +148,6 @@ namespace WindBot.Game.AI.Decks
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))
{
......@@ -256,10 +198,7 @@ namespace WindBot.Game.AI.Decks
return selected;
}
public override bool OnSelectHand()
{
return true;
}
public override int OnSelectOption(IList<int> options)
{
return Program.Rand.Next(options.Count);
......@@ -280,13 +219,14 @@ namespace WindBot.Game.AI.Decks
private bool ImFeelingLucky()
{
return Program.Rand.Next(10) >= 5 && DefaultDontChainMyself() && !Card.HasType(CardType.Equip);
if (Type == ExecutorType.Activate && DefaultCheckWhetherCardIsNegated(Card)) return false;
return Program.Rand.Next(10) >= 5 && DefaultDontChainMyself();
}
private bool ImFeelingUnlucky()
{
return DefaultDontChainMyself() && !Card.HasType(CardType.Equip);
if (Type == ExecutorType.Activate && DefaultCheckWhetherCardIsNegated(Card)) return false;
return DefaultDontChainMyself();
}
private bool ImFeelingLazy()
......
......@@ -58,7 +58,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.透幻乡险峻,DefaultField);
AddExecutor(ExecutorType.Repos, 幻刃急攻Repos);
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.风车鳞虫);
......@@ -337,7 +337,7 @@ namespace WindBot.Game.AI.Decks
int[] materials = new[] { CardId.幻刃破龙, CardId.建造龙, CardId.幻龙重骑, CardId.起重龙 };
if (Bot.HasInMonstersZone(materials))
{
AI.SelectTribute(materials);
AI.SelectCard(materials);
return true;
}
return false;
......
......@@ -59,7 +59,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Summon, CardId.人造人, DefaultMonsterSummon);
AddExecutor(ExecutorType.Summon, CardId.神秘庄家);
AddExecutor(ExecutorType.Summon, CardId.侏儒兔, 侏儒兔Summon);
AddExecutor(ExecutorType.Activate, CardId.神秘庄家, draweffect);
AddExecutor(ExecutorType.Activate, CardId.神秘庄家, Draweffect);
AddExecutor(ExecutorType.SpellSet, CardId.暗黑释放);
AddExecutor(ExecutorType.SpellSet, CardId.落穴);
AddExecutor(ExecutorType.Activate, CardId.暗黑释放, 圣防Effect);
......@@ -335,7 +335,7 @@ namespace WindBot.Game.AI.Decks
AI.SelectCard(Enemy.GetMonsters().GetHighestAttackMonster());
return true;
}
private bool draweffect()
private bool Draweffect()
{
if ((Bot.MonsterZone.GetMatchingCardsCount(card => card.Level < 5) + Bot.Hand.GetMatchingCardsCount(card => card.Level < 5)) <= 2)
......
......@@ -11,8 +11,6 @@ namespace WindBot.Game.AI.Decks
[Deck("MokeyMokeyKing", "AI_MokeyMokeyKing")]
public class MokeyMokeyKingExecutor : DefaultExecutor
{
public class CardId
{
......@@ -64,7 +62,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Summon, CardId.人造人, DefaultMonsterSummon);
AddExecutor(ExecutorType.Summon, CardId.神秘庄家);
AddExecutor(ExecutorType.Summon, CardId.侏儒兔, 侏儒兔Summon);
AddExecutor(ExecutorType.Activate, CardId.神秘庄家, draweffect);
AddExecutor(ExecutorType.Activate, CardId.神秘庄家, Draweffect);
AddExecutor(ExecutorType.SpellSet, CardId.暗黑释放);
AddExecutor(ExecutorType.SpellSet, CardId.落穴);
AddExecutor(ExecutorType.Activate, CardId.暗黑释放, 圣防Effect);
......@@ -90,7 +88,6 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Repos, CardId.七星道魔术师, 反转Repos);
AddExecutor(ExecutorType.Repos, CardId.青眼白龙, 圣防Repos);
AddExecutor(ExecutorType.Repos, CardId.破坏之剑士, 圣防Repos);
//AddExecutor(ExecutorType.Activate, CardId.sionmax, sionmaxEffect);
AddExecutor(ExecutorType.Activate, CardId.耳语妖精, 耳语妖精Effect);
AddExecutor(ExecutorType.Activate, CardId.火星心少女, 火星心少女Effect);
AddExecutor(ExecutorType.Activate, CardId.连击龙);
......@@ -334,7 +331,7 @@ namespace WindBot.Game.AI.Decks
AI.SelectYesNo(true);
return true;
}
private bool draweffect()
private bool Draweffect()
{
if ((Bot.MonsterZone.GetMatchingCardsCount(card => card.Level < 5) + Bot.Hand.GetMatchingCardsCount(card => card.Level < 5)) <= 2)
......
......@@ -69,10 +69,10 @@ namespace WindBot.Game.AI.Decks
if (_lastDoubleSummon == Duel.Turn)
return false;
if (Main.SummonableCards.Count == 0)
if (Duel.MainPhase.SummonableCards.Count == 0)
return false;
if (Main.SummonableCards.Count == 1 && Main.SummonableCards[0].Level < 5)
if (Duel.MainPhase.SummonableCards.Count == 1 && Duel.MainPhase.SummonableCards[0].Level < 5)
{
bool canTribute = false;
foreach (ClientCard handCard in Bot.Hand)
......
......@@ -214,11 +214,13 @@ namespace WindBot.Game.AI.Decks
CymbalSkeletonUsed = false;
BorrelswordDragonUsed = false;
RustyBardicheTarget = null;
base.OnNewTurn();
}
public override void OnChainEnd()
{
RustyBardicheTarget = null;
base.OnChainEnd();
}
public override CardPosition OnSelectPosition(int cardId, IList<CardPosition> positions)
......@@ -465,6 +467,7 @@ namespace WindBot.Game.AI.Decks
private bool JetSynchronEffect()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
AI.SelectCard(HandCosts);
return true;
}
......@@ -488,6 +491,7 @@ namespace WindBot.Game.AI.Decks
private bool DestrudoSummon()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
return Bot.GetMonsterCount() < 3 && Bot.HasInExtra(new[] { CardId.CrystronNeedlefiber, CardId.KnightmarePhoenix });
}
......@@ -659,6 +663,7 @@ namespace WindBot.Game.AI.Decks
private bool KnightmarePhoenixEffect()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
int costcount = Bot.Hand.GetMatchingCardsCount(card => card.IsCode(HandCosts));
ClientCard target = Enemy.SpellZone.GetFloodgate();
ClientCard anytarget = Enemy.SpellZone.GetFirstMatchingCard(card => !card.OwnTargets.Any(cont => cont.IsCode(CardId.TrickstarLightStage)));
......@@ -685,6 +690,7 @@ namespace WindBot.Game.AI.Decks
private bool KnightmareMermaidEffect()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
AI.SelectCard(HandCosts);
return true;
}
......@@ -703,6 +709,7 @@ namespace WindBot.Game.AI.Decks
private bool OrcustKnightmareEffect()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (!Bot.HasInGraveyard(CardId.OrcustHarpHorror))
{
AI.SelectCard(Util.GetBestBotMonster());
......@@ -726,6 +733,7 @@ namespace WindBot.Game.AI.Decks
private bool HarpHorrorEffect()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
HarpHorrorUsed = true;
AI.SelectCard(CardId.OrcustCymbalSkeleton);
return true;
......@@ -733,6 +741,7 @@ namespace WindBot.Game.AI.Decks
private bool WorldWandEffect()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
AI.SelectCard(CardId.OrcustCymbalSkeleton);
return true;
}
......@@ -783,6 +792,7 @@ namespace WindBot.Game.AI.Decks
private bool CymbalSkeletonEffect()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
int[] botTurnTargets = new[] { CardId.GalateaTheOrcustAutomaton, CardId.SheorcustDingirsu };
int[] emenyTurnTargets = new[] { CardId.SheorcustDingirsu, CardId.GalateaTheOrcustAutomaton };
if (Duel.Player == 0 && Bot.HasInGraveyard(CardId.GalateaTheOrcustAutomaton) && !Bot.HasInMonstersZone(CardId.GalateaTheOrcustAutomaton) && Bot.HasInExtra(CardId.SheorcustDingirsu) && !SheorcustDingirsuSummoned)
......@@ -867,6 +877,7 @@ namespace WindBot.Game.AI.Decks
private bool AncientCloakEffect()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Bot.HasInMonstersZone(CardId.SalamangreatAlmiraj) && Bot.HasInExtra(CardId.KnightmarePhoenix))
AI.SelectCard(CardId.ThePhantomKnightsofShadeBrigandine);
else
......@@ -881,6 +892,7 @@ namespace WindBot.Game.AI.Decks
private bool SilentBootsEffect()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Bot.HasInMonstersZone(CardId.SalamangreatAlmiraj) && Bot.HasInExtra(CardId.KnightmarePhoenix))
AI.SelectCard(CardId.ThePhantomKnightsofShadeBrigandine);
else
......@@ -1033,6 +1045,7 @@ namespace WindBot.Game.AI.Decks
{
if (Card.Location == CardLocation.Grave)
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
IList<ClientCard> costCards = Bot.Hand.GetMatchingCards(card => card.IsCode(HandCosts));
if (costCards.Count > 0)
{
......@@ -1113,6 +1126,7 @@ namespace WindBot.Game.AI.Decks
}
else if (Bot.HasInGraveyard(CardId.ThePhantomKnightsofRustyBardiche) || Bot.GetMonsterCount() < 2)
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
AI.SelectCard(CardId.ThePhantomKnightsofRustyBardiche);
return true;
}
......
......@@ -555,6 +555,7 @@ namespace WindBot.Game.AI.Decks
}
private bool SpeedroidTaketomborgeff()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if ((Bot.GetRemainingCount(CardId.SpeedroidRedEyedDice, 1) >= 1) &&
Bot.HasInMonstersZone(CardId.SpeedroidTerrortop))
{
......
......@@ -130,6 +130,7 @@ namespace WindBot.Game.AI.Decks
public override void OnNewTurn()
{
CardOfDemiseUsed = false;
base.OnNewTurn();
}
public override IList<ClientCard> OnSelectPendulumSummon(IList<ClientCard> cards, int max)
......@@ -281,6 +282,7 @@ namespace WindBot.Game.AI.Decks
{
if (Card.Location == CardLocation.Hand)
return false;
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
int count = 0;
int handcount = 0;
int fieldcount = 0;
......
......@@ -142,6 +142,7 @@ namespace WindBot.Game.AI.Decks
public override void OnNewTurn()
{
NormalSummoned = false;
base.OnNewTurn();
}
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
......@@ -210,6 +211,7 @@ namespace WindBot.Game.AI.Decks
private bool RescueRabbitSummon()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
return Util.GetBotAvailZonesFromExtraDeck() > 0
|| !Enemy.MonsterZone.IsExistingMatchingCard(card => card.GetDefensePower() >= 1900)
|| Enemy.MonsterZone.GetMatchingCardsCount(card => card.GetDefensePower() < 1900) > Bot.MonsterZone.GetMatchingCardsCount(card => card.Attack >= 1900);
......
......@@ -116,6 +116,7 @@ namespace WindBot.Game.AI.Decks
DoubleSummonUsed = false;
CyberDragonInfinitySummoned = false;
Number61VolcasaurusUsed = false;
base.OnNewTurn();
}
public override IList<ClientCard> OnSelectXyzMaterial(IList<ClientCard> cards, int min, int max)
......
This diff is collapsed.
......@@ -153,6 +153,7 @@ namespace WindBot.Game.AI.Decks
{
// reset
BalancerLordUsed = false;
base.OnNewTurn();
}
public override int OnSelectOption(IList<int> options)
......
......@@ -594,6 +594,7 @@ namespace WindBot.Game.AI.Decks
}
else
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Bot.HasInHand(CardId.Spinny) || FalcoToGY(false))
{
if (Bot.HasInHand(CardId.Spinny) && !Bot.HasInGraveyard(CardId.Spinny))
......@@ -779,10 +780,12 @@ namespace WindBot.Game.AI.Decks
public bool G_activate()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
return (Duel.Player == 1);
}
public bool Hand_act_eff()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
return (Duel.LastChainPlayer == 1);
}
......
......@@ -146,6 +146,7 @@ namespace WindBot.Game.AI.Decks
ShizukuSummoned = false;
HayateSummoned = false;
WidowAnchorTarget = null;
base.OnNewTurn();
}
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
......@@ -194,6 +195,7 @@ namespace WindBot.Game.AI.Decks
private bool MaxxCEffect()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
return Duel.Player == 1;
}
......@@ -667,6 +669,7 @@ namespace WindBot.Game.AI.Decks
private bool JetSynchronEffect()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Bot.HasInMonstersZone(CardId.Raye) || Bot.HasInMonstersZone(CardId.CrystronNeedlefiber))
{
AI.SelectCard(GetDiscardHand());
......
This diff is collapsed.
This diff is collapsed.
......@@ -182,8 +182,8 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.BaronnedeFleur, BaronnedeFleurEffect);
AddExecutor(ExecutorType.Activate, CardId.ElderEntityNtss, ElderEntityNtssEffect);
AddExecutor(ExecutorType.Activate, CardId.PredaplantDragostapelia, PredaplantDragostapeliaEffect);
AddExecutor(ExecutorType.Activate, CardId.HeraldofOrangeLight);
AddExecutor(ExecutorType.Activate, CardId.HeraldofGreenLight);
AddExecutor(ExecutorType.Activate, CardId.HeraldofOrangeLight, DefaultTrap);
AddExecutor(ExecutorType.Activate, CardId.HeraldofGreenLight, DefaultTrap);
AddExecutor(ExecutorType.Activate, CardId.TearlamentsRulkallos, TearlamentsRulkallosEffect);
AddExecutor(ExecutorType.Activate, CardId.FADawnDragster);
AddExecutor(ExecutorType.Activate, CardId.PrimevalPlanetPerlereino, PrimevalPlanetPerlereinoEffect);
......@@ -275,6 +275,7 @@ namespace WindBot.Game.AI.Decks
spsummoned = false;
summon_SprightElf = false;
TearlamentsKitkallos_summoned = false;
base.OnNewTurn();
}
private List<ClientCard> GetZoneCards(CardLocation loc, ClientField player)
{
......@@ -1704,7 +1705,7 @@ namespace WindBot.Game.AI.Decks
if (Duel.Turn == 1 || Enemy.GetMonsterCount() <= 0) return false;
List<ClientCard> e_cards = Enemy.GetMonsters().Where(card => card != null && card.IsFaceup() && card.IsAttack()).ToList();
List<ClientCard> b_cards = Bot.GetMonsters().Where(card => card != null && card.IsFaceup() && card.IsAttack()).ToList();
if ((e_cards.Count <= 0 || b_cards.Count <= 0) && Enemy.MonsterZone.GetDangerousMonster() == null) return false;
if (e_cards.Count <= 0 || b_cards.Count <= 0 || Enemy.MonsterZone.GetDangerousMonster() == null) return false;
e_cards.Sort(CardContainer.CompareCardAttack);
e_cards.Reverse();
b_cards.Sort(CardContainer.CompareCardAttack);
......@@ -2172,6 +2173,7 @@ namespace WindBot.Game.AI.Decks
}
private bool EvaEffect()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
List<ClientCard> cards = Bot.GetGraveyardMonsters().Where(card => card != null && card.HasAttribute(CardAttribute.Light) && card.HasRace(CardRace.Fairy) && card != Card).ToList();
if (cards.Count <= 0) return false;
activate_Eva = true;
......@@ -2207,6 +2209,7 @@ namespace WindBot.Game.AI.Decks
}
private bool MudoratheSwordOracleEffect()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Card.Location == CardLocation.Hand)
{
if ((Bot.Hand.Count(card => card != null && card.Id == CardId.AgidotheAncientSentinel) <= 0 || activate_AgidotheAncientSentinel_2)
......
......@@ -278,6 +278,8 @@ namespace WindBot.Game.AI.Decks
for (int i = 0; i < selectAtt.Count; i++)
selectAtt[i] = false;
base.OnNewTurn();
}
private bool IsAvailableZone(int seq)
{
......@@ -889,6 +891,7 @@ namespace WindBot.Game.AI.Decks
}
private bool AshBlossomEffect()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
return Duel.CurrentChain.Count > 0 && Duel.LastChainPlayer != 0;
}
public int CompareCardLink(ClientCard cardA, ClientCard cardB)
......@@ -1053,6 +1056,7 @@ namespace WindBot.Game.AI.Decks
}
private bool GEffect()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
return Duel.Player != 0;
}
private bool ThunderDragonColossusSummon_2()
......@@ -1101,6 +1105,7 @@ namespace WindBot.Game.AI.Decks
{
if (ActivateDescription == Util.GetStringId(CardId.PredaplantVerteAnaconda, 1))
{
if (DefaultCheckWhetherCardIsNegated(Card)) 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) && card.IsFaceup()) <= 0) return false;
List<ClientCard> g_card = Bot.Graveyard.ToList();
......@@ -1148,6 +1153,7 @@ namespace WindBot.Game.AI.Decks
}
private bool KnightmareUnicornEffect()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
List<ClientCard> cards = new List<ClientCard>();
cards.AddRange(Enemy.SpellZone);
cards.AddRange(Enemy.MonsterZone);
......@@ -1598,6 +1604,7 @@ namespace WindBot.Game.AI.Decks
{
if (Card.Location == CardLocation.Hand)
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
List<ClientCard> banish_cards = new List<ClientCard>();
List<ClientCard> grave_cards = new List<ClientCard>();
foreach (var card in Bot.Banished)
......@@ -1792,6 +1799,7 @@ namespace WindBot.Game.AI.Decks
{
if (Card.Location == CardLocation.Hand)
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (handActivated) return false;
handActivated = true;
activate_ThunderDragonroar = true;
......@@ -2035,6 +2043,7 @@ namespace WindBot.Game.AI.Decks
{
if (Card.Location == CardLocation.Hand)
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Duel.Player == 0)
{
if (IsShouldChainTunder())
......@@ -2243,6 +2252,7 @@ namespace WindBot.Game.AI.Decks
{
if (Card.Location == CardLocation.Hand)
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (HasInZoneNoActivate(CardId.BystialMagnamhut,CardLocation.Deck) && !Bot.HasInHand(CardId.BystialMagnamhut))
AI.SelectCard(CardId.BystialMagnamhut);
else if(HasInZoneNoActivate(CardId.BystialDruiswurm, CardLocation.Deck) && !Bot.HasInHand(CardId.BystialDruiswurm))
......@@ -2420,6 +2430,7 @@ namespace WindBot.Game.AI.Decks
{
if (Card.Location == CardLocation.Hand)
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Duel.Player == 0)
{
if (IsShouldChainTunder())
......@@ -2498,6 +2509,7 @@ namespace WindBot.Game.AI.Decks
}
private bool NormalThunderDragonEffect()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
handActivated = true;
ResetFlag();
selectFlag[(int)Select.NormalThunderDragon] = true;
......
......@@ -192,6 +192,7 @@ namespace WindBot.Game.AI.Decks
{
if (Card.Location == CardLocation.MonsterZone)
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
AI.SelectCard(Monsters.TimeThiefCronocorder);
AI.SelectCard(Monsters.TimeThiefWinder);
return true;
......@@ -370,6 +371,7 @@ namespace WindBot.Game.AI.Decks
}
private bool ThunderKingRaiOheff()
{
if (DefaultOnlyHorusSpSummoning()) return false;
if (Duel.SummoningCards.Count > 0)
{
foreach (ClientCard m in Duel.SummoningCards)
......
......@@ -231,6 +231,7 @@ namespace WindBot.Game.AI.Decks
}
else
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Bot.HasInHand(CardId.DupeFrog))
{
AI.SelectCard(
......@@ -267,6 +268,7 @@ namespace WindBot.Game.AI.Decks
private bool RonintoadinEffect()
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
}
......@@ -297,6 +299,7 @@ namespace WindBot.Game.AI.Decks
{
if (Duel.CurrentChain.Count > 0)
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
// negate effect, select a cost for it
List<ClientCard> monsters = Bot.GetMonsters();
IList<int> suitableCost = new[] {
......@@ -381,6 +384,7 @@ namespace WindBot.Game.AI.Decks
}
else if (Duel.Phase == DuelPhase.Standby)
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
SelectXYZDetach(Card.Overlays);
if (Duel.Player == 0)
{
......
This diff is collapsed.
This diff is collapsed.
......@@ -155,6 +155,7 @@ namespace WindBot.Game.AI.Decks
public override void OnNewTurn()
{
CardOfDemiseUsed = false;
base.OnNewTurn();
}
public override bool OnSelectYesNo(int desc)
......
This diff is collapsed.
......@@ -127,6 +127,7 @@ namespace WindBot.Game.AI.Decks
TigermortarSpsummoned = false;
ChakanineSpsummoned = false;
BroadbullSpsummoned = false;
base.OnNewTurn();
}
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
......@@ -150,6 +151,7 @@ namespace WindBot.Game.AI.Decks
{
if (Card.Location == CardLocation.Hand)
{
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (!(Duel.Phase == DuelPhase.BattleStep
|| Duel.Phase == DuelPhase.BattleStart
|| Duel.Phase == DuelPhase.Damage))
......@@ -429,8 +431,7 @@ namespace WindBot.Game.AI.Decks
{
if (Duel.Phase == DuelPhase.Main1 || Duel.Phase == DuelPhase.Main2)
return false;
if (Card.IsDisabled())
return false;
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
ClientCard target = null;
List<ClientCard> monsters = Bot.GetMonsters();
foreach (ClientCard monster in monsters)
......
This diff is collapsed.
......@@ -35,6 +35,10 @@ namespace WindBot.Game.AI
public string[] setmonster { get; set; }
[DataMember]
public string[] chaining { get; set; }
[DataMember]
public string[] surrender { get; set; }
[DataMember]
public string[] custom { get; set; }
}
public class Dialogs
{
......@@ -53,6 +57,8 @@ namespace WindBot.Game.AI
private string[] _summon;
private string[] _setmonster;
private string[] _chaining;
private string[] _surrender;
private string[] _custom;
public Dialogs(GameClient game)
{
......@@ -75,6 +81,8 @@ namespace WindBot.Game.AI
_summon = data.summon;
_setmonster = data.setmonster;
_chaining = data.chaining;
_surrender = data.surrender;
_custom = data.custom;
}
}
......@@ -158,10 +166,17 @@ namespace WindBot.Game.AI
InternalSendMessage(_chaining, card);
}
public void SendSurrender()
{
InternalSendMessage(_surrender);
}
private void InternalSendMessage(IList<string> array, params object[] opts)
{
if (!_game._chat)
return;
if (array == null || array.Count == 0)
return;
string message = string.Format(array[Program.Rand.Next(array.Count)], opts);
if (message != "")
_game.Chat(message);
......@@ -173,5 +188,14 @@ namespace WindBot.Game.AI
if (message != "")
_game.Chat(message);
}
public void SendCustomChat(int index, params object[] opts)
{
if (!_game._chat || _custom == null)
return;
string message = string.Format(_custom[index], opts);
if (message != "")
_game.Chat(message);
}
}
}
......@@ -24,30 +24,8 @@
ZushintheSleepingGiant = 67547370,
Heart_eartHDragon = 97403510,
DaigustoSphreeze = 29552709,
OhimetheManifestedMikanko = 81260679,
ArahimetheManifestedMikanko = 75771170,
YubelDasEwigLiebeWachter = 47172959
}
public enum ImmuneTrapMonster
{
幻龙重骑 = 120155022,
天帝龙树 = 120150011,
大连击龙 = 120210002,
超魔机神 = 120150002,
超魔机神2 = 120231005,
超魔辉兽 = 120217002,
超魔辉兽2 = 120239005,
超魔轨道 = 120239002,
灰霸炎神 = 120170015,
大恐龙驾 = 120151007,
终焰魔神 = 120231007,
焰魔神 = 120231011,
深渊杀戮者 = 120249023,
三日月之剑豪将军 = 120196033,
剑黎 = 120246080,
新种掠夺萝卜 = 120228035,
武枪 = 120231052,
苍救之幻影 = 120235041,
流星黑龙兽 = 120253047,
极乐鹰巨人 = 120227001,
鹰身三姐妹 = 120247002,
}
}
......@@ -71,6 +71,7 @@
ElShaddollConstruct = 20366274,
ElShaddollGrysra = 48424886,
ElShaddollWinda = 94977269,
HotRedDragonArchfiendAbyss = 9753964,
UltimateConductorTytanno = 18940556,
OvertexCoatls = 41782653,
FirePrison = 269510,
......@@ -199,6 +200,29 @@
BystialDisPater = 27572350,
DespianLuluwalilith = 53971455,
FirewallDragonSingularity = 21637210,
BrandedEtude = 45675980
BrandedEtude = 45675980,
EvolzarLars = 35103106,
AltergeistAdminia = 61470213,
EmperorCharlesTheGreat = 97864322,
YouReFinished = 88346805,
VolcanicEmperor = 46412900,
VolcanicInferno = 84138874,
RedZone = 50056656,
TGGlaiveBlaster = 95973569,
StellarNemesisTPHON_DoomsdayStar = 93039339,
SPLittleKnight = 29301450,
AngelRing = 40678060,
SkullGuardianProtectorOfTheVoicelessVoice = 10774240,
FloweringEtoileTheMelodiousMagnificat = 83793721,
EnlightenmentDragon = 46186135,
GoldPrideEradicator = 45464587,
VarudrasTheFinalBringerOfTheEndTimes = 70636044,
RagnaraikaStagSovereign = 42307760,
DrytronMeteonisAlphaDraconids = 56863746,
TheUnstoppableExodiaIncarnate = 83257450,
LightAndDarknessDragonLord = 19652159,
FiendsmithDiesIrae = 82135803,
MementomictlanTecuhtlicaCombinedConqueror = 14529511,
MadolcheQueenTiaraalaFraise = 49689480
}
}
......@@ -67,6 +67,7 @@
FaceCardFusion = 29062925,
MyutantFusion = 42577802,
MyutantCry = 31855260,
FallenOfAlbaz = 68468459,
GreaterPolymerization = 7614732,
UltimateFusion = 71143015,
BrandedFusion = 44362883,
......@@ -82,6 +83,11 @@
AmazonessSecretArts = 86758746,
DarkWorldAccession = 65956182,
BeetrooperLanding = 13234975,
FusionReproduction = 43331750
FusionReproduction = 43331750,
ChimeraFusion = 63136489,
HarmonicSynchroFusion = 7473735,
SouloftheSupremeCelestialKing = 76840111,
MelodiousConcerto = 31458630,
MementotlanFusion = 66518509
}
}
namespace WindBot.Game.AI.Enums
{
/// <summary>
/// Cards that are immune trap destroy.
/// </summary>
public enum ImmuneTrapMonster
{
幻龙重骑 = 120155022,
幻龙重骑2 = 120283151,
天帝龙树 = 120150011,
天帝龙树2 = 120260005,
大连击龙 = 120210002,
超魔机神 = 120150002,
超魔机神2 = 120231005,
超魔辉兽 = 120217002,
超魔辉兽2 = 120239005,
超魔轨道 = 120239002,
灰霸炎神 = 120170015,
大恐龙驾 = 120151006,
终焰魔神 = 120231007,
焰魔神 = 120231011,
深渊杀戮者 = 120249023,
三日月之剑豪将军 = 120196033,
剑黎 = 120246080,
新种掠夺萝卜 = 120228035,
武枪 = 120231052,
苍救之幻影 = 120235041,
流星黑龙兽 = 120253047,
极乐鹰巨人 = 120227001,
鹰身三姐妹 = 120247002,
火轰岚凰 = 120249016,
三角美人 = 120279001,
钢击龙F = 120217004,
彩光超 = 120217024,
穿越侍变星 = 120245002,
}
}
......@@ -27,7 +27,9 @@
NumberC96DarkStorm = 77205367,
Number54LionHeart = 54366836,
Number2NinjaShadowMosquito = 32453837,
OhimetheManifestedMikanko = 81260679
OhimetheManifestedMikanko = 81260679,
NightmareMagician = 40221691,
ArahimetheManifestedMikanko = 75771170
}
/// <summary>
/// Cards that are invincible to battle.
......@@ -101,6 +103,26 @@
BrigrandtheGloryDragon = 34848821,
AmazonessQueen = 15951532,
Number2NinjaShadowMosquito = 32453837,
OhimetheManifestedMikanko = 81260679
OhimetheManifestedMikanko = 81260679,
CornfieldCoatl = 92565383,
MirrorSwordknight = 28954097,
NightmareMagician = 40221691,
ArahimetheManifestedMikanko = 75771170,
UFOLight = 9275482,
TaotheGreatChanter = 34541543,
SpiritOfYubel = 90829280,
DarkGuardian = 26746975,
EnvoyOfTheWaxState = 87462901,
Fluffyfluff = 85401123,
YubelDasEwigLiebeWachter = 47172959,
TenpaiDragonFadra = 65326118,
GolgoilTheSteelSeismicSmasher = 59369430,
TalonsOfShurilane = 74150658,
NightmareApprentice = 58143852,
MillenniumoonMaiden = 37552929,
MillenniumFiendReflection = 63947968,
HereticalPhoboscobos = 76078185,
TopHatHareTheSilhouetteMagician = 1528054,
Silhouhatte = 24440742
}
}
namespace WindBot.Game.AI.Enums
{
public enum NotBeSynchroMaterialMonster
{
Ronintoadin = 1357146,
GagagaCaesar = 9583383,
VagueShadowToken = 9929399,
TourGuideFromtheUnderworld = 10802915,
PhotonToken = 17418745,
KagemuchaKnight = 19353570,
SharkStickers = 20838380,
GagagaMagician = 26082117,
RadianToken = 28674153,
Kurivolt = 40817915,
BlueMountainButterspy = 54582424,
Lightserpent = 55501446,
SaberShark = 63193879,
ConstellarKaus = 70908596,
CeremonialToken = 82340057,
HeroicChallenger_DoubleLance = 89774530,
SteelswarmScout = 90727556,
Kagetokage = 94656263,
YellowDuston = 16366810,
BlueDuston = 40217358,
Centerfrog = 47346782,
GreenDuston = 52182715,
RedDuston = 61019812,
EaterofMillions = 63845230,
PutridPuddingBodyBuddies = 85101097,
Click_Echo = 2992467
}
}
\ No newline at end of file
namespace WindBot.Game.AI.Enums
{
public enum NotBeXyzMaterialMonster
{
YellowDuston = 16366810,
BlueDuston = 40217358,
Centerfrog = 47346782,
GreenDuston = 52182715,
RedDuston = 61019812,
EaterofMillions = 63845230,
PutridPuddingBodyBuddies = 85101097,
Click_Echo = 2992467
}
}
\ No newline at end of file
......@@ -11,10 +11,6 @@
SamuraiDestroyer = 40509732,
ArmadesKeeperOfBoundaries = 88033975,
NumberS39UtopiaTheLightning = 56832966,
DualAvatarEmpoweredKonGyo = 33026283,
GGolemRockHammer = 98875863,
WishDragon = 64583600,
ChaosWitch = 30327674,
FissioningMotherSpider = 34034150
DualAvatarEmpoweredKonGyo = 33026283
}
}
......@@ -59,6 +59,14 @@
BrotherhoodoftheFireFist_Leopard = 39699564,
SpringansPedor = 56818977,
GizmekNaganakitheSunriseSignaler = 96399967,
MyutantMutant = 26561172
MyutantMutant = 26561172,
ThreeEyedGhost = 31464658,
UrsarcticPolarStar = 62714453,
BattlinBoxerPromoter = 83315222,
TGRocketSalamander = 77392987,
GGolemRockHammer = 98875863,
WishDragon = 64583600,
ChaosWitch = 30327674,
FissioningMotherSpider = 34034150
}
}
......@@ -16,6 +16,7 @@
BorreloadDragon = 31833038,
BorrelendDragon = 98630720,
DrytronMeteonisDraconids = 69815951,
MyutantBeast = 34695290
MyutantBeast = 34695290,
VeidosTheDragonOfEndlessDarkness = 8540986
}
}
......@@ -49,6 +49,8 @@
Blackwing_FullArmoredWing = 54082269,
DragunofRedEyes = 37818794,
RedEyesBDragon = 74677422, // sometimes the name of DragunofRedEyes will be changed to RedEyesBDragon
TheArrivalCyberseIgnister = 11738489
TheArrivalCyberseIgnister = 11738489,
MajespecterPorcupineYamaarashi = 51073802,
RaidraptorRisingRebellionFalcon = 71222868
}
}
......@@ -16,12 +16,10 @@ namespace WindBot.Game.AI
public GameAI AI { get; private set; }
public AIUtil Util { get; private set; }
protected MainPhase Main { get; private set; }
protected BattlePhase Battle { get; private set; }
protected ExecutorType Type { get; private set; }
protected ClientCard Card { get; private set; }
protected int ActivateDescription { get; private set; }
protected int CurrentTiming { get; private set; }
protected ClientField Bot { get; private set; }
protected ClientField Enemy { get; private set; }
......@@ -94,10 +92,21 @@ namespace WindBot.Game.AI
// For overriding
}
public virtual void OnChainSolved(int chainIndex)
{
// For overriding
}
public virtual void OnChainEnd()
{
// For overriding
}
public virtual void OnReceivingAnnouce(int player, int data)
{
// For overriding
}
public virtual void OnNewPhase()
{
// Some AI need do something on new phase
......@@ -112,6 +121,11 @@ namespace WindBot.Game.AI
// Some AI need do something on draw
}
public virtual void OnMove(ClientCard card, int previousControler, int previousLocation, int currentControler, int currentLocation)
{
// Some AI need do something on card's moving
}
public virtual IList<ClientCard> OnSelectCard(IList<ClientCard> cards, int min, int max, int hint, bool cancelable)
{
// For overriding
......@@ -147,11 +161,6 @@ namespace WindBot.Game.AI
// For overriding
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)
{
......@@ -170,6 +179,7 @@ namespace WindBot.Game.AI
// For overriding
return null;
}
public virtual void OnSelectChain(IList<ClientCard> cards)
{
return;
......@@ -224,24 +234,25 @@ namespace WindBot.Game.AI
return 0;
}
public void SetMain(MainPhase main)
{
Main = main;
}
public void SetBattle(BattlePhase battle)
/// <summary>
/// Called when card is successfully special summoned.
/// Used on monsters that can only special summoned once per turn.
/// </summary>
public virtual void OnSpSummoned()
{
Battle = battle;
// For overriding
return;
}
/// <summary>
/// Set global variables Type, Card, ActivateDescription for Executor
/// </summary>
public void SetCard(ExecutorType type, ClientCard card, int description)
public void SetCard(ExecutorType type, ClientCard card, int description, int timing = -1)
{
Type = type;
Card = card;
ActivateDescription = description;
CurrentTiming = timing;
}
/// <summary>
......
......@@ -11,6 +11,7 @@
SummonOrSet,
GoToBattlePhase,
GoToMainPhase2,
GoToEndPhase
GoToEndPhase,
Surrender
}
}
\ No newline at end of file
......@@ -57,6 +57,11 @@
ToZone = 571,
Counter = 572,
Disable = 573,
OperateCard = 574;
OperateCard = 574,
RITUAL = 1057,
FUSION = 1056,
SYNCHRO = 1063,
XYZ = 1073,
PENDULUM = 1074;
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using YGOSharp.OCGWrapper;
using YGOSharp.OCGWrapper.Enums;
namespace WindBot.Game
{
public class ChainInfo
{
public ClientCard RelatedCard { get; private set; }
public int ActivatePlayer { get; private set; }
public int ActivateId { get; private set; }
public int ActivateController { get; private set; }
public int ActivatePosition { get; private set; }
public int ActivateSequence { get; private set; }
public CardLocation ActivateLocation { get; private set; }
public int ActivateLevel { get; private set; }
public int ActivateRank { get; private set; }
public int ActivateType { get; private set; }
public int ActivateRace { get; private set; }
public int ActivateAttack { get; private set; }
public int ActivateDefense { get; private set; }
public bool IsSpecialSummoned { get; private set; }
public int ActivateDescription { get; private set; }
public ChainInfo(ClientCard card)
: this(card, card.Controller, 0)
{
}
public ChainInfo(ClientCard card, int player, int desc)
{
RelatedCard = card;
ActivatePlayer = player;
ActivateId = card.Id;
ActivateController = card.Controller;
ActivatePosition = card.Position;
ActivateSequence = card.Sequence;
ActivateLocation = card.Location;
ActivateLevel = card.Level;
ActivateRank = card.Rank;
ActivateType = card.Type;
ActivateRace = card.Race;
ActivateAttack = card.Attack;
ActivateDefense = card.Defense;
ActivateAttack = card.Attack;
ActivateDefense = card.Defense;
IsSpecialSummoned = card.IsSpecialSummoned;
ActivateDescription = desc;
}
public bool HasPosition(CardPosition position)
{
return (ActivatePosition & (int)position) != 0;
}
public bool HasLocation(CardLocation location)
{
return ((int)ActivateLocation & (int)location) != 0;
}
public bool IsCode(int id)
{
return RelatedCard != null && RelatedCard.IsCode(id);
}
public bool IsCode(IList<int> ids)
{
return RelatedCard != null && RelatedCard.IsCode(ids);
}
public bool IsCode(params int[] ids)
{
return RelatedCard != null && RelatedCard.IsCode(ids);
}
public bool HasType(CardType type)
{
return RelatedCard != null && (RelatedCard.Type & (int)type) != 0;
}
public bool IsSpell()
{
return HasType(CardType.Spell);
}
public bool IsTrap()
{
return HasType(CardType.Trap);
}
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("IceYGO")]
[assembly: AssemblyProduct("WindBot")]
[assembly: AssemblyCopyright("Copyright © IceYGO 2015-2017")]
[assembly: AssemblyCopyright("Copyright © IceYGO 2015-2025")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
......
This diff is collapsed.
This diff is collapsed.
......@@ -24,7 +24,7 @@ namespace WindBot
Host = "127.0.0.1";
Port = 7911;
HostInfo = "";
Version = 0x1354;
Version = 0x1362;
Hand = 0;
Debug = false;
Chat = true;
......
This diff is collapsed.
This diff is collapsed.
namespace YGOSharp.Network.Enums
{
public enum GameState
{
Lobby = 0,
Hand = 1,
Starting = 2,
Duel = 3,
End = 4,
Side = 5
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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