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
18b0cc48
Commit
18b0cc48
authored
Jan 10, 2024
by
wind2009
Committed by
GitHub
Jan 10, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update default excutor (#178)
parent
f0581a87
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
286 additions
and
35 deletions
+286
-35
Game/AI/CardExtension.cs
Game/AI/CardExtension.cs
+2
-1
Game/AI/DefaultExecutor.cs
Game/AI/DefaultExecutor.cs
+198
-27
Game/AI/Enums/DangerousMonster.cs
Game/AI/Enums/DangerousMonster.cs
+2
-1
Game/AI/Enums/Floodgate.cs
Game/AI/Enums/Floodgate.cs
+2
-1
Game/AI/Enums/InvincibleMonster.cs
Game/AI/Enums/InvincibleMonster.cs
+6
-1
Game/AI/Enums/ShouldNotBeTarget.cs
Game/AI/Enums/ShouldNotBeTarget.cs
+3
-1
Game/AI/Executor.cs
Game/AI/Executor.cs
+5
-0
Game/Duel.cs
Game/Duel.cs
+16
-1
Game/GameAI.cs
Game/GameAI.cs
+7
-0
Game/GameBehavior.cs
Game/GameBehavior.cs
+45
-2
No files found.
Game/AI/CardExtension.cs
View file @
18b0cc48
...
...
@@ -21,7 +21,8 @@ namespace WindBot.Game.AI
/// </summary>
public
static
bool
IsMonsterDangerous
(
this
ClientCard
card
)
{
return
!
card
.
IsDisabled
()
&&
Enum
.
IsDefined
(
typeof
(
DangerousMonster
),
card
.
Id
);
return
!
card
.
IsDisabled
()
&&
(
Enum
.
IsDefined
(
typeof
(
DangerousMonster
),
card
.
Id
)
||
(
card
.
HasSetcode
(
0x18d
)
&&
(
card
.
HasType
(
CardType
.
Ritual
)
||
card
.
EquipCards
.
Count
>
0
)));
}
/// <summary>
...
...
Game/AI/DefaultExecutor.cs
View file @
18b0cc48
This diff is collapsed.
Click to expand it.
Game/AI/Enums/DangerousMonster.cs
View file @
18b0cc48
...
...
@@ -25,6 +25,7 @@
Heart_eartHDragon
=
97403510
,
DaigustoSphreeze
=
29552709
,
OhimetheManifestedMikanko
=
81260679
,
ArahimetheManifestedMikanko
=
75771170
ArahimetheManifestedMikanko
=
75771170
,
YubelDasEwigLiebeW
ä
chter
=
47172959
}
}
Game/AI/Enums/Floodgate.cs
View file @
18b0cc48
...
...
@@ -210,6 +210,7 @@
TGGlaiveBlaster
=
95973569
,
StellarNemesisTPHON_DoomsdayStar
=
93039339
,
SPLittleKnight
=
29301450
,
AngelRing
=
40678060
AngelRing
=
40678060
,
SkullGuardianTheSilenforcingProtector
=
10774240
}
}
Game/AI/Enums/InvincibleMonster.cs
View file @
18b0cc48
...
...
@@ -109,6 +109,11 @@
NightmareMagician
=
40221691
,
ArahimetheManifestedMikanko
=
75771170
,
UFOLight
=
9275482
,
TaotheGreatChanter
=
34541543
TaotheGreatChanter
=
34541543
,
SpiritOfYubel
=
90829280
,
DarkGuardian
=
26746975
,
EnvoyOfTheWaxState
=
87462901
,
Fluffyfluff
=
85401123
,
YubelDasEwigLiebeW
ä
chter
=
47172959
}
}
Game/AI/Enums/ShouldNotBeTarget.cs
View file @
18b0cc48
...
...
@@ -49,6 +49,8 @@
Blackwing_FullArmoredWing
=
54082269
,
DragunofRedEyes
=
37818794
,
RedEyesBDragon
=
74677422
,
// sometimes the name of DragunofRedEyes will be changed to RedEyesBDragon
TheArrivalCyberseIgnister
=
11738489
TheArrivalCyberseIgnister
=
11738489
,
MajespecterPorcupineYamaarashi
=
51073802
,
RaidraptorRisingRebellionFalcon
=
71222868
}
}
Game/AI/Executor.cs
View file @
18b0cc48
...
...
@@ -95,6 +95,11 @@ namespace WindBot.Game.AI
// For overriding
}
public
virtual
void
OnChainSolved
(
int
chainIndex
)
{
// For overriding
}
public
virtual
void
OnChainEnd
()
{
// For overriding
...
...
Game/Duel.cs
View file @
18b0cc48
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
YGOSharp.OCGWrapper.Enums
;
namespace
WindBot.Game
...
...
@@ -26,6 +26,8 @@ namespace WindBot.Game
public
int
LastSummonPlayer
{
get
;
set
;
}
public
IList
<
ClientCard
>
SummoningCards
{
get
;
set
;
}
public
IList
<
ClientCard
>
LastSummonedCards
{
get
;
set
;
}
public
int
SolvingChainIndex
{
get
;
set
;
}
public
IList
<
int
>
NegatedChainIndexList
{
get
;
set
;
}
public
Duel
()
{
...
...
@@ -41,6 +43,8 @@ namespace WindBot.Game
LastSummonPlayer
=
-
1
;
SummoningCards
=
new
List
<
ClientCard
>();
LastSummonedCards
=
new
List
<
ClientCard
>();
SolvingChainIndex
=
0
;
NegatedChainIndexList
=
new
List
<
int
>();
}
public
ClientCard
GetCard
(
int
player
,
CardLocation
loc
,
int
seq
)
...
...
@@ -169,5 +173,16 @@ namespace WindBot.Game
{
return
IsFirst
?
player
:
1
-
player
;
}
public
ClientCard
GetCurrentSolvingChainCard
()
{
if
(
SolvingChainIndex
==
0
||
SolvingChainIndex
>
CurrentChain
.
Count
)
return
null
;
return
CurrentChain
[
SolvingChainIndex
-
1
];
}
public
bool
IsCurrentSolvingChainNegated
()
{
return
SolvingChainIndex
>
0
&&
NegatedChainIndexList
.
Contains
(
SolvingChainIndex
);
}
}
}
\ No newline at end of file
Game/GameAI.cs
View file @
18b0cc48
...
...
@@ -141,6 +141,11 @@ namespace WindBot.Game
{
Executor
.
OnChaining
(
player
,
card
);
}
public
void
OnChainSolved
(
int
chainIndex
)
{
Executor
.
OnChainSolved
(
chainIndex
);
}
/// <summary>
/// Called when a chain has been solved.
...
...
@@ -300,6 +305,8 @@ namespace WindBot.Game
// Always select the first available cards and choose the minimum.
IList
<
ClientCard
>
selected
=
new
List
<
ClientCard
>();
if
(
hint
==
HintMsg
.
AttackTarget
&&
cancelable
)
return
selected
;
if
(
cards
.
Count
>=
min
)
{
for
(
int
i
=
0
;
i
<
min
;
++
i
)
...
...
Game/GameBehavior.cs
View file @
18b0cc48
...
...
@@ -109,6 +109,10 @@ namespace WindBot.Game
_messages
.
Add
(
GameMessage
.
AttackDisabled
,
OnAttackDisabled
);
_messages
.
Add
(
GameMessage
.
PosChange
,
OnPosChange
);
_messages
.
Add
(
GameMessage
.
Chaining
,
OnChaining
);
_messages
.
Add
(
GameMessage
.
ChainSolving
,
OnChainSolving
);
_messages
.
Add
(
GameMessage
.
ChainNegated
,
OnChainNegated
);
_messages
.
Add
(
GameMessage
.
ChainDisabled
,
OnChainDisabled
);
_messages
.
Add
(
GameMessage
.
ChainSolved
,
OnChainSolved
);
_messages
.
Add
(
GameMessage
.
ChainEnd
,
OnChainEnd
);
_messages
.
Add
(
GameMessage
.
SortCard
,
OnCardSorting
);
_messages
.
Add
(
GameMessage
.
SortChain
,
OnChainSorting
);
...
...
@@ -362,6 +366,19 @@ namespace WindBot.Game
extra
=
packet
.
ReadInt16
();
_duel
.
Fields
[
GetLocalPlayer
(
1
)].
Init
(
deck
,
extra
);
// in case of ending duel in chain's solving
_duel
.
LastChainPlayer
=
-
1
;
_duel
.
LastChainLocation
=
0
;
_duel
.
CurrentChain
.
Clear
();
_duel
.
ChainTargets
.
Clear
();
_duel
.
LastChainTargets
.
Clear
();
_duel
.
ChainTargetOnly
.
Clear
();
_duel
.
LastSummonPlayer
=
-
1
;
_duel
.
SummoningCards
.
Clear
();
_duel
.
LastSummonedCards
.
Clear
();
_duel
.
SolvingChainIndex
=
0
;
_duel
.
NegatedChainIndexList
.
Clear
();
Logger
.
DebugWriteLine
(
"Duel started: "
+
_room
.
Names
[
0
]
+
" versus "
+
_room
.
Names
[
1
]);
_ai
.
OnStart
();
}
...
...
@@ -742,6 +759,30 @@ namespace WindBot.Game
}
private
void
OnChainSolving
(
BinaryReader
packet
)
{
int
chainIndex
=
packet
.
ReadByte
();
_duel
.
SolvingChainIndex
=
chainIndex
;
}
private
void
OnChainNegated
(
BinaryReader
packet
)
{
int
chainIndex
=
packet
.
ReadByte
();
_duel
.
NegatedChainIndexList
.
Add
(
chainIndex
);
}
private
void
OnChainDisabled
(
BinaryReader
packet
)
{
int
chainIndex
=
packet
.
ReadByte
();
_duel
.
NegatedChainIndexList
.
Add
(
chainIndex
);
}
private
void
OnChainSolved
(
BinaryReader
packet
)
{
int
chainIndex
=
packet
.
ReadByte
();
_ai
.
OnChainSolved
(
chainIndex
);
}
private
void
OnChainEnd
(
BinaryReader
packet
)
{
_ai
.
OnChainEnd
();
...
...
@@ -751,6 +792,8 @@ namespace WindBot.Game
_duel
.
ChainTargets
.
Clear
();
_duel
.
LastChainTargets
.
Clear
();
_duel
.
ChainTargetOnly
.
Clear
();
_duel
.
SolvingChainIndex
=
0
;
_duel
.
NegatedChainIndexList
.
Clear
();
}
private
void
OnCardSorting
(
BinaryReader
packet
)
...
...
@@ -1083,7 +1126,7 @@ namespace WindBot.Game
int
count
=
packet
.
ReadByte
();
packet
.
ReadByte
();
// specount
bool
forced
=
packet
.
ReadByte
()
!=
0
;
packet
.
ReadInt32
();
// hint1
int
hint1
=
packet
.
ReadInt32
();
// hint1
int
hint2
=
packet
.
ReadInt32
();
// hint2
IList
<
ClientCard
>
cards
=
new
List
<
ClientCard
>();
...
...
@@ -1124,7 +1167,7 @@ namespace WindBot.Game
return
;
}
Connection
.
Send
(
CtosMessage
.
Response
,
_ai
.
OnSelectChain
(
cards
,
descs
,
forced
,
hint2
));
Connection
.
Send
(
CtosMessage
.
Response
,
_ai
.
OnSelectChain
(
cards
,
descs
,
forced
,
hint
1
|
hint
2
));
}
private
void
OnSelectCounter
(
BinaryReader
packet
)
...
...
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