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
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
MyCard
windbot
Commits
3674b020
Commit
3674b020
authored
Apr 25, 2018
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add part of AI.SelectPlace
selecting LinkedZones need to be implemented
parent
e0facc91
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
81 additions
and
39 deletions
+81
-39
Game/AI/Executor.cs
Game/AI/Executor.cs
+6
-0
Game/AI/Zones.cs
Game/AI/Zones.cs
+3
-3
Game/GameAI.cs
Game/GameAI.cs
+24
-0
Game/GameBehavior.cs
Game/GameBehavior.cs
+48
-36
No files found.
Game/AI/Executor.cs
View file @
3674b020
...
@@ -156,6 +156,12 @@ namespace WindBot.Game.AI
...
@@ -156,6 +156,12 @@ namespace WindBot.Game.AI
return
-
1
;
return
-
1
;
}
}
public
virtual
int
OnSelectPlace
(
int
cardId
,
int
player
,
int
location
,
int
available
)
{
// For overriding
return
0
;
}
public
virtual
CardPosition
OnSelectPosition
(
int
cardId
,
IList
<
CardPosition
>
positions
)
public
virtual
CardPosition
OnSelectPosition
(
int
cardId
,
IList
<
CardPosition
>
positions
)
{
{
// Overrided in DefalultExecutor
// Overrided in DefalultExecutor
...
...
Game/AI/Zones.cs
View file @
3674b020
namespace
WindBot.Game.AI
namespace
WindBot.Game.AI
{
{
public
enum
Zones
public
static
class
Zones
{
{
z0
=
0x1
,
public
const
int
z0
=
0x1
,
z1
=
0x2
,
z1
=
0x2
,
z2
=
0x4
,
z2
=
0x4
,
z3
=
0x8
,
z3
=
0x8
,
...
@@ -19,6 +19,6 @@
...
@@ -19,6 +19,6 @@
PendulumZones
=
0x3
,
PendulumZones
=
0x3
,
LinkedZones
=
0x10000
,
LinkedZones
=
0x10000
,
NotLinkedZones
=
0x20000
NotLinkedZones
=
0x20000
;
}
}
}
}
\ No newline at end of file
Game/GameAI.cs
View file @
3674b020
...
@@ -90,6 +90,7 @@ namespace WindBot.Game
...
@@ -90,6 +90,7 @@ namespace WindBot.Game
m_option
=
-
1
;
m_option
=
-
1
;
m_yesno
=
-
1
;
m_yesno
=
-
1
;
m_position
=
CardPosition
.
FaceUpAttack
;
m_position
=
CardPosition
.
FaceUpAttack
;
m_place
=
0
;
if
(
Duel
.
Player
==
0
&&
Duel
.
Phase
==
DuelPhase
.
Draw
)
if
(
Duel
.
Player
==
0
&&
Duel
.
Phase
==
DuelPhase
.
Draw
)
{
{
_dialogs
.
SendNewTurn
();
_dialogs
.
SendNewTurn
();
...
@@ -436,6 +437,23 @@ namespace WindBot.Game
...
@@ -436,6 +437,23 @@ namespace WindBot.Game
return
0
;
// Always select the first option.
return
0
;
// Always select the first option.
}
}
public
int
OnSelectPlace
(
int
cardId
,
int
player
,
int
location
,
int
available
)
{
int
selector_selected
=
m_place
;
m_place
=
0
;
int
executor_selected
=
Executor
.
OnSelectPlace
(
cardId
,
player
,
location
,
available
);
if
((
executor_selected
&
available
)
>
0
)
return
executor_selected
&
available
;
if
((
selector_selected
&
available
)
>
0
)
return
selector_selected
&
available
;
// TODO: LinkedZones
return
0
;
}
/// <summary>
/// <summary>
/// Called when the AI has to select a card position.
/// Called when the AI has to select a card position.
/// </summary>
/// </summary>
...
@@ -680,6 +698,7 @@ namespace WindBot.Game
...
@@ -680,6 +698,7 @@ namespace WindBot.Game
private
CardSelector
m_thirdSelector
;
private
CardSelector
m_thirdSelector
;
private
CardSelector
m_materialSelector
;
private
CardSelector
m_materialSelector
;
private
CardPosition
m_position
=
CardPosition
.
FaceUpAttack
;
private
CardPosition
m_position
=
CardPosition
.
FaceUpAttack
;
private
int
m_place
;
private
int
m_option
;
private
int
m_option
;
private
int
m_number
;
private
int
m_number
;
private
int
m_announce
;
private
int
m_announce
;
...
@@ -814,6 +833,11 @@ namespace WindBot.Game
...
@@ -814,6 +833,11 @@ namespace WindBot.Game
m_position
=
pos
;
m_position
=
pos
;
}
}
public
void
SelectPlace
(
int
zones
)
{
m_place
=
zones
;
}
public
void
SelectOption
(
int
opt
)
public
void
SelectOption
(
int
opt
)
{
{
m_option
=
opt
;
m_option
=
opt
;
...
...
Game/GameBehavior.cs
View file @
3674b020
...
@@ -1012,67 +1012,79 @@ namespace WindBot.Game
...
@@ -1012,67 +1012,79 @@ namespace WindBot.Game
packet
.
ReadByte
();
// min
packet
.
ReadByte
();
// min
int
field
=
~
packet
.
ReadInt32
();
int
field
=
~
packet
.
ReadInt32
();
byte
[]
resp
=
new
byte
[
3
];
const
int
LOCATION_MZONE
=
0x4
;
const
int
LOCATION_SZONE
=
0x8
;
bool
pendulumZone
=
false
;
const
int
LOCATION_PZONE
=
0x200
;
byte
LOCATION_MZONE
=
0x4
;
byte
LOCATION_SZONE
=
0x8
;
int
player
;
int
location
;
int
filter
;
int
filter
;
if
((
field
&
0x7f
)
!=
0
)
if
((
field
&
0x7f
)
!=
0
)
{
{
resp
[
0
]
=
(
byte
)
GetLocalPlayer
(
0
)
;
player
=
0
;
resp
[
1
]
=
LOCATION_MZONE
;
location
=
LOCATION_MZONE
;
filter
=
field
&
(
int
)
Zones
.
MonsterZones
;
filter
=
field
&
Zones
.
MonsterZones
;
}
}
else
if
((
field
&
0x1f00
)
!=
0
)
else
if
((
field
&
0x1f00
)
!=
0
)
{
{
resp
[
0
]
=
(
byte
)
GetLocalPlayer
(
0
)
;
player
=
0
;
resp
[
1
]
=
LOCATION_SZONE
;
location
=
LOCATION_SZONE
;
filter
=
(
field
>>
8
)
&
(
int
)
Zones
.
SpellZones
;
filter
=
(
field
>>
8
)
&
Zones
.
SpellZones
;
}
}
else
if
((
field
&
0xc000
)
!=
0
)
else
if
((
field
&
0xc000
)
!=
0
)
{
{
resp
[
0
]
=
(
byte
)
GetLocalPlayer
(
0
);
player
=
0
;
resp
[
1
]
=
LOCATION_SZONE
;
location
=
LOCATION_PZONE
;
filter
=
(
field
>>
14
)
&
(
int
)
Zones
.
PendulumZones
;
filter
=
(
field
>>
14
)
&
Zones
.
PendulumZones
;
pendulumZone
=
true
;
}
}
else
if
((
field
&
0x7f0000
)
!=
0
)
else
if
((
field
&
0x7f0000
)
!=
0
)
{
{
resp
[
0
]
=
(
byte
)
GetLocalPlayer
(
1
)
;
player
=
1
;
resp
[
1
]
=
LOCATION_MZONE
;
location
=
LOCATION_MZONE
;
filter
=
(
field
>>
16
)
&
(
int
)
Zones
.
MonsterZones
;
filter
=
(
field
>>
16
)
&
Zones
.
MonsterZones
;
}
}
else
if
((
field
&
0x1f000000
)
!=
0
)
else
if
((
field
&
0x1f000000
)
!=
0
)
{
{
resp
[
0
]
=
(
byte
)
GetLocalPlayer
(
1
)
;
player
=
1
;
resp
[
1
]
=
LOCATION_SZONE
;
location
=
LOCATION_SZONE
;
filter
=
(
field
>>
24
)
&
(
int
)
Zones
.
SpellZones
;
filter
=
(
field
>>
24
)
&
Zones
.
SpellZones
;
}
}
else
else
{
{
resp
[
0
]
=
(
byte
)
GetLocalPlayer
(
1
);
player
=
1
;
resp
[
1
]
=
LOCATION_SZONE
;
location
=
LOCATION_PZONE
;
filter
=
(
field
>>
30
)
&
(
int
)
Zones
.
PendulumZones
;
filter
=
(
field
>>
30
)
&
Zones
.
PendulumZones
;
pendulumZone
=
true
;
}
}
if
(!
pendulumZone
)
int
selected
=
_ai
.
OnSelectPlace
(
_select_hint
,
player
,
location
,
filter
);
_select_hint
=
0
;
byte
[]
resp
=
new
byte
[
3
];
resp
[
0
]
=
(
byte
)
GetLocalPlayer
(
player
);
if
(
location
!=
LOCATION_PZONE
)
{
{
if
((
filter
&
(
int
)
Zones
.
z6
)
!=
0
)
resp
[
2
]
=
6
;
resp
[
1
]
=
(
byte
)
location
;
else
if
((
filter
&
(
int
)
Zones
.
z5
)
!=
0
)
resp
[
2
]
=
5
;
if
((
selected
&
filter
)
>
0
)
else
if
((
filter
&
(
int
)
Zones
.
z2
)
!=
0
)
resp
[
2
]
=
2
;
filter
&=
selected
;
else
if
((
filter
&
(
int
)
Zones
.
z1
)
!=
0
)
resp
[
2
]
=
1
;
else
if
((
filter
&
(
int
)
Zones
.
z3
)
!=
0
)
resp
[
2
]
=
3
;
if
((
filter
&
Zones
.
z6
)
!=
0
)
resp
[
2
]
=
6
;
else
if
((
filter
&
(
int
)
Zones
.
z0
)
!=
0
)
resp
[
2
]
=
0
;
else
if
((
filter
&
Zones
.
z5
)
!=
0
)
resp
[
2
]
=
5
;
else
if
((
filter
&
(
int
)
Zones
.
z4
)
!=
0
)
resp
[
2
]
=
4
;
else
if
((
filter
&
Zones
.
z2
)
!=
0
)
resp
[
2
]
=
2
;
else
if
((
filter
&
Zones
.
z1
)
!=
0
)
resp
[
2
]
=
1
;
else
if
((
filter
&
Zones
.
z3
)
!=
0
)
resp
[
2
]
=
3
;
else
if
((
filter
&
Zones
.
z0
)
!=
0
)
resp
[
2
]
=
0
;
else
if
((
filter
&
Zones
.
z4
)
!=
0
)
resp
[
2
]
=
4
;
}
}
else
else
{
{
if
((
filter
&
(
int
)
Zones
.
z0
)
!=
0
)
resp
[
2
]
=
6
;
resp
[
1
]
=
(
byte
)
LOCATION_SZONE
;
if
((
filter
&
(
int
)
Zones
.
z1
)
!=
0
)
resp
[
2
]
=
7
;
if
((
selected
&
filter
)
>
0
)
filter
&=
selected
;
if
((
filter
&
Zones
.
z0
)
!=
0
)
resp
[
2
]
=
6
;
if
((
filter
&
Zones
.
z1
)
!=
0
)
resp
[
2
]
=
7
;
}
}
BinaryWriter
reply
=
GamePacketFactory
.
Create
(
CtosMessage
.
Response
);
BinaryWriter
reply
=
GamePacketFactory
.
Create
(
CtosMessage
.
Response
);
...
...
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