Skip to content

Commit

Permalink
E.T.C. Band Support/Improved Fizzle Snapshots
Browse files Browse the repository at this point in the history
- Include E.T.C. Band in view activation card list
- Check hand/deck for more Fizzle Snapshots before clearing list
  • Loading branch information
batstyx committed May 20, 2024
2 parents 1a3af36 + c8fa722 commit 15e1316
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
5 changes: 4 additions & 1 deletion Graveyard/FizzleView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ public override bool Update(Card card)
{
Cards.AddRange(Core.Game.Player.Hand.OrderBy(e => e.ZonePosition).Select(e => Database.GetCardFromId(e.CardId)));
}
else if (card.Id == SnapshotId)
else if (card.Id == SnapshotId
&& Core.Game.Player.PlayerEntities
.Where(x => x.CardId == SnapshotId && (x.IsInHand || x.IsInDeck))
.Count() == 0)
{
Cards.Clear();
}
Expand Down
26 changes: 17 additions & 9 deletions Graveyard/Graveyard.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
using Hearthstone_Deck_Tracker.API;
using Hearthstone_Deck_Tracker.Enums;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using static HearthDb.CardIds.Collectible;
using Card = Hearthstone_Deck_Tracker.Hearthstone.Card;
using Core = Hearthstone_Deck_Tracker.API.Core;

Expand Down Expand Up @@ -149,7 +148,7 @@ public void Dispose()
Input.Dispose();
}

public void Clear()
public void ClearUI()
{
FriendlyPanel.Children.Clear();
EnemyPanel.Children.Clear();
Expand Down Expand Up @@ -178,14 +177,23 @@ public void Update()
}
}

/**
private IEnumerable<Card> _PlayerCardList = null;
private IEnumerable<Card> PlayerCardList => _PlayerCardList ?? (_PlayerCardList = Core.Game.Player.PlayerCardList.Concat(PlayerETCBand));
private IEnumerable<Card> PlayerETCBand => Core.Game.Player.PlayerSideboardsDict
.Where(s => s.OwnerCardId == Neutral.ETCBandManager)
.FirstOrDefault()
.Cards;

/**
* Clear then recreate all Views.
*/
public void Reset()
public void Reset()
{
Clear();
ClearUI();

_PlayerCardList = null;

if ((Core.Game.IsInMenu && Hearthstone_Deck_Tracker.Config.Instance.HideInMenu) || Core.Game.IsBattlegroundsMatch || Core.Game.IsMercenariesMatch)
if ((Core.Game.IsInMenu && Hearthstone_Deck_Tracker.Config.Instance.HideInMenu) || Core.Game.IsBattlegroundsMatch || Core.Game.IsMercenariesMatch)
{
// don't initialize in menu unless the overlay is visible
// don't show graveyard for Battlegrounds or Mercenaries
Expand Down Expand Up @@ -217,7 +225,7 @@ public void Reset()
// Show "demo mode" when overlay is visible in menu
if (Core.Game.IsInMenu)
{
foreach (var card in Core.Game.Player.PlayerCardList)
foreach (var card in PlayerCardList)
{
if (card != null)
{
Expand All @@ -233,7 +241,7 @@ public void Reset()

private ViewBase InitializeView(Panel parent, ViewConfig config, bool isDefault = false)
{
var view = new ViewBuilder(config, Core.Game.Player.PlayerCardList).BuildView();
var view = new ViewBuilder(config, PlayerCardList).BuildView();
if (view == null) return null;

config.RegisterView(view, isDefault);
Expand Down
4 changes: 2 additions & 2 deletions Graveyard/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.14.2.0")]
[assembly: AssemblyFileVersion("1.14.2.0")]
[assembly: AssemblyVersion("1.14.3.0")]
[assembly: AssemblyFileVersion("1.14.3.0")]

0 comments on commit 15e1316

Please sign in to comment.