Decompiled source of SmallTweak Borne v1.0.0

plugins/SmallTweak_Borne.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using DiskCardGame;
using HarmonyLib;
using InscryptionAPI.Card;
using Microsoft.CodeAnalysis;
using SmallTweak_Hydra.PATCHES;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: AssemblyCompany("SmallTweak_Borne")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Bornes should attack cards bearing the same borne durrrr.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+eedbf13e53819a4e15d63f9c30d75be22f6dbb7c")]
[assembly: AssemblyProduct("SmallTweak_Borne")]
[assembly: AssemblyTitle("SmallTweak_Borne")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SmallTweak_Hydra
{
	[BepInPlugin("creator.SmallTweak.Borne", "Smalltweak Borne", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class SmallTweak_Borne : BaseUnityPlugin
	{
		public const string PluginGuid = "creator.SmallTweak.Borne";

		public const string PluginName = "Smalltweak Borne";

		public const string PluginVersion = "1.0.0";

		public const string PluginPrefix = "Smalltweak_Borne";

		public static ManualLogSource Log = new ManualLogSource("Smalltweak Borne");

		public static Harmony harmony = new Harmony("creator.SmallTweak.Borne");

		public void Awake()
		{
			harmony.PatchAll(typeof(PlayablePatches));
			harmony.PatchAll(typeof(BorneRulebookPatches));
			((BaseUnityPlugin)this).Logger.LogMessage((object)"creator.SmallTweak.Borne: Loaded Mod: Smalltweak Borne - 1.0.0");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "SmallTweak_Borne";

		public const string PLUGIN_NAME = "SmallTweak_Borne";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace SmallTweak_Hydra.PATCHES
{
	[HarmonyPatch(typeof(RuleBookInfo))]
	internal static class BorneRulebookPatches
	{
		[HarmonyAfter(new string[] { "cyantist.inscryption.api" })]
		[HarmonyPostfix]
		[HarmonyPatch("ConstructPageData", new Type[] { typeof(AbilityMetaCategory) })]
		public static void PostfixUpdateHydraEggRulebook(AbilityMetaCategory metaCategory)
		{
			AbilityInfo val = ((IEnumerable<AbilityInfo>)AbilityManager.AllAbilityInfos).FirstOrDefault((Func<AbilityInfo, bool>)((AbilityInfo i) => (int)i.ability == 19));
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			val.rulebookDescription = "[creature] will strike an opponent directly, even if there is a creature opposing it, unless the creature has this sigil.";
			AbilityInfo val2 = ((IEnumerable<AbilityInfo>)AbilityManager.AllAbilityInfos).FirstOrDefault((Func<AbilityInfo, bool>)((AbilityInfo i) => (int)i.ability == 13));
			if (!((Object)(object)val2 == (Object)null))
			{
				val2.rulebookDescription = "[creature] submerges itself during its opponent's turn. While submerged, opposing creatures attack its owner directly, unless that creature has this sigil.";
				AbilityInfo val3 = ((IEnumerable<AbilityInfo>)AbilityManager.AllAbilityInfos).FirstOrDefault((Func<AbilityInfo, bool>)((AbilityInfo i) => (int)i.ability == 89));
				if (!((Object)(object)val3 == (Object)null))
				{
					val3.rulebookDescription = "[creature] submerges itself during its opponent's turn. While submerged, opposing creatures attack its owner directly, unless that creature has this sigil.";
				}
			}
		}
	}
	[HarmonyPatch]
	internal static class PlayablePatches
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(PlayableCard), "CanAttackDirectly")]
		public static bool PrefixCanAttackDirectly(CardSlot opposingSlot, ref bool __result, PlayableCard __instance)
		{
			__result = (Object)(object)opposingSlot.Card == (Object)null || (__instance.HasAbility((Ability)19) && !opposingSlot.Card.HasAbility((Ability)23) && !opposingSlot.Card.HasAbility((Ability)19)) || (((Card)opposingSlot.Card).FaceDown && !__instance.HasAbility((Ability)13));
			return false;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}