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
d18e943d
Commit
d18e943d
authored
May 11, 2024
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add ExecutorType.Surrender
parent
3feb38fe
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
48 additions
and
2 deletions
+48
-2
Dialogs/default.json
Dialogs/default.json
+6
-0
Dialogs/gugugu.zh-CN.json
Dialogs/gugugu.zh-CN.json
+5
-0
Dialogs/zh-CN.json
Dialogs/zh-CN.json
+4
-0
Game/AI/Dialogs.cs
Game/AI/Dialogs.cs
+10
-1
Game/AI/ExecutorType.cs
Game/AI/ExecutorType.cs
+2
-1
Game/GameAI.cs
Game/GameAI.cs
+16
-0
Game/GameClient.cs
Game/GameClient.cs
+5
-0
No files found.
Dialogs/default.json
View file @
d18e943d
...
...
@@ -64,5 +64,11 @@
"Before you do that, I'll chain {0}!"
,
"Nice try, but I have {0}!"
,
"Didn't expect {0}, did you?"
],
"surrender"
:
[
"I surrender."
,
"You win this time."
,
"I can't win this duel."
,
"Good game."
]
}
\ No newline at end of file
Dialogs/gugugu.zh-CN.json
View file @
d18e943d
...
...
@@ -55,5 +55,10 @@
"但我鸽了"
,
"无此服务"
,
"可怕"
],
"surrender"
:
[
"太可怕了(跑路"
,
"这游戏好难玩(跑路"
,
"还好我不玩游戏王(跑路"
]
}
Dialogs/zh-CN.json
View file @
d18e943d
...
...
@@ -71,5 +71,9 @@
"我不认同。{0},发动!"
,
"看样子你忘了我的{0}!"
,
"你考虑过我有{0}吗?"
],
"surrender"
:
[
"我认输。"
,
"我承认你的胜利。"
]
}
Game/AI/Dialogs.cs
View file @
d18e943d
using
System
;
using
System
;
using
System.IO
;
using
System.Collections.Generic
;
using
System.Runtime.Serialization
;
...
...
@@ -36,6 +36,8 @@ namespace WindBot.Game.AI
[
DataMember
]
public
string
[]
chaining
{
get
;
set
;
}
[
DataMember
]
public
string
[]
surrender
{
get
;
set
;
}
[
DataMember
]
public
string
[]
custom
{
get
;
set
;
}
}
public
class
Dialogs
...
...
@@ -55,6 +57,7 @@ namespace WindBot.Game.AI
private
string
[]
_summon
;
private
string
[]
_setmonster
;
private
string
[]
_chaining
;
private
string
[]
_surrender
;
private
string
[]
_custom
;
public
Dialogs
(
GameClient
game
)
...
...
@@ -78,6 +81,7 @@ namespace WindBot.Game.AI
_summon
=
data
.
summon
;
_setmonster
=
data
.
setmonster
;
_chaining
=
data
.
chaining
;
_surrender
=
data
.
surrender
;
_custom
=
data
.
custom
;
}
}
...
...
@@ -162,6 +166,11 @@ namespace WindBot.Game.AI
InternalSendMessage
(
_chaining
,
card
);
}
public
void
SendSurrender
()
{
InternalSendMessage
(
_surrender
);
}
private
void
InternalSendMessage
(
IList
<
string
>
array
,
params
object
[]
opts
)
{
if
(!
_game
.
_chat
)
...
...
Game/AI/ExecutorType.cs
View file @
d18e943d
...
...
@@ -11,6 +11,7 @@
SummonOrSet
,
GoToBattlePhase
,
GoToMainPhase2
,
GoToEndPhase
GoToEndPhase
,
Surrender
}
}
\ No newline at end of file
Game/GameAI.cs
View file @
d18e943d
...
...
@@ -25,6 +25,18 @@ namespace WindBot.Game
_activatedCards
=
new
Dictionary
<
int
,
int
>();
}
private
void
CheckSurrender
()
{
foreach
(
CardExecutor
exec
in
Executor
.
Executors
)
{
if
(
exec
.
Type
==
ExecutorType
.
Surrender
&&
exec
.
Func
())
{
_dialogs
.
SendSurrender
();
Game
.
Surrender
();
}
}
}
/// <summary>
/// Called when the AI got the error message.
/// </summary>
...
...
@@ -117,6 +129,7 @@ namespace WindBot.Game
_dialogs
.
SendNewTurn
();
}
Executor
.
OnNewPhase
();
CheckSurrender
();
}
public
void
OnMove
(
ClientCard
card
,
int
previousControler
,
int
previousLocation
,
int
currentControler
,
int
currentLocation
)
...
...
@@ -130,6 +143,7 @@ namespace WindBot.Game
public
void
OnDirectAttack
(
ClientCard
card
)
{
_dialogs
.
SendOnDirectAttack
(
card
.
Name
);
CheckSurrender
();
}
/// <summary>
...
...
@@ -155,6 +169,7 @@ namespace WindBot.Game
m_selector
.
Clear
();
m_selector_pointer
=
-
1
;
Executor
.
OnChainEnd
();
CheckSurrender
();
}
/// <summary>
...
...
@@ -422,6 +437,7 @@ namespace WindBot.Game
public
MainPhaseAction
OnSelectIdleCmd
(
MainPhase
main
)
{
Executor
.
SetMain
(
main
);
CheckSurrender
();
foreach
(
CardExecutor
exec
in
Executor
.
Executors
)
{
if
(
exec
.
Type
==
ExecutorType
.
GoToEndPhase
&&
main
.
CanEndPhase
&&
exec
.
Func
())
// check if should enter end phase directly
...
...
Game/GameClient.cs
View file @
d18e943d
...
...
@@ -90,6 +90,11 @@ namespace WindBot.Game
Connection
.
Send
(
chat
);
}
public
void
Surrender
()
{
Connection
.
Send
(
CtosMessage
.
Surrender
);
}
private
void
OnPacketReceived
(
BinaryReader
reader
)
{
_behavior
.
OnPacket
(
reader
);
...
...
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