Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add rune cost properties on Card w/ tests, tiny formatting fix #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion HearthDb.Tests/UnitTest1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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"));

Expand Down Expand Up @@ -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);
}
}
}
9 changes: 9 additions & 0 deletions HearthDb/Card.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down