@@ -7,10 +7,12 @@ namespace APIPlugin
77 public class CustomCard
88 {
99 public static List < CustomCard > cards = new List < CustomCard > ( ) ;
10- public static Dictionary < int , List < AbilityIdentifier > > abilityIds = new Dictionary < int , List < AbilityIdentifier > > ( ) ;
11- public static Dictionary < int , EvolveIdentifier > evolveIds = new Dictionary < int , EvolveIdentifier > ( ) ;
12- public static Dictionary < int , IceCubeIdentifier > iceCubeIds = new Dictionary < int , IceCubeIdentifier > ( ) ;
13- public static Dictionary < int , TailIdentifier > tailIds = new Dictionary < int , TailIdentifier > ( ) ;
10+
11+ public static Dictionary < int , List < AbilityIdentifier > > abilityIds = new ( ) ;
12+ public static Dictionary < int , EvolveIdentifier > evolveIds = new ( ) ;
13+ public static Dictionary < int , IceCubeIdentifier > iceCubeIds = new ( ) ;
14+ public static Dictionary < int , TailIdentifier > tailIds = new ( ) ;
15+
1416 public string name ;
1517 public List < CardMetaCategory > metaCategories ;
1618 public CardComplexity ? cardComplexity ;
@@ -28,38 +30,53 @@ public class CustomCard
2830 public List < Tribe > tribes ;
2931 public List < Trait > traits ;
3032 public List < SpecialTriggeredAbility > specialAbilities ;
31- public List < Ability > abilities ;
33+ public List < Ability > abilities = new ( ) ;
3234 public EvolveParams evolveParams ;
3335 public string defaultEvolutionName ;
3436 public TailParams tailParams ;
3537 public IceCubeParams iceCubeParams ;
3638 public bool ? flipPortraitForStrafe ;
3739 public bool ? onePerDeck ;
3840 public List < CardAppearanceBehaviour . Appearance > appearanceBehaviour ;
39- [ IgnoreMapping ]
40- public Texture2D tex ;
41- [ IgnoreMapping ]
42- public Texture2D altTex ;
41+ [ IgnoreMapping ] public Texture2D tex ;
42+ [ IgnoreMapping ] public Texture2D altTex ;
4343 public Texture titleGraphic ;
44- [ IgnoreMapping ]
45- public Texture2D pixelTex ;
44+ [ IgnoreMapping ] public Texture2D pixelTex ;
4645 public GameObject animatedPortrait ;
4746 public List < Texture > decals ;
48- public List < AbilityIdentifier > abilityId ;
47+ public List < AbilityIdentifier > abilityIdList = new ( ) ;
4948 public EvolveIdentifier evolveId ;
5049 public IceCubeIdentifier iceCubeId ;
5150 public TailIdentifier tailId ;
5251
53- public CustomCard ( string name , List < AbilityIdentifier > abilityId = null , EvolveIdentifier evolveId = null , IceCubeIdentifier iceCubeId = null , TailIdentifier tailId = null )
52+ public CustomCard ( string name , List < AbilityIdentifier > abilityIdListParam = null ,
53+ EvolveIdentifier evolveId = null ,
54+ IceCubeIdentifier iceCubeId = null , TailIdentifier tailId = null )
5455 {
5556 this . name = name ;
5657 CustomCard . cards . Add ( this ) ;
5758
5859 // Handle AbilityIdentifier
5960 List < AbilityIdentifier > toRemove = new List < AbilityIdentifier > ( ) ;
60- if ( abilityId is not null && this . abilityId . Count > 0 )
61+ if ( abilityIdListParam is not null )
6162 {
62- CustomCard . abilityIds [ CustomCard . cards . Count - 1 ] = abilityId ;
63+ foreach ( AbilityIdentifier id in abilityIdListParam )
64+ {
65+ if ( id . id != 0 )
66+ {
67+ this . abilities . Add ( id . id ) ;
68+ }
69+ }
70+
71+ foreach ( AbilityIdentifier id in toRemove )
72+ {
73+ this . abilityIdList . Remove ( id ) ;
74+ }
75+ }
76+
77+ if ( abilityIdListParam is not null && this . abilityIdList . Count > 0 )
78+ {
79+ CustomCard . abilityIds [ CustomCard . cards . Count - 1 ] = abilityIdListParam ;
6380 }
6481
6582 // Handle EvolveIdentifier
@@ -92,22 +109,26 @@ public CardInfo AdjustCard(CardInfo card)
92109 card . portraitTex = Sprite . Create ( tex , CardUtils . DefaultCardArtRect , CardUtils . DefaultVector2 ) ;
93110 card . portraitTex . name = "portrait_" + name ;
94111 }
112+
95113 if ( this . altTex is not null )
96114 {
97115 altTex . name = "portrait_" + name ;
98116 altTex . filterMode = FilterMode . Point ;
99117 card . alternatePortrait = Sprite . Create ( altTex , CardUtils . DefaultCardArtRect , CardUtils . DefaultVector2 ) ;
100118 card . alternatePortrait . name = "portrait_" + name ;
101119 }
120+
102121 if ( this . pixelTex is not null )
103122 {
104123 pixelTex . name = "portrait_" + name ;
105124 pixelTex . filterMode = FilterMode . Point ;
106- card . pixelPortrait = Sprite . Create ( pixelTex , CardUtils . DefaultCardPixelArtRect , CardUtils . DefaultVector2 ) ;
125+ card . pixelPortrait =
126+ Sprite . Create ( pixelTex , CardUtils . DefaultCardPixelArtRect , CardUtils . DefaultVector2 ) ;
107127 card . pixelPortrait . name = "portrait_" + name ;
108128 }
129+
109130 Plugin . Log . LogInfo ( $ "Adjusted default card { name } !") ;
110131 return card ;
111132 }
112133 }
113- }
134+ }
0 commit comments