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
alstroemeria-silentlove
windbot
Commits
f81d9f58
Commit
f81d9f58
authored
Aug 29, 2018
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add ClientCard.OwnTargets
parent
af5a9bfc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
1 deletion
+58
-1
Game/ClientCard.cs
Game/ClientCard.cs
+18
-0
Game/GameBehavior.cs
Game/GameBehavior.cs
+40
-1
No files found.
Game/ClientCard.cs
View file @
f81d9f58
...
...
@@ -40,6 +40,8 @@ namespace WindBot.Game
public
List
<
ClientCard
>
EquipCards
{
get
;
set
;
}
public
ClientCard
EquipTarget
;
public
List
<
ClientCard
>
OwnTargets
{
get
;
set
;
}
public
List
<
ClientCard
>
TargetCards
{
get
;
set
;
}
public
bool
CanDirectAttack
{
get
;
set
;
}
public
bool
ShouldDirectAttack
{
get
;
set
;
}
...
...
@@ -62,6 +64,8 @@ namespace WindBot.Game
Position
=
position
;
Overlays
=
new
List
<
int
>();
EquipCards
=
new
List
<
ClientCard
>();
OwnTargets
=
new
List
<
ClientCard
>();
TargetCards
=
new
List
<
ClientCard
>();
ActionIndex
=
new
int
[
16
];
ActionActivateIndex
=
new
Dictionary
<
int
,
int
>();
Location
=
loc
;
...
...
@@ -154,6 +158,20 @@ namespace WindBot.Game
}
}
public
void
ClearCardTargets
()
{
foreach
(
ClientCard
card
in
TargetCards
)
{
card
.
OwnTargets
.
Remove
(
this
);
}
foreach
(
ClientCard
card
in
OwnTargets
)
{
card
.
TargetCards
.
Remove
(
this
);
}
OwnTargets
.
Clear
();
TargetCards
.
Clear
();
}
public
bool
HasLinkMarker
(
int
dir
)
{
return
(
LinkMarker
&
dir
)
!=
0
;
...
...
Game/GameBehavior.cs
View file @
f81d9f58
...
...
@@ -133,6 +133,8 @@ namespace WindBot.Game
_messages
.
Add
(
GameMessage
.
RockPaperScissors
,
OnRockPaperScissors
);
_messages
.
Add
(
GameMessage
.
Equip
,
OnEquip
);
_messages
.
Add
(
GameMessage
.
Unequip
,
OnUnEquip
);
_messages
.
Add
(
GameMessage
.
CardTarget
,
OnCardTarget
);
_messages
.
Add
(
GameMessage
.
CancelTarget
,
OnCancelTarget
);
_messages
.
Add
(
GameMessage
.
Summoning
,
OnSummoning
);
_messages
.
Add
(
GameMessage
.
Summoned
,
OnSummoned
);
_messages
.
Add
(
GameMessage
.
SpSummoning
,
OnSpSummoning
);
...
...
@@ -517,6 +519,7 @@ namespace WindBot.Game
private
void
OnMove
(
BinaryReader
packet
)
{
// TODO: update equip cards and target cards
int
cardId
=
packet
.
ReadInt32
();
int
previousControler
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
previousLocation
=
packet
.
ReadByte
();
...
...
@@ -631,12 +634,14 @@ namespace WindBot.Game
int
pc
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
pl
=
packet
.
ReadByte
();
int
ps
=
packet
.
ReadSByte
();
packet
.
ReadSByte
();
// pp
int
pp
=
packet
.
ReadSByte
();
int
cp
=
packet
.
ReadSByte
();
ClientCard
card
=
_duel
.
GetCard
(
pc
,
(
CardLocation
)
pl
,
ps
);
if
(
card
!=
null
)
{
card
.
Position
=
cp
;
if
((
pp
&
(
int
)
CardPosition
.
FaceUp
)
>
0
&&
(
cp
&
(
int
)
CardPosition
.
FaceDown
)
>
0
)
card
.
ClearCardTargets
();
if
(
_debug
)
Logger
.
WriteLine
(
"("
+
(
card
.
Name
??
"UnKnowCard"
)
+
" change position to "
+
(
CardPosition
)
cp
+
")"
);
}
...
...
@@ -1468,6 +1473,40 @@ namespace WindBot.Game
}
}
private
void
OnCardTarget
(
BinaryReader
packet
)
{
int
ownerCardControler
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
ownerCardLocation
=
packet
.
ReadByte
();
int
ownerCardSequence
=
packet
.
ReadSByte
();
packet
.
ReadByte
();
int
targetCardControler
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
targetCardLocation
=
packet
.
ReadByte
();
int
targetCardSequence
=
packet
.
ReadSByte
();
packet
.
ReadByte
();
ClientCard
ownerCard
=
_duel
.
GetCard
(
ownerCardControler
,
(
CardLocation
)
ownerCardLocation
,
ownerCardSequence
);
ClientCard
targetCard
=
_duel
.
GetCard
(
targetCardControler
,
(
CardLocation
)
targetCardLocation
,
targetCardSequence
);
if
(
ownerCard
==
null
||
targetCard
==
null
)
return
;
ownerCard
.
TargetCards
.
Add
(
targetCard
);
targetCard
.
OwnTargets
.
Add
(
ownerCard
);
}
private
void
OnCancelTarget
(
BinaryReader
packet
)
{
int
ownerCardControler
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
ownerCardLocation
=
packet
.
ReadByte
();
int
ownerCardSequence
=
packet
.
ReadSByte
();
packet
.
ReadByte
();
int
targetCardControler
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
targetCardLocation
=
packet
.
ReadByte
();
int
targetCardSequence
=
packet
.
ReadSByte
();
packet
.
ReadByte
();
ClientCard
ownerCard
=
_duel
.
GetCard
(
ownerCardControler
,
(
CardLocation
)
ownerCardLocation
,
ownerCardSequence
);
ClientCard
targetCard
=
_duel
.
GetCard
(
targetCardControler
,
(
CardLocation
)
targetCardLocation
,
targetCardSequence
);
if
(
ownerCard
==
null
||
targetCard
==
null
)
return
;
ownerCard
.
TargetCards
.
Remove
(
targetCard
);
targetCard
.
OwnTargets
.
Remove
(
ownerCard
);
}
private
void
OnSummoning
(
BinaryReader
packet
)
{
_duel
.
LastSummonedCards
.
Clear
();
...
...
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