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
415dccdb
Commit
415dccdb
authored
May 29, 2018
by
mercury233
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/IceYGO/windbot
parents
beed24a4
0f71dc96
Changes
28
Show whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
3638 additions
and
860 deletions
+3638
-860
Decks/AI_DarkMagician.ydk
Decks/AI_DarkMagician.ydk
+57
-0
Decks/AI_LightswornShaddoldinosour.ydk
Decks/AI_LightswornShaddoldinosour.ydk
+1
-0
Game/AI/AIFunctions.cs
Game/AI/AIFunctions.cs
+70
-23
Game/AI/CardContainer.cs
Game/AI/CardContainer.cs
+14
-14
Game/AI/CardExtension.cs
Game/AI/CardExtension.cs
+32
-0
Game/AI/Decks/BlueEyesExecutor.cs
Game/AI/Decks/BlueEyesExecutor.cs
+1
-1
Game/AI/Decks/ChainBurnExecutor.cs
Game/AI/Decks/ChainBurnExecutor.cs
+868
-685
Game/AI/Decks/DarkMagicianExecutor.cs
Game/AI/Decks/DarkMagicianExecutor.cs
+1948
-0
Game/AI/Decks/LightswornShaddoldinosourExecutor.cs
Game/AI/Decks/LightswornShaddoldinosourExecutor.cs
+3
-3
Game/AI/Decks/SkyStrikerExecutor.cs
Game/AI/Decks/SkyStrikerExecutor.cs
+58
-56
Game/AI/DefaultExecutor.cs
Game/AI/DefaultExecutor.cs
+30
-3
Game/AI/Dialogs.cs
Game/AI/Dialogs.cs
+12
-3
Game/AI/Enums/Floodgate.cs
Game/AI/Enums/Floodgate.cs
+2
-1
Game/AI/Enums/ShouldBeDisabledBeforeItUseEffectMonster.cs
Game/AI/Enums/ShouldBeDisabledBeforeItUseEffectMonster.cs
+46
-0
Game/AI/Enums/ShouldNotBeMonsterTarget.cs
Game/AI/Enums/ShouldNotBeMonsterTarget.cs
+17
-0
Game/AI/Enums/ShouldNotBeSpellTarget.cs
Game/AI/Enums/ShouldNotBeSpellTarget.cs
+14
-0
Game/AI/Enums/ShouldNotBeTarget.cs
Game/AI/Enums/ShouldNotBeTarget.cs
+49
-0
Game/AI/Executor.cs
Game/AI/Executor.cs
+17
-0
Game/AI/Zones.cs
Game/AI/Zones.cs
+24
-0
Game/ClientCard.cs
Game/ClientCard.cs
+17
-0
Game/ClientField.cs
Game/ClientField.cs
+94
-0
Game/Duel.cs
Game/Duel.cs
+31
-0
Game/GameAI.cs
Game/GameAI.cs
+52
-0
Game/GameBehavior.cs
Game/GameBehavior.cs
+159
-69
Game/GameClient.cs
Game/GameClient.cs
+4
-1
Program.cs
Program.cs
+8
-0
WindBot.csproj
WindBot.csproj
+6
-0
WindBotInfo.cs
WindBotInfo.cs
+4
-1
No files found.
Decks/AI_DarkMagician.ydk
0 → 100644
View file @
415dccdb
#created by ...
#main
46986414
46986414
46986414
30603688
30603688
30603688
71007216
71007216
7084129
7084129
7084129
43722862
43722862
14558127
14558127
14824019
23434538
70117860
1784686
1784686
2314238
23314220
70368879
70368879
89739383
41735184
73616671
47222536
47222536
47222536
67775894
67775894
7922915
7922915
7922915
48680970
48680970
48680970
40605147
40605147
#extra
41721210
41721210
50954680
58074177
90036274
14577226
16691074
22110647
80117527
71384012
71384012
71384012
1482001
!side
Decks/AI_LightswornShaddoldinosour.ydk
View file @
415dccdb
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
80280944
80280944
48048590
48048590
77723643
77723643
77723643
55623480
55623480
30328508
30328508
30328508
30328508
...
...
Game/AI/AIFunctions.cs
View file @
415dccdb
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
YGOSharp.OCGWrapper.Enums
;
using
YGOSharp.OCGWrapper.Enums
;
namespace
WindBot.Game.AI
namespace
WindBot.Game.AI
{
{
public
class
AIFunctions
public
class
AIFunctions
...
@@ -151,14 +150,33 @@ namespace WindBot.Game.AI
...
@@ -151,14 +150,33 @@ namespace WindBot.Game.AI
return
bestMonster
;
return
bestMonster
;
}
}
public
ClientCard
GetOneEnemyBetterThanValue
(
int
value
,
bool
onlyATK
=
false
)
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
;
}
public
ClientCard
GetOneEnemyBetterThanValue
(
int
value
,
bool
onlyATK
=
false
,
bool
canBeTarget
=
false
)
{
{
ClientCard
bestCard
=
null
;
ClientCard
bestCard
=
null
;
int
bestValue
=
value
;
int
bestValue
=
value
;
for
(
int
i
=
0
;
i
<
7
;
++
i
)
for
(
int
i
=
0
;
i
<
7
;
++
i
)
{
{
ClientCard
card
=
Enemy
.
MonsterZone
[
i
];
ClientCard
card
=
Enemy
.
MonsterZone
[
i
];
if
(
card
==
null
||
card
.
Data
==
null
)
continue
;
if
(
card
==
null
||
card
.
Data
==
null
||
(
canBeTarget
&&
card
.
IsShouldNotBeTarget
())
)
continue
;
if
(
onlyATK
&&
card
.
IsDefense
())
continue
;
if
(
onlyATK
&&
card
.
IsDefense
())
continue
;
int
enemyValue
=
card
.
GetDefensePower
();
int
enemyValue
=
card
.
GetDefensePower
();
if
(
enemyValue
>=
bestValue
)
if
(
enemyValue
>=
bestValue
)
...
@@ -170,52 +188,52 @@ namespace WindBot.Game.AI
...
@@ -170,52 +188,52 @@ namespace WindBot.Game.AI
return
bestCard
;
return
bestCard
;
}
}
public
ClientCard
GetOneEnemyBetterThanMyBest
(
bool
onlyATK
=
false
)
public
ClientCard
GetOneEnemyBetterThanMyBest
(
bool
onlyATK
=
false
,
bool
canBeTarget
=
false
)
{
{
int
bestBotPower
=
GetBestPower
(
Bot
,
onlyATK
);
int
bestBotPower
=
GetBestPower
(
Bot
,
onlyATK
);
return
GetOneEnemyBetterThanValue
(
bestBotPower
,
onlyATK
);
return
GetOneEnemyBetterThanValue
(
bestBotPower
,
onlyATK
,
canBeTarget
);
}
}
public
ClientCard
GetProblematicEnemyCard
(
int
attack
=
0
)
public
ClientCard
GetProblematicEnemyCard
(
int
attack
=
0
,
bool
canBeTarget
=
false
)
{
{
ClientCard
card
=
Enemy
.
MonsterZone
.
GetFloodgate
();
ClientCard
card
=
Enemy
.
MonsterZone
.
GetFloodgate
(
canBeTarget
);
if
(
card
!=
null
)
if
(
card
!=
null
)
return
card
;
return
card
;
card
=
Enemy
.
SpellZone
.
GetFloodgate
();
card
=
Enemy
.
SpellZone
.
GetFloodgate
(
canBeTarget
);
if
(
card
!=
null
)
if
(
card
!=
null
)
return
card
;
return
card
;
card
=
Enemy
.
MonsterZone
.
GetDangerousMonster
();
card
=
Enemy
.
MonsterZone
.
GetDangerousMonster
(
canBeTarget
);
if
(
card
!=
null
)
if
(
card
!=
null
)
return
card
;
return
card
;
card
=
Enemy
.
MonsterZone
.
GetInvincibleMonster
();
card
=
Enemy
.
MonsterZone
.
GetInvincibleMonster
(
canBeTarget
);
if
(
card
!=
null
)
if
(
card
!=
null
)
return
card
;
return
card
;
if
(
attack
==
0
)
if
(
attack
==
0
)
attack
=
GetBestAttack
(
Bot
);
attack
=
GetBestAttack
(
Bot
);
return
GetOneEnemyBetterThanValue
(
attack
,
true
);
return
GetOneEnemyBetterThanValue
(
attack
,
true
,
canBeTarget
);
}
}
public
ClientCard
GetProblematicEnemyMonster
(
int
attack
=
0
)
public
ClientCard
GetProblematicEnemyMonster
(
int
attack
=
0
,
bool
canBeTarget
=
false
)
{
{
ClientCard
card
=
Enemy
.
MonsterZone
.
GetFloodgate
();
ClientCard
card
=
Enemy
.
MonsterZone
.
GetFloodgate
(
canBeTarget
);
if
(
card
!=
null
)
if
(
card
!=
null
)
return
card
;
return
card
;
card
=
Enemy
.
MonsterZone
.
GetDangerousMonster
();
card
=
Enemy
.
MonsterZone
.
GetDangerousMonster
(
canBeTarget
);
if
(
card
!=
null
)
if
(
card
!=
null
)
return
card
;
return
card
;
card
=
Enemy
.
MonsterZone
.
GetInvincibleMonster
();
card
=
Enemy
.
MonsterZone
.
GetInvincibleMonster
(
canBeTarget
);
if
(
card
!=
null
)
if
(
card
!=
null
)
return
card
;
return
card
;
if
(
attack
==
0
)
if
(
attack
==
0
)
attack
=
GetBestAttack
(
Bot
);
attack
=
GetBestAttack
(
Bot
);
return
GetOneEnemyBetterThanValue
(
attack
,
true
);
return
GetOneEnemyBetterThanValue
(
attack
,
true
,
canBeTarget
);
}
}
public
ClientCard
GetProblematicEnemySpell
()
public
ClientCard
GetProblematicEnemySpell
()
...
@@ -224,9 +242,9 @@ namespace WindBot.Game.AI
...
@@ -224,9 +242,9 @@ namespace WindBot.Game.AI
return
card
;
return
card
;
}
}
public
ClientCard
GetBestEnemyCard
(
bool
onlyFaceup
=
false
)
public
ClientCard
GetBestEnemyCard
(
bool
onlyFaceup
=
false
,
bool
canBeTarget
=
false
)
{
{
ClientCard
card
=
GetBestEnemyMonster
(
onlyFaceup
);
ClientCard
card
=
GetBestEnemyMonster
(
onlyFaceup
,
canBeTarget
);
if
(
card
!=
null
)
if
(
card
!=
null
)
return
card
;
return
card
;
...
@@ -237,25 +255,44 @@ namespace WindBot.Game.AI
...
@@ -237,25 +255,44 @@ namespace WindBot.Game.AI
return
null
;
return
null
;
}
}
public
ClientCard
GetBestEnemyMonster
(
bool
onlyFaceup
=
false
)
public
ClientCard
GetBestEnemyMonster
(
bool
onlyFaceup
=
false
,
bool
canBeTarget
=
false
)
{
{
ClientCard
card
=
GetProblematicEnemyMonster
();
ClientCard
card
=
GetProblematicEnemyMonster
(
0
,
canBeTarget
);
if
(
card
!=
null
)
if
(
card
!=
null
)
return
card
;
return
card
;
card
=
Enemy
.
MonsterZone
.
GetHighestAttackMonster
();
card
=
Enemy
.
MonsterZone
.
GetHighestAttackMonster
(
canBeTarget
);
if
(
card
!=
null
)
if
(
card
!=
null
)
return
card
;
return
card
;
List
<
ClientCard
>
monsters
=
Enemy
.
GetMonsters
();
List
<
ClientCard
>
monsters
=
Enemy
.
GetMonsters
();
// after GetHighestAttackMonster, the left monsters must be face-down.
// after GetHighestAttackMonster, the left monsters must be face-down.
if
(
monsters
.
Count
>
0
&&
!
onlyFaceup
)
if
(
monsters
.
Count
>
0
&&
!
onlyFaceup
&&
(!
canBeTarget
||
!
card
.
IsShouldNotBeTarget
())
)
return
monsters
[
0
];
return
monsters
[
0
];
return
null
;
return
null
;
}
}
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
;
}
public
ClientCard
GetBestEnemySpell
(
bool
onlyFaceup
=
false
)
public
ClientCard
GetBestEnemySpell
(
bool
onlyFaceup
=
false
)
{
{
ClientCard
card
=
GetProblematicEnemySpell
();
ClientCard
card
=
GetProblematicEnemySpell
();
...
@@ -337,6 +374,16 @@ namespace WindBot.Game.AI
...
@@ -337,6 +374,16 @@ namespace WindBot.Game.AI
return
count
;
return
count
;
}
}
public
bool
ChainContainPlayer
(
int
player
)
{
foreach
(
ClientCard
card
in
Duel
.
CurrentChain
)
{
if
(
card
.
Controller
==
player
)
return
true
;
}
return
false
;
}
public
bool
HasChainedTrap
(
int
player
)
public
bool
HasChainedTrap
(
int
player
)
{
{
foreach
(
ClientCard
card
in
Duel
.
CurrentChain
)
foreach
(
ClientCard
card
in
Duel
.
CurrentChain
)
...
...
Game/AI/CardContainer.cs
View file @
415dccdb
...
@@ -6,13 +6,13 @@ namespace WindBot.Game.AI
...
@@ -6,13 +6,13 @@ namespace WindBot.Game.AI
{
{
public
static
class
CardContainer
public
static
class
CardContainer
{
{
public
static
ClientCard
GetHighestAttackMonster
(
this
IEnumerable
<
ClientCard
>
cards
)
public
static
ClientCard
GetHighestAttackMonster
(
this
IEnumerable
<
ClientCard
>
cards
,
bool
canBeTarget
=
false
)
{
{
int
highestAtk
=
0
;
int
highestAtk
=
0
;
ClientCard
selected
=
null
;
ClientCard
selected
=
null
;
foreach
(
ClientCard
card
in
cards
)
foreach
(
ClientCard
card
in
cards
)
{
{
if
(
card
==
null
||
card
.
Data
==
null
||
card
.
IsFacedown
())
continue
;
if
(
card
==
null
||
card
.
Data
==
null
||
card
.
IsFacedown
()
||
(
canBeTarget
&&
card
.
IsShouldNotBeTarget
())
)
continue
;
if
(
card
.
HasType
(
CardType
.
Monster
)
&&
card
.
Attack
>
highestAtk
)
if
(
card
.
HasType
(
CardType
.
Monster
)
&&
card
.
Attack
>
highestAtk
)
{
{
highestAtk
=
card
.
Attack
;
highestAtk
=
card
.
Attack
;
...
@@ -22,13 +22,13 @@ namespace WindBot.Game.AI
...
@@ -22,13 +22,13 @@ namespace WindBot.Game.AI
return
selected
;
return
selected
;
}
}
public
static
ClientCard
GetHighestDefenseMonster
(
this
IEnumerable
<
ClientCard
>
cards
)
public
static
ClientCard
GetHighestDefenseMonster
(
this
IEnumerable
<
ClientCard
>
cards
,
bool
canBeTarget
=
false
)
{
{
int
highestDef
=
0
;
int
highestDef
=
0
;
ClientCard
selected
=
null
;
ClientCard
selected
=
null
;
foreach
(
ClientCard
card
in
cards
)
foreach
(
ClientCard
card
in
cards
)
{
{
if
(
card
==
null
||
card
.
Data
==
null
||
card
.
IsFacedown
())
continue
;
if
(
card
==
null
||
card
.
Data
==
null
||
card
.
IsFacedown
()
||
(
canBeTarget
&&
card
.
IsShouldNotBeTarget
())
)
continue
;
if
(
card
.
HasType
(
CardType
.
Monster
)
&&
card
.
Defense
>
highestDef
)
if
(
card
.
HasType
(
CardType
.
Monster
)
&&
card
.
Defense
>
highestDef
)
{
{
highestDef
=
card
.
Defense
;
highestDef
=
card
.
Defense
;
...
@@ -38,13 +38,13 @@ namespace WindBot.Game.AI
...
@@ -38,13 +38,13 @@ namespace WindBot.Game.AI
return
selected
;
return
selected
;
}
}
public
static
ClientCard
GetLowestAttackMonster
(
this
IEnumerable
<
ClientCard
>
cards
)
public
static
ClientCard
GetLowestAttackMonster
(
this
IEnumerable
<
ClientCard
>
cards
,
bool
canBeTarget
=
false
)
{
{
int
lowestAtk
=
0
;
int
lowestAtk
=
0
;
ClientCard
selected
=
null
;
ClientCard
selected
=
null
;
foreach
(
ClientCard
card
in
cards
)
foreach
(
ClientCard
card
in
cards
)
{
{
if
(
card
==
null
||
card
.
Data
==
null
||
card
.
IsFacedown
())
continue
;
if
(
card
==
null
||
card
.
Data
==
null
||
card
.
IsFacedown
()
||
(
canBeTarget
&&
card
.
IsShouldNotBeTarget
())
)
continue
;
if
(
lowestAtk
==
0
&&
card
.
HasType
(
CardType
.
Monster
)
||
if
(
lowestAtk
==
0
&&
card
.
HasType
(
CardType
.
Monster
)
||
card
.
HasType
(
CardType
.
Monster
)
&&
card
.
Attack
<
lowestAtk
)
card
.
HasType
(
CardType
.
Monster
)
&&
card
.
Attack
<
lowestAtk
)
{
{
...
@@ -55,13 +55,13 @@ namespace WindBot.Game.AI
...
@@ -55,13 +55,13 @@ namespace WindBot.Game.AI
return
selected
;
return
selected
;
}
}
public
static
ClientCard
GetLowestDefenseMonster
(
this
IEnumerable
<
ClientCard
>
cards
)
public
static
ClientCard
GetLowestDefenseMonster
(
this
IEnumerable
<
ClientCard
>
cards
,
bool
canBeTarget
=
false
)
{
{
int
lowestDef
=
0
;
int
lowestDef
=
0
;
ClientCard
selected
=
null
;
ClientCard
selected
=
null
;
foreach
(
ClientCard
card
in
cards
)
foreach
(
ClientCard
card
in
cards
)
{
{
if
(
card
==
null
||
card
.
Data
==
null
||
card
.
IsFacedown
())
continue
;
if
(
card
==
null
||
card
.
Data
==
null
||
card
.
IsFacedown
()
||
(
canBeTarget
&&
card
.
IsShouldNotBeTarget
())
)
continue
;
if
(
lowestDef
==
0
&&
card
.
HasType
(
CardType
.
Monster
)
||
if
(
lowestDef
==
0
&&
card
.
HasType
(
CardType
.
Monster
)
||
card
.
HasType
(
CardType
.
Monster
)
&&
card
.
Defense
<
lowestDef
)
card
.
HasType
(
CardType
.
Monster
)
&&
card
.
Defense
<
lowestDef
)
{
{
...
@@ -149,31 +149,31 @@ namespace WindBot.Game.AI
...
@@ -149,31 +149,31 @@ namespace WindBot.Game.AI
return
cardlist
;
return
cardlist
;
}
}
public
static
ClientCard
GetInvincibleMonster
(
this
IEnumerable
<
ClientCard
>
cards
)
public
static
ClientCard
GetInvincibleMonster
(
this
IEnumerable
<
ClientCard
>
cards
,
bool
canBeTarget
=
false
)
{
{
foreach
(
ClientCard
card
in
cards
)
foreach
(
ClientCard
card
in
cards
)
{
{
if
(
card
!=
null
&&
card
.
IsMonsterInvincible
()
&&
card
.
IsFaceup
())
if
(
card
!=
null
&&
card
.
IsMonsterInvincible
()
&&
card
.
IsFaceup
()
&&
(!
canBeTarget
||
!
card
.
IsShouldNotBeTarget
())
)
return
card
;
return
card
;
}
}
return
null
;
return
null
;
}
}
public
static
ClientCard
GetDangerousMonster
(
this
IEnumerable
<
ClientCard
>
cards
)
public
static
ClientCard
GetDangerousMonster
(
this
IEnumerable
<
ClientCard
>
cards
,
bool
canBeTarget
=
false
)
{
{
foreach
(
ClientCard
card
in
cards
)
foreach
(
ClientCard
card
in
cards
)
{
{
if
(
card
!=
null
&&
card
.
IsMonsterDangerous
()
&&
card
.
IsFaceup
())
if
(
card
!=
null
&&
card
.
IsMonsterDangerous
()
&&
card
.
IsFaceup
()
&&
(!
canBeTarget
||
!
card
.
IsShouldNotBeTarget
())
)
return
card
;
return
card
;
}
}
return
null
;
return
null
;
}
}
public
static
ClientCard
GetFloodgate
(
this
IEnumerable
<
ClientCard
>
cards
)
public
static
ClientCard
GetFloodgate
(
this
IEnumerable
<
ClientCard
>
cards
,
bool
canBeTarget
=
false
)
{
{
foreach
(
ClientCard
card
in
cards
)
foreach
(
ClientCard
card
in
cards
)
{
{
if
(
card
!=
null
&&
card
.
IsFloodgate
()
&&
card
.
IsFaceup
())
if
(
card
!=
null
&&
card
.
IsFloodgate
()
&&
card
.
IsFaceup
()
&&
(!
canBeTarget
||
!
card
.
IsShouldNotBeTarget
())
)
return
card
;
return
card
;
}
}
return
null
;
return
null
;
...
...
Game/AI/CardExtension.cs
View file @
415dccdb
...
@@ -29,6 +29,38 @@ namespace WindBot.Game.AI
...
@@ -29,6 +29,38 @@ namespace WindBot.Game.AI
return
!
card
.
IsDisabled
()
&&
Enum
.
IsDefined
(
typeof
(
PreventActivationEffectInBattle
),
card
.
Id
);
return
!
card
.
IsDisabled
()
&&
Enum
.
IsDefined
(
typeof
(
PreventActivationEffectInBattle
),
card
.
Id
);
}
}
/// <summary>
/// Is this card shouldn't be tried to be selected as target?
/// </summary>
public
static
bool
IsShouldNotBeTarget
(
this
ClientCard
card
)
{
return
!
card
.
IsDisabled
()
&&
Enum
.
IsDefined
(
typeof
(
ShouldNotBeTarget
),
card
.
Id
);
}
/// <summary>
/// Is this card shouldn't be tried to be selected as target of monster?
/// </summary>
public
static
bool
IsShouldNotBeMonsterTarget
(
this
ClientCard
card
)
{
return
!
card
.
IsDisabled
()
&&
Enum
.
IsDefined
(
typeof
(
ShouldNotBeMonsterTarget
),
card
.
Id
);
}
/// <summary>
/// Is this card shouldn't be tried to be selected as target of spell & trap?
/// </summary>
public
static
bool
IsShouldNotBeSpellTrapTarget
(
this
ClientCard
card
)
{
return
!
card
.
IsDisabled
()
&&
Enum
.
IsDefined
(
typeof
(
ShouldNotBeSpellTrapTarget
),
card
.
Id
);
}
/// <summary>
/// Is this monster should be disabled (with Breakthrough Skill) before it use effect and release or banish itself?
/// </summary>
public
static
bool
IsMonsterShouldBeDisabledBeforeItUseEffect
(
this
ClientCard
card
)
{
return
!
card
.
IsDisabled
()
&&
Enum
.
IsDefined
(
typeof
(
ShouldBeDisabledBeforeItUseEffectMonster
),
card
.
Id
);
}
public
static
bool
IsFloodgate
(
this
ClientCard
card
)
public
static
bool
IsFloodgate
(
this
ClientCard
card
)
{
{
return
Enum
.
IsDefined
(
typeof
(
Floodgate
),
card
.
Id
);
return
Enum
.
IsDefined
(
typeof
(
Floodgate
),
card
.
Id
);
...
...
Game/AI/Decks/BlueEyesExecutor.cs
View file @
415dccdb
...
@@ -292,7 +292,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -292,7 +292,7 @@ namespace WindBot.Game.AI.Decks
}
}
if
(
CanDealWithUsedAlternativeWhiteDragon
())
if
(
CanDealWithUsedAlternativeWhiteDragon
())
{
{
target
=
AI
.
Utils
.
GetBestEnemyMonster
();
target
=
AI
.
Utils
.
GetBestEnemyMonster
(
false
,
true
);
AI
.
SelectCard
(
target
);
AI
.
SelectCard
(
target
);
UsedAlternativeWhiteDragon
.
Add
(
Card
);
UsedAlternativeWhiteDragon
.
Add
(
Card
);
return
true
;
return
true
;
...
...
Game/AI/Decks/ChainBurnExecutor.cs
View file @
415dccdb
...
@@ -11,7 +11,8 @@ namespace WindBot.Game.AI.Decks
...
@@ -11,7 +11,8 @@ namespace WindBot.Game.AI.Decks
{
{
public
class
CardId
public
class
CardId
{
{
public
const
int
SandaionTheTimloard
=
100227025
;
public
const
int
SandaionTheTimelord
=
100227025
;
public
const
int
MichionTimelord
=
100227021
;
public
const
int
Mathematician
=
41386308
;
public
const
int
Mathematician
=
41386308
;
public
const
int
DiceJar
=
3549275
;
public
const
int
DiceJar
=
3549275
;
public
const
int
CardcarD
=
45812361
;
public
const
int
CardcarD
=
45812361
;
...
@@ -48,16 +49,18 @@ namespace WindBot.Game.AI.Decks
...
@@ -48,16 +49,18 @@ namespace WindBot.Game.AI.Decks
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
PotOfDesires
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
PotOfDesires
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
PotOfDuality
,
PotOfDualityeff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
PotOfDuality
,
PotOfDualityeff
);
//normal summon
//normal summon
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
MichionTimelord
,
MichionTimelordsummon
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
SandaionTheTimelord
,
SandaionTheTimelord_summon
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
Mathematician
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
Mathematician
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Mathematician
,
Mathematicianeff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Mathematician
,
Mathematicianeff
);
AddExecutor
(
ExecutorType
.
MonsterSet
,
CardId
.
DiceJar
);
AddExecutor
(
ExecutorType
.
MonsterSet
,
CardId
.
DiceJar
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
DiceJar
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
DiceJar
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
CardcarD
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
AbouluteKingBackJack
,
AbouluteKingBackJacksummon
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
AbouluteKingBackJack
,
AbouluteKingBackJacksummon
);
AddExecutor
(
ExecutorType
.
MonsterSet
,
CardId
.
AbouluteKingBackJack
);
AddExecutor
(
ExecutorType
.
MonsterSet
,
CardId
.
AbouluteKingBackJack
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
AbouluteKingBackJack
,
AbouluteKingBackJackeff
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
CardcarD
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
MichionTimelord
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
SandaionTheTimloard
,
SandaionTheTimloard_summon
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
SandaionTheTimelord
,
SandaionTheTimelordeff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
SandaionTheTimloard
,
SandaionTheTimloardeff
);
// Set traps
// Set traps
AddExecutor
(
ExecutorType
.
SpellSet
,
CardId
.
Waboku
);
AddExecutor
(
ExecutorType
.
SpellSet
,
CardId
.
Waboku
);
AddExecutor
(
ExecutorType
.
SpellSet
,
CardId
.
ThreateningRoar
);
AddExecutor
(
ExecutorType
.
SpellSet
,
CardId
.
ThreateningRoar
);
...
@@ -71,31 +74,33 @@ namespace WindBot.Game.AI.Decks
...
@@ -71,31 +74,33 @@ namespace WindBot.Game.AI.Decks
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
BalanceOfJudgment
,
BalanceOfJudgmenteff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
BalanceOfJudgment
,
BalanceOfJudgmenteff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
AccuulatedFortune
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
AccuulatedFortune
);
//battle
//battle
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
BlazingMirrorForce
,
BlazingMirrorForceeff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
MagicCylinder
,
MagicCylindereff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
ThreateningRoar
,
ThreateningRoareff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
ThreateningRoar
,
ThreateningRoareff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Waboku
,
Wabokueff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Waboku
,
Wabokueff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
BattleFader
,
BattleFadereff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
BattleFader
,
BattleFadereff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
MagicCylinder
,
MagicCylindereff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
BlazingMirrorForce
,
BlazingMirrorForceeff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
RingOfDestruction
,
Ring_act
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
RingOfDestruction
,
Ring_act
);
//chain
//chain
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
JustDesserts
,
JustDessertseff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
JustDesserts
,
JustDessertseff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
OjamaTrio
,
OjamaTrioeff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Ceasefire
,
Ceasefireeff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Ceasefire
,
Ceasefireeff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
SecretBlast
,
SecretBlasteff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
SecretBlast
,
SecretBlasteff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
SectetBarrel
,
SectetBarreleff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
SectetBarrel
,
SectetBarreleff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
RecklessGreed
,
RecklessGreedeff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
RecklessGreed
,
RecklessGreedeff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
OjamaTrio
,
OjamaTrioeff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
AbouluteKingBackJack
,
AbouluteKingBackJackeff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
ChainStrike
,
ChainStrikeeff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
ChainStrike
,
ChainStrikeeff
);
//sp
//sp
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
Linkuriboh
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
Linkuriboh
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Linkuriboh
,
Linkuriboheff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Linkuriboh
,
Linkuriboheff
);
AddExecutor
(
ExecutorType
.
Repos
,
MonsterRepos
);
}
}
public
int
[]
all_List
()
public
int
[]
all_List
()
{
{
return
new
[]
return
new
[]
{
{
CardId
.
SandaionTheTimloard
,
CardId
.
SandaionTheTimelord
,
CardId
.
MichionTimelord
,
CardId
.
Mathematician
,
CardId
.
Mathematician
,
CardId
.
DiceJar
,
CardId
.
DiceJar
,
CardId
.
CardcarD
,
CardId
.
CardcarD
,
...
@@ -143,7 +148,8 @@ namespace WindBot.Game.AI.Decks
...
@@ -143,7 +148,8 @@ namespace WindBot.Game.AI.Decks
public
int
[]
AbouluteKingBackJack_List_2
()
public
int
[]
AbouluteKingBackJack_List_2
()
{
{
return
new
[]
{
return
new
[]
{
CardId
.
SandaionTheTimloard
,
CardId
.
MichionTimelord
,
CardId
.
SandaionTheTimelord
,
CardId
.
PotOfDesires
,
CardId
.
PotOfDesires
,
CardId
.
Mathematician
,
CardId
.
Mathematician
,
CardId
.
DiceJar
,
CardId
.
DiceJar
,
...
@@ -186,7 +192,8 @@ namespace WindBot.Game.AI.Decks
...
@@ -186,7 +192,8 @@ namespace WindBot.Game.AI.Decks
return
new
[]
return
new
[]
{
{
CardId
.
PotOfDesires
,
CardId
.
PotOfDesires
,
CardId
.
SandaionTheTimloard
,
CardId
.
MichionTimelord
,
CardId
.
SandaionTheTimelord
,
CardId
.
BattleFader
,
CardId
.
BattleFader
,
CardId
.
Waboku
,
CardId
.
Waboku
,
...
@@ -218,8 +225,9 @@ namespace WindBot.Game.AI.Decks
...
@@ -218,8 +225,9 @@ namespace WindBot.Game.AI.Decks
}
}
public
bool
Has_prevent_list_1
(
int
id
)
public
bool
Has_prevent_list_1
(
int
id
)
{
{
return
(
id
==
CardId
.
SandaionTheTimloard
||
return
(
id
==
CardId
.
SandaionTheTimelord
||
id
==
CardId
.
BattleFader
id
==
CardId
.
BattleFader
||
id
==
CardId
.
MichionTimelord
);
);
}
}
bool
no_sp
=
false
;
bool
no_sp
=
false
;
...
@@ -228,11 +236,12 @@ namespace WindBot.Game.AI.Decks
...
@@ -228,11 +236,12 @@ namespace WindBot.Game.AI.Decks
int
expected_blood
=
0
;
int
expected_blood
=
0
;
bool
prevent_used
=
false
;
bool
prevent_used
=
false
;
int
preventcount
=
0
;
int
preventcount
=
0
;
bool
battleprevent
=
false
;
bool
OjamaTrioused
=
false
;
bool
OjamaTrioused
=
false
;
bool
OjamaTrioused_draw
=
false
;
bool
OjamaTrioused_draw
=
false
;
bool
OjamaTrioused_do
=
false
;
bool
drawfirst
=
false
;
bool
drawfirst
=
false
;
bool
Linkuribohused
=
true
;
bool
Linkuribohused
=
true
;
bool
Timelord_check
=
false
;
int
Waboku_count
=
0
;
int
Waboku_count
=
0
;
int
Roar_count
=
0
;
int
Roar_count
=
0
;
int
strike_count
=
0
;
int
strike_count
=
0
;
...
@@ -242,6 +251,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -242,6 +251,7 @@ namespace WindBot.Game.AI.Decks
int
just_count
=
0
;
int
just_count
=
0
;
int
Ojama_count
=
0
;
int
Ojama_count
=
0
;
int
HasAccuulatedFortune
=
0
;
int
HasAccuulatedFortune
=
0
;
public
override
bool
OnSelectHand
()
public
override
bool
OnSelectHand
()
{
{
return
true
;
return
true
;
...
@@ -249,17 +259,16 @@ namespace WindBot.Game.AI.Decks
...
@@ -249,17 +259,16 @@ namespace WindBot.Game.AI.Decks
public
override
void
OnNewTurn
()
public
override
void
OnNewTurn
()
{
{
if
(
Bot
.
HasInHand
(
CardId
.
SandaionTheTimelord
)
||
Bot
.
HasInHand
(
CardId
.
MichionTimelord
))
Logger
.
DebugWriteLine
(
"2222222222222222SandaionTheTimelord"
);
no_sp
=
false
;
no_sp
=
false
;
prevent_used
=
false
;
prevent_used
=
false
;
Linkuribohused
=
true
;
Linkuribohused
=
true
;
Timelord_check
=
false
;
}
}
public
override
void
OnNewPhase
()
public
override
void
OnNewPhase
()
{
{
preventcount
=
0
;
preventcount
=
0
;
battleprevent
=
false
;
OjamaTrioused
=
false
;
OjamaTrioused
=
false
;
IList
<
ClientCard
>
trap
=
Bot
.
GetSpells
();
IList
<
ClientCard
>
trap
=
Bot
.
GetSpells
();
...
@@ -270,24 +279,35 @@ namespace WindBot.Game.AI.Decks
...
@@ -270,24 +279,35 @@ namespace WindBot.Game.AI.Decks
if
(
Has_prevent_list_0
(
card
.
Id
))
if
(
Has_prevent_list_0
(
card
.
Id
))
{
{
preventcount
++;
preventcount
++;
battleprevent
=
true
;
}
}
}
}
foreach
(
ClientCard
card
in
monster
)
foreach
(
ClientCard
card
in
monster
)
{
{
if
(
Has_prevent_list_1
(
card
.
Id
))
if
(
Has_prevent_list_1
(
card
.
Id
))
{
{
preventcount
++;
preventcount
++;
battleprevent
=
true
;
}
}
}
}
foreach
(
ClientCard
card
in
monster
)
{
if
(
Bot
.
HasInMonstersZone
(
CardId
.
SandaionTheTimelord
)
||
Bot
.
HasInMonstersZone
(
CardId
.
MichionTimelord
))
{
prevent_used
=
true
;
Timelord_check
=
true
;
}
}
if
(
prevent_used
&&
Timelord_check
)
{
if
(!
Bot
.
HasInMonstersZone
(
CardId
.
SandaionTheTimelord
)
||
!
Bot
.
HasInMonstersZone
(
CardId
.
MichionTimelord
))
prevent_used
=
false
;
}
expected_blood
=
0
;
expected_blood
=
0
;
one_turn_kill
=
false
;
one_turn_kill
=
false
;
one_turn_kill_1
=
false
;
one_turn_kill_1
=
false
;
OjamaTrioused_draw
=
false
;
OjamaTrioused_draw
=
false
;
OjamaTrioused_do
=
false
;
drawfirst
=
false
;
drawfirst
=
false
;
HasAccuulatedFortune
=
0
;
HasAccuulatedFortune
=
0
;
strike_count
=
0
;
strike_count
=
0
;
...
@@ -348,11 +368,6 @@ namespace WindBot.Game.AI.Decks
...
@@ -348,11 +368,6 @@ namespace WindBot.Game.AI.Decks
Roar_count
++;
Roar_count
++;
}
}
if
(
Bot
.
HasInSpellZone
(
CardId
.
OjamaTrio
)
&&
Enemy
.
GetMonsterCount
()
<=
2
&&
Enemy
.
GetMonsterCount
()
>=
1
)
{
if
(
HasAccuulatedFortune
>
0
)
OjamaTrioused_draw
=
true
;
}
expected_blood
=
(
Enemy
.
GetMonsterCount
()
*
500
*
just_count
+
Enemy
.
GetFieldHandCount
()
*
200
*
barrel_count
+
Enemy
.
GetFieldCount
()
*
300
*
blast_count
);
expected_blood
=
(
Enemy
.
GetMonsterCount
()
*
500
*
just_count
+
Enemy
.
GetFieldHandCount
()
*
200
*
barrel_count
+
Enemy
.
GetFieldCount
()
*
300
*
blast_count
);
if
(
Enemy
.
LifePoints
<=
expected_blood
&&
Duel
.
Player
==
1
)
if
(
Enemy
.
LifePoints
<=
expected_blood
&&
Duel
.
Player
==
1
)
{
{
...
@@ -366,21 +381,35 @@ namespace WindBot.Game.AI.Decks
...
@@ -366,21 +381,35 @@ namespace WindBot.Game.AI.Decks
if
(
barrel_count
>=
2
)
barrel_count
=
1
;
if
(
barrel_count
>=
2
)
barrel_count
=
1
;
if
(
Waboku_count
>=
2
)
Waboku_count
=
1
;
if
(
Waboku_count
>=
2
)
Waboku_count
=
1
;
if
(
Roar_count
>=
2
)
Roar_count
=
1
;
if
(
Roar_count
>=
2
)
Roar_count
=
1
;
if
(
strike_count
>=
2
)
strike_count
=
1
;
int
currentchain
=
0
;
int
currentchain
=
0
;
if
(
OjamaTrioused_d
raw
)
if
(
OjamaTrioused_d
o
)
currentchain
=
Duel
.
CurrentChain
.
Count
+
blast_count
+
just_count
+
barrel_count
+
Waboku_count
+
Waboku_count
+
Roar_count
+
greed_count
+
strike_count
+
Ojama_count
;
currentchain
=
Duel
.
CurrentChain
.
Count
+
blast_count
+
just_count
+
barrel_count
+
Waboku_count
+
Waboku_count
+
Roar_count
+
greed_count
+
Ojama_count
;
else
else
currentchain
=
Duel
.
CurrentChain
.
Count
+
blast_count
+
just_count
+
barrel_count
+
Waboku_count
+
Waboku_count
+
greed_count
+
Roar_count
+
strike_count
;
currentchain
=
Duel
.
CurrentChain
.
Count
+
blast_count
+
just_count
+
barrel_count
+
Waboku_count
+
Waboku_count
+
greed_count
+
Roar_count
;
//if (currentchain >= 3 && Duel.Player == 1) drawfirst = true;
//if (currentchain >= 3 && Duel.Player == 1) drawfirst = true;
currentchain
=
Duel
.
CurrentChain
.
Count
+
blast_count
+
just_count
+
barrel_count
;
if
(
Bot
.
HasInSpellZone
(
CardId
.
ChainStrike
))
expected_blood
=
(
Enemy
.
GetMonsterCount
()
*
500
*
just_count
+
Enemy
.
GetFieldHandCount
()
*
200
*
barrel_count
+
Enemy
.
GetFieldCount
()
*
300
*
blast_count
+(
currentchain
+
1
)*
400
);
/*if (!one_turn_kill && Enemy.LifePoints <= expected_blood && Duel.Player == 1)
{
{
Logger.DebugWriteLine(" one_turn_kill_1");
if
(
strike_count
==
1
)
{
if
(
OjamaTrioused_do
)
expected_blood
=
((
Enemy
.
GetMonsterCount
()
+
3
)
*
500
*
just_count
+
Enemy
.
GetFieldHandCount
()
*
200
*
barrel_count
+
Enemy
.
GetFieldCount
()
*
300
*
blast_count
+
(
currentchain
+
1
)
*
400
);
else
expected_blood
=
(
Enemy
.
GetMonsterCount
()
*
500
*
just_count
+
Enemy
.
GetFieldHandCount
()
*
200
*
barrel_count
+
Enemy
.
GetFieldCount
()
*
300
*
blast_count
+
(
currentchain
+
1
)
*
400
);
}
else
{
if
(
OjamaTrioused_do
)
expected_blood
=
((
Enemy
.
GetMonsterCount
()
+
3
)
*
500
*
just_count
+
Enemy
.
GetFieldHandCount
()
*
200
*
barrel_count
+
Enemy
.
GetFieldCount
()
*
300
*
blast_count
+
(
currentchain
+
1
+
currentchain
+
2
)
*
400
);
else
expected_blood
=
(
Enemy
.
GetMonsterCount
()
*
500
*
just_count
+
Enemy
.
GetFieldHandCount
()
*
200
*
barrel_count
+
Enemy
.
GetFieldCount
()
*
300
*
blast_count
+
(
currentchain
+
1
+
currentchain
+
2
)
*
400
);
}
if
(!
one_turn_kill
&&
Enemy
.
LifePoints
<=
expected_blood
&&
Duel
.
Player
==
1
)
{
Logger
.
DebugWriteLine
(
" %%%%%%%%%%%%%%%%%one_turn_kill_1"
);
one_turn_kill_1
=
true
;
one_turn_kill_1
=
true
;
}*/
OjamaTrioused
=
true
;
}
}
}
}
...
@@ -406,11 +435,17 @@ namespace WindBot.Game.AI.Decks
...
@@ -406,11 +435,17 @@ namespace WindBot.Game.AI.Decks
if
(
Card
.
Id
==
CardId
.
OjamaTrio
&&
Bot
.
HasInSpellZone
(
CardId
.
OjamaTrio
))
return
false
;
if
(
Card
.
Id
==
CardId
.
OjamaTrio
&&
Bot
.
HasInSpellZone
(
CardId
.
OjamaTrio
))
return
false
;
return
(
Card
.
IsTrap
()
||
Card
.
HasType
(
CardType
.
QuickPlay
))
&&
Bot
.
GetSpellCountWithoutField
()
<
5
;
return
(
Card
.
IsTrap
()
||
Card
.
HasType
(
CardType
.
QuickPlay
))
&&
Bot
.
GetSpellCountWithoutField
()
<
5
;
}
}
private
bool
SandaionTheTimloard_summon
()
private
bool
MichionTimelordsummon
()
{
{
if
(!
battleprevent
)
if
(
Duel
.
Turn
==
1
)
return
true
;
return
false
;
return
false
;
return
true
;
}
private
bool
SandaionTheTimelord_summon
()
{
Logger
.
DebugWriteLine
(
"&&&&&&&&&SandaionTheTimelord_summon"
);
return
true
;
}
}
private
bool
AbouluteKingBackJacksummon
()
private
bool
AbouluteKingBackJacksummon
()
{
{
...
@@ -434,34 +469,28 @@ namespace WindBot.Game.AI.Decks
...
@@ -434,34 +469,28 @@ namespace WindBot.Game.AI.Decks
AI
.
SelectCard
(
pot_list
());
AI
.
SelectCard
(
pot_list
());
return
true
;
return
true
;
}
}
private
bool
BlazingMirrorForceeff
()
{
if
(
prevent_used
)
return
false
;
IList
<
ClientCard
>
list
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
monster
in
Enemy
.
GetMonsters
())
{
list
.
Add
(
monster
);
}
//if (GetTotalATK(list) / 2 >= Bot.LifePoints) return false;
if
(
GetTotalATK
(
list
)
<
3000
)
return
false
;
return
Enemy
.
HasAttackingMonster
()
&&
DefaultUniqueTrap
();
}
private
bool
ThreateningRoareff
()
private
bool
ThreateningRoareff
()
{
{
if
(
one_turn_kill_1
)
return
UniqueFaceupSpell
();
if
(
drawfirst
)
return
true
;
if
(
drawfirst
)
return
true
;
if
(
DefaultOnBecomeTarget
())
return
DefaultUniqueTrap
();
if
(
DefaultOnBecomeTarget
())
{
prevent_used
=
true
;
return
true
;
}
if
(
prevent_used
||
Duel
.
Phase
!=
DuelPhase
.
BattleStart
)
return
false
;
if
(
prevent_used
||
Duel
.
Phase
!=
DuelPhase
.
BattleStart
)
return
false
;
prevent_used
=
true
;
prevent_used
=
true
;
return
DefaultUniqueTrap
();
return
DefaultUniqueTrap
();
}
}
private
bool
SandaionTheTim
loardeff
()
private
bool
SandaionTheTim
elordeff
()
{
{
Logger
.
DebugWriteLine
(
"***********SandaionTheTimelordeff"
);
prevent_used
=
true
;
return
true
;
return
true
;
}
}
private
bool
Wabokueff
()
private
bool
Wabokueff
()
{
{
if
(
one_turn_kill_1
)
return
UniqueFaceupSpell
();
if
(
drawfirst
)
if
(
drawfirst
)
{
{
Linkuribohused
=
false
;
Linkuribohused
=
false
;
...
@@ -470,7 +499,8 @@ namespace WindBot.Game.AI.Decks
...
@@ -470,7 +499,8 @@ namespace WindBot.Game.AI.Decks
if
(
DefaultOnBecomeTarget
())
if
(
DefaultOnBecomeTarget
())
{
{
Linkuribohused
=
false
;
Linkuribohused
=
false
;
return
DefaultUniqueTrap
();
prevent_used
=
true
;
return
true
;
}
}
if
(
prevent_used
||
Duel
.
Player
==
0
||
Duel
.
Phase
!=
DuelPhase
.
BattleStart
)
return
false
;
if
(
prevent_used
||
Duel
.
Player
==
0
||
Duel
.
Phase
!=
DuelPhase
.
BattleStart
)
return
false
;
prevent_used
=
true
;
prevent_used
=
true
;
...
@@ -479,16 +509,38 @@ namespace WindBot.Game.AI.Decks
...
@@ -479,16 +509,38 @@ namespace WindBot.Game.AI.Decks
}
}
private
bool
BattleFadereff
()
private
bool
BattleFadereff
()
{
{
if
(
AI
.
Utils
.
ChainContainsCard
(
CardId
.
BlazingMirrorForce
)
||
AI
.
Utils
.
ChainContainsCard
(
CardId
.
MagicCylinder
))
return
false
;
if
(
prevent_used
||
Duel
.
Player
==
0
)
return
false
;
if
(
prevent_used
||
Duel
.
Player
==
0
)
return
false
;
AI
.
SelectPosition
(
CardPosition
.
FaceUpDefence
);
AI
.
SelectPosition
(
CardPosition
.
FaceUpDefence
);
prevent_used
=
true
;
prevent_used
=
true
;
return
true
;
return
true
;
}
}
private
bool
BlazingMirrorForceeff
()
{
if
(
prevent_used
)
return
false
;
IList
<
ClientCard
>
list
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
monster
in
Enemy
.
GetMonsters
())
{
if
(
monster
.
IsAttack
())
list
.
Add
(
monster
);
}
if
(
GetTotalATK
(
list
)
/
2
>=
Bot
.
LifePoints
)
return
false
;
Logger
.
DebugWriteLine
(
"!!!!!!!!BlazingMirrorForceeff"
+
GetTotalATK
(
list
)
/
2
);
if
(
GetTotalATK
(
list
)
/
2
>=
Enemy
.
LifePoints
)
return
DefaultUniqueTrap
();
if
(
GetTotalATK
(
list
)
<
3000
)
return
false
;
prevent_used
=
true
;
return
DefaultUniqueTrap
();
}
private
bool
MagicCylindereff
()
private
bool
MagicCylindereff
()
{
{
if
(
prevent_used
)
return
false
;
if
(
prevent_used
)
return
false
;
if
(
Bot
.
LifePoints
<=
Enemy
.
BattlingMonster
.
Attack
)
return
DefaultUniqueTrap
();
if
(
Bot
.
LifePoints
<=
Enemy
.
BattlingMonster
.
Attack
)
return
DefaultUniqueTrap
();
if
(
Enemy
.
BattlingMonster
.
Attack
>
1800
)
return
DefaultUniqueTrap
();
if
(
Enemy
.
LifePoints
<=
Enemy
.
BattlingMonster
.
Attack
)
return
DefaultUniqueTrap
();
if
(
Enemy
.
BattlingMonster
.
Attack
>
1800
)
return
DefaultUniqueTrap
();
return
false
;
return
false
;
}
}
public
bool
Ring_act
()
public
bool
Ring_act
()
...
@@ -497,7 +549,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -497,7 +549,7 @@ namespace WindBot.Game.AI.Decks
ClientCard
target
=
AI
.
Utils
.
GetProblematicEnemyMonster
();
ClientCard
target
=
AI
.
Utils
.
GetProblematicEnemyMonster
();
if
(
target
==
null
&&
AI
.
Utils
.
IsChainTarget
(
Card
))
if
(
target
==
null
&&
AI
.
Utils
.
IsChainTarget
(
Card
))
{
{
target
=
AI
.
Utils
.
GetBestEnemyMonster
(
);
target
=
AI
.
Utils
.
GetBestEnemyMonster
(
true
,
true
);
}
}
if
(
target
!=
null
)
if
(
target
!=
null
)
{
{
...
@@ -509,6 +561,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -509,6 +561,7 @@ namespace WindBot.Game.AI.Decks
}
}
private
bool
RecklessGreedeff
()
private
bool
RecklessGreedeff
()
{
{
if
(
one_turn_kill_1
)
return
UniqueFaceupSpell
();
int
count
=
0
;
int
count
=
0
;
foreach
(
ClientCard
card
in
Bot
.
GetSpells
())
foreach
(
ClientCard
card
in
Bot
.
GetSpells
())
{
{
...
@@ -517,33 +570,54 @@ namespace WindBot.Game.AI.Decks
...
@@ -517,33 +570,54 @@ namespace WindBot.Game.AI.Decks
}
}
bool
Demiseused
=
AI
.
Utils
.
ChainContainsCard
(
CardId
.
CardOfDemise
);
bool
Demiseused
=
AI
.
Utils
.
ChainContainsCard
(
CardId
.
CardOfDemise
);
if
(
drawfirst
)
return
DefaultUniqueTrap
();
if
(
drawfirst
)
return
UniqueFaceupSpell
();
if
(
DefaultOnBecomeTarget
()
&&
count
>
1
)
return
true
;
if
(
DefaultOnBecomeTarget
()
&&
count
>
1
)
return
true
;
if
(
Demiseused
)
return
false
;
if
(
Demiseused
)
return
false
;
if
(
count
>
1
)
return
true
;
if
(
count
>
1
)
return
true
;
if
(
Bot
.
LifePoints
<=
2000
)
return
true
;
if
(
Bot
.
LifePoints
<=
3000
)
return
true
;
if
(
Bot
.
GetHandCount
()
<
1
&&
Duel
.
Player
==
0
&&
Duel
.
Phase
!=
DuelPhase
.
Standby
)
return
true
;
if
(
Bot
.
GetHandCount
()
<
1
&&
Duel
.
Player
==
0
&&
Duel
.
Phase
!=
DuelPhase
.
Standby
)
return
true
;
return
false
;
return
false
;
}
}
private
bool
SectetBarreleff
()
private
bool
SectetBarreleff
()
{
{
if
(
drawfirst
)
return
DefaultUniqueTrap
();
if
(
DefaultOnBecomeTarget
())
return
true
;
if
(
one_turn_kill_1
)
return
DefaultUniqueTrap
();
if
(
Duel
.
Player
==
0
)
return
false
;
if
(
one_turn_kill
)
return
DefaultUniqueTrap
();
if
(
drawfirst
)
return
true
;
if
(
one_turn_kill_1
)
return
UniqueFaceupSpell
();
if
(
one_turn_kill
)
return
true
;
if
(
DefaultOnBecomeTarget
())
return
true
;
if
(
DefaultOnBecomeTarget
())
return
true
;
int
count
=
Enemy
.
GetFieldHandCount
();
int
count
=
Enemy
.
GetFieldHandCount
();
int
monster_count
=
Enemy
.
GetMonsterCount
()
-
Enemy
.
GetMonstersExtraZoneCount
();
if
(
Enemy
.
LifePoints
<
count
*
200
)
return
true
;
if
(
Enemy
.
LifePoints
<
count
*
200
)
return
true
;
if
(
Bot
.
HasInSpellZone
(
CardId
.
OjamaTrio
)
&&
monster_count
<=
2
&&
monster_count
>=
1
)
{
if
(
count
+
3
>=
8
)
{
OjamaTrioused
=
true
;
return
true
;
}
}
if
(
count
>=
8
)
return
true
;
if
(
count
>=
8
)
return
true
;
return
false
;
return
false
;
}
}
private
bool
SecretBlasteff
()
private
bool
SecretBlasteff
()
{
{
if
(
drawfirst
)
return
DefaultUniqueTrap
();
if
(
one_turn_kill_1
)
return
DefaultUniqueTrap
();
if
(
one_turn_kill
)
return
DefaultUniqueTrap
();
if
(
DefaultOnBecomeTarget
())
return
true
;
if
(
DefaultOnBecomeTarget
())
return
true
;
if
(
Duel
.
Player
==
0
)
return
false
;
if
(
drawfirst
)
return
UniqueFaceupSpell
();
if
(
one_turn_kill_1
)
return
UniqueFaceupSpell
();
if
(
one_turn_kill
)
return
true
;
int
count
=
Enemy
.
GetFieldCount
();
int
count
=
Enemy
.
GetFieldCount
();
int
monster_count
=
Enemy
.
GetMonsterCount
()
-
Enemy
.
GetMonstersExtraZoneCount
();
if
(
Enemy
.
LifePoints
<
count
*
300
)
return
true
;
if
(
Enemy
.
LifePoints
<
count
*
300
)
return
true
;
if
(
Bot
.
HasInSpellZone
(
CardId
.
OjamaTrio
)
&&
monster_count
<=
2
&&
monster_count
>=
1
)
{
if
(
count
+
3
>=
5
)
{
OjamaTrioused
=
true
;
return
true
;
}
}
if
(
count
>=
5
)
return
true
;
if
(
count
>=
5
)
return
true
;
return
false
;
return
false
;
...
@@ -555,24 +629,25 @@ namespace WindBot.Game.AI.Decks
...
@@ -555,24 +629,25 @@ namespace WindBot.Game.AI.Decks
}
}
private
bool
JustDessertseff
()
private
bool
JustDessertseff
()
{
{
if
(
Duel
.
Player
==
0
)
return
false
;
if
(
drawfirst
)
return
DefaultUniqueTrap
();
if
(
one_turn_kill_1
)
return
DefaultUniqueTrap
();
if
(
one_turn_kill
)
return
DefaultUniqueTrap
();
if
(
DefaultOnBecomeTarget
())
return
true
;
if
(
DefaultOnBecomeTarget
())
return
true
;
int
count
=
Enemy
.
GetMonsterCount
();
if
(
Duel
.
Player
==
0
)
return
false
;
if
(
drawfirst
)
return
UniqueFaceupSpell
();
if
(
one_turn_kill_1
)
return
UniqueFaceupSpell
();
if
(
one_turn_kill
)
return
true
;
int
count
=
Enemy
.
GetMonsterCount
()-
Enemy
.
GetMonstersExtraZoneCount
();
if
(
Enemy
.
LifePoints
<=
count
*
500
)
return
true
;
if
(
Enemy
.
LifePoints
<=
count
*
500
)
return
true
;
if
(
Bot
.
HasInSpellZone
(
CardId
.
OjamaTrio
)
&&
count
<=
2
&&
count
>=
1
)
if
(
Bot
.
HasInSpellZone
(
CardId
.
OjamaTrio
)
&&
count
<=
2
&&
count
>=
1
)
{
{
OjamaTrioused
=
true
;
OjamaTrioused
=
true
;
return
true
;
return
true
;
}
}
if
(
count
>=
4
)
return
true
;
if
(
count
>=
3
)
return
true
;
return
false
;
return
false
;
}
}
private
bool
ChainStrikeeff
()
private
bool
ChainStrikeeff
()
{
{
if
(
one_turn_kill
)
return
true
;
if
(
one_turn_kill_1
)
return
true
;
if
(
drawfirst
)
return
true
;
if
(
drawfirst
)
return
true
;
if
(
DefaultOnBecomeTarget
())
return
true
;
if
(
DefaultOnBecomeTarget
())
return
true
;
int
chain
=
Duel
.
CurrentChain
.
Count
;
int
chain
=
Duel
.
CurrentChain
.
Count
;
...
@@ -634,10 +709,10 @@ namespace WindBot.Game.AI.Decks
...
@@ -634,10 +709,10 @@ namespace WindBot.Game.AI.Decks
}
}
private
bool
Linkuriboheff
()
private
bool
Linkuriboheff
()
{
{
IList
<
ClientCard
>
newlist
=
new
List
<
ClientCard
>();
IList
<
ClientCard
>
newlist
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
newmonster
in
Enemy
.
GetMonsters
())
foreach
(
ClientCard
newmonster
in
Enemy
.
GetMonsters
())
{
{
if
(
newmonster
.
IsAttack
())
newlist
.
Add
(
newmonster
);
newlist
.
Add
(
newmonster
);
}
}
if
(!
Linkuribohused
)
return
false
;
if
(!
Linkuribohused
)
return
false
;
...
@@ -645,47 +720,155 @@ namespace WindBot.Game.AI.Decks
...
@@ -645,47 +720,155 @@ namespace WindBot.Game.AI.Decks
{
{
if
(
Enemy
.
BattlingMonster
.
Attack
>
1800
&&
Bot
.
HasInSpellZone
(
CardId
.
MagicCylinder
))
return
false
;
if
(
Enemy
.
BattlingMonster
.
Attack
>
1800
&&
Bot
.
HasInSpellZone
(
CardId
.
MagicCylinder
))
return
false
;
}
}
if
(
GetTotalATK
(
newlist
)
>=
3000
&&
Bot
.
HasInSpellZone
(
CardId
.
BlazingMirrorForce
))
return
false
;
if
(
GetTotalATK
(
newlist
)
/
2
>=
Bot
.
LifePoints
&&
Bot
.
HasInSpellZone
(
CardId
.
BlazingMirrorForce
))
return
true
;
if
(
GetTotalATK
(
newlist
)
/
2
>=
Enemy
.
LifePoints
&&
Bot
.
HasInSpellZone
(
CardId
.
BlazingMirrorForce
))
return
false
;
if
(
AI
.
Utils
.
GetLastChainCard
()
==
null
)
return
true
;
if
(
AI
.
Utils
.
GetLastChainCard
()
==
null
)
return
true
;
if
(
AI
.
Utils
.
GetLastChainCard
().
Id
==
CardId
.
Linkuriboh
)
return
false
;
if
(
AI
.
Utils
.
GetLastChainCard
().
Id
==
CardId
.
Linkuriboh
)
return
false
;
return
true
;
return
true
;
}
}
public
bool
MonsterRepos
()
{
if
(
Card
.
IsFacedown
()
&&
Card
.
Id
!=
CardId
.
DiceJar
)
return
true
;
return
base
.
DefaultMonsterRepos
();
}
public
override
bool
OnPreBattleBetween
(
ClientCard
attacker
,
ClientCard
defender
)
public
override
bool
OnPreBattleBetween
(
ClientCard
attacker
,
ClientCard
defender
)
{
{
if
(
attacker
.
Id
==
CardId
.
Linkuriboh
&&
defender
.
IsFacedown
())
return
false
;
if
(
attacker
.
Id
==
CardId
.
Linkuriboh
&&
defender
.
IsFacedown
())
return
false
;
if
(
attacker
.
Id
==
CardId
.
SandaionTheTimelord
&&
!
attacker
.
IsDisabled
())
{
attacker
.
RealPower
=
9999
;
return
true
;
}
if
(
attacker
.
Id
==
CardId
.
MichionTimelord
&&
!
attacker
.
IsDisabled
())
{
attacker
.
RealPower
=
9999
;
return
true
;
}
return
base
.
OnPreBattleBetween
(
attacker
,
defender
);
return
base
.
OnPreBattleBetween
(
attacker
,
defender
);
}
}
/*private bool SwordsOfRevealingLight()
public
override
void
OnChaining
(
int
player
,
ClientCard
card
)
{
{
int count = Bot.SpellZone.GetCardCount(CardId.SwordsOfRevealingLight);
expected_blood
=
0
;
return count == 0;
one_turn_kill
=
false
;
}*/
one_turn_kill_1
=
false
;
OjamaTrioused_draw
=
false
;
OjamaTrioused_do
=
false
;
drawfirst
=
false
;
HasAccuulatedFortune
=
0
;
strike_count
=
0
;
greed_count
=
0
;
blast_count
=
0
;
barrel_count
=
0
;
just_count
=
0
;
Waboku_count
=
0
;
Roar_count
=
0
;
Ojama_count
=
0
;
/*
IList
<
ClientCard
>
check
=
Bot
.
GetSpells
();
private bool SetInvincibleMonster()
foreach
(
ClientCard
card1
in
check
)
{
{
foreach (ClientCard card in Bot.GetMonsters())
if
(
card1
.
Id
==
CardId
.
AccuulatedFortune
)
HasAccuulatedFortune
++;
}
foreach
(
ClientCard
card1
in
check
)
{
{
if (card.Id == CardId.Marshmallon || card.Id == CardId.SpiritReaper)
if
(
card1
.
Id
==
CardId
.
SecretBlast
)
blast_count
++;
}
foreach
(
ClientCard
card1
in
check
)
{
{
return false;
if
(
card1
.
Id
==
CardId
.
SectetBarrel
)
barrel_count
++;
}
}
foreach
(
ClientCard
card1
in
check
)
{
if
(
card1
.
Id
==
CardId
.
JustDesserts
)
just_count
++;
}
}
return true;
foreach
(
ClientCard
card1
in
check
)
}*/
{
if
(
card1
.
Id
==
CardId
.
ChainStrike
)
strike_count
++;
}
foreach
(
ClientCard
card1
in
Bot
.
GetSpells
())
{
if
(
card1
.
Id
==
CardId
.
RecklessGreed
)
greed_count
++;
/*
}
private bool ReposEverything()
foreach
(
ClientCard
card1
in
check
)
{
{
if (Card.Id == CardId.ReflectBounder)
if
(
card1
.
Id
==
CardId
.
Waboku
)
return Card.IsDefense();
Waboku_count
++;
if (Card.Id == CardId.FencingFireFerret)
return DefaultMonsterRepos();
}
if (Card.IsAttack())
foreach
(
ClientCard
card1
in
check
)
return true;
{
return false;
if
(
card1
.
Id
==
CardId
.
ThreateningRoar
)
Roar_count
++;
}
/*if (Bot.HasInSpellZone(CardId.OjamaTrio) && Enemy.GetMonsterCount() <= 2 && Enemy.GetMonsterCount() >= 1)
{
if (HasAccuulatedFortune > 0) OjamaTrioused_draw = true;
}*/
}*/
if
(
Bot
.
HasInSpellZone
(
CardId
.
OjamaTrio
)
&&
(
Enemy
.
GetMonsterCount
()
-
Enemy
.
GetMonstersExtraZoneCount
())
<=
2
&&
(
Enemy
.
GetMonsterCount
()
-
Enemy
.
GetMonstersExtraZoneCount
())
>=
1
)
{
OjamaTrioused_do
=
true
;
}
expected_blood
=
(
Enemy
.
GetMonsterCount
()
*
500
*
just_count
+
Enemy
.
GetFieldHandCount
()
*
200
*
barrel_count
+
Enemy
.
GetFieldCount
()
*
300
*
blast_count
);
if
(
Enemy
.
LifePoints
<=
expected_blood
&&
Duel
.
Player
==
1
)
{
Logger
.
DebugWriteLine
(
" %%%%%%%%%%%%%%%%%one_turn_kill"
);
one_turn_kill
=
true
;
}
expected_blood
=
0
;
if
(
greed_count
>=
2
)
greed_count
=
1
;
if
(
blast_count
>=
2
)
blast_count
=
1
;
if
(
just_count
>=
2
)
just_count
=
1
;
if
(
barrel_count
>=
2
)
barrel_count
=
1
;
if
(
Waboku_count
>=
2
)
Waboku_count
=
1
;
if
(
Roar_count
>=
2
)
Roar_count
=
1
;
int
currentchain
=
0
;
if
(
OjamaTrioused_do
)
currentchain
=
Duel
.
CurrentChain
.
Count
+
blast_count
+
just_count
+
barrel_count
+
Waboku_count
+
Waboku_count
+
Roar_count
+
greed_count
+
Ojama_count
;
else
currentchain
=
Duel
.
CurrentChain
.
Count
+
blast_count
+
just_count
+
barrel_count
+
Waboku_count
+
Waboku_count
+
greed_count
+
Roar_count
;
//if (currentchain >= 3 && Duel.Player == 1) drawfirst = true;
if
(
Bot
.
HasInSpellZone
(
CardId
.
ChainStrike
))
{
if
(
strike_count
==
1
)
{
if
(
OjamaTrioused_do
)
expected_blood
=
((
Enemy
.
GetMonsterCount
()
+
3
)
*
500
*
just_count
+
Enemy
.
GetFieldHandCount
()
*
200
*
barrel_count
+
Enemy
.
GetFieldCount
()
*
300
*
blast_count
+
(
currentchain
+
1
)
*
400
);
else
expected_blood
=
(
Enemy
.
GetMonsterCount
()
*
500
*
just_count
+
Enemy
.
GetFieldHandCount
()
*
200
*
barrel_count
+
Enemy
.
GetFieldCount
()
*
300
*
blast_count
+
(
currentchain
+
1
)
*
400
);
}
else
{
if
(
OjamaTrioused_do
)
expected_blood
=
((
Enemy
.
GetMonsterCount
()
+
3
)
*
500
*
just_count
+
Enemy
.
GetFieldHandCount
()
*
200
*
barrel_count
+
Enemy
.
GetFieldCount
()
*
300
*
blast_count
+
(
currentchain
+
1
+
currentchain
+
2
)
*
400
);
else
expected_blood
=
(
Enemy
.
GetMonsterCount
()
*
500
*
just_count
+
Enemy
.
GetFieldHandCount
()
*
200
*
barrel_count
+
Enemy
.
GetFieldCount
()
*
300
*
blast_count
+
(
currentchain
+
1
+
currentchain
+
2
)
*
400
);
}
if
(!
one_turn_kill
&&
Enemy
.
LifePoints
<=
expected_blood
&&
Duel
.
Player
==
1
)
{
Logger
.
DebugWriteLine
(
" %%%%%%%%%%%%%%%%%one_turn_kill_1"
);
one_turn_kill_1
=
true
;
OjamaTrioused
=
true
;
}
}
base
.
OnChaining
(
player
,
card
);
}
}
}
}
}
\ No newline at end of file
Game/AI/Decks/DarkMagicianExecutor.cs
0 → 100644
View file @
415dccdb
using
YGOSharp.OCGWrapper.Enums
;
using
System.Collections.Generic
;
using
WindBot
;
using
WindBot.Game
;
using
WindBot.Game.AI
;
namespace
WindBot.Game.AI.Decks
{
// NOT FINISHED YET
[
Deck
(
"DarkMagician"
,
"AI_DarkMagician"
,
"NotFinished"
)]
public
class
DarkMagicianExecutor
:
DefaultExecutor
{
public
class
CardId
{
public
const
int
DarkMagician
=
46986414
;
public
const
int
GrinderGolem
=
75732622
;
public
const
int
MagicianOfLllusion
=
35191415
;
public
const
int
ApprenticeLllusionMagician
=
30603688
;
public
const
int
WindwitchGlassBell
=
71007216
;
public
const
int
MagiciansRod
=
7084129
;
public
const
int
WindwitchIceBell
=
43722862
;
public
const
int
AshBlossom
=
14558127
;
public
const
int
SpellbookMagicianOfProphecy
=
14824019
;
public
const
int
MaxxC
=
23434538
;
public
const
int
WindwitchSnowBell
=
70117860
;
public
const
int
TheEyeOfTimaeus
=
1784686
;
public
const
int
DarkMagicAttack
=
2314238
;
public
const
int
SpellbookOfKnowledge
=
23314220
;
public
const
int
UpstartGoblin
=
70368879
;
public
const
int
SpellbookOfSecrets
=
89739383
;
public
const
int
DarkMagicInheritance
=
41735184
;
public
const
int
LllusionMagic
=
73616671
;
//public const int Scapegoat = 73915051;
public
const
int
DarkMagicalCircle
=
47222536
;
public
const
int
WonderWand
=
67775894
;
public
const
int
MagicianNavigation
=
7922915
;
public
const
int
EternalSoul
=
48680970
;
public
const
int
SolemnStrike
=
40605147
;
public
const
int
DarkMagicianTheDragonKnight
=
41721210
;
public
const
int
CrystalWingSynchroDragon
=
50954680
;
public
const
int
OddEyesWingDragon
=
58074177
;
public
const
int
ClearWingFastDragon
=
90036274
;
public
const
int
WindwitchWinterBell
=
14577226
;
public
const
int
OddEyesAbsoluteDragon
=
16691074
;
public
const
int
Dracossack
=
22110647
;
public
const
int
BigEye
=
80117527
;
public
const
int
TroymarePhoenix
=
2857636
;
public
const
int
TroymareCerberus
=
75452921
;
public
const
int
ApprenticeWitchling
=
71384012
;
public
const
int
VentriloauistsClaraAndLucika
=
1482001
;
/*public const int EbonLllusionMagician = 96471335;
public const int BorreloadDragon = 31833038;
public const int SaryujaSkullDread = 74997493;
public const int Hidaruma = 64514892;
public const int AkashicMagician = 28776350;
public const int SecurityDragon = 99111753;
public const int LinkSpider = 98978921;
public const int Linkuriboh = 41999284;*/
public
const
int
HarpiesFeatherDuster
=
18144506
;
public
const
int
ElShaddollWinda
=
94977269
;
public
const
int
DarkHole
=
53129443
;
public
const
int
Ultimate
=
86221741
;
public
const
int
LockBird
=
94145021
;
public
const
int
Ghost
=
59438930
;
public
const
int
GiantRex
=
80280944
;
public
const
int
UltimateConductorTytanno
=
18940556
;
public
const
int
SummonSorceress
=
61665245
;
public
const
int
CrystronNeedlefiber
=
50588353
;
public
const
int
FirewallDragon
=
5043010
;
public
const
int
JackKnightOfTheLavenderDust
=
28692962
;
public
const
int
JackKnightOfTheCobaltDepths
=
92204263
;
public
const
int
JackKnightOfTheCrimsonLotus
=
56809158
;
public
const
int
JackKnightOfTheGoldenBlossom
=
29415459
;
public
const
int
JackKnightOfTheVerdantGale
=
66022706
;
public
const
int
JackKnightOfTheAmberShade
=
93020401
;
public
const
int
JackKnightOfTheAzureSky
=
20537097
;
public
const
int
MekkKnightMorningStar
=
72006609
;
public
const
int
JackKnightOfTheWorldScar
=
38502358
;
public
const
int
WhisperOfTheWorldLegacy
=
62530723
;
public
const
int
TrueDepthsOfTheWorldLegacy
=
98935722
;
public
const
int
KeyToTheWorldLegacy
=
2930675
;
}
public
DarkMagicianExecutor
(
GameAI
ai
,
Duel
duel
)
:
base
(
ai
,
duel
)
{
//counter
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
SolemnStrike
,
SolemnStrikeeff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
AshBlossom
,
ChainEnemy
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
CrystalWingSynchroDragon
,
CrystalWingSynchroDragoneff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
MaxxC
,
MaxxCeff
);
//AddExecutor(ExecutorType.Activate, CardId.Scapegoat,Scapegoateff);
//first do
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
UpstartGoblin
,
UpstartGoblineff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
DarkMagicalCircle
,
DarkMagicalCircleeff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
SpellbookOfSecrets
,
SpellbookOfSecreteff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
DarkMagicInheritance
,
DarkMagicInheritanceeff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
DarkMagicAttack
,
DarkMagicAttackeff
);
//trap set
AddExecutor
(
ExecutorType
.
SpellSet
,
CardId
.
SolemnStrike
);
AddExecutor
(
ExecutorType
.
SpellSet
,
CardId
.
MagicianNavigation
,
MagicianNavigationset
);
AddExecutor
(
ExecutorType
.
SpellSet
,
CardId
.
EternalSoul
,
EternalSoulset
);
/*AddExecutor(ExecutorType.SpellSet, CardId.Scapegoat, Scapegoatset);
//sheep
AddExecutor(ExecutorType.SpSummon, CardId.Hidaruma, Hidarumasp);
AddExecutor(ExecutorType.SpSummon, CardId.Linkuriboh, Linkuribohsp);
AddExecutor(ExecutorType.Activate, CardId.Linkuriboh, Linkuriboheff);
AddExecutor(ExecutorType.SpSummon, CardId.LinkSpider, Linkuribohsp);
AddExecutor(ExecutorType.SpSummon, CardId.BorreloadDragon, BorreloadDragonsp);
AddExecutor(ExecutorType.SpSummon, CardId.BorreloadDragon, BorreloadDragoneff);*/
//plan A
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
WindwitchIceBell
,
WindwitchIceBelleff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
WindwitchGlassBell
,
WindwitchGlassBelleff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
WindwitchSnowBell
,
WindwitchSnowBellsp
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
WindwitchWinterBell
,
WindwitchWinterBellsp
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
WindwitchWinterBell
,
WindwitchWinterBelleff
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
CrystalWingSynchroDragon
,
CrystalWingSynchroDragonsp
);
// if fail
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
ClearWingFastDragon
,
ClearWingFastDragonsp
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
ClearWingFastDragon
,
ClearWingFastDragoneff
);
// plan B
//AddExecutor(ExecutorType.Activate, CardId.GrinderGolem, GrinderGolemeff);
// AddExecutor(ExecutorType.SpSummon, CardId.Linkuriboh, Linkuribohsp);
//AddExecutor(ExecutorType.SpSummon, CardId.LinkSpider, LinkSpidersp);
//AddExecutor(ExecutorType.SpSummon, CardId.AkashicMagician);
//plan C
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
OddEyesAbsoluteDragon
,
OddEyesAbsoluteDragonsp
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
OddEyesAbsoluteDragon
,
OddEyesAbsoluteDragoneff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
OddEyesWingDragon
);
//summon
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
WindwitchGlassBell
,
WindwitchGlassBellsummonfirst
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
SpellbookMagicianOfProphecy
,
SpellbookMagicianOfProphecysummon
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
SpellbookMagicianOfProphecy
,
SpellbookMagicianOfProphecyeff
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
MagiciansRod
,
MagiciansRodsummon
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
MagiciansRod
,
MagiciansRodeff
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
WindwitchGlassBell
,
WindwitchGlassBellsummon
);
//activate
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
LllusionMagic
,
LllusionMagiceff
);
AddExecutor
(
ExecutorType
.
SpellSet
,
CardId
.
LllusionMagic
,
LllusionMagicset
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
SpellbookOfKnowledge
,
SpellbookOfKnowledgeeff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
WonderWand
,
WonderWandeff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
TheEyeOfTimaeus
,
TheEyeOfTimaeuseff
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
ApprenticeLllusionMagician
,
ApprenticeLllusionMagiciansp
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
ApprenticeLllusionMagician
,
ApprenticeLllusionMagicianeff
);
//other thing
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
MagicianOfLllusion
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
MagicianNavigation
,
MagicianNavigationeff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
EternalSoul
,
EternalSouleff
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
BigEye
,
BigEyesp
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
BigEye
,
BigEyeeff
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
Dracossack
,
Dracossacksp
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Dracossack
,
Dracossackeff
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
ApprenticeWitchling
,
ApprenticeWitchlingsp
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
ApprenticeWitchling
,
ApprenticeWitchlingeff
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
VentriloauistsClaraAndLucika
,
VentriloauistsClaraAndLucikasp
);
AddExecutor
(
ExecutorType
.
Repos
,
MonsterRepos
);
}
private
void
EternalSoulSelect
()
{
AI
.
SelectPosition
(
CardPosition
.
FaceUpAttack
);
/*
if (Enemy.HasInMonstersZone(CardId.MekkKnightMorningStar))
{
int MekkKnightZone = 0;
int BotZone = 0;
for (int i = 0; i <= 6; i++)
{
if (Enemy.MonsterZone[i] != null && Enemy.MonsterZone[i].Id == CardId.MekkKnightMorningStar)
{
MekkKnightZone = i;
break;
}
}
if (Bot.MonsterZone[GetReverseColumnMainZone(MekkKnightZone)] == null)
{
BotZone = GetReverseColumnMainZone(MekkKnightZone);
AI.SelectPlace(ReverseZoneTo16bit(BotZone));
}
else
{
for (int i = 0; i <= 6; i++)
{
if (!NoJackKnightColumn(i))
{
if (Bot.MonsterZone[GetReverseColumnMainZone(i)] == null)
{
AI.SelectPlace(ReverseZoneTo16bit(GetReverseColumnMainZone(i)));
break;
}
}
}
}
Logger.DebugWriteLine("******************MekkKnightMorningStar");
}
else
{
for (int i = 0; i <= 6; i++)
{
if (!NoJackKnightColumn(i))
{
if (Bot.MonsterZone[GetReverseColumnMainZone(i)] == null)
{
AI.SelectPlace(ReverseZoneTo16bit(GetReverseColumnMainZone(i)));
break;
}
}
}
}
*/
}
int
attackerzone
=
-
1
;
int
defenderzone
=
-
1
;
bool
Secret_used
=
false
;
bool
plan_A
=
false
;
bool
plan_C
=
false
;
int
maxxc_done
=
0
;
int
lockbird_done
=
0
;
int
ghost_done
=
0
;
bool
maxxc_used
=
false
;
bool
lockbird_used
=
false
;
bool
ghost_used
=
false
;
bool
WindwitchGlassBelleff_used
=
false
;
int
ApprenticeLllusionMagician_count
=
0
;
bool
Spellbook_summon
=
false
;
bool
Rod_summon
=
false
;
bool
GlassBell_summon
=
false
;
bool
magician_sp
=
false
;
bool
soul_used
=
false
;
bool
big_attack
=
false
;
bool
big_attack_used
=
false
;
bool
CrystalWingSynchroDragon_used
=
false
;
public
override
void
OnNewPhase
()
{
//AI.Utils.UpdateLinkedZone();
//Logger.DebugWriteLine("Zones.CheckLinkedPointZones= " + Zones.CheckLinkedPointZones);
//Logger.DebugWriteLine("Zones.CheckMutualEnemyZoneCount= " + Zones.CheckMutualEnemyZoneCount);
plan_C
=
false
;
ApprenticeLllusionMagician_count
=
0
;
foreach
(
ClientCard
count
in
Bot
.
GetMonsters
())
{
if
(
count
.
Id
==
CardId
.
ApprenticeLllusionMagician
&&
count
.
IsFaceup
())
ApprenticeLllusionMagician_count
++;
}
foreach
(
ClientCard
dangerous
in
Enemy
.
GetMonsters
())
{
if
(
dangerous
!=
null
&&
dangerous
.
IsShouldNotBeTarget
()
&&
dangerous
.
Attack
>
2500
&&
!
Bot
.
HasInHandOrHasInMonstersZone
(
CardId
.
ApprenticeLllusionMagician
))
{
plan_C
=
true
;
Logger
.
DebugWriteLine
(
"*********dangerous = "
+
dangerous
.
Id
);
}
}
if
(
Bot
.
HasInHand
(
CardId
.
SpellbookMagicianOfProphecy
)
&&
Bot
.
HasInHand
(
CardId
.
MagiciansRod
)
&&
Bot
.
HasInHand
(
CardId
.
WindwitchGlassBell
))
{
if
(
Bot
.
HasInHand
(
CardId
.
SpellbookOfKnowledge
)
||
Bot
.
HasInHand
(
CardId
.
WonderWand
))
Rod_summon
=
true
;
else
Spellbook_summon
=
true
;
}
else
if
(
Bot
.
HasInHand
(
CardId
.
SpellbookMagicianOfProphecy
)
&&
Bot
.
HasInHand
(
CardId
.
MagiciansRod
))
{
if
(
Bot
.
HasInSpellZone
(
CardId
.
EternalSoul
)
&&
!(
Bot
.
HasInHand
(
CardId
.
DarkMagician
)
||
Bot
.
HasInHand
(
CardId
.
DarkMagician
)))
Rod_summon
=
true
;
else
if
(
Bot
.
HasInHand
(
CardId
.
SpellbookOfKnowledge
)
||
Bot
.
HasInHand
(
CardId
.
WonderWand
))
Rod_summon
=
true
;
else
Spellbook_summon
=
true
;
}
else
if
(
Bot
.
HasInHand
(
CardId
.
SpellbookMagicianOfProphecy
)
&&
Bot
.
HasInHand
(
CardId
.
WindwitchGlassBell
))
{
if
(
plan_A
)
Rod_summon
=
true
;
else
GlassBell_summon
=
true
;
}
else
if
(
Bot
.
HasInHand
(
CardId
.
MagiciansRod
)
&&
Bot
.
HasInHand
(
CardId
.
WindwitchGlassBell
))
{
if
(
plan_A
)
Rod_summon
=
true
;
else
GlassBell_summon
=
true
;
}
else
{
Spellbook_summon
=
true
;
Rod_summon
=
true
;
GlassBell_summon
=
true
;
}
}
public
override
void
OnNewTurn
()
{
CrystalWingSynchroDragon_used
=
false
;
Secret_used
=
false
;
maxxc_used
=
false
;
lockbird_used
=
false
;
ghost_used
=
false
;
WindwitchGlassBelleff_used
=
false
;
Spellbook_summon
=
false
;
Rod_summon
=
false
;
GlassBell_summon
=
false
;
magician_sp
=
false
;
big_attack
=
false
;
big_attack_used
=
false
;
soul_used
=
false
;
}
public
int
GetTotalATK
(
IList
<
ClientCard
>
list
)
{
int
atk
=
0
;
foreach
(
ClientCard
c
in
list
)
{
if
(
c
==
null
)
continue
;
atk
+=
c
.
Attack
;
}
return
atk
;
}
private
bool
WindwitchIceBelleff
()
{
if
(
lockbird_used
)
return
false
;
if
(
Enemy
.
HasInMonstersZone
(
CardId
.
ElShaddollWinda
))
return
false
;
if
(
maxxc_used
)
return
false
;
if
(
WindwitchGlassBelleff_used
)
return
false
;
//AI.SelectPlace(Zones.z2, 1);
if
(
Bot
.
GetRemainingCount
(
CardId
.
WindwitchGlassBell
,
2
)
>=
1
)
AI
.
SelectCard
(
CardId
.
WindwitchGlassBell
);
else
if
(
Bot
.
HasInHand
(
CardId
.
WindwitchGlassBell
))
AI
.
SelectCard
(
CardId
.
WindwitchSnowBell
);
AI
.
SelectPosition
(
CardPosition
.
FaceUpDefence
);
return
true
;
}
private
bool
WindwitchGlassBelleff
()
{
if
(
Bot
.
HasInMonstersZone
(
CardId
.
WindwitchIceBell
))
{
int
ghost_count
=
0
;
foreach
(
ClientCard
check
in
Enemy
.
Graveyard
)
{
if
(
check
.
Id
==
CardId
.
Ghost
)
ghost_count
++;
}
if
(
ghost_count
!=
ghost_done
)
AI
.
SelectCard
(
CardId
.
WindwitchIceBell
);
else
AI
.
SelectCard
(
CardId
.
WindwitchSnowBell
);
}
else
AI
.
SelectCard
(
CardId
.
WindwitchIceBell
);
WindwitchGlassBelleff_used
=
true
;
return
true
;
}
private
bool
WindwitchSnowBellsp
()
{
if
(
Bot
.
HasInMonstersZone
(
CardId
.
WindwitchIceBell
)
&&
Bot
.
HasInMonstersZone
(
CardId
.
WindwitchGlassBell
))
{
AI
.
SelectPosition
(
CardPosition
.
FaceUpDefence
);
return
true
;
}
return
false
;
}
private
bool
WindwitchWinterBellsp
()
{
if
(
Bot
.
HasInMonstersZone
(
CardId
.
WindwitchIceBell
)
&&
Bot
.
HasInMonstersZone
(
CardId
.
WindwitchGlassBell
)
&&
Bot
.
HasInMonstersZone
(
CardId
.
WindwitchSnowBell
))
{
//AI.SelectPlace(Zones.z5, Zones.ExtraMonsterZones);
AI
.
SelectCard
(
new
[]
{
CardId
.
WindwitchIceBell
,
CardId
.
WindwitchGlassBell
});
AI
.
SelectPosition
(
CardPosition
.
FaceUpAttack
);
return
true
;
}
return
false
;
}
private
bool
WindwitchWinterBelleff
()
{
AI
.
SelectCard
(
CardId
.
WindwitchGlassBell
);
return
true
;
}
private
bool
ClearWingFastDragonsp
()
{
if
(
Bot
.
HasInMonstersZone
(
CardId
.
WindwitchIceBell
)
&&
Bot
.
HasInMonstersZone
(
CardId
.
WindwitchGlassBell
))
{
AI
.
SelectPosition
(
CardPosition
.
FaceUpAttack
);
return
true
;
}
return
false
;
}
private
bool
ClearWingFastDragoneff
()
{
if
(
Card
.
Location
==
CardLocation
.
MonsterZone
)
{
if
(
Duel
.
Player
==
1
)
return
DefaultTrap
();
return
true
;
}
return
false
;
}
private
bool
CrystalWingSynchroDragonsp
()
{
if
(
Bot
.
HasInMonstersZone
(
CardId
.
WindwitchSnowBell
)
&&
Bot
.
HasInMonstersZone
(
CardId
.
WindwitchWinterBell
))
{
//AI.SelectPlace(Zones.z5, Zones.ExtraMonsterZones);
plan_A
=
true
;
return
true
;
}
return
false
;
}
/* private bool GrinderGolemeff()
{
if (plan_A) return false;
AI.SelectPosition(CardPosition.FaceUpDefence);
if (Bot.GetMonstersExtraZoneCount() == 0)
return true;
if (Bot.HasInMonstersZone(CardId.AkashicMagician) ||
Bot.HasInMonstersZone(CardId.SecurityDragon))
return true;
return false;
}*/
/* private bool Linkuribohsp()
{
if (Bot.HasInMonstersZone(CardId.GrinderGolem + 1))
{
AI.SelectCard(CardId.GrinderGolem + 1);
return true;
}
return false;
}
private bool LinkSpidersp()
{
if(Bot.HasInMonstersZone(CardId.GrinderGolem+1))
{
AI.SelectCard(CardId.GrinderGolem + 1);
return true;
}
return false;
}*/
private
bool
OddEyesAbsoluteDragonsp
()
{
if
(
plan_C
)
{
return
true
;
}
return
false
;
}
private
bool
OddEyesAbsoluteDragoneff
()
{
Logger
.
DebugWriteLine
(
"OddEyesAbsoluteDragonef 1"
);
if
(
Card
.
Location
==
CardLocation
.
MonsterZone
/*ActivateDescription == AI.Utils.GetStringId(CardId.OddEyesAbsoluteDragon, 0)*/
)
{
Logger
.
DebugWriteLine
(
"OddEyesAbsoluteDragonef 2"
);
return
Duel
.
Player
==
1
;
}
else
if
(
Card
.
Location
==
CardLocation
.
Grave
/*ActivateDescription == AI.Utils.GetStringId(CardId.OddEyesAbsoluteDragon, 0)*/
)
{
Logger
.
DebugWriteLine
(
"OddEyesAbsoluteDragonef 3"
);
AI
.
SelectCard
(
CardId
.
OddEyesWingDragon
);
return
true
;
}
return
false
;
}
private
bool
SolemnStrikeeff
()
{
if
(
Bot
.
LifePoints
>
1500
&&
Duel
.
LastChainPlayer
==
1
)
return
true
;
return
false
;
}
private
bool
ChainEnemy
()
{
if
(
AI
.
Utils
.
GetLastChainCard
()
!=
null
&&
AI
.
Utils
.
GetLastChainCard
().
Id
==
CardId
.
UpstartGoblin
)
return
false
;
return
Duel
.
LastChainPlayer
==
1
;
}
private
bool
CrystalWingSynchroDragoneff
()
{
if
(
Duel
.
LastChainPlayer
==
1
)
{
CrystalWingSynchroDragon_used
=
true
;
return
true
;
}
return
false
;
}
private
bool
MaxxCeff
()
{
return
Duel
.
Player
==
1
;
}
/*
private bool Scapegoatset()
{
if (Bot.HasInSpellZone(CardId.Scapegoat)) return false;
return (Bot.GetMonsterCount() - Bot.GetMonstersExtraZoneCount()) < 2;
}
public bool Scapegoateff()
{
if (Duel.Player == 0) return false;
if (DefaultOnBecomeTarget() && !Enemy.HasInMonstersZone(CardId.UltimateConductorTytanno))
{
Logger.DebugWriteLine("*************************sheepeff");
return true;
}
if (Bot.HasInMonstersZone(CardId.CrystalWingSynchroDragon)) return false;
if(Duel.Phase == DuelPhase.End)
{
Logger.DebugWriteLine("*************************sheepeff");
return true;
}
if (Duel.Phase > DuelPhase.Main1 && Duel.Phase < DuelPhase.Main2)
{
int total_atk = 0;
List<ClientCard> enemy_monster = Enemy.GetMonsters();
foreach (ClientCard m in enemy_monster)
{
if (m.IsAttack() && !m.Attacked) total_atk += m.Attack;
}
if (total_atk >= Bot.LifePoints && !Enemy.HasInMonstersZone(CardId.UltimateConductorTytanno)) return true;
}
return false;
}
private bool Hidarumasp()
{
if (!Bot.HasInMonstersZone(CardId.Scapegoat + 1)) return false;
if(Bot.MonsterZone[5]==null)
{
AI.SelectCard(new[] { CardId.Scapegoat + 1, CardId.Scapegoat + 1 });
return true;
}
if (Bot.MonsterZone[6] == null)
{
AI.SelectCard(new[] { CardId.Scapegoat + 1, CardId.Scapegoat + 1 });
return true;
}
return false;
}
private bool Linkuribohsp()
{
foreach (ClientCard c in Bot.GetMonsters())
{
if (c.Id != CardId.WindwitchSnowBell && c.Level == 1 && c.Id != CardId.LinkSpider && c.Id != CardId.Linkuriboh)
{
AI.SelectCard(c);
return true;
}
}
return false;
}
private bool Linkuriboheff()
{
if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard().Id == CardId.Linkuriboh) return false;
if (Bot.HasInMonstersZone(CardId.WindwitchSnowBell)) return false;
return true;
}
private bool BorreloadDragonsp()
{
if(Bot.HasInMonstersZone(CardId.Hidaruma)&&
Bot.HasInMonstersZone(CardId.Linkuriboh))
{
AI.SelectCard(new[] { CardId.Hidaruma, CardId.Linkuriboh, CardId.LinkSpider ,CardId.Linkuriboh});
return true;
}
return false;
}
private bool BorreloadDragoneff()
{
if (ActivateDescription == -1)
{
ClientCard enemy_monster = Enemy.BattlingMonster;
if (enemy_monster != null && enemy_monster.HasPosition(CardPosition.Attack))
{
return enemy_monster.Attack > 2000;
}
return true;
};
ClientCard BestEnemy = AI.Utils.GetBestEnemyMonster(true,true);
if (BestEnemy == null || BestEnemy.HasPosition(CardPosition.FaceDown)) return false;
AI.SelectCard(BestEnemy);
return true;
}*/
private
bool
EternalSoulset
()
{
if
(
Bot
.
GetHandCount
()
>
6
)
return
true
;
if
(!
Bot
.
HasInSpellZone
(
CardId
.
EternalSoul
))
return
true
;
return
false
;
}
private
bool
EternalSouleff
()
{
IList
<
ClientCard
>
grave
=
Bot
.
Graveyard
;
IList
<
ClientCard
>
magician
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
check
in
grave
)
{
if
(
check
.
Id
==
CardId
.
DarkMagician
)
{
magician
.
Add
(
check
);
}
}
if
(
AI
.
Utils
.
IsChainTarget
(
Card
)
&&
Bot
.
GetMonsterCount
()
==
0
)
{
AI
.
SelectYesNo
(
false
);
return
true
;
}
if
(
AI
.
Utils
.
ChainCountPlayer
(
0
)
>
0
)
return
false
;
if
(
Enemy
.
HasInSpellZone
(
CardId
.
HarpiesFeatherDuster
)
&&
Card
.
IsFacedown
())
return
false
;
foreach
(
ClientCard
target
in
Duel
.
ChainTargets
)
{
if
((
target
.
Id
==
CardId
.
DarkMagician
||
target
.
Id
==
CardId
.
DarkMagicianTheDragonKnight
)
&&
Card
.
IsFacedown
())
{
AI
.
SelectYesNo
(
false
);
return
true
;
}
}
if
(
Enemy
.
HasInSpellZone
(
CardId
.
DarkHole
)
&&
Card
.
IsFacedown
()
&&
(
Bot
.
HasInMonstersZone
(
CardId
.
DarkMagician
)
||
Bot
.
HasInMonstersZone
(
CardId
.
DarkMagicianTheDragonKnight
)))
{
AI
.
SelectYesNo
(
false
);
return
true
;
}
if
(
Bot
.
HasInGraveyard
(
CardId
.
DarkMagicianTheDragonKnight
)
&&
!
Bot
.
HasInMonstersZone
(
CardId
.
DarkMagicianTheDragonKnight
)
&&
!
plan_C
)
{
EternalSoulSelect
();
AI
.
SelectCard
(
CardId
.
DarkMagicianTheDragonKnight
);
return
true
;
}
if
(
Duel
.
Player
==
1
&&
Bot
.
HasInSpellZone
(
CardId
.
DarkMagicalCircle
)
&&
(
Enemy
.
HasInMonstersZone
(
CardId
.
SummonSorceress
)
||
Enemy
.
HasInMonstersZone
(
CardId
.
FirewallDragon
)))
{
soul_used
=
true
;
magician_sp
=
true
;
EternalSoulSelect
();
AI
.
SelectCard
(
magician
);
return
true
;
}
if
(
Duel
.
Player
==
1
&&
Duel
.
Phase
==
DuelPhase
.
BattleStart
&&
Enemy
.
GetMonsterCount
()
>
0
)
{
if
(
Card
.
IsFacedown
()
&&
Bot
.
HasInMonstersZone
(
CardId
.
VentriloauistsClaraAndLucika
))
{
AI
.
SelectYesNo
(
false
);
return
true
;
}
if
(
Card
.
IsFacedown
()
&&
(
Bot
.
HasInMonstersZone
(
CardId
.
DarkMagician
)
||
Bot
.
HasInMonstersZone
(
CardId
.
DarkMagicianTheDragonKnight
)))
{
AI
.
SelectYesNo
(
false
);
return
true
;
}
if
(
Bot
.
HasInGraveyard
(
CardId
.
DarkMagicianTheDragonKnight
)
||
Bot
.
HasInGraveyard
(
CardId
.
DarkMagician
))
{
soul_used
=
true
;
magician_sp
=
true
;
EternalSoulSelect
();
AI
.
SelectCard
(
magician
);
return
true
;
}
if
(
Bot
.
HasInHand
(
CardId
.
DarkMagician
))
{
soul_used
=
true
;
magician_sp
=
true
;
AI
.
SelectCard
(
CardId
.
DarkMagician
);
EternalSoulSelect
();
return
true
;
}
}
if
(
Duel
.
Player
==
0
&&
Duel
.
Phase
==
DuelPhase
.
Main1
)
{
if
(
Bot
.
HasInHand
(
CardId
.
DarkMagicalCircle
)
&&
!
Bot
.
HasInSpellZone
(
CardId
.
DarkMagicalCircle
))
return
false
;
if
(
Bot
.
HasInGraveyard
(
CardId
.
DarkMagicianTheDragonKnight
)
||
Bot
.
HasInGraveyard
(
CardId
.
DarkMagician
))
{
soul_used
=
true
;
magician_sp
=
true
;
AI
.
SelectCard
(
magician
);
EternalSoulSelect
();
return
true
;
}
if
(
Bot
.
HasInHand
(
CardId
.
DarkMagician
))
{
soul_used
=
true
;
magician_sp
=
true
;
AI
.
SelectCard
(
CardId
.
DarkMagician
);
EternalSoulSelect
();
return
true
;
}
}
if
(
Duel
.
Phase
==
DuelPhase
.
End
)
{
if
(
Card
.
IsFacedown
()
&&
Bot
.
HasInMonstersZone
(
CardId
.
VentriloauistsClaraAndLucika
))
{
AI
.
SelectYesNo
(
false
);
return
true
;
}
if
(
Bot
.
HasInGraveyard
(
CardId
.
DarkMagicianTheDragonKnight
)
||
Bot
.
HasInGraveyard
(
CardId
.
DarkMagician
))
{
soul_used
=
true
;
magician_sp
=
true
;
AI
.
SelectCard
(
magician
);
EternalSoulSelect
();
return
true
;
}
if
(
Bot
.
HasInHand
(
CardId
.
DarkMagician
))
{
soul_used
=
true
;
magician_sp
=
true
;
AI
.
SelectCard
(
CardId
.
DarkMagician
);
EternalSoulSelect
();
return
true
;
}
return
true
;
}
return
false
;
}
private
bool
MagicianNavigationset
()
{
if
(
Bot
.
GetHandCount
()
>
6
)
return
true
;
if
(
Bot
.
HasInSpellZone
(
CardId
.
LllusionMagic
))
return
true
;
if
(
Bot
.
HasInHand
(
CardId
.
DarkMagician
)
&&
!
Bot
.
HasInSpellZone
(
CardId
.
MagicianNavigation
))
return
true
;
return
false
;
}
private
bool
MagicianNavigationeff
()
{
bool
spell_act
=
false
;
IList
<
ClientCard
>
spell
=
new
List
<
ClientCard
>();
if
(
Duel
.
LastChainPlayer
==
1
)
{
foreach
(
ClientCard
check
in
Enemy
.
GetSpells
())
{
if
(
AI
.
Utils
.
GetLastChainCard
()
==
check
)
{
spell
.
Add
(
check
);
spell_act
=
true
;
break
;
}
}
}
bool
soul_faceup
=
false
;
foreach
(
ClientCard
check
in
Bot
.
GetSpells
())
{
if
(
check
.
Id
==
CardId
.
EternalSoul
&&
check
.
IsFaceup
())
{
soul_faceup
=
true
;
}
}
if
(
Card
.
Location
==
CardLocation
.
Grave
&&
spell_act
)
{
Logger
.
DebugWriteLine
(
"**********************Navigationeff***********"
);
AI
.
SelectCard
(
spell
);
return
true
;
}
if
(
AI
.
Utils
.
IsChainTarget
(
Card
))
{
AI
.
SelectPlace
(
Zones
.
z0
|
Zones
.
z4
);
AI
.
SelectCard
(
CardId
.
DarkMagician
);
ClientCard
check
=
AI
.
Utils
.
GetOneEnemyBetterThanValue
(
2500
,
true
);
if
(
check
!=
null
)
AI
.
SelectNextCard
(
new
[]
{
CardId
.
ApprenticeLllusionMagician
,
CardId
.
DarkMagician
,
CardId
.
MagicianOfLllusion
});
else
AI
.
SelectNextCard
(
new
[]
{
CardId
.
ApprenticeLllusionMagician
,
CardId
.
DarkMagician
,
CardId
.
MagicianOfLllusion
});
magician_sp
=
true
;
return
UniqueFaceupSpell
();
}
if
(
DefaultOnBecomeTarget
()
&&
!
soul_faceup
)
{
AI
.
SelectPlace
(
Zones
.
z0
|
Zones
.
z4
);
AI
.
SelectCard
(
CardId
.
DarkMagician
);
ClientCard
check
=
AI
.
Utils
.
GetOneEnemyBetterThanValue
(
2500
,
true
);
if
(
check
!=
null
)
AI
.
SelectNextCard
(
new
[]
{
CardId
.
ApprenticeLllusionMagician
,
CardId
.
DarkMagician
,
CardId
.
MagicianOfLllusion
});
else
AI
.
SelectNextCard
(
new
[]
{
CardId
.
ApprenticeLllusionMagician
,
CardId
.
DarkMagician
,
CardId
.
MagicianOfLllusion
});
magician_sp
=
true
;
return
true
;
}
if
(
Duel
.
Player
==
0
&&
Card
.
Location
==
CardLocation
.
SpellZone
&&
!
maxxc_used
&&
Bot
.
HasInHand
(
CardId
.
DarkMagician
))
{
AI
.
SelectPlace
(
Zones
.
z0
|
Zones
.
z4
);
AI
.
SelectCard
(
CardId
.
DarkMagician
);
ClientCard
check
=
AI
.
Utils
.
GetOneEnemyBetterThanValue
(
2500
,
true
);
if
(
check
!=
null
)
AI
.
SelectNextCard
(
new
[]
{
CardId
.
ApprenticeLllusionMagician
,
CardId
.
DarkMagician
,
CardId
.
MagicianOfLllusion
});
else
AI
.
SelectNextCard
(
new
[]
{
CardId
.
ApprenticeLllusionMagician
,
CardId
.
DarkMagician
,
CardId
.
MagicianOfLllusion
});
magician_sp
=
true
;
return
UniqueFaceupSpell
();
}
if
(
Duel
.
Player
==
1
&&
Bot
.
HasInSpellZone
(
CardId
.
DarkMagicalCircle
)
&&
(
Enemy
.
HasInMonstersZone
(
CardId
.
SummonSorceress
)
||
Enemy
.
HasInMonstersZone
(
CardId
.
FirewallDragon
))
&&
Card
.
Location
==
CardLocation
.
SpellZone
)
{
AI
.
SelectPlace
(
Zones
.
z0
|
Zones
.
z4
);
AI
.
SelectCard
(
CardId
.
DarkMagician
);
ClientCard
check
=
AI
.
Utils
.
GetOneEnemyBetterThanValue
(
2500
,
true
);
if
(
check
!=
null
)
AI
.
SelectNextCard
(
new
[]
{
CardId
.
ApprenticeLllusionMagician
,
CardId
.
DarkMagician
,
CardId
.
MagicianOfLllusion
});
else
AI
.
SelectNextCard
(
new
[]
{
CardId
.
ApprenticeLllusionMagician
,
CardId
.
DarkMagician
,
CardId
.
MagicianOfLllusion
});
magician_sp
=
true
;
return
UniqueFaceupSpell
();
}
if
(
Enemy
.
GetFieldCount
()
>
0
&&
(
Duel
.
Phase
==
DuelPhase
.
BattleStart
||
Duel
.
Phase
==
DuelPhase
.
End
)
&&
Card
.
Location
==
CardLocation
.
SpellZone
&&
!
maxxc_used
)
{
AI
.
SelectPlace
(
Zones
.
z0
|
Zones
.
z4
);
AI
.
SelectCard
(
CardId
.
DarkMagician
);
ClientCard
check
=
AI
.
Utils
.
GetOneEnemyBetterThanValue
(
2500
,
true
);
if
(
check
!=
null
)
AI
.
SelectNextCard
(
new
[]
{
CardId
.
ApprenticeLllusionMagician
,
CardId
.
DarkMagician
,
CardId
.
MagicianOfLllusion
});
else
AI
.
SelectNextCard
(
new
[]
{
CardId
.
ApprenticeLllusionMagician
,
CardId
.
DarkMagician
,
CardId
.
MagicianOfLllusion
});
magician_sp
=
true
;
return
UniqueFaceupSpell
();
}
return
false
;
}
private
bool
DarkMagicalCircleeff
()
{
if
(
Card
.
Location
==
CardLocation
.
Hand
)
{
//AI.SelectPlace(Zones.z2, 2);
if
(
Bot
.
LifePoints
<=
4000
)
return
true
;
return
UniqueFaceupSpell
();
}
else
{
if
(
magician_sp
)
{
AI
.
SelectCard
(
AI
.
Utils
.
GetBestEnemyCard
(
false
,
true
));
if
(
AI
.
Utils
.
GetBestEnemyCard
(
false
,
true
)
!=
null
)
Logger
.
DebugWriteLine
(
"*************SelectCard= "
+
AI
.
Utils
.
GetBestEnemyCard
(
false
,
true
).
Id
);
magician_sp
=
false
;
}
}
return
true
;
}
private
bool
LllusionMagicset
()
{
if
(
Bot
.
GetMonsterCount
()
>=
1
&&
!(
Bot
.
GetMonsterCount
()
==
1
&&
Bot
.
HasInMonstersZone
(
CardId
.
CrystalWingSynchroDragon
))
&&
!(
Bot
.
GetMonsterCount
()
==
1
&&
Bot
.
HasInMonstersZone
(
CardId
.
ClearWingFastDragon
))
&&
!(
Bot
.
GetMonsterCount
()
==
1
&&
Bot
.
HasInMonstersZone
(
CardId
.
VentriloauistsClaraAndLucika
)))
return
true
;
return
false
;
}
private
bool
LllusionMagiceff
()
{
if
(
lockbird_used
)
return
false
;
if
(
Duel
.
LastChainPlayer
==
0
)
return
false
;
ClientCard
target
=
null
;
bool
soul_exist
=
false
;
//AI.SelectPlace(Zones.z2, 2);
foreach
(
ClientCard
m
in
Bot
.
GetSpells
())
{
if
(
m
.
Id
==
CardId
.
EternalSoul
&&
m
.
IsFaceup
())
soul_exist
=
true
;
}
if
(!
soul_used
&&
soul_exist
)
{
if
(
Bot
.
HasInMonstersZone
(
CardId
.
MagiciansRod
))
{
AI
.
SelectCard
(
CardId
.
MagiciansRod
);
AI
.
SelectNextCard
(
new
[]
{
CardId
.
DarkMagician
,
CardId
.
DarkMagician
});
return
true
;
}
}
if
(
Duel
.
Player
==
0
)
{
int
ghost_count
=
0
;
foreach
(
ClientCard
check
in
Enemy
.
Graveyard
)
{
if
(
check
.
Id
==
CardId
.
Ghost
)
ghost_count
++;
}
if
(
ghost_count
!=
ghost_done
)
{
if
(
Duel
.
CurrentChain
.
Count
>=
2
&&
AI
.
Utils
.
GetLastChainCard
().
Id
==
0
)
{
AI
.
SelectCard
(
CardId
.
MagiciansRod
);
AI
.
SelectNextCard
(
new
[]
{
CardId
.
DarkMagician
,
CardId
.
DarkMagician
});
return
true
;
}
}
int
count
=
0
;
foreach
(
ClientCard
m
in
Bot
.
GetMonsters
())
{
if
(
AI
.
Utils
.
IsChainTarget
(
m
))
{
count
++;
target
=
m
;
Logger
.
DebugWriteLine
(
"************IsChainTarget= "
+
target
.
Id
);
break
;
}
}
if
(
count
==
0
)
return
false
;
if
((
target
.
Id
==
CardId
.
WindwitchGlassBell
||
target
.
Id
==
CardId
.
WindwitchIceBell
)
&&
Bot
.
HasInMonstersZone
(
CardId
.
WindwitchIceBell
)
&&
Bot
.
HasInMonstersZone
(
CardId
.
WindwitchGlassBell
))
return
false
;
AI
.
SelectCard
(
target
);
AI
.
SelectNextCard
(
new
[]
{
CardId
.
DarkMagician
,
CardId
.
DarkMagician
});
return
true
;
}
if
(
Bot
.
HasInMonstersZone
(
CardId
.
MagiciansRod
)
||
Bot
.
HasInMonstersZone
(
CardId
.
SpellbookMagicianOfProphecy
))
{
AI
.
SelectCard
(
new
[]
{
CardId
.
MagiciansRod
,
CardId
.
SpellbookMagicianOfProphecy
});
AI
.
SelectNextCard
(
new
[]
{
CardId
.
DarkMagician
,
CardId
.
DarkMagician
});
return
true
;
}
if
(
Duel
.
Player
==
1
&&
Bot
.
HasInMonstersZone
(
CardId
.
WindwitchGlassBell
))
{
AI
.
SelectCard
(
CardId
.
WindwitchGlassBell
);
AI
.
SelectNextCard
(
new
[]
{
CardId
.
DarkMagician
,
CardId
.
DarkMagician
});
return
true
;
}
if
(
Duel
.
Player
==
1
&&
Bot
.
HasInMonstersZone
(
CardId
.
WindwitchIceBell
))
{
AI
.
SelectCard
(
CardId
.
WindwitchIceBell
);
AI
.
SelectNextCard
(
new
[]
{
CardId
.
DarkMagician
,
CardId
.
DarkMagician
});
return
true
;
}
if
(
Duel
.
Player
==
1
&&
Bot
.
HasInMonstersZone
(
CardId
.
WindwitchSnowBell
))
{
AI
.
SelectCard
(
CardId
.
WindwitchSnowBell
);
AI
.
SelectNextCard
(
new
[]
{
CardId
.
DarkMagician
,
CardId
.
DarkMagician
});
return
true
;
}
if
(
Duel
.
Player
==
1
&&
Bot
.
HasInMonstersZone
(
CardId
.
SpellbookMagicianOfProphecy
))
{
AI
.
SelectCard
(
CardId
.
SpellbookMagicianOfProphecy
);
AI
.
SelectNextCard
(
new
[]
{
CardId
.
DarkMagician
,
CardId
.
DarkMagician
});
return
true
;
}
if
(
Duel
.
Player
==
1
&&
Bot
.
HasInMonstersZone
(
CardId
.
ApprenticeLllusionMagician
)
&&
(
Bot
.
HasInSpellZone
(
CardId
.
EternalSoul
)
||
Bot
.
HasInSpellZone
(
CardId
.
MagicianNavigation
)))
{
AI
.
SelectCard
(
CardId
.
ApprenticeLllusionMagician
);
AI
.
SelectNextCard
(
new
[]
{
CardId
.
DarkMagician
,
CardId
.
DarkMagician
});
return
true
;
}
if
((
Bot
.
GetRemainingCount
(
CardId
.
DarkMagician
,
3
)
>
1
||
Bot
.
HasInGraveyard
(
CardId
.
DarkMagician
))
&&
Bot
.
HasInSpellZone
(
CardId
.
MagicianNavigation
)
&&
(
Bot
.
HasInMonstersZone
(
CardId
.
DarkMagician
)
||
Bot
.
HasInMonstersZone
(
CardId
.
ApprenticeLllusionMagician
))
&&
Duel
.
Player
==
1
&&
!
Bot
.
HasInHand
(
CardId
.
DarkMagician
))
{
AI
.
SelectCard
(
new
[]
{
CardId
.
DarkMagician
,
CardId
.
ApprenticeLllusionMagician
});
AI
.
SelectNextCard
(
new
[]
{
CardId
.
DarkMagician
,
CardId
.
DarkMagician
});
return
true
;
}
return
false
;
}
private
bool
SpellbookMagicianOfProphecyeff
()
{
Logger
.
DebugWriteLine
(
"*********Secret_used= "
+
Secret_used
);
if
(
Secret_used
)
AI
.
SelectCard
(
CardId
.
SpellbookOfKnowledge
);
else
AI
.
SelectCard
(
new
[]
{
CardId
.
SpellbookOfSecrets
,
CardId
.
SpellbookOfKnowledge
});
return
true
;
}
private
bool
TheEyeOfTimaeuseff
()
{
//AI.SelectPlace(Zones.z2, 2);
return
true
;
}
private
bool
UpstartGoblineff
()
{
//AI.SelectPlace(Zones.z2, 2);
return
true
;
}
private
bool
SpellbookOfSecreteff
()
{
if
(
lockbird_used
)
return
false
;
//AI.SelectPlace(Zones.z2, 2);
Secret_used
=
true
;
if
(
Bot
.
HasInHand
(
CardId
.
SpellbookMagicianOfProphecy
))
AI
.
SelectCard
(
CardId
.
SpellbookOfKnowledge
);
else
AI
.
SelectCard
(
CardId
.
SpellbookMagicianOfProphecy
);
return
true
;
}
private
bool
SpellbookOfKnowledgeeff
()
{
int
count
=
0
;
foreach
(
ClientCard
check
in
Bot
.
GetMonsters
())
{
if
(
check
.
Id
!=
CardId
.
CrystalWingSynchroDragon
)
count
++;
}
Logger
.
DebugWriteLine
(
"%%%%%%%%%%%%%%%%SpellCaster= "
+
count
);
if
(
lockbird_used
)
return
false
;
if
(
Bot
.
HasInSpellZone
(
CardId
.
LllusionMagic
)
&&
count
<
2
)
return
false
;
//AI.SelectPlace(Zones.z2, 2);
if
(
Bot
.
HasInMonstersZone
(
CardId
.
SpellbookMagicianOfProphecy
)
||
Bot
.
HasInMonstersZone
(
CardId
.
MagiciansRod
)
||
Bot
.
HasInMonstersZone
(
CardId
.
WindwitchGlassBell
)
||
Bot
.
HasInMonstersZone
(
CardId
.
WindwitchIceBell
))
{
AI
.
SelectCard
(
new
[]
{
CardId
.
SpellbookMagicianOfProphecy
,
CardId
.
MagiciansRod
,
CardId
.
WindwitchGlassBell
,
});
return
true
;
}
if
(
Bot
.
HasInMonstersZone
(
CardId
.
ApprenticeLllusionMagician
)
&&
Bot
.
GetSpellCount
()
<
2
&&
Duel
.
Phase
==
DuelPhase
.
Main2
)
{
AI
.
SelectCard
(
CardId
.
ApprenticeLllusionMagician
);
return
true
;
}
if
(
Bot
.
HasInMonstersZone
(
CardId
.
DarkMagician
)
&&
Bot
.
HasInSpellZone
(
CardId
.
EternalSoul
)
&&
Duel
.
Phase
==
DuelPhase
.
Main2
)
{
AI
.
SelectCard
(
CardId
.
DarkMagician
);
return
true
;
}
return
false
;
}
private
bool
WonderWandeff
()
{
if
(
lockbird_used
)
return
false
;
int
count
=
0
;
foreach
(
ClientCard
check
in
Bot
.
GetMonsters
())
{
if
(
check
.
Id
!=
CardId
.
CrystalWingSynchroDragon
)
count
++;
}
Logger
.
DebugWriteLine
(
"%%%%%%%%%%%%%%%%SpellCaster= "
+
count
);
if
(
Card
.
Location
==
CardLocation
.
Hand
)
{
if
(
Bot
.
HasInSpellZone
(
CardId
.
LllusionMagic
)
&&
count
<
2
)
return
false
;
//AI.SelectPlace(Zones.z2, 2);
if
(
Bot
.
HasInMonstersZone
(
CardId
.
SpellbookMagicianOfProphecy
)
||
Bot
.
HasInMonstersZone
(
CardId
.
MagiciansRod
)
||
Bot
.
HasInMonstersZone
(
CardId
.
WindwitchGlassBell
)
||
Bot
.
HasInMonstersZone
(
CardId
.
WindwitchIceBell
))
{
AI
.
SelectCard
(
new
[]
{
CardId
.
SpellbookMagicianOfProphecy
,
CardId
.
MagiciansRod
,
CardId
.
WindwitchGlassBell
,
CardId
.
WindwitchIceBell
,
});
return
UniqueFaceupSpell
();
}
if
(
Bot
.
HasInMonstersZone
(
CardId
.
DarkMagician
)
&&
Bot
.
HasInSpellZone
(
CardId
.
EternalSoul
)
&&
Duel
.
Phase
==
DuelPhase
.
Main2
)
{
AI
.
SelectCard
(
CardId
.
DarkMagician
);
return
UniqueFaceupSpell
();
}
if
(
Bot
.
HasInMonstersZone
(
CardId
.
ApprenticeLllusionMagician
)
&&
Bot
.
GetSpellCount
()
<
2
&&
Duel
.
Phase
==
DuelPhase
.
Main2
)
{
AI
.
SelectCard
(
CardId
.
ApprenticeLllusionMagician
);
return
UniqueFaceupSpell
();
}
if
(
Bot
.
HasInMonstersZone
(
CardId
.
ApprenticeLllusionMagician
)
&&
Bot
.
GetHandCount
()
<=
3
&&
Duel
.
Phase
==
DuelPhase
.
Main2
)
{
AI
.
SelectCard
(
CardId
.
ApprenticeLllusionMagician
);
return
UniqueFaceupSpell
();
}
}
else
{
if
(
Duel
.
Turn
!=
1
)
{
if
(
Duel
.
Phase
==
DuelPhase
.
Main1
&&
Enemy
.
GetSpellCountWithoutField
()
==
0
&&
AI
.
Utils
.
GetBestEnemyMonster
(
true
,
true
)
==
null
)
return
false
;
if
(
Duel
.
Phase
==
DuelPhase
.
Main1
&&
Enemy
.
GetSpellCountWithoutField
()
==
0
&&
AI
.
Utils
.
GetBestEnemyMonster
().
IsFacedown
())
return
true
;
if
(
Duel
.
Phase
==
DuelPhase
.
Main1
&&
Enemy
.
GetSpellCountWithoutField
()
==
0
&&
AI
.
Utils
.
GetBestBotMonster
(
true
)
!=
null
&&
AI
.
Utils
.
GetBestBotMonster
(
true
).
Attack
>
AI
.
Utils
.
GetBestEnemyMonster
(
true
).
Attack
)
return
false
;
}
return
true
;
}
return
false
;
}
private
bool
ApprenticeLllusionMagiciansp
()
{
//AI.SelectPlace(Zones.z2, 1);
if
(
Bot
.
HasInHand
(
CardId
.
DarkMagician
)
&&
!
Bot
.
HasInSpellZone
(
CardId
.
MagicianNavigation
))
{
if
(
Bot
.
GetRemainingCount
(
CardId
.
DarkMagician
,
3
)
>
0
)
{
AI
.
SelectCard
(
CardId
.
DarkMagician
);
AI
.
SelectPosition
(
CardPosition
.
FaceUpAttack
);
return
true
;
}
return
false
;
}
if
((
Bot
.
HasInHand
(
CardId
.
SpellbookOfSecrets
)
||
Bot
.
HasInHand
(
CardId
.
DarkMagicAttack
)))
{
AI
.
SelectPosition
(
CardPosition
.
FaceUpAttack
);
AI
.
SelectCard
(
new
[]
{
CardId
.
SpellbookOfSecrets
,
CardId
.
DarkMagicAttack
,
});
return
true
;
}
if
(
Bot
.
HasInMonstersZone
(
CardId
.
ApprenticeLllusionMagician
))
return
false
;
int
count
=
0
;
foreach
(
ClientCard
check
in
Bot
.
Hand
)
{
if
(
check
.
Id
==
CardId
.
WonderWand
)
count
++;
}
if
(
count
>=
2
)
{
AI
.
SelectPosition
(
CardPosition
.
FaceUpAttack
);
AI
.
SelectCard
(
CardId
.
WonderWand
);
return
true
;
}
if
(!
Bot
.
HasInHandOrInSpellZone
(
CardId
.
EternalSoul
)
&&
Bot
.
HasInHandOrInSpellZone
(
CardId
.
MagicianNavigation
)&&
!
Bot
.
HasInHand
(
CardId
.
DarkMagician
)
&&
Bot
.
GetHandCount
()>
2
&&
Bot
.
GetMonsterCount
()==
0
)
{
AI
.
SelectPosition
(
CardPosition
.
FaceUpAttack
);
AI
.
SelectCard
(
new
[]
{
CardId
.
MagicianOfLllusion
,
CardId
.
ApprenticeLllusionMagician
,
CardId
.
TheEyeOfTimaeus
,
CardId
.
DarkMagicInheritance
,
CardId
.
WonderWand
,
});
return
true
;
}
if
(!
Bot
.
HasInHandOrInMonstersZoneOrInGraveyard
(
CardId
.
DarkMagician
))
{
if
(
Bot
.
HasInHandOrInSpellZone
(
CardId
.
LllusionMagic
)
&&
Bot
.
GetMonsterCount
()
>=
1
)
return
false
;
AI
.
SelectPosition
(
CardPosition
.
FaceUpAttack
);
int
Navigation_count
=
0
;
foreach
(
ClientCard
Navigation
in
Bot
.
Hand
)
{
if
(
Navigation
.
Id
==
CardId
.
MagicianNavigation
)
Navigation_count
++;
}
if
(
Navigation_count
>=
2
)
{
AI
.
SelectCard
(
CardId
.
MagicianNavigation
);
return
true
;
}
AI
.
SelectCard
(
new
[]
{
CardId
.
MagicianOfLllusion
,
CardId
.
ApprenticeLllusionMagician
,
CardId
.
TheEyeOfTimaeus
,
CardId
.
DarkMagicInheritance
,
CardId
.
WonderWand
,
});
return
true
;
}
return
false
;
}
private
bool
ApprenticeLllusionMagicianeff
()
{
if
(
AI
.
Utils
.
ChainContainsCard
(
CardId
.
ApprenticeLllusionMagician
))
return
false
;
if
(
Duel
.
Phase
==
DuelPhase
.
Battle
||
Duel
.
Phase
==
DuelPhase
.
BattleStart
||
Duel
.
Phase
==
DuelPhase
.
BattleStep
||
Duel
.
Phase
==
DuelPhase
.
Damage
||
Duel
.
Phase
==
DuelPhase
.
DamageCal
)
{
if
(
ActivateDescription
==
-
1
)
{
Logger
.
DebugWriteLine
(
"ApprenticeLllusionMagicianadd"
);
return
true
;
}
if
(
Card
.
IsDisabled
())
return
false
;
if
((
Bot
.
BattlingMonster
==
null
))
return
false
;
if
((
Enemy
.
BattlingMonster
==
null
))
return
false
;
if
(
Bot
.
BattlingMonster
.
Attack
<
Enemy
.
BattlingMonster
.
Attack
)
return
true
;
else
return
false
;
}
else
return
true
;
}
private
bool
SpellbookMagicianOfProphecysummon
()
{
//AI.SelectPlace(Zones.z2, 1);
if
(
lockbird_used
)
return
false
;
if
(
Spellbook_summon
)
{
if
(
Secret_used
)
AI
.
SelectCard
(
CardId
.
SpellbookOfKnowledge
);
else
AI
.
SelectCard
(
new
[]
{
CardId
.
SpellbookOfSecrets
,
CardId
.
SpellbookOfKnowledge
});
return
true
;
}
return
false
;
}
private
bool
MagiciansRodsummon
()
{
if
(
lockbird_used
)
return
false
;
//AI.SelectPlace(Zones.z2, 1);
if
(
Rod_summon
)
return
true
;
return
true
;
}
private
bool
DarkMagicAttackeff
()
{
//AI.SelectPlace(Zones.z1, 2);
return
DefaultHarpiesFeatherDusterFirst
();
}
private
bool
DarkMagicInheritanceeff
()
{
if
(
lockbird_used
)
return
false
;
IList
<
ClientCard
>
grave
=
Bot
.
Graveyard
;
IList
<
ClientCard
>
spell
=
new
List
<
ClientCard
>();
int
count
=
0
;
foreach
(
ClientCard
check
in
grave
)
{
if
(
Card
.
HasType
(
CardType
.
Spell
))
{
spell
.
Add
(
check
);
count
++;
}
}
if
(
count
>=
2
)
{
//AI.SelectPlace(Zones.z2, 2);
AI
.
SelectCard
(
spell
);
if
(
Bot
.
HasInHandOrInSpellZone
(
CardId
.
EternalSoul
)
&&
Bot
.
HasInHandOrInSpellZone
(
CardId
.
DarkMagicalCircle
))
if
(
Bot
.
GetRemainingCount
(
CardId
.
DarkMagician
,
3
)
>=
2
&&
!
Bot
.
HasInHandOrInSpellZoneOrInGraveyard
(
CardId
.
LllusionMagic
))
{
AI
.
SelectNextCard
(
CardId
.
LllusionMagic
);
return
true
;
}
if
(
Bot
.
HasInHand
(
CardId
.
ApprenticeLllusionMagician
)
&&
(!
Bot
.
HasInHandOrInSpellZone
(
CardId
.
EternalSoul
)
||
!
Bot
.
HasInHandOrInSpellZone
(
CardId
.
MagicianNavigation
)))
{
AI
.
SelectNextCard
(
CardId
.
MagicianNavigation
);
return
true
;
}
if
(
Bot
.
HasInHandOrInSpellZone
(
CardId
.
EternalSoul
)
&&
!
Bot
.
HasInHandOrInMonstersZoneOrInGraveyard
(
CardId
.
DarkMagician
)
&&
!
Bot
.
HasInHandOrInSpellZoneOrInGraveyard
(
CardId
.
LllusionMagic
))
{
AI
.
SelectNextCard
(
CardId
.
LllusionMagic
);
return
true
;
}
if
(
Bot
.
HasInHandOrInSpellZone
(
CardId
.
MagicianNavigation
)
&&
!
Bot
.
HasInHand
(
CardId
.
DarkMagician
)
&&
!
Bot
.
HasInHandOrInSpellZone
(
CardId
.
EternalSoul
)
&&
Bot
.
GetRemainingCount
(
CardId
.
LllusionMagic
,
1
)
>
0
)
{
AI
.
SelectNextCard
(
CardId
.
LllusionMagic
);
return
true
;
}
if
((
Bot
.
HasInHandOrInSpellZone
(
CardId
.
EternalSoul
)
||
Bot
.
HasInHandOrInSpellZone
(
CardId
.
MagicianNavigation
))
&&
!
Bot
.
HasInHandOrInSpellZone
(
CardId
.
DarkMagicalCircle
))
{
AI
.
SelectNextCard
(
CardId
.
DarkMagicalCircle
);
return
true
;
}
if
(
Bot
.
HasInHandOrInSpellZone
(
CardId
.
DarkMagicalCircle
))
{
if
(
Bot
.
HasInGraveyard
(
CardId
.
MagicianNavigation
))
{
AI
.
SelectNextCard
(
new
[]
{
CardId
.
EternalSoul
,
CardId
.
MagicianNavigation
,
CardId
.
DarkMagicalCircle
});
}
else
AI
.
SelectNextCard
(
new
[]
{
CardId
.
EternalSoul
,
CardId
.
MagicianNavigation
,
CardId
.
DarkMagicalCircle
});
return
true
;
}
if
(
Bot
.
HasInGraveyard
(
CardId
.
MagicianNavigation
))
{
AI
.
SelectNextCard
(
new
[]
{
CardId
.
EternalSoul
,
CardId
.
DarkMagicalCircle
,
CardId
.
MagicianNavigation
,
});
}
else
AI
.
SelectNextCard
(
new
[]
{
CardId
.
MagicianNavigation
,
CardId
.
DarkMagicalCircle
,
CardId
.
EternalSoul
,
});
return
true
;
}
return
false
;
}
private
bool
MagiciansRodeff
()
{
if
(
Card
.
Location
==
CardLocation
.
MonsterZone
)
{
if
(
Bot
.
HasInHandOrInSpellZone
(
CardId
.
EternalSoul
)
&&
Bot
.
HasInHandOrInSpellZone
(
CardId
.
DarkMagicalCircle
))
if
(
Bot
.
GetRemainingCount
(
CardId
.
DarkMagician
,
3
)
>=
2
&&
Bot
.
GetRemainingCount
(
CardId
.
LllusionMagic
,
1
)
>
0
)
{
AI
.
SelectCard
(
CardId
.
LllusionMagic
);
return
true
;
}
if
(
Bot
.
HasInHand
(
CardId
.
ApprenticeLllusionMagician
)
&&
!
Bot
.
HasInHandOrInSpellZone
(
CardId
.
MagicianNavigation
)
&&
Bot
.
GetRemainingCount
(
CardId
.
MagicianNavigation
,
3
)
>
0
)
{
AI
.
SelectCard
(
CardId
.
MagicianNavigation
);
return
true
;
}
if
(
Bot
.
HasInHandOrInSpellZone
(
CardId
.
EternalSoul
)
&&
!
Bot
.
HasInHandOrInMonstersZoneOrInGraveyard
(
CardId
.
DarkMagician
)
&&
Bot
.
GetRemainingCount
(
CardId
.
LllusionMagic
,
1
)
>
0
)
{
AI
.
SelectCard
(
CardId
.
LllusionMagic
);
return
true
;
}
if
(
Bot
.
HasInHandOrInSpellZone
(
CardId
.
MagicianNavigation
)
&&
!
Bot
.
HasInHand
(
CardId
.
DarkMagician
)
&&
!
Bot
.
HasInHandOrInSpellZone
(
CardId
.
EternalSoul
)
&&
Bot
.
GetRemainingCount
(
CardId
.
LllusionMagic
,
1
)
>
0
)
{
AI
.
SelectCard
(
CardId
.
LllusionMagic
);
return
true
;
}
if
(!
Bot
.
HasInHandOrInSpellZone
(
CardId
.
EternalSoul
)
&&
Bot
.
HasInHandOrInSpellZone
(
CardId
.
DarkMagicalCircle
)
&&
Bot
.
HasInHandOrInSpellZone
(
CardId
.
MagicianNavigation
)
&&
Bot
.
GetRemainingCount
(
CardId
.
EternalSoul
,
3
)
>
0
)
{
AI
.
SelectCard
(
CardId
.
EternalSoul
);
return
true
;
}
if
((
Bot
.
HasInHandOrInSpellZone
(
CardId
.
EternalSoul
)
||
Bot
.
HasInHandOrInSpellZone
(
CardId
.
MagicianNavigation
))
&&
!
Bot
.
HasInHandOrInSpellZone
(
CardId
.
DarkMagicalCircle
)
&&
Bot
.
GetRemainingCount
(
CardId
.
DarkMagicalCircle
,
3
)
>
0
)
{
AI
.
SelectCard
(
CardId
.
DarkMagicalCircle
);
return
true
;
}
if
(!
Bot
.
HasInHandOrInSpellZone
(
CardId
.
EternalSoul
)
&&
!
Bot
.
HasInHandOrInSpellZone
(
CardId
.
MagicianNavigation
))
{
if
(
Bot
.
HasInHand
(
CardId
.
DarkMagician
)
&&
!
Bot
.
HasInGraveyard
(
CardId
.
MagicianNavigation
)
&&
Bot
.
GetRemainingCount
(
CardId
.
MagicianNavigation
,
3
)
>
0
)
AI
.
SelectCard
(
CardId
.
MagicianNavigation
);
else
if
(!
Bot
.
HasInHandOrInSpellZone
(
CardId
.
DarkMagicalCircle
))
AI
.
SelectCard
(
CardId
.
DarkMagicalCircle
);
else
AI
.
SelectCard
(
CardId
.
EternalSoul
);
return
true
;
}
if
(!
Bot
.
HasInHand
(
CardId
.
MagicianNavigation
))
{
AI
.
SelectCard
(
CardId
.
MagicianNavigation
);
return
true
;
}
if
(!
Bot
.
HasInHand
(
CardId
.
DarkMagicalCircle
))
{
AI
.
SelectCard
(
CardId
.
DarkMagicalCircle
);
return
true
;
}
if
(!
Bot
.
HasInHand
(
CardId
.
EternalSoul
))
{
AI
.
SelectCard
(
CardId
.
EternalSoul
);
return
true
;
}
AI
.
SelectCard
(
new
[]
{
CardId
.
LllusionMagic
,
CardId
.
EternalSoul
,
CardId
.
DarkMagicalCircle
,
CardId
.
MagicianNavigation
});
return
true
;
}
else
{
if
(
Bot
.
HasInMonstersZone
(
CardId
.
VentriloauistsClaraAndLucika
))
{
AI
.
SelectCard
(
CardId
.
VentriloauistsClaraAndLucika
);
return
true
;
}
int
Enemy_atk
=
0
;
IList
<
ClientCard
>
list
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
monster
in
Enemy
.
GetMonsters
())
{
if
(
monster
.
IsAttack
())
list
.
Add
(
monster
);
}
Enemy_atk
=
GetTotalATK
(
list
);
int
bot_atk
=
0
;
IList
<
ClientCard
>
list_1
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
monster
in
Bot
.
GetMonsters
())
{
if
(
AI
.
Utils
.
GetWorstBotMonster
(
true
)
!=
null
)
{
if
(
monster
.
IsAttack
()
&&
monster
.
Id
!=
AI
.
Utils
.
GetWorstBotMonster
(
true
).
Id
)
list_1
.
Add
(
monster
);
}
}
bot_atk
=
GetTotalATK
(
list
);
if
(
Bot
.
HasInHand
(
CardId
.
MagiciansRod
))
return
false
;
if
(
Bot
.
HasInMonstersZone
(
CardId
.
ApprenticeWitchling
)
&&
Bot
.
GetMonsterCount
()
==
1
&&
Bot
.
HasInSpellZone
(
CardId
.
EternalSoul
))
return
false
;
if
(
Bot
.
LifePoints
<=
(
Enemy_atk
-
bot_atk
)
&&
Bot
.
GetMonsterCount
()
>
1
)
return
false
;
if
((
Bot
.
LifePoints
-
Enemy_atk
<=
1000
)
&&
Bot
.
GetMonsterCount
()
==
1
)
return
false
;
AI
.
SelectCard
(
new
[]
{
CardId
.
VentriloauistsClaraAndLucika
,
CardId
.
SpellbookMagicianOfProphecy
,
CardId
.
WindwitchGlassBell
,
CardId
.
WindwitchIceBell
,
CardId
.
MagiciansRod
,
CardId
.
DarkMagician
,
CardId
.
MagicianOfLllusion
});
return
true
;
}
}
private
bool
WindwitchGlassBellsummonfirst
()
{
if
(
Bot
.
HasInMonstersZone
(
CardId
.
WindwitchIceBell
)
&&
Bot
.
HasInMonstersZone
(
CardId
.
WindwitchSnowBell
)
&&
!
Bot
.
HasInMonstersZone
(
CardId
.
WindwitchGlassBell
))
return
true
;
return
false
;
}
private
bool
WindwitchGlassBellsummon
()
{
if
(
lockbird_used
)
return
false
;
if
(!
plan_A
&&
(
Bot
.
HasInGraveyard
(
CardId
.
WindwitchGlassBell
)
||
Bot
.
HasInMonstersZone
(
CardId
.
WindwitchGlassBell
)))
return
false
;
//AI.SelectPlace(Zones.z2, 1);
if
(
GlassBell_summon
&&
Bot
.
HasInMonstersZone
(
CardId
.
WindwitchIceBell
)
&&
!
Bot
.
HasInMonstersZone
(
CardId
.
WindwitchGlassBell
))
return
true
;
if
(
WindwitchGlassBelleff_used
)
return
false
;
if
(
GlassBell_summon
)
return
true
;
return
false
;
}
private
bool
BigEyesp
()
{
if
(
plan_C
)
return
false
;
if
(
AI
.
Utils
.
IsOneEnemyBetterThanValue
(
2500
,
false
)
&&
!
Bot
.
HasInHandOrHasInMonstersZone
(
CardId
.
ApprenticeLllusionMagician
))
{
//AI.SelectPlace(Zones.z5, Zones.ExtraMonsterZones);
AI
.
SelectPosition
(
CardPosition
.
FaceUpAttack
);
return
true
;
}
return
false
;
}
private
bool
BigEyeeff
()
{
ClientCard
target
=
AI
.
Utils
.
GetBestEnemyMonster
(
false
,
true
);
if
(
target
!=
null
&&
target
.
Attack
>=
2500
)
{
AI
.
SelectCard
(
CardId
.
DarkMagician
);
AI
.
SelectNextCard
(
target
);
return
true
;
}
return
false
;
}
private
bool
Dracossacksp
()
{
if
(
plan_C
)
return
false
;
if
(
AI
.
Utils
.
IsOneEnemyBetterThanValue
(
2500
,
false
)
&&
!
Bot
.
HasInHandOrHasInMonstersZone
(
CardId
.
ApprenticeLllusionMagician
))
{
//AI.SelectPlace(Zones.z5, Zones.ExtraMonsterZones);
AI
.
SelectPosition
(
CardPosition
.
FaceUpAttack
);
return
true
;
}
return
false
;
}
private
bool
Dracossackeff
()
{
if
(
ActivateDescription
==
AI
.
Utils
.
GetStringId
(
CardId
.
Dracossack
,
0
))
{
AI
.
SelectCard
(
CardId
.
DarkMagician
);
return
true
;
}
ClientCard
target
=
AI
.
Utils
.
GetBestEnemyCard
(
false
,
true
);
if
(
target
!=
null
)
{
AI
.
SelectCard
(
CardId
.
Dracossack
+
1
);
AI
.
SelectNextCard
(
target
);
return
true
;
}
return
false
;
}
private
bool
ApprenticeWitchlingsp
()
{
int
rod_count
=
0
;
foreach
(
ClientCard
rod
in
Bot
.
GetMonsters
())
{
if
(
rod
.
Id
==
CardId
.
MagiciansRod
)
rod_count
++;
}
if
(
rod_count
>=
2
)
{
AI
.
SelectCard
(
new
[]
{
CardId
.
MagiciansRod
,
CardId
.
MagiciansRod
});
return
true
;
}
if
(
Bot
.
HasInMonstersZone
(
CardId
.
DarkMagician
)
&&
Bot
.
HasInMonstersZone
(
CardId
.
MagiciansRod
)
&&
(
Bot
.
HasInSpellZone
(
CardId
.
EternalSoul
)
||
Bot
.
GetMonsterCount
()
>=
4
)
&&
Duel
.
Phase
==
DuelPhase
.
Main2
)
{
if
(
rod_count
>=
2
)
AI
.
SelectCard
(
new
[]
{
CardId
.
MagiciansRod
,
CardId
.
MagiciansRod
});
else
AI
.
SelectCard
(
new
[]
{
CardId
.
MagiciansRod
,
CardId
.
DarkMagician
});
return
true
;
}
if
(
Bot
.
HasInMonstersZone
(
CardId
.
MagiciansRod
)
&&
Bot
.
HasInMonstersZone
(
CardId
.
ApprenticeLllusionMagician
)
&&
(
Bot
.
HasInSpellZone
(
CardId
.
EternalSoul
)
||
Bot
.
HasInSpellZone
(
CardId
.
MagicianNavigation
))
&&
Duel
.
Phase
==
DuelPhase
.
Main2
)
{
if
(
rod_count
>=
2
)
AI
.
SelectCard
(
new
[]
{
CardId
.
MagiciansRod
,
CardId
.
MagiciansRod
});
else
AI
.
SelectCard
(
new
[]
{
CardId
.
MagiciansRod
,
CardId
.
DarkMagician
});
return
true
;
}
return
false
;
}
private
bool
ApprenticeWitchlingeff
()
{
AI
.
SelectCard
(
new
[]
{
CardId
.
MagiciansRod
,
CardId
.
DarkMagician
,
CardId
.
ApprenticeLllusionMagician
});
return
true
;
}
public
override
bool
OnSelectHand
()
{
return
true
;
}
private
bool
VentriloauistsClaraAndLucikasp
()
{
if
(
Bot
.
HasInSpellZone
(
CardId
.
LllusionMagic
))
return
false
;
if
(
Bot
.
HasInMonstersZone
(
CardId
.
MagiciansRod
)
&&
!
Bot
.
HasInGraveyard
(
CardId
.
MagiciansRod
)
&&
(
Bot
.
HasInSpellZone
(
CardId
.
EternalSoul
)
||
Bot
.
HasInSpellZone
(
CardId
.
MagicianNavigation
)))
{
AI
.
SelectCard
(
CardId
.
MagiciansRod
);
return
true
;
}
return
false
;
}
public
override
void
OnChaining
(
int
player
,
ClientCard
card
)
{
base
.
OnChaining
(
player
,
card
);
}
public
override
void
OnChainEnd
()
{
/*if (Enemy.MonsterZone[5] != null)
{
Logger.DebugWriteLine("%%%%%%%%%%%%%%%%Enemy.MonsterZone[5].LinkMarker= " + Enemy.MonsterZone[5].LinkMarker);
Logger.DebugWriteLine("%%%%%%%%%%%%%%%%Enemy.MonsterZone[5].LinkLevel= " + Enemy.MonsterZone[5].LinkLevel);
}
if (Enemy.MonsterZone[6] != null)
{
Logger.DebugWriteLine("%%%%%%%%%%%%%%%%Enemy.MonsterZone[6].LinkMarker= " + Enemy.MonsterZone[6].LinkMarker);
Logger.DebugWriteLine("%%%%%%%%%%%%%%%%Enemy.MonsterZone[6].LinkLevel= " + Enemy.MonsterZone[6].LinkLevel);
}
for (int i = 0; i < 6; i++)
{
if (Enemy.MonsterZone[i] != null)
Logger.DebugWriteLine("++++++++MONSTER ZONE[" + i + "]= " + Enemy.MonsterZone[i].Attack);
}
for (int i = 0; i < 6; i++)
{
if (Bot.MonsterZone[i] != null)
Logger.DebugWriteLine("++++++++MONSTER ZONE[" + i + "]= " + Bot.MonsterZone[i].Id);
}
for (int i = 0; i < 4; i++)
{
if (Bot.SpellZone[i] != null)
Logger.DebugWriteLine("++++++++SpellZone[" + i + "]= " + Bot.SpellZone[i].Id);
}*/
if
((
Duel
.
CurrentChain
.
Count
>=
1
&&
AI
.
Utils
.
GetLastChainCard
().
Id
==
0
)
||
(
Duel
.
CurrentChain
.
Count
==
2
&&
!
AI
.
Utils
.
ChainContainPlayer
(
0
)
&&
Duel
.
CurrentChain
[
0
].
Id
==
0
))
{
Logger
.
DebugWriteLine
(
"current chain = "
+
Duel
.
CurrentChain
.
Count
);
Logger
.
DebugWriteLine
(
"******last chain card= "
+
AI
.
Utils
.
GetLastChainCard
().
Id
);
int
maxxc_count
=
0
;
foreach
(
ClientCard
check
in
Enemy
.
Graveyard
)
{
if
(
check
.
Id
==
CardId
.
MaxxC
)
maxxc_count
++;
}
if
(
maxxc_count
!=
maxxc_done
)
{
Logger
.
DebugWriteLine
(
"************************last chain card= "
+
AI
.
Utils
.
GetLastChainCard
().
Id
);
maxxc_used
=
true
;
}
int
lockbird_count
=
0
;
foreach
(
ClientCard
check
in
Enemy
.
Graveyard
)
{
if
(
check
.
Id
==
CardId
.
LockBird
)
lockbird_count
++;
}
if
(
lockbird_count
!=
lockbird_done
)
{
Logger
.
DebugWriteLine
(
"************************last chain card= "
+
AI
.
Utils
.
GetLastChainCard
().
Id
);
lockbird_used
=
true
;
}
int
ghost_count
=
0
;
foreach
(
ClientCard
check
in
Enemy
.
Graveyard
)
{
if
(
check
.
Id
==
CardId
.
Ghost
)
ghost_count
++;
}
if
(
ghost_count
!=
ghost_done
)
{
Logger
.
DebugWriteLine
(
"************************last chain card= "
+
AI
.
Utils
.
GetLastChainCard
().
Id
);
ghost_used
=
true
;
}
if
(
ghost_used
&&
AI
.
Utils
.
ChainContainsCard
(
CardId
.
WindwitchGlassBell
))
{
AI
.
SelectCard
(
CardId
.
WindwitchIceBell
);
Logger
.
DebugWriteLine
(
"***********WindwitchGlassBell*********************"
);
}
}
foreach
(
ClientCard
dangerous
in
Enemy
.
GetMonsters
())
{
if
(
dangerous
!=
null
&&
dangerous
.
IsShouldNotBeTarget
()
&&
(
dangerous
.
Attack
>
2500
||
dangerous
.
Defense
>
2500
)
&&
!
Bot
.
HasInHandOrHasInMonstersZone
(
CardId
.
ApprenticeLllusionMagician
))
{
plan_C
=
true
;
Logger
.
DebugWriteLine
(
"*********dangerous = "
+
dangerous
.
Id
);
}
}
int
count
=
0
;
foreach
(
ClientCard
check
in
Enemy
.
Graveyard
)
{
if
(
check
.
Id
==
CardId
.
MaxxC
)
count
++;
}
maxxc_done
=
count
;
count
=
0
;
foreach
(
ClientCard
check
in
Enemy
.
Graveyard
)
{
if
(
check
.
Id
==
CardId
.
LockBird
)
count
++;
}
lockbird_done
=
count
;
count
=
0
;
foreach
(
ClientCard
check
in
Enemy
.
Graveyard
)
{
if
(
check
.
Id
==
CardId
.
Ghost
)
count
++;
}
ghost_done
=
count
;
base
.
OnChainEnd
();
}
public
override
bool
OnPreBattleBetween
(
ClientCard
attacker
,
ClientCard
defender
)
{
/*
if (Enemy.HasInMonstersZone(CardId.MekkKnightMorningStar))
{
attackerzone = -1;
defenderzone = -1;
for (int a = 0; a <= 6; a++)
for (int b = 0; b <= 6; b++)
{
if (Bot.MonsterZone[a] != null && Enemy.MonsterZone[b] != null &&
SameMonsterColumn(a, b) &&
Bot.MonsterZone[a].Id == attacker.Id && Enemy.MonsterZone[b].Id == defender.Id)
{
attackerzone = a;
defenderzone = b;
}
}
Logger.DebugWriteLine("**********attack_zone= " + attackerzone + " defender_zone= " + defenderzone);
if (!SameMonsterColumn(attackerzone, defenderzone) && IsJackKnightMonster(defenderzone))
{
Logger.DebugWriteLine("**********cant attack ");
return false;
}
}
*/
//Logger.DebugWriteLine("@@@@@@@@@@@@@@@@@@@ApprenticeLllusionMagician= " + ApprenticeLllusionMagician_count);
if
(
Bot
.
HasInSpellZone
(
CardId
.
OddEyesWingDragon
))
big_attack
=
true
;
if
(
Duel
.
Player
==
0
&&
Bot
.
GetMonsterCount
()
>=
2
&&
plan_C
)
{
Logger
.
DebugWriteLine
(
"*********dangerous********************* "
);
if
(
attacker
.
Id
==
CardId
.
OddEyesAbsoluteDragon
||
attacker
.
Id
==
CardId
.
OddEyesWingDragon
)
attacker
.
RealPower
=
9999
;
}
if
((
attacker
.
Id
==
CardId
.
DarkMagician
||
attacker
.
Id
==
CardId
.
MagiciansRod
||
attacker
.
Id
==
CardId
.
BigEye
||
attacker
.
Id
==
CardId
.
ApprenticeWitchling
)
&&
Bot
.
HasInHandOrHasInMonstersZone
(
CardId
.
ApprenticeLllusionMagician
))
{
attacker
.
RealPower
+=
2000
;
}
if
(
attacker
.
Id
==
CardId
.
ApprenticeLllusionMagician
&&
ApprenticeLllusionMagician_count
>=
2
)
{
attacker
.
RealPower
+=
2000
;
}
if
((
attacker
.
Id
==
CardId
.
DarkMagician
||
attacker
.
Id
==
CardId
.
DarkMagicianTheDragonKnight
)
&&
Bot
.
HasInSpellZone
(
CardId
.
EternalSoul
))
{
return
true
;
}
if
(
attacker
.
Id
==
CardId
.
CrystalWingSynchroDragon
)
{
if
(
defender
.
Level
>=
5
)
attacker
.
RealPower
=
9999
;
if
(
CrystalWingSynchroDragon_used
==
false
)
return
true
;
}
if
(!
big_attack_used
&&
big_attack
)
{
attacker
.
RealPower
=
9999
;
big_attack_used
=
true
;
return
true
;
}
if
(
attacker
.
Id
==
CardId
.
ApprenticeLllusionMagician
)
Logger
.
DebugWriteLine
(
"@@@@@@@@@@@@@@@@@@@ApprenticeLllusionMagician= "
+
attacker
.
RealPower
);
if
(
Bot
.
HasInSpellZone
(
CardId
.
EternalSoul
)
&&
(
attacker
.
Id
==
CardId
.
DarkMagician
||
attacker
.
Id
==
CardId
.
DarkMagicianTheDragonKnight
||
attacker
.
Id
==
CardId
.
MagicianOfLllusion
))
return
true
;
return
base
.
OnPreBattleBetween
(
attacker
,
defender
);
}
/*
public override BattlePhaseAction OnSelectAttackTarget(ClientCard attacker, IList<ClientCard> defenders)
{
for (int i = 0; i < defenders.Count; ++i)
{
ClientCard defender = defenders[i];
if (Enemy.HasInMonstersZone(CardId.MekkKnightMorningStar))
{
for (int b = 0; b <= 6; b++)
{
if (Enemy.MonsterZone[b] != null &&
SameMonsterColumn(attackerzone, b) &&
Bot.MonsterZone[attackerzone].Id == attacker.Id && Enemy.MonsterZone[b].Id == defender.Id)
{
defenderzone = b;
}
}
if (defenderzone == -1)
{
Logger.DebugWriteLine("**********firstattackerzone= " + attackerzone + " firstTargetzone= " + defenderzone);
return null;
}
}
}
defenderzone = -1;
return base.OnSelectAttackTarget(attacker,defenders);
}
*/
/*
public override ClientCard OnSelectAttacker(IList<ClientCard> attackers, IList<ClientCard> defenders)
{
for (int i = 0; i < attackers.Count; ++i)
{
ClientCard attacker = attackers[i];
for(int j = 0;j < defenders.Count;++j)
{
ClientCard defender = defenders[j];
if (Enemy.HasInMonstersZone(CardId.MekkKnightMorningStar))
{
attackerzone = -1;
defenderzone = -1;
for(int a = 0;a <= 6;a++)
for(int b = 0;b <= 6;b++)
{
if (Bot.MonsterZone[a] != null && Enemy.MonsterZone[b]!=null &&
SameMonsterColumn(a,b) &&
Bot.MonsterZone[a].Id==attacker.Id && Enemy.MonsterZone[b].Id == defender.Id)
{
attackerzone = a;
defenderzone = b;
}
}
if (defenderzone != -1)
{
Logger.DebugWriteLine("**********firstattackerzone= " + attackerzone + " firstdefenderzone= " + defenderzone);
return attacker;
}
}
}
}
return base.OnSelectAttacker(attackers,defenders);
}
*/
public
bool
MonsterRepos
()
{
if
(
Bot
.
HasInMonstersZone
(
CardId
.
OddEyesWingDragon
)
||
Bot
.
HasInSpellZone
(
CardId
.
OddEyesWingDragon
)
||
Bot
.
HasInMonstersZone
(
CardId
.
OddEyesAbsoluteDragon
))
{
if
(
Card
.
IsAttack
())
return
false
;
}
if
(
Bot
.
HasInMonstersZone
(
CardId
.
ApprenticeLllusionMagician
)
||
(
Bot
.
HasInHand
(
CardId
.
ApprenticeLllusionMagician
)))
{
if
(
Card
.
IsAttack
())
return
false
;
}
if
(
Card
.
IsFacedown
())
return
true
;
return
base
.
DefaultMonsterRepos
();
}
}
}
\ No newline at end of file
Game/AI/Decks/LightswornShaddoldinosourExecutor.cs
View file @
415dccdb
...
@@ -527,7 +527,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -527,7 +527,7 @@ namespace WindBot.Game.AI.Decks
private
bool
FairyTailSnowsummon
()
private
bool
FairyTailSnowsummon
()
{
{
ClientCard
target
=
AI
.
Utils
.
GetBestEnemyMonster
(
true
);
ClientCard
target
=
AI
.
Utils
.
GetBestEnemyMonster
(
true
,
true
);
if
(
target
!=
null
)
if
(
target
!=
null
)
{
{
return
true
;
return
true
;
...
@@ -541,7 +541,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -541,7 +541,7 @@ namespace WindBot.Game.AI.Decks
if
(
Card
.
Location
==
CardLocation
.
MonsterZone
)
if
(
Card
.
Location
==
CardLocation
.
MonsterZone
)
{
{
AI
.
SelectCard
(
AI
.
Utils
.
GetBestEnemyMonster
(
true
));
AI
.
SelectCard
(
AI
.
Utils
.
GetBestEnemyMonster
(
true
,
true
));
return
true
;
return
true
;
}
}
else
else
...
@@ -1052,7 +1052,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -1052,7 +1052,7 @@ namespace WindBot.Game.AI.Decks
if
(
Card
.
Location
==
CardLocation
.
Grave
)
if
(
Card
.
Location
==
CardLocation
.
Grave
)
return
true
;
return
true
;
if
(
Bot
.
LifePoints
<=
1000
)
return
false
;
if
(
Bot
.
LifePoints
<=
1000
)
return
false
;
ClientCard
select
=
AI
.
Utils
.
GetBestEnemy
Monster
();
ClientCard
select
=
AI
.
Utils
.
GetBestEnemy
Card
();
if
(
select
==
null
)
return
false
;
if
(
select
==
null
)
return
false
;
if
(
select
!=
null
)
if
(
select
!=
null
)
{
{
...
...
Game/AI/Decks/SkyStrikerExecutor.cs
View file @
415dccdb
...
@@ -11,18 +11,18 @@ namespace WindBot.Game.AI.Decks
...
@@ -11,18 +11,18 @@ namespace WindBot.Game.AI.Decks
{
{
public
class
CardId
public
class
CardId
{
{
public
const
int
R
ei
=
26077387
;
public
const
int
R
aye
=
26077387
;
public
const
int
Kagari
=
63288573
;
public
const
int
Kagari
=
63288573
;
public
const
int
Shizuku
=
90673288
;
public
const
int
Shizuku
=
90673288
;
public
const
int
Hayate
=
8491308
;
public
const
int
Hayate
=
8491308
;
public
const
int
Token
=
52340445
;
public
const
int
Token
=
52340445
;
public
const
int
Engage
=
63166095
;
public
const
int
Engage
=
63166095
;
public
const
int
Hornet
Bit
=
52340444
;
public
const
int
Hornet
Drones
=
52340444
;
public
const
int
WidowAnchor
=
98338152
;
public
const
int
WidowAnchor
=
98338152
;
public
const
int
Afterburner
=
99550630
;
public
const
int
Afterburner
s
=
99550630
;
public
const
int
JammingWave
=
25955749
;
public
const
int
JammingWave
=
25955749
;
public
const
int
Multi
Roll
=
24010609
;
public
const
int
Multi
role
=
24010609
;
public
const
int
HerculesBase
=
97616504
;
public
const
int
HerculesBase
=
97616504
;
public
const
int
AreaZero
=
50005218
;
public
const
int
AreaZero
=
50005218
;
...
@@ -73,22 +73,22 @@ namespace WindBot.Game.AI.Decks
...
@@ -73,22 +73,22 @@ namespace WindBot.Game.AI.Decks
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
TwinTwisters
,
TwinTwistersEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
TwinTwisters
,
TwinTwistersEffect
);
//
//
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Multi
Roll
,
MultiRoll
HandEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Multi
role
,
Multirole
HandEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
WidowAnchor
,
WidowAnchorEffectFirst
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
WidowAnchor
,
WidowAnchorEffectFirst
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Afterburner
,
Afterburner
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Afterburner
s
,
Afterburners
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
JammingWave
,
JammingWaveEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
JammingWave
,
JammingWaveEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Engage
,
EngageEffectFirst
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Engage
,
EngageEffectFirst
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Hornet
Bit
,
HornetBit
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Hornet
Drones
,
HornetDrones
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
WidowAnchor
,
WidowAnchorEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
WidowAnchor
,
WidowAnchorEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
HerculesBase
,
HerculesBaseEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
HerculesBase
,
HerculesBaseEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
AreaZero
,
AreaZeroEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
AreaZero
,
AreaZeroEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Multi
Roll
,
MultiRoll
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Multi
role
,
Multirole
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Engage
,
EngageEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Engage
,
EngageEffect
);
...
@@ -98,7 +98,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -98,7 +98,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
GhostRabbit
,
TunerSummon
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
GhostRabbit
,
TunerSummon
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
AshBlossom
,
TunerSummon
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
AshBlossom
,
TunerSummon
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
R
ei
,
Rei
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
R
aye
,
Raye
Effect
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
Kagari
,
KagariSummon
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
Kagari
,
KagariSummon
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Kagari
,
KagariEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Kagari
,
KagariEffect
);
...
@@ -116,7 +116,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -116,7 +116,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
TopologicBomberDragon
,
AI
.
Utils
.
IsTurn1OrMain2
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
TopologicBomberDragon
,
AI
.
Utils
.
IsTurn1OrMain2
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
R
ei
,
Rei
Summon
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
R
aye
,
Raye
Summon
);
//
//
AddExecutor
(
ExecutorType
.
SpellSet
,
CardId
.
SolemnJudgment
);
AddExecutor
(
ExecutorType
.
SpellSet
,
CardId
.
SolemnJudgment
);
...
@@ -125,11 +125,11 @@ namespace WindBot.Game.AI.Decks
...
@@ -125,11 +125,11 @@ namespace WindBot.Game.AI.Decks
AddExecutor
(
ExecutorType
.
SpellSet
,
CardId
.
HerculesBase
);
AddExecutor
(
ExecutorType
.
SpellSet
,
CardId
.
HerculesBase
);
AddExecutor
(
ExecutorType
.
SpellSet
,
CardId
.
TwinTwisters
,
HandFull
);
AddExecutor
(
ExecutorType
.
SpellSet
,
CardId
.
TwinTwisters
,
HandFull
);
AddExecutor
(
ExecutorType
.
SpellSet
,
CardId
.
Hornet
Bit
,
HandFull
);
AddExecutor
(
ExecutorType
.
SpellSet
,
CardId
.
Hornet
Drones
,
HandFull
);
//
//
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
MetalfoesFusion
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
MetalfoesFusion
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Multi
Roll
,
MultiRoll
EPEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Multi
role
,
Multirole
EPEffect
);
AddExecutor
(
ExecutorType
.
Repos
,
DefaultMonsterRepos
);
AddExecutor
(
ExecutorType
.
Repos
,
DefaultMonsterRepos
);
}
}
...
@@ -177,7 +177,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -177,7 +177,7 @@ namespace WindBot.Game.AI.Decks
else
else
return
false
;
return
false
;
}
}
if
(
desc
==
AI
.
Utils
.
GetStringId
(
CardId
.
Afterburner
,
0
))
// destroy spell & trap?
if
(
desc
==
AI
.
Utils
.
GetStringId
(
CardId
.
Afterburner
s
,
0
))
// destroy spell & trap?
{
{
ClientCard
target
=
AI
.
Utils
.
GetBestEnemySpell
();
ClientCard
target
=
AI
.
Utils
.
GetBestEnemySpell
();
if
(
target
!=
null
)
if
(
target
!=
null
)
...
@@ -233,24 +233,24 @@ namespace WindBot.Game.AI.Decks
...
@@ -233,24 +233,24 @@ namespace WindBot.Game.AI.Decks
CardId
.
MetalfoesFusion
,
CardId
.
MetalfoesFusion
,
CardId
.
WidowAnchor
,
CardId
.
WidowAnchor
,
CardId
.
Engage
,
CardId
.
Engage
,
CardId
.
Hornet
Bit
CardId
.
Hornet
Drones
});
});
return
true
;
return
true
;
}
}
private
bool
Multi
Roll
HandEffect
()
private
bool
Multi
role
HandEffect
()
{
{
return
Card
.
Location
==
CardLocation
.
Hand
;
return
Card
.
Location
==
CardLocation
.
Hand
;
}
}
private
bool
Multi
Roll
EPEffect
()
private
bool
Multi
role
EPEffect
()
{
{
if
(
Duel
.
Phase
!=
DuelPhase
.
End
)
if
(
Duel
.
Phase
!=
DuelPhase
.
End
)
return
false
;
return
false
;
IList
<
int
>
targets
=
new
[]
{
IList
<
int
>
targets
=
new
[]
{
CardId
.
Engage
,
CardId
.
Engage
,
CardId
.
Hornet
Bit
,
CardId
.
Hornet
Drones
,
CardId
.
WidowAnchor
CardId
.
WidowAnchor
};
};
AI
.
SelectCard
(
targets
);
AI
.
SelectCard
(
targets
);
...
@@ -259,7 +259,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -259,7 +259,7 @@ namespace WindBot.Game.AI.Decks
return
true
;
return
true
;
}
}
private
bool
AfterburnerEffect
()
private
bool
Afterburner
s
Effect
()
{
{
ClientCard
target
=
AI
.
Utils
.
GetBestEnemyMonster
(
true
);
ClientCard
target
=
AI
.
Utils
.
GetBestEnemyMonster
(
true
);
if
(
target
!=
null
)
if
(
target
!=
null
)
...
@@ -291,6 +291,8 @@ namespace WindBot.Game.AI.Decks
...
@@ -291,6 +291,8 @@ namespace WindBot.Game.AI.Decks
private
bool
WidowAnchorEffectFirst
()
private
bool
WidowAnchorEffectFirst
()
{
{
if
(
AI
.
Utils
.
ChainContainsCard
(
CardId
.
WidowAnchor
))
return
false
;
ClientCard
target
=
AI
.
Utils
.
GetProblematicEnemyMonster
();
ClientCard
target
=
AI
.
Utils
.
GetProblematicEnemyMonster
();
if
(
target
!=
null
)
if
(
target
!=
null
)
{
{
...
@@ -311,11 +313,11 @@ namespace WindBot.Game.AI.Decks
...
@@ -311,11 +313,11 @@ namespace WindBot.Game.AI.Decks
AI
.
SelectCard
(
target
);
AI
.
SelectCard
(
target
);
else
else
AI
.
SelectCard
(
new
[]
{
AI
.
SelectCard
(
new
[]
{
CardId
.
Multi
Roll
,
CardId
.
Multi
role
,
CardId
.
AreaZero
,
CardId
.
AreaZero
,
CardId
.
Afterburner
,
CardId
.
Afterburner
s
,
CardId
.
JammingWave
,
CardId
.
JammingWave
,
CardId
.
R
ei
CardId
.
R
aye
});
});
return
true
;
return
true
;
...
@@ -329,17 +331,17 @@ namespace WindBot.Game.AI.Decks
...
@@ -329,17 +331,17 @@ namespace WindBot.Game.AI.Decks
AI
.
SelectCard
(
target
);
AI
.
SelectCard
(
target
);
else
else
AI
.
SelectCard
(
new
[]
{
AI
.
SelectCard
(
new
[]
{
CardId
.
Multi
Roll
,
CardId
.
Multi
role
,
CardId
.
AreaZero
,
CardId
.
AreaZero
,
CardId
.
Afterburner
,
CardId
.
Afterburner
s
,
CardId
.
JammingWave
,
CardId
.
JammingWave
,
CardId
.
R
ei
CardId
.
R
aye
});
});
return
true
;
return
true
;
}
}
private
bool
Hornet
Bit
Effect
()
private
bool
Hornet
Drones
Effect
()
{
{
if
(
Duel
.
Player
==
1
)
if
(
Duel
.
Player
==
1
)
{
{
...
@@ -449,7 +451,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -449,7 +451,7 @@ namespace WindBot.Game.AI.Decks
}
}
foreach
(
ClientCard
target
in
Bot
.
GetMonsters
())
foreach
(
ClientCard
target
in
Bot
.
GetMonsters
())
{
{
if
(
target
.
Id
==
CardId
.
R
ei
&&
Bot
.
GetMonstersExtraZoneCount
()
==
0
)
if
(
target
.
Id
==
CardId
.
R
aye
&&
Bot
.
GetMonstersExtraZoneCount
()
==
0
)
{
{
AI
.
SelectCard
(
target
);
AI
.
SelectCard
(
target
);
return
true
;
return
true
;
...
@@ -457,7 +459,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -457,7 +459,7 @@ namespace WindBot.Game.AI.Decks
}
}
foreach
(
ClientCard
target
in
Bot
.
GetSpells
())
foreach
(
ClientCard
target
in
Bot
.
GetSpells
())
{
{
if
(
target
.
Id
!=
CardId
.
AreaZero
&&
target
.
Id
!=
CardId
.
Multi
Roll
&&
target
.
Id
!=
CardId
.
WidowAnchor
&&
target
.
IsSpell
())
if
(
target
.
Id
!=
CardId
.
AreaZero
&&
target
.
Id
!=
CardId
.
Multi
role
&&
target
.
Id
!=
CardId
.
WidowAnchor
&&
target
.
IsSpell
())
{
{
AI
.
SelectCard
(
target
);
AI
.
SelectCard
(
target
);
return
true
;
return
true
;
...
@@ -466,7 +468,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -466,7 +468,7 @@ namespace WindBot.Game.AI.Decks
return
false
;
return
false
;
}
}
private
bool
Multi
Roll
Effect
()
private
bool
Multi
role
Effect
()
{
{
if
(
Card
.
Location
==
CardLocation
.
SpellZone
)
if
(
Card
.
Location
==
CardLocation
.
SpellZone
)
{
{
...
@@ -480,7 +482,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -480,7 +482,7 @@ namespace WindBot.Game.AI.Decks
}
}
foreach
(
ClientCard
target
in
Bot
.
GetMonsters
())
foreach
(
ClientCard
target
in
Bot
.
GetMonsters
())
{
{
if
(
target
.
Id
==
CardId
.
R
ei
&&
Bot
.
GetMonstersExtraZoneCount
()
==
0
)
if
(
target
.
Id
==
CardId
.
R
aye
&&
Bot
.
GetMonstersExtraZoneCount
()
==
0
)
{
{
AI
.
SelectCard
(
target
);
AI
.
SelectCard
(
target
);
return
true
;
return
true
;
...
@@ -496,7 +498,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -496,7 +498,7 @@ namespace WindBot.Game.AI.Decks
}
}
foreach
(
ClientCard
target
in
Bot
.
GetSpells
())
foreach
(
ClientCard
target
in
Bot
.
GetSpells
())
{
{
if
(
target
.
Id
!=
CardId
.
Multi
Roll
&&
target
.
Id
!=
CardId
.
WidowAnchor
&&
target
.
IsSpell
())
if
(
target
.
Id
!=
CardId
.
Multi
role
&&
target
.
Id
!=
CardId
.
WidowAnchor
&&
target
.
IsSpell
())
{
{
AI
.
SelectCard
(
target
);
AI
.
SelectCard
(
target
);
return
true
;
return
true
;
...
@@ -506,7 +508,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -506,7 +508,7 @@ namespace WindBot.Game.AI.Decks
return
false
;
return
false
;
}
}
private
bool
R
ei
Summon
()
private
bool
R
aye
Summon
()
{
{
if
(
Bot
.
GetMonstersExtraZoneCount
()
==
0
)
if
(
Bot
.
GetMonstersExtraZoneCount
()
==
0
)
{
{
...
@@ -515,7 +517,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -515,7 +517,7 @@ namespace WindBot.Game.AI.Decks
return
false
;
return
false
;
}
}
private
bool
R
ei
Effect
()
private
bool
R
aye
Effect
()
{
{
if
(
Card
.
Location
==
CardLocation
.
Grave
)
if
(
Card
.
Location
==
CardLocation
.
Grave
)
{
{
...
@@ -527,32 +529,32 @@ namespace WindBot.Game.AI.Decks
...
@@ -527,32 +529,32 @@ namespace WindBot.Game.AI.Decks
}
}
if
(
AI
.
Utils
.
IsChainTarget
(
Card
))
if
(
AI
.
Utils
.
IsChainTarget
(
Card
))
{
{
R
ei
SelectTarget
();
R
aye
SelectTarget
();
return
true
;
return
true
;
}
}
if
(
Card
.
Attacked
&&
Duel
.
Phase
==
DuelPhase
.
BattleStart
)
if
(
Card
.
Attacked
&&
Duel
.
Phase
==
DuelPhase
.
BattleStart
)
{
{
R
ei
SelectTarget
();
R
aye
SelectTarget
();
return
true
;
return
true
;
}
}
if
(
Card
==
Bot
.
BattlingMonster
&&
Duel
.
Player
==
1
)
if
(
Card
==
Bot
.
BattlingMonster
&&
Duel
.
Player
==
1
)
{
{
R
ei
SelectTarget
();
R
aye
SelectTarget
();
return
true
;
return
true
;
}
}
if
(
Duel
.
Phase
==
DuelPhase
.
Main2
)
if
(
Duel
.
Phase
==
DuelPhase
.
Main2
)
{
{
R
ei
SelectTarget
();
R
aye
SelectTarget
();
return
true
;
return
true
;
}
}
return
false
;
return
false
;
}
}
private
void
R
ei
SelectTarget
()
private
void
R
aye
SelectTarget
()
{
{
if
(!
KagariSummoned
&&
Bot
.
HasInGraveyard
(
new
[]
{
if
(!
KagariSummoned
&&
Bot
.
HasInGraveyard
(
new
[]
{
CardId
.
Engage
,
CardId
.
Engage
,
CardId
.
Hornet
Bit
,
CardId
.
Hornet
Drones
,
CardId
.
WidowAnchor
CardId
.
WidowAnchor
}))
}))
{
{
...
@@ -572,7 +574,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -572,7 +574,7 @@ namespace WindBot.Game.AI.Decks
{
{
if
(
Bot
.
HasInGraveyard
(
new
[]
{
if
(
Bot
.
HasInGraveyard
(
new
[]
{
CardId
.
Engage
,
CardId
.
Engage
,
CardId
.
Hornet
Bit
,
CardId
.
Hornet
Drones
,
CardId
.
WidowAnchor
CardId
.
WidowAnchor
}))
}))
{
{
...
@@ -584,9 +586,9 @@ namespace WindBot.Game.AI.Decks
...
@@ -584,9 +586,9 @@ namespace WindBot.Game.AI.Decks
private
bool
KagariEffect
()
private
bool
KagariEffect
()
{
{
if
(
EmptyMainMonsterZone
()
&&
AI
.
Utils
.
GetProblematicEnemyMonster
()
!=
null
&&
Bot
.
HasInGraveyard
(
CardId
.
Afterburner
))
if
(
EmptyMainMonsterZone
()
&&
AI
.
Utils
.
GetProblematicEnemyMonster
()
!=
null
&&
Bot
.
HasInGraveyard
(
CardId
.
Afterburner
s
))
{
{
AI
.
SelectCard
(
CardId
.
Afterburner
);
AI
.
SelectCard
(
CardId
.
Afterburner
s
);
}
}
else
if
(
EmptyMainMonsterZone
()
&&
AI
.
Utils
.
GetProblematicEnemySpell
()
!=
null
&&
Bot
.
HasInGraveyard
(
CardId
.
JammingWave
))
else
if
(
EmptyMainMonsterZone
()
&&
AI
.
Utils
.
GetProblematicEnemySpell
()
!=
null
&&
Bot
.
HasInGraveyard
(
CardId
.
JammingWave
))
{
{
...
@@ -595,7 +597,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -595,7 +597,7 @@ namespace WindBot.Game.AI.Decks
else
else
AI
.
SelectCard
(
new
[]
{
AI
.
SelectCard
(
new
[]
{
CardId
.
Engage
,
CardId
.
Engage
,
CardId
.
Hornet
Bit
,
CardId
.
Hornet
Drones
,
CardId
.
WidowAnchor
CardId
.
WidowAnchor
});
});
return
true
;
return
true
;
...
@@ -619,7 +621,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -619,7 +621,7 @@ namespace WindBot.Game.AI.Decks
else
else
AI
.
SelectCard
(
new
[]
{
AI
.
SelectCard
(
new
[]
{
CardId
.
Engage
,
CardId
.
Engage
,
CardId
.
Hornet
Bit
,
CardId
.
Hornet
Drones
,
CardId
.
WidowAnchor
CardId
.
WidowAnchor
});
});
return
true
;
return
true
;
...
@@ -635,10 +637,10 @@ namespace WindBot.Game.AI.Decks
...
@@ -635,10 +637,10 @@ namespace WindBot.Game.AI.Decks
private
bool
HayateEffect
()
private
bool
HayateEffect
()
{
{
if
(!
Bot
.
HasInGraveyard
(
CardId
.
R
ei
))
if
(!
Bot
.
HasInGraveyard
(
CardId
.
R
aye
))
AI
.
SelectCard
(
CardId
.
R
ei
);
AI
.
SelectCard
(
CardId
.
R
aye
);
else
if
(!
Bot
.
HasInGraveyard
(
CardId
.
Hornet
Bit
))
else
if
(!
Bot
.
HasInGraveyard
(
CardId
.
Hornet
Drones
))
AI
.
SelectCard
(
CardId
.
Hornet
Bit
);
AI
.
SelectCard
(
CardId
.
Hornet
Drones
);
else
if
(!
Bot
.
HasInGraveyard
(
CardId
.
WidowAnchor
))
else
if
(!
Bot
.
HasInGraveyard
(
CardId
.
WidowAnchor
))
AI
.
SelectCard
(
CardId
.
WidowAnchor
);
AI
.
SelectCard
(
CardId
.
WidowAnchor
);
return
true
;
return
true
;
...
@@ -676,7 +678,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -676,7 +678,7 @@ namespace WindBot.Game.AI.Decks
private
bool
JetSynchronEffect
()
private
bool
JetSynchronEffect
()
{
{
if
(
Bot
.
HasInMonstersZone
(
CardId
.
R
ei
)
||
Bot
.
HasInMonstersZone
(
CardId
.
CrystronNeedlefiber
))
if
(
Bot
.
HasInMonstersZone
(
CardId
.
R
aye
)
||
Bot
.
HasInMonstersZone
(
CardId
.
CrystronNeedlefiber
))
{
{
AI
.
SelectCard
(
GetDiscardHand
());
AI
.
SelectCard
(
GetDiscardHand
());
AI
.
SelectPosition
(
CardPosition
.
FaceUpDefence
);
AI
.
SelectPosition
(
CardPosition
.
FaceUpDefence
);
...
@@ -694,8 +696,8 @@ namespace WindBot.Game.AI.Decks
...
@@ -694,8 +696,8 @@ namespace WindBot.Game.AI.Decks
{
{
if
(
Bot
.
HasInHand
(
CardId
.
MetalfoesFusion
))
if
(
Bot
.
HasInHand
(
CardId
.
MetalfoesFusion
))
return
CardId
.
MetalfoesFusion
;
return
CardId
.
MetalfoesFusion
;
if
(
Bot
.
HasInHand
(
CardId
.
R
ei
)
&&
!
Bot
.
HasInGraveyard
(
CardId
.
Rei
))
if
(
Bot
.
HasInHand
(
CardId
.
R
aye
)
&&
!
Bot
.
HasInGraveyard
(
CardId
.
Raye
))
return
CardId
.
R
ei
;
return
CardId
.
R
aye
;
if
(
Bot
.
HasInHand
(
CardId
.
JetSynchron
))
if
(
Bot
.
HasInHand
(
CardId
.
JetSynchron
))
return
CardId
.
JetSynchron
;
return
CardId
.
JetSynchron
;
if
(
Bot
.
HasInHand
(
CardId
.
ReinforcementOfTheArmy
))
if
(
Bot
.
HasInHand
(
CardId
.
ReinforcementOfTheArmy
))
...
@@ -707,25 +709,25 @@ namespace WindBot.Game.AI.Decks
...
@@ -707,25 +709,25 @@ namespace WindBot.Game.AI.Decks
private
int
GetCardToSearch
()
private
int
GetCardToSearch
()
{
{
if
(!
Bot
.
HasInHand
(
CardId
.
Hornet
Bit
)
&&
Bot
.
GetRemainingCount
(
CardId
.
HornetBit
,
3
)
>
0
)
if
(!
Bot
.
HasInHand
(
CardId
.
Hornet
Drones
)
&&
Bot
.
GetRemainingCount
(
CardId
.
HornetDrones
,
3
)
>
0
)
{
{
return
CardId
.
Hornet
Bit
;
return
CardId
.
Hornet
Drones
;
}
}
else
if
(
AI
.
Utils
.
GetProblematicEnemyMonster
()
!=
null
&&
Bot
.
GetRemainingCount
(
CardId
.
WidowAnchor
,
3
)
>
0
)
else
if
(
AI
.
Utils
.
GetProblematicEnemyMonster
()
!=
null
&&
Bot
.
GetRemainingCount
(
CardId
.
WidowAnchor
,
3
)
>
0
)
{
{
return
CardId
.
WidowAnchor
;
return
CardId
.
WidowAnchor
;
}
}
else
if
(
EmptyMainMonsterZone
()
&&
AI
.
Utils
.
GetProblematicEnemyMonster
()
!=
null
&&
Bot
.
GetRemainingCount
(
CardId
.
Afterburner
,
1
)
>
0
)
else
if
(
EmptyMainMonsterZone
()
&&
AI
.
Utils
.
GetProblematicEnemyMonster
()
!=
null
&&
Bot
.
GetRemainingCount
(
CardId
.
Afterburner
s
,
1
)
>
0
)
{
{
return
CardId
.
Afterburner
;
return
CardId
.
Afterburner
s
;
}
}
else
if
(
EmptyMainMonsterZone
()
&&
AI
.
Utils
.
GetProblematicEnemySpell
()
!=
null
&&
Bot
.
GetRemainingCount
(
CardId
.
JammingWave
,
1
)
>
0
)
else
if
(
EmptyMainMonsterZone
()
&&
AI
.
Utils
.
GetProblematicEnemySpell
()
!=
null
&&
Bot
.
GetRemainingCount
(
CardId
.
JammingWave
,
1
)
>
0
)
{
{
return
CardId
.
JammingWave
;
return
CardId
.
JammingWave
;
}
}
else
if
(!
Bot
.
HasInHand
(
CardId
.
R
ei
)
&&
!
Bot
.
HasInMonstersZone
(
CardId
.
Rei
)
&&
Bot
.
GetRemainingCount
(
CardId
.
Rei
,
3
)
>
0
)
else
if
(!
Bot
.
HasInHand
(
CardId
.
R
aye
)
&&
!
Bot
.
HasInMonstersZone
(
CardId
.
Raye
)
&&
Bot
.
GetRemainingCount
(
CardId
.
Raye
,
3
)
>
0
)
{
{
return
CardId
.
R
ei
;
return
CardId
.
R
aye
;
}
}
else
if
(!
Bot
.
HasInHand
(
CardId
.
WidowAnchor
)
&&
!
Bot
.
HasInSpellZone
(
CardId
.
WidowAnchor
)
&&
Bot
.
GetRemainingCount
(
CardId
.
WidowAnchor
,
3
)
>
0
)
else
if
(!
Bot
.
HasInHand
(
CardId
.
WidowAnchor
)
&&
!
Bot
.
HasInSpellZone
(
CardId
.
WidowAnchor
)
&&
Bot
.
GetRemainingCount
(
CardId
.
WidowAnchor
,
3
)
>
0
)
{
{
...
...
Game/AI/DefaultExecutor.cs
View file @
415dccdb
...
@@ -25,7 +25,9 @@ namespace WindBot.Game.AI
...
@@ -25,7 +25,9 @@ namespace WindBot.Game.AI
public
const
int
DupeFrog
=
46239604
;
public
const
int
DupeFrog
=
46239604
;
public
const
int
MaraudingCaptain
=
2460565
;
public
const
int
MaraudingCaptain
=
2460565
;
public
const
int
EvilswarmExcitonKnight
=
46772449
;
public
const
int
HarpiesFeatherDuster
=
18144506
;
public
const
int
HarpiesFeatherDuster
=
18144506
;
public
const
int
DarkMagicAttack
=
2314238
;
public
const
int
MysticalSpaceTyphoon
=
5318639
;
public
const
int
MysticalSpaceTyphoon
=
5318639
;
public
const
int
CosmicCyclone
=
8267140
;
public
const
int
CosmicCyclone
=
8267140
;
public
const
int
ChickenGame
=
67616300
;
public
const
int
ChickenGame
=
67616300
;
...
@@ -39,6 +41,7 @@ namespace WindBot.Game.AI
...
@@ -39,6 +41,7 @@ namespace WindBot.Game.AI
public
const
int
VampireFr
ä
ulein
=
6039967
;
public
const
int
VampireFr
ä
ulein
=
6039967
;
public
const
int
InjectionFairyLily
=
79575620
;
public
const
int
InjectionFairyLily
=
79575620
;
public
const
int
BlueEyesChaosMAXDragon
=
55410871
;
}
}
protected
DefaultExecutor
(
GameAI
ai
,
Duel
duel
)
protected
DefaultExecutor
(
GameAI
ai
,
Duel
duel
)
...
@@ -310,15 +313,31 @@ namespace WindBot.Game.AI
...
@@ -310,15 +313,31 @@ namespace WindBot.Game.AI
}
}
/// <summary>
/// <summary>
/// Chain the enemy monster.
/// Chain the enemy monster
, or disable monster like Rescue Rabbit
.
/// </summary>
/// </summary>
protected
bool
DefaultBreakthroughSkill
()
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
();
ClientCard
LastChainCard
=
AI
.
Utils
.
GetLastChainCard
();
if
(
LastChainCard
==
null
)
if
(
LastChainCard
==
null
)
return
false
;
return
false
;
if
(
LastChainCard
.
Controller
!=
1
||
LastChainCard
.
Location
!=
CardLocation
.
MonsterZone
||
!
DefaultUniqueTrap
())
if
(
LastChainCard
.
Controller
!=
1
||
LastChainCard
.
Location
!=
CardLocation
.
MonsterZone
||
LastChainCard
.
IsDisabled
()
||
LastChainCard
.
IsShouldNotBeTarget
()
||
LastChainCard
.
IsShouldNotBeSpellTrapTarget
())
return
false
;
return
false
;
AI
.
SelectCard
(
LastChainCard
);
AI
.
SelectCard
(
LastChainCard
);
return
true
;
return
true
;
...
@@ -453,7 +472,13 @@ namespace WindBot.Game.AI
...
@@ -453,7 +472,13 @@ namespace WindBot.Game.AI
{
{
if
(
Card
.
IsFaceup
()
&&
Card
.
IsDefense
()
&&
Card
.
Attack
==
0
)
if
(
Card
.
IsFaceup
()
&&
Card
.
IsDefense
()
&&
Card
.
Attack
==
0
)
return
false
;
return
false
;
if
(
Enemy
.
HasInMonstersZone
(
_CardId
.
BlueEyesChaosMAXDragon
)
&&
Card
.
IsAttack
()
&&
(
4000
-
Card
.
Defense
)*
2
>(
4000
-
Card
.
Attack
))
return
false
;
if
(
Enemy
.
HasInMonstersZone
(
_CardId
.
BlueEyesChaosMAXDragon
)
&&
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
)
if
(
Card
.
IsAttack
()
&&
enemyBetter
)
...
@@ -469,7 +494,9 @@ namespace WindBot.Game.AI
...
@@ -469,7 +494,9 @@ namespace WindBot.Game.AI
protected
bool
DefaultOnBecomeTarget
()
protected
bool
DefaultOnBecomeTarget
()
{
{
if
(
AI
.
Utils
.
IsChainTarget
(
Card
))
return
true
;
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
.
HarpiesFeatherDuster
,
true
))
return
true
;
if
(
Enemy
.
HasInSpellZone
(
_CardId
.
DarkMagicAttack
,
true
))
return
true
;
return
false
;
return
false
;
}
}
/// <summary>
/// <summary>
...
...
Game/AI/Dialogs.cs
View file @
415dccdb
...
@@ -80,15 +80,15 @@ namespace WindBot.Game.AI
...
@@ -80,15 +80,15 @@ namespace WindBot.Game.AI
public
void
SendSorry
()
public
void
SendSorry
()
{
{
InternalSendMessage
(
new
[]
{
"Sorry, an error occurs."
});
InternalSendMessage
Forced
(
new
[]
{
"Sorry, an error occurs."
});
}
}
public
void
SendDeckSorry
(
string
card
)
public
void
SendDeckSorry
(
string
card
)
{
{
if
(
card
==
"DECK"
)
if
(
card
==
"DECK"
)
InternalSendMessage
(
new
[]
{
"Deck illegal. Please check the database of your YGOPro and WindBot."
});
InternalSendMessage
Forced
(
new
[]
{
"Deck illegal. Please check the database of your YGOPro and WindBot."
});
else
else
InternalSendMessage
(
_deckerror
,
card
);
InternalSendMessage
Forced
(
_deckerror
,
card
);
}
}
public
void
SendWelcome
()
public
void
SendWelcome
()
...
@@ -159,6 +159,15 @@ namespace WindBot.Game.AI
...
@@ -159,6 +159,15 @@ namespace WindBot.Game.AI
}
}
private
void
InternalSendMessage
(
IList
<
string
>
array
,
params
object
[]
opts
)
private
void
InternalSendMessage
(
IList
<
string
>
array
,
params
object
[]
opts
)
{
if
(!
_game
.
_chat
)
return
;
string
message
=
string
.
Format
(
array
[
Program
.
Rand
.
Next
(
array
.
Count
)],
opts
);
if
(
message
!=
""
)
_game
.
Chat
(
message
);
}
private
void
InternalSendMessageForced
(
IList
<
string
>
array
,
params
object
[]
opts
)
{
{
string
message
=
string
.
Format
(
array
[
Program
.
Rand
.
Next
(
array
.
Count
)],
opts
);
string
message
=
string
.
Format
(
array
[
Program
.
Rand
.
Next
(
array
.
Count
)],
opts
);
if
(
message
!=
""
)
if
(
message
!=
""
)
...
...
Game/AI/Enums/Floodgate.cs
View file @
415dccdb
...
@@ -72,6 +72,7 @@
...
@@ -72,6 +72,7 @@
ElShaddollGrysra
=
48424886
,
ElShaddollGrysra
=
48424886
,
ElShaddollWinda
=
94977269
,
ElShaddollWinda
=
94977269
,
UltimateConductorTytanno
=
18940556
,
UltimateConductorTytanno
=
18940556
,
OvertexCoatls
=
41782653
OvertexCoatls
=
41782653
,
FirePrison
=
269510
}
}
}
}
Game/AI/Enums/ShouldBeDisabledBeforeItUseEffectMonster.cs
0 → 100644
View file @
415dccdb
namespace
WindBot.Game.AI.Enums
{
/// <summary>
/// Monsters that release or banish itself to use effect. So them should be disabled (with Breakthrough Skill) before it use effect.
/// </summary>
public
enum
ShouldBeDisabledBeforeItUseEffectMonster
{
MachinaMegaform
=
51617185
,
DarkSummoningBeast
=
87917187
,
GemKnightAlexandrite
=
90019393
,
RedEyesRetroDragon
=
53485634
,
DeepSweeper
=
8649148
,
BeastWarriorPuma
=
16796157
,
ZefrasaberSwordmasteroftheNekroz
=
84388461
,
CipherWing
=
81974607
,
MadolcheAnjelly
=
34680482
,
PlanetPathfinder
=
97526666
,
RescueCat
=
14878871
,
RescueHamster
=
50485594
,
RescueFerret
=
56343672
,
RescueRabbit
=
85138716
,
GalaxyWizard
=
98555327
,
Backlinker
=
71172240
,
Merlin
=
3580032
,
CrystalVanguard
=
87475570
,
Kuribandit
=
16404809
,
PhotonLizard
=
38973775
,
SuperheavySamuraiFlutist
=
27978707
,
ConstellarRasalhague
=
70624184
,
CardcarD
=
45812361
,
UnifloraMysticalBeastoftheForest
=
36318200
,
BusterWhelpoftheDestructionSwordsman
=
49823708
,
GalaxyEyesCloudragon
=
9260791
,
SylvanPrincessprout
=
20579538
,
AltergeistPixiel
=
57769391
,
AbyssActorExtras
=
88412339
,
PerformapalTrumpWitch
=
91584698
,
RaidraptorLastStrix
=
97219708
,
TimeMaiden
=
27107590
,
SuperQuantalFairyAlphan
=
58753372
,
TheBlackStoneofLegend
=
66574418
,
PaladinofDarkDragon
=
71408082
,
PaladinofPhotonDragon
=
85346853
,
TwinPhotonLizard
=
29455728
}
}
Game/AI/Enums/ShouldNotBeMonsterTarget.cs
0 → 100644
View file @
415dccdb
namespace
WindBot.Game.AI.Enums
{
/// <summary>
/// Cards that are can't be selected as target of monster's effect, or immuned to monster's effect.
/// So them shouldn't be tried to be selected as target of monster at most times.
/// </summary>
public
enum
ShouldNotBeMonsterTarget
{
TheLegendaryFishermanII
=
19801646
,
FirstoftheDragons
=
10817524
,
Tatsunoko
=
55863245
,
CXyzSimontheGreatMoralLeader
=
41147577
,
PaleozoicAnomalocaris
=
61307542
,
PaleozoicOpabinia
=
37649320
,
BorreloadDragon
=
31833038
}
}
Game/AI/Enums/ShouldNotBeSpellTarget.cs
0 → 100644
View file @
415dccdb
namespace
WindBot.Game.AI.Enums
{
/// <summary>
/// Cards that are can't be selected as target of spell&trap's effect, or immuned to spell&trap's effect.
/// So them shouldn't be tried to be selected as target of spell&trap at most times.
/// </summary>
public
enum
ShouldNotBeSpellTrapTarget
{
ApoqliphortTowers
=
27279764
,
ApoqliphortSkybase
=
40061558
,
TheLegendaryFishermanIII
=
44968687
,
ChaosAncientGearGiant
=
51788412
}
}
Game/AI/Enums/ShouldNotBeTarget.cs
0 → 100644
View file @
415dccdb
namespace
WindBot.Game.AI.Enums
{
/// <summary>
/// Cards that are can't be selected as target, or immuned to most effect.
/// So them shouldn't be tried to be selected as target at most times.
/// </summary>
public
enum
ShouldNotBeTarget
{
DivineSerpentGeh
=
82103466
,
ObelisktheTormentor
=
10000000
,
TheWingedDragonofRaSphereMode
=
10000080
,
TheWingedDragonofRaImmortalPhoenix
=
10000090
,
KozmoDarkPlanet
=
85991529
,
ZushintheSleepingGiant
=
67547370
,
TheLegendaryExodiaIncarnate
=
58604027
,
KozmoDarkEclipser
=
64063868
,
KozmoDarkDestroyer
=
55885348
,
KozmoForerunner
=
20849090
,
MajespecterUnicornKirin
=
31178212
,
WorldLegacyWorldShield
=
55787576
,
KiwiMagicianGirl
=
82627406
,
MajespecterFoxKyubi
=
94784213
,
MajespecterToadOgama
=
645794
,
MajespecterCrowYata
=
68395509
,
MajespecterRaccoonBunbuku
=
31991800
,
MajespecterCatNekomata
=
5506791
,
HazyFlameHydra
=
8696773
,
HazyFlameMantikor
=
96051150
,
HazyFlameHyppogrif
=
31303283
,
HazyFlameCerbereus
=
38525760
,
HazyFlameSphynx
=
1409474
,
HazyFlamePeryton
=
37803172
,
HazyFlameGriffin
=
74010769
,
BlueEyesChaosMAXDragon
=
55410871
,
SupremeKingZARC
=
13331639
,
CrimsonNovaTrinitytheDarkCubicLord
=
72664875
,
LunalightLeoDancer
=
24550676
,
TimaeustheKnightofDestiny
=
53315891
,
DantePilgrimoftheBurningAbyss
=
18386170
,
AncientGearHowitzer
=
87182127
,
InvokedCocytus
=
85908279
,
LyriluscIndependentNightingale
=
76815942
,
FlowerCardianLightshower
=
42291297
,
YaziEviloftheYangZing
=
43202238
,
RaidraptorUltimateFalcon
=
86221741
,
DisdainfulBirdofParadise
=
27240101
,
DarkestDiabolosLordOfTheLair
=
50383626
}
}
Game/AI/Executor.cs
View file @
415dccdb
...
@@ -98,6 +98,11 @@ namespace WindBot.Game.AI
...
@@ -98,6 +98,11 @@ namespace WindBot.Game.AI
// Some AI need do something on new turn
// Some AI need do something on new turn
}
}
public
virtual
void
OnDraw
(
int
player
)
{
// Some AI need do something on draw
}
public
virtual
IList
<
ClientCard
>
OnSelectCard
(
IList
<
ClientCard
>
cards
,
int
min
,
int
max
,
int
hint
,
bool
cancelable
)
public
virtual
IList
<
ClientCard
>
OnSelectCard
(
IList
<
ClientCard
>
cards
,
int
min
,
int
max
,
int
hint
,
bool
cancelable
)
{
{
// For overriding
// For overriding
...
@@ -146,6 +151,12 @@ namespace WindBot.Game.AI
...
@@ -146,6 +151,12 @@ namespace WindBot.Game.AI
return
null
;
return
null
;
}
}
public
virtual
IList
<
ClientCard
>
OnCardSorting
(
IList
<
ClientCard
>
cards
)
{
// For overriding
return
null
;
}
public
virtual
bool
OnSelectYesNo
(
int
desc
)
public
virtual
bool
OnSelectYesNo
(
int
desc
)
{
{
return
true
;
return
true
;
...
@@ -156,6 +167,12 @@ namespace WindBot.Game.AI
...
@@ -156,6 +167,12 @@ namespace WindBot.Game.AI
return
-
1
;
return
-
1
;
}
}
public
virtual
int
OnSelectPlace
(
int
cardId
,
int
player
,
int
location
,
int
available
)
{
// For overriding
return
0
;
}
public
virtual
CardPosition
OnSelectPosition
(
int
cardId
,
IList
<
CardPosition
>
positions
)
public
virtual
CardPosition
OnSelectPosition
(
int
cardId
,
IList
<
CardPosition
>
positions
)
{
{
// Overrided in DefalultExecutor
// Overrided in DefalultExecutor
...
...
Game/AI/Zones.cs
0 → 100644
View file @
415dccdb
namespace
WindBot.Game.AI
{
public
static
class
Zones
{
public
const
int
z0
=
0x1
,
z1
=
0x2
,
z2
=
0x4
,
z3
=
0x8
,
z4
=
0x10
,
z5
=
0x20
,
z6
=
0x40
,
MonsterZones
=
0x7f
,
MainMonsterZones
=
0x1f
,
ExtraMonsterZones
=
0x60
,
SpellZones
=
0x1f
,
PendulumZones
=
0x3
,
LinkedZones
=
0x10000
,
NotLinkedZones
=
0x20000
;
}
}
\ No newline at end of file
Game/ClientCard.cs
View file @
415dccdb
...
@@ -23,6 +23,8 @@ namespace WindBot.Game
...
@@ -23,6 +23,8 @@ namespace WindBot.Game
public
int
Defense
{
get
;
private
set
;
}
public
int
Defense
{
get
;
private
set
;
}
public
int
LScale
{
get
;
private
set
;
}
public
int
LScale
{
get
;
private
set
;
}
public
int
RScale
{
get
;
private
set
;
}
public
int
RScale
{
get
;
private
set
;
}
public
int
LinkCount
{
get
;
private
set
;
}
public
int
LinkMarker
{
get
;
private
set
;
}
public
int
BaseAttack
{
get
;
private
set
;
}
public
int
BaseAttack
{
get
;
private
set
;
}
public
int
BaseDefense
{
get
;
private
set
;
}
public
int
BaseDefense
{
get
;
private
set
;
}
public
int
RealPower
{
get
;
set
;
}
public
int
RealPower
{
get
;
set
;
}
...
@@ -132,6 +134,21 @@ namespace WindBot.Game
...
@@ -132,6 +134,21 @@ namespace WindBot.Game
LScale
=
packet
.
ReadInt32
();
LScale
=
packet
.
ReadInt32
();
if
((
flag
&
(
int
)
Query
.
RScale
)
!=
0
)
if
((
flag
&
(
int
)
Query
.
RScale
)
!=
0
)
RScale
=
packet
.
ReadInt32
();
RScale
=
packet
.
ReadInt32
();
if
((
flag
&
(
int
)
Query
.
Link
)
!=
0
)
{
LinkCount
=
packet
.
ReadInt32
();
LinkMarker
=
packet
.
ReadInt32
();
}
}
public
bool
HasLinkMarker
(
int
dir
)
{
return
((
LinkMarker
&
dir
)
!=
0
);
}
public
bool
HasLinkMarker
(
LinkMarker
dir
)
{
return
((
LinkMarker
&
(
int
)
dir
)
!=
0
);
}
}
public
bool
HasType
(
CardType
type
)
public
bool
HasType
(
CardType
type
)
...
...
Game/ClientField.cs
View file @
415dccdb
...
@@ -71,6 +71,30 @@ namespace WindBot.Game
...
@@ -71,6 +71,30 @@ namespace WindBot.Game
return
count
;
return
count
;
}
}
/// <summary>
/// Count Column
/// </summary>
/// <param zone>range of zone 0-4</param>
public
int
GetColumnCount
(
int
zone
,
bool
IncludeExtraMonsterZone
=
true
)
{
int
count
=
0
;
if
(
SpellZone
[
zone
]
!=
null
)
count
++;
if
(
MonsterZone
[
zone
]
!=
null
)
count
++;
if
(
zone
==
1
&&
IncludeExtraMonsterZone
)
{
if
(
MonsterZone
[
5
]
!=
null
)
count
++;
}
if
(
zone
==
3
&&
IncludeExtraMonsterZone
)
{
if
(
MonsterZone
[
6
]
!=
null
)
count
++;
}
return
count
;
}
public
int
GetFieldCount
()
public
int
GetFieldCount
()
{
{
...
@@ -218,6 +242,76 @@ namespace WindBot.Game
...
@@ -218,6 +242,76 @@ namespace WindBot.Game
return
HasInCards
(
SpellZone
,
cardId
,
notDisabled
);
return
HasInCards
(
SpellZone
,
cardId
,
notDisabled
);
}
}
public
bool
HasInHandOrInSpellZone
(
int
cardId
)
{
return
HasInHand
(
cardId
)
||
HasInSpellZone
(
cardId
);
}
public
bool
HasInHandOrHasInMonstersZone
(
int
cardId
)
{
return
HasInHand
(
cardId
)
||
HasInMonstersZone
(
cardId
);
}
public
bool
HasInHandOrInGraveyard
(
int
cardId
)
{
return
HasInHand
(
cardId
)
||
HasInGraveyard
(
cardId
);
}
public
bool
HasInMonstersZoneOrInGraveyard
(
int
cardId
)
{
return
HasInMonstersZone
(
cardId
)
||
HasInGraveyard
(
cardId
);
}
public
bool
HasInSpellZoneOrInGraveyard
(
int
cardId
)
{
return
HasInSpellZone
(
cardId
)
||
HasInGraveyard
(
cardId
);
}
public
bool
HasInHandOrInMonstersZoneOrInGraveyard
(
int
cardId
)
{
return
HasInHand
(
cardId
)
||
HasInMonstersZone
(
cardId
)
||
HasInGraveyard
(
cardId
);
}
public
bool
HasInHandOrInSpellZoneOrInGraveyard
(
int
cardId
)
{
return
HasInHand
(
cardId
)
||
HasInSpellZone
(
cardId
)
||
HasInGraveyard
(
cardId
);
}
public
bool
HasInHandOrInSpellZone
(
IList
<
int
>
cardId
)
{
return
HasInHand
(
cardId
)
||
HasInSpellZone
(
cardId
);
}
public
bool
HasInHandOrHasInMonstersZone
(
IList
<
int
>
cardId
)
{
return
HasInHand
(
cardId
)
||
HasInMonstersZone
(
cardId
);
}
public
bool
HasInHandOrInGraveyard
(
IList
<
int
>
cardId
)
{
return
HasInHand
(
cardId
)
||
HasInGraveyard
(
cardId
);
}
public
bool
HasInMonstersZoneOrInGraveyard
(
IList
<
int
>
cardId
)
{
return
HasInMonstersZone
(
cardId
)
||
HasInGraveyard
(
cardId
);
}
public
bool
HasInSpellZoneOrInGraveyard
(
IList
<
int
>
cardId
)
{
return
HasInSpellZone
(
cardId
)
||
HasInGraveyard
(
cardId
);
}
public
bool
HasInHandOrInMonstersZoneOrInGraveyard
(
IList
<
int
>
cardId
)
{
return
HasInHand
(
cardId
)
||
HasInMonstersZone
(
cardId
)
||
HasInGraveyard
(
cardId
);
}
public
bool
HasInHandOrInSpellZoneOrInGraveyard
(
IList
<
int
>
cardId
)
{
return
HasInHand
(
cardId
)
||
HasInSpellZone
(
cardId
)
||
HasInGraveyard
(
cardId
);
}
public
int
GetRemainingCount
(
int
cardId
,
int
initialCount
)
public
int
GetRemainingCount
(
int
cardId
,
int
initialCount
)
{
{
int
remaining
=
initialCount
;
int
remaining
=
initialCount
;
...
...
Game/Duel.cs
View file @
415dccdb
...
@@ -115,6 +115,37 @@ namespace WindBot.Game
...
@@ -115,6 +115,37 @@ namespace WindBot.Game
}
}
}
}
public
void
AddCard
(
CardLocation
loc
,
ClientCard
card
,
int
player
,
int
zone
,
int
pos
,
int
id
)
{
card
.
Location
=
loc
;
card
.
Position
=
pos
;
card
.
SetId
(
id
);
switch
(
loc
)
{
case
CardLocation
.
Hand
:
Fields
[
player
].
Hand
.
Add
(
card
);
break
;
case
CardLocation
.
Grave
:
Fields
[
player
].
Graveyard
.
Add
(
card
);
break
;
case
CardLocation
.
Removed
:
Fields
[
player
].
Banished
.
Add
(
card
);
break
;
case
CardLocation
.
MonsterZone
:
Fields
[
player
].
MonsterZone
[
zone
]
=
card
;
break
;
case
CardLocation
.
SpellZone
:
Fields
[
player
].
SpellZone
[
zone
]
=
card
;
break
;
case
CardLocation
.
Deck
:
Fields
[
player
].
Deck
.
Add
(
card
);
break
;
case
CardLocation
.
Extra
:
Fields
[
player
].
ExtraDeck
.
Add
(
card
);
break
;
}
}
public
void
RemoveCard
(
CardLocation
loc
,
ClientCard
card
,
int
player
,
int
zone
)
public
void
RemoveCard
(
CardLocation
loc
,
ClientCard
card
,
int
player
,
int
zone
)
{
{
switch
(
loc
)
switch
(
loc
)
...
...
Game/GameAI.cs
View file @
415dccdb
...
@@ -70,6 +70,14 @@ namespace WindBot.Game
...
@@ -70,6 +70,14 @@ namespace WindBot.Game
return
Executor
.
OnSelectHand
();
return
Executor
.
OnSelectHand
();
}
}
/// <summary>
/// Called when any player draw card.
/// </summary>
public
void
OnDraw
(
int
player
)
{
Executor
.
OnDraw
(
player
);
}
/// <summary>
/// <summary>
/// Called when it's a new turn.
/// Called when it's a new turn.
/// </summary>
/// </summary>
...
@@ -90,6 +98,7 @@ namespace WindBot.Game
...
@@ -90,6 +98,7 @@ namespace WindBot.Game
m_option
=
-
1
;
m_option
=
-
1
;
m_yesno
=
-
1
;
m_yesno
=
-
1
;
m_position
=
CardPosition
.
FaceUpAttack
;
m_position
=
CardPosition
.
FaceUpAttack
;
m_place
=
0
;
if
(
Duel
.
Player
==
0
&&
Duel
.
Phase
==
DuelPhase
.
Draw
)
if
(
Duel
.
Player
==
0
&&
Duel
.
Phase
==
DuelPhase
.
Draw
)
{
{
_dialogs
.
SendNewTurn
();
_dialogs
.
SendNewTurn
();
...
@@ -328,6 +337,26 @@ namespace WindBot.Game
...
@@ -328,6 +337,26 @@ namespace WindBot.Game
return
used
;
return
used
;
}
}
/// <summary>
/// Called when the AI has to sort cards.
/// </summary>
/// <param name="cards">Cards to sort.</param>
/// <returns>List of sorted cards.</returns>
public
IList
<
ClientCard
>
OnCardSorting
(
IList
<
ClientCard
>
cards
)
{
IList
<
ClientCard
>
result
=
Executor
.
OnCardSorting
(
cards
);
if
(
result
!=
null
)
return
result
;
result
=
new
List
<
ClientCard
>();
// TODO: use selector
for
(
int
i
=
0
;
i
<
cards
.
Count
;
i
++)
{
result
.
Add
(
cards
[
i
]);
}
return
result
;
}
/// <summary>
/// <summary>
/// Called when the AI has to choose to activate or not an effect.
/// Called when the AI has to choose to activate or not an effect.
/// </summary>
/// </summary>
...
@@ -436,6 +465,23 @@ namespace WindBot.Game
...
@@ -436,6 +465,23 @@ namespace WindBot.Game
return
0
;
// Always select the first option.
return
0
;
// Always select the first option.
}
}
public
int
OnSelectPlace
(
int
cardId
,
int
player
,
int
location
,
int
available
)
{
int
selector_selected
=
m_place
;
m_place
=
0
;
int
executor_selected
=
Executor
.
OnSelectPlace
(
cardId
,
player
,
location
,
available
);
if
((
executor_selected
&
available
)
>
0
)
return
executor_selected
&
available
;
if
((
selector_selected
&
available
)
>
0
)
return
selector_selected
&
available
;
// TODO: LinkedZones
return
0
;
}
/// <summary>
/// <summary>
/// Called when the AI has to select a card position.
/// Called when the AI has to select a card position.
/// </summary>
/// </summary>
...
@@ -680,6 +726,7 @@ namespace WindBot.Game
...
@@ -680,6 +726,7 @@ namespace WindBot.Game
private
CardSelector
m_thirdSelector
;
private
CardSelector
m_thirdSelector
;
private
CardSelector
m_materialSelector
;
private
CardSelector
m_materialSelector
;
private
CardPosition
m_position
=
CardPosition
.
FaceUpAttack
;
private
CardPosition
m_position
=
CardPosition
.
FaceUpAttack
;
private
int
m_place
;
private
int
m_option
;
private
int
m_option
;
private
int
m_number
;
private
int
m_number
;
private
int
m_announce
;
private
int
m_announce
;
...
@@ -814,6 +861,11 @@ namespace WindBot.Game
...
@@ -814,6 +861,11 @@ namespace WindBot.Game
m_position
=
pos
;
m_position
=
pos
;
}
}
public
void
SelectPlace
(
int
zones
)
{
m_place
=
zones
;
}
public
void
SelectOption
(
int
opt
)
public
void
SelectOption
(
int
opt
)
{
{
m_option
=
opt
;
m_option
=
opt
;
...
...
Game/GameBehavior.cs
View file @
415dccdb
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.IO
;
using
System.Text.RegularExpressions
;
using
System.Text.RegularExpressions
;
...
@@ -25,6 +25,7 @@ namespace WindBot.Game
...
@@ -25,6 +25,7 @@ namespace WindBot.Game
private
Room
_room
;
private
Room
_room
;
private
Duel
_duel
;
private
Duel
_duel
;
private
int
_hand
;
private
int
_hand
;
private
bool
_debug
;
private
int
_select_hint
;
private
int
_select_hint
;
public
GameBehavior
(
GameClient
game
)
public
GameBehavior
(
GameClient
game
)
...
@@ -32,7 +33,7 @@ namespace WindBot.Game
...
@@ -32,7 +33,7 @@ namespace WindBot.Game
Game
=
game
;
Game
=
game
;
Connection
=
game
.
Connection
;
Connection
=
game
.
Connection
;
_hand
=
game
.
Hand
;
_hand
=
game
.
Hand
;
_debug
=
game
.
Debug
;
_packets
=
new
Dictionary
<
StocMessage
,
Action
<
BinaryReader
>>();
_packets
=
new
Dictionary
<
StocMessage
,
Action
<
BinaryReader
>>();
_messages
=
new
Dictionary
<
GameMessage
,
Action
<
BinaryReader
>>();
_messages
=
new
Dictionary
<
GameMessage
,
Action
<
BinaryReader
>>();
RegisterPackets
();
RegisterPackets
();
...
@@ -264,7 +265,6 @@ namespace WindBot.Game
...
@@ -264,7 +265,6 @@ namespace WindBot.Game
private
void
OnDuelEnd
(
BinaryReader
packet
)
private
void
OnDuelEnd
(
BinaryReader
packet
)
{
{
Connection
.
Close
();
Connection
.
Close
();
Logger
.
DebugWriteLine
(
"********************* Duel end *********************"
);
}
}
private
void
OnChat
(
BinaryReader
packet
)
private
void
OnChat
(
BinaryReader
packet
)
...
@@ -352,13 +352,15 @@ namespace WindBot.Game
...
@@ -352,13 +352,15 @@ namespace WindBot.Game
{
{
int
player
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
player
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
count
=
packet
.
ReadByte
();
int
count
=
packet
.
ReadByte
();
Logger
.
DebugWriteLine
(
"("
+
player
.
ToString
()
+
"抽了"
+
count
.
ToString
()
+
"张卡)"
);
if
(
_debug
)
Logger
.
WriteLine
(
"("
+
player
.
ToString
()
+
" draw "
+
count
.
ToString
()
+
" card)"
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
{
_duel
.
Fields
[
player
].
Deck
.
RemoveAt
(
_duel
.
Fields
[
player
].
Deck
.
Count
-
1
);
_duel
.
Fields
[
player
].
Deck
.
RemoveAt
(
_duel
.
Fields
[
player
].
Deck
.
Count
-
1
);
_duel
.
Fields
[
player
].
Hand
.
Add
(
new
ClientCard
(
0
,
CardLocation
.
Hand
));
_duel
.
Fields
[
player
].
Hand
.
Add
(
new
ClientCard
(
0
,
CardLocation
.
Hand
));
}
}
_ai
.
OnDraw
(
player
);
}
}
private
void
OnShuffleDeck
(
BinaryReader
packet
)
private
void
OnShuffleDeck
(
BinaryReader
packet
)
...
@@ -424,7 +426,17 @@ namespace WindBot.Game
...
@@ -424,7 +426,17 @@ namespace WindBot.Game
private
void
OnNewPhase
(
BinaryReader
packet
)
private
void
OnNewPhase
(
BinaryReader
packet
)
{
{
_duel
.
Phase
=
(
DuelPhase
)
packet
.
ReadInt16
();
_duel
.
Phase
=
(
DuelPhase
)
packet
.
ReadInt16
();
Logger
.
DebugWriteLine
(
"(进入"
+
(
_duel
.
Phase
.
ToString
())
+
")"
);
if
(
_debug
&&
_duel
.
Phase
==
DuelPhase
.
Standby
)
{
Logger
.
WriteLine
(
"*********Bot Hand*********"
);
foreach
(
ClientCard
card
in
_duel
.
Fields
[
0
].
Hand
)
{
Logger
.
WriteLine
(
card
.
Name
);
}
Logger
.
WriteLine
(
"*********Bot Hand*********"
);
}
if
(
_debug
)
Logger
.
WriteLine
(
"(Go to "
+
(
_duel
.
Phase
.
ToString
())
+
")"
);
_duel
.
LastSummonPlayer
=
-
1
;
_duel
.
LastSummonPlayer
=
-
1
;
_duel
.
Fields
[
0
].
BattlingMonster
=
null
;
_duel
.
Fields
[
0
].
BattlingMonster
=
null
;
_duel
.
Fields
[
1
].
BattlingMonster
=
null
;
_duel
.
Fields
[
1
].
BattlingMonster
=
null
;
...
@@ -436,7 +448,8 @@ namespace WindBot.Game
...
@@ -436,7 +448,8 @@ namespace WindBot.Game
int
player
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
player
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
final
=
_duel
.
Fields
[
player
].
LifePoints
-
packet
.
ReadInt32
();
int
final
=
_duel
.
Fields
[
player
].
LifePoints
-
packet
.
ReadInt32
();
if
(
final
<
0
)
final
=
0
;
if
(
final
<
0
)
final
=
0
;
Logger
.
DebugWriteLine
(
"("
+
player
.
ToString
()
+
"受到了伤害,当前为"
+
final
.
ToString
()
+
")"
);
if
(
_debug
)
Logger
.
WriteLine
(
"("
+
player
.
ToString
()
+
" got damage , LifePoint left= "
+
final
.
ToString
()
+
")"
);
_duel
.
Fields
[
player
].
LifePoints
=
final
;
_duel
.
Fields
[
player
].
LifePoints
=
final
;
}
}
...
@@ -455,44 +468,59 @@ namespace WindBot.Game
...
@@ -455,44 +468,59 @@ namespace WindBot.Game
private
void
OnMove
(
BinaryReader
packet
)
private
void
OnMove
(
BinaryReader
packet
)
{
{
int
cardId
=
packet
.
ReadInt32
();
int
cardId
=
packet
.
ReadInt32
();
int
p
c
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
p
reviousControler
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
p
l
=
packet
.
ReadByte
();
int
p
reviousLocation
=
packet
.
ReadByte
();
int
p
s
=
packet
.
ReadSByte
();
int
p
reviousSequence
=
packet
.
ReadSByte
();
packet
.
ReadSByte
();
// pp
/*int previousPosotion = */
packet
.
ReadSByte
();
int
c
c
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
c
urrentControler
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
c
l
=
packet
.
ReadByte
();
int
c
urrentLocation
=
packet
.
ReadByte
();
int
c
s
=
packet
.
ReadSByte
();
int
c
urrentSequence
=
packet
.
ReadSByte
();
int
c
p
=
packet
.
ReadSByte
();
int
c
urrentPosition
=
packet
.
ReadSByte
();
packet
.
ReadInt32
();
// reason
packet
.
ReadInt32
();
// reason
ClientCard
card
=
_duel
.
GetCard
(
pc
,
(
CardLocation
)
pl
,
ps
);
ClientCard
card
=
_duel
.
GetCard
(
previousControler
,
(
CardLocation
)
previousLocation
,
previousSequence
);
if
(
card
!=
null
)
Logger
.
DebugWriteLine
(
"("
+
pc
.
ToString
()
+
"的"
+
(
card
.
Name
??
"未知卡片"
)
+
"从"
+
(
CardLocation
)
pl
+
"移动到了"
+
(
CardLocation
)
cl
+
")"
);
if
((
previousLocation
&
(
int
)
CardLocation
.
Overlay
)
!=
0
)
if
((
pl
&
(
int
)
CardLocation
.
Overlay
)
!=
0
)
{
{
p
l
=
pl
&
0x7f
;
p
reviousLocation
=
previousLocation
&
0x7f
;
card
=
_duel
.
GetCard
(
p
c
,
(
CardLocation
)
pl
,
ps
);
card
=
_duel
.
GetCard
(
p
reviousControler
,
(
CardLocation
)
previousLocation
,
previousSequence
);
if
(
card
!=
null
)
if
(
card
!=
null
)
{
if
(
_debug
)
Logger
.
WriteLine
(
"("
+
previousControler
.
ToString
()
+
" 's "
+
(
card
.
Name
??
"UnKnowCard"
)
+
" deattach "
+
(
NamedCard
.
Get
(
cardId
)?.
Name
)
+
")"
);
card
.
Overlays
.
Remove
(
cardId
);
card
.
Overlays
.
Remove
(
cardId
);
}
}
previousLocation
=
0
;
// the card is removed when it go to overlay, so here we treat it as a new card
}
else
else
_duel
.
RemoveCard
((
CardLocation
)
p
l
,
card
,
pc
,
ps
);
_duel
.
RemoveCard
((
CardLocation
)
p
reviousLocation
,
card
,
previousControler
,
previousSequence
);
if
((
c
l
&
(
int
)
CardLocation
.
Overlay
)
!=
0
)
if
((
c
urrentLocation
&
(
int
)
CardLocation
.
Overlay
)
!=
0
)
{
{
c
l
=
cl
&
0x7f
;
c
urrentLocation
=
currentLocation
&
0x7f
;
card
=
_duel
.
GetCard
(
c
c
,
(
CardLocation
)
cl
,
cs
);
card
=
_duel
.
GetCard
(
c
urrentControler
,
(
CardLocation
)
currentLocation
,
currentSequence
);
if
(
card
!=
null
)
if
(
card
!=
null
)
{
if
(
_debug
)
Logger
.
WriteLine
(
"("
+
previousControler
.
ToString
()
+
" 's "
+
(
card
.
Name
??
"UnKnowCard"
)
+
" overlay "
+
(
NamedCard
.
Get
(
cardId
)?.
Name
)
+
")"
);
card
.
Overlays
.
Add
(
cardId
);
card
.
Overlays
.
Add
(
cardId
);
}
}
}
else
else
{
{
_duel
.
AddCard
((
CardLocation
)
cl
,
cardId
,
cc
,
cs
,
cp
);
if
(
previousLocation
==
0
)
if
((
pl
&
(
int
)
CardLocation
.
Overlay
)
==
0
&&
card
!=
null
)
{
{
ClientCard
newcard
=
_duel
.
GetCard
(
cc
,
(
CardLocation
)
cl
,
cs
);
if
(
_debug
)
if
(
newcard
!=
null
)
Logger
.
WriteLine
(
"("
+
previousControler
.
ToString
()
+
" 's "
+
(
NamedCard
.
Get
(
cardId
)?.
Name
)
newcard
.
Overlays
.
AddRange
(
card
.
Overlays
);
+
" appear in "
+
(
CardLocation
)
currentLocation
+
")"
);
_duel
.
AddCard
((
CardLocation
)
currentLocation
,
cardId
,
currentControler
,
currentSequence
,
currentPosition
);
}
else
{
_duel
.
AddCard
((
CardLocation
)
currentLocation
,
card
,
currentControler
,
currentSequence
,
currentPosition
,
cardId
);
if
(
_debug
&&
card
!=
null
)
Logger
.
WriteLine
(
"("
+
previousControler
.
ToString
()
+
" 's "
+
(
card
.
Name
??
"UnKnowCard"
)
+
" from "
+
(
CardLocation
)
previousLocation
+
" move to "
+
(
CardLocation
)
currentLocation
+
")"
);
}
}
}
}
}
}
...
@@ -510,8 +538,11 @@ namespace WindBot.Game
...
@@ -510,8 +538,11 @@ namespace WindBot.Game
ClientCard
attackcard
=
_duel
.
GetCard
(
ca
,
(
CardLocation
)
la
,
sa
);
ClientCard
attackcard
=
_duel
.
GetCard
(
ca
,
(
CardLocation
)
la
,
sa
);
ClientCard
defendcard
=
_duel
.
GetCard
(
cd
,
(
CardLocation
)
ld
,
sd
);
ClientCard
defendcard
=
_duel
.
GetCard
(
cd
,
(
CardLocation
)
ld
,
sd
);
if
(
defendcard
==
null
)
Logger
.
DebugWriteLine
(
"("
+
(
attackcard
.
Name
??
"未知卡片"
)
+
"直接攻击)"
);
if
(
_debug
)
else
Logger
.
DebugWriteLine
(
"("
+
ca
.
ToString
()
+
"的"
+
(
attackcard
.
Name
??
"未知卡片"
)
+
"攻击了"
+
cd
.
ToString
()
+
"的"
+
(
defendcard
.
Name
??
"未知卡片"
)
+
")"
);
{
if
(
defendcard
==
null
)
Logger
.
WriteLine
(
"("
+
(
attackcard
.
Name
??
"UnKnowCard"
)
+
" direct attack!!)"
);
else
Logger
.
WriteLine
(
"("
+
ca
.
ToString
()
+
" 's "
+
(
attackcard
.
Name
??
"UnKnowCard"
)
+
" attack "
+
cd
.
ToString
()
+
" 's "
+
(
defendcard
.
Name
??
"UnKnowCard"
)
+
")"
);
}
_duel
.
Fields
[
attackcard
.
Controller
].
BattlingMonster
=
attackcard
;
_duel
.
Fields
[
attackcard
.
Controller
].
BattlingMonster
=
attackcard
;
_duel
.
Fields
[
1
-
attackcard
.
Controller
].
BattlingMonster
=
defendcard
;
_duel
.
Fields
[
1
-
attackcard
.
Controller
].
BattlingMonster
=
defendcard
;
...
@@ -533,7 +564,8 @@ namespace WindBot.Game
...
@@ -533,7 +564,8 @@ namespace WindBot.Game
if
(
card
!=
null
)
if
(
card
!=
null
)
{
{
card
.
Position
=
cp
;
card
.
Position
=
cp
;
Logger
.
DebugWriteLine
(
"("
+
(
card
.
Name
??
"未知卡片"
)
+
"改变了表示形式为"
+
(
CardPosition
)
cp
+
")"
);
if
(
_debug
)
Logger
.
WriteLine
(
"("
+
(
card
.
Name
??
"UnKnowCard"
)
+
" change position to "
+
(
CardPosition
)
cp
+
")"
);
}
}
}
}
...
@@ -546,12 +578,14 @@ namespace WindBot.Game
...
@@ -546,12 +578,14 @@ namespace WindBot.Game
int
subs
=
packet
.
ReadSByte
();
int
subs
=
packet
.
ReadSByte
();
ClientCard
card
=
_duel
.
GetCard
(
pcc
,
pcl
,
pcs
,
subs
);
ClientCard
card
=
_duel
.
GetCard
(
pcc
,
pcl
,
pcs
,
subs
);
int
cc
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
cc
=
GetLocalPlayer
(
packet
.
ReadByte
());
if
(
card
!=
null
)
Logger
.
DebugWriteLine
(
"("
+
cc
.
ToString
()
+
"的"
+
(
card
.
Name
??
"未知卡片"
)
+
"发动了效果)"
);
if
(
_debug
)
if
(
card
!=
null
)
Logger
.
WriteLine
(
"("
+
cc
.
ToString
()
+
" 's "
+
(
card
.
Name
??
"UnKnowCard"
)
+
" activate effect)"
);
_ai
.
OnChaining
(
card
,
cc
);
_ai
.
OnChaining
(
card
,
cc
);
_duel
.
ChainTargets
.
Clear
();
_duel
.
ChainTargets
.
Clear
();
_duel
.
LastSummonPlayer
=
-
1
;
_duel
.
LastSummonPlayer
=
-
1
;
_duel
.
CurrentChain
.
Add
(
card
);
_duel
.
CurrentChain
.
Add
(
card
);
_duel
.
LastChainPlayer
=
cc
;
_duel
.
LastChainPlayer
=
cc
;
}
}
private
void
OnChainEnd
(
BinaryReader
packet
)
private
void
OnChainEnd
(
BinaryReader
packet
)
...
@@ -564,8 +598,48 @@ namespace WindBot.Game
...
@@ -564,8 +598,48 @@ namespace WindBot.Game
private
void
OnCardSorting
(
BinaryReader
packet
)
private
void
OnCardSorting
(
BinaryReader
packet
)
{
{
/*BinaryWriter writer =*/
GamePacketFactory
.
Create
(
CtosMessage
.
Response
);
/*int player =*/
GetLocalPlayer
(
packet
.
ReadByte
());
Connection
.
Send
(
CtosMessage
.
Response
,
-
1
);
IList
<
ClientCard
>
originalCards
=
new
List
<
ClientCard
>();
IList
<
ClientCard
>
cards
=
new
List
<
ClientCard
>();
int
count
=
packet
.
ReadByte
();
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
int
id
=
packet
.
ReadInt32
();
int
controler
=
GetLocalPlayer
(
packet
.
ReadByte
());
CardLocation
loc
=
(
CardLocation
)
packet
.
ReadByte
();
int
seq
=
packet
.
ReadByte
();
ClientCard
card
;
if
(((
int
)
loc
&
(
int
)
CardLocation
.
Overlay
)
!=
0
)
card
=
new
ClientCard
(
id
,
CardLocation
.
Overlay
);
else
card
=
_duel
.
GetCard
(
controler
,
loc
,
seq
);
if
(
card
==
null
)
continue
;
if
(
id
!=
0
)
card
.
SetId
(
id
);
originalCards
.
Add
(
card
);
cards
.
Add
(
card
);
}
IList
<
ClientCard
>
selected
=
_ai
.
OnCardSorting
(
cards
);
byte
[]
result
=
new
byte
[
count
];
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
int
id
=
0
;
for
(
int
j
=
0
;
j
<
count
;
++
j
)
{
if
(
selected
[
j
]
==
null
)
continue
;
if
(
selected
[
j
].
Equals
(
originalCards
[
i
]))
{
id
=
j
;
break
;
}
}
result
[
i
]
=
(
byte
)
id
;
}
BinaryWriter
reply
=
GamePacketFactory
.
Create
(
CtosMessage
.
Response
);
reply
.
Write
(
result
);
Connection
.
Send
(
reply
);
}
}
private
void
OnChainSorting
(
BinaryReader
packet
)
private
void
OnChainSorting
(
BinaryReader
packet
)
...
@@ -641,7 +715,8 @@ namespace WindBot.Game
...
@@ -641,7 +715,8 @@ namespace WindBot.Game
/*int sseq = */
packet
.
ReadByte
();
/*int sseq = */
packet
.
ReadByte
();
ClientCard
card
=
_duel
.
GetCard
(
player
,
(
CardLocation
)
loc
,
seq
);
ClientCard
card
=
_duel
.
GetCard
(
player
,
(
CardLocation
)
loc
,
seq
);
if
(
card
==
null
)
continue
;
if
(
card
==
null
)
continue
;
Logger
.
DebugWriteLine
(
"("
+
(
CardLocation
)
loc
+
"的"
+
(
card
.
Name
??
"未知卡片"
)
+
"成为了对象)"
);
if
(
_debug
)
Logger
.
WriteLine
(
"("
+
(
CardLocation
)
loc
+
" 's "
+
(
card
.
Name
??
"UnKnowCard"
)
+
" become target)"
);
_duel
.
ChainTargets
.
Add
(
card
);
_duel
.
ChainTargets
.
Add
(
card
);
}
}
}
}
...
@@ -1023,64 +1098,79 @@ namespace WindBot.Game
...
@@ -1023,64 +1098,79 @@ namespace WindBot.Game
packet
.
ReadByte
();
// min
packet
.
ReadByte
();
// min
int
field
=
~
packet
.
ReadInt32
();
int
field
=
~
packet
.
ReadInt32
();
byte
[]
resp
=
new
byte
[
3
]
;
const
int
LOCATION_MZONE
=
0x4
;
const
int
LOCATION_SZONE
=
0x8
;
bool
pendulumZone
=
false
;
const
int
LOCATION_PZONE
=
0x200
;
int
player
;
int
location
;
int
filter
;
int
filter
;
if
((
field
&
0x7f
)
!=
0
)
if
((
field
&
0x7f
)
!=
0
)
{
{
resp
[
0
]
=
(
byte
)
GetLocalPlayer
(
0
)
;
player
=
0
;
resp
[
1
]
=
0x4
;
location
=
LOCATION_MZONE
;
filter
=
field
&
0x7f
;
filter
=
field
&
Zones
.
MonsterZones
;
}
}
else
if
((
field
&
0x1f00
)
!=
0
)
else
if
((
field
&
0x1f00
)
!=
0
)
{
{
resp
[
0
]
=
(
byte
)
GetLocalPlayer
(
0
)
;
player
=
0
;
resp
[
1
]
=
0x8
;
location
=
LOCATION_SZONE
;
filter
=
(
field
>>
8
)
&
0x1f
;
filter
=
(
field
>>
8
)
&
Zones
.
SpellZones
;
}
}
else
if
((
field
&
0xc000
)
!=
0
)
else
if
((
field
&
0xc000
)
!=
0
)
{
{
resp
[
0
]
=
(
byte
)
GetLocalPlayer
(
0
);
player
=
0
;
resp
[
1
]
=
0x8
;
location
=
LOCATION_PZONE
;
filter
=
(
field
>>
14
)
&
0x3
;
filter
=
(
field
>>
14
)
&
Zones
.
PendulumZones
;
pendulumZone
=
true
;
}
}
else
if
((
field
&
0x7f0000
)
!=
0
)
else
if
((
field
&
0x7f0000
)
!=
0
)
{
{
resp
[
0
]
=
(
byte
)
GetLocalPlayer
(
1
)
;
player
=
1
;
resp
[
1
]
=
0x4
;
location
=
LOCATION_MZONE
;
filter
=
(
field
>>
16
)
&
0x7f
;
filter
=
(
field
>>
16
)
&
Zones
.
MonsterZones
;
}
}
else
if
((
field
&
0x1f000000
)
!=
0
)
else
if
((
field
&
0x1f000000
)
!=
0
)
{
{
resp
[
0
]
=
(
byte
)
GetLocalPlayer
(
1
)
;
player
=
1
;
resp
[
1
]
=
0x8
;
location
=
LOCATION_SZONE
;
filter
=
(
field
>>
24
)
&
0x1f
;
filter
=
(
field
>>
24
)
&
Zones
.
SpellZones
;
}
}
else
else
{
{
resp
[
0
]
=
(
byte
)
GetLocalPlayer
(
1
);
player
=
1
;
resp
[
1
]
=
0x8
;
location
=
LOCATION_PZONE
;
filter
=
(
field
>>
30
)
&
0x3
;
filter
=
(
field
>>
30
)
&
Zones
.
PendulumZones
;
pendulumZone
=
true
;
}
}
if
(!
pendulumZone
)
int
selected
=
_ai
.
OnSelectPlace
(
_select_hint
,
player
,
location
,
filter
);
_select_hint
=
0
;
byte
[]
resp
=
new
byte
[
3
];
resp
[
0
]
=
(
byte
)
GetLocalPlayer
(
player
);
if
(
location
!=
LOCATION_PZONE
)
{
{
if
((
filter
&
0x40
)
!=
0
)
resp
[
2
]
=
6
;
resp
[
1
]
=
(
byte
)
location
;
else
if
((
filter
&
0x20
)
!=
0
)
resp
[
2
]
=
5
;
if
((
selected
&
filter
)
>
0
)
else
if
((
filter
&
0x4
)
!=
0
)
resp
[
2
]
=
2
;
filter
&=
selected
;
else
if
((
filter
&
0x2
)
!=
0
)
resp
[
2
]
=
1
;
else
if
((
filter
&
0x8
)
!=
0
)
resp
[
2
]
=
3
;
if
((
filter
&
Zones
.
z6
)
!=
0
)
resp
[
2
]
=
6
;
else
if
((
filter
&
0x1
)
!=
0
)
resp
[
2
]
=
0
;
else
if
((
filter
&
Zones
.
z5
)
!=
0
)
resp
[
2
]
=
5
;
else
if
((
filter
&
0x10
)
!=
0
)
resp
[
2
]
=
4
;
else
if
((
filter
&
Zones
.
z2
)
!=
0
)
resp
[
2
]
=
2
;
else
if
((
filter
&
Zones
.
z1
)
!=
0
)
resp
[
2
]
=
1
;
else
if
((
filter
&
Zones
.
z3
)
!=
0
)
resp
[
2
]
=
3
;
else
if
((
filter
&
Zones
.
z0
)
!=
0
)
resp
[
2
]
=
0
;
else
if
((
filter
&
Zones
.
z4
)
!=
0
)
resp
[
2
]
=
4
;
}
}
else
else
{
{
if
((
filter
&
0x1
)
!=
0
)
resp
[
2
]
=
6
;
resp
[
1
]
=
(
byte
)
LOCATION_SZONE
;
if
((
filter
&
0x2
)
!=
0
)
resp
[
2
]
=
7
;
if
((
selected
&
filter
)
>
0
)
filter
&=
selected
;
if
((
filter
&
Zones
.
z0
)
!=
0
)
resp
[
2
]
=
6
;
if
((
filter
&
Zones
.
z1
)
!=
0
)
resp
[
2
]
=
7
;
}
}
BinaryWriter
reply
=
GamePacketFactory
.
Create
(
CtosMessage
.
Response
);
BinaryWriter
reply
=
GamePacketFactory
.
Create
(
CtosMessage
.
Response
);
...
...
Game/GameClient.cs
View file @
415dccdb
...
@@ -14,7 +14,8 @@ namespace WindBot.Game
...
@@ -14,7 +14,8 @@ namespace WindBot.Game
public
string
Deck
;
public
string
Deck
;
public
string
Dialog
;
public
string
Dialog
;
public
int
Hand
;
public
int
Hand
;
public
bool
Debug
;
public
bool
_chat
;
private
string
_serverHost
;
private
string
_serverHost
;
private
int
_serverPort
;
private
int
_serverPort
;
private
short
_proVersion
;
private
short
_proVersion
;
...
@@ -29,6 +30,8 @@ namespace WindBot.Game
...
@@ -29,6 +30,8 @@ namespace WindBot.Game
Deck
=
Info
.
Deck
;
Deck
=
Info
.
Deck
;
Dialog
=
Info
.
Dialog
;
Dialog
=
Info
.
Dialog
;
Hand
=
Info
.
Hand
;
Hand
=
Info
.
Hand
;
Debug
=
Info
.
Debug
;
_chat
=
Info
.
Chat
;
_serverHost
=
Info
.
Host
;
_serverHost
=
Info
.
Host
;
_serverPort
=
Info
.
Port
;
_serverPort
=
Info
.
Port
;
_roomInfo
=
Info
.
HostInfo
;
_roomInfo
=
Info
.
HostInfo
;
...
...
Program.cs
View file @
415dccdb
...
@@ -74,6 +74,8 @@ namespace WindBot
...
@@ -74,6 +74,8 @@ namespace WindBot
Info
.
HostInfo
=
Config
.
GetString
(
"HostInfo"
,
Info
.
HostInfo
);
Info
.
HostInfo
=
Config
.
GetString
(
"HostInfo"
,
Info
.
HostInfo
);
Info
.
Version
=
Config
.
GetInt
(
"Version"
,
Info
.
Version
);
Info
.
Version
=
Config
.
GetInt
(
"Version"
,
Info
.
Version
);
Info
.
Hand
=
Config
.
GetInt
(
"Hand"
,
Info
.
Hand
);
Info
.
Hand
=
Config
.
GetInt
(
"Hand"
,
Info
.
Hand
);
Info
.
Debug
=
Config
.
GetBool
(
"Debug"
,
Info
.
Debug
);
Info
.
Chat
=
Config
.
GetBool
(
"Chat"
,
Info
.
Chat
);
Run
(
Info
);
Run
(
Info
);
}
}
...
@@ -114,6 +116,12 @@ namespace WindBot
...
@@ -114,6 +116,12 @@ namespace WindBot
string
hand
=
HttpUtility
.
ParseQueryString
(
RawUrl
).
Get
(
"hand"
);
string
hand
=
HttpUtility
.
ParseQueryString
(
RawUrl
).
Get
(
"hand"
);
if
(
hand
!=
null
)
if
(
hand
!=
null
)
Info
.
Hand
=
Int32
.
Parse
(
hand
);
Info
.
Hand
=
Int32
.
Parse
(
hand
);
string
debug
=
HttpUtility
.
ParseQueryString
(
RawUrl
).
Get
(
"debug"
);
if
(
debug
!=
null
)
Info
.
Debug
=
bool
.
Parse
(
debug
);
string
chat
=
HttpUtility
.
ParseQueryString
(
RawUrl
).
Get
(
"chat"
);
if
(
chat
!=
null
)
Info
.
Chat
=
bool
.
Parse
(
chat
);
if
(
Info
.
Name
==
null
||
Info
.
Host
==
null
||
port
==
null
)
if
(
Info
.
Name
==
null
||
Info
.
Host
==
null
||
port
==
null
)
{
{
...
...
WindBot.csproj
View file @
415dccdb
...
@@ -68,6 +68,7 @@
...
@@ -68,6 +68,7 @@
<Compile
Include=
"Game\AI\DecksManager.cs"
/>
<Compile
Include=
"Game\AI\DecksManager.cs"
/>
<Compile
Include=
"Game\AI\Decks\BlackwingExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\BlackwingExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\CyberDragonExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\CyberDragonExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\DarkMagicianExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\SkyStrikerExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\SkyStrikerExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\MokeyMokeyKingExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\MokeyMokeyKingExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\MokeyMokeyExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\MokeyMokeyExecutor.cs"
/>
...
@@ -98,11 +99,16 @@
...
@@ -98,11 +99,16 @@
<Compile
Include=
"Game\AI\Dialogs.cs"
/>
<Compile
Include=
"Game\AI\Dialogs.cs"
/>
<Compile
Include=
"Game\AI\Enums\DangerousMonster.cs"
/>
<Compile
Include=
"Game\AI\Enums\DangerousMonster.cs"
/>
<Compile
Include=
"Game\AI\Enums\FusionSpell.cs"
/>
<Compile
Include=
"Game\AI\Enums\FusionSpell.cs"
/>
<Compile
Include=
"Game\AI\Enums\ShouldBeDisabledBeforeItUseEffectMonster.cs"
/>
<Compile
Include=
"Game\AI\Enums\ShouldNotBeSpellTarget.cs"
/>
<Compile
Include=
"Game\AI\Enums\ShouldNotBeMonsterTarget.cs"
/>
<Compile
Include=
"Game\AI\Enums\ShouldNotBeTarget.cs"
/>
<Compile
Include=
"Game\AI\Enums\PreventActivationEffectInBattle.cs"
/>
<Compile
Include=
"Game\AI\Enums\PreventActivationEffectInBattle.cs"
/>
<Compile
Include=
"Game\AI\Enums\OneForXyz.cs"
/>
<Compile
Include=
"Game\AI\Enums\OneForXyz.cs"
/>
<Compile
Include=
"Game\AI\Enums\InvincibleMonster.cs"
/>
<Compile
Include=
"Game\AI\Enums\InvincibleMonster.cs"
/>
<Compile
Include=
"Game\AI\Enums\Floodgate.cs"
/>
<Compile
Include=
"Game\AI\Enums\Floodgate.cs"
/>
<Compile
Include=
"Game\AI\Executor.cs"
/>
<Compile
Include=
"Game\AI\Executor.cs"
/>
<Compile
Include=
"Game\AI\Zones.cs"
/>
<Compile
Include=
"Game\AI\ExecutorType.cs"
/>
<Compile
Include=
"Game\AI\ExecutorType.cs"
/>
<Compile
Include=
"Game\BattlePhase.cs"
/>
<Compile
Include=
"Game\BattlePhase.cs"
/>
<Compile
Include=
"Game\BattlePhaseAction.cs"
/>
<Compile
Include=
"Game\BattlePhaseAction.cs"
/>
...
...
WindBotInfo.cs
View file @
415dccdb
...
@@ -12,7 +12,8 @@ namespace WindBot
...
@@ -12,7 +12,8 @@ namespace WindBot
public
string
HostInfo
{
get
;
set
;
}
public
string
HostInfo
{
get
;
set
;
}
public
int
Version
{
get
;
set
;
}
public
int
Version
{
get
;
set
;
}
public
int
Hand
{
get
;
set
;
}
public
int
Hand
{
get
;
set
;
}
public
bool
Debug
{
get
;
set
;
}
public
bool
Chat
{
get
;
set
;
}
public
WindBotInfo
()
public
WindBotInfo
()
{
{
Name
=
"WindBot"
;
Name
=
"WindBot"
;
...
@@ -23,6 +24,8 @@ namespace WindBot
...
@@ -23,6 +24,8 @@ namespace WindBot
HostInfo
=
""
;
HostInfo
=
""
;
Version
=
0x1343
;
Version
=
0x1343
;
Hand
=
0
;
Hand
=
0
;
Debug
=
false
;
Chat
=
true
;
}
}
}
}
}
}
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