Decompiled source of TungstenBalls v1.0.5

BepInEx/plugins/TungstenBalls/TungstenBalls.dll

Decompiled 3 weeks 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.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BlackMagicAPI.Enums;
using BlackMagicAPI.Managers;
using BlackMagicAPI.Modules.Spells;
using FishNet.Object;
using Steamworks;
using UnityEngine;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("TungstenBalls")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TungstenBalls")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("70af21c4-baa6-4349-9d5a-75aea5a13a7b")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace TungstenBalls;

public static class PluginInfo
{
	public const string PLUGIN_GUID = "com.magearena.tungstenballs";
}
[BepInPlugin("com.magearena.tungstenballs", "Tungsten Balls", "1.0.4")]
[BepInProcess("MageArena.exe")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class TungstenBalls : BaseUnityPlugin
{
	public static string modsync = "all";

	private static AssetBundle tungstenBallsBundle = null;

	public static AudioClip dongSound = null;

	private void Awake()
	{
		BlackMagicManager.RegisterDeathIcon((BaseUnityPlugin)(object)this, "Tungsten Balls", "death_icon.png");
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin com.magearena.tungstenballs is loaded!");
		BlackMagicManager.RegisterSpell((BaseUnityPlugin)(object)this, typeof(TungstenBallsSpellData), typeof(TungstenBallsSpellLogic));
		LoadTungstenBallsAssets();
	}

	private void LoadTungstenBallsAssets()
	{
		try
		{
			string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			string text = Path.Combine(directoryName, "Assets", "tungstenballls");
			if (File.Exists(text))
			{
				tungstenBallsBundle = AssetBundle.LoadFromFile(text);
				if ((Object)(object)tungstenBallsBundle != (Object)null)
				{
					dongSound = tungstenBallsBundle.LoadAsset<AudioClip>("dong");
					if ((Object)(object)dongSound == (Object)null)
					{
						Debug.LogWarning((object)"[TungstenBalls] Could not find 'dong' audio clip in AssetBundle");
					}
				}
				else
				{
					Debug.LogError((object)"[TungstenBalls] Failed to load AssetBundle");
				}
			}
			else
			{
				Debug.LogError((object)("[TungstenBalls] AssetBundle file does not exist at path: " + text));
			}
		}
		catch (Exception ex)
		{
			Debug.LogError((object)("[TungstenBalls] Error loading AssetBundle: " + ex.Message));
		}
	}
}
internal class TungstenBallsSpellData : SpellData
{
	public override SpellType SpellType => (SpellType)0;

	public override string Name => "Tungsten Balls";

	public override float Cooldown => 20f;

	public override Color GlowColor => new Color(0.8f, 0.6f, 0.5f);
}
internal class TungstenBallsSpellLogic : SpellLogic
{
	[CompilerGenerated]
	private sealed class <SubtractTungstenBallsDebuff>d__4 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public float duration;

		private FieldInfo <stewspeedboostField>5__1;

		private PlayerMovement[] <allPlayers>5__2;

		private PlayerMovement[] <>s__3;

		private int <>s__4;

		private PlayerMovement <player>5__5;

		private float <currentValue>5__6;

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

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

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

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<stewspeedboostField>5__1 = null;
			<allPlayers>5__2 = null;
			<>s__3 = null;
			<player>5__5 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(duration);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<stewspeedboostField>5__1 = typeof(PlayerMovement).GetField("stewspeedboost", BindingFlags.Instance | BindingFlags.NonPublic);
				if (<stewspeedboostField>5__1 != null)
				{
					<allPlayers>5__2 = Object.FindObjectsByType<PlayerMovement>((FindObjectsSortMode)0);
					<>s__3 = <allPlayers>5__2;
					for (<>s__4 = 0; <>s__4 < <>s__3.Length; <>s__4++)
					{
						<player>5__5 = <>s__3[<>s__4];
						if (((NetworkBehaviour)<player>5__5).IsOwner)
						{
							<currentValue>5__6 = (float)<stewspeedboostField>5__1.GetValue(<player>5__5);
							<stewspeedboostField>5__1.SetValue(<player>5__5, <currentValue>5__6 + 2f);
							break;
						}
						<player>5__5 = null;
					}
					<>s__3 = null;
					<allPlayers>5__2 = null;
				}
				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 <TungstenBallsFallEffect>d__2 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public PlayerMovement targetMovement;

		private bool <originalCanMove>5__1;

		private bool <originalCanMoveCamera>5__2;

		private bool <originalEnabled>5__3;

		private GameObject <playerRoot>5__4;

		private Transform <wizardTrio>5__5;

		private ShadowCastingMode[] <originalShadowModes>5__6;

		private SkinnedMeshRenderer[] <playerRenderers>5__7;

		private Transform <armz>5__8;

		private Transform <pikupact>5__9;

		private bool <armzWasActive>5__10;

		private bool <pikupactWasActive>5__11;

		private int <i>5__12;

		private Camera <mainCamera>5__13;

		private Transform <originalCameraParent>5__14;

		private Vector3 <originalCameraPosition>5__15;

		private Quaternion <originalCameraRotation>5__16;

		private Transform <spectatePoint>5__17;

		private float <yaw>5__18;

		private float <pitch>5__19;

		private float <sensitivity>5__20;

		private float <distance>5__21;

		private float <minDistance>5__22;

		private float <maxDistance>5__23;

		private float <effectDuration>5__24;

		private float <elapsedTime>5__25;

		private float <mouseX>5__26;

		private float <mouseY>5__27;

		private float <scroll>5__28;

		private Vector3 <targetPosition>5__29;

		private float <yawRad>5__30;

		private float <pitchRad>5__31;

		private float <horizontalDistance>5__32;

		private Vector3 <offset>5__33;

		private MethodInfo <undoFrogRpcMethod>5__34;

		private int <i>5__35;

		private FieldInfo <stewspeedboostField>5__36;

		private float <currentValue>5__37;

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

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

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

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<playerRoot>5__4 = null;
			<wizardTrio>5__5 = null;
			<originalShadowModes>5__6 = null;
			<playerRenderers>5__7 = null;
			<armz>5__8 = null;
			<pikupact>5__9 = null;
			<mainCamera>5__13 = null;
			<originalCameraParent>5__14 = null;
			<spectatePoint>5__17 = null;
			<undoFrogRpcMethod>5__34 = null;
			<stewspeedboostField>5__36 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Expected O, but got Unknown
			//IL_059e: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_046c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0471: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0505: Unknown result type (might be due to invalid IL or missing references)
			//IL_050a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0521: Unknown result type (might be due to invalid IL or missing references)
			//IL_05df: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e9: Expected O, but got Unknown
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Expected I4, but got Unknown
			//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<originalCanMove>5__1 = targetMovement.canMove;
				<originalCanMoveCamera>5__2 = targetMovement.canMoveCamera;
				<originalEnabled>5__3 = ((Behaviour)targetMovement).enabled;
				targetMovement.canMove = false;
				targetMovement.canMoveCamera = false;
				PlayTungstenBallsSound(((Component)targetMovement).transform.position);
				<>2__current = (object)new WaitForSeconds(0.5f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				targetMovement.NonRpcDamagePlayer(10f, (GameObject)null, "tungstenballs");
				<playerRoot>5__4 = ((Component)targetMovement).gameObject;
				<wizardTrio>5__5 = <playerRoot>5__4.transform.Find("wizardtrio");
				<originalShadowModes>5__6 = null;
				<playerRenderers>5__7 = null;
				if ((Object)(object)<wizardTrio>5__5 != (Object)null)
				{
					<playerRenderers>5__7 = ((Component)<wizardTrio>5__5).GetComponentsInChildren<SkinnedMeshRenderer>();
					if (<playerRenderers>5__7.Length != 0)
					{
						<originalShadowModes>5__6 = (ShadowCastingMode[])(object)new ShadowCastingMode[<playerRenderers>5__7.Length];
						<i>5__12 = 0;
						while (<i>5__12 < <playerRenderers>5__7.Length)
						{
							<originalShadowModes>5__6[<i>5__12] = (ShadowCastingMode)(int)((Renderer)<playerRenderers>5__7[<i>5__12]).shadowCastingMode;
							((Renderer)<playerRenderers>5__7[<i>5__12]).shadowCastingMode = (ShadowCastingMode)1;
							<i>5__12++;
						}
					}
				}
				<armz>5__8 = <playerRoot>5__4.transform.Find("armz");
				<pikupact>5__9 = <playerRoot>5__4.transform.Find("pikupact");
				<armzWasActive>5__10 = false;
				<pikupactWasActive>5__11 = false;
				if ((Object)(object)<armz>5__8 != (Object)null)
				{
					<armzWasActive>5__10 = ((Component)<armz>5__8).gameObject.activeSelf;
					((Component)<armz>5__8).gameObject.SetActive(false);
				}
				if ((Object)(object)<pikupact>5__9 != (Object)null)
				{
					<pikupactWasActive>5__11 = ((Component)<pikupact>5__9).gameObject.activeSelf;
					((Component)<pikupact>5__9).gameObject.SetActive(false);
				}
				if (((NetworkBehaviour)targetMovement).IsOwner)
				{
					<mainCamera>5__13 = Camera.main;
					if ((Object)(object)<mainCamera>5__13 == (Object)null)
					{
						Debug.LogError((object)"[TungstenBalls] Could not find main camera");
						return false;
					}
					<originalCameraParent>5__14 = ((Component)<mainCamera>5__13).transform.parent;
					<originalCameraPosition>5__15 = ((Component)<mainCamera>5__13).transform.position;
					<originalCameraRotation>5__16 = ((Component)<mainCamera>5__13).transform.rotation;
					<spectatePoint>5__17 = targetMovement.SpectatePoint;
					if ((Object)(object)<spectatePoint>5__17 == (Object)null)
					{
						<spectatePoint>5__17 = ((Component)targetMovement).transform;
					}
					<yaw>5__18 = 0f;
					<pitch>5__19 = 0f;
					<sensitivity>5__20 = 2f;
					<distance>5__21 = 5f;
					<minDistance>5__22 = 2f;
					<maxDistance>5__23 = 15f;
					Cursor.lockState = (CursorLockMode)1;
					Cursor.visible = false;
					<effectDuration>5__24 = 5f;
					<elapsedTime>5__25 = 0f;
					goto IL_0556;
				}
				<>2__current = (object)new WaitForSeconds(5f);
				<>1__state = 3;
				return true;
			case 2:
				<>1__state = -1;
				goto IL_0556;
			case 3:
				{
					<>1__state = -1;
					break;
				}
				IL_0556:
				if (<elapsedTime>5__25 < <effectDuration>5__24 && !targetMovement.isDead)
				{
					<mouseX>5__26 = Input.GetAxis("Mouse X") * <sensitivity>5__20;
					<mouseY>5__27 = Input.GetAxis("Mouse Y") * <sensitivity>5__20;
					<yaw>5__18 += <mouseX>5__26;
					<pitch>5__19 -= <mouseY>5__27;
					<pitch>5__19 = Mathf.Clamp(<pitch>5__19, -80f, 80f);
					<scroll>5__28 = Input.GetAxis("Mouse ScrollWheel");
					<distance>5__21 -= <scroll>5__28 * 5f;
					<distance>5__21 = Mathf.Clamp(<distance>5__21, <minDistance>5__22, <maxDistance>5__23);
					<targetPosition>5__29 = <spectatePoint>5__17.position;
					<yawRad>5__30 = <yaw>5__18 * ((float)Math.PI / 180f);
					<pitchRad>5__31 = <pitch>5__19 * ((float)Math.PI / 180f);
					<horizontalDistance>5__32 = <distance>5__21 * Mathf.Cos(<pitchRad>5__31);
					<offset>5__33 = new Vector3(Mathf.Sin(<yawRad>5__30) * <horizontalDistance>5__32, <distance>5__21 * Mathf.Sin(<pitchRad>5__31), Mathf.Cos(<yawRad>5__30) * <horizontalDistance>5__32);
					((Component)<mainCamera>5__13).transform.position = <targetPosition>5__29 + <offset>5__33;
					((Component)<mainCamera>5__13).transform.LookAt(<targetPosition>5__29);
					<elapsedTime>5__25 += Time.deltaTime;
					<>2__current = null;
					<>1__state = 2;
					return true;
				}
				Cursor.lockState = (CursorLockMode)1;
				Cursor.visible = false;
				((Component)<mainCamera>5__13).transform.parent = <originalCameraParent>5__14;
				((Component)<mainCamera>5__13).transform.position = <originalCameraPosition>5__15;
				((Component)<mainCamera>5__13).transform.rotation = <originalCameraRotation>5__16;
				<mainCamera>5__13 = null;
				<originalCameraParent>5__14 = null;
				<spectatePoint>5__17 = null;
				break;
			}
			if (!targetMovement.isDead)
			{
				if (<playerRenderers>5__7 != null && <originalShadowModes>5__6 != null)
				{
					<i>5__35 = 0;
					while (<i>5__35 < <playerRenderers>5__7.Length && <i>5__35 < <originalShadowModes>5__6.Length)
					{
						((Renderer)<playerRenderers>5__7[<i>5__35]).shadowCastingMode = <originalShadowModes>5__6[<i>5__35];
						<i>5__35++;
					}
				}
				if (((Object)(object)<armz>5__8 != (Object)null) & <armzWasActive>5__10)
				{
					((Component)<armz>5__8).gameObject.SetActive(true);
				}
				if (((Object)(object)<pikupact>5__9 != (Object)null) & <pikupactWasActive>5__11)
				{
					((Component)<pikupact>5__9).gameObject.SetActive(true);
				}
				targetMovement.canMove = <originalCanMove>5__1;
				targetMovement.canMoveCamera = <originalCanMoveCamera>5__2;
				((Behaviour)targetMovement).enabled = <originalEnabled>5__3;
				if (((NetworkBehaviour)targetMovement).IsOwner)
				{
					<stewspeedboostField>5__36 = typeof(PlayerMovement).GetField("stewspeedboost", BindingFlags.Instance | BindingFlags.NonPublic);
					if (<stewspeedboostField>5__36 != null)
					{
						<currentValue>5__37 = (float)<stewspeedboostField>5__36.GetValue(targetMovement);
						<stewspeedboostField>5__36.SetValue(targetMovement, <currentValue>5__37 - 2f);
					}
					((MonoBehaviour)targetMovement).StartCoroutine(SubtractTungstenBallsDebuff(3f));
					<stewspeedboostField>5__36 = null;
				}
				<undoFrogRpcMethod>5__34 = typeof(PlayerMovement).GetMethod("UndoFrogRpc", BindingFlags.Instance | BindingFlags.NonPublic);
				if (<undoFrogRpcMethod>5__34 != null)
				{
					<undoFrogRpcMethod>5__34.Invoke(targetMovement, null);
				}
				<undoFrogRpcMethod>5__34 = null;
			}
			if (affectedPlayers.ContainsKey(targetMovement))
			{
				affectedPlayers[targetMovement] = false;
			}
			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 Dictionary<PlayerMovement, bool> affectedPlayers = new Dictionary<PlayerMovement, bool>();

	public override void CastSpell(GameObject playerObj, PageController page, Vector3 spawnPos, Vector3 viewDirectionVector, int castingLevel)
	{
		//IL_0026: 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_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_014d: Unknown result type (might be due to invalid IL or missing references)
		//IL_014e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0158: Unknown result type (might be due to invalid IL or missing references)
		//IL_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0162: Unknown result type (might be due to invalid IL or missing references)
		//IL_016b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_017a: Unknown result type (might be due to invalid IL or missing references)
		//IL_017f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0184: Unknown result type (might be due to invalid IL or missing references)
		//IL_0186: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Unknown result type (might be due to invalid IL or missing references)
		//IL_018a: Unknown result type (might be due to invalid IL or missing references)
		//IL_018f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0193: Unknown result type (might be due to invalid IL or missing references)
		//IL_0198: Unknown result type (might be due to invalid IL or missing references)
		//IL_019a: Unknown result type (might be due to invalid IL or missing references)
		//IL_019c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f7: 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_0289: Unknown result type (might be due to invalid IL or missing references)
		PlayerMovement component = playerObj.GetComponent<PlayerMovement>();
		if ((Object)(object)component == (Object)null)
		{
			return;
		}
		GameObject[] array = GameObject.FindGameObjectsWithTag("Player");
		Vector3 normalized = ((Vector3)(ref viewDirectionVector)).normalized;
		string personaName = SteamFriends.GetPersonaName();
		PlayerMovement val = null;
		PlayerMovement[] array2 = Object.FindObjectsByType<PlayerMovement>((FindObjectsSortMode)0);
		PlayerMovement[] array3 = array2;
		foreach (PlayerMovement val2 in array3)
		{
			if (val2.playername == personaName)
			{
				val = val2;
				break;
			}
		}
		GameObject val3 = null;
		float num = float.MaxValue;
		PlayerMovement val4 = null;
		GameObject[] array4 = array;
		RaycastHit val10 = default(RaycastHit);
		foreach (GameObject val5 in array4)
		{
			if ((Object)(object)val5 == (Object)(object)playerObj)
			{
				continue;
			}
			Vector3 val6 = val5.transform.position - spawnPos;
			Vector3 normalized2 = ((Vector3)(ref val6)).normalized;
			float num2 = Vector3.Distance(spawnPos, val5.transform.position);
			if (!(num2 <= 30f))
			{
				continue;
			}
			float num3 = Vector3.Angle(normalized, normalized2);
			if (!(num3 <= 45f))
			{
				continue;
			}
			PlayerMovement component2 = val5.GetComponent<PlayerMovement>();
			if ((Object)(object)component2 != (Object)null && component.playerTeam == component2.playerTeam)
			{
				continue;
			}
			Vector3 val7 = spawnPos + Vector3.up * 1.5f;
			Vector3 val8 = val5.transform.position + Vector3.up * 1.5f;
			val6 = val8 - val7;
			Vector3 normalized3 = ((Vector3)(ref val6)).normalized;
			float num4 = Vector3.Distance(val7, val8);
			int num5 = ~(1 << LayerMask.NameToLayer("Player"));
			float[] array5 = new float[3] { -5f, 0f, 5f };
			bool flag = false;
			for (int k = 0; k < array5.Length; k++)
			{
				Vector3 val9 = Quaternion.Euler(0f, array5[k], 0f) * normalized3;
				if (!Physics.Raycast(val7, val9, ref val10, num4, num5))
				{
					flag = true;
					break;
				}
			}
			if (flag && (Object)(object)component2 != (Object)null && (!((Object)(object)val != (Object)null) || !((Object)(object)component2 == (Object)(object)val) || !affectedPlayers.ContainsKey(component2) || !affectedPlayers[component2]))
			{
				float num6 = Vector3.Angle(normalized, normalized2);
				float num7 = num6 * 2f + num2;
				if (num7 < num)
				{
					val3 = val5;
					num = num7;
					val4 = component2;
				}
			}
		}
		if ((Object)(object)val3 != (Object)null && (Object)(object)val4 != (Object)null)
		{
			affectedPlayers[val4] = true;
			MethodInfo method = typeof(PlayerMovement).GetMethod("FrogRpc", BindingFlags.Instance | BindingFlags.NonPublic);
			if (method != null)
			{
				method.Invoke(val4, null);
			}
			((MonoBehaviour)val4).StartCoroutine(TungstenBallsFallEffect(val4));
		}
	}

	[IteratorStateMachine(typeof(<TungstenBallsFallEffect>d__2))]
	public static IEnumerator TungstenBallsFallEffect(PlayerMovement targetMovement)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <TungstenBallsFallEffect>d__2(0)
		{
			targetMovement = targetMovement
		};
	}

	private static void PlayTungstenBallsSound(Vector3 position)
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Expected O, but got Unknown
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			if ((Object)(object)TungstenBalls.dongSound != (Object)null)
			{
				GameObject val = new GameObject("TungstenBallsAudio");
				val.transform.position = position;
				AudioSource val2 = val.AddComponent<AudioSource>();
				val2.clip = TungstenBalls.dongSound;
				val2.volume = 0.8f;
				val2.spatialBlend = 1f;
				val2.rolloffMode = (AudioRolloffMode)1;
				val2.minDistance = 5f;
				val2.maxDistance = 50f;
				val2.Play();
				float num = TungstenBalls.dongSound.length + 0.1f;
				Object.Destroy((Object)(object)val, num);
			}
		}
		catch (Exception ex)
		{
			Debug.LogError((object)("[TungstenBalls] Error playing sound: " + ex.Message));
		}
	}

	[IteratorStateMachine(typeof(<SubtractTungstenBallsDebuff>d__4))]
	private static IEnumerator SubtractTungstenBallsDebuff(float duration)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <SubtractTungstenBallsDebuff>d__4(0)
		{
			duration = duration
		};
	}
}