From 95991883bb99a9b4f0dbaa0b3aa8f301e91919cd Mon Sep 17 00:00:00 2001 From: Paul Mulders Date: Fri, 2 Feb 2024 12:29:36 +0100 Subject: [PATCH] add rune cost properties on Card w/ tests, tiny formatting fix --- HearthDb.Tests/UnitTest1.cs | 27 ++++++++++++++++++++++++++- HearthDb/Card.cs | 9 +++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/HearthDb.Tests/UnitTest1.cs b/HearthDb.Tests/UnitTest1.cs index 5ff07c7c..277020aa 100644 --- a/HearthDb.Tests/UnitTest1.cs +++ b/HearthDb.Tests/UnitTest1.cs @@ -71,7 +71,7 @@ public void TestCardText() Assert.IsTrue(galakrond.Text.Contains("Draw 1 card.")); Assert.IsTrue(galakrond.Text.Contains("It costs (0).")); - var eyeOfCthun = Cards.All[CardIds.NonCollectible.Neutral.CThuntheShattered_EyeOfCthunToken]; + var eyeOfCthun = Cards.All[CardIds.NonCollectible.Neutral.CThuntheShattered_EyeOfCthunToken]; Assert.IsTrue(eyeOfCthun.Text.Contains("(0/4)")); Assert.IsTrue(eyeOfCthun.Text.Contains("7 damage randomly")); @@ -103,5 +103,30 @@ public void DeflectOBot_HasDivineShield() Assert.AreEqual(1, Cards.All[CardIds.NonCollectible.Neutral.DeflectOBot].Entity.GetTag(GameTag.DIVINE_SHIELD)); Assert.AreEqual(1, Cards.All[CardIds.NonCollectible.Neutral.DeflectOBotTavernBrawl].Entity.GetTag(GameTag.DIVINE_SHIELD)); } + + [TestMethod] + public void TestRuneCosts() + { + var shadowVisions = Cards.All[CardIds.Collectible.Priest.ShadowVisions]; + Assert.AreEqual(0, shadowVisions.BloodCost); + Assert.AreEqual(0, shadowVisions.FrostCost); + Assert.AreEqual(0, shadowVisions.UnholyCost); + + var climacticNecroticExplosion = Cards.All[CardIds.Collectible.Deathknight.ClimacticNecroticExplosion]; + Assert.AreEqual(1, climacticNecroticExplosion.BloodCost); + Assert.AreEqual(1, climacticNecroticExplosion.FrostCost); + Assert.AreEqual(1, climacticNecroticExplosion.UnholyCost); + Assert.AreNotEqual(3, climacticNecroticExplosion.UnholyCost); + + var plaguedGrain = Cards.All[CardIds.Collectible.Deathknight.PlaguedGrainCore]; + Assert.AreEqual(0, plaguedGrain.BloodCost); + Assert.AreEqual(0, plaguedGrain.FrostCost); + Assert.AreEqual(3, plaguedGrain.UnholyCost); + + var fistfulOfCorpses = Cards.All[CardIds.Collectible.Deathknight.FistfulOfCorpses]; + Assert.AreEqual(1, fistfulOfCorpses.BloodCost); + Assert.AreEqual(0, fistfulOfCorpses.FrostCost); + Assert.AreEqual(1, fistfulOfCorpses.UnholyCost); + } } } diff --git a/HearthDb/Card.cs b/HearthDb/Card.cs index ba89db04..87571ec8 100644 --- a/HearthDb/Card.cs +++ b/HearthDb/Card.cs @@ -122,6 +122,15 @@ public CardSet Set private int? _cost; public int Cost => _cost ??= Entity.GetTag(COST); + private int? _bloodCost; + public int BloodCost => _bloodCost ??= Entity.GetTag(COST_BLOOD); + + private int? _frostCost; + public int FrostCost => _frostCost ??= Entity.GetTag(COST_FROST); + + private int? _unholyCost; + public int UnholyCost => _unholyCost ??= Entity.GetTag(COST_UNHOLY); + private int? _attack; public int Attack => _attack ??= Entity.GetTag(ATK);