diff --git a/HDTTests/BoardDamage/BoardCardTest.cs b/HDTTests/BoardDamage/BoardCardTest.cs index c24397528f..522024d072 100644 --- a/HDTTests/BoardDamage/BoardCardTest.cs +++ b/HDTTests/BoardDamage/BoardCardTest.cs @@ -176,17 +176,20 @@ public void Attack_WeaponWithWindfuryOneHitLeft() Assert.AreEqual(5, card.Attack); } - [TestMethod] - public void Attack_MegaWindfury_V07TR0N() + [DataTestMethod] + [DataRow(CardIds.NonCollectible.Neutral.MimironsHead_V07Tr0NToken, DisplayName = "V-07-TR-0N")] + [DataRow(CardIds.Collectible.Shaman.WalkingMountain, DisplayName = "Walking Mountain")] + public void Attack_MegaWindfury(string cardId) { - var eb = new EntityBuilder("GVG_111t", 4, 8).Windfury().Charge().InPlay(); + var eb = new EntityBuilder(cardId, 4, 8).Windfury().Charge().InPlay(); Assert.AreEqual(16, eb.ToBoardCard().Attack); Assert.AreEqual(16, eb.Exhausted().ToBoardCard(false).Attack); + Assert.AreEqual(16, eb.AttacksThisTurn(4).ToBoardCard(false).Attack); Assert.AreEqual(12, eb.AttacksThisTurn(1).ToBoardCard().Attack); Assert.AreEqual(8, eb.AttacksThisTurn(2).ToBoardCard().Attack); Assert.AreEqual(4, eb.AttacksThisTurn(3).ToBoardCard().Attack); - Assert.AreEqual(4, eb.AttacksThisTurn(4).ToBoardCard().Attack); + Assert.AreEqual(0, eb.AttacksThisTurn(4).ToBoardCard().Attack); } [TestMethod] diff --git a/Hearthstone Deck Tracker/Utility/BoardDamage/BoardCard.cs b/Hearthstone Deck Tracker/Utility/BoardDamage/BoardCard.cs index 5d5de43d6d..2a685a3b40 100644 --- a/Hearthstone Deck Tracker/Utility/BoardDamage/BoardCard.cs +++ b/Hearthstone Deck Tracker/Utility/BoardDamage/BoardCard.cs @@ -39,6 +39,7 @@ public BoardCard(Entity e, bool active = true) _frozen = e.GetTag(FROZEN) == 1; Charge = e.GetTag(CHARGE) == 1; Windfury = e.GetTag(WINDFURY) == 1; + MegaWindfury = (e.CardId == HearthDb.CardIds.NonCollectible.Neutral.MimironsHead_V07Tr0NToken || e.CardId == HearthDb.CardIds.Collectible.Shaman.WalkingMountain); AttacksThisTurn = e.GetTag(NUM_ATTACKS_THIS_TURN); _dormant = e.GetTag(DORMANT) == 1; _isTitan = e.GetTag(TITAN) == 1; @@ -64,6 +65,7 @@ public BoardCard(Entity e, bool active = true) public bool Taunt { get; private set; } public bool Charge { get; } public bool Windfury { get; } + public bool MegaWindfury { get; } public string CardType { get; private set; } public string Name { get; } @@ -72,6 +74,18 @@ public BoardCard(Entity e, bool active = true) public bool Include { get; } public int AttacksThisTurn { get; } + public int AttacksPerTurn + { + get + { + if(MegaWindfury) + return 4; + if(Windfury) + return 2; + return 1; + } + } + public bool Exhausted { get; } public string Zone { get; } @@ -86,19 +100,13 @@ public BoardCard(Entity e, bool active = true) private int CalculateAttack(bool active, bool isWeapon) { - // V-07-TR-0N is a special case Mega-Windfury - if(!string.IsNullOrEmpty(CardId) && CardId == "GVG_111t") - return V07TRONAttack(active); - // for weapons check for windfury and number of hits left + var remainingAttacks = Math.Max(AttacksPerTurn - (active ? AttacksThisTurn : 0), 0); + if(isWeapon) - { - if(Windfury && Health >= 2 && AttacksThisTurn == 0) - return _stdAttack * 2; - } - // for minions with windfury that haven't already attacked, double attack - else if(Windfury && (!active || AttacksThisTurn == 0)) - return _stdAttack * 2; - return _stdAttack; + // for weapons, clamp remaining attacks to health + remainingAttacks = Math.Min(remainingAttacks, Health); + + return remainingAttacks * _stdAttack; } private bool IsAbleToAttack(bool active, bool isWeapon)