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
alstroemeria-silentlove
windbot
Commits
47f5ca86
Commit
47f5ca86
authored
Aug 27, 2018
by
mercury233
Committed by
GitHub
Aug 27, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor DefaultExecutor (#92)
parent
07a0649a
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
184 additions
and
253 deletions
+184
-253
Game/AI/AIFunctions.cs
Game/AI/AIFunctions.cs
+5
-0
Game/AI/Decks/LightswornExecutor.cs
Game/AI/Decks/LightswornExecutor.cs
+1
-0
Game/AI/DefaultExecutor.cs
Game/AI/DefaultExecutor.cs
+166
-241
Game/ClientField.cs
Game/ClientField.cs
+12
-12
No files found.
Game/AI/AIFunctions.cs
View file @
47f5ca86
...
...
@@ -280,6 +280,11 @@ namespace WindBot.Game.AI
return
Duel
.
CurrentChain
.
Any
(
card
=>
card
.
Id
==
id
);
}
public
bool
ChainContainsCard
(
int
[]
ids
)
{
return
Duel
.
CurrentChain
.
Any
(
card
=>
ids
.
Contains
(
card
.
Id
));
}
public
int
ChainCountPlayer
(
int
player
)
{
return
Duel
.
CurrentChain
.
Count
(
card
=>
card
.
Controller
==
player
);
...
...
Game/AI/Decks/LightswornExecutor.cs
View file @
47f5ca86
...
...
@@ -91,6 +91,7 @@ namespace WindBot.Game.AI.Decks
public
override
void
OnNewTurn
()
{
ClownUsed
=
false
;
base
.
OnNewTurn
();
}
public
override
bool
OnPreBattleBetween
(
ClientCard
attacker
,
ClientCard
defender
)
...
...
Game/AI/DefaultExecutor.cs
View file @
47f5ca86
This diff is collapsed.
Click to expand it.
Game/ClientField.cs
View file @
47f5ca86
...
...
@@ -198,24 +198,24 @@ namespace WindBot.Game
return
GetMonsters
().
Any
(
card
=>
card
.
IsDefense
());
}
public
bool
HasInMonstersZone
(
int
cardId
,
bool
notDisabled
=
false
,
bool
hasXyzMaterial
=
false
)
public
bool
HasInMonstersZone
(
int
cardId
,
bool
notDisabled
=
false
,
bool
hasXyzMaterial
=
false
,
bool
faceUp
=
false
)
{
return
HasInCards
(
MonsterZone
,
cardId
,
notDisabled
,
hasXyzMaterial
);
return
HasInCards
(
MonsterZone
,
cardId
,
notDisabled
,
hasXyzMaterial
,
faceUp
);
}
public
bool
HasInMonstersZone
(
IList
<
int
>
cardId
,
bool
notDisabled
=
false
,
bool
hasXyzMaterial
=
false
)
public
bool
HasInMonstersZone
(
IList
<
int
>
cardId
,
bool
notDisabled
=
false
,
bool
hasXyzMaterial
=
false
,
bool
faceUp
=
false
)
{
return
HasInCards
(
MonsterZone
,
cardId
,
notDisabled
,
hasXyzMaterial
);
return
HasInCards
(
MonsterZone
,
cardId
,
notDisabled
,
hasXyzMaterial
,
faceUp
);
}
public
bool
HasInSpellZone
(
int
cardId
,
bool
notDisabled
=
false
)
public
bool
HasInSpellZone
(
int
cardId
,
bool
notDisabled
=
false
,
bool
faceUp
=
false
)
{
return
HasInCards
(
SpellZone
,
cardId
,
notDisabled
);
return
HasInCards
(
SpellZone
,
cardId
,
notDisabled
,
false
,
faceUp
);
}
public
bool
HasInSpellZone
(
IList
<
int
>
cardId
,
bool
notDisabled
=
false
)
public
bool
HasInSpellZone
(
IList
<
int
>
cardId
,
bool
notDisabled
=
false
,
bool
faceUp
=
false
)
{
return
HasInCards
(
SpellZone
,
cardId
,
notDisabled
);
return
HasInCards
(
SpellZone
,
cardId
,
notDisabled
,
false
,
faceUp
);
}
public
bool
HasInHandOrInSpellZone
(
int
cardId
)
...
...
@@ -323,14 +323,14 @@ namespace WindBot.Game
return
cards
.
Where
(
card
=>
card
!=
null
).
ToList
();
}
private
static
bool
HasInCards
(
IEnumerable
<
ClientCard
>
cards
,
int
cardId
,
bool
notDisabled
=
false
,
bool
hasXyzMaterial
=
false
)
private
static
bool
HasInCards
(
IEnumerable
<
ClientCard
>
cards
,
int
cardId
,
bool
notDisabled
=
false
,
bool
hasXyzMaterial
=
false
,
bool
faceUp
=
false
)
{
return
cards
.
Any
(
card
=>
card
!=
null
&&
card
.
Id
==
cardId
&&
!(
notDisabled
&&
card
.
IsDisabled
())
&&
!(
hasXyzMaterial
&&
!
card
.
HasXyzMaterial
()));
return
cards
.
Any
(
card
=>
card
!=
null
&&
card
.
Id
==
cardId
&&
!(
notDisabled
&&
card
.
IsDisabled
())
&&
!(
hasXyzMaterial
&&
!
card
.
HasXyzMaterial
())
&&
!(
faceUp
&&
card
.
IsFacedown
())
);
}
private
static
bool
HasInCards
(
IEnumerable
<
ClientCard
>
cards
,
IList
<
int
>
cardId
,
bool
notDisabled
=
false
,
bool
hasXyzMaterial
=
false
)
private
static
bool
HasInCards
(
IEnumerable
<
ClientCard
>
cards
,
IList
<
int
>
cardId
,
bool
notDisabled
=
false
,
bool
hasXyzMaterial
=
false
,
bool
faceUp
=
false
)
{
return
cards
.
Any
(
card
=>
card
!=
null
&&
cardId
.
Contains
(
card
.
Id
)
&&
!(
notDisabled
&&
card
.
IsDisabled
())
&&
!(
hasXyzMaterial
&&
!
card
.
HasXyzMaterial
()));
return
cards
.
Any
(
card
=>
card
!=
null
&&
cardId
.
Contains
(
card
.
Id
)
&&
!(
notDisabled
&&
card
.
IsDisabled
())
&&
!(
hasXyzMaterial
&&
!
card
.
HasXyzMaterial
())
&&
!(
faceUp
&&
card
.
IsFacedown
())
);
}
}
}
\ No newline at end of file
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