66using UnityEngine ;
77using DiskCardGame ;
88using HarmonyLib ;
9+ #pragma warning disable 169
910
1011namespace APIPlugin
1112{
@@ -56,157 +57,26 @@ public class CustomCard
5657 public bool ? flipPortraitForStrafe ;
5758 public bool ? onePerDeck ;
5859 public List < CardAppearanceBehaviour . Appearance > appearanceBehaviour ;
60+ [ IgnoreMapping ]
5961 public Texture2D tex ;
62+ [ IgnoreMapping ]
6063 public Texture2D altTex ;
6164 public Texture titleGraphic ;
65+ [ IgnoreMapping ]
6266 public Texture2D pixelTex ;
6367 public GameObject animatedPortrait ;
6468 public List < Texture > decals ;
6569
66- public CustomCard ( string name , List < CardMetaCategory > metaCategories = null , CardComplexity ? cardComplexity = null , CardTemple ? temple = null , string displayedName = "" ,
67- int ? baseAttack = null , int ? baseHealth = null , string description = "" , bool ? hideAttackAndHealth = null , int ? cost = null , int ? bonesCost = null ,
68- int ? energyCost = null , List < GemType > gemsCost = null , SpecialStatIcon ? specialStatIcon = null , List < Tribe > tribes = null , List < Trait > traits = null ,
69- List < SpecialTriggeredAbility > specialAbilities = null , List < Ability > abilities = null , EvolveParams evolveParams = null , string defaultEvolutionName = "" ,
70- TailParams tailParams = null , IceCubeParams iceCubeParams = null , bool ? flipPortraitForStrafe = null , bool ? onePerDeck = null ,
71- List < CardAppearanceBehaviour . Appearance > appearanceBehaviour = null , Texture2D tex = null , Texture2D altTex = null , Texture titleGraphic = null ,
72- Texture2D pixelTex = null , GameObject animatedPortrait = null , List < Texture > decals = null )
70+ public CustomCard ( string name )
7371 {
7472 this . name = name ;
75- this . metaCategories = metaCategories ;
76- this . cardComplexity = cardComplexity ;
77- this . temple = temple ;
78- this . displayedName = displayedName ;
79- this . baseAttack = baseAttack ;
80- this . baseHealth = baseHealth ;
81- this . description = description ;
82- this . hideAttackAndHealth = hideAttackAndHealth ;
83- this . cost = cost ;
84- this . bonesCost = bonesCost ;
85- this . energyCost = energyCost ;
86- this . gemsCost = gemsCost ;
87- this . specialStatIcon = specialStatIcon ;
88- this . tribes = tribes ;
89- this . traits = traits ;
90- this . specialAbilities = specialAbilities ;
91- this . abilities = abilities ;
92- this . evolveParams = evolveParams ;
93- this . defaultEvolutionName = defaultEvolutionName ;
94- this . tailParams = tailParams ;
95- this . iceCubeParams = iceCubeParams ;
96- this . flipPortraitForStrafe = flipPortraitForStrafe ;
97- this . onePerDeck = onePerDeck ;
98- this . appearanceBehaviour = appearanceBehaviour ;
99- this . tex = tex ;
100- this . altTex = altTex ;
101- this . titleGraphic = titleGraphic ;
102- this . pixelTex = pixelTex ;
103- this . animatedPortrait = animatedPortrait ;
104- this . decals = decals ;
10573 CustomCard . cards . Add ( this ) ;
10674 }
10775
10876 public CardInfo AdjustCard ( CardInfo card )
10977 {
110- if ( this . metaCategories is not null )
111- {
112- card . metaCategories = this . metaCategories ;
113- }
114- if ( this . cardComplexity is not null )
115- {
116- card . cardComplexity = ( CardComplexity ) this . cardComplexity ;
117- }
118- if ( this . temple is not null )
119- {
120- card . temple = ( CardTemple ) this . temple ;
121- }
122- if ( ! String . IsNullOrEmpty ( displayedName ) )
123- {
124- card . displayedName = displayedName ;
125- }
126- if ( this . baseAttack is not null )
127- {
128- card . baseAttack = baseAttack . Value ;
129- }
130- if ( this . baseHealth is not null )
131- {
132- card . baseHealth = baseHealth . Value ;
133- }
134- if ( ! String . IsNullOrEmpty ( description ) )
135- {
136- card . description = this . description ;
137- }
138- if ( this . cost is not null )
139- {
140- card . cost = cost . Value ;
141- }
142- if ( this . bonesCost is not null )
143- {
144- card . bonesCost = bonesCost . Value ;
145- }
146- if ( this . energyCost is not null )
147- {
148- card . energyCost = energyCost . Value ;
149- }
150- if ( this . gemsCost is not null )
151- {
152- card . gemsCost = gemsCost ;
153- }
154- if ( this . specialStatIcon is not null )
155- {
156- card . specialStatIcon = specialStatIcon . Value ;
157- }
158- if ( this . tribes is not null )
159- {
160- card . tribes = this . tribes ;
161- }
162- if ( this . traits is not null )
163- {
164- card . traits = this . traits ;
165- }
166- if ( this . specialAbilities is not null )
167- {
168- card . specialAbilities = specialAbilities ;
169- }
170- if ( this . abilities is not null )
171- {
172- card . abilities = abilities ;
173- }
174- if ( evolveParams is not null )
175- {
176- card . evolveParams = evolveParams ;
177- }
178- if ( evolveParams is not null )
179- {
180- card . evolveParams = evolveParams ;
181- }
182- if ( ! String . IsNullOrEmpty ( defaultEvolutionName ) )
183- {
184- card . defaultEvolutionName = defaultEvolutionName ;
185- }
186- if ( tailParams is not null )
187- {
188- card . tailParams = tailParams ;
189- }
190- if ( iceCubeParams is not null )
191- {
192- card . iceCubeParams = iceCubeParams ;
193- }
194- if ( this . appearanceBehaviour is not null )
195- {
196- card . appearanceBehaviour = this . appearanceBehaviour ;
197- }
198- if ( this . flipPortraitForStrafe is not null )
199- {
200- card . flipPortraitForStrafe = ( bool ) this . flipPortraitForStrafe ;
201- }
202- if ( this . onePerDeck is not null )
203- {
204- card . onePerDeck = ( bool ) this . onePerDeck ;
205- }
206- if ( this . hideAttackAndHealth is not null )
207- {
208- card . hideAttackAndHealth = ( bool ) this . hideAttackAndHealth ;
209- }
78+ TypeMapper < CustomCard , CardInfo > . Convert ( this , card ) ;
79+
21080 if ( this . tex is not null )
21181 {
21282 tex . name = "portrait_" + name ;
@@ -221,35 +91,23 @@ public CardInfo AdjustCard(CardInfo card)
22191 card . alternatePortrait = Sprite . Create ( altTex , new Rect ( 0.0f , 0.0f , 114.0f , 94.0f ) , new Vector2 ( 0.5f , 0.5f ) ) ;
22292 card . alternatePortrait . name = "portrait_" + name ;
22393 }
224- if ( this . titleGraphic is not null )
225- {
226- card . titleGraphic = this . titleGraphic ;
227- }
22894 if ( this . pixelTex is not null )
22995 {
23096 pixelTex . name = "portrait_" + name ;
23197 pixelTex . filterMode = FilterMode . Point ;
23298 card . pixelPortrait = Sprite . Create ( pixelTex , new Rect ( 0.0f , 0.0f , 114.0f , 94.0f ) , new Vector2 ( 0.5f , 0.5f ) ) ;
23399 card . pixelPortrait . name = "portrait_" + name ;
234100 }
235- if ( animatedPortrait is not null )
236- {
237- card . animatedPortrait = animatedPortrait ;
238- }
239- if ( decals is not null )
240- {
241- card . decals = decals ;
242- }
243101 Plugin . Log . LogInfo ( $ "Adjusted default card { name } !") ;
244102 return card ;
245103 }
246104 }
247105
248- public class NewCard
106+ public static class NewCard
249107 {
250108 public static List < CardInfo > cards = new List < CardInfo > ( ) ;
251109
252- public NewCard ( CardInfo card )
110+ public static void Add ( CardInfo card )
253111 {
254112 NewCard . cards . Add ( card ) ;
255113 Plugin . Log . LogInfo ( $ "Loaded custom card { card . name } !") ;
@@ -258,11 +116,11 @@ public NewCard(CardInfo card)
258116 // TODO Implement a handler for custom appearanceBehaviour - in particular custom card backs
259117 // TODO Change parameter order, and function setter call order to make more sense
260118 // TODO Rename parameters to be more user friendly
261- public NewCard ( string name , List < CardMetaCategory > metaCategories , CardComplexity cardComplexity , CardTemple temple , string displayedName , int baseAttack , int baseHealth ,
262- string description = "" ,
119+ public static void Add ( string name , List < CardMetaCategory > metaCategories , CardComplexity cardComplexity , CardTemple temple , string displayedName , int baseAttack , int baseHealth ,
120+ string description = null ,
263121 bool hideAttackAndHealth = false , int cost = 0 , int bonesCost = 0 , int energyCost = 0 , List < GemType > gemsCost = null , SpecialStatIcon specialStatIcon = SpecialStatIcon . None ,
264122 List < Tribe > tribes = null , List < Trait > traits = null , List < SpecialTriggeredAbility > specialAbilities = null , List < Ability > abilities = null , EvolveParams evolveParams = null ,
265- string defaultEvolutionName = "" , TailParams tailParams = null , IceCubeParams iceCubeParams = null , bool flipPortraitForStrafe = false , bool onePerDeck = false ,
123+ string defaultEvolutionName = null , TailParams tailParams = null , IceCubeParams iceCubeParams = null , bool flipPortraitForStrafe = false , bool onePerDeck = false ,
266124 List < CardAppearanceBehaviour . Appearance > appearanceBehaviour = null , Texture2D tex = null , Texture2D altTex = null , Texture titleGraphic = null , Texture2D pixelTex = null ,
267125 GameObject animatedPortrait = null , List < Texture > decals = null )
268126 {
@@ -393,141 +251,15 @@ public class CustomRegion
393251 private Color ? mapEmissionColor ;
394252 private List < GameObject > mapParticlesPrefabs ;
395253
396- public CustomRegion ( string name , int ? tier = null , List < CardInfo > terrainCards = null , List < ConsumableItemData > consumableItems = null , List < EncounterBlueprintData > encounters = null ,
397- List < Opponent . Type > bosses = null , List < CardInfo > likelyCards = null , List < Tribe > dominantTribes = null , PredefinedNodes predefinedNodes = null ,
398- EncounterBlueprintData bossPrepEncounter = null , StoryEventCondition bossPrepCondition = null , List < ScarceSceneryEntry > scarceScenery = null ,
399- List < FillerSceneryEntry > fillerScenery = null , PredefinedScenery predefinedScenery = null , string ambientLoopId = "" , bool ? silenceCabinAmbience = null ,
400- Color ? boardLightColor = null , Color ? cardsLightColor = null , bool ? dustParticlesDisabled = null , bool ? fogEnabled = null , VolumetricFogAndMist . VolumetricFogProfile fogProfile = null ,
401- float ? fogAlpha = null , Texture mapAlbedo = null , Texture mapEmission = null , Color ? mapEmissionColor = null , List < GameObject > mapParticlesPrefabs = null )
254+ public CustomRegion ( string name )
402255 {
403256 this . name = name ;
404- this . tier = tier ;
405- this . terrainCards = terrainCards ;
406- this . consumableItems = consumableItems ;
407- this . encounters = encounters ;
408- this . bosses = bosses ;
409- this . likelyCards = likelyCards ;
410- this . dominantTribes = dominantTribes ;
411- this . predefinedNodes = predefinedNodes ;
412- this . bossPrepEncounter = bossPrepEncounter ;
413- this . bossPrepCondition = bossPrepCondition ;
414- this . scarceScenery = scarceScenery ;
415- this . fillerScenery = fillerScenery ;
416- this . predefinedScenery = predefinedScenery ;
417- this . ambientLoopId = ambientLoopId ;
418- this . silenceCabinAmbience = silenceCabinAmbience ;
419- this . boardLightColor = boardLightColor ;
420- this . cardsLightColor = cardsLightColor ;
421- this . dustParticlesDisabled = dustParticlesDisabled ;
422- this . fogEnabled = fogEnabled ;
423- this . fogProfile = fogProfile ;
424- this . fogAlpha = fogAlpha ;
425- this . mapAlbedo = mapAlbedo ;
426- this . mapEmission = mapEmission ;
427- this . mapEmissionColor = mapEmissionColor ;
428- this . mapParticlesPrefabs = mapParticlesPrefabs ;
429257 CustomRegion . regions . Add ( this ) ;
430258 }
431259
432260 public RegionData AdjustRegion ( RegionData region )
433261 {
434- region . name = this . name ;
435- if ( this . terrainCards is not null )
436- {
437- region . terrainCards = this . terrainCards ;
438- }
439- if ( this . consumableItems is not null )
440- {
441- region . consumableItems = this . consumableItems ;
442- }
443- if ( this . encounters is not null )
444- {
445- region . encounters = this . encounters ;
446- }
447- if ( this . bosses is not null )
448- {
449- region . bosses = this . bosses ;
450- }
451- if ( this . likelyCards is not null )
452- {
453- region . likelyCards = this . likelyCards ;
454- }
455- if ( this . dominantTribes is not null )
456- {
457- region . dominantTribes = this . dominantTribes ;
458- }
459- if ( this . predefinedNodes is not null )
460- {
461- region . predefinedNodes = this . predefinedNodes ;
462- }
463- if ( this . bossPrepEncounter is not null )
464- {
465- region . bossPrepEncounter = this . bossPrepEncounter ;
466- }
467- if ( this . bossPrepCondition is not null )
468- {
469- region . bossPrepCondition = this . bossPrepCondition ;
470- }
471- if ( this . scarceScenery is not null )
472- {
473- region . scarceScenery = this . scarceScenery ;
474- }
475- if ( this . fillerScenery is not null )
476- {
477- region . fillerScenery = this . fillerScenery ;
478- }
479- if ( this . predefinedScenery is not null )
480- {
481- region . predefinedScenery = this . predefinedScenery ;
482- }
483- if ( ! String . IsNullOrEmpty ( this . ambientLoopId ) )
484- {
485- region . ambientLoopId = this . ambientLoopId ;
486- }
487- if ( this . silenceCabinAmbience is not null )
488- {
489- region . silenceCabinAmbience = ( bool ) this . silenceCabinAmbience ;
490- }
491- if ( this . boardLightColor is not null )
492- {
493- region . boardLightColor = ( Color ) this . boardLightColor ;
494- }
495- if ( this . cardsLightColor is not null )
496- {
497- region . cardsLightColor = ( Color ) this . cardsLightColor ;
498- }
499- if ( this . dustParticlesDisabled is not null )
500- {
501- region . dustParticlesDisabled = ( bool ) this . dustParticlesDisabled ;
502- }
503- if ( this . fogEnabled is not null )
504- {
505- region . fogEnabled = ( bool ) this . fogEnabled ;
506- }
507- if ( this . fogProfile is not null )
508- {
509- region . fogProfile = this . fogProfile ;
510- }
511- if ( this . fogAlpha is not null )
512- {
513- region . fogAlpha = ( float ) this . fogAlpha ;
514- }
515- if ( this . mapAlbedo is not null )
516- {
517- region . mapAlbedo = this . mapAlbedo ;
518- }
519- if ( this . mapEmission is not null )
520- {
521- region . mapEmission = this . mapEmission ;
522- }
523- if ( this . mapEmissionColor is not null )
524- {
525- region . mapEmissionColor = ( Color ) this . mapEmissionColor ;
526- }
527- if ( this . mapParticlesPrefabs is not null )
528- {
529- region . mapParticlesPrefabs = this . mapParticlesPrefabs ;
530- }
262+ TypeMapper < CustomRegion , RegionData > . Convert ( this , region ) ;
531263 Plugin . Log . LogInfo ( $ "Adjusted default region { name } !") ;
532264 return region ;
533265 }
0 commit comments