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
b965f487
Commit
b965f487
authored
Mar 06, 2024
by
jwyxym
Committed by
GitHub
Mar 06, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update AutoChessExecutor.cs
parent
cff994ea
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
65 deletions
+75
-65
Game/AI/Decks/AutoChessExecutor.cs
Game/AI/Decks/AutoChessExecutor.cs
+75
-65
No files found.
Game/AI/Decks/AutoChessExecutor.cs
View file @
b965f487
...
...
@@ -295,7 +295,7 @@ namespace WindBot.Game.AI.Decks
||
EnemyCardTargetMonsterFaceDown
(
card
)
||
EnemyCardTargetFaceDown
(
card
)
||
EnemyCardTargetFaceUp
(
card
)
||
EnemyCardTarget
(
card
)
||
EnemyCardTarget
(
card
,
ActivateDescription
)
)
return
true
;
return
false
;
...
...
@@ -303,7 +303,7 @@ namespace WindBot.Game.AI.Decks
private
bool
NotLinkMaterialCard
(
ClientCard
card
,
ClientCard
lcard
)
{
if
(
card
.
IsFacedown
()
||
!
IsAvailableLinkZone
())
if
(
card
.
IsFacedown
()
||
!
IsAvailableLinkZone
(
lcard
))
return
false
;
if
((
card
.
HasType
(
CardType
.
Fusion
)
&&
card
.
Level
>=
7
)
...
...
@@ -663,7 +663,7 @@ namespace WindBot.Game.AI.Decks
return
res
;
}
private
bool
IsAvailableZone
(
int
seq
)
private
bool
IsAvailableZone
(
int
seq
,
ClientCard
lcard
)
{
ClientCard
card
=
Bot
.
MonsterZone
[
seq
];
if
(
seq
==
5
&&
Bot
.
MonsterZone
[
6
]
!=
null
&&
Bot
.
MonsterZone
[
6
].
Controller
==
0
)
return
false
;
...
...
@@ -671,10 +671,15 @@ namespace WindBot.Game.AI.Decks
if
(
card
==
null
)
return
true
;
if
(
card
.
Controller
!=
0
)
return
false
;
if
(
card
.
IsFacedown
())
return
false
;
if
(
card
.
IsDisabled
())
return
true
;
if
((
card
.
HasType
(
CardType
.
Fusion
)
&&
card
.
Level
>=
7
)
||
(
card
.
HasType
(
CardType
.
Synchro
)
&&
(
card
.
Level
>=
7
||
card
.
Id
==
2956282
||
card
.
Id
==
33198837
||
card
.
Id
==
43932460
||
card
.
Id
==
29981921
))
||
card
.
HasType
(
CardType
.
Xyz
)
||
card
.
LinkCount
>=
lcard
.
LinkCount
)
return
false
;
return
true
;
}
private
bool
IsAvailableLinkZone
()
private
bool
IsAvailableLinkZone
(
ClientCard
lcard
)
{
int
zones
=
0
;
List
<
ClientCard
>
cards
=
Bot
.
GetMonstersInMainZone
().
Where
(
card
=>
card
!=
null
&&
card
.
IsFaceup
()).
ToList
();
...
...
@@ -727,13 +732,13 @@ namespace WindBot.Game.AI.Decks
}
}
zones
&=
0x7f
;
if
((
zones
&
Zones
.
z0
)
>
0
&&
IsAvailableZone
(
0
))
return
true
;
if
((
zones
&
Zones
.
z1
)
>
0
&&
IsAvailableZone
(
1
))
return
true
;
if
((
zones
&
Zones
.
z2
)
>
0
&&
IsAvailableZone
(
2
))
return
true
;
if
((
zones
&
Zones
.
z3
)
>
0
&&
IsAvailableZone
(
3
))
return
true
;
if
((
zones
&
Zones
.
z4
)
>
0
&&
IsAvailableZone
(
4
))
return
true
;
if
(
IsAvailableZone
(
5
))
return
true
;
if
(
IsAvailableZone
(
6
))
return
true
;
if
((
zones
&
Zones
.
z0
)
>
0
&&
IsAvailableZone
(
0
,
lcard
))
return
true
;
if
((
zones
&
Zones
.
z1
)
>
0
&&
IsAvailableZone
(
1
,
lcard
))
return
true
;
if
((
zones
&
Zones
.
z2
)
>
0
&&
IsAvailableZone
(
2
,
lcard
))
return
true
;
if
((
zones
&
Zones
.
z3
)
>
0
&&
IsAvailableZone
(
3
,
lcard
))
return
true
;
if
((
zones
&
Zones
.
z4
)
>
0
&&
IsAvailableZone
(
4
,
lcard
))
return
true
;
if
(
IsAvailableZone
(
5
,
lcard
))
return
true
;
if
(
IsAvailableZone
(
6
,
lcard
))
return
true
;
return
false
;
}
...
...
@@ -918,7 +923,7 @@ namespace WindBot.Game.AI.Decks
}
return
false
;
}
else
if
(
EnemyCardTarget
(
Card
))
else
if
(
EnemyCardTarget
(
Card
,
ActivateDescription
))
{
cards
=
GetZoneCards
(
CardLocation
.
Onfield
,
Enemy
).
Where
(
card
=>
card
!=
null
&&
!
card
.
IsShouldNotBeTarget
()
&&
(
card
.
HasType
(
CardType
.
Field
)
||
card
.
HasType
(
CardType
.
Continuous
)
||
card
.
HasType
(
CardType
.
Equip
)
||
(
card
.
HasType
(
CardType
.
Pendulum
)
&&
card
.
Location
==
CardLocation
.
SpellZone
)
||
(
card
.
IsFacedown
()
&&
card
.
Location
==
CardLocation
.
SpellZone
)
||
card
.
Location
==
CardLocation
.
MonsterZone
)).
ToList
();
if
(
cards
.
Count
()
>
0
)
...
...
@@ -1094,16 +1099,51 @@ namespace WindBot.Game.AI.Decks
if
(
Card
.
HasType
(
CardType
.
Link
))
{
List
<
ClientCard
>
cards
=
GetZoneCards
(
CardLocation
.
MonsterZone
,
Bot
).
Where
(
card
=>
card
!=
null
&&
NotLinkMaterialCard
(
card
,
Card
)).
ToList
();
if
(
cards
.
Count
()
<
Card
.
LinkCount
)
return
false
;
if
(
Card
.
Id
==
98127549
)
return
false
;
return
true
;
}
return
true
;
}
public
override
bool
OnSelectYesNo
(
int
desc
)
{
if
(
desc
==
Util
.
GetStringId
(
63014935
,
2
))
return
Bot
.
LifePoints
<=
1000
;
return
true
;
}
public
override
IList
<
ClientCard
>
OnSelectCard
(
IList
<
ClientCard
>
_cards
,
int
min
,
int
max
,
int
hint
,
bool
cancelable
)
{
if
(
Duel
.
Phase
==
DuelPhase
.
BattleStart
)
return
null
;
if
(
AI
.
HaveSelectedCards
())
return
null
;
IList
<
ClientCard
>
selected
=
new
List
<
ClientCard
>();
IList
<
ClientCard
>
cards
=
new
List
<
ClientCard
>(
_cards
);
if
(
max
>
cards
.
Count
)
max
=
cards
.
Count
;
if
(
p_summoning
||
((
Card
==
Util
.
GetPZone
(
0
,
0
)
||
Card
==
Util
.
GetPZone
(
0
,
1
))
&&
hint
==
HintMsg
.
SpSummon
)
&&
Card
.
HasType
(
CardType
.
Pendulum
))
{
List
<
ClientCard
>
result
=
new
List
<
ClientCard
>();
List
<
ClientCard
>
scards
=
cards
.
Where
(
card
=>
card
!=
null
&&
!
DontSummon
(
card
)).
ToList
();
p_summoning
=
false
;
if
(
scards
.
Count
>
0
)
return
Util
.
CheckSelectCount
(
result
,
scards
,
1
,
1
);
else
if
(
min
==
0
)
return
result
;
}
if
(
hint
==
533
&&
Card
.
HasType
(
CardType
.
Link
)
&&
Card
.
Location
==
CardLocation
.
Extra
)
{
IList
<
ClientCard
>
lcards
=
cards
.
Where
(
card
=>
NotLinkMaterialCard
(
card
,
Card
)).
ToList
();
IList
<
ClientCard
>
lcards1
=
new
List
<
ClientCard
>();
IList
<
ClientCard
>
lcards2
=
new
List
<
ClientCard
>();
IList
<
ClientCard
>
scards
=
new
List
<
ClientCard
>();
if
(
cards
.
Count
()
<
Card
.
LinkCount
)
return
false
;
if
(
Card
.
LinkCount
==
98127549
)
return
false
;
if
(
Card
.
LinkCount
>
4
)
{
lcards1
=
cards
.
Where
(
card
=>
card
.
LinkCount
==
2
).
ToList
();
lcards2
=
cards
.
Where
(
card
=>
card
.
LinkCount
<
2
||
card
.
LinkCount
==
0
).
ToList
();
lcards1
=
l
cards
.
Where
(
card
=>
card
.
LinkCount
==
2
).
ToList
();
lcards2
=
l
cards
.
Where
(
card
=>
card
.
LinkCount
<
2
||
card
.
LinkCount
==
0
).
ToList
();
if
(
lcards1
.
Count
()
>
0
)
{
foreach
(
ClientCard
card
in
lcards1
)
...
...
@@ -1120,68 +1160,38 @@ namespace WindBot.Game.AI.Decks
scards
.
Add
(
card
);
}
}
AI
.
SelectMaterials
(
scards
);
return
true
;
}
else
if
(
Card
.
LinkCount
>
2
)
{
lcards1
=
cards
.
Where
(
card
=>
card
.
LinkCount
==
3
).
ToList
();
lcards2
=
cards
.
Where
(
card
=>
card
.
LinkCount
<
2
||
card
.
LinkCount
==
0
).
ToList
();
int
a
=
0
;
lcards1
=
lcards
.
Where
(
card
=>
card
.
LinkCount
==
3
).
ToList
();
lcards2
=
lcards
.
Where
(
card
=>
card
.
LinkCount
<
2
||
card
.
LinkCount
==
0
).
ToList
();
if
(
lcards1
.
Count
()
==
0
)
lcards1
=
cards
.
Where
(
card
=>
card
.
LinkCount
==
2
).
ToList
();
if
(
lcards2
.
Count
()
==
0
)
lcards2
=
cards
.
Where
(
card
=>
card
.
LinkCount
==
2
).
ToList
();
lcards1
=
l
cards
.
Where
(
card
=>
card
.
LinkCount
==
2
).
ToList
();
if
(
lcards2
.
Count
()
==
0
&&
lcards1
.
Any
(
card
=>
card
.
LinkCount
==
3
)
)
lcards2
=
l
cards
.
Where
(
card
=>
card
.
LinkCount
==
2
).
ToList
();
if
(
lcards1
.
Count
()
>
0
)
{
foreach
(
ClientCard
card
in
lcards1
)
{
if
(
scards
.
Count
()
>=
Card
.
LinkCount
)
break
;
scards
.
Add
(
card
);
}
}
if
(
lcards2
.
Count
()
>
0
)
if
(
lcards2
.
Count
()
>
0
&&
a
==
0
)
{
foreach
(
ClientCard
card
in
lcards2
)
a
++;
foreach
(
ClientCard
card2
in
lcards2
)
{
if
(
scards
.
Count
()
>=
Card
.
LinkCount
)
break
;
scards
.
Add
(
card
);
}
scards
.
Add
(
card2
);
}
AI
.
SelectMaterials
(
scards
);
return
true
;
}
else
AI
.
SelectMaterials
(
cards
);
return
true
;
}
return
true
;
}
public
override
bool
OnSelectYesNo
(
int
desc
)
{
if
(
desc
==
Util
.
GetStringId
(
63014935
,
2
))
return
Bot
.
LifePoints
<=
1000
;
return
true
;
}
public
override
IList
<
ClientCard
>
OnSelectCard
(
IList
<
ClientCard
>
_cards
,
int
min
,
int
max
,
int
hint
,
bool
cancelable
)
{
if
(
Duel
.
Phase
==
DuelPhase
.
BattleStart
)
return
null
;
if
(
AI
.
HaveSelectedCards
())
return
null
;
IList
<
ClientCard
>
selected
=
new
List
<
ClientCard
>();
IList
<
ClientCard
>
cards
=
new
List
<
ClientCard
>(
_cards
);
if
(
max
>
cards
.
Count
)
max
=
cards
.
Count
;
else
scards
=
lcards
;
if
(
p_summoning
||
((
Card
==
Util
.
GetPZone
(
0
,
0
)
||
Card
==
Util
.
GetPZone
(
0
,
1
))
&&
hint
==
HintMsg
.
SpSummon
)
&&
Card
.
HasType
(
CardType
.
Pendulum
))
{
List
<
ClientCard
>
result
=
new
List
<
ClientCard
>();
List
<
ClientCard
>
scards
=
cards
.
Where
(
card
=>
card
!=
null
&&
!
DontSummon
(
card
)).
ToList
();
p_summoning
=
false
;
if
(
scards
.
Count
>
0
)
return
Util
.
CheckSelectCount
(
result
,
scards
,
1
,
1
);
else
if
(
min
==
0
)
return
result
;
return
Util
.
CheckSelectCount
(
scards
,
cards
,
min
,
min
);
}
if
(
HintFunction
(
hint
,
13
,
new
[]{
506
})
&&
!
cards
.
Any
(
card
=>
card
!=
null
&&
card
.
Controller
==
1
)
&&
cards
.
Any
(
card
=>
card
!=
null
&&
card
.
Location
==
CardLocation
.
Hand
))
...
...
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