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
xiaoye
windbot
Commits
f2d7219b
Commit
f2d7219b
authored
Mar 21, 2021
by
mercury233
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/IceYGO/windbot
parents
e6a8cac1
a927ee30
Changes
35
Show whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
2830 additions
and
2369 deletions
+2830
-2369
BotWrapper/bot.conf
BotWrapper/bot.conf
+14
-9
Dialogs/gugugu.zh-CN.json
Dialogs/gugugu.zh-CN.json
+59
-0
Game/AI/CardExtension.cs
Game/AI/CardExtension.cs
+3
-1
Game/AI/Decks/AltergeistExecutor.cs
Game/AI/Decks/AltergeistExecutor.cs
+1
-3
Game/AI/Decks/DoEveryThingExecutor.cs
Game/AI/Decks/DoEveryThingExecutor.cs
+1
-1
Game/AI/Decks/FamiliarPossessedExecutor.cs
Game/AI/Decks/FamiliarPossessedExecutor.cs
+557
-557
Game/AI/Decks/FrogExecutor.cs
Game/AI/Decks/FrogExecutor.cs
+1
-9
Game/AI/Decks/HorusExecutor.cs
Game/AI/Decks/HorusExecutor.cs
+2
-2
Game/AI/Decks/Level8Executor.cs
Game/AI/Decks/Level8Executor.cs
+1
-4
Game/AI/Decks/LightswornShaddoldinosourExecutor.cs
Game/AI/Decks/LightswornShaddoldinosourExecutor.cs
+1274
-1277
Game/AI/Decks/LuckyExecutor.cs
Game/AI/Decks/LuckyExecutor.cs
+242
-0
Game/AI/Decks/OldSchoolExecutor.cs
Game/AI/Decks/OldSchoolExecutor.cs
+2
-2
Game/AI/Decks/OrcustExecutor.cs
Game/AI/Decks/OrcustExecutor.cs
+19
-24
Game/AI/Decks/PhantasmExecutor.cs
Game/AI/Decks/PhantasmExecutor.cs
+0
-6
Game/AI/Decks/PureWindsExecutor.cs
Game/AI/Decks/PureWindsExecutor.cs
+1
-5
Game/AI/Decks/TimeThiefExecutor.cs
Game/AI/Decks/TimeThiefExecutor.cs
+334
-334
Game/AI/Decks/TrickstarExecutor.cs
Game/AI/Decks/TrickstarExecutor.cs
+0
-9
Game/AI/Decks/WitchcraftExecutor.cs
Game/AI/Decks/WitchcraftExecutor.cs
+6
-14
Game/AI/Decks/ZexalWeaponsExecutor.cs
Game/AI/Decks/ZexalWeaponsExecutor.cs
+2
-9
Game/AI/Decks/ZoodiacExecutor.cs
Game/AI/Decks/ZoodiacExecutor.cs
+1
-4
Game/AI/DefaultExecutor.cs
Game/AI/DefaultExecutor.cs
+108
-33
Game/AI/Dialogs.cs
Game/AI/Dialogs.cs
+1
-1
Game/AI/Enums/InvincibleMonster.cs
Game/AI/Enums/InvincibleMonster.cs
+28
-1
Game/AI/Executor.cs
Game/AI/Executor.cs
+20
-4
Game/AI/HintMsg.cs
Game/AI/HintMsg.cs
+62
-0
Game/ClientCard.cs
Game/ClientCard.cs
+1
-1
Game/Deck.cs
Game/Deck.cs
+1
-1
Game/Duel.cs
Game/Duel.cs
+3
-24
Game/GameAI.cs
Game/GameAI.cs
+46
-31
Game/GameBehavior.cs
Game/GameBehavior.cs
+8
-3
Game/GameClient.cs
Game/GameClient.cs
+2
-0
Program.cs
Program.cs
+21
-0
README.md
README.md
+5
-0
WindBot.csproj
WindBot.csproj
+2
-0
WindBotInfo.cs
WindBotInfo.cs
+2
-0
No files found.
BotWrapper/bot.conf
View file @
f2d7219b
...
@@ -2,27 +2,32 @@
...
@@ -2,27 +2,32 @@
# !name
# !name
# command
# command
# description
# description
# flags (avail flags: SUPPORT_MASTER_RULE_3, SUPPORT_NEW_MASTER_RULE, SUPPORT_MASTER_RULE_2020)
# flags (avail flags: SUPPORT_MASTER_RULE_3, SUPPORT_NEW_MASTER_RULE, SUPPORT_MASTER_RULE_2020
, SELECT_DECKFILE
)
!随机-非常简单
!随机-非常简单
Random
=
AI_LV1
Random
=
AI_LV1
主要是一些沙包。
主要是一些沙包。
SUPPORT_
NEW_MASTER_RULE
SUPPORT_
MASTER_RULE_2020
SUPPORT_MASTER_RULE_2020
!随机-简单
!随机-简单
Random
=
AI_LV2
Random
=
AI_LV2
一些比较弱的卡组。
一些比较弱的卡组。
SUPPORT_
NEW_MASTER_RULE
SUPPORT_
MASTER_RULE_2020
SUPPORT_MASTER_RULE_2020
!随机-普通
!随机-普通
Random
=
AI_LV3
Random
=
AI_LV3
一些环境里可以看到的卡组。
一些环境里可以看到的卡组。
SUPPORT_
NEW_MASTER_RULE
SUPPORT_
MASTER_RULE_2020
SUPPORT_MASTER_RULE_2020
!随机-报社
!随机-报社
Random
=
AI_ANTI_META
Random
=
AI_ANTI_META
一些报复社会(针对主流卡组的弱点)的卡组。
一些报复社会(针对主流卡组的弱点)的卡组。
SUPPORT_NEW_MASTER_RULE
SUPPORT_MASTER_RULE_2020
SUPPORT_MASTER_RULE_2020
!
P2
-自选卡组
Name
=
P2
Deck
=
Lucky
Dialog
=
gugugu
.
zh
-
CN
人机卡组由你选择。随缘出牌。可将你的卡组文件(.
ydk
)复制到
WindBot
的对应文件夹。
SELECT_DECKFILE
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
SUPPORT_MASTER_RULE_2020
!悠悠
!悠悠
Name
=悠悠
Deck
=
MokeyMokey
Dialog
=
mokey
.
zh
-
CN
Name
=悠悠
Deck
=
MokeyMokey
Dialog
=
mokey
.
zh
-
CN
...
@@ -47,17 +52,17 @@ AI_LV2 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020
...
@@ -47,17 +52,17 @@ AI_LV2 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020
!谜之剑士
LV4
-
R5
!谜之剑士
LV4
-
R5
Name
=谜之剑士
LV4
Deck
=
'Rank V'
Dialog
=
swordsman
.
zh
-
CN
Name
=谜之剑士
LV4
Deck
=
'Rank V'
Dialog
=
swordsman
.
zh
-
CN
5
阶超量卡组。
5
阶超量卡组。
AI_LV2
SUPPORT_MASTER_RULE_3
SUPPORT_
NEW_MASTER_RULE
SUPPORT_
MASTER_RULE_2020
AI_LV2
SUPPORT_MASTER_RULE_3
SUPPORT_MASTER_RULE_2020
!谜之剑士
LV4
-异热同心武器
!谜之剑士
LV4
-异热同心武器
Name
=谜之剑士
LV4
Deck
=
'Zexal Weapons'
Dialog
=
swordsman
.
zh
-
CN
Name
=谜之剑士
LV4
Deck
=
'Zexal Weapons'
Dialog
=
swordsman
.
zh
-
CN
神装电光皇卡组。
神装电光皇卡组。
AI_LV2
SUPPORT_MASTER_RULE_3
SUPPORT_
NEW_MASTER_RULE
SUPPORT_
MASTER_RULE_2020
AI_LV2
SUPPORT_MASTER_RULE_3
SUPPORT_MASTER_RULE_2020
!琪露诺-彩虹
!琪露诺-彩虹
Name
=琪露诺
Deck
=
Rainbow
Dialog
=
cirno
.
zh
-
CN
Name
=琪露诺
Deck
=
Rainbow
Dialog
=
cirno
.
zh
-
CN
全属性凡骨卡组。
全属性凡骨卡组。
AI_LV2
SUPPORT_MASTER_RULE_3
SUPPORT_
NEW_MASTER_RULE
SUPPORT_
MASTER_RULE_2020
AI_LV2
SUPPORT_MASTER_RULE_3
SUPPORT_MASTER_RULE_2020
!琪露诺-饼蛙
!琪露诺-饼蛙
Name
=琪露诺
Deck
=
'Toadally Awesome'
Dialog
=
cirno
.
zh
-
CN
Name
=琪露诺
Deck
=
'Toadally Awesome'
Dialog
=
cirno
.
zh
-
CN
...
@@ -67,7 +72,7 @@ SUPPORT_MASTER_RULE_3 SUPPORT_MASTER_RULE_2020
...
@@ -67,7 +72,7 @@ SUPPORT_MASTER_RULE_3 SUPPORT_MASTER_RULE_2020
!复制植物-青眼
!复制植物-青眼
Name
=复制植物
Deck
=
Blue
-
Eyes
Dialog
=
copy
.
zh
-
CN
Name
=复制植物
Deck
=
Blue
-
Eyes
Dialog
=
copy
.
zh
-
CN
青眼卡组。
青眼卡组。
AI_LV3
SUPPORT_MASTER_RULE_3
SUPPORT_
NEW_MASTER_RULE
SUPPORT_
MASTER_RULE_2020
AI_LV3
SUPPORT_MASTER_RULE_3
SUPPORT_MASTER_RULE_2020
!复制植物-十二兽
!复制植物-十二兽
Name
=复制植物
Deck
=
Zoodiac
Dialog
=
copy
.
zh
-
CN
Name
=复制植物
Deck
=
Zoodiac
Dialog
=
copy
.
zh
-
CN
...
...
Dialogs/gugugu.zh-CN.json
0 → 100644
View file @
f2d7219b
{
"welcome"
:
[
"大家好我是新人"
,
"游戏王是怎么玩来着?"
,
"还好我不玩游戏王"
],
"deckerror"
:
[
"卡组里{0}鸽了"
],
"duelstart"
:
[
"不想干活怎么办"
,
"智商欠费不想干活怎么办"
],
"newturn"
:
[
"好多可怕的新卡啊"
,
"这游戏好难玩"
,
"so lazy cant move"
],
"endturn"
:
[
"搞得我只能鸽了"
,
"不是在此时,不知在何时"
,
"too hot need ice cream"
],
"directattack"
:
[
"听起来很鸽"
,
"老鸽,稳"
],
"attack"
:
[
"听起来不是很鸽"
,
"可怕"
],
"ondirectattack"
:
[
"哇!"
,
"这么可怕的吗"
,
"听起来非常鸽"
,
"承受不住"
],
"facedownmonstername"
:
"鸽子"
,
"activate"
:
[
"不明觉鸽"
,
"鸽了,爽"
],
"summon"
:
[
"可怕"
,
"不关我事"
,
"那还是不关我事"
,
"鸽了,爽"
],
"setmonster"
:
[
"摸鱼中,不想更新"
,
"那还是鸽置吧"
],
"chaining"
:
[
"那是什么"
,
"但我鸽了"
,
"无此服务"
,
"可怕"
]
}
Game/AI/CardExtension.cs
View file @
f2d7219b
...
@@ -11,7 +11,9 @@ namespace WindBot.Game.AI
...
@@ -11,7 +11,9 @@ namespace WindBot.Game.AI
/// </summary>
/// </summary>
public
static
bool
IsMonsterInvincible
(
this
ClientCard
card
)
public
static
bool
IsMonsterInvincible
(
this
ClientCard
card
)
{
{
return
!
card
.
IsDisabled
()
&&
Enum
.
IsDefined
(
typeof
(
InvincibleMonster
),
card
.
Id
);
return
!
card
.
IsDisabled
()
&&
(
card
.
Controller
==
0
&&
Enum
.
IsDefined
(
typeof
(
InvincibleBotMonster
),
card
.
Id
)
||
card
.
Controller
==
1
&&
Enum
.
IsDefined
(
typeof
(
InvincibleEnemyMonster
),
card
.
Id
));
}
}
/// <summary>
/// <summary>
...
...
Game/AI/Decks/AltergeistExecutor.cs
View file @
f2d7219b
...
@@ -2742,8 +2742,6 @@ namespace WindBot.Game.AI.Decks
...
@@ -2742,8 +2742,6 @@ namespace WindBot.Game.AI.Decks
public
override
IList
<
ClientCard
>
OnSelectCard
(
IList
<
ClientCard
>
cards
,
int
min
,
int
max
,
int
hint
,
bool
cancelable
)
public
override
IList
<
ClientCard
>
OnSelectCard
(
IList
<
ClientCard
>
cards
,
int
min
,
int
max
,
int
hint
,
bool
cancelable
)
{
{
int
HIINT_TOGRAVE
=
504
;
if
(
max
==
1
&&
cards
[
0
].
Location
==
CardLocation
.
Deck
if
(
max
==
1
&&
cards
[
0
].
Location
==
CardLocation
.
Deck
&&
Util
.
GetLastChainCard
()
!=
null
&&
Util
.
GetLastChainCard
().
IsCode
(
23002292
)
&&
Bot
.
GetRemainingCount
(
CardId
.
WakingtheDragon
,
1
)
>
0
)
&&
Util
.
GetLastChainCard
()
!=
null
&&
Util
.
GetLastChainCard
().
IsCode
(
23002292
)
&&
Bot
.
GetRemainingCount
(
CardId
.
WakingtheDragon
,
1
)
>
0
)
{
{
...
@@ -2764,7 +2762,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -2764,7 +2762,7 @@ namespace WindBot.Game.AI.Decks
Logger
.
DebugWriteLine
(
"EvenlyMatched: min="
+
min
.
ToString
()
+
", max="
+
max
.
ToString
());
Logger
.
DebugWriteLine
(
"EvenlyMatched: min="
+
min
.
ToString
()
+
", max="
+
max
.
ToString
());
}
}
else
if
(
cards
[
0
].
Location
==
CardLocation
.
Hand
&&
cards
[
cards
.
Count
-
1
].
Location
==
CardLocation
.
Hand
else
if
(
cards
[
0
].
Location
==
CardLocation
.
Hand
&&
cards
[
cards
.
Count
-
1
].
Location
==
CardLocation
.
Hand
&&
(
hint
==
501
||
hint
==
HIINT_TOGRAVE
)
&&
min
==
max
)
&&
(
hint
==
HintMsg
.
Discard
||
hint
==
HintMsg
.
ToGrave
)
&&
min
==
max
)
{
{
if
(
Duel
.
LastChainPlayer
==
0
&&
Util
.
GetLastChainCard
().
IsCode
(
CardId
.
OneForOne
))
return
null
;
if
(
Duel
.
LastChainPlayer
==
0
&&
Util
.
GetLastChainCard
().
IsCode
(
CardId
.
OneForOne
))
return
null
;
Logger
.
DebugWriteLine
(
"Hand drop except OneForOne"
);
Logger
.
DebugWriteLine
(
"Hand drop except OneForOne"
);
...
...
Game/AI/Decks/DoEveryThingExecutor.cs
View file @
f2d7219b
...
@@ -20,7 +20,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -20,7 +20,7 @@ namespace WindBot.Game.AI.Decks
{
{
AddExecutor
(
ExecutorType
.
SpSummon
);
AddExecutor
(
ExecutorType
.
SpSummon
);
AddExecutor
(
ExecutorType
.
Activate
,
DefaultDontChainMyself
);
AddExecutor
(
ExecutorType
.
Activate
,
DefaultDontChainMyself
);
AddExecutor
(
ExecutorType
.
SummonOrSet
);
AddExecutor
(
ExecutorType
.
SummonOrSet
,
DefaultMonsterSummon
);
AddExecutor
(
ExecutorType
.
Repos
,
DefaultMonsterRepos
);
AddExecutor
(
ExecutorType
.
Repos
,
DefaultMonsterRepos
);
AddExecutor
(
ExecutorType
.
SpellSet
);
AddExecutor
(
ExecutorType
.
SpellSet
);
}
}
...
...
Game/AI/Decks/FamiliarPossessedExecutor.cs
View file @
f2d7219b
Game/AI/Decks/FrogExecutor.cs
View file @
f2d7219b
...
@@ -83,18 +83,10 @@ namespace WindBot.Game.AI.Decks
...
@@ -83,18 +83,10 @@ namespace WindBot.Game.AI.Decks
private
int
m_swapFrogSummoned
;
private
int
m_swapFrogSummoned
;
private
int
m_flipFlopFrogSummoned
;
private
int
m_flipFlopFrogSummoned
;
private
int
m_treebornFrogCount
=
0
;
public
override
void
OnNewTurn
()
{
m_treebornFrogCount
=
0
;
base
.
OnNewTurn
();
}
private
bool
TreebornFrog
()
private
bool
TreebornFrog
()
{
{
m_treebornFrogCount
++;
return
true
;
return
m_treebornFrogCount
<=
5
;
}
}
private
bool
SwapFrogSummon
()
private
bool
SwapFrogSummon
()
...
...
Game/AI/Decks/HorusExecutor.cs
View file @
f2d7219b
...
@@ -56,7 +56,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -56,7 +56,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
MonsterReborn
,
MonsterReborn
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
MonsterReborn
,
MonsterReborn
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
WhiteNightDragon
,
WhiteNightDragon
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
WhiteNightDragon
,
WhiteNightDragon
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
HorusTheBlackFlameDragonLv6
,
Default
Tribute
Summon
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
HorusTheBlackFlameDragonLv6
,
Default
Monster
Summon
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
AlexandriteDragon
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
AlexandriteDragon
);
AddExecutor
(
ExecutorType
.
SummonOrSet
,
CardId
.
AxeDragonute
);
AddExecutor
(
ExecutorType
.
SummonOrSet
,
CardId
.
AxeDragonute
);
AddExecutor
(
ExecutorType
.
SummonOrSet
,
CardId
.
DodgerDragon
);
AddExecutor
(
ExecutorType
.
SummonOrSet
,
CardId
.
DodgerDragon
);
...
@@ -157,7 +157,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -157,7 +157,7 @@ namespace WindBot.Game.AI.Decks
if
(
card
.
IsCode
(
11224103
))
if
(
card
.
IsCode
(
11224103
))
return
false
;
return
false
;
return
Default
Tribute
Summon
();
return
Default
Monster
Summon
();
}
}
private
bool
HorusTheBlackFlameDragonLv8
()
private
bool
HorusTheBlackFlameDragonLv8
()
...
...
Game/AI/Decks/Level8Executor.cs
View file @
f2d7219b
...
@@ -184,7 +184,6 @@ namespace WindBot.Game.AI.Decks
...
@@ -184,7 +184,6 @@ namespace WindBot.Game.AI.Decks
private
bool
JetSynchronUsed
=
false
;
private
bool
JetSynchronUsed
=
false
;
private
bool
ScrapWyvernUsed
=
false
;
private
bool
ScrapWyvernUsed
=
false
;
private
bool
MaskedChameleonUsed
=
false
;
private
bool
MaskedChameleonUsed
=
false
;
private
int
ShootingRiserDragonCount
=
0
;
private
int
[]
HandCosts
=
new
[]
private
int
[]
HandCosts
=
new
[]
{
{
...
@@ -218,7 +217,6 @@ namespace WindBot.Game.AI.Decks
...
@@ -218,7 +217,6 @@ namespace WindBot.Game.AI.Decks
JetSynchronUsed
=
false
;
JetSynchronUsed
=
false
;
ScrapWyvernUsed
=
false
;
ScrapWyvernUsed
=
false
;
MaskedChameleonUsed
=
false
;
MaskedChameleonUsed
=
false
;
ShootingRiserDragonCount
=
0
;
}
}
public
override
void
OnChainEnd
()
public
override
void
OnChainEnd
()
...
@@ -845,9 +843,8 @@ namespace WindBot.Game.AI.Decks
...
@@ -845,9 +843,8 @@ namespace WindBot.Game.AI.Decks
}
}
else
else
{
{
if
(
Duel
.
LastChainPlayer
==
0
||
ShootingRiserDragonCount
>=
10
)
if
(
Duel
.
LastChainPlayer
==
0
)
return
false
;
return
false
;
ShootingRiserDragonCount
++;
AI
.
SelectCard
(
new
[]
{
AI
.
SelectCard
(
new
[]
{
CardId
.
BlackRoseMoonlightDragon
,
CardId
.
BlackRoseMoonlightDragon
,
CardId
.
ScrapDragon
,
CardId
.
ScrapDragon
,
...
...
Game/AI/Decks/LightswornShaddoldinosourExecutor.cs
View file @
f2d7219b
...
@@ -230,7 +230,6 @@ namespace WindBot.Game.AI.Decks
...
@@ -230,7 +230,6 @@ namespace WindBot.Game.AI.Decks
}
}
int
Ultimate_ss
=
0
;
int
Ultimate_ss
=
0
;
int
Enemy_atk
=
0
;
int
Enemy_atk
=
0
;
int
TG_WonderMagician_count
=
0
;
bool
Pillused
=
false
;
bool
Pillused
=
false
;
bool
CrystronNeedlefibereff_used
=
false
;
bool
CrystronNeedlefibereff_used
=
false
;
bool
OvertexCoatlseff_used
=
false
;
bool
OvertexCoatlseff_used
=
false
;
...
@@ -275,7 +274,6 @@ namespace WindBot.Game.AI.Decks
...
@@ -275,7 +274,6 @@ namespace WindBot.Game.AI.Decks
ShaddollSquamata_used
=
false
;
ShaddollSquamata_used
=
false
;
ShaddollDragon_used
=
false
;
ShaddollDragon_used
=
false
;
ShaddollHedgehog_used
=
false
;
ShaddollHedgehog_used
=
false
;
TG_WonderMagician_count
=
0
;
}
}
private
bool
Luminasummon
()
private
bool
Luminasummon
()
...
@@ -576,8 +574,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -576,8 +574,7 @@ namespace WindBot.Game.AI.Decks
private
bool
TG_WonderMagicianeff
()
private
bool
TG_WonderMagicianeff
()
{
{
TG_WonderMagician_count
++;
return
true
;
return
TG_WonderMagician_count
<=
10
;
}
}
private
bool
AllureofDarkness
()
private
bool
AllureofDarkness
()
{
{
...
...
Game/AI/Decks/LuckyExecutor.cs
0 → 100644
View file @
f2d7219b
using
YGOSharp.OCGWrapper.Enums
;
using
System.Collections.Generic
;
using
System.Linq
;
using
WindBot
;
using
WindBot.Game
;
using
WindBot.Game.AI
;
namespace
WindBot.Game.AI.Decks
{
[
Deck
(
"Lucky"
,
"AI_Test"
,
"Test"
)]
public
class
LuckyExecutor
:
DefaultExecutor
{
public
LuckyExecutor
(
GameAI
ai
,
Duel
duel
)
:
base
(
ai
,
duel
)
{
AddExecutor
(
ExecutorType
.
Activate
,
ImFeelingLucky
);
AddExecutor
(
ExecutorType
.
SpSummon
,
ImFeelingLucky
);
AddExecutor
(
ExecutorType
.
SpSummon
,
ImFeelingUnlucky
);
AddExecutor
(
ExecutorType
.
Activate
,
ImFeelingUnlucky
);
AddExecutor
(
ExecutorType
.
SummonOrSet
,
ImFeelingLazy
);
AddExecutor
(
ExecutorType
.
SpellSet
,
DefaultSpellSet
);
AddExecutor
(
ExecutorType
.
Repos
,
DefaultMonsterRepos
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
MysticalSpaceTyphoon
,
DefaultMysticalSpaceTyphoon
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
CosmicCyclone
,
DefaultCosmicCyclone
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
GalaxyCyclone
,
DefaultGalaxyCyclone
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
BookOfMoon
,
DefaultBookOfMoon
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
CompulsoryEvacuationDevice
,
DefaultCompulsoryEvacuationDevice
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
CallOfTheHaunted
,
DefaultCallOfTheHaunted
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
Scapegoat
,
DefaultScapegoat
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
MaxxC
,
DefaultMaxxC
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
AshBlossom
,
DefaultAshBlossomAndJoyousSpring
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
GhostOgreAndSnowRabbit
,
DefaultGhostOgreAndSnowRabbit
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
GhostBelle
,
DefaultGhostBelleAndHauntedMansion
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
EffectVeiler
,
DefaultEffectVeiler
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
CalledByTheGrave
,
DefaultCalledByTheGrave
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
InfiniteImpermanence
,
DefaultInfiniteImpermanence
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
BreakthroughSkill
,
DefaultBreakthroughSkill
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
SolemnJudgment
,
DefaultSolemnJudgment
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
SolemnWarning
,
DefaultSolemnWarning
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
SolemnStrike
,
DefaultSolemnStrike
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
TorrentialTribute
,
DefaultTorrentialTribute
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
HeavyStorm
,
DefaultHeavyStorm
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
HarpiesFeatherDuster
,
DefaultHarpiesFeatherDusterFirst
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
HammerShot
,
DefaultHammerShot
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
DarkHole
,
DefaultDarkHole
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
Raigeki
,
DefaultRaigeki
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
SmashingGround
,
DefaultSmashingGround
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
PotOfDesires
,
DefaultPotOfDesires
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
AllureofDarkness
,
DefaultAllureofDarkness
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
DimensionalBarrier
,
DefaultDimensionalBarrier
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
InterruptedKaijuSlumber
,
DefaultInterruptedKaijuSlumber
);
AddExecutor
(
ExecutorType
.
SpSummon
,
_CardId
.
JizukirutheStarDestroyingKaiju
,
DefaultKaijuSpsummon
);
AddExecutor
(
ExecutorType
.
SpSummon
,
_CardId
.
GadarlatheMysteryDustKaiju
,
DefaultKaijuSpsummon
);
AddExecutor
(
ExecutorType
.
SpSummon
,
_CardId
.
GamecieltheSeaTurtleKaiju
,
DefaultKaijuSpsummon
);
AddExecutor
(
ExecutorType
.
SpSummon
,
_CardId
.
RadiantheMultidimensionalKaiju
,
DefaultKaijuSpsummon
);
AddExecutor
(
ExecutorType
.
SpSummon
,
_CardId
.
KumongoustheStickyStringKaiju
,
DefaultKaijuSpsummon
);
AddExecutor
(
ExecutorType
.
SpSummon
,
_CardId
.
ThunderKingtheLightningstrikeKaiju
,
DefaultKaijuSpsummon
);
AddExecutor
(
ExecutorType
.
SpSummon
,
_CardId
.
DogorantheMadFlameKaiju
,
DefaultKaijuSpsummon
);
AddExecutor
(
ExecutorType
.
SpSummon
,
_CardId
.
SuperAntiKaijuWarMachineMechaDogoran
,
DefaultKaijuSpsummon
);
AddExecutor
(
ExecutorType
.
SpSummon
,
_CardId
.
EvilswarmExcitonKnight
,
DefaultEvilswarmExcitonKnightSummon
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
EvilswarmExcitonKnight
,
DefaultEvilswarmExcitonKnightEffect
);
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
SandaionTheTimelord
,
DefaultTimelordSummon
);
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
GabrionTheTimelord
,
DefaultTimelordSummon
);
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
MichionTheTimelord
,
DefaultTimelordSummon
);
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
ZaphionTheTimelord
,
DefaultTimelordSummon
);
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
HailonTheTimelord
,
DefaultTimelordSummon
);
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
RaphionTheTimelord
,
DefaultTimelordSummon
);
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
SadionTheTimelord
,
DefaultTimelordSummon
);
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
MetaionTheTimelord
,
DefaultTimelordSummon
);
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
KamionTheTimelord
,
DefaultTimelordSummon
);
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
LazionTheTimelord
,
DefaultTimelordSummon
);
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
LeftArmofTheForbiddenOne
,
JustDontIt
);
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
RightLegofTheForbiddenOne
,
JustDontIt
);
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
LeftLegofTheForbiddenOne
,
JustDontIt
);
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
RightArmofTheForbiddenOne
,
JustDontIt
);
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
ExodiaTheForbiddenOne
,
JustDontIt
);
}
private
List
<
int
>
HintMsgForEnemy
=
new
List
<
int
>
{
HintMsg
.
Release
,
HintMsg
.
Destroy
,
HintMsg
.
Remove
,
HintMsg
.
ToGrave
,
HintMsg
.
ReturnToHand
,
HintMsg
.
ToDeck
,
HintMsg
.
FusionMaterial
,
HintMsg
.
SynchroMaterial
,
HintMsg
.
XyzMaterial
,
HintMsg
.
LinkMaterial
,
HintMsg
.
Disable
};
private
List
<
int
>
HintMsgForDeck
=
new
List
<
int
>
{
HintMsg
.
SpSummon
,
HintMsg
.
ToGrave
,
HintMsg
.
Remove
,
HintMsg
.
AddToHand
,
HintMsg
.
FusionMaterial
};
private
List
<
int
>
HintMsgForSelf
=
new
List
<
int
>
{
HintMsg
.
Equip
};
private
List
<
int
>
HintMsgForMaterial
=
new
List
<
int
>
{
HintMsg
.
FusionMaterial
,
HintMsg
.
SynchroMaterial
,
HintMsg
.
XyzMaterial
,
HintMsg
.
LinkMaterial
,
HintMsg
.
Release
};
private
List
<
int
>
HintMsgForMaxSelect
=
new
List
<
int
>
{
HintMsg
.
SpSummon
,
HintMsg
.
ToGrave
,
HintMsg
.
AddToHand
,
HintMsg
.
FusionMaterial
,
HintMsg
.
Destroy
};
public
override
IList
<
ClientCard
>
OnSelectCard
(
IList
<
ClientCard
>
_cards
,
int
min
,
int
max
,
int
hint
,
bool
cancelable
)
{
if
(
Duel
.
Phase
==
DuelPhase
.
BattleStart
)
return
null
;
if
(
AI
.
HaveSelectedCards
())
return
null
;
IList
<
ClientCard
>
selected
=
new
List
<
ClientCard
>();
IList
<
ClientCard
>
cards
=
new
List
<
ClientCard
>(
_cards
);
if
(
max
>
cards
.
Count
)
max
=
cards
.
Count
;
if
(
HintMsgForEnemy
.
Contains
(
hint
))
{
IList
<
ClientCard
>
enemyCards
=
cards
.
Where
(
card
=>
card
.
Controller
==
1
).
ToList
();
// select enemy's card first
while
(
enemyCards
.
Count
>
0
&&
selected
.
Count
<
max
)
{
ClientCard
card
=
enemyCards
[
Program
.
Rand
.
Next
(
enemyCards
.
Count
)];
selected
.
Add
(
card
);
enemyCards
.
Remove
(
card
);
cards
.
Remove
(
card
);
}
}
if
(
HintMsgForDeck
.
Contains
(
hint
))
{
IList
<
ClientCard
>
deckCards
=
cards
.
Where
(
card
=>
card
.
Location
==
CardLocation
.
Deck
).
ToList
();
// select deck's card first
while
(
deckCards
.
Count
>
0
&&
selected
.
Count
<
max
)
{
ClientCard
card
=
deckCards
[
Program
.
Rand
.
Next
(
deckCards
.
Count
)];
selected
.
Add
(
card
);
deckCards
.
Remove
(
card
);
cards
.
Remove
(
card
);
}
}
if
(
HintMsgForSelf
.
Contains
(
hint
))
{
IList
<
ClientCard
>
botCards
=
cards
.
Where
(
card
=>
card
.
Controller
==
0
).
ToList
();
// select bot's card first
while
(
botCards
.
Count
>
0
&&
selected
.
Count
<
max
)
{
ClientCard
card
=
botCards
[
Program
.
Rand
.
Next
(
botCards
.
Count
)];
selected
.
Add
(
card
);
botCards
.
Remove
(
card
);
cards
.
Remove
(
card
);
}
}
if
(
HintMsgForMaterial
.
Contains
(
hint
))
{
IList
<
ClientCard
>
materials
=
cards
.
OrderBy
(
card
=>
card
.
Attack
).
ToList
();
// select low attack first
while
(
materials
.
Count
>
0
&&
selected
.
Count
<
min
)
{
ClientCard
card
=
materials
[
0
];
selected
.
Add
(
card
);
materials
.
Remove
(
card
);
cards
.
Remove
(
card
);
}
}
// select random cards
while
(
selected
.
Count
<
min
)
{
ClientCard
card
=
cards
[
Program
.
Rand
.
Next
(
cards
.
Count
)];
selected
.
Add
(
card
);
cards
.
Remove
(
card
);
}
if
(
HintMsgForMaxSelect
.
Contains
(
hint
))
{
// select max cards
while
(
selected
.
Count
<
max
)
{
ClientCard
card
=
cards
[
Program
.
Rand
.
Next
(
cards
.
Count
)];
selected
.
Add
(
card
);
cards
.
Remove
(
card
);
}
}
return
selected
;
}
public
override
int
OnSelectOption
(
IList
<
int
>
options
)
{
return
Program
.
Rand
.
Next
(
options
.
Count
);
}
public
override
CardPosition
OnSelectPosition
(
int
cardId
,
IList
<
CardPosition
>
positions
)
{
YGOSharp
.
OCGWrapper
.
NamedCard
cardData
=
YGOSharp
.
OCGWrapper
.
NamedCard
.
Get
(
cardId
);
if
(
cardData
!=
null
)
{
if
(
cardData
.
Attack
<
0
)
return
CardPosition
.
FaceUpAttack
;
if
(
cardData
.
Attack
<=
1000
)
return
CardPosition
.
FaceUpDefence
;
}
return
0
;
}
private
bool
ImFeelingLucky
()
{
return
Program
.
Rand
.
Next
(
10
)
>=
5
&&
DefaultDontChainMyself
();
}
private
bool
ImFeelingUnlucky
()
{
return
DefaultDontChainMyself
();
}
private
bool
ImFeelingLazy
()
{
if
(
Executors
.
Any
(
exec
=>
(
exec
.
Type
==
ExecutorType
.
SummonOrSet
||
exec
.
Type
==
ExecutorType
.
Summon
||
exec
.
Type
==
ExecutorType
.
MonsterSet
)
&&
exec
.
CardId
==
Card
.
Id
))
return
false
;
return
DefaultMonsterSummon
();
}
private
bool
JustDontIt
()
{
return
false
;
}
}
}
\ No newline at end of file
Game/AI/Decks/OldSchoolExecutor.cs
View file @
f2d7219b
...
@@ -46,8 +46,8 @@ namespace WindBot.Game.AI.Decks
...
@@ -46,8 +46,8 @@ namespace WindBot.Game.AI.Decks
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
SwordsOfRevealingLight
,
SwordsOfRevealingLight
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
SwordsOfRevealingLight
,
SwordsOfRevealingLight
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
DoubleSummon
,
DoubleSummon
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
DoubleSummon
,
DoubleSummon
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
AncientGearGolem
,
Default
Tribute
Summon
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
AncientGearGolem
,
Default
Monster
Summon
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
Frostosaurus
,
Default
Tribute
Summon
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
Frostosaurus
,
Default
Monster
Summon
);
AddExecutor
(
ExecutorType
.
SummonOrSet
,
CardId
.
AlexandriteDragon
);
AddExecutor
(
ExecutorType
.
SummonOrSet
,
CardId
.
AlexandriteDragon
);
AddExecutor
(
ExecutorType
.
SummonOrSet
,
CardId
.
GeneWarpedWarwolf
);
AddExecutor
(
ExecutorType
.
SummonOrSet
,
CardId
.
GeneWarpedWarwolf
);
AddExecutor
(
ExecutorType
.
MonsterSet
,
CardId
.
GearGolemTheMovingFortress
);
AddExecutor
(
ExecutorType
.
MonsterSet
,
CardId
.
GearGolemTheMovingFortress
);
...
...
Game/AI/Decks/OrcustExecutor.cs
View file @
f2d7219b
...
@@ -181,7 +181,6 @@ namespace WindBot.Game.AI.Decks
...
@@ -181,7 +181,6 @@ namespace WindBot.Game.AI.Decks
private
bool
CymbalSkeletonUsed
=
false
;
private
bool
CymbalSkeletonUsed
=
false
;
private
bool
BorrelswordDragonUsed
=
false
;
private
bool
BorrelswordDragonUsed
=
false
;
private
ClientCard
RustyBardicheTarget
=
null
;
private
ClientCard
RustyBardicheTarget
=
null
;
private
int
ShootingRiserDragonCount
=
0
;
private
int
[]
HandCosts
=
new
[]
private
int
[]
HandCosts
=
new
[]
{
{
...
@@ -215,7 +214,6 @@ namespace WindBot.Game.AI.Decks
...
@@ -215,7 +214,6 @@ namespace WindBot.Game.AI.Decks
CymbalSkeletonUsed
=
false
;
CymbalSkeletonUsed
=
false
;
BorrelswordDragonUsed
=
false
;
BorrelswordDragonUsed
=
false
;
RustyBardicheTarget
=
null
;
RustyBardicheTarget
=
null
;
ShootingRiserDragonCount
=
0
;
}
}
public
override
void
OnChainEnd
()
public
override
void
OnChainEnd
()
...
@@ -611,10 +609,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -611,10 +609,7 @@ namespace WindBot.Game.AI.Decks
}
}
else
else
{
{
if
(
Duel
.
LastChainPlayer
==
0
)
return
Duel
.
LastChainPlayer
!=
0
;
return
false
;
ShootingRiserDragonCount
++;
return
ShootingRiserDragonCount
<=
10
;
}
}
}
}
...
...
Game/AI/Decks/PhantasmExecutor.cs
View file @
f2d7219b
...
@@ -117,13 +117,11 @@ namespace WindBot.Game.AI.Decks
...
@@ -117,13 +117,11 @@ namespace WindBot.Game.AI.Decks
bool
summon_used
=
false
;
bool
summon_used
=
false
;
bool
CardOfDemiseeff_used
=
false
;
bool
CardOfDemiseeff_used
=
false
;
bool
SeaStealthAttackeff_used
=
false
;
bool
SeaStealthAttackeff_used
=
false
;
int
City_count
=
0
;
public
override
void
OnNewTurn
()
public
override
void
OnNewTurn
()
{
{
summon_used
=
false
;
summon_used
=
false
;
CardOfDemiseeff_used
=
false
;
CardOfDemiseeff_used
=
false
;
SeaStealthAttackeff_used
=
false
;
SeaStealthAttackeff_used
=
false
;
City_count
=
0
;
base
.
OnNewTurn
();
base
.
OnNewTurn
();
}
}
private
bool
PreventFeatherDustereff
()
private
bool
PreventFeatherDustereff
()
...
@@ -356,9 +354,6 @@ namespace WindBot.Game.AI.Decks
...
@@ -356,9 +354,6 @@ namespace WindBot.Game.AI.Decks
}
}
else
else
{
{
if
(
City_count
>
10
)
return
false
;
ClientCard
target
=
null
;
ClientCard
target
=
null
;
foreach
(
ClientCard
s
in
Bot
.
GetSpells
())
foreach
(
ClientCard
s
in
Bot
.
GetSpells
())
{
{
...
@@ -380,7 +375,6 @@ namespace WindBot.Game.AI.Decks
...
@@ -380,7 +375,6 @@ namespace WindBot.Game.AI.Decks
break
;
break
;
}
}
}
}
City_count
++;
AI
.
SelectPlace
(
Zones
.
z1
|
Zones
.
z3
);
AI
.
SelectPlace
(
Zones
.
z1
|
Zones
.
z3
);
AI
.
SelectCard
(
CardId
.
PhantasmSprialBattle
);
AI
.
SelectCard
(
CardId
.
PhantasmSprialBattle
);
return
true
;
return
true
;
...
...
Game/AI/Decks/PureWindsExecutor.cs
View file @
f2d7219b
...
@@ -215,8 +215,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -215,8 +215,7 @@ namespace WindBot.Game.AI.Decks
private
bool
Summon_used
;
private
bool
Summon_used
;
private
bool
Pilica_eff
;
private
bool
Pilica_eff
;
private
bool
plan_A
;
private
bool
plan_A
;
private
int
SnowBell_count
=
0
;
//TODO: reset the flags when they should reset ( public override void OnNewTurn() )
public
PureWindsExecutor
(
GameAI
ai
,
Duel
duel
)
public
PureWindsExecutor
(
GameAI
ai
,
Duel
duel
)
:
base
(
ai
,
duel
)
:
base
(
ai
,
duel
)
{
{
...
@@ -302,7 +301,6 @@ namespace WindBot.Game.AI.Decks
...
@@ -302,7 +301,6 @@ namespace WindBot.Game.AI.Decks
Summon_used
=
false
;
Summon_used
=
false
;
Pilica_eff
=
false
;
Pilica_eff
=
false
;
plan_A
=
false
;
plan_A
=
false
;
SnowBell_count
=
0
;
base
.
OnNewTurn
();
base
.
OnNewTurn
();
}
}
private
bool
windaset
()
private
bool
windaset
()
...
@@ -770,7 +768,6 @@ namespace WindBot.Game.AI.Decks
...
@@ -770,7 +768,6 @@ namespace WindBot.Game.AI.Decks
private
bool
WindwitchSnowBellsp
()
private
bool
WindwitchSnowBellsp
()
{
{
if
(
SnowBell_count
>=
5
)
return
false
;
if
((
Bot
.
HasInMonstersZone
(
CardId
.
CrystalWingSynchroDragon
)
||
if
((
Bot
.
HasInMonstersZone
(
CardId
.
CrystalWingSynchroDragon
)
||
Bot
.
HasInMonstersZone
(
CardId
.
DaigustoSphreez
)
||
Bot
.
HasInMonstersZone
(
CardId
.
DaigustoSphreez
)
||
Bot
.
HasInMonstersZone
(
CardId
.
MistWurm
))
&&
Bot
.
HasInMonstersZone
(
CardId
.
MistWurm
))
&&
...
@@ -786,7 +783,6 @@ namespace WindBot.Game.AI.Decks
...
@@ -786,7 +783,6 @@ namespace WindBot.Game.AI.Decks
(
Util
.
GetBotAvailZonesFromExtraDeck
()
==
0
))
(
Util
.
GetBotAvailZonesFromExtraDeck
()
==
0
))
return
false
;
return
false
;
AI
.
SelectPosition
(
CardPosition
.
FaceUpDefence
);
AI
.
SelectPosition
(
CardPosition
.
FaceUpDefence
);
SnowBell_count
++;
return
true
;
return
true
;
}
}
private
bool
DaigustoSphreezsp
()
private
bool
DaigustoSphreezsp
()
...
...
Game/AI/Decks/TimeThiefExecutor.cs
View file @
f2d7219b
Game/AI/Decks/TrickstarExecutor.cs
View file @
f2d7219b
...
@@ -73,7 +73,6 @@ namespace WindBot.Game.AI.Decks
...
@@ -73,7 +73,6 @@ namespace WindBot.Game.AI.Decks
bool
snake_four_s
=
false
;
bool
snake_four_s
=
false
;
bool
tuner_eff_used
=
false
;
bool
tuner_eff_used
=
false
;
bool
crystal_eff_used
=
false
;
bool
crystal_eff_used
=
false
;
int
red_ss_count
=
0
;
bool
white_eff_used
=
false
;
bool
white_eff_used
=
false
;
bool
lockbird_useful
=
false
;
bool
lockbird_useful
=
false
;
bool
lockbird_used
=
false
;
bool
lockbird_used
=
false
;
...
@@ -758,7 +757,6 @@ namespace WindBot.Game.AI.Decks
...
@@ -758,7 +757,6 @@ namespace WindBot.Game.AI.Decks
public
bool
Red_ss
()
public
bool
Red_ss
()
{
{
if
(
red_ss_count
>=
6
)
return
false
;
if
((
Util
.
ChainContainsCard
(
CardId
.
DarkHole
)
||
Util
.
ChainContainsCard
(
99330325
)
||
Util
.
ChainContainsCard
(
53582587
))
&&
Util
.
ChainContainsCard
(
CardId
.
Red
))
return
false
;
if
((
Util
.
ChainContainsCard
(
CardId
.
DarkHole
)
||
Util
.
ChainContainsCard
(
99330325
)
||
Util
.
ChainContainsCard
(
53582587
))
&&
Util
.
ChainContainsCard
(
CardId
.
Red
))
return
false
;
if
(
Duel
.
LastChainPlayer
==
0
&&
Util
.
GetLastChainCard
().
IsCode
(
CardId
.
Red
))
if
(
Duel
.
LastChainPlayer
==
0
&&
Util
.
GetLastChainCard
().
IsCode
(
CardId
.
Red
))
{
{
...
@@ -766,7 +764,6 @@ namespace WindBot.Game.AI.Decks
...
@@ -766,7 +764,6 @@ namespace WindBot.Game.AI.Decks
{
{
if
(
Util
.
IsChainTarget
(
m
)
&&
IsTrickstar
(
m
.
Id
))
if
(
Util
.
IsChainTarget
(
m
)
&&
IsTrickstar
(
m
.
Id
))
{
{
red_ss_count
+=
1
;
AI
.
SelectCard
(
m
);
AI
.
SelectCard
(
m
);
Red_SelectPos
();
Red_SelectPos
();
return
true
;
return
true
;
...
@@ -789,7 +786,6 @@ namespace WindBot.Game.AI.Decks
...
@@ -789,7 +786,6 @@ namespace WindBot.Game.AI.Decks
{
{
AI
.
SelectCard
(
c
);
AI
.
SelectCard
(
c
);
Red_SelectPos
(
c
);
Red_SelectPos
(
c
);
red_ss_count
+=
1
;
return
true
;
return
true
;
}
}
if
(
c
.
IsCode
(
CardId
.
Pink
))
return
false
;
if
(
c
.
IsCode
(
CardId
.
Pink
))
return
false
;
...
@@ -800,14 +796,12 @@ namespace WindBot.Game.AI.Decks
...
@@ -800,14 +796,12 @@ namespace WindBot.Game.AI.Decks
if
(
tosolve_enemy
.
Attack
>
3200
)
AI
.
SelectPosition
(
CardPosition
.
FaceUpDefence
);
if
(
tosolve_enemy
.
Attack
>
3200
)
AI
.
SelectPosition
(
CardPosition
.
FaceUpDefence
);
AI
.
SelectCard
(
c
);
AI
.
SelectCard
(
c
);
Red_SelectPos
(
c
);
Red_SelectPos
(
c
);
red_ss_count
+=
1
;
return
true
;
return
true
;
}
}
if
(!
Bot
.
HasInHand
(
CardId
.
White
)
&&
tosolve_enemy
.
Attack
<=
3200
&&
c
.
IsCode
(
CardId
.
White
))
if
(!
Bot
.
HasInHand
(
CardId
.
White
)
&&
tosolve_enemy
.
Attack
<=
3200
&&
c
.
IsCode
(
CardId
.
White
))
{
{
AI
.
SelectCard
(
c
);
AI
.
SelectCard
(
c
);
Red_SelectPos
(
c
);
Red_SelectPos
(
c
);
red_ss_count
+=
1
;
return
true
;
return
true
;
}
}
if
(!
Bot
.
HasInHand
(
CardId
.
White
)
&&
c
.
Attack
<
tosolve_enemy
.
Attack
)
if
(!
Bot
.
HasInHand
(
CardId
.
White
)
&&
c
.
Attack
<
tosolve_enemy
.
Attack
)
...
@@ -824,7 +818,6 @@ namespace WindBot.Game.AI.Decks
...
@@ -824,7 +818,6 @@ namespace WindBot.Game.AI.Decks
if
(
tosolve_enemy
.
Attack
>
1600
)
AI
.
SelectPosition
(
CardPosition
.
FaceUpDefence
);
if
(
tosolve_enemy
.
Attack
>
1600
)
AI
.
SelectPosition
(
CardPosition
.
FaceUpDefence
);
AI
.
SelectCard
(
c
);
AI
.
SelectCard
(
c
);
Red_SelectPos
(
c
);
Red_SelectPos
(
c
);
red_ss_count
+=
1
;
return
true
;
return
true
;
}
}
}
}
...
@@ -845,7 +838,6 @@ namespace WindBot.Game.AI.Decks
...
@@ -845,7 +838,6 @@ namespace WindBot.Game.AI.Decks
{
{
AI
.
SelectCard
(
card
);
AI
.
SelectCard
(
card
);
Red_SelectPos
(
card
);
Red_SelectPos
(
card
);
red_ss_count
+=
1
;
return
true
;
return
true
;
}
}
}
}
...
@@ -1710,7 +1702,6 @@ namespace WindBot.Game.AI.Decks
...
@@ -1710,7 +1702,6 @@ namespace WindBot.Game.AI.Decks
pink_ss
=
false
;
pink_ss
=
false
;
snake_four_s
=
false
;
snake_four_s
=
false
;
crystal_eff_used
=
false
;
crystal_eff_used
=
false
;
red_ss_count
=
0
;
white_eff_used
=
false
;
white_eff_used
=
false
;
lockbird_useful
=
false
;
lockbird_useful
=
false
;
lockbird_used
=
false
;
lockbird_used
=
false
;
...
...
Game/AI/Decks/WitchcraftExecutor.cs
View file @
f2d7219b
...
@@ -197,7 +197,6 @@ namespace WindBot.Game.AI.Decks
...
@@ -197,7 +197,6 @@ namespace WindBot.Game.AI.Decks
bool
MagicianRightHand_used
=
false
;
bool
MagicianRightHand_used
=
false
;
ClientCard
MagiciansLeftHand_negate
=
null
;
ClientCard
MagiciansLeftHand_negate
=
null
;
ClientCard
MagicianRightHand_negate
=
null
;
ClientCard
MagicianRightHand_negate
=
null
;
int
PSYOmega_count
=
0
;
// go first
// go first
public
override
bool
OnSelectHand
()
public
override
bool
OnSelectHand
()
...
@@ -271,7 +270,6 @@ namespace WindBot.Game.AI.Decks
...
@@ -271,7 +270,6 @@ namespace WindBot.Game.AI.Decks
public
override
void
OnNewTurn
()
public
override
void
OnNewTurn
()
{
{
CrossoutDesignatorTarget
=
0
;
CrossoutDesignatorTarget
=
0
;
PSYOmega_count
=
0
;
MadameVerreGainedATK
=
false
;
MadameVerreGainedATK
=
false
;
summoned
=
false
;
summoned
=
false
;
enemy_activate_MaxxC
=
false
;
enemy_activate_MaxxC
=
false
;
...
@@ -311,8 +309,8 @@ namespace WindBot.Game.AI.Decks
...
@@ -311,8 +309,8 @@ namespace WindBot.Game.AI.Decks
// overwrite OnSelectCard to act normally in SelectUnselect
// overwrite OnSelectCard to act normally in SelectUnselect
public
override
IList
<
ClientCard
>
OnSelectCard
(
IList
<
ClientCard
>
cards
,
int
min
,
int
max
,
int
hint
,
bool
cancelable
)
public
override
IList
<
ClientCard
>
OnSelectCard
(
IList
<
ClientCard
>
cards
,
int
min
,
int
max
,
int
hint
,
bool
cancelable
)
{
{
// Patronus
HINTMSG_ATOHAND
// Patronus
if
(
hint
==
506
)
if
(
hint
==
HintMsg
.
AddToHand
)
{
{
bool
flag
=
true
;
bool
flag
=
true
;
foreach
(
ClientCard
card
in
cards
)
foreach
(
ClientCard
card
in
cards
)
...
@@ -336,8 +334,8 @@ namespace WindBot.Game.AI.Decks
...
@@ -336,8 +334,8 @@ namespace WindBot.Game.AI.Decks
return
selected
;
return
selected
;
}
}
}
}
// MaxxC
HINTMSG_SPSUMMON
// MaxxC
solution
if
(
hint
==
509
&&
enemy_activate_MaxxC
)
if
(
hint
==
HintMsg
.
SpSummon
&&
enemy_activate_MaxxC
)
{
{
// check whether SS from deck while using effect
// check whether SS from deck while using effect
bool
flag
=
true
;
bool
flag
=
true
;
...
@@ -394,8 +392,8 @@ namespace WindBot.Game.AI.Decks
...
@@ -394,8 +392,8 @@ namespace WindBot.Game.AI.Decks
}
}
}
}
}
}
// MadameVerre
HINTMSG_CONFIRM
// MadameVerre
if
(
hint
==
526
)
if
(
hint
==
HintMsg
.
Confirm
)
{
{
Logger
.
DebugWriteLine
(
"** min-max: "
+
min
.
ToString
()
+
" / "
+
max
.
ToString
());
Logger
.
DebugWriteLine
(
"** min-max: "
+
min
.
ToString
()
+
" / "
+
max
.
ToString
());
foreach
(
ClientCard
card
in
cards
)
foreach
(
ClientCard
card
in
cards
)
...
@@ -2501,20 +2499,15 @@ namespace WindBot.Game.AI.Decks
...
@@ -2501,20 +2499,15 @@ namespace WindBot.Game.AI.Decks
// recycle from grave
// recycle from grave
if
(
Card
.
Location
==
CardLocation
.
Grave
)
if
(
Card
.
Location
==
CardLocation
.
Grave
)
{
{
if
(
PSYOmega_count
>=
5
){
return
false
;
}
List
<
ClientCard
>
enemy_danger
=
CheckDangerousCardinEnemyGrave
();
List
<
ClientCard
>
enemy_danger
=
CheckDangerousCardinEnemyGrave
();
if
(
enemy_danger
.
Count
>
0
)
if
(
enemy_danger
.
Count
>
0
)
{
{
AI
.
SelectCard
(
enemy_danger
);
AI
.
SelectCard
(
enemy_danger
);
PSYOmega_count
++;
return
true
;
return
true
;
}
}
if
(!
Bot
.
HasInHandOrInSpellZoneOrInGraveyard
(
CardId
.
Holiday
)
&&
Bot
.
HasInGraveyard
(
important_witchcraft
))
if
(!
Bot
.
HasInHandOrInSpellZoneOrInGraveyard
(
CardId
.
Holiday
)
&&
Bot
.
HasInGraveyard
(
important_witchcraft
))
{
{
AI
.
SelectCard
(
important_witchcraft
);
AI
.
SelectCard
(
important_witchcraft
);
PSYOmega_count
++;
return
true
;
return
true
;
}
}
if
(
CheckProblematicCards
()
==
null
)
if
(
CheckProblematicCards
()
==
null
)
...
@@ -2523,7 +2516,6 @@ namespace WindBot.Game.AI.Decks
...
@@ -2523,7 +2516,6 @@ namespace WindBot.Game.AI.Decks
CardId
.
MaxxC
,
CardId
.
AshBlossom_JoyousSpring
,
CardId
.
MaxxC
,
CardId
.
AshBlossom_JoyousSpring
,
CardId
.
MagicianRightHand
,
CardId
.
MagiciansLeftHand
,
CardId
.
MagiciansRestage
,
CardId
.
Patronus
,
CardId
.
MagicianRightHand
,
CardId
.
MagiciansLeftHand
,
CardId
.
MagiciansRestage
,
CardId
.
Patronus
,
CardId
.
LightningStorm
,
CardId
.
Reasoning
);
CardId
.
LightningStorm
,
CardId
.
Reasoning
);
PSYOmega_count
++;
return
true
;
return
true
;
}
}
}
}
...
...
Game/AI/Decks/ZexalWeaponsExecutor.cs
View file @
f2d7219b
...
@@ -100,6 +100,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -100,6 +100,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
Goblindbergh
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
Goblindbergh
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
TinGoldfish
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
TinGoldfish
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
SummonerMonk
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
SummonerMonk
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
Honest
);
// Summons: Effects
// Summons: Effects
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Goblindbergh
,
GoblindberghEffect
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
Goblindbergh
,
GoblindberghEffect
);
...
@@ -122,13 +123,6 @@ namespace WindBot.Game.AI.Decks
...
@@ -122,13 +123,6 @@ namespace WindBot.Game.AI.Decks
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
SolemnStrike
,
DefaultSolemnStrike
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
SolemnStrike
,
DefaultSolemnStrike
);
}
}
private
int
ZwCount
=
0
;
public
override
void
OnNewTurn
()
{
ZwCount
=
0
;
}
public
override
bool
OnSelectHand
()
public
override
bool
OnSelectHand
()
{
{
return
false
;
return
false
;
...
@@ -177,8 +171,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -177,8 +171,7 @@ namespace WindBot.Game.AI.Decks
private
bool
ZwWeapon
()
private
bool
ZwWeapon
()
{
{
ZwCount
++;
return
true
;
return
ZwCount
<
10
;
}
}
private
bool
ReinforcementOfTheArmy
()
private
bool
ReinforcementOfTheArmy
()
...
...
Game/AI/Decks/ZoodiacExecutor.cs
View file @
f2d7219b
...
@@ -47,7 +47,6 @@ namespace WindBot.Game.AI.Decks
...
@@ -47,7 +47,6 @@ namespace WindBot.Game.AI.Decks
bool
TigermortarSpsummoned
=
false
;
bool
TigermortarSpsummoned
=
false
;
bool
ChakanineSpsummoned
=
false
;
bool
ChakanineSpsummoned
=
false
;
bool
BroadbullSpsummoned
=
false
;
bool
BroadbullSpsummoned
=
false
;
int
WhiptailEffectCount
=
0
;
public
ZoodiacExecutor
(
GameAI
ai
,
Duel
duel
)
public
ZoodiacExecutor
(
GameAI
ai
,
Duel
duel
)
:
base
(
ai
,
duel
)
:
base
(
ai
,
duel
)
...
@@ -128,7 +127,6 @@ namespace WindBot.Game.AI.Decks
...
@@ -128,7 +127,6 @@ namespace WindBot.Game.AI.Decks
TigermortarSpsummoned
=
false
;
TigermortarSpsummoned
=
false
;
ChakanineSpsummoned
=
false
;
ChakanineSpsummoned
=
false
;
BroadbullSpsummoned
=
false
;
BroadbullSpsummoned
=
false
;
WhiptailEffectCount
=
0
;
}
}
public
override
bool
OnPreBattleBetween
(
ClientCard
attacker
,
ClientCard
defender
)
public
override
bool
OnPreBattleBetween
(
ClientCard
attacker
,
ClientCard
defender
)
...
@@ -431,7 +429,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -431,7 +429,7 @@ namespace WindBot.Game.AI.Decks
{
{
if
(
Duel
.
Phase
==
DuelPhase
.
Main1
||
Duel
.
Phase
==
DuelPhase
.
Main2
)
if
(
Duel
.
Phase
==
DuelPhase
.
Main1
||
Duel
.
Phase
==
DuelPhase
.
Main2
)
return
false
;
return
false
;
if
(
Card
.
IsDisabled
()
||
WhiptailEffectCount
>=
3
)
if
(
Card
.
IsDisabled
())
return
false
;
return
false
;
ClientCard
target
=
null
;
ClientCard
target
=
null
;
List
<
ClientCard
>
monsters
=
Bot
.
GetMonsters
();
List
<
ClientCard
>
monsters
=
Bot
.
GetMonsters
();
...
@@ -461,7 +459,6 @@ namespace WindBot.Game.AI.Decks
...
@@ -461,7 +459,6 @@ namespace WindBot.Game.AI.Decks
CardId
.
Drident
CardId
.
Drident
});
});
}
}
WhiptailEffectCount
++;
return
true
;
return
true
;
}
}
...
...
Game/AI/DefaultExecutor.cs
View file @
f2d7219b
...
@@ -21,6 +21,23 @@ namespace WindBot.Game.AI
...
@@ -21,6 +21,23 @@ namespace WindBot.Game.AI
public
const
int
GamecieltheSeaTurtleKaiju
=
55063751
;
public
const
int
GamecieltheSeaTurtleKaiju
=
55063751
;
public
const
int
SuperAntiKaijuWarMachineMechaDogoran
=
84769941
;
public
const
int
SuperAntiKaijuWarMachineMechaDogoran
=
84769941
;
public
const
int
SandaionTheTimelord
=
33015627
;
public
const
int
GabrionTheTimelord
=
6616912
;
public
const
int
MichionTheTimelord
=
7733560
;
public
const
int
ZaphionTheTimelord
=
28929131
;
public
const
int
HailonTheTimelord
=
34137269
;
public
const
int
RaphionTheTimelord
=
60222213
;
public
const
int
SadionTheTimelord
=
65314286
;
public
const
int
MetaionTheTimelord
=
74530899
;
public
const
int
KamionTheTimelord
=
91712985
;
public
const
int
LazionTheTimelord
=
92435533
;
public
const
int
LeftArmofTheForbiddenOne
=
7902349
;
public
const
int
RightLegofTheForbiddenOne
=
8124921
;
public
const
int
LeftLegofTheForbiddenOne
=
44519536
;
public
const
int
RightArmofTheForbiddenOne
=
70903634
;
public
const
int
ExodiaTheForbiddenOne
=
33396948
;
public
const
int
UltimateConductorTytanno
=
18940556
;
public
const
int
UltimateConductorTytanno
=
18940556
;
public
const
int
ElShaddollConstruct
=
20366274
;
public
const
int
ElShaddollConstruct
=
20366274
;
public
const
int
AllyOfJusticeCatastor
=
26593852
;
public
const
int
AllyOfJusticeCatastor
=
26593852
;
...
@@ -36,8 +53,27 @@ namespace WindBot.Game.AI
...
@@ -36,8 +53,27 @@ namespace WindBot.Game.AI
public
const
int
DarkMagicAttack
=
2314238
;
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
GalaxyCyclone
=
5133471
;
public
const
int
BookOfMoon
=
14087893
;
public
const
int
CompulsoryEvacuationDevice
=
94192409
;
public
const
int
CallOfTheHaunted
=
97077563
;
public
const
int
Scapegoat
=
73915051
;
public
const
int
BreakthroughSkill
=
78474168
;
public
const
int
SolemnJudgment
=
41420027
;
public
const
int
SolemnWarning
=
84749824
;
public
const
int
SolemnStrike
=
40605147
;
public
const
int
TorrentialTribute
=
53582587
;
public
const
int
HeavyStorm
=
19613556
;
public
const
int
HammerShot
=
26412047
;
public
const
int
DarkHole
=
53129443
;
public
const
int
Raigeki
=
12580477
;
public
const
int
SmashingGround
=
97169186
;
public
const
int
PotOfDesires
=
35261759
;
public
const
int
AllureofDarkness
=
1475311
;
public
const
int
DimensionalBarrier
=
83326048
;
public
const
int
InterruptedKaijuSlumber
=
99330325
;
public
const
int
ChickenGame
=
67616300
;
public
const
int
SantaClaws
=
46565218
;
public
const
int
SantaClaws
=
46565218
;
public
const
int
CastelTheSkyblasterMusketeer
=
82633039
;
public
const
int
CastelTheSkyblasterMusketeer
=
82633039
;
...
@@ -61,7 +97,7 @@ namespace WindBot.Game.AI
...
@@ -61,7 +97,7 @@ namespace WindBot.Game.AI
public
const
int
LockBird
=
94145021
;
public
const
int
LockBird
=
94145021
;
public
const
int
GhostOgreAndSnowRabbit
=
59438930
;
public
const
int
GhostOgreAndSnowRabbit
=
59438930
;
public
const
int
GhostBelle
=
73642296
;
public
const
int
GhostBelle
=
73642296
;
public
const
int
EffectVeiler
=
63845230
;
public
const
int
EffectVeiler
=
97268402
;
public
const
int
ArtifactLancea
=
34267821
;
public
const
int
ArtifactLancea
=
34267821
;
public
const
int
CalledByTheGrave
=
24224830
;
public
const
int
CalledByTheGrave
=
24224830
;
...
@@ -80,12 +116,11 @@ namespace WindBot.Game.AI
...
@@ -80,12 +116,11 @@ namespace WindBot.Game.AI
public
const
int
RedDragonArchfiend
=
70902743
;
public
const
int
RedDragonArchfiend
=
70902743
;
public
const
int
ImperialOrder
=
61740673
;
public
const
int
ImperialOrder
=
61740673
;
public
const
int
RoyalDecreel
=
51452091
;
public
const
int
NaturiaBeast
=
33198837
;
public
const
int
NaturiaBeast
=
33198837
;
public
const
int
AntiSpellFragrance
=
58921041
;
public
const
int
AntiSpellFragrance
=
58921041
;
}
}
int
HonestEffectCount
=
0
;
protected
DefaultExecutor
(
GameAI
ai
,
Duel
duel
)
protected
DefaultExecutor
(
GameAI
ai
,
Duel
duel
)
:
base
(
ai
,
duel
)
:
base
(
ai
,
duel
)
{
{
...
@@ -127,9 +162,6 @@ namespace WindBot.Game.AI
...
@@ -127,9 +162,6 @@ namespace WindBot.Game.AI
/// <returns>false if the attack shouldn't be done.</returns>
/// <returns>false if the attack shouldn't be done.</returns>
public
override
bool
OnPreBattleBetween
(
ClientCard
attacker
,
ClientCard
defender
)
public
override
bool
OnPreBattleBetween
(
ClientCard
attacker
,
ClientCard
defender
)
{
{
if
(
attacker
.
RealPower
<=
0
)
return
false
;
if
(!
attacker
.
IsMonsterHasPreventActivationEffectInBattle
())
if
(!
attacker
.
IsMonsterHasPreventActivationEffectInBattle
())
{
{
if
(
defender
.
IsMonsterInvincible
()
&&
defender
.
IsDefense
())
if
(
defender
.
IsMonsterInvincible
()
&&
defender
.
IsDefense
())
...
@@ -180,6 +212,12 @@ namespace WindBot.Game.AI
...
@@ -180,6 +212,12 @@ namespace WindBot.Game.AI
if
(
attacker
.
IsCode
(
_CardId
.
NumberS39UtopiaTheLightning
)
&&
!
attacker
.
IsDisabled
()
&&
attacker
.
HasXyzMaterial
(
2
,
_CardId
.
Number39Utopia
))
if
(
attacker
.
IsCode
(
_CardId
.
NumberS39UtopiaTheLightning
)
&&
!
attacker
.
IsDisabled
()
&&
attacker
.
HasXyzMaterial
(
2
,
_CardId
.
Number39Utopia
))
attacker
.
RealPower
=
5000
;
attacker
.
RealPower
=
5000
;
if
(
attacker
.
IsCode
(
_CardId
.
EaterOfMillions
)
&&
!
attacker
.
IsDisabled
())
attacker
.
RealPower
=
9999
;
if
(
attacker
.
IsMonsterInvincible
())
attacker
.
RealPower
=
9999
;
foreach
(
ClientCard
equip
in
attacker
.
EquipCards
)
foreach
(
ClientCard
equip
in
attacker
.
EquipCards
)
{
{
if
(
equip
.
IsCode
(
_CardId
.
MoonMirrorShield
)
&&
!
equip
.
IsDisabled
())
if
(
equip
.
IsCode
(
_CardId
.
MoonMirrorShield
)
&&
!
equip
.
IsDisabled
())
...
@@ -210,6 +248,29 @@ namespace WindBot.Game.AI
...
@@ -210,6 +248,29 @@ namespace WindBot.Game.AI
return
true
;
return
true
;
}
}
public
override
bool
OnPreActivate
(
ClientCard
card
)
{
ClientCard
LastChainCard
=
Util
.
GetLastChainCard
();
if
(
LastChainCard
!=
null
&&
Duel
.
Phase
==
DuelPhase
.
Standby
&&
LastChainCard
.
IsCode
(
_CardId
.
SandaionTheTimelord
,
_CardId
.
GabrionTheTimelord
,
_CardId
.
MichionTheTimelord
,
_CardId
.
ZaphionTheTimelord
,
_CardId
.
HailonTheTimelord
,
_CardId
.
RaphionTheTimelord
,
_CardId
.
SadionTheTimelord
,
_CardId
.
MetaionTheTimelord
,
_CardId
.
KamionTheTimelord
,
_CardId
.
LazionTheTimelord
))
return
false
;
if
((
card
.
Location
==
CardLocation
.
Hand
||
card
.
Location
==
CardLocation
.
SpellZone
&&
card
.
IsFacedown
())
&&
(
card
.
IsSpell
()
&&
DefaultSpellWillBeNegated
()
||
card
.
IsTrap
()
&&
DefaultTrapWillBeNegated
()))
return
false
;
return
true
;
}
/// <summary>
/// <summary>
/// Called when the AI has to select a card position.
/// Called when the AI has to select a card position.
/// </summary>
/// </summary>
...
@@ -242,9 +303,12 @@ namespace WindBot.Game.AI
...
@@ -242,9 +303,12 @@ namespace WindBot.Game.AI
return
false
;
return
false
;
}
}
public
override
void
OnNewTurn
()
/// <summary>
/// Set when this card can't beat the enemies
/// </summary>
public
override
bool
OnSelectMonsterSummonOrSet
(
ClientCard
card
)
{
{
HonestEffectCount
=
0
;
return
card
.
Level
<=
4
&&
Bot
.
GetMonsters
().
Count
(
m
=>
m
.
IsFaceup
())
==
0
&&
Util
.
IsAllEnemyBetterThanValue
(
card
.
Attack
,
true
)
;
}
}
/// <summary>
/// <summary>
...
@@ -622,14 +686,17 @@ namespace WindBot.Game.AI
...
@@ -622,14 +686,17 @@ namespace WindBot.Game.AI
/// </summary>
/// </summary>
protected
bool
DefaultSpellSet
()
protected
bool
DefaultSpellSet
()
{
{
return
(
Card
.
IsTrap
()
||
Card
.
HasType
(
CardType
.
QuickPlay
))
&&
Bot
.
GetSpellCountWithoutField
()
<
4
;
return
(
Card
.
IsTrap
()
||
Card
.
HasType
(
CardType
.
QuickPlay
)
||
DefaultSpellMustSetFirst
()
)
&&
Bot
.
GetSpellCountWithoutField
()
<
4
;
}
}
/// <summary>
/// <summary>
/// Summon with tributes ATK lower.
/// Summon with
no tribute, or with
tributes ATK lower.
/// </summary>
/// </summary>
protected
bool
Default
Tribute
Summon
()
protected
bool
Default
Monster
Summon
()
{
{
if
(
Card
.
Level
<=
4
)
return
true
;
if
(!
UniqueFaceupMonster
())
if
(!
UniqueFaceupMonster
())
return
false
;
return
false
;
int
tributecount
=
(
int
)
Math
.
Ceiling
((
Card
.
Level
-
4.0d
)
/
2.0d
);
int
tributecount
=
(
int
)
Math
.
Ceiling
((
Card
.
Level
-
4.0d
)
/
2.0d
);
...
@@ -656,8 +723,13 @@ namespace WindBot.Game.AI
...
@@ -656,8 +723,13 @@ namespace WindBot.Game.AI
/// </summary>
/// </summary>
protected
bool
DefaultMonsterRepos
()
protected
bool
DefaultMonsterRepos
()
{
{
if
(
Card
.
IsFaceup
()
&&
Card
.
IsDefense
()
&&
Card
.
Attack
==
0
)
if
(
Card
.
Attack
==
0
)
{
if
(
Card
.
IsFaceup
()
&&
Card
.
IsAttack
())
return
true
;
if
(
Card
.
IsFaceup
()
&&
Card
.
IsDefense
())
return
false
;
return
false
;
}
if
(
Enemy
.
HasInMonstersZone
(
_CardId
.
BlueEyesChaosMAXDragon
,
true
)
&&
if
(
Enemy
.
HasInMonstersZone
(
_CardId
.
BlueEyesChaosMAXDragon
,
true
)
&&
Card
.
IsAttack
()
&&
(
4000
-
Card
.
Defense
)
*
2
>
(
4000
-
Card
.
Attack
))
Card
.
IsAttack
()
&&
(
4000
-
Card
.
Defense
)
*
2
>
(
4000
-
Card
.
Attack
))
...
@@ -667,10 +739,10 @@ namespace WindBot.Game.AI
...
@@ -667,10 +739,10 @@ namespace WindBot.Game.AI
(
4000
-
Card
.
Defense
)
*
2
>
(
4000
-
Card
.
Attack
))
(
4000
-
Card
.
Defense
)
*
2
>
(
4000
-
Card
.
Attack
))
return
true
;
return
true
;
bool
enemyBetter
=
Util
.
IsAllEnemyBetter
(
true
);
bool
enemyBetter
=
Util
.
IsAllEnemyBetter
();
if
(
Card
.
IsAttack
()
&&
enemyBetter
)
if
(
Card
.
IsAttack
()
&&
enemyBetter
)
return
true
;
return
true
;
if
(
Card
.
IsDefense
()
&&
!
enemyBetter
&&
Card
.
Attack
>=
Card
.
Defense
)
if
(
Card
.
IsDefense
()
&&
!
enemyBetter
&&
(
Card
.
Attack
>=
Card
.
Defense
||
Card
.
Attack
>=
Util
.
GetBestPower
(
Enemy
))
)
return
true
;
return
true
;
return
false
;
return
false
;
...
@@ -681,7 +753,15 @@ namespace WindBot.Game.AI
...
@@ -681,7 +753,15 @@ namespace WindBot.Game.AI
/// </summary>
/// </summary>
protected
bool
DefaultSpellWillBeNegated
()
protected
bool
DefaultSpellWillBeNegated
()
{
{
return
Bot
.
HasInSpellZone
(
_CardId
.
ImperialOrder
,
true
,
true
)
||
Enemy
.
HasInSpellZone
(
_CardId
.
ImperialOrder
,
true
)
||
Enemy
.
HasInMonstersZone
(
_CardId
.
NaturiaBeast
,
true
);
return
(
Bot
.
HasInSpellZone
(
_CardId
.
ImperialOrder
,
true
,
true
)
||
Enemy
.
HasInSpellZone
(
_CardId
.
ImperialOrder
,
true
))
&&
!
Util
.
ChainContainsCard
(
_CardId
.
ImperialOrder
);
}
/// <summary>
/// If trap will be negated
/// </summary>
protected
bool
DefaultTrapWillBeNegated
()
{
return
(
Bot
.
HasInSpellZone
(
_CardId
.
RoyalDecreel
,
true
,
true
)
||
Enemy
.
HasInSpellZone
(
_CardId
.
RoyalDecreel
,
true
))
&&
!
Util
.
ChainContainsCard
(
_CardId
.
RoyalDecreel
);
}
}
/// <summary>
/// <summary>
...
@@ -689,14 +769,6 @@ namespace WindBot.Game.AI
...
@@ -689,14 +769,6 @@ namespace WindBot.Game.AI
/// </summary>
/// </summary>
protected
bool
DefaultSpellMustSetFirst
()
protected
bool
DefaultSpellMustSetFirst
()
{
{
ClientCard
card
=
null
;
foreach
(
ClientCard
check
in
Bot
.
GetSpells
())
{
if
(
check
.
IsCode
(
_CardId
.
AntiSpellFragrance
)
&&
!
check
.
IsDisabled
())
card
=
check
;
}
if
(
card
!=
null
&&
card
.
IsFaceup
())
return
true
;
return
Bot
.
HasInSpellZone
(
_CardId
.
AntiSpellFragrance
,
true
,
true
)
||
Enemy
.
HasInSpellZone
(
_CardId
.
AntiSpellFragrance
,
true
);
return
Bot
.
HasInSpellZone
(
_CardId
.
AntiSpellFragrance
,
true
,
true
)
||
Enemy
.
HasInSpellZone
(
_CardId
.
AntiSpellFragrance
,
true
);
}
}
...
@@ -764,6 +836,8 @@ namespace WindBot.Game.AI
...
@@ -764,6 +836,8 @@ namespace WindBot.Game.AI
/// </summary>
/// </summary>
protected
bool
DefaultDontChainMyself
()
protected
bool
DefaultDontChainMyself
()
{
{
if
(
Type
!=
ExecutorType
.
Activate
)
return
true
;
if
(
Executors
.
Any
(
exec
=>
exec
.
Type
==
Type
&&
exec
.
CardId
==
Card
.
Id
))
if
(
Executors
.
Any
(
exec
=>
exec
.
Type
==
Type
&&
exec
.
CardId
==
Card
.
Id
))
return
false
;
return
false
;
return
Duel
.
LastChainPlayer
!=
0
;
return
Duel
.
LastChainPlayer
!=
0
;
...
@@ -776,6 +850,8 @@ namespace WindBot.Game.AI
...
@@ -776,6 +850,8 @@ namespace WindBot.Game.AI
{
{
if
(
Executors
.
Count
(
exec
=>
exec
.
Type
==
Type
&&
exec
.
CardId
==
Card
.
Id
)
>
1
)
if
(
Executors
.
Count
(
exec
=>
exec
.
Type
==
Type
&&
exec
.
CardId
==
Card
.
Id
)
>
1
)
return
false
;
return
false
;
if
(
Card
.
IsFacedown
())
return
true
;
if
(
Bot
.
LifePoints
<=
1000
)
if
(
Bot
.
LifePoints
<=
1000
)
return
false
;
return
false
;
if
(
Bot
.
LifePoints
<=
Enemy
.
LifePoints
&&
ActivateDescription
==
Util
.
GetStringId
(
_CardId
.
ChickenGame
,
0
))
if
(
Bot
.
LifePoints
<=
Enemy
.
LifePoints
&&
ActivateDescription
==
Util
.
GetStringId
(
_CardId
.
ChickenGame
,
0
))
...
@@ -1067,6 +1143,11 @@ namespace WindBot.Game.AI
...
@@ -1067,6 +1143,11 @@ namespace WindBot.Game.AI
return
(
selfBestAttack
<=
oppoBestAttack
&&
oppoBestAttack
<=
3000
)
||
DefaultScarlightRedDragonArchfiendEffect
();
return
(
selfBestAttack
<=
oppoBestAttack
&&
oppoBestAttack
<=
3000
)
||
DefaultScarlightRedDragonArchfiendEffect
();
}
}
protected
bool
DefaultTimelordSummon
()
{
return
Bot
.
GetMonsterCount
()
==
0
;
}
/// <summary>
/// <summary>
/// Activate when we have less monsters than enemy, or when enemy have more than 3 monsters.
/// Activate when we have less monsters than enemy, or when enemy have more than 3 monsters.
/// </summary>
/// </summary>
...
@@ -1089,13 +1170,7 @@ namespace WindBot.Game.AI
...
@@ -1089,13 +1170,7 @@ namespace WindBot.Game.AI
||
((
Bot
.
BattlingMonster
.
Attack
<
Enemy
.
BattlingMonster
.
Defense
)
&&
(
Bot
.
BattlingMonster
.
Attack
+
Enemy
.
BattlingMonster
.
Attack
>
Enemy
.
BattlingMonster
.
Defense
)));
||
((
Bot
.
BattlingMonster
.
Attack
<
Enemy
.
BattlingMonster
.
Defense
)
&&
(
Bot
.
BattlingMonster
.
Attack
+
Enemy
.
BattlingMonster
.
Attack
>
Enemy
.
BattlingMonster
.
Defense
)));
}
}
if
(
Util
.
IsTurn1OrMain2
()
&&
HonestEffectCount
<=
5
)
return
Util
.
IsTurn1OrMain2
();
{
HonestEffectCount
++;
return
true
;
}
return
false
;
}
}
}
}
}
}
Game/AI/Dialogs.cs
View file @
f2d7219b
...
@@ -59,7 +59,7 @@ namespace WindBot.Game.AI
...
@@ -59,7 +59,7 @@ namespace WindBot.Game.AI
_game
=
game
;
_game
=
game
;
DataContractJsonSerializer
serializer
=
new
DataContractJsonSerializer
(
typeof
(
DialogsData
));
DataContractJsonSerializer
serializer
=
new
DataContractJsonSerializer
(
typeof
(
DialogsData
));
string
dialogfilename
=
game
.
Dialog
;
string
dialogfilename
=
game
.
Dialog
;
using
(
FileStream
fs
=
File
.
OpenRead
(
"Dialogs/"
+
dialogfilename
+
".
json"
))
using
(
FileStream
fs
=
Program
.
ReadFile
(
"Dialogs"
,
dialogfilename
,
"
json"
))
{
{
DialogsData
data
=
(
DialogsData
)
serializer
.
ReadObject
(
fs
);
DialogsData
data
=
(
DialogsData
)
serializer
.
ReadObject
(
fs
);
_welcome
=
data
.
welcome
;
_welcome
=
data
.
welcome
;
...
...
Game/AI/Enums/InvincibleMonster.cs
View file @
f2d7219b
namespace
WindBot.Game.AI.Enums
namespace
WindBot.Game.AI.Enums
{
{
/// <summary>
/// Cards that are invincible to battle and should always attack to use effect.
/// </summary>
public
enum
InvincibleBotMonster
{
YubelTheUltimateNightmare
=
31764700
,
YubelTerrorIncarnate
=
4779091
,
SandaionTheTimelord
=
33015627
,
GabrionTheTimelord
=
6616912
,
MichionTheTimelord
=
7733560
,
ZaphionTheTimelord
=
28929131
,
HailonTheTimelord
=
34137269
,
RaphionTheTimelord
=
60222213
,
SadionTheTimelord
=
65314286
,
MetaionTheTimelord
=
74530899
,
KamionTheTimelord
=
91712985
,
LazionTheTimelord
=
92435533
,
TimelordProgenitorVorpgate
=
67508932
,
RocketWarrior
=
30860696
,
GoDDDDivineZeroKingRage
=
40227329
,
BloomDivaTheMelodiousChoir
=
84988419
,
BlackwingArmorMaster
=
69031175
,
DaigustoSphreez
=
29552709
,
Number92HearteartHDragon
=
97403510
,
NumberC96DarkStorm
=
77205367
,
Number54LionHeart
=
54366836
}
/// <summary>
/// <summary>
/// Cards that are invincible to battle.
/// Cards that are invincible to battle.
/// </summary>
/// </summary>
public
enum
InvincibleMonster
public
enum
Invincible
Enemy
Monster
{
{
SpiritReaper
=
23205979
,
SpiritReaper
=
23205979
,
YubelTheUltimateNightmare
=
31764700
,
YubelTheUltimateNightmare
=
31764700
,
...
...
Game/AI/Executor.cs
View file @
f2d7219b
...
@@ -73,13 +73,19 @@ namespace WindBot.Game.AI
...
@@ -73,13 +73,19 @@ namespace WindBot.Game.AI
public
virtual
BattlePhaseAction
OnSelectAttackTarget
(
ClientCard
attacker
,
IList
<
ClientCard
>
defenders
)
public
virtual
BattlePhaseAction
OnSelectAttackTarget
(
ClientCard
attacker
,
IList
<
ClientCard
>
defenders
)
{
{
// Overrided in Defa
l
ultExecutor
// Overrided in DefaultExecutor
return
null
;
return
null
;
}
}
public
virtual
bool
OnPreBattleBetween
(
ClientCard
attacker
,
ClientCard
defender
)
public
virtual
bool
OnPreBattleBetween
(
ClientCard
attacker
,
ClientCard
defender
)
{
{
// Overrided in DefalultExecutor
// Overrided in DefaultExecutor
return
true
;
}
public
virtual
bool
OnPreActivate
(
ClientCard
card
)
{
// Overrided in DefaultExecutor
return
true
;
return
true
;
}
}
...
@@ -178,13 +184,23 @@ namespace WindBot.Game.AI
...
@@ -178,13 +184,23 @@ namespace WindBot.Game.AI
public
virtual
CardPosition
OnSelectPosition
(
int
cardId
,
IList
<
CardPosition
>
positions
)
public
virtual
CardPosition
OnSelectPosition
(
int
cardId
,
IList
<
CardPosition
>
positions
)
{
{
// Overrided in Defa
l
ultExecutor
// Overrided in DefaultExecutor
return
0
;
return
0
;
}
}
public
virtual
bool
OnSelectBattleReplay
()
public
virtual
bool
OnSelectBattleReplay
()
{
{
// Overrided in DefalultExecutor
// Overrided in DefaultExecutor
return
false
;
}
/// <summary>
/// Called when the executor type is SummonOrSet
/// </summary>
/// <returns>True if select to set the monster.</returns>
public
virtual
bool
OnSelectMonsterSummonOrSet
(
ClientCard
card
)
{
// Overrided in DefaultExecutor
return
false
;
return
false
;
}
}
...
...
Game/AI/HintMsg.cs
0 → 100644
View file @
f2d7219b
namespace
WindBot.Game.AI
{
public
static
class
HintMsg
{
public
const
int
Release
=
500
,
Discard
=
501
,
Destroy
=
502
,
Remove
=
503
,
ToGrave
=
504
,
ReturnToHand
=
505
,
AddToHand
=
506
,
ToDeck
=
507
,
Summon
=
508
,
SpSummon
=
509
,
Set
=
510
,
FusionMaterial
=
511
,
SynchroMaterial
=
512
,
XyzMaterial
=
513
,
Faceup
=
514
,
Facedown
=
515
,
Attack
=
516
,
Defense
=
517
,
Equip
=
518
,
RemoveXyz
=
519
,
Control
=
520
,
DestroyReplace
=
521
,
FaceupAttack
=
522
,
FaceupDefense
=
523
,
FacedownAttack
=
524
,
FacedownDefense
=
525
,
Confirm
=
526
,
ToField
=
527
,
PosChange
=
528
,
Self
=
529
,
Oppo
=
530
,
Tribute
=
531
,
DeattachFrom
=
532
,
LinkMaterial
=
533
,
AttackTarget
=
549
,
Effect
=
550
,
Target
=
551
,
Coin
=
552
,
Dice
=
553
,
CardType
=
554
,
Option
=
555
,
ResolveEffect
=
556
,
Select
=
560
,
Position
=
561
,
Attribute
=
562
,
Race
=
563
,
Code
=
564
,
Number
=
565
,
LvRank
=
567
,
ResolveCard
=
568
,
Zone
=
569
,
DisableZone
=
570
,
ToZone
=
571
,
Counter
=
572
,
Disable
=
573
,
OperateCard
=
574
;
}
}
\ No newline at end of file
Game/ClientCard.cs
View file @
f2d7219b
...
@@ -32,7 +32,7 @@ namespace WindBot.Game
...
@@ -32,7 +32,7 @@ namespace WindBot.Game
public
int
RealPower
{
get
;
set
;
}
public
int
RealPower
{
get
;
set
;
}
public
List
<
int
>
Overlays
{
get
;
private
set
;
}
public
List
<
int
>
Overlays
{
get
;
private
set
;
}
public
int
Owner
{
get
;
private
set
;
}
public
int
Owner
{
get
;
private
set
;
}
public
int
Controller
{
get
;
private
set
;
}
public
int
Controller
{
get
;
set
;
}
public
int
Disabled
{
get
;
private
set
;
}
public
int
Disabled
{
get
;
private
set
;
}
public
int
ProcCompleted
{
get
;
private
set
;
}
public
int
ProcCompleted
{
get
;
private
set
;
}
public
int
SelectSeq
{
get
;
set
;
}
public
int
SelectSeq
{
get
;
set
;
}
...
...
Game/Deck.cs
View file @
f2d7219b
...
@@ -43,7 +43,7 @@ namespace WindBot.Game
...
@@ -43,7 +43,7 @@ namespace WindBot.Game
StreamReader
reader
=
null
;
StreamReader
reader
=
null
;
try
try
{
{
reader
=
new
StreamReader
(
new
FileStream
(
"Decks/"
+
name
+
".ydk"
,
FileMode
.
Open
,
FileAccess
.
Read
));
reader
=
new
StreamReader
(
Program
.
ReadFile
(
"Decks"
,
name
,
"ydk"
));
Deck
deck
=
new
Deck
();
Deck
deck
=
new
Deck
();
bool
side
=
false
;
bool
side
=
false
;
...
...
Game/Duel.cs
View file @
f2d7219b
...
@@ -96,30 +96,8 @@ namespace WindBot.Game
...
@@ -96,30 +96,8 @@ namespace WindBot.Game
public
void
AddCard
(
CardLocation
loc
,
int
cardId
,
int
player
,
int
seq
,
int
pos
)
public
void
AddCard
(
CardLocation
loc
,
int
cardId
,
int
player
,
int
seq
,
int
pos
)
{
{
switch
(
loc
)
ClientCard
card
=
new
ClientCard
(
cardId
,
loc
,
seq
,
pos
);
{
AddCard
(
loc
,
card
,
player
,
seq
,
pos
,
cardId
);
case
CardLocation
.
Hand
:
Fields
[
player
].
Hand
.
Add
(
new
ClientCard
(
cardId
,
loc
,
-
1
,
pos
));
break
;
case
CardLocation
.
Grave
:
Fields
[
player
].
Graveyard
.
Add
(
new
ClientCard
(
cardId
,
loc
,-
1
,
pos
));
break
;
case
CardLocation
.
Removed
:
Fields
[
player
].
Banished
.
Add
(
new
ClientCard
(
cardId
,
loc
,
-
1
,
pos
));
break
;
case
CardLocation
.
MonsterZone
:
Fields
[
player
].
MonsterZone
[
seq
]
=
new
ClientCard
(
cardId
,
loc
,
seq
,
pos
);
break
;
case
CardLocation
.
SpellZone
:
Fields
[
player
].
SpellZone
[
seq
]
=
new
ClientCard
(
cardId
,
loc
,
seq
,
pos
);
break
;
case
CardLocation
.
Deck
:
Fields
[
player
].
Deck
.
Add
(
new
ClientCard
(
cardId
,
loc
,
-
1
,
pos
));
break
;
case
CardLocation
.
Extra
:
Fields
[
player
].
ExtraDeck
.
Add
(
new
ClientCard
(
cardId
,
loc
,
-
1
,
pos
));
break
;
}
}
}
public
void
AddCard
(
CardLocation
loc
,
ClientCard
card
,
int
player
,
int
seq
,
int
pos
,
int
id
)
public
void
AddCard
(
CardLocation
loc
,
ClientCard
card
,
int
player
,
int
seq
,
int
pos
,
int
id
)
...
@@ -127,6 +105,7 @@ namespace WindBot.Game
...
@@ -127,6 +105,7 @@ namespace WindBot.Game
card
.
Location
=
loc
;
card
.
Location
=
loc
;
card
.
Sequence
=
seq
;
card
.
Sequence
=
seq
;
card
.
Position
=
pos
;
card
.
Position
=
pos
;
card
.
Controller
=
player
;
card
.
SetId
(
id
);
card
.
SetId
(
id
);
switch
(
loc
)
switch
(
loc
)
{
{
...
...
Game/GameAI.cs
View file @
f2d7219b
...
@@ -13,12 +13,16 @@ namespace WindBot.Game
...
@@ -13,12 +13,16 @@ namespace WindBot.Game
private
Dialogs
_dialogs
;
private
Dialogs
_dialogs
;
// record activated count to prevent infinite actions
private
Dictionary
<
int
,
int
>
_activatedCards
;
public
GameAI
(
GameClient
game
,
Duel
duel
)
public
GameAI
(
GameClient
game
,
Duel
duel
)
{
{
Game
=
game
;
Game
=
game
;
Duel
=
duel
;
Duel
=
duel
;
_dialogs
=
new
Dialogs
(
game
);
_dialogs
=
new
Dialogs
(
game
);
_activatedCards
=
new
Dictionary
<
int
,
int
>();
}
}
/// <summary>
/// <summary>
...
@@ -81,6 +85,7 @@ namespace WindBot.Game
...
@@ -81,6 +85,7 @@ namespace WindBot.Game
/// </summary>
/// </summary>
public
void
OnNewTurn
()
public
void
OnNewTurn
()
{
{
_activatedCards
.
Clear
();
Executor
.
OnNewTurn
();
Executor
.
OnNewTurn
();
}
}
...
@@ -190,13 +195,9 @@ namespace WindBot.Game
...
@@ -190,13 +195,9 @@ namespace WindBot.Game
if
(
defenders
.
Count
==
0
)
if
(
defenders
.
Count
==
0
)
{
{
// Attack with the monster with the lowest attack first
// Attack with the monster with the lowest attack first
for
(
int
i
=
attackers
.
Count
-
1
;
i
>=
0
;
--
i
)
ClientCard
attacker
=
attackers
[
attackers
.
Count
-
1
];
{
ClientCard
attacker
=
attackers
[
i
];
if
(
attacker
.
Attack
>
0
)
return
Attack
(
attacker
,
null
);
return
Attack
(
attacker
,
null
);
}
}
}
else
else
{
{
for
(
int
k
=
0
;
k
<
attackers
.
Count
;
++
k
)
for
(
int
k
=
0
;
k
<
attackers
.
Count
;
++
k
)
...
@@ -226,18 +227,12 @@ namespace WindBot.Game
...
@@ -226,18 +227,12 @@ namespace WindBot.Game
/// <returns>A new list containing the selected cards.</returns>
/// <returns>A new list containing the selected cards.</returns>
public
IList
<
ClientCard
>
OnSelectCard
(
IList
<
ClientCard
>
cards
,
int
min
,
int
max
,
int
hint
,
bool
cancelable
)
public
IList
<
ClientCard
>
OnSelectCard
(
IList
<
ClientCard
>
cards
,
int
min
,
int
max
,
int
hint
,
bool
cancelable
)
{
{
const
int
HINTMSG_FMATERIAL
=
511
;
const
int
HINTMSG_SMATERIAL
=
512
;
const
int
HINTMSG_XMATERIAL
=
513
;
const
int
HINTMSG_LMATERIAL
=
533
;
const
int
HINTMSG_SPSUMMON
=
509
;
// Check for the executor.
// Check for the executor.
IList
<
ClientCard
>
result
=
Executor
.
OnSelectCard
(
cards
,
min
,
max
,
hint
,
cancelable
);
IList
<
ClientCard
>
result
=
Executor
.
OnSelectCard
(
cards
,
min
,
max
,
hint
,
cancelable
);
if
(
result
!=
null
)
if
(
result
!=
null
)
return
result
;
return
result
;
if
(
hint
==
H
INTMSG_SPSUMMON
&&
min
==
1
&&
max
>
min
)
// pendulum summon
if
(
hint
==
H
intMsg
.
SpSummon
&&
min
==
1
&&
max
>
min
)
// pendulum summon
{
{
result
=
Executor
.
OnSelectPendulumSummon
(
cards
,
max
);
result
=
Executor
.
OnSelectPendulumSummon
(
cards
,
max
);
if
(
result
!=
null
)
if
(
result
!=
null
)
...
@@ -245,7 +240,7 @@ namespace WindBot.Game
...
@@ -245,7 +240,7 @@ namespace WindBot.Game
}
}
CardSelector
selector
=
null
;
CardSelector
selector
=
null
;
if
(
hint
==
H
INTMSG_FMATERIAL
||
hint
==
HINTMSG_SMATERIAL
||
hint
==
HINTMSG_XMATERIAL
||
hint
==
HINTMSG_LMATERIAL
)
if
(
hint
==
H
intMsg
.
FusionMaterial
||
hint
==
HintMsg
.
SynchroMaterial
||
hint
==
HintMsg
.
XyzMaterial
||
hint
==
HintMsg
.
LinkMaterial
)
{
{
if
(
m_materialSelector
!=
null
)
if
(
m_materialSelector
!=
null
)
{
{
...
@@ -254,13 +249,13 @@ namespace WindBot.Game
...
@@ -254,13 +249,13 @@ namespace WindBot.Game
}
}
else
else
{
{
if
(
hint
==
H
INTMSG_FMATERIAL
)
if
(
hint
==
H
intMsg
.
FusionMaterial
)
result
=
Executor
.
OnSelectFusionMaterial
(
cards
,
min
,
max
);
result
=
Executor
.
OnSelectFusionMaterial
(
cards
,
min
,
max
);
if
(
hint
==
H
INTMSG_SMATERIAL
)
if
(
hint
==
H
intMsg
.
SynchroMaterial
)
result
=
Executor
.
OnSelectSynchroMaterial
(
cards
,
0
,
min
,
max
);
result
=
Executor
.
OnSelectSynchroMaterial
(
cards
,
0
,
min
,
max
);
if
(
hint
==
H
INTMSG_XMATERIAL
)
if
(
hint
==
H
intMsg
.
XyzMaterial
)
result
=
Executor
.
OnSelectXyzMaterial
(
cards
,
min
,
max
);
result
=
Executor
.
OnSelectXyzMaterial
(
cards
,
min
,
max
);
if
(
hint
==
H
INTMSG_LMATERIAL
)
if
(
hint
==
H
intMsg
.
LinkMaterial
)
result
=
Executor
.
OnSelectLinkMaterial
(
cards
,
min
,
max
);
result
=
Executor
.
OnSelectLinkMaterial
(
cards
,
min
,
max
);
if
(
result
!=
null
)
if
(
result
!=
null
)
...
@@ -439,8 +434,7 @@ namespace WindBot.Game
...
@@ -439,8 +434,7 @@ namespace WindBot.Game
}
}
if
(
ShouldExecute
(
exec
,
card
,
ExecutorType
.
SummonOrSet
))
if
(
ShouldExecute
(
exec
,
card
,
ExecutorType
.
SummonOrSet
))
{
{
if
(
Executor
.
Util
.
IsAllEnemyBetter
(
true
)
&&
Executor
.
Util
.
IsAllEnemyBetterThanValue
(
card
.
Attack
+
300
,
false
)
&&
if
(
main
.
MonsterSetableCards
.
Contains
(
card
)
&&
Executor
.
OnSelectMonsterSummonOrSet
(
card
))
main
.
MonsterSetableCards
.
Contains
(
card
))
{
{
_dialogs
.
SendSetMonster
();
_dialogs
.
SendSetMonster
();
return
new
MainPhaseAction
(
MainPhaseAction
.
MainAction
.
SetMonster
,
card
.
ActionIndex
);
return
new
MainPhaseAction
(
MainPhaseAction
.
MainAction
.
SetMonster
,
card
.
ActionIndex
);
...
@@ -529,16 +523,13 @@ namespace WindBot.Game
...
@@ -529,16 +523,13 @@ namespace WindBot.Game
/// <returns></returns>
/// <returns></returns>
public
IList
<
ClientCard
>
OnSelectSum
(
IList
<
ClientCard
>
cards
,
int
sum
,
int
min
,
int
max
,
int
hint
,
bool
mode
)
public
IList
<
ClientCard
>
OnSelectSum
(
IList
<
ClientCard
>
cards
,
int
sum
,
int
min
,
int
max
,
int
hint
,
bool
mode
)
{
{
const
int
HINTMSG_RELEASE
=
500
;
const
int
HINTMSG_SMATERIAL
=
512
;
IList
<
ClientCard
>
selected
=
Executor
.
OnSelectSum
(
cards
,
sum
,
min
,
max
,
hint
,
mode
);
IList
<
ClientCard
>
selected
=
Executor
.
OnSelectSum
(
cards
,
sum
,
min
,
max
,
hint
,
mode
);
if
(
selected
!=
null
)
if
(
selected
!=
null
)
{
{
return
selected
;
return
selected
;
}
}
if
(
hint
==
H
INTMSG_RELEASE
||
hint
==
HINTMSG_SMATERIAL
)
if
(
hint
==
H
intMsg
.
Release
||
hint
==
HintMsg
.
SynchroMaterial
)
{
{
if
(
m_materialSelector
!=
null
)
if
(
m_materialSelector
!=
null
)
{
{
...
@@ -548,10 +539,10 @@ namespace WindBot.Game
...
@@ -548,10 +539,10 @@ namespace WindBot.Game
{
{
switch
(
hint
)
switch
(
hint
)
{
{
case
H
INTMSG_SMATERIAL
:
case
H
intMsg
.
SynchroMaterial
:
selected
=
Executor
.
OnSelectSynchroMaterial
(
cards
,
sum
,
min
,
max
);
selected
=
Executor
.
OnSelectSynchroMaterial
(
cards
,
sum
,
min
,
max
);
break
;
break
;
case
H
INTMSG_RELEASE
:
case
H
intMsg
.
Release
:
selected
=
Executor
.
OnSelectRitualTribute
(
cards
,
sum
,
min
,
max
);
selected
=
Executor
.
OnSelectRitualTribute
(
cards
,
sum
,
min
,
max
);
break
;
break
;
}
}
...
@@ -951,6 +942,11 @@ namespace WindBot.Game
...
@@ -951,6 +942,11 @@ namespace WindBot.Game
m_materialSelector
=
null
;
m_materialSelector
=
null
;
}
}
public
bool
HaveSelectedCards
()
{
return
m_selector
.
Count
>
0
||
m_materialSelector
!=
null
;
}
public
CardSelector
GetSelectedCards
()
public
CardSelector
GetSelectedCards
()
{
{
CardSelector
selected
=
null
;
CardSelector
selected
=
null
;
...
@@ -1102,11 +1098,30 @@ namespace WindBot.Game
...
@@ -1102,11 +1098,30 @@ namespace WindBot.Game
private
bool
ShouldExecute
(
CardExecutor
exec
,
ClientCard
card
,
ExecutorType
type
,
int
desc
=
-
1
)
private
bool
ShouldExecute
(
CardExecutor
exec
,
ClientCard
card
,
ExecutorType
type
,
int
desc
=
-
1
)
{
{
if
(
card
.
Id
!=
0
&&
type
==
ExecutorType
.
Activate
)
{
if
(
_activatedCards
.
ContainsKey
(
card
.
Id
)
&&
_activatedCards
[
card
.
Id
]
>=
9
)
return
false
;
if
(!
Executor
.
OnPreActivate
(
card
))
return
false
;
}
Executor
.
SetCard
(
type
,
card
,
desc
);
Executor
.
SetCard
(
type
,
card
,
desc
);
return
card
!=
null
&&
bool
result
=
card
!=
null
&&
exec
.
Type
==
type
&&
exec
.
Type
==
type
&&
(
exec
.
CardId
==
-
1
||
exec
.
CardId
==
card
.
Id
)
&&
(
exec
.
CardId
==
-
1
||
exec
.
CardId
==
card
.
Id
)
&&
(
exec
.
Func
==
null
||
exec
.
Func
());
(
exec
.
Func
==
null
||
exec
.
Func
());
if
(
card
.
Id
!=
0
&&
type
==
ExecutorType
.
Activate
&&
result
)
{
int
count
=
card
.
IsDisabled
()
?
3
:
1
;
if
(!
_activatedCards
.
ContainsKey
(
card
.
Id
))
{
_activatedCards
.
Add
(
card
.
Id
,
count
);
}
else
{
_activatedCards
[
card
.
Id
]
+=
count
;
}
}
return
result
;
}
}
}
}
}
}
Game/GameBehavior.cs
View file @
f2d7219b
...
@@ -44,7 +44,7 @@ namespace WindBot.Game
...
@@ -44,7 +44,7 @@ namespace WindBot.Game
_ai
=
new
GameAI
(
Game
,
_duel
);
_ai
=
new
GameAI
(
Game
,
_duel
);
_ai
.
Executor
=
DecksManager
.
Instantiate
(
_ai
,
_duel
);
_ai
.
Executor
=
DecksManager
.
Instantiate
(
_ai
,
_duel
);
Deck
=
Deck
.
Load
(
_ai
.
Executor
.
Deck
);
Deck
=
Deck
.
Load
(
Game
.
DeckFile
??
_ai
.
Executor
.
Deck
);
_select_hint
=
0
;
_select_hint
=
0
;
}
}
...
@@ -1048,7 +1048,7 @@ namespace WindBot.Game
...
@@ -1048,7 +1048,7 @@ namespace WindBot.Game
for
(
int
i
=
0
;
i
<
count
;
++
i
)
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
{
packet
.
ReadByte
();
// flag
packet
.
ReadByte
();
// flag
packet
.
ReadInt32
();
// card id
int
id
=
packet
.
ReadInt32
();
int
con
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
con
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
loc
=
packet
.
ReadByte
();
int
loc
=
packet
.
ReadByte
();
int
seq
=
packet
.
ReadByte
();
int
seq
=
packet
.
ReadByte
();
...
@@ -1059,7 +1059,12 @@ namespace WindBot.Game
...
@@ -1059,7 +1059,12 @@ namespace WindBot.Game
{
{
desc
=
0
;
desc
=
0
;
}
}
cards
.
Add
(
_duel
.
GetCard
(
con
,
loc
,
seq
,
sseq
));
ClientCard
card
=
_duel
.
GetCard
(
con
,
loc
,
seq
,
sseq
);
if
(
card
.
Id
==
0
)
card
.
SetId
(
id
);
cards
.
Add
(
card
);
descs
.
Add
(
desc
);
descs
.
Add
(
desc
);
}
}
...
...
Game/GameClient.cs
View file @
f2d7219b
...
@@ -13,6 +13,7 @@ namespace WindBot.Game
...
@@ -13,6 +13,7 @@ namespace WindBot.Game
public
YGOClient
Connection
{
get
;
private
set
;
}
public
YGOClient
Connection
{
get
;
private
set
;
}
public
string
Username
;
public
string
Username
;
public
string
Deck
;
public
string
Deck
;
public
string
DeckFile
;
public
string
Dialog
;
public
string
Dialog
;
public
int
Hand
;
public
int
Hand
;
public
bool
Debug
;
public
bool
Debug
;
...
@@ -29,6 +30,7 @@ namespace WindBot.Game
...
@@ -29,6 +30,7 @@ namespace WindBot.Game
{
{
Username
=
Info
.
Name
;
Username
=
Info
.
Name
;
Deck
=
Info
.
Deck
;
Deck
=
Info
.
Deck
;
DeckFile
=
Info
.
DeckFile
;
Dialog
=
Info
.
Dialog
;
Dialog
=
Info
.
Dialog
;
Hand
=
Info
.
Hand
;
Hand
=
Info
.
Hand
;
Debug
=
Info
.
Debug
;
Debug
=
Info
.
Debug
;
...
...
Program.cs
View file @
f2d7219b
...
@@ -68,6 +68,7 @@ namespace WindBot
...
@@ -68,6 +68,7 @@ namespace WindBot
WindBotInfo
Info
=
new
WindBotInfo
();
WindBotInfo
Info
=
new
WindBotInfo
();
Info
.
Name
=
Config
.
GetString
(
"Name"
,
Info
.
Name
);
Info
.
Name
=
Config
.
GetString
(
"Name"
,
Info
.
Name
);
Info
.
Deck
=
Config
.
GetString
(
"Deck"
,
Info
.
Deck
);
Info
.
Deck
=
Config
.
GetString
(
"Deck"
,
Info
.
Deck
);
Info
.
DeckFile
=
Config
.
GetString
(
"DeckFile"
,
Info
.
DeckFile
);
Info
.
Dialog
=
Config
.
GetString
(
"Dialog"
,
Info
.
Dialog
);
Info
.
Dialog
=
Config
.
GetString
(
"Dialog"
,
Info
.
Dialog
);
Info
.
Host
=
Config
.
GetString
(
"Host"
,
Info
.
Host
);
Info
.
Host
=
Config
.
GetString
(
"Host"
,
Info
.
Host
);
Info
.
Port
=
Config
.
GetInt
(
"Port"
,
Info
.
Port
);
Info
.
Port
=
Config
.
GetInt
(
"Port"
,
Info
.
Port
);
...
@@ -104,6 +105,9 @@ namespace WindBot
...
@@ -104,6 +105,9 @@ namespace WindBot
string
port
=
HttpUtility
.
ParseQueryString
(
RawUrl
).
Get
(
"port"
);
string
port
=
HttpUtility
.
ParseQueryString
(
RawUrl
).
Get
(
"port"
);
if
(
port
!=
null
)
if
(
port
!=
null
)
Info
.
Port
=
Int32
.
Parse
(
port
);
Info
.
Port
=
Int32
.
Parse
(
port
);
string
deckfile
=
HttpUtility
.
ParseQueryString
(
RawUrl
).
Get
(
"deckfile"
);
if
(
deckfile
!=
null
)
Info
.
DeckFile
=
deckfile
;
string
dialog
=
HttpUtility
.
ParseQueryString
(
RawUrl
).
Get
(
"dialog"
);
string
dialog
=
HttpUtility
.
ParseQueryString
(
RawUrl
).
Get
(
"dialog"
);
if
(
dialog
!=
null
)
if
(
dialog
!=
null
)
Info
.
Dialog
=
dialog
;
Info
.
Dialog
=
dialog
;
...
@@ -193,5 +197,22 @@ namespace WindBot
...
@@ -193,5 +197,22 @@ namespace WindBot
}
}
#endif
#endif
}
}
public
static
FileStream
ReadFile
(
string
directory
,
string
filename
,
string
extension
)
{
string
tryfilename
=
filename
+
"."
+
extension
;
string
fullpath
=
Path
.
Combine
(
directory
,
tryfilename
);
if
(!
File
.
Exists
(
fullpath
))
fullpath
=
filename
;
if
(!
File
.
Exists
(
fullpath
))
fullpath
=
Path
.
Combine
(
"../"
,
filename
);
if
(!
File
.
Exists
(
fullpath
))
fullpath
=
Path
.
Combine
(
"../deck/"
,
filename
);
if
(!
File
.
Exists
(
fullpath
))
fullpath
=
Path
.
Combine
(
"../"
,
tryfilename
);
if
(!
File
.
Exists
(
fullpath
))
fullpath
=
Path
.
Combine
(
"../deck/"
,
tryfilename
);
return
new
FileStream
(
fullpath
,
FileMode
.
Open
,
FileAccess
.
Read
);
}
}
}
}
}
README.md
View file @
f2d7219b
...
@@ -20,6 +20,11 @@ The nickname for the bot.
...
@@ -20,6 +20,11 @@ The nickname for the bot.
`Deck`
`Deck`
The deck to be used by the bot. Available decks are listed below. Keep empty to use random deck.
The deck to be used by the bot. Available decks are listed below. Keep empty to use random deck.
`DeckFile`
The deck file (.ydk) to be used by the bot. Will be set by
`Deck`
automatically, but you can override it.
Note: Most cards not in the original deck are unknown to the bot, and won't be summoned or activated in the duel.
`Dialog`
`Dialog`
The dialog texts to be used by the bot. See Dialogs folder for list.
The dialog texts to be used by the bot. See Dialogs folder for list.
...
...
WindBot.csproj
View file @
f2d7219b
...
@@ -72,6 +72,7 @@
...
@@ -72,6 +72,7 @@
<Compile
Include=
"Game\AI\Decks\AltergeistExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\AltergeistExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\FamiliarPossessedExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\FamiliarPossessedExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\BlackwingExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\BlackwingExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\LuckyExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\MathMechExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\MathMechExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\PureWindsExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\PureWindsExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\DragunExecutor.cs"
/>
<Compile
Include=
"Game\AI\Decks\DragunExecutor.cs"
/>
...
@@ -124,6 +125,7 @@
...
@@ -124,6 +125,7 @@
<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\HintMsg.cs"
/>
<Compile
Include=
"Game\AI\Opcodes.cs"
/>
<Compile
Include=
"Game\AI\Opcodes.cs"
/>
<Compile
Include=
"Game\AI\Zones.cs"
/>
<Compile
Include=
"Game\AI\Zones.cs"
/>
<Compile
Include=
"Game\AI\ExecutorType.cs"
/>
<Compile
Include=
"Game\AI\ExecutorType.cs"
/>
...
...
WindBotInfo.cs
View file @
f2d7219b
...
@@ -6,6 +6,7 @@ namespace WindBot
...
@@ -6,6 +6,7 @@ namespace WindBot
{
{
public
string
Name
{
get
;
set
;
}
public
string
Name
{
get
;
set
;
}
public
string
Deck
{
get
;
set
;
}
public
string
Deck
{
get
;
set
;
}
public
string
DeckFile
{
get
;
set
;
}
public
string
Dialog
{
get
;
set
;
}
public
string
Dialog
{
get
;
set
;
}
public
string
Host
{
get
;
set
;
}
public
string
Host
{
get
;
set
;
}
public
int
Port
{
get
;
set
;
}
public
int
Port
{
get
;
set
;
}
...
@@ -18,6 +19,7 @@ namespace WindBot
...
@@ -18,6 +19,7 @@ namespace WindBot
{
{
Name
=
"WindBot"
;
Name
=
"WindBot"
;
Deck
=
null
;
Deck
=
null
;
DeckFile
=
null
;
Dialog
=
"default"
;
Dialog
=
"default"
;
Host
=
"127.0.0.1"
;
Host
=
"127.0.0.1"
;
Port
=
7911
;
Port
=
7911
;
...
...
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