Skip to content

Commit

Permalink
abilities on customcard fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottWilson0903 committed Nov 21, 2021
1 parent 1be6624 commit a5391b9
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 47 deletions.
2 changes: 1 addition & 1 deletion API.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>API</AssemblyName>
<Description>An API for inscryption</Description>
<Version>1.12.0.0</Version>
<Version>1.12.1.0</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>9.0</LangVersion>
</PropertyGroup>
Expand Down
9 changes: 6 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Changelog
## v1.12.1
- Bugfix so CustomCard doesn't wipe ability information.

## v1.12
- Fixes params
- Adds feature for special abilities and special stat icons
- Added support for emissions
- Fixes params.
- Adds feature for special abilities and special stat icons.
- Added support for emissions.

## v1.11
- Added support for more identifiers
Expand Down
48 changes: 7 additions & 41 deletions Models/CustomCard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class CustomCard
public static Dictionary<int,TailIdentifier> tailIds = new();

public static Dictionary<string, Sprite> emissions = new();

public string name;
public List<CardMetaCategory> metaCategories;
public CardComplexity? cardComplexity;
Expand All @@ -32,8 +33,8 @@ public class CustomCard
public SpecialStatIcon? specialStatIcon;
public List<Tribe> tribes;
public List<Trait> traits;
public List<SpecialTriggeredAbility> specialAbilities = new();
public List<Ability> abilities = new();
public List<SpecialTriggeredAbility> specialAbilities;
public List<Ability> abilities;
public EvolveParams evolveParams;
public string defaultEvolutionName;
public TailParams tailParams;
Expand All @@ -48,10 +49,6 @@ public class CustomCard
[IgnoreMapping] public Texture2D emissionTex;
public GameObject animatedPortrait;
public List<Texture> decals;
public List<AbilityIdentifier> abilityIdList = new();
public EvolveIdentifier evolveId;
public IceCubeIdentifier iceCubeId;
public TailIdentifier tailId;

public CustomCard(
string name,
Expand All @@ -65,47 +62,16 @@ public CustomCard(
CustomCard.cards.Add(this);

// Handle AbilityIdentifier
List<AbilityIdentifier> abilitiesToRemove = new List<AbilityIdentifier>();
if (abilityIdParam is not null)
if (abilityIdParam is not null && abilityIdParam.Count > 0)
{
foreach (var id in abilityIdParam.Where(id => id.id != 0))
{
this.abilities.Add(id.id);
abilitiesToRemove.Add(id);
}

foreach (AbilityIdentifier id in abilitiesToRemove)
{
abilityIdParam.Remove(id);
}

if (abilityIdParam.Count > 0)
{
CustomCard.abilityIds[CustomCard.cards.Count - 1] = abilityIdParam;
}
CustomCard.abilityIds[CustomCard.cards.Count - 1] = abilityIdParam;
}

List<SpecialAbilityIdentifier> specialAbilitiesToRemove = new List<SpecialAbilityIdentifier>();
if (specialAbilityIdParam is not null)
if (specialAbilityIdParam is not null && specialAbilityIdParam.Count > 0)
{
foreach (var id in specialAbilityIdParam.Where(id => id.id != 0))
{
this.specialAbilities.Add(id.id);
specialAbilitiesToRemove.Add(id);
}

foreach (SpecialAbilityIdentifier id in specialAbilitiesToRemove)
{
specialAbilityIdParam.Remove(id);
}

if (specialAbilityIdParam.Count > 0)
{
CustomCard.specialAbilityIds[CustomCard.cards.Count - 1] = specialAbilityIdParam;
}
CustomCard.specialAbilityIds[CustomCard.cards.Count - 1] = specialAbilityIdParam;
}


// Handle EvolveIdentifier
if (evolveId is not null)
{
Expand Down
2 changes: 1 addition & 1 deletion Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public partial class Plugin : BaseUnityPlugin
{
private const string PluginGuid = "cyantist.inscryption.api";
private const string PluginName = "API";
private const string PluginVersion = "1.12.0.0";
private const string PluginVersion = "1.12.1.0";

internal static ManualLogSource Log;
internal static ConfigEntry<bool> configEnergy;
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "API",
"version_number": "1.12.0",
"version_number": "1.12.1",
"website_url": "https://github.com/ScottWilson0903/InscryptionAPI",
"description": "This plugin is a BepInEx plugin made for Inscryption as an API. It can currently create custom cards and abilities and inject them into the data pool, or modify existing cards in the card pool.",
"dependencies": [
Expand Down

0 comments on commit a5391b9

Please sign in to comment.