Skip to content

Commit

Permalink
fix: consider battlegrounds spells for board slots
Browse files Browse the repository at this point in the history
  • Loading branch information
beheh committed Dec 6, 2023
1 parent 41ef4cf commit 23f0e65
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
7 changes: 5 additions & 2 deletions Hearthstone Deck Tracker/Hearthstone/Entities/Entity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void ClearCardId()
public bool IsOpponent => !IsPlayer && HasTag(GameTag.PLAYER_ID);

[JsonIgnore]
public bool IsMinionOrLocation => IsMinion || IsLocation;
public bool TakesBoardSlot => IsMinion || IsLocation || IsBattlegroundsSpell;

[JsonIgnore]
public bool IsMinion => GetTag(GameTag.CARDTYPE) == (int)CardType.MINION;
Expand All @@ -89,7 +89,7 @@ public void ClearCardId()
public bool IsLocation => GetTag(GameTag.CARDTYPE) == (int)CardType.LOCATION;

[JsonIgnore]
public bool IsPlayableCard => IsMinionOrLocation || IsSpell || IsWeapon || IsPlayableHero;
public bool IsPlayableCard => IsMinion || IsLocation || IsSpell || IsWeapon || IsPlayableHero;

[JsonIgnore]
public bool IsWeapon => GetTag(GameTag.CARDTYPE) == (int)CardType.WEAPON;
Expand Down Expand Up @@ -124,6 +124,9 @@ public void ClearCardId()
[JsonIgnore]
public bool IsBattlegroundsQuest => HasTag(GameTag.QUEST_REWARD_DATABASE_ID);

[JsonIgnore]
public bool IsBattlegroundsSpell => GetTag(GameTag.CARDTYPE) == (int)CardType.BATTLEGROUND_SPELL;

[JsonIgnore]
public bool IsSideQuest => HasTag(GameTag.SIDEQUEST);

Expand Down
4 changes: 2 additions & 2 deletions Hearthstone Deck Tracker/Hearthstone/GameV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ public GameV2()
public bool IsMinionInPlay => Entities.Values.FirstOrDefault(x => x.IsInPlay && x.IsMinion) != null;
public bool IsOpponentMinionInPlay => Entities.Values.FirstOrDefault(x => x.IsInPlay && x.IsMinion && x.IsControlledBy(Opponent.Id)) != null;
public int OpponentMinionCount => Entities.Values.Count(x => x.IsInPlay && x.IsMinion && x.IsControlledBy(Opponent.Id));
public int OpponentBoardCount => Entities.Values.Count(x => x.IsInPlay && x.IsMinionOrLocation && x.IsControlledBy(Opponent.Id));
public int OpponentBoardCount => Entities.Values.Count(x => x.IsInPlay && x.TakesBoardSlot && x.IsControlledBy(Opponent.Id));
public int PlayerMinionCount => Entities.Values.Count(x => x.IsInPlay && x.IsMinion && x.IsControlledBy(Player.Id));
public int PlayerBoardCount => Entities.Values.Count(x => x.IsInPlay && x.IsMinionOrLocation && x.IsControlledBy(Player.Id));
public int PlayerBoardCount => Entities.Values.Count(x => x.IsInPlay && x.TakesBoardSlot && x.IsControlledBy(Player.Id));
public int OpponentHandCount => Entities.Values.Count(x => x.IsInHand && x.IsControlledBy(Opponent.Id));
public int OpponentSecretCount => Entities.Values.Count(x => x.IsInSecret && x.IsSecret && x.IsControlledBy(Opponent.Id));
public int PlayerHandCount => Entities.Values.Count(x => x.IsInHand && x.IsControlledBy(Player.Id));
Expand Down
4 changes: 2 additions & 2 deletions Hearthstone Deck Tracker/Live/BoardStateWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ private int HeroDbfId(Entity? entity)
{
Player = new BoardStatePlayer
{
Board = SortedDbfIds(player.Board.Where(x => x.IsMinionOrLocation)),
Board = SortedDbfIds(player.Board.Where(x => x.TakesBoardSlot)),
Deck = new BoardStateDeck
{
Cards = playerCardsList,
Expand All @@ -228,7 +228,7 @@ private int HeroDbfId(Entity? entity)
},
Opponent = new BoardStatePlayer
{
Board = SortedDbfIds(opponent.Board.Where(x => x.IsMinionOrLocation)),
Board = SortedDbfIds(opponent.Board.Where(x => x.TakesBoardSlot)),
Deck = new BoardStateDeck
{
Size = opponent.DeckCount
Expand Down
4 changes: 2 additions & 2 deletions Hearthstone Deck Tracker/Windows/OverlayWindow.Update.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ public void Update(bool refresh)
_cardMarks[i].Visibility = Collapsed;
}

var oppBoard = Core.Game.Opponent.Board.Where(x => x.IsMinionOrLocation).OrderBy(x => x.GetTag(ZONE_POSITION)).ToList();
var playerBoard = Core.Game.Player.Board.Where(x => x.IsMinionOrLocation).OrderBy(x => x.GetTag(ZONE_POSITION)).ToList();
var oppBoard = Core.Game.Opponent.Board.Where(x => x.TakesBoardSlot).OrderBy(x => x.GetTag(ZONE_POSITION)).ToList();
var playerBoard = Core.Game.Player.Board.Where(x => x.TakesBoardSlot).OrderBy(x => x.GetTag(ZONE_POSITION)).ToList();
UpdateMouseOverDetectionRegions(oppBoard, playerBoard);
if(!_game.IsInMenu && (_game.IsMulliganDone || _game.IsBattlegroundsMatch || _game.IsMercenariesMatch) && User32.IsHearthstoneInForeground() && IsVisible)
DetectMouseOver(playerBoard, oppBoard);
Expand Down

0 comments on commit 23f0e65

Please sign in to comment.