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
9a3e147a
Commit
9a3e147a
authored
May 23, 2018
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix OnMove, use same card instead of creating a new one
parent
8aa7ef14
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
23 deletions
+50
-23
Game/Duel.cs
Game/Duel.cs
+30
-0
Game/GameBehavior.cs
Game/GameBehavior.cs
+20
-23
No files found.
Game/Duel.cs
View file @
9a3e147a
...
@@ -115,6 +115,36 @@ namespace WindBot.Game
...
@@ -115,6 +115,36 @@ namespace WindBot.Game
}
}
}
}
public
void
AddCard
(
CardLocation
loc
,
ClientCard
card
,
int
player
,
int
zone
,
int
pos
)
{
card
.
Location
=
loc
;
card
.
Position
=
pos
;
switch
(
loc
)
{
case
CardLocation
.
Hand
:
Fields
[
player
].
Hand
.
Add
(
card
);
break
;
case
CardLocation
.
Grave
:
Fields
[
player
].
Graveyard
.
Add
(
card
);
break
;
case
CardLocation
.
Removed
:
Fields
[
player
].
Banished
.
Add
(
card
);
break
;
case
CardLocation
.
MonsterZone
:
Fields
[
player
].
MonsterZone
[
zone
]
=
card
;
break
;
case
CardLocation
.
SpellZone
:
Fields
[
player
].
SpellZone
[
zone
]
=
card
;
break
;
case
CardLocation
.
Deck
:
Fields
[
player
].
Deck
.
Add
(
card
);
break
;
case
CardLocation
.
Extra
:
Fields
[
player
].
ExtraDeck
.
Add
(
card
);
break
;
}
}
public
void
RemoveCard
(
CardLocation
loc
,
ClientCard
card
,
int
player
,
int
zone
)
public
void
RemoveCard
(
CardLocation
loc
,
ClientCard
card
,
int
player
,
int
zone
)
{
{
switch
(
loc
)
switch
(
loc
)
...
...
Game/GameBehavior.cs
View file @
9a3e147a
...
@@ -451,44 +451,41 @@ namespace WindBot.Game
...
@@ -451,44 +451,41 @@ namespace WindBot.Game
private
void
OnMove
(
BinaryReader
packet
)
private
void
OnMove
(
BinaryReader
packet
)
{
{
int
cardId
=
packet
.
ReadInt32
();
int
cardId
=
packet
.
ReadInt32
();
int
p
c
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
p
reviousControler
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
p
l
=
packet
.
ReadByte
();
int
p
reviousLocation
=
packet
.
ReadByte
();
int
p
s
=
packet
.
ReadSByte
();
int
p
reviousSequence
=
packet
.
ReadSByte
();
packet
.
ReadSByte
();
// pp
/*int previousPosotion = */
packet
.
ReadSByte
();
int
c
c
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
c
urrentControler
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
c
l
=
packet
.
ReadByte
();
int
c
urrentLocation
=
packet
.
ReadByte
();
int
c
s
=
packet
.
ReadSByte
();
int
c
urrentSequence
=
packet
.
ReadSByte
();
int
c
p
=
packet
.
ReadSByte
();
int
c
urrentPosition
=
packet
.
ReadSByte
();
packet
.
ReadInt32
();
// reason
packet
.
ReadInt32
();
// reason
ClientCard
card
=
_duel
.
GetCard
(
p
c
,
(
CardLocation
)
pl
,
ps
);
ClientCard
card
=
_duel
.
GetCard
(
p
reviousControler
,
(
CardLocation
)
previousLocation
,
previousSequence
);
if
((
p
l
&
(
int
)
CardLocation
.
Overlay
)
!=
0
)
if
((
p
reviousLocation
&
(
int
)
CardLocation
.
Overlay
)
!=
0
)
{
{
p
l
=
pl
&
0x7f
;
p
reviousLocation
=
previousLocation
&
0x7f
;
card
=
_duel
.
GetCard
(
p
c
,
(
CardLocation
)
pl
,
ps
);
card
=
_duel
.
GetCard
(
p
reviousControler
,
(
CardLocation
)
previousLocation
,
previousSequence
);
if
(
card
!=
null
)
if
(
card
!=
null
)
card
.
Overlays
.
Remove
(
cardId
);
card
.
Overlays
.
Remove
(
cardId
);
}
}
else
else
_duel
.
RemoveCard
((
CardLocation
)
p
l
,
card
,
pc
,
ps
);
_duel
.
RemoveCard
((
CardLocation
)
p
reviousLocation
,
card
,
previousControler
,
previousSequence
);
if
((
c
l
&
(
int
)
CardLocation
.
Overlay
)
!=
0
)
if
((
c
urrentLocation
&
(
int
)
CardLocation
.
Overlay
)
!=
0
)
{
{
c
l
=
cl
&
0x7f
;
c
urrentLocation
=
currentLocation
&
0x7f
;
card
=
_duel
.
GetCard
(
c
c
,
(
CardLocation
)
cl
,
cs
);
card
=
_duel
.
GetCard
(
c
urrentControler
,
(
CardLocation
)
currentLocation
,
currentSequence
);
if
(
card
!=
null
)
if
(
card
!=
null
)
card
.
Overlays
.
Add
(
cardId
);
card
.
Overlays
.
Add
(
cardId
);
}
}
else
else
{
{
_duel
.
AddCard
((
CardLocation
)
cl
,
cardId
,
cc
,
cs
,
cp
);
if
(
previousLocation
==
0
)
if
((
pl
&
(
int
)
CardLocation
.
Overlay
)
==
0
&&
card
!=
null
)
_duel
.
AddCard
((
CardLocation
)
currentLocation
,
cardId
,
currentControler
,
currentSequence
,
currentPosition
);
{
else
ClientCard
newcard
=
_duel
.
GetCard
(
cc
,
(
CardLocation
)
cl
,
cs
);
_duel
.
AddCard
((
CardLocation
)
currentLocation
,
card
,
currentControler
,
currentSequence
,
currentPosition
);
if
(
newcard
!=
null
)
newcard
.
Overlays
.
AddRange
(
card
.
Overlays
);
}
}
}
}
}
...
...
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