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
xiaoye
windbot
Commits
bba4eedd
Commit
bba4eedd
authored
Nov 09, 2017
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add AI.Utils.SelectPreferredCards
parent
e11ebc27
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
94 additions
and
20 deletions
+94
-20
Game/AI/AIFunctions.cs
Game/AI/AIFunctions.cs
+60
-0
Game/AI/Decks/BlueEyesExecutor.cs
Game/AI/Decks/BlueEyesExecutor.cs
+1
-14
Game/AI/Decks/LightswornExecutor.cs
Game/AI/Decks/LightswornExecutor.cs
+0
-6
Game/AI/Decks/Rank5Executor.cs
Game/AI/Decks/Rank5Executor.cs
+13
-0
Game/AI/Decks/YosenjuExecutor.cs
Game/AI/Decks/YosenjuExecutor.cs
+8
-0
Game/AI/Decks/ZexalWeaponsExecutor.cs
Game/AI/Decks/ZexalWeaponsExecutor.cs
+12
-0
No files found.
Game/AI/AIFunctions.cs
View file @
bba4eedd
...
...
@@ -296,6 +296,66 @@ namespace WindBot.Game.AI
return
Duel
.
ChainTargets
.
Count
==
1
&&
card
.
Equals
(
Duel
.
ChainTargets
[
0
]);
}
/// <summary>
/// Select cards listed in preferred.
/// </summary>
public
void
SelectPreferredCards
(
IList
<
ClientCard
>
selected
,
ClientCard
preferred
,
IList
<
ClientCard
>
cards
,
int
min
,
int
max
)
{
if
(
cards
.
IndexOf
(
preferred
)
>
0
&&
selected
.
Count
<
max
)
{
selected
.
Add
(
preferred
);
}
}
/// <summary>
/// Select cards listed in preferred.
/// </summary>
public
void
SelectPreferredCards
(
IList
<
ClientCard
>
selected
,
int
preferred
,
IList
<
ClientCard
>
cards
,
int
min
,
int
max
)
{
foreach
(
ClientCard
card
in
cards
)
{
if
(
card
.
Id
==
preferred
&&
selected
.
Count
<
max
)
selected
.
Add
(
card
);
}
}
/// <summary>
/// Select cards listed in preferred.
/// </summary>
public
void
SelectPreferredCards
(
IList
<
ClientCard
>
selected
,
IList
<
ClientCard
>
preferred
,
IList
<
ClientCard
>
cards
,
int
min
,
int
max
)
{
IList
<
ClientCard
>
avail
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
card
in
cards
)
{
// clone
avail
.
Add
(
card
);
}
while
(
preferred
.
Count
>
0
&&
avail
.
IndexOf
(
preferred
[
0
])
>
0
&&
selected
.
Count
<
max
)
{
ClientCard
card
=
preferred
[
0
];
preferred
.
Remove
(
card
);
avail
.
Remove
(
card
);
selected
.
Add
(
card
);
}
}
/// <summary>
/// Select cards listed in preferred.
/// </summary>
public
void
SelectPreferredCards
(
IList
<
ClientCard
>
selected
,
IList
<
int
>
preferred
,
IList
<
ClientCard
>
cards
,
int
min
,
int
max
)
{
for
(
int
i
=
0
;
i
<
preferred
.
Count
;
i
++)
{
foreach
(
ClientCard
card
in
cards
)
{
if
(
card
.
Id
==
preferred
[
i
]
&&
selected
.
Count
<
max
&&
selected
.
IndexOf
(
card
)
<=
0
)
selected
.
Add
(
card
);
}
if
(
selected
.
Count
>=
max
)
break
;
}
}
/// <summary>
/// Check and fix selected to make sure it meet the count requirement.
/// </summary>
...
...
Game/AI/Decks/BlueEyesExecutor.cs
View file @
bba4eedd
...
...
@@ -167,21 +167,8 @@ namespace WindBot.Game.AI.Decks
public
override
IList
<
ClientCard
>
OnSelectXyzMaterial
(
IList
<
ClientCard
>
cards
,
int
min
,
int
max
)
{
Logger
.
DebugWriteLine
(
"OnSelectXyzMaterial "
+
cards
.
Count
+
" "
+
min
+
" "
+
max
);
IList
<
ClientCard
>
avail
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
card
in
cards
)
{
// clone
avail
.
Add
(
card
);
}
IList
<
ClientCard
>
result
=
new
List
<
ClientCard
>();
while
(
UsedAlternativeWhiteDragon
.
Count
>
0
&&
avail
.
IndexOf
(
UsedAlternativeWhiteDragon
[
0
])
>
0
)
{
Logger
.
DebugWriteLine
(
"select UsedAlternativeWhiteDragon"
);
ClientCard
card
=
UsedAlternativeWhiteDragon
[
0
];
UsedAlternativeWhiteDragon
.
Remove
(
card
);
avail
.
Remove
(
card
);
result
.
Add
(
card
);
}
AI
.
Utils
.
SelectPreferredCards
(
result
,
UsedAlternativeWhiteDragon
,
cards
,
min
,
max
);
AI
.
Utils
.
CheckSelectCount
(
result
,
cards
,
min
,
max
);
return
result
;
}
...
...
Game/AI/Decks/LightswornExecutor.cs
View file @
bba4eedd
...
...
@@ -106,12 +106,6 @@ namespace WindBot.Game.AI.Decks
public
override
IList
<
ClientCard
>
OnSelectXyzMaterial
(
IList
<
ClientCard
>
cards
,
int
min
,
int
max
)
{
Logger
.
DebugWriteLine
(
"OnSelectXyzMaterial "
+
cards
.
Count
+
" "
+
min
+
" "
+
max
);
IList
<
ClientCard
>
avail
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
card
in
cards
)
{
// clone
avail
.
Add
(
card
);
}
IList
<
ClientCard
>
result
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
card
in
cards
)
{
...
...
Game/AI/Decks/Rank5Executor.cs
View file @
bba4eedd
...
...
@@ -118,6 +118,19 @@ namespace WindBot.Game.AI.Decks
Number61VolcasaurusUsed
=
false
;
}
public
override
IList
<
ClientCard
>
OnSelectXyzMaterial
(
IList
<
ClientCard
>
cards
,
int
min
,
int
max
)
{
IList
<
ClientCard
>
result
=
new
List
<
ClientCard
>();
AI
.
Utils
.
SelectPreferredCards
(
result
,
new
[]
{
CardId
.
MistArchfiend
,
CardId
.
PanzerDragon
,
CardId
.
SolarWindJammer
,
CardId
.
StarDrawing
},
cards
,
min
,
max
);
AI
.
Utils
.
CheckSelectCount
(
result
,
cards
,
min
,
max
);
return
result
;
}
private
bool
NormalSummon
()
{
NormalSummoned
=
true
;
...
...
Game/AI/Decks/YosenjuExecutor.cs
View file @
bba4eedd
...
...
@@ -179,6 +179,14 @@ namespace WindBot.Game.AI.Decks
return
base
.
OnPreBattleBetween
(
attacker
,
defender
);
}
public
override
IList
<
ClientCard
>
OnSelectXyzMaterial
(
IList
<
ClientCard
>
cards
,
int
min
,
int
max
)
{
IList
<
ClientCard
>
result
=
new
List
<
ClientCard
>();
AI
.
Utils
.
SelectPreferredCards
(
result
,
CardId
.
YosenjuTsujik
,
cards
,
min
,
max
);
AI
.
Utils
.
CheckSelectCount
(
result
,
cards
,
min
,
max
);
return
result
;
}
private
bool
PotOfDualityEffect
()
{
if
(
CardOfDemiseUsed
)
...
...
Game/AI/Decks/ZexalWeaponsExecutor.cs
View file @
bba4eedd
...
...
@@ -136,6 +136,18 @@ namespace WindBot.Game.AI.Decks
return
base
.
OnPreBattleBetween
(
attacker
,
defender
);
}
public
override
IList
<
ClientCard
>
OnSelectXyzMaterial
(
IList
<
ClientCard
>
cards
,
int
min
,
int
max
)
{
IList
<
ClientCard
>
result
=
new
List
<
ClientCard
>();
AI
.
Utils
.
SelectPreferredCards
(
result
,
new
[]
{
CardId
.
StarDrawing
,
CardId
.
SolarWindJammer
,
CardId
.
Goblindbergh
},
cards
,
min
,
max
);
AI
.
Utils
.
CheckSelectCount
(
result
,
cards
,
min
,
max
);
return
result
;
}
private
bool
Number39Utopia
()
{
if
(!
HasChainedTrap
(
0
)
&&
Duel
.
Player
==
1
&&
Duel
.
Phase
==
DuelPhase
.
BattleStart
&&
Card
.
HasXyzMaterial
(
2
))
...
...
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