Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
W
Windbot-408
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
神之吹息
Windbot-408
Commits
2ad318ae
Commit
2ad318ae
authored
Feb 08, 2023
by
苍蓝
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
780b6d6c
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
749 additions
and
54 deletions
+749
-54
Game/AI/CardContainer.cs
Game/AI/CardContainer.cs
+4
-0
Game/AI/Decks/LuckyExecutor.cs
Game/AI/Decks/LuckyExecutor.cs
+32
-7
Game/AI/Decks/MituziExecutor.cs
Game/AI/Decks/MituziExecutor.cs
+114
-2
Game/AI/Decks/MokeyMokeyExecutor.cs
Game/AI/Decks/MokeyMokeyExecutor.cs
+117
-8
Game/AI/Decks/MokeyMokeyKingExecutor.cs
Game/AI/Decks/MokeyMokeyKingExecutor.cs
+110
-4
Game/AI/Decks/SaikyoBattleFlagExecutor.cs
Game/AI/Decks/SaikyoBattleFlagExecutor.cs
+110
-11
Game/AI/Decks/TheLegendExecutor.cs
Game/AI/Decks/TheLegendExecutor.cs
+105
-5
Game/AI/DefaultExecutor.cs
Game/AI/DefaultExecutor.cs
+157
-17
No files found.
Game/AI/CardContainer.cs
View file @
2ad318ae
...
...
@@ -115,6 +115,10 @@ namespace WindBot.Game.AI
{
return
cards
.
FirstOrDefault
(
card
=>
card
?.
Data
!=
null
&&
card
.
IsMonsterInvincible
()
&&
card
.
IsFaceup
()
&&
(!
canBeTarget
||
!
card
.
IsShouldNotBeTarget
()));
}
public
static
ClientCard
GetImmuneTrapMonster
(
this
IEnumerable
<
ClientCard
>
cards
,
bool
canBeTarget
=
false
)
{
return
cards
.
FirstOrDefault
(
card
=>
card
?.
Data
!=
null
&&
card
.
IsMonsterImmuneTrap
()
&&
card
.
IsFaceup
()
&&
(!
canBeTarget
||
!
card
.
IsShouldNotBeTarget
()));
}
public
static
ClientCard
GetDangerousMonster
(
this
IEnumerable
<
ClientCard
>
cards
,
bool
canBeTarget
=
false
)
{
...
...
Game/AI/Decks/LuckyExecutor.cs
View file @
2ad318ae
...
...
@@ -18,9 +18,10 @@ namespace WindBot.Game.AI.Decks
AddExecutor
(
ExecutorType
.
SpSummon
,
ImFeelingLucky
);
AddExecutor
(
ExecutorType
.
SpSummon
,
ImFeelingUnlucky
);
AddExecutor
(
ExecutorType
.
Activate
,
ImFeelingUnlucky
);
AddExecutor
(
ExecutorType
.
SummonOrSet
,
ImFeelingLazy
);
AddExecutor
(
ExecutorType
.
Repos
,
DefaultMonsterRepos
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
苍救升
,
苍救升
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
苍救降
,
苍救降
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
传说战士
,
传说战士
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
海龙骑士
,
海龙骑士
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
大风暴
,
大风暴
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
魔法筒
,
魔法筒
Effect
);
...
...
@@ -31,6 +32,9 @@ namespace WindBot.Game.AI.Decks
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
暗黑释放
,
圣防
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
手枪龙
,
手枪龙
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
最强战旗
,
最强战旗
Eff
);
//AddExecutor(ExecutorType.Activate, _CardId.升阵, 装备act);
//AddExecutor(ExecutorType.Activate, _CardId.苍救之证, 装备act);
AddExecutor
(
ExecutorType
.
Activate
,
装备
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
MysticalSpaceTyphoon
,
DefaultMysticalSpaceTyphoon
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
CosmicCyclone
,
DefaultCosmicCyclone
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
GalaxyCyclone
,
DefaultGalaxyCyclone
);
...
...
@@ -60,7 +64,9 @@ namespace WindBot.Game.AI.Decks
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
AllureofDarkness
,
DefaultAllureofDarkness
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
DimensionalBarrier
,
DefaultDimensionalBarrier
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
InterruptedKaijuSlumber
,
DefaultInterruptedKaijuSlumber
);
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
苍救降
);
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
苍救升
);
AddExecutor
(
ExecutorType
.
SummonOrSet
,
ImFeelingLazy
);
AddExecutor
(
ExecutorType
.
SpSummon
,
_CardId
.
JizukirutheStarDestroyingKaiju
,
DefaultKaijuSpsummon
);
AddExecutor
(
ExecutorType
.
SpSummon
,
_CardId
.
GadarlatheMysteryDustKaiju
,
DefaultKaijuSpsummon
);
AddExecutor
(
ExecutorType
.
SpSummon
,
_CardId
.
GamecieltheSeaTurtleKaiju
,
DefaultKaijuSpsummon
);
...
...
@@ -91,6 +97,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
ExodiaTheForbiddenOne
,
JustDontIt
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
死苏
,
死苏
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
死苏
2
,
死苏
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
斗牛士
,
斗牛士
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
最强战旗
,
最强战旗
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
钢机神
,
钢机神
1
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
钢机神
,
钢机神
Effect
);
...
...
@@ -98,6 +105,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor
(
ExecutorType
.
MonsterSet
,
_CardId
.
千年盾
,
DefaultMonsterSummon
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
死供
,
死供
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
耳语妖精
,
耳语妖精
Effect
);
AddExecutor
(
ExecutorType
.
Repos
,
DefaultMonsterRepos
);
AddExecutor
(
ExecutorType
.
Repos
,
圣防
Repos
);
AddExecutor
(
ExecutorType
.
SpellSet
,
DefaultSpellSet
);
...
...
@@ -113,7 +121,10 @@ namespace WindBot.Game.AI.Decks
{
HintMsg
.
SpSummon
,
HintMsg
.
ToGrave
,
HintMsg
.
Remove
,
HintMsg
.
AddToHand
,
HintMsg
.
FusionMaterial
};
private
List
<
int
>
HintMsgForExtra
=
new
List
<
int
>
{
HintMsg
.
SpSummon
,
HintMsg
.
ToGrave
,
HintMsg
.
Remove
,
HintMsg
.
AddToHand
,
HintMsg
.
FusionMaterial
};
private
List
<
int
>
HintMsgForSelf
=
new
List
<
int
>
{
HintMsg
.
Equip
...
...
@@ -126,7 +137,7 @@ namespace WindBot.Game.AI.Decks
private
List
<
int
>
HintMsgForMaxSelect
=
new
List
<
int
>
{
HintMsg
.
SpSummon
,
HintMsg
.
ToGrave
,
HintMsg
.
AddToHand
,
HintMsg
.
FusionMaterial
,
HintMsg
.
Destroy
HintMsg
.
SpSummon
,
HintMsg
.
ToGrave
,
HintMsg
.
AddToHand
,
HintMsg
.
FusionMaterial
,
HintMsg
.
Destroy
,
HintMsg
.
Equip
,
HintMsg
.
Confirm
};
public
override
IList
<
ClientCard
>
OnSelectCard
(
IList
<
ClientCard
>
_cards
,
int
min
,
int
max
,
int
hint
,
bool
cancelable
)
...
...
@@ -168,6 +179,19 @@ namespace WindBot.Game.AI.Decks
cards
.
Remove
(
card
);
}
}
if
(
HintMsgForExtra
.
Contains
(
hint
))
{
IList
<
ClientCard
>
ExtraCards
=
cards
.
Where
(
card
=>
card
.
Location
==
CardLocation
.
Extra
).
ToList
();
// select extra's card first
while
(
ExtraCards
.
Count
>
0
&&
selected
.
Count
<
max
)
{
ClientCard
card
=
ExtraCards
[
Program
.
Rand
.
Next
(
ExtraCards
.
Count
)];
selected
.
Add
(
card
);
ExtraCards
.
Remove
(
card
);
cards
.
Remove
(
card
);
}
}
if
(
HintMsgForSelf
.
Contains
(
hint
))
{
...
...
@@ -239,12 +263,13 @@ namespace WindBot.Game.AI.Decks
private
bool
ImFeelingLucky
()
{
return
Program
.
Rand
.
Next
(
10
)
>=
5
&&
DefaultDontChainMyself
();
return
Program
.
Rand
.
Next
(
10
)
>=
5
&&
DefaultDontChainMyself
()
&&
!
Card
.
HasType
(
CardType
.
Equip
);
}
private
bool
ImFeelingUnlucky
()
{
return
DefaultDontChainMyself
(
);
return
DefaultDontChainMyself
()
&&
!
Card
.
HasType
(
CardType
.
Equip
);
}
private
bool
ImFeelingLazy
()
...
...
Game/AI/Decks/MituziExecutor.cs
View file @
2ad318ae
...
...
@@ -75,34 +75,61 @@ namespace WindBot.Game.AI.Decks
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
幻刃封锁
,
幻刃封锁
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
幻刃急攻
,
幻刃急攻
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
透幻乡险峻
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
破灭之龙魔导士
,
破灭之龙魔导士
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
星战骑佩流安
,
星战骑佩流安
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
加百列热茶
,
加百列热茶
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
DefaultDontChainMyself
);
AddExecutor
(
ExecutorType
.
Repos
,
DefaultMonsterRepos
);
AddExecutor
(
ExecutorType
.
Repos
,
圣防
Repos
);
AddExecutor
(
ExecutorType
.
SpellSet
,
TrapCardSet
);
AddExecutor
(
ExecutorType
.
SpellSet
);
}
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
>
HintMsgForExtra
=
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
.
ToDeck
,
HintMsg
.
Destroy
HintMsg
.
SpSummon
,
HintMsg
.
ToGrave
,
HintMsg
.
AddToHand
,
HintMsg
.
FusionMaterial
,
HintMsg
.
Destroy
,
HintMsg
.
Equip
,
HintMsg
.
Confirm
};
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
)
{
...
...
@@ -112,6 +139,70 @@ namespace WindBot.Game.AI.Decks
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
(
HintMsgForExtra
.
Contains
(
hint
))
{
IList
<
ClientCard
>
ExtraCards
=
cards
.
Where
(
card
=>
card
.
Location
==
CardLocation
.
Extra
).
ToList
();
// select extra's card first
while
(
ExtraCards
.
Count
>
0
&&
selected
.
Count
<
max
)
{
ClientCard
card
=
ExtraCards
[
Program
.
Rand
.
Next
(
ExtraCards
.
Count
)];
selected
.
Add
(
card
);
ExtraCards
.
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
...
...
@@ -122,9 +213,30 @@ namespace WindBot.Game.AI.Decks
cards
.
Remove
(
card
);
}
}
return
selected
;
}
public
override
bool
OnSelectHand
()
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
;
}
public
override
bool
OnSelectHand
()
{
// go first
return
true
;
...
...
Game/AI/Decks/MokeyMokeyExecutor.cs
View file @
2ad318ae
...
...
@@ -35,12 +35,14 @@ namespace WindBot.Game.AI.Decks
public
const
int
对死者的供奉
=
120151023
;
public
const
int
落穴
=
120150019
;
public
const
int
暗黑释放
=
120105013
;
public
const
int
七魔导枪
=
120228050
;
}
public
MokeyMokeyExecutor
(
GameAI
ai
,
Duel
duel
)
:
base
(
ai
,
duel
)
{
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
黑洞
,
黑洞
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
强欲之壶
);
AddExecutor
(
ExecutorType
.
SpSummon
);
AddExecutor
(
ExecutorType
.
Repos
,
DefaultMonsterRepos
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
侏儒兔
,
侏儒兔
Effect
);
...
...
@@ -58,8 +60,9 @@ namespace WindBot.Game.AI.Decks
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
神秘庄家
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
侏儒兔
,
侏儒兔
Summon
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
神秘庄家
,
draweffect
);
AddExecutor
(
ExecutorType
.
SpellSet
,
CardId
.
暗黑释放
,
圣防
Effect
);
AddExecutor
(
ExecutorType
.
SpellSet
,
CardId
.
暗黑释放
);
AddExecutor
(
ExecutorType
.
SpellSet
,
CardId
.
落穴
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
暗黑释放
,
圣防
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
魔法筒
,
魔法筒
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
炸甲
,
炸甲
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
落穴
,
落穴
Effect
);
...
...
@@ -78,7 +81,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor
(
ExecutorType
.
Summon
,
_CardId
.
结界像
);
AddExecutor
(
ExecutorType
.
SummonOrSet
,
DefaultMonsterSummon
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
七魔导枪
,
七魔导枪
Effect
);
AddExecutor
(
ExecutorType
.
SpellSet
);
//AddExecutor(ExecutorType.Activate, CardId.sionmax, sionmaxEffect);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
耳语妖精
,
耳语妖精
Effect
);
...
...
@@ -86,23 +89,42 @@ namespace WindBot.Game.AI.Decks
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
连击龙
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
七星道魔术师
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
斗牛士
,
斗牛士
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
破灭之龙魔导士
,
破灭之龙魔导士
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
星战骑佩流安
,
星战骑佩流安
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
加百列热茶
,
加百列热茶
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
DefaultDontChainMyself
);
AddExecutor
(
ExecutorType
.
Repos
,
CardId
.
青眼白龙
,
圣防
Repos
);
AddExecutor
(
ExecutorType
.
Repos
,
CardId
.
破坏之剑士
,
圣防
Repos
);
}
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
>
HintMsgForExtra
=
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
.
ToDeck
,
HintMsg
.
Destroy
HintMsg
.
SpSummon
,
HintMsg
.
ToGrave
,
HintMsg
.
AddToHand
,
HintMsg
.
FusionMaterial
,
HintMsg
.
Destroy
,
HintMsg
.
Equip
,
HintMsg
.
Confirm
};
public
override
IList
<
ClientCard
>
OnSelectCard
(
IList
<
ClientCard
>
_cards
,
int
min
,
int
max
,
int
hint
,
bool
cancelable
)
...
...
@@ -131,6 +153,69 @@ namespace WindBot.Game.AI.Decks
}
}
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
(
HintMsgForExtra
.
Contains
(
hint
))
{
IList
<
ClientCard
>
ExtraCards
=
cards
.
Where
(
card
=>
card
.
Location
==
CardLocation
.
Extra
).
ToList
();
// select extra's card first
while
(
ExtraCards
.
Count
>
0
&&
selected
.
Count
<
max
)
{
ClientCard
card
=
ExtraCards
[
Program
.
Rand
.
Next
(
ExtraCards
.
Count
)];
selected
.
Add
(
card
);
ExtraCards
.
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
...
...
@@ -144,6 +229,25 @@ namespace WindBot.Game.AI.Decks
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
;
}
public
override
bool
OnSelectHand
()
{
// go first
...
...
@@ -169,7 +273,12 @@ namespace WindBot.Game.AI.Decks
return
false
;
return
true
;
}
private
bool
七魔导枪
Effect
()
{
if
(
Bot
.
HasInMonstersZone
(
CardId
.
七星道魔术师
))
AI
.
SelectCard
(
CardId
.
七星道魔术师
);
return
true
;
}
private
bool
火星心少女
Effect
()
{
foreach
(
ClientCard
m
in
Bot
.
Hand
)
...
...
@@ -240,7 +349,7 @@ namespace WindBot.Game.AI.Decks
{
if
(
Bot
.
HasInGraveyard
(
new
[]
{
CardId
.
连击龙
,
CardId
.
青眼白龙
})
&&
Bot
.
MonsterZone
.
GetMatchingCardsCount
(
card
=>
card
.
Level
>
4
)
<
2
&&
(
Bot
.
MonsterZone
.
GetMatchingCardsCount
(
card
=>
card
.
Level
<
5
)
+
Bot
.
Hand
.
GetMatchingCardsCount
(
card
=>
card
.
Level
<
5
))
<
=
2
)
(
Bot
.
MonsterZone
.
GetMatchingCardsCount
(
card
=>
card
.
Level
<
5
)
+
Bot
.
Hand
.
GetMatchingCardsCount
(
card
=>
card
.
Level
<
5
))
>
=
2
)
{
return
true
;
}
...
...
Game/AI/Decks/MokeyMokeyKingExecutor.cs
View file @
2ad318ae
...
...
@@ -48,6 +48,7 @@ namespace WindBot.Game.AI.Decks
{
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
黑洞
,
黑洞
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
疾风弹
,
疾风弹
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
强欲之壶
);
AddExecutor
(
ExecutorType
.
SpSummon
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
七星道法师
,
七星道法师
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
侏儒兔
,
侏儒兔
Effect
);
...
...
@@ -64,8 +65,9 @@ namespace WindBot.Game.AI.Decks
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
神秘庄家
);
AddExecutor
(
ExecutorType
.
Summon
,
CardId
.
侏儒兔
,
侏儒兔
Summon
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
神秘庄家
,
draweffect
);
AddExecutor
(
ExecutorType
.
SpellSet
,
CardId
.
暗黑释放
,
圣防
Effect
);
AddExecutor
(
ExecutorType
.
SpellSet
,
CardId
.
暗黑释放
);
AddExecutor
(
ExecutorType
.
SpellSet
,
CardId
.
落穴
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
暗黑释放
,
圣防
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
魔法筒
,
魔法筒
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
炸甲
,
炸甲
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
落穴
,
落穴
Effect
);
...
...
@@ -91,6 +93,9 @@ namespace WindBot.Game.AI.Decks
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
连击龙
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
七星道魔术师
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
斗牛士
,
斗牛士
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
破灭之龙魔导士
,
破灭之龙魔导士
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
星战骑佩流安
,
星战骑佩流安
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
加百列热茶
,
加百列热茶
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
死苏
,
死苏
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
死苏
2
,
死苏
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
DefaultDontChainMyself
);
...
...
@@ -98,15 +103,33 @@ namespace WindBot.Game.AI.Decks
}
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
>
HintMsgForExtra
=
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
.
ToDeck
,
HintMsg
.
Destroy
HintMsg
.
SpSummon
,
HintMsg
.
ToGrave
,
HintMsg
.
AddToHand
,
HintMsg
.
FusionMaterial
,
HintMsg
.
Destroy
,
HintMsg
.
Equip
,
HintMsg
.
Confirm
};
public
override
IList
<
ClientCard
>
OnSelectCard
(
IList
<
ClientCard
>
_cards
,
int
min
,
int
max
,
int
hint
,
bool
cancelable
)
...
...
@@ -135,6 +158,69 @@ namespace WindBot.Game.AI.Decks
}
}
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
(
HintMsgForExtra
.
Contains
(
hint
))
{
IList
<
ClientCard
>
ExtraCards
=
cards
.
Where
(
card
=>
card
.
Location
==
CardLocation
.
Extra
).
ToList
();
// select extra's card first
while
(
ExtraCards
.
Count
>
0
&&
selected
.
Count
<
max
)
{
ClientCard
card
=
ExtraCards
[
Program
.
Rand
.
Next
(
ExtraCards
.
Count
)];
selected
.
Add
(
card
);
ExtraCards
.
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
...
...
@@ -145,8 +231,28 @@ namespace WindBot.Game.AI.Decks
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
;
}
public
override
bool
OnSelectHand
()
{
// go first
...
...
@@ -243,7 +349,7 @@ namespace WindBot.Game.AI.Decks
{
if
(
Bot
.
HasInGraveyard
(
new
[]
{
CardId
.
连击龙
,
CardId
.
青眼白龙
})
&&
Bot
.
MonsterZone
.
GetMatchingCardsCount
(
card
=>
card
.
Level
>
4
)
<
2
&&
(
Bot
.
MonsterZone
.
GetMatchingCardsCount
(
card
=>
card
.
Level
<
5
)
+
Bot
.
Hand
.
GetMatchingCardsCount
(
card
=>
card
.
Level
<
5
))
<
=
2
)
(
Bot
.
MonsterZone
.
GetMatchingCardsCount
(
card
=>
card
.
Level
<
5
)
+
Bot
.
Hand
.
GetMatchingCardsCount
(
card
=>
card
.
Level
<
5
))
>
=
2
)
{
return
true
;
}
...
...
Game/AI/Decks/SaikyoBattleFlagExecutor.cs
View file @
2ad318ae
...
...
@@ -123,16 +123,33 @@ namespace WindBot.Game.AI.Decks
AddExecutor
(
ExecutorType
.
Repos
,
CardId
.
钢机神
,
圣防
Repos
);
}
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
>
HintMsgForExtra
=
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
.
ToDeck
,
HintMsg
.
Destroy
HintMsg
.
SpSummon
,
HintMsg
.
ToGrave
,
HintMsg
.
AddToHand
,
HintMsg
.
FusionMaterial
,
HintMsg
.
Destroy
,
HintMsg
.
Equip
,
HintMsg
.
Confirm
};
public
override
IList
<
ClientCard
>
OnSelectCard
(
IList
<
ClientCard
>
_cards
,
int
min
,
int
max
,
int
hint
,
bool
cancelable
)
...
...
@@ -161,17 +178,99 @@ namespace WindBot.Game.AI.Decks
}
}
if
(
HintMsgForMaxSelect
.
Contains
(
hint
))
if
(
HintMsgForDeck
.
Contains
(
hint
))
{
//select max cards
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
(
HintMsgForExtra
.
Contains
(
hint
))
{
IList
<
ClientCard
>
ExtraCards
=
cards
.
Where
(
card
=>
card
.
Location
==
CardLocation
.
Extra
).
ToList
();
// select extra's card first
while
(
ExtraCards
.
Count
>
0
&&
selected
.
Count
<
max
)
{
ClientCard
card
=
ExtraCards
[
Program
.
Rand
.
Next
(
ExtraCards
.
Count
)];
selected
.
Add
(
card
);
ExtraCards
.
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
;
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
;
}
public
override
bool
OnSelectHand
()
...
...
Game/AI/Decks/TheLegendExecutor.cs
View file @
2ad318ae
...
...
@@ -104,6 +104,9 @@ namespace WindBot.Game.AI.Decks
AddExecutor
(
ExecutorType
.
MonsterSet
,
CardId
.
机器栗子
);
AddExecutor
(
ExecutorType
.
MonsterSet
,
CardId
.
成金恐龙王
);
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
古之规则
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
破灭之龙魔导士
,
破灭之龙魔导士
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
星战骑佩流安
,
星战骑佩流安
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
加百列热茶
,
加百列热茶
Effect
);
AddExecutor
(
ExecutorType
.
Activate
,
DefaultDontChainMyself
);
AddExecutor
(
ExecutorType
.
Repos
,
CardId
.
青眼白龙
,
圣防
Repos
);
AddExecutor
(
ExecutorType
.
Repos
,
CardId
.
破坏之剑士
,
圣防
Repos
);
...
...
@@ -111,20 +114,35 @@ namespace WindBot.Game.AI.Decks
AddExecutor
(
ExecutorType
.
SpellSet
);
//AddExecutor(ExecutorType.Activate, CardId.sionmax, sionmaxEffect);
}
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
>
HintMsgForExtra
=
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
.
ToDeck
,
HintMsg
.
Destroy
HintMsg
.
SpSummon
,
HintMsg
.
ToGrave
,
HintMsg
.
AddToHand
,
HintMsg
.
FusionMaterial
,
HintMsg
.
Destroy
,
HintMsg
.
Equip
,
HintMsg
.
Confirm
};
public
override
IList
<
ClientCard
>
OnSelectCard
(
IList
<
ClientCard
>
_cards
,
int
min
,
int
max
,
int
hint
,
bool
cancelable
)
...
...
@@ -153,6 +171,69 @@ namespace WindBot.Game.AI.Decks
}
}
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
(
HintMsgForExtra
.
Contains
(
hint
))
{
IList
<
ClientCard
>
ExtraCards
=
cards
.
Where
(
card
=>
card
.
Location
==
CardLocation
.
Extra
).
ToList
();
// select extra's card first
while
(
ExtraCards
.
Count
>
0
&&
selected
.
Count
<
max
)
{
ClientCard
card
=
ExtraCards
[
Program
.
Rand
.
Next
(
ExtraCards
.
Count
)];
selected
.
Add
(
card
);
ExtraCards
.
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
...
...
@@ -166,6 +247,25 @@ namespace WindBot.Game.AI.Decks
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
;
}
public
override
bool
OnSelectHand
()
{
// go first
...
...
Game/AI/DefaultExecutor.cs
View file @
2ad318ae
...
...
@@ -12,7 +12,19 @@ namespace WindBot.Game.AI
{
protected
class
_CardId
{
public
const
int
暗黑释放
=
120105013
;
public
const
int
海龙骑士
=
120199032
;
public
const
int
耳语妖精
=
120120018
;
public
const
int
斗牛士
=
120170035
;
public
const
int
结界像
=
120226013
;
public
const
int
终焰魔神
=
120231008
;
public
const
int
最强战旗
=
120181001
;
public
const
int
钢机神
=
120155015
;
public
const
int
破灭之龙魔导士
=
120231049
;
public
const
int
星战骑佩流安
=
120109014
;
public
const
int
加百列热茶
=
120151039
;
public
const
int
武枪
=
120231052
;
public
const
int
连击龙
=
120110001
;
public
const
int
死苏
=
120194004
;
public
const
int
死苏
2
=
120195004
;
public
const
int
死供
=
120151023
;
...
...
@@ -24,26 +36,36 @@ namespace WindBot.Game.AI
public
const
int
激流葬
=
1202223105
;
public
const
int
炸甲
=
120194005
;
public
const
int
落穴
=
120150019
;
public
const
int
暗黑释放
=
120105013
;
public
const
int
疾风弹
=
120203028
;
public
const
int
HMD
=
120130041
;
public
const
int
海龙骑士
=
120199032
;
public
const
int
耳语妖精
=
120120018
;
public
const
int
人造人
=
120155000
;
public
const
int
狼人
=
120214004
;
public
const
int
幻影之龙
=
120223102
;
public
const
int
幻影之龙
=
120223102
;
public
const
int
手枪龙
=
120208000
;
public
const
int
伟大魔兽
=
120238019
;
public
const
int
青眼白龙
=
120120000
;
public
const
int
黑魔术师
=
120130000
;
public
const
int
破坏之剑士
=
120170000
;
public
const
int
连击龙
=
120110001
;
public
const
int
千年盾
=
120194001
;
public
const
int
血腥魔兽人
=
120194002
;
public
const
int
圣精灵
=
120194003
;
public
const
int
结界像
=
120226013
;
public
const
int
终焰魔神
=
120231008
;
public
const
int
最强战旗
=
120181001
;
public
const
int
钢机神
=
120155015
;
public
const
int
苍救升
=
120235025
;
public
const
int
苍救降
=
120235024
;
public
const
int
苍救之闪光
=
120235038
;
public
const
int
苍救之泡影
=
120235039
;
public
const
int
苍救之一闪
=
120235040
;
public
const
int
苍救之幻影
=
120235041
;
public
const
int
天翔流那
=
120203011
;
public
const
int
天翔流丽雅
=
120199036
;
public
const
int
天翔流丽谢
=
120205036
;
public
const
int
传说战士
=
120235029
;
public
const
int
升阵
=
120228059
;
public
const
int
苍救之证
=
120235054
;
public
const
int
JizukirutheStarDestroyingKaiju
=
63941210
;
public
const
int
ThunderKingtheLightningstrikeKaiju
=
48770333
;
public
const
int
DogorantheMadFlameKaiju
=
93332803
;
...
...
@@ -354,6 +376,57 @@ namespace WindBot.Game.AI
return
true
;
}
protected
bool
传说战士
Effect
()
{
IList
<
ClientCard
>
targets
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
card
in
Bot
.
GetGraveyardSpells
())
{
if
(
card
.
HasType
(
CardType
.
Equip
))
targets
.
Add
(
card
);
}
AI
.
SelectCard
(
targets
);
return
true
;
}
protected
bool
苍救升
Effect
()
{
IList
<
ClientCard
>
targets
=
new
List
<
ClientCard
>();
foreach
(
ClientCard
card
in
Bot
.
GetMonstersInExtraZone
())
{
if
(
card
.
Level
==
9
)
targets
.
Add
(
card
);
}
AI
.
SelectCard
(
targets
);
return
true
;
}
protected
bool
苍救降
Effect
()
{
ClientCard
e
=
Util
.
GetBestEnemyMonster
(
true
,
true
);
IList
<
int
>
targets
=
new
[]
{
_CardId
.
苍救之泡影
,
_CardId
.
苍救之一闪
,
_CardId
.
苍救之闪光
,
_CardId
.
苍救之幻影
,
_CardId
.
天翔流那
,
_CardId
.
天翔流丽谢
,
_CardId
.
天翔流丽雅
};
AI
.
SelectCard
(
targets
);
//AI.SelectCard(_CardId.苍救之泡影 , _CardId.苍救之一闪 , _CardId.苍救之闪光 ,_CardId.苍救之幻影 , _CardId.天翔流那 , _CardId.天翔流丽谢 , _CardId.天翔流丽雅);
// AI.SelectNextCard(e);
return
true
;
}
protected
bool
星战骑佩流安
Effect
()
{
AI
.
SelectCard
(
Bot
.
GetMonsters
().
GetHighestAttackMonster
());
AI
.
SelectNextCard
(
Enemy
.
GetMonsters
().
GetLowestLevelMonster
());
return
true
;
}
protected
bool
加百列热茶
Effect
()
{
foreach
(
ClientCard
m
in
Bot
.
Hand
)
AI
.
SelectCard
(
m
);
AI
.
SelectNextCard
(
Bot
.
GetMonsters
().
GetHighestAttackMonster
());
return
true
;
}
protected
bool
破灭之龙魔导士
Effect
()
{
foreach
(
ClientCard
m
in
Bot
.
GetGraveyardMonsters
())
AI
.
SelectCard
(
m
);
AI
.
SelectNextCard
(
Bot
.
GetMonsters
().
GetHighestAttackMonster
());
return
true
;
}
protected
bool
斗牛士
Effect
()
{
{
...
...
@@ -363,7 +436,6 @@ namespace WindBot.Game.AI
AI
.
SelectNextCard
(
Enemy
.
MonsterZone
.
GetHighestAttackMonster
());
return
true
;
}
}
protected
bool
海龙骑士
Effect
()
{
...
...
@@ -471,13 +543,81 @@ namespace WindBot.Game.AI
protected
bool
圣防
Repos
()
{
if
(
Enemy
.
Graveyard
.
GetMatchingCardsCount
(
card
=>
(
card
.
Race
&
(
int
)
CardRace
.
SpellCaster
)
>
0
)
>=
4
&&
Enemy
.
GetSpellCountWithoutField
()
>=
1
&&
!
Bot
.
HasInMonstersZone
(
new
[]{
_CardId
.
人造人
,
_CardId
.
狼人
,
_CardId
.
幻影之龙
})
&&
Enemy
.
Graveyard
.
GetMatchingCardsCount
(
card
=>
card
.
IsCode
(
_CardId
.
暗黑释放
))
<
3
)
&&
!
Bot
.
HasInMonstersZone
(
new
[]{
_CardId
.
人造人
,
_CardId
.
狼人
,
_CardId
.
武枪
,
_CardId
.
幻影之龙
})
&&
Enemy
.
Graveyard
.
GetMatchingCardsCount
(
card
=>
card
.
IsCode
(
_CardId
.
暗黑释放
))
<
3
)
{
if
(
Bot
.
MonsterZone
.
GetMatchingCardsCount
(
card
=>
card
.
IsAttack
()
&&
card
.
Level
>
5
)
>=
2
&&
!
Bot
.
HasDefendingMonster
())
return
true
;
}
return
false
;
}
protected
bool
装备
Effect
()
{
//if (Executors.Any(exec => exec.Type == Type && exec.CardId == Card.Id))
// return false;
if
(!
Card
.
HasType
(
CardType
.
Equip
))
return
false
;
List
<
ClientCard
>
cards
=
new
List
<
ClientCard
>(
Bot
.
MonsterZone
.
GetMonsters
());
cards
.
Sort
(
CardContainer
.
CompareCardLevel
);
ClientCard
selectedCard
=
null
;
for
(
int
i
=
cards
.
Count
-
1
;
i
>=
0
;
--
i
)
{
ClientCard
card
=
cards
[
i
];
if
(
card
.
Level
<
5
)
break
;
if
(
card
.
IsMonster
())
{
selectedCard
=
card
;
break
;
}
}
if
(
selectedCard
!=
null
)
{
AI
.
SelectCard
(
selectedCard
);
return
true
;
}
return
false
;
/* ClientCard mon = Bot.MonsterZone.GetFirstMatchingCard(card => card.Level >= 6);
{
if (mon.Level >= 8)
AI.SelectCard(mon);
else if (mon.Level >= 6)
AI.SelectCard(mon);
else return false;
}
return Card.HasType(CardType.Equip);*/
}
protected
bool
装备
act
()
{
List
<
ClientCard
>
cards
=
new
List
<
ClientCard
>(
Bot
.
MonsterZone
.
GetMonsters
());
cards
.
Sort
(
CardContainer
.
CompareCardLevel
);
ClientCard
selectedCard
=
null
;
for
(
int
i
=
cards
.
Count
-
1
;
i
>=
0
;
--
i
)
{
ClientCard
card
=
cards
[
i
];
if
(
card
.
Level
<
5
)
break
;
if
(
card
.
IsMonster
())
{
selectedCard
=
card
;
break
;
}
}
if
(
selectedCard
!=
null
)
{
AI
.
SelectCard
(
selectedCard
);
return
true
;
}
return
false
;
/* ClientCard mon = Bot.MonsterZone.GetFirstMatchingCard(card => card.Level >= 6);
{
if (mon.Level >= 8)
AI.SelectCard(mon);
else if (mon.Level >= 6)
AI.SelectCard(mon);
else return false;
}
return Card.HasType(CardType.Equip);*/
}
protected
bool
死苏
Effect
()
{
...
...
@@ -512,7 +652,7 @@ namespace WindBot.Game.AI
}
protected
bool
死供
Effect
()
{
if
(
Util
.
IsOneEnemyBetterThanValue
(
1900
,
false
))
if
(
Util
.
IsOneEnemyBetterThanValue
(
1900
,
false
)
&&
!
Enemy
.
HasInMonstersZone
(
_CardId
.
终焰魔神
)
)
{
foreach
(
ClientCard
m
in
Bot
.
Hand
)
AI
.
SelectCard
(
m
);
...
...
@@ -542,7 +682,7 @@ namespace WindBot.Game.AI
}
protected
bool
圣防
Effect
()
{
if
(
Util
.
GetTotalAttackingMonsterAttack
(
1
)
>
1900
&&
!
Enemy
.
BattlingMonster
.
IsMonsterImmuneTrap
(
))
return
true
;
if
(
Util
.
GetTotalAttackingMonsterAttack
(
1
)
>
=
1900
&&
(
Enemy
.
GetMonsters
().
GetImmuneTrapMonster
()
==
null
))
return
true
;
if
(
Util
.
GetTotalAttackingMonsterAttack
(
1
)
-
Util
.
GetTotalAttackingMonsterAttack
(
0
)
>
Bot
.
LifePoints
&&
!
Bot
.
HasDefendingMonster
())
return
true
;
return
false
;
}
...
...
@@ -550,19 +690,19 @@ namespace WindBot.Game.AI
{
foreach
(
ClientCard
n
in
Duel
.
LastSummonedCards
)
{
if
(
n
.
Attack
>=
1900
)
return
true
;
if
(
Util
.
GetTotalAttackingMonsterAttack
(
1
)
-
Util
.
GetTotalAttackingMonsterAttack
(
0
)
>
Bot
.
LifePoints
&&
!
Bot
.
HasDefendingMonster
())
return
true
;
if
(
n
.
Attack
>=
1900
&&
!
n
.
IsCode
(
_CardId
.
武枪
)
)
return
true
;
if
(
Util
.
GetTotalAttackingMonsterAttack
(
1
)
-
Util
.
GetTotalAttackingMonsterAttack
(
0
)
>
Bot
.
LifePoints
&&
!
Bot
.
HasDefendingMonster
()
&&
!
n
.
IsCode
(
_CardId
.
武枪
)
)
return
true
;
}
return
false
;
}
protected
bool
激流葬
Effect
()
{
return
!
Util
.
HasChainedTrap
(
0
)
&&
Util
.
IsAllEnemyBetter
(
true
);
return
!
Util
.
HasChainedTrap
(
0
)
&&
Util
.
IsAllEnemyBetter
(
true
)
&&
(
Enemy
.
GetMonsters
().
GetImmuneTrapMonster
()
==
null
)
;
}
protected
bool
炸甲
Effect
()
{
if
(
Enemy
.
BattlingMonster
.
Attack
>
2000
&&
!
Enemy
.
BattlingMonster
.
IsMonsterImmuneTrap
(
))
return
true
;
if
(
Enemy
.
BattlingMonster
.
Attack
>
2000
&&
(
Enemy
.
GetMonsters
().
GetImmuneTrapMonster
()
==
null
))
return
true
;
if
(
Bot
.
LifePoints
<=
Enemy
.
BattlingMonster
.
Attack
)
return
true
;
if
(!
Util
.
IsOneEnemyBetterThanValue
(
1500
,
true
)
&&
Bot
.
GetSpellCountWithoutField
()
==
3
)
return
true
;
return
false
;
...
...
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