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
967694d3
Commit
967694d3
authored
Feb 28, 2024
by
jwyxym
Committed by
GitHub
Feb 28, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update AutoChessExecutor.cs
parent
4d90f00d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
53 deletions
+72
-53
Game/AI/Decks/AutoChessExecutor.cs
Game/AI/Decks/AutoChessExecutor.cs
+72
-53
No files found.
Game/AI/Decks/AutoChessExecutor.cs
View file @
967694d3
...
@@ -67,23 +67,6 @@ namespace WindBot.Game.AI.Decks
...
@@ -67,23 +67,6 @@ namespace WindBot.Game.AI.Decks
AddExecutor
(
ExecutorType
.
SpSummon
,
_CardId
.
EvilswarmExcitonKnight
,
DefaultEvilswarmExcitonKnightSummon
);
AddExecutor
(
ExecutorType
.
SpSummon
,
_CardId
.
EvilswarmExcitonKnight
,
DefaultEvilswarmExcitonKnightSummon
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
EvilswarmExcitonKnight
,
DefaultEvilswarmExcitonKnightEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
EvilswarmExcitonKnight
,
DefaultEvilswarmExcitonKnightEffect
);
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
SandaionTheTimelord
,
DefaultTimelordSummon
);
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
GabrionTheTimelord
,
DefaultTimelordSummon
);
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
MichionTheTimelord
,
DefaultTimelordSummon
);
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
ZaphionTheTimelord
,
DefaultTimelordSummon
);
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
HailonTheTimelord
,
DefaultTimelordSummon
);
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
RaphionTheTimelord
,
DefaultTimelordSummon
);
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
SadionTheTimelord
,
DefaultTimelordSummon
);
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
MetaionTheTimelord
,
DefaultTimelordSummon
);
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
KamionTheTimelord
,
DefaultTimelordSummon
);
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
LazionTheTimelord
,
DefaultTimelordSummon
);
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
LeftArmofTheForbiddenOne
,
JustDontIt
);
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
RightLegofTheForbiddenOne
,
JustDontIt
);
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
LeftLegofTheForbiddenOne
,
JustDontIt
);
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
RightArmofTheForbiddenOne
,
JustDontIt
);
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
ExodiaTheForbiddenOne
,
JustDontIt
);
}
}
private
List
<
int
>
HintMsgForEnemy
=
new
List
<
int
>
private
List
<
int
>
HintMsgForEnemy
=
new
List
<
int
>
...
@@ -343,7 +326,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -343,7 +326,7 @@ namespace WindBot.Game.AI.Decks
List
<
ClientCard
>
cards
=
new
List
<
ClientCard
>();
List
<
ClientCard
>
cards
=
new
List
<
ClientCard
>();
if
(
Card
.
Location
==
CardLocation
.
Hand
)
if
(
Card
.
Location
==
CardLocation
.
Hand
)
{
{
if
(
Card
.
HasSetcode
(
0x18d
)
)
if
(
Card
.
Id
==
43527730
)
{
{
cards
=
GetZoneCards
(
CardLocation
.
MonsterZone
,
Enemy
).
Where
(
card
=>
card
!=
null
&&
card
.
IsFaceup
()
&&
!
card
.
IsShouldNotBeTarget
()).
ToList
();
cards
=
GetZoneCards
(
CardLocation
.
MonsterZone
,
Enemy
).
Where
(
card
=>
card
!=
null
&&
card
.
IsFaceup
()
&&
!
card
.
IsShouldNotBeTarget
()).
ToList
();
if
(
cards
.
Count
()
==
0
)
if
(
cards
.
Count
()
==
0
)
...
@@ -354,8 +337,12 @@ namespace WindBot.Game.AI.Decks
...
@@ -354,8 +337,12 @@ namespace WindBot.Game.AI.Decks
cards
.
Reverse
();
cards
.
Reverse
();
}
}
AI
.
SelectCard
(
cards
[
0
]);
if
(
cards
.
Count
()
>
0
)
return
cards
.
Count
()
>
0
;
{
AI
.
SelectCard
(
cards
);
return
true
;
}
return
false
;
}
}
else
if
(
Card
.
Id
==
41927278
)
else
if
(
Card
.
Id
==
41927278
)
{
{
...
@@ -368,18 +355,30 @@ namespace WindBot.Game.AI.Decks
...
@@ -368,18 +355,30 @@ namespace WindBot.Game.AI.Decks
cards
.
Reverse
();
cards
.
Reverse
();
}
}
AI
.
SelectCard
(
cards
[
0
]);
if
(
cards
.
Count
()
>
0
)
return
cards
.
Count
()
>
0
;
{
AI
.
SelectCard
(
cards
);
return
true
;
}
return
false
;
}
}
else
if
(
Card
.
Id
==
6203182
||
Card
.
Id
==
69954399
)
else
if
(
Card
.
Id
==
6203182
||
Card
.
Id
==
69954399
||
Card
.
Id
==
33453260
)
{
{
cards
=
GetZoneCards
(
CardLocation
.
MonsterZone
,
Enemy
).
Where
(
card
=>
card
!=
null
&&
card
.
IsFaceup
()
&&
!
card
.
IsShouldNotBeTarget
()).
ToList
();
cards
=
GetZoneCards
(
CardLocation
.
MonsterZone
,
Enemy
).
Where
(
card
=>
card
!=
null
&&
card
.
IsFaceup
()
&&
!
card
.
IsShouldNotBeTarget
()).
ToList
();
if
(
cards
.
Count
()
>
0
)
{
AI
.
SelectCard
(
cards
);
return
true
;
}
return
false
;
}
cards
=
GetZoneCards
(
CardLocation
.
MonsterZone
,
Bot
).
Where
(
card
=>
card
!=
null
&&
card
.
IsFaceup
()
&&
!
card
.
IsShouldNotBeTarget
()).
ToList
();
if
(
cards
.
Count
()
>
0
)
{
AI
.
SelectCard
(
cards
);
AI
.
SelectCard
(
cards
);
return
cards
.
Count
()
>
0
;
return
true
;
}
}
cards
=
GetZoneCards
(
CardLocation
.
MonsterZone
,
Bot
).
Where
(
card
=>
card
!=
null
&&
card
.
IsFaceup
()
&&
!
card
.
IsShouldNotBeTarget
()
&&
card
.
HasSetcode
(
0x18d
)).
ToList
();
return
false
;
AI
.
SelectCard
(
cards
);
return
cards
.
Count
()
>
0
;
}
}
return
false
;
return
false
;
}
}
...
@@ -396,17 +395,35 @@ namespace WindBot.Game.AI.Decks
...
@@ -396,17 +395,35 @@ namespace WindBot.Game.AI.Decks
{
{
return
!
Card
.
EquipTarget
.
HasSetcode
(
0x18d
);
return
!
Card
.
EquipTarget
.
HasSetcode
(
0x18d
);
}
}
if
(
Card
.
Id
==
32939238
||
Card
.
Id
==
57736667
||
Card
.
Id
==
36148308
)
if
(
Card
.
Id
==
32939238
)
{
{
cards
=
GetZoneCards
(
CardLocation
.
Onfield
,
Enemy
).
Where
(
card
=>
card
!=
null
&&
!
card
.
IsShouldNotBeTarget
()).
ToList
();
cards
=
GetZoneCards
(
CardLocation
.
Onfield
,
Enemy
).
Where
(
card
=>
card
!=
null
&&
!
card
.
IsShouldNotBeTarget
()).
ToList
();
AI
.
SelectNextCard
(
cards
);
if
(
cards
.
Count
()
>
0
)
return
cards
.
Count
()
>
0
;
{
AI
.
SelectNextCard
(
cards
);
return
true
;
}
return
false
;
}
if
(
Card
.
Id
==
57736667
||
Card
.
Id
==
36148308
)
{
cards
=
GetZoneCards
(
CardLocation
.
Onfield
,
Enemy
).
Where
(
card
=>
card
!=
null
&&
!
card
.
IsShouldNotBeTarget
()).
ToList
();
if
(
cards
.
Count
()
>
0
)
{
AI
.
SelectCard
(
cards
);
return
true
;
}
return
false
;
}
}
if
(
Card
.
Id
==
99013397
||
Card
.
Id
==
70423794
||
Card
.
Id
==
22147147
)
if
(
Card
.
Id
==
99013397
||
Card
.
Id
==
70423794
||
Card
.
Id
==
22147147
)
{
{
cards
=
GetZoneCards
(
CardLocation
.
Onfield
,
Enemy
).
Where
(
card
=>
card
!=
null
&&
!
card
.
IsShouldNotBeTarget
()
&&
(
card
.
HasType
(
CardType
.
Spell
)
||
card
.
HasType
(
CardType
.
Trap
))).
ToList
();
cards
=
GetZoneCards
(
CardLocation
.
Onfield
,
Enemy
).
Where
(
card
=>
card
!=
null
&&
!
card
.
IsShouldNotBeTarget
()
&&
(
card
.
HasType
(
CardType
.
Spell
)
||
card
.
HasType
(
CardType
.
Trap
))).
ToList
();
AI
.
SelectCard
(
cards
);
if
(
cards
.
Count
()
>
0
)
return
cards
.
Count
()
>
0
;
{
AI
.
SelectCard
(
cards
);
return
true
;
}
return
false
;
}
}
return
DefaultDontChainMyself
();
return
DefaultDontChainMyself
();
}
}
...
@@ -415,14 +432,22 @@ namespace WindBot.Game.AI.Decks
...
@@ -415,14 +432,22 @@ namespace WindBot.Game.AI.Decks
if
(
Card
.
Id
==
64867422
)
if
(
Card
.
Id
==
64867422
)
{
{
cards
=
GetZoneCards
(
CardLocation
.
MonsterZone
,
Enemy
).
Where
(
card
=>
card
!=
null
&&
!
card
.
IsShouldNotBeTarget
()
&&
card
.
IsFaceup
()).
ToList
();
cards
=
GetZoneCards
(
CardLocation
.
MonsterZone
,
Enemy
).
Where
(
card
=>
card
!=
null
&&
!
card
.
IsShouldNotBeTarget
()
&&
card
.
IsFaceup
()).
ToList
();
AI
.
SelectCard
(
cards
);
if
(
cards
.
Count
()
>
0
)
return
cards
.
Count
()
>
0
;
{
AI
.
SelectCard
(
cards
);
return
true
;
}
return
false
;
}
}
if
(
Card
.
Id
==
66947913
)
if
(
Card
.
Id
==
66947913
)
{
{
cards
=
GetZoneCards
(
CardLocation
.
MonsterZone
,
Enemy
).
Where
(
card
=>
card
!=
null
&&
!
card
.
IsShouldNotBeTarget
()).
ToList
();
cards
=
GetZoneCards
(
CardLocation
.
MonsterZone
,
Enemy
).
Where
(
card
=>
card
!=
null
&&
!
card
.
IsShouldNotBeTarget
()).
ToList
();
AI
.
SelectCard
(
cards
);
if
(
cards
.
Count
()
>
0
)
return
cards
.
Count
()
>
0
;
{
AI
.
SelectCard
(
cards
);
return
true
;
}
return
false
;
}
}
return
DefaultDontChainMyself
();
return
DefaultDontChainMyself
();
}
}
...
@@ -472,10 +497,6 @@ namespace WindBot.Game.AI.Decks
...
@@ -472,10 +497,6 @@ namespace WindBot.Game.AI.Decks
return
DefaultDontChainMyself
();
return
DefaultDontChainMyself
();
}
}
private
bool
JustDontIt
()
{
return
false
;
}
public
override
CardPosition
OnSelectPosition
(
int
cardId
,
IList
<
CardPosition
>
positions
)
public
override
CardPosition
OnSelectPosition
(
int
cardId
,
IList
<
CardPosition
>
positions
)
{
{
YGOSharp
.
OCGWrapper
.
NamedCard
cardData
=
YGOSharp
.
OCGWrapper
.
NamedCard
.
Get
(
cardId
);
YGOSharp
.
OCGWrapper
.
NamedCard
cardData
=
YGOSharp
.
OCGWrapper
.
NamedCard
.
Get
(
cardId
);
...
@@ -493,16 +514,19 @@ namespace WindBot.Game.AI.Decks
...
@@ -493,16 +514,19 @@ namespace WindBot.Game.AI.Decks
}
}
else
else
{
{
if
(
cardData
.
Defense
<
3000
)
if
(
cardData
.
Defense
>=
2000
&&
cardData
.
Defense
>
cardData
.
Attack
)
return
CardPosition
.
FaceUpAttack
;
else
return
CardPosition
.
FaceUpDefence
;
return
CardPosition
.
FaceUpDefence
;
else
return
CardPosition
.
FaceUpAttack
;
}
}
}
}
return
0
;
return
0
;
}
}
public
override
BattlePhaseAction
OnSelectAttackTarget
(
ClientCard
attacker
,
IList
<
ClientCard
>
defenders
)
public
override
BattlePhaseAction
OnSelectAttackTarget
(
ClientCard
attacker
,
IList
<
ClientCard
>
defenders
)
{
{
if
(
attacker
.
CanDirectAttack
)
return
AI
.
Attack
(
attacker
,
null
);
int
atk
=
attacker
.
Attack
;
int
atk
=
attacker
.
Attack
;
if
(!
attacker
.
IsAttack
())
if
(!
attacker
.
IsAttack
())
atk
=
attacker
.
GetDefensePower
();
atk
=
attacker
.
GetDefensePower
();
...
@@ -513,9 +537,6 @@ namespace WindBot.Game.AI.Decks
...
@@ -513,9 +537,6 @@ namespace WindBot.Game.AI.Decks
if
(
BlackmailAttacker
(
attacker
,
Bot
))
if
(
BlackmailAttacker
(
attacker
,
Bot
))
{
{
if
(
attacker
.
CanDirectAttack
)
return
AI
.
Attack
(
attacker
,
null
);
if
(
cards1
.
Count
()
>
0
&&
cards2
.
Count
()
>
0
)
if
(
cards1
.
Count
()
>
0
&&
cards2
.
Count
()
>
0
)
{
{
int
dam1
=
cards1
[
0
].
GetDefensePower
();
int
dam1
=
cards1
[
0
].
GetDefensePower
();
...
@@ -563,9 +584,6 @@ namespace WindBot.Game.AI.Decks
...
@@ -563,9 +584,6 @@ namespace WindBot.Game.AI.Decks
return
null
;
return
null
;
}
}
private
bool
MonsterRepos
()
private
bool
MonsterRepos
()
{
{
if
(
Duel
.
Phase
==
DuelPhase
.
Main1
&&
(
FilpMonster
(
Card
.
Id
))
&&
Card
.
IsFacedown
())
if
(
Duel
.
Phase
==
DuelPhase
.
Main1
&&
(
FilpMonster
(
Card
.
Id
))
&&
Card
.
IsFacedown
())
...
@@ -581,15 +599,16 @@ namespace WindBot.Game.AI.Decks
...
@@ -581,15 +599,16 @@ namespace WindBot.Game.AI.Decks
if
(
Card
.
IsFaceup
()
&&
Card
.
IsDefense
())
if
(
Card
.
IsFaceup
()
&&
Card
.
IsDefense
())
return
true
;
return
true
;
}
}
if
(
Card
.
Defense
>
Card
.
Attack
)
else
if
(
Card
.
Defense
>
Card
.
Attack
)
return
DefaultMonsterRepos
();
return
DefaultMonsterRepos
();
else
else
{
{
if
(
Card
.
IsFaceup
()
&&
Card
.
IsAttack
())
if
(
Card
.
IsFaceup
()
&&
Card
.
IsAttack
())
return
Bot
.
LifePoints
<=
1500
;
return
Bot
.
LifePoints
<=
1500
&&
GetZoneCards
(
CardLocation
.
MonsterZone
,
Enemy
).
Count
(
card
=>
card
!=
null
&&
card
.
Attack
<
Card
.
Attack
)
==
0
&&
GetZoneCards
(
CardLocation
.
MonsterZone
,
Enemy
).
Count
()
>
0
&&
Card
.
Attack
<
1500
;
if
(
Card
.
IsDefense
())
else
return
Bot
.
LifePoints
>
1500
;
return
Bot
.
LifePoints
>
1500
||
GetZoneCards
(
CardLocation
.
MonsterZone
,
Enemy
).
Count
(
card
=>
card
!=
null
&&
card
.
Attack
<
Card
.
Attack
)
>
0
||
GetZoneCards
(
CardLocation
.
MonsterZone
,
Enemy
).
Count
()
==
0
||
Card
.
Attack
>=
1500
;
}
}
return
false
;
}
}
return
false
;
return
false
;
...
...
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