Decompiled source of Furibrosa v1.1.0

UMM/BroMaker_Storage/Furibrosa/Furibrosa.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using BroMakerLib;
using BroMakerLib.CustomObjects.Bros;
using BroMakerLib.Loggers;
using Effects;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using RocketLib;
using RocketLib.CustomTriggers;
using Rogueforce;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Furibrosa")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Furibrosa")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f637a9e4-6c18-40e6-834a-0a75c00103c5")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 Furibrosa
{
	public class Bolt : PredabroSpear
	{
		public SpriteSM sprite;

		public bool explosive;

		public float explosiveTimer;

		public float range = 48f;

		public AudioClip[] explosionSounds;

		protected bool isStuckToUnit;

		protected Unit stuckToUnit;

		protected override void Awake()
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Expected O, but got Unknown
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			((Projectile)this).canMakeEffectsMoreThanOnce = true;
			((BrocheteMachete)this).stunOnHit = false;
			((Projectile)this).groundLayer = LayerMask.op_Implicit((1 << LayerMask.NameToLayer("Ground")) | (1 << LayerMask.NameToLayer("LargeObjects")) | (1 << LayerMask.NameToLayer("FLUI")));
			((Projectile)this).barrierLayer = LayerMask.op_Implicit((1 << LayerMask.NameToLayer("MobileBarriers")) | (1 << LayerMask.NameToLayer("IndestructibleGround")));
			((Projectile)this).friendlyBarrierLayer = LayerMask.op_Implicit(1 << LayerMask.NameToLayer("FriendlyBarriers"));
			((Projectile)this).fragileLayer = LayerMask.op_Implicit(1 << LayerMask.NameToLayer("DirtyHippie"));
			((Projectile)this).zOffset = (1f - Random.value * 2f) * 0.04f;
			((Projectile)this).random = new Randomf(Random.Range(0, 10000));
			if (explosive)
			{
				explosionSounds = (AudioClip[])(object)new AudioClip[2];
				explosionSounds[0] = ResourcesController.GetAudioClip(Path.Combine(directoryName, "sounds"), "explosion1.wav");
				explosionSounds[1] = ResourcesController.GetAudioClip(Path.Combine(directoryName, "sounds"), "explosion2.wav");
			}
		}

		private void OnDisable()
		{
			if (base.stuckInPlace)
			{
				((Projectile)this).Death();
			}
		}

		public void Setup(bool isExplosive)
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: 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_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Expected O, but got Unknown
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0397: Unknown result type (might be due to invalid IL or missing references)
			//IL_039c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
			MeshRenderer component = ((Component)this).gameObject.GetComponent<MeshRenderer>();
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			Material material = (((Renderer)component).material = ((!isExplosive) ? ResourcesController.GetMaterial(directoryName, "bolt.png") : ResourcesController.GetMaterial(directoryName, "boltExplosive.png")));
			sprite = ((Component)this).gameObject.GetComponent<SpriteSM>();
			sprite.lowerLeftPixel = new Vector2(-3f, 16f);
			sprite.pixelDimensions = new Vector2(17f, 16f);
			((SpriteBase)sprite).plane = (SPRITE_PLANE)0;
			((SpriteBase)sprite).width = 17f;
			((SpriteBase)sprite).height = 16f;
			((SpriteBase)sprite).offset = new Vector3(-10.5f, 0f, 10.82f);
			BoxCollider component2 = ((Component)this).gameObject.GetComponent<BoxCollider>();
			component2.center = new Vector3(0f, 0.5f, 8f);
			component2.size = new Vector3(26f, 2f, 0f);
			explosive = isExplosive;
			if (explosive)
			{
				base.groundLayersCrushLeft = 1;
				((BrocheteMachete)this).maxPenetrations = 2;
				((Projectile)this).life = 0.42f;
			}
			else
			{
				base.groundLayersCrushLeft = 1;
				((BrocheteMachete)this).maxPenetrations = 2;
				((Projectile)this).life = 0.46f;
			}
			((BrocheteMachete)this).unimpalementDamage = 8;
			((BrocheteMachete)this).trailDist = 12f;
			((BrocheteMachete)this).stunOnHit = false;
			((BrocheteMachete)this).rotationSpeed = 0f;
			((BrocheteMachete)this).dragUnitsSpeedM = 0.9f;
			((Projectile)this).projectileSize = 8f;
			((Projectile)this).damage = (((Projectile)this).damageInternal = (((Projectile)this).fullDamage = 13));
			((Projectile)this).fadeDamage = false;
			((Projectile)this).damageType = (DamageType)0;
			((Projectile)this).canHitGrenades = true;
			((Projectile)this).affectScenery = true;
			((Projectile)this).horizontalProjectile = true;
			((Projectile)this).isWideProjectile = false;
			((Projectile)this).canReflect = true;
			((Projectile)this).canMakeEffectsMoreThanOnce = true;
			base.platformCollider = (Collider)(object)new GameObject("BoltCollider", new Type[1] { typeof(BoxCollider) }).GetComponent<BoxCollider>();
			base.platformCollider.enabled = false;
			((Component)base.platformCollider).transform.parent = ((Component)this).transform;
			base.platformCollider = (Collider)(object)ComponentExtensions.FindChildOfName((Component)(object)this, "BoltCollider").gameObject.GetComponent<BoxCollider>();
			base.platformCollider.material = new PhysicMaterial();
			base.platformCollider.material.dynamicFriction = 0.6f;
			base.platformCollider.material.staticFriction = 0.6f;
			base.platformCollider.material.bounciness = 0f;
			base.platformCollider.material.frictionCombine = (PhysicMaterialCombine)0;
			base.platformCollider.material.bounceCombine = (PhysicMaterialCombine)0;
			((Component)base.platformCollider).gameObject.layer = 15;
			Collider platformCollider = base.platformCollider;
			((BoxCollider)((platformCollider is BoxCollider) ? platformCollider : null)).size = new Vector3(11f, 1f, 1f);
			GameObject val2 = new GameObject("BoltForeground", new Type[3]
			{
				typeof(MeshFilter),
				typeof(MeshRenderer),
				typeof(SpriteSM)
			});
			val2.transform.parent = ((Component)this).transform;
			((Renderer)val2.GetComponent<MeshRenderer>()).material = material;
			SpriteSM component3 = val2.GetComponent<SpriteSM>();
			component3.lowerLeftPixel = new Vector2(14f, 16f);
			component3.pixelDimensions = new Vector2(14f, 16f);
			((SpriteBase)component3).plane = (SPRITE_PLANE)0;
			((SpriteBase)component3).width = 14f;
			((SpriteBase)component3).height = 16f;
			((SpriteBase)component3).offset = new Vector3(-1f, 0f, 0f);
			val2.transform.localPosition = new Vector3(5f, 0f, -0.62f);
		}

		public override void Fire(float newX, float newY, float xI, float yI, float _zOffset, int playerNum, MonoBehaviour FiredBy)
		{
			((Component)this).gameObject.SetActive(true);
			((Projectile)this).Fire(newX, newY, xI, yI, _zOffset, playerNum, FiredBy);
		}

		protected override void CheckSpawnPoint()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: 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_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: 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_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			((Projectile)this).CheckWallsAtSpawnPoint();
			bool flag = default(bool);
			Map.DamageDoodads(((Projectile)this).damageInternal, ((Projectile)this).damageType, ((BroforceObject)this).X, ((BroforceObject)this).Y, ((BroforceObject)this).xI, ((BroforceObject)this).yI, ((Projectile)this).projectileSize, ((Projectile)this).playerNum, ref flag, (MonoBehaviour)(object)this);
			((Projectile)this).RegisterProjectile();
			((Projectile)this).CheckReturnZones();
			if ((((Projectile)this).canReflect && ((Projectile)this).playerNum >= 0 && ((Projectile)this).horizontalProjectile && Physics.Raycast(new Vector3(((BroforceObject)this).X - Mathf.Sign(((BroforceObject)this).xI) * ((Projectile)this).projectileSize * 2f, ((BroforceObject)this).Y, 0f), new Vector3(((BroforceObject)this).xI, ((BroforceObject)this).yI, 0f), ref ((Projectile)this).raycastHit, ((Projectile)this).projectileSize * 3f, LayerMask.op_Implicit(((Projectile)this).barrierLayer))) || (!((Projectile)this).horizontalProjectile && Physics.Raycast(new Vector3(((BroforceObject)this).X, ((BroforceObject)this).Y, 0f), new Vector3(((BroforceObject)this).xI, ((BroforceObject)this).yI, 0f), ref ((Projectile)this).raycastHit, ((Projectile)this).projectileSize + ((Projectile)this).startProjectileSpeed * ((Projectile)this).t, LayerMask.op_Implicit(((Projectile)this).barrierLayer))))
			{
				((Projectile)this).ReflectProjectile(((Projectile)this).raycastHit);
			}
			else if ((((Projectile)this).canReflect && ((Projectile)this).playerNum < 0 && ((Projectile)this).horizontalProjectile && Physics.Raycast(new Vector3(((BroforceObject)this).X - Mathf.Sign(((BroforceObject)this).xI) * ((Projectile)this).projectileSize * 2f, ((BroforceObject)this).Y, 0f), new Vector3(((BroforceObject)this).xI, ((BroforceObject)this).yI, 0f), ref ((Projectile)this).raycastHit, ((Projectile)this).projectileSize * 3f, LayerMask.op_Implicit(((Projectile)this).friendlyBarrierLayer))) || (!((Projectile)this).horizontalProjectile && Physics.Raycast(new Vector3(((BroforceObject)this).X, ((BroforceObject)this).Y, 0f), new Vector3(((BroforceObject)this).xI, ((BroforceObject)this).yI, 0f), ref ((Projectile)this).raycastHit, ((Projectile)this).projectileSize + ((Projectile)this).startProjectileSpeed * ((Projectile)this).t, LayerMask.op_Implicit(((Projectile)this).friendlyBarrierLayer))))
			{
				((Projectile)this).playerNum = 5;
				((Projectile)this).firedBy = null;
				((Projectile)this).ReflectProjectile(((Projectile)this).raycastHit);
			}
			else
			{
				((Projectile)this).TryHitUnitsAtSpawn();
			}
			((Projectile)this).CheckSpawnPointFragile();
		}

		protected override bool CheckWallsAtSpawnPoint()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			Collider[] array = Physics.OverlapSphere(new Vector3(((BroforceObject)this).X, ((BroforceObject)this).Y, 0f), 5f, LayerMask.op_Implicit(((Projectile)this).groundLayer));
			bool result = false;
			if (array.Length != 0)
			{
				for (int i = 0; i < array.Length; i++)
				{
					Collider val = null;
					if ((Object)(object)((Projectile)this).firedBy != (Object)null)
					{
						val = ((Component)((Projectile)this).firedBy).GetComponent<Collider>();
					}
					if ((Object)(object)((Projectile)this).firedBy == (Object)null || (Object)(object)array[i] != (Object)(object)val)
					{
						((Projectile)this).ProjectileApplyDamageToBlock(((Component)array[i]).gameObject, ((Projectile)this).damageInternal, ((Projectile)this).damageType, ((BroforceObject)this).xI, ((BroforceObject)this).yI);
						result = true;
					}
				}
			}
			return result;
		}

		protected override void Update()
		{
			if (base.stuckInPlace && explosive)
			{
				explosiveTimer += ((Projectile)this).t;
				if (explosiveTimer > 0.2f)
				{
					((Projectile)this).Death();
				}
			}
			if (isStuckToUnit && ((Object)(object)stuckToUnit == (Object)null || ((BroforceObject)stuckToUnit).health <= 0))
			{
				((Projectile)this).Death();
			}
			((BrocheteMachete)this).Update();
		}

		public void DestroyNearBySpears(Vector3 around)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Collider[] array = Physics.OverlapSphere(around, 9f, LayerMask.op_Implicit(Map.unitLayer));
			for (int i = 0; i < array.Length; i++)
			{
				PredabroSpear componentInChildren = ((Component)array[i]).GetComponentInChildren<PredabroSpear>();
				if ((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren != (Object)(object)this)
				{
					((Projectile)componentInChildren).Death();
				}
			}
		}

		public void StickToUnit(Transform trans, Vector3 point, Unit stuckUnit)
		{
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			foreach (Unit hitUnit in ((BrocheteMachete)this).hitUnits)
			{
				hitUnit.Damage(((BroforceObject)hitUnit).health, (DamageType)10, ((BroforceObject)this).xI, ((BroforceObject)this).yI, (int)Mathf.Sign(((BroforceObject)this).xI), ((Projectile)this).firedBy, ((BroforceObject)this).X, ((BroforceObject)this).Y);
			}
			base.stuckInPlace = true;
			((BrocheteMachete)this).superMachete = false;
			isStuckToUnit = true;
			stuckToUnit = stuckUnit;
			((Component)this).transform.parent = trans;
			((BroforceObject)this).X = point.x - Mathf.Sign(((BroforceObject)this).xI) * base.hitGroundOffset;
			((Projectile)this).SetPosition();
			((Projectile)this).life = float.PositiveInfinity;
			((Component)trans).SendMessage("AttachMe", (object)((Component)this).transform);
			base.platformCollider.enabled = true;
			DestroyNearBySpears(point);
		}

		protected override void HitUnits()
		{
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: 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_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			if (((BrocheteMachete)this).penetrationsCount >= ((BrocheteMachete)this).maxPenetrations)
			{
				return;
			}
			Unit firstUnit = Map.GetFirstUnit(((Projectile)this).firedBy, ((Projectile)this).playerNum, 5f, ((BroforceObject)this).X, ((BroforceObject)this).Y, true, true, ((BrocheteMachete)this).hitUnits);
			if (!((Object)(object)firstUnit != (Object)null))
			{
				return;
			}
			if (firstUnit.IsHeavy())
			{
				firstUnit.Damage(((Projectile)this).damageInternal, (DamageType)7, ((BroforceObject)this).xI, ((BroforceObject)this).yI, (int)Mathf.Sign(((BroforceObject)this).xI), ((Projectile)this).firedBy, ((BroforceObject)this).X, ((BroforceObject)this).Y);
				((Projectile)this).MakeEffects(false, ((BroforceObject)this).X, ((BroforceObject)this).Y, false, ((RaycastHit)(ref ((Projectile)this).raycastHit)).normal, ((RaycastHit)(ref ((Projectile)this).raycastHit)).point);
				Sound.GetInstance().PlaySoundEffectAt(((Projectile)this).soundHolder.specialSounds, 0.4f, ((Component)this).transform.position, 1f, true, false, false, 0f);
				if (!(firstUnit is DolphLundrenSoldier))
				{
					StickToUnit(((Component)firstUnit).transform, ((Component)this).transform.position - new Vector3(7f * ((Component)this).transform.localScale.x, 0f, 0f), firstUnit);
				}
				else
				{
					Object.Destroy((Object)(object)((Component)this).gameObject);
				}
				return;
			}
			((BrocheteMachete)this).hitUnits.Add(firstUnit);
			if (((BrocheteMachete)this).stunOnHit)
			{
				firstUnit.Blind();
			}
			firstUnit.Impale(((Component)this).transform, Vector3.right * Mathf.Sign(((BroforceObject)this).xI), ((Projectile)this).damageInternal, ((BroforceObject)this).xI, ((BroforceObject)this).yI, 0f, 0f);
			((BroforceObject)firstUnit).Y = ((BroforceObject)this).Y - 8f;
			if (firstUnit is Mook)
			{
				firstUnit.useImpaledFrames = true;
			}
			Sound.GetInstance().PlaySoundEffectAt(((Projectile)this).soundHolder.specialSounds, 0.5f, ((Component)this).transform.position, 1f, true, false, false, 0f);
			((BrocheteMachete)this).penetrationsCount = ((BrocheteMachete)this).penetrationsCount + 1;
			if (!explosive)
			{
				((Projectile)this).life = ((Projectile)this).life + 0.15f;
			}
			SortOfFollow.Shake(0.1f);
			EffectsController.CreateBloodParticles(firstUnit.bloodColor, ((BroforceObject)this).X, ((BroforceObject)this).Y, 4, 4f, 5f, 60f, ((BroforceObject)this).xI * 0.2f, ((BroforceObject)this).yI * 0.5f + 40f);
			EffectsController.CreateMeleeStrikeEffect(((BroforceObject)this).X, ((BroforceObject)this).Y, ((BroforceObject)this).xI * 0.2f, ((BroforceObject)this).yI * 0.5f + 24f);
			if (((BroforceObject)this).xI > 0f)
			{
				if (((BroforceObject)firstUnit).X < ((BroforceObject)this).X + 3f)
				{
					((BroforceObject)firstUnit).X = ((BroforceObject)this).X + 3f;
				}
			}
			else if (((BroforceObject)this).xI < 0f && ((BroforceObject)firstUnit).X > ((BroforceObject)this).X - 3f)
			{
				((BroforceObject)firstUnit).X = ((BroforceObject)this).X - 3f;
			}
		}

		protected override void MakeEffects(bool particles, float x, float y, bool useRayCast, Vector3 hitNormal, Vector3 hitPoint)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			if (explosive)
			{
				Explode();
			}
			else
			{
				((PredabroSpear)this).MakeEffects(particles, x, y, useRayCast, hitNormal, hitPoint);
			}
		}

		protected void Explode()
		{
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			MapController.DamageGround(((Projectile)this).firedBy, ValueOrchestrator.GetModifiedDamage(((Projectile)this).damage, ((Projectile)this).playerNum), (DamageType)2, range, ((BroforceObject)this).X, ((BroforceObject)this).Y, (Collider[])null, false);
			EffectsController.CreateExplosionRangePop(((BroforceObject)this).X, ((BroforceObject)this).Y, -1f, range * 2f);
			Map.ExplodeUnits(((Projectile)this).firedBy, 12, (DamageType)2, range * 1.3f, range, ((BroforceObject)this).X, ((BroforceObject)this).Y, 50f, 400f, ((Projectile)this).playerNum, false, true, true);
			EffectsController.CreateExplosionRangePop(((BroforceObject)this).X, ((BroforceObject)this).Y, -1f, range * 2f);
			EffectsController.CreateExplosion(((BroforceObject)this).X, ((BroforceObject)this).Y, range * 0.25f, range * 0.25f, 120f, 1f, range * 1.5f, 1f, 0f, true);
			if ((Object)(object)((Projectile)this).sound == (Object)null)
			{
				((Projectile)this).sound = Sound.GetInstance();
			}
			if ((Object)(object)((Projectile)this).sound != (Object)null)
			{
				((Projectile)this).sound.PlaySoundEffectAt(explosionSounds, 0.7f, ((Component)this).transform.position, 1f, true, false, false, 0f);
			}
			bool flag = default(bool);
			Map.DamageDoodads(((Projectile)this).damage, (DamageType)2, ((BroforceObject)this).X, ((BroforceObject)this).Y, 0f, 0f, range, ((Projectile)this).playerNum, ref flag, (MonoBehaviour)null);
		}
	}
	public class FuribrosaSummonWarRigActionInfo : CustomTriggerActionInfo
	{
		public bool StartOnGround = true;

		public GridPoint SpawnPoint = new GridPoint(0, 0);

		public GridPoint TargetPoint = new GridPoint(0, 0);

		public override void ShowGUI(LevelEditorGUI gui)
		{
			CustomTriggerActionInfo.ShowGridPointOption(gui, SpawnPoint, "Set Spawn Point");
			CustomTriggerActionInfo.ShowGridPointOption(gui, TargetPoint, "Set Target Point");
			GUILayout.Space(5f);
			StartOnGround = GUILayout.Toggle(StartOnGround, "Spawn on the nearest ground below", (GUILayoutOption[])(object)new GUILayoutOption[0]);
		}
	}
	public class FuribrosaSummonWarRigAction : CustomTriggerAction<FuribrosaSummonWarRigActionInfo>
	{
		public FuribrosaSummonWarRigAction()
		{
			Furibrosa.CreateWarRigPrefab();
		}

		public override void Start()
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			((TriggerAction)this).Start();
			Furibrosa.CreateWarRigPrefab();
			Furibrosa furibrosa = null;
			for (int i = 0; i < 4; i++)
			{
				if (!HeroController.PlayerIsAlive(i))
				{
					continue;
				}
				try
				{
					if (HeroController.players[i].character is Furibrosa furibrosa2)
					{
						furibrosa = furibrosa2;
						break;
					}
				}
				catch
				{
				}
			}
			Vector3 blockCenter = Map.GetBlockCenter(new GridPoint(base.info.SpawnPoint.collumn - Map.lastXLoadOffset, base.info.SpawnPoint.row - Map.lastYLoadOffset));
			Vector3 blockCenter2 = Map.GetBlockCenter(new GridPoint(base.info.TargetPoint.collumn - Map.lastXLoadOffset, base.info.TargetPoint.row - Map.lastYLoadOffset));
			float num = Mathf.Sign(blockCenter2.x - blockCenter.x);
			WarRig warRig = Object.Instantiate<WarRig>(Furibrosa.warRigPrefab, blockCenter, Quaternion.identity);
			if (base.info.StartOnGround)
			{
				warRig.SetToGround();
			}
			warRig.SetTarget(furibrosa, blockCenter2.x, new Vector3(num, ((Component)warRig).transform.localScale.y, ((Component)warRig).transform.localScale.z), num, manualSpawn: true);
			((Component)warRig).gameObject.SetActive(true);
			if (furibrosa != null)
			{
				furibrosa.currentWarRig = warRig;
			}
			((TriggerAction)this).state = (TriggerActionState)2;
		}

		public override void Update()
		{
		}
	}
	public class FuriosaFlare : Flare
	{
		public void Setup(Flare otherFlare)
		{
			//IL_006e: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Expected O, but got Unknown
			base.blastForce = otherFlare.blastForce;
			base.hitUnitsSize = otherFlare.hitUnitsSize;
			base.fire1 = otherFlare.fire1;
			base.fire2 = otherFlare.fire2;
			base.fire3 = otherFlare.fire3;
			base.smoke1 = otherFlare.smoke1;
			base.smoke2 = otherFlare.smoke2;
			base.smoke3 = otherFlare.smoke3;
			base.explosion = otherFlare.explosion;
			base.trailType = otherFlare.trailType;
			((Projectile)this).z = ((Projectile)otherFlare).z;
			((Projectile)this).shrapnel = ((Projectile)otherFlare).shrapnel;
			((Projectile)this).shrapnelSpark = ((Projectile)otherFlare).shrapnelSpark;
			((Projectile)this).flickPuff = ((Projectile)otherFlare).flickPuff;
			((Projectile)this).life = ((Projectile)otherFlare).life;
			((Projectile)this).projectileSize = ((Projectile)otherFlare).projectileSize;
			((Projectile)this).fullLife = 1f;
			((Projectile)this).fadeDamage = ((Projectile)otherFlare).fadeDamage;
			((Projectile)this).damageType = ((Projectile)otherFlare).damageType;
			((Projectile)this).playerNum = ((Projectile)otherFlare).playerNum;
			((Projectile)this).soundHolder = ((Projectile)otherFlare).soundHolder;
			((Projectile)this).canHitGrenades = ((Projectile)otherFlare).canHitGrenades;
			((Projectile)this).affectScenery = ((Projectile)otherFlare).affectScenery;
			((Projectile)this).soundVolume = ((Projectile)otherFlare).soundVolume;
			((Projectile)this).firedBy = ((Projectile)otherFlare).firedBy;
			((Projectile)this).seed = ((Projectile)otherFlare).seed;
			((Projectile)this).random = new Randomf(Random.Range(0, 10000));
			((Projectile)this).sparkCount = ((Projectile)otherFlare).sparkCount;
			((Projectile)this).isDamageable = ((Projectile)otherFlare).isDamageable;
			((Projectile)this).horizontalProjectile = ((Projectile)otherFlare).horizontalProjectile;
			((Projectile)this).isWideProjectile = ((Projectile)otherFlare).isWideProjectile;
			((Projectile)this).zOffset = (1f - Random.value * 2f) * 0.04f;
			((Projectile)this).canReflect = ((Projectile)otherFlare).canReflect;
			((Projectile)this).startProjectileSpeed = 400f;
			((Projectile)this).heldDelay = 0f;
			((Projectile)this).canMakeEffectsMoreThanOnce = false;
			((Projectile)this).whitePopEffect = ((Projectile)otherFlare).whitePopEffect;
			((Projectile)this).doubleSpeed = ((Projectile)otherFlare).doubleSpeed;
			((Projectile)this).giveDeflectAchievementOnMookKill = ((Projectile)otherFlare).giveDeflectAchievementOnMookKill;
			((BroforceObject)this).health = 3;
			((BroforceObject)this).maxHealth = -1;
			Object.Destroy((Object)(object)otherFlare);
			((Projectile)this).damage = (((Projectile)this).damageInternal = (((Projectile)this).fullDamage = 11));
			base.range = 9f;
		}

		public override void Fire(float x, float y, float xI, float yI, float _zOffset, int playerNum, MonoBehaviour FiredBy)
		{
			((Component)this).gameObject.SetActive(true);
			((Flare)this).Fire(x, y, xI, yI, _zOffset, playerNum, FiredBy);
		}
	}
	[HeroPreset(/*Could not decode attribute arguments.*/)]
	public class Furibrosa : CustomHero
	{
		public enum PrimaryState
		{
			Crossbow,
			FlareGun,
			Switching
		}

		public static KeyBindingForPlayers switchWeaponKey = AllModKeyBindings.LoadKeyBinding("Furibrosa", "Switch Weapon");

		protected bool acceptedDeath;

		private bool wasInvulnerable;

		public static bool jsonLoaded = false;

		public Material originalSpecialMat;

		public AudioClip[] crossbowSounds;

		public AudioClip[] flareSounds;

		public AudioClip chargeSound;

		public AudioClip swapSound;

		public AudioClip[] meleeSwingSounds;

		public PrimaryState currentState;

		public PrimaryState nextState;

		public static Bolt boltPrefab;

		public static Bolt explosiveBoltPrefab;

		protected bool releasedFire;

		protected float chargeTime;

		protected int chargeCounter;

		protected bool charged;

		protected Material crossbowMat;

		protected Material crossbowNormalMat;

		protected Material crossbowHoldingMat;

		protected Material flareGunMat;

		protected Material flareGunNormalMat;

		protected Material flareGunHoldingMat;

		protected float gunFramerate;

		public static FuriosaFlare flarePrefab;

		[SaveableSetting(null)]
		public static bool doubleTapSwitch = true;

		protected float lastDownPressTime = -1f;

		protected bool randomizedWeapon;

		public const float crossbowDelay = 0.65f;

		public const float flaregunDelay = 0.8f;

		public const int crossbowDamage = 13;

		public const int flaregunDamage = 11;

		protected MeshRenderer holdingArm;

		public static HashSet<Unit> grabbedUnits = new HashSet<Unit>();

		private Unit grabbedUnit;

		protected bool unitWasGrabbed;

		protected bool throwingMook;

		protected float holdingXOffset;

		protected float holdingYOffset;

		protected float targetHoldingXOffset;

		protected float targetHoldingYOffset;

		protected float interpolationSpeed = 20f;

		protected bool isInterpolating;

		public static WarRig warRigPrefab;

		public WarRig currentWarRig;

		public bool holdingSpecial;

		public float holdingSpecialTime;

		protected override void Awake()
		{
			((Component)this).gameObject.layer = 19;
			((CustomHero)this).Awake();
		}

		public override void PreloadAssets()
		{
			CustomHero.PreloadSprites(((CustomHero)this).DirectoryPath, new List<string>
			{
				"gunSpriteCrossbow.png", "gunSpriteCrossbowHolding.png", "gunSpriteFlareGun.png", "gunSpriteFlareGunHolding.png", "special.png", "gunSpriteHolding.png", "vehicleSprite.png", "vehicleCrossbow.png", "vehicleFlareGun.png", "vehicleCrossbow.png",
				"vehicleWheels.png", "vehicleBumper.png", "vehicleLongSmokestacks.png", "vehicleShortSmokestacks.png", "vehicleFrontSmokestacks.png", "vehicleSpecial.png", "boltExplosive.png", "bolt.png", "harpoon.png"
			});
			CustomHero.PreloadSounds(((CustomHero)this).SoundPath, new List<string>
			{
				"crossbowShot1.wav", "crossbowShot2.wav", "crossbowShot3.wav", "crossbowShot4.wav", "flareShot1.wav", "flareShot2.wav", "flareShot3.wav", "flareShot4.wav", "charged.wav", "weaponSwap.wav",
				"meleeSwing1.wav", "meleeSwing2.wav", "meleeSwing3.wav", "vehicleIdleLoop.wav", "vehicleBoost.wav", "vehicleHornMedium.wav", "vehicleHornLong.wav", "vehicleHit1.wav", "vehicleHit2.wav", "vehicleHit3.wav",
				"harpoon.wav"
			});
		}

		public override void HarmonyPatches(Harmony harmony)
		{
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			harmony.PatchAll(executingAssembly);
		}

		public override void RegisterCustomTriggers()
		{
			CustomTriggerManager.RegisterCustomTrigger(typeof(FuribrosaSummonWarRigAction), typeof(FuribrosaSummonWarRigActionInfo), "Furibrosa - Summon War Rig", "Custom Bros", 0);
		}

		protected override void Start()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0406: Unknown result type (might be due to invalid IL or missing references)
			//IL_040b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			((CustomHero)this).Start();
			((BroBase)this).meleeType = (MeleeType)2;
			crossbowMat = ResourcesController.GetMaterial(Path.Combine(((CustomHero)this).DirectoryPath, "gunSpriteCrossbow.png"));
			crossbowNormalMat = crossbowMat;
			crossbowHoldingMat = ResourcesController.GetMaterial(Path.Combine(((CustomHero)this).DirectoryPath, "gunSpriteCrossbowHolding.png"));
			flareGunMat = ResourcesController.GetMaterial(Path.Combine(((CustomHero)this).DirectoryPath, "gunSpriteFlareGun.png"));
			flareGunNormalMat = flareGunMat;
			flareGunHoldingMat = ResourcesController.GetMaterial(Path.Combine(((CustomHero)this).DirectoryPath, "gunSpriteFlareGunHolding.png"));
			((Component)((TestVanDammeAnim)this).gunSprite).gameObject.layer = 19;
			((TestVanDammeAnim)this).gunSprite.meshRender.material = crossbowMat;
			originalSpecialMat = ResourcesController.GetMaterial(((CustomHero)this).DirectoryPath, "special.png");
			if ((Object)(object)boltPrefab == (Object)null)
			{
				boltPrefab = new GameObject("Bolt", new Type[5]
				{
					typeof(MeshFilter),
					typeof(MeshRenderer),
					typeof(SpriteSM),
					typeof(BoxCollider),
					typeof(Bolt)
				}).GetComponent<Bolt>();
				((Component)boltPrefab).gameObject.SetActive(false);
				ref SoundHolder soundHolder = ref ((Projectile)boltPrefab).soundHolder;
				TestVanDammeAnim heroPrefab = HeroController.GetHeroPrefab((HeroType)34);
				soundHolder = ((Unit)((heroPrefab is Predabro) ? heroPrefab : null)).projectile.soundHolder;
				boltPrefab.Setup(isExplosive: false);
				Object.DontDestroyOnLoad((Object)(object)boltPrefab);
			}
			if ((Object)(object)explosiveBoltPrefab == (Object)null)
			{
				explosiveBoltPrefab = new GameObject("ExplosiveBolt", new Type[5]
				{
					typeof(MeshFilter),
					typeof(MeshRenderer),
					typeof(SpriteSM),
					typeof(BoxCollider),
					typeof(Bolt)
				}).GetComponent<Bolt>();
				((Component)explosiveBoltPrefab).gameObject.SetActive(false);
				ref SoundHolder soundHolder2 = ref ((Projectile)explosiveBoltPrefab).soundHolder;
				TestVanDammeAnim heroPrefab2 = HeroController.GetHeroPrefab((HeroType)34);
				soundHolder2 = ((Unit)((heroPrefab2 is Predabro) ? heroPrefab2 : null)).projectile.soundHolder;
				explosiveBoltPrefab.Setup(isExplosive: true);
				Object.DontDestroyOnLoad((Object)(object)explosiveBoltPrefab);
			}
			if ((Object)(object)flarePrefab == (Object)null)
			{
				for (int i = 0; i < InstantiationController.PrefabList.Count; i++)
				{
					if (InstantiationController.PrefabList[i] != (Object)null && InstantiationController.PrefabList[i].name == "Bullet Flare")
					{
						Object obj = Object.Instantiate(InstantiationController.PrefabList[i], Vector3.zero, Quaternion.identity);
						Flare component = ((GameObject)((obj is GameObject) ? obj : null)).GetComponent<Flare>();
						flarePrefab = ((Component)component).gameObject.AddComponent<FuriosaFlare>();
						flarePrefab.Setup(component);
						((Component)flarePrefab).gameObject.SetActive(false);
						Object.DontDestroyOnLoad((Object)(object)flarePrefab);
						break;
					}
				}
			}
			holdingArm = new GameObject("FuribrosaArm", new Type[3]
			{
				typeof(MeshFilter),
				typeof(MeshRenderer),
				typeof(SpriteSM)
			}).GetComponent<MeshRenderer>();
			((Component)holdingArm).transform.parent = ((Component)this).transform;
			((Component)holdingArm).gameObject.SetActive(false);
			((Renderer)holdingArm).material = ResourcesController.GetMaterial(((CustomHero)this).DirectoryPath, "gunSpriteHolding.png");
			SpriteSM component2 = ((Component)holdingArm).gameObject.GetComponent<SpriteSM>();
			((SpriteBase)component2).RecalcTexture();
			component2.SetTextureDefaults();
			component2.lowerLeftPixel = new Vector2(0f, 32f);
			component2.pixelDimensions = new Vector2(32f, 32f);
			((SpriteBase)component2).plane = (SPRITE_PLANE)0;
			((SpriteBase)component2).width = 32f;
			((SpriteBase)component2).height = 32f;
			((Component)component2).transform.localPosition = new Vector3(0f, 0f, -0.9f);
			((SpriteBase)component2).CalcUVs();
			((SpriteBase)component2).UpdateUVs();
			((SpriteBase)component2).offset = new Vector3(0f, 15f, 0f);
			try
			{
				CreateWarRigPrefab();
			}
			catch (Exception ex)
			{
				BMLogger.Log("Exception creating WarRig: " + ex.ToString(), (LogType)3, true);
			}
			if (!randomizedWeapon)
			{
				if (Random.value >= 0.5f)
				{
					nextState = PrimaryState.FlareGun;
					SwitchWeapon();
				}
				randomizedWeapon = true;
			}
		}

		public static void CreateWarRigPrefab()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)warRigPrefab == (Object)null))
			{
				return;
			}
			GameObject val = null;
			for (int i = 0; i < InstantiationController.PrefabList.Count; i++)
			{
				if (InstantiationController.PrefabList[i] != (Object)null && InstantiationController.PrefabList[i].name == "ZMookArmouredGuy")
				{
					Object obj = Object.Instantiate(InstantiationController.PrefabList[i], Vector3.zero, Quaternion.identity);
					val = (GameObject)(object)((obj is GameObject) ? obj : null);
				}
			}
			if ((Object)(object)val != (Object)null)
			{
				warRigPrefab = val.AddComponent<WarRig>();
				warRigPrefab.Setup();
				Object.DontDestroyOnLoad((Object)(object)warRigPrefab);
				return;
			}
			throw new Exception("Mech Prefab not found");
		}

		public override void BeforePrefabSetup()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			base.SoundHolderVoiceType = (SoundHolderVoiceTypes)5;
		}

		public override void AfterPrefabSetup()
		{
			crossbowSounds = (AudioClip[])(object)new AudioClip[4];
			crossbowSounds[0] = ResourcesController.GetAudioClip(((CustomHero)this).SoundPath, "crossbowShot1.wav");
			crossbowSounds[1] = ResourcesController.GetAudioClip(((CustomHero)this).SoundPath, "crossbowShot2.wav");
			crossbowSounds[2] = ResourcesController.GetAudioClip(((CustomHero)this).SoundPath, "crossbowShot3.wav");
			crossbowSounds[3] = ResourcesController.GetAudioClip(((CustomHero)this).SoundPath, "crossbowShot4.wav");
			flareSounds = (AudioClip[])(object)new AudioClip[4];
			flareSounds[0] = ResourcesController.GetAudioClip(((CustomHero)this).SoundPath, "flareShot1.wav");
			flareSounds[1] = ResourcesController.GetAudioClip(((CustomHero)this).SoundPath, "flareShot2.wav");
			flareSounds[2] = ResourcesController.GetAudioClip(((CustomHero)this).SoundPath, "flareShot3.wav");
			flareSounds[3] = ResourcesController.GetAudioClip(((CustomHero)this).SoundPath, "flareShot4.wav");
			chargeSound = ResourcesController.GetAudioClip(((CustomHero)this).SoundPath, "charged.wav");
			swapSound = ResourcesController.GetAudioClip(((CustomHero)this).SoundPath, "weaponSwap.wav");
			meleeSwingSounds = (AudioClip[])(object)new AudioClip[3];
			meleeSwingSounds[0] = ResourcesController.GetAudioClip(((CustomHero)this).SoundPath, "meleeSwing1.wav");
			meleeSwingSounds[1] = ResourcesController.GetAudioClip(((CustomHero)this).SoundPath, "meleeSwing2.wav");
			meleeSwingSounds[2] = ResourcesController.GetAudioClip(((CustomHero)this).SoundPath, "meleeSwing3.wav");
		}

		protected override void Update()
		{
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Invalid comparison between Unknown and I4
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			((BroBase)this).Update();
			if (acceptedDeath)
			{
				if (((BroforceObject)this).health <= 0 && !((TestVanDammeAnim)this).WillReviveAlready)
				{
					return;
				}
				acceptedDeath = false;
			}
			if (((Unit)this).invulnerable)
			{
				wasInvulnerable = true;
			}
			if (((NetworkedUnit)this).playerNum >= 0 && ((NetworkedUnit)this).playerNum < 4 && switchWeaponKey.IsDown(((NetworkedUnit)this).playerNum))
			{
				StartSwitchingWeapon();
			}
			if (wasInvulnerable && !((Unit)this).invulnerable)
			{
				wasInvulnerable = false;
				((Component)this).GetComponent<Renderer>().material.SetColor("_TintColor", Color.gray);
				crossbowNormalMat.SetColor("_TintColor", Color.gray);
				crossbowHoldingMat.SetColor("_TintColor", Color.gray);
				flareGunNormalMat.SetColor("_TintColor", Color.gray);
				flareGunHoldingMat.SetColor("_TintColor", Color.gray);
				((Renderer)holdingArm).material.SetColor("_TintColor", Color.gray);
			}
			if (holdingSpecial)
			{
				if (((TestVanDammeAnim)this).special)
				{
					holdingSpecialTime += ((Unit)this).t;
					if (holdingSpecialTime > 0.2f)
					{
						GoPastFuriosa();
					}
				}
				else
				{
					holdingSpecial = false;
				}
			}
			if ((int)((Unit)this).actionState == 5 && !acceptedDeath && !((TestVanDammeAnim)this).WillReviveAlready)
			{
				acceptedDeath = true;
			}
			if (((TestVanDammeAnim)this).isOnHelicopter)
			{
				ReleaseUnit(throwUnit: false);
			}
			if ((Object)(object)grabbedUnit != (Object)null && isInterpolating)
			{
				holdingXOffset = Mathf.Lerp(holdingXOffset, targetHoldingXOffset, Time.deltaTime * interpolationSpeed);
				holdingYOffset = Mathf.Lerp(holdingYOffset, targetHoldingYOffset, Time.deltaTime * interpolationSpeed);
				if (Mathf.Abs(holdingXOffset - targetHoldingXOffset) < 0.01f && Mathf.Abs(holdingYOffset - targetHoldingYOffset) < 0.01f)
				{
					holdingXOffset = targetHoldingXOffset;
					holdingYOffset = targetHoldingYOffset;
					isInterpolating = false;
				}
			}
		}

		protected override void LateUpdate()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			((TestVanDammeAnim)this).LateUpdate();
			if (acceptedDeath)
			{
				return;
			}
			if ((Object)(object)grabbedUnit != (Object)null)
			{
				if (((BroforceObject)grabbedUnit).health > 0 && ((BroforceObject)this).health > 0)
				{
					((BroforceObject)grabbedUnit).X = ((BroforceObject)this).X + ((Component)this).transform.localScale.x * holdingXOffset;
					((BroforceObject)grabbedUnit).Y = ((BroforceObject)this).Y + holdingYOffset;
					if (currentState == PrimaryState.Crossbow)
					{
						grabbedUnit.zOffset = -0.95f;
					}
					else if (currentState == PrimaryState.FlareGun)
					{
						grabbedUnit.zOffset = -2f;
					}
					((Component)grabbedUnit).transform.localScale = ((Component)this).transform.localScale;
					unitWasGrabbed = true;
				}
				else
				{
					ReleaseUnit(throwUnit: false);
				}
			}
			else if (unitWasGrabbed)
			{
				unitWasGrabbed = false;
				grabbedUnits.RemoveWhere((Unit unit) => (Object)(object)unit == (Object)null);
				grabbedUnit = null;
				((Component)((TestVanDammeAnim)this).gunSprite).gameObject.layer = 19;
				SwitchToNormalMaterials();
				((TestVanDammeAnim)this).ChangeFrame();
			}
		}

		public override void UIOptions()
		{
			GUILayout.Space(10f);
			int num = default(int);
			switchWeaponKey.OnGUI(ref num, GUI.tooltip == string.Empty);
			GUILayout.Space(10f);
			if (doubleTapSwitch != (doubleTapSwitch = GUILayout.Toggle(doubleTapSwitch, "Double Tap Down to Switch Weapons", (GUILayoutOption[])(object)new GUILayoutOption[0])))
			{
				((CustomHero)this).SaveSettings();
			}
		}

		public override void Death(float xI, float yI, DamageObject damage)
		{
			ReleaseUnit(throwUnit: false);
			((BroBase)this).Death(xI, yI, damage);
		}

		protected override void OnDestroy()
		{
			ReleaseUnit(throwUnit: false);
			((BroBase)this).OnDestroy();
		}

		public override void RecallBro()
		{
			ReleaseUnit(throwUnit: false);
			((TestVanDammeAnim)this).RecallBro();
		}

		protected override void ChangeFrame()
		{
			if (!randomizedWeapon && ((TestVanDammeAnim)this).isOnHelicopter)
			{
				randomizedWeapon = true;
			}
			((TestVanDammeAnim)this).ChangeFrame();
		}

		protected override void SetGunPosition(float xOffset, float yOffset)
		{
			//IL_004e: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			((CustomHero)this).SetGunPosition(xOffset, yOffset);
			if ((Object)(object)grabbedUnit != (Object)null)
			{
				if (!isInterpolating)
				{
					holdingXOffset = 11f + xOffset;
					holdingYOffset = 4.5f + yOffset;
				}
				((Component)holdingArm).transform.localPosition = ((Component)((TestVanDammeAnim)this).gunSprite).transform.localPosition + new Vector3(0f, 0f, 0.1f);
				((Component)holdingArm).transform.localScale = ((Component)((TestVanDammeAnim)this).gunSprite).transform.localScale;
			}
		}

		protected override void StartFiring()
		{
			chargeTime = 0f;
			chargeCounter = 0;
			charged = false;
			((TestVanDammeAnim)this).StartFiring();
		}

		protected override void ReleaseFire()
		{
			if (((TestVanDammeAnim)this).fireDelay < 0.2f)
			{
				releasedFire = true;
			}
			((TestVanDammeAnim)this).ReleaseFire();
		}

		protected override void RunFiring()
		{
			if (((BroforceObject)this).health <= 0)
			{
				return;
			}
			if (currentState == PrimaryState.Crossbow)
			{
				if (((TestVanDammeAnim)this).fireDelay > 0f)
				{
					((TestVanDammeAnim)this).fireDelay = ((TestVanDammeAnim)this).fireDelay - ((Unit)this).t;
				}
				if (((TestVanDammeAnim)this).fireDelay <= 0f)
				{
					if (((TestVanDammeAnim)this).fire)
					{
						((TestVanDammeAnim)this).StopRolling();
						chargeTime += ((Unit)this).t;
					}
					else if (releasedFire)
					{
						((TestVanDammeAnim)this).UseFire();
						((TestVanDammeAnim)this).SetGestureAnimation((Gestures)0);
					}
				}
			}
			else if (currentState == PrimaryState.FlareGun)
			{
				if (((TestVanDammeAnim)this).fireDelay > 0f)
				{
					((TestVanDammeAnim)this).fireDelay = ((TestVanDammeAnim)this).fireDelay - ((Unit)this).t;
				}
				if (((TestVanDammeAnim)this).fireDelay <= 0f && (((TestVanDammeAnim)this).fire || releasedFire))
				{
					((TestVanDammeAnim)this).UseFire();
					((TestVanDammeAnim)this).SetGestureAnimation((Gestures)0);
					releasedFire = false;
				}
			}
		}

		protected override void UseFire()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			if (((TestVanDammeAnim)this).doingMelee)
			{
				((TestVanDammeAnim)this).CancelMelee();
			}
			releasedFire = false;
			if (Connect.IsOffline)
			{
				((NetworkedUnit)this).syncedDirection = (int)((Component)this).transform.localScale.x;
			}
			((TestVanDammeAnim)this).FireWeapon(0f, 0f, 0f, 0f);
			Map.DisturbWildLife(((BroforceObject)this).X, ((BroforceObject)this).Y, 60f, ((NetworkedUnit)this).playerNum);
		}

		protected override void FireWeapon(float x, float y, float xSpeed, float ySpeed)
		{
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			if (currentState == PrimaryState.Crossbow)
			{
				if (charged)
				{
					x = ((BroforceObject)this).X + ((Component)this).transform.localScale.x * 8f;
					y = ((BroforceObject)this).Y + 8f;
					xSpeed = ((Component)this).transform.localScale.x * 500f + ((BroforceObject)this).xI / 2f;
					ySpeed = 0f;
					((TestVanDammeAnim)this).gunFrame = 3;
					((TestVanDammeAnim)this).SetGunSprite(((TestVanDammeAnim)this).gunFrame, 0);
					((TestVanDammeAnim)this).TriggerBroFireEvent();
					EffectsController.CreateMuzzleFlashEffect(x, y, -25f, xSpeed * 0.15f, ySpeed, ((Component)this).transform);
					ProjectileController.SpawnProjectileLocally((Projectile)(object)explosiveBoltPrefab, (MonoBehaviour)(object)this, x, y, xSpeed, ySpeed, ((NetworkedUnit)this).playerNum);
				}
				else
				{
					x = ((BroforceObject)this).X + ((Component)this).transform.localScale.x * 8f;
					y = ((BroforceObject)this).Y + 8f;
					xSpeed = ((Component)this).transform.localScale.x * 400f + ((BroforceObject)this).xI / 2f;
					ySpeed = 0f;
					((TestVanDammeAnim)this).gunFrame = 3;
					((TestVanDammeAnim)this).SetGunSprite(((TestVanDammeAnim)this).gunFrame, 0);
					((TestVanDammeAnim)this).TriggerBroFireEvent();
					EffectsController.CreateMuzzleFlashEffect(x, y, -25f, xSpeed * 0.15f, ySpeed, ((Component)this).transform);
					ProjectileController.SpawnProjectileLocally((Projectile)(object)boltPrefab, (MonoBehaviour)(object)this, x, y, xSpeed, ySpeed, ((NetworkedUnit)this).playerNum);
				}
				PlayCrossbowSound(((Component)this).transform.position);
				((TestVanDammeAnim)this).fireDelay = 0.65f;
			}
			else if (currentState == PrimaryState.FlareGun)
			{
				if ((Object)(object)((Unit)this).attachedToZipline == (Object)null)
				{
					x = ((BroforceObject)this).X + ((Component)this).transform.localScale.x * 12f;
					y = ((BroforceObject)this).Y + 8f;
					xSpeed = ((Component)this).transform.localScale.x * 450f;
					ySpeed = Random.Range(15, 50);
					EffectsController.CreateMuzzleFlashEffect(x, y, -25f, xSpeed * 0.15f, ySpeed, ((Component)this).transform);
					ProjectileController.SpawnProjectileLocally((Projectile)(object)flarePrefab, (MonoBehaviour)(object)this, x, y, xSpeed, ySpeed, ((NetworkedUnit)this).playerNum);
				}
				else
				{
					x = ((BroforceObject)this).X + ((Component)this).transform.localScale.x * 4f;
					y = ((BroforceObject)this).Y + 8f;
					xSpeed = ((Component)this).transform.localScale.x * 450f;
					ySpeed = Random.Range(15, 50);
					EffectsController.CreateMuzzleFlashEffect(x, y, -25f, xSpeed * 0.15f, ySpeed, ((Component)this).transform);
					ProjectileController.SpawnProjectileLocally((Projectile)(object)flarePrefab, (MonoBehaviour)(object)this, x, y, xSpeed, ySpeed, ((NetworkedUnit)this).playerNum);
				}
				((TestVanDammeAnim)this).gunFrame = 3;
				PlayFlareSound(((Component)this).transform.position);
				((TestVanDammeAnim)this).fireDelay = 0.8f;
			}
		}

		public void PlayChargeSound(Vector3 position)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			((TestVanDammeAnim)this).sound.PlaySoundEffectAt(chargeSound, 0.35f, position, 1f, true, false, true, 0f);
		}

		public void PlayCrossbowSound(Vector3 position)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			((TestVanDammeAnim)this).sound.PlaySoundEffectAt(crossbowSounds, 0.35f, position, 1f, true, false, true, 0f);
		}

		public void PlayFlareSound(Vector3 position)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			((TestVanDammeAnim)this).sound.PlaySoundEffectAt(flareSounds, 0.75f, position, 1f, true, false, true, 0f);
		}

		public void PlaySwapSound(Vector3 position)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			((TestVanDammeAnim)this).sound.PlaySoundEffectAt(swapSound, 0.35f, position, 1f, true, false, true, 0f);
		}

		protected override void RunGun()
		{
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			if (currentState == PrimaryState.Crossbow)
			{
				if (((TestVanDammeAnim)this).fire)
				{
					if (!(chargeTime > 0.2f))
					{
						return;
					}
					if (chargeCounter == 0)
					{
						((TestVanDammeAnim)this).gunCounter = ((TestVanDammeAnim)this).gunCounter + ((Unit)this).t;
						if (((TestVanDammeAnim)this).gunCounter < 1f && ((TestVanDammeAnim)this).gunCounter > 0.08f)
						{
							((TestVanDammeAnim)this).gunCounter = ((TestVanDammeAnim)this).gunCounter - 0.08f;
							((TestVanDammeAnim)this).gunFrame = ((TestVanDammeAnim)this).gunFrame + 1;
							if (((TestVanDammeAnim)this).gunFrame > 5)
							{
								chargeCounter++;
								gunFramerate = 0.09f;
							}
						}
					}
					else
					{
						((TestVanDammeAnim)this).gunCounter = ((TestVanDammeAnim)this).gunCounter + ((Unit)this).t;
						if (((TestVanDammeAnim)this).gunCounter > gunFramerate)
						{
							((TestVanDammeAnim)this).gunCounter = ((TestVanDammeAnim)this).gunCounter - gunFramerate;
							((TestVanDammeAnim)this).gunFrame = ((TestVanDammeAnim)this).gunFrame + 1;
							if (((TestVanDammeAnim)this).gunFrame > 9)
							{
								((TestVanDammeAnim)this).gunFrame = 6;
								if (!charged)
								{
									chargeCounter++;
									if (chargeCounter > 1)
									{
										PlayChargeSound(((Component)this).transform.position);
										charged = true;
										gunFramerate = 0.04f;
									}
								}
							}
						}
					}
					((TestVanDammeAnim)this).gunSprite.SetLowerLeftPixel((float)((((TestVanDammeAnim)this).gunFrame + 14) * ((TestVanDammeAnim)this).gunSpritePixelWidth), (float)((TestVanDammeAnim)this).gunSpritePixelHeight);
				}
				else if (!((TestVanDammeAnim)this).WallDrag && ((TestVanDammeAnim)this).gunFrame > 0)
				{
					((TestVanDammeAnim)this).gunCounter = ((TestVanDammeAnim)this).gunCounter + ((Unit)this).t;
					if (((TestVanDammeAnim)this).gunCounter > 0.045f)
					{
						((TestVanDammeAnim)this).gunCounter = ((TestVanDammeAnim)this).gunCounter - 0.045f;
						((TestVanDammeAnim)this).gunFrame = ((TestVanDammeAnim)this).gunFrame - 1;
						((TestVanDammeAnim)this).SetGunSprite(((TestVanDammeAnim)this).gunFrame, 0);
					}
				}
				return;
			}
			if (currentState == PrimaryState.FlareGun)
			{
				if (((TestVanDammeAnim)this).gunFrame > 0)
				{
					((TestVanDammeAnim)this).gunCounter = ((TestVanDammeAnim)this).gunCounter + ((Unit)this).t;
					if (((TestVanDammeAnim)this).gunCounter > 0.0334f)
					{
						((TestVanDammeAnim)this).gunCounter = ((TestVanDammeAnim)this).gunCounter - 0.0334f;
						((TestVanDammeAnim)this).gunFrame = ((TestVanDammeAnim)this).gunFrame - 1;
					}
				}
				((TestVanDammeAnim)this).SetGunSprite(((TestVanDammeAnim)this).gunFrame, 0);
				return;
			}
			((TestVanDammeAnim)this).gunCounter = ((TestVanDammeAnim)this).gunCounter + ((Unit)this).t;
			if (((TestVanDammeAnim)this).gunCounter > 0.07f)
			{
				((TestVanDammeAnim)this).gunCounter = ((TestVanDammeAnim)this).gunCounter - 0.07f;
				((TestVanDammeAnim)this).gunFrame = ((TestVanDammeAnim)this).gunFrame + 1;
				if (((TestVanDammeAnim)this).gunFrame == 3)
				{
					PlaySwapSound(((Component)this).transform.position);
				}
			}
			if (((TestVanDammeAnim)this).gunFrame > 5)
			{
				SwitchWeapon();
			}
			else
			{
				((TestVanDammeAnim)this).SetGunSprite(25 + ((TestVanDammeAnim)this).gunFrame, 0);
			}
		}

		public override void StartPilotingUnit(Unit pilottedUnit)
		{
			if (currentState == PrimaryState.Switching)
			{
				SwitchWeapon();
			}
			ReleaseUnit(throwUnit: false);
			((TestVanDammeAnim)this).fire = (((TestVanDammeAnim)this).wasFire = false);
			((TestVanDammeAnim)this).StartPilotingUnit(pilottedUnit);
		}

		protected void StartSwitchingWeapon()
		{
			if (!((TestVanDammeAnim)this).usingSpecial && currentState != PrimaryState.Switching && (Object)(object)((Unit)this).attachedToZipline == (Object)null)
			{
				((TestVanDammeAnim)this).CancelMelee();
				((TestVanDammeAnim)this).SetGestureAnimation((Gestures)0);
				if (currentState == PrimaryState.Crossbow)
				{
					nextState = PrimaryState.FlareGun;
				}
				else
				{
					nextState = PrimaryState.Crossbow;
				}
				currentState = PrimaryState.Switching;
				((TestVanDammeAnim)this).gunFrame = 0;
				((TestVanDammeAnim)this).gunCounter = 0f;
				((TestVanDammeAnim)this).fireDelay = 0f;
				((TestVanDammeAnim)this).RunGun();
			}
		}

		public void SwitchWeapon()
		{
			((TestVanDammeAnim)this).gunFrame = 0;
			((TestVanDammeAnim)this).gunCounter = 0f;
			currentState = nextState;
			if (currentState == PrimaryState.FlareGun)
			{
				((TestVanDammeAnim)this).gunSprite.meshRender.material = flareGunMat;
			}
			else
			{
				((TestVanDammeAnim)this).gunSprite.meshRender.material = crossbowMat;
			}
			if ((Object)(object)grabbedUnit != (Object)null)
			{
				((Component)holdingArm).gameObject.SetActive(true);
			}
			((TestVanDammeAnim)this).SetGunSprite(0, 0);
		}

		protected override void CheckInput()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Invalid comparison between Unknown and I4
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Invalid comparison between Unknown and I4
			((BroBase)this).CheckInput();
			if (!acceptedDeath && (int)((Unit)this).actionState != 5 && doubleTapSwitch && ((TestVanDammeAnim)this).down && !((TestVanDammeAnim)this).wasDown && (int)((Unit)this).actionState != 6)
			{
				if (Time.realtimeSinceStartup - lastDownPressTime < 0.2f)
				{
					StartSwitchingWeapon();
				}
				lastDownPressTime = Time.realtimeSinceStartup;
			}
		}

		public override void AttachToZipline(ZipLine zipLine)
		{
			if (currentState == PrimaryState.Switching)
			{
				SwitchWeapon();
			}
			((TestVanDammeAnim)this).AttachToZipline(zipLine);
		}

		protected override void SetMeleeType()
		{
			((TestVanDammeAnim)this).SetMeleeType();
			if (((TestVanDammeAnim)this).jumpingMelee && (((TestVanDammeAnim)this).right || ((TestVanDammeAnim)this).left))
			{
				((TestVanDammeAnim)this).dashingMelee = true;
			}
		}

		protected override void StartCustomMelee()
		{
			if ((Object)(object)grabbedUnit != (Object)null)
			{
				ReleaseUnit(throwUnit: true);
				return;
			}
			if (((BroBase)this).CanStartNewMelee())
			{
				((Unit)this).frame = 1;
				((TestVanDammeAnim)this).counter = -0.05f;
				((TestVanDammeAnim)this).AnimateMelee();
			}
			else if (((BroBase)this).CanStartMeleeFollowUp())
			{
				((TestVanDammeAnim)this).meleeFollowUp = true;
			}
			if (!((TestVanDammeAnim)this).jumpingMelee)
			{
				((TestVanDammeAnim)this).dashingMelee = true;
				((BroforceObject)this).xI = (float)((NetworkedUnit)this).Direction * ((TestVanDammeAnim)this).speed;
			}
			throwingMook = (Object)(object)((TestVanDammeAnim)this).nearbyMook != (Object)null && ((Unit)((TestVanDammeAnim)this).nearbyMook).CanBeThrown();
			if (!((TestVanDammeAnim)this).doingMelee)
			{
				((BroBase)this).StartMeleeCommon();
			}
		}

		protected override void AnimateCustomMelee()
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			((BroBase)this).AnimateMeleeCommon();
			if (!throwingMook)
			{
				((TestVanDammeAnim)this).frameRate = 0.07f;
			}
			((TestVanDammeAnim)this).sprite.SetLowerLeftPixel((float)((25 + ((Unit)this).frame) * ((TestVanDammeAnim)this).spritePixelWidth), (float)(9 * ((TestVanDammeAnim)this).spritePixelHeight));
			if (((Unit)this).frame == 2)
			{
				((TestVanDammeAnim)this).sound.PlaySoundEffectAt(meleeSwingSounds, 0.3f, ((Component)this).transform.position, 1f, true, false, true, 0f);
			}
			else if (((Unit)this).frame == 3)
			{
				((TestVanDammeAnim)this).counter = ((TestVanDammeAnim)this).counter - 0.066f;
				GrabUnit();
			}
			else if (((Unit)this).frame > 3 && !((TestVanDammeAnim)this).meleeHasHit)
			{
				GrabUnit();
			}
			if (((TestVanDammeAnim)this).meleeHasHit && (Object)(object)grabbedUnit != (Object)null)
			{
				switch (((Unit)this).frame)
				{
				case 3:
					targetHoldingXOffset = 5f;
					targetHoldingYOffset = 1f;
					isInterpolating = true;
					break;
				case 4:
					targetHoldingXOffset = 7f;
					targetHoldingYOffset = 2f;
					isInterpolating = true;
					break;
				case 5:
					targetHoldingXOffset = 9f;
					targetHoldingYOffset = 3f;
					isInterpolating = true;
					break;
				case 6:
					targetHoldingXOffset = 11f;
					targetHoldingYOffset = 4.5f;
					isInterpolating = true;
					break;
				}
			}
			else if (((Unit)this).frame == 5)
			{
				((Unit)this).frame = 0;
				((TestVanDammeAnim)this).CancelMelee();
			}
			if (((Unit)this).frame >= 7)
			{
				((Unit)this).frame = 0;
				((TestVanDammeAnim)this).CancelMelee();
			}
		}

		protected override void RunCustomMeleeMovement()
		{
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			if (((TestVanDammeAnim)this).jumpingMelee)
			{
				((TestVanDammeAnim)this).ApplyFallingGravity();
				if (((BroforceObject)this).yI < ((TestVanDammeAnim)this).maxFallSpeed)
				{
					((BroforceObject)this).yI = ((TestVanDammeAnim)this).maxFallSpeed;
				}
			}
			else if (((TestVanDammeAnim)this).dashingMelee)
			{
				if (((Unit)this).frame <= 1)
				{
					((BroforceObject)this).xI = 0f;
					((BroforceObject)this).yI = 0f;
				}
				else if (((Unit)this).frame <= 3)
				{
					if ((Object)(object)((TestVanDammeAnim)this).meleeChosenUnit == (Object)null)
					{
						if (!((TestVanDammeAnim)this).isInQuicksand)
						{
							((BroforceObject)this).xI = ((TestVanDammeAnim)this).speed * 1f * ((Component)this).transform.localScale.x;
						}
						((BroforceObject)this).yI = 0f;
					}
					else if (!((TestVanDammeAnim)this).isInQuicksand)
					{
						((BroforceObject)this).xI = ((TestVanDammeAnim)this).speed * 0.5f * ((Component)this).transform.localScale.x + (((BroforceObject)((TestVanDammeAnim)this).meleeChosenUnit).X - ((BroforceObject)this).X) * 2f;
					}
				}
				else if (((Unit)this).frame <= 5)
				{
					if (!((TestVanDammeAnim)this).isInQuicksand)
					{
						((BroforceObject)this).xI = ((TestVanDammeAnim)this).speed * 0.3f * ((Component)this).transform.localScale.x;
					}
					((TestVanDammeAnim)this).ApplyFallingGravity();
				}
				else
				{
					((TestVanDammeAnim)this).ApplyFallingGravity();
				}
			}
			else if (((BroforceObject)this).Y > ((TestVanDammeAnim)this).groundHeight + 1f)
			{
				((TestVanDammeAnim)this).CancelMelee();
			}
		}

		protected override void CancelMelee()
		{
			targetHoldingXOffset = 11f;
			targetHoldingYOffset = 4.5f;
			isInterpolating = true;
			if ((Object)(object)grabbedUnit != (Object)null)
			{
				SwitchToHoldingMaterials();
			}
			((BroBase)this).CancelMelee();
		}

		public static Unit GetNextClosestUnit(int playerNum, DirectionEnum direction, float xRange, float yRange, float x, float y, List<Unit> alreadyFoundUnits)
		{
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Invalid comparison between Unknown and I4
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Invalid comparison between Unknown and I4
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Invalid comparison between Unknown and I4
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Invalid comparison between Unknown and I4
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Invalid comparison between Unknown and I4
			if (Map.units == null)
			{
				return null;
			}
			float num = xRange;
			Unit val = null;
			for (int num2 = Map.units.Count - 1; num2 >= 0; num2--)
			{
				Unit val2 = Map.units[num2];
				if ((Object)(object)val2 != (Object)null && !val2.invulnerable && ((BroforceObject)val2).health > 0 && GameModeController.DoesPlayerNumDamage(playerNum, ((NetworkedUnit)val2).playerNum) && !alreadyFoundUnits.Contains(val2))
				{
					float num3 = ((BroforceObject)val2).Y + val2.height / 2f + 3f - y;
					if (Mathf.Abs(num3) - yRange < val2.height)
					{
						float num4 = ((BroforceObject)val2).X - x;
						if (Mathf.Abs(num4) - num < val2.width && (((int)direction == 3 && num3 < 0f) || ((int)direction == 2 && num3 > 0f) || ((int)direction == 5 && num4 > 0f) || ((int)direction == 4 && num4 < 0f) || (int)direction == 1))
						{
							val = val2;
							num = Mathf.Abs(num3);
						}
					}
				}
			}
			if ((Object)(object)val != (Object)null)
			{
				return val;
			}
			return null;
		}

		protected void GrabUnit()
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Invalid comparison between Unknown and I4
			bool flag = default(bool);
			Map.DamageDoodads(3, (DamageType)14, ((BroforceObject)this).X + (float)(((NetworkedUnit)this).Direction * 4), ((BroforceObject)this).Y, 0f, 0f, 6f, ((NetworkedUnit)this).playerNum, ref flag, (MonoBehaviour)null);
			((BroBase)this).KickDoors(24f);
			Unit nextClosestUnit = GetNextClosestUnit(((NetworkedUnit)this).playerNum, (DirectionEnum)((((Component)this).transform.localScale.x > 0f) ? 5 : 4), 22f, 14f, ((BroforceObject)this).X - ((Component)this).transform.localScale.x * 4f, ((BroforceObject)this).Y + ((Unit)this).height / 2f, new List<Unit>());
			if ((Object)(object)nextClosestUnit != (Object)null)
			{
				if (!nextClosestUnit.IsHeavy() && (int)nextClosestUnit.actionState != 12 && !(nextClosestUnit is MookDog) && (!(nextClosestUnit is AlienMosquito) || nextClosestUnit is HellLostSoul))
				{
					((TestVanDammeAnim)this).meleeHasHit = true;
					grabbedUnit = nextClosestUnit;
					grabbedUnits.Add(nextClosestUnit);
					nextClosestUnit.Panic(1000f, true);
					((NetworkedUnit)nextClosestUnit).playerNum = ((NetworkedUnit)this).playerNum;
					((Component)((TestVanDammeAnim)this).gunSprite).gameObject.layer = 28;
					((TestVanDammeAnim)this).doRollOnLand = false;
					holdingXOffset = 5f;
					holdingYOffset = 1f;
					targetHoldingXOffset = 5f;
					targetHoldingYOffset = 1f;
					if (nextClosestUnit is MookJetpack)
					{
						Traverse obj = Traverse.Create((object)((nextClosestUnit is MookJetpack) ? nextClosestUnit : null));
						object fieldValue = HarmonyExtensions.GetFieldValue((object)obj, "jetpackAudio");
						((AudioSource)((fieldValue is AudioSource) ? fieldValue : null)).Stop();
						HarmonyExtensions.SetFieldValue<bool>((object)obj, "jetpacksOn", false);
						HarmonyExtensions.SetFieldValue<bool>((object)obj, "spiralling", false);
					}
				}
				else
				{
					((TestVanDammeAnim)this).meleeHasHit = true;
					Map.KnockAndDamageUnit((MonoBehaviour)(object)this, nextClosestUnit, 5, (DamageType)14, 200f, 100f, (int)Mathf.Sign(((Component)this).transform.localScale.x), true, ((BroforceObject)this).X, ((BroforceObject)this).Y, false);
					((TestVanDammeAnim)this).sound.PlaySoundEffectAt(((TestVanDammeAnim)this).soundHolder.alternateMeleeHitSound, 0.3f, ((Component)this).transform.position, 1f, true, false, false, 0f);
					EffectsController.CreateProjectilePopWhiteEffect(((BroforceObject)this).X + (((Unit)this).width + 4f) * ((Component)this).transform.localScale.x, ((BroforceObject)this).Y + ((Unit)this).height + 4f);
				}
			}
			else
			{
				((TestVanDammeAnim)this).meleeHasHit = ((BroBase)this).TryMeleeTerrain(4, 4);
			}
		}

		protected void ReleaseUnit(bool throwUnit)
		{
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)grabbedUnit != (Object)null)
			{
				unitWasGrabbed = false;
				((NetworkedUnit)grabbedUnit).playerNum = -1;
				if (grabbedUnit is Mook)
				{
					Unit obj = grabbedUnit;
					Mook val = (Mook)(object)((obj is Mook) ? obj : null);
					val.blindTime = 0f;
					if (throwUnit)
					{
						((TestVanDammeAnim)this).ThrowBackMook(val);
					}
				}
				else if (grabbedUnit is Animal)
				{
					Unit obj2 = grabbedUnit;
					Unit obj3 = ((obj2 is Animal) ? obj2 : null);
					HarmonyExtensions.SetFieldValue<float>((object)Traverse.Create((object)grabbedUnit), "blindTime", 0f);
					((TestVanDammeAnim)obj3).xIBlast = ((Component)this).transform.localScale.x * 450f;
					((BroforceObject)obj3).yI = 300f;
				}
				((Component)((TestVanDammeAnim)this).gunSprite).gameObject.layer = 19;
				grabbedUnits.Remove(grabbedUnit);
				grabbedUnit = null;
				SwitchToNormalMaterials();
				((TestVanDammeAnim)this).ChangeFrame();
			}
			((TestVanDammeAnim)this).doRollOnLand = true;
		}

		protected void SwitchToHoldingMaterials()
		{
			crossbowMat = crossbowHoldingMat;
			flareGunMat = flareGunHoldingMat;
			if (currentState == PrimaryState.Crossbow)
			{
				((TestVanDammeAnim)this).gunSprite.meshRender.material = crossbowMat;
			}
			else if (currentState == PrimaryState.FlareGun)
			{
				((TestVanDammeAnim)this).gunSprite.meshRender.material = flareGunMat;
			}
			((Component)holdingArm).gameObject.SetActive(true);
		}

		protected void SwitchToNormalMaterials()
		{
			crossbowMat = crossbowNormalMat;
			((Component)holdingArm).gameObject.SetActive(false);
			flareGunMat = flareGunNormalMat;
			if (currentState == PrimaryState.Crossbow)
			{
				((TestVanDammeAnim)this).gunSprite.meshRender.material = crossbowMat;
			}
			else if (currentState == PrimaryState.FlareGun)
			{
				((TestVanDammeAnim)this).gunSprite.meshRender.material = flareGunMat;
			}
		}

		public override void Damage(int damage, DamageType damageType, float xI, float yI, int direction, MonoBehaviour damageSender, float hitX, float hitY)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Invalid comparison between Unknown and I4
			//IL_0040: 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)
			if (((int)damageType == 2 || (int)damageType == 1 || (int)damageType == 22) && (Object)(object)grabbedUnit != (Object)null && (float)direction != ((Component)this).transform.localScale.x)
			{
				Unit obj = grabbedUnit;
				ReleaseUnit(throwUnit: false);
				obj.Damage(damage * 2, damageType, xI, yI, direction, damageSender, hitX, hitY);
				((Unit)this).Knock(damageType, xI, yI, false);
			}
			else
			{
				((BroBase)this).Damage(damage, damageType, xI, yI, direction, damageSender, hitX, hitY);
			}
		}

		public override void SetGestureAnimation(Gestures gesture)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Invalid comparison between Unknown and I4
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			if (!((TestVanDammeAnim)this).doingMelee)
			{
				if ((int)gesture == 4)
				{
					ReleaseUnit(throwUnit: false);
				}
				((BroBase)this).SetGestureAnimation(gesture);
			}
		}

		protected void ClearCurrentWarRig()
		{
			currentWarRig = null;
		}

		private Vector3 DetermineWarRigSpawn()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			if (((Component)this).transform.localScale.x > 0f)
			{
				return new Vector3(SortOfFollow.GetScreenMinX() - 65f, ((BroforceObject)this).Y, 0f);
			}
			return new Vector3(SortOfFollow.GetScreenMaxX() + 65f, ((BroforceObject)this).Y, 0f);
		}

		protected override void UseSpecial()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			if (((TestVanDammeAnim)this).SpecialAmmo > 0 && (Object)(object)((TestVanDammeAnim)this).specialGrenade != (Object)null)
			{
				int specialAmmo = ((TestVanDammeAnim)this).SpecialAmmo;
				((TestVanDammeAnim)this).SpecialAmmo = specialAmmo - 1;
				ClearCurrentWarRig();
				currentWarRig = Object.Instantiate<WarRig>(warRigPrefab, DetermineWarRigSpawn(), Quaternion.identity);
				currentWarRig.SetTarget(this, ((BroforceObject)this).X + ((Component)this).transform.localScale.x * 10f, new Vector3(((Component)this).transform.localScale.x, ((Component)currentWarRig).transform.localScale.y, ((Component)currentWarRig).transform.localScale.z), ((Component)this).transform.localScale.x);
				((Component)currentWarRig).gameObject.SetActive(true);
				if (((TestVanDammeAnim)this).special)
				{
					holdingSpecial = true;
					holdingSpecialTime = 0f;
				}
			}
			else
			{
				HeroController.FlashSpecialAmmo(((NetworkedUnit)this).playerNum);
				((TestVanDammeAnim)this).ActivateGun();
			}
			((TestVanDammeAnim)this).pressSpecialFacingDirection = 0;
		}

		public void GoPastFuriosa()
		{
			currentWarRig.keepGoingBeyondTarget = true;
			if (currentWarRig.summonedDirection == 1f)
			{
				currentWarRig.secondTargetX = SortOfFollow.GetScreenMaxX() - 20f;
			}
			else
			{
				currentWarRig.secondTargetX = SortOfFollow.GetScreenMinX() + 20f;
			}
			holdingSpecial = false;
		}

		public void ClearInvulnerability()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			((TestVanDammeAnim)this).invulnerableTime = 0f;
			((Unit)this).invulnerable = false;
			((Component)this).GetComponent<Renderer>().material.SetColor("_TintColor", Color.gray);
			crossbowNormalMat.SetColor("_TintColor", Color.gray);
			crossbowHoldingMat.SetColor("_TintColor", Color.gray);
			flareGunNormalMat.SetColor("_TintColor", Color.gray);
			flareGunHoldingMat.SetColor("_TintColor", Color.gray);
			((Renderer)holdingArm).material.SetColor("_TintColor", Color.gray);
		}
	}
	internal class HarmonyPatches
	{
		[HarmonyPatch(typeof(TestVanDammeAnim), "RunBlindStars")]
		private static class TestVanDammeAnim_RunBlindStars_Patch
		{
			public static bool Prefix(Mook __instance)
			{
				if (Furibrosa.grabbedUnits.Contains((Unit)(object)__instance))
				{
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(TestVanDammeAnim), "EvaluateIsJumping")]
		private static class TestVanDammeAnim_EvaluateIsJumping_Patch
		{
			public static bool Prefix(TestVanDammeAnim __instance)
			{
				if (Furibrosa.grabbedUnits.Contains((Unit)(object)__instance))
				{
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(Mook), "Land")]
		private static class Mook_Land_Patch
		{
			public static bool Prefix(Mook __instance)
			{
				if (Furibrosa.grabbedUnits.Contains((Unit)(object)__instance))
				{
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(Mook), "GetGroundHeightGround")]
		private static class Mook_GetGroundHeightGround_Patch
		{
			public static bool Prefix(Mook __instance, ref float __result)
			{
				if (Furibrosa.grabbedUnits.Contains((Unit)(object)__instance))
				{
					__result = ((BroforceObject)__instance).Y;
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(TestVanDammeAnim), "RunAvatarRunning")]
		private static class TestVanDammeAnim_RunAvatarRunning_Patch
		{
			public static bool Prefix(TestVanDammeAnim __instance)
			{
				if (Furibrosa.grabbedUnits.Contains((Unit)(object)__instance))
				{
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(Mook), "IsOnGround")]
		private static class Mook_IsOnGround_Patch
		{
			public static bool Prefix(Mook __instance, ref bool __result)
			{
				if (Furibrosa.grabbedUnits.Contains((Unit)(object)__instance))
				{
					__result = true;
					return false;
				}
				return true;
			}
		}
	}
	public class Harpoon : PredabroSpear
	{
		public SpriteSM sprite;

		protected override void Awake()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Expected O, but got Unknown
			((Projectile)this).canMakeEffectsMoreThanOnce = true;
			((BrocheteMachete)this).stunOnHit = false;
			((Projectile)this).groundLayer = LayerMask.op_Implicit((1 << LayerMask.NameToLayer("Ground")) | (1 << LayerMask.NameToLayer("LargeObjects")) | (1 << LayerMask.NameToLayer("FLUI")));
			((Projectile)this).barrierLayer = LayerMask.op_Implicit((1 << LayerMask.NameToLayer("MobileBarriers")) | (1 << LayerMask.NameToLayer("IndestructibleGround")));
			((Projectile)this).friendlyBarrierLayer = LayerMask.op_Implicit(1 << LayerMask.NameToLayer("FriendlyBarriers"));
			((Projectile)this).fragileLayer = LayerMask.op_Implicit(1 << LayerMask.NameToLayer("DirtyHippie"));
			((Projectile)this).zOffset = (1f - Random.value * 2f) * 0.04f;
			((Projectile)this).random = new Randomf(Random.Range(0, 10000));
		}

		private void OnDisable()
		{
			if (base.stuckInPlace)
			{
				((Projectile)this).Death();
			}
		}

		public void Setup()
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: 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_01f6: Expected O, but got Unknown
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_0316: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0330: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			Material material2 = (((Renderer)((Component)this).gameObject.GetComponent<MeshRenderer>()).material = ResourcesController.GetMaterial(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "harpoon.png"));
			sprite = ((Component)this).gameObject.GetComponent<SpriteSM>();
			sprite.lowerLeftPixel = new Vector2(-3f, 10f);
			sprite.pixelDimensions = new Vector2(17f, 3f);
			((SpriteBase)sprite).plane = (SPRITE_PLANE)0;
			((SpriteBase)sprite).width = 17f;
			((SpriteBase)sprite).height = 5f;
			((SpriteBase)sprite).offset = new Vector3(-10.5f, 0f, 10.82f);
			BoxCollider component = ((Component)this).gameObject.GetComponent<BoxCollider>();
			component.center = new Vector3(0f, 0.5f, 8f);
			component.size = new Vector3(26f, 2f, 0f);
			base.groundLayersCrushLeft = 5;
			((BrocheteMachete)this).maxPenetrations = 8;
			((Projectile)this).life = 0.44f;
			((BrocheteMachete)this).unimpalementDamage = 8;
			((BrocheteMachete)this).trailDist = 12f;
			((BrocheteMachete)this).stunOnHit = false;
			((BrocheteMachete)this).rotationSpeed = 0f;
			((BrocheteMachete)this).dragUnitsSpeedM = 0.9f;
			((Projectile)this).projectileSize = 14f;
			((Projectile)this).damage = 30;
			((Projectile)this).damageInternal = 30;
			((Projectile)this).fullDamage = 30;
			((Projectile)this).fadeDamage = false;
			((Projectile)this).damageType = (DamageType)0;
			((Projectile)this).canHitGrenades = true;
			((Projectile)this).affectScenery = true;
			((Projectile)this).horizontalProjectile = true;
			((Projectile)this).isWideProjectile = false;
			((Projectile)this).canReflect = true;
			((Projectile)this).canMakeEffectsMoreThanOnce = true;
			base.platformCollider = (Collider)(object)new GameObject("HarpoonCollider", new Type[1] { typeof(BoxCollider) }).GetComponent<BoxCollider>();
			base.platformCollider.enabled = false;
			((Component)base.platformCollider).transform.parent = ((Component)this).transform;
			base.platformCollider.material = new PhysicMaterial();
			base.platformCollider.material.dynamicFriction = 0.6f;
			base.platformCollider.material.staticFriction = 0.6f;
			base.platformCollider.material.bounciness = 0f;
			base.platformCollider.material.frictionCombine = (PhysicMaterialCombine)0;
			base.platformCollider.material.bounceCombine = (PhysicMaterialCombine)0;
			((Component)base.platformCollider).gameObject.layer = 15;
			Collider platformCollider = base.platformCollider;
			((BoxCollider)((platformCollider is BoxCollider) ? platformCollider : null)).center = new Vector3(0f, 2f, 0f);
			Collider platformCollider2 = base.platformCollider;
			((BoxCollider)((platformCollider2 is BoxCollider) ? platformCollider2 : null)).size = new Vector3(20f, 1f, 1f);
			GameObject val = new GameObject("HarpoonForeground", new Type[3]
			{
				typeof(MeshFilter),
				typeof(MeshRenderer),
				typeof(SpriteSM)
			});
			val.transform.parent = ((Component)this).transform;
			((Renderer)val.GetComponent<MeshRenderer>()).material = material2;
			SpriteSM component2 = val.GetComponent<SpriteSM>();
			component2.lowerLeftPixel = new Vector2(14f, 10f);
			component2.pixelDimensions = new Vector2(20f, 3f);
			((SpriteBase)component2).plane = (SPRITE_PLANE)0;
			((SpriteBase)component2).width = 20f;
			((SpriteBase)component2).height = 5f;
			((SpriteBase)component2).offset = new Vector3(-1f, 0f, 0f);
			val.transform.localPosition = new Vector3(9f, 0f, -0.62f);
		}

		public override void Fire(float newX, float newY, float xI, float yI, float _zOffset, int playerNum, MonoBehaviour FiredBy)
		{
			((Component)this).gameObject.SetActive(true);
			((Projectile)this).Fire(newX, newY, xI, yI, _zOffset, playerNum, FiredBy);
		}

		protected override void CheckSpawnPoint()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: 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_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: 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_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			((Projectile)this).CheckWallsAtSpawnPoint();
			bool flag = default(bool);
			Map.DamageDoodads(((Projectile)this).damageInternal, ((Projectile)this).damageType, ((BroforceObject)this).X, ((BroforceObject)this).Y, ((BroforceObject)this).xI, ((BroforceObject)this).yI, ((Projectile)this).projectileSize, ((Projectile)this).playerNum, ref flag, (MonoBehaviour)(object)this);
			((Projectile)this).RegisterProjectile();
			((Projectile)this).CheckReturnZones();
			if ((((Projectile)this).canReflect && ((Projectile)this).playerNum >= 0 && ((Projectile)this).horizontalProjectile && Physics.Raycast(new Vector3(((BroforceObject)this).X - Mathf.Sign(((BroforceObject)this).xI) * ((Projectile)this).projectileSize * 2f, ((BroforceObject)this).Y, 0f), new Vector3(((BroforceObject)this).xI, ((BroforceObject)this).yI, 0f), ref ((Projectile)this).raycastHit, ((Projectile)this).projectileSize * 3f, LayerMask.op_Implicit(((Projectile)this).barrierLayer))) || (!((Projectile)this).horizontalProjectile && Physics.Raycast(new Vector3(((BroforceObject)this).X, ((BroforceObject)this).Y, 0f), new Vector3(((BroforceObject)this).xI, ((BroforceObject)this).yI, 0f), ref ((Projectile)this).raycastHit, ((Projectile)this).projectileSize + ((Projectile)this).startProjectileSpeed * ((Projectile)this).t, LayerMask.op_Implicit(((Projectile)this).barrierLayer))))
			{
				((Projectile)this).ReflectProjectile(((Projectile)this).raycastHit);
			}
			else if ((((Projectile)this).canReflect && ((Projectile)this).playerNum < 0 && ((Projectile)this).horizontalProjectile && Physics.Raycast(new Vector3(((BroforceObject)this).X - Mathf.Sign(((BroforceObject)this).xI) * ((Projectile)this).projectileSize * 2f, ((BroforceObject)this).Y, 0f), new Vector3(((BroforceObject)this).xI, ((BroforceObject)this).yI, 0f), ref ((Projectile)this).raycastHit, ((Projectile)this).projectileSize * 3f, LayerMask.op_Implicit(((Projectile)this).friendlyBarrierLayer))) || (!((Projectile)this).horizontalProjectile && Physics.Raycast(new Vector3(((BroforceObject)this).X, ((BroforceObject)this).Y, 0f), new Vector3(((BroforceObject)this).xI, ((BroforceObject)this).yI, 0f), ref ((Projectile)this).raycastHit, ((Projectile)this).projectileSize + ((Projectile)this).startProjectileSpeed * ((Projectile)this).t, LayerMask.op_Implicit(((Projectile)this).friendlyBarrierLayer))))
			{
				((Projectile)this).playerNum = 5;
				((Projectile)this).firedBy = null;
				((Projectile)this).ReflectProjectile(((Projectile)this).raycastHit);
			}
			else
			{
				((Projectile)this).TryHitUnitsAtSpawn();
			}
			((Projectile)this).CheckSpawnPointFragile();
		}

		protected override bool CheckWallsAtSpawnPoint()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			Collider[] array = Physics.OverlapSphere(new Vector3(((BroforceObject)this).X, ((BroforceObject)this).Y, 0f), 5f, LayerMask.op_Implicit(((Projectile)this).groundLayer));
			bool result = false;
			if (array.Length != 0)
			{
				for (int i = 0; i < array.Length; i++)
				{
					Collider val = null;
					if ((Object)(object)((Projectile)this).firedBy != (Object)null)
					{
						val = ((Component)((Projectile)this).firedBy).GetComponent<Collider>();
					}
					if ((Object)(object)((Projectile)this).firedBy == (Object)null || (Object)(object)array[i] != (Object)(object)val)
					{
						((Projectile)this).ProjectileApplyDamageToBlock(((Component)array[i]).gameObject, ((Projectile)this).damageInternal, ((Projectile)this).damageType, ((BroforceObject)this).xI, ((BroforceObject)this).yI);
						result = true;
					}
				}
			}
			return result;
		}

		protected override void Update()
		{
			((BrocheteMachete)this).Update();
		}

		protected override void HitUnits()
		{
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: 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_01c9: Unknown result type (might be due to invalid IL or missing references)
			if (((BrocheteMachete)this).penetrationsCount >= ((BrocheteMachete)this).maxPenetrations)
			{
				return;
			}
			Unit firstUnit = Map.GetFirstUnit(((Projectile)this).firedBy, ((Projectile)this).playerNum, 10f, ((BroforceObject)this).X, ((BroforceObject)this).Y, true, true, ((BrocheteMachete)this).hitUnits);
			if (!((Object)(object)firstUnit != (Object)null))
			{
				return;
			}
			if (firstUnit.IsHeavy())
			{
				((BrocheteMachete)this).hitUnits.Add(firstUnit);
				firstUnit.Damage(((Projectile)this).damageInternal, (DamageType)7, ((BroforceObject)this).xI, ((BroforceObject)this).yI, (int)Mathf.Sign(((BroforceObject)this).xI), ((Projectile)this).firedBy, ((BroforceObject)this).X, ((BroforceObject)this).Y);
				((Projectile)this).MakeEffects(false, ((BroforceObject)this).X, ((BroforceObject)this).Y, false, ((RaycastHit)(ref ((Projectile)this).raycastHit)).normal, ((RaycastHit)(ref ((Projectile)this).raycastHit)).point);
				Sound.GetInstance().PlaySoundEffectAt(((Projectile)this).soundHolder.specialSounds, 0.4f, ((Component)this).transform.position, 1f, true, false, false, 0f);
				if (BroMakerUtilities.IsBoss(firstUnit))
				{
					((Projectile)this).Death();
				}
				return;
			}
			((BrocheteMachete)this).hitUnits.Add(firstUnit);
			if (((BrocheteMachete)this).stunOnHit)
			{
				firstUnit.Blind();
			}
			firstUnit.Impale(((Component)this).transform, Vector3.right * Mathf.Sign(((BroforceObject)this).xI), ((Projectile)this).damageInternal, ((BroforceObject)this).xI, ((BroforceObject)this).yI, 0f, 1f);
			((BroforceObject)firstUnit).Y = ((BroforceObject)this).Y - 8f;
			if (firstUnit is Mook)
			{
				firstUnit.useImpaledFrames = true;
			}
			Sound.GetInstance().PlaySoundEffectAt(((Projectile)this).soundHolder.specialSounds, 0.5f, ((Component)this).transform.position, 1f, true, false, false, 0f);
			((BrocheteMachete)this).penetrationsCount = ((BrocheteMachete)this).penetrationsCount + 1;
			SortOfFollow.Shake(0.3f);
			EffectsController.CreateBloodParticles(firstUnit.bloodColor, ((BroforceObject)this).X, ((BroforceObject)this).Y, 4, 4f, 5f, 60f, ((BroforceObject)this).xI * 0.2f, ((BroforceObject)this).yI * 0.5f + 40f);
			EffectsController.CreateMeleeStrikeEffect(((BroforceObject)this).X, ((BroforceObject)this).Y, ((BroforceObject)this).xI * 0.2f, ((BroforceObject)this).yI * 0.5f + 24f);
			if (((BroforceObject)this).xI > 0f)
			{
				if (((BroforceObject)firstUnit).X < ((BroforceObject)this).X + 3f)
				{
					((BroforceObject)firstUnit).X = ((BroforceObject)this).X + 3f;
				}
			}
			else if (((BroforceObject)this).xI < 0f && ((BroforceObject)firstUnit).X > ((BroforceObject)this).X - 3f)
			{
				((BroforceObject)firstUnit).X = ((BroforceObject)this).X - 3f;
			}
		}

		protected override void Bounce(RaycastHit raycastHit)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			if (base.groundLayersCrushLeft > 0 && GameObjectExtensions.HasComponent<DamageRelay>(((Component)((RaycastHit)(ref raycastHit)).collider).gameObject))
			{
				base.groundLayersCrushLeft = 1;
				((Projectile)this).damage = 45;
			}
			((PredabroSpear)this).Bounce(raycastHit);
			((Projectile)this).damage = 30;
		}

		protected override void MakeEffects(bool particles, float x, float y, bool useRayCast, Vector3 hitNormal, Vector3 hitPoint)
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: 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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: 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_0118: Unknown result type (might be due to invalid IL or missing references)
			if (((Projectile)this).hasMadeEffects && !((Projectile)this).canMakeEffectsMoreThanOnce)
			{
				return;
			}
			if (useRayCast)
			{
				if (particles)
				{
					EffectsController.CreateSparkShower(hitPoint.x + hitNormal.x * 3f, hitPoint.y + hitNormal.y * 3f, ((Projectile)this).sparkCount, 2f, 60f, hitNormal.x * 60f, hitNormal.y * 30f, 0.2f, 0f);
				}
				EffectsController.CreateProjectilePopEffect(hitPoint.x + hitNormal.x * 3f, hitPoint.y + hitNormal.y * 3f);
			}
			else
			{
				if (particles)
				{
					EffectsController.CreateSparkShower(x, y, 10, 2f, 60f, (0f - ((BroforceObject)this).xI) * 0.2f, 35f, 0.2f, 0f);
					EffectsController.CreateShrapnel(((Projectile)this).shrapnel, x, y, 5f, 20f, 6f, 0f, 0f);
				}
				EffectsController.CreateProjectilePopEffect(x, y);
			}
			if (!particles)
			{
				bool flag = default(bool);
				Map.DamageDoodads(((Projectile)this).damageInternal, ((Projectile)this).damageType, x, y, ((BroforceObject)this).xI, ((BroforceObject)this).yI, 8f, ((Projectile)this).playerNum, ref flag, (MonoBehaviour)(object)this);
			}
			((Projectile)this).hasMadeEffects = true;
		}
	}
	public class WarRig : Mook
	{
		public enum FuriosaState
		{
			InVehicle,
			GoingOut,
			HangingOut,
			GoingIn
		}

		private string directoryPath;

		public Unit pilotUnit;

		public bool pilotted;

		public Furibrosa summoner;

		protected bool pilotIsFuribrosa;

		protected int previousLayer;

		protected MobileSwitch pilotSwitch;

		protected bool hasResetDamage;

		protected float shieldDamage;

		public bool hasBeenPiloted;

		protected int fireAmount;

		protected int knockCount;

		public bool alwaysKnockOnExplosions;

		protected float pilotUnitDelay;

		protected bool fixedBubbles;

		public Material specialSprite;

		protected PlayerHUD hud;

		public const int maxDamageBeforeExploding = 100;

		protected int deathCount;

		protected float smokeCounter;

		protected float deathCountdownCounter;

		protected float deathCountdown;

		protected int deathCountdownExplodeThreshold = 20;

		private readonly List<MonoBehaviour> recentlyHitBy = new List<MonoBehaviour>();

		protected float hitCooldown;

		protected bool gibbed;

		protected float wheelsCounter;

		protected int wheelsFrame;

		protected int crushingGroundLayers;

		protected float fallDamageHurtSpeed = -450f;

		protected float fallDamageHurtSpeedHero = -550f;

		protected float fallDamageDeathSpeed = -600f;

		protected float fallDamageDeathSpeedHero = -750f;

		protected float boostFuel = 1f;

		protected const float originalGroundFriction = 0.75f;

		protected float groundFriction = 0.75f;

		protected float lastDashTime = -5f;

		protected float frontHeadHeight;

		protected float distanceToFront;

		protected float distanceToBack;

		public BoxCollider platform;

		protected int crushDamage = 5;

		protected float crushXRange = 30f;

		protected float crushYRange = 50f;

		protected float crushXOffset = 53f;

		protected float crushYOffset = 30f;

		protected float unitXRange = 6f;

		protected float unitYRange = 30f;

		protected float crushDamageCooldown;

		protected const floa