Skip to content

Commit 4c05073

Browse files
committed
refactor: return non-collectible cards by default
...anywhere but in GetFromName.
1 parent 706e4bd commit 4c05073

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

HearthDb.Tests/UnitTest1.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void TestMechanics()
5959
[TestMethod]
6060
public void TestCardText()
6161
{
62-
var lucentbark = Cards.GetFromDbfId(51796, false);
62+
var lucentbark = Cards.GetFromDbfId(51796);
6363
System.Console.WriteLine(lucentbark.Text);
6464
Assert.IsTrue(lucentbark.Text.Contains("(5 left!)"));
6565

HearthDb/Cards.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static Cards()
5959
public static Card GetFromName(string name, Locale lang, bool collectible = true)
6060
=> (collectible ? Collectible : All).Values.FirstOrDefault(x => x.GetLocName(lang)?.Equals(name, StringComparison.InvariantCultureIgnoreCase) ?? false);
6161

62-
public static Card GetFromDbfId(int dbfId, bool collectible = true)
62+
public static Card GetFromDbfId(int dbfId, bool collectible = false)
6363
=> (collectible ? CollectibleByDbfId : AllByDbfId).TryGetValue(dbfId, out var card) ? card : null;
6464

6565
private static bool IsDeflectOBot(Entity entity) => entity.CardId == CardIds.NonCollectible.Neutral.DeflectOBot || entity.CardId == CardIds.NonCollectible.Neutral.DeflectOBotTavernBrawl;

HearthDb/Deckstrings/Deck.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public class Deck
4646
/// <summary>
4747
/// Gets the card object for the given HeroDbfId
4848
/// </summary>
49-
public Card GetHero() => Cards.GetFromDbfId(HeroDbfId, false);
49+
public Card GetHero() => Cards.GetFromDbfId(HeroDbfId);
5050

5151
/// <summary>
5252
/// Converts (DbfId, Count) dictionary to (CardObject, Count).
@@ -61,10 +61,10 @@ public Dictionary<Card, int> GetCards() => CardDbfIds
6161
public Dictionary<Card, Dictionary<Card, int>> GetSideboards() => Sideboards
6262
.Select(x => new
6363
{
64-
Owner = Cards.GetFromDbfId(x.Key),
64+
Owner = Cards.GetFromDbfId(x.Key),
6565
Sideboard = x.Value.Select(s => new
6666
{
67-
Card = Cards.GetFromDbfId(s.Key),
67+
Card = Cards.GetFromDbfId(s.Key),
6868
Count = s.Value
6969
}).Where(s => s.Card != null).ToDictionary(x => x.Card, x => x.Count)
7070
})

0 commit comments

Comments
 (0)