Decompiled source of Gameboi Valuable v1.0.1

PokeBattle.dll

Decompiled a month 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.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;

[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.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Omniscye")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+31d33a1e262fb9cd936a8fd3f583fdd7bc996e5a")]
[assembly: AssemblyProduct("PokeBattle")]
[assembly: AssemblyTitle("PokeBattle")]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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;
		}
	}
}
public class PokemonBattleItem : MonoBehaviour
{
	[CompilerGenerated]
	private sealed class <AnimateHP>d__18 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public Image hpBar;

		public float startPct;

		public float endPct;

		public PokemonBattleItem <>4__this;

		private float <t>5__1;

		private float <duration>5__2;

		private float <current>5__3;

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

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

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

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<t>5__1 = 0f;
				<duration>5__2 = 1f;
				break;
			case 1:
				<>1__state = -1;
				break;
			}
			if (<t>5__1 < <duration>5__2)
			{
				<t>5__1 += Time.deltaTime;
				<current>5__3 = Mathf.Lerp(startPct, endPct, <t>5__1 / <duration>5__2);
				hpBar.fillAmount = <current>5__3;
				if (<current>5__3 < 0.25f)
				{
					((Graphic)hpBar).color = new Color(1f, 0.2f, 0.2f);
				}
				else if (<current>5__3 < 0.5f)
				{
					((Graphic)hpBar).color = new Color(1f, 0.8f, 0.2f);
				}
				else
				{
					((Graphic)hpBar).color = new Color(0.2f, 0.9f, 0.3f);
				}
				<>2__current = null;
				<>1__state = 1;
				return true;
			}
			hpBar.fillAmount = endPct;
			if (endPct < 0.25f)
			{
				((Graphic)hpBar).color = new Color(1f, 0.2f, 0.2f);
			}
			else if (endPct < 0.5f)
			{
				((Graphic)hpBar).color = new Color(1f, 0.8f, 0.2f);
			}
			else
			{
				((Graphic)hpBar).color = new Color(0.2f, 0.9f, 0.3f);
			}
			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();
		}
	}

	[CompilerGenerated]
	private sealed class <BattleSequence>d__13 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public int attackerID;

		public int defenderID;

		public int winnerID;

		public PokemonBattleItem <>4__this;

		private PlayerAvatar <p1>5__1;

		private PlayerAvatar <p2>5__2;

		private GameObject <audioObj>5__3;

		private AudioSource <source>5__4;

		private AudioSource <sfxSource>5__5;

		private GameObject <canvasObj>5__6;

		private Canvas <canvas>5__7;

		private CanvasScaler <scaler>5__8;

		private GameObject <flashObj>5__9;

		private RectTransform <enemyHUD>5__10;

		private RectTransform <playerHUD>5__11;

		private Image <enemyHP>5__12;

		private Image <playerHP>5__13;

		private Text <statusText>5__14;

		private string <move1>5__15;

		private string <move2>5__16;

		private string <move3>5__17;

		private string <finisherMove>5__18;

		private PlayerAvatar <winner>5__19;

		private PlayerAvatar <loser>5__20;

		private Image <loserHPBar>5__21;

		private RectTransform <loserRect>5__22;

		private float <currentFill>5__23;

		private int <i>5__24;

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

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

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

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<p1>5__1 = null;
			<p2>5__2 = null;
			<audioObj>5__3 = null;
			<source>5__4 = null;
			<sfxSource>5__5 = null;
			<canvasObj>5__6 = null;
			<canvas>5__7 = null;
			<scaler>5__8 = null;
			<flashObj>5__9 = null;
			<enemyHUD>5__10 = null;
			<playerHUD>5__11 = null;
			<enemyHP>5__12 = null;
			<playerHP>5__13 = null;
			<statusText>5__14 = null;
			<move1>5__15 = null;
			<move2>5__16 = null;
			<move3>5__17 = null;
			<finisherMove>5__18 = null;
			<winner>5__19 = null;
			<loser>5__20 = null;
			<loserHPBar>5__21 = null;
			<loserRect>5__22 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Expected O, but got Unknown
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e6: Expected O, but got Unknown
			//IL_054d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0557: Expected O, but got Unknown
			//IL_060f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0619: Expected O, but got Unknown
			//IL_069a: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a4: Expected O, but got Unknown
			//IL_076d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0777: Expected O, but got Unknown
			//IL_07df: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e9: Expected O, but got Unknown
			//IL_0811: Unknown result type (might be due to invalid IL or missing references)
			//IL_081b: Expected O, but got Unknown
			//IL_09dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e6: Expected O, but got Unknown
			//IL_0a1e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a28: Expected O, but got Unknown
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Expected O, but got Unknown
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a90: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a9a: Expected O, but got Unknown
			//IL_0346: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Expected O, but got Unknown
			//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_03db: Unknown result type (might be due to invalid IL or missing references)
			//IL_040d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0496: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a0: Expected O, but got Unknown
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Expected O, but got Unknown
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0906: Unknown result type (might be due to invalid IL or missing references)
			//IL_0910: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
			{
				<>1__state = -1;
				<>4__this.isBattling = true;
				PhotonView photonView = PhotonNetwork.GetPhotonView(attackerID);
				<p1>5__1 = ((photonView != null) ? ((Component)photonView).GetComponent<PlayerAvatar>() : null);
				PhotonView photonView2 = PhotonNetwork.GetPhotonView(defenderID);
				<p2>5__2 = ((photonView2 != null) ? ((Component)photonView2).GetComponent<PlayerAvatar>() : null);
				if ((Object)(object)<p1>5__1 == (Object)null || (Object)(object)<p2>5__2 == (Object)null)
				{
					<>4__this.isBattling = false;
					return false;
				}
				if (<p1>5__1.photonView.IsMine || <p2>5__2.photonView.IsMine)
				{
					PlayerController.instance.InputDisable(20f);
					PlayerController.instance.rb.velocity = Vector3.zero;
				}
				<>2__current = (object)new WaitForSeconds(0.2f);
				<>1__state = 1;
				return true;
			}
			case 1:
				<>1__state = -1;
				<audioObj>5__3 = new GameObject("BattleAudio");
				<audioObj>5__3.transform.position = ((Component)<>4__this).transform.position;
				<source>5__4 = <audioObj>5__3.AddComponent<AudioSource>();
				<sfxSource>5__5 = <audioObj>5__3.AddComponent<AudioSource>();
				<source>5__4.spatialBlend = 0f;
				<source>5__4.volume = 0.6f;
				<sfxSource>5__5.spatialBlend = 0f;
				<sfxSource>5__5.volume = 0.8f;
				if ((Object)(object)<>4__this.battleMusicClip != (Object)null)
				{
					<source>5__4.clip = <>4__this.battleMusicClip;
					<source>5__4.loop = true;
					<source>5__4.Play();
				}
				<canvasObj>5__6 = new GameObject("PokemonCanvas");
				<canvas>5__7 = <canvasObj>5__6.AddComponent<Canvas>();
				<canvas>5__7.renderMode = (RenderMode)0;
				<canvas>5__7.sortingOrder = 999;
				<scaler>5__8 = <canvasObj>5__6.AddComponent<CanvasScaler>();
				<scaler>5__8.uiScaleMode = (ScaleMode)1;
				<scaler>5__8.referenceResolution = new Vector2(1920f, 1080f);
				<canvasObj>5__6.AddComponent<GraphicRaycaster>();
				<flashObj>5__9 = <>4__this.CreateSolidPanel(<canvasObj>5__6, Color.white);
				<i>5__24 = 0;
				goto IL_0373;
			case 2:
				<>1__state = -1;
				<i>5__24++;
				goto IL_0373;
			case 3:
				<>1__state = -1;
				<statusText>5__14.text = "Go! " + <p1>5__1.playerName + "!";
				<>2__current = (object)new WaitForSeconds(2f);
				<>1__state = 4;
				return true;
			case 4:
				<>1__state = -1;
				<move1>5__15 = <>4__this.funnyMoves[Random.Range(0, <>4__this.funnyMoves.Length)];
				<statusText>5__14.text = <p1>5__1.playerName + " used " + <move1>5__15 + "!";
				<>2__current = (object)new WaitForSeconds(1f);
				<>1__state = 5;
				return true;
			case 5:
				<>1__state = -1;
				((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.ShakeUI(<enemyHUD>5__10));
				if ((Object)(object)<>4__this.hitSoundClip != (Object)null)
				{
					<sfxSource>5__5.PlayOneShot(<>4__this.hitSoundClip);
				}
				<>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.AnimateHP(<enemyHP>5__12, 1f, 0.45f));
				<>1__state = 6;
				return true;
			case 6:
				<>1__state = -1;
				<statusText>5__14.text = "It's super effective!";
				<>2__current = (object)new WaitForSeconds(2f);
				<>1__state = 7;
				return true;
			case 7:
				<>1__state = -1;
				<move2>5__16 = <>4__this.funnyMoves[Random.Range(0, <>4__this.funnyMoves.Length)];
				<statusText>5__14.text = "Wild " + <p2>5__2.playerName + " used " + <move2>5__16 + "!";
				<>2__current = (object)new WaitForSeconds(1f);
				<>1__state = 8;
				return true;
			case 8:
				<>1__state = -1;
				((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.ShakeUI(<playerHUD>5__11));
				if ((Object)(object)<>4__this.hitSoundClip != (Object)null)
				{
					<sfxSource>5__5.PlayOneShot(<>4__this.hitSoundClip);
				}
				<>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.AnimateHP(<playerHP>5__13, 1f, 0.3f));
				<>1__state = 9;
				return true;
			case 9:
				<>1__state = -1;
				<statusText>5__14.text = <p1>5__1.playerName + " took emotional damage!";
				<>2__current = (object)new WaitForSeconds(2f);
				<>1__state = 10;
				return true;
			case 10:
				<>1__state = -1;
				<move3>5__17 = <>4__this.funnyMoves[Random.Range(0, <>4__this.funnyMoves.Length)];
				<statusText>5__14.text = <p1>5__1.playerName + " used " + <move3>5__17 + "!";
				<>2__current = (object)new WaitForSeconds(1.5f);
				<>1__state = 11;
				return true;
			case 11:
				<>1__state = -1;
				<statusText>5__14.text = "But it missed!";
				<>2__current = (object)new WaitForSeconds(1.5f);
				<>1__state = 12;
				return true;
			case 12:
				<>1__state = -1;
				<finisherMove>5__18 = ((winnerID == attackerID) ? "BAN HAMMER" : "CURSE OF RA");
				<winner>5__19 = ((winnerID == attackerID) ? <p1>5__1 : <p2>5__2);
				<loser>5__20 = ((winnerID == attackerID) ? <p2>5__2 : <p1>5__1);
				<loserHPBar>5__21 = ((winnerID == attackerID) ? <enemyHP>5__12 : <playerHP>5__13);
				<loserRect>5__22 = ((winnerID == attackerID) ? <enemyHUD>5__10 : <playerHUD>5__11);
				<statusText>5__14.text = <winner>5__19.playerName + " used " + <finisherMove>5__18 + "!";
				<>2__current = (object)new WaitForSeconds(1f);
				<>1__state = 13;
				return true;
			case 13:
				<>1__state = -1;
				((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.ShakeUI(<loserRect>5__22, 25f, 0.8f));
				if ((Object)(object)<>4__this.hitSoundClip != (Object)null)
				{
					<sfxSource>5__5.PlayOneShot(<>4__this.hitSoundClip);
				}
				<currentFill>5__23 = <loserHPBar>5__21.fillAmount;
				<>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.AnimateHP(<loserHPBar>5__21, <currentFill>5__23, 0f));
				<>1__state = 14;
				return true;
			case 14:
				<>1__state = -1;
				<statusText>5__14.text = "Critical hit!";
				<>2__current = (object)new WaitForSeconds(1f);
				<>1__state = 15;
				return true;
			case 15:
				<>1__state = -1;
				<statusText>5__14.text = <loser>5__20.playerName + " fainted!";
				<>2__current = (object)new WaitForSeconds(2f);
				<>1__state = 16;
				return true;
			case 16:
				<>1__state = -1;
				if (<loser>5__20.photonView.IsMine)
				{
					<loser>5__20.playerHealth.Hurt(9999, false, -1);
				}
				<statusText>5__14.text = <winner>5__19.playerName + " wins!";
				<>2__current = (object)new WaitForSeconds(3f);
				<>1__state = 17;
				return true;
			case 17:
				{
					<>1__state = -1;
					Object.Destroy((Object)(object)<canvasObj>5__6);
					Object.Destroy((Object)(object)<audioObj>5__3);
					<>4__this.isBattling = false;
					return false;
				}
				IL_0373:
				if (<i>5__24 < 6)
				{
					<flashObj>5__9.SetActive(!<flashObj>5__9.activeSelf);
					<>2__current = (object)new WaitForSeconds(0.08f);
					<>1__state = 2;
					return true;
				}
				Object.Destroy((Object)(object)<flashObj>5__9);
				<>4__this.CreateSolidPanel(<canvasObj>5__6, new Color(0.05f, 0.05f, 0.05f, 0.4f));
				<enemyHUD>5__10 = <>4__this.CreatePrettyStatBlock(<canvasObj>5__6, <p2>5__2.playerName, new Vector2(0.05f, 0.75f), isPlayer: false);
				<playerHUD>5__11 = <>4__this.CreatePrettyStatBlock(<canvasObj>5__6, <p1>5__1.playerName, new Vector2(0.65f, 0.3f), isPlayer: true);
				<enemyHP>5__12 = ((Component)((Transform)<enemyHUD>5__10).Find("HPBar/Fill")).GetComponent<Image>();
				<playerHP>5__13 = ((Component)((Transform)<playerHUD>5__11).Find("HPBar/Fill")).GetComponent<Image>();
				<statusText>5__14 = <>4__this.CreatePrettyTextBox(<canvasObj>5__6);
				<statusText>5__14.text = "A wild " + <p2>5__2.playerName + " appeared!";
				<>2__current = (object)new WaitForSeconds(2.5f);
				<>1__state = 3;
				return true;
			}
		}

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

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

	[CompilerGenerated]
	private sealed class <LoadMusic>d__9 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public PokemonBattleItem <>4__this;

		private string <folderPath>5__1;

		private string <musicPath>5__2;

		private UnityWebRequest <www>5__3;

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

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

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

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			int num = <>1__state;
			if (num == -3 || num == 1)
			{
				try
				{
				}
				finally
				{
					<>m__Finally1();
				}
			}
			<folderPath>5__1 = null;
			<musicPath>5__2 = null;
			<www>5__3 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Invalid comparison between Unknown and I4
			try
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<folderPath>5__1 = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
					<musicPath>5__2 = Path.Combine(<folderPath>5__1, "battle.ogg");
					if (!<musicPath>5__2.StartsWith("file://"))
					{
						<musicPath>5__2 = "file://" + <musicPath>5__2;
					}
					<www>5__3 = UnityWebRequestMultimedia.GetAudioClip(<musicPath>5__2, (AudioType)14);
					<>1__state = -3;
					<>2__current = <www>5__3.SendWebRequest();
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -3;
					if ((int)<www>5__3.result == 1)
					{
						<>4__this.battleMusicClip = DownloadHandlerAudioClip.GetContent(<www>5__3);
					}
					<>m__Finally1();
					<www>5__3 = null;
					return false;
				}
			}
			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;
			if (<www>5__3 != null)
			{
				((IDisposable)<www>5__3).Dispose();
			}
		}

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

	[CompilerGenerated]
	private sealed class <ShakeUI>d__19 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public RectTransform uiElement;

		public float intensity;

		public float duration;

		public PokemonBattleItem <>4__this;

		private Vector2 <originalPos>5__1;

		private float <t>5__2;

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

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

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

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//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)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<originalPos>5__1 = uiElement.anchoredPosition;
				<t>5__2 = 0f;
				break;
			case 1:
				<>1__state = -1;
				break;
			}
			if (<t>5__2 < duration)
			{
				<t>5__2 += Time.deltaTime;
				uiElement.anchoredPosition = <originalPos>5__1 + Random.insideUnitCircle * intensity;
				<>2__current = null;
				<>1__state = 1;
				return true;
			}
			uiElement.anchoredPosition = <originalPos>5__1;
			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 PhysGrabObject physGrabObject;

	public PhotonView photonView;

	private bool isBattling = false;

	private AudioClip battleMusicClip;

	private AudioClip hitSoundClip;

	private string[] funnyMoves = new string[157]
	{
		"BOCON'S BACON", "THE FULL BOCON", "BOCON'S WIFI", "BOCON'S AIM", "CLASSIC BOCON", "BOCONATOR", "BOCON'S WAIFU", "BOCON'S SEARCH HISTORY", "BOCON'S HAIRLINE", "BOCON'S MIXTAPE",
		"BOCON'S COOKING", "TOUCH GRASS", "SKILL ISSUE", "RATIO", "YEET", "L + RATIO", "EMOTIONAL DAMAGE", "LAG SPIKE", "DDOS ATTACK", "DEV TEXTURE",
		"GASLIGHT", "GATEKEEP", "GIRLBOSS", "CTRL+ALT+DEL", "BLUE SCREEN", "INTERNET ARGUMENT", "MAIN CHARACTER SYNDROME", "CRINGE COMPILATION", "OK BOOMER", "ZOOMER HUMOR",
		"VIBE CHECK", "NO U", "REVERSE CARD", "DEEZ NUTS", "GIGACHAD STARE", "OMEGALUL", "POGCHAMP", "WEIRD FLEX", "THAT'S CAP", "DOWN BAD",
		"CAUGHT IN 4K", "RENT FREE", "NPC ENERGY", "DISCORD MOD", "REDDIT KARMA", "TWITTER THREAD", "COPIUM OVERDOSE", "KISSY KISS", "AGGRESSIVE HUG", "HEADPAT",
		"BOOP THE SNOOT", "UWU VOICE", "ARARA", "SENPAI NOTICE ME", "HAND HOLDING", "BLOW A KISS", "WINKY FACE", "TICKLE ATTACK", "FRIENDSHIP", "CARE BEAR STARE",
		"LOVE LETTER", "PUPPY EYES", "HIGH FIVE", "WET WILLY", "POCKET SAND", "YOUR MOM", "WHO ASKED", "IGNORED DM", "LEFT ON READ", "BLOCK BUTTON",
		"UNSUBSCRIBE", "REPORTED", "DISLIKE BUTTON", "RATIO ATTEMPT", "MUTE MIC", "TEABAG", "SPIT TAKE", "ANKLE BREAKER", "YO MAMA JOKE", "SPAGHETTI CODE",
		"NULL REFERENCE", "SEGFAULT", "MEMORY LEAK", "GIT PUSH --FORCE", "DELETE SYSTEM32", "ALT + F4", "UNITY CRASH", "INFINITE LOOP", "DIVIDE BY ZERO", "404 NOT FOUND",
		"CORRUPTED FILE", "DOWNLOAD RAM", "IP LEAK", "PING 999", "PACKET LOSS", "TAX EVASION", "ARSON", "VEHICULAR MANSLAUGHTER", "JAYWALKING", "MICROCLAVICLE",
		"TOE STUB", "STEP ON LEGO", "PAPER CUT", "BRAIN FREEZE", "PIZZA CRUST", "UNSEASONED CHICKEN", "MAYONNAISE", "BEES?", "NOT THE BEES", "SHARKNADO",
		"FLORIDA MAN", "A KNIFE", "JUST A GUN", "EXISTENTIAL DREAD", "MIDLIFE CRISIS", "STUDENT DEBT", "EXPIRED COUPON", "MANAGER SUMMON", "KAREN SCREAM", "CHAIR THROW",
		"TABLE FLIP", "WATER GUN", "NERF DART", "SOCK WITH SANDAL", "CROC MODE: SPORT", "T-POSE", "ASSERT DOMINANCE", "ROLL NAT 1", "RAGE QUIT", "CONTROLLER DISCONNECT",
		"SCREEN CHEAT", "CAMPING", "SPAWN KILL", "AÏM ASSIST", "WALL HACK", "BAN HAMMER", "VAC BAN", "SMURF ACCOUNT", "BRONZE ELO", "HARD STUCK",
		"EZ CLAP", "GG EZ", "DIFF", "JUNGLE DIFF", "HEALER DIFF", "FORGOT WALLET", "DECLINED CARD", "EVICTION NOTICE", "JURY DUTY", "DMV LINE",
		"TRAFFIC JAM", "WET SOCKS", "BAD HAIRCUT", "PUBLIC SPEAKING", "ALARM CLOCK", "MONDAY MORNING", "COLD COFFEE"
	};

	private void Awake()
	{
		if ((Object)(object)physGrabObject == (Object)null)
		{
			physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
		}
		if ((Object)(object)photonView == (Object)null)
		{
			photonView = ((Component)this).GetComponent<PhotonView>();
		}
	}

	private void Start()
	{
		((MonoBehaviour)this).StartCoroutine(LoadMusic());
		GenerateHitSound();
	}

	private void GenerateHitSound()
	{
		hitSoundClip = AudioClip.Create("RetroHit", 11025, 1, 44100, false);
		float[] array = new float[11025];
		for (int i = 0; i < array.Length; i++)
		{
			array[i] = Random.Range(-0.6f, 0.6f);
			if (i > array.Length - 2000)
			{
				array[i] *= 0.5f;
			}
		}
		hitSoundClip.SetData(array, 0);
	}

	[IteratorStateMachine(typeof(<LoadMusic>d__9))]
	private IEnumerator LoadMusic()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <LoadMusic>d__9(0)
		{
			<>4__this = this
		};
	}

	private void Update()
	{
		if (!isBattling && !((Object)(object)photonView == (Object)null) && photonView.IsMine && physGrabObject.playerGrabbing.Count > 0)
		{
			PhysGrabber val = physGrabObject.playerGrabbing[0];
			PlayerAvatar componentInParent = ((Component)val).GetComponentInParent<PlayerAvatar>();
			if ((Object)(object)componentInParent != (Object)null)
			{
				AttemptStartBattle(componentInParent);
			}
		}
	}

	private void AttemptStartBattle(PlayerAvatar attacker)
	{
		List<PlayerAvatar> list = SemiFunc.PlayerGetList();
		List<PlayerAvatar> list2 = new List<PlayerAvatar>();
		foreach (PlayerAvatar item in list)
		{
			if ((Object)(object)item != (Object)(object)attacker && item.playerHealth.health > 0)
			{
				list2.Add(item);
			}
		}
		if (list2.Count > 0)
		{
			PlayerAvatar val = list2[Random.Range(0, list2.Count)];
			int viewID = attacker.photonView.ViewID;
			int viewID2 = val.photonView.ViewID;
			int num = ((Random.value > 0.5f) ? viewID : viewID2);
			photonView.RPC("RPC_StartBattle", (RpcTarget)0, new object[3] { viewID, viewID2, num });
		}
	}

	[PunRPC]
	public void RPC_StartBattle(int attackerID, int defenderID, int winnerID)
	{
		((MonoBehaviour)this).StartCoroutine(BattleSequence(attackerID, defenderID, winnerID));
	}

	[IteratorStateMachine(typeof(<BattleSequence>d__13))]
	private IEnumerator BattleSequence(int attackerID, int defenderID, int winnerID)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <BattleSequence>d__13(0)
		{
			<>4__this = this,
			attackerID = attackerID,
			defenderID = defenderID,
			winnerID = winnerID
		};
	}

	private GameObject CreateStyledPanel(GameObject parent, string name, Color bgColor, Color borderColor)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Expected O, but got Unknown
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: 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)
		GameObject val = new GameObject(name);
		val.transform.SetParent(parent.transform, false);
		Image val2 = val.AddComponent<Image>();
		((Graphic)val2).color = bgColor;
		Outline val3 = val.AddComponent<Outline>();
		((Shadow)val3).effectColor = borderColor;
		((Shadow)val3).effectDistance = new Vector2(3f, -3f);
		return val;
	}

	private GameObject CreateSolidPanel(GameObject parent, Color c)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_0027: 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_0045: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("SolidPanel");
		val.transform.SetParent(parent.transform, false);
		Image val2 = val.AddComponent<Image>();
		((Graphic)val2).color = c;
		((Graphic)val2).rectTransform.anchorMin = Vector2.zero;
		((Graphic)val2).rectTransform.anchorMax = Vector2.one;
		((Graphic)val2).raycastTarget = false;
		return val;
	}

	private Text CreatePrettyTextBox(GameObject canvas)
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: 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_0063: 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_0079: Expected O, but got Unknown
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: 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_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: 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_0153: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = CreateStyledPanel(canvas, "TextBox", new Color(0.1f, 0.1f, 0.15f, 0.95f), new Color(0.9f, 0.9f, 0.9f));
		RectTransform component = val.GetComponent<RectTransform>();
		component.anchorMin = new Vector2(0.05f, 0.05f);
		component.anchorMax = new Vector2(0.95f, 0.25f);
		GameObject val2 = new GameObject("Text");
		val2.transform.SetParent(val.transform, false);
		Text val3 = val2.AddComponent<Text>();
		val3.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
		val3.fontSize = 36;
		val3.fontStyle = (FontStyle)1;
		((Graphic)val3).color = Color.white;
		val3.alignment = (TextAnchor)0;
		Shadow val4 = ((Component)val3).gameObject.AddComponent<Shadow>();
		val4.effectDistance = new Vector2(2f, -2f);
		val4.effectColor = new Color(0f, 0f, 0f, 0.8f);
		RectTransform rectTransform = ((Graphic)val3).rectTransform;
		rectTransform.anchorMin = Vector2.zero;
		rectTransform.anchorMax = Vector2.one;
		rectTransform.offsetMin = new Vector2(20f, 20f);
		rectTransform.offsetMax = new Vector2(-20f, -20f);
		return val3;
	}

	private RectTransform CreatePrettyStatBlock(GameObject canvas, string name, Vector2 anchorPos, bool isPlayer)
	{
		//IL_0022: 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)
		//IL_003a: 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_004d: 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)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Expected O, but got Unknown
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: 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_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: 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_0149: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: Expected O, but got Unknown
		//IL_017e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_01da: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0208: Unknown result type (might be due to invalid IL or missing references)
		//IL_021f: Unknown result type (might be due to invalid IL or missing references)
		//IL_022f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0236: Expected O, but got Unknown
		//IL_0265: Unknown result type (might be due to invalid IL or missing references)
		//IL_027b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0288: Unknown result type (might be due to invalid IL or missing references)
		//IL_029f: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = CreateStyledPanel(canvas, name + "_HUD", new Color(0.1f, 0.1f, 0.12f, 0.9f), Color.white);
		RectTransform component = val.GetComponent<RectTransform>();
		component.anchorMin = anchorPos;
		component.anchorMax = anchorPos + new Vector2(0.3f, 0.12f);
		GameObject val2 = new GameObject("Name");
		val2.transform.SetParent(val.transform, false);
		Text val3 = val2.AddComponent<Text>();
		val3.text = name;
		val3.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
		val3.fontSize = 28;
		val3.fontStyle = (FontStyle)1;
		((Graphic)val3).color = Color.white;
		val3.alignment = (TextAnchor)3;
		((Component)val3).gameObject.AddComponent<Shadow>().effectDistance = new Vector2(2f, -2f);
		RectTransform rectTransform = ((Graphic)val3).rectTransform;
		rectTransform.anchorMin = new Vector2(0f, 0.5f);
		rectTransform.anchorMax = new Vector2(1f, 1f);
		rectTransform.offsetMin = new Vector2(15f, 0f);
		rectTransform.offsetMax = new Vector2(-5f, 0f);
		GameObject val4 = new GameObject("HPBar");
		val4.transform.SetParent(val.transform, false);
		Image val5 = val4.AddComponent<Image>();
		((Graphic)val5).color = new Color(0.2f, 0.2f, 0.2f);
		Outline val6 = val4.AddComponent<Outline>();
		((Shadow)val6).effectColor = new Color(0.5f, 0.5f, 0.5f);
		((Shadow)val6).effectDistance = new Vector2(1f, -1f);
		RectTransform component2 = val4.GetComponent<RectTransform>();
		component2.anchorMin = new Vector2(0f, 0.1f);
		component2.anchorMax = new Vector2(1f, 0.45f);
		component2.offsetMin = new Vector2(15f, 0f);
		component2.offsetMax = new Vector2(-15f, 0f);
		GameObject val7 = new GameObject("Fill");
		val7.transform.SetParent(val4.transform, false);
		Image val8 = val7.AddComponent<Image>();
		((Graphic)val8).color = new Color(0.1f, 0.9f, 0.4f);
		RectTransform component3 = val7.GetComponent<RectTransform>();
		component3.anchorMin = Vector2.zero;
		component3.anchorMax = Vector2.one;
		component3.pivot = new Vector2(0f, 0.5f);
		component3.offsetMin = new Vector2(2f, 2f);
		component3.offsetMax = new Vector2(-2f, -2f);
		val8.type = (Type)3;
		val8.fillMethod = (FillMethod)0;
		val8.fillOrigin = 0;
		return component;
	}

	[IteratorStateMachine(typeof(<AnimateHP>d__18))]
	private IEnumerator AnimateHP(Image hpBar, float startPct, float endPct)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <AnimateHP>d__18(0)
		{
			<>4__this = this,
			hpBar = hpBar,
			startPct = startPct,
			endPct = endPct
		};
	}

	[IteratorStateMachine(typeof(<ShakeUI>d__19))]
	private IEnumerator ShakeUI(RectTransform uiElement, float intensity = 8f, float duration = 0.5f)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <ShakeUI>d__19(0)
		{
			<>4__this = this,
			uiElement = uiElement,
			intensity = intensity,
			duration = duration
		};
	}
}
namespace PokemonBattleMod
{
	[BepInPlugin("user.pokemon.battle", "Pokemon Battle Mod", "1.0.0")]
	public class PokemonBattlePlugin : BaseUnityPlugin
	{
		public static PokemonBattlePlugin Instance;

		private void Awake()
		{
			Instance = this;
		}
	}
}