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
nanahira
windbot
Commits
b56e66dc
Commit
b56e66dc
authored
Apr 26, 2019
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move GetMatchingCards, add GetMatchingCardsCount
parent
c2a94e8e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
16 deletions
+26
-16
Game/AI/AIUtil.cs
Game/AI/AIUtil.cs
+0
-5
Game/AI/CardContainer.cs
Game/AI/CardContainer.cs
+15
-0
Game/AI/Decks/RainbowExecutor.cs
Game/AI/Decks/RainbowExecutor.cs
+11
-11
No files found.
Game/AI/AIUtil.cs
View file @
b56e66dc
...
...
@@ -219,11 +219,6 @@ namespace WindBot.Game.AI
return
null
;
}
public
IList
<
ClientCard
>
GetMatchingCards
(
IList
<
ClientCard
>
cards
,
Func
<
ClientCard
,
bool
>
filter
)
{
return
cards
.
Where
(
card
=>
card
!=
null
&&
filter
(
card
)).
ToList
();
}
public
ClientCard
GetPZone
(
int
player
,
int
id
)
{
if
(
Duel
.
IsNewRule
)
...
...
Game/AI/CardContainer.cs
View file @
b56e66dc
...
...
@@ -116,6 +116,21 @@ namespace WindBot.Game.AI
return
cards
.
FirstOrDefault
(
card
=>
card
?.
Data
!=
null
&&
card
.
IsFaceup
()
&&
filter
.
Invoke
(
card
));
}
public
static
IList
<
ClientCard
>
GetMatchingCards
(
this
IEnumerable
<
ClientCard
>
cards
,
Func
<
ClientCard
,
bool
>
filter
)
{
return
cards
.
Where
(
card
=>
card
?.
Data
!=
null
&&
filter
.
Invoke
(
card
)).
ToList
();
}
public
static
int
GetMatchingCardsCount
(
this
IEnumerable
<
ClientCard
>
cards
,
Func
<
ClientCard
,
bool
>
filter
)
{
return
cards
.
Count
(
card
=>
card
?.
Data
!=
null
&&
filter
.
Invoke
(
card
));
}
public
static
bool
IsExistingMatchingCard
(
this
IEnumerable
<
ClientCard
>
cards
,
Func
<
ClientCard
,
bool
>
filter
,
int
count
=
1
)
{
return
cards
.
GetMatchingCardsCount
(
filter
)
>=
count
;
}
public
static
ClientCard
GetShouldBeDisabledBeforeItUseEffectMonster
(
this
IEnumerable
<
ClientCard
>
cards
,
bool
canBeTarget
=
true
)
{
return
cards
.
FirstOrDefault
(
card
=>
card
?.
Data
!=
null
&&
card
.
IsMonsterShouldBeDisabledBeforeItUseEffect
()
&&
card
.
IsFaceup
()
&&
(!
canBeTarget
||
!
card
.
IsShouldNotBeTarget
()));
...
...
Game/AI/Decks/RainbowExecutor.cs
View file @
b56e66dc
using
System
;
using
System
;
using
YGOSharp.OCGWrapper.Enums
;
using
System.Collections.Generic
;
using
WindBot
;
using
WindBot.Game
;
using
WindBot.Game.AI
;
namespace
WindBot.Game.AI.Decks
{
[
Deck
(
"Rainbow"
,
"AI_Rainbow"
)]
...
...
@@ -137,8 +137,8 @@ namespace WindBot.Game.AI.Decks
AddExecutor
(
ExecutorType
.
Activate
,
CardId
.
TraptrixTrapHoleNightmare
,
DefaultUniqueTrap
);
AddExecutor
(
ExecutorType
.
Repos
,
DefaultMonsterRepos
);
}
}
public
override
void
OnNewTurn
()
{
NormalSummoned
=
false
;
...
...
@@ -207,13 +207,13 @@ namespace WindBot.Game.AI.Decks
}
return
true
;
}
private
bool
RescueRabbitSummon
()
{
return
Util
.
GetBotAvailZonesFromExtraDeck
()
>
0
||
Util
.
GetMatchingCards
(
Enemy
.
MonsterZone
,
card
=>
card
.
GetDefensePower
()
>=
1900
).
Count
==
0
||
Util
.
GetMatchingCards
(
Enemy
.
MonsterZone
,
card
=>
card
.
GetDefensePower
()
<
1900
).
Count
>
Util
.
GetMatchingCards
(
Bot
.
MonsterZone
,
card
=>
card
.
Attack
>=
1900
).
Count
;
}
private
bool
RescueRabbitSummon
()
{
return
Util
.
GetBotAvailZonesFromExtraDeck
()
>
0
||
!
Enemy
.
MonsterZone
.
IsExistingMatchingCard
(
card
=>
card
.
GetDefensePower
()
>=
1900
)
||
Enemy
.
MonsterZone
.
GetMatchingCardsCount
(
card
=>
card
.
GetDefensePower
()
<
1900
)
>
Bot
.
MonsterZone
.
GetMatchingCardsCount
(
card
=>
card
.
Attack
>=
1900
);
}
private
bool
RescueRabbitEffect
()
{
...
...
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