Commit 5cfb5b78 authored by mercury233's avatar mercury233

fix OnMove, handle overlay correctly

parent 9a3e147a
...@@ -115,10 +115,11 @@ namespace WindBot.Game ...@@ -115,10 +115,11 @@ namespace WindBot.Game
} }
} }
public void AddCard(CardLocation loc, ClientCard card, int player, int zone, int pos) public void AddCard(CardLocation loc, ClientCard card, int player, int zone, int pos, int id)
{ {
card.Location = loc; card.Location = loc;
card.Position = pos; card.Position = pos;
card.SetId(id);
switch (loc) switch (loc)
{ {
case CardLocation.Hand: case CardLocation.Hand:
......
...@@ -469,6 +469,7 @@ namespace WindBot.Game ...@@ -469,6 +469,7 @@ namespace WindBot.Game
card = _duel.GetCard(previousControler, (CardLocation)previousLocation, previousSequence); card = _duel.GetCard(previousControler, (CardLocation)previousLocation, previousSequence);
if (card != null) if (card != null)
card.Overlays.Remove(cardId); card.Overlays.Remove(cardId);
previousLocation = 0; // the card is removed when it go to overlay, so here we treat it as a new card
} }
else else
_duel.RemoveCard((CardLocation)previousLocation, card, previousControler, previousSequence); _duel.RemoveCard((CardLocation)previousLocation, card, previousControler, previousSequence);
...@@ -485,7 +486,7 @@ namespace WindBot.Game ...@@ -485,7 +486,7 @@ namespace WindBot.Game
if (previousLocation == 0) if (previousLocation == 0)
_duel.AddCard((CardLocation)currentLocation, cardId, currentControler, currentSequence, currentPosition); _duel.AddCard((CardLocation)currentLocation, cardId, currentControler, currentSequence, currentPosition);
else else
_duel.AddCard((CardLocation)currentLocation, card, currentControler, currentSequence, currentPosition); _duel.AddCard((CardLocation)currentLocation, card, currentControler, currentSequence, currentPosition, cardId);
} }
} }
......
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