Skip to content

Commit 8106b43

Browse files
Clean up
1 parent 4d3a5f5 commit 8106b43

File tree

5 files changed

+44
-13
lines changed

5 files changed

+44
-13
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

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

InscryptionAPI/Card/CardExtensionsCosts.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ public static int BloodCost(this PlayableCard card)
3535
if (card && card.Info)
3636
{
3737
int originalBloodCost = CostProperties.CostProperties.OriginalBloodCost(card.Info);
38-
39-
if (card.IsUsingBlueGem())
38+
if (card.IsUsingBlueGem() && CostProperties.CostProperties.ReduceGemifiedBlood(card, originalBloodCost))
4039
originalBloodCost--;
4140

4241
// add adjustments from temp mods
@@ -59,7 +58,7 @@ public static int BonesCost(this PlayableCard card)
5958
if (card && card.Info)
6059
{
6160
int originalBonesCost = CostProperties.CostProperties.OriginalBonesCost(card.Info);
62-
if (card.IsUsingBlueGem())
61+
if (card.IsUsingBlueGem() && CostProperties.CostProperties.ReduceGemifiedBones(card, originalBonesCost))
6362
originalBonesCost--;
6463

6564
// add adjustments from temp mods
@@ -98,7 +97,7 @@ public static List<GemType> GemsCost(this PlayableCard card)
9897
}
9998
}
10099

101-
if (gemsCost.Count > 0 && card.IsUsingBlueGem())
100+
if (card.IsUsingBlueGem() && CostProperties.CostProperties.ReduceGemifiedMox(card, gemsCost))
102101
gemsCost.RemoveAt(0);
103102

104103
return gemsCost;

InscryptionAPI/Card/CostProperties.cs

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ public bool GemsChanged<T>(List<T> a, List<T> b)
7878
[HarmonyReversePatch, HarmonyPatch(typeof(CardInfo), nameof(CardInfo.BloodCost), MethodType.Getter), MethodImpl(MethodImplOptions.NoInlining)]
7979
public static int OriginalBloodCost(CardInfo __instance) { return 0; }
8080

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

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

97+
/// <summary>
98+
/// Improved version of CardInfo.GemsCost that accounts for addGemCost and RemovedGemsCost().
99+
/// </summary>
100+
/// <remarks>For consistency's sake, it's recommended you use this method over OriginalGemsCost in most cases.</remarks>
101+
/// <param name="instance"></param>
99102
public static List<GemType> ImprovedGemsCost(CardInfo instance)
100103
{
101104
if (instance.Mods.Exists(x => x.nullifyGemsCost))
@@ -123,6 +126,23 @@ public static List<GemType> ImprovedGemsCost(CardInfo instance)
123126
/// </summary>
124127
[HarmonyReversePatch, HarmonyPatch(typeof(CardInfo), nameof(CardInfo.EnergyCost), MethodType.Getter), MethodImpl(MethodImplOptions.NoInlining)]
125128
public static int OriginalEnergyCost(CardInfo __instance) { return 0; }
129+
130+
public static bool ReduceGemifiedBlood(PlayableCard card, int? bloodCost = null)
131+
{
132+
return (bloodCost ?? OriginalBloodCost(card.Info)) > 0 && !ReduceGemifiedMox(card) && !ReduceGemifiedBones(card) && !ReduceGemifiedMox(card);
133+
}
134+
public static bool ReduceGemifiedMox(PlayableCard card, List<GemType> gemsCost = null)
135+
{
136+
return (gemsCost?.Count ?? ImprovedGemsCost(card.Info).Count) > 0 && !ReduceGemifiedBones(card) && !ReduceGemifiedEnergy(card);
137+
}
138+
public static bool ReduceGemifiedBones(PlayableCard card, int? bonesCost = null)
139+
{
140+
return (bonesCost ?? OriginalBonesCost(card.Info)) > 0 && !ReduceGemifiedEnergy(card);
141+
}
142+
public static bool ReduceGemifiedEnergy(PlayableCard card, int? energyCost = null)
143+
{
144+
return (energyCost ?? OriginalEnergyCost(card.Info)) > 0;
145+
}
126146
}
127147

128148
[HarmonyPatch]
@@ -162,12 +182,13 @@ public static bool EnergyCost(CardInfo __instance, ref int __result)
162182
__result = card?.EnergyCost ?? CostProperties.OriginalEnergyCost(__instance);
163183
return false;
164184
}
185+
165186
[HarmonyPatch(typeof(PlayableCard), nameof(PlayableCard.EnergyCost), MethodType.Getter), HarmonyPrefix]
166187
public static bool DisableVanillaEnergyCost(PlayableCard __instance, ref int __result)
167188
{
168189
// patch this to follow the same pattern as the other cost methods
169190
int energyCost = CostProperties.OriginalEnergyCost(__instance.Info);
170-
if (__instance.IsUsingBlueGem())
191+
if (__instance.IsUsingBlueGem() && CostProperties.ReduceGemifiedEnergy(__instance, energyCost))
171192
energyCost--;
172193

173194
foreach (CardModificationInfo mod in __instance.TemporaryMods)

InscryptionCommunityPatch/InscryptionCommunityPatchPlugin.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public class PatchPlugin : BaseUnityPlugin
4444
internal static ConfigEntry<bool> configRemovePatches;
4545

4646
internal static ConfigEntry<bool> configSmallPricetags;
47+
internal static ConfigEntry<bool> configMovePricetags;
4748

4849
internal static ConfigEntry<bool> configTestState;
4950

@@ -93,6 +94,7 @@ private void Awake()
9394
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.");
9495
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).");
9596
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.");
97+
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.");
9698
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");
9799
act2TutorCenterRows = Config.Bind("Act 2", "Centred Hoarder UI", true, "If true, centres displayed cards in each row during the Hoarder selection sequence.");
98100
configFullDebug = Config.Bind("General", "Full Debug", true, "If true, displays all debug logs in the console.");

InscryptionCommunityPatch/Sequencers/BuyPeltsSmallTags.cs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,20 @@ internal class BuyPeltsSmallTags
1515
[HarmonyPostfix, HarmonyPatch(typeof(BuyPeltsSequencer), nameof(BuyPeltsSequencer.AddPricetagToCard))]
1616
private static void ReducePricetagSize(SelectableCard card)
1717
{
18-
if (!PatchPlugin.configSmallPricetags.Value)
19-
return;
20-
21-
Transform t = card.transform.Find("pricetag");
22-
if (t != null)
18+
if (PatchPlugin.configSmallPricetags.Value || PatchPlugin.configMovePricetags.Value)
2319
{
24-
t.localScale = new(0.75f, 1f, 0.75f);
20+
Transform t = card.transform.Find("pricetag");
21+
if (t == null)
22+
return;
23+
24+
if (PatchPlugin.configSmallPricetags.Value)
25+
{
26+
t.localScale = new(0.75f, 1f, 0.75f);
27+
}
28+
if (PatchPlugin.configMovePricetags.Value)
29+
{
30+
t.localPosition = new(t.localPosition.x * -1, t.localPosition.y, t.localPosition.z);
31+
}
2532
}
2633
}
2734
}

0 commit comments

Comments
 (0)