Skip to content

Commit

Permalink
BoardCard class Titan compatibility
Browse files Browse the repository at this point in the history
- Add titan check and titan abilities used count
- Return false from IsAbletoAttack method if card is titan and still has unused abilities
- Issue HearthSim#4503
  • Loading branch information
batstyx committed Oct 20, 2023
1 parent 86b7f0f commit 39ca32b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Hearthstone Deck Tracker/Utility/BoardDamage/BoardCard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public class BoardCard : IBoardEntity
private readonly int _health;
private readonly int _stdAttack;
private readonly bool _dormant;
private readonly bool _isTitan;
private readonly int _titanAbilitiesUsed;

public BoardCard(Entity e, bool active = true)
{
Expand All @@ -39,6 +41,13 @@ public BoardCard(Entity e, bool active = true)
Windfury = e.GetTag(WINDFURY) == 1;
AttacksThisTurn = e.GetTag(NUM_ATTACKS_THIS_TURN);
_dormant = e.GetTag(DORMANT) == 1;
_isTitan = e.GetTag(TITAN) == 1;
if(_isTitan)
{
if(e.GetTag(TITAN_ABILITY_USED_1) == 1) _titanAbilitiesUsed += 1;
if(e.GetTag(TITAN_ABILITY_USED_2) == 1) _titanAbilitiesUsed += 1;
if(e.GetTag(TITAN_ABILITY_USED_3) == 1) _titanAbilitiesUsed += 1;
}

Name = name;
CardId = e.CardId;
Expand Down Expand Up @@ -96,7 +105,7 @@ private bool IsAbleToAttack(bool active, bool isWeapon)
{
// TODO: if frozen on turn, may be able to attack next turn
// don't include weapons if an active turn, count Hero instead
if(_cantAttack || _frozen || (isWeapon && active) || _dormant)
if(_cantAttack || _frozen || (isWeapon && active) || _dormant || (_isTitan && _titanAbilitiesUsed < 3))
return false;
if(!active)
{
Expand Down

0 comments on commit 39ca32b

Please sign in to comment.