@@ -13,116 +13,13 @@ public static class CardUtils
1313 public static readonly Rect DefaultCardArtRect = new Rect ( 0.0f , 0.0f , 114.0f , 94.0f ) ;
1414 public static readonly Rect DefaultCardPixelArtRect = new Rect ( 0.0f , 0.0f , 41.0f , 28.0f ) ;
1515
16- // Print section
17- public static void PrintStatIconInfo ( StatIconInfo info )
18- {
19- Plugin . Log . LogInfo ( $ "\n StatIconInfo") ;
20- Plugin . Log . LogInfo ( $ "GBC Description [{ info . gbcDescription } ]") ;
21- Plugin . Log . LogInfo ( $ "Rulebook Name [{ info . rulebookName } ]") ;
22- Plugin . Log . LogInfo ( $ "Rulebook Description [{ info . rulebookDescription } ]") ;
23- Plugin . Log . LogInfo ( $ "Applies to Attack [{ info . appliesToAttack } ] Health [{ info . appliesToAttack } ]") ;
24- PrintList ( "MetaCategory" , info . metaCategories ) ;
25- }
26-
27- public static void PrintAllCardInfo ( )
28- {
29- foreach ( var info in CardLoader . AllData )
30- {
31- PrintCardInfo ( info ) ;
32- }
33- }
34-
35- public static void PrintCardModInfoList ( List < CardModificationInfo > mods )
36- {
37- if ( mods . Count != 0 )
38- {
39- Plugin . Log . LogInfo ( "Card Mods Info" ) ;
40- foreach ( var mod in mods )
41- {
42- PrintCardModInfo ( mod ) ;
43- }
44- }
45- }
46-
47- public static void PrintCardModInfo ( CardModificationInfo mod )
48- {
49- Plugin . Log . LogInfo ( $ "ID [{ mod . singletonId } ]") ;
50- Plugin . Log . LogInfo ( $ "Gemify? [{ mod . gemify } ]") ;
51- Plugin . Log . LogInfo ( $ "Attack Adjustment [{ mod . attackAdjustment } ]") ;
52- Plugin . Log . LogInfo ( $ "Health Adjustment [{ mod . healthAdjustment } ]") ;
53- Plugin . Log . LogInfo ( $ "Blood Cost Adjustment [{ mod . bloodCostAdjustment } ]") ;
54- Plugin . Log . LogInfo ( $ "Bones Cost Adjustment [{ mod . bonesCostAdjustment } ]") ;
55- Plugin . Log . LogInfo ( $ "Energy Cost Adjustment [{ mod . energyCostAdjustment } ]") ;
56- Plugin . Log . LogInfo ( $ "Non-Copyable? [{ mod . nonCopyable } ]") ;
57- Plugin . Log . LogInfo ( $ "From Card Merge? [{ mod . fromCardMerge } ]") ;
58- Plugin . Log . LogInfo ( $ "From Duplicate Merge? [{ mod . fromDuplicateMerge } ]") ;
59- Plugin . Log . LogInfo ( $ "From Latch? [{ mod . fromLatch } ]") ;
60- Plugin . Log . LogInfo ( $ "From Overclock? [{ mod . fromOverclock } ]") ;
61- Plugin . Log . LogInfo ( $ "From Totem? [{ mod . fromTotem } ]") ;
62- Plugin . Log . LogInfo ( $ "Nullify Gems Cost? [{ mod . nullifyGemsCost } ]") ;
63- Plugin . Log . LogInfo ( $ "Side Deck Mod? [{ mod . sideDeckMod } ]") ;
64- Plugin . Log . LogInfo ( $ "Special Stat Icon [{ mod . statIcon } ]") ;
65- Plugin . Log . LogInfo ( $ "Remove On upkeep? [{ mod . RemoveOnUpkeep } ]") ;
66-
67- PrintList ( "Abilities" , mod . abilities ) ;
68- PrintList ( "Negate Abilities" , mod . negateAbilities ) ;
69- PrintList ( "Special Abilities" , mod . specialAbilities ) ;
70- PrintList ( "Add Gem Costs" , mod . addGemCost ) ;
71- PrintList ( "DecalIds" , mod . decalIds ) ;
72- }
73-
74- public static void PrintList < T > ( string title , List < T > items )
75- {
76- if ( items . Count != 0 )
77- {
78- Plugin . Log . LogInfo ( title ) ;
79- items . ForEach ( item => Plugin . Log . LogInfo ( $ "-> { item } ") ) ;
80- }
81- }
82-
83- public static void PrintCardInfo ( CardInfo info )
84- {
85- Plugin . Log . LogInfo ( $ "===============") ;
86- Plugin . Log . LogInfo ( $ "Name [{ info . name } ]") ;
87- Plugin . Log . LogInfo ( $ "Displayed Name [{ info . displayedName } ]") ;
88- Plugin . Log . LogInfo ( $ "Description [{ info . description } ]") ;
89- Plugin . Log . LogInfo ( $ "Attack [{ info . baseAttack } ] Health [{ info . baseHealth } ]") ;
90- Plugin . Log . LogInfo ( $ "Boon [{ info . boon } ]") ;
91- Plugin . Log . LogInfo ( $ "Bones Cost [{ info . bonesCost } ]") ;
92- Plugin . Log . LogInfo ( $ "Cost [{ info . cost } ]") ;
93- Plugin . Log . LogInfo ( $ "Temple [{ info . temple } ]") ;
94- Plugin . Log . LogInfo ( $ "CardComplexity [{ info . cardComplexity } ]") ;
95- Plugin . Log . LogInfo ( $ "EnergyCost [{ info . energyCost } ]") ;
96- if ( info . evolveParams is not null )
97- Plugin . Log . LogInfo (
98- $ "EvolveParams = Turns to evolve [{ info . evolveParams . turnsToEvolve } ] Evolves into [{ info . evolveParams . evolution . name } ]") ;
99- Plugin . Log . LogInfo ( $ "Can sacrifice? [{ info . Sacrificable } ]") ;
100- Plugin . Log . LogInfo ( $ "Is Gemified? [{ info . Gemified } ]") ;
101- if ( info . iceCubeParams is not null )
102- Plugin . Log . LogInfo ( $ "IceCubeParams = [{ info . iceCubeParams . creatureWithin . name } ]") ;
103- Plugin . Log . LogInfo ( $ "SpecialStatIcon [{ info . specialStatIcon } ]") ;
104- Plugin . Log . LogInfo ( $ "One per deck? [{ info . onePerDeck } ]") ;
105- // TODO: possible to get an NRE if the power level is not set?
106- // Plugin.Log.LogInfo($"Power Level [{info.PowerLevel}]");
107- PrintList ( "Abilities" , info . Abilities ) ;
108- PrintList ( "Special Abilities" , info . SpecialAbilities ) ;
109- PrintList ( "Appearance Behavior" , info . appearanceBehaviour ) ;
110- PrintList ( "Gems Cost" , info . GemsCost ) ;
111- PrintList ( "MetaCategory" , info . metaCategories ) ;
112- PrintList ( "Traits" , info . traits ) ;
113- PrintList ( "Tribes" , info . tribes ) ;
114-
115- PrintCardModInfoList ( info . mods ) ;
116-
117- Plugin . Log . LogInfo ( $ "===============\n ") ;
118- }
119-
12016 public static Predicate < CardInfo > IsNonLivingCard = card
12117 => card . traits . Exists ( t => t is Trait . Terrain or Trait . Pelt ) ;
12218
123- public static string cleanCardName ( string name )
19+ public static string CleanCardName ( string name )
12420 {
125- // for card names that for some reason equal to 'Card (Sparrow)' instead of just 'Sparrow'
21+ // When calling PlayableCard.name, it will look like 'Card (Sparrow)' instead of just 'Sparrow'
22+ // For some reason CardInfo.name is not available to call
12623 if ( name . StartsWith ( "Card " ) )
12724 {
12825 string [ ] nameSplit = name . Split ( '(' ) ; // [Card (, name_of_card)]
@@ -198,24 +95,17 @@ public static string cleanCardName(string name)
19895 CardAppearanceBehaviour . Appearance . DynamicPortrait
19996 } ;
20097
201- public static byte [ ] getArtworkFileAsBytes ( BaseUnityPlugin plugin , string path )
98+ public static byte [ ] ReadArtworkFileAsBytes ( string nameOfCardArt )
20299 {
203- if ( ! path . StartsWith ( "Artwork/" ) )
204- {
205- path = String . Join ( "Artwork/" , path ) ;
206- }
207-
208- return File . ReadAllBytes ( Path . Combine (
209- plugin . Info . Location . Replace ( "CardLoaderMod.dll" , "" ) ,
210- path
211- )
212- ) ;
100+ return File . ReadAllBytes (
101+ Directory . GetFiles ( Paths . PluginPath , nameOfCardArt , SearchOption . AllDirectories ) [ 0 ]
102+ ) ;
213103 }
214104
215105 public static Texture2D getAndloadImageAsTexture ( string pathCardArt )
216106 {
217107 Texture2D texture = new Texture2D ( 2 , 2 ) ;
218- byte [ ] imgBytes = File . ReadAllBytes ( pathCardArt ) ;
108+ byte [ ] imgBytes = ReadArtworkFileAsBytes ( pathCardArt ) ;
219109 bool isLoaded = texture . LoadImage ( imgBytes ) ;
220110 return texture ;
221111 }
0 commit comments