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 Effects = new Dictionary(); 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> Blessings = new Dictionary>(); public static void AddBlessing(PlayableCard card, BlessingType type) { if (!((Object)(object)card == (Object)null)) { if (!Blessings.ContainsKey(card)) { Blessings.Add(card, new List()); } 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 WindCards = new HashSet(); 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(); } } }