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
nanahira
windbot
Commits
d5995341
Commit
d5995341
authored
Jun 12, 2023
by
YSPplayer
Committed by
GitHub
Jun 12, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Bot Zefra (#166)
parent
1b401e3a
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
2395 additions
and
0 deletions
+2395
-0
Decks/AI_Zefra.ydk
Decks/AI_Zefra.ydk
+79
-0
Game/AI/AIUtil.cs
Game/AI/AIUtil.cs
+110
-0
Game/AI/CardContainer.cs
Game/AI/CardContainer.cs
+9
-0
Game/AI/CardExtension.cs
Game/AI/CardExtension.cs
+16
-0
Game/AI/Decks/ZefraExecutor.cs
Game/AI/Decks/ZefraExecutor.cs
+2133
-0
Game/AI/Enums/NotBeSynchroMaterialMonster.cs
Game/AI/Enums/NotBeSynchroMaterialMonster.cs
+32
-0
Game/AI/Enums/NotBeXyzMaterialMonster.cs
Game/AI/Enums/NotBeXyzMaterialMonster.cs
+13
-0
WindBot.csproj
WindBot.csproj
+3
-0
No files found.
Decks/AI_Zefra.ydk
0 → 100644
View file @
d5995341
#created by ...
#main
49036338
29432356
29432356
29432356
3611830
76794549
5560911
96227613
96227613
27354732
58990362
58990362
58990362
20773176
22617205
69610326
14785765
95401059
31314549
96223501
52159691
21495657
21495657
57777714
92559258
92559258
92559258
38814750
38814750
38814750
72291078
23434538
23434538
23434538
94693857
9742784
19580308
11609969
61488417
2295440
23581825
38943357
38943357
38943357
41620959
41620959
41620959
73628505
74580251
74580251
74580251
81439173
24224830
24224830
46372010
32354768
32354768
32354768
35561352
57831349
#extra
27548199
74586817
80696379
33158448
65536818
79606837
88581108
96157835
73347079
74997493
44097050
24094258
50588353
36429703
41999284
!side
Game/AI/AIUtil.cs
View file @
d5995341
...
@@ -442,5 +442,115 @@ namespace WindBot.Game.AI
...
@@ -442,5 +442,115 @@ namespace WindBot.Game.AI
return
selected
;
return
selected
;
}
}
/// <summary>
/// Get all xyz materials lists that xyz monster required level in the 'pre_materials' list
/// </summary>
/// <param name="param_pre_materials">Original materials</param>
/// <param name="level">Xyz monster required level</param>
/// <param name="material_count">SpSummon rule:number of xyz materials</param>
/// <param name="material_count_above">More xyz materials</param>
/// <param name="material_func">Filter xyz materials func</param>
/// <returns></returns>
public
List
<
List
<
ClientCard
>>
GetXyzMaterials
(
IList
<
ClientCard
>
param_pre_materials
,
int
level
,
int
material_count
,
bool
material_count_above
=
false
,
Func
<
ClientCard
,
bool
>
material_func
=
null
)
{
List
<
List
<
ClientCard
>>
result
=
new
List
<
List
<
ClientCard
>>();
List
<
ClientCard
>
pre_materials
=
param_pre_materials
?.
Where
(
card
=>
card
!=
null
&&
!(
card
.
IsFacedown
()
&
card
.
Location
==
CardLocation
.
MonsterZone
)
&&
card
.
Level
==
level
&&
!
card
.
IsMonsterNotBeXyzMaterial
()).
ToList
();
if
(
pre_materials
?.
Count
()
<
material_count
)
return
result
;
Func
<
ClientCard
,
bool
>
default_func
=
card
=>
true
;
material_func
=
material_func
??
default_func
;
for
(
int
i
=
1
;
i
<
Math
.
Pow
(
2
,
pre_materials
.
Count
);
i
++)
{
List
<
ClientCard
>
temp_materials
=
new
List
<
ClientCard
>();
string
binaryString
=
Convert
.
ToString
(
i
,
2
).
PadLeft
(
pre_materials
.
Count
,
'0'
);
char
[]
reversedBinaryChars
=
binaryString
.
Reverse
().
ToArray
();
for
(
int
j
=
0
;
j
<
pre_materials
.
Count
;
j
++)
{
if
(
reversedBinaryChars
[
j
]
==
'1'
&&
material_func
(
pre_materials
[
j
]))
{
temp_materials
.
Add
(
pre_materials
[
j
]);
}
}
if
(
material_count_above
?
temp_materials
.
Count
>=
material_count
:
temp_materials
.
Count
==
material_count
)
{
result
.
Add
(
temp_materials
);
}
}
return
result
;
}
/// <summary>
/// Get all synchro materials lists that synchro monster level == param 'level' in the 'pre_materials' list
/// </summary>
/// <param name="pre_materials">Original materials</param>
/// <param name="level">Synchro monster level</param>
/// <param name="tuner_count">SpSummon rule:number of tuner monsters </param>
/// <param name="n_tuner_count">SpSummon rule:number of non-tuner monsters count</param>
/// <param name="tuner_count_above">More tuner monsters</param>
/// <param name="n_tuner_count_above">More non-tuner monsters</param>
/// <param name="tuner_func">Filter tuner monsters func</param>
/// <param name="n_tuner_func">Filter non-tuner monsters func</param>
/// <returns></returns>
public
List
<
List
<
ClientCard
>>
GetSynchroMaterials
(
IList
<
ClientCard
>
param_pre_materials
,
int
level
,
int
tuner_count
,
int
n_tuner_count
,
bool
tuner_count_above
=
false
,
bool
n_tuner_count_above
=
true
,
Func
<
ClientCard
,
bool
>
tuner_func
=
null
,
Func
<
ClientCard
,
bool
>
n_tuner_func
=
null
)
{
List
<
List
<
ClientCard
>>
t_result
=
new
List
<
List
<
ClientCard
>>();
List
<
ClientCard
>
pre_materials
=
param_pre_materials
?.
Where
(
card
=>
card
!=
null
&&
!(
card
.
IsFacedown
()
&
card
.
Location
==
CardLocation
.
MonsterZone
)
&&
card
.
Level
>
0
&&
!
card
.
IsMonsterNotBeSynchroMaterial
()).
ToList
();
if
(
pre_materials
?.
Count
()
<
tuner_count
+
n_tuner_count
)
return
t_result
;
Func
<
ClientCard
,
bool
>
default_func
=
card
=>
true
;
tuner_func
=
tuner_func
??
default_func
;
n_tuner_func
=
n_tuner_func
??
default_func
;
pre_materials
.
Sort
(
CardContainer
.
CompareCardLevel
);
Stack
<
object
[
]>
materials_stack
=
new
Stack
<
object
[
]>
();
for
(
var
i
=
0
;
i
<
pre_materials
.
Count
;
i
++)
{
if
(
pre_materials
[
i
].
Level
>
level
)
break
;
materials_stack
.
Push
(
new
object
[]
{
pre_materials
[
i
].
Level
,
i
,
pre_materials
[
i
].
Level
,
new
List
<
ClientCard
>
{
pre_materials
[
i
]
}
});
}
while
(
materials_stack
.
Count
>
0
)
{
object
[]
data
=
materials_stack
.
Pop
();
int
num
=
(
int
)
data
[
0
];
int
index
=
(
int
)
data
[
1
];
int
sum
=
(
int
)
data
[
2
];
List
<
ClientCard
>
temp_materials
=
(
List
<
ClientCard
>)
data
[
3
];
if
(
sum
==
level
)
{
t_result
.
Add
(
temp_materials
);
}
else
if
(
sum
<
level
)
{
for
(
var
i
=
index
+
1
;
i
<
pre_materials
.
Count
;
i
++)
{
if
(
pre_materials
[
i
].
Level
>
level
-
sum
)
break
;
if
(
i
>
index
+
1
&&
pre_materials
[
i
].
Level
==
pre_materials
[
i
-
1
].
Level
)
continue
;
var
new_temp_materials
=
new
List
<
ClientCard
>(
temp_materials
);
new_temp_materials
.
Add
(
pre_materials
[
i
]);
materials_stack
.
Push
(
new
object
[]
{
pre_materials
[
i
].
Level
,
i
,
sum
+
pre_materials
[
i
].
Level
,
new_temp_materials
});
}
}
}
List
<
List
<
ClientCard
>>
result
=
new
List
<
List
<
ClientCard
>>();
for
(
int
i
=
0
;
i
<
t_result
.
Count
;
i
++)
{
List
<
ClientCard
>
materials
=
t_result
[
i
];
List
<
ClientCard
>
tuner_materials
=
new
List
<
ClientCard
>();
List
<
ClientCard
>
n_tuner_materials
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
material
in
materials
)
{
if
(
material
.
HasType
(
CardType
.
Tuner
)
&&
tuner_func
(
material
))
{
tuner_materials
.
Add
(
material
);
}
else
if
(
material
.
Level
>
0
&&
n_tuner_func
(
material
))
{
n_tuner_materials
.
Add
(
material
);
}
}
if
((
tuner_count_above
?
tuner_materials
.
Count
>=
tuner_count
:
tuner_materials
.
Count
==
tuner_count
)
&&
(
n_tuner_count_above
?
n_tuner_materials
.
Count
>=
n_tuner_count
:
n_tuner_materials
.
Count
==
n_tuner_count
))
result
.
Add
(
materials
);
}
return
result
;
}
}
}
}
}
\ No newline at end of file
Game/AI/CardContainer.cs
View file @
d5995341
...
@@ -25,6 +25,15 @@ namespace WindBot.Game.AI
...
@@ -25,6 +25,15 @@ namespace WindBot.Game.AI
return
1
;
return
1
;
}
}
public
static
int
CompareCardLink
(
ClientCard
cardA
,
ClientCard
cardB
)
{
if
(
cardA
.
LinkCount
<
cardB
.
LinkCount
)
return
-
1
;
if
(
cardA
.
LinkCount
==
cardB
.
LinkCount
)
return
0
;
return
1
;
}
public
static
int
CompareDefensePower
(
ClientCard
cardA
,
ClientCard
cardB
)
public
static
int
CompareDefensePower
(
ClientCard
cardA
,
ClientCard
cardB
)
{
{
if
(
cardA
==
null
&&
cardB
==
null
)
if
(
cardA
==
null
&&
cardB
==
null
)
...
...
Game/AI/CardExtension.cs
View file @
d5995341
...
@@ -78,5 +78,21 @@ namespace WindBot.Game.AI
...
@@ -78,5 +78,21 @@ namespace WindBot.Game.AI
{
{
return
Enum
.
IsDefined
(
typeof
(
FusionSpell
),
card
.
Id
);
return
Enum
.
IsDefined
(
typeof
(
FusionSpell
),
card
.
Id
);
}
}
/// <summary>
/// Is this monster not be synchro material?
/// </summary>
public
static
bool
IsMonsterNotBeSynchroMaterial
(
this
ClientCard
card
)
{
return
Enum
.
IsDefined
(
typeof
(
NotBeSynchroMaterialMonster
),
card
.
Id
);
}
/// <summary>
/// Is this monster not be xyz material?
/// </summary>
public
static
bool
IsMonsterNotBeXyzMaterial
(
this
ClientCard
card
)
{
return
Enum
.
IsDefined
(
typeof
(
NotBeXyzMaterialMonster
),
card
.
Id
);
}
}
}
}
}
\ No newline at end of file
Game/AI/Decks/ZefraExecutor.cs
0 → 100644
View file @
d5995341
This source diff could not be displayed because it is too large. You can
view the blob
instead.
Game/AI/Enums/NotBeSynchroMaterialMonster.cs
0 → 100644
View file @
d5995341
namespace
WindBot.Game.AI.Enums
{
public
enum
NotBeSynchroMaterialMonster
{
Ronintoadin
=
1357146
,
GagagaCaesar
=
9583383
,
VagueShadowToken
=
9929399
,
TourGuideFromtheUnderworld
=
10802915
,
PhotonToken
=
17418745
,
KagemuchaKnight
=
19353570
,
SharkStickers
=
20838380
,
GagagaMagician
=
26082117
,
RadianToken
=
28674153
,
Kurivolt
=
40817915
,
BlueMountainButterspy
=
54582424
,
Lightserpent
=
55501446
,
SaberShark
=
63193879
,
ConstellarKaus
=
70908596
,
CeremonialToken
=
82340057
,
HeroicChallenger_DoubleLance
=
89774530
,
SteelswarmScout
=
90727556
,
Kagetokage
=
94656263
,
YellowDuston
=
16366810
,
BlueDuston
=
40217358
,
Centerfrog
=
47346782
,
GreenDuston
=
52182715
,
RedDuston
=
61019812
,
EaterofMillions
=
63845230
,
PutridPuddingBodyBuddies
=
85101097
}
}
\ No newline at end of file
Game/AI/Enums/NotBeXyzMaterialMonster.cs
0 → 100644
View file @
d5995341
namespace
WindBot.Game.AI.Enums
{
public
enum
NotBeXyzMaterialMonster
{
YellowDuston
=
16366810
,
BlueDuston
=
40217358
,
Centerfrog
=
47346782
,
GreenDuston
=
52182715
,
RedDuston
=
61019812
,
EaterofMillions
=
63845230
,
PutridPuddingBodyBuddies
=
85101097
}
}
\ No newline at end of file
WindBot.csproj
View file @
d5995341
...
@@ -115,12 +115,15 @@
...
@@ -115,12 +115,15 @@
<Compile
Include=
"Game\AI\Decks\DoEveryThingExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\DoEveryThingExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\OldSchoolExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\OldSchoolExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\Rank5Executor.cs"
/>
<Compile
Include=
"Game\AI\Decks\Rank5Executor.cs"
/>
<Compile
Include=
"Game\AI\Decks\ZefraExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\ZoodiacExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\ZoodiacExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\ZexalWeaponsExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\ZexalWeaponsExecutor.cs"
/>
<Compile
Include=
"Game\AI\DefaultExecutor.cs"
/>
<Compile
Include=
"Game\AI\DefaultExecutor.cs"
/>
<Compile
Include=
"Game\AI\Dialogs.cs"
/>
<Compile
Include=
"Game\AI\Dialogs.cs"
/>
<Compile
Include=
"Game\AI\Enums\DangerousMonster.cs"
/>
<Compile
Include=
"Game\AI\Enums\DangerousMonster.cs"
/>
<Compile
Include=
"Game\AI\Enums\FusionSpell.cs"
/>
<Compile
Include=
"Game\AI\Enums\FusionSpell.cs"
/>
<Compile
Include=
"Game\AI\Enums\NotBeSynchroMaterialMonster.cs"
/>
<Compile
Include=
"Game\AI\Enums\NotBeXyzMaterialMonster.cs"
/>
<Compile
Include=
"Game\AI\Enums\ShouldBeDisabledBeforeItUseEffectMonster.cs"
/>
<Compile
Include=
"Game\AI\Enums\ShouldBeDisabledBeforeItUseEffectMonster.cs"
/>
<Compile
Include=
"Game\AI\Enums\ShouldNotBeSpellTarget.cs"
/>
<Compile
Include=
"Game\AI\Enums\ShouldNotBeSpellTarget.cs"
/>
<Compile
Include=
"Game\AI\Enums\ShouldNotBeMonsterTarget.cs"
/>
<Compile
Include=
"Game\AI\Enums\ShouldNotBeMonsterTarget.cs"
/>
...
...
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