Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
W
windbot
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
windbot
Commits
2ad318ae
Commit
2ad318ae
authored
Feb 08, 2023
by
苍蓝
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
780b6d6c
Pipeline
#20009
passed with stage
in 24 seconds
Changes
8
Pipelines
1
Expand all
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
This diff is collapsed.
Click to expand it.
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