Commit a83c5e3a authored by nanahira's avatar nanahira

Merge branch 'master' of github.com:IceYGO/windbot

parents 61e96415 a75d41f0
......@@ -89,6 +89,36 @@ Name=尼亚 Deck=Altergeist Dialog=near.zh-CN
幻变骚灵卡组。
AI_LV3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020
!尼亚-拉比林斯迷宫
Name=尼亚 Deck=Labrynth Dialog=near.zh-CN
拉比林斯迷宫卡组。
AI_LV3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020
!复制梁龙-闪刀姬
Name=复制梁龙 Deck=SkyStriker Dialog=anothercopy.zh-CN
旧式闪刀姬卡组。
AI_LV3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020
!复制梁龙-自奏圣乐
Name=复制梁龙 Deck=Orcust Dialog=anothercopy.zh-CN
旧式自奏圣乐卡组。
AI_LV3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020
!复制梁龙-转生炎兽
Name=复制梁龙 Deck=Salamangreat Dialog=anothercopy.zh-CN
转生炎兽卡组。
AI_LV3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020
!VI-1911-凭依装着
Name=VI-1911 Deck=FamiliarPossessed Dialog=VI-1911.zh-CN
凭依装着卡组。
AI_ANTI_META SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020
!VI-1911-时劫者
Name=VI-1911 Deck=TimeThief Dialog=VI-1911.zh-CN
时间潜行者卡组。
AI_LV2 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020
!永远之魂-削血
Name=永远之魂 Deck=Burn Dialog=soul.zh-CN
老式削血卡组。
......@@ -244,6 +274,16 @@ Name=玻璃女巫 Deck=Exosister Dialog=verre.zh-CN
救祓少女卡组。
AI_LV3 SUPPORT_MASTER_RULE_3 SUPPORT_MASTER_RULE_2020
!艾克莉西娅-相剑
Name=艾克莉西娅 Deck=Swordsoul Dialog=ecclesia.zh-CN
相剑卡组。
AI_LV3 SUPPORT_MASTER_RULE_3 SUPPORT_MASTER_RULE_2020
!艾克莉西娅-教导
Name=艾克莉西娅 Deck=Dogmatika Dialog=ecclesia.zh-CN
教导卡组。
AI_LV3 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020
!神数不神-刹帝利
Name=神数不神 Deck=Kashtira Dialog=Zefra.zh-CN
俱舍怒威族卡组。
......@@ -258,3 +298,13 @@ SUPPORT_MASTER_RULE_2020
Name=神数不神 Deck=Tearlaments Dialog=Zefra.zh-CN
旧式地天使珠泪哀歌族卡组。
AI_LV3 SUPPORT_MASTER_RULE_2020
!神数不神-神数
Name=神数不神 Deck=Zefra Dialog=Zefra.zh-CN
神数卡组。
AI_LV3 SUPPORT_MASTER_RULE_2020
!今晚有宵夜吗-超重武者
Name=今晚有宵夜吗 Deck=SuperheavySamurai Dialog=superheavysamurai.zh-CN
超重武者卡组。
AI_LV3 SUPPORT_MASTER_RULE_2020
#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
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▽ ̄)╭"
]
}
{
"welcome": [
"这里就是大灵峰吗?",
"这里是教导龙国。"
],
"deckerror": [
"{0}被冰水咒缚了!"
],
"duelstart": [
"走了好久,肚子饿了……",
"前方会遇到怎样的同伴呢?",
"有阿不思在一起的话……"
],
"newturn": [
"我的回合!"
],
"endturn": [
"姐姐到底在哪里……",
"阿不思的干粮也吃完了啊。",
"什么时候开饭呢?"
],
"directattack": [
"{0},直接攻击!",
"开饭!"
],
"attack": [
"用{0}攻击{1}!"
],
"ondirectattack": [
"好饿……",
"呜呜……",
"姐姐……"
],
"facedownmonstername": "怪兽",
"activate": [
"发动{0}的效果!"
],
"summon": [
"{0}召唤!",
"出来吧,{0}!"
],
"setmonster": [
"……"
],
"chaining": [
"发动{0}的效果!",
"{0}!"
]
}
{
"welcome": [
"是宵夜哒哟!",
"什么灵摆卡组都会玩的哟!",
"什么?你说超重不是灵摆卡组?"
],
"deckerror": [
"{0}的数量不对!快去改成无禁限模式!。"
],
"duelstart": [
"给你展现一下超重的魅力!"
],
"newturn": [
"抽卡!弁庆你别上手救我了!",
"抽卡!P身子你别上手救我了!"
],
"endturn": [
"哼哼,到你的回合了!",
"喜不喜欢我的展开呢?"
],
"directattack": [
"我用{0}直接攻击!"
],
"attack": [
"我用{0}攻击{1}!"
],
"ondirectattack": [
"不许打!不许打呀!",
"呜哇!要被打倒惹~"
],
"facedownmonstername": "怪兽",
"activate": [
"呼呼呼,{0}的效果太厉害了!",
"呼呼呼,我使用{0}的效果。"
],
"summon": [
"呼呼呼,我召唤{0}!"
],
"setmonster": [
"呼呼呼,我盖放了一只怪兽。"
],
"chaining": [
"此刻!{0}的效果发动!"
]
}
......@@ -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)
......
......@@ -21,7 +21,8 @@ namespace WindBot.Game.AI
/// </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>
......@@ -78,5 +79,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
......@@ -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
{
......@@ -324,23 +325,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;
}
......@@ -2656,6 +2671,27 @@ namespace WindBot.Game.AI.Decks
attacked_Meluseek.Clear();
}
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()
{
if (Card.Attack == 0) return (Card.IsAttack());
......@@ -2797,7 +2833,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)
......
......@@ -146,7 +146,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)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -629,25 +629,42 @@ namespace WindBot.Game.AI.Decks
/// <param name="avoidList">Whether need to avoid set in this place</param>
public void SelectSTPlace(ClientCard card = null, bool avoidImpermanence = false, List<int> avoidList = null)
{
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 && avoidImpermanence && infiniteImpermanenceList.Contains(seq)) continue;
if (avoidList != null && avoidList.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 (avoidImpermanence && Bot.GetMonsters().Any(c => c.IsFaceup() && !c.IsDisabled()))
{
foreach (int seq in list)
{
ClientCard enemySpell = Enemy.SpellZone[4 - seq];
if (enemySpell != null && enemySpell.IsFacedown()) continue;
int zone = (int)System.Math.Pow(2, seq);
if (Bot.SpellZone[seq] == null)
AI.SelectPlace(zone);
return;
}
}
foreach (int seq in list)
{
if (card != null && card.Location == CardLocation.Hand && avoidImpermanence && infiniteImpermanenceList.Contains(seq)) continue;
if (avoidList != null && avoidList.Contains(seq)) continue;
int zone = (int)System.Math.Pow(2, seq);
AI.SelectPlace(zone);
return;
};
}
AI.SelectPlace(0);
}
......@@ -816,6 +833,7 @@ namespace WindBot.Game.AI.Decks
public override void OnNewTurn()
{
if (Duel.Turn <= 1) calledbytheGraveCount.Clear();
enemyActivateMaxxC = false;
enemyActivateLockBird = false;
infiniteImpermanenceList.Clear();
......@@ -1950,7 +1968,7 @@ namespace WindBot.Game.AI.Decks
}
// become target
if (DefaultOnBecomeTarget() || (Duel.CurrentChain.Any(c => c == Card) && Duel.LastChainPlayer != 0))
if ((DefaultOnBecomeTarget() && !Util.ChainContainsCard(_CardId.EvenlyMatched)) || (Duel.CurrentChain.Any(c => c == Card) && Duel.LastChainPlayer != 0))
{
targetedMagnificaList.Add(Card);
transformDestList.AddRange(new List<int>{CardId.ExosistersMagnifica, CardId.ExosisterMikailis, CardId.ExosisterGibrine, CardId.ExosisterKaspitell, CardId.ExosisterAsophiel});
......@@ -2025,7 +2043,7 @@ namespace WindBot.Game.AI.Decks
public bool ExosisterPaxActivate()
{
if (potActivate)
if (potActivate || Bot.LifePoints <= 800)
{
return false;
}
......@@ -2198,7 +2216,7 @@ namespace WindBot.Game.AI.Decks
public bool ExosisterPaxActivateForEndSearch()
{
if (potActivate)
if (potActivate || Bot.LifePoints <= 800)
{
return false;
}
......@@ -2230,6 +2248,10 @@ namespace WindBot.Game.AI.Decks
public bool ExosisterArmentActivate()
{
if (Bot.LifePoints <= 800)
{
return false;
}
ClientCard activateTarget = null;
if (Duel.Player == 0)
......@@ -2366,6 +2388,11 @@ namespace WindBot.Game.AI.Decks
public bool ExosisterVadisActivate()
{
if (Bot.LifePoints <= 800)
{
return false;
}
List<int> checkListForSpSummon = new List<int>{
CardId.ExosisterSophia, CardId.ExosisterIrene, CardId.ExosisterStella, CardId.ExosisterMartha, CardId.ExosisterElis
};
......@@ -2435,6 +2462,11 @@ namespace WindBot.Game.AI.Decks
public bool ExosisterReturniaActivate()
{
if (Bot.LifePoints <= 800)
{
return false;
}
// banish problem card
ClientCard target = GetProblematicEnemyCard(true);
if (target != null && Duel.LastChainPlayer != 0)
......@@ -2463,7 +2495,7 @@ namespace WindBot.Game.AI.Decks
// dump banish
target = GetBestEnemyCard(false, true, true);
bool check1 = DefaultOnBecomeTarget() && target.Id != _CardId.EvenlyMatched;
bool check1 = DefaultOnBecomeTarget() && target != null && (target.Location != CardLocation.Onfield || target.Id != _CardId.EvenlyMatched);
bool check2 = Bot.UnderAttack;
bool check3 = (Duel.Player == 1 && Duel.Phase == DuelPhase.End && Duel.LastChainPlayer != 0 && target != null && target.Location != CardLocation.Grave);
bool check4 = (Duel.Player == 1 && Enemy.GetMonsterCount() >= 2 && Duel.LastChainPlayer != 0);
......
This diff is collapsed.
This diff is collapsed.
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
{
......@@ -67,6 +68,7 @@ namespace WindBot.Game.AI.Decks
return 1;
}
List<int> Impermanence_list = new List<int>();
bool NormalSummoned = false;
ClientCard stage_locked = null;
bool pink_ss = false;
......@@ -190,21 +192,39 @@ namespace WindBot.Game.AI.Decks
return false;
}
public int SelectSTPlace()
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)
{
ClientCard enemySpell = Enemy.SpellZone[4 - seq];
if (enemySpell != null && enemySpell.IsFacedown()) continue;
return (int)System.Math.Pow(2, seq);
}
}
foreach(int seq in list)
foreach (int seq in list)
{
int zone = (int)System.Math.Pow(2, seq);
if (Bot.SpellZone[seq] == null) return zone;
return (int)System.Math.Pow(2, seq);
}
return 0;
}
......@@ -505,7 +525,7 @@ namespace WindBot.Game.AI.Decks
if (selected == null)
return false;
AI.SelectCard(selected);
AI.SelectPlace(SelectSTPlace());
AI.SelectPlace(SelectSTPlace(Card, true));
return true;
}
......@@ -526,13 +546,13 @@ namespace WindBot.Game.AI.Decks
if (self_card.IsCode(CardId.Galaxy))
return false;
}
AI.SelectPlace(SelectSTPlace());
AI.SelectPlace(SelectSTPlace(Card, true));
return true;
}
// activate when more than 2 cards
if (Enemy.GetSpellCount() <= 1)
return false;
AI.SelectPlace(SelectSTPlace());
AI.SelectPlace(SelectSTPlace(Card, true));
return true;
}
......@@ -627,7 +647,7 @@ namespace WindBot.Game.AI.Decks
if (!spell_trap_activate()) return false;
if (Bot.Deck.Count > 15)
{
AI.SelectPlace(SelectSTPlace());
AI.SelectPlace(SelectSTPlace(Card, true));
return true;
}
return false;
......@@ -1003,7 +1023,7 @@ namespace WindBot.Game.AI.Decks
if (!spell_trap_activate()) return false;
if (Duel.Phase <= DuelPhase.Main1 && Ts_reborn())
{
AI.SelectPlace(SelectSTPlace());
AI.SelectPlace(SelectSTPlace(Card, true));
return true;
}
return false;
......@@ -1634,14 +1654,14 @@ namespace WindBot.Game.AI.Decks
{
if (enemy.IsMonsterDangerous())
{
AI.SelectPlace(SelectSTPlace());
AI.SelectPlace(SelectSTPlace(Card, true));
return true;
}
if (enemy.IsFaceup() && (enemy.GetDefensePower() > bestenemy)) bestenemy = enemy.GetDefensePower();
}
if (bestPower <= bestenemy)
{
AI.SelectPlace(SelectSTPlace());
AI.SelectPlace(SelectSTPlace(Card, true));
return true;
}
}
......@@ -1697,6 +1717,11 @@ namespace WindBot.Game.AI.Decks
public override void OnNewTurn()
{
if (Duel.Turn <= 1)
{
GraveCall_count = 0;
GraveCall_id = 0;
}
NormalSummoned = false;
stage_locked = null;
pink_ss = false;
......@@ -1705,6 +1730,7 @@ namespace WindBot.Game.AI.Decks
white_eff_used = false;
lockbird_useful = false;
lockbird_used = false;
Impermanence_list.Clear();
if (GraveCall_count > 0)
{
if (--GraveCall_count <= 0)
......@@ -1714,6 +1740,27 @@ namespace WindBot.Game.AI.Decks
}
}
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 override BattlePhaseAction OnSelectAttackTarget(ClientCard attacker, IList<ClientCard> defenders)
{
ClientCard lowestattack = null;
......
......@@ -269,6 +269,7 @@ namespace WindBot.Game.AI.Decks
// new turn reset
public override void OnNewTurn()
{
if (Duel.Turn <= 1) CalledbytheGraveCount.Clear();
CrossoutDesignatorTarget = 0;
MadameVerreGainedATK = false;
summoned = false;
......@@ -858,27 +859,44 @@ namespace WindBot.Game.AI.Decks
/// <param name="card">Card to set(default current card)</param>
/// <param name="avoid_Impermanence">Whether need to avoid InfiniteImpermanence</param>
/// <param name="avoid_list">Whether need to avoid set in this place</param>
public void SelectSTPlace(ClientCard card = null, bool avoid_Impermanence = false, List<int> avoid_list=null)
public void SelectSTPlace(ClientCard card = null, bool avoid_Impermanence = false, List<int> avoid_list = null)
{
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;
if (avoid_list != null && avoid_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)
{
ClientCard enemySpell = Enemy.SpellZone[4 - seq];
if (enemySpell != null && enemySpell.IsFacedown()) continue;
int zone = (int)System.Math.Pow(2, seq);
if (Bot.SpellZone[seq] == null)
AI.SelectPlace(zone);
return;
}
}
foreach (int seq in list)
{
if (card != null && card.Location == CardLocation.Hand && avoid_Impermanence && Impermanence_list.Contains(seq)) continue;
if (avoid_list != null && avoid_list.Contains(seq)) continue;
int zone = (int)System.Math.Pow(2, seq);
AI.SelectPlace(zone);
return;
};
}
AI.SelectPlace(0);
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -35,6 +35,8 @@ namespace WindBot.Game.AI
public string[] setmonster { get; set; }
[DataMember]
public string[] chaining { get; set; }
[DataMember]
public string[] custom { get; set; }
}
public class Dialogs
{
......@@ -53,6 +55,7 @@ namespace WindBot.Game.AI
private string[] _summon;
private string[] _setmonster;
private string[] _chaining;
private string[] _custom;
public Dialogs(GameClient game)
{
......@@ -75,6 +78,7 @@ namespace WindBot.Game.AI
_summon = data.summon;
_setmonster = data.setmonster;
_chaining = data.chaining;
_custom = data.custom;
}
}
......@@ -176,5 +180,14 @@ namespace WindBot.Game.AI
Logger.WriteLine("Error: " + 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,5 +24,8 @@
ZushintheSleepingGiant = 67547370,
Heart_eartHDragon = 97403510,
DaigustoSphreeze = 29552709,
OhimetheManifestedMikanko = 81260679,
ArahimetheManifestedMikanko = 75771170,
YubelDasEwigLiebeWächter = 47172959
}
}
......@@ -71,6 +71,7 @@
ElShaddollConstruct = 20366274,
ElShaddollGrysra = 48424886,
ElShaddollWinda = 94977269,
HotRedDragonArchfiendAbyss = 9753964,
UltimateConductorTytanno = 18940556,
OvertexCoatls = 41782653,
FirePrison = 269510,
......@@ -199,6 +200,18 @@
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,
SkullGuardianTheSilenforcingProtector = 10774240
}
}
......@@ -67,6 +67,7 @@
FaceCardFusion = 29062925,
MyutantFusion = 42577802,
MyutantCry = 31855260,
FallenOfAlbaz = 68468459,
GreaterPolymerization = 7614732,
UltimateFusion = 71143015,
BrandedFusion = 44362883,
......@@ -82,6 +83,9 @@
AmazonessSecretArts = 86758746,
DarkWorldAccession = 65956182,
BeetrooperLanding = 13234975,
FusionReproduction = 43331750
FusionReproduction = 43331750,
ChimeraFusion = 63136489,
HarmonicSynchroFusion = 7473735,
SouloftheSupremeCelestialKing = 76840111
}
}
......@@ -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,17 @@
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,
YubelDasEwigLiebeWächter = 47172959
}
}
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
......@@ -59,6 +59,10 @@
BrotherhoodoftheFireFist_Leopard = 39699564,
SpringansPedor = 56818977,
GizmekNaganakitheSunriseSignaler = 96399967,
MyutantMutant = 26561172
MyutantMutant = 26561172,
ThreeEyedGhost = 31464658,
UrsarcticPolarStar = 62714453,
BattlinBoxerPromoter = 83315222,
TGRocketSalamander = 77392987
}
}
......@@ -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
}
}
......@@ -22,6 +22,7 @@ namespace WindBot.Game.AI
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 +95,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 +124,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
......@@ -165,6 +182,7 @@ namespace WindBot.Game.AI
// For overriding
return null;
}
public virtual void OnSelectChain(IList<ClientCard> cards)
{
return;
......@@ -232,11 +250,12 @@ namespace WindBot.Game.AI
/// <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>
......
......@@ -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
......@@ -82,6 +82,9 @@ namespace WindBot.Game
Name = Data.Name;
if (Data.Alias != 0)
Alias = Data.Alias;
} else {
Name = null;
Alias = 0;
}
}
......
using System.Collections.Generic;
using System.Collections.Generic;
using YGOSharp.OCGWrapper.Enums;
namespace WindBot.Game
......@@ -26,6 +26,8 @@ namespace WindBot.Game
public int LastSummonPlayer { get; set; }
public IList<ClientCard> SummoningCards { get; set; }
public IList<ClientCard> LastSummonedCards { get; set; }
public int SolvingChainIndex { get; set; }
public IList<int> NegatedChainIndexList { get; set; }
public Duel()
{
......@@ -41,6 +43,8 @@ namespace WindBot.Game
LastSummonPlayer = -1;
SummoningCards = new List<ClientCard>();
LastSummonedCards = new List<ClientCard>();
SolvingChainIndex = 0;
NegatedChainIndexList = new List<int>();
}
public ClientCard GetCard(int player, CardLocation loc, int seq)
......@@ -169,5 +173,16 @@ namespace WindBot.Game
{
return IsFirst ? player : 1 - player;
}
public ClientCard GetCurrentSolvingChainCard()
{
if (SolvingChainIndex == 0 || SolvingChainIndex > CurrentChain.Count) return null;
return CurrentChain[SolvingChainIndex - 1];
}
public bool IsCurrentSolvingChainNegated()
{
return SolvingChainIndex > 0 && NegatedChainIndexList.Contains(SolvingChainIndex);
}
}
}
\ No newline at end of file
......@@ -54,6 +54,14 @@ namespace WindBot.Game
_dialogs.SendDuelStart();
}
/// <summary>
/// Customized called when the AI do something in a duel.
/// </summary>
public void SendCustomChat(int index, params object[] opts)
{
_dialogs.SendCustomChat(index, opts);
}
/// <summary>
/// Called when the AI do the rock-paper-scissors.
/// </summary>
......@@ -111,6 +119,11 @@ namespace WindBot.Game
Executor.OnNewPhase();
}
public void OnMove(ClientCard card, int previousControler, int previousLocation, int currentControler, int currentLocation)
{
Executor.OnMove(card, previousControler, previousLocation, currentControler, currentLocation);
}
/// <summary>
/// Called when the AI got attack directly.
/// </summary>
......@@ -129,6 +142,11 @@ namespace WindBot.Game
Executor.OnChaining(player,card);
}
public void OnChainSolved(int chainIndex)
{
Executor.OnChainSolved(chainIndex);
}
/// <summary>
/// Called when a chain has been solved.
/// </summary>
......@@ -139,6 +157,16 @@ namespace WindBot.Game
Executor.OnChainEnd();
}
/// <summary>
/// Called when receiving annouce
/// </summary>
/// <param name="player">Player who announce.</param>
/// <param name="data">Annouced info.</param>
public void OnReceivingAnnouce(int player, int data)
{
Executor.OnReceivingAnnouce(player, data);
}
/// <summary>
/// Called when the AI has to do something during the battle phase.
/// </summary>
......@@ -287,6 +315,8 @@ namespace WindBot.Game
// Always select the first available cards and choose the minimum.
IList<ClientCard> selected = new List<ClientCard>();
if (hint == HintMsg.AttackTarget && cancelable) return selected;
if (cards.Count >= min)
{
for (int i = 0; i < min; ++i)
......@@ -301,8 +331,9 @@ namespace WindBot.Game
/// <param name="cards">List of activable cards.</param>
/// <param name="descs">List of effect descriptions.</param>
/// <param name="forced">You can't return -1 if this param is true.</param>
/// <param name="timing">Current hint timing</param>
/// <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, int timing = -1)
{
Executor.OnSelectChain(cards);
foreach (CardExecutor exec in Executor.Executors)
......@@ -310,7 +341,7 @@ namespace WindBot.Game
for (int i = 0; i < cards.Count; ++i)
{
ClientCard card = cards[i];
if (ShouldExecute(exec, card, ExecutorType.Activate, descs[i]))
if (ShouldExecute(exec, card, ExecutorType.Activate, descs[i], timing))
{
_dialogs.SendChaining(card.Name);
return i;
......@@ -1113,7 +1144,7 @@ namespace WindBot.Game
return new BattlePhaseAction(BattlePhaseAction.BattleAction.ToMainPhaseTwo);
}
private bool ShouldExecute(CardExecutor exec, ClientCard card, ExecutorType type, int desc = -1)
private bool ShouldExecute(CardExecutor exec, ClientCard card, ExecutorType type, int desc = -1, int timing = -1)
{
if (card.Id != 0 && type == ExecutorType.Activate)
{
......@@ -1122,7 +1153,7 @@ namespace WindBot.Game
if (!Executor.OnPreActivate(card))
return false;
}
Executor.SetCard(type, card, desc);
Executor.SetCard(type, card, desc, timing);
bool result = card != null && exec.Type == type &&
(exec.CardId == -1 || exec.CardId == card.Id) &&
(exec.Func == null || exec.Func());
......
......@@ -121,6 +121,10 @@ namespace WindBot.Game
_messages.Add(GameMessage.AttackDisabled, OnAttackDisabled);
_messages.Add(GameMessage.PosChange, OnPosChange);
_messages.Add(GameMessage.Chaining, OnChaining);
_messages.Add(GameMessage.ChainSolving, OnChainSolving);
_messages.Add(GameMessage.ChainNegated, OnChainNegated);
_messages.Add(GameMessage.ChainDisabled, OnChainDisabled);
_messages.Add(GameMessage.ChainSolved, OnChainSolved);
_messages.Add(GameMessage.ChainEnd, OnChainEnd);
_messages.Add(GameMessage.SortCard, OnCardSorting);
_messages.Add(GameMessage.SortChain, OnChainSorting);
......@@ -156,6 +160,7 @@ namespace WindBot.Game
_messages.Add(GameMessage.SpSummoned, OnSpSummoned);
_messages.Add(GameMessage.FlipSummoning, OnSummoning);
_messages.Add(GameMessage.FlipSummoned, OnSummoned);
_messages.Add(GameMessage.ConfirmCards, OnConfirmCards);
}
private BinaryWriter buildUpdateDeck(Deck targetDeck) {
......@@ -389,6 +394,10 @@ namespace WindBot.Game
{
_select_hint = data;
}
if (type == 4) // HINT_OPSELECTED
{
_ai.OnReceivingAnnouce(player, data);
}
}
private void OnStart(BinaryReader packet)
......@@ -396,6 +405,11 @@ namespace WindBot.Game
int type = packet.ReadByte();
_duel.IsFirst = (type & 0xF) == 0;
_duel.Turn = 0;
_duel.LastChainLocation = 0;
_duel.LastChainPlayer = -1;
_duel.LastChainTargets.Clear();
_duel.LastSummonedCards.Clear();
_duel.LastSummonPlayer = -1;
int duel_rule = packet.ReadByte();
_ai.Duel.IsNewRule = (duel_rule >= 4);
_ai.Duel.IsNewRule2020 = (duel_rule >= 5);
......@@ -408,6 +422,19 @@ namespace WindBot.Game
extra = packet.ReadInt16();
_duel.Fields[GetLocalPlayer(1)].Init(deck, extra);
// in case of ending duel in chain's solving
_duel.LastChainPlayer = -1;
_duel.LastChainLocation = 0;
_duel.CurrentChain.Clear();
_duel.ChainTargets.Clear();
_duel.LastChainTargets.Clear();
_duel.ChainTargetOnly.Clear();
_duel.LastSummonPlayer = -1;
_duel.SummoningCards.Clear();
_duel.LastSummonedCards.Clear();
_duel.SolvingChainIndex = 0;
_duel.NegatedChainIndexList.Clear();
Logger.WriteLine("Duel started: " + _room.Names[0] + " versus " + _room.Names[1]);
_ai.OnStart();
}
......@@ -683,6 +710,8 @@ namespace WindBot.Game
(CardLocation)previousLocation + " move to " + (CardLocation)currentLocation + ")");
}
}
_ai.OnMove(card, previousControler, previousLocation, currentControler, currentLocation);
}
private void OnSwap(BinaryReader packet)
......@@ -788,6 +817,30 @@ namespace WindBot.Game
}
private void OnChainSolving(BinaryReader packet)
{
int chainIndex = packet.ReadByte();
_duel.SolvingChainIndex = chainIndex;
}
private void OnChainNegated(BinaryReader packet)
{
int chainIndex = packet.ReadByte();
_duel.NegatedChainIndexList.Add(chainIndex);
}
private void OnChainDisabled(BinaryReader packet)
{
int chainIndex = packet.ReadByte();
_duel.NegatedChainIndexList.Add(chainIndex);
}
private void OnChainSolved(BinaryReader packet)
{
int chainIndex = packet.ReadByte();
_ai.OnChainSolved(chainIndex);
}
private void OnChainEnd(BinaryReader packet)
{
_ai.OnChainEnd();
......@@ -797,6 +850,8 @@ namespace WindBot.Game
_duel.ChainTargets.Clear();
_duel.LastChainTargets.Clear();
_duel.ChainTargetOnly.Clear();
_duel.SolvingChainIndex = 0;
_duel.NegatedChainIndexList.Clear();
}
private void OnCardSorting(BinaryReader packet)
......@@ -1004,7 +1059,10 @@ namespace WindBot.Game
if (((int)loc & (int)CardLocation.Overlay) != 0)
card = new ClientCard(id, CardLocation.Overlay, -1);
else
{
card = _duel.GetCard(player, loc, seq);
card.Controller = player;
}
if (card == null) continue;
if (card.Id == 0)
card.SetId(id);
......@@ -1126,8 +1184,8 @@ namespace WindBot.Game
int count = packet.ReadByte();
packet.ReadByte(); // specount
bool forced = packet.ReadByte() != 0;
packet.ReadInt32(); // hint1
packet.ReadInt32(); // hint2
int hint1 = packet.ReadInt32(); // hint1
int hint2 = packet.ReadInt32(); // hint2
IList<ClientCard> cards = new List<ClientCard>();
IList<int> descs = new List<int>();
......@@ -1167,7 +1225,7 @@ namespace WindBot.Game
return;
}
Connection.Send(CtosMessage.Response, _ai.OnSelectChain(cards, descs, forced));
Connection.Send(CtosMessage.Response, _ai.OnSelectChain(cards, descs, forced, hint1 | hint2));
}
private void OnSelectCounter(BinaryReader packet)
......@@ -1804,7 +1862,7 @@ namespace WindBot.Game
int count = packet.ReadByte();
int available = packet.ReadInt32();
int filter = 0x1;
for (int i = 0; i < 23; ++i)
for (int i = 0; i < 26; ++i)
{
if ((available & filter) != 0)
races.Add((CardRace)filter);
......@@ -1940,5 +1998,22 @@ namespace WindBot.Game
}
_duel.SummoningCards.Clear();
}
private void OnConfirmCards(BinaryReader packet)
{
/*int playerid = */packet.ReadByte();
int count = packet.ReadByte();
for (int i = 0; i < count; ++ i)
{
int cardId = packet.ReadInt32();
int player = GetLocalPlayer(packet.ReadByte());
int loc = packet.ReadByte();
int seq = packet.ReadByte();
ClientCard card = _duel.GetCard(player, (CardLocation)loc, seq);
if (cardId > 0) card.SetId(cardId);
if (_debug)
Logger.WriteLine("(Confirm " + player.ToString() + "'s " + (CardLocation)loc + " card: " + (card.Name ?? "UnKnowCard") + ")");
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
......@@ -83,6 +83,7 @@
<Compile Include="Game\AI\Decks\SalamangreatExecutor.cs" />
<Compile Include="Game\AI\Decks\CyberDragonExecutor.cs" />
<Compile Include="Game\AI\Decks\DarkMagicianExecutor.cs" />
<Compile Include="Game\AI\Decks\DogmatikaExecutor.cs" />
<Compile Include="Game\AI\Decks\OrcustExecutor.cs" />
<Compile Include="Game\AI\Decks\SkyStrikerExecutor.cs" />
<Compile Include="Game\AI\Decks\MokeyMokeyKingExecutor.cs" />
......@@ -102,10 +103,13 @@
<Compile Include="Game\AI\Decks\GraydleExecutor.cs" />
<Compile Include="Game\AI\Decks\GrenMajuThunderBoarderExecutor.cs" />
<Compile Include="Game\AI\Decks\LightswornExecutor.cs" />
<Compile Include="Game\AI\Decks\LabrynthExecutor.cs" />
<Compile Include="Game\AI\Decks\LightswornShaddoldinosourExecutor.cs" />
<Compile Include="Game\AI\Decks\PhantasmExecutor.cs" />
<Compile Include="Game\AI\Decks\QliphortExecutor.cs" />
<Compile Include="Game\AI\Decks\ST1732Executor.cs" />
<Compile Include="Game\AI\Decks\SuperheavySamuraiExecutor.cs" />
<Compile Include="Game\AI\Decks\SwordsoulExecutor.cs" />
<Compile Include="Game\AI\Decks\TrickstarExecutor.cs" />
<Compile Include="Game\AI\Decks\WitchcraftExecutor.cs" />
<Compile Include="Game\AI\Decks\YosenjuExecutor.cs" />
......@@ -115,12 +119,15 @@
<Compile Include="Game\AI\Decks\DoEveryThingExecutor.cs" />
<Compile Include="Game\AI\Decks\OldSchoolExecutor.cs" />
<Compile Include="Game\AI\Decks\Rank5Executor.cs" />
<Compile Include="Game\AI\Decks\ZefraExecutor.cs" />
<Compile Include="Game\AI\Decks\ZoodiacExecutor.cs" />
<Compile Include="Game\AI\Decks\ZexalWeaponsExecutor.cs" />
<Compile Include="Game\AI\DefaultExecutor.cs" />
<Compile Include="Game\AI\Dialogs.cs" />
<Compile Include="Game\AI\Enums\DangerousMonster.cs" />
<Compile Include="Game\AI\Enums\FusionSpell.cs" />
<Compile Include="Game\AI\Enums\NotBeSynchroMaterialMonster.cs" />
<Compile Include="Game\AI\Enums\NotBeXyzMaterialMonster.cs" />
<Compile Include="Game\AI\Enums\ShouldBeDisabledBeforeItUseEffectMonster.cs" />
<Compile Include="Game\AI\Enums\ShouldNotBeSpellTarget.cs" />
<Compile Include="Game\AI\Enums\ShouldNotBeMonsterTarget.cs" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment