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 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_Cunning_sigil")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("OldSa_Cunning_sigil")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("8c1adbcf-028b-4655-bd78-77375f2d87d0")] [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")] namespace OLD_SA.Cunning; public static class CunningAPI { public static FullAbility ability; public unsafe static void Init() { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) AbilityInfo val = ScriptableObject.CreateInstance(); ((Object)val).name = "Cunning"; val.rulebookName = "Cunning"; val.metaCategories = new List { (AbilityMetaCategory)0, (AbilityMetaCategory)1 }; val.powerLevel = 2; val.opponentUsable = true; Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Cunning.png", (FilterMode)0); Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("OldSa_Cunning_px.png", (FilterMode)0); val.pixelIcon = Sprite.Create(imageAsTexture2, new Rect(0f, 0f, (float)((Texture)imageAsTexture2).width, (float)((Texture)imageAsTexture2).height), new Vector2(0.5f, 0.5f)); FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { field.SetValue(val, "When there is a creature opposite [creature], [creature] gains Power equal to the number of sigils on that creature."); } ability = AbilityManager.Add("OLD_SA", val, typeof(CunningBehaviour), imageAsTexture); Ability id = ability.Id; Debug.Log((object)("Cunning registered ID=" + ((object)(*(Ability*)(&id))/*cast due to .constrained prefix*/).ToString())); } } [HarmonyPatch(typeof(PlayableCard), "get_Attack")] public static class CunningAttackPatch { [HarmonyPostfix] public static void Postfix(PlayableCard __instance, ref int __result) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null || (Object)(object)((Card)__instance).Info == (Object)null || !__instance.HasAbility(CunningAPI.ability.Id) || (Object)(object)__instance.Slot == (Object)null || (Object)(object)__instance.Slot.opposingSlot == (Object)null) { return; } PlayableCard card = __instance.Slot.opposingSlot.Card; if (!((Object)(object)card == (Object)null)) { int sigilCount = GetSigilCount(card); if (sigilCount > 0) { __result += sigilCount; } } } private static int GetSigilCount(PlayableCard card) { int num = 0; if (((Card)card).Info.Abilities != null) { num += ((Card)card).Info.Abilities.Count; } if (card.TemporaryMods != null) { foreach (CardModificationInfo temporaryMod in card.TemporaryMods) { if (temporaryMod.abilities != null) { num += temporaryMod.abilities.Count; } } } return num; } } public class CunningBehaviour : AbilityBehaviour { public override Ability Ability => CunningAPI.ability.Id; } [BepInPlugin("OLD_SA.Cunning", "OLD SA Cunning", "1.0.0")] public class Plugin : BaseUnityPlugin { private void Awake() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown Debug.Log((object)"OLD SA Cunning Loading..."); CunningAPI.Init(); Harmony val = new Harmony("OLD_SA.Cunning"); val.PatchAll(); Debug.Log((object)"OLD SA Cunning Loaded!"); } }