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
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
MyCard
windbot
Commits
1d6da58b
Commit
1d6da58b
authored
Aug 20, 2018
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add SummoningCards, LastSummonedCards, IsSpecialSummoned
parent
702b0932
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
9 deletions
+59
-9
Game/AI/DefaultExecutor.cs
Game/AI/DefaultExecutor.cs
+2
-3
Game/ClientCard.cs
Game/ClientCard.cs
+1
-0
Game/Duel.cs
Game/Duel.cs
+4
-0
Game/GameAI.cs
Game/GameAI.cs
+0
-3
Game/GameBehavior.cs
Game/GameBehavior.cs
+52
-3
No files found.
Game/AI/DefaultExecutor.cs
View file @
1d6da58b
...
@@ -887,8 +887,7 @@ namespace WindBot.Game.AI
...
@@ -887,8 +887,7 @@ namespace WindBot.Game.AI
List
<
ClientCard
>
monsters
=
Bot
.
GetMonsters
();
List
<
ClientCard
>
monsters
=
Bot
.
GetMonsters
();
foreach
(
ClientCard
monster
in
monsters
)
foreach
(
ClientCard
monster
in
monsters
)
{
{
// The bot don't know if the card is special summoned, so let we assume all monsters are special summoned
if
(!
monster
.
Equals
(
Card
)
&&
monster
.
IsSpecialSummoned
&&
monster
.
HasType
(
CardType
.
Effect
)
&&
monster
.
Attack
<=
Card
.
Attack
)
if
(!
monster
.
Equals
(
Card
)
&&
monster
.
HasType
(
CardType
.
Effect
)
&&
monster
.
Attack
<=
Card
.
Attack
)
selfCount
++;
selfCount
++;
}
}
...
@@ -896,7 +895,7 @@ namespace WindBot.Game.AI
...
@@ -896,7 +895,7 @@ namespace WindBot.Game.AI
monsters
=
Enemy
.
GetMonsters
();
monsters
=
Enemy
.
GetMonsters
();
foreach
(
ClientCard
monster
in
monsters
)
foreach
(
ClientCard
monster
in
monsters
)
{
{
if
(
monster
.
HasType
(
CardType
.
Effect
)
&&
monster
.
Attack
<=
Card
.
Attack
)
if
(
monster
.
IsSpecialSummoned
&&
monster
.
HasType
(
CardType
.
Effect
)
&&
monster
.
Attack
<=
Card
.
Attack
)
oppoCount
++;
oppoCount
++;
}
}
...
...
Game/ClientCard.cs
View file @
1d6da58b
...
@@ -39,6 +39,7 @@ namespace WindBot.Game
...
@@ -39,6 +39,7 @@ namespace WindBot.Game
public
bool
ShouldDirectAttack
{
get
;
set
;
}
public
bool
ShouldDirectAttack
{
get
;
set
;
}
public
bool
Attacked
{
get
;
set
;
}
public
bool
Attacked
{
get
;
set
;
}
public
bool
IsLastAttacker
{
get
;
set
;
}
public
bool
IsLastAttacker
{
get
;
set
;
}
public
bool
IsSpecialSummoned
{
get
;
set
;
}
public
int
[]
ActionIndex
{
get
;
set
;
}
public
int
[]
ActionIndex
{
get
;
set
;
}
public
IDictionary
<
int
,
int
>
ActionActivateIndex
{
get
;
private
set
;
}
public
IDictionary
<
int
,
int
>
ActionActivateIndex
{
get
;
private
set
;
}
...
...
Game/Duel.cs
View file @
1d6da58b
...
@@ -21,6 +21,8 @@ namespace WindBot.Game
...
@@ -21,6 +21,8 @@ namespace WindBot.Game
public
IList
<
ClientCard
>
ChainTargets
{
get
;
set
;
}
public
IList
<
ClientCard
>
ChainTargets
{
get
;
set
;
}
public
IList
<
ClientCard
>
ChainTargetOnly
{
get
;
set
;
}
public
IList
<
ClientCard
>
ChainTargetOnly
{
get
;
set
;
}
public
int
LastSummonPlayer
{
get
;
set
;
}
public
int
LastSummonPlayer
{
get
;
set
;
}
public
IList
<
ClientCard
>
SummoningCards
{
get
;
set
;
}
public
IList
<
ClientCard
>
LastSummonedCards
{
get
;
set
;
}
public
Duel
()
public
Duel
()
{
{
...
@@ -32,6 +34,8 @@ namespace WindBot.Game
...
@@ -32,6 +34,8 @@ namespace WindBot.Game
ChainTargets
=
new
List
<
ClientCard
>();
ChainTargets
=
new
List
<
ClientCard
>();
ChainTargetOnly
=
new
List
<
ClientCard
>();
ChainTargetOnly
=
new
List
<
ClientCard
>();
LastSummonPlayer
=
-
1
;
LastSummonPlayer
=
-
1
;
SummoningCards
=
new
List
<
ClientCard
>();
LastSummonedCards
=
new
List
<
ClientCard
>();
}
}
public
ClientCard
GetCard
(
int
player
,
CardLocation
loc
,
int
index
)
public
ClientCard
GetCard
(
int
player
,
CardLocation
loc
,
int
index
)
...
...
Game/GameAI.cs
View file @
1d6da58b
...
@@ -430,7 +430,6 @@ namespace WindBot.Game
...
@@ -430,7 +430,6 @@ namespace WindBot.Game
if
(
ShouldExecute
(
exec
,
card
,
ExecutorType
.
SpSummon
))
if
(
ShouldExecute
(
exec
,
card
,
ExecutorType
.
SpSummon
))
{
{
_dialogs
.
SendSummon
(
card
.
Name
);
_dialogs
.
SendSummon
(
card
.
Name
);
Duel
.
LastSummonPlayer
=
0
;
return
new
MainPhaseAction
(
MainPhaseAction
.
MainAction
.
SpSummon
,
card
.
ActionIndex
);
return
new
MainPhaseAction
(
MainPhaseAction
.
MainAction
.
SpSummon
,
card
.
ActionIndex
);
}
}
}
}
...
@@ -439,7 +438,6 @@ namespace WindBot.Game
...
@@ -439,7 +438,6 @@ namespace WindBot.Game
if
(
ShouldExecute
(
exec
,
card
,
ExecutorType
.
Summon
))
if
(
ShouldExecute
(
exec
,
card
,
ExecutorType
.
Summon
))
{
{
_dialogs
.
SendSummon
(
card
.
Name
);
_dialogs
.
SendSummon
(
card
.
Name
);
Duel
.
LastSummonPlayer
=
0
;
return
new
MainPhaseAction
(
MainPhaseAction
.
MainAction
.
Summon
,
card
.
ActionIndex
);
return
new
MainPhaseAction
(
MainPhaseAction
.
MainAction
.
Summon
,
card
.
ActionIndex
);
}
}
if
(
ShouldExecute
(
exec
,
card
,
ExecutorType
.
SummonOrSet
))
if
(
ShouldExecute
(
exec
,
card
,
ExecutorType
.
SummonOrSet
))
...
@@ -451,7 +449,6 @@ namespace WindBot.Game
...
@@ -451,7 +449,6 @@ namespace WindBot.Game
return
new
MainPhaseAction
(
MainPhaseAction
.
MainAction
.
SetMonster
,
card
.
ActionIndex
);
return
new
MainPhaseAction
(
MainPhaseAction
.
MainAction
.
SetMonster
,
card
.
ActionIndex
);
}
}
_dialogs
.
SendSummon
(
card
.
Name
);
_dialogs
.
SendSummon
(
card
.
Name
);
Duel
.
LastSummonPlayer
=
0
;
return
new
MainPhaseAction
(
MainPhaseAction
.
MainAction
.
Summon
,
card
.
ActionIndex
);
return
new
MainPhaseAction
(
MainPhaseAction
.
MainAction
.
Summon
,
card
.
ActionIndex
);
}
}
}
}
...
...
Game/GameBehavior.cs
View file @
1d6da58b
...
@@ -129,8 +129,12 @@ namespace WindBot.Game
...
@@ -129,8 +129,12 @@ namespace WindBot.Game
_messages
.
Add
(
GameMessage
.
AnnounceCardFilter
,
OnAnnounceCard
);
_messages
.
Add
(
GameMessage
.
AnnounceCardFilter
,
OnAnnounceCard
);
_messages
.
Add
(
GameMessage
.
RockPaperScissors
,
OnRockPaperScissors
);
_messages
.
Add
(
GameMessage
.
RockPaperScissors
,
OnRockPaperScissors
);
_messages
.
Add
(
GameMessage
.
SpSummoning
,
OnSpSummon
);
_messages
.
Add
(
GameMessage
.
Summoning
,
OnSummoning
);
_messages
.
Add
(
GameMessage
.
SpSummoned
,
OnSpSummon
);
_messages
.
Add
(
GameMessage
.
Summoned
,
OnSummoned
);
_messages
.
Add
(
GameMessage
.
SpSummoning
,
OnSpSummoning
);
_messages
.
Add
(
GameMessage
.
SpSummoned
,
OnSpSummoned
);
_messages
.
Add
(
GameMessage
.
FlipSummoning
,
OnSummoning
);
_messages
.
Add
(
GameMessage
.
FlipSummoned
,
OnSummoned
);
}
}
private
void
OnJoinGame
(
BinaryReader
packet
)
private
void
OnJoinGame
(
BinaryReader
packet
)
...
@@ -478,6 +482,8 @@ namespace WindBot.Game
...
@@ -478,6 +482,8 @@ namespace WindBot.Game
if
(
_debug
)
if
(
_debug
)
Logger
.
WriteLine
(
"(Go to "
+
(
_duel
.
Phase
.
ToString
())
+
")"
);
Logger
.
WriteLine
(
"(Go to "
+
(
_duel
.
Phase
.
ToString
())
+
")"
);
_duel
.
LastSummonPlayer
=
-
1
;
_duel
.
LastSummonPlayer
=
-
1
;
_duel
.
SummoningCards
.
Clear
();
_duel
.
LastSummonedCards
.
Clear
();
_duel
.
Fields
[
0
].
BattlingMonster
=
null
;
_duel
.
Fields
[
0
].
BattlingMonster
=
null
;
_duel
.
Fields
[
1
].
BattlingMonster
=
null
;
_duel
.
Fields
[
1
].
BattlingMonster
=
null
;
_ai
.
OnNewPhase
();
_ai
.
OnNewPhase
();
...
@@ -557,6 +563,8 @@ namespace WindBot.Game
...
@@ -557,6 +563,8 @@ namespace WindBot.Game
else
else
{
{
_duel
.
AddCard
((
CardLocation
)
currentLocation
,
card
,
currentControler
,
currentSequence
,
currentPosition
,
cardId
);
_duel
.
AddCard
((
CardLocation
)
currentLocation
,
card
,
currentControler
,
currentSequence
,
currentPosition
,
cardId
);
if
(
card
!=
null
&&
previousLocation
!=
currentLocation
)
card
.
IsSpecialSummoned
=
false
;
if
(
_debug
&&
card
!=
null
)
if
(
_debug
&&
card
!=
null
)
Logger
.
WriteLine
(
"("
+
previousControler
.
ToString
()
+
" 's "
+
(
card
.
Name
??
"UnKnowCard"
)
Logger
.
WriteLine
(
"("
+
previousControler
.
ToString
()
+
" 's "
+
(
card
.
Name
??
"UnKnowCard"
)
+
" from "
+
+
" from "
+
...
@@ -1400,9 +1408,50 @@ namespace WindBot.Game
...
@@ -1400,9 +1408,50 @@ namespace WindBot.Game
Connection
.
Send
(
CtosMessage
.
Response
,
result
);
Connection
.
Send
(
CtosMessage
.
Response
,
result
);
}
}
private
void
OnS
pSummon
(
BinaryReader
packet
)
private
void
OnS
ummoning
(
BinaryReader
packet
)
{
{
_duel
.
LastSummonedCards
.
Clear
();
int
code
=
packet
.
ReadInt32
();
int
currentControler
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
currentLocation
=
packet
.
ReadByte
();
int
currentSequence
=
packet
.
ReadSByte
();
int
currentPosition
=
packet
.
ReadSByte
();
ClientCard
card
=
_duel
.
GetCard
(
currentControler
,
(
CardLocation
)
currentLocation
,
currentSequence
);
_duel
.
SummoningCards
.
Add
(
card
);
_duel
.
LastSummonPlayer
=
currentControler
;
}
private
void
OnSummoned
(
BinaryReader
packet
)
{
foreach
(
ClientCard
card
in
_duel
.
SummoningCards
)
{
_duel
.
LastSummonedCards
.
Add
(
card
);
}
_duel
.
SummoningCards
.
Clear
();
}
private
void
OnSpSummoning
(
BinaryReader
packet
)
{
_duel
.
LastSummonedCards
.
Clear
();
_ai
.
CleanSelectMaterials
();
_ai
.
CleanSelectMaterials
();
int
code
=
packet
.
ReadInt32
();
int
currentControler
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
currentLocation
=
packet
.
ReadByte
();
int
currentSequence
=
packet
.
ReadSByte
();
int
currentPosition
=
packet
.
ReadSByte
();
ClientCard
card
=
_duel
.
GetCard
(
currentControler
,
(
CardLocation
)
currentLocation
,
currentSequence
);
_duel
.
SummoningCards
.
Add
(
card
);
_duel
.
LastSummonPlayer
=
currentControler
;
}
private
void
OnSpSummoned
(
BinaryReader
packet
)
{
foreach
(
ClientCard
card
in
_duel
.
SummoningCards
)
{
card
.
IsSpecialSummoned
=
true
;
_duel
.
LastSummonedCards
.
Add
(
card
);
}
_duel
.
SummoningCards
.
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