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
神之吹息
windbot
Commits
8dfcd0d5
Commit
8dfcd0d5
authored
Nov 04, 2017
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update OnPreBattleBetween
parent
f8f793ac
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
95 additions
and
80 deletions
+95
-80
Game/AI/CardExtension.cs
Game/AI/CardExtension.cs
+9
-1
Game/AI/Decks/BlueEyesExecutor.cs
Game/AI/Decks/BlueEyesExecutor.cs
+1
-6
Game/AI/Decks/LightswornExecutor.cs
Game/AI/Decks/LightswornExecutor.cs
+2
-9
Game/AI/Decks/MokeyMokeyExecutor.cs
Game/AI/Decks/MokeyMokeyExecutor.cs
+1
-1
Game/AI/Decks/RainbowExecutor.cs
Game/AI/Decks/RainbowExecutor.cs
+2
-9
Game/AI/Decks/ToadallyAwesomeExecutor.cs
Game/AI/Decks/ToadallyAwesomeExecutor.cs
+2
-9
Game/AI/Decks/YosenjuExecutor.cs
Game/AI/Decks/YosenjuExecutor.cs
+2
-9
Game/AI/Decks/ZexalWeaponsExecutor.cs
Game/AI/Decks/ZexalWeaponsExecutor.cs
+2
-9
Game/AI/Decks/ZoodiacExecutor.cs
Game/AI/Decks/ZoodiacExecutor.cs
+4
-11
Game/AI/DefaultExecutor.cs
Game/AI/DefaultExecutor.cs
+52
-0
Game/AI/Enums/PreventActivationEffectInBattle.cs
Game/AI/Enums/PreventActivationEffectInBattle.cs
+14
-0
Game/AI/Executor.cs
Game/AI/Executor.cs
+3
-14
README.md
README.md
+0
-2
WindBot.csproj
WindBot.csproj
+1
-0
No files found.
Game/AI/CardExtension.cs
View file @
8dfcd0d5
...
...
@@ -18,7 +18,15 @@ namespace WindBot.Game.AI
/// </summary>
public
static
bool
IsMonsterDangerous
(
this
ClientCard
card
)
{
return
Enum
.
IsDefined
(
typeof
(
DangerousMonster
),
card
.
Id
);
return
!
card
.
IsDisabled
()
&&
Enum
.
IsDefined
(
typeof
(
DangerousMonster
),
card
.
Id
);
}
/// <summary>
/// Do this monster prevents activation of opponent's effect monsters in battle?
/// </summary>
public
static
bool
IsMonsterHasPreventActivationEffectInBattle
(
this
ClientCard
card
)
{
return
!
card
.
IsDisabled
()
&&
Enum
.
IsDefined
(
typeof
(
PreventActivationEffectInBattle
),
card
.
Id
);
}
public
static
bool
IsFloodgate
(
this
ClientCard
card
)
...
...
Game/AI/Decks/BlueEyesExecutor.cs
View file @
8dfcd0d5
...
...
@@ -233,12 +233,7 @@ namespace WindBot.Game.AI.Decks
public
override
bool
OnPreBattleBetween
(
ClientCard
attacker
,
ClientCard
defender
)
{
if
(
defender
.
IsMonsterInvincible
())
{
if
(
defender
.
IsMonsterDangerous
()
||
defender
.
IsDefense
())
return
false
;
}
return
attacker
.
Attack
>
0
;
return
attacker
.
Attack
>
0
&&
base
.
OnPreBattleBetween
(
attacker
,
defender
);
}
private
bool
DragonShrineEffect
()
...
...
Game/AI/Decks/LightswornExecutor.cs
View file @
8dfcd0d5
...
...
@@ -95,19 +95,12 @@ namespace WindBot.Game.AI.Decks
public
override
bool
OnPreBattleBetween
(
ClientCard
attacker
,
ClientCard
defender
)
{
if
(
defender
.
IsMonsterInvincible
())
{
if
(
defender
.
IsMonsterDangerous
()
||
defender
.
IsDefense
())
return
false
;
}
if
(!(
defender
.
Id
==
CardId
.
NumberS39UtopiatheLightning
))
if
(!
defender
.
IsMonsterHasPreventActivationEffectInBattle
())
{
if
(
attacker
.
Attribute
==
(
int
)
CardAttribute
.
Light
&&
Bot
.
HasInHand
(
CardId
.
Honest
))
attacker
.
RealPower
=
attacker
.
RealPower
+
defender
.
Attack
;
if
(
attacker
.
Id
==
CardId
.
NumberS39UtopiatheLightning
&&
!
attacker
.
IsDisabled
()
&&
attacker
.
HasXyzMaterial
(
2
,
CardId
.
Number39Utopia
))
attacker
.
RealPower
=
5000
;
}
return
attacker
.
RealPower
>
defender
.
GetDefensePower
(
);
return
base
.
OnPreBattleBetween
(
attacker
,
defender
);
}
public
override
IList
<
ClientCard
>
OnSelectCard
(
IList
<
ClientCard
>
cards
,
int
min
,
int
max
,
bool
cancelable
)
...
...
Game/AI/Decks/MokeyMokeyExecutor.cs
View file @
8dfcd0d5
...
...
@@ -36,7 +36,7 @@ namespace WindBot.Game.AI.Decks
public
override
bool
OnPreBattleBetween
(
ClientCard
attacker
,
ClientCard
defender
)
{
return
attacker
.
Attack
>
0
;
return
attacker
.
Attack
>
0
&&
base
.
OnPreBattleBetween
(
attacker
,
defender
)
;
}
}
}
\ No newline at end of file
Game/AI/Decks/RainbowExecutor.cs
View file @
8dfcd0d5
...
...
@@ -150,19 +150,12 @@ namespace WindBot.Game.AI.Decks
public
override
bool
OnPreBattleBetween
(
ClientCard
attacker
,
ClientCard
defender
)
{
if
(
defender
.
IsMonsterInvincib
le
())
if
(
!
defender
.
IsMonsterHasPreventActivationEffectInBatt
le
())
{
if
(
defender
.
IsMonsterDangerous
()
||
defender
.
IsDefense
())
return
false
;
}
if
(!(
defender
.
Id
==
CardId
.
NumberS39UtopiatheLightning
))
{
if
(
attacker
.
Id
==
CardId
.
NumberS39UtopiatheLightning
&&
!
attacker
.
IsDisabled
()
&&
attacker
.
HasXyzMaterial
(
2
,
CardId
.
Number39Utopia
))
attacker
.
RealPower
=
5000
;
if
(
Bot
.
HasInMonstersZone
(
CardId
.
Number37HopeWovenDragonSpiderShark
,
true
,
true
))
attacker
.
RealPower
=
attacker
.
RealPower
+
1000
;
}
return
attacker
.
RealPower
>
defender
.
GetDefensePower
(
);
return
base
.
OnPreBattleBetween
(
attacker
,
defender
);
}
private
bool
UnexpectedDaiEffect
()
...
...
Game/AI/Decks/ToadallyAwesomeExecutor.cs
View file @
8dfcd0d5
...
...
@@ -40,8 +40,6 @@ namespace WindBot.Game.AI.Decks
public
static
int
BookOfMoon
=
14087893
;
public
static
int
CallOfTheHaunted
=
97077563
;
public
static
int
TorrentialTribute
=
53582587
;
public
static
int
NumberS39UtopiatheLightning
=
56832966
;
}
public
ToadallyAwesomeExecutor
(
GameAI
ai
,
Duel
duel
)
...
...
@@ -116,17 +114,12 @@ namespace WindBot.Game.AI.Decks
public
override
bool
OnPreBattleBetween
(
ClientCard
attacker
,
ClientCard
defender
)
{
if
(
defender
.
IsMonsterInvincible
())
{
if
(
defender
.
IsMonsterDangerous
()
||
defender
.
IsDefense
())
return
false
;
}
if
(!(
defender
.
Id
==
CardId
.
NumberS39UtopiatheLightning
))
if
(!
defender
.
IsMonsterHasPreventActivationEffectInBattle
())
{
if
(
attacker
.
Id
==
CardId
.
SkyCavalryCentaurea
&&
!
attacker
.
IsDisabled
()
&&
attacker
.
HasXyzMaterial
())
attacker
.
RealPower
=
Duel
.
LifePoints
[
0
]
+
attacker
.
Attack
;
}
return
attacker
.
RealPower
>=
defender
.
GetDefensePower
(
);
return
base
.
OnPreBattleBetween
(
attacker
,
defender
);
}
private
bool
MedallionOfTheIceBarrierEffect
()
...
...
Game/AI/Decks/YosenjuExecutor.cs
View file @
8dfcd0d5
...
...
@@ -171,19 +171,12 @@ namespace WindBot.Game.AI.Decks
public
override
bool
OnPreBattleBetween
(
ClientCard
attacker
,
ClientCard
defender
)
{
if
(
defender
.
IsMonsterInvincible
())
{
if
(
defender
.
IsMonsterDangerous
()
||
defender
.
IsDefense
())
return
false
;
}
if
(!(
defender
.
Id
==
CardId
.
NumberS39UtopiatheLightning
))
if
(!
defender
.
IsMonsterHasPreventActivationEffectInBattle
())
{
if
(
attacker
.
Attribute
==
(
int
)
CardAttribute
.
Wind
&&
Bot
.
HasInHand
(
CardId
.
YosenjuTsujik
))
attacker
.
RealPower
=
attacker
.
RealPower
+
1000
;
if
(
attacker
.
Id
==
CardId
.
NumberS39UtopiatheLightning
&&
!
attacker
.
IsDisabled
()
&&
attacker
.
HasXyzMaterial
(
2
,
CardId
.
Number39Utopia
))
attacker
.
RealPower
=
5000
;
}
return
attacker
.
RealPower
>
defender
.
GetDefensePower
(
);
return
base
.
OnPreBattleBetween
(
attacker
,
defender
);
}
private
bool
PotOfDualityEffect
()
...
...
Game/AI/Decks/ZexalWeaponsExecutor.cs
View file @
8dfcd0d5
...
...
@@ -128,19 +128,12 @@ namespace WindBot.Game.AI.Decks
public
override
bool
OnPreBattleBetween
(
ClientCard
attacker
,
ClientCard
defender
)
{
if
(
defender
.
IsMonsterInvincible
())
{
if
(
defender
.
IsMonsterDangerous
()
||
defender
.
IsDefense
())
return
false
;
}
if
(!(
defender
.
Id
==
CardId
.
NumberS39UtopiatheLightning
))
if
(!
defender
.
IsMonsterHasPreventActivationEffectInBattle
())
{
if
(
attacker
.
Attribute
==
(
int
)
CardAttribute
.
Light
&&
Bot
.
HasInHand
(
CardId
.
Honest
))
attacker
.
RealPower
=
attacker
.
RealPower
+
defender
.
Attack
;
if
(
attacker
.
Id
==
CardId
.
NumberS39UtopiatheLightning
&&
!
attacker
.
IsDisabled
()
&&
attacker
.
HasXyzMaterial
(
2
,
CardId
.
Number39Utopia
))
attacker
.
RealPower
=
5000
;
}
return
attacker
.
RealPower
>
defender
.
GetDefensePower
(
);
return
base
.
OnPreBattleBetween
(
attacker
,
defender
);
}
private
bool
Number39Utopia
()
...
...
Game/AI/Decks/ZoodiacExecutor.cs
View file @
8dfcd0d5
...
...
@@ -133,19 +133,12 @@ namespace WindBot.Game.AI.Decks
public
override
bool
OnPreBattleBetween
(
ClientCard
attacker
,
ClientCard
defender
)
{
if
(
defender
.
IsMonsterInvincib
le
())
if
(
!
defender
.
IsMonsterHasPreventActivationEffectInBatt
le
())
{
if
(
defender
.
IsMonsterDangerous
()
||
defender
.
IsDefense
())
return
false
;
}
if
(!(
defender
.
Id
==
CardId
.
NumberS39UtopiatheLightning
))
{
//if (attacker.HasType(CardType.Fusion) && Bot.HasInHand(CardId.AleisterTheInvoker))
// attacker.RealPower = attacker.RealPower + 1000;
if
(
attacker
.
Id
==
CardId
.
NumberS39UtopiatheLightning
&&
!
attacker
.
IsDisabled
()
&&
attacker
.
HasXyzMaterial
(
2
,
CardId
.
Number39Utopia
))
attacker
.
RealPower
=
5000
;
if
(
attacker
.
HasType
(
CardType
.
Fusion
)
&&
Bot
.
HasInHand
(
CardId
.
AleisterTheInvoker
))
attacker
.
RealPower
=
attacker
.
RealPower
+
1000
;
}
return
attacker
.
RealPower
>
defender
.
GetDefensePower
(
);
return
base
.
OnPreBattleBetween
(
attacker
,
defender
);
}
private
bool
PhotonThrasherSummon
()
...
...
Game/AI/DefaultExecutor.cs
View file @
8dfcd0d5
...
...
@@ -20,11 +20,18 @@ namespace WindBot.Game.AI
public
static
int
DogorantheMadFlameKaiju
=
93332803
;
public
static
int
SuperAntiKaijuWarMachineMechaDogoran
=
84769941
;
public
static
int
DupeFrog
=
46239604
;
public
static
int
MaraudingCaptain
=
2460565
;
public
static
int
MysticalSpaceTyphoon
=
5318639
;
public
static
int
CosmicCyclone
=
8267140
;
public
static
int
ChickenGame
=
67616300
;
public
static
int
CastelTheSkyblasterMusketeer
=
82633039
;
public
static
int
NumberS39UtopiaTheLightning
=
56832966
;
public
static
int
Number39Utopia
=
84013237
;
public
static
int
UltimayaTzolkin
=
1686814
;
}
protected
DefaultExecutor
(
GameAI
ai
,
Duel
duel
)
...
...
@@ -33,6 +40,51 @@ namespace WindBot.Game.AI
AddExecutor
(
ExecutorType
.
Activate
,
_CardId
.
ChickenGame
,
DefaultChickenGame
);
}
/// <summary>
/// Decide whether to declare attack between attacker and defender.
/// Can be overrided to update the RealPower of attacker for cards like Honest.
/// </summary>
/// <param name="attacker">Card that attack.</param>
/// <param name="defender">Card that defend.</param>
/// <returns>true if the attack can be done.</returns>
public
override
bool
OnPreBattleBetween
(
ClientCard
attacker
,
ClientCard
defender
)
{
if
(
defender
.
IsMonsterInvincible
())
{
if
(!
attacker
.
IsMonsterHasPreventActivationEffectInBattle
()
&&
(
defender
.
IsMonsterDangerous
()
||
defender
.
IsDefense
()))
return
false
;
}
if
(!
defender
.
IsMonsterHasPreventActivationEffectInBattle
())
{
if
(
attacker
.
Id
==
_CardId
.
NumberS39UtopiaTheLightning
&&
!
attacker
.
IsDisabled
()
&&
attacker
.
HasXyzMaterial
(
2
,
_CardId
.
Number39Utopia
))
attacker
.
RealPower
=
5000
;
}
if
(!
attacker
.
IsMonsterHasPreventActivationEffectInBattle
())
{
if
(
defender
.
Id
==
_CardId
.
NumberS39UtopiaTheLightning
&&
!
defender
.
IsDisabled
()
&&
defender
.
HasXyzMaterial
(
2
,
_CardId
.
Number39Utopia
))
defender
.
RealPower
=
5000
;
}
if
(
Enemy
.
HasInMonstersZone
(
_CardId
.
DupeFrog
,
true
)
&&
defender
.
Id
!=
_CardId
.
DupeFrog
)
return
false
;
if
(
Enemy
.
HasInMonstersZone
(
_CardId
.
MaraudingCaptain
,
true
)
&&
defender
.
Id
!=
_CardId
.
MaraudingCaptain
&&
defender
.
Race
==
(
int
)
CardRace
.
Warrior
)
return
false
;
if
(
defender
.
Id
==
_CardId
.
UltimayaTzolkin
&&
!
defender
.
IsDisabled
())
{
List
<
ClientCard
>
monsters
=
Enemy
.
GetMonsters
();
foreach
(
ClientCard
monster
in
monsters
)
{
if
(
monster
.
HasType
(
CardType
.
Synchro
))
return
false
;
}
}
return
true
;
}
/// <summary>
/// Destroy face-down cards first, in our turn.
/// </summary>
...
...
Game/AI/Enums/PreventActivationEffectInBattle.cs
0 → 100644
View file @
8dfcd0d5
namespace
WindBot.Game.AI.Enums
{
public
enum
PreventActivationEffectInBattle
{
Deskbot009
=
25494711
,
ArchfiendBlackSkullDragon
=
45349196
,
FrightfurChimera
=
83866861
,
GladiatorBeastNerokius
=
29357956
,
GemKnightCitrine
=
67985943
,
FrightfurSheep
=
57477163
,
ArmadesKeeperOfBoundaries
=
88033975
,
NumberS39UtopiaTheLightning
=
56832966
,
}
}
Game/AI/Executor.cs
View file @
8dfcd0d5
...
...
@@ -67,14 +67,14 @@ namespace WindBot.Game.AI
for
(
int
i
=
defenders
.
Count
-
1
;
i
>=
0
;
--
i
)
{
ClientCard
defender
=
defenders
[
i
];
int
def
=
defender
.
GetDefensePower
();
for
(
int
j
=
0
;
j
<
attackers
.
Count
;
++
j
)
{
ClientCard
attacker
=
attackers
[
j
];
attacker
.
RealPower
=
attacker
.
Attack
;
defender
.
RealPower
=
defender
.
GetDefensePower
();
if
(!
OnPreBattleBetween
(
attacker
,
defender
))
continue
;
if
(
attacker
.
RealPower
>
def
||
(
attacker
.
RealPower
>=
def
&&
j
==
attackers
.
Count
-
1
))
if
(
attacker
.
RealPower
>
def
ender
.
RealPower
||
(
attacker
.
RealPower
>=
defender
.
RealPower
&&
j
==
attackers
.
Count
-
1
))
return
AI
.
Attack
(
attacker
,
defender
);
}
}
...
...
@@ -92,20 +92,9 @@ namespace WindBot.Game.AI
return
AI
.
ToMainPhase2
();
}
/// <summary>
/// Decide whether to declare attack between attacker and defender.
/// Can be overrided to update the RealPower of attacker for cards like Honest.
/// </summary>
/// <param name="attacker">Card that attack.</param>
/// <param name="defender">Card that defend.</param>
/// <returns>true if the attack can be done.</returns>
public
virtual
bool
OnPreBattleBetween
(
ClientCard
attacker
,
ClientCard
defender
)
{
if
(
defender
.
IsMonsterInvincible
())
{
if
(
defender
.
IsMonsterDangerous
()
||
defender
.
IsDefense
())
return
false
;
}
// Overrided in DefalultExecutor
return
true
;
}
...
...
README.md
View file @
8dfcd0d5
...
...
@@ -107,8 +107,6 @@ The parameters are same as commandlines, but low cased.
### Known issues
*
The bot will attack synchro monsters next to _Ultimaya Tzolkin_ because it don't know _Ultimaya Tzolkin_ can't be attacked.
*
The attack won't be canceled when battle replay happens.
*
If one chain includes two activation that use
`AI.SelectCard`
, the second one won't select correctly.
...
...
WindBot.csproj
View file @
8dfcd0d5
...
...
@@ -111,6 +111,7 @@
<Compile
Include=
"Game\AI\Dialogs.cs"
/>
<Compile
Include=
"Game\AI\Enums\DangerousMonster.cs"
/>
<Compile
Include=
"Game\AI\Enums\FusionSpell.cs"
/>
<Compile
Include=
"Game\AI\Enums\PreventActivationEffectInBattle.cs"
/>
<Compile
Include=
"Game\AI\Enums\OneForXyz.cs"
/>
<Compile
Include=
"Game\AI\Enums\InvincibleMonster.cs"
/>
<Compile
Include=
"Game\AI\Enums\Floodgate.cs"
/>
...
...
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