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 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_Gorebound_sigil")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("OldSa_Gorebound_sigil")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("16df888a-f3a1-42d4-8390-95bc5a89743f")] [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.Gorebound; public static class GoreboundAPI { public static FullAbility ability; public static void Init() { AbilityInfo val = ScriptableObject.CreateInstance(); ((Object)val).name = "Gorebound"; val.rulebookName = "Gorebound"; val.metaCategories = new List { (AbilityMetaCategory)0 }; val.powerLevel = 4; val.opponentUsable = false; Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Gorebound.png", (FilterMode)0); FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { field.SetValue(val, "When [creature] sacrifices another creature, it gains 1 Power and 1 Health for each tribe that sacrificed creature has."); } ability = AbilityManager.Add("OLD_SA", val, typeof(GoreboundBehaviour), imageAsTexture); } } public class GoreboundBehaviour : AbilityBehaviour { public override Ability Ability => GoreboundAPI.ability.Id; public IEnumerator OnOtherCreatureSacrificed(PlayableCard sacrificedCard) { if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead || !((AbilityBehaviour)this).Card.OnBoard || (Object)(object)sacrificedCard == (Object)null || (Object)(object)sacrificedCard == (Object)(object)((AbilityBehaviour)this).Card) { yield break; } yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence(); if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && !((AbilityBehaviour)this).Card.Dead && ((AbilityBehaviour)this).Card.OnBoard && !((Object)(object)sacrificedCard == (Object)null)) { int tribeCount = ((((Card)sacrificedCard).Info.tribes != null) ? ((Card)sacrificedCard).Info.tribes.Count : 0); if (tribeCount <= 0) { yield return ((AbilityBehaviour)this).LearnAbility(0f); yield break; } CardModificationInfo statMod = new CardModificationInfo(tribeCount, tribeCount); ((AbilityBehaviour)this).Card.AddTemporaryMod(statMod); ((Card)((AbilityBehaviour)this).Card).RenderCard(); yield return ((AbilityBehaviour)this).LearnAbility(0f); } } } [HarmonyPatch(typeof(PlayableCard), "Sacrifice")] public static class GoreboundSacrificePatch { public static void Prefix(PlayableCard __instance) { if ((Object)(object)__instance == (Object)null) { return; } PlayableCard currentSacrificeDemandingCard = Singleton.Instance.CurrentSacrificeDemandingCard; if (!((Object)(object)currentSacrificeDemandingCard == (Object)null) && !((Object)(object)currentSacrificeDemandingCard == (Object)(object)__instance)) { GoreboundBehaviour component = ((Component)currentSacrificeDemandingCard).GetComponent(); if (!((Object)(object)component == (Object)null)) { ((MonoBehaviour)currentSacrificeDemandingCard).StartCoroutine(TriggerGorebound(component, __instance)); } } } private static IEnumerator TriggerGorebound(GoreboundBehaviour behaviour, PlayableCard sacrificedCard) { if (!((Object)(object)behaviour == (Object)null)) { yield return behaviour.OnOtherCreatureSacrificed(sacrificedCard); } } } [BepInPlugin("OLD_SA.Gorebound", "OLD SA Gorebound", "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 GoreboundAPI.Init(); Harmony val = new Harmony("OLD_SA.Gorebound"); val.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[OLD SA] Gorebound loaded."); } }