Decompiled source of Saxby Fam v6.0.1

plugins/SaxbyFam.dll

Decompiled 11 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
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 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: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("SaxbyFam")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SaxbyFam")]
[assembly: AssemblyTitle("SaxbyFam")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace SaxbyFam;

internal class Abilities
{
	public class SoulsaTransform : SpecialCardBehaviour
	{
		public static readonly SpecialTriggeredAbility soulsaTransform = SpecialTriggeredAbilityManager.Add("bitty45.inscryption.saxbyfam", "soulsaTransform", typeof(SoulsaTransform)).Id;

		public override bool RespondsToResolveOnBoard()
		{
			return true;
		}

		public override IEnumerator OnResolveOnBoard()
		{
			((SpecialCardBehaviour)this).PlayableCard.AddTemporaryMod(new CardModificationInfo
			{
				abilities = new List<Ability> { (Ability)20 }
			});
			((SpecialCardBehaviour)this).PlayableCard.Status.hiddenAbilities.Add((Ability)20);
			yield break;
		}

		public override bool RespondsToSacrifice()
		{
			return true;
		}

		public override IEnumerator OnSacrifice()
		{
			string name = ((Object)((SpecialCardBehaviour)this).PlayableCard).name;
			string text = name;
			string text2 = text;
			CardInfo evolution = ((text2 == "saxby_Soulsa") ? CardLoader.GetCardByName("saxby_Soluno") : ((!(text2 == "saxby_Soluno")) ? CardLoader.GetCardByName("saxby_BittysTotem") : CardLoader.GetCardByName("saxby_Soulsa")));
			foreach (CardModificationInfo cardModificationInfo in ((Card)((SpecialCardBehaviour)this).PlayableCard).Info.Mods.FindAll((CardModificationInfo x) => !x.nonCopyable))
			{
				CardModificationInfo cardModificationInfo2 = (CardModificationInfo)cardModificationInfo.Clone();
				evolution.Mods.Add(cardModificationInfo2);
			}
			yield return ((SpecialCardBehaviour)this).PlayableCard.TransformIntoCard(evolution, (Action)null, (Action)null);
			yield return (object)new WaitForSeconds(0.5f);
		}
	}

	public class DropCat : SpecialCardBehaviour
	{
		public static readonly SpecialTriggeredAbility dropCat = SpecialTriggeredAbilityManager.Add("bitty45.inscryption.saxbyfam", "dropCat", typeof(DropCat)).Id;

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

		public override IEnumerator OnDie(bool wasSacrifice, PlayableCard killer)
		{
			yield return Singleton<BoardManager>.Instance.CreateCardInSlot(CardLoader.GetCardByName("Cat"), ((SpecialCardBehaviour)this).PlayableCard.slot, 0.15f, true);
		}
	}

	public static void AddCards()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Expected I4, but got Unknown
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Expected I4, but got Unknown
		CardInfo val = CardExtensions.SetPortraitAndEmission(CardExtensions.AddSpecialAbilities(CardManager.New("bittySaxbyFam", "TestCard", "TestCard", 1, 2, "test card."), (SpecialTriggeredAbility[])(object)new SpecialTriggeredAbility[2]
		{
			(SpecialTriggeredAbility)(int)SoulsaTransform.soulsaTransform,
			(SpecialTriggeredAbility)(int)DropCat.dropCat
		}), Tools.LoadTexture("portrait_test"), Tools.LoadTexture("portrait_test"), (FilterMode?)null);
		CardManager.Add("bittySaxbyFam", val);
	}
}
[BepInPlugin("bitty45.inscryption.saxbyfam", "Bitty Saxbyfam", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
	internal const string PluginGuid = "bitty45.inscryption.saxbyfam";

	internal const string PluginName = "Bitty Saxbyfam";

	internal const string CardPrefix = "bittySaxbyFam";

	internal const string PluginVersion = "1.0.0";

	public static AssetBundle assetBundle;

	public static List<AudioClip> addedSfx = new List<AudioClip>();

	internal static ManualLogSource Log;

	private void Awake()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		Log = ((BaseUnityPlugin)this).Logger;
		Harmony val = new Harmony("bitty45.inscryption.saxbyfam");
		Abilities.AddCards();
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin SaxbyFam is loaded!");
	}
}
internal class Tools
{
	private static Assembly _assembly;

	public static Assembly CurrentAssembly => _assembly ?? (_assembly = Assembly.GetExecutingAssembly());

	public static Texture2D LoadTexture(string name)
	{
		return TextureHelper.GetImageAsTexture(name + (name.EndsWith(".png") ? "" : ".png"), CurrentAssembly, (FilterMode)0);
	}

	public static Sprite LoadSprite(string name)
	{
		return TextureHelper.ConvertTexture(TextureHelper.GetImageAsTexture(name + (name.EndsWith(".png") ? "" : ".png"), CurrentAssembly, (FilterMode)0), (Vector2?)null);
	}
}