@@ -31,67 +31,87 @@ internal Card(Entity entity)
3131
3232 public string FlavorText => GetLocFlavorText ( DefaultLanguage ) ;
3333
34- public CardClass Class => ( CardClass ) Entity . GetTag ( CLASS ) ;
34+ private CardClass ? _class ;
35+ public CardClass Class => _class ??= ( CardClass ) Entity . GetTag ( CLASS ) ;
3536
36- public Rarity Rarity => ( Rarity ) Entity . GetTag ( RARITY ) ;
37+ private Rarity ? _rarity ;
38+ public Rarity Rarity => _rarity ??= ( Rarity ) Entity . GetTag ( RARITY ) ;
3739
38- public CardType Type => ( CardType ) Entity . GetTag ( CARDTYPE ) ;
40+ private CardType ? _type ;
41+ public CardType Type => _type ?? ( CardType ) Entity . GetTag ( CARDTYPE ) ;
3942
40- public Race Race => ( Race ) Entity . GetTag ( CARDRACE ) ;
43+ private Race ? _race ;
44+ public Race Race => _race ?? ( Race ) Entity . GetTag ( CARDRACE ) ;
4145
46+ private CardSet ? _set ;
4247 public CardSet Set
4348 {
4449 get
4550 {
46- // HACK to fix missing set value on Hall of Fame cards
47- if ( new [ ]
51+ if ( _set == null )
4852 {
49- CardIds . Collectible . Mage . IceBlock ,
50- CardIds . Collectible . Neutral . ColdlightOracle ,
51- CardIds . Collectible . Neutral . MoltenGiant ,
52-
53- //2019
54- CardIds . Collectible . Druid . Naturalize ,
55- CardIds . Collectible . Warlock . Doomguard ,
56- CardIds . Collectible . Paladin . DivineFavor ,
57- CardIds . Collectible . Neutral . BakuTheMooneater ,
58- CardIds . Collectible . Neutral . GennGreymane ,
59- CardIds . Collectible . Druid . GloomStag ,
60- CardIds . Collectible . Mage . BlackCat ,
61- CardIds . Collectible . Priest . GlitterMoth ,
62- CardIds . Collectible . Shaman . MurksparkEel ,
63-
64- //2020
65- CardIds . Collectible . Priest . AuchenaiSoulpriest ,
66- CardIds . Collectible . Priest . HolyFire ,
67- CardIds . Collectible . Priest . Shadowform ,
68- CardIds . Collectible . Priest . ProphetVelen ,
69- CardIds . Collectible . Priest . DivineSpirit ,
70- CardIds . Collectible . Priest . NorthshireCleric ,
71- CardIds . Collectible . Neutral . AcolyteOfPain ,
72- CardIds . Collectible . Neutral . Spellbreaker ,
73- CardIds . Collectible . Neutral . MindControlTech ,
74- CardIds . Collectible . Neutral . MountainGiant ,
75- CardIds . Collectible . Neutral . LeeroyJenkins ,
76- } . Contains ( Id ) )
77- return CardSet . HOF ;
78- return ( CardSet ) Entity . GetTag ( CARD_SET ) ;
53+ // HACK to fix missing set value on Hall of Fame cards
54+ if ( new [ ]
55+ {
56+ CardIds . Collectible . Mage . IceBlock ,
57+ CardIds . Collectible . Neutral . ColdlightOracle ,
58+ CardIds . Collectible . Neutral . MoltenGiant ,
59+
60+ //2019
61+ CardIds . Collectible . Druid . Naturalize ,
62+ CardIds . Collectible . Warlock . Doomguard ,
63+ CardIds . Collectible . Paladin . DivineFavor ,
64+ CardIds . Collectible . Neutral . BakuTheMooneater ,
65+ CardIds . Collectible . Neutral . GennGreymane ,
66+ CardIds . Collectible . Druid . GloomStag ,
67+ CardIds . Collectible . Mage . BlackCat ,
68+ CardIds . Collectible . Priest . GlitterMoth ,
69+ CardIds . Collectible . Shaman . MurksparkEel ,
70+
71+ //2020
72+ CardIds . Collectible . Priest . AuchenaiSoulpriest ,
73+ CardIds . Collectible . Priest . HolyFire ,
74+ CardIds . Collectible . Priest . Shadowform ,
75+ CardIds . Collectible . Priest . ProphetVelen ,
76+ CardIds . Collectible . Priest . DivineSpirit ,
77+ CardIds . Collectible . Priest . NorthshireCleric ,
78+ CardIds . Collectible . Neutral . AcolyteOfPain ,
79+ CardIds . Collectible . Neutral . Spellbreaker ,
80+ CardIds . Collectible . Neutral . MindControlTech ,
81+ CardIds . Collectible . Neutral . MountainGiant ,
82+ CardIds . Collectible . Neutral . LeeroyJenkins ,
83+ } . Contains ( Id ) )
84+ {
85+ _set = CardSet . HOF ;
86+ }
87+ else
88+ {
89+ _set = ( CardSet ) Entity . GetTag ( CARD_SET ) ;
90+ }
91+ }
92+ return _set . Value ;
7993 }
8094 }
8195
8296 public Faction Faction => ( Faction ) Entity . GetTag ( FACTION ) ;
8397
84- public int Cost => Entity . GetTag ( COST ) ;
98+ private int ? _cost ;
99+ public int Cost => _cost ??= Entity . GetTag ( COST ) ;
85100
86- public int Attack => Entity . GetTag ( ATK ) ;
101+ private int ? _attack ;
102+ public int Attack => _attack ??= Entity . GetTag ( ATK ) ;
87103
88- public int Health => Entity . GetTag ( HEALTH ) ;
104+ private int ? _health ;
105+ public int Health => _health ??= Entity . GetTag ( HEALTH ) ;
89106
90- public int Durability => Entity . GetTag ( DURABILITY ) ;
107+ private int ? _durability ;
108+ public int Durability => _durability ??= Entity . GetTag ( DURABILITY ) ;
91109
92- public int Armor => Entity . GetTag ( ARMOR ) ;
110+ private int ? _armor ;
111+ public int Armor => _armor ??= Entity . GetTag ( ARMOR ) ;
93112
94- public int SpellSchool => Entity . GetTag ( SPELL_SCHOOL ) ;
113+ private int ? _spellSchool ;
114+ public int SpellSchool => _spellSchool ??= Entity . GetTag ( SPELL_SCHOOL ) ;
95115
96116 public string [ ] Mechanics
97117 {
@@ -111,7 +131,8 @@ public string[] Mechanics
111131
112132 public Locale DefaultLanguage { get ; set ; } = Locale . enUS ;
113133
114- public bool Collectible => Convert . ToBoolean ( Entity . GetTag ( COLLECTIBLE ) ) ;
134+ private bool ? _collectible ;
135+ public bool Collectible => _collectible ??= Convert . ToBoolean ( Entity . GetTag ( COLLECTIBLE ) ) ;
115136
116137 public string GetLocName ( Locale lang ) => Entity . GetLocString ( CARDNAME , lang ) ;
117138
@@ -150,8 +171,10 @@ public string GetLocText(Locale lang)
150171
151172 public string GetLocFlavorText ( Locale lang ) => Entity . GetLocString ( FLAVORTEXT , lang ) ;
152173
153- public bool IsWild => Helper . WildSets . Contains ( Set ) ;
174+ private bool ? _isWild ;
175+ public bool IsWild => _isWild ??= Helper . WildSets . Contains ( Set ) ;
154176
155- public bool IsClassic => Helper . ClassicSets . Contains ( Set ) ;
177+ private bool ? _isClassic ;
178+ public bool IsClassic => _isClassic ??= Helper . ClassicSets . Contains ( Set ) ;
156179 }
157180}
0 commit comments