Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
W
Windbot-408
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
神之吹息
Windbot-408
Commits
04074096
Commit
04074096
authored
Mar 01, 2018
by
Momobako
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/moecube/windbot
parents
f9f72259
afa65cfc
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
693 additions
and
151 deletions
+693
-151
Decks/AI_Trickstar.ydk
Decks/AI_Trickstar.ydk
+12
-12
Game/AI/Decks/TrickstarExecutor.cs
Game/AI/Decks/TrickstarExecutor.cs
+651
-130
Game/GameAI.cs
Game/GameAI.cs
+25
-5
Game/GameBehavior.cs
Game/GameBehavior.cs
+5
-4
No files found.
Decks/AI_Trickstar.ydk
View file @
04074096
...
...
@@ -22,8 +22,6 @@
63845230
63845230
63845230
5133471
5133471
18144506
35261759
35261759
...
...
@@ -34,6 +32,8 @@
35371948
35371948
35371948
10813327
10813327
21076084
83555666
40605147
...
...
@@ -42,18 +42,18 @@
84749824
#extra
41999284
99111753
98558751
50588353
2857636
38342335
41999284
74997493
3987233
41999284
74997493
50588353
98558751
74997493
2857636
99111753
38342335
98978921
99111753
31833038
3987233
50588353
41999284
9753964
34408491
!side
Game/AI/Decks/TrickstarExecutor.cs
View file @
04074096
...
...
@@ -21,6 +21,7 @@ namespace WindBot.Game.AI.Decks
public
const
int
MG
=
23434538
;
public
const
int
Tuner
=
67441435
;
public
const
int
Eater
=
63845230
;
public
const
int
LockBird
=
94145021
;
public
const
int
Feather
=
18144506
;
public
const
int
Galaxy
=
5133471
;
...
...
@@ -34,27 +35,33 @@ namespace WindBot.Game.AI.Decks
public
const
int
Ring
=
83555666
;
public
const
int
Strike
=
40605147
;
public
const
int
Warn
=
84749824
;
public
const
int
Grass
=
10813327
;
public
const
int
Linkuri
=
41999284
;
public
const
int
Linkspi
=
98978921
;
public
const
int
SafeDra
=
99111753
;
public
const
int
Crystal
=
50588353
;
public
const
int
downer
=
77058170
;
public
const
int
phoneix
=
2857636
;
public
const
int
unicorn
=
38342335
;
public
const
int
firewall
=
5043010
;
public
const
int
snake
=
74997493
;
public
const
int
borrel
=
31833038
;
public
const
int
boomer
=
5821478
;
public
const
int
TG
=
98558751
;
public
const
int
Beelze
=
34408491
;
public
const
int
Abyss
=
9753964
;
public
const
int
Exterio
=
99916754
;
public
const
int
Ultimate
=
86221741
;
public
const
int
Cardian
=
87460579
;
public
const
int
Missus
=
3987233
;
}
public
int
getLinkMarker
(
int
id
)
{
if
(
id
==
CardId
.
borrel
||
id
==
CardId
.
snake
)
return
4
;
else
if
(
id
==
CardId
.
Abyss
||
id
==
CardId
.
Beelze
||
id
==
CardId
.
Exterio
||
id
==
CardId
.
Ultimate
)
return
5
;
else
if
(
id
==
CardId
.
unicorn
)
return
3
;
else
if
(
id
==
CardId
.
Crystal
||
id
==
CardId
.
phoneix
||
id
==
CardId
.
SafeDra
)
return
2
;
else
if
(
id
==
CardId
.
Crystal
||
id
==
CardId
.
phoneix
||
id
==
CardId
.
SafeDra
||
id
==
CardId
.
Missus
)
return
2
;
return
1
;
}
...
...
@@ -65,6 +72,9 @@ namespace WindBot.Game.AI.Decks
bool
tuner_eff_used
=
false
;
bool
crystal_eff_used
=
false
;
int
red_ss_count
=
0
;
bool
white_eff_used
=
false
;
bool
lockbird_useful
=
false
;
bool
lockbird_used
=
false
;
public
TrickstarExecutor
(
GameAI
ai
,
Duel
duel
)
:
base
(
ai
,
duel
)
...
...
@@ -73,9 +83,13 @@ namespace WindBot.Game.AI.Decks
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
MG
,
G_act
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Strike
,
DefaultSolemnStrike
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Warn
,
DefaultSolemnWarning
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Grass
,
Grass_ss
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Urara
,
Hand_act_eff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Ghost
,
Hand_act_eff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Ring
,
DefaultCompulsoryEvacuationDevice
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Ring
,
Ring_act
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Abyss
,
Abyss_eff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Exterio
,
Exterio_counter
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Cardian
);
// spell clean
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Stage
,
Stage_Lock
);
...
...
@@ -83,39 +97,46 @@ namespace WindBot.Game.AI.Decks
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Galaxy
,
GalaxyCyclone
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
TG
,
TG_eff
);
// ex_monster act
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Crystal
,
Crystal_eff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
SafeDra
,
DefaultCompulsoryEvacuationDevice
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Linkuri
,
Linkuri_eff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
phoneix
,
Phoneix_eff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
unicorn
,
Unicorn_eff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
snake
,
Snake_eff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Tuner
,
Tuner_eff
);
// ex ss
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
snake
,
Snake_ss
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
borrel
,
Borrel_ss
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
Missus
,
Missus_ss
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
phoneix
,
Phoneix_ss
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
unicorn
,
Unicorn
_ss
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
snake
,
Snake
_ss
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
Crystal
,
Crystal_ss
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
SafeDra
,
Safedragon_ss
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Linkuri
,
Linkuri_eff
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
Linkuri
,
Linkuri_ss
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
unicorn
,
Unicorn_ss
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
Linkspi
);
// ex_monster act
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Beelze
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Missus
,
Missus_eff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Crystal
,
Crystal_eff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
SafeDra
,
DefaultCompulsoryEvacuationDevice
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
phoneix
,
Phoneix_eff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
unicorn
,
Unicorn_eff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
snake
,
Snake_eff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
borrel
,
Borrel_eff
);
// normal act
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Trans
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
BF
,
BF_pos
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
BF
,
BF_pos
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Sheep
,
Sheep_Act
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Eater
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Eater
,
Eater_eff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
LockBird
,
LockBird_act
);
// ts
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Stage
,
Stage_act
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Pink
,
Pink_eff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Re
,
Reincarnation
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Red
,
Red_ss
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Yellow
,
Yellow_eff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
White
,
White_eff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Re
,
Reincarnation
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Crown
,
Crown_eff
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
Yellow
,
Yellow_sum
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
Red
,
Red_sum
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
Pink
,
Pink_sum
);
...
...
@@ -130,7 +151,6 @@ namespace WindBot.Game.AI.Decks
AddExecutor
(
ExecutorType
.
SummonOrSet
,
CardId
.
Red
);
AddExecutor
(
ExecutorType
.
SummonOrSet
,
CardId
.
Pink
);
AddExecutor
(
ExecutorType
.
SpellSet
,
DefaultSpellSet
);
}
public
bool
Has_down_arrow
(
int
id
)
...
...
@@ -147,8 +167,9 @@ namespace WindBot.Game.AI.Decks
{
return
new
[]
{
CardId
.
Crown
,
CardId
.
Tuner
,
CardId
.
Grass
,
CardId
.
Crown
,
CardId
.
Pink
,
CardId
.
Pot
,
CardId
.
BF
,
...
...
@@ -171,6 +192,71 @@ namespace WindBot.Game.AI.Decks
};
}
public
int
GetTotalATK
(
IList
<
ClientCard
>
list
)
{
int
atk
=
0
;
foreach
(
ClientCard
c
in
list
)
{
if
(
c
==
null
)
continue
;
atk
+=
c
.
Attack
;
}
return
atk
;
}
public
bool
Grass_ss
()
{
if
(
Bot
.
ExtraDeck
.
Count
>
0
)
{
IList
<
ClientCard
>
ex
=
Bot
.
ExtraDeck
;
ClientCard
ex_best
=
null
;
foreach
(
ClientCard
ex_card
in
ex
)
{
if
(
ex_best
==
null
||
ex_card
.
Attack
>
ex_best
.
Attack
)
ex_best
=
ex_card
;
}
if
(
ex_best
!=
null
)
{
AI
.
SelectCard
(
ex_best
);
}
return
true
;
}
return
true
;
}
public
bool
Abyss_eff
()
{
// tuner ss
if
(
ActivateDescription
==
-
1
)
{
AI
.
SelectCard
(
new
[]
{
CardId
.
Ghost
,
CardId
.
TG
,
CardId
.
Tuner
,
CardId
.
Urara
,
CardId
.
BF
});
return
true
;
};
// counter
if
(!
Enemy
.
HasInMonstersZone
(
CardId
.
Ghost
)
||
Enemy
.
GetHandCount
()
<=
1
)
{
ClientCard
tosolve
=
AI
.
Utils
.
GetProblematicEnemyCard
();
if
(
tosolve
==
null
)
{
if
(
LastChainPlayer
==
1
&&
GetLastChainCard
()
!=
null
)
{
ClientCard
target
=
GetLastChainCard
();
if
(
target
.
HasPosition
(
CardPosition
.
FaceUp
)
&&
(
target
.
Location
==
CardLocation
.
MonsterZone
||
target
.
Location
==
CardLocation
.
SpellZone
))
tosolve
=
target
;
}
}
if
(
tosolve
!=
null
)
{
AI
.
SelectCard
(
tosolve
);
return
true
;
}
}
return
false
;
}
public
bool
Stage_Lock
()
{
if
(
Card
.
Location
!=
CardLocation
.
SpellZone
)
return
false
;
...
...
@@ -224,14 +310,9 @@ namespace WindBot.Game.AI.Decks
public
bool
Feather_Act
()
{
List
<
ClientCard
>
spells
=
Enemy
.
GetSpells
();
foreach
(
ClientCard
card
in
spells
)
{
// 有常用贴纸
if
(
card
.
Id
==
5851097
||
card
.
Id
==
30241314
||
card
.
Id
==
81674782
||
card
.
Id
==
58921041
||
card
.
Id
==
59305593
)
if
(
AI
.
Utils
.
GetProblematicEnemySpell
()
!=
null
)
{
List
<
ClientCard
>
grave
=
Bot
.
GetGraveyardSpells
();
// 墓地有银河旋风则不发动
foreach
(
ClientCard
self_card
in
grave
)
{
if
(
self_card
.
Id
==
CardId
.
Galaxy
)
...
...
@@ -239,9 +320,8 @@ namespace WindBot.Game.AI.Decks
}
return
true
;
}
}
// 2张以上才发动
if
(
spells
.
Count
<=
1
)
// activate when more than 2 cards
if
(
Enemy
.
GetSpellCount
()
<=
1
)
return
false
;
return
true
;
}
...
...
@@ -250,8 +330,8 @@ namespace WindBot.Game.AI.Decks
{
if
(
Duel
.
Player
==
0
)
return
false
;
if
(
Duel
.
Phase
==
DuelPhase
.
End
)
return
true
;
if
(
LastChainPlayer
==
1
&&
(
AI
.
Utils
.
IsChainTarget
(
Card
)
||
GetLastChainCard
().
Id
==
CardId
.
Feather
))
return
true
;
if
(
Duel
.
Phase
>
DuelPhase
.
Main1
&&
Duel
.
Phase
<
DuelPhase
.
Main2
)
if
(
LastChainPlayer
==
1
&&
(
AI
.
Utils
.
IsChainTarget
(
Card
)
||
(
GetLastChainCard
().
Id
==
CardId
.
Feather
&&
!
Bot
.
HasInSpellZone
(
CardId
.
Grass
))
))
return
true
;
if
(
Duel
.
Phase
==
DuelPhase
.
BattleStart
)
{
int
total_atk
=
0
;
List
<
ClientCard
>
enemy_monster
=
Enemy
.
GetMonsters
();
...
...
@@ -282,7 +362,7 @@ namespace WindBot.Game.AI.Decks
stage_locked
=
null
;
return
true
;
}
else
if
(
Duel
.
LifePoints
[
1
]
<=
1000
&&
!
pink_ss
)
else
if
(
Duel
.
LifePoints
[
1
]
<=
1000
&&
Bot
.
GetRemainingCount
(
CardId
.
Pink
,
1
)
>
0
)
{
AI
.
SelectCard
(
new
[]
{
...
...
@@ -336,44 +416,42 @@ namespace WindBot.Game.AI.Decks
if
(
NormalSummoned
)
{
if
(
Bot
.
HasInMonstersZone
(
CardId
.
Yellow
)
&&
!
Bot
.
HasInHand
(
CardId
.
Red
)
)
if
(
Duel
.
LifePoints
[
1
]
<=
1000
&&
!
pink_ss
&&
Bot
.
GetRemainingCount
(
CardId
.
Pink
,
1
)
>
0
)
{
AI
.
SelectCard
(
new
[]
{
CardId
.
Red
,
CardId
.
Pink
,
CardId
.
Yellow
,
CardId
.
Red
,
CardId
.
White
});
stage_locked
=
null
;
return
true
;
}
else
if
(
Duel
.
LifePoints
[
1
]
<=
1000
&&
!
pink_ss
)
if
(
Enemy
.
GetMonsterCount
()
>
0
&&
AI
.
Utils
.
GetBestEnemyMonster
().
Attack
>=
AI
.
Utils
.
GetBestAttack
(
Bot
)
&&
!
Bot
.
HasInHand
(
CardId
.
White
)
)
{
AI
.
SelectCard
(
new
[]
{
CardId
.
Pink
,
CardId
.
White
,
CardId
.
Yellow
,
CardId
.
Red
,
CardId
.
White
CardId
.
Pink
,
CardId
.
Red
});
stage_locked
=
null
;
return
true
;
}
else
if
(
Enemy
.
GetMonsterCount
()
>
0
&&
AI
.
Utils
.
GetBestEnemyMonster
().
Attack
>=
AI
.
Utils
.
GetBestAttack
(
Bot
))
if
(
Bot
.
HasInMonstersZone
(
CardId
.
Yellow
)
&&
!
Bot
.
HasInHand
(
CardId
.
Red
))
{
AI
.
SelectCard
(
new
[]
{
CardId
.
White
,
CardId
.
Yellow
,
CardId
.
Red
,
CardId
.
Pink
,
CardId
.
Red
CardId
.
Yellow
,
CardId
.
White
});
stage_locked
=
null
;
return
true
;
}
else
if
(!
Bot
.
HasInSpellZone
(
CardId
.
Stage
))
{
AI
.
SelectCard
(
new
[]
{
CardId
.
Yellow
,
...
...
@@ -384,7 +462,6 @@ namespace WindBot.Game.AI.Decks
stage_locked
=
null
;
return
true
;
}
}
stage_locked
=
null
;
return
false
;
}
...
...
@@ -396,10 +473,21 @@ namespace WindBot.Game.AI.Decks
public
bool
Hand_act_eff
()
{
if
(
Card
.
Id
==
CardId
.
Urara
&&
Bot
.
HasInHand
(
CardId
.
LockBird
)
&&
Bot
.
HasInSpellZone
(
CardId
.
Re
))
return
false
;
if
(
Card
.
Id
==
CardId
.
Ghost
&&
Card
.
Location
==
CardLocation
.
Hand
&&
Bot
.
HasInMonstersZone
(
CardId
.
Ghost
))
return
false
;
return
(
LastChainPlayer
==
1
);
}
public
bool
Exterio_counter
()
{
if
(
LastChainPlayer
==
1
)
{
AI
.
SelectCard
(
Useless_List
());
return
true
;
}
return
false
;
}
public
bool
G_act
()
{
return
(
Duel
.
Player
==
1
);
...
...
@@ -448,7 +536,9 @@ namespace WindBot.Game.AI.Decks
public
bool
Eater_ss
()
{
if
(
AI
.
Utils
.
GetProblematicEnemyMonster
()
==
null
&&
Bot
.
ExtraDeck
.
Count
<
5
)
return
false
;
if
(
AI
.
Utils
.
IsTurn1OrMain2
())
return
false
;
AI
.
SelectPosition
(
CardPosition
.
FaceUpAttack
);
IList
<
ClientCard
>
targets
=
new
List
<
ClientCard
>();
if
(
Bot
.
SpellZone
[
5
]
!=
null
&&
Bot
.
SpellZone
[
5
].
IsFacedown
())
{
...
...
@@ -467,7 +557,8 @@ namespace WindBot.Game.AI.Decks
return
true
;
}
}
foreach
(
ClientCard
s_c
in
Bot
.
SpellZone
)
Logger
.
DebugWriteLine
(
"*** Eater use up the extra deck."
);
foreach
(
ClientCard
s_c
in
Bot
.
GetSpells
())
{
targets
.
Add
(
s_c
);
if
(
targets
.
Count
>=
5
)
...
...
@@ -479,14 +570,25 @@ namespace WindBot.Game.AI.Decks
return
false
;
}
public
bool
Eater_eff
()
{
ClientCard
self_card
=
(
Duel
.
Player
==
0
)
?
AI
.
GetAttacker
()
:
AI
.
GetDefender
();
ClientCard
enemy_card
=
(
Duel
.
Player
==
1
)
?
AI
.
GetAttacker
()
:
AI
.
GetDefender
();
if
(
self_card
==
null
||
enemy_card
==
null
)
return
false
;
if
(
enemy_card
.
HasPosition
(
CardPosition
.
FaceDown
))
return
true
;
if
(
enemy_card
.
HasPosition
(
CardPosition
.
Attack
)
&&
(
self_card
.
Attack
-
enemy_card
.
GetDefensePower
()
>=
Duel
.
LifePoints
[
1
]))
return
true
;
return
(
self_card
.
Attack
<=
(
enemy_card
.
GetDefensePower
()
*
2
));
}
public
bool
Red_ss
()
{
if
(
red_ss_count
>=
9
)
return
false
;
if
(
red_ss_count
>=
6
)
return
false
;
if
((
ChainContainsCard
(
53129443
)
||
ChainContainsCard
(
99330325
)
||
ChainContainsCard
(
53582587
))
&&
ChainContainsCard
(
CardId
.
Red
))
return
false
;
if
(
LastChainPlayer
==
0
&&
GetLastChainCard
().
Id
==
CardId
.
Red
)
{
foreach
(
ClientCard
m
in
Bot
.
GetMonsters
())
{
if
(
AI
.
Utils
.
IsChainTarget
(
m
))
if
(
AI
.
Utils
.
IsChainTarget
(
m
)
&&
IsTrickstar
(
m
.
Id
)
)
{
red_ss_count
+=
1
;
AI
.
SelectCard
(
m
);
...
...
@@ -504,7 +606,7 @@ namespace WindBot.Game.AI.Decks
ClientCard
tosolve_enemy
=
AI
.
Utils
.
GetOneEnemyBetterThanMyBest
();
foreach
(
ClientCard
c
in
self_m
)
{
if
(
IsTrickstar
(
c
.
Id
))
if
(
IsTrickstar
(
c
.
Id
)
&&
c
.
Id
!=
CardId
.
Red
)
{
if
(
c
.
Attacked
)
{
...
...
@@ -514,8 +616,9 @@ namespace WindBot.Game.AI.Decks
}
if
(
tosolve_enemy
!=
null
)
{
if
(
Bot
.
HasInHand
(
CardId
.
White
)
&&
c
.
Attack
*
2
<
tosolve_enemy
.
Attack
)
if
(
Bot
.
HasInHand
(
CardId
.
White
)
&&
c
.
Attack
+
c
.
BaseAttack
<
tosolve_enemy
.
Attack
)
{
if
(
tosolve_enemy
.
Attack
>
3200
)
AI
.
SelectPosition
(
CardPosition
.
FaceUpDefence
);
AI
.
SelectCard
(
c
);
red_ss_count
+=
1
;
return
true
;
...
...
@@ -528,6 +631,16 @@ namespace WindBot.Game.AI.Decks
}
if
(!
Bot
.
HasInHand
(
CardId
.
White
)
&&
c
.
Attack
<
tosolve_enemy
.
Attack
)
{
if
(!
c
.
Attacked
)
{
ClientCard
badatk
=
Enemy
.
GetMonsters
().
GetLowestAttackMonster
();
ClientCard
baddef
=
Enemy
.
GetMonsters
().
GetLowestDefenseMonster
();
int
enemy_power
=
99999
;
if
(
badatk
!=
null
&&
badatk
.
Attack
<=
enemy_power
)
enemy_power
=
badatk
.
Attack
;
if
(
baddef
!=
null
&&
baddef
.
Defense
<=
enemy_power
)
enemy_power
=
baddef
.
Defense
;
if
(
c
.
Attack
>
enemy_power
)
return
false
;
}
if
(
tosolve_enemy
.
Attack
>
1600
)
AI
.
SelectPosition
(
CardPosition
.
FaceUpDefence
);
AI
.
SelectCard
(
c
);
red_ss_count
+=
1
;
return
true
;
...
...
@@ -560,7 +673,7 @@ namespace WindBot.Game.AI.Decks
public
bool
Yellow_eff
()
{
if
(!
Bot
.
HasInHand
(
CardId
.
Stage
)
&&
!
Bot
.
HasInSpellZone
(
CardId
.
Stage
)
&&
Bot
.
GetRemainingCount
(
CardId
.
Stage
,
3
)
>
0
)
if
(!
Bot
.
HasInHand
(
CardId
.
Stage
)
&&
!
Bot
.
HasInSpellZone
(
CardId
.
Stage
)
&&
Bot
.
GetRemainingCount
(
CardId
.
Stage
,
3
)
>
0
)
{
AI
.
SelectCard
(
new
[]
{
...
...
@@ -569,14 +682,45 @@ namespace WindBot.Game.AI.Decks
CardId
.
White
,
CardId
.
Pink
,
CardId
.
Re
,
CardId
.
Ring
,
CardId
.
Crown
,
CardId
.
Yellow
});
return
true
;
}
if
(
Duel
.
LifePoints
[
1
]
<=
1000
)
{
if
(
Bot
.
GetRemainingCount
(
CardId
.
Pink
,
1
)
>
0
&&
!
pink_ss
)
{
AI
.
SelectCard
(
new
[]
{
CardId
.
Pink
,
CardId
.
Stage
,
CardId
.
Red
,
CardId
.
White
,
CardId
.
Re
,
CardId
.
Crown
,
CardId
.
Yellow
});
return
true
;
}
else
if
(
Enemy
.
GetMonsterCount
()
==
0
&&
!
AI
.
Utils
.
IsTurn1OrMain2
()
)
else
if
(
Bot
.
HasInGraveyard
(
CardId
.
Pink
)
&&
Bot
.
GetRemainingCount
(
CardId
.
Crown
,
1
)
>
0
)
{
if
(
Bot
.
HasInGraveyard
(
CardId
.
Red
)
&&
Bot
.
GetRemainingCount
(
CardId
.
Pink
,
1
)>
0
&&
!
pink_ss
)
AI
.
SelectCard
(
new
[]
{
CardId
.
Crown
,
CardId
.
Pink
,
CardId
.
Re
,
CardId
.
Stage
,
CardId
.
Red
,
CardId
.
White
,
CardId
.
Yellow
});
return
true
;
}
}
if
(
Enemy
.
GetMonsterCount
()
==
0
&&
!
AI
.
Utils
.
IsTurn1OrMain2
())
{
if
(
Bot
.
HasInGraveyard
(
CardId
.
Red
)
&&
Bot
.
GetRemainingCount
(
CardId
.
Pink
,
1
)
>
0
&&
!
pink_ss
)
{
AI
.
SelectCard
(
new
[]
{
...
...
@@ -585,15 +729,15 @@ namespace WindBot.Game.AI.Decks
CardId
.
White
,
CardId
.
Re
,
CardId
.
Stage
,
CardId
.
Ring
,
CardId
.
Crown
,
CardId
.
Yellow
});
}
else
if
(
Bot
.
HasInGraveyard
(
CardId
.
Pink
)
&&
Bot
.
HasInGraveyard
(
CardId
.
Red
)
&&
Bot
.
GetRemainingCount
(
CardId
.
Ring
,
1
)
>
0
)
else
if
(
Bot
.
HasInGraveyard
(
CardId
.
Pink
)
&&
Bot
.
HasInGraveyard
(
CardId
.
Red
)
&&
Bot
.
GetRemainingCount
(
CardId
.
Ring
,
1
)
>
0
)
{
AI
.
SelectCard
(
new
[]
{
CardId
.
Ring
,
CardId
.
Crown
,
CardId
.
Red
,
CardId
.
White
,
CardId
.
Re
,
...
...
@@ -602,7 +746,7 @@ namespace WindBot.Game.AI.Decks
CardId
.
Yellow
});
}
else
if
(
Bot
.
GetRemainingCount
(
CardId
.
White
,
2
)
>
0
&&
Duel
.
LifePoints
[
1
]
<=
4000
)
else
if
(
Bot
.
GetRemainingCount
(
CardId
.
White
,
2
)
>
0
&&
Duel
.
LifePoints
[
1
]
<=
4000
)
{
AI
.
SelectCard
(
new
[]
{
...
...
@@ -611,15 +755,15 @@ namespace WindBot.Game.AI.Decks
CardId
.
Pink
,
CardId
.
Re
,
CardId
.
Stage
,
CardId
.
Ring
,
CardId
.
Crown
,
CardId
.
Yellow
});
}
else
if
(
Bot
.
HasInGraveyard
(
CardId
.
White
)
&&
Bot
.
GetRemainingCount
(
CardId
.
Ring
,
1
)
>
0
)
else
if
(
Bot
.
HasInGraveyard
(
CardId
.
White
)
&&
Bot
.
GetRemainingCount
(
CardId
.
Crown
,
1
)
>
0
)
{
AI
.
SelectCard
(
new
[]
{
CardId
.
Ring
,
CardId
.
Crown
,
CardId
.
Red
,
CardId
.
Pink
,
CardId
.
Re
,
...
...
@@ -635,7 +779,7 @@ namespace WindBot.Game.AI.Decks
CardId
.
Red
,
CardId
.
Pink
,
CardId
.
Re
,
CardId
.
Ring
,
CardId
.
Crown
,
CardId
.
Stage
,
CardId
.
White
,
CardId
.
Yellow
...
...
@@ -643,10 +787,10 @@ namespace WindBot.Game.AI.Decks
}
return
true
;
}
else
if
(
AI
.
Utils
.
GetProblematicEnemyMonster
()
!=
null
)
if
(
AI
.
Utils
.
GetProblematicEnemyMonster
()
!=
null
)
{
int
atk
=
AI
.
Utils
.
GetProblematicEnemyMonster
().
Attack
;
if
(
atk
>=
1800
&&
atk
<=
3600
&&
Bot
.
GetRemainingCount
(
CardId
.
White
,
2
)
>
0
)
if
(
atk
>=
1800
&&
atk
<=
3600
&&
Bot
.
GetRemainingCount
(
CardId
.
White
,
2
)
>
0
&&
!
Bot
.
HasInHand
(
CardId
.
White
)
)
{
AI
.
SelectCard
(
new
[]
{
...
...
@@ -655,7 +799,7 @@ namespace WindBot.Game.AI.Decks
CardId
.
Pink
,
CardId
.
Re
,
CardId
.
Stage
,
CardId
.
Ring
,
CardId
.
Crown
,
CardId
.
Yellow
});
}
...
...
@@ -666,80 +810,179 @@ namespace WindBot.Game.AI.Decks
CardId
.
Red
,
CardId
.
Pink
,
CardId
.
Re
,
CardId
.
Ring
,
CardId
.
Crown
,
CardId
.
Stage
,
CardId
.
White
,
CardId
.
Yellow
});
}
return
true
;
}
else
}
if
((
Bot
.
HasInHand
(
CardId
.
Red
)
||
Bot
.
HasInHand
(
CardId
.
Stage
)
||
Bot
.
HasInHand
(
CardId
.
Yellow
))
&&
Bot
.
GetRemainingCount
(
CardId
.
Re
,
1
)
>
0
)
{
Logger
.
DebugWriteLine
(
"to search reincarnation"
);
AI
.
SelectCard
(
new
[]
{
CardId
.
Re
,
CardId
.
Red
,
CardId
.
White
,
CardId
.
Crown
,
CardId
.
Pink
,
CardId
.
Stage
,
CardId
.
Yellow
});
return
true
;
}
AI
.
SelectCard
(
new
[]
{
CardId
.
Red
,
CardId
.
Pink
,
CardId
.
Re
,
CardId
.
Ring
,
CardId
.
Crown
,
CardId
.
Stage
,
CardId
.
White
,
CardId
.
Yellow
});
return
true
;
}
}
public
bool
White_eff
()
{
if
(
Duel
.
Phase
>
DuelPhase
.
Main1
&&
Duel
.
Phase
<
DuelPhase
.
Main2
)
{
// from blackwing
/*
ClientCard bestMy = Bot.GetMonsters().GetHighestAttackMonster();
ClientCard bestEnemyATK = Enemy.GetMonsters().GetHighestAttackMonster();
ClientCard bestEnemyDEF = Enemy.GetMonsters().GetHighestDefenseMonster();
if (bestMy == null || (bestEnemyATK == null && bestEnemyDEF == null))
return false;
if (bestEnemyATK != null && bestMy.Attack <= bestEnemyATK.Attack && bestMy.Attack * 2 >= bestEnemyATK.Attack)
{
white_eff_used = true;
return true;
}
if (bestEnemyDEF != null && bestMy.Attack <= bestEnemyDEF.Defense && bestMy.Attack * 2 >= bestEnemyDEF.Defense)
{
white_eff_used = true;
return true;
}
*/
ClientCard
self_monster
=
(
Duel
.
Player
==
0
)
?
AI
.
GetAttacker
()
:
AI
.
GetDefender
();
ClientCard
enemy_monster
=
(
Duel
.
Player
==
1
)
?
AI
.
GetAttacker
()
:
AI
.
GetDefender
();
if
(
self_monster
==
null
||
enemy_monster
==
null
||
!
IsTrickstar
(
self_monster
.
Id
)
||
self_monster
.
HasPosition
(
CardPosition
.
Defence
))
return
false
;
if
(
self_monster
.
Attack
<=
enemy_monster
.
RealPower
&&
self_monster
.
Attack
+
self_monster
.
BaseAttack
>=
enemy_monster
.
RealPower
)
{
white_eff_used
=
true
;
return
true
;
}
return
false
;
}
else
{
if
(
Enemy
.
GetMonsterCount
()
==
0
&&
!
AI
.
Utils
.
IsTurn1OrMain2
())
return
true
;
if
(
Enemy
.
GetMonsterCount
()
==
0
&&
!
AI
.
Utils
.
IsTurn1OrMain2
())
{
white_eff_used
=
true
;
return
true
;
}
else
if
(
Enemy
.
GetMonsterCount
()
!=
0
)
{
ClientCard
tosolve
=
AI
.
Utils
.
GetBestEnemyMonster
(
true
);
ClientCard
self_card
=
Bot
.
GetMonsters
().
GetHighestAttackMonster
();
if
(
tosolve
==
null
||
self_card
==
null
||
(
tosolve
!=
null
&&
self_card
!=
null
&&
!
IsTrickstar
(
self_card
.
Id
)))
{
return
(
Enemy
.
GetMonsters
().
GetLowestAttackMonster
()
==
null
||
Enemy
.
GetMonsters
().
GetLowestDefenseMonster
()
==
null
||
Enemy
.
GetMonsters
().
GetLowestAttackMonster
().
Attack
<
2000
||
Enemy
.
GetMonsters
().
GetLowestDefenseMonster
().
Defense
<
2000
);
if
(
Enemy
.
GetMonsters
().
GetHighestAttackMonster
()==
null
||
Enemy
.
GetMonsters
().
GetHighestDefenseMonster
()
==
null
||
Enemy
.
GetMonsters
().
GetHighestAttackMonster
().
GetDefensePower
()
<
2000
||
Enemy
.
GetMonsters
().
GetHighestDefenseMonster
().
GetDefensePower
()
<
2000
)
{
white_eff_used
=
true
;
return
true
;
}
else
return
false
;
}
if
(
tosolve
!=
null
&&
self_card
!=
null
&&
IsTrickstar
(
self_card
.
Id
))
if
(
tosolve
!=
null
&&
self_card
!=
null
&&
IsTrickstar
(
self_card
.
Id
)
&&
!
tosolve
.
IsMonsterHasPreventActivationEffectInBattle
()
)
{
int
attacker_atk
=
self_card
.
Attack
;
int
defender_power
=
tosolve
.
GetDefensePower
();
if
(
attacker_atk
<=
defender_power
&&
attacker_atk
*
2
>=
defender_power
)
Logger
.
DebugWriteLine
(
"battle check 0:"
+
Duel
.
Phase
.
ToString
());
Logger
.
DebugWriteLine
(
"battle check 1:"
+
self_card
.
Attack
.
ToString
());
Logger
.
DebugWriteLine
(
"battle check 2:"
+
(
self_card
.
Attack
+
self_card
.
BaseAttack
).
ToString
());
Logger
.
DebugWriteLine
(
"battle check 3:"
+
defender_power
.
ToString
());
if
(
self_card
.
Attack
<=
defender_power
&&
self_card
.
Attack
+
self_card
.
BaseAttack
>=
defender_power
)
{
return
false
;
}
else
if
(
defender_power
<=
2000
)
{
white_eff_used
=
true
;
return
true
;
}
}
}
return
false
;
}
}
public
bool
LockBird_act
()
{
if
(
Duel
.
Player
==
0
||
lockbird_used
)
return
false
;
lockbird_useful
=
true
;
if
(
Bot
.
HasInSpellZone
(
CardId
.
Re
))
{
if
(
ChainContainsCard
(
CardId
.
Re
))
lockbird_used
=
true
;
return
ChainContainsCard
(
CardId
.
Re
);
}
lockbird_used
=
true
;
return
true
;
}
public
bool
Reincarnation
()
{
if
(
Card
.
Location
==
CardLocation
.
Grave
)
return
Ts_reborn
();
if
(
Bot
.
HasInHand
(
CardId
.
LockBird
))
{
if
(
lockbird_useful
||
AI
.
Utils
.
IsChainTarget
(
Card
)
||
(
Duel
.
Player
==
1
&&
ChainContainsCard
(
CardId
.
Feather
)))
{
lockbird_useful
=
false
;
return
true
;
}
return
false
;
}
return
true
;
}
public
bool
Crown_eff
()
{
if
(
Card
.
Location
==
CardLocation
.
Hand
)
{
if
(
Duel
.
Phase
<=
DuelPhase
.
Main1
)
return
Ts_reborn
();
return
false
;
}
if
(
Bot
.
HasInHand
(
CardId
.
Pink
))
{
AI
.
SelectCard
(
CardId
.
Pink
);
return
true
;
}
if
(
Enemy
.
GetMonsterCount
()
==
0
)
{
foreach
(
ClientCard
hand
in
Bot
.
Hand
)
{
if
(
hand
.
IsMonster
()
&&
IsTrickstar
(
hand
.
Id
))
{
if
(
hand
.
Attack
>=
Duel
.
LifePoints
[
1
])
return
true
;
if
(
hand
.
Id
!=
CardId
.
Yellow
)
{
if
(
AI
.
Utils
.
GetOneEnemyBetterThanValue
(
hand
.
Attack
,
false
)
==
null
)
return
true
;
}
}
}
}
return
false
;
}
public
bool
Ts_reborn
()
{
if
(
Duel
.
Player
==
0
&&
Duel
.
LifePoints
[
1
]
<=
1000
)
{
AI
.
SelectCard
(
CardId
.
Pink
);
return
true
;
}
bool
can_summon
=
(
Duel
.
Player
==
0
&&
NormalSummoned
);
if
(
can_summon
)
{
...
...
@@ -762,6 +1005,7 @@ namespace WindBot.Game.AI.Decks
}
else
{
AI
.
SelectCard
(
new
[]
{
CardId
.
Red
,
...
...
@@ -816,15 +1060,20 @@ namespace WindBot.Game.AI.Decks
public
bool
Tuner_ss
()
{
if
(
crystal_eff_used
)
return
false
;
if
(
crystal_eff_used
||
Bot
.
HasInMonstersZone
(
CardId
.
Crystal
)
)
return
false
;
if
(
Bot
.
GetMonsterCount
()
==
0
||
!
Bot
.
HasInExtra
(
CardId
.
Crystal
))
return
false
;
if
(
Card
.
Id
==
CardId
.
Ghost
&&
Bot
.
GetRemainingCount
(
CardId
.
Ghost
,
2
)
<=
0
)
return
false
;
int
count
=
0
;
if
(
Card
.
Id
!=
CardId
.
Urara
)
count
+=
1
;
foreach
(
ClientCard
hand
in
Bot
.
Hand
)
{
if
(
hand
.
Id
==
Card
.
Id
)
count
+=
1
;
}
if
(
count
>=
2
)
return
true
;
if
(
count
<
2
)
return
false
;
foreach
(
ClientCard
m
in
Bot
.
GetMonsters
())
{
if
(
m
.
Id
!=
CardId
.
Eater
&&
getLinkMarker
(
m
.
Id
)
<=
2
)
return
true
;
}
return
false
;
}
...
...
@@ -835,6 +1084,23 @@ namespace WindBot.Game.AI.Decks
return
true
;
}
public
bool
Ring_act
()
{
if
(
LastChainPlayer
==
0
&&
GetLastChainCard
()
!=
null
&&
GetLastChainCard
().
Id
==
CardId
.
Ghost
)
return
false
;
ClientCard
target
=
AI
.
Utils
.
GetProblematicEnemyMonster
();
if
(
target
==
null
&&
AI
.
Utils
.
IsChainTarget
(
Card
))
{
target
=
AI
.
Utils
.
GetBestEnemyMonster
();
}
if
(
target
!=
null
)
{
if
(
Duel
.
LifePoints
[
0
]
<=
target
.
Attack
)
return
false
;
AI
.
SelectCard
(
target
);
return
true
;
}
return
false
;
}
public
bool
Linkuri_ss
()
{
foreach
(
ClientCard
c
in
Bot
.
GetMonsters
())
...
...
@@ -866,9 +1132,14 @@ namespace WindBot.Game.AI.Decks
});
return
true
;
}
foreach
(
ClientCard
extra_card
in
Bot
.
GetMonstersInExtraZone
())
{
if
(
getLinkMarker
(
extra_card
.
Id
)
>=
5
)
return
false
;
}
IList
<
ClientCard
>
targets
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
t_check
in
Bot
.
GetMonsters
())
{
if
(
t_check
.
IsFacedown
())
continue
;
if
(
t_check
.
Id
==
CardId
.
BF
||
t_check
.
Id
==
CardId
.
Tuner
||
t_check
.
Id
==
CardId
.
Urara
||
t_check
.
Id
==
CardId
.
Ghost
)
{
targets
.
Add
(
t_check
);
...
...
@@ -876,8 +1147,11 @@ namespace WindBot.Game.AI.Decks
}
}
if
(
targets
.
Count
==
0
)
return
false
;
foreach
(
ClientCard
e_check
in
Bot
.
GetMonsters
())
List
<
ClientCard
>
m_list
=
new
List
<
ClientCard
>(
Bot
.
GetMonsters
());
m_list
.
Sort
(
AIFunctions
.
CompareCardAttack
);
foreach
(
ClientCard
e_check
in
m_list
)
{
if
(
e_check
.
IsFacedown
())
continue
;
if
(
targets
[
0
]
!=
e_check
&&
getLinkMarker
(
e_check
.
Id
)
<=
2
&&
e_check
.
Id
!=
CardId
.
Eater
&&
e_check
.
Id
!=
CardId
.
Crystal
)
{
targets
.
Add
(
e_check
);
...
...
@@ -885,7 +1159,7 @@ namespace WindBot.Game.AI.Decks
}
}
if
(
targets
.
Count
<=
1
)
return
false
;
AI
.
Select
Card
(
targets
);
AI
.
Select
Materials
(
targets
);
return
true
;
}
...
...
@@ -916,16 +1190,41 @@ namespace WindBot.Game.AI.Decks
{
if
(
Card
.
Location
!=
CardLocation
.
MonsterZone
)
return
true
;
ClientCard
target
=
AI
.
Utils
.
GetProblematicEnemySpell
();
if
(
target
!=
null
)
AI
.
SelectCard
(
target
);
IList
<
ClientCard
>
list
=
new
List
<
ClientCard
>();
if
(
target
!=
null
)
list
.
Add
(
target
);
foreach
(
ClientCard
spells
in
Enemy
.
GetSpells
())
{
if
(
spells
!=
null
&&
!
list
.
Contains
(
spells
))
list
.
Add
(
spells
);
}
AI
.
SelectCard
(
list
);
return
true
;
}
public
bool
Safedragon_ss
()
{
if
(
AI
.
Utils
.
IsTurn1OrMain2
())
return
false
;
ClientCard
m
=
AI
.
Utils
.
GetProblematicEnemyMonster
();
if
(
m
==
null
)
foreach
(
ClientCard
ex_m
in
Bot
.
GetMonstersInExtraZone
())
{
if
(
getLinkMarker
(
ex_m
.
Id
)
>=
4
)
return
false
;
}
if
((
m
==
null
||
m
.
HasPosition
(
CardPosition
.
FaceDown
))
&&
Duel
.
LifePoints
[
1
]
<=
1100
)
{
if
(
Enemy
.
GetMonsterCount
()
==
0
&&
Duel
.
Phase
<
DuelPhase
.
Battle
)
{
IList
<
ClientCard
>
list
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
monster
in
Bot
.
GetMonsters
())
{
return
(
Enemy
.
GetMonsterCount
()
==
0
&&
Duel
.
LifePoints
[
1
]
<=
1100
&&
Duel
.
Phase
<
DuelPhase
.
Battle
);
if
(
getLinkMarker
(
monster
.
Id
)
<=
2
)
list
.
Add
(
monster
);
if
(
list
.
Count
==
2
)
break
;
}
if
(
list
.
Count
==
2
&&
GetTotalATK
(
list
)
<=
1100
)
{
AI
.
SelectMaterials
(
list
);
return
true
;
}
return
false
;
}
}
ClientCard
ex_1
=
Bot
.
MonsterZone
[
5
];
ClientCard
ex_2
=
Bot
.
MonsterZone
[
6
];
...
...
@@ -937,12 +1236,13 @@ namespace WindBot.Game.AI.Decks
IList
<
ClientCard
>
targets
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
s_m
in
Bot
.
GetMonsters
())
{
if
(
s_m
.
Id
==
CardId
.
Eater
)
continue
;
if
(
s_m
!=
Bot
.
MonsterZone
[
5
]
&&
s_m
!=
Bot
.
MonsterZone
[
6
])
targets
.
Add
(
s_m
);
if
(
targets
.
Count
>
=
2
)
break
;
if
(
targets
.
Count
=
=
2
)
break
;
}
if
(
targets
.
Count
>
=
2
)
if
(
targets
.
Count
=
=
2
)
{
AI
.
Select
Card
(
targets
);
AI
.
Select
Materials
(
targets
);
return
true
;
}
return
false
;
...
...
@@ -953,31 +1253,51 @@ namespace WindBot.Game.AI.Decks
ClientCard
m
=
AI
.
Utils
.
GetProblematicEnemySpell
();
if
(
m
==
null
)
{
return
(
Enemy
.
GetMonsterCount
()
==
0
&&
Duel
.
LifePoints
[
1
]
<=
1900
&&
Duel
.
Phase
==
DuelPhase
.
Main1
);
if
(
Enemy
.
GetMonsterCount
()
==
0
&&
Duel
.
LifePoints
[
1
]
<=
1900
&&
Duel
.
Phase
==
DuelPhase
.
Main1
)
{
IList
<
ClientCard
>
m_list
=
new
List
<
ClientCard
>();
List
<
ClientCard
>
list
=
new
List
<
ClientCard
>(
Bot
.
GetMonsters
());
list
.
Sort
(
AIFunctions
.
CompareCardAttack
);
foreach
(
ClientCard
monster
in
list
)
{
if
(
getLinkMarker
(
monster
.
Id
)
==
1
&&
monster
.
IsFaceup
())
m_list
.
Add
(
monster
);
if
(
m_list
.
Count
==
2
)
break
;
}
if
(
m_list
.
Count
==
2
&&
GetTotalATK
(
m_list
)
<=
1900
)
{
AI
.
SelectMaterials
(
m_list
);
return
true
;
}
}
return
false
;
}
if
(
Bot
.
Hand
.
Count
==
0
)
return
false
;
IList
<
ClientCard
>
targets
=
new
List
<
ClientCard
>();
ClientCard
ex_zone
=
null
;
foreach
(
ClientCard
s_m
in
Bot
.
GetMonsters
())
List
<
ClientCard
>
main_list
=
new
List
<
ClientCard
>(
Bot
.
GetMonstersInMainZone
());
main_list
.
Sort
(
AIFunctions
.
CompareCardAttack
);
foreach
(
ClientCard
s_m
in
main_list
)
{
if
(
s_m
==
Bot
.
MonsterZone
[
5
]
&&
s_m
!=
Bot
.
MonsterZone
[
6
])
if
(
s_m
.
IsFacedown
())
continue
;
if
((
s_m
.
Id
!=
CardId
.
Eater
||
(
s_m
.
Id
==
CardId
.
Eater
&&
s_m
.
IsDisabled
()))
&&
!
targets
.
ContainsCardWithId
(
s_m
.
Id
))
{
ex_zone
=
s_m
;
targets
.
Add
(
s_m
);
};
if
(
targets
.
Count
==
2
)
break
;
}
else
if
(
targets
.
Count
<
2
)
{
foreach
(
ClientCard
s_m
in
Bot
.
GetMonstersInExtraZone
())
{
if
(
s_m
.
IsFacedown
())
continue
;
if
(
s_m
.
Id
!=
CardId
.
Eater
&&
!
targets
.
ContainsCardWithId
(
s_m
.
Id
))
{
targets
.
Add
(
s_m
);
};
};
if
(
targets
.
Count
>=
2
)
break
;
if
(
targets
.
Count
==
2
)
break
;
}
if
(
targets
.
Count
<
2
)
{
targets
.
Add
(
ex_zone
);
}
AI
.
SelectCard
(
targets
);
if
(
targets
.
Count
<
2
)
return
false
;
AI
.
SelectMaterials
(
targets
);
return
true
;
}
...
...
@@ -989,16 +1309,42 @@ namespace WindBot.Game.AI.Decks
public
bool
Unicorn_ss
()
{
ClientCard
m
=
AI
.
Utils
.
GetProblematicEnemyCard
();
int
link_count
=
0
;
if
(
m
==
null
)
{
return
(
Enemy
.
GetMonsterCount
()
==
0
&&
Duel
.
LifePoints
[
1
]
<=
2200
&&
Duel
.
Phase
==
DuelPhase
.
Main1
);
if
(
Enemy
.
GetMonsterCount
()
==
0
&&
Duel
.
LifePoints
[
1
]
<=
2200
&&
Duel
.
Phase
==
DuelPhase
.
Main1
)
{
IList
<
ClientCard
>
m_list
=
new
List
<
ClientCard
>();
List
<
ClientCard
>
_sort_list
=
new
List
<
ClientCard
>(
Bot
.
GetMonsters
());
_sort_list
.
Sort
(
AIFunctions
.
CompareCardAttack
);
foreach
(
ClientCard
monster
in
_sort_list
)
{
if
(
getLinkMarker
(
monster
.
Id
)
==
2
)
{
link_count
+=
2
;
m_list
.
Add
(
monster
);
}
else
if
(
getLinkMarker
(
monster
.
Id
)
==
1
&&
monster
.
IsFaceup
())
{
link_count
+=
1
;
m_list
.
Add
(
monster
);
}
if
(
link_count
>=
3
)
break
;
}
if
(
link_count
>=
3
&&
GetTotalATK
(
m_list
)
<=
2200
)
{
AI
.
SelectMaterials
(
m_list
);
return
true
;
}
}
return
false
;
}
if
(
Bot
.
Hand
.
Count
==
0
)
return
false
;
IList
<
ClientCard
>
targets
=
new
List
<
ClientCard
>();
int
link_count
=
0
;
foreach
(
ClientCard
s_m
in
Bot
.
GetMonsters
())
List
<
ClientCard
>
sort_list
=
Bot
.
GetMonsters
();
sort_list
.
Sort
(
AIFunctions
.
CompareCardAttack
);
foreach
(
ClientCard
s_m
in
sort_list
)
{
if
(
s_m
.
Id
!=
CardId
.
Eater
&&
getLinkMarker
(
s_m
.
Id
)
<=
2
)
if
(
(
s_m
.
Id
!=
CardId
.
Eater
||
(
s_m
.
Id
==
CardId
.
Eater
&&
m
.
IsMonsterHasPreventActivationEffectInBattle
()))
&&
getLinkMarker
(
s_m
.
Id
)
<=
2
&&
s_m
.
IsFaceup
()
)
{
if
(!
targets
.
ContainsCardWithId
(
s_m
.
Id
))
{
...
...
@@ -1009,7 +1355,7 @@ namespace WindBot.Game.AI.Decks
}
}
if
(
link_count
<
3
)
return
false
;
AI
.
Select
Card
(
targets
);
AI
.
Select
Materials
(
targets
);
return
true
;
}
...
...
@@ -1017,28 +1363,54 @@ namespace WindBot.Game.AI.Decks
{
ClientCard
m
=
AI
.
Utils
.
GetProblematicEnemyCard
();
if
(
m
==
null
)
return
false
;
// avoid cards that cannot target.
AI
.
SelectCard
(
Useless_List
());
AI
.
SelectNextCard
(
m
);
IList
<
ClientCard
>
enemy_list
=
new
List
<
ClientCard
>();
enemy_list
.
Add
(
m
);
foreach
(
ClientCard
enemy
in
Enemy
.
GetMonstersInExtraZone
())
{
if
(
enemy
!=
null
&&
!
enemy_list
.
Contains
(
enemy
))
enemy_list
.
Add
(
enemy
);
}
foreach
(
ClientCard
enemy
in
Enemy
.
GetMonstersInMainZone
())
{
if
(
enemy
!=
null
&&
!
enemy_list
.
Contains
(
enemy
))
enemy_list
.
Add
(
enemy
);
}
foreach
(
ClientCard
enemy
in
Enemy
.
GetSpells
())
{
if
(
enemy
!=
null
&&
!
enemy_list
.
Contains
(
enemy
))
enemy_list
.
Add
(
enemy
);
}
AI
.
SelectNextCard
(
enemy_list
);
return
true
;
}
public
bool
Snake_ss
()
{
IList
<
ClientCard
>
targets
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
m
in
Bot
.
GetMonsters
())
// exzone fo first
foreach
(
ClientCard
e_m
in
Bot
.
GetMonstersInExtraZone
())
{
if
(
m
.
Attack
<
1900
&&
!
targets
.
ContainsCardWithId
(
m
.
Id
))
if
(
e_m
.
Attack
<
1900
&&
!
targets
.
ContainsCardWithId
(
e_m
.
Id
)
&&
e_m
.
IsFaceup
(
))
{
targets
.
Add
(
m
);
targets
.
Add
(
e_
m
);
}
}
List
<
ClientCard
>
sort_main_list
=
new
List
<
ClientCard
>(
Bot
.
GetMonstersInMainZone
());
sort_main_list
.
Sort
(
AIFunctions
.
CompareCardAttack
);
foreach
(
ClientCard
m
in
sort_main_list
)
{
if
(
m
.
Attack
<
1900
&&
!
targets
.
ContainsCardWithId
(
m
.
Id
)
&&
m
.
IsFaceup
())
{
targets
.
Add
(
m
);
}
if
(
targets
.
Count
>=
4
)
{
AI
.
SelectCard
(
targets
);
if
(
Duel
.
LifePoints
[
1
]
<=
GetTotalATK
(
targets
)
&&
Enemy
.
GetMonsterCount
()
==
0
)
return
false
;
AI
.
SelectMaterials
(
targets
);
AI
.
SelectYesNo
(
true
);
snake_four_s
=
true
;
return
true
;
}
}
return
false
;
}
...
...
@@ -1073,10 +1445,111 @@ namespace WindBot.Game.AI.Decks
return
false
;
}
public
bool
Missus_ss
()
{
IList
<
ClientCard
>
material_list
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
monster
in
Bot
.
GetMonsters
())
{
if
(
monster
.
HasAttribute
(
CardAttribute
.
Earth
)
&&
getLinkMarker
(
monster
.
Id
)
==
1
)
material_list
.
Add
(
monster
);
if
(
material_list
.
Count
==
2
)
break
;
}
if
(
material_list
.
Count
<
2
)
return
false
;
if
(
Enemy
.
GetMonsterCount
()
==
0
||
AI
.
Utils
.
GetProblematicEnemyMonster
(
2000
)
==
null
)
{
AI
.
SelectMaterials
(
material_list
);
return
true
;
}
else
if
(
AI
.
Utils
.
GetProblematicEnemyMonster
(
2000
)
!=
null
&&
Bot
.
HasInExtra
(
CardId
.
borrel
)
&&
!
Bot
.
HasInMonstersZone
(
CardId
.
Missus
))
{
AI
.
SelectMaterials
(
material_list
);
return
true
;
}
return
false
;
}
public
bool
Missus_eff
()
{
AI
.
SelectCard
(
new
[]
{
CardId
.
MG
,
CardId
.
Missus
,
CardId
.
snake
});
return
true
;
}
public
bool
Borrel_ss
()
{
bool
already_link2
=
false
;
IList
<
ClientCard
>
material_list
=
new
List
<
ClientCard
>();
if
(
AI
.
Utils
.
GetProblematicEnemyMonster
(
2000
)
==
null
)
Logger
.
DebugWriteLine
(
"***borrel:null"
);
else
Logger
.
DebugWriteLine
(
"***borrel:"
+
(
AI
.
Utils
.
GetProblematicEnemyMonster
(
2000
).
Name
??
"unknown"
));
if
(
AI
.
Utils
.
GetProblematicEnemyMonster
(
2000
)
!=
null
||
(
Enemy
.
GetMonsterCount
()
==
0
&&
Duel
.
Phase
==
DuelPhase
.
Main1
&&
Duel
.
LifePoints
[
1
]
<=
3000
))
{
foreach
(
ClientCard
e_m
in
Bot
.
GetMonstersInExtraZone
())
{
if
(
getLinkMarker
(
e_m
.
Id
)
<
3
)
{
if
(
getLinkMarker
(
e_m
.
Id
)
==
2
)
already_link2
=
true
;
material_list
.
Add
(
e_m
);
}
}
List
<
ClientCard
>
sort_list
=
new
List
<
ClientCard
>(
Bot
.
GetMonstersInMainZone
());
sort_list
.
Sort
(
AIFunctions
.
CompareCardAttack
);
foreach
(
ClientCard
m
in
sort_list
)
{
if
(
getLinkMarker
(
m
.
Id
)
<
3
)
{
if
(
getLinkMarker
(
m
.
Id
)
==
2
&&
!
already_link2
)
{
already_link2
=
true
;
material_list
.
Add
(
m
);
}
else
if
(
m
.
Id
!=
CardId
.
Sheep
+
1
&&
(
m
.
Id
!=
CardId
.
Eater
))
{
material_list
.
Add
(
m
);
}
if
((
already_link2
&&
material_list
.
Count
==
3
)
||
(!
already_link2
&&
material_list
.
Count
==
4
))
break
;
}
}
if
((
already_link2
&&
material_list
.
Count
==
3
)
||
(!
already_link2
&&
material_list
.
Count
==
4
))
{
if
(
Enemy
.
GetMonsterCount
()
==
0
&&
Duel
.
Phase
==
DuelPhase
.
Main1
&&
Duel
.
LifePoints
[
1
]
<=
3000
)
{
if
(
GetTotalATK
(
material_list
)
>=
3000
)
return
false
;
}
AI
.
SelectMaterials
(
material_list
);
return
true
;
}
}
return
false
;
}
public
bool
Borrel_eff
()
{
if
(
ActivateDescription
==
-
1
)
{
Logger
.
DebugWriteLine
(
"borrel's ntr effect"
);
return
true
;
};
ClientCard
BestEnemy
=
AI
.
Utils
.
GetBestEnemyMonster
(
true
);
ClientCard
WorstBot
=
Bot
.
GetMonsters
().
GetLowestAttackMonster
();
if
(
BestEnemy
==
null
||
BestEnemy
.
HasPosition
(
CardPosition
.
FaceDown
))
return
false
;
if
(
WorstBot
==
null
||
WorstBot
.
HasPosition
(
CardPosition
.
FaceDown
))
return
false
;
if
(
BestEnemy
.
Attack
>=
WorstBot
.
RealPower
)
{
AI
.
SelectCard
(
BestEnemy
);
return
true
;
}
return
false
;
}
public
bool
MonsterRepos
()
{
if
(
Card
.
Id
==
CardId
.
Eater
)
return
false
;
if
(
Card
.
Id
==
CardId
.
Sheep
+
1
)
return
false
;
if
(
Card
.
Id
==
CardId
.
Eater
&&
Card
.
IsAttack
())
return
false
;
if
(
IsTrickstar
(
Card
.
Id
)
&&
!
white_eff_used
&&
Bot
.
HasInHand
(
CardId
.
White
)
&&
Card
.
IsAttack
()
&&
Duel
.
Phase
==
DuelPhase
.
Main1
)
return
false
;
if
(
Card
.
IsFaceup
()
&&
Card
.
IsDefense
()
&&
Card
.
Attack
==
0
)
return
false
;
bool
enemyBetter
=
AI
.
Utils
.
IsAllEnemyBetter
(
true
);
if
(
Card
.
IsAttack
()
&&
enemyBetter
)
...
...
@@ -1100,16 +1573,64 @@ namespace WindBot.Game.AI.Decks
snake_four_s
=
false
;
crystal_eff_used
=
false
;
red_ss_count
=
0
;
white_eff_used
=
false
;
lockbird_useful
=
false
;
lockbird_used
=
false
;
}
public
override
BattlePhaseAction
OnBattle
(
IList
<
ClientCard
>
attackers
,
IList
<
ClientCard
>
defenders
)
{
if
(
attackers
.
Count
==
0
)
return
AI
.
ToMainPhase2
();
if
(
defenders
.
Count
==
0
)
{
for
(
int
i
=
attackers
.
Count
-
1
;
i
>=
0
;
--
i
)
{
ClientCard
attacker
=
attackers
[
i
];
if
(
attacker
.
Attack
>
0
)
return
AI
.
Attack
(
attacker
,
null
);
}
}
else
{
for
(
int
i
=
defenders
.
Count
-
1
;
i
>=
0
;
--
i
)
{
ClientCard
defender
=
defenders
[
i
];
for
(
int
j
=
0
;
j
<
attackers
.
Count
;
++
j
)
{
ClientCard
attacker
=
attackers
[
j
];
attacker
.
RealPower
=
attacker
.
Attack
;
defender
.
RealPower
=
defender
.
GetDefensePower
();
if
(!
OnPreBattleBetween
(
attacker
,
defender
))
continue
;
// add
if
(!
defender
.
IsMonsterHasPreventActivationEffectInBattle
()
&&
!
attacker
.
IsDisabled
())
{
if
((
attacker
.
Id
==
CardId
.
Eater
&&
!
defender
.
HasType
(
CardType
.
Token
))
||
attacker
.
Id
==
CardId
.
borrel
)
return
AI
.
Attack
(
attacker
,
defender
);
}
if
(
attacker
.
RealPower
>
defender
.
RealPower
||
(
attacker
.
RealPower
>=
defender
.
RealPower
&&
j
==
attackers
.
Count
-
1
))
return
AI
.
Attack
(
attacker
,
defender
);
}
}
for
(
int
i
=
attackers
.
Count
-
1
;
i
>=
0
;
--
i
)
{
ClientCard
attacker
=
attackers
[
i
];
if
(
attacker
.
CanDirectAttack
)
return
AI
.
Attack
(
attacker
,
null
);
}
}
if
(!
Battle
.
CanMainPhaseTwo
)
return
AI
.
Attack
(
attackers
[
0
],
(
defenders
.
Count
==
0
)
?
null
:
defenders
[
0
]);
return
AI
.
ToMainPhase2
();
}
public
override
bool
OnPreBattleBetween
(
ClientCard
attacker
,
ClientCard
defender
)
{
if
(!
defender
.
IsMonsterHasPreventActivationEffectInBattle
())
{
if
(
attacker
.
Attribute
==
(
int
)
CardAttribute
.
Light
&&
Bot
.
HasInHand
(
CardId
.
White
)
)
if
(
IsTrickstar
(
attacker
.
Id
)
&&
Bot
.
HasInHand
(
CardId
.
White
)
&&
!
white_eff_used
)
attacker
.
RealPower
=
attacker
.
RealPower
*
2
;
else
if
(
attacker
.
Id
==
CardId
.
Eater
)
attacker
.
RealPower
=
99999
;
}
return
base
.
OnPreBattleBetween
(
attacker
,
defender
);
}
...
...
Game/GameAI.cs
View file @
04074096
using
System.Linq
;
using
System.Linq
;
using
System.Collections.Generic
;
using
WindBot.Game.AI
;
using
YGOSharp.OCGWrapper.Enums
;
...
...
@@ -90,6 +90,8 @@ namespace WindBot.Game
m_option
=
-
1
;
m_yesno
=
-
1
;
m_position
=
CardPosition
.
FaceUpAttack
;
m_attacker
=
null
;
m_defender
=
null
;
Duel
.
LastSummonPlayer
=
-
1
;
if
(
Duel
.
Player
==
0
&&
Duel
.
Phase
==
DuelPhase
.
Draw
)
{
...
...
@@ -628,9 +630,27 @@ namespace WindBot.Game
private
int
m_number
;
private
int
m_announce
;
private
int
m_yesno
;
private
ClientCard
m_attacker
;
private
ClientCard
m_defender
;
private
IList
<
CardAttribute
>
m_attributes
=
new
List
<
CardAttribute
>();
private
IList
<
CardRace
>
m_races
=
new
List
<
CardRace
>();
public
void
SendBattleMsg
(
ClientCard
attackcard
,
ClientCard
defendcard
)
{
m_attacker
=
attackcard
;
m_defender
=
defendcard
;
}
public
ClientCard
GetAttacker
()
{
return
m_attacker
;
}
public
ClientCard
GetDefender
()
{
return
m_defender
;
}
public
void
SelectCard
(
ClientCard
card
)
{
m_selector
=
new
CardSelector
(
card
);
...
...
Game/GameBehavior.cs
View file @
04074096
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.Text.RegularExpressions
;
...
...
@@ -497,12 +497,13 @@ namespace WindBot.Game
int
la
=
packet
.
ReadByte
();
int
sa
=
packet
.
ReadByte
();
packet
.
ReadByte
();
//
packet
.
ReadByte
(
);
// cd
int
cd
=
GetLocalPlayer
(
packet
.
ReadByte
()
);
// cd
int
ld
=
packet
.
ReadByte
();
packet
.
ReadByte
();
// sd
int
sd
=
packet
.
ReadByte
();
// sd
packet
.
ReadByte
();
//
ClientCard
attackcard
=
_duel
.
GetCard
(
ca
,
(
CardLocation
)
la
,
sa
);
ClientCard
defendcard
=
_duel
.
GetCard
(
cd
,
(
CardLocation
)
ld
,
sd
);
_ai
.
SendBattleMsg
(
attackcard
,
defendcard
);
if
(
ld
==
0
&&
(
attackcard
!=
null
)
&&
(
ca
!=
0
))
{
_ai
.
OnDirectAttack
(
attackcard
);
...
...
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