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.Dialogue; 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_Retribution_sigil")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("OldSa_Retribution_sigil")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("40ac4f68-7b1a-43e3-8dc6-e8c2d15bec1b")] [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.Retribution; [BepInPlugin("OLD_SA.Retribution", "OLD SA Retribution", "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 RetributionAPI.Init(); Harmony val = new Harmony("OLD_SA.Retribution"); val.PatchAll(); Debug.Log((object)"OLD SA Retribution Loaded"); } } public static class RetributionAPI { public static FullAbility ability; public unsafe static void Init() { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) AbilityInfo val = ScriptableObject.CreateInstance(); ((Object)val).name = "Retribution"; val.rulebookName = "Retribution"; val.metaCategories = new List { (AbilityMetaCategory)0 }; val.powerLevel = 3; val.opponentUsable = false; Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Retribution.png", (FilterMode)0); Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("OldSa_Retribution_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 an enemy creature attacks the player, [creature] causes it to lose Power."); } ability = AbilityManager.Add("OLD_SA", val, typeof(RetributionBehaviour), imageAsTexture); Ability id = ability.Id; Debug.Log((object)("Retribution registered ID=" + ((object)(*(Ability*)(&id))/*cast due to .constrained prefix*/).ToString())); } } public class RetributionBehaviour : AbilityBehaviour { public override Ability Ability => RetributionAPI.ability.Id; public IEnumerator Trigger(PlayableCard attacker) { if (!((Object)(object)attacker == (Object)null)) { yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence(); yield return (object)new WaitForSeconds(0.4f); if ((Object)(object)((AbilityBehaviour)this).Card != (Object)null && (Object)(object)((AbilityBehaviour)this).Card.Slot != (Object)null && (Object)(object)attacker.Slot != (Object)null) { ((Card)((AbilityBehaviour)this).Card).Anim.PlayAttackAnimation(((AbilityBehaviour)this).Card.IsFlyingAttackingReach(), attacker.Slot, (Action)null); yield return (object)new WaitForSeconds(0f); ((Card)attacker).Anim.PlayHitAnimation(); yield return (object)new WaitForSeconds(0.2f); } CardModificationInfo debuff = new CardModificationInfo(); debuff.attackAdjustment = -1; attacker.AddTemporaryMod(debuff); ((Card)attacker).RenderCard(); yield return SigilDialogueAPI.ShowFirstTime("Retribution", "It makes all who commit violence pay the price."); } } } [HarmonyPatch(typeof(CombatPhaseManager), "SlotAttackSlot")] public static class RetributionPatch { public static IEnumerator Postfix(IEnumerator result, CardSlot attackingSlot, CardSlot opposingSlot) { int oldDamage = Singleton.Instance.DamageDealtThisPhase; while (result.MoveNext()) { yield return result.Current; } if ((Object)(object)attackingSlot == (Object)null || (Object)(object)opposingSlot == (Object)null || (Object)(object)attackingSlot.Card == (Object)null) { yield break; } PlayableCard attacker = attackingSlot.Card; int newDamage = Singleton.Instance.DamageDealtThisPhase; if (newDamage <= oldDamage) { yield break; } List targetSlots = ((!opposingSlot.IsPlayerSlot) ? Singleton.Instance.OpponentSlotsCopy : Singleton.Instance.PlayerSlotsCopy); foreach (CardSlot slot in targetSlots) { if (!((Object)(object)slot == (Object)null) && !((Object)(object)slot.Card == (Object)null) && slot.Card.HasAbility(RetributionAPI.ability.Id)) { RetributionBehaviour behaviour = ((Component)slot.Card).GetComponent(); if (!((Object)(object)behaviour == (Object)null)) { yield return (object)new WaitForSeconds(0.2f); yield return behaviour.Trigger(attacker); } } } } }