Skip to content

Commit c5506ed

Browse files
Removed test code causing shields to persist forever
1 parent 6ec0d40 commit c5506ed

4 files changed

Lines changed: 14 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 2.23.1
2+
- Fixed non-CardModificationInfo shields not breaking
3+
14
# 2.23.0
25
- Added 'GBC Vanilla Render' config to community patches (false by default) - makes GBC cards render with vanilla cost sprites
36
- Added 'Vanilla Stacking' config to community patches (false by default) - renders cards with only two (stacking) sigils as they appear in vanilla, eg Spore Mice and Sporedigger

InscryptionAPI/Card/ShieldManager.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public static class ShieldManager
2626

2727
public static IEnumerator TriggerBreakShield(PlayableCard target, int damage, PlayableCard attacker)
2828
{
29+
InscryptionAPIPlugin.Logger.LogDebug("[TriggerBreakShield] Begin");
2930
BreakShield(target, damage, attacker);
3031

3132
List<IShieldPreventedDamage> shieldTriggers = CustomTriggerFinder.FindTriggersOnBoard<IShieldPreventedDamage>(false).ToList();
@@ -56,9 +57,11 @@ public static void BreakShield(PlayableCard target, int damage, PlayableCard att
5657
DamageShieldBehaviour shield = Array.Find(target.GetComponents<DamageShieldBehaviour>(), x => x.HasShields());
5758
if (shield != null)
5859
{
60+
InscryptionAPIPlugin.Logger.LogDebug("[BreakShield] Found DamageShieldBehaviour");
5961
CardModificationInfo info = target.TemporaryMods.Find(x => x.abilities != null && x.abilities.Contains(shield.Ability));
6062
if (info != null)
6163
{
64+
InscryptionAPIPlugin.Logger.LogDebug("[BreakShield] CardModInfo found for behaviour");
6265
target.RemoveTemporaryMod(info, false); // RemoveShields is called here in a patch
6366
info.abilities.Remove(shield.Ability);
6467
target.AddTemporaryMod(info);
@@ -71,6 +74,7 @@ public static void BreakShield(PlayableCard target, int damage, PlayableCard att
7174
target.Anim.StrongNegationEffect();
7275
if (target.GetTotalShields() == 0) // if we removed the last shield
7376
{
77+
InscryptionAPIPlugin.Logger.LogDebug("[BreakShield] TotalShields == 0");
7478
target.Status.lostShield = true;
7579
if (target.Info.HasBrokenShieldPortrait())
7680
target.SwitchToPortrait(target.Info.BrokenShieldPortrait());
@@ -95,7 +99,10 @@ private static bool PreventShieldReset(PlayableCard target)
9599
/// <summary>
96100
/// The new version of PlayableCard.HasShield implementing the new shield logic.
97101
/// </summary>
98-
public static bool NewHasShield(PlayableCard instance) => instance.GetTotalShields() > 0 && !instance.Status.lostShield;
102+
public static bool NewHasShield(PlayableCard instance)
103+
{
104+
return instance.GetTotalShields() > 0 && !instance.Status.lostShield;
105+
}
99106

100107
[HarmonyPostfix, HarmonyPatch(typeof(PlayableCard), nameof(PlayableCard.HasShield))]
101108
private static void ReplaceHasShieldBool(PlayableCard __instance, ref bool __result) => __result = NewHasShield(__instance);
@@ -247,7 +254,6 @@ private static void CorrectHiddenAbilityRender(PlayableCard card)
247254
{
248255
if (com.Ability.GetHideSingleStacks())
249256
{
250-
card.AddShieldCount(1, Ability.DeathShield);
251257
int shieldsLost = com.StartingNumShields - com.NumShields;
252258
if (card.Status.hiddenAbilities.Count(x => x == com.Ability) < shieldsLost)
253259
{

InscryptionAPI/InscryptionAPIPlugin.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class InscryptionAPIPlugin : BaseUnityPlugin
3030
{
3131
public const string ModGUID = "cyantist.inscryption.api";
3232
public const string ModName = "InscryptionAPI";
33-
public const string ModVer = "2.23.0";
33+
public const string ModVer = "2.23.1";
3434

3535
public static string Directory = "";
3636

InscryptionCommunityPatch/Card/StackAbilityIcons.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,13 +319,13 @@ private static void AddIconNumber(Ability ability, CardInfo info, PlayableCard c
319319
AbilityInfo ai = AbilityManager.AllAbilityInfos.AbilityByID(ability);
320320
if (card != null)
321321
{
322+
baseAbilities.AddRange(AbilitiesUtil.GetAbilitiesFromMods(card.TemporaryMods/*.Where(x => !x.fromTotem && (!x.fromCardMerge || PatchPlugin.configMergeOnBottom.Value)).ToList()*/));
322323
if (ai.IsShieldAbility())
323324
{
324325
count = card.GetShieldBehaviour(ability)?.NumShields;
325326
}
326327
else
327328
{
328-
baseAbilities.AddRange(AbilitiesUtil.GetAbilitiesFromMods(card.TemporaryMods/*.Where(x => !x.fromTotem && (!x.fromCardMerge || PatchPlugin.configMergeOnBottom.Value)).ToList()*/));
329329
if (ai.GetHideSingleStacks())
330330
{
331331
for (int i = 0; i < card.Status.hiddenAbilities.Count(x => x == ability); i++)
@@ -344,7 +344,7 @@ private static void AddIconNumber(Ability ability, CardInfo info, PlayableCard c
344344
if (count > 1) // we have a stack and need to add an override
345345
{
346346
if (PatchPlugin.doubleStackSplit.Value && count == 2 && count == baseAbilities.Count)
347-
__instance.SetIcon(__instance.LoadIcon(info, ai, card != null && card.OpponentCard));//RenderSameSigilTwice(__instance, ai, info, card);
347+
__instance.SetIcon(__instance.LoadIcon(info, ai, card != null && card.OpponentCard));
348348
else
349349
__instance.SetIcon(PatchTexture(ability, (int)count));
350350
}

0 commit comments

Comments
 (0)