Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
W
windbot
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tang Xinwei
windbot
Commits
5950a280
Commit
5950a280
authored
Sep 30, 2022
by
wind2009
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/mycard/windbot
into 2pick
parents
a27db336
e8280715
Changes
19
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
1287 additions
and
36 deletions
+1287
-36
.github/workflows/test-build.yml
.github/workflows/test-build.yml
+52
-0
BotWrapper/bot.conf
BotWrapper/bot.conf
+8
-3
Decks/AI_Brave.ydk
Decks/AI_Brave.ydk
+74
-0
Dialogs/smart.zh-CN.json
Dialogs/smart.zh-CN.json
+1
-1
Dialogs/verre.zh-CN.json
Dialogs/verre.zh-CN.json
+1
-1
Game/AI/Decks/BraveExecutor.cs
Game/AI/Decks/BraveExecutor.cs
+1037
-0
Game/AI/Decks/GrenMajuThunderBoarderExecutor.cs
Game/AI/Decks/GrenMajuThunderBoarderExecutor.cs
+3
-3
Game/AI/Decks/PhantasmExecutor.cs
Game/AI/Decks/PhantasmExecutor.cs
+5
-4
Game/AI/Decks/TrickstarExecutor.cs
Game/AI/Decks/TrickstarExecutor.cs
+2
-2
Game/AI/DefaultExecutor.cs
Game/AI/DefaultExecutor.cs
+14
-7
Game/AI/Zones.cs
Game/AI/Zones.cs
+2
-0
Game/ClientField.cs
Game/ClientField.cs
+5
-0
Game/Duel.cs
Game/Duel.cs
+1
-1
Game/GameAI.cs
Game/GameAI.cs
+26
-10
Game/GameBehavior.cs
Game/GameBehavior.cs
+49
-3
Program.cs
Program.cs
+3
-0
README.md
README.md
+2
-0
WindBot.csproj
WindBot.csproj
+1
-0
WindBotInfo.cs
WindBotInfo.cs
+1
-1
No files found.
.github/workflows/test-build.yml
0 → 100644
View file @
5950a280
name
:
Automated Test Build
on
:
push
:
branches
:
[
"
master"
]
pull_request
:
branches
:
[
"
master"
]
jobs
:
build
:
runs-on
:
windows-2019
env
:
Solution_Name
:
WindBot.sln
steps
:
-
name
:
Checkout
uses
:
actions/checkout@v3
with
:
fetch-depth
:
0
-
name
:
Setup MSBuild.exe
uses
:
microsoft/setup-msbuild@v1
-
name
:
Build!
run
:
msbuild $env:Solution_Name /t:Build /p:Configuration=Release
-
name
:
Pack
run
:
|
mkdir dist
xcopy /e /y bin\Release dist\WindBot\
xcopy /y BotWrapper\bin\Release\bot.conf dist\
xcopy /y BotWrapper\bin\Release\bot.exe dist\
cd dist
7z a WindBot.7z *
cd ..
-
name
:
Upload build artifacts
uses
:
actions/upload-artifact@v3
with
:
path
:
dist\WindBot.7z
-
name
:
GitHub Release
if
:
github.event_name == 'push'
uses
:
marvinpinto/action-automatic-releases@latest
with
:
repo_token
:
"
${{
secrets.GITHUB_TOKEN
}}"
automatic_release_tag
:
"
latest"
prerelease
:
true
title
:
"
Development
Build"
files
:
|
dist/WindBot.7z
BotWrapper/bot.conf
View file @
5950a280
...
@@ -26,7 +26,7 @@ SUPPORT_MASTER_RULE_2020
...
@@ -26,7 +26,7 @@ SUPPORT_MASTER_RULE_2020
!
P2
-自选卡组
!
P2
-自选卡组
Name
=
P2
Deck
=
Lucky
Dialog
=
gugugu
.
zh
-
CN
Name
=
P2
Deck
=
Lucky
Dialog
=
gugugu
.
zh
-
CN
人机卡组由你选择。随缘出牌。
可将你的卡组文件(.
ydk
)复制到
WindBot
的对应文件夹。
人机卡组由你选择。随缘出牌。
SELECT_DECKFILE
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
SUPPORT_MASTER_RULE_2020
SELECT_DECKFILE
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
SUPPORT_MASTER_RULE_2020
!谜之剑士
LV4
-龙骑星爆
!谜之剑士
LV4
-龙骑星爆
...
@@ -209,11 +209,16 @@ Name=朱露咲浅羽 Deck=Salamangreat Dialog=nlch.zh-CN
...
@@ -209,11 +209,16 @@ Name=朱露咲浅羽 Deck=Salamangreat Dialog=nlch.zh-CN
浅羽的香喷喷曲奇。
浅羽的香喷喷曲奇。
AI_LV3
SUPPORT_NEW_MASTER_RULE
SUPPORT_MASTER_RULE_2020
AI_LV3
SUPPORT_NEW_MASTER_RULE
SUPPORT_MASTER_RULE_2020
!
朱露咲浅羽-真红眼
!
我太帅了-真红眼龙骑士
Name
=
朱露咲浅羽
Deck
=
Dragun
Dialog
=
nlch
.
zh
-
CN
Name
=
我太帅了
Deck
=
Dragun
Dialog
=
smart
.
zh
-
CN
超魔导真红眼龙骑士卡组。
超魔导真红眼龙骑士卡组。
AI_LV3
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
SUPPORT_MASTER_RULE_2020
AI_LV3
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
SUPPORT_MASTER_RULE_2020
!我太帅了-水百凤凰勇者
Name
=我太帅了
Deck
=
Brave
Dialog
=
smart
.
zh
-
CN
水机百头龙凤凰人勇者卡组。
AI_LV3
SUPPORT_MASTER_RULE_2020
!玻璃女巫
!玻璃女巫
Name
=玻璃女巫
Deck
=
Witchcraft
Dialog
=
verre
.
zh
-
CN
Name
=玻璃女巫
Deck
=
Witchcraft
Dialog
=
verre
.
zh
-
CN
魔女术卡组。
魔女术卡组。
...
...
Decks/AI_Brave.ydk
0 → 100644
View file @
5950a280
#created by ...
#main
2563463
81866673
72090076
63362460
30680659
30680659
30680659
26202165
26202165
26202165
91646304
14558127
14558127
14558127
72291078
72291078
23434538
23434538
9742784
97268402
3285551
3285551
3285551
18144506
52947044
52947044
52947044
81439173
83764718
24224830
24224830
65681983
65681983
39568067
38745520
10045474
10045474
10045474
40605147
40605147
#extra
15291624
60461804
84815190
92519087
27548199
42566602
90953320
98558751
21915012
44097050
50588353
70369116
98978921
98978921
60303245
!side
55063751
55063751
55063751
34267821
34267821
34267821
43534808
43534808
43534808
94145021
94145021
94145021
14532163
14532163
14532163
Dialogs/smart.zh-CN.json
View file @
5950a280
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
"接下来就是我的舞台"
"接下来就是我的舞台"
],
],
"endturn"
:
[
"endturn"
:
[
"
我的回合结束,试试来击溃我吧
"
"
每个人的目的不同,我更注重强度,我只想赢。
"
],
],
"directattack"
:
[
"directattack"
:
[
"老子上了,要你的命"
"老子上了,要你的命"
...
...
Dialogs/verre.zh-CN.json
View file @
5950a280
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
"directattack"
:
[
"directattack"
:
[
"{0},直接攻击!"
,
"{0},直接攻击!"
,
"不过如此嘛,直接攻击!"
,
"不过如此嘛,直接攻击!"
,
"快走开,我要回去睡觉了。"
,
"快走开,我要回去睡觉了。"
],
],
"attack"
:
[
"attack"
:
[
"{0},攻击{1}!"
,
"{0},攻击{1}!"
,
...
...
Game/AI/Decks/BraveExecutor.cs
0 → 100644
View file @
5950a280
This diff is collapsed.
Click to expand it.
Game/AI/Decks/GrenMajuThunderBoarderExecutor.cs
View file @
5950a280
...
@@ -523,7 +523,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -523,7 +523,7 @@ namespace WindBot.Game.AI.Decks
targets
.
Add
(
e_c
);
targets
.
Add
(
e_c
);
if
(
targets
.
Count
>=
5
)
if
(
targets
.
Count
>=
5
)
{
{
AI
.
Select
Card
(
targets
);
AI
.
Select
Materials
(
targets
,
HintMsg
.
Remove
);
/*AI.SelectCard(new[] {
/*AI.SelectCard(new[] {
CardId.BingirsuTheWorldChaliceWarrior,
CardId.BingirsuTheWorldChaliceWarrior,
CardId.TopologicTrisbaena,
CardId.TopologicTrisbaena,
...
@@ -547,8 +547,8 @@ namespace WindBot.Game.AI.Decks
...
@@ -547,8 +547,8 @@ namespace WindBot.Game.AI.Decks
{
{
targets
.
Add
(
s_c
);
targets
.
Add
(
s_c
);
if
(
targets
.
Count
>=
5
)
if
(
targets
.
Count
>=
5
)
{
{
AI
.
Select
Card
(
targets
);
AI
.
Select
Materials
(
targets
,
HintMsg
.
Remove
);
return
true
;
return
true
;
}
}
}
}
...
...
Game/AI/Decks/PhantasmExecutor.cs
View file @
5950a280
...
@@ -468,13 +468,13 @@ namespace WindBot.Game.AI.Decks
...
@@ -468,13 +468,13 @@ namespace WindBot.Game.AI.Decks
IList
<
ClientCard
>
material_list
=
new
List
<
ClientCard
>();
IList
<
ClientCard
>
material_list
=
new
List
<
ClientCard
>();
if
(
Bot
.
HasInExtra
(
CardId
.
BorreloadDragon
))
if
(
Bot
.
HasInExtra
(
CardId
.
BorreloadDragon
))
{
{
AI
.
Select
Card
(
AI
.
Select
Materials
(
new
[]
{
CardId
.
TopologicBomberDragon
,
CardId
.
TopologicBomberDragon
,
CardId
.
TopologicTrisbaena
,
CardId
.
TopologicTrisbaena
,
CardId
.
KnightmareGryphon
,
CardId
.
KnightmareGryphon
,
CardId
.
SummonSorceress
,
CardId
.
SummonSorceress
,
CardId
.
BorreloadDragon
CardId
.
BorreloadDragon
);
},
HintMsg
.
Remove
);
}
}
else
else
{
{
...
@@ -482,7 +482,8 @@ namespace WindBot.Game.AI.Decks
...
@@ -482,7 +482,8 @@ namespace WindBot.Game.AI.Decks
{
{
if
(
material_list
.
Count
==
5
)
break
;
if
(
material_list
.
Count
==
5
)
break
;
material_list
.
Add
(
m
);
material_list
.
Add
(
m
);
}
}
AI
.
SelectMaterials
(
material_list
,
HintMsg
.
Remove
);
}
}
return
true
;
return
true
;
}
}
...
...
Game/AI/Decks/TrickstarExecutor.cs
View file @
5950a280
...
@@ -709,7 +709,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -709,7 +709,7 @@ namespace WindBot.Game.AI.Decks
targets
.
Add
(
e_c
);
targets
.
Add
(
e_c
);
if
(
targets
.
Count
>=
5
)
if
(
targets
.
Count
>=
5
)
{
{
AI
.
Select
Card
(
targets
);
AI
.
Select
Materials
(
targets
,
HintMsg
.
Remove
);
return
true
;
return
true
;
}
}
}
}
...
@@ -719,7 +719,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -719,7 +719,7 @@ namespace WindBot.Game.AI.Decks
targets
.
Add
(
s_c
);
targets
.
Add
(
s_c
);
if
(
targets
.
Count
>=
5
)
if
(
targets
.
Count
>=
5
)
{
{
AI
.
Select
Card
(
targets
);
AI
.
Select
Materials
(
targets
,
HintMsg
.
Remove
);
return
true
;
return
true
;
}
}
}
}
...
...
Game/AI/DefaultExecutor.cs
View file @
5950a280
...
@@ -63,6 +63,7 @@ namespace WindBot.Game.AI
...
@@ -63,6 +63,7 @@ namespace WindBot.Game.AI
public
const
int
SolemnWarning
=
84749824
;
public
const
int
SolemnWarning
=
84749824
;
public
const
int
SolemnStrike
=
40605147
;
public
const
int
SolemnStrike
=
40605147
;
public
const
int
TorrentialTribute
=
53582587
;
public
const
int
TorrentialTribute
=
53582587
;
public
const
int
EvenlyMatched
=
15693423
;
public
const
int
HeavyStorm
=
19613556
;
public
const
int
HeavyStorm
=
19613556
;
public
const
int
HammerShot
=
26412047
;
public
const
int
HammerShot
=
26412047
;
public
const
int
DarkHole
=
53129443
;
public
const
int
DarkHole
=
53129443
;
...
@@ -106,6 +107,7 @@ namespace WindBot.Game.AI
...
@@ -106,6 +107,7 @@ namespace WindBot.Game.AI
public
const
int
MacroCosmos
=
30241314
;
public
const
int
MacroCosmos
=
30241314
;
public
const
int
UpstartGoblin
=
70368879
;
public
const
int
UpstartGoblin
=
70368879
;
public
const
int
CyberEmergency
=
60600126
;
public
const
int
CyberEmergency
=
60600126
;
public
const
int
TheAgentOfCreationVenus
=
64734921
;
public
const
int
EaterOfMillions
=
63845230
;
public
const
int
EaterOfMillions
=
63845230
;
...
@@ -471,7 +473,8 @@ namespace WindBot.Game.AI
...
@@ -471,7 +473,8 @@ namespace WindBot.Game.AI
int
[]
ignoreList
=
{
int
[]
ignoreList
=
{
_CardId
.
MacroCosmos
,
_CardId
.
MacroCosmos
,
_CardId
.
UpstartGoblin
,
_CardId
.
UpstartGoblin
,
_CardId
.
CyberEmergency
_CardId
.
CyberEmergency
,
_CardId
.
TheAgentOfCreationVenus
};
};
if
(
Util
.
GetLastChainCard
().
IsCode
(
ignoreList
))
if
(
Util
.
GetLastChainCard
().
IsCode
(
ignoreList
))
return
false
;
return
false
;
...
@@ -500,8 +503,9 @@ namespace WindBot.Game.AI
...
@@ -500,8 +503,9 @@ namespace WindBot.Game.AI
/// </summary>
/// </summary>
protected
bool
DefaultEffectVeiler
()
protected
bool
DefaultEffectVeiler
()
{
{
if
(
Util
.
GetLastChainCard
()
!=
null
&&
Util
.
GetLastChainCard
().
IsCode
(
_CardId
.
GalaxySoldier
)
&&
Enemy
.
Hand
.
Count
>=
3
)
return
false
;
ClientCard
LastChainCard
=
Util
.
GetLastChainCard
();
if
(
Util
.
ChainContainsCard
(
_CardId
.
EffectVeiler
))
if
(
LastChainCard
!=
null
&&
(
LastChainCard
.
IsCode
(
_CardId
.
GalaxySoldier
)
&&
Enemy
.
Hand
.
Count
>=
3
||
LastChainCard
.
IsCode
(
_CardId
.
EffectVeiler
,
_CardId
.
InfiniteImpermanence
)))
return
false
;
return
false
;
return
DefaultBreakthroughSkill
();
return
DefaultBreakthroughSkill
();
}
}
...
@@ -539,7 +543,9 @@ namespace WindBot.Game.AI
...
@@ -539,7 +543,9 @@ namespace WindBot.Game.AI
protected
bool
DefaultInfiniteImpermanence
()
protected
bool
DefaultInfiniteImpermanence
()
{
{
// TODO: disable s & t
// TODO: disable s & t
if
(!
DefaultUniqueTrap
())
ClientCard
LastChainCard
=
Util
.
GetLastChainCard
();
if
(
LastChainCard
!=
null
&&
(
LastChainCard
.
IsCode
(
_CardId
.
GalaxySoldier
)
&&
Enemy
.
Hand
.
Count
>=
3
||
LastChainCard
.
IsCode
(
_CardId
.
EffectVeiler
,
_CardId
.
InfiniteImpermanence
)))
return
false
;
return
false
;
return
DefaultDisableMonster
();
return
DefaultDisableMonster
();
}
}
...
@@ -788,16 +794,17 @@ namespace WindBot.Game.AI
...
@@ -788,16 +794,17 @@ namespace WindBot.Game.AI
_CardId
.
EvilswarmExcitonKnight
,
_CardId
.
EvilswarmExcitonKnight
,
_CardId
.
BlackRoseDragon
,
_CardId
.
BlackRoseDragon
,
_CardId
.
JudgmentDragon
,
_CardId
.
JudgmentDragon
,
_CardId
.
TopologicTrisbaena
_CardId
.
TopologicTrisbaena
,
_CardId
.
EvenlyMatched
};
};
int
[]
destroyAllOpponentList
=
int
[]
destroyAllOpponent
Spell
List
=
{
{
_CardId
.
HarpiesFeatherDuster
,
_CardId
.
HarpiesFeatherDuster
,
_CardId
.
DarkMagicAttack
_CardId
.
DarkMagicAttack
};
};
if
(
Util
.
ChainContainsCard
(
destroyAllList
))
return
true
;
if
(
Util
.
ChainContainsCard
(
destroyAllList
))
return
true
;
if
(
Enemy
.
HasInSpellZone
(
destroyAllOpponent
List
,
true
)
)
return
true
;
if
(
Enemy
.
HasInSpellZone
(
destroyAllOpponent
SpellList
,
true
)
&&
Card
.
Location
==
CardLocation
.
SpellZone
)
return
true
;
// TODO: ChainContainsCard(id, player)
// TODO: ChainContainsCard(id, player)
return
false
;
return
false
;
}
}
...
...
Game/AI/Zones.cs
View file @
5950a280
...
@@ -10,6 +10,8 @@
...
@@ -10,6 +10,8 @@
z5
=
0x20
,
z5
=
0x20
,
z6
=
0x40
,
z6
=
0x40
,
FieldZone
=
0x20
,
MonsterZones
=
0x7f
,
MonsterZones
=
0x7f
,
MainMonsterZones
=
0x1f
,
MainMonsterZones
=
0x1f
,
ExtraMonsterZones
=
0x60
,
ExtraMonsterZones
=
0x60
,
...
...
Game/ClientField.cs
View file @
5950a280
...
@@ -248,6 +248,11 @@ namespace WindBot.Game
...
@@ -248,6 +248,11 @@ namespace WindBot.Game
return
HasInHand
(
cardId
)
||
HasInGraveyard
(
cardId
);
return
HasInHand
(
cardId
)
||
HasInGraveyard
(
cardId
);
}
}
public
bool
HasInGraveyardOrInBanished
(
int
cardId
)
{
return
HasInBanished
(
cardId
)
||
HasInGraveyard
(
cardId
);
}
public
bool
HasInMonstersZoneOrInGraveyard
(
int
cardId
)
public
bool
HasInMonstersZoneOrInGraveyard
(
int
cardId
)
{
{
return
HasInMonstersZone
(
cardId
)
||
HasInGraveyard
(
cardId
);
return
HasInMonstersZone
(
cardId
)
||
HasInGraveyard
(
cardId
);
...
...
Game/Duel.cs
View file @
5950a280
...
@@ -88,7 +88,7 @@ namespace WindBot.Game
...
@@ -88,7 +88,7 @@ namespace WindBot.Game
ClientCard
card
=
cards
[
seq
];
ClientCard
card
=
cards
[
seq
];
if
(
card
==
null
||
subSeq
>=
card
.
Overlays
.
Count
)
if
(
card
==
null
||
subSeq
>=
card
.
Overlays
.
Count
)
return
null
;
return
null
;
return
n
ull
;
// TODO card.Overlays[subSeq]
return
n
ew
ClientCard
(
card
.
Overlays
[
subSeq
],
CardLocation
.
Overlay
,
0
,
0
);
}
}
return
cards
[
seq
];
return
cards
[
seq
];
...
...
Game/GameAI.cs
View file @
5950a280
...
@@ -98,6 +98,7 @@ namespace WindBot.Game
...
@@ -98,6 +98,7 @@ namespace WindBot.Game
m_position
.
Clear
();
m_position
.
Clear
();
m_selector_pointer
=
-
1
;
m_selector_pointer
=
-
1
;
m_materialSelector
=
null
;
m_materialSelector
=
null
;
m_materialSelectorHint
=
0
;
m_option
=
-
1
;
m_option
=
-
1
;
m_yesno
=
-
1
;
m_yesno
=
-
1
;
m_announce
=
0
;
m_announce
=
0
;
...
@@ -267,8 +268,16 @@ namespace WindBot.Game
...
@@ -267,8 +268,16 @@ namespace WindBot.Game
}
}
else
else
{
{
// Update the next selector.
if
(
m_materialSelector
!=
null
&&
hint
==
m_materialSelectorHint
)
selector
=
GetSelectedCards
();
{
//Logger.DebugWriteLine("m_materialSelector hint match");
selector
=
m_materialSelector
;
}
else
{
// Update the next selector.
selector
=
GetSelectedCards
();
}
}
}
// If we selected a card, use this card.
// If we selected a card, use this card.
...
@@ -464,13 +473,13 @@ namespace WindBot.Game
...
@@ -464,13 +473,13 @@ namespace WindBot.Game
/// <returns>Index of the selected option.</returns>
/// <returns>Index of the selected option.</returns>
public
int
OnSelectOption
(
IList
<
int
>
options
)
public
int
OnSelectOption
(
IList
<
int
>
options
)
{
{
if
(
m_option
!=
-
1
&&
m_option
<
options
.
Count
)
return
m_option
;
int
result
=
Executor
.
OnSelectOption
(
options
);
int
result
=
Executor
.
OnSelectOption
(
options
);
if
(
result
!=
-
1
)
if
(
result
!=
-
1
)
return
result
;
return
result
;
if
(
m_option
!=
-
1
&&
m_option
<
options
.
Count
)
return
m_option
;
return
0
;
// Always select the first option.
return
0
;
// Always select the first option.
}
}
...
@@ -745,6 +754,7 @@ namespace WindBot.Game
...
@@ -745,6 +754,7 @@ namespace WindBot.Game
private
CardSelector
m_materialSelector
;
private
CardSelector
m_materialSelector
;
private
int
m_materialSelectorHint
;
private
int
m_place
;
private
int
m_place
;
private
int
m_option
;
private
int
m_option
;
private
int
m_number
;
private
int
m_number
;
...
@@ -912,34 +922,40 @@ namespace WindBot.Game
...
@@ -912,34 +922,40 @@ namespace WindBot.Game
m_selector
.
Insert
(
m_selector_pointer
,
new
CardSelector
(
loc
));
m_selector
.
Insert
(
m_selector_pointer
,
new
CardSelector
(
loc
));
}
}
public
void
SelectMaterials
(
ClientCard
card
)
public
void
SelectMaterials
(
ClientCard
card
,
int
hint
=
0
)
{
{
m_materialSelector
=
new
CardSelector
(
card
);
m_materialSelector
=
new
CardSelector
(
card
);
m_materialSelectorHint
=
hint
;
}
}
public
void
SelectMaterials
(
IList
<
ClientCard
>
cards
)
public
void
SelectMaterials
(
IList
<
ClientCard
>
cards
,
int
hint
=
0
)
{
{
m_materialSelector
=
new
CardSelector
(
cards
);
m_materialSelector
=
new
CardSelector
(
cards
);
m_materialSelectorHint
=
hint
;
}
}
public
void
SelectMaterials
(
int
cardId
)
public
void
SelectMaterials
(
int
cardId
,
int
hint
=
0
)
{
{
m_materialSelector
=
new
CardSelector
(
cardId
);
m_materialSelector
=
new
CardSelector
(
cardId
);
m_materialSelectorHint
=
hint
;
}
}
public
void
SelectMaterials
(
IList
<
int
>
ids
)
public
void
SelectMaterials
(
IList
<
int
>
ids
,
int
hint
=
0
)
{
{
m_materialSelector
=
new
CardSelector
(
ids
);
m_materialSelector
=
new
CardSelector
(
ids
);
m_materialSelectorHint
=
hint
;
}
}
public
void
SelectMaterials
(
CardLocation
loc
)
public
void
SelectMaterials
(
CardLocation
loc
,
int
hint
=
0
)
{
{
m_materialSelector
=
new
CardSelector
(
loc
);
m_materialSelector
=
new
CardSelector
(
loc
);
m_materialSelectorHint
=
hint
;
}
}
public
void
CleanSelectMaterials
()
public
void
CleanSelectMaterials
()
{
{
m_materialSelector
=
null
;
m_materialSelector
=
null
;
m_materialSelectorHint
=
0
;
}
}
public
bool
HaveSelectedCards
()
public
bool
HaveSelectedCards
()
...
...
Game/GameBehavior.cs
View file @
5950a280
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.IO
;
using
System.Linq
;
using
System.Text.RegularExpressions
;
using
System.Text.RegularExpressions
;
using
WindBot.Game.AI
;
using
WindBot.Game.AI
;
using
YGOSharp.Network
;
using
YGOSharp.Network
;
...
@@ -105,6 +106,7 @@ namespace WindBot.Game
...
@@ -105,6 +106,7 @@ namespace WindBot.Game
_messages
.
Add
(
GameMessage
.
ShuffleHand
,
OnShuffleHand
);
_messages
.
Add
(
GameMessage
.
ShuffleHand
,
OnShuffleHand
);
_messages
.
Add
(
GameMessage
.
ShuffleExtra
,
OnShuffleExtra
);
_messages
.
Add
(
GameMessage
.
ShuffleExtra
,
OnShuffleExtra
);
_messages
.
Add
(
GameMessage
.
ShuffleSetCard
,
OnShuffleSetCard
);
_messages
.
Add
(
GameMessage
.
ShuffleSetCard
,
OnShuffleSetCard
);
_messages
.
Add
(
GameMessage
.
SwapGraveDeck
,
OnSwapGraveDeck
);
_messages
.
Add
(
GameMessage
.
TagSwap
,
OnTagSwap
);
_messages
.
Add
(
GameMessage
.
TagSwap
,
OnTagSwap
);
_messages
.
Add
(
GameMessage
.
NewTurn
,
OnNewTurn
);
_messages
.
Add
(
GameMessage
.
NewTurn
,
OnNewTurn
);
_messages
.
Add
(
GameMessage
.
NewPhase
,
OnNewPhase
);
_messages
.
Add
(
GameMessage
.
NewPhase
,
OnNewPhase
);
...
@@ -489,6 +491,36 @@ namespace WindBot.Game
...
@@ -489,6 +491,36 @@ namespace WindBot.Game
}
}
}
}
private
void
OnSwapGraveDeck
(
BinaryReader
packet
)
{
int
player
=
GetLocalPlayer
(
packet
.
ReadByte
());
IList
<
ClientCard
>
tmpDeckList
=
_duel
.
Fields
[
player
].
Deck
.
ToList
();
_duel
.
Fields
[
player
].
Deck
.
Clear
();
int
seq
=
0
;
foreach
(
var
card
in
_duel
.
Fields
[
player
].
Graveyard
)
{
if
(
card
.
IsExtraCard
())
{
_duel
.
Fields
[
player
].
ExtraDeck
.
Add
(
card
);
card
.
Location
=
CardLocation
.
Extra
;
card
.
Position
=
(
int
)
CardPosition
.
FaceDown
;
// TODO: face-up P cards
}
else
{
_duel
.
Fields
[
player
].
Deck
.
Add
(
card
);
card
.
Location
=
CardLocation
.
Deck
;
card
.
Sequence
=
seq
++;
}
}
_duel
.
Fields
[
player
].
Graveyard
.
Clear
();
foreach
(
var
card
in
tmpDeckList
)
{
_duel
.
Fields
[
player
].
Graveyard
.
Add
(
card
);
card
.
Location
=
CardLocation
.
Grave
;
}
}
private
void
OnTagSwap
(
BinaryReader
packet
)
private
void
OnTagSwap
(
BinaryReader
packet
)
{
{
int
player
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
player
=
GetLocalPlayer
(
packet
.
ReadByte
());
...
@@ -1039,6 +1071,7 @@ namespace WindBot.Game
...
@@ -1039,6 +1071,7 @@ namespace WindBot.Game
int
seq
=
packet
.
ReadByte
();
int
seq
=
packet
.
ReadByte
();
packet
.
ReadByte
();
// pos
packet
.
ReadByte
();
// pos
}
}
if
(
count2
==
0
)
cancelable
=
false
;
IList
<
ClientCard
>
selected
=
func
(
cards
,
(
finishable
?
0
:
1
),
1
,
_select_hint
,
cancelable
);
IList
<
ClientCard
>
selected
=
func
(
cards
,
(
finishable
?
0
:
1
),
1
,
_select_hint
,
cancelable
);
...
@@ -1297,6 +1330,12 @@ namespace WindBot.Game
...
@@ -1297,6 +1330,12 @@ namespace WindBot.Game
location
=
CardLocation
.
SpellZone
;
location
=
CardLocation
.
SpellZone
;
filter
=
(
field
>>
8
)
&
Zones
.
SpellZones
;
filter
=
(
field
>>
8
)
&
Zones
.
SpellZones
;
}
}
else
if
((
field
&
0x2000
)
!=
0
)
{
player
=
0
;
location
=
CardLocation
.
FieldZone
;
filter
=
Zones
.
FieldZone
;
}
else
if
((
field
&
0xc000
)
!=
0
)
else
if
((
field
&
0xc000
)
!=
0
)
{
{
player
=
0
;
player
=
0
;
...
@@ -1315,6 +1354,12 @@ namespace WindBot.Game
...
@@ -1315,6 +1354,12 @@ namespace WindBot.Game
location
=
CardLocation
.
SpellZone
;
location
=
CardLocation
.
SpellZone
;
filter
=
(
field
>>
24
)
&
Zones
.
SpellZones
;
filter
=
(
field
>>
24
)
&
Zones
.
SpellZones
;
}
}
else
if
((
field
&
0x20000000
)
!=
0
)
{
player
=
1
;
location
=
CardLocation
.
FieldZone
;
filter
=
Zones
.
FieldZone
;
}
else
else
{
{
player
=
1
;
player
=
1
;
...
@@ -1328,7 +1373,7 @@ namespace WindBot.Game
...
@@ -1328,7 +1373,7 @@ namespace WindBot.Game
byte
[]
resp
=
new
byte
[
3
];
byte
[]
resp
=
new
byte
[
3
];
resp
[
0
]
=
(
byte
)
GetLocalPlayer
(
player
);
resp
[
0
]
=
(
byte
)
GetLocalPlayer
(
player
);
if
(
location
!=
CardLocation
.
PendulumZone
)
if
(
location
!=
CardLocation
.
PendulumZone
&&
location
!=
CardLocation
.
FieldZone
)
{
{
resp
[
1
]
=
(
byte
)
location
;
resp
[
1
]
=
(
byte
)
location
;
if
((
selected
&
filter
)
>
0
)
if
((
selected
&
filter
)
>
0
)
...
@@ -1348,8 +1393,9 @@ namespace WindBot.Game
...
@@ -1348,8 +1393,9 @@ namespace WindBot.Game
if
((
selected
&
filter
)
>
0
)
if
((
selected
&
filter
)
>
0
)
filter
&=
selected
;
filter
&=
selected
;
if
((
filter
&
Zones
.
z0
)
!=
0
)
resp
[
2
]
=
6
;
if
((
filter
&
Zones
.
FieldZone
)
!=
0
)
resp
[
2
]
=
5
;
if
((
filter
&
Zones
.
z1
)
!=
0
)
resp
[
2
]
=
7
;
if
((
filter
&
Zones
.
z0
)
!=
0
)
resp
[
2
]
=
6
;
// left pendulum zone
if
((
filter
&
Zones
.
z1
)
!=
0
)
resp
[
2
]
=
7
;
// right pendulum zone
}
}
BinaryWriter
reply
=
GamePacketFactory
.
Create
(
CtosMessage
.
Response
);
BinaryWriter
reply
=
GamePacketFactory
.
Create
(
CtosMessage
.
Response
);
...
...
Program.cs
View file @
5950a280
...
@@ -52,6 +52,9 @@ namespace WindBot
...
@@ -52,6 +52,9 @@ namespace WindBot
if
(!
File
.
Exists
(
absolutePath
))
if
(!
File
.
Exists
(
absolutePath
))
// In case windbot is placed in a folder under ygopro folder
// In case windbot is placed in a folder under ygopro folder
absolutePath
=
Path
.
GetFullPath
(
"../"
+
databasePath
);
absolutePath
=
Path
.
GetFullPath
(
"../"
+
databasePath
);
if
(!
File
.
Exists
(
absolutePath
))
// In case windbot is placed in a folder under ygopro2 folder
absolutePath
=
Path
.
GetFullPath
(
"../cdb/"
+
databasePath
);
if
(!
File
.
Exists
(
absolutePath
))
if
(!
File
.
Exists
(
absolutePath
))
{
{
Logger
.
WriteErrorLine
(
"Can't find cards database file."
);
Logger
.
WriteErrorLine
(
"Can't find cards database file."
);
...
...
README.md
View file @
5950a280
...
@@ -79,6 +79,8 @@ WindBot can run as a "server", provide a http interface to create bot.
...
@@ -79,6 +79,8 @@ WindBot can run as a "server", provide a http interface to create bot.
*
BlueEyesMaxDragon
*
BlueEyesMaxDragon
*
Brave
*
ChainBurn
*
ChainBurn
*
DarkMagician
*
DarkMagician
...
...
WindBot.csproj
View file @
5950a280
...
@@ -70,6 +70,7 @@
...
@@ -70,6 +70,7 @@
<Compile
Include=
"Game\AI\DeckAttribute.cs"
/>
<Compile
Include=
"Game\AI\DeckAttribute.cs"
/>
<Compile
Include=
"Game\AI\DecksManager.cs"
/>
<Compile
Include=
"Game\AI\DecksManager.cs"
/>
<Compile
Include=
"Game\AI\Decks\AltergeistExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\AltergeistExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\BraveExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\FamiliarPossessedExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\FamiliarPossessedExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\BlackwingExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\BlackwingExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\LuckyExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\LuckyExecutor.cs"
/>
...
...
WindBotInfo.cs
View file @
5950a280
...
@@ -26,7 +26,7 @@ namespace WindBot
...
@@ -26,7 +26,7 @@ namespace WindBot
Host
=
"127.0.0.1"
;
Host
=
"127.0.0.1"
;
Port
=
7911
;
Port
=
7911
;
HostInfo
=
""
;
HostInfo
=
""
;
Version
=
0x135
3
;
Version
=
0x135
4
;
Hand
=
0
;
Hand
=
0
;
Debug
=
false
;
Debug
=
false
;
Chat
=
true
;
Chat
=
true
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment