Skip to content

Commit

Permalink
Merge pull request HearthSim#619 from jw013/master
Browse files Browse the repository at this point in the history
Update Card.InHandCount for PlayerDrawn deck.
  • Loading branch information
Epix committed Jan 31, 2015
2 parents 55588f7 + e0fd664 commit 85ba766
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Hearthstone Deck Tracker/Hearthstone/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ public static async Task<bool> PlayerDraw(string cardId)
drawnCard = GetCardFromId(cardId);
PlayerDrawn.Add(drawnCard);
}
drawnCard.InHandCount++;
drawnCard.JustDrawn();


Expand Down Expand Up @@ -288,6 +289,7 @@ public static void PlayerGet(string cardId, bool fromPlay, int turn)
drawnCard.IsStolen = true;
PlayerDrawn.Add(drawnCard);
}
drawnCard.InHandCount++;
drawnCard.JustDrawn();

var deckCard = PlayerDeck.FirstOrDefault(c => c.Id == cardId && c.IsStolen);
Expand Down Expand Up @@ -318,6 +320,12 @@ public static void PlayerPlayed(string cardId)
if(CanRemoveCard(card))
PlayerDeck.Remove(card);
}

var drawnCard = PlayerDrawn.FirstOrDefault(c => c.Id == cardId);
if (drawnCard != null)
{
drawnCard.InHandCount--;
}
}

private static bool CanRemoveCard(Card card)
Expand Down

0 comments on commit 85ba766

Please sign in to comment.