Decompiled source of Deck Of Hotties v1.0.0

plugins/DeckOfHotties/DeckOfHotties.dll

Decompiled 3 weeks 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 DiskCardGame;
using InscryptionAPI.Card;
using InscryptionAPI.Helpers;
using InscryptionAPI.Triggers;
using Microsoft.CodeAnalysis;
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(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("DeckOfHotties")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("How did these cards get here?")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DeckOfHotties")]
[assembly: AssemblyTitle("DeckOfHotties")]
[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 DeckOfHotties
{
	public class CustomAppearances : CardAppearanceBehaviour
	{
		public static Appearance ID = CardAppearanceBehaviourManager.Add("DeckOfHotties", "CustomCardBackground", typeof(CustomAppearances)).Id;

		public override void ApplyAppearance()
		{
			string text = "FullBackground.png";
			string name = ((Object)((CardAppearanceBehaviour)this).Card.Info).name;
			if (name.StartsWith("DeckOfHotties_summon_"))
			{
				text = "ShortBackground.png";
			}
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture(text, (FilterMode)0);
			if ((Object)(object)imageAsTexture != (Object)null)
			{
				((CardAppearanceBehaviour)this).Card.RenderInfo.baseTextureOverride = (Texture)(object)imageAsTexture;
				((CardAppearanceBehaviour)this).Card.RenderInfo.forceEmissivePortrait = false;
			}
			else
			{
				Debug.LogWarning((object)("[DeckOfHotties] CustomApperance not found: " + text));
			}
		}
	}
	public class FlowerSummon : AbilityBehaviour
	{
		[CompilerGenerated]
		private sealed class <OnResolveOnBoard>d__5 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public FlowerSummon <>4__this;

			private List<CardSlot> <adjacentSlots>5__1;

			private List<CardSlot>.Enumerator <>s__2;

			private CardSlot <slot>5__3;

			private string <cardToSpawn>5__4;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <OnResolveOnBoard>d__5(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 2)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<adjacentSlots>5__1 = null;
				<>s__2 = default(List<CardSlot>.Enumerator);
				<slot>5__3 = null;
				<cardToSpawn>5__4 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<>2__current = ((AbilityBehaviour)<>4__this).PreSuccessfulTriggerSequence();
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -1;
						<adjacentSlots>5__1 = Singleton<BoardManager>.Instance.GetAdjacentSlots(((AbilityBehaviour)<>4__this).Card.Slot);
						<>s__2 = <adjacentSlots>5__1.GetEnumerator();
						<>1__state = -3;
						goto IL_0142;
					case 2:
						<>1__state = -3;
						<cardToSpawn>5__4 = null;
						goto IL_013a;
					case 3:
						{
							<>1__state = -1;
							return false;
						}
						IL_0142:
						if (<>s__2.MoveNext())
						{
							<slot>5__3 = <>s__2.Current;
							if ((Object)(object)<slot>5__3 != (Object)null && (Object)(object)<slot>5__3.Card == (Object)null)
							{
								<cardToSpawn>5__4 = ((Random.value <= 0.3f) ? "DeckOfHotties_summon_GigantescoMano" : "DeckOfHotties_summon_FlowerLimb");
								<>2__current = Singleton<BoardManager>.Instance.CreateCardInSlot(CardLoader.GetCardByName(<cardToSpawn>5__4), <slot>5__3, 0.25f, true);
								<>1__state = 2;
								return true;
							}
							goto IL_013a;
						}
						<>m__Finally1();
						<>s__2 = default(List<CardSlot>.Enumerator);
						<>2__current = ((AbilityBehaviour)<>4__this).LearnAbility(0f);
						<>1__state = 3;
						return true;
						IL_013a:
						<slot>5__3 = null;
						goto IL_0142;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				((IDisposable)<>s__2).Dispose();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public static Ability ability;

		public override Ability Ability => ability;

		public static void Init()
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			val.rulebookName = "Hana Hana fruit";
			AbilityExtensions.SetRulebookDescription(val, "When this card is played, it summons random flower limbs in the empty slots adjacent to it. if the summoner dies, the limbs will die as well.");
			val.canStack = false;
			val.powerLevel = 3;
			val.opponentUsable = true;
			val.passive = false;
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("FlowerFruit.png", (FilterMode)0);
			ability = AbilityManager.Add("DeckOfHotties", val, typeof(FlowerSummon), (Texture)(object)imageAsTexture).Id;
		}

		public override bool RespondsToResolveOnBoard()
		{
			return true;
		}

		[IteratorStateMachine(typeof(<OnResolveOnBoard>d__5))]
		public override IEnumerator OnResolveOnBoard()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <OnResolveOnBoard>d__5(0)
			{
				<>4__this = this
			};
		}
	}
	public class GhostTail : AbilityBehaviour
	{
		[CompilerGenerated]
		private sealed class <OnTakeDamage>d__5 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public PlayableCard source;

			public GhostTail <>4__this;

			private CardSlot <slot>5__1;

			private CardSlot <targetSlot>5__2;

			private CardSlot <right>5__3;

			private CardSlot <left>5__4;

			private string <ghostID>5__5;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <OnTakeDamage>d__5(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<slot>5__1 = null;
				<targetSlot>5__2 = null;
				<right>5__3 = null;
				<left>5__4 = null;
				<ghostID>5__5 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01eb: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<slot>5__1 = ((AbilityBehaviour)<>4__this).Card.Slot;
					<targetSlot>5__2 = null;
					<right>5__3 = Singleton<BoardManager>.Instance.GetAdjacent(<slot>5__1, false);
					<left>5__4 = Singleton<BoardManager>.Instance.GetAdjacent(<slot>5__1, true);
					if ((Object)(object)<right>5__3 != (Object)null && (Object)(object)<right>5__3.Card == (Object)null && (Object)(object)<left>5__4 != (Object)null && (Object)(object)<left>5__4.Card == (Object)null)
					{
						<targetSlot>5__2 = ((Random.value > 0.5f) ? <right>5__3 : <left>5__4);
					}
					else if ((Object)(object)<right>5__3 != (Object)null && (Object)(object)<right>5__3.Card == (Object)null)
					{
						<targetSlot>5__2 = <right>5__3;
					}
					else if ((Object)(object)<left>5__4 != (Object)null && (Object)(object)<left>5__4.Card == (Object)null)
					{
						<targetSlot>5__2 = <left>5__4;
					}
					if ((Object)(object)<targetSlot>5__2 != (Object)null)
					{
						<>2__current = ((AbilityBehaviour)<>4__this).PreSuccessfulTriggerSequence();
						<>1__state = 1;
						return true;
					}
					break;
				case 1:
					<>1__state = -1;
					<>2__current = Singleton<BoardManager>.Instance.AssignCardToSlot(((AbilityBehaviour)<>4__this).Card, <targetSlot>5__2, 0.1f, (Action)null, true);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(0.2f);
					<>1__state = 3;
					return true;
				case 3:
					<>1__state = -1;
					<ghostID>5__5 = "DeckOfHotties_summon_HollowGhost";
					<>2__current = Singleton<BoardManager>.Instance.CreateCardInSlot(CardLoader.GetCardByName(<ghostID>5__5), <slot>5__1, 0.1f, true);
					<>1__state = 4;
					return true;
				case 4:
					<>1__state = -1;
					<>2__current = ((AbilityBehaviour)<>4__this).LearnAbility(0.5f);
					<>1__state = 5;
					return true;
				case 5:
					<>1__state = -1;
					<ghostID>5__5 = null;
					break;
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public static Ability ability;

		public override Ability Ability => ability;

		public static void Init()
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			val.rulebookName = "Holo Holo fruit";
			AbilityExtensions.SetRulebookDescription(val, "When this card would be struck, it moves to an empty space and leaves a Negative Ghost behind.");
			val.canStack = false;
			val.powerLevel = 1;
			val.opponentUsable = true;
			val.passive = false;
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("HollowFruit.png", (FilterMode)0);
			ability = AbilityManager.Add("DeckOfHotties", val, typeof(GhostTail), (Texture)(object)imageAsTexture).Id;
		}

		public override bool RespondsToTakeDamage(PlayableCard source)
		{
			return !((AbilityBehaviour)this).Card.Dead;
		}

		[IteratorStateMachine(typeof(<OnTakeDamage>d__5))]
		public override IEnumerator OnTakeDamage(PlayableCard source)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <OnTakeDamage>d__5(0)
			{
				<>4__this = this,
				source = source
			};
		}
	}
	public class MeroMero : AbilityBehaviour, IModifyDamageTaken
	{
		public static Ability ability;

		public override Ability Ability => ability;

		public static void Init()
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			AbilityInfo val = ScriptableObject.CreateInstance<AbilityInfo>();
			val.rulebookName = "Mero Mero fruit";
			AbilityExtensions.SetRulebookDescription(val, "The enemy directly opposing this card cannot deal damage to it.");
			val.canStack = false;
			val.powerLevel = 4;
			val.opponentUsable = false;
			val.passive = false;
			val.metaCategories = new List<AbilityMetaCategory> { (AbilityMetaCategory)0 };
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("MeroFruit.png", (FilterMode)0);
			ability = AbilityManager.Add("DeckOfHotties", val, typeof(MeroMero), (Texture)(object)imageAsTexture).Id;
		}

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

		public bool RespondsToModifyDamageTaken(PlayableCard target, int damage, PlayableCard attacker, int originalDamage)
		{
			return (Object)(object)target == (Object)(object)((AbilityBehaviour)this).Card && !((AbilityBehaviour)this).Card.Dead && (Object)(object)attacker != (Object)null;
		}

		public int OnModifyDamageTaken(PlayableCard target, int damage, PlayableCard attacker, int originalDamage)
		{
			if ((Object)(object)((AbilityBehaviour)this).Card.Slot == (Object)null)
			{
				return damage;
			}
			CardSlot opposingSlot = ((AbilityBehaviour)this).Card.Slot.opposingSlot;
			if ((Object)(object)attacker.Slot == (Object)(object)opposingSlot)
			{
				((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect();
				return 0;
			}
			return damage;
		}
	}
	[BepInPlugin("com.Hazes.DeckOfHotties", "Deck of Hotties", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Deck of Hotties mod loaded!");
			FlowerSummon.Init();
			GhostTail.Init();
			MeroMero.Init();
			AddCards();
		}

		private void AddCards()
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected I4, but got Unknown
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Expected I4, but got Unknown
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Expected I4, but got Unknown
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Expected I4, but got Unknown
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Expected I4, but got Unknown
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Expected I4, but got Unknown
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Expected I4, but got Unknown
			//IL_038b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Expected I4, but got Unknown
			CardInfo val = CardManager.New("DeckOfHotties", "OP_Nami", "Nami", 2, 1, "Burglar and navigator");
			int? num = 4;
			CardExtensions.SetCost(val, (int?)0, num, (int?)0, (List<GemType>)null);
			CardExtensions.AddAbilities(val, (Ability[])(object)new Ability[1] { (Ability)7 });
			CardExtensions.AddAppearances(val, (Appearance[])(object)new Appearance[1] { (Appearance)7 });
			CardExtensions.AddAppearances(val, (Appearance[])(object)new Appearance[1] { (Appearance)(int)CustomAppearances.ID });
			CardExtensions.SetDefaultPart1Card(val);
			CardExtensions.SetPortrait(val, CreateFullArtSprite("Nami.png"));
			CardExtensions.SetEmissivePortrait(val, CreateFullArtSprite("Nami_Emissive.png"));
			CardExtensions.AddMetaCategories(val, (CardMetaCategory[])(object)new CardMetaCategory[2]
			{
				default(CardMetaCategory),
				(CardMetaCategory)1
			});
			CardManager.Add("DeckOfHotties", val);
			CardInfo val2 = CardManager.New("DeckOfHotties", "OP_Robin", "Robin", 2, 2, "Scholar and archaeologist");
			CardExtensions.SetCost(val2, (int?)2, (int?)0, (int?)0, (List<GemType>)null);
			CardExtensions.AddAbilities(val2, (Ability[])(object)new Ability[1] { (Ability)(int)FlowerSummon.ability });
			CardExtensions.AddAppearances(val2, (Appearance[])(object)new Appearance[1] { (Appearance)7 });
			CardExtensions.AddAppearances(val2, (Appearance[])(object)new Appearance[1] { (Appearance)(int)CustomAppearances.ID });
			CardExtensions.SetDefaultPart1Card(val2);
			CardExtensions.SetPortrait(val2, CreateFullArtSprite("Robin.png"));
			CardExtensions.SetEmissivePortrait(val2, CreateFullArtSprite("Robin_Emissive.png"));
			CardExtensions.AddMetaCategories(val2, (CardMetaCategory[])(object)new CardMetaCategory[2]
			{
				default(CardMetaCategory),
				(CardMetaCategory)1
			});
			CardManager.Add("DeckOfHotties", val2);
			CardInfo val3 = CardManager.New("DeckOfHotties", "OP_Perona", "Perona", 1, 3, "The ghost princess.");
			num = 3;
			CardExtensions.SetCost(val3, (int?)0, num, (int?)0, (List<GemType>)null);
			CardExtensions.AddAbilities(val3, (Ability[])(object)new Ability[2]
			{
				(Ability)(int)GhostTail.ability,
				(Ability)19
			});
			CardExtensions.AddAppearances(val3, (Appearance[])(object)new Appearance[1] { (Appearance)7 });
			CardExtensions.AddAppearances(val3, (Appearance[])(object)new Appearance[1] { (Appearance)(int)CustomAppearances.ID });
			CardExtensions.SetDefaultPart1Card(val3);
			CardExtensions.SetPortrait(val3, CreateFullArtSprite("Perona.png"));
			CardExtensions.SetEmissivePortrait(val3, CreateFullArtSprite("Perona_Emissive.png"));
			CardExtensions.AddMetaCategories(val3, (CardMetaCategory[])(object)new CardMetaCategory[2]
			{
				default(CardMetaCategory),
				(CardMetaCategory)1
			});
			CardManager.Add("DeckOfHotties", val3);
			CardInfo val4 = CardManager.New("DeckOfHotties", "summon_HollowGhost", "Hollow Ghost", 0, 2, "A ghost summoned by Perona. It weakens the enemy it hits.");
			CardExtensions.SetCost(val4, (int?)0, (int?)2, (int?)0, (List<GemType>)null);
			CardExtensions.AddAbilities(val4, (Ability[])(object)new Ability[1] { (Ability)83 });
			CardExtensions.AddAppearances(val4, (Appearance[])(object)new Appearance[1] { (Appearance)(int)CustomAppearances.ID });
			CardExtensions.SetPortrait(val4, CreateStandardPortrait("HollowGhost.png"));
			CardExtensions.SetDefaultPart1Card(val4);
			CardExtensions.RemoveMetaCategories(val4, (CardMetaCategory[])(object)new CardMetaCategory[1] { (CardMetaCategory)3 });
			CardManager.Add("DeckOfHotties", val4);
			CardInfo val5 = CardManager.New("DeckOfHotties", "summon_GigantescoMano", "Giant Limb", 1, 1, "A giant flower limb");
			CardExtensions.AddAbilities(val5, (Ability[])(object)new Ability[2]
			{
				(Ability)24,
				(Ability)35
			});
			CardExtensions.AddAppearances(val5, (Appearance[])(object)new Appearance[1] { (Appearance)(int)CustomAppearances.ID });
			CardExtensions.SetPortrait(val5, CreateStandardPortrait("GigantescoMano.png"));
			CardExtensions.SetDefaultPart1Card(val5);
			CardExtensions.RemoveMetaCategories(val5, (CardMetaCategory[])(object)new CardMetaCategory[3]
			{
				default(CardMetaCategory),
				(CardMetaCategory)1,
				(CardMetaCategory)3
			});
			CardManager.Add("DeckOfHotties", val5);
			CardInfo val6 = CardManager.New("DeckOfHotties", "summon_FlowerLimb", "Flower Limb", 1, 1, "A flower limb");
			CardExtensions.AddAbilities(val6, (Ability[])(object)new Ability[1] { (Ability)35 });
			CardExtensions.AddAppearances(val6, (Appearance[])(object)new Appearance[1] { (Appearance)(int)CustomAppearances.ID });
			CardExtensions.SetPortrait(val6, CreateStandardPortrait("FlowerLimb.png"));
			CardExtensions.SetDefaultPart1Card(val6);
			CardManager.Add("DeckOfHotties", val6);
		}

		private Sprite CreateFullArtSprite(string imageName)
		{
			//IL_003a: 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)
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture(imageName, (FilterMode)0);
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(0f, 0f, (float)((Texture)imageAsTexture).width, (float)((Texture)imageAsTexture).height);
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(0.51f, 0.58f);
			return Sprite.Create(imageAsTexture, val, val2, 100f, 0u, (SpriteMeshType)0);
		}

		private Sprite CreateStandardPortrait(string imageName)
		{
			//IL_003a: 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)
			Texture2D imageAsTexture = TextureHelper.GetImageAsTexture(imageName, (FilterMode)0);
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(0f, 0f, (float)((Texture)imageAsTexture).width, (float)((Texture)imageAsTexture).height);
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(0.5f, 0.5f);
			return Sprite.Create(imageAsTexture, val, val2, 100f, 0u, (SpriteMeshType)0);
		}
	}
}