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
5cf720d1
Commit
5cf720d1
authored
Apr 09, 2018
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add Executor.OnSelectPosition, make 0 atk monster go defense at default
parent
dd752335
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
6 deletions
+30
-6
Game/AI/DefaultExecutor.cs
Game/AI/DefaultExecutor.cs
+14
-0
Game/AI/Executor.cs
Game/AI/Executor.cs
+6
-0
Game/GameAI.cs
Game/GameAI.cs
+10
-6
No files found.
Game/AI/DefaultExecutor.cs
View file @
5cf720d1
...
...
@@ -127,6 +127,20 @@ namespace WindBot.Game.AI
return
true
;
}
/// <summary>
/// Called when the AI has to select a card position.
/// </summary>
/// <param name="cardId">Id of the card to position on the field.</param>
/// <param name="positions">List of available positions.</param>
/// <returns>Selected position, or 0 if no position is set for this card.</returns>
public
override
CardPosition
OnSelectPosition
(
int
cardId
,
IList
<
CardPosition
>
positions
)
{
YGOSharp
.
OCGWrapper
.
NamedCard
cardData
=
YGOSharp
.
OCGWrapper
.
NamedCard
.
Get
(
cardId
);
if
(
cardData
.
Attack
==
0
)
return
CardPosition
.
FaceUpDefence
;
return
base
.
OnSelectPosition
(
cardId
,
positions
);
}
public
override
bool
OnSelectBattleReplay
()
{
if
(
Bot
.
BattlingMonster
==
null
)
...
...
Game/AI/Executor.cs
View file @
5cf720d1
...
...
@@ -156,6 +156,12 @@ namespace WindBot.Game.AI
return
-
1
;
}
public
virtual
CardPosition
OnSelectPosition
(
int
cardId
,
IList
<
CardPosition
>
positions
)
{
// Overrided in DefalultExecutor
return
0
;
}
public
virtual
bool
OnSelectBattleReplay
()
{
// Overrided in DefalultExecutor
...
...
Game/GameAI.cs
View file @
5cf720d1
...
...
@@ -443,13 +443,17 @@ namespace WindBot.Game
/// <returns>Selected position.</returns>
public
CardPosition
OnSelectPosition
(
int
cardId
,
IList
<
CardPosition
>
positions
)
{
// Selects the selected position if available, the first available otherwise.
if
(
positions
.
Contains
(
m_position
))
{
CardPosition
old
=
m_position
;
CardPosition
selector_selected
=
m_position
;
m_position
=
CardPosition
.
FaceUpAttack
;
return
old
;
}
CardPosition
executor_selected
=
Executor
.
OnSelectPosition
(
cardId
,
positions
);
// Selects the selected position if available, the first available otherwise.
if
(
positions
.
Contains
(
executor_selected
))
return
executor_selected
;
if
(
positions
.
Contains
(
selector_selected
))
return
selector_selected
;
return
positions
[
0
];
}
...
...
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