Skip to content

Commit

Permalink
Implemented new chance frames.
Browse files Browse the repository at this point in the history
Reduced chance probability to nearest tenth of a percent to reduce
visual overload.
  • Loading branch information
zachwlewis committed Aug 19, 2015
1 parent 4cf2524 commit b51b6c7
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 28 deletions.
2 changes: 2 additions & 0 deletions Hearthstone Deck Tracker/Hearthstone Deck Tracker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,8 @@
<Content Include="Images\bluegill-warrior.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Resource Include="Images\opponent-chance-frame.png" />
<Resource Include="Images\player-chance-frame.png" />
<Content Include="Images\thunder-bluff-valiant.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Expand Down
27 changes: 20 additions & 7 deletions Hearthstone Deck Tracker/Windows/OverlayWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<TextBox x:Name="LblDebugLog" Text="Test" TextWrapping="Wrap" FontSize="14" Foreground="Aqua" />
</ScrollViewer>

<StackPanel Name="StackPanelPlayer" Canvas.Left="438" Canvas.Top="47" Width="218">
<StackPanel Name="StackPanelPlayer" Canvas.Left="604" Canvas.Top="203" Width="218">
<local:HearthstoneTextBlock x:Name="LblDeckTitle" FontSize="16" Text="Deck title" />
<local:HearthstoneTextBlock x:Name="LblWins" FontSize="16" Text="0 - 0 (0%)" />
<controls:DeckListView x:Name="ListViewPlayer" Height="auto" Canvas.Left="350" Canvas.Top="147"
Expand Down Expand Up @@ -52,16 +52,21 @@
<local:HearthstoneTextBlock x:Name="LblCardCount" FontSize="18" Text="3" VerticalAlignment="Center" TextAlignment="Center" Width="48" HorizontalAlignment="Left" Margin="50,0,0,0" />
<local:HearthstoneTextBlock x:Name="LblDeckCount" FontSize="18" Text="27" TextAlignment="Center" Width="48" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="20,0,0,0" />
</StackPanel>
<Canvas Name="CanvasPlayerChance" HorizontalAlignment="Stretch" Height="66" Width="218" Margin="0,5">
<Canvas.Background>
<ImageBrush ImageSource="/HearthstoneDeckTracker;component/Images/player-chance-frame.png"/>
</Canvas.Background>
<local:HearthstoneTextBlock x:Name="LblDrawChance1" FontSize="18" Text="0%" Canvas.Left="64" Canvas.Top="27" TextAlignment="Right" Width="55" />
<local:HearthstoneTextBlock x:Name="LblDrawChance2" FontSize="18" Text="0%" Canvas.Left="146" Canvas.Top="27" TextAlignment="Right" Width="55" />
</Canvas>
<StackPanel Name="StackPanelPlayerDraw" Orientation="Horizontal" HorizontalAlignment="Center">
<local:HearthstoneTextBlock x:Name="LblDrawChance2" FontSize="16" Text="0%" />
<local:HearthstoneTextBlock x:Name="LblDrawChance1" FontSize="16" Text="0%" Margin="4,0,0,0" />
</StackPanel>
<StackPanel Name="StackPanelPlayerFatigue" Orientation="Horizontal" HorizontalAlignment="Center">
<local:HearthstoneTextBlock x:Name="LblPlayerFatigue" FontSize="14" Text="" Margin="4,0,0,0" />
</StackPanel>

</StackPanel>
<StackPanel Name="StackPanelOpponent" Width="218">
<StackPanel Name="StackPanelOpponent" Width="218" Canvas.Top="203" Canvas.Left="10">
<Viewbox StretchDirection="DownOnly" Name="ViewBoxWinRateAgainst">
<local:HearthstoneTextBlock x:Name="LblWinRateAgainst" FontSize="16" Text="VS: 0 - 0 (0%)"/>
</Viewbox>
Expand Down Expand Up @@ -90,8 +95,16 @@
<local:HearthstoneTextBlock x:Name="LblOpponentCardCount" FontSize="18" Text="3" VerticalAlignment="Center" TextAlignment="Center" Width="48" HorizontalAlignment="Left" Margin="50,0,0,0" />
<local:HearthstoneTextBlock x:Name="LblOpponentDeckCount" FontSize="18" Text="27" TextAlignment="Center" Width="48" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="20,0,0,0" />
</StackPanel>
<local:HearthstoneTextBlock x:Name="LblOpponentDrawChance2" FontSize="16" Text="0%" />
<local:HearthstoneTextBlock x:Name="LblOpponentDrawChance1" FontSize="16" Text="0%" />
<Canvas Name="CanvasOpponentChance" HorizontalAlignment="Stretch" Height="105" Width="218" Margin="0,5">
<Canvas.Background>
<ImageBrush ImageSource="/HearthstoneDeckTracker;component/Images/opponent-chance-frame.png"/>
</Canvas.Background>
<local:HearthstoneTextBlock x:Name="LblOpponentDrawChance1" FontSize="18" Text="0%" Canvas.Left="64" Canvas.Top="27" TextAlignment="Right" Width="55" />
<local:HearthstoneTextBlock x:Name="LblOpponentDrawChance2" FontSize="18" Text="0%" Canvas.Left="146" Canvas.Top="27" TextAlignment="Right" Width="55" />
<local:HearthstoneTextBlock x:Name="LblOpponentHandChance1" FontSize="18" Text="0%" Canvas.Left="64" Canvas.Top="65" TextAlignment="Right" Width="55" />
<local:HearthstoneTextBlock x:Name="LblOpponentHandChance2" FontSize="18" Text="0%" Canvas.Left="146" Canvas.Top="65" TextAlignment="Right" Width="55" />
</Canvas>

<StackPanel Name="StackPanelOpponentFatigue" Orientation="Horizontal" HorizontalAlignment="Center">
<local:HearthstoneTextBlock x:Name="LblOpponentFatigue" FontSize="14" Text="" Margin="4,0,0,0" />
</StackPanel>
Expand Down
43 changes: 22 additions & 21 deletions Hearthstone Deck Tracker/Windows/OverlayWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -353,22 +353,26 @@ private void SetOpponentCardCount(int cardCount, int cardsLeftInDeck)
{
LblOpponentFatigue.Text = "Next draw fatigues for: " + (Game.OpponentFatigueCount + 1);

LblOpponentDrawChance2.Text = cardCount <= 0 ? "[2]: -% / -%" : "[2]: 100% / -%";
LblOpponentDrawChance1.Text = cardCount <= 0 ? "[1]: -% / -%" : "[1]: 100% / -%";
return;
LblOpponentDrawChance2.Text = "0%";
LblOpponentDrawChance1.Text = "0%";
LblOpponentHandChance2.Text = cardCount <= 0 ? "0%" : "100%"; ;
LblOpponentHandChance1.Text = cardCount <= 0 ? "0%" : "100%";
return;
}
LblOpponentFatigue.Text = "";

var handWithoutCoin = cardCount - (Game.OpponentHasCoin ? 1 : 0);

var holdingNextTurn2 = Math.Round(100.0f * Helper.DrawProbability(2, (cardsLeftInDeck + handWithoutCoin), handWithoutCoin + 1), 2);
var drawNextTurn2 = Math.Round(200.0f / cardsLeftInDeck, 2);
LblOpponentDrawChance2.Text = "[2]: " + holdingNextTurn2 + "% / " + drawNextTurn2 + "%";
var holdingNextTurn2 = Math.Round(100.0f * Helper.DrawProbability(2, (cardsLeftInDeck + handWithoutCoin), handWithoutCoin + 1), 1);
var drawNextTurn2 = Math.Round(200.0f / cardsLeftInDeck, 1);
LblOpponentDrawChance2.Text = drawNextTurn2 + "%";
LblOpponentHandChance2.Text = holdingNextTurn2 + "%";

var holdingNextTurn = Math.Round(100.0f * Helper.DrawProbability(1, (cardsLeftInDeck + handWithoutCoin), handWithoutCoin + 1), 2);
var drawNextTurn = Math.Round(100.0f / cardsLeftInDeck, 2);
LblOpponentDrawChance1.Text = "[1]: " + holdingNextTurn + "% / " + drawNextTurn + "%";
}
var holdingNextTurn = Math.Round(100.0f * Helper.DrawProbability(1, (cardsLeftInDeck + handWithoutCoin), handWithoutCoin + 1), 1);
var drawNextTurn = Math.Round(100.0f / cardsLeftInDeck, 1);
LblOpponentDrawChance1.Text = drawNextTurn + "%";
LblOpponentHandChance1.Text = holdingNextTurn + "%";
}

private void SetCardCount(int cardCount, int cardsLeftInDeck)
{
Expand All @@ -384,14 +388,14 @@ private void SetCardCount(int cardCount, int cardsLeftInDeck)
{
LblPlayerFatigue.Text = "Next draw fatigues for: " + (Game.PlayerFatigueCount + 1);

LblDrawChance2.Text = "[2]: -%";
LblDrawChance1.Text = "[1]: -%";
LblDrawChance2.Text = "0%";
LblDrawChance1.Text = "0%";
return;
}
LblPlayerFatigue.Text = "";

LblDrawChance2.Text = "[2]: " + Math.Round(200.0f / cardsLeftInDeck, 2) + "%";
LblDrawChance1.Text = "[1]: " + Math.Round(100.0f / cardsLeftInDeck, 2) + "%";
LblDrawChance2.Text = Math.Round(200.0f / cardsLeftInDeck, 1) + "%";
LblDrawChance1.Text = Math.Round(100.0f / cardsLeftInDeck, 1) + "%";
}

public void ShowOverlay(bool enable)
Expand Down Expand Up @@ -584,13 +588,11 @@ public void Update(bool refresh)
&& !_uiMovable ? Visibility.Collapsed : Visibility.Visible;
}

LblDrawChance1.Visibility = Config.Instance.HideDrawChances ? Visibility.Collapsed : Visibility.Visible;
LblDrawChance2.Visibility = Config.Instance.HideDrawChances ? Visibility.Collapsed : Visibility.Visible;
CanvasPlayerChance.Visibility = Config.Instance.HideDrawChances ? Visibility.Collapsed : Visibility.Visible;
LblPlayerFatigue.Visibility = Config.Instance.HidePlayerFatigueCount ? Visibility.Collapsed : Visibility.Visible;
StackPanelPlayerCount.Visibility = Config.Instance.HidePlayerCardCount ? Visibility.Collapsed : Visibility.Visible;

LblOpponentDrawChance1.Visibility = Config.Instance.HideOpponentDrawChances ? Visibility.Collapsed : Visibility.Visible;
LblOpponentDrawChance2.Visibility = Config.Instance.HideOpponentDrawChances ? Visibility.Collapsed : Visibility.Visible;
CanvasOpponentChance.Visibility = Config.Instance.HideOpponentDrawChances ? Visibility.Collapsed : Visibility.Visible;
LblOpponentFatigue.Visibility = Config.Instance.HideOpponentFatigueCount ? Visibility.Collapsed : Visibility.Visible;
StackPanelOpponentCount.Visibility = Config.Instance.HideOpponentCardCount ? Visibility.Collapsed : Visibility.Visible;
if(Game.IsInMenu && !_uiMovable)
Expand Down Expand Up @@ -972,7 +974,7 @@ public void UpdatePlayerLayout()
StackPanelPlayer.Children.Add(ListViewPlayer);
break;
case "Draw Chances":
StackPanelPlayer.Children.Add(StackPanelPlayerDraw);
StackPanelPlayer.Children.Add(CanvasPlayerChance);
break;
case "Card Counter":
StackPanelPlayer.Children.Add(StackPanelPlayerCount);
Expand Down Expand Up @@ -1001,8 +1003,7 @@ public void UpdateOpponentLayout()
StackPanelOpponent.Children.Add(ListViewOpponent);
break;
case "Draw Chances":
StackPanelOpponent.Children.Add(LblOpponentDrawChance1);
StackPanelOpponent.Children.Add(LblOpponentDrawChance2);
StackPanelOpponent.Children.Add(CanvasOpponentChance);
break;
case "Card Counter":
StackPanelOpponent.Children.Add(StackPanelOpponentCount);
Expand Down

0 comments on commit b51b6c7

Please sign in to comment.