Commit 0974c33d authored by mercury233's avatar mercury233
parents 124f7da2 e85abe26
#created by ... #created by ...
#main #main
75498415 75498415
75498415 75498415
75498415 75498415
81105204 81105204
81105204 81105204
81105204 81105204
58820853 58820853
58820853 58820853
58820853 58820853
49003716 49003716
49003716 49003716
49003716 49003716
85215458 85215458
85215458 85215458
85215458 85215458
2009101 2009101
2009101 2009101
2009101 2009101
22835145 22835145
22835145 22835145
22835145 22835145
46710683 46710683
46710683 46710683
46710683 46710683
53129443 53129443
5318639 5318639
5318639 5318639
5318639 5318639
91351370 91351370
91351370 91351370
91351370 91351370
44095762 44095762
44095762 44095762
44095762 44095762
59839761 59839761
59839761 59839761
59839761 59839761
70342110 70342110
70342110 70342110
70342110 70342110
#extra #extra
33236860 33236860
33236860 33236860
33236860 33236860
9012916 9012916
9012916 9012916
9012916 9012916
69031175 69031175
69031175 69031175
69031175 69031175
76913983 76913983
76913983 76913983
76913983 76913983
17377751 17377751
17377751 17377751
17377751 17377751
!side !side
#created by ... #created by ...
#main #main
89631139 89631139
89631139 89631139
89631139 89631139
38517737 38517737
38517737 38517737
38517737 38517737
45467446 45467446
45467446 45467446
71039903 71039903
71039903 71039903
71039903 71039903
79814787 79814787
79814787 79814787
8240199 8240199
8240199 8240199
8240199 8240199
5133471 5133471
5133471 5133471
6853254 6853254
6853254 6853254
6853254 6853254
18144506 18144506
35261759 35261759
35261759 35261759
38120068 38120068
38120068 38120068
38120068 38120068
39701395 39701395
39701395 39701395
39701395 39701395
41620959 41620959
41620959 41620959
48800175 48800175
48800175 48800175
48800175 48800175
54447022 54447022
83764718 83764718
87025064 87025064
87025064 87025064
87025064 87025064
#extra #extra
63422098 63422098
40908371 40908371
40908371 40908371
40908371 40908371
59822133 59822133
59822133 59822133
59822133 59822133
58820923 58820923
2530830 2530830
39030163 39030163
31801517 31801517
18963306 18963306
63767246 63767246
63767246 63767246
33909817 33909817
!side !side
#created by ... #created by ...
#main #main
4162088 4162088
68774379 68774379
70095154 70095154
70095154 70095154
70095154 70095154
59281922 59281922
59281922 59281922
59281922 59281922
3370104 3370104
67159705 67159705
26439287 26439287
26439287 26439287
26439287 26439287
76986005 76986005
23893227 23893227
23893227 23893227
23893227 23893227
3657444 3657444
11961740 11961740
11961740 11961740
24094653 24094653
24094653 24094653
37630732 37630732
37630732 37630732
37630732 37630732
52875873 52875873
52875873 52875873
53129443 53129443
66607691 66607691
95286165 95286165
29401950 29401950
29401950 29401950
44095762 44095762
44095762 44095762
91989718 91989718
92773018 92773018
92773018 92773018
97077563 97077563
97077563 97077563
3819470 3819470
#extra #extra
1546123 1546123
1546123 1546123
1546123 1546123
74157028 74157028
74157028 74157028
74157028 74157028
10443957 10443957
10443957 10443957
10443957 10443957
58069384 58069384
58069384 58069384
58069384 58069384
!side !side
#created by ... #created by ...
#main #main
77542832 77542832
77542832 77542832
77542832 77542832
40921545 40921545
79785958 79785958
79785958 79785958
79785958 79785958
59546797 59546797
59546797 59546797
72429240 72429240
4756629 4756629
4756629 4756629
4756629 4756629
8814959 8814959
8814959 8814959
8814959 8814959
85138716 85138716
85138716 85138716
85138716 85138716
23434538 23434538
23434538 23434538
911883 911883
1475311 1475311
1475311 1475311
18144506 18144506
32807846 32807846
8267140 8267140
27541267 27541267
27541267 27541267
26708437 26708437
26708437 26708437
5851097 5851097
35419032 35419032
58921041 58921041
58921041 58921041
40605147 40605147
40605147 40605147
40605147 40605147
41420027 41420027
84749824 84749824
#extra #extra
88754763 88754763
9272381 9272381
56832966 56832966
86532744 86532744
36757171 36757171
93568288 93568288
21044178 21044178
91279700 91279700
46772449 46772449
82633039 82633039
84013237 84013237
76067258 76067258
359563 359563
91279700 91279700
91279700 91279700
!side !side
8233522 8233522
8233522 8233522
5318639 5318639
8267140 8267140
12923641 12923641
12923641 12923641
12923641 12923641
18161786 18161786
18161786 18161786
11109820 11109820
11109820 11109820
11109820 11109820
94192409 94192409
94192409 94192409
58921041 58921041
#created by ... #created by ...
#main #main
25524823 25524823
36521459 36521459
3825890 3825890
62473983 62473983
17393207 17393207
17393207 17393207
17393207 17393207
25262697 25262697
30213599 30213599
30213599 30213599
30213599 30213599
24317029 24317029
24317029 24317029
24317029 24317029
93023479 93023479
93023479 93023479
93023479 93023479
72405967 72405967
72405967 72405967
5318639 5318639
5318639 5318639
5318639 5318639
14087893 14087893
14087893 14087893
70000776 70000776
70000776 70000776
47355498 47355498
47355498 47355498
47355498 47355498
29401950 29401950
29401950 29401950
30450531 30450531
30450531 30450531
53582587 53582587
53582587 53582587
70342110 70342110
70342110 70342110
84749824 84749824
90434657 90434657
90434657 90434657
#extra #extra
44508094 44508094
!side !side
#created by ... #created by ...
#main #main
20056760 20056760
20056760 20056760
20056760 20056760
29834183 29834183
29834183 29834183
29834183 29834183
93445074 93445074
93445074 93445074
93445074 93445074
66451379 66451379
66451379 66451379
66451379 66451379
23434538 23434538
23434538 23434538
23434538 23434538
97268402 97268402
97268402 97268402
97268402 97268402
18144507 18144507
33057951 33057951
33057951 33057951
33057951 33057951
53129443 53129443
83764718 83764718
98645731 98645731
98645731 98645731
98645731 98645731
2759860 2759860
2759860 2759860
2759860 2759860
58120309 58120309
75361204 75361204
75361204 75361204
49966595 49966595
49966595 49966595
49966595 49966595
82732705 82732705
82732705 82732705
82732705 82732705
41420027 41420027
#extra #extra
52687916 52687916
80666118 80666118
39765958 39765958
52145422 52145422
52145422 52145422
70902743 70902743
76774528 76774528
44508094 44508094
83994433 83994433
95040215 95040215
98012938 98012938
88033975 88033975
26593852 26593852
98558751 98558751
78156759 78156759
!side !side
46565218 46565218
46565218 46565218
46565218 46565218
5318639 5318639
5318639 5318639
5318639 5318639
95561280 95561280
95561280 95561280
95561280 95561280
47475363 47475363
47475363 47475363
47475363 47475363
98643358 98643358
98643358 98643358
98643358 98643358
#created by ... #created by ...
#main #main
77558536 77558536
18144506 18144506
57774843 57774843
57774843 57774843
57774843 57774843
58996430 58996430
58996430 58996430
58996430 58996430
59019082 59019082
77558536 77558536
77558536 77558536
22624373 22624373
22624373 22624373
67696066 67696066
67696066 67696066
67696066 67696066
25259669 25259669
25259669 25259669
25259669 25259669
1833916 1833916
1833916 1833916
73176465 73176465
73176465 73176465
37742478 37742478
37742478 37742478
95503687 95503687
95503687 95503687
95503687 95503687
40164421 40164421
21502796 21502796
67441435 67441435
691925 691925
691925 691925
691925 691925
5133471 5133471
32807846 32807846
73594093 73594093
94886282 94886282
94886282 94886282
94886282 94886282
#extra #extra
52687916 52687916
80666118 80666118
74586817 74586817
4779823 4779823
37192109 37192109
56832966 56832966
84013237 84013237
82633039 82633039
30100551 30100551
30100551 30100551
30100551 30100551
46772449 46772449
83531441 83531441
1861629 1861629
3987233 3987233
!side !side
...@@ -76,18 +76,3 @@ ...@@ -76,18 +76,3 @@
50588353 50588353
50588353 50588353
!side !side
67696066
73176465
37742478
15341821
54757758
13529466
74586817
6983839
82633039
46772449
1861629
1845204
53129443
43898403
48130397
#created by ... #created by ...
#main #main
52738610 52738610
52738610 52738610
52738610 52738610
23401839 23401839
23401839 23401839
23401839 23401839
95492061 95492061
95492061 95492061
95492061 95492061
30312361 30312361
90307777 90307777
88240999 88240999
88240999 88240999
52068432 52068432
52068432 52068432
52068432 52068432
74122412 74122412
74122412 74122412
26674724 26674724
89463537 89463537
99185129 99185129
99185129 99185129
99185129 99185129
32807846 32807846
53129443 53129443
96729612 96729612
96729612 96729612
14735698 14735698
14735698 14735698
14735698 14735698
51124303 51124303
51124303 51124303
51124303 51124303
97211663 97211663
5318639 5318639
5318639 5318639
5318639 5318639
51452091 51452091
51452091 51452091
51452091 51452091
#extra #extra
35952884 35952884
35952884 35952884
41517789 41517789
41517789 41517789
24696097 24696097
24696097 24696097
52687916 52687916
74586817 74586817
37192109 37192109
42566602 42566602
90953320 90953320
79606837 79606837
79606837 79606837
79606837 79606837
46772449 46772449
!side !side
#created by ... #created by ...
#main #main
18108166 18108166
18108166 18108166
18108166 18108166
74852097 74852097
74852097 74852097
74852097 74852097
81823360 81823360
81823360 81823360
81823360 81823360
75195825 75195825
75195825 75195825
75195825 75195825
87979586 87979586
87979586 87979586
87979586 87979586
33256280 33256280
33256280 33256280
33256280 33256280
85138716 85138716
85138716 85138716
85138716 85138716
911883 911883
911883 911883
911883 911883
18144506 18144506
35261759 35261759
35261759 35261759
35261759 35261759
97169186 97169186
97169186 97169186
97169186 97169186
5650082 5650082
20522190 20522190
29401950 29401950
29616929 29616929
40838625 40838625
44095762 44095762
47475363 47475363
58120309 58120309
75249652 75249652
#extra #extra
80666118 80666118
18239909 18239909
44508094 44508094
56832966 56832966
37279508 37279508
84013237 84013237
74294676 74294676
82697249 82697249
82633039 82633039
61344030 61344030
22653490 22653490
46772449 46772449
12014404 12014404
359563 359563
6511113 6511113
!side !side
#created by ... #created by ...
#main #main
23950192 23950192
23950192 23950192
90311614 90311614
90311614 90311614
90311614 90311614
9126351 9126351
9126351 9126351
9126351 9126351
50088247 50088247
50088247 50088247
50088247 50088247
1357146 1357146
1357146 1357146
1357146 1357146
46239604 46239604
46239604 46239604
46239604 46239604
80250319 80250319
80250319 80250319
80250319 80250319
5133471 5133471
5133471 5133471
5133471 5133471
18144506 18144506
33057951 33057951
33057951 33057951
33057951 33057951
53129443 53129443
72892473 72892473
81439173 81439173
83764718 83764718
84206435 84206435
84206435 84206435
84206435 84206435
96947648 96947648
96947648 96947648
96947648 96947648
29047353 29047353
29047353 29047353
29047353 29047353
#extra #extra
79606837 79606837
79606837 79606837
79606837 79606837
90809975 90809975
90809975 90809975
90809975 90809975
36776089 36776089
36776089 36776089
36776089 36776089
2766877 2766877
2766877 2766877
2766877 2766877
84224627 84224627
84224627 84224627
84224627 84224627
!side !side
#created by ... #created by ...
#main #main
92246806 92246806
92246806 92246806
92246806 92246806
65247798 65247798
65247798 65247798
65247798 65247798
28630501 28630501
28630501 28630501
28630501 28630501
25244515 25244515
25244515 25244515
18144507 18144507
53129443 53129443
59750328 59750328
59750328 59750328
98645731 98645731
98645731 98645731
98645731 98645731
8267140 8267140
8267140 8267140
8267140 8267140
40838625 40838625
40838625 40838625
47475363 47475363
47475363 47475363
47475363 47475363
58120309 58120309
58120309 58120309
58120309 58120309
5851097 5851097
30241314 30241314
30241314 30241314
30241314 30241314
40605147 40605147
40605147 40605147
41420027 41420027
59344077 59344077
59344077 59344077
59344077 59344077
84749824 84749824
#extra #extra
44508094 44508094
56832966 56832966
86532744 86532744
16195942 16195942
84013237 84013237
94380860 94380860
96381979 96381979
63746411 63746411
82633039 82633039
95169481 95169481
22653490 22653490
46772449 46772449
21044178 21044178
12014404 12014404
12014404 12014404
!side !side
{
"welcome": [
"真難得有人發現這個。",
"真沒想到你能跟我對戰呢!決鬥者。不過也就到此為止了,接下來由我V.F.D(非常友善的決鬥者)來做你的對手。"
],
"deckerror": [
"阿,可能BA又把CBD修壞導致{0}消失了。"
],
"duelstart": [
"這只是AI,打贏不要太高興阿。",
"十分致謝233服讓我們有遊戲可以玩,別忘記去拜訪他們。",
"反主流學院請洽NOVA。",
"Wryyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy."
],
"newturn": [
"到我的回合了,抽牌!",
"我的回合,抽牌!",
"我抽了一張卡。"
],
"endturn": [
"回合结束。",
"我的回合结束了。",
"這樣算是成功的展開嗎......",
"輪到你了。你的下一句是......我要發動灰流麗對吧!"
],
"directattack": [
"{0},直接攻擊!",
"{0},直接攻擊對手!",
"{0},没有防守的地方,攻擊!",
"{0},攻擊對手的生命值!",
"{0},直接攻擊對手的生命值!",
"{0},通過直接攻擊打倒對手!",
"{0},使用直接攻擊打倒對手!",
"{0},直接攻擊釋放你的力量吧!",
"我的{0}將會粉碎你的生命值!",
"向對手展示你的力量吧,{0}!",
"你已經無法阻止我了。{0},攻擊!"
],
"attack": [
"{0},攻擊這體{1}!",
"{0},消滅這體{1}!",
"{0},打倒{1}!",
"{0},衝向那體{1}!",
"{0},把你的力量释放到{1}上吧!"
],
"ondirectattack": [
"可惡......",
"不過是{0}而已!",
"果然我還是太弱了......"
],
"facedownmonstername": "怪獸",
"activate": [
"我發動{0}。",
"我使用{0}的效果。",
"我使用{0}的力量。"
],
"summon": [
"真是HIGH的最高點!出來吧{0}。",
"出來吧,{0}!",
"出現吧,{0}!",
"我召喚了強大的{0}!",
"我呼喚{0}參加戰鬥!",
"我呼喚出{0}。",
"我召喚{0}。"
],
"setmonster": [
"我放置了一體怪獸。",
"我裡側表示放置了一體怪獸。"
],
"chaining": [
"看這裡!發動{0}!",
"我使用{0}的力量。",
"很不錯的戰術...但是我拒絕!{0}!",
"真不愧是納粹,竟然能識破我的蓋牌......你說你只是單純的決鬥者?{0},發動!",
"看樣子你忘了我的{0}!",
"你考慮過我有{0}嗎?"
]
}
...@@ -9,8 +9,7 @@ ...@@ -9,8 +9,7 @@
"duelstart": [ "duelstart": [
"這只是AI,打贏不要太高興阿。", "這只是AI,打贏不要太高興阿。",
"十分致謝233服讓我們有遊戲可以玩,別忘記去拜訪他們。", "十分致謝233服讓我們有遊戲可以玩,別忘記去拜訪他們。",
"反主流學院請洽NOVA。", "反主流學院請洽NOVA。"
], ],
"newturn": [ "newturn": [
"到我的回合了,抽牌!", "到我的回合了,抽牌!",
...@@ -71,7 +70,6 @@ ...@@ -71,7 +70,6 @@
"看這裡!發動{0}!", "看這裡!發動{0}!",
"我使用{0}的力量。", "我使用{0}的力量。",
"很不錯的戰術...但是我拒絕!{0}!", "很不錯的戰術...但是我拒絕!{0}!",
"真不愧是納粹,竟然能識破我的蓋牌......你說你只是單純的決鬥者?{0},發動!",
"看樣子你忘了我的{0}!", "看樣子你忘了我的{0}!",
"你考慮過我有{0}嗎?" "你考慮過我有{0}嗎?"
] ]
......
This diff is collapsed.
This diff is collapsed.
using YGOSharp.OCGWrapper.Enums; using YGOSharp.OCGWrapper.Enums;
using System.Collections.Generic; using System.Collections.Generic;
using WindBot; using WindBot;
using WindBot.Game; using WindBot.Game;
using WindBot.Game.AI; using WindBot.Game.AI;
namespace WindBot.Game.AI.Decks namespace WindBot.Game.AI.Decks
{ {
[Deck("Test", "AI_Test", "Test")] [Deck("Test", "AI_Test", "Test")]
public class DoEverythingExecutor : DefaultExecutor public class DoEverythingExecutor : DefaultExecutor
{ {
public class CardId public class CardId
{ {
public const int LeoWizard = 4392470; public const int LeoWizard = 4392470;
public const int Bunilla = 69380702; public const int Bunilla = 69380702;
} }
public DoEverythingExecutor(GameAI ai, Duel duel) public DoEverythingExecutor(GameAI ai, Duel duel)
: base(ai, duel) : base(ai, duel)
{ {
AddExecutor(ExecutorType.SpSummon); AddExecutor(ExecutorType.SpSummon);
AddExecutor(ExecutorType.Activate, DefaultDontChainMyself); AddExecutor(ExecutorType.Activate, DefaultDontChainMyself);
AddExecutor(ExecutorType.SummonOrSet); AddExecutor(ExecutorType.SummonOrSet);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos); AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
AddExecutor(ExecutorType.SpellSet); AddExecutor(ExecutorType.SpellSet);
} }
public override IList<ClientCard> OnSelectCard(IList<ClientCard> cards, int min, int max, int hint, bool cancelable) public override IList<ClientCard> OnSelectCard(IList<ClientCard> cards, int min, int max, int hint, bool cancelable)
{ {
if (Duel.Phase == DuelPhase.BattleStart) if (Duel.Phase == DuelPhase.BattleStart)
return null; return null;
IList<ClientCard> selected = new List<ClientCard>(); IList<ClientCard> selected = new List<ClientCard>();
// select the last cards // select the last cards
for (int i = 1; i <= max; ++i) for (int i = 1; i <= max; ++i)
selected.Add(cards[cards.Count-i]); selected.Add(cards[cards.Count-i]);
return selected; return selected;
} }
public override int OnSelectOption(IList<int> options) public override int OnSelectOption(IList<int> options)
{ {
return Program.Rand.Next(options.Count); return Program.Rand.Next(options.Count);
} }
} }
} }
\ No newline at end of file
using YGOSharp.OCGWrapper.Enums; using YGOSharp.OCGWrapper.Enums;
using System.Collections.Generic; using System.Collections.Generic;
using WindBot; using WindBot;
using WindBot.Game; using WindBot.Game;
using WindBot.Game.AI; using WindBot.Game.AI;
namespace WindBot.Game.AI.Decks namespace WindBot.Game.AI.Decks
{ {
// NOT FINISHED YET // NOT FINISHED YET
[Deck("Evilswarm", "AI_Evilswarm", "NotFinished")] [Deck("Evilswarm", "AI_Evilswarm", "NotFinished")]
public class EvilswarmExecutor : DefaultExecutor public class EvilswarmExecutor : DefaultExecutor
{ {
public class CardId public class CardId
{ {
public const int DarkHole = 53129443; public const int DarkHole = 53129443;
public const int CosmicCyclone = 8267140; public const int CosmicCyclone = 8267140;
public const int InfestationPandemic = 27541267; public const int InfestationPandemic = 27541267;
public const int SolemnJudgment = 41420027; public const int SolemnJudgment = 41420027;
public const int SolemnWarning = 84749824; public const int SolemnWarning = 84749824;
public const int SolemnStrike = 40605147; public const int SolemnStrike = 40605147;
} }
public EvilswarmExecutor(GameAI ai, Duel duel) public EvilswarmExecutor(GameAI ai, Duel duel)
: base(ai, duel) : base(ai, duel)
{ {
AddExecutor(ExecutorType.Activate, CardId.DarkHole, DefaultDarkHole); AddExecutor(ExecutorType.Activate, CardId.DarkHole, DefaultDarkHole);
AddExecutor(ExecutorType.Activate, CardId.CosmicCyclone, DefaultCosmicCyclone); AddExecutor(ExecutorType.Activate, CardId.CosmicCyclone, DefaultCosmicCyclone);
AddExecutor(ExecutorType.Activate, CardId.SolemnJudgment, DefaultSolemnJudgment); AddExecutor(ExecutorType.Activate, CardId.SolemnJudgment, DefaultSolemnJudgment);
AddExecutor(ExecutorType.Activate, CardId.SolemnWarning, DefaultSolemnWarning); AddExecutor(ExecutorType.Activate, CardId.SolemnWarning, DefaultSolemnWarning);
AddExecutor(ExecutorType.Activate, CardId.SolemnStrike, DefaultSolemnStrike); AddExecutor(ExecutorType.Activate, CardId.SolemnStrike, DefaultSolemnStrike);
AddExecutor(ExecutorType.SpellSet, CardId.InfestationPandemic); AddExecutor(ExecutorType.SpellSet, CardId.InfestationPandemic);
AddExecutor(ExecutorType.Activate, DefaultDontChainMyself); AddExecutor(ExecutorType.Activate, DefaultDontChainMyself);
AddExecutor(ExecutorType.Summon); AddExecutor(ExecutorType.Summon);
AddExecutor(ExecutorType.SpSummon); AddExecutor(ExecutorType.SpSummon);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos); AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
AddExecutor(ExecutorType.SpellSet); AddExecutor(ExecutorType.SpellSet);
} }
// will be added soon...? // will be added soon...?
} }
} }
\ No newline at end of file
This diff is collapsed.
using YGOSharp.OCGWrapper.Enums; using YGOSharp.OCGWrapper.Enums;
using System.Collections.Generic; using System.Collections.Generic;
using WindBot; using WindBot;
using WindBot.Game; using WindBot.Game;
using WindBot.Game.AI; using WindBot.Game.AI;
namespace WindBot.Game.AI.Decks namespace WindBot.Game.AI.Decks
{ {
// NOT FINISHED YET // NOT FINISHED YET
[Deck("Graydle", "AI_Graydle", "NotFinished")] [Deck("Graydle", "AI_Graydle", "NotFinished")]
public class GraydleExecutor : DefaultExecutor public class GraydleExecutor : DefaultExecutor
{ {
public class CardId public class CardId
{ {
public const int DarkHole = 53129443; public const int DarkHole = 53129443;
public const int CosmicCyclone = 8267140; public const int CosmicCyclone = 8267140;
public const int SolemnJudgment = 41420027; public const int SolemnJudgment = 41420027;
public const int SolemnWarning = 84749824; public const int SolemnWarning = 84749824;
public const int SolemnStrike = 40605147; public const int SolemnStrike = 40605147;
} }
public GraydleExecutor(GameAI ai, Duel duel) public GraydleExecutor(GameAI ai, Duel duel)
: base(ai, duel) : base(ai, duel)
{ {
AddExecutor(ExecutorType.Activate, CardId.DarkHole, DefaultDarkHole); AddExecutor(ExecutorType.Activate, CardId.DarkHole, DefaultDarkHole);
AddExecutor(ExecutorType.Activate, CardId.CosmicCyclone, DefaultCosmicCyclone); AddExecutor(ExecutorType.Activate, CardId.CosmicCyclone, DefaultCosmicCyclone);
AddExecutor(ExecutorType.Activate, CardId.SolemnJudgment, DefaultSolemnJudgment); AddExecutor(ExecutorType.Activate, CardId.SolemnJudgment, DefaultSolemnJudgment);
AddExecutor(ExecutorType.Activate, CardId.SolemnWarning, DefaultSolemnWarning); AddExecutor(ExecutorType.Activate, CardId.SolemnWarning, DefaultSolemnWarning);
AddExecutor(ExecutorType.Activate, CardId.SolemnStrike, DefaultSolemnStrike); AddExecutor(ExecutorType.Activate, CardId.SolemnStrike, DefaultSolemnStrike);
AddExecutor(ExecutorType.Activate, DefaultDontChainMyself); AddExecutor(ExecutorType.Activate, DefaultDontChainMyself);
AddExecutor(ExecutorType.MonsterSet); AddExecutor(ExecutorType.MonsterSet);
AddExecutor(ExecutorType.SpSummon); AddExecutor(ExecutorType.SpSummon);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos); AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
AddExecutor(ExecutorType.SpellSet); AddExecutor(ExecutorType.SpellSet);
} }
// will be added soon...? // will be added soon...?
} }
} }
\ No newline at end of file
This diff is collapsed.
...@@ -191,7 +191,7 @@ namespace WindBot.Game.AI.Decks ...@@ -191,7 +191,7 @@ namespace WindBot.Game.AI.Decks
} }
return false; return false;
} }
private bool TrapSetUnique() private bool TrapSetUnique()
{ {
foreach (ClientCard card in Bot.GetSpells()) foreach (ClientCard card in Bot.GetSpells())
......
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using YGOSharp.OCGWrapper.Enums; using YGOSharp.OCGWrapper.Enums;
using WindBot; using WindBot;
...@@ -12,14 +12,15 @@ namespace WindBot.Game.AI ...@@ -12,14 +12,15 @@ namespace WindBot.Game.AI
protected class _CardId protected class _CardId
{ {
public const int JizukirutheStarDestroyingKaiju = 63941210; public const int JizukirutheStarDestroyingKaiju = 63941210;
public const int GadarlatheMysteryDustKaiju = 36956512;
public const int GamecieltheSeaTurtleKaiju = 55063751;
public const int RadiantheMultidimensionalKaiju = 28674152;
public const int KumongoustheStickyStringKaiju = 29726552;
public const int ThunderKingtheLightningstrikeKaiju = 48770333; public const int ThunderKingtheLightningstrikeKaiju = 48770333;
public const int DogorantheMadFlameKaiju = 93332803; public const int DogorantheMadFlameKaiju = 93332803;
public const int RadiantheMultidimensionalKaiju = 28674152;
public const int GadarlatheMysteryDustKaiju = 36956512;
public const int KumongoustheStickyStringKaiju = 29726552;
public const int GamecieltheSeaTurtleKaiju = 55063751;
public const int SuperAntiKaijuWarMachineMechaDogoran = 84769941; public const int SuperAntiKaijuWarMachineMechaDogoran = 84769941;
public const int DupeFrog = 46239604; public const int DupeFrog = 46239604;
public const int MaraudingCaptain = 2460565; public const int MaraudingCaptain = 2460565;
...@@ -44,13 +45,40 @@ namespace WindBot.Game.AI ...@@ -44,13 +45,40 @@ namespace WindBot.Game.AI
AddExecutor(ExecutorType.Activate, _CardId.ChickenGame, DefaultChickenGame); AddExecutor(ExecutorType.Activate, _CardId.ChickenGame, DefaultChickenGame);
} }
/// <summary>
/// Decide which card should the attacker attack.
/// </summary>
/// <param name="attacker">Card that attack.</param>
/// <param name="defenders">Cards that defend.</param>
/// <returns>BattlePhaseAction including the target, or null (in this situation, GameAI will check the next attacker)</returns>
public override BattlePhaseAction OnSelectAttackTarget(ClientCard attacker, IList<ClientCard> defenders)
{
for (int i = 0; i < defenders.Count; ++i)
{
ClientCard defender = defenders[i];
attacker.RealPower = attacker.Attack;
defender.RealPower = defender.GetDefensePower();
if (!OnPreBattleBetween(attacker, defender))
continue;
if (attacker.RealPower > defender.RealPower || (attacker.RealPower >= defender.RealPower && attacker.IsLastAttacker))
return AI.Attack(attacker, defender);
}
if (attacker.CanDirectAttack)
return AI.Attack(attacker, null);
return null;
}
/// <summary> /// <summary>
/// Decide whether to declare attack between attacker and defender. /// Decide whether to declare attack between attacker and defender.
/// Can be overrided to update the RealPower of attacker for cards like Honest. /// Can be overrided to update the RealPower of attacker for cards like Honest.
/// </summary> /// </summary>
/// <param name="attacker">Card that attack.</param> /// <param name="attacker">Card that attack.</param>
/// <param name="defender">Card that defend.</param> /// <param name="defender">Card that defend.</param>
/// <returns>false if the attack can't be done.</returns> /// <returns>false if the attack shouldn't be done.</returns>
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender) public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
{ {
if (attacker.RealPower <= 0) if (attacker.RealPower <= 0)
...@@ -68,9 +96,9 @@ namespace WindBot.Game.AI ...@@ -68,9 +96,9 @@ namespace WindBot.Game.AI
defender.RealPower = 5000; defender.RealPower = 5000;
if (defender.Id == _CardId.VampireFräulein && !defender.IsDisabled()) if (defender.Id == _CardId.VampireFräulein && !defender.IsDisabled())
defender.RealPower += (Duel.LifePoints[defender.Controller] > 3000) ? 3000 : (Duel.LifePoints[defender.Controller] - 100); defender.RealPower += (Enemy.LifePoints > 3000) ? 3000 : (Enemy.LifePoints - 100);
if (defender.Id == _CardId.InjectionFairyLily && !defender.IsDisabled() && Duel.LifePoints[defender.Controller] > 2000) if (defender.Id == _CardId.InjectionFairyLily && !defender.IsDisabled() && Enemy.LifePoints > 2000)
defender.RealPower += 3000; defender.RealPower += 3000;
} }
...@@ -99,6 +127,21 @@ namespace WindBot.Game.AI ...@@ -99,6 +127,21 @@ namespace WindBot.Game.AI
return true; return true;
} }
public override bool OnSelectBattleReplay()
{
if (Bot.BattlingMonster == null)
return false;
List<ClientCard> defenders = new List<ClientCard>(Duel.Fields[1].GetMonsters());
defenders.Sort(AIFunctions.CompareDefensePower);
defenders.Reverse();
BattlePhaseAction result = OnSelectAttackTarget(Bot.BattlingMonster, defenders);
if (result != null && result.Action == BattlePhaseAction.BattleAction.Attack)
{
return true;
}
return false;
}
/// <summary> /// <summary>
/// Destroy face-down cards first, in our turn. /// Destroy face-down cards first, in our turn.
/// </summary> /// </summary>
...@@ -469,6 +512,29 @@ namespace WindBot.Game.AI ...@@ -469,6 +512,29 @@ namespace WindBot.Game.AI
return false; return false;
} }
/// <summary>
/// Draw when we have Dark monster in hand,and banish random one. Can be overrided.
/// </summary>
protected bool DefaultAllureofDarkness()
{
IList<ClientCard> condition = Bot.Hand;
IList<ClientCard> check = new List<ClientCard>();
ClientCard con = null;
foreach (ClientCard card in condition)
{
if (card.HasAttribute(CardAttribute.Dark))
{
con = card;
break;
}
}
if (con != null)
{
return true;
}
return false;
}
/// <summary> /// <summary>
/// Clever enough. /// Clever enough.
/// </summary> /// </summary>
...@@ -557,7 +623,7 @@ namespace WindBot.Game.AI ...@@ -557,7 +623,7 @@ namespace WindBot.Game.AI
} }
/// <summary> /// <summary>
/// Clever enough. /// Clever enough
/// </summary> /// </summary>
protected bool DefaultInterruptedKaijuSlumber() protected bool DefaultInterruptedKaijuSlumber()
{ {
...@@ -567,24 +633,34 @@ namespace WindBot.Game.AI ...@@ -567,24 +633,34 @@ namespace WindBot.Game.AI
{ {
_CardId.GamecieltheSeaTurtleKaiju, _CardId.GamecieltheSeaTurtleKaiju,
_CardId.KumongoustheStickyStringKaiju, _CardId.KumongoustheStickyStringKaiju,
_CardId.GadarlatheMysteryDustKaiju,
_CardId.RadiantheMultidimensionalKaiju, _CardId.RadiantheMultidimensionalKaiju,
_CardId.GadarlatheMysteryDustKaiju _CardId.DogorantheMadFlameKaiju,
_CardId.ThunderKingtheLightningstrikeKaiju,
_CardId.JizukirutheStarDestroyingKaiju,
}); });
return true; return true;
} }
AI.SelectCard(new[] AI.SelectCard(new[]
{ {
_CardId.JizukirutheStarDestroyingKaiju, _CardId.JizukirutheStarDestroyingKaiju,
_CardId.ThunderKingtheLightningstrikeKaiju,
_CardId.DogorantheMadFlameKaiju,
_CardId.RadiantheMultidimensionalKaiju, _CardId.RadiantheMultidimensionalKaiju,
_CardId.GadarlatheMysteryDustKaiju, _CardId.GadarlatheMysteryDustKaiju,
_CardId.KumongoustheStickyStringKaiju _CardId.KumongoustheStickyStringKaiju,
_CardId.GamecieltheSeaTurtleKaiju,
}); });
AI.SelectNextCard(new[] AI.SelectNextCard(new[]
{ {
_CardId.SuperAntiKaijuWarMachineMechaDogoran,
_CardId.GamecieltheSeaTurtleKaiju, _CardId.GamecieltheSeaTurtleKaiju,
_CardId.KumongoustheStickyStringKaiju, _CardId.KumongoustheStickyStringKaiju,
_CardId.GadarlatheMysteryDustKaiju, _CardId.GadarlatheMysteryDustKaiju,
_CardId.RadiantheMultidimensionalKaiju _CardId.RadiantheMultidimensionalKaiju,
_CardId.DogorantheMadFlameKaiju,
_CardId.ThunderKingtheLightningstrikeKaiju,
}); });
return DefaultDarkHole(); return DefaultDarkHole();
} }
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
MetaionTheTimelord = 74530899, MetaionTheTimelord = 74530899,
KamionTheTimelord = 91712985, KamionTheTimelord = 91712985,
LazionTheTimelord = 92435533, LazionTheTimelord = 92435533,
EaterOfMillions = 63845230 EaterOfMillions = 63845230,
} ElShaddollConstruct = 20366274,
}
} }
namespace WindBot.Game.AI.Enums namespace WindBot.Game.AI.Enums
{ {
/// <summary> /// <summary>
/// Cards that restrict player from performing some action. Bot will preferentially destroy them. /// Cards that restrict player from performing some action. Bot will preferentially destroy them.
/// </summary> /// </summary>
public enum Floodgate public enum Floodgate
{ {
BarrierStatueoftheTorrent = 10963799, BarrierStatueoftheTorrent = 10963799,
BarrierStatueoftheDrought = 19740112, BarrierStatueoftheDrought = 19740112,
BarrierStatueoftheHeavens = 46145256, BarrierStatueoftheHeavens = 46145256,
BarrierStatueoftheInferno = 47961808, BarrierStatueoftheInferno = 47961808,
BarrierStatueoftheStormwinds = 73356503, BarrierStatueoftheStormwinds = 73356503,
BarrierStatueoftheAbyss = 84478195, BarrierStatueoftheAbyss = 84478195,
ThunderKingRaiOh = 71564252, ThunderKingRaiOh = 71564252,
FossilDynaPachycephalo = 42009836, FossilDynaPachycephalo = 42009836,
VanitysFiend = 47084486, VanitysFiend = 47084486,
MajestysFiend = 33746252, MajestysFiend = 33746252,
VanitysRuler = 72634965, VanitysRuler = 72634965,
KycootheGhostDestroyer = 88240808, KycootheGhostDestroyer = 88240808,
ConsecratedLight = 2980764, ConsecratedLight = 2980764,
ArchlordKristya = 59509952, ArchlordKristya = 59509952,
KoakiMeiruDrago = 12435193, KoakiMeiruDrago = 12435193,
DenkoSekka = 13974207, DenkoSekka = 13974207,
ZapMustung = 29951323, ZapMustung = 29951323,
Jinzo = 77585513, Jinzo = 77585513,
SpellCanceller = 84636823, SpellCanceller = 84636823,
LevelLimitAreaB = 3136426, LevelLimitAreaB = 3136426,
DimensionalFissure = 81674782, DimensionalFissure = 81674782,
Necrovalley = 47355498, Necrovalley = 47355498,
SavageColosseum = 32391631, SavageColosseum = 32391631,
SecretVillageoftheSpellcasters = 68462976, SecretVillageoftheSpellcasters = 68462976,
SwordsofRevealingLight = 72302403, SwordsofRevealingLight = 72302403,
MessengerofPeace = 44656491, MessengerofPeace = 44656491,
KaiserColosseum = 35059553, KaiserColosseum = 35059553,
DomainoftheTrueMonarchs = 84171830, DomainoftheTrueMonarchs = 84171830,
ZombieWorld = 4064256, ZombieWorld = 4064256,
ImperialOrder = 61740673, ImperialOrder = 61740673,
MacroCosmos = 30241314, MacroCosmos = 30241314,
MindDrain = 68937720, MindDrain = 68937720,
SoulDrain = 73599290, SoulDrain = 73599290,
SkillDrain = 82732705, SkillDrain = 82732705,
Eisbahn = 54059040, Eisbahn = 54059040,
GozenMatch = 53334471, GozenMatch = 53334471,
RivalryofWarlords = 90846359, RivalryofWarlords = 90846359,
AntiSpellFragrance = 58921041, AntiSpellFragrance = 58921041,
LightImprisoningMirror = 53341729, LightImprisoningMirror = 53341729,
ShadowImprisoningMirror = 99735427, ShadowImprisoningMirror = 99735427,
WallofRevealingLight = 17078030, WallofRevealingLight = 17078030,
GravityBind = 85742772, GravityBind = 85742772,
VanitysEmptiness = 5851097, VanitysEmptiness = 5851097,
Lose1Turn = 24348804, Lose1Turn = 24348804,
Reqliate = 20426907, Reqliate = 20426907,
SummonLimit = 23516703, SummonLimit = 23516703,
AndtheBandPlayedOn = 47594939, AndtheBandPlayedOn = 47594939,
StygianDirge = 81489939, StygianDirge = 81489939,
RoyalDecree = 51452091, RoyalDecree = 51452091,
ImperialIronWall = 30459350, ImperialIronWall = 30459350,
DNASurgery = 74701381, DNASurgery = 74701381,
NaturiaExterio = 99916754, NaturiaExterio = 99916754,
TheLastWarriorfromAnotherPlanet = 86099788, TheLastWarriorfromAnotherPlanet = 86099788,
ThousandEyesRestrict = 63519819, ThousandEyesRestrict = 63519819,
ElShaddollWinda = 94977269, ElShaddollWinda = 94977269,
MaskedHERODarkLaw = 58481572, MaskedHERODarkLaw = 58481572,
NaturiaBeast = 33198837, NaturiaBeast = 33198837,
NaturiaBarkion = 2956282, NaturiaBarkion = 2956282,
EvilswarmOphion = 91279700, EvilswarmOphion = 91279700,
MermailAbyssgaios = 74371660, MermailAbyssgaios = 74371660,
AbyssDweller = 21044178, AbyssDweller = 21044178,
ZoodiacDrident = 48905153 ZoodiacDrident = 48905153
} }
} }
...@@ -52,47 +52,26 @@ namespace WindBot.Game.AI ...@@ -52,47 +52,26 @@ namespace WindBot.Game.AI
/// <returns>A new BattlePhaseAction containing the action to do.</returns> /// <returns>A new BattlePhaseAction containing the action to do.</returns>
public virtual BattlePhaseAction OnBattle(IList<ClientCard> attackers, IList<ClientCard> defenders) public virtual BattlePhaseAction OnBattle(IList<ClientCard> attackers, IList<ClientCard> defenders)
{ {
if (attackers.Count == 0) // For overriding
return AI.ToMainPhase2(); return null;
}
if (defenders.Count == 0)
{
for (int i = attackers.Count - 1; i >= 0; --i)
{
ClientCard attacker = attackers[i];
if (attacker.Attack > 0)
return AI.Attack(attacker, null);
}
}
else
{
for (int i = defenders.Count - 1; i >= 0; --i)
{
ClientCard defender = defenders[i];
for (int j = 0; j < attackers.Count; ++j)
{
ClientCard attacker = attackers[j];
attacker.RealPower = attacker.Attack;
defender.RealPower = defender.GetDefensePower();
if (!OnPreBattleBetween(attacker, defender))
continue;
if (attacker.RealPower > defender.RealPower || (attacker.RealPower >= defender.RealPower && j == attackers.Count - 1))
return AI.Attack(attacker, defender);
}
}
for (int i = attackers.Count - 1; i >= 0; --i)
{
ClientCard attacker = attackers[i];
if (attacker.CanDirectAttack)
return AI.Attack(attacker, null);
}
}
if (!Battle.CanMainPhaseTwo) /// <summary>
return AI.Attack(attackers[0], (defenders.Count == 0) ? null : defenders[0]); /// Called when the AI has to decide which card to attack first
/// </summary>
/// <param name="attackers">List of monsters that can attcack.</param>
/// <param name="defenders">List of monsters of enemy.</param>
/// <returns>The card to attack first.</returns>
public virtual ClientCard OnSelectAttacker(IList<ClientCard> attackers, IList<ClientCard> defenders)
{
// For overriding
return null;
}
return AI.ToMainPhase2(); public virtual BattlePhaseAction OnSelectAttackTarget(ClientCard attacker, IList<ClientCard> defenders)
{
// Overrided in DefalultExecutor
return null;
} }
public virtual bool OnPreBattleBetween(ClientCard attacker, ClientCard defender) public virtual bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
...@@ -174,6 +153,12 @@ namespace WindBot.Game.AI ...@@ -174,6 +153,12 @@ namespace WindBot.Game.AI
return -1; return -1;
} }
public virtual bool OnSelectBattleReplay()
{
// Overrided in DefalultExecutor
return false;
}
public void SetMain(MainPhase main) public void SetMain(MainPhase main)
{ {
Main = main; Main = main;
......
...@@ -36,6 +36,7 @@ namespace WindBot.Game ...@@ -36,6 +36,7 @@ namespace WindBot.Game
public bool CanDirectAttack { get; set; } public bool CanDirectAttack { get; set; }
public bool ShouldDirectAttack { get; set; } public bool ShouldDirectAttack { get; set; }
public bool Attacked { get; set; } public bool Attacked { get; set; }
public bool IsLastAttacker { get; set; }
public int[] ActionIndex { get; set; } public int[] ActionIndex { get; set; }
public IDictionary<int, int> ActionActivateIndex { get; private set; } public IDictionary<int, int> ActionActivateIndex { get; private set; }
......
...@@ -70,6 +70,19 @@ namespace WindBot.Game ...@@ -70,6 +70,19 @@ namespace WindBot.Game
} }
return count; return count;
} }
public int GetFieldCount()
{
return GetSpellCount() + GetMonsterCount();
}
public int GetFieldHandCount()
{
return GetSpellCount() + GetMonsterCount() + GetHandCount();
}
public bool IsFieldEmpty() public bool IsFieldEmpty()
{ {
......
...@@ -143,13 +143,57 @@ namespace WindBot.Game ...@@ -143,13 +143,57 @@ namespace WindBot.Game
} }
} }
// Sort the attackers and defenders, make monster with higher attack go first.
List<ClientCard> attackers = new List<ClientCard>(battle.AttackableCards); List<ClientCard> attackers = new List<ClientCard>(battle.AttackableCards);
attackers.Sort(AIFunctions.CompareCardAttack); attackers.Sort(AIFunctions.CompareCardAttack);
attackers.Reverse();
List<ClientCard> defenders = new List<ClientCard>(Duel.Fields[1].GetMonsters()); List<ClientCard> defenders = new List<ClientCard>(Duel.Fields[1].GetMonsters());
defenders.Sort(AIFunctions.CompareDefensePower); defenders.Sort(AIFunctions.CompareDefensePower);
defenders.Reverse();
return Executor.OnBattle(attackers, defenders); // Let executor decide which card should attack first.
ClientCard selected = Executor.OnSelectAttacker(attackers, defenders);
if (selected != null && attackers.Contains(selected))
{
attackers.Remove(selected);
attackers.Insert(0, selected);
}
// Check for the executor.
BattlePhaseAction result = Executor.OnBattle(attackers, defenders);
if (result != null)
return result;
if (attackers.Count == 0)
return ToMainPhase2();
if (defenders.Count == 0)
{
// Attack with the monster with the lowest attack first
for (int i = attackers.Count - 1; i >= 0; --i)
{
ClientCard attacker = attackers[i];
if (attacker.Attack > 0)
return Attack(attacker, null);
}
}
else
{
for (int k = 0; k < attackers.Count; ++k)
{
ClientCard attacker = attackers[k];
attacker.IsLastAttacker = (k == attackers.Count - 1);
result = Executor.OnSelectAttackTarget(attacker, defenders);
if (result != null)
return result;
}
}
if (!battle.CanMainPhaseTwo)
return Attack(attackers[0], (defenders.Count == 0) ? null : defenders[0]);
return ToMainPhase2();
} }
/// <summary> /// <summary>
...@@ -165,9 +209,9 @@ namespace WindBot.Game ...@@ -165,9 +209,9 @@ namespace WindBot.Game
{ {
const int HINTMSG_FMATERIAL = 511; const int HINTMSG_FMATERIAL = 511;
const int HINTMSG_SMATERIAL = 512; const int HINTMSG_SMATERIAL = 512;
const int HINTMSG_XMATERIAL = 513; const int HINTMSG_XMATERIAL = 513;
const int HINTMSG_LMATERIAL = 533; const int HINTMSG_LMATERIAL = 533;
const int HINTMSG_SPSUMMON = 509; const int HINTMSG_SPSUMMON = 509;
// Check for the executor. // Check for the executor.
IList<ClientCard> result = Executor.OnSelectCard(cards, min, max, hint, cancelable); IList<ClientCard> result = Executor.OnSelectCard(cards, min, max, hint, cancelable);
...@@ -220,9 +264,11 @@ namespace WindBot.Game ...@@ -220,9 +264,11 @@ namespace WindBot.Game
// Always select the first available cards and choose the minimum. // Always select the first available cards and choose the minimum.
IList<ClientCard> selected = new List<ClientCard>(); IList<ClientCard> selected = new List<ClientCard>();
for (int i = 0; i < min; ++i) if (cards.Count >= min)
selected.Add(cards[i]); {
for (int i = 0; i < min; ++i)
selected.Add(cards[i]);
}
return selected; return selected;
} }
...@@ -601,6 +647,15 @@ namespace WindBot.Game ...@@ -601,6 +647,15 @@ namespace WindBot.Game
return Executor.OnSelectYesNo(desc); return Executor.OnSelectYesNo(desc);
} }
/// <summary>
/// Called when the AI has to select if to continue attacking when replay.
/// </summary>
/// <returns>True for yes, false for no.</returns>
public bool OnSelectBattleReplay()
{
return Executor.OnSelectBattleReplay();
}
/// <summary> /// <summary>
/// Called when the AI has to declare a card. /// Called when the AI has to declare a card.
/// </summary> /// </summary>
......
...@@ -108,6 +108,7 @@ namespace WindBot.Game ...@@ -108,6 +108,7 @@ namespace WindBot.Game
_messages.Add(GameMessage.BecomeTarget, OnBecomeTarget); _messages.Add(GameMessage.BecomeTarget, OnBecomeTarget);
_messages.Add(GameMessage.SelectBattleCmd, OnSelectBattleCmd); _messages.Add(GameMessage.SelectBattleCmd, OnSelectBattleCmd);
_messages.Add(GameMessage.SelectCard, OnSelectCard); _messages.Add(GameMessage.SelectCard, OnSelectCard);
_messages.Add(GameMessage.SelectUnselectCard, OnSelectUnselectCard);
_messages.Add(GameMessage.SelectChain, OnSelectChain); _messages.Add(GameMessage.SelectChain, OnSelectChain);
_messages.Add(GameMessage.SelectCounter, OnSelectCounter); _messages.Add(GameMessage.SelectCounter, OnSelectCounter);
_messages.Add(GameMessage.SelectDisfield, OnSelectDisfield); _messages.Add(GameMessage.SelectDisfield, OnSelectDisfield);
...@@ -750,11 +751,84 @@ namespace WindBot.Game ...@@ -750,11 +751,84 @@ namespace WindBot.Game
Connection.Send(reply); Connection.Send(reply);
} }
private void InternalOnSelectUnselectCard(BinaryReader packet, Func<IList<ClientCard>, int, int, int, bool, IList<ClientCard>> func)
{
packet.ReadByte(); // player
packet.ReadByte(); // buttonok
bool cancelable = packet.ReadByte() != 0;
int min = packet.ReadByte();
int max = packet.ReadByte();
IList<ClientCard> cards = new List<ClientCard>();
int count = packet.ReadByte();
for (int i = 0; i < count; ++i)
{
int id = packet.ReadInt32();
int player = GetLocalPlayer(packet.ReadByte());
CardLocation loc = (CardLocation)packet.ReadByte();
int seq = packet.ReadByte();
packet.ReadByte(); // pos
ClientCard card;
if (((int)loc & (int)CardLocation.Overlay) != 0)
card = new ClientCard(id, CardLocation.Overlay);
else
card = _duel.GetCard(player, loc, seq);
if (card == null) continue;
if (card.Id == 0)
card.SetId(id);
cards.Add(card);
}
int count2 = packet.ReadByte();
for (int i = 0; i < count2; ++i)
{
int id = packet.ReadInt32();
int player = GetLocalPlayer(packet.ReadByte());
CardLocation loc = (CardLocation)packet.ReadByte();
int seq = packet.ReadByte();
packet.ReadByte(); // pos
}
IList<ClientCard> selected = func(cards, min, max, _select_hint, cancelable);
_select_hint = 0;
if (selected.Count == 0 && cancelable)
{
Connection.Send(CtosMessage.Response, -1);
return;
}
byte[] result = new byte[selected.Count + 1];
result[0] = (byte)selected.Count;
for (int i = 0; i < selected.Count; ++i)
{
int id = 0;
for (int j = 0; j < count; ++j)
{
if (cards[j] == null) continue;
if (cards[j].Equals(selected[i]))
{
id = j;
break;
}
}
result[i + 1] = (byte)id;
}
BinaryWriter reply = GamePacketFactory.Create(CtosMessage.Response);
reply.Write(result);
Connection.Send(reply);
}
private void OnSelectCard(BinaryReader packet) private void OnSelectCard(BinaryReader packet)
{ {
InternalOnSelectCard(packet, _ai.OnSelectCard); InternalOnSelectCard(packet, _ai.OnSelectCard);
} }
private void OnSelectUnselectCard(BinaryReader packet)
{
InternalOnSelectUnselectCard(packet, _ai.OnSelectCard);
}
private void OnSelectChain(BinaryReader packet) private void OnSelectChain(BinaryReader packet)
{ {
packet.ReadByte(); // player packet.ReadByte(); // player
...@@ -1106,7 +1180,12 @@ namespace WindBot.Game ...@@ -1106,7 +1180,12 @@ namespace WindBot.Game
private void OnSelectYesNo(BinaryReader packet) private void OnSelectYesNo(BinaryReader packet)
{ {
packet.ReadByte(); // player packet.ReadByte(); // player
int reply = _ai.OnSelectYesNo(packet.ReadInt32()) ? (1) : (0); int desc = packet.ReadInt32();
int reply;
if (desc == 30)
reply = _ai.OnSelectBattleReplay() ? 1 : 0;
else
reply = _ai.OnSelectYesNo(desc) ? 1 : 0;
Connection.Send(CtosMessage.Response, reply); Connection.Send(CtosMessage.Response, reply);
} }
......
using System; using System;
namespace WindBot namespace WindBot
{ {
......
No preview for this file type
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