11using System . Collections . Generic ;
2+ using System . Linq ;
23using CardLoaderPlugin . lib ;
34using DiskCardGame ;
45using UnityEngine ;
@@ -7,11 +8,12 @@ namespace APIPlugin
78{
89 public class CustomCard
910 {
10- public static List < CustomCard > cards = new List < CustomCard > ( ) ;
11- public static Dictionary < int , List < AbilityIdentifier > > abilityIds = new Dictionary < int , List < AbilityIdentifier > > ( ) ;
12- public static Dictionary < int , EvolveIdentifier > evolveIds = new Dictionary < int , EvolveIdentifier > ( ) ;
13- public static Dictionary < int , IceCubeIdentifier > iceCubeIds = new Dictionary < int , IceCubeIdentifier > ( ) ;
14- public static Dictionary < int , TailIdentifier > tailIds = new Dictionary < int , TailIdentifier > ( ) ;
11+ public static List < CustomCard > cards = new ( ) ;
12+ public static Dictionary < int , List < AbilityIdentifier > > abilityIds = new ( ) ;
13+ public static Dictionary < int , List < SpecialAbilityIdentifier > > specialAbilityIds = new ( ) ;
14+ public static Dictionary < int , EvolveIdentifier > evolveIds = new ( ) ;
15+ public static Dictionary < int , IceCubeIdentifier > iceCubeIds = new ( ) ;
16+ public static Dictionary < int , TailIdentifier > tailIds = new ( ) ;
1517 public string name ;
1618 public List < CardMetaCategory > metaCategories ;
1719 public CardComplexity ? cardComplexity ;
@@ -28,8 +30,8 @@ public class CustomCard
2830 public SpecialStatIcon ? specialStatIcon ;
2931 public List < Tribe > tribes ;
3032 public List < Trait > traits ;
31- public List < SpecialTriggeredAbility > specialAbilities ;
32- public List < Ability > abilities ;
33+ public List < SpecialTriggeredAbility > specialAbilities = new ( ) ;
34+ public List < Ability > abilities = new ( ) ;
3335 public EvolveParams evolveParams ;
3436 public string defaultEvolutionName ;
3537 public TailParams tailParams ;
@@ -51,32 +53,57 @@ public class CustomCard
5153 public IceCubeIdentifier iceCubeId ;
5254 public TailIdentifier tailId ;
5355
54- public CustomCard ( string name , List < AbilityIdentifier > abilityId = null , EvolveIdentifier evolveId = null , IceCubeIdentifier iceCubeId = null , TailIdentifier tailId = null )
56+ public CustomCard (
57+ string name ,
58+ List < AbilityIdentifier > abilityIdParam = null ,
59+ List < SpecialAbilityIdentifier > specialAbilityIdParam = null ,
60+ EvolveIdentifier evolveId = null ,
61+ IceCubeIdentifier iceCubeId = null ,
62+ TailIdentifier tailId = null )
5563 {
5664 this . name = name ;
5765 CustomCard . cards . Add ( this ) ;
5866
5967 // Handle AbilityIdentifier
60- List < AbilityIdentifier > toRemove = new List < AbilityIdentifier > ( ) ;
61- if ( this . abilityId is not null )
68+ List < AbilityIdentifier > abilitiesToRemove = new List < AbilityIdentifier > ( ) ;
69+ if ( abilityIdParam is not null )
6270 {
63- foreach ( AbilityIdentifier id in abilityId )
71+ foreach ( var id in abilityIdParam . Where ( id => id . id != 0 ) )
6472 {
65- if ( id . id != 0 )
66- {
67- this . abilities . Add ( id . id ) ;
68- }
73+ this . abilities . Add ( id . id ) ;
6974 }
70- foreach ( AbilityIdentifier id in toRemove )
75+
76+ foreach ( AbilityIdentifier id in abilitiesToRemove )
7177 {
72- this . abilityId . Remove ( id ) ;
78+ abilityIdParam . Remove ( id ) ;
79+ }
80+
81+ if ( abilityIdParam . Count > 0 )
82+ {
83+ CustomCard . abilityIds [ CustomCard . cards . Count - 1 ] = abilityIdParam ;
7384 }
7485 }
75- if ( abilityId is not null && this . abilityId . Count > 0 )
86+
87+ List < SpecialAbilityIdentifier > specialAbilitiesToRemove = new List < SpecialAbilityIdentifier > ( ) ;
88+ if ( specialAbilityIdParam is not null )
7689 {
77- CustomCard . abilityIds [ CustomCard . cards . Count - 1 ] = abilityId ;
90+ foreach ( var id in specialAbilityIdParam . Where ( id => id . id != 0 ) )
91+ {
92+ this . specialAbilities . Add ( id . id ) ;
93+ }
94+
95+ foreach ( SpecialAbilityIdentifier id in specialAbilitiesToRemove )
96+ {
97+ specialAbilityIdParam . Remove ( id ) ;
98+ }
99+
100+ if ( specialAbilityIdParam . Count > 0 )
101+ {
102+ CustomCard . specialAbilityIds [ CustomCard . cards . Count - 1 ] = specialAbilityIdParam ;
103+ }
78104 }
79105
106+
80107 // Handle EvolveIdentifier
81108 if ( evolveId is not null )
82109 {
0 commit comments