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
Tang Xinwei
windbot
Commits
4866c58c
Commit
4866c58c
authored
Mar 19, 2021
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add Executor.OnPreActivate
don't activate if the card will be negated
parent
4eb4cab5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
9 deletions
+49
-9
Game/AI/DefaultExecutor.cs
Game/AI/DefaultExecutor.cs
+33
-1
Game/AI/Executor.cs
Game/AI/Executor.cs
+11
-5
Game/GameAI.cs
Game/GameAI.cs
+5
-3
No files found.
Game/AI/DefaultExecutor.cs
View file @
4866c58c
...
...
@@ -116,6 +116,7 @@ namespace WindBot.Game.AI
public
const
int
RedDragonArchfiend
=
70902743
;
public
const
int
ImperialOrder
=
61740673
;
public
const
int
RoyalDecreel
=
51452091
;
public
const
int
NaturiaBeast
=
33198837
;
public
const
int
AntiSpellFragrance
=
58921041
;
}
...
...
@@ -247,6 +248,29 @@ namespace WindBot.Game.AI
return
true
;
}
public
override
bool
OnPreActivate
(
ClientCard
card
)
{
ClientCard
LastChainCard
=
Util
.
GetLastChainCard
();
if
(
LastChainCard
!=
null
&&
Duel
.
Phase
==
DuelPhase
.
Standby
&&
LastChainCard
.
IsCode
(
_CardId
.
SandaionTheTimelord
,
_CardId
.
GabrionTheTimelord
,
_CardId
.
MichionTheTimelord
,
_CardId
.
ZaphionTheTimelord
,
_CardId
.
HailonTheTimelord
,
_CardId
.
RaphionTheTimelord
,
_CardId
.
SadionTheTimelord
,
_CardId
.
MetaionTheTimelord
,
_CardId
.
KamionTheTimelord
,
_CardId
.
LazionTheTimelord
))
return
false
;
if
((
card
.
Location
==
CardLocation
.
Hand
||
card
.
Location
==
CardLocation
.
SpellZone
&&
card
.
IsFacedown
())
&&
(
Card
.
IsSpell
()
&&
DefaultSpellWillBeNegated
()
||
card
.
IsTrap
()
&&
DefaultTrapWillBeNegated
()))
return
false
;
return
true
;
}
/// <summary>
/// Called when the AI has to select a card position.
/// </summary>
...
...
@@ -729,7 +753,15 @@ namespace WindBot.Game.AI
/// </summary>
protected
bool
DefaultSpellWillBeNegated
()
{
return
Bot
.
HasInSpellZone
(
_CardId
.
ImperialOrder
,
true
,
true
)
||
Enemy
.
HasInSpellZone
(
_CardId
.
ImperialOrder
,
true
)
||
Enemy
.
HasInMonstersZone
(
_CardId
.
NaturiaBeast
,
true
);
return
(
Bot
.
HasInSpellZone
(
_CardId
.
ImperialOrder
,
true
,
true
)
||
Enemy
.
HasInSpellZone
(
_CardId
.
ImperialOrder
,
true
))
&&
!
Util
.
ChainContainsCard
(
_CardId
.
ImperialOrder
);
}
/// <summary>
/// If trap will be negated
/// </summary>
protected
bool
DefaultTrapWillBeNegated
()
{
return
(
Bot
.
HasInSpellZone
(
_CardId
.
RoyalDecreel
,
true
,
true
)
||
Enemy
.
HasInSpellZone
(
_CardId
.
RoyalDecreel
,
true
))
&&
!
Util
.
ChainContainsCard
(
_CardId
.
RoyalDecreel
);
}
/// <summary>
...
...
Game/AI/Executor.cs
View file @
4866c58c
...
...
@@ -73,13 +73,19 @@ namespace WindBot.Game.AI
public
virtual
BattlePhaseAction
OnSelectAttackTarget
(
ClientCard
attacker
,
IList
<
ClientCard
>
defenders
)
{
// Overrided in Defa
l
ultExecutor
// Overrided in DefaultExecutor
return
null
;
}
public
virtual
bool
OnPreBattleBetween
(
ClientCard
attacker
,
ClientCard
defender
)
{
// Overrided in DefalultExecutor
// Overrided in DefaultExecutor
return
true
;
}
public
virtual
bool
OnPreActivate
(
ClientCard
card
)
{
// Overrided in DefaultExecutor
return
true
;
}
...
...
@@ -178,13 +184,13 @@ namespace WindBot.Game.AI
public
virtual
CardPosition
OnSelectPosition
(
int
cardId
,
IList
<
CardPosition
>
positions
)
{
// Overrided in Defa
l
ultExecutor
// Overrided in DefaultExecutor
return
0
;
}
public
virtual
bool
OnSelectBattleReplay
()
{
// Overrided in Defa
l
ultExecutor
// Overrided in DefaultExecutor
return
false
;
}
...
...
@@ -194,7 +200,7 @@ namespace WindBot.Game.AI
/// <returns>True if select to set the monster.</returns>
public
virtual
bool
OnSelectMonsterSummonOrSet
(
ClientCard
card
)
{
// Overrided in Defa
l
ultExecutor
// Overrided in DefaultExecutor
return
false
;
}
...
...
Game/GameAI.cs
View file @
4866c58c
...
...
@@ -1102,10 +1102,12 @@ namespace WindBot.Game
private
bool
ShouldExecute
(
CardExecutor
exec
,
ClientCard
card
,
ExecutorType
type
,
int
desc
=
-
1
)
{
if
(
card
.
Id
!=
0
&&
type
==
ExecutorType
.
Activate
&&
_activatedCards
.
ContainsKey
(
card
.
Id
)
&&
_activatedCards
[
card
.
Id
]
>=
9
)
if
(
card
.
Id
!=
0
&&
type
==
ExecutorType
.
Activate
)
{
return
false
;
if
(
_activatedCards
.
ContainsKey
(
card
.
Id
)
&&
_activatedCards
[
card
.
Id
]
>=
9
)
return
false
;
if
(!
Executor
.
OnPreActivate
(
card
))
return
false
;
}
Executor
.
SetCard
(
type
,
card
,
desc
);
bool
result
=
card
!=
null
&&
exec
.
Type
==
type
&&
...
...
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