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
xiaoye
windbot
Commits
ef961874
Commit
ef961874
authored
Jun 15, 2022
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement SwapGraveDeck
parent
9d28e904
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
Game/GameBehavior.cs
Game/GameBehavior.cs
+32
-0
No files found.
Game/GameBehavior.cs
View file @
ef961874
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.Linq
;
using
System.Text.RegularExpressions
;
using
WindBot.Game.AI
;
using
YGOSharp.Network
;
...
...
@@ -93,6 +94,7 @@ namespace WindBot.Game
_messages
.
Add
(
GameMessage
.
ShuffleHand
,
OnShuffleHand
);
_messages
.
Add
(
GameMessage
.
ShuffleExtra
,
OnShuffleExtra
);
_messages
.
Add
(
GameMessage
.
ShuffleSetCard
,
OnShuffleSetCard
);
_messages
.
Add
(
GameMessage
.
SwapGraveDeck
,
OnSwapGraveDeck
);
_messages
.
Add
(
GameMessage
.
TagSwap
,
OnTagSwap
);
_messages
.
Add
(
GameMessage
.
NewTurn
,
OnNewTurn
);
_messages
.
Add
(
GameMessage
.
NewPhase
,
OnNewPhase
);
...
...
@@ -442,6 +444,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
)
{
int
player
=
GetLocalPlayer
(
packet
.
ReadByte
());
...
...
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