Decompiled source of Xenowood Law v1.2.9

Sigil/OldSa_Redirect_Strikesigil.dll

Decompiled 5 days 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.Combat;
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_Redirect_Strikesigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Redirect_Strikesigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c07ac79b-0b9b-4a09-8814-20139d4eaeb5")]
[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.RedirectStrike;

[BepInPlugin("OLD_SA.RedirectStrike", "OLD SA Redirect Strike", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public const string GUID = "OLD_SA.RedirectStrike";

	public const string NAME = "OLD SA Redirect Strike";

	public const string VERSION = "1.0.0";

	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)"Redirect Strike Plugin loaded");
		RedirectStrikeAPI.Init();
		Harmony val = new Harmony("OLD_SA.RedirectStrike");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Redirect Strike initialized");
	}
}
public static class RedirectStrikeAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Redirect Strike";
		val.rulebookName = "Redirect 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_Redirect_Strike.png", (FilterMode)0);
		FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(val, "[creature] excess damage is dealt directly to the player.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(RedirectStrikeBehaviour), imageAsTexture);
		if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
		{
			ProgressionData.Data.learnedAbilities.Add(ability.Id);
		}
	}
}
public class RedirectStrikeBehaviour : AbilityBehaviour
{
	public override Ability Ability => RedirectStrikeAPI.ability.Id;
}
[HarmonyPatch(typeof(CombatPhaseManager), "DealOverkillDamage")]
public static class RedirectStrikePatch
{
	public static bool Prefix(int damage, CardSlot attackingSlot, CardSlot opposingSlot, ref IEnumerator __result)
	{
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		if (damage <= 0)
		{
			return true;
		}
		if ((Object)(object)attackingSlot == (Object)null || (Object)(object)attackingSlot.Card == (Object)null)
		{
			return true;
		}
		PlayableCard card = attackingSlot.Card;
		if (!card.HasAbility(RedirectStrikeAPI.ability.Id))
		{
			return true;
		}
		__result = RedirectOverkillDamage(damage, attackingSlot);
		return false;
	}

	private static IEnumerator RedirectOverkillDamage(int damage, CardSlot attackingSlot)
	{
		if (!((Object)(object)Singleton<LifeManager>.Instance == (Object)null))
		{
			LifeManager lifeManager = Singleton<LifeManager>.Instance;
			bool playerAttack = attackingSlot.IsPlayerSlot;
			bool opponentTakesDamage = !playerAttack;
			bool bossHasMoreLives = (Object)(object)Singleton<TurnManager>.Instance != (Object)null && (Object)(object)Singleton<TurnManager>.Instance.Opponent != (Object)null && Singleton<TurnManager>.Instance.Opponent.NumLives > 1;
			int excessDamage = 0;
			if (playerAttack)
			{
				int balanceBeforeDamage = lifeManager.Balance;
				excessDamage = Mathf.Max(0, balanceBeforeDamage + damage - 5);
			}
			int scaleDamage = damage - excessDamage;
			if (scaleDamage > 0)
			{
				yield return lifeManager.ShowDamageSequence(scaleDamage, scaleDamage, opponentTakesDamage, 0f, (GameObject)null, 0f, true);
			}
			if (playerAttack && excessDamage > 0 && !bossHasMoreLives)
			{
				yield return ExtraDamageResolver.ResolveCurrencyGain(excessDamage);
			}
		}
	}
}

Sigil/OldSa_Retribution_sigil.dll

Decompiled 5 days 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.", ((AbilityBehaviour)this).Card, "OLD_SA_BROKEN_BIRD");
		}
	}
}
[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 5 days 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, "OLD_SA_RING_DRAGON");
	}
}
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 5 days 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_Shell_Defense_sigil.dll

Decompiled 5 days 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 InscryptionAPI.Triggers;
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_Shell_Defense_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Shell_Defense_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("cfb5c90a-c242-4c1c-99c4-5d48da1a63fc")]
[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.ShellDefense;

[BepInPlugin("OLD_SA.ShellDefense.New", "OLD SA Shell Defense", "2.0.0")]
public class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		ShellDefenseAPI.Init();
		Debug.Log((object)"[OLD SA] Shell Defense loaded.");
	}
}
public static class ShellDefenseAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Shell Defense";
		val.rulebookName = "Shell Defense";
		val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
		val.powerLevel = 3;
		val.opponentUsable = false;
		val.canStack = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Shell_Defense.png", (FilterMode)0);
		FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(val, "When [creature] would take 1 damage, prevent it and deal 1 damage to the attacker.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(ShellDefenseBehaviour), imageAsTexture);
		if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
		{
			ProgressionData.Data.learnedAbilities.Add(ability.Id);
		}
	}
}
public class ShellDefenseBehaviour : ExtendedAbilityBehaviour, IModifyDamageTaken
{
	private bool shellDefenseReflectedDamage;

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

	private bool IsValid()
	{
		return (Object)(object)((AbilityBehaviour)this).Card != (Object)null && ((AbilityBehaviour)this).Card.OnBoard && !((AbilityBehaviour)this).Card.Dead;
	}

	public void MarkShellDefenseDamage()
	{
		shellDefenseReflectedDamage = true;
	}

	private bool IsShellDefenseDamage()
	{
		return shellDefenseReflectedDamage;
	}

	public bool RespondsToModifyDamageTaken(PlayableCard card, int damage, PlayableCard attacker, int amount)
	{
		if (!IsValid())
		{
			return false;
		}
		if ((Object)(object)card != (Object)(object)((AbilityBehaviour)this).Card)
		{
			return false;
		}
		if ((Object)(object)attacker == (Object)null || attacker.Dead)
		{
			return false;
		}
		if (damage != 1)
		{
			return false;
		}
		return true;
	}

	public int OnModifyDamageTaken(PlayableCard card, int damage, PlayableCard attacker, int amount)
	{
		if (!IsValid())
		{
			return damage;
		}
		if ((Object)(object)card != (Object)(object)((AbilityBehaviour)this).Card)
		{
			return damage;
		}
		if (damage != 1)
		{
			return damage;
		}
		if (IsShellDefenseDamage())
		{
			shellDefenseReflectedDamage = false;
			return 0;
		}
		if ((Object)(object)attacker != (Object)null && !attacker.Dead)
		{
			ShellDefenseBehaviour component = ((Component)attacker).GetComponent<ShellDefenseBehaviour>();
			if ((Object)(object)component != (Object)null)
			{
				component.MarkShellDefenseDamage();
			}
			((MonoBehaviour)((AbilityBehaviour)this).Card).StartCoroutine(DealShellDefenseDamage(attacker));
		}
		return 0;
	}

	private IEnumerator DealShellDefenseDamage(PlayableCard attacker)
	{
		if (!((Object)(object)attacker == (Object)null) && !attacker.Dead)
		{
			yield return attacker.TakeDamage(1, ((AbilityBehaviour)this).Card);
		}
	}

	public int TriggerPriority(PlayableCard card, int damage, PlayableCard attacker)
	{
		return 0;
	}
}

Sigil/OldSa_Sigil_Helper.dll

Decompiled 5 days 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.ArmorStrike;
using OLD_SA.CardHelper;
using OLD_SA.Patches;
using OLD_SA.WolfJackal;
using OldSa_Challenge;
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_Sigil_Helper")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Sigil_Helper")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("af78b1f3-6044-43f3-95f2-a5438b7b6177")]
[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
{
	[BepInPlugin("old.sa.plugin", "OLD SA", "1.0.0")]
	public class OLD_SA_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.plugin");
			val.PatchAll();
			SniperRulebook.Init();
			SentryRulebook.Init();
			EnemyDrawSigils.Init();
			SquirrelStrafeRulebook.Init();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"OLD SA Loaded");
		}
	}
}
namespace OLD_SA.Utilities
{
	public static class OpponentQueueUtility
	{
		public static IEnumerator AddCard(CardInfo cardInfo)
		{
			if ((Object)(object)cardInfo == (Object)null)
			{
				Debug.LogError((object)"[OpponentQueueUtility] 传入的卡牌信息为空。");
				yield break;
			}
			Opponent opponent = Singleton<TurnManager>.Instance.Opponent;
			if ((Object)(object)opponent == (Object)null)
			{
				yield break;
			}
			CardSlot freeSlot = FindFreeQueueSlot(opponent);
			if ((Object)(object)freeSlot != (Object)null)
			{
				yield return opponent.QueueCard(cardInfo, freeSlot, true, true, true);
				yield break;
			}
			PlayableCard target = FindSameQueuedCard(opponent, ((Object)cardInfo).name);
			if ((Object)(object)target == (Object)null)
			{
				Debug.LogWarning((object)("[OpponentQueueUtility] 队列已满,且没有找到同名排队卡:" + ((Object)cardInfo).name));
				yield break;
			}
			PlayableCard source = CardSpawner.SpawnPlayableCard(cardInfo);
			if (!((Object)(object)source == (Object)null))
			{
				MergeCardStats(target, source);
				Object.Destroy((Object)(object)((Component)source).gameObject);
			}
		}

		public static CardSlot FindFreeQueueSlot(Opponent opponent)
		{
			if ((Object)(object)opponent == (Object)null)
			{
				return null;
			}
			foreach (CardSlot slot in Singleton<BoardManager>.Instance.OpponentSlotsCopy)
			{
				if ((Object)(object)slot == (Object)null || opponent.Queue.Exists((PlayableCard x) => (Object)(object)x != (Object)null && (Object)(object)x.QueuedSlot == (Object)(object)slot))
				{
					continue;
				}
				return slot;
			}
			return null;
		}

		public static PlayableCard FindSameQueuedCard(Opponent opponent, string cardName)
		{
			if ((Object)(object)opponent == (Object)null || string.IsNullOrEmpty(cardName))
			{
				return null;
			}
			List<PlayableCard> list = new List<PlayableCard>();
			foreach (PlayableCard item in opponent.Queue)
			{
				if (!((Object)(object)item == (Object)null) && !((Object)(object)((Card)item).Info == (Object)null) && ((Object)((Card)item).Info).name == cardName)
				{
					list.Add(item);
				}
			}
			if (list.Count == 0)
			{
				return null;
			}
			int index = Random.Range(0, list.Count);
			return list[index];
		}

		public static void MergeCardStats(PlayableCard target, PlayableCard source)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//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_0075: 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_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)target == (Object)null || (Object)(object)source == (Object)null)
			{
				return;
			}
			CardModificationInfo val = new CardModificationInfo();
			val.fromCardMerge = true;
			val.attackAdjustment = source.Attack;
			val.healthAdjustment = source.Health;
			val.abilities = new List<Ability>();
			foreach (Ability ability in ((Card)source).Info.Abilities)
			{
				if (!((Card)target).Info.Abilities.Contains(ability) && !val.abilities.Contains(ability))
				{
					val.abilities.Add(ability);
				}
			}
			foreach (CardModificationInfo mod in ((Card)source).Info.Mods)
			{
				foreach (Ability ability2 in mod.abilities)
				{
					if (!((Card)target).Info.Abilities.Contains(ability2) && !val.abilities.Contains(ability2))
					{
						val.abilities.Add(ability2);
					}
				}
			}
			target.AddTemporaryMod(val);
			target.OnStatsChanged();
			((Card)target).RenderCard();
		}
	}
}
namespace OLD_SA.CardHelper
{
	public static class EnemyDrawSigils
	{
		public static void Init()
		{
			EnableEnemy((Ability)9);
			EnableEnemy((Ability)14);
			EnableEnemy((Ability)17);
			EnableEnemy((Ability)2);
		}

		private static void EnableEnemy(Ability ability)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			FullAbility val = null;
			foreach (FullAbility baseGameAbility in AbilityManager.BaseGameAbilities)
			{
				if (baseGameAbility == null || (Object)(object)baseGameAbility.Info == (Object)null || baseGameAbility.Info.ability != ability)
				{
					continue;
				}
				val = baseGameAbility;
				break;
			}
			if (val != null)
			{
				AbilityInfo info = val.Info;
				if (info.metaCategories == null)
				{
					info.metaCategories = new List<AbilityMetaCategory>();
				}
				if (!info.metaCategories.Contains((AbilityMetaCategory)1))
				{
					info.metaCategories.Add((AbilityMetaCategory)1);
				}
				info.opponentUsable = true;
				info.canStack = false;
			}
		}
	}
	public static class SentryRulebook
	{
		public static void Init()
		{
			FullAbility val = null;
			foreach (FullAbility baseGameAbility in AbilityManager.BaseGameAbilities)
			{
				if (baseGameAbility == null || (Object)(object)baseGameAbility.Info == (Object)null || !(((Object)baseGameAbility.Info).name == "Sentry"))
				{
					continue;
				}
				val = baseGameAbility;
				break;
			}
			if (val != null)
			{
				AbilityInfo info = val.Info;
				if (info.metaCategories == null)
				{
					info.metaCategories = new List<AbilityMetaCategory>();
				}
				if (!info.metaCategories.Contains((AbilityMetaCategory)0))
				{
					info.metaCategories.Add((AbilityMetaCategory)0);
				}
				if (!info.metaCategories.Contains((AbilityMetaCategory)1))
				{
					info.metaCategories.Add((AbilityMetaCategory)1);
				}
				info.opponentUsable = true;
				info.canStack = false;
			}
		}
	}
	public static class SniperRulebook
	{
		public static void Init()
		{
			FullAbility val = null;
			foreach (FullAbility baseGameAbility in AbilityManager.BaseGameAbilities)
			{
				if (baseGameAbility == null || (Object)(object)baseGameAbility.Info == (Object)null || !(((Object)baseGameAbility.Info).name == "Sniper"))
				{
					continue;
				}
				val = baseGameAbility;
				break;
			}
			if (val != null)
			{
				AbilityInfo info = val.Info;
				if (info.metaCategories == null)
				{
					info.metaCategories = new List<AbilityMetaCategory>();
				}
				if (!info.metaCategories.Contains((AbilityMetaCategory)0))
				{
					info.metaCategories.Add((AbilityMetaCategory)0);
				}
				if (!info.metaCategories.Contains((AbilityMetaCategory)1))
				{
					info.metaCategories.Add((AbilityMetaCategory)1);
				}
				info.opponentUsable = true;
				info.canStack = false;
			}
		}
	}
	public static class SquirrelStrafeRulebook
	{
		public static void Init()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Invalid comparison between Unknown and I4
			FullAbility val = null;
			foreach (FullAbility baseGameAbility in AbilityManager.BaseGameAbilities)
			{
				if (baseGameAbility == null || (Object)(object)baseGameAbility.Info == (Object)null || (int)baseGameAbility.Info.ability != 46)
				{
					continue;
				}
				val = baseGameAbility;
				break;
			}
			if (val != null)
			{
				AbilityInfo info = val.Info;
				if (info.metaCategories == null)
				{
					info.metaCategories = new List<AbilityMetaCategory>();
				}
				if (!info.metaCategories.Contains((AbilityMetaCategory)0))
				{
					info.metaCategories.Add((AbilityMetaCategory)0);
				}
				if (!info.metaCategories.Contains((AbilityMetaCategory)1))
				{
					info.metaCategories.Add((AbilityMetaCategory)1);
				}
				info.opponentUsable = false;
				info.canStack = false;
			}
		}
	}
}
namespace OLD_SA.Patches
{
	[HarmonyPatch]
	public static class EnemyDrawCreatedCardPatch
	{
		public static HashSet<PlayableCard> PendingOverkillProtection = new HashSet<PlayableCard>();

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

		public static HashSet<PlayableCard> MergingCards = new HashSet<PlayableCard>();

		[HarmonyPatch(typeof(DrawCreatedCard), "CreateDrawnCard")]
		[HarmonyPrefix]
		public static bool Prefix(DrawCreatedCard __instance)
		{
			PlayableCard ownerCard = GetOwnerCard(__instance);
			if ((Object)(object)ownerCard == (Object)null)
			{
				return true;
			}
			if (!ownerCard.OpponentCard)
			{
				return true;
			}
			CardInfo cardToDraw = GetCardToDraw(__instance);
			if ((Object)(object)cardToDraw == (Object)null)
			{
				return true;
			}
			PendingCreateCards.Add(((Object)cardToDraw).name);
			((MonoBehaviour)Singleton<TurnManager>.Instance).StartCoroutine(SpawnEnemyCard(cardToDraw, __instance is DrawCopyOnDeath || __instance is BeesOnHit));
			return false;
		}

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

		private static CardInfo GetCardToDraw(DrawCreatedCard drawer)
		{
			PlayableCard ownerCard = GetOwnerCard(drawer);
			if ((Object)(object)ownerCard == (Object)null)
			{
				return null;
			}
			if (drawer is DrawCopy)
			{
				object obj = ((Card)ownerCard).Info.Clone();
				CardInfo val = (CardInfo)((obj is CardInfo) ? obj : null);
				RemoveDrawCopyAbility(val);
				return val;
			}
			if (drawer is DrawCopyOnDeath)
			{
				object obj2 = ((Card)ownerCard).Info.Clone();
				return (CardInfo)((obj2 is CardInfo) ? obj2 : null);
			}
			if (drawer is BeesOnHit)
			{
				return CardLoader.GetCardByName("Bee");
			}
			if (drawer is DrawAnt)
			{
				return CardLoader.GetCardByName("Ant");
			}
			return null;
		}

		private static void RemoveDrawCopyAbility(CardInfo info)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			if (!((Object)(object)info == (Object)null))
			{
				if (info.Mods == null)
				{
					info.Mods = new List<CardModificationInfo>();
				}
				CardModificationInfo val = new CardModificationInfo();
				val.negateAbilities.Add((Ability)9);
				info.Mods.Add(val);
			}
		}

		private static IEnumerator SpawnEnemyCard(CardInfo info, bool protectOverkill)
		{
			yield return null;
			if ((Object)(object)info == (Object)null)
			{
				yield break;
			}
			Opponent opponent = Singleton<TurnManager>.Instance.Opponent;
			if ((Object)(object)opponent == (Object)null)
			{
				PendingCreateCards.Remove(((Object)info).name);
				yield break;
			}
			CardSlot freeSlot = FindFreeQueueSlot(opponent);
			if ((Object)(object)freeSlot != (Object)null)
			{
				yield return opponent.QueueCard(info, freeSlot, true, true, true);
				if (protectOverkill)
				{
					PlayableCard created = Singleton<BoardManager>.Instance.GetCardQueuedForSlot(freeSlot);
					if ((Object)(object)created != (Object)null)
					{
						((MonoBehaviour)Singleton<TurnManager>.Instance).StartCoroutine(AddOverkillProtection(created));
					}
				}
				PendingCreateCards.Remove(((Object)info).name);
				yield break;
			}
			PlayableCard target = FindSameQueuedCard(opponent, ((Object)info).name);
			if ((Object)(object)target == (Object)null)
			{
				PendingCreateCards.Remove(((Object)info).name);
				yield break;
			}
			if (MergingCards.Contains(target))
			{
				PendingCreateCards.Remove(((Object)info).name);
				yield break;
			}
			MergingCards.Add(target);
			PlayableCard temp = CardSpawner.SpawnPlayableCard(info);
			if ((Object)(object)temp == (Object)null)
			{
				MergingCards.Remove(target);
				PendingCreateCards.Remove(((Object)info).name);
				yield break;
			}
			MergeCardStats(target, temp);
			Object.Destroy((Object)(object)((Component)temp).gameObject);
			MergingCards.Remove(target);
			PendingCreateCards.Remove(((Object)info).name);
		}

		private static CardSlot FindFreeQueueSlot(Opponent opponent)
		{
			foreach (CardSlot slot in Singleton<BoardManager>.Instance.OpponentSlotsCopy)
			{
				if (!opponent.Queue.Exists((PlayableCard x) => (Object)(object)x != (Object)null && (Object)(object)x.QueuedSlot == (Object)(object)slot))
				{
					return slot;
				}
			}
			return null;
		}

		private static PlayableCard FindSameQueuedCard(Opponent opponent, string name)
		{
			List<PlayableCard> list = new List<PlayableCard>();
			foreach (PlayableCard item in opponent.Queue)
			{
				if (!((Object)(object)item == (Object)null) && ((Object)((Card)item).Info).name == name)
				{
					list.Add(item);
				}
			}
			if (list.Count == 0)
			{
				return null;
			}
			return list[Random.Range(0, list.Count)];
		}

		private static void MergeCardStats(PlayableCard target, PlayableCard source)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: 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)
			if ((Object)(object)target == (Object)null || (Object)(object)source == (Object)null)
			{
				return;
			}
			CardModificationInfo val = new CardModificationInfo();
			val.fromCardMerge = true;
			val.attackAdjustment = source.Attack;
			val.healthAdjustment = source.Health;
			val.abilities = new List<Ability>();
			foreach (Ability ability in ((Card)source).Info.Abilities)
			{
				AddAbility(target, val, ability);
			}
			if (val.attackAdjustment != 0 || val.healthAdjustment != 0 || val.abilities.Count != 0)
			{
				target.AddTemporaryMod(val);
				target.OnStatsChanged();
				((Card)target).RenderCard();
			}
		}

		private static void AddAbility(PlayableCard target, CardModificationInfo mod, 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_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: 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 ((int)ability != 0 && !target.HasAbility(ability) && !mod.abilities.Contains(ability))
			{
				mod.abilities.Add(ability);
			}
		}

		private static IEnumerator AddOverkillProtection(PlayableCard card)
		{
			yield return null;
			if ((Object)(object)card != (Object)null)
			{
				PendingOverkillProtection.Add(card);
			}
		}
	}
	[HarmonyPatch(typeof(SquirrelStrafe), "PostSuccessfulMoveSequence")]
	public static class SquirrelStrafePatch
	{
		[HarmonyPrefix]
		private static bool Prefix(SquirrelStrafe __instance, CardSlot cardSlot, ref IEnumerator __result)
		{
			__result = SpawnSquirrelWithCopiedMods(__instance, cardSlot);
			return false;
		}

		private static IEnumerator SpawnSquirrelWithCopiedMods(SquirrelStrafe source, CardSlot cardSlot)
		{
			if ((Object)(object)source == (Object)null || (Object)(object)cardSlot == (Object)null || (Object)(object)cardSlot.Card != (Object)null)
			{
				yield break;
			}
			PlayableCard sourceCard = ((Component)source).GetComponent<PlayableCard>();
			if ((Object)(object)sourceCard == (Object)null || (Object)(object)((Card)sourceCard).Info == (Object)null)
			{
				yield break;
			}
			CardInfo squirrelInfo = CardLoader.GetCardByName("Squirrel");
			if ((Object)(object)squirrelInfo == (Object)null)
			{
				yield break;
			}
			squirrelInfo = (CardInfo)squirrelInfo.Clone();
			CardInfo originalSquirrel = CardLoader.GetCardByName("Squirrel");
			if (originalSquirrel.Mods != null)
			{
				foreach (CardModificationInfo mod in originalSquirrel.Mods)
				{
					if (mod != null)
					{
						squirrelInfo.Mods.Add((CardModificationInfo)mod.Clone());
					}
				}
			}
			foreach (CardModificationInfo mod2 in ((Card)sourceCard).Info.Mods)
			{
				if (!(mod2?.nonCopyable ?? true) && mod2.attackAdjustment == 0 && mod2.healthAdjustment == 0 && (mod2.abilities == null || !mod2.abilities.Contains(((AbilityBehaviour)source).Ability)))
				{
					squirrelInfo.Mods.Add((CardModificationInfo)mod2.Clone());
				}
			}
			foreach (CardModificationInfo mod3 in sourceCard.TemporaryMods)
			{
				if (!(mod3?.nonCopyable ?? true) && mod3.attackAdjustment == 0 && mod3.healthAdjustment == 0 && (mod3.abilities == null || !mod3.abilities.Contains(((AbilityBehaviour)source).Ability)))
				{
					squirrelInfo.Mods.Add((CardModificationInfo)mod3.Clone());
				}
			}
			yield return Singleton<BoardManager>.Instance.CreateCardInSlot(squirrelInfo, cardSlot, 0.1f, true);
		}
	}
	[HarmonyPatch]
	public static class WoodcarverAbilityPatch
	{
		private static MethodBase TargetMethod()
		{
			return AccessTools.Method(typeof(BuildTotemSequencer), "GenerateTotemChoices", (Type[])null, (Type[])null);
		}

		[HarmonyPrefix]
		private static void Prefix()
		{
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: 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)
			if (ProgressionData.Data == null || ProgressionData.Data.learnedAbilities == null)
			{
				return;
			}
			List<Ability> learnedAbilities = ProgressionData.Data.learnedAbilities;
			foreach (FullAbility allAbility in AbilityManager.AllAbilities)
			{
				if (allAbility != null && !string.IsNullOrEmpty(allAbility.ModGUID))
				{
					AbilityInfo info = allAbility.Info;
					if (!((Object)(object)info == (Object)null) && info.metaCategories != null && info.metaCategories.Contains((AbilityMetaCategory)1) && ProgressionData.LearnedAbility(allAbility.Id) && !learnedAbilities.Contains(allAbility.Id))
					{
						learnedAbilities.Add(allAbility.Id);
					}
				}
			}
		}
	}
}
namespace OLD_SA.OpportunistStrike
{
	internal class AttackReplicationEvent
	{
		public CardSlot Target;

		public bool PigCopied;

		public bool WolfCopied;

		public bool WolfEligible;

		public AttackReplicationEvent(CardSlot target, bool pigCopied, bool wolfCopied, bool wolfEligible)
		{
			Target = target;
			PigCopied = pigCopied;
			WolfCopied = wolfCopied;
			WolfEligible = wolfEligible;
		}
	}
	internal static class AttackReplicationState
	{
		private static readonly Dictionary<PlayableCard, Queue<AttackReplicationEvent>> Events = new Dictionary<PlayableCard, Queue<AttackReplicationEvent>>();

		public static void Set(PlayableCard card, List<AttackReplicationEvent> events)
		{
			if (!((Object)(object)card == (Object)null) && events != null)
			{
				Events[card] = new Queue<AttackReplicationEvent>(events);
			}
		}

		public static bool TryConsume(PlayableCard card, CardSlot target, out AttackReplicationEvent attackEvent)
		{
			attackEvent = null;
			if ((Object)(object)card == (Object)null || !Events.TryGetValue(card, out var value) || value.Count == 0)
			{
				return false;
			}
			List<AttackReplicationEvent> list = new List<AttackReplicationEvent>(value);
			int num = list.FindIndex((AttackReplicationEvent x) => x != null && (Object)(object)x.Target == (Object)(object)target);
			if (num < 0)
			{
				return false;
			}
			attackEvent = list[num];
			list.RemoveAt(num);
			Events[card] = new Queue<AttackReplicationEvent>(list);
			return true;
		}

		private static string DescribeSlot(CardSlot slot)
		{
			if ((Object)(object)slot == (Object)null)
			{
				return "null";
			}
			string text = (((Object)(object)slot.Card != (Object)null && (Object)(object)((Card)slot.Card).Info != (Object)null) ? ((Object)((Card)slot.Card).Info).name : "Empty");
			return "Index=" + slot.Index + "(" + text + ")";
		}

		public static void Clear(PlayableCard card)
		{
			if ((Object)(object)card != (Object)null)
			{
				Events.Remove(card);
			}
		}
	}
	[HarmonyPatch(typeof(PlayableCard), "GetOpposingSlots")]
	public static class AttackReplicationTargetsPatch
	{
		[HarmonyPrefix]
		[HarmonyPriority(800)]
		public static void Prefix(PlayableCard __instance, out List<CardSlot> __state)
		{
			__state = null;
			if (!((Object)(object)__instance == (Object)null) && __instance.OnBoard && !((Object)(object)__instance.Slot == (Object)null))
			{
				__state = GetInitialTargets(__instance);
			}
		}

		private static List<CardSlot> GetInitialTargets(PlayableCard card)
		{
			List<CardSlot> list = new List<CardSlot>();
			if ((Object)(object)card == (Object)null || (Object)(object)card.Slot == (Object)null)
			{
				return list;
			}
			if (card.HasAbility((Ability)33))
			{
				List<CardSlot> list2 = (card.OpponentCard ? Singleton<BoardManager>.Instance.PlayerSlotsCopy : Singleton<BoardManager>.Instance.OpponentSlotsCopy);
				if (list2.Exists((CardSlot x) => (Object)(object)x.Card != (Object)null && !card.CanAttackDirectly(x)))
				{
					foreach (CardSlot item in list2)
					{
						if ((Object)(object)item.Card != (Object)null && !card.CanAttackDirectly(item))
						{
							list.Add(item);
						}
					}
				}
				else if (list2.Count > 0)
				{
					list.Add(list2[0]);
				}
			}
			else
			{
				list.Add(card.Slot.opposingSlot);
			}
			if (card.HasAbility((Ability)24))
			{
				list.Remove(card.Slot.opposingSlot);
			}
			list.Sort((CardSlot a, CardSlot b) => a.Index - b.Index);
			return list;
		}

		[HarmonyPostfix]
		[HarmonyPriority(0)]
		public static void Postfix(PlayableCard __instance, ref List<CardSlot> __result, List<CardSlot> __state)
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance == (Object)null || __result == null || !__instance.OnBoard || (Object)(object)__instance.Slot == (Object)null || __state == null)
			{
				return;
			}
			bool flag = OpportunistStrikeAPI.ability != null && __instance.HasAbility(OpportunistStrikeAPI.ability.Id);
			bool flag2 = HasWolf(__instance);
			if (!flag && !flag2)
			{
				return;
			}
			Dictionary<CardSlot, int> dictionary = new Dictionary<CardSlot, int>();
			foreach (CardSlot item in __state)
			{
				if (!((Object)(object)item == (Object)null))
				{
					if (!dictionary.ContainsKey(item))
					{
						dictionary[item] = 0;
					}
					dictionary[item]++;
				}
			}
			List<AttackReplicationEvent> list = new List<AttackReplicationEvent>();
			foreach (CardSlot item2 in __result)
			{
				if (!((Object)(object)item2 == (Object)null))
				{
					bool wolfEligible = true;
					if (dictionary.TryGetValue(item2, out var value) && value > 0)
					{
						dictionary[item2] = value - 1;
						wolfEligible = false;
					}
					list.Add(new AttackReplicationEvent(item2, pigCopied: false, wolfCopied: false, wolfEligible));
				}
			}
			List<AttackReplicationEvent> list2 = new List<AttackReplicationEvent>();
			foreach (AttackReplicationEvent item3 in list)
			{
				list2.Add(item3);
				if (flag && CanPigCopy(__instance, item3.Target))
				{
					list2.Add(new AttackReplicationEvent(item3.Target, pigCopied: true, wolfCopied: false, wolfEligible: true));
				}
			}
			List<AttackReplicationEvent> list3 = new List<AttackReplicationEvent>();
			if (flag2)
			{
				foreach (AttackReplicationEvent item4 in list2)
				{
					if (item4.WolfEligible)
					{
						list3.Add(new AttackReplicationEvent(item4.Target, item4.PigCopied, wolfCopied: true, wolfEligible: false));
						if (flag && !item4.PigCopied && CanPigCopy(__instance, item4.Target))
						{
							list3.Add(new AttackReplicationEvent(item4.Target, pigCopied: true, wolfCopied: true, wolfEligible: false));
						}
					}
				}
			}
			List<AttackReplicationEvent> list4 = new List<AttackReplicationEvent>();
			list4.AddRange(list2);
			list4.AddRange(list3);
			__result.Clear();
			foreach (AttackReplicationEvent item5 in list4)
			{
				__result.Add(item5.Target);
			}
			AttackReplicationState.Set(__instance, list4);
		}

		private static bool CanPigCopy(PlayableCard attacker, CardSlot target)
		{
			if ((Object)(object)attacker == (Object)null || (Object)(object)target == (Object)null)
			{
				return false;
			}
			if ((Object)(object)target.Card == (Object)null || target.Card.Dead)
			{
				return true;
			}
			return attacker.CanAttackDirectly(target);
		}

		private static bool HasWolf(PlayableCard card)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)card == (Object)null || (Object)(object)((Card)card).Info == (Object)null || WolfAndJackalAPI.ability == null)
			{
				return false;
			}
			return card.HasAbility(WolfAndJackalAPI.ability.Id);
		}
	}
	[HarmonyPatch(typeof(CombatPhaseManager), "SlotAttackSequence")]
	public static class AttackReplicationSequencePatch
	{
		[HarmonyPrefix]
		public static void Prefix(CardSlot slot)
		{
			if ((Object)(object)slot != (Object)null && (Object)(object)slot.Card != (Object)null)
			{
				AttackReplicationState.Clear(slot.Card);
			}
		}

		[HarmonyPostfix]
		public static void Postfix(CardSlot slot, ref IEnumerator __result)
		{
			if (!((Object)(object)slot == (Object)null) && !((Object)(object)slot.Card == (Object)null) && __result != null)
			{
				__result = CleanupSequence(__result, slot.Card);
			}
		}

		private static IEnumerator CleanupSequence(IEnumerator original, PlayableCard attacker)
		{
			try
			{
				while (original.MoveNext())
				{
					yield return original.Current;
				}
			}
			finally
			{
				AttackReplicationState.Clear(attacker);
			}
		}
	}
	[HarmonyPatch(typeof(CombatPhaseManager), "SlotAttackSlot")]
	public static class OpportunistStrikePatch
	{
		[HarmonyPrefix]
		public static bool Prefix(CardSlot attackingSlot, CardSlot opposingSlot, float waitAfter, ref IEnumerator __result)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)attackingSlot == (Object)null || (Object)(object)opposingSlot == (Object)null || (Object)(object)attackingSlot.Card == (Object)null)
			{
				return true;
			}
			PlayableCard card = attackingSlot.Card;
			if (OpportunistStrikeAPI.ability == null || !card.HasAbility(OpportunistStrikeAPI.ability.Id))
			{
				return true;
			}
			AttackReplicationState.TryConsume(card, opposingSlot, out var _);
			if ((Object)(object)opposingSlot.Card != (Object)null && !opposingSlot.Card.Dead && !card.CanAttackDirectly(opposingSlot))
			{
				__result = FailedAttack(card);
				return false;
			}
			return true;
		}

		private static IEnumerator FailedAttack(PlayableCard attacker)
		{
			if ((Object)(object)attacker != (Object)null && (Object)(object)((Card)attacker).Anim != (Object)null)
			{
				((Card)attacker).Anim.StrongNegationEffect();
			}
			yield break;
		}
	}
}
namespace OLD_SA.Combat
{
	public static class AttackContext
	{
		public static PlayableCard Card;

		public static PlayableCard OriginalAttacker;

		public static CardSlot OriginalSlot;

		public static int Remaining;

		public static int AttackIndex;

		public static bool Active;

		public static int ArmorStrikeStacks;

		public static void Start(PlayableCard card, int amount, int armorStrikeStacks = 0)
		{
			Card = card;
			Remaining = amount;
			AttackIndex = 0;
			Active = true;
			OriginalAttacker = card;
			OriginalSlot = (((Object)(object)card != (Object)null) ? card.Slot : null);
			ArmorStrikeStacks = armorStrikeStacks;
			if ((Object)(object)card != (Object)null)
			{
				LastAttackState.Start(card, card.Slot);
			}
			else
			{
				LastAttackState.Clear();
			}
		}

		public static bool Is(PlayableCard card)
		{
			return Active && (Object)(object)Card == (Object)(object)card;
		}

		public static bool HasRemaining()
		{
			return Active && Remaining > 0;
		}

		public static void Consume()
		{
			if (Remaining > 0)
			{
				Remaining--;
			}
			AttackIndex++;
		}

		public static bool TryGetOriginalAttack(out PlayableCard attacker, out CardSlot slot)
		{
			attacker = OriginalAttacker;
			slot = OriginalSlot;
			return (Object)(object)attacker != (Object)null && (Object)(object)slot != (Object)null;
		}

		public static void Clear()
		{
			Card = null;
			OriginalAttacker = null;
			OriginalSlot = null;
			Remaining = 0;
			AttackIndex = 0;
			Active = false;
			ArmorStrikeStacks = 0;
			LastAttackState.Clear();
		}
	}
	[HarmonyPatch]
	public static class CustomAttackDamagePatch
	{
		private static MethodBase TargetMethod()
		{
			Type type = AccessTools.TypeByName("InscryptionAPI.Triggers.SlotAttackSlotPatches");
			if (type == null)
			{
				return null;
			}
			return AccessTools.Method(type, "DamageToDealThisPhase", (Type[])null, (Type[])null);
		}

		[HarmonyPostfix]
		private static void Postfix(CardSlot __0, CardSlot __1, ref int __result)
		{
			if (CustomAttackResolver.IsAdditionalAttack && !((Object)(object)__0 == (Object)null) && !((Object)(object)__1 == (Object)null) && __0.IsPlayerSlot && !__1.IsPlayerSlot && !((Object)(object)__1.Card != (Object)null) && !((Object)(object)Singleton<TurnManager>.Instance == (Object)null) && !Singleton<TurnManager>.Instance.IsPlayerTurn && __result < 0)
			{
				__result = -__result;
			}
		}
	}
	public static class CustomAttackResolver
	{
		public static bool IsAdditionalAttack;

		public static IEnumerator RequestAttack(CardSlot attacker, CardSlot target)
		{
			return RequestAttack(attacker, target, allowDeadAttacker: false);
		}

		public static IEnumerator RequestAttack(CardSlot attacker, CardSlot target, bool allowDeadAttacker)
		{
			if ((Object)(object)attacker == (Object)null || (Object)(object)target == (Object)null || (Object)(object)attacker.Card == (Object)null || (attacker.Card.Dead && !allowDeadAttacker))
			{
				yield break;
			}
			ExtraAttackQueue.AttackRequest request = ExtraAttackQueue.Enqueue(attacker, target, allowDeadAttacker);
			if (request != null)
			{
				while (!request.completed)
				{
					yield return null;
				}
			}
		}

		public static IEnumerator RequestAttacks(CardSlot attacker, CardSlot target, int count, bool allowDeadAttacker = false)
		{
			if (count <= 0 || (Object)(object)attacker == (Object)null || (Object)(object)target == (Object)null || (Object)(object)attacker.Card == (Object)null || (attacker.Card.Dead && !allowDeadAttacker))
			{
				yield break;
			}
			ExtraAttackQueue.AttackRequest lastRequest = null;
			for (int i = 0; i < count; i++)
			{
				ExtraAttackQueue.AttackRequest request = ExtraAttackQueue.Enqueue(attacker, target, allowDeadAttacker);
				if (request != null)
				{
					lastRequest = request;
				}
			}
			if (lastRequest != null)
			{
				while (!lastRequest.completed)
				{
					yield return null;
				}
			}
		}
	}
	[HarmonyPatch(typeof(CombatPhaseManager), "SlotAttackSequence")]
	public static class DynamicAttackPatch
	{
		[HarmonyPrefix]
		public static bool Prefix(CombatPhaseManager __instance, CardSlot slot, ref IEnumerator __result)
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Invalid comparison between Unknown and I4
			if ((Object)(object)slot == (Object)null || (Object)(object)slot.Card == (Object)null)
			{
				return true;
			}
			PlayableCard card = slot.Card;
			if (card.HasAbility((Ability)53))
			{
				return true;
			}
			if (!AttackContext.Is(card))
			{
				int num = card.GetOpposingSlots()?.Count ?? 0;
				int num2 = ExtraAttackState.TakeForAttack(card);
				int num3 = 0;
				bool flag = card.HasAbility(ArmorStrikeAPI.ArmorStrikeAbility);
				int abilityStacks = CardExtensions.GetAbilityStacks(card, (Ability)54);
				int num4 = 0;
				if (card.Status != null && card.Status.hiddenAbilities != null)
				{
					foreach (Ability hiddenAbility in card.Status.hiddenAbilities)
					{
						if ((int)hiddenAbility == 54)
						{
							num4++;
						}
					}
				}
				if (flag)
				{
					num3 = Mathf.Max(0, abilityStacks - num4);
					num2 += num3;
				}
				int num5 = num + num2;
				if (num5 <= 1)
				{
					return true;
				}
				AttackContext.Start(card, num5, num3);
			}
			__result = DynamicSequence(__instance, slot);
			return false;
		}

		private static IEnumerator DynamicSequence(CombatPhaseManager manager, CardSlot slot)
		{
			PlayableCard card = slot.Card;
			Singleton<ViewManager>.Instance.SwitchToView(Singleton<BoardManager>.Instance.CombatView, false, false);
			Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)1;
			while (AttackContext.HasRemaining() && !((Object)(object)card == (Object)null) && !card.Dead && !((Object)(object)card.Slot == (Object)null))
			{
				List<CardSlot> targets = card.GetOpposingSlots();
				if (targets == null || targets.Count == 0)
				{
					break;
				}
				int index = Mathf.Min(AttackContext.AttackIndex, targets.Count - 1);
				CardSlot target = targets[index];
				if ((Object)(object)target == (Object)null)
				{
					AttackContext.Consume();
					continue;
				}
				yield return manager.SlotAttackSlot(card.Slot, target, (targets.Count > 1) ? 0.1f : 0f);
				AttackContext.Consume();
			}
			AttackContext.Clear();
			Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)1;
		}
	}
	public static class ExtraAttackQueue
	{
		public class AttackRequest
		{
			public CardSlot attacker;

			public CardSlot target;

			public bool completed;

			public bool allowDeadAttacker;
		}

		private static Queue<AttackRequest> queue = new Queue<AttackRequest>();

		private static List<AttackRequest> waitingRequests = new List<AttackRequest>();

		private static bool running = false;

		public static AttackRequest Enqueue(CardSlot attacker, CardSlot target, bool allowDeadAttacker = false)
		{
			if ((Object)(object)attacker == (Object)null || (Object)(object)target == (Object)null || (Object)(object)attacker.Card == (Object)null || (attacker.Card.Dead && !allowDeadAttacker))
			{
				return null;
			}
			AttackRequest attackRequest = new AttackRequest
			{
				attacker = attacker,
				target = target,
				completed = false,
				allowDeadAttacker = allowDeadAttacker
			};
			queue.Enqueue(attackRequest);
			waitingRequests.Add(attackRequest);
			if (!running)
			{
				running = true;
				((MonoBehaviour)Singleton<GameFlowManager>.Instance).StartCoroutine(ProcessQueue());
			}
			return attackRequest;
		}

		private static IEnumerator ProcessQueue()
		{
			while (queue.Count > 0 || ExtraDamageQueue.HasDamage())
			{
				if (queue.Count > 0)
				{
					AttackRequest attack = queue.Dequeue();
					if ((Object)(object)attack.attacker != (Object)null && (Object)(object)attack.target != (Object)null && (Object)(object)attack.attacker.Card != (Object)null && (!attack.attacker.Card.Dead || attack.allowDeadAttacker))
					{
						yield return ExtraCombatBridge.ExecuteAttack(attack.attacker, attack.target, attack.allowDeadAttacker);
					}
					yield return (object)new WaitForSeconds(0.1f);
				}
				else if (ExtraDamageQueue.HasDamage())
				{
					yield return ExtraDamageQueue.ResolveAll();
				}
			}
			foreach (AttackRequest request in waitingRequests)
			{
				request.completed = true;
			}
			waitingRequests.Clear();
			running = false;
			if (queue.Count > 0 || ExtraDamageQueue.HasDamage())
			{
				running = true;
				((MonoBehaviour)Singleton<GameFlowManager>.Instance).StartCoroutine(ProcessQueue());
			}
		}
	}
	public class CardExtraAttackData
	{
		public int Temporary = 0;

		public int Stored = 0;
	}
	public static class ExtraAttackState
	{
		private static Dictionary<PlayableCard, CardExtraAttackData> data = new Dictionary<PlayableCard, CardExtraAttackData>();

		private static bool wolfProcessing = false;

		private static CardExtraAttackData Get(PlayableCard card)
		{
			if ((Object)(object)card == (Object)null)
			{
				return null;
			}
			if (!data.ContainsKey(card))
			{
				data[card] = new CardExtraAttackData();
			}
			return data[card];
		}

		public static void AddTemporary(PlayableCard card, int amount)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			CardExtraAttackData cardExtraAttackData = Get(card);
			if (cardExtraAttackData == null || amount <= 0)
			{
				return;
			}
			cardExtraAttackData.Temporary += amount;
			if (wolfProcessing || !card.HasAbility(WolfAndJackalAPI.ability.Id))
			{
				return;
			}
			wolfProcessing = true;
			try
			{
				cardExtraAttackData.Temporary += amount;
			}
			finally
			{
				wolfProcessing = false;
			}
		}

		public static void AddStored(PlayableCard card, int amount)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			CardExtraAttackData cardExtraAttackData = Get(card);
			if (cardExtraAttackData == null || amount <= 0)
			{
				return;
			}
			cardExtraAttackData.Stored += amount;
			if (wolfProcessing || !card.HasAbility(WolfAndJackalAPI.ability.Id))
			{
				return;
			}
			wolfProcessing = true;
			try
			{
				cardExtraAttackData.Stored += amount;
			}
			finally
			{
				wolfProcessing = false;
			}
		}

		public static int TakeForAttack(PlayableCard card)
		{
			CardExtraAttackData cardExtraAttackData = Get(card);
			if (cardExtraAttackData == null)
			{
				return 0;
			}
			int result = cardExtraAttackData.Temporary + cardExtraAttackData.Stored;
			cardExtraAttackData.Temporary = 0;
			return result;
		}

		public static int GetTotal(PlayableCard card)
		{
			CardExtraAttackData cardExtraAttackData = Get(card);
			if (cardExtraAttackData == null)
			{
				return 0;
			}
			return cardExtraAttackData.Temporary + cardExtraAttackData.Stored;
		}
	}
	public static class ExtraCombatBridge
	{
		public static int DamageThisAttack = 0;

		public static CombatPhaseManager Manager;

		private static readonly MethodInfo DamageSetter = typeof(CombatPhaseManager).GetProperty("DamageDealtThisPhase", BindingFlags.Instance | BindingFlags.Public)?.GetSetMethod(nonPublic: true);

		public static IEnumerator ExecuteAttack(CardSlot attacker, CardSlot target, bool allowDeadAttacker = false)
		{
			Manager = Singleton<CombatPhaseManager>.Instance;
			if ((Object)(object)Manager == (Object)null || (Object)(object)attacker == (Object)null || (Object)(object)target == (Object)null || (Object)(object)attacker.Card == (Object)null || (attacker.Card.Dead && !allowDeadAttacker))
			{
				yield break;
			}
			DamageThisAttack = 0;
			bool directAttack = (Object)(object)target.Card == (Object)null;
			int attackBefore = attacker.Card.Attack;
			if ((Object)(object)Singleton<ViewManager>.Instance != (Object)null && (Object)(object)Singleton<BoardManager>.Instance != (Object)null)
			{
				Singleton<ViewManager>.Instance.SwitchToView(Singleton<BoardManager>.Instance.CombatView, false, false);
				yield return (object)new WaitForSeconds(0.1f);
			}
			int before = Manager.DamageDealtThisPhase;
			yield return RunAdditionalAttack(Manager.SlotAttackSlot(attacker, target, 0f));
			int after = Manager.DamageDealtThisPhase;
			if (directAttack)
			{
				DamageThisAttack = Mathf.Max(0, attackBefore);
			}
			else
			{
				DamageThisAttack = Mathf.Max(0, after - before);
			}
			if (DamageSetter == null)
			{
				Debug.LogError((object)"[OLD_SA] 无法获取 DamageDealtThisPhase 的私有 setter。");
				yield break;
			}
			try
			{
				DamageSetter.Invoke(Manager, new object[1] { before });
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("[OLD_SA] 恢复原版战斗伤害统计失败:" + ex));
				yield break;
			}
			if (DamageThisAttack > 0)
			{
				ExtraDamageQueue.Add(attacker.IsPlayerSlot, DamageThisAttack);
			}
		}

		private static IEnumerator RunAdditionalAttack(IEnumerator routine)
		{
			if (routine == null)
			{
				yield break;
			}
			try
			{
				while (true)
				{
					bool moved = false;
					object current = null;
					bool previous = CustomAttackResolver.IsAdditionalAttack;
					try
					{
						CustomAttackResolver.IsAdditionalAttack = true;
						moved = routine.MoveNext();
						if (moved)
						{
							current = routine.Current;
						}
					}
					finally
					{
						CustomAttackResolver.IsAdditionalAttack = previous;
					}
					if (moved)
					{
						if (current is IEnumerator nested)
						{
							yield return RunAdditionalAttack(nested);
						}
						else
						{
							yield return current;
						}
						continue;
					}
					break;
				}
			}
			finally
			{
				if (routine is IDisposable disposable)
				{
					disposable.Dispose();
				}
			}
		}
	}
	public static class ExtraDamageQueue
	{
		private class DamageEntry
		{
			public bool playerAttack;

			public int damage;
		}

		private static List<DamageEntry> damages = new List<DamageEntry>();

		public static void Add(bool playerAttack, int damage)
		{
			if (damage > 0)
			{
				damages.Add(new DamageEntry
				{
					playerAttack = playerAttack,
					damage = damage
				});
			}
		}

		public static bool HasDamage()
		{
			return damages.Count > 0;
		}

		public static IEnumerator ResolveAll()
		{
			while (damages.Count > 0)
			{
				List<DamageEntry> batch = new List<DamageEntry>(damages);
				damages.Clear();
				int playerDamage = 0;
				int opponentDamage = 0;
				foreach (DamageEntry entry in batch)
				{
					if (entry.playerAttack)
					{
						playerDamage += entry.damage;
					}
					else
					{
						opponentDamage += entry.damage;
					}
				}
				if (playerDamage > 0)
				{
					yield return ExtraDamageResolver.Resolve(playerAttack: true, playerDamage);
				}
				if (opponentDamage > 0)
				{
					yield return ExtraDamageResolver.Resolve(playerAttack: false, opponentDamage);
				}
			}
		}
	}
	public static class ExtraDamageResolver
	{
		public static IEnumerator Resolve(bool playerAttack, int damage)
		{
			if (damage > 0)
			{
				yield return (object)new WaitForSeconds(0.4f);
				yield return MoveOriginalWeights(playerAttack);
				int excessDamage = 0;
				if (playerAttack)
				{
					excessDamage = Singleton<LifeManager>.Instance.Balance + damage - 5;
					excessDamage = Mathf.Max(0, excessDamage);
				}
				int scaleDamage = damage - excessDamage;
				if (scaleDamage > 0)
				{
					yield return Singleton<LifeManager>.Instance.ShowDamageSequence(scaleDamage, scaleDamage, !playerAttack, 0f, (GameObject)null, 0f, true);
				}
				if (Mathf.Abs(Singleton<LifeManager>.Instance.Balance) < 5 && excessDamage > 0 && playerAttack)
				{
					yield return ResolveCurrencyGain(excessDamage);
				}
			}
		}

		public static IEnumerator ResolveCurrencyGain(int amount)
		{
			if (amount > 0 && (!((Object)(object)Singleton<TurnManager>.Instance != (Object)null) || !((Object)(object)Singleton<TurnManager>.Instance.Opponent != (Object)null) || Singleton<TurnManager>.Instance.Opponent.NumLives <= 1))
			{
				if (AscensionSaveData.Data != null && AscensionSaveData.Data.ChallengeIsActive(ChallengeRegistry.MoneyShortageChallengeType))
				{
					ChallengeActivationUI.TryShowActivation(ChallengeRegistry.MoneyShortageChallengeType);
					yield break;
				}
				RunState run = RunState.Run;
				run.currency += amount;
				yield return ShowCurrencyGain(amount);
			}
		}

		private static IEnumerator SwitchToCombatView()
		{
			if (!((Object)(object)Singleton<ViewManager>.Instance == (Object)null))
			{
				Singleton<ViewManager>.Instance.SwitchToView(Singleton<BoardManager>.Instance.CombatView, false, false);
				yield return (object)new WaitForSeconds(0.1f);
			}
		}

		private static IEnumerator ShowCurrencyGain(int amount)
		{
			if ((Object)(object)Singleton<ViewManager>.Instance != (Object)null && (Object)(object)Singleton<BoardManager>.Instance != (Object)null)
			{
				Singleton<ViewManager>.Instance.SwitchToView(Singleton<BoardManager>.Instance.DefaultView, false, false);
				yield return (object)new WaitForSeconds(0.25f);
			}
			if ((Object)(object)Singleton<CurrencyBowl>.Instance != (Object)null)
			{
				yield return Singleton<CurrencyBowl>.Instance.ShowGain(Mathf.Min(20, amount), false, false);
			}
		}

		private static IEnumerator MoveOriginalWeights(bool playerAttack)
		{
			CombatPhaseManager instance = Singleton<CombatPhaseManager>.Instance;
			CombatPhaseManager3D manager = (CombatPhaseManager3D)(object)((instance is CombatPhaseManager3D) ? instance : null);
			if ((Object)(object)manager == (Object)null)
			{
				yield break;
			}
			FieldInfo field = typeof(CombatPhaseManager3D).GetField("damageWeights", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field == null)
			{
				yield break;
			}
			List<Transform> weights = field.GetValue(manager) as List<Transform>;
			if (weights == null || weights.Count == 0 || (Object)(object)Singleton<LifeManager>.Instance.Scales3D == (Object)null)
			{
				yield break;
			}
			Vector3 scalePos = (playerAttack ? Singleton<LifeManager>.Instance.Scales3D.OpponentSide : Singleton<LifeManager>.Instance.Scales3D.PlayerSide);
			foreach (Transform weight in weights)
			{
				if (!((Object)(object)weight == (Object)null))
				{
					Tween.Position(weight, scalePos, 0.2f, 0f, Tween.EaseOut, (LoopType)0, (Action)null, (Action)null, true);
					Object.Destroy((Object)(object)((Component)weight).gameObject, 0.2f);
					yield return (object)new WaitForSeconds(0.02f);
				}
			}
			weights.Clear();
			yield return (object)new WaitForSeconds(0.25f);
		}
	}
	[HarmonyPatch]
	public static class ExtraWeightPatch
	{
		private static MethodBase TargetMethod()
		{
			return AccessTools.Method(typeof(CombatPhaseManager3D), "VisualizeCardAttackingDirectly", new Type[3]
			{
				typeof(CardSlot),
				typeof(CardSlot),
				typeof(int)
			}, (Type[])null);
		}

		[HarmonyPrefix]
		private static void Prefix(CardSlot attackingSlot, CardSlot targetSlot, ref int damage)
		{
			if (CustomAttackResolver.IsAdditionalAttack && !((Object)(object)attackingSlot == (Object)null) && !((Object)(object)targetSlot == (Object)null) && !((Object)(object)targetSlot.Card != (Object)null) && damage < 0)
			{
				damage = (((Object)(object)attackingSlot.Card != (Object)null) ? Mathf.Max(0, attackingSlot.Card.Attack) : 0);
			}
		}
	}
	public static class LastAttackState
	{
		public static PlayableCard Attacker;

		public static CardSlot AttackSlot;

		public static void Start(PlayableCard attacker, CardSlot slot)
		{
			Attacker = attacker;
			AttackSlot = slot;
		}

		public static void Clear()
		{
			Attacker = null;
			AttackSlot = null;
		}
	}
	[HarmonyPatch(typeof(CombatPhaseManager), "SlotAttackSequence")]
	public static class OriginalAttackRecordPatch
	{
		[HarmonyPrefix]
		public static void Prefix(CardSlot slot)
		{
			if (!((Object)(object)slot == (Object)null) && !((Object)(object)slot.Card == (Object)null))
			{
				LastAttackState.Start(slot.Card, slot);
			}
		}
	}
	[HarmonyPatch(typeof(CombatPhaseManager), "DealOverkillDamage")]
	public static class OverkillPatch
	{
		[HarmonyPrefix]
		public static bool Prefix(CombatPhaseManager __instance, int damage, CardSlot attackingSlot, CardSlot opposingSlot, ref IEnumerator __result)
		{
			if (damage <= 0 || (Object)(object)opposingSlot == (Object)null)
			{
				return true;
			}
			PlayableCard cardQueuedForSlot = Singleton<BoardManager>.Instance.GetCardQueuedForSlot(opposingSlot);
			if ((Object)(object)cardQueuedForSlot == (Object)null)
			{
				return true;
			}
			if (EnemyDrawCreatedCardPatch.PendingOverkillProtection.Contains(cardQueuedForSlot))
			{
				EnemyDrawCreatedCardPatch.PendingOverkillProtection.Remove(cardQueuedForSlot);
				__result = EmptyRoutine();
				return false;
			}
			if (EnemyDrawCreatedCardPatch.MergingCards.Contains(cardQueuedForSlot))
			{
				__result = EmptyRoutine();
				return false;
			}
			PlayableCard attacker = LastAttackState.Attacker;
			if ((Object)(object)attacker == (Object)null)
			{
				return true;
			}
			__result = DealOverkillReplacement(cardQueuedForSlot, attacker, damage);
			return false;
		}

		private static IEnumerator EmptyRoutine()
		{
			yield break;
		}

		private static IEnumerator DealOverkillReplacement(PlayableCard card, PlayableCard attacker, int damage)
		{
			if ((Object)(object)card == (Object)null)
			{
				yield break;
			}
			yield return (object)new WaitForSeconds(0.1f);
			Singleton<ViewManager>.Instance.SwitchToView(Singleton<BoardManager>.Instance.QueueView, false, false);
			try
			{
				yield return (object)new WaitForSeconds(0.3f);
				if (card.HasAbility((Ability)21))
				{
					yield return ShowBlocked(card);
					yield break;
				}
				yield return PreOverkillDamage(card);
				yield return card.TakeDamage(damage, attacker);
				yield return PostOverkillDamage(card);
			}
			finally
			{
				Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
			}
		}

		private static IEnumerator PreOverkillDamage(PlayableCard card)
		{
			MethodInfo method = AccessTools.Method(typeof(CombatPhaseManager), "PreOverkillDamage", (Type[])null, (Type[])null);
			if (!(method == null) && method.Invoke(Singleton<CombatPhaseManager>.Instance, new object[1] { card }) is IEnumerator routine)
			{
				yield return routine;
			}
		}

		private static IEnumerator PostOverkillDamage(PlayableCard card)
		{
			MethodInfo method = AccessTools.Method(typeof(CombatPhaseManager), "PostOverkillDamage", (Type[])null, (Type[])null);
			if (!(method == null) && method.Invoke(Singleton<CombatPhaseManager>.Instance, new object[1] { card }) is IEnumerator routine)
			{
				yield return routine;
			}
		}

		private static IEnumerator ShowBlocked(PlayableCard card)
		{
			MethodInfo method = AccessTools.Method(typeof(CombatPhaseManager), "ShowCardBlocked", (Type[])null, (Type[])null);
			if (!(method == null) && method.Invoke(Singleton<CombatPhaseManager>.Instance, new object[1] { card }) is IEnumerator routine)
			{
				yield return routine;
			}
		}
	}
}

Sigil/OldSa_Slow_Strike_sigil.dll

Decompiled 5 days 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_Slow_Strike_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Slow_Strike_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("076fd396-a7cb-4f3d-8cd1-87ad2a18dbc6")]
[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.SlowStrike;

[BepInPlugin("OLD_SA.SlowStrike", "OLD SA Slow Strike", "1.0.0")]
public class SlowStrikePlugin : 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
		((BaseUnityPlugin)this).Logger.LogInfo((object)"[OLD SA Slow Strike] Loading...");
		Harmony val = new Harmony("OLD_SA.SlowStrike");
		val.PatchAll();
		SlowStrikeAPI.Init();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"[OLD SA Slow Strike] Loaded!");
	}
}
[HarmonyPatch(typeof(CombatPhaseManager), "SlotAttackSlot")]
public static class SlowAttackPatch
{
	[HarmonyPrefix]
	public static bool Prefix(ref CardSlot attackingSlot)
	{
		if ((Object)(object)attackingSlot == (Object)null)
		{
			return true;
		}
		PlayableCard card = attackingSlot.Card;
		if ((Object)(object)card == (Object)null)
		{
			return true;
		}
		if (!SlowStrikeManager.HasBlockedAttack(card))
		{
			return true;
		}
		SlowStrikeManager.ConsumeBlockedAttack(card);
		((Card)card).Anim.StrongNegationEffect();
		return false;
	}
}
public static class SlowStrikeAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Slow Strike";
		val.rulebookName = "Slow Strike";
		val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
		val.powerLevel = 4;
		val.opponentUsable = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Slow_Strike.png", (FilterMode)0);
		FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(val, "When [creature] deals damage to the same opposing creature twice, that creature's next attack is negated.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(SlowStrikeBehaviour), imageAsTexture);
	}
}
public class SlowStrikeBehaviour : AbilityBehaviour
{
	private readonly Dictionary<PlayableCard, int> damageCounts = new Dictionary<PlayableCard, int>();

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

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

	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 break;
		}
		int count = 0;
		damageCounts.TryGetValue(target, out count);
		count++;
		if (count < 2)
		{
			damageCounts[target] = count;
			yield break;
		}
		damageCounts.Remove(target);
		yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
		if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && !((AbilityBehaviour)this).Card.Dead && !((Object)(object)target == (Object)null) && !target.Dead)
		{
			SlowStrikeManager.AddBlockedAttack(target);
			yield return ((AbilityBehaviour)this).LearnAbility(0.15f);
		}
	}
}
public static class SlowStrikeManager
{
	private static readonly HashSet<PlayableCard> blockedCards = new HashSet<PlayableCard>();

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

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

	public static bool ConsumeBlockedAttack(PlayableCard card)
	{
		if ((Object)(object)card == (Object)null)
		{
			return false;
		}
		return blockedCards.Remove(card);
	}

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

Sigil/OldSa_Split_sigil.dll

Decompiled 5 days 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_Split_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Split_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7f10d55c-8f75-49ca-b611-866a7b867b52")]
[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.Split;

[BepInPlugin("OLD_SA.Split", "OLD SA Split", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public const string GUID = "OLD_SA.Split";

	public const string NAME = "OLD SA Split";

	public const string VERSION = "1.0.0";

	private void Awake()
	{
		SplitAPI.Init();
	}
}
public static class SplitAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Split";
		val.rulebookName = "Split";
		val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
		val.powerLevel = 5;
		val.opponentUsable = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Split.png", (FilterMode)0);
		FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(val, "When [creature] dies, place a Split card on its left and right. The Split card's stats are half of this card's.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(SplitBehaviour), imageAsTexture);
	}
}
public class SplitBehaviour : ExtendedAbilityBehaviour
{
	private const string LEFT_PROPERTY = "Split_0";

	private const string RIGHT_PROPERTY = "Split_1";

	private const string DEFAULT_LEFT_CARD = "Skeleton";

	private const string DEFAULT_RIGHT_CARD = "Skeleton";

	public override Ability Ability => SplitAPI.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 ((Object)(object)card == (Object)null)
		{
			return false;
		}
		if (!fromCombat)
		{
			return false;
		}
		return (Object)(object)card == (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 || (Object)(object)card == (Object)null || (Object)(object)card != (Object)(object)((AbilityBehaviour)this).Card || !fromCombat)
		{
			yield break;
		}
		int originalAttack = card.Attack;
		int originalMaxHealth = ((Card)card).Info.Health;
		int splitAttack = Mathf.Max(0, Mathf.FloorToInt((float)originalAttack / 2f));
		int splitHealth = Mathf.Max(1, Mathf.FloorToInt((float)originalMaxHealth / 2f));
		string leftCardName = CardExtensions.GetExtendedProperty(((Card)card).Info, "Split_0");
		if (string.IsNullOrEmpty(leftCardName))
		{
			leftCardName = "Skeleton";
		}
		string rightCardName = CardExtensions.GetExtendedProperty(((Card)card).Info, "Split_1");
		if (string.IsNullOrEmpty(rightCardName))
		{
			rightCardName = "Skeleton";
		}
		BoardManager board = Singleton<BoardManager>.Instance;
		if (!((Object)(object)board == (Object)null))
		{
			CardSlot leftSlot = GetLeftSplitSlot(board, deathSlot, card.OpponentCard);
			CardSlot rightSlot = GetRightSplitSlot(board, deathSlot, card.OpponentCard);
			yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
			if ((Object)(object)leftSlot != (Object)null && (Object)(object)leftSlot.Card == (Object)null)
			{
				yield return SpawnSplitCard(leftCardName, leftSlot, splitAttack, splitHealth);
			}
			if ((Object)(object)rightSlot != (Object)null && (Object)(object)rightSlot.Card == (Object)null)
			{
				yield return SpawnSplitCard(rightCardName, rightSlot, splitAttack, splitHealth);
			}
			yield return ((AbilityBehaviour)this).LearnAbility(0.5f);
		}
	}

	private CardSlot GetLeftSplitSlot(BoardManager board, CardSlot deathSlot, bool opponentCard)
	{
		if ((Object)(object)board == (Object)null || (Object)(object)deathSlot == (Object)null)
		{
			return null;
		}
		CardSlot adjacent = board.GetAdjacent(deathSlot, true);
		if ((Object)(object)adjacent != (Object)null)
		{
			return adjacent;
		}
		List<CardSlot> list = (opponentCard ? board.OpponentSlotsCopy : board.PlayerSlotsCopy);
		if (list == null || list.Count == 0)
		{
			return null;
		}
		return list[list.Count - 1];
	}

	private CardSlot GetRightSplitSlot(BoardManager board, CardSlot deathSlot, bool opponentCard)
	{
		if ((Object)(object)board == (Object)null || (Object)(object)deathSlot == (Object)null)
		{
			return null;
		}
		CardSlot adjacent = board.GetAdjacent(deathSlot, false);
		if ((Object)(object)adjacent != (Object)null)
		{
			return adjacent;
		}
		List<CardSlot> list = (opponentCard ? board.OpponentSlotsCopy : board.PlayerSlotsCopy);
		if (list == null || list.Count == 0)
		{
			return null;
		}
		return list[0];
	}

	private IEnumerator SpawnSplitCard(string cardName, CardSlot targetSlot, int attack, int health)
	{
		if (string.IsNullOrEmpty(cardName) || (Object)(object)targetSlot == (Object)null || (Object)(object)targetSlot.Card != (Object)null)
		{
			yield break;
		}
		CardInfo splitInfo = CardLoader.GetCardByName(cardName);
		if ((Object)(object)splitInfo == (Object)null)
		{
			yield break;
		}
		object obj = splitInfo.Clone();
		splitInfo = (CardInfo)((obj is CardInfo) ? obj : null);
		if ((Object)(object)splitInfo == (Object)null)
		{
			yield break;
		}
		PlayableCard splitCard = CardSpawner.SpawnPlayableCardWithCopiedMods(splitInfo, ((AbilityBehaviour)this).Card, SplitAPI.ability.Id);
		if ((Object)(object)splitCard == (Object)null)
		{
			yield break;
		}
		CardModificationInfo splitStatMod = new CardModificationInfo();
		splitStatMod.attackAdjustment = attack - splitCard.Attack;
		splitStatMod.healthAdjustment = health - ((Card)splitCard).Info.Health;
		splitCard.AddTemporaryMod(splitStatMod);
		((Card)splitCard).RenderCard();
		((Component)splitCard).transform.position = ((Component)targetSlot).transform.position + Vector3.back * 2f + Vector3.up * 2f;
		((Component)splitCard).transform.rotation = Quaternion.Euler(110f, 90f, 90f);
		BoardManager board = Singleton<BoardManager>.Instance;
		if ((Object)(object)board == (Object)null)
		{
			yield break;
		}
		if ((Object)(object)targetSlot.Card != (Object)null)
		{
			if ((Object)(object)splitCard != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)splitCard).gameObject);
			}
			yield break;
		}
		yield return board.ResolveCardOnBoard(splitCard, targetSlot, 0.1f, (Action)null, true);
		if ((Object)(object)splitCard != (Object)null && (Object)(object)splitCard.Slot != (Object)null && (Object)(object)((Card)splitCard).Anim != (Object)null)
		{
			((Card)splitCard).Anim.StrongNegationEffect();
		}
	}
}

Sigil/OldSa_Strafe Strike_sigil.dll

Decompiled 5 days 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.Combat;
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()
	{
		//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)
		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		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);
		Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("OldSa_Strafe_Strike_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, "After [creature] moves, it attacks.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(StrafeStrikeBehaviour), imageAsTexture);
		if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
		{
			ProgressionData.Data.learnedAbilities.Add(ability.Id);
		}
	}
}
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))
		{
			attackingSlot = ((AbilityBehaviour)this).Card.Slot;
			if ((Object)(object)attackingSlot.opposingSlot != (Object)null)
			{
				yield return CustomAttackResolver.RequestAttack(attackingSlot, attackingSlot.opposingSlot);
			}
			yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
		}
	}
}

Sigil/OldSa_Sweep_sigil.dll

Decompiled 5 days 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.Sweep;
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_Sweep_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Sweep_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("03d52a77-6a08-49a6-b9f9-13e4baedbd73")]
[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.Sweep
{
	public static class SweepAPI
	{
		public static FullAbility ability;

		public static void Init()
		{
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Sweep";
			val.rulebookName = "Sweep";
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.powerLevel = 5;
			val.opponentUsable = true;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Sweep.png", (FilterMode)0);
			FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(val, "When [creature] attacks, it deals 1 damage to all enemy creatures.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(SweepBehaviour), imageAsTexture);
			if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
			{
				ProgressionData.Data.learnedAbilities.Add(ability.Id);
			}
		}
	}
	public class SweepBehaviour : AbilityBehaviour
	{
		public override Ability Ability => SweepAPI.ability.Id;
	}
	public static class SweepAttackContext
	{
		public static PlayableCard AttackingCard;

		public static CardSlot TargetSlot;

		public static void Set(PlayableCard attackingCard, CardSlot targetSlot)
		{
			AttackingCard = attackingCard;
			TargetSlot = targetSlot;
		}

		public static void Clear()
		{
			AttackingCard = null;
			TargetSlot = null;
		}

		public static bool ShouldUseOneAttack(PlayableCard card)
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			return (Object)(object)card != (Object)null && (Object)(object)card == (Object)(object)AttackingCard && (Object)(object)TargetSlot != (Object)null && (Object)(object)TargetSlot.Card != (Object)null && !TargetSlot.Card.Dead && card.HasAbility(SweepAPI.ability.Id);
		}
	}
	[HarmonyPatch]
	public static class SweepAttackContextPatch
	{
		private static MethodBase TargetMethod()
		{
			return AccessTools.Method(typeof(CombatPhaseManager), "SlotAttackSlot", (Type[])null, (Type[])null);
		}

		public static void Postfix(CardSlot attackingSlot, CardSlot opposingSlot, float waitAfter, ref IEnumerator __result)
		{
			if (__result != null)
			{
				PlayableCard attackingCard = (((Object)(object)attackingSlot != (Object)null) ? attackingSlot.Card : null);
				__result = WrapAttack(__result, attackingCard, opposingSlot);
			}
		}

		private static IEnumerator WrapAttack(IEnumerator original, PlayableCard attackingCard, CardSlot opposingSlot)
		{
			try
			{
				while (true)
				{
					SweepAttackContext.Set(attackingCard, opposingSlot);
					bool moved;
					object current;
					try
					{
						moved = original.MoveNext();
						current = (moved ? original.Current : null);
					}
					finally
					{
						SweepAttackContext.Clear();
					}
					if (moved)
					{
						yield return current;
						current = null;
						continue;
					}
					break;
				}
			}
			finally
			{
				SweepAttackContext.Clear();
			}
		}
	}
	[HarmonyPatch]
	public static class SweepAttackValuePatch
	{
		private static MethodBase TargetMethod()
		{
			return AccessTools.PropertyGetter(typeof(PlayableCard), "Attack");
		}

		public static void Postfix(PlayableCard __instance, ref int __result)
		{
			if (SweepAttackContext.ShouldUseOneAttack(__instance))
			{
				__result = 1;
			}
		}
	}
	[HarmonyPatch(typeof(PlayableCard), "GetOpposingSlots")]
	public static class SweepTargetPatch
	{
		public static void Postfix(PlayableCard __instance, ref List<CardSlot> __result)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance == (Object)null || !__instance.HasAbility(SweepAPI.ability.Id))
			{
				return;
			}
			BoardManager instance = Singleton<BoardManager>.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			List<CardSlot> list = (__instance.OpponentCard ? instance.PlayerSlotsCopy : instance.OpponentSlotsCopy);
			List<CardSlot> list2 = new List<CardSlot>();
			foreach (CardSlot item in list)
			{
				if (!((Object)(object)item == (Object)null) && !((Object)(object)item.Card == (Object)null) && !item.Card.Dead)
				{
					list2.Add(item);
				}
			}
			if (list2.Count > 0)
			{
				__result = list2;
			}
		}
	}
	[HarmonyPatch(typeof(PlayableCard), "TakeDamage")]
	public static class SweepDamagePatch
	{
		public static void Prefix(PlayableCard __instance, ref int damage, PlayableCard attacker)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)attacker == (Object)null) && attacker.HasAbility(SweepAPI.ability.Id))
			{
				damage = 1;
			}
		}
	}
}
namespace OLD_SA_Sweep
{
	[BepInPlugin("OLD_SA.Sweep", "OLD SA Sweep", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string GUID = "OLD_SA.Sweep";

		public const string NAME = "OLD SA Sweep";

		public const string VERSION = "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
			SweepAPI.Init();
			Harmony val = new Harmony("OLD_SA.Sweep");
			val.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"OLD SA Sweep loaded.");
		}
	}
}

Sigil/OldSa_Tempest_sigil.dll

Decompiled 5 days 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_Vampire_sigil.dll

Decompiled 5 days 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.Vampire;
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_Vampire_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Vampire_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e01b4fe2-5b05-4f2d-a419-dadef7ab74f6")]
[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.Vampire
{
	public static class VampireAPI
	{
		public static FullAbility ability;

		public static void Init()
		{
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Vampire";
			val.rulebookName = "Vampire";
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.powerLevel = 3;
			val.opponentUsable = true;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Vampire.png", (FilterMode)0);
			FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(val, "When [creature] deals damage, it heals 1 damage.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(VampireBehaviour), imageAsTexture);
			if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
			{
				ProgressionData.Data.learnedAbilities.Add(ability.Id);
			}
		}
	}
	public class VampireBehaviour : AbilityBehaviour
	{
		public override Ability Ability => VampireAPI.ability.Id;

		public override bool RespondsToDealDamage(int amount, PlayableCard target)
		{
			return amount >= 1 && (Object)(object)((AbilityBehaviour)this).Card != (Object)null && !((AbilityBehaviour)this).Card.Dead && ((AbilityBehaviour)this).Card.OnBoard;
		}

		public override IEnumerator OnDealDamage(int amount, PlayableCard target)
		{
			yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
			if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && !((AbilityBehaviour)this).Card.Dead)
			{
				int missingHealth = ((AbilityBehaviour)this).Card.MaxHealth - ((AbilityBehaviour)this).Card.Health;
				if (missingHealth > 0)
				{
					((AbilityBehaviour)this).Card.HealDamage(1);
					((Card)((AbilityBehaviour)this).Card).RenderCard();
				}
				yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
			}
		}
	}
}
namespace OLD_SA_Vampire
{
	[BepInPlugin("OLD_SA.Vampire", "OLD SA Vampire", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string GUID = "OLD_SA.Vampire";

		public const string NAME = "OLD SA Vampire";

		public const string VERSION = "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
			VampireAPI.Init();
			Harmony val = new Harmony("OLD_SA.Vampire");
			val.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"OLD SA Vampire loaded.");
		}
	}
}

Sigil/OldSa_Wind's Blessing_sigil.dll

Decompiled 5 days 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, "OLD_SA_WIND_PTEROSAUR");
		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 5 days 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()));
	}
}
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 5 days 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)
		//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: 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);
		if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
		{
			ProgressionData.Data.learnedAbilities.Add(ability.Id);
		}
	}
}
public class WritheBehaviour : AbilityBehaviour
{
	public override Ability Ability => WritheAPI.ability.Id;
}
[HarmonyPatch]
public static class WrithePatch
{
	private static MethodBase TargetMethod()
	{
		return AccessTools.Method(typeof(PlayableCard), "TakeDamage", new Type[2]
		{
			typeof(int),
			typeof(PlayableCard)
		}, (Type[])null);
	}

	[HarmonyPrefix]
	public static bool Prefix(PlayableCard __instance, int damage, PlayableCard attacker, ref IEnumerator __result)
	{
		//IL_001c: 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) || __instance.Dead || damage <= 0)
		{
			return true;
		}
		int health = __instance.Health;
		int num = Mathf.Max(0, __instance.Attack);
		if (damage < health)
		{
			return true;
		}
		int num2 = Mathf.Max(0, health - 1);
		int num3 = damage - num2;
		if (num3 > num)
		{
			return true;
		}
		__result = WritheTakeDamageSequence(__instance, num2, num3, damage, attacker);
		return false;
	}

	private static IEnumerator WritheTakeDamageSequence(PlayableCard card, int healthDamage, int overflow, int originalDamage, PlayableCard attacker)
	{
		if ((Object)(object)card == (Object)null || card.Dead)
		{
			yield break;
		}
		AbilityBehaviour writhe = (AbilityBehaviour)(object)((Component)card).GetComponent<WritheBehaviour>();
		MethodInfo preTriggerMethod = AccessTools.Method(typeof(AbilityBehaviour), "PreSuccessfulTriggerSequence", (Type[])null, (Type[])null);
		if ((Object)(object)writhe != (Object)null && preTriggerMethod != null && preTriggerMethod.Invoke(writhe, null) is IEnumerator sequence)
		{
			yield return sequence;
		}
		if ((Object)(object)card == (Object)null || card.Dead)
		{
			yield break;
		}
		if (healthDamage > 0)
		{
			PlayableCardStatus status = card.Status;
			status.damageTaken += healthDamage;
		}
		if ((Object)(object)((Card)card).Anim != (Object)null && card.Health > 0)
		{
			((Card)card).Anim.PlayHitAnimation();
		}
		if (overflow > 0)
		{
			CardModificationInfo attackLoss = new CardModificationInfo
			{
				attackAdjustment = -overflow
			};
			card.AddTemporaryMod(attackLoss);
		}
		card.OnStatsChanged();
		((Card)card).RenderCard();
		card.UpdateFaceUpOnBoardEffects();
		if ((Object)(object)attacker != (Object)null)
		{
			if (attacker.TriggerHandler.RespondsToTrigger((Trigger)9, new object[2] { originalDamage, card }))
			{
				yield return attacker.TriggerHandler.OnTrigger((Trigger)9, new object[2] { originalDamage, card });
			}
			yield return Singleton<GlobalTriggerHandler>.Instance.TriggerCardsOnBoard((Trigger)19, false, new object[3] { attacker, attacker.Attack, card });
		}
	}
}

Sigil/Old_Sa_Proliferation_sigil.dll

Decompiled 5 days 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 OLD_SA.Patches;
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)
		//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: 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);
		if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
		{
			ProgressionData.Data.learnedAbilities.Add(ability.Id);
		}
	}
}
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)
		{
			yield break;
		}
		object obj = ((Card)((AbilityBehaviour)this).Card).Info.Clone();
		CardInfo clone = (CardInfo)((obj is CardInfo) ? obj : null);
		if ((Object)(object)clone == (Object)null)
		{
			yield break;
		}
		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;
		if (clone.Mods == null)
		{
			clone.Mods = new List<CardModificationInfo>();
		}
		clone.Mods.Add(statMod);
		if (!((AbilityBehaviour)this).Card.OpponentCard)
		{
			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);
		}
		else
		{
			yield return SpawnEnemyCopy(clone);
			yield return ((AbilityBehaviour)this).LearnAbility(0.1f);
		}
	}

	private IEnumerator SpawnEnemyCopy(CardInfo info)
	{
		if ((Object)(object)info == (Object)null)
		{
			yield break;
		}
		Opponent opponent = Singleton<TurnManager>.Instance.Opponent;
		if ((Object)(object)opponent == (Object)null)
		{
			yield break;
		}
		CardSlot freeSlot = FindFreeQueueSlot(opponent);
		if ((Object)(object)freeSlot != (Object)null)
		{
			yield return opponent.QueueCard(info, freeSlot, true, true, true);
			PlayableCard created = Singleton<BoardManager>.Instance.GetCardQueuedForSlot(freeSlot);
			if ((Object)(object)created != (Object)null)
			{
				EnemyDrawCreatedCardPatch.PendingOverkillProtection.Add(created);
			}
			yield break;
		}
		PlayableCard same = FindSameQueuedCard(opponent, ((Object)info).name);
		if (!((Object)(object)same == (Object)null) && !EnemyDrawCreatedCardPatch.MergingCards.Contains(same))
		{
			EnemyDrawCreatedCardPatch.MergingCards.Add(same);
			PlayableCard temp = CardSpawner.SpawnPlayableCard(info);
			if ((Object)(object)temp == (Object)null)
			{
				EnemyDrawCreatedCardPatch.MergingCards.Remove(same);
				yield break;
			}
			MergeCardStats(same, temp);
			Object.Destroy((Object)(object)((Component)temp).gameObject);
			EnemyDrawCreatedCardPatch.MergingCards.Remove(same);
		}
	}

	private CardSlot FindFreeQueueSlot(Opponent opponent)
	{
		foreach (CardSlot slot in Singleton<BoardManager>.Instance.OpponentSlotsCopy)
		{
			if (!opponent.Queue.Exists((PlayableCard x) => (Object)(object)x != (Object)null && (Object)(object)x.QueuedSlot == (Object)(object)slot))
			{
				return slot;
			}
		}
		return null;
	}

	private PlayableCard FindSameQueuedCard(Opponent opponent, string name)
	{
		List<PlayableCard> list = new List<PlayableCard>();
		foreach (PlayableCard item in opponent.Queue)
		{
			if (!((Object)(object)item == (Object)null) && ((Object)((Card)item).Info).name == name)
			{
				list.Add(item);
			}
		}
		if (list.Count == 0)
		{
			return null;
		}
		return list[Random.Range(0, list.Count)];
	}

	private void MergeCardStats(PlayableCard target, PlayableCard source)
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Expected O, but got Unknown
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: 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)
		//IL_007d: 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)
		if ((Object)(object)target == (Object)null || (Object)(object)source == (Object)null)
		{
			return;
		}
		CardModificationInfo val = new CardModificationInfo();
		val.fromCardMerge = true;
		val.attackAdjustment = source.Attack;
		val.healthAdjustment = source.Health;
		val.abilities = new List<Ability>();
		foreach (Ability ability in ((Card)source).Info.Abilities)
		{
			if ((int)ability != 0 && !target.HasAbility(ability) && !val.abilities.Contains(ability))
			{
				val.abilities.Add(ability);
			}
		}
		if (val.attackAdjustment != 0 || val.healthAdjustment != 0 || val.abilities.Count != 0)
		{
			target.AddTemporaryMod(val);
			target.OnStatsChanged();
			((Card)target).RenderCard();
		}
	}
}

Challenge/OldSa_Battle.dll

Decompiled 5 days 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.Card;
using InscryptionAPI.Encounters;
using InscryptionAPI.Regions;
using OLD_SA.Boons;
using OLD_SA.Tribes;
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.Patches
{
	[HarmonyPatch(typeof(EncounterBuilder), "Build")]
	public static class CustomTerrainDifficultyContextPatch
	{
		public class BuildState
		{
			public int PreviousDifficulty;

			public bool PreviousHasDifficulty;
		}

		[ThreadStatic]
		private static int currentDifficulty;

		[ThreadStatic]
		private static bool hasDifficulty;

		public static int CurrentDifficulty => currentDifficulty;

		public static bool HasDifficulty => hasDifficulty;

		[HarmonyPrefix]
		public static void Prefix(CardBattleNodeData nodeData, ref BuildState __state)
		{
			__state = new BuildState
			{
				PreviousDifficulty = currentDifficulty,
				PreviousHasDifficulty = hasDifficulty
			};
			if (nodeData == null)
			{
				hasDifficulty = false;
				return;
			}
			int num = 0;
			if (RunState.Run != null)
			{
				num = RunState.Run.DifficultyModifier;
			}
			currentDifficulty = nodeData.difficulty + num;
			hasDifficulty = true;
		}

		[HarmonyPostfix]
		public static void Postfix(BuildState __state)
		{
			if (__state != null)
			{
				currentDifficulty = __state.PreviousDifficulty;
				hasDifficulty = __state.PreviousHasDifficulty;
			}
		}
	}
	[HarmonyPatch(typeof(EncounterBuilder), "BuildTerrainCondition")]
	[HarmonyPriority(800)]
	public static class CustomTerrainPoolPatch
	{
		public class TerrainPoolState
		{
			public RegionData Region;

			public List<CardInfo> OriginalCards = new List<CardInfo>();

			public Dictionary<string, string> CustomSides = new Dictionary<string, string>();

			public int Difficulty;

			public int RandomSeed;

			public bool Modified;
		}

		private const string ENABLE_PROPERTY = "OLD_SA_CanAppearAsTerrain";

		private const string DIFFICULTY_PROPERTY = "OLD_SA_TerrainDifficulty";

		private const string SIDE_PROPERTY = "OLD_SA_TerrainSide";

		[HarmonyPrefix]
		public static void Prefix(bool reachTerrainOnPlayerSide, int randomSeed, ref TerrainPoolState __state)
		{
			__state = new TerrainPoolState();
			RegionData currentMapRegion = RunState.CurrentMapRegion;
			if ((Object)(object)currentMapRegion == (Object)null || currentMapRegion.terrainCards == null)
			{
				return;
			}
			__state.Region = currentMapRegion;
			__state.OriginalCards = new List<CardInfo>(currentMapRegion.terrainCards);
			OldSaBoons.SetTerrainPool(currentMapRegion.terrainCards);
			__state.RandomSeed = randomSeed;
			if (CustomTerrainDifficultyContextPatch.HasDifficulty)
			{
				__state.Difficulty = CustomTerrainDifficultyContextPatch.CurrentDifficulty;
			}
			else
			{
				int num = 0;
				if ((Object)(object)Singleton<TurnManager>.Instance != (Object)null && Singleton<TurnManager>.Instance.BattleNodeData != null)
				{
					num = Singleton<TurnManager>.Instance.BattleNodeData.difficulty;
				}
				if (RunState.Run != null)
				{
					num += RunState.Run.DifficultyModifier;
				}
				__state.Difficulty = num;
			}
			List<CardInfo> allData = ScriptableObjectLoader<CardInfo>.AllData;
			if (allData == null)
			{
				return;
			}
			currentMapRegion.terrainCards.RemoveAll((CardInfo val) => !((Object)(object)val == (Object)null) && IsEnabledCustomTerrain(val));
			foreach (CardInfo card in allData)
			{
				if ((Object)(object)card == (Object)null || !IsEnabledCustomTerrain(card) || !IsDifficultyAllowed(card, __state.Difficulty))
				{
					continue;
				}
				string text = CardExtensions.GetExtendedProperty(card, "OLD_SA_TerrainSide");
				if (string.IsNullOrWhiteSpace(text))
				{
					text = "Both";
				}
				text = text.Trim();
				if (IsValidSide(text) && card.traits != null && card.traits.Contains((Trait)12))
				{
					__state.CustomSides[((Object)card).name] = text;
					if (!currentMapRegion.terrainCards.Exists((CardInfo existing) => (Object)(object)existing != (Object)null && ((Object)existing).name == ((Object)card).name))
					{
						currentMapRegion.terrainCards.Add(card);
						__state.Modified = true;
					}
				}
			}
			OldSaBoons.SetTerrainPool(currentMapRegion.terrainCards);
		}

		[HarmonyPostfix]
		public static void Postfix(ref StartCondition __result, bool reachTerrainOnPlayerSide, TerrainPoolState __state)
		{
			if (__state == null || (Object)(object)__state.Region == (Object)null)
			{
				return;
			}
			try
			{
				if (__result != null)
				{
					FilterWrongSideCards(__result.cardsInPlayerSlots, "Player", __state, reachTerrainOnPlayerSide);
					FilterWrongSideCards(__result.cardsInOpponentSlots, "Opponent", __state, reachTerrainOnPlayerSide);
				}
			}
			finally
			{
				__state.Region.terrainCards.Clear();
				__state.Region.terrainCards.AddRange(__state.OriginalCards);
			}
		}

		private static bool IsEnabledCustomTerrain(CardInfo card)
		{
			string extendedProperty = CardExtensions.GetExtendedProperty(card, "OLD_SA_CanAppearAsTerrain");
			return string.Equals(extendedProperty, "true", StringComparison.OrdinalIgnoreCase);
		}

		private static bool IsValidSide(string side)
		{
			return side.Equals("Both", StringComparison.OrdinalIgnoreCase) || side.Equals("Player", StringComparison.OrdinalIgnoreCase) || side.Equals("Opponent", StringComparison.OrdinalIgnoreCase);
		}

		private static bool IsDifficultyAllowed(CardInfo card, int difficulty)
		{
			string extendedProperty = CardExtensions.GetExtendedProperty(card, "OLD_SA_TerrainDifficulty");
			if (string.IsNullOrWhiteSpace(extendedProperty))
			{
				return false;
			}
			string[] array = extendedProperty.Split(new char[1] { ',' });
			if (array.Length != 2)
			{
				return false;
			}
			if (!int.TryParse(array[0].Trim(), out var result))
			{
				return false;
			}
			if (!int.TryParse(array[1].Trim(), out var result2))
			{
				return false;
			}
			if (result > result2)
			{
				return false;
			}
			return difficulty >= result && difficulty <= result2;
		}

		private static void FilterWrongSideCards(CardInfo[] slots, string actualSide, TerrainPoolState state, bool reachTerrainOnPlayerSide)
		{
			if (slots == null)
			{
				return;
			}
			for (int i = 0; i < slots.Length; i++)
			{
				CardInfo val = slots[i];
				if (!((Object)(object)val == (Object)null) && state.CustomSides.TryGetValue(((Object)val).name, out var value) && !value.Equals("Both", StringComparison.OrdinalIgnoreCase) && !value.Equals(actualSide, StringComparison.OrdinalIgnoreCase))
				{
					slots[i] = GetVanillaFallback(actualSide, i, slots.Length, state, reachTerrainOnPlayerSide);
				}
			}
		}

		private static CardInfo GetVanillaFallback(string actualSide, int slotIndex, int slotCount, TerrainPoolState state, bool reachTerrainOnPlayerSide)
		{
			if (actualSide == "Player" && reachTerrainOnPlayerSide)
			{
				CardInfo val = state.OriginalCards.Find((CardInfo card) => (Object)(object)card != (Object)null && !IsEnabledCustomTerrain(card) && card.HasAbility((Ability)23));
				if ((Object)(object)val != (Object)null)
				{
					return CardLoader.GetCardByName(((Object)val).name);
				}
				return CardLoader.GetCardByName("Tree");
			}
			List<CardInfo> list = new List<CardInfo>();
			foreach (CardInfo originalCard in state.OriginalCards)
			{
				if (!((Object)(object)originalCard == (Object)null) && !IsEnabledCustomTerrain(originalCard) && originalCard.traits != null && originalCard.traits.Contains((Trait)12) && ConceptProgressionTree.Tree.CardUnlocked(originalCard, true))
				{
					list.Add(originalCard);
				}
			}
			if (list.Count == 0)
			{
				return null;
			}
			int num = state.RandomSeed + slotIndex + slotCount;
			int index = SeededRandom.Range(0, list.Count, num);
			return CardLoader.GetCardByName(((Object)list[index]).name);
		}
	}
	[HarmonyPatch(typeof(RegionData), "GetBlueprintForNode")]
	public static class EncounterDifficultyPatch
	{
		[HarmonyPostfix]
		public static void Postfix(CardBattleNodeData nodeData, ref EncounterBlueprintData __result, RegionData __instance)
		{
			if ((Object)(object)__result == (Object)null || nodeData == null || (Object)(object)__instance == (Object)null)
			{
				return;
			}
			int difficulty = nodeData.difficulty;
			int difficultyModifier = RunState.Run.DifficultyModifier;
			if (!((Object)__result).name.StartsWith("OLD_SA_BATTLE") || (difficulty >= __result.minDifficulty && difficulty <= __result.maxDifficulty))
			{
				return;
			}
			List<EncounterBlueprintData> list = new List<EncounterBlueprintData>();
			foreach (EncounterBlueprintData encounter in __instance.encounters)
			{
				if (!((Object)(object)encounter == (Object)null))
				{
					if (!((Object)encounter).name.StartsWith("OLD_SA_BATTLE"))
					{
						list.Add(encounter);
					}
					else if (encounter.PrerequisitesMet() && difficulty >= encounter.minDifficulty && difficulty <= encounter.maxDifficulty)
					{
						list.Add(encounter);
					}
				}
			}
			if (list.Count != 0)
			{
				__result = list[SeededRandom.Range(0, list.Count, SaveManager.SaveFile.GetCurrentRandomSeed())];
			}
		}
	}
	[HarmonyPatch(typeof(Opponent), "CanOfferSurrender")]
	public static class MosquitoPreventSurrenderPatch
	{
		[HarmonyPostfix]
		public static void Postfix(Opponent __instance, ref bool __result)
		{
			if (!((Object)(object)__instance == (Object)null) && !((Object)(object)__instance.Blueprint == (Object)null) && ((Object)__instance.Blueprint).name == "OLD_SA_BATTLE_MOSQUITO")
			{
				__result = false;
			}
		}
	}
}
namespace OLD_SA.Battle
{
	public static class BattleAPI
	{
		private const int EASY_MIN = 0;

		private const int EASY_MAX = 3;

		private const int LOW_MIN = 4;

		private const int LOW_MAX = 8;

		private const int MEDIUM_MIN = 9;

		private const int MEDIUM_MAX = 12;

		private const int HIGH_MIN = 13;

		private const int HIGH_MAX = 20;

		public static EncounterBlueprintData WolfPack;

		public static EncounterBlueprintData SwarmCrisis;

		public static EncounterBlueprintData BoneCrisis;

		public static EncounterBlueprintData Attack;

		public static EncounterBlueprintData HoovedPack;

		public static EncounterBlueprintData Magic;

		public static EncounterBlueprintData Cat;

		public static EncounterBlueprintData Snake;

		public static EncounterBlueprintData Bird;

		public static EncounterBlueprintData Mosquito;

		public static EncounterBlueprintData Crab;

		public static EncounterBlueprintData StrangeHoovedPack;

		private static CardBlueprint Card(string cardName, int minDifficulty = 0, int maxDifficulty = 20)
		{
			return EncounterManager.NewCardBlueprint(cardName, 0, false, 0, (string)null, minDifficulty, maxDifficulty);
		}

		public static void Init()
		{
			//IL_039d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a3: Expected I4, but got Unknown
			//IL_054d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0553: Expected I4, but got Unknown
			//IL_0650: Unknown result type (might be due to invalid IL or missing references)
			//IL_0656: Expected I4, but got Unknown
			//IL_099c: Unknown result type (might be due to invalid IL or missing references)
			//IL_09a2: Expected I4, but got Unknown
			try
			{
				WolfPack = EncounterManager.New("OLD_SA_BATTLE_WOLF_PACK", true);
				EncounterExtensions.AddTurns<EncounterBlueprintData>(WolfPack, new List<CardBlueprint>[5]
				{
					EncounterManager.CreateTurn((CardBlueprint[])(object)new CardBlueprint[4]
					{
						Card("OLD_SA_WARG"),
						Card("Rabbit", 0, 3),
						Card("WolfCub", 4, 12),
						Card("Wolf", 13)
					}),
					EncounterManager.CreateTurn((CardBlueprint[])(object)new CardBlueprint[2]
					{
						Card("WolfCub", 0, 8),
						Card("Wolf", 9)
					}),
					EncounterManager.CreateTurn((CardBlueprint[])(object)new CardBlueprint[3]
					{
						Card("Mole", 4, 8),
						Card("WolfCub", 9, 12),
						Card("Wolf", 13)
					}),
					EncounterManager.CreateTurn((CardBlueprint[])(object)new CardBlueprint[2]
					{
						Card("OLD_SA_WARG", 4),
						Card("WolfCub", 13)
					}),
					EncounterManager.CreateTurn(Card("Alpha", 13))
				});
				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((CardBlueprint[])(object)new CardBlueprint[3]
					{
						Card("OLD_SA_WHORLTOOTH_WORM"),
						Card("Bee", 4, 8),
						Card("AntQueen", 9)
					}),
					EncounterManager.CreateTurn((CardBlueprint[])(object)new CardBlueprint[2]
					{
						Card("Bee", 0, 8),
						Card("Ant", 9)
					}),
					EncounterManager.CreateTurn((CardBlueprint[])(object)new CardBlueprint[2]
					{
						Card("Bee", 9, 12),
						Card("OLD_SA_WASP", 13)
					}),
					EncounterManager.CreateTurn(Card("OLD_SA_WHORLTOOTH_WORM", 13)),
					EncounterManager.CreateTurn(Card("Mole", 4))
				});
				EncounterExtensions.AddDominantTribes<EncounterBlueprintData>(SwarmCrisis, (Tribe[])(object)new Tribe[1] { (Tribe)6 });
				BoneCrisis = EncounterManager.New("OLD_SA_BATTLE_BONE_CRISIS", true);
				EncounterExtensions.AddTurns<EncounterBlueprintData>(BoneCrisis, new List<CardBlueprint>[6]
				{
					EncounterManager.CreateTurn((CardBlueprint[])(object)new CardBlueprint[2]
					{
						Card("OLD_SA_GULPER_EEL", 9),
						Card("OLD_SA_ARMORED_CATFISH")
					}),
					EncounterManager.CreateTurn("OLD_SA_BONEGULL"),
					EncounterManager.CreateTurn((CardBlueprint)null),
					EncounterManager.CreateTurn("Mole"),
					EncounterManager.CreateTurn("OLD_SA_BONEGULL"),
					EncounterManager.CreateTurn(Card("DireWolfCub", 13))
				});
				EncounterExtensions.AddDominantTribes<EncounterBlueprintData>(BoneCrisis, (Tribe[])(object)new Tribe[1] { (Tribe)2 });
				Attack = EncounterManager.New("OLD_SA_BATTLE_ATTACK", true);
				EncounterExtensions.AddTurns<EncounterBlueprintData>(Attack, new List<CardBlueprint>[6]
				{
					EncounterManager.CreateTurn(new string[2] { "Mantis", "OLD_SA_MANTIS_SHRIMP" }),
					EncounterManager.CreateTurn((CardBlueprint[])(object)new CardBlueprint[2]
					{
						Card("Mole", 0, 12),
						Card("Porcupine", 13)
					}),
					EncounterManager.CreateTurn("Mantis"),
					EncounterManager.CreateTurn(Card("OLD_SA_STAG_BEETLE", 9)),
					EncounterManager.CreateTurn((CardBlueprint)null),
					EncounterManager.CreateTurn(Card("OLD_SA_MANTIS_SHRIMP", 13))
				});
				EncounterExtensions.AddDominantTribes<EncounterBlueprintData>(Attack, (Tribe[])(object)new Tribe[1] { (Tribe)(int)TribesAPI.Crustacean });
				HoovedPack = EncounterManager.New("OLD_SA_BATTLE_HoovedPack", true);
				EncounterExtensions.AddTurns<EncounterBlueprintData>(HoovedPack, new List<CardBlueprint>[6]
				{
					EncounterManager.CreateTurn((CardBlueprint[])(object)new CardBlueprint[2]
					{
						Card("Mole", 4),
						Card("OLD_SA_ANTELOPE")
					}),
					EncounterManager.CreateTurn((CardBlueprint[])(object)new CardBlueprint[3]
					{
						Card("ElkCub", 0, 8),
						Card("Elk", 9, 12),
						Card("Bull", 13)
					}),
					EncounterManager.CreateTurn((CardBlueprint[])(object)new CardBlueprint[2]
					{
						Card("ElkCub", 4, 8),
						Card("OLD_SA_ANTELOPE", 9)
					}),
					EncounterManager.CreateTurn(Card("Bull", 13)),
					EncounterManager.CreateTurn(Card("Pronghorn", 13)),
					EncounterManager.CreateTurn(Card("Elk", 13))
				});
				EncounterExtensions.AddDominantTribes<EncounterBlueprintData>(HoovedPack, (Tribe[])(object)new Tribe[1] { (Tribe)4 });
				Magic = EncounterManager.New("OLD_SA_BATTLE_MAGIC", true);
				EncounterExtensions.AddTurns<EncounterBlueprintData>(Magic, new List<CardBlueprint>[5]
				{
					EncounterManager.CreateTurn(new string[2] { "OLD_SA_PUPPET_SAD", "OLD_SA_PUPPETEER_FEAR" }),
					EncounterManager.CreateTurn(new string[2] { "Alpha", "OLD_SA_PUPPETEER_HAPPY" }),
					EncounterManager.CreateTurn("OLD_SA_PUPPET_SAD"),
					EncounterManager.CreateTurn("OLD_SA_PUPPETEER_FEAR"),
					EncounterManager.CreateTurn("Mole")
				});
				EncounterExtensions.AddDominantTribes<EncounterBlueprintData>(Magic, (Tribe[])(object)new Tribe[1] { (Tribe)(int)TribesAPI.Magic });
				Cat = EncounterManager.New("OLD_SA_BATTLE_CAT", true);
				EncounterExtensions.AddTurns<EncounterBlueprintData>(Cat, new List<CardBlueprint>[5]
				{
					EncounterManager.CreateTurn((CardBlueprint[])(object)new CardBlueprint[2]
					{
						Card("OLD_SA_LYNX"),
						Card("OLD_SA_BLACK_PANTHER", 9)
					}),
					EncounterManager.CreateTurn("Mole"),
					EncounterManager.CreateTurn((CardBlueprint[])(object)new CardBlueprint[2]
					{
						Card("OLD_SA_LYNX"),
						Card("OLD_SA_BLACK_PANTHER", 9)
					}),
					EncounterManager.CreateTurn((CardBlueprint[])(object)new CardBlueprint[2]
					{
						Card("OLD_SA_BLACK_PANTHER", 4, 12),
						Card("OLD_SA_LION", 13)
					}),
					EncounterManager.CreateTurn((CardBlueprint[])(object)new CardBlueprint[2]
					{
						Card("OLD_SA_LYNX", 4, 12),
						Card("OLD_SA_BLACK_PANTHER", 13)
					})
				});
				EncounterExtensions.AddDominantTribes<EncounterBlueprintData>(Cat, (Tribe[])(object)new Tribe[1] { (Tribe)(int)TribesAPI.Feline });
				Snake = EncounterManager.New("OLD_SA_BATTLE_SNAKE", true);
				EncounterExtensions.AddTurns<EncounterBlueprintData>(Snake, new List<CardBlueprint>[5]
				{
					EncounterManager.CreateTurn((CardBlueprint[])(object)new CardBlueprint[3]
					{
						Card("OLD_SA_DART_FROG"),
						Card("Skink", 4, 8),
						Card("OLD_SA_INK_ADDER", 9)
					}),
					EncounterManager.CreateTurn("Skink"),
					EncounterManager.CreateTurn((CardBlueprint[])(object)new CardBlueprint[2]
					{
						Card("Mole", 4, 8),
						Card("OLD_SA_INK_ADDER", 9)
					}),
					EncounterManager.CreateTurn((CardBlueprint[])(object)new CardBlueprint[2]
					{
						Card("Skink", 9, 12),
						Card("OLD_SA_INK_ADDER", 13)
					}),
					EncounterManager.CreateTurn(Card("OLD_SA_TRICERATOPS", 13))
				});
				EncounterExtensions.AddDominantTribes<EncounterBlueprintData>(Snake, (Tribe[])(object)new Tribe[1] { (Tribe)5 });
				Bird = EncounterManager.New("OLD_SA_BATTLE_BIRD", true);
				EncounterExtensions.AddTurns<EncounterBlueprintData>(Bird, new List<CardBlueprint>[5]
				{
					EncounterManager.CreateTurn((CardBlueprint[])(object)new CardBlueprint[3]
					{
						Card("Raven"),
						Card("Porcupine", 9, 12),
						Card("RavenEgg", 13)
					}),
					EncounterManager.CreateTurn("Sparrow"),
					EncounterManager.CreateTurn((CardBlueprint[])(object)new CardBlueprint[2]
					{
						Card("RavenEgg", 9, 12),
						Card("OLD_SA_HUNTER_DOVE", 13)
					}),
					EncounterManager.CreateTurn(Card("MoleMan", 13)),
					EncounterManager.CreateTurn(Card("Kingfisher", 9, 12))
				});
				EncounterExtensions.AddDominantTribes<EncounterBlueprintData>(Bird, (Tribe[])(object)new Tribe[1] { (Tribe)2 });
				Mosquito = EncounterManager.New("OLD_SA_BATTLE_MOSQUITO", true);
				EncounterExtensions.AddTurns<EncounterBlueprintData>(Mosquito, new List<CardBlueprint>[1] { EncounterManager.CreateTurn((CardBlueprint[])(object)new CardBlueprint[3]
				{
					Card("OLD_SA_MOSQUITO_DUKE_1", 0, 8),
					Card("OLD_SA_MOSQUITO_DUKE", 9, 12),
					Card("OLD_SA_MOSQUITO_DUKE_2", 13)
				}) });
				for (int i = 0; i < 10; i++)
				{
					EncounterExtensions.AddTurns<EncounterBlueprintData>(Mosquito, new List<CardBlueprint>[1] { EncounterManager.CreateTurn((CardBlueprint)null) });
				}
				EncounterExtensions.AddDominantTribes<EncounterBlueprintData>(Mosquito, (Tribe[])(object)new Tribe[1] { (Tribe)6 });
				Crab = EncounterManager.New("OLD_SA_BATTLE_CRAB", true);
				EncounterExtensions.AddTurns<EncounterBlueprintData>(Crab, new List<CardBlueprint>[5]
				{
					EncounterManager.CreateTurn((CardBlueprint[])(object)new CardBlueprint[2]
					{
						Card("OLD_SA_CRAB"),
						Card("OLD_SA_LOBSTER", 4, 8)
					}),
					EncounterManager.CreateTurn(Card("OLD_SA_HERMIT_CRAB", 4, 8)),
					EncounterManager.CreateTurn((CardBlueprint[])(object)new CardBlueprint[2]
					{
						Card("Mole", 4),
						Card("Kingfisher", 9)
					}),
					EncounterManager.CreateTurn(Card("OLD_SA_LOBSTER", 9)),
					EncounterManager.CreateTurn(Card("OLD_SA_CRAB", 13))
				});
				EncounterExtensions.AddDominantTribes<EncounterBlueprintData>(Crab, (Tribe[])(object)new Tribe[1] { (Tribe)(int)TribesAPI.Crustacean });
				StrangeHoovedPack = EncounterManager.New("OLD_SA_BATTLE_STRANGE_HOOVED_PACK", true);
				EncounterExtensions.AddTurns<EncounterBlueprintData>(StrangeHoovedPack, new List<CardBlueprint>[5]
				{
					EncounterManager.CreateTurn((CardBlueprint[])(object)new CardBlueprint[2]
					{
						Card("OLD_SA_DEFORMED_ANTLER_ELK_CUB"),
						Card("Mole", 4)
					}),
					EncounterManager.CreateTurn((CardBlueprint[])(object)new CardBlueprint[2]
					{
						Card("ElkCub", 0, 8),
						Card("Elk", 9, 12)
					}),
					EncounterManager.CreateTurn((CardBlueprint[])(object)new CardBlueprint[3]
					{
						Card("ElkCub", 0, 3),
						Card("OLD_SA_BOAR", 4, 8),
						Card("OLD_SA_DEFORMED_ANTLER_ELK", 9)
					}),
					EncounterManager.CreateTurn(Card("Elk", 9)),
					EncounterManager.CreateTurn(Card("OLD_SA_BOAR", 13))
				});
				EncounterExtensions.AddDominantTribes<EncounterBlueprintData>(StrangeHoovedPack, (Tribe[])(object)new Tribe[1] { (Tribe)4 });
				EncounterExtensions.SetDifficulty<EncounterBlueprintData>(WolfPack, 1, 20);
				EncounterExtensions.SetDifficulty<EncounterBlueprintData>(SwarmCrisis, 1, 20);
				EncounterExtensions.SetDifficulty<EncounterBlueprintData>(BoneCrisis, 6, 20);
				EncounterExtensions.SetDifficulty<EncounterBlueprintData>(Attack, 6, 20);
				EncounterExtensions.SetDifficulty<EncounterBlueprintData>(HoovedPack, 1, 20);
				EncounterExtensions.SetDifficulty<EncounterBlueprintData>(Magic, 9, 20);
				EncounterExtensions.SetDifficulty<EncounterBlueprintData>(Cat, 1, 20);
				EncounterExtensions.SetDifficulty<EncounterBlueprintData>(Snake, 4, 20);
				EncounterExtensions.SetDifficulty<EncounterBlueprintData>(Bird, 1, 20);
				EncounterExtensions.SetDifficulty<EncounterBlueprintData>(Mosquito, 4, 20);
				EncounterExtensions.SetDifficulty<EncounterBlueprintData>(Crab, 1, 20);
				EncounterExtensions.SetDifficulty<EncounterBlueprintData>(StrangeHoovedPack, 1, 20);
				RegionManager.ModifyRegionsList += AddEncountersToRegions;
				RegionManager.SyncRegionList();
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("[OLD_SA] BattleAPI 初始化失败:\n" + 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);
				}
				if (!val.encounters.Contains(Magic))
				{
					val.encounters.Add(Magic);
				}
				if (!val.encounters.Contains(Cat))
				{
					val.encounters.Add(Cat);
				}
				if (!val.encounters.Contains(Mosquito))
				{
					val.encounters.Add(Mosquito);
				}
				if (!val.encounters.Contains(StrangeHoovedPack))
				{
					val.encounters.Add(StrangeHoovedPack);
				}
			}
			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);
				}
				if (!val2.encounters.Contains(BoneCrisis))
				{
					val2.encounters.Add(BoneCrisis);
				}
				if (!val2.encounters.Contains(Attack))
				{
					val2.encounters.Add(Attack);
				}
				if (!val2.encounters.Contains(Mosquito))
				{
					val2.encounters.Add(Mosquito);
				}
				if (!val2.encounters.Contains(Crab))
				{
					val2.encounters.Add(Crab);
				}
			}
			RegionData val3 = regions.Find((RegionData x) => (Object)(object)x != (Object)null && ((Object)x).name == "Alpine");
			if ((Object)(object)val3 != (Object)null)
			{
				if (val3.encounters == null)
				{
					val3.encounters = new List<EncounterBlueprintData>();
				}
				if (!val3.encounters.Contains(HoovedPack))
				{
					val3.encounters.Add(HoovedPack);
				}
				if (!val3.encounters.Contains(Snake))
				{
					val3.encounters.Add(Snake);
				}
				if (!val3.encounters.Contains(Bird))
				{
					val3.encounters.Add(Bird);
				}
				if (!val3.encounters.Contains(Mosquito))
				{
					val3.encounters.Add(Mosquito);
				}
				if (!val3.encounters.Contains(StrangeHoovedPack))
				{
					val3.encounters.Add(StrangeHoovedPack);
				}
			}
			return regions;
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[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 5 days 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 HarmonyLib;
using InscryptionAPI.Ascension;
using InscryptionAPI.Helpers;
using InscryptionAPI.Slots;
using OLD_SA.Dialogue;
using OLD_SA.Random;
using OLD_SA.RedirectStrike;
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("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 OLD_SA.Combat
{
	[HarmonyPatch(typeof(CombatPhaseManager), "DealOverkillDamage")]
	public static class EnemyOverkillHandDamagePatch
	{
		public static bool Prefix(int damage, CardSlot attackingSlot, CardSlot opposingSlot, ref IEnumerator __result)
		{
			//IL_00b8: 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)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			if (damage <= 0)
			{
				return true;
			}
			if ((Object)(object)attackingSlot == (Object)null || (Object)(object)attackingSlot.Card == (Object)null)
			{
				return true;
			}
			if (attackingSlot.IsPlayerSlot)
			{
				return true;
			}
			if ((Object)(object)opposingSlot == (Object)null || !opposingSlot.IsPlayerSlot)
			{
				return true;
			}
			if (attackingSlot.Card.HasAbility(RedirectStrikeAPI.ability.Id))
			{
				return true;
			}
			bool flag = false;
			try
			{
				flag = AscensionSaveData.Data.ChallengeIsActive(ChallengeRegistry.OverkillPunishmentChallengeType);
			}
			catch
			{
				flag = false;
			}
			if (!flag)
			{
				return true;
			}
			ChallengeActivationUI.TryShowActivation(ChallengeRegistry.OverkillPunishmentChallengeType);
			__result = EnemyOverkillHandResolver.Resolve(damage, attackingSlot.Card);
			return false;
		}
	}
	public static class EnemyOverkillHandResolver
	{
		public static IEnumerator Resolve(int damage, PlayableCard attacker)
		{
			PlayerHand hand = Singleton<PlayerHand>.Instance;
			if ((Object)(object)hand == (Object)null || hand.CardsInHand.Count == 0)
			{
				yield break;
			}
			PlayableCard card = hand.CardsInHand[0];
			if (!((Object)(object)card == (Object)null))
			{
				if ((Object)(object)Singleton<ViewManager>.Instance != (Object)null && (Object)(object)Singleton<BoardManager>.Instance != (Object)null)
				{
					Singleton<ViewManager>.Instance.SwitchToView(Singleton<BoardManager>.Instance.DefaultView, false, false);
					yield return (object)new WaitForSeconds(0.3f);
				}
				PlayableCard dialogueCard = card;
				yield return HandDamageResolver.Deal(card, damage, attacker);
				yield return SigilDialogueAPI.ShowFirstTime("EnemyOverkillHandDamage", "Surprised? My overkill damage can reach your hand now. Be careful with your first card.", dialogueCard);
			}
		}
	}
	[HarmonyPatch(typeof(PlayableCard), "Die")]
	public static class HandDeathSlotWrapper
	{
		private static FieldInfo slotField = typeof(PlayableCard).GetField("slot", BindingFlags.Instance | BindingFlags.NonPublic);

		public static void Prefix(PlayableCard __instance, ref CardSlot __state)
		{
			__state = null;
			if ((Object)(object)__instance == (Object)null || slotField == null)
			{
				return;
			}
			PlayerHand instance = Singleton<PlayerHand>.Instance;
			if (!((Object)(object)instance == (Object)null) && instance.CardsInHand.Contains(__instance))
			{
				BoardManager instance2 = Singleton<BoardManager>.Instance;
				if (!((Object)(object)instance2 == (Object)null) && instance2.PlayerSlotsCopy.Count != 0)
				{
					__state = null;
					slotField.SetValue(__instance, instance2.PlayerSlotsCopy[0]);
				}
			}
		}

		public static void Postfix(PlayableCard __instance, CardSlot __state)
		{
			if (!((Object)(object)__instance == (Object)null) && !(slotField == null))
			{
				PlayerHand instance = Singleton<PlayerHand>.Instance;
				if (!((Object)(object)instance == (Object)null) && instance.CardsInHand.Contains(__instance))
				{
					slotField.SetValue(__instance, null);
				}
			}
		}
	}
	public static class HandDamageResolver
	{
		public static IEnumerator Deal(PlayableCard card, int damage, PlayableCard attacker)
		{
			if ((Object)(object)card == (Object)null)
			{
				yield break;
			}
			PlayableCardStatus status = card.Status;
			status.damageTaken += damage;
			if (card.TriggerHandler.RespondsToTrigger((Trigger)8, new object[1] { attacker }))
			{
				yield return card.TriggerHandler.OnTrigger((Trigger)8, new object[1] { attacker });
			}
			if (card.Health > 0)
			{
				if ((Object)(object)((Card)card).Anim != (Object)null)
				{
					((Card)card).Anim.PlayHitAnimation();
				}
				yield break;
			}
			card.Dead = true;
			if ((Object)(object)((Card)card).Anim != (Object)null)
			{
				((Card)card).Anim.PlayDeathAnimation(true);
				yield return (object)new WaitForSeconds(1f);
			}
			BoardManager board = Singleton<BoardManager>.Instance;
			if ((Object)(object)Singleton<ResourcesManager>.Instance != (Object)null && (Object)(object)board != (Object)null && board.PlayerSlotsCopy.Count > 0)
			{
				yield return Singleton<ResourcesManager>.Instance.AddBones(1, board.PlayerSlotsCopy[0]);
			}
			if (card.TriggerHandler.RespondsToTrigger((Trigger)12, new object[2] { false, attacker }))
			{
				yield return card.TriggerHandler.OnTrigger((Trigger)12, new object[2] { false, attacker });
			}
			if ((Object)(object)Singleton<GlobalTriggerHandler>.Instance != (Object)null)
			{
				yield return Singleton<GlobalTriggerHandler>.Instance.TriggerAll((Trigger)11, false, new object[4]
				{
					card,
					board.PlayerSlotsCopy[0],
					true,
					attacker
				});
			}
			PlayerHand hand = Singleton<PlayerHand>.Instance;
			if ((Object)(object)hand != (Object)null)
			{
				hand.CardsInHand.Remove(card);
			}
			Object.Destroy((Object)(object)((Component)card).gameObject);
		}
	}
}
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");
			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)
			{
				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);
					}
				}
			}
			if (numChallengesOfTypeActive <= num)
			{
			}
		}
	}
	[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", "PocketWatch" };

		public static void Apply(Harmony harmony)
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Expected O, but got Unknown
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Expected O, but got Unknown
			MethodInfo methodInfo = AccessTools.Method(typeof(GainConsumablesSequencer), "GenerateItemChoices", (Type[])null, (Type[])null);
			if (methodInfo == null)
			{
				Plugin.Log.LogError((object)"[OldSa Challenge] Could not find GainConsumablesSequencer.GenerateItemChoices.");
			}
			else
			{
				harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(BrokenBagPatch), "GenerateItemChoices_Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			MethodInfo methodInfo2 = AccessTools.Method(typeof(ItemsUtil), "GetRandomUnlockedConsumable", (Type[])null, (Type[])null);
			if (methodInfo2 == null)
			{
				Plugin.Log.LogError((object)"[OldSa Challenge] Could not find ItemsUtil.GetRandomUnlockedConsumable.");
			}
			else
			{
				harmony.Patch((MethodBase)methodInfo2, new HarmonyMethod(typeof(BrokenBagPatch), "GetRandomUnlockedConsumable_Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			PatchBuyPeltsStateMachine(harmony);
			MethodInfo methodInfo3 = AccessTools.Method(typeof(BuyPeltsSequencer), "OnPurchaseKnifePressed", (Type[])null, (Type[])null);
			if (methodInfo3 == null)
			{
				Plugin.Log.LogError((object)"[OldSa Challenge] Could not find BuyPeltsSequencer.OnPurchaseKnifePressed.");
			}
			else
			{
				harmony.Patch((MethodBase)methodInfo3, new HarmonyMethod(typeof(BrokenBagPatch), "OnPurchaseKnifePressed_Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
		}

		private static bool GenerateItemChoices_Prefix(GainConsumablesNodeData nodeData, int randomSeed, ref List<ConsumableItemData> __result)
		{
			//IL_0041: 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_0053: Invalid comparison between Unknown and I4
			if (!IsBrokenBagActive())
			{
				return true;
			}
			List<ConsumableItemData> list = new List<ConsumableItemData>(ItemsUtil.GetUnlockedConsumablesForRegion(RunState.CurrentMapRegion));
			List<ConsumableItemData> list2 = new List<ConsumableItemData>();
			if (StoryEventsData.EventCompleted((StoryEvent)15) && !StoryEventsData.EventCompleted((StoryEvent)30) && ((int)RunState.Run.eyeState == 0 || (int)RunState.Run.eyeState == 3) && !RunState.Run.consumables.Contains("SpecialDagger"))
			{
				list2.Add(ItemsUtil.GetConsumableByName("SpecialDagger"));
			}
			while (list2.Count < 3)
			{
				if (list.Count == 0)
				{
					ConsumableItemData consumableByName = ItemsUtil.GetConsumableByName("SquirrelBottle");
					list2.Add(consumableByName);
					continue;
				}
				int num = ((RunState.Run != null) ? (RunState.Run.consumables.Count * 1000) : 0);
				int num2 = randomSeed + num;
				int powerLevelRoll = SeededRandom.Range(1, 6, num2++);
				List<ConsumableItemData> list3 = list.FindAll((ConsumableItemData x) => (Object)(object)x != (Object)null && x.powerLevel <= powerLevelRoll && !IsForbidden(((Object)x).name));
				if (list3.Count == 0)
				{
					randomSeed++;
					continue;
				}
				int index = SeededRandom.Range(0, list3.Count, num2++);
				ConsumableItemData val = list3[index];
				list.Remove(val);
				if ((Object)(object)val != (Object)null)
				{
					list2.Add(val);
				}
				randomSeed += 2;
			}
			if (RunState.Run.regionTier > 0 && StoryEventsData.EventCompleted((StoryEvent)5) && !StoryEventsData.EventCompleted((StoryEvent)80) && !RunState.Run.consumables.Contains("GooBottle") && RunState.Run.consumables.Count == 2 && !SaveFile.IsAscension)
			{
				list2[1] = ItemsUtil.GetConsumableByName("GooBottle");
			}
			for (int num3 = 0; num3 < list2.Count; num3++)
			{
				ConsumableItemData val2 = list2[num3];
				if (!((Object)(object)val2 == (Object)null) && IsForbidden(((Object)val2).name))
				{
					Plugin.Log.LogError((object)("[OldSa Challenge] Forbidden consumable reached bag result: " + ((Object)val2).name));
					ConsumableItemData replacementConsumable = GetReplacementConsumable(randomSeed + num3);
					if ((Object)(object)replacementConsumable != (Object)null)
					{
						list2[num3] = replacementConsumable;
					}
				}
			}
			__result = list2;
			return false;
		}

		private static bool GetRandomUnlockedConsumable_Prefix(int randomSeed, ref ConsumableItemData __result)
		{
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			if (!IsBrokenBagActive())
			{
				return true;
			}
			List<ConsumableItemData> list = new List<ConsumableItemData>(ItemsUtil.GetUnlockedConsumables());
			list.RemoveAll((ConsumableItemData item) => (Object)(object)item == (Object)null || item.notRandomlyGiven || IsForbidden(((Object)item).name));
			if (list.Count == 0)
			{
				ConsumableItemData consumableByName = ItemsUtil.GetConsumableByName("SquirrelBottle");
				if ((Object)(object)consumableByName != (Object)null)
				{
					ChallengeActivationUI.TryShowActivation(ChallengeRegistry.BrokenBagChallengeType);
					__result = consumableByName;
					return false;
				}
				return true;
			}
			int index = SeededRandom.Range(0, list.Count, randomSeed);
			ConsumableItemData val = list[index];
			ChallengeActivationUI.TryShowActivation(ChallengeRegistry.BrokenBagChallengeType);
			__result = val;
			return false;
		}

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

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

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

		private static void PatchBuyPeltsStateMachine(Harmony harmony)
		{
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			Type type = typeof(BuyPeltsSequencer).GetNestedTypes(BindingFlags.NonPublic).FirstOrDefault((Type type2) => type2.Name.StartsWith("<BuyPelts>d__", StringComparison.Ordinal));
			if (type == null)
			{
				Plugin.Log.LogError((object)"[OldSa Challenge] Could not find BuyPelts state machine.");
				return;
			}
			MethodInfo methodInfo = AccessTools.Method(type, "MoveNext", (Type[])null, (Type[])null);
			if (methodInfo == null)
			{
				Plugin.Log.LogError((object)"[OldSa Challenge] Could not find MoveNext() in BuyPelts state machine.");
			}
			else
			{
				harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(BrokenBagPatch), "BuyPelts_MoveNext_Transpiler", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null);
			}
		}

		private static IEnumerable<CodeInstruction> BuyPelts_MoveNext_Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Expected O, but got Unknown
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Expected O, but got Unknown
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			MethodInfo methodInfo = AccessTools.Method(typeof(GameObject), "SetActive", (Type[])null, (Type[])null);
			MethodInfo target = AccessTools.Method(typeof(GenericMainInputInteractable), "SetEnabled", (Type[])null, (Type[])null);
			MethodInfo methodInfo2 = AccessTools.Method(typeof(BrokenBagPatch), "ShouldShowKnife", (Type[])null, (Type[])null);
			MethodInfo methodInfo3 = AccessTools.Method(typeof(BrokenBagPatch), "ShouldEnableKnife", (Type[])null, (Type[])null);
			MethodInfo methodInfo4 = AccessTools.Method(typeof(BrokenBagPatch), "ShowHunterActivation", (Type[])null, (Type[])null);
			if (methodInfo == null)
			{
				Plugin.Log.LogError((object)"[OldSa Challenge] Could not find GameObject.SetActive.");
			}
			if (methodInfo2 == null)
			{
				Plugin.Log.LogError((object)"[OldSa Challenge] Could not find ShouldShowKnife.");
			}
			if (methodInfo3 == null)
			{
				Plugin.Log.LogError((object)"[OldSa Challenge] Could not find ShouldEnableKnife.");
			}
			if (methodInfo4 == null)
			{
				Plugin.Log.LogError((object)"[OldSa Challenge] Could not find ShowHunterActivation.");
			}
			bool flag = false;
			bool flag2 = false;
			bool flag3 = false;
			for (int i = 0; i < list.Count - 1; i++)
			{
				if (IsLdcI4One(list[i].opcode) && CallsMethod(list[i + 1], methodInfo))
				{
					list.Insert(i, new CodeInstruction(OpCodes.Call, (object)methodInfo4));
					i++;
					list[i] = new CodeInstruction(OpCodes.Call, (object)methodInfo2);
					flag = true;
					flag3 = true;
					break;
				}
			}
			for (int j = 0; j < list.Count - 1; j++)
			{
				if (IsLdcI4One(list[j].opcode) && CallsMethod(list[j + 1], target))
				{
					list[j] = new CodeInstruction(OpCodes.Call, (object)methodInfo3);
					flag2 = true;
					break;
				}
			}
			if (!flag)
			{
				Plugin.Log.LogWarning((object)"[OldSa Challenge] Could not patch hunter knife GameObject.SetActive.");
			}
			if (!flag2)
			{
				Plugin.Log.LogWarning((object)"[OldSa Challenge] Could not patch hunter knife SetEnabled.");
			}
			if (!flag3)
			{
				Plugin.Log.LogWarning((object)"[OldSa Challenge] Could not patch hunter activation display.");
			}
			return list;
		}

		private static void ShowHunterActivation()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			if (IsBrokenBagActive())
			{
				ChallengeActivationUI.TryShowActivation(ChallengeRegistry.BrokenBagChallengeType);
			}
		}

		private static bool IsLdcI4One(OpCode opcode)
		{
			return opcode == OpCodes.Ldc_I4_1;
		}

		private static bool CallsMethod(CodeInstruction instruction, MethodInfo target)
		{
			if (instruction == null || target == null)
			{
				return false;
			}
			if (instruction.opcode != OpCodes.Call && instruction.opcode != OpCodes.Callvirt)
			{
				return false;
			}
			if (!(instruction.operand is MethodInfo methodInfo))
			{
				return false;
			}
			return methodInfo == target;
		}

		private static bool ShouldShowKnife()
		{
			if (IsBrokenBagActive())
			{
				return false;
			}
			return true;
		}

		private static bool ShouldEnableKnife()
		{
			if (IsBrokenBagActive())
			{
				return false;
			}
			return true;
		}

		private static bool OnPurchaseKnifePressed_Prefix()
		{
			if (!IsBrokenBagActive())
			{
				return true;
			}
			return false;
		}
	}
	public static class BrokenStartPatch
	{
		[HarmonyPatch(typeof(AscensionSaveData), "NewRun", new Type[] { typeof(List<CardInfo>) })]
		private static class NewRunPatch
		{
			[HarmonyPrefix]
			[HarmonyPriority(0)]
			private static void Prefix(List<CardInfo> starterDeck)
			{
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				ClearState();
				if (!SaveFile.IsAscension || starterDeck == null)
				{
					return;
				}
				AscensionSaveData data = AscensionSaveData.Data;
				if (data == null)
				{
					return;
				}
				int numChallengesOfTypeActive = data.GetNumChallengesOfTypeActive(ChallengeRegistry.BrokenStartChallengeType);
				if (numChallengesOfTypeActive > 0)
				{
					remainingStarterLookups = starterDeck.Count;
					int num = (remainingReplacements = Mathf.Min(numChallengesOfTypeActive, 2));
					List<int> list = new List<int> { 0, 1 };
					for (int i = 0; i < num; i++)
					{
						int index = Random.Range(0, list.Count);
						replacementIndices.Add(list[index]);
						list.RemoveAt(index);
					}
				}
			}

			[HarmonyPostfix]
			private static void Postfix()
			{
				ClearState();
			}
		}

		[HarmonyPatch(typeof(CardLoader), "GetCardByName", new Type[] { typeof(string) })]
		private static class GetCardByNamePatch
		{
			[HarmonyPrefix]
			private static void Prefix(ref string name)
			{
				if (remainingStarterLookups <= 0 && remainingReplacements <= 0)
				{
					return;
				}
				if (remainingStarterLookups > 0)
				{
					remainingStarterLookups--;
				}
				else if (BrokenStartPatch.extraCardIndex < 2)
				{
					int extraCardIndex = BrokenStartPatch.extraCardIndex;
					BrokenStartPatch.extraCardIndex++;
					if (replacementIndices.Contains(extraCardIndex))
					{
						name = "OLD_SA_BROKEN_PELT";
						remainingReplacements--;
					}
				}
			}
		}

		private const string BrokenPeltName = "OLD_SA_BROKEN_PELT";

		private static int remainingStarterLookups = 0;

		private static int remainingReplacements = 0;

		private static int extraCardIndex = 0;

		private static HashSet<int> replacementIndices = new HashSet<int>();

		private static void ClearState()
		{
			remainingStarterLookups = 0;
			remainingReplacements = 0;
			extraCardIndex = 0;
			replacementIndices.Clear();
		}
	}
	[HarmonyPatch]
	public static class CampfireChallengesPatch
	{
		private static readonly BindingFlags InstanceFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;

		private static bool IsFireOfFamineActive()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			return AscensionSaveData.Data != null && AscensionSaveData.Data.ChallengeIsActive(ChallengeRegistry.FireOfFamineChallengeType);
		}

		private static bool IsNoSurvivorsActive()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			return AscensionSaveData.Data != null && AscensionSaveData.Data.ChallengeIsActive(ChallengeRegistry.NoSurvivorsChallengeType);
		}

		public static void Apply(Harmony harmony)
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			Type type = typeof(CardStatBoostSequencer).GetNestedTypes(BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault((Type t) => t.Name.Contains("<StatBoostSequence>") && t.GetMethod("MoveNext", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) != null);
			if (type != null)
			{
				MethodInfo method = type.GetMethod("MoveNext", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				harmony.Patch((MethodBase)method, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(CampfireChallengesPatch), "StatBoostSequence_Transpiler", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null);
			}
			PatchCampfireNodeEntry(harmony);
		}

		private static void PatchCampfireNodeEntry(Harmony harmony)
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			MethodInfo methodInfo = AccessTools.Method(typeof(SpecialNodeHandler), "StartSpecialNodeSequence", new Type[1] { typeof(SpecialNodeData) }, (Type[])null);
			if (!(methodInfo == null))
			{
				harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(CampfireChallengesPatch), "SpecialNodeEntry_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
		}

		public static void SpecialNodeEntry_Postfix(SpecialNodeData nodeData)
		{
			//IL_001d: 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 (nodeData is CardStatBoostNodeData)
			{
				if (IsFireOfFamineActive())
				{
					ChallengeActivationUI.TryShowActivation(ChallengeRegistry.FireOfFamineChallengeType);
				}
				if (IsNoSurvivorsActive())
				{
					ChallengeActivationUI.TryShowActivation(ChallengeRegistry.NoSurvivorsChallengeType);
				}
			}
		}

		public static void CampfireNodeEntry_Postfix()
		{
			//IL_000b: 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)
			if (IsFireOfFamineActive())
			{
				ChallengeActivationUI.TryShowActivation(ChallengeRegistry.FireOfFamineChallengeType);
			}
			if (IsNoSurvivorsActive())
			{
				ChallengeActivationUI.TryShowActivation(ChallengeRegistry.NoSurvivorsChallengeType);
			}
		}

		private static bool EnableCampfireRisk(bool original)
		{
			return original || IsFireOfFamineActive();
		}

		private static bool CampfireSurvivorsDead(bool original)
		{
			return original || IsNoSurvivorsActive();
		}

		private static IEnumerator PlaySurvivorsDeadDialogue(TextDisplayer displayer, string eventId, MessageAdvanceMode advanceMode, EventIntersectMode intersectMode, string[] vars, Action<Line> lineCallback)
		{
			//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)
			//IL_001c: 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)
			if (IsNoSurvivorsActive())
			{
				yield return ChallengeDialogueAPI.ShowNoSurvivorsCampfire();
			}
			else
			{
				yield return displayer.PlayDialogueEvent(eventId, advanceMode, intersectMode, vars, lineCallback);
			}
		}

		private static bool CheckInitialCampfireRisk(object stateMachine)
		{
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Expected O, but got Unknown
			if (RunState.Run != null && RunState.Run.survivorsDead)
			{
				return false;
			}
			if (!IsFireOfFamineActive())
			{
				return false;
			}
			Type type = stateMachine.GetType();
			FieldInfo field = type.GetField("<>4__this", InstanceFlags);
			FieldInfo field2 = type.GetField("<destroyedCard>5__2", InstanceFlags);
			FieldInfo field3 = type.GetField("<>2__current", InstanceFlags);
			FieldInfo field4 = type.GetField("<>1__state", InstanceFlags);
			if (field == null || field2 == null || field3 == null || field4 == null)
			{
				return false;
			}
			object? value = field.GetValue(stateMachine);
			CardStatBoostSequencer val = (CardStatBoostSequencer)((value is CardStatBoostSequencer) ? value : null);
			if ((Object)(object)val == (Object)null)
			{
				return false;
			}
			FieldInfo fieldInfo = AccessTools.Field(typeof(CardStatBoostSequencer), "selectionSlot");
			if (fieldInfo == null)
			{
				return false;
			}
			object? value2 = fieldInfo.GetValue(val);
			SelectCardFromDeckSlot val2 = (SelectCardFromDeckSlot)((value2 is SelectCardFromDeckSlot) ? value2 : null);
			if ((Object)(object)val2 == (Object)null || (Object)(object)val2.Card == (Object)null || (Object)(object)((Card)val2.Card).Info == (Object)null)
			{
				return false;
			}
			SaveFile saveFile = SaveManager.SaveFile;
			if (saveFile == null)
			{
				return false;
			}
			float num = (SaveFile.IsAscension ? 0.5f : 0.775f);
			float num2 = SeededRandom.Value(saveFile.GetCurrentRandomSeed());
			FieldInfo fieldInfo2 = AccessTools.Field(typeof(SaveFile), "randomSeed");
			if (fieldInfo2 != null)
			{
				int num3 = (int)fieldInfo2.GetValue(saveFile);
				fieldInfo2.SetValue(saveFile, num3 + 1);
			}
			else
			{
				Debug.LogError((object)"[CampfireChallengesPatch] 找不到 SaveFile.randomSeed,无法推进随机种子。");
			}
			if (num2 <= num)
			{
				return false;
			}
			CardInfo info = ((Card)val2.Card).Info;
			field2.SetValue(stateMachine, info);
			val2.Disable();
			((Card)val2.Card).Anim.PlayDeathAnimation(true);
			((CardCollectionInfo)RunState.Run.playerDeck).RemoveCard(info);
			SaveManager.SaveToFile(true);
			field3.SetValue(stateMachine, (object?)new WaitForSeconds(1f));
			field4.SetValue(stateMachine, 15);
			return true;
		}

		public static IEnumerable<CodeInstruction> StatBoostSequence_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
		{
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Expected O, but got Unknown
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Expected O, but got Unknown
			//IL_036d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0377: Expected O, but got Unknown
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_038a: Expected O, but got Unknown
			//IL_0398: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Expected O, but got Unknown
			//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b4: Expected O, but got Unknown
			//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c6: Expected O, but got Unknown
			List<CodeInstruction> list = instructions.Select((Func<CodeInstruction, CodeInstruction>)((CodeInstruction c) => new CodeInstruction(c))).ToList();
			MethodInfo methodInfo = AccessTools.PropertyGetter(typeof(SaveFile), "IsAscension");
			MethodInfo methodInfo2 = AccessTools.Method(typeof(CampfireChallengesPatch), "EnableCampfireRisk", (Type[])null, (Type[])null);
			MethodInfo methodInfo3 = AccessTools.Method(typeof(CampfireChallengesPatch), "CampfireSurvivorsDead", (Type[])null, (Type[])null);
			MethodInfo methodInfo4 = AccessTools.Method(typeof(CampfireChallengesPatch), "CheckInitialCampfireRisk", (Type[])null, (Type[])null);
			MethodInfo methodInfo5 = AccessTools.Method(typeof(CampfireChallengesPatch), "PlaySurvivorsDeadDialogue", (Type[])null, (Type[])null);
			MethodInfo methodInfo6 = AccessTools.Method(typeof(TextDisplayer), "PlayDialogueEvent", new Type[5]
			{
				typeof(string),
				typeof(MessageAdvanceMode),
				typeof(EventIntersectMode),
				typeof(string[]),
				typeof(Action<Line>)
			}, (Type[])null);
			if (methodInfo != null && methodInfo2 != null)
			{
				for (int num = 0; num < list.Count; num++)
				{
					if (CodeInstructionExtensions.Calls(list[num], methodInfo))
					{
						list.Insert(num + 1, new CodeInstruction(OpCodes.Call, (object)methodInfo2));
						break;
					}
				}
			}
			FieldInfo fieldInfo = AccessTools.Field(typeof(RunState), "survivorsDead");
			if (fieldInfo != null && methodInfo3 != null)
			{
				for (int num2 = 0; num2 < list.Count; num2++)
				{
					if (!(list[num2].opcode != OpCodes.Ldfld) && list[num2].operand is FieldInfo fieldInfo2 && !(fieldInfo2 != fieldInfo))
					{
						list.Insert(num2 + 1, new CodeInstruction(OpCodes.Call, (object)methodInfo3));
						num2++;
					}
				}
			}
			if (methodInfo6 != null && methodInfo5 != null)
			{
				for (int num3 = 0; num3 < list.Count; num3++)
				{
					if (CodeInstructionExtensions.Calls(list[num3], methodInfo6) && IsDialogueEventCall(list, num3, "StatBoostSurvivorsDead"))
					{
						list[num3].operand = methodInfo5;
					}
				}
			}
			if (methodInfo4 != null)
			{
				for (int num4 = 0; num4 < list.Count; num4++)
				{
					if (!(list[num4].opcode != OpCodes.Stfld) && list[num4].operand is FieldInfo fieldInfo3 && !(fieldInfo3.Name != "<numBuffsGiven>5__4"))
					{
						int num5 = num4 + 1;
						if (num5 < list.Count)
						{
							Label label = generator.DefineLabel();
							list[num5].labels.Add(label);
							List<CodeInstruction> collection = new List<CodeInstruction>
							{
								new CodeInstruction(OpCodes.Ldarg_0, (object)null),
								new CodeInstruction(OpCodes.Call, (object)methodInfo4),
								new CodeInstruction(OpCodes.Brfalse, (object)label),
								new CodeInstruction(OpCodes.Ldc_I4_1, (object)null),
								new CodeInstruction(OpCodes.Ret, (object)null)
							};
							list.InsertRange(num5, collection);
						}
						break;
					}
				}
			}
			return list;
		}

		private static bool IsDialogueEventCall(List<CodeInstruction> codes, int callIndex, string eventId)
		{
			int num = Math.Max(0, callIndex - 8);
			for (int i = num; i < callIndex; i++)
			{
				if (codes[i].opcode == OpCodes.Ldstr && codes[i].operand is string text && text == eventId)
				{
					return true;
				}
			}
			return false;
		}
	}
	public static class ChallengeIncompatibilities
	{
		public static void RegisterAll()
		{
			RegisterMutual(ChallengeRegistry.ElephantModeChallenge, (AscensionChallenge)13);
			RegisterMutual(ChallengeRegistry.BadThingsChallenge, ChallengeRegistry.DizzyStartersChallenge);
			RegisterMutual(ChallengeRegistry.BadThingsChallenge, (AscensionChallenge)9);
			RegisterMutual(ChallengeRegistry.FireOfFamineChallenge, ChallengeRegistry.NoSurvivorsChallenge);
		}

		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 IEnumerator ShowNoSurvivorsCampfire()
		{
			TextDisplayer textDisplayer = Singleton<TextDisplayer>.Instance;
			if (!((Object)(object)textDisplayer == (Object)null))
			{
				yield return textDisplayer.ShowUntilInput("Strange... there doesn't seem to be anyone here.", -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 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 WaterForestChallenge;

		public const string WaterForestName = "Water Forest";

		public const string WaterForestDescription = "Turn one of your spaces into a Submerge Slot.";

		public static AscensionChallengeInfo HallucinationSlotChallenge;

		public const string HallucinationSlotName = "Hallucination Forest";

		public const string HallucinationSlotDescription = "Turn one of your spaces into a Hallucination Slot.";

		public static AscensionChallengeInfo StartledSlotChallenge;

		public const string StartledSlotName = "Startled Forest";

		public const string StartledSlotDescription = "Turn one of your spaces into a Startled Slot.";

		public static AscensionChallengeInfo OverkillPunishmentChallenge;

		public const string OverkillPunishmentName = "Overkill Punishment";

		public const string OverkillPunishmentDescription = "Leshy's overkill damage also affects your hand.";

		public static AscensionChallengeInfo FireOfFamineChallenge;

		public const string FireOfFamineName = "Fire of Famine";

		public const string FireOfFamineDescription = "Campfire nodes may now devour cards even on the first visit to the fire.";

		public static AscensionChallengeInfo NoSurvivorsChallenge;

		public const string NoSurvivorsName = "No Survivors";

		public const string NoSurvivorsDescription = "Campfire nodes now have no survivors.";

		public static AscensionChallengeInfo MoneyShortageChallenge;

		public const string MoneyShortageName = "Money Shortage";

		public const string MoneyShortageDescription = "You cannot obtain Gold Teeth through normal means.";

		public static AscensionChallengeInfo BoonBoxChallenge;

		public const string BoonBoxName = "Boon Box";

		public const string BoonBoxDescription = "An additional reward box appears after boss battles.";

		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 WaterForestChallengeType => (AscensionChallenge)(((Object)(object)WaterForestChallenge != (Object)null) ? ((int)WaterForestChallenge.challengeType) : 0);

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

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

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

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

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

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

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

		public static void Register()
		{
			NoGrowthChallenge = FullChallenge.op_Implicit(ChallengeManager.Add("OLD_SA.Challenge", "No Growth", "Fledgling sigils no longer evolve. They only grant +1 Power and +1 Health.", 10, TextureHelper.GetImageAsTexture("NoGrowth.png", (FilterMode)0), TextureHelper.GetImageAsTexture("NoGrowth_Activated.png", (FilterMode)0), 0, false));
			NoWoodcarverChallenge = FullChallenge.op_Implicit(ChallengeManager.Add("OLD_SA.Challenge", "No Woodcarver", "You will no longer encounter Woodcarver choice nodes.", 10, TextureHelper.GetImageAsTexture("NoWoodcarver.png", (FilterMode)0), TextureHelper.GetImageAsTexture("NoWoodcarver_Activated.png", (FilterMode)0), 0, false));
			DizzyStartersChallenge = FullChallenge.op_Implicit(ChallengeManager.Add("OLD_SA.Challenge", "Dizzy Starters", "All creatures in your starting deck gain the Random sigil.", 5, TextureHelper.GetImageAsTexture("DizzyStarters.png", (FilterMode)0), TextureHelper.GetImageAsTexture("DizzyStarters_Activated.png", (FilterMode)0), 0, false));
			DoubleTrialChallenge = FullChallenge.op_Implicit(ChallengeManager.Add("OLD_SA.Challenge", "Double Trial", "All Totem battles in this run have bases with the Double Strike sigil.", 50, TextureHelper.GetImageAsTexture("DoubleTrial.png", (FilterMode)0), TextureHelper.GetImageAsTexture("DoubleTrial_Activated.png", (FilterMode)0), 0, false));
			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));
			BadThingsChallenge = FullChallenge.op_Implicit(ChallengeManager.AddSpecific("OLD_SA.Challenge", "Bad Things", "One of your starting creatures is replaced with a Broken Pelt.", 10, 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));
			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));
			BrokenBagChallenge = FullChallenge.op_Implicit(ChallengeManager.AddSpecific("OLD_SA.Challenge", "Broken Bag", "You will not encounter the Hourglass, Skinning Knife, Scissors, or CuckooClock.", 35, 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));
			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));
			WaterForestChallenge = FullChallenge.op_Implicit(ChallengeManager.AddSpecific("OLD_SA.Challenge", "Water Forest", "Turn one of your spaces into a Submerge Slot.", 15, TextureHelper.GetImageAsTexture("WaterForest.png", (FilterMode)0), TextureHelper.GetImageAsTexture("WaterForest_Activated.png", (FilterMode)0), (Type)null, 0, (List<object>)null, (Func<FullChallenge[], IEnumerable<AscensionChallenge>>)null, (Func<FullChallenge[], IEnumerable<AscensionChallenge>>)null, 1));
			HallucinationSlotChallenge = FullChallenge.op_Implicit(ChallengeManager.AddSpecific("OLD_SA.Challenge", "Hallucination Forest", "Turn one of your spaces into a Hallucination Slot.", 15, TextureHelper.GetImageAsTexture("HallucinationSlot.png", (FilterMode)0), TextureHelper.GetImageAsTexture("HallucinationSlot_Activated.png", (FilterMode)0), (Type)null, 0, (List<object>)null, (Func<FullChallenge[], IEnumerable<AscensionChallenge>>)null, (Func<FullChallenge[], IEnumerable<AscensionChallenge>>)null, 1));
			StartledSlotChallenge = FullChallenge.op_Implicit(ChallengeManager.AddSpecific("OLD_SA.Challenge", "Startled Forest", "Turn one of your spaces into a Startled Slot.", 15, TextureHelper.GetImageAsTexture("StartledSlot.png", (FilterMode)0), TextureHelper.GetImageAsTexture("StartledSlot_Activated.png", (FilterMode)0), (Type)null, 0, (List<object>)null, (Func<FullChallenge[], IEnumerable<AscensionChallenge>>)null, (Func<FullChallenge[], IEnumerable<AscensionChallenge>>)null, 1));
			OverkillPunishmentChallenge = FullChallenge.op_Implicit(ChallengeManager.AddSpecific("OLD_SA.Challenge", "Overkill Punishment", "Leshy's overkill damage also affects your hand.", 35, TextureHelper.GetImageAsTexture("OverkillPunishment.png", (FilterMode)0), TextureHelper.GetImageAsTexture("OverkillPunishment_Activated.png", (FilterMode)0), (Type)null, 0, (List<object>)null, (Func<FullChallenge[], IEnumerable<AscensionChallenge>>)null, (Func<FullChallenge[], IEnumerable<AscensionChallenge>>)null, 1));
			FireOfFamineChallenge = FullChallenge.op_Implicit(ChallengeManager.AddSpecific("OLD_SA.Challenge", "Fire of Famine", "Campfire nodes may now devour cards even on the first visit to the fire.", 20, TextureHelper.GetImageAsTexture("FireOfFamine.png", (FilterMode)0), TextureHelper.GetImageAsTexture("FireOfFamine_Activated.png", (FilterMode)0), (Type)null, 0, (List<object>)null, (Func<FullChallenge[], IEnumerable<AscensionChallenge>>)null, (Func<FullChallenge[], IEnumerable<AscensionChallenge>>)null, 1));
			NoSurvivorsChallenge = FullChallenge.op_Implicit(ChallengeManager.AddSpecific("OLD_SA.Challenge", "No Survivors", "Campfire nodes now have no survivors.", -30, TextureHelper.GetImageAsTexture("NoSurvivors.png", (FilterMode)0), TextureHelper.GetImageAsTexture("NoSurvivors_Activated.png", (FilterMode)0), (Type)null, 0, (List<object>)null, (Func<FullChallenge[], IEnumerable<AscensionChallenge>>)null, (Func<FullChallenge[], IEnumerable<AscensionChallenge>>)null, 1));
			MoneyShortageChallenge = FullChallenge.op_Implicit(ChallengeManager.AddSpecific("OLD_SA.Challenge", "Money Shortage", "You cannot obtain Gold Teeth through normal means.", 5, TextureHelper.GetImageAsTexture("MoneyShortage.png", (FilterMode)0), TextureHelper.GetImageAsTexture("MoneyShortage_Activated.png", (FilterMode)0), (Type)null, 0, (List<object>)null, (Func<FullChallenge[], IEnumerable<AscensionChallenge>>)null, (Func<FullChallenge[], IEnumerable<AscensionChallenge>>)null, 1));
			BoonBoxChallenge = FullChallenge.op_Implicit(ChallengeManager.AddSpecific("OLD_SA.Challenge", "Boon Box", "An additional reward box appears after boss battles.", -30, TextureHelper.GetImageAsTexture("BoonBox.png", (FilterMode)0), TextureHelper.GetImageAsTexture("BoonBox_Activated.png", (FilterMode)0), (Type)null, 0, (List<object>)null, (Func<FullChallenge[], IEnumerable<AscensionChallenge>>)null, (Func<FullChallenge[], IEnumerable<AscensionChallenge>>)null, 1));
			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)
			{
				ChallengeActivationUI.TryShowActivation(ChallengeRegistry.BadThingsChallengeType);
				yield return ChallengeDialogueManager.ShowFirstTime("Bad Things", "Your creature has left you.I kept this for you.");
			}
			if (brokenStart)
			{
				ChallengeActivationUI.TryShowActivation(ChallengeRegistry.BrokenStartChallengeType);
				yield return ChallengeDialogueManager.ShowFirstTime("Broken Start", "Sorry,I don't have anything better.Good luck.");
			}
			if (dizzyStarters)
			{
				ChallengeActivationUI.TryShowActivation(ChallengeRegistry.DizzyStartersChallengeType);
				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);
				}
			}
		}
	}
	[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;
				}
			}
		}
	}
	[HarmonyPatch(typeof(Part1Opponent), "AssembleTotem")]
	public static class DoubleTrialTotemPatch
	{
		[HarmonyPrefix]
		public static void Prefix(Part1Opponent __instance, TotemItemData totemData)
		{
			//IL_002d: 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)
			if (!((Object)(object)__instance == (Object)null) && !((Object)(object)ChallengeRegistry.DoubleTrialChallenge == (Object)null) && AscensionSaveData.Data != null && AscensionSaveData.Data.ChallengeIsActive(ChallengeRegistry.DoubleTrialChallenge.challengeType))
			{
				ChallengeActivationUI.TryShowActivation(ChallengeRegistry.DoubleTrialChallengeType);
			}
		}
	}
	[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;
			}
			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 && AscensionSaveData.Data.ChallengeIsActive(ChallengeRegistry.ElephantModeChallengeType))
			{
				__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;
			}
			return method;
		}

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

		private static IEnumerator ElephantGlitchSequence()
		{
			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;
			}
			((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);
		}

		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);
			}
		}
	}
	[HarmonyPatch(typeof(PlayableCard), "GetOpposingSlots")]
	public static class HallucinationPatch
	{
		private static int randomCounter;

		[HarmonyPostfix]
		public static void Postfix(PlayableCard __instance, ref List<CardSlot> __result)
		{
			if ((Object)(object)__instance == (Object)null || (Object)(object)__instance.Slot == (Object)null || __result == null || !HasHallucinationSlot(__instance.Slot))
			{
				return;
			}
			BoardManager instance = Singleton<BoardManager>.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			List<CardSlot> list = (__instance.OpponentCard ? instance.PlayerSlotsCopy : 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 seed = GetSeed(__instance, i);
					float num = SeededRandom.Value(seed);
					int num2 = Mathf.FloorToInt(num * (float)list.Count);
					num2 = Mathf.Clamp(num2, 0, list.Count - 1);
					list2.Add(list[num2]);
				}
				__result = list2;
			}
		}

		private static bool HasHallucinationSlot(CardSlot slot)
		{
			if ((Object)(object)slot == (Object)null)
			{
				return false;
			}
			return (Object)(object)((Component)slot).GetComponent<HallucinationSlot>() != (Object)null;
		}

		private static int GetSeed(PlayableCard card, int index)
		{
			int nextRandomSeed = GetNextRandomSeed();
			int num = (((Object)(object)card != (Object)null && (Object)(object)card.Slot != (Object)null) ? card.Slot.Index : 0);
			int num2 = randomCounter++;
			nextRandomSeed = nextRandomSeed * 31 + num;
			nextRandomSeed = nextRandomSeed * 31 + index;
			return nextRandomSeed * 31 + num2;
		}

		private static int GetNextRandomSeed()
		{
			SaveFile saveFile = SaveManager.SaveFile;
			if (saveFile == null)
			{
				return 0;
			}
			int currentRandomSeed = saveFile.GetCurrentRandomSeed();
			FieldInfo fieldInfo = AccessTools.Field(typeof(SaveFile), "randomSeed");
			if (fieldInfo != null)
			{
				int num = (int)fieldInfo.GetValue(saveFile);
				fieldInfo.SetValue(saveFile, num + 1);
			}
			return currentRandomSeed;
		}
	}
	public class HallucinationSlot : SlotModificationBehaviour
	{
		public static ModificationType SlotType;

		private static bool initialized;

		public static void Add_HallucinationSlot()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			if (!initialized)
			{
				initialized = true;
				SlotType = SlotModificationExtensions.SetRulebook(SlotModificationManager.New("OLD_SA.Challenge", "HallucinationSlot", typeof(HallucinationSlot), TextureHelper.GetImageAsTexture("hallucination_slot.png", (FilterMode)0)), "Hallucination Slot", "Creatures on this space attack random targets.", TextureHelper.GetImageAsTexture("hallucination_rulebook.png", (FilterMode)0), (ModificationMetaCategory[])(object)new ModificationMetaCategory[1]);
			}
		}
	}
	public static class MoneyShortagePatch
	{
		private static bool transpilerInstalled;

		private static bool suppressNextVisualization;

		public static void Apply(Harmony harmony)
		{
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Expected O, but got Unknown
			if (harmony == null)
			{
				Debug.LogError((object)"[MoneyShortagePatch] Harmony 实例为空");
				return;
			}
			try
			{
				Type type = AccessTools.TypeByName("InscryptionAPI.Triggers.DoCombatPhasePatches");
				if (type == null)
				{
					Debug.LogError((object)"[MoneyShortagePatch] 找不到 DoCombatPhasePatches");
					return;
				}
				Type type2 = null;
				Type[] nestedTypes = type.GetNestedTypes(BindingFlags.Public | BindingFlags.NonPublic);
				foreach (Type type3 in nestedTypes)
				{
					if (type3.Name.Contains("<NegativeDamageSupport>"))
					{
						type2 = type3;
						break;
					}
				}
				if (type2 == null)
				{
					Debug.LogError((object)"[MoneyShortagePatch] 找不到 NegativeDamageSupport 状态机");
					return;
				}
				MethodInfo methodInfo = AccessTools.Method(type2, "MoveNext", (Type[])null, (Type[])null);
				MethodInfo methodInfo2 = AccessTools.Method(typeof(MoneyShortagePatch), "CurrencyTranspiler", (Type[])null, (Type[])null);
				if (methodInfo == null || methodInfo2 == null)
				{
					Debug.LogError((object)"[MoneyShortagePatch] 找不到目标方法");
					return;
				}
				Patches patchInfo = Harmony.GetPatchInfo((MethodBase)methodInfo);
				if (patchInfo != null)
				{
					foreach (Patch transpiler in patchInfo.Transpilers)
					{
						if (transpiler.owner == harmony.Id && transpiler.PatchMethod == methodInfo2)
						{
							transpilerInstalled = true;
							return;
						}
					}
				}
				harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null);
				patchInfo = Harmony.GetPatchInfo((MethodBase)methodInfo);
				if (patchInfo == null)
				{
					return;
				}
				foreach (Patch transpiler2 in patchInfo.Transpilers)
				{
					if (transpiler2.owner == harmony.Id && transpiler2.PatchMethod == methodInfo2)
					{
						transpilerInstalled = true;
						break;
					}
				}
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("[MoneyShortagePatch] 安装失败:\n" + ex));
			}
		}

		private static bool IsMoneyShortageActive()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			return AscensionSaveData.Data != null && AscensionSaveData.Data.ChallengeIsActive(ChallengeRegistry.MoneyShortageChallengeType);
		}

		private static int FilterCurrencyAddition(int currentCurrency, int amount)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			if (amount > 0 && IsMoneyShortageActive())
			{
				suppressNextVisualization = true;
				try
				{
					ChallengeActivationUI.TryShowActivation(ChallengeRegistry.MoneyShortageChallengeType);
				}
				catch (Exception ex)
				{
					Debug.LogWarning((object)("[MoneyShortagePatch] 显示挑战图标失败:" + ex.Message));
				}
				return currentCurrency;
			}
			return currentCurrency + amount;
		}

		private static IEnumerator FilterExcessLethalVisualization(CombatPhaseManager instance, int amount, object specialSequencer)
		{
			if (suppressNextVisualization)
			{
				suppressNextVisualization = false;
				yield break;
			}
			MethodInfo originalMethod = AccessTools.Method(typeof(CombatPhaseManager), "VisualizeExcessLethalDamage", (Type[])null, (Type[])null);
			if (originalMethod == null)
			{
				Debug.LogError((object)"[MoneyShortagePatch] 找不到 VisualizeExcessLethalDamage");
				yield break;
			}
			IEnumerator original;
			try
			{
				original = originalMethod.Invoke(instance, new object[2] { amount, specialSequencer }) as IEnumerator;
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("[MoneyShortagePatch] 调用原版动画失败:" + ex));
				yield break;
			}
			if (original != null)
			{
				while (original.MoveNext())
				{
					yield return original.Current;
				}
			}
		}

		private static IEnumerable<CodeInstruction> CurrencyTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			MethodInfo operand = AccessTools.Method(typeof(MoneyShortagePatch), "FilterCurrencyAddition", (Type[])null, (Type[])null);
			MethodInfo operand2 = AccessTools.Method(typeof(MoneyShortagePatch), "FilterExcessLethalVisualization", (Type[])null, (Type[])null);
			bool flag = false;
			bool flag2 = false;
			for (int i = 0; i < list.Count; i++)
			{
				if (!flag && list[i].opcode == OpCodes.Stfld)
				{
					FieldInfo fieldInfo = list[i].operand as FieldInfo;
					if (fieldInfo != null && fieldInfo.Name == "currency" && fieldInfo.DeclaringType == typeof(RunState))
					{
						int num = -1;
						for (int num2 = i - 1; num2 >= 0; num2--)
						{
							if (!(list[num2].opcode == OpCodes.Nop))
							{
								if (list[num2].opcode == OpCodes.Add || list[num2].opcode == OpCodes.Add_Ovf || list[num2].opcode == OpCodes.Add_Ovf_Un)
								{
									num = num2;
								}
								break;
							}
						}
						if (num >= 0)
						{
							list[num].opcode = OpCodes.Call;
							list[num].operand = operand;
							flag = true;
						}
					}
				}
				if (!flag2 && (list[i].opcode == OpCodes.Call || list[i].opcode == OpCodes.Callvirt))
				{
					MethodInfo methodInfo = list[i].operand as MethodInfo;
					if (methodInfo != null && methodInfo.Name == "VisualizeExcessLethalDamage" && methodInfo.DeclaringType == typeof(CombatPhaseManager))
					{
						list[i].opcode = OpCodes.Call;
						list[i].operand = operand2;
						flag2 = true;
					}
				}
			}
			if (!flag)
			{
				Debug.LogError((object)"[MoneyShortagePatch] 未找到 currency 加法");
			}
			if (!flag2)
			{
				Debug.LogError((object)"[MoneyShortagePatch] 未找到金币动画调用,动画拦截未生效");
			}
			return list;
		}
	}
	public static class NeverHungryPatch
	{
		public static void Apply(Harmony harmony)
		{
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Expected O, but got Unknown
			Type type = typeof(CardDrawPiles).GetNestedTypes(BindingFlags.NonPublic).FirstOrDefault((Type type3) => type3.Name.StartsWith("<ExhaustedSequence>d__", StringComparison.Ordinal));
			if (type == null)
			{
				Plugin.Log.LogError((object)"[OldSa Challenge] Could not find the compiler-generated state machine for CardDrawPiles.ExhaustedSequence.");
				Type[] nestedTypes = typeof(CardDrawPiles).GetNestedTypes(BindingFlags.NonPublic);
				Type[] array = nestedTypes;
				foreach (Type type2 in array)
				{
				}
			}
			else
			{
				MethodInfo methodInfo = AccessTools.Method(type, "MoveNext", (Type[])null, (Type[])null);
				if (methodInfo == null)
				{
					Plugin.Log.LogError((object)"[OldSa Challenge] Could not find MoveNext() in ExhaustedSequence state machine.");
				}
				else
				{
					harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(NeverHungryPatch), "ExhaustedSequence_MoveNext_Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				}
			}
		}

		private static bool IsNeverHungryActive()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				return AscensionSaveData.Data.ChallengeIsActive(ChallengeRegistry.NeverStarvationChallengeType);
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("[OldSa Challenge] Failed to check NeverHungry challenge: " + ex));
				return false;
			}
		}

		private static bool ExhaustedSequence_MoveNext_Prefix()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			if (!IsNeverHungryActive())
			{
				return true;
			}
			ChallengeActivationUI.TryShowActivation(ChallengeRegistry.NeverStarvationChallengeType);
			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)
			{
				ChallengeActivationUI.TryShowActivation(ChallengeRegistry.NoGrowthChallenge.challengeType);
				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), "GenerateMap")]
	public static class NoWoodcarverMapGeneratePatch
	{
		[HarmonyPostfix]
		public static void Postfix()
		{
			//IL_0037: 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 (SaveFile.IsAscension && !((Object)(object)ChallengeRegistry.NoWoodcarverChallenge == (Object)null) && AscensionSaveData.Data != null && AscensionSaveData.Data.ChallengeIsActive(ChallengeRegistry.NoWoodcarverChallenge.challengeType))
			{
				ChallengeActivationUI.TryShowActivation(ChallengeRegistry.NoWoodcarverChallenge.challengeType);
			}
		}
	}
	[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);
			}
		}
	}
	public static class OpeningHandSlotPatch
	{
		[HarmonyPatch(typeof(CardDrawPiles3D), "DrawOpeningHand")]
		public static class DrawOpeningHandPatch
		{
			private static IEnumerator Postfix(IEnumerator result)
			{
				yield return result;
				yield return (object)new WaitForSeconds(0.5f);
				yield return SlotChallengePatch.GenerateChallengeSlots();
			}
		}
	}
	[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_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			ChallengeRegistry.Register();
			Harmony val = new Harmony("OLD_SA.Challenge");
			NeverHungryPatch.Apply(val);
			BrokenBagPatch.Apply(val);
			val.PatchAll();
			WaterForestSlot.Add_WaterForestSlot();
			StartledSlot.Add_StartledSlot();
			HallucinationSlot.Add_HallucinationSlot();
			CampfireChallengesPatch.Apply(val);
			MoneyShortagePatch.Apply(val);
		}

		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;
		}
	}
	[HarmonyPatch(typeof(PlayableCard), "GetPassiveAttackBuffs")]
	public static class StartledPatch
	{
		[HarmonyPostfix]
		public static void Postfix(PlayableCard __instance, ref int __result)
		{
			if (!((Object)(object)__instance == (Object)null) && !((Object)(object)__instance.Slot == (Object)null) && HasStartledSlot(__instance.Slot))
			{
				__result--;
			}
		}

		private static bool HasStartledSlot(CardSlot slot)
		{
			if ((Object)(object)slot == (Object)null)
			{
				return false;
			}
			return (Object)(object)((Component)slot).GetComponent<StartledSlot>() != (Object)null;
		}
	}
	public class StartledSlot : SlotModificationBehaviour
	{
		public static ModificationType SlotType;

		public static void Add_StartledSlot()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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)
			SlotType = SlotModificationExtensions.SetRulebook(SlotModificationManager.New("OLD_SA.Challenge", "StartledSlot", typeof(StartledSlot), TextureHelper.GetImageAsTexture("startled_slot.png", (FilterMode)0)), "Startled Slot", "Creatures on this space lose 1 attack.", TextureHelper.GetImageAsTexture("startled_rulebook.png", (FilterMode)0), (ModificationMetaCategory[])(object)new ModificationMetaCategory[1]);
		}
	}
	public static class SlotChallengePatch
	{
		public static List<CardSlot> ModifiedSlots = new List<CardSlot>();

		public static IEnumerator GenerateChallengeSlots()
		{
			if (!SaveFile.IsAscension)
			{
				yield break;
			}
			BoardManager3D board = Singleton<BoardManager3D>.Instance;
			if (!((Object)(object)board == (Object)null))
			{
				ModifiedSlots.Clear();
				List<CardSlot> availableSlots = ((BoardManager)board).PlayerSlotsCopy.ToList();
				Random slotRandom = new Random(SaveManager.SaveFile.GetCurrentRandomSeed() + 777);
				int waterForestCount = AscensionSaveData.Data.GetNumChallengesOfTypeActive(ChallengeRegistry.WaterForestChallengeType);
				if (waterForestCount > 0)
				{
					ChallengeActivationUI.TryShowActivation(ChallengeRegistry.WaterForestChallengeType);
					yield return ApplySlot(availableSlots, waterForestCount, WaterForestSlot.SlotType, slotRandom);
				}
				int hallucinationCount = AscensionSaveData.Data.GetNumChallengesOfTypeActive(ChallengeRegistry.HallucinationSlotChallengeType);
				if (hallucinationCount > 0)
				{
					ChallengeActivationUI.TryShowActivation(ChallengeRegistry.HallucinationSlotChallengeType);
					yield return ApplySlot(availableSlots, hallucinationCount, HallucinationSlot.SlotType, slotRandom);
				}
				int startledCount = AscensionSaveData.Data.GetNumChallengesOfTypeActive(ChallengeRegistry.StartledSlotChallengeType);
				if (startledCount > 0)
				{
					ChallengeActivationUI.TryShowActivation(ChallengeRegistry.StartledSlotChallengeType);
					yield return ApplySlot(availableSlots, startledCount, StartledSlot.SlotType, slotRandom);
				}
			}
		}

		private static IEnumerator ApplySlot(List<CardSlot> availableSlots, int count, ModificationType slotType, Random random)
		{
			//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)
			if (availableSlots == null || availableSlots.Count == 0 || count <= 0)
			{
				yield break;
			}
			List<CardSlot> selectedSlots = availableSlots.OrderBy((CardSlot x) => random.Next()).Take(count).ToList();
			foreach (CardSlot slot in selectedSlots)
			{
				((HighlightedInteractable)slot).SetShown(false, false);
			}
			yield return (object)new WaitForSeconds(0.45f);
			foreach (CardSlot slot2 in selectedSlots)
			{
				yield return SlotModificationExtensions.SetSlotModification(slot2, slotType);
				if (!ModifiedSlots.Contains(slot2))
				{
					ModifiedSlots.Add(slot2);
				}
				availableSlots.Remove(slot2);
			}
			foreach (CardSlot slot3 in selectedSlots)
			{
				((HighlightedInteractable)slot3).SetShown(true, false);
				yield return (object)new WaitForSeconds(0.05f);
			}
		}
	}
	public class WaterForestSlot : SlotModificationBehaviour
	{
		public static ModificationType SlotType;

		private const string WATER_FOREST_ID = "oldsa_water_forest_submerge";

		private readonly CardModificationInfo waterMod = new CardModificationInfo
		{
			abilities = new List<Ability> { (Ability)13 },
			singletonId = "oldsa_water_forest_submerge",
			nonCopyable = true,
			RemoveOnUpkeep = false
		};

		private static bool initialized;

		public override bool RespondsToOtherCardAssignedToSlot(PlayableCard otherCard)
		{
			return (Object)(object)otherCard != (Object)null && (Object)(object)((SlotModificationBehaviour)this).Slot.Card == (Object)(object)otherCard && !HasWaterForestMod(otherCard);
		}

		public override IEnumerator OnOtherCardAssignedToSlot(PlayableCard otherCard)
		{
			if (!((Object)(object)otherCard == (Object)null) && !HasWaterForestMod(otherCard) && !otherCard.HasAbility((Ability)13) && !otherCard.HasAbility((Ability)89))
			{
				otherCard.Status.hiddenAbilities.Add((Ability)13);
				otherCard.AddTemporaryMod(waterMod);
				otherCard.OnStatsChanged();
			}
			yield break;
		}

		private bool HasWaterForestMod(PlayableCard card)
		{
			if ((Object)(object)card == (Object)null)
			{
				return false;
			}
			foreach (CardModificationInfo temporaryMod in card.TemporaryMods)
			{
				if (temporaryMod.singletonId == "oldsa_water_forest_submerge")
				{
					return true;
				}
			}
			return false;
		}

		public static void Add_WaterForestSlot()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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)
			if (!initialized)
			{
				initialized = true;
				ModificationType slotType = SlotModificationExtensions.SetRulebook(SlotModificationManager.New("OLD_SA.Challenge", "WaterForestSlot", typeof(WaterForestSlot), TextureHelper.GetImageAsTexture("water_forest_slot.png", (FilterMode)0)), "Submerge Slot", "Creatures that enter this space gain the Submerge sigil for this battle.", TextureHelper.GetImageAsTexture("water_forest_rulebook.png", (FilterMode)0), (ModificationMetaCategory[])(object)new ModificationMetaCategory[1]);
				SlotType = slotType;
			}
		}
	}
}

Chinese/OldSa_Chinese.dll

Decompiled 5 days ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using InscryptionAPI.Ascension;
using SimplifiedChineseLanguagePack;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("OldSa_Chinese")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Chinese")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f3343b17-e15c-4e94-ab2d-b5615a847f48")]
[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
{
	[HarmonyPatch(typeof(ChallengeDisplayerPlus), "DisplayText")]
	public static class ChallengeDisplayerPlusPatch
	{
		private static void Prefix(ref string incompatibility)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Invalid comparison between Unknown and I4
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Invalid comparison between Unknown and I4
			if (!string.IsNullOrEmpty(incompatibility) && incompatibility.StartsWith("Incompatible with: "))
			{
				string text = incompatibility.Substring("Incompatible with: ".Length);
				if ((int)Localization.CurrentLanguage == 10)
				{
					incompatibility = "与以下挑战互斥:" + text;
				}
				else if ((int)Localization.CurrentLanguage == 11)
				{
					incompatibility = "與以下挑戰互斥:" + text;
				}
			}
		}
	}
}
namespace OLD_SA_Chinese
{
	public static class AbilityTranslations
	{
		public static void Init()
		{
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Ring Fort", "环形之壁", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Dragon's Rumble", "龙吟", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Blood Recompense", "分解者", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Royalty", "王族", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Martyr's Sting", "自杀刺", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Hive Will", "蜂群意志", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Retribution", "报偿", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Wind's Blessing", "风神祝福", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Tempest", "飓风打击", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Cunning", "狡诈", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Wolf and Warg", "狼狈为奸", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Greed's Sin", "贪婪之罪", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Bloodlust Rising", "吞噬", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Immolate", "焚尽", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Inferno", "炼狱", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Deadly Fang", "毒牙", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Death Spray", "死亡喷射", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Blaze", "烈火", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Poison", "剧毒", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Gluttony", "暴食", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Strafe Strike", "奔袭", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Infinite", "无尽", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Random", "不定", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Penalty", "代价", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Blood Strike", "血袭", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Writhe", "挣扎", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Proliferation", "增殖", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Entangle", "纠缠", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Pitfall Trap", "诱杀", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Cache", "藏秘", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Bones Feast", "吞骨殆尽", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Collect Bones", "拾骨", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Crimson Rush", "猩红狂袭", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Fileswarm", "蝇群", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Bones Armored", "坚骨硬甲", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Incorporal", "无形之物", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Submerge Slot", "水袭格", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Perseverance", "坚定", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Shell Defense", "硬壳防护", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Bloody Gear", "猩红齿", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Blood", "血腥", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Gorebound", "血腥结合", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Bone Devourer", "食骨者", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Fighter", "斗士", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Annihilation", "终焉", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Balance", "平衡", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Flying Strike", "腾飞打击", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Prosperity", "繁荣", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Coiled", "蓄势", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Oak", "橡树之奖", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "BonesCarnival", "骨宴之奖", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Cenotaph", "铭墓之奖", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Blood Acolyte", "血徒", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Slow", "缓慢", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Slow Strike", "缓慢打击", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Healing Armor", "再愈之甲", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Puppeteer", "操偶师", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Puppet Happy", "傀儡_喜", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Memorial", "纪念品", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Puppet Sad", "傀儡_哀", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Denial", "套中人", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Puppet Fear", "傀儡_惧", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "RagePuppeteer", "上位者", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Puppet Rage", "傀儡_怒", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Stubborn Resistance", "负隅顽抗", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Puppet Rejection", "傀儡_狂欢", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Carnival Master", "狂欢之主", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Bell Toes", "脚趾铃铛", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Toe Bell", "铃铛脚趾", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Speed", "极速", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Raid", "突袭", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Blitz", "闪袭", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Redirect Strike", "转向直击", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Diagonal Block", "对角格挡", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Bone Strike", "骨袭打击", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Sweep", "横扫", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Vampire", "吸血鬼", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Frenzy", "狂热", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Hallucinogenic", "迷幻粉", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Death Roll", "死亡翻滚", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Devouring Maw", "吞世之胃", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Split", "分裂", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Double Draw", "二连抽", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Enrage", "激怒", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Arbiter", "仲裁者", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Startled Slot", "恐惧格", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Hallucination Slot", "迷幻格", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Water Music", "水之歌", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Imitator", "模仿者", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Molting", "蜕壳", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Osteophagia", "食骨癖", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Sage", "慧者", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Wondrous Brush", "妙笔", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Twisted Growth", "畸形成长", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Lightning", "风驰电掣", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Forced March", "急行军", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Armor Strike", "硬壳打击", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Enrage Armor", "愤怒之甲", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Fatal Bargain", "致命交易", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Hover", "盘旋", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Brittle Copy", "脆弱的同盟", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Endless Breeding", "繁育永续", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Pack Thief", "背包窃贼", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Undying Rest", "永息不灭", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Fragile", "易碎品", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Blood Dependency", "血液依赖", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Vanishing Act", "大变活人", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Card Steal", "窃牌", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Stress Response", "应激反应", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Death Burst", "横尸当场", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Opportunist", "见风使舵", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Deathborn", "向死而生", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Parasite", "寄生虫", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Decay", "腐坏", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Malformed Spikes", "畸形尖刺", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Ambush", "伺机而动", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Opportunist Strike", "投机打击", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Central Strike", "中心打击", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Bait", "诱饵", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Instinctive Containment", "本能遏制", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Gnome", "地灵之奖", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Bloomguard", "花叶守护", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Ants Fall", "蚂蚁掉落", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Force Entry", "强悍登场", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Foul Stench", "恶臭散发", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Miser", "财奴", (Language)10);
		}
	}
	public static class CardTranslations
	{
		public static void Init()
		{
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Ring Dragon", "环形龙", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Wasp", "杀人蜂", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Bee Worker", "工蜂", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Bee Queen", "蜂后", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Broken Bird", "碎骨鸟", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Quetzalcoatlus", "风神翼龙", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Warg", "狈", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Wolf With Warg", "狼与狈", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Dart Frog", "箭毒蛙", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Hungry Wolf", "饿狼", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Infero Dog", "地狱犬", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Antelope", "羚羊", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "World Snake", "世界蛇", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Lynx", "猞猁", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Cat Of Ulthar", "乌撒之猫", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Whorltooth Worm", "旋齿蠕虫", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Nepenthes", "猪笼草", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Stranglevien", "绞藤", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Broken Pelt", "残破皮毛", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Broken {0}", "残破{0}", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Spirit Bear", "灵熊", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Bonepod Bloom", "繁花骨荚", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Consumable Squirrel", "背包松鼠", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Holy Pelt", "神圣皮毛", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Bonegull", "拾骨雀", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Hollowgaze", "林瞳鸦", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Files", "苍蝇", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Carrion Fly", "食腐蝇", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Broken Flesh", "残破血肉", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Aberration Flesh", "畸形血肉", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Geargrass", "锯齿草", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Gulper eel", "吞噬鳗", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Stitched Spores", "缝合孢子", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Stag Beetle", "锹甲", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Nidhogg", "尼德霍格", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Ratatoslk", "拉塔托斯克", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Vedrfolnir", "韦德弗尔尼尔", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Mantis shrimp", "螳螂虾", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Shaman Totem", "萨满图腾", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Blood Fox", "血魇狐", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Baron Slug", "蛞蝓男爵", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Puppet", "人偶", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Puppeteer Happy", "愚笑假偶", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Puppeteer Sad", "悲祷瓷人", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Puppeteer Rage", "怒咆狂铸", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Puppeteer Fear", "忧惧纸影", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Jester", "弄臣", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Bell Toes", "铃铛脚趾", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Carnival Master", "狂欢剧主", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Swift", "雨燕", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Lion", "雄狮", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Black Panther", "黑豹", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Triceratops", "三角龙", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Ink Adder", "墨纹黑蛇", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Hunter Dove", "猎鸠", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Mosquito Duke", "骨蚊公爵", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Crocodile", "鳄鱼", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Hallucination Moth", "催幻绒蛾", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Devourer World", "吞世魔", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Slime", "史莱姆", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Bone Cicada", "骨翅蝉", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Pure {0}", "纯洁{0}", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Honey Badger", "蜜獾", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Hyena", "鬣狗", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Tailsaur Fiend", "尾蜥恶犾", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Snail", "蛞蝓", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Pure Pelt", "纯洁毛皮", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Lobster", "龙虾", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Crab", "螃蟹", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Siren", "塞壬", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Armored catfish", "非洲骨鲶", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Parrot", "鹦鹉", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Giraffe", "长颈鹿", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Hermit Crab", "寄居蟹", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Marvelous bear", "神奇的熊", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Puppet Tail", "断线的尾巴", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Aborted Idol", "畸胎圣像", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Blood Bolete", "吸血牛肝菌", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Cheetah", "猎豹", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Ostrich", "鸵鸟", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Rageclaw Crabspider", "怒爪蟹蛛", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Kampert", "坎珀特", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Mercenary Squirrel", "松鼠雇佣兵", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Silverfish", "蠹虫", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Rat Emperor", "鼠皇", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Gibbon", "长臂猿", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Card Sorcerer", "牌术士", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "White Wolf", "白狼", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Crystalline Orchid", "脆晶兰", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Silly Roe Deer", "傻狍子", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Seagull", "海鸥", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Antling", "蚍蜉", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Parasite Crab", "寄生沙蟹", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Worm", "蠕虫", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Sand Worm", "沙海蠕虫", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "White Wolf Cub", "白狼崽", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Deformed Antler Elk", "畸角鹿", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Deformed Antler Elk Cub", "畸角鹿幼崽", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Shoebill", "鲸头鹳", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Moth Dragon", "天蛾龙", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Boar", "野猪", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Owl", "猫头鹰", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Anglerfish", "鮟鱇鱼", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Shrubgrass", "灌草", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Pistol Shrimp", "鼓虾", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Sakura Cat", "樱绮猫", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Skeleton Sellsword", "骷髅佣兵", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Acacia", "金合欢树", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Komodo Dragon", "科莫多巨蜥", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Rafflesia", "大王花", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Centipede", "蜈蚣", (Language)10);
		}
	}
	public static class ChallengeTranslations
	{
		public static void Init()
		{
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "No Growth", "禁止成长", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Fledgling sigils no longer evolve. They only grant +1 Power and +1 Health.", "幼雏印记将不会进化为成长体且只提供1攻击与1生命", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "No Woodcarver", "禁止木雕", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "You will no longer encounter Woodcarver choice nodes.", "你将无法遇见木雕师的选择节点", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Dizzy Starters", "晕头转向", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "All creatures in your starting deck gain the Random sigil.", "你初始卡组的造物都将拥有不定印记", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Double Trial", "双重试炼", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "All Totem battles in this run have bases with the Double Strike sigil.", "你遇到的所有图腾战斗都将是双重打击印记", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Broken Start", "残破开局", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "One of your starting pelts is replaced with a Broken Pelt.", "将你的一张初始毛皮替换成残破毛皮", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Bad Things", "坏事多多", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "One of your starting creatures is replaced with a Broken Pelt.", "将你的初始卡组一张卡替换为残破毛皮", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Elephant Bosses", "巨象头目", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "On the second turn, the Boss will fill the board with Elephants.", "在第二阶段,敌方场上将铺满大象", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Broken Bag", "破碎背包", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "You will not encounter the Hourglass, Skinning Knife, Scissors, or CuckooClock.", "你将无法拿到沙漏,剥皮刀,剪刀与顺时针", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Never Starvation", "永不饥饿", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "You will never encounter starvation, even when there are no cards left to draw.", "即使无牌可抽,你也不会遭遇饥饿", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Water Forest", "水之森", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Turn one of your spaces into a Submerge Slot.", "将你的一个格子变为水袭格", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Sorry,she doesn't have enough wood.", "抱歉,她没有那么多木头了", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "They were meant to evolve... but only an echo answered.", "它们本应蜕变...却只有一次微弱的回响", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Your creature has left you.I kept this for you.", "你的造物离你而去,我帮你留下了一些东西", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Sorry,I don't have anything better.Good luck.", "抱歉,我没有更好的了,祝你好运", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "They have all lost their sense of direction.", "它们都失去了方向感", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Not much for you to choose from this time.", "这次可没那么多给你选了", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Hallucination Forest", "幻觉森林", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Turn one of your spaces into a Hallucination Slot.", "将你的一个格子变为迷幻格", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Startled Forest", "忧惧森林", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Turn one of your spaces into a Startled Slot.", "将你的一个格子变为恐惧格", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Overkill Punishment", "溢出惩戒", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Leshy's overkill damage also affects your hand.", "莱西的溢出伤害将可以作用于你的手牌", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Strange... there doesn't seem to be anyone here.", "奇怪...似乎没有任何人", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Fire of Famine", "饥荒之火", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Campfire nodes may now devour cards even on the first visit to the fire.", "篝火节点现在在第一次烤火时将有概率吃掉卡牌", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "No Survivors", "无人之地", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Campfire nodes now have no survivors.", "篝火节点现在将不再拥有幸存者", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Money Shortage", "金钱亏空", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "You cannot obtain Gold Teeth through normal means.", "你将无法通过正常方式获得金牙齿", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Boon Box", "恩惠之箱", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "An additional reward box appears after boss battles.", "头目战后将额外出现一个新的奖励箱", (Language)10);
		}
	}
	public static class DialogueTranslations
	{
		public static void Init()
		{
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "A new cycle begins... Even death can give birth to new life.", "一个新的循环……死亡亦能孕育新生。", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "It departs, leaving its enemies to suffer the consequences. But the Ring never ends, and neither does its return.", "它离开了,为敌人带来惨痛的代价。但环永不止息,它会再次归来。", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "A pitiful creature... yet this time, it managed to protect everything.", "可悲的生物……但这一次,它成功守护了一切。", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "This... this is impossible?", "这……这怎么可能?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "They always attack at the cost of their own lives.", "它们总是舍命攻击。", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "They will give everything for their loyalty.", "它们会为了忠诚而奉献一切。", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Her massive body symbolizes the nobility within the hive.", "她硕大的身躯代表着她在蜂群中的尊贵。", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "She shall lead her swarm to victory.", "她会带领自己的子民走向胜利。", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "A pitiful creature. Its right to fly was taken from it by those who abused it.", "一个可怜的生物,因遭受施暴从而失去了飞翔的权利", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "It makes all who commit violence pay the price.", "它会让所有施暴者付出代价", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "They are the rulers of the sky, destroying enemies with hurricanes.", "它们是天空的霸主,以飓风摧毁敌人", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "It spreads its wings, sending creatures soaring into the sky.", "它展开双翼,令生物翻飞而起", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "The wind god rejects your gift. It will soar by its own power.", "风神拒绝了你的恩赐,并决定自己乘风而起", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "It spreads its wings, but they have long been broken.", "它试图扇动翅膀,但它们早已满目疮痍", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Where the Wolf treads, the Wrag is near.", "狼之所至,狈影随行", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "A cunning creature that exists only in legends.", "一个狡诈并且只在传说中出现的造物", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "It is cloaked in venom — keep your distance.", "它剧毒裹身,最好不要靠近", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Right now, it could swallow anything.", "现在它几乎什么都能吃下", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "It commands the flames — even Hell fears it.", "它是火焰的掌控者,连地狱都畏惧于它", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Watch its horns,sometimes they strike true.", "小心它的角,有时候总是非常致命", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "I really don't know if I should let you pick this one...", "我真不知道该不该让你选择它...", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "It never knows contentment.", "它永远不懂得知足", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "To make it obey you, you must pay a price.", "想要使用它,总得付出点什么", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Habituated to life, he struggles on.", "它已经习惯了活着,因此挣扎求生", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Attack with care. More of its kind may lurk in the dark.", "谨慎攻击,你并不知道黑暗里还有多少一样的猫", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Little aggression, but entanglement brings trouble.", "它几乎没有攻击性,但是被缠上总会很麻烦", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "It did nothing. The insects fell in of their own accord.", "它什么也没做,这些虫子是自己进去的", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "What's this?!", "这是什么鬼?!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "What good do you think I have to offer you?", "你难道觉得我会给你什么好东西吗?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Blooms and thorns hide an old‑god's bone.", "繁花与荆棘掩藏着邪神之骨", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Ice‑age ghost, keeper of old rainforest secrets.", "它是冰河世纪的遗魂,藏在雨林深处的秘宝", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Your creatures have all been driven wild by this.", "你的造物们因此激发了野性", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Your creatures are purged of impurity and grow stronger.", "你的造物们洗涤杂质,并且变得更加强大", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "It carries bone back to its nest.", "它会将骸骨带回自己的巢穴", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "One, two... or maybe more?", "一只,两只,或许更多?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "They feed on carrion. They are everywhere.", "它们以腐肉为食,无处不在", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "You really think this will work?", "你真觉得这会成功?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Attracted some annoying stuff...", "招来了一些惹人烦的东西...", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "The creatures shrink from it in fear.", "造物们都对它望而生畏", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Join me! Become part of me!", "加入我!成为我!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "This time, it answers more than a call.", "它这次不再只是听从召唤", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "You pick!", "你来选择!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "We stitch!", "我们缝合!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Choose your stats.", "选择你的属性", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Choose your cost.", "选择你的成本", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Choose your sigils.", "选择你的印记", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Not enough! We need more!", "不够!我们需要更多!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Come back next time!", "下次再来!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "I really hate them.", "我真的很讨厌它们", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Sorry. You can't draw anymore.", "抱歉,不准抽牌", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "What did you do?", "你干了什么?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Never mind. The Angler should like this.", "算了,钓鱼人应该会喜欢的", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "It is fiercely competitive and always seeks to prove itself against its opponents.", "它拥有极强和好胜心,时常想与对手一决胜负", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Beware its fists. They often seek a one-hit kill.", "当心它的拳头,它们总是追求一击毙命", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "You can't smoke this.", "你不能抽这个", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "A shaman totem standing on the battlefield, its power enough to awaken the most primal instincts.", "矗立于战场上的萨满图腾,其蕴含的力量足以唤起最原始的本能", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "It hungers. It thirsts.", "它正在渴望,它正在渴求", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "It moves slowly, but it is enough to hold the enemy back.", "它虽说行动缓慢,但也足够拖住敌人", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Joy, anger, sorrow, fear—it smiles foolishly, it sneers.", "喜怒哀惧,它在愚笑,它在嗤笑", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Joy, anger, sorrow, fear—it weeps bitterly, it prays in grief.", "喜怒哀惧,它在痛哭,它在悲祷", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Joy, anger, sorrow, fear—it flees, it dreads.", "喜怒哀惧,它在逃避,它在忧惧", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Joy, anger, sorrow, fear—it roars in rage, it howls in fury.", "喜怒哀惧,它在怒咆,它在怒啸", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "See his toes of bells! See his bells of toes!", "他的脚趾像铃铛,他的铃铛像脚趾", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Covet joy, abuse wrath, swallow sorrow, bring fear—next comes an endless revelry!!!", "觊觎欢喜,滥用愤怒,吞咽哀伤,带来恐惧,接下来是永不停息的狂欢!!!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Its performance has come to an end.", "它的演出已然落幕", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "It is like a lone commander...", "它如同一个光杆司令般怒咆", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "It is extremely fast. Enemies had better beware its assault.", "它的速度极快,敌人可得当心它的攻势了", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "The mighty lion prefers to eliminate the root of problems rather than solve them", "强壮的雄狮比起解决问题,更会解决问题的源头", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "It moves so fast none can catch it.", "它的速度快得没有谁能捉住它", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Its horns can withstand all powerful attacks.", "它的角可以抵挡许多强势的攻击", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Its body is highly toxic, and it is very difficult to catch.", "它的体表含有剧毒,且十分不易被抓住", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Its gaze is sharp, and it can often pursue its prey.", "它的眼神锐利异常,对猎物穷追不舍", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Sharp teeth, biting enemies to death.", "伶牙俐齿,死咬敌人", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "It does not fight on its own, but the hallucinogenic powder on its body is enough to cloud the mind.", "它虽说不会主动厮杀,但身上的迷粉足以让人神志不清", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "It hungers. It feeds. It never ends.", "它在饥饿,它在啃食,永无止境", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Sometimes trouble just keeps multiplying.", "有时候麻烦总是越来越多", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "There are more and more of them...", "它们变得越来越多了...", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Hiding away... until the ground turns into a graveyard.", "蛰伏,直到地底变成坟墓", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Not bird, not wolf. What is it? What is it not?", "似鸟非鸟,似狼非狼,它究是何,何究是它", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "It always likes to provoke powerful creatures.", "它总是喜欢去招惹强大的生物", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Hyenas always like to travel in packs with their companions.", "鬣狗总是喜欢和它的同伴们成群结队", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Surprised? My overkill damage can reach your hand now. Be careful with your first card.", "很意外吗?我的溢出伤害现在也对你有效了,小心你的第一张手牌", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Arloph Sterling, the Dark Arbiter Beast, also known as the Tailsaur Fiend.", "阿尔洛浦·斯特林,暗黑的仲裁之兽,又称之为尾蜥恶犾", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Given the chance, they will heal.", "只要有机会,它终会痊愈", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Its hard shell blocks attacks, and its claws can pin enemies.", "它的壳无坚不摧,它的钳无物不碎", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "It will keep holding on until the eve of victory.", "它会一直坚持,直到胜利的朝夕", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "I love you. Beneath the waves, I hide a kiss and a heart.", "我爱你,在水下,我藏着一个吻和一颗心", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "A parrot that loves to mimic—is it a bit too noisy?", "一个爱模仿的鹦鹉,但似乎有点太吵了?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "A parrot that loves to mimic—is it a bit too noisy?", "一个爱模仿的鹦鹉,但似乎有点太吵了?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "A tall giraffe... it seems to be craving bones?", "一只高大的长颈鹿,它似乎正在渴望骨头?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "This hermit crab is looking for its shell.", "这只寄居蟹正在寻找自己的壳", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Though never trained by a master, his innate magic compels him to draw wonders.", "他并非大师门下,但他的魔法天赋依然驱使他画出了不可思议的东西", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Viska's mind is filled with mad whispers, and they grow worse as its flesh grows.", "维斯卡的脑子里全是痴语,这会伴随它血肉的生长愈演愈烈", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "The cheetah is swift as lightning—a hundred meters in a flash.", "猎豹的速度风驰电掣,百米犹如一瞬", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "It's different from other birds—you'd better watch out for those legs of its.", "它其他的鸟不同,你可得小心它的那双粗壮的大腿了", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Don't touch it... The stimulation of blood will only make it grow larger and larger.", "别碰它...鲜血的刺激会让它越长越大", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Sometimes, even without blood...", "有时候,哪怕无需鲜血的滋养...", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "It seems to be in a constant state of rage, eager to tear its enemies apart...", "它似乎无时无刻处于愤怒状态,渴望将敌人撕碎...", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Opportunity seldom exists without its toll.", "机会总与代价常相伴", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Swarms of silverfish forge a fragile alliance.", "成群的蠹虫,结成了脆弱的同盟", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "No... they've already overrun everything.", "不...它们早已泛滥成灾", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Shed the mortal shell, the great claw falls.", "褪凡壳,巨爪落", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Its eerie long arms can reach anything it wants.", "它诡异的长臂可以够到它想要的任何东西", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "It always comes and goes like a ghost. Who knows what else it can conjure up?", "它总是神出鬼没,谁又能知道它会变出什么呢", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "It is a born killing machine. Without killing, it has no meaning.", "它就是天生的杀戮机器,没有杀戮,它就失去了意义", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "This dazzling beauty is its final elegy.", "这绚烂之美是它最后的哀歌", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Foolish and foolish roe deer, at least he knows how to escape.", "愚蠢至极的傻狍子,至少它还知道怎么逃跑", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "A weathervane seagull, it has truly mastered the pirates' ways.", "见风使舵的海鸥,深得海盗们的精髓", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Frail and unknowing, yet they never yield.", "纵然弱小愚昧,亦无退缩之意", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Strange... nature does not allow this, yet they have indeed achieved some form of symbiosis...", "真奇怪...自然并不允许如此,但它们的确达成了某种共生...", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "It seems to have had a strong urge to attack since it was young.", "它似乎从小就有极强的攻击欲望", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "This little elk's antlers look a bit strange.", "这只小鹿的角看上去有点奇怪", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "What a pair of terrifying antlers... How did it ever grow them?", "这真是一对可怕的角...它究竟是如何长的?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "The two-faced shoebill is waiting for its next prey.", "表里不一的鲸头鹳,它正在等待下一个猎物", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Do you believe this is all this abomination is capable of?", "你觉得这就是这种邪恶生物的极限了吗?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Sorry, did I embarrass you?", "抱歉,我有让你难堪吗?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "I hope I'm the card you need.", "我希望我是你需要的牌", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "I hope you have fun!", "希望你玩得开心", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "I'll do my best!", "我会尽力的!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Nice play, buddy!", "打得真好,伙计!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Shrubgrass incoming!", "灌草来袭!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Buddy, I'm so glad I could take that hit for you.", "伙计,真庆幸我帮你挡下来了", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "I'm just glad it wasn't you who got hurt.", "真高兴受伤的不是你", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Ouch!", "嗷!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Will you choose me?", "你选的会是我吗?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "I shouldn't get my hopes up.", "我不该抱有太大期待", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Trust your instincts.", "相信你自己的选择", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Of course, you could choose me too.", "当然,你也可以选择我", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Is it time for us to say goodbye?", "我们该说再见了?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "It's my honor.", "这是我的荣幸", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "I have no regrets.", "无怨无悔", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "See you next time!", "下次见!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Good luck!", "祝你好运!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Will we make it?", "会成功吗?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Or perhaps you don't want to succeed?", "或者你并不想成功?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "I'm ready to become even stronger!", "我准备好变得更加强大了", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Yes, we're here!", "是的,我们在这", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "How fascinating...", "真是神奇...", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Goodbye, buddy. I've had a wonderful time with you.", "再见伙计,和你在一起很开心", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Let's play together again sometime!", "下一次再一起玩吧", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "I think it's time for me to rest.", "我该休息了", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Hello! I'm Shrubgrass!", "你好,我是灌草!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "It's nice to see you again!", "我们又见面了", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Choose what you believe is right.", "选择你认为正确的吧", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Even if you don't choose me, I'll be waiting for our next meeting.", "即便不是我,我也会等待我们的下一次见面", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "It always likes to cut corners and charge in recklessly.", "它总是喜欢投机取巧,莽撞过人", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Its head is always steady, staying perfectly centered.", "它的脑袋十分稳定,一直处于中心位置", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Its light can lure many creatures close.", "它的灯光可以吸引许多生物的靠近", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Stay away from it,it's poised to strike.", "别靠近它,它蓄势待发", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Do you like bear paintings?", "你喜欢熊的画吗?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "A magical paintbrush will never disappoint you.", "神奇的画笔不会让你失望", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Bear likes you! Bear hopes you like Bear too.", "熊喜欢你!希望你也喜欢熊", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Outdoor painting!", "户外写生!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Bear is here to add a little color!", "熊来添一笔!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "The mighty Bear strikes!", "巨熊出击!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Bear's paintbrush has split.", "熊的画刷分叉了", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Hey! That's rude!", "嘿!真没礼貌!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Ouch!", "唔!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Let Bear see the new materials.", "让熊看看新素材", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Bear trusts your taste.", "熊相信你的审美", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Trust Bear's eye for art!", "相信熊的眼光!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "You don't seem to like this style?", "你好像不喜欢这个风格?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Alright, Bear will try a different technique next time.", "好吧,下次熊会换个画法", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Bear will still like you.", "熊还是会喜欢你", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Hey! Bear just started sketching!", "嘿,熊刚起草!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Alright, Bear will do this for you.", "好吧,熊成全你", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Bear is going to wash the paintbrush.", "熊去洗个笔刷", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Magic is art!", "魔法即艺术!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Bear will carefully study these runes.", "熊会好好观察符文的", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Success and failure are like light and shadow.", "成功与失败就像光与影", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "More paintbrushes and more colors.", "更多的画笔和颜色", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "A victory for Dadaism!", "达达主义的胜利!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Bear feels... marvelous.", "熊感觉...很神奇", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Goodbye, Bear's muse.", "再见,熊的缪斯", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Bear would like to take a little nap.", "熊想睡一会了", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Bear's art will stay with you.", "熊的艺术会继续陪着你", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Hello! Would you like to be Bear's muse?", "你好!你想做熊的缪斯吗?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "...Bear thought Bear had lost you.", "…熊还以为熊弄丢你了", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Bear's inspiration... has returned.", "熊的灵感…回来了", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Bear's world is colorful again!", "熊的世界又是彩色了!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "H-Hello!", "你...你好!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Meow...", "喵...", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "I'm happy to see you! Hehe.", "很高兴看到你,嘻嘻", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "I'll protect everyone!", "我会保护大家!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Please let me heal everyone.", "请让我为大家治疗吧", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Please believe in me.", "请相信我", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Meow!", "喵!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "What's that for?!", "干嘛!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "I protected you...", "我保护了你...", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Pick me, meow!", "选我喵!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Look at me! Look at me!", "看我看我!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Will it be me?", "会是我吗?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "I don't want to leave you...", "我不想离开你...", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Do you dislike me?", "你讨厌我吗?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Meow...", "喵...", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Alright, meow...", "好吧喵...", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "I don't blame you.", "我不怪你", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Goodbye...", "再见...", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Good luck!", "加油!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "I hope I was helpful.", "希望我有帮到你", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Wishing you the best of luck!", "祝你好运满满!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Thank you!", "感谢!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "I won't let you down.", "我不会辜负你的期待", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Will I become even better?", "我会变得更好吗?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Hello, I'm Sakura Cat!", "你好,我叫樱绮猫!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "I've missed you so much!", "我很想你!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "We're meeting again!", "我们又见面了!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Meow!", "喵!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Let's make this happen!", "让我们大干一场!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Just make sure we've got the money!", "先说好,钱得够!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "H-Hey, it's my turn already?!", "哎哎哎,这就到我了?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Pleasure doing business with you!", "合作愉快!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Nothing can stop us! Except money.", "一切都不会阻挡我们!除了钱。", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Thanks for your support. I'll take it from here.", "谢谢支持,接下来交给我。", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "I save my best work for the right moment!", "好钢都用在刀刃上!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "I'm not exactly an expert in this field...", "我可不是这方面的专家。", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Should've spent less time slacking off...", "早知道少摸鱼了。", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "I don't take advantage of repeat customers!", "杀熟这种事情我可不干!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "At least I can still make bone broth!", "至少我还能炖骨头汤!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Show your support! Buy more!", "多支持点生意!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "I demand a vacation!", "我要休假!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Don't come to me if you're short on cash!", "钱不够来找我可是不行的!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "I'm no coward!", "我可不是孬种!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "What a glorious exit!", "华丽退场!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Back to the land of the dead!", "亡灵返乡!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Just don't dock my bounty!", "别扣我赏金就行!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "I'm amazing!", "我真强!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "This is definitely not my fault!", "这绝对不是我的问题!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "You get what you pay for!", "一分钱一分货!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "I'm a mighty warrior who can be anywhere!", "我可是“无所不至”的强大!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "This is worth more than money!", "这比钱来的实在!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "One plus one... definitely isn't two! Just like our partnership!", "一加一……反正不是二!就像我们的合作!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "I'll ask the old Bone King to make me look more handsome!", "我去让骨王他老人家给我弄帅一点!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Time for some well-earned R&R!", "给自己一次战备休整!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "It's been a pleasure doing business with you!", "合作很愉快!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "I'm the finest mercenary around!", "我可是最棒的佣兵!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Fancy meeting you here! Need a hand?", "真巧啊,还要帮忙吗?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "With enough money, victory is guaranteed!", "只要钱充足就是稳赢的!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Don't leave just yet! How about hiring me?", "别急着走啊,不考虑考虑我?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "The jungle law and a streak of treachery fuel their cold-bloodedness.", "弱肉强食加上一点点阴险构成了他们冷血的所有成分", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Its foul stench strikes fear into all creatures.", "它的恶臭让生物们望而生畏", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Hey, hey! Look at me!", "嘿,嘿,看我!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Wait, oh!", "等等,哦!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Things aren't looking too good right now.", "现在局势可不太好。", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "You want me to get myself killed?!", "你想让我送死吗!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Me? Really?", "是我?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Don't let me down!", "别让我失望!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "I knew it!", "我就知道!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Pay me back!", "快赔钱!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "What was that for?!", "干嘛?!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Wait, is it me?", "等等,是我吗?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "It's going to be me, right?!", "会是我吧!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Could it not be me?", "不会是我吗?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Wait, don't pick me!", "等等,别选我!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Get your filthy hands off me!", "挪开你的脏手!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "I don't want this!", "我不想要这个!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "You're using me for THIS?!", "你就拿我干这个?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Huh?", "阿哈?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "HAH!", "阿哈!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Do I get paid if I pass?", "通过了有钱拿吗?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "You picked me just like that?", "这就拿到我了?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Wait, what's going on?", "等等,这是干嘛?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Yes, yes.", "是的,是的。", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "A fair deal, pal.", "平等的交易,伙计。", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Don't treat me like a trash can!", "别把我当垃圾桶!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Wait? Where am I? Well, at least this isn't another inn.", "等等?这是哪?算了,不是又一个旅馆就行。", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "You again?", "又是你?", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Oh, don't pick me!", "哦,别选我!", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "I don't want to go adventuring with you!", "我可不想陪你冒险!", (Language)10);
		}
	}
	[BepInPlugin("OLD_SA.Chinese", "OLD SA Chinese", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private void Awake()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			RulebookTranslations.Init();
			AbilityTranslations.Init();
			CardTranslations.Init();
			DialogueTranslations.Init();
			ChallengeTranslations.Init();
			Harmony val = new Harmony("OLD_SA.Chinese");
			val.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"OLD SA Chinese loaded");
		}
	}
	public static class RulebookTranslations
	{
		public static void Init()
		{
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] kills another creature, a card is created.", "当[creature]消灭另一个造物时,持有者会获得一张卡牌。", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] dies, it deals 1 damage to a random enemy, increasing each time it takes damage.", "当[creature]死亡时,对随机一个敌方造物造成1点伤害。每当它受到伤害时,将会增加", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] takes damage, it intercepts the attack and reduces that damage by 1.", "[creature]会拦截敌方造物的攻击,并使受到的伤害降低1点。", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "This creature's attack is determined by the number of different tribes present on the board.", "该造物的攻击力由场上存在的不同种族数量决定。", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "The lower this creature's health, the higher its attack.", "该造物的生命越低,它的攻击就越高。", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When a specific card is played on [creature], they fuse with each other.", "当你对[creature]打出特定卡牌时,它们会融合", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When an enemy creature attacks the player, [creature] causes it to lose Power.", "当一个敌方造物攻击持牌人时,[creature]会令其失去力量", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "At the start of the turn, [creature] grants Wind Blessing to itself and adjacent creatures.", "当回合开始时,[creature]会给予相邻和自身风祝福效果.", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "For each flying ally, [creature] attacks an additional time.", "友方每有一个空中造物,[creature]便额外攻击一次", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When another sigil on [creature] triggers, it triggers an additional time.", "当[creature]的其他印记触发时,它们会额外触发一次", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When there is a creature opposite [creature], [creature] gains Power equal to the number of sigils on that creature.", "当[creature]对面有其他造物时,[creature]会根据目标的印记数量而增加力量", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] kills another creature, a random opposing creature gains 5 Gluttony.", "当[creature]击杀一个造物时,一个友方获得1点暴食,共5次", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] kills a creature, it gains 2 Gluttony.", "当[creature]击杀时,获得2点暴食", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "At the start of the end, [creature] gives the opposing creature 3 Blaze.", "回合结束时,[creature]会给予对面造物3点烈火", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "At the start of the turn, [creature] gives 1 Blaze to all opposing creatures.", "回合开始时,[creature]会给予所有敌方1点烈火", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] attacks, it gives Poison equal to 4 minus its Power to the target.", "当[creature]攻击时,会给予目标4减去自身攻击的剧毒", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] dies, it gives 4 Poison to a random enemy.", "当[creature]死亡时,给予一个随机敌人4点剧毒", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Every 2 Blaze, the bearer takes 1 damage.", "每有2点烈火,则受到1点伤害", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Every 4 Poison, the bearer dies.", "每有4点剧毒,则自身毒发身亡", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Every 3 Gluttony, the bearer gains 1 Power and 1 Health.After triggering 3 times in a battle, the bearer dies.", "每有3点暴食,则获得1生命与1攻击,每累计触发3次,则死亡", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "After [creature] moves, it attacks.", "当[creature]移动时,它会攻击一次", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "At the start of each turn, [creature] regains lost sigils.", "当回合开始时,[creature]将会恢复印记", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] attacks, its target is random.", "[creature]的攻击目标是随机的", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] is played, its owner takes 1 damage.", "当[creature]上场时,对持有者造成1点伤害", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] kills, it gains 1 attack.", "当[creature]击杀时,它会获得1次攻击次数", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "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.", "当[creature]受到致命伤害时,会保留1生命并且以攻击来抵挡伤害", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] takes damage, a 1/1 copy of it is created in the owner's hand for 2 Bone.", "当[creature]受伤时,在你的手中创造一张该卡的副本,副本拥有1/1的属性与2骨头的消耗", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] is killed, the creature that killed it permanently loses 2 attack.", "当[creature]被击杀时,击杀者将会失去2点力量", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] is attacked by an Insect, it takes no damage and kills the attacker. It gains 1 Power and 1 Health.", "当[creature]被虫族攻击时,它不会受到伤害反而吞噬敌方并且获得1点力量与生命", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] kills a creature, gain a random item.", "当[creature]击杀时,获得一个随机道具", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When a creature is sacrificed to summon [creature], gain 3 Bones from it.", "当一个造物被献祭以召唤[creature],获得3根骨头", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When another creature dies, if [creature] is on the board, gain 1 Bone.", "当其他造物死亡时,如果[creature]在场,则获得1根骨头", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] attacks, it targets opposing creatures first and gains 1 additional attack after a kill.", "当[creature]攻击时,优先锁定敌方造物,并且击杀后获得1次额外攻击次数", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When an ally dies, [creature] summons a card in its place.", "当友方阵亡时,[creature]在其位置召唤一张卡牌", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] takes damage, if bones are available, it consumes them to prevent that damage.", "当[creature]受到攻击时,如果数量允许,则消耗骨头来抵挡攻击", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] is on the board, it cannot be hit, and it cannot hit enemies.", "当[creature]在场时,它不会受到敌方造物的攻击,同样它对敌方造物造成伤害", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Creatures that enter this space gain the Submerge sigil for this battle.", "进入过此格的造物将拥有水袭", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When an ally takes damage, if that damage is less than 2, [creature] gives it 1 Health.", "当友方受伤时,若伤害低于2,则[creature]给予其1点生命", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] would take 1 damage, prevent it and deal 1 damage to the attacker.", "当[creature]受伤时,如果伤害量为1,则免疫并反弹", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] deals damage, give the struck creature 1 Blood. When it dies, create a Flesh in your hand.", "当[creature]造成伤害时,施加1点血腥,且它在死亡时在你的手中创造一张血肉", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Crimson everywhere, flesh growing wild.", "猩红遍地,血肉横生", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] sacrifices another creature, it gains 1 Power and 1 Health for each tribe that sacrificed creature has.", "当[creature]献祭时,被献祭者每个种族为它提供1点生命与力量", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When a bone appears, [creature] devours one. For every 3 bones devoured, [creature] gains 1 Power and 1 Health.", "当出现骨头时,[creature]会吞掉1根,每吞掉3根,[creature]则获得1点力量与生命", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] kills another creature, randomly gain 1 Power or 2 Health.", "当[creature]击杀时,获得1点力量或者2点生命", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "At the end of the turn, [creature] kills all creatures with less than 2 Health. For each creature killed this way, [creature] gains 1 Power.", "当回合结束时,[creature]会击杀所有生命值不足2的敌方,每次击杀[creature]将获得1点力量", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "[creature] gives allies the higher stat and enemies the lower.", "[creature]会让友方造物的攻击取其数值中的最大值,敌方则取最小值", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] attacks, make an additional Flying Strike.", "当[creature]攻击时,将额外攻击一次,并视为空袭效果", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] kills another creature, it and adjacent friendly creatures gain 1 Health.", "当[creature]击杀时,其相邻友方和自身获得1点生命", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When an ally deals damage, [creature] gains 1 Power until the end of the turn.", "当友方造成伤害时,[creature]获得1点力量,持续至回合结束", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Add 1 Squirrel to your hand.", "获得1张松鼠", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Gain 4 Bones.", "获得4根骨头", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Once per battle, when a friendly card dies, create a Grave in its place.", "友方造物阵亡时,在其位置创建一张墓碑", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "[creature] grows stronger with each sacrifice.", "[creature]可以从献祭中变得更加强大", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] deals damage, the struck creature gains 2 Slow.", "当[creature]造成造成伤害时,施加2层缓慢", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Every 3 Slow, the bearer loses its attack this turn.", "每有3点缓慢,此造物将在攻击时抵消一次", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "At the start of the turn, if [creature] took no damage during the last enemy turn, it restores 2 Health.", "回合开始时,若[creature]在上一个敌方回合没有受伤,则恢复2点生命", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When the Puppeteer's stats change, [creature] changes as well.", "当操偶师发生属性修改时,[creature]也会一同获得", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] is played, place a Puppet on its left.", "当[creature]上场时,在其左侧放置一张人偶,若被阻挡,则会先使其回到手中", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "This creature's attack is determined by the number of puppets bound to it.", "该值取决于场上与其绑定的人偶数量", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] is played, place a Puppet opposite it.", "当[creature]上场时,在其对位放置一张人偶", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] kills, it returns to your hand and leaves a card in its place.", "当[creature]击杀时,回到手中并留下一张卡牌", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] dies, a chosen card from your hand is placed in its position.", "当[creature]阵亡时,你手中的一张卡来到其位置", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] is on the board, adjacent allies lose 1 Power.", "与[creature]相邻的造物将降低1点力量", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When an ally takes damage, [creature] gives an ally 1 Power.", "当友方受到伤害时,[creature]使一个友方获得1点力量", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] has this sigil, it does not attack its Puppeteer.", "[creature]不会攻击其主人", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] is played, it transforms an allied creature into a Puppet.", "当[creature]上场时,令一个友方变为人偶", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "For every two sacrifices made, [creature] adds a Puppet to your hand.", "每执行两次献祭,[creature]会为你添加一张人偶", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When another creature is played, [creature] turns it into a Puppet.", "当其他卡上场时,[creature]将其变为人偶", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When an ally is about to die, [creature] dies in its place.", "当其他卡即将死亡,[creature]将代替其死亡", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "For every 3 Speed, attacks once.", "每有3点极速,就攻击一次", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] is played, it gains 2 Speed. Then, at the end of each turn, it gains 2 Speed.", "当[creature]上场时,获得2点极速,过后每回合结束时获得2点极速", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] is about to be attacked, it counterattacks once and moves.", "当[creature]即将受到攻击时,反击一次并移动", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "[creature] excess damage is dealt directly to the player.", "[creature]的溢出伤害将直接作用于牌手", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "[creature] the damage it ultimately takes is 5 minus its stat.", "[creature]受到的最终伤害将为5减去其数值", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] attacks, spend 1 Bone. For every 2 Bones spent, attack an additional time.", "当[creature]攻击时,消耗1根骨头,每消耗2根,获得一次攻击次数", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] attacks, it deals 1 damage to all enemy creatures.", "当[creature]攻击时,对所有敌方造成1点伤害", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] deals damage, it heals 1 damage.", "当[creature]造成伤害时,恢复1点生命", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] kills another creature, it moves.", "当[creature]击杀时,移动一次", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] is about to be attacked, the attacker's target is randomized.", "当[creature]被攻击时,使攻击者的目标随机化,敌我不分", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "At the start of the turn, [creature] deals 1 damage to the card opposite it, repeated for each time it has attacked.", "当回合开始时,[creature]对对位卡造成1点伤害,重复次数为[creature]对其的攻击次数", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] kills a creature, it gains that creature's Power, Health, and sigils.", "当[creature]击杀时,获得被击杀造物的力量,生命与印记", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] dies, place a Split card on its left and right. The Split card's stats are half of this card's.", "当[creature]阵亡时,在左侧与右侧各放置一张分裂卡,分裂卡的数值为该卡的一半", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] is drawn, draw an additional card.", "当[creature]被抽到时,从主牌堆再抽一张牌", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When [creature] deals damage, the target gains 1 Power.", "当[creature]造成伤害时,受击者获得1点力量", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "At the start of the turn, [creature] deals 1 damage to a random enemy. If it does not kill, the next trigger repeats one additional time.", "当回合开始时,[creature]对一个随机敌方造成1点伤害,如若未击杀,则下一次触发次数+1", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Creatures on this space attack random targets.", "该格上的造物的攻击目标是随机的", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "Creatures on this space lose 1 attack.", "该格上的造物将损失1点攻击", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA", (string)null, "When a creature emerges, if it is an ally, [creature] gives it 1 Power; if it is an enemy, [creature] reduces it by 1.", "当造物浮出水面时,如果是友方,[creature]给予其1点力量,如果是敌方,[creature]减少其1点力量", (Language)10);
			SimplifiedChineseLanguagePackPlugin.Translate("OLD_SA"

Sigil/OldSa_Annihilation_sigil.dll

Decompiled 5 days 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 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_Annihilation_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Annihilation_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("795f6556-1ddc-446e-8cf0-2c04f724a510")]
[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.Annihilation;

public static class AnnihilationAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Annihilation";
		val.rulebookName = "Annihilation";
		val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
		val.powerLevel = 5;
		val.opponentUsable = false;
		val.canStack = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Annihilation.png", (FilterMode)0);
		FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(val, "At the end of the turn, [creature] kills all creatures with less than 2 Health. For each creature killed this way, [creature] gains 1 Power.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(AnnihilationBehaviour), imageAsTexture);
	}
}
public class AnnihilationBehaviour : AbilityBehaviour
{
	public static Ability ability;

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

	public override bool RespondsToTurnEnd(bool playerTurnEnd)
	{
		if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead || !((AbilityBehaviour)this).Card.OnBoard)
		{
			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 || !((AbilityBehaviour)this).Card.OnBoard)
		{
			yield break;
		}
		yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
		List<PlayableCard> targets = GetAnnihilationTargets();
		foreach (PlayableCard target in targets)
		{
			if (!((Object)(object)target == (Object)null) && !target.Dead && target.OnBoard && target.Health < 2)
			{
				yield return target.Die(false, ((AbilityBehaviour)this).Card, true);
				yield return (object)new WaitForSeconds(0.25f);
				if ((Object)(object)((AbilityBehaviour)this).Card != (Object)null && !((AbilityBehaviour)this).Card.Dead && ((AbilityBehaviour)this).Card.OnBoard)
				{
					CardModificationInfo mod = new CardModificationInfo(1, 0);
					((AbilityBehaviour)this).Card.AddTemporaryMod(mod);
					((Card)((AbilityBehaviour)this).Card).RenderCard();
					((Card)((AbilityBehaviour)this).Card).Anim.LightNegationEffect();
				}
			}
		}
		if ((Object)(object)((AbilityBehaviour)this).Card != (Object)null && !((AbilityBehaviour)this).Card.Dead)
		{
			yield return ((AbilityBehaviour)this).LearnAbility(0f);
		}
	}

	private List<PlayableCard> GetAnnihilationTargets()
	{
		List<PlayableCard> list = new List<PlayableCard>();
		List<CardSlot> enemySlots = GetEnemySlots();
		foreach (CardSlot item in enemySlots)
		{
			if (!((Object)(object)item == (Object)null) && !((Object)(object)item.Card == (Object)null))
			{
				PlayableCard card = item.Card;
				if (!card.Dead && card.OnBoard && card.Health < 2)
				{
					list.Add(card);
				}
			}
		}
		return list;
	}

	private List<CardSlot> GetEnemySlots()
	{
		BoardManager instance = Singleton<BoardManager>.Instance;
		if ((Object)(object)instance == (Object)null)
		{
			return new List<CardSlot>();
		}
		if (((AbilityBehaviour)this).Card.OpponentCard)
		{
			return instance.PlayerSlotsCopy;
		}
		return instance.OpponentSlotsCopy;
	}
}
[BepInPlugin("OLD_SA.Annihilation", "OLD SA Annihilation", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		AnnihilationAPI.Init();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"OLD SA Annihilation loaded.");
	}
}

Sigil/OldSa_Balance_sigil.dll

Decompiled 5 days 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 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_Balance_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Balance_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1b083245-323f-440b-b777-4d61ae69dcd5")]
[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.Balance;

public static class BalanceAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Balance";
		val.rulebookName = "Balance";
		val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
		val.powerLevel = 3;
		val.opponentUsable = false;
		val.canStack = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Balance.png", (FilterMode)0);
		FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(val, "[creature] gives allies the higher stat and enemies the lower.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(BalanceBehaviour), imageAsTexture);
	}
}
public class BalanceBehaviour : ExtendedAbilityBehaviour
{
	public override Ability Ability => BalanceAPI.ability.Id;

	public override int GetPassiveAttackBuff(PlayableCard target)
	{
		if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead || !((AbilityBehaviour)this).Card.OnBoard)
		{
			return 0;
		}
		if ((Object)(object)target == (Object)null || target.Dead || !target.OnBoard || (Object)(object)target == (Object)(object)((AbilityBehaviour)this).Card)
		{
			return 0;
		}
		if ((Object)(object)((Card)target).Info == (Object)null)
		{
			return 0;
		}
		int attack = ((Card)target).Info.Attack;
		int health = target.Health;
		int num = ((target.OpponentCard != ((AbilityBehaviour)this).Card.OpponentCard) ? Mathf.Min(attack, health) : Mathf.Max(attack, health));
		return num - attack;
	}
}
[BepInPlugin("OLD_SA.Balance", "OLD SA Balance", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		BalanceAPI.Init();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"OLD SA Balance loaded.");
	}
}

Sigil/OldSa_Blessing.dll

Decompiled 5 days 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_Blitz_sigil.dll

Decompiled 5 days 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_Blitz_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Blitz_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("55aa65b6-2f8c-4363-8dce-5d1ef76ae984")]
[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.Blitz;

public static class BlitzAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Blitz";
		val.rulebookName = "Blitz";
		val.metaCategories = new List<AbilityMetaCategory>
		{
			(AbilityMetaCategory)0,
			(AbilityMetaCategory)1
		};
		val.powerLevel = 4;
		val.opponentUsable = true;
		val.canStack = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OLD_SA_Blitz.png", (FilterMode)0);
		FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(val, "When [creature] is about to be attacked, it counterattacks once and moves.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(BlitzBehaviour), imageAsTexture);
		if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
		{
			ProgressionData.Data.learnedAbilities.Add(ability.Id);
		}
	}
}
public class BlitzBehaviour : AbilityBehaviour
{
	public override Ability Ability => BlitzAPI.ability.Id;

	public override bool RespondsToSlotTargetedForAttack(CardSlot slot, PlayableCard attacker)
	{
		if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead || (Object)(object)((AbilityBehaviour)this).Card.Slot == (Object)null || (Object)(object)attacker == (Object)null)
		{
			return false;
		}
		if ((Object)(object)slot != (Object)(object)((AbilityBehaviour)this).Card.Slot)
		{
			return false;
		}
		if (attacker.CanAttackDirectly(slot))
		{
			return false;
		}
		BoardManager instance = Singleton<BoardManager>.Instance;
		if ((Object)(object)instance == (Object)null)
		{
			return false;
		}
		CardSlot adjacent = instance.GetAdjacent(((AbilityBehaviour)this).Card.Slot, true);
		CardSlot adjacent2 = instance.GetAdjacent(((AbilityBehaviour)this).Card.Slot, false);
		return ((Object)(object)adjacent2 != (Object)null && (Object)(object)adjacent2.Card == (Object)null) || ((Object)(object)adjacent != (Object)null && (Object)(object)adjacent.Card == (Object)null);
	}

	public override IEnumerator OnSlotTargetedForAttack(CardSlot slot, PlayableCard attacker)
	{
		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 || (Object)(object)slot != (Object)(object)((AbilityBehaviour)this).Card.Slot)
		{
			yield break;
		}
		BoardManager board = Singleton<BoardManager>.Instance;
		if ((Object)(object)board == (Object)null)
		{
			yield break;
		}
		CardSlot left = board.GetAdjacent(((AbilityBehaviour)this).Card.Slot, true);
		CardSlot right = board.GetAdjacent(((AbilityBehaviour)this).Card.Slot, false);
		CardSlot target = null;
		if ((Object)(object)right != (Object)null && (Object)(object)right.Card == (Object)null)
		{
			target = right;
		}
		else if ((Object)(object)left != (Object)null && (Object)(object)left.Card == (Object)null)
		{
			target = left;
		}
		if (!((Object)(object)target == (Object)null))
		{
			CardSlot opposingSlot = ((AbilityBehaviour)this).Card.Slot.opposingSlot;
			if ((Object)(object)opposingSlot != (Object)null && (Object)(object)opposingSlot.Card != (Object)null)
			{
				yield return opposingSlot.Card.TakeDamage(1, ((AbilityBehaviour)this).Card);
			}
			if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && !((AbilityBehaviour)this).Card.Dead && !((Object)(object)((AbilityBehaviour)this).Card.Slot == (Object)null) && !((Object)(object)target.Card != (Object)null))
			{
				yield return board.AssignCardToSlot(((AbilityBehaviour)this).Card, target, 0.1f, (Action)null, true);
				((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
				yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
			}
		}
	}
}
[BepInPlugin("OLD_SA.Blitz", "OLD SA Blitz", "1.0.0")]
public class BlitzPlugin : 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
		BlitzAPI.Init();
		Harmony val = new Harmony("OLD_SA.Blitz");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"OLD SA Blitz loaded");
	}
}

Sigil/OldSa_Blood Strike_sigil.dll

Decompiled 5 days 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.Combat;
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()
	{
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		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, it gains 1 attack.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(BloodStrikeBehaviour), imageAsTexture);
		if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
		{
			ProgressionData.Data.learnedAbilities.Add(ability.Id);
		}
	}
}
public class BloodStrikeBehaviour : ExtendedAbilityBehaviour
{
	public static Ability ability;

	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.Dead || !((AbilityBehaviour)this).Card.OnBoard)
		{
			return false;
		}
		if ((Object)(object)card == (Object)null)
		{
			return false;
		}
		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)
		{
			ExtraAttackState.AddStored(((AbilityBehaviour)this).Card, 1);
		}
	}
}
[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 5 days 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.BloodRecompense;
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
{
	[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.");
			BloodRecompenseAPI.Init();
			BloodRecompenseRegistry.Init();
			Log.LogInfo((object)"Blood Recompense ability initialized.");
		}
	}
}
namespace OLD_SA.BloodRecompense
{
	public static class BloodRecompenseAPI
	{
		public static FullAbility ability;

		public static void Init()
		{
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Blood Recompense";
			val.rulebookName = "Blood Recompense";
			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_Blood_Recompense.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 card is created.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(BloodRecompenseBehaviour), imageAsTexture);
			if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
			{
				ProgressionData.Data.learnedAbilities.Add(ability.Id);
			}
		}
	}
	public static class BloodRecompenseRegistry
	{
		private class SpawnEntry
		{
			public string[] SpawnNames;

			public float[] Probabilities;

			public SpawnEntry(string[] spawnNames, float[] probabilities)
			{
				SpawnNames = spawnNames;
				Probabilities = probabilities;
			}
		}

		private static readonly Dictionary<string, SpawnEntry> SpawnTable = new Dictionary<string, SpawnEntry>();

		public static void Init()
		{
			Register("Wolf", "WolfCub");
			Register("AntQueen", "Ant", "AntFlying");
			Register("Beehive", "Bee");
			Register("Cockroach", "Cockroach");
			Register("Elk", "ElkCub");
			Register("FieldMouse", "FieldMouse");
			Register("MantisGod", "Mantis");
			Register("MoldMan", "Mold");
			Register("Moose", "ElkCub");
			Register("Mothman_Stage3", "Mothman_Stage1");
			Register("Raven", "RavenEgg");
			Register("Smoke_Improved", "Smoke");
			Register("Snelk", "Snelk_Neck");
			Register("SquidBell", "DausBell");
			Register("Warren", "Rabbit");
			Register("DireWolf", "DireWolfCub");
			Register("RedHart", "ElkCub");
			Register("Bullfrog", "Tadpole");
			Register("Hydra", "HydraEgg");
			Register("Alpha", "WolfCub");
			Register("CagedWolf", "WolfCub");
			Register("Daus", "DausBell");
			Register("Pronghorn", "ElkCub");
			Register("PackRat", "OLD_SA_CONSUMABLE_SQUIRREL");
			Register("SquirrelBall", "Squirrel");
			Register("Kraken", "SquidBell", "SquidCards", "SquidMirror");
			Register("Angler_Talking", "Angler_Fish_More", "Angler_Fish_Dood", "Angler_Fish_Bad");
			Register("CatUndead", "Cat");
			Register("DeadPets", "Goat");
			Register("FieldMouse_Fused", "FieldMouse_Fused");
			Register("Amalgam", "Wolf", "Elk", "Raven", "AntQueen", "Adder");
			Register("Cuckoo", "RavenEgg");
		}

		public static void Register(string cardName, params string[] spawnNames)
		{
			if (!string.IsNullOrEmpty(cardName) && spawnNames != null && spawnNames.Length != 0)
			{
				float[] array = new float[spawnNames.Length];
				float num = 1f / (float)spawnNames.Length;
				for (int i = 0; i < array.Length; i++)
				{
					array[i] = num;
				}
				SpawnTable[cardName] = new SpawnEntry((string[])spawnNames.Clone(), array);
			}
		}

		public static void Register(string cardName, string[] spawnNames, params float[] probabilities)
		{
			if (string.IsNullOrEmpty(cardName) || spawnNames == null || spawnNames.Length == 0 || probabilities == null || probabilities.Length != spawnNames.Length)
			{
				return;
			}
			float num = 0f;
			for (int i = 0; i < probabilities.Length; i++)
			{
				if (probabilities[i] < 0f || float.IsNaN(probabilities[i]) || float.IsInfinity(probabilities[i]))
				{
					return;
				}
				num += probabilities[i];
			}
			if (!(num <= 0f) && !float.IsNaN(num) && !float.IsInfinity(num))
			{
				float[] array = new float[probabilities.Length];
				for (int j = 0; j < probabilities.Length; j++)
				{
					array[j] = probabilities[j] / num;
				}
				SpawnTable[cardName] = new SpawnEntry((string[])spawnNames.Clone(), array);
			}
		}

		public static CardInfo GetSpawn(CardInfo source, int seed)
		{
			if ((Object)(object)source == (Object)null)
			{
				return null;
			}
			if (!SpawnTable.TryGetValue(((Object)source).name, out var value))
			{
				return null;
			}
			if (value.SpawnNames == null || value.SpawnNames.Length == 0)
			{
				return null;
			}
			int num = 0;
			if (value.SpawnNames.Length > 1)
			{
				int num2 = SeededRandom.Range(0, 10000, seed);
				float num3 = (float)num2 / 10000f;
				float num4 = 0f;
				for (int i = 0; i < value.Probabilities.Length; i++)
				{
					num4 += value.Probabilities[i];
					if (num3 < num4)
					{
						num = i;
						break;
					}
				}
				if (num3 >= num4)
				{
					num = value.SpawnNames.Length - 1;
				}
			}
			return CardLoader.GetCardByName(value.SpawnNames[num]);
		}
	}
	public class BloodRecompenseBehaviour : AbilityBehaviour
	{
		public override Ability Ability => BloodRecompenseAPI.ability.Id;

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

		private static int GetBloodRecompenseSeed()
		{
			SaveFile saveFile = SaveManager.SaveFile;
			if (saveFile == null)
			{
				return 0;
			}
			int currentRandomSeed = saveFile.GetCurrentRandomSeed();
			FieldInfo fieldInfo = AccessTools.Field(typeof(SaveFile), "randomSeed");
			if (fieldInfo != null)
			{
				int num = (int)fieldInfo.GetValue(saveFile);
				fieldInfo.SetValue(saveFile, num + 1);
			}
			else
			{
				Debug.LogError((object)"[BloodRecompense] 找不到 SaveFile.randomSeed,无法推进随机种子。");
			}
			return currentRandomSeed;
		}

		public override IEnumerator OnOtherCardDie(PlayableCard deadCard, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
		{
			yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
			if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || (Object)(object)deadCard == (Object)null)
			{
				yield break;
			}
			string spawnName = CardExtensions.GetExtendedProperty(((Card)((AbilityBehaviour)this).Card).Info, "OLD_SA.BloodRecompenseInfo");
			CardInfo spawn = null;
			if (!string.IsNullOrEmpty(spawnName))
			{
				spawn = CardLoader.GetCardByName(spawnName);
			}
			if ((Object)(object)spawn == (Object)null)
			{
				spawn = BloodRecompenseRegistry.GetSpawn(seed: GetBloodRecompenseSeed(), source: ((Card)((AbilityBehaviour)this).Card).Info);
			}
			if ((Object)(object)spawn == (Object)null)
			{
				spawn = CardLoader.GetCardByName("Skeleton");
			}
			if ((Object)(object)spawn == (Object)null)
			{
				yield break;
			}
			object obj = spawn.Clone();
			spawn = (CardInfo)((obj is CardInfo) ? obj : null);
			if ((Object)(object)spawn == (Object)null)
			{
				yield break;
			}
			CopyAbilities(spawn);
			if (!((AbilityBehaviour)this).Card.OpponentCard)
			{
				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);
				}
				PlayableCard playerCard = CardSpawner.SpawnPlayableCard(spawn);
				if (!((Object)(object)playerCard == (Object)null))
				{
					yield return Singleton<PlayerHand>.Instance.AddCardToHand(playerCard, Vector3.zero, 0.25f);
				}
			}
			else
			{
				yield return SpawnEnemyCard(spawn);
				yield return ((AbilityBehaviour)this).LearnAbility(0.5f);
			}
		}

		private IEnumerator SpawnEnemyCard(CardInfo spawn)
		{
			Opponent opponent = Singleton<TurnManager>.Instance.Opponent;
			if ((Object)(object)opponent == (Object)null)
			{
				yield break;
			}
			CardSlot freeSlot = FindFreeQueueSlot(opponent);
			if ((Object)(object)freeSlot != (Object)null)
			{
				yield return opponent.QueueCard(spawn, freeSlot, true, true, true);
				yield break;
			}
			PlayableCard same = FindSameQueuedCard(opponent, ((Object)spawn).name);
			if (!((Object)(object)same == (Object)null))
			{
				PlayableCard temp = CardSpawner.SpawnPlayableCard(spawn);
				if (!((Object)(object)temp == (Object)null))
				{
					MergeCardStats(same, temp);
					Object.Destroy((Object)(object)((Component)temp).gameObject);
				}
			}
		}

		private CardSlot FindFreeQueueSlot(Opponent opponent)
		{
			foreach (CardSlot slot in Singleton<BoardManager>.Instance.OpponentSlotsCopy)
			{
				if (!opponent.Queue.Exists((PlayableCard x) => (Object)(object)x != (Object)null && (Object)(object)x.QueuedSlot == (Object)(object)slot))
				{
					return slot;
				}
			}
			return null;
		}

		private PlayableCard FindSameQueuedCard(Opponent opponent, string name)
		{
			List<PlayableCard> list = new List<PlayableCard>();
			foreach (PlayableCard item in opponent.Queue)
			{
				if (!((Object)(object)item == (Object)null) && ((Object)((Card)item).Info).name == name)
				{
					list.Add(item);
				}
			}
			if (list.Count == 0)
			{
				return null;
			}
			return list[Random.Range(0, list.Count)];
		}

		private void MergeCardStats(PlayableCard target, PlayableCard source)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)target == (Object)null || (Object)(object)source == (Object)null)
			{
				return;
			}
			CardModificationInfo val = new CardModificationInfo();
			val.fromCardMerge = true;
			val.abilities = new List<Ability>();
			val.attackAdjustment = source.Attack;
			val.healthAdjustment = source.Health;
			if (((Card)source).Info.Abilities != null)
			{
				foreach (Ability ability in ((Card)source).Info.Abilities)
				{
					if ((int)ability != 0 && !target.HasAbility(ability) && !val.abilities.Contains(ability))
					{
						val.abilities.Add(ability);
					}
				}
			}
			if (((Card)source).Info.Mods != null)
			{
				foreach (CardModificationInfo mod in ((Card)source).Info.Mods)
				{
					if (mod == null || mod.abilities == null)
					{
						continue;
					}
					foreach (Ability ability2 in mod.abilities)
					{
						if ((int)ability2 != 0 && !target.HasAbility(ability2) && !val.abilities.Contains(ability2))
						{
							val.abilities.Add(ability2);
						}
					}
				}
			}
			if (val.attackAdjustment != 0 || val.healthAdjustment != 0 || val.abilities.Count != 0)
			{
				target.AddTemporaryMod(val);
				target.OnStatsChanged();
				((Card)target).RenderCard();
			}
		}

		private void CopyAbilities(CardInfo spawn)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0034: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			CardModificationInfo val = new CardModificationInfo();
			val.fromCardMerge = true;
			val.abilities = new List<Ability>();
			foreach (Ability ability in ((Card)((AbilityBehaviour)this).Card).Info.Abilities)
			{
				if (ability != ((AbilityBehaviour)this).Ability && !val.abilities.Contains(ability))
				{
					val.abilities.Add(ability);
				}
			}
			if (((AbilityBehaviour)this).Card.TemporaryMods != null)
			{
				foreach (CardModificationInfo temporaryMod in ((AbilityBehaviour)this).Card.TemporaryMods)
				{
					if (temporaryMod == null || temporaryMod.abilities == null)
					{
						continue;
					}
					foreach (Ability ability2 in temporaryMod.abilities)
					{
						if (!val.abilities.Contains(ability2))
						{
							val.abilities.Add(ability2);
						}
					}
				}
			}
			if (val.abilities.Count != 0)
			{
				spawn.Mods.Add(val);
			}
		}
	}
}

Sigil/OldSa_Blood_Acolyte_sigil.dll

Decompiled 5 days 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 OLD_SA.BloodAcolyte;
using OLD_SA.CardTraits;
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_Acolyte_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Blood_Acolyte_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3a2a00f5-aca6-402b-bfa7-101c15c24f4a")]
[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_Blood_Acolyte_sigil
{
	[BepInPlugin("OLD_SA.Blood_Acolyte", "OLD SA Blood Acolyte", "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 Blood Acolyte] Loading...");
			BloodAcolyteAPI.Init();
			Harmony val = new Harmony("OLD_SA.Blood_Acolyte");
			val.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"[OLD SA Blood Acolyte] Loaded!");
		}
	}
}
namespace OLD_SA.BloodAcolyte
{
	public static class BloodAcolyteAPI
	{
		public static FullAbility ability;

		public static void Init()
		{
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Blood Acolyte";
			val.rulebookName = "Blood Acolyte";
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.powerLevel = 5;
			val.opponentUsable = false;
			val.canStack = false;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OLD_SA_Blood_Acolyte.png", (FilterMode)0);
			FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(val, "[creature] grows stronger with each sacrifice.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(BloodAcolyteBehaviour), imageAsTexture);
		}
	}
	public class BloodAcolyteBehaviour : AbilityBehaviour
	{
		public override Ability Ability => BloodAcolyteAPI.ability.Id;
	}
	[HarmonyPatch(typeof(PlayableCard), "Sacrifice")]
	public static class BloodAcolyteSacrificeTriggerPatch
	{
		public static void Prefix(PlayableCard __instance)
		{
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Expected O, but got Unknown
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Expected O, but got Unknown
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Expected O, but got Unknown
			if ((Object)(object)__instance == (Object)null || (Object)(object)Singleton<BoardManager>.Instance == (Object)null)
			{
				return;
			}
			PlayableCard currentSacrificeDemandingCard = Singleton<BoardManager>.Instance.CurrentSacrificeDemandingCard;
			if ((Object)(object)currentSacrificeDemandingCard == (Object)null)
			{
				return;
			}
			bool flag = OLD_SA_TraitAPI.HasOldSaTrait(currentSacrificeDemandingCard, "OLD_SA_BLOOD_DEVOURER");
			BoardManager instance = Singleton<BoardManager>.Instance;
			List<PlayableCard> list = new List<PlayableCard>();
			foreach (CardSlot allSlot in instance.AllSlots)
			{
				if ((Object)(object)allSlot.Card != (Object)null)
				{
					list.Add(allSlot.Card);
				}
			}
			if ((Object)(object)Singleton<PlayerHand>.Instance != (Object)null)
			{
				foreach (PlayableCard item in Singleton<PlayerHand>.Instance.CardsInHand)
				{
					if ((Object)(object)item != (Object)null)
					{
						list.Add(item);
					}
				}
			}
			foreach (PlayableCard item2 in list)
			{
				if ((Object)(object)((Card)item2).Info == (Object)null || !((Card)item2).Info.Abilities.Contains(BloodAcolyteAPI.ability.Id))
				{
					continue;
				}
				CardModificationInfo val = new CardModificationInfo();
				val.attackAdjustment = 1;
				CardModificationInfo val2 = new CardModificationInfo();
				if (CardExtensions.BloodCost(item2) > 0)
				{
					val2.bloodCostAdjustment = -1;
				}
				if (flag)
				{
					if (((Card)item2).Info.Mods == null)
					{
						((Card)item2).Info.Mods = new List<CardModificationInfo>();
					}
					((Card)item2).Info.Mods.Add(val);
					item2.AddTemporaryMod(val2);
					continue;
				}
				CardModificationInfo val3 = new CardModificationInfo();
				val3.attackAdjustment = 1;
				if (CardExtensions.BloodCost(item2) > 0)
				{
					val3.bloodCostAdjustment = -1;
				}
				item2.AddTemporaryMod(val3);
			}
		}
	}
}

Sigil/OldSa_Bloody_Gear_sigil.dll

Decompiled 5 days 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_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()
	{
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		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);
		if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
		{
			ProgressionData.Data.learnedAbilities.Add(ability.Id);
		}
	}
}
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;
		}
		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) && !BloodyGearDamageManager.RegisterDealDamage(target, ((AbilityBehaviour)this).Card, amount))
		{
			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) || (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 || (Object)(object)card == (Object)null || (!BloodTargets.Contains(card) && (Object)(object)killer != (Object)(object)((AbilityBehaviour)this).Card))
		{
			yield break;
		}
		int finalDamageCount = BloodyGearDamageManager.GetDamageCount(card);
		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 (finalDamageCount <= 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 = finalDamageCount - clone.Attack;
		statMod.healthAdjustment = finalDamageCount - clone.Health;
		clone.Mods.Add(statMod);
		if (inheritedTribes != null)
		{
			clone.tribes = new List<Tribe>(inheritedTribes);
		}
		List<Ability> inheritedAbilities = new List<Ability>();
		if ((Object)(object)((Card)card).Info != (Object)null && ((Card)card).Info.Abilities != null)
		{
			foreach (Ability ability in ((Card)card).Info.Abilities)
			{
				AddInheritedAbility(inheritedAbilities, ability);
			}
		}
		if ((Object)(object)((Card)card).Info != (Object)null && ((Card)card).Info.Mods != null)
		{
			foreach (CardModificationInfo mod in ((Card)card).Info.Mods)
			{
				if (mod == null || mod.abilities == null)
				{
					continue;
				}
				foreach (Ability ability2 in mod.abilities)
				{
					AddInheritedAbility(inheritedAbilities, ability2);
				}
			}
		}
		FieldInfo temporaryModsField = AccessTools.Field(typeof(PlayableCard), "temporaryMods");
		if (temporaryModsField != null && temporaryModsField.GetValue(card) is List<CardModificationInfo> temporaryMods)
		{
			foreach (CardModificationInfo mod2 in temporaryMods)
			{
				if (mod2 == null || mod2.abilities == null)
				{
					continue;
				}
				foreach (Ability ability3 in mod2.abilities)
				{
					AddInheritedAbility(inheritedAbilities, ability3);
				}
			}
		}
		if (inheritedAbilities.Count > 0)
		{
			CardModificationInfo abilityMod = new CardModificationInfo();
			foreach (Ability ability4 in inheritedAbilities)
			{
				abilityMod.abilities.Add(ability4);
			}
			clone.Mods.Add(abilityMod);
		}
		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);
		yield return (object)new WaitForSeconds(0.2f);
		if ((int)Singleton<ViewManager>.Instance.CurrentView == 0)
		{
			Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
		}
	}

	private static void AddInheritedAbility(List<Ability> abilities, Ability ability)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		if ((int)ability != 0 && !abilities.Contains(ability))
		{
			abilities.Add(ability);
		}
	}
}
public sealed class BloodyGearDamageContext
{
	public PlayableCard Target;

	public PlayableCard Attacker;

	public int Amount;

	public bool Counted;

	public bool Lethal;
}
internal static class BloodyGearDamageManager
{
	private class SharedDamageData
	{
		public int DamageCount;
	}

	private static readonly ConditionalWeakTable<PlayableCard, SharedDamageData> SharedDamageCounts = new ConditionalWeakTable<PlayableCard, SharedDamageData>();

	private static readonly Dictionary<PlayableCard, List<BloodyGearDamageContext>> ActiveContexts = new Dictionary<PlayableCard, List<BloodyGearDamageContext>>();

	public static BloodyGearDamageContext BeginDamage(PlayableCard target, PlayableCard attacker, int amount)
	{
		if ((Object)(object)target == (Object)null)
		{
			return null;
		}
		BloodyGearDamageContext bloodyGearDamageContext = new BloodyGearDamageContext
		{
			Target = target,
			Attacker = attacker,
			Amount = amount
		};
		if (!ActiveContexts.TryGetValue(target, out var value))
		{
			value = new List<BloodyGearDamageContext>();
			ActiveContexts.Add(target, value);
		}
		value.Add(bloodyGearDamageContext);
		return bloodyGearDamageContext;
	}

	private static BloodyGearDamageContext FindContext(PlayableCard target, PlayableCard attacker)
	{
		if ((Object)(object)target == (Object)null)
		{
			return null;
		}
		if (!ActiveContexts.TryGetValue(target, out var value))
		{
			return null;
		}
		for (int num = value.Count - 1; num >= 0; num--)
		{
			BloodyGearDamageContext bloodyGearDamageContext = value[num];
			if (bloodyGearDamageContext != null && (Object)(object)bloodyGearDamageContext.Attacker == (Object)(object)attacker)
			{
				return bloodyGearDamageContext;
			}
		}
		return null;
	}

	public static void RegisterLethalDamage(PlayableCard target, PlayableCard attacker)
	{
		BloodyGearDamageContext bloodyGearDamageContext = FindContext(target, attacker);
		if (bloodyGearDamageContext != null && !bloodyGearDamageContext.Counted)
		{
			SharedDamageData value = SharedDamageCounts.GetValue(target, (PlayableCard _) => new SharedDamageData());
			value.DamageCount++;
			bloodyGearDamageContext.Counted = true;
			bloodyGearDamageContext.Lethal = true;
		}
	}

	public static bool RegisterDealDamage(PlayableCard target, PlayableCard attacker, int amount)
	{
		if ((Object)(object)target == (Object)null || amount <= 0)
		{
			return false;
		}
		BloodyGearDamageContext bloodyGearDamageContext = FindContext(target, attacker);
		if (bloodyGearDamageContext != null && bloodyGearDamageContext.Counted)
		{
			return bloodyGearDamageContext.Lethal;
		}
		SharedDamageData value = SharedDamageCounts.GetValue(target, (PlayableCard _) => new SharedDamageData());
		value.DamageCount++;
		if (bloodyGearDamageContext != null)
		{
			bloodyGearDamageContext.Counted = true;
		}
		return false;
	}

	public static int GetDamageCount(PlayableCard target)
	{
		if ((Object)(object)target == (Object)null)
		{
			return 0;
		}
		if (SharedDamageCounts.TryGetValue(target, out var value))
		{
			return value.DamageCount;
		}
		return 0;
	}

	public static void EndDamage(BloodyGearDamageContext context)
	{
		if (context != null && !((Object)(object)context.Target == (Object)null) && ActiveContexts.TryGetValue(context.Target, out var value))
		{
			value.Remove(context);
			if (value.Count == 0)
			{
				ActiveContexts.Remove(context.Target);
			}
		}
	}
}
[HarmonyPatch(typeof(PlayableCard), "TakeDamage", new Type[]
{
	typeof(int),
	typeof(PlayableCard)
})]
public static class BloodyGearTakeDamagePatch
{
	[HarmonyPrefix]
	public static void Prefix(PlayableCard __instance, int damage, PlayableCard attacker, out BloodyGearDamageContext __state)
	{
		__state = BloodyGearDamageManager.BeginDamage(__instance, attacker, damage);
	}

	[HarmonyPostfix]
	public static void Postfix(ref IEnumerator __result, BloodyGearDamageContext __state)
	{
		if (__result != null && __state != null)
		{
			__result = TrackDamage(__result, __state);
		}
	}

	private static IEnumerator TrackDamage(IEnumerator original, BloodyGearDamageContext context)
	{
		try
		{
			while (original.MoveNext())
			{
				yield return original.Current;
			}
		}
		finally
		{
			if (original is IDisposable disposable)
			{
				disposable.Dispose();
			}
			BloodyGearDamageManager.EndDamage(context);
		}
	}
}
[HarmonyPatch(typeof(PlayableCard), "Die", new Type[]
{
	typeof(bool),
	typeof(PlayableCard),
	typeof(bool)
})]
public static class BloodyGearDiePatch
{
	[HarmonyPrefix]
	public static void Prefix(PlayableCard __instance, bool wasSacrifice, PlayableCard killer)
	{
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		if (!wasSacrifice && !((Object)(object)__instance == (Object)null) && !((Object)(object)killer == (Object)null) && killer.HasAbility(BloodyGearAPI.ability.Id))
		{
			BloodyGearDamageManager.RegisterLethalDamage(__instance, killer);
		}
	}
}
[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 5 days 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;

[HarmonyPatch(typeof(PlayableCard), "Die")]
public static class BoneDevourerRemovePatch
{
	[HarmonyPrefix]
	private static void Prefix(PlayableCard __instance)
	{
		if (!((Object)(object)__instance == (Object)null))
		{
			BoneDevourerBehaviour component = ((Component)__instance).GetComponent<BoneDevourerBehaviour>();
			if ((Object)(object)component != (Object)null)
			{
				component.RemoveDevourer();
			}
		}
	}
}
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 3 bones devoured, [creature] gains 1 Power and 1 Health.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(BoneDevourerBehaviour), imageAsTexture);
	}
}
public class BoneDevourerBehaviour : AbilityBehaviour
{
	public static List<BoneDevourerBehaviour> ActiveDevourers = new List<BoneDevourerBehaviour>();

	private int bonesDevoured;

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

	private void Awake()
	{
		RegisterDevourer();
	}

	public void RegisterDevourer()
	{
		if (!ActiveDevourers.Contains(this))
		{
			ActiveDevourers.Add(this);
		}
	}

	public void RemoveDevourer()
	{
		ActiveDevourers.Remove(this);
	}

	private void OnDestroy()
	{
		RemoveDevourer();
	}

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

	public bool IsActive()
	{
		return (Object)(object)((AbilityBehaviour)this).Card != (Object)null && !((AbilityBehaviour)this).Card.Dead && ((AbilityBehaviour)this).Card.OnBoard;
	}

	public IEnumerator DevourBone()
	{
		bonesDevoured++;
		if (bonesDevoured % 3 == 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).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);
				ResourcesManager resources = Singleton<ResourcesManager>.Instance;
				if ((Object)(object)resources != (Object)null)
				{
					try
					{
						BoneDevourerState.SilentSpend = true;
						yield return resources.SpendBones(1);
					}
					finally
					{
						BoneDevourerState.SilentSpend = false;
					}
				}
				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()
	{
		foreach (BoneDevourerBehaviour activeDevourer in BoneDevourerBehaviour.ActiveDevourers)
		{
			if ((Object)(object)activeDevourer == (Object)null || !activeDevourer.IsActive())
			{
				continue;
			}
			return activeDevourer;
		}
		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);
		}
	}
}
[HarmonyPatch(typeof(Part1ResourcesManager), "ShowSpendBones")]
public static class BoneDevourerSpendBonesViewPatch
{
	public static bool Prefix(Part1ResourcesManager __instance, int amount, ref IEnumerator __result)
	{
		if (!BoneDevourerState.SilentSpend)
		{
			return true;
		}
		__result = SilentRemoveBones(__instance, amount);
		return false;
	}

	private static IEnumerator SilentRemoveBones(Part1ResourcesManager manager, int amount)
	{
		MethodInfo method = AccessTools.Method(typeof(Part1ResourcesManager), "RemoveBones", (Type[])null, (Type[])null);
		if (method != null && method.Invoke(manager, new object[1] { amount }) is IEnumerator routine)
		{
			while (routine.MoveNext())
			{
				yield return routine.Current;
			}
		}
	}
}
public static class BoneDevourerState
{
	public static bool SilentSpend;
}
[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_Bone_Strike_sigil.dll

Decompiled 5 days 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.Combat;
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_Strike_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Bone_Strike_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("6c22bce7-2107-42e9-b3ee-7adaa47a7aa8")]
[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.BoneStrike;

public static class BoneStrikeAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Bone Strike";
		val.rulebookName = "Bone 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_Bone_Strike.png", (FilterMode)0);
		FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(val, "When [creature] attacks, spend 1 Bone. For every 2 Bones spent, attack an additional time.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(BoneStrikeBehaviour), imageAsTexture);
		if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
		{
			ProgressionData.Data.learnedAbilities.Add(ability.Id);
		}
	}
}
public class BoneStrikeBehaviour : ExtendedAbilityBehaviour
{
	public static Ability ability;

	private int bonesSpent = 0;

	public override Ability Ability => ability;

	public IEnumerator OnAttack()
	{
		if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead)
		{
			yield break;
		}
		ResourcesManager resources = Singleton<ResourcesManager>.Instance;
		if ((Object)(object)resources == (Object)null)
		{
			yield break;
		}
		int before = resources.PlayerBones;
		if (before <= 0)
		{
			Debug.Log((object)"[BoneStrike] No bones");
			yield break;
		}
		bool spent = false;
		try
		{
			BoneStrikeState.SilentSpend = true;
			yield return resources.SpendBones(1);
			int after = resources.PlayerBones;
			Debug.Log((object)("[BoneStrike] before=" + before + " after=" + after));
			if (after < before)
			{
				spent = true;
			}
		}
		finally
		{
			BoneStrikeState.SilentSpend = false;
		}
		if (!spent)
		{
			Debug.Log((object)"[BoneStrike] Spend failed");
			yield break;
		}
		bonesSpent++;
		Debug.Log((object)("[BoneStrike] spent count=" + bonesSpent));
		if (bonesSpent % 2 == 0)
		{
			ExtraAttackState.AddStored(((AbilityBehaviour)this).Card, 1);
			Debug.Log((object)"[BoneStrike] Attack +1");
		}
	}
}
[HarmonyPatch(typeof(Part1ResourcesManager), "ShowSpendBones")]
public static class BoneStrikeSpendBonesViewPatch
{
	public static bool Prefix(Part1ResourcesManager __instance, int amount, ref IEnumerator __result)
	{
		if (!BoneStrikeState.SilentSpend)
		{
			return true;
		}
		__result = SilentRemoveBones(__instance, amount);
		return false;
	}

	private static IEnumerator SilentRemoveBones(Part1ResourcesManager manager, int amount)
	{
		MethodInfo method = AccessTools.Method(typeof(Part1ResourcesManager), "RemoveBones", (Type[])null, (Type[])null);
		if (method != null)
		{
			IEnumerator routine = method.Invoke(manager, new object[1] { amount }) as IEnumerator;
			while (routine.MoveNext())
			{
				yield return routine.Current;
			}
		}
	}
}
[HarmonyPatch(typeof(CombatPhaseManager), "SlotAttackSlot")]
public static class BoneStrikeAttackPatch
{
	public static IEnumerator Postfix(IEnumerator result, CardSlot attackingSlot)
	{
		while (result.MoveNext())
		{
			yield return result.Current;
		}
		if (!((Object)(object)attackingSlot == (Object)null) && !((Object)(object)attackingSlot.Card == (Object)null))
		{
			BoneStrikeBehaviour behaviour = ((Component)attackingSlot.Card).GetComponent<BoneStrikeBehaviour>();
			if (!((Object)(object)behaviour == (Object)null))
			{
				yield return behaviour.OnAttack();
			}
		}
	}
}
public static class BoneStrikeState
{
	public static bool SilentSpend;
}
[BepInPlugin("OLD_SA.BoneStrike", "OLD SA Bone Strike", "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
		BoneStrikeAPI.Init();
		Harmony val = new Harmony("OLD_SA.BoneStrike");
		val.PatchAll();
	}
}

Sigil/OldSa_Bones_Armored_sigil.dll

Decompiled 5 days 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 5 days 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 OnSacrifice(PlayableCard sacrificedCard)
	{
		Debug.Log((object)("[OLD SA Bones] OnSacrifice ENTER " + ((Object)((Card)((AbilityBehaviour)this).Card).Info).name));
		if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && !((Object)(object)sacrificedCard == (Object)null))
		{
			yield return Singleton<ResourcesManager>.Instance.AddBones(3, sacrificedCard.Slot);
			Debug.Log((object)"[OLD SA Bones] Added bones");
			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))
		{
			BonesFeastBehaviour component = ((Component)currentSacrificeDemandingCard).GetComponent<BonesFeastBehaviour>();
			if (!((Object)(object)component == (Object)null))
			{
				((MonoBehaviour)currentSacrificeDemandingCard).StartCoroutine(component.OnSacrifice(__instance));
			}
		}
	}
}
[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 5 days 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_Coiled_sigil.dll

Decompiled 5 days 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 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_Coiled_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Coiled_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8812912a-6c71-42a8-a276-53aed62c0498")]
[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.Coiled;

public static class CoiledAPI
{
	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)
		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Coiled";
		val.rulebookName = "Coiled";
		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_Coiled.png", (FilterMode)0);
		Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("OldSa_Coiled_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 deals damage, [creature] gains 1 Power until the end of the turn.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(CoiledBehaviour), imageAsTexture);
		if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
		{
			ProgressionData.Data.learnedAbilities.Add(ability.Id);
		}
	}
}
public class CoiledBehaviour : ExtendedAbilityBehaviour
{
	public static List<CoiledBehaviour> ActiveCoiled = new List<CoiledBehaviour>();

	private int coiledStacks = 0;

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

	private void Awake()
	{
		RegisterCoiled();
	}

	private void RegisterCoiled()
	{
		if (!ActiveCoiled.Contains(this))
		{
			ActiveCoiled.Add(this);
		}
	}

	private void RemoveCoiled()
	{
		ActiveCoiled.Remove(this);
	}

	private void OnDestroy()
	{
		RemoveCoiled();
	}

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

	public override int GetPassiveAttackBuff(PlayableCard target)
	{
		if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead || !((AbilityBehaviour)this).Card.OnBoard)
		{
			return 0;
		}
		if ((Object)(object)target != (Object)(object)((AbilityBehaviour)this).Card)
		{
			return 0;
		}
		return coiledStacks;
	}

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

	public override IEnumerator OnOtherCardDealtDamage(PlayableCard attacker, int amount, PlayableCard target)
	{
		if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && !((AbilityBehaviour)this).Card.Dead && ((AbilityBehaviour)this).Card.OnBoard)
		{
			yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
			coiledStacks++;
			yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
		}
	}

	public IEnumerator OnWaterborneOtherCardDealtDamage(PlayableCard attacker, int amount, PlayableCard target)
	{
		if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && !((AbilityBehaviour)this).Card.Dead && !((Object)(object)attacker == (Object)null) && !attacker.Dead && !((Object)(object)attacker == (Object)(object)((AbilityBehaviour)this).Card) && attacker.OpponentCard == ((AbilityBehaviour)this).Card.OpponentCard && amount > 0)
		{
			yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
			coiledStacks++;
			yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
		}
	}

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

	public override IEnumerator OnTurnEnd(bool playerTurnEnd)
	{
		coiledStacks = 0;
		yield break;
	}
}
[BepInPlugin("OLD_SA.Coiled", "OLD SA Coiled", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		CoiledAPI.Init();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"OLD SA Coiled loaded.");
	}
}

Sigil/OldSa_Collect_Bones_sigil.dll

Decompiled 5 days 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)
		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: 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 = false;
		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);
		if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
		{
			ProgressionData.Data.learnedAbilities.Add(ability.Id);
		}
	}
}
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 5 days 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 5 days 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 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_00f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: 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);
		if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
		{
			ProgressionData.Data.learnedAbilities.Add(ability.Id);
		}
	}
}
public class CunningBehaviour : ExtendedAbilityBehaviour
{
	public static Ability ability;

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

	public override int GetPassiveAttackBuff(PlayableCard target)
	{
		if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null)
		{
			return 0;
		}
		if (((AbilityBehaviour)this).Card.Dead || !((AbilityBehaviour)this).Card.OnBoard)
		{
			return 0;
		}
		if ((Object)(object)target != (Object)(object)((AbilityBehaviour)this).Card)
		{
			return 0;
		}
		if ((Object)(object)((AbilityBehaviour)this).Card.Slot == (Object)null || (Object)(object)((AbilityBehaviour)this).Card.Slot.opposingSlot == (Object)null)
		{
			return 0;
		}
		PlayableCard card = ((AbilityBehaviour)this).Card.Slot.opposingSlot.Card;
		if ((Object)(object)card == (Object)null || card.Dead)
		{
			return 0;
		}
		return GetSigilCount(card);
	}

	private static int GetSigilCount(PlayableCard card)
	{
		if ((Object)(object)card == (Object)null || (Object)(object)((Card)card).Info == (Object)null)
		{
			return 0;
		}
		List<Ability> list = new List<Ability>();
		if (((Card)card).Info.Abilities != null)
		{
			list.AddRange(((Card)card).Info.Abilities);
		}
		if (card.TemporaryMods != null)
		{
			foreach (CardModificationInfo temporaryMod in card.TemporaryMods)
			{
				if (temporaryMod != null && temporaryMod.abilities != null)
				{
					list.AddRange(temporaryMod.abilities);
				}
			}
			foreach (CardModificationInfo mod in card.TemporaryMods)
			{
				if (mod != null && mod.negateAbilities != null)
				{
					list.RemoveAll((Ability ability) => mod.negateAbilities.Contains(ability));
				}
			}
		}
		list = AbilitiesUtil.RemoveNonDistinctNonStacking(list);
		return list.Count;
	}
}
[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_Death Spray_sigil.dll

Decompiled 5 days 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_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, destroy a random opposing creature.");
		}
		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();
		if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || (Object)(object)Singleton<BoardManager>.Instance == (Object)null)
		{
			yield break;
		}
		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 && !slot.Card.HasAbility((Ability)105))
				{
					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 && !slot2.Card.HasAbility((Ability)105))
				{
					targets.Add(slot2.Card);
				}
			}
		}
		if (targets.Count != 0)
		{
			int seed = GetDeathSpraySeed();
			int targetIndex = SeededRandom.Range(0, targets.Count, seed);
			PlayableCard target = targets[targetIndex];
			if (!((Object)(object)target == (Object)null) && !target.Dead)
			{
				yield return target.Die(false, (PlayableCard)null, true);
			}
		}
	}

	private static int GetDeathSpraySeed()
	{
		SaveFile saveFile = SaveManager.SaveFile;
		if (saveFile == null)
		{
			return 0;
		}
		int currentRandomSeed = saveFile.GetCurrentRandomSeed();
		FieldInfo fieldInfo = AccessTools.Field(typeof(SaveFile), "randomSeed");
		if (fieldInfo != null)
		{
			int num = (int)fieldInfo.GetValue(saveFile);
			fieldInfo.SetValue(saveFile, num + 1);
		}
		return currentRandomSeed;
	}
}
[BepInPlugin("OLD_SA.DeathSpray", "OLD SA Death Spray", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		DeathSprayAPI.Init();
	}
}

Sigil/OldSa_Death_Roll_sigil.dll

Decompiled 5 days 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_Death_Roll_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Death_Roll_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("49d1ea1c-dafc-4bae-b214-4cc574d533a2")]
[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.DeathRoll;

public static class DeathRollAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Death Roll";
		val.rulebookName = "Death Roll";
		val.metaCategories = new List<AbilityMetaCategory>
		{
			(AbilityMetaCategory)0,
			(AbilityMetaCategory)1
		};
		val.powerLevel = 4;
		val.opponentUsable = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OLD_SA_DeathRoll.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] deals 1 damage to the card opposite it, repeated for each time it has attacked.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(DeathRollBehaviour), imageAsTexture);
		if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
		{
			ProgressionData.Data.learnedAbilities.Add(ability.Id);
		}
	}
}
public class DeathRollBehaviour : AbilityBehaviour
{
	private Dictionary<PlayableCard, int> attackCount = new Dictionary<PlayableCard, int>();

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

	public override bool RespondsToUpkeep(bool playerUpkeep)
	{
		if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead || !((AbilityBehaviour)this).Card.OnBoard)
		{
			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 || !((AbilityBehaviour)this).Card.OnBoard)
		{
			yield break;
		}
		yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
		CardSlot opposingSlot = ((AbilityBehaviour)this).Card.Slot.opposingSlot;
		if ((Object)(object)opposingSlot == (Object)null || (Object)(object)opposingSlot.Card == (Object)null)
		{
			yield break;
		}
		PlayableCard target = opposingSlot.Card;
		if ((Object)(object)target == (Object)null || target.Dead || !target.OnBoard)
		{
			yield break;
		}
		int count = 1;
		if (attackCount.ContainsKey(target))
		{
			count += attackCount[target];
		}
		for (int i = 0; i < count; i++)
		{
			if ((Object)(object)target == (Object)null)
			{
				break;
			}
			if (target.Dead)
			{
				break;
			}
			if (!target.OnBoard)
			{
				break;
			}
			yield return target.TakeDamage(1, ((AbilityBehaviour)this).Card);
			yield return (object)new WaitForSeconds(0.15f);
		}
		yield return ((AbilityBehaviour)this).LearnAbility(0f);
	}

	public void RecordAttack(PlayableCard target)
	{
		if (!((Object)(object)target == (Object)null))
		{
			if (attackCount.ContainsKey(target))
			{
				attackCount[target]++;
			}
			else
			{
				attackCount.Add(target, 1);
			}
		}
	}
}
[HarmonyPatch(typeof(CombatPhaseManager), "SlotAttackSlot")]
public static class DeathRollPatch
{
	[HarmonyPrefix]
	public static void Prefix(CardSlot attackingSlot, CardSlot opposingSlot)
	{
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)attackingSlot == (Object)null) && !((Object)(object)attackingSlot.Card == (Object)null) && !((Object)(object)opposingSlot == (Object)null) && !((Object)(object)opposingSlot.Card == (Object)null) && attackingSlot.Card.HasAbility(DeathRollAPI.ability.Id))
		{
			DeathRollBehaviour component = ((Component)attackingSlot.Card).GetComponent<DeathRollBehaviour>();
			if ((Object)(object)component != (Object)null)
			{
				component.RecordAttack(opposingSlot.Card);
			}
		}
	}
}
[BepInPlugin("OLD_SA.DeathRoll", "OLD SA Death Roll", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public const string GUID = "OLD_SA.DeathRoll";

	public const string NAME = "OLD SA Death Roll";

	public const string VERSION = "1.0.0";

	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.DeathRoll");
		val.PatchAll();
		DeathRollAPI.Init();
	}
}

Sigil/OldSa_Devouring_Maw_sigil.dll

Decompiled 5 days 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_Devouring_Maw_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Devouring_Maw_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("822ea6a2-3aff-4a3f-8e46-bef094283320")]
[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.DevouringMaw;

public static class DevouringMawAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Devouring Maw";
		val.rulebookName = "Devouring Maw";
		val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
		val.powerLevel = 5;
		val.opponentUsable = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Devouring_Maw.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 that creature's Power, Health, and sigils.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(DevouringMawBehaviour), imageAsTexture);
	}
}
public class DevouringMawBehaviour : AbilityBehaviour
{
	public override Ability Ability => DevouringMawAPI.ability.Id;

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

	private bool IsNegativeAbility(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_000d: Unknown result type (might be due to invalid IL or missing references)
		if ((int)ability == 0)
		{
			return true;
		}
		AbilityInfo info = AbilitiesUtil.GetInfo(ability);
		if ((Object)(object)info == (Object)null)
		{
			return false;
		}
		return info.powerLevel < 0;
	}

	private void AddInheritedAbility(List<Ability> abilities, 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_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		if ((int)ability != 0 && !IsNegativeAbility(ability) && !abilities.Contains(ability))
		{
			abilities.Add(ability);
		}
	}

	public override IEnumerator OnOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
	{
		if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead || (Object)(object)card == (Object)null || (Object)(object)killer != (Object)(object)((AbilityBehaviour)this).Card)
		{
			yield break;
		}
		int attack = card.Attack;
		int health = ((Card)card).Info.Health;
		List<Ability> abilities = new List<Ability>();
		if ((Object)(object)((Card)card).Info != (Object)null && ((Card)card).Info.Abilities != null)
		{
			foreach (Ability ability in ((Card)card).Info.Abilities)
			{
				AddInheritedAbility(abilities, ability);
			}
		}
		if ((Object)(object)((Card)card).Info != (Object)null && ((Card)card).Info.Mods != null)
		{
			foreach (CardModificationInfo cardMod in ((Card)card).Info.Mods)
			{
				if (cardMod == null || cardMod.abilities == null)
				{
					continue;
				}
				foreach (Ability ability2 in cardMod.abilities)
				{
					AddInheritedAbility(abilities, ability2);
				}
			}
		}
		FieldInfo temporaryModsField = AccessTools.Field(typeof(PlayableCard), "temporaryMods");
		if (temporaryModsField != null && temporaryModsField.GetValue(card) is List<CardModificationInfo> temporaryMods)
		{
			foreach (CardModificationInfo cardMod2 in temporaryMods)
			{
				if (cardMod2 == null || cardMod2.abilities == null)
				{
					continue;
				}
				foreach (Ability ability3 in cardMod2.abilities)
				{
					AddInheritedAbility(abilities, ability3);
				}
			}
		}
		yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
		if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead)
		{
			yield break;
		}
		CardModificationInfo mod = new CardModificationInfo();
		mod.attackAdjustment = attack;
		mod.healthAdjustment = health;
		foreach (Ability ability4 in abilities)
		{
			mod.abilities.Add(ability4);
		}
		yield return PlayDevouringAnimation(mod);
		if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && !((AbilityBehaviour)this).Card.Dead)
		{
			yield return ((AbilityBehaviour)this).LearnAbility(0.5f);
		}
	}

	private IEnumerator PlayDevouringAnimation(CardModificationInfo mod)
	{
		if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null))
		{
			((Card)((AbilityBehaviour)this).Card).Anim.PlayTransformAnimation();
			((AbilityBehaviour)this).Card.AddTemporaryMod(mod);
			((Card)((AbilityBehaviour)this).Card).RenderCard();
			yield return (object)new WaitForSeconds(0.5f);
		}
	}
}
[BepInPlugin("OLD_SA.DevouringMaw", "OLD SA DevouringMaw", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public const string GUID = "OLD_SA.DevouringMaw";

	public const string NAME = "OLD SA DevouringMaw";

	public const string VERSION = "1.0.0";

	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.DevouringMaw");
		val.PatchAll();
		DevouringMawAPI.Init();
	}
}

Sigil/OldSa_Diagonal_Block_sigil.dll

Decompiled 5 days 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 InscryptionAPI.Card;
using InscryptionAPI.Helpers;
using InscryptionAPI.Triggers;
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_Diagonal_Block_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Diagonal_Block_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("19eecc50-4756-4978-a9a0-6a080ff94d6c")]
[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.DiagonalBlock;

public static class DiagonalBlockAPI
{
	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 = "Diagonal Block";
		val.rulebookName = "Diagonal Block";
		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_Diagonal_Block.png", (FilterMode)0);
		Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("OldSa_Diagonal_Block_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, "[creature] the damage it ultimately takes is 5 minus its stat.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(DiagonalBlockBehaviour), imageAsTexture);
	}
}
public class DiagonalBlockBehaviour : AbilityBehaviour, IModifyDamageTaken
{
	private int lastDamage = -1;

	private int lastResult = -1;

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

	public bool RespondsToModifyDamageTaken(PlayableCard card, int damage, PlayableCard attacker, int amount)
	{
		return (Object)(object)card == (Object)(object)((AbilityBehaviour)this).Card && damage > 0;
	}

	public int OnModifyDamageTaken(PlayableCard card, int damage, PlayableCard attacker, int amount)
	{
		if (damage == lastResult)
		{
			return lastResult;
		}
		lastDamage = damage;
		lastResult = Mathf.Max(0, 5 - damage);
		return lastResult;
	}

	public int TriggerPriority(PlayableCard card, int damage, PlayableCard attacker)
	{
		return 0;
	}
}
[BepInPlugin("OLD_SA.ShellDefense", "OLD SA Shell Defense", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		DiagonalBlockAPI.Init();
	}
}

Sigil/OldSa_Dragon's Rumble_sigil.dll

Decompiled 5 days 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_Enrage_sigil.dll

Decompiled 5 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
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 InscryptionAPI.Helpers.Extensions;
using InscryptionAPI.Triggers;
using OLD_SA.Ambush;
using OLD_SA.AntsFall;
using OLD_SA.Arbiter;
using OLD_SA.ArmorStrike;
using OLD_SA.Bait;
using OLD_SA.BloodDependency;
using OLD_SA.Bloomguard;
using OLD_SA.BrittleCopy;
using OLD_SA.CardSteal;
using OLD_SA.CardTraits;
using OLD_SA.CentralStrike;
using OLD_SA.Combat;
using OLD_SA.DeathBurst;
using OLD_SA.Deathborn;
using OLD_SA.Decay;
using OLD_SA.DoubleDraw;
using OLD_SA.EndlessBreeding;
using OLD_SA.EnrageArmor;
using OLD_SA.FatalBargain;
using OLD_SA.ForceEntry;
using OLD_SA.ForcedMarch;
using OLD_SA.FoulSten;
using OLD_SA.Fragile;
using OLD_SA.Hover;
using OLD_SA.InstinctiveContainment;
using OLD_SA.Lightning;
using OLD_SA.MalformedSpikes;
using OLD_SA.Miser;
using OLD_SA.Molting;
using OLD_SA.Opportunist;
using OLD_SA.OpportunistStrike;
using OLD_SA.Osteophagia;
using OLD_SA.PackThief;
using OLD_SA.Parasite;
using OLD_SA.StressResponse;
using OLD_SA.TwistedGrowth;
using OLD_SA.UndyingRest;
using OLD_SA.Utilities;
using OLD_SA.VanishingAct;
using OLD_SA.WaterMusic;
using OLD_SA.WondrousBrush;
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_Enrage_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Enrage_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7c16529d-197e-4a29-8c29-1179bf898236")]
[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.WondrousBrush
{
	public static class WondrousBrushAPI
	{
		public static FullAbility ability;

		public static void Init()
		{
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Wondrous Brush";
			val.rulebookName = "Wondrous Brush";
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.powerLevel = 5;
			val.opponentUsable = false;
			val.canStack = false;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_WondrousBrush.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 gains Power and Health equal to the number of sigils that creature had.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(WondrousBrushBehaviour), imageAsTexture);
		}
	}
	public class WondrousBrushBehaviour : ExtendedAbilityBehaviour
	{
		public override Ability Ability => WondrousBrushAPI.ability.Id;

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

		public override IEnumerator OnOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
		{
			if (!((Object)(object)card == (Object)null))
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				int count = GetSigilCount(card);
				if (count > 0)
				{
					CardModificationInfo mod = new CardModificationInfo();
					mod.attackAdjustment = count;
					mod.healthAdjustment = count;
					((AbilityBehaviour)this).Card.AddTemporaryMod(mod);
					((Card)((AbilityBehaviour)this).Card).RenderCard();
					((Card)((AbilityBehaviour)this).Card).Anim.LightNegationEffect();
				}
				yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
			}
		}

		private int GetSigilCount(PlayableCard card)
		{
			int num = 0;
			if ((Object)(object)((Card)card).Info != (Object)null && ((Card)card).Info.Abilities != null)
			{
				num += ((Card)card).Info.Abilities.Count;
			}
			if (card.TemporaryMods != null)
			{
				foreach (CardModificationInfo temporaryMod in card.TemporaryMods)
				{
					if (temporaryMod != null && temporaryMod.abilities != null)
					{
						num += temporaryMod.abilities.Count;
					}
				}
			}
			return num;
		}
	}
}
namespace OLD_SA.WaterMusic
{
	public static class WaterMusicAPI
	{
		public static FullAbility ability;

		public static Ability WaterMusicAbility;

		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 = "Water Music";
			val.rulebookName = "Water Music";
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.powerLevel = 4;
			val.opponentUsable = false;
			val.canStack = false;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Water_Music.png", (FilterMode)0);
			FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(val, "When a creature emerges, if it is an ally, [creature] gives it 1 Power; if it is an enemy, [creature] reduces it by 1.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(WaterMusicBehaviour), imageAsTexture);
			WaterMusicAbility = val.ability;
		}
	}
	public class WaterMusicBehaviour : ExtendedAbilityBehaviour
	{
		public static List<WaterMusicBehaviour> ActiveWaterMusic = new List<WaterMusicBehaviour>();

		private Dictionary<PlayableCard, int> AppliedBuff = new Dictionary<PlayableCard, int>();

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

		private void Awake()
		{
			if (!ActiveWaterMusic.Contains(this))
			{
				ActiveWaterMusic.Add(this);
			}
		}

		private void OnDestroy()
		{
			ActiveWaterMusic.Remove(this);
			AppliedBuff.Clear();
		}

		public bool IsValid()
		{
			return (Object)(object)((AbilityBehaviour)this).Card != (Object)null && !((AbilityBehaviour)this).Card.Dead && ((AbilityBehaviour)this).Card.OnBoard;
		}

		public void OnCreatureResurface(PlayableCard creature)
		{
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			if (IsValid() && !((Object)(object)creature == (Object)null) && !creature.Dead)
			{
				int num = ((((AbilityBehaviour)this).Card.OpponentCard == creature.OpponentCard) ? 1 : (-1));
				if (AppliedBuff.ContainsKey(creature))
				{
					AppliedBuff[creature] += num;
				}
				else
				{
					AppliedBuff.Add(creature, num);
				}
				CardModificationInfo val = new CardModificationInfo();
				val.attackAdjustment = num;
				creature.AddTemporaryMod(val);
				creature.OnStatsChanged();
			}
		}
	}
	[HarmonyPatch(typeof(Submerge), "OnResurface")]
	public static class WaterMusicResurfacePatch
	{
		[HarmonyPostfix]
		public static void Postfix(Submerge __instance)
		{
			if ((Object)(object)__instance == (Object)null)
			{
				return;
			}
			PlayableCard card = GetCard(__instance);
			if ((Object)(object)card == (Object)null)
			{
				return;
			}
			foreach (WaterMusicBehaviour item in new List<WaterMusicBehaviour>(WaterMusicBehaviour.ActiveWaterMusic))
			{
				if (!((Object)(object)item == (Object)null))
				{
					item.OnCreatureResurface(card);
				}
			}
		}

		private static PlayableCard GetCard(Submerge submerge)
		{
			Type type = ((object)submerge).GetType();
			while (type != null)
			{
				PropertyInfo[] properties = type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				PropertyInfo[] array = properties;
				foreach (PropertyInfo propertyInfo in array)
				{
					if (propertyInfo.PropertyType == typeof(PlayableCard))
					{
						object? value = propertyInfo.GetValue(submerge);
						return (PlayableCard)((value is PlayableCard) ? value : null);
					}
				}
				FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				FieldInfo[] array2 = fields;
				foreach (FieldInfo fieldInfo in array2)
				{
					if (fieldInfo.FieldType == typeof(PlayableCard))
					{
						object? value2 = fieldInfo.GetValue(submerge);
						return (PlayableCard)((value2 is PlayableCard) ? value2 : null);
					}
				}
				type = type.BaseType;
			}
			return null;
		}
	}
}
namespace OLD_SA.VanishingAct
{
	public static class VanishingActAPI
	{
		public static FullAbility ability;

		public static Ability VanishingActAbility;

		public static void Init()
		{
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: 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)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Vanishing Act";
			val.rulebookName = "Vanishing Act";
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.powerLevel = 3;
			val.opponentUsable = false;
			val.canStack = false;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_VanishingAct.png", (FilterMode)0);
			FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(val, "At the end of the turn, [creature] moves once, kills any card it encounters, and draws a card.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(VanishingActBehaviour), imageAsTexture);
			VanishingActAbility = val.ability;
			if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
			{
				ProgressionData.Data.learnedAbilities.Add(ability.Id);
			}
		}
	}
	public class VanishingActBehaviour : Strafe
	{
		public override Ability Ability => VanishingActAPI.ability.Id;

		protected override IEnumerator DoStrafe(CardSlot toLeft, CardSlot toRight)
		{
			if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead || !((AbilityBehaviour)this).Card.OnBoard)
			{
				yield break;
			}
			bool leftAvailable = (Object)(object)toLeft != (Object)null;
			bool rightAvailable = (Object)(object)toRight != (Object)null;
			if (base.movingLeft && !leftAvailable)
			{
				base.movingLeft = false;
			}
			if (!base.movingLeft && !rightAvailable)
			{
				base.movingLeft = true;
			}
			CardSlot targetSlot = (base.movingLeft ? toLeft : toRight);
			if ((Object)(object)targetSlot == (Object)null)
			{
				((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
				yield return (object)new WaitForSeconds(0.15f);
				yield break;
			}
			bool killedTarget = false;
			PlayableCard targetCard = targetSlot.Card;
			if ((Object)(object)targetCard != (Object)null)
			{
				if ((Object)(object)targetCard == (Object)(object)((AbilityBehaviour)this).Card || targetCard.Dead || !targetCard.OnBoard)
				{
					yield break;
				}
				yield return targetCard.Die(false, ((AbilityBehaviour)this).Card, true);
				yield return (object)new WaitForSeconds(0.25f);
				if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead || !((AbilityBehaviour)this).Card.OnBoard || (Object)(object)targetSlot.Card != (Object)null)
				{
					yield break;
				}
				killedTarget = true;
			}
			yield return ((Strafe)this).MoveToSlot(targetSlot, true);
			if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && !((AbilityBehaviour)this).Card.Dead && ((AbilityBehaviour)this).Card.OnBoard)
			{
				if (killedTarget)
				{
					yield return DrawOneCard();
				}
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
			}
		}

		private IEnumerator DrawOneCard()
		{
			CardDrawPiles3D piles = CardDrawPiles3D.Instance;
			if (!((Object)(object)piles == (Object)null) && !((Object)(object)((CardDrawPiles)piles).Deck == (Object)null) && ((CardDrawPiles)piles).Deck.CardsInDeck > 0)
			{
				if ((Object)(object)piles.Pile != (Object)null)
				{
					piles.Pile.Draw();
				}
				yield return ((CardDrawPiles)piles).DrawCardFromDeck((CardInfo)null, (Action<PlayableCard>)null);
			}
		}
	}
}
namespace OLD_SA.UndyingRest
{
	public static class UndyingRestAPI
	{
		public static FullAbility ability;

		public static Ability UndyingRestAbility;

		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 = "Undying Rest";
			val.rulebookName = "Undying Rest";
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.powerLevel = 3;
			val.opponentUsable = false;
			val.canStack = false;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_UndyingRest.png", (FilterMode)0);
			FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(val, "When [creature] is sacrificed, it does not perish and you gain 2 Bones.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(UndyingRestBehaviour), imageAsTexture);
			UndyingRestAbility = val.ability;
		}
	}
	public class UndyingRestBehaviour : AbilityBehaviour
	{
		public override Ability Ability => UndyingRestAPI.ability.Id;

		public override bool RespondsToSacrifice()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			return (Object)(object)((AbilityBehaviour)this).Card != (Object)null && !((AbilityBehaviour)this).Card.Dead && ((AbilityBehaviour)this).Card.HasAbility(UndyingRestAPI.UndyingRestAbility);
		}

		public override IEnumerator OnSacrifice()
		{
			yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
			((Card)((AbilityBehaviour)this).Card).Anim.LightNegationEffect();
			yield return ((AbilityBehaviour)this).LearnAbility(0f);
			yield return (object)new WaitForSeconds(0.25f);
		}
	}
	[HarmonyPatch(typeof(PlayableCard), "Sacrifice")]
	public static class UndyingRestPatch
	{
		public static bool Prefix(PlayableCard __instance, ref IEnumerator __result)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance == (Object)null || !__instance.HasAbility(UndyingRestAPI.UndyingRestAbility))
			{
				return true;
			}
			__result = SacrificeWithoutDeath(__instance);
			return false;
		}

		private static IEnumerator SacrificeWithoutDeath(PlayableCard card)
		{
			AscensionStatsData.TryIncrementStat((Type)7);
			((Card)card).Anim.PlaySacrificeSound();
			if (card.HasAbility((Ability)20))
			{
				((Card)card).Anim.SetSacrificeHoverMarkerShown(false);
				((Card)card).Anim.SetMarkedForSacrifice(false);
				((Card)card).Anim.PlaySacrificeParticles();
				ProgressionData.SetAbilityLearned((Ability)20);
			}
			else
			{
				((Card)card).Anim.DeactivateSacrificeHoverMarker();
				((Card)card).Anim.SetSacrificeHoverMarkerShown(false);
				((Card)card).Anim.SetMarkedForSacrifice(false);
			}
			if (card.TriggerHandler.RespondsToTrigger((Trigger)5, Array.Empty<object>()))
			{
				yield return card.TriggerHandler.OnTrigger((Trigger)5, Array.Empty<object>());
			}
			yield return Singleton<ResourcesManager>.Instance.AddBones(2, card.Slot);
		}
	}
}
namespace OLD_SA.TwistedGrowth
{
	public static class TwistedGrowthAPI
	{
		public static FullAbility ability;

		public static void Init()
		{
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Twisted Growth";
			val.rulebookName = "Twisted Growth";
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.powerLevel = 3;
			val.opponentUsable = false;
			val.canStack = false;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Twisted_Growth.png", (FilterMode)0);
			FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(val, "At the end of the owner's turn, [creature] gains 1 Health. If [creature] killed a creature this turn, it gains 1 Power and 2 Health instead.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(TwistedGrowthBehaviour), imageAsTexture);
		}
	}
	public class TwistedGrowthBehaviour : ExtendedAbilityBehaviour
	{
		private bool killedThisTurn;

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

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

		public override IEnumerator OnUpkeep(bool playerUpkeep)
		{
			killedThisTurn = false;
			yield break;
		}

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

		public override IEnumerator OnOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
		{
			if ((Object)(object)killer == (Object)(object)((AbilityBehaviour)this).Card)
			{
				killedThisTurn = true;
			}
			yield break;
		}

		public override bool RespondsToTurnEnd(bool playerTurnEnd)
		{
			if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead || !((AbilityBehaviour)this).Card.OnBoard)
			{
				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 && ((AbilityBehaviour)this).Card.OnBoard)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				CardModificationInfo mod = new CardModificationInfo();
				if (killedThisTurn)
				{
					mod.attackAdjustment = 1;
					mod.healthAdjustment = 2;
				}
				else
				{
					mod.healthAdjustment = 1;
				}
				((AbilityBehaviour)this).Card.AddTemporaryMod(mod);
				killedThisTurn = false;
				yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
			}
		}
	}
}
namespace OLD_SA.Patches
{
	[HarmonyPatch(typeof(GlobalTriggerHandler), "ReceiverRespondsToTrigger")]
	public static class TakeDamageNullSourcePatch
	{
		[HarmonyPrefix]
		public static bool Prefix(Trigger trigger, TriggerReceiver receiver, object[] otherArgs, ref bool __result)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			if ((int)trigger != 8)
			{
				return true;
			}
			if (otherArgs == null || otherArgs.Length == 0)
			{
				return true;
			}
			if (otherArgs[0] != null)
			{
				return true;
			}
			if ((Object)(object)receiver == (Object)null)
			{
				__result = false;
				return false;
			}
			__result = receiver.RespondsToTakeDamage((PlayableCard)null);
			return false;
		}
	}
}
namespace OLD_SA.StressResponse
{
	public static class StressResponseAPI
	{
		public static FullAbility ability;

		public static Ability StressResponseAbility;

		public static void Init()
		{
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Stress Response";
			val.rulebookName = "Stress Response";
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.powerLevel = -2;
			val.opponentUsable = false;
			val.canStack = false;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_StressResponse.png", (FilterMode)0);
			FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(val, "When an ally dies, [creature] returns to your hand.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(StressResponseBehaviour), imageAsTexture);
			StressResponseAbility = val.ability;
		}
	}
	public class StressResponseBehaviour : AbilityBehaviour
	{
		private readonly HashSet<PlayableCard> processedDeathCards = new HashSet<PlayableCard>();

		private bool returningToHand;

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

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

		public override IEnumerator OnOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
		{
			if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead || !((AbilityBehaviour)this).Card.OnBoard || (Object)(object)card == (Object)null || (Object)(object)card == (Object)(object)((AbilityBehaviour)this).Card || !fromCombat || card.OpponentCard != ((AbilityBehaviour)this).Card.OpponentCard || !processedDeathCards.Add(card) || returningToHand)
			{
				yield break;
			}
			returningToHand = true;
			yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
			if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead || !((AbilityBehaviour)this).Card.OnBoard || (Object)(object)((AbilityBehaviour)this).Card.Slot == (Object)null)
			{
				returningToHand = false;
				yield break;
			}
			PlayableCard cardToReturn = ((AbilityBehaviour)this).Card;
			Singleton<ViewManager>.Instance.SwitchToView((View)0, false, false);
			yield return (object)new WaitForSeconds(0.1f);
			PlayerHand hand = Singleton<PlayerHand>.Instance;
			if ((Object)(object)hand == (Object)null)
			{
				returningToHand = false;
				yield break;
			}
			CardSlot oldSlot = cardToReturn.Slot;
			if ((Object)(object)oldSlot != (Object)null && (Object)(object)oldSlot.Card == (Object)(object)cardToReturn)
			{
				oldSlot.Card = null;
			}
			cardToReturn.Slot = null;
			yield return hand.AddCardToHand(cardToReturn, Vector3.zero, 0.25f);
			yield return (object)new WaitForSeconds(0.1f);
			if (!hand.CardsInHand.Contains(cardToReturn))
			{
				returningToHand = false;
				yield break;
			}
			Collider cardCollider = ((Component)cardToReturn).GetComponent<Collider>();
			if ((Object)(object)cardCollider != (Object)null && !cardCollider.enabled)
			{
				((InteractableBase)cardToReturn).SetEnabled(true);
			}
			Collider2D cardCollider2D = ((Component)cardToReturn).GetComponent<Collider2D>();
			if ((Object)(object)cardCollider2D != (Object)null && !((Behaviour)cardCollider2D).enabled)
			{
				((InteractableBase)cardToReturn).SetEnabled(true);
			}
			Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
			yield return null;
			if (hand.CardsInHand.Contains(cardToReturn))
			{
				if ((Object)(object)cardCollider != (Object)null && !cardCollider.enabled)
				{
					((InteractableBase)cardToReturn).SetEnabled(true);
				}
				if ((Object)(object)cardCollider2D != (Object)null && !((Behaviour)cardCollider2D).enabled)
				{
					((InteractableBase)cardToReturn).SetEnabled(true);
				}
				hand.OnCardInspected(cardToReturn);
			}
			yield return ((AbilityBehaviour)this).LearnAbility(0f);
			returningToHand = false;
		}
	}
}
namespace OLD_SA.Parasite
{
	public static class ParasiteAPI
	{
		public static FullAbility ability;

		public static Ability ParasiteAbility;

		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 = "Parasite";
			val.rulebookName = "Parasite";
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.powerLevel = 2;
			val.opponentUsable = false;
			val.canStack = false;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Parasite.png", (FilterMode)0);
			FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(val, "When [creature] takes damage, create a card in hand.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(ParasiteBehaviour), imageAsTexture);
			ParasiteAbility = val.ability;
		}
	}
	public class ParasiteBehaviour : AbilityBehaviour
	{
		private const string EXTENDED_PROPERTY = "Parasite";

		private const string DEFAULT_CARD = "OLD_SA_WORM";

		private bool triggering;

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

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

		public override IEnumerator OnTakeDamage(PlayableCard source)
		{
			if (triggering || (Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead || !((AbilityBehaviour)this).Card.OnBoard)
			{
				yield break;
			}
			triggering = true;
			try
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead || !((AbilityBehaviour)this).Card.OnBoard || (Object)(object)((Card)((AbilityBehaviour)this).Card).Info == (Object)null)
				{
					yield break;
				}
				string spawnedCardName = CardExtensions.GetExtendedProperty(((Card)((AbilityBehaviour)this).Card).Info, "Parasite");
				if (string.IsNullOrEmpty(spawnedCardName))
				{
					spawnedCardName = "OLD_SA_WORM";
				}
				CardInfo spawnedInfo = CardLoader.GetCardByName(spawnedCardName);
				if ((Object)(object)spawnedInfo == (Object)null)
				{
					Debug.LogError((object)("[Parasite] 找不到生成卡牌:" + spawnedCardName));
					yield break;
				}
				object obj = spawnedInfo.Clone();
				spawnedInfo = (CardInfo)((obj is CardInfo) ? obj : null);
				if ((Object)(object)spawnedInfo == (Object)null)
				{
					yield break;
				}
				if (spawnedInfo.Mods == null)
				{
					spawnedInfo.Mods = new List<CardModificationInfo>();
				}
				spawnedInfo.Mods.AddRange(((AbilityBehaviour)this).GetNonDefaultModsFromSelf((Ability[])(object)new Ability[1] { (Ability)(int)((AbilityBehaviour)this).Ability }));
				ViewManager viewManager = Singleton<ViewManager>.Instance;
				if ((Object)(object)viewManager != (Object)null)
				{
					viewManager.SwitchToView((View)0, false, false);
					yield return (object)new WaitForSeconds(0.1f);
				}
				PlayerHand hand = Singleton<PlayerHand>.Instance;
				if ((Object)(object)hand == (Object)null)
				{
					yield break;
				}
				yield return Singleton<CardSpawner>.Instance.SpawnCardToHand(spawnedInfo, (List<CardModificationInfo>)null, 0.25f, (Action<PlayableCard>)null);
				yield return (object)new WaitForSeconds(0.1f);
				if ((Object)(object)hand != (Object)null && hand.CardsInHand != null)
				{
					List<PlayableCard> cards = new List<PlayableCard>(hand.CardsInHand);
					foreach (PlayableCard handCard in cards)
					{
						if (!((Object)(object)handCard == (Object)null) && hand.CardsInHand.Contains(handCard))
						{
							Collider cardCollider = ((Component)handCard).GetComponent<Collider>();
							Collider2D cardCollider2D = ((Component)handCard).GetComponent<Collider2D>();
							if (((Object)(object)cardCollider != (Object)null && !cardCollider.enabled) || ((Object)(object)cardCollider2D != (Object)null && !((Behaviour)cardCollider2D).enabled))
							{
								((InteractableBase)handCard).SetEnabled(true);
							}
							hand.OnCardInspected(handCard);
						}
					}
				}
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
			}
			finally
			{
				triggering = false;
			}
		}
	}
}
namespace OLD_SA.PackThief
{
	public static class PackThiefAPI
	{
		public static FullAbility ability;

		public static Ability PackThiefAbility;

		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 = "Pack Thief";
			val.rulebookName = "Pack Thief";
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.powerLevel = 3;
			val.opponentUsable = false;
			val.canStack = false;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_PackThief.png", (FilterMode)0);
			FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(val, "Whenever a item is used, [creature] gains 1 Power and 1 Health.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(PackThiefBehaviour), imageAsTexture);
			PackThiefAbility = val.ability;
		}
	}
	public class PackThiefBehaviour : AbilityBehaviour
	{
		public override Ability Ability => PackThiefAPI.PackThiefAbility;
	}
	[HarmonyPatch(typeof(ConsumableItemSlot), "CompleteItemActivation")]
	public static class PackThiefConsumablePatch
	{
		private static readonly Dictionary<PlayableCard, int> ConsumableCounts = new Dictionary<PlayableCard, int>();

		private const string RatEmperorName = "OLD_SA_RAT_EMPEROR";

		[HarmonyPostfix]
		public static void Postfix()
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Expected O, but got Unknown
			BoardManager instance = Singleton<BoardManager>.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			HashSet<PlayableCard> hashSet = new HashSet<PlayableCard>();
			foreach (CardSlot allSlot in instance.AllSlots)
			{
				if (!((Object)(object)allSlot == (Object)null) && !((Object)(object)allSlot.Card == (Object)null))
				{
					PlayableCard card = allSlot.Card;
					if (!card.OpponentCard && !card.Dead && card.HasAbility(PackThiefAPI.PackThiefAbility))
					{
						hashSet.Add(card);
					}
				}
			}
			PlayerHand instance2 = Singleton<PlayerHand>.Instance;
			if ((Object)(object)instance2 != (Object)null)
			{
				foreach (PlayableCard item in instance2.CardsInHand)
				{
					if (!((Object)(object)item == (Object)null) && !item.Dead && item.HasAbility(PackThiefAPI.PackThiefAbility))
					{
						hashSet.Add(item);
					}
				}
			}
			foreach (PlayableCard item2 in hashSet)
			{
				if ((Object)(object)item2 == (Object)null || (Object)(object)((Card)item2).Info == (Object)null)
				{
					continue;
				}
				if (!ConsumableCounts.TryGetValue(item2, out var value))
				{
					value = 0;
				}
				value++;
				ConsumableCounts[item2] = value;
				bool flag = value % 2 == 0 && ((Object)((Card)item2).Info).name == "OLD_SA_RAT_EMPEROR";
				CardModificationInfo val = new CardModificationInfo();
				val.attackAdjustment = 1;
				val.healthAdjustment = 1;
				if (flag)
				{
					if (((Card)item2).Info.Mods == null)
					{
						((Card)item2).Info.Mods = new List<CardModificationInfo>();
					}
					((Card)item2).Info.Mods.Add(val);
				}
				else
				{
					item2.AddTemporaryMod(val);
				}
			}
			List<PlayableCard> list = new List<PlayableCard>();
			foreach (KeyValuePair<PlayableCard, int> consumableCount in ConsumableCounts)
			{
				if ((Object)(object)consumableCount.Key == (Object)null)
				{
					list.Add(consumableCount.Key);
				}
			}
			foreach (PlayableCard item3 in list)
			{
				ConsumableCounts.Remove(item3);
			}
		}
	}
}
namespace OLD_SA.Osteophagia
{
	public static class OsteophagiaAPI
	{
		public static FullAbility ability;

		public static Ability OsteophagiaAbility;

		public static void Init()
		{
			//IL_00b2: 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_00cb: 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)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Osteophagia";
			val.rulebookName = "Osteophagia";
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.powerLevel = 1;
			val.opponentUsable = false;
			val.canStack = false;
			val.activated = true;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Osteophagia.png", (FilterMode)0);
			FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(val, "When you click [creature], consume 1 bone and gain 1 Health.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(OsteophagiaBehaviour), imageAsTexture);
			OsteophagiaAbility = ability.Id;
			if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
			{
				ProgressionData.Data.learnedAbilities.Add(ability.Id);
			}
		}
	}
	public class OsteophagiaBehaviour : ExtendedActivatedAbilityBehaviour
	{
		public override Ability Ability => OsteophagiaAPI.ability.Id;

		public override int StartingBonesCost => 1;

		public override IEnumerator Activate()
		{
			if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && !((AbilityBehaviour)this).Card.Dead && ((AbilityBehaviour)this).Card.OnBoard)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				CardModificationInfo mod = new CardModificationInfo(0, 1);
				((AbilityBehaviour)this).Card.AddTemporaryMod(mod);
				if ((Object)(object)((Card)((AbilityBehaviour)this).Card).Anim != (Object)null)
				{
					((Card)((AbilityBehaviour)this).Card).Anim.LightNegationEffect();
				}
				yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
			}
		}
	}
}
namespace OLD_SA.OpportunistStrike
{
	public class OpportunistStrikeAPI
	{
		public static FullAbility ability;

		public static void Init()
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Opportunist Strike";
			val.rulebookName = "Opportunist Strike";
			val.powerLevel = 4;
			val.opponentUsable = true;
			val.canStack = false;
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("OldSa_OpportunistStrike.png", (FilterMode)0);
			Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("OldSa_OpportunistStrike_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));
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(OpportunistStrikeBehaviour), (Texture)(object)imageAsTexture);
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(val, "When [creature] attacks, if the target is empty, it attacks one additional time; otherwise, the attack is prevented.");
			}
			if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
			{
				ProgressionData.Data.learnedAbilities.Add(ability.Id);
			}
		}
	}
	public class OpportunistStrikeBehaviour : AbilityBehaviour
	{
		public override Ability Ability => OpportunistStrikeAPI.ability.Id;
	}
}
namespace OLD_SA.Opportunist
{
	public static class OpportunistAPI
	{
		public static FullAbility ability;

		public static Ability OpportunistAbility;

		public static void Init()
		{
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Opportunist";
			val.rulebookName = "Opportunist";
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.powerLevel = -2;
			val.opponentUsable = false;
			val.canStack = false;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Opportunist.png", (FilterMode)0);
			Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("OldSa_Opportunist_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 the balance tips toward its owner, [creature] tries to move to the enemy's side.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(OpportunistBehaviour), imageAsTexture);
			OpportunistAbility = val.ability;
		}
	}
	[HarmonyPatch(typeof(LifeManager), "ShowDamageSequence")]
	public static class OpportunistShowDamageSequencePatch
	{
		[HarmonyPostfix]
		public static void Postfix(ref IEnumerator __result)
		{
			if (__result != null)
			{
				__result = OpportunistBalanceWatcher.AfterBalanceSequence(__result);
			}
		}
	}
	[HarmonyPatch(typeof(LifeManager), "SetNumWeightsImmediate")]
	public static class OpportunistSetWeightsPatch
	{
		[HarmonyPostfix]
		public static void Postfix()
		{
			OpportunistBalanceWatcher.ScheduleCheck();
		}
	}
	[HarmonyPatch(typeof(LifeManager), "Reset")]
	public static class OpportunistResetPatch
	{
		[HarmonyPostfix]
		public static void Postfix()
		{
			OpportunistBalanceWatcher.ScheduleCheck();
		}
	}
	[HarmonyPatch(typeof(LifeManager), "CleanUp")]
	public static class OpportunistCleanUpPatch
	{
		[HarmonyPostfix]
		public static void Postfix(ref IEnumerator __result)
		{
			if (__result != null)
			{
				__result = OpportunistBalanceWatcher.AfterBalanceSequence(__result);
			}
		}
	}
	public static class OpportunistBalanceWatcher
	{
		private static bool checking;

		public static IEnumerator CheckAndMoveAll()
		{
			if (checking)
			{
				yield break;
			}
			checking = true;
			try
			{
				if ((Object)(object)Singleton<LifeManager>.Instance == (Object)null)
				{
					yield break;
				}
				int balance = Singleton<LifeManager>.Instance.Balance;
				if (balance == 0)
				{
					yield break;
				}
				bool targetPlayerSide = balance > 0;
				List<PlayableCard> cards = GetOpportunistCards();
				foreach (PlayableCard card in cards)
				{
					if ((Object)(object)card == (Object)null || card.Dead || (Object)(object)card.Slot == (Object)null || !card.OnBoard || !((Component)card).gameObject.activeInHierarchy)
					{
						continue;
					}
					bool currentlyPlayerSide = !card.OpponentCard;
					if (currentlyPlayerSide != targetPlayerSide)
					{
						CardSlot targetSlot = FindTargetSlot(card, targetPlayerSide);
						if (!((Object)(object)targetSlot == (Object)null))
						{
							yield return MoveCard(card, targetSlot);
						}
					}
				}
			}
			finally
			{
				checking = false;
			}
		}

		private static List<PlayableCard> GetOpportunistCards()
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			List<PlayableCard> list = new List<PlayableCard>();
			PlayableCard[] array = Resources.FindObjectsOfTypeAll<PlayableCard>();
			PlayableCard[] array2 = array;
			foreach (PlayableCard val in array2)
			{
				if (!((Object)(object)val == (Object)null) && ((Component)val).gameObject.activeInHierarchy && !val.Dead && val.OnBoard && !((Object)(object)val.Slot == (Object)null) && CardExtensions.GetAbilityStacks(val, OpportunistAPI.OpportunistAbility) > 0 && !list.Contains(val))
				{
					list.Add(val);
				}
			}
			return list;
		}

		private static CardSlot FindTargetSlot(PlayableCard card, bool targetPlayerSide)
		{
			if ((Object)(object)card == (Object)null || (Object)(object)card.Slot == (Object)null)
			{
				return null;
			}
			CardSlot opposingSlot = card.Slot.opposingSlot;
			if ((Object)(object)opposingSlot != (Object)null && opposingSlot.IsPlayerSlot == targetPlayerSide && (Object)(object)opposingSlot.Card == (Object)null)
			{
				return opposingSlot;
			}
			CardSlot[] array = Resources.FindObjectsOfTypeAll<CardSlot>();
			List<CardSlot> list = new List<CardSlot>();
			CardSlot[] array2 = array;
			foreach (CardSlot val in array2)
			{
				if (!((Object)(object)val == (Object)null) && ((Component)val).gameObject.activeInHierarchy && val.IsPlayerSlot == targetPlayerSide && !((Object)(object)val.Card != (Object)null) && !list.Contains(val))
				{
					list.Add(val);
				}
			}
			list.Sort((CardSlot a, CardSlot b) => ((Component)a).transform.position.x.CompareTo(((Component)b).transform.position.x));
			if (list.Count > 0)
			{
				return list[0];
			}
			return null;
		}

		private static IEnumerator MoveCard(PlayableCard card, CardSlot targetSlot)
		{
			if (!((Object)(object)card == (Object)null) && !card.Dead && !((Object)(object)card.Slot == (Object)null) && !((Object)(object)targetSlot == (Object)null) && !((Object)(object)targetSlot.Card != (Object)null))
			{
				bool targetPlayerSide = targetSlot.IsPlayerSlot;
				Vector3 midpoint = (((Component)card.Slot).transform.position + ((Component)targetSlot).transform.position) / 2f;
				Tween.Position(((Component)card).transform, midpoint + Vector3.up * 0.5f, 0.1f, 0f, Tween.EaseIn, (LoopType)0, (Action)null, (Action)null, true);
				yield return Singleton<BoardManager>.Instance.AssignCardToSlot(card, targetSlot, 0.1f, (Action)null, true);
				if ((Object)(object)card != (Object)null && !card.Dead)
				{
					card.SetIsOpponentCard(!targetPlayerSide);
				}
			}
		}

		public static void ScheduleCheck()
		{
			if (!checking && !((Object)(object)Singleton<BoardManager>.Instance == (Object)null))
			{
				((MonoBehaviour)Singleton<BoardManager>.Instance).StartCoroutine(CheckAndMoveAll());
			}
		}

		public static IEnumerator AfterBalanceSequence(IEnumerator original)
		{
			while (original.MoveNext())
			{
				yield return original.Current;
			}
			yield return CheckAndMoveAll();
		}
	}
	public class OpportunistBehaviour : ExtendedAbilityBehaviour
	{
		public override Ability Ability => OpportunistAPI.OpportunistAbility;

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

		public override IEnumerator OnResolveOnBoard()
		{
			yield return OpportunistBalanceWatcher.CheckAndMoveAll();
		}
	}
}
namespace OLD_SA.Molting
{
	public static class MoltingAPI
	{
		public static FullAbility ability;

		public static void Init()
		{
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Molting";
			val.rulebookName = "Molting";
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.powerLevel = 3;
			val.opponentUsable = false;
			val.canStack = false;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Molting.png", (FilterMode)0);
			FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(val, "At the end of the turn, [creature] takes 1 additional damage. At the end of the next turn, remove this effect and gain Armored. This repeats.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(MoltingBehaviour), imageAsTexture);
			if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
			{
				ProgressionData.Data.learnedAbilities.Add(ability.Id);
			}
		}
	}
	public class MoltingBehaviour : ExtendedAbilityBehaviour, IModifyDamageTaken
	{
		public static List<MoltingBehaviour> ActiveMolting = new List<MoltingBehaviour>();

		private bool molting;

		private bool processingTurnEnd;

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

		private void Awake()
		{
			RegisterMolting();
		}

		private void RegisterMolting()
		{
			if (!ActiveMolting.Contains(this))
			{
				ActiveMolting.Add(this);
			}
		}

		private void RemoveMolting()
		{
			ActiveMolting.Remove(this);
		}

		private void OnDestroy()
		{
			RemoveMolting();
		}

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

		public bool RespondsToModifyDamageTaken(PlayableCard card, int damage, PlayableCard attacker, int amount)
		{
			if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead || !((AbilityBehaviour)this).Card.OnBoard || (Object)(object)card != (Object)(object)((AbilityBehaviour)this).Card)
			{
				return false;
			}
			return molting;
		}

		public int OnModifyDamageTaken(PlayableCard card, int damage, PlayableCard attacker, int amount)
		{
			if (!molting)
			{
				return damage;
			}
			return damage + 1;
		}

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

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

		public IEnumerator OnWaterborneTurnEnd(bool playerTurnEnd)
		{
			if (IsActiveForMolting())
			{
				bool isPlayerCard = !((AbilityBehaviour)this).Card.OpponentCard;
				if (playerTurnEnd == isPlayerCard)
				{
					yield return ProcessTurnEnd();
				}
			}
		}

		private IEnumerator ProcessTurnEnd()
		{
			if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead || processingTurnEnd)
			{
				yield break;
			}
			processingTurnEnd = true;
			try
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead)
				{
					yield break;
				}
				if (molting)
				{
					molting = false;
					if (OLD_SA_TraitAPI.HasOldSaTrait(((AbilityBehaviour)this).Card, "OLD_SA_BLOOD_BOLETE_ARMOR"))
					{
						OLD_SA_LifeShield shield = ((Component)((AbilityBehaviour)this).Card).GetComponent<OLD_SA_LifeShield>();
						if ((Object)(object)shield == (Object)null)
						{
							shield = ((Component)((AbilityBehaviour)this).Card).gameObject.AddComponent<OLD_SA_LifeShield>();
						}
						shield.AddShield(1);
					}
					else
					{
						CardModificationInfo armor = new CardModificationInfo((Ability)54);
						((AbilityBehaviour)this).Card.AddTemporaryMod(armor);
					}
					if ((Object)(object)((Card)((AbilityBehaviour)this).Card).Anim != (Object)null)
					{
						((Card)((AbilityBehaviour)this).Card).Anim.LightNegationEffect();
					}
					((Card)((AbilityBehaviour)this).Card).RenderCard();
					yield return null;
					if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && !((AbilityBehaviour)this).Card.Dead)
					{
						((AbilityBehaviour)this).Card.UpdateFaceUpOnBoardEffects();
						yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
					}
				}
				else
				{
					molting = true;
					if ((Object)(object)((Card)((AbilityBehaviour)this).Card).Anim != (Object)null)
					{
						((Card)((AbilityBehaviour)this).Card).Anim.LightNegationEffect();
					}
					yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
				}
			}
			finally
			{
				processingTurnEnd = false;
			}
		}

		public int TriggerPriority(PlayableCard card, int damage, PlayableCard attacker)
		{
			return 0;
		}
	}
}
namespace OLD_SA.Miser
{
	public static class MiserAPI
	{
		public static FullAbility ability;

		public static void Init()
		{
			//IL_00bc: 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)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Miser";
			val.rulebookName = "Miser";
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.powerLevel = 4;
			val.opponentUsable = false;
			val.canStack = false;
			val.activated = true;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Miser.png", (FilterMode)0);
			FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(val, "When you click this [creature], pay 4 Teeth to gain Death Shield.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(MiserBehaviour), imageAsTexture);
			if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
			{
				ProgressionData.Data.learnedAbilities.Add(ability.Id);
			}
		}
	}
	public class MiserBehaviour : ActivatedAbilityBehaviour
	{
		public override Ability Ability => MiserAPI.ability.Id;

		protected override bool CanActivate()
		{
			return (Object)(object)((AbilityBehaviour)this).Card != (Object)null && !((AbilityBehaviour)this).Card.Dead && ((AbilityBehaviour)this).Card.OnBoard && RunState.Run != null && RunState.Run.currency >= 4;
		}

		protected override IEnumerator Activate()
		{
			if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead || !((AbilityBehaviour)this).Card.OnBoard)
			{
				yield break;
			}
			List<Rigidbody> teeth = Singleton<CurrencyBowl>.Instance.TakeWeights(4);
			foreach (Rigidbody tooth in teeth)
			{
				if (!((Object)(object)tooth == (Object)null))
				{
					yield return (object)new WaitForSeconds(0.1f);
					float delay = (float)teeth.IndexOf(tooth) * 0.05f;
					Tween.Position(((Component)tooth).transform, ((Component)tooth).transform.position + Vector3.up * 0.5f, 0.075f, delay, Tween.EaseIn, (LoopType)0, (Action)null, (Action)null, true);
					Tween.Position(((Component)tooth).transform, new Vector3(0f, 5.5f, 4f), 0.3f, 0.125f + delay, Tween.EaseOut, (LoopType)0, (Action)null, (Action)null, true);
					Object.Destroy((Object)(object)((Component)tooth).gameObject, 0.5f);
				}
			}
			yield return (object)new WaitForSeconds(0.5f);
			if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && !((AbilityBehaviour)this).Card.Dead && ((AbilityBehaviour)this).Card.OnBoard)
			{
				CardModificationInfo armor = new CardModificationInfo((Ability)54);
				((AbilityBehaviour)this).Card.AddTemporaryMod(armor);
				if ((Object)(object)((Card)((AbilityBehaviour)this).Card).Anim != (Object)null)
				{
					((Card)((AbilityBehaviour)this).Card).Anim.LightNegationEffect();
				}
				((Card)((AbilityBehaviour)this).Card).RenderCard();
				yield return null;
				if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && !((AbilityBehaviour)this).Card.Dead)
				{
					((AbilityBehaviour)this).Card.UpdateFaceUpOnBoardEffects();
					yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
				}
			}
		}
	}
}
namespace OLD_SA.MalformedSpikes
{
	public static class MalformedSpikesAPI
	{
		public static FullAbility ability;

		public static void Init()
		{
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Malformed Spikes";
			val.rulebookName = "Malformed Spikes";
			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_Malformed_Spikes.png", (FilterMode)0);
			FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(val, "When [creature] takes damage, it deals 1 damage to a random opposing creature twice.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(MalformedSpikesBehaviour), imageAsTexture);
			if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
			{
				ProgressionData.Data.learnedAbilities.Add(ability.Id);
			}
		}
	}
	public class MalformedSpikesBehaviour : AbilityBehaviour
	{
		public override Ability Ability => MalformedSpikesAPI.ability.Id;

		public override bool RespondsToTakeDamage(PlayableCard source)
		{
			return (Object)(object)((AbilityBehaviour)this).Card != (Object)null && !((AbilityBehaviour)this).Card.Dead && ((AbilityBehaviour)this).Card.OnBoard && (Object)(object)source != (Object)null && source.Health > 0;
		}

		private static int GetMalformedSpikesSeed()
		{
			SaveFile saveFile = SaveManager.SaveFile;
			if (saveFile == null)
			{
				return 0;
			}
			int currentRandomSeed = saveFile.GetCurrentRandomSeed();
			FieldInfo fieldInfo = AccessTools.Field(typeof(SaveFile), "randomSeed");
			if (fieldInfo != null)
			{
				int num = (int)fieldInfo.GetValue(saveFile);
				fieldInfo.SetValue(saveFile, num + 1);
			}
			else
			{
				Debug.LogError((object)"[MalformedSpikes] 找不到 SaveFile.randomSeed,无法推进随机种子。");
			}
			return currentRandomSeed;
		}

		private PlayableCard GetRandomEnemy()
		{
			if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null)
			{
				return null;
			}
			List<PlayableCard> list = new List<PlayableCard>();
			List<CardSlot> list2 = (((AbilityBehaviour)this).Card.OpponentCard ? Singleton<BoardManager>.Instance.PlayerSlotsCopy : Singleton<BoardManager>.Instance.OpponentSlotsCopy);
			foreach (CardSlot item in list2)
			{
				if (!((Object)(object)item == (Object)null) && !((Object)(object)item.Card == (Object)null) && !item.Card.Dead && item.Card.OnBoard)
				{
					list.Add(item.Card);
				}
			}
			if (list.Count == 0)
			{
				return null;
			}
			int malformedSpikesSeed = GetMalformedSpikesSeed();
			int index = SeededRandom.Range(0, list.Count, malformedSpikesSeed);
			return list[index];
		}

		public override IEnumerator OnTakeDamage(PlayableCard source)
		{
			yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
			if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead || !((AbilityBehaviour)this).Card.OnBoard)
			{
				yield break;
			}
			((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
			yield return (object)new WaitForSeconds(0.55f);
			for (int i = 0; i < 2; i++)
			{
				if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead || !((AbilityBehaviour)this).Card.OnBoard)
				{
					yield break;
				}
				PlayableCard target = GetRandomEnemy();
				if ((Object)(object)target == (Object)null)
				{
					yield break;
				}
				yield return target.TakeDamage(1, ((AbilityBehaviour)this).Card);
				if (i == 0)
				{
					yield return (object)new WaitForSeconds(0.15f);
				}
			}
			yield return ((AbilityBehaviour)this).LearnAbility(0.4f);
		}
	}
}
namespace OLD_SA.Lightning
{
	public static class LightningAPI
	{
		public static FullAbility ability;

		public static Ability LightningAbility;

		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)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Lightning";
			val.rulebookName = "Lightning";
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.powerLevel = 2;
			val.opponentUsable = true;
			val.canStack = false;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OLD_SA_Lightning.png", (FilterMode)0);
			Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("OLD_SA_Lightning_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, "At the end of the owner's turn, [creature] moves repeatedly in one direction until it can move no further.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(LightningBehaviour), imageAsTexture);
			LightningAbility = val.ability;
			if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
			{
				ProgressionData.Data.learnedAbilities.Add(ability.Id);
			}
		}
	}
	public class LightningBehaviour : Strafe
	{
		public override Ability Ability => LightningAPI.ability.Id;

		protected override IEnumerator DoStrafe(CardSlot toLeft, CardSlot toRight)
		{
			bool leftAvailable = (Object)(object)toLeft != (Object)null && (Object)(object)toLeft.Card == (Object)null;
			bool rightAvailable = (Object)(object)toRight != (Object)null && (Object)(object)toRight.Card == (Object)null;
			if (base.movingLeft && !leftAvailable)
			{
				base.movingLeft = false;
			}
			if (!base.movingLeft && !rightAvailable)
			{
				base.movingLeft = true;
			}
			CardSlot currentSlot = ((AbilityBehaviour)this).Card.Slot;
			bool moved = false;
			if (base.movingLeft)
			{
				while (true)
				{
					CardSlot next = Singleton<BoardManager>.Instance.GetAdjacent(currentSlot, true);
					if ((Object)(object)next == (Object)null || (Object)(object)next.Card != (Object)null)
					{
						break;
					}
					yield return ((Strafe)this).MoveToSlot(next, true);
					currentSlot = next;
					moved = true;
					yield return (object)new WaitForSeconds(0.05f);
				}
			}
			else
			{
				while (true)
				{
					CardSlot next2 = Singleton<BoardManager>.Instance.GetAdjacent(currentSlot, false);
					if ((Object)(object)next2 == (Object)null || (Object)(object)next2.Card != (Object)null)
					{
						break;
					}
					yield return ((Strafe)this).MoveToSlot(next2, true);
					currentSlot = next2;
					moved = true;
					yield return (object)new WaitForSeconds(0.05f);
				}
			}
			if (moved)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
			}
			else
			{
				((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
				yield return (object)new WaitForSeconds(0.15f);
			}
		}
	}
}
namespace OLD_SA.InstinctiveContainment
{
	public static class InstinctiveContainmentAPI
	{
		public static FullAbility ability;

		public static void Init()
		{
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Instinctive Containment";
			val.rulebookName = "Instinctive Containment";
			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_InstinctiveContainment.png", (FilterMode)0);
			FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(val, "When [creature] would attack, it prevents the attack. When it perishes, it attacks once for each attack it prevented.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(InstinctiveContainmentBehaviour), imageAsTexture);
			if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
			{
				ProgressionData.Data.learnedAbilities.Add(ability.Id);
			}
		}
	}
	public class InstinctiveContainmentBehaviour : AbilityBehaviour
	{
		public override Ability Ability => InstinctiveContainmentAPI.ability.Id;

		public override bool RespondsToPreDeathAnimation(bool wasSacrifice)
		{
			return !wasSacrifice && InstinctiveContainmentPatch.GetBlockedCount(((AbilityBehaviour)this).Card) > 0;
		}

		public override IEnumerator OnPreDeathAnimation(bool wasSacrifice)
		{
			if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || (Object)(object)((AbilityBehaviour)this).Card.Slot == (Object)null)
			{
				yield break;
			}
			int blockedCount = InstinctiveContainmentPatch.TakeBlockedCount(((AbilityBehaviour)this).Card);
			if (blockedCount <= 0)
			{
				yield break;
			}
			yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
			CardSlot attackingSlot = ((AbilityBehaviour)this).Card.Slot;
			if (!((Object)(object)attackingSlot == (Object)null))
			{
				CardSlot targetSlot = attackingSlot.opposingSlot;
				InstinctiveContainmentPatch.BeginDeathAttacks(((AbilityBehaviour)this).Card);
				try
				{
					yield return CustomAttackResolver.RequestAttacks(attackingSlot, targetSlot, blockedCount, true);
				}
				finally
				{
					InstinctiveContainmentPatch.EndDeathAttacks(((AbilityBehaviour)this).Card);
				}
			}
		}
	}
	[HarmonyPatch(typeof(CombatPhaseManager), "SlotAttackSlot")]
	[HarmonyPriority(0)]
	public static class InstinctiveContainmentPatch
	{
		private static readonly Dictionary<PlayableCard, int> BlockedAttackCounts = new Dictionary<PlayableCard, int>();

		private static readonly HashSet<PlayableCard> ActiveDeathAttackers = new HashSet<PlayableCard>();

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

		public static int TakeBlockedCount(PlayableCard card)
		{
			if ((Object)(object)card == (Object)null)
			{
				return 0;
			}
			int blockedCount = GetBlockedCount(card);
			BlockedAttackCounts.Remove(card);
			return blockedCount;
		}

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

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

		private static bool IsDeathAttack(PlayableCard card)
		{
			return (Object)(object)card != (Object)null && ActiveDeathAttackers.Contains(card);
		}

		[HarmonyPrefix]
		public static bool SlotAttackSlot(CardSlot attackingSlot, CardSlot opposingSlot, float waitAfter = 0f)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)attackingSlot == (Object)null || (Object)(object)attackingSlot.Card == (Object)null)
			{
				return true;
			}
			PlayableCard card = attackingSlot.Card;
			if (InstinctiveContainmentAPI.ability == null || !card.HasAbility(InstinctiveContainmentAPI.ability.Id))
			{
				return true;
			}
			if (IsDeathAttack(card))
			{
				return true;
			}
			if (!BlockedAttackCounts.ContainsKey(card))
			{
				BlockedAttackCounts[card] = 0;
			}
			BlockedAttackCounts[card]++;
			((Card)card).Anim.StrongNegationEffect();
			return false;
		}
	}
}
namespace OLD_SA.Hover
{
	public static class HoverAPI
	{
		public static FullAbility ability;

		public static Ability HoverAbility;

		public static void Init()
		{
			//IL_00b2: 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_00cb: 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)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Hover";
			val.rulebookName = "Hover";
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.powerLevel = 1;
			val.opponentUsable = false;
			val.canStack = false;
			val.activated = true;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Hover.png", (FilterMode)0);
			FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(val, "When you click [creature], toggle its Airborne ability.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(HoverBehaviour), imageAsTexture);
			HoverAbility = ability.Id;
			if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
			{
				ProgressionData.Data.learnedAbilities.Add(ability.Id);
			}
		}
	}
	public class HoverBehaviour : ExtendedActivatedAbilityBehaviour
	{
		public override Ability Ability => HoverAPI.ability.Id;

		public override IEnumerator Activate()
		{
			if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead || !((AbilityBehaviour)this).Card.OnBoard)
			{
				yield break;
			}
			yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
			if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && !((AbilityBehaviour)this).Card.Dead && ((AbilityBehaviour)this).Card.OnBoard)
			{
				CardModificationInfo mod = new CardModificationInfo();
				mod.singletonId = "OLD_SA_Hover_Toggle";
				if (((AbilityBehaviour)this).Card.HasAbility((Ability)19))
				{
					mod.negateAbilities = new List<Ability> { (Ability)19 };
				}
				else
				{
					mod.abilities = new List<Ability> { (Ability)19 };
				}
				((AbilityBehaviour)this).Card.AddTemporaryMod(mod);
				((Card)((AbilityBehaviour)this).Card).RenderCard();
				yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
			}
		}
	}
}
namespace OLD_SA.Fragile
{
	public static class FragileAPI
	{
		public static FullAbility ability;

		public static Ability FragileAbility;

		public static void Init()
		{
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Fragile";
			val.rulebookName = "Fragile";
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.powerLevel = -3;
			val.opponentUsable = false;
			val.canStack = false;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Fragile.png", (FilterMode)0);
			Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("OldSa_Fragile_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] takes damage, it perishes.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(FragileBehaviour), imageAsTexture);
			FragileAbility = val.ability;
		}
	}
	public class FragileBehaviour : AbilityBehaviour
	{
		public override Ability Ability => FragileAPI.ability.Id;

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

		public override IEnumerator OnTakeDamage(PlayableCard source)
		{
			if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && !((AbilityBehaviour)this).Card.Dead)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && !((AbilityBehaviour)this).Card.Dead)
				{
					yield return ((AbilityBehaviour)this).Card.Die(false, source, true);
					yield return ((AbilityBehaviour)this).LearnAbility(0.1f);
				}
			}
		}
	}
}
namespace OLD_SA.FoulSten
{
	public class FoulStenBehaviour : ExtendedAbilityBehaviour
	{
		private List<int> slotDebuffs = new List<int>();

		private int nextSlotIndex = 1;

		private bool initialized = false;

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

		private List<CardSlot> GetOpposingSlots()
		{
			if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null)
			{
				return new List<CardSlot>();
			}
			BoardManager instance = Singleton<BoardManager>.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return new List<CardSlot>();
			}
			if (((AbilityBehaviour)this).Card.OpponentCard)
			{
				return instance.PlayerSlotsCopy;
			}
			return instance.OpponentSlotsCopy;
		}

		private void EnsureSlotDebuffs(int count)
		{
			if (count <= 0)
			{
				return;
			}
			if (!initialized)
			{
				slotDebuffs.Clear();
				for (int i = 0; i < count; i++)
				{
					slotDebuffs.Add(0);
				}
				slotDebuffs[0] = 1;
				nextSlotIndex = 1 % count;
				initialized = true;
			}
			else
			{
				while (slotDebuffs.Count < count)
				{
					slotDebuffs.Add(0);
				}
				while (slotDebuffs.Count > count)
				{
					slotDebuffs.RemoveAt(slotDebuffs.Count - 1);
				}
				nextSlotIndex %= count;
			}
		}

		public override int GetPassiveAttackBuff(PlayableCard target)
		{
			if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead || !((AbilityBehaviour)this).Card.OnBoard || (Object)(object)target == (Object)null || target.Dead || (Object)(object)target.Slot == (Object)null)
			{
				return 0;
			}
			if (target.OpponentCard == ((AbilityBehaviour)this).Card.OpponentCard)
			{
				return 0;
			}
			List<CardSlot> opposingSlots = GetOpposingSlots();
			EnsureSlotDebuffs(opposingSlots.Count);
			int num = opposingSlots.IndexOf(target.Slot);
			if (num < 0 || num >= slotDebuffs.Count)
			{
				return 0;
			}
			return -slotDebuffs[num];
		}

		public override bool RespondsToTakeDamage(PlayableCard source)
		{
			if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead || !((AbilityBehaviour)this).Card.OnBoard)
			{
				return false;
			}
			List<CardSlot> opposingSlots = GetOpposingSlots();
			return opposingSlots.Count > 0;
		}

		public override IEnumerator OnTakeDamage(PlayableCard source)
		{
			if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead || !((AbilityBehaviour)this).Card.OnBoard)
			{
				yield break;
			}
			List<CardSlot> opposingSlots = GetOpposingSlots();
			if (opposingSlots.Count != 0)
			{
				EnsureSlotDebuffs(opposingSlots.Count);
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				int index = nextSlotIndex;
				slotDebuffs[index]++;
				nextSlotIndex++;
				if (nextSlotIndex >= opposingSlots.Count)
				{
					nextSlotIndex = 0;
				}
				CardSlot targetSlot = opposingSlots[index];
				if ((Object)(object)targetSlot != (Object)null && (Object)(object)targetSlot.Card != (Object)null)
				{
					((Card)targetSlot.Card).RenderCard();
				}
				yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
			}
		}
	}
	public static class FoulStenAPI
	{
		public static FullAbility ability;

		public static void Init()
		{
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Foul Stench";
			val.rulebookName = "Foul Stench";
			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_FoulSten.png", (FilterMode)0);
			FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(val, "[creature] gives the enemy creature in the first slot -1 Attack. Whenever [creature] is damaged, this effect spreads to the next slot.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(FoulStenBehaviour), imageAsTexture);
			if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
			{
				ProgressionData.Data.learnedAbilities.Add(ability.Id);
			}
		}
	}
}
namespace OLD_SA.ForceEntry
{
	public static class ForceEntryAPI
	{
		public static FullAbility ability;

		public static Ability ForceEntryAbility;

		public static void Init()
		{
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: 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)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Force Entry";
			val.rulebookName = "Force Entry";
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.powerLevel = 3;
			val.opponentUsable = false;
			val.canStack = false;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_ForceEntry.png", (FilterMode)0);
			FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(val, "When an enemy creature dies, [creature] kills a random friendly creature, gains 2 Power, then enters play.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(ForceEntryBehaviour), imageAsTexture);
			ForceEntryAbility = val.ability;
			if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
			{
				ProgressionData.Data.learnedAbilities.Add(ability.Id);
			}
		}
	}
	public class ForceEntryBehaviour : AbilityBehaviour
	{
		public override Ability Ability => ForceEntryAPI.ability.Id;

		public override int Priority => -1;

		private List<PlayableCard> GetFriendlyCards()
		{
			List<PlayableCard> list = new List<PlayableCard>();
			List<CardSlot> playerSlotsCopy = Singleton<BoardManager>.Instance.PlayerSlotsCopy;
			foreach (CardSlot item in playerSlotsCopy)
			{
				if (!((Object)(object)item == (Object)null) && !((Object)(object)item.Card == (Object)null))
				{
					PlayableCard card = item.Card;
					if (!card.Dead && card.OnBoard && !card.OpponentCard && !((Object)(object)card.Slot == (Object)null))
					{
						list.Add(card);
					}
				}
			}
			return list;
		}

		private PlayableCard GetRandomFriendlyCard()
		{
			List<PlayableCard> friendlyCards = GetFriendlyCards();
			if (friendlyCards.Count == 0)
			{
				return null;
			}
			int currentRandomSeed = SaveManager.SaveFile.GetCurrentRandomSeed();
			int index = SeededRandom.Range(0, friendlyCards.Count, currentRandomSeed);
			FieldInfo field = ((object)SaveManager.SaveFile).GetType().GetField("randomSeed", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(SaveManager.SaveFile, currentRandomSeed + 1);
			}
			return friendlyCards[index];
		}

		public override bool RespondsToOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
		{
			if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead)
			{
				return false;
			}
			PlayerHand instance = Singleton<PlayerHand>.Instance;
			if ((Object)(object)instance == (Object)null || !instance.CardsInHand.Contains(((AbilityBehaviour)this).Card))
			{
				return false;
			}
			if ((Object)(object)card == (Object)null || !card.OpponentCard)
			{
				return false;
			}
			return GetFriendlyCards().Count > 0;
		}

		public override IEnumerator OnOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
		{
			if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || (Object)(object)card == (Object)null)
			{
				yield break;
			}
			PlayerHand hand = Singleton<PlayerHand>.Instance;
			if ((Object)(object)hand == (Object)null || !hand.CardsInHand.Contains(((AbilityBehaviour)this).Card))
			{
				yield break;
			}
			yield return (object)new WaitForSeconds(0.5f);
			if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead || !hand.CardsInHand.Contains(((AbilityBehaviour)this).Card))
			{
				yield break;
			}
			PlayableCard targetCard = GetRandomFriendlyCard();
			if (!((Object)(object)targetCard == (Object)null) && !targetCard.Dead && targetCard.OnBoard && !((Object)(object)targetCard.Slot == (Object)null))
			{
				CardSlot targetSlot = targetCard.Slot;
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				yield return targetCard.Die(false, ((AbilityBehaviour)this).Card, true);
				yield return (object)new WaitForSeconds(0.1f);
				if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && !((AbilityBehaviour)this).Card.Dead && hand.CardsInHand.Contains(((AbilityBehaviour)this).Card) && !((Object)(object)targetSlot == (Object)null) && !((Object)(object)targetSlot.Card != (Object)null))
				{
					CardModificationInfo powerMod = new CardModificationInfo(2, 0);
					((AbilityBehaviour)this).Card.AddTemporaryMod(powerMod);
					((Card)((AbilityBehaviour)this).Card).RenderCard();
					yield return hand.PlayCardOnSlot(((AbilityBehaviour)this).Card, targetSlot);
					yield return ((AbilityBehaviour)this).LearnAbility(0.5f);
				}
			}
		}
	}
}
namespace OLD_SA.ForcedMarch
{
	public static class ForcedMarchAPI
	{
		public static FullAbility ability;

		public static Ability ForcedMarchAbility;

		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)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Forced March";
			val.rulebookName = "Forced March";
			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_Forced_March.png", (FilterMode)0);
			Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("OldSa_Forced_March_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 a friendly creature moves, [creature] gains 1 Power until the end of its next turn.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(ForcedMarchBehaviour), imageAsTexture);
			ForcedMarchAbility = val.ability;
			if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
			{
				ProgressionData.Data.learnedAbilities.Add(ability.Id);
			}
		}
	}
	public class ForcedMarchBehaviour : ExtendedAbilityBehaviour
	{
		public static List<ForcedMarchBehaviour> ActiveForcedMarch = new List<ForcedMarchBehaviour>();

		private int expiringStacks = 0;

		private int currentTurnStacks = 0;

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

		private void Awake()
		{
			if (!ActiveForcedMarch.Contains(this))
			{
				ActiveForcedMarch.Add(this);
			}
		}

		private void OnDestroy()
		{
			ActiveForcedMarch.Remove(this);
		}

		public override int GetPassiveAttackBuff(PlayableCard target)
		{
			if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead || !((AbilityBehaviour)this).Card.OnBoard || (Object)(object)target != (Object)(object)((AbilityBehaviour)this).Card)
			{
				return 0;
			}
			return expiringStacks + currentTurnStacks;
		}

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

		public override IEnumerator OnOtherCardAssignedToSlot(PlayableCard otherCard)
		{
			if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && !((AbilityBehaviour)this).Card.Dead && ((AbilityBehaviour)this).Card.OnBoard && !((Object)(object)otherCard == (Object)null) && !otherCard.Dead && !((Object)(object)otherCard.Slot == (Object)null) && otherCard.OpponentCard == ((AbilityBehaviour)this).Card.OpponentCard && ForcedMarchPatch.IsActualMovement(otherCard))
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				currentTurnStacks++;
				yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
			}
		}

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

		public override IEnumerator OnTurnEnd(bool playerTurnEnd)
		{
			if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && !((AbilityBehaviour)this).Card.Dead && ((AbilityBehaviour)this).Card.OnBoard)
			{
				bool isPlayerCard = !((AbilityBehaviour)this).Card.OpponentCard;
				if (playerTurnEnd == isPlayerCard)
				{
					expiringStacks = currentTurnStacks;
					currentTurnStacks = 0;
				}
			}
			yield break;
		}
	}
	[HarmonyPatch(typeof(BoardManager), "AssignCardToSlot")]
	public static class ForcedMarchPatch
	{
		public class AssignmentRecord
		{
			public CardSlot PreviousSlot;

			public CardSlot DestinationSlot;

			public bool IsMovement => (Object)(object)PreviousSlot != (Object)null && (Object)(object)DestinationSlot != (Object)null && (Object)(object)PreviousSlot != (Object)(object)DestinationSlot;

			public AssignmentRecord(CardSlot previousSlot, CardSlot destinationSlot)
			{
				PreviousSlot = previousSlot;
				DestinationSlot = destinationSlot;
			}
		}

		public static readonly Dictionary<PlayableCard, AssignmentRecord> Assignments = new Dictionary<PlayableCard, AssignmentRecord>();

		[HarmonyPrefix]
		public static void Prefix(PlayableCard card, CardSlot slot)
		{
			if (!((Object)(object)card == (Object)null))
			{
				Assignments[card] = new AssignmentRecord(card.Slot, slot);
			}
		}

		public static bool IsActualMovement(PlayableCard card)
		{
			if ((Object)(object)card == (Object)null || (Object)(object)card.Slot == (Object)null)
			{
				return false;
			}
			if (!Assignments.TryGetValue(card, out var value))
			{
				return false;
			}
			if ((Object)(object)value.DestinationSlot != (Object)(object)card.Slot)
			{
				return false;
			}
			return value.IsMovement;
		}
	}
}
namespace OLD_SA.FatalBargain
{
	public static class FatalBargainAPI
	{
		public static FullAbility ability;

		public static Ability FatalBargainAbility;

		public static void Init()
		{
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Fatal Bargain";
			val.rulebookName = "Fatal Bargain";
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.powerLevel = -5;
			val.opponentUsable = false;
			val.canStack = false;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_FatalBargain.png", (FilterMode)0);
			FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(val, "While [creature] is on the field, the player cannot draw a card at the start of each turn.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(FatalBargainBehaviour), imageAsTexture);
			FatalBargainAbility = val.ability;
		}
	}
	public class FatalBargainBehaviour : AbilityBehaviour
	{
		public override Ability Ability => FatalBargainAPI.FatalBargainAbility;
	}
	[HarmonyPatch]
	public static class FatalBargainPatch
	{
		private static bool HasFatalBargain()
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Singleton<BoardManager>.Instance == (Object)null)
			{
				return false;
			}
			List<CardSlot> playerSlotsCopy = Singleton<BoardManager>.Instance.PlayerSlotsCopy;
			if (playerSlotsCopy == null)
			{
				return false;
			}
			foreach (CardSlot item in playerSlotsCopy)
			{
				if ((Object)(object)item == (Object)null || (Object)(object)item.Card == (Object)null || !item.Card.HasAbility(FatalBargainAPI.FatalBargainAbility))
				{
					continue;
				}
				return true;
			}
			return false;
		}

		private static MethodBase TargetMethod()
		{
			Type type = typeof(CardDrawPiles).GetNestedTypes(BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault((Type t) => t.Name.StartsWith("<DrawPhaseSequence>", StringComparison.Ordinal));
			if (type == null)
			{
				return null;
			}
			return AccessTools.Method(type, "MoveNext", (Type[])null, (Type[])null);
		}

		private static CardDrawPiles GetOwner(object stateMachine)
		{
			if (stateMachine == null)
			{
				return null;
			}
			FieldInfo fieldInfo = AccessTools.Field(stateMachine.GetType(), "<>4__this");
			if (fieldInfo == null)
			{
				return null;
			}
			object? value = fieldInfo.GetValue(stateMachine);
			return (CardDrawPiles)((value is CardDrawPiles) ? value : null);
		}

		private static bool IsExhausted(CardDrawPiles piles)
		{
			if ((Object)(object)piles == (Object)null)
			{
				return false;
			}
			PropertyInfo propertyInfo = AccessTools.Property(typeof(CardDrawPiles), "Exhausted");
			if (propertyInfo != null)
			{
				return Convert.ToBoolean(propertyInfo.GetValue(piles, null));
			}
			FieldInfo fieldInfo = AccessTools.Field(typeof(CardDrawPiles), "Exhausted");
			if (fieldInfo != null)
			{
				return Convert.ToBoolean(fieldInfo.GetValue(piles));
			}
			return false;
		}

		[HarmonyPrefix]
		public static bool Prefix(object __instance, ref bool __result)
		{
			CardDrawPiles owner = GetOwner(__instance);
			if ((Object)(object)owner == (Object)null)
			{
				return true;
			}
			if (!HasFatalBargain())
			{
				return true;
			}
			if (IsExhausted(owner))
			{
				return true;
			}
			__result = false;
			return false;
		}
	}
}
namespace OLD_SA.EnrageArmor
{
	public static class EnrageArmorAPI
	{
		public static FullAbility ability;

		public static Ability EnrageArmorAbility;

		public static void Init()
		{
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Enrage Armor";
			val.rulebookName = "Enrage Armor";
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.powerLevel = 3;
			val.opponentUsable = false;
			val.canStack = false;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_EnrageArmor.png", (FilterMode)0);
			FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(val, "Whenever [creature] loses 1 stack of DeathShield, it gains 2 Power.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(EnrageArmorBehaviour), imageAsTexture);
			EnrageArmorAbility = val.ability;
		}
	}
	public class EnrageArmorBehaviour : AbilityBehaviour
	{
		public override Ability Ability => EnrageArmorAPI.EnrageArmorAbility;
	}
	[HarmonyPatch(typeof(ShieldManager), "BreakShield")]
	public static class EnrageArmorPatch
	{
		[HarmonyPostfix]
		public static void Postfix(PlayableCard target, int damage, PlayableCard attacker)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			if (!((Object)(object)target == (Object)null) && !((Object)(object)((Card)target).Info == (Object)null) && !target.Dead && target.HasAbility(EnrageArmorAPI.EnrageArmorAbility))
			{
				CardModificationInfo val = new CardModificationInfo();
				val.attackAdjustment = 2;
				target.AddTemporaryMod(val);
				if ((Object)(object)((Card)target).Anim != (Object)null)
				{
					((Card)target).Anim.LightNegationEffect();
				}
				((Card)target).RenderCard();
			}
		}
	}
}
namespace OLD_SA.Enrage
{
	public static class EnrageAPI
	{
		public static FullAbility ability;

		public static Ability EnrageAbility;

		public static void Init()
		{
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Enrage";
			val.rulebookName = "Enrage";
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.powerLevel = -2;
			val.opponentUsable = false;
			val.canStack = false;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Enrage.png", (FilterMode)0);
			Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("OldSa_Enrage_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] deals damage, the target gains 1 Power.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(EnrageBehaviour), imageAsTexture);
			EnrageAbility = val.ability;
		}
	}
	public class EnrageBehaviour : AbilityBehaviour
	{
		public override Ability Ability => EnrageAPI.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;
			}
			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))
			{
				CardModificationInfo mod = new CardModificationInfo();
				mod.attackAdjustment = 1;
				target.AddTemporaryMod(mod);
				yield return (object)new WaitForSeconds(0.15f);
			}
		}
	}
	public class Imitator : VariableStatBehaviour
	{
		public static SpecialStatIcon iconType;

		protected override SpecialStatIcon IconType => iconType;

		public static void Init()
		{
			//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)
			StatIconInfo val = ScriptableObject.CreateInstance<StatIconInfo>();
			val.rulebookName = "Imitator";
			val.rulebookDescription = "This creature's attack is equal to the attack of the creature that attacked most recently while it was on the board.";
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("imitator.png", (FilterMode)0);
			val.iconGraphic = (Texture)(object)imageAsTexture;
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.appliesToAttack = true;
			val.appliesToHealth = false;
			FullStatIcon val2 = StatIconManager.Add("OLD_SA", val, typeof(Imitator));
			iconType = val2.Id;
		}

		protected override int[] GetStatValues()
		{
			int num = ImitatorAttackTracker.GetAttack(((SpecialCardBehaviour)this).PlayableCard);
			if (num < 0)
			{
				num = 0;
			}
			return new int[2] { num, 0 };
		}

		private void Awake()
		{
			if ((Object)(object)((SpecialCardBehaviour)this).PlayableCard != (Object)null)
			{
				ImitatorAttackTracker.Register(((SpecialCardBehaviour)this).PlayableCard);
			}
		}

		private void OnDestroy()
		{
			if ((Object)(object)((SpecialCardBehaviour)this).PlayableCard != (Object)null)
			{
				ImitatorAttackTracker.Unregister(((SpecialCardBehaviour)this).PlayableCard);
			}
		}
	}
	[HarmonyPatch(typeof(CombatPhaseManager), "SlotAttackSlot")]
	public static class ImitatorAttackPatch
	{
		public static IEnumerator Postfix(IEnumerator result, CardSlot attackingSlot)
		{
			while (result.MoveNext())
			{
				yield return result.Current;
			}
			if ((Object)(object)attackingSlot == (Object)null || (Object)(object)attackingSlot.Card == (Object)null)
			{
				yield break;
			}
			PlayableCard attacker = attackingSlot.Card;
			int attack = attacker.Attack;
			List<PlayableCard> imitators = new List<PlayableCard>();
			foreach (CardSlot slot in Singleton<BoardManager>.Instance.GetSlots(true))
			{
				AddImitator(slot, imitators);
			}
			foreach (CardSlot slot2 in Singleton<BoardManager>.Instance.GetSlots(false))
			{
				AddImitator(slot2, imitators);
			}
			foreach (PlayableCard imitator in imitators)
			{
				if (!((Object)(object)imitator == (Object)(object)attacker))
				{
					ImitatorAttackTracker.RecordAttack(imitator, attack);
				}
			}
		}

		private static void AddImitator(CardSlot slot, List<PlayableCard> imitators)
		{
			if ((Object)(object)slot == (Object)null || (Object)(object)slot.Card == (Object)null)
			{
				return;
			}
			PlayableCard card = slot.Card;
			if (card.OnBoard && !card.Dead)
			{
				Imitator component = ((Component)card).GetComponent<Imitator>();
				if (!((Object)(object)component == (Object)null) && !imitators.Contains(card))
				{
					imitators.Add(card);
				}
			}
		}
	}
	public static class ImitatorAttackTracker
	{
		private static Dictionary<PlayableCard, int> LastAttackValues = new Dictionary<PlayableCard, int>();

		public static void Register(PlayableCard card)
		{
			if (!((Object)(object)card == (Object)null) && !LastAttackValues.ContainsKey(card))
			{
				LastAttackValues.Add(card, -1);
			}
		}

		public static int GetAttack(PlayableCard card)
		{
			if ((Object)(object)card == (Object)null)
			{
				return -1;
			}
			if (LastAttackValues.TryGetValue(card, out var value))
			{
				return value;
			}
			return -1;
		}

		public static void RecordAttack(PlayableCard card, int attack)
		{
			if (!((Object)(object)card == (Object)null))
			{
				if (!LastAttackValues.ContainsKey(card))
				{
					LastAttackValues.Add(card, -1);
				}
				LastAttackValues[card] = attack;
			}
		}

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

		public static void Reset()
		{
			LastAttackValues.Clear();
		}
	}
	[BepInPlugin("OLD_SA.Enrage", "OLD SA Enrage", "1.0.0")]
	public class EnragePlugin : BaseUnityPlugin
	{
		private void Awake()
		{
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Expected O, but got Unknown
			EnrageAPI.Init();
			DoubleDrawAPI.Init();
			ArbiterAPI.Init();
			WaterMusicAPI.Init();
			MoltingAPI.Init();
			Imitator.Init();
			SageBehaviour.Init();
			OsteophagiaAPI.Init();
			WondrousBrushAPI.Init();
			ArmorStrikeAPI.Init();
			EnrageArmorAPI.Init();
			ForcedMarchAPI.Init();
			LightningAPI.Init();
			TwistedGrowthAPI.Init();
			FatalBargainAPI.Init();
			HoverAPI.Init();
			BrittleCopyAPI.Init();
			PackThiefAPI.Init();
			EndlessBreedingAPI.Init();
			UndyingRestAPI.Init();
			FragileAPI.Init();
			BloodDependencyAPI.Init();
			VanishingActAPI.Init();
			CardStealAPI.Init();
			StressResponseAPI.Init();
			DeathBurstAPI.Init();
			OpportunistAPI.Init();
			DeathbornAPI.Init();
			DecayAPI.Init();
			ParasiteAPI.Init();
			MalformedSpikesAPI.Init();
			AmbushAPI.Init();
			OpportunistStrikeAPI.Init();
			CentralStrikeAPI.Init();
			BaitAPI.Init();
			InstinctiveContainmentAPI.Init();
			BloomguardAPI.Init();
			AntsFallAPI.Init();
			Forc

Sigil/OldSa_Entangle_sigil.dll

Decompiled 5 days 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)
		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: 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);
		if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
		{
			ProgressionData.Data.learnedAbilities.Add(ability.Id);
		}
	}
}
public class EntangleBehaviour : AbilityBehaviour
{
	public override Ability Ability => EntangleAPI.ability.Id;

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

	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 && killer.OnBoard)
		{
			((Card)killer).Anim.StrongNegationEffect();
			yield return (object)new WaitForSeconds(0.15f);
			CardModificationInfo mod = new CardModificationInfo();
			mod.attackAdjustment = -2;
			killer.AddTemporaryMod(mod);
			killer.OnStatsChanged();
		}
	}
}
[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_Fighter_sigil.dll

Decompiled 5 days 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 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_Fighter_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Fighter_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a5e41553-6637-42a2-ae52-50ef781b12b9")]
[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.Fighter;

public static class FighterAPI
{
	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)
		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Fighter";
		val.rulebookName = "Fighter";
		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_Fighter.png", (FilterMode)0);
		Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("OldSa_Fighter_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] kills another creature, randomly gain 1 Power or 2 Health.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(FighterBehaviour), imageAsTexture);
		if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
		{
			ProgressionData.Data.learnedAbilities.Add(ability.Id);
		}
	}
}
public class FighterBehaviour : AbilityBehaviour
{
	public override Ability Ability => FighterAPI.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();
		yield return (object)new WaitForSeconds(0.3f);
		bool gainAttack = Random.value < 0.5f;
		CardModificationInfo mod = new CardModificationInfo();
		if (gainAttack)
		{
			mod.attackAdjustment = 1;
		}
		else
		{
			mod.healthAdjustment = 2;
		}
		((AbilityBehaviour)this).Card.AddTemporaryMod(mod);
		if (!((AbilityBehaviour)this).Card.Dead)
		{
			((Card)((AbilityBehaviour)this).Card).Anim.LightNegationEffect();
			yield return (object)new WaitForSeconds(0.3f);
			yield return ((AbilityBehaviour)this).LearnAbility(0f);
		}
	}
}
[BepInPlugin("OLD_SA.Fighter", "OLD SA Fighter", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		FighterAPI.Init();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"OLD SA Fighter loaded.");
	}
}

Sigil/OldSa_Fileswarm_sigil.dll

Decompiled 5 days 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?", ((AbilityBehaviour)this).Card, "OLD_SA_FILES");
			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...", ((AbilityBehaviour)this).Card, "OLD_SA_FILES");
			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_Flying_Strike_sigil.dll

Decompiled 5 days 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_Flying_Strike_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Flying_Strike_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("26a1651a-f4f5-4764-9138-7b4ab925a161")]
[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.FlyingStrike;

public static class FlyingStrikeAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Flying Strike";
		val.rulebookName = "Flying Strike";
		val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
		val.powerLevel = 5;
		val.opponentUsable = false;
		val.canStack = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Flying_Strike.png", (FilterMode)0);
		FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(val, "When [creature] attacks, make an additional Flying Strike.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(FlyingStrikeBehaviour), imageAsTexture);
	}
}
public class FlyingStrikeBehaviour : ExtendedAbilityBehaviour
{
	public static Ability ability;

	private int flyingCharges = 1;

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

	public bool HasCharge()
	{
		return flyingCharges > 0;
	}

	public void ConsumeCharge()
	{
		if (flyingCharges > 0)
		{
			flyingCharges--;
		}
	}

	public override bool RespondsToGetOpposingSlots()
	{
		return true;
	}

	public override List<CardSlot> GetOpposingSlots(List<CardSlot> originalSlots, List<CardSlot> otherAddedSlots)
	{
		List<CardSlot> list = new List<CardSlot>();
		CardSlot val = CardExtensions.OpposingSlot(((AbilityBehaviour)this).Card);
		if ((Object)(object)val != (Object)null)
		{
			FlyingStrikePatch.MarkFlyingStrikeAttack(((AbilityBehaviour)this).Card, val);
			list.Add(val);
		}
		return list;
	}

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

	public override IEnumerator OnUpkeep(bool playerUpkeep)
	{
		flyingCharges = 1;
		yield break;
	}
}
[HarmonyPatch(typeof(CombatPhaseManager), "SlotAttackSlot")]
public static class FlyingStrikePatch
{
	private const string FLYING_STRIKE_MOD_ID = "OLD_SA_FlyingStrike_TemporaryFlying";

	private static readonly HashSet<PlayableCard> pendingFlyingAttacks = new HashSet<PlayableCard>();

	public static void MarkFlyingStrikeAttack(PlayableCard card, CardSlot targetSlot)
	{
		if (!((Object)(object)card == (Object)null))
		{
			FlyingStrikeBehaviour component = ((Component)card).GetComponent<FlyingStrikeBehaviour>();
			if (!((Object)(object)component == (Object)null) && component.HasCharge())
			{
				component.ConsumeCharge();
				pendingFlyingAttacks.Add(card);
			}
		}
	}

	[HarmonyPostfix]
	private static void Postfix(CardSlot attackingSlot, CardSlot opposingSlot, float waitAfter, ref IEnumerator __result)
	{
		if (!((Object)(object)attackingSlot == (Object)null) && !((Object)(object)attackingSlot.Card == (Object)null))
		{
			PlayableCard card = attackingSlot.Card;
			if (pendingFlyingAttacks.Contains(card))
			{
				pendingFlyingAttacks.Remove(card);
				__result = ExecuteFlyingStrikeAttack(__result, card);
			}
		}
	}

	private static IEnumerator ExecuteFlyingStrikeAttack(IEnumerator originalRoutine, PlayableCard card)
	{
		bool alreadyFlying = card.HasAbility((Ability)19);
		bool addedFlying = false;
		try
		{
			if (!alreadyFlying && !card.Dead)
			{
				CardModificationInfo mod = new CardModificationInfo((Ability)19);
				mod.singletonId = "OLD_SA_FlyingStrike_TemporaryFlying";
				if (card.Status != null && !card.Status.hiddenAbilities.Contains((Ability)19))
				{
					card.Status.hiddenAbilities.Add((Ability)19);
				}
				card.AddTemporaryMod(mod);
				addedFlying = true;
			}
			if (originalRoutine != null)
			{
				while (originalRoutine.MoveNext())
				{
					yield return originalRoutine.Current;
				}
			}
		}
		finally
		{
			if (addedFlying && (Object)(object)card != (Object)null)
			{
				RemoveFlyingMod(card);
			}
		}
	}

	private static void RemoveFlyingMod(PlayableCard card)
	{
		if ((Object)(object)card == (Object)null)
		{
			return;
		}
		List<CardModificationInfo> list = CardExtensions.AllCardModificationInfos(card);
		foreach (CardModificationInfo item in list)
		{
			if (item != null && item.singletonId == "OLD_SA_FlyingStrike_TemporaryFlying")
			{
				CardExtensions.RemoveCardModificationInfo(card, item, true);
			}
		}
		if (card.Status != null)
		{
			card.Status.hiddenAbilities.Remove((Ability)19);
		}
	}
}
[BepInPlugin("OLD_SA.FlyingStrike", "OLD SA Flying Strike", "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
		FlyingStrikeAPI.Init();
		Harmony val = new Harmony("OLD_SA.FlyingStrike");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"OLD SA Flying Strike loaded.");
	}
}

Sigil/OldSa_Frenzy_sigil.dll

Decompiled 5 days 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_Frenzy_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Frenzy_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f4c9ff12-92b2-40f2-b204-b8b0082873dd")]
[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.Frenzy;

public static class FrenzyAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Frenzy";
		val.rulebookName = "Frenzy";
		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_Frenzy.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 moves.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(FrenzyBehaviour), imageAsTexture);
		if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
		{
			ProgressionData.Data.learnedAbilities.Add(ability.Id);
		}
	}
}
public class FrenzyBehaviour : AbilityBehaviour
{
	protected bool movingLeft;

	public override Ability Ability => FrenzyAPI.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))
		{
			CardSlot toLeft = Singleton<BoardManager>.Instance.GetAdjacent(((AbilityBehaviour)this).Card.Slot, true);
			CardSlot toRight = Singleton<BoardManager>.Instance.GetAdjacent(((AbilityBehaviour)this).Card.Slot, false);
			bool leftValid = (Object)(object)toLeft != (Object)null && (Object)(object)toLeft.Card == (Object)null;
			bool rightValid = (Object)(object)toRight != (Object)null && (Object)(object)toRight.Card == (Object)null;
			if (movingLeft && !leftValid)
			{
				movingLeft = false;
			}
			if (!movingLeft && !rightValid)
			{
				movingLeft = true;
			}
			CardSlot destination = (movingLeft ? toLeft : toRight);
			bool destinationValid = (movingLeft ? leftValid : rightValid);
			if ((Object)(object)destination == (Object)null || !destinationValid)
			{
				((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
				yield return (object)new WaitForSeconds(0.15f);
			}
			else
			{
				CardSlot oldSlot = ((AbilityBehaviour)this).Card.Slot;
				yield return Singleton<BoardManager>.Instance.AssignCardToSlot(((AbilityBehaviour)this).Card, destination, 0.1f, (Action)null, true);
				yield return PostSuccessfulMoveSequence(oldSlot);
			}
		}
	}

	protected virtual IEnumerator PostSuccessfulMoveSequence(CardSlot oldSlot)
	{
		yield break;
	}
}
[BepInPlugin("OLD_SA.Frenzy", "OLD SA Frenzy", "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
		FrenzyAPI.Init();
		Harmony val = new Harmony("OLD_SA.Frenzy");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"OLD SA Frenzy Loaded");
	}
}

Sigil/OldSa_Gorebound_sigil.dll

Decompiled 5 days 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 OnSacrifice(PlayableCard sacrificedCard)
	{
		if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && !((AbilityBehaviour)this).Card.Dead && !((Object)(object)sacrificedCard == (Object)null) && !((Object)(object)sacrificedCard == (Object)(object)((AbilityBehaviour)this).Card))
		{
			((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
			int tribeCount = 0;
			if (((Card)sacrificedCard).Info.tribes != null)
			{
				tribeCount = ((Card)sacrificedCard).Info.tribes.Count;
			}
			Debug.Log((object)("[OLD SA Gorebound] Tribe count = " + tribeCount));
			if (tribeCount > 0)
			{
				CardModificationInfo mod = new CardModificationInfo(tribeCount, tribeCount);
				((AbilityBehaviour)this).Card.AddTemporaryMod(mod);
				((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 || (Object)(object)Singleton<BoardManager>.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(component.OnSacrifice(__instance));
			}
		}
	}
}
[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_Hallucinogenic_sigil.dll

Decompiled 5 days 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_Hallucinogenic_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Hallucinogenic_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("47fe31fe-4a65-485f-8e11-007c2dc7eba4")]
[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.Hallucinogenic;

public static class HallucinogenicAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Hallucinogenic";
		val.rulebookName = "Hallucinogenic";
		val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
		val.powerLevel = 5;
		val.opponentUsable = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Hallucinogenic.png", (FilterMode)0);
		FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(val, "When [creature] is about to be attacked, the attacker's target is randomized.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(HallucinogenicBehaviour), imageAsTexture);
	}
}
public class HallucinogenicBehaviour : AbilityBehaviour
{
	public override Ability Ability => HallucinogenicAPI.ability.Id;
}
[HarmonyPatch(typeof(PlayableCard), "GetOpposingSlots")]
public static class HallucinogenicPatch
{
	private static int randomCounter;

	[HarmonyPostfix]
	public static void Postfix(PlayableCard __instance, ref List<CardSlot> __result)
	{
		//IL_008b: 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 || __result.Count == 0 || HallucinogenicAPI.ability == null)
		{
			return;
		}
		List<CardSlot> list = new List<CardSlot>(__result);
		List<CardSlot> list2 = null;
		for (int i = 0; i < list.Count; i++)
		{
			CardSlot val = list[i];
			if ((Object)(object)val == (Object)null || (Object)(object)val.Card == (Object)null)
			{
				continue;
			}
			PlayableCard card = val.Card;
			if (card.HasAbility(HallucinogenicAPI.ability.Id) && !__instance.CanAttackDirectly(val))
			{
				if (list2 == null)
				{
					list2 = GetRandomTargets(__instance, val);
				}
				if (list2.Count != 0)
				{
					int nextRandomSeed = GetNextRandomSeed();
					nextRandomSeed = nextRandomSeed * 31 + __instance.Slot.Index;
					nextRandomSeed = nextRandomSeed * 31 + i;
					nextRandomSeed = nextRandomSeed * 31 + randomCounter++;
					float num = SeededRandom.Value(nextRandomSeed);
					int index = Mathf.Clamp(Mathf.FloorToInt(num * (float)list2.Count), 0, list2.Count - 1);
					__result[i] = list2[index];
				}
			}
		}
	}

	private static List<CardSlot> GetRandomTargets(PlayableCard attacker, CardSlot hallucinogenicSlot)
	{
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		List<CardSlot> list = new List<CardSlot>();
		BoardManager instance = Singleton<BoardManager>.Instance;
		if ((Object)(object)instance == (Object)null)
		{
			return list;
		}
		List<CardSlot> list2 = new List<CardSlot>();
		list2.AddRange(instance.PlayerSlotsCopy);
		list2.AddRange(instance.OpponentSlotsCopy);
		foreach (CardSlot item in list2)
		{
			if (!((Object)(object)item == (Object)null) && !((Object)(object)item == (Object)(object)attacker.Slot) && !((Object)(object)item == (Object)(object)hallucinogenicSlot) && (!((Object)(object)item.Card != (Object)null) || HallucinogenicAPI.ability == null || !item.Card.HasAbility(HallucinogenicAPI.ability.Id)))
			{
				list.Add(item);
			}
		}
		return list;
	}

	private static int GetNextRandomSeed()
	{
		SaveFile saveFile = SaveManager.SaveFile;
		if (saveFile == null)
		{
			return 0;
		}
		int currentRandomSeed = saveFile.GetCurrentRandomSeed();
		FieldInfo fieldInfo = AccessTools.Field(typeof(SaveFile), "randomSeed");
		if (fieldInfo != null)
		{
			int num = (int)fieldInfo.GetValue(saveFile);
			fieldInfo.SetValue(saveFile, num + 1);
		}
		return currentRandomSeed;
	}
}
[BepInPlugin("OLD_SA.Hallucinogenic", "OLD SA Hallucinogenic", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public const string GUID = "OLD_SA.Hallucinogenic";

	public const string NAME = "OLD SA Hallucinogenic";

	public const string VERSION = "1.0.0";

	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.Hallucinogenic");
		val.PatchAll();
		HallucinogenicAPI.Init();
	}
}

Sigil/OldSa_Healing Armor_sigil.dll

Decompiled 5 days 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 OLD_SA.HealingArmor;
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_Healing Armor_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Healing Armor_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("376829af-6343-471f-98ce-d962884b6704")]
[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_HealingArmor
{
	[BepInPlugin("OLD_SA.HealingArmor", "OLD SA Healing Armor", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string GUID = "OLD_SA.HealingArmor";

		public const string NAME = "OLD SA Healing Armor";

		public const string VERSION = "1.0.0";

		private void Awake()
		{
			HealingArmorAPI.Init();
		}
	}
}
namespace OLD_SA.HealingArmor
{
	public static class HealingArmorAPI
	{
		public static FullAbility ability;

		public static void Init()
		{
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_0126: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Healing Armor";
			val.rulebookName = "Healing Armor";
			val.metaCategories = new List<AbilityMetaCategory>
			{
				(AbilityMetaCategory)0,
				(AbilityMetaCategory)1
			};
			val.powerLevel = 3;
			val.opponentUsable = true;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Healing_Armor.png", (FilterMode)0);
			Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("OldSa_Healing_Armor_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, "At the start of the turn, if [creature] took no damage during the last enemy turn, it restores 2 Health.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(HealingArmorBehaviour), imageAsTexture);
			if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
			{
				ProgressionData.Data.learnedAbilities.Add(ability.Id);
			}
		}
	}
	public class HealingArmorBehaviour : ExtendedAbilityBehaviour
	{
		private bool trackingOpposingTurn;

		private bool damagedDuringOpposingTurn;

		private bool previousOpposingTurnValid;

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

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

		public override IEnumerator OnUpkeep(bool playerUpkeep)
		{
			if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && !((AbilityBehaviour)this).Card.Dead && ((AbilityBehaviour)this).Card.OnBoard && previousOpposingTurnValid && ((AbilityBehaviour)this).Card.Health < ((Card)((AbilityBehaviour)this).Card).Info.Health)
			{
				yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
				int missingHealth = ((Card)((AbilityBehaviour)this).Card).Info.Health - ((AbilityBehaviour)this).Card.Health;
				int healAmount = Math.Min(2, missingHealth);
				if (healAmount > 0)
				{
					((AbilityBehaviour)this).Card.HealDamage(healAmount);
				}
				yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
				previousOpposingTurnValid = false;
			}
		}

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

		public override IEnumerator OnTakeDamage(PlayableCard source)
		{
			damagedDuringOpposingTurn = true;
			yield break;
		}

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

		public override IEnumerator OnTurnEnd(bool playerTurnEnd)
		{
			if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null)
			{
				yield break;
			}
			bool isPlayerCard = !((AbilityBehaviour)this).Card.OpponentCard;
			if (playerTurnEnd == isPlayerCard)
			{
				trackingOpposingTurn = ((AbilityBehaviour)this).Card.OnBoard;
				damagedDuringOpposingTurn = false;
				previousOpposingTurnValid = false;
				yield break;
			}
			if (trackingOpposingTurn)
			{
				previousOpposingTurnValid = !damagedDuringOpposingTurn && ((AbilityBehaviour)this).Card.OnBoard;
			}
			trackingOpposingTurn = false;
			damagedDuringOpposingTurn = false;
		}
	}
}

Sigil/OldSa_Hive Will_sigil.dll

Decompiled 5 days 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)
		{
			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, "OLD_SA_BEE_QUEEN");
		}
		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_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Expected O, but got Unknown
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: 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";
			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);
			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_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Expected O, but got Unknown
		//IL_0066: 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_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: 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))
			{
				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_0090: 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)
		//IL_00b3: Expected O, but got Unknown
		//IL_0043: 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_004c: Unknown result type (might be due to invalid IL or missing references)
		HashSet<Ability> hashSet = new HashSet<Ability>();
		foreach (CardModificationInfo temporaryMod in material.TemporaryMods)
		{
			if (temporaryMod.abilities == null)
			{
				continue;
			}
			foreach (Ability ability in temporaryMod.abilities)
			{
				hashSet.Add(ability);
			}
		}
		hashSet.Remove(HiveWillAPI.ability.Id);
		if (hashSet.Count != 0)
		{
			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) && !Cards.Contains(((Card)card).Info))
		{
			Cards.Add(((Card)card).Info);
		}
	}

	public static void Clear()
	{
		foreach (CardInfo card in Cards)
		{
			if (!((Object)(object)card == (Object)null))
			{
				int count = card.Mods.Count;
				card.Mods.RemoveAll((CardModificationInfo x) => x.singletonId == "OLD_SA_HIVEWILL");
				int count2 = card.Mods.Count;
			}
		}
		Cards.Clear();
	}
}
[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_Martyr's Sting_station.dll

Decompiled 5 days 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 || !((SpecialCardBehaviour)this).PlayableCard.OnBoard)
		{
			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 + Mathf.Max(0, 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 5 days 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();
			if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && !((Object)(object)Singleton<LifeManager>.Instance == (Object)null))
			{
				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;
			}
		}
	}
}
[HarmonyPatch(typeof(CombatPhaseManager), "SlotAttackSequence")]
public static class PenaltyCombatPatch
{
	[HarmonyPrefix]
	public static bool Prefix(CardSlot slot, ref IEnumerator __result)
	{
		if ((Object)(object)slot == (Object)null || (Object)(object)Singleton<LifeManager>.Instance == (Object)null)
		{
			return true;
		}
		if (Mathf.Abs(Singleton<LifeManager>.Instance.Balance) >= 5)
		{
			__result = StopAttackSequence();
			return false;
		}
		return true;
	}

	private static IEnumerator StopAttackSequence()
	{
		yield break;
	}
}
[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_Perseverance_sigil.dll.dll

Decompiled 5 days 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 InscryptionAPI.Card;
using InscryptionAPI.Helpers;
using InscryptionAPI.Triggers;
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_Perseverance_sigil.dll")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Perseverance_sigil.dll")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("941850e0-847b-458c-9cf7-29b1fceb516a")]
[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.Perseverance;

public static class PerseveranceAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Perseverance";
		val.rulebookName = "Perseverance";
		val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
		val.powerLevel = 3;
		val.opponentUsable = true;
		val.canStack = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Perseverance.png", (FilterMode)0);
		FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(val, "When an ally takes damage, if that damage is less than 2, [creature] gives it 1 Health.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(PerseveranceBehaviour), imageAsTexture);
		if (!ProgressionData.Data.learnedAbilities.Contains(ability.Id))
		{
			ProgressionData.Data.learnedAbilities.Add(ability.Id);
		}
	}
}
public class PerseveranceBehaviour : AbilityBehaviour, IModifyDamageTaken
{
	public override Ability Ability => PerseveranceAPI.ability.Id;

	public bool RespondsToModifyDamageTaken(PlayableCard target, int damage, PlayableCard attacker, int originalDamage)
	{
		if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || !((AbilityBehaviour)this).Card.OnBoard || ((AbilityBehaviour)this).Card.Dead)
		{
			return false;
		}
		if ((Object)(object)target == (Object)null)
		{
			return false;
		}
		if (target.OpponentCard != ((AbilityBehaviour)this).Card.OpponentCard)
		{
			return false;
		}
		if (damage >= 2)
		{
			return false;
		}
		return true;
	}

	public int TriggerPriority(PlayableCard target, int damage, PlayableCard attacker)
	{
		return 0;
	}

	public int OnModifyDamageTaken(PlayableCard target, int damage, PlayableCard attacker, int originalDamage)
	{
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Expected O, but got Unknown
		if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || !((AbilityBehaviour)this).Card.OnBoard || ((AbilityBehaviour)this).Card.Dead)
		{
			return damage;
		}
		if ((Object)(object)target == (Object)null)
		{
			return damage;
		}
		if (target.OpponentCard != ((AbilityBehaviour)this).Card.OpponentCard)
		{
			return damage;
		}
		if (damage >= 2)
		{
			return damage;
		}
		if ((Object)(object)((Card)target).Anim != (Object)null)
		{
			((Card)target).Anim.StrongNegationEffect();
		}
		CardModificationInfo val = new CardModificationInfo(0, 1);
		target.AddTemporaryMod(val);
		return damage;
	}
}
[BepInPlugin("OLD_SA.Perseverance", "OLD SA Perseverance", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		PerseveranceAPI.Init();
		Debug.Log((object)"[OLD SA] Perseverance loaded.");
	}
}

Sigil/OldSa_Pitfall_Trap_sigil.dll

Decompiled 5 days 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_Prosperity_sigil.dll

Decompiled 5 days 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 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_Prosperity_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Prosperity_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("bf8f7560-4f77-47f9-a3d7-8a782b962f33")]
[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.Prosperity;

[BepInPlugin("OLD_SA.Prosperity", "OLD SA Prosperity", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		ProsperityAPI.Init();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"OLD SA Prosperity loaded.");
	}
}
public static class ProsperityAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Prosperity";
		val.rulebookName = "Prosperity";
		val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
		val.powerLevel = 5;
		val.opponentUsable = false;
		val.canStack = false;
		Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Prosperity.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 and adjacent friendly creatures gain 1 Health.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(ProsperityBehaviour), imageAsTexture);
	}
}
public class ProsperityBehaviour : AbilityBehaviour
{
	public static Ability ability;

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

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

	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 && ((AbilityBehaviour)this).Card.OnBoard)
		{
			yield return GiveHealth(((AbilityBehaviour)this).Card);
			CardSlot leftSlot = GetAdjacentSlot(-1);
			if ((Object)(object)leftSlot != (Object)null && (Object)(object)leftSlot.Card != (Object)null)
			{
				yield return GiveHealth(leftSlot.Card);
			}
			CardSlot rightSlot = GetAdjacentSlot(1);
			if ((Object)(object)rightSlot != (Object)null && (Object)(object)rightSlot.Card != (Object)null)
			{
				yield return GiveHealth(rightSlot.Card);
			}
			if ((Object)(object)((AbilityBehaviour)this).Card != (Object)null && !((AbilityBehaviour)this).Card.Dead)
			{
				yield return ((AbilityBehaviour)this).LearnAbility(0f);
			}
		}
	}

	private IEnumerator GiveHealth(PlayableCard target)
	{
		if (!((Object)(object)target == (Object)null) && !target.Dead && target.OnBoard)
		{
			CardModificationInfo mod = new CardModificationInfo();
			mod.healthAdjustment = 1;
			target.AddTemporaryMod(mod);
			target.OnStatsChanged();
			((Card)target).RenderCard();
			target.UpdateFaceUpOnBoardEffects();
			yield return (object)new WaitForSeconds(0.15f);
		}
	}

	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];
	}
}

Sigil/OldSa_Puppeteer_sigil.dll

Decompiled 5 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
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 InscryptionAPI.Triggers;
using OLD_SA.CarnivalMaster;
using OLD_SA.Jester;
using OLD_SA.Puppet;
using OLD_SA.PuppetFear;
using OLD_SA.Puppeteer;
using OLD_SA.RagePuppet;
using OLD_SA.SorrowPuppet;
using OLD_SA.StubbornResistance;
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_Puppeteer_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Puppeteer_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("68ad490a-c487-4007-a2b7-613033a2115a")]
[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_Puppeteer
{
	[BepInPlugin("OLD_SA.Puppeteer", "OLD SA Puppeteer", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string GUID = "OLD_SA.Puppeteer";

		public const string NAME = "OLD SA Puppeteer";

		public const string VERSION = "1.0.0";

		private void Awake()
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			PuppeteerAPI.Init();
			PuppetAPI.Init();
			DenialAPI.Init();
			JesterAPI.Init();
			CarnivalMasterAttack.Init();
			PuppetFearAPI.Init();
			PuppetRageAPI.Init();
			PuppetRejectionAPI.Init();
			RagePuppetAPI.Register();
			SorrowPuppetAPI.Register();
			StubbornResistanceAPI.Init();
			Harmony val = new Harmony("OLD_SA.Puppeteer");
			val.PatchAll();
		}
	}
}
namespace OLD_SA.StubbornResistance
{
	public static class StubbornResistanceAPI
	{
		public static FullAbility ability;

		public static void Init()
		{
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Stubborn Resistance";
			val.rulebookName = "Stubborn Resistance";
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.powerLevel = 3;
			val.opponentUsable = false;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Stubborn_Resistance.png", (FilterMode)0);
			FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(val, "When another creature is played, [creature] turns it into a Puppet.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(StubbornResistanceBehaviour), imageAsTexture);
		}
	}
	public class StubbornResistanceBehaviour : ExtendedAbilityBehaviour
	{
		private const string EXTENDED_PROPERTY = "Puppeteer";

		private const string DEFAULT_CARD = "OLD_SA_PUPPET";

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

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

		public override IEnumerator OnOtherCardResolve(PlayableCard otherCard)
		{
			if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || (Object)(object)otherCard == (Object)null || otherCard.Dead)
			{
				yield break;
			}
			yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
			int savedAttack = otherCard.Attack;
			int savedHealth = otherCard.Health;
			int savedMaxHealth = otherCard.MaxHealth;
			string cardName = CardExtensions.GetExtendedProperty(((Card)((AbilityBehaviour)this).Card).Info, "Puppeteer");
			if (string.IsNullOrEmpty(cardName))
			{
				cardName = "OLD_SA_PUPPET";
			}
			CardInfo puppetInfo = CardLoader.GetCardByName(cardName);
			if ((Object)(object)puppetInfo == (Object)null)
			{
				yield break;
			}
			object obj = puppetInfo.Clone();
			puppetInfo = (CardInfo)((obj is CardInfo) ? obj : null);
			if ((Object)(object)puppetInfo == (Object)null)
			{
				yield break;
			}
			if (puppetInfo.Mods == null)
			{
				puppetInfo.Mods = new List<CardModificationInfo>();
			}
			if (((Card)otherCard).Info.Mods != null)
			{
				foreach (CardModificationInfo mod in ((Card)otherCard).Info.Mods)
				{
					if (mod != null && !mod.nonCopyable)
					{
						object obj2 = mod.Clone();
						CardModificationInfo clone = (CardModificationInfo)((obj2 is CardModificationInfo) ? obj2 : null);
						if (clone != null)
						{
							clone.attackAdjustment = 0;
							clone.healthAdjustment = 0;
							puppetInfo.Mods.Add(clone);
						}
					}
				}
			}
			yield return otherCard.TransformIntoCard(puppetInfo, (Action)null, (Action)null);
			otherCard.SwitchToPortrait(((Card)otherCard).Info.portraitTex);
			((Card)otherCard).RenderCard();
			int attackFix = savedAttack - otherCard.Attack;
			int maxHealthFix = savedMaxHealth - otherCard.MaxHealth;
			if (attackFix != 0 || maxHealthFix != 0)
			{
				CardModificationInfo fix = new CardModificationInfo();
				fix.attackAdjustment = attackFix;
				fix.healthAdjustment = maxHealthFix;
				otherCard.AddTemporaryMod(fix);
			}
			int currentHealthFix = savedHealth - otherCard.Health;
			if (currentHealthFix != 0)
			{
				otherCard.HealDamage(currentHealthFix);
			}
			yield return (object)new WaitForSeconds(0.2f);
			PuppetHelper.Bind(((AbilityBehaviour)this).Card, otherCard);
			yield return ((AbilityBehaviour)this).LearnAbility(0.1f);
		}
	}
}
namespace OLD_SA.Jester
{
	public class BellToesBehaviour : AbilityBehaviour
	{
		public static Ability ability;

		private const string EXTENDED_PROPERTY = "BellToes";

		private const string DEFAULT_CARD = "Squirrel";

		private bool triggering;

		public override Ability Ability => JesterAPI.BellToesAbility.Id;

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

		public override IEnumerator OnOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
		{
			if (triggering || (Object)(object)((AbilityBehaviour)this).Card == (Object)null || !((AbilityBehaviour)this).Card.OnBoard || ((AbilityBehaviour)this).Card.Dead || (Object)(object)card == (Object)null || !fromCombat || (Object)(object)killer != (Object)(object)((AbilityBehaviour)this).Card || card.OpponentCard == ((AbilityBehaviour)this).Card.OpponentCard)
			{
				yield break;
			}
			triggering = true;
			PlayableCard cardToReturn = ((AbilityBehaviour)this).Card;
			CardSlot targetSlot = cardToReturn.Slot;
			if ((Object)(object)targetSlot == (Object)null)
			{
				triggering = false;
				yield break;
			}
			yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
			if ((Object)(object)cardToReturn == (Object)null)
			{
				triggering = false;
				yield break;
			}
			string spawnedCardName = CardExtensions.GetExtendedProperty(((Card)cardToReturn).Info, "BellToes");
			if (string.IsNullOrEmpty(spawnedCardName))
			{
				spawnedCardName = "Squirrel";
			}
			CardInfo spawnedInfo = CardLoader.GetCardByName(spawnedCardName);
			if ((Object)(object)spawnedInfo == (Object)null)
			{
				triggering = false;
				yield break;
			}
			object obj = spawnedInfo.Clone();
			spawnedInfo = (CardInfo)((obj is CardInfo) ? obj : null);
			if ((Object)(object)spawnedInfo == (Object)null)
			{
				triggering = false;
				yield break;
			}
			PlayerHand hand = Singleton<PlayerHand>.Instance;
			if ((Object)(object)hand == (Object)null)
			{
				triggering = false;
				yield break;
			}
			Singleton<ViewManager>.Instance.SwitchToView((View)0, false, false);
			yield return (object)new WaitForSeconds(0.1f);
			if ((Object)(object)cardToReturn.Slot != (Object)null && (Object)(object)cardToReturn.Slot.Card == (Object)(object)cardToReturn)
			{
				cardToReturn.Slot.Card = null;
			}
			cardToReturn.Slot = null;
			yield return hand.AddCardToHand(cardToReturn, Vector3.zero, 0.25f);
			yield return (object)new WaitForSeconds(0.1f);
			if (!hand.CardsInHand.Contains(cardToReturn))
			{
				triggering = false;
				yield break;
			}
			RestoreCardCollider(cardToReturn);
			Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
			yield return (object)new WaitForSeconds(0.25f);
			if (hand.CardsInHand.Contains(cardToReturn))
			{
				RestoreCardCollider(cardToReturn);
				hand.OnCardInspected(cardToReturn);
			}
			PlayableCard spawned = CardSpawner.SpawnPlayableCard(spawnedInfo);
			if ((Object)(object)spawned == (Object)null)
			{
				triggering = false;
				yield break;
			}
			yield return Singleton<BoardManager>.Instance.ResolveCardOnBoard(spawned, targetSlot, 0.1f, (Action)null, true);
			yield return (object)new WaitForSeconds(0.1f);
			yield return ((AbilityBehaviour)this).LearnAbility(0f);
			triggering = false;
		}

		private static void RestoreCardCollider(PlayableCard card)
		{
			if (!((Object)(object)card == (Object)null))
			{
				Collider component = ((Component)card).GetComponent<Collider>();
				if ((Object)(object)component != (Object)null && !component.enabled)
				{
					((InteractableBase)card).SetEnabled(true);
				}
				Collider2D component2 = ((Component)card).GetComponent<Collider2D>();
				if ((Object)(object)component2 != (Object)null && !((Behaviour)component2).enabled)
				{
					((InteractableBase)card).SetEnabled(true);
				}
			}
		}
	}
	public static class JesterAPI
	{
		public static FullAbility BellToesAbility;

		public static FullAbility ToeBellAbility;

		public static void Init()
		{
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Bell Toes";
			val.rulebookName = "Bell Toes";
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.powerLevel = 3;
			val.opponentUsable = false;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_BellToes.png", (FilterMode)0);
			FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(val, "When [creature] kills, it returns to your hand and leaves a card in its place.");
			}
			BellToesAbility = AbilityManager.Add("OLD_SA", val, typeof(BellToesBehaviour), imageAsTexture);
			AbilityInfo val2 = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val2).name = "Toe Bell";
			val2.rulebookName = "Toe Bell";
			val2.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val2.powerLevel = 0;
			val2.opponentUsable = false;
			Texture imageAsTexture2 = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_ToeBell.png", (FilterMode)0);
			FieldInfo field2 = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field2 != null)
			{
				field2.SetValue(val2, "When [creature] dies, a chosen card from your hand is placed in its position.");
			}
			ToeBellAbility = AbilityManager.Add("OLD_SA", val2, typeof(ToeBellBehaviour), imageAsTexture2);
		}
	}
	public class ToeBellBehaviour : AbilityBehaviour
	{
		public static Ability ability;

		private const string EXTENDED_PROPERTY = "ToeBell";

		public override Ability Ability => JesterAPI.ToeBellAbility.Id;

		public override bool RespondsToDie(bool wasSacrifice, PlayableCard killer)
		{
			if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || (Object)(object)((AbilityBehaviour)this).Card.Slot == (Object)null)
			{
				return false;
			}
			PlayerHand instance = Singleton<PlayerHand>.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return false;
			}
			foreach (PlayableCard item in instance.CardsInHand)
			{
				if ((Object)(object)item != (Object)null && (Object)(object)((Card)item).Info != (Object)null)
				{
					return true;
				}
			}
			return false;
		}

		public override IEnumerator OnDie(bool wasSacrifice, PlayableCard killer)
		{
			CardSlot deathSlot = ((AbilityBehaviour)this).Card.Slot;
			if ((Object)(object)deathSlot == (Object)null)
			{
				yield break;
			}
			PlayerHand hand = Singleton<PlayerHand>.Instance;
			if ((Object)(object)hand == (Object)null)
			{
				yield break;
			}
			PlayableCard selectedCard = null;
			string targetName = CardExtensions.GetExtendedProperty(((Card)((AbilityBehaviour)this).Card).Info, "ToeBell");
			if (!string.IsNullOrEmpty(targetName))
			{
				foreach (PlayableCard card in hand.CardsInHand)
				{
					if ((Object)(object)card != (Object)null && (Object)(object)((Card)card).Info != (Object)null && ((Object)((Card)card).Info).name == targetName)
					{
						selectedCard = card;
						break;
					}
				}
			}
			if ((Object)(object)selectedCard == (Object)null)
			{
				List<PlayableCard> candidates = new List<PlayableCard>();
				foreach (PlayableCard card2 in hand.CardsInHand)
				{
					if ((Object)(object)card2 != (Object)null && (Object)(object)((Card)card2).Info != (Object)null)
					{
						candidates.Add(card2);
					}
				}
				if (candidates.Count == 0)
				{
					yield break;
				}
				selectedCard = candidates[Random.Range(0, candidates.Count)];
			}
			yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
			yield return hand.PlayCardOnSlot(selectedCard, deathSlot);
			yield return ((AbilityBehaviour)this).LearnAbility(0.5f);
		}
	}
}
namespace OLD_SA.SorrowPuppet
{
	public class RagePuppetBehaviour : ExtendedAbilityBehaviour
	{
		private const string EXTENDED_PROPERTY = "Puppeteer";

		private const string DEFAULT_CARD = "OLD_SA_PUPPET";

		private bool triggered;

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

		public override bool RespondsToResolveOnBoard()
		{
			return !triggered;
		}

		public override IEnumerator OnResolveOnBoard()
		{
			triggered = true;
			yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
			if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || !((AbilityBehaviour)this).Card.OnBoard)
			{
				yield break;
			}
			List<CardSlot> allTargets = new List<CardSlot>();
			List<CardSlot> validTargets = new List<CardSlot>();
			BoardManager board = Singleton<BoardManager>.Instance;
			if ((Object)(object)board == (Object)null)
			{
				yield break;
			}
			foreach (CardSlot slot in board.PlayerSlotsCopy)
			{
				allTargets.Add(slot);
				if (!((Object)(object)slot.Card == (Object)null) && !((Object)(object)slot.Card == (Object)(object)((AbilityBehaviour)this).Card))
				{
					validTargets.Add(slot);
				}
			}
			if (validTargets.Count == 0)
			{
				string dialogue = "It is like a lone commander...";
				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);
					}
					yield break;
				}
				finally
				{
				}
			}
			CardSlot selectedSlot = null;
			GameObject currentTargetIcon = null;
			GameObject targetIconPrefab = ResourceBank.Get<GameObject>("Prefabs/Cards/SpecificCardModels/CannonTargetIcon");
			Singleton<ViewManager>.Instance.Controller.SwitchToControlMode(board.ChoosingSlotViewMode, false);
			Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)1;
			yield return board.ChooseTarget(allTargets, validTargets, (Action<CardSlot>)delegate(CardSlot val)
			{
				selectedSlot = val;
				if ((Object)(object)currentTargetIcon != (Object)null)
				{
					Object.Destroy((Object)(object)currentTargetIcon);
					currentTargetIcon = null;
				}
			}, (Action<CardSlot>)delegate
			{
			}, (Action<CardSlot>)delegate(CardSlot val)
			{
				//IL_0072: 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)
				if (!((Object)(object)val == (Object)null) && !((Object)(object)targetIconPrefab == (Object)null))
				{
					if ((Object)(object)currentTargetIcon != (Object)null)
					{
						Object.Destroy((Object)(object)currentTargetIcon);
					}
					currentTargetIcon = Object.Instantiate<GameObject>(targetIconPrefab, ((Component)val).transform);
					currentTargetIcon.transform.localPosition = new Vector3(0f, 0.25f, 0f);
					currentTargetIcon.transform.localRotation = Quaternion.identity;
				}
			}, (Func<bool>)(() => false), (CursorType)16);
			if ((Object)(object)currentTargetIcon != (Object)null)
			{
				Object.Destroy((Object)(object)currentTargetIcon);
			}
			Singleton<ViewManager>.Instance.Controller.SwitchToControlMode(board.DefaultViewMode, false);
			Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
			if ((Object)(object)selectedSlot == (Object)null || (Object)(object)selectedSlot.Card == (Object)null)
			{
				yield break;
			}
			PlayableCard target = selectedSlot.Card;
			int savedAttack = target.Attack;
			int savedHealth = target.Health;
			int savedMaxHealth = target.MaxHealth;
			string cardName = CardExtensions.GetExtendedProperty(((Card)((AbilityBehaviour)this).Card).Info, "Puppeteer");
			if (string.IsNullOrEmpty(cardName))
			{
				cardName = "OLD_SA_PUPPET";
			}
			CardInfo puppetInfo = CardLoader.GetCardByName(cardName);
			if ((Object)(object)puppetInfo == (Object)null)
			{
				yield break;
			}
			object obj = puppetInfo.Clone();
			puppetInfo = (CardInfo)((obj is CardInfo) ? obj : null);
			if ((Object)(object)puppetInfo == (Object)null)
			{
				yield break;
			}
			if (puppetInfo.Mods == null)
			{
				puppetInfo.Mods = new List<CardModificationInfo>();
			}
			if (((Card)target).Info.Mods != null)
			{
				foreach (CardModificationInfo mod in ((Card)target).Info.Mods)
				{
					if (mod != null && !mod.nonCopyable)
					{
						object obj2 = mod.Clone();
						CardModificationInfo clone = (CardModificationInfo)((obj2 is CardModificationInfo) ? obj2 : null);
						if (clone != null)
						{
							clone.attackAdjustment = 0;
							clone.healthAdjustment = 0;
							puppetInfo.Mods.Add(clone);
						}
					}
				}
			}
			yield return target.TransformIntoCard(puppetInfo, (Action)null, (Action)null);
			target.SwitchToPortrait(((Card)target).Info.portraitTex);
			((Card)target).RenderCard();
			int attackFix = savedAttack - target.Attack;
			int maxHealthFix = savedMaxHealth - target.MaxHealth;
			if (attackFix != 0 || maxHealthFix != 0)
			{
				CardModificationInfo fix = new CardModificationInfo();
				fix.attackAdjustment = attackFix;
				fix.healthAdjustment = maxHealthFix;
				target.AddTemporaryMod(fix);
			}
			int currentHealthFix = savedHealth - target.Health;
			if (currentHealthFix != 0)
			{
				target.HealDamage(currentHealthFix);
			}
			yield return (object)new WaitForSeconds(0.2f);
			PuppetHelper.Bind(((AbilityBehaviour)this).Card, target);
			yield return ((AbilityBehaviour)this).LearnAbility(0.5f);
		}
	}
	public class MemorialBehaviour : ExtendedAbilityBehaviour
	{
		private const string EXTENDED_PROPERTY = "Puppeteer";

		private const string DEFAULT_CARD = "OLD_SA_PUPPET";

		private int sacrificeCount = 0;

		public override Ability Ability => SorrowPuppetAPI.MemorialAbility.Id;

		public void OnSacrificeExecuted()
		{
			if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && ((AbilityBehaviour)this).Card.OnBoard && !((AbilityBehaviour)this).Card.Dead)
			{
				sacrificeCount++;
				if (sacrificeCount >= 2)
				{
					sacrificeCount = 0;
					((MonoBehaviour)this).StartCoroutine(GeneratePuppet());
				}
			}
		}

		private IEnumerator GeneratePuppet()
		{
			if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || !((AbilityBehaviour)this).Card.OnBoard || ((AbilityBehaviour)this).Card.Dead)
			{
				yield break;
			}
			yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
			string cardName = CardExtensions.GetExtendedProperty(((Card)((AbilityBehaviour)this).Card).Info, "Puppeteer");
			if (string.IsNullOrEmpty(cardName))
			{
				cardName = "OLD_SA_PUPPET";
			}
			CardInfo puppetInfo = CardLoader.GetCardByName(cardName);
			if ((Object)(object)puppetInfo == (Object)null)
			{
				yield break;
			}
			object obj = puppetInfo.Clone();
			puppetInfo = (CardInfo)((obj is CardInfo) ? obj : null);
			if ((Object)(object)puppetInfo == (Object)null)
			{
				yield break;
			}
			PlayableCard puppet = CardSpawner.SpawnPlayableCard(puppetInfo);
			if (!((Object)(object)puppet == (Object)null))
			{
				PuppetHelper.Bind(((AbilityBehaviour)this).Card, puppet);
				PlayerHand hand = Singleton<PlayerHand>.Instance;
				if ((Object)(object)hand == (Object)null)
				{
					PuppetHelper.Unbind(((AbilityBehaviour)this).Card, puppet);
					yield break;
				}
				yield return hand.AddCardToHand(puppet, Vector3.zero, 0.25f);
				yield return ((AbilityBehaviour)this).LearnAbility(0.5f);
			}
		}
	}
	[HarmonyPatch(typeof(PlayableCard), "Sacrifice")]
	public static class MemorialSacrificePatch
	{
		public static void Prefix(PlayableCard __instance)
		{
			if ((Object)(object)__instance == (Object)null)
			{
				return;
			}
			BoardManager instance = Singleton<BoardManager>.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			foreach (CardSlot allSlot in instance.AllSlots)
			{
				if ((Object)(object)allSlot == (Object)null)
				{
					continue;
				}
				PlayableCard card = allSlot.Card;
				if (!((Object)(object)card == (Object)null) && card.OnBoard && !card.Dead)
				{
					MemorialBehaviour component = ((Component)card).GetComponent<MemorialBehaviour>();
					if (!((Object)(object)component == (Object)null))
					{
						component.OnSacrificeExecuted();
					}
				}
			}
		}
	}
	public static class SorrowPuppetAPI
	{
		public static FullAbility MemorialAbility;

		public static FullAbility SorrowPuppetAbility;

		public static void Register()
		{
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Memorial";
			val.rulebookName = "Memorial";
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.powerLevel = 4;
			val.opponentUsable = false;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Memorial.png", (FilterMode)0);
			typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(val, "For every two sacrifices made, [creature] adds a Puppet to your hand.");
			MemorialAbility = AbilityManager.Add("OLD_SA", val, typeof(MemorialBehaviour), imageAsTexture);
			AbilityInfo val2 = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val2).name = "Puppet Sad";
			val2.rulebookName = "Puppet Sad";
			val2.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val2.powerLevel = 2;
			val2.opponentUsable = false;
			Texture imageAsTexture2 = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Puppet_Sad.png", (FilterMode)0);
			typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(val2, "When an ally is about to die, [creature] dies in its place.");
			SorrowPuppetAbility = AbilityManager.Add("OLD_SA", val2, typeof(SorrowPuppetBehaviour), imageAsTexture2);
		}
	}
	public class SorrowPuppetBehaviour : ExtendedAbilityBehaviour
	{
		public static Ability ability;

		public override Ability Ability => SorrowPuppetAPI.SorrowPuppetAbility.Id;

		public IEnumerator TriggerPreSuccessfulSequence()
		{
			yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
		}
	}
	[HarmonyPatch(typeof(PlayableCard), "Die")]
	public static class SorrowPuppetDiePatch
	{
		private static readonly HashSet<PlayableCard> ForcedDeaths = new HashSet<PlayableCard>();

		public static bool Prefix(PlayableCard __instance, bool wasSacrifice, PlayableCard killer, bool playSound, ref IEnumerator __result)
		{
			if ((Object)(object)__instance == (Object)null)
			{
				return true;
			}
			if (ForcedDeaths.Contains(__instance))
			{
				return true;
			}
			if (wasSacrifice)
			{
				return true;
			}
			if (__instance.Dead)
			{
				return true;
			}
			if (IsSorrowPuppet(__instance))
			{
				return true;
			}
			PlayableCard val = FindSorrowPuppet(__instance);
			if ((Object)(object)val == (Object)null)
			{
				return true;
			}
			__result = ReplaceDeath(__instance, val, killer, playSound);
			return false;
		}

		private static PlayableCard FindSorrowPuppet(PlayableCard target)
		{
			if ((Object)(object)target == (Object)null)
			{
				return null;
			}
			BoardManager instance = Singleton<BoardManager>.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return null;
			}
			foreach (CardSlot allSlot in instance.AllSlots)
			{
				if (!((Object)(object)allSlot == (Object)null))
				{
					PlayableCard card = allSlot.Card;
					if (!((Object)(object)card == (Object)null) && card.OpponentCard == target.OpponentCard && card.OnBoard && !card.Dead && !((Object)(object)card == (Object)(object)target) && IsSorrowPuppet(card))
					{
						return card;
					}
				}
			}
			return null;
		}

		private static bool IsSorrowPuppet(PlayableCard card)
		{
			if ((Object)(object)card == (Object)null)
			{
				return false;
			}
			return (Object)(object)((Component)card).GetComponent<SorrowPuppetBehaviour>() != (Object)null;
		}

		private static IEnumerator ReplaceDeath(PlayableCard target, PlayableCard sorrowPuppet, PlayableCard killer, bool playSound)
		{
			if (!((Object)(object)target == (Object)null) && !((Object)(object)sorrowPuppet == (Object)null))
			{
				SorrowPuppetBehaviour behaviour = ((Component)sorrowPuppet).GetComponent<SorrowPuppetBehaviour>();
				if ((Object)(object)behaviour != (Object)null)
				{
					yield return behaviour.TriggerPreSuccessfulSequence();
				}
				ForcedDeaths.Add(sorrowPuppet);
				try
				{
					yield return sorrowPuppet.Die(false, killer, playSound);
				}
				finally
				{
					ForcedDeaths.Remove(sorrowPuppet);
				}
			}
		}
	}
}
namespace OLD_SA.RagePuppet
{
	public static class RagePuppetAPI
	{
		public static FullAbility ability;

		public static void Register()
		{
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "RagePuppeteer";
			val.rulebookName = "RagePuppeteer";
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.powerLevel = 3;
			val.opponentUsable = false;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Rage_Puppeteer.png", (FilterMode)0);
			typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(val, "When [creature] is played, it transforms an allied creature into a Puppet.");
			ability = AbilityManager.Add("OLD_SA", val, typeof(RagePuppetBehaviour), imageAsTexture);
		}
	}
}
namespace OLD_SA.CarnivalMaster
{
	public class CarnivalMasterAttack : VariableStatBehaviour
	{
		public static SpecialStatIcon iconType;

		protected override SpecialStatIcon IconType => iconType;

		public static void Init()
		{
			//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)
			StatIconInfo val = ScriptableObject.CreateInstance<StatIconInfo>();
			val.rulebookName = "Carnival Master";
			val.rulebookDescription = "This creature's attack is determined by the number of puppets bound to it.";
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("OldSa_Carnival_Master.png", (FilterMode)0);
			val.iconGraphic = (Texture)(object)imageAsTexture;
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.appliesToAttack = true;
			val.appliesToHealth = false;
			FullStatIcon val2 = StatIconManager.Add("OLD_SA", val, typeof(CarnivalMasterAttack));
			iconType = val2.Id;
		}

		protected override int[] GetStatValues()
		{
			if ((Object)(object)((SpecialCardBehaviour)this).PlayableCard == (Object)null)
			{
				return new int[2] { 2, 0 };
			}
			int num = 0;
			List<PlayableCard> puppets = PuppetHelper.GetPuppets(((SpecialCardBehaviour)this).PlayableCard);
			if (puppets != null)
			{
				foreach (PlayableCard item in puppets)
				{
					if (!((Object)(object)item == (Object)null) && !item.Dead && item.OnBoard)
					{
						num++;
					}
				}
			}
			int num2 = num * 2 + 2;
			return new int[2] { num2, 0 };
		}
	}
}
namespace OLD_SA.PuppetFear
{
	[HarmonyPatch(typeof(PlayableCard), "AttackIsBlocked")]
	public static class PuppetRejectionPatch
	{
		public static void Postfix(PlayableCard __instance, CardSlot opposingSlot, ref bool __result)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance == (Object)null || (Object)(object)opposingSlot == (Object)null || !__instance.HasAbility(PuppetRejectionAPI.ability.Id))
			{
				return;
			}
			PlayableCard card = opposingSlot.Card;
			if (!((Object)(object)card == (Object)null))
			{
				PlayableCard owner = PuppetHelper.GetOwner(__instance);
				if (!((Object)(object)owner == (Object)null) && !((Object)(object)card != (Object)(object)owner))
				{
					__result = true;
				}
			}
		}
	}
	public static class PuppetFearAPI
	{
		public static FullAbility ability;

		public static void Init()
		{
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Puppet Fear";
			val.rulebookName = "Puppet Fear";
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.powerLevel = 2;
			val.opponentUsable = false;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Puppet_Fear.png", (FilterMode)0);
			typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(val, "When [creature] is on the board, adjacent allies lose 1 Power.");
			ability = AbilityManager.Add("OLD_SA", val, typeof(PuppetFearBehaviour), imageAsTexture);
		}
	}
	public static class DenialAPI
	{
		public static FullAbility ability;

		public static void Init()
		{
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Denial";
			val.rulebookName = "Denial";
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.powerLevel = 3;
			val.opponentUsable = false;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Denial.png", (FilterMode)0);
			FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(val, "When [creature] is played, place a Puppet opposite it.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(DenialBehaviour), imageAsTexture);
		}
	}
	public class DenialBehaviour : ExtendedAbilityBehaviour
	{
		private const string EXTENDED_PROPERTY = "Puppeteer";

		private const string DEFAULT_CARD = "OLD_SA_PUPPET";

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

		public override bool RespondsToResolveOnBoard()
		{
			return true;
		}

		public override IEnumerator OnResolveOnBoard()
		{
			Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
			yield return (object)new WaitForSeconds(0.1f);
			if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null)
			{
				yield break;
			}
			CardSlot targetSlot = ((AbilityBehaviour)this).Card.Slot.opposingSlot;
			if ((Object)(object)targetSlot == (Object)null)
			{
				yield break;
			}
			if ((Object)(object)targetSlot.Card != (Object)null)
			{
				((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
				yield break;
			}
			yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
			string cardName = CardExtensions.GetExtendedProperty(((Card)((AbilityBehaviour)this).Card).Info, "Puppeteer");
			if (string.IsNullOrEmpty(cardName))
			{
				cardName = "OLD_SA_PUPPET";
			}
			CardInfo puppetInfo = CardLoader.GetCardByName(cardName);
			if ((Object)(object)puppetInfo == (Object)null)
			{
				yield break;
			}
			object obj = puppetInfo.Clone();
			puppetInfo = (CardInfo)((obj is CardInfo) ? obj : null);
			if (!((Object)(object)puppetInfo == (Object)null))
			{
				PlayableCard puppet = CardSpawner.SpawnPlayableCard(puppetInfo);
				if (!((Object)(object)puppet == (Object)null))
				{
					PuppetHelper.Bind(((AbilityBehaviour)this).Card, puppet);
					yield return Singleton<BoardManager>.Instance.ResolveCardOnBoard(puppet, targetSlot, 0.15f, (Action)null, true);
					yield return ((AbilityBehaviour)this).LearnAbility(0f);
				}
			}
		}
	}
	public class PuppetFearBehaviour : ExtendedAbilityBehaviour
	{
		public override Ability Ability => PuppetFearAPI.ability.Id;

		public override int GetPassiveAttackBuff(PlayableCard target)
		{
			if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null)
			{
				return 0;
			}
			if (!((AbilityBehaviour)this).Card.OnBoard || ((AbilityBehaviour)this).Card.Dead)
			{
				return 0;
			}
			if ((Object)(object)target == (Object)null)
			{
				return 0;
			}
			if ((Object)(object)target == (Object)(object)((AbilityBehaviour)this).Card)
			{
				return 0;
			}
			if (target.OpponentCard != ((AbilityBehaviour)this).Card.OpponentCard)
			{
				return 0;
			}
			if ((Object)(object)((AbilityBehaviour)this).Card.Slot == (Object)null || (Object)(object)target.Slot == (Object)null)
			{
				return 0;
			}
			foreach (CardSlot adjacentSlot in Singleton<BoardManager>.Instance.GetAdjacentSlots(((AbilityBehaviour)this).Card.Slot))
			{
				if ((Object)(object)adjacentSlot.Card == (Object)(object)target)
				{
					return -1;
				}
			}
			return 0;
		}
	}
	public static class PuppetRejectionAPI
	{
		public static FullAbility ability;

		public static void Init()
		{
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Puppet Rejection";
			val.rulebookName = "Puppet Rejection";
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.powerLevel = 2;
			val.opponentUsable = false;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Puppet_Rejection.png", (FilterMode)0);
			FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(val, "When [creature] has this sigil, it does not attack its Puppeteer.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(PuppetRejectionBehaviour), imageAsTexture);
		}
	}
	public class PuppetRejectionBehaviour : ExtendedAbilityBehaviour
	{
		public override Ability Ability => PuppetRejectionAPI.ability.Id;
	}
}
namespace OLD_SA.Puppeteer
{
	internal static class PuppeteerQueueFix
	{
		internal static readonly HashSet<PlayableCard> ReturnedCards = new HashSet<PlayableCard>();

		internal static void MarkReturned(PlayableCard card)
		{
			if ((Object)(object)card != (Object)null)
			{
				ReturnedCards.Add(card);
			}
		}
	}
	[HarmonyPatch]
	internal static class OriginalPlayCardsInQueuePatch
	{
		[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPatch(typeof(Opponent), "PlayCardsInQueue")]
		internal static IEnumerator Original(Opponent instance, float tweenLength = 0.1f)
		{
			throw new NotImplementedException("Harmony reverse patch stub");
		}
	}
	[HarmonyPatch(typeof(Opponent), "PlayCardsInQueue")]
	internal static class OpponentPlayCardsInQueuePatch
	{
		[HarmonyPrefix]
		private static bool Prefix(Opponent __instance, ref IEnumerator __result, float tweenLength = 0.1f)
		{
			__result = PlayAndRestore(__instance, tweenLength);
			return false;
		}

		private static IEnumerator PlayAndRestore(Opponent opponent, float tweenLength)
		{
			PuppeteerQueueFix.ReturnedCards.Clear();
			yield return OriginalPlayCardsInQueuePatch.Original(opponent, tweenLength);
			foreach (PlayableCard card in PuppeteerQueueFix.ReturnedCards)
			{
				if ((Object)(object)card != (Object)null && !opponent.Queue.Contains(card))
				{
					opponent.Queue.Add(card);
				}
			}
			PuppeteerQueueFix.ReturnedCards.Clear();
		}
	}
	public static class PuppeteerAPI
	{
		public static FullAbility ability;

		public static void Init()
		{
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Puppeteer";
			val.rulebookName = "Puppeteer";
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.powerLevel = 5;
			val.opponentUsable = false;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Puppeteer.png", (FilterMode)0);
			FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(val, "When [creature] is played, place a Puppet on its left.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(PuppeteerBehaviour), imageAsTexture);
		}
	}
	public class PuppeteerBehaviour : ExtendedAbilityBehaviour
	{
		private const string EXTENDED_PROPERTY = "Puppeteer";

		private const string DEFAULT_CARD = "OLD_SA_PUPPET";

		private PlayableCard puppet;

		private bool puppetCreated;

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

		public override bool RespondsToResolveOnBoard()
		{
			return !puppetCreated;
		}

		public override IEnumerator OnResolveOnBoard()
		{
			yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
			yield return CreatePuppet();
			yield return ((AbilityBehaviour)this).LearnAbility(0f);
		}

		private IEnumerator CreatePuppet()
		{
			if (puppetCreated || (Object)(object)((AbilityBehaviour)this).Card == (Object)null || (Object)(object)((AbilityBehaviour)this).Card.Slot == (Object)null)
			{
				yield break;
			}
			BoardManager board = Singleton<BoardManager>.Instance;
			if ((Object)(object)board == (Object)null)
			{
				yield break;
			}
			CardSlot targetSlot = GetPuppetTargetSlot();
			if ((Object)(object)targetSlot == (Object)null)
			{
				yield break;
			}
			if ((Object)(object)targetSlot.Card != (Object)null)
			{
				PlayableCard occupyingCard = targetSlot.Card;
				if (occupyingCard.OpponentCard)
				{
					yield return ReturnCardToOpponentQueue(occupyingCard);
				}
				else
				{
					yield return ReturnCardToPlayerHand(occupyingCard);
				}
				int waitFrames = 0;
				while ((Object)(object)targetSlot.Card == (Object)(object)occupyingCard && waitFrames < 10)
				{
					waitFrames++;
					yield return null;
				}
			}
			string spawnedCardName = CardExtensions.GetExtendedProperty(((Card)((AbilityBehaviour)this).Card).Info, "Puppeteer");
			if (string.IsNullOrEmpty(spawnedCardName))
			{
				spawnedCardName = "OLD_SA_PUPPET";
			}
			CardInfo puppetInfo = CardLoader.GetCardByName(spawnedCardName);
			if ((Object)(object)puppetInfo == (Object)null)
			{
				yield break;
			}
			object obj = puppetInfo.Clone();
			puppetInfo = (CardInfo)((obj is CardInfo) ? obj : null);
			if ((Object)(object)puppetInfo == (Object)null)
			{
				yield break;
			}
			puppet = CardSpawner.SpawnPlayableCardWithCopiedMods(puppetInfo, ((AbilityBehaviour)this).Card, PuppeteerAPI.ability.Id);
			if (!((Object)(object)puppet == (Object)null))
			{
				PuppetHelper.Bind(((AbilityBehaviour)this).Card, puppet);
				((Component)puppet).transform.position = ((Component)targetSlot).transform.position + Vector3.back * 2f + Vector3.up * 2f;
				((Component)puppet).transform.rotation = Quaternion.Euler(110f, 90f, 90f);
				yield return board.ResolveCardOnBoard(puppet, targetSlot, 0.1f, (Action)null, true);
				PuppetHelper.SyncCurrentResults(((AbilityBehaviour)this).Card, puppet);
				Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
				yield return (object)new WaitForSeconds(0.2f);
				if ((Object)(object)puppet != (Object)null && (Object)(object)((Card)puppet).Anim != (Object)null)
				{
					((Card)puppet).Anim.StrongNegationEffect();
				}
				puppetCreated = true;
			}
		}

		public void NotifyPuppetModification(CardModificationInfo modification, bool temporary)
		{
			if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || modification == null)
			{
				return;
			}
			List<PlayableCard> puppets = PuppetHelper.GetPuppets(((AbilityBehaviour)this).Card);
			foreach (PlayableCard item in puppets)
			{
				if (!((Object)(object)item == (Object)null))
				{
					PuppetBehaviour component = ((Component)item).GetComponent<PuppetBehaviour>();
					if (!((Object)(object)component == (Object)null))
					{
						component.OnOwnerModified(((AbilityBehaviour)this).Card, modification, temporary);
					}
				}
			}
		}

		public void NotifyPuppetStatsChanged()
		{
			if (!((Object)(object)((AbilityBehaviour)this).Card == (Object)null))
			{
				PuppetHelper.SyncAllPuppets(((AbilityBehaviour)this).Card);
			}
		}

		private CardSlot GetPuppetTargetSlot()
		{
			if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || (Object)(object)((AbilityBehaviour)this).Card.Slot == (Object)null)
			{
				return null;
			}
			BoardManager instance = Singleton<BoardManager>.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return null;
			}
			CardSlot adjacent = instance.GetAdjacent(((AbilityBehaviour)this).Card.Slot, true);
			if ((Object)(object)adjacent != (Object)null)
			{
				return adjacent;
			}
			List<CardSlot> list = ((!((AbilityBehaviour)this).Card.OpponentCard) ? instance.PlayerSlotsCopy : instance.OpponentSlotsCopy);
			if (list == null || list.Count == 0)
			{
				return null;
			}
			return list[list.Count - 1];
		}

		private IEnumerator ReturnCardToPlayerHand(PlayableCard card)
		{
			if ((Object)(object)card == (Object)null)
			{
				yield break;
			}
			PlayerHand hand = Singleton<PlayerHand>.Instance;
			if (!((Object)(object)hand == (Object)null))
			{
				Singleton<ViewManager>.Instance.SwitchToView((View)0, false, false);
				yield return (object)new WaitForSeconds(0.1f);
				yield return hand.AddCardToHand(card, Vector3.zero, 0.25f);
				yield return (object)new WaitForSeconds(0.1f);
				if (hand.CardsInHand.Contains(card))
				{
					RestoreCardCollider(card);
				}
				Singleton<ViewManager>.Instance.SwitchToView((View)4, false, false);
				yield return (object)new WaitForSeconds(0.25f);
				if (hand.CardsInHand.Contains(card))
				{
					RestoreCardCollider(card);
					hand.OnCardInspected(card);
				}
			}
		}

		private static void RestoreCardCollider(PlayableCard card)
		{
			if (!((Object)(object)card == (Object)null))
			{
				Collider component = ((Component)card).GetComponent<Collider>();
				if ((Object)(object)component != (Object)null && !component.enabled)
				{
					((InteractableBase)card).SetEnabled(true);
				}
				Collider2D component2 = ((Component)card).GetComponent<Collider2D>();
				if ((Object)(object)component2 != (Object)null && !((Behaviour)component2).enabled)
				{
					((InteractableBase)card).SetEnabled(true);
				}
			}
		}

		private IEnumerator ReturnCardToOpponentQueue(PlayableCard card)
		{
			if ((Object)(object)card == (Object)null)
			{
				yield break;
			}
			TurnManager turnManager = Singleton<TurnManager>.Instance;
			if ((Object)(object)turnManager == (Object)null || (Object)(object)turnManager.Opponent == (Object)null)
			{
				yield break;
			}
			Opponent opponent = turnManager.Opponent;
			BoardManager board = Singleton<BoardManager>.Instance;
			if ((Object)(object)board == (Object)null)
			{
				yield break;
			}
			CardSlot originalSlot = card.Slot;
			opponent.Queue.RemoveAll((PlayableCard queuedCard) => (Object)(object)queuedCard == (Object)(object)card);
			PlayableCard existingQueuedCard = opponent.Queue.Find((PlayableCard queuedCard) => (Object)(object)queuedCard != (Object)null && (Object)(object)queuedCard != (Object)(object)card && (Object)(object)queuedCard.QueuedSlot == (Object)(object)originalSlot);
			if ((Object)(object)existingQueuedCard != (Object)null)
			{
				((Card)existingQueuedCard).ExitBoard(0.25f, new Vector3(-1f, -2f, 5f));
				opponent.Queue.RemoveAll((PlayableCard queuedCard) => (Object)(object)queuedCard == (Object)(object)existingQueuedCard);
			}
			if ((Object)(object)originalSlot != (Object)null && (Object)(object)originalSlot.Card == (Object)(object)card)
			{
				originalSlot.Card = null;
			}
			PuppeteerQueueFix.MarkReturned(card);
			board.ReturnCardToQueue(card, 0.25f);
			opponent.Queue.RemoveAll((PlayableCard queuedCard) => (Object)(object)queuedCard == (Object)(object)card);
			opponent.Queue.Add(card);
			yield return (object)new WaitForSeconds(0.25f);
		}
	}
	[HarmonyPatch(typeof(PlayableCard), "AddTemporaryMod")]
	public static class PuppeteerAddTemporaryModPatch
	{
		[HarmonyPostfix]
		private static void Postfix(PlayableCard __instance, CardModificationInfo mod)
		{
			if (!((Object)(object)__instance == (Object)null) && mod != null)
			{
				PuppeteerBehaviour component = ((Component)__instance).GetComponent<PuppeteerBehaviour>();
				if (!((Object)(object)component == (Object)null))
				{
					component.NotifyPuppetModification(mod, temporary: true);
				}
			}
		}
	}
}
namespace OLD_SA.Puppet
{
	public interface IRagePreTakeDamage
	{
		bool RespondsToRagePreTakeDamage(PlayableCard target, int damage, PlayableCard attacker);

		IEnumerator OnRagePreTakeDamage(PlayableCard target, int damage, PlayableCard attacker);
	}
	public static class PuppetRageAPI
	{
		public static FullAbility ability;

		public static void Init()
		{
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Puppet Rage";
			val.rulebookName = "Puppet Rage";
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.powerLevel = 3;
			val.opponentUsable = false;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Puppet_Rage.png", (FilterMode)0);
			FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(val, "When an ally takes damage, [creature] gives an ally 1 Power.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(RageBehaviour), imageAsTexture);
		}
	}
	public class RageBehaviour : AbilityBehaviour, IModifyDamageTaken, IRagePreTakeDamage
	{
		private bool triggering;

		private GameObject targetIconPrefab;

		private GameObject currentIcon;

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

		public bool RespondsToModifyDamageTaken(PlayableCard target, int damage, PlayableCard attacker, int originalDamage)
		{
			if (triggering)
			{
				return false;
			}
			if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null)
			{
				return false;
			}
			if (!((AbilityBehaviour)this).Card.OnBoard)
			{
				return false;
			}
			if (((AbilityBehaviour)this).Card.Dead)
			{
				return false;
			}
			if ((Object)(object)target == (Object)null)
			{
				return false;
			}
			if (target.OpponentCard != ((AbilityBehaviour)this).Card.OpponentCard)
			{
				return false;
			}
			return true;
		}

		public int TriggerPriority(PlayableCard target, int damage, PlayableCard attacker)
		{
			return 0;
		}

		public int OnModifyDamageTaken(PlayableCard target, int damage, PlayableCard attacker, int originalDamage)
		{
			RageTakeDamagePatch.RegisterRage(target, this);
			return damage;
		}

		public bool RespondsToRagePreTakeDamage(PlayableCard target, int damage, PlayableCard attacker)
		{
			if (triggering)
			{
				return false;
			}
			if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null)
			{
				return false;
			}
			if (!((AbilityBehaviour)this).Card.OnBoard)
			{
				return false;
			}
			if (((AbilityBehaviour)this).Card.Dead)
			{
				return false;
			}
			if ((Object)(object)target == (Object)null)
			{
				return false;
			}
			if (target.OpponentCard != ((AbilityBehaviour)this).Card.OpponentCard)
			{
				return false;
			}
			return true;
		}

		public IEnumerator OnRagePreTakeDamage(PlayableCard target, int damage, PlayableCard attacker)
		{
			triggering = true;
			yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
			yield return GiveRage();
			yield return ((AbilityBehaviour)this).LearnAbility(0.5f);
			triggering = false;
		}

		private IEnumerator GiveRage()
		{
			if ((Object)(object)((AbilityBehaviour)this).Card == (Object)null || ((AbilityBehaviour)this).Card.Dead)
			{
				yield break;
			}
			BoardManager board = Singleton<BoardManager>.Instance;
			if ((Object)(object)board == (Object)null)
			{
				yield break;
			}
			List<CardSlot> allTargets = new List<CardSlot>();
			List<CardSlot> validTargets = new List<CardSlot>();
			List<CardSlot> slots = ((!((AbilityBehaviour)this).Card.OpponentCard) ? board.PlayerSlotsCopy : board.OpponentSlotsCopy);
			foreach (CardSlot slot in slots)
			{
				if (!((Object)(object)slot == (Object)null))
				{
					allTargets.Add(slot);
					if ((Object)(object)slot.Card != (Object)null)
					{
						validTargets.Add(slot);
					}
				}
			}
			if (validTargets.Count != 0)
			{
				CardSlot selected = null;
				if ((Object)(object)Singleton<ViewManager>.Instance != (Object)null && (Object)(object)Singleton<ViewManager>.Instance.Controller != (Object)null)
				{
					Singleton<ViewManager>.Instance.Controller.SwitchToControlMode(board.ChoosingSlotViewMode, false);
					Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)1;
				}
				yield return board.ChooseTarget(allTargets, validTargets, (Action<CardSlot>)delegate(CardSlot val)
				{
					selected = val;
				}, (Action<CardSlot>)delegate
				{
				}, (Action<CardSlot>)delegate(CardSlot slot2)
				{
					CreateTargetIcon(slot2);
				}, (Func<bool>)(() => false), (CursorType)16);
				ClearTargetIcon();
				if ((Object)(object)Singleton<ViewManager>.Instance != (Object)null && (Object)(object)Singleton<ViewManager>.Instance.Controller != (Object)null)
				{
					Singleton<ViewManager>.Instance.Controller.SwitchToControlMode(board.DefaultViewMode, false);
					Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
				}
				if (!((Object)(object)selected == (Object)null) && !((Object)(object)selected.Card == (Object)null))
				{
					CardModificationInfo mod = new CardModificationInfo();
					mod.attackAdjustment = 1;
					selected.Card.AddTemporaryMod(mod);
					((Card)selected.Card).Anim.LightNegationEffect();
					((Card)selected.Card).RenderCard();
				}
			}
		}

		private void CreateTargetIcon(CardSlot slot)
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)slot == (Object)null))
			{
				if ((Object)(object)targetIconPrefab == (Object)null)
				{
					targetIconPrefab = ResourceBank.Get<GameObject>("Prefabs/Cards/SpecificCardModels/CannonTargetIcon");
				}
				if (!((Object)(object)targetIconPrefab == (Object)null))
				{
					ClearTargetIcon();
					currentIcon = Object.Instantiate<GameObject>(targetIconPrefab, ((Component)slot).transform);
					currentIcon.transform.localPosition = new Vector3(0f, 0.25f, 0f);
					currentIcon.transform.localRotation = Quaternion.identity;
				}
			}
		}

		private void ClearTargetIcon()
		{
			if ((Object)(object)currentIcon != (Object)null)
			{
				Object.Destroy((Object)(object)currentIcon);
				currentIcon = null;
			}
		}
	}
	public static class PuppetAPI
	{
		public static FullAbility ability;

		public static void Init()
		{
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			((Object)val).name = "Puppet Happy";
			val.rulebookName = "Puppet Happy";
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			val.powerLevel = 3;
			val.opponentUsable = false;
			Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture("OldSa_Puppet_Happy.png", (FilterMode)0);
			FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(val, "When the Puppeteer's stats change, [creature] changes as well.");
			}
			ability = AbilityManager.Add("OLD_SA", val, typeof(PuppetBehaviour), imageAsTexture);
		}
	}
	public class PuppetBehaviour : ExtendedAbilityBehaviour
	{
		public override Ability Ability => PuppetAPI.ability.Id;

		public void OnOwnerModified(PlayableCard owner, CardModificationInfo modification, bool temporary)
		{
			if (!((Object)(object)owner == (Object)null) && !((Object)(object)((AbilityBehaviour)this).Card == (Object)null) && modification != null)
			{
				PuppetHelper.SyncModification(owner, modification, temporary);
			}
		}

		public void OnOwnerStatsChanged(PlayableCard owner)
		{
			if (!((Object)(object)owner == (Object)null) && !((Object)(object)((AbilityBehaviour)this).Card == (Object)null))
			{
				PuppetHelper.SyncCurrentResults(owner, ((AbilityBehaviour)this).Card);
			}
		}
	}
	[HarmonyPatch(typeof(PlayableCard), "OnStatsChanged")]
	public static class PuppeteerStatsChangedPatch
	{
		[HarmonyPostfix]
		private static void Postfix(PlayableCard __instance)
		{
			if (!((Object)(object)__instance == (Object)null))
			{
				PuppeteerBehaviour component = ((Component)__instance).GetComponent<PuppeteerBehaviour>();
				if (!((Object)(object)component == (Object)null))
				{
					component.NotifyPuppetStatsChanged();
				}
			}
		}
	}
	public static class PuppetHelper
	{
		private class PuppetBinding
		{
			public PlayableCard Owner;

			public PlayableCard Puppet;
		}

		private static readonly List<PuppetBinding> bindings = new List<PuppetBinding>();

		public static void Bind(PlayableCard owner, PlayableCard puppet)
		{
			if (!((Object)(object)owner == (Object)null) && !((Object)(object)puppet == (Object)null) && !IsBound(owner, puppet))
			{
				bindings.Add(new PuppetBinding
				{
					Owner = owner,
					Puppet = puppet
				});
			}
		}

		public static bool IsBound(PlayableCard owner, PlayableCard puppet)
		{
			if ((Object)(object)owner == (Object)null || (Object)(object)puppet == (Object)null)
			{
				return false;
			}
			return bindings.Any((PuppetBinding x) => (Object)(object)x.Owner == (Object)(object)owner && (Object)(object)x.Puppet == (Object)(object)puppet);
		}

		public static List<PlayableCard> GetPuppets(PlayableCard owner)
		{
			if ((Object)(object)owner == (Object)null)
			{
				return new List<PlayableCard>();
			}
			return (from x in bindings
				where (Object)(object)x.Owner == (Object)(object)owner
				select x.Puppet into x
				where (Object)(object)x != (Object)null
				select x).ToList();
		}

		public static PlayableCard GetOwner(PlayableCard puppet)
		{
			if ((Object)(object)puppet == (Object)null)
			{
				return null;
			}
			return bindings.FirstOrDefault((PuppetBinding x) => (Object)(object)x.Puppet == (Object)(object)puppet)?.Owner;
		}

		public static void Unbind(PlayableCard owner, PlayableCard puppet)
		{
			if (!((Object)(object)owner == (Object)null) && !((Object)(object)puppet == (Object)null))
			{
				bindings.RemoveAll((PuppetBinding x) => (Object)(object)x.Owner == (Object)(object)owner && (Object)(object)x.Puppet == (Object)(object)puppet);
			}
		}

		public static void UnbindAll(PlayableCard card)
		{
			if (!((Object)(object)card == (Object)null))
			{
				bindings.RemoveAll((PuppetBinding x) => (Object)(object)x.Owner == (Object)(object)card || (Object)(object)x.Puppet == (Object)(object)card);
			}
		}

		public static void CopyAllModifications(PlayableCard owner, PlayableCard puppet)
		{
			if ((Object)(object)owner == (Object)null || (Object)(object)puppet == (Object)null)
			{
				return;
			}
			if ((Object)(object)((Card)owner).Info != (Object)null && ((Card)owner).Info.Mods != null)
			{
				if (((Card)puppet).Info.Mods == null)
				{
					((Card)puppet).Info.Mods = new List<CardModificationInfo>();
				}
				foreach (CardModificationInfo mod in ((Card)owner).Info.Mods)
				{
					CopyModificationToCard(mod, puppet);
				}
			}
			if (owner.TemporaryMods != null)
			{
				foreach (CardModificationInfo temporaryMod in owner.TemporaryMods)
				{
					CopyTemporaryModificationToCard(temporaryMod, puppet);
				}
			}
			puppet.OnStatsChanged();
		}

		public static CardModificationInfo CopyModificationToCard(CardModificationInfo sourceMod, PlayableCard target)
		{
			if (sourceMod == null || (Object)(object)target == (Object)null)
			{
				return null;
			}
			if (sourceMod.nonCopyable)
			{
				return null;
			}
			object obj = sourceMod.Clone();
			CardModificationInfo val = (CardModificationInfo)((obj is CardModificationInfo) ? obj : null);
			if (val == null)
			{
				return null;
			}
			if (((Card)target).Info.Mods == null)
			{
				((Card)target).Info.Mods = new List<CardModificationInfo>();
			}
			((Card)target).Info.Mods.Add(val);
			target.OnStatsChanged();
			return val;
		}

		public static CardModificationInfo CopyTemporaryModificationToCard(CardModificationInfo sourceMod, PlayableCard target)
		{
			if (sourceMod == null || (Object)(object)target == (Object)null)
			{
				return null;
			}
			if (sourceMod.nonCopyable)
			{
				return null;
			}
			object obj = sourceMod.Clone();
			CardModificationInfo val = (CardModificationInfo)((obj is CardModificationInfo) ? obj : null);
			if (val == null)
			{
				return null;
			}
			target.AddTemporaryMod(val);
			return val;
		}

		public static void SyncModification(PlayableCard owner, CardModificationInfo modification, bool temporary = true)
		{
			if ((Object)(object)owner == (Object)null || modification == null)
			{
				return;
			}
			List<PlayableCard> puppets = GetPuppets(owner);
			foreach (PlayableCard item in puppets)
			{
				if (!((Object)(object)item == (Object)null))
				{
					if (temporary)
					{
						CopyTemporaryModificationToCard(modification, item);
					}
					else
					{
						CopyModificationToCard(modification, item);
					}
				}
			}
		}

		public static void SyncCurrentResults(PlayableCard owner, PlayableCard puppet)
		{
			if (!((Object)(object)owner == (Object)null) && !((Object)(object)puppet == (Object)null) && IsBound(owner, puppet))
			{
				puppet.OnStatsChanged();
			}
		}

		public static void SyncAllPuppets(PlayableCard owner)
		{
			if ((Object)(object)owner == (Object)null)
			{
				return;
			}
			List<PlayableCard> puppets = GetPuppets(owner);
			foreach (PlayableCard item in puppets)
			{
				if (!((Object)(object)item == (Object)null))
				{
					SyncCurrentResults(owner, item);
				}
			}
		}

		public static void SyncAll(PlayableCard owner, PlayableCard puppet)
		{
			if (!((Object)(object)owner == (Object)null) && !((Object)(object)puppet == (Object)null) && IsBound(owner, puppet))
			{
				SyncCurrentResults(owner, puppet);
			}
		}
	}
	[HarmonyPatch]
	[HarmonyPriority(0)]
	public static class PuppetPassiveAttackPatch
	{
		private static readonly MethodInfo GetPassiveAttackBuffsMethod = AccessTools.Method(typeof(PlayableCard), "GetPassiveAttackBuffs", (Type[])null, (Type[])null);

		private static readonly HashSet<PlayableCard> evaluating = new HashSet<PlayableCard>();

		private static MethodBase TargetMethod()
		{
			return GetPassiveAttackBuffsMethod;
		}

		[HarmonyPostfix]
		private static void Postfix(PlayableCard __instance, ref int __result)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance == (Object)null || evaluating.Contains(__instance) || !__instance.HasAbility(PuppetAPI.ability.Id))
			{
				return;
			}
			PlayableCard owner = PuppetHelper.GetOwner(__instance);
			if ((Object)(object)owner == (Object)null || (Object)(object)owner == (Object)(object)__instance)
			{
				return;
			}
			evaluating.Add(__instance);
			try
			{
				int num = __result;
				int ownerPassiveAttack = GetOwnerPassiveAttack(owner);
				__result = num + ownerPassiveAttack;
			}
			finally
			{
				evaluating.Remove(__instance);
			}
		}

		private static int GetOwnerPassiveAttack(PlayableCard owner)
		{
			if ((Object)(object)owner == (Object)null)
			{
				return 0;
			}
			if (evaluating.Contains(owner))
			{
				return 0;
			}
			evaluating.Add(owner);
			try
			{
				if (!(GetPassiveAttackBuffsMethod.Invoke(owner, null) is int result))
				{
					return 0;
				}
				return result;
			}
			finally
			{
				evaluating.Remove(owner);
			}
		}
	}
	[HarmonyPatch]
	[HarmonyPriority(0)]
	public static class PuppetPassiveHealthPatch
	{
		private static readonly MethodInfo GetPassiveHealthBuffsMethod = AccessTools.Method(typeof(PlayableCard), "GetPassiveHealthBuffs", (Type[])null, (Type[])null);

		private static readonly HashSet<PlayableCard> evaluating = new HashSet<PlayableCard>();

		private static MethodBase TargetMethod()
		{
			return GetPassiveHealthBuffsMethod;
		}

		[HarmonyPostfix]
		private static void Postfix(PlayableCard __instance, ref int __result)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance == (Object)null || evaluating.Contains(__instance) || !__instance.HasAbility(PuppetAPI.ability.Id))
			{
				return;
			}
			PlayableCard owner = PuppetHelper.GetOwner(__instance);
			if ((Object)(object)owner == (Object)null || (Object)(object)owner == (Object)(object)__instance)
			{
				return;
			}
			evaluating.Add(__instance);
			try
			{
				int num = __result;
				int ownerPassiveHealth = GetOwnerPassiveHealth(owner);
				__result = num + ownerPassiveHealth;
			}
			finally
			{
				evaluating.Remove(__instance);
			}
		}

		private static int GetOwnerPassiveHealth(PlayableCard owner)
		{
			if ((Object)(object)owner == (Object)null)
			{
				return 0;
			}
			if (evaluating.Contains(owner))
			{
				return 0;
			}
			evaluating.Add(owner);
			try
			{
				if (!(GetPassiveHealthBuffsMethod.Invoke(owner, null) is int result))
				{
					return 0;
				}
				return result;
			}
			finally
			{
				evaluating.Remove(owner);
			}
		}
	}
	[HarmonyPatch(typeof(PlayableCard), "TakeDamage")]
	public static class RageTakeDamagePatch
	{
		private static readonly Dictionary<PlayableCard, List<IRagePreTakeDamage>> PendingRage = new Dictionary<PlayableCard, List<IRagePreTakeDamage>>();

		public static void RegisterRage(PlayableCard target, IRagePreTakeDamage rage)
		{
			if (!((Object)(object)target == (Object)null) && rage != null)
			{
				if (!PendingRage.TryGetValue(target, out var value))
				{
					value = new List<IRagePreTakeDamage>();
					PendingRage.Add(target, value);
				}
				if (!value.Contains(rage))
				{
					value.Add(rage);
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPriority(800)]
		private static void Postfix(PlayableCard __instance, int damage, PlayableCard attacker, ref IEnumerator __result)
		{
			List<IRagePreTakeDamage> value = null;
			if ((Object)(object)__instance != (Object)null)
			{
				PendingRage.TryGetValue(__instance, out value);
			}
			if (value != null && value.Count != 0)
			{
				List<IRagePreTakeDamage> triggers = new List<IRagePreTakeDamage>(value);
				PendingRage.Remove(__instance);
				IEnumerator original = __result;
				__result = RunRageThenDamage(__instance, damage, attacker, triggers, original);
			}
		}

		private static IEnumerator RunRageThenDamage(PlayableCard target, int damage, PlayableCard attacker, List<IRagePreTakeDamage> triggers, IEnumerator original)
		{
			for (int i = 0; i < triggers.Count; i++)
			{
				IRagePreTakeDamage rage = triggers[i];
				if (rage != null && rage.RespondsToRagePreTakeDamage(target, damage, attacker))
				{
					yield return rage.OnRagePreTakeDamage(target, damage, attacker);
				}
			}
			if (original != null)
			{
				yield return original;
			}
		}
	}
}

Sigil/OldSa_Raid_sigil.dll

Decompiled 5 days 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_Raid_sigil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Raid_sigil")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d27fa05b-0653-4e7d-8248-fc1c010797ee")]
[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.Raid;

[BepInPlugin("OLD_SA.Raid", "OLD SA Raid", "1.0.0")]
public class RaidPlugin : 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
		((BaseUnityPlugin)this).Logger.LogInfo((object)"[OLD SA Raid] Plugin loaded.");
		Harmony val = new Harmony("OLD_SA.Raid");
		val.PatchAll();
		RaidAPI.Init();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"[OLD SA Raid] Ability initialized.");
	}
}
public static class RaidAPI
{
	public static FullAbility ability;

	public static void Init()
	{
		AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
		((Object)val).name = "Raid";
		val.rulebookName = "Raid";
		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_Raid.png", (FilterMode)0);
		FieldInfo field = typeof(AbilityInfo).GetField("rulebookDescription", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(val, "When [creature] is played, deal 1 damage to all opposing creatures.");
		}
		ability = AbilityManager.Add("OLD_SA", val, typeof(RaidBehaviour), imageAsTexture);
	}
}
public class RaidBehaviour : AbilityBehaviour
{
	public override Ability Ability => RaidAPI.ability.Id;

	public override bool RespondsToResolveOnBoard()
	{
		return true;
	}

	public override IEnumerator OnResolveOnBoard()
	{
		yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence();
		if ((Object)(object)Singleton<BoardManager>.Instance == (Object)null)
		{
			yield break;
		}
		foreach (CardSlot slot in Singleton<BoardManager>.Instance.OpponentSlotsCopy)
		{
			if (!((Object)(object)slot == (Object)null) && !((Object)(object)slot.Card == (Object)null))
			{
				yield return slot.Card.TakeDamage(1, ((AbilityBehaviour)this).Card);
			}
		}
		yield return ((AbilityBehaviour)this).LearnAbility(0.25f);
	}
}

Sigil/OldSa_Random_sigil.dll

Decompiled 5 days 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 nextRandomSeed = GetNextRandomSeed();
		int num = (((Object)(object)card != (Object)null && (Object)(object)card.Slot != (Object)null) ? card.Slot.Index : 0);
		int num2 = randomCounter++;
		int num3 = nextRandomSeed;
		num3 = num3 * 31 + num;
		num3 = num3 * 31 + attackIndex;
		return num3 * 31 + num2;
	}

	private static int GetNextRandomSeed()
	{
		SaveFile saveFile = SaveManager.SaveFile;
		if (saveFile == null)
		{
			return 0;
		}
		int currentRandomSeed = saveFile.GetCurrentRandomSeed();
		FieldInfo fieldInfo = AccessTools.Field(typeof(SaveFile), "randomSeed");
		if (fieldInfo != null)
		{
			int num = (int)fieldInfo.GetValue(saveFile);
			fieldInfo.SetValue(saveFile, num + 1);
		}
		return currentRandomSeed;
	}
}

Xenowood_Law_Card/OLD_SA_Evolution.dll

Decompiled 5 days 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)
	{
		if (!string.IsNullOrEmpty(from) && !string.IsNullOrEmpty(to))
		{
			Evolutions[from] = to;
			Turns[from] = turns;
			if (!string.IsNullOrEmpty(dialogue))
			{
				EvolutionDialogues[from] = dialogue;
			}
			else
			{
				EvolutionDialogues.Remove(from);
			}
		}
	}

	public static bool TryGetEvolution(string cardName, out string evolutionName)
	{
		return Evolutions.TryGetValue(cardName, out evolutionName);
	}

	public static int GetEvolutionTurns(string cardName)
	{
		if (Turns.TryGetValue(cardName, out var value))
		{
			return value;
		}
		return 1;
	}

	public static string GetEvolutionDialogue(string cardName)
	{
		if (EvolutionDialogues.TryGetValue(cardName, out var value))
		{
			return value;
		}
		return null;
	}

	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> BeforeEvolutionTarget = new Dictionary<PlayableCard, string>();

	[HarmonyPatch("TransformIntoCard")]
	[HarmonyPrefix]
	public static void Prefix(PlayableCard __instance, CardInfo evolvedInfo)
	{
		if (!((Object)(object)__instance == (Object)null) && !((Object)(object)((Card)__instance).Info == (Object)null) && !((Object)(object)evolvedInfo == (Object)null))
		{
			string extendedProperty = CardExtensions.GetExtendedProperty(evolvedInfo, "OLD_SA_EvolveFrom");
			if (!string.IsNullOrEmpty(extendedProperty) && !(((Object)((Card)__instance).Info).name != extendedProperty))
			{
				BeforeEvolutionTarget[__instance] = ((Object)evolvedInfo).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 || !BeforeEvolutionTarget.TryGetValue(__instance, out var targetName))
		{
			yield break;
		}
		BeforeEvolutionTarget.Remove(__instance);
		if (!(((Object)evolvedInfo).name != targetName) && !((Object)(object)((Card)__instance).Info == (Object)null) && !(((Object)((Card)__instance).Info).name != targetName))
		{
			__instance.SwitchToPortrait(((Card)__instance).Info.portraitTex);
			((Card)__instance).RenderCard();
			yield return (object)new WaitForSeconds(0.15f);
			string dialogue = CardExtensions.GetExtendedProperty(evolvedInfo, "OLD_SA_EvolveDialogue");
			if (!string.IsNullOrEmpty(dialogue) && EvolutionAPI.ShouldTriggerEvolutionDialogue(((Object)evolvedInfo).name))
			{
				yield return ShowEvolutionDialogue(dialogue, evolvedInfo);
			}
		}
	}

	private static IEnumerator ShowEvolutionDialogue(string dialogue, CardInfo evolvedInfo)
	{
		DialogueColorAPI.CurrentColor = null;
		if ((Object)(object)evolvedInfo != (Object)null && ((Object)evolvedInfo).name == "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;
		}
	}
}
[HarmonyPatch]
public static class EvolutionInitialIconPatch
{
	private static MethodBase TargetMethod()
	{
		return AccessTools.Method(typeof(CardDisplayer3D), "DisplayAbilityIcons", (Type[])null, (Type[])null);
	}

	[HarmonyPrefix]
	public static void Prefix(CardRenderInfo renderInfo, PlayableCard playableCard)
	{
		if (renderInfo == null || (Object)(object)playableCard == (Object)null || (Object)(object)((Card)playableCard).Info == (Object)null)
		{
			return;
		}
		string name = ((Object)((Card)playableCard).Info).name;
		if (!EvolutionAPI.TryGetEvolution(name, out var _))
		{
			return;
		}
		Evolve component = ((Component)playableCard).GetComponent<Evolve>();
		if (!((Object)(object)component == (Object)null))
		{
			int num = EvolutionAPI.GetEvolutionTurns(name);
			if (num < 1)
			{
				num = 1;
			}
			int value = Traverse.Create((object)component).Field("numTurnsInPlay").GetValue<int>();
			Texture val = ResourceBank.Get<Texture>("Art/Cards/AbilityIcons/ability_evolve_" + Mathf.Max(1, num - value));
			renderInfo.OverrideAbilityIcon((Ability)5, val);
		}
	}
}
public static class EvolutionManager
{
	public static void RegisterAll()
	{
		if (CardManager.AllCardsCopy == null)
		{
			return;
		}
		foreach (CardInfo item in CardManager.AllCardsCopy)
		{
			if ((Object)(object)item == (Object)null)
			{
				continue;
			}
			string evolveFrom = CardExtensions.GetExtendedProperty(item, "OLD_SA_EvolveFrom");
			if (string.IsNullOrEmpty(evolveFrom))
			{
				continue;
			}
			CardInfo val = CardManager.AllCardsCopy.Find((CardInfo x) => (Object)(object)x != (Object)null && ((Object)x).name == evolveFrom);
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogWarning((object)("[OLD_SA Evolution] Base card not found: " + evolveFrom));
				continue;
			}
			int num = 1;
			string extendedProperty = CardExtensions.GetExtendedProperty(item, "OLD_SA_EvolveTurns");
			if (int.TryParse(extendedProperty, out var result))
			{
				num = result;
			}
			string extendedProperty2 = CardExtensions.GetExtendedProperty(item, "OLD_SA_EvolveDialogue");
			EvolutionAPI.AddEvolution(((Object)val).name, ((Object)item).name, num, extendedProperty2);
			CardExtensions.SetEvolve(val, item, num, (IEnumerable<CardModificationInfo>)null);
			if (val.evolveParams != null)
			{
				val.evolveParams.turnsToEvolve = num;
			}
		}
	}
}
[HarmonyPatch(typeof(Evolve), "GetTransformCardInfo")]
public static class EvolutionPriorityPatch
{
	[HarmonyPrefix]
	public static bool Prefix(Evolve __instance, ref CardInfo __result)
	{
		PlayableCard value = Traverse.Create((object)__instance).Property("Card", (object[])null).GetValue<PlayableCard>();
		if ((Object)(object)value == (Object)null || (Object)(object)((Card)value).Info == (Object)null)
		{
			return true;
		}
		CardInfo info = ((Card)value).Info;
		if (!EvolutionAPI.TryGetEvolution(((Object)info).name, out var evolutionName))
		{
			return true;
		}
		CardInfo cardByName = CardLoader.GetCardByName(evolutionName);
		if ((Object)(object)cardByName == (Object)null)
		{
			return true;
		}
		object obj = cardByName.Clone();
		__result = (CardInfo)((obj is CardInfo) ? obj : null);
		return false;
	}
}
[HarmonyPatch(typeof(Evolve), "OnUpkeep")]
public static class EvolutionTurnsPatch
{
	private class EvolutionTurnsEnumerator : IEnumerator
	{
		private readonly IEnumerator original;

		private readonly CardInfo cardInfo;

		private readonly int turns;

		public object Current => original.Current;

		public EvolutionTurnsEnumerator(IEnumerator original, CardInfo cardInfo, int turns)
		{
			this.original = original;
			this.cardInfo = cardInfo;
			this.turns = turns;
		}

		public bool MoveNext()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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_003c: Expected O, but got Unknown
			EvolveParams evolveParams = cardInfo.evolveParams;
			try
			{
				cardInfo.evolveParams = new EvolveParams
				{
					evolution = evolveParams?.evolution,
					turnsToEvolve = turns
				};
				return original.MoveNext();
			}
			finally
			{
				cardInfo.evolveParams = evolveParams;
			}
		}

		public void Reset()
		{
			original.Reset();
		}
	}

	[HarmonyPostfix]
	public static void Postfix(Evolve __instance, ref IEnumerator __result)
	{
		if ((Object)(object)__instance == (Object)null || __result == null)
		{
			return;
		}
		PlayableCard value = Traverse.Create((object)__instance).Property("Card", (object[])null).GetValue<PlayableCard>();
		if ((Object)(object)value == (Object)null || (Object)(object)((Card)value).Info == (Object)null)
		{
			return;
		}
		string name = ((Object)((Card)value).Info).name;
		if (EvolutionAPI.TryGetEvolution(name, out var _))
		{
			int num = EvolutionAPI.GetEvolutionTurns(name);
			if (num < 1)
			{
				num = 1;
			}
			__result = new EvolutionTurnsEnumerator(__result, ((Card)value).Info, num);
		}
	}
}
[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();
	}
}

Xenowood_Law_Card/OLD_SA_Sigil.dll

Decompiled 5 days 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);
		}
		catch (Exception ex)
		{
			Debug.LogError((object)("OLD SA Save Failed: " + ex.Message));
		}
	}

	public static void Load()
	{
		if (!File.Exists(PathFile))
		{
			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);
			}
		}
		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, null);
	}

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

	public static IEnumerator ShowFirstTime(string sigilID, string dialogue, PlayableCard triggerCard, string limitCardName)
	{
		if ((!string.IsNullOrEmpty(limitCardName) && ((Object)(object)triggerCard == (Object)null || (Object)(object)((Card)triggerCard).Info == (Object)null || ((Object)((Card)triggerCard).Info).name != limitCardName)) || 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();
	}

	[HarmonyPatch(typeof(SaveManager), "SaveToFile")]
	[HarmonyPostfix]
	public static void SaveToFilePostfix(bool saveActiveScene)
	{
		OLD_SA_SaveManager.Save();
	}
}
[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);
			}
		}
	}
}

Xenowood_Law_Card/OldSa_CardTraits.dll

Decompiled 5 days 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 OLD_SA.Puppet;
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 const string CarnivalMaster = "OLD_SA_CarnivalMaster";

	public const string PuppetMaster = "OLD_SA_PuppetMaster";
}
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 IEnumerator PlayTraitDialogue(PlayableCard card)
	{
		if ((Object)(object)card == (Object)null || (Object)(object)((Card)card).Info == (Object)null)
		{
			yield break;
		}
		string dialogue = CardExtensions.GetExtendedProperty(((Card)card).Info, "OLD_SA_TraitDialogue");
		if (!string.IsNullOrEmpty(dialogue))
		{
			DialogueColorAPI.CurrentColor = null;
			string cardName = ((Object)((Card)card).Info).name;
			if (cardName == "OLD_SA_GIANT_BEAR")
			{
				DialogueColorAPI.CurrentColor = new Color(0.45f, 0.25f, 0.1f);
			}
			try
			{
				yield return Singleton<TextDisplayer>.Instance.ShowUntilInput(dialogue, -0.65f, 0.4f, (Emotion)0, (LetterAnimation)0, (Speaker)0, (string[])null, true);
			}
			finally
			{
				DialogueColorAPI.CurrentColor = null;
			}
		}
	}

	public static IEnumerator TryTrigger(PlayableCard card, string trait)
	{
		if (!((Object)(object)card == (Object)null) && !((Object)(object)((Card)card).Info == (Object)null))
		{
			string dialogueID = ((Object)((Card)card).Info).name + "_" + trait;
			string dialogue = CardExtensions.GetExtendedProperty(((Card)card).Info, trait + "_Dialogue");
			yield return TryTrigger(dialogueID, dialogue);
		}
	}
}
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;
	}
}
public static class CarnivalMasterFusionManager
{
	public static void AddCard(CardInfo card)
	{
		if (!((Object)(object)card == (Object)null) && RunState.Run != null)
		{
			DeckInfo playerDeck = RunState.Run.playerDeck;
			if (playerDeck != null)
			{
				((CardCollectionInfo)playerDeck).AddCard(card);
			}
		}
	}
}
public static class CarnivalTraitAPI
{
	public const string Trait = "OLD_SA_CarnivalMaster";

	public const string NeedCards = "OLD_SA_TraitNeedCards";

	public const string TransformCard = "OLD_SA_TraitTransformCard";

	public const string DialogueID = "OLD_SA_TraitDialogueID";

	public const string Dialogue = "OLD_SA_TraitDialogue";

	public static string GetNeedCards(PlayableCard card)
	{
		if (!CardTraitHelper.HasTrait(card, "OLD_SA_CarnivalMaster"))
		{
			return null;
		}
		return CardExtensions.GetExtendedProperty(((Card)card).Info, "OLD_SA_TraitNeedCards");
	}

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

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

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

	public static IEnumerator CheckCarnivalFusion()
	{
		if (transforming)
		{
			yield break;
		}
		BoardManager board = Singleton<BoardManager>.Instance;
		if ((Object)(object)board == (Object)null)
		{
			yield break;
		}
		foreach (CardSlot slot in board.GetSlots(true))
		{
			if ((Object)(object)slot.Card == (Object)null)
			{
				continue;
			}
			PlayableCard master = slot.Card;
			if (CardTraitHelper.HasTrait(master, "OLD_SA_CarnivalMaster"))
			{
				PlayableCard[] cards = FindCards(master);
				if (cards != null)
				{
					yield return Fusion(master, cards);
					yield break;
				}
			}
		}
	}

	private static PlayableCard[] FindCards(PlayableCard master)
	{
		string needCards = CarnivalTraitAPI.GetNeedCards(master);
		if (string.IsNullOrEmpty(needCards))
		{
			return null;
		}
		string[] array = needCards.Split(new char[1] { ',' });
		List<PlayableCard> list = new List<PlayableCard>();
		string[] array2 = array;
		foreach (string text in array2)
		{
			foreach (CardSlot slot in Singleton<BoardManager>.Instance.GetSlots(!master.OpponentCard))
			{
				if ((Object)(object)slot.Card == (Object)null || (Object)(object)slot.Card == (Object)(object)master || !(((Object)((Card)slot.Card).Info).name == text.Trim()))
				{
					continue;
				}
				list.Add(slot.Card);
				break;
			}
		}
		if (list.Count != array.Length)
		{
			return null;
		}
		return list.ToArray();
	}

	private static IEnumerator Fusion(PlayableCard master, PlayableCard[] materials)
	{
		transforming = true;
		CardInfo result = CardLoader.GetCardByName(CarnivalTraitAPI.GetTransformCard(master));
		if ((Object)(object)result == (Object)null)
		{
			transforming = false;
			yield break;
		}
		CardSlot spawnSlot = master.Slot;
		yield return CardTraitDialogueManager.TryTrigger(master);
		((Card)master).Anim.ExitBoard(0.5f, Vector3.zero);
		foreach (PlayableCard card in materials)
		{
			((Card)card).Anim.ExitBoard(0.5f, Vector3.zero);
		}
		yield return (object)new WaitForSeconds(0.6f);
		Object.Destroy((Object)(object)((Component)master).gameObject);
		foreach (PlayableCard card2 in materials)
		{
			Object.Destroy((Object)(object)((Component)card2).gameObject);
		}
		yield return (object)new WaitForSeconds(0.2f);
		yield return Singleton<BoardManager>.Instance.CreateCardInSlot(result, spawnSlot, 0.1f, true);
		CarnivalMasterFusionManager.AddCard(result);
		transforming = false;
	}
}
[HarmonyPatch(typeof(BoardManager), "AssignCardToSlot")]
public static class CarnivalMasterTriggerPatch
{
	public static IEnumerator Postfix(IEnumerator __result)
	{
		while (__result.MoveNext())
		{
			yield return __result.Current;
		}
		yield return (object)new WaitForSeconds(0.05f);
		yield return CarnivalMasterTraitPatch.CheckCarnivalFusion();
	}
}
[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");
	}
}
public static class PuppetMasterTraitAPI
{
	public const string Trait = "OLD_SA_PuppetMaster";

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

	public static string GetDialogue(PlayableCard card)
	{
		if (!CardTraitHelper.HasTrait(card, "OLD_SA_PuppetMaster"))
		{
			return null;
		}
		return CardExtensions.GetExtendedProperty(((Card)card).Info, "OLD_SA_TraitDialogue");
	}
}
[HarmonyPatch(typeof(PlayableCard), "Die")]
public static class PuppetMasterTraitPatch
{
	private static bool killingPuppets;

	public static void Prefix(PlayableCard __instance)
	{
		if (!killingPuppets && !((Object)(object)__instance == (Object)null) && CardTraitHelper.HasTrait(__instance, "OLD_SA_PuppetMaster") && PuppetHelper.GetPuppets(__instance).Count != 0)
		{
			((MonoBehaviour)__instance).StartCoroutine(KillPuppets(__instance));
		}
	}

	private static IEnumerator KillPuppets(PlayableCard master)
	{
		if ((Object)(object)master == (Object)null)
		{
			yield break;
		}
		List<PlayableCard> puppets = new List<PlayableCard>(PuppetHelper.GetPuppets(master));
		if (puppets.Count == 0)
		{
			yield break;
		}
		yield return CardTraitDialogueManager.TryTrigger(master);
		killingPuppets = true;
		try
		{
			foreach (PlayableCard puppet in puppets)
			{
				if (!((Object)(object)puppet == (Object)null) && !puppet.Dead)
				{
					puppet.Die(false, master, true);
					yield return (object)new WaitForSeconds(0.1f);
				}
			}
		}
		finally
		{
			killingPuppets = false;
		}
	}
}
[HarmonyPatch(typeof(BoardManager), "AssignCardToSlot")]
public static class RatEmperorFusionPatch
{
	private static bool transforming;

	private const string FieldMouseName = "FieldMouse";

	private const string RatKingName = "RatKing";

	private const string PackRatName = "PackRat";

	private const string ResultCardName = "OLD_SA_RAT_EMPEROR";

	private const string DialogueID = "OLD_SA_RAT_EMPEROR_DIALOGUE";

	private const string Dialogue = "No... they've already overrun everything.";

	public static IEnumerator Postfix(IEnumerator __result, PlayableCard card)
	{
		while (__result.MoveNext())
		{
			yield return __result.Current;
		}
		yield return (object)new WaitForSeconds(0.05f);
		if (!transforming && !((Object)(object)card == (Object)null) && !card.Dead && !((Object)(object)((Card)card).Info == (Object)null) && card.OnBoard && !card.OpponentCard && !((Object)(object)card.Slot == (Object)null) && card.Slot.IsPlayerSlot)
		{
			yield return CheckFusion(card);
		}
	}

	private static IEnumerator CheckFusion(PlayableCard lastPlacedCard)
	{
		if (transforming || (Object)(object)lastPlacedCard == (Object)null || !lastPlacedCard.OnBoard || (Object)(object)((Card)lastPlacedCard).Info == (Object)null)
		{
			yield break;
		}
		string lastName = ((Object)((Card)lastPlacedCard).Info).name;
		if (lastName != "FieldMouse" && lastName != "RatKing" && lastName != "PackRat")
		{
			yield break;
		}
		BoardManager board = Singleton<BoardManager>.Instance;
		if ((Object)(object)board == (Object)null)
		{
			yield break;
		}
		PlayableCard fieldMouse = null;
		PlayableCard ratKing = null;
		PlayableCard packRat = null;
		foreach (CardSlot slot in board.GetSlots(true))
		{
			if ((Object)(object)slot == (Object)null || (Object)(object)slot.Card == (Object)null || slot.Card.Dead || (Object)(object)((Card)slot.Card).Info == (Object)null)
			{
				continue;
			}
			PlayableCard current = slot.Card;
			switch (((Object)((Card)current).Info).name)
			{
			case "FieldMouse":
				if ((Object)(object)fieldMouse == (Object)null)
				{
					fieldMouse = current;
				}
				break;
			case "RatKing":
				if ((Object)(object)ratKing == (Object)null)
				{
					ratKing = current;
				}
				break;
			case "PackRat":
				if ((Object)(object)packRat == (Object)null)
				{
					packRat = current;
				}
				break;
			}
		}
		if ((Object)(object)fieldMouse == (Object)null || (Object)(object)ratKing == (Object)null || (Object)(object)packRat == (Object)null || ((Object)(object)lastPlacedCard != (Object)(object)fieldMouse && (Object)(object)lastPlacedCard != (Object)(object)ratKing && (Object)(object)lastPlacedCard != (Object)(object)packRat))
		{
			yield break;
		}
		CardInfo result = CardLoader.GetCardByName("OLD_SA_RAT_EMPEROR");
		if ((Object)(object)result == (Object)null)
		{
			Debug.LogError((object)"[RatEmperorFusion] 找不到卡牌:OLD_SA_RAT_EMPEROR");
			yield break;
		}
		CardSlot spawnSlot = lastPlacedCard.Slot;
		if (!((Object)(object)spawnSlot == (Object)null))
		{
			transforming = true;
			try
			{
				yield return CardTraitDialogueManager.TryTrigger("OLD_SA_RAT_EMPEROR_DIALOGUE", "No... they've already overrun everything.");
				((Card)fieldMouse).Anim.ExitBoard(0.5f, Vector3.zero);
				((Card)ratKing).Anim.ExitBoard(0.5f, Vector3.zero);
				((Card)packRat).Anim.ExitBoard(0.5f, Vector3.zero);
				yield return (object)new WaitForSeconds(0.6f);
				ClearSlot(fieldMouse);
				ClearSlot(ratKing);
				ClearSlot(packRat);
				Object.Destroy((Object)(object)((Component)fieldMouse).gameObject);
				Object.Destroy((Object)(object)((Component)ratKing).gameObject);
				Object.Destroy((Object)(object)((Component)packRat).gameObject);
				yield return (object)new WaitForSeconds(0.2f);
				yield return Singleton<BoardManager>.Instance.CreateCardInSlot(result, spawnSlot, 0.1f, true);
				CarnivalMasterFusionManager.AddCard(result);
			}
			finally
			{
				transforming = false;
			}
		}
	}

	private static void ClearSlot(PlayableCard card)
	{
		if (!((Object)(object)card == (Object)null))
		{
			CardSlot slot = card.Slot;
			if ((Object)(object)slot != (Object)null && (Object)(object)slot.Card == (Object)(object)card)
			{
				slot.Card = null;
			}
			card.Slot = null;
		}
	}
}
[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();
	}
}

Xenowood_Law_Card/OldSa_Card_Helper.dll

Decompiled 5 days 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.Dialogue;
using InscryptionAPI.Helpers;
using InscryptionAPI.TalkingCards;
using InscryptionAPI.TalkingCards.Animation;
using InscryptionAPI.TalkingCards.Create;
using OLD_SA.CardTraits;
using OLD_SA.TalkingCards;
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_Card_Helper")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Card_Helper")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1f970448-c0fe-40dc-8c38-0f94e5a5ea4e")]
[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
{
	public static class ShieldTransform
	{
		private const string NormalKey = "OLD_SA.ShieldTransform.Normal";

		private const string OneShieldKey = "OLD_SA.ShieldTransform.OneShield";

		private const string MultiShieldKey = "OLD_SA.ShieldTransform.MultiShield";

		public static int GetForm(PlayableCard card)
		{
			if ((Object)(object)card == (Object)null || (Object)(object)((Card)card).Info == (Object)null)
			{
				return 0;
			}
			int lifeShieldStacks = GetLifeShieldStacks(card);
			if (lifeShieldStacks <= 0)
			{
				return 0;
			}
			if (lifeShieldStacks == 1)
			{
				return 1;
			}
			return 2;
		}

		private static int GetLifeShieldStacks(PlayableCard card)
		{
			if ((Object)(object)card == (Object)null)
			{
				return 0;
			}
			OLD_SA_LifeShield component = ((Component)card).GetComponent<OLD_SA_LifeShield>();
			if ((Object)(object)component == (Object)null)
			{
				return 0;
			}
			return component.GetStacks();
		}

		public static CardInfo GetTargetCard(PlayableCard card, int form)
		{
			if ((Object)(object)card == (Object)null || (Object)(object)((Card)card).Info == (Object)null)
			{
				return null;
			}
			string text;
			switch (form)
			{
			case 0:
				text = "OLD_SA.ShieldTransform.Normal";
				break;
			case 1:
				text = "OLD_SA.ShieldTransform.OneShield";
				break;
			case 2:
				text = "OLD_SA.ShieldTransform.MultiShield";
				break;
			default:
				return null;
			}
			string extendedProperty = CardExtensions.GetExtendedProperty(((Card)card).Info, text);
			if (string.IsNullOrEmpty(extendedProperty))
			{
				return null;
			}
			return CardLoader.GetCardByName(extendedProperty);
		}

		public static IEnumerator Transform(PlayableCard card)
		{
			if ((Object)(object)card == (Object)null || (Object)(object)((Card)card).Info == (Object)null || card.Dead)
			{
				yield break;
			}
			string oldTraits = CardExtensions.GetExtendedProperty(((Card)card).Info, "OLD_SA_Traits");
			string normal = CardExtensions.GetExtendedProperty(((Card)card).Info, "OLD_SA.ShieldTransform.Normal");
			string oneShield = CardExtensions.GetExtendedProperty(((Card)card).Info, "OLD_SA.ShieldTransform.OneShield");
			string multiShield = CardExtensions.GetExtendedProperty(((Card)card).Info, "OLD_SA.ShieldTransform.MultiShield");
			List<Ability> hiddenAbilities = new List<Ability>();
			if (card.Status != null && card.Status.hiddenAbilities != null)
			{
				hiddenAbilities.AddRange(card.Status.hiddenAbilities);
			}
			List<CardModificationInfo> mods = new List<CardModificationInfo>();
			foreach (CardModificationInfo mod in CardExtensions.AllCardModificationInfos(card))
			{
				if (mod != null && !mod.nonCopyable)
				{
					object obj = mod.Clone();
					CardModificationInfo cloneMod = (CardModificationInfo)((obj is CardModificationInfo) ? obj : null);
					if (cloneMod != null)
					{
						mods.Add(cloneMod);
					}
				}
			}
			int form = GetForm(card);
			CardInfo target = GetTargetCard(card, form);
			if ((Object)(object)target == (Object)null || ((Object)((Card)card).Info).name == ((Object)target).name)
			{
				yield break;
			}
			object obj2 = target.Clone();
			CardInfo clone = (CardInfo)((obj2 is CardInfo) ? obj2 : null);
			if ((Object)(object)clone == (Object)null)
			{
				yield break;
			}
			if (clone.Mods == null)
			{
				clone.Mods = new List<CardModificationInfo>();
			}
			foreach (CardModificationInfo mod2 in mods)
			{
				clone.Mods.Add(mod2);
			}
			yield return card.TransformIntoCard(clone, (Action)null, (Action)null);
			yield return (object)new WaitForSeconds(0.2f);
			if ((Object)(object)card == (Object)null || card.Dead || (Object)(object)((Card)card).Info == (Object)null)
			{
				yield break;
			}
			RestoreProperty(((Card)card).Info, "OLD_SA_Traits", oldTraits);
			RestoreProperty(((Card)card).Info, "OLD_SA.ShieldTransform.Normal", normal);
			RestoreProperty(((Card)card).Info, "OLD_SA.ShieldTransform.OneShield", oneShield);
			RestoreProperty(((Card)card).Info, "OLD_SA.ShieldTransform.MultiShield", multiShield);
			if (card.Status != null)
			{
				foreach (Ability ability in hiddenAbilities)
				{
					if (!card.Status.hiddenAbilities.Contains(ability))
					{
						card.Status.hiddenAbilities.Add(ability);
					}
				}
			}
			OLD_SA_TraitInjector.AddTraitBehaviours(card);
			card.OnStatsChanged();
			((Card)card).RenderCard();
			card.UpdateFaceUpOnBoardEffects();
			yield return (object)new WaitForSeconds(0.1f);
		}

		private static void RestoreProperty(CardInfo info, string key, string value)
		{
			if (!((Object)(object)info == (Object)null) && !string.IsNullOrEmpty(value))
			{
				CardExtensions.SetExtendedProperty(info, key, (object)value);
			}
		}
	}
	[HarmonyPatch(typeof(PlayableCard), "UpdateFaceUpOnBoardEffects")]
	public static class ShieldTransformPatch
	{
		private static readonly Dictionary<PlayableCard, int> LastForm = new Dictionary<PlayableCard, int>();

		private static readonly HashSet<PlayableCard> Transforming = new HashSet<PlayableCard>();

		[HarmonyPostfix]
		public static void Postfix(PlayableCard __instance)
		{
			if (!((Object)(object)__instance == (Object)null) && !((Object)(object)((Card)__instance).Info == (Object)null) && !__instance.Dead && !Transforming.Contains(__instance) && HasTransformConfiguration(__instance))
			{
				int form = ShieldTransform.GetForm(__instance);
				if (!LastForm.ContainsKey(__instance))
				{
					LastForm[__instance] = form;
				}
				else if (LastForm[__instance] != form)
				{
					Transforming.Add(__instance);
					((MonoBehaviour)__instance).StartCoroutine(TransformAndRelease(__instance));
				}
			}
		}

		private static IEnumerator TransformAndRelease(PlayableCard card)
		{
			try
			{
				if ((Object)(object)card == (Object)null || (Object)(object)((Card)card).Info == (Object)null || card.Dead)
				{
					yield break;
				}
				bool wasSubmerged = ((Card)card).FaceDown;
				if (wasSubmerged)
				{
					((Card)card).SetFaceDown(false, false);
					card.UpdateFaceUpOnBoardEffects();
					yield return (object)new WaitForSeconds(0.5f);
					if ((Object)(object)card == (Object)null || card.Dead)
					{
						yield break;
					}
				}
				if (((Card)card).FaceDown)
				{
					((Card)card).SetFaceDown(false, false);
					card.UpdateFaceUpOnBoardEffects();
					yield return (object)new WaitForSeconds(0.3f);
				}
				yield return ShieldTransform.Transform(card);
				if ((Object)(object)card == (Object)null || (Object)(object)((Card)card).Info == (Object)null || card.Dead)
				{
					yield break;
				}
				yield return (object)new WaitForSeconds(0.5f);
				bool targetHasSubmerge = CardExtensions.GetAbilityStacks(card, (Ability)13) > 0;
				if (wasSubmerged && targetHasSubmerge)
				{
					((Card)card).SetCardbackSubmerged();
					if (!((Card)card).FaceDown)
					{
						((Card)card).SetFaceDown(true, false);
					}
					yield return (object)new WaitForSeconds(0.3f);
				}
				else if (((Card)card).FaceDown)
				{
					((Card)card).SetFaceDown(false, false);
					card.UpdateFaceUpOnBoardEffects();
					yield return (object)new WaitForSeconds(0.3f);
				}
				LastForm[card] = ShieldTransform.GetForm(card);
			}
			finally
			{
				if ((Object)(object)card != (Object)null)
				{
					Transforming.Remove(card);
				}
			}
		}

		private static bool HasTransformConfiguration(PlayableCard card)
		{
			if ((Object)(object)card == (Object)null || (Object)(object)((Card)card).Info == (Object)null)
			{
				return false;
			}
			return !string.IsNullOrWhiteSpace(CardExtensions.GetExtendedProperty(((Card)card).Info, "OLD_SA.ShieldTransform.Normal")) || !string.IsNullOrWhiteSpace(CardExtensions.GetExtendedProperty(((Card)card).Info, "OLD_SA.ShieldTransform.OneShield")) || !string.IsNullOrWhiteSpace(CardExtensions.GetExtendedProperty(((Card)card).Info, "OLD_SA.ShieldTransform.MultiShield"));
		}
	}
}
namespace OLD_SA.CardHelper
{
	public static class OriginalCardPortraits
	{
		private class PortraitConfig
		{
			public string CardName;

			public string TextureName;

			public string EmissionTextureName;

			public PortraitConfig(string cardName, string textureName, string emissionTextureName)
			{
				CardName = cardName;
				TextureName = textureName;
				EmissionTextureName = emissionTextureName;
			}
		}

		private static readonly PortraitConfig[] PortraitConfigs = new PortraitConfig[1]
		{
			new PortraitConfig("SquirrelBall", "SquirrelBall.png", "SquirrelBall_em.png")
		};

		private static bool initialized;

		public static void Init()
		{
			if (!initialized)
			{
				initialized = true;
				CardManager.ModifyCardList += ModifyCards;
			}
		}

		private static List<CardInfo> ModifyCards(List<CardInfo> cards)
		{
			PortraitConfig[] portraitConfigs = PortraitConfigs;
			foreach (PortraitConfig config in portraitConfigs)
			{
				CardInfo val = cards.Find((CardInfo x) => (Object)(object)x != (Object)null && ((Object)x).name == config.CardName);
				if ((Object)(object)val == (Object)null)
				{
					Debug.LogWarning((object)("[OLD_SA] 找不到原版卡牌:" + config.CardName));
					continue;
				}
				Texture2D imageAsTexture = TextureHelper.GetImageAsTexture(config.TextureName, (FilterMode)0);
				Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture(config.EmissionTextureName, (FilterMode)0);
				if ((Object)(object)imageAsTexture == (Object)null || (Object)(object)imageAsTexture2 == (Object)null)
				{
					Debug.LogError((object)("[OLD_SA] 卡图加载失败:" + config.CardName));
				}
				else
				{
					CardExtensions.SetPortrait(val, imageAsTexture, imageAsTexture2, (FilterMode?)null);
				}
			}
			return cards;
		}
	}
	[BepInPlugin("OLD_SA.CardHelper", "OLD SA Card Helper", "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.CardHelper");
			OriginalCardPortraits.Init();
			val.PatchAll();
			TalkingCardRegister.Register();
			MarvelousBearTalkingCardRegister.Register();
			CentipedeTalkingCardRegister.Register();
			BloomCatTalkingCardRegister.Register();
			SkeletonSellswordTalkingCardRegister.Register();
		}
	}
}
namespace OLD_SA.CardHelper.Portrait
{
	public static class HermitCrabPortraitSwitch
	{
		private const string NORMAL_PORTRAIT = "OLD_SA.NormalPortrait";

		private const string NORMAL_EMISSION = "OLD_SA.NormalEmission";

		private const string ARMORED_PORTRAIT = "OLD_SA.ArmoredPortrait";

		private const string ARMORED_EMISSION = "OLD_SA.ArmoredEmission";

		public static IEnumerator SwitchToArmored(PlayableCard card)
		{
			if ((Object)(object)card == (Object)null || (Object)(object)((Card)card).Info == (Object)null)
			{
				yield break;
			}
			string portraitName = CardExtensions.GetExtendedProperty(((Card)card).Info, "OLD_SA.ArmoredPortrait");
			string emissionName = CardExtensions.GetExtendedProperty(((Card)card).Info, "OLD_SA.ArmoredEmission");
			if (!string.IsNullOrWhiteSpace(portraitName))
			{
				Sprite portrait = LoadPortrait(portraitName, emissionName);
				if (!((Object)(object)portrait == (Object)null))
				{
					card.SwitchToPortrait(portrait);
					((Card)card).RenderCard();
				}
			}
		}

		public static IEnumerator ResetPortrait(PlayableCard card)
		{
			if ((Object)(object)card == (Object)null || (Object)(object)((Card)card).Info == (Object)null)
			{
				yield break;
			}
			string portraitName = CardExtensions.GetExtendedProperty(((Card)card).Info, "OLD_SA.NormalPortrait");
			string emissionName = CardExtensions.GetExtendedProperty(((Card)card).Info, "OLD_SA.NormalEmission");
			if (!string.IsNullOrWhiteSpace(portraitName))
			{
				Sprite portrait = LoadPortrait(portraitName, emissionName);
				if (!((Object)(object)portrait == (Object)null))
				{
					card.SwitchToPortrait(portrait);
					((Card)card).RenderCard();
				}
			}
		}

		private static Sprite LoadPortrait(string portraitName, string emissionName)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			portraitName = NormalizeTextureName(portraitName);
			Texture2D val = null;
			try
			{
				val = TextureHelper.GetImageAsTexture(portraitName, (FilterMode)0);
			}
			catch
			{
			}
			if ((Object)(object)val == (Object)null)
			{
				Debug.Log((object)("[OLD SA] Missing portrait: " + portraitName));
				return null;
			}
			Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
			((Object)val2).name = portraitName;
			if (string.IsNullOrWhiteSpace(emissionName))
			{
				return val2;
			}
			emissionName = NormalizeTextureName(emissionName);
			Texture2D val3 = null;
			try
			{
				val3 = TextureHelper.GetImageAsTexture(emissionName, (FilterMode)0);
			}
			catch
			{
			}
			if ((Object)(object)val3 == (Object)null)
			{
				Debug.Log((object)("[OLD SA] Missing emission: " + emissionName));
				return val2;
			}
			Sprite val4 = Sprite.Create(val3, new Rect(0f, 0f, (float)((Texture)val3).width, (float)((Texture)val3).height), new Vector2(0.5f, 0.5f));
			((Object)val4).name = emissionName;
			TextureHelper.RegisterEmissionForSprite(val2, val4);
			return val2;
		}

		private static string NormalizeTextureName(string name)
		{
			if (string.IsNullOrWhiteSpace(name))
			{
				return name;
			}
			name = name.Trim();
			if (name.EndsWith(".png", StringComparison.OrdinalIgnoreCase))
			{
				return name;
			}
			return name + ".png";
		}
	}
	[HarmonyPatch(typeof(PlayableCard), "UpdateFaceUpOnBoardEffects")]
	public static class HermitCrabShieldPortraitPatch
	{
		private static readonly Dictionary<PlayableCard, bool> ShieldState = new Dictionary<PlayableCard, bool>();

		private static readonly Dictionary<PlayableCard, Coroutine> PortraitCoroutines = new Dictionary<PlayableCard, Coroutine>();

		[HarmonyPostfix]
		public static void Postfix(PlayableCard __instance)
		{
			if ((Object)(object)__instance == (Object)null || (Object)(object)((Card)__instance).Info == (Object)null)
			{
				return;
			}
			string extendedProperty = CardExtensions.GetExtendedProperty(((Card)__instance).Info, "OLD_SA.NormalPortrait");
			string extendedProperty2 = CardExtensions.GetExtendedProperty(((Card)__instance).Info, "OLD_SA.ArmoredPortrait");
			if (!string.IsNullOrWhiteSpace(extendedProperty) && !string.IsNullOrWhiteSpace(extendedProperty2))
			{
				bool flag = __instance.HasShield();
				if ((!ShieldState.TryGetValue(__instance, out var value) || value != flag || !PortraitCoroutines.ContainsKey(__instance)) && (!ShieldState.TryGetValue(__instance, out value) || value != flag))
				{
					ShieldState[__instance] = flag;
					StartPortraitUpdate(__instance, flag);
				}
			}
		}

		private static void StartPortraitUpdate(PlayableCard card, bool armored)
		{
			if ((Object)(object)card == (Object)null)
			{
				return;
			}
			if (PortraitCoroutines.TryGetValue(card, out var value))
			{
				if (value != null)
				{
					((MonoBehaviour)card).StopCoroutine(value);
				}
				PortraitCoroutines.Remove(card);
			}
			Coroutine value2 = ((MonoBehaviour)card).StartCoroutine(UpdatePortrait(card, armored));
			PortraitCoroutines[card] = value2;
		}

		private static IEnumerator UpdatePortrait(PlayableCard card, bool expectedShield)
		{
			yield return null;
			if ((Object)(object)card == (Object)null || (Object)(object)((Card)card).Info == (Object)null)
			{
				yield break;
			}
			bool currentShield = card.HasShield();
			if (currentShield != expectedShield)
			{
				ShieldState[card] = currentShield;
				PortraitCoroutines.Remove(card);
				StartPortraitUpdate(card, currentShield);
				yield break;
			}
			if (expectedShield)
			{
				yield return HermitCrabPortraitSwitch.SwitchToArmored(card);
			}
			else
			{
				yield return HermitCrabPortraitSwitch.ResetPortrait(card);
			}
			if ((Object)(object)card != (Object)null)
			{
				bool finalShield = card.HasShield();
				PortraitCoroutines.Remove(card);
				if (finalShield != expectedShield)
				{
					ShieldState[card] = finalShield;
					StartPortraitUpdate(card, finalShield);
				}
			}
		}
	}
	public static class PortraitRefresh
	{
		public static IEnumerator Refresh(PlayableCard card)
		{
			if (!((Object)(object)card == (Object)null) && !((Object)(object)((Card)card).Info == (Object)null))
			{
				yield return HermitCrabPortraitSwitch.ResetPortrait(card);
				TailPortraitSwitch.Reset(card);
				((Card)card).RenderCard();
			}
		}
	}
	[HarmonyPatch(typeof(TailOnHit), "SetTailLost")]
	public static class TailPortraitPatch
	{
		public static void Postfix(TailOnHit __instance, bool lost)
		{
			if ((Object)(object)__instance == (Object)null)
			{
				return;
			}
			PlayableCard card = GetCard(__instance);
			if (!((Object)(object)card == (Object)null) && !((Object)(object)((Card)card).Info == (Object)null))
			{
				if (lost)
				{
					TailPortraitSwitch.SwitchToLostTail(card);
				}
				else
				{
					TailPortraitSwitch.Reset(card);
				}
			}
		}

		private static PlayableCard GetCard(TailOnHit behaviour)
		{
			if ((Object)(object)behaviour == (Object)null)
			{
				return null;
			}
			PropertyInfo propertyInfo = AccessTools.Property(((object)behaviour).GetType(), "Card");
			if (propertyInfo != null && typeof(PlayableCard).IsAssignableFrom(propertyInfo.PropertyType))
			{
				try
				{
					object? value = propertyInfo.GetValue(behaviour, null);
					PlayableCard val = (PlayableCard)((value is PlayableCard) ? value : null);
					if ((Object)(object)val != (Object)null)
					{
						return val;
					}
				}
				catch (Exception)
				{
				}
			}
			Type type = ((object)behaviour).GetType();
			while (type != null)
			{
				FieldInfo fieldInfo = AccessTools.Field(type, "Card");
				if (fieldInfo != null && typeof(PlayableCard).IsAssignableFrom(fieldInfo.FieldType))
				{
					try
					{
						object? value2 = fieldInfo.GetValue(behaviour);
						PlayableCard val2 = (PlayableCard)((value2 is PlayableCard) ? value2 : null);
						if ((Object)(object)val2 != (Object)null)
						{
							return val2;
						}
					}
					catch (Exception)
					{
					}
				}
				type = type.BaseType;
			}
			return null;
		}
	}
	public static class TailPortraitSwitch
	{
		private const string NORMAL = "OLD_SA.TailNormalPortrait";

		private const string NORMAL_EM = "OLD_SA.TailNormalEmission";

		private const string LOST = "OLD_SA.TailLostPortrait";

		private const string LOST_EM = "OLD_SA.TailLostEmission";

		public static void SwitchToLostTail(PlayableCard card)
		{
			SwitchPortrait(card, "OLD_SA.TailLostPortrait", "OLD_SA.TailLostEmission", "断尾");
		}

		public static void Reset(PlayableCard card)
		{
			SwitchPortrait(card, "OLD_SA.TailNormalPortrait", "OLD_SA.TailNormalEmission", "普通");
		}

		private static void SwitchPortrait(PlayableCard card, string portraitKey, string emissionKey, string stateName)
		{
			if ((Object)(object)card == (Object)null || (Object)(object)((Card)card).Info == (Object)null)
			{
				return;
			}
			string extendedProperty = CardExtensions.GetExtendedProperty(((Card)card).Info, portraitKey);
			if (!string.IsNullOrWhiteSpace(extendedProperty))
			{
				string extendedProperty2 = CardExtensions.GetExtendedProperty(((Card)card).Info, emissionKey);
				Sprite val = LoadPortrait(extendedProperty, extendedProperty2);
				if (!((Object)(object)val == (Object)null))
				{
					card.SwitchToPortrait(val);
					((Card)card).RenderCard();
				}
			}
		}

		private static Sprite LoadPortrait(string portraitName, string emissionName)
		{
			//IL_0049: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			portraitName = Normalize(portraitName);
			Texture2D imageAsTexture;
			try
			{
				imageAsTexture = TextureHelper.GetImageAsTexture(portraitName, (FilterMode)0);
			}
			catch (Exception)
			{
				return null;
			}
			if ((Object)(object)imageAsTexture == (Object)null)
			{
				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 = portraitName;
			if (!string.IsNullOrWhiteSpace(emissionName))
			{
				emissionName = Normalize(emissionName);
				try
				{
					Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture(emissionName, (FilterMode)0);
					if ((Object)(object)imageAsTexture2 != (Object)null)
					{
						Sprite val2 = Sprite.Create(imageAsTexture2, new Rect(0f, 0f, (float)((Texture)imageAsTexture2).width, (float)((Texture)imageAsTexture2).height), new Vector2(0.5f, 0.5f));
						((Object)val2).name = emissionName;
						TextureHelper.RegisterEmissionForSprite(val, val2);
					}
				}
				catch (Exception)
				{
				}
			}
			return val;
		}

		private static string Normalize(string name)
		{
			if (string.IsNullOrWhiteSpace(name))
			{
				return name;
			}
			if (!name.EndsWith(".png", StringComparison.OrdinalIgnoreCase))
			{
				return name + ".png";
			}
			return name;
		}
	}
}
namespace OLD_SA.TalkingCards
{
	public static class BloomCatTalkingCardRegister
	{
		private const string CardName = "OLD_SA_SAKURA_CAT";

		private const string PluginGuid = "OLD_SA.CardHelper";

		private static readonly HashSet<DialogueEvent> RandomDialogueEvents = new HashSet<DialogueEvent>();

		private static bool patched;

		public static void Register()
		{
			PatchDialogueSelection();
			RegisterFace();
			RegisterDialogues();
		}

		private static void PatchDialogueSelection()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			if (!patched)
			{
				Harmony val = new Harmony("OLD_SA.CardHelper.BloomCatDialogue");
				val.Patch((MethodBase)AccessTools.Method(typeof(DialogueEvent), "GetLines", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(BloomCatTalkingCardRegister), "GetLinesPostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				patched = true;
			}
		}

		private static void GetLinesPostfix(DialogueEvent __instance, ref List<Line> __result)
		{
			if (__result != null && __result.Count > 1 && RandomDialogueEvents.Contains(__instance))
			{
				Line item = __result[Random.Range(0, __result.Count)];
				__result = new List<Line> { item };
			}
		}

		private static Sprite LoadSprite(string fileName)
		{
			//IL_0022: 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)
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture(fileName, (FilterMode)0);
			return Sprite.Create(imageAsTexture, new Rect(0f, 0f, (float)((Texture)imageAsTexture).width, (float)((Texture)imageAsTexture).height), new Vector2(0.5f, 0f), 100f);
		}

		private static FaceAnim LoadFaceAnim(string openFile, string closedFile)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			return new FaceAnim(LoadSprite(openFile), LoadSprite(closedFile));
		}

		private static void RegisterFace()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Expected O, but got Unknown
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Expected O, but got Unknown
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Expected O, but got Unknown
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Expected O, but got Unknown
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			List<EmotionData> list = new List<EmotionData>
			{
				new EmotionData((Emotion)0, LoadSprite("SakuraCat_Face.png"), LoadFaceAnim("SakuraCat_Neutral_Eyes_Open.png", "SakuraCat_Eyes_Closed.png"), LoadFaceAnim("SakuraCat_Mouth_Open.png", "SakuraCat_Mouth_Closed.png"), LoadFaceAnim("OLD_SA_SAKURA_CAT_em.png", "SakuraCat_Eyes_Closed_Emission.png")),
				new EmotionData((Emotion)1, LoadSprite("SakuraCat_Face.png"), LoadFaceAnim("SakuraCat_Happy_Eyes_Open.png", "SakuraCat_Eyes_Closed.png"), LoadFaceAnim("SakuraCat_Mouth_Open.png", "SakuraCat_Happy_Mouth_Closed.png"), LoadFaceAnim("OLD_SA_SAKURA_CAT_em.png", "SakuraCat_Eyes_Closed_Emission.png")),
				new EmotionData((Emotion)3, LoadSprite("SakuraCat_Face.png"), LoadFaceAnim("SakuraCat_Sad_Eyes_Open.png", "SakuraCat_Eyes_Closed.png"), LoadFaceAnim("SakuraCat_Mouth_Open.png", "SakuraCat_Sad_Mouth_Closed.png"), LoadFaceAnim("OLD_SA_SAKURA_CAT_em.png", "SakuraCat_Eyes_Closed_Emission.png")),
				new EmotionData((Emotion)4, LoadSprite("SakuraCat_Face.png"), LoadFaceAnim("SakuraCat_Surprised_Eyes_Open.png", "SakuraCat_Eyes_Closed.png"), LoadFaceAnim("SakuraCat_Mouth_Open.png", "SakuraCat_Surprised_Mouth_Closed.png"), LoadFaceAnim("OLD_SA_SAKURA_CAT_em.png", "SakuraCat_Eyes_Closed_Emission.png"))
			};
			FaceInfo val = new FaceInfo((float?)1.5f, "cat_voice", (float?)1f, (string)null);
			FaceData val2 = new FaceData("OLD_SA_SAKURA_CAT", list, val);
			TalkingCardManager.Create(val2, GeneratePortrait.DialogueDummy);
		}

		private static CustomLine Line(string text, Emotion emotion)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			CustomLine result = default(CustomLine);
			((CustomLine)(ref result))..ctor();
			result.text = text;
			result.emotion = emotion;
			return result;
		}

		private static void RegisterEvent(string eventName, CustomLine[] mainLines, CustomLine[] repeatLines = null)
		{
			string text = "OLD_SA_SAKURA_CAT_" + eventName;
			List<CustomLine> list = new List<CustomLine>(mainLines);
			List<List<CustomLine>> list2 = null;
			if (repeatLines != null && repeatLines.Length != 0)
			{
				list2 = new List<List<CustomLine>>
				{
					new List<CustomLine>(repeatLines)
				};
			}
			DialogueEvent val = DialogueManager.GenerateEvent("OLD_SA.CardHelper", text, list, list2, (MaxRepeatsBehaviour)0, (Speaker)0);
			if (val != null)
			{
				RandomDialogueEvents.Add(val);
			}
			TalkingCardCreator.AddToDialogueCache(text);
		}

		private static void RegisterDialogues()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//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_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: 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_0085: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: 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)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: 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_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: 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_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			RegisterEvent("OnDrawn", (CustomLine[])(object)new CustomLine[3]
			{
				Line("H-Hello!", (Emotion)1),
				Line("Meow...", (Emotion)4),
				Line("I'm happy to see you! Hehe.", (Emotion)1)
			});
			RegisterEvent("OnPlayFromHand", (CustomLine[])(object)new CustomLine[3]
			{
				Line("I'll protect everyone!", (Emotion)1),
				Line("Please let me heal everyone.", (Emotion)0),
				Line("Please believe in me.", (Emotion)0)
			});
			RegisterEvent("OnAttacked", (CustomLine[])(object)new CustomLine[3]
			{
				Line("Meow!", (Emotion)3),
				Line("What's that for?!", (Emotion)3),
				Line("I protected you...", (Emotion)1)
			});
			RegisterEvent("OnBecomeSelectablePositive", (CustomLine[])(object)new CustomLine[3]
			{
				Line("Pick me, meow!", (Emotion)1),
				Line("Look at me! Look at me!", (Emotion)1),
				Line("Will it be me?", (Emotion)1)
			});
			RegisterEvent("OnBecomeSelectableNegative", (CustomLine[])(object)new CustomLine[3]
			{
				Line("I don't want to leave you...", (Emotion)4),
				Line("Do you dislike me?", (Emotion)3),
				Line("Meow...", (Emotion)4)
			});
			RegisterEvent("OnSacrificed", (CustomLine[])(object)new CustomLine[3]
			{
				Line("Alright, meow...", (Emotion)4),
				Line("I don't blame you.", (Emotion)3),
				Line("Goodbye...", (Emotion)3)
			});
			RegisterEvent("OnSelectedForDeckTrial", (CustomLine[])(object)new CustomLine[3]
			{
				Line("Good luck!", (Emotion)1),
				Line("I hope I was helpful.", (Emotion)4),
				Line("Wishing you the best of luck!", (Emotion)1)
			});
			RegisterEvent("OnSelectedForCardMerge", (CustomLine[])(object)new CustomLine[3]
			{
				Line("Thank you!", (Emotion)1),
				Line("I won't let you down.", (Emotion)4),
				Line("Will I become even better?", (Emotion)4)
			});
			RegisterEvent("OnDiscoveredInExploration", (CustomLine[])(object)new CustomLine[1] { Line("Hello, I'm Sakura Cat!", (Emotion)4) }, (CustomLine[])(object)new CustomLine[3]
			{
				Line("I've missed you so much!", (Emotion)4),
				Line("We're meeting again!", (Emotion)1),
				Line("Meow!", (Emotion)1)
			});
		}
	}
	public static class CentipedeTalkingCardRegister
	{
		private const string CardName = "OLD_SA_TALKING_CENTIPEDE";

		private const string PluginGuid = "OLD_SA.CardHelper";

		private static readonly HashSet<DialogueEvent> RandomDialogueEvents = new HashSet<DialogueEvent>();

		private static bool patched;

		public static void Register()
		{
			PatchDialogueSelection();
			RegisterFace();
			RegisterDialogues();
		}

		private static void PatchDialogueSelection()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			if (!patched)
			{
				Harmony val = new Harmony("OLD_SA.CardHelper.CentipedeDialogue");
				val.Patch((MethodBase)AccessTools.Method(typeof(DialogueEvent), "GetLines", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(CentipedeTalkingCardRegister), "GetLinesPostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				patched = true;
			}
		}

		private static void GetLinesPostfix(DialogueEvent __instance, ref List<Line> __result)
		{
			if (__result != null && __result.Count > 1 && RandomDialogueEvents.Contains(__instance))
			{
				Line item = __result[Random.Range(0, __result.Count)];
				__result = new List<Line> { item };
			}
		}

		private static Sprite LoadSprite(string fileName)
		{
			//IL_0022: 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)
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture(fileName, (FilterMode)0);
			return Sprite.Create(imageAsTexture, new Rect(0f, 0f, (float)((Texture)imageAsTexture).width, (float)((Texture)imageAsTexture).height), new Vector2(0.5f, 0f), 100f);
		}

		private static FaceAnim LoadFaceAnim(string openFile, string closedFile)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			return new FaceAnim(LoadSprite(openFile), LoadSprite(closedFile));
		}

		private static void RegisterFace()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Expected O, but got Unknown
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Expected O, but got Unknown
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Expected O, but got Unknown
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Expected O, but got Unknown
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			List<EmotionData> list = new List<EmotionData>
			{
				new EmotionData((Emotion)0, LoadSprite("Centipede_Face.png"), LoadFaceAnim("Centipede_Neutral_Eyes_Open.png", "Centipede_Eyes_Closed.png"), LoadFaceAnim("Centipede_Mouth_Open.png", "Centipede_Mouth_Closed.png"), LoadFaceAnim("OLD_SA_TALKING_CENTIPEDE_em.png", "Centipede_Eyes_Closed_Emission.png")),
				new EmotionData((Emotion)2, LoadSprite("Centipede_Face.png"), LoadFaceAnim("Centipede_Angry_Eyes_Open.png", "Centipede_Eyes_Closed.png"), LoadFaceAnim("Centipede_Mouth_Open.png", "Centipede_Mouth_Closed.png"), LoadFaceAnim("Centipede_Angry_Eyes_Open_Emission.png", "Centipede_Eyes_Closed_Emission.png")),
				new EmotionData((Emotion)3, LoadSprite("Centipede_Face.png"), LoadFaceAnim("Centipede_Sad_Eyes_Open.png", "Centipede_Eyes_Closed.png"), LoadFaceAnim("Centipede_Mouth_Open.png", "Centipede_Mouth_Closed.png"), LoadFaceAnim("Centipede_Sad_Eyes_Open_Emission.png", "Centipede_Eyes_Closed_Emission.png")),
				new EmotionData((Emotion)4, LoadSprite("Centipede_Face.png"), LoadFaceAnim("Centipede_Surprised_Eyes_Open.png", "Centipede_Eyes_Closed.png"), LoadFaceAnim("Centipede_Mouth_Open.png", "Centipede_Mouth_Closed.png"), LoadFaceAnim("Centipede_Surprised_Eyes_Open_Emission.png", "Centipede_Eyes_Closed_Emission.png"))
			};
			FaceInfo val = new FaceInfo((float?)1.5f, "kobold_voice", (float?)1.4f, (string)null);
			FaceData val2 = new FaceData("OLD_SA_TALKING_CENTIPEDE", list, val);
			TalkingCardManager.Create(val2, GeneratePortrait.DialogueDummy);
		}

		private static CustomLine Line(string text, Emotion emotion)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			CustomLine result = default(CustomLine);
			((CustomLine)(ref result))..ctor();
			result.text = text;
			result.emotion = emotion;
			return result;
		}

		private static void RegisterEvent(string eventName, CustomLine[] mainLines, CustomLine[] repeatLines = null)
		{
			string text = "OLD_SA_TALKING_CENTIPEDE_" + eventName;
			List<CustomLine> list = new List<CustomLine>(mainLines);
			List<List<CustomLine>> list2 = null;
			if (repeatLines != null && repeatLines.Length != 0)
			{
				list2 = new List<List<CustomLine>>
				{
					new List<CustomLine>(repeatLines)
				};
			}
			DialogueEvent val = DialogueManager.GenerateEvent("OLD_SA.CardHelper", text, list, list2, (MaxRepeatsBehaviour)0, (Speaker)0);
			if (val != null)
			{
				RandomDialogueEvents.Add(val);
			}
			TalkingCardCreator.AddToDialogueCache(text);
		}

		private static void RegisterDialogues()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//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_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: 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_0085: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: 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)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: 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_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: 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_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			RegisterEvent("OnDrawn", (CustomLine[])(object)new CustomLine[3]
			{
				Line("Hey, hey! Look at me!", (Emotion)4),
				Line("Wait, oh!", (Emotion)4),
				Line("Things aren't looking too good right now.", (Emotion)2)
			});
			RegisterEvent("OnPlayFromHand", (CustomLine[])(object)new CustomLine[3]
			{
				Line("You want me to get myself killed?!", (Emotion)2),
				Line("Me? Really?", (Emotion)4),
				Line("Don't let me down!", (Emotion)3)
			});
			RegisterEvent("OnAttacked", (CustomLine[])(object)new CustomLine[3]
			{
				Line("I knew it!", (Emotion)2),
				Line("Pay me back!", (Emotion)2),
				Line("What was that for?!", (Emotion)4)
			});
			RegisterEvent("OnBecomeSelectablePositive", (CustomLine[])(object)new CustomLine[3]
			{
				Line("Wait, is it me?", (Emotion)4),
				Line("It's going to be me, right?!", (Emotion)4),
				Line("Could it not be me?", (Emotion)3)
			});
			RegisterEvent("OnBecomeSelectableNegative", (CustomLine[])(object)new CustomLine[3]
			{
				Line("Wait, don't pick me!", (Emotion)2),
				Line("Get your filthy hands off me!", (Emotion)2),
				Line("I don't want this!", (Emotion)2)
			});
			RegisterEvent("OnSacrificed", (CustomLine[])(object)new CustomLine[3]
			{
				Line("You're using me for THIS?!", (Emotion)2),
				Line("Huh?", (Emotion)4),
				Line("HAH!", (Emotion)2)
			});
			RegisterEvent("OnSelectedForDeckTrial", (CustomLine[])(object)new CustomLine[3]
			{
				Line("Do I get paid if I pass?", (Emotion)0),
				Line("You picked me just like that?", (Emotion)4),
				Line("Wait, what's going on?", (Emotion)2)
			});
			RegisterEvent("OnSelectedForCardMerge", (CustomLine[])(object)new CustomLine[3]
			{
				Line("Yes, yes.", (Emotion)0),
				Line("A fair deal, pal.", (Emotion)0),
				Line("Don't treat me like a trash can!", (Emotion)2)
			});
			RegisterEvent("OnDiscoveredInExploration", (CustomLine[])(object)new CustomLine[1] { Line("Wait? Where am I? Well, at least this isn't another inn.", (Emotion)4) }, (CustomLine[])(object)new CustomLine[3]
			{
				Line("You again?", (Emotion)4),
				Line("Oh, don't pick me!", (Emotion)2),
				Line("I don't want to go adventuring with you!", (Emotion)2)
			});
		}
	}
	public static class MarvelousBearTalkingCardRegister
	{
		private const string CardName = "OLD_SA_MARVELOUS_BEAR";

		private const string PluginGuid = "OLD_SA.CardHelper";

		private static readonly HashSet<DialogueEvent> RandomDialogueEvents = new HashSet<DialogueEvent>();

		private static bool patched;

		public static void Register()
		{
			PatchDialogueSelection();
			RegisterFace();
			RegisterDialogues();
		}

		private static void PatchDialogueSelection()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			if (!patched)
			{
				Harmony val = new Harmony("OLD_SA.CardHelper.MarvelousBearDialogue");
				val.Patch((MethodBase)AccessTools.Method(typeof(DialogueEvent), "GetLines", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(MarvelousBearTalkingCardRegister), "GetLinesPostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				patched = true;
			}
		}

		private static void GetLinesPostfix(DialogueEvent __instance, ref List<Line> __result)
		{
			if (__result != null && __result.Count > 1 && RandomDialogueEvents.Contains(__instance))
			{
				Line item = __result[Random.Range(0, __result.Count)];
				__result = new List<Line> { item };
			}
		}

		private static Sprite LoadSprite(string fileName)
		{
			//IL_0022: 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)
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture(fileName, (FilterMode)0);
			return Sprite.Create(imageAsTexture, new Rect(0f, 0f, (float)((Texture)imageAsTexture).width, (float)((Texture)imageAsTexture).height), new Vector2(0.5f, 0f), 100f);
		}

		private static FaceAnim LoadFaceAnim(string openFile, string closedFile)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			return new FaceAnim(LoadSprite(openFile), LoadSprite(closedFile));
		}

		private static void RegisterFace()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Expected O, but got Unknown
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Expected O, but got Unknown
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Expected O, but got Unknown
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Expected O, but got Unknown
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			List<EmotionData> list = new List<EmotionData>
			{
				new EmotionData((Emotion)0, LoadSprite("MarvelousBear_Face.png"), LoadFaceAnim("MarvelousBear_Neutral_Eyes_Open.png", "MarvelousBear_Eyes_Closed.png"), LoadFaceAnim("MarvelousBear_Mouth_Open.png", "MarvelousBear_Neutral_Mouth_Closed.png"), LoadFaceAnim("MarvelousBear_Emission.png", "MarvelousBear_Emission.png")),
				new EmotionData((Emotion)1, LoadSprite("MarvelousBear_Face.png"), LoadFaceAnim("MarvelousBear_Neutral_Eyes_Open.png", "MarvelousBear_Happy_Eyes_Closed.png"), LoadFaceAnim("MarvelousBear_Mouth_Open.png", "MarvelousBear_Happy_Mouth_Closed.png"), LoadFaceAnim("MarvelousBear_Emission.png", "MarvelousBear_Emission.png")),
				new EmotionData((Emotion)2, LoadSprite("MarvelousBear_Face.png"), LoadFaceAnim("MarvelousBear_Angry_Eyes_Open.png", "MarvelousBear_Eyes_Closed.png"), LoadFaceAnim("MarvelousBear_Mouth_Open.png", "MarvelousBear_Angry_Mouth_Closed.png"), LoadFaceAnim("MarvelousBear_Emission.png", "MarvelousBear_Emission.png")),
				new EmotionData((Emotion)3, LoadSprite("MarvelousBear_Face.png"), LoadFaceAnim("MarvelousBear_Sad_Eyes_Open.png", "MarvelousBear_Eyes_Closed.png"), LoadFaceAnim("MarvelousBear_Mouth_Open.png", "MarvelousBear_Sad_Mouth_Closed.png"), LoadFaceAnim("MarvelousBear_Emission.png", "MarvelousBear_Emission.png"))
			};
			FaceInfo val = new FaceInfo((float?)1.5f, "kobold_voice", (float?)0.8f, (string)null);
			FaceData val2 = new FaceData("OLD_SA_MARVELOUS_BEAR", list, val);
			TalkingCardManager.Create(val2, GeneratePortrait.DialogueDummy);
		}

		private static CustomLine Line(string text, Emotion emotion)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			CustomLine result = default(CustomLine);
			((CustomLine)(ref result))..ctor();
			result.text = text;
			result.emotion = emotion;
			return result;
		}

		private static void RegisterEvent(string eventName, CustomLine[] mainLines, CustomLine[] repeatLines = null)
		{
			string text = "OLD_SA_MARVELOUS_BEAR_" + eventName;
			List<CustomLine> list = new List<CustomLine>(mainLines);
			List<List<CustomLine>> list2 = null;
			if (repeatLines != null && repeatLines.Length != 0)
			{
				list2 = new List<List<CustomLine>>
				{
					new List<CustomLine>(repeatLines)
				};
			}
			DialogueEvent val = DialogueManager.GenerateEvent("OLD_SA.CardHelper", text, list, list2, (MaxRepeatsBehaviour)0, (Speaker)0);
			if (val != null)
			{
				RandomDialogueEvents.Add(val);
			}
			TalkingCardCreator.AddToDialogueCache(text);
		}

		private static void RegisterDialogues()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//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_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: 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_0085: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: 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)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: 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_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: 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_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			RegisterEvent("OnDrawn", (CustomLine[])(object)new CustomLine[3]
			{
				Line("Do you like bear paintings?", (Emotion)1),
				Line("A magical paintbrush will never disappoint you.", (Emotion)1),
				Line("Bear likes you! Bear hopes you like Bear too.", (Emotion)1)
			});
			RegisterEvent("OnPlayFromHand", (CustomLine[])(object)new CustomLine[3]
			{
				Line("Outdoor painting!", (Emotion)1),
				Line("Bear is here to add a little color!", (Emotion)1),
				Line("The mighty Bear strikes!", (Emotion)2)
			});
			RegisterEvent("OnAttacked", (CustomLine[])(object)new CustomLine[3]
			{
				Line("Bear's paintbrush has split.", (Emotion)3),
				Line("Hey! That's rude!", (Emotion)2),
				Line("Ouch!", (Emotion)3)
			});
			RegisterEvent("OnBecomeSelectablePositive", (CustomLine[])(object)new CustomLine[3]
			{
				Line("Let Bear see the new materials.", (Emotion)0),
				Line("Bear trusts your taste.", (Emotion)1),
				Line("Trust Bear's eye for art!", (Emotion)0)
			});
			RegisterEvent("OnBecomeSelectableNegative", (CustomLine[])(object)new CustomLine[3]
			{
				Line("You don't seem to like this style?", (Emotion)3),
				Line("Alright, Bear will try a different technique next time.", (Emotion)3),
				Line("Bear will still like you.", (Emotion)3)
			});
			RegisterEvent("OnSacrificed", (CustomLine[])(object)new CustomLine[3]
			{
				Line("Hey! Bear just started sketching!", (Emotion)2),
				Line("Alright, Bear will do this for you.", (Emotion)3),
				Line("Bear is going to wash the paintbrush.", (Emotion)3)
			});
			RegisterEvent("OnSelectedForDeckTrial", (CustomLine[])(object)new CustomLine[3]
			{
				Line("Magic is art!", (Emotion)1),
				Line("Bear will carefully study these runes.", (Emotion)1),
				Line("Success and failure are like light and shadow.", (Emotion)1)
			});
			RegisterEvent("OnSelectedForCardMerge", (CustomLine[])(object)new CustomLine[3]
			{
				Line("More paintbrushes and more colors.", (Emotion)1),
				Line("A victory for Dadaism!", (Emotion)1),
				Line("Bear feels... marvelous.", (Emotion)1)
			});
			RegisterEvent("OnSelectedForCardRemove", (CustomLine[])(object)new CustomLine[3]
			{
				Line("Goodbye, Bear's muse.", (Emotion)3),
				Line("Bear would like to take a little nap.", (Emotion)3),
				Line("Bear's art will stay with you.", (Emotion)3)
			});
			RegisterEvent("OnDiscoveredInExploration", (CustomLine[])(object)new CustomLine[1] { Line("Hello! Would you like to be Bear's muse?", (Emotion)1) }, (CustomLine[])(object)new CustomLine[3]
			{
				Line("...Bear thought Bear had lost you.", (Emotion)3),
				Line("Bear's inspiration... has returned.", (Emotion)3),
				Line("Bear's world is colorful again!", (Emotion)3)
			});
		}
	}
	public static class SkeletonSellswordTalkingCardRegister
	{
		private const string CardName = "OLD_SA_SKELETON_SELLSWORD";

		private const string PluginGuid = "OLD_SA.CardHelper";

		private static readonly HashSet<DialogueEvent> RandomDialogueEvents = new HashSet<DialogueEvent>();

		private static bool patched;

		public static void Register()
		{
			PatchDialogueSelection();
			RegisterFace();
			RegisterDialogues();
		}

		private static void PatchDialogueSelection()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			if (!patched)
			{
				Harmony val = new Harmony("OLD_SA.CardHelper.SkeletonSellswordDialogue");
				val.Patch((MethodBase)AccessTools.Method(typeof(DialogueEvent), "GetLines", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(SkeletonSellswordTalkingCardRegister), "GetLinesPostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				patched = true;
			}
		}

		private static void GetLinesPostfix(DialogueEvent __instance, ref List<Line> __result)
		{
			if (__result != null && __result.Count > 1 && RandomDialogueEvents.Contains(__instance))
			{
				Line item = __result[Random.Range(0, __result.Count)];
				__result = new List<Line> { item };
			}
		}

		private static Sprite LoadSprite(string fileName)
		{
			//IL_0022: 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)
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture(fileName, (FilterMode)0);
			return Sprite.Create(imageAsTexture, new Rect(0f, 0f, (float)((Texture)imageAsTexture).width, (float)((Texture)imageAsTexture).height), new Vector2(0.5f, 0f), 100f);
		}

		private static FaceAnim LoadFaceAnim(string openFile, string closedFile)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			return new FaceAnim(LoadSprite(openFile), LoadSprite(closedFile));
		}

		private static void RegisterFace()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Expected O, but got Unknown
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Expected O, but got Unknown
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Expected O, but got Unknown
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Expected O, but got Unknown
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			List<EmotionData> list = new List<EmotionData>
			{
				new EmotionData((Emotion)0, LoadSprite("SkeletonSellsword_Face.png"), LoadFaceAnim("SkeletonSellsword_Neutral_Eyes_Open.png", "SkeletonSellsword_Eyes_Closed.png"), LoadFaceAnim("SkeletonSellsword_Mouth_Open.png", "SkeletonSellsword_Mouth_Closed.png"), LoadFaceAnim("SkeletonSellsword_Neutral_Eyes_Open_Emission.png", "SkeletonSellsword_Eyes_Closed_Emission.png")),
				new EmotionData((Emotion)1, LoadSprite("SkeletonSellsword_Face.png"), LoadFaceAnim("SkeletonSellsword_Neutral_Eyes_Open.png", "SkeletonSellsword_Happy_Eyes_Closed.png"), LoadFaceAnim("SkeletonSellsword_Mouth_Open.png", "SkeletonSellsword_Mouth_Closed.png"), LoadFaceAnim("SkeletonSellsword_Neutral_Eyes_Open_Emission.png", "SkeletonSellsword_Happy_Eyes_Closed_Emission.png")),
				new EmotionData((Emotion)2, LoadSprite("SkeletonSellsword_Face.png"), LoadFaceAnim("SkeletonSellsword_Angry_Eyes_Open.png", "SkeletonSellsword_Eyes_Closed.png"), LoadFaceAnim("SkeletonSellsword_Mouth_Open.png", "SkeletonSellsword_Mouth_Closed.png"), LoadFaceAnim("SkeletonSellsword_Angry_Eyes_Open_Emission.png", "SkeletonSellsword_Eyes_Closed_Emission.png")),
				new EmotionData((Emotion)3, LoadSprite("SkeletonSellsword_Face.png"), LoadFaceAnim("SkeletonSellsword_Sad_Eyes_Open.png", "SkeletonSellsword_Eyes_Closed.png"), LoadFaceAnim("SkeletonSellsword_Mouth_Open.png", "SkeletonSellsword_Mouth_Closed.png"), LoadFaceAnim("SkeletonSellsword_Sad_Eyes_Open_Emission.png", "SkeletonSellsword_Eyes_Closed_Emission.png"))
			};
			FaceInfo val = new FaceInfo((float?)1.5f, "kobold_voice", (float?)1.3f, (string)null);
			FaceData val2 = new FaceData("OLD_SA_SKELETON_SELLSWORD", list, val);
			TalkingCardManager.Create(val2, GeneratePortrait.DialogueDummy);
		}

		private static CustomLine Line(string text, Emotion emotion)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			CustomLine result = default(CustomLine);
			((CustomLine)(ref result))..ctor();
			result.text = text;
			result.emotion = emotion;
			return result;
		}

		private static void RegisterEvent(string eventName, CustomLine[] mainLines, CustomLine[] repeatLines = null)
		{
			string text = "OLD_SA_SKELETON_SELLSWORD_" + eventName;
			List<CustomLine> list = new List<CustomLine>(mainLines);
			List<List<CustomLine>> list2 = null;
			if (repeatLines != null && repeatLines.Length != 0)
			{
				list2 = new List<List<CustomLine>>
				{
					new List<CustomLine>(repeatLines)
				};
			}
			DialogueEvent val = DialogueManager.GenerateEvent("OLD_SA.CardHelper", text, list, list2, (MaxRepeatsBehaviour)0, (Speaker)0);
			if (val != null)
			{
				RandomDialogueEvents.Add(val);
			}
			TalkingCardCreator.AddToDialogueCache(text);
		}

		private static void RegisterDialogues()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//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_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: 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_0085: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: 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)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: 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_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: 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_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			RegisterEvent("OnDrawn", (CustomLine[])(object)new CustomLine[3]
			{
				Line("Let's make this happen!", (Emotion)1),
				Line("Just make sure we've got the money!", (Emotion)1),
				Line("H-Hey, it's my turn already?!", (Emotion)1)
			});
			RegisterEvent("OnPlayFromHand", (CustomLine[])(object)new CustomLine[3]
			{
				Line("Pleasure doing business with you!", (Emotion)1),
				Line("Nothing can stop us! Except money.", (Emotion)1),
				Line("Thanks for your support. I'll take it from here.", (Emotion)1)
			});
			RegisterEvent("OnAttacked", (CustomLine[])(object)new CustomLine[3]
			{
				Line("I save my best work for the right moment!", (Emotion)2),
				Line("I'm not exactly an expert in this field...", (Emotion)3),
				Line("Should've spent less time slacking off...", (Emotion)3)
			});
			RegisterEvent("OnBecomeSelectablePositive", (CustomLine[])(object)new CustomLine[3]
			{
				Line("I don't take advantage of repeat customers!", (Emotion)1),
				Line("At least I can still make bone broth!", (Emotion)1),
				Line("Show your support! Buy more!", (Emotion)1)
			});
			RegisterEvent("OnBecomeSelectableNegative", (CustomLine[])(object)new CustomLine[3]
			{
				Line("I demand a vacation!", (Emotion)2),
				Line("Don't come to me if you're short on cash!", (Emotion)2),
				Line("I'm no coward!", (Emotion)2)
			});
			RegisterEvent("OnSacrificed", (CustomLine[])(object)new CustomLine[3]
			{
				Line("What a glorious exit!", (Emotion)1),
				Line("Back to the land of the dead!", (Emotion)1),
				Line("Just don't dock my bounty!", (Emotion)1)
			});
			RegisterEvent("OnSelectedForDeckTrial", (CustomLine[])(object)new CustomLine[3]
			{
				Line("I'm amazing!", (Emotion)1),
				Line("This is definitely not my fault!", (Emotion)2),
				Line("You get what you pay for!", (Emotion)1)
			});
			RegisterEvent("OnSelectedForCardMerge", (CustomLine[])(object)new CustomLine[3]
			{
				Line("I'm a mighty warrior who can be anywhere!", (Emotion)1),
				Line("This is worth more than money!", (Emotion)1),
				Line("One plus one... definitely isn't two! Just like our partnership!", (Emotion)1)
			});
			RegisterEvent("OnSelectedForCardRemove", (CustomLine[])(object)new CustomLine[3]
			{
				Line("I'll ask the old Bone King to make me look more handsome!", (Emotion)1),
				Line("Time for some well-earned R&R!", (Emotion)1),
				Line("It's been a pleasure doing business with you!", (Emotion)1)
			});
			RegisterEvent("OnDiscoveredInExploration", (CustomLine[])(object)new CustomLine[1] { Line("I'm the finest mercenary around!", (Emotion)1) }, (CustomLine[])(object)new CustomLine[3]
			{
				Line("Fancy meeting you here! Need a hand?", (Emotion)1),
				Line("With enough money, victory is guaranteed!", (Emotion)1),
				Line("Don't leave just yet! How about hiring me?", (Emotion)3)
			});
		}
	}
	public static class TalkingCardRegister
	{
		internal static class RandomDialoguePatch
		{
			private static void Postfix(DialogueEvent __instance, ref List<Line> __result)
			{
				//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_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_006b: 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_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)
				//IL_0079: Unknown result type (might be due to invalid IL or missing references)
				//IL_007e: 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_008f: Unknown result type (might be due to invalid IL or missing references)
				//IL_009b: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
				//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)
				//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c0: Expected O, but got Unknown
				//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
				if (__instance != null && __result != null && RandomDialogueEvents.Contains(__instance) && __result.Count != 0)
				{
					int index = Random.Range(0, __result.Count);
					Line val = __result[index];
					Line val2 = new Line
					{
						p03Face = val.p03Face,
						emotion = val.emotion,
						letterAnimation = val.letterAnimation,
						speakerIndex = val.speakerIndex,
						text = val.text,
						specialInstruction = val.specialInstruction,
						storyCondition = val.storyCondition,
						storyConditionMustBeMet = val.storyConditionMustBeMet
					};
					if (RandomEmotionEvents.Contains(__instance))
					{
						Emotion[] array = (Emotion[])(object)new Emotion[2]
						{
							(Emotion)3,
							(Emotion)4
						};
						int num = Random.Range(0, array.Length);
						val2.emotion = array[num];
					}
					__result = new List<Line> { val2 };
				}
			}
		}

		private const string CardName = "OLD_SA_SHRUBGRASS";

		private const string PluginGuid = "OLD_SA.CardHelper";

		internal static readonly HashSet<DialogueEvent> RandomDialogueEvents = new HashSet<DialogueEvent>();

		internal static readonly HashSet<DialogueEvent> RandomEmotionEvents = new HashSet<DialogueEvent>();

		private static bool randomLinePatchInstalled;

		public static void Register()
		{
			RegisterRandomLinePatch();
			RegisterEmotions();
			RegisterDialogues();
		}

		private static void RegisterRandomLinePatch()
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Expected O, but got Unknown
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Expected O, but got Unknown
			if (!randomLinePatchInstalled)
			{
				MethodInfo method = typeof(DialogueEvent).GetMethod("GetLines", BindingFlags.Instance | BindingFlags.Public, null, new Type[1] { typeof(int) }, null);
				MethodInfo method2 = typeof(RandomDialoguePatch).GetMethod("Postfix", BindingFlags.Static | BindingFlags.NonPublic);
				if (method == null || method2 == null)
				{
					Debug.LogError((object)"[OLD_SA] Failed to install TalkingCard random dialogue patch.");
					return;
				}
				Harmony val = new Harmony("OLD_SA.CardHelper.TalkingCardRandomDialogue");
				val.Patch((MethodBase)method, (HarmonyMethod)null, new HarmonyMethod(method2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				randomLinePatchInstalled = true;
			}
		}

		private static Sprite LoadSprite(string fileName)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture(fileName, (FilterMode)0);
			if ((Object)(object)imageAsTexture == (Object)null)
			{
				Debug.LogError((object)("[OLD_SA] Failed to load talking card texture: " + fileName));
				return GeneratePortrait.EmptyPortrait;
			}
			return Sprite.Create(imageAsTexture, new Rect(0f, 0f, (float)((Texture)imageAsTexture).width, (float)((Texture)imageAsTexture).height), new Vector2(0.5f, 0f), 100f);
		}

		private static FaceAnim LoadFaceAnim(string open, string closed)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			return new FaceAnim(LoadSprite(open), LoadSprite(closed));
		}

		private static void RegisterEmotions()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Expected O, but got Unknown
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Expected O, but got Unknown
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Expected O, but got Unknown
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Expected O, but got Unknown
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			List<EmotionData> list = new List<EmotionData>
			{
				new EmotionData((Emotion)0, LoadSprite("Shrubgrass_Face.png"), LoadFaceAnim("Shrubgrass_Neutral_Eyes_Open.png", "Shrubgrass_Eyes_Closed.png"), LoadFaceAnim("Shrubgrass_Mouth_Open.png", "Shrubgrass_Mouth_Closed.png"), LoadFaceAnim("Shrubgrass_Neutral_Eyes_Open_Emission.png", "Shrubgrass_Eyes_Closed_Emission.png")),
				new EmotionData((Emotion)2, LoadSprite("Shrubgrass_Face.png"), LoadFaceAnim("Shrubgrass_Angry_Eyes_Open.png", "Shrubgrass_Eyes_Closed.png"), LoadFaceAnim("Shrubgrass_Mouth_Open.png", "Shrubgrass_Mouth_Closed.png"), LoadFaceAnim("Shrubgrass_Angry_Eyes_Open_Emission.png", "Shrubgrass_Eyes_Closed_Emission.png")),
				new EmotionData((Emotion)3, LoadSprite("Shrubgrass_Face.png"), LoadFaceAnim("Shrubgrass_Sad_Eyes_Open.png", "Shrubgrass_Eyes_Closed.png"), LoadFaceAnim("Shrubgrass_Mouth_Open.png", "Shrubgrass_Mouth_Closed.png"), LoadFaceAnim("Shrubgrass_Sad_Eyes_Open_Emission.png", "Shrubgrass_Eyes_Closed_Emission.png")),
				new EmotionData((Emotion)4, LoadSprite("Shrubgrass_Face.png"), LoadFaceAnim("Shrubgrass_Surprised_Eyes_Open.png", "Shrubgrass_Eyes_Closed.png"), LoadFaceAnim("Shrubgrass_Mouth_Open.png", "Shrubgrass_Mouth_Closed.png"), LoadFaceAnim("Shrubgrass_Surprised_Eyes_Open_Emission.png", "Shrubgrass_Eyes_Closed_Emission.png"))
			};
			FaceInfo val = new FaceInfo((float?)1.5f, "female1_voice", (float?)1f, (string)null);
			FaceData val2 = new FaceData("OLD_SA_SHRUBGRASS", list, val);
			TalkingCardManager.Create(val2, GeneratePortrait.DialogueDummy);
		}

		private static void RegisterDialogues()
		{
			RegisterEvent("OnDrawn", new string[3] { "Sorry, did I embarrass you?", "I hope I'm the card you need.", "I hope you have fun!" });
			RegisterEvent("OnPlayFromHand", new string[3] { "I'll do my best!", "Nice play, buddy!", "Shrubgrass incoming!" });
			RegisterEvent("OnAttacked", new string[3] { "Buddy, I'm so glad I could take that hit for you.", "I'm just glad it wasn't you who got hurt.", "Ouch!" }, null, randomEmotion: true);
			RegisterEvent("OnBecomeSelectablePositive", new string[3] { "Will you choose me?", "I shouldn't get my hopes up.", "Trust your instincts." });
			RegisterEvent("OnBecomeSelectableNegative", new string[3] { "Will you choose me?", "Of course, you could choose me too.", "Is it time for us to say goodbye?" });
			RegisterEvent("OnSacrificed", new string[3] { "It's my honor.", "I have no regrets.", "See you next time!" }, null, randomEmotion: true);
			RegisterEvent("OnSelectedForDeckTrial", new string[3] { "Good luck!", "Will we make it?", "Or perhaps you don't want to succeed?" });
			RegisterEvent("OnSelectedForCardMerge", new string[3] { "I'm ready to become even stronger!", "Yes, we're here!", "How fascinating..." });
			RegisterEvent("OnSelectedForCardRemove", new string[3] { "Goodbye, buddy. I've had a wonderful time with you.", "Let's play together again sometime!", "I think it's time for me to rest." });
			RegisterEvent("OnDiscoveredInExploration", new string[1] { "Hello! I'm Shrubgrass!" }, new string[3] { "It's nice to see you again!", "Choose what you believe is right.", "Even if you don't choose me, I'll be waiting for our next meeting." });
		}

		private static void RegisterEvent(string eventName, string[] mainLines, string[] repeatLines = null, bool randomEmotion = false)
		{
			//IL_004b: 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 (mainLines == null || mainLines.Length == 0)
			{
				return;
			}
			string text = "OLD_SA_SHRUBGRASS_" + eventName;
			List<CustomLine> list = new List<CustomLine>();
			CustomLine item = default(CustomLine);
			foreach (string text2 in mainLines)
			{
				((CustomLine)(ref item))..ctor();
				item.text = text2;
				list.Add(item);
			}
			List<List<CustomLine>> list2 = new List<List<CustomLine>>();
			if (repeatLines != null && repeatLines.Length != 0)
			{
				List<CustomLine> list3 = new List<CustomLine>();
				foreach (string text3 in repeatLines)
				{
					((CustomLine)(ref item))..ctor();
					item.text = text3;
					list3.Add(item);
				}
				list2.Add(list3);
			}
			DialogueEvent val = DialogueManager.GenerateEvent("OLD_SA.CardHelper", text, list, list2, (MaxRepeatsBehaviour)0, (Speaker)0);
			if (val != null)
			{
				RandomDialogueEvents.Add(val);
				if (randomEmotion)
				{
					RandomEmotionEvents.Add(val);
				}
			}
			TalkingCardCreator.AddToDialogueCache(text);
		}
	}
}
namespace OLD_SA.Patches
{
	[HarmonyPatch(typeof(BellProximity), "<GetStatValues>g__IsBell|2_0")]
	public static class BellProximityIsBellPatch
	{
		[HarmonyPostfix]
		private static void Postfix(PlayableCard card, ref bool __result)
		{
			if (!__result && !((Object)(object)card == (Object)null) && !((Object)(object)((Card)card).Info == (Object)null) && ((Object)((Card)card).Info).name == "OLD_SA_BELL_TOES")
			{
				__result = true;
			}
		}
	}
	[HarmonyPatch(typeof(Daus), "RespondsToOtherCardDealtDamage")]
	public static class DausBellTargetPatch
	{
		private static readonly HashSet<string> AdditionalTargets = new HashSet<string> { "OLD_SA_BELL_TOES" };

		[HarmonyPostfix]
		private static void Postfix(PlayableCard attacker, int amount, PlayableCard target, ref bool __result)
		{
			if (!__result && !((Object)(object)attacker == (Object)null) && !attacker.Dead && !((Object)(object)target == (Object)null) && !((Object)(object)((Card)target).Info == (Object)null) && AdditionalTargets.Contains(((Object)((Card)target).Info).name))
			{
				__result = true;
			}
		}
	}
}

Xenowood_Law_Card/OldSa_Features_Card.dll

Decompiled 5 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using DiskCardGame;
using HarmonyLib;
using InscryptionAPI.Boons;
using InscryptionAPI.Helpers;
using OLD_SA.Boons;
using OldSa_Challenge;
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_Features_Card")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Features_Card")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("55a4efa1-fec9-4346-bb3d-abb4a8839775")]
[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.Boons
{
	public class OldSaBoonBehaviour : BoonBehaviour
	{
		private bool usedThisBattle;

		public override bool RespondsToPreBoonActivation()
		{
			//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)
			//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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			if (((BoonBehaviour)this).boon == null || (Object)(object)((BoonBehaviour)this).boon.boon == (Object)null)
			{
				return false;
			}
			return ((BoonBehaviour)this).boon.boon.type == OldSaBoons.Oak || ((BoonBehaviour)this).boon.boon.type == OldSaBoons.BonesCarnival || ((BoonBehaviour)this).boon.boon.type == OldSaBoons.Gnome;
		}

		public override IEnumerator OnPreBoonActivation()
		{
			if (((BoonBehaviour)this).boon == null || (Object)(object)((BoonBehaviour)this).boon.boon == (Object)null)
			{
				yield break;
			}
			if (((BoonBehaviour)this).boon.boon.type == OldSaBoons.Oak)
			{
				yield return ((BoonBehaviour)this).PlayBoonAnimation();
				PlayableCard squirrel = CardSpawner.SpawnPlayableCard(CardLoader.GetCardByName("Squirrel"));
				yield return Singleton<PlayerHand>.Instance.AddCardToHand(squirrel, Vector3.zero, 0.25f);
			}
			else if (((BoonBehaviour)this).boon.boon.type == OldSaBoons.BonesCarnival)
			{
				yield return ((BoonBehaviour)this).PlayBoonAnimation();
				yield return Singleton<ResourcesManager>.Instance.AddBones(4, (CardSlot)null);
			}
			else
			{
				if (((BoonBehaviour)this).boon.boon.type != OldSaBoons.Gnome)
				{
					yield break;
				}
				CardInfo terrainCard = GetRandomTerrainCard();
				if (!((Object)(object)terrainCard == (Object)null))
				{
					yield return ((BoonBehaviour)this).PlayBoonAnimation();
					PlayableCard spawnedCard = CardSpawner.SpawnPlayableCard(terrainCard);
					if (!((Object)(object)spawnedCard == (Object)null))
					{
						yield return Singleton<PlayerHand>.Instance.AddCardToHand(spawnedCard, Vector3.zero, 0.25f);
					}
				}
			}
		}

		private CardInfo GetRandomTerrainCard()
		{
			return OldSaBoons.GetRandomTerrainCard();
		}

		public override bool RespondsToOtherCardDie(PlayableCard card, CardSlot deathSlot, bool fromCombat, PlayableCard killer)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			if (((BoonBehaviour)this).boon == null || (Object)(object)((BoonBehaviour)this).boon.boon == (Object)null || ((BoonBehaviour)this).boon.boon.type != OldSaBoons.Grave)
			{
				return false;
			}
			if (usedThisBattle)
			{
				return false;
			}
			if ((Object)(object)card == (Object)null || (Object)(object)deathSlot == (Object)null)
			{
				return false;
			}
			if (!fromCombat)
			{
				return false;
			}
			if (card.OpponentCard)
			{
				return false;
			}
			if ((Object)(object)((Card)card).Info == (Object)null)
			{
				return false;
			}
			if (((Card)card).Info.HasTrait((Trait)12) || ((Card)card).Info.HasTrait((Trait)13))
			{
				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 || ((BoonBehaviour)this).boon == null || (Object)(object)((BoonBehaviour)this).boon.boon == (Object)null || ((BoonBehaviour)this).boon.boon.type != OldSaBoons.Grave || usedThisBattle || ((Card)card).Info.HasTrait((Trait)12) || ((Card)card).Info.HasTrait((Trait)13))
			{
				yield break;
			}
			yield return (object)new WaitForSeconds(0.5f);
			if ((Object)(object)deathSlot == (Object)null || ((Object)(object)deathSlot.Card != (Object)null && !deathSlot.Card.Dead))
			{
				yield break;
			}
			CardInfo graveCard = CardLoader.GetCardByName("OLD_SA_GRAVE");
			if (!((Object)(object)graveCard == (Object)null))
			{
				usedThisBattle = true;
				yield return ((BoonBehaviour)this).PlayBoonAnimation();
				yield return Singleton<BoardManager>.Instance.CreateCardInSlot(graveCard, deathSlot, 0.15f, true);
				if ((Object)(object)deathSlot.Card == (Object)null)
				{
					usedThisBattle = false;
				}
			}
		}

		public override bool RespondsToPostBattleCleanup()
		{
			//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)
			if (((BoonBehaviour)this).boon == null || (Object)(object)((BoonBehaviour)this).boon.boon == (Object)null)
			{
				return false;
			}
			return ((BoonBehaviour)this).boon.boon.type == OldSaBoons.Grave;
		}

		public override IEnumerator OnPostBattleCleanup()
		{
			if (((BoonBehaviour)this).boon != null && (Object)(object)((BoonBehaviour)this).boon.boon != (Object)null && ((BoonBehaviour)this).boon.boon.type == OldSaBoons.Grave)
			{
				usedThisBattle = false;
			}
			yield break;
		}
	}
	public static class OldSaBoons
	{
		public static Type Oak;

		public static Type BonesCarnival;

		public static Type Grave;

		public static Type Gnome;

		public static int GraveWeight = 100;

		public static int GnomeWeight = 75;

		public static int BonesCarnivalWeight = 75;

		public static int OakWeight = 40;

		private static List<CardInfo> terrainPool = new List<CardInfo>();

		private static List<CardInfo> remainingTerrainCards = new List<CardInfo>();

		public static int GetWeight(Type type)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: 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_0016: 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_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: 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)
			if (type == Oak)
			{
				return OakWeight;
			}
			if (type == BonesCarnival)
			{
				return BonesCarnivalWeight;
			}
			if (type == Grave)
			{
				return GraveWeight;
			}
			if (type == Gnome)
			{
				return GnomeWeight;
			}
			return 0;
		}

		public static void SetTerrainPool(List<CardInfo> cards)
		{
			terrainPool = new List<CardInfo>();
			remainingTerrainCards.Clear();
			if (cards == null)
			{
				return;
			}
			foreach (CardInfo card in cards)
			{
				if (!((Object)(object)card == (Object)null))
				{
					terrainPool.Add(card);
				}
			}
		}

		public static CardInfo GetRandomTerrainCard()
		{
			if (terrainPool == null || terrainPool.Count == 0)
			{
				return null;
			}
			if (SaveManager.SaveFile == null)
			{
				return null;
			}
			if (remainingTerrainCards.Count == 0)
			{
				remainingTerrainCards = new List<CardInfo>();
				foreach (CardInfo item in terrainPool)
				{
					if (!((Object)(object)item == (Object)null))
					{
						remainingTerrainCards.Add(item);
					}
				}
				if (remainingTerrainCards.Count == 0)
				{
					return null;
				}
				int currentRandomSeed = SaveManager.SaveFile.GetCurrentRandomSeed();
				ShuffleTerrainCards(remainingTerrainCards, currentRandomSeed);
			}
			CardInfo result = remainingTerrainCards[0];
			remainingTerrainCards.RemoveAt(0);
			AdvanceRandomSeed();
			return result;
		}

		private static void ShuffleTerrainCards(List<CardInfo> cards, int seed)
		{
			if (cards != null && cards.Count > 1)
			{
				for (int num = cards.Count - 1; num > 0; num--)
				{
					int index = SeededRandom.Range(0, num + 1, seed + num);
					CardInfo value = cards[num];
					cards[num] = cards[index];
					cards[index] = value;
				}
			}
		}

		private static void AdvanceRandomSeed()
		{
			if (SaveManager.SaveFile != null)
			{
				FieldInfo field = typeof(SaveFile).GetField("randomSeed", BindingFlags.Instance | BindingFlags.NonPublic);
				if (!(field == null))
				{
					int num = (int)field.GetValue(SaveManager.SaveFile);
					field.SetValue(SaveManager.SaveFile, num + 1);
				}
			}
		}

		public static void Register()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: 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_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			Assembly assembly = typeof(OldSaBoons).Assembly;
			Oak = BoonManager.New("OLD_SA", "Oak", typeof(OldSaBoonBehaviour), "Add 1 Squirrel to your hand.", (Texture)(object)TextureHelper.GetImageAsTexture("OLD_SA_Boon_Oak_Icon.png", assembly, (FilterMode)0), (Texture)(object)TextureHelper.GetImageAsTexture("OLD_SA_Boon_Oak_Art.png", assembly, (FilterMode)0), true, true, true);
			BoonManager.AddRuleBookCategories(Oak, (AbilityMetaCategory[])(object)new AbilityMetaCategory[1]);
			BonesCarnival = BoonManager.New("OLD_SA", "BonesCarnival", typeof(OldSaBoonBehaviour), "Gain 4 Bones.", (Texture)(object)TextureHelper.GetImageAsTexture("OLD_SA_Boon_BonesCarnival_Icon.png", assembly, (FilterMode)0), (Texture)(object)TextureHelper.GetImageAsTexture("OLD_SA_Boon_BonesCarnival_Art.png", assembly, (FilterMode)0), true, true, true);
			BoonManager.AddRuleBookCategories(BonesCarnival, (AbilityMetaCategory[])(object)new AbilityMetaCategory[1]);
			Grave = BoonManager.New("OLD_SA", "Cenotaph", typeof(OldSaBoonBehaviour), "Once per battle, when a friendly card dies, create a Grave in its place.", (Texture)(object)TextureHelper.GetImageAsTexture("OLD_SA_Boon_Grave_Icon.png", assembly, (FilterMode)0), (Texture)(object)TextureHelper.GetImageAsTexture("OLD_SA_Boon_Grave_Art.png", assembly, (FilterMode)0), true, true, true);
			BoonManager.AddRuleBookCategories(Grave, (AbilityMetaCategory[])(object)new AbilityMetaCategory[1]);
			Gnome = BoonManager.New("OLD_SA", "Gnome", typeof(OldSaBoonBehaviour), "Add 1 random Terrain card to your hand.", (Texture)(object)TextureHelper.GetImageAsTexture("OLD_SA_Boon_Gnome_Icon.png", assembly, (FilterMode)0), (Texture)(object)TextureHelper.GetImageAsTexture("OLD_SA_Boon_Gnome_Art.png", assembly, (FilterMode)0), true, true, true);
			BoonManager.AddRuleBookCategories(Gnome, (AbilityMetaCategory[])(object)new AbilityMetaCategory[1]);
		}
	}
}
namespace FunctionalSideDeck
{
	[BepInPlugin("com.yourname.functionalsidedeck", "FunctionalSideDeck", "1.0.0")]
	public class FunctionalSideDeckPlugin : 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("com.yourname.functionalsidedeck");
			val.PatchAll();
			OldSaBoons.Register();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"[OLD SA Features] Plugin initialized.");
		}
	}
}
namespace DiskCardGame
{
	[HarmonyPatch(typeof(SpecialNodeHandler), "StartSpecialNodeSequence")]
	public static class BossBoonRewardPatch
	{
		private static readonly FieldInfo rareCardChoiceSequencerField = AccessTools.Field(typeof(SpecialNodeHandler), "rareCardChoiceSequencer");

		private static bool Prefix(SpecialNodeHandler __instance, SpecialNodeData nodeData)
		{
			if ((Object)(object)__instance == (Object)null || nodeData == null)
			{
				return true;
			}
			if (!(nodeData is ChooseRareCardNodeData))
			{
				return true;
			}
			if (rareCardChoiceSequencerField == null)
			{
				return true;
			}
			object? value = rareCardChoiceSequencerField.GetValue(__instance);
			MonoBehaviour val = (MonoBehaviour)((value is MonoBehaviour) ? value : null);
			if ((Object)(object)val == (Object)null)
			{
				return true;
			}
			OLDSARareCardChoicesSequencer oLDSARareCardChoicesSequencer = ((Component)val).gameObject.GetComponent<OLDSARareCardChoicesSequencer>();
			if ((Object)(object)oLDSARareCardChoicesSequencer == (Object)null)
			{
				oLDSARareCardChoicesSequencer = ((Component)val).gameObject.AddComponent<OLDSARareCardChoicesSequencer>();
				CopyFields((Component)(object)val, (Component)(object)oLDSARareCardChoicesSequencer);
			}
			val.StopAllCoroutines();
			((Behaviour)val).enabled = false;
			((Behaviour)oLDSARareCardChoicesSequencer).enabled = true;
			((MonoBehaviour)__instance).StartCoroutine(oLDSARareCardChoicesSequencer.ChooseRareCard());
			return false;
		}

		private static void CopyFields(Component source, Component target)
		{
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			Type type = ((object)source).GetType();
			while (type != null && type != typeof(MonoBehaviour) && type != typeof(Behaviour) && type != typeof(Component) && type != typeof(Object))
			{
				FieldInfo[] fields = type.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				FieldInfo[] array = fields;
				foreach (FieldInfo fieldInfo in array)
				{
					if (fieldInfo.IsStatic || fieldInfo.IsInitOnly)
					{
						continue;
					}
					FieldInfo fieldInfo2 = FindField(((object)target).GetType(), fieldInfo.Name);
					if (!(fieldInfo2 == null) && !fieldInfo2.IsStatic && !fieldInfo2.IsInitOnly && fieldInfo2.FieldType.IsAssignableFrom(fieldInfo.FieldType))
					{
						try
						{
							fieldInfo2.SetValue(target, fieldInfo.GetValue(source));
						}
						catch
						{
						}
					}
				}
				type = type.BaseType;
			}
			FieldInfo fieldInfo3 = AccessTools.Field(typeof(CardSingleChoicesSequencer), "basePosition");
			if (fieldInfo3 != null)
			{
				try
				{
					fieldInfo3.SetValue(target, target.transform.position);
				}
				catch
				{
				}
			}
		}

		private static FieldInfo FindField(Type type, string fieldName)
		{
			while (type != null && type != typeof(MonoBehaviour) && type != typeof(Behaviour) && type != typeof(Component) && type != typeof(Object))
			{
				FieldInfo field = type.GetField(fieldName, BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (field != null)
				{
					return field;
				}
				type = type.BaseType;
			}
			return null;
		}
	}
	public class OLDSARareCardChoicesSequencer : CardSingleChoicesSequencer
	{
		[Header("Rare Cards")]
		[SerializeField]
		private Part1RareChoiceGenerator rareChoiceGenerator;

		[SerializeField]
		private Transform box;

		protected override Vector3 CardExaminePosition => new Vector3(((Component)box).transform.position.x, 6.5f, ((Component)box).transform.position.z);

		private bool IsBoonBoxChallengeActive()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			return AscensionSaveData.Data != null && AscensionSaveData.Data.ChallengeIsActive(ChallengeRegistry.BoonBoxChallengeType);
		}

		private void ForceCleanupSelectableCards()
		{
			if (((CardChoicesSequencer)this).selectableCards == null)
			{
				return;
			}
			foreach (SelectableCard selectableCard in ((CardChoicesSequencer)this).selectableCards)
			{
				if ((Object)(object)selectableCard != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)selectableCard).gameObject);
				}
			}
			((CardChoicesSequencer)this).selectableCards.Clear();
		}

		public IEnumerator ChooseRareCard()
		{
			Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)1;
			Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
			yield return (object)new WaitForSeconds(1f);
			Singleton<TableRuleBook>.Instance.SetOnBoard(true);
			((Component)((CardChoicesSequencer)this).deckPile).gameObject.SetActive(true);
			yield return ((MonoBehaviour)this).StartCoroutine(((CardChoicesSequencer)this).deckPile.SpawnCards(RunState.DeckList.Count, 1f));
			Vector3 vector = new Vector3(box.position.x, box.position.y, 0.5f);
			Vector3 startPos = new Vector3(vector.x, vector.y, 9f);
			box.position = startPos;
			((Component)box).gameObject.SetActive(true);
			AudioController.Instance.PlaySound3D("woodbox_slide", (MixerGroup)4, vector, 1f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
			Tween.Position(box, vector, 0.3f, 0f, Tween.EaseOut, (LoopType)0, (Action)null, (Action)null, true);
			yield return (object)new WaitForSeconds(0.3f);
			yield return (object)new WaitForSeconds(0.5f);
			if (!SaveFile.IsAscension || !DialogueEventsData.EventIsPlayed("ChallengeNoBossRares"))
			{
				yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("RareCardsIntro", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
			}
			((CardChoicesSequencer)this).selectableCards = ((CardChoicesSequencer)this).SpawnCards(3, ((Component)box).transform, new Vector3(-1.55f, 0.2f, 0f), 1.5f);
			List<CardChoice> choices = ((!AscensionSaveData.Data.ChallengeIsActive((AscensionChallenge)8)) ? ((CardChoiceGenerator)rareChoiceGenerator).GenerateChoices(SaveManager.SaveFile.GetCurrentRandomSeed()) : base.choiceGenerator.GenerateChoices(new CardChoicesNodeData(), SaveManager.SaveFile.GetCurrentRandomSeed()));
			for (int i = 0; i < ((CardChoicesSequencer)this).selectableCards.Count; i++)
			{
				SelectableCard card = ((CardChoicesSequencer)this).selectableCards[i];
				((Component)card).gameObject.SetActive(true);
				card.ChoiceInfo = choices[i];
				card.Initialize(choices[i].CardInfo, (Action<SelectableCard>)base.OnRewardChosen, (Action<SelectableCard>)base.OnCardFlipped, true, (Action<SelectableCard>)((CardChoicesSequencer)this).OnCardInspected);
				((InteractableBase)card).SetEnabled(false);
				((Card)card).SetFaceDown(true, true);
				SpecialCardBehaviour[] behaviours = ((Component)card).GetComponents<SpecialCardBehaviour>();
				SpecialCardBehaviour[] array = behaviours;
				foreach (SpecialCardBehaviour behaviour in array)
				{
					behaviour.OnShownForCardChoiceNode();
				}
			}
			((Component)box).GetComponentInChildren<Animator>().Play("open", 0, 0f);
			AudioController.Instance.PlaySound3D("woodbox_open", (MixerGroup)4, ((Component)box).transform.position, 1f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
			yield return (object)new WaitForSeconds(2f);
			Singleton<ViewManager>.Instance.SwitchToView(((CardChoicesSequencer)this).choicesView, false, false);
			ChallengeActivationUI.TryShowActivation((AscensionChallenge)8);
			if (AscensionSaveData.Data.ChallengeIsActive((AscensionChallenge)8) && !DialogueEventsData.EventIsPlayed("ChallengeNoBossRares"))
			{
				yield return (object)new WaitForSeconds(0.5f);
				yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("ChallengeNoBossRares", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
			}
			Singleton<InteractionCursor>.Instance.InteractionDisabled = false;
			((CardChoicesSequencer)this).SetCollidersEnabled(true);
			((Behaviour)((CardChoicesSequencer)this).gamepadGrid).enabled = true;
			((CardChoicesSequencer)this).EnableViewDeck(base.viewControlMode, base.basePosition);
			base.chosenReward = null;
			yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)base.chosenReward != (Object)null));
			((CardChoicesSequencer)this).DisableViewDeck();
			((Component)base.chosenReward).transform.parent = null;
			Singleton<RuleBookController>.Instance.SetShown(false, true);
			((Behaviour)((CardChoicesSequencer)this).gamepadGrid).enabled = false;
			((CardChoicesSequencer)this).deckPile.MoveCardToPile((Card)(object)base.chosenReward, true, 0.25f, 1.15f);
			((CardSingleChoicesSequencer)this).AddChosenCardToDeck();
			((CardSingleChoicesSequencer)this).CleanupMushrooms();
			yield return (object)new WaitForSeconds(0.5f);
			Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
			yield return (object)new WaitForSeconds(0.5f);
			((Component)box).GetComponentInChildren<Animator>().Play("close", 0, 0f);
			AudioController.Instance.PlaySound3D("woodbox_close", (MixerGroup)4, ((Component)box).transform.position, 1f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
			yield return (object)new WaitForSeconds(0.6f);
			ForceCleanupSelectableCards();
			Tween.Position(box, startPos, 0.3f, 0f, Tween.EaseInOut, (LoopType)0, (Action)null, (Action)null, true);
			yield return (object)new WaitForSeconds(0.3f);
			((Component)box).gameObject.SetActive(false);
			base.chosenReward = null;
			if (IsBoonBoxChallengeActive())
			{
				yield return ((MonoBehaviour)this).StartCoroutine(ChooseBoonCards());
			}
			if ((Object)(object)((CardChoicesSequencer)this).deckPile != (Object)null)
			{
				((MonoBehaviour)((CardChoicesSequencer)this).deckPile).StopAllCoroutines();
				SafeDestroyDeckPileCards();
				((Component)((CardChoicesSequencer)this).deckPile).gameObject.SetActive(false);
			}
			ProgressionData.SetMechanicLearned((MechanicsConcept)20);
			if ((int)RunState.Run.eyeState == 1)
			{
				Singleton<GameFlowManager>.Instance.TransitionToGameState((GameState)3, (NodeData)new ChooseEyeballNodeData());
			}
			else
			{
				Singleton<GameFlowManager>.Instance.TransitionToGameState((GameState)1, (NodeData)null);
			}
		}

		private List<BoonData> SelectWeightedBoons(List<BoonData> availableBoons, int count)
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			List<BoonData> list = new List<BoonData>(availableBoons);
			List<BoonData> list2 = new List<BoonData>();
			FieldInfo fieldInfo = AccessTools.Field(typeof(SaveFile), "randomSeed");
			if (fieldInfo == null)
			{
				throw new MissingFieldException(typeof(SaveFile).FullName, "randomSeed");
			}
			while (list2.Count < count && list.Count > 0)
			{
				int num = 0;
				foreach (BoonData item in list)
				{
					int weight = OldSaBoons.GetWeight(item.type);
					if (weight > 0)
					{
						num += weight;
					}
				}
				if (num <= 0)
				{
					break;
				}
				int currentRandomSeed = SaveManager.SaveFile.GetCurrentRandomSeed();
				Random random = new Random(currentRandomSeed);
				int num2 = random.Next(num);
				fieldInfo.SetValue(SaveManager.SaveFile, currentRandomSeed + 1);
				int num3 = 0;
				BoonData val = null;
				foreach (BoonData item2 in list)
				{
					int weight2 = OldSaBoons.GetWeight(item2.type);
					if (weight2 > 0)
					{
						num3 += weight2;
						if (num2 < num3)
						{
							val = item2;
							break;
						}
					}
				}
				if ((Object)(object)val == (Object)null)
				{
					break;
				}
				list2.Add(val);
				list.Remove(val);
			}
			return list2;
		}

		private IEnumerator ChooseBoonCards()
		{
			if (!IsBoonBoxChallengeActive())
			{
				yield break;
			}
			ChallengeActivationUI.TryShowActivation(ChallengeRegistry.BoonBoxChallengeType);
			ForceCleanupSelectableCards();
			Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
			yield return (object)new WaitForSeconds(0.5f);
			Vector3 vector = new Vector3(box.position.x, box.position.y, 0.5f);
			Vector3 startPos = new Vector3(vector.x, vector.y, 9f);
			box.position = startPos;
			((Component)box).gameObject.SetActive(true);
			AudioController.Instance.PlaySound3D("woodbox_slide", (MixerGroup)4, vector, 1f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
			Tween.Position(box, vector, 0.3f, 0f, Tween.EaseOut, (LoopType)0, (Action)null, (Action)null, true);
			yield return (object)new WaitForSeconds(0.8f);
			List<BoonData> availableBoons = (from x in BoonManager.AllBoonsCopy
				where (Object)(object)x != (Object)null
				where OldSaBoons.GetWeight(x.type) > 0
				select x).ToList();
			if (availableBoons.Count == 0)
			{
				((Component)box).gameObject.SetActive(false);
				yield break;
			}
			List<BoonData> selectedBoons = SelectWeightedBoons(availableBoons, 3);
			if (selectedBoons.Count == 0)
			{
				((Component)box).gameObject.SetActive(false);
				yield break;
			}
			((CardChoicesSequencer)this).selectableCards = ((CardChoicesSequencer)this).SpawnCards(selectedBoons.Count, ((Component)box).transform, new Vector3(-1.55f, 0.2f, 0f), 1.5f);
			for (int i = 0; i < ((CardChoicesSequencer)this).selectableCards.Count; i++)
			{
				BoonData boon = selectedBoons[i];
				CardInfo boonCard = BoonsUtil.CreateCardForBoon(boon);
				CardChoice choice = new CardChoice
				{
					CardInfo = boonCard
				};
				SelectableCard card = ((CardChoicesSequencer)this).selectableCards[i];
				((Component)card).gameObject.SetActive(true);
				card.ChoiceInfo = choice;
				card.Initialize(boonCard, (Action<SelectableCard>)base.OnRewardChosen, (Action<SelectableCard>)base.OnCardFlipped, true, (Action<SelectableCard>)((CardChoicesSequencer)this).OnCardInspected);
				((InteractableBase)card).SetEnabled(false);
				((Card)card).SetFaceDown(true, true);
				SpecialCardBehaviour[] behaviours = ((Component)card).GetComponents<SpecialCardBehaviour>();
				SpecialCardBehaviour[] array = behaviours;
				foreach (SpecialCardBehaviour behaviour in array)
				{
					behaviour.OnShownForCardChoiceNode();
				}
			}
			((Component)box).GetComponentInChildren<Animator>().Play("open", 0, 0f);
			AudioController.Instance.PlaySound3D("woodbox_open", (MixerGroup)4, ((Component)box).transform.position, 1f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
			yield return (object)new WaitForSeconds(2f);
			Singleton<ViewManager>.Instance.SwitchToView(((CardChoicesSequencer)this).choicesView, false, false);
			Singleton<InteractionCursor>.Instance.InteractionDisabled = false;
			((CardChoicesSequencer)this).SetCollidersEnabled(true);
			((Behaviour)((CardChoicesSequencer)this).gamepadGrid).enabled = true;
			((CardChoicesSequencer)this).EnableViewDeck(base.viewControlMode, base.basePosition);
			base.chosenReward = null;
			yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)base.chosenReward != (Object)null));
			((CardChoicesSequencer)this).DisableViewDeck();
			Singleton<RuleBookController>.Instance.SetShown(false, true);
			((Behaviour)((CardChoicesSequencer)this).gamepadGrid).enabled = false;
			Type chosenBoon = ((Card)base.chosenReward).Info.boon;
			if ((int)chosenBoon > 0)
			{
				SaveManager.SaveFile.CurrentDeck.AddBoon(chosenBoon);
			}
			yield return (object)new WaitForSeconds(0.5f);
			Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
			yield return (object)new WaitForSeconds(0.5f);
			((Component)box).GetComponentInChildren<Animator>().Play("close", 0, 0f);
			AudioController.Instance.PlaySound3D("woodbox_close", (MixerGroup)4, ((Component)box).transform.position, 1f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false);
			yield return (object)new WaitForSeconds(0.6f);
			ForceCleanupSelectableCards();
			Tween.Position(box, startPos, 0.3f, 0f, Tween.EaseInOut, (LoopType)0, (Action)null, (Action)null, true);
			yield return (object)new WaitForSeconds(0.3f);
			((Component)box).gameObject.SetActive(false);
			base.chosenReward = null;
		}

		private void SafeDestroyDeckPileCards()
		{
			if ((Object)(object)((CardChoicesSequencer)this).deckPile == (Object)null)
			{
				return;
			}
			FieldInfo fieldInfo = AccessTools.Field(typeof(CardPile), "cards");
			if (!(fieldInfo == null) && fieldInfo.GetValue(((CardChoicesSequencer)this).deckPile) is List<Transform> list)
			{
				list.RemoveAll((Transform card) => (Object)(object)card == (Object)null);
				((CardChoicesSequencer)this).deckPile.DestroyCardsImmediate();
			}
		}
	}
}

Xenowood_Law_Card/OldSa_Node.dll

Decompiled 5 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using DiskCardGame;
using HarmonyLib;
using InscryptionAPI.Helpers;
using InscryptionAPI.Nodes;
using OLD_SA.Node;
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_Node")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Node")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("65a5c92a-0050-4a49-8f5b-67eb4bac819a")]
[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.Node
{
	public static class FungalStitchSpawnState
	{
		public static int SpawnedCount;
	}
	[HarmonyPatch(typeof(MapGenerator), "GenerateNodes")]
	public static class FungalStitchMapResetPatch
	{
		[HarmonyPrefix]
		public static void Prefix()
		{
			FungalStitchSpawnState.SpawnedCount = 0;
		}
	}
	[HarmonyPatch(typeof(MapGenerator), "CreateNode")]
	public static class FungalStitchCreateNodePatch
	{
		[HarmonyPostfix]
		public static void Postfix(int x, int y, List<NodeData> nodesInRow, List<NodeData> previousNodes, int mapLength, ref NodeData __result)
		{
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Expected O, but got Unknown
			if (FungalStitchNode.Node != null && RunState.Run != null && RunState.Run.regionTier >= 1 && RunState.Run.regionTier <= 3 && y > 4 && y < mapLength - 1 && FungalStitchSpawnState.SpawnedCount < 3 && __result != null && CanReplaceNode(__result) && !(Random.value >= 0.05f))
			{
				CustomSpecialNodeData val = new CustomSpecialNodeData(FungalStitchNode.Node);
				((NodeData)val).gridX = x;
				((NodeData)val).gridY = y;
				((MapElementData)val).id = ((MapElementData)__result).id;
				__result = (NodeData)(object)val;
				FungalStitchSpawnState.SpawnedCount++;
			}
		}

		private static bool CanReplaceNode(NodeData node)
		{
			if (node is CardBattleNodeData)
			{
				return false;
			}
			if (node is TotemBattleNodeData)
			{
				return false;
			}
			if (node is BossBattleNodeData)
			{
				return false;
			}
			return node is CardChoicesNodeData || node is CardMergeNodeData || node is GainConsumablesNodeData || node is BuildTotemNodeData || node is DuplicateMergeNodeData || node is CardRemoveNodeData || node is CardStatBoostNodeData || node is CopyCardNodeData || node is BuyPeltsNodeData || node is TradePeltsNodeData || node is DeckTrialNodeData || node is BoulderChoiceNodeData;
		}
	}
	public static class FungalStitchNode
	{
		public static FullNode Node;

		public static void Register()
		{
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			Assembly assembly = typeof(FungalStitchNode).Assembly;
			Node = NewNodeManager.New("OLD_SA_FUNGAL_STITCH", "Fungal Stitch", (GenerationType)2, typeof(FungalStitchNodeSequencer), new List<Texture2D>
			{
				TextureHelper.GetImageAsTexture("FungalStitch_1.png", assembly, (FilterMode)0),
				TextureHelper.GetImageAsTexture("FungalStitch_2.png", assembly, (FilterMode)0),
				TextureHelper.GetImageAsTexture("FungalStitch_3.png", assembly, (FilterMode)0),
				TextureHelper.GetImageAsTexture("FungalStitch_4.png", assembly, (FilterMode)0)
			}, new List<SelectionCondition> { (SelectionCondition)new WithinRegionIndexRange(3, 3) }, (List<SelectionCondition>)null, (Action<CustomSpecialNodeData>)null, (Action<CustomSpecialNodeData, MapNode2D>)null, (GameObject)null, (GameObject)null);
		}
	}
	public class FungalStitchNodeSequencer : CustomCardChoiceNodeSequencer
	{
		private CardInfo selectedStatsCard;

		private CardInfo selectedCostCard;

		private CardInfo selectedAbilitiesCard;

		private Random stitchRandom;

		private readonly List<CardInfo> usedCards = new List<CardInfo>();

		private CardInfo currentSelectedCard;

		private CardInfo finalCard;

		private bool finalCardSelected;

		private static readonly BindingFlags PrivateInstance = BindingFlags.Instance | BindingFlags.NonPublic;

		public override bool ShouldDestroyOnEnd(CustomSpecialNodeData node)
		{
			return true;
		}

		public override bool ShouldNotReturnToMapOnEnd(CustomSpecialNodeData node)
		{
			return false;
		}

		public override IEnumerator DoCustomSequence(CustomSpecialNodeData node)
		{
			((CustomCardChoiceNodeSequencer)this).Inherit(node);
			usedCards.Clear();
			selectedStatsCard = null;
			selectedCostCard = null;
			selectedAbilitiesCard = null;
			currentSelectedCard = null;
			finalCard = null;
			finalCardSelected = false;
			int seed = SaveManager.SaveFile.GetCurrentRandomSeed();
			stitchRandom = new Random(seed);
			Singleton<TableRuleBook>.Instance.SetOnBoard(true);
			Singleton<ViewManager>.Instance.SwitchToView((View)1, false, true);
			yield return (object)new WaitForSeconds(0.1f);
			LeshyAnimationController.Instance.PutOnMask((Mask)5, true);
			yield return (object)new WaitForSeconds(1f);
			Singleton<ViewManager>.Instance.SwitchToView((View)29, false, true);
			yield return (object)new WaitForSeconds(0.1f);
			Singleton<OpponentAnimationController>.Instance.SetHeadTrigger("doctor_idle");
			SetSideHeadTalking(sideHeadTalking: false);
			yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("You pick!", -2.5f, 0.5f, (Emotion)0, (LetterAnimation)0, (Speaker)0, (string[])null, true);
			SetSideHeadTalking(sideHeadTalking: true);
			yield return (object)new WaitForSeconds(0.15f);
			yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("We stitch!", -2.5f, 0.5f, (Emotion)0, (LetterAnimation)0, (Speaker)0, (string[])null, true);
			SetSideHeadTalking(sideHeadTalking: false);
			yield return (object)new WaitForSeconds(0.1f);
			Singleton<ViewManager>.Instance.SwitchToView((View)3, false, true);
			yield return (object)new WaitForSeconds(0.15f);
			List<CardInfo> availableCards = GetUnusedCards();
			if (availableCards.Count < 6)
			{
				Singleton<ViewManager>.Instance.SwitchToView((View)29, false, true);
				yield return (object)new WaitForSeconds(0.1f);
				Singleton<OpponentAnimationController>.Instance.SetHeadTrigger("doctor_idle");
				SetSideHeadTalking(sideHeadTalking: false);
				yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("Not enough! We need more!", -2.5f, 0.5f, (Emotion)0, (LetterAnimation)0, (Speaker)0, (string[])null, true);
				SetSideHeadTalking(sideHeadTalking: true);
				yield return (object)new WaitForSeconds(0.15f);
				yield return Singleton<TextDisplayer>.Instance.ShowUntilInput("Come back next time!", -2.5f, 0.5f, (Emotion)0, (LetterAnimation)0, (Speaker)0, (string[])null, true);
				SetSideHeadTalking(sideHeadTalking: false);
				yield return (object)new WaitForSeconds(0.1f);
				Singleton<TextDisplayer>.Instance.Clear();
				Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
				yield return (object)new WaitForSeconds(0.1f);
				yield return LeshyAnimationController.Instance.TakeOffMask();
				yield break;
			}
			int totalCards = Mathf.Min(availableCards.Count, 9);
			int cardsPerRound = totalCards / 3;
			int remainder = totalCards % 3;
			int firstRoundCount = cardsPerRound + ((remainder > 0) ? 1 : 0);
			int secondRoundCount = cardsPerRound + ((remainder > 1) ? 1 : 0);
			int thirdRoundCount = cardsPerRound;
			yield return ShowRoundDialogue("Choose your stats.");
			yield return SelectCardRound(firstRoundCount, delegate(CardInfo card)
			{
				selectedStatsCard = card;
			});
			yield return ShowRoundDialogue("Choose your cost.");
			yield return SelectCardRound(secondRoundCount, delegate(CardInfo card)
			{
				selectedCostCard = card;
			});
			yield return ShowRoundDialogue("Choose your sigils.");
			yield return SelectCardRound(thirdRoundCount, delegate(CardInfo card)
			{
				selectedAbilitiesCard = card;
			});
			RemoveSelectedCardsFromDeck();
			finalCard = CreateFungalStitchedCard();
			if ((Object)(object)finalCard == (Object)null)
			{
				Debug.LogError((object)"[OLD SA Node] Fungal Stitch failed to create the final card.");
				Singleton<TextDisplayer>.Instance.Clear();
				Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
				yield return LeshyAnimationController.Instance.TakeOffMask();
			}
			else
			{
				yield return ShowFinalCard(finalCard);
				SetSideHeadTalking(sideHeadTalking: false);
				Singleton<TextDisplayer>.Instance.Clear();
				Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false);
				yield return (object)new WaitForSeconds(0.1f);
				yield return LeshyAnimationController.Instance.TakeOffMask();
			}
		}

		private IEnumerator ShowRoundDialogue(string message)
		{
			SetSideHeadTalking(sideHeadTalking: false);
			yield return Singleton<TextDisplayer>.Instance.ShowUntilInput(message, -2.5f, 0.5f, (Emotion)0, (LetterAnimation)0, (Speaker)0, (string[])null, true);
			SetSideHeadTalking(sideHeadTalking: false);
			yield return (object)new WaitForSeconds(0.15f);
		}

		private void SetSideHeadTalking(bool sideHeadTalking)
		{
			if ((Object)(object)Singleton<OpponentAnimationController>.Instance != (Object)null)
			{
				Singleton<OpponentAnimationController>.Instance.SetHeadBool("doctor_sidehead", sideHeadTalking);
			}
			if ((Object)(object)LeshyAnimationController.Instance.CurrentMask != (Object)null)
			{
				DoctorMask component = LeshyAnimationController.Instance.CurrentMask.GetComponent<DoctorMask>();
				if ((Object)(object)component != (Object)null)
				{
					component.SetEyesActive(sideHeadTalking);
				}
			}
			LeshyAnimationController.Instance.EyeAnimationsDisabled = sideHeadTalking;
		}

		private IEnumerator SelectCardRound(int numberOfChoices, Action<CardInfo> onSelected)
		{
			Singleton<ViewManager>.Instance.SwitchToView((View)3, false, true);
			yield return (object)new WaitForSeconds(0.1f);
			List<CardInfo> candidates = GetUnusedRandomCards(numberOfChoices);
			if (candidates.Count == 0)
			{
				Debug.LogError((object)"[OLD SA Node] Fungal Stitch could not find any unused cards.");
				yield break;
			}
			foreach (CardInfo candidate in candidates)
			{
				if ((Object)(object)candidate != (Object)null && !usedCards.Contains(candidate))
				{
					usedCards.Add(candidate);
				}
			}
			currentSelectedCard = null;
			((CardChoicesSequencer)this).selectableCards = ((CardChoicesSequencer)this).SpawnCards(candidates.Count, ((Component)this).transform, new Vector3(0f, 5.01f, 0f), 1.5f);
			for (int i = 0; i < candidates.Count; i++)
			{
				SelectableCard selectableCard = ((CardChoicesSequencer)this).selectableCards[i];
				CardInfo candidate2 = candidates[i];
				float centerOffset = (float)(candidates.Count - 1) * 0.75f;
				((Component)selectableCard).transform.localPosition = new Vector3(0f - centerOffset + 1.5f * (float)i, 5.01f, 0f);
				selectableCard.Initialize(candidate2, (Action<SelectableCard>)delegate(SelectableCard card)
				{
					if (!((Object)(object)currentSelectedCard != (Object)null))
					{
						currentSelectedCard = ((Card)card).Info;
					}
				}, (Action<SelectableCard>)null, false, (Action<SelectableCard>)((CardChoicesSequencer)this).OnCardInspected);
				((Card)selectableCard).SetFaceDown(false, false);
				selectableCard.SetParticlesEnabled(false);
				((InteractableBase)selectableCard).SetEnabled(false);
				((Card)selectableCard).SetInteractionEnabled(false);
				((Component)selectableCard).gameObject.SetActive(true);
				((Component)selectableCard).transform.localEulerAngles = new Vector3(90f, 0f, 0f);
				Vector3 position = ((Component)selectableCard).transform.position;
				((Component)selectableCard).transform.position = position + Vector3.forward * 5f + new Vector3(-0.5f + Random.value, 0f, 0f);
				Tween.Position(((Component)selectableCard).transform, position, 0.3f, 0f, Tween.EaseInOut, (LoopType)0, (Action)null, (Action)null, true);
				yield return (object)new WaitForSeconds(0.1f);
			}
			yield return (object)new WaitForSeconds(0.25f);
			((CardChoicesSequencer)this).SetCollidersEnabled(true);
			foreach (SelectableCard selectableCard2 in ((CardChoicesSequencer)this).selectableCards)
			{
				if (!((Object)(object)selectableCard2 == (Object)null))
				{
					selectableCard2.SetParticlesEnabled(false);
					((InteractableBase)selectableCard2).SetEnabled(true);
					((Card)selectableCard2).SetInteractionEnabled(true);
				}
			}
			yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)currentSelectedCard != (Object)null));
			CardInfo result = currentSelectedCard;
			((CardChoicesSequencer)this).SetCollidersEnabled(false);
			foreach (SelectableCard selectableCard3 in ((CardChoicesSequencer)this).selectableCards)
			{
				if (!((Object)(object)selectableCard3 == (Object)null))
				{
					((InteractableBase)selectableCard3).SetEnabled(false);
					((Card)selectableCard3).SetInteractionEnabled(false);
				}
			}
			yield return (object)new WaitForSeconds(0.15f);
			foreach (SelectableCard selectableCard4 in ((CardChoicesSequencer)this).selectableCards)
			{
				if (!((Object)(object)selectableCard4 == (Object)null))
				{
					Tween.Position(((Component)selectableCard4).transform, ((Component)selectableCard4).transform.position + Vector3.forward * 20f, 0.3f, 0f, Tween.EaseInOut, (LoopType)0, (Action)null, (Action)null, true);
					Object.Destroy((Object)(object)((Component)selectableCard4).gameObject, 0.3f);
				}
			}
			((CardChoicesSequencer)this).selectableCards.Clear();
			onSelected?.Invoke(result);
			currentSelectedCard = null;
			yield return (object)new WaitForSeconds(0.3f);
		}

		private List<CardInfo> GetUnusedCards()
		{
			List<CardInfo> cards = ((CardCollectionInfo)SaveManager.SaveFile.CurrentDeck).Cards;
			List<CardInfo> list = new List<CardInfo>();
			HashSet<string> hashSet = new HashSet<string>();
			foreach (CardInfo usedCard in usedCards)
			{
				if (!((Object)(object)usedCard == (Object)null) && !string.IsNullOrEmpty(((Object)usedCard).name))
				{
					hashSet.Add(((Object)usedCard).name);
				}
			}
			foreach (CardInfo card in cards)
			{
				if (!((Object)(object)card == (Object)null) && !string.IsNullOrEmpty(((Object)card).name) && !hashSet.Contains(((Object)card).name) && !list.Any((CardInfo x) => (Object)(object)x != (Object)null && ((Object)x).name == ((Object)card).name))
				{
					list.Add(card);
				}
			}
			return list;
		}

		private List<CardInfo> GetUnusedRandomCards(int count)
		{
			List<CardInfo> list = GetUnusedCards();
			for (int num = list.Count - 1; num > 0; num--)
			{
				int index = stitchRandom.Next(0, num + 1);
				CardInfo value = list[num];
				list[num] = list[index];
				list[index] = value;
			}
			if (list.Count > count)
			{
				list = list.Take(count).ToList();
			}
			return list;
		}

		private void RemoveSelectedCardsFromDeck()
		{
			if ((Object)(object)selectedStatsCard != (Object)null)
			{
				((CardCollectionInfo)RunState.Run.playerDeck).RemoveCard(selectedStatsCard);
			}
			if ((Object)(object)selectedCostCard != (Object)null)
			{
				((CardCollectionInfo)RunState.Run.playerDeck).RemoveCard(selectedCostCard);
			}
			if ((Object)(object)selectedAbilitiesCard != (Object)null)
			{
				((CardCollectionInfo)RunState.Run.playerDeck).RemoveCard(selectedAbilitiesCard);
			}
			Debug.Log((object)"[OLD SA Node] Fungal Stitch removed the three selected cards from the deck.");
		}

		private void ResetFungalStitchTemplateTribes()
		{
			CardInfo cardByName = CardLoader.GetCardByName("OLD_SA_STITCHED_SPORES");
			if (!((Object)(object)cardByName == (Object)null))
			{
			}
		}

		private CardInfo CreateFungalStitchedCard()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			CardInfo cardByName = CardLoader.GetCardByName("OLD_SA_STITCHED_SPORES");
			if ((Object)(object)cardByName == (Object)null)
			{
				Debug.LogError((object)"[OLD SA Node] Missing OLD_SA_STITCHED_SPORES");
				return null;
			}
			cardByName.Mods.Clear();
			CardModificationInfo val = new CardModificationInfo();
			val.attackAdjustment = selectedStatsCard.Attack - cardByName.Attack;
			val.healthAdjustment = selectedStatsCard.Health - cardByName.Health;
			val.statIcon = selectedStatsCard.SpecialStatIcon;
			if (selectedStatsCard.SpecialAbilities != null)
			{
				val.specialAbilities = new List<SpecialTriggeredAbility>(selectedStatsCard.SpecialAbilities);
			}
			val.bloodCostAdjustment = selectedCostCard.BloodCost - cardByName.BloodCost;
			val.bonesCostAdjustment = selectedCostCard.BonesCost - cardByName.BonesCost;
			val.energyCostAdjustment = selectedCostCard.EnergyCost - cardByName.EnergyCost;
			if (selectedCostCard.GemsCost != null && selectedCostCard.GemsCost.Count > 0)
			{
				val.addGemCost = new List<GemType>(selectedCostCard.GemsCost);
			}
			if (selectedAbilitiesCard.Abilities != null)
			{
				foreach (Ability ability in selectedAbilitiesCard.Abilities)
				{
					if (!val.abilities.Contains(ability))
					{
						val.abilities.Add(ability);
					}
				}
			}
			if (selectedAbilitiesCard.Mods != null)
			{
				foreach (CardModificationInfo mod in selectedAbilitiesCard.Mods)
				{
					if (mod.abilities != null)
					{
						foreach (Ability ability2 in mod.abilities)
						{
							if (!val.abilities.Contains(ability2))
							{
								val.abilities.Add(ability2);
							}
						}
					}
					if (mod.negateAbilities == null)
					{
						continue;
					}
					foreach (Ability negateAbility in mod.negateAbilities)
					{
						if (!val.negateAbilities.Contains(negateAbility))
						{
							val.negateAbilities.Add(negateAbility);
						}
					}
				}
			}
			cardByName.Mods.Add(val);
			return cardByName;
		}

		private T GetPrivateField<T>(object obj, string fieldName)
		{
			FieldInfo field = obj.GetType().GetField(fieldName, BindingFlags.Instance | BindingFlags.NonPublic);
			if (field == null)
			{
				Debug.LogError((object)("Could not find field: " + fieldName));
				return default(T);
			}
			return (T)field.GetValue(obj);
		}

		private IEnumerator ShowFinalCard(CardInfo info)
		{
			Singleton<ViewManager>.Instance.SwitchToView((View)3, false, true);
			yield return (object)new WaitForSeconds(0.15f);
			((CardChoicesSequencer)this).selectableCards = ((CardChoicesSequencer)this).SpawnCards(1, ((Component)this).transform, new Vector3(0f, 5.01f, 0f), 1.5f);
			if (((CardChoicesSequencer)this).selectableCards.Count == 0)
			{
				Debug.LogError((object)"[OLD SA Node] Failed to spawn the final Fungal Stitch card.");
				yield break;
			}
			SelectableCard resultCard = ((CardChoicesSequencer)this).selectableCards[0];
			finalCardSelected = false;
			resultCard.Initialize(info, (Action<SelectableCard>)delegate
			{
				if (!finalCardSelected)
				{
					finalCardSelected = true;
				}
			}, (Action<SelectableCard>)null, false, (Action<SelectableCard>)((CardChoicesSequencer)this).OnCardInspected);
			((Card)resultCard).SetFaceDown(false, false);
			resultCard.SetParticlesEnabled(false);
			((InteractableBase)resultCard).SetEnabled(false);
			((Card)resultCard).SetInteractionEnabled(false);
			((Component)resultCard).gameObject.SetActive(true);
			((Component)resultCard).transform.localPosition = new Vector3(0f, 5.01f, 0f);
			((Component)resultCard).transform.localEulerAngles = new Vector3(90f, 0f, 0f);
			Vector3 position = ((Component)resultCard).transform.position;
			((Component)resultCard).transform.position = position + Vector3.forward * 5f;
			Tween.Position(((Component)resultCard).transform, position, 0.3f, 0f, Tween.EaseInOut, (LoopType)0, (Action)null, (Action)null, true);
			yield return (object)new WaitForSeconds(0.3f);
			resultCard.SetParticlesEnabled(false);
			((CardChoicesSequencer)this).SetCollidersEnabled(true);
			((InteractableBase)resultCard).SetEnabled(true);
			((Card)resultCard).SetInteractionEnabled(true);
			yield return (object)new WaitUntil((Func<bool>)(() => finalCardSelected));
			((CardChoicesSequencer)this).SetCollidersEnabled(false);
			((InteractableBase)resultCard).SetEnabled(false);
			((Card)resultCard).SetInteractionEnabled(false);
			((CardCollectionInfo)RunState.Run.playerDeck).AddCard(info);
			yield return (object)new WaitForSeconds(0.4f);
			if ((Object)(object)resultCard != (Object)null)
			{
				Tween.Position(((Component)resultCard).transform, ((Component)resultCard).transform.position + Vector3.forward * 20f, 0.4f, 0f, Tween.EaseInOut, (LoopType)0, (Action)null, (Action)null, true);
				Object.Destroy((Object)(object)((Component)resultCard).gameObject, 0.4f);
			}
			((CardChoicesSequencer)this).selectableCards.Clear();
			yield return (object)new WaitForSeconds(0.4f);
		}

		private static void SetPrivateField(object target, string fieldName, object value)
		{
			FieldInfo field = target.GetType().GetField(fieldName, PrivateInstance);
			if (field == null)
			{
				Debug.LogError((object)("[OLD SA Node] Could not find private CardInfo field: " + fieldName));
			}
			else
			{
				field.SetValue(target, value);
			}
		}
	}
	[BepInPlugin("OLD_SA.Node", "OLD SA Node", "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 Node] Initializing...");
			FungalStitchNode.Register();
			Harmony val = new Harmony("oldsa.test");
			val.PatchAll();
			Debug.Log((object)"[OLD SA Node] All nodes registered.");
		}
	}
}
namespace OLD_SA.Patches
{
	[HarmonyPatch(typeof(MapGenerator), "GenerateMap")]
	public static class FinalAscensionMapNodesPatch
	{
		[HarmonyPostfix]
		public static void Postfix(RegionData region, int gridWidth, int gridLength, PredefinedNodes predefinedNodes, ref MapData __result)
		{
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Expected O, but got Unknown
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Expected O, but got Unknown
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Expected O, but got Unknown
			//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
			if (!SaveFile.IsAscension || (Object)(object)region == (Object)null || __result == null)
			{
				return;
			}
			RegionProgression instance = RegionProgression.Instance;
			if ((Object)(object)instance == (Object)null || ((Object)(object)region != (Object)(object)instance.ascensionFinalRegion && (Object)(object)region != (Object)(object)instance.ascensionFinalBossRegion))
			{
				return;
			}
			MapData val = __result;
			if (val.nodeData == null || val.nodeData.Count < 2 || gridWidth <= 0 || gridLength <= 0 || val.mapLength <= 0f)
			{
				return;
			}
			int bossY = int.MinValue;
			foreach (NodeData nodeDatum in val.nodeData)
			{
				if (nodeDatum.gridY > bossY)
				{
					bossY = nodeDatum.gridY;
				}
			}
			int targetY = bossY - 1;
			if (targetY < 1)
			{
				return;
			}
			List<NodeData> list = val.nodeData.FindAll((NodeData n) => n.gridY == targetY - 1);
			List<NodeData> list2 = val.nodeData.FindAll((NodeData n) => n.gridY == bossY);
			if (list.Count == 0 || list2.Count == 0)
			{
				return;
			}
			foreach (NodeData nodeDatum2 in val.nodeData)
			{
				if (nodeDatum2.connectedNodes == null)
				{
					nodeDatum2.connectedNodes = new List<NodeData>();
				}
			}
			if (FungalStitchNode.Node == null)
			{
				return;
			}
			List<NodeData> list3 = new List<NodeData>
			{
				(NodeData)new CustomSpecialNodeData(FungalStitchNode.Node),
				(NodeData)new DuplicateMergeNodeData(),
				(NodeData)new CopyCardNodeData()
			};
			int num = 0;
			foreach (NodeData nodeDatum3 in val.nodeData)
			{
				if (((MapElementData)nodeDatum3).id >= num)
				{
					num = ((MapElementData)nodeDatum3).id + 1;
				}
			}
			foreach (NodeData item in list3)
			{
				((MapElementData)item).id = num++;
				item.gridY = targetY;
				if (item.connectedNodes == null)
				{
					item.connectedNodes = new List<NodeData>();
				}
			}
			List<NodeData> list4 = val.nodeData.FindAll((NodeData n) => n.gridY == targetY);
			list4.AddRange(list3);
			list4.Sort((NodeData a, NodeData b) => a.gridX.CompareTo(b.gridX));
			float num2 = val.mapLength / (float)gridLength;
			float num3 = 0.1f;
			float num4 = 0.9f;
			for (int num5 = 0; num5 < list4.Count; num5++)
			{
				NodeData val2 = list4[num5];
				val2.gridX = num5;
				float num6 = ((list4.Count > 1) ? Mathf.Lerp(num3, num4, (float)num5 / (float)(list4.Count - 1)) : 0.5f);
				float num7 = 0.4f + (float)val2.gridY * num2;
				float num8 = Random.Range(-0.005f, 0.005f);
				((MapElementData)val2).position = new Vector2(Mathf.Clamp(num6 + num8, num3, num4), Mathf.Max(0.025f, num7));
			}
			foreach (NodeData item2 in list)
			{
				foreach (NodeData item3 in list3)
				{
					if (!item2.connectedNodes.Contains(item3))
					{
						item2.connectedNodes.Add(item3);
					}
				}
			}
			foreach (NodeData item4 in list3)
			{
				foreach (NodeData item5 in list2)
				{
					if (!item4.connectedNodes.Contains(item5))
					{
						item4.connectedNodes.Add(item5);
					}
				}
			}
			int num9 = Mathf.Max(0, val.nodeData.Count - 1);
			num9 = Mathf.Min(num9, val.nodeData.Count);
			val.nodeData.InsertRange(num9, list3);
		}
	}
}

Xenowood_Law_Card/OldSa_Pelt.dll

Decompiled 5 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
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 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_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.Patches
{
	[HarmonyPatch]
	public static class PeltPriceTagPatch
	{
		private static readonly FieldInfo PricetagTexturesField = AccessTools.Field(typeof(BuyPeltsSequencer), "pricetagTextures");

		private static readonly FieldInfo PricetagPrefabField = AccessTools.Field(typeof(BuyPeltsSequencer), "pricetagPrefab");

		private const int MAX_PRICE = 40;

		private static bool EnsurePriceTextures(BuyPeltsSequencer instance)
		{
			if (PricetagTexturesField == null)
			{
				Debug.LogError((object)"[OLD_SA] 找不到 pricetagTextures");
				return false;
			}
			if (!(PricetagTexturesField.GetValue(instance) is Texture[] array) || array.Length == 0)
			{
				Debug.LogError((object)"[OLD_SA] 原版价格贴图为空");
				return false;
			}
			bool flag = array.Length > 40;
			if (flag)
			{
				for (int i = 21; i <= 40; i++)
				{
					if ((Object)(object)array[i] == (Object)null)
					{
						flag = false;
						break;
					}
				}
			}
			if (flag)
			{
				return true;
			}
			Texture[] array2 = (Texture[])(object)new Texture[41];
			Array.Copy(array, array2, Math.Min(array.Length, array2.Length));
			for (int j = 21; j <= 40; j++)
			{
				if (!((Object)(object)array2[j] != (Object)null))
				{
					Texture imageAsTexture = (Texture)(object)TextureHelper.GetImageAsTexture(j + ".png", (FilterMode)0);
					if ((Object)(object)imageAsTexture == (Object)null)
					{
						Debug.LogError((object)("[OLD_SA] 价格图片加载失败:" + j + ".png"));
						return false;
					}
					array2[j] = imageAsTexture;
				}
			}
			PricetagTexturesField.SetValue(instance, array2);
			return true;
		}

		[HarmonyPatch(typeof(BuyPeltsSequencer), "AddPricetagToCard")]
		[HarmonyPrefix]
		private static bool AddPricetagToCardPrefix(BuyPeltsSequencer __instance, SelectableCard __0, int __1, float __2)
		{
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			if (__1 <= 20)
			{
				return true;
			}
			if (!EnsurePriceTextures(__instance))
			{
				return true;
			}
			int num = Math.Min(__1, 40);
			GameObject val = (GameObject)((PricetagPrefabField != null) ? /*isinst with value type is only supported in some contexts*/: null);
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogError((object)"[OLD_SA] 找不到 pricetagPrefab");
				return true;
			}
			Texture[] array = PricetagTexturesField.GetValue(__instance) as Texture[];
			if (array == null || num >= array.Length || (Object)(object)array[num] == (Object)null)
			{
				Debug.LogError((object)("[OLD_SA] 价格标签贴图无效:" + num + ",数组长度:" + ((array == null) ? (-1) : array.Length)));
				return true;
			}
			GameObject val2 = Object.Instantiate<GameObject>(val);
			val2.transform.SetParent(((Component)__0).transform);
			val2.transform.localPosition = new Vector3(-0.4f + Random.value * 0.1f, 0.95f, -0.03f);
			val2.transform.localEulerAngles = new Vector3(-90f, -90f, 90f);
			((Object)val2).name = "pricetag";
			Renderer componentInChildren = val2.GetComponentInChildren<Renderer>();
			if ((Object)(object)componentInChildren == (Object)null)
			{
				Object.Destroy((Object)(object)val2);
				return true;
			}
			componentInChildren.material.mainTexture = array[num];
			Tween.LocalRotation(val2.transform, new Vector3(-80f + Random.value * -20f, -90f, 90f), 0.25f, __2, Tween.EaseOut, (LoopType)0, (Action)null, (Action)null, true);
			return false;
		}
	}
}
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
{
	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 HolyPelt
	{
		private const string HolyPeltName = "OLD_SA_HOLY_PELT";

		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)3, (CardTemple)0);
			PeltData val = PeltManager.New("OLD_SA.Pelt", cardByName, func, 11, 1, 4);
			val.peltTierName = "Holy";
			val.isSoldByTrapper = true;
			DialogueManager.GenerateTraderPeltsEvent("OLD_SA.Pelt", val, new List<CustomLine> { CustomLine.op_Implicit("Your creatures have all been driven wild by this.") }, (List<List<CustomLine>>)null);
		}

		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 11;
		}
	}
	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("OldSa_Eerie_Forest_Background.png", (FilterMode)0);
			}
			((CardAppearanceBehaviour)this).Card.RenderInfo.baseTextureOverride = (Texture)(object)BackgroundTexture;
		}
	}
	public class OldSaMythBackground : CardAppearanceBehaviour
	{
		public static Appearance ID;

		private static Texture2D BackgroundTexture;

		public override void ApplyAppearance()
		{
			if ((Object)(object)BackgroundTexture == (Object)null)
			{
				BackgroundTexture = TextureHelper.GetImageAsTexture("OldSa_Myth_Background.png", (FilterMode)0);
			}
			((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("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 void Awake()
		{
			//IL_002e: 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)
			//IL_0053: 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_0078: 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)
			//IL_009d: 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_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_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Expected O, but got Unknown
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			try
			{
				FullCardAppearanceBehaviour val = CardAppearanceBehaviourManager.Add("OLD_SA.Pelt", "RainbowEmission", typeof(RainbowEmission));
				RainbowEmission.ID = val.Id;
				FullCardAppearanceBehaviour val2 = CardAppearanceBehaviourManager.Add("OLD_SA.Pelt", "SacredSilver", typeof(SacredSilver));
				SacredSilver.ID = val2.Id;
				FullCardAppearanceBehaviour val3 = CardAppearanceBehaviourManager.Add("OLD_SA.Pelt", "OldSa_Eerie_Forest_Background", typeof(OldSaEerieForestBackground));
				OldSaEerieForestBackground.ID = val3.Id;
				FullCardAppearanceBehaviour val4 = CardAppearanceBehaviourManager.Add("OLD_SA.Pelt", "OldSa_Plant_Background", typeof(OldSaPlantBackground));
				OldSaPlantBackground.ID = val4.Id;
				FullCardAppearanceBehaviour val5 = CardAppearanceBehaviourManager.Add("OLD_SA.Pelt", "OldSa_Myth_Background", typeof(OldSaMythBackground));
				OldSaMythBackground.ID = val5.Id;
				RegisterBrokenPelt();
				HolyPelt.Initialize();
				PurePelt.Initialize();
				Harmony val6 = new Harmony("OLD_SA.Pelt");
				val6.PatchAll();
			}
			catch (Exception ex)
			{
				Log.LogError((object)("[OLD SA Pelt] Initialization failed: " + 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;
				}
				else
				{
					val.healthAdjustment = -2;
				}
			}
			else if (flag)
			{
				val.attackAdjustment = -1;
			}
			else if (flag2)
			{
				val.healthAdjustment = -2;
			}
			else
			{
				RemoveRandomAbility(cardInfo, val);
			}
			val.singletonId = "OLD_SA_BROKEN_PELT_MOD";
			if (cardInfo.Mods == null)
			{
				cardInfo.Mods = new List<CardModificationInfo>();
			}
			cardInfo.Mods.Add(val);
		}

		private static void RemoveRandomAbility(CardInfo cardInfo, CardModificationInfo brokenMod)
		{
			//IL_004a: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			if (cardInfo.Abilities != null && cardInfo.Abilities.Count != 0)
			{
				List<Ability> list = new List<Ability>(cardInfo.Abilities);
				if (list.Count != 0)
				{
					Ability item = list[Random.Range(0, list.Count)];
					brokenMod.negateAbilities = new List<Ability>();
					brokenMod.negateAbilities.Add(item);
				}
			}
		}

		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 static class PurePelt
	{
		private const string PurePeltName = "OLD_SA_PURE_PELT";

		private const string PureModificationId = "OLD_SA_PURE_PELT_MOD";

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

		private static void RegisterPurePelt()
		{
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			CardInfo cardByName = CardLoader.GetCardByName("OLD_SA_PURE_PELT");
			if ((Object)(object)cardByName == (Object)null)
			{
				Debug.LogError((object)"[OLD SA Pelt] Could not find card: OLD_SA_PURE_PELT");
				return;
			}
			Func<List<CardInfo>> func = delegate
			{
				List<CardInfo> unlockedCards = CardLoader.GetUnlockedCards((CardMetaCategory)3, (CardTemple)0);
				unlockedCards.RemoveAll((CardInfo card) => !CanReceivePure(card));
				return unlockedCards;
			};
			PeltData val = PeltManager.New("OLD_SA.Pelt", cardByName, func, 11, 0, 4);
			val.peltTierName = "Pure";
			val.isSoldByTrapper = true;
			DialogueManager.GenerateTraderPeltsEvent("OLD_SA.Pelt", val, new List<CustomLine> { CustomLine.op_Implicit("Your creatures are purged of impurity and grow stronger.") }, (List<List<CustomLine>>)null);
			PeltExtensions.SetModifyCardChoiceAtTrader(val, (Action<CardInfo>)ModifyPureCard);
		}

		private static bool CanReceivePure(CardInfo cardInfo)
		{
			if ((Object)(object)cardInfo == (Object)null)
			{
				return false;
			}
			bool flag = HasAttackParameter(cardInfo);
			bool flag2 = HasHealthParameter(cardInfo);
			if (flag && flag2)
			{
				return false;
			}
			return true;
		}

		private static bool HasAttackParameter(CardInfo cardInfo)
		{
			if ((Object)(object)cardInfo == (Object)null)
			{
				return false;
			}
			if (HasSpecialStatIconAttack(cardInfo))
			{
				return true;
			}
			if (cardInfo.Mods != null)
			{
				foreach (CardModificationInfo mod in cardInfo.Mods)
				{
					if (mod == null || mod.attackAdjustment <= 0)
					{
						continue;
					}
					return true;
				}
			}
			return false;
		}

		private static bool HasHealthParameter(CardInfo cardInfo)
		{
			if ((Object)(object)cardInfo == (Object)null)
			{
				return false;
			}
			if (HasSpecialStatIconHealth(cardInfo))
			{
				return true;
			}
			if (cardInfo.Mods != null)
			{
				foreach (CardModificationInfo mod in cardInfo.Mods)
				{
					if (mod == null || mod.healthAdjustment <= 0)
					{
						continue;
					}
					return true;
				}
			}
			return false;
		}

		private static bool HasSpecialStatIconAttack(CardInfo cardInfo)
		{
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)cardInfo == (Object)null)
			{
				return false;
			}
			List<SpecialTriggeredAbility> specialTriggeredAbilities = GetSpecialTriggeredAbilities(cardInfo);
			if (specialTriggeredAbilities == null || specialTriggeredAbilities.Count == 0)
			{
				return false;
			}
			foreach (FullStatIcon allStatIcon in StatIconManager.AllStatIcons)
			{
				if (allStatIcon == null || (Object)(object)allStatIcon.Info == (Object)null || !allStatIcon.Info.appliesToAttack || !specialTriggeredAbilities.Contains(allStatIcon.AbilityId))
				{
					continue;
				}
				return true;
			}
			return false;
		}

		private static bool HasSpecialStatIconHealth(CardInfo cardInfo)
		{
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)cardInfo == (Object)null)
			{
				return false;
			}
			List<SpecialTriggeredAbility> specialTriggeredAbilities = GetSpecialTriggeredAbilities(cardInfo);
			if (specialTriggeredAbilities == null || specialTriggeredAbilities.Count == 0)
			{
				return false;
			}
			foreach (FullStatIcon allStatIcon in StatIconManager.AllStatIcons)
			{
				if (allStatIcon == null || (Object)(object)allStatIcon.Info == (Object)null || !allStatIcon.Info.appliesToHealth || !specialTriggeredAbilities.Contains(allStatIcon.AbilityId))
				{
					continue;
				}
				return true;
			}
			return false;
		}

		private static List<SpecialTriggeredAbility> GetSpecialTriggeredAbilities(CardInfo cardInfo)
		{
			List<SpecialTriggeredAbility> list = new List<SpecialTriggeredAbility>();
			if ((Object)(object)cardInfo == (Object)null)
			{
				return list;
			}
			Type type = ((object)cardInfo).GetType();
			while (type != null)
			{
				FieldInfo[] fields = type.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				FieldInfo[] array = fields;
				foreach (FieldInfo fieldInfo in array)
				{
					if (!(fieldInfo == null))
					{
						object value;
						try
						{
							value = fieldInfo.GetValue(cardInfo);
						}
						catch
						{
							continue;
						}
						if (value != null)
						{
							AddSpecialTriggeredAbilities(value, list);
						}
					}
				}
				PropertyInfo[] properties = type.GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				PropertyInfo[] array2 = properties;
				foreach (PropertyInfo propertyInfo in array2)
				{
					if (!(propertyInfo == null) && propertyInfo.CanRead && propertyInfo.GetIndexParameters().Length == 0)
					{
						object value2;
						try
						{
							value2 = propertyInfo.GetValue(cardInfo, null);
						}
						catch
						{
							continue;
						}
						if (value2 != null)
						{
							AddSpecialTriggeredAbilities(value2, list);
						}
					}
				}
				type = type.BaseType;
			}
			return list.Distinct().ToList();
		}

		private static void AddSpecialTriggeredAbilities(object value, List<SpecialTriggeredAbility> result)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Invalid comparison between Unknown and I4
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Invalid comparison between Unknown and I4
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			if (value == null)
			{
				return;
			}
			if (value is SpecialTriggeredAbility val)
			{
				if ((int)val > 0)
				{
					result.Add(val);
				}
			}
			else
			{
				if (!(value is IEnumerable enumerable))
				{
					return;
				}
				foreach (object item in enumerable)
				{
					if (item is SpecialTriggeredAbility val2 && (int)val2 > 0)
					{
						result.Add(val2);
					}
				}
			}
		}

		private static void ModifyPureCard(CardInfo cardInfo)
		{
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: 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_PURE_PELT_MOD"))
					{
						continue;
					}
					return;
				}
			}
			bool flag = HasAttackParameter(cardInfo);
			bool flag2 = HasHealthParameter(cardInfo);
			if (!(flag && flag2))
			{
				CardModificationInfo val = new CardModificationInfo();
				if (flag)
				{
					val.healthAdjustment = 2;
				}
				else if (flag2)
				{
					val.attackAdjustment = 1;
				}
				else if (Random.Range(0, 2) == 0)
				{
					val.attackAdjustment = 1;
				}
				else
				{
					val.healthAdjustment = 2;
				}
				val.singletonId = "OLD_SA_PURE_PELT_MOD";
				if (cardInfo.Mods == null)
				{
					cardInfo.Mods = new List<CardModificationInfo>();
				}
				cardInfo.Mods.Add(val);
			}
		}
	}
	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 GetBundlePath()
		{
			string location = Assembly.GetExecutingAssembly().Location;
			string directoryName = Path.GetDirectoryName(location);
			if (string.IsNullOrEmpty(directoryName))
			{
				Debug.LogError((object)"[OLD SA Pelt] Failed to locate DLL directory.");
				return null;
			}
			return Path.Combine(directoryName, "old_sa_rainbow");
		}

		private static bool LoadRainbowBundle()
		{
			if ((Object)(object)rainbowBaseMaterial != (Object)null)
			{
				return true;
			}
			if ((Object)(object)rainbowBundle == (Object)null)
			{
				string bundlePath = GetBundlePath();
				if (string.IsNullOrEmpty(bundlePath))
				{
					return false;
				}
				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: " + bundlePath));
					return false;
				}
			}
			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;
			}
			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;
			}
		}

		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;
		}
	}
	public class SacredSilver : CardAppearanceBehaviour
	{
		public static Appearance ID;

		private static AssetBundle sacredSilverBundle;

		private static Material sacredSilverBaseMaterial;

		private Material originalMaterial;

		private Material sacredSilverMaterial;

		private static string GetBundlePath()
		{
			string location = Assembly.GetExecutingAssembly().Location;
			string directoryName = Path.GetDirectoryName(location);
			if (string.IsNullOrEmpty(directoryName))
			{
				Debug.LogError((object)"[OLD SA Pelt] Failed to locate DLL directory.");
				return null;
			}
			return Path.Combine(directoryName, "oldsa_sacred_silver");
		}

		private static bool LoadSacredSilverBundle()
		{
			if ((Object)(object)sacredSilverBaseMaterial != (Object)null)
			{
				return true;
			}
			if ((Object)(object)sacredSilverBundle == (Object)null)
			{
				string bundlePath = GetBundlePath();
				if (string.IsNullOrEmpty(bundlePath))
				{
					return false;
				}
				if (!File.Exists(bundlePath))
				{
					Debug.LogError((object)("[OLD SA Pelt] Sacred Silver AssetBundle not found: " + bundlePath));
					return false;
				}
				sacredSilverBundle = AssetBundle.LoadFromFile(bundlePath);
				if ((Object)(object)sacredSilverBundle == (Object)null)
				{
					Debug.LogError((object)("[OLD SA Pelt] Failed to load Sacred Silver AssetBundle: " + bundlePath));
					return false;
				}
			}
			sacredSilverBaseMaterial = sacredSilverBundle.LoadAsset<Material>("assets/sacredsilver.mat");
			if ((Object)(object)sacredSilverBaseMaterial == (Object)null)
			{
				Debug.LogError((object)"[OLD SA Pelt] SacredSilver Material not found in AssetBundle.");
				return false;
			}
			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) && LoadSacredSilverBundle())
			{
				originalMaterial = ((CardAppearanceBehaviour)this).Card.StatsLayer.Material;
				sacredSilverMaterial = new Material(sacredSilverBaseMaterial);
				((CardAppearanceBehaviour)this).Card.StatsLayer.Material = sacredSilverMaterial;
			}
		}

		public override void ManagedUpdate()
		{
			if (!((Object)(object)sacredSilverMaterial == (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)sacredSilverMaterial != (Object)null)
			{
				Object.Destroy((Object)(object)sacredSilverMaterial);
				sacredSilverMaterial = null;
			}
			originalMaterial = null;
		}
	}
}

Xenowood_Law_Card/OldSa_Trait.dll

Decompiled 5 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
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 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_Trait")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldSa_Trait")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("628debee-9b42-44ac-b32a-51f8ddb48f10")]
[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
{
	public class OLD_SA_LifeShield : MonoBehaviour
	{
		public int stacks;

		public int GetStacks()
		{
			return stacks;
		}

		public void AddShield(int amount)
		{
			if (amount > 0)
			{
				stacks += amount;
				PlayableCard component = ((Component)this).GetComponent<PlayableCard>();
				if ((Object)(object)component != (Object)null)
				{
					((Card)component).RenderCard();
					((MonoBehaviour)component).StartCoroutine(ShieldTransform.Transform(component));
				}
			}
		}

		public bool ConsumeShield()
		{
			if (stacks <= 0)
			{
				return false;
			}
			stacks--;
			PlayableCard component = ((Component)this).GetComponent<PlayableCard>();
			if ((Object)(object)component != (Object)null)
			{
				((Card)component).RenderCard();
				component.UpdateFaceUpOnBoardEffects();
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(PlayableCard), "TakeDamage")]
	public static class LifeShieldPatch
	{
		[HarmonyPrefix]
		public static bool Prefix(PlayableCard __instance, int damage, PlayableCard attacker, ref IEnumerator __result)
		{
			if ((Object)(object)__instance == (Object)null)
			{
				return true;
			}
			OLD_SA_LifeShield component = ((Component)__instance).GetComponent<OLD_SA_LifeShield>();
			if ((Object)(object)component == (Object)null || component.stacks <= 0)
			{
				return true;
			}
			if (damage < __instance.Health)
			{
				return true;
			}
			component.ConsumeShield();
			__result = SaveByLifeShield(__instance, damage, attacker);
			return false;
		}

		private static IEnumerator SaveByLifeShield(PlayableCard card, int damage, PlayableCard attacker)
		{
			if (!((Object)(object)card == (Object)null) && !card.Dead)
			{
				card.Status.damageTaken = card.Health - 1;
				card.OnStatsChanged();
				((Card)card).RenderCard();
				card.UpdateFaceUpOnBoardEffects();
				yield return null;
			}
		}
	}
	[BepInPlugin("oldsa.inscryption", "OLD SA", "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
			((BaseUnityPlugin)this).Logger.LogInfo((object)"OLD SA Plugin 正在加载");
			Harmony val = new Harmony("oldsa.inscryption");
			val.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"OLD SA Harmony 补丁安装完成");
		}
	}
}
namespace OLD_SA.CardTraits
{
	[HarmonyPatch(typeof(PlayableCard), "Die")]
	public static class BloodArmorKillPatch
	{
		[HarmonyPostfix]
		public static void Postfix(PlayableCard __instance, PlayableCard killer)
		{
			if (!((Object)(object)__instance == (Object)null) && !((Object)(object)killer == (Object)null) && !killer.Dead && killer.OnBoard && killer.HasOldSaTrait("OLD_SA_BLOOD_ARMOR"))
			{
				BloodArmorTrait bloodArmorTrait = ((Component)killer).GetComponent<BloodArmorTrait>();
				if ((Object)(object)bloodArmorTrait == (Object)null)
				{
					bloodArmorTrait = ((Component)killer).gameObject.AddComponent<BloodArmorTrait>();
				}
				bloodArmorTrait.RegisterKill();
			}
		}
	}
	public class BloodArmorTrait : MonoBehaviour
	{
		private const int KillRequired = 2;

		private int killCount;

		public void RegisterKill()
		{
			PlayableCard component = ((Component)this).GetComponent<PlayableCard>();
			if (!((Object)(object)component == (Object)null) && !component.Dead && component.OnBoard && component.HasOldSaTrait("OLD_SA_BLOOD_ARMOR"))
			{
				killCount++;
				while (killCount >= 2)
				{
					killCount -= 2;
					AddArmor(component);
				}
			}
		}

		private void AddArmor(PlayableCard card)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			if (!((Object)(object)card == (Object)null) && !card.Dead)
			{
				CardModificationInfo val = new CardModificationInfo((Ability)54);
				card.AddTemporaryMod(val);
				if ((Object)(object)((Card)card).Anim != (Object)null)
				{
					((Card)card).Anim.LightNegationEffect();
				}
				((Card)card).RenderCard();
				card.UpdateFaceUpOnBoardEffects();
			}
		}
	}
	public class BloodDevourerTrait : OLD_SA_TraitBehaviour
	{
		public const string Trait = "OLD_SA_BLOOD_DEVOURER";
	}
	public class BoleteGrowthState : MonoBehaviour
	{
		public int Form = 0;

		public int HealingProgress = 0;

		public PlayableCard Card => ((Component)this).GetComponent<PlayableCard>();

		public void SetForm(int value)
		{
			Form = Mathf.Clamp(value, 0, 2);
		}

		public void AddHealing(int amount)
		{
			HealingProgress += amount;
		}

		public bool CanEvolveByHealing()
		{
			return Form == 1 && HealingProgress >= 2;
		}

		public void ResetHealing()
		{
			HealingProgress = 0;
		}
	}
	[HarmonyPatch(typeof(CardMergeSequencer), "GetValidCardsForSacrifice")]
	internal static class CardMergeSequencer_SpecialPeltSacrificePatch
	{
		[HarmonyPostfix]
		private static void Postfix(ref List<CardInfo> __result)
		{
			if (__result != null && __result.Count != 0)
			{
				__result.RemoveAll((CardInfo card) => (Object)(object)card != (Object)null && card.HasOldSaTrait("OLD_SA_PITIFUL_SACRIFICE"));
			}
		}
	}
	public static class GreedyCardManager
	{
		public static GreedyCardTrait GetActiveGreedyCard()
		{
			if ((Object)(object)Singleton<BoardManager>.Instance == (Object)null)
			{
				return null;
			}
			foreach (CardSlot item in Singleton<BoardManager>.Instance.PlayerSlotsCopy)
			{
				if (!((Object)(object)item.Card == (Object)null))
				{
					GreedyCardTrait component = ((Component)item.Card).GetComponent<GreedyCardTrait>();
					if ((Object)(object)component != (Object)null)
					{
						return component;
					}
				}
			}
			return null;
		}
	}
	[HarmonyPatch(typeof(CardDrawPiles3D), "DrawFromSidePile")]
	public static class GreedyCardPatch
	{
		[HarmonyPrefix]
		public static bool Prefix(CardDrawPiles3D __instance)
		{
			GreedyCardTrait activeGreedyCard = GreedyCardManager.GetActiveGreedyCard();
			if ((Object)(object)activeGreedyCard == (Object)null)
			{
				return true;
			}
			if (activeGreedyCard.ShouldBlock())
			{
				((MonoBehaviour)__instance).StartCoroutine(activeGreedyCard.PlayDialogue());
				return false;
			}
			activeGreedyCard.AddDrawCount();
			return true;
		}
	}
	[HarmonyPatch(typeof(PlayableCard), "HealDamage")]
	internal static class HealingArmorHealPatch
	{
		private static void Prefix(PlayableCard __instance, out int __state)
		{
			__state = (((Object)(object)__instance != (Object)null) ? __instance.Health : 0);
		}

		private static void Postfix(PlayableCard __instance, int __state)
		{
			if (!((Object)(object)__instance != (Object)null) || (Object)(object)((Card)__instance).Info != (Object)null)
			{
			}
			if ((Object)(object)__instance == (Object)null || (Object)(object)((Card)__instance).Info == (Object)null || __instance.Dead || !__instance.OnBoard || (Object)(object)__instance == (Object)null || (Object)(object)((Card)__instance).Info == (Object)null || __instance.Dead || !__instance.OnBoard)
			{
				return;
			}
			int num = __instance.Health - __state;
			if (num > 0 && __instance.HasOldSaTrait("OLD_SA_HEALING_ARMOR"))
			{
				HealingArmorTrait healingArmorTrait = ((Component)__instance).GetComponent<HealingArmorTrait>();
				if ((Object)(object)healingArmorTrait == (Object)null)
				{
					healingArmorTrait = ((Component)__instance).gameObject.AddComponent<HealingArmorTrait>();
				}
				healingArmorTrait.RegisterHealing(num);
			}
		}
	}
	public class HealingArmorTrait : MonoBehaviour
	{
		private const int HealRequired = 2;

		private int accumulatedHealing;

		public void RegisterHealing(int amount)
		{
			if (amount <= 0)
			{
				return;
			}
			PlayableCard component = ((Component)this).GetComponent<PlayableCard>();
			if (!((Object)(object)component == (Object)null) && !component.Dead && component.OnBoard && component.HasOldSaTrait("OLD_SA_HEALING_ARMOR"))
			{
				accumulatedHealing += amount;
				while (accumulatedHealing >= 2)
				{
					accumulatedHealing -= 2;
					AddLifeShield(component);
				}
			}
		}

		private void AddLifeShield(PlayableCard card)
		{
			if (!((Object)(object)card == (Object)null) && !card.Dead)
			{
				OLD_SA_LifeShield oLD_SA_LifeShield = ((Component)card).GetComponent<OLD_SA_LifeShield>();
				if ((Object)(object)oLD_SA_LifeShield == (Object)null)
				{
					oLD_SA_LifeShield = ((Component)card).gameObject.AddComponent<OLD_SA_LifeShield>();
				}
				oLD_SA_LifeShield.AddShield(1);
				if ((Object)(object)((Card)card).Anim != (Object)null)
				{
					((Card)card).Anim.LightNegationEffect();
				}
				((Card)card).RenderCard();
				card.UpdateFaceUpOnBoardEffects();
			}
		}
	}
	public class BeeHunterTrait : OLD_SA_TraitBehaviour
	{
		public override bool RespondsToOtherCardResolve(PlayableCard otherCard)
		{
			return (Object)(object)otherCard != (Object)null && otherCard.OpponentCard && otherCard.HasOldSaTrait("OLD_SA_BEE");
		}

		public override IEnumerator OnOtherCardResolve(PlayableCard otherCard)
		{
			yield return CardTraitDialogueManager.TryTrigger(((SpecialCardBehaviour)this).PlayableCard, "OLD_SA_BEE_HUNTER");
			otherCard.TakeDamage(((SpecialCardBehaviour)this).PlayableCard.Attack, ((SpecialCardBehaviour)this).PlayableCard);
		}
	}
	public class GreedyCardTrait : OLD_SA_TraitBehaviour
	{
		private int sideDeckDrawCount;

		public PlayableCard OwnerCard => ((SpecialCardBehaviour)this).PlayableCard;

		public void AddDrawCount()
		{
			sideDeckDrawCount++;
		}

		public bool ShouldBlock()
		{
			return sideDeckDrawCount >= 5;
		}

		public override void OnCleanUp()
		{
			sideDeckDrawCount = 0;
		}

		public IEnumerator PlayDialogue()
		{
			yield return CardTraitDialogueManager.TryTrigger(OwnerCard, "OLD_SA_GREEDY_CARD");
		}
	}
	public static class OLD_SA_Traits
	{
		public const string Bee = "OLD_SA_BEE";

		public const string BeeHunter = "OLD_SA_BEE_HUNTER";

		public const string GreedyCard = "OLD_SA_GREEDY_CARD";

		public const string BloodDevourer = "OLD_SA_BLOOD_DEVOURER";

		public const string PitifulSacrifice = "OLD_SA_PITIFUL_SACRIFICE";

		public const string BloodBoleteArmor = "OLD_SA_BLOOD_BOLETE_ARMOR";

		public const string HealingArmor = "OLD_SA_HEALING_ARMOR";

		public const string BloodArmor = "OLD_SA_BLOOD_ARMOR";
	}
	public static class OLD_SA_TraitAPI
	{
		private const string TraitProperty = "OLD_SA_Traits";

		public static bool HasOldSaTrait(this CardInfo info, string trait)
		{
			if ((Object)(object)info == (Object)null || string.IsNullOrWhiteSpace(trait))
			{
				return false;
			}
			string extendedProperty = CardExtensions.GetExtendedProperty(info, "OLD_SA_Traits");
			if (string.IsNullOrWhiteSpace(extendedProperty))
			{
				return false;
			}
			return (from x in extendedProperty.Split(new char[1] { ',' })
				select x.Trim()).Any((string x) => string.Equals(x, trait, StringComparison.Ordinal));
		}

		public static bool HasOldSaTrait(this PlayableCard card, string trait)
		{
			if ((Object)(object)card == (Object)null || (Object)(object)((Card)card).Info == (Object)null)
			{
				return false;
			}
			return ((Card)card).Info.HasOldSaTrait(trait);
		}

		public static string GetTraitDialogueID(this CardInfo info)
		{
			if ((Object)(object)info == (Object)null)
			{
				return null;
			}
			return CardExtensions.GetExtendedProperty(info, "OLD_SA_TraitDialogueID");
		}

		public static string GetTraitDialogue(this CardInfo info)
		{
			if ((Object)(object)info == (Object)null)
			{
				return null;
			}
			return CardExtensions.GetExtendedProperty(info, "OLD_SA_TraitDialogue");
		}
	}
	public class OLD_SA_TraitBehaviour : SpecialCardBehaviour
	{
		protected bool HasTrait(string trait)
		{
			return ((SpecialCardBehaviour)this).PlayableCard.HasOldSaTrait(trait);
		}

		protected void TriggerTraitDialogue()
		{
			((MonoBehaviour)this).StartCoroutine(CardTraitDialogueManager.TryTrigger(((SpecialCardBehaviour)this).PlayableCard));
		}
	}
	public static class OLD_SA_TraitInjector
	{
		public static void AddTraitBehaviours(PlayableCard card)
		{
			if ((Object)(object)card == (Object)null || (Object)(object)((Card)card).Info == (Object)null)
			{
				return;
			}
			string extendedProperty = CardExtensions.GetExtendedProperty(((Card)card).Info, "OLD_SA_Traits");
			if (string.IsNullOrWhiteSpace(extendedProperty))
			{
				return;
			}
			string[] array = extendedProperty.Split(new char[1] { ',' });
			string[] array2 = array;
			foreach (string text in array2)
			{
				string text2 = text.Trim();
				if (text2 == "OLD_SA_BEE_HUNTER" && (Object)(object)((Component)card).GetComponent<BeeHunterTrait>() == (Object)null)
				{
					((Component)card).gameObject.AddComponent<BeeHunterTrait>();
				}
				if (text2 == "OLD_SA_GREEDY_CARD" && (Object)(object)((Component)card).GetComponent<GreedyCardTrait>() == (Object)null)
				{
					((Component)card).gameObject.AddComponent<GreedyCardTrait>();
				}
				if (text2 == "OLD_SA_BLOOD_DEVOURER" && (Object)(object)((Component)card).GetComponent<BloodDevourerTrait>() == (Object)null)
				{
					((Component)card).gameObject.AddComponent<BloodDevourerTrait>();
				}
				if (text2 == "OLD_SA_BLOOD_ARMOR" && (Object)(object)((Component)card).GetComponent<BloodArmorTrait>() == (Object)null)
				{
					((Component)card).gameObject.AddComponent<BloodArmorTrait>();
				}
				if (text2 == "OLD_SA_HEALING_ARMOR" && (Object)(object)((Component)card).GetComponent<HealingArmorTrait>() == (Object)null)
				{
					((Component)card).gameObject.AddComponent<HealingArmorTrait>();
				}
			}
		}
	}
	public static class OLD_SA_TraitManager
	{
		public static Dictionary<string, Type> Traits = new Dictionary<string, Type>
		{
			{
				"OLD_SA_BEE_HUNTER",
				typeof(BeeHunterTrait)
			},
			{
				"OLD_SA_GREEDY_CARD",
				typeof(GreedyCardTrait)
			}
		};
	}
	[HarmonyPatch(typeof(PlayableCard), "SetInfo")]
	public static class OLD_SA_TraitPatch
	{
		[HarmonyPostfix]
		public static void Postfix(PlayableCard __instance, CardInfo info)
		{
			OLD_SA_TraitInjector.AddTraitBehaviours(__instance);
		}
	}
	public static class VanillaBeeTagPatch
	{
		public static void AddBeeTags()
		{
			AddTag("Bee");
			AddTag("Beehive");
		}

		private static void AddTag(string cardName)
		{
			CardInfo cardByName = CardLoader.GetCardByName(cardName);
			if (!((Object)(object)cardByName == (Object)null))
			{
				string extendedProperty = CardExtensions.GetExtendedProperty(cardByName, "OLD_SA_Traits");
				if (string.IsNullOrWhiteSpace(extendedProperty))
				{
					CardExtensions.SetExtendedProperty(cardByName, "OLD_SA_Traits", (object)"OLD_SA_BEE");
				}
				else if (!Array.Exists(extendedProperty.Split(new char[1] { ',' }), (string trait) => trait.Trim() == "OLD_SA_BEE"))
				{
					CardExtensions.SetExtendedProperty(cardByName, "OLD_SA_Traits", (object)(extendedProperty + ",OLD_SA_BEE"));
				}
			}
		}
	}
}

Xenowood_Law_Card/OldSa_Tribes.dll

Decompiled 5 days 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
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("OLD_SA.Tribes", "OLD SA Tribes", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static ManualLogSource Log;

		public const string GUID = "OLD_SA.Tribes";

		private void Awake()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)"OLD SA Tribes loading...");
			TribesAPI.Init();
			Harmony val = new Harmony("OLD_SA.Tribes");
			val.PatchAll();
			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 Tribe Magic;

		public static Tribe Water;

		public static Tribe Mollusca;

		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_007b: 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_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: 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)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0373: Unknown result type (might be due to invalid IL or missing references)
			//IL_0344: Unknown result type (might be due to invalid IL or missing references)
			//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_038e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0463: Unknown result type (might be due to invalid IL or missing references)
			//IL_0419: Unknown result type (might be due to invalid IL or missing references)
			//IL_0406: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_04db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0491: Unknown result type (might be due to invalid IL or missing references)
			//IL_047e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0434: Unknown result type (might be due to invalid IL or missing references)
			//IL_0525: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_059d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0553: Unknown result type (might be due to invalid IL or missing references)
			//IL_0540: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_056e: 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);
			Magic = TribeManager.Add("OLD_SA", "Magic", TextureHelper.GetImageAsTexture("OldSa_Magic.png", (FilterMode)0), true, (Texture2D)null);
			Water = TribeManager.Add("OLD_SA", "Water", TextureHelper.GetImageAsTexture("OldSa_Water.png", (FilterMode)0), true, (Texture2D)null);
			Mollusca = TribeManager.Add("OLD_SA", "Mollusca", TextureHelper.GetImageAsTexture("OldSa_Mollusca.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);
			}
			CardInfo cardByName7 = CardLoader.GetCardByName("BaitBucket");
			if ((Object)(object)cardByName7 != (Object)null && !cardByName7.tribes.Contains(Water))
			{
				cardByName7.tribes.Add(Water);
			}
			CardInfo cardByName8 = CardLoader.GetCardByName("Bullfrog");
			if ((Object)(object)cardByName8 != (Object)null && !cardByName8.tribes.Contains(Water))
			{
				cardByName8.tribes.Add(Water);
			}
			CardInfo cardByName9 = CardLoader.GetCardByName("Otter");
			if ((Object)(object)cardByName9 != (Object)null && !cardByName9.tribes.Contains(Water))
			{
				cardByName9.tribes.Add(Water);
			}
			CardInfo cardByName10 = CardLoader.GetCardByName("SquidBell");
			if ((Object)(object)cardByName10 != (Object)null)
			{
				if (!cardByName10.tribes.Contains(Water))
				{
					cardByName10.tribes.Add(Water);
				}
				if (!cardByName10.tribes.Contains(Mollusca))
				{
					cardByName10.tribes.Add(Mollusca);
				}
			}
			CardInfo cardByName11 = CardLoader.GetCardByName("SquidCards");
			if ((Object)(object)cardByName11 != (Object)null)
			{
				if (!cardByName11.tribes.Contains(Water))
				{
					cardByName11.tribes.Add(Water);
				}
				if (!cardByName11.tribes.Contains(Mollusca))
				{
					cardByName11.tribes.Add(Mollusca);
				}
			}
			CardInfo cardByName12 = CardLoader.GetCardByName("SquidMirror");
			if ((Object)(object)cardByName12 != (Object)null)
			{
				if (!cardByName12.tribes.Contains(Water))
				{
					cardByName12.tribes.Add(Water);
				}
				if (!cardByName12.tribes.Contains(Mollusca))
				{
					cardByName12.tribes.Add(Mollusca);
				}
			}
			CardInfo cardByName13 = CardLoader.GetCardByName("Tadpole");
			if ((Object)(object)cardByName13 != (Object)null && !cardByName13.tribes.Contains(Water))
			{
				cardByName13.tribes.Add(Water);
			}
			CardInfo cardByName14 = CardLoader.GetCardByName("Kraken");
			if ((Object)(object)cardByName14 != (Object)null)
			{
				if (!cardByName14.tribes.Contains(Water))
				{
					cardByName14.tribes.Add(Water);
				}
				if (!cardByName14.tribes.Contains(Mollusca))
				{
					cardByName14.tribes.Add(Mollusca);
				}
			}
			CardInfo cardByName15 = CardLoader.GetCardByName("Shark");
			if ((Object)(object)cardByName15 != (Object)null && !cardByName15.tribes.Contains(Water))
			{
				cardByName15.tribes.Add(Water);
			}
			CardInfo cardByName16 = CardLoader.GetCardByName("Hodag");
			if ((Object)(object)cardByName16 != (Object)null && !cardByName16.tribes.Contains((Tribe)4))
			{
				cardByName16.tribes.Add((Tribe)4);
			}
		}
	}
}
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
			},
			{
				"OLD_SA_RATATOSK",
				OldSaMythBackground.ID
			},
			{
				"OLD_SA_NIDHOGG",
				OldSaMythBackground.ID
			},
			{
				"OLD_SA_VEDRFOLNIR",
				OldSaMythBackground.ID
			},
			{
				"OLD_SA_HOLLOWGAZE",
				OldSaEerieForestBackground.ID
			},
			{
				"OLD_SA_SIREN",
				OldSaMythBackground.ID
			},
			{
				"OLD_SA_ABORTED_IDOL",
				OldSaMythBackground.ID
			},
			{
				"OLD_SA_CRYSTALLINE_ORCHID",
				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);
			}
		}
	}
}

Xenowood_Law_Card/Xenowood_Law_Decks/OLD_SA_Decks.dll

Decompiled 5 days 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);
		StarterDeckManager.New("com.oldsa.attack", "Attack", "OLD_SA_Attack.png", new string[3] { "Mantis", "OLD_SA_STAG_BEETLE", "OLD_SA_MANTIS_SHRIMP" }, 0);
		StarterDeckManager.New("com.oldsa.shield", "Shield", "OLD_SA_Shield.png", new string[3] { "OLD_SA_HONEY_BADGER", "OLD_SA_SNAIL", "OLD_SA_TRICERATOPS" }, 0);
		StarterDeckManager.New("com.oldsa.pure", "Pure", "OLD_SA_Pure.png", new string[3] { "OLD_SA_PURE_PELT", "OLD_SA_PURE_PELT", "OLD_SA_PURE_PELT" }, 0);
		StarterDeckManager.New("com.oldsa.running", "Running", "OLD_SA_Running.png", new string[3] { "SquirrelBall", "OLD_SA_OSTRICH", "OLD_SA_CHEETAH" }, 0);
		StarterDeckManager.New("com.oldsa.cards", "Cards", "OLD_SA_Cards.png", new string[3] { "SquidCards", "OLD_SA_SILVERFISH", "Cockroach" }, 0);
		StarterDeckManager.New("com.oldsa.negative", "Negative", "OLD_SA_Negative.png", new string[3] { "OLD_SA_SEAGULL", "OLD_SA_WHITE_WOLF", "OLD_SA_CRYSTALLINE_ORCHID" }, 0);
		StarterDeckManager.New("com.oldsa.combo", "Combo", "OLD_SA_Combo.png", new string[3] { "OLD_SA_OWL", "OLD_SA_BOAR", "OLD_SA_SHOEBILL" }, 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");
	}
}