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
8880a1d5
Commit
8880a1d5
authored
Aug 24, 2018
by
mercury233
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/IceYGO/windbot
parents
a11997ff
3f572de6
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
501 additions
and
195 deletions
+501
-195
Decks/AI_GrenMajuThunderBoarder.ydk
Decks/AI_GrenMajuThunderBoarder.ydk
+7
-10
Game/AI/Decks/AltergeistExecutor.cs
Game/AI/Decks/AltergeistExecutor.cs
+79
-9
Game/AI/Decks/BlueEyesMaxDragonExecutor.cs
Game/AI/Decks/BlueEyesMaxDragonExecutor.cs
+5
-4
Game/AI/Decks/GrenMajuThunderBoarderExecutor.cs
Game/AI/Decks/GrenMajuThunderBoarderExecutor.cs
+201
-130
Game/AI/Decks/LightswornShaddoldinosourExecutor.cs
Game/AI/Decks/LightswornShaddoldinosourExecutor.cs
+1
-0
Game/AI/DefaultExecutor.cs
Game/AI/DefaultExecutor.cs
+86
-0
Game/AI/Enums/Floodgate.cs
Game/AI/Enums/Floodgate.cs
+2
-1
Game/ClientCard.cs
Game/ClientCard.cs
+11
-4
Game/ClientField.cs
Game/ClientField.cs
+2
-2
Game/Duel.cs
Game/Duel.cs
+23
-22
Game/GameAI.cs
Game/GameAI.cs
+16
-5
Game/GameBehavior.cs
Game/GameBehavior.cs
+68
-8
No files found.
Decks/AI_GrenMajuThunderBoarder.ydk
View file @
8880a1d5
...
@@ -6,6 +6,8 @@
...
@@ -6,6 +6,8 @@
71564252
71564252
71564252
71564252
71564252
71564252
14558127
14558127
36584821
36584821
36584821
36584821
36584821
36584821
...
@@ -20,9 +22,6 @@
...
@@ -20,9 +22,6 @@
35261759
35261759
59750328
59750328
59750328
59750328
70368879
70368879
70368879
98645731
98645731
98645731
98645731
98645731
98645731
...
@@ -30,22 +29,22 @@
...
@@ -30,22 +29,22 @@
73915051
73915051
10045474
10045474
10045474
10045474
10045474
10813327
10813327
15693423
15693423
23924608
23924608
47475363
47475363
30241314
30241314
30241314
30241314
58921041
58921041
58921041
58921041
61740673
61740673
61936647
69452756
69452756
40605147
40605147
40605147
40605147
77538567
77538567
77538567
77538567
84749824
84749824
#extra
#extra
86221741
86221741
31833038
31833038
...
@@ -65,13 +64,11 @@
...
@@ -65,13 +64,11 @@
!side
!side
10000080
10000080
86937530
86937530
14558127
62015408
62015408
9742784
9742784
67441435
70368879
72529749
43898403
19508728
19508728
10045474
15693423
15693423
24207889
24207889
69452756
69452756
...
...
Game/AI/Decks/AltergeistExecutor.cs
View file @
8880a1d5
...
@@ -461,7 +461,8 @@ namespace WindBot.Game.AI.Decks
...
@@ -461,7 +461,8 @@ namespace WindBot.Game.AI.Decks
return
card
;
return
card
;
card
=
Enemy
.
MonsterZone
.
GetDangerousMonster
(
canBeTarget
);
card
=
Enemy
.
MonsterZone
.
GetDangerousMonster
(
canBeTarget
);
if
(
card
!=
null
)
if
(
card
!=
null
&&
(
Duel
.
Player
==
0
||
(
Duel
.
Phase
>
DuelPhase
.
Main1
&&
Duel
.
Phase
<
DuelPhase
.
Main2
)))
return
card
;
return
card
;
card
=
Enemy
.
MonsterZone
.
GetInvincibleMonster
(
canBeTarget
);
card
=
Enemy
.
MonsterZone
.
GetInvincibleMonster
(
canBeTarget
);
...
@@ -1136,7 +1137,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -1136,7 +1137,7 @@ namespace WindBot.Game.AI.Decks
if
(!
AI
.
Utils
.
IsTurn1OrMain2
())
if
(!
AI
.
Utils
.
IsTurn1OrMain2
())
{
{
ClientCard
self_best
=
AI
.
Utils
.
GetBestBotMonster
();
ClientCard
self_best
=
AI
.
Utils
.
GetBestBotMonster
();
ClientCard
enemy_best
=
AI
.
Utils
.
GetProblematicEnemyCard
(
self_best
.
Attack
+
1
,
true
);
ClientCard
enemy_best
=
AI
.
Utils
.
GetProblematicEnemyCard
(
self_best
.
Attack
,
true
);
ClientCard
enemy_target
=
GetProblematicEnemyCard_Alter
(
true
,
false
);
ClientCard
enemy_target
=
GetProblematicEnemyCard_Alter
(
true
,
false
);
if
((
enemy_best
!=
null
||
enemy_target
!=
null
)
if
((
enemy_best
!=
null
||
enemy_target
!=
null
)
...
@@ -1548,7 +1549,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -1548,7 +1549,7 @@ namespace WindBot.Game.AI.Decks
ClientCard
enemy_card
=
GetBestEnemyCard_random
();
ClientCard
enemy_card
=
GetBestEnemyCard_random
();
if
(
enemy_card
!=
null
)
if
(
enemy_card
!=
null
)
{
{
Logger
.
DebugWriteLine
(
"Silquitousdecide:"
+
bounce_self
?.
Name
);
Logger
.
DebugWriteLine
(
"Silquitous
decide:"
+
bounce_self
?.
Name
);
AI
.
SelectCard
(
bounce_self
);
AI
.
SelectCard
(
bounce_self
);
AI
.
SelectNextCard
(
enemy_card
);
AI
.
SelectNextCard
(
enemy_card
);
return
true
;
return
true
;
...
@@ -1908,6 +1909,11 @@ namespace WindBot.Game.AI.Decks
...
@@ -1908,6 +1909,11 @@ namespace WindBot.Game.AI.Decks
}
}
else
else
{
{
ClientCard
self_best
=
AI
.
Utils
.
GetBestBotMonster
();
int
best_atk
=
self_best
==
null
?
0
:
self_best
.
Attack
;
ClientCard
enemy_best
=
AI
.
Utils
.
GetProblematicEnemyCard
(
best_atk
,
true
);
ClientCard
enemy_target
=
GetProblematicEnemyCard_Alter
(
true
,
false
);
if
(!
Multifaker_ssfromhand
&&
Multifaker_candeckss
()
&&
can_ss_Multifaker
)
if
(!
Multifaker_ssfromhand
&&
Multifaker_candeckss
()
&&
can_ss_Multifaker
)
{
{
Spoofing_select
(
new
[]
Spoofing_select
(
new
[]
...
@@ -1928,6 +1934,45 @@ namespace WindBot.Game.AI.Decks
...
@@ -1928,6 +1934,45 @@ namespace WindBot.Game.AI.Decks
CardId
.
Silquitous
CardId
.
Silquitous
});
});
}
}
else
if
(!
summoned
&&
!
Bot
.
HasInGraveyard
(
CardId
.
Meluseek
)
&&
Bot
.
GetRemainingCount
(
CardId
.
Meluseek
,
3
)
>
0
&&
!
Bot
.
HasInHand
(
CardId
.
Meluseek
)
&&
(
enemy_best
!=
null
||
enemy_target
!=
null
)
)
{
if
(
Bot
.
HasInHand
(
CardId
.
Silquitous
))
{
foreach
(
ClientCard
card
in
Bot
.
Hand
)
{
if
(
card
.
Id
==
CardId
.
Silquitous
)
{
AI
.
SelectCard
(
card
);
AI
.
SelectNextCard
(
new
[]{
CardId
.
Meluseek
,
CardId
.
Marionetter
});
return
true
;
}
}
}
else
{
Spoofing_select
(
new
[]
{
CardId
.
Silquitous
,
CardId
.
Manifestation
,
CardId
.
Kunquery
,
CardId
.
Multifaker
,
CardId
.
Protocol
,
CardId
.
Meluseek
,
CardId
.
Marionetter
,
});
AI
.
SelectNextCard
(
new
[]{
CardId
.
Meluseek
,
CardId
.
Marionetter
,
CardId
.
Multifaker
,
CardId
.
Kunquery
});
return
true
;
}
}
else
if
(!
summoned
&&
!
Bot
.
HasInHand
(
CardId
.
Marionetter
)
&&
Bot
.
GetRemainingCount
(
CardId
.
Marionetter
,
3
)
>
0
)
else
if
(!
summoned
&&
!
Bot
.
HasInHand
(
CardId
.
Marionetter
)
&&
Bot
.
GetRemainingCount
(
CardId
.
Marionetter
,
3
)
>
0
)
{
{
if
(
Bot
.
HasInHand
(
CardId
.
Silquitous
))
if
(
Bot
.
HasInHand
(
CardId
.
Silquitous
))
...
@@ -1944,7 +1989,8 @@ namespace WindBot.Game.AI.Decks
...
@@ -1944,7 +1989,8 @@ namespace WindBot.Game.AI.Decks
return
true
;
return
true
;
}
}
}
}
}
else
}
else
{
{
Spoofing_select
(
new
[]
Spoofing_select
(
new
[]
{
{
...
@@ -1966,6 +2012,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -1966,6 +2012,7 @@ namespace WindBot.Game.AI.Decks
}
}
}
}
}
}
// target protect
bool
go
=
false
;
bool
go
=
false
;
foreach
(
ClientCard
card
in
Bot
.
GetSpells
())
foreach
(
ClientCard
card
in
Bot
.
GetSpells
())
{
{
...
@@ -2052,6 +2099,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -2052,6 +2099,7 @@ namespace WindBot.Game.AI.Decks
{
{
if
(
EvenlyMatched_ready
())
return
false
;
if
(
EvenlyMatched_ready
())
return
false
;
bool
can_summon
=
false
;
bool
can_summon
=
false
;
if
(
Enemy
.
GetMonsterCount
()
==
0
&&
Enemy
.
LifePoints
<=
800
)
return
true
;
foreach
(
ClientCard
card
in
Bot
.
Hand
)
foreach
(
ClientCard
card
in
Bot
.
Hand
)
{
{
if
(
isAltergeist
(
card
.
Id
)
&&
card
.
IsTrap
())
if
(
isAltergeist
(
card
.
Id
)
&&
card
.
IsTrap
())
...
@@ -2089,6 +2137,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -2089,6 +2137,7 @@ namespace WindBot.Game.AI.Decks
public
bool
Multifaker_summon
()
public
bool
Multifaker_summon
()
{
{
if
(
EvenlyMatched_ready
())
return
false
;
if
(
EvenlyMatched_ready
())
return
false
;
if
(
Enemy
.
GetMonsterCount
()
==
0
&&
Enemy
.
LifePoints
<=
1200
)
return
true
;
if
(
Bot
.
HasInMonstersZone
(
CardId
.
Silquitous
)
||
Bot
.
HasInHandOrInSpellZone
(
CardId
.
Spoofing
))
if
(
Bot
.
HasInMonstersZone
(
CardId
.
Silquitous
)
||
Bot
.
HasInHandOrInSpellZone
(
CardId
.
Spoofing
))
{
{
summoned
=
true
;
summoned
=
true
;
...
@@ -2211,10 +2260,22 @@ namespace WindBot.Game.AI.Decks
...
@@ -2211,10 +2260,22 @@ namespace WindBot.Game.AI.Decks
if
(
AI
.
Utils
.
ChainContainsCard
(
CardId
.
Multifaker
))
return
false
;
if
(
AI
.
Utils
.
ChainContainsCard
(
CardId
.
Multifaker
))
return
false
;
if
(
Duel
.
Player
==
1
)
if
(
Duel
.
Player
==
1
)
{
{
AI
.
SelectCard
(
new
[]
{
CardId
.
Meluseek
});
if
(
Card
.
Location
==
CardLocation
.
Grave
)
ss_other_monster
=
true
;
{
return
true
;
AI
.
SelectCard
(
new
[]
{
CardId
.
Meluseek
});
}
else
ss_other_monster
=
true
;
return
true
;
}
else
{
if
(
Card
.
IsDisabled
()
&&
!
Enemy
.
HasInSpellZone
(
82732705
,
true
))
return
false
;
ClientCard
enemy_card
=
Enemy
.
BattlingMonster
;
if
(
enemy_card
==
null
)
return
false
;
ClientCard
self_card
=
Bot
.
BattlingMonster
;
if
(
self_card
==
null
)
return
(
enemy_card
.
Id
!=
CardId
.
Hayate
);
return
(
enemy_card
.
Attack
>
self_card
.
GetDefensePower
());
}
}
else
{
{
if
(!
summoned
&&
!
Bot
.
HasInHand
(
CardId
.
Marionetter
)
&&
!
Meluseek_searched
&&
(
Duel
.
Phase
==
DuelPhase
.
Main1
||
Duel
.
Phase
==
DuelPhase
.
Main2
))
if
(!
summoned
&&
!
Bot
.
HasInHand
(
CardId
.
Marionetter
)
&&
!
Meluseek_searched
&&
(
Duel
.
Phase
==
DuelPhase
.
Main1
||
Duel
.
Phase
==
DuelPhase
.
Main2
))
{
{
...
@@ -2509,7 +2570,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -2509,7 +2570,7 @@ namespace WindBot.Game.AI.Decks
Logger
.
DebugWriteLine
(
"Tuner: enemy: "
+
enemy_power
.
ToString
()
+
", bot: "
+
self_power
.
ToString
());
Logger
.
DebugWriteLine
(
"Tuner: enemy: "
+
enemy_power
.
ToString
()
+
", bot: "
+
self_power
.
ToString
());
if
(
enemy_power
<
self_power
||
enemy_power
==
0
)
return
false
;
if
(
enemy_power
<
self_power
||
enemy_power
==
0
)
return
false
;
int
real_count
=
(
Bot
.
HasInExtra
(
CardId
.
Needlefiber
))
?
Bot
.
GetMonsterCount
()
+
2
:
Bot
.
GetMonsterCount
()
+
1
;
int
real_count
=
(
Bot
.
HasInExtra
(
CardId
.
Needlefiber
))
?
Bot
.
GetMonsterCount
()
+
2
:
Bot
.
GetMonsterCount
()
+
1
;
if
((
real_count
<
3
&&
enemy_power
>=
2400
)
if
((
real_count
<
=
3
&&
enemy_power
>=
2400
)
||
!(
Bot
.
HasInExtra
(
CardId
.
TripleBurstDragon
)
||
Bot
.
HasInExtra
(
CardId
.
Borrelsword
))
)
return
false
;
||
!(
Bot
.
HasInExtra
(
CardId
.
TripleBurstDragon
)
||
Bot
.
HasInExtra
(
CardId
.
Borrelsword
))
)
return
false
;
}
}
if
(
Multifaker_ssfromdeck
)
return
false
;
if
(
Multifaker_ssfromdeck
)
return
false
;
...
@@ -2707,6 +2768,15 @@ namespace WindBot.Game.AI.Decks
...
@@ -2707,6 +2768,15 @@ namespace WindBot.Game.AI.Decks
return
null
;
return
null
;
}
}
public
override
CardPosition
OnSelectPosition
(
int
cardId
,
IList
<
CardPosition
>
positions
)
{
if
(
AI
.
Utils
.
IsTurn1OrMain2
())
{
return
CardPosition
.
FaceUpDefence
;
}
return
0
;
}
public
override
int
OnSelectPlace
(
int
cardId
,
int
player
,
int
location
,
int
available
)
public
override
int
OnSelectPlace
(
int
cardId
,
int
player
,
int
location
,
int
available
)
{
{
if
(
player
==
0
)
if
(
player
==
0
)
...
...
Game/AI/Decks/BlueEyesMaxDragonExecutor.cs
View file @
8880a1d5
...
@@ -128,28 +128,29 @@ namespace WindBot.Game.AI.Decks
...
@@ -128,28 +128,29 @@ namespace WindBot.Game.AI.Decks
{
{
if
(
Duel
.
LastChainPlayer
==
1
)
if
(
Duel
.
LastChainPlayer
==
1
)
{
{
if
(
AI
.
Utils
.
GetLastChainCard
().
Id
==
CardId
.
MaxxC
)
ClientCard
lastCard
=
AI
.
Utils
.
GetLastChainCard
();
if
(
lastCard
.
Id
==
CardId
.
MaxxC
)
{
{
AI
.
SelectCard
(
CardId
.
MaxxC
);
AI
.
SelectCard
(
CardId
.
MaxxC
);
if
(
AI
.
Utils
.
ChainContainsCard
(
CardId
.
TheMelodyOfAwakeningDragon
))
if
(
AI
.
Utils
.
ChainContainsCard
(
CardId
.
TheMelodyOfAwakeningDragon
))
AI
.
SelectNextCard
(
new
[]
{
CardId
.
BlueEyesChaosMaxDragon
,
CardId
.
BlueEyesChaosMaxDragon
,
CardId
.
BlueEyesAlternativeWhiteDragon
});
AI
.
SelectNextCard
(
new
[]
{
CardId
.
BlueEyesChaosMaxDragon
,
CardId
.
BlueEyesChaosMaxDragon
,
CardId
.
BlueEyesAlternativeWhiteDragon
});
return
UniqueFaceupSpell
();
return
UniqueFaceupSpell
();
}
}
if
(
AI
.
Utils
.
GetLastChainCard
()
.
Id
==
CardId
.
LockBird
)
if
(
lastCard
.
Id
==
CardId
.
LockBird
)
{
{
AI
.
SelectCard
(
CardId
.
LockBird
);
AI
.
SelectCard
(
CardId
.
LockBird
);
if
(
AI
.
Utils
.
ChainContainsCard
(
CardId
.
TheMelodyOfAwakeningDragon
))
if
(
AI
.
Utils
.
ChainContainsCard
(
CardId
.
TheMelodyOfAwakeningDragon
))
AI
.
SelectNextCard
(
new
[]
{
CardId
.
BlueEyesChaosMaxDragon
,
CardId
.
BlueEyesChaosMaxDragon
,
CardId
.
BlueEyesAlternativeWhiteDragon
});
AI
.
SelectNextCard
(
new
[]
{
CardId
.
BlueEyesChaosMaxDragon
,
CardId
.
BlueEyesChaosMaxDragon
,
CardId
.
BlueEyesAlternativeWhiteDragon
});
return
UniqueFaceupSpell
();
return
UniqueFaceupSpell
();
}
}
if
(
AI
.
Utils
.
GetLastChainCard
()
.
Id
==
CardId
.
Ghost
)
if
(
lastCard
.
Id
==
CardId
.
Ghost
)
{
{
AI
.
SelectCard
(
CardId
.
Ghost
);
AI
.
SelectCard
(
CardId
.
Ghost
);
if
(
AI
.
Utils
.
ChainContainsCard
(
CardId
.
TheMelodyOfAwakeningDragon
))
if
(
AI
.
Utils
.
ChainContainsCard
(
CardId
.
TheMelodyOfAwakeningDragon
))
AI
.
SelectNextCard
(
new
[]
{
CardId
.
BlueEyesChaosMaxDragon
,
CardId
.
BlueEyesChaosMaxDragon
,
CardId
.
BlueEyesAlternativeWhiteDragon
});
AI
.
SelectNextCard
(
new
[]
{
CardId
.
BlueEyesChaosMaxDragon
,
CardId
.
BlueEyesChaosMaxDragon
,
CardId
.
BlueEyesAlternativeWhiteDragon
});
return
UniqueFaceupSpell
();
return
UniqueFaceupSpell
();
}
}
if
(
AI
.
Utils
.
GetLastChainCard
()
.
Id
==
CardId
.
AshBlossom
)
if
(
lastCard
.
Id
==
CardId
.
AshBlossom
)
{
{
AI
.
SelectCard
(
CardId
.
AshBlossom
);
AI
.
SelectCard
(
CardId
.
AshBlossom
);
if
(
AI
.
Utils
.
ChainContainsCard
(
CardId
.
TheMelodyOfAwakeningDragon
))
if
(
AI
.
Utils
.
ChainContainsCard
(
CardId
.
TheMelodyOfAwakeningDragon
))
...
...
Game/AI/Decks/GrenMajuThunderBoarderExecutor.cs
View file @
8880a1d5
This diff is collapsed.
Click to expand it.
Game/AI/Decks/LightswornShaddoldinosourExecutor.cs
View file @
8880a1d5
...
@@ -1098,6 +1098,7 @@ namespace WindBot.Game.AI.Decks
...
@@ -1098,6 +1098,7 @@ namespace WindBot.Game.AI.Decks
if
(
targets
.
Count
==
0
)
if
(
targets
.
Count
==
0
)
return
false
;
return
false
;
AI
.
SelectCard
(
0
);
AI
.
SelectNextCard
(
targets
);
AI
.
SelectNextCard
(
targets
);
return
true
;
return
true
;
}
}
...
...
Game/AI/DefaultExecutor.cs
View file @
8880a1d5
...
@@ -38,6 +38,7 @@ namespace WindBot.Game.AI
...
@@ -38,6 +38,7 @@ namespace WindBot.Game.AI
public
const
int
Number39Utopia
=
84013237
;
public
const
int
Number39Utopia
=
84013237
;
public
const
int
UltimayaTzolkin
=
1686814
;
public
const
int
UltimayaTzolkin
=
1686814
;
public
const
int
MoonMirrorShield
=
19508728
;
public
const
int
VampireFr
ä
ulein
=
6039967
;
public
const
int
VampireFr
ä
ulein
=
6039967
;
public
const
int
InjectionFairyLily
=
79575620
;
public
const
int
InjectionFairyLily
=
79575620
;
...
@@ -55,6 +56,14 @@ namespace WindBot.Game.AI
...
@@ -55,6 +56,14 @@ namespace WindBot.Game.AI
public
const
int
MacroCosmos
=
30241314
;
public
const
int
MacroCosmos
=
30241314
;
public
const
int
UpstartGoblin
=
70368879
;
public
const
int
UpstartGoblin
=
70368879
;
public
const
int
EaterOfMillions
=
63845230
;
public
const
int
EaterOfMillions
=
63845230
;
public
const
int
InvokedPurgatrio
=
12307878
;
public
const
int
ChaosAncientGearGiant
=
51788412
;
public
const
int
UltimateAncientGearGolem
=
12652643
;
public
const
int
ImperialOrder
=
61740673
;
public
const
int
NaturiaBeast
=
33198837
;
public
const
int
AntiSpellFragrance
=
58921041
;
}
}
protected
DefaultExecutor
(
GameAI
ai
,
Duel
duel
)
protected
DefaultExecutor
(
GameAI
ai
,
Duel
duel
)
...
@@ -116,6 +125,14 @@ namespace WindBot.Game.AI
...
@@ -116,6 +125,14 @@ namespace WindBot.Game.AI
return
false
;
return
false
;
}
}
foreach
(
ClientCard
equip
in
defender
.
EquipCards
)
{
if
(
equip
.
Id
==
_CardId
.
MoonMirrorShield
&&
!
equip
.
IsDisabled
())
{
return
false
;
}
}
if
(
defender
.
Id
==
_CardId
.
CrystalWingSynchroDragon
&&
defender
.
IsAttack
()
&&
!
defender
.
IsDisabled
()
&&
attacker
.
Level
>=
5
)
if
(
defender
.
Id
==
_CardId
.
CrystalWingSynchroDragon
&&
defender
.
IsAttack
()
&&
!
defender
.
IsDisabled
()
&&
attacker
.
Level
>=
5
)
return
false
;
return
false
;
...
@@ -133,6 +150,14 @@ namespace WindBot.Game.AI
...
@@ -133,6 +150,14 @@ namespace WindBot.Game.AI
{
{
if
(
attacker
.
Id
==
_CardId
.
NumberS39UtopiaTheLightning
&&
!
attacker
.
IsDisabled
()
&&
attacker
.
HasXyzMaterial
(
2
,
_CardId
.
Number39Utopia
))
if
(
attacker
.
Id
==
_CardId
.
NumberS39UtopiaTheLightning
&&
!
attacker
.
IsDisabled
()
&&
attacker
.
HasXyzMaterial
(
2
,
_CardId
.
Number39Utopia
))
attacker
.
RealPower
=
5000
;
attacker
.
RealPower
=
5000
;
foreach
(
ClientCard
equip
in
attacker
.
EquipCards
)
{
if
(
equip
.
Id
==
_CardId
.
MoonMirrorShield
&&
!
equip
.
IsDisabled
())
{
attacker
.
RealPower
=
defender
.
RealPower
+
100
;
}
}
}
}
if
(
Enemy
.
HasInMonstersZone
(
_CardId
.
DupeFrog
,
true
)
&&
defender
.
Id
!=
_CardId
.
DupeFrog
)
if
(
Enemy
.
HasInMonstersZone
(
_CardId
.
DupeFrog
,
true
)
&&
defender
.
Id
!=
_CardId
.
DupeFrog
)
...
@@ -325,6 +350,31 @@ namespace WindBot.Game.AI
...
@@ -325,6 +350,31 @@ namespace WindBot.Game.AI
return
true
;
return
true
;
}
}
/// <summary>
/// Default Scapegoat effect
/// </summary>
protected
bool
DefaultScapegoat
()
{
if
(
DefaultSpellWillBeNegated
())
return
false
;
if
(
Duel
.
Player
==
0
)
return
false
;
if
(
Duel
.
Phase
==
DuelPhase
.
End
)
return
true
;
if
(
DefaultOnBecomeTarget
())
return
true
;
if
(
Duel
.
Phase
>
DuelPhase
.
Main1
&&
Duel
.
Phase
<
DuelPhase
.
Main2
)
{
if
(
Enemy
.
HasInMonstersZone
(
_CardId
.
UltimateConductorTytanno
,
true
))
return
false
;
if
(
Enemy
.
HasInMonstersZone
(
_CardId
.
InvokedPurgatrio
,
true
))
return
false
;
if
(
Enemy
.
HasInMonstersZone
(
_CardId
.
ChaosAncientGearGiant
,
true
))
return
false
;
if
(
Enemy
.
HasInMonstersZone
(
_CardId
.
UltimateAncientGearGolem
,
true
))
return
false
;
int
total_atk
=
0
;
List
<
ClientCard
>
enemy_monster
=
Enemy
.
GetMonsters
();
foreach
(
ClientCard
m
in
enemy_monster
)
{
if
(
m
.
IsAttack
())
total_atk
+=
m
.
Attack
;
}
if
(
total_atk
>=
Bot
.
LifePoints
)
return
true
;
}
return
false
;
}
/// <summary>
/// <summary>
/// Always active in opponent's turn.
/// Always active in opponent's turn.
/// </summary>
/// </summary>
...
@@ -624,6 +674,42 @@ namespace WindBot.Game.AI
...
@@ -624,6 +674,42 @@ namespace WindBot.Game.AI
return
false
;
return
false
;
}
}
/// <summary>
/// If spell will be negated
/// </summary>
protected
bool
DefaultSpellWillBeNegated
()
{
ClientCard
card
=
null
;
foreach
(
ClientCard
check
in
Bot
.
GetSpells
())
{
if
(
check
.
Id
==
_CardId
.
ImperialOrder
&&
!
check
.
IsDisabled
())
card
=
check
;
}
if
(
card
!=
null
&&
card
.
IsFaceup
())
return
true
;
if
(
Enemy
.
HasInSpellZone
(
_CardId
.
ImperialOrder
,
true
)
||
Enemy
.
HasInMonstersZone
(
_CardId
.
NaturiaBeast
,
true
))
return
true
;
return
false
;
}
/// <summary>
/// If spell must set first to activate
/// </summary>
protected
bool
DefaultSpellMustSetFirst
()
{
ClientCard
card
=
null
;
foreach
(
ClientCard
check
in
Bot
.
GetSpells
())
{
if
(
check
.
Id
==
_CardId
.
AntiSpellFragrance
&&
!
check
.
IsDisabled
())
card
=
check
;
}
if
(
card
!=
null
&&
card
.
IsFaceup
())
return
true
;
if
(
Enemy
.
HasInSpellZone
(
_CardId
.
AntiSpellFragrance
,
true
))
return
true
;
return
false
;
}
/// <summary>
/// <summary>
/// if spell/trap is the target or enermy activate HarpiesFeatherDuster
/// if spell/trap is the target or enermy activate HarpiesFeatherDuster
/// </summary>
/// </summary>
...
...
Game/AI/Enums/Floodgate.cs
View file @
8880a1d5
...
@@ -77,6 +77,7 @@
...
@@ -77,6 +77,7 @@
LairOfDarkness
=
59160188
,
LairOfDarkness
=
59160188
,
SuperboltThunderDragon
=
15291624
,
SuperboltThunderDragon
=
15291624
,
ThunderDragonLord
=
41685633
,
ThunderDragonLord
=
41685633
,
CyberDragonInfinity
=
10443957
CyberDragonInfinity
=
10443957
,
ImperialCustom
=
9995766
}
}
}
}
Game/ClientCard.cs
View file @
8880a1d5
...
@@ -12,6 +12,7 @@ namespace WindBot.Game
...
@@ -12,6 +12,7 @@ namespace WindBot.Game
public
string
Name
{
get
;
private
set
;
}
public
string
Name
{
get
;
private
set
;
}
public
int
Position
{
get
;
set
;
}
public
int
Position
{
get
;
set
;
}
public
int
Sequence
{
get
;
set
;
}
public
CardLocation
Location
{
get
;
set
;
}
public
CardLocation
Location
{
get
;
set
;
}
public
int
Alias
{
get
;
private
set
;
}
public
int
Alias
{
get
;
private
set
;
}
public
int
Level
{
get
;
private
set
;
}
public
int
Level
{
get
;
private
set
;
}
...
@@ -35,6 +36,10 @@ namespace WindBot.Game
...
@@ -35,6 +36,10 @@ namespace WindBot.Game
public
int
SelectSeq
{
get
;
set
;
}
public
int
SelectSeq
{
get
;
set
;
}
public
int
OpParam1
{
get
;
set
;
}
public
int
OpParam1
{
get
;
set
;
}
public
int
OpParam2
{
get
;
set
;
}
public
int
OpParam2
{
get
;
set
;
}
public
List
<
ClientCard
>
EquipCards
{
get
;
set
;
}
public
ClientCard
EquipTarget
;
public
bool
CanDirectAttack
{
get
;
set
;
}
public
bool
CanDirectAttack
{
get
;
set
;
}
public
bool
ShouldDirectAttack
{
get
;
set
;
}
public
bool
ShouldDirectAttack
{
get
;
set
;
}
public
bool
Attacked
{
get
;
set
;
}
public
bool
Attacked
{
get
;
set
;
}
...
@@ -44,16 +49,18 @@ namespace WindBot.Game
...
@@ -44,16 +49,18 @@ namespace WindBot.Game
public
int
[]
ActionIndex
{
get
;
set
;
}
public
int
[]
ActionIndex
{
get
;
set
;
}
public
IDictionary
<
int
,
int
>
ActionActivateIndex
{
get
;
private
set
;
}
public
IDictionary
<
int
,
int
>
ActionActivateIndex
{
get
;
private
set
;
}
public
ClientCard
(
int
id
,
CardLocation
loc
)
public
ClientCard
(
int
id
,
CardLocation
loc
,
int
sequence
)
:
this
(
id
,
loc
,
0
)
:
this
(
id
,
loc
,
-
1
,
0
)
{
{
}
}
public
ClientCard
(
int
id
,
CardLocation
loc
,
int
position
)
public
ClientCard
(
int
id
,
CardLocation
loc
,
int
sequence
,
int
position
)
{
{
SetId
(
id
);
SetId
(
id
);
Sequence
=
sequence
;
Position
=
position
;
Position
=
position
;
Overlays
=
new
List
<
int
>();
Overlays
=
new
List
<
int
>();
EquipCards
=
new
List
<
ClientCard
>();
ActionIndex
=
new
int
[
16
];
ActionIndex
=
new
int
[
16
];
ActionActivateIndex
=
new
Dictionary
<
int
,
int
>();
ActionActivateIndex
=
new
Dictionary
<
int
,
int
>();
Location
=
loc
;
Location
=
loc
;
...
@@ -189,7 +196,7 @@ namespace WindBot.Game
...
@@ -189,7 +196,7 @@ namespace WindBot.Game
public
bool
IsExtraCard
()
public
bool
IsExtraCard
()
{
{
return
(
HasType
(
CardType
.
Fusion
)
||
HasType
(
CardType
.
Synchro
)
||
HasType
(
CardType
.
Xyz
)
);
return
HasType
(
CardType
.
Fusion
)
||
HasType
(
CardType
.
Synchro
)
||
HasType
(
CardType
.
Xyz
)
||
HasType
(
CardType
.
Link
);
}
}
public
bool
IsFaceup
()
public
bool
IsFaceup
()
...
...
Game/ClientField.cs
View file @
8880a1d5
...
@@ -31,9 +31,9 @@ namespace WindBot.Game
...
@@ -31,9 +31,9 @@ namespace WindBot.Game
ExtraDeck
=
new
List
<
ClientCard
>();
ExtraDeck
=
new
List
<
ClientCard
>();
for
(
int
i
=
0
;
i
<
deck
;
++
i
)
for
(
int
i
=
0
;
i
<
deck
;
++
i
)
Deck
.
Add
(
new
ClientCard
(
0
,
CardLocation
.
Deck
));
Deck
.
Add
(
new
ClientCard
(
0
,
CardLocation
.
Deck
,
-
1
));
for
(
int
i
=
0
;
i
<
extra
;
++
i
)
for
(
int
i
=
0
;
i
<
extra
;
++
i
)
ExtraDeck
.
Add
(
new
ClientCard
(
0
,
CardLocation
.
Extra
));
ExtraDeck
.
Add
(
new
ClientCard
(
0
,
CardLocation
.
Extra
,
-
1
));
}
}
public
int
GetMonstersExtraZoneCount
()
public
int
GetMonstersExtraZoneCount
()
...
...
Game/Duel.cs
View file @
8880a1d5
...
@@ -38,12 +38,12 @@ namespace WindBot.Game
...
@@ -38,12 +38,12 @@ namespace WindBot.Game
LastSummonedCards
=
new
List
<
ClientCard
>();
LastSummonedCards
=
new
List
<
ClientCard
>();
}
}
public
ClientCard
GetCard
(
int
player
,
CardLocation
loc
,
int
index
)
public
ClientCard
GetCard
(
int
player
,
CardLocation
loc
,
int
seq
)
{
{
return
GetCard
(
player
,
(
int
)
loc
,
index
,
0
);
return
GetCard
(
player
,
(
int
)
loc
,
seq
,
0
);
}
}
public
ClientCard
GetCard
(
int
player
,
int
loc
,
int
index
,
int
subindex
)
public
ClientCard
GetCard
(
int
player
,
int
loc
,
int
seq
,
int
subSeq
)
{
{
if
(
player
<
0
||
player
>
1
)
if
(
player
<
0
||
player
>
1
)
return
null
;
return
null
;
...
@@ -79,51 +79,52 @@ namespace WindBot.Game
...
@@ -79,51 +79,52 @@ namespace WindBot.Game
if
(
cards
==
null
)
if
(
cards
==
null
)
return
null
;
return
null
;
if
(
index
>=
cards
.
Count
)
if
(
seq
>=
cards
.
Count
)
return
null
;
return
null
;
if
(
isXyz
)
if
(
isXyz
)
{
{
ClientCard
card
=
cards
[
index
];
ClientCard
card
=
cards
[
seq
];
if
(
card
==
null
||
sub
index
>=
card
.
Overlays
.
Count
)
if
(
card
==
null
||
sub
Seq
>=
card
.
Overlays
.
Count
)
return
null
;
return
null
;
return
null
;
// TODO card.Overlays[sub
index
]
return
null
;
// TODO card.Overlays[sub
Seq
]
}
}
return
cards
[
index
];
return
cards
[
seq
];
}
}
public
void
AddCard
(
CardLocation
loc
,
int
cardId
,
int
player
,
int
zone
,
int
pos
)
public
void
AddCard
(
CardLocation
loc
,
int
cardId
,
int
player
,
int
seq
,
int
pos
)
{
{
switch
(
loc
)
switch
(
loc
)
{
{
case
CardLocation
.
Hand
:
case
CardLocation
.
Hand
:
Fields
[
player
].
Hand
.
Add
(
new
ClientCard
(
cardId
,
loc
,
pos
));
Fields
[
player
].
Hand
.
Add
(
new
ClientCard
(
cardId
,
loc
,
-
1
,
pos
));
break
;
break
;
case
CardLocation
.
Grave
:
case
CardLocation
.
Grave
:
Fields
[
player
].
Graveyard
.
Add
(
new
ClientCard
(
cardId
,
loc
,
pos
));
Fields
[
player
].
Graveyard
.
Add
(
new
ClientCard
(
cardId
,
loc
,
-
1
,
pos
));
break
;
break
;
case
CardLocation
.
Removed
:
case
CardLocation
.
Removed
:
Fields
[
player
].
Banished
.
Add
(
new
ClientCard
(
cardId
,
loc
,
pos
));
Fields
[
player
].
Banished
.
Add
(
new
ClientCard
(
cardId
,
loc
,
-
1
,
pos
));
break
;
break
;
case
CardLocation
.
MonsterZone
:
case
CardLocation
.
MonsterZone
:
Fields
[
player
].
MonsterZone
[
zone
]
=
new
ClientCard
(
cardId
,
loc
,
pos
);
Fields
[
player
].
MonsterZone
[
seq
]
=
new
ClientCard
(
cardId
,
loc
,
seq
,
pos
);
break
;
break
;
case
CardLocation
.
SpellZone
:
case
CardLocation
.
SpellZone
:
Fields
[
player
].
SpellZone
[
zone
]
=
new
ClientCard
(
cardId
,
loc
,
pos
);
Fields
[
player
].
SpellZone
[
seq
]
=
new
ClientCard
(
cardId
,
loc
,
seq
,
pos
);
break
;
break
;
case
CardLocation
.
Deck
:
case
CardLocation
.
Deck
:
Fields
[
player
].
Deck
.
Add
(
new
ClientCard
(
cardId
,
loc
,
pos
));
Fields
[
player
].
Deck
.
Add
(
new
ClientCard
(
cardId
,
loc
,
-
1
,
pos
));
break
;
break
;
case
CardLocation
.
Extra
:
case
CardLocation
.
Extra
:
Fields
[
player
].
ExtraDeck
.
Add
(
new
ClientCard
(
cardId
,
loc
,
pos
));
Fields
[
player
].
ExtraDeck
.
Add
(
new
ClientCard
(
cardId
,
loc
,
-
1
,
pos
));
break
;
break
;
}
}
}
}
public
void
AddCard
(
CardLocation
loc
,
ClientCard
card
,
int
player
,
int
zone
,
int
pos
,
int
id
)
public
void
AddCard
(
CardLocation
loc
,
ClientCard
card
,
int
player
,
int
seq
,
int
pos
,
int
id
)
{
{
card
.
Location
=
loc
;
card
.
Location
=
loc
;
card
.
Sequence
=
seq
;
card
.
Position
=
pos
;
card
.
Position
=
pos
;
card
.
SetId
(
id
);
card
.
SetId
(
id
);
switch
(
loc
)
switch
(
loc
)
...
@@ -138,10 +139,10 @@ namespace WindBot.Game
...
@@ -138,10 +139,10 @@ namespace WindBot.Game
Fields
[
player
].
Banished
.
Add
(
card
);
Fields
[
player
].
Banished
.
Add
(
card
);
break
;
break
;
case
CardLocation
.
MonsterZone
:
case
CardLocation
.
MonsterZone
:
Fields
[
player
].
MonsterZone
[
zone
]
=
card
;
Fields
[
player
].
MonsterZone
[
seq
]
=
card
;
break
;
break
;
case
CardLocation
.
SpellZone
:
case
CardLocation
.
SpellZone
:
Fields
[
player
].
SpellZone
[
zone
]
=
card
;
Fields
[
player
].
SpellZone
[
seq
]
=
card
;
break
;
break
;
case
CardLocation
.
Deck
:
case
CardLocation
.
Deck
:
Fields
[
player
].
Deck
.
Add
(
card
);
Fields
[
player
].
Deck
.
Add
(
card
);
...
@@ -152,7 +153,7 @@ namespace WindBot.Game
...
@@ -152,7 +153,7 @@ namespace WindBot.Game
}
}
}
}
public
void
RemoveCard
(
CardLocation
loc
,
ClientCard
card
,
int
player
,
int
zone
)
public
void
RemoveCard
(
CardLocation
loc
,
ClientCard
card
,
int
player
,
int
seq
)
{
{
switch
(
loc
)
switch
(
loc
)
{
{
...
@@ -166,10 +167,10 @@ namespace WindBot.Game
...
@@ -166,10 +167,10 @@ namespace WindBot.Game
Fields
[
player
].
Banished
.
Remove
(
card
);
Fields
[
player
].
Banished
.
Remove
(
card
);
break
;
break
;
case
CardLocation
.
MonsterZone
:
case
CardLocation
.
MonsterZone
:
Fields
[
player
].
MonsterZone
[
zone
]
=
null
;
Fields
[
player
].
MonsterZone
[
seq
]
=
null
;
break
;
break
;
case
CardLocation
.
SpellZone
:
case
CardLocation
.
SpellZone
:
Fields
[
player
].
SpellZone
[
zone
]
=
null
;
Fields
[
player
].
SpellZone
[
seq
]
=
null
;
break
;
break
;
case
CardLocation
.
Deck
:
case
CardLocation
.
Deck
:
Fields
[
player
].
Deck
.
Remove
(
card
);
Fields
[
player
].
Deck
.
Remove
(
card
);
...
...
Game/GameAI.cs
View file @
8880a1d5
...
@@ -92,11 +92,12 @@ namespace WindBot.Game
...
@@ -92,11 +92,12 @@ namespace WindBot.Game
public
void
OnNewPhase
()
public
void
OnNewPhase
()
{
{
m_selector
.
Clear
();
m_selector
.
Clear
();
m_position
.
Clear
();
m_selector_pointer
=
-
1
;
m_selector_pointer
=
-
1
;
m_materialSelector
=
null
;
m_materialSelector
=
null
;
m_option
=
-
1
;
m_option
=
-
1
;
m_yesno
=
-
1
;
m_yesno
=
-
1
;
m_position
=
CardPosition
.
FaceUpAttack
;
m_place
=
0
;
m_place
=
0
;
if
(
Duel
.
Player
==
0
&&
Duel
.
Phase
==
DuelPhase
.
Draw
)
if
(
Duel
.
Player
==
0
&&
Duel
.
Phase
==
DuelPhase
.
Draw
)
{
{
...
@@ -508,8 +509,7 @@ namespace WindBot.Game
...
@@ -508,8 +509,7 @@ namespace WindBot.Game
/// <returns>Selected position.</returns>
/// <returns>Selected position.</returns>
public
CardPosition
OnSelectPosition
(
int
cardId
,
IList
<
CardPosition
>
positions
)
public
CardPosition
OnSelectPosition
(
int
cardId
,
IList
<
CardPosition
>
positions
)
{
{
CardPosition
selector_selected
=
m_position
;
CardPosition
selector_selected
=
GetSelectedPosition
();
m_position
=
CardPosition
.
FaceUpAttack
;
CardPosition
executor_selected
=
Executor
.
OnSelectPosition
(
cardId
,
positions
);
CardPosition
executor_selected
=
Executor
.
OnSelectPosition
(
cardId
,
positions
);
...
@@ -747,7 +747,6 @@ namespace WindBot.Game
...
@@ -747,7 +747,6 @@ namespace WindBot.Game
private
CardSelector
m_materialSelector
;
private
CardSelector
m_materialSelector
;
private
CardPosition
m_position
=
CardPosition
.
FaceUpAttack
;
private
int
m_place
;
private
int
m_place
;
private
int
m_option
;
private
int
m_option
;
private
int
m_number
;
private
int
m_number
;
...
@@ -755,6 +754,7 @@ namespace WindBot.Game
...
@@ -755,6 +754,7 @@ namespace WindBot.Game
private
int
m_yesno
;
private
int
m_yesno
;
private
IList
<
CardAttribute
>
m_attributes
=
new
List
<
CardAttribute
>();
private
IList
<
CardAttribute
>
m_attributes
=
new
List
<
CardAttribute
>();
private
IList
<
CardSelector
>
m_selector
=
new
List
<
CardSelector
>();
private
IList
<
CardSelector
>
m_selector
=
new
List
<
CardSelector
>();
private
IList
<
CardPosition
>
m_position
=
new
List
<
CardPosition
>();
private
int
m_selector_pointer
=
-
1
;
private
int
m_selector_pointer
=
-
1
;
private
IList
<
CardRace
>
m_races
=
new
List
<
CardRace
>();
private
IList
<
CardRace
>
m_races
=
new
List
<
CardRace
>();
...
@@ -929,9 +929,20 @@ namespace WindBot.Game
...
@@ -929,9 +929,20 @@ namespace WindBot.Game
return
selected
;
return
selected
;
}
}
public
CardPosition
GetSelectedPosition
()
{
CardPosition
selected
=
CardPosition
.
FaceUpAttack
;
if
(
m_position
.
Count
>
0
)
{
selected
=
m_position
[
0
];
m_position
.
RemoveAt
(
0
);
}
return
selected
;
}
public
void
SelectPosition
(
CardPosition
pos
)
public
void
SelectPosition
(
CardPosition
pos
)
{
{
m_position
=
pos
;
m_position
.
Add
(
pos
)
;
}
}
public
void
SelectPlace
(
int
zones
)
public
void
SelectPlace
(
int
zones
)
...
...
Game/GameBehavior.cs
View file @
8880a1d5
...
@@ -101,6 +101,7 @@ namespace WindBot.Game
...
@@ -101,6 +101,7 @@ namespace WindBot.Game
_messages
.
Add
(
GameMessage
.
Recover
,
OnRecover
);
_messages
.
Add
(
GameMessage
.
Recover
,
OnRecover
);
_messages
.
Add
(
GameMessage
.
LpUpdate
,
OnLpUpdate
);
_messages
.
Add
(
GameMessage
.
LpUpdate
,
OnLpUpdate
);
_messages
.
Add
(
GameMessage
.
Move
,
OnMove
);
_messages
.
Add
(
GameMessage
.
Move
,
OnMove
);
_messages
.
Add
(
GameMessage
.
Swap
,
OnSwap
);
_messages
.
Add
(
GameMessage
.
Attack
,
OnAttack
);
_messages
.
Add
(
GameMessage
.
Attack
,
OnAttack
);
_messages
.
Add
(
GameMessage
.
PosChange
,
OnPosChange
);
_messages
.
Add
(
GameMessage
.
PosChange
,
OnPosChange
);
_messages
.
Add
(
GameMessage
.
Chaining
,
OnChaining
);
_messages
.
Add
(
GameMessage
.
Chaining
,
OnChaining
);
...
@@ -130,7 +131,8 @@ namespace WindBot.Game
...
@@ -130,7 +131,8 @@ namespace WindBot.Game
_messages
.
Add
(
GameMessage
.
AnnounceRace
,
OnAnnounceRace
);
_messages
.
Add
(
GameMessage
.
AnnounceRace
,
OnAnnounceRace
);
_messages
.
Add
(
GameMessage
.
AnnounceCardFilter
,
OnAnnounceCard
);
_messages
.
Add
(
GameMessage
.
AnnounceCardFilter
,
OnAnnounceCard
);
_messages
.
Add
(
GameMessage
.
RockPaperScissors
,
OnRockPaperScissors
);
_messages
.
Add
(
GameMessage
.
RockPaperScissors
,
OnRockPaperScissors
);
_messages
.
Add
(
GameMessage
.
Equip
,
OnEquip
);
_messages
.
Add
(
GameMessage
.
Unequip
,
OnUnEquip
);
_messages
.
Add
(
GameMessage
.
Summoning
,
OnSummoning
);
_messages
.
Add
(
GameMessage
.
Summoning
,
OnSummoning
);
_messages
.
Add
(
GameMessage
.
Summoned
,
OnSummoned
);
_messages
.
Add
(
GameMessage
.
Summoned
,
OnSummoned
);
_messages
.
Add
(
GameMessage
.
SpSummoning
,
OnSpSummoning
);
_messages
.
Add
(
GameMessage
.
SpSummoning
,
OnSpSummoning
);
...
@@ -365,7 +367,7 @@ namespace WindBot.Game
...
@@ -365,7 +367,7 @@ namespace WindBot.Game
for
(
int
i
=
0
;
i
<
count
;
++
i
)
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
{
_duel
.
Fields
[
player
].
Deck
.
RemoveAt
(
_duel
.
Fields
[
player
].
Deck
.
Count
-
1
);
_duel
.
Fields
[
player
].
Deck
.
RemoveAt
(
_duel
.
Fields
[
player
].
Deck
.
Count
-
1
);
_duel
.
Fields
[
player
].
Hand
.
Add
(
new
ClientCard
(
0
,
CardLocation
.
Hand
));
_duel
.
Fields
[
player
].
Hand
.
Add
(
new
ClientCard
(
0
,
CardLocation
.
Hand
,
-
1
));
}
}
_ai
.
OnDraw
(
player
);
_ai
.
OnDraw
(
player
);
}
}
...
@@ -436,19 +438,19 @@ namespace WindBot.Game
...
@@ -436,19 +438,19 @@ namespace WindBot.Game
_duel
.
Fields
[
player
].
Deck
.
Clear
();
_duel
.
Fields
[
player
].
Deck
.
Clear
();
for
(
int
i
=
0
;
i
<
mcount
;
++
i
)
for
(
int
i
=
0
;
i
<
mcount
;
++
i
)
{
{
_duel
.
Fields
[
player
].
Deck
.
Add
(
new
ClientCard
(
0
,
CardLocation
.
Deck
));
_duel
.
Fields
[
player
].
Deck
.
Add
(
new
ClientCard
(
0
,
CardLocation
.
Deck
,
-
1
));
}
}
_duel
.
Fields
[
player
].
ExtraDeck
.
Clear
();
_duel
.
Fields
[
player
].
ExtraDeck
.
Clear
();
for
(
int
i
=
0
;
i
<
ecount
;
++
i
)
for
(
int
i
=
0
;
i
<
ecount
;
++
i
)
{
{
int
code
=
packet
.
ReadInt32
()
&
0x7fffffff
;
int
code
=
packet
.
ReadInt32
()
&
0x7fffffff
;
_duel
.
Fields
[
player
].
ExtraDeck
.
Add
(
new
ClientCard
(
code
,
CardLocation
.
Extra
));
_duel
.
Fields
[
player
].
ExtraDeck
.
Add
(
new
ClientCard
(
code
,
CardLocation
.
Extra
,
-
1
));
}
}
_duel
.
Fields
[
player
].
Hand
.
Clear
();
_duel
.
Fields
[
player
].
Hand
.
Clear
();
for
(
int
i
=
0
;
i
<
hcount
;
++
i
)
for
(
int
i
=
0
;
i
<
hcount
;
++
i
)
{
{
int
code
=
packet
.
ReadInt32
();
int
code
=
packet
.
ReadInt32
();
_duel
.
Fields
[
player
].
Hand
.
Add
(
new
ClientCard
(
code
,
CardLocation
.
Hand
));
_duel
.
Fields
[
player
].
Hand
.
Add
(
new
ClientCard
(
code
,
CardLocation
.
Hand
,-
1
));
}
}
}
}
...
@@ -575,6 +577,27 @@ namespace WindBot.Game
...
@@ -575,6 +577,27 @@ namespace WindBot.Game
}
}
}
}
private
void
OnSwap
(
BinaryReader
packet
)
{
int
cardId1
=
packet
.
ReadInt32
();
int
controler1
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
location1
=
packet
.
ReadByte
();
int
sequence1
=
packet
.
ReadByte
();
packet
.
ReadByte
();
int
cardId2
=
packet
.
ReadInt32
();
int
controler2
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
location2
=
packet
.
ReadByte
();
int
sequence2
=
packet
.
ReadByte
();
packet
.
ReadByte
();
ClientCard
card1
=
_duel
.
GetCard
(
controler1
,
(
CardLocation
)
location1
,
sequence1
);
ClientCard
card2
=
_duel
.
GetCard
(
controler2
,
(
CardLocation
)
location2
,
sequence2
);
if
(
card1
==
null
||
card2
==
null
)
return
;
_duel
.
RemoveCard
((
CardLocation
)
location1
,
card1
,
controler1
,
sequence1
);
_duel
.
RemoveCard
((
CardLocation
)
location2
,
card2
,
controler2
,
sequence2
);
_duel
.
AddCard
((
CardLocation
)
location2
,
card1
,
controler2
,
sequence2
,
card1
.
Position
,
cardId1
);
_duel
.
AddCard
((
CardLocation
)
location1
,
card2
,
controler1
,
sequence1
,
card2
.
Position
,
cardId2
);
}
private
void
OnAttack
(
BinaryReader
packet
)
private
void
OnAttack
(
BinaryReader
packet
)
{
{
int
ca
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
ca
=
GetLocalPlayer
(
packet
.
ReadByte
());
...
@@ -662,7 +685,7 @@ namespace WindBot.Game
...
@@ -662,7 +685,7 @@ namespace WindBot.Game
int
seq
=
packet
.
ReadByte
();
int
seq
=
packet
.
ReadByte
();
ClientCard
card
;
ClientCard
card
;
if
(((
int
)
loc
&
(
int
)
CardLocation
.
Overlay
)
!=
0
)
if
(((
int
)
loc
&
(
int
)
CardLocation
.
Overlay
)
!=
0
)
card
=
new
ClientCard
(
id
,
CardLocation
.
Overlay
);
card
=
new
ClientCard
(
id
,
CardLocation
.
Overlay
,
-
1
);
else
else
card
=
_duel
.
GetCard
(
controler
,
loc
,
seq
);
card
=
_duel
.
GetCard
(
controler
,
loc
,
seq
);
if
(
card
==
null
)
continue
;
if
(
card
==
null
)
continue
;
...
@@ -850,7 +873,7 @@ namespace WindBot.Game
...
@@ -850,7 +873,7 @@ namespace WindBot.Game
packet
.
ReadByte
();
// pos
packet
.
ReadByte
();
// pos
ClientCard
card
;
ClientCard
card
;
if
(((
int
)
loc
&
(
int
)
CardLocation
.
Overlay
)
!=
0
)
if
(((
int
)
loc
&
(
int
)
CardLocation
.
Overlay
)
!=
0
)
card
=
new
ClientCard
(
id
,
CardLocation
.
Overlay
);
card
=
new
ClientCard
(
id
,
CardLocation
.
Overlay
,
-
1
);
else
else
card
=
_duel
.
GetCard
(
player
,
loc
,
seq
);
card
=
_duel
.
GetCard
(
player
,
loc
,
seq
);
if
(
card
==
null
)
continue
;
if
(
card
==
null
)
continue
;
...
@@ -909,7 +932,7 @@ namespace WindBot.Game
...
@@ -909,7 +932,7 @@ namespace WindBot.Game
packet
.
ReadByte
();
// pos
packet
.
ReadByte
();
// pos
ClientCard
card
;
ClientCard
card
;
if
(((
int
)
loc
&
(
int
)
CardLocation
.
Overlay
)
!=
0
)
if
(((
int
)
loc
&
(
int
)
CardLocation
.
Overlay
)
!=
0
)
card
=
new
ClientCard
(
id
,
CardLocation
.
Overlay
);
card
=
new
ClientCard
(
id
,
CardLocation
.
Overlay
,
-
1
);
else
else
card
=
_duel
.
GetCard
(
player
,
loc
,
seq
);
card
=
_duel
.
GetCard
(
player
,
loc
,
seq
);
if
(
card
==
null
)
continue
;
if
(
card
==
null
)
continue
;
...
@@ -1412,6 +1435,43 @@ namespace WindBot.Game
...
@@ -1412,6 +1435,43 @@ namespace WindBot.Game
Connection
.
Send
(
CtosMessage
.
Response
,
result
);
Connection
.
Send
(
CtosMessage
.
Response
,
result
);
}
}
private
void
OnEquip
(
BinaryReader
packet
)
{
int
equipCardControler
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
equipCardLocation
=
packet
.
ReadByte
();
int
equipCardSequence
=
packet
.
ReadSByte
();
packet
.
ReadByte
();
int
targetCardControler
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
targetCardLocation
=
packet
.
ReadByte
();
int
targetCardSequence
=
packet
.
ReadSByte
();
packet
.
ReadByte
();
ClientCard
equipCard
=
_duel
.
GetCard
(
equipCardControler
,
(
CardLocation
)
equipCardLocation
,
equipCardSequence
);
ClientCard
targetCard
=
_duel
.
GetCard
(
targetCardControler
,
(
CardLocation
)
targetCardLocation
,
targetCardSequence
);
if
(
equipCard
==
null
||
targetCard
==
null
)
return
;
if
(
equipCard
.
EquipTarget
!=
null
)
{
equipCard
.
EquipTarget
.
EquipCards
.
Remove
(
equipCard
);
}
equipCard
.
EquipTarget
=
targetCard
;
targetCard
.
EquipCards
.
Add
(
equipCard
);
}
private
void
OnUnEquip
(
BinaryReader
packet
)
{
int
equipCardControler
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
equipCardLocation
=
packet
.
ReadByte
();
int
equipCardSequence
=
packet
.
ReadSByte
();
packet
.
ReadByte
();
ClientCard
equipCard
=
_duel
.
GetCard
(
equipCardControler
,
(
CardLocation
)
equipCardLocation
,
equipCardSequence
);
if
(
equipCard
==
null
)
return
;
if
(
equipCard
.
EquipTarget
!=
null
)
{
equipCard
.
EquipTarget
.
EquipCards
.
Remove
(
equipCard
);
equipCard
.
EquipTarget
=
null
;
}
}
private
void
OnSummoning
(
BinaryReader
packet
)
private
void
OnSummoning
(
BinaryReader
packet
)
{
{
_duel
.
LastSummonedCards
.
Clear
();
_duel
.
LastSummonedCards
.
Clear
();
...
...
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