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
0d0f6f9f
Commit
0d0f6f9f
authored
Aug 20, 2018
by
handsomekiwi
Committed by
mercury233
Aug 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update AI.SelectCard, use array to store Selectors (#59)
parent
91b1f962
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
82 additions
and
32 deletions
+82
-32
Game/GameAI.cs
Game/GameAI.cs
+82
-32
No files found.
Game/GameAI.cs
View file @
0d0f6f9f
...
...
@@ -91,9 +91,8 @@ namespace WindBot.Game
/// </summary>
public
void
OnNewPhase
()
{
m_selector
=
null
;
m_nextSelector
=
null
;
m_thirdSelector
=
null
;
m_selector
.
Clear
();
m_selector_pointer
=
-
1
;
m_materialSelector
=
null
;
m_option
=
-
1
;
m_yesno
=
-
1
;
...
...
@@ -129,6 +128,8 @@ namespace WindBot.Game
/// </summary>
public
void
OnChainEnd
()
{
m_selector
.
Clear
();
m_selector_pointer
=
-
1
;
Executor
.
OnChainEnd
();
}
...
...
@@ -721,9 +722,7 @@ namespace WindBot.Game
// _ Others functions _
// Those functions are used by the AI behavior.
private
CardSelector
m_selector
;
private
CardSelector
m_nextSelector
;
private
CardSelector
m_thirdSelector
;
private
CardSelector
m_materialSelector
;
private
CardPosition
m_position
=
CardPosition
.
FaceUpAttack
;
private
int
m_place
;
...
...
@@ -732,81 +731,138 @@ namespace WindBot.Game
private
int
m_announce
;
private
int
m_yesno
;
private
IList
<
CardAttribute
>
m_attributes
=
new
List
<
CardAttribute
>();
private
IList
<
CardSelector
>
m_selector
=
new
List
<
CardSelector
>();
private
int
m_selector_pointer
=
-
1
;
private
IList
<
CardRace
>
m_races
=
new
List
<
CardRace
>();
public
void
SelectCard
(
ClientCard
card
)
{
m_selector
=
new
CardSelector
(
card
);
m_selector_pointer
=
m_selector
.
Count
();
m_selector
.
Add
(
new
CardSelector
(
card
));
}
public
void
SelectCard
(
IList
<
ClientCard
>
cards
)
{
m_selector
=
new
CardSelector
(
cards
);
m_selector_pointer
=
m_selector
.
Count
();
m_selector
.
Add
(
new
CardSelector
(
cards
));
}
public
void
SelectCard
(
int
cardId
)
{
m_selector
=
new
CardSelector
(
cardId
);
m_selector_pointer
=
m_selector
.
Count
();
m_selector
.
Add
(
new
CardSelector
(
cardId
));
}
public
void
SelectCard
(
IList
<
int
>
ids
)
{
m_selector
=
new
CardSelector
(
ids
);
m_selector_pointer
=
m_selector
.
Count
();
m_selector
.
Add
(
new
CardSelector
(
ids
));
}
public
void
SelectCard
(
CardLocation
loc
)
{
m_selector
=
new
CardSelector
(
loc
);
m_selector_pointer
=
m_selector
.
Count
();
m_selector
.
Add
(
new
CardSelector
(
loc
));
}
public
void
SelectNextCard
(
ClientCard
card
)
{
m_nextSelector
=
new
CardSelector
(
card
);
if
(
m_selector_pointer
==
-
1
)
{
Logger
.
WriteErrorLine
(
"Error: Call SelectNextCard() before SelectCard()"
);
m_selector_pointer
=
0
;
}
m_selector
.
Insert
(
m_selector_pointer
,
new
CardSelector
(
card
));
}
public
void
SelectNextCard
(
IList
<
ClientCard
>
cards
)
{
m_nextSelector
=
new
CardSelector
(
cards
);
if
(
m_selector_pointer
==
-
1
)
{
Logger
.
WriteErrorLine
(
"Error: Call SelectNextCard() before SelectCard()"
);
m_selector_pointer
=
0
;
}
m_selector
.
Insert
(
m_selector_pointer
,
new
CardSelector
(
cards
));
}
public
void
SelectNextCard
(
int
cardId
)
{
m_nextSelector
=
new
CardSelector
(
cardId
);
if
(
m_selector_pointer
==
-
1
)
{
Logger
.
WriteErrorLine
(
"Error: Call SelectNextCard() before SelectCard()"
);
m_selector_pointer
=
0
;
}
m_selector
.
Insert
(
m_selector_pointer
,
new
CardSelector
(
cardId
));
}
public
void
SelectNextCard
(
IList
<
int
>
ids
)
{
m_nextSelector
=
new
CardSelector
(
ids
);
if
(
m_selector_pointer
==
-
1
)
{
Logger
.
WriteErrorLine
(
"Error: Call SelectNextCard() before SelectCard()"
);
m_selector_pointer
=
0
;
}
m_selector
.
Insert
(
m_selector_pointer
,
new
CardSelector
(
ids
));
}
public
void
SelectNextCard
(
CardLocation
loc
)
{
m_nextSelector
=
new
CardSelector
(
loc
);
if
(
m_selector_pointer
==
-
1
)
{
Logger
.
WriteErrorLine
(
"Error: Call SelectNextCard() before SelectCard()"
);
m_selector_pointer
=
0
;
}
m_selector
.
Insert
(
m_selector_pointer
,
new
CardSelector
(
loc
));
}
public
void
SelectThirdCard
(
ClientCard
card
)
{
m_thirdSelector
=
new
CardSelector
(
card
);
if
(
m_selector_pointer
==
-
1
)
{
Logger
.
WriteErrorLine
(
"Error: Call SelectThirdCard() before SelectCard()"
);
m_selector_pointer
=
0
;
}
m_selector
.
Insert
(
m_selector_pointer
,
new
CardSelector
(
card
));
}
public
void
SelectThirdCard
(
IList
<
ClientCard
>
cards
)
{
m_thirdSelector
=
new
CardSelector
(
cards
);
if
(
m_selector_pointer
==
-
1
)
{
Logger
.
WriteErrorLine
(
"Error: Call SelectThirdCard() before SelectCard()"
);
m_selector_pointer
=
0
;
}
m_selector
.
Insert
(
m_selector_pointer
,
new
CardSelector
(
cards
));
}
public
void
SelectThirdCard
(
int
cardId
)
{
m_thirdSelector
=
new
CardSelector
(
cardId
);
if
(
m_selector_pointer
==
-
1
)
{
Logger
.
WriteErrorLine
(
"Error: Call SelectThirdCard() before SelectCard()"
);
m_selector_pointer
=
0
;
}
m_selector
.
Insert
(
m_selector_pointer
,
new
CardSelector
(
cardId
));
}
public
void
SelectThirdCard
(
IList
<
int
>
ids
)
{
m_thirdSelector
=
new
CardSelector
(
ids
);
if
(
m_selector_pointer
==
-
1
)
{
Logger
.
WriteErrorLine
(
"Error: Call SelectThirdCard() before SelectCard()"
);
m_selector_pointer
=
0
;
}
m_selector
.
Insert
(
m_selector_pointer
,
new
CardSelector
(
ids
));
}
public
void
SelectThirdCard
(
CardLocation
loc
)
{
m_thirdSelector
=
new
CardSelector
(
loc
);
if
(
m_selector_pointer
==
-
1
)
{
Logger
.
WriteErrorLine
(
"Error: Call SelectThirdCard() before SelectCard()"
);
m_selector_pointer
=
0
;
}
m_selector
.
Insert
(
m_selector_pointer
,
new
CardSelector
(
loc
));
}
public
void
SelectMaterials
(
ClientCard
card
)
...
...
@@ -841,17 +897,11 @@ namespace WindBot.Game
public
CardSelector
GetSelectedCards
()
{
CardSelector
selected
=
m_selector
;
m_selector
=
null
;
if
(
m_nextSelector
!=
null
)
CardSelector
selected
=
null
;
if
(
m_selector
.
Count
>
0
)
{
m_selector
=
m_nextSelector
;
m_nextSelector
=
null
;
if
(
m_thirdSelector
!=
null
)
{
m_nextSelector
=
m_thirdSelector
;
m_thirdSelector
=
null
;
}
selected
=
m_selector
[
m_selector
.
Count
-
1
];
m_selector
.
RemoveAt
(
m_selector
.
Count
-
1
);
}
return
selected
;
}
...
...
@@ -1004,4 +1054,4 @@ namespace WindBot.Game
return
false
;
}
}
}
\ 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