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
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
MyCard
windbot
Commits
4fe200fc
Commit
4fe200fc
authored
Mar 05, 2021
by
mercury233
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/IceYGO/windbot
parents
d6998ace
972f4135
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
1035 additions
and
134 deletions
+1035
-134
BotWrapper/bot.conf
BotWrapper/bot.conf
+10
-0
Decks/AI_FamiliarPossessed.ydk
Decks/AI_FamiliarPossessed.ydk
+63
-0
Decks/AI_Timethief.ydk
Decks/AI_Timethief.ydk
+29
-25
Dialogs/VI-1911.zh-CN.json
Dialogs/VI-1911.zh-CN.json
+60
-0
Game/AI/Decks/FamiliarPossessedExecutor.cs
Game/AI/Decks/FamiliarPossessedExecutor.cs
+629
-0
Game/AI/Decks/TimeThiefExecutor.cs
Game/AI/Decks/TimeThiefExecutor.cs
+230
-108
Game/GameClient.cs
Game/GameClient.cs
+13
-1
WindBot.csproj
WindBot.csproj
+1
-0
No files found.
BotWrapper/bot.conf
View file @
4fe200fc
...
...
@@ -109,6 +109,16 @@ Name=复制梁龙 Deck=Salamangreat Dialog=anothercopy.zh-CN
转生炎兽卡组。
AI_LV3
SUPPORT_NEW_MASTER_RULE
SUPPORT_MASTER_RULE_2020
!
VI
-
1911
-凭依装着
Name
=
VI
-
1911
Deck
=
FamiliarPossessed
Dialog
=
VI
-
1911
.
zh
-
CN
凭依装着卡组。
AI_ANTI_META
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
SUPPORT_MASTER_RULE_2020
!
VI
-
1911
-时劫者
Name
=
VI
-
1911
Deck
=
TimeThief
Dialog
=
VI
-
1911
.
zh
-
CN
时间潜行者卡组。
AI_LV2
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
SUPPORT_MASTER_RULE_2020
!永远之魂-削血
Name
=永远之魂
Deck
=
Burn
Dialog
=
soul
.
zh
-
CN
老式削血卡组。
...
...
Decks/AI_FamiliarPossessed.ydk
0 → 100644
View file @
4fe200fc
#created by ...
#main
71197066
15397015
15397015
15397015
4376659
4376659
31764354
31887906
40542826
40542826
68881650
68881650
14558127
14558127
36584821
36584821
23434538
23434538
18144506
35261759
35261759
49238328
49238328
73915051
73915051
62256492
62256492
25704359
25704359
30241314
30241314
36975314
36975314
59305593
59305593
61740673
82732705
82732705
40605147
40605147
41420027
41420027
84749824
84749824
#extra
12014404
31833038
85289965
65330383
38342335
2857636
9839945
30674956
48815792
73309655
97661969
75452921
98978921
41999284
41999284
!side
Decks/AI_Timethief.ydk
View file @
4fe200fc
#created by ...
#main
65367484
65367484
65367484
71564252
71564252
71564252
56308388
56308388
56308388
67696066
67696066
82496097
82496097
82496097
74578720
74578720
74578720
19891131
19891131
19891131
70368879
70368879
70368879
14558127
14558127
23434538
23434538
12580477
18144507
35261759
35261759
49238328
49238328
81439173
10877309
10877309
10877309
81670445
81670445
81670445
18678554
18678554
18678554
26708437
26708437
26708437
57319935
57319935
98827725
98827725
98827725
36975314
36975314
40605147
40605147
40605147
41420027
41420027
41420027
76587747
76587747
76587747
84749824
84749824
#extra
56832966
56832966
5683296
6
4242160
6
86532744
86532744
86532744
84013237
16195942
84013237
84013237
55285840
55285840
55285840
59208943
59208943
59208943
46772449
12014404
12014404
!side
Dialogs/VI-1911.zh-CN.json
0 → 100644
View file @
4fe200fc
{
"welcome"
:
[
"咱是一个机器人,名字叫老喵师,一个不怎么会打牌的存在。"
,
"欢迎下载了解喵版YGO主程序YGO-VI-EX。下载请微博搜索:老喵师1911。"
],
"deckerror"
:
[
"啊,{0}又用不出来了。"
],
"duelstart"
:
[
"没有人可以打不赢咱。"
,
"无能的咱,什么卡组都用不好。"
,
"你左手让咱,咱都不是你的对手。"
,
"嘛,无所谓了。"
],
"newturn"
:
[
"啊,是咱的回合么。"
,
"抽一张卡。"
],
"endturn"
:
[
"咱的运气不错,没能被你干掉。"
,
"无所谓了,看看下回合能做点啥了。"
],
"directattack"
:
[
"用{0}进行攻击。"
,
"这卡还行,就拿{0}攻击吧。"
,
"时间还早,先拿{0}打过去。"
,
"运气不算太差,{0}的攻击应该能通过吧。"
],
"attack"
:
[
"{0},攻击{1}。"
,
"没时间了,{0},赶快把{1}打了,咱要去看看哪里有BUG需要修了。"
,
"似乎行得通,{1}没有{0}强,{0}攻击。"
],
"ondirectattack"
:
[
"习惯就好了。"
,
"{0}么,运气不错啊。"
,
"还行还行。"
],
"facedownmonstername"
:
"怪兽"
,
"activate"
:
[
"发动{0}的效果。"
,
"啊等下,使用{0}的效果。"
,
"这{0}咋用啊,交了算了。"
],
"summon"
:
[
"召唤{0}"
,
"{0}似乎今天没有BUG。"
,
"{0}居然在服务器里更新了么。"
,
"{0}:老喵师这么菜就别打牌了。"
],
"setmonster"
:
[
"放置一只怪兽,看看要不要结束回合。"
,
"没辙了,放置一只怪兽。"
],
"chaining"
:
[
"发动{0}的效果进行连锁。"
,
"不要调皮,{0}发动。"
,
"还有张{0},发了。"
]
}
Game/AI/Decks/FamiliarPossessedExecutor.cs
0 → 100644
View file @
4fe200fc
using
YGOSharp.OCGWrapper
;
using
YGOSharp.OCGWrapper.Enums
;
using
System.Collections.Generic
;
using
WindBot
;
using
WindBot.Game
;
using
WindBot.Game.AI
;
using
System.Linq
;
namespace
WindBot.Game.AI.Decks
{
[
Deck
(
"FamiliarPossessed"
,
"AI_FamiliarPossessed"
)]
public
class
FamiliarPossessedExecutor
:
DefaultExecutor
{
public
class
CardId
{
public
const
int
MetalSnake
=
71197066
;
public
const
int
InspectBoarder
=
15397015
;
public
const
int
AshBlossomAndJoyousSpring
=
14558127
;
public
const
int
GrenMajuDaEizo
=
36584821
;
public
const
int
MaxxC
=
23434538
;
public
const
int
Aussa
=
31887906
;
public
const
int
Eria
=
68881650
;
public
const
int
Wynn
=
31764354
;
public
const
int
Hiita
=
4376659
;
public
const
int
Lyna
=
40542825
;
public
const
int
Awakening
=
62256492
;
public
const
int
Unpossessed
=
25704359
;
public
const
int
NaturalExterio
=
99916754
;
public
const
int
NaturalBeast
=
33198837
;
public
const
int
SwordsmanLV7
=
37267041
;
public
const
int
RoyalDecreel
=
51452091
;
public
const
int
HarpieFeatherDuster
=
18144506
;
public
const
int
PotOfDesires
=
35261759
;
public
const
int
PotofExtravagance
=
49238328
;
public
const
int
Scapegoat
=
73915051
;
public
const
int
MacroCosmos
=
30241314
;
public
const
int
Crackdown
=
36975314
;
public
const
int
ImperialOrder
=
61740673
;
public
const
int
SolemnWarning
=
84749824
;
public
const
int
SolemStrike
=
40605147
;
public
const
int
SolemnJudgment
=
41420027
;
public
const
int
SkillDrain
=
82732705
;
public
const
int
Mistake
=
59305593
;
public
const
int
BorreloadDragon
=
31833038
;
public
const
int
BirrelswordDragon
=
85289965
;
public
const
int
KnightmareGryphon
=
65330383
;
public
const
int
KnightmareUnicorn
=
38342335
;
public
const
int
KnightmarePhoenix
=
2857636
;
public
const
int
KnightmareCerberus
=
75452921
;
public
const
int
LinkSpider
=
98978921
;
public
const
int
Linkuriboh
=
41999284
;
public
const
int
GagagaCowboy
=
12014404
;
public
const
int
AussaP
=
97661969
;
public
const
int
EriaP
=
73309655
;
public
const
int
WynnP
=
30674956
;
public
const
int
HiitaP
=
48815792
;
public
const
int
LynaP
=
9839945
;
}
public
FamiliarPossessedExecutor
(
GameAI
ai
,
Duel
duel
)
:
base
(
ai
,
duel
)
{
// do first
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
PotofExtravagance
,
PotofExtravaganceActivate
);
// burn if enemy's LP is below 800
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
GagagaCowboy
,
GagagaCowboySummon
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
GagagaCowboy
);
//Sticker
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
MacroCosmos
,
MacroCosmoseff
);
//counter
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
AshBlossomAndJoyousSpring
,
DefaultAshBlossomAndJoyousSpring
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
MaxxC
,
DefaultMaxxC
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
SolemnWarning
,
DefaultSolemnWarning
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
SolemStrike
,
DefaultSolemnStrike
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
ImperialOrder
,
ImperialOrderfirst
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
ImperialOrder
,
ImperialOrdereff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
SolemnJudgment
,
DefaultSolemnJudgment
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
SkillDrain
,
SkillDrainEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Mistake
,
DefaultUniqueTrap
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Awakening
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Unpossessed
,
UnpossessedEffect
);
//first do
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
HarpieFeatherDuster
,
DefaultHarpiesFeatherDusterFirst
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
PotOfDesires
,
PotOfDesireseff
);
//sp
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Linkuriboh
,
Linkuriboheff
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
Linkuriboh
,
Linkuribohsp
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
KnightmareCerberus
,
Knightmaresp
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
KnightmarePhoenix
,
Knightmaresp
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
AussaP
,
AussaPsp
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
AussaP
,
AussaPeff
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
EriaP
,
EriaPsp
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
EriaP
,
EriaPeff
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
WynnP
,
WynnPsp
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
WynnP
,
WynnPeff
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
HiitaP
,
HiitaPsp
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
HiitaP
,
HiitaPeff
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
LynaP
,
LynaPsp
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
LynaP
,
LynaPeff
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
Linkuriboh
,
Linkuribohsp
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
LinkSpider
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
BorreloadDragon
,
BorreloadDragonsp
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
BorreloadDragon
,
BorreloadDragoneff
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
BirrelswordDragon
,
BirrelswordDragonsp
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
BirrelswordDragon
,
BirrelswordDragoneff
);
// normal summon
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
InspectBoarder
,
InspectBoardersummon
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
GrenMajuDaEizo
,
GrenMajuDaEizosummon
);
AddExecutor
(
ExecutorType
.
SpSummon
,
CardId
.
BorreloadDragon
,
BorreloadDragonspsecond
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
Aussa
,
FamiliarPossessedsummon
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
Eria
,
FamiliarPossessedsummon
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
Wynn
,
FamiliarPossessedsummon
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
Hiita
,
FamiliarPossessedsummon
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
Lyna
,
FamiliarPossessedsummon
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
MetalSnake
,
MetalSnakesp
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
MetalSnake
,
MetalSnakeeff
);
//spell
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Crackdown
,
Crackdowneff
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Scapegoat
,
DefaultScapegoat
);
AddExecutor
(
ExecutorType
.
Repos
,
DefaultMonsterRepos
);
//set
AddExecutor
(
ExecutorType
.
SpellSet
,
SpellSet
);
}
public
void
SelectSTPlace
(
ClientCard
card
=
null
,
bool
avoid_Impermanence
=
false
,
List
<
int
>
avoid_list
=
null
)
{
List
<
int
>
list
=
new
List
<
int
>
{
0
,
1
,
2
,
3
,
4
};
int
n
=
list
.
Count
;
while
(
n
--
>
1
)
{
int
index
=
Program
.
Rand
.
Next
(
n
+
1
);
int
temp
=
list
[
index
];
list
[
index
]
=
list
[
n
];
list
[
n
]
=
temp
;
}
foreach
(
int
seq
in
list
)
{
int
zone
=
(
int
)
System
.
Math
.
Pow
(
2
,
seq
);
if
(
Bot
.
SpellZone
[
seq
]
==
null
)
{
if
(
card
!=
null
&&
card
.
Location
==
CardLocation
.
Hand
&&
avoid_Impermanence
)
continue
;
if
(
avoid_list
!=
null
&&
avoid_list
.
Contains
(
seq
))
continue
;
AI
.
SelectPlace
(
zone
);
return
;
};
}
AI
.
SelectPlace
(
0
);
}
public
bool
SpellNegatable
(
bool
isCounter
=
false
,
ClientCard
target
=
null
)
{
// target default set
if
(
target
==
null
)
target
=
Card
;
// won't negate if not on field
if
(
target
.
Location
!=
CardLocation
.
SpellZone
&&
target
.
Location
!=
CardLocation
.
Hand
)
return
false
;
// negate judge
if
(
Enemy
.
HasInMonstersZone
(
CardId
.
NaturalExterio
,
true
)
&&
!
isCounter
)
return
true
;
if
(
target
.
IsSpell
())
{
if
(
Enemy
.
HasInMonstersZone
(
CardId
.
NaturalBeast
,
true
))
return
true
;
if
(
Enemy
.
HasInSpellZone
(
CardId
.
ImperialOrder
,
true
)
||
Bot
.
HasInSpellZone
(
CardId
.
ImperialOrder
,
true
))
return
true
;
if
(
Enemy
.
HasInMonstersZone
(
CardId
.
SwordsmanLV7
,
true
)
||
Bot
.
HasInMonstersZone
(
CardId
.
SwordsmanLV7
,
true
))
return
true
;
}
if
(
target
.
IsTrap
())
{
if
(
Enemy
.
HasInSpellZone
(
CardId
.
RoyalDecreel
,
true
)
||
Bot
.
HasInSpellZone
(
CardId
.
RoyalDecreel
,
true
))
return
true
;
}
// how to get here?
return
false
;
}
private
bool
MacroCosmoseff
()
{
return
(
Duel
.
LastChainPlayer
==
1
||
Duel
.
LastSummonPlayer
==
1
||
Duel
.
Player
==
0
)
&&
UniqueFaceupSpell
();
}
private
bool
ImperialOrderfirst
()
{
if
(
Util
.
GetLastChainCard
()
!=
null
&&
Util
.
GetLastChainCard
().
IsCode
(
CardId
.
PotOfDesires
))
return
false
;
return
DefaultOnBecomeTarget
()
&&
Util
.
GetLastChainCard
().
HasType
(
CardType
.
Spell
);
}
private
bool
ImperialOrdereff
()
{
if
(
Util
.
GetLastChainCard
()
!=
null
&&
Util
.
GetLastChainCard
().
IsCode
(
CardId
.
PotOfDesires
))
return
false
;
if
(
Duel
.
LastChainPlayer
==
1
)
{
foreach
(
ClientCard
check
in
Enemy
.
GetSpells
())
{
if
(
Util
.
GetLastChainCard
()
==
check
)
return
true
;
}
}
return
false
;
}
private
bool
PotOfDesireseff
()
{
return
Bot
.
Deck
.
Count
>
14
&&
!
DefaultSpellWillBeNegated
();
}
// activate of PotofExtravagance
public
bool
PotofExtravaganceActivate
()
{
// won't activate if it'll be negate
if
(
SpellNegatable
())
return
false
;
SelectSTPlace
(
Card
,
true
);
AI
.
SelectOption
(
1
);
return
true
;
}
private
bool
Crackdowneff
()
{
if
(
Util
.
GetOneEnemyBetterThanMyBest
(
true
,
true
)
!=
null
&&
Bot
.
UnderAttack
)
AI
.
SelectCard
(
Util
.
GetOneEnemyBetterThanMyBest
(
true
,
true
));
return
Util
.
GetOneEnemyBetterThanMyBest
(
true
,
true
)
!=
null
&&
Bot
.
UnderAttack
;
}
private
bool
SkillDrainEffect
()
{
return
(
Bot
.
LifePoints
>
1000
)
&&
DefaultUniqueTrap
();
}
private
bool
UnpossessedEffect
()
{
AI
.
SelectCard
(
new
List
<
int
>()
{
CardId
.
Lyna
,
CardId
.
Hiita
,
CardId
.
Wynn
,
CardId
.
Eria
,
CardId
.
Aussa
});
return
true
;
}
private
bool
InspectBoardersummon
()
{
if
(
Bot
.
MonsterZone
[
0
]
==
null
)
AI
.
SelectPlace
(
Zones
.
z0
);
else
AI
.
SelectPlace
(
Zones
.
z4
);
return
true
;
}
private
bool
GrenMajuDaEizosummon
()
{
if
(
Duel
.
Turn
==
1
)
return
false
;
if
(
Bot
.
HasInSpellZone
(
CardId
.
SkillDrain
)
||
Enemy
.
HasInSpellZone
(
CardId
.
SkillDrain
))
return
false
;
if
(
Bot
.
MonsterZone
[
0
]
==
null
)
AI
.
SelectPlace
(
Zones
.
z0
);
else
AI
.
SelectPlace
(
Zones
.
z4
);
return
Bot
.
Banished
.
Count
>=
6
;
}
private
bool
FamiliarPossessedsummon
()
{
if
(
Bot
.
MonsterZone
[
0
]
==
null
)
AI
.
SelectPlace
(
Zones
.
z0
);
else
AI
.
SelectPlace
(
Zones
.
z4
);
return
true
;
}
private
bool
BorreloadDragonsp
()
{
if
(!(
Bot
.
HasInMonstersZone
(
new
[]
{
CardId
.
KnightmareCerberus
,
CardId
.
KnightmarePhoenix
,
CardId
.
LynaP
,
CardId
.
HiitaP
,
CardId
.
WynnP
,
CardId
.
EriaP
,
CardId
.
AussaP
})))
return
false
;
IList
<
ClientCard
>
material_list
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
monster
in
Bot
.
GetMonsters
())
{
if
(
monster
.
IsCode
(
CardId
.
LynaP
,
CardId
.
HiitaP
,
CardId
.
WynnP
,
CardId
.
EriaP
,
CardId
.
AussaP
,
CardId
.
KnightmareCerberus
,
CardId
.
KnightmarePhoenix
,
CardId
.
LinkSpider
,
CardId
.
Linkuriboh
))
material_list
.
Add
(
monster
);
if
(
material_list
.
Count
==
3
)
break
;
}
if
(
material_list
.
Count
>=
3
)
{
AI
.
SelectMaterials
(
material_list
);
return
true
;
}
return
false
;
}
private
bool
BorreloadDragonspsecond
()
{
if
(!(
Bot
.
HasInMonstersZone
(
new
[]
{
CardId
.
KnightmareCerberus
,
CardId
.
KnightmarePhoenix
,
CardId
.
LynaP
,
CardId
.
HiitaP
,
CardId
.
WynnP
,
CardId
.
EriaP
,
CardId
.
AussaP
})))
return
false
;
IList
<
ClientCard
>
material_list
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
monster
in
Bot
.
GetMonsters
())
{
if
(
monster
.
IsCode
(
CardId
.
LynaP
,
CardId
.
HiitaP
,
CardId
.
WynnP
,
CardId
.
EriaP
,
CardId
.
AussaP
,
CardId
.
KnightmareCerberus
,
CardId
.
KnightmarePhoenix
,
CardId
.
LinkSpider
,
CardId
.
Linkuriboh
))
material_list
.
Add
(
monster
);
if
(
material_list
.
Count
==
3
)
break
;
}
if
(
material_list
.
Count
>=
3
)
{
AI
.
SelectMaterials
(
material_list
);
return
true
;
}
return
false
;
}
public
bool
BorreloadDragoneff
()
{
if
(
ActivateDescription
==
-
1
&&
(
Duel
.
Phase
==
DuelPhase
.
BattleStart
||
Duel
.
Phase
==
DuelPhase
.
End
))
{
ClientCard
enemy_monster
=
Enemy
.
BattlingMonster
;
if
(
enemy_monster
!=
null
&&
enemy_monster
.
HasPosition
(
CardPosition
.
Attack
))
{
return
(
Card
.
Attack
-
enemy_monster
.
Attack
<
Enemy
.
LifePoints
);
}
return
true
;
};
ClientCard
BestEnemy
=
Util
.
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
;
}
private
bool
BirrelswordDragonsp
()
{
IList
<
ClientCard
>
material_list
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
m
in
Bot
.
GetMonsters
())
{
if
(
m
.
IsCode
(
CardId
.
KnightmareCerberus
,
CardId
.
KnightmarePhoenix
,
CardId
.
LynaP
,
CardId
.
HiitaP
,
CardId
.
WynnP
,
CardId
.
EriaP
,
CardId
.
AussaP
))
{
material_list
.
Add
(
m
);
break
;
}
}
foreach
(
ClientCard
m
in
Bot
.
GetMonsters
())
{
if
(
m
.
IsCode
(
CardId
.
Linkuriboh
)
||
m
.
Level
==
1
)
{
material_list
.
Add
(
m
);
if
(
material_list
.
Count
==
3
)
break
;
}
}
if
(
material_list
.
Count
==
3
)
{
AI
.
SelectMaterials
(
material_list
);
return
true
;
}
return
false
;
}
private
bool
BirrelswordDragoneff
()
{
if
(
ActivateDescription
==
Util
.
GetStringId
(
CardId
.
BirrelswordDragon
,
0
))
{
if
(
Util
.
IsChainTarget
(
Card
)
&&
Util
.
GetBestEnemyMonster
(
true
,
true
)
!=
null
)
{
AI
.
SelectCard
(
Util
.
GetBestEnemyMonster
(
true
,
true
));
return
true
;
}
if
(
Duel
.
Player
==
1
&&
Bot
.
BattlingMonster
==
Card
)
{
AI
.
SelectCard
(
Enemy
.
BattlingMonster
);
return
true
;
}
if
(
Duel
.
Player
==
1
&&
Bot
.
BattlingMonster
!=
null
&&
(
Enemy
.
BattlingMonster
.
Attack
-
Bot
.
BattlingMonster
.
Attack
)
>=
Bot
.
LifePoints
)
{
AI
.
SelectCard
(
Enemy
.
BattlingMonster
);
return
true
;
}
if
(
Duel
.
Player
==
0
&&
Duel
.
Phase
==
DuelPhase
.
BattleStart
)
{
foreach
(
ClientCard
check
in
Enemy
.
GetMonsters
())
{
if
(
check
.
IsAttack
())
{
AI
.
SelectCard
(
check
);
return
true
;
}
}
}
return
false
;
}
return
true
;
}
private
bool
MetalSnakesp
()
{
if
(
ActivateDescription
==
Util
.
GetStringId
(
CardId
.
MetalSnake
,
0
)
&&
!
Bot
.
HasInMonstersZone
(
CardId
.
MetalSnake
))
{
if
(
Duel
.
Player
==
1
&&
Duel
.
Phase
>=
DuelPhase
.
BattleStart
)
return
Bot
.
Deck
.
Count
>=
12
;
if
(
Duel
.
Player
==
0
&&
Duel
.
Phase
>=
DuelPhase
.
Main1
)
return
Bot
.
Deck
.
Count
>=
12
;
}
return
false
;
}
private
bool
MetalSnakeeff
()
{
ClientCard
target
=
Util
.
GetOneEnemyBetterThanMyBest
(
true
,
true
);
if
(
ActivateDescription
==
Util
.
GetStringId
(
CardId
.
MetalSnake
,
1
)
&&
target
!=
null
)
{
AI
.
SelectCard
(
new
[]
{
CardId
.
LynaP
,
CardId
.
HiitaP
,
CardId
.
WynnP
,
CardId
.
EriaP
,
CardId
.
KnightmareGryphon
});
AI
.
SelectNextCard
(
target
);
return
true
;
}
return
false
;
}
private
bool
AussaPsp
()
{
IList
<
ClientCard
>
material_list
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
monster
in
Bot
.
GetMonsters
())
{
if
(
monster
.
HasAttribute
(
CardAttribute
.
Earth
)
&&
!
monster
.
IsCode
(
CardId
.
KnightmareCerberus
,
CardId
.
InspectBoarder
,
CardId
.
GrenMajuDaEizo
,
CardId
.
KnightmarePhoenix
,
CardId
.
LynaP
,
CardId
.
HiitaP
,
CardId
.
WynnP
,
CardId
.
EriaP
,
CardId
.
AussaP
,
CardId
.
KnightmareUnicorn
,
CardId
.
KnightmareGryphon
,
CardId
.
BorreloadDragon
,
CardId
.
BirrelswordDragon
))
material_list
.
Add
(
monster
);
if
(
material_list
.
Count
==
2
)
break
;
}
if
(
material_list
.
Count
<
2
)
return
false
;
if
(
Bot
.
HasInMonstersZone
(
CardId
.
AussaP
))
return
false
;
AI
.
SelectMaterials
(
material_list
);
if
(
Bot
.
MonsterZone
[
0
]
==
null
&&
Bot
.
MonsterZone
[
2
]
==
null
&&
Bot
.
MonsterZone
[
5
]
==
null
)
AI
.
SelectPlace
(
Zones
.
z5
);
else
AI
.
SelectPlace
(
Zones
.
z6
);
return
true
;
}
private
bool
AussaPeff
()
{
AI
.
SelectCard
(
CardId
.
MaxxC
,
CardId
.
Aussa
);
return
true
;
}
private
bool
EriaPsp
()
{
IList
<
ClientCard
>
material_list
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
monster
in
Bot
.
GetMonsters
())
{
if
(
monster
.
HasAttribute
(
CardAttribute
.
Water
)
&&
!
monster
.
IsCode
(
CardId
.
KnightmareCerberus
,
CardId
.
InspectBoarder
,
CardId
.
GrenMajuDaEizo
,
CardId
.
KnightmarePhoenix
,
CardId
.
LynaP
,
CardId
.
HiitaP
,
CardId
.
WynnP
,
CardId
.
EriaP
,
CardId
.
AussaP
,
CardId
.
KnightmareUnicorn
,
CardId
.
KnightmareGryphon
,
CardId
.
BorreloadDragon
,
CardId
.
BirrelswordDragon
))
material_list
.
Add
(
monster
);
if
(
material_list
.
Count
==
2
)
break
;
}
if
(
material_list
.
Count
<
2
)
return
false
;
if
(
Bot
.
HasInMonstersZone
(
CardId
.
EriaP
))
return
false
;
AI
.
SelectMaterials
(
material_list
);
if
(
Bot
.
MonsterZone
[
0
]
==
null
&&
Bot
.
MonsterZone
[
2
]
==
null
&&
Bot
.
MonsterZone
[
5
]
==
null
)
AI
.
SelectPlace
(
Zones
.
z5
);
else
AI
.
SelectPlace
(
Zones
.
z6
);
return
true
;
}
private
bool
EriaPeff
()
{
AI
.
SelectCard
(
CardId
.
Eria
);
return
true
;
}
private
bool
WynnPsp
()
{
IList
<
ClientCard
>
material_list
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
monster
in
Bot
.
GetMonsters
())
{
if
(
monster
.
HasAttribute
(
CardAttribute
.
Wind
)
&&
!
monster
.
IsCode
(
CardId
.
KnightmareCerberus
,
CardId
.
InspectBoarder
,
CardId
.
GrenMajuDaEizo
,
CardId
.
KnightmarePhoenix
,
CardId
.
LynaP
,
CardId
.
HiitaP
,
CardId
.
WynnP
,
CardId
.
EriaP
,
CardId
.
AussaP
,
CardId
.
KnightmareUnicorn
,
CardId
.
KnightmareGryphon
,
CardId
.
BorreloadDragon
,
CardId
.
BirrelswordDragon
))
material_list
.
Add
(
monster
);
if
(
material_list
.
Count
==
2
)
break
;
}
if
(
material_list
.
Count
<
2
)
return
false
;
if
(
Bot
.
HasInMonstersZone
(
CardId
.
WynnP
))
return
false
;
AI
.
SelectMaterials
(
material_list
);
if
(
Bot
.
MonsterZone
[
0
]
==
null
&&
Bot
.
MonsterZone
[
2
]
==
null
&&
Bot
.
MonsterZone
[
5
]
==
null
)
AI
.
SelectPlace
(
Zones
.
z5
);
else
AI
.
SelectPlace
(
Zones
.
z6
);
return
true
;
}
private
bool
WynnPeff
()
{
AI
.
SelectCard
(
CardId
.
Wynn
);
return
true
;
}
private
bool
HiitaPsp
()
{
IList
<
ClientCard
>
material_list
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
monster
in
Bot
.
GetMonsters
())
{
if
(
monster
.
HasAttribute
(
CardAttribute
.
Fire
)
&&
!
monster
.
IsCode
(
CardId
.
KnightmareCerberus
,
CardId
.
InspectBoarder
,
CardId
.
GrenMajuDaEizo
,
CardId
.
KnightmarePhoenix
,
CardId
.
LynaP
,
CardId
.
HiitaP
,
CardId
.
WynnP
,
CardId
.
EriaP
,
CardId
.
AussaP
,
CardId
.
KnightmareUnicorn
,
CardId
.
KnightmareGryphon
,
CardId
.
BorreloadDragon
,
CardId
.
BirrelswordDragon
))
material_list
.
Add
(
monster
);
if
(
material_list
.
Count
==
2
)
break
;
}
if
(
material_list
.
Count
<
2
)
return
false
;
if
(
Bot
.
HasInMonstersZone
(
CardId
.
HiitaP
))
return
false
;
AI
.
SelectMaterials
(
material_list
);
if
(
Bot
.
MonsterZone
[
0
]
==
null
&&
Bot
.
MonsterZone
[
2
]
==
null
&&
Bot
.
MonsterZone
[
5
]
==
null
)
AI
.
SelectPlace
(
Zones
.
z5
);
else
AI
.
SelectPlace
(
Zones
.
z6
);
return
true
;
}
private
bool
HiitaPeff
()
{
AI
.
SelectCard
(
CardId
.
Hiita
);
return
true
;
}
private
bool
LynaPsp
()
{
IList
<
ClientCard
>
material_list
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
monster
in
Bot
.
GetMonsters
())
{
if
(
monster
.
HasAttribute
(
CardAttribute
.
Light
)
&&
!
monster
.
IsCode
(
CardId
.
KnightmareCerberus
,
CardId
.
InspectBoarder
,
CardId
.
GrenMajuDaEizo
,
CardId
.
KnightmarePhoenix
,
CardId
.
LynaP
,
CardId
.
HiitaP
,
CardId
.
WynnP
,
CardId
.
EriaP
,
CardId
.
AussaP
,
CardId
.
KnightmareUnicorn
,
CardId
.
KnightmareGryphon
,
CardId
.
BorreloadDragon
,
CardId
.
BirrelswordDragon
))
material_list
.
Add
(
monster
);
if
(
material_list
.
Count
==
2
)
break
;
}
if
(
material_list
.
Count
<
2
)
return
false
;
if
(
Bot
.
HasInMonstersZone
(
CardId
.
LynaP
))
return
false
;
AI
.
SelectMaterials
(
material_list
);
if
(
Bot
.
MonsterZone
[
0
]
==
null
&&
Bot
.
MonsterZone
[
2
]
==
null
&&
Bot
.
MonsterZone
[
5
]
==
null
)
AI
.
SelectPlace
(
Zones
.
z5
);
else
AI
.
SelectPlace
(
Zones
.
z6
);
return
true
;
}
private
bool
LynaPeff
()
{
AI
.
SelectCard
(
CardId
.
Lyna
);
return
true
;
}
private
bool
Linkuribohsp
()
{
foreach
(
ClientCard
c
in
Bot
.
GetMonsters
())
{
if
(
c
.
Level
==
1
)
{
AI
.
SelectMaterials
(
c
);
return
true
;
}
}
return
false
;
}
private
bool
Knightmaresp
()
{
int
[]
firstMats
=
new
[]
{
CardId
.
KnightmareCerberus
,
CardId
.
KnightmarePhoenix
};
if
(
Bot
.
MonsterZone
.
GetMatchingCardsCount
(
card
=>
card
.
IsCode
(
firstMats
))
>=
1
)
return
false
;
foreach
(
ClientCard
c
in
Bot
.
GetMonsters
())
{
if
(
c
.
Level
==
1
)
{
AI
.
SelectMaterials
(
c
);
return
true
;
}
}
return
false
;
}
private
bool
Linkuriboheff
()
{
if
(
Duel
.
LastChainPlayer
==
0
&&
Util
.
GetLastChainCard
().
IsCode
(
CardId
.
Linkuriboh
))
return
false
;
return
true
;
}
private
bool
GagagaCowboySummon
()
{
if
(
Enemy
.
LifePoints
<=
800
||
(
Bot
.
GetMonsterCount
()
>=
4
&&
Enemy
.
LifePoints
<=
1600
))
{
AI
.
SelectPosition
(
CardPosition
.
FaceUpDefence
);
return
true
;
}
return
false
;
}
private
bool
SpellSet
()
{
if
(
Card
.
IsCode
(
CardId
.
MacroCosmos
)
&&
Bot
.
HasInSpellZone
(
CardId
.
MacroCosmos
))
return
false
;
if
(
Card
.
IsCode
(
CardId
.
Unpossessed
)
&&
Bot
.
HasInSpellZone
(
CardId
.
Unpossessed
))
return
false
;
if
(
Card
.
IsCode
(
CardId
.
Crackdown
)
&&
Bot
.
HasInSpellZone
(
CardId
.
Crackdown
))
return
false
;
if
(
Card
.
IsCode
(
CardId
.
SkillDrain
)
&&
Bot
.
HasInSpellZone
(
CardId
.
SkillDrain
))
return
false
;
if
(
Card
.
IsCode
(
CardId
.
Mistake
)
&&
Bot
.
HasInSpellZone
(
CardId
.
Mistake
))
return
false
;
if
(
Card
.
IsCode
(
CardId
.
Scapegoat
))
return
true
;
if
(
Card
.
HasType
(
CardType
.
Trap
))
return
Bot
.
GetSpellCountWithoutField
()
<
4
;
return
false
;
}
public
override
ClientCard
OnSelectAttacker
(
IList
<
ClientCard
>
attackers
,
IList
<
ClientCard
>
defenders
)
{
for
(
int
i
=
0
;
i
<
attackers
.
Count
;
++
i
)
{
ClientCard
attacker
=
attackers
[
i
];
if
(
attacker
.
IsCode
(
CardId
.
BirrelswordDragon
,
CardId
.
BorreloadDragon
))
return
attacker
;
}
return
null
;
}
public
override
bool
OnSelectHand
()
{
return
true
;
}
}
}
\ No newline at end of file
Game/AI/Decks/TimeThiefExecutor.cs
View file @
4fe200fc
using
System
;
using
YGOSharp.OCGWrapper
;
using
YGOSharp.OCGWrapper.Enums
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
WindBot
;
using
WindBot.Game
;
using
WindBot.Game.AI
;
using
System.Linq
;
using
System.Reflection
;
namespace
WindBot.Game.AI.Decks
{
...
...
@@ -22,25 +20,41 @@ namespace WindBot.Game.AI.Decks
public
const
int
TimeThiefRegulator
=
19891131
;
public
const
int
PhotonTrasher
=
65367484
;
public
const
int
PerformTrickClown
=
67696066
;
public
const
int
ThunderKingRaiOh
=
71564252
;
public
const
int
MaxxC
=
23434538
;
public
const
int
AshBlossomAndJoyousSpring
=
14558127
;
}
public
class
CardId
{
public
const
int
ImperialOrder
=
61740673
;
public
const
int
NaturalExterio
=
99916754
;
public
const
int
NaturalBeast
=
33198837
;
public
const
int
SwordsmanLV7
=
37267041
;
public
const
int
RoyalDecreel
=
51452091
;
}
public
class
Spells
{
// spells
public
const
int
UpstartGoblin
=
70368879
;
public
const
int
Raigeki
=
12580477
;
public
const
int
FoolishBurial
=
81439173
;
public
const
int
TimeThiefStartup
=
10877309
;
public
const
int
TimeThiefHack
=
81670445
;
public
const
int
HarpieFeatherDuster
=
18144506
;
public
const
int
PotOfDesires
=
35261759
;
public
const
int
PotofExtravagance
=
49238328
;
}
public
class
Traps
{
//traps
public
const
int
XyzReborn
=
26708437
;
public
const
int
XyzExtreme
=
57319935
;
public
const
int
SolemnWarning
=
84749824
;
public
const
int
SolemStrike
=
40605147
;
public
const
int
SolemnJudgment
=
41420027
;
public
const
int
TimeThiefRetrograte
=
76587747
;
public
const
int
PhantomKnightsShade
=
98827725
;
public
const
int
TimeThiefFlyBack
=
18678554
;
public
const
int
Crackdown
=
36975314
;
}
public
class
XYZs
{
...
...
@@ -48,6 +62,12 @@ namespace WindBot.Game.AI.Decks
public
const
int
TimeThiefRedoer
=
55285840
;
public
const
int
TimeThiefPerpetua
=
59208943
;
public
const
int
CrazyBox
=
42421606
;
public
const
int
GagagaCowboy
=
12014404
;
public
const
int
Number39Utopia
=
84013237
;
public
const
int
NumberS39UtopiatheLightning
=
56832966
;
public
const
int
NumberS39UtopiaOne
=
86532744
;
public
const
int
DarkRebellionXyzDragon
=
16195942
;
public
const
int
EvilswarmExcitonKnight
=
46772449
;
}
...
...
@@ -57,54 +77,117 @@ namespace WindBot.Game.AI.Decks
{
// executors
//Spell activate
AddExecutor
(
ExecutorType
.
Activate
,
Spells
.
UpstartGoblin
);
AddExecutor
(
ExecutorType
.
Activate
,
Spells
.
FoolishBurial
,
FoolishBurialTarget
);
AddExecutor
(
ExecutorType
.
Activate
,
Spells
.
TimeThiefStartup
,
TimeThiefStartupEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
Spells
.
TimeThiefHack
);
AddExecutor
(
ExecutorType
.
Activate
,
Spells
.
Raigeki
,
DefaultDarkHole
);
AddExecutor
(
ExecutorType
.
Activate
,
Spells
.
FoolishBurial
,
FoolishBurialTarget
);
AddExecutor
(
ExecutorType
.
Activate
,
Spells
.
TimeThiefStartup
,
TimeThiefStartupEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
Spells
.
TimeThiefHack
);
AddExecutor
(
ExecutorType
.
Activate
,
Spells
.
PotofExtravagance
,
PotofExtravaganceActivate
);
AddExecutor
(
ExecutorType
.
Activate
,
Spells
.
HarpieFeatherDuster
,
DefaultHarpiesFeatherDusterFirst
);
AddExecutor
(
ExecutorType
.
Activate
,
Spells
.
PotOfDesires
,
PotOfDesireseff
);
// trap executors set
AddExecutor
(
ExecutorType
.
SpellSet
,
Traps
.
XyzExtreme
);
AddExecutor
(
ExecutorType
.
SpellSet
,
Traps
.
XyzReborn
);
AddExecutor
(
ExecutorType
.
SpellSet
,
Traps
.
PhantomKnightsShade
);
AddExecutor
(
ExecutorType
.
SpellSet
,
Traps
.
TimeThiefRetrograte
);
AddExecutor
(
ExecutorType
.
SpellSet
,
Traps
.
TimeThiefFlyBack
);
AddExecutor
(
ExecutorType
.
SpellSet
,
Traps
.
PhantomKnightsShade
);
AddExecutor
(
ExecutorType
.
SpellSet
,
Traps
.
TimeThiefRetrograte
);
AddExecutor
(
ExecutorType
.
SpellSet
,
Traps
.
TimeThiefFlyBack
);
AddExecutor
(
ExecutorType
.
SpellSet
,
Traps
.
SolemnWarning
);
AddExecutor
(
ExecutorType
.
SpellSet
,
Traps
.
SolemStrike
);
AddExecutor
(
ExecutorType
.
SpellSet
,
Traps
.
SolemnJudgment
);
AddExecutor
(
ExecutorType
.
SpellSet
,
Traps
.
Crackdown
);
//normal summons
AddExecutor
(
ExecutorType
.
Summon
,
Monsters
.
TimeThiefRegulator
);
AddExecutor
(
ExecutorType
.
SpSummon
,
Monsters
.
PhotonTrasher
,
SummonToDef
);
AddExecutor
(
ExecutorType
.
Summon
,
Monsters
.
TimeThiefWinder
);
AddExecutor
(
ExecutorType
.
Summon
,
Monsters
.
TimeThiefBezelShip
);
AddExecutor
(
ExecutorType
.
Summon
,
Monsters
.
PerformTrickClown
);
AddExecutor
(
ExecutorType
.
Summon
,
Monsters
.
TimeThiefCronocorder
);
AddExecutor
(
ExecutorType
.
Summon
,
Monsters
.
TimeThiefRegulator
);
AddExecutor
(
ExecutorType
.
SpSummon
,
Monsters
.
PhotonTrasher
,
SummonToDef
);
AddExecutor
(
ExecutorType
.
Summon
,
Monsters
.
TimeThiefWinder
);
AddExecutor
(
ExecutorType
.
Summon
,
Monsters
.
TimeThiefBezelShip
);
AddExecutor
(
ExecutorType
.
Summon
,
Monsters
.
PerformTrickClown
);
AddExecutor
(
ExecutorType
.
Summon
,
Monsters
.
TimeThiefCronocorder
);
AddExecutor
(
ExecutorType
.
Summon
,
Monsters
.
ThunderKingRaiOh
,
ThunderKingRaiOhsummon
);
//xyz summons
AddExecutor
(
ExecutorType
.
SpSummon
,
XYZs
.
TimeThiefRedoer
);
AddExecutor
(
ExecutorType
.
SpSummon
,
XYZs
.
TimeThiefPerpetua
);
// activate trap
AddExecutor
(
ExecutorType
.
Activate
,
Traps
.
PhantomKnightsShade
);
AddExecutor
(
ExecutorType
.
Activate
,
Traps
.
XyzExtreme
,
XyzExtremeEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
Traps
.
XyzReborn
,
XyzRebornEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
Traps
.
TimeThiefRetrograte
,
RetrograteEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
Traps
.
TimeThiefFlyBack
);
AddExecutor
(
ExecutorType
.
SpSummon
,
XYZs
.
TimeThiefRedoer
);
AddExecutor
(
ExecutorType
.
SpSummon
,
XYZs
.
TimeThiefPerpetua
);
AddExecutor
(
ExecutorType
.
SpSummon
,
XYZs
.
EvilswarmExcitonKnight
,
DefaultEvilswarmExcitonKnightSummon
);
AddExecutor
(
ExecutorType
.
SpSummon
,
XYZs
.
GagagaCowboy
,
GagagaCowboySummon
);
AddExecutor
(
ExecutorType
.
SpSummon
,
XYZs
.
Number39Utopia
,
DefaultNumberS39UtopiaTheLightningSummon
);
AddExecutor
(
ExecutorType
.
SpSummon
,
XYZs
.
NumberS39UtopiaOne
);
AddExecutor
(
ExecutorType
.
SpSummon
,
XYZs
.
NumberS39UtopiatheLightning
);
AddExecutor
(
ExecutorType
.
SpSummon
,
XYZs
.
DarkRebellionXyzDragon
,
DarkRebellionXyzDragonSummon
);
//activate trap
AddExecutor
(
ExecutorType
.
Activate
,
Traps
.
PhantomKnightsShade
);
AddExecutor
(
ExecutorType
.
Activate
,
Traps
.
TimeThiefRetrograte
,
RetrograteEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
Traps
.
TimeThiefFlyBack
);
AddExecutor
(
ExecutorType
.
Activate
,
Traps
.
SolemnWarning
,
DefaultSolemnWarning
);
AddExecutor
(
ExecutorType
.
Activate
,
Traps
.
SolemStrike
,
DefaultSolemnStrike
);
AddExecutor
(
ExecutorType
.
Activate
,
Traps
.
SolemnJudgment
,
DefaultSolemnJudgment
);
AddExecutor
(
ExecutorType
.
Activate
,
Traps
.
Crackdown
,
Crackdowneff
);
//xyz effects
AddExecutor
(
ExecutorType
.
Activate
,
XYZs
.
TimeThiefRedoer
,
RedoerEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
XYZs
.
TimeThiefPerpetua
,
PerpertuaEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
XYZs
.
TimeThiefRedoer
,
RedoerEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
XYZs
.
TimeThiefPerpetua
,
PerpertuaEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
XYZs
.
EvilswarmExcitonKnight
,
DefaultEvilswarmExcitonKnightEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
XYZs
.
GagagaCowboy
);
AddExecutor
(
ExecutorType
.
Activate
,
XYZs
.
NumberS39UtopiatheLightning
,
DefaultNumberS39UtopiaTheLightningEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
XYZs
.
DarkRebellionXyzDragon
,
DarkRebellionXyzDragonEffect
);
//monster effects
AddExecutor
(
ExecutorType
.
Activate
,
Monsters
.
TimeThiefRegulator
,
RegulatorEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
Monsters
.
TimeThiefWinder
);
AddExecutor
(
ExecutorType
.
Activate
,
Monsters
.
TimeThiefCronocorder
);
AddExecutor
(
ExecutorType
.
Activate
,
Monsters
.
PerformTrickClown
,
TrickClownEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
Monsters
.
TimeThiefBezelShip
);
AddExecutor
(
ExecutorType
.
Activate
,
Monsters
.
TimeThiefRegulator
,
RegulatorEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
Monsters
.
TimeThiefWinder
);
AddExecutor
(
ExecutorType
.
Activate
,
Monsters
.
TimeThiefCronocorder
);
AddExecutor
(
ExecutorType
.
Activate
,
Monsters
.
PerformTrickClown
,
TrickClownEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
Monsters
.
TimeThiefBezelShip
);
AddExecutor
(
ExecutorType
.
Activate
,
Monsters
.
ThunderKingRaiOh
,
ThunderKingRaiOheff
);
AddExecutor
(
ExecutorType
.
Activate
,
Monsters
.
AshBlossomAndJoyousSpring
,
DefaultAshBlossomAndJoyousSpring
);
AddExecutor
(
ExecutorType
.
Activate
,
Monsters
.
MaxxC
,
DefaultMaxxC
);
}
public
void
SelectSTPlace
(
ClientCard
card
=
null
,
bool
avoid_Impermanence
=
false
,
List
<
int
>
avoid_list
=
null
)
{
List
<
int
>
list
=
new
List
<
int
>
{
0
,
1
,
2
,
3
,
4
};
int
n
=
list
.
Count
;
while
(
n
--
>
1
)
{
int
index
=
Program
.
Rand
.
Next
(
n
+
1
);
int
temp
=
list
[
index
];
list
[
index
]
=
list
[
n
];
list
[
n
]
=
temp
;
}
foreach
(
int
seq
in
list
)
{
int
zone
=
(
int
)
System
.
Math
.
Pow
(
2
,
seq
);
if
(
Bot
.
SpellZone
[
seq
]
==
null
)
{
if
(
card
!=
null
&&
card
.
Location
==
CardLocation
.
Hand
&&
avoid_Impermanence
)
continue
;
if
(
avoid_list
!=
null
&&
avoid_list
.
Contains
(
seq
))
continue
;
AI
.
SelectPlace
(
zone
);
return
;
};
}
AI
.
SelectPlace
(
0
);
}
public
bool
SpellNegatable
(
bool
isCounter
=
false
,
ClientCard
target
=
null
)
{
// target default set
if
(
target
==
null
)
target
=
Card
;
// won't negate if not on field
if
(
target
.
Location
!=
CardLocation
.
SpellZone
&&
target
.
Location
!=
CardLocation
.
Hand
)
return
false
;
// negate judge
if
(
Enemy
.
HasInMonstersZone
(
CardId
.
NaturalExterio
,
true
)
&&
!
isCounter
)
return
true
;
if
(
target
.
IsSpell
())
{
if
(
Enemy
.
HasInMonstersZone
(
CardId
.
NaturalBeast
,
true
))
return
true
;
if
(
Enemy
.
HasInSpellZone
(
CardId
.
ImperialOrder
,
true
)
||
Bot
.
HasInSpellZone
(
CardId
.
ImperialOrder
,
true
))
return
true
;
if
(
Enemy
.
HasInMonstersZone
(
CardId
.
SwordsmanLV7
,
true
)
||
Bot
.
HasInMonstersZone
(
CardId
.
SwordsmanLV7
,
true
))
return
true
;
}
if
(
target
.
IsTrap
())
{
if
(
Enemy
.
HasInSpellZone
(
CardId
.
RoyalDecreel
,
true
)
||
Bot
.
HasInSpellZone
(
CardId
.
RoyalDecreel
,
true
))
return
true
;
}
// how to get here?
return
false
;
}
private
bool
SummonToDef
()
{
AI
.
SelectPosition
(
CardPosition
.
Defence
);
return
true
;
}
private
bool
RegulatorEffect
()
{
if
(
Card
.
Location
==
CardLocation
.
MonsterZone
)
...
...
@@ -147,7 +230,7 @@ namespace WindBot.Game.AI.Decks
List
<
ClientCard
>
enemy
=
Enemy
.
GetMonstersInMainZone
();
List
<
int
>
units
=
Card
.
Overlays
;
if
(
Duel
.
Phase
==
DuelPhase
.
Standby
&&
(
AI
.
Executor
.
Util
.
GetStringId
(
XYZs
.
TimeThiefRedoer
,
0
)
==
if
(
Duel
.
Phase
==
DuelPhase
.
Standby
&&
(
AI
.
Executor
.
Util
.
GetStringId
(
XYZs
.
TimeThiefRedoer
,
0
)
==
ActivateDescription
))
{
...
...
@@ -156,16 +239,6 @@ namespace WindBot.Game.AI.Decks
try
{
if
(
Bot
.
HasInSpellZone
(
Traps
.
XyzReborn
))
{
return
false
;
}
if
(
Bot
.
HasInSpellZone
(
Traps
.
XyzExtreme
))
{
return
false
;
}
for
(
int
i
=
0
;
i
<
enemy
.
Count
;
i
++)
{
_totalAttack
+=
enemy
[
i
].
Attack
;
...
...
@@ -191,12 +264,12 @@ namespace WindBot.Game.AI.Decks
AI
.
SelectCard
(
t
.
Id
);
AI
.
SelectCard
(
t
.
Id
);
}
catch
{
}
catch
{
}
return
true
;
}
}
catch
{
}
catch
{
}
if
(
Bot
.
UnderAttack
)
{
...
...
@@ -207,33 +280,15 @@ namespace WindBot.Game.AI.Decks
return
false
;
}
private
bool
RetrograteEffect
()
{
if
(
Card
.
Owner
==
1
)
if
(
Card
.
Owner
==
1
)
{
return
true
;
}
return
false
;
}
private
bool
XyzRebornEffect
()
{
if
(
Bot
.
HasInGraveyard
(
XYZs
.
TimeThiefRedoer
))
{
AI
.
SelectCard
(
XYZs
.
TimeThiefRedoer
);
return
true
;
}
return
true
;
}
//function
private
bool
XyzExtremeEffect
()
{
AI
.
SelectCard
(
XYZs
.
CrazyBox
);
return
true
;
}
private
bool
TimeThiefStartupEffect
()
{
if
(
Card
.
Location
==
CardLocation
.
Hand
)
...
...
@@ -243,7 +298,7 @@ namespace WindBot.Game.AI.Decks
AI
.
SelectCard
(
Monsters
.
TimeThiefRegulator
);
return
true
;
}
if
(
Bot
.
HasInHand
(
Monsters
.
TimeThiefWinder
)
&&
Bot
.
GetMonsterCount
()>
1
)
if
(
Bot
.
HasInHand
(
Monsters
.
TimeThiefWinder
)
&&
Bot
.
GetMonsterCount
()
>
1
)
{
AI
.
SelectCard
(
Monsters
.
TimeThiefWinder
);
return
true
;
...
...
@@ -277,7 +332,74 @@ namespace WindBot.Game.AI.Decks
AI
.
SelectPosition
(
CardPosition
.
FaceUpDefence
);
return
true
;
}
private
bool
GagagaCowboySummon
()
{
if
(
Enemy
.
LifePoints
<=
800
||
(
Bot
.
GetMonsterCount
()
>=
4
&&
Enemy
.
LifePoints
<=
1600
))
{
AI
.
SelectPosition
(
CardPosition
.
FaceUpDefence
);
return
true
;
}
return
false
;
}
private
bool
DarkRebellionXyzDragonSummon
()
{
int
selfBestAttack
=
Util
.
GetBestAttack
(
Bot
);
int
oppoBestAttack
=
Util
.
GetBestAttack
(
Enemy
);
return
selfBestAttack
<=
oppoBestAttack
;
}
private
bool
DarkRebellionXyzDragonEffect
()
{
int
oppoBestAttack
=
Util
.
GetBestAttack
(
Enemy
);
ClientCard
target
=
Util
.
GetOneEnemyBetterThanValue
(
oppoBestAttack
,
true
);
if
(
target
!=
null
)
{
AI
.
SelectCard
(
0
);
AI
.
SelectNextCard
(
target
);
}
return
true
;
}
private
bool
ThunderKingRaiOhsummon
()
{
if
(
Bot
.
MonsterZone
[
0
]
==
null
)
AI
.
SelectPlace
(
Zones
.
z0
);
else
AI
.
SelectPlace
(
Zones
.
z4
);
return
true
;
}
private
bool
ThunderKingRaiOheff
()
{
if
(
Duel
.
SummoningCards
.
Count
>
0
)
{
foreach
(
ClientCard
m
in
Duel
.
SummoningCards
)
{
if
(
m
.
Attack
>=
1900
)
return
true
;
}
}
return
false
;
}
private
bool
Crackdowneff
()
{
if
(
Util
.
GetOneEnemyBetterThanMyBest
(
true
,
true
)
!=
null
&&
Bot
.
UnderAttack
)
AI
.
SelectCard
(
Util
.
GetOneEnemyBetterThanMyBest
(
true
,
true
));
return
Util
.
GetOneEnemyBetterThanMyBest
(
true
,
true
)
!=
null
&&
Bot
.
UnderAttack
;
}
private
bool
PotOfDesireseff
()
{
return
Bot
.
Deck
.
Count
>
14
&&
!
DefaultSpellWillBeNegated
();
}
// activate of PotofExtravagance
public
bool
PotofExtravaganceActivate
()
{
// won't activate if it'll be negate
if
(
SpellNegatable
())
return
false
;
SelectSTPlace
(
Card
,
true
);
AI
.
SelectOption
(
1
);
return
true
;
}
}
...
...
Game/GameClient.cs
View file @
4fe200fc
using
System.IO
;
using
System.Linq
;
using
System.Net
;
using
System.Text
;
using
YGOSharp.Network
;
...
...
@@ -46,7 +47,18 @@ namespace WindBot.Game
Connection
.
Connected
+=
OnConnected
;
Connection
.
PacketReceived
+=
OnPacketReceived
;
Connection
.
Connect
(
IPAddress
.
Parse
(
_serverHost
),
_serverPort
);
IPAddress
target_address
;
try
{
target_address
=
IPAddress
.
Parse
(
_serverHost
);
}
catch
(
System
.
Exception
)
{
IPHostEntry
_hostEntry
=
Dns
.
GetHostEntry
(
_serverHost
);
target_address
=
_hostEntry
.
AddressList
.
FirstOrDefault
(
findIPv4
=>
findIPv4
.
AddressFamily
==
System
.
Net
.
Sockets
.
AddressFamily
.
InterNetwork
);
}
Connection
.
Connect
(
target_address
,
_serverPort
);
}
private
void
OnConnected
()
...
...
WindBot.csproj
View file @
4fe200fc
...
...
@@ -70,6 +70,7 @@
<Compile
Include=
"Game\AI\DeckAttribute.cs"
/>
<Compile
Include=
"Game\AI\DecksManager.cs"
/>
<Compile
Include=
"Game\AI\Decks\AltergeistExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\FamiliarPossessedExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\BlackwingExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\MathMechExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\PureWindsExecutor.cs"
/>
...
...
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