Skip to content

Commit 865afde

Browse files
committed
Make NewCard static
1 parent a4ff63e commit 865afde

File tree

2 files changed

+10
-73
lines changed

2 files changed

+10
-73
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ bin/
44
.idea/
55
.vs/
66
.vscode/
7+
*.user

Plugin.cs

Lines changed: 9 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using UnityEngine;
77
using DiskCardGame;
88
using HarmonyLib;
9+
#pragma warning disable 169
910

1011
namespace APIPlugin
1112
{
@@ -66,51 +67,16 @@ public class CustomCard
6667
public GameObject animatedPortrait;
6768
public List<Texture> decals;
6869

69-
public CustomCard(string name, List<CardMetaCategory> metaCategories = null, CardComplexity? cardComplexity = null, CardTemple? temple = null, string displayedName = "",
70-
int? baseAttack = null, int? baseHealth = null, string description = "", bool? hideAttackAndHealth = null, int? cost = null, int? bonesCost = null,
71-
int? energyCost = null, List<GemType> gemsCost = null, SpecialStatIcon? specialStatIcon = null, List<Tribe> tribes = null, List<Trait> traits = null,
72-
List<SpecialTriggeredAbility> specialAbilities = null, List<Ability> abilities = null, EvolveParams evolveParams = null, string defaultEvolutionName = "",
73-
TailParams tailParams = null, IceCubeParams iceCubeParams = null, bool? flipPortraitForStrafe = null, bool? onePerDeck = null,
74-
List<CardAppearanceBehaviour.Appearance> appearanceBehaviour = null, Texture2D tex = null, Texture2D altTex = null, Texture titleGraphic = null,
75-
Texture2D pixelTex = null, GameObject animatedPortrait = null, List<Texture> decals = null)
70+
public CustomCard(string name)
7671
{
7772
this.name = name;
78-
this.metaCategories = metaCategories;
79-
this.cardComplexity = cardComplexity;
80-
this.temple = temple;
81-
this.displayedName = displayedName;
82-
this.baseAttack = baseAttack;
83-
this.baseHealth = baseHealth;
84-
this.description = description;
85-
this.hideAttackAndHealth = hideAttackAndHealth;
86-
this.cost = cost;
87-
this.bonesCost = bonesCost;
88-
this.energyCost = energyCost;
89-
this.gemsCost = gemsCost;
90-
this.specialStatIcon = specialStatIcon;
91-
this.tribes = tribes;
92-
this.traits = traits;
93-
this.specialAbilities = specialAbilities;
94-
this.abilities = abilities;
95-
this.evolveParams = evolveParams;
96-
this.defaultEvolutionName = defaultEvolutionName;
97-
this.tailParams = tailParams;
98-
this.iceCubeParams = iceCubeParams;
99-
this.flipPortraitForStrafe = flipPortraitForStrafe;
100-
this.onePerDeck = onePerDeck;
101-
this.appearanceBehaviour = appearanceBehaviour;
102-
this.tex = tex;
103-
this.altTex = altTex;
104-
this.titleGraphic = titleGraphic;
105-
this.pixelTex = pixelTex;
106-
this.animatedPortrait = animatedPortrait;
107-
this.decals = decals;
10873
CustomCard.cards.Add(this);
10974
}
11075

11176
public CardInfo AdjustCard(CardInfo card)
11277
{
11378
TypeMapper<CustomCard, CardInfo>.Convert(this, card);
79+
11480
if (this.tex is not null)
11581
{
11682
tex.name = "portrait_" + name;
@@ -137,11 +103,11 @@ public CardInfo AdjustCard(CardInfo card)
137103
}
138104
}
139105

140-
public class NewCard
106+
public static class NewCard
141107
{
142108
public static List<CardInfo> cards = new List<CardInfo>();
143109

144-
public NewCard(CardInfo card)
110+
public static void Add(CardInfo card)
145111
{
146112
NewCard.cards.Add(card);
147113
Plugin.Log.LogInfo($"Loaded custom card {card.name}!");
@@ -150,11 +116,11 @@ public NewCard(CardInfo card)
150116
// TODO Implement a handler for custom appearanceBehaviour - in particular custom card backs
151117
// TODO Change parameter order, and function setter call order to make more sense
152118
// TODO Rename parameters to be more user friendly
153-
public NewCard(string name, List<CardMetaCategory> metaCategories, CardComplexity cardComplexity, CardTemple temple, string displayedName, int baseAttack, int baseHealth,
154-
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,
155121
bool hideAttackAndHealth = false, int cost = 0, int bonesCost = 0, int energyCost = 0, List<GemType> gemsCost = null, SpecialStatIcon specialStatIcon = SpecialStatIcon.None,
156122
List<Tribe> tribes = null, List<Trait> traits = null, List<SpecialTriggeredAbility> specialAbilities = null, List<Ability> abilities = null, EvolveParams evolveParams = null,
157-
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,
158124
List<CardAppearanceBehaviour.Appearance> appearanceBehaviour = null, Texture2D tex = null, Texture2D altTex = null, Texture titleGraphic = null, Texture2D pixelTex = null,
159125
GameObject animatedPortrait = null, List<Texture> decals = null)
160126
{
@@ -285,39 +251,9 @@ public class CustomRegion
285251
private Color? mapEmissionColor;
286252
private List<GameObject> mapParticlesPrefabs;
287253

288-
public CustomRegion(string name, int? tier = null, List<CardInfo> terrainCards = null, List<ConsumableItemData> consumableItems = null, List<EncounterBlueprintData> encounters = null,
289-
List<Opponent.Type> bosses = null, List<CardInfo> likelyCards = null, List<Tribe> dominantTribes = null, PredefinedNodes predefinedNodes = null,
290-
EncounterBlueprintData bossPrepEncounter = null, StoryEventCondition bossPrepCondition = null, List<ScarceSceneryEntry> scarceScenery = null,
291-
List<FillerSceneryEntry> fillerScenery = null, PredefinedScenery predefinedScenery = null, string ambientLoopId = "", bool? silenceCabinAmbience = null,
292-
Color? boardLightColor = null, Color? cardsLightColor = null, bool? dustParticlesDisabled = null, bool? fogEnabled = null, VolumetricFogAndMist.VolumetricFogProfile fogProfile = null,
293-
float? fogAlpha = null, Texture mapAlbedo = null, Texture mapEmission = null, Color? mapEmissionColor = null, List<GameObject> mapParticlesPrefabs = null)
254+
public CustomRegion(string name)
294255
{
295256
this.name = name;
296-
this.tier = tier;
297-
this.terrainCards = terrainCards;
298-
this.consumableItems = consumableItems;
299-
this.encounters = encounters;
300-
this.bosses = bosses;
301-
this.likelyCards = likelyCards;
302-
this.dominantTribes = dominantTribes;
303-
this.predefinedNodes = predefinedNodes;
304-
this.bossPrepEncounter = bossPrepEncounter;
305-
this.bossPrepCondition = bossPrepCondition;
306-
this.scarceScenery = scarceScenery;
307-
this.fillerScenery = fillerScenery;
308-
this.predefinedScenery = predefinedScenery;
309-
this.ambientLoopId = ambientLoopId;
310-
this.silenceCabinAmbience = silenceCabinAmbience;
311-
this.boardLightColor = boardLightColor;
312-
this.cardsLightColor = cardsLightColor;
313-
this.dustParticlesDisabled = dustParticlesDisabled;
314-
this.fogEnabled = fogEnabled;
315-
this.fogProfile = fogProfile;
316-
this.fogAlpha = fogAlpha;
317-
this.mapAlbedo = mapAlbedo;
318-
this.mapEmission = mapEmission;
319-
this.mapEmissionColor = mapEmissionColor;
320-
this.mapParticlesPrefabs = mapParticlesPrefabs;
321257
CustomRegion.regions.Add(this);
322258
}
323259

0 commit comments

Comments
 (0)