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
Tang Xinwei
windbot
Commits
43086945
Commit
43086945
authored
Aug 29, 2018
by
mercury233
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/IceYGO/windbot
parents
8880a1d5
73314e40
Changes
38
Show whitespace changes
Inline
Side-by-side
Showing
38 changed files
with
1032 additions
and
1223 deletions
+1032
-1223
BotWrapper/BotWrapper.cs
BotWrapper/BotWrapper.cs
+65
-65
Game/AI/AIFunctions.cs
Game/AI/AIFunctions.cs
+122
-163
Game/AI/CardContainer.cs
Game/AI/CardContainer.cs
+34
-128
Game/AI/CardSelector.cs
Game/AI/CardSelector.cs
+2
-2
Game/AI/Decks/AltergeistExecutor.cs
Game/AI/Decks/AltergeistExecutor.cs
+106
-100
Game/AI/Decks/BlackwingExecutor.cs
Game/AI/Decks/BlackwingExecutor.cs
+4
-4
Game/AI/Decks/BlueEyesExecutor.cs
Game/AI/Decks/BlueEyesExecutor.cs
+11
-35
Game/AI/Decks/BlueEyesMaxDragonExecutor.cs
Game/AI/Decks/BlueEyesMaxDragonExecutor.cs
+30
-34
Game/AI/Decks/BurnExecutor.cs
Game/AI/Decks/BurnExecutor.cs
+3
-3
Game/AI/Decks/ChainBurnExecutor.cs
Game/AI/Decks/ChainBurnExecutor.cs
+27
-27
Game/AI/Decks/DarkMagicianExecutor.cs
Game/AI/Decks/DarkMagicianExecutor.cs
+34
-39
Game/AI/Decks/DragunityExecutor.cs
Game/AI/Decks/DragunityExecutor.cs
+9
-10
Game/AI/Decks/FrogExecutor.cs
Game/AI/Decks/FrogExecutor.cs
+7
-7
Game/AI/Decks/GrenMajuThunderBoarderExecutor.cs
Game/AI/Decks/GrenMajuThunderBoarderExecutor.cs
+22
-25
Game/AI/Decks/HorusExecutor.cs
Game/AI/Decks/HorusExecutor.cs
+3
-3
Game/AI/Decks/LightswornExecutor.cs
Game/AI/Decks/LightswornExecutor.cs
+4
-3
Game/AI/Decks/LightswornShaddoldinosourExecutor.cs
Game/AI/Decks/LightswornShaddoldinosourExecutor.cs
+41
-47
Game/AI/Decks/NekrozExecutor.cs
Game/AI/Decks/NekrozExecutor.cs
+5
-5
Game/AI/Decks/PhantasmExecutor.cs
Game/AI/Decks/PhantasmExecutor.cs
+19
-19
Game/AI/Decks/QliphortExecutor.cs
Game/AI/Decks/QliphortExecutor.cs
+3
-3
Game/AI/Decks/RainbowExecutor.cs
Game/AI/Decks/RainbowExecutor.cs
+3
-3
Game/AI/Decks/Rank5Executor.cs
Game/AI/Decks/Rank5Executor.cs
+9
-11
Game/AI/Decks/ST1732Executor.cs
Game/AI/Decks/ST1732Executor.cs
+3
-3
Game/AI/Decks/SkyStrikerExecutor.cs
Game/AI/Decks/SkyStrikerExecutor.cs
+7
-7
Game/AI/Decks/ToadallyAwesomeExecutor.cs
Game/AI/Decks/ToadallyAwesomeExecutor.cs
+9
-9
Game/AI/Decks/TrickstarExecutor.cs
Game/AI/Decks/TrickstarExecutor.cs
+40
-40
Game/AI/Decks/YosenjuExecutor.cs
Game/AI/Decks/YosenjuExecutor.cs
+5
-7
Game/AI/Decks/ZexalWeaponsExecutor.cs
Game/AI/Decks/ZexalWeaponsExecutor.cs
+13
-7
Game/AI/Decks/ZoodiacExecutor.cs
Game/AI/Decks/ZoodiacExecutor.cs
+6
-6
Game/AI/DefaultExecutor.cs
Game/AI/DefaultExecutor.cs
+185
-252
Game/AI/Dialogs.cs
Game/AI/Dialogs.cs
+1
-1
Game/AI/Executor.cs
Game/AI/Executor.cs
+4
-8
Game/ClientCard.cs
Game/ClientCard.cs
+97
-9
Game/ClientField.cs
Game/ClientField.cs
+37
-100
Game/Deck.cs
Game/Deck.cs
+1
-2
Game/GameAI.cs
Game/GameAI.cs
+16
-26
Game/GameBehavior.cs
Game/GameBehavior.cs
+45
-10
YGOSharp.OCGWrapper.Enums.dll
YGOSharp.OCGWrapper.Enums.dll
+0
-0
No files found.
BotWrapper/BotWrapper.cs
View file @
43086945
Game/AI/AIFunctions.cs
View file @
43086945
using
System.Collections.Generic
;
using
System.Linq
;
using
YGOSharp.OCGWrapper.Enums
;
namespace
WindBot.Game.AI
{
...
...
@@ -46,13 +47,7 @@ namespace WindBot.Game.AI
/// </summary>
public
int
GetTotalAttackingMonsterAttack
(
int
player
)
{
int
atk
=
0
;
foreach
(
ClientCard
m
in
Duel
.
Fields
[
player
].
GetMonsters
())
{
if
(
m
.
IsAttack
())
atk
+=
m
.
Attack
;
}
return
atk
;
return
Duel
.
Fields
[
player
].
GetMonsters
().
Where
(
m
=>
m
.
IsAttack
()).
Sum
(
m
=>
(
int
?)
m
.
Attack
)
??
0
;
}
/// <summary>
/// Get the best ATK or DEF power of the field.
...
...
@@ -61,17 +56,9 @@ namespace WindBot.Game.AI
/// <param name="onlyATK">Only calculate attack.</param>
public
int
GetBestPower
(
ClientField
field
,
bool
onlyATK
=
false
)
{
int
bestPower
=
-
1
;
for
(
int
i
=
0
;
i
<
7
;
++
i
)
{
ClientCard
card
=
field
.
MonsterZone
[
i
];
if
(
card
==
null
||
card
.
Data
==
null
)
continue
;
if
(
onlyATK
&&
card
.
IsDefense
())
continue
;
int
newPower
=
card
.
GetDefensePower
();
if
(
newPower
>
bestPower
)
bestPower
=
newPower
;
}
return
bestPower
;
return
field
.
MonsterZone
.
GetMonsters
()
.
Where
(
card
=>
!
onlyATK
||
card
.
IsAttack
())
.
Max
(
card
=>
(
int
?)
card
.
GetDefensePower
())
??
-
1
;
}
public
int
GetBestAttack
(
ClientField
field
)
...
...
@@ -81,36 +68,14 @@ namespace WindBot.Game.AI
public
bool
IsOneEnemyBetterThanValue
(
int
value
,
bool
onlyATK
)
{
int
bestValue
=
-
1
;
bool
nomonster
=
true
;
for
(
int
i
=
0
;
i
<
7
;
++
i
)
{
ClientCard
card
=
Enemy
.
MonsterZone
[
i
];
if
(
card
==
null
||
card
.
Data
==
null
)
continue
;
if
(
onlyATK
&&
card
.
IsDefense
())
continue
;
nomonster
=
false
;
int
enemyValue
=
card
.
GetDefensePower
();
if
(
enemyValue
>
bestValue
)
bestValue
=
enemyValue
;
}
if
(
nomonster
)
return
false
;
return
bestValue
>
value
;
return
Enemy
.
MonsterZone
.
GetMonsters
()
.
Any
(
card
=>
card
.
GetDefensePower
()
>
value
&&
(!
onlyATK
||
card
.
IsAttack
()));
}
public
bool
IsAllEnemyBetterThanValue
(
int
value
,
bool
onlyATK
)
{
bool
nomonster
=
true
;
for
(
int
i
=
0
;
i
<
7
;
++
i
)
{
ClientCard
card
=
Enemy
.
MonsterZone
[
i
];
if
(
card
==
null
||
card
.
Data
==
null
)
continue
;
if
(
onlyATK
&&
card
.
IsDefense
())
continue
;
nomonster
=
false
;
int
enemyValue
=
card
.
GetDefensePower
();
if
(
enemyValue
<=
value
)
return
false
;
}
return
!
nomonster
;
return
Enemy
.
MonsterZone
.
GetMonsters
()
.
All
(
card
=>
card
.
GetDefensePower
()
>
value
&&
(!
onlyATK
||
card
.
IsAttack
()));
}
/// <summary>
...
...
@@ -146,59 +111,24 @@ namespace WindBot.Game.AI
public
ClientCard
GetBestBotMonster
(
bool
onlyATK
=
false
)
{
int
bestPower
=
-
1
;
ClientCard
bestMonster
=
null
;
for
(
int
i
=
0
;
i
<
7
;
++
i
)
{
ClientCard
card
=
Bot
.
MonsterZone
[
i
];
if
(
card
==
null
||
card
.
Data
==
null
)
continue
;
if
(
onlyATK
&&
card
.
IsDefense
())
continue
;
int
newPower
=
card
.
GetDefensePower
();
if
(
newPower
>
bestPower
)
{
bestPower
=
newPower
;
bestMonster
=
card
;
}
}
return
bestMonster
;
return
Bot
.
MonsterZone
.
GetMonsters
()
.
Where
(
card
=>
!
onlyATK
||
card
.
IsAttack
())
.
OrderByDescending
(
card
=>
card
.
GetDefensePower
())
.
FirstOrDefault
();
}
public
ClientCard
GetWorstBotMonster
(
bool
onlyATK
=
false
)
{
int
WorstPower
=
-
1
;
ClientCard
WorstMonster
=
null
;
for
(
int
i
=
0
;
i
<
7
;
++
i
)
{
ClientCard
card
=
Bot
.
MonsterZone
[
i
];
if
(
card
==
null
||
card
.
Data
==
null
)
continue
;
if
(
onlyATK
&&
card
.
IsDefense
())
continue
;
int
newPower
=
card
.
GetDefensePower
();
if
(
newPower
<
WorstPower
)
{
WorstPower
=
newPower
;
WorstMonster
=
card
;
}
}
return
WorstMonster
;
return
Bot
.
MonsterZone
.
GetMonsters
()
.
Where
(
card
=>
!
onlyATK
||
card
.
IsAttack
())
.
OrderBy
(
card
=>
card
.
GetDefensePower
())
.
FirstOrDefault
();
}
public
ClientCard
GetOneEnemyBetterThanValue
(
int
value
,
bool
onlyATK
=
false
,
bool
canBeTarget
=
false
)
{
ClientCard
bestCard
=
null
;
int
bestValue
=
value
;
for
(
int
i
=
0
;
i
<
7
;
++
i
)
{
ClientCard
card
=
Enemy
.
MonsterZone
[
i
];
if
(
card
==
null
||
card
.
Data
==
null
||
(
canBeTarget
&&
card
.
IsShouldNotBeTarget
()))
continue
;
if
(
onlyATK
&&
card
.
IsDefense
())
continue
;
int
enemyValue
=
card
.
GetDefensePower
();
if
(
enemyValue
>=
bestValue
)
{
bestCard
=
card
;
bestValue
=
enemyValue
;
}
}
return
bestCard
;
return
Enemy
.
MonsterZone
.
GetMonsters
()
.
FirstOrDefault
(
card
=>
card
.
GetDefensePower
()
>
value
&&
(!
onlyATK
||
card
.
IsAttack
())
&&
(!
canBeTarget
||
!
card
.
IsShouldNotBeTarget
()));
}
public
ClientCard
GetOneEnemyBetterThanMyBest
(
bool
onlyATK
=
false
,
bool
canBeTarget
=
false
)
...
...
@@ -289,21 +219,10 @@ namespace WindBot.Game.AI
public
ClientCard
GetWorstEnemyMonster
(
bool
onlyATK
=
false
)
{
int
WorstPower
=
-
1
;
ClientCard
WorstMonster
=
null
;
for
(
int
i
=
0
;
i
<
7
;
++
i
)
{
ClientCard
card
=
Enemy
.
MonsterZone
[
i
];
if
(
card
==
null
||
card
.
Data
==
null
)
continue
;
if
(
onlyATK
&&
card
.
IsDefense
())
continue
;
int
newPower
=
card
.
GetDefensePower
();
if
(
newPower
<
WorstPower
)
{
WorstPower
=
newPower
;
WorstMonster
=
card
;
}
}
return
WorstMonster
;
return
Enemy
.
MonsterZone
.
GetMonsters
()
.
Where
(
card
=>
!
onlyATK
||
card
.
IsAttack
())
.
OrderBy
(
card
=>
card
.
GetDefensePower
())
.
FirstOrDefault
();
}
public
ClientCard
GetBestEnemySpell
(
bool
onlyFaceup
=
false
)
...
...
@@ -312,14 +231,11 @@ namespace WindBot.Game.AI
if
(
card
!=
null
)
return
card
;
List
<
ClientCard
>
spells
=
Enemy
.
GetSpells
();
var
spells
=
Enemy
.
GetSpells
();
foreach
(
ClientCard
ecard
in
spells
)
{
if
(
ecard
.
IsFaceup
()
&&
ecard
.
HasType
(
CardType
.
Continuous
)||
ecard
.
IsFaceup
()
&&
ecard
.
HasType
(
CardType
.
Field
))
return
ecard
;
}
card
=
spells
.
FirstOrDefault
(
ecard
=>
ecard
.
IsFaceup
()
&&
(
ecard
.
HasType
(
CardType
.
Continuous
)
||
ecard
.
HasType
(
CardType
.
Field
)));
if
(
card
!=
null
)
return
card
;
if
(
spells
.
Count
>
0
&&
!
onlyFaceup
)
return
spells
[
0
];
...
...
@@ -349,16 +265,67 @@ namespace WindBot.Game.AI
return
Duel
.
Turn
==
1
||
Duel
.
Phase
==
DuelPhase
.
Main2
;
}
public
bool
IsChainTarget
(
ClientCard
card
)
internal
bool
inListOrNull
(
ClientCard
card
,
IList
<
ClientCard
>
list
)
{
foreach
(
ClientCard
target
in
Duel
.
ChainTargets
)
return
card
==
null
||
list
.
Contains
(
card
);
}
public
int
GetBotAvailZonesFromExtraDeck
(
IList
<
ClientCard
>
remove
)
{
if
(
card
.
Equals
(
target
))
if
(!
Duel
.
IsNewRule
)
return
Zones
.
MainMonsterZones
;
int
result
=
0
;
if
(
inListOrNull
(
Bot
.
MonsterZone
[
5
],
remove
)
&&
inListOrNull
(
Bot
.
MonsterZone
[
6
],
remove
)
&&
(
inListOrNull
(
Enemy
.
MonsterZone
[
5
],
remove
)
||
inListOrNull
(
Enemy
.
MonsterZone
[
6
],
remove
)))
result
|=
Zones
.
ExtraMonsterZones
;
if
(
inListOrNull
(
Bot
.
MonsterZone
[
0
],
remove
)
&&
(!
inListOrNull
(
Bot
.
MonsterZone
[
1
],
remove
)
&&
Bot
.
MonsterZone
[
1
].
HasLinkMarker
(
CardLinkMarker
.
Left
)
||
!
inListOrNull
(
Bot
.
MonsterZone
[
5
],
remove
)
&&
Bot
.
MonsterZone
[
5
].
HasLinkMarker
(
CardLinkMarker
.
BottomLeft
)
||
!
inListOrNull
(
Enemy
.
MonsterZone
[
6
],
remove
)
&&
Enemy
.
MonsterZone
[
6
].
HasLinkMarker
(
CardLinkMarker
.
TopRight
)))
result
+=
Zones
.
z0
;
if
(
inListOrNull
(
Bot
.
MonsterZone
[
1
],
remove
)
&&
(!
inListOrNull
(
Bot
.
MonsterZone
[
0
],
remove
)
&&
Bot
.
MonsterZone
[
0
].
HasLinkMarker
(
CardLinkMarker
.
Right
)
||
!
inListOrNull
(
Bot
.
MonsterZone
[
2
],
remove
)
&&
Bot
.
MonsterZone
[
2
].
HasLinkMarker
(
CardLinkMarker
.
Left
)
||
!
inListOrNull
(
Bot
.
MonsterZone
[
5
],
remove
)
&&
Bot
.
MonsterZone
[
5
].
HasLinkMarker
(
CardLinkMarker
.
Bottom
)
||
!
inListOrNull
(
Enemy
.
MonsterZone
[
6
],
remove
)
&&
Enemy
.
MonsterZone
[
6
].
HasLinkMarker
(
CardLinkMarker
.
Top
)))
result
+=
Zones
.
z1
;
if
(
inListOrNull
(
Bot
.
MonsterZone
[
2
],
remove
)
&&
(!
inListOrNull
(
Bot
.
MonsterZone
[
1
],
remove
)
&&
Bot
.
MonsterZone
[
1
].
HasLinkMarker
(
CardLinkMarker
.
Right
)
||
!
inListOrNull
(
Bot
.
MonsterZone
[
3
],
remove
)
&&
Bot
.
MonsterZone
[
3
].
HasLinkMarker
(
CardLinkMarker
.
Left
)
||
!
inListOrNull
(
Bot
.
MonsterZone
[
5
],
remove
)
&&
Bot
.
MonsterZone
[
5
].
HasLinkMarker
(
CardLinkMarker
.
BottomRight
)
||
!
inListOrNull
(
Enemy
.
MonsterZone
[
6
],
remove
)
&&
Enemy
.
MonsterZone
[
6
].
HasLinkMarker
(
CardLinkMarker
.
TopLeft
)
||
!
inListOrNull
(
Bot
.
MonsterZone
[
6
],
remove
)
&&
Bot
.
MonsterZone
[
6
].
HasLinkMarker
(
CardLinkMarker
.
BottomLeft
)
||
!
inListOrNull
(
Enemy
.
MonsterZone
[
5
],
remove
)
&&
Enemy
.
MonsterZone
[
5
].
HasLinkMarker
(
CardLinkMarker
.
TopRight
)))
result
+=
Zones
.
z2
;
if
(
inListOrNull
(
Bot
.
MonsterZone
[
3
],
remove
)
&&
(!
inListOrNull
(
Bot
.
MonsterZone
[
2
],
remove
)
&&
Bot
.
MonsterZone
[
2
].
HasLinkMarker
(
CardLinkMarker
.
Right
)
||
!
inListOrNull
(
Bot
.
MonsterZone
[
4
],
remove
)
&&
Bot
.
MonsterZone
[
4
].
HasLinkMarker
(
CardLinkMarker
.
Left
)
||
!
inListOrNull
(
Bot
.
MonsterZone
[
6
],
remove
)
&&
Bot
.
MonsterZone
[
6
].
HasLinkMarker
(
CardLinkMarker
.
Bottom
)
||
!
inListOrNull
(
Enemy
.
MonsterZone
[
5
],
remove
)
&&
Enemy
.
MonsterZone
[
5
].
HasLinkMarker
(
CardLinkMarker
.
Top
)))
result
+=
Zones
.
z3
;
if
(
inListOrNull
(
Bot
.
MonsterZone
[
4
],
remove
)
&&
(!
inListOrNull
(
Bot
.
MonsterZone
[
3
],
remove
)
&&
Bot
.
MonsterZone
[
3
].
HasLinkMarker
(
CardLinkMarker
.
Right
)
||
!
inListOrNull
(
Bot
.
MonsterZone
[
6
],
remove
)
&&
Bot
.
MonsterZone
[
6
].
HasLinkMarker
(
CardLinkMarker
.
BottomRight
)
||
!
inListOrNull
(
Enemy
.
MonsterZone
[
5
],
remove
)
&&
Enemy
.
MonsterZone
[
5
].
HasLinkMarker
(
CardLinkMarker
.
TopLeft
)))
result
+=
Zones
.
z4
;
return
result
;
}
public
int
GetBotAvailZonesFromExtraDeck
(
ClientCard
remove
)
{
return
true
;
return
GetBotAvailZonesFromExtraDeck
(
new
[]
{
remove
})
;
}
public
int
GetBotAvailZonesFromExtraDeck
()
{
return
GetBotAvailZonesFromExtraDeck
(
new
List
<
ClientCard
>());
}
return
false
;
public
bool
IsChainTarget
(
ClientCard
card
)
{
return
Duel
.
ChainTargets
.
Any
(
card
.
Equals
);
}
public
bool
IsChainTargetOnly
(
ClientCard
card
)
...
...
@@ -368,86 +335,70 @@ namespace WindBot.Game.AI
public
bool
ChainContainsCard
(
int
id
)
{
foreach
(
ClientCard
card
in
Duel
.
CurrentChain
)
{
if
(
card
.
Id
==
id
)
return
true
;
return
Duel
.
CurrentChain
.
Any
(
card
=>
card
.
IsCode
(
id
));
}
return
false
;
public
bool
ChainContainsCard
(
int
[]
ids
)
{
return
Duel
.
CurrentChain
.
Any
(
card
=>
card
.
IsCode
(
ids
));
}
public
int
ChainCountPlayer
(
int
player
)
{
int
count
=
0
;
foreach
(
ClientCard
card
in
Duel
.
CurrentChain
)
{
if
(
card
.
Controller
==
player
)
count
++;
}
return
count
;
return
Duel
.
CurrentChain
.
Count
(
card
=>
card
.
Controller
==
player
);
}
public
bool
ChainContainPlayer
(
int
player
)
{
foreach
(
ClientCard
card
in
Duel
.
CurrentChain
)
{
if
(
card
.
Controller
==
player
)
return
true
;
}
return
false
;
return
Duel
.
CurrentChain
.
Any
(
card
=>
card
.
Controller
==
player
);
}
public
bool
HasChainedTrap
(
int
player
)
{
foreach
(
ClientCard
card
in
Duel
.
CurrentChain
)
{
if
(
card
.
Controller
==
player
&&
card
.
HasType
(
CardType
.
Trap
))
return
true
;
}
return
false
;
return
Duel
.
CurrentChain
.
Any
(
card
=>
card
.
Controller
==
player
&&
card
.
HasType
(
CardType
.
Trap
));
}
public
ClientCard
GetLastChainCard
()
{
if
(
Duel
.
CurrentChain
.
Count
>
0
)
return
Duel
.
CurrentChain
[
Duel
.
CurrentChain
.
Count
-
1
];
return
null
;
return
Duel
.
CurrentChain
.
LastOrDefault
();
}
/// <summary>
/// Select cards listed in preferred.
/// </summary>
public
void
SelectPreferredCards
(
IList
<
ClientCard
>
selected
,
ClientCard
preferred
,
IList
<
ClientCard
>
cards
,
int
min
,
int
max
)
public
IList
<
ClientCard
>
SelectPreferredCards
(
ClientCard
preferred
,
IList
<
ClientCard
>
cards
,
int
min
,
int
max
)
{
IList
<
ClientCard
>
selected
=
new
List
<
ClientCard
>();
if
(
cards
.
IndexOf
(
preferred
)
>
0
&&
selected
.
Count
<
max
)
{
selected
.
Add
(
preferred
);
}
return
selected
;
}
/// <summary>
/// Select cards listed in preferred.
/// </summary>
public
void
SelectPreferredCards
(
IList
<
ClientCard
>
selected
,
int
preferred
,
IList
<
ClientCard
>
cards
,
int
min
,
int
max
)
public
IList
<
ClientCard
>
SelectPreferredCards
(
int
preferred
,
IList
<
ClientCard
>
cards
,
int
min
,
int
max
)
{
IList
<
ClientCard
>
selected
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
card
in
cards
)
{
if
(
card
.
I
d
==
preferred
&&
selected
.
Count
<
max
)
if
(
card
.
I
sCode
(
preferred
)
&&
selected
.
Count
<
max
)
selected
.
Add
(
card
);
}
return
selected
;
}
/// <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
)
public
IList
<
ClientCard
>
SelectPreferredCards
(
IList
<
ClientCard
>
preferred
,
IList
<
ClientCard
>
cards
,
int
min
,
int
max
)
{
// clone
avail
.
Add
(
card
);
}
IList
<
ClientCard
>
selected
=
new
List
<
ClientCard
>();
IList
<
ClientCard
>
avail
=
cards
.
ToList
();
// clone
while
(
preferred
.
Count
>
0
&&
avail
.
IndexOf
(
preferred
[
0
])
>
0
&&
selected
.
Count
<
max
)
{
ClientCard
card
=
preferred
[
0
];
...
...
@@ -455,30 +406,36 @@ namespace WindBot.Game.AI
avail
.
Remove
(
card
);
selected
.
Add
(
card
);
}
return
selected
;
}
/// <summary>
/// Select cards listed in preferred.
/// </summary>
public
void
SelectPreferredCards
(
IList
<
ClientCard
>
selected
,
IList
<
int
>
preferred
,
IList
<
ClientCard
>
cards
,
int
min
,
int
max
)
public
IList
<
ClientCard
>
SelectPreferredCards
(
IList
<
int
>
preferred
,
IList
<
ClientCard
>
cards
,
int
min
,
int
max
)
{
for
(
int
i
=
0
;
i
<
preferred
.
Count
;
i
++)
IList
<
ClientCard
>
selected
=
new
List
<
ClientCard
>();
foreach
(
int
id
in
preferred
)
{
foreach
(
ClientCard
card
in
cards
)
{
if
(
card
.
I
d
==
preferred
[
i
]
&&
selected
.
Count
<
max
&&
selected
.
IndexOf
(
card
)
<=
0
)
if
(
card
.
I
sCode
(
id
)
&&
selected
.
Count
<
max
&&
selected
.
IndexOf
(
card
)
<=
0
)
selected
.
Add
(
card
);
}
if
(
selected
.
Count
>=
max
)
break
;
}
return
selected
;
}
/// <summary>
/// Check and fix selected to make sure it meet the count requirement.
/// </summary>
public
void
CheckSelectCount
(
IList
<
ClientCard
>
selected
,
IList
<
ClientCard
>
cards
,
int
min
,
int
max
)
public
IList
<
ClientCard
>
CheckSelectCount
(
IList
<
ClientCard
>
_
selected
,
IList
<
ClientCard
>
cards
,
int
min
,
int
max
)
{
var
selected
=
_selected
.
ToList
();
if
(
selected
.
Count
<
min
)
{
foreach
(
ClientCard
card
in
cards
)
...
...
@@ -493,6 +450,8 @@ namespace WindBot.Game.AI
{
selected
.
RemoveAt
(
selected
.
Count
-
1
);
}
return
selected
;
}
}
}
\ No newline at end of file
Game/AI/CardContainer.cs
View file @
43086945
using
System.Collections.Generic
;
using
YGOSharp.OCGWrapper.Enums
;
using
System
;
using
System.Linq
;
namespace
WindBot.Game.AI
...
...
@@ -8,185 +9,90 @@ namespace WindBot.Game.AI
{
public
static
ClientCard
GetHighestAttackMonster
(
this
IEnumerable
<
ClientCard
>
cards
,
bool
canBeTarget
=
false
)
{
int
highestAtk
=
0
;
ClientCard
selected
=
null
;
foreach
(
ClientCard
card
in
cards
)
{
if
(
card
==
null
||
card
.
Data
==
null
||
card
.
IsFacedown
()
||
(
canBeTarget
&&
card
.
IsShouldNotBeTarget
()))
continue
;
if
(
card
.
HasType
(
CardType
.
Monster
)
&&
card
.
Attack
>
highestAtk
)
{
highestAtk
=
card
.
Attack
;
selected
=
card
;
}
}
return
selected
;
return
cards
.
Where
(
card
=>
card
?.
Data
!=
null
&&
card
.
HasType
(
CardType
.
Monster
)
&&
card
.
IsFaceup
()
&&
!(
canBeTarget
&&
card
.
IsShouldNotBeTarget
()))
.
OrderBy
(
card
=>
card
.
Attack
).
FirstOrDefault
();
}
public
static
ClientCard
GetHighestDefenseMonster
(
this
IEnumerable
<
ClientCard
>
cards
,
bool
canBeTarget
=
false
)
{
int
highestDef
=
0
;
ClientCard
selected
=
null
;
foreach
(
ClientCard
card
in
cards
)
{
if
(
card
==
null
||
card
.
Data
==
null
||
card
.
IsFacedown
()
||
(
canBeTarget
&&
card
.
IsShouldNotBeTarget
()))
continue
;
if
(
card
.
HasType
(
CardType
.
Monster
)
&&
card
.
Defense
>
highestDef
)
{
highestDef
=
card
.
Defense
;
selected
=
card
;
}
}
return
selected
;
return
cards
.
Where
(
card
=>
card
?.
Data
!=
null
&&
card
.
HasType
(
CardType
.
Monster
)
&&
card
.
IsFaceup
()
&&
!(
canBeTarget
&&
card
.
IsShouldNotBeTarget
()))
.
OrderBy
(
card
=>
card
.
Defense
).
FirstOrDefault
();
}
public
static
ClientCard
GetLowestAttackMonster
(
this
IEnumerable
<
ClientCard
>
cards
,
bool
canBeTarget
=
false
)
{
int
lowestAtk
=
0
;
ClientCard
selected
=
null
;
foreach
(
ClientCard
card
in
cards
)
{
if
(
card
==
null
||
card
.
Data
==
null
||
card
.
IsFacedown
()
||
(
canBeTarget
&&
card
.
IsShouldNotBeTarget
()))
continue
;
if
(
lowestAtk
==
0
&&
card
.
HasType
(
CardType
.
Monster
)
||
card
.
HasType
(
CardType
.
Monster
)
&&
card
.
Attack
<
lowestAtk
)
{
lowestAtk
=
card
.
Attack
;
selected
=
card
;
}
}
return
selected
;
return
cards
.
Where
(
card
=>
card
?.
Data
!=
null
&&
card
.
HasType
(
CardType
.
Monster
)
&&
card
.
IsFaceup
()
&&
!(
canBeTarget
&&
card
.
IsShouldNotBeTarget
()))
.
OrderByDescending
(
card
=>
card
.
Attack
).
FirstOrDefault
();
}
public
static
ClientCard
GetLowestDefenseMonster
(
this
IEnumerable
<
ClientCard
>
cards
,
bool
canBeTarget
=
false
)
{
int
lowestDef
=
0
;
ClientCard
selected
=
null
;
foreach
(
ClientCard
card
in
cards
)
{
if
(
card
==
null
||
card
.
Data
==
null
||
card
.
IsFacedown
()
||
(
canBeTarget
&&
card
.
IsShouldNotBeTarget
()))
continue
;
if
(
lowestDef
==
0
&&
card
.
HasType
(
CardType
.
Monster
)
||
card
.
HasType
(
CardType
.
Monster
)
&&
card
.
Defense
<
lowestDef
)
{
lowestDef
=
card
.
Defense
;
selected
=
card
;
}
}
return
selected
;
return
cards
.
Where
(
card
=>
card
?.
Data
!=
null
&&
card
.
HasType
(
CardType
.
Monster
)
&&
card
.
IsFaceup
()
&&
!(
canBeTarget
&&
card
.
IsShouldNotBeTarget
()))
.
OrderByDescending
(
card
=>
card
.
Defense
).
FirstOrDefault
();
}
public
static
bool
ContainsMonsterWithLevel
(
this
IEnumerable
<
ClientCard
>
cards
,
int
level
)
{
foreach
(
ClientCard
card
in
cards
)
{
if
(
card
==
null
)
continue
;
if
(!
card
.
HasType
(
CardType
.
Xyz
)
&&
card
.
Level
==
level
)
return
true
;
}
return
false
;
return
cards
.
Where
(
card
=>
card
?.
Data
!=
null
).
Any
(
card
=>
!
card
.
HasType
(
CardType
.
Xyz
)
&&
card
.
Level
==
level
);
}
public
static
bool
ContainsMonsterWithRank
(
this
IEnumerable
<
ClientCard
>
cards
,
int
rank
)
{
foreach
(
ClientCard
card
in
cards
)
{
if
(
card
==
null
)
continue
;
if
(
card
.
HasType
(
CardType
.
Xyz
)
&&
card
.
Rank
==
rank
)
return
true
;
}
return
false
;
return
cards
.
Where
(
card
=>
card
?.
Data
!=
null
).
Any
(
card
=>
card
.
HasType
(
CardType
.
Xyz
)
&&
card
.
Rank
==
rank
);
}
public
static
bool
ContainsCardWithId
(
this
IEnumerable
<
ClientCard
>
cards
,
int
id
)
{
foreach
(
ClientCard
card
in
cards
)
{
if
(
card
==
null
)
continue
;
if
(
card
.
Id
==
id
)
return
true
;
}
return
false
;
return
cards
.
Where
(
card
=>
card
?.
Data
!=
null
).
Any
(
card
=>
card
.
IsCode
(
id
));
}
public
static
int
GetCardCount
(
this
IEnumerable
<
ClientCard
>
cards
,
int
id
)
{
int
count
=
0
;
foreach
(
ClientCard
card
in
cards
)
{
if
(
card
==
null
)
continue
;
if
(
card
.
Id
==
id
)
count
++;
}
return
count
;
return
cards
.
Where
(
card
=>
card
?.
Data
!=
null
).
Count
(
card
=>
card
.
IsCode
(
id
));
}
public
static
List
<
ClientCard
>
GetMonsters
(
this
IEnumerable
<
ClientCard
>
cards
)
{
List
<
ClientCard
>
cardlist
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
card
in
cards
)
{
if
(
card
==
null
)
continue
;
if
(
card
.
HasType
(
CardType
.
Monster
))
cardlist
.
Add
(
card
);
}
return
cardlist
;
return
cards
.
Where
(
card
=>
card
?.
Data
!=
null
&&
card
.
HasType
(
CardType
.
Monster
)).
ToList
();
}
public
static
List
<
ClientCard
>
GetFaceupPendulumMonsters
(
this
IEnumerable
<
ClientCard
>
cards
)
{
List
<
ClientCard
>
cardlist
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
card
in
cards
)
{
if
(
card
==
null
)
continue
;
if
(
card
.
HasType
(
CardType
.
Monster
)
&&
card
.
IsFaceup
()
&&
card
.
HasType
(
CardType
.
Pendulum
))
cardlist
.
Add
(
card
);
}
return
cardlist
;
return
cards
.
Where
(
card
=>
card
?.
Data
!=
null
&&
card
.
HasType
(
CardType
.
Monster
)
&&
card
.
IsFaceup
()
&&
card
.
HasType
(
CardType
.
Pendulum
)).
ToList
();
}
public
static
ClientCard
GetInvincibleMonster
(
this
IEnumerable
<
ClientCard
>
cards
,
bool
canBeTarget
=
false
)
{
foreach
(
ClientCard
card
in
cards
)
{
if
(
card
!=
null
&&
card
.
IsMonsterInvincible
()
&&
card
.
IsFaceup
()
&&
(!
canBeTarget
||
!
card
.
IsShouldNotBeTarget
()))
return
card
;
}
return
null
;
return
cards
.
FirstOrDefault
(
card
=>
card
?.
Data
!=
null
&&
card
.
IsMonsterInvincible
()
&&
card
.
IsFaceup
()
&&
(!
canBeTarget
||
!
card
.
IsShouldNotBeTarget
()));
}
public
static
ClientCard
GetDangerousMonster
(
this
IEnumerable
<
ClientCard
>
cards
,
bool
canBeTarget
=
false
)
{
foreach
(
ClientCard
card
in
cards
)
{
if
(
card
!=
null
&&
card
.
IsMonsterDangerous
()
&&
card
.
IsFaceup
()
&&
(!
canBeTarget
||
!
card
.
IsShouldNotBeTarget
()))
return
card
;
}
return
null
;
return
cards
.
FirstOrDefault
(
card
=>
card
?.
Data
!=
null
&&
card
.
IsMonsterDangerous
()
&&
card
.
IsFaceup
()
&&
(!
canBeTarget
||
!
card
.
IsShouldNotBeTarget
()));
}
public
static
ClientCard
GetFloodgate
(
this
IEnumerable
<
ClientCard
>
cards
,
bool
canBeTarget
=
false
)
{
foreach
(
ClientCard
card
in
cards
)
{
if
(
card
!=
null
&&
card
.
IsFloodgate
()
&&
card
.
IsFaceup
()
&&
(!
canBeTarget
||
!
card
.
IsShouldNotBeTarget
()))
return
card
;
}
return
null
;
return
cards
.
FirstOrDefault
(
card
=>
card
?.
Data
!=
null
&&
card
.
IsFloodgate
()
&&
card
.
IsFaceup
()
&&
(!
canBeTarget
||
!
card
.
IsShouldNotBeTarget
()));
}
public
static
ClientCard
Get
ShouldBeDisabledBeforeItUseEffectMonster
(
this
IEnumerable
<
ClientCard
>
cards
)
public
static
ClientCard
Get
FirstMatchingCard
(
this
IEnumerable
<
ClientCard
>
cards
,
Func
<
ClientCard
,
bool
>
filter
)
{
foreach
(
ClientCard
card
in
cards
)
return
cards
.
FirstOrDefault
(
card
=>
card
?.
Data
!=
null
&&
filter
.
Invoke
(
card
));
}
public
static
ClientCard
GetFirstMatchingFaceupCard
(
this
IEnumerable
<
ClientCard
>
cards
,
Func
<
ClientCard
,
bool
>
filter
)
{
if
(
card
!=
null
&&
card
.
IsMonsterShouldBeDisabledBeforeItUseEffect
()
&&
card
.
IsFaceup
())
return
card
;
return
cards
.
FirstOrDefault
(
card
=>
card
?.
Data
!=
null
&&
card
.
IsFaceup
()
&&
filter
.
Invoke
(
card
));
}
return
null
;
public
static
ClientCard
GetShouldBeDisabledBeforeItUseEffectMonster
(
this
IEnumerable
<
ClientCard
>
cards
,
bool
canBeTarget
=
true
)
{
return
cards
.
FirstOrDefault
(
card
=>
card
?.
Data
!=
null
&&
card
.
IsMonsterShouldBeDisabledBeforeItUseEffect
()
&&
card
.
IsFaceup
()
&&
(!
canBeTarget
||
!
card
.
IsShouldNotBeTarget
()));
}
public
static
IEnumerable
<
IEnumerable
<
T
>>
GetCombinations
<
T
>(
this
IEnumerable
<
T
>
elements
,
int
k
)
...
...
Game/AI/CardSelector.cs
View file @
43086945
...
...
@@ -68,13 +68,13 @@ namespace WindBot.Game.AI
break
;
case
SelectType
.
Id
:
foreach
(
ClientCard
card
in
cards
)
if
(
card
.
I
d
==
_id
)
if
(
card
.
I
sCode
(
_id
)
)
result
.
Add
(
card
);
break
;
case
SelectType
.
Ids
:
foreach
(
int
id
in
_ids
)
foreach
(
ClientCard
card
in
cards
)
if
(
card
.
I
d
==
id
&&
!
result
.
Contains
(
card
))
if
(
card
.
I
sCode
(
id
)
&&
!
result
.
Contains
(
card
))
result
.
Add
(
card
);
break
;
case
SelectType
.
Location
:
...
...
Game/AI/Decks/AltergeistExecutor.cs
View file @
43086945
...
...
@@ -215,6 +215,12 @@ namespace WindBot.Game.AI.Decks
||
id
==
CardId
.
Manifestation
||
id
==
CardId
.
Silquitous
);
}
public
bool
isAltergeist
(
ClientCard
card
)
{
return
card
.
IsCode
(
CardId
.
Marionetter
,
CardId
.
Hexstia
,
CardId
.
Protocol
,
CardId
.
Multifaker
,
CardId
.
Meluseek
,
CardId
.
Kunquery
,
CardId
.
Manifestation
,
CardId
.
Silquitous
);
}
public
int
GetSequence
(
ClientCard
card
)
{
if
(
Card
.
Location
!=
CardLocation
.
MonsterZone
)
return
-
1
;
...
...
@@ -239,10 +245,10 @@ namespace WindBot.Game.AI.Decks
ClientCard
self_card
=
Duel
.
CurrentChain
[
Duel
.
CurrentChain
.
Count
-
2
];
if
(
self_card
?.
Controller
!=
0
||
!(
self_card
.
Location
==
CardLocation
.
MonsterZone
||
self_card
.
Location
==
CardLocation
.
SpellZone
)
||
!
isAltergeist
(
self_card
.
Id
))
return
true
;
||
!
isAltergeist
(
self_card
))
return
true
;
ClientCard
enemy_card
=
Duel
.
CurrentChain
[
Duel
.
CurrentChain
.
Count
-
1
];
if
(
enemy_card
?.
Controller
!=
1
||
!
normal_counter
.
Contains
(
enemy_card
.
Id
))
return
true
;
||
!
enemy_card
.
IsCode
(
normal_counter
))
return
true
;
return
false
;
}
...
...
@@ -253,10 +259,10 @@ namespace WindBot.Game.AI.Decks
ClientCard
self_card
=
Duel
.
CurrentChain
[
Duel
.
CurrentChain
.
Count
-
2
];
if
(
self_card
?.
Controller
!=
0
||
!(
self_card
.
Location
==
CardLocation
.
MonsterZone
||
self_card
.
Location
==
CardLocation
.
SpellZone
)
||
!
isAltergeist
(
self_card
.
Id
))
return
false
;
||
!
isAltergeist
(
self_card
))
return
false
;
ClientCard
enemy_card
=
Duel
.
CurrentChain
[
Duel
.
CurrentChain
.
Count
-
1
];
if
(
enemy_card
?.
Controller
!=
1
||
!
normal_counter
.
Contains
(
enemy_card
.
Id
))
return
false
;
||
!
enemy_card
.
IsCode
(
normal_counter
))
return
false
;
return
true
;
}
...
...
@@ -264,7 +270,7 @@ namespace WindBot.Game.AI.Decks
{
ClientCard
last_card
=
AI
.
Utils
.
GetLastChainCard
();
if
(
last_card
!=
null
&&
last_card
.
Controller
==
1
&&
should_not_negate
.
Contains
(
last_card
.
Id
))
&&
last_card
.
Controller
==
1
&&
last_card
.
IsCode
(
should_not_negate
))
return
true
;
return
false
;
}
...
...
@@ -297,7 +303,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
card
in
Bot
.
GetSpells
())
{
if
(
card
.
I
d
==
CardId
.
Protocol
&&
card
.
IsFaceup
()
&&
!
card
.
IsDisabled
()
&&
!
Duel
.
CurrentChain
.
Contains
(
card
))
return
true
;
if
(
card
.
I
sCode
(
CardId
.
Protocol
)
&&
card
.
IsFaceup
()
&&
!
card
.
IsDisabled
()
&&
!
Duel
.
CurrentChain
.
Contains
(
card
))
return
true
;
}
return
false
;
}
...
...
@@ -417,7 +423,7 @@ namespace WindBot.Game.AI.Decks
if
(
place
==
2
||
place
==
4
)
{
int
last_place
=
place
-
1
;
return
(
Bot
.
MonsterZone
[
last_place
]
!=
null
&&
Bot
.
MonsterZone
[
last_place
].
I
d
==
CardId
.
Hexstia
);
return
(
Bot
.
MonsterZone
[
last_place
]
!=
null
&&
Bot
.
MonsterZone
[
last_place
].
I
sCode
(
CardId
.
Hexstia
)
);
}
if
(
place
==
1
||
place
==
3
)
{
...
...
@@ -431,8 +437,8 @@ namespace WindBot.Game.AI.Decks
last_place_1
=
2
;
last_place_2
=
6
;
}
if
(
Bot
.
MonsterZone
[
last_place_1
]
!=
null
&&
Bot
.
MonsterZone
[
last_place_1
].
I
d
==
CardId
.
Hexstia
)
return
true
;
if
(
Bot
.
MonsterZone
[
last_place_2
]
!=
null
&&
Bot
.
MonsterZone
[
last_place_2
].
I
d
==
CardId
.
Hexstia
)
return
true
;
if
(
Bot
.
MonsterZone
[
last_place_1
]
!=
null
&&
Bot
.
MonsterZone
[
last_place_1
].
I
sCode
(
CardId
.
Hexstia
)
)
return
true
;
if
(
Bot
.
MonsterZone
[
last_place_2
]
!=
null
&&
Bot
.
MonsterZone
[
last_place_2
].
I
sCode
(
CardId
.
Hexstia
)
)
return
true
;
return
false
;
}
return
false
;
...
...
@@ -442,7 +448,8 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
card
in
Enemy
.
GetSpells
())
{
if
(
card
!=
null
&&
card
.
IsFloodgate
()
&&
card
.
IsFaceup
()
&&
(
card
.
Id
!=
CardId
.
Anti_Spell
&&
card
.
Id
!=
CardId
.
ImperialOrder
)
if
(
card
!=
null
&&
card
.
IsFloodgate
()
&&
card
.
IsFaceup
()
&&
!
card
.
IsCode
(
CardId
.
Anti_Spell
,
CardId
.
ImperialOrder
)
&&
(!
is_bounce
||
card
.
IsTrap
())
&&
(!
canBeTarget
||
!
card
.
IsShouldNotBeTarget
()))
return
card
;
...
...
@@ -475,7 +482,7 @@ namespace WindBot.Game.AI.Decks
{
if
(
target
.
HasType
(
CardType
.
Fusion
)
||
target
.
HasType
(
CardType
.
Ritual
)
||
target
.
HasType
(
CardType
.
Synchro
)
||
target
.
HasType
(
CardType
.
Xyz
)
||
(
target
.
HasType
(
CardType
.
Link
)
&&
target
.
LinkCount
>=
2
)
)
{
if
(
target
.
I
d
==
CardId
.
Kagari
||
target
.
Id
==
CardId
.
Shizuku
)
continue
;
if
(
target
.
I
sCode
(
CardId
.
Kagari
,
CardId
.
Shizuku
)
)
continue
;
if
(!
canBeTarget
||
!(
target
.
IsShouldNotBeTarget
()
||
target
.
IsShouldNotBeMonsterTarget
()))
return
target
;
}
}
...
...
@@ -520,7 +527,7 @@ namespace WindBot.Game.AI.Decks
if
(
Duel
.
Player
!=
0
)
return
false
;
foreach
(
ClientCard
card
in
Bot
.
GetMonsters
())
{
if
(
card
.
I
d
==
CardId
.
Meluseek
&&
!
card
.
IsDisabled
()
&&
!
card
.
Attacked
)
return
true
;
if
(
card
.
I
sCode
(
CardId
.
Meluseek
)
&&
!
card
.
IsDisabled
()
&&
!
card
.
Attacked
)
return
true
;
}
if
(
Bot
.
HasInMonstersZone
(
CardId
.
Meluseek
))
return
true
;
if
(
Bot
.
HasInMonstersZone
(
CardId
.
Marionetter
)
&&
!
Marionetter_reborn
&&
Bot
.
HasInGraveyard
(
CardId
.
Meluseek
))
return
true
;
...
...
@@ -534,17 +541,17 @@ namespace WindBot.Game.AI.Decks
public
bool
SpellSet
()
{
if
(
Duel
.
Phase
==
DuelPhase
.
Main1
&&
Bot
.
HasAttackingMonster
()
&&
Duel
.
Turn
>
1
)
return
false
;
if
(
Card
.
I
d
==
CardId
.
EvenlyMatched
&&
!
Bot
.
HasInHandOrInSpellZone
(
CardId
.
Spoofing
)
if
(
Card
.
I
sCode
(
CardId
.
EvenlyMatched
)
&&
!
Bot
.
HasInHandOrInSpellZone
(
CardId
.
Spoofing
)
&&
!
Bot
.
HasInHandOrInSpellZone
(
CardId
.
Protocol
)
&&
!
Bot
.
HasInHandOrInSpellZone
(
CardId
.
ImperialOrder
))
return
false
;
if
(
Card
.
I
d
==
CardId
.
EvenlyMatched
&&
Bot
.
HasInSpellZone
(
CardId
.
EvenlyMatched
))
return
false
;
if
(
Card
.
I
d
==
CardId
.
SolemnStrike
&&
Bot
.
LifePoints
<=
1500
)
return
false
;
if
(
Card
.
I
d
==
CardId
.
Spoofing
&&
Bot
.
HasInSpellZone
(
CardId
.
Spoofing
))
return
false
;
if
(
Card
.
I
d
==
CardId
.
Manifestation
&&
Bot
.
HasInHandOrInSpellZone
(
CardId
.
Spoofing
))
if
(
Card
.
I
sCode
(
CardId
.
EvenlyMatched
)
&&
Bot
.
HasInSpellZone
(
CardId
.
EvenlyMatched
))
return
false
;
if
(
Card
.
I
sCode
(
CardId
.
SolemnStrike
)
&&
Bot
.
LifePoints
<=
1500
)
return
false
;
if
(
Card
.
I
sCode
(
CardId
.
Spoofing
)
&&
Bot
.
HasInSpellZone
(
CardId
.
Spoofing
))
return
false
;
if
(
Card
.
I
sCode
(
CardId
.
Manifestation
)
&&
Bot
.
HasInHandOrInSpellZone
(
CardId
.
Spoofing
))
{
bool
can_activate
=
false
;
foreach
(
ClientCard
g
in
Bot
.
GetGraveyardMonsters
())
{
if
(
g
.
IsMonster
()
&&
isAltergeist
(
g
.
Id
))
if
(
g
.
IsMonster
()
&&
isAltergeist
(
g
))
{
can_activate
=
true
;
break
;
...
...
@@ -567,7 +574,7 @@ namespace WindBot.Game.AI.Decks
}
if
(
Bot
.
HasInHand
(
CardId
.
Impermanence
))
{
if
(
Card
.
I
d
==
CardId
.
Impermanence
)
if
(
Card
.
I
sCode
(
CardId
.
Impermanence
)
)
{
AI
.
SelectPlace
(
Impermanence_set
);
return
true
;
...
...
@@ -584,7 +591,7 @@ namespace WindBot.Game.AI.Decks
}
else
if
(
Enemy
.
HasInSpellZone
(
CardId
.
Anti_Spell
,
true
)
||
Bot
.
HasInSpellZone
(
CardId
.
Anti_Spell
,
true
))
{
if
(
Card
.
IsSpell
()
&&
(
Card
.
Id
!=
CardId
.
OneForOne
||
Bot
.
GetRemainingCount
(
CardId
.
Meluseek
,
3
)
>
0
))
if
(
Card
.
IsSpell
()
&&
(
!
Card
.
IsCode
(
CardId
.
OneForOne
)
||
Bot
.
GetRemainingCount
(
CardId
.
Meluseek
,
3
)
>
0
))
{
AI
.
SelectPlace
(
SelectSTPlace
());
return
true
;
...
...
@@ -598,7 +605,7 @@ namespace WindBot.Game.AI.Decks
if
(
Card
.
HasPosition
(
CardPosition
.
FaceDown
)
&&
Card
.
HasType
(
CardType
.
Field
)
&&
Card
.
Location
==
CardLocation
.
SpellZone
)
{
// field spells that forbid other fields' activate
return
(
Card
.
Id
!=
71650854
&&
Card
.
Id
!=
78082039
);
return
!
Card
.
IsCode
(
71650854
,
78082039
);
}
return
false
;
}
...
...
@@ -624,7 +631,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
card
in
Bot
.
GetSpells
())
{
if
(
card
.
I
d
==
CardId
.
Anti_Spell
&&
card
.
IsFaceup
()
&&
Duel
.
LastChainPlayer
==
0
)
return
false
;
if
(
card
.
I
sCode
(
CardId
.
Anti_Spell
)
&&
card
.
IsFaceup
()
&&
Duel
.
LastChainPlayer
==
0
)
return
false
;
}
return
true
;
}
...
...
@@ -632,12 +639,12 @@ namespace WindBot.Game.AI.Decks
public
bool
SecretVillage_activate
()
{
if
(!
spell_trap_activate
())
return
false
;
if
(
Bot
.
SpellZone
[
5
]
!=
null
&&
Bot
.
SpellZone
[
5
].
IsFaceup
()
&&
Bot
.
SpellZone
[
5
].
I
d
==
CardId
.
SecretVillage
&&
Bot
.
SpellZone
[
5
].
Disabled
==
0
)
return
false
;
if
(
Bot
.
SpellZone
[
5
]
!=
null
&&
Bot
.
SpellZone
[
5
].
IsFaceup
()
&&
Bot
.
SpellZone
[
5
].
I
sCode
(
CardId
.
SecretVillage
)
&&
Bot
.
SpellZone
[
5
].
Disabled
==
0
)
return
false
;
if
(
Multifaker_can_ss
()
&&
Bot
.
HasInHand
(
CardId
.
Multifaker
))
return
true
;
foreach
(
ClientCard
card
in
Bot
.
GetMonsters
())
{
if
(
card
!=
null
&&
card
.
IsFaceup
()
&&
(
card
.
Race
&
(
int
)
CardRace
.
SpellCaster
)
!=
0
&&
card
.
Id
!=
CardId
.
Meluseek
)
return
true
;
if
(
card
!=
null
&&
card
.
IsFaceup
()
&&
(
card
.
Race
&
(
int
)
CardRace
.
SpellCaster
)
!=
0
&&
!
card
.
IsCode
(
CardId
.
Meluseek
)
)
return
true
;
}
return
false
;
}
...
...
@@ -744,7 +751,7 @@ namespace WindBot.Game.AI.Decks
}
if
(
(
this_seq
*
that_seq
>=
0
&&
this_seq
+
that_seq
==
4
)
||
(
AI
.
Utils
.
IsChainTarget
(
Card
))
||
(
LastChainCard
!=
null
&&
LastChainCard
.
Controller
==
1
&&
LastChainCard
.
I
d
==
_CardId
.
HarpiesFeatherDuster
)
||
(
LastChainCard
!=
null
&&
LastChainCard
.
Controller
==
1
&&
LastChainCard
.
I
sCode
(
_CardId
.
HarpiesFeatherDuster
)
)
||
(
Duel
.
Player
==
1
&&
Duel
.
Phase
>
DuelPhase
.
Main2
&&
Bot
.
HasInHand
(
CardId
.
Multifaker
)
&&
Multifaker_candeckss
()
&&
!
Multifaker_ssfromhand
))
{
List
<
ClientCard
>
enemy_monsters
=
Enemy
.
GetMonsters
();
...
...
@@ -802,7 +809,7 @@ namespace WindBot.Game.AI.Decks
public
bool
Hand_act_eff
()
{
if
(
Card
.
I
d
==
CardId
.
GO_SR
&&
Card
.
Location
==
CardLocation
.
Hand
&&
Bot
.
HasInMonstersZone
(
CardId
.
GO_SR
))
return
false
;
if
(
Card
.
I
sCode
(
CardId
.
GO_SR
)
&&
Card
.
Location
==
CardLocation
.
Hand
&&
Bot
.
HasInMonstersZone
(
CardId
.
GO_SR
))
return
false
;
return
(
Duel
.
LastChainPlayer
==
1
);
}
...
...
@@ -813,7 +820,7 @@ namespace WindBot.Game.AI.Decks
bool
has_skystriker
=
false
;
foreach
(
ClientCard
card
in
Enemy
.
Graveyard
)
{
if
(
card
!=
null
&&
SkyStrike_list
.
Contains
(
card
.
Id
))
if
(
card
!=
null
&&
card
.
IsCode
(
SkyStrike_list
))
{
has_skystriker
=
true
;
break
;
...
...
@@ -823,7 +830,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
card
in
Enemy
.
GetSpells
())
{
if
(
card
!=
null
&&
SkyStrike_list
.
Contains
(
card
.
Id
))
if
(
card
!=
null
&&
card
.
IsCode
(
SkyStrike_list
))
{
has_skystriker
=
true
;
break
;
...
...
@@ -834,7 +841,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
card
in
Enemy
.
GetSpells
())
{
if
(
card
!=
null
&&
SkyStrike_list
.
Contains
(
card
.
Id
))
if
(
card
!=
null
&&
card
.
IsCode
(
SkyStrike_list
))
{
has_skystriker
=
true
;
break
;
...
...
@@ -890,11 +897,11 @@ namespace WindBot.Game.AI.Decks
foreach
(
ClientCard
card
in
Enemy
.
MonsterZone
)
{
if
(
card
==
null
)
continue
;
if
(
card
.
I
d
==
CardId
.
Kagari
||
card
.
Id
==
CardId
.
Shizuku
||
card
.
Id
==
CardId
.
Hayate
||
card
.
Id
==
CardId
.
Raye
||
card
.
Id
==
CardId
.
Drones_Token
)
has_skystriker_acer
=
true
;
if
(
card
.
I
sCode
(
CardId
.
Kagari
,
CardId
.
Shizuku
,
CardId
.
Hayate
,
CardId
.
Raye
,
CardId
.
Drones_Token
)
)
has_skystriker_acer
=
true
;
if
(
card
.
HasType
(
CardType
.
Pendulum
))
pendulum_count
++;
if
((
card
.
Race
&
(
int
)
CardRace
.
Warrior
)
!=
0
)
warrior_count
++;
if
(
card
.
IsTuner
()
&&
(
Enemy
.
GetMonsterCount
()
>=
2
))
has_tuner
=
true
;
if
(
isAltergeist
(
card
.
Id
))
altergeis_count
++;
if
(
isAltergeist
(
card
))
altergeis_count
++;
if
(!
card
.
HasType
(
CardType
.
Link
)
&&
!
card
.
HasType
(
CardType
.
Xyz
)
&&
card
.
Level
==
1
)
has_level_1
=
true
;
link_count
+=
(
card
.
HasType
(
CardType
.
Link
)
?
card
.
LinkCount
:
1
);
}
...
...
@@ -1031,7 +1038,7 @@ namespace WindBot.Game.AI.Decks
if
(
Duel
.
Phase
==
DuelPhase
.
End
||
activate_immediately
>=
2
||
(
AI
.
Utils
.
IsChainTarget
(
Card
)
||
(
AI
.
Utils
.
GetLastChainCard
()
!=
null
&&
AI
.
Utils
.
GetLastChainCard
().
Controller
==
1
&&
AI
.
Utils
.
GetLastChainCard
().
I
d
==
_CardId
.
HarpiesFeatherDuster
)))
||
(
AI
.
Utils
.
GetLastChainCard
()
!=
null
&&
AI
.
Utils
.
GetLastChainCard
().
Controller
==
1
&&
AI
.
Utils
.
GetLastChainCard
().
I
sCode
(
_CardId
.
HarpiesFeatherDuster
)
)))
{
if
(
select_list
.
Count
>
0
)
{
...
...
@@ -1119,7 +1126,7 @@ namespace WindBot.Game.AI.Decks
bool
can_choose_other
=
false
;
foreach
(
ClientCard
card
in
Bot
.
GetSpells
())
{
if
(
card
.
IsFaceup
()
&&
isAltergeist
(
card
.
Id
))
if
(
card
.
IsFaceup
()
&&
isAltergeist
(
card
))
{
can_choose_other
=
true
;
break
;
...
...
@@ -1128,7 +1135,7 @@ namespace WindBot.Game.AI.Decks
if
(!
can_choose_other
){
foreach
(
ClientCard
card
in
Bot
.
GetMonsters
())
{
if
(
card
.
IsFaceup
()
&&
card
!=
Card
&&
isAltergeist
(
card
.
Id
))
if
(
card
.
IsFaceup
()
&&
card
!=
Card
&&
isAltergeist
(
card
))
{
can_choose_other
=
true
;
}
...
...
@@ -1175,15 +1182,15 @@ namespace WindBot.Game.AI.Decks
int
alter_count
=
0
;
foreach
(
ClientCard
card
in
Bot
.
Hand
)
{
if
(
isAltergeist
(
card
.
Id
)
&&
(
card
.
IsTrap
()
||
(!
summoned
&&
card
.
IsMonster
())))
alter_count
++;
if
(
isAltergeist
(
card
)
&&
(
card
.
IsTrap
()
||
(!
summoned
&&
card
.
IsMonster
())))
alter_count
++;
}
foreach
(
ClientCard
s
in
Bot
.
GetSpells
())
{
if
(
isAltergeist
(
s
.
Id
))
alter_count
++;
if
(
isAltergeist
(
s
))
alter_count
++;
}
foreach
(
ClientCard
m
in
Bot
.
GetMonsters
())
{
if
(
isAltergeist
(
m
.
Id
)
&&
m
!=
Card
)
alter_count
++;
if
(
isAltergeist
(
m
)
&&
m
!=
Card
)
alter_count
++;
}
if
(
alter_count
>
0
)
{
...
...
@@ -1196,11 +1203,11 @@ namespace WindBot.Game.AI.Decks
int
Protocol_count
=
0
;
foreach
(
ClientCard
h
in
Bot
.
Hand
)
{
if
(
h
.
I
d
==
CardId
.
Protocol
)
Protocol_count
++;
if
(
h
.
I
sCode
(
CardId
.
Protocol
)
)
Protocol_count
++;
}
foreach
(
ClientCard
s
in
Bot
.
GetSpells
())
{
if
(
s
.
I
d
==
CardId
.
Protocol
)
Protocol_count
+=
(
s
.
IsFaceup
()
?
11
:
1
);
if
(
s
.
I
sCode
(
CardId
.
Protocol
)
)
Protocol_count
+=
(
s
.
IsFaceup
()
?
11
:
1
);
}
if
(
Protocol_count
>=
12
)
{
...
...
@@ -1214,7 +1221,7 @@ namespace WindBot.Game.AI.Decks
list
.
Sort
(
AIFunctions
.
CompareCardAttack
);
foreach
(
ClientCard
card
in
list
)
{
if
(
isAltergeist
(
card
.
Id
)
&&
!(
choose_other
&&
card
==
Card
))
if
(
isAltergeist
(
card
)
&&
!(
choose_other
&&
card
==
Card
))
{
AI
.
SelectCard
(
card
);
AI
.
SelectNextCard
(
next_card
);
...
...
@@ -1245,7 +1252,7 @@ namespace WindBot.Game.AI.Decks
if
(
this_seq
!=
-
1
)
{
ClientCard
linked_card
=
Bot
.
MonsterZone
[
this_seq
];
if
(
linked_card
!=
null
&&
linked_card
.
I
d
==
CardId
.
Hexstia
)
if
(
linked_card
!=
null
&&
linked_card
.
I
sCode
(
CardId
.
Hexstia
)
)
{
int
next_seq
=
get_Hexstia_linkzone
(
this_seq
);
if
(
next_seq
!=
-
1
&&
Bot
.
MonsterZone
[
next_seq
]
!=
null
&&
isAltergeist
(
Bot
.
MonsterZone
[
next_seq
].
Id
))
return
false
;
...
...
@@ -1335,7 +1342,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
set_card
in
Bot
.
GetSpells
())
{
if
(
set_card
.
IsFacedown
()
&&
set_card
.
Id
!=
CardId
.
WakingtheDragon
)
if
(
set_card
.
IsFacedown
()
&&
!
set_card
.
IsCode
(
CardId
.
WakingtheDragon
)
)
{
AI
.
SelectCard
(
CardId
.
Multifaker
);
return
true
;
...
...
@@ -1445,7 +1452,7 @@ namespace WindBot.Game.AI.Decks
ClientCard
selected_target
=
null
;
foreach
(
ClientCard
spell
in
Bot
.
GetSpells
())
{
if
(
spell
.
I
d
==
CardId
.
Protocol
)
if
(
spell
.
I
sCode
(
CardId
.
Protocol
)
)
{
if
(
spell
.
IsFaceup
())
{
...
...
@@ -1456,8 +1463,8 @@ namespace WindBot.Game.AI.Decks
Protocol_count
++;
}
}
if
(
spell
.
I
d
==
CardId
.
Manifestation
&&
spell
.
IsFaceup
())
faceup_Manifestation
=
spell
;
if
(
Duel
.
LastChainPlayer
!=
0
&&
AI
.
Utils
.
IsChainTarget
(
spell
)
&&
spell
.
IsFaceup
()
&&
isAltergeist
(
spell
.
Id
))
if
(
spell
.
I
sCode
(
CardId
.
Manifestation
)
&&
spell
.
IsFaceup
())
faceup_Manifestation
=
spell
;
if
(
Duel
.
LastChainPlayer
!=
0
&&
AI
.
Utils
.
IsChainTarget
(
spell
)
&&
spell
.
IsFaceup
()
&&
isAltergeist
(
spell
))
{
selected_target
=
spell
;
}
...
...
@@ -1478,14 +1485,14 @@ namespace WindBot.Game.AI.Decks
monster_list
.
Sort
(
AIFunctions
.
CompareCardAttack
);
foreach
(
ClientCard
card
in
monster_list
)
{
if
(
card
.
IsFaceup
()
&&
isAltergeist
(
card
.
Id
)
&&
card
!=
Card
)
if
(
card
.
IsFaceup
()
&&
isAltergeist
(
card
)
&&
card
!=
Card
)
{
if
(
Duel
.
LastChainPlayer
!=
0
&&
AI
.
Utils
.
IsChainTarget
(
card
)
&&
card
.
IsFaceup
())
{
selected_target
=
card
;
}
if
(
faceup_Multifaker
==
null
&&
card
.
I
d
==
CardId
.
Multifaker
)
faceup_Multifaker
=
card
;
if
(
faceup_monster
==
null
&&
card
.
Id
!=
CardId
.
Hexstia
)
faceup_monster
=
card
;
if
(
faceup_Multifaker
==
null
&&
card
.
I
sCode
(
CardId
.
Multifaker
)
)
faceup_Multifaker
=
card
;
if
(
faceup_monster
==
null
&&
!
card
.
IsCode
(
CardId
.
Hexstia
)
)
faceup_monster
=
card
;
}
}
if
(
bounce_self
==
null
)
...
...
@@ -1574,7 +1581,7 @@ namespace WindBot.Game.AI.Decks
else
{
if
(
AI
.
Utils
.
ChainContainsCard
(
CardId
.
Manifestation
)
||
AI
.
Utils
.
ChainContainsCard
(
CardId
.
Spoofing
))
return
false
;
if
(
Duel
.
LastChainPlayer
==
0
&&
!(
AI
.
Utils
.
GetLastChainCard
()
!=
null
&&
AI
.
Utils
.
GetLastChainCard
().
I
d
==
CardId
.
Hexstia
))
return
false
;
if
(
Duel
.
LastChainPlayer
==
0
&&
!(
AI
.
Utils
.
GetLastChainCard
()
!=
null
&&
AI
.
Utils
.
GetLastChainCard
().
I
sCode
(
CardId
.
Hexstia
)
))
return
false
;
if
(
Bot
.
HasInMonstersZone
(
CardId
.
Hexstia
))
{
...
...
@@ -1582,7 +1589,7 @@ namespace WindBot.Game.AI.Decks
for
(
int
i
=
0
;
i
<
7
;
++
i
)
{
ClientCard
target
=
Bot
.
MonsterZone
[
i
];
if
(
target
!=
null
&&
target
.
I
d
==
CardId
.
Hexstia
)
if
(
target
!=
null
&&
target
.
I
sCode
(
CardId
.
Hexstia
)
)
{
int
next_id
=
get_Hexstia_linkzone
(
i
);
if
(
next_id
!=
-
1
)
...
...
@@ -1655,7 +1662,7 @@ namespace WindBot.Game.AI.Decks
if
(
Should_activate_Protocol
())
return
false
;
foreach
(
ClientCard
card
in
Bot
.
GetSpells
())
{
if
(
card
.
I
d
==
CardId
.
Protocol
&&
card
.
IsFaceup
()
&&
card
!=
Card
if
(
card
.
I
sCode
(
CardId
.
Protocol
)
&&
card
.
IsFaceup
()
&&
card
!=
Card
&&
(
Card
.
IsFacedown
()
||
!
Card
.
IsDisabled
()))
{
AI
.
SelectCard
(
card
);
...
...
@@ -1667,9 +1674,9 @@ namespace WindBot.Game.AI.Decks
for
(
int
i
=
0
;
i
<
7
;
++
i
)
{
ClientCard
target
=
Bot
.
MonsterZone
[
i
];
if
(
target
!=
null
&&
isAltergeist
(
target
.
Id
)
&&
target
.
IsFaceup
())
if
(
target
!=
null
&&
isAltergeist
(
target
)
&&
target
.
IsFaceup
())
{
if
(
target
.
I
d
==
CardId
.
Hexstia
)
if
(
target
.
I
sCode
(
CardId
.
Hexstia
)
)
{
int
next_index
=
get_Hexstia_linkzone
(
i
);
if
(
next_index
!=
-
1
&&
Bot
.
MonsterZone
[
next_index
]
!=
null
&&
Bot
.
MonsterZone
[
next_index
].
IsFaceup
()
&&
isAltergeist
(
Bot
.
MonsterZone
[
next_index
].
Id
))
continue
;
...
...
@@ -1694,13 +1701,13 @@ namespace WindBot.Game.AI.Decks
for
(
int
i
=
0
;
i
<
7
;
++
i
)
{
ClientCard
card
=
Bot
.
MonsterZone
[
i
];
if
(
card
!=
null
&&
card
.
I
d
==
CardId
.
Hexstia
)
if
(
card
!=
null
&&
card
.
I
sCode
(
CardId
.
Hexstia
)
)
{
int
nextzone
=
get_Hexstia_linkzone
(
i
);
if
(
nextzone
!=
-
1
)
{
ClientCard
linkedcard
=
Bot
.
MonsterZone
[
nextzone
];
if
(
linkedcard
==
null
||
!
isAltergeist
(
linkedcard
.
Id
))
if
(
linkedcard
==
null
||
!
isAltergeist
(
linkedcard
))
{
cost_list
.
Add
(
CardId
.
Hexstia
);
}
...
...
@@ -1732,7 +1739,7 @@ namespace WindBot.Game.AI.Decks
for
(
int
i
=
0
;
i
<
7
;
++
i
)
{
if
(
i
==
4
)
continue
;
if
(
Bot
.
MonsterZone
[
i
]
!=
null
&&
Bot
.
MonsterZone
[
i
].
I
d
==
CardId
.
Hexstia
)
if
(
Bot
.
MonsterZone
[
i
]
!=
null
&&
Bot
.
MonsterZone
[
i
].
I
sCode
(
CardId
.
Hexstia
)
)
{
int
next_id
=
get_Hexstia_linkzone
(
i
);
if
(
next_id
!=
-
1
)
...
...
@@ -1746,10 +1753,10 @@ namespace WindBot.Game.AI.Decks
bool
should_disnegate
=
false
;
foreach
(
ClientCard
card
in
Bot
.
GetMonsters
())
{
if
(
isAltergeist
(
card
.
Id
))
if
(
isAltergeist
(
card
))
{
if
(
card
.
I
d
==
CardId
.
Silquitous
&&
card
.
IsFaceup
()
&&
!
Silquitous_bounced
)
can_bounce
+=
10
;
else
if
(
card
.
IsFaceup
()
&&
card
.
Id
!=
CardId
.
Hexstia
)
can_bounce
++;
if
(
card
.
I
sCode
(
CardId
.
Silquitous
)
&&
card
.
IsFaceup
()
&&
!
Silquitous_bounced
)
can_bounce
+=
10
;
else
if
(
card
.
IsFaceup
()
&&
!
card
.
IsCode
(
CardId
.
Hexstia
)
)
can_bounce
++;
if
(
card
.
IsDisabled
()
&&
!
Protocol_activing
())
should_disnegate
=
true
;
}
}
...
...
@@ -1766,7 +1773,7 @@ namespace WindBot.Game.AI.Decks
if
(
card
!=
null
&&
card
.
Location
==
CardLocation
.
SpellZone
&&
card
.
Controller
==
0
&&
card
.
IsFaceup
())
{
if
(
card
.
I
d
==
CardId
.
Manifestation
)
if
(
card
.
I
sCode
(
CardId
.
Manifestation
)
)
{
AI
.
SelectCard
(
card
);
return
;
...
...
@@ -1777,7 +1784,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
int
id
in
list
)
{
if
(
card
?.
Id
==
id
&&
!(
id
==
CardId
.
Multifaker
&&
AI
.
Utils
.
GetLastChainCard
()
==
card
))
if
(
card
.
IsCode
(
id
)
&&
!(
id
==
CardId
.
Multifaker
&&
AI
.
Utils
.
GetLastChainCard
()
==
card
))
{
AI
.
SelectCard
(
card
);
return
;
...
...
@@ -1788,7 +1795,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
int
id
in
list
)
{
if
(
card
.
IsFaceup
()
&&
card
.
I
d
==
id
)
if
(
card
.
IsFaceup
()
&&
card
.
I
sCode
(
id
)
)
{
AI
.
SelectCard
(
card
);
return
;
...
...
@@ -1799,7 +1806,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
int
id
in
list
)
{
if
(
card
.
IsFaceup
()
&&
card
.
I
d
==
id
)
if
(
card
.
IsFaceup
()
&&
card
.
I
sCode
(
id
)
)
{
AI
.
SelectCard
(
card
);
return
;
...
...
@@ -1824,7 +1831,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
card
in
Bot
.
Hand
)
{
if
(
isAltergeist
(
card
.
Id
))
if
(
isAltergeist
(
card
))
{
has_cost
=
true
;
break
;
...
...
@@ -1834,7 +1841,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
card
in
Bot
.
GetSpells
())
{
if
(
isAltergeist
(
card
.
Id
)
&&
card
.
IsFaceup
())
if
(
isAltergeist
(
card
)
&&
card
.
IsFaceup
())
{
has_cost
=
true
;
break
;
...
...
@@ -1845,7 +1852,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
card
in
Bot
.
GetMonsters
())
{
if
(
isAltergeist
(
card
.
Id
)
&&
card
.
IsFaceup
())
if
(
isAltergeist
(
card
)
&&
card
.
IsFaceup
())
{
has_cost
=
true
;
break
;
...
...
@@ -1856,7 +1863,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
card
in
Bot
.
GetSpells
())
{
if
(
isAltergeist
(
card
.
Id
)
&&
card
.
IsFaceup
())
if
(
isAltergeist
(
card
)
&&
card
.
IsFaceup
())
{
has_cost
=
true
;
break
;
...
...
@@ -1873,7 +1880,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
card
in
Bot
.
Hand
)
{
if
(
card
.
I
d
==
CardId
.
Silquitous
)
if
(
card
.
I
sCode
(
CardId
.
Silquitous
)
)
{
AI
.
SelectCard
(
card
);
AI
.
SelectNextCard
(
new
[]
{
...
...
@@ -1916,8 +1923,7 @@ namespace WindBot.Game.AI.Decks
if
(!
Multifaker_ssfromhand
&&
Multifaker_candeckss
()
&&
can_ss_Multifaker
)
{
Spoofing_select
(
new
[]
{
Spoofing_select
(
new
[]{
CardId
.
Silquitous
,
CardId
.
Manifestation
,
CardId
.
Kunquery
,
...
...
@@ -1941,7 +1947,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
card
in
Bot
.
Hand
)
{
if
(
card
.
I
d
==
CardId
.
Silquitous
)
if
(
card
.
I
sCode
(
CardId
.
Silquitous
)
)
{
AI
.
SelectCard
(
card
);
AI
.
SelectNextCard
(
new
[]{
...
...
@@ -1979,7 +1985,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
card
in
Bot
.
Hand
)
{
if
(
card
.
I
d
==
CardId
.
Silquitous
)
if
(
card
.
I
sCode
(
CardId
.
Silquitous
)
)
{
AI
.
SelectCard
(
card
);
AI
.
SelectNextCard
(
new
[]{
...
...
@@ -2017,7 +2023,7 @@ namespace WindBot.Game.AI.Decks
foreach
(
ClientCard
card
in
Bot
.
GetSpells
())
{
if
(
(
AI
.
Utils
.
ChainContainsCard
(
_CardId
.
HarpiesFeatherDuster
)
||
AI
.
Utils
.
IsChainTarget
(
card
))
&&
card
.
IsFaceup
()
&&
Duel
.
LastChainPlayer
!=
0
&&
isAltergeist
(
card
.
Id
))
&&
card
.
IsFaceup
()
&&
Duel
.
LastChainPlayer
!=
0
&&
isAltergeist
(
card
))
{
AI
.
SelectCard
(
card
);
go
=
true
;
...
...
@@ -2029,7 +2035,7 @@ namespace WindBot.Game.AI.Decks
foreach
(
ClientCard
card
in
Bot
.
GetMonsters
())
{
if
(
(
AI
.
Utils
.
IsChainTarget
(
card
)
||
AI
.
Utils
.
ChainContainsCard
(
CardId
.
DarkHole
)
||
(!
Protocol_activing
()
&&
card
.
IsDisabled
()))
&&
card
.
IsFaceup
()
&&
Duel
.
LastChainPlayer
!=
0
&&
isAltergeist
(
card
.
Id
))
&&
card
.
IsFaceup
()
&&
Duel
.
LastChainPlayer
!=
0
&&
isAltergeist
(
card
))
{
Logger
.
DebugWriteLine
(
"Spoofing target:"
+
card
?.
Name
);
AI
.
SelectCard
(
card
);
...
...
@@ -2102,7 +2108,7 @@ namespace WindBot.Game.AI.Decks
if
(
Enemy
.
GetMonsterCount
()
==
0
&&
Enemy
.
LifePoints
<=
800
)
return
true
;
foreach
(
ClientCard
card
in
Bot
.
Hand
)
{
if
(
isAltergeist
(
card
.
Id
)
&&
card
.
IsTrap
())
if
(
isAltergeist
(
card
)
&&
card
.
IsTrap
())
{
can_summon
=
true
;
break
;
...
...
@@ -2110,7 +2116,7 @@ namespace WindBot.Game.AI.Decks
}
foreach
(
ClientCard
card
in
Bot
.
GetMonstersInMainZone
())
{
if
(
isAltergeist
(
card
.
Id
))
if
(
isAltergeist
(
card
))
{
can_summon
=
true
;
break
;
...
...
@@ -2118,7 +2124,7 @@ namespace WindBot.Game.AI.Decks
}
foreach
(
ClientCard
card
in
Bot
.
GetSpells
())
{
if
(
isAltergeist
(
card
.
Id
))
if
(
isAltergeist
(
card
))
{
can_summon
=
true
;
break
;
...
...
@@ -2161,7 +2167,7 @@ namespace WindBot.Game.AI.Decks
if
(
Duel
.
Phase
!=
DuelPhase
.
Main2
)
return
false
;
ClientCard
card_ex_left
=
Enemy
.
MonsterZone
[
6
];
ClientCard
card_ex_right
=
Enemy
.
MonsterZone
[
5
];
if
(
card_ex_left
!=
null
&&
card_ex_left
.
HasLinkMarker
((
int
)
LinkMarker
.
Top
))
if
(
card_ex_left
!=
null
&&
card_ex_left
.
HasLinkMarker
((
int
)
Card
LinkMarker
.
Top
))
{
ClientCard
self_card_1
=
Bot
.
MonsterZone
[
1
];
if
(
self_card_1
==
null
)
...
...
@@ -2170,7 +2176,7 @@ namespace WindBot.Game.AI.Decks
AI
.
SelectPlace
(
Zones
.
z1
);
ss_other_monster
=
true
;
return
true
;
}
else
if
(
self_card_1
.
I
d
==
CardId
.
Meluseek
)
}
else
if
(
self_card_1
.
I
sCode
(
CardId
.
Meluseek
)
)
{
AI
.
SelectMaterials
(
self_card_1
);
AI
.
SelectPlace
(
Zones
.
z1
);
...
...
@@ -2178,7 +2184,7 @@ namespace WindBot.Game.AI.Decks
return
true
;
}
}
if
(
card_ex_right
!=
null
&&
card_ex_right
.
HasLinkMarker
((
int
)
LinkMarker
.
Top
))
if
(
card_ex_right
!=
null
&&
card_ex_right
.
HasLinkMarker
((
int
)
Card
LinkMarker
.
Top
))
{
ClientCard
self_card_2
=
Bot
.
MonsterZone
[
3
];
if
(
self_card_2
==
null
)
...
...
@@ -2188,7 +2194,7 @@ namespace WindBot.Game.AI.Decks
ss_other_monster
=
true
;
return
true
;
}
else
if
(
self_card_2
.
I
d
==
CardId
.
Meluseek
)
else
if
(
self_card_2
.
I
sCode
(
CardId
.
Meluseek
)
)
{
AI
.
SelectMaterials
(
self_card_2
);
AI
.
SelectPlace
(
Zones
.
z3
);
...
...
@@ -2271,7 +2277,7 @@ namespace WindBot.Game.AI.Decks
ClientCard
enemy_card
=
Enemy
.
BattlingMonster
;
if
(
enemy_card
==
null
)
return
false
;
ClientCard
self_card
=
Bot
.
BattlingMonster
;
if
(
self_card
==
null
)
return
(
enemy_card
.
Id
!=
CardId
.
Hayate
);
if
(
self_card
==
null
)
return
(
!
enemy_card
.
IsCode
(
CardId
.
Hayate
)
);
return
(
enemy_card
.
Attack
>
self_card
.
GetDefensePower
());
}
}
...
...
@@ -2321,8 +2327,8 @@ namespace WindBot.Game.AI.Decks
int
altergeist_count
=
0
;
foreach
(
ClientCard
card
in
list
)
{
if
(
isAltergeist
(
card
.
Id
))
altergeist_count
++;
if
(
card
.
I
d
==
CardId
.
Meluseek
&&
targets
.
Count
<
2
&&
card
.
IsFaceup
())
if
(
isAltergeist
(
card
))
altergeist_count
++;
if
(
card
.
I
sCode
(
CardId
.
Meluseek
)
&&
targets
.
Count
<
2
&&
card
.
IsFaceup
())
{
if
((!
Meluseek_searched
||
!
Meluseek_selected
)
&&
(!
summoned
||
Duel
.
Phase
==
DuelPhase
.
Main2
))
{
...
...
@@ -2330,7 +2336,7 @@ namespace WindBot.Game.AI.Decks
targets
.
Add
(
card
);
}
}
else
if
(
card
.
I
d
==
CardId
.
Silquitous
&&
targets
.
Count
<
2
&&
card
.
IsFaceup
()
&&
!
Bot
.
HasInGraveyard
(
CardId
.
Silquitous
))
else
if
(
card
.
I
sCode
(
CardId
.
Silquitous
)
&&
targets
.
Count
<
2
&&
card
.
IsFaceup
()
&&
!
Bot
.
HasInGraveyard
(
CardId
.
Silquitous
))
{
if
(!
Silquitous_recycled
||
!
Silquitous_selected
)
{
...
...
@@ -2338,7 +2344,7 @@ namespace WindBot.Game.AI.Decks
targets
.
Add
(
card
);
}
}
else
if
(
card
.
I
d
==
CardId
.
Hexstia
&&
targets
.
Count
<
2
&&
card
.
IsFaceup
())
else
if
(
card
.
I
sCode
(
CardId
.
Hexstia
)
&&
targets
.
Count
<
2
&&
card
.
IsFaceup
())
{
if
((!
Hexstia_searched
||
!
Hexstia_selected
)
&&
!
summoned
&&
!
Bot
.
HasInHand
(
CardId
.
Marionetter
)
&&
Bot
.
GetRemainingCount
(
CardId
.
Marionetter
,
3
)
>
0
)
{
...
...
@@ -2346,8 +2352,8 @@ namespace WindBot.Game.AI.Decks
targets
.
Add
(
card
);
}
}
else
if
(
isAltergeist
(
card
.
Id
)
&&
targets
.
Count
<
2
&&
card
.
IsFaceup
())
targets
.
Add
(
card
);
else
if
(
card
.
I
d
==
CardId
.
Silquitous
&&
targets
.
Count
<
2
&&
card
.
IsFaceup
())
else
if
(
isAltergeist
(
card
)
&&
targets
.
Count
<
2
&&
card
.
IsFaceup
())
targets
.
Add
(
card
);
else
if
(
card
.
I
sCode
(
CardId
.
Silquitous
)
&&
targets
.
Count
<
2
&&
card
.
IsFaceup
())
{
if
(!
Silquitous_recycled
||
!
Silquitous_selected
)
{
...
...
@@ -2405,7 +2411,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
card
in
Bot
.
GetMonsters
())
{
if
(
card
.
I
d
==
CardId
.
Needlefiber
)
if
(
card
.
I
sCode
(
CardId
.
Needlefiber
)
)
{
list
.
Add
(
card
);
link_count
+=
2
;
...
...
@@ -2592,13 +2598,13 @@ namespace WindBot.Game.AI.Decks
for
(
int
i
=
0
;
i
<
attackers
.
Count
;
++
i
)
{
ClientCard
attacker
=
attackers
[
i
];
if
(
attacker
.
I
d
==
CardId
.
Meluseek
&&
!
attacker
.
IsDisabled
())
if
(
attacker
.
I
sCode
(
CardId
.
Meluseek
)
&&
!
attacker
.
IsDisabled
())
{
if
(
Enemy
.
GetMonsterCount
()
>
0
)
return
attacker
;
// Meluseek attack first even in direct attack
else
Meluseek_list
.
Add
(
attacker
);
}
if
(
attacker
.
I
d
==
CardId
.
Borrelsword
&&
!
attacker
.
IsDisabled
())
return
attacker
;
if
(
attacker
.
I
sCode
(
CardId
.
Borrelsword
)
&&
!
attacker
.
IsDisabled
())
return
attacker
;
}
if
(
Meluseek_list
.
Count
>
0
)
{
...
...
@@ -2636,12 +2642,12 @@ namespace WindBot.Game.AI.Decks
{
if
(
Card
.
Attack
==
0
)
return
(
Card
.
IsAttack
());
if
(
Card
.
I
d
==
CardId
.
Meluseek
||
Bot
.
HasInMonstersZone
(
CardId
.
Meluseek
))
if
(
Card
.
I
sCode
(
CardId
.
Meluseek
)
||
Bot
.
HasInMonstersZone
(
CardId
.
Meluseek
))
{
return
Card
.
HasPosition
(
CardPosition
.
Defence
);
}
if
(
isAltergeist
(
Card
.
Id
)
&&
Bot
.
HasInHandOrInSpellZone
(
CardId
.
Protocol
)
&&
Card
.
IsFacedown
())
return
true
;
if
(
isAltergeist
(
Card
)
&&
Bot
.
HasInHandOrInSpellZone
(
CardId
.
Protocol
)
&&
Card
.
IsFacedown
())
return
true
;
bool
enemyBetter
=
AI
.
Utils
.
IsAllEnemyBetter
(
true
);
if
(
Card
.
IsAttack
()
&&
enemyBetter
)
...
...
@@ -2694,7 +2700,7 @@ namespace WindBot.Game.AI.Decks
ClientCard
defender
=
defenders
[
i
];
attacker
.
RealPower
=
attacker
.
Attack
;
defender
.
RealPower
=
defender
.
GetDefensePower
();
if
(!
OnPreBattleBetween
(
attacker
,
defender
)
&&
!(
attacker
.
I
d
==
CardId
.
Borrelsword
&&
!
attacker
.
IsDisabled
()))
if
(!
OnPreBattleBetween
(
attacker
,
defender
)
&&
!(
attacker
.
I
sCode
(
CardId
.
Borrelsword
)
&&
!
attacker
.
IsDisabled
()))
continue
;
if
(
attacker
.
RealPower
>
defender
.
RealPower
||
(
attacker
.
RealPower
>=
defender
.
RealPower
&&
attacker
.
IsLastAttacker
&&
defender
.
IsAttack
()))
return
AI
.
Attack
(
attacker
,
defender
);
...
...
@@ -2711,12 +2717,12 @@ namespace WindBot.Game.AI.Decks
int
HIINT_TOGRAVE
=
504
;
if
(
max
==
1
&&
cards
[
0
].
Location
==
CardLocation
.
Deck
&&
AI
.
Utils
.
GetLastChainCard
()
!=
null
&&
AI
.
Utils
.
GetLastChainCard
().
I
d
==
23002292
&&
Bot
.
GetRemainingCount
(
CardId
.
WakingtheDragon
,
1
)
>
0
)
&&
AI
.
Utils
.
GetLastChainCard
()
!=
null
&&
AI
.
Utils
.
GetLastChainCard
().
I
sCode
(
23002292
)
&&
Bot
.
GetRemainingCount
(
CardId
.
WakingtheDragon
,
1
)
>
0
)
{
IList
<
ClientCard
>
result
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
card
in
cards
)
{
if
(
card
.
I
d
==
CardId
.
WakingtheDragon
)
if
(
card
.
I
sCode
(
CardId
.
WakingtheDragon
)
)
{
result
.
Add
(
card
);
AI
.
SelectPlace
(
SelectSetPlace
());
...
...
@@ -2725,14 +2731,14 @@ namespace WindBot.Game.AI.Decks
}
if
(
result
.
Count
>
0
)
return
result
;
}
else
if
(
AI
.
Utils
.
GetLastChainCard
()
!=
null
&&
AI
.
Utils
.
GetLastChainCard
().
I
d
==
CardId
.
EvenlyMatched
&&
Duel
.
LastChainPlayer
!=
0
)
else
if
(
AI
.
Utils
.
GetLastChainCard
()
!=
null
&&
AI
.
Utils
.
GetLastChainCard
().
I
sCode
(
CardId
.
EvenlyMatched
)
&&
Duel
.
LastChainPlayer
!=
0
)
{
Logger
.
DebugWriteLine
(
"EvenlyMatched: min="
+
min
.
ToString
()
+
", max="
+
max
.
ToString
());
}
else
if
(
cards
[
0
].
Location
==
CardLocation
.
Hand
&&
cards
[
cards
.
Count
-
1
].
Location
==
CardLocation
.
Hand
&&
(
hint
==
501
||
hint
==
HIINT_TOGRAVE
)
&&
min
==
max
)
{
if
(
Duel
.
LastChainPlayer
==
0
&&
AI
.
Utils
.
GetLastChainCard
().
I
d
==
CardId
.
OneForOne
)
return
null
;
if
(
Duel
.
LastChainPlayer
==
0
&&
AI
.
Utils
.
GetLastChainCard
().
I
sCode
(
CardId
.
OneForOne
)
)
return
null
;
Logger
.
DebugWriteLine
(
"Hand drop except OneForOne"
);
int
todrop
=
min
;
IList
<
ClientCard
>
result
=
new
List
<
ClientCard
>();
...
...
@@ -2755,7 +2761,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
card
in
ToRemove
)
{
if
(
card
.
I
d
==
throw_id
)
if
(
card
.
I
sCode
(
throw_id
)
)
{
result
.
Add
(
card
);
if
(--
todrop
<=
0
)
return
result
;
...
...
@@ -2807,7 +2813,7 @@ namespace WindBot.Game.AI.Decks
for
(
int
i
=
0
;
i
<
7
;
++
i
)
{
if
(
i
==
4
)
continue
;
if
(
Bot
.
MonsterZone
[
i
]
!=
null
&&
Bot
.
MonsterZone
[
i
].
I
d
==
CardId
.
Hexstia
)
if
(
Bot
.
MonsterZone
[
i
]
!=
null
&&
Bot
.
MonsterZone
[
i
].
I
sCode
(
CardId
.
Hexstia
)
)
{
int
next_index
=
get_Hexstia_linkzone
(
i
);
if
(
next_index
!=
-
1
&&
(
available
&
(
int
)(
System
.
Math
.
Pow
(
2
,
next_index
)))
>
0
)
...
...
Game/AI/Decks/BlackwingExecutor.cs
View file @
43086945
...
...
@@ -111,7 +111,7 @@ namespace WindBot.Game.AI.Decks
{
List
<
ClientCard
>
monster
=
Bot
.
GetMonsters
();
foreach
(
ClientCard
card
in
monster
)
if
(
card
!=
null
&&
card
.
I
d
==
CardId
.
KrisTheCrackOfDawn
||
card
.
Id
==
CardId
.
KalutTheMoonShadow
||
card
.
Id
==
CardId
.
GaleTheWhirlwind
||
card
.
Id
==
CardId
.
BoraTheSpear
||
card
.
Id
==
CardId
.
SiroccoTheDawn
||
card
.
Id
==
CardId
.
ShuraTheBlueFlame
||
card
.
Id
==
CardId
.
BlizzardTheFarNorth
)
if
(
card
!=
null
&&
card
.
I
sCode
(
CardId
.
KrisTheCrackOfDawn
,
CardId
.
KalutTheMoonShadow
,
CardId
.
GaleTheWhirlwind
,
CardId
.
BoraTheSpear
,
CardId
.
SiroccoTheDawn
,
CardId
.
ShuraTheBlueFlame
,
CardId
.
BlizzardTheFarNorth
)
)
return
true
;
return
false
;
}
...
...
@@ -119,7 +119,7 @@ namespace WindBot.Game.AI.Decks
private
bool
KalutTheMoonShadowSummon
()
{
foreach
(
ClientCard
card
in
Bot
.
Hand
)
if
(
card
!=
null
&&
card
.
I
d
==
CardId
.
KrisTheCrackOfDawn
||
card
.
Id
==
CardId
.
GaleTheWhirlwind
||
card
.
Id
==
CardId
.
BoraTheSpear
||
card
.
Id
==
CardId
.
SiroccoTheDawn
||
card
.
Id
==
CardId
.
ShuraTheBlueFlame
||
card
.
Id
==
CardId
.
BlizzardTheFarNorth
)
if
(
card
!=
null
&&
card
.
I
sCode
(
CardId
.
KrisTheCrackOfDawn
,
CardId
.
GaleTheWhirlwind
,
CardId
.
BoraTheSpear
,
CardId
.
SiroccoTheDawn
,
CardId
.
ShuraTheBlueFlame
,
CardId
.
BlizzardTheFarNorth
)
)
return
false
;
return
true
;
}
...
...
@@ -127,7 +127,7 @@ namespace WindBot.Game.AI.Decks
private
bool
BlizzardTheFarNorthSummon
()
{
foreach
(
ClientCard
card
in
Bot
.
Graveyard
)
if
(
card
!=
null
&&
card
.
I
d
==
CardId
.
KalutTheMoonShadow
||
card
.
Id
==
CardId
.
BoraTheSpear
||
card
.
Id
==
CardId
.
ShuraTheBlueFlame
||
card
.
Id
==
CardId
.
KrisTheCrackOfDawn
)
if
(
card
!=
null
&&
card
.
I
sCode
(
CardId
.
KalutTheMoonShadow
,
CardId
.
BoraTheSpear
,
CardId
.
ShuraTheBlueFlame
,
CardId
.
KrisTheCrackOfDawn
)
)
return
true
;
return
false
;
}
...
...
@@ -138,7 +138,7 @@ namespace WindBot.Game.AI.Decks
List
<
ClientCard
>
monster
=
Bot
.
GetMonsters
();
foreach
(
ClientCard
card
in
monster
)
if
(
card
!=
null
&&
card
.
I
d
==
CardId
.
KrisTheCrackOfDawn
||
card
.
Id
==
CardId
.
KalutTheMoonShadow
||
card
.
Id
==
CardId
.
GaleTheWhirlwind
||
card
.
Id
==
CardId
.
BoraTheSpear
||
card
.
Id
==
CardId
.
SiroccoTheDawn
||
card
.
Id
==
CardId
.
ShuraTheBlueFlame
||
card
.
Id
==
CardId
.
BlizzardTheFarNorth
)
if
(
card
!=
null
&&
card
.
I
sCode
(
CardId
.
KrisTheCrackOfDawn
,
CardId
.
KalutTheMoonShadow
,
CardId
.
GaleTheWhirlwind
,
CardId
.
BoraTheSpear
,
CardId
.
SiroccoTheDawn
,
CardId
.
ShuraTheBlueFlame
,
CardId
.
BlizzardTheFarNorth
)
)
Count
++;
if
(
Count
==
3
)
...
...
Game/AI/Decks/BlueEyesExecutor.cs
View file @
43086945
using
YGOSharp.OCGWrapper.Enums
;
using
System.Collections.Generic
;
using
System.Linq
;
using
WindBot
;
using
WindBot.Game
;
using
WindBot.Game.AI
;
...
...
@@ -138,27 +139,11 @@ namespace WindBot.Game.AI.Decks
if
(
max
==
2
&&
cards
[
0
].
Location
==
CardLocation
.
Deck
)
{
Logger
.
DebugWriteLine
(
"OnSelectCard MelodyOfAwakeningDragon"
);
I
List
<
ClientCard
>
result
=
new
List
<
ClientCard
>();
List
<
ClientCard
>
result
=
new
List
<
ClientCard
>();
if
(!
Bot
.
HasInHand
(
CardId
.
WhiteDragon
))
{
foreach
(
ClientCard
card
in
cards
)
{
if
(
card
.
Id
==
CardId
.
WhiteDragon
)
{
result
.
Add
(
card
);
break
;
}
}
}
foreach
(
ClientCard
card
in
cards
)
{
if
(
card
.
Id
==
CardId
.
AlternativeWhiteDragon
&&
result
.
Count
<
max
)
{
result
.
Add
(
card
);
}
}
AI
.
Utils
.
CheckSelectCount
(
result
,
cards
,
min
,
max
);
return
result
;
result
.
AddRange
(
cards
.
Where
(
card
=>
card
.
IsCode
(
CardId
.
WhiteDragon
)).
Take
(
1
));
result
.
AddRange
(
cards
.
Where
(
card
=>
card
.
IsCode
(
CardId
.
AlternativeWhiteDragon
)));
return
AI
.
Utils
.
CheckSelectCount
(
result
,
cards
,
min
,
max
);
}
Logger
.
DebugWriteLine
(
"Use default."
);
return
null
;
...
...
@@ -167,10 +152,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
>
result
=
new
List
<
ClientCard
>();
AI
.
Utils
.
SelectPreferredCards
(
result
,
UsedAlternativeWhiteDragon
,
cards
,
min
,
max
);
AI
.
Utils
.
CheckSelectCount
(
result
,
cards
,
min
,
max
);
return
result
;
IList
<
ClientCard
>
result
=
AI
.
Utils
.
SelectPreferredCards
(
UsedAlternativeWhiteDragon
,
cards
,
min
,
max
);
return
AI
.
Utils
.
CheckSelectCount
(
result
,
cards
,
min
,
max
);
}
public
override
IList
<
ClientCard
>
OnSelectSynchroMaterial
(
IList
<
ClientCard
>
cards
,
int
sum
,
int
min
,
int
max
)
...
...
@@ -900,23 +883,16 @@ namespace WindBot.Game.AI.Decks
return
true
;
if
(
Card
.
IsDefense
()
&&
!
enemyBetter
&&
Card
.
Attack
>=
Card
.
Defense
)
return
true
;
if
(
Card
.
IsDefense
()
&&
(
Card
.
Id
==
CardId
.
BlueEyesSpiritDragon
||
Card
.
Id
==
CardId
.
AzureEyesSilverDragon
))
if
(
Card
.
IsDefense
()
&&
Card
.
IsCode
(
CardId
.
BlueEyesSpiritDragon
,
CardId
.
AzureEyesSilverDragon
))
return
true
;
if
(
Card
.
IsAttack
()
&&
(
Card
.
Id
==
CardId
.
SageWithEyesOfBlue
||
Card
.
Id
==
CardId
.
WhiteStoneOfAncients
||
Card
.
Id
==
CardId
.
WhiteStoneOfLegend
))
if
(
Card
.
IsAttack
()
&&
Card
.
IsCode
(
CardId
.
SageWithEyesOfBlue
,
CardId
.
WhiteStoneOfAncients
,
CardId
.
WhiteStoneOfLegend
))
return
true
;
return
false
;
}
private
bool
SpellSet
()
{
return
(
Card
.
IsTrap
()
||
(
Card
.
Id
==
CardId
.
SilversCry
))
&&
Bot
.
GetSpellCountWithoutField
()
<
4
;
return
(
Card
.
IsTrap
()
||
Card
.
IsCode
(
CardId
.
SilversCry
))
&&
Bot
.
GetSpellCountWithoutField
()
<
4
;
}
private
bool
HasTwoInHand
(
int
id
)
...
...
@@ -924,7 +900,7 @@ namespace WindBot.Game.AI.Decks
int
num
=
0
;
foreach
(
ClientCard
card
in
Bot
.
Hand
)
{
if
(
card
!=
null
&&
card
.
I
d
==
id
)
if
(
card
!=
null
&&
card
.
I
sCode
(
id
)
)
num
++;
}
return
num
>=
2
;
...
...
Game/AI/Decks/BlueEyesMaxDragonExecutor.cs
View file @
43086945
...
...
@@ -104,17 +104,17 @@ namespace WindBot.Game.AI.Decks
MaxDragon_count
=
0
;
foreach
(
ClientCard
check
in
Bot
.
Hand
)
{
if
(
check
.
I
d
==
CardId
.
AdvancedRitualArt
)
if
(
check
.
I
sCode
(
CardId
.
AdvancedRitualArt
)
)
RitualArt_count
++;
if
(
check
.
I
d
==
CardId
.
ChaosForm
)
if
(
check
.
I
sCode
(
CardId
.
ChaosForm
)
)
ChaosForm_count
++;
if
(
check
.
I
d
==
CardId
.
DevirrtualCandoll
)
if
(
check
.
I
sCode
(
CardId
.
DevirrtualCandoll
)
)
Candoll_count
++;
if
(
check
.
I
d
==
CardId
.
DeviritualTalismandra
)
if
(
check
.
I
sCode
(
CardId
.
DeviritualTalismandra
)
)
Talismandra_count
++;
if
(
check
.
I
d
==
CardId
.
BlueEyesChaosMaxDragon
)
if
(
check
.
I
sCode
(
CardId
.
BlueEyesChaosMaxDragon
)
)
MaxDragon_count
++;
if
(
check
.
I
d
==
CardId
.
TheMelodyOfAwakeningDragon
)
if
(
check
.
I
sCode
(
CardId
.
TheMelodyOfAwakeningDragon
)
)
TheMelody_count
++;
}
}
...
...
@@ -129,28 +129,28 @@ namespace WindBot.Game.AI.Decks
if
(
Duel
.
LastChainPlayer
==
1
)
{
ClientCard
lastCard
=
AI
.
Utils
.
GetLastChainCard
();
if
(
lastCard
.
I
d
==
CardId
.
MaxxC
)
if
(
lastCard
.
I
sCode
(
CardId
.
MaxxC
)
)
{
AI
.
SelectCard
(
CardId
.
MaxxC
);
if
(
AI
.
Utils
.
ChainContainsCard
(
CardId
.
TheMelodyOfAwakeningDragon
))
AI
.
SelectNextCard
(
new
[]
{
CardId
.
BlueEyesChaosMaxDragon
,
CardId
.
BlueEyesChaosMaxDragon
,
CardId
.
BlueEyesAlternativeWhiteDragon
});
return
UniqueFaceupSpell
();
}
if
(
lastCard
.
I
d
==
CardId
.
LockBird
)
if
(
lastCard
.
I
sCode
(
CardId
.
LockBird
)
)
{
AI
.
SelectCard
(
CardId
.
LockBird
);
if
(
AI
.
Utils
.
ChainContainsCard
(
CardId
.
TheMelodyOfAwakeningDragon
))
AI
.
SelectNextCard
(
new
[]
{
CardId
.
BlueEyesChaosMaxDragon
,
CardId
.
BlueEyesChaosMaxDragon
,
CardId
.
BlueEyesAlternativeWhiteDragon
});
return
UniqueFaceupSpell
();
}
if
(
lastCard
.
I
d
==
CardId
.
Ghost
)
if
(
lastCard
.
I
sCode
(
CardId
.
Ghost
)
)
{
AI
.
SelectCard
(
CardId
.
Ghost
);
if
(
AI
.
Utils
.
ChainContainsCard
(
CardId
.
TheMelodyOfAwakeningDragon
))
AI
.
SelectNextCard
(
new
[]
{
CardId
.
BlueEyesChaosMaxDragon
,
CardId
.
BlueEyesChaosMaxDragon
,
CardId
.
BlueEyesAlternativeWhiteDragon
});
return
UniqueFaceupSpell
();
}
if
(
lastCard
.
I
d
==
CardId
.
AshBlossom
)
if
(
lastCard
.
I
sCode
(
CardId
.
AshBlossom
)
)
{
AI
.
SelectCard
(
CardId
.
AshBlossom
);
if
(
AI
.
Utils
.
ChainContainsCard
(
CardId
.
TheMelodyOfAwakeningDragon
))
...
...
@@ -216,13 +216,13 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
m
in
Bot
.
Hand
)
{
if
(
m
.
I
d
==
CardId
.
AdvancedRitualArt
)
if
(
m
.
I
sCode
(
CardId
.
AdvancedRitualArt
)
)
AI
.
SelectCard
(
m
);
}
}
foreach
(
ClientCard
m
in
Bot
.
Hand
)
{
if
(
m
.
Id
!=
CardId
.
AdvancedRitualArt
)
if
(
!
m
.
IsCode
(
CardId
.
AdvancedRitualArt
)
)
AI
.
SelectCard
(
m
);
}
AI
.
SelectNextCard
(
new
[]
{
CardId
.
BlueEyesChaosMaxDragon
,
CardId
.
BlueEyesChaosMaxDragon
,
CardId
.
BlueEyesAlternativeWhiteDragon
});
...
...
@@ -329,15 +329,13 @@ namespace WindBot.Game.AI.Decks
ClientCard
check
=
null
;
foreach
(
ClientCard
m
in
Bot
.
GetGraveyardMonsters
())
{
if
(
m
.
Id
==
CardId
.
BlueEyesAlternativeWhiteDragon
||
m
.
Id
==
CardId
.
BlueEyesChaosMaxDragon
||
m
.
Id
==
CardId
.
BlueEyesWhiteDragon
)
if
(
m
.
IsCode
(
CardId
.
BlueEyesAlternativeWhiteDragon
,
CardId
.
BlueEyesChaosMaxDragon
,
CardId
.
BlueEyesWhiteDragon
))
check
=
m
;
}
foreach
(
ClientCard
m
in
Bot
.
Hand
)
{
if
(
m
.
I
d
==
CardId
.
BlueEyesWhiteDragon
)
if
(
m
.
I
sCode
(
CardId
.
BlueEyesWhiteDragon
)
)
check
=
m
;
}
if
(
check
!=
null
)
...
...
@@ -351,7 +349,7 @@ namespace WindBot.Game.AI.Decks
private
bool
DeviritualCheck
()
{
Count_check
();
if
(
Card
.
I
d
==
CardId
.
DeviritualTalismandra
||
Card
.
Id
==
CardId
.
DevirrtualCandoll
)
if
(
Card
.
I
sCode
(
CardId
.
DeviritualTalismandra
,
CardId
.
DevirrtualCandoll
)
)
{
if
(
Card
.
Location
==
CardLocation
.
MonsterZone
)
{
...
...
@@ -367,12 +365,12 @@ namespace WindBot.Game.AI.Decks
}
if
(
Card
.
Location
==
CardLocation
.
Hand
)
{
if
(
Card
.
I
d
==
CardId
.
DevirrtualCandoll
)
if
(
Card
.
I
sCode
(
CardId
.
DevirrtualCandoll
)
)
{
if
(
MaxDragon_count
>=
2
&&
Talismandra_count
>=
1
||
Candoll_used
)
return
false
;
}
if
(
Card
.
I
d
==
CardId
.
DeviritualTalismandra
)
if
(
Card
.
I
sCode
(
CardId
.
DeviritualTalismandra
)
)
{
if
(
RitualArt_count
+
ChaosForm_count
>=
2
&&
Candoll_count
>=
1
||
Talismandra_used
)
return
false
;
...
...
@@ -402,9 +400,7 @@ namespace WindBot.Game.AI.Decks
ClientCard
check
=
null
;
foreach
(
ClientCard
m
in
Bot
.
Graveyard
)
{
if
(
m
.
Id
==
CardId
.
BlueEyesAlternativeWhiteDragon
||
m
.
Id
==
CardId
.
BlueEyesChaosMaxDragon
||
m
.
Id
==
CardId
.
BlueEyesWhiteDragon
)
if
(
m
.
IsCode
(
CardId
.
BlueEyesAlternativeWhiteDragon
,
CardId
.
BlueEyesChaosMaxDragon
,
CardId
.
BlueEyesWhiteDragon
))
check
=
m
;
}
...
...
@@ -417,7 +413,7 @@ namespace WindBot.Game.AI.Decks
}
foreach
(
ClientCard
m
in
Bot
.
Hand
)
{
if
(
m
.
I
d
==
CardId
.
BlueEyesWhiteDragon
)
if
(
m
.
I
sCode
(
CardId
.
BlueEyesWhiteDragon
)
)
check
=
m
;
}
if
(
check
!=
null
)
...
...
@@ -461,7 +457,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
c
in
Bot
.
GetMonsters
())
{
if
(
c
.
Id
!=
CardId
.
Linkuriboh
&&
c
.
Level
==
1
)
if
(
!
c
.
IsCode
(
CardId
.
Linkuriboh
)
&&
c
.
Level
==
1
)
{
AI
.
SelectMaterials
(
c
);
return
true
;
...
...
@@ -472,7 +468,7 @@ namespace WindBot.Game.AI.Decks
private
bool
Linkuriboheff
()
{
if
(
Duel
.
LastChainPlayer
==
0
&&
AI
.
Utils
.
GetLastChainCard
().
I
d
==
CardId
.
Linkuriboh
)
return
false
;
if
(
Duel
.
LastChainPlayer
==
0
&&
AI
.
Utils
.
GetLastChainCard
().
I
sCode
(
CardId
.
Linkuriboh
)
)
return
false
;
return
true
;
}
private
bool
BirrelswordDragonsp
()
...
...
@@ -481,7 +477,7 @@ namespace WindBot.Game.AI.Decks
IList
<
ClientCard
>
material_list
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
m
in
Bot
.
GetMonsters
())
{
if
(
m
.
I
d
==
CardId
.
MissusRadiant
)
if
(
m
.
I
sCode
(
CardId
.
MissusRadiant
)
)
{
material_list
.
Add
(
m
);
break
;
...
...
@@ -489,7 +485,7 @@ namespace WindBot.Game.AI.Decks
}
foreach
(
ClientCard
m
in
Bot
.
GetMonsters
())
{
if
(
m
.
I
d
==
CardId
.
Linkuriboh
||
m
.
Level
==
1
)
if
(
m
.
I
sCode
(
CardId
.
Linkuriboh
)
||
m
.
Level
==
1
)
{
material_list
.
Add
(
m
);
if
(
material_list
.
Count
==
3
)
...
...
@@ -541,11 +537,11 @@ namespace WindBot.Game.AI.Decks
}
private
bool
SpellSet
()
{
if
(
Card
.
I
d
==
CardId
.
InfiniteImpermanence
)
if
(
Card
.
I
sCode
(
CardId
.
InfiniteImpermanence
)
)
return
!
Bot
.
IsFieldEmpty
();
if
(
Card
.
I
d
==
CardId
.
RecklessGreed
)
if
(
Card
.
I
sCode
(
CardId
.
RecklessGreed
)
)
return
true
;
if
(
Card
.
I
d
==
CardId
.
Scapegoat
)
if
(
Card
.
I
sCode
(
CardId
.
Scapegoat
)
)
return
true
;
return
false
;
}
...
...
@@ -555,7 +551,7 @@ namespace WindBot.Game.AI.Decks
int
count
=
0
;
foreach
(
ClientCard
card
in
Bot
.
GetSpells
())
{
if
(
card
.
I
d
==
CardId
.
RecklessGreed
)
if
(
card
.
I
sCode
(
CardId
.
RecklessGreed
)
)
count
++;
}
if
(
DefaultOnBecomeTarget
())
return
true
;
...
...
@@ -589,7 +585,7 @@ namespace WindBot.Game.AI.Decks
for
(
int
i
=
0
;
i
<
attackers
.
Count
;
++
i
)
{
ClientCard
attacker
=
attackers
[
i
];
if
(
attacker
.
I
d
==
CardId
.
BlueEyesChaosMaxDragon
)
if
(
attacker
.
I
sCode
(
CardId
.
BlueEyesChaosMaxDragon
)
)
{
Logger
.
DebugWriteLine
(
attacker
.
Name
);
return
attacker
;
...
...
@@ -599,7 +595,7 @@ namespace WindBot.Game.AI.Decks
}
public
override
BattlePhaseAction
OnSelectAttackTarget
(
ClientCard
attacker
,
IList
<
ClientCard
>
defenders
)
{
if
(
attacker
.
I
d
==
CardId
.
BlueEyesChaosMaxDragon
&&
!
attacker
.
IsDisabled
()
&&
if
(
attacker
.
I
sCode
(
CardId
.
BlueEyesChaosMaxDragon
)
&&
!
attacker
.
IsDisabled
()
&&
Enemy
.
HasInMonstersZone
(
new
[]
{
CardId
.
DeviritualTalismandra
,
CardId
.
DevirrtualCandoll
}))
{
for
(
int
i
=
0
;
i
<
defenders
.
Count
;
i
++)
...
...
@@ -609,7 +605,7 @@ namespace WindBot.Game.AI.Decks
defender
.
RealPower
=
defender
.
GetDefensePower
();
if
(!
OnPreBattleBetween
(
attacker
,
defender
))
continue
;
if
(
defender
.
I
d
==
CardId
.
DevirrtualCandoll
||
defender
.
Id
==
CardId
.
DeviritualTalismandra
)
if
(
defender
.
I
sCode
(
CardId
.
DevirrtualCandoll
,
CardId
.
DeviritualTalismandra
)
)
{
return
AI
.
Attack
(
attacker
,
defender
);
}
...
...
Game/AI/Decks/BurnExecutor.cs
View file @
43086945
...
...
@@ -108,7 +108,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
card
in
Bot
.
GetMonsters
())
{
if
(
card
.
I
d
==
CardId
.
Marshmallon
||
card
.
Id
==
CardId
.
SpiritReaper
)
if
(
card
.
I
sCode
(
CardId
.
Marshmallon
,
CardId
.
SpiritReaper
)
)
{
return
false
;
}
...
...
@@ -134,9 +134,9 @@ namespace WindBot.Game.AI.Decks
private
bool
ReposEverything
()
{
if
(
Card
.
I
d
==
CardId
.
ReflectBounder
)
if
(
Card
.
I
sCode
(
CardId
.
ReflectBounder
)
)
return
Card
.
IsDefense
();
if
(
Card
.
I
d
==
CardId
.
FencingFireFerret
)
if
(
Card
.
I
sCode
(
CardId
.
FencingFireFerret
)
)
return
DefaultMonsterRepos
();
if
(
Card
.
IsAttack
())
return
true
;
...
...
Game/AI/Decks/ChainBurnExecutor.cs
View file @
43086945
...
...
@@ -227,7 +227,7 @@ namespace WindBot.Game.AI.Decks
{
return
(
id
==
CardId
.
SandaionTheTimelord
||
id
==
CardId
.
BattleFader
||
id
==
CardId
.
MichionTimelord
id
==
CardId
.
MichionTimelord
);
}
bool
no_sp
=
false
;
...
...
@@ -322,49 +322,49 @@ namespace WindBot.Game.AI.Decks
IList
<
ClientCard
>
check
=
Bot
.
GetSpells
();
foreach
(
ClientCard
card
in
check
)
{
if
(
card
.
I
d
==
CardId
.
AccuulatedFortune
)
if
(
card
.
I
sCode
(
CardId
.
AccuulatedFortune
)
)
HasAccuulatedFortune
++;
}
foreach
(
ClientCard
card
in
check
)
{
if
(
card
.
I
d
==
CardId
.
SecretBlast
)
if
(
card
.
I
sCode
(
CardId
.
SecretBlast
)
)
blast_count
++;
}
foreach
(
ClientCard
card
in
check
)
{
if
(
card
.
I
d
==
CardId
.
SectetBarrel
)
if
(
card
.
I
sCode
(
CardId
.
SectetBarrel
)
)
barrel_count
++;
}
foreach
(
ClientCard
card
in
check
)
{
if
(
card
.
I
d
==
CardId
.
JustDesserts
)
if
(
card
.
I
sCode
(
CardId
.
JustDesserts
)
)
just_count
++;
}
foreach
(
ClientCard
card
in
check
)
{
if
(
card
.
I
d
==
CardId
.
ChainStrike
)
if
(
card
.
I
sCode
(
CardId
.
ChainStrike
)
)
strike_count
++;
}
foreach
(
ClientCard
card
in
Bot
.
GetSpells
())
{
if
(
card
.
I
d
==
CardId
.
RecklessGreed
)
if
(
card
.
I
sCode
(
CardId
.
RecklessGreed
)
)
greed_count
++;
}
foreach
(
ClientCard
card
in
check
)
{
if
(
card
.
I
d
==
CardId
.
Waboku
)
if
(
card
.
I
sCode
(
CardId
.
Waboku
)
)
Waboku_count
++;
}
foreach
(
ClientCard
card
in
check
)
{
if
(
card
.
I
d
==
CardId
.
ThreateningRoar
)
if
(
card
.
I
sCode
(
CardId
.
ThreateningRoar
)
)
Roar_count
++;
}
...
...
@@ -418,7 +418,7 @@ namespace WindBot.Game.AI.Decks
if
(
AI
.
Utils
.
IsChainTarget
(
Card
))
return
true
;
foreach
(
ClientCard
card
in
Enemy
.
GetSpells
())
{
if
(
card
.
I
d
==
CardId
.
HarpiesFeatherDuster
&&
card
.
IsFaceup
())
if
(
card
.
I
sCode
(
CardId
.
HarpiesFeatherDuster
)
&&
card
.
IsFaceup
())
{
return
true
;
}
...
...
@@ -432,7 +432,7 @@ namespace WindBot.Game.AI.Decks
}
private
bool
BrunSpellSet
()
{
if
(
Card
.
I
d
==
CardId
.
OjamaTrio
&&
Bot
.
HasInSpellZone
(
CardId
.
OjamaTrio
))
return
false
;
if
(
Card
.
I
sCode
(
CardId
.
OjamaTrio
)
&&
Bot
.
HasInSpellZone
(
CardId
.
OjamaTrio
))
return
false
;
return
(
Card
.
IsTrap
()
||
Card
.
HasType
(
CardType
.
QuickPlay
))
&&
Bot
.
GetSpellCountWithoutField
()
<
5
;
}
private
bool
MichionTimelordsummon
()
...
...
@@ -565,7 +565,7 @@ namespace WindBot.Game.AI.Decks
int
count
=
0
;
foreach
(
ClientCard
card
in
Bot
.
GetSpells
())
{
if
(
card
.
I
d
==
CardId
.
RecklessGreed
)
if
(
card
.
I
sCode
(
CardId
.
RecklessGreed
)
)
count
++;
}
...
...
@@ -668,7 +668,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
card
in
Bot
.
GetMonsters
())
{
if
(
card
.
I
d
==
CardId
.
CardcarD
&&
card
.
IsFaceup
())
if
(
card
.
I
sCode
(
CardId
.
CardcarD
)
&&
card
.
IsFaceup
())
return
false
;
}
if
(
Bot
.
GetHandCount
()
==
1
&&
Bot
.
GetSpellCountWithoutField
()
<=
3
)
...
...
@@ -694,7 +694,7 @@ namespace WindBot.Game.AI.Decks
foreach
(
ClientCard
card
in
Bot
.
GetMonsters
())
{
if
(
card
.
I
d
==
CardId
.
DiceJar
&&
card
.
IsFacedown
())
if
(
card
.
I
sCode
(
CardId
.
DiceJar
)
&&
card
.
IsFacedown
())
return
true
;
break
;
}
...
...
@@ -725,24 +725,24 @@ namespace WindBot.Game.AI.Decks
if
(
GetTotalATK
(
newlist
)
/
2
>=
Enemy
.
LifePoints
&&
Bot
.
HasInSpellZone
(
CardId
.
BlazingMirrorForce
))
return
false
;
if
(
AI
.
Utils
.
GetLastChainCard
()
==
null
)
return
true
;
if
(
AI
.
Utils
.
GetLastChainCard
().
I
d
==
CardId
.
Linkuriboh
)
return
false
;
if
(
AI
.
Utils
.
GetLastChainCard
().
I
sCode
(
CardId
.
Linkuriboh
)
)
return
false
;
return
true
;
}
public
bool
MonsterRepos
()
{
if
(
Card
.
IsFacedown
()
&&
Card
.
Id
!=
CardId
.
DiceJar
)
if
(
Card
.
IsFacedown
()
&&
!
Card
.
IsCode
(
CardId
.
DiceJar
)
)
return
true
;
return
base
.
DefaultMonsterRepos
();
}
public
override
bool
OnPreBattleBetween
(
ClientCard
attacker
,
ClientCard
defender
)
{
if
(
attacker
.
I
d
==
CardId
.
Linkuriboh
&&
defender
.
IsFacedown
())
return
false
;
if
(
attacker
.
I
d
==
CardId
.
SandaionTheTimelord
&&
!
attacker
.
IsDisabled
())
if
(
attacker
.
I
sCode
(
CardId
.
Linkuriboh
)
&&
defender
.
IsFacedown
())
return
false
;
if
(
attacker
.
I
sCode
(
CardId
.
SandaionTheTimelord
)
&&
!
attacker
.
IsDisabled
())
{
attacker
.
RealPower
=
9999
;
return
true
;
}
if
(
attacker
.
I
d
==
CardId
.
MichionTimelord
&&
!
attacker
.
IsDisabled
())
if
(
attacker
.
I
sCode
(
CardId
.
MichionTimelord
)
&&
!
attacker
.
IsDisabled
())
{
attacker
.
RealPower
=
9999
;
return
true
;
...
...
@@ -771,49 +771,49 @@ namespace WindBot.Game.AI.Decks
IList
<
ClientCard
>
check
=
Bot
.
GetSpells
();
foreach
(
ClientCard
card1
in
check
)
{
if
(
card1
.
I
d
==
CardId
.
AccuulatedFortune
)
if
(
card1
.
I
sCode
(
CardId
.
AccuulatedFortune
)
)
HasAccuulatedFortune
++;
}
foreach
(
ClientCard
card1
in
check
)
{
if
(
card1
.
I
d
==
CardId
.
SecretBlast
)
if
(
card1
.
I
sCode
(
CardId
.
SecretBlast
)
)
blast_count
++;
}
foreach
(
ClientCard
card1
in
check
)
{
if
(
card1
.
I
d
==
CardId
.
SectetBarrel
)
if
(
card1
.
I
sCode
(
CardId
.
SectetBarrel
)
)
barrel_count
++;
}
foreach
(
ClientCard
card1
in
check
)
{
if
(
card1
.
I
d
==
CardId
.
JustDesserts
)
if
(
card1
.
I
sCode
(
CardId
.
JustDesserts
)
)
just_count
++;
}
foreach
(
ClientCard
card1
in
check
)
{
if
(
card1
.
I
d
==
CardId
.
ChainStrike
)
if
(
card1
.
I
sCode
(
CardId
.
ChainStrike
)
)
strike_count
++;
}
foreach
(
ClientCard
card1
in
Bot
.
GetSpells
())
{
if
(
card1
.
I
d
==
CardId
.
RecklessGreed
)
if
(
card1
.
I
sCode
(
CardId
.
RecklessGreed
)
)
greed_count
++;
}
foreach
(
ClientCard
card1
in
check
)
{
if
(
card1
.
I
d
==
CardId
.
Waboku
)
if
(
card1
.
I
sCode
(
CardId
.
Waboku
)
)
Waboku_count
++;
}
foreach
(
ClientCard
card1
in
check
)
{
if
(
card1
.
I
d
==
CardId
.
ThreateningRoar
)
if
(
card1
.
I
sCode
(
CardId
.
ThreateningRoar
)
)
Roar_count
++;
}
...
...
Game/AI/Decks/DarkMagicianExecutor.cs
View file @
43086945
...
...
@@ -169,7 +169,7 @@ namespace WindBot.Game.AI.Decks
int BotZone = 0;
for (int i = 0; i <= 6; i++)
{
if (Enemy.MonsterZone[i] != null && Enemy.MonsterZone[i].I
d == CardId.MekkKnightMorningStar
)
if (Enemy.MonsterZone[i] != null && Enemy.MonsterZone[i].I
sCode(CardId.MekkKnightMorningStar)
)
{
MekkKnightZone = i;
break;
...
...
@@ -242,7 +242,7 @@ namespace WindBot.Game.AI.Decks
ApprenticeLllusionMagician_count
=
0
;
foreach
(
ClientCard
count
in
Bot
.
GetMonsters
())
{
if
(
count
.
I
d
==
CardId
.
ApprenticeLllusionMagician
&&
count
.
IsFaceup
())
if
(
count
.
I
sCode
(
CardId
.
ApprenticeLllusionMagician
)
&&
count
.
IsFaceup
())
ApprenticeLllusionMagician_count
++;
}
foreach
(
ClientCard
dangerous
in
Enemy
.
GetMonsters
())
...
...
@@ -352,7 +352,7 @@ namespace WindBot.Game.AI.Decks
int
ghost_count
=
0
;
foreach
(
ClientCard
check
in
Enemy
.
Graveyard
)
{
if
(
check
.
I
d
==
CardId
.
Ghost
)
if
(
check
.
I
sCode
(
CardId
.
Ghost
)
)
ghost_count
++;
}
if
(
ghost_count
!=
ghost_done
)
...
...
@@ -502,7 +502,7 @@ namespace WindBot.Game.AI.Decks
private
bool
ChainEnemy
()
{
if
(
AI
.
Utils
.
GetLastChainCard
()
!=
null
&&
AI
.
Utils
.
GetLastChainCard
().
I
d
==
CardId
.
UpstartGoblin
)
AI
.
Utils
.
GetLastChainCard
().
I
sCode
(
CardId
.
UpstartGoblin
)
)
return
false
;
return
Duel
.
LastChainPlayer
==
1
;
}
...
...
@@ -577,7 +577,7 @@ namespace WindBot.Game.AI.Decks
{
foreach (ClientCard c in Bot.GetMonsters())
{
if (
c.Id != CardId.WindwitchSnowBell && c.Level == 1 && c.Id != CardId.LinkSpider && c.Id != CardId.Linkuriboh
)
if (
!c.IsCode(CardId.WindwitchSnowBell) && c.Level == 1 && !c.IsCode(CardId.LinkSpider) && !c.IsCode(CardId.Linkuriboh)
)
{
AI.SelectCard(c);
return true;
...
...
@@ -589,7 +589,7 @@ namespace WindBot.Game.AI.Decks
private bool Linkuriboheff()
{
if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard().I
d == CardId.Linkuriboh
) return false;
if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard().I
sCode(CardId.Linkuriboh)
) return false;
if (Bot.HasInMonstersZone(CardId.WindwitchSnowBell)) return false;
return true;
}
...
...
@@ -636,7 +636,7 @@ namespace WindBot.Game.AI.Decks
IList
<
ClientCard
>
magician
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
check
in
grave
)
{
if
(
check
.
I
d
==
CardId
.
DarkMagician
)
if
(
check
.
I
sCode
(
CardId
.
DarkMagician
)
)
{
magician
.
Add
(
check
);
}
...
...
@@ -653,7 +653,7 @@ namespace WindBot.Game.AI.Decks
foreach
(
ClientCard
target
in
Duel
.
ChainTargets
)
{
if
((
target
.
I
d
==
CardId
.
DarkMagician
||
target
.
Id
==
CardId
.
DarkMagicianTheDragonKnight
)
if
((
target
.
I
sCode
(
CardId
.
DarkMagician
,
CardId
.
DarkMagicianTheDragonKnight
)
)
&&
Card
.
IsFacedown
())
{
AI
.
SelectYesNo
(
false
);
...
...
@@ -793,7 +793,7 @@ namespace WindBot.Game.AI.Decks
bool
soul_faceup
=
false
;
foreach
(
ClientCard
check
in
Bot
.
GetSpells
())
{
if
(
check
.
I
d
==
CardId
.
EternalSoul
&&
check
.
IsFaceup
())
if
(
check
.
I
sCode
(
CardId
.
EternalSoul
)
&&
check
.
IsFaceup
())
{
soul_faceup
=
true
;
}
...
...
@@ -940,7 +940,7 @@ namespace WindBot.Game.AI.Decks
//AI.SelectPlace(Zones.z2, 2);
foreach
(
ClientCard
m
in
Bot
.
GetSpells
())
{
if
(
m
.
I
d
==
CardId
.
EternalSoul
&&
m
.
IsFaceup
())
if
(
m
.
I
sCode
(
CardId
.
EternalSoul
)
&&
m
.
IsFaceup
())
soul_exist
=
true
;
}
if
(!
soul_used
&&
soul_exist
)
...
...
@@ -957,12 +957,12 @@ namespace WindBot.Game.AI.Decks
int
ghost_count
=
0
;
foreach
(
ClientCard
check
in
Enemy
.
Graveyard
)
{
if
(
check
.
I
d
==
CardId
.
Ghost
)
if
(
check
.
I
sCode
(
CardId
.
Ghost
)
)
ghost_count
++;
}
if
(
ghost_count
!=
ghost_done
)
{
if
(
Duel
.
CurrentChain
.
Count
>=
2
&&
AI
.
Utils
.
GetLastChainCard
().
I
d
==
0
)
if
(
Duel
.
CurrentChain
.
Count
>=
2
&&
AI
.
Utils
.
GetLastChainCard
().
I
sCode
(
0
)
)
{
AI
.
SelectCard
(
CardId
.
MagiciansRod
);
AI
.
SelectNextCard
(
new
[]
{
CardId
.
DarkMagician
,
CardId
.
DarkMagician
});
...
...
@@ -981,7 +981,7 @@ namespace WindBot.Game.AI.Decks
}
}
if
(
count
==
0
)
return
false
;
if
((
target
.
I
d
==
CardId
.
WindwitchGlassBell
||
target
.
Id
==
CardId
.
WindwitchIceBell
)
&&
if
((
target
.
I
sCode
(
CardId
.
WindwitchGlassBell
,
CardId
.
WindwitchIceBell
)
)
&&
Bot
.
HasInMonstersZone
(
CardId
.
WindwitchIceBell
)
&&
Bot
.
HasInMonstersZone
(
CardId
.
WindwitchGlassBell
))
return
false
;
...
...
@@ -1077,7 +1077,7 @@ namespace WindBot.Game.AI.Decks
int
count
=
0
;
foreach
(
ClientCard
check
in
Bot
.
GetMonsters
())
{
if
(
check
.
Id
!=
CardId
.
CrystalWingSynchroDragon
)
if
(
!
check
.
IsCode
(
CardId
.
CrystalWingSynchroDragon
)
)
count
++;
}
Logger
.
DebugWriteLine
(
"%%%%%%%%%%%%%%%%SpellCaster= "
+
count
);
...
...
@@ -1118,7 +1118,7 @@ namespace WindBot.Game.AI.Decks
int
count
=
0
;
foreach
(
ClientCard
check
in
Bot
.
GetMonsters
())
{
if
(
check
.
Id
!=
CardId
.
CrystalWingSynchroDragon
)
if
(
!
check
.
IsCode
(
CardId
.
CrystalWingSynchroDragon
)
)
count
++;
}
Logger
.
DebugWriteLine
(
"%%%%%%%%%%%%%%%%SpellCaster= "
+
count
);
...
...
@@ -1208,7 +1208,7 @@ namespace WindBot.Game.AI.Decks
int
count
=
0
;
foreach
(
ClientCard
check
in
Bot
.
Hand
)
{
if
(
check
.
I
d
==
CardId
.
WonderWand
)
if
(
check
.
I
sCode
(
CardId
.
WonderWand
)
)
count
++;
}
if
(
count
>=
2
)
...
...
@@ -1241,7 +1241,7 @@ namespace WindBot.Game.AI.Decks
int
Navigation_count
=
0
;
foreach
(
ClientCard
Navigation
in
Bot
.
Hand
)
{
if
(
Navigation
.
I
d
==
CardId
.
MagicianNavigation
)
if
(
Navigation
.
I
sCode
(
CardId
.
MagicianNavigation
)
)
Navigation_count
++;
}
if
(
Navigation_count
>=
2
)
...
...
@@ -1619,7 +1619,7 @@ namespace WindBot.Game.AI.Decks
int
rod_count
=
0
;
foreach
(
ClientCard
rod
in
Bot
.
GetMonsters
())
{
if
(
rod
.
I
d
==
CardId
.
MagiciansRod
)
if
(
rod
.
I
sCode
(
CardId
.
MagiciansRod
)
)
rod_count
++;
}
if
(
rod_count
>=
2
)
...
...
@@ -1716,7 +1716,7 @@ namespace WindBot.Game.AI.Decks
int
maxxc_count
=
0
;
foreach
(
ClientCard
check
in
Enemy
.
Graveyard
)
{
if
(
check
.
I
d
==
CardId
.
MaxxC
)
if
(
check
.
I
sCode
(
CardId
.
MaxxC
)
)
maxxc_count
++;
}
if
(
maxxc_count
!=
maxxc_done
)
...
...
@@ -1727,7 +1727,7 @@ namespace WindBot.Game.AI.Decks
int
lockbird_count
=
0
;
foreach
(
ClientCard
check
in
Enemy
.
Graveyard
)
{
if
(
check
.
I
d
==
CardId
.
LockBird
)
if
(
check
.
I
sCode
(
CardId
.
LockBird
)
)
lockbird_count
++;
}
if
(
lockbird_count
!=
lockbird_done
)
...
...
@@ -1738,7 +1738,7 @@ namespace WindBot.Game.AI.Decks
int
ghost_count
=
0
;
foreach
(
ClientCard
check
in
Enemy
.
Graveyard
)
{
if
(
check
.
I
d
==
CardId
.
Ghost
)
if
(
check
.
I
sCode
(
CardId
.
Ghost
)
)
ghost_count
++;
}
if
(
ghost_count
!=
ghost_done
)
...
...
@@ -1766,21 +1766,21 @@ namespace WindBot.Game.AI.Decks
int
count
=
0
;
foreach
(
ClientCard
check
in
Enemy
.
Graveyard
)
{
if
(
check
.
I
d
==
CardId
.
MaxxC
)
if
(
check
.
I
sCode
(
CardId
.
MaxxC
)
)
count
++;
}
maxxc_done
=
count
;
count
=
0
;
foreach
(
ClientCard
check
in
Enemy
.
Graveyard
)
{
if
(
check
.
I
d
==
CardId
.
LockBird
)
if
(
check
.
I
sCode
(
CardId
.
LockBird
)
)
count
++;
}
lockbird_done
=
count
;
count
=
0
;
foreach
(
ClientCard
check
in
Enemy
.
Graveyard
)
{
if
(
check
.
I
d
==
CardId
.
Ghost
)
if
(
check
.
I
sCode
(
CardId
.
Ghost
)
)
count
++;
}
ghost_done
=
count
;
...
...
@@ -1800,7 +1800,7 @@ namespace WindBot.Game.AI.Decks
{
if (Bot.MonsterZone[a] != null && Enemy.MonsterZone[b] != null &&
SameMonsterColumn(a, b) &&
Bot.MonsterZone[a].I
d == attacker.Id && Enemy.MonsterZone[b].Id == defender.Id
)
Bot.MonsterZone[a].I
sCode(attacker.Id) && Enemy.MonsterZone[b].IsCode(defender.Id)
)
{
attackerzone = a;
defenderzone = b;
...
...
@@ -1820,27 +1820,23 @@ namespace WindBot.Game.AI.Decks
if
(
Duel
.
Player
==
0
&&
Bot
.
GetMonsterCount
()
>=
2
&&
plan_C
)
{
Logger
.
DebugWriteLine
(
"*********dangerous********************* "
);
if
(
attacker
.
I
d
==
CardId
.
OddEyesAbsoluteDragon
||
attacker
.
Id
==
CardId
.
OddEyesWingDragon
)
if
(
attacker
.
I
sCode
(
CardId
.
OddEyesAbsoluteDragon
,
CardId
.
OddEyesWingDragon
)
)
attacker
.
RealPower
=
9999
;
}
if
((
attacker
.
Id
==
CardId
.
DarkMagician
||
attacker
.
Id
==
CardId
.
MagiciansRod
||
attacker
.
Id
==
CardId
.
BigEye
||
attacker
.
Id
==
CardId
.
ApprenticeWitchling
)
&&
if
((
attacker
.
IsCode
(
CardId
.
DarkMagician
,
CardId
.
MagiciansRod
,
CardId
.
BigEye
,
CardId
.
ApprenticeWitchling
))
&&
Bot
.
HasInHandOrHasInMonstersZone
(
CardId
.
ApprenticeLllusionMagician
))
{
attacker
.
RealPower
+=
2000
;
}
if
(
attacker
.
I
d
==
CardId
.
ApprenticeLllusionMagician
&&
ApprenticeLllusionMagician_count
>=
2
)
if
(
attacker
.
I
sCode
(
CardId
.
ApprenticeLllusionMagician
)
&&
ApprenticeLllusionMagician_count
>=
2
)
{
attacker
.
RealPower
+=
2000
;
}
if
((
attacker
.
Id
==
CardId
.
DarkMagician
||
attacker
.
Id
==
CardId
.
DarkMagicianTheDragonKnight
)
&&
Bot
.
HasInSpellZone
(
CardId
.
EternalSoul
))
if
(
attacker
.
IsCode
(
CardId
.
DarkMagician
,
CardId
.
DarkMagicianTheDragonKnight
)
&&
Bot
.
HasInSpellZone
(
CardId
.
EternalSoul
))
{
return
true
;
}
if
(
attacker
.
I
d
==
CardId
.
CrystalWingSynchroDragon
)
if
(
attacker
.
I
sCode
(
CardId
.
CrystalWingSynchroDragon
)
)
{
if
(
defender
.
Level
>=
5
)
attacker
.
RealPower
=
9999
;
...
...
@@ -1853,10 +1849,9 @@ namespace WindBot.Game.AI.Decks
big_attack_used
=
true
;
return
true
;
}
if
(
attacker
.
I
d
==
CardId
.
ApprenticeLllusionMagician
)
if
(
attacker
.
I
sCode
(
CardId
.
ApprenticeLllusionMagician
)
)
Logger
.
DebugWriteLine
(
"@@@@@@@@@@@@@@@@@@@ApprenticeLllusionMagician= "
+
attacker
.
RealPower
);
if
(
Bot
.
HasInSpellZone
(
CardId
.
EternalSoul
)
&&
(
attacker
.
Id
==
CardId
.
DarkMagician
||
attacker
.
Id
==
CardId
.
DarkMagicianTheDragonKnight
||
attacker
.
Id
==
CardId
.
MagicianOfLllusion
))
if
(
Bot
.
HasInSpellZone
(
CardId
.
EternalSoul
)
&&
attacker
.
IsCode
(
CardId
.
DarkMagician
,
CardId
.
DarkMagicianTheDragonKnight
,
CardId
.
MagicianOfLllusion
))
return
true
;
return
base
.
OnPreBattleBetween
(
attacker
,
defender
);
}
...
...
@@ -1872,7 +1867,7 @@ namespace WindBot.Game.AI.Decks
{
if (Enemy.MonsterZone[b] != null &&
SameMonsterColumn(attackerzone, b) &&
Bot.MonsterZone[attackerzone].I
d == attacker.Id && Enemy.MonsterZone[b].Id == defender.Id
)
Bot.MonsterZone[attackerzone].I
sCode(attacker.Id) && Enemy.MonsterZone[b].IsCode(defender.Id)
)
{
defenderzone = b;
}
...
...
@@ -1907,7 +1902,7 @@ namespace WindBot.Game.AI.Decks
{
if (Bot.MonsterZone[a] != null && Enemy.MonsterZone[b]!=null &&
SameMonsterColumn(a,b) &&
Bot.MonsterZone[a].I
d==attacker.Id && Enemy.MonsterZone[b].Id == defender.Id
)
Bot.MonsterZone[a].I
sCode(attacker.Id) && Enemy.MonsterZone[b].IsCode(defender.Id)
)
{
attackerzone = a;
defenderzone = b;
...
...
Game/AI/Decks/DragunityExecutor.cs
View file @
43086945
...
...
@@ -136,7 +136,7 @@ namespace WindBot.Game.AI.Decks
int
count
=
0
;
foreach
(
ClientCard
card
in
Bot
.
Hand
)
{
if
(
card
.
I
d
==
CardId
.
DragunityDux
)
if
(
card
.
I
sCode
(
CardId
.
DragunityDux
)
)
++
count
;
}
if
(
count
>=
2
)
...
...
@@ -164,7 +164,7 @@ namespace WindBot.Game.AI.Decks
/*bool hasRealMonster = false;
foreach (ClientCard card in Bot.GetMonsters())
{
if (
card.Id != CardId.AssaultBeast
)
if (
!card.IsCode(CardId.AssaultBeast)
)
{
hasRealMonster = true;
break;
...
...
@@ -184,13 +184,13 @@ namespace WindBot.Game.AI.Decks
int
remaining
=
3
;
foreach
(
ClientCard
card
in
Bot
.
Hand
)
if
(
card
.
I
d
==
needId
)
if
(
card
.
I
sCode
(
needId
)
)
remaining
--;
foreach
(
ClientCard
card
in
Bot
.
Graveyard
)
if
(
card
.
I
d
==
needId
)
if
(
card
.
I
sCode
(
needId
)
)
remaining
--;
foreach
(
ClientCard
card
in
Bot
.
Banished
)
if
(
card
.
I
d
==
needId
)
if
(
card
.
I
sCode
(
needId
)
)
remaining
--;
if
(
remaining
<=
0
)
return
false
;
...
...
@@ -262,8 +262,7 @@ namespace WindBot.Game.AI.Decks
ClientCard
card
=
cards
[
i
];
if
(
card
.
Attack
<
2000
)
break
;
if
(
card
.
Id
==
(
int
)
CardId
.
StardustDragonAssaultMode
||
card
.
Id
==
(
int
)
CardId
.
FiveHeadedDragon
)
if
(
card
.
IsCode
(
CardId
.
StardustDragonAssaultMode
,
CardId
.
FiveHeadedDragon
))
continue
;
if
(
card
.
IsMonster
())
{
...
...
@@ -298,7 +297,7 @@ namespace WindBot.Game.AI.Decks
int
phalanxCount
=
0
;
foreach
(
ClientCard
card
in
Bot
.
Graveyard
)
{
if
(
card
.
I
d
==
(
int
)
CardId
.
DragunityPhalanx
)
if
(
card
.
I
sCode
(
CardId
.
DragunityPhalanx
)
)
{
phalanxCount
++;
break
;
...
...
@@ -315,7 +314,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
card
in
Bot
.
Graveyard
)
{
if
(
card
.
I
d
==
(
int
)
CardId
.
DragunityPhalanx
)
if
(
card
.
I
sCode
(
CardId
.
DragunityPhalanx
)
)
{
phalanxCount
--;
tributes
.
Add
(
card
);
...
...
@@ -462,7 +461,7 @@ namespace WindBot.Game.AI.Decks
List
<
ClientCard
>
monsters
=
Bot
.
GetMonsters
();
foreach
(
ClientCard
monster
in
monsters
)
{
if
(
monster
.
I
d
==
CardId
.
StardustDragon
&&
monster
.
Attacked
)
if
(
monster
.
I
sCode
(
CardId
.
StardustDragon
)
&&
monster
.
Attacked
)
{
AI
.
SelectCard
(
monster
);
return
true
;
...
...
Game/AI/Decks/FrogExecutor.cs
View file @
43086945
...
...
@@ -147,7 +147,7 @@ namespace WindBot.Game.AI.Decks
if
(
AI
.
Utils
.
IsOneEnemyBetterThanValue
(
atk
,
true
))
return
false
;
if
(
Card
.
I
d
==
CardId
.
SwapFrog
)
if
(
Card
.
I
sCode
(
CardId
.
SwapFrog
)
)
m_swapFrogSummoned
=
Duel
.
Turn
;
return
true
;
}
...
...
@@ -200,7 +200,7 @@ namespace WindBot.Game.AI.Decks
List
<
ClientCard
>
spells
=
Bot
.
GetSpells
();
foreach
(
ClientCard
spell
in
spells
)
{
if
(
spell
.
I
d
==
CardId
.
GravityBind
&&
!
spell
.
IsFacedown
())
if
(
spell
.
I
sCode
(
CardId
.
GravityBind
)
&&
!
spell
.
IsFacedown
())
return
false
;
}
return
true
;
...
...
@@ -208,9 +208,9 @@ namespace WindBot.Game.AI.Decks
private
bool
FrogMonsterRepos
()
{
if
(
Card
.
I
d
==
CardId
.
Unifrog
)
if
(
Card
.
I
sCode
(
CardId
.
Unifrog
)
)
return
Card
.
IsDefense
();
if
(
Card
.
I
d
==
CardId
.
DewdarkOfTheIceBarrier
)
if
(
Card
.
I
sCode
(
CardId
.
DewdarkOfTheIceBarrier
)
)
return
Card
.
IsDefense
();
bool
enemyBetter
=
AI
.
Utils
.
IsOneEnemyBetterThanValue
(
Card
.
Attack
+
(
Card
.
IsFacedown
()
?
GetSpellBonus
()
:
0
),
true
);
...
...
@@ -222,10 +222,10 @@ namespace WindBot.Game.AI.Decks
if
(
Card
.
IsDefense
()
&&
!
enemyBetter
)
result
=
true
;
if
(!
result
&&
Card
.
I
d
==
CardId
.
FlipFlopFrog
&&
Enemy
.
GetMonsterCount
()
>
0
&&
Card
.
IsFacedown
())
if
(!
result
&&
Card
.
I
sCode
(
CardId
.
FlipFlopFrog
)
&&
Enemy
.
GetMonsterCount
()
>
0
&&
Card
.
IsFacedown
())
result
=
true
;
if
(
Card
.
I
d
==
CardId
.
FlipFlopFrog
&&
Card
.
IsFacedown
()
&&
result
)
if
(
Card
.
I
sCode
(
CardId
.
FlipFlopFrog
)
&&
Card
.
IsFacedown
()
&&
result
)
m_flipFlopFrogSummoned
=
Duel
.
Turn
;
return
result
;
...
...
@@ -242,7 +242,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
card
in
Bot
.
GetSpells
())
{
if
(
card
.
I
d
==
CardId
.
Solidarity
)
if
(
card
.
I
sCode
(
CardId
.
Solidarity
)
)
atk
+=
800
;
}
}
...
...
Game/AI/Decks/GrenMajuThunderBoarderExecutor.cs
View file @
43086945
...
...
@@ -251,21 +251,21 @@ namespace WindBot.Game.AI.Decks
private
bool
DarkBribeeff
()
{
if
(
AI
.
Utils
.
GetLastChainCard
()!=
null
&&
AI
.
Utils
.
GetLastChainCard
().
I
d
==
CardId
.
UpstartGoblin
)
if
(
AI
.
Utils
.
GetLastChainCard
()!=
null
&&
AI
.
Utils
.
GetLastChainCard
().
I
sCode
(
CardId
.
UpstartGoblin
)
)
return
false
;
return
true
;
}
private
bool
ImperialOrderfirst
()
{
if
(
AI
.
Utils
.
GetLastChainCard
()
!=
null
&&
AI
.
Utils
.
GetLastChainCard
().
I
d
==
CardId
.
UpstartGoblin
)
if
(
AI
.
Utils
.
GetLastChainCard
()
!=
null
&&
AI
.
Utils
.
GetLastChainCard
().
I
sCode
(
CardId
.
UpstartGoblin
)
)
return
false
;
return
DefaultOnBecomeTarget
()
&&
AI
.
Utils
.
GetLastChainCard
().
HasType
(
CardType
.
Spell
);
}
private
bool
ImperialOrdereff
()
{
if
(
AI
.
Utils
.
GetLastChainCard
()
!=
null
&&
AI
.
Utils
.
GetLastChainCard
().
I
d
==
CardId
.
UpstartGoblin
)
if
(
AI
.
Utils
.
GetLastChainCard
()
!=
null
&&
AI
.
Utils
.
GetLastChainCard
().
I
sCode
(
CardId
.
UpstartGoblin
)
)
return
false
;
if
(
Duel
.
LastChainPlayer
==
1
)
{
...
...
@@ -437,7 +437,7 @@ namespace WindBot.Game.AI.Decks
IList
<
ClientCard
>
material_list
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
monster
in
Bot
.
GetMonsters
())
{
if
(
monster
.
I
d
==
CardId
.
MissusRadiant
||
monster
.
Id
==
CardId
.
LinkSpider
||
monster
.
Id
==
CardId
.
Linkuriboh
)
if
(
monster
.
I
sCode
(
CardId
.
MissusRadiant
,
CardId
.
LinkSpider
,
CardId
.
Linkuriboh
)
)
material_list
.
Add
(
monster
);
if
(
material_list
.
Count
==
3
)
break
;
}
...
...
@@ -454,10 +454,7 @@ namespace WindBot.Game.AI.Decks
IList
<
ClientCard
>
material_list
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
monster
in
Bot
.
GetMonsters
())
{
if
((
monster
.
Id
==
CardId
.
MissusRadiant
||
monster
.
Id
==
CardId
.
LinkSpider
||
monster
.
Id
==
CardId
.
Linkuriboh
)&&
monster
.
Id
!=
CardId
.
EaterOfMillions
)
if
(
monster
.
IsCode
(
CardId
.
MissusRadiant
,
CardId
.
LinkSpider
,
CardId
.
Linkuriboh
))
material_list
.
Add
(
monster
);
if
(
material_list
.
Count
==
3
)
break
;
}
...
...
@@ -559,7 +556,7 @@ namespace WindBot.Game.AI.Decks
IList
<
ClientCard
>
material_list
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
monster
in
Bot
.
GetMonsters
())
{
if
(
monster
.
HasAttribute
(
CardAttribute
.
Earth
)
&&
monster
.
Level
==
1
&&
monster
.
Id
!=
CardId
.
EaterOfMillions
)
if
(
monster
.
HasAttribute
(
CardAttribute
.
Earth
)
&&
monster
.
Level
==
1
&&
!
monster
.
IsCode
(
CardId
.
EaterOfMillions
)
)
material_list
.
Add
(
monster
);
if
(
material_list
.
Count
==
2
)
break
;
}
...
...
@@ -587,7 +584,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
c
in
Bot
.
GetMonsters
())
{
if
(
c
.
Id
!=
CardId
.
EaterOfMillions
&&
c
.
Id
!=
CardId
.
Linkuriboh
&&
c
.
Level
==
1
)
if
(
!
c
.
IsCode
(
CardId
.
EaterOfMillions
,
CardId
.
Linkuriboh
)
&&
c
.
Level
==
1
)
{
AI
.
SelectMaterials
(
c
);
return
true
;
...
...
@@ -598,12 +595,12 @@ namespace WindBot.Game.AI.Decks
private
bool
Linkuriboheff
()
{
if
(
Duel
.
LastChainPlayer
==
0
&&
AI
.
Utils
.
GetLastChainCard
().
I
d
==
CardId
.
Linkuriboh
)
return
false
;
if
(
Duel
.
LastChainPlayer
==
0
&&
AI
.
Utils
.
GetLastChainCard
().
I
sCode
(
CardId
.
Linkuriboh
)
)
return
false
;
return
true
;
}
private
bool
MonsterRepos
()
{
if
(
Card
.
I
d
==
CardId
.
EaterOfMillions
&&
Card
.
IsAttack
())
return
false
;
if
(
Card
.
I
sCode
(
CardId
.
EaterOfMillions
)
&&
Card
.
IsAttack
())
return
false
;
return
DefaultMonsterRepos
();
}
...
...
@@ -612,29 +609,29 @@ namespace WindBot.Game.AI.Decks
int
count
=
0
;
foreach
(
ClientCard
check
in
Bot
.
Hand
)
{
if
(
check
.
I
d
==
CardId
.
CardOfDemise
)
if
(
check
.
I
sCode
(
CardId
.
CardOfDemise
)
)
count
++;
}
if
(
count
==
2
&&
Bot
.
Hand
.
Count
==
2
&&
Bot
.
GetSpellCountWithoutField
()
<=
2
)
return
true
;
if
(
Card
.
I
d
==
CardId
.
MacroCosmos
&&
Bot
.
HasInSpellZone
(
CardId
.
MacroCosmos
))
return
false
;
if
(
Card
.
I
d
==
CardId
.
AntiSpellFragrance
&&
Bot
.
HasInSpellZone
(
CardId
.
AntiSpellFragrance
))
return
false
;
if
(
Card
.
I
sCode
(
CardId
.
MacroCosmos
)
&&
Bot
.
HasInSpellZone
(
CardId
.
MacroCosmos
))
return
false
;
if
(
Card
.
I
sCode
(
CardId
.
AntiSpellFragrance
)
&&
Bot
.
HasInSpellZone
(
CardId
.
AntiSpellFragrance
))
return
false
;
if
(
CardOfDemiseeff_used
)
return
true
;
if
(
Card
.
I
d
==
CardId
.
EvenlyMatched
&&
(
Enemy
.
GetFieldCount
()
-
Bot
.
GetFieldCount
())
<
0
)
return
false
;
if
(
Card
.
I
d
==
CardId
.
AntiSpellFragrance
&&
Bot
.
HasInSpellZone
(
CardId
.
AntiSpellFragrance
))
return
false
;
if
(
Card
.
I
d
==
CardId
.
MacroCosmos
&&
Bot
.
HasInSpellZone
(
CardId
.
MacroCosmos
))
return
false
;
if
(
Card
.
I
sCode
(
CardId
.
EvenlyMatched
)
&&
(
Enemy
.
GetFieldCount
()
-
Bot
.
GetFieldCount
())
<
0
)
return
false
;
if
(
Card
.
I
sCode
(
CardId
.
AntiSpellFragrance
)
&&
Bot
.
HasInSpellZone
(
CardId
.
AntiSpellFragrance
))
return
false
;
if
(
Card
.
I
sCode
(
CardId
.
MacroCosmos
)
&&
Bot
.
HasInSpellZone
(
CardId
.
MacroCosmos
))
return
false
;
if
(
Duel
.
Turn
>
1
&&
Duel
.
Phase
==
DuelPhase
.
Main1
&&
Bot
.
HasAttackingMonster
())
return
false
;
if
(
Card
.
I
d
==
CardId
.
InfiniteImpermanence
)
if
(
Card
.
I
sCode
(
CardId
.
InfiniteImpermanence
)
)
return
Bot
.
GetFieldCount
()
>
0
&&
Bot
.
GetSpellCountWithoutField
()
<
4
;
if
(
Card
.
I
d
==
CardId
.
Scapegoat
)
if
(
Card
.
I
sCode
(
CardId
.
Scapegoat
)
)
return
true
;
if
(
Card
.
HasType
(
CardType
.
Trap
))
return
Bot
.
GetSpellCountWithoutField
()
<
4
;
if
(
Bot
.
HasInSpellZone
(
CardId
.
AntiSpellFragrance
,
true
))
{
if
(
Card
.
I
d
==
CardId
.
UpstartGoblin
||
Card
.
Id
==
CardId
.
PotOfDesires
||
Card
.
Id
==
CardId
.
PotOfDuality
)
return
true
;
if
(
Card
.
I
d
==
CardId
.
CardOfDemise
&&
Bot
.
HasInSpellZone
(
CardId
.
CardOfDemise
))
return
false
;
if
(
Card
.
I
sCode
(
CardId
.
UpstartGoblin
,
CardId
.
PotOfDesires
,
CardId
.
PotOfDuality
)
)
return
true
;
if
(
Card
.
I
sCode
(
CardId
.
CardOfDemise
)
&&
Bot
.
HasInSpellZone
(
CardId
.
CardOfDemise
))
return
false
;
if
(
Card
.
HasType
(
CardType
.
Spell
))
return
Bot
.
GetSpellCountWithoutField
()
<
4
;
}
...
...
@@ -642,12 +639,12 @@ namespace WindBot.Game.AI.Decks
}
public
override
bool
OnPreBattleBetween
(
ClientCard
attacker
,
ClientCard
defender
)
{
if
(
attacker
.
I
d
==
_CardId
.
EaterOfMillions
&&
(
Bot
.
HasInMonstersZone
(
CardId
.
InspectBoarder
)
&&
eater_eff
)
&&
!
attacker
.
IsDisabled
())
if
(
attacker
.
I
sCode
(
_CardId
.
EaterOfMillions
)
&&
(
Bot
.
HasInMonstersZone
(
CardId
.
InspectBoarder
)
&&
eater_eff
)
&&
!
attacker
.
IsDisabled
())
{
attacker
.
RealPower
=
9999
;
return
true
;
}
if
(
attacker
.
I
d
==
_CardId
.
EaterOfMillions
&&
!
Bot
.
HasInMonstersZone
(
CardId
.
InspectBoarder
)
&&
!
attacker
.
IsDisabled
())
if
(
attacker
.
I
sCode
(
_CardId
.
EaterOfMillions
)
&&
!
Bot
.
HasInMonstersZone
(
CardId
.
InspectBoarder
)
&&
!
attacker
.
IsDisabled
())
{
attacker
.
RealPower
=
9999
;
return
true
;
...
...
@@ -659,7 +656,7 @@ namespace WindBot.Game.AI.Decks
for
(
int
i
=
0
;
i
<
attackers
.
Count
;
++
i
)
{
ClientCard
attacker
=
attackers
[
i
];
if
(
attacker
.
I
d
==
CardId
.
BirrelswordDragon
||
attacker
.
Id
==
CardId
.
EaterOfMillions
)
return
attacker
;
if
(
attacker
.
I
sCode
(
CardId
.
BirrelswordDragon
,
CardId
.
EaterOfMillions
)
)
return
attacker
;
}
return
null
;
}
...
...
Game/AI/Decks/HorusExecutor.cs
View file @
43086945
...
...
@@ -79,7 +79,7 @@ namespace WindBot.Game.AI.Decks
return
false
;
int
remaining
=
2
;
foreach
(
ClientCard
card
in
Bot
.
Banished
)
if
(
card
.
I
d
==
CardId
.
WhiteNightDragon
)
if
(
card
.
I
sCode
(
CardId
.
WhiteNightDragon
)
)
remaining
--;
if
(
remaining
>
0
)
{
...
...
@@ -154,7 +154,7 @@ namespace WindBot.Game.AI.Decks
// We should summon Horus the Black Flame Dragon LV6 if he can lvlup.
if
(
Enemy
.
GetMonsterCount
()
!=
0
&&
!
AI
.
Utils
.
IsAllEnemyBetterThanValue
(
2300
-
1
,
false
))
foreach
(
ClientCard
card
in
Main
.
SummonableCards
)
if
(
card
.
I
d
==
11224103
)
if
(
card
.
I
sCode
(
11224103
)
)
return
false
;
return
DefaultTributeSummon
();
...
...
@@ -197,7 +197,7 @@ namespace WindBot.Game.AI.Decks
ClientCard
monster
=
cards
[
i
];
if
(
monster
.
Attack
<
2300
)
return
false
;
if
(
monster
.
Race
==
(
int
)
CardRace
.
Dragon
&&
monster
.
Id
!=
CardId
.
HorusTheBlackFlameDragonLv8
)
if
(
monster
.
Race
==
(
int
)
CardRace
.
Dragon
&&
!
monster
.
IsCode
(
CardId
.
HorusTheBlackFlameDragonLv8
)
)
{
summonCard
=
monster
;
break
;
...
...
Game/AI/Decks/LightswornExecutor.cs
View file @
43086945
...
...
@@ -91,6 +91,7 @@ namespace WindBot.Game.AI.Decks
public
override
void
OnNewTurn
()
{
ClownUsed
=
false
;
base
.
OnNewTurn
();
}
public
override
bool
OnPreBattleBetween
(
ClientCard
attacker
,
ClientCard
defender
)
...
...
@@ -109,13 +110,13 @@ namespace WindBot.Game.AI.Decks
IList
<
ClientCard
>
result
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
card
in
cards
)
{
if
(!
result
.
Contains
(
card
)
&&
(!
ClownUsed
||
card
.
Id
!=
CardId
.
PerformageTrickClown
))
if
(!
result
.
Contains
(
card
)
&&
(!
ClownUsed
||
!
card
.
IsCode
(
CardId
.
PerformageTrickClown
)
))
result
.
Add
(
card
);
if
(
result
.
Count
>=
max
)
break
;
}
AI
.
Utils
.
CheckSelectCount
(
result
,
cards
,
min
,
max
);
return
result
;
return
AI
.
Utils
.
CheckSelectCount
(
result
,
cards
,
min
,
max
)
;
}
private
bool
ReinforcementOfTheArmyEffect
()
...
...
Game/AI/Decks/LightswornShaddoldinosourExecutor.cs
View file @
43086945
...
...
@@ -390,7 +390,7 @@ namespace WindBot.Game.AI.Decks
Pillused
=
true
;
foreach
(
ClientCard
card
in
Bot
.
GetMonsters
())
{
if
(
card
.
I
d
==
CardId
.
UltimateConductorTytanno
&&
card
.
IsFaceup
())
if
(
card
.
I
sCode
(
CardId
.
UltimateConductorTytanno
)
&&
card
.
IsFaceup
())
return
false
;
}
Ultimate_ss
++;
...
...
@@ -410,12 +410,12 @@ namespace WindBot.Game.AI.Decks
private
bool
MonsterRepos
()
{
if
(
Card
.
I
d
==
CardId
.
UltimateConductorTytanno
&&
Card
.
IsFacedown
())
return
true
;
if
(
Card
.
I
d
==
CardId
.
ElShaddollConstruct
&&
Card
.
IsFacedown
())
return
true
;
if
(
Card
.
I
d
==
CardId
.
ElShaddollConstruct
&&
Card
.
IsAttack
())
return
false
;
if
(
Card
.
I
d
==
CardId
.
GlowUpBulb
&&
Card
.
IsDefense
())
return
false
;
if
(
Card
.
I
d
==
CardId
.
ShaddollDragon
&&
Card
.
IsFacedown
()
&&
Enemy
.
GetMonsterCount
()
>=
0
)
return
true
;
if
(
Card
.
I
d
==
CardId
.
ShaddollSquamata
&&
Card
.
IsFacedown
()
&&
Enemy
.
GetMonsterCount
()
>=
0
)
return
true
;
if
(
Card
.
I
sCode
(
CardId
.
UltimateConductorTytanno
)
&&
Card
.
IsFacedown
())
return
true
;
if
(
Card
.
I
sCode
(
CardId
.
ElShaddollConstruct
)
&&
Card
.
IsFacedown
())
return
true
;
if
(
Card
.
I
sCode
(
CardId
.
ElShaddollConstruct
)
&&
Card
.
IsAttack
())
return
false
;
if
(
Card
.
I
sCode
(
CardId
.
GlowUpBulb
)
&&
Card
.
IsDefense
())
return
false
;
if
(
Card
.
I
sCode
(
CardId
.
ShaddollDragon
)
&&
Card
.
IsFacedown
()
&&
Enemy
.
GetMonsterCount
()
>=
0
)
return
true
;
if
(
Card
.
I
sCode
(
CardId
.
ShaddollSquamata
)
&&
Card
.
IsFacedown
()
&&
Enemy
.
GetMonsterCount
()
>=
0
)
return
true
;
return
base
.
DefaultMonsterRepos
();
}
...
...
@@ -430,7 +430,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
card
in
Bot
.
GetMonsters
())
{
if
(
card
.
I
d
==
CardId
.
UltimateConductorTytanno
&&
card
.
IsFaceup
())
if
(
card
.
I
sCode
(
CardId
.
UltimateConductorTytanno
)
&&
card
.
IsFaceup
())
return
false
;
}
if
(
Pillused
==
true
)
return
false
;
...
...
@@ -552,7 +552,7 @@ namespace WindBot.Game.AI.Decks
IList
<
ClientCard
>
all
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
check
in
grave
)
{
if
(
check
.
I
d
==
CardId
.
GiantRex
)
if
(
check
.
I
sCode
(
CardId
.
GiantRex
))
{
all
.
Add
(
check
);
}
...
...
@@ -1030,8 +1030,8 @@ namespace WindBot.Game.AI.Decks
public
bool
Hand_act_eff
()
{
//if (Card.I
d == CardId.Urara
&& Bot.HasInHand(CardId.LockBird) && Bot.HasInSpellZone(CardId.Re)) return false;
if
(
Card
.
I
d
==
CardId
.
GhostOgre
&&
Card
.
Location
==
CardLocation
.
Hand
&&
Bot
.
HasInMonstersZone
(
CardId
.
GhostOgre
))
return
false
;
//if (Card.I
sCode(CardId.Urara)
&& Bot.HasInHand(CardId.LockBird) && Bot.HasInSpellZone(CardId.Re)) return false;
if
(
Card
.
I
sCode
(
CardId
.
GhostOgre
)
&&
Card
.
Location
==
CardLocation
.
Hand
&&
Bot
.
HasInMonstersZone
(
CardId
.
GhostOgre
))
return
false
;
return
(
Duel
.
LastChainPlayer
==
1
);
}
//other extra
...
...
@@ -1128,14 +1128,8 @@ namespace WindBot.Game.AI.Decks
};
int
count
=
0
;
foreach
(
ClientCard
monster
in
Bot
.
GetMonsters
())
if
(
monster
.
Id
==
CardId
.
GlowUpBulb
||
monster
.
Id
==
CardId
.
FairyTailSnow
||
monster
.
Id
==
CardId
.
KeeperOfDragonicMagic
||
monster
.
Id
==
CardId
.
SouleatingOviraptor
||
monster
.
Id
==
CardId
.
GiantRex
||
monster
.
Id
==
CardId
.
Lumina
||
monster
.
Id
==
CardId
.
Raiden
)
if
(
monster
.
IsCode
(
CardId
.
GlowUpBulb
,
CardId
.
FairyTailSnow
,
CardId
.
KeeperOfDragonicMagic
,
CardId
.
SouleatingOviraptor
,
CardId
.
GiantRex
,
CardId
.
Lumina
,
CardId
.
Raiden
))
count
++;
if
(!
Bot
.
HasInMonstersZone
(
CardId
.
GlowUpBulb
)
||
count
<
2
)
return
false
;
...
...
@@ -1150,7 +1144,7 @@ namespace WindBot.Game.AI.Decks
bool
DarkHole
=
false
;
foreach
(
ClientCard
card
in
Enemy
.
GetSpells
())
{
if
(
card
.
I
d
==
53129443
&&
card
.
IsFaceup
())
if
(
card
.
I
sCode
(
53129443
)
&&
card
.
IsFaceup
())
{
DarkHole
=
true
;
}
...
...
@@ -1222,12 +1216,12 @@ namespace WindBot.Game.AI.Decks
{
foreach (ClientCard hand in Bot.Hand)
{
if (hand.I
d == CardId.Red || hand.Id == CardId.Pink
)
if (hand.I
sCode(CardId.Red, CardId.Pink)
)
{
AI.SelectCard(hand);
return true;
}
if (hand.I
d == CardId.Urara || hand.Id == CardId.Ghost
)
if (hand.I
sCode(CardId.Urara, CardId.Ghost)
)
{
if (Tuner_ss())
{
...
...
@@ -1261,7 +1255,7 @@ namespace WindBot.Game.AI.Decks
private
bool
RedWyverneff
()
{
IList
<
ClientCard
>
check
=
Enemy
.
MonsterZone
;
IList
<
ClientCard
>
check
=
Enemy
.
GetMonsters
()
;
ClientCard
best
=
null
;
foreach
(
ClientCard
monster
in
check
)
{
...
...
@@ -1304,9 +1298,9 @@ namespace WindBot.Game.AI.Decks
{
if
(!
defender
.
IsMonsterHasPreventActivationEffectInBattle
())
{
if
(
attacker
.
I
d
==
CardId
.
ElShaddollConstruct
&&
!
attacker
.
IsDisabled
())
// TODO: && defender.IsSpecialSummoned
if
(
attacker
.
I
sCode
(
CardId
.
ElShaddollConstruct
)
&&
!
attacker
.
IsDisabled
())
// TODO: && defender.IsSpecialSummoned
attacker
.
RealPower
=
9999
;
if
(
attacker
.
I
d
==
CardId
.
UltimateConductorTytanno
&&
!
attacker
.
IsDisabled
()
&&
defender
.
IsDefense
())
if
(
attacker
.
I
sCode
(
CardId
.
UltimateConductorTytanno
)
&&
!
attacker
.
IsDisabled
()
&&
defender
.
IsDefense
())
attacker
.
RealPower
=
9999
;
}
return
base
.
OnPreBattleBetween
(
attacker
,
defender
);
...
...
Game/AI/Decks/NekrozExecutor.cs
View file @
43086945
...
...
@@ -106,9 +106,9 @@ namespace WindBot.Game.AI.Decks
if
(!
Bot
.
HasInHand
(
NekrozRituelCard
)
||
Bot
.
HasInHand
(
CardId
.
Shurit
)
||
!
Bot
.
HasInHand
(
NekrozSpellCard
))
return
true
;
foreach
(
ClientCard
Card
in
Bot
.
Hand
)
if
(
Card
!=
null
&&
Card
.
I
d
==
CardId
.
Kaleidoscope
&&
!
Bot
.
HasInHand
(
CardId
.
Unicore
))
if
(
Card
!=
null
&&
Card
.
I
sCode
(
CardId
.
Kaleidoscope
)
&&
!
Bot
.
HasInHand
(
CardId
.
Unicore
))
return
true
;
else
if
(
Card
.
I
d
==
CardId
.
Trishula
||
Card
.
Id
==
CardId
.
DecisiveArmor
&&
!
Bot
.
HasInHand
(
CardId
.
Mirror
)
||
!
Bot
.
HasInHand
(
CardId
.
Shurit
))
else
if
(
Card
.
I
sCode
(
CardId
.
Trishula
)
||
Card
.
IsCode
(
CardId
.
DecisiveArmor
)
&&
!
Bot
.
HasInHand
(
CardId
.
Mirror
)
||
!
Bot
.
HasInHand
(
CardId
.
Shurit
))
return
true
;
return
false
;
}
...
...
@@ -271,9 +271,9 @@ namespace WindBot.Game.AI.Decks
List
<
int
>
NekrozCard
=
new
List
<
int
>();
try
{
foreach
(
ClientCard
C
ard
in
Bot
.
Hand
)
if
(
Card
!=
null
&&
NekrozRituelCard
.
Contains
((
int
)
Card
.
I
d
))
NekrozCard
.
Add
(
C
ard
.
Id
);
foreach
(
ClientCard
c
ard
in
Bot
.
Hand
)
if
(
card
!=
null
&&
card
.
IsCode
(
NekrozRituelCar
d
))
NekrozCard
.
Add
(
c
ard
.
Id
);
foreach
(
int
Id
in
NekrozCard
)
{
...
...
Game/AI/Decks/PhantasmExecutor.cs
View file @
43086945
...
...
@@ -162,7 +162,7 @@ namespace WindBot.Game.AI.Decks
}
if
(
AI
.
Utils
.
GetProblematicEnemyCard
(
9999
,
true
)!=
null
)
{
if
(
AI
.
Utils
.
GetProblematicEnemyCard
(
9999
,
true
).
I
d
==
CardId
.
ElShaddollWinda
&&
if
(
AI
.
Utils
.
GetProblematicEnemyCard
(
9999
,
true
).
I
sCode
(
CardId
.
ElShaddollWinda
)
&&
!
AI
.
Utils
.
GetProblematicEnemyCard
(
9999
,
true
).
IsDisabled
())
return
false
;
AI
.
SelectCard
(
AI
.
Utils
.
GetProblematicEnemyCard
(
9999
,
true
));
...
...
@@ -349,7 +349,7 @@ namespace WindBot.Game.AI.Decks
ClientCard
target
=
null
;
foreach
(
ClientCard
s
in
Bot
.
GetSpells
())
{
if
(
s
.
I
d
==
CardId
.
SeaStealthAttack
&&
Card
.
IsFaceup
())
if
(
s
.
I
sCode
(
CardId
.
SeaStealthAttack
)
&&
Card
.
IsFaceup
())
{
target
=
s
;
break
;
...
...
@@ -388,7 +388,7 @@ namespace WindBot.Game.AI.Decks
IList
<
ClientCard
>
material_list
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
m
in
Bot
.
GetMonsters
())
{
if
(
m
.
I
d
==
CardId
.
MissusRadiant
)
if
(
m
.
I
sCode
(
CardId
.
MissusRadiant
)
)
{
material_list
.
Add
(
m
);
break
;
...
...
@@ -396,7 +396,7 @@ namespace WindBot.Game.AI.Decks
}
foreach
(
ClientCard
m
in
Bot
.
GetMonsters
())
{
if
(
m
.
I
d
==
CardId
.
Linkuriboh
||
m
.
Id
==
CardId
.
LinkSpider
)
if
(
m
.
I
sCode
(
CardId
.
Linkuriboh
,
CardId
.
LinkSpider
)
)
{
material_list
.
Add
(
m
);
if
(
material_list
.
Count
==
3
)
...
...
@@ -489,7 +489,7 @@ namespace WindBot.Game.AI.Decks
IList
<
ClientCard
>
material_list
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
monster
in
Bot
.
GetMonsters
())
{
if
(
monster
.
HasAttribute
(
CardAttribute
.
Earth
)
&&
monster
.
Level
==
1
&&
monster
.
Id
!=
CardId
.
EaterOfMillions
)
if
(
monster
.
HasAttribute
(
CardAttribute
.
Earth
)
&&
monster
.
Level
==
1
&&
!
monster
.
IsCode
(
CardId
.
EaterOfMillions
)
)
material_list
.
Add
(
monster
);
if
(
material_list
.
Count
==
2
)
break
;
}
...
...
@@ -518,7 +518,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
c
in
Bot
.
GetMonsters
())
{
if
(
c
.
Id
!=
CardId
.
EaterOfMillions
&&
c
.
Id
!=
CardId
.
Linkuriboh
&&
c
.
Level
==
1
)
if
(
!
c
.
IsCode
(
CardId
.
EaterOfMillions
,
CardId
.
Linkuriboh
)
&&
c
.
Level
==
1
)
{
AI
.
SelectMaterials
(
c
);
return
true
;
...
...
@@ -529,7 +529,7 @@ namespace WindBot.Game.AI.Decks
private
bool
Linkuriboheff
()
{
if
(
Duel
.
LastChainPlayer
==
0
&&
AI
.
Utils
.
GetLastChainCard
().
I
d
==
CardId
.
Linkuriboh
)
return
false
;
if
(
Duel
.
LastChainPlayer
==
0
&&
AI
.
Utils
.
GetLastChainCard
().
I
sCode
(
CardId
.
Linkuriboh
)
)
return
false
;
return
true
;
}
private
bool
SeaStealthAttackeff
()
...
...
@@ -548,7 +548,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
s
in
Bot
.
GetGraveyardSpells
())
{
if
(
s
.
I
d
==
CardId
.
PacifisThePhantasmCity
)
if
(
s
.
I
sCode
(
CardId
.
PacifisThePhantasmCity
)
)
{
AI
.
SelectYesNo
(
true
);
AI
.
SelectCard
(
s
);
...
...
@@ -560,7 +560,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
s
in
Bot
.
Hand
)
{
if
(
s
.
I
d
==
CardId
.
PacifisThePhantasmCity
)
if
(
s
.
I
sCode
(
CardId
.
PacifisThePhantasmCity
)
)
{
AI
.
SelectYesNo
(
true
);
AI
.
SelectCard
(
s
);
...
...
@@ -579,7 +579,7 @@ namespace WindBot.Game.AI.Decks
ClientCard
target
=
null
;
foreach
(
ClientCard
s
in
Bot
.
GetSpells
())
{
if
(
s
.
I
d
==
CardId
.
PacifisThePhantasmCity
)
if
(
s
.
I
sCode
(
CardId
.
PacifisThePhantasmCity
)
)
target
=
s
;
}
if
(
target
!=
null
&&
AI
.
Utils
.
IsChainTarget
(
target
))
...
...
@@ -590,13 +590,13 @@ namespace WindBot.Game.AI.Decks
target
=
AI
.
Utils
.
GetLastChainCard
();
if
(
target
!=
null
)
{
if
(
target
.
I
d
==
CardId
.
BrandishSkillAfterburner
)
if
(
target
.
I
sCode
(
CardId
.
BrandishSkillAfterburner
)
)
{
AI
.
SelectCard
(
CardId
.
MegalosmasherX
);
SeaStealthAttackeff_used
=
true
;
return
true
;
}
if
(
Enemy
.
GetGraveyardSpells
().
Count
>=
3
&&
target
.
I
d
==
CardId
.
BrandishSkillJammingWave
)
if
(
Enemy
.
GetGraveyardSpells
().
Count
>=
3
&&
target
.
I
sCode
(
CardId
.
BrandishSkillJammingWave
)
)
{
AI
.
SelectCard
(
CardId
.
MegalosmasherX
);
SeaStealthAttackeff_used
=
true
;
...
...
@@ -675,7 +675,7 @@ namespace WindBot.Game.AI.Decks
int
zone_count
=
5
-
Bot
.
GetSpellCountWithoutField
();
return
zone_count
-
hand_spell_count
>=
1
;
}
if
(
Card
.
I
d
==
CardId
.
PhantasmSprialBattle
||
Card
.
Id
==
CardId
.
PhantasmSpiralPower
)
if
(
Card
.
I
sCode
(
CardId
.
PhantasmSprialBattle
,
CardId
.
PhantasmSpiralPower
)
)
{
if
(
Bot
.
HasInMonstersZone
(
CardId
.
MegalosmasherX
)
&&
!
Bot
.
HasInHandOrInSpellZone
(
CardId
.
PacifisThePhantasmCity
)
&&
...
...
@@ -691,20 +691,20 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
s
in
Bot
.
GetSpells
())
{
if
(
s
.
IsFaceup
()
&&
s
.
I
d
==
CardId
.
SeaStealthAttack
&&
if
(
s
.
IsFaceup
()
&&
s
.
I
sCode
(
CardId
.
SeaStealthAttack
)
&&
Bot
.
HasInSpellZone
(
CardId
.
PacifisThePhantasmCity
)
&&
Card
.
IsAttack
())
return
false
;
}
}
if
(
Card
.
I
d
==
CardId
.
EaterOfMillions
&&
!
Card
.
IsDisabled
()
&&
Card
.
IsAttack
())
if
(
Card
.
I
sCode
(
CardId
.
EaterOfMillions
)
&&
!
Card
.
IsDisabled
()
&&
Card
.
IsAttack
())
return
false
;
return
DefaultMonsterRepos
();
}
public
override
bool
OnPreBattleBetween
(
ClientCard
attacker
,
ClientCard
defender
)
{
if
(
attacker
.
I
d
==
CardId
.
PacifisThePhantasmCity
+
1
&&
defender
.
Id
==
CardId
.
EaterOfMillions
)
if
(
attacker
.
I
sCode
(
CardId
.
PacifisThePhantasmCity
+
1
)
&&
defender
.
IsCode
(
CardId
.
EaterOfMillions
)
)
{
if
(
attacker
.
RealPower
>=
defender
.
RealPower
)
return
true
;
}
...
...
@@ -712,10 +712,10 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
s
in
Bot
.
GetSpells
())
{
if
(
s
.
IsFaceup
()
&&
s
.
I
d
==
CardId
.
SeaStealthAttack
&&
Bot
.
HasInSpellZone
(
CardId
.
PacifisThePhantasmCity
))
if
(
s
.
IsFaceup
()
&&
s
.
I
sCode
(
CardId
.
SeaStealthAttack
)
&&
Bot
.
HasInSpellZone
(
CardId
.
PacifisThePhantasmCity
))
{
attacker
.
RealPower
=
9999
;
if
(
defender
.
I
d
==
CardId
.
EaterOfMillions
)
return
true
;
if
(
defender
.
I
sCode
(
CardId
.
EaterOfMillions
)
)
return
true
;
}
}
...
...
@@ -728,7 +728,7 @@ namespace WindBot.Game.AI.Decks
for
(
int
i
=
0
;
i
<
attackers
.
Count
;
++
i
)
{
ClientCard
attacker
=
attackers
[
i
];
if
(
attacker
.
I
d
==
CardId
.
EaterOfMillions
)
return
attacker
;
if
(
attacker
.
I
sCode
(
CardId
.
EaterOfMillions
)
)
return
attacker
;
}
return
null
;
}
...
...
Game/AI/Decks/QliphortExecutor.cs
View file @
43086945
...
...
@@ -141,7 +141,7 @@ namespace WindBot.Game.AI.Decks
for
(
int
i
=
1
;
i
<=
max
;
++
i
)
{
ClientCard
card
=
cards
[
cards
.
Count
-
i
];
if
(
card
.
Id
!=
CardId
.
Scout
||
(
card
.
Location
==
CardLocation
.
Extra
&&
!
Duel
.
IsNewRule
))
if
(
!
card
.
IsCode
(
CardId
.
Scout
)
||
(
card
.
Location
==
CardLocation
.
Extra
&&
!
Duel
.
IsNewRule
))
selected
.
Add
(
card
);
}
if
(
selected
.
Count
==
0
)
...
...
@@ -152,7 +152,7 @@ namespace WindBot.Game.AI.Decks
private
bool
NormalSummon
()
{
if
(
Card
.
I
d
==
CardId
.
Scout
)
if
(
Card
.
I
sCode
(
CardId
.
Scout
)
)
return
false
;
if
(
Card
.
Level
<
8
)
AI
.
SelectOption
(
1
);
...
...
@@ -196,7 +196,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
card
in
Bot
.
GetSpells
())
{
if
(
card
.
I
d
==
Card
.
Id
)
if
(
card
.
I
sCode
(
Card
.
Id
)
)
return
false
;
}
return
TrapSetWhenZoneFree
();
...
...
Game/AI/Decks/RainbowExecutor.cs
View file @
43086945
...
...
@@ -162,7 +162,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
card2
in
cards
)
{
if
(
card1
.
I
d
==
card2
.
Id
&&
!
card1
.
Equals
(
card2
))
if
(
card1
.
I
sCode
(
card2
.
Id
)
&&
!
card1
.
Equals
(
card2
))
{
result
.
Add
(
card1
);
result
.
Add
(
card2
);
...
...
@@ -172,8 +172,8 @@ namespace WindBot.Game.AI.Decks
if
(
result
.
Count
>
0
)
break
;
}
AI
.
Utils
.
CheckSelectCount
(
result
,
cards
,
min
,
max
);
return
result
;
return
AI
.
Utils
.
CheckSelectCount
(
result
,
cards
,
min
,
max
)
;
}
private
bool
UnexpectedDaiEffect
()
...
...
Game/AI/Decks/Rank5Executor.cs
View file @
43086945
...
...
@@ -120,15 +120,13 @@ namespace WindBot.Game.AI.Decks
public
override
IList
<
ClientCard
>
OnSelectXyzMaterial
(
IList
<
ClientCard
>
cards
,
int
min
,
int
max
)
{
IList
<
ClientCard
>
result
=
new
List
<
ClientCard
>();
AI
.
Utils
.
SelectPreferredCards
(
result
,
new
[]
{
IList
<
ClientCard
>
result
=
AI
.
Utils
.
SelectPreferredCards
(
new
[]
{
CardId
.
MistArchfiend
,
CardId
.
PanzerDragon
,
CardId
.
SolarWindJammer
,
CardId
.
StarDrawing
},
cards
,
min
,
max
);
AI
.
Utils
.
CheckSelectCount
(
result
,
cards
,
min
,
max
);
return
result
;
return
AI
.
Utils
.
CheckSelectCount
(
result
,
cards
,
min
,
max
);
}
private
bool
NormalSummon
()
...
...
@@ -187,15 +185,15 @@ namespace WindBot.Game.AI.Decks
int
lv5Count
=
0
;
foreach
(
ClientCard
card
in
Bot
.
Hand
)
{
if
(
card
.
I
d
==
CardId
.
SolarWindJammer
&&
Bot
.
GetMonsterCount
()
==
0
)
if
(
card
.
I
sCode
(
CardId
.
SolarWindJammer
)
&&
Bot
.
GetMonsterCount
()
==
0
)
++
lv5Count
;
if
(
card
.
I
d
==
CardId
.
InstantFusion
&&
!
InstantFusionUsed
)
if
(
card
.
I
sCode
(
CardId
.
InstantFusion
)
&&
!
InstantFusionUsed
)
++
lv5Count
;
if
(
card
.
I
d
==
CardId
.
QuickdrawSynchron
&&
Bot
.
Hand
.
ContainsMonsterWithLevel
(
4
))
if
(
card
.
I
sCode
(
CardId
.
QuickdrawSynchron
)
&&
Bot
.
Hand
.
ContainsMonsterWithLevel
(
4
))
++
lv5Count
;
if
(
card
.
I
d
==
CardId
.
MistArchfiend
&&
!
NormalSummoned
)
if
(
card
.
I
sCode
(
CardId
.
MistArchfiend
)
&&
!
NormalSummoned
)
++
lv5Count
;
if
(
card
.
I
d
==
CardId
.
DoubleSummon
&&
DoubleSummonEffect
())
if
(
card
.
I
sCode
(
CardId
.
DoubleSummon
)
&&
DoubleSummonEffect
())
++
lv5Count
;
}
if
(
lv5Count
>=
2
)
...
...
@@ -389,8 +387,8 @@ namespace WindBot.Game.AI.Decks
if
(
monster
.
HasType
(
CardType
.
Monster
)
&&
!
monster
.
HasType
(
CardType
.
Xyz
)
&&
(
monster
.
Level
==
5
||
monster
.
I
d
==
CardId
.
StarDrawing
||
(
monster
.
I
d
==
CardId
.
WindUpSoldier
)
&&
!
monster
.
Equals
(
Card
)))
||
monster
.
I
sCode
(
CardId
.
StarDrawing
)
||
(
monster
.
I
sCode
(
CardId
.
WindUpSoldier
)
)
&&
!
monster
.
Equals
(
Card
)))
return
true
;
}
return
false
;
...
...
Game/AI/Decks/ST1732Executor.cs
View file @
43086945
...
...
@@ -284,7 +284,7 @@ namespace WindBot.Game.AI.Decks
List
<
ClientCard
>
monsters
=
Bot
.
GetMonsters
();
foreach
(
ClientCard
monster
in
monsters
)
{
if
(
monster
.
I
d
==
CardId
.
BalancerLord
)
if
(
monster
.
I
sCode
(
CardId
.
BalancerLord
)
)
{
AI
.
SelectCard
(
monster
);
selected
=
true
;
...
...
@@ -404,7 +404,7 @@ namespace WindBot.Game.AI.Decks
};
foreach
(
ClientCard
monster
in
Bot
.
Hand
)
{
if
(
targets
.
Contains
(
monster
.
Id
))
if
(
monster
.
IsCode
(
targets
))
{
AI
.
SelectCard
(
targets
);
return
true
;
...
...
@@ -418,7 +418,7 @@ namespace WindBot.Game.AI.Decks
};
foreach
(
ClientCard
monster
in
Bot
.
GetMonsters
())
{
if
(
targets2
.
Contains
(
monster
.
Id
))
if
(
monster
.
IsCode
(
targets2
))
{
AI
.
SelectCard
(
targets2
);
return
true
;
...
...
Game/AI/Decks/SkyStrikerExecutor.cs
View file @
43086945
...
...
@@ -152,7 +152,7 @@ namespace WindBot.Game.AI.Decks
{
if
(!
defender
.
IsMonsterHasPreventActivationEffectInBattle
())
{
if
(
attacker
.
I
d
==
CardId
.
HiSpeedroidChanbara
&&
!
attacker
.
IsDisabled
())
if
(
attacker
.
I
sCode
(
CardId
.
HiSpeedroidChanbara
)
&&
!
attacker
.
IsDisabled
())
attacker
.
RealPower
=
attacker
.
RealPower
+
200
;
}
return
base
.
OnPreBattleBetween
(
attacker
,
defender
);
...
...
@@ -399,7 +399,7 @@ namespace WindBot.Game.AI.Decks
IList
<
ClientCard
>
targets
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
card
in
Bot
.
GetGraveyardMonsters
())
{
if
(
card
.
I
d
==
CardId
.
Hayate
||
card
.
Id
==
CardId
.
Kagari
||
card
.
Id
==
CardId
.
Shizuku
)
if
(
card
.
I
sCode
(
CardId
.
Hayate
,
CardId
.
Kagari
,
CardId
.
Shizuku
)
)
targets
.
Add
(
card
);
}
if
(
targets
.
Count
>
0
)
...
...
@@ -451,7 +451,7 @@ namespace WindBot.Game.AI.Decks
}
foreach
(
ClientCard
target
in
Bot
.
GetMonsters
())
{
if
(
target
.
I
d
==
CardId
.
Raye
&&
Bot
.
GetMonstersExtraZoneCount
()
==
0
)
if
(
target
.
I
sCode
(
CardId
.
Raye
)
&&
Bot
.
GetMonstersExtraZoneCount
()
==
0
)
{
AI
.
SelectCard
(
target
);
return
true
;
...
...
@@ -459,7 +459,7 @@ namespace WindBot.Game.AI.Decks
}
foreach
(
ClientCard
target
in
Bot
.
GetSpells
())
{
if
(
target
.
Id
!=
CardId
.
AreaZero
&&
target
.
Id
!=
CardId
.
Multirole
&&
target
.
Id
!=
CardId
.
WidowAnchor
&&
target
.
IsSpell
())
if
(
!
target
.
IsCode
(
CardId
.
AreaZero
,
CardId
.
Multirole
,
CardId
.
WidowAnchor
)
&&
target
.
IsSpell
())
{
AI
.
SelectCard
(
target
);
return
true
;
...
...
@@ -482,7 +482,7 @@ namespace WindBot.Game.AI.Decks
}
foreach
(
ClientCard
target
in
Bot
.
GetMonsters
())
{
if
(
target
.
I
d
==
CardId
.
Raye
&&
Bot
.
GetMonstersExtraZoneCount
()
==
0
)
if
(
target
.
I
sCode
(
CardId
.
Raye
)
&&
Bot
.
GetMonstersExtraZoneCount
()
==
0
)
{
AI
.
SelectCard
(
target
);
return
true
;
...
...
@@ -490,7 +490,7 @@ namespace WindBot.Game.AI.Decks
}
foreach
(
ClientCard
target
in
Bot
.
GetSpells
())
{
if
(
target
.
I
d
==
CardId
.
AreaZero
)
if
(
target
.
I
sCode
(
CardId
.
AreaZero
)
)
{
AI
.
SelectCard
(
target
);
return
true
;
...
...
@@ -498,7 +498,7 @@ namespace WindBot.Game.AI.Decks
}
foreach
(
ClientCard
target
in
Bot
.
GetSpells
())
{
if
(
target
.
Id
!=
CardId
.
Multirole
&&
target
.
Id
!=
CardId
.
WidowAnchor
&&
target
.
IsSpell
())
if
(
!
target
.
IsCode
(
CardId
.
Multirole
,
CardId
.
WidowAnchor
)
&&
target
.
IsSpell
())
{
AI
.
SelectCard
(
target
);
return
true
;
...
...
Game/AI/Decks/ToadallyAwesomeExecutor.cs
View file @
43086945
...
...
@@ -116,7 +116,7 @@ namespace WindBot.Game.AI.Decks
{
if
(!
defender
.
IsMonsterHasPreventActivationEffectInBattle
())
{
if
(
attacker
.
I
d
==
CardId
.
SkyCavalryCentaurea
&&
!
attacker
.
IsDisabled
()
&&
attacker
.
HasXyzMaterial
())
if
(
attacker
.
I
sCode
(
CardId
.
SkyCavalryCentaurea
)
&&
!
attacker
.
IsDisabled
()
&&
attacker
.
HasXyzMaterial
())
attacker
.
RealPower
=
Bot
.
LifePoints
+
attacker
.
Attack
;
}
return
base
.
OnPreBattleBetween
(
attacker
,
defender
);
...
...
@@ -315,7 +315,7 @@ namespace WindBot.Game.AI.Decks
};
foreach
(
ClientCard
monster
in
monsters
)
{
if
(
suitableCost
.
Contains
(
monster
.
Id
))
if
(
monster
.
IsCode
(
suitableCost
))
{
AI
.
SelectCard
(
monster
);
return
true
;
...
...
@@ -325,7 +325,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
monster
in
monsters
)
{
if
(
monster
.
I
d
==
CardId
.
DupeFrog
)
if
(
monster
.
I
sCode
(
CardId
.
DupeFrog
)
)
{
AI
.
SelectCard
(
monster
);
return
true
;
...
...
@@ -337,7 +337,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
monster
in
hands
)
{
if
(
monster
.
I
d
==
CardId
.
GraydleSlimeJr
)
if
(
monster
.
I
sCode
(
CardId
.
GraydleSlimeJr
)
)
{
AI
.
SelectCard
(
monster
);
return
true
;
...
...
@@ -348,7 +348,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
monster
in
hands
)
{
if
(
monster
.
I
d
==
CardId
.
DupeFrog
)
if
(
monster
.
I
sCode
(
CardId
.
DupeFrog
)
)
{
AI
.
SelectCard
(
monster
);
return
true
;
...
...
@@ -357,7 +357,7 @@ namespace WindBot.Game.AI.Decks
}
foreach
(
ClientCard
monster
in
hands
)
{
if
(
monster
.
I
d
==
CardId
.
Ronintoadin
||
monster
.
Id
==
CardId
.
DupeFrog
)
if
(
monster
.
I
sCode
(
CardId
.
Ronintoadin
,
CardId
.
DupeFrog
)
)
{
AI
.
SelectCard
(
monster
);
return
true
;
...
...
@@ -442,7 +442,7 @@ namespace WindBot.Game.AI.Decks
List
<
ClientCard
>
monsters
=
Bot
.
GetMonsters
();
foreach
(
ClientCard
monster
in
monsters
)
{
if
(
monster
.
I
d
==
CardId
.
ToadallyAwesome
&&
monster
.
Attack
<=
2200
)
if
(
monster
.
I
sCode
(
CardId
.
ToadallyAwesome
)
&&
monster
.
Attack
<=
2200
)
{
SelectXYZDetach
(
Card
.
Overlays
);
AI
.
SelectNextCard
(
monster
);
...
...
@@ -451,7 +451,7 @@ namespace WindBot.Game.AI.Decks
}
foreach
(
ClientCard
monster
in
monsters
)
{
if
(
monster
.
I
d
==
CardId
.
SkyCavalryCentaurea
&&
monster
.
Attack
<=
2000
)
if
(
monster
.
I
sCode
(
CardId
.
SkyCavalryCentaurea
)
&&
monster
.
Attack
<=
2000
)
{
SelectXYZDetach
(
Card
.
Overlays
);
AI
.
SelectNextCard
(
monster
);
...
...
@@ -460,7 +460,7 @@ namespace WindBot.Game.AI.Decks
}
foreach
(
ClientCard
monster
in
monsters
)
{
if
(
monster
.
I
d
==
CardId
.
DaigustoPhoenix
&&
monster
.
Attack
<=
1500
)
if
(
monster
.
I
sCode
(
CardId
.
DaigustoPhoenix
)
&&
monster
.
Attack
<=
1500
)
{
SelectXYZDetach
(
Card
.
Overlays
);
AI
.
SelectNextCard
(
monster
);
...
...
Game/AI/Decks/TrickstarExecutor.cs
View file @
43086945
...
...
@@ -217,14 +217,14 @@ namespace WindBot.Game.AI.Decks
public
bool
SpellSet
()
{
if
(
Card
.
I
d
==
CardId
.
Sheep
&&
Bot
.
HasInSpellZone
(
CardId
.
Sheep
))
return
false
;
if
(
Card
.
I
sCode
(
CardId
.
Sheep
)
&&
Bot
.
HasInSpellZone
(
CardId
.
Sheep
))
return
false
;
if
(
DefaultSpellSet
())
{
AI
.
SelectPlace
(
SelectSTPlace
());
return
true
;
}
else
if
(
Enemy
.
HasInSpellZone
(
58921041
,
true
)
||
Bot
.
HasInSpellZone
(
58921041
,
true
))
{
if
(
Card
.
I
d
==
CardId
.
Stage
)
return
!
Bot
.
HasInSpellZone
(
CardId
.
Stage
);
if
(
Card
.
I
sCode
(
CardId
.
Stage
)
)
return
!
Bot
.
HasInSpellZone
(
CardId
.
Stage
);
if
(
Card
.
IsSpell
())
{
AI
.
SelectPlace
(
SelectSTPlace
());
...
...
@@ -244,7 +244,7 @@ namespace WindBot.Game.AI.Decks
if
(
Card
.
HasPosition
(
CardPosition
.
FaceDown
)
&&
Card
.
HasType
(
CardType
.
Field
)
&&
Card
.
Location
==
CardLocation
.
SpellZone
)
{
// field spells that forbid other fields' activate
return
(
Card
.
Id
!=
71650854
&&
Card
.
Id
!=
78082039
);
return
!
Card
.
IsCode
(
71650854
,
78082039
);
}
return
false
;
}
...
...
@@ -337,7 +337,7 @@ namespace WindBot.Game.AI.Decks
bool
has_skystriker
=
false
;
foreach
(
ClientCard
card
in
Enemy
.
Graveyard
)
{
if
(
card
!=
null
&&
SkyStrike_list
.
Contains
(
card
.
Id
))
if
(
card
!=
null
&&
card
.
IsCode
(
SkyStrike_list
))
{
has_skystriker
=
true
;
break
;
...
...
@@ -347,7 +347,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
card
in
Enemy
.
GetSpells
())
{
if
(
card
!=
null
&&
SkyStrike_list
.
Contains
(
card
.
Id
))
if
(
card
!=
null
&&
card
.
IsCode
(
SkyStrike_list
))
{
has_skystriker
=
true
;
break
;
...
...
@@ -358,7 +358,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
card
in
Enemy
.
GetSpells
())
{
if
(
card
!=
null
&&
SkyStrike_list
.
Contains
(
card
.
Id
))
if
(
card
!=
null
&&
card
.
IsCode
(
SkyStrike_list
))
{
has_skystriker
=
true
;
break
;
...
...
@@ -536,7 +536,7 @@ namespace WindBot.Game.AI.Decks
List
<
ClientCard
>
grave
=
Bot
.
GetGraveyardSpells
();
foreach
(
ClientCard
self_card
in
grave
)
{
if
(
self_card
.
I
d
==
CardId
.
Galaxy
)
if
(
self_card
.
I
sCode
(
CardId
.
Galaxy
)
)
return
false
;
}
AI
.
SelectPlace
(
SelectSTPlace
());
...
...
@@ -554,7 +554,7 @@ namespace WindBot.Game.AI.Decks
if
(!
spell_trap_activate
())
return
false
;
if
(
Duel
.
Player
==
0
)
return
false
;
if
(
Duel
.
Phase
==
DuelPhase
.
End
)
return
true
;
if
(
Duel
.
LastChainPlayer
==
1
&&
(
AI
.
Utils
.
IsChainTarget
(
Card
)
||
(
AI
.
Utils
.
GetLastChainCard
().
I
d
==
CardId
.
Feather
&&
!
Bot
.
HasInSpellZone
(
CardId
.
Awaken
))))
return
true
;
if
(
Duel
.
LastChainPlayer
==
1
&&
(
AI
.
Utils
.
IsChainTarget
(
Card
)
||
(
AI
.
Utils
.
GetLastChainCard
().
I
sCode
(
CardId
.
Feather
)
&&
!
Bot
.
HasInSpellZone
(
CardId
.
Awaken
))))
return
true
;
if
(
Duel
.
Phase
>
DuelPhase
.
Main1
&&
Duel
.
Phase
<
DuelPhase
.
Main2
)
{
int
total_atk
=
0
;
...
...
@@ -704,8 +704,8 @@ namespace WindBot.Game.AI.Decks
public
bool
Hand_act_eff
()
{
if
(
GraveCall_count
>
0
&&
GraveCall_id
==
Card
.
Id
)
return
false
;
if
(
Card
.
I
d
==
CardId
.
Urara
&&
Bot
.
HasInHand
(
CardId
.
LockBird
)
&&
Bot
.
HasInSpellZone
(
CardId
.
Re
))
return
false
;
if
(
Card
.
I
d
==
CardId
.
Ghost
&&
Card
.
Location
==
CardLocation
.
Hand
&&
Bot
.
HasInMonstersZone
(
CardId
.
Ghost
))
return
false
;
if
(
Card
.
I
sCode
(
CardId
.
Urara
)
&&
Bot
.
HasInHand
(
CardId
.
LockBird
)
&&
Bot
.
HasInSpellZone
(
CardId
.
Re
))
return
false
;
if
(
Card
.
I
sCode
(
CardId
.
Ghost
)
&&
Card
.
Location
==
CardLocation
.
Hand
&&
Bot
.
HasInMonstersZone
(
CardId
.
Ghost
))
return
false
;
return
(
Duel
.
LastChainPlayer
==
1
);
}
...
...
@@ -772,11 +772,11 @@ namespace WindBot.Game.AI.Decks
if
(
AI
.
Utils
.
IsTurn1OrMain2
())
return
false
;
AI
.
SelectPosition
(
CardPosition
.
FaceUpAttack
);
IList
<
ClientCard
>
targets
=
new
List
<
ClientCard
>();
if
(
Bot
.
SpellZone
[
5
]
!=
null
&&
Bot
.
SpellZone
[
5
].
Id
!=
CardId
.
Stage
)
if
(
Bot
.
SpellZone
[
5
]
!=
null
&&
!
Bot
.
SpellZone
[
5
].
IsCode
(
CardId
.
Stage
)
)
{
targets
.
Add
(
Bot
.
SpellZone
[
5
]);
}
if
(
Bot
.
SpellZone
[
5
]
!=
null
&&
Bot
.
SpellZone
[
5
].
I
d
==
CardId
.
Stage
&&
Bot
.
HasInHand
(
CardId
.
Stage
))
if
(
Bot
.
SpellZone
[
5
]
!=
null
&&
Bot
.
SpellZone
[
5
].
I
sCode
(
CardId
.
Stage
)
&&
Bot
.
HasInHand
(
CardId
.
Stage
))
{
targets
.
Add
(
Bot
.
SpellZone
[
5
]);
}
...
...
@@ -835,7 +835,7 @@ namespace WindBot.Game.AI.Decks
{
if
(
red_ss_count
>=
6
)
return
false
;
if
((
AI
.
Utils
.
ChainContainsCard
(
CardId
.
DarkHole
)
||
AI
.
Utils
.
ChainContainsCard
(
99330325
)
||
AI
.
Utils
.
ChainContainsCard
(
53582587
))
&&
AI
.
Utils
.
ChainContainsCard
(
CardId
.
Red
))
return
false
;
if
(
Duel
.
LastChainPlayer
==
0
&&
AI
.
Utils
.
GetLastChainCard
().
I
d
==
CardId
.
Red
)
if
(
Duel
.
LastChainPlayer
==
0
&&
AI
.
Utils
.
GetLastChainCard
().
I
sCode
(
CardId
.
Red
)
)
{
foreach
(
ClientCard
m
in
Bot
.
GetMonsters
())
{
...
...
@@ -858,7 +858,7 @@ namespace WindBot.Game.AI.Decks
ClientCard
tosolve_enemy
=
AI
.
Utils
.
GetOneEnemyBetterThanMyBest
();
foreach
(
ClientCard
c
in
self_m
)
{
if
(
IsTrickstar
(
c
.
Id
)
&&
c
.
Id
!=
CardId
.
Red
)
if
(
IsTrickstar
(
c
.
Id
)
&&
!
c
.
IsCode
(
CardId
.
Red
)
)
{
if
(
c
.
Attacked
)
{
...
...
@@ -867,7 +867,7 @@ namespace WindBot.Game.AI.Decks
red_ss_count
+=
1
;
return
true
;
}
if
(
c
.
I
d
==
CardId
.
Pink
)
return
false
;
if
(
c
.
I
sCode
(
CardId
.
Pink
)
)
return
false
;
if
(
tosolve_enemy
!=
null
)
{
if
(
Bot
.
HasInHand
(
CardId
.
White
)
&&
c
.
Attack
+
c
.
BaseAttack
<
tosolve_enemy
.
Attack
)
...
...
@@ -878,7 +878,7 @@ namespace WindBot.Game.AI.Decks
red_ss_count
+=
1
;
return
true
;
}
if
(!
Bot
.
HasInHand
(
CardId
.
White
)
&&
tosolve_enemy
.
Attack
<=
3200
&&
c
.
I
d
==
CardId
.
White
)
if
(!
Bot
.
HasInHand
(
CardId
.
White
)
&&
tosolve_enemy
.
Attack
<=
3200
&&
c
.
I
sCode
(
CardId
.
White
)
)
{
AI
.
SelectCard
(
c
);
Red_SelectPos
(
c
);
...
...
@@ -916,7 +916,7 @@ namespace WindBot.Game.AI.Decks
self_monster
.
Sort
(
AIFunctions
.
CompareDefensePower
);
foreach
(
ClientCard
card
in
self_monster
)
{
if
(
IsTrickstar
(
card
.
Id
)
&&
card
.
Id
!=
CardId
.
Red
)
if
(
IsTrickstar
(
card
.
Id
)
&&
!
card
.
IsCode
(
CardId
.
Red
)
)
{
AI
.
SelectCard
(
card
);
Red_SelectPos
(
card
);
...
...
@@ -1211,7 +1211,7 @@ namespace WindBot.Game.AI.Decks
if
(
hand
.
IsMonster
()
&&
IsTrickstar
(
hand
.
Id
))
{
if
(
hand
.
Attack
>=
Enemy
.
LifePoints
)
return
true
;
if
(
hand
.
Id
!=
CardId
.
Yellow
)
if
(
!
hand
.
IsCode
(
CardId
.
Yellow
)
)
{
if
(
AI
.
Utils
.
GetOneEnemyBetterThanValue
(
hand
.
Attack
,
false
)
==
null
)
return
true
;
}
...
...
@@ -1296,7 +1296,7 @@ namespace WindBot.Game.AI.Decks
public
bool
Tuner_ns
()
{
if
((
Card
.
I
d
==
CardId
.
Tuner
&&
Bot
.
HasInExtra
(
CardId
.
Crystal
)
&&
!
tuner_eff_used
)
||
Tuner_ss
())
if
((
Card
.
I
sCode
(
CardId
.
Tuner
)
&&
Bot
.
HasInExtra
(
CardId
.
Crystal
)
&&
!
tuner_eff_used
)
||
Tuner_ss
())
{
NormalSummoned
=
true
;
return
true
;
...
...
@@ -1308,17 +1308,17 @@ namespace WindBot.Game.AI.Decks
{
if
(
crystal_eff_used
||
Bot
.
HasInMonstersZone
(
CardId
.
Crystal
))
return
false
;
if
(
Bot
.
GetMonsterCount
()
==
0
||
!
Bot
.
HasInExtra
(
CardId
.
Crystal
))
return
false
;
if
(
Card
.
I
d
==
CardId
.
Ghost
&&
Bot
.
GetRemainingCount
(
CardId
.
Ghost
,
2
)
<=
0
)
return
false
;
if
(
Card
.
I
sCode
(
CardId
.
Ghost
)
&&
Bot
.
GetRemainingCount
(
CardId
.
Ghost
,
2
)
<=
0
)
return
false
;
int
count
=
0
;
if
(
Card
.
Id
!=
CardId
.
Urara
)
count
+=
1
;
if
(
!
Card
.
IsCode
(
CardId
.
Urara
)
)
count
+=
1
;
foreach
(
ClientCard
hand
in
Bot
.
Hand
)
{
if
(
hand
.
I
d
==
Card
.
Id
)
count
+=
1
;
if
(
hand
.
I
sCode
(
Card
.
Id
)
)
count
+=
1
;
}
if
(
count
<
2
)
return
false
;
foreach
(
ClientCard
m
in
Bot
.
GetMonsters
())
{
if
(
m
.
Id
!=
CardId
.
Eater
&&
getLinkMarker
(
m
.
Id
)
<=
2
)
return
true
;
if
(
!
m
.
IsCode
(
CardId
.
Eater
)
&&
getLinkMarker
(
m
.
Id
)
<=
2
)
return
true
;
}
return
false
;
}
...
...
@@ -1332,7 +1332,7 @@ namespace WindBot.Game.AI.Decks
public
bool
Ring_act
()
{
if
(
Duel
.
LastChainPlayer
==
0
&&
AI
.
Utils
.
GetLastChainCard
()
!=
null
&&
AI
.
Utils
.
GetLastChainCard
().
I
d
==
CardId
.
Ghost
)
return
false
;
if
(
Duel
.
LastChainPlayer
==
0
&&
AI
.
Utils
.
GetLastChainCard
()
!=
null
&&
AI
.
Utils
.
GetLastChainCard
().
I
sCode
(
CardId
.
Ghost
)
)
return
false
;
if
(!
spell_trap_activate
())
return
false
;
ClientCard
target
=
AI
.
Utils
.
GetProblematicEnemyMonster
();
if
(
target
==
null
&&
AI
.
Utils
.
IsChainTarget
(
Card
))
...
...
@@ -1352,7 +1352,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
c
in
Bot
.
GetMonsters
())
{
if
(
c
.
Id
!=
CardId
.
Eater
&&
c
.
Level
==
1
&&
c
.
Id
!=
CardId
.
Linkuri
&&
c
.
Id
!=
CardId
.
Linkspi
)
if
(
!
c
.
IsCode
(
CardId
.
Eater
,
CardId
.
Linkuri
,
CardId
.
Linkspi
)
&&
c
.
Level
==
1
)
{
AI
.
SelectCard
(
c
);
return
true
;
...
...
@@ -1363,7 +1363,7 @@ namespace WindBot.Game.AI.Decks
public
bool
Linkuri_eff
()
{
if
(
Duel
.
LastChainPlayer
==
0
&&
AI
.
Utils
.
GetLastChainCard
().
I
d
==
CardId
.
Linkuri
)
return
false
;
if
(
Duel
.
LastChainPlayer
==
0
&&
AI
.
Utils
.
GetLastChainCard
().
I
sCode
(
CardId
.
Linkuri
)
)
return
false
;
AI
.
SelectCard
(
new
[]
{
CardId
.
Tuner
,
CardId
.
BF
+
1
});
return
true
;
}
...
...
@@ -1387,7 +1387,7 @@ namespace WindBot.Game.AI.Decks
foreach
(
ClientCard
t_check
in
Bot
.
GetMonsters
())
{
if
(
t_check
.
IsFacedown
())
continue
;
if
(
t_check
.
I
d
==
CardId
.
BF
||
t_check
.
Id
==
CardId
.
Tuner
||
t_check
.
Id
==
CardId
.
Urara
||
t_check
.
Id
==
CardId
.
Ghost
)
if
(
t_check
.
I
sCode
(
CardId
.
BF
,
CardId
.
Tuner
,
CardId
.
Urara
,
CardId
.
Ghost
)
)
{
targets
.
Add
(
t_check
);
break
;
...
...
@@ -1399,7 +1399,7 @@ namespace WindBot.Game.AI.Decks
foreach
(
ClientCard
e_check
in
m_list
)
{
if
(
e_check
.
IsFacedown
())
continue
;
if
(
targets
[
0
]
!=
e_check
&&
getLinkMarker
(
e_check
.
Id
)
<=
2
&&
e_check
.
Id
!=
CardId
.
Eater
&&
e_check
.
Id
!=
CardId
.
Crystal
)
if
(
targets
[
0
]
!=
e_check
&&
getLinkMarker
(
e_check
.
Id
)
<=
2
&&
!
e_check
.
IsCode
(
CardId
.
Eater
,
CardId
.
Crystal
)
)
{
targets
.
Add
(
e_check
);
break
;
...
...
@@ -1483,7 +1483,7 @@ namespace WindBot.Game.AI.Decks
IList
<
ClientCard
>
targets
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
s_m
in
Bot
.
GetMonsters
())
{
if
(
s_m
.
I
d
==
CardId
.
Eater
)
continue
;
if
(
s_m
.
I
sCode
(
CardId
.
Eater
)
)
continue
;
if
(
s_m
!=
Bot
.
MonsterZone
[
5
]
&&
s_m
!=
Bot
.
MonsterZone
[
6
])
targets
.
Add
(
s_m
);
if
(
targets
.
Count
==
2
)
break
;
}
...
...
@@ -1525,7 +1525,7 @@ namespace WindBot.Game.AI.Decks
foreach
(
ClientCard
s_m
in
main_list
)
{
if
(
s_m
.
IsFacedown
())
continue
;
if
((
s_m
.
Id
!=
CardId
.
Eater
||
(
s_m
.
Id
==
CardId
.
Eater
&&
s_m
.
IsDisabled
()))
&&
!
targets
.
ContainsCardWithId
(
s_m
.
Id
))
if
((
!
s_m
.
IsCode
(
CardId
.
Eater
)
||
(
s_m
.
IsCode
(
CardId
.
Eater
)
&&
s_m
.
IsDisabled
()))
&&
!
targets
.
ContainsCardWithId
(
s_m
.
Id
))
{
targets
.
Add
(
s_m
);
};
...
...
@@ -1536,7 +1536,7 @@ namespace WindBot.Game.AI.Decks
foreach
(
ClientCard
s_m
in
Bot
.
GetMonstersInExtraZone
())
{
if
(
s_m
.
IsFacedown
())
continue
;
if
(
s_m
.
Id
!=
CardId
.
Eater
&&
!
targets
.
ContainsCardWithId
(
s_m
.
Id
))
if
(
!
s_m
.
IsCode
(
CardId
.
Eater
)
&&
!
targets
.
ContainsCardWithId
(
s_m
.
Id
))
{
targets
.
Add
(
s_m
);
};
...
...
@@ -1604,7 +1604,7 @@ namespace WindBot.Game.AI.Decks
sort_list
.
Sort
(
AIFunctions
.
CompareCardAttack
);
foreach
(
ClientCard
s_m
in
sort_list
)
{
if
((
s_m
.
Id
!=
CardId
.
Eater
||
(
s_m
.
Id
==
CardId
.
Eater
&&
m
.
IsMonsterHasPreventActivationEffectInBattle
()))
&&
getLinkMarker
(
s_m
.
Id
)
<=
2
&&
s_m
.
IsFaceup
())
if
((
!
s_m
.
IsCode
(
CardId
.
Eater
)
||
(
s_m
.
IsCode
(
CardId
.
Eater
)
&&
m
.
IsMonsterHasPreventActivationEffectInBattle
()))
&&
getLinkMarker
(
s_m
.
Id
)
<=
2
&&
s_m
.
IsFaceup
())
{
if
(!
targets
.
ContainsCardWithId
(
s_m
.
Id
))
{
...
...
@@ -1693,12 +1693,12 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
hand
in
Bot
.
Hand
)
{
if
(
hand
.
I
d
==
CardId
.
Red
||
hand
.
Id
==
CardId
.
Pink
)
if
(
hand
.
I
sCode
(
CardId
.
Red
,
CardId
.
Pink
)
)
{
AI
.
SelectCard
(
hand
);
return
true
;
}
if
(
hand
.
I
d
==
CardId
.
Urara
||
hand
.
Id
==
CardId
.
Ghost
)
if
(
hand
.
I
sCode
(
CardId
.
Urara
,
CardId
.
Ghost
)
)
{
if
(
Tuner_ss
())
{
...
...
@@ -1770,7 +1770,7 @@ namespace WindBot.Game.AI.Decks
{
already_link2
=
true
;
material_list
.
Add
(
m
);
}
else
if
(
m
.
Id
!=
CardId
.
Sheep
+
1
&&
(
m
.
Id
!=
CardId
.
Eater
))
}
else
if
(
!
m
.
IsCode
(
CardId
.
Sheep
+
1
,
CardId
.
Eater
))
{
material_list
.
Add
(
m
);
}
...
...
@@ -1876,14 +1876,14 @@ namespace WindBot.Game.AI.Decks
public
bool
MonsterRepos
()
{
if
(
Card
.
I
d
==
CardId
.
Eater
)
return
(!
Card
.
HasPosition
(
CardPosition
.
Attack
));
if
(
Card
.
I
sCode
(
CardId
.
Eater
)
)
return
(!
Card
.
HasPosition
(
CardPosition
.
Attack
));
if
(
IsTrickstar
(
Card
.
Id
)
&&
!
white_eff_used
&&
Bot
.
HasInHand
(
CardId
.
White
)
&&
Card
.
IsAttack
()
&&
Duel
.
Phase
==
DuelPhase
.
Main1
)
return
false
;
if
(
Card
.
IsFaceup
()
&&
Card
.
IsDefense
()
&&
Card
.
Attack
==
0
)
return
false
;
if
(
Card
.
I
d
==
CardId
.
Pink
)
if
(
Card
.
I
sCode
(
CardId
.
Pink
)
)
{
if
((
Bot
.
HasInSpellZone
(
CardId
.
Stage
,
true
)
&&
Enemy
.
LifePoints
<=
1000
)
||
(!
Bot
.
HasInSpellZone
(
CardId
.
Stage
,
true
)
&&
Enemy
.
LifePoints
<=
800
))
{
...
...
@@ -1944,8 +1944,8 @@ namespace WindBot.Game.AI.Decks
if
(!
defender
.
IsMonsterHasPreventActivationEffectInBattle
()
&&
!
attacker
.
IsDisabled
())
{
if
((
attacker
.
I
d
==
CardId
.
Eater
&&
!
defender
.
HasType
(
CardType
.
Token
))
||
attacker
.
Id
==
CardId
.
Borrel
)
return
AI
.
Attack
(
attacker
,
defender
);
if
((
attacker
.
I
d
==
CardId
.
Ultimate
||
attacker
.
Id
==
CardId
.
Cardian
)
&&
attacker
.
RealPower
>
defender
.
RealPower
)
return
AI
.
Attack
(
attacker
,
defender
);
if
((
attacker
.
I
sCode
(
CardId
.
Eater
)
&&
!
defender
.
HasType
(
CardType
.
Token
))
||
attacker
.
IsCode
(
CardId
.
Borrel
)
)
return
AI
.
Attack
(
attacker
,
defender
);
if
((
attacker
.
I
sCode
(
CardId
.
Ultimate
,
CardId
.
Cardian
)
)
&&
attacker
.
RealPower
>
defender
.
RealPower
)
return
AI
.
Attack
(
attacker
,
defender
);
}
if
(!
OnPreBattleBetween
(
attacker
,
defender
))
...
...
@@ -1966,7 +1966,7 @@ namespace WindBot.Game.AI.Decks
for
(
int
i
=
0
;
i
<
attackers
.
Count
;
++
i
)
{
ClientCard
attacker
=
attackers
[
i
];
if
(
attacker
.
I
d
==
CardId
.
Borrel
||
attacker
.
Id
==
CardId
.
Eater
)
return
attacker
;
if
(
attacker
.
I
sCode
(
CardId
.
Borrel
,
CardId
.
Eater
)
)
return
attacker
;
}
return
null
;
}
...
...
Game/AI/Decks/YosenjuExecutor.cs
View file @
43086945
...
...
@@ -163,7 +163,7 @@ namespace WindBot.Game.AI.Decks
if
(
Card
==
null
)
return
true
;
// Logger.DebugWriteLine(Card.Name);
if
(
Card
.
I
d
==
CardId
.
YosenjuKama2
)
if
(
Card
.
I
sCode
(
CardId
.
YosenjuKama2
)
)
return
Card
.
ShouldDirectAttack
;
else
return
true
;
...
...
@@ -181,10 +181,8 @@ namespace WindBot.Game.AI.Decks
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
;
IList
<
ClientCard
>
result
=
AI
.
Utils
.
SelectPreferredCards
(
CardId
.
YosenjuTsujik
,
cards
,
min
,
max
);
return
AI
.
Utils
.
CheckSelectCount
(
result
,
cards
,
min
,
max
);
}
private
bool
PotOfDualityEffect
()
...
...
@@ -243,7 +241,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
card
in
Bot
.
Hand
.
GetMonsters
())
{
if
(!
card
.
Equals
(
Card
)
&&
card
.
I
d
==
Card
.
Id
)
if
(!
card
.
Equals
(
Card
)
&&
card
.
I
sCode
(
Card
.
Id
)
)
return
true
;
}
return
false
;
...
...
@@ -253,7 +251,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
card
in
Bot
.
GetSpells
())
{
if
(
card
.
I
d
==
Card
.
Id
)
if
(
card
.
I
sCode
(
Card
.
Id
)
)
return
false
;
}
return
TrapSetWhenZoneFree
();
...
...
Game/AI/Decks/ZexalWeaponsExecutor.cs
View file @
43086945
using
System.Collections.Generic
;
using
System
;
using
System.Collections.Generic
;
using
WindBot
;
using
WindBot.Game
;
using
WindBot.Game.AI
;
...
...
@@ -103,7 +104,7 @@ namespace WindBot.Game.AI.Decks
// Summons: Effects
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Goblindbergh
,
GoblindberghEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
TinGoldfish
,
GoblindberghEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Kagetokage
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Kagetokage
,
KagetokageEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
SummonerMonk
,
SummonerMonkEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Honest
,
DefaultHonestEffect
);
...
...
@@ -138,14 +139,12 @@ namespace WindBot.Game.AI.Decks
public
override
IList
<
ClientCard
>
OnSelectXyzMaterial
(
IList
<
ClientCard
>
cards
,
int
min
,
int
max
)
{
IList
<
ClientCard
>
result
=
new
List
<
ClientCard
>();
AI
.
Utils
.
SelectPreferredCards
(
result
,
new
[]
{
IList
<
ClientCard
>
result
=
AI
.
Utils
.
SelectPreferredCards
(
new
[]
{
CardId
.
StarDrawing
,
CardId
.
SolarWindJammer
,
CardId
.
Goblindbergh
},
cards
,
min
,
max
);
AI
.
Utils
.
CheckSelectCount
(
result
,
cards
,
min
,
max
);
return
result
;
return
AI
.
Utils
.
CheckSelectCount
(
result
,
cards
,
min
,
max
);
}
private
bool
Number39Utopia
()
...
...
@@ -235,6 +234,13 @@ namespace WindBot.Game.AI.Decks
return
true
;
}
private
bool
KagetokageEffect
()
{
var
lastChainCard
=
AI
.
Utils
.
GetLastChainCard
();
if
(
lastChainCard
==
null
)
return
true
;
return
!
lastChainCard
.
IsCode
(
CardId
.
Goblindbergh
,
CardId
.
TinGoldfish
);
}
private
bool
SummonerMonkEffect
()
{
IList
<
int
>
costs
=
new
[]
...
...
@@ -273,7 +279,7 @@ namespace WindBot.Game.AI.Decks
private
bool
MonsterRepos
()
{
if
(
Card
.
I
d
==
CardId
.
NumberS39UtopiatheLightning
&&
Card
.
IsAttack
())
if
(
Card
.
I
sCode
(
CardId
.
NumberS39UtopiatheLightning
)
&&
Card
.
IsAttack
())
return
false
;
return
base
.
DefaultMonsterRepos
();
}
...
...
Game/AI/Decks/ZoodiacExecutor.cs
View file @
43086945
...
...
@@ -230,14 +230,14 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
card
in
Enemy
.
Graveyard
)
{
if
(
card
.
I
d
==
CardId
.
AleisterTheInvoker
)
if
(
card
.
I
sCode
(
CardId
.
AleisterTheInvoker
)
)
{
return
card
;
}
}
foreach
(
ClientCard
card
in
Bot
.
Graveyard
)
{
if
(
card
.
I
d
==
CardId
.
AleisterTheInvoker
)
if
(
card
.
I
sCode
(
CardId
.
AleisterTheInvoker
)
)
{
return
card
;
}
...
...
@@ -445,7 +445,7 @@ namespace WindBot.Game.AI.Decks
List
<
ClientCard
>
monsters
=
Bot
.
GetMonsters
();
foreach
(
ClientCard
monster
in
monsters
)
{
if
(
monster
.
IsFaceup
()
&&
monster
.
I
d
==
CardId
.
Drident
&&
!
monster
.
HasXyzMaterial
())
if
(
monster
.
IsFaceup
()
&&
monster
.
I
sCode
(
CardId
.
Drident
)
&&
!
monster
.
HasXyzMaterial
())
{
target
=
monster
;
break
;
...
...
@@ -455,7 +455,7 @@ namespace WindBot.Game.AI.Decks
{
foreach (ClientCard monster in monsters)
{
if (monster.IsFaceup() && monster.Type == (int)CardType.Xyz &&
monster.Id != CardId.DaigustoEmeral
&& !monster.HasXyzMaterial())
if (monster.IsFaceup() && monster.Type == (int)CardType.Xyz &&
!monster.IsCode(CardId.DaigustoEmeral)
&& !monster.HasXyzMaterial())
{
target = monster;
break;
...
...
@@ -550,7 +550,7 @@ namespace WindBot.Game.AI.Decks
{
foreach
(
ClientCard
spell
in
Bot
.
GetSpells
())
{
if
(
spell
.
I
d
==
CardId
.
ZoodiacBarrage
&&
!
Card
.
Equals
(
spell
))
if
(
spell
.
I
sCode
(
CardId
.
ZoodiacBarrage
)
&&
!
Card
.
Equals
(
spell
))
return
false
;
}
AI
.
SelectCard
(
new
[]
...
...
@@ -604,7 +604,7 @@ namespace WindBot.Game.AI.Decks
private
bool
MonsterRepos
()
{
if
(
Card
.
I
d
==
CardId
.
NumberS39UtopiatheLightning
&&
Card
.
IsAttack
())
if
(
Card
.
I
sCode
(
CardId
.
NumberS39UtopiatheLightning
)
&&
Card
.
IsAttack
())
return
false
;
return
base
.
DefaultMonsterRepos
();
}
...
...
Game/AI/DefaultExecutor.cs
View file @
43086945
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
YGOSharp.OCGWrapper.Enums
;
using
WindBot
;
using
WindBot.Game
;
...
...
@@ -21,10 +22,15 @@ namespace WindBot.Game.AI
public
const
int
SuperAntiKaijuWarMachineMechaDogoran
=
84769941
;
public
const
int
UltimateConductorTytanno
=
18940556
;
public
const
int
ElShaddollConstruct
=
20366274
;
public
const
int
AllyOfJusticeCatastor
=
26593852
;
public
const
int
DupeFrog
=
46239604
;
public
const
int
MaraudingCaptain
=
2460565
;
public
const
int
BlackRoseDragon
=
73580471
;
public
const
int
JudgmentDragon
=
57774843
;
public
const
int
TopologicTrisbaena
=
72529749
;
public
const
int
EvilswarmExcitonKnight
=
46772449
;
public
const
int
HarpiesFeatherDuster
=
18144506
;
public
const
int
DarkMagicAttack
=
2314238
;
...
...
@@ -39,7 +45,9 @@ namespace WindBot.Game.AI
public
const
int
UltimayaTzolkin
=
1686814
;
public
const
int
MoonMirrorShield
=
19508728
;
public
const
int
VampireFr
ä
ulein
=
6039967
;
public
const
int
PhantomKnightsFogBlade
=
25542642
;
public
const
int
VampireFraeulein
=
6039967
;
public
const
int
InjectionFairyLily
=
79575620
;
public
const
int
BlueEyesChaosMAXDragon
=
55410871
;
...
...
@@ -55,17 +63,23 @@ namespace WindBot.Game.AI
public
const
int
GalaxySoldier
=
46659709
;
public
const
int
MacroCosmos
=
30241314
;
public
const
int
UpstartGoblin
=
70368879
;
public
const
int
CyberEmergency
=
60600126
;
public
const
int
EaterOfMillions
=
63845230
;
public
const
int
InvokedPurgatrio
=
12307878
;
public
const
int
ChaosAncientGearGiant
=
51788412
;
public
const
int
UltimateAncientGearGolem
=
12652643
;
public
const
int
RedDragonArchfiend
=
70902743
;
public
const
int
ImperialOrder
=
61740673
;
public
const
int
NaturiaBeast
=
33198837
;
public
const
int
AntiSpellFragrance
=
58921041
;
}
int
HonestEffectCount
=
0
;
protected
DefaultExecutor
(
GameAI
ai
,
Duel
duel
)
:
base
(
ai
,
duel
)
{
...
...
@@ -80,10 +94,8 @@ namespace WindBot.Game.AI
/// <returns>BattlePhaseAction including the target, or null (in this situation, GameAI will check the next attacker)</returns>
public
override
BattlePhaseAction
OnSelectAttackTarget
(
ClientCard
attacker
,
IList
<
ClientCard
>
defenders
)
{
for
(
int
i
=
0
;
i
<
defenders
.
Count
;
++
i
)
for
each
(
ClientCard
defender
in
defenders
)
{
ClientCard
defender
=
defenders
[
i
];
attacker
.
RealPower
=
attacker
.
Attack
;
defender
.
RealPower
=
defender
.
GetDefensePower
();
if
(!
OnPreBattleBetween
(
attacker
,
defender
))
...
...
@@ -118,63 +130,66 @@ namespace WindBot.Game.AI
if
(
defender
.
IsMonsterDangerous
())
{
bool
canignoreit
=
false
;
if
(
attacker
.
Id
==
_CardId
.
UltimateConductorTytanno
&&
!
attacker
.
IsDisabled
()
&&
defender
.
IsDefense
())
canignoreit
=
true
;
if
(!
canignoreit
)
bool
canIgnoreIt
=
!
attacker
.
IsDisabled
()
&&
(
attacker
.
IsCode
(
_CardId
.
UltimateConductorTytanno
)
&&
defender
.
IsDefense
()
||
attacker
.
IsCode
(
_CardId
.
ElShaddollConstruct
)
&&
defender
.
IsSpecialSummoned
||
attacker
.
IsCode
(
_CardId
.
AllyOfJusticeCatastor
)
&&
!
defender
.
HasAttribute
(
CardAttribute
.
Dark
));
if
(!
canIgnoreIt
)
return
false
;
}
foreach
(
ClientCard
equip
in
defender
.
EquipCards
)
{
if
(
equip
.
I
d
==
_CardId
.
MoonMirrorShield
&&
!
equip
.
IsDisabled
())
if
(
equip
.
I
sCode
(
_CardId
.
MoonMirrorShield
)
&&
!
equip
.
IsDisabled
())
{
return
false
;
}
}
if
(
defender
.
Id
==
_CardId
.
CrystalWingSynchroDragon
&&
defender
.
IsAttack
()
&&
!
defender
.
IsDisabled
()
&&
attacker
.
Level
>=
5
)
if
(!
defender
.
IsDisabled
())
{
if
(
defender
.
IsCode
(
_CardId
.
CrystalWingSynchroDragon
)
&&
defender
.
IsAttack
()
&&
attacker
.
Level
>=
5
)
return
false
;
if
(
defender
.
Id
==
_CardId
.
NumberS39UtopiaTheLightning
&&
defender
.
IsAttack
()
&&
!
defender
.
IsDisabled
()
&&
defender
.
HasXyzMaterial
(
2
,
_CardId
.
Number39Utopia
))
if
(
defender
.
IsCode
(
_CardId
.
AllyOfJusticeCatastor
)
&&
!
attacker
.
HasAttribute
(
CardAttribute
.
Dark
))
return
false
;
if
(
defender
.
IsCode
(
_CardId
.
NumberS39UtopiaTheLightning
)
&&
defender
.
IsAttack
()
&&
defender
.
HasXyzMaterial
(
2
,
_CardId
.
Number39Utopia
))
defender
.
RealPower
=
5000
;
if
(
defender
.
Id
==
_CardId
.
VampireFr
ä
ulein
&&
!
defender
.
IsDisabled
(
))
if
(
defender
.
IsCode
(
_CardId
.
VampireFraeulein
))
defender
.
RealPower
+=
(
Enemy
.
LifePoints
>
3000
)
?
3000
:
(
Enemy
.
LifePoints
-
100
);
if
(
defender
.
Id
==
_CardId
.
InjectionFairyLily
&&
!
defender
.
IsDisabled
(
)
&&
Enemy
.
LifePoints
>
2000
)
if
(
defender
.
IsCode
(
_CardId
.
InjectionFairyLily
)
&&
Enemy
.
LifePoints
>
2000
)
defender
.
RealPower
+=
3000
;
}
}
if
(!
defender
.
IsMonsterHasPreventActivationEffectInBattle
())
{
if
(
attacker
.
I
d
==
_CardId
.
NumberS39UtopiaTheLightning
&&
!
attacker
.
IsDisabled
()
&&
attacker
.
HasXyzMaterial
(
2
,
_CardId
.
Number39Utopia
))
if
(
attacker
.
I
sCode
(
_CardId
.
NumberS39UtopiaTheLightning
)
&&
!
attacker
.
IsDisabled
()
&&
attacker
.
HasXyzMaterial
(
2
,
_CardId
.
Number39Utopia
))
attacker
.
RealPower
=
5000
;
foreach
(
ClientCard
equip
in
attacker
.
EquipCards
)
{
if
(
equip
.
I
d
==
_CardId
.
MoonMirrorShield
&&
!
equip
.
IsDisabled
())
if
(
equip
.
I
sCode
(
_CardId
.
MoonMirrorShield
)
&&
!
equip
.
IsDisabled
())
{
attacker
.
RealPower
=
defender
.
RealPower
+
100
;
}
}
}
if
(
Enemy
.
HasInMonstersZone
(
_CardId
.
DupeFrog
,
true
)
&&
defender
.
Id
!=
_CardId
.
DupeFrog
)
if
(
Enemy
.
HasInMonstersZone
(
_CardId
.
DupeFrog
,
true
)
&&
!(
defender
).
IsCode
(
_CardId
.
DupeFrog
)
)
return
false
;
if
(
Enemy
.
HasInMonstersZone
(
_CardId
.
MaraudingCaptain
,
true
)
&&
defender
.
Id
!=
_CardId
.
MaraudingCaptain
&&
defender
.
Race
==
(
int
)
CardRace
.
Warrior
)
if
(
Enemy
.
HasInMonstersZone
(
_CardId
.
MaraudingCaptain
,
true
)
&&
!
defender
.
IsCode
(
_CardId
.
MaraudingCaptain
)
&&
defender
.
Race
==
(
int
)
CardRace
.
Warrior
)
return
false
;
if
(
defender
.
Id
==
_CardId
.
UltimayaTzolkin
&&
!
defender
.
IsDisabled
())
{
List
<
ClientCard
>
monsters
=
Enemy
.
GetMonsters
();
foreach
(
ClientCard
monster
in
monsters
)
{
if
(
monster
.
HasType
(
CardType
.
Synchro
))
if
(
defender
.
IsCode
(
_CardId
.
UltimayaTzolkin
)
&&
!
defender
.
IsDisabled
()
&&
Enemy
.
GetMonsters
().
Any
(
monster
=>
!
monster
.
Equals
(
defender
)
&&
monster
.
HasType
(
CardType
.
Synchro
)))
return
false
;
if
(
defender
.
OwnTargets
.
Any
(
card
=>
card
.
IsCode
(
_CardId
.
PhantomKnightsFogBlade
)
&&
!
card
.
IsDisabled
()))
return
false
;
}
}
return
true
;
}
...
...
@@ -211,14 +226,20 @@ namespace WindBot.Game.AI
return
false
;
}
public
override
void
OnNewTurn
()
{
HonestEffectCount
=
0
;
}
/// <summary>
/// Destroy face-down cards first, in our turn.
/// </summary>
protected
bool
DefaultMysticalSpaceTyphoon
()
{
foreach
(
ClientCard
card
in
Duel
.
CurrentChain
)
if
(
card
.
Id
==
_CardId
.
MysticalSpaceTyphoon
)
if
(
Duel
.
CurrentChain
.
Any
(
card
=>
card
.
IsCode
(
_CardId
.
MysticalSpaceTyphoon
))
)
{
return
false
;
}
List
<
ClientCard
>
spells
=
Enemy
.
GetSpells
();
if
(
spells
.
Count
==
0
)
...
...
@@ -228,14 +249,10 @@ namespace WindBot.Game.AI
if
(
selected
==
null
)
{
foreach
(
ClientCard
card
in
spells
)
{
if
(
Duel
.
Player
==
1
&&
!
card
.
HasType
(
CardType
.
Continuous
))
continue
;
selected
=
card
;
if
(
Duel
.
Player
==
0
&&
card
.
IsFacedown
())
break
;
}
if
(
Duel
.
Player
==
0
)
selected
=
spells
.
FirstOrDefault
(
card
=>
card
.
IsFacedown
());
if
(
Duel
.
Player
==
1
)
selected
=
spells
.
FirstOrDefault
(
card
=>
card
.
HasType
(
CardType
.
Continuous
)
||
card
.
HasType
(
CardType
.
Equip
));
}
if
(
selected
==
null
)
...
...
@@ -250,7 +267,7 @@ namespace WindBot.Game.AI
protected
bool
DefaultCosmicCyclone
()
{
foreach
(
ClientCard
card
in
Duel
.
CurrentChain
)
if
(
card
.
I
d
==
_CardId
.
CosmicCyclone
)
if
(
card
.
I
sCode
(
_CardId
.
CosmicCyclone
)
)
return
false
;
return
(
Bot
.
LifePoints
>
1000
)
&&
DefaultMysticalSpaceTyphoon
();
}
...
...
@@ -272,14 +289,7 @@ namespace WindBot.Game.AI
}
else
{
foreach
(
ClientCard
card
in
spells
)
{
if
(
card
.
IsFacedown
())
{
selected
=
card
;
break
;
}
}
selected
=
spells
.
FirstOrDefault
(
card
=>
card
.
IsFacedown
());
}
if
(
selected
==
null
)
...
...
@@ -296,7 +306,7 @@ namespace WindBot.Game.AI
{
if
(
AI
.
Utils
.
IsAllEnemyBetter
(
true
))
{
ClientCard
monster
=
Enemy
.
GetMonsters
().
GetHighestAttackMonster
();
ClientCard
monster
=
Enemy
.
GetMonsters
().
GetHighestAttackMonster
(
true
);
if
(
monster
!=
null
&&
monster
.
HasType
(
CardType
.
Effect
)
&&
!
monster
.
HasType
(
CardType
.
Link
)
&&
(
monster
.
HasType
(
CardType
.
Xyz
)
||
monster
.
Level
>
4
))
{
AI
.
SelectCard
(
monster
);
...
...
@@ -311,7 +321,7 @@ namespace WindBot.Game.AI
/// </summary>
protected
bool
DefaultCompulsoryEvacuationDevice
()
{
ClientCard
target
=
AI
.
Utils
.
GetProblematicEnemyMonster
();
ClientCard
target
=
AI
.
Utils
.
GetProblematicEnemyMonster
(
0
,
true
);
if
(
target
!=
null
)
{
AI
.
SelectCard
(
target
);
...
...
@@ -319,7 +329,7 @@ namespace WindBot.Game.AI
}
if
(
AI
.
Utils
.
IsChainTarget
(
Card
))
{
ClientCard
monster
=
AI
.
Utils
.
GetBestEnemyMonster
();
ClientCard
monster
=
AI
.
Utils
.
GetBestEnemyMonster
(
false
,
true
);
if
(
monster
!=
null
)
{
AI
.
SelectCard
(
monster
);
...
...
@@ -336,16 +346,7 @@ namespace WindBot.Game.AI
{
if
(!
AI
.
Utils
.
IsAllEnemyBetter
(
true
))
return
false
;
ClientCard
selected
=
null
;
int
BestAtk
=
0
;
foreach
(
ClientCard
card
in
Bot
.
Graveyard
)
{
if
(
card
.
Attack
>
BestAtk
)
{
BestAtk
=
card
.
Attack
;
selected
=
card
;
}
}
ClientCard
selected
=
Bot
.
Graveyard
.
OrderByDescending
(
card
=>
card
.
Attack
).
FirstOrDefault
();
AI
.
SelectCard
(
selected
);
return
true
;
}
...
...
@@ -361,17 +362,15 @@ namespace WindBot.Game.AI
if
(
DefaultOnBecomeTarget
())
return
true
;
if
(
Duel
.
Phase
>
DuelPhase
.
Main1
&&
Duel
.
Phase
<
DuelPhase
.
Main2
)
{
if
(
Enemy
.
HasInMonstersZone
(
_CardId
.
UltimateConductorTytanno
,
true
))
return
false
;
if
(
Enemy
.
HasInMonstersZone
(
_CardId
.
InvokedPurgatrio
,
true
))
return
false
;
if
(
Enemy
.
HasInMonstersZone
(
_CardId
.
ChaosAncientGearGiant
,
true
))
return
false
;
if
(
Enemy
.
HasInMonstersZone
(
_CardId
.
UltimateAncientGearGolem
,
true
))
return
false
;
int
total_atk
=
0
;
List
<
ClientCard
>
enemy_monster
=
Enemy
.
GetMonsters
();
foreach
(
ClientCard
m
in
enemy_monster
)
if
(
Enemy
.
HasInMonstersZone
(
new
[]
{
if
(
m
.
IsAttack
())
total_atk
+=
m
.
Attack
;
}
if
(
total_atk
>=
Bot
.
LifePoints
)
return
true
;
_CardId
.
UltimateConductorTytanno
,
_CardId
.
InvokedPurgatrio
,
_CardId
.
ChaosAncientGearGiant
,
_CardId
.
UltimateAncientGearGolem
,
_CardId
.
RedDragonArchfiend
},
true
))
return
false
;
if
(
AI
.
Utils
.
GetTotalAttackingMonsterAttack
(
1
)
>=
Bot
.
LifePoints
)
return
true
;
}
return
false
;
}
...
...
@@ -387,9 +386,12 @@ namespace WindBot.Game.AI
/// </summary>
protected
bool
DefaultAshBlossomAndJoyousSpring
()
{
if
(
AI
.
Utils
.
GetLastChainCard
().
Id
==
_CardId
.
MacroCosmos
)
return
false
;
if
(
AI
.
Utils
.
GetLastChainCard
().
Id
==
_CardId
.
UpstartGoblin
)
int
[]
ignoreList
=
{
_CardId
.
MacroCosmos
,
_CardId
.
UpstartGoblin
,
_CardId
.
CyberEmergency
};
if
(
AI
.
Utils
.
GetLastChainCard
().
IsCode
(
ignoreList
))
return
false
;
return
Duel
.
LastChainPlayer
==
1
;
}
...
...
@@ -414,7 +416,7 @@ namespace WindBot.Game.AI
/// </summary>
protected
bool
DefaultEffectVeiler
()
{
if
(
AI
.
Utils
.
GetLastChainCard
()
!=
null
&&
AI
.
Utils
.
GetLastChainCard
().
I
d
==
_CardId
.
GalaxySoldier
&&
Enemy
.
Hand
.
Count
>=
3
)
return
false
;
if
(
AI
.
Utils
.
GetLastChainCard
()
!=
null
&&
AI
.
Utils
.
GetLastChainCard
().
I
sCode
(
_CardId
.
GalaxySoldier
)
&&
Enemy
.
Hand
.
Count
>=
3
)
return
false
;
if
(
AI
.
Utils
.
ChainContainsCard
(
_CardId
.
EffectVeiler
))
return
false
;
return
DefaultBreakthroughSkill
();
...
...
@@ -424,32 +426,23 @@ namespace WindBot.Game.AI
/// </summary>
protected
bool
DefaultCalledByTheGrave
()
{
if
(
Duel
.
LastChainPlayer
==
1
)
{
if
(
AI
.
Utils
.
GetLastChainCard
().
Id
==
_CardId
.
MaxxC
)
int
[]
targetList
=
{
AI
.
SelectCard
(
_CardId
.
MaxxC
);
return
UniqueFaceupSpell
();
}
if
(
AI
.
Utils
.
GetLastChainCard
().
Id
==
_CardId
.
LockBird
)
_CardId
.
MaxxC
,
_CardId
.
LockBird
,
_CardId
.
GhostOgreAndSnowRabbit
,
_CardId
.
AshBlossom
,
_CardId
.
GhostBelle
};
if
(
Duel
.
LastChainPlayer
==
1
)
{
AI
.
SelectCard
(
_CardId
.
LockBird
);
return
UniqueFaceupSpell
();
}
if
(
AI
.
Utils
.
GetLastChainCard
().
Id
==
_CardId
.
GhostOgreAndSnowRabbit
)
foreach
(
int
id
in
targetList
)
{
AI
.
SelectCard
(
_CardId
.
GhostOgreAndSnowRabbit
);
return
UniqueFaceupSpell
();
}
if
(
AI
.
Utils
.
GetLastChainCard
().
Id
==
_CardId
.
AshBlossom
)
if
(
AI
.
Utils
.
GetLastChainCard
().
IsCode
(
id
))
{
AI
.
SelectCard
(
_CardId
.
AshBlossom
);
AI
.
SelectCard
(
id
);
return
UniqueFaceupSpell
();
}
if
(
AI
.
Utils
.
GetLastChainCard
().
Id
==
_CardId
.
GhostBelle
)
{
AI
.
SelectCard
(
_CardId
.
GhostBelle
);
return
UniqueFaceupSpell
();
}
}
return
false
;
...
...
@@ -458,6 +451,19 @@ namespace WindBot.Game.AI
/// Default InfiniteImpermanence effect
/// </summary>
protected
bool
DefaultInfiniteImpermanence
()
{
// TODO: disable s & t
return
DefaultBreakthroughSkill
();
}
/// <summary>
/// Chain the enemy monster, or disable monster like Rescue Rabbit.
/// </summary>
protected
bool
DefaultBreakthroughSkill
()
{
if
(!
DefaultUniqueTrap
())
return
false
;
if
(
Duel
.
Player
==
1
)
{
ClientCard
target
=
Enemy
.
MonsterZone
.
GetShouldBeDisabledBeforeItUseEffectMonster
();
if
(
target
!=
null
)
...
...
@@ -465,68 +471,34 @@ namespace WindBot.Game.AI
AI
.
SelectCard
(
target
);
return
true
;
}
if
(
Duel
.
LastChainPlayer
==
1
)
{
foreach
(
ClientCard
check
in
Enemy
.
GetMonsters
())
{
if
(
AI
.
Utils
.
GetLastChainCard
()
==
check
)
{
target
=
check
;
break
;
}
}
if
(
target
!=
null
&&
!
target
.
IsDisabled
())
ClientCard
LastChainCard
=
AI
.
Utils
.
GetLastChainCard
();
if
(
LastChainCard
!=
null
&&
LastChainCard
.
Controller
==
1
&&
LastChainCard
.
Location
==
CardLocation
.
MonsterZone
&&
!
LastChainCard
.
IsDisabled
()
&&
!
LastChainCard
.
IsShouldNotBeTarget
()
&&
!
LastChainCard
.
IsShouldNotBeSpellTrapTarget
())
{
AI
.
SelectCard
(
target
);
AI
.
SelectCard
(
LastChainCard
);
return
true
;
}
}
if
(
Bot
.
BattlingMonster
!=
null
&&
Enemy
.
BattlingMonster
!=
null
)
{
if
(
Enemy
.
BattlingMonster
.
IsDisabled
())
return
false
;
if
(
Enemy
.
BattlingMonster
.
Id
==
_CardId
.
EaterOfMillions
)
if
(!
Enemy
.
BattlingMonster
.
IsDisabled
()
&&
Enemy
.
BattlingMonster
.
IsCode
(
_CardId
.
EaterOfMillions
))
{
AI
.
SelectCard
(
Enemy
.
BattlingMonster
);
return
true
;
}
}
if
(
Duel
.
Phase
==
DuelPhase
.
BattleStart
&&
Duel
.
Player
==
1
&&
Enemy
.
HasInMonstersZone
(
_CardId
.
NumberS39UtopiaTheLightning
,
true
))
{
AI
.
SelectCard
(
_CardId
.
NumberS39UtopiaTheLightning
);
return
UniqueFaceupSpell
();
}
return
false
;
}
/// <summary>
/// Chain the enemy monster, or disable monster like Rescue Rabbit.
/// </summary>
protected
bool
DefaultBreakthroughSkill
()
{
if
(!
DefaultUniqueTrap
())
return
false
;
if
(
Duel
.
Player
==
1
)
{
foreach
(
ClientCard
target
in
Enemy
.
GetMonsters
())
{
if
(
target
.
IsMonsterShouldBeDisabledBeforeItUseEffect
())
{
AI
.
SelectCard
(
target
);
return
true
;
}
}
}
ClientCard
LastChainCard
=
AI
.
Utils
.
GetLastChainCard
();
if
(
LastChainCard
==
null
)
return
false
;
if
(
LastChainCard
.
Controller
!=
1
||
LastChainCard
.
Location
!=
CardLocation
.
MonsterZone
||
LastChainCard
.
IsDisabled
()
||
LastChainCard
.
IsShouldNotBeTarget
()
||
LastChainCard
.
IsShouldNotBeSpellTrapTarget
())
return
false
;
AI
.
SelectCard
(
LastChainCard
);
return
true
;
}
/// <summary>
...
...
@@ -658,19 +630,21 @@ namespace WindBot.Game.AI
{
if
(
Card
.
IsFaceup
()
&&
Card
.
IsDefense
()
&&
Card
.
Attack
==
0
)
return
false
;
if
(
Enemy
.
HasInMonstersZone
(
_CardId
.
BlueEyesChaosMAXDragon
)
&&
Card
.
IsAttack
()
&&
(
4000
-
Card
.
Defense
)*
2
>(
4000
-
Card
.
Attack
))
if
(
Enemy
.
HasInMonstersZone
(
_CardId
.
BlueEyesChaosMAXDragon
,
true
)
&&
Card
.
IsAttack
()
&&
(
4000
-
Card
.
Defense
)
*
2
>
(
4000
-
Card
.
Attack
))
return
false
;
if
(
Enemy
.
HasInMonstersZone
(
_CardId
.
BlueEyesChaosMAXDragon
)
&&
if
(
Enemy
.
HasInMonstersZone
(
_CardId
.
BlueEyesChaosMAXDragon
,
true
)
&&
Card
.
IsDefense
()
&&
Card
.
IsFaceup
()
&&
(
4000
-
Card
.
Defense
)
*
2
>
(
4000
-
Card
.
Attack
))
return
true
;
bool
enemyBetter
=
AI
.
Utils
.
IsAllEnemyBetter
(
true
);
bool
enemyBetter
=
AI
.
Utils
.
IsAllEnemyBetter
(
true
);
if
(
Card
.
IsAttack
()
&&
enemyBetter
)
return
true
;
if
(
Card
.
IsDefense
()
&&
!
enemyBetter
&&
Card
.
Attack
>=
Card
.
Defense
)
return
true
;
return
false
;
}
...
...
@@ -679,17 +653,7 @@ namespace WindBot.Game.AI
/// </summary>
protected
bool
DefaultSpellWillBeNegated
()
{
ClientCard
card
=
null
;
foreach
(
ClientCard
check
in
Bot
.
GetSpells
())
{
if
(
check
.
Id
==
_CardId
.
ImperialOrder
&&
!
check
.
IsDisabled
())
card
=
check
;
}
if
(
card
!=
null
&&
card
.
IsFaceup
())
return
true
;
if
(
Enemy
.
HasInSpellZone
(
_CardId
.
ImperialOrder
,
true
)
||
Enemy
.
HasInMonstersZone
(
_CardId
.
NaturiaBeast
,
true
))
return
true
;
return
false
;
return
Bot
.
HasInSpellZone
(
_CardId
.
ImperialOrder
,
true
,
true
)
||
Enemy
.
HasInSpellZone
(
_CardId
.
ImperialOrder
,
true
)
||
Enemy
.
HasInMonstersZone
(
_CardId
.
NaturiaBeast
,
true
);
}
/// <summary>
...
...
@@ -700,14 +664,12 @@ namespace WindBot.Game.AI
ClientCard
card
=
null
;
foreach
(
ClientCard
check
in
Bot
.
GetSpells
())
{
if
(
check
.
I
d
==
_CardId
.
AntiSpellFragrance
&&
!
check
.
IsDisabled
())
if
(
check
.
I
sCode
(
_CardId
.
AntiSpellFragrance
)
&&
!
check
.
IsDisabled
())
card
=
check
;
}
if
(
card
!=
null
&&
card
.
IsFaceup
())
return
true
;
if
(
Enemy
.
HasInSpellZone
(
_CardId
.
AntiSpellFragrance
,
true
))
return
true
;
return
false
;
return
Bot
.
HasInSpellZone
(
_CardId
.
AntiSpellFragrance
,
true
,
true
)
||
Enemy
.
HasInSpellZone
(
_CardId
.
AntiSpellFragrance
,
true
);
}
/// <summary>
...
...
@@ -716,9 +678,22 @@ namespace WindBot.Game.AI
protected
bool
DefaultOnBecomeTarget
()
{
if
(
AI
.
Utils
.
IsChainTarget
(
Card
))
return
true
;
if
(
AI
.
Utils
.
ChainContainsCard
(
_CardId
.
EvilswarmExcitonKnight
))
return
true
;
if
(
Enemy
.
HasInSpellZone
(
_CardId
.
HarpiesFeatherDuster
,
true
))
return
true
;
if
(
Enemy
.
HasInSpellZone
(
_CardId
.
DarkMagicAttack
,
true
))
return
true
;
int
[]
destroyAllList
=
{
_CardId
.
EvilswarmExcitonKnight
,
_CardId
.
BlackRoseDragon
,
_CardId
.
JudgmentDragon
,
_CardId
.
TopologicTrisbaena
};
int
[]
destroyAllOpponentList
=
{
_CardId
.
HarpiesFeatherDuster
,
_CardId
.
DarkMagicAttack
};
if
(
AI
.
Utils
.
ChainContainsCard
(
destroyAllList
))
return
true
;
if
(
Enemy
.
HasInSpellZone
(
destroyAllOpponentList
,
true
))
return
true
;
// TODO: ChainContainsCard(id, player)
return
false
;
}
/// <summary>
...
...
@@ -745,12 +720,7 @@ namespace WindBot.Game.AI
/// </summary>
protected
bool
UniqueFaceupSpell
()
{
foreach
(
ClientCard
card
in
Bot
.
GetSpells
())
{
if
(
card
.
Id
==
Card
.
Id
&&
card
.
IsFaceup
())
return
false
;
}
return
true
;
return
!
Bot
.
GetSpells
().
Any
(
card
=>
card
.
IsCode
(
Card
.
Id
)
&&
card
.
IsFaceup
());
}
/// <summary>
...
...
@@ -758,12 +728,7 @@ namespace WindBot.Game.AI
/// </summary>
protected
bool
UniqueFaceupMonster
()
{
foreach
(
ClientCard
card
in
Bot
.
GetMonsters
())
{
if
(
card
.
Id
==
Card
.
Id
&&
card
.
IsFaceup
())
return
false
;
}
return
true
;
return
!
Bot
.
GetMonsters
().
Any
(
card
=>
card
.
IsCode
(
Card
.
Id
)
&&
card
.
IsFaceup
());
}
/// <summary>
...
...
@@ -771,11 +736,8 @@ namespace WindBot.Game.AI
/// </summary>
protected
bool
DefaultDontChainMyself
()
{
foreach
(
CardExecutor
exec
in
Executors
)
{
if
(
exec
.
Type
==
Type
&&
exec
.
CardId
==
Card
.
Id
)
if
(
Executors
.
Any
(
exec
=>
exec
.
Type
==
Type
&&
exec
.
CardId
==
Card
.
Id
))
return
false
;
}
return
Duel
.
LastChainPlayer
!=
0
;
}
...
...
@@ -784,13 +746,9 @@ namespace WindBot.Game.AI
/// </summary>
protected
bool
DefaultChickenGame
()
{
int
count
=
0
;
foreach
(
CardExecutor
exec
in
Executors
)
{
if
(
exec
.
Type
==
Type
&&
exec
.
CardId
==
Card
.
Id
)
count
++;
}
if
(
count
>
1
||
Bot
.
LifePoints
<=
1000
)
if
(
Executors
.
Count
(
exec
=>
exec
.
Type
==
Type
&&
exec
.
CardId
==
Card
.
Id
)
>
1
)
return
false
;
if
(
Bot
.
LifePoints
<=
1000
)
return
false
;
if
(
Bot
.
LifePoints
<=
Enemy
.
LifePoints
&&
ActivateDescription
==
AI
.
Utils
.
GetStringId
(
_CardId
.
ChickenGame
,
0
))
return
true
;
...
...
@@ -804,22 +762,8 @@ namespace WindBot.Game.AI
/// </summary>
protected
bool
DefaultAllureofDarkness
()
{
IList
<
ClientCard
>
condition
=
Bot
.
Hand
;
IList
<
ClientCard
>
check
=
new
List
<
ClientCard
>();
ClientCard
con
=
null
;
foreach
(
ClientCard
card
in
condition
)
{
if
(
card
.
HasAttribute
(
CardAttribute
.
Dark
))
{
con
=
card
;
break
;
}
}
if
(
con
!=
null
)
{
return
true
;
}
return
false
;
ClientCard
target
=
Bot
.
Hand
.
FirstOrDefault
(
card
=>
card
.
HasAttribute
(
CardAttribute
.
Dark
));
return
target
!=
null
;
}
/// <summary>
...
...
@@ -842,14 +786,17 @@ namespace WindBot.Game.AI
{
if
(
monster
.
HasType
(
CardType
.
Tuner
))
tuner
=
true
;
else
if
(!
monster
.
HasType
(
CardType
.
Xyz
))
else
if
(!
monster
.
HasType
(
CardType
.
Xyz
)
&&
!
monster
.
HasType
(
CardType
.
Link
))
{
nontuner
=
true
;
levels
[
monster
.
Level
]
=
levels
[
monster
.
Level
]
+
1
;
}
if
(
monster
.
IsOneForXyz
())
{
AI
.
SelectOption
(
XYZ
);
return
true
;
}
levels
[
monster
.
Level
]
=
levels
[
monster
.
Level
]
+
1
;
}
if
(
tuner
&&
nontuner
)
{
...
...
@@ -928,6 +875,9 @@ namespace WindBot.Game.AI
});
return
true
;
}
if
(
DefaultDarkHole
())
{
AI
.
SelectCard
(
new
[]
{
_CardId
.
JizukirutheStarDestroyingKaiju
,
...
...
@@ -949,7 +899,10 @@ namespace WindBot.Game.AI
_CardId
.
ThunderKingtheLightningstrikeKaiju
,
});
return
DefaultDarkHole
();
return
true
;
}
return
false
;
}
/// <summary>
...
...
@@ -969,7 +922,7 @@ namespace WindBot.Game.AI
};
foreach
(
ClientCard
monster
in
Enemy
.
GetMonsters
())
{
if
(
kaijus
.
Contains
(
monster
.
Id
))
if
(
monster
.
IsCode
(
kaijus
))
return
Card
.
GetDefensePower
()
>
monster
.
GetDefensePower
();
}
ClientCard
card
=
Enemy
.
MonsterZone
.
GetFloodgate
();
...
...
@@ -1031,19 +984,8 @@ namespace WindBot.Game.AI
if
(
selfCount
<
oppoCount
)
return
true
;
int
selfAttack
=
0
;
List
<
ClientCard
>
monsters
=
Bot
.
GetMonsters
();
foreach
(
ClientCard
monster
in
monsters
)
{
selfAttack
+=
monster
.
GetDefensePower
();
}
int
oppoAttack
=
0
;
monsters
=
Enemy
.
GetMonsters
();
foreach
(
ClientCard
monster
in
monsters
)
{
oppoAttack
+=
monster
.
GetDefensePower
();
}
int
selfAttack
=
Bot
.
GetMonsters
().
Sum
(
monster
=>
(
int
?)
monster
.
GetDefensePower
())
??
0
;
int
oppoAttack
=
Enemy
.
GetMonsters
().
Sum
(
monster
=>
(
int
?)
monster
.
GetDefensePower
())
??
0
;
return
selfAttack
<
oppoAttack
;
}
...
...
@@ -1106,23 +1048,9 @@ namespace WindBot.Game.AI
/// </summary>
protected
bool
DefaultScarlightRedDragonArchfiendEffect
()
{
int
selfCount
=
0
;
List
<
ClientCard
>
monsters
=
Bot
.
GetMonsters
();
foreach
(
ClientCard
monster
in
monsters
)
{
if
(!
monster
.
Equals
(
Card
)
&&
monster
.
IsSpecialSummoned
&&
monster
.
HasType
(
CardType
.
Effect
)
&&
monster
.
Attack
<=
Card
.
Attack
)
selfCount
++;
}
int
oppoCount
=
0
;
monsters
=
Enemy
.
GetMonsters
();
foreach
(
ClientCard
monster
in
monsters
)
{
if
(
monster
.
IsSpecialSummoned
&&
monster
.
HasType
(
CardType
.
Effect
)
&&
monster
.
Attack
<=
Card
.
Attack
)
oppoCount
++;
}
return
(
oppoCount
>
0
&&
selfCount
<=
oppoCount
)
||
oppoCount
>=
3
;
int
selfCount
=
Bot
.
GetMonsters
().
Count
(
monster
=>
!
monster
.
Equals
(
Card
)
&&
monster
.
IsSpecialSummoned
&&
monster
.
HasType
(
CardType
.
Effect
)
&&
monster
.
Attack
<=
Card
.
Attack
);
int
oppoCount
=
Enemy
.
GetMonsters
().
Count
(
monster
=>
monster
.
IsSpecialSummoned
&&
monster
.
HasType
(
CardType
.
Effect
)
&&
monster
.
Attack
<=
Card
.
Attack
);
return
selfCount
<=
oppoCount
||
oppoCount
>=
3
;
}
/// <summary>
...
...
@@ -1136,9 +1064,14 @@ namespace WindBot.Game.AI
(((
Bot
.
BattlingMonster
.
Attack
<
Enemy
.
BattlingMonster
.
Attack
)
||
Bot
.
BattlingMonster
.
Attack
>=
Enemy
.
LifePoints
)
||
((
Bot
.
BattlingMonster
.
Attack
<
Enemy
.
BattlingMonster
.
Defense
)
&&
(
Bot
.
BattlingMonster
.
Attack
+
Enemy
.
BattlingMonster
.
Attack
>
Enemy
.
BattlingMonster
.
Defense
)));
}
else
return
AI
.
Utils
.
IsTurn1OrMain2
();
}
if
(
AI
.
Utils
.
IsTurn1OrMain2
()
&&
HonestEffectCount
<=
5
)
{
HonestEffectCount
++;
return
true
;
}
return
false
;
}
}
}
Game/AI/Dialogs.cs
View file @
43086945
...
...
@@ -127,7 +127,7 @@ namespace WindBot.Game.AI
public
void
SendOnDirectAttack
(
string
attacker
)
{
if
(
attacker
==
""
||
attacker
==
null
)
if
(
string
.
IsNullOrEmpty
(
attacker
)
)
{
attacker
=
_facedownmonstername
;
}
...
...
Game/AI/Executor.cs
View file @
43086945
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
YGOSharp.OCGWrapper.Enums
;
using
WindBot
;
using
WindBot.Game
;
...
...
@@ -82,12 +83,12 @@ namespace WindBot.Game.AI
public
virtual
void
OnChaining
(
int
player
,
ClientCard
card
)
{
// For overriding
}
public
virtual
void
OnChainEnd
()
{
// For overriding
}
public
virtual
void
OnNewPhase
()
{
...
...
@@ -239,12 +240,7 @@ namespace WindBot.Game.AI
private
bool
DefaultNoExecutor
()
{
foreach
(
CardExecutor
exec
in
Executors
)
{
if
(
exec
.
Type
==
Type
&&
exec
.
CardId
==
Card
.
Id
)
return
false
;
}
return
true
;
return
Executors
.
All
(
exec
=>
exec
.
Type
!=
Type
||
exec
.
CardId
!=
Card
.
Id
);
}
}
}
\ No newline at end of file
Game/ClientCard.cs
View file @
43086945
using
System.Collections.Generic
;
using
System.IO
;
using
System.Linq
;
using
YGOSharp.OCGWrapper
;
using
YGOSharp.OCGWrapper.Enums
;
...
...
@@ -39,6 +40,8 @@ namespace WindBot.Game
public
List
<
ClientCard
>
EquipCards
{
get
;
set
;
}
public
ClientCard
EquipTarget
;
public
List
<
ClientCard
>
OwnTargets
{
get
;
set
;
}
public
List
<
ClientCard
>
TargetCards
{
get
;
set
;
}
public
bool
CanDirectAttack
{
get
;
set
;
}
public
bool
ShouldDirectAttack
{
get
;
set
;
}
...
...
@@ -61,6 +64,8 @@ namespace WindBot.Game
Position
=
position
;
Overlays
=
new
List
<
int
>();
EquipCards
=
new
List
<
ClientCard
>();
OwnTargets
=
new
List
<
ClientCard
>();
TargetCards
=
new
List
<
ClientCard
>();
ActionIndex
=
new
int
[
16
];
ActionActivateIndex
=
new
Dictionary
<
int
,
int
>();
Location
=
loc
;
...
...
@@ -72,7 +77,11 @@ namespace WindBot.Game
Id
=
id
;
Data
=
NamedCard
.
Get
(
Id
);
if
(
Data
!=
null
)
{
Name
=
Data
.
Name
;
if
(
Data
.
Alias
!=
0
)
Alias
=
Data
.
Alias
;
}
}
public
void
Update
(
BinaryReader
packet
,
Duel
duel
)
...
...
@@ -83,8 +92,8 @@ namespace WindBot.Game
if
((
flag
&
(
int
)
Query
.
Position
)
!=
0
)
{
Controller
=
duel
.
GetLocalPlayer
(
packet
.
ReadByte
());
packet
.
ReadByte
();
packet
.
ReadByte
();
Location
=
(
CardLocation
)
packet
.
ReadByte
();
Sequence
=
packet
.
ReadByte
();
Position
=
packet
.
ReadByte
();
}
if
((
flag
&
(
int
)
Query
.
Alias
)
!=
0
)
...
...
@@ -149,29 +158,93 @@ namespace WindBot.Game
}
}
public
void
ClearCardTargets
()
{
foreach
(
ClientCard
card
in
TargetCards
)
{
card
.
OwnTargets
.
Remove
(
this
);
}
foreach
(
ClientCard
card
in
OwnTargets
)
{
card
.
TargetCards
.
Remove
(
this
);
}
OwnTargets
.
Clear
();
TargetCards
.
Clear
();
}
public
bool
HasLinkMarker
(
int
dir
)
{
return
(
(
LinkMarker
&
dir
)
!=
0
)
;
return
(
LinkMarker
&
dir
)
!=
0
;
}
public
bool
HasLinkMarker
(
LinkMarker
dir
)
public
bool
HasLinkMarker
(
Card
LinkMarker
dir
)
{
return
((
LinkMarker
&
(
int
)
dir
)
!=
0
);
return
(
LinkMarker
&
(
int
)
dir
)
!=
0
;
}
public
int
GetLinkedZones
()
{
if
(!
HasType
(
CardType
.
Link
)
||
Location
!=
CardLocation
.
MonsterZone
)
return
0
;
int
zones
=
0
;
if
(
Sequence
>
0
&&
Sequence
<=
4
&&
HasLinkMarker
(
CardLinkMarker
.
Left
))
zones
|=
1
<<
(
Sequence
-
1
);
if
(
Sequence
<=
3
&&
HasLinkMarker
(
CardLinkMarker
.
Right
))
zones
|=
1
<<
(
Sequence
+
1
);
if
(
Sequence
==
0
&&
HasLinkMarker
(
CardLinkMarker
.
TopRight
)
||
Sequence
==
1
&&
HasLinkMarker
(
CardLinkMarker
.
Top
)
||
Sequence
==
2
&&
HasLinkMarker
(
CardLinkMarker
.
TopLeft
))
zones
|=
(
1
<<
5
)
|
(
1
<<
(
16
+
6
));
if
(
Sequence
==
2
&&
HasLinkMarker
(
CardLinkMarker
.
TopRight
)
||
Sequence
==
3
&&
HasLinkMarker
(
CardLinkMarker
.
Top
)
||
Sequence
==
4
&&
HasLinkMarker
(
CardLinkMarker
.
TopLeft
))
zones
|=
(
1
<<
6
)
|
(
1
<<
(
16
+
5
));
if
(
Sequence
==
5
)
{
if
(
HasLinkMarker
(
CardLinkMarker
.
BottomLeft
))
zones
|=
1
<<
0
;
if
(
HasLinkMarker
(
CardLinkMarker
.
Bottom
))
zones
|=
1
<<
1
;
if
(
HasLinkMarker
(
CardLinkMarker
.
BottomRight
))
zones
|=
1
<<
2
;
if
(
HasLinkMarker
(
CardLinkMarker
.
TopLeft
))
zones
|=
1
<<
(
16
+
4
);
if
(
HasLinkMarker
(
CardLinkMarker
.
Top
))
zones
|=
1
<<
(
16
+
3
);
if
(
HasLinkMarker
(
CardLinkMarker
.
TopRight
))
zones
|=
1
<<
(
16
+
2
);
}
if
(
Sequence
==
6
)
{
if
(
HasLinkMarker
(
CardLinkMarker
.
BottomLeft
))
zones
|=
1
<<
2
;
if
(
HasLinkMarker
(
CardLinkMarker
.
Bottom
))
zones
|=
1
<<
3
;
if
(
HasLinkMarker
(
CardLinkMarker
.
BottomRight
))
zones
|=
1
<<
4
;
if
(
HasLinkMarker
(
CardLinkMarker
.
TopLeft
))
zones
|=
1
<<
(
16
+
2
);
if
(
HasLinkMarker
(
CardLinkMarker
.
Top
))
zones
|=
1
<<
(
16
+
1
);
if
(
HasLinkMarker
(
CardLinkMarker
.
TopRight
))
zones
|=
1
<<
(
16
+
0
);
}
return
zones
;
}
public
bool
HasType
(
CardType
type
)
{
return
(
(
Type
&
(
int
)
type
)
!=
0
)
;
return
(
Type
&
(
int
)
type
)
!=
0
;
}
public
bool
HasPosition
(
CardPosition
position
)
{
return
(
(
Position
&
(
int
)
position
)
!=
0
)
;
return
(
Position
&
(
int
)
position
)
!=
0
;
}
public
bool
HasAttribute
(
CardAttribute
attribute
)
{
return
(
(
Attribute
&
(
int
)
attribute
)
!=
0
)
;
return
(
Attribute
&
(
int
)
attribute
)
!=
0
;
}
public
bool
IsMonster
()
...
...
@@ -221,7 +294,22 @@ namespace WindBot.Game
public
bool
IsDisabled
()
{
return
(
Disabled
!=
0
);
return
Disabled
!=
0
;
}
public
bool
IsCode
(
int
id
)
{
return
Id
==
id
||
Alias
!=
0
&&
Alias
==
id
;
}
public
bool
IsCode
(
IList
<
int
>
ids
)
{
return
ids
.
Contains
(
Id
)
||
Alias
!=
0
&&
ids
.
Contains
(
Alias
);
}
public
bool
IsCode
(
params
int
[]
ids
)
{
return
ids
.
Contains
(
Id
)
||
Alias
!=
0
&&
ids
.
Contains
(
Alias
);
}
public
bool
HasXyzMaterial
()
...
...
Game/ClientField.cs
View file @
43086945
using
System.Collections.Generic
;
using
System.Linq
;
using
WindBot.Game.AI
;
using
YGOSharp.OCGWrapper.Enums
;
namespace
WindBot.Game
...
...
@@ -95,30 +97,36 @@ namespace WindBot.Game
return
count
;
}
public
int
GetFieldCount
()
{
return
GetSpellCount
()
+
GetMonsterCount
();
}
public
int
GetFieldHandCount
()
{
return
GetSpellCount
()
+
GetMonsterCount
()
+
GetHandCount
();
}
public
bool
IsFieldEmpty
()
{
return
GetMonsters
().
Count
==
0
&&
GetSpells
().
Count
==
0
;
}
public
int
GetLinkedZones
()
{
int
zones
=
0
;
for
(
int
i
=
0
;
i
<
7
;
i
++)
{
zones
|=
MonsterZone
[
i
]?.
GetLinkedZones
()
??
0
;
}
return
zones
;
}
public
List
<
ClientCard
>
GetMonsters
()
{
return
GetCards
(
MonsterZone
);
}
public
List
<
ClientCard
>
GetGraveyardMonsters
()
{
return
GetCards
(
Graveyard
,
CardType
.
Monster
);
...
...
@@ -141,23 +149,12 @@ namespace WindBot.Game
public
List
<
ClientCard
>
GetMonstersInExtraZone
()
{
List
<
ClientCard
>
cards
=
new
List
<
ClientCard
>();
if
(
MonsterZone
[
5
]
!=
null
)
cards
.
Add
(
MonsterZone
[
5
]);
if
(
MonsterZone
[
6
]
!=
null
)
cards
.
Add
(
MonsterZone
[
6
]);
return
cards
;
return
GetMonsters
().
Where
((
card
,
i
)
=>
i
>=
5
).
ToList
();
}
public
List
<
ClientCard
>
GetMonstersInMainZone
()
{
List
<
ClientCard
>
cards
=
new
List
<
ClientCard
>();
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
if
(
MonsterZone
[
i
]
!=
null
)
cards
.
Add
(
MonsterZone
[
i
]);
}
return
cards
;
return
GetMonsters
().
Where
((
card
,
i
)
=>
i
<
5
).
ToList
();
}
public
bool
HasInHand
(
int
cardId
)
...
...
@@ -202,44 +199,32 @@ namespace WindBot.Game
public
bool
HasAttackingMonster
()
{
IList
<
ClientCard
>
monsters
=
GetMonsters
();
foreach
(
ClientCard
card
in
monsters
)
{
if
(
card
.
IsAttack
())
return
true
;
}
return
false
;
return
GetMonsters
().
Any
(
card
=>
card
.
IsAttack
());
}
public
bool
HasDefendingMonster
()
{
IList
<
ClientCard
>
monsters
=
GetMonsters
();
foreach
(
ClientCard
card
in
monsters
)
{
if
(
card
.
IsDefense
())
return
true
;
}
return
false
;
return
GetMonsters
().
Any
(
card
=>
card
.
IsDefense
());
}
public
bool
HasInMonstersZone
(
int
cardId
,
bool
notDisabled
=
false
,
bool
hasXyzMaterial
=
false
)
public
bool
HasInMonstersZone
(
int
cardId
,
bool
notDisabled
=
false
,
bool
hasXyzMaterial
=
false
,
bool
faceUp
=
false
)
{
return
HasInCards
(
MonsterZone
,
cardId
,
notDisabled
,
hasXyzMaterial
);
return
HasInCards
(
MonsterZone
,
cardId
,
notDisabled
,
hasXyzMaterial
,
faceUp
);
}
public
bool
HasInMonstersZone
(
IList
<
int
>
cardId
,
bool
notDisabled
=
false
,
bool
hasXyzMaterial
=
false
)
public
bool
HasInMonstersZone
(
IList
<
int
>
cardId
,
bool
notDisabled
=
false
,
bool
hasXyzMaterial
=
false
,
bool
faceUp
=
false
)
{
return
HasInCards
(
MonsterZone
,
cardId
,
notDisabled
,
hasXyzMaterial
);
return
HasInCards
(
MonsterZone
,
cardId
,
notDisabled
,
hasXyzMaterial
,
faceUp
);
}
public
bool
HasInSpellZone
(
int
cardId
,
bool
notDisabled
=
false
)
public
bool
HasInSpellZone
(
int
cardId
,
bool
notDisabled
=
false
,
bool
faceUp
=
false
)
{
return
HasInCards
(
SpellZone
,
cardId
,
notDisabled
);
return
HasInCards
(
SpellZone
,
cardId
,
notDisabled
,
false
,
faceUp
);
}
public
bool
HasInSpellZone
(
IList
<
int
>
cardId
,
bool
notDisabled
=
false
)
public
bool
HasInSpellZone
(
IList
<
int
>
cardId
,
bool
notDisabled
=
false
,
bool
faceUp
=
false
)
{
return
HasInCards
(
SpellZone
,
cardId
,
notDisabled
);
return
HasInCards
(
SpellZone
,
cardId
,
notDisabled
,
false
,
faceUp
);
}
public
bool
HasInHandOrInSpellZone
(
int
cardId
)
...
...
@@ -315,94 +300,46 @@ namespace WindBot.Game
public
int
GetRemainingCount
(
int
cardId
,
int
initialCount
)
{
int
remaining
=
initialCount
;
foreach
(
ClientCard
card
in
Hand
)
if
(
card
!=
null
&&
card
.
Id
==
cardId
)
remaining
--;
foreach
(
ClientCard
card
in
SpellZone
)
if
(
card
!=
null
&&
card
.
Id
==
cardId
)
remaining
--;
foreach
(
ClientCard
card
in
Graveyard
)
if
(
card
!=
null
&&
card
.
Id
==
cardId
)
remaining
--;
foreach
(
ClientCard
card
in
Banished
)
if
(
card
!=
null
&&
card
.
Id
==
cardId
)
remaining
--;
remaining
=
remaining
-
Hand
.
Count
(
card
=>
card
!=
null
&&
card
.
IsCode
(
cardId
));
remaining
=
remaining
-
SpellZone
.
Count
(
card
=>
card
!=
null
&&
card
.
IsCode
(
cardId
));
remaining
=
remaining
-
Graveyard
.
Count
(
card
=>
card
!=
null
&&
card
.
IsCode
(
cardId
));
remaining
=
remaining
-
Banished
.
Count
(
card
=>
card
!=
null
&&
card
.
IsCode
(
cardId
));
return
(
remaining
<
0
)
?
0
:
remaining
;
}
private
static
int
GetCount
(
IEnumerable
<
ClientCard
>
cards
)
{
int
count
=
0
;
foreach
(
ClientCard
card
in
cards
)
{
if
(
card
!=
null
)
count
++;
}
return
count
;
return
cards
.
Count
(
card
=>
card
!=
null
);
}
public
int
GetCountCardInZone
(
IEnumerable
<
ClientCard
>
cards
,
int
cardId
)
{
int
count
=
0
;
foreach
(
ClientCard
card
in
cards
)
{
if
(
card
!=
null
&&
card
.
Id
==
cardId
)
count
++;
}
return
count
;
return
cards
.
Count
(
card
=>
card
!=
null
&&
card
.
IsCode
(
cardId
));
}
public
int
GetCountCardInZone
(
IEnumerable
<
ClientCard
>
cards
,
List
<
int
>
cardId
)
{
int
count
=
0
;
foreach
(
ClientCard
card
in
cards
)
{
if
(
card
!=
null
&&
cardId
.
Contains
(
card
.
Id
))
count
++;
}
return
count
;
return
cards
.
Count
(
card
=>
card
!=
null
&&
card
.
IsCode
(
cardId
));
}
private
static
List
<
ClientCard
>
GetCards
(
IEnumerable
<
ClientCard
>
cards
,
CardType
type
)
{
List
<
ClientCard
>
nCards
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
card
in
cards
)
{
if
(
card
!=
null
&&
card
.
HasType
(
type
))
nCards
.
Add
(
card
);
}
return
nCards
;
return
cards
.
Where
(
card
=>
card
!=
null
&&
card
.
HasType
(
type
)).
ToList
();
}
private
static
List
<
ClientCard
>
GetCards
(
IEnumerable
<
ClientCard
>
cards
)
{
List
<
ClientCard
>
nCards
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
card
in
cards
)
{
if
(
card
!=
null
)
nCards
.
Add
(
card
);
}
return
nCards
;
return
cards
.
Where
(
card
=>
card
!=
null
).
ToList
();
}
private
static
bool
HasInCards
(
IEnumerable
<
ClientCard
>
cards
,
int
cardId
,
bool
notDisabled
=
false
,
bool
hasXyzMaterial
=
false
)
{
foreach
(
ClientCard
card
in
cards
)
private
static
bool
HasInCards
(
IEnumerable
<
ClientCard
>
cards
,
int
cardId
,
bool
notDisabled
=
false
,
bool
hasXyzMaterial
=
false
,
bool
faceUp
=
false
)
{
if
(
card
!=
null
&&
card
.
Id
==
cardId
&&
!(
notDisabled
&&
card
.
IsDisabled
())
&&
!(
hasXyzMaterial
&&
!
card
.
HasXyzMaterial
()))
return
true
;
}
return
false
;
return
cards
.
Any
(
card
=>
card
!=
null
&&
card
.
IsCode
(
cardId
)
&&
!(
notDisabled
&&
card
.
IsDisabled
())
&&
!(
hasXyzMaterial
&&
!
card
.
HasXyzMaterial
())
&&
!(
faceUp
&&
card
.
IsFacedown
()));
}
private
static
bool
HasInCards
(
IEnumerable
<
ClientCard
>
cards
,
IList
<
int
>
cardId
,
bool
notDisabled
=
false
,
bool
hasXyzMaterial
=
false
)
private
static
bool
HasInCards
(
IEnumerable
<
ClientCard
>
cards
,
IList
<
int
>
cardId
,
bool
notDisabled
=
false
,
bool
hasXyzMaterial
=
false
,
bool
faceUp
=
false
)
{
foreach
(
ClientCard
card
in
cards
)
{
if
(
card
!=
null
&&
cardId
.
Contains
(
card
.
Id
)
&&
!(
notDisabled
&&
card
.
IsDisabled
())
&&
!(
hasXyzMaterial
&&
!
card
.
HasXyzMaterial
()))
return
true
;
}
return
false
;
return
cards
.
Any
(
card
=>
card
!=
null
&&
card
.
IsCode
(
cardId
)
&&
!(
notDisabled
&&
card
.
IsDisabled
())
&&
!(
hasXyzMaterial
&&
!
card
.
HasXyzMaterial
())
&&
!(
faceUp
&&
card
.
IsFacedown
()));
}
}
}
\ No newline at end of file
Game/Deck.cs
View file @
43086945
...
...
@@ -83,8 +83,7 @@ namespace WindBot.Game
}
catch
(
Exception
)
{
if
(
reader
!=
null
)
reader
.
Close
();
reader
?.
Close
();
return
null
;
}
}
...
...
Game/GameAI.cs
View file @
43086945
...
...
@@ -360,10 +360,7 @@ namespace WindBot.Game
return
result
;
result
=
new
List
<
ClientCard
>();
// TODO: use selector
for
(
int
i
=
0
;
i
<
cards
.
Count
;
i
++)
{
result
.
Add
(
cards
[
i
]);
}
result
=
cards
.
ToList
();
return
result
;
}
...
...
@@ -550,10 +547,15 @@ namespace WindBot.Game
}
else
{
if
(
hint
==
HINTMSG_SMATERIAL
)
switch
(
hint
)
{
case
HINTMSG_SMATERIAL
:
selected
=
Executor
.
OnSelectSynchroMaterial
(
cards
,
sum
,
min
,
max
);
if
(
hint
==
HINTMSG_RELEASE
)
break
;
case
HINTMSG_RELEASE
:
selected
=
Executor
.
OnSelectRitualTribute
(
cards
,
sum
,
min
,
max
);
break
;
}
}
if
(
selected
!=
null
)
{
...
...
@@ -1017,12 +1019,7 @@ namespace WindBot.Game
/// <returns>A list of the selected attributes.</returns>
public
virtual
IList
<
CardAttribute
>
OnAnnounceAttrib
(
int
count
,
IList
<
CardAttribute
>
attributes
)
{
IList
<
CardAttribute
>
foundAttributes
=
new
List
<
CardAttribute
>();
foreach
(
CardAttribute
attribute
in
m_attributes
)
{
if
(
attributes
.
Contains
(
attribute
))
foundAttributes
.
Add
(
attribute
);
}
IList
<
CardAttribute
>
foundAttributes
=
m_attributes
.
Where
(
attributes
.
Contains
).
ToList
();
if
(
foundAttributes
.
Count
>
0
)
return
foundAttributes
;
...
...
@@ -1037,12 +1034,7 @@ namespace WindBot.Game
/// <returns>A list of the selected races.</returns>
public
virtual
IList
<
CardRace
>
OnAnnounceRace
(
int
count
,
IList
<
CardRace
>
races
)
{
IList
<
CardRace
>
foundRaces
=
new
List
<
CardRace
>();
foreach
(
CardRace
race
in
m_races
)
{
if
(
races
.
Contains
(
race
))
foundRaces
.
Add
(
race
);
}
IList
<
CardRace
>
foundRaces
=
m_races
.
Where
(
races
.
Contains
).
ToList
();
if
(
foundRaces
.
Count
>
0
)
return
foundRaces
;
...
...
@@ -1080,12 +1072,10 @@ namespace WindBot.Game
private
bool
ShouldExecute
(
CardExecutor
exec
,
ClientCard
card
,
ExecutorType
type
,
int
desc
=
-
1
)
{
Executor
.
SetCard
(
type
,
card
,
desc
);
if
(
card
!=
null
&&
return
card
!=
null
&&
exec
.
Type
==
type
&&
(
exec
.
CardId
==
-
1
||
exec
.
CardId
==
card
.
Id
)
&&
(
exec
.
Func
==
null
||
exec
.
Func
()))
return
true
;
return
false
;
(
exec
.
Func
==
null
||
exec
.
Func
());
}
}
}
Game/GameBehavior.cs
View file @
43086945
...
...
@@ -133,6 +133,8 @@ namespace WindBot.Game
_messages
.
Add
(
GameMessage
.
RockPaperScissors
,
OnRockPaperScissors
);
_messages
.
Add
(
GameMessage
.
Equip
,
OnEquip
);
_messages
.
Add
(
GameMessage
.
Unequip
,
OnUnEquip
);
_messages
.
Add
(
GameMessage
.
CardTarget
,
OnCardTarget
);
_messages
.
Add
(
GameMessage
.
CancelTarget
,
OnCancelTarget
);
_messages
.
Add
(
GameMessage
.
Summoning
,
OnSummoning
);
_messages
.
Add
(
GameMessage
.
Summoned
,
OnSummoned
);
_messages
.
Add
(
GameMessage
.
SpSummoning
,
OnSpSummoning
);
...
...
@@ -517,6 +519,7 @@ namespace WindBot.Game
private
void
OnMove
(
BinaryReader
packet
)
{
// TODO: update equip cards and target cards
int
cardId
=
packet
.
ReadInt32
();
int
previousControler
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
previousLocation
=
packet
.
ReadByte
();
...
...
@@ -619,7 +622,7 @@ namespace WindBot.Game
_duel
.
Fields
[
attackcard
.
Controller
].
BattlingMonster
=
attackcard
;
_duel
.
Fields
[
1
-
attackcard
.
Controller
].
BattlingMonster
=
defendcard
;
if
(
ld
==
0
&&
(
attackcard
!=
null
)
&&
(
ca
!=
0
)
)
if
(
ld
==
0
&&
ca
!=
0
)
{
_ai
.
OnDirectAttack
(
attackcard
);
}
...
...
@@ -631,12 +634,14 @@ namespace WindBot.Game
int
pc
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
pl
=
packet
.
ReadByte
();
int
ps
=
packet
.
ReadSByte
();
packet
.
ReadSByte
();
// pp
int
pp
=
packet
.
ReadSByte
();
int
cp
=
packet
.
ReadSByte
();
ClientCard
card
=
_duel
.
GetCard
(
pc
,
(
CardLocation
)
pl
,
ps
);
if
(
card
!=
null
)
{
card
.
Position
=
cp
;
if
((
pp
&
(
int
)
CardPosition
.
FaceUp
)
>
0
&&
(
cp
&
(
int
)
CardPosition
.
FaceDown
)
>
0
)
card
.
ClearCardTargets
();
if
(
_debug
)
Logger
.
WriteLine
(
"("
+
(
card
.
Name
??
"UnKnowCard"
)
+
" change position to "
+
(
CardPosition
)
cp
+
")"
);
}
...
...
@@ -732,9 +737,8 @@ namespace WindBot.Game
packet
.
ReadInt32
();
// ???
ClientCard
card
=
_duel
.
GetCard
(
player
,
(
CardLocation
)
loc
,
seq
);
if
(
card
==
null
)
return
;
card
.
Update
(
packet
,
_duel
);
card
?
.
Update
(
packet
,
_duel
);
}
private
void
OnUpdateData
(
BinaryReader
packet
)
...
...
@@ -1087,7 +1091,8 @@ namespace WindBot.Game
return
;
}
if
(
card
.
Id
==
0
)
card
.
SetId
(
cardId
);
if
(
card
.
Id
==
0
)
card
.
SetId
(
cardId
);
int
reply
=
_ai
.
OnSelectEffectYn
(
card
,
desc
)
?
(
1
)
:
(
0
);
Connection
.
Send
(
CtosMessage
.
Response
,
reply
);
...
...
@@ -1448,11 +1453,7 @@ namespace WindBot.Game
ClientCard
equipCard
=
_duel
.
GetCard
(
equipCardControler
,
(
CardLocation
)
equipCardLocation
,
equipCardSequence
);
ClientCard
targetCard
=
_duel
.
GetCard
(
targetCardControler
,
(
CardLocation
)
targetCardLocation
,
targetCardSequence
);
if
(
equipCard
==
null
||
targetCard
==
null
)
return
;
if
(
equipCard
.
EquipTarget
!=
null
)
{
equipCard
.
EquipTarget
.
EquipCards
.
Remove
(
equipCard
);
}
equipCard
.
EquipTarget
?.
EquipCards
.
Remove
(
equipCard
);
equipCard
.
EquipTarget
=
targetCard
;
targetCard
.
EquipCards
.
Add
(
equipCard
);
}
...
...
@@ -1472,6 +1473,40 @@ namespace WindBot.Game
}
}
private
void
OnCardTarget
(
BinaryReader
packet
)
{
int
ownerCardControler
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
ownerCardLocation
=
packet
.
ReadByte
();
int
ownerCardSequence
=
packet
.
ReadSByte
();
packet
.
ReadByte
();
int
targetCardControler
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
targetCardLocation
=
packet
.
ReadByte
();
int
targetCardSequence
=
packet
.
ReadSByte
();
packet
.
ReadByte
();
ClientCard
ownerCard
=
_duel
.
GetCard
(
ownerCardControler
,
(
CardLocation
)
ownerCardLocation
,
ownerCardSequence
);
ClientCard
targetCard
=
_duel
.
GetCard
(
targetCardControler
,
(
CardLocation
)
targetCardLocation
,
targetCardSequence
);
if
(
ownerCard
==
null
||
targetCard
==
null
)
return
;
ownerCard
.
TargetCards
.
Add
(
targetCard
);
targetCard
.
OwnTargets
.
Add
(
ownerCard
);
}
private
void
OnCancelTarget
(
BinaryReader
packet
)
{
int
ownerCardControler
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
ownerCardLocation
=
packet
.
ReadByte
();
int
ownerCardSequence
=
packet
.
ReadSByte
();
packet
.
ReadByte
();
int
targetCardControler
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
targetCardLocation
=
packet
.
ReadByte
();
int
targetCardSequence
=
packet
.
ReadSByte
();
packet
.
ReadByte
();
ClientCard
ownerCard
=
_duel
.
GetCard
(
ownerCardControler
,
(
CardLocation
)
ownerCardLocation
,
ownerCardSequence
);
ClientCard
targetCard
=
_duel
.
GetCard
(
targetCardControler
,
(
CardLocation
)
targetCardLocation
,
targetCardSequence
);
if
(
ownerCard
==
null
||
targetCard
==
null
)
return
;
ownerCard
.
TargetCards
.
Remove
(
targetCard
);
targetCard
.
OwnTargets
.
Remove
(
ownerCard
);
}
private
void
OnSummoning
(
BinaryReader
packet
)
{
_duel
.
LastSummonedCards
.
Clear
();
...
...
YGOSharp.OCGWrapper.Enums.dll
View file @
43086945
No preview for this file type
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