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
神之吹息
windbot
Commits
e5d5696d
Commit
e5d5696d
authored
Apr 11, 2018
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/moecube/windbot
parents
4eaca351
b2bf309b
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
844 additions
and
318 deletions
+844
-318
Decks/AI_ChainBurn.ydk
Decks/AI_ChainBurn.ydk
+3
-3
Game/AI/Decks/ChainBurnExecutor.cs
Game/AI/Decks/ChainBurnExecutor.cs
+207
-59
Game/AI/Decks/LightswornShaddoldinosourExecutor.cs
Game/AI/Decks/LightswornShaddoldinosourExecutor.cs
+424
-204
Game/AI/Decks/TrickstarExecutor.cs
Game/AI/Decks/TrickstarExecutor.cs
+161
-42
Game/AI/DefaultExecutor.cs
Game/AI/DefaultExecutor.cs
+20
-2
Game/AI/Executor.cs
Game/AI/Executor.cs
+6
-0
Game/GameAI.cs
Game/GameAI.cs
+10
-6
Game/GameBehavior.cs
Game/GameBehavior.cs
+13
-2
No files found.
Decks/AI_ChainBurn.ydk
View file @
e5d5696d
...
@@ -37,7 +37,6 @@
...
@@ -37,7 +37,6 @@
36361633
36361633
36361633
36361633
36361633
36361633
36468556
37576645
37576645
37576645
37576645
37576645
37576645
...
@@ -52,7 +51,6 @@
...
@@ -52,7 +51,6 @@
75249652
75249652
83555666
83555666
98444741
98444741
98444741
#extra
#extra
41999284
41999284
41999284
41999284
...
@@ -65,4 +63,6 @@
...
@@ -65,4 +63,6 @@
98444741
98444741
100227025
100227025
100227025
100227025
100227025
100227025
\ No newline at end of file
36468556
98444741
\ No newline at end of file
Game/AI/Decks/ChainBurnExecutor.cs
View file @
e5d5696d
This diff is collapsed.
Click to expand it.
Game/AI/Decks/LightswornShaddoldinosourExecutor.cs
View file @
e5d5696d
This diff is collapsed.
Click to expand it.
Game/AI/Decks/TrickstarExecutor.cs
View file @
e5d5696d
This diff is collapsed.
Click to expand it.
Game/AI/DefaultExecutor.cs
View file @
e5d5696d
...
@@ -127,6 +127,23 @@ namespace WindBot.Game.AI
...
@@ -127,6 +127,23 @@ namespace WindBot.Game.AI
return
true
;
return
true
;
}
}
/// <summary>
/// Called when the AI has to select a card position.
/// </summary>
/// <param name="cardId">Id of the card to position on the field.</param>
/// <param name="positions">List of available positions.</param>
/// <returns>Selected position, or 0 if no position is set for this card.</returns>
public
override
CardPosition
OnSelectPosition
(
int
cardId
,
IList
<
CardPosition
>
positions
)
{
YGOSharp
.
OCGWrapper
.
NamedCard
cardData
=
YGOSharp
.
OCGWrapper
.
NamedCard
.
Get
(
cardId
);
if
(
cardData
!=
null
)
{
if
(
cardData
.
Attack
==
0
)
return
CardPosition
.
FaceUpDefence
;
}
return
0
;
}
public
override
bool
OnSelectBattleReplay
()
public
override
bool
OnSelectBattleReplay
()
{
{
if
(
Bot
.
BattlingMonster
==
null
)
if
(
Bot
.
BattlingMonster
==
null
)
...
@@ -290,9 +307,10 @@ namespace WindBot.Game.AI
...
@@ -290,9 +307,10 @@ namespace WindBot.Game.AI
if
(
LastChainCard
==
null
)
if
(
LastChainCard
==
null
)
return
false
;
return
false
;
if
(
LastChainCard
.
Controller
!=
1
||
LastChainCard
.
Location
!=
CardLocation
.
MonsterZone
||
!
DefaultUniqueTrap
())
return
false
;
AI
.
SelectCard
(
LastChainCard
);
AI
.
SelectCard
(
LastChainCard
);
return
LastChainCard
.
Controller
==
1
&&
LastChainCard
.
Location
==
CardLocation
.
MonsterZone
&&
DefaultUniqueTrap
()
;
return
true
;
}
}
/// <summary>
/// <summary>
...
...
Game/AI/Executor.cs
View file @
e5d5696d
...
@@ -156,6 +156,12 @@ namespace WindBot.Game.AI
...
@@ -156,6 +156,12 @@ namespace WindBot.Game.AI
return
-
1
;
return
-
1
;
}
}
public
virtual
CardPosition
OnSelectPosition
(
int
cardId
,
IList
<
CardPosition
>
positions
)
{
// Overrided in DefalultExecutor
return
0
;
}
public
virtual
bool
OnSelectBattleReplay
()
public
virtual
bool
OnSelectBattleReplay
()
{
{
// Overrided in DefalultExecutor
// Overrided in DefalultExecutor
...
...
Game/GameAI.cs
View file @
e5d5696d
...
@@ -443,13 +443,17 @@ namespace WindBot.Game
...
@@ -443,13 +443,17 @@ namespace WindBot.Game
/// <returns>Selected position.</returns>
/// <returns>Selected position.</returns>
public
CardPosition
OnSelectPosition
(
int
cardId
,
IList
<
CardPosition
>
positions
)
public
CardPosition
OnSelectPosition
(
int
cardId
,
IList
<
CardPosition
>
positions
)
{
{
CardPosition
selector_selected
=
m_position
;
m_position
=
CardPosition
.
FaceUpAttack
;
CardPosition
executor_selected
=
Executor
.
OnSelectPosition
(
cardId
,
positions
);
// Selects the selected position if available, the first available otherwise.
// Selects the selected position if available, the first available otherwise.
if
(
positions
.
Contains
(
m_position
))
if
(
positions
.
Contains
(
executor_selected
))
{
return
executor_selected
;
CardPosition
old
=
m_position
;
if
(
positions
.
Contains
(
selector_selected
))
m_position
=
CardPosition
.
FaceUpAttack
;
return
selector_selected
;
return
old
;
}
return
positions
[
0
];
return
positions
[
0
];
}
}
...
...
Game/GameBehavior.cs
View file @
e5d5696d
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.IO
;
using
System.Text.RegularExpressions
;
using
System.Text.RegularExpressions
;
...
@@ -265,6 +265,7 @@ namespace WindBot.Game
...
@@ -265,6 +265,7 @@ namespace WindBot.Game
private
void
OnDuelEnd
(
BinaryReader
packet
)
private
void
OnDuelEnd
(
BinaryReader
packet
)
{
{
Connection
.
Close
();
Connection
.
Close
();
Logger
.
DebugWriteLine
(
"********************* Duel end *********************"
);
}
}
private
void
OnChat
(
BinaryReader
packet
)
private
void
OnChat
(
BinaryReader
packet
)
...
@@ -352,6 +353,7 @@ namespace WindBot.Game
...
@@ -352,6 +353,7 @@ namespace WindBot.Game
{
{
int
player
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
player
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
count
=
packet
.
ReadByte
();
int
count
=
packet
.
ReadByte
();
Logger
.
DebugWriteLine
(
"("
+
player
.
ToString
()
+
"抽了"
+
count
.
ToString
()
+
"张卡)"
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
{
...
@@ -423,6 +425,7 @@ namespace WindBot.Game
...
@@ -423,6 +425,7 @@ namespace WindBot.Game
private
void
OnNewPhase
(
BinaryReader
packet
)
private
void
OnNewPhase
(
BinaryReader
packet
)
{
{
_duel
.
Phase
=
(
DuelPhase
)
packet
.
ReadInt16
();
_duel
.
Phase
=
(
DuelPhase
)
packet
.
ReadInt16
();
Logger
.
DebugWriteLine
(
"(进入"
+
(
_duel
.
Phase
.
ToString
())
+
")"
);
_duel
.
LastSummonPlayer
=
-
1
;
_duel
.
LastSummonPlayer
=
-
1
;
_duel
.
Fields
[
0
].
BattlingMonster
=
null
;
_duel
.
Fields
[
0
].
BattlingMonster
=
null
;
_duel
.
Fields
[
1
].
BattlingMonster
=
null
;
_duel
.
Fields
[
1
].
BattlingMonster
=
null
;
...
@@ -434,6 +437,7 @@ namespace WindBot.Game
...
@@ -434,6 +437,7 @@ namespace WindBot.Game
int
player
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
player
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
final
=
_duel
.
Fields
[
player
].
LifePoints
-
packet
.
ReadInt32
();
int
final
=
_duel
.
Fields
[
player
].
LifePoints
-
packet
.
ReadInt32
();
if
(
final
<
0
)
final
=
0
;
if
(
final
<
0
)
final
=
0
;
Logger
.
DebugWriteLine
(
"("
+
player
.
ToString
()
+
"受到了伤害,当前为"
+
final
.
ToString
()
+
")"
);
_duel
.
Fields
[
player
].
LifePoints
=
final
;
_duel
.
Fields
[
player
].
LifePoints
=
final
;
}
}
...
@@ -463,6 +467,7 @@ namespace WindBot.Game
...
@@ -463,6 +467,7 @@ namespace WindBot.Game
packet
.
ReadInt32
();
// reason
packet
.
ReadInt32
();
// reason
ClientCard
card
=
_duel
.
GetCard
(
pc
,
(
CardLocation
)
pl
,
ps
);
ClientCard
card
=
_duel
.
GetCard
(
pc
,
(
CardLocation
)
pl
,
ps
);
if
(
card
!=
null
)
Logger
.
DebugWriteLine
(
"("
+
pc
.
ToString
()
+
"的"
+
(
card
.
Name
??
"未知卡片"
)
+
"从"
+
(
CardLocation
)
pl
+
"移动到了"
+
(
CardLocation
)
cl
+
")"
);
if
((
pl
&
(
int
)
CardLocation
.
Overlay
)
!=
0
)
if
((
pl
&
(
int
)
CardLocation
.
Overlay
)
!=
0
)
{
{
...
@@ -506,6 +511,8 @@ namespace WindBot.Game
...
@@ -506,6 +511,8 @@ namespace WindBot.Game
ClientCard
attackcard
=
_duel
.
GetCard
(
ca
,
(
CardLocation
)
la
,
sa
);
ClientCard
attackcard
=
_duel
.
GetCard
(
ca
,
(
CardLocation
)
la
,
sa
);
ClientCard
defendcard
=
_duel
.
GetCard
(
cd
,
(
CardLocation
)
ld
,
sd
);
ClientCard
defendcard
=
_duel
.
GetCard
(
cd
,
(
CardLocation
)
ld
,
sd
);
if
(
defendcard
==
null
)
Logger
.
DebugWriteLine
(
"("
+
(
attackcard
.
Name
??
"未知卡片"
)
+
"直接攻击)"
);
else
Logger
.
DebugWriteLine
(
"("
+
ca
.
ToString
()
+
"的"
+
(
attackcard
.
Name
??
"未知卡片"
)
+
"攻击了"
+
cd
.
ToString
()
+
"的"
+
(
defendcard
.
Name
??
"未知卡片"
)
+
")"
);
_duel
.
Fields
[
attackcard
.
Controller
].
BattlingMonster
=
attackcard
;
_duel
.
Fields
[
attackcard
.
Controller
].
BattlingMonster
=
attackcard
;
_duel
.
Fields
[
1
-
attackcard
.
Controller
].
BattlingMonster
=
defendcard
;
_duel
.
Fields
[
1
-
attackcard
.
Controller
].
BattlingMonster
=
defendcard
;
...
@@ -525,7 +532,10 @@ namespace WindBot.Game
...
@@ -525,7 +532,10 @@ namespace WindBot.Game
int
cp
=
packet
.
ReadSByte
();
int
cp
=
packet
.
ReadSByte
();
ClientCard
card
=
_duel
.
GetCard
(
pc
,
(
CardLocation
)
pl
,
ps
);
ClientCard
card
=
_duel
.
GetCard
(
pc
,
(
CardLocation
)
pl
,
ps
);
if
(
card
!=
null
)
if
(
card
!=
null
)
{
card
.
Position
=
cp
;
card
.
Position
=
cp
;
Logger
.
DebugWriteLine
(
"("
+
(
card
.
Name
??
"未知卡片"
)
+
"改变了表示形式为"
+
(
CardPosition
)
cp
+
")"
);
}
}
}
private
void
OnChaining
(
BinaryReader
packet
)
private
void
OnChaining
(
BinaryReader
packet
)
...
@@ -537,12 +547,12 @@ namespace WindBot.Game
...
@@ -537,12 +547,12 @@ namespace WindBot.Game
int
subs
=
packet
.
ReadSByte
();
int
subs
=
packet
.
ReadSByte
();
ClientCard
card
=
_duel
.
GetCard
(
pcc
,
pcl
,
pcs
,
subs
);
ClientCard
card
=
_duel
.
GetCard
(
pcc
,
pcl
,
pcs
,
subs
);
int
cc
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
cc
=
GetLocalPlayer
(
packet
.
ReadByte
());
if
(
card
!=
null
)
Logger
.
DebugWriteLine
(
"("
+
cc
.
ToString
()
+
"的"
+
(
card
.
Name
??
"未知卡片"
)
+
"发动了效果)"
);
_ai
.
OnChaining
(
card
,
cc
);
_ai
.
OnChaining
(
card
,
cc
);
_duel
.
ChainTargets
.
Clear
();
_duel
.
ChainTargets
.
Clear
();
_duel
.
LastSummonPlayer
=
-
1
;
_duel
.
LastSummonPlayer
=
-
1
;
_duel
.
CurrentChain
.
Add
(
card
);
_duel
.
CurrentChain
.
Add
(
card
);
_duel
.
LastChainPlayer
=
cc
;
_duel
.
LastChainPlayer
=
cc
;
}
}
private
void
OnChainEnd
(
BinaryReader
packet
)
private
void
OnChainEnd
(
BinaryReader
packet
)
...
@@ -632,6 +642,7 @@ namespace WindBot.Game
...
@@ -632,6 +642,7 @@ namespace WindBot.Game
/*int sseq = */
packet
.
ReadByte
();
/*int sseq = */
packet
.
ReadByte
();
ClientCard
card
=
_duel
.
GetCard
(
player
,
(
CardLocation
)
loc
,
seq
);
ClientCard
card
=
_duel
.
GetCard
(
player
,
(
CardLocation
)
loc
,
seq
);
if
(
card
==
null
)
continue
;
if
(
card
==
null
)
continue
;
Logger
.
DebugWriteLine
(
"("
+
(
CardLocation
)
loc
+
"的"
+
(
card
.
Name
??
"未知卡片"
)
+
"成为了对象)"
);
_duel
.
ChainTargets
.
Add
(
card
);
_duel
.
ChainTargets
.
Add
(
card
);
}
}
}
}
...
...
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