Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<details>
<summary>View Changelog</summary>

# 2.22.2
- Added GetEnergyConfig method to community patch's EnergyDrone class - retrieves the current Act's EnergyConfigInfo
- CommunityPatches: Added community config to move pelt price tags to the right of the card
- Experimental: Changed gemified to only reduce a single cost on a card, with priority of Energy > Bones > Gems > Blood
- Fixed positioning errors caused by having multiple custom boss challenge icons
- EnergyConfigInfo's fields can now be modified when initialising a new instance
- Updated installation guide on the ReadMe to match the wiki, added link to wiki.

# 2.22.1
- Added IShieldPreventedDamage and IShieldPreventedDamageInHand ability triggers and interfaces
- Added TriggerBreakShield, wraps BreakShield in an IEnumerator for additional customisation by modders
Expand Down
25 changes: 17 additions & 8 deletions InscryptionAPI/Ascension/AscensionChallengePaginator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,29 +71,37 @@ public void AddPage(List<AscensionChallengeInfo> challengeInfos)
List<AscensionChallengeInfo> bossChallengeInfos = challengeInfos.FindAll(x => x.challengeType.GetFullChallenge().Boss);

// keep track of the number of bosses that are on this page, and account for them when determining how many icons to create
int numBosses = challengeInfos.Count(x => x.challengeType.GetFullChallenge().Boss);
int numBosses = bossChallengeInfos.Count;
int numIcons = Mathf.Min(14, challengeObjectsForPages[0].Count) - numBosses;

// the list index when we begin adding boss icons
int bossStartingIndex = (1 + regularChallengeInfos.Count) / 2;
int numBossesAdded = 0;

//Debug.Log($"NumIcons for Page: {numIcons}: {regularChallengeInfos.Count} {bossChallengeInfos.Count}");
// 14 = regular + boss * 2
//Debug.Log($"NumIcons for Page: {numIcons}: {regularChallengeInfos.Count} {bossChallengeInfos.Count} | {bossStartingIndex}");

for (int i = 0; i < 14; i++)
{
GameObject objectRef = null;

if (i % 7 < bossStartingIndex + numBosses && i % 7 >= bossStartingIndex)
int columnIndex = i % 7;
//Debug.Log($"{i} ({columnIndex}) | {bossStartingIndex + numBosses} / {bossStartingIndex}");

if (columnIndex >= bossStartingIndex && columnIndex < bossStartingIndex + numBosses)
{
//Debug.Log($"In boss column {i}");
if (numBossesAdded < numBosses)
{
//Debug.Log($"Use boss icon");
numBossesAdded++;
objectRef = challengeObjectsForPages[0][14];
}
else
{
i += numBosses;
//Debug.Log($"Skip to end");
i += numBosses - 1; // account for loop iteration
continue;
}
}

Expand All @@ -117,21 +125,22 @@ public void AddPage(List<AscensionChallengeInfo> challengeInfos)
int infoCount = challengeInfos.Count;
for (int i = 0; i < newPage.Count; i++)
{
//Debug.Log($"Checking icon [{i}] info {infoIdx}");
AscensionChallengeInfo info = challengeInfos[infoIdx];
AscensionIconInteractable interactable = newPage[i].GetComponent<AscensionIconInteractable>();

//Debug.Log($"Checking icon [{i}] info at {infoIdx} : {info.title}");
if (i < infoCount)
{
// if we're assigning boss info to an icon that isn't a boss icon
if (challengeInfos[infoIdx].GetFullChallenge().Boss && (interactable.coll2D as BoxCollider2D).size.y < 1f)
if (info.GetFullChallenge().Boss && (interactable.coll2D as BoxCollider2D).size.y < 1f)
{
//Debug.Log("Boss error: y < 1");
interactable.challengeInfo = missingChallengeInfo;
newPage[i].AddComponent<NoneChallengeDisplayer>();
infoCount++;
}
else
{
interactable.challengeInfo = challengeInfos[infoIdx];
interactable.challengeInfo = info;
infoIdx++;
}
}
Expand Down
2 changes: 2 additions & 0 deletions InscryptionAPI/Ascension/ChallengeDisplayerPlus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public static ChallengeDisplayerPlus TryAddChallengeDisplayerPlusToDisplayer(Asc
if (plus.incompatibilityText == null)
{
GameObject cloned = Instantiate(displayer.titleText.gameObject);
cloned.name = "PixelTextLine_INCOMPATIBLE";
cloned.transform.parent = displayer.titleText.transform.parent;
float y = plus.originalTitlePos;
if (displayer.descriptionText != null)
Expand All @@ -47,6 +48,7 @@ public static ChallengeDisplayerPlus TryAddChallengeDisplayerPlusToDisplayer(Asc
if (plus.dependencyText == null)
{
GameObject cloned = Instantiate(displayer.titleText.gameObject);
cloned.name = "PixelTextLine_DEPENDENCY";
cloned.transform.parent = displayer.titleText.transform.parent;
float y = plus.originalTitlePos;
if (displayer.descriptionText != null)
Expand Down
7 changes: 3 additions & 4 deletions InscryptionAPI/Card/CardExtensionsCosts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ public static int BloodCost(this PlayableCard card)
if (card && card.Info)
{
int originalBloodCost = CostProperties.CostProperties.OriginalBloodCost(card.Info);

if (card.IsUsingBlueGem())
if (card.IsUsingBlueGem() && CostProperties.CostProperties.ReduceGemifiedBlood(card, originalBloodCost))
originalBloodCost--;

// add adjustments from temp mods
Expand All @@ -59,7 +58,7 @@ public static int BonesCost(this PlayableCard card)
if (card && card.Info)
{
int originalBonesCost = CostProperties.CostProperties.OriginalBonesCost(card.Info);
if (card.IsUsingBlueGem())
if (card.IsUsingBlueGem() && CostProperties.CostProperties.ReduceGemifiedBones(card, originalBonesCost))
originalBonesCost--;

// add adjustments from temp mods
Expand Down Expand Up @@ -98,7 +97,7 @@ public static List<GemType> GemsCost(this PlayableCard card)
}
}

if (gemsCost.Count > 0 && card.IsUsingBlueGem())
if (card.IsUsingBlueGem() && CostProperties.CostProperties.ReduceGemifiedMox(card, gemsCost))
gemsCost.RemoveAt(0);

return gemsCost;
Expand Down
27 changes: 24 additions & 3 deletions InscryptionAPI/Card/CostProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ public bool GemsChanged<T>(List<T> a, List<T> b)
[HarmonyReversePatch, HarmonyPatch(typeof(CardInfo), nameof(CardInfo.BloodCost), MethodType.Getter), MethodImpl(MethodImplOptions.NoInlining)]
public static int OriginalBloodCost(CardInfo __instance) { return 0; }


/// <summary>
/// ChangeCardCostGetter patches BoneCost so we can change the cost on the fly
/// This reverse patch gives us access to the original method without any changes.
Expand All @@ -87,7 +86,6 @@ public bool GemsChanged<T>(List<T> a, List<T> b)
[HarmonyReversePatch, HarmonyPatch(typeof(CardInfo), nameof(CardInfo.BonesCost), MethodType.Getter), MethodImpl(MethodImplOptions.NoInlining)]
public static int OriginalBonesCost(CardInfo __instance) { return 0; }


/// <summary>
/// ChangeCardCostGetter patches GemsCost so we can change the cost on the fly
/// This reverse patch gives us access to the original method without any changes.
Expand All @@ -96,6 +94,11 @@ public bool GemsChanged<T>(List<T> a, List<T> b)
[HarmonyReversePatch, HarmonyPatch(typeof(CardInfo), nameof(CardInfo.GemsCost), MethodType.Getter), MethodImpl(MethodImplOptions.NoInlining)]
public static List<GemType> OriginalGemsCost(CardInfo __instance) { return null; }

/// <summary>
/// Improved version of CardInfo.GemsCost that accounts for addGemCost and RemovedGemsCost().
/// </summary>
/// <remarks>For consistency's sake, it's recommended you use this method over OriginalGemsCost in most cases.</remarks>
/// <param name="instance"></param>
public static List<GemType> ImprovedGemsCost(CardInfo instance)
{
if (instance.Mods.Exists(x => x.nullifyGemsCost))
Expand Down Expand Up @@ -123,6 +126,23 @@ public static List<GemType> ImprovedGemsCost(CardInfo instance)
/// </summary>
[HarmonyReversePatch, HarmonyPatch(typeof(CardInfo), nameof(CardInfo.EnergyCost), MethodType.Getter), MethodImpl(MethodImplOptions.NoInlining)]
public static int OriginalEnergyCost(CardInfo __instance) { return 0; }

public static bool ReduceGemifiedBlood(PlayableCard card, int? bloodCost = null)
{
return (bloodCost ?? OriginalBloodCost(card.Info)) > 0 && !ReduceGemifiedMox(card) && !ReduceGemifiedBones(card) && !ReduceGemifiedMox(card);
}
public static bool ReduceGemifiedMox(PlayableCard card, List<GemType> gemsCost = null)
{
return (gemsCost?.Count ?? ImprovedGemsCost(card.Info).Count) > 0 && !ReduceGemifiedBones(card) && !ReduceGemifiedEnergy(card);
}
public static bool ReduceGemifiedBones(PlayableCard card, int? bonesCost = null)
{
return (bonesCost ?? OriginalBonesCost(card.Info)) > 0 && !ReduceGemifiedEnergy(card);
}
public static bool ReduceGemifiedEnergy(PlayableCard card, int? energyCost = null)
{
return (energyCost ?? OriginalEnergyCost(card.Info)) > 0;
}
}

[HarmonyPatch]
Expand Down Expand Up @@ -162,12 +182,13 @@ public static bool EnergyCost(CardInfo __instance, ref int __result)
__result = card?.EnergyCost ?? CostProperties.OriginalEnergyCost(__instance);
return false;
}

[HarmonyPatch(typeof(PlayableCard), nameof(PlayableCard.EnergyCost), MethodType.Getter), HarmonyPrefix]
public static bool DisableVanillaEnergyCost(PlayableCard __instance, ref int __result)
{
// patch this to follow the same pattern as the other cost methods
int energyCost = CostProperties.OriginalEnergyCost(__instance.Info);
if (__instance.IsUsingBlueGem())
if (__instance.IsUsingBlueGem() && CostProperties.ReduceGemifiedEnergy(__instance, energyCost))
energyCost--;

foreach (CardModificationInfo mod in __instance.TemporaryMods)
Expand Down
2 changes: 1 addition & 1 deletion InscryptionAPI/InscryptionAPI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<DebugType>full</DebugType>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<Version>2.22.1</Version>
<Version>2.22.2</Version>
</PropertyGroup>

<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion InscryptionAPI/InscryptionAPIPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class InscryptionAPIPlugin : BaseUnityPlugin
{
public const string ModGUID = "cyantist.inscryption.api";
public const string ModName = "InscryptionAPI";
public const string ModVer = "2.22.0";
public const string ModVer = "2.22.2";

public static string Directory = "";

Expand Down
2 changes: 1 addition & 1 deletion InscryptionCommunityPatch/InscryptionCommunityPatch.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>full</DebugType>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Version>2.21.0</Version>
<Version>2.22.0</Version>
</PropertyGroup>

<PropertyGroup>
Expand Down
2 changes: 2 additions & 0 deletions InscryptionCommunityPatch/InscryptionCommunityPatchPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public class PatchPlugin : BaseUnityPlugin
internal static ConfigEntry<bool> configRemovePatches;

internal static ConfigEntry<bool> configSmallPricetags;
internal static ConfigEntry<bool> configMovePricetags;

internal static ConfigEntry<bool> configTestState;

Expand Down Expand Up @@ -93,6 +94,7 @@ private void Awake()
configMergeOnBottom = Config.Bind("Sigil Display", "Merge_On_Botom", false, "Makes it so if enabled, merged sigils will display on the bottom of the card instead of on the artwork. In extreme cases, this can cause some visual bugs.");
configRemovePatches = Config.Bind("Sigil Display", "Remove_Patches", false, "Makes it so if enabled, merged sigils will not have a patch behind them anymore and will instead be glowing yellow (only works with Merge_On_Bottom).");
configSmallPricetags = Config.Bind("Act 1", "Smaller Pricetags", false, "If enabled, the price tags placed on cards while buying from the Trapper will be scaled down.");
configMovePricetags = Config.Bind("Act 1", "Move Pricetags", false, "If enabled, the price tags placed on cards while buying from the Trapper will be moved to the right.");
act2StackIconType = Config.Bind("Sigil Display", "Act 2 Sigil icon type", true, "If true, stacking icons are a cream outline with a black center. If false, stacking icons are a black outline with a cream center. Act 2");
act2TutorCenterRows = Config.Bind("Act 2", "Centred Hoarder UI", true, "If true, centres displayed cards in each row during the Hoarder selection sequence.");
configFullDebug = Config.Bind("General", "Full Debug", true, "If true, displays all debug logs in the console.");
Expand Down
48 changes: 32 additions & 16 deletions InscryptionCommunityPatch/ResourceManagers/ActOneEnergyDrone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,26 @@ namespace InscryptionCommunityPatch.ResourceManagers;
[HarmonyPatch]
public static class EnergyDrone
{
/// <summary>
/// Class containing information on the resource energy drone. Controls whether the Energy Drone will appear in non-Act 3 acts.
/// </summary>
public class EnergyConfigInfo
{
public bool ConfigEnergy => PoolHasEnergy || PatchPlugin.configEnergy.Value;
public bool ConfigDrone => PoolHasEnergy || ConfigDroneMox || PatchPlugin.configDrone.Value;
public bool ConfigDroneMox => PoolHasGems || PatchPlugin.configDroneMox.Value;
public bool ConfigMox => PoolHasGems || PatchPlugin.configMox.Value;
public bool ConfigDefaultDrone => PatchPlugin.configDefaultDrone.Value;
public bool ConfigEnergy { get; set; } = PoolHasEnergy || PatchPlugin.configEnergy.Value;
public bool ConfigShowDrone { get; set; } = PoolHasEnergy || PatchPlugin.configDrone.Value;
public bool ConfigDroneMox { get; set; } = PoolHasGems || PatchPlugin.configDroneMox.Value;
public bool ConfigMox { get; set; } = PoolHasGems || PatchPlugin.configMox.Value;
public bool ConfigDefaultDrone { get; set; } = PatchPlugin.configDefaultDrone.Value;

/// <summary>
/// Controls whether or not the Drone will appear. By default, will appear if there are obtainable Energy or Mox cards in the card pool (or the corresponding config value has been set).
/// </summary>
public bool ConfigDrone => ConfigShowDrone || ConfigDroneMox;
}

/// <summary>
/// Contains the EnergyConfigInfos for each Act with default settings. If you want to directly alter an Act's drone behaviour, please modify GetEnergyConfig instead.
/// </summary>
public static Dictionary<CardTemple, EnergyConfigInfo> ZoneConfigs = new()
{
{ CardTemple.Nature, new() },
Expand Down Expand Up @@ -49,23 +60,28 @@ public static bool CurrentSceneCanHaveEnergyDrone
}
}

private static EnergyConfigInfo EnergyConfig
/// <summary>
/// Returns the EnergyConfigInfo object corresponding to the current Act.
/// </summary>
public static EnergyConfigInfo GetEnergyConfig()
{
get
{
if (SaveManager.SaveFile.IsPart3)
return ZoneConfigs[CardTemple.Tech];
if (SaveManager.SaveFile.IsPart3)
return ZoneConfigs[CardTemple.Tech];

if (SaveManager.SaveFile.IsGrimora)
return ZoneConfigs[CardTemple.Undead];
if (SaveManager.SaveFile.IsGrimora)
return ZoneConfigs[CardTemple.Undead];

if (SaveManager.SaveFile.IsMagnificus)
return ZoneConfigs[CardTemple.Wizard];
if (SaveManager.SaveFile.IsMagnificus)
return ZoneConfigs[CardTemple.Wizard];

return ZoneConfigs[CardTemple.Nature];
}
return ZoneConfigs[CardTemple.Nature];
}

/// <summary>
/// The EnergyConfigInfo for the current Act.
/// </summary>
private static EnergyConfigInfo EnergyConfig => GetEnergyConfig();

public static bool PoolHasEnergy { get; private set; }
public static bool PoolHasGems { get; private set; }

Expand Down
19 changes: 13 additions & 6 deletions InscryptionCommunityPatch/Sequencers/BuyPeltsSmallTags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,20 @@ internal class BuyPeltsSmallTags
[HarmonyPostfix, HarmonyPatch(typeof(BuyPeltsSequencer), nameof(BuyPeltsSequencer.AddPricetagToCard))]
private static void ReducePricetagSize(SelectableCard card)
{
if (!PatchPlugin.configSmallPricetags.Value)
return;

Transform t = card.transform.Find("pricetag");
if (t != null)
if (PatchPlugin.configSmallPricetags.Value || PatchPlugin.configMovePricetags.Value)
{
t.localScale = new(0.75f, 1f, 0.75f);
Transform t = card.transform.Find("pricetag");
if (t == null)
return;

if (PatchPlugin.configSmallPricetags.Value)
{
t.localScale = new(0.75f, 1f, 0.75f);
}
if (PatchPlugin.configMovePricetags.Value)
{
t.localPosition = new(t.localPosition.x * -1, t.localPosition.y, t.localPosition.z);
}
}
}
}
Loading
Loading