1+ using System . Collections . Generic ;
2+ using DiskCardGame ;
3+ using InscryptionAPI . Card ;
4+ using UnityEngine ;
5+
6+ namespace APIPlugin
7+ {
8+ [ Obsolete ( "Use CardManager instead" , true ) ]
9+ public class CustomCard
10+ {
11+ public static List < CustomCard > cards = new ( ) ;
12+
13+ public static Dictionary < int , List < AbilityIdentifier > > abilityIds = new ( ) ;
14+ public static Dictionary < int , List < SpecialAbilityIdentifier > > specialAbilityIds = new ( ) ;
15+ public static Dictionary < int , EvolveIdentifier > evolveIds = new ( ) ;
16+ public static Dictionary < int , IceCubeIdentifier > iceCubeIds = new ( ) ;
17+ public static Dictionary < int , TailIdentifier > tailIds = new ( ) ;
18+ public static Dictionary < string , Sprite > emissions = new ( ) ;
19+
20+ public string name ;
21+ public List < CardMetaCategory > metaCategories ;
22+ public CardComplexity ? cardComplexity ;
23+ public CardTemple ? temple ;
24+ public string displayedName ;
25+ public int ? baseAttack ;
26+ public int ? baseHealth ;
27+ public string description ;
28+ public bool ? hideAttackAndHealth ;
29+ public int ? cost ;
30+ public int ? bonesCost ;
31+ public int ? energyCost ;
32+ public List < GemType > gemsCost ;
33+ public SpecialStatIcon ? specialStatIcon ;
34+ public List < Tribe > tribes ;
35+ public List < Trait > traits ;
36+ public List < SpecialTriggeredAbility > specialAbilities ;
37+ public List < Ability > abilities ;
38+ public EvolveParams evolveParams ;
39+ public string defaultEvolutionName ;
40+ public TailParams tailParams ;
41+ public IceCubeParams iceCubeParams ;
42+ public bool ? flipPortraitForStrafe ;
43+ public bool ? onePerDeck ;
44+ public List < CardAppearanceBehaviour . Appearance > appearanceBehaviour ;
45+ [ IgnoreMapping ] public Texture2D tex ;
46+ [ IgnoreMapping ] public Texture2D altTex ;
47+ public Texture titleGraphic ;
48+ [ IgnoreMapping ] public Texture2D pixelTex ;
49+ [ IgnoreMapping ] public Texture2D emissionTex ;
50+ public GameObject animatedPortrait ;
51+ public List < Texture > decals ;
52+
53+ [ IgnoreMapping ] private List < AbilityIdentifier > abilityIdParam ;
54+ [ IgnoreMapping ] private List < SpecialAbilityIdentifier > specialAbilityIdParam ;
55+ [ IgnoreMapping ] private EvolveIdentifier evolveId ;
56+ [ IgnoreMapping ] private IceCubeIdentifier iceCubeId ;
57+ [ IgnoreMapping ] private TailIdentifier tailId ;
58+
59+ public CustomCard (
60+ string name ,
61+ List < AbilityIdentifier > abilityIdParam = null ,
62+ List < SpecialAbilityIdentifier > specialAbilityIdParam = null ,
63+ EvolveIdentifier evolveId = null ,
64+ IceCubeIdentifier iceCubeId = null ,
65+ TailIdentifier tailId = null )
66+ {
67+ this . name = name ;
68+ this . abilityIdParam = abilityIdParam ;
69+ this . specialAbilityIdParam = specialAbilityIdParam ;
70+ this . evolveId = evolveId ;
71+ this . iceCubeId = iceCubeId ;
72+ this . tailId = tailId ;
73+
74+ CardManager . ModifyCardList += delegate ( List < CardInfo > cards )
75+ {
76+ CardInfo targetCard = cards . CardByName ( this . name ) ;
77+
78+ if ( targetCard != null )
79+ this . AdjustCard ( targetCard , cards ) ;
80+
81+ return cards ;
82+ } ;
83+ }
84+
85+ public CardInfo AdjustCard ( CardInfo card , List < CardInfo > cardsToSearch )
86+ {
87+ TypeMapper < CustomCard , CardInfo > . Convert ( this , card ) ;
88+
89+ if ( this . tex is not null )
90+ card . SetPortrait ( this . tex ) ;
91+
92+ if ( this . altTex is not null )
93+ card . SetAltPortrait ( this . altTex ) ;
94+
95+ if ( this . pixelTex is not null )
96+ card . SetPixelPortrait ( this . pixelTex ) ;
97+
98+ if ( this . decals is not null )
99+ card . AddDecal ( this . decals . ToArray ( ) ) ;
100+
101+ if ( this . abilityIdParam != null )
102+ card . AddAbilities ( this . abilityIdParam . Select ( ai => ai . realID ) . ToArray ( ) ) ;
103+
104+ if ( this . specialAbilityIdParam != null )
105+ card . AssignSpecialAbilities ( this . specialAbilityIdParam ) ;
106+
107+ if ( this . evolveId != null )
108+ {
109+ // We're already in the mapper. I don't want to add another event handler
110+ CardInfo evolveTarget = cardsToSearch . CardByName ( this . evolveId . name ) ;
111+ if ( evolveTarget != null )
112+ card . SetEvolve ( evolveTarget , this . evolveId . turnsToEvolve , new List < CardModificationInfo > ( ) { this . evolveId . mods } ) ;
113+ }
114+
115+ if ( this . tailId != null )
116+ {
117+ // We're already in the mapper. I don't want to add another event handler
118+ CardInfo tail = cardsToSearch . CardByName ( this . tailId . name ) ;
119+ if ( tail != null )
120+ card . SetTail ( tail , this . tailId . tailLostTex , mods : new List < CardModificationInfo > ( ) { this . tailId . mods } ) ;
121+ }
122+
123+ if ( this . iceCubeId != null )
124+ {
125+ // We're already in the mapper. I don't want to add another event handler
126+ CardInfo iceCubeTarget = cardsToSearch . CardByName ( this . iceCubeId . name ) ;
127+ if ( iceCubeTarget != null )
128+ card . SetIceCube ( iceCubeTarget , new List < CardModificationInfo > ( ) { this . iceCubeId . mods } ) ;
129+ }
130+
131+ return card ;
132+ }
133+ }
134+ }
0 commit comments