diff --git a/Decks/AI_FamiliarPossessed.ydk b/Decks/AI_FamiliarPossessed.ydk
index e809afe3..527ec21a 100644
--- a/Decks/AI_FamiliarPossessed.ydk
+++ b/Decks/AI_FamiliarPossessed.ydk
@@ -61,3 +61,18 @@
41999284
41999284
!side
+14558127
+23434538
+12580477
+14532163
+14532163
+14532163
+8267140
+8267140
+24224830
+24224830
+65681983
+65681983
+10045474
+10045474
+10045474
diff --git a/Decks/Lose/AI_FamiliarPossessed.ydk b/Decks/Lose/AI_FamiliarPossessed.ydk
new file mode 100644
index 00000000..33a80a99
--- /dev/null
+++ b/Decks/Lose/AI_FamiliarPossessed.ydk
@@ -0,0 +1,78 @@
+#created by ...
+#main
+71197066
+15397015
+15397015
+15397015
+4376659
+4376659
+31764354
+31887906
+40542826
+40542826
+68881650
+68881650
+14558127
+14558127
+36584821
+36584821
+18144506
+35261759
+35261759
+49238328
+49238328
+24224830
+24224830
+73915051
+73915051
+62256492
+62256492
+25704359
+25704359
+30241314
+30241314
+36975314
+36975314
+59305593
+59305593
+61740673
+82732705
+82732705
+40605147
+40605147
+41420027
+41420027
+84749824
+84749824
+#extra
+12014404
+31833038
+85289965
+65330383
+38342335
+2857636
+9839945
+30674956
+48815792
+73309655
+97661969
+75452921
+98978921
+41999284
+41999284
+!side
+14558127
+23434538
+23434538
+23434538
+12580477
+14532163
+14532163
+14532163
+8267140
+8267140
+65681983
+65681983
+10045474
+10045474
+10045474
diff --git a/Decks/Win/AI_FamiliarPossessed.ydk b/Decks/Win/AI_FamiliarPossessed.ydk
new file mode 100644
index 00000000..46c0f2ef
--- /dev/null
+++ b/Decks/Win/AI_FamiliarPossessed.ydk
@@ -0,0 +1,78 @@
+#created by ...
+#main
+71197066
+15397015
+15397015
+4376659
+4376659
+31764354
+31887906
+40542826
+40542826
+68881650
+68881650
+14558127
+14558127
+14558127
+36584821
+36584821
+23434538
+23434538
+23434538
+14532163
+14532163
+14532163
+18144506
+35261759
+35261759
+49238328
+49238328
+73915051
+73915051
+62256492
+62256492
+10045474
+10045474
+10045474
+25704359
+25704359
+36975314
+36975314
+61740673
+82732705
+82732705
+40605147
+41420027
+41420027
+#extra
+12014404
+31833038
+85289965
+65330383
+38342335
+2857636
+9839945
+30674956
+48815792
+73309655
+97661969
+75452921
+98978921
+41999284
+41999284
+!side
+15397015
+12580477
+8267140
+8267140
+24224830
+24224830
+65681983
+65681983
+30241314
+30241314
+59305593
+59305593
+40605147
+84749824
+84749824
diff --git a/Game/AI/Decks/FamiliarPossessedExecutor.cs b/Game/AI/Decks/FamiliarPossessedExecutor.cs
index 81a84571..b57f52a7 100644
--- a/Game/AI/Decks/FamiliarPossessedExecutor.cs
+++ b/Game/AI/Decks/FamiliarPossessedExecutor.cs
@@ -60,7 +60,13 @@ public class CardId
public const int WynnP = 30674956;
public const int HiitaP = 48815792;
public const int LynaP = 9839945;
-
+// side
+ public const int Raigeki = 12580477;
+ public const int lightningStorm = 14532163;
+ public const int CosmicCyclone = 8267140;
+ public const int CalledByTheGrave = 24224830;
+ public const int CrossoutDesignator = 65681983;
+ public const int InfiniteImpermanence = 10045474;
}
public FamiliarPossessedExecutor(GameAI ai, Duel duel)
@@ -74,6 +80,9 @@ public FamiliarPossessedExecutor(GameAI ai, Duel duel)
//Sticker
AddExecutor(ExecutorType.Activate, CardId.MacroCosmos, MacroCosmoseff);
//counter
+ AddExecutor(ExecutorType.Activate, CardId.CalledByTheGrave, DefaultCalledByTheGrave);
+ // AddExecutor(ExecutorType.Activate, CardId.CrossoutDesignator, DefaultCalledByTheGrave);
+ AddExecutor(ExecutorType.Activate, CardId.InfiniteImpermanence, DefaultInfiniteImpermanence);
AddExecutor(ExecutorType.Activate, CardId.AshBlossomAndJoyousSpring, DefaultAshBlossomAndJoyousSpring);
AddExecutor(ExecutorType.Activate, CardId.MaxxC, DefaultMaxxC);
AddExecutor(ExecutorType.Activate, CardId.SolemnWarning, DefaultSolemnWarning);
@@ -86,7 +95,10 @@ public FamiliarPossessedExecutor(GameAI ai, Duel duel)
AddExecutor(ExecutorType.Activate, CardId.Awakening);
AddExecutor(ExecutorType.Activate, CardId.Unpossessed, UnpossessedEffect);
//first do
+ AddExecutor(ExecutorType.Activate, CardId.lightningStorm, DefaultLightingStorm);
AddExecutor(ExecutorType.Activate, CardId.HarpieFeatherDuster, DefaultHarpiesFeatherDusterFirst);
+ AddExecutor(ExecutorType.Activate, CardId.CosmicCyclone, DefaultMysticalSpaceTyphoon);
+ AddExecutor(ExecutorType.Activate, CardId.Raigeki, DefaultRaigeki);
AddExecutor(ExecutorType.Activate, CardId.PotOfDesires, PotOfDesireseff);
//sp
AddExecutor(ExecutorType.Activate, CardId.Linkuriboh, Linkuriboheff);
@@ -626,4 +638,4 @@ public override bool OnSelectHand()
return true;
}
}
-}
\ No newline at end of file
+}
diff --git a/Game/AI/DefaultExecutor.cs b/Game/AI/DefaultExecutor.cs
index 50d04e4c..5ba457a4 100644
--- a/Game/AI/DefaultExecutor.cs
+++ b/Game/AI/DefaultExecutor.cs
@@ -119,6 +119,8 @@ protected class _CardId
public const int RoyalDecreel = 51452091;
public const int NaturiaBeast = 33198837;
public const int AntiSpellFragrance = 58921041;
+
+ public const int lightningStorm = 14532163;
}
protected DefaultExecutor(GameAI ai, Duel duel)
@@ -1167,5 +1169,20 @@ protected bool DefaultHonestEffect()
return Util.IsTurn1OrMain2();
}
+
+ protected bool DefaultLightingStorm()
+ {
+ if ((Enemy.MonsterZone.ToList().Count > Enemy.SpellZone.ToList().Count ) && Enemy.MonsterZone.ToList().Count>3)
+ {
+ AI.SelectPlace(Zones.MonsterZones);
+ return true;
+ }
+ else
+ {
+ AI.SelectPlace(Zones.SpellZones);
+ return true;
+ }
+
+ }
}
}
diff --git a/Game/GameBehavior.cs b/Game/GameBehavior.cs
index 0784257a..48f67750 100644
--- a/Game/GameBehavior.cs
+++ b/Game/GameBehavior.cs
@@ -16,6 +16,8 @@ public class GameBehavior
public GameClient Game { get; private set; }
public YGOClient Connection { get; private set; }
public Deck Deck { get; private set; }
+ public Deck DeckForWin { get; private set; }
+ public Deck DeckForLose { get; private set; }
private GameAI _ai;
@@ -28,6 +30,7 @@ public class GameBehavior
private bool _debug;
private int _select_hint;
private GameMessage _lastMessage;
+ private int lastDuelResult;
public GameBehavior(GameClient game)
{
@@ -44,9 +47,12 @@ public GameBehavior(GameClient game)
_ai = new GameAI(Game, _duel);
_ai.Executor = DecksManager.Instantiate(_ai, _duel);
- Deck = Deck.Load(Game.DeckFile ?? _ai.Executor.Deck);
-
+ string deckName = Game.DeckFile ?? _ai.Executor.Deck;
+ Deck = Deck.Load(deckName);
+ DeckForWin = Deck.Load("Win/" + deckName);
+ DeckForLose = Deck.Load("Lose/" + deckName);
_select_hint = 0;
+ lastDuelResult = 2;
}
public int GetLocalPlayer(int player)
@@ -144,6 +150,21 @@ private void RegisterPackets()
_messages.Add(GameMessage.FlipSummoned, OnSummoned);
}
+ private BinaryWriter buildUpdateDeck(Deck targetDeck) {
+ BinaryWriter deck = GamePacketFactory.Create(CtosMessage.UpdateDeck);
+ deck.Write(targetDeck.Cards.Count + targetDeck.ExtraCards.Count);
+ //Logger.WriteLine("Main + Extra: " + targetDeck.Cards.Count + targetDeck.ExtraCards.Count);
+ deck.Write(targetDeck.SideCards.Count);
+ //Logger.WriteLine("Side: " + targetDeck.SideCards.Count);
+ foreach (NamedCard card in targetDeck.Cards)
+ deck.Write(card.Id);
+ foreach (NamedCard card in targetDeck.ExtraCards)
+ deck.Write(card.Id);
+ foreach (NamedCard card in targetDeck.SideCards)
+ deck.Write(card.Id);
+ return deck;
+ }
+
private void OnJoinGame(BinaryReader packet)
{
/*int lflist = (int)*/ packet.ReadUInt32();
@@ -152,30 +173,27 @@ private void OnJoinGame(BinaryReader packet)
int duel_rule = packet.ReadByte();
_ai.Duel.IsNewRule = (duel_rule >= 4);
_ai.Duel.IsNewRule2020 = (duel_rule >= 5);
- BinaryWriter deck = GamePacketFactory.Create(CtosMessage.UpdateDeck);
- deck.Write(Deck.Cards.Count + Deck.ExtraCards.Count);
- deck.Write(Deck.SideCards.Count);
- foreach (NamedCard card in Deck.Cards)
- deck.Write(card.Id);
- foreach (NamedCard card in Deck.ExtraCards)
- deck.Write(card.Id);
- foreach (NamedCard card in Deck.SideCards)
- deck.Write(card.Id);
+ BinaryWriter deck = buildUpdateDeck(pickDeckOnResult());
Connection.Send(deck);
_ai.OnJoinGame();
}
+
+ private Deck pickDeckOnResult() {
+ if(lastDuelResult == 0 && DeckForWin != null) {
+ //Logger.WriteLine("Using deck for win: " + DeckForWin.SideCards[2].Name);
+ return DeckForWin;
+ }
+ if(lastDuelResult == 1 && DeckForLose != null) {
+ //Logger.WriteLine("Using deck for lose: " + DeckForLose.SideCards[2].Name);
+ return DeckForLose;
+ }
+ //Logger.WriteLine("Using default deck.");
+ return Deck;
+ }
private void OnChangeSide(BinaryReader packet)
{
- BinaryWriter deck = GamePacketFactory.Create(CtosMessage.UpdateDeck);
- deck.Write(Deck.Cards.Count + Deck.ExtraCards.Count);
- deck.Write(Deck.SideCards.Count);
- foreach (NamedCard card in Deck.Cards)
- deck.Write(card.Id);
- foreach (NamedCard card in Deck.ExtraCards)
- deck.Write(card.Id);
- foreach (NamedCard card in Deck.SideCards)
- deck.Write(card.Id);
+ BinaryWriter deck = buildUpdateDeck(pickDeckOnResult());
Connection.Send(deck);
_ai.OnJoinGame();
}
@@ -293,6 +311,7 @@ private void OnChat(BinaryReader packet)
private void OnErrorMsg(BinaryReader packet)
{
int msg = packet.ReadByte();
+ Logger.WriteLine("Got error: " + msg);
// align
packet.ReadByte();
packet.ReadByte();
@@ -359,7 +378,7 @@ private void OnStart(BinaryReader packet)
extra = packet.ReadInt16();
_duel.Fields[GetLocalPlayer(1)].Init(deck, extra);
- Logger.DebugWriteLine("Duel started: " + _room.Names[0] + " versus " + _room.Names[1]);
+ Logger.WriteLine("Duel started: " + _room.Names[0] + " versus " + _room.Names[1]);
_ai.OnStart();
}
@@ -367,9 +386,11 @@ private void OnWin(BinaryReader packet)
{
int result = GetLocalPlayer(packet.ReadByte());
+ lastDuelResult = result;
+
string otherName = _room.Position == 0 ? _room.Names[1] : _room.Names[0];
string textResult = (result == 2 ? "Draw" : result == 0 ? "Win" : "Lose");
- Logger.DebugWriteLine("Duel finished against " + otherName + ", result: " + textResult);
+ Logger.WriteLine("Duel finished against " + otherName + ", result: " + textResult);
}
private void OnDraw(BinaryReader packet)
diff --git a/WindBot.csproj b/WindBot.csproj
index 89fc2340..e65b476c 100644
--- a/WindBot.csproj
+++ b/WindBot.csproj
@@ -157,6 +157,12 @@
PreserveNewest
+
+ PreserveNewest
+
+
+ PreserveNewest
+
PreserveNewest
@@ -172,4 +178,4 @@
-->
-
\ No newline at end of file
+