Decompiled source of OLD SA DLC v0.3.5

Challenge/OldSa_Battle.dll

Decompiled 3 hours ago
using System;
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.Encounters;
using InscryptionAPI.Regions;
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_Battle")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Battle")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a79770a7-eb75-4467-a2c4-5ab71b61dbe0")]
[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.Battle;

public static class BattleAPI
{
	public static EncounterBlueprintData WolfPack;

	public static EncounterBlueprintData SwarmCrisis;

	public static void Init()
	{
		try
		{
			WolfPack = EncounterManager.New("OLD_SA_BATTLE_WOLF_PACK", true);
			EncounterExtensions.AddTurns<EncounterBlueprintData>(WolfPack, new List<CardBlueprint>[5]
			{
				EncounterManager.CreateTurn(new string[2] { "OLD_SA_WRAG", "Rabbit" }),
				EncounterManager.CreateTurn("WolfCub"),
				EncounterManager.CreateTurn("Mole"),
				EncounterManager.CreateTurn("OLD_SA_WRAG"),
				EncounterManager.CreateTurn("Alpha")
			});
			EncounterExtensions.AddDominantTribes<EncounterBlueprintData>(WolfPack, (Tribe[])(object)new Tribe[1] { (Tribe)3 });
			SwarmCrisis = EncounterManager.New("OLD_SA_BATTLE_SWARM_CRISIS", true);
			EncounterExtensions.AddTurns<EncounterBlueprintData>(SwarmCrisis, new List<CardBlueprint>[5]
			{
				EncounterManager.CreateTurn(new string[2] { "Bee", "OLD_SA_WHORLTOOTH_WORM" }),
				EncounterManager.CreateTurn("Bee"),
				EncounterManager.CreateTurn("OLD_SA_WASP"),
				EncounterManager.CreateTurn("OLD_SA_WHORLTOOTH_WORM"),
				EncounterManager.CreateTurn("Mole")
			});
			EncounterExtensions.AddDominantTribes<EncounterBlueprintData>(SwarmCrisis, (Tribe[])(object)new Tribe[1] { (Tribe)6 });
			RegionManager.ModifyRegionsList += AddEncountersToRegions;
			RegionManager.SyncRegionList();
		}
		catch (Exception ex)
		{
			Debug.LogError((object)"[OLD SA Battle] BattleAPI.Init() failed.");
			Debug.LogError((object)ex);
		}
	}

	private static List<RegionData> AddEncountersToRegions(List<RegionData> regions)
	{
		if (regions == null)
		{
			return regions;
		}
		RegionData val = regions.Find((RegionData x) => (Object)(object)x != (Object)null && ((Object)x).name == "Forest");
		if ((Object)(object)val != (Object)null)
		{
			if (val.encounters == null)
			{
				val.encounters = new List<EncounterBlueprintData>();
			}
			if (!val.encounters.Contains(WolfPack))
			{
				val.encounters.Add(WolfPack);
			}
		}
		RegionData val2 = regions.Find((RegionData x) => (Object)(object)x != (Object)null && ((Object)x).name == "Wetlands");
		if ((Object)(object)val2 != (Object)null)
		{
			if (val2.encounters == null)
			{
				val2.encounters = new List<EncounterBlueprintData>();
			}
			if (!val2.encounters.Contains(SwarmCrisis))
			{
				val2.encounters.Add(SwarmCrisis);
			}
		}
		return regions;
	}
}
[BepInPlugin("OLD_SA.Battle", "OLD SA Battle", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public static Plugin Instance;

	private void Awake()
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Expected O, but got Unknown
		Instance = this;
		BattleAPI.Init();
		Harmony val = new Harmony("OLD_SA.Battle");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"OLD SA Battle loaded.");
	}
}

Challenge/OldSa_Challenge.dll

Decompiled 3 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using DiskCardGame;
using GBC;
using HarmonyLib;
using InscryptionAPI.Ascension;
using InscryptionAPI.Helpers;
using InscryptionAPI.Slots;
using OLD_SA.Dialogue;
using OLD_SA.Incorporal;
using OLD_SA.Random;
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_Challenge")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Challenge")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7bddb5c6-b65b-44d7-8bf7-754e15af94f3")]
[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 OldSa_Challenge;

[HarmonyPatch(typeof(AscensionSaveData), "NewRun")]
public static class BadThingsChallengePatch
{
	private const string BrokenPeltName = "OLD_SA_BROKEN_PELT";

	[HarmonyPrefix]
	private static void Prefix(List<CardInfo> starterDeck)
	{
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		if (!SaveFile.IsAscension || starterDeck == null || starterDeck.Count == 0)
		{
			return;
		}
		int numChallengesOfTypeActive = AscensionSaveData.Data.GetNumChallengesOfTypeActive(ChallengeRegistry.BadThingsChallengeType);
		if (numChallengesOfTypeActive <= 0)
		{
			return;
		}
		CardInfo cardByName = CardLoader.GetCardByName("OLD_SA_BROKEN_PELT");
		if ((Object)(object)cardByName == (Object)null)
		{
			Plugin.Log.LogError((object)"[OldSa Challenge] Bad Things: Could not find card: OLD_SA_BROKEN_PELT");
			return;
		}
		List<CardInfo> list = starterDeck.Where((CardInfo card) => (Object)(object)card != (Object)null && !card.HasTrait((Trait)13) && ((Object)card).name != "OLD_SA_BROKEN_PELT").ToList();
		if (list.Count == 0)
		{
			Plugin.Log.LogWarning((object)"[OldSa Challenge] Bad Things: No valid starter cards found.");
			return;
		}
		int num = Math.Min(numChallengesOfTypeActive, list.Count);
		for (int num2 = 0; num2 < num; num2++)
		{
			int index = Random.Range(0, list.Count);
			CardInfo val = list[index];
			if (!((Object)(object)val == (Object)null))
			{
				int num3 = starterDeck.IndexOf(val);
				if (num3 >= 0)
				{
					starterDeck[num3] = cardByName;
					list.RemoveAt(index);
					Plugin.Log.LogInfo((object)("[OldSa Challenge] Bad Things: Replaced starter card " + (num2 + 1) + "/" + num + " (" + ((Object)val).name + ") with OLD_SA_BROKEN_PELT"));
				}
			}
		}
		if (numChallengesOfTypeActive > num)
		{
			Plugin.Log.LogWarning((object)("[OldSa Challenge] Bad Things: Challenge activated " + numChallengesOfTypeActive + " times, but only " + num + " valid starter cards were available."));
		}
	}
}
[HarmonyPatch(typeof(GainConsumablesSequencer), "ReplenishConsumables")]
public static class BrokenBackpackPatch
{
	private static readonly FieldInfo BackpackField = AccessTools.Field(typeof(GainConsumablesSequencer), "backpack");

	private static readonly MethodInfo FullConsumablesSequenceMethod = AccessTools.Method(typeof(GainConsumablesSequencer), "FullConsumablesSequence", (Type[])null, (Type[])null);

	private static readonly MethodInfo TutorialGainConsumablesMethod = AccessTools.Method(typeof(GainConsumablesSequencer), "TutorialGainConsumables", (Type[])null, (Type[])null);

	private static readonly MethodInfo RegularGainConsumablesMethod = AccessTools.Method(typeof(GainConsumablesSequencer), "RegularGainConsumables", (Type[])null, (Type[])null);

	[HarmonyPrefix]
	public static bool Prefix(GainConsumablesSequencer __instance, GainConsumablesNodeData nodeData, ref IEnumerator __result)
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)ChallengeRegistry.BrokenBagChallenge == (Object)null || AscensionSaveData.Data == null || !AscensionSaveData.Data.ChallengeIsActive(ChallengeRegistry.BrokenBagChallengeType))
		{
			return true;
		}
		__result = ReplenishConsumablesWithDialogue(__instance, nodeData);
		return false;
	}

	private static IEnumerator ReplenishConsumablesWithDialogue(GainConsumablesSequencer instance, GainConsumablesNodeData nodeData)
	{
		Singleton<ViewManager>.Instance.SwitchToView((View)1, false, true);
		yield return (object)new WaitForEndOfFrame();
		Singleton<ExplorableAreaManager>.Instance.SetHandLightRange(17f, 0.25f);
		Singleton<ExplorableAreaManager>.Instance.SetHangingLightRange(7f, 0.25f);
		GameObject backpack = GetBackpack(instance);
		if ((Object)(object)backpack != (Object)null)
		{
			backpack.SetActive(true);
		}
		yield return (object)new WaitForSeconds(0.25f);
		if ((Object)(object)Singleton<GameFlowManager>.Instance != (Object)null)
		{
			yield return (object)new WaitUntil((Func<bool>)(() => !Singleton<GameFlowManager>.Instance.Transitioning));
		}
		ChallengeActivationUI.TryShowActivation(ChallengeRegistry.BrokenBagChallengeType);
		yield return ChallengeDialogueManager.ShowFirstTime("Broken Bag", "Not much for you to choose from this time.");
		if (RunState.Run.consumables.Count == RunState.Run.MaxConsumables)
		{
			yield return InvokeCoroutine(FullConsumablesSequenceMethod, instance);
		}
		else if (!ProgressionData.LearnedMechanic((MechanicsConcept)33))
		{
			yield return InvokeCoroutine(TutorialGainConsumablesMethod, instance);
			ProgressionData.SetMechanicLearned((MechanicsConcept)33);
		}
		else
		{
			yield return InvokeCoroutine(RegularGainConsumablesMethod, instance, nodeData);
			ProgressionData.SetMechanicLearned((MechanicsConcept)34);
		}
		Singleton<ExplorableAreaManager>.Instance.ResetHandLightRange(0.25f);
		Singleton<ExplorableAreaManager>.Instance.ResetHangingLightRange(0.25f);
		if ((Object)(object)backpack != (Object)null)
		{
			Animator animator = backpack.GetComponentInChildren<Animator>();
			if ((Object)(object)animator != (Object)null)
			{
				animator.SetTrigger("exit");
			}
			CustomCoroutine.WaitThenExecute(0.25f, (Action)delegate
			{
				backpack.SetActive(false);
			}, false);
		}
		if ((Object)(object)Singleton<GameFlowManager>.Instance != (Object)null)
		{
			Singleton<GameFlowManager>.Instance.TransitionToGameState((GameState)1, (NodeData)null);
		}
	}

	private static GameObject GetBackpack(GainConsumablesSequencer instance)
	{
		if ((Object)(object)instance == (Object)null || BackpackField == null)
		{
			return null;
		}
		object? value = BackpackField.GetValue(instance);
		return (GameObject)((value is GameObject) ? value : null);
	}

	private static IEnumerator InvokeCoroutine(MethodInfo method, object instance, params object[] parameters)
	{
		if (method == null)
		{
			yield break;
		}
		object result = method.Invoke(instance, parameters);
		if (result is IEnumerator sequence)
		{
			while (sequence.MoveNext())
			{
				yield return sequence.Current;
			}
		}
	}
}
public static class BrokenBagPatch
{
	private static readonly HashSet<string> ForbiddenConsumables = new HashSet<string> { "Hourglass", "Scissors", "CuckooClock" };

	public static void Apply(Harmony harmony)
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Expected O, but got Unknown
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Expected O, but got Unknown
		//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Expected O, but got Unknown
		harmony.Patch((MethodBase)AccessTools.Method(typeof(GainConsumablesSequencer), "GenerateItemChoices", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(BrokenBagPatch), "GenerateItemChoices_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		harmony.Patch((MethodBase)AccessTools.Method(typeof(ItemsUtil), "GetRandomUnlockedConsumable", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(BrokenBagPatch), "GetRandomUnlockedConsumable_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		harmony.Patch((MethodBase)AccessTools.Method(typeof(BuyPeltsSequencer), "BuyPelts", (Type[])null, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(BrokenBagPatch), "BuyPelts_Transpiler", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null);
		harmony.Patch((MethodBase)AccessTools.Method(typeof(BuyPeltsSequencer), "OnPurchaseKnifePressed", (Type[])null, (Type[])null), new HarmonyMethod(typeof(BrokenBagPatch), "OnPurchaseKnifePressed_Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		Plugin.Log.LogInfo((object)"[OldSa Challenge] Broken Bag patches applied.");
	}

	private static bool IsBrokenBagActive()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		return AscensionSaveData.Data.ChallengeIsActive(ChallengeRegistry.BrokenBagChallengeType);
	}

	private static void GenerateItemChoices_Postfix(ref List<ConsumableItemData> __result, int randomSeed)
	{
		if (!IsBrokenBagActive() || __result == null)
		{
			return;
		}
		for (int i = 0; i < __result.Count; i++)
		{
			ConsumableItemData val = __result[i];
			if (!((Object)(object)val == (Object)null) && IsForbidden(((Object)val).name))
			{
				ConsumableItemData replacementConsumable = GetReplacementConsumable(randomSeed + i);
				if ((Object)(object)replacementConsumable != (Object)null)
				{
					__result[i] = replacementConsumable;
				}
			}
		}
	}

	private static void GetRandomUnlockedConsumable_Postfix(ref ConsumableItemData __result, int randomSeed)
	{
		if (IsBrokenBagActive() && !((Object)(object)__result == (Object)null) && IsForbidden(((Object)__result).name))
		{
			__result = GetReplacementConsumable(randomSeed);
		}
	}

	private static ConsumableItemData GetReplacementConsumable(int randomSeed)
	{
		List<ConsumableItemData> unlockedConsumables = ItemsUtil.GetUnlockedConsumables();
		unlockedConsumables.RemoveAll((ConsumableItemData item) => (Object)(object)item == (Object)null || item.notRandomlyGiven || IsForbidden(((Object)item).name));
		if (unlockedConsumables.Count == 0)
		{
			return ItemsUtil.GetConsumableByName("SquirrelBottle");
		}
		int index = SeededRandom.Range(0, unlockedConsumables.Count, randomSeed);
		return unlockedConsumables[index];
	}

	private static bool IsForbidden(string itemName)
	{
		return !string.IsNullOrEmpty(itemName) && ForbiddenConsumables.Contains(itemName);
	}

	private static IEnumerable<CodeInstruction> BuyPelts_Transpiler(IEnumerable<CodeInstruction> instructions)
	{
		//IL_013f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: Expected O, but got Unknown
		//IL_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0165: Expected O, but got Unknown
		List<CodeInstruction> list = new List<CodeInstruction>(instructions);
		FieldInfo fieldInfo = AccessTools.Field(typeof(RunState), "trapperKnifeBought");
		MethodInfo methodInfo = AccessTools.Method(typeof(BrokenBagPatch), "IsBrokenBagActive", (Type[])null, (Type[])null);
		if (fieldInfo == null)
		{
			Plugin.Log.LogError((object)"[OldSa Challenge] Could not find RunState.trapperKnifeBought.");
			return list;
		}
		if (methodInfo == null)
		{
			Plugin.Log.LogError((object)"[OldSa Challenge] Could not find IsBrokenBagActive.");
			return list;
		}
		for (int i = 0; i < list.Count - 1; i++)
		{
			if (!(list[i].opcode != OpCodes.Ldfld) && list[i].operand is FieldInfo fieldInfo2 && !(fieldInfo2 != fieldInfo) && IsBrtrue(list[i + 1].opcode) && list[i + 1].operand is Label label)
			{
				list.Insert(i + 2, new CodeInstruction(OpCodes.Call, (object)methodInfo));
				list.Insert(i + 3, new CodeInstruction(OpCodes.Brtrue, (object)label));
				Plugin.Log.LogInfo((object)"[OldSa Challenge] Trapper Knife purchase option disabled.");
				return list;
			}
		}
		Plugin.Log.LogWarning((object)"[OldSa Challenge] Could not locate trapperKnifeBought check in BuyPelts().");
		return list;
	}

	private static bool IsBrtrue(OpCode opcode)
	{
		return opcode == OpCodes.Brtrue || opcode == OpCodes.Brtrue_S;
	}

	private static bool OnPurchaseKnifePressed_Prefix()
	{
		if (!IsBrokenBagActive())
		{
			return true;
		}
		Plugin.Log.LogInfo((object)"[OldSa Challenge] Broken Bag prevented Trapper Knife purchase.");
		return false;
	}
}
public static class BrokenStartPatch
{
	[HarmonyPatch(typeof(AscensionSaveData), "NewRun", new Type[] { typeof(List<CardInfo>) })]
	private static class NewRunPatch
	{
		[HarmonyPrefix]
		private static void Prefix(AscensionSaveData __instance)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			remainingReplacements = 0;
			if (__instance != null && SaveFile.IsAscension)
			{
				int numChallengesOfTypeActive = __instance.GetNumChallengesOfTypeActive(ChallengeRegistry.BrokenStartChallengeType);
				if (numChallengesOfTypeActive > 0)
				{
					remainingReplacements = numChallengesOfTypeActive;
					Plugin.Log.LogInfo((object)("[OldSa Challenge] Broken Start: Starting pelt replacement enabled. Remaining replacements = " + remainingReplacements));
				}
			}
		}

		[HarmonyPostfix]
		private static void Postfix()
		{
			if (remainingReplacements > 0)
			{
				Plugin.Log.LogInfo((object)("[OldSa Challenge] Broken Start: NewRun finished with " + remainingReplacements + " replacement(s) unused."));
			}
			remainingReplacements = 0;
			Plugin.Log.LogInfo((object)"[OldSa Challenge] Broken Start: Starting pelt replacement disabled.");
		}
	}

	[HarmonyPatch(typeof(CardLoader), "GetCardByName", new Type[] { typeof(string) })]
	private static class GetCardByNamePatch
	{
		[HarmonyPrefix]
		private static bool Prefix(ref string name)
		{
			if (remainingReplacements <= 0)
			{
				return true;
			}
			if (name != "PeltHare")
			{
				return true;
			}
			Plugin.Log.LogInfo((object)("[OldSa Challenge] Broken Start: Intercepted PeltHare -> OLD_SA_BROKEN_PELT (" + remainingReplacements + " replacement(s) before this one)"));
			name = "OLD_SA_BROKEN_PELT";
			remainingReplacements--;
			return true;
		}
	}

	private const string BrokenPeltName = "OLD_SA_BROKEN_PELT";

	private static int remainingReplacements;
}
public static class ChallengeIncompatibilities
{
	public static void RegisterAll()
	{
		RegisterMutual(ChallengeRegistry.ElephantModeChallenge, (AscensionChallenge)13);
		RegisterMutual(ChallengeRegistry.BadThingsChallenge, ChallengeRegistry.DizzyStartersChallenge);
		RegisterMutual(ChallengeRegistry.BadThingsChallenge, (AscensionChallenge)9);
	}

	private static void RegisterMutual(AscensionChallengeInfo customChallenge, AscensionChallenge vanillaChallenge)
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Expected I4, but got Unknown
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Expected I4, but got Unknown
		if (!((Object)(object)customChallenge == (Object)null))
		{
			ChallengeManager.GetFullChallenge(customChallenge).SetIncompatibleChallengeGetterStatic((AscensionChallenge[])(object)new AscensionChallenge[1] { (AscensionChallenge)(int)vanillaChallenge });
			ChallengeManager.GetFullChallenge(vanillaChallenge).SetIncompatibleChallengeGetterStatic((AscensionChallenge[])(object)new AscensionChallenge[1] { (AscensionChallenge)(int)customChallenge.challengeType });
		}
	}

	private static void RegisterMutual(AscensionChallengeInfo first, AscensionChallengeInfo second)
	{
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Expected I4, but got Unknown
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Expected I4, but got Unknown
		if (!((Object)(object)first == (Object)null) && !((Object)(object)second == (Object)null))
		{
			ChallengeManager.GetFullChallenge(first).SetIncompatibleChallengeGetterStatic((AscensionChallenge[])(object)new AscensionChallenge[1] { (AscensionChallenge)(int)second.challengeType });
			ChallengeManager.GetFullChallenge(second).SetIncompatibleChallengeGetterStatic((AscensionChallenge[])(object)new AscensionChallenge[1] { (AscensionChallenge)(int)first.challengeType });
		}
	}
}
public static class ChallengeDialogueAPI
{
	public static IEnumerator ShowFirstTime(string challengeName, string dialogue)
	{
		if (!string.IsNullOrEmpty(challengeName) && !string.IsNullOrEmpty(dialogue) && !ChallengeDialogueSaveData.HasTriggered(challengeName))
		{
			ChallengeDialogueSaveData.AddTriggered(challengeName);
			OLD_SA_SaveManager.Save();
			TextDisplayer textDisplayer = Singleton<TextDisplayer>.Instance;
			if (!((Object)(object)textDisplayer == (Object)null))
			{
				yield return textDisplayer.ShowUntilInput(dialogue, -2.5f, 0.5f, (Emotion)0, (LetterAnimation)0, (Speaker)0, (string[])null, true);
			}
		}
	}
}
public static class ChallengeDialogueConfig
{
	public const string NoGrowthDialogue = "NoGrowthChallenge";

	public const string NoWoodcarverDialogue = "NoWoodcarverChallenge";

	public const string DizzyStartersDialogue = "DizzyStartersChallenge";

	public const string DoubleTrialDialogue = "DoubleTrialChallenge";

	public const string BrokenStartDialogue = "BrokenStartChallenge";

	public const string BadThingsDialogue = "BadThingsChallenge";

	public const string ElephantModeDialogue = "ElephantModeChallenge";

	public const string BrokenBagDialogue = "BrokenBagChallenge";

	public const string NeverStarvationDialogue = "NeverStarvationChallenge";

	public const string GhostForestDialogue = "GhostForestChallenge";
}
public static class ChallengeDialogueManager
{
	public static IEnumerator ShowFirstTime(string challengeName, string dialogue)
	{
		if (string.IsNullOrEmpty(challengeName) || string.IsNullOrEmpty(dialogue) || ChallengeDialogueSaveData.HasTriggered(challengeName))
		{
			yield break;
		}
		ChallengeDialogueSaveData.AddTriggered(challengeName);
		OLD_SA_SaveManager.Save();
		if ((Object)(object)Singleton<ViewManager>.Instance != (Object)null)
		{
			Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)1;
		}
		if ((Object)(object)Singleton<PlayerHand>.Instance != (Object)null)
		{
			Singleton<PlayerHand>.Instance.PlayingLocked = true;
		}
		try
		{
			if ((Object)(object)Singleton<TextDisplayer>.Instance != (Object)null)
			{
				yield return Singleton<TextDisplayer>.Instance.ShowUntilInput(dialogue, -2.5f, 0.5f, (Emotion)0, (LetterAnimation)0, (Speaker)0, (string[])null, true);
			}
		}
		finally
		{
			if ((Object)(object)Singleton<PlayerHand>.Instance != (Object)null)
			{
				Singleton<PlayerHand>.Instance.PlayingLocked = false;
			}
			if ((Object)(object)Singleton<ViewManager>.Instance != (Object)null)
			{
				Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
			}
		}
	}
}
public static class ChallengeDialogueSaveData
{
	private static readonly HashSet<string> TriggeredChallenges = new HashSet<string>();

	public static bool HasTriggered(string challengeName)
	{
		if (string.IsNullOrEmpty(challengeName))
		{
			return false;
		}
		return TriggeredChallenges.Contains(challengeName);
	}

	public static void AddTriggered(string challengeName)
	{
		if (!string.IsNullOrEmpty(challengeName))
		{
			TriggeredChallenges.Add(challengeName);
		}
	}

	public static List<string> GetSaveList()
	{
		return new List<string>(TriggeredChallenges);
	}

	public static void LoadFromList(List<string> list)
	{
		TriggeredChallenges.Clear();
		if (list == null)
		{
			return;
		}
		foreach (string item in list)
		{
			if (!string.IsNullOrEmpty(item))
			{
				TriggeredChallenges.Add(item);
			}
		}
	}
}
public static class ChallengeRegistry
{
	public static AscensionChallengeInfo NoGrowthChallenge;

	public const string NoGrowthName = "No Growth";

	public const string NoGrowthDescription = "Fledgling sigils no longer evolve. They only grant +1 Power and +1 Health.";

	public static AscensionChallengeInfo NoWoodcarverChallenge;

	public const string NoWoodcarverName = "No Woodcarver";

	public const string NoWoodcarverDescription = "You will no longer encounter Woodcarver choice nodes.";

	public static AscensionChallengeInfo DizzyStartersChallenge;

	public const string DizzyStartersName = "Dizzy Starters";

	public const string DizzyStartersDescription = "All creatures in your starting deck gain the Random sigil.";

	public static AscensionChallengeInfo DoubleTrialChallenge;

	public const string DoubleTrialName = "Double Trial";

	public const string DoubleTrialDescription = "All Totem battles in this run have bases with the Double Strike sigil.";

	public static AscensionChallengeInfo BrokenStartChallenge;

	public const string BrokenStartName = "Broken Start";

	public const string BrokenStartDescription = "One of your starting pelts is replaced with a Broken Pelt.";

	public static AscensionChallengeInfo BadThingsChallenge;

	public const string BadThingsName = "Bad Things";

	public const string BadThingsDescription = "One of your starting creatures is replaced with a Broken Pelt.";

	public static AscensionChallengeInfo ElephantModeChallenge;

	public const string ElephantModeName = "Elephant Bosses";

	public const string ElephantModeDescription = "On the second turn, the Boss will fill the board with Elephants.";

	public static AscensionChallengeInfo BrokenBagChallenge;

	public const string BrokenBagName = "Broken Bag";

	public const string BrokenBagDescription = "You will not encounter the Hourglass, Skinning Knife, Scissors, or CuckooClock.";

	public static AscensionChallengeInfo NeverStarvationChallenge;

	public const string NeverStarvationName = "Never Starvation";

	public const string NeverStarvationDescription = "You will never encounter starvation, even when there are no cards left to draw.";

	public static AscensionChallengeInfo GhostForestChallenge;

	public const string GhostForestName = "Ghost Forest";

	public const string GhostForestDescription = "One of your squares will turn into the Netherworld.";

	public static AscensionChallenge NoGrowthChallengeType => (AscensionChallenge)(((Object)(object)NoGrowthChallenge != (Object)null) ? ((int)NoGrowthChallenge.challengeType) : 0);

	public static AscensionChallenge NoWoodcarverChallengeType => (AscensionChallenge)(((Object)(object)NoWoodcarverChallenge != (Object)null) ? ((int)NoWoodcarverChallenge.challengeType) : 0);

	public static AscensionChallenge DizzyStartersChallengeType => (AscensionChallenge)(((Object)(object)DizzyStartersChallenge != (Object)null) ? ((int)DizzyStartersChallenge.challengeType) : 0);

	public static AscensionChallenge DoubleTrialChallengeType => (AscensionChallenge)(((Object)(object)DoubleTrialChallenge != (Object)null) ? ((int)DoubleTrialChallenge.challengeType) : 0);

	public static AscensionChallenge BrokenStartChallengeType => (AscensionChallenge)(((Object)(object)BrokenStartChallenge != (Object)null) ? ((int)BrokenStartChallenge.challengeType) : 0);

	public static AscensionChallenge BadThingsChallengeType => (AscensionChallenge)(((Object)(object)BadThingsChallenge != (Object)null) ? ((int)BadThingsChallenge.challengeType) : 0);

	public static AscensionChallenge ElephantModeChallengeType => (AscensionChallenge)(((Object)(object)ElephantModeChallenge != (Object)null) ? ((int)ElephantModeChallenge.challengeType) : 0);

	public static AscensionChallenge BrokenBagChallengeType => (AscensionChallenge)(((Object)(object)BrokenBagChallenge != (Object)null) ? ((int)BrokenBagChallenge.challengeType) : 0);

	public static AscensionChallenge NeverStarvationChallengeType => (AscensionChallenge)(((Object)(object)NeverStarvationChallenge != (Object)null) ? ((int)NeverStarvationChallenge.challengeType) : 0);

	public static AscensionChallenge GhostForestChallengeType => (AscensionChallenge)(((Object)(object)GhostForestChallenge != (Object)null) ? ((int)GhostForestChallenge.challengeType) : 0);

	public static void Register()
	{
		Plugin.Log.LogInfo((object)"[OldSa Challenge] Registering challenges...");
		NoGrowthChallenge = FullChallenge.op_Implicit(ChallengeManager.Add("OLD_SA.Challenge", "No Growth", "Fledgling sigils no longer evolve. They only grant +1 Power and +1 Health.", 30, TextureHelper.GetImageAsTexture("NoGrowth.png", (FilterMode)0), TextureHelper.GetImageAsTexture("NoGrowth_Activated.png", (FilterMode)0), 0, false));
		Plugin.Log.LogInfo((object)("[OldSa Challenge] Registered: No Growth | ID: " + ((object)Unsafe.As<AscensionChallenge, AscensionChallenge>(ref NoGrowthChallenge.challengeType)/*cast due to .constrained prefix*/).ToString()));
		NoWoodcarverChallenge = FullChallenge.op_Implicit(ChallengeManager.Add("OLD_SA.Challenge", "No Woodcarver", "You will no longer encounter Woodcarver choice nodes.", 30, TextureHelper.GetImageAsTexture("NoWoodcarver.png", (FilterMode)0), TextureHelper.GetImageAsTexture("NoWoodcarver_Activated.png", (FilterMode)0), 0, false));
		Plugin.Log.LogInfo((object)("[OldSa Challenge] Registered: No Woodcarver | ID: " + ((object)Unsafe.As<AscensionChallenge, AscensionChallenge>(ref NoWoodcarverChallenge.challengeType)/*cast due to .constrained prefix*/).ToString()));
		DizzyStartersChallenge = FullChallenge.op_Implicit(ChallengeManager.Add("OLD_SA.Challenge", "Dizzy Starters", "All creatures in your starting deck gain the Random sigil.", 30, TextureHelper.GetImageAsTexture("DizzyStarters.png", (FilterMode)0), TextureHelper.GetImageAsTexture("DizzyStarters_Activated.png", (FilterMode)0), 0, false));
		Plugin.Log.LogInfo((object)("[OldSa Challenge] Registered: Dizzy Starters | ID: " + ((object)Unsafe.As<AscensionChallenge, AscensionChallenge>(ref DizzyStartersChallenge.challengeType)/*cast due to .constrained prefix*/).ToString()));
		DoubleTrialChallenge = FullChallenge.op_Implicit(ChallengeManager.Add("OLD_SA.Challenge", "Double Trial", "All Totem battles in this run have bases with the Double Strike sigil.", 100, TextureHelper.GetImageAsTexture("DoubleTrial.png", (FilterMode)0), TextureHelper.GetImageAsTexture("DoubleTrial_Activated.png", (FilterMode)0), 0, false));
		Plugin.Log.LogInfo((object)("[OldSa Challenge] Registered: Double Trial | ID: " + ((object)Unsafe.As<AscensionChallenge, AscensionChallenge>(ref DoubleTrialChallenge.challengeType)/*cast due to .constrained prefix*/).ToString()));
		BrokenStartChallenge = FullChallenge.op_Implicit(ChallengeManager.AddSpecific("OLD_SA.Challenge", "Broken Start", "One of your starting pelts is replaced with a Broken Pelt.", 15, TextureHelper.GetImageAsTexture("BrokenStart.png", (FilterMode)0), TextureHelper.GetImageAsTexture("BrokenStart_Activated.png", (FilterMode)0), (Type)null, 0, (List<object>)null, (Func<FullChallenge[], IEnumerable<AscensionChallenge>>)null, (Func<FullChallenge[], IEnumerable<AscensionChallenge>>)null, 2));
		Plugin.Log.LogInfo((object)("[OldSa Challenge] Registered: Broken Start | ID: " + ((object)Unsafe.As<AscensionChallenge, AscensionChallenge>(ref BrokenStartChallenge.challengeType)/*cast due to .constrained prefix*/).ToString() + " | Appearances: 2"));
		BadThingsChallenge = FullChallenge.op_Implicit(ChallengeManager.AddSpecific("OLD_SA.Challenge", "Bad Things", "One of your starting creatures is replaced with a Broken Pelt.", 20, TextureHelper.GetImageAsTexture("BadThings.png", (FilterMode)0), TextureHelper.GetImageAsTexture("BadThings_Activated.png", (FilterMode)0), (Type)null, 0, (List<object>)null, (Func<FullChallenge[], IEnumerable<AscensionChallenge>>)null, (Func<FullChallenge[], IEnumerable<AscensionChallenge>>)null, 3));
		Plugin.Log.LogInfo((object)("[OldSa Challenge] Registered: Bad Things | ID: " + ((object)Unsafe.As<AscensionChallenge, AscensionChallenge>(ref BadThingsChallenge.challengeType)/*cast due to .constrained prefix*/).ToString() + " | Appearances: 3"));
		ElephantModeChallenge = FullChallenge.op_Implicit(ChallengeManager.AddSpecific("OLD_SA.Challenge", "Elephant Bosses", "On the second turn, the Boss will fill the board with Elephants.", 50, TextureHelper.GetImageAsTexture("ElephantMode.png", (FilterMode)0), TextureHelper.GetImageAsTexture("ElephantMode_Activated.png", (FilterMode)0), (Type)null, 0, (List<object>)null, (Func<FullChallenge[], IEnumerable<AscensionChallenge>>)null, (Func<FullChallenge[], IEnumerable<AscensionChallenge>>)null, 1));
		Plugin.Log.LogInfo((object)("[OldSa Challenge] Registered: Elephant Bosses | ID: " + ((object)Unsafe.As<AscensionChallenge, AscensionChallenge>(ref ElephantModeChallenge.challengeType)/*cast due to .constrained prefix*/).ToString() + " | Appearances: 1"));
		BrokenBagChallenge = FullChallenge.op_Implicit(ChallengeManager.AddSpecific("OLD_SA.Challenge", "Broken Bag", "You will not encounter the Hourglass, Skinning Knife, Scissors, or CuckooClock.", 50, TextureHelper.GetImageAsTexture("BrokenBag.png", (FilterMode)0), TextureHelper.GetImageAsTexture("BrokenBag_Activated.png", (FilterMode)0), (Type)null, 0, (List<object>)null, (Func<FullChallenge[], IEnumerable<AscensionChallenge>>)null, (Func<FullChallenge[], IEnumerable<AscensionChallenge>>)null, 1));
		Plugin.Log.LogInfo((object)("[OldSa Challenge] Registered: Broken Bag | ID: " + ((object)Unsafe.As<AscensionChallenge, AscensionChallenge>(ref BrokenBagChallenge.challengeType)/*cast due to .constrained prefix*/).ToString() + " | Appearances: 1"));
		NeverStarvationChallenge = FullChallenge.op_Implicit(ChallengeManager.AddSpecific("OLD_SA.Challenge", "Never Starvation", "You will never encounter starvation, even when there are no cards left to draw.", -15, TextureHelper.GetImageAsTexture("NeverStarvation.png", (FilterMode)0), TextureHelper.GetImageAsTexture("NeverStarvation_Activated.png", (FilterMode)0), (Type)null, 0, (List<object>)null, (Func<FullChallenge[], IEnumerable<AscensionChallenge>>)null, (Func<FullChallenge[], IEnumerable<AscensionChallenge>>)null, 1));
		Plugin.Log.LogInfo((object)("[OldSa Challenge] Registered: Never Starvation | ID: " + ((object)Unsafe.As<AscensionChallenge, AscensionChallenge>(ref NeverStarvationChallenge.challengeType)/*cast due to .constrained prefix*/).ToString() + " | Appearances: 1"));
		GhostForestChallenge = FullChallenge.op_Implicit(ChallengeManager.AddSpecific("OLD_SA.Challenge", "Ghost Forest", "One of your squares will turn into the Netherworld.", 15, TextureHelper.GetImageAsTexture("GhostForest.png", (FilterMode)0), TextureHelper.GetImageAsTexture("GhostForest_Activated.png", (FilterMode)0), (Type)null, 0, (List<object>)null, (Func<FullChallenge[], IEnumerable<AscensionChallenge>>)null, (Func<FullChallenge[], IEnumerable<AscensionChallenge>>)null, 4));
		Plugin.Log.LogInfo((object)("[OldSa Challenge] Registered: Ghost Forest | ID: " + ((object)Unsafe.As<AscensionChallenge, AscensionChallenge>(ref GhostForestChallenge.challengeType)/*cast due to .constrained prefix*/).ToString() + " | Appearances: 4"));
		Plugin.Log.LogInfo((object)"[OldSa Challenge] All challenges registered.");
		ChallengeIncompatibilities.RegisterAll();
	}
}
[HarmonyPatch]
public static class ChallengeIntroDialoguePatch
{
	internal static bool InRunIntro;

	internal static bool IntroDeckShown;

	[HarmonyPatch(typeof(RunIntroSequencer), "RunIntroSequence")]
	[HarmonyPrefix]
	private static void RunIntroPrefix()
	{
		InRunIntro = true;
		IntroDeckShown = false;
	}

	[HarmonyPatch(typeof(RunIntroSequencer), "RunIntroSequence")]
	[HarmonyPostfix]
	private static void RunIntroPostfix(ref IEnumerator __result)
	{
		if (__result == null)
		{
			InRunIntro = false;
		}
		else
		{
			__result = WrapRunIntro(__result);
		}
	}

	private static IEnumerator WrapRunIntro(IEnumerator original)
	{
		while (original.MoveNext())
		{
			yield return original.Current;
		}
		InRunIntro = false;
	}

	[HarmonyPatch(typeof(DeckReviewSequencer), "SetDeckReviewShown", new Type[]
	{
		typeof(bool),
		typeof(Transform),
		typeof(Vector3),
		typeof(bool),
		typeof(bool)
	})]
	[HarmonyPostfix]
	private static void SetDeckReviewShownPostfix(DeckReviewSequencer __instance, bool shown)
	{
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		if (shown && InRunIntro && SaveFile.IsAscension && !IntroDeckShown)
		{
			IntroDeckShown = true;
			bool flag = IsChallengeActive(ChallengeRegistry.BadThingsChallengeType);
			bool flag2 = IsChallengeActive(ChallengeRegistry.BrokenStartChallengeType);
			bool flag3 = IsChallengeActive(ChallengeRegistry.DizzyStartersChallengeType);
			if ((flag || flag2 || flag3) && !((Object)(object)__instance == (Object)null))
			{
				((MonoBehaviour)__instance).StartCoroutine(ShowIntroDialogues(flag, flag2, flag3));
			}
		}
	}

	private static bool IsChallengeActive(AscensionChallenge challenge)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		if (AscensionSaveData.Data == null)
		{
			return false;
		}
		return AscensionSaveData.Data.ChallengeIsActive(challenge);
	}

	private static IEnumerator ShowIntroDialogues(bool badThings, bool brokenStart, bool dizzyStarters)
	{
		yield return (object)new WaitForSeconds(0.3f);
		if (badThings)
		{
			yield return ChallengeDialogueManager.ShowFirstTime("Bad Things", "Your creature has left you.I kept this for you.");
		}
		if (brokenStart)
		{
			yield return ChallengeDialogueManager.ShowFirstTime("Broken Start", "Sorry,I don't have anything better.Good luck.");
		}
		if (dizzyStarters)
		{
			yield return ChallengeDialogueManager.ShowFirstTime("Dizzy Starters", "They have all lost their sense of direction.");
		}
	}
}
[HarmonyPatch(typeof(AscensionSaveData), "NewRun")]
public static class DizzyStartersPatch
{
	[HarmonyPostfix]
	public static void Postfix(AscensionSaveData __instance)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Invalid comparison between Unknown and I4
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Expected O, but got Unknown
		if (!__instance.ChallengeIsActive(ChallengeRegistry.DizzyStartersChallengeType) || __instance.currentRun == null || __instance.currentRun.playerDeck == null)
		{
			return;
		}
		Ability randomAbility = RandomAPI.RandomAbility;
		if ((int)randomAbility == 0)
		{
			Plugin.Log.LogError((object)"[OldSa Challenge] Dizzy Starters: Random ability is invalid.");
			return;
		}
		foreach (CardInfo card in ((CardCollectionInfo)__instance.currentRun.playerDeck).Cards)
		{
			if (!((Object)(object)card == (Object)null) && !card.HasTrait((Trait)13) && !card.HasAbility(randomAbility))
			{
				CardModificationInfo val = new CardModificationInfo(randomAbility);
				__instance.currentRun.playerDeck.ModifyCard(card, val);
				Plugin.Log.LogInfo((object)("[OldSa Challenge] Dizzy Starters: Added Random to " + ((Object)card).name));
			}
		}
	}
}
[HarmonyPatch(typeof(TotemsUtil), "AssignAbilityToBottom")]
public static class DoubleTrialPatch
{
	[HarmonyPostfix]
	public static void Postfix(TotemBottomData bottom)
	{
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)bottom == (Object)null) && bottom.effectParams != null)
		{
			AscensionSaveData data = AscensionSaveData.Data;
			if (data != null && data.ChallengeIsActive(ChallengeRegistry.DoubleTrialChallengeType))
			{
				bottom.effectParams.ability = (Ability)100;
				Plugin.Log.LogInfo((object)"[OldSa Challenge] Double Trial: Totem bottom ability changed to Double Strike.");
			}
		}
	}
}
[HarmonyPatch]
public static class ElephantGrizzlyPhasePatch
{
	private static MethodBase TargetMethod()
	{
		MethodInfo method = typeof(Part1BossOpponent).GetMethod("HasGrizzlyGlitchPhase", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
		if (method == null)
		{
			Plugin.Log.LogError((object)"[OLD SA Elephant] HasGrizzlyGlitchPhase NOT FOUND!");
			return null;
		}
		Plugin.Log.LogInfo((object)("[OLD SA Elephant] Found HasGrizzlyGlitchPhase: " + method));
		return method;
	}

	[HarmonyPostfix]
	private static void HasGrizzlyGlitchPhasePostfix(ref bool __result)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		if (AscensionSaveData.Data != null)
		{
			bool flag = AscensionSaveData.Data.ChallengeIsActive(ChallengeRegistry.ElephantModeChallengeType);
			Plugin.Log.LogInfo((object)("[OLD SA Elephant] HasGrizzlyGlitchPhase result = " + __result + ", Elephant Mode = " + flag));
			if (flag)
			{
				Plugin.Log.LogInfo((object)"[OLD SA Elephant] Forcing Grizzly glitch phase.");
				__result = true;
			}
		}
	}
}
[HarmonyPatch]
public static class ElephantBearGlitchPatch
{
	private static MethodBase TargetMethod()
	{
		MethodInfo method = typeof(Tutorial4BattleSequencer).GetMethod("BearGlitchSequence", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
		if (method == null)
		{
			Plugin.Log.LogError((object)"[OLD SA Elephant] BearGlitchSequence NOT FOUND!");
			return null;
		}
		Plugin.Log.LogInfo((object)("[OLD SA Elephant] Found BearGlitchSequence: " + method));
		return method;
	}

	[HarmonyPrefix]
	private static bool BearGlitchSequencePrefix(ref IEnumerator __result)
	{
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		Plugin.Log.LogInfo((object)"[OLD SA Elephant] BearGlitchSequence PREFIX CALLED.");
		if (AscensionSaveData.Data == null)
		{
			Plugin.Log.LogWarning((object)"[OLD SA Elephant] AscensionSaveData.Data == null.");
			return true;
		}
		bool flag = AscensionSaveData.Data.ChallengeIsActive(ChallengeRegistry.ElephantModeChallengeType);
		Plugin.Log.LogInfo((object)("[OLD SA Elephant] Elephant Mode active = " + flag));
		if (!flag)
		{
			return true;
		}
		Plugin.Log.LogInfo((object)"[OLD SA Elephant] Replacing BearGlitchSequence.");
		__result = ElephantGlitchSequence();
		return false;
	}

	private static IEnumerator ElephantGlitchSequence()
	{
		Plugin.Log.LogInfo((object)"[OLD SA Elephant] ElephantGlitchSequence START.");
		ChallengeActivationUI.TryShowActivation(ChallengeRegistry.ElephantModeChallengeType);
		CardInfo elephantInfo = CardLoader.GetCardByName("OLD_SA_Elephant");
		if ((Object)(object)elephantInfo == (Object)null)
		{
			Plugin.Log.LogError((object)"[OLD SA Elephant] OLD_SA_Elephant NOT FOUND!");
			yield break;
		}
		Plugin.Log.LogInfo((object)"[OLD SA Elephant] OLD_SA_Elephant found.");
		((ScreenEffect)Singleton<UIManager>.Instance.Effects.GetEffect<ScreenGlitchEffect>()).SetIntensity(1f, 1f);
		Singleton<CameraEffects>.Instance.Shake(0.1f, 1f);
		AudioController.Instance.PlaySound2D("broken_hum", (MixerGroup)0, 1f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
		foreach (CardSlot slot in Singleton<BoardManager>.Instance.OpponentSlotsCopy)
		{
			if (!Singleton<TurnManager>.Instance.Opponent.QueuedSlots.Contains(slot))
			{
				yield return Singleton<TurnManager>.Instance.Opponent.QueueCard(elephantInfo, slot, false, false, false);
			}
			if ((Object)(object)slot.Card == (Object)null)
			{
				yield return Singleton<BoardManager>.Instance.CreateCardInSlot(elephantInfo, slot, 0f, true);
			}
			if ((Object)(object)slot.Card != (Object)null)
			{
				GiveCardReachAndRedColor(slot.Card);
			}
		}
		foreach (PlayableCard playableCard in Singleton<TurnManager>.Instance.Opponent.Queue)
		{
			if ((Object)(object)playableCard != (Object)null && (Object)(object)((Card)playableCard).Info != (Object)null && ((Object)((Card)playableCard).Info).name == "OLD_SA_Elephant")
			{
				GiveCardReachAndRedColor(playableCard);
			}
		}
		yield return (object)new WaitForSeconds(0.5f);
		Plugin.Log.LogInfo((object)"[OLD SA Elephant] ElephantGlitchSequence END.");
	}

	private static void GiveCardReachAndRedColor(PlayableCard card)
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)card == (Object)null))
		{
			CardModificationInfo val = new CardModificationInfo((Ability)23);
			val.fromTotem = true;
			if ((Object)(object)((Card)card).StatsLayer != (Object)null)
			{
				((Card)card).StatsLayer.SetEmissionColor(GameColors.Instance.glowRed);
			}
			card.AddTemporaryMod(val);
			Plugin.Log.LogInfo((object)("[OLD SA Elephant] Reach applied to " + (((Object)(object)((Card)card).Info != (Object)null) ? ((Object)((Card)card).Info).name : "UNKNOWN")));
		}
	}
}
public static class GhostForestChallenge
{
	[HarmonyPatch(typeof(TurnManager), "SetupPhase")]
	private static class TurnManager_SetupPhase
	{
		[HarmonyPostfix]
		private static void Postfix(ref IEnumerator __result)
		{
			Plugin.Log.LogError((object)"[OldSa Challenge] TEST: TurnManager.SetupPhase PATCHED!");
			IEnumerator original = __result;
			__result = SetupPhaseWithGhostForest(original);
		}
	}

	private static IEnumerator SetupPhaseWithGhostForest(IEnumerator original)
	{
		while (original?.MoveNext() ?? false)
		{
			yield return original.Current;
		}
		Plugin.Log.LogError((object)"[OldSa Challenge] TEST: SetupPhase finished!");
		yield return ApplyGhostForest();
	}

	private unsafe static IEnumerator ApplyGhostForest()
	{
		Plugin.Log.LogError((object)"[OldSa Challenge] TEST: ApplyGhostForest ENTERED!");
		if (!SaveFile.IsAscension)
		{
			Plugin.Log.LogError((object)"[OldSa Challenge] Ghost Forest: Not Ascension.");
			yield break;
		}
		int activeCount = AscensionSaveData.Data.GetNumChallengesOfTypeActive(ChallengeRegistry.GhostForestChallengeType);
		Plugin.Log.LogError((object)("[OldSa Challenge] Ghost Forest active count = " + activeCount));
		if (activeCount <= 0)
		{
			yield break;
		}
		BoardManager board = Singleton<BoardManager>.Instance;
		if ((Object)(object)board == (Object)null)
		{
			Plugin.Log.LogError((object)"[OldSa Challenge] Ghost Forest: BoardManager NULL!");
			yield break;
		}
		ModificationType modType = SlotModificationRegistry.NetherworldSlotModificationType;
		Plugin.Log.LogError((object)("[OldSa Challenge] Ghost Forest ModificationType = " + ((object)(*(ModificationType*)(&modType))/*cast due to .constrained prefix*/).ToString()));
		if ((int)modType == 0)
		{
			Plugin.Log.LogError((object)"[OldSa Challenge] Ghost Forest: ModificationType INVALID!");
			yield break;
		}
		List<CardSlot> slots = new List<CardSlot>(board.PlayerSlotsCopy);
		Plugin.Log.LogError((object)("[OldSa Challenge] Player slot count = " + slots.Count));
		if (slots.Count == 0)
		{
			yield break;
		}
		int convertCount = Mathf.Min(activeCount, slots.Count);
		for (int i = 0; i < convertCount; i++)
		{
			int randomIndex = Random.Range(0, slots.Count);
			CardSlot targetSlot = slots[randomIndex];
			slots.RemoveAt(randomIndex);
			if (!((Object)(object)targetSlot == (Object)null))
			{
				Plugin.Log.LogError((object)("[OldSa Challenge] Applying Netherworld to slot " + targetSlot.Index));
				yield return SlotModificationExtensions.SetSlotModification(targetSlot, modType);
				ModificationType actual = SlotModificationExtensions.GetSlotModification(targetSlot);
				Plugin.Log.LogError((object)("[OldSa Challenge] Slot " + targetSlot.Index + " AFTER = " + ((object)(*(ModificationType*)(&actual))/*cast due to .constrained prefix*/).ToString()));
				if (actual == modType)
				{
					Plugin.Log.LogError((object)("[OldSa Challenge] SUCCESS slot " + targetSlot.Index));
					continue;
				}
				Plugin.Log.LogError((object)("[OldSa Challenge] FAILED slot " + targetSlot.Index + " Expected=" + ((object)(*(ModificationType*)(&modType))/*cast due to .constrained prefix*/).ToString() + " Actual=" + ((object)(*(ModificationType*)(&actual))/*cast due to .constrained prefix*/).ToString()));
			}
		}
	}
}
public class NetherworldSlotModification : SlotModificationBehaviour
{
	private PlayableCard currentCard;

	public override IEnumerator Setup()
	{
		currentCard = null;
		UpdateCurrentCard();
		yield break;
	}

	public override bool RespondsToOtherCardAssignedToSlot(PlayableCard otherCard)
	{
		return (Object)(object)otherCard != (Object)null;
	}

	public override IEnumerator OnOtherCardAssignedToSlot(PlayableCard otherCard)
	{
		if (!((Object)(object)otherCard == (Object)null))
		{
			if ((Object)(object)currentCard != (Object)null && (Object)(object)currentCard != (Object)(object)otherCard)
			{
				RemoveIncorporal(currentCard);
			}
			currentCard = otherCard;
			ApplyIncorporal(currentCard);
		}
		yield break;
	}

	private void Update()
	{
		if (!((Object)(object)((SlotModificationBehaviour)this).Slot == (Object)null))
		{
			PlayableCard card = ((SlotModificationBehaviour)this).Slot.Card;
			if ((Object)(object)currentCard != (Object)null && (Object)(object)card != (Object)(object)currentCard)
			{
				PlayableCard card2 = currentCard;
				currentCard = null;
				RemoveIncorporal(card2);
			}
			if ((Object)(object)card != (Object)null && (Object)(object)card != (Object)(object)currentCard)
			{
				currentCard = card;
				ApplyIncorporal(currentCard);
			}
		}
	}

	private void ApplyIncorporal(PlayableCard card)
	{
		if (!((Object)(object)card == (Object)null))
		{
			IncorporalState orCreate = IncorporalState.GetOrCreate(card);
			if (!((Object)(object)orCreate == (Object)null))
			{
				orCreate.Apply((Component)(object)this);
			}
		}
	}

	private void RemoveIncorporal(PlayableCard card)
	{
		if (!((Object)(object)card == (Object)null))
		{
			IncorporalState component = ((Component)card).GetComponent<IncorporalState>();
			if (!((Object)(object)component == (Object)null))
			{
				component.Remove((Component)(object)this);
			}
		}
	}

	public override IEnumerator Cleanup(ModificationType replacement)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)currentCard != (Object)null)
		{
			PlayableCard oldCard = currentCard;
			currentCard = null;
			RemoveIncorporal(oldCard);
		}
		yield break;
	}

	private void UpdateCurrentCard()
	{
		if (!((Object)(object)((SlotModificationBehaviour)this).Slot == (Object)null))
		{
			PlayableCard card = ((SlotModificationBehaviour)this).Slot.Card;
			if (!((Object)(object)card == (Object)null))
			{
				currentCard = card;
				ApplyIncorporal(currentCard);
			}
		}
	}
}
public static class NeverHungryPatch
{
	public static void Apply(Harmony harmony)
	{
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		harmony.Patch((MethodBase)AccessTools.Method(typeof(CardDrawPiles), "ExhaustedSequence", (Type[])null, (Type[])null), new HarmonyMethod(typeof(NeverHungryPatch), "ExhaustedSequence_Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		Plugin.Log.LogInfo((object)"[OldSa Challenge] Never Hungry patch applied.");
	}

	private static bool IsNeverHungryActive()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		return AscensionSaveData.Data.ChallengeIsActive(ChallengeRegistry.NeverStarvationChallengeType);
	}

	private static bool ExhaustedSequence_Prefix()
	{
		if (!IsNeverHungryActive())
		{
			return true;
		}
		Plugin.Log.LogInfo((object)"[OldSa Challenge] Never Hungry prevented starvation.");
		return false;
	}
}
[HarmonyPatch(typeof(Evolve), "OnUpkeep")]
public static class NoGrowthPatch
{
	private static readonly FieldRef<Evolve, int> NumTurnsInPlay = AccessTools.FieldRefAccess<Evolve, int>("numTurnsInPlay");

	private static readonly MethodInfo PreSuccessfulTriggerSequenceMethod = AccessTools.Method(typeof(AbilityBehaviour), "PreSuccessfulTriggerSequence", (Type[])null, (Type[])null);

	private static readonly PropertyInfo CardProperty = AccessTools.Property(typeof(AbilityBehaviour), "Card");

	private static readonly HashSet<Evolve> ProcessedEvolves = new HashSet<Evolve>();

	[HarmonyPrefix]
	public static bool Prefix(Evolve __instance, bool playerUpkeep, ref IEnumerator __result)
	{
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)__instance == (Object)null)
		{
			return true;
		}
		if ((Object)(object)ChallengeRegistry.NoGrowthChallenge == (Object)null || AscensionSaveData.Data == null || !AscensionSaveData.Data.ChallengeIsActive(ChallengeRegistry.NoGrowthChallenge.challengeType))
		{
			return true;
		}
		PlayableCard card = GetCard(__instance);
		if ((Object)(object)card == (Object)null || card.Dead)
		{
			return true;
		}
		if (card.OpponentCard)
		{
			return true;
		}
		if (ProcessedEvolves.Contains(__instance))
		{
			__result = EmptySequence();
			return false;
		}
		__result = NoGrowthOnUpkeep(__instance, card, playerUpkeep);
		return false;
	}

	private static IEnumerator EmptySequence()
	{
		yield break;
	}

	private static PlayableCard GetCard(Evolve evolve)
	{
		if ((Object)(object)evolve == (Object)null || CardProperty == null)
		{
			return null;
		}
		object? value = CardProperty.GetValue(evolve, null);
		return (PlayableCard)((value is PlayableCard) ? value : null);
	}

	private static IEnumerator NoGrowthOnUpkeep(Evolve evolve, PlayableCard card, bool playerUpkeep)
	{
		if ((Object)(object)evolve == (Object)null || (Object)(object)card == (Object)null || card.Dead || card.OpponentCard == playerUpkeep)
		{
			yield break;
		}
		int turnsToEvolve = ((!((Object)(object)((Card)card).Info != (Object)null) || ((Card)card).Info.evolveParams == null) ? 1 : ((Card)card).Info.evolveParams.turnsToEvolve);
		int numTurnsInPlay = NumTurnsInPlay.Invoke(evolve);
		numTurnsInPlay++;
		NumTurnsInPlay.Invoke(evolve) = numTurnsInPlay;
		int remaining = Mathf.Max(1, turnsToEvolve - numTurnsInPlay);
		((Card)card).RenderInfo.OverrideAbilityIcon((Ability)5, ResourceBank.Get<Texture>("Art/Cards/AbilityIcons/ability_evolve_" + remaining));
		((Card)card).RenderCard();
		if (numTurnsInPlay >= turnsToEvolve)
		{
			ProcessedEvolves.Add(evolve);
			yield return InvokePreSuccessfulTriggerSequence(evolve);
			if (!((Object)(object)card == (Object)null) && !card.Dead)
			{
				Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
				yield return (object)new WaitForSeconds(0.15f);
				((Card)card).Anim.PlayTransformAnimation();
				yield return (object)new WaitForSeconds(0.15f);
				CardModificationInfo growth = new CardModificationInfo
				{
					attackAdjustment = 1,
					healthAdjustment = 1,
					singletonId = "OLD_SA_NoGrowth_StatIncrease"
				};
				card.AddTemporaryMod(growth);
				HideEvolve(card);
				card.OnStatsChanged();
				((Card)card).RenderCard();
				card.UpdateFaceUpOnBoardEffects();
				yield return ChallengeDialogueManager.ShowFirstTime("No Growth", "They were meant to evolve... but only an echo answered.");
			}
		}
	}

	private static void HideEvolve(PlayableCard card)
	{
		if (!((Object)(object)card == (Object)null) && card.Status != null)
		{
			if (card.Status.hiddenAbilities == null)
			{
				card.Status.hiddenAbilities = new List<Ability>();
			}
			if (!card.Status.hiddenAbilities.Contains((Ability)5))
			{
				card.Status.hiddenAbilities.Add((Ability)5);
			}
			((Card)card).RenderInfo.OverrideAbilityIcon((Ability)5, (Texture)null);
			((Card)card).RenderCard();
		}
	}

	private static IEnumerator InvokePreSuccessfulTriggerSequence(Evolve evolve)
	{
		if ((Object)(object)evolve == (Object)null || PreSuccessfulTriggerSequenceMethod == null)
		{
			yield break;
		}
		object result = PreSuccessfulTriggerSequenceMethod.Invoke(evolve, null);
		if (result is IEnumerator sequence)
		{
			while (sequence.MoveNext())
			{
				yield return sequence.Current;
			}
		}
	}
}
[HarmonyPatch(typeof(GameMap), "ShowMapSequence")]
public static class NoWoodcarverDialoguePatch
{
	private static readonly MethodInfo UnrollingSequenceMethod = AccessTools.Method(typeof(GameMap), "UnrollingSequence", (Type[])null, (Type[])null);

	[HarmonyPrefix]
	public static bool Prefix(GameMap __instance, float unrollSpeed, ref IEnumerator __result)
	{
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)__instance == (Object)null)
		{
			return true;
		}
		if ((Object)(object)ChallengeRegistry.NoWoodcarverChallenge == (Object)null || AscensionSaveData.Data == null || !AscensionSaveData.Data.ChallengeIsActive(ChallengeRegistry.NoWoodcarverChallenge.challengeType))
		{
			return true;
		}
		__result = ShowMapSequenceWithDialogue(__instance, unrollSpeed);
		return false;
	}

	private static IEnumerator ShowMapSequenceWithDialogue(GameMap map, float unrollSpeed)
	{
		SetFullyUnrolled(map, value: false);
		IEnumerator sequence = InvokeUnrollingSequence(map, unrollSpeed);
		if (sequence != null)
		{
			while (sequence.MoveNext())
			{
				yield return sequence.Current;
			}
		}
		((AnimatedGameMapMarker)PlayerMarker.Instance).Show();
		SetFullyUnrolled(map, value: true);
		yield return ChallengeDialogueManager.ShowFirstTime("No Woodcarver", "Sorry,she doesn't have enough wood.");
	}

	private static IEnumerator InvokeUnrollingSequence(GameMap map, float unrollSpeed)
	{
		if ((Object)(object)map == (Object)null || UnrollingSequenceMethod == null)
		{
			yield break;
		}
		object result = UnrollingSequenceMethod.Invoke(map, new object[1] { unrollSpeed });
		if (result is IEnumerator sequence)
		{
			while (sequence.MoveNext())
			{
				yield return sequence.Current;
			}
		}
	}

	private static void SetFullyUnrolled(GameMap map, bool value)
	{
		if (!((Object)(object)map == (Object)null))
		{
			PropertyInfo propertyInfo = AccessTools.Property(typeof(GameMap), "FullyUnrolled");
			if (!(propertyInfo == null))
			{
				propertyInfo.SetValue(map, value, null);
			}
		}
	}
}
[HarmonyPatch(typeof(MapGenerator), "ChooseSpecialNodeFromPossibilities")]
public static class NoWoodcarverPatch
{
	[HarmonyPrefix]
	public static void Prefix(List<NodeData> possibilities)
	{
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		if (possibilities != null && !((Object)(object)ChallengeRegistry.NoWoodcarverChallenge == (Object)null) && SaveFile.IsAscension && AscensionSaveData.Data.ChallengeIsActive(ChallengeRegistry.NoWoodcarverChallenge.challengeType))
		{
			possibilities.RemoveAll((NodeData node) => node is BuildTotemNodeData);
		}
	}
}
[BepInPlugin("OLD_SA.Challenge", "OLD SA Challenge", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
	public const string PluginGuid = "OLD_SA.Challenge";

	public const string PluginName = "OLD SA Challenge";

	public const string PluginVersion = "1.0.0";

	internal static ManualLogSource Log;

	private void Awake()
	{
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Expected O, but got Unknown
		Log = ((BaseUnityPlugin)this).Logger;
		Log.LogInfo((object)"[OldSa Challenge] Plugin loaded.");
		SlotModificationRegistry.Register();
		ChallengeRegistry.Register();
		Harmony val = new Harmony("OLD_SA.Challenge");
		val.PatchAll();
		Log.LogInfo((object)"[OldSa Challenge] Harmony patches applied.");
		Log.LogInfo((object)"[OldSa Challenge] Initialization complete.");
	}

	public static Texture2D LoadTexture(string name)
	{
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Expected O, but got Unknown
		using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("OldSa_Challenge.Resources." + name);
		if (stream == null)
		{
			Log.LogError((object)("[OldSa Challenge] Missing texture: " + name));
			return null;
		}
		byte[] array = new byte[stream.Length];
		stream.Read(array, 0, array.Length);
		Texture2D val = new Texture2D(2, 2);
		ImageConversion.LoadImage(val, array);
		((Object)val).name = name;
		return val;
	}
}
public static class SlotModificationRegistry
{
	public static ModificationType NetherworldSlotModificationType;

	private static Sprite netherworldRulebookSprite;

	public static void Register()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Invalid comparison between Unknown and I4
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_013b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0140: Unknown result type (might be due to invalid IL or missing references)
		//IL_0145: Unknown result type (might be due to invalid IL or missing references)
		//IL_014b: Invalid comparison between Unknown and I4
		if ((int)NetherworldSlotModificationType > 0)
		{
			Plugin.Log.LogWarning((object)"[OldSa Challenge] Netherworld Slot Modification was already registered.");
			return;
		}
		SlotModificationManager.ModifySlotModificationList -= ModifySlotModificationList;
		SlotModificationManager.ModifySlotModificationList += ModifySlotModificationList;
		Plugin.Log.LogInfo((object)"[OldSa Challenge] Slot modification rulebook modifier registered.");
		Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("OldSa_Netherworld.png", (FilterMode)0);
		if ((Object)(object)imageAsTexture == (Object)null)
		{
			Plugin.Log.LogError((object)"[OldSa Challenge] Failed to load OldSa_Netherworld.png.");
			return;
		}
		netherworldRulebookSprite = Sprite.Create(imageAsTexture, new Rect(0f, 0f, (float)((Texture)imageAsTexture).width, (float)((Texture)imageAsTexture).height), new Vector2(0.5f, 0.5f), 100f);
		if ((Object)(object)netherworldRulebookSprite == (Object)null)
		{
			Plugin.Log.LogError((object)"[OldSa Challenge] Failed to create Netherworld Rulebook Sprite.");
			return;
		}
		Plugin.Log.LogInfo((object)"[OldSa Challenge] Netherworld Rulebook Sprite created.");
		Dictionary<CardTemple, Texture2D> dictionary = new Dictionary<CardTemple, Texture2D>
		{
			{
				(CardTemple)0,
				imageAsTexture
			},
			{
				(CardTemple)2,
				imageAsTexture
			},
			{
				(CardTemple)1,
				imageAsTexture
			},
			{
				(CardTemple)3,
				imageAsTexture
			}
		};
		NetherworldSlotModificationType = SlotModificationManager.New("OLD_SA.Challenge", "Netherworld", typeof(NetherworldSlotModification), dictionary, (Dictionary<BoardTheme, BoardThemeSpriteSet>)null);
		if ((int)NetherworldSlotModificationType == 0)
		{
			Plugin.Log.LogError((object)"[OldSa Challenge] FAILED to register Netherworld Slot Modification.");
			return;
		}
		Plugin.Log.LogInfo((object)"[OldSa Challenge] Registered Slot Modification: Netherworld");
		Plugin.Log.LogInfo((object)("[OldSa Challenge] Netherworld ID = " + ((object)Unsafe.As<ModificationType, ModificationType>(ref NetherworldSlotModificationType)/*cast due to .constrained prefix*/).ToString()));
		SlotModificationManager.SyncSlotModificationList();
		Info val = SlotModificationManager.AllModificationInfos.Find((Info x) => x.ModificationType == NetherworldSlotModificationType);
		if (val == null)
		{
			Plugin.Log.LogError((object)"[OldSa Challenge] Netherworld Info was NOT found in AllModificationInfos.");
			return;
		}
		val.RulebookName = "Netherworld";
		val.RulebookDescription = "When a creature enters this space, it becomes a ghost.";
		val.RulebookSprite = netherworldRulebookSprite;
		if ((Object)(object)val.RulebookSprite == (Object)null)
		{
			Plugin.Log.LogError((object)"[OldSa Challenge] RulebookSprite is STILL NULL!");
		}
		else
		{
			Plugin.Log.LogInfo((object)"[OldSa Challenge] RulebookSprite assigned successfully.");
		}
		if (!val.MetaCategories.Contains((ModificationMetaCategory)0))
		{
			val.MetaCategories.Add((ModificationMetaCategory)0);
		}
		SlotModificationManager.SyncSlotModificationList();
		Info val2 = SlotModificationManager.AllModificationInfos.Find((Info x) => x.ModificationType == NetherworldSlotModificationType);
		if (val2 == null)
		{
			Plugin.Log.LogError((object)"[OldSa Challenge] Netherworld final Info was NOT found after Sync.");
			return;
		}
		Plugin.Log.LogInfo((object)"[OldSa Challenge] Netherworld Info found.");
		Plugin.Log.LogInfo((object)("[OldSa Challenge] RulebookName = " + val2.RulebookName));
		Plugin.Log.LogInfo((object)("[OldSa Challenge] RulebookDescription = " + val2.RulebookDescription));
		Plugin.Log.LogInfo((object)("[OldSa Challenge] RulebookSprite = " + (((Object)(object)val2.RulebookSprite != (Object)null) ? "VALID" : "NULL")));
		Plugin.Log.LogInfo((object)("[OldSa Challenge] Part1Rulebook = " + val2.MetaCategories.Contains((ModificationMetaCategory)0)));
	}

	private static List<Info> ModifySlotModificationList(List<Info> infos)
	{
		Info val = infos.Find((Info x) => x.ModificationType == NetherworldSlotModificationType);
		if (val == null)
		{
			return infos;
		}
		val.RulebookName = "Netherworld";
		val.RulebookDescription = "When a creature enters this space, it becomes a ghost.";
		if ((Object)(object)netherworldRulebookSprite != (Object)null)
		{
			val.RulebookSprite = netherworldRulebookSprite;
		}
		else
		{
			Plugin.Log.LogWarning((object)"[OldSa Challenge] Netherworld Rulebook Sprite is not available.");
		}
		if (!val.MetaCategories.Contains((ModificationMetaCategory)0))
		{
			val.MetaCategories.Add((ModificationMetaCategory)0);
		}
		Plugin.Log.LogInfo((object)"[OldSa Challenge] Netherworld added to Part 1 Rulebook.");
		return infos;
	}
}

OLD_SA_Card/OLD_SA_Decks/OLD_SA_Decks.dll

Decompiled 3 hours ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using InscryptionAPI.Ascension;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("OLD_SA_Decks")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OLD_SA_Decks")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("006f57b1-dcb0-4c34-9083-035a71c7be95")]
[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 StarterDeck
{
	public static void Init()
	{
		StarterDeckManager.New("com.oldsa.hive", "Hive Will", "OLD_SA_HiveDeck.png", new string[3] { "Beehive", "OLD_SA_BEE_WORKER", "OLD_SA_BEE_QUEEN" }, 0);
		StarterDeckManager.New("com.oldsa.poison", "Poison", "OLD_SA_Poison.png", new string[3] { "Skink", "OLD_SA_DART_FROG", "Adder" }, 0);
		StarterDeckManager.New("com.oldsa.strafe", "Strafe", "OLD_SA_Strafe.png", new string[3] { "ElkCub", "OLD_SA_ANTELOPE", "Bull" }, 0);
		StarterDeckManager.New("com.oldsa.cat", "Cat", "OLD_SA_Cat.png", new string[3] { "Cat", "OLD_SA_LYNX", "OLD_SA_CAT_OF_ULTHAR" }, 0);
		StarterDeckManager.New("com.oldsa.bones", "Bones", "OLD_SA_Bones.png", new string[3] { "OLD_SA_FILES", "OLD_SA_BONEGULL", "Lammergeier" }, 0);
	}
}
namespace OLD_SA.Decks;

[BepInPlugin("OLD_SA.Decks", "OLD SA Decks", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		StarterDeck.Init();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"OLD SA Decks Loaded");
	}
}

OLD_SA_Card/OLD_SA_Evolution.dll

Decompiled 3 hours ago
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 OLD_SA.Dialogue;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("OLD_SA_Evolution")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OLD_SA_Evolution")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5b768fcb-7685-41db-8b51-6ca3e88435e4")]
[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.Evolution;

public static class EvolutionAPI
{
	public static Dictionary<string, string> Evolutions = new Dictionary<string, string>();

	public static Dictionary<string, int> Turns = new Dictionary<string, int>();

	public static Dictionary<string, string> EvolutionDialogues = new Dictionary<string, string>();

	public static HashSet<string> TriggeredEvolutionDialogues = new HashSet<string>();

	public static void AddEvolution(string from, string to, int turns, string dialogue = null)
	{
		Evolutions[from] = to;
		Turns[from] = turns;
		if (!string.IsNullOrEmpty(dialogue))
		{
			EvolutionDialogues[from] = dialogue;
		}
	}

	public static bool ShouldTriggerEvolutionDialogue(string cardName)
	{
		if (TriggeredEvolutionDialogues.Contains(cardName))
		{
			return false;
		}
		TriggeredEvolutionDialogues.Add(cardName);
		OLD_SA_SaveManager.Save();
		return true;
	}

	public static List<string> GetTriggeredDialogues()
	{
		return new List<string>(TriggeredEvolutionDialogues);
	}

	public static void LoadTriggeredDialogues(List<string> data)
	{
		TriggeredEvolutionDialogues.Clear();
		if (data == null)
		{
			return;
		}
		foreach (string datum in data)
		{
			if (!string.IsNullOrEmpty(datum))
			{
				TriggeredEvolutionDialogues.Add(datum);
			}
		}
	}

	public static void ClearTriggeredDialogues()
	{
		TriggeredEvolutionDialogues.Clear();
	}
}
public class EvolutionData
{
	public string target;

	public int turns;

	public string dialogue;
}
[HarmonyPatch(typeof(PlayableCard))]
public static class EvolutionDialoguePatch
{
	private static Dictionary<PlayableCard, string> BeforeEvolution = new Dictionary<PlayableCard, string>();

	[HarmonyPatch("TransformIntoCard")]
	[HarmonyPrefix]
	public static void Prefix(PlayableCard __instance)
	{
		if (!((Object)(object)__instance == (Object)null) && !((Object)(object)((Card)__instance).Info == (Object)null))
		{
			BeforeEvolution[__instance] = ((Object)((Card)__instance).Info).name;
		}
	}

	[HarmonyPatch("TransformIntoCard")]
	[HarmonyPostfix]
	public static IEnumerator Postfix(IEnumerator result, PlayableCard __instance, CardInfo evolvedInfo)
	{
		while (result.MoveNext())
		{
			yield return result.Current;
		}
		if (!((Object)(object)__instance == (Object)null) && !((Object)(object)evolvedInfo == (Object)null) && BeforeEvolution.ContainsKey(__instance))
		{
			string oldName = BeforeEvolution[__instance];
			BeforeEvolution.Remove(__instance);
			if (EvolutionAPI.EvolutionDialogues.ContainsKey(oldName) && EvolutionAPI.ShouldTriggerEvolutionDialogue(oldName))
			{
				string dialogue = EvolutionAPI.EvolutionDialogues[oldName];
				yield return ShowEvolutionDialogue(dialogue, evolvedInfo);
			}
		}
	}

	private static IEnumerator ShowEvolutionDialogue(string dialogue, CardInfo evolvedInfo)
	{
		DialogueColorAPI.CurrentColor = null;
		if ((Object)(object)evolvedInfo != (Object)null)
		{
			string cardName = ((Object)evolvedInfo).name;
			if (cardName == "OLD_SA_ABERRATION_FLESH")
			{
				DialogueColorAPI.CurrentColor = new Color(0.65f, 0.05f, 0.05f);
			}
		}
		yield return (object)new WaitForEndOfFrame();
		try
		{
			if ((Object)(object)Singleton<TextDisplayer>.Instance != (Object)null)
			{
				yield return Singleton<TextDisplayer>.Instance.ShowUntilInput(dialogue, -2.5f, 0.5f, (Emotion)0, (LetterAnimation)0, (Speaker)0, (string[])null, true);
			}
		}
		finally
		{
			DialogueColorAPI.CurrentColor = null;
		}
	}
}
public static class EvolutionManager
{
	public static void RegisterAll()
	{
		foreach (CardInfo item in CardManager.AllCardsCopy)
		{
			string evolveFrom = CardExtensions.GetExtendedProperty(item, "OLD_SA_EvolveFrom");
			if (string.IsNullOrEmpty(evolveFrom))
			{
				continue;
			}
			CardInfo val = CardManager.AllCardsCopy.Find((CardInfo x) => ((Object)x).name == evolveFrom);
			if (!((Object)(object)val == (Object)null))
			{
				int num = 1;
				string extendedProperty = CardExtensions.GetExtendedProperty(item, "OLD_SA_EvolveTurns");
				if (int.TryParse(extendedProperty, out var result))
				{
					num = result;
				}
				if (val.evolveParams == null || (Object)(object)val.evolveParams.evolution != (Object)(object)item)
				{
					CardExtensions.SetEvolve(val, item, num, (IEnumerable<CardModificationInfo>)null);
				}
				if (val.evolveParams != null)
				{
					val.evolveParams.turnsToEvolve = num;
				}
				string extendedProperty2 = CardExtensions.GetExtendedProperty(item, "OLD_SA_EvolveDialogue");
				EvolutionAPI.AddEvolution(((Object)val).name, ((Object)item).name, num, extendedProperty2);
			}
		}
	}
}
[BepInPlugin("OLD_SA.Evolution", "OLD SA Evolution", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("OLD_SA.Evolution");
		val.PatchAll();
		SceneManager.sceneLoaded += OnSceneLoaded;
		((MonoBehaviour)this).StartCoroutine(InitialRegister());
		Debug.Log((object)"OLD SA Evolution Loaded");
	}

	private IEnumerator InitialRegister()
	{
		yield return (object)new WaitUntil((Func<bool>)(() => CardManager.AllCardsCopy != null && CardManager.AllCardsCopy.Count > 0));
		yield return (object)new WaitForSeconds(1f);
		EvolutionManager.RegisterAll();
	}

	private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		((MonoBehaviour)this).StartCoroutine(DelayedSceneRegister());
	}

	private IEnumerator DelayedSceneRegister()
	{
		yield return (object)new WaitForSeconds(1f);
		EvolutionManager.RegisterAll();
	}
}

OLD_SA_Card/OLD_SA_Sigil.dll

Decompiled 3 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using DiskCardGame;
using HarmonyLib;
using OLD_SA.CardTraits;
using OLD_SA.Evolution;
using OldSa_Challenge;
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("OLD_SA_Sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OLD_SA_Sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("59150cfa-2a48-413c-bd72-7da85784e761")]
[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.Dialogue;

public static class DialogueColorAPI
{
	public static Color? CurrentColor;
}
public static class OLD_SA_SaveManager
{
	[Serializable]
	private class DialogueSaveData
	{
		public List<string> SigilDialogues = new List<string>();

		public List<string> EvolutionDialogues = new List<string>();

		public List<string> TraitDialogues = new List<string>();

		public List<string> ChallengeDialogues = new List<string>();
	}

	private static string PathFile => Path.Combine(Application.persistentDataPath, "OLD_SA_Save.json");

	public static void Save()
	{
		DialogueSaveData dialogueSaveData = new DialogueSaveData();
		dialogueSaveData.SigilDialogues = SigilDialogueSaveData.GetSaveList();
		dialogueSaveData.EvolutionDialogues = EvolutionAPI.GetTriggeredDialogues();
		dialogueSaveData.TraitDialogues = CardTraitDialogueSaveData.GetSaveList();
		dialogueSaveData.ChallengeDialogues = ChallengeDialogueSaveData.GetSaveList();
		string contents = JsonUtility.ToJson((object)dialogueSaveData, true);
		try
		{
			File.WriteAllText(PathFile, contents);
			Debug.Log((object)"OLD SA Save Complete");
		}
		catch (Exception ex)
		{
			Debug.LogError((object)("OLD SA Save Failed: " + ex.Message));
		}
	}

	public static void Load()
	{
		if (!File.Exists(PathFile))
		{
			Debug.Log((object)"OLD SA Save Not Found");
			return;
		}
		try
		{
			string text = File.ReadAllText(PathFile);
			DialogueSaveData dialogueSaveData = JsonUtility.FromJson<DialogueSaveData>(text);
			if (dialogueSaveData != null)
			{
				SigilDialogueSaveData.LoadFromList(dialogueSaveData.SigilDialogues);
				EvolutionAPI.LoadTriggeredDialogues(dialogueSaveData.EvolutionDialogues);
				CardTraitDialogueSaveData.LoadFromList(dialogueSaveData.TraitDialogues);
				ChallengeDialogueSaveData.LoadFromList(dialogueSaveData.ChallengeDialogues);
				Debug.Log((object)"OLD SA Load Complete");
			}
		}
		catch (Exception ex)
		{
			Debug.LogError((object)("OLD SA Load Failed: " + ex.Message));
		}
	}
}
[BepInPlugin("OLD_SA.Dialogue", "OLD SA Dialogue", "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
		OLD_SA_SaveManager.Load();
		Harmony val = new Harmony("OLD_SA.Dialogue");
		val.PatchAll();
		Debug.Log((object)"OLD SA Dialogue Loaded");
	}
}
public static class SigilDialogueAPI
{
	public static bool ShowingDialogue;

	public static IEnumerator ShowFirstTime(string sigilID, string dialogue)
	{
		return ShowFirstTime(sigilID, dialogue, null);
	}

	public static IEnumerator ShowFirstTime(string sigilID, string dialogue, PlayableCard triggerCard = null)
	{
		if (SigilDialogueSaveData.HasTriggered(sigilID))
		{
			yield break;
		}
		SigilDialogueSaveData.AddTriggered(sigilID);
		OLD_SA_SaveManager.Save();
		DialogueColorAPI.CurrentColor = null;
		if ((Object)(object)triggerCard != (Object)null && (Object)(object)((Card)triggerCard).Info != (Object)null)
		{
			string cardName = ((Object)((Card)triggerCard).Info).name;
			if (cardName == "OLD_SA_WIND_PTEROSAUR")
			{
				DialogueColorAPI.CurrentColor = Color.cyan;
			}
			if (cardName == "OLD_SA_BEE_QUEEN")
			{
				DialogueColorAPI.CurrentColor = Color.yellow;
			}
		}
		ShowingDialogue = true;
		if ((Object)(object)Singleton<ViewManager>.Instance != (Object)null)
		{
			Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)1;
		}
		if ((Object)(object)Singleton<PlayerHand>.Instance != (Object)null)
		{
			Singleton<PlayerHand>.Instance.PlayingLocked = true;
		}
		try
		{
			if ((Object)(object)Singleton<TextDisplayer>.Instance != (Object)null)
			{
				yield return Singleton<TextDisplayer>.Instance.ShowUntilInput(dialogue, -2.5f, 0.5f, (Emotion)0, (LetterAnimation)0, (Speaker)0, (string[])null, true);
			}
		}
		finally
		{
			if ((Object)(object)Singleton<PlayerHand>.Instance != (Object)null)
			{
				Singleton<PlayerHand>.Instance.PlayingLocked = false;
			}
			if ((Object)(object)Singleton<ViewManager>.Instance != (Object)null)
			{
				Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
			}
			DialogueColorAPI.CurrentColor = null;
			ShowingDialogue = false;
		}
	}
}
public static class SigilDialogueSaveData
{
	private static HashSet<string> Triggered = new HashSet<string>();

	public static int Count => Triggered.Count;

	public static bool HasTriggered(string id)
	{
		if (string.IsNullOrEmpty(id))
		{
			return false;
		}
		return Triggered.Contains(id);
	}

	public static void AddTriggered(string id)
	{
		if (!string.IsNullOrEmpty(id) && !Triggered.Contains(id))
		{
			Triggered.Add(id);
		}
	}

	public static void Remove(string id)
	{
		if (!string.IsNullOrEmpty(id))
		{
			Triggered.Remove(id);
		}
	}

	public static void Clear()
	{
		Triggered.Clear();
	}

	public static List<string> GetSaveList()
	{
		return new List<string>(Triggered);
	}

	public static void LoadFromList(List<string> data)
	{
		Triggered.Clear();
		if (data == null)
		{
			return;
		}
		foreach (string datum in data)
		{
			if (!string.IsNullOrEmpty(datum))
			{
				Triggered.Add(datum);
			}
		}
	}
}
[HarmonyPatch]
public static class SigilDialogueSavePatch
{
	[HarmonyPatch(typeof(SaveFile), "Initialize")]
	[HarmonyPostfix]
	public static void InitializePostfix()
	{
		OLD_SA_SaveManager.Load();
		Debug.Log((object)"OLD SA Dialogue Save Loaded");
	}

	[HarmonyPatch(typeof(SaveManager), "SaveToFile")]
	[HarmonyPostfix]
	public static void SaveToFilePostfix(bool saveActiveScene)
	{
		OLD_SA_SaveManager.Save();
		Debug.Log((object)"OLD SA Dialogue Save Saved");
	}
}
[HarmonyPatch(typeof(TextDisplayer), "ShowMessage")]
public static class TextDisplayerColorPatch
{
	[HarmonyPostfix]
	public static void Postfix(TextDisplayer __instance)
	{
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		if (!DialogueColorAPI.CurrentColor.HasValue)
		{
			return;
		}
		FieldInfo fieldInfo = AccessTools.Field(typeof(TextDisplayer), "textMesh");
		if (fieldInfo == null)
		{
			return;
		}
		object value = fieldInfo.GetValue(__instance);
		if (value != null)
		{
			PropertyInfo property = value.GetType().GetProperty("color");
			if (property != null && property.CanWrite)
			{
				property.SetValue(value, DialogueColorAPI.CurrentColor.Value);
			}
		}
	}
}

OLD_SA_Card/OldSa_CardTraits.dll

Decompiled 3 hours ago
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 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_CardTraits")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_CardTraits")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4ebfbc44-c273-4a7d-92ed-5b86f52380fa")]
[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.CardTraits;

public static class CardTrait
{
	public const string Featherless = "OLD_SA_Featherless";

	public const string Jackal = "OLD_SA_Jackal";

	public const string WeakHatchling = "OLD_SA_WeakHatchling";

	public const string Infinite = "OLD_SA_Infinite";
}
public static class CardTraitAPI
{
	public static HashSet<string> TriggeredTraitDialogues = new HashSet<string>();

	public static bool ShouldTriggerDialogue(string dialogueID)
	{
		if (string.IsNullOrEmpty(dialogueID))
		{
			return false;
		}
		if (TriggeredTraitDialogues.Contains(dialogueID))
		{
			return false;
		}
		TriggeredTraitDialogues.Add(dialogueID);
		OLD_SA_SaveManager.Save();
		return true;
	}

	public static List<string> GetTriggeredDialogues()
	{
		return new List<string>(TriggeredTraitDialogues);
	}

	public static void LoadTriggeredDialogues(List<string> data)
	{
		TriggeredTraitDialogues.Clear();
		if (data == null)
		{
			return;
		}
		foreach (string datum in data)
		{
			if (!string.IsNullOrEmpty(datum))
			{
				TriggeredTraitDialogues.Add(datum);
			}
		}
	}

	public static void ClearTriggeredDialogues()
	{
		TriggeredTraitDialogues.Clear();
	}
}
public static class CardTraitConditionAPI
{
	private static Dictionary<string, string> RequiredAdjacent = new Dictionary<string, string>();

	public static void RegisterAdjacentRequirement(string trait, string cardName)
	{
		RequiredAdjacent[trait] = cardName;
	}

	public static bool CheckAdjacentRequirement(PlayableCard card, string trait)
	{
		if (!RequiredAdjacent.ContainsKey(trait))
		{
			return true;
		}
		string text = RequiredAdjacent[trait];
		foreach (CardSlot adjacentSlot in Singleton<BoardManager>.Instance.GetAdjacentSlots(card.Slot))
		{
			if ((Object)(object)adjacentSlot.Card != (Object)null && ((Object)((Card)adjacentSlot.Card).Info).name == text)
			{
				return true;
			}
		}
		return false;
	}
}
public static class CardTraitDialogueManager
{
	public static IEnumerator TryTrigger(PlayableCard card)
	{
		if (!((Object)(object)card == (Object)null) && !((Object)(object)((Card)card).Info == (Object)null))
		{
			string dialogueID = CardExtensions.GetExtendedProperty(((Card)card).Info, "OLD_SA_TraitDialogueID");
			string dialogue = CardExtensions.GetExtendedProperty(((Card)card).Info, "OLD_SA_TraitDialogue");
			yield return TryTrigger(dialogueID, dialogue);
		}
	}

	public static IEnumerator TryTrigger(string dialogueID, string dialogue)
	{
		if (!string.IsNullOrEmpty(dialogueID) && !string.IsNullOrEmpty(dialogue) && !CardTraitDialogueSaveData.HasTriggered(dialogueID))
		{
			yield return Singleton<TextDisplayer>.Instance.ShowUntilInput(dialogue, -0.65f, 0.4f, (Emotion)0, (LetterAnimation)0, (Speaker)0, (string[])null, true);
			CardTraitDialogueSaveData.AddTriggered(dialogueID);
		}
	}
}
public static class CardTraitDialogueQueue
{
	private static string id;

	private static string text;

	public static void Add(string dialogueID, string dialogue)
	{
		if (!string.IsNullOrEmpty(dialogueID) && !string.IsNullOrEmpty(dialogue))
		{
			id = dialogueID;
			text = dialogue;
		}
	}

	public static bool HasDialogue()
	{
		return !string.IsNullOrEmpty(id) && !string.IsNullOrEmpty(text);
	}

	public static IEnumerator Play()
	{
		if (HasDialogue())
		{
			string currentID = id;
			string currentText = text;
			id = null;
			text = null;
			yield return Singleton<TextDisplayer>.Instance.ShowUntilInput(currentText, -0.65f, 0.4f, (Emotion)0, (LetterAnimation)0, (Speaker)0, (string[])null, true);
			CardTraitDialogueSaveData.AddTriggered(currentID);
		}
	}
}
public class CardTraitDialogueRunner : MonoBehaviour
{
	private static CardTraitDialogueRunner instance;

	private bool playing;

	public static CardTraitDialogueRunner Instance
	{
		get
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			if ((Object)(object)instance == (Object)null)
			{
				GameObject val = new GameObject("CardTraitDialogueRunner");
				Object.DontDestroyOnLoad((Object)(object)val);
				instance = val.AddComponent<CardTraitDialogueRunner>();
			}
			return instance;
		}
	}

	public void Queue(string dialogueID, string dialogue)
	{
		CardTraitDialogueQueue.Add(dialogueID, dialogue);
	}

	private void Update()
	{
		if (!playing && CardTraitDialogueQueue.HasDialogue())
		{
			((MonoBehaviour)this).StartCoroutine(PlayQueue());
		}
	}

	private IEnumerator PlayQueue()
	{
		playing = true;
		yield return CardTraitDialogueQueue.Play();
		playing = false;
	}
}
public static class CardTraitDialogueSaveData
{
	private static HashSet<string> Triggered = new HashSet<string>();

	public static bool HasTriggered(string id)
	{
		if (string.IsNullOrEmpty(id))
		{
			return false;
		}
		return Triggered.Contains(id);
	}

	public static void AddTriggered(string id)
	{
		if (!string.IsNullOrEmpty(id) && !Triggered.Contains(id))
		{
			Triggered.Add(id);
		}
	}

	public static void Remove(string id)
	{
		if (!string.IsNullOrEmpty(id))
		{
			Triggered.Remove(id);
		}
	}

	public static void Clear()
	{
		Triggered.Clear();
	}

	public static List<string> GetSaveList()
	{
		return new List<string>(Triggered);
	}

	public static void LoadFromList(List<string> data)
	{
		Triggered.Clear();
		if (data == null)
		{
			return;
		}
		foreach (string datum in data)
		{
			if (!string.IsNullOrEmpty(datum))
			{
				Triggered.Add(datum);
			}
		}
	}
}
[HarmonyPatch(typeof(PlayableCard), "AddTemporaryMod")]
public static class CardTraitFlyingPatch
{
	[HarmonyPrefix]
	public static bool Prefix(PlayableCard __instance, CardModificationInfo mod)
	{
		if ((Object)(object)__instance == (Object)null || (Object)(object)((Card)__instance).Info == (Object)null || mod == null || mod.abilities == null)
		{
			return true;
		}
		if (!mod.abilities.Contains((Ability)19))
		{
			return true;
		}
		if (mod.singletonId == "wind_blessing_flying")
		{
			return true;
		}
		if (!CardTraitHelper.HasTrait(__instance, "OLD_SA_Featherless"))
		{
			return true;
		}
		((MonoBehaviour)__instance).StartCoroutine(CardTraitDialogueManager.TryTrigger(__instance));
		mod.abilities.Remove((Ability)19);
		if (mod.abilities.Count == 0 && mod.attackAdjustment == 0 && mod.healthAdjustment == 0 && (mod.negateAbilities == null || mod.negateAbilities.Count == 0))
		{
			return false;
		}
		return true;
	}
}
public static class CardTraitHelper
{
	public static bool HasTrait(PlayableCard card, string trait)
	{
		if ((Object)(object)card == (Object)null || (Object)(object)((Card)card).Info == (Object)null)
		{
			return false;
		}
		if (CardExtensions.GetExtendedProperty(((Card)card).Info, trait) == "true")
		{
			return true;
		}
		foreach (CardModificationInfo mod in ((Card)card).Info.Mods)
		{
			if (mod.singletonId == trait)
			{
				return true;
			}
		}
		foreach (CardModificationInfo temporaryMod in card.TemporaryMods)
		{
			if (temporaryMod.singletonId == trait)
			{
				return true;
			}
		}
		return false;
	}
}
[HarmonyPatch(typeof(DeckInfo), "ModifyCard")]
public static class FeatherlessDeckModifyPatch
{
	[HarmonyPrefix]
	public static bool Prefix(CardInfo card, CardModificationInfo mod)
	{
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Invalid comparison between Unknown and I4
		if ((Object)(object)card == (Object)null || mod == null || mod.abilities == null)
		{
			return true;
		}
		if (!mod.abilities.Contains((Ability)19))
		{
			return true;
		}
		if (CardExtensions.GetExtendedProperty(card, "OLD_SA_Featherless") != "true")
		{
			return true;
		}
		mod.abilities.Remove((Ability)19);
		string extendedProperty = CardExtensions.GetExtendedProperty(card, "OLD_SA_TraitDialogueID");
		string extendedProperty2 = CardExtensions.GetExtendedProperty(card, "OLD_SA_TraitDialogue");
		CardTraitDialogueQueue.Add(extendedProperty, extendedProperty2);
		if (mod.abilities.Count == 0 && mod.attackAdjustment == 0 && mod.healthAdjustment == 0 && (mod.negateAbilities == null || mod.negateAbilities.Count == 0) && (mod.addGemCost == null || mod.addGemCost.Count == 0) && (mod.specialAbilities == null || mod.specialAbilities.Count == 0) && (int)mod.statIcon == 0)
		{
			return false;
		}
		return true;
	}
}
[HarmonyPatch(typeof(RandomAbility), "ChooseAbility")]
public static class FeatherlessRandomAbilityPatch
{
	[HarmonyPostfix]
	public static void Postfix(RandomAbility __instance, ref Ability __result)
	{
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: Expected I4, but got Unknown
		if ((Object)(object)__instance == (Object)null)
		{
			return;
		}
		PlayableCard card = Traverse.Create((object)__instance).Field("Card").GetValue<PlayableCard>();
		if (!((Object)(object)card == (Object)null) && !((Object)(object)((Card)card).Info == (Object)null) && CardTraitHelper.HasTrait(card, "OLD_SA_Featherless") && (int)__result == 19)
		{
			List<Ability> learnedAbilities = AbilitiesUtil.GetLearnedAbilities(false, 0, 5, (AbilityMetaCategory)1);
			learnedAbilities.Remove((Ability)19);
			learnedAbilities.RemoveAll((Ability x) => card.HasAbility(x));
			if (learnedAbilities.Count > 0)
			{
				__result = (Ability)(int)learnedAbilities[SeededRandom.Range(0, learnedAbilities.Count, SaveManager.SaveFile.GetCurrentRandomSeed())];
			}
			else
			{
				__result = (Ability)15;
			}
		}
	}
}
[HarmonyPatch(typeof(PlayableCard), "AddTemporaryMod")]
public static class InfinitePermanentStatsPatch
{
	[HarmonyPrefix]
	public static bool Prefix(PlayableCard __instance, CardModificationInfo mod)
	{
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Expected O, but got Unknown
		if ((Object)(object)__instance == (Object)null || (Object)(object)((Card)__instance).Info == (Object)null || mod == null)
		{
			return true;
		}
		if (!CardTraitHelper.HasTrait(__instance, "OLD_SA_Infinite"))
		{
			return true;
		}
		int num = ((mod.attackAdjustment > 0) ? mod.attackAdjustment : 0);
		int num2 = ((mod.healthAdjustment > 0) ? mod.healthAdjustment : 0);
		if (num == 0 && num2 == 0)
		{
			return true;
		}
		CardModificationInfo val = new CardModificationInfo();
		val.attackAdjustment = num;
		val.healthAdjustment = num2;
		((Card)__instance).Info.Mods.Add(val);
		mod.attackAdjustment -= num;
		mod.healthAdjustment -= num2;
		if (mod.attackAdjustment != 0 || mod.healthAdjustment != 0 || mod.bloodCostAdjustment != 0 || mod.bonesCostAdjustment != 0 || mod.energyCostAdjustment != 0 || mod.gemify || mod.fromOverclock || (mod.abilities != null && mod.abilities.Count > 0) || (mod.negateAbilities != null && mod.negateAbilities.Count > 0))
		{
			return true;
		}
		return false;
	}
}
public static class JackalFusionManager
{
	public static void ReplaceDeckCards(CardInfo jackal, CardInfo wolf, CardInfo result)
	{
		if (RunState.Run == null)
		{
			return;
		}
		DeckInfo playerDeck = RunState.Run.playerDeck;
		if (playerDeck == null)
		{
			return;
		}
		if ((Object)(object)jackal != (Object)null)
		{
			((CardCollectionInfo)playerDeck).RemoveCardByName(((Object)jackal).name);
		}
		if ((Object)(object)wolf != (Object)null)
		{
			((CardCollectionInfo)playerDeck).RemoveCardByName(((Object)wolf).name);
		}
		if ((Object)(object)result != (Object)null)
		{
			((CardCollectionInfo)playerDeck).AddCard(result);
		}
		foreach (CardInfo card in ((CardCollectionInfo)playerDeck).Cards)
		{
		}
	}
}
public static class JackalTraitAPI
{
	public const string Trait = "OLD_SA_Jackal";

	public const string ConditionCard = "OLD_SA_TraitConditionCard";

	public const string TransformCard = "OLD_SA_TraitTransformCard";

	public const string DialogueID = "OLD_SA_TraitDialogueID";

	public const string Dialogue = "OLD_SA_TraitDialogue";

	public static string GetConditionCard(PlayableCard card)
	{
		if (!CardTraitHelper.HasTrait(card, "OLD_SA_Jackal"))
		{
			return null;
		}
		return CardExtensions.GetExtendedProperty(((Card)card).Info, "OLD_SA_TraitConditionCard");
	}

	public static string GetTransformCard(PlayableCard card)
	{
		if (!CardTraitHelper.HasTrait(card, "OLD_SA_Jackal"))
		{
			return null;
		}
		return CardExtensions.GetExtendedProperty(((Card)card).Info, "OLD_SA_TraitTransformCard");
	}

	public static string GetDialogueID(PlayableCard card)
	{
		if (!CardTraitHelper.HasTrait(card, "OLD_SA_Jackal"))
		{
			return null;
		}
		return CardExtensions.GetExtendedProperty(((Card)card).Info, "OLD_SA_TraitDialogueID");
	}

	public static string GetDialogue(PlayableCard card)
	{
		if (!CardTraitHelper.HasTrait(card, "OLD_SA_Jackal"))
		{
			return null;
		}
		return CardExtensions.GetExtendedProperty(((Card)card).Info, "OLD_SA_TraitDialogue");
	}
}
public static class JackalTraitPatch
{
	private static bool transforming;

	public static IEnumerator CheckJackalFusion()
	{
		if (transforming || (Object)(object)Singleton<BoardManager>.Instance == (Object)null)
		{
			yield break;
		}
		foreach (CardSlot slot in Singleton<BoardManager>.Instance.GetSlots(true))
		{
			if ((Object)(object)slot.Card == (Object)null)
			{
				continue;
			}
			PlayableCard jackal = slot.Card;
			if (CardTraitHelper.HasTrait(jackal, "OLD_SA_Jackal"))
			{
				PlayableCard wolf = FindWolf(jackal);
				if ((Object)(object)wolf != (Object)null)
				{
					yield return Fusion(jackal, wolf);
					yield break;
				}
			}
		}
	}

	private static PlayableCard FindWolf(PlayableCard jackal)
	{
		foreach (CardSlot adjacentSlot in Singleton<BoardManager>.Instance.GetAdjacentSlots(jackal.Slot))
		{
			if ((Object)(object)adjacentSlot.Card == (Object)null || !(((Object)((Card)adjacentSlot.Card).Info).name == JackalTraitAPI.GetConditionCard(jackal)))
			{
				continue;
			}
			return adjacentSlot.Card;
		}
		return null;
	}

	private static IEnumerator Fusion(PlayableCard jackal, PlayableCard wolf)
	{
		transforming = true;
		CardInfo result = CardLoader.GetCardByName(JackalTraitAPI.GetTransformCard(jackal));
		if ((Object)(object)result == (Object)null)
		{
			transforming = false;
			yield break;
		}
		CardSlot spawnSlot = jackal.Slot;
		CardInfo jackalInfo = ((Card)jackal).Info;
		CardInfo wolfInfo = ((Card)wolf).Info;
		yield return CardTraitDialogueManager.TryTrigger(jackal);
		if ((Object)(object)jackal != (Object)null)
		{
			((Card)jackal).Anim.ExitBoard(0.5f, Vector3.zero);
		}
		if ((Object)(object)wolf != (Object)null)
		{
			((Card)wolf).Anim.ExitBoard(0.5f, Vector3.zero);
		}
		yield return (object)new WaitForSeconds(0.6f);
		if ((Object)(object)jackal != (Object)null)
		{
			Object.Destroy((Object)(object)((Component)jackal).gameObject);
		}
		if ((Object)(object)wolf != (Object)null)
		{
			Object.Destroy((Object)(object)((Component)wolf).gameObject);
		}
		yield return (object)new WaitForSeconds(0.2f);
		yield return Singleton<BoardManager>.Instance.CreateCardInSlot(result, spawnSlot, 0.1f, true);
		JackalFusionManager.ReplaceDeckCards(jackalInfo, wolfInfo, result);
		transforming = false;
	}
}
[HarmonyPatch(typeof(BoardManager), "AssignCardToSlot")]
public static class JackalFusionTriggerPatch
{
	public static IEnumerator Postfix(IEnumerator __result)
	{
		while (__result.MoveNext())
		{
			yield return __result.Current;
		}
		yield return (object)new WaitForSeconds(0.05f);
		if (HasJackalOnBoard())
		{
			yield return JackalTraitPatch.CheckJackalFusion();
		}
	}

	private static bool HasJackalOnBoard()
	{
		if ((Object)(object)Singleton<BoardManager>.Instance == (Object)null)
		{
			return false;
		}
		foreach (CardSlot slot in Singleton<BoardManager>.Instance.GetSlots(true))
		{
			if ((Object)(object)slot.Card == (Object)null || !CardTraitHelper.HasTrait(slot.Card, "OLD_SA_Jackal"))
			{
				continue;
			}
			return true;
		}
		return false;
	}
}
[BepInPlugin("OLD_SA.CardTraits", "OLD SA CardTraits", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("OLD_SA.CardTraits");
		val.PatchAll();
		_ = CardTraitDialogueRunner.Instance;
		((BaseUnityPlugin)this).Logger.LogInfo((object)"OLD SA CardTraits Loaded");
	}
}
[HarmonyPatch(typeof(Evolve), "OnUpkeep")]
public static class WeakHatchlingPatch
{
	private static readonly FieldRef<Evolve, int> NumTurnsInPlay = AccessTools.FieldRefAccess<Evolve, int>("numTurnsInPlay");

	private static readonly MethodInfo PreSuccessfulTriggerSequenceMethod = AccessTools.Method(typeof(AbilityBehaviour), "PreSuccessfulTriggerSequence", (Type[])null, (Type[])null);

	[HarmonyPrefix]
	public static bool Prefix(Evolve __instance, bool playerUpkeep, ref IEnumerator __result)
	{
		if ((Object)(object)__instance == (Object)null)
		{
			return true;
		}
		PlayableCard card = GetCard(__instance);
		if ((Object)(object)card == (Object)null || !CardTraitHelper.HasTrait(card, "OLD_SA_WeakHatchling"))
		{
			return true;
		}
		__result = WeakHatchlingOnUpkeep(__instance, card, playerUpkeep);
		return false;
	}

	private static PlayableCard GetCard(Evolve evolve)
	{
		if ((Object)(object)evolve == (Object)null)
		{
			return null;
		}
		PropertyInfo propertyInfo = AccessTools.Property(typeof(AbilityBehaviour), "Card");
		if (propertyInfo == null)
		{
			return null;
		}
		object? value = propertyInfo.GetValue(evolve, null);
		return (PlayableCard)((value is PlayableCard) ? value : null);
	}

	private static IEnumerator WeakHatchlingOnUpkeep(Evolve evolve, PlayableCard card, bool playerUpkeep)
	{
		if ((Object)(object)evolve == (Object)null || (Object)(object)card == (Object)null || card.Dead || card.OpponentCard == playerUpkeep)
		{
			yield break;
		}
		int turnsToEvolve = ((!((Object)(object)((Card)card).Info != (Object)null) || ((Card)card).Info.evolveParams == null) ? 1 : ((Card)card).Info.evolveParams.turnsToEvolve);
		int numTurnsInPlay = NumTurnsInPlay.Invoke(evolve);
		numTurnsInPlay++;
		NumTurnsInPlay.Invoke(evolve) = numTurnsInPlay;
		int remaining = Mathf.Max(1, turnsToEvolve - numTurnsInPlay);
		((Card)card).RenderInfo.OverrideAbilityIcon((Ability)5, ResourceBank.Get<Texture>("Art/Cards/AbilityIcons/ability_evolve_" + remaining));
		((Card)card).RenderCard();
		if (numTurnsInPlay >= turnsToEvolve)
		{
			yield return InvokePreSuccessfulTriggerSequence(evolve);
			if (!((Object)(object)card == (Object)null) && !card.Dead)
			{
				Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
				yield return (object)new WaitForSeconds(0.15f);
				((Card)card).Anim.PlayTransformAnimation();
				yield return (object)new WaitForSeconds(0.15f);
				CardModificationInfo growth = new CardModificationInfo
				{
					attackAdjustment = 1,
					healthAdjustment = 1,
					singletonId = "OLD_SA_WeakHatchling_Growth"
				};
				card.AddTemporaryMod(growth);
				RemoveEvolve(card);
				((Card)card).RenderCard();
				card.OnStatsChanged();
				card.UpdateFaceUpOnBoardEffects();
				yield return CardTraitDialogueManager.TryTrigger(card);
			}
		}
	}

	private static IEnumerator InvokePreSuccessfulTriggerSequence(Evolve evolve)
	{
		if ((Object)(object)evolve == (Object)null || PreSuccessfulTriggerSequenceMethod == null)
		{
			yield break;
		}
		object result = PreSuccessfulTriggerSequenceMethod.Invoke(evolve, null);
		if (result is IEnumerator sequence)
		{
			while (sequence.MoveNext())
			{
				yield return sequence.Current;
			}
		}
	}

	private static void RemoveEvolve(PlayableCard card)
	{
		if ((Object)(object)card == (Object)null)
		{
			return;
		}
		if ((Object)(object)card.TriggerHandler != (Object)null)
		{
			card.TriggerHandler.RemoveAbility((Ability)5);
		}
		while (true)
		{
			CardModificationInfo val = null;
			foreach (CardModificationInfo temporaryMod in card.TemporaryMods)
			{
				if (temporaryMod == null || temporaryMod.abilities == null || !temporaryMod.abilities.Contains((Ability)5))
				{
					continue;
				}
				val = temporaryMod;
				break;
			}
			if (val == null)
			{
				break;
			}
			card.RemoveTemporaryMod(val, true);
		}
		if (card.Status != null)
		{
			if (card.Status.hiddenAbilities == null)
			{
				card.Status.hiddenAbilities = new List<Ability>();
			}
			if (!card.Status.hiddenAbilities.Contains((Ability)5))
			{
				card.Status.hiddenAbilities.Add((Ability)5);
			}
		}
		((Card)card).RenderInfo.OverrideAbilityIcon((Ability)5, (Texture)null);
		((Card)card).RenderCard();
	}
}

OLD_SA_Card/OldSa_Pelt.dll

Decompiled 3 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using DiskCardGame;
using HarmonyLib;
using InscryptionAPI.Card;
using InscryptionAPI.Dialogue;
using InscryptionAPI.Helpers;
using InscryptionAPI.Pelts;
using InscryptionAPI.Pelts.Extensions;
using OLD_SA.Pelt;
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_Pelt")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Pelt")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b8818afc-f159-4d5d-a320-9616352cd5db")]
[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.Incorporal
{
	[HarmonyPatch(typeof(RenderStatsLayer), "AssignCopiedRenderTexture")]
	public static class GhostCardRenderTexturePatch
	{
		[HarmonyPostfix]
		private static void Postfix(RenderStatsLayer __instance, Texture tex, bool emission)
		{
			if (!((Object)(object)__instance == (Object)null) && !((Object)(object)tex == (Object)null))
			{
				object? obj = AccessTools.Property(typeof(RenderStatsLayer), "PlayableCard")?.GetValue(__instance, null);
				PlayableCard val = (PlayableCard)((obj is PlayableCard) ? obj : null);
				if (!((Object)(object)val == (Object)null) && GhostCard.IsApplied(val))
				{
					GhostCard.SyncRenderTexture(val, tex, emission);
				}
			}
		}
	}
}
namespace OLD_SA.Pelt
{
	[HarmonyPatch(typeof(CardMergeSequencer), "GetValidCardsForSacrifice")]
	internal static class CardMergeSequencer_GoldPeltSacrificePatch
	{
		[HarmonyPostfix]
		private static void Postfix(ref List<CardInfo> __result)
		{
			if (__result == null || __result.Count == 0)
			{
				return;
			}
			List<CardInfo> goldCards = GoldPeltPool.GetGoldCards();
			if (goldCards != null && goldCards.Count != 0)
			{
				__result.RemoveAll((CardInfo card) => (Object)(object)card != (Object)null && goldCards.Contains(card));
			}
		}
	}
	public static class GhostCard
	{
		private static AssetBundle ghostBundle;

		private static Material ghostBaseMaterial;

		private static readonly Dictionary<PlayableCard, Material> originalMaterials = new Dictionary<PlayableCard, Material>();

		private static readonly Dictionary<PlayableCard, Material> ghostMaterials = new Dictionary<PlayableCard, Material>();

		private static string BundlePath => Path.Combine(Paths.PluginPath, "OLD_SA_DLC", "OLD_SA_Card", "old_sa_ghost");

		private static bool LoadGhostBundle()
		{
			if ((Object)(object)ghostBaseMaterial != (Object)null)
			{
				return true;
			}
			if ((Object)(object)ghostBundle == (Object)null)
			{
				if (!File.Exists(BundlePath))
				{
					return false;
				}
				ghostBundle = AssetBundle.LoadFromFile(BundlePath);
				if ((Object)(object)ghostBundle == (Object)null)
				{
					return false;
				}
			}
			ghostBaseMaterial = ghostBundle.LoadAsset<Material>("assets/ghostcard_material.mat");
			if ((Object)(object)ghostBaseMaterial == (Object)null)
			{
				return false;
			}
			return true;
		}

		public static void SyncRenderTexture(PlayableCard card, Texture tex, bool emission)
		{
			if ((Object)(object)card == (Object)null || (Object)(object)tex == (Object)null)
			{
				return;
			}
			Material value = null;
			if (!ghostMaterials.TryGetValue(card, out value) || (Object)(object)value == (Object)null)
			{
				return;
			}
			if (emission)
			{
				if (value.HasProperty("_EmissionMap"))
				{
					value.SetTexture("_EmissionMap", tex);
				}
			}
			else if (value.HasProperty("_MainTex"))
			{
				value.SetTexture("_MainTex", tex);
			}
			Material value2 = null;
			if (!originalMaterials.TryGetValue(card, out value2) || !((Object)(object)value2 != (Object)null))
			{
				return;
			}
			if (emission)
			{
				if (value2.HasProperty("_EmissionMap"))
				{
					value2.SetTexture("_EmissionMap", tex);
				}
			}
			else if (value2.HasProperty("_MainTex"))
			{
				value2.SetTexture("_MainTex", tex);
			}
		}

		public static void Apply(PlayableCard card)
		{
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Expected O, but got Unknown
			if ((Object)(object)card == (Object)null || (Object)(object)((Card)card).StatsLayer == (Object)null)
			{
				return;
			}
			Material value = null;
			if (ghostMaterials.TryGetValue(card, out value))
			{
				if (!((Object)(object)value == (Object)null))
				{
					if ((Object)(object)((Card)card).StatsLayer.Material != (Object)(object)value)
					{
						((Card)card).StatsLayer.Material = value;
					}
					return;
				}
				ghostMaterials.Remove(card);
			}
			if ((Object)(object)((Card)card).StatsLayer.Material == (Object)null || !LoadGhostBundle())
			{
				return;
			}
			Material material = ((Card)card).StatsLayer.Material;
			if ((Object)(object)material == (Object)null)
			{
				return;
			}
			Material val = new Material(ghostBaseMaterial);
			if (material.HasProperty("_MainTex") && val.HasProperty("_MainTex"))
			{
				Texture texture = material.GetTexture("_MainTex");
				if ((Object)(object)texture != (Object)null)
				{
					val.SetTexture("_MainTex", texture);
				}
			}
			if (material.HasProperty("_EmissionMap") && val.HasProperty("_EmissionMap"))
			{
				Texture texture2 = material.GetTexture("_EmissionMap");
				if ((Object)(object)texture2 != (Object)null)
				{
					val.SetTexture("_EmissionMap", texture2);
				}
			}
			originalMaterials[card] = material;
			ghostMaterials[card] = val;
			((Card)card).StatsLayer.Material = val;
		}

		public static void Refresh(PlayableCard card)
		{
			if (!((Object)(object)card == (Object)null))
			{
				Material value = null;
				if (ghostMaterials.TryGetValue(card, out value) && !((Object)(object)value == (Object)null) && !((Object)(object)((Card)card).StatsLayer == (Object)null) && (Object)(object)((Card)card).StatsLayer.Material != (Object)(object)value)
				{
					((Card)card).StatsLayer.Material = value;
				}
			}
		}

		public static void Remove(PlayableCard card)
		{
			if (!((Object)(object)card == (Object)null))
			{
				Material value = null;
				originalMaterials.TryGetValue(card, out value);
				Material value2 = null;
				ghostMaterials.TryGetValue(card, out value2);
				if ((Object)(object)((Card)card).StatsLayer != (Object)null && (Object)(object)value != (Object)null)
				{
					((Card)card).StatsLayer.Material = value;
				}
				if ((Object)(object)value2 != (Object)null)
				{
					Object.Destroy((Object)(object)value2);
				}
				originalMaterials.Remove(card);
				ghostMaterials.Remove(card);
			}
		}

		public static bool IsApplied(PlayableCard card)
		{
			if ((Object)(object)card == (Object)null)
			{
				return false;
			}
			Material value = null;
			if (!ghostMaterials.TryGetValue(card, out value))
			{
				return false;
			}
			if ((Object)(object)value == (Object)null)
			{
				return false;
			}
			if ((Object)(object)((Card)card).StatsLayer == (Object)null)
			{
				return false;
			}
			return (Object)(object)((Card)card).StatsLayer.Material == (Object)(object)value;
		}

		public static Material GetGhostMaterial(PlayableCard card)
		{
			if ((Object)(object)card == (Object)null)
			{
				return null;
			}
			Material value = null;
			if (ghostMaterials.TryGetValue(card, out value))
			{
				return value;
			}
			return null;
		}

		public static void Forget(PlayableCard card)
		{
			if (!((Object)(object)card == (Object)null))
			{
				Material value = null;
				if (ghostMaterials.TryGetValue(card, out value) && (Object)(object)value != (Object)null)
				{
					Object.Destroy((Object)(object)value);
				}
				originalMaterials.Remove(card);
				ghostMaterials.Remove(card);
			}
		}
	}
	public static class GoldPeltPool
	{
		public const string GoldPeltProperty = "OLD_SA_GoldPool";

		private static readonly List<CardInfo> goldCards = new List<CardInfo>();

		public static int Count => goldCards.Count;

		public static void Initialize()
		{
			BuildPool();
		}

		public static void BuildPool()
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected I4, but got Unknown
			goldCards.Clear();
			foreach (CardInfo item in CardManager.AllCardsCopy)
			{
				if (!((Object)(object)item == (Object)null) && IsGoldPeltCard(item))
				{
					CardExtensions.AddAppearances(item, (Appearance[])(object)new Appearance[1] { (Appearance)(int)OldSaEerieForestBackground.ID });
					if (!goldCards.Contains(item))
					{
						goldCards.Add(item);
					}
					Debug.Log((object)("[OLD SA Pelt] Gold card registered: " + ((Object)item).name));
				}
			}
			Debug.Log((object)("[OLD SA Pelt] Gold Pelt Pool built. Count = " + goldCards.Count));
		}

		public static bool IsGoldPeltCard(CardInfo cardInfo)
		{
			if ((Object)(object)cardInfo == (Object)null)
			{
				return false;
			}
			string extendedProperty = CardExtensions.GetExtendedProperty(cardInfo, "OLD_SA_GoldPool");
			return string.Equals(extendedProperty, "true", StringComparison.OrdinalIgnoreCase);
		}

		public static List<CardInfo> GetGoldCards()
		{
			return new List<CardInfo>(goldCards);
		}

		public static CardInfo GetRandomGoldCard()
		{
			if (goldCards.Count == 0)
			{
				return null;
			}
			return goldCards[Random.Range(0, goldCards.Count)];
		}
	}
	public static class HolyPelt
	{
		private const string HolyPeltName = "OLD_SA_HOLY_PELT";

		private static readonly HashSet<BuyPeltsSequencer> PurchasedAtThisNode = new HashSet<BuyPeltsSequencer>();

		public static void Initialize()
		{
			RegisterHolyPelt();
		}

		private static void RegisterHolyPelt()
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			CardInfo cardByName = CardLoader.GetCardByName("OLD_SA_HOLY_PELT");
			Func<List<CardInfo>> func = () => CardLoader.GetUnlockedCards((CardMetaCategory)1, (CardTemple)0);
			PeltData val = PeltManager.New("OLD_SA.Pelt", cardByName, func, 13, 0, 3);
			val.peltTierName = "Holy";
			val.isSoldByTrapper = false;
			DialogueManager.GenerateTraderPeltsEvent("OLD_SA.Pelt", val, new List<CustomLine> { CustomLine.op_Implicit("This will draw their attention.") }, (List<List<CustomLine>>)null);
		}

		[HarmonyPatch(typeof(BuyPeltsSequencer), "BuyPelts")]
		[HarmonyPrefix]
		private static void BuyPeltsPrefix(BuyPeltsSequencer __instance)
		{
			PurchasedAtThisNode.Remove(__instance);
		}

		[HarmonyPatch(typeof(BuyPeltsSequencer), "BuyPelt")]
		[HarmonyPrefix]
		private static bool BuyPeltPrefix(BuyPeltsSequencer __instance, SelectableCard card)
		{
			if ((Object)(object)card == (Object)null || (Object)(object)((Card)card).Info == (Object)null)
			{
				return true;
			}
			if (((Object)((Card)card).Info).name != "OLD_SA_HOLY_PELT")
			{
				return true;
			}
			int holyPeltPrice = GetHolyPeltPrice(card);
			if (RunState.Run.currency < holyPeltPrice)
			{
				return true;
			}
			if (!PurchasedAtThisNode.Contains(__instance))
			{
				PurchasedAtThisNode.Add(__instance);
				return true;
			}
			ShowAlreadyHaveEnough(__instance);
			return false;
		}

		private static int GetHolyPeltPrice(SelectableCard card)
		{
			PeltData val = PeltManager.AllPeltsAvailableAtTrader().Find((PeltData x) => x != null && x.peltCardName == "OLD_SA_HOLY_PELT");
			if (val != null)
			{
				return val.BuyPrice;
			}
			return 13;
		}

		private static void ShowAlreadyHaveEnough(BuyPeltsSequencer instance)
		{
			if (!Singleton<TextDisplayer>.Instance.Displaying)
			{
				((MonoBehaviour)instance).StartCoroutine(Singleton<TextDisplayer>.Instance.ShowThenClear("You've got enough already", 3f, 0f, (Emotion)0, (LetterAnimation)0, (Speaker)0, (string[])null));
			}
		}
	}
	public class OldSaEerieForestBackground : CardAppearanceBehaviour
	{
		public static Appearance ID;

		private static Texture2D BackgroundTexture;

		public override void ApplyAppearance()
		{
			if ((Object)(object)BackgroundTexture == (Object)null)
			{
				BackgroundTexture = TextureHelper.GetImageAsTexture("OLD_SA_DLC/OLD_SA_Card/Background/OldSa_Eerie_Forest_Background.png", (FilterMode)0);
			}
			if ((Object)(object)BackgroundTexture == (Object)null)
			{
				Debug.LogError((object)"[OLD SA Pelt] Failed to load Eerie Forest Background.");
			}
			else
			{
				((CardAppearanceBehaviour)this).Card.RenderInfo.baseTextureOverride = (Texture)(object)BackgroundTexture;
			}
		}
	}
	public class OldSaPlantBackground : CardAppearanceBehaviour
	{
		public static Appearance ID;

		private static Texture2D BackgroundTexture;

		public override void ApplyAppearance()
		{
			if ((Object)(object)BackgroundTexture == (Object)null)
			{
				BackgroundTexture = TextureHelper.GetImageAsTexture("OLD_SA_DLC/OLD_SA_Card/Background/OldSa_Plant_Background.png", (FilterMode)0);
			}
			((CardAppearanceBehaviour)this).Card.RenderInfo.baseTextureOverride = (Texture)(object)BackgroundTexture;
		}
	}
	[BepInPlugin("OLD_SA.Pelt", "OLD SA Pelt", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string PluginGuid = "OLD_SA.Pelt";

		public const string PluginName = "OLD SA Pelt";

		public const string PluginVersion = "1.0.0";

		internal static Plugin Instance;

		internal static ManualLogSource Log;

		private const string BrokenPeltName = "OLD_SA_BROKEN_PELT";

		private const string HolyPeltName = "OLD_SA_HOLY_PELT";

		private const string BrokenModificationId = "OLD_SA_BROKEN_PELT_MOD";

		private unsafe void Awake()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Expected O, but got Unknown
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)"[OLD SA Pelt] Plugin loaded.");
			try
			{
				FullCardAppearanceBehaviour val = CardAppearanceBehaviourManager.Add("OLD_SA.Pelt", "RainbowEmission", typeof(RainbowEmission));
				RainbowEmission.ID = val.Id;
				Log.LogInfo((object)"[OLD SA Pelt] RainbowEmission registered.");
				ManualLogSource log = Log;
				Appearance id = val.Id;
				log.LogInfo((object)("[OLD SA Pelt] RainbowEmission ID = " + ((object)(*(Appearance*)(&id))/*cast due to .constrained prefix*/).ToString()));
				Log.LogInfo((object)("[OLD SA Pelt] RainbowEmission Type = " + val.AppearanceBehaviour));
				FullCardAppearanceBehaviour val2 = CardAppearanceBehaviourManager.Add("OLD_SA.Pelt", "OldSa_Eerie_Forest_Background", typeof(OldSaEerieForestBackground));
				OldSaEerieForestBackground.ID = val2.Id;
				Log.LogInfo((object)"[OLD SA Pelt] OldSa Eerie Forest Background registered.");
				ManualLogSource log2 = Log;
				id = val2.Id;
				log2.LogInfo((object)("[OLD SA Pelt] OldSa Eerie Forest Background ID = " + ((object)(*(Appearance*)(&id))/*cast due to .constrained prefix*/).ToString()));
				Log.LogInfo((object)("[OLD SA Pelt] OldSa Eerie Forest Background Type = " + val2.AppearanceBehaviour));
				FullCardAppearanceBehaviour val3 = CardAppearanceBehaviourManager.Add("OLD_SA.Pelt", "OldSa_Plant_Background", typeof(OldSaPlantBackground));
				OldSaPlantBackground.ID = val3.Id;
				Log.LogInfo((object)"[OLD SA Pelt] OldSa Plant Background registered.");
				ManualLogSource log3 = Log;
				id = val3.Id;
				log3.LogInfo((object)("[OLD SA Pelt] OldSa Plant Background ID = " + ((object)(*(Appearance*)(&id))/*cast due to .constrained prefix*/).ToString()));
				Log.LogInfo((object)("[OLD SA Pelt] OldSa Plant Background Type = " + val3.AppearanceBehaviour));
				RegisterBrokenPelt();
				HolyPelt.Initialize();
				Harmony val4 = new Harmony("OLD_SA.Pelt");
				val4.PatchAll();
				Log.LogInfo((object)"[OLD SA Pelt] Harmony PatchAll completed.");
				Log.LogInfo((object)"[OLD SA Pelt] Broken Pelt registered successfully.");
				Log.LogInfo((object)"[OLD SA Pelt] Holy Pelt initialized successfully.");
				Log.LogInfo((object)"[OLD SA Pelt] Plugin initialization completed.");
			}
			catch (Exception ex)
			{
				Log.LogError((object)"[OLD SA Pelt] Failed to initialize:");
				Log.LogError((object)ex);
			}
		}

		private void RegisterBrokenPelt()
		{
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			CardInfo cardByName = CardLoader.GetCardByName("OLD_SA_BROKEN_PELT");
			if ((Object)(object)cardByName == (Object)null)
			{
				Log.LogError((object)"[OLD SA Pelt] Could not find card: OLD_SA_BROKEN_PELT");
				return;
			}
			Func<List<CardInfo>> func = delegate
			{
				List<CardInfo> unlockedCards = CardLoader.GetUnlockedCards((CardMetaCategory)1, (CardTemple)0);
				unlockedCards.RemoveAll((CardInfo card) => !CanBeBroken(card));
				return unlockedCards;
			};
			PeltData val = PeltManager.New("OLD_SA.Pelt", cardByName, func, 1, 0, 8);
			val.isSoldByTrapper = false;
			val.peltTierName = "Broken";
			DialogueManager.GenerateTraderPeltsEvent("OLD_SA.Pelt", val, new List<CustomLine> { CustomLine.op_Implicit("What good do you think I have to offer you?") }, (List<List<CustomLine>>)null);
			PeltExtensions.SetModifyCardChoiceAtTrader(val, (Action<CardInfo>)ModifyBrokenCard);
			PeltExtensions.SetModifyCardChoiceAtTrader(val, (Action<CardInfo>)ModifyBrokenCard);
			Log.LogInfo((object)"[OLD SA Pelt] Registered OLD_SA_BROKEN_PELT.");
		}

		private static bool CanBeBroken(CardInfo cardInfo)
		{
			if ((Object)(object)cardInfo == (Object)null)
			{
				return false;
			}
			if (cardInfo.Attack > 0)
			{
				return true;
			}
			if (cardInfo.Health > 2)
			{
				return true;
			}
			if (cardInfo.Abilities != null && cardInfo.Abilities.Count > 0)
			{
				return true;
			}
			return false;
		}

		private static void ModifyBrokenCard(CardInfo cardInfo)
		{
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Expected O, but got Unknown
			if ((Object)(object)cardInfo == (Object)null)
			{
				return;
			}
			if (cardInfo.Mods != null)
			{
				foreach (CardModificationInfo mod in cardInfo.Mods)
				{
					if (mod == null || !(mod.singletonId == "OLD_SA_BROKEN_PELT_MOD"))
					{
						continue;
					}
					return;
				}
			}
			int attack = cardInfo.Attack;
			int health = cardInfo.Health;
			bool flag = attack > 0;
			bool flag2 = health > 2;
			CardModificationInfo val = new CardModificationInfo();
			if (flag && flag2)
			{
				if (Random.Range(0, 2) == 0)
				{
					val.attackAdjustment = -1;
					Log.LogInfo((object)("[OLD SA Pelt] " + ((Object)cardInfo).name + " -> Attack -1"));
				}
				else
				{
					val.healthAdjustment = -2;
					Log.LogInfo((object)("[OLD SA Pelt] " + ((Object)cardInfo).name + " -> Health -2"));
				}
			}
			else if (flag)
			{
				val.attackAdjustment = -1;
				Log.LogInfo((object)("[OLD SA Pelt] " + ((Object)cardInfo).name + " -> Attack -1"));
			}
			else if (flag2)
			{
				val.healthAdjustment = -2;
				Log.LogInfo((object)("[OLD SA Pelt] " + ((Object)cardInfo).name + " -> Health -2"));
			}
			else
			{
				RemoveRandomAbility(cardInfo, val);
			}
			string text = cardInfo.DisplayedNameLocalized;
			if (string.IsNullOrEmpty(text))
			{
				text = ((Object)cardInfo).name;
			}
			val.nameReplacement = string.Format(Localization.Translate("Broken {0}"), text);
			val.singletonId = "OLD_SA_BROKEN_PELT_MOD";
			if (cardInfo.Mods == null)
			{
				cardInfo.Mods = new List<CardModificationInfo>();
			}
			cardInfo.Mods.Add(val);
		}

		private unsafe static void RemoveRandomAbility(CardInfo cardInfo, CardModificationInfo brokenMod)
		{
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			if (cardInfo.Abilities == null || cardInfo.Abilities.Count == 0)
			{
				Log.LogInfo((object)("[OLD SA Pelt] " + ((Object)cardInfo).name + " -> No abilities to remove."));
				return;
			}
			List<Ability> list = new List<Ability>(cardInfo.Abilities);
			if (list.Count == 0)
			{
				Log.LogInfo((object)("[OLD SA Pelt] " + ((Object)cardInfo).name + " -> No abilities."));
				return;
			}
			Ability item = list[Random.Range(0, list.Count)];
			brokenMod.negateAbilities = new List<Ability>();
			brokenMod.negateAbilities.Add(item);
			Log.LogInfo((object)("[OLD SA Pelt] " + ((Object)cardInfo).name + " -> Removed ability " + ((object)(*(Ability*)(&item))/*cast due to .constrained prefix*/).ToString()));
		}

		internal static bool HasBrokenPeltInHand()
		{
			if ((Object)(object)Singleton<PlayerHand>.Instance == (Object)null)
			{
				return false;
			}
			foreach (PlayableCard item in Singleton<PlayerHand>.Instance.CardsInHand)
			{
				if ((Object)(object)item == (Object)null || (Object)(object)((Card)item).Info == (Object)null || !(((Object)((Card)item).Info).name == "OLD_SA_BROKEN_PELT"))
				{
					continue;
				}
				return true;
			}
			return false;
		}

		internal static bool HasHolyPeltInHand()
		{
			if ((Object)(object)Singleton<PlayerHand>.Instance == (Object)null)
			{
				return false;
			}
			foreach (PlayableCard item in Singleton<PlayerHand>.Instance.CardsInHand)
			{
				if ((Object)(object)item == (Object)null || (Object)(object)((Card)item).Info == (Object)null || !(((Object)((Card)item).Info).name == "OLD_SA_HOLY_PELT"))
				{
					continue;
				}
				return true;
			}
			return false;
		}
	}
	public class RainbowEmission : CardAppearanceBehaviour
	{
		public static Appearance ID;

		private static AssetBundle rainbowBundle;

		private static Material rainbowBaseMaterial;

		private Material originalMaterial;

		private Material rainbowMaterial;

		private static string BundlePath => Path.Combine(Paths.PluginPath, "OLD_SA_DLC", "OLD_SA_Card", "old_sa_rainbow");

		private static bool LoadRainbowBundle()
		{
			if ((Object)(object)rainbowBaseMaterial != (Object)null)
			{
				return true;
			}
			if ((Object)(object)rainbowBundle == (Object)null)
			{
				if (!File.Exists(BundlePath))
				{
					Debug.LogError((object)("[OLD SA Pelt] Rainbow AssetBundle not found: " + BundlePath));
					return false;
				}
				rainbowBundle = AssetBundle.LoadFromFile(BundlePath);
				if ((Object)(object)rainbowBundle == (Object)null)
				{
					Debug.LogError((object)"[OLD SA Pelt] Failed to load Rainbow AssetBundle.");
					return false;
				}
				Debug.Log((object)"[OLD SA Pelt] Rainbow AssetBundle loaded.");
			}
			rainbowBaseMaterial = rainbowBundle.LoadAsset<Material>("assets/rainbowoilfilm_material.mat");
			if ((Object)(object)rainbowBaseMaterial == (Object)null)
			{
				Debug.LogError((object)"[OLD SA Pelt] RainbowOilFilm_Material not found in AssetBundle.");
				return false;
			}
			Debug.Log((object)"[OLD SA Pelt] RainbowOilFilm_Material loaded.");
			Debug.Log((object)("[OLD SA Pelt] Shader = " + ((Object)rainbowBaseMaterial.shader).name));
			return true;
		}

		public override void ApplyAppearance()
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			if (!((Object)(object)((CardAppearanceBehaviour)this).Card == (Object)null) && !((Object)(object)((CardAppearanceBehaviour)this).Card.StatsLayer == (Object)null) && !((Object)(object)((CardAppearanceBehaviour)this).Card.StatsLayer.Material == (Object)null) && LoadRainbowBundle())
			{
				originalMaterial = ((CardAppearanceBehaviour)this).Card.StatsLayer.Material;
				rainbowMaterial = new Material(rainbowBaseMaterial);
				((CardAppearanceBehaviour)this).Card.StatsLayer.Material = rainbowMaterial;
				Debug.Log((object)"[OLD SA Pelt] Rainbow material applied to card.");
			}
		}

		public override void ManagedUpdate()
		{
			if (!((Object)(object)rainbowMaterial == (Object)null))
			{
			}
		}

		public override void ResetAppearance()
		{
			if ((Object)(object)((CardAppearanceBehaviour)this).Card != (Object)null && (Object)(object)((CardAppearanceBehaviour)this).Card.StatsLayer != (Object)null && (Object)(object)originalMaterial != (Object)null)
			{
				((CardAppearanceBehaviour)this).Card.StatsLayer.Material = originalMaterial;
			}
			if ((Object)(object)rainbowMaterial != (Object)null)
			{
				Object.Destroy((Object)(object)rainbowMaterial);
				rainbowMaterial = null;
			}
			originalMaterial = null;
		}
	}
}

OLD_SA_Card/OldSa_Tribes.dll

Decompiled 3 hours ago
using System;
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 BepInEx.Logging;
using DiskCardGame;
using HarmonyLib;
using InscryptionAPI.Card;
using InscryptionAPI.Helpers;
using OLD_SA.Pelt;
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_Tribes")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Tribes")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("408b1661-bdcd-4b4d-85b7-bcdbe1090f1a")]
[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.Tribes
{
	[BepInPlugin("OLD_SA.Tribes", "OLD SA Tribes", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static ManualLogSource Log;

		private void Awake()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)"OLD SA Tribes loading...");
			TribesAPI.Init();
			CardBackgroundPatch.Initialize(new Harmony("OLD_SA.Tribes"));
			Log.LogInfo((object)"OLD SA Tribes loaded.");
		}
	}
	public static class TribesAPI
	{
		public static Tribe Feline;

		public static Tribe Plant;

		public static Tribe Crustacean;

		public static void Init()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			Feline = TribeManager.Add("OLD_SA", "Feline", TextureHelper.GetImageAsTexture("OldSa_Feline.png", (FilterMode)0), true, (Texture2D)null);
			Plant = TribeManager.Add("OLD_SA", "Plant", TextureHelper.GetImageAsTexture("OldSa_Plant.png", (FilterMode)0), true, (Texture2D)null);
			Crustacean = TribeManager.Add("OLD_SA", "Crustacean", TextureHelper.GetImageAsTexture("OldSa_Crustacean.png", (FilterMode)0), true, (Texture2D)null);
			CardInfo cardByName = CardLoader.GetCardByName("Cat");
			if ((Object)(object)cardByName != (Object)null && !cardByName.tribes.Contains(Feline))
			{
				cardByName.tribes.Add(Feline);
			}
			CardInfo cardByName2 = CardLoader.GetCardByName("DeadTree");
			if ((Object)(object)cardByName2 != (Object)null && !cardByName2.tribes.Contains(Plant))
			{
				cardByName2.tribes.Add(Plant);
			}
			CardInfo cardByName3 = CardLoader.GetCardByName("Stump");
			if ((Object)(object)cardByName3 != (Object)null && !cardByName3.tribes.Contains(Plant))
			{
				cardByName3.tribes.Add(Plant);
			}
			CardInfo cardByName4 = CardLoader.GetCardByName("Tree");
			if ((Object)(object)cardByName4 != (Object)null && !cardByName4.tribes.Contains(Plant))
			{
				cardByName4.tribes.Add(Plant);
			}
			CardInfo cardByName5 = CardLoader.GetCardByName("Tree_Hologram");
			if ((Object)(object)cardByName5 != (Object)null && !cardByName5.tribes.Contains(Plant))
			{
				cardByName5.tribes.Add(Plant);
			}
			CardInfo cardByName6 = CardLoader.GetCardByName("Tree_SnowCovered");
			if ((Object)(object)cardByName6 != (Object)null && !cardByName6.tribes.Contains(Plant))
			{
				cardByName6.tribes.Add(Plant);
			}
		}
	}
}
namespace OLD_SA.Pelt
{
	internal static class CardBackgroundPatch
	{
		private static readonly Dictionary<string, Appearance> CardBackgrounds = new Dictionary<string, Appearance>
		{
			{
				"OLD_SA_NEPENTHES",
				OldSaPlantBackground.ID
			},
			{
				"OLD_SA_STRANGLEVIEN",
				OldSaPlantBackground.ID
			},
			{
				"OLD_SA_GEARGRASS",
				OldSaPlantBackground.ID
			}
		};

		public static void Initialize(Harmony harmony)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			harmony.Patch((MethodBase)AccessTools.Method(typeof(Card), "ApplyAppearanceBehaviours", new Type[1] { typeof(List<Appearance>) }, (Type[])null), new HarmonyMethod(AccessTools.Method(typeof(CardBackgroundPatch), "Prefix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}

		private static void Prefix(Card __instance, List<Appearance> appearances)
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)__instance == (Object)null) && !((Object)(object)__instance.Info == (Object)null) && appearances != null && CardBackgrounds.TryGetValue(((Object)__instance.Info).name, out var value) && !appearances.Contains(value))
			{
				appearances.Add(value);
			}
		}
	}
}

Sigil/OldSa_Blessing.dll

Decompiled 3 hours ago
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 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_Blessing")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Blessing")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("6d19ef0e-8b62-4cde-b8c7-49a209400275")]
[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.Blessing;

public static class BlessingEffectManager
{
	private static readonly Dictionary<BlessingType, IBlessingEffect> Effects = new Dictionary<BlessingType, IBlessingEffect>();

	public static void Register(BlessingType type, IBlessingEffect effect)
	{
		Effects[type] = effect;
	}

	public static IBlessingEffect GetEffect(BlessingType type)
	{
		if (Effects.TryGetValue(type, out var value))
		{
			return value;
		}
		return null;
	}

	public static void Apply(PlayableCard card, BlessingType type)
	{
		GetEffect(type)?.Apply(card);
	}
}
public static class BlessingManager
{
	private static readonly Dictionary<PlayableCard, List<BlessingType>> Blessings = new Dictionary<PlayableCard, List<BlessingType>>();

	public static void AddBlessing(PlayableCard card, BlessingType type)
	{
		if (!((Object)(object)card == (Object)null))
		{
			if (!Blessings.ContainsKey(card))
			{
				Blessings.Add(card, new List<BlessingType>());
			}
			if (!Blessings[card].Contains(type))
			{
				Blessings[card].Add(type);
			}
		}
	}

	public static bool HasBlessing(PlayableCard card, BlessingType type)
	{
		if ((Object)(object)card == (Object)null)
		{
			return false;
		}
		if (!Blessings.ContainsKey(card))
		{
			return false;
		}
		return Blessings[card].Contains(type);
	}

	public static void RemoveBlessing(PlayableCard card, BlessingType type)
	{
		if (!((Object)(object)card == (Object)null) && Blessings.ContainsKey(card))
		{
			Blessings[card].Remove(type);
		}
	}

	public static void ClearCard(PlayableCard card)
	{
		if (!((Object)(object)card == (Object)null))
		{
			Blessings.Remove(card);
		}
	}

	public static void ClearAll()
	{
		Blessings.Clear();
	}
}
public static class BlessingRegister
{
	public static void Register()
	{
		BlessingEffectManager.Register(BlessingType.Wind, new WindBlessingEffect());
	}
}
public enum BlessingType
{
	Wind,
	Fire,
	Water,
	Earth
}
public interface IBlessingEffect
{
	void Apply(PlayableCard card);

	void Remove(PlayableCard card);
}
[BepInPlugin("OLD_SA.Blessing", "OLD SA Blessing", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public static Plugin Instance;

	private Harmony harmony;

	private void Awake()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		Instance = this;
		harmony = new Harmony("OLD_SA.Blessing");
		harmony.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"[OLD_SA.Blessing] Loaded.");
	}
}
public class WindBlessingEffect : IBlessingEffect
{
	public void Apply(PlayableCard card)
	{
		if (!((Object)(object)card == (Object)null))
		{
			WindBlessingRuntime.Add(card);
			card.UpdateFaceUpOnBoardEffects();
		}
	}

	public void Remove(PlayableCard card)
	{
		if (!((Object)(object)card == (Object)null))
		{
			WindBlessingRuntime.Remove(card);
			card.UpdateFaceUpOnBoardEffects();
		}
	}
}
[HarmonyPatch(typeof(PlayableCard), "HasAbility")]
public static class WindBlessingHasAbilityPatch
{
	public static void Postfix(PlayableCard __instance, Ability ability, ref bool __result)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0004: Invalid comparison between Unknown and I4
		if ((int)ability == 19 && WindBlessingRuntime.HasWind(__instance))
		{
			__result = true;
		}
	}
}
public static class WindBlessingRuntime
{
	private static readonly HashSet<PlayableCard> WindCards = new HashSet<PlayableCard>();

	public static void Add(PlayableCard card)
	{
		if (!((Object)(object)card == (Object)null))
		{
			WindCards.Add(card);
		}
	}

	public static void Remove(PlayableCard card)
	{
		if (!((Object)(object)card == (Object)null))
		{
			WindCards.Remove(card);
		}
	}

	public static bool HasWind(PlayableCard card)
	{
		if ((Object)(object)card == (Object)null)
		{
			return false;
		}
		return WindCards.Contains(card);
	}

	public static void RemoveDeadCards()
	{
		WindCards.RemoveWhere((PlayableCard card) => (Object)(object)card == (Object)null || card.Dead);
	}

	public static void Clear()
	{
		WindCards.Clear();
	}
}
[HarmonyPatch(typeof(PlayableCard), "OnUpkeep")]
public static class WindBlessingUpkeepPatch
{
	public static void Postfix(PlayableCard __instance, bool playerUpkeep)
	{
		if (!((Object)(object)__instance == (Object)null) && __instance.OpponentCard == playerUpkeep && WindBlessingRuntime.HasWind(__instance))
		{
			WindBlessingRuntime.Remove(__instance);
			__instance.UpdateFaceUpOnBoardEffects();
			((Card)__instance).RenderCard();
		}
	}
}

Sigil/OldSa_Blood Strike_sigil.dll

Decompiled 3 hours ago
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 Pixelplacement;
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_Blood Strike_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Blood Strike_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5220cd9b-f564-40be-bae0-549090a841ec")]
[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.BloodStrike;

public static class BloodStrikeAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Blood Strike";
		val.rulebookName = "Blood Strike";
		val.metaCategories = new List<AbilityMetaCategory>
		{
			(AbilityMetaCategory)0,
			(AbilityMetaCategory)1
		};
		val.powerLevel = 5;
		val.opponentUsable = true;
		val.canStack = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Blood_Strike.png", (FilterMode)0);
		FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(val, "When [creature] kills another creature, it attacks again.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(BloodStrikeBehaviour), imageAsTexture);
	}
}
public class BloodStrikeBehaviour : AbilityBehaviour
{
	public override Ability Ability => BloodStrikeAPI.ability.Id;

	public override bool RespondsToOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
	{
		return (Object)(object)killer == (Object)(object)((AbilityBehaviour)this).Card;
	}

	public override IEnumerator OnOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
	{
		yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
		if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead || (Object)(object)((AbilityBehaviour)this).Card.Slot == (Object)null)
		{
			yield break;
		}
		CardSlot attackingSlot = ((AbilityBehaviour)this).Card.Slot;
		CardSlot opposingSlot = attackingSlot.opposingSlot;
		if ((Object)(object)opposingSlot == (Object)null)
		{
			yield break;
		}
		CombatPhaseManager combat = Singleton<CombatPhaseManager>.Instance;
		if (!((Object)(object)combat == (Object)null))
		{
			int damageBefore = combat.DamageDealtThisPhase;
			yield return combat.SlotAttackSlot(attackingSlot, opposingSlot, 0f);
			int damageAfter = combat.DamageDealtThisPhase;
			int directDamage = damageAfter - damageBefore;
			if (directDamage > 0)
			{
				yield return MoveDamageWeightsToScales(combat, attackingSlot.IsPlayerSlot);
				yield return Singleton<LifeManager>.Instance.ShowDamageSequence(directDamage, directDamage, !attackingSlot.IsPlayerSlot, 0f, (GameObject)null, 0f, true);
			}
			yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
		}
	}

	private IEnumerator MoveDamageWeightsToScales(CombatPhaseManager combat, bool playerIsAttacker)
	{
		CombatPhaseManager3D combat3D = (CombatPhaseManager3D)(object)((combat is CombatPhaseManager3D) ? combat : null);
		if ((Object)(object)combat3D == (Object)null)
		{
			yield return (object)new WaitForSeconds(0.25f);
			yield break;
		}
		FieldInfo field = typeof(CombatPhaseManager3D).GetField("damageWeights", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field == null)
		{
			yield return (object)new WaitForSeconds(0.25f);
			yield break;
		}
		if (!(field.GetValue(combat3D) is List<Transform> damageWeights))
		{
			yield return (object)new WaitForSeconds(0.25f);
			yield break;
		}
		if ((Object)(object)Singleton<LifeManager>.Instance.Scales3D != (Object)null)
		{
			Vector3 scalesPos = (playerIsAttacker ? Singleton<LifeManager>.Instance.Scales3D.OpponentSide : Singleton<LifeManager>.Instance.Scales3D.PlayerSide);
			foreach (Transform transform in damageWeights)
			{
				if ((Object)(object)transform != (Object)null)
				{
					Tween.Position(transform, scalesPos, 0.2f, 0f, Tween.EaseOut, (LoopType)0, (Action)null, (Action)null, true);
					Object.Destroy((Object)(object)((Component)transform).gameObject, 0.2f);
				}
				yield return (object)new WaitForSeconds(0.02f);
			}
		}
		else
		{
			foreach (Transform transform2 in damageWeights)
			{
				if ((Object)(object)transform2 != (Object)null)
				{
					Part1Scales.DissolveWeight(((Component)transform2).gameObject);
				}
				yield return (object)new WaitForSeconds(0.02f);
			}
		}
		yield return (object)new WaitForSeconds(0.25f);
		damageWeights.Clear();
	}
}
[BepInPlugin("OLD_SA.BloodStrike", "OLD SA Blood Strike", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("OLD_SA.BloodStrike");
		val.PatchAll();
		BloodStrikeAPI.Init();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"OLD SA Blood Strike Loaded");
	}
}

Sigil/OldSa_BloodRecompense_sigil.dll

Decompiled 3 hours ago
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 BepInEx.Logging;
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("Blood Recompense")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Blood Recompense")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("cc6d3245-7eca-4c79-b54b-b4a2e4110b2f")]
[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 BloodRecompense;

public static class BloodRecompenseAPI
{
	private static bool initialized = false;

	public const string DefaultSpawnCard = "Squirrel";

	private static Dictionary<PlayableCard, PlayableCard> DamageSources = new Dictionary<PlayableCard, PlayableCard>();

	public static void RegisterDamageSource(PlayableCard target, PlayableCard attacker)
	{
		if (!((Object)(object)target == (Object)null) && !((Object)(object)attacker == (Object)null))
		{
			DamageSources[target] = attacker;
		}
	}

	public static bool WasKilledBy(PlayableCard dead, PlayableCard killer)
	{
		if ((Object)(object)dead == (Object)null || (Object)(object)killer == (Object)null)
		{
			return false;
		}
		if (DamageSources.TryGetValue(dead, out var value))
		{
			return (Object)(object)value == (Object)(object)killer;
		}
		return false;
	}

	public static void ClearDamageSource(PlayableCard card)
	{
		if (!((Object)(object)card == (Object)null))
		{
			DamageSources.Remove(card);
		}
	}

	public static void Init()
	{
		if (!initialized)
		{
			BloodRecompenseBehaviour.Init();
			initialized = true;
		}
	}

	public static bool HasBloodRecompense(CardInfo info)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)info == (Object)null)
		{
			return false;
		}
		return info.Abilities.Contains(BloodRecompenseBehaviour.ability);
	}

	public static BloodRecompenseResult GetResult(PlayableCard card)
	{
		if ((Object)(object)card == (Object)null)
		{
			return null;
		}
		string text = "Squirrel";
		BloodRecompenseInfo bloodRecompenseInfo = ((Card)card).Info.GetBloodRecompenseInfo();
		if (bloodRecompenseInfo != null && !string.IsNullOrEmpty(bloodRecompenseInfo.SpawnCard))
		{
			text = bloodRecompenseInfo.SpawnCard;
		}
		CardInfo cardByName = CardLoader.GetCardByName(text);
		if ((Object)(object)cardByName == (Object)null)
		{
			return null;
		}
		return new BloodRecompenseResult(cardByName);
	}
}
public static class BloodRecompenseExtensions
{
	private const string InfoKey = "OLD_SA.BloodRecompenseInfo";

	public static void AddBloodRecompense(this CardInfo card)
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Invalid comparison between Unknown and I4
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Expected I4, but got Unknown
		if (!((Object)(object)card == (Object)null))
		{
			if ((int)BloodRecompenseBehaviour.ability == 0)
			{
				BloodRecompenseAPI.Init();
			}
			if (!card.Abilities.Contains(BloodRecompenseBehaviour.ability))
			{
				CardExtensions.AddAbilities(card, (Ability[])(object)new Ability[1] { (Ability)(int)BloodRecompenseBehaviour.ability });
			}
		}
	}

	public static void AddBloodRecompense(this CardInfo card, string spawnCard)
	{
		if (!((Object)(object)card == (Object)null))
		{
			card.AddBloodRecompense();
			if (!string.IsNullOrEmpty(spawnCard))
			{
				card.SetBloodRecompenseInfo(new BloodRecompenseInfo(spawnCard));
			}
		}
	}

	public static void SetBloodRecompenseInfo(this CardInfo card, BloodRecompenseInfo info)
	{
		if (!((Object)(object)card == (Object)null) && info != null && !string.IsNullOrEmpty(info.SpawnCard))
		{
			CardExtensions.SetExtendedProperty(card, "OLD_SA.BloodRecompenseInfo", (object)info.SpawnCard);
		}
	}

	public static BloodRecompenseInfo GetBloodRecompenseInfo(this CardInfo card)
	{
		if ((Object)(object)card == (Object)null)
		{
			return null;
		}
		string extendedProperty = CardExtensions.GetExtendedProperty(card, "OLD_SA.BloodRecompenseInfo");
		if (string.IsNullOrEmpty(extendedProperty))
		{
			return null;
		}
		return new BloodRecompenseInfo(extendedProperty);
	}
}
public class BloodRecompenseInfo
{
	public string SpawnCard { get; set; }

	public BloodRecompenseInfo(string card)
	{
		SpawnCard = card;
	}
}
public class BloodRecompenseResult
{
	public CardInfo Card { get; set; }

	public int Count { get; set; }

	public BloodRecompenseResult(CardInfo card)
	{
		Card = card;
		Count = 1;
	}
}
[HarmonyPatch(typeof(PlayableCard), "TakeDamage")]
public static class BloodRecompenseDamagePatch
{
	public static void Prefix(PlayableCard __instance, int damage, PlayableCard attacker)
	{
		if (!((Object)(object)__instance == (Object)null) && !((Object)(object)attacker == (Object)null))
		{
			BloodRecompenseAPI.RegisterDamageSource(__instance, attacker);
		}
	}
}
public static class BloodRecompenseManager
{
	public static bool Processing;
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.oldsa.BloodRecompense", "OLD_SA_BloodRecompense", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private static ManualLogSource Log;

	private void Awake()
	{
		Log = ((BaseUnityPlugin)this).Logger;
		Log.LogInfo((object)"OLD_SA_BloodRecompense Mod loaded successfully.");
		BloodRecompenseBehaviour.Init();
		Log.LogInfo((object)"Blood Recompense ability initialized.");
	}
}
public static class BloodRecompenseSpawnAPI
{
	public static IEnumerator SpawnToHand(CardInfo card)
	{
		if (!((Object)(object)card == (Object)null))
		{
			yield return Singleton<CardSpawner>.Instance.SpawnCardToHand(card, 0.5f);
		}
	}

	public static IEnumerator SpawnToHand(string cardName)
	{
		CardInfo card = CardLoader.GetCardByName(cardName);
		if (!((Object)(object)card == (Object)null))
		{
			yield return SpawnToHand(card);
		}
	}
}
public class BloodRecompenseBehaviour : AbilityBehaviour
{
	public static Ability ability;

	public override Ability Ability => ability;

	public static void Init()
	{
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: 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)
		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "BloodRecompense";
		val.rulebookName = "Blood Recompense";
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Blood_Recompense.png", (FilterMode)0);
		Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("OldSa_Blood_Recompense_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 [creature] eliminates another creature, the owner gains a specific card in their hand.");
		}
		val.metaCategories = new List<AbilityMetaCategory>
		{
			(AbilityMetaCategory)0,
			(AbilityMetaCategory)2,
			(AbilityMetaCategory)1,
			(AbilityMetaCategory)3
		};
		val.powerLevel = 3;
		val.opponentUsable = false;
		FullAbility val2 = AbilityManager.Add("OLD_SA", val, typeof(BloodRecompenseBehaviour), imageAsTexture);
		ability = val2.Id;
		Debug.Log((object)("Blood Recompense ability registered ID=" + ((object)Unsafe.As<Ability, Ability>(ref ability)/*cast due to .constrained prefix*/).ToString()));
	}

	public override bool RespondsToOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
	{
		return (Object)(object)killer == (Object)(object)((AbilityBehaviour)this).Card;
	}

	public override IEnumerator OnOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
	{
		yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
		BloodRecompenseResult result = BloodRecompenseAPI.GetResult(((AbilityBehaviour)this).Card);
		if (result != null && !((Object)(object)result.Card == (Object)null))
		{
			CardInfo spawn = (CardInfo)result.Card.Clone();
			ModifySpawnedCard(spawn);
			yield return BloodRecompenseSpawnAPI.SpawnToHand(spawn);
			Singleton<ViewManager>.Instance.SwitchToView((View)0, false, false);
			yield return (object)new WaitForSeconds(0.5f);
			yield return SigilDialogueAPI.ShowFirstTime("BloodRecompense", "A new cycle begins... Even death can give birth to new life.");
			if ((Object)(object)card != (Object)null)
			{
				BloodRecompenseAPI.ClearDamageSource(card);
			}
			Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
		}
	}

	private void ModifySpawnedCard(CardInfo card)
	{
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Expected O, but got Unknown
		List<Ability> list = new List<Ability>(((Card)((AbilityBehaviour)this).Card).Info.Abilities);
		foreach (CardModificationInfo temporaryMod in ((AbilityBehaviour)this).Card.TemporaryMods)
		{
			list.AddRange(temporaryMod.abilities);
		}
		list.RemoveAll((Ability x) => x == ability);
		if (list.Count != 0)
		{
			CardModificationInfo val = new CardModificationInfo();
			val.fromCardMerge = true;
			val.abilities = list;
			card.Mods.Add(val);
		}
	}
}

Sigil/OldSa_Bloodlust Rising_sigil.dll

Decompiled 3 hours ago
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 InscryptionAPI.Card;
using InscryptionAPI.Helpers;
using OLD_SA.SmallSigils;
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_Bloodlust Rising_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Bloodlust Rising_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c833c51f-3b0b-4b13-b19e-49596ad94f6c")]
[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.BloodlustRising;

public static class BloodlustRisingAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Bloodlust Rising";
		val.rulebookName = "Bloodlust Rising";
		val.metaCategories = new List<AbilityMetaCategory>
		{
			(AbilityMetaCategory)0,
			(AbilityMetaCategory)1
		};
		val.powerLevel = 3;
		val.opponentUsable = true;
		val.canStack = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Bloodlust_Rising.png", (FilterMode)0);
		FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(val, "When [creature] kills a creature, it gains 2 Gluttony.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(BloodlustRisingBehaviour), imageAsTexture);
	}
}
public class BloodlustRisingBehaviour : AbilityBehaviour
{
	public override Ability Ability => BloodlustRisingAPI.ability.Id;

	public override bool RespondsToOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
	{
		return (Object)(object)killer == (Object)(object)((AbilityBehaviour)this).Card;
	}

	public override IEnumerator OnOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
	{
		if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && !((AbilityBehaviour)this).Card.Dead)
		{
			yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
			SmallSigilManager.AddStacks(((AbilityBehaviour)this).Card, (SmallSigilType)2, 2);
			yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
		}
	}
}
[BepInPlugin("OLD_SA.BloodlustRising", "OLD SA Bloodlust Rising", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		BloodlustRisingAPI.Init();
	}
}

Sigil/OldSa_Bloody_Gear_sigil.dll

Decompiled 3 hours ago
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.SmallSigils;
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_Bloody_Gear_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Bloody_Gear_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("072ebb55-b632-4135-8de6-6cafa189d64a")]
[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.BloodyGear;

public static class BloodyGearAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Bloody Gear";
		val.rulebookName = "Bloody Gear";
		val.metaCategories = new List<AbilityMetaCategory>
		{
			(AbilityMetaCategory)0,
			(AbilityMetaCategory)1
		};
		val.powerLevel = 4;
		val.opponentUsable = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Bloody_Gear.png", (FilterMode)0);
		FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(val, "When [creature] deals damage, give the struck creature 1 Blood. When it dies, create a Flesh in your hand.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(BloodyGearBehaviour), imageAsTexture);
	}
}
public class BloodyGearBehaviour : AbilityBehaviour
{
	private readonly HashSet<PlayableCard> BloodTargets = new HashSet<PlayableCard>();

	public override Ability Ability => BloodyGearAPI.ability.Id;

	public override bool RespondsToDealDamage(int amount, PlayableCard target)
	{
		if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null)
		{
			return false;
		}
		if (amount <= 0)
		{
			return false;
		}
		if ((Object)(object)target == (Object)null)
		{
			return false;
		}
		if (target.Dead)
		{
			return false;
		}
		return true;
	}

	public override IEnumerator OnDealDamage(int amount, PlayableCard target)
	{
		yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
		if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && !((Object)(object)target == (Object)null) && !target.Dead)
		{
			SmallSigilManager.AddStacks(target, (SmallSigilType)3, 1);
			BloodTargets.Add(target);
			yield return (object)new WaitForSeconds(0.15f);
		}
	}

	public override bool RespondsToOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
	{
		if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null)
		{
			return false;
		}
		if ((Object)(object)card == (Object)null)
		{
			return false;
		}
		return BloodTargets.Contains(card);
	}

	public override IEnumerator OnOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
	{
		yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
		if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || (Object)(object)card == (Object)null || !BloodTargets.Contains(card))
		{
			yield break;
		}
		int bloodStacks = SmallSigilManager.GetStacks(card, (SmallSigilType)3);
		List<Tribe> inheritedTribes = null;
		if ((Object)(object)((Card)card).Info != (Object)null && ((Card)card).Info.tribes != null)
		{
			inheritedTribes = new List<Tribe>(((Card)card).Info.tribes);
		}
		BloodTargets.Remove(card);
		if (bloodStacks <= 0)
		{
			yield break;
		}
		CardInfo flesh = CardLoader.GetCardByName("OLD_SA_BROKEN_FLESH");
		if ((Object)(object)flesh == (Object)null)
		{
			yield break;
		}
		object obj = flesh.Clone();
		CardInfo clone = (CardInfo)((obj is CardInfo) ? obj : null);
		if ((Object)(object)clone == (Object)null)
		{
			yield break;
		}
		CardModificationInfo statMod = new CardModificationInfo();
		statMod.attackAdjustment = bloodStacks - clone.Attack;
		statMod.healthAdjustment = bloodStacks - clone.Health;
		clone.Mods.Add(statMod);
		if (inheritedTribes != null)
		{
			clone.tribes = new List<Tribe>(inheritedTribes);
		}
		if ((Object)(object)((Card)card).Info != (Object)null && ((Card)card).Info.Mods != null)
		{
			foreach (CardModificationInfo originalMod in ((Card)card).Info.Mods)
			{
				if (originalMod != null)
				{
					CardModificationInfo copiedMod = (CardModificationInfo)originalMod.Clone();
					if (copiedMod != null)
					{
						clone.Mods.Add(copiedMod);
					}
				}
			}
		}
		if ((int)Singleton<ViewManager>.Instance.CurrentView > 0)
		{
			yield return (object)new WaitForSeconds(0.2f);
			Singleton<ViewManager>.Instance.SwitchToView((View)0, false, false);
			yield return (object)new WaitForSeconds(0.2f);
		}
		yield return Singleton<CardSpawner>.Instance.SpawnCardToHand(clone, (List<CardModificationInfo>)null, 0.25f, (Action<PlayableCard>)null);
		yield return (object)new WaitForSeconds(0.45f);
		yield return ((AbilityBehaviour)this).LearnAbility(0.1f);
	}
}
[BepInPlugin("OLD_SA.Bloody_Gear_sigil", "OldSa Bloody Gear Sigil", "1.0.0")]
public class BloodyGearPlugin : BaseUnityPlugin
{
	public const string PluginGuid = "OLD_SA.Bloody_Gear_sigil";

	public const string PluginName = "OldSa Bloody Gear Sigil";

	public const string PluginVersion = "1.0.0";

	private void Awake()
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		BloodyGearAPI.Init();
		Harmony val = new Harmony("OLD_SA.Bloody_Gear_sigil");
		val.PatchAll(Assembly.GetExecutingAssembly());
	}
}

Sigil/OldSa_Bone_Devourer_sigil.dll

Decompiled 3 hours ago
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 Pixelplacement;
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_Bone_Devourer_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Bone_Devourer_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("499f2d57-312a-4735-b826-444696765434")]
[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.BoneDevourer;

public static class BoneDevourerAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Bone Devourer";
		val.rulebookName = "Bone Devourer";
		val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
		val.powerLevel = 4;
		val.opponentUsable = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Bone_Devourer.png", (FilterMode)0);
		FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(val, "When a bone appears, [creature] devours one. For every 4 bones devoured, [creature] gains 1 Power and 1 Health.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(BoneDevourerBehaviour), imageAsTexture);
	}
}
public class BoneDevourerBehaviour : AbilityBehaviour
{
	private int bonesDevoured;

	public override Ability Ability => BoneDevourerAPI.ability.Id;

	public PlayableCard GetCard()
	{
		return ((AbilityBehaviour)this).Card;
	}

	public IEnumerator DevourBone()
	{
		bonesDevoured++;
		if (bonesDevoured % 4 == 0)
		{
			yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
			Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
			yield return (object)new WaitForSeconds(0.15f);
			CardModificationInfo mod = new CardModificationInfo(1, 1);
			((AbilityBehaviour)this).Card.AddTemporaryMod(mod);
			((Card)((AbilityBehaviour)this).Card).Anim.PlayTransformAnimation();
			yield return (object)new WaitForSeconds(0.15f);
			((Card)((AbilityBehaviour)this).Card).RenderCard();
		}
	}
}
[HarmonyPatch(typeof(Part1ResourcesManager), "ShowAddBones")]
public static class BoneDevourerBonePatch
{
	[HarmonyPrefix]
	private static bool Prefix(Part1ResourcesManager __instance, int amount, CardSlot slot, ref IEnumerator __result)
	{
		__result = ShowAddBonesWithDevourer(__instance, amount, slot);
		return false;
	}

	private static IEnumerator ShowAddBonesWithDevourer(Part1ResourcesManager instance, int amount, CardSlot slot)
	{
		if (!ProgressionData.LearnedMechanic((MechanicsConcept)0))
		{
			yield break;
		}
		BoneDevourerBehaviour devourer = FindBoneDevourer();
		GetBoneTokens(instance);
		bool devoured = false;
		for (int i = 0; i < amount; i++)
		{
			GameObject gameObject = Object.Instantiate<GameObject>(GetBoneTokenPrefab(instance));
			BoneTokenInteractable component = gameObject.GetComponent<BoneTokenInteractable>();
			Component tokenRB = gameObject.GetComponent("Rigidbody");
			if ((Object)(object)slot != (Object)null)
			{
				InvokeRigidbodyMethod(tokenRB, "Sleep");
				gameObject.transform.position = ((Component)slot).transform.position + Vector3.up;
				InvokePushTokenDown(instance, tokenRB);
				Vector3 landingPosition = GetRandomLandingPosition(instance) + Vector3.up;
				Tween.Position(((Component)component).transform, landingPosition, 0.25f, 0.5f, Tween.EaseInOut, (LoopType)0, (Action)null, (Action)delegate
				{
					InvokeRigidbodyMethod(tokenRB, "WakeUp");
					InvokePushTokenDown(instance, tokenRB);
				}, true);
			}
			else
			{
				gameObject.transform.position = GetRandomLandingPosition(instance) + Vector3.up * 5f;
				InvokePushTokenDown(instance, tokenRB);
			}
			if (!devoured && (Object)(object)devourer != (Object)null && (Object)(object)component != (Object)null)
			{
				devoured = true;
				GetBoneTokens(instance)?.Remove(component);
				yield return DevourBoneAnimation(component, devourer);
				yield return devourer.DevourBone();
			}
			else
			{
				GetBoneTokens(instance)?.Add(component);
				SetOrganizedFalse(instance);
			}
			yield return (object)new WaitForSeconds(0.05f);
		}
	}

	private static IEnumerator DevourBoneAnimation(BoneTokenInteractable token, BoneDevourerBehaviour devourer)
	{
		if (!((Object)(object)token == (Object)null) && !((Object)(object)devourer == (Object)null))
		{
			((InteractableBase)token).SetEnabled(false);
			Component rigidbody = ((Component)token).GetComponent("Rigidbody");
			if ((Object)(object)rigidbody != (Object)null)
			{
				Object.Destroy((Object)(object)rigidbody);
			}
			Vector3 target = ((Component)devourer).transform.position + Vector3.up;
			Tween.Position(((Component)token).transform, target, 0.3f, 0f, Tween.EaseInOut, (LoopType)0, (Action)null, (Action)null, true);
			Tween.Rotate(((Component)token).transform, new Vector3(90f, 0f, 90f), (Space)0, 0.3f, 0f, (AnimationCurve)null, (LoopType)0, (Action)null, (Action)null, true);
			AudioController.Instance.PlaySound3D("token_enter_higher", (MixerGroup)4, ((Component)token).transform.position, 1f, 0f, new Pitch((Variation)0), new Repetition(0.05f, ""), (Randomization)null, (Distortion)null, false);
			yield return (object)new WaitForSeconds(0.3f);
			Object.Destroy((Object)(object)((Component)token).gameObject);
		}
	}

	private static BoneDevourerBehaviour FindBoneDevourer()
	{
		if ((Object)(object)Singleton<BoardManager>.Instance == (Object)null)
		{
			return null;
		}
		foreach (CardSlot item in Singleton<BoardManager>.Instance.OpponentSlotsCopy)
		{
			if (!((Object)(object)item == (Object)null) && !((Object)(object)item.Card == (Object)null) && !item.Card.Dead)
			{
				BoneDevourerBehaviour component = ((Component)item.Card).GetComponent<BoneDevourerBehaviour>();
				if ((Object)(object)component != (Object)null)
				{
					return component;
				}
			}
		}
		return null;
	}

	private static GameObject GetBoneTokenPrefab(Part1ResourcesManager instance)
	{
		FieldInfo field = typeof(Part1ResourcesManager).GetField("boneTokenPrefab", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field == null)
		{
			return null;
		}
		object? value = field.GetValue(instance);
		return (GameObject)((value is GameObject) ? value : null);
	}

	private static List<BoneTokenInteractable> GetBoneTokens(Part1ResourcesManager instance)
	{
		FieldInfo field = typeof(Part1ResourcesManager).GetField("boneTokens", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field == null)
		{
			return null;
		}
		return field.GetValue(instance) as List<BoneTokenInteractable>;
	}

	private static Vector3 GetRandomLandingPosition(Part1ResourcesManager instance)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		FieldInfo field = typeof(Part1ResourcesManager).GetField("boneTokenArea", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field == null)
		{
			return Vector3.zero;
		}
		object? value = field.GetValue(instance);
		Transform val = (Transform)((value is Transform) ? value : null);
		if ((Object)(object)val == (Object)null)
		{
			return Vector3.zero;
		}
		return val.position + new Vector3(Random.value * 0.6f, 0f, Random.value * 0.6f);
	}

	private static void InvokePushTokenDown(Part1ResourcesManager instance, Component tokenRB)
	{
		if (!((Object)(object)instance == (Object)null) && !((Object)(object)tokenRB == (Object)null))
		{
			MethodInfo method = typeof(Part1ResourcesManager).GetMethod("PushTokenDown", BindingFlags.Instance | BindingFlags.NonPublic);
			if (!(method == null))
			{
				method.Invoke(instance, new object[1] { tokenRB });
			}
		}
	}

	private static void InvokeRigidbodyMethod(Component component, string methodName)
	{
		if (!((Object)(object)component == (Object)null))
		{
			MethodInfo method = ((object)component).GetType().GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public);
			if (!(method == null))
			{
				method.Invoke(component, null);
			}
		}
	}

	private static void SetOrganizedFalse(Part1ResourcesManager instance)
	{
		FieldInfo field = typeof(Part1ResourcesManager).GetField("isOrganized", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(instance, false);
		}
	}
}
[BepInPlugin("OLD_SA.Bone_Devourer_sigil", "OldSa Bone Devourer Sigil", "1.0.0")]
public class BoneDevourerPlugin : BaseUnityPlugin
{
	public const string PluginGuid = "OLD_SA.Bone_Devourer_sigil";

	public const string PluginName = "OldSa Bone Devourer Sigil";

	public const string PluginVersion = "1.0.0";

	private void Awake()
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		BoneDevourerAPI.Init();
		Harmony val = new Harmony("OLD_SA.Bone_Devourer_sigil");
		val.PatchAll(Assembly.GetExecutingAssembly());
	}
}

Sigil/OldSa_Bones_Armored_sigil.dll

Decompiled 3 hours ago
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 BepInEx.Logging;
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_Bones_Armored_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Bones_Armored_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("26c0943b-8651-422c-bc3a-dd4ee3e65005")]
[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.BonesArmored;

public static class BonesArmoredAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Bones Armored";
		val.rulebookName = "Bones Armored";
		val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
		val.powerLevel = 5;
		val.opponentUsable = false;
		val.canStack = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Bones_Armored.png", (FilterMode)0);
		FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(val, "When [creature] takes damage, if bones are available, it consumes them to prevent that damage.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(BonesArmoredBehaviour), imageAsTexture);
	}
}
public class BonesArmoredBehaviour : AbilityBehaviour
{
	public static Ability ability;

	public override Ability Ability => ability;

	public override bool RespondsToTakeDamage(PlayableCard source)
	{
		if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null)
		{
			return false;
		}
		if (((AbilityBehaviour)this).Card.Dead)
		{
			return false;
		}
		if (!((AbilityBehaviour)this).Card.OnBoard)
		{
			return false;
		}
		if ((Object)(object)source == (Object)null)
		{
			return false;
		}
		return true;
	}

	public override IEnumerator OnTakeDamage(PlayableCard source)
	{
		yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
	}
}
[HarmonyPatch(typeof(PlayableCard), "TakeDamage")]
public static class BonesArmoredPatch
{
	private static readonly MethodInfo PreSuccessfulTriggerSequenceMethod = AccessTools.Method(typeof(AbilityBehaviour), "PreSuccessfulTriggerSequence", (Type[])null, (Type[])null);

	[HarmonyPrefix]
	public static bool Prefix(PlayableCard __instance, int damage, PlayableCard attacker, ref IEnumerator __result)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)__instance == (Object)null)
		{
			return true;
		}
		if (!__instance.HasAbility(BonesArmoredAPI.ability.Id))
		{
			return true;
		}
		if (__instance.Dead)
		{
			return true;
		}
		if (damage <= 0)
		{
			return true;
		}
		int num = damage * 2;
		if (Singleton<ResourcesManager>.Instance.PlayerBones < num)
		{
			return true;
		}
		__result = BonesArmoredTakeDamageSequence(__instance, damage, attacker, num);
		return false;
	}

	private static IEnumerator BonesArmoredTakeDamageSequence(PlayableCard card, int damage, PlayableCard attacker, int requiredBones)
	{
		if ((Object)(object)card == (Object)null || card.Dead)
		{
			yield break;
		}
		BonesArmoredBehaviour behaviour = ((Component)card).GetComponent<BonesArmoredBehaviour>();
		if ((Object)(object)behaviour != (Object)null && PreSuccessfulTriggerSequenceMethod != null)
		{
			object result = PreSuccessfulTriggerSequenceMethod.Invoke(behaviour, null);
			if (result is IEnumerator sequence)
			{
				while (sequence.MoveNext())
				{
					yield return sequence.Current;
				}
			}
		}
		if (!((Object)(object)card == (Object)null) && !card.Dead && Singleton<ResourcesManager>.Instance.PlayerBones >= requiredBones)
		{
			yield return Singleton<ResourcesManager>.Instance.SpendBones(requiredBones);
			if (card.Health > 0)
			{
				((Card)card).Anim.PlayHitAnimation();
			}
			card.OnStatsChanged();
			((Card)card).RenderCard();
			card.UpdateFaceUpOnBoardEffects();
			if ((Object)(object)card.TriggerHandler != (Object)null && card.TriggerHandler.RespondsToTrigger((Trigger)8, new object[1] { attacker }))
			{
				yield return card.TriggerHandler.OnTrigger((Trigger)8, new object[1] { attacker });
			}
		}
	}
}
[BepInPlugin("OLD_SA.BonesArmored", "OLD SA Bones Armored", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public const string PluginGuid = "OLD_SA.BonesArmored";

	public const string PluginName = "OLD SA Bones Armored";

	public const string PluginVersion = "1.0.0";

	internal static ManualLogSource Log;

	private void Awake()
	{
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Expected O, but got Unknown
		Log = ((BaseUnityPlugin)this).Logger;
		Log.LogInfo((object)"[OLD SA Bones Armored] Plugin loaded.");
		BonesArmoredAPI.Init();
		Log.LogInfo((object)"[OLD SA Bones Armored] Bones Armored registered.");
		Harmony val = new Harmony("OLD_SA.BonesArmored");
		val.PatchAll();
		Log.LogInfo((object)"[OLD SA Bones Armored] Harmony patches applied.");
		Log.LogInfo((object)"[OLD SA Bones Armored] Loaded successfully.");
	}
}

Sigil/OldSa_Bones_Feast_sigil.dll

Decompiled 3 hours ago
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_Bones_Feast_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Bones_Feast_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1512c82c-bf7f-48fc-a9f4-68fa5cf86dae")]
[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.BonesFeast;

public static class BonesFeastAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Bones Feast";
		val.rulebookName = "Bones Feast";
		val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
		val.powerLevel = 5;
		val.opponentUsable = false;
		val.canStack = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Bones_Feast.png", (FilterMode)0);
		FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(val, "When a creature is sacrificed to summon [creature], gain 3 Bones from it.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(BonesFeastBehaviour), imageAsTexture);
	}
}
public class BonesFeastBehaviour : AbilityBehaviour
{
	public override Ability Ability => BonesFeastAPI.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 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))
			{
				yield return Singleton<ResourcesManager>.Instance.AddBones(3, ((AbilityBehaviour)this).Card.Slot);
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
			}
		}
	}
}
[HarmonyPatch(typeof(PlayableCard), "Sacrifice")]
public static class BonesFeastSacrificePatch
{
	public static void Prefix(PlayableCard __instance)
	{
		if ((Object)(object)__instance == (Object)null)
		{
			return;
		}
		PlayableCard currentSacrificeDemandingCard = Singleton<BoardManager>.Instance.CurrentSacrificeDemandingCard;
		if (!((Object)(object)currentSacrificeDemandingCard == (Object)null) && !((Object)(object)currentSacrificeDemandingCard == (Object)(object)__instance))
		{
			BonesFeastBehaviour component = ((Component)currentSacrificeDemandingCard).GetComponent<BonesFeastBehaviour>();
			if (!((Object)(object)component == (Object)null))
			{
				((MonoBehaviour)currentSacrificeDemandingCard).StartCoroutine(TriggerBonesFeast(component, __instance));
			}
		}
	}

	private static IEnumerator TriggerBonesFeast(BonesFeastBehaviour behaviour, PlayableCard sacrificedCard)
	{
		if (!((Object)(object)behaviour == (Object)null))
		{
			yield return behaviour.OnOtherCreatureSacrificed(sacrificedCard);
		}
	}
}
[BepInPlugin("OLD_SA.BonesFeast", "OLD SA Bones Feast", "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
		BonesFeastAPI.Init();
		Harmony val = new Harmony("OLD_SA.BonesFeast");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"[OLD SA] Bones Feast loaded.");
	}
}

Sigil/OldSa_Cache_sigil.dll

Decompiled 3 hours ago
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 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_Cache_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Cache_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a730f331-acfb-4291-9da1-08fbe66ea620")]
[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.Cache;

public static class CacheAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Cache";
		val.rulebookName = "Cache";
		val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
		val.powerLevel = 4;
		val.opponentUsable = false;
		val.canStack = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Cache.png", (FilterMode)0);
		FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(val, "When [creature] kills a creature, gain a random item.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(CacheBehaviour), imageAsTexture);
	}
}
public class CacheBehaviour : DrawCreatedCard
{
	public override Ability Ability => CacheAPI.ability.Id;

	protected override CardInfo CardToDraw
	{
		get
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected I4, but got Unknown
			CardInfo cardByName = CardLoader.GetCardByName("OLD_SA_CONSUMABLE_SQUIRREL");
			if ((Object)(object)cardByName != (Object)null)
			{
				cardByName.Mods.AddRange(((AbilityBehaviour)this).GetNonDefaultModsFromSelf((Ability[])(object)new Ability[1] { (Ability)(int)((AbilityBehaviour)this).Ability }));
			}
			return cardByName;
		}
	}

	public override bool RespondsToOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
	{
		return (Object)(object)killer == (Object)(object)((AbilityBehaviour)this).Card;
	}

	public override IEnumerator OnOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
	{
		yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
		if (RunState.Run.consumables.Count < RunState.Run.MaxConsumables)
		{
			RunState.Run.consumables.Add(((Object)ItemsUtil.GetRandomUnlockedConsumable(((TriggerReceiver)this).GetRandomSeed())).name);
			Singleton<ItemsManager>.Instance.UpdateItems(false);
			yield return (object)new WaitForSeconds(0.2f);
			yield return ((AbilityBehaviour)this).LearnAbility(0f);
		}
		else
		{
			yield return ((DrawCreatedCard)this).CreateDrawnCard();
		}
	}
}
[BepInPlugin("OLD_SA.Cache", "OLD SA Cache", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public const string PluginGuid = "OLD_SA.Cache";

	public const string PluginName = "OLD SA Cache";

	public const string PluginVersion = "1.0.0";

	private void Awake()
	{
		((BaseUnityPlugin)this).Logger.LogInfo((object)"[OLD SA Cache] Plugin loaded.");
		try
		{
			CacheAPI.Init();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"[OLD SA Cache] Cache initialized successfully.");
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"[OLD SA Cache] Failed to initialize:");
			((BaseUnityPlugin)this).Logger.LogError((object)ex);
		}
	}
}

Sigil/OldSa_Collect_Bones_sigil.dll

Decompiled 3 hours ago
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 BepInEx.Logging;
using DiskCardGame;
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_Collect_Bones_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Collect_Bones_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("eb1d6f4a-081a-4f5f-9aa1-8c345c9ff1e2")]
[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.Collect_Bones;

public static class CollectBonesAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Collect Bones";
		val.rulebookName = "Collect Bones";
		val.metaCategories = new List<AbilityMetaCategory>
		{
			(AbilityMetaCategory)0,
			(AbilityMetaCategory)1
		};
		val.powerLevel = 3;
		val.opponentUsable = true;
		val.canStack = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Collect_Bones.png", (FilterMode)0);
		Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("OldSa_Collect_Bones_px.png", (FilterMode)0);
		if ((Object)(object)imageAsTexture2 != (Object)null)
		{
			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 another creature dies, if [creature] is on the board, gain 1 Bone.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(CollectBonesBehaviour), imageAsTexture);
	}
}
public class CollectBonesBehaviour : AbilityBehaviour
{
	public override Ability Ability => CollectBonesAPI.ability.Id;

	public override bool RespondsToOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
	{
		return ((AbilityBehaviour)this).Card.OnBoard && (Object)(object)card != (Object)(object)((AbilityBehaviour)this).Card;
	}

	public override IEnumerator OnOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
	{
		yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
		((Card)((AbilityBehaviour)this).Card).Anim.LightNegationEffect();
		yield return Singleton<ResourcesManager>.Instance.AddBones(1, deathSlot);
		yield return ((AbilityBehaviour)this).LearnAbility(0f);
		yield return (object)new WaitForSeconds(0.25f);
	}
}
[BepInPlugin("OLD_SA.Collect_Bones", "OLD SA Collect Bones", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public static ManualLogSource Log;

	private void Awake()
	{
		Log = ((BaseUnityPlugin)this).Logger;
		Log.LogInfo((object)"[OLD SA] Loading Collect Bones...");
		CollectBonesAPI.Init();
		Log.LogInfo((object)"[OLD SA] Collect Bones loaded successfully.");
	}
}

Sigil/OldSa_Crimson_Rush_sigil.dll

Decompiled 3 hours ago
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 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_Crimson_Rush_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Crimson_Rush_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("06293b9e-8de2-401c-8d9c-f9bd1db0b842")]
[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.CrimsonRush;

public static class CrimsonRushAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Crimson Rush";
		val.rulebookName = "Crimson Rush";
		val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
		val.powerLevel = 5;
		val.opponentUsable = false;
		val.canStack = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Crimson_Rush.png", (FilterMode)0);
		FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(val, "When [creature] attacks, it targets opposing creatures first and gains 1 additional attack after a kill.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(CrimsonRushBehaviour), imageAsTexture);
	}
}
public class CrimsonRushBehaviour : AbilityBehaviour
{
	private static readonly Dictionary<PlayableCard, int> KillCounts = new Dictionary<PlayableCard, int>();

	public override Ability Ability => CrimsonRushAPI.ability.Id;

	public static int GetKillCount(PlayableCard card)
	{
		if ((Object)(object)card == (Object)null)
		{
			return 0;
		}
		if (KillCounts.TryGetValue(card, out var value))
		{
			return value;
		}
		return 0;
	}

	public override bool RespondsToOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
	{
		return (Object)(object)killer == (Object)(object)((AbilityBehaviour)this).Card;
	}

	public override IEnumerator OnOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
	{
		yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
		if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && !((AbilityBehaviour)this).Card.Dead)
		{
			int count = GetKillCount(((AbilityBehaviour)this).Card);
			KillCounts[((AbilityBehaviour)this).Card] = count + 1;
			yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
		}
	}

	public static void Clear(PlayableCard card)
	{
		if (!((Object)(object)card == (Object)null))
		{
			KillCounts.Remove(card);
		}
	}
}
[HarmonyPatch(typeof(CombatPhaseManager), "SlotAttackSlot")]
public static class CrimsonRushPatch
{
	private static readonly HashSet<PlayableCard> InternalAttack = new HashSet<PlayableCard>();

	private static void Prefix(CardSlot attackingSlot, ref CardSlot opposingSlot, float waitAfter)
	{
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)attackingSlot == (Object)null)
		{
			return;
		}
		PlayableCard card = attackingSlot.Card;
		if ((Object)(object)card == (Object)null || !card.HasAbility(CrimsonRushAPI.ability.Id))
		{
			return;
		}
		List<CardSlot> list = ((!attackingSlot.IsPlayerSlot) ? Singleton<BoardManager>.Instance.PlayerSlotsCopy : Singleton<BoardManager>.Instance.OpponentSlotsCopy);
		foreach (CardSlot item in list)
		{
			if ((Object)(object)item == (Object)null || (Object)(object)item.Card == (Object)null || item.Card.Dead)
			{
				continue;
			}
			opposingSlot = item;
			break;
		}
	}

	private static void Postfix(CardSlot attackingSlot, CardSlot opposingSlot, float waitAfter, ref IEnumerator __result)
	{
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)attackingSlot == (Object)null)
		{
			return;
		}
		PlayableCard card = attackingSlot.Card;
		if (!((Object)(object)card == (Object)null) && card.HasAbility(CrimsonRushAPI.ability.Id) && !card.Dead)
		{
			int killCount = CrimsonRushBehaviour.GetKillCount(card);
			if (killCount > 0)
			{
				IEnumerator original = __result;
				__result = CrimsonRushAttackRoutine(original, card, attackingSlot, killCount);
			}
		}
	}

	private static IEnumerator CrimsonRushAttackRoutine(IEnumerator original, PlayableCard attackingCard, CardSlot attackingSlot, int killCount)
	{
		yield return original;
		if ((Object)(object)attackingCard == (Object)null || attackingCard.Dead || (Object)(object)attackingCard.Slot == (Object)null)
		{
			yield break;
		}
		CombatPhaseManager combat = Singleton<CombatPhaseManager>.Instance;
		if ((Object)(object)combat == (Object)null)
		{
			yield break;
		}
		int remaining = killCount;
		while (remaining > 0)
		{
			CardSlot target = FindEnemyCreature(attackingSlot);
			if ((Object)(object)target == (Object)null)
			{
				break;
			}
			InternalAttack.Add(attackingCard);
			yield return combat.SlotAttackSlot(attackingSlot, target, 0f);
			InternalAttack.Remove(attackingCard);
			remaining--;
			if ((Object)(object)attackingCard == (Object)null || attackingCard.Dead || (Object)(object)attackingCard.Slot == (Object)null)
			{
				break;
			}
		}
	}

	private static CardSlot FindEnemyCreature(CardSlot attackingSlot)
	{
		if ((Object)(object)attackingSlot == (Object)null)
		{
			return null;
		}
		List<CardSlot> list = ((!attackingSlot.IsPlayerSlot) ? Singleton<BoardManager>.Instance.PlayerSlotsCopy : Singleton<BoardManager>.Instance.OpponentSlotsCopy);
		foreach (CardSlot item in list)
		{
			if ((Object)(object)item == (Object)null || (Object)(object)item.Card == (Object)null || item.Card.Dead)
			{
				continue;
			}
			return item;
		}
		return null;
	}
}
[BepInPlugin("OLD_SA.CrimsonRush", "OLD SA Crimson Rush", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public const string PluginGuid = "OLD_SA.CrimsonRush";

	public const string PluginName = "OLD SA Crimson Rush";

	public const string PluginVersion = "1.0.0";

	private void Awake()
	{
		Debug.Log((object)"[OLD SA Crimson Rush] Plugin loaded.");
		try
		{
			CrimsonRushAPI.Init();
			Debug.Log((object)"[OLD SA Crimson Rush] Crimson Rush registered.");
		}
		catch (Exception ex)
		{
			Debug.LogError((object)"[OLD SA Crimson Rush] Failed to initialize:");
			Debug.LogError((object)ex);
		}
	}
}

Sigil/OldSa_Cunning_sigil.dll

Decompiled 3 hours ago
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<AbilityInfo>();
		((Object)val).name = "Cunning";
		val.rulebookName = "Cunning";
		val.metaCategories = new List<AbilityMetaCategory>
		{
			(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!");
	}
}

Sigil/OldSa_Deadly Fang_sigil.dll

Decompiled 3 hours ago
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 InscryptionAPI.Card;
using InscryptionAPI.Helpers;
using OLD_SA.SmallSigils;
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_Deadly Fang_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Deadly Fang_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e6c3083e-0bee-46d6-949d-33660cb4fdb5")]
[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.DeadlyFang;

public static class DeadlyFangAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Deadly Fang";
		val.rulebookName = "Deadly Fang";
		val.metaCategories = new List<AbilityMetaCategory>
		{
			(AbilityMetaCategory)0,
			(AbilityMetaCategory)1
		};
		val.powerLevel = 3;
		val.opponentUsable = true;
		val.canStack = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Deadly_Fang.png", (FilterMode)0);
		FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(val, "When [creature] attacks, it gives Poison equal to 4 minus its Power to the target.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(DeadlyFangBehaviour), imageAsTexture);
	}
}
public class DeadlyFangBehaviour : AbilityBehaviour
{
	public override Ability Ability => DeadlyFangAPI.ability.Id;

	public override bool RespondsToDealDamage(int amount, PlayableCard target)
	{
		if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead)
		{
			return false;
		}
		if ((Object)(object)target == (Object)null || target.Dead)
		{
			return false;
		}
		return amount > 0;
	}

	public override IEnumerator OnDealDamage(int amount, PlayableCard target)
	{
		if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && !((AbilityBehaviour)this).Card.Dead && !((Object)(object)target == (Object)null) && !target.Dead)
		{
			yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
			int attack = ((AbilityBehaviour)this).Card.Attack;
			int poison = 4 - attack;
			if (poison < 0)
			{
				poison = 0;
			}
			if (poison > 0)
			{
				SmallSigilManager.AddStacks(target, (SmallSigilType)1, poison);
			}
			yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
		}
	}
}
[BepInPlugin("OLD_SA.DeadlyFang", "OLD SA Deadly Fang", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		Debug.Log((object)"[OLD SA] Initializing Deadly Fang...");
		DeadlyFangAPI.Init();
		Debug.Log((object)"[OLD SA] Deadly Fang initialized.");
	}
}

Sigil/OldSa_Death Spray_sigil.dll

Decompiled 3 hours ago
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 InscryptionAPI.Card;
using InscryptionAPI.Helpers;
using OLD_SA.SmallSigils;
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_Death Spray_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Death Spray_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("11770e47-5aec-4f45-b449-5b81d4f62b0f")]
[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.DeathSpray;

public static class DeathSprayAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Death Spray";
		val.rulebookName = "Death Spray";
		val.metaCategories = new List<AbilityMetaCategory>
		{
			(AbilityMetaCategory)0,
			(AbilityMetaCategory)1
		};
		val.powerLevel = 4;
		val.opponentUsable = true;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Death_Spray.png", (FilterMode)0);
		FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(val, "When [creature] dies, it gives 4 Poison to a random enemy.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(DeathSprayBehaviour), imageAsTexture);
	}
}
public class DeathSprayBehaviour : AbilityBehaviour
{
	public override Ability Ability => DeathSprayAPI.ability.Id;

	public override bool RespondsToDie(bool wasSacrifice, PlayableCard killer)
	{
		return !wasSacrifice;
	}

	public override IEnumerator OnDie(bool wasSacrifice, PlayableCard killer)
	{
		yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
		List<PlayableCard> targets = new List<PlayableCard>();
		if (!((AbilityBehaviour)this).Card.OpponentCard)
		{
			foreach (CardSlot slot in Singleton<BoardManager>.Instance.OpponentSlotsCopy)
			{
				if ((Object)(object)slot != (Object)null && (Object)(object)slot.Card != (Object)null && !slot.Card.Dead)
				{
					targets.Add(slot.Card);
				}
			}
		}
		else
		{
			foreach (CardSlot slot2 in Singleton<BoardManager>.Instance.PlayerSlotsCopy)
			{
				if ((Object)(object)slot2 != (Object)null && (Object)(object)slot2.Card != (Object)null && !slot2.Card.Dead)
				{
					targets.Add(slot2.Card);
				}
			}
		}
		if (targets.Count != 0)
		{
			PlayableCard target = targets[Random.Range(0, targets.Count)];
			SmallSigilManager.AddStacks(target, (SmallSigilType)1, 4);
			yield return null;
		}
	}
}
[BepInPlugin("OLD_SA.DeathSpray", "OLD SA Death Spray", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		DeathSprayAPI.Init();
	}
}

Sigil/OldSa_Dragon's Rumble_sigil.dll

Decompiled 3 hours ago
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_Dragon's Rumble_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Dragon's Rumble_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("bf186182-ce7f-4319-9508-a81b593ffaa4")]
[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.DragonsRumble;

public class DragonRumbleAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "DragonsRumble";
		val.rulebookName = "Dragon's Rumble";
		val.powerLevel = 4;
		Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("OldSa_Dragons_Rumble.png", (FilterMode)0);
		ability = AbilityManager.Add("OLD_SA", val, typeof(DragonRumbleBehaviour), (Texture)(object)imageAsTexture);
		val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
		FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(val, "When [creature] dies, it deals 1 damage to a random enemy, increasing each time it takes damage.");
		}
	}

	public static IEnumerator DealDamage(PlayableCard source)
	{
		List<CardSlot> targets = new List<CardSlot>();
		foreach (CardSlot slot in Singleton<BoardManager>.Instance.OpponentSlotsCopy)
		{
			if ((Object)(object)slot.Card != (Object)null && !slot.Card.Dead)
			{
				targets.Add(slot);
			}
		}
		if (targets.Count != 0)
		{
			CardSlot target = targets[Random.Range(0, targets.Count)];
			PlayableCard victim = target.Card;
			if (!((Object)(object)victim == (Object)null) && !victim.Dead)
			{
				yield return victim.TakeDamage(1, source);
			}
		}
	}
}
public class DragonRumbleBehaviour : AbilityBehaviour
{
	public int triggerCount = 1;

	public override Ability Ability => DragonRumbleAPI.ability.Id;

	public void IncreaseTrigger()
	{
		triggerCount++;
	}

	public int GetTriggerCount()
	{
		return triggerCount;
	}

	public void ResetTrigger()
	{
		triggerCount = 1;
	}

	public override bool RespondsToDie(bool wasSacrifice, PlayableCard killer)
	{
		return !wasSacrifice;
	}

	public override IEnumerator OnDie(bool wasSacrifice, PlayableCard killer)
	{
		yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
		int count = triggerCount;
		for (int i = 0; i < count; i++)
		{
			yield return DragonRumbleAPI.DealDamage(((AbilityBehaviour)this).Card);
		}
		yield return SigilDialogueAPI.ShowFirstTime("DragonRumble", "It departs, leaving its enemies to suffer the consequences. But the Ring never ends, and neither does its return.");
		ResetTrigger();
	}
}
[HarmonyPatch(typeof(PlayableCard), "TakeDamage")]
public class DragonRumbleDamagePatch
{
	public static void Prefix(PlayableCard __instance)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)__instance == (Object)null) && __instance.HasAbility(DragonRumbleAPI.ability.Id))
		{
			DragonRumbleBehaviour component = ((Component)__instance).GetComponent<DragonRumbleBehaviour>();
			if (!((Object)(object)component == (Object)null))
			{
				component.IncreaseTrigger();
			}
		}
	}
}
[BepInPlugin("oldsa.dragonsrumble", "Old SA Dragon's Rumble", "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
		DragonRumbleAPI.Init();
		Harmony val = new Harmony("OLD_SA.DragonsRumble");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Dragon's Rumble Loaded");
	}
}

Sigil/OldSa_Entangle_sigil.dll

Decompiled 3 hours ago
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 BepInEx.Logging;
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_Entangle_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Entangle_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8d842e27-b6fa-4e64-8a4e-544a73a8f7d7")]
[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.Entangle;

public static class EntangleAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Entangle";
		val.rulebookName = "Entangle";
		val.metaCategories = new List<AbilityMetaCategory>
		{
			(AbilityMetaCategory)0,
			(AbilityMetaCategory)1
		};
		val.powerLevel = 3;
		val.opponentUsable = true;
		val.canStack = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Entangle.png", (FilterMode)0);
		Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("OldSa_Entangle_px.png", (FilterMode)0);
		if ((Object)(object)imageAsTexture2 != (Object)null)
		{
			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 [creature] is killed, the creature that killed it permanently loses 2 attack.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(EntangleBehaviour), imageAsTexture);
	}
}
public class EntangleBehaviour : AbilityBehaviour
{
	public override Ability Ability => EntangleAPI.ability.Id;

	public override bool RespondsToOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
	{
		if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null)
		{
			return false;
		}
		if (((AbilityBehaviour)this).Card.Dead)
		{
			return false;
		}
		if ((Object)(object)card != (Object)(object)((AbilityBehaviour)this).Card)
		{
			return false;
		}
		if ((Object)(object)killer == (Object)null)
		{
			return false;
		}
		return true;
	}

	public override IEnumerator OnOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
	{
		yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
		if (!((Object)(object)killer == (Object)null) && !killer.Dead)
		{
			EntangleManager.ApplyAttackPenalty(killer);
			((Card)killer).Anim.StrongNegationEffect();
			yield return (object)new WaitForSeconds(0.15f);
		}
	}
}
public static class EntangleManager
{
	public static void ApplyAttackPenalty(PlayableCard killer)
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Expected O, but got Unknown
		if (!((Object)(object)killer == (Object)null) && !killer.Dead)
		{
			CardModificationInfo val = new CardModificationInfo
			{
				attackAdjustment = -2
			};
			killer.AddTemporaryMod(val);
		}
	}
}
[BepInPlugin("OLD_SA.Entangle", "OLD SA Entangle", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public const string PluginGuid = "OLD_SA.Entangle";

	public const string PluginName = "OLD SA Entangle";

	public const string PluginVersion = "1.0.0";

	public static ManualLogSource Log;

	private void Awake()
	{
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Expected O, but got Unknown
		Log = ((BaseUnityPlugin)this).Logger;
		Log.LogInfo((object)"[OLD_SA] Loading Entangle...");
		EntangleAPI.Init();
		Harmony val = new Harmony("OLD_SA.Entangle");
		val.PatchAll();
		Log.LogInfo((object)"[OLD_SA] Entangle loaded successfully.");
	}
}

Sigil/OldSa_Fileswarm_sigil.dll

Decompiled 3 hours ago
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 BepInEx.Logging;
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_Fileswarm_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Fileswarm_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3f6db44f-2c66-4b89-8024-9fe90b8daf9f")]
[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.Fileswarm;

public static class FileswarmAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Fileswarm";
		val.rulebookName = "Fileswarm";
		val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
		val.powerLevel = 4;
		val.opponentUsable = false;
		val.canStack = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Fileswarm.png", (FilterMode)0);
		Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("OldSa_Fileswarm_px.png", (FilterMode)0);
		if ((Object)(object)imageAsTexture2 != (Object)null)
		{
			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 ally dies, [creature] summons a card in its place.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(FileswarmBehaviour), imageAsTexture);
		FileswarmBehaviour.ability = ability.Id;
	}
}
public class FileswarmBehaviour : AbilityBehaviour
{
	private class FileswarmSpawnMarker : MonoBehaviour
	{
		public int SourceId;
	}

	public static Ability ability;

	private const string EXTENDED_PROPERTY = "Fileswarm";

	private const string DEFAULT_CARD = "Squirrel";

	private const string REJECT_DIALOGUE = "FileswarmReject";

	private const string SUCCESS_DIALOGUE = "FileswarmSuccess";

	public override Ability Ability => ability;

	public override bool RespondsToOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
	{
		if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || !((AbilityBehaviour)this).Card.OnBoard || ((AbilityBehaviour)this).Card.Dead)
		{
			return false;
		}
		if ((Object)(object)card == (Object)null || (Object)(object)deathSlot == (Object)null)
		{
			return false;
		}
		if (!fromCombat)
		{
			return false;
		}
		if (card.OpponentCard != ((AbilityBehaviour)this).Card.OpponentCard)
		{
			return false;
		}
		if ((Object)(object)card == (Object)(object)((AbilityBehaviour)this).Card)
		{
			return false;
		}
		if ((Object)(object)((Card)card).Info == (Object)null)
		{
			return false;
		}
		FileswarmSpawnMarker component = ((Component)card).GetComponent<FileswarmSpawnMarker>();
		if ((Object)(object)component != (Object)null && component.SourceId == ((Object)this).GetInstanceID())
		{
			return false;
		}
		return true;
	}

	public override IEnumerator OnOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
	{
		if ((Object)(object)card == (Object)null || (Object)(object)((Card)card).Info == (Object)null || (Object)(object)deathSlot == (Object)null)
		{
			yield break;
		}
		yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
		if (((Card)card).Info.HasTrait((Trait)12) || ((Card)card).Info.HasTrait((Trait)13))
		{
			((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
			yield return (object)new WaitForSeconds(0.15f);
			yield return SigilDialogueAPI.ShowFirstTime("FileswarmReject", "You really think this will work?");
			yield break;
		}
		yield return (object)new WaitForSeconds(0.5f);
		if ((Object)(object)deathSlot == (Object)null)
		{
			yield break;
		}
		string spawnedCardName = CardExtensions.GetExtendedProperty(((Card)((AbilityBehaviour)this).Card).Info, "Fileswarm");
		if (string.IsNullOrWhiteSpace(spawnedCardName))
		{
			spawnedCardName = "Squirrel";
		}
		CardInfo spawnedCard = CardLoader.GetCardByName(spawnedCardName);
		if ((Object)(object)spawnedCard == (Object)null || ((Object)(object)deathSlot.Card != (Object)null && !deathSlot.Card.Dead))
		{
			yield break;
		}
		yield return Singleton<BoardManager>.Instance.CreateCardInSlot(spawnedCard, deathSlot, 0.15f, true);
		if (!((Object)(object)deathSlot.Card == (Object)null))
		{
			FileswarmSpawnMarker marker = ((Component)deathSlot.Card).gameObject.GetComponent<FileswarmSpawnMarker>();
			if ((Object)(object)marker == (Object)null)
			{
				marker = ((Component)deathSlot.Card).gameObject.AddComponent<FileswarmSpawnMarker>();
			}
			marker.SourceId = ((Object)this).GetInstanceID();
			yield return SigilDialogueAPI.ShowFirstTime("FileswarmSuccess", "Attracted some annoying stuff...");
			yield return ((AbilityBehaviour)this).LearnAbility(0f);
		}
	}
}
[BepInPlugin("OLD_SA.Fileswarm", "OLD SA Fileswarm", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public const string PluginGuid = "OLD_SA.Fileswarm";

	public const string PluginName = "OLD SA Fileswarm";

	public const string PluginVersion = "1.0.0";

	internal static ManualLogSource Log;

	private void Awake()
	{
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Expected O, but got Unknown
		Log = ((BaseUnityPlugin)this).Logger;
		Log.LogInfo((object)"[OLD SA Fileswarm] Plugin loaded.");
		FileswarmAPI.Init();
		Log.LogInfo((object)"[OLD SA Fileswarm] Fileswarm registered.");
		Harmony val = new Harmony("OLD_SA.Fileswarm");
		val.PatchAll();
		Log.LogInfo((object)"[OLD SA Fileswarm] Harmony patches applied.");
		Log.LogInfo((object)"[OLD SA Fileswarm] Loaded successfully.");
	}
}

Sigil/OldSa_Gorebound_sigil.dll

Decompiled 3 hours ago
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<AbilityInfo>();
		((Object)val).name = "Gorebound";
		val.rulebookName = "Gorebound";
		val.metaCategories = new List<AbilityMetaCategory> { (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<BoardManager>.Instance.CurrentSacrificeDemandingCard;
		if (!((Object)(object)currentSacrificeDemandingCard == (Object)null) && !((Object)(object)currentSacrificeDemandingCard == (Object)(object)__instance))
		{
			GoreboundBehaviour component = ((Component)currentSacrificeDemandingCard).GetComponent<GoreboundBehaviour>();
			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.");
	}
}

Sigil/OldSa_Greed's Sin_sigil.dll

Decompiled 3 hours ago
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.SmallSigils;
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_Greed's Sin_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Greed's Sin_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3d4de877-48c9-4c43-ac54-9c4981726cd4")]
[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.GreedSin;

public static class GreedSinAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Greed's Sin";
		val.rulebookName = "Greed's Sin";
		val.metaCategories = new List<AbilityMetaCategory>
		{
			(AbilityMetaCategory)0,
			(AbilityMetaCategory)1
		};
		val.powerLevel = 5;
		val.opponentUsable = true;
		val.canStack = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Greed_Sin.png", (FilterMode)0);
		FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(val, "When [creature] kills another creature, a random opposing creature gains 5 Gluttony.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(GreedSinBehaviour), imageAsTexture);
	}
}
public class GreedSinBehaviour : AbilityBehaviour
{
	public override Ability Ability => GreedSinAPI.ability.Id;

	public override bool RespondsToOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
	{
		return (Object)(object)killer == (Object)(object)((AbilityBehaviour)this).Card;
	}

	public override IEnumerator OnOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
	{
		yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
		for (int i = 0; i < 5; i++)
		{
			List<PlayableCard> allies = new List<PlayableCard>();
			if ((Object)(object)Singleton<BoardManager>.Instance != (Object)null)
			{
				List<CardSlot> slots = Singleton<BoardManager>.Instance.GetSlots(((AbilityBehaviour)this).Card.OpponentCard);
				foreach (CardSlot slot in slots)
				{
					if (!((Object)(object)slot == (Object)null) && !((Object)(object)slot.Card == (Object)null) && !slot.Card.Dead)
					{
						allies.Add(slot.Card);
					}
				}
			}
			if (allies.Count == 0)
			{
				break;
			}
			PlayableCard target = allies[Random.Range(0, allies.Count)];
			if (!((Object)(object)target == (Object)null) && !target.Dead)
			{
				SmallSigilManager.AddStacks(target, (SmallSigilType)2, 1);
				yield return (object)new WaitForSeconds(0.1f);
			}
		}
		yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
	}
}
[BepInPlugin("OLD_SA.GreedSin", "OLD SA Greed's Sin", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Expected O, but got Unknown
		((BaseUnityPlugin)this).Logger.LogInfo((object)"[OLD SA Greed's Sin] Loading...");
		GreedSinAPI.Init();
		Harmony val = new Harmony("OLD_SA.GreedSin");
		val.PatchAll();
	}
}

Sigil/OldSa_Hive Will_sigil.dll

Decompiled 3 hours ago
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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_Hive Will_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Hive Will_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("014ad8de-ec23-4e3d-82f6-36fbdce503a7")]
[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.HiveWill;

public static class HiveWillAPI
{
	public static FullAbility ability;

	public unsafe static void Init()
	{
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: 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<AbilityInfo>();
		((Object)val).name = "HiveWill";
		val.rulebookName = "Hive Will";
		val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Hive_Will.png", (FilterMode)0);
		Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("OldSa_Hive_Will_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 a specific card is played on [creature], they fuse with each other.");
		}
		val.opponentUsable = false;
		val.powerLevel = 0;
		ability = AbilityManager.Add("OLD_SA", val, typeof(HiveWillBehaviour), imageAsTexture);
		Ability id = ability.Id;
		Debug.Log((object)("HiveWill registered ID=" + ((object)(*(Ability*)(&id))/*cast due to .constrained prefix*/).ToString()));
	}
}
public static class HiveWillAssets
{
	public static Sprite LoadSprite(string name)
	{
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		Texture2D imageAsTexture = TextureHelper.GetImageAsTexture(name, (FilterMode)0);
		if ((Object)(object)imageAsTexture == (Object)null)
		{
			return null;
		}
		return Sprite.Create(imageAsTexture, new Rect(0f, 0f, (float)((Texture)imageAsTexture).width, (float)((Texture)imageAsTexture).height), new Vector2(0.5f, 0.5f));
	}
}
public static class HiveWillAudio
{
	public static AudioClip LoadBuzz()
	{
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Expected O, but got Unknown
		string text = Path.Combine(Path.GetDirectoryName(typeof(HiveWillAudio).Assembly.Location), "Audio", "hive_buzz.wav");
		if (!File.Exists(text))
		{
			return null;
		}
		WWW val = new WWW("file:///" + text);
		while (!val.isDone)
		{
		}
		return val.GetAudioClip(false, false);
	}
}
public class HiveWillBehaviour : AbilityBehaviour
{
	public override Ability Ability => HiveWillAPI.ability.Id;
}
[HarmonyPatch(typeof(TurnManager), "set_GameEnded")]
public static class HiveWillCombatEndPatch
{
	public static void Postfix(bool value)
	{
		if (value)
		{
			Debug.Log((object)"HiveWill Combat End Clear Trigger");
			HiveWillTemporaryManager.Clear();
		}
	}
}
public class HiveWillIconShake : MonoBehaviour
{
	private float angle = 4f;

	private float speed = 35f;

	private Quaternion startRotation;

	public void StartShake()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		startRotation = ((Component)this).transform.localRotation;
	}

	private void Update()
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		float num = Mathf.Sin(Time.time * speed) * angle;
		((Component)this).transform.localRotation = startRotation * Quaternion.Euler(0f, 0f, num);
	}
}
public static class HiveWillManager
{
	public static IEnumerator Merge(PlayableCard host, PlayableCard material)
	{
		if ((Object)(object)host == (Object)null || (Object)(object)material == (Object)null)
		{
			HiveWillPatch.Merging = false;
			yield break;
		}
		CardModificationInfo statMod = new CardModificationInfo();
		statMod.attackAdjustment = material.Attack;
		statMod.healthAdjustment = material.Health;
		statMod.fromCardMerge = true;
		host.AddTemporaryMod(statMod);
		if (ShouldInherit(host))
		{
			InheritAbilities(host, material);
		}
		Singleton<PlayerHand>.Instance.RemoveCardFromHand(material);
		((Component)material).gameObject.SetActive(false);
		yield return (object)new WaitForSeconds(0.2f);
		((Card)host).Anim.PlayTransformAnimation();
		yield return (object)new WaitForSeconds(0.8f);
		((Card)host).RenderCard();
		try
		{
			yield return SigilDialogueAPI.ShowFirstTime("HiveWill", "She shall lead her swarm to victory.", host);
		}
		finally
		{
			HiveWillSelectionPatch.DisableFlying();
			((Card)host).Anim.SetSelectedToPlay(false);
			HiveWillPatch.Merging = false;
			Singleton<ViewManager>.Instance.SwitchToView((View)0, false, false);
		}
	}

	private static bool ShouldInherit(PlayableCard host)
	{
		string extendedProperty = CardExtensions.GetExtendedProperty(((Card)host).Info, "OLD_SA.HiveWillInherit");
		if (extendedProperty == "false")
		{
			return false;
		}
		return true;
	}

	private static void InheritAbilities(PlayableCard host, PlayableCard material)
	{
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Expected O, but got Unknown
		//IL_015c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0162: Expected O, but got Unknown
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		List<Ability> list = new List<Ability>();
		foreach (CardModificationInfo mod in ((Card)material).Info.Mods)
		{
			if (mod.abilities == null || !mod.fromCardMerge)
			{
				continue;
			}
			foreach (Ability ability in mod.abilities)
			{
				if (!host.HasAbility(ability) && !list.Contains(ability))
				{
					list.Add(ability);
				}
			}
		}
		if (list.Count != 0)
		{
			CardModificationInfo val = new CardModificationInfo();
			val.abilities = new List<Ability>(list);
			val.fromCardMerge = true;
			val.singletonId = "OLD_SA_HIVEWILL";
			Debug.Log((object)("HiveWill Add Temporary Mod: " + ((Object)((Card)host).Info).name + " ID=" + val.singletonId + " Abilities=" + string.Join(",", list)));
			host.AddTemporaryMod(val);
			CardModificationInfo val2 = new CardModificationInfo();
			val2.abilities = new List<Ability>(list);
			val2.fromCardMerge = true;
			val2.singletonId = "OLD_SA_HIVEWILL";
			((Card)host).Info.Mods.Add(val2);
			Debug.Log((object)("HiveWill Add Display Mod: " + ((Object)((Card)host).Info).name + " ID=" + val2.singletonId));
			HiveWillTemporaryManager.Register(host);
			host.OnStatsChanged();
			((Card)host).RenderCard();
		}
	}
}
[HarmonyPatch(typeof(BoardManager))]
public static class HiveWillPatch
{
	public static bool Merging;

	[HarmonyPatch("ChooseSlot")]
	[HarmonyPrefix]
	public static void ChooseSlotPrefix(List<CardSlot> validSlots)
	{
		if (validSlots == null)
		{
			return;
		}
		PlayableCard choosingSlotCard = Singleton<PlayerHand>.Instance.ChoosingSlotCard;
		if ((Object)(object)choosingSlotCard == (Object)null)
		{
			return;
		}
		foreach (CardSlot item in Singleton<BoardManager>.Instance.PlayerSlotsCopy)
		{
			if (!((Object)(object)item.Card == (Object)null))
			{
				PlayableCard card = item.Card;
				if (HasHiveWill(card) && IsHiveWillTarget(card, choosingSlotCard) && !validSlots.Contains(item))
				{
					validSlots.Add(item);
				}
			}
		}
	}

	[HarmonyPatch("OnSlotSelected")]
	[HarmonyPrefix]
	public static bool OnSlotSelectedPrefix(CardSlot slot)
	{
		if (Merging)
		{
			return false;
		}
		if ((Object)(object)slot == (Object)null)
		{
			return true;
		}
		if ((Object)(object)slot.Card == (Object)null)
		{
			return true;
		}
		PlayableCard card = slot.Card;
		if (!HasHiveWill(card))
		{
			return true;
		}
		PlayableCard choosingSlotCard = Singleton<PlayerHand>.Instance.ChoosingSlotCard;
		if ((Object)(object)choosingSlotCard == (Object)null)
		{
			return true;
		}
		if (!IsHiveWillTarget(card, choosingSlotCard))
		{
			return true;
		}
		Merging = true;
		HiveWillSelectionPatch.DisableFlying();
		Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
		((MonoBehaviour)card).StartCoroutine(HiveWillManager.Merge(card, choosingSlotCard));
		return false;
	}

	private static bool IsHiveWillTarget(PlayableCard host, PlayableCard card)
	{
		string text = CardExtensions.GetExtendedProperty(((Card)host).Info, "OLD_SA.HiveWillTarget");
		if (string.IsNullOrEmpty(text))
		{
			text = "Squirrel";
		}
		return ((Object)((Card)card).Info).name == text;
	}

	private static bool HasHiveWill(PlayableCard card)
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		if (((Card)card).Info.Abilities.Contains(HiveWillAPI.ability.Id))
		{
			return true;
		}
		foreach (CardModificationInfo temporaryMod in card.TemporaryMods)
		{
			if (temporaryMod.abilities.Contains(HiveWillAPI.ability.Id))
			{
				return true;
			}
		}
		return false;
	}
}
public static class HiveWillSelectionEffect
{
	private static GameObject currentIcon;

	public static void Show(PlayableCard card)
	{
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Expected O, but got Unknown
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)card == (Object)null) && !((Object)(object)currentIcon != (Object)null))
		{
			Sprite val = HiveWillAssets.LoadSprite("HiveIcon.png");
			if ((Object)(object)val == (Object)null)
			{
				Debug.Log((object)"Missing HiveIcon");
				return;
			}
			currentIcon = new GameObject("HiveWillIcon");
			currentIcon.transform.position = ((Component)card).transform.position + new Vector3(0f, 0.8f, 0f);
			currentIcon.transform.rotation = Quaternion.Euler(90f, 0f, 0f);
			SpriteRenderer val2 = currentIcon.AddComponent<SpriteRenderer>();
			val2.sprite = val;
			((Renderer)val2).sortingOrder = 999;
			HiveWillIconShake hiveWillIconShake = currentIcon.AddComponent<HiveWillIconShake>();
			hiveWillIconShake.StartShake();
		}
	}

	public static void Hide()
	{
		if ((Object)(object)currentIcon != (Object)null)
		{
			Object.Destroy((Object)(object)currentIcon);
		}
		currentIcon = null;
	}

	public static bool IsShowing()
	{
		return (Object)(object)currentIcon != (Object)null;
	}
}
public static class HiveWillSelectionManager
{
	public static PlayableCard Material;

	public static PlayableCard Target;

	public static bool Choosing;

	public static void StartSelection(PlayableCard material, PlayableCard target)
	{
		Material = material;
		Target = target;
		Choosing = true;
		if ((Object)(object)Target != (Object)null && (Object)(object)((Card)Target).Anim != (Object)null)
		{
			((Card)Target).Anim.SetSelectedToPlay(true);
		}
	}

	public static void Finish()
	{
		if (!((Object)(object)Material == (Object)null) && !((Object)(object)Target == (Object)null))
		{
			((MonoBehaviour)Target).StartCoroutine(HiveWillManager.Merge(Target, Material));
			Choosing = false;
			Material = null;
			Target = null;
		}
	}

	private static bool IsHiveWillTarget(PlayableCard host, PlayableCard card)
	{
		string text = CardExtensions.GetExtendedProperty(((Card)host).Info, "OLD_SA.HiveWillTarget");
		if (string.IsNullOrEmpty(text))
		{
			text = "Squirrel";
		}
		return ((Object)((Card)card).Info).name == text;
	}

	private static void InheritAbilities(PlayableCard host, PlayableCard material)
	{
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_012e: Expected O, but got Unknown
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		Debug.Log((object)"=== HiveWill Ability Inherit ===");
		Debug.Log((object)("Material: " + ((Object)((Card)material).Info).name));
		Debug.Log((object)("TemporaryMods Count: " + material.TemporaryMods.Count));
		HashSet<Ability> hashSet = new HashSet<Ability>();
		foreach (CardModificationInfo temporaryMod in material.TemporaryMods)
		{
			if (temporaryMod.abilities == null)
			{
				continue;
			}
			Debug.Log((object)("Found Mod Abilities: " + string.Join(", ", temporaryMod.abilities)));
			foreach (Ability ability in temporaryMod.abilities)
			{
				hashSet.Add(ability);
			}
		}
		hashSet.Remove(HiveWillAPI.ability.Id);
		if (hashSet.Count == 0)
		{
			Debug.Log((object)"No extra abilities found.");
			return;
		}
		CardModificationInfo val = new CardModificationInfo();
		val.fromCardMerge = true;
		val.abilities = new List<Ability>(hashSet);
		host.AddTemporaryMod(val);
	}
}
[HarmonyPatch(typeof(PlayerHand))]
public static class HiveWillSelectionPatch
{
	private static HashSet<PlayableCard> ActiveCards = new HashSet<PlayableCard>();

	[HarmonyPatch("ManagedUpdate")]
	[HarmonyPostfix]
	public static void UpdateCheck()
	{
		PlayerHand instance = Singleton<PlayerHand>.Instance;
		if (!((Object)(object)instance == (Object)null))
		{
			if ((Object)(object)instance.ChoosingSlotCard != (Object)null)
			{
				CheckHiveWill(instance.ChoosingSlotCard);
			}
			else
			{
				DisableFlying();
			}
		}
	}

	private static void CheckHiveWill(PlayableCard material)
	{
		HashSet<PlayableCard> hashSet = new HashSet<PlayableCard>();
		foreach (CardSlot item in Singleton<BoardManager>.Instance.PlayerSlotsCopy)
		{
			if ((Object)(object)item.Card == (Object)null)
			{
				continue;
			}
			PlayableCard card = item.Card;
			if (HasHiveWill(card))
			{
				string text = CardExtensions.GetExtendedProperty(((Card)card).Info, "OLD_SA.HiveWillTarget");
				if (string.IsNullOrEmpty(text))
				{
					text = "Squirrel";
				}
				if (!(((Object)((Card)material).Info).name != text))
				{
					hashSet.Add(card);
					EnableFlying(card);
				}
			}
		}
		foreach (PlayableCard item2 in new List<PlayableCard>(ActiveCards))
		{
			if (!hashSet.Contains(item2))
			{
				RemoveFlying(item2);
			}
		}
	}

	private static void EnableFlying(PlayableCard card)
	{
		if (!ActiveCards.Contains(card))
		{
			HiveWillSelectionEffect.Show(card);
			ActiveCards.Add(card);
		}
	}

	private static void RemoveFlying(PlayableCard card)
	{
		if (!((Object)(object)card == (Object)null))
		{
			HiveWillSelectionEffect.Hide();
			ActiveCards.Remove(card);
		}
	}

	public static void DisableFlying()
	{
		foreach (PlayableCard item in new List<PlayableCard>(ActiveCards))
		{
			RemoveFlying(item);
		}
	}

	private static bool HasHiveWill(PlayableCard card)
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		if (((Card)card).Info.Abilities.Contains(HiveWillAPI.ability.Id))
		{
			return true;
		}
		foreach (CardModificationInfo temporaryMod in card.TemporaryMods)
		{
			if (temporaryMod.abilities.Contains(HiveWillAPI.ability.Id))
			{
				return true;
			}
		}
		return false;
	}
}
public static class HiveWillTemporaryManager
{
	private static List<CardInfo> Cards = new List<CardInfo>();

	public static void Register(PlayableCard card)
	{
		if (!((Object)(object)card == (Object)null) && !((Object)(object)((Card)card).Info == (Object)null))
		{
			Debug.Log((object)("HiveWill Register CardInfo = " + ((Object)((Card)card).Info).name));
			if (!Cards.Contains(((Card)card).Info))
			{
				Cards.Add(((Card)card).Info);
			}
		}
	}

	public static void Clear()
	{
		Debug.Log((object)("HiveWill Clear Start Count = " + Cards.Count));
		foreach (CardInfo card in Cards)
		{
			if (!((Object)(object)card == (Object)null))
			{
				Debug.Log((object)("HiveWill Clearing CardInfo = " + ((Object)card).name));
				int count = card.Mods.Count;
				card.Mods.RemoveAll((CardModificationInfo x) => x.singletonId == "OLD_SA_HIVEWILL");
				int count2 = card.Mods.Count;
				Debug.Log((object)("HiveWill Remove Display Mods: " + (count - count2)));
			}
		}
		Cards.Clear();
		Debug.Log((object)"HiveWill Clear Finished");
	}
}
[BepInPlugin("OLD_SA.HiveWill", "OLD_SA Hive Will", "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
		HiveWillAPI.Init();
		Harmony val = new Harmony("OLD_SA.HiveWill");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"OLD_SA Hive Will Loaded");
	}
}

Sigil/OldSa_Immolate_sigil.dll

Decompiled 3 hours ago
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 InscryptionAPI.Card;
using InscryptionAPI.Helpers;
using OLD_SA.SmallSigils;
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_Immolate_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Immolate_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("41436ad8-9195-43e8-ba27-c14a8582321d")]
[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.Immolate;

public static class ImmolateAPI
{
	public static FullAbility ability;

	public unsafe static void Init()
	{
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Immolate";
		val.rulebookName = "Immolate";
		val.metaCategories = new List<AbilityMetaCategory>
		{
			(AbilityMetaCategory)0,
			(AbilityMetaCategory)1
		};
		val.powerLevel = 3;
		val.opponentUsable = true;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Immolate.png", (FilterMode)0);
		FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(val, "At the start of the end, [creature] gives the opposing creature 3 Blaze.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(ImmolateBehaviour), imageAsTexture);
		Ability id = ability.Id;
		Debug.Log((object)("[OLD SA] Immolate registered. ID=" + ((object)(*(Ability*)(&id))/*cast due to .constrained prefix*/).ToString()));
	}
}
public class ImmolateBehaviour : AbilityBehaviour
{
	public static Ability AbilityID => ImmolateAPI.ability.Id;

	public override Ability Ability => AbilityID;

	public override bool RespondsToTurnEnd(bool playerTurnEnd)
	{
		if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead)
		{
			return false;
		}
		return ((AbilityBehaviour)this).Card.OpponentCard != playerTurnEnd;
	}

	public override IEnumerator OnTurnEnd(bool playerTurnEnd)
	{
		if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead)
		{
			yield break;
		}
		CardSlot opposingSlot = ((AbilityBehaviour)this).Card.Slot.opposingSlot;
		if (!((Object)(object)opposingSlot == (Object)null) && !((Object)(object)opposingSlot.Card == (Object)null))
		{
			PlayableCard target = opposingSlot.Card;
			if (!((Object)(object)target == (Object)null) && !target.Dead)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				SmallSigilManager.AddStacks(target, (SmallSigilType)0, 3);
				yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
			}
		}
	}
}
[BepInPlugin("OLD_SA.Immolate", "OLD SA Immolate Sigil", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		Debug.Log((object)"[OLD SA Immolate] Loading...");
		ImmolateAPI.Init();
		Debug.Log((object)"[OLD SA Immolate] Loaded.");
	}
}

Sigil/OldSa_Incorporal_sigil.dll

Decompiled 3 hours ago
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.Pelt;
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_Incorporal_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Incorporal_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("56dcff78-f765-498f-811c-982c4a8a5935")]
[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.Incorporal;

public static class IncorporalAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Incorporal";
		val.rulebookName = "Incorporal";
		val.metaCategories = new List<AbilityMetaCategory>
		{
			(AbilityMetaCategory)0,
			(AbilityMetaCategory)1
		};
		val.powerLevel = 3;
		val.opponentUsable = true;
		val.canStack = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Incorporal.png", (FilterMode)0);
		FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(val, "When [creature] is on the board, it cannot be hit, and it cannot hit enemies.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(IncorporalBehaviour), imageAsTexture);
	}
}
public class IncorporalBehaviour : AbilityBehaviour
{
	public override Ability Ability => IncorporalAPI.ability.Id;

	public override bool RespondsToResolveOnBoard()
	{
		return true;
	}

	public override IEnumerator OnResolveOnBoard()
	{
		yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
		IncorporalState state = IncorporalState.GetOrCreate(((AbilityBehaviour)this).Card);
		if ((Object)(object)state != (Object)null)
		{
			state.Apply((Component)(object)this);
		}
	}
}
[HarmonyPatch(typeof(PlayableCard), "CanAttackDirectly")]
public static class IncorporalDirectAttackPatch
{
	[HarmonyPostfix]
	private static void Postfix(PlayableCard __instance, CardSlot opposingSlot, ref bool __result)
	{
		if ((Object)(object)__instance == (Object)null || (Object)(object)opposingSlot == (Object)null)
		{
			return;
		}
		PlayableCard card = opposingSlot.Card;
		if ((Object)(object)card != (Object)null && (Object)(object)((Card)card).Info != (Object)null && ((Card)card).Info.traits.Contains((Trait)16))
		{
			return;
		}
		IncorporalState component = ((Component)__instance).GetComponent<IncorporalState>();
		if ((Object)(object)component != (Object)null && component.IsIncorporal)
		{
			__result = true;
		}
		else if ((Object)(object)card != (Object)null)
		{
			IncorporalState component2 = ((Component)card).GetComponent<IncorporalState>();
			if ((Object)(object)component2 != (Object)null && component2.IsIncorporal)
			{
				__result = true;
			}
		}
	}
}
public class IncorporalState : MonoBehaviour
{
	private PlayableCard card;

	private readonly HashSet<Component> sources = new HashSet<Component>();

	public bool IsIncorporal => sources.Count > 0;

	private void Awake()
	{
		card = ((Component)this).GetComponent<PlayableCard>();
	}

	public static IncorporalState GetOrCreate(PlayableCard card)
	{
		if ((Object)(object)card == (Object)null)
		{
			return null;
		}
		IncorporalState incorporalState = ((Component)card).GetComponent<IncorporalState>();
		if ((Object)(object)incorporalState == (Object)null)
		{
			incorporalState = ((Component)card).gameObject.AddComponent<IncorporalState>();
		}
		return incorporalState;
	}

	public void Apply(Component source)
	{
		if (!((Object)(object)source == (Object)null))
		{
			if ((Object)(object)card == (Object)null)
			{
				card = ((Component)this).GetComponent<PlayableCard>();
			}
			if (!((Object)(object)card == (Object)null) && sources.Add(source) && sources.Count == 1)
			{
				EnableGhost();
			}
		}
	}

	public void Remove(Component source)
	{
		if (!((Object)(object)source == (Object)null) && sources.Remove(source) && sources.Count <= 0)
		{
			DisableGhost();
		}
	}

	private void EnableGhost()
	{
		if (!((Object)(object)card == (Object)null))
		{
			GhostCard.Apply(card);
		}
	}

	private void DisableGhost()
	{
		if (!((Object)(object)card == (Object)null))
		{
			GhostCard.Remove(card);
		}
	}

	private void OnDestroy()
	{
	}
}
[BepInPlugin("OLD_SA.Incorporal", "OLD SA Incorporal", "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
		IncorporalAPI.Init();
		Harmony val = new Harmony("OLD_SA.Incorporal");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"OLD SA Incorporal loaded.");
	}
}

Sigil/OldSa_Inferno_sigil.dll

Decompiled 3 hours ago
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 InscryptionAPI.Card;
using InscryptionAPI.Helpers;
using InscryptionAPI.Helpers.Extensions;
using OLD_SA.SmallSigils;
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_Inferno_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Inferno_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f922c8b9-44d0-47d2-9c0b-c7807a8cbfad")]
[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.Inferno;

public static class InfernoAPI
{
	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<AbilityInfo>();
		((Object)val).name = "Inferno";
		val.rulebookName = "Inferno";
		val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
		val.powerLevel = 4;
		val.opponentUsable = false;
		val.canStack = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Inferno.png", (FilterMode)0);
		FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(val, "At the start of the turn, [creature] gives 1 Blaze to all opposing creatures.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(InfernoBehaviour), imageAsTexture);
		Ability id = ability.Id;
		Debug.Log((object)("Inferno registered ID=" + ((object)(*(Ability*)(&id))/*cast due to .constrained prefix*/).ToString()));
	}
}
public class InfernoBehaviour : AbilityBehaviour
{
	public static Ability AbilityID => InfernoAPI.ability.Id;

	public override Ability Ability => AbilityID;

	public override bool RespondsToUpkeep(bool playerUpkeep)
	{
		if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead)
		{
			return false;
		}
		return ((AbilityBehaviour)this).Card.OpponentCard != playerUpkeep;
	}

	public override IEnumerator OnUpkeep(bool playerUpkeep)
	{
		if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead)
		{
			yield break;
		}
		yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
		List<PlayableCard> opposingCards = BoardManagerExtensions.GetCards(Singleton<BoardManager>.Instance, !((AbilityBehaviour)this).Card.OpponentCard, (Predicate<PlayableCard>)null);
		foreach (PlayableCard target in opposingCards)
		{
			if (!((Object)(object)target == (Object)null) && !target.Dead)
			{
				SmallSigilManager.AddStacks(target, (SmallSigilType)0, 1);
				yield return null;
			}
		}
		yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
	}
}
[BepInPlugin("OLD_SA.Inferno", "OLD SA Inferno Sigil", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		Debug.Log((object)"[OLD SA Inferno] Loading...");
		InfernoAPI.Init();
		Debug.Log((object)"[OLD SA Inferno] Loaded.");
	}
}

Sigil/OldSa_Martyr's Sting_station.dll

Decompiled 3 hours ago
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_Martyr's Sting_station")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Martyr's Sting_station")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("292d45ee-add0-4f6e-b6d7-c6be983e9d4a")]
[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.MartyrsSting;

public class MartyrsSting : VariableStatBehaviour
{
	public static SpecialStatIcon iconType;

	protected override SpecialStatIcon IconType => iconType;

	public static void Init()
	{
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		StatIconInfo val = ScriptableObject.CreateInstance<StatIconInfo>();
		val.rulebookName = "Martyr's Sting";
		val.rulebookDescription = "The lower this creature's health, the higher its attack.";
		Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("Martyr's Sting.png", (FilterMode)0);
		val.iconGraphic = (Texture)(object)imageAsTexture;
		Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("Martyr's Sting_px.png", (FilterMode)0);
		AbilityExtensions.SetPixelIcon(val, imageAsTexture2, (FilterMode?)null);
		val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
		val.appliesToAttack = true;
		val.appliesToHealth = false;
		FullStatIcon val2 = StatIconManager.Add("OLD_SA", val, typeof(MartyrsSting));
		iconType = val2.Id;
	}

	protected override int[] GetStatValues()
	{
		if ((Object)(object)((SpecialCardBehaviour)this).PlayableCard == (Object)null || (Object)(object)((SpecialCardBehaviour)this).PlayableCard.Slot == (Object)null)
		{
			return new int[2];
		}
		int maxHealth = ((SpecialCardBehaviour)this).PlayableCard.MaxHealth;
		int health = ((SpecialCardBehaviour)this).PlayableCard.Health;
		int num = maxHealth - health;
		return new int[2]
		{
			1 + num,
			0
		};
	}
}
[BepInPlugin("OLD_SA.MartyrsSting", "OLD_SA Martyr's Sting", "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
		MartyrsSting.Init();
		Harmony val = new Harmony("OLD_SA.MartyrsSting");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"OLD_SA Martyr's Sting Loaded");
	}
}

Sigil/OldSa_Penalty_sigil.dll

Decompiled 3 hours ago
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 BepInEx.Logging;
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_Penalty_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Penalty_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3abb0a06-3397-4edd-a979-83e4c193ba69")]
[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.Penalty;

public static class PenaltyAPI
{
	public static FullAbility ability;

	public 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)
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Penalty";
		val.rulebookName = "Penalty";
		val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
		val.powerLevel = -2;
		val.opponentUsable = false;
		val.canStack = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Penalty.png", (FilterMode)0);
		Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("OldSa_Penalty_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 [creature] is played, its owner takes 1 damage.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(PenaltyBehaviour), imageAsTexture);
	}
}
public class PenaltyBehaviour : AbilityBehaviour
{
	private static readonly MethodInfo PreSuccessfulTriggerSequenceMethod = AccessTools.Method(typeof(AbilityBehaviour), "PreSuccessfulTriggerSequence", (Type[])null, (Type[])null);

	public override Ability Ability => PenaltyAPI.ability.Id;

	public override bool RespondsToResolveOnBoard()
	{
		return true;
	}

	public override IEnumerator OnResolveOnBoard()
	{
		if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && !((Object)(object)Singleton<LifeManager>.Instance == (Object)null))
		{
			yield return InvokePreSuccessfulTriggerSequence();
			bool toPlayer = !((AbilityBehaviour)this).Card.OpponentCard;
			yield return Singleton<LifeManager>.Instance.ShowDamageSequence(1, 1, toPlayer, 0.125f, (GameObject)null, 0f, true);
		}
	}

	private IEnumerator InvokePreSuccessfulTriggerSequence()
	{
		if (PreSuccessfulTriggerSequenceMethod == null)
		{
			yield break;
		}
		object result = PreSuccessfulTriggerSequenceMethod.Invoke(this, null);
		if (result is IEnumerator sequence)
		{
			while (sequence.MoveNext())
			{
				yield return sequence.Current;
			}
		}
	}
}
[BepInPlugin("OLD_SA.Penalty", "OLD SA Penalty", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private Harmony harmony;

	private unsafe void Awake()
	{
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Expected O, but got Unknown
		((BaseUnityPlugin)this).Logger.LogInfo((object)"[OLD SA Penalty] Loading...");
		PenaltyAPI.Init();
		if (PenaltyAPI.ability == null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"[OLD SA Penalty] Failed to register Penalty ability!");
			return;
		}
		ManualLogSource logger = ((BaseUnityPlugin)this).Logger;
		Ability id = PenaltyAPI.ability.Id;
		logger.LogInfo((object)("[OLD SA Penalty] Penalty ability registered. ID = " + ((object)(*(Ability*)(&id))/*cast due to .constrained prefix*/).ToString()));
		harmony = new Harmony("OLD_SA.Penalty");
		harmony.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"[OLD SA Penalty] Harmony patches applied.");
		((BaseUnityPlugin)this).Logger.LogInfo((object)"[OLD SA Penalty] Loaded successfully.");
	}

	private void OnDestroy()
	{
		if (harmony != null)
		{
			harmony.UnpatchSelf();
			harmony = null;
		}
		((BaseUnityPlugin)this).Logger.LogInfo((object)"[OLD SA Penalty] Unloaded.");
	}
}

Sigil/OldSa_Pitfall_Trap_sigil.dll

Decompiled 3 hours ago
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 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_Pitfall_Trap_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Pitfall_Trap_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b5f5bff9-b1b2-4cb1-9e58-784a743b478b")]
[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.PitfallTrap;

public static class PitfallTrapAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Pitfall Trap";
		val.rulebookName = "Pitfall Trap";
		val.metaCategories = new List<AbilityMetaCategory>
		{
			(AbilityMetaCategory)0,
			(AbilityMetaCategory)1
		};
		val.powerLevel = 2;
		val.opponentUsable = true;
		val.canStack = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Pitfall_Trap.png", (FilterMode)0);
		Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("OldSa_Pitfall_Trap_px.png", (FilterMode)0);
		if ((Object)(object)imageAsTexture2 != (Object)null)
		{
			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 [creature] is attacked by an Insect, it takes no damage and kills the attacker. It gains 1 Power and 1 Health.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(PitfallTrapBehaviour), imageAsTexture);
	}
}
public class PitfallTrapBehaviour : AbilityBehaviour
{
	public override Ability Ability => PitfallTrapAPI.ability.Id;

	public IEnumerator TriggerPitfall(PlayableCard attacker)
	{
		if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && !((AbilityBehaviour)this).Card.Dead && !((Object)(object)attacker == (Object)null) && !attacker.Dead)
		{
			yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
			if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && !((AbilityBehaviour)this).Card.Dead && !((Object)(object)attacker == (Object)null) && !attacker.Dead)
			{
				yield return attacker.Die(false, ((AbilityBehaviour)this).Card, true);
				CardModificationInfo bonus = new CardModificationInfo
				{
					attackAdjustment = 1,
					healthAdjustment = 1,
					singletonId = "OLD_SA_PitfallTrap_Bonus_" + Guid.NewGuid()
				};
				((AbilityBehaviour)this).Card.AddTemporaryMod(bonus);
				((AbilityBehaviour)this).Card.OnStatsChanged();
				((Card)((AbilityBehaviour)this).Card).RenderCard();
				((AbilityBehaviour)this).Card.UpdateFaceUpOnBoardEffects();
			}
		}
	}
}
internal static class PitfallTrapAttackContext
{
	internal static PlayableCard AttackingCard;

	internal static PlayableCard TargetCard;

	internal static void Set(PlayableCard attackingCard, PlayableCard targetCard)
	{
		AttackingCard = attackingCard;
		TargetCard = targetCard;
	}

	internal static void Clear()
	{
		AttackingCard = null;
		TargetCard = null;
	}
}
[HarmonyPatch(typeof(CombatPhaseManager), "SlotAttackSlot")]
internal static class PitfallTrap_SlotAttackSlot_Patch
{
	[HarmonyPostfix]
	private static void Postfix(CardSlot attackingSlot, CardSlot opposingSlot, ref IEnumerator __result)
	{
		if (__result != null)
		{
			PlayableCard attackingCard = (((Object)(object)attackingSlot != (Object)null) ? attackingSlot.Card : null);
			PlayableCard targetCard = (((Object)(object)opposingSlot != (Object)null) ? opposingSlot.Card : null);
			__result = WrapAttackCoroutine(__result, attackingCard, targetCard);
		}
	}

	private static IEnumerator WrapAttackCoroutine(IEnumerator original, PlayableCard attackingCard, PlayableCard targetCard)
	{
		try
		{
			while (true)
			{
				PitfallTrapAttackContext.Set(attackingCard, targetCard);
				bool hasNext;
				try
				{
					hasNext = original.MoveNext();
				}
				finally
				{
					PitfallTrapAttackContext.Clear();
				}
				if (!hasNext)
				{
					break;
				}
				yield return original.Current;
			}
		}
		finally
		{
			PitfallTrapAttackContext.Clear();
		}
	}
}
[HarmonyPatch(typeof(PlayableCard), "TakeDamage")]
public static class PitfallTrapPatch
{
	[HarmonyPrefix]
	public static bool Prefix(PlayableCard __instance, int damage, PlayableCard attacker, ref IEnumerator __result)
	{
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)__instance == (Object)null)
		{
			return true;
		}
		if ((Object)(object)attacker == (Object)null)
		{
			return true;
		}
		if ((Object)(object)PitfallTrapAttackContext.AttackingCard == (Object)null || (Object)(object)PitfallTrapAttackContext.TargetCard == (Object)null)
		{
			return true;
		}
		if ((Object)(object)attacker != (Object)(object)PitfallTrapAttackContext.AttackingCard)
		{
			return true;
		}
		if ((Object)(object)__instance != (Object)(object)PitfallTrapAttackContext.TargetCard)
		{
			return true;
		}
		if (__instance.Dead)
		{
			return true;
		}
		if (!__instance.HasAbility(PitfallTrapAPI.ability.Id))
		{
			return true;
		}
		if ((Object)(object)((Card)attacker).Info == (Object)null || ((Card)attacker).Info.tribes == null || !((Card)attacker).Info.tribes.Contains((Tribe)6))
		{
			return true;
		}
		PitfallTrapBehaviour pitfallBehaviour = GetPitfallBehaviour(__instance);
		if ((Object)(object)pitfallBehaviour == (Object)null)
		{
			return true;
		}
		__result = pitfallBehaviour.TriggerPitfall(attacker);
		return false;
	}

	private static PitfallTrapBehaviour GetPitfallBehaviour(PlayableCard card)
	{
		if ((Object)(object)card == (Object)null)
		{
			return null;
		}
		AbilityBehaviour[] components = ((Component)card).GetComponents<AbilityBehaviour>();
		if (components == null)
		{
			return null;
		}
		AbilityBehaviour[] array = components;
		foreach (AbilityBehaviour val in array)
		{
			PitfallTrapBehaviour pitfallTrapBehaviour = val as PitfallTrapBehaviour;
			if ((Object)(object)pitfallTrapBehaviour != (Object)null)
			{
				return pitfallTrapBehaviour;
			}
		}
		return null;
	}
}
[BepInPlugin("OLD_SA.PitfallTrap", "OLD SA Pitfall Trap", "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
		PitfallTrapAPI.Init();
		Harmony val = new Harmony("OLD_SA.PitfallTrap");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"OLD SA Pitfall Trap loaded.");
	}
}

Sigil/OldSa_Random_sigil.dll

Decompiled 3 hours ago
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_Random_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Random_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("cf3705a4-140c-4f68-8f0c-b63c824f267b")]
[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.Random;

[BepInPlugin("OLD_SA.Random", "OLD SA Random", "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
		RandomAPI.Init();
		Harmony val = new Harmony("OLD_SA.Random");
		val.PatchAll();
	}
}
public static class RandomAPI
{
	public static FullAbility ability;

	public static Ability RandomAbility;

	public static void Init()
	{
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Random";
		val.rulebookName = "Random";
		val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
		val.powerLevel = -1;
		val.opponentUsable = false;
		val.canStack = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Random.png", (FilterMode)0);
		FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(val, "When [creature] attacks, its target is random.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(RandomBehaviour), imageAsTexture);
		RandomAbility = val.ability;
	}
}
public class RandomBehaviour : AbilityBehaviour
{
	public override Ability Ability => RandomAPI.ability.Id;
}
[HarmonyPatch(typeof(PlayableCard), "GetOpposingSlots")]
public static class RandomPatch
{
	private static int randomCounter;

	[HarmonyPostfix]
	public static void Postfix(PlayableCard __instance, ref List<CardSlot> __result)
	{
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)__instance == (Object)null || (Object)(object)__instance.Slot == (Object)null || __result == null || RandomAPI.ability == null || !__instance.HasAbility(RandomAPI.ability.Id))
		{
			return;
		}
		List<CardSlot> list = (__instance.OpponentCard ? Singleton<BoardManager>.Instance.PlayerSlotsCopy : Singleton<BoardManager>.Instance.OpponentSlotsCopy);
		if (list == null || list.Count == 0)
		{
			return;
		}
		int count = __result.Count;
		if (count > 0)
		{
			List<CardSlot> list2 = new List<CardSlot>();
			for (int i = 0; i < count; i++)
			{
				int randomSeed = GetRandomSeed(__instance, i);
				float num = SeededRandom.Value(randomSeed);
				int num2 = Mathf.FloorToInt(num * (float)list.Count);
				num2 = Mathf.Clamp(num2, 0, list.Count - 1);
				list2.Add(list[num2]);
			}
			__result = list2;
		}
	}

	private static int GetRandomSeed(PlayableCard card, int attackIndex)
	{
		int currentRandomSeed = SaveManager.SaveFile.GetCurrentRandomSeed();
		int num = (((Object)(object)card != (Object)null && (Object)(object)card.Slot != (Object)null) ? card.Slot.Index : 0);
		int num2 = randomCounter++;
		int num3 = currentRandomSeed;
		num3 = num3 * 31 + num;
		num3 = num3 * 31 + attackIndex;
		return num3 * 31 + num2;
	}
}

Sigil/OldSa_Retribution_sigil.dll

Decompiled 3 hours ago
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<AbilityInfo>();
		((Object)val).name = "Retribution";
		val.rulebookName = "Retribution";
		val.metaCategories = new List<AbilityMetaCategory> { (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<CombatPhaseManager>.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<CombatPhaseManager>.Instance.DamageDealtThisPhase;
		if (newDamage <= oldDamage)
		{
			yield break;
		}
		List<CardSlot> targetSlots = ((!opposingSlot.IsPlayerSlot) ? Singleton<BoardManager>.Instance.OpponentSlotsCopy : Singleton<BoardManager>.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<RetributionBehaviour>();
				if (!((Object)(object)behaviour == (Object)null))
				{
					yield return (object)new WaitForSeconds(0.2f);
					yield return behaviour.Trigger(attacker);
				}
			}
		}
	}
}

Sigil/OldSa_Ring Fort_sigil.dll

Decompiled 3 hours ago
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_Ring Fort_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Ring Fort_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c7d3d1e4-a719-44a4-9bbf-73e52029f5e9")]
[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.RingFort;

[BepInPlugin("oldsa.ringfort", "Old SA Ring Fort", "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
		RingFortAPI.Init();
		Harmony val = new Harmony("oldsa.ringfort");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Old SA Ring Fort Loaded");
	}
}
public class RingFortBehaviour : AbilityBehaviour
{
	public override Ability Ability => RingFortAPI.ability.Id;

	public IEnumerator TriggerFirstDialogue()
	{
		yield return SigilDialogueAPI.ShowFirstTime("RingFort", "A pitiful creature... yet this time, it managed to protect everything.", ((AbilityBehaviour)this).Card);
	}
}
public class RingFortAPI
{
	public static FullAbility ability;

	public unsafe static void Init()
	{
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "RingFort";
		val.rulebookName = "Ring Fort";
		val.powerLevel = 5;
		val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
		FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(val, "When [creature] takes damage, it intercepts the attack and reduces that damage by 1.");
		}
		Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("OldSa_Ring_Fort.png", (FilterMode)0);
		ability = AbilityManager.Add("OLD_SA", val, typeof(RingFortBehaviour), (Texture)(object)imageAsTexture);
		Ability id = ability.Id;
		Debug.Log((object)("Ring Fort registered ID = " + ((object)(*(Ability*)(&id))/*cast due to .constrained prefix*/).ToString()));
	}
}
[HarmonyPatch(typeof(CombatPhaseManager), "SlotAttackSlot")]
public class RingFortPatch
{
	public static PlayableCard redirectedCard;

	public static void Prefix(CardSlot attackingSlot, ref CardSlot opposingSlot, float waitAfter)
	{
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		redirectedCard = null;
		if ((Object)(object)attackingSlot == (Object)null || (Object)(object)opposingSlot == (Object)null || (Object)(object)attackingSlot.Card == (Object)null)
		{
			return;
		}
		List<CardSlot> list = ((!attackingSlot.IsPlayerSlot) ? Singleton<BoardManager>.Instance.PlayerSlotsCopy : Singleton<BoardManager>.Instance.OpponentSlotsCopy);
		foreach (CardSlot item in list)
		{
			if ((Object)(object)item.Card == (Object)null || !item.Card.HasAbility(RingFortAPI.ability.Id))
			{
				continue;
			}
			redirectedCard = item.Card;
			opposingSlot = item;
			break;
		}
	}
}
[HarmonyPatch(typeof(PlayableCard), "TakeDamage")]
public class RingFortDamagePatch
{
	public static void Prefix(PlayableCard __instance, ref int damage)
	{
		if ((Object)(object)__instance == (Object)null || !((Object)(object)__instance == (Object)(object)RingFortPatch.redirectedCard))
		{
			return;
		}
		int num = damage;
		damage = Mathf.Max(0, damage - 1);
		if (num > damage && !SigilDialogueSaveData.HasTriggered("RingFort"))
		{
			RingFortBehaviour component = ((Component)__instance).GetComponent<RingFortBehaviour>();
			if ((Object)(object)component != (Object)null)
			{
				((MonoBehaviour)__instance).StartCoroutine(component.TriggerFirstDialogue());
			}
		}
	}
}
[HarmonyPatch(typeof(PlayableCard), "CanAttackDirectly")]
public class RingFortDirectAttackPatch
{
	public static bool Prefix(PlayableCard __instance, CardSlot opposingSlot, ref bool __result)
	{
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)__instance == (Object)null)
		{
			return true;
		}
		if ((Object)(object)opposingSlot == (Object)null)
		{
			return true;
		}
		if ((Object)(object)opposingSlot.Card != (Object)null && opposingSlot.Card.HasAbility(RingFortAPI.ability.Id))
		{
			Debug.Log((object)"Ring Fort blocks direct attack");
			__result = false;
			return false;
		}
		return true;
	}
}

Sigil/OldSa_Royalty_station.dll

Decompiled 3 hours ago
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("OLD_SA.Royalty")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OLD_SA.Royalty")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7879e24e-cb30-4fed-833d-51d78ca3f60b")]
[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.Royalty;

[BepInPlugin("OLD_SA.Royalty", "OLD_SA Royalty", "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
		Royalty.Init();
		Harmony val = new Harmony("OLD_SA.Royalty");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"OLD_SA Royalty Loaded");
	}
}
public class Royalty : VariableStatBehaviour
{
	public static SpecialStatIcon iconType;

	protected override SpecialStatIcon IconType => iconType;

	public static void Init()
	{
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		StatIconInfo val = ScriptableObject.CreateInstance<StatIconInfo>();
		val.rulebookName = "Royalty";
		val.rulebookDescription = "This creature's attack is determined by the number of different tribes present on the board.";
		Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("royalty.png", (FilterMode)0);
		val.iconGraphic = (Texture)(object)imageAsTexture;
		Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("royalty_px.png", (FilterMode)0);
		AbilityExtensions.SetPixelIcon(val, imageAsTexture2, (FilterMode?)null);
		val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
		val.appliesToAttack = true;
		val.appliesToHealth = false;
		FullStatIcon val2 = StatIconManager.Add("OLD_SA", val, typeof(Royalty));
		iconType = val2.Id;
	}

	protected override int[] GetStatValues()
	{
		HashSet<string> hashSet = new HashSet<string>();
		foreach (CardSlot slot in Singleton<BoardManager>.Instance.GetSlots(true))
		{
			AddTribe(slot, hashSet);
		}
		foreach (CardSlot slot2 in Singleton<BoardManager>.Instance.GetSlots(false))
		{
			AddTribe(slot2, hashSet);
		}
		int count = hashSet.Count;
		int num = count;
		int? extendedPropertyAsInt = CardExtensions.GetExtendedPropertyAsInt(((Card)((SpecialCardBehaviour)this).PlayableCard).Info, "OLD_SA.RoyaltyBonus");
		if (extendedPropertyAsInt.HasValue)
		{
			num = extendedPropertyAsInt.Value;
		}
		return new int[2]
		{
			count + num,
			0
		};
	}

	private void AddTribe(CardSlot slot, HashSet<string> tribes)
	{
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)slot.Card == (Object)null)
		{
			return;
		}
		if (((Card)slot.Card).Info.tribes == null || ((Card)slot.Card).Info.tribes.Count == 0)
		{
			tribes.Add("NONE");
			return;
		}
		foreach (Tribe tribe in ((Card)slot.Card).Info.tribes)
		{
			tribes.Add(((object)tribe/*cast due to .constrained prefix*/).ToString());
		}
	}
}

Sigil/OldSa_SmallSigils.dll

Decompiled 3 hours ago
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 InscryptionCommunityPatch.Card;
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_SmallSigils")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_SmallSigils")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1cd49d69-dd3b-4c57-b7ac-6ff7e5278d53")]
[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.SmallSigils;

public class BloodSigilRule : SmallSigilRuleBase
{
	public override SmallSigilType Type => SmallSigilType.Blood;

	public override Type BehaviourType => typeof(BloodStatusEffect);

	public override int Threshold => 1;

	public override SmallSigilAttribute Attribute => SmallSigilAttribute.None;

	public override IEnumerator Effect(PlayableCard card)
	{
		yield break;
	}
}
public class BloodStatusEffect : SmallSigilStatusEffectBehaviour
{
	public override string CardModSingletonName => "OLD_SA_Blood";
}
public class BurningSigilRule : SmallSigilRuleBase
{
	public override SmallSigilType Type => SmallSigilType.Burning;

	public override Type BehaviourType => typeof(BurningStatusEffect);

	public override int Threshold => 2;

	public override SmallSigilCategory Category => SmallSigilCategory.Debuff;

	public override SmallSigilAttribute Attribute => SmallSigilAttribute.Fire;

	public override IEnumerator Effect(PlayableCard card)
	{
		if (!((Object)(object)card == (Object)null))
		{
			yield return card.TakeDamage(1, (PlayableCard)null);
		}
	}
}
public class BurningStatusEffect : SmallSigilStatusEffectBehaviour
{
	public override string CardModSingletonName => "OLD_SA_Burning";
}
public class GluttonySigilRule : SmallSigilRuleBase
{
	public override SmallSigilType Type => SmallSigilType.Gluttony;

	public override Type BehaviourType => typeof(GluttonyStatusEffect);

	public override int Threshold => 3;

	public override SmallSigilCategory Category => SmallSigilCategory.Buff;

	public override SmallSigilAttribute Attribute => SmallSigilAttribute.None;

	public override IEnumerator Effect(PlayableCard card)
	{
		if (!((Object)(object)card == (Object)null))
		{
			int triggerCount = SmallSigilRuleManager.IncrementBattleTriggerCount(card);
			CardModificationInfo mod = new CardModificationInfo(1, 1);
			card.AddTemporaryMod(mod);
			if (triggerCount >= 3)
			{
				yield return card.Die(false, (PlayableCard)null, true);
			}
			else
			{
				yield return null;
			}
		}
	}
}
public class GluttonyStatusEffect : SmallSigilStatusEffectBehaviour
{
	public override string CardModSingletonName => "OLD_SA_Gluttony";
}
[BepInPlugin("OLD_SA.SmallSigils", "OLD SA Small Sigils", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public const string PluginGuid = "OLD_SA.SmallSigils";

	private Harmony harmony;

	public static Plugin Instance { get; private set; }

	private void Awake()
	{
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Expected O, but got Unknown
		Instance = this;
		((BaseUnityPlugin)this).Logger.LogInfo((object)"OLD SA Small Sigils Loaded");
		SmallSigilStatusEffectManager.Initialize("OLD_SA.SmallSigils");
		harmony = new Harmony("OLD_SA.SmallSigils");
		harmony.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"OLD SA Small Sigils patches applied.");
	}

	private void OnDestroy()
	{
		if (harmony != null)
		{
			harmony.UnpatchSelf();
			harmony = null;
		}
		Instance = null;
	}
}
public class PoisonSigilRule : SmallSigilRuleBase
{
	public override SmallSigilType Type => SmallSigilType.Poison;

	public override Type BehaviourType => typeof(PoisonStatusEffect);

	public override int Threshold => 4;

	public override SmallSigilCategory Category => SmallSigilCategory.Debuff;

	public override SmallSigilAttribute Attribute => SmallSigilAttribute.Poison;

	public override IEnumerator Effect(PlayableCard card)
	{
		if (!((Object)(object)card == (Object)null) && !card.HasAbility((Ability)105))
		{
			yield return card.Die(false, (PlayableCard)null, true);
		}
	}
}
public class PoisonStatusEffect : SmallSigilStatusEffectBehaviour
{
	public override string CardModSingletonName => "OLD_SA_Poison";
}
public class SmallSigilAbilityIcons : ManagedBehaviour
{
	public List<AbilityIconInteractable> part1AbilityIcons = new List<AbilityIconInteractable>();

	public List<GameObject> smallSigilIconGroups = new List<GameObject>();

	public List<AbilityIconInteractable> abilityIcons = new List<AbilityIconInteractable>();

	public Material smallSigilMat;

	public Color fireColor = new Color(1f, 0.15f, 0.05f, 1f);

	public Color poisonColor = new Color(0.15f, 1f, 0.15f, 1f);

	public Color noneColor = new Color(0.45f, 0.22f, 0.08f, 1f);
}
[HarmonyPatch]
internal static class SmallSigilAbilityIconsPatch
{
	private const int MaxSmallSigilIcons = 5;

	private const float StartX = 0.4f;

	private const float XSpacing = 0.14f;

	private const float IconY = 0.75f;

	private static readonly Vector3 IconScale = new Vector3(0.1f, 0.075f, 1f);

	[HarmonyPostfix]
	[HarmonyPatch(typeof(CardAbilityIcons), "UpdateAbilityIcons")]
	private static void AddSmallSigilIcons(CardAbilityIcons __instance, PlayableCard playableCard)
	{
		//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01be: Invalid comparison between Unknown and I4
		//IL_022d: Unknown result type (might be due to invalid IL or missing references)
		//IL_023f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0269: Unknown result type (might be due to invalid IL or missing references)
		//IL_0284: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)__instance == (Object)null || !SaveManager.SaveFile.IsPart1 || (Object)(object)playableCard == (Object)null)
		{
			return;
		}
		SmallSigilAbilityIcons smallSigilAbilityIcons = ((Component)__instance).GetComponent<SmallSigilAbilityIcons>();
		if ((Object)(object)smallSigilAbilityIcons == (Object)null)
		{
			smallSigilAbilityIcons = ((Component)__instance).gameObject.AddComponent<SmallSigilAbilityIcons>();
		}
		if ((Object)(object)smallSigilAbilityIcons == (Object)null || smallSigilAbilityIcons.part1AbilityIcons == null)
		{
			return;
		}
		if (smallSigilAbilityIcons.part1AbilityIcons.Count < 5)
		{
			CreateSmallSigilSlots(__instance, smallSigilAbilityIcons);
		}
		if (smallSigilAbilityIcons.part1AbilityIcons.Count == 0)
		{
			return;
		}
		for (int i = 0; i < smallSigilAbilityIcons.part1AbilityIcons.Count; i++)
		{
			AbilityIconInteractable val = smallSigilAbilityIcons.part1AbilityIcons[i];
			if ((Object)(object)val != (Object)null)
			{
				((Component)val).gameObject.SetActive(false);
			}
		}
		List<SmallSigilType> list = new List<SmallSigilType>();
		if (SmallSigilManager.GetStacks(playableCard, SmallSigilType.Burning) > 0)
		{
			list.Add(SmallSigilType.Burning);
		}
		if (SmallSigilManager.GetStacks(playableCard, SmallSigilType.Poison) > 0)
		{
			list.Add(SmallSigilType.Poison);
		}
		if (SmallSigilManager.GetStacks(playableCard, SmallSigilType.Gluttony) > 0)
		{
			list.Add(SmallSigilType.Gluttony);
		}
		if (list.Count == 0)
		{
			return;
		}
		int num = Mathf.Min(new int[3]
		{
			list.Count,
			smallSigilAbilityIcons.part1AbilityIcons.Count,
			5
		});
		for (int j = 0; j < num; j++)
		{
			SmallSigilType type = list[j];
			Ability ability = GetAbility(type);
			if ((int)ability == 0)
			{
				continue;
			}
			AbilityIconInteractable val2 = smallSigilAbilityIcons.part1AbilityIcons[j];
			if ((Object)(object)val2 == (Object)null)
			{
				continue;
			}
			int stacks = SmallSigilManager.GetStacks(playableCard, type);
			if (stacks <= 0)
			{
				continue;
			}
			((Component)val2).transform.localPosition = new Vector3(0.4f - 0.14f * (float)j, 0.75f, 0f);
			((Component)val2).transform.localScale = IconScale;
			Texture texture = GetTexture(type);
			if ((Object)(object)texture == (Object)null)
			{
				continue;
			}
			val2.AssignAbility(ability, ((Card)playableCard).Info, playableCard);
			if (stacks > 1)
			{
				Texture val3 = InvokePatchTexture(ability, stacks);
				if ((Object)(object)val3 != (Object)null)
				{
					val2.SetIcon(val3);
				}
				else
				{
					val2.SetIcon(texture);
				}
			}
			else
			{
				val2.SetIcon(texture);
			}
			Renderer component = ((Component)val2).GetComponent<Renderer>();
			if ((Object)(object)component != (Object)null)
			{
				component.material.color = GetColor(smallSigilAbilityIcons, type);
			}
			((Component)val2).gameObject.SetActive(true);
			if (!smallSigilAbilityIcons.abilityIcons.Contains(val2))
			{
				smallSigilAbilityIcons.abilityIcons.Add(val2);
			}
		}
	}

	[HarmonyPostfix]
	[HarmonyPatch(typeof(CardAbilityIcons), "UpdateAbilityIcons")]
	private static void ResetSmallSigilController(CardAbilityIcons __instance)
	{
		if ((Object)(object)__instance == (Object)null)
		{
			return;
		}
		SmallSigilAbilityIcons component = ((Component)__instance).GetComponent<SmallSigilAbilityIcons>();
		if (!((Object)(object)component == (Object)null) && component.abilityIcons != null)
		{
			component.abilityIcons.RemoveAll((AbilityIconInteractable icon) => (Object)(object)icon == (Object)null || !((Component)icon).gameObject.activeSelf);
		}
	}

	private static Texture InvokePatchTexture(Ability ability, int count)
	{
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		if (count <= 1)
		{
			return null;
		}
		MethodInfo methodInfo = AccessTools.Method(typeof(StackAbilityIcons), "PatchTexture", (Type[])null, (Type[])null);
		if (methodInfo == null)
		{
			return null;
		}
		int num = Mathf.Clamp(count, 2, 99);
		try
		{
			object obj = methodInfo.Invoke(null, new object[2] { ability, num });
			return (Texture)((obj is Texture) ? obj : null);
		}
		catch
		{
			return null;
		}
	}

	private static void CreateSmallSigilSlots(CardAbilityIcons instance, SmallSigilAbilityIcons controller)
	{
		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)instance == (Object)null || (Object)(object)controller == (Object)null)
		{
			return;
		}
		AbilityIconInteractable val = null;
		AbilityIconInteractable[] componentsInChildren = ((Component)instance).GetComponentsInChildren<AbilityIconInteractable>(true);
		AbilityIconInteractable[] array = componentsInChildren;
		foreach (AbilityIconInteractable val2 in array)
		{
			if (!((Object)(object)val2 == (Object)null) && !((Object)((Component)val2).gameObject).name.StartsWith("SmallSigilIcon_"))
			{
				val = val2;
				break;
			}
		}
		if ((Object)(object)val == (Object)null)
		{
			return;
		}
		for (int j = controller.part1AbilityIcons.Count; j < 5; j++)
		{
			GameObject val3 = Object.Instantiate<GameObject>(((Component)val).gameObject, ((Component)val).transform.parent);
			if ((Object)(object)val3 == (Object)null)
			{
				continue;
			}
			((Object)val3).name = "SmallSigilIcon_" + (j + 1);
			val3.transform.localPosition = new Vector3(0.4f - 0.14f * (float)j, 0.75f, 0f);
			val3.transform.localScale = IconScale;
			AbilityIconInteractable component = val3.GetComponent<AbilityIconInteractable>();
			if ((Object)(object)component == (Object)null)
			{
				Object.Destroy((Object)(object)val3);
				continue;
			}
			Renderer component2 = ((Component)val).GetComponent<Renderer>();
			Renderer component3 = ((Component)component).GetComponent<Renderer>();
			if ((Object)(object)component2 != (Object)null && (Object)(object)component3 != (Object)null)
			{
				component3.sharedMaterial = component2.sharedMaterial;
			}
			controller.part1AbilityIcons.Add(component);
			val3.SetActive(false);
		}
	}

	private static Ability GetAbility(SmallSigilType type)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		return (Ability)(type switch
		{
			SmallSigilType.Burning => SmallSigilStatusEffectManager.GetIconAbility(typeof(BurningStatusEffect)), 
			SmallSigilType.Poison => SmallSigilStatusEffectManager.GetIconAbility(typeof(PoisonStatusEffect)), 
			SmallSigilType.Gluttony => SmallSigilStatusEffectManager.GetIconAbility(typeof(GluttonyStatusEffect)), 
			_ => 0, 
		});
	}

	private static Texture GetTexture(SmallSigilType type)
	{
		return (Texture)(type switch
		{
			SmallSigilType.Burning => SmallSigilStatusEffectManager.GetIconTexture(typeof(BurningStatusEffect)), 
			SmallSigilType.Poison => SmallSigilStatusEffectManager.GetIconTexture(typeof(PoisonStatusEffect)), 
			SmallSigilType.Gluttony => SmallSigilStatusEffectManager.GetIconTexture(typeof(GluttonyStatusEffect)), 
			_ => null, 
		});
	}

	private static Color GetColor(SmallSigilAbilityIcons controller, SmallSigilType type)
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)controller == (Object)null)
		{
			return Color.white;
		}
		SmallSigilRuleBase rule = SmallSigilRuleManager.GetRule(type);
		if (rule == null)
		{
			return Color.white;
		}
		return (Color)(rule.Attribute switch
		{
			SmallSigilAttribute.Fire => controller.fireColor, 
			SmallSigilAttribute.Poison => controller.poisonColor, 
			SmallSigilAttribute.None => controller.noneColor, 
			_ => controller.noneColor, 
		});
	}

	[HarmonyPostfix]
	[HarmonyPatch(typeof(CardAbilityIcons), "GetDistinctShownAbilities")]
	private static void HideSmallSigilsFromNormalIcons(ref List<Ability> __result)
	{
		if (__result != null && __result.Count != 0)
		{
			__result.RemoveAll((Ability ability) => SmallSigilStatusEffectManager.IsSmallSigilAbility(ability));
		}
	}
}
public class SmallSigilBehaviour : MonoBehaviour
{
	public PlayableCard Card { get; private set; }

	private void Awake()
	{
		Card = ((Component)this).GetComponent<PlayableCard>();
		if (!((Object)(object)Card == (Object)null))
		{
			SmallSigilManager.RegisterCard(Card);
			EnsureTriggerBehaviour();
		}
	}

	private void EnsureTriggerBehaviour()
	{
		if (!((Object)(object)Card == (Object)null) && (Object)(object)((Component)Card).GetComponent<SmallSigilTriggerBehaviour>() == (Object)null)
		{
			((Component)Card).gameObject.AddComponent<SmallSigilTriggerBehaviour>();
		}
	}

	private void OnDestroy()
	{
		if (!((Object)(object)Card == (Object)null))
		{
			SmallSigilRuleManager.ClearCard(Card);
			SmallSigilManager.ClearCard(Card);
			Card = null;
		}
	}
}
public class SmallSigilData
{
	private readonly Dictionary<SmallSigilType, int> stacks = new Dictionary<SmallSigilType, int>();

	public int GetStacks(SmallSigilType type)
	{
		if (stacks.TryGetValue(type, out var value))
		{
			return value;
		}
		return 0;
	}

	public void AddStacks(SmallSigilType type, int amount)
	{
		if (amount > 0)
		{
			int num = GetStacks(type);
			stacks[type] = num + amount;
		}
	}

	public bool RemoveStacks(SmallSigilType type, int amount)
	{
		if (amount <= 0)
		{
			return false;
		}
		int num = GetStacks(type);
		if (num < amount)
		{
			return false;
		}
		int num2 = num - amount;
		if (num2 <= 0)
		{
			stacks.Remove(type);
		}
		else
		{
			stacks[type] = num2;
		}
		return true;
	}

	public void SetStacks(SmallSigilType type, int amount)
	{
		if (amount <= 0)
		{
			stacks.Remove(type);
		}
		else
		{
			stacks[type] = amount;
		}
	}

	public void Clear()
	{
		stacks.Clear();
	}
}
public static class SmallSigilManager
{
	private static SmallSigilStatusEffectBehaviour GetBehaviour(PlayableCard card, SmallSigilType type, bool create)
	{
		if ((Object)(object)card == (Object)null)
		{
			return null;
		}
		SmallSigilRuleBase rule = SmallSigilRuleManager.GetRule(type);
		if (rule == null)
		{
			return null;
		}
		Type behaviourType = rule.BehaviourType;
		if (behaviourType == null)
		{
			return null;
		}
		SmallSigilStatusEffectBehaviour smallSigilStatusEffectBehaviour = ((Component)card).GetComponent(behaviourType) as SmallSigilStatusEffectBehaviour;
		if ((Object)(object)smallSigilStatusEffectBehaviour == (Object)null && create)
		{
			smallSigilStatusEffectBehaviour = ((Component)card).gameObject.AddComponent(behaviourType) as SmallSigilStatusEffectBehaviour;
		}
		return smallSigilStatusEffectBehaviour;
	}

	public static SmallSigilStatusEffectBehaviour GetBehaviourForRule(PlayableCard card, SmallSigilType type)
	{
		return GetBehaviour(card, type, create: false);
	}

	public static void RegisterCard(PlayableCard card)
	{
	}

	public static int GetStacks(PlayableCard card, SmallSigilType type)
	{
		SmallSigilStatusEffectBehaviour behaviour = GetBehaviour(card, type, create: false);
		if ((Object)(object)behaviour == (Object)null)
		{
			return 0;
		}
		return behaviour.EffectSeverity;
	}

	public static void AddStacks(PlayableCard card, SmallSigilType type, int amount)
	{
		if (!((Object)(object)card == (Object)null) && amount > 0)
		{
			SmallSigilStatusEffectBehaviour behaviour = GetBehaviour(card, type, create: true);
			if (!((Object)(object)behaviour == (Object)null))
			{
				behaviour.AddSeverity(amount);
				SmallSigilRuleManager.RequestProcess(card);
			}
		}
	}

	public static bool RemoveStacks(PlayableCard card, SmallSigilType type, int amount)
	{
		if ((Object)(object)card == (Object)null || amount <= 0)
		{
			return false;
		}
		SmallSigilStatusEffectBehaviour behaviour = GetBehaviour(card, type, create: false);
		if ((Object)(object)behaviour == (Object)null)
		{
			return false;
		}
		if (behaviour.EffectSeverity < amount)
		{
			return false;
		}
		behaviour.SetSeverity(behaviour.EffectSeverity - amount);
		return true;
	}

	public static void SetStacks(PlayableCard card, SmallSigilType type, int amount)
	{
		if ((Object)(object)card == (Object)null)
		{
			return;
		}
		SmallSigilStatusEffectBehaviour behaviour = GetBehaviour(card, type, create: true);
		if (!((Object)(object)behaviour == (Object)null))
		{
			behaviour.SetSeverity(amount);
			if (amount > 0)
			{
				SmallSigilRuleManager.RequestProcess(card);
			}
		}
	}

	public static void ClearStacks(PlayableCard card, SmallSigilType type)
	{
		if (!((Object)(object)card == (Object)null))
		{
			SmallSigilStatusEffectBehaviour behaviour = GetBehaviour(card, type, create: false);
			if (!((Object)(object)behaviour == (Object)null))
			{
				behaviour.SetSeverity(0);
			}
		}
	}

	public static void ClearCard(PlayableCard card)
	{
		if (!((Object)(object)card == (Object)null))
		{
			SmallSigilRuleManager.ClearCard(card);
		}
	}

	public static void ClearAll()
	{
		SmallSigilRuleManager.ClearAll();
	}

	private static string GetCardName(PlayableCard card)
	{
		if ((Object)(object)card == (Object)null || (Object)(object)((Card)card).Info == (Object)null)
		{
			return "NULL";
		}
		return ((Object)((Card)card).Info).name;
	}
}
public abstract class SmallSigilRuleBase
{
	public abstract SmallSigilType Type { get; }

	public abstract Type BehaviourType { get; }

	public abstract int Threshold { get; }

	public virtual int Consume => Threshold;

	public virtual SmallSigilCategory Category => SmallSigilCategory.Debuff;

	public virtual SmallSigilAttribute Attribute => SmallSigilAttribute.None;

	public abstract IEnumerator Effect(PlayableCard card);
}
public static class SmallSigilRuleManager
{
	private static readonly Dictionary<SmallSigilType, SmallSigilRuleBase> Rules;

	private static readonly HashSet<PlayableCard> ProcessingCards;

	private static readonly Dictionary<PlayableCard, int> BattleTriggerCounts;

	private const float TriggerDelay = 0.4f;

	static SmallSigilRuleManager()
	{
		Rules = new Dictionary<SmallSigilType, SmallSigilRuleBase>();
		ProcessingCards = new HashSet<PlayableCard>();
		BattleTriggerCounts = new Dictionary<PlayableCard, int>();
		RegisterRules();
	}

	private static void RegisterRules()
	{
		Register(new BurningSigilRule());
		Register(new PoisonSigilRule());
		Register(new GluttonySigilRule());
		Register(new BloodSigilRule());
	}

	private static void Register(SmallSigilRuleBase rule)
	{
		if (rule != null)
		{
			Rules[rule.Type] = rule;
		}
	}

	public static void RequestProcess(PlayableCard card)
	{
		if (!((Object)(object)card == (Object)null) && !ProcessingCards.Contains(card) && HasTriggeredEffect(card))
		{
			ProcessingCards.Add(card);
			SmallSigilStatusEffectBehaviour component = ((Component)card).GetComponent<SmallSigilStatusEffectBehaviour>();
			if ((Object)(object)component == (Object)null)
			{
				ProcessingCards.Remove(card);
			}
			else
			{
				((MonoBehaviour)component).StartCoroutine(Process(card));
			}
		}
	}

	public static bool HasTriggeredEffect(PlayableCard card)
	{
		if ((Object)(object)card == (Object)null)
		{
			return false;
		}
		foreach (KeyValuePair<SmallSigilType, SmallSigilRuleBase> rule in Rules)
		{
			SmallSigilRuleBase value = rule.Value;
			int stacks = SmallSigilManager.GetStacks(card, value.Type);
			if (stacks >= value.Threshold)
			{
				return true;
			}
		}
		return false;
	}

	public static IEnumerator Process(PlayableCard card)
	{
		if ((Object)(object)card == (Object)null)
		{
			yield break;
		}
		if (!ProcessingCards.Contains(card))
		{
			ProcessingCards.Add(card);
		}
		try
		{
			bool needsAnotherCheck = true;
			while ((Object)(object)card != (Object)null && needsAnotherCheck)
			{
				needsAnotherCheck = false;
				foreach (KeyValuePair<SmallSigilType, SmallSigilRuleBase> pair in Rules)
				{
					if ((Object)(object)card == (Object)null)
					{
						yield break;
					}
					SmallSigilRuleBase rule = pair.Value;
					int stacks = SmallSigilManager.GetStacks(card, rule.Type);
					if (stacks < rule.Threshold)
					{
						continue;
					}
					int triggerCount = stacks / rule.Threshold;
					for (int i = 0; i < triggerCount; i++)
					{
						if ((Object)(object)card == (Object)null)
						{
							yield break;
						}
						int currentStacks = SmallSigilManager.GetStacks(card, rule.Type);
						if (currentStacks < rule.Threshold)
						{
							break;
						}
						SmallSigilStatusEffectBehaviour behaviour = SmallSigilManager.GetBehaviourForRule(card, rule.Type);
						if ((Object)(object)behaviour == (Object)null)
						{
							break;
						}
						yield return RunSmallSigilTriggerSequence(card, behaviour.IconAbilityInfo.ability);
						if ((Object)(object)card == (Object)null)
						{
							yield break;
						}
						yield return (object)new WaitForSeconds(0.4f);
						currentStacks = SmallSigilManager.GetStacks(card, rule.Type);
						if (currentStacks < rule.Threshold || !SmallSigilManager.RemoveStacks(card, rule.Type, rule.Consume))
						{
							break;
						}
						yield return rule.Effect(card);
						if ((Object)(object)card == (Object)null)
						{
							yield break;
						}
						yield return null;
					}
					if ((Object)(object)card != (Object)null && SmallSigilManager.GetStacks(card, rule.Type) >= rule.Threshold)
					{
						needsAnotherCheck = true;
					}
				}
				if ((Object)(object)card != (Object)null && HasTriggeredEffect(card))
				{
					needsAnotherCheck = true;
				}
			}
		}
		finally
		{
			ProcessingCards.Remove(card);
		}
	}

	private static IEnumerator RunSmallSigilTriggerSequence(PlayableCard card, Ability ability)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)card == (Object)null))
		{
			if ((Object)(object)Singleton<GlobalTriggerHandler>.Instance != (Object)null)
			{
				Singleton<GlobalTriggerHandler>.Instance.AbilitiesTriggeredThisTurn.Add(ability);
			}
			yield return card.OnAbilityTriggered(ability);
		}
	}

	public static SmallSigilCategory GetCategory(SmallSigilType type)
	{
		if (Rules.TryGetValue(type, out var value))
		{
			return value.Category;
		}
		return SmallSigilCategory.Debuff;
	}

	public static SmallSigilAttribute GetAttribute(SmallSigilType type)
	{
		if (Rules.TryGetValue(type, out var value))
		{
			return value.Attribute;
		}
		return SmallSigilAttribute.None;
	}

	public static SmallSigilRuleBase GetRule(SmallSigilType type)
	{
		if (Rules.TryGetValue(type, out var value))
		{
			return value;
		}
		return null;
	}

	public static int GetBattleTriggerCount(PlayableCard card)
	{
		if ((Object)(object)card == (Object)null)
		{
			return 0;
		}
		if (BattleTriggerCounts.TryGetValue(card, out var value))
		{
			return value;
		}
		return 0;
	}

	public static int IncrementBattleTriggerCount(PlayableCard card)
	{
		if ((Object)(object)card == (Object)null)
		{
			return 0;
		}
		int battleTriggerCount = GetBattleTriggerCount(card);
		battleTriggerCount++;
		BattleTriggerCounts[card] = battleTriggerCount;
		return battleTriggerCount;
	}

	public static void ResetBattleTriggerCount(PlayableCard card)
	{
		if (!((Object)(object)card == (Object)null))
		{
			BattleTriggerCounts.Remove(card);
		}
	}

	public static void ClearCard(PlayableCard card)
	{
		if (!((Object)(object)card == (Object)null))
		{
			BattleTriggerCounts.Remove(card);
			ProcessingCards.Remove(card);
		}
	}

	public static void ClearAll()
	{
		BattleTriggerCounts.Clear();
		ProcessingCards.Clear();
	}
}
public abstract class SmallSigilStatusEffectBehaviour : SpecialCardBehaviour
{
	public abstract string CardModSingletonName { get; }

	protected string DisplayModSingletonName => CardModSingletonName + "_DISPLAY";

	public virtual bool EffectCanBeInherited => false;

	public AbilityInfo IconAbilityInfo => SmallSigilStatusEffectManager.GetIconAbilityInfo(((object)this).GetType());

	public int EffectSeverity { get; protected set; }

	protected virtual void Start()
	{
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)((SpecialCardBehaviour)this).PlayableCard == (Object)null))
		{
			AbilityInfo iconAbilityInfo = IconAbilityInfo;
			if (!((Object)(object)iconAbilityInfo == (Object)null))
			{
				EffectSeverity = GetExistingSeverity(iconAbilityInfo.ability);
				SyncEffectMods();
			}
		}
	}

	private int GetExistingSeverity(Ability ability)
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Invalid comparison between Unknown and I4
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Unknown result type (might be due to invalid IL or missing references)
		//IL_016d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_0172: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)((SpecialCardBehaviour)this).PlayableCard == (Object)null || (Object)(object)((Card)((SpecialCardBehaviour)this).PlayableCard).Info == (Object)null || (int)ability == 0)
		{
			return 0;
		}
		int num = 0;
		foreach (CardModificationInfo temporaryMod in ((SpecialCardBehaviour)this).PlayableCard.TemporaryMods)
		{
			if (temporaryMod == null || temporaryMod.singletonId != CardModSingletonName || temporaryMod.abilities == null)
			{
				continue;
			}
			foreach (Ability ability2 in temporaryMod.abilities)
			{
				if (ability2 == ability)
				{
					num++;
				}
			}
		}
		if (num > 0)
		{
			return num;
		}
		int num2 = 0;
		foreach (CardModificationInfo mod in ((Card)((SpecialCardBehaviour)this).PlayableCard).Info.Mods)
		{
			if (mod == null || mod.singletonId != DisplayModSingletonName || mod.abilities == null)
			{
				continue;
			}
			foreach (Ability ability3 in mod.abilities)
			{
				if (ability3 == ability)
				{
					num2++;
				}
			}
		}
		return num2;
	}

	public void AddSeverity(int amount)
	{
		if (!((Object)(object)((SpecialCardBehaviour)this).PlayableCard == (Object)null) && amount > 0)
		{
			EffectSeverity += amount;
			SyncEffectMods();
		}
	}

	public void SetSeverity(int amount)
	{
		if (!((Object)(object)((SpecialCardBehaviour)this).PlayableCard == (Object)null))
		{
			EffectSeverity = ((amount >= 0) ? amount : 0);
			SyncEffectMods();
		}
	}

	private void SyncEffectMods()
	{
		if ((Object)(object)((SpecialCardBehaviour)this).PlayableCard == (Object)null || (Object)(object)((Card)((SpecialCardBehaviour)this).PlayableCard).Info == (Object)null)
		{
			return;
		}
		RemoveTemporaryEffectMod();
		RemoveDisplayEffectMod();
		if (EffectSeverity <= 0)
		{
			((SpecialCardBehaviour)this).PlayableCard.OnStatsChanged();
			((Card)((SpecialCardBehaviour)this).PlayableCard).RenderCard();
			return;
		}
		CardModificationInfo val = CreateEffectMod();
		if (val != null && val.abilities != null && val.abilities.Count > 0)
		{
			((SpecialCardBehaviour)this).PlayableCard.AddTemporaryMod(val);
		}
		CardModificationInfo val2 = CreateDisplayMod();
		if (val2 != null && val2.abilities != null && val2.abilities.Count > 0)
		{
			((Card)((SpecialCardBehaviour)this).PlayableCard).Info.Mods.Add(val2);
		}
		((SpecialCardBehaviour)this).PlayableCard.OnStatsChanged();
		((Card)((SpecialCardBehaviour)this).PlayableCard).RenderCard();
	}

	private void RemoveTemporaryEffectMod()
	{
		if (!((Object)(object)((SpecialCardBehaviour)this).PlayableCard == (Object)null))
		{
			CardModificationInfo val = ((SpecialCardBehaviour)this).PlayableCard.TemporaryMods.Find((CardModificationInfo x) => x != null && x.singletonId == CardModSingletonName);
			if (val != null)
			{
				((SpecialCardBehaviour)this).PlayableCard.RemoveTemporaryMod(val, true);
			}
		}
	}

	private void RemoveDisplayEffectMod()
	{
		if ((Object)(object)((SpecialCardBehaviour)this).PlayableCard == (Object)null || (Object)(object)((Card)((SpecialCardBehaviour)this).PlayableCard).Info == (Object)null)
		{
			return;
		}
		List<CardModificationInfo> list = ((Card)((SpecialCardBehaviour)this).PlayableCard).Info.Mods.FindAll((CardModificationInfo x) => x != null && x.singletonId == DisplayModSingletonName);
		if (list.Count == 0)
		{
			return;
		}
		foreach (CardModificationInfo item in list)
		{
			((Card)((SpecialCardBehaviour)this).PlayableCard).Info.Mods.Remove(item);
		}
	}

	private CardModificationInfo CreateEffectMod()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Expected I4, but got Unknown
		CardModificationInfo val = new CardModificationInfo();
		val.singletonId = CardModSingletonName;
		val.nonCopyable = true;
		AbilityInfo iconAbilityInfo = IconAbilityInfo;
		if ((Object)(object)iconAbilityInfo == (Object)null)
		{
			return val;
		}
		for (int i = 0; i < EffectSeverity; i++)
		{
			CardModificationInfoExtensions.AddAbilities(val, (Ability[])(object)new Ability[1] { (Ability)(int)iconAbilityInfo.ability });
		}
		return val;
	}

	private CardModificationInfo CreateDisplayMod()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Expected I4, but got Unknown
		CardModificationInfo val = new CardModificationInfo();
		val.singletonId = DisplayModSingletonName;
		val.nonCopyable = true;
		AbilityInfo iconAbilityInfo = IconAbilityInfo;
		if ((Object)(object)iconAbilityInfo == (Object)null)
		{
			return val;
		}
		for (int i = 0; i < EffectSeverity; i++)
		{
			CardModificationInfoExtensions.AddAbilities(val, (Ability[])(object)new Ability[1] { (Ability)(int)iconAbilityInfo.ability });
		}
		return val;
	}

	public void ClearDisplayMod()
	{
		if (!((Object)(object)((SpecialCardBehaviour)this).PlayableCard == (Object)null) && !((Object)(object)((Card)((SpecialCardBehaviour)this).PlayableCard).Info == (Object)null))
		{
			RemoveDisplayEffectMod();
			((SpecialCardBehaviour)this).PlayableCard.OnStatsChanged();
			((Card)((SpecialCardBehaviour)this).PlayableCard).RenderCard();
		}
	}

	public void ClearAllEffectMods()
	{
		if (!((Object)(object)((SpecialCardBehaviour)this).PlayableCard == (Object)null) && !((Object)(object)((Card)((SpecialCardBehaviour)this).PlayableCard).Info == (Object)null))
		{
			RemoveTemporaryEffectMod();
			RemoveDisplayEffectMod();
			EffectSeverity = 0;
			((SpecialCardBehaviour)this).PlayableCard.OnStatsChanged();
			((Card)((SpecialCardBehaviour)this).PlayableCard).RenderCard();
		}
	}
}
public static class SmallSigilStatusEffectManager
{
	public const string SmallSigilProperty = "OLD_SA_SmallSigil";

	private static readonly Dictionary<Type, AbilityInfo> Effects = new Dictionary<Type, AbilityInfo>();

	private static readonly Dictionary<Type, Texture> IconTextures = new Dictionary<Type, Texture>();

	public static void Initialize(string pluginGuid)
	{
		if (Effects.Count <= 0)
		{
			Register<BurningStatusEffect>(pluginGuid, "Blaze", "Every 2 Blaze, the bearer takes 1 damage.", "OldSa_Blaze.png");
			Register<PoisonStatusEffect>(pluginGuid, "Poison", "Every 4 Poison, the bearer dies.", "OldSa_Poison.png");
			Register<GluttonyStatusEffect>(pluginGuid, "Gluttony", "Every 3 Gluttony, the bearer gains 1 Power and 1 Health. After triggering 3 times in a battle, the bearer dies.", "OldSa_Gluttony.png");
			Register<BloodStatusEffect>(pluginGuid, "Blood", "Crimson everywhere, flesh growing wild.", "OldSa_Blood.png");
		}
	}

	private static void Register<T>(string pluginGuid, string rulebookName, string rulebookDescription, string iconFile) where T : SmallSigilStatusEffectBehaviour
	{
		Texture2D imageAsTexture = TextureHelper.GetImageAsTexture(iconFile, (FilterMode)0);
		if (!((Object)(object)imageAsTexture == (Object)null))
		{
			IconTextures[typeof(T)] = (Texture)(object)imageAsTexture;
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = rulebookName;
			val.rulebookName = rulebookName;
			FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(val, rulebookDescription);
			}
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			AbilityExtensions.SetCanStack(val, true, false);
			AbilityExtensions.SetPassive(val, true);
			AbilityExtensions.SetExtendedProperty(val, "OLD_SA_SmallSigil", (object)true);
			FullAbility val2 = AbilityManager.Add(pluginGuid, val, typeof(T), (Texture)(object)imageAsTexture);
			if (val2 != null)
			{
				Effects[typeof(T)] = val2.Info;
			}
		}
	}

	public static AbilityInfo GetIconAbilityInfo(Type behaviourType)
	{
		if (behaviourType == null)
		{
			return null;
		}
		if (Effects.TryGetValue(behaviourType, out var value))
		{
			return value;
		}
		return null;
	}

	public static Ability GetIconAbility(Type behaviourType)
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		AbilityInfo iconAbilityInfo = GetIconAbilityInfo(behaviourType);
		if ((Object)(object)iconAbilityInfo == (Object)null)
		{
			return (Ability)0;
		}
		return iconAbilityInfo.ability;
	}

	public static Texture GetIconTexture(Type behaviourType)
	{
		if (behaviourType == null)
		{
			return null;
		}
		if (IconTextures.TryGetValue(behaviourType, out var value))
		{
			return value;
		}
		return null;
	}

	public static bool IsSmallSigilAbility(Ability ability)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Invalid comparison between Unknown and I4
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		if ((int)ability == 0)
		{
			return false;
		}
		AbilityInfo info = AbilitiesUtil.GetInfo(ability);
		if ((Object)(object)info == (Object)null)
		{
			return false;
		}
		return AbilityExtensions.GetExtendedPropertyAsBool(info, "OLD_SA_SmallSigil") == true;
	}
}
public enum SmallSigilCategory
{
	Buff,
	Debuff
}
public enum SmallSigilAttribute
{
	None,
	Fire,
	Poison
}
public class SmallSigilTriggerBehaviour : TriggerReceiver
{
	private PlayableCard Card => ((Component)this).GetComponent<PlayableCard>();

	public override bool RespondsToTakeDamage(PlayableCard source)
	{
		return (Object)(object)Card != (Object)null && SmallSigilRuleManager.HasTriggeredEffect(Card);
	}

	public override IEnumerator OnTakeDamage(PlayableCard source)
	{
		if (!((Object)(object)Card == (Object)null))
		{
			yield return SmallSigilRuleManager.Process(Card);
		}
	}

	public override bool RespondsToCardGettingAttacked(PlayableCard source)
	{
		return false;
	}

	public override IEnumerator OnCardGettingAttacked(PlayableCard card)
	{
		yield break;
	}

	public override bool RespondsToTurnEnd(bool playerTurnEnd)
	{
		return false;
	}

	public override IEnumerator OnTurnEnd(bool playerTurnEnd)
	{
		yield break;
	}

	public override bool RespondsToDie(bool wasSacrifice, PlayableCard killer)
	{
		return false;
	}

	public override IEnumerator OnDie(bool wasSacrifice, PlayableCard killer)
	{
		yield break;
	}
}
public enum SmallSigilType
{
	Burning,
	Poison,
	Gluttony,
	Blood
}

Sigil/OldSa_Strafe Strike_sigil.dll

Decompiled 3 hours ago
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 Pixelplacement;
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_Strafe Strike_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Strafe Strike_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a396b6fd-2b3b-4ced-aca0-69ad30118ef9")]
[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.StrafeStrike;

[BepInPlugin("OLD_SA.StrafeStrike", "OLD SA Strafe Strike", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("OLD_SA.StrafeStrike");
		StrafeStrikeAPI.Init();
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"OLD SA Strafe Strike Loaded");
	}
}
public static class StrafeStrikeAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Strafe Strike";
		val.rulebookName = "Strafe Strike";
		val.metaCategories = new List<AbilityMetaCategory>
		{
			(AbilityMetaCategory)0,
			(AbilityMetaCategory)1
		};
		val.powerLevel = 4;
		val.opponentUsable = true;
		val.canStack = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Strafe_Strike.png", (FilterMode)0);
		FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(val, "After [creature] moves, it attacks.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(StrafeStrikeBehaviour), imageAsTexture);
	}
}
public class StrafeStrikeBehaviour : AbilityBehaviour
{
	private CardSlot lastSlot;

	public override Ability Ability => StrafeStrikeAPI.ability.Id;

	public override bool RespondsToResolveOnBoard()
	{
		return (Object)(object)((AbilityBehaviour)this).Card != (Object)null && !((AbilityBehaviour)this).Card.Dead && (Object)(object)((AbilityBehaviour)this).Card.Slot != (Object)null;
	}

	public override IEnumerator OnResolveOnBoard()
	{
		if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && !((AbilityBehaviour)this).Card.Dead && !((Object)(object)((AbilityBehaviour)this).Card.Slot == (Object)null))
		{
			lastSlot = ((AbilityBehaviour)this).Card.Slot;
		}
		yield break;
	}

	public override bool RespondsToOtherCardAssignedToSlot(PlayableCard otherCard)
	{
		if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead)
		{
			return false;
		}
		if ((Object)(object)otherCard == (Object)null || otherCard.Dead)
		{
			return false;
		}
		if ((Object)(object)otherCard != (Object)(object)((AbilityBehaviour)this).Card)
		{
			return false;
		}
		if ((Object)(object)lastSlot == (Object)null)
		{
			return false;
		}
		if ((Object)(object)((AbilityBehaviour)this).Card.Slot == (Object)null || (Object)(object)((AbilityBehaviour)this).Card.Slot == (Object)(object)lastSlot)
		{
			return false;
		}
		return true;
	}

	public override IEnumerator OnOtherCardAssignedToSlot(PlayableCard otherCard)
	{
		if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead || (Object)(object)((AbilityBehaviour)this).Card.Slot == (Object)null || (Object)(object)otherCard == (Object)null || (Object)(object)otherCard != (Object)(object)((AbilityBehaviour)this).Card || otherCard.Dead)
		{
			yield break;
		}
		CardSlot attackingSlot = ((AbilityBehaviour)this).Card.Slot;
		if ((Object)(object)lastSlot == (Object)null || (Object)(object)attackingSlot == (Object)(object)lastSlot)
		{
			yield break;
		}
		lastSlot = attackingSlot;
		yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
		if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead || (Object)(object)((AbilityBehaviour)this).Card.Slot == (Object)null)
		{
			yield break;
		}
		attackingSlot = ((AbilityBehaviour)this).Card.Slot;
		CardSlot opposingSlot = attackingSlot.opposingSlot;
		if ((Object)(object)opposingSlot == (Object)null)
		{
			yield break;
		}
		CombatPhaseManager combat = Singleton<CombatPhaseManager>.Instance;
		if (!((Object)(object)combat == (Object)null))
		{
			int damageBefore = combat.DamageDealtThisPhase;
			yield return combat.SlotAttackSlot(attackingSlot, opposingSlot, 0f);
			int damageAfter = combat.DamageDealtThisPhase;
			int damage = damageAfter - damageBefore;
			if (damage <= 0)
			{
				yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
				yield break;
			}
			yield return ResolveDamage(combat, damage, attackingSlot.IsPlayerSlot);
			yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
		}
	}

	private IEnumerator ResolveDamage(CombatPhaseManager combat, int damage, bool playerIsAttacker)
	{
		if (!((Object)(object)combat == (Object)null) && damage > 0)
		{
			yield return (object)new WaitForSeconds(0.4f);
			int excessDamage = 0;
			if (playerIsAttacker)
			{
				excessDamage = Singleton<LifeManager>.Instance.Balance + damage - 5;
				excessDamage = Mathf.Max(0, excessDamage);
			}
			int damageToScales = damage - excessDamage;
			yield return Singleton<LifeManager>.Instance.ShowDamageSequence(damageToScales, damageToScales, !playerIsAttacker, 0f, (GameObject)null, 0f, true);
			yield return MoveDamageWeightsToScales(combat, playerIsAttacker);
			if (excessDamage > 0 && playerIsAttacker && (Object)(object)Singleton<TurnManager>.Instance != (Object)null && (Object)(object)Singleton<TurnManager>.Instance.Opponent != (Object)null && Singleton<TurnManager>.Instance.Opponent.NumLives == 1 && Singleton<TurnManager>.Instance.Opponent.GiveCurrencyOnDefeat)
			{
				yield return Singleton<TurnManager>.Instance.Opponent.TryRevokeSurrender();
				RunState run = RunState.Run;
				run.currency += excessDamage;
				yield return VisualizeExcessLethalDamage(excessDamage);
			}
			SetDamageDealtThisPhase(combat, combat.DamageDealtThisPhase - damage);
		}
	}

	private IEnumerator MoveDamageWeightsToScales(CombatPhaseManager combat, bool playerIsAttacker)
	{
		CombatPhaseManager3D combat3D = (CombatPhaseManager3D)(object)((combat is CombatPhaseManager3D) ? combat : null);
		FieldInfo field = typeof(CombatPhaseManager3D).GetField("damageWeights", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field == null)
		{
			yield return (object)new WaitForSeconds(0.25f);
			yield break;
		}
		if (!(field.GetValue(combat3D) is List<Transform> damageWeights))
		{
			yield return (object)new WaitForSeconds(0.25f);
			yield break;
		}
		if ((Object)(object)Singleton<LifeManager>.Instance.Scales3D != (Object)null)
		{
			Vector3 scalesPos = (playerIsAttacker ? Singleton<LifeManager>.Instance.Scales3D.OpponentSide : Singleton<LifeManager>.Instance.Scales3D.PlayerSide);
			foreach (Transform transform in damageWeights)
			{
				if ((Object)(object)transform != (Object)null)
				{
					Tween.Position(transform, scalesPos, 0.2f, 0f, Tween.EaseOut, (LoopType)0, (Action)null, (Action)null, true);
					Object.Destroy((Object)(object)((Component)transform).gameObject, 0.2f);
				}
				yield return (object)new WaitForSeconds(0.02f);
			}
		}
		else
		{
			foreach (Transform transform2 in damageWeights)
			{
				if ((Object)(object)transform2 != (Object)null)
				{
					Part1Scales.DissolveWeight(((Component)transform2).gameObject);
				}
				yield return (object)new WaitForSeconds(0.02f);
			}
		}
		yield return (object)new WaitForSeconds(0.25f);
		damageWeights.Clear();
	}

	private static void SetDamageDealtThisPhase(CombatPhaseManager combat, int value)
	{
		if ((Object)(object)combat == (Object)null)
		{
			return;
		}
		PropertyInfo property = typeof(CombatPhaseManager).GetProperty("DamageDealtThisPhase", BindingFlags.Instance | BindingFlags.Public);
		if (!(property == null))
		{
			MethodInfo setMethod = property.GetSetMethod(nonPublic: true);
			if (!(setMethod == null))
			{
				setMethod.Invoke(combat, new object[1] { Mathf.Max(0, value) });
			}
		}
	}

	private IEnumerator VisualizeExcessLethalDamage(int excessDamage)
	{
		if (excessDamage <= 0)
		{
			yield break;
		}
		MethodInfo method = typeof(CombatPhaseManager).GetMethod("VisualizeExcessLethalDamage", BindingFlags.Instance | BindingFlags.NonPublic);
		if (method == null)
		{
			yield break;
		}
		object result = method.Invoke(Singleton<CombatPhaseManager>.Instance, new object[2] { excessDamage, null });
		if (result is IEnumerator sequence)
		{
			while (sequence.MoveNext())
			{
				yield return sequence.Current;
			}
		}
	}
}

Sigil/OldSa_Tempest_sigil.dll

Decompiled 3 hours ago
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_Tempest_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Tempest_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("209b2d3a-a1fc-4e1d-8a4e-a627b05cec58")]
[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.Tempest;

[BepInPlugin("OLD_SA.Tempest", "OLD SA Tempest", "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
		TempestAPI.Init();
		Harmony val = new Harmony("OLD_SA.Tempest");
		val.PatchAll();
	}
}
public class TempestAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Tempest";
		val.rulebookName = "Tempest";
		val.powerLevel = 4;
		Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("OldSa_Tempest.png", (FilterMode)0);
		ability = AbilityManager.Add("OLD_SA", val, typeof(TempestBehaviour), (Texture)(object)imageAsTexture);
		val.metaCategories = new List<AbilityMetaCategory>
		{
			(AbilityMetaCategory)0,
			(AbilityMetaCategory)7
		};
		FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(val, "For each flying ally, [creature] attacks an additional time.");
		}
	}
}
public class TempestBehaviour : ExtendedAbilityBehaviour
{
	public static Ability ability;

	public override Ability Ability => ability;

	public override bool RespondsToGetOpposingSlots()
	{
		return true;
	}

	public override List<CardSlot> GetOpposingSlots(List<CardSlot> originalSlots, List<CardSlot> otherAddedSlots)
	{
		List<CardSlot> list = new List<CardSlot>();
		int num = CountFriendlyAirborne();
		for (int i = 0; i < num; i++)
		{
			CardSlot val = CardExtensions.OpposingSlot(((AbilityBehaviour)this).Card);
			if ((Object)(object)val != (Object)null)
			{
				list.Add(val);
			}
		}
		return list;
	}

	private int CountFriendlyAirborne()
	{
		int num = 0;
		foreach (CardSlot slot in Singleton<BoardManager>.Instance.GetSlots(((AbilityBehaviour)this).Card.Slot.IsPlayerSlot))
		{
			if ((Object)(object)slot.Card != (Object)null && HasAirborne(slot.Card))
			{
				num++;
			}
		}
		return num;
	}

	private bool HasAirborne(PlayableCard card)
	{
		if ((Object)(object)card == (Object)null)
		{
			return false;
		}
		return card.HasAbility((Ability)19);
	}
}

Sigil/OldSa_Wind's Blessing_sigil.dll

Decompiled 3 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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.Blessing;
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_Wind's Blessing_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Wind's Blessing_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3c5c93e4-53b2-4569-b21f-e6bb56856b02")]
[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.WindsBlessing;

[BepInPlugin("OLD_SA.WindsBlessing", "OLD SA Wind's Blessing", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Expected O, but got Unknown
		((BaseUnityPlugin)this).Logger.LogInfo((object)"OLD SA Wind's Blessing Loaded");
		WindBlessingAPI.Init();
		WindBlessingAudio.Init();
		Harmony val = new Harmony("OLD_SA.WindsBlessing");
		val.PatchAll();
	}
}
public class WindBlessingAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "WindsBlessing";
		val.rulebookName = "Wind's Blessing";
		val.powerLevel = 5;
		Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("OldSa_Winds_Blessing.png", (FilterMode)0);
		ability = AbilityManager.Add("OLD_SA", val, typeof(WindBlessingBehaviour), (Texture)(object)imageAsTexture);
		val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
		FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(val, "At the start of the turn, [creature] grants Wind Blessing to itself and adjacent creatures.");
		}
	}
}
public static class WindBlessingAssets
{
	public static Sprite LoadSprite(string name)
	{
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		Texture2D imageAsTexture = TextureHelper.GetImageAsTexture(name, (FilterMode)0);
		if ((Object)(object)imageAsTexture == (Object)null)
		{
			Debug.Log((object)("Missing artwork: " + name));
			return null;
		}
		return Sprite.Create(imageAsTexture, new Rect(0f, 0f, (float)((Texture)imageAsTexture).width, (float)((Texture)imageAsTexture).height), new Vector2(0.5f, 0.5f));
	}
}
public static class WindBlessingAudio
{
	private static AudioClip windSound;

	private static AudioClip pterosaurRoar;

	public static void Init()
	{
		Debug.Log((object)"Loading Wind Blessing Audio...");
		windSound = LoadAudio("old_sa_wind.wav");
		pterosaurRoar = LoadAudio("old_sa_pterosaur_roar.wav");
		Debug.Log((object)("Wind sound = " + (object)windSound));
		Debug.Log((object)("Pterosaur roar = " + (object)pterosaurRoar));
	}

	public static void PlayWind(Vector3 position)
	{
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		Debug.Log((object)"Playing wind sound");
		if ((Object)(object)windSound == (Object)null)
		{
			Debug.Log((object)"Wind sound missing");
		}
		else
		{
			PlayClip(windSound, position);
		}
	}

	public static void PlayPterosaurRoar(Vector3 position)
	{
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		Debug.Log((object)"Playing pterosaur roar");
		if ((Object)(object)pterosaurRoar == (Object)null)
		{
			Debug.Log((object)"Pterosaur roar missing");
		}
		else
		{
			PlayClip(pterosaurRoar, position);
		}
	}

	private static void PlayClip(AudioClip clip, Vector3 position)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("WindBlessingAudio");
		val.transform.position = position;
		AudioSource val2 = val.AddComponent<AudioSource>();
		val2.clip = clip;
		val2.volume = 1f;
		Debug.Log((object)("Audio length:" + clip.length));
		val2.spatialBlend = 0f;
		val2.Play();
		Object.Destroy((Object)(object)val, clip.length + 0.2f);
	}

	private static AudioClip LoadAudio(string fileName)
	{
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Expected O, but got Unknown
		Debug.Log((object)("LoadAudio called: " + fileName));
		string text = Path.Combine(Path.GetDirectoryName(typeof(WindBlessingAudio).Assembly.Location), "Audio", fileName);
		if (!File.Exists(text))
		{
			Debug.Log((object)("Missing audio: " + text));
			return null;
		}
		WWW val = new WWW("file:///" + text);
		while (!val.isDone)
		{
		}
		if (!string.IsNullOrEmpty(val.error))
		{
			Debug.Log((object)("Audio load error: " + val.error));
			return null;
		}
		AudioClip audioClip = val.GetAudioClip(false, false);
		if ((Object)(object)audioClip == (Object)null)
		{
			Debug.Log((object)("AudioClip creation failed: " + fileName));
			return null;
		}
		Debug.Log((object)("Loaded audio " + fileName + " length=" + audioClip.length));
		return audioClip;
	}
}
public class WindBlessingBehaviour : AbilityBehaviour
{
	private bool windBlessingTriggered;

	public override Ability Ability => WindBlessingAPI.ability.Id;

	public override bool RespondsToUpkeep(bool playerUpkeep)
	{
		return playerUpkeep;
	}

	public override IEnumerator OnUpkeep(bool playerUpkeep)
	{
		windBlessingTriggered = true;
		yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
		Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
		if (ShouldUseWindPortrait())
		{
			yield return WindBlessingPterosaurPortraitSwitch.SwitchToStage1(((AbilityBehaviour)this).Card);
		}
		CardSlot leftSlot = GetAdjacentSlot(-1);
		if ((Object)(object)leftSlot != (Object)null && (Object)(object)leftSlot.Card != (Object)null)
		{
			yield return TriggerWindBlessing(leftSlot.Card);
		}
		yield return (object)new WaitForSeconds(0.15f);
		if (ShouldUseWindPortrait())
		{
			yield return WindBlessingPterosaurPortraitSwitch.SwitchToStage2(((AbilityBehaviour)this).Card);
		}
		CardSlot rightSlot = GetAdjacentSlot(1);
		if ((Object)(object)rightSlot != (Object)null && (Object)(object)rightSlot.Card != (Object)null)
		{
			yield return TriggerWindBlessing(rightSlot.Card);
		}
		yield return (object)new WaitForSeconds(0.25f);
		yield return TriggerSelfWindBlessing();
		yield return SigilDialogueAPI.ShowFirstTime("WindBlessing", "It spreads its wings, sending creatures soaring into the sky.", ((AbilityBehaviour)this).Card);
		while (WindBlessingEffect.ActiveWindIcons > 0)
		{
			yield return null;
		}
		Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
	}

	private IEnumerator TriggerWindBlessing(PlayableCard target)
	{
		if (!((Object)(object)target == (Object)null) && !target.HasAbility((Ability)19))
		{
			yield return WindBlessingEffect.Play(target);
			yield return GiveWindBlessing(target);
		}
	}

	private IEnumerator TriggerSelfWindBlessing()
	{
		if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && !((AbilityBehaviour)this).Card.HasAbility((Ability)19))
		{
			if (ShouldUseWindPortrait())
			{
				yield return WindBlessingPterosaurPortraitSwitch.SwitchToStage3(((AbilityBehaviour)this).Card);
			}
			yield return WindBlessingEffect.Play(((AbilityBehaviour)this).Card, selfCast: true);
			yield return GiveWindBlessing(((AbilityBehaviour)this).Card);
		}
	}

	private bool ShouldUseWindPortrait()
	{
		return windBlessingTriggered && (Object)(object)((AbilityBehaviour)this).Card != (Object)null && (Object)(object)((Card)((AbilityBehaviour)this).Card).Info != (Object)null && ((Object)((Card)((AbilityBehaviour)this).Card).Info).name == "OLD_SA_WIND_PTEROSAUR";
	}

	private CardSlot GetAdjacentSlot(int offset)
	{
		if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || (Object)(object)((AbilityBehaviour)this).Card.Slot == (Object)null)
		{
			return null;
		}
		CardSlot slot = ((AbilityBehaviour)this).Card.Slot;
		int num = slot.Index + offset;
		List<CardSlot> slots = Singleton<BoardManager>.Instance.GetSlots(slot.IsPlayerSlot);
		if (num < 0 || num >= slots.Count)
		{
			return null;
		}
		return slots[num];
	}

	private IEnumerator GiveWindBlessing(PlayableCard target)
	{
		if (!((Object)(object)target == (Object)null) && !target.HasAbility((Ability)19) && !WindBlessingRuntime.HasWind(target))
		{
			WindBlessingRuntime.Add(target);
			target.UpdateFaceUpOnBoardEffects();
			((Card)target).RenderCard();
		}
		yield break;
	}
}
public static class WindBlessingEffect
{
	private const string PTEROSAUR_CARD = "OLD_SA_WIND_PTEROSAUR";

	public static int ActiveWindIcons;

	public static IEnumerator Play(PlayableCard card, bool selfCast = false)
	{
		if (!((Object)(object)card == (Object)null))
		{
			Debug.Log((object)("Wind Blessing effect on " + ((Object)((Card)card).Info).name));
			((Card)card).Anim.PlayTransformAnimation();
			WindBlessingWindIcon.Spawn(card);
			if (selfCast && ((Object)((Card)card).Info).name == "OLD_SA_WIND_PTEROSAUR")
			{
				WindBlessingAudio.PlayPterosaurRoar(((Component)card).transform.position);
			}
			else
			{
				WindBlessingAudio.PlayWind(((Component)card).transform.position);
			}
		}
		yield break;
	}
}
public static class WindBlessingFlyingManager
{
	public static HashSet<PlayableCard> AddingWindFlying = new HashSet<PlayableCard>();

	public static bool IsAddingWindFlying(PlayableCard card)
	{
		if ((Object)(object)card == (Object)null)
		{
			return false;
		}
		return AddingWindFlying.Contains(card);
	}

	public static void ClearAdding()
	{
		AddingWindFlying.Clear();
	}
}
public static class WindBlessingPterosaurPortraitSwitch
{
	private const string PTEROSAUR_CARD = "OLD_SA_WIND_PTEROSAUR";

	public static IEnumerator SwitchToStage1(PlayableCard card, bool allowEmission = false)
	{
		yield return SwitchPortrait(card, 1, allowEmission);
	}

	public static IEnumerator SwitchToStage2(PlayableCard card, bool allowEmission = false)
	{
		yield return SwitchPortrait(card, 2, allowEmission);
	}

	public static IEnumerator SwitchToStage3(PlayableCard card, bool allowEmission = false)
	{
		yield return SwitchPortrait(card, 3, allowEmission);
	}

	private static IEnumerator SwitchPortrait(PlayableCard card, int stage, bool allowEmission)
	{
		if ((Object)(object)card == (Object)null || (Object)(object)((Card)card).Info == (Object)null || ((Object)((Card)card).Info).name != "OLD_SA_WIND_PTEROSAUR")
		{
			yield break;
		}
		string portraitName = null;
		switch (stage)
		{
		case 1:
			portraitName = "OLD_SA_WIND_PTEROSAUR_1";
			break;
		case 2:
			portraitName = "OLD_SA_WIND_PTEROSAUR_2";
			break;
		case 3:
			portraitName = "OLD_SA_WIND_PTEROSAUR_3";
			break;
		}
		if (portraitName != null)
		{
			Sprite portrait = LoadPortrait(portraitName);
			if ((Object)(object)portrait != (Object)null)
			{
				card.SwitchToPortrait(portrait);
				((Card)card).RenderInfo.forceEmissivePortrait = allowEmission && HasEmission(portraitName);
				((Card)card).RenderCard();
			}
		}
	}

	public static IEnumerator ResetPortrait(PlayableCard card)
	{
		if (!((Object)(object)card == (Object)null) && !((Object)(object)((Card)card).Info == (Object)null) && !(((Object)((Card)card).Info).name != "OLD_SA_WIND_PTEROSAUR"))
		{
			Sprite normalPortrait = LoadPortrait("OLD_SA_WIND_PTEROSAUR");
			if ((Object)(object)normalPortrait != (Object)null)
			{
				((Card)card).RenderInfo.forceEmissivePortrait = false;
				((Card)card).RenderInfo.portraitOverride = null;
				card.SwitchToPortrait(normalPortrait);
				((Card)card).RenderCard();
			}
		}
		yield break;
	}

	private static Sprite LoadPortrait(string name)
	{
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		Texture2D imageAsTexture = TextureHelper.GetImageAsTexture(name + ".png", (FilterMode)0);
		if ((Object)(object)imageAsTexture == (Object)null)
		{
			Debug.Log((object)("Missing portrait: " + name));
			return null;
		}
		Sprite val = Sprite.Create(imageAsTexture, new Rect(0f, 0f, (float)((Texture)imageAsTexture).width, (float)((Texture)imageAsTexture).height), new Vector2(0.5f, 0.5f));
		((Object)val).name = name;
		Texture2D val2 = null;
		try
		{
			val2 = TextureHelper.GetImageAsTexture(name + "_emission.png", (FilterMode)0);
		}
		catch
		{
		}
		if ((Object)(object)val2 != (Object)null)
		{
			Sprite val3 = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), new Vector2(0.5f, 0.5f));
			((Object)val3).name = name + "_emission";
			TextureHelper.RegisterEmissionForSprite(val, val3);
		}
		return val;
	}

	private static bool HasEmission(string name)
	{
		Texture2D val = null;
		try
		{
			val = TextureHelper.GetImageAsTexture(name + "_emission.png", (FilterMode)0);
		}
		catch
		{
		}
		return (Object)(object)val != (Object)null;
	}
}
public static class WindBlessingWindIcon
{
	public static void Spawn(PlayableCard card)
	{
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Expected O, but got Unknown
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)card == (Object)null))
		{
			Sprite val = WindBlessingAssets.LoadSprite("WindIcon.png");
			if ((Object)(object)val == (Object)null)
			{
				Debug.Log((object)"Missing WindIcon");
				return;
			}
			GameObject val2 = new GameObject("WindBlessingIcon");
			val2.transform.position = ((Component)card).transform.position + new Vector3(0f, 0.8f, 0f);
			val2.transform.rotation = Quaternion.Euler(90f, 0f, 0f);
			SpriteRenderer val3 = val2.AddComponent<SpriteRenderer>();
			val3.sprite = val;
			((Renderer)val3).sortingOrder = 999;
			WindBlessingEffect.ActiveWindIcons++;
			WindIconRotation windIconRotation = val2.AddComponent<WindIconRotation>();
			windIconRotation.StartAnimation();
		}
	}
}
public class WindIconRotation : MonoBehaviour
{
	private float duration = 1.2f;

	private float timer = 0f;

	private float startSpeed = 720f;

	private SpriteRenderer renderer;

	private Vector3 startScale = new Vector3(0.2f, 0.2f, 0.2f);

	private Vector3 normalScale = Vector3.one;

	public void StartAnimation()
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		timer = 0f;
		renderer = ((Component)this).GetComponent<SpriteRenderer>();
		((Component)this).transform.localScale = startScale;
	}

	private void Update()
	{
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		timer += Time.deltaTime;
		float num = Mathf.Clamp01(timer / duration);
		if (num < 0.15f)
		{
			float num2 = num / 0.15f;
			((Component)this).transform.localScale = Vector3.Lerp(startScale, normalScale, Mathf.Sin(num2 * (float)Math.PI * 0.5f));
		}
		float num3 = Mathf.Lerp(startSpeed, 0f, Mathf.Pow(num, 2.5f));
		((Component)this).transform.Rotate(Vector3.forward, num3 * Time.deltaTime);
		if (num > 0.8f)
		{
			float num4 = (num - 0.8f) / 0.2f;
			float num5 = Mathf.Lerp(1f, 0f, num4);
			((Component)this).transform.localScale = new Vector3(num5, num5, num5);
			if ((Object)(object)renderer != (Object)null)
			{
				Color color = renderer.color;
				color.a = Mathf.Lerp(1f, 0f, num4);
				renderer.color = color;
			}
		}
		if (timer >= duration)
		{
			WindBlessingEffect.ActiveWindIcons--;
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
}

Sigil/OldSa_WolfAndJackal_sigil.dll

Decompiled 3 hours ago
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<MethodBase> 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<PlayableCard>();
		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<AbilityInfo>();
		((Object)val).name = "WolfAndWarg";
		val.rulebookName = "Wolf and Warg";
		val.metaCategories = new List<AbilityMetaCategory> { (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<PlayableCard, bool> Processing = new Dictionary<PlayableCard, bool>();

	[HarmonyPostfix]
	public static void Postfix(PlayableCard __instance, ref List<CardSlot> __result)
	{
		if ((Object)(object)__instance == (Object)null || !__instance.OnBoard || !HasWolf(__instance) || (Processing.ContainsKey(__instance) && Processing[__instance]))
		{
			return;
		}
		Processing[__instance] = true;
		List<CardSlot> list = new List<CardSlot>();
		if (__instance.HasAbility((Ability)100))
		{
			list.Add(__instance.Slot.opposingSlot);
		}
		if (__instance.HasAbility((Ability)24))
		{
			foreach (CardSlot adjacentSlot in Singleton<BoardManager>.Instance.GetAdjacentSlots(__instance.Slot.opposingSlot))
			{
				list.Add(adjacentSlot);
			}
		}
		if (__instance.HasTriStrike())
		{
			foreach (CardSlot adjacentSlot2 in Singleton<BoardManager>.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<BoardManager>.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<PlayableCard>();
		if ((Object)(object)card == (Object)null || WolfAndJackalAPI.ability == null)
		{
			yield break;
		}
		AbilityBehaviour[] realAbilities = ((Component)card).GetComponents<AbilityBehaviour>();
		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<TriggerReceiver> 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<GlobalTriggerHandler>.Instance.TriggerSequence(trigger, receiver, otherArgs);
				}
			}
		}
		repeating = false;
	}

	private static List<TriggerReceiver> 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<TriggerReceiver>;
	}
}
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;
	}
}

Sigil/OldSa_Writhe_sigil.dll

Decompiled 3 hours ago
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 BepInEx.Logging;
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_Writhe_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Writhe_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3560dc46-299b-4da7-9e0a-7b7619f5384f")]
[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.Writhe;

[BepInPlugin("OLD_SA.Writhe", "OLD SA Writhe", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public static ManualLogSource Log;

	private void Awake()
	{
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Expected O, but got Unknown
		Log = ((BaseUnityPlugin)this).Logger;
		Log.LogInfo((object)"OLD SA Writhe loading...");
		WritheAPI.Init();
		Harmony val = new Harmony("OLD_SA.Writhe");
		val.PatchAll();
		Log.LogInfo((object)"OLD SA Writhe loaded.");
	}
}
public static class WritheAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Writhe";
		val.rulebookName = "Writhe";
		val.metaCategories = new List<AbilityMetaCategory>
		{
			(AbilityMetaCategory)0,
			(AbilityMetaCategory)1
		};
		val.powerLevel = 3;
		val.opponentUsable = true;
		val.canStack = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Writhe.png", (FilterMode)0);
		Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("OldSa_Writhe_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 [creature] would take lethal damage, it survives with 1 health and loses attack equal to the excess damage. If its attack is 0, it dies.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(WritheBehaviour), imageAsTexture);
	}
}
public class WritheBehaviour : AbilityBehaviour
{
	public override Ability Ability => WritheAPI.ability.Id;
}
[HarmonyPatch(typeof(PlayableCard), "TakeDamage")]
public static class WrithePatch
{
	private static readonly MethodInfo PreSuccessfulTriggerSequenceMethod = AccessTools.Method(typeof(AbilityBehaviour), "PreSuccessfulTriggerSequence", (Type[])null, (Type[])null);

	private static readonly FieldInfo StatusField = AccessTools.Field(typeof(PlayableCard), "Status");

	[HarmonyPrefix]
	public static bool Prefix(PlayableCard __instance, int damage, PlayableCard attacker, ref IEnumerator __result)
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)__instance == (Object)null)
		{
			return true;
		}
		if (!__instance.HasAbility(WritheAPI.ability.Id))
		{
			return true;
		}
		if (__instance.Dead)
		{
			return true;
		}
		if (damage <= 0)
		{
			return true;
		}
		if (damage < __instance.Health)
		{
			return true;
		}
		int num = Mathf.Max(0, __instance.Attack);
		int num2 = Mathf.Max(0, __instance.Health - 1);
		int num3 = damage - num2;
		if (num3 > num)
		{
			return true;
		}
		__result = WritheTakeDamageSequence(__instance, damage, attacker, num2, num3);
		return false;
	}

	private static IEnumerator WritheTakeDamageSequence(PlayableCard card, int damage, PlayableCard attacker, int healthDamage, int overflow)
	{
		if ((Object)(object)card == (Object)null || card.Dead)
		{
			yield break;
		}
		WritheBehaviour writhe = ((Component)card).GetComponent<WritheBehaviour>();
		if ((Object)(object)writhe != (Object)null && PreSuccessfulTriggerSequenceMethod != null)
		{
			object result = PreSuccessfulTriggerSequenceMethod.Invoke(writhe, null);
			if (result is IEnumerator sequence)
			{
				while (sequence.MoveNext())
				{
					yield return sequence.Current;
				}
			}
		}
		if ((Object)(object)card == (Object)null || card.Dead)
		{
			yield break;
		}
		PlayableCardStatus status = card.Status;
		status.damageTaken += healthDamage;
		if (card.Health > 0)
		{
			((Card)card).Anim.PlayHitAnimation();
		}
		if (overflow > 0)
		{
			CardModificationInfo attackLoss = new CardModificationInfo
			{
				attackAdjustment = -overflow,
				singletonId = "OLD_SA_Writhe_AttackLoss"
			};
			card.AddTemporaryMod(attackLoss);
		}
		card.OnStatsChanged();
		((Card)card).RenderCard();
		card.UpdateFaceUpOnBoardEffects();
		if ((Object)(object)card.TriggerHandler != (Object)null && card.TriggerHandler.RespondsToTrigger((Trigger)8, new object[1] { attacker }))
		{
			yield return card.TriggerHandler.OnTrigger((Trigger)8, new object[1] { attacker });
		}
		if ((Object)(object)attacker != (Object)null)
		{
			if ((Object)(object)attacker.TriggerHandler != (Object)null && attacker.TriggerHandler.RespondsToTrigger((Trigger)9, new object[2] { damage, card }))
			{
				yield return attacker.TriggerHandler.OnTrigger((Trigger)9, new object[2] { damage, card });
			}
			yield return Singleton<GlobalTriggerHandler>.Instance.TriggerCardsOnBoard((Trigger)19, false, new object[3] { attacker, attacker.Attack, card });
		}
	}
}

Sigil/Old_Sa_Proliferation_sigil.dll

Decompiled 3 hours ago
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 BepInEx.Logging;
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("Old_Sa_Proliferation_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Old_Sa_Proliferation_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f19e4650-e4a0-498d-b995-1a4fc3ab031c")]
[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.Proliferation;

[BepInPlugin("OLD_SA.Proliferation", "OLD SA Proliferation", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public static ManualLogSource Log;

	private void Awake()
	{
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Expected O, but got Unknown
		Log = ((BaseUnityPlugin)this).Logger;
		Log.LogInfo((object)"OLD SA Proliferation loading...");
		ProliferationAPI.Init();
		Harmony val = new Harmony("OLD_SA.Proliferation");
		val.PatchAll();
		Log.LogInfo((object)"OLD SA Proliferation loaded.");
	}
}
public static class ProliferationAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Proliferation";
		val.rulebookName = "Proliferation";
		val.metaCategories = new List<AbilityMetaCategory>
		{
			(AbilityMetaCategory)0,
			(AbilityMetaCategory)1
		};
		val.powerLevel = 5;
		val.opponentUsable = true;
		val.canStack = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Proliferation.png", (FilterMode)0);
		Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("OldSa_Proliferation_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 [creature] takes damage, a 1/1 copy of it is created in the owner's hand for 2 Bone.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(ProliferationBehaviour), imageAsTexture);
	}
}
public class ProliferationBehaviour : AbilityBehaviour
{
	public override Ability Ability => ProliferationAPI.ability.Id;

	public override bool RespondsToTakeDamage(PlayableCard source)
	{
		if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null)
		{
			return false;
		}
		if (((AbilityBehaviour)this).Card.Dead)
		{
			return false;
		}
		return true;
	}

	public override IEnumerator OnTakeDamage(PlayableCard source)
	{
		yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
		if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead || (Object)(object)((Card)((AbilityBehaviour)this).Card).Info == (Object)null || ((AbilityBehaviour)this).Card.OpponentCard)
		{
			yield break;
		}
		object obj = ((Card)((AbilityBehaviour)this).Card).Info.Clone();
		CardInfo clone = (CardInfo)((obj is CardInfo) ? obj : null);
		if (!((Object)(object)clone == (Object)null))
		{
			CardModificationInfo statMod = new CardModificationInfo();
			statMod.attackAdjustment = 1 - clone.Attack;
			statMod.healthAdjustment = 1 - clone.Health;
			statMod.bonesCostAdjustment = 2 - clone.BonesCost;
			statMod.bloodCostAdjustment = -clone.BloodCost;
			statMod.energyCostAdjustment = -clone.EnergyCost;
			clone.Mods.Add(statMod);
			if ((int)Singleton<ViewManager>.Instance.CurrentView > 0)
			{
				yield return (object)new WaitForSeconds(0.2f);
				Singleton<ViewManager>.Instance.SwitchToView((View)0, false, false);
				yield return (object)new WaitForSeconds(0.2f);
			}
			yield return Singleton<CardSpawner>.Instance.SpawnCardToHand(clone, (List<CardModificationInfo>)null, 0.25f, (Action<PlayableCard>)null);
			yield return (object)new WaitForSeconds(0.45f);
			yield return ((AbilityBehaviour)this).LearnAbility(0.1f);
		}
	}
}