Commit 80cbd224 authored by nanahira's avatar nanahira

change side

parent a87c4681
......@@ -16,6 +16,8 @@ namespace WindBot.Game
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;
......@@ -46,7 +48,8 @@ namespace WindBot.Game
_ai = new GameAI(Game, _duel);
_ai.Executor = DecksManager.Instantiate(_ai, _duel);
Deck = Deck.Load(_ai.Executor.Deck);
DeckForWin = Deck.Load("Win/" + _ai.Executor.Deck);
DeckForLose = Deck.Load("Lose/" + _ai.Executor.Deck);
_select_hint = 0;
lastDuelResult = 2;
}
......@@ -171,10 +174,20 @@ namespace WindBot.Game
Connection.Send(deck);
_ai.OnJoinGame();
}
private Deck pickDeckOnResult() {
if(lastDuelResult == 0 && DeckForWin != null) {
return DeckForWin;
}
if(lastDuelResult == 1 && DeckForLose != null) {
return DeckForLose;
}
return Deck;
}
private void OnChangeSide(BinaryReader packet)
{
BinaryWriter deck = buildUpdateDeck(Deck);
BinaryWriter deck = buildUpdateDeck(pickDeckOnResult());
Connection.Send(deck);
_ai.OnJoinGame();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment