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
7e8bc837
Commit
7e8bc837
authored
Sep 18, 2024
by
Tang Xinwei
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
发牌姬第二期AI智力修复:盖谜题、时间魔术师、链接召唤过滤、宝箱怪逻辑
+ 检测宝箱怪是否要攻击
parent
8b859976
Pipeline
#29862
failed with stages
in 45 seconds
Changes
2
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
828 additions
and
679 deletions
+828
-679
Game/AI/DefaultExecutor.cs
Game/AI/DefaultExecutor.cs
+811
-665
Game/GameAI.cs
Game/GameAI.cs
+17
-14
No files found.
Game/AI/DefaultExecutor.cs
View file @
7e8bc837
This diff is collapsed.
Click to expand it.
Game/GameAI.cs
View file @
7e8bc837
using
System.Linq
;
using
System.Linq
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Threading
;
using
WindBot.Game.AI
;
using
WindBot.Game.AI
;
using
YGOSharp.OCGWrapper.Enums
;
using
YGOSharp.OCGWrapper.Enums
;
using
System
;
using
System.Threading
;
namespace
WindBot.Game
namespace
WindBot.Game
{
{
...
@@ -49,9 +50,6 @@ namespace WindBot.Game
...
@@ -49,9 +50,6 @@ namespace WindBot.Game
public
void
OnDeckError
(
string
card
)
public
void
OnDeckError
(
string
card
)
{
{
_dialogs
.
SendDeckSorry
(
card
);
_dialogs
.
SendDeckSorry
(
card
);
Thread
.
Sleep
(
1000
);
_dialogs
.
SendSurrender
();
Game
.
Connection
.
Close
();
}
}
/// <summary>
/// <summary>
...
@@ -237,10 +235,10 @@ namespace WindBot.Game
...
@@ -237,10 +235,10 @@ namespace WindBot.Game
if
(
result
!=
null
)
if
(
result
!=
null
)
return
result
;
return
result
;
if
(
attackers
.
Count
==
0
)
if
(
attackers
.
Count
==
0
)
//如果自己场上没有可以攻击的怪兽直接返回
return
ToMainPhase2
();
return
ToMainPhase2
();
if
(
defenders
.
Count
==
0
)
if
(
defenders
.
Count
==
0
)
//如果对方场上没有怪兽则直接攻击
{
{
// Attack with the monster with the lowest attack first
// Attack with the monster with the lowest attack first
ClientCard
attacker
=
attackers
[
attackers
.
Count
-
1
];
ClientCard
attacker
=
attackers
[
attackers
.
Count
-
1
];
...
@@ -248,17 +246,17 @@ namespace WindBot.Game
...
@@ -248,17 +246,17 @@ namespace WindBot.Game
}
}
else
else
{
{
for
(
int
k
=
0
;
k
<
attackers
.
Count
;
++
k
)
for
(
int
k
=
0
;
k
<
attackers
.
Count
;
++
k
)
//如果对方场上有怪兽
{
{
ClientCard
attacker
=
attackers
[
k
];
ClientCard
attacker
=
attackers
[
k
];
attacker
.
IsLastAttacker
=
(
k
==
attackers
.
Count
-
1
);
attacker
.
IsLastAttacker
=
(
k
==
attackers
.
Count
-
1
);
result
=
Executor
.
OnSelectAttackTarget
(
attacker
,
defenders
);
result
=
Executor
.
OnSelectAttackTarget
(
attacker
,
defenders
);
//这个函数决定是否要攻击
if
(
result
!=
null
)
if
(
result
!=
null
)
return
result
;
return
result
;
}
}
}
}
if
(!
battle
.
CanMainPhaseTwo
)
if
(!
battle
.
CanMainPhaseTwo
)
//如果不能进战阶强制攻击
return
Attack
(
attackers
[
0
],
(
defenders
.
Count
==
0
)
?
null
:
defenders
[
0
]);
return
Attack
(
attackers
[
0
],
(
defenders
.
Count
==
0
)
?
null
:
defenders
[
0
]);
return
ToMainPhase2
();
return
ToMainPhase2
();
...
@@ -756,7 +754,7 @@ namespace WindBot.Game
...
@@ -756,7 +754,7 @@ namespace WindBot.Game
sorted
.
Sort
(
CardContainer
.
CompareCardAttack
);
sorted
.
Sort
(
CardContainer
.
CompareCardAttack
);
IList
<
ClientCard
>
selected
=
new
List
<
ClientCard
>();
IList
<
ClientCard
>
selected
=
new
List
<
ClientCard
>();
for
(
int
i
=
0
;
i
<
min
&&
i
<
sorted
.
Count
;
++
i
)
for
(
int
i
=
0
;
i
<
min
&&
i
<
sorted
.
Count
;
++
i
)
selected
.
Add
(
sorted
[
i
]);
selected
.
Add
(
sorted
[
i
]);
...
@@ -1174,10 +1172,15 @@ namespace WindBot.Game
...
@@ -1174,10 +1172,15 @@ namespace WindBot.Game
if
(!
Executor
.
OnPreActivate
(
card
))
if
(!
Executor
.
OnPreActivate
(
card
))
return
false
;
return
false
;
}
}
bool
result
=
card
!=
null
&&
exec
.
Type
==
type
&&
Func
<
bool
>
Func
=
()
=>
(
exec
.
CardId
==
-
1
||
exec
.
CardId
==
card
.
Id
)
&&
{
(
exec
.
Func
==
null
||
exec
.
Func
());
if
(
Executor
.
FuncFilters
.
ContainsKey
(
exec
.
Type
)
&&
Executor
.
FuncFilters
[
exec
.
Type
]
!=
null
if
(
card
.
Id
!=
0
&&
type
==
ExecutorType
.
Activate
&&
result
)
&&
!
Executor
.
FuncFilters
[
exec
.
Type
]())
return
false
;
return
exec
.
Func
==
null
||
exec
.
Func
();
};
bool
result
=
card
!=
null
&&
exec
.
Type
==
type
&&
(
exec
.
CardId
==
-
1
||
exec
.
CardId
==
card
.
Id
)
&&
Func
();
if
(
card
.
Id
!=
0
&&
type
==
ExecutorType
.
Activate
&&
result
)
{
{
int
count
=
card
.
IsDisabled
()
?
3
:
1
;
int
count
=
card
.
IsDisabled
()
?
3
:
1
;
if
(!
_activatedCards
.
ContainsKey
(
card
.
Id
))
if
(!
_activatedCards
.
ContainsKey
(
card
.
Id
))
...
...
Tang Xinwei
@pokeboyexn
mentioned in commit
078ad579
·
Sep 19, 2024
mentioned in commit
078ad579
mentioned in commit 078ad57972dd2c64a612e19ec5e5c9fd76085a13
Toggle commit list
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