Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
W
Windbot-408
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
神之吹息
Windbot-408
Commits
d2925f39
Commit
d2925f39
authored
Apr 06, 2018
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add OnSelectBattleReplay
parent
98f7c3e1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
1 deletion
+36
-1
Game/AI/DefaultExecutor.cs
Game/AI/DefaultExecutor.cs
+15
-0
Game/AI/Executor.cs
Game/AI/Executor.cs
+6
-0
Game/GameAI.cs
Game/GameAI.cs
+9
-0
Game/GameBehavior.cs
Game/GameBehavior.cs
+6
-1
No files found.
Game/AI/DefaultExecutor.cs
View file @
d2925f39
...
...
@@ -127,6 +127,21 @@ namespace WindBot.Game.AI
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>
/// Destroy face-down cards first, in our turn.
/// </summary>
...
...
Game/AI/Executor.cs
View file @
d2925f39
...
...
@@ -153,6 +153,12 @@ namespace WindBot.Game.AI
return
-
1
;
}
public
virtual
bool
OnSelectBattleReplay
()
{
// Overrided in DefalultExecutor
return
false
;
}
public
void
SetMain
(
MainPhase
main
)
{
Main
=
main
;
...
...
Game/GameAI.cs
View file @
d2925f39
...
...
@@ -647,6 +647,15 @@ namespace WindBot.Game
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>
/// Called when the AI has to declare a card.
/// </summary>
...
...
Game/GameBehavior.cs
View file @
d2925f39
...
...
@@ -1180,7 +1180,12 @@ namespace WindBot.Game
private
void
OnSelectYesNo
(
BinaryReader
packet
)
{
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
);
}
...
...
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