Skip to content

Commit

Permalink
v0.1.1
Browse files Browse the repository at this point in the history
+option to search class+neutral cards
+option to highlight cards currently in hand
+removed included playerdecks.xml to avoid overwriting peoples decks

*end of game detection fixed (=> hiding overlay in menu option reenabled)
  • Loading branch information
epix37 committed May 30, 2014
1 parent 77936be commit 6e6fc82
Show file tree
Hide file tree
Showing 10 changed files with 274 additions and 149 deletions.
5 changes: 4 additions & 1 deletion Hearthstone Deck Tracker/Card.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public struct Card
private int? _count;
public string Name { get; set; }
public int Cost { get; set; }
public int InHandCount;


public string GetPlayerClass
{
Expand All @@ -32,11 +34,12 @@ public SolidColorBrush ColorPlayer
get
{
return Hearthstone.IsUsingPremade
? new SolidColorBrush((_count != 0) ? Colors.White : Colors.Gray)
?new SolidColorBrush((InHandCount > 0 && Hearthstone.HighlightCardsInHand) ? Colors.GreenYellow : (_count != 0) ? Colors.White : Colors.Gray)
: ColorEnemy;
}
}


public SolidColorBrush ColorEnemy
{
get { return new SolidColorBrush(Colors.White); }
Expand Down
1 change: 1 addition & 0 deletions Hearthstone Deck Tracker/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ public class Config
public int WindowHeight;
public string HearthstoneDirectory;
public bool ShowInTaskbar;
public bool HighlightCardsInHand;
}
}
3 changes: 0 additions & 3 deletions Hearthstone Deck Tracker/Hearthstone Deck Tracker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -1281,9 +1281,6 @@
<Content Include="images\ysera.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="PlayerDecks.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Version.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand Down
52 changes: 43 additions & 9 deletions Hearthstone Deck Tracker/Hearthstone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ public class Hearthstone
//public bool UsingPremadeDeck;
//public ObservableCollection<Card> PremadePlayerDeck;
public static bool IsUsingPremade;

//dont like this solution, cant think of better atm
public static bool HighlightCardsInHand;


private readonly Dictionary<string, Card> _cardDb;
public ObservableCollection<Card> EnemyCards;
public int EnemyHandCount;
Expand Down Expand Up @@ -105,7 +110,6 @@ public void PlayerDraw(string cardId)
return;
}
var card = GetCardFromDb(cardId);
//sorta need to chance this to get the full deck and remove then

if (!IsUsingPremade)
{
Expand All @@ -122,22 +126,41 @@ public void PlayerDraw(string cardId)

PlayerDeck.Remove(deckCard);
deckCard.Count--;
deckCard.InHandCount++;
PlayerDeck.Add(deckCard);
//if (deckCard.Count == 2)
// {
// deckCard.Count = 1;
// }
}
PlayerHandCount++;
}
public void PlayerGet()

//cards from board(?), thoughtsteal etc
public void PlayerGet(string cardId)
{
PlayerHandCount++;
PlayerHandCount++;
if (IsUsingPremade)
{
if (PlayerDeck.Any(c => c.Id == cardId))
{
var card = PlayerDeck.First(c => c.Id == cardId);
PlayerDeck.Remove(card);
card.InHandCount++;
PlayerDeck.Add(card);
}
}
}

public void PlayerPlayed(string cardId)
{
PlayerHandCount--;
if (IsUsingPremade)
{
if (PlayerDeck.Any(c => c.Id == cardId))
{
var card = PlayerDeck.First(c => c.Id == cardId);
PlayerDeck.Remove(card);
card.InHandCount--;
PlayerDeck.Add(card);
}
}
}

public void EnemyDraw()
Expand Down Expand Up @@ -180,6 +203,7 @@ public void Mulligan(string cardId)
Card deckCard = PlayerDeck.FirstOrDefault(c => c.Name != null && c.Name == card.Name);
PlayerDeck.Remove(deckCard);
deckCard.Count++;
deckCard.InHandCount--;
PlayerDeck.Add(deckCard);
}

Expand All @@ -193,7 +217,17 @@ public void EnemyMulligan()

internal void PlayerHandDiscard(string cardId)
{
PlayerHandCount--;
PlayerHandCount--;
if (IsUsingPremade)
{
if (PlayerDeck.Any(c => c.Id == cardId))
{
var card = PlayerDeck.First(c => c.Id == cardId);
PlayerDeck.Remove(card);
card.InHandCount--;
PlayerDeck.Add(card);
}
}
}

internal void PlayerDeckDiscard(string cardId)
Expand Down
Loading

0 comments on commit 6e6fc82

Please sign in to comment.