using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using DiskCardGame; using HarmonyLib; using InscryptionAPI.Card; using InscryptionAPI.Helpers; using OLD_SA.WolfJackal; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("OldSa_WolfAndJackal_sigil")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("OldSa_WolfAndJackal_sigil")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("52f11cb7-74f6-4ad0-8434-d2213aa3d57a")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] public static class WolfAndJackalActivatedAPI { public static bool HasWolfAndWarg(PlayableCard card) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)card == (Object)null) { return false; } foreach (Ability ability in ((Card)card).Info.Abilities) { if (ability == WolfAndJackalAPI.ability.Id) { return true; } } return false; } } namespace OLD_SA.WolfJackal; [BepInPlugin("OLD_SA.WolfJackal", "OLD SA WolfJackal", "1.0.0")] public class Plugin : BaseUnityPlugin { private void Awake() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown WolfAndJackalAPI.Init(); Harmony val = new Harmony("OLD_SA.WolfJackal"); val.PatchAll(); Debug.Log((object)"OLD SA WolfJackal Loaded"); } } [HarmonyPatch] public static class WolfAndJackalActivatedEffectPatch { private static bool Copying; private static IEnumerable TargetMethods() { Type[] types = typeof(ActivatedAbilityBehaviour).Assembly.GetTypes(); foreach (Type type in types) { if (type.IsSubclassOf(typeof(ActivatedAbilityBehaviour))) { MethodInfo method = type.GetMethod("Activate", BindingFlags.Instance | BindingFlags.NonPublic); if (method != null) { yield return method; } } } } [HarmonyPostfix] public static IEnumerator Postfix(IEnumerator result, ActivatedAbilityBehaviour __instance) { yield return result; if (Copying || (Object)(object)__instance == (Object)null) { yield break; } PlayableCard card = ((Component)__instance).GetComponent(); if (!((Object)(object)card == (Object)null) && WolfAndJackalTriggerAPI.HasWolfAndWarg(card)) { Copying = true; MethodInfo activate = ((object)__instance).GetType().GetMethod("Activate", BindingFlags.Instance | BindingFlags.NonPublic); if (activate != null && activate.Invoke(__instance, null) is IEnumerator second) { yield return second; } Copying = false; } } } public static class WolfAndJackalAPI { public static FullAbility ability; public unsafe static void Init() { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) AbilityInfo val = ScriptableObject.CreateInstance(); ((Object)val).name = "WolfAndWarg"; val.rulebookName = "Wolf and Warg"; val.metaCategories = new List { (AbilityMetaCategory)0 }; val.powerLevel = 5; val.opponentUsable = false; val.canStack = false; Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_WolfAndWarg.png", (FilterMode)0); FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { field.SetValue(val, "When another sigil on [creature] triggers, it triggers an additional time."); } ability = AbilityManager.Add("OLD_SA", val, typeof(WolfAndJackalBehaviour), imageAsTexture); Ability id = ability.Id; Debug.Log((object)("WolfAndWarg registered ID=" + ((object)(*(Ability*)(&id))/*cast due to .constrained prefix*/).ToString())); } } [HarmonyPatch(typeof(PlayableCard), "GetOpposingSlots")] public static class WolfAndJackalAttackPatch { private static Dictionary Processing = new Dictionary(); [HarmonyPostfix] public static void Postfix(PlayableCard __instance, ref List __result) { if ((Object)(object)__instance == (Object)null || !__instance.OnBoard || !HasWolf(__instance) || (Processing.ContainsKey(__instance) && Processing[__instance])) { return; } Processing[__instance] = true; List list = new List(); if (__instance.HasAbility((Ability)100)) { list.Add(__instance.Slot.opposingSlot); } if (__instance.HasAbility((Ability)24)) { foreach (CardSlot adjacentSlot in Singleton.Instance.GetAdjacentSlots(__instance.Slot.opposingSlot)) { list.Add(adjacentSlot); } } if (__instance.HasTriStrike()) { foreach (CardSlot adjacentSlot2 in Singleton.Instance.GetAdjacentSlots(__instance.Slot.opposingSlot)) { list.Add(adjacentSlot2); } if (!list.Contains(__instance.Slot.opposingSlot)) { list.Add(__instance.Slot.opposingSlot); } } foreach (CardSlot item in list) { if (!((Object)(object)item == (Object)null)) { __result.Add(item); } } Processing.Remove(__instance); } private static bool HasWolf(PlayableCard card) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)card == (Object)null) { return false; } foreach (Ability ability in ((Card)card).Info.Abilities) { if (ability == WolfAndJackalAPI.ability.Id) { return true; } } return false; } } public class WolfAndJackalBehaviour : AbilityBehaviour { public override Ability Ability => WolfAndJackalAPI.ability.Id; } [HarmonyPatch(typeof(PlayableCard), "GetPassiveAttackBuffs")] public static class WolfAndJackalPassiveBuffPatch { [HarmonyPostfix] public static void Postfix(PlayableCard __instance, ref int __result) { if ((Object)(object)__instance == (Object)null || !__instance.OnBoard) { return; } int num = 0; foreach (CardSlot adjacentSlot in Singleton.Instance.GetAdjacentSlots(__instance.Slot)) { if (!((Object)(object)adjacentSlot.Card == (Object)null) && adjacentSlot.Card.HasAbility((Ability)34) && WolfAndJackalTriggerAPI.HasWolfAndWarg(adjacentSlot.Card)) { num++; } } CardSlot opposingSlot = __instance.Slot.opposingSlot; if ((Object)(object)opposingSlot != (Object)null && (Object)(object)opposingSlot.Card != (Object)null) { PlayableCard card = opposingSlot.Card; if (card.HasAbility((Ability)76) && WolfAndJackalTriggerAPI.HasWolfAndWarg(card)) { num++; } if (card.HasAbility((Ability)83) && WolfAndJackalTriggerAPI.HasWolfAndWarg(card) && !__instance.HasAbility((Ability)105)) { num--; } } if (num != 0) { __result += num; } } } [HarmonyPatch(typeof(CardTriggerHandler), "OnTrigger")] public static class WolfAndJackalPatch { private static bool repeating; [HarmonyPostfix] public static IEnumerator Postfix(IEnumerator result, CardTriggerHandler __instance, Trigger trigger, object[] otherArgs) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) yield return result; if (repeating) { yield break; } PlayableCard card = ((Component)__instance).GetComponent(); if ((Object)(object)card == (Object)null || WolfAndJackalAPI.ability == null) { yield break; } AbilityBehaviour[] realAbilities = ((Component)card).GetComponents(); AbilityBehaviour[] array = realAbilities; for (int i = 0; i < array.Length; i++) { _ = array[i]; } bool hasWolfAndWarg = false; AbilityBehaviour[] array2 = realAbilities; foreach (AbilityBehaviour realAbility in array2) { if (realAbility.Ability == WolfAndJackalAPI.ability.Id) { hasWolfAndWarg = true; break; } } if (!hasWolfAndWarg || (int)trigger == 18) { yield break; } List receivers = GetReceivers(__instance); if (receivers == null) { yield break; } repeating = true; foreach (TriggerReceiver receiver in receivers) { if (!((Object)(object)receiver == (Object)null)) { AbilityBehaviour ability = (AbilityBehaviour)(object)((receiver is AbilityBehaviour) ? receiver : null); if (!((Object)(object)ability == (Object)null) && ability.Ability != WolfAndJackalAPI.ability.Id && GlobalTriggerHandler.ReceiverRespondsToTrigger(trigger, receiver, otherArgs)) { yield return Singleton.Instance.TriggerSequence(trigger, receiver, otherArgs); } } } repeating = false; } private static List GetReceivers(CardTriggerHandler handler) { MethodInfo method = typeof(CardTriggerHandler).GetMethod("GetAllReceivers", BindingFlags.Instance | BindingFlags.NonPublic); if (method == null) { return null; } return method.Invoke(handler, null) as List; } } public static class WolfAndJackalTriggerAPI { public static bool HasWolfAndWarg(PlayableCard card) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)card == (Object)null) { return false; } if (WolfAndJackalAPI.ability == null) { return false; } foreach (Ability ability in ((Card)card).Info.Abilities) { if (ability == WolfAndJackalAPI.ability.Id) { return true; } } return false; } public static int GetPassiveMultiplier(PlayableCard card) { return (!HasWolfAndWarg(card)) ? 1 : 2; } }