Decompiled source of Mission Impossibro v1.1.0

UMM/BroMaker_Storage/Mission Impossibro/Mission Impossibro.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using BroMakerLib;
using BroMakerLib.CustomObjects.Bros;
using BroMakerLib.CustomObjects.Projectiles;
using HarmonyLib;
using RocketLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Bro Template")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Bro Template")]
[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")]
namespace Mission_Impossibro;

[HeroPreset(/*Could not decode attribute arguments.*/)]
public class MissionImpossibro : CustomHero
{
	private Material normalMaterial;

	private Material stealthMaterial;

	private Material normalGunMaterial;

	private Material stealthGunMaterial;

	private Material normalAvatarMaterial;

	private Material stealthAvatarMaterial;

	private bool wasInvulnerable;

	public AudioClip[] tranqGunSounds;

	public AudioClip[] detonatorSound;

	private TranqDart lastFiredTranq;

	private float fireCooldown;

	protected const float bulletSpeed = 600f;

	protected bool wallHangFiring;

	public static Dictionary<Unit, int> bossHitCounter = new Dictionary<Unit, int>();

	protected const float originalFireRate = 0.3f;

	private LineRenderer grappleLine;

	protected Vector3 grappleHitPoint;

	protected const float grappleRange = 300f;

	protected const float grappleSpeed = 200f;

	protected float grappleMaterialScale = 0.25f;

	protected float grappleMaterialOffset = 0.25f;

	protected Vector3 grappleOffset = new Vector3(0f, 14f, 0f);

	protected bool grappleAttached;

	protected float grappleCooldown;

	protected bool exitingGrapple;

	protected int grappleFrame;

	protected bool wasAttachedToBlock;

	protected Block grappleAttachBlock;

	public int checkCeilingForHangRadius = 6;

	protected float specialTime;

	protected bool stealthActive;

	protected bool triggeringExplosives;

	protected bool readyToDetonate;

	protected int usingSpecialFrame;

	protected List<Explosive> currentExplosives;

	protected const int MaxExplosives = 5;

	protected Explosive explosivePrefab;

	protected bool isElbowSlamming;

	protected bool playedTriggerSound;

	protected ExplosiveGum gumPrefab;

	protected float sachelPackCooldown;

	protected bool acceptedDeath;

	public static bool jsonLoaded = false;

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

	[SaveableSetting(null)]
	public static bool PressKeyToToggleGrapple = false;

	public static KeyBindingForPlayers toggleGrappleKey = AllModKeyBindings.LoadKeyBinding("Mission Impossibro", "Toggle Grapple");

	protected override void Awake()
	{
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		((CustomHero)this).Awake();
		((Unit)this).projectile = (Projectile)(object)CustomProjectile.CreatePrefab<TranqDart>();
		explosivePrefab = CustomSachelPack.CreatePrefab<Explosive>();
		gumPrefab = CustomSachelPack.CreatePrefab<ExplosiveGum>();
		grappleLine = new GameObject("GrappleLine", new Type[1] { typeof(LineRenderer) }).GetComponent<LineRenderer>();
		((Component)grappleLine).transform.parent = ((Component)this).transform;
		((Renderer)grappleLine).material = ResourcesController.GetMaterial(((CustomHero)this).DirectoryPath, "line.png");
		((Renderer)grappleLine).material.mainTexture.wrapMode = (TextureWrapMode)0;
		((BroBase)this).meleeType = (MeleeType)1;
		((BroBase)this).currentMeleeType = (MeleeType)1;
		((TestVanDammeAnim)this).gunSpriteHangingFrame = 9;
		((TestVanDammeAnim)this).canCeilingHang = true;
	}

	public override void PreloadAssets()
	{
		CustomHero.PreloadSprites(((CustomHero)this).DirectoryPath, new List<string> { "spriteStealth.png", "gunSpriteStealth.png", "avatar.png", "avatarStealth.png" });
		CustomHero.PreloadSprites(((CustomHero)this).ProjectilePath, new List<string> { "TranqDart.png", "Explosive.png", "ExplosiveGum.png" });
		CustomHero.PreloadSounds(((CustomHero)this).SoundPath, new List<string>
		{
			"gun1.wav", "gun2.wav", "gun3.wav", "gun4.wav", "gun5.wav", "gun6.wav", "gun7.wav", "Click_Metal1.wav", "Click_Metal2.wav", "Click_Metal3.wav",
			"Click_Metal5.wav", "Click_Metal6.wav"
		});
	}

	public override void AfterPrefabSetup()
	{
		if (tranqGunSounds == null)
		{
			tranqGunSounds = (AudioClip[])(object)new AudioClip[7];
			tranqGunSounds[0] = ResourcesController.GetAudioClip(((CustomHero)this).SoundPath, "gun1.wav");
			tranqGunSounds[1] = ResourcesController.GetAudioClip(((CustomHero)this).SoundPath, "gun2.wav");
			tranqGunSounds[2] = ResourcesController.GetAudioClip(((CustomHero)this).SoundPath, "gun3.wav");
			tranqGunSounds[3] = ResourcesController.GetAudioClip(((CustomHero)this).SoundPath, "gun4.wav");
			tranqGunSounds[4] = ResourcesController.GetAudioClip(((CustomHero)this).SoundPath, "gun5.wav");
			tranqGunSounds[5] = ResourcesController.GetAudioClip(((CustomHero)this).SoundPath, "gun6.wav");
			tranqGunSounds[6] = ResourcesController.GetAudioClip(((CustomHero)this).SoundPath, "gun7.wav");
		}
		if (detonatorSound == null)
		{
			detonatorSound = (AudioClip[])(object)new AudioClip[5];
			detonatorSound[0] = ResourcesController.GetAudioClip(((CustomHero)this).SoundPath, "Click_Metal1.wav");
			detonatorSound[1] = ResourcesController.GetAudioClip(((CustomHero)this).SoundPath, "Click_Metal2.wav");
			detonatorSound[2] = ResourcesController.GetAudioClip(((CustomHero)this).SoundPath, "Click_Metal3.wav");
			detonatorSound[3] = ResourcesController.GetAudioClip(((CustomHero)this).SoundPath, "Click_Metal5.wav");
			detonatorSound[4] = ResourcesController.GetAudioClip(((CustomHero)this).SoundPath, "Click_Metal6.wav");
		}
	}

	public override void UIOptions()
	{
		GUILayout.Space(10f);
		int num = default(int);
		if (toggleGrappleKey.OnGUI(ref num, GUI.tooltip == string.Empty))
		{
			PressKeyToToggleGrapple = true;
		}
		GUILayout.Space(10f);
		if (JumpToToggleGrapple != (JumpToToggleGrapple = GUILayout.Toggle(JumpToToggleGrapple, "Toggle grapple with jump button", (GUILayoutOption[])(object)new GUILayoutOption[0])))
		{
			((CustomHero)this).SaveSettings();
		}
		if (PressKeyToToggleGrapple != (PressKeyToToggleGrapple = GUILayout.Toggle(PressKeyToToggleGrapple, "Toggle grapple with custom keybinding", (GUILayoutOption[])(object)new GUILayoutOption[0])))
		{
			((CustomHero)this).SaveSettings();
		}
	}

	protected override void Start()
	{
		((CustomHero)this).Start();
		normalMaterial = ((TestVanDammeAnim)this).material;
		stealthMaterial = ResourcesController.GetMaterial(((CustomHero)this).DirectoryPath, "spriteStealth.png");
		normalGunMaterial = ((TestVanDammeAnim)this).gunSprite.meshRender.material;
		stealthGunMaterial = ResourcesController.GetMaterial(((CustomHero)this).DirectoryPath, "gunSpriteStealth.png");
		normalAvatarMaterial = ResourcesController.GetMaterial(((CustomHero)this).DirectoryPath, "avatar.png");
		stealthAvatarMaterial = ResourcesController.GetMaterial(((CustomHero)this).DirectoryPath, "avatarStealth.png");
	}

	protected override void Update()
	{
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_0239: Unknown result type (might be due to invalid IL or missing references)
		//IL_023f: Invalid comparison between Unknown and I4
		if (((Unit)this).invulnerable)
		{
			wasInvulnerable = true;
		}
		((BroBase)this).Update();
		if (acceptedDeath)
		{
			if (((BroforceObject)this).health <= 0 && !((TestVanDammeAnim)this).WillReviveAlready)
			{
				return;
			}
			((TestVanDammeAnim)this).usingSpecial = false;
			((Component)this).GetComponent<Renderer>().material = normalMaterial;
			((TestVanDammeAnim)this).gunSprite.meshRender.material = normalGunMaterial;
			stealthActive = false;
			acceptedDeath = false;
		}
		if (wasInvulnerable && !((Unit)this).invulnerable)
		{
			normalMaterial.SetColor("_TintColor", Color.gray);
			stealthMaterial.SetColor("_TintColor", Color.gray);
			((TestVanDammeAnim)this).gunSprite.meshRender.material.SetColor("_TintColor", Color.gray);
		}
		sachelPackCooldown -= ((Unit)this).t;
		if (fireCooldown > 0f)
		{
			fireCooldown -= ((Unit)this).t;
		}
		if (grappleCooldown > 0f)
		{
			grappleCooldown -= ((Unit)this).t;
		}
		if (specialTime > 0f)
		{
			specialTime -= ((Unit)this).t;
			if (specialTime <= 0f)
			{
				StartDetonating();
			}
		}
		if (wallHangFiring && !((TestVanDammeAnim)this).wallDrag)
		{
			wallHangFiring = false;
		}
		if (grappleAttached)
		{
			if (JumpToToggleGrapple && ((TestVanDammeAnim)this).buttonJump && !((TestVanDammeAnim)this).wasButtonJump && grappleCooldown <= 0f)
			{
				DetachGrapple();
			}
			else if (PressKeyToToggleGrapple && toggleGrappleKey[((NetworkedUnit)this).playerNum].PressedDown() && grappleCooldown <= 0f)
			{
				DetachGrapple();
			}
			else if ((((TestVanDammeAnim)this).right || ((TestVanDammeAnim)this).left) && CloseEnoughToClimbAlongCeiling())
			{
				DetachGrapple();
				((TestVanDammeAnim)this).StartHanging();
			}
		}
		if (PressKeyToToggleGrapple && toggleGrappleKey[((NetworkedUnit)this).playerNum].PressedDown() && !grappleAttached && grappleCooldown <= 0f && !((TestVanDammeAnim)this).doingMelee && SearchForGrapplePoint())
		{
			AttachGrapple();
		}
		if ((int)((Unit)this).actionState == 5 && !acceptedDeath && !((TestVanDammeAnim)this).WillReviveAlready)
		{
			InstantDetachGrapple();
			specialTime = 0f;
			triggeringExplosives = (stealthActive = (((TestVanDammeAnim)this).usingSpecial = false));
			acceptedDeath = true;
		}
	}

	protected override void LateUpdate()
	{
		((TestVanDammeAnim)this).LateUpdate();
		if (grappleAttached && wasAttachedToBlock && ((Object)(object)grappleAttachBlock == (Object)null || ((BroforceObject)grappleAttachBlock).destroyed || ((BroforceObject)grappleAttachBlock).health <= 0))
		{
			DetachGrapple();
		}
	}

	protected override void AirJump()
	{
		((BroBase)this).AirJump();
		if (JumpToToggleGrapple && !grappleAttached && grappleCooldown <= 0f && !((TestVanDammeAnim)this).doingMelee && SearchForGrapplePoint())
		{
			AttachGrapple();
		}
	}

	protected override void CalculateMovement()
	{
		if (grappleAttached)
		{
			((TestVanDammeAnim)this).CalculateMovement();
			if (((TestVanDammeAnim)this).up)
			{
				((BroforceObject)this).yI = 200f;
			}
			else if (((TestVanDammeAnim)this).down)
			{
				((BroforceObject)this).yI = -200f;
			}
			else
			{
				((BroforceObject)this).yI = 0f;
			}
			((BroforceObject)this).xI = 0f;
		}
		else
		{
			((TestVanDammeAnim)this).CalculateMovement();
		}
	}

	protected override void ApplyFallingGravity()
	{
		if (!grappleAttached)
		{
			((TestVanDammeAnim)this).ApplyFallingGravity();
		}
		if (((TestVanDammeAnim)this).wallDrag && ((BroforceObject)this).yI < 0f)
		{
			if (((TestVanDammeAnim)this).down)
			{
				((BroforceObject)this).yI = -100f;
			}
			else
			{
				((BroforceObject)this).yI = 0f;
			}
		}
	}

	protected override void RunMovement()
	{
		((TestVanDammeAnim)this).RunMovement();
		if (grappleAttached)
		{
			UpdateGrapplePosition();
		}
	}

	public bool SearchForGrapplePoint()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: 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_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		if (Physics.Raycast(((Component)this).transform.position, Vector3.up, ref ((TestVanDammeAnim)this).raycastHit, 300f, LayerMask.op_Implicit(((TestVanDammeAnim)this).groundLayer) | LayerMask.op_Implicit(((TestVanDammeAnim)this).barrierLayer)))
		{
			grappleHitPoint = ((RaycastHit)(ref ((TestVanDammeAnim)this).raycastHit)).point;
			return true;
		}
		return false;
	}

	public void AttachGrapple()
	{
		//IL_004d: 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_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: 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_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		((TestVanDammeAnim)this).SetGestureAnimation((Gestures)0);
		((Renderer)grappleLine).enabled = true;
		grappleAttachBlock = ((Component)((RaycastHit)(ref ((TestVanDammeAnim)this).raycastHit)).collider).gameObject.GetComponent<Block>();
		wasAttachedToBlock = (Object)(object)grappleAttachBlock != (Object)null;
		grappleLine.SetPosition(0, ((Component)this).transform.position + grappleOffset);
		grappleLine.SetPosition(1, grappleHitPoint);
		Vector3 val = grappleHitPoint - (((Component)this).transform.position + grappleOffset);
		float magnitude = ((Vector3)(ref val)).magnitude;
		((Renderer)grappleLine).material.SetTextureScale("_MainTex", new Vector2(magnitude * grappleMaterialScale, 1f));
		((Renderer)grappleLine).material.SetTextureOffset("_MainTex", new Vector2(magnitude * grappleMaterialOffset, 0f));
		grappleLine.startWidth = 1.5f;
		grappleLine.endWidth = 1.5f;
		grappleAttached = true;
		grappleCooldown = 0.1f;
		grappleFrame = 0;
		((TestVanDammeAnim)this).frameRate = 0.05f;
		((TestVanDammeAnim)this).chimneyFlip = false;
	}

	public void DetachGrapple()
	{
		((Renderer)grappleLine).enabled = false;
		grappleAttached = false;
		grappleCooldown = 0.1f;
		exitingGrapple = true;
	}

	public void InstantDetachGrapple()
	{
		((TestVanDammeAnim)this).DeactivateGun();
		((Renderer)grappleLine).enabled = false;
		grappleAttached = false;
		exitingGrapple = false;
		grappleCooldown = 0.1f;
	}

	public void UpdateGrapplePosition()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//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_0069: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		grappleLine.SetPosition(0, ((Component)this).transform.position + grappleOffset);
		Vector3 val = grappleHitPoint - (((Component)this).transform.position + grappleOffset);
		float magnitude = ((Vector3)(ref val)).magnitude;
		((Renderer)grappleLine).material.SetTextureScale("_MainTex", new Vector2(magnitude * grappleMaterialScale, 1f));
		((Renderer)grappleLine).material.SetTextureOffset("_MainTex", new Vector2(magnitude * grappleMaterialOffset, 0f));
		if (((Component)this).transform.position.y + 5f > grappleHitPoint.y || Mathf.Abs(((Component)this).transform.position.x - grappleHitPoint.x) > 20f)
		{
			DetachGrapple();
		}
	}

	protected override void ChangeFrame()
	{
		if (!grappleAttached && !exitingGrapple && (!IsHangingOneArmed() || !((TestVanDammeAnim)this).usingSpecial))
		{
			((TestVanDammeAnim)this).ChangeFrame();
		}
		else if (((TestVanDammeAnim)this).usingSpecial)
		{
			((TestVanDammeAnim)this).AnimateSpecial();
		}
		else
		{
			AnimateGrapple();
		}
	}

	public void AnimateGrapple()
	{
		if (((TestVanDammeAnim)this).recalling)
		{
			return;
		}
		((TestVanDammeAnim)this).SetSpriteOffset(0f, 0f);
		if (!exitingGrapple && grappleFrame >= 2)
		{
			if (!stealthActive)
			{
				((TestVanDammeAnim)this).SetGunPosition(3.4f, -1.1f);
				((TestVanDammeAnim)this).ActivateGun();
			}
			else
			{
				((TestVanDammeAnim)this).SetGunPosition(3f, 0f);
				((TestVanDammeAnim)this).ActivateGun();
			}
			grappleFrame = 2;
		}
		else if (exitingGrapple)
		{
			if (!stealthActive && grappleFrame == 3)
			{
				((TestVanDammeAnim)this).DeactivateGun();
			}
			else
			{
				if (grappleFrame > 4)
				{
					((Unit)this).frame = 0;
					((TestVanDammeAnim)this).SetGunPosition(0f, 0f);
					((TestVanDammeAnim)this).ActivateGun();
					((TestVanDammeAnim)this).sprite.SetLowerLeftPixel(0f, (float)((TestVanDammeAnim)this).spritePixelHeight);
					exitingGrapple = false;
					return;
				}
				if (!stealthActive)
				{
					((TestVanDammeAnim)this).SetGunPosition(3.4f, -1.1f);
				}
				else
				{
					((TestVanDammeAnim)this).SetGunPosition(3f, 0f);
				}
			}
		}
		else if (!stealthActive)
		{
			((TestVanDammeAnim)this).DeactivateGun();
		}
		else
		{
			((TestVanDammeAnim)this).SetGunPosition(3f, 0f);
		}
		((TestVanDammeAnim)this).sprite.SetLowerLeftPixel((float)(grappleFrame * ((TestVanDammeAnim)this).spritePixelWidth), (float)(7 * ((TestVanDammeAnim)this).spritePixelHeight));
		grappleFrame++;
	}

	public override void PlayChimneyFlipSound(float volume)
	{
		((BroBase)this).PlayChimneyFlipSound(volume);
		if (grappleAttached)
		{
			DetachGrapple();
		}
	}

	protected override void PressHighFiveMelee(bool forceHighFive = false)
	{
		if (grappleAttached || exitingGrapple)
		{
			InstantDetachGrapple();
		}
		((TestVanDammeAnim)this).PressHighFiveMelee(forceHighFive);
	}

	protected override void PlayFootStepSound(AudioClip[] clips, float v, float p)
	{
		if (!grappleAttached)
		{
			((TestVanDammeAnim)this).PlayFootStepSound(clips, v, p);
		}
	}

	public override void SetGestureAnimation(Gestures gesture)
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Invalid comparison between Unknown and I4
		if (!((TestVanDammeAnim)this).doingMelee && !grappleAttached && !exitingGrapple)
		{
			((BroBase)this).SetGestureAnimation(gesture);
			if ((int)gesture == 4)
			{
				isElbowSlamming = (bool)Traverse.Create((object)this).Field("isElbowSlamming").GetValue();
			}
		}
	}

	protected override void Land()
	{
		if (!grappleAttached)
		{
			if (stealthActive && !isElbowSlamming)
			{
				((BroforceObject)this).yI = -100f;
				((BroBase)this).Land();
			}
			else
			{
				((BroBase)this).Land();
			}
			isElbowSlamming = false;
		}
	}

	protected override bool CanCheckClimbAlongCeiling()
	{
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		if (((BroforceObject)this).health > 0 && !((TestVanDammeAnim)this).down && !grappleAttached)
		{
			return Physics.CheckSphere(new Vector3(((BroforceObject)this).X, ((BroforceObject)this).Y + ((Unit)this).headHeight, 0f), (float)(checkCeilingForHangRadius + ((!(((BroforceObject)this).yI <= 0f)) ? (-2) : 0)), LayerMask.op_Implicit(Map.groundLayer));
		}
		return false;
	}

	protected virtual bool CloseEnoughToClimbAlongCeiling()
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		if (((BroforceObject)this).health > 0 && !((TestVanDammeAnim)this).usingSpecial)
		{
			return Physics.CheckSphere(new Vector3(((BroforceObject)this).X, ((BroforceObject)this).Y + ((Unit)this).headHeight, 0f), (float)(checkCeilingForHangRadius + ((!(((BroforceObject)this).yI <= 0f)) ? (-2) : 0)), LayerMask.op_Implicit(Map.groundLayer));
		}
		return false;
	}

	protected virtual bool IsHangingOneArmed()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Invalid comparison between Unknown and I4
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Invalid comparison between Unknown and I4
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Invalid comparison between Unknown and I4
		if ((int)((Unit)this).actionState != 11 && ((int)((Unit)this).actionState != 6 || !((TestVanDammeAnim)this).hangingOneArmed))
		{
			if ((Object)(object)((Unit)this).attachedToZipline != (Object)null)
			{
				return (int)((Unit)this).actionState == 3;
			}
			return false;
		}
		return true;
	}

	protected override void SetGunPosition(float xOffset, float yOffset)
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		if (!stealthActive)
		{
			((CustomHero)this).SetGunPosition(xOffset, yOffset);
		}
		else
		{
			((Component)((TestVanDammeAnim)this).gunSprite).transform.localPosition = new Vector3(xOffset, yOffset + 0.4f, -0.001f);
		}
	}

	protected override void StartFiring()
	{
		if (((TestVanDammeAnim)this).fireDelay <= 0f && fireCooldown <= 0f)
		{
			((TestVanDammeAnim)this).fireCounter = ((TestVanDammeAnim)this).fireRate;
		}
		if (!readyToDetonate)
		{
			readyToDetonate = true;
		}
	}

	protected override void RunFiring()
	{
		if (!triggeringExplosives && !((TestVanDammeAnim)this).usingSpecial)
		{
			((TestVanDammeAnim)this).RunFiring();
		}
	}

	protected override void UseFire()
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		if (((TestVanDammeAnim)this).doingMelee)
		{
			((TestVanDammeAnim)this).CancelMelee();
		}
		float num = ((Component)this).transform.localScale.x;
		if (!((NetworkObject)this).IsMine && ((NetworkObject)this).Syncronize)
		{
			num = ((NetworkedUnit)this).syncedDirection;
		}
		if (Connect.IsOffline)
		{
			((NetworkedUnit)this).syncedDirection = (int)((Component)this).transform.localScale.x;
		}
		if (IsHangingOneArmed())
		{
			((TestVanDammeAnim)this).FireWeapon(((BroforceObject)this).X + num * 4f, ((BroforceObject)this).Y + 5f, num * 600f, 0f);
		}
		else if (grappleAttached || exitingGrapple)
		{
			((TestVanDammeAnim)this).FireWeapon(((BroforceObject)this).X + num * 14f, ((BroforceObject)this).Y + 10f, num * 600f, 0f);
		}
		else if (((TestVanDammeAnim)this).WallDrag)
		{
			num *= -1f;
			((TestVanDammeAnim)this).FireWeapon(((BroforceObject)this).X + num * 14f, ((BroforceObject)this).Y + 10f, num * 600f, 0f);
		}
		else if (stealthActive)
		{
			((TestVanDammeAnim)this).FireWeapon(((BroforceObject)this).X + num * 12f, ((BroforceObject)this).Y + 10f, num * 600f, 0f);
		}
		else if (((TestVanDammeAnim)this).ducking)
		{
			((TestVanDammeAnim)this).FireWeapon(((BroforceObject)this).X + num * 14f, ((BroforceObject)this).Y + 7f, num * 600f, 0f);
		}
		else
		{
			((TestVanDammeAnim)this).FireWeapon(((BroforceObject)this).X + num * 12f, ((BroforceObject)this).Y + 10f, num * 600f, 0f);
		}
		if (!stealthActive)
		{
			Map.DisturbWildLife(((BroforceObject)this).X, ((BroforceObject)this).Y, 60f, ((NetworkedUnit)this).playerNum);
		}
		fireCooldown = ((TestVanDammeAnim)this).fireRate - 0.12f;
	}

	protected override void FireWeapon(float x, float y, float xSpeed, float ySpeed)
	{
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0163: Unknown result type (might be due to invalid IL or missing references)
		//IL_0186: Unknown result type (might be due to invalid IL or missing references)
		if (!stealthActive)
		{
			y += 3f;
			if (grappleAttached)
			{
				((TestVanDammeAnim)this).gunFrame = 1;
				((TestVanDammeAnim)this).SetGunSprite(((TestVanDammeAnim)this).gunFrame + 22, 0);
			}
			else if (!((TestVanDammeAnim)this).wallDrag)
			{
				((TestVanDammeAnim)this).gunFrame = 3;
				((TestVanDammeAnim)this).SetGunSprite(((TestVanDammeAnim)this).gunFrame, 0);
			}
			else
			{
				((TestVanDammeAnim)this).gunFrame = 3;
			}
			((TestVanDammeAnim)this).TriggerBroFireEvent();
			EffectsController.CreateMuzzleFlashEffect(x, y, -25f, xSpeed * 0.15f, ySpeed * 0.15f, ((Component)this).transform);
			lastFiredTranq = ProjectileController.SpawnProjectileLocally(((Unit)this).projectile, (MonoBehaviour)(object)this, x, y, xSpeed, ySpeed, ((NetworkedUnit)this).playerNum) as TranqDart;
			lastFiredTranq.Setup();
			Sound.GetInstance().PlaySoundEffectAt(tranqGunSounds, 0.5f, ((Component)this).transform.position, 1f + ((TestVanDammeAnim)this).pitchShiftAmount, true, false, false, 0f);
		}
		else if (!triggeringExplosives && currentExplosives.Count < 5)
		{
			((TestVanDammeAnim)this).gunFrame = 3;
			((TestVanDammeAnim)this).SetGunSprite(((TestVanDammeAnim)this).gunFrame, 0);
			float num = 100f;
			float num2 = 50f;
			if (((TestVanDammeAnim)this).down)
			{
				num = 0f;
				num2 = -100f;
			}
			else if (((TestVanDammeAnim)this).up)
			{
				num = 0f;
				num2 = 175f;
			}
			Explosive explosive;
			currentExplosives.Add(explosive = ProjectileController.SpawnProjectileLocally((Projectile)(object)explosivePrefab, (MonoBehaviour)(object)this, ((BroforceObject)this).X + ((Component)this).transform.localScale.x * 6f, ((BroforceObject)this).Y + 10f, ((Component)this).transform.localScale.x * num + ((BroforceObject)this).xI / 2f, num2 + ((BroforceObject)this).yI / 2f, ((NetworkedUnit)this).playerNum) as Explosive);
			((Projectile)explosive).life = specialTime + 4f;
			((Behaviour)explosive).enabled = true;
			if (currentExplosives.Count == 5)
			{
				readyToDetonate = false;
			}
		}
		else if (readyToDetonate)
		{
			StartDetonating();
		}
	}

	protected override void RunGun()
	{
		//IL_0220: Unknown result type (might be due to invalid IL or missing references)
		//IL_0167: Unknown result type (might be due to invalid IL or missing references)
		if (!((TestVanDammeAnim)this).WallDrag && !acceptedDeath)
		{
			if (!stealthActive && !grappleAttached && !exitingGrapple)
			{
				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;
						if (((TestVanDammeAnim)this).gunFrame < 1 && ((TestVanDammeAnim)this).fire)
						{
							((TestVanDammeAnim)this).gunFrame = 1;
						}
						((TestVanDammeAnim)this).SetGunSprite(((TestVanDammeAnim)this).gunFrame, 0);
					}
				}
				else
				{
					((TestVanDammeAnim)this).SetGunSprite(0, 0);
				}
			}
			else if (triggeringExplosives)
			{
				((TestVanDammeAnim)this).gunCounter = ((TestVanDammeAnim)this).gunCounter + ((Unit)this).t;
				if (((TestVanDammeAnim)this).gunCounter > 0.12f)
				{
					((TestVanDammeAnim)this).gunCounter = ((TestVanDammeAnim)this).gunCounter - 0.12f;
					((TestVanDammeAnim)this).gunFrame = ((TestVanDammeAnim)this).gunFrame + 1;
				}
				if (IsHangingOneArmed())
				{
					if (((TestVanDammeAnim)this).gunFrame < 4)
					{
						((TestVanDammeAnim)this).gunSprite.SetLowerLeftPixel((float)((27 + ((TestVanDammeAnim)this).gunFrame) * ((TestVanDammeAnim)this).gunSpritePixelWidth), 32f);
						if (((TestVanDammeAnim)this).gunFrame == 3 && !((TestVanDammeAnim)this).recalling && !playedTriggerSound)
						{
							Sound.GetInstance().PlaySoundEffectAt(detonatorSound, 0.8f, ((Component)this).transform.position, 1f, true, true, false, 0f);
							playedTriggerSound = true;
						}
					}
					else
					{
						if (!((TestVanDammeAnim)this).usingSpecial)
						{
							StopSpecial();
						}
						((TestVanDammeAnim)this).gunFrame = 3;
						((TestVanDammeAnim)this).gunSprite.SetLowerLeftPixel((float)((27 + ((TestVanDammeAnim)this).gunFrame) * ((TestVanDammeAnim)this).gunSpritePixelWidth), 32f);
					}
				}
				else if (((TestVanDammeAnim)this).gunFrame < 3)
				{
					((TestVanDammeAnim)this).gunSprite.SetLowerLeftPixel((float)((18 + ((TestVanDammeAnim)this).gunFrame) * ((TestVanDammeAnim)this).gunSpritePixelWidth), 32f);
					if (((TestVanDammeAnim)this).gunFrame == 2 && !((TestVanDammeAnim)this).recalling && !playedTriggerSound)
					{
						Sound.GetInstance().PlaySoundEffectAt(detonatorSound, 0.8f, ((Component)this).transform.position, 1f, true, true, false, 0f);
						playedTriggerSound = true;
					}
				}
				else
				{
					if (!((TestVanDammeAnim)this).usingSpecial)
					{
						StopSpecial();
					}
					((TestVanDammeAnim)this).gunFrame = 2;
					((TestVanDammeAnim)this).gunSprite.SetLowerLeftPixel((float)((18 + ((TestVanDammeAnim)this).gunFrame) * ((TestVanDammeAnim)this).gunSpritePixelWidth), 32f);
				}
			}
			else if (stealthActive && currentExplosives.Count < 5)
			{
				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);
					}
				}
				else
				{
					((TestVanDammeAnim)this).SetGunSprite(0, 0);
				}
			}
			else if (!stealthActive && (grappleAttached || exitingGrapple))
			{
				if (((TestVanDammeAnim)this).gunFrame > 0 && grappleFrame > 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 + 22, 0);
					}
				}
				else if (grappleFrame > 0)
				{
					((TestVanDammeAnim)this).SetGunSprite(22, 0);
				}
				else
				{
					((TestVanDammeAnim)this).SetGunSprite(0, 0);
				}
			}
			else
			{
				((TestVanDammeAnim)this).SetGunSprite(18, 0);
			}
		}
		else
		{
			if (stealthActive || triggeringExplosives || acceptedDeath)
			{
				return;
			}
			if (((TestVanDammeAnim)this).gunFrame > 0)
			{
				wallHangFiring = true;
				((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;
					if (((TestVanDammeAnim)this).gunFrame < 2 && ((TestVanDammeAnim)this).fire)
					{
						((TestVanDammeAnim)this).gunFrame = 2;
					}
					((TestVanDammeAnim)this).sprite.SetLowerLeftPixel((float)((((TestVanDammeAnim)this).gunFrame + 7) * ((TestVanDammeAnim)this).spritePixelWidth), (float)(((TestVanDammeAnim)this).spritePixelHeight * 7));
				}
			}
			else if (wallHangFiring)
			{
				((TestVanDammeAnim)this).sprite.SetLowerLeftPixel((float)((((TestVanDammeAnim)this).gunFrame + 7) * ((TestVanDammeAnim)this).spritePixelWidth), (float)(((TestVanDammeAnim)this).spritePixelHeight * 7));
			}
		}
	}

	protected override void AnimateWallDrag()
	{
		//IL_0290: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_020e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0230: Unknown result type (might be due to invalid IL or missing references)
		//IL_023a: Unknown result type (might be due to invalid IL or missing references)
		//IL_017e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01aa: 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_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		if (wallHangFiring)
		{
			return;
		}
		((TestVanDammeAnim)this).wallClimbAnticipation = false;
		if (((TestVanDammeAnim)this).useNewKnifeClimbingFrames)
		{
			if (((BroforceObject)this).yI > 100f)
			{
				if (((TestVanDammeAnim)this).knifeHand % 2 == 0)
				{
					if (((Unit)this).frame > 1)
					{
						((Unit)this).frame = 1;
					}
					int num = 12 + Mathf.Clamp(((Unit)this).frame, 0, 1);
					((TestVanDammeAnim)this).sprite.SetLowerLeftPixel((float)(num * ((TestVanDammeAnim)this).spritePixelWidth), (float)(((TestVanDammeAnim)this).spritePixelHeight * 3));
				}
				else
				{
					if (((Unit)this).frame > 1)
					{
						((Unit)this).frame = 1;
					}
					int num2 = 22 + Mathf.Clamp(((Unit)this).frame, 0, 1);
					((TestVanDammeAnim)this).sprite.SetLowerLeftPixel((float)(num2 * ((TestVanDammeAnim)this).spritePixelWidth), (float)(((TestVanDammeAnim)this).spritePixelHeight * 3));
				}
				return;
			}
			if (((Unit)this).frame == 2)
			{
				((TestVanDammeAnim)this).PlayKnifeClimbSound();
			}
			if (((TestVanDammeAnim)this).knifeHand % 2 == 0)
			{
				int num3 = 12 + Mathf.Clamp(((Unit)this).frame, 0, 4);
				if (!FluidController.IsSubmerged((BroforceObject)(object)this) && ((TestVanDammeAnim)this).down)
				{
					EffectsController.CreateFootPoofEffect(((BroforceObject)this).X + ((Component)this).transform.localScale.x * 6f, ((BroforceObject)this).Y + 16f, 0f, Vector3.up * 1f, (BloodColor)3);
				}
				((TestVanDammeAnim)this).sprite.SetLowerLeftPixel((float)(num3 * ((TestVanDammeAnim)this).spritePixelWidth), (float)(((TestVanDammeAnim)this).spritePixelHeight * 3));
			}
			else
			{
				int num4 = 22 + Mathf.Clamp(((Unit)this).frame, 0, 4);
				if (!FluidController.IsSubmerged((BroforceObject)(object)this) && ((TestVanDammeAnim)this).down)
				{
					EffectsController.CreateFootPoofEffect(((BroforceObject)this).X + ((Component)this).transform.localScale.x * 6f, ((BroforceObject)this).Y + 16f, 0f, Vector3.up * 1f, (BloodColor)3);
				}
				((TestVanDammeAnim)this).sprite.SetLowerLeftPixel((float)(num4 * ((TestVanDammeAnim)this).spritePixelWidth), (float)(((TestVanDammeAnim)this).spritePixelHeight * 3));
			}
		}
		else if (((TestVanDammeAnim)this).knifeHand % 2 == 0)
		{
			int num5 = 11 + Mathf.Clamp(((Unit)this).frame, 0, 2);
			if (!FluidController.IsSubmerged((BroforceObject)(object)this) && ((TestVanDammeAnim)this).down)
			{
				EffectsController.CreateFootPoofEffect(((BroforceObject)this).X + ((Component)this).transform.localScale.x * 6f, ((BroforceObject)this).Y + 12f, 0f, Vector3.up * 1f, (BloodColor)3);
			}
			((TestVanDammeAnim)this).sprite.SetLowerLeftPixel((float)(num5 * ((TestVanDammeAnim)this).spritePixelWidth), (float)((TestVanDammeAnim)this).spritePixelHeight);
		}
		else
		{
			int num6 = 14 + Mathf.Clamp(((Unit)this).frame, 0, 2);
			if (!FluidController.IsSubmerged((BroforceObject)(object)this) && ((TestVanDammeAnim)this).down)
			{
				EffectsController.CreateFootPoofEffect(((BroforceObject)this).X + ((Component)this).transform.localScale.x * 6f, ((BroforceObject)this).Y + 12f, 0f, Vector3.up * 1f, (BloodColor)3);
			}
			((TestVanDammeAnim)this).sprite.SetLowerLeftPixel((float)(num6 * ((TestVanDammeAnim)this).spritePixelWidth), (float)((TestVanDammeAnim)this).spritePixelHeight);
		}
	}

	protected override void Jump(bool wallJump)
	{
		if (!grappleAttached)
		{
			if (wallJump)
			{
				wallHangFiring = false;
			}
			((BroBase)this).Jump(wallJump);
		}
	}

	protected override void PressSpecial()
	{
		if (!((TestVanDammeAnim)this).usingSpecial && !stealthActive && !((TestVanDammeAnim)this).hasBeenCoverInAcid && ((TestVanDammeAnim)this).SpecialAmmo > 0)
		{
			if (grappleAttached)
			{
				usingSpecialFrame = 1;
			}
			else
			{
				usingSpecialFrame = 0;
			}
			((TestVanDammeAnim)this).usingSpecial = true;
			specialTime = 7f;
			stealthActive = true;
			Map.ForgetPlayer(((NetworkedUnit)this).playerNum, true, false);
			currentExplosives = new List<Explosive>();
			((TestVanDammeAnim)this).fireRate = 0.3f;
		}
		else if (specialTime > 0f && !((TestVanDammeAnim)this).usingSpecial)
		{
			StartDetonating();
		}
		else if (((TestVanDammeAnim)this).SpecialAmmo <= 0)
		{
			HeroController.FlashSpecialAmmo(((NetworkedUnit)this).playerNum);
			((TestVanDammeAnim)this).ActivateGun();
		}
	}

	protected override void UseSpecial()
	{
		int specialAmmo = ((TestVanDammeAnim)this).SpecialAmmo - 1;
		((TestVanDammeAnim)this).SpecialAmmo = specialAmmo;
	}

	public override bool IsInStealthMode()
	{
		if (!stealthActive)
		{
			return ((TestVanDammeAnim)this).IsInStealthMode();
		}
		return true;
	}

	protected override void AlertNearbyMooks()
	{
		if (!stealthActive)
		{
			((BroBase)this).AlertNearbyMooks();
		}
	}

	protected void StartDetonating()
	{
		if (!triggeringExplosives)
		{
			specialTime = 0f;
			((TestVanDammeAnim)this).gunCounter = 0f;
			triggeringExplosives = true;
			((TestVanDammeAnim)this).gunFrame = 0;
			((TestVanDammeAnim)this).gunCounter = 0f;
			((TestVanDammeAnim)this).RunGun();
		}
	}

	protected void StopSpecial()
	{
		((TestVanDammeAnim)this).usingSpecial = true;
		if (grappleAttached)
		{
			usingSpecialFrame = 4;
		}
		else
		{
			usingSpecialFrame = 5;
		}
		((TestVanDammeAnim)this).fireRate = 0.3f;
		foreach (Explosive currentExplosife in currentExplosives)
		{
			((Projectile)currentExplosife).life = 0.2f;
		}
		triggeringExplosives = false;
		((TestVanDammeAnim)this).ChangeFrame();
		((TestVanDammeAnim)this).RunGun();
		playedTriggerSound = false;
	}

	protected override void AnimateSpecial()
	{
		((TestVanDammeAnim)this).frameRate = 0.0667f;
		if (((TestVanDammeAnim)this).recalling)
		{
			return;
		}
		if (grappleAttached || exitingGrapple)
		{
			((TestVanDammeAnim)this).DeactivateGun();
			if (specialTime > 0f)
			{
				if (usingSpecialFrame > 4)
				{
					((TestVanDammeAnim)this).usingSpecial = false;
					((Component)this).GetComponent<Renderer>().material = stealthMaterial;
					((TestVanDammeAnim)this).gunSprite.meshRender.material = stealthGunMaterial;
					HeroController.SetAvatarMaterial(((NetworkedUnit)this).playerNum, stealthAvatarMaterial);
					stealthActive = true;
					((TestVanDammeAnim)this).gunFrame = 0;
					((TestVanDammeAnim)this).ActivateGun();
					((TestVanDammeAnim)this).SetGunPosition(3f, 0f);
					((TestVanDammeAnim)this).gunFrame = 0;
					((TestVanDammeAnim)this).UseSpecial();
					((TestVanDammeAnim)this).ChangeFrame();
				}
				else
				{
					((TestVanDammeAnim)this).sprite.SetLowerLeftPixel((float)((26 + usingSpecialFrame) * ((TestVanDammeAnim)this).spritePixelWidth), (float)(9 * ((TestVanDammeAnim)this).spritePixelHeight));
					usingSpecialFrame++;
				}
			}
			else if (usingSpecialFrame < 1)
			{
				((TestVanDammeAnim)this).usingSpecial = false;
				((Component)this).GetComponent<Renderer>().material = normalMaterial;
				((TestVanDammeAnim)this).gunSprite.meshRender.material = normalGunMaterial;
				HeroController.SetAvatarMaterial(((NetworkedUnit)this).playerNum, normalAvatarMaterial);
				stealthActive = false;
				((TestVanDammeAnim)this).gunFrame = 0;
				((TestVanDammeAnim)this).ActivateGun();
				((TestVanDammeAnim)this).ChangeFrame();
			}
			else
			{
				((TestVanDammeAnim)this).sprite.SetLowerLeftPixel((float)((26 + usingSpecialFrame) * ((TestVanDammeAnim)this).spritePixelWidth), (float)(9 * ((TestVanDammeAnim)this).spritePixelHeight));
				usingSpecialFrame--;
			}
			return;
		}
		((TestVanDammeAnim)this).DeactivateGun();
		if (specialTime > 0f)
		{
			if (usingSpecialFrame > 5)
			{
				((Unit)this).frame = 0;
				((TestVanDammeAnim)this).usingSpecial = false;
				((Component)this).GetComponent<Renderer>().material = stealthMaterial;
				((TestVanDammeAnim)this).gunSprite.meshRender.material = stealthGunMaterial;
				HeroController.SetAvatarMaterial(((NetworkedUnit)this).playerNum, stealthAvatarMaterial);
				stealthActive = true;
				((TestVanDammeAnim)this).gunFrame = 0;
				((TestVanDammeAnim)this).ActivateGun();
				((TestVanDammeAnim)this).ChangeFrame();
				((TestVanDammeAnim)this).UseSpecial();
			}
			else
			{
				if (IsHangingOneArmed())
				{
					((TestVanDammeAnim)this).sprite.SetLowerLeftPixel((float)((26 + usingSpecialFrame) * ((TestVanDammeAnim)this).spritePixelWidth), (float)(7 * ((TestVanDammeAnim)this).spritePixelHeight));
				}
				else
				{
					((TestVanDammeAnim)this).sprite.SetLowerLeftPixel((float)((26 + usingSpecialFrame) * ((TestVanDammeAnim)this).spritePixelWidth), (float)(8 * ((TestVanDammeAnim)this).spritePixelHeight));
				}
				usingSpecialFrame++;
			}
		}
		else if (usingSpecialFrame < 0)
		{
			((Unit)this).frame = 0;
			((TestVanDammeAnim)this).usingSpecial = false;
			((Component)this).GetComponent<Renderer>().material = normalMaterial;
			((TestVanDammeAnim)this).gunSprite.meshRender.material = normalGunMaterial;
			HeroController.SetAvatarMaterial(((NetworkedUnit)this).playerNum, normalAvatarMaterial);
			stealthActive = false;
			((TestVanDammeAnim)this).gunFrame = 0;
			((TestVanDammeAnim)this).ActivateGun();
			((TestVanDammeAnim)this).ChangeFrame();
		}
		else
		{
			if (IsHangingOneArmed())
			{
				((TestVanDammeAnim)this).sprite.SetLowerLeftPixel((float)((26 + usingSpecialFrame) * ((TestVanDammeAnim)this).spritePixelWidth), (float)(7 * ((TestVanDammeAnim)this).spritePixelHeight));
			}
			else
			{
				((TestVanDammeAnim)this).sprite.SetLowerLeftPixel((float)((26 + usingSpecialFrame) * ((TestVanDammeAnim)this).spritePixelWidth), (float)(8 * ((TestVanDammeAnim)this).spritePixelHeight));
			}
			usingSpecialFrame--;
		}
	}

	protected override void AnimatePunch()
	{
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Invalid comparison between Unknown and I4
		((BroBase)this).AnimateMeleeCommon();
		((TestVanDammeAnim)this).frameRate = 0.03f;
		int num = 25 + Mathf.Clamp(((Unit)this).frame, 0, 8);
		int num2 = 10;
		if (((Unit)this).frame == 5)
		{
			((TestVanDammeAnim)this).counter = ((TestVanDammeAnim)this).counter - 0.0334f;
			((TestVanDammeAnim)this).counter = ((TestVanDammeAnim)this).counter - 0.0334f;
			((TestVanDammeAnim)this).counter = ((TestVanDammeAnim)this).counter - 0.0334f;
		}
		if (((Unit)this).frame == 3)
		{
			((TestVanDammeAnim)this).counter = ((TestVanDammeAnim)this).counter - 0.0334f;
		}
		((TestVanDammeAnim)this).sprite.SetLowerLeftPixel((float)(num * ((TestVanDammeAnim)this).spritePixelWidth), (float)(num2 * ((TestVanDammeAnim)this).spritePixelHeight));
		if (((Unit)this).frame == 3 && !((TestVanDammeAnim)this).meleeHasHit)
		{
			((BroBase)this).PerformPunchAttack(true, true);
		}
		if ((int)((BroBase)this).currentMeleeType == 15 && ((Unit)this).frame >= 4 && ((Unit)this).frame <= 5 && !((TestVanDammeAnim)this).meleeHasHit)
		{
			((BroBase)this).PerformPunchAttack(true, true);
		}
		if (((Unit)this).frame >= 7)
		{
			((Unit)this).frame = 0;
			((TestVanDammeAnim)this).CancelMelee();
		}
	}

	protected override void PerformPunchAttack(bool shouldTryHitTerrain, bool playMissSound)
	{
		//IL_00c7: 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_00dd: 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_0176: Unknown result type (might be due to invalid IL or missing references)
		//IL_017b: Unknown result type (might be due to invalid IL or missing references)
		//IL_018c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0197: Unknown result type (might be due to invalid IL or missing references)
		if (sachelPackCooldown > 0f)
		{
			((BroBase)this).PerformPunchAttack(shouldTryHitTerrain, playMissSound);
			return;
		}
		Unit val = Map.GeLivingtUnit(((NetworkedUnit)this).playerNum, 8f, 8f, ((BroforceObject)this).X + (float)(((NetworkedUnit)this).Direction * 6), ((BroforceObject)this).Y + 6f);
		if ((Object)(object)val != (Object)null)
		{
			((Behaviour)(ProjectileController.SpawnProjectileLocally((Projectile)(object)gumPrefab, (MonoBehaviour)(object)this, ((BroforceObject)val).X, ((BroforceObject)val).Y + 6f, 0f, 0f, false, ((NetworkedUnit)this).playerNum, false, false, 0f) as ExplosiveGum)).enabled = true;
			sachelPackCooldown = 0.8f;
		}
		else if (((NetworkedUnit)this).Direction < 0 && Physics.Raycast(new Vector3(((BroforceObject)this).X + 6f, ((BroforceObject)this).Y + 10f, 0f), Vector3.left, ref ((TestVanDammeAnim)this).raycastHit, 16f, LayerMask.op_Implicit(((TestVanDammeAnim)this).groundLayer) | LayerMask.op_Implicit(((TestVanDammeAnim)this).fragileLayer)))
		{
			((Behaviour)(ProjectileController.SpawnProjectileLocally((Projectile)(object)gumPrefab, (MonoBehaviour)(object)this, ((BroforceObject)this).X - 6f, ((BroforceObject)this).Y + 10f, -10f, 10f, false, ((NetworkedUnit)this).playerNum, false, false, 0f) as ExplosiveGum)).enabled = true;
			sachelPackCooldown = 0.7f;
		}
		else if (((NetworkedUnit)this).Direction > 0 && Physics.Raycast(new Vector3(((BroforceObject)this).X - 6f, ((BroforceObject)this).Y + 10f, 0f), Vector3.right, ref ((TestVanDammeAnim)this).raycastHit, 12f, LayerMask.op_Implicit(((TestVanDammeAnim)this).groundLayer) | LayerMask.op_Implicit(((TestVanDammeAnim)this).fragileLayer)))
		{
			((Behaviour)(ProjectileController.SpawnProjectileLocally((Projectile)(object)gumPrefab, (MonoBehaviour)(object)this, ((BroforceObject)this).X + 6f, ((BroforceObject)this).Y + 10f, 10f, 10f, false, ((NetworkedUnit)this).playerNum, false, false, 0f) as ExplosiveGum)).enabled = true;
			sachelPackCooldown = 0.7f;
		}
		else
		{
			((BroBase)this).PerformPunchAttack(shouldTryHitTerrain, playMissSound);
		}
	}

	protected override void ThrowBackMook(Mook mook)
	{
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		if (((NetworkObject)this).IsMine)
		{
			ExplosiveGum obj = ProjectileController.SpawnProjectileLocally((Projectile)(object)gumPrefab, (MonoBehaviour)(object)this, ((BroforceObject)mook).X, ((BroforceObject)mook).Y + 10f, ((Component)this).transform.localScale.x * 100f + ((BroforceObject)this).xI * 0.7f, ((BroforceObject)this).yI, false, ((NetworkedUnit)this).playerNum, false, false, 0f) as ExplosiveGum;
			((Behaviour)obj).enabled = true;
			((SachelPack)obj).TryStickToUnit((Unit)(object)mook, true);
		}
		((TestVanDammeAnim)this).ThrowBackMook(mook);
	}
}
public class Explosive : CustomSachelPack
{
	protected bool stickToDeadUnit;

	protected float previousSpeed;

	protected override void Awake()
	{
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)base.DefaultSoundHolder == (Object)null)
		{
			base.DefaultSoundHolder = ((Unit)HeroController.GetHeroPrefab((HeroType)5)).projectile.soundHolder;
		}
		((CustomSachelPack)this).Awake();
		((Projectile)this).life = 100f;
		((SachelPack)this).range = 65f;
		((SachelPack)this).blastForce = 50f;
		((SachelPack)this).sticky = true;
		((SachelPack)this).stickyToUnits = true;
		((Projectile)this).damage = 12;
		((Projectile)this).damageInternal = 12;
		((Projectile)this).fullDamage = 12;
		((Projectile)this).damageType = (DamageType)1;
		((Projectile)this).canHitGrenades = false;
		((Projectile)this).soundVolume = 0.4f;
		((SachelPack)this).bounceXM = 0.1f;
		((SachelPack)this).bounceYM = 0.1f;
	}

	public override void PrefabSetup()
	{
		TestVanDammeAnim heroPrefab = HeroController.GetHeroPrefab((HeroType)5);
		Projectile projectile = ((Unit)((heroPrefab is McBrover) ? heroPrefab : null)).projectile;
		SachelPack val = (SachelPack)(object)((projectile is SachelPack) ? projectile : null);
		((SachelPack)this).fire1 = val.fire1;
		((SachelPack)this).fire2 = val.fire2;
		((SachelPack)this).fire3 = val.fire3;
		((SachelPack)this).smoke1 = val.smoke1;
		((SachelPack)this).smoke2 = val.smoke2;
		((SachelPack)this).explosion = val.explosion;
		((SachelPack)this).explosionSmall = val.explosionSmall;
		((Projectile)this).shrapnel = ((Projectile)val).shrapnel;
		((Projectile)this).shrapnelSpark = ((Projectile)val).shrapnelSpark;
		((Projectile)this).flickPuff = ((Projectile)val).flickPuff;
	}

	protected override void Update()
	{
		((SachelPack)this).Update();
		if (((BroforceObject)this).xI != 0f)
		{
			previousSpeed = ((BroforceObject)this).xI;
		}
	}

	public override void TryStickToUnit(Unit unit, bool _stickToDeadUnit = false)
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		stickToDeadUnit = _stickToDeadUnit;
		if ((Object)(object)unit != (Object)null)
		{
			((SachelPack)this).stuckToUnit = unit;
			((SachelPack)this).PlayStuckSound(0.7f);
			Vector3 val = ((Component)((SachelPack)this).stuckToUnit).transform.InverseTransformPoint(((Component)this).transform.position);
			((SachelPack)this).StickToUnit(((SachelPack)this).stuckToUnit, val);
		}
	}

	protected override bool HitWalls()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ce: 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_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_059c: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: 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_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_069e: Unknown result type (might be due to invalid IL or missing references)
		//IL_06a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: Unknown result type (might be due to invalid IL or missing references)
		//IL_0169: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_087b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0880: Unknown result type (might be due to invalid IL or missing references)
		//IL_0885: Unknown result type (might be due to invalid IL or missing references)
		//IL_0887: Unknown result type (might be due to invalid IL or missing references)
		//IL_088d: Unknown result type (might be due to invalid IL or missing references)
		//IL_018f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0650: Unknown result type (might be due to invalid IL or missing references)
		//IL_0632: Unknown result type (might be due to invalid IL or missing references)
		//IL_0380: Unknown result type (might be due to invalid IL or missing references)
		//IL_055f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0848: Unknown result type (might be due to invalid IL or missing references)
		int num = LayerMask.op_Implicit(((Projectile)this).groundLayer) | (1 << LayerMask.NameToLayer("DirtyHippie"));
		if ((Object)(object)((SachelPack)this).stuckToUnit == (Object)null && (((SachelPack)this).stuckUp || ((SachelPack)this).stuckLeft || ((SachelPack)this).stuckRight))
		{
			if (((SachelPack)this).stuckUp)
			{
				if (Physics.Raycast(new Vector3(((BroforceObject)this).X, ((BroforceObject)this).Y - 6f, 0f), Vector3.up, ref ((Projectile)this).raycastHit, 14f + ((SachelPack)this).heightOffGround, num))
				{
					((BroforceObject)this).Y = ((RaycastHit)(ref ((Projectile)this).raycastHit)).point.y - ((SachelPack)this).heightOffGround;
					((BroforceObject)this).xI = (((BroforceObject)this).yI = 0f);
				}
				else
				{
					((SachelPack)this).stuckUp = false;
				}
			}
			if (((SachelPack)this).stuckLeft)
			{
				if (Physics.Raycast(new Vector3(((BroforceObject)this).X + 6f, ((BroforceObject)this).Y, 0f), Vector3.left, ref ((Projectile)this).raycastHit, 10f + ((SachelPack)this).heightOffGround, num))
				{
					((BroforceObject)this).X = ((RaycastHit)(ref ((Projectile)this).raycastHit)).point.x + ((SachelPack)this).heightOffGround;
					((BroforceObject)this).xI = (((BroforceObject)this).yI = 0f);
				}
				else
				{
					((SachelPack)this).stuckLeft = false;
				}
			}
			if (((SachelPack)this).stuckRight)
			{
				if (Physics.Raycast(new Vector3(((BroforceObject)this).X - 6f, ((BroforceObject)this).Y, 0f), Vector3.right, ref ((Projectile)this).raycastHit, 10f + ((SachelPack)this).heightOffGround, num))
				{
					((BroforceObject)this).X = ((RaycastHit)(ref ((Projectile)this).raycastHit)).point.x - ((SachelPack)this).heightOffGround;
					((BroforceObject)this).xI = (((BroforceObject)this).yI = 0f);
				}
				else
				{
					((SachelPack)this).stuckRight = false;
				}
			}
		}
		else
		{
			if (((BroforceObject)this).xI < 0f)
			{
				if (Physics.Raycast(new Vector3(((BroforceObject)this).X + 4f, ((BroforceObject)this).Y, 0f), Vector3.left, ref ((Projectile)this).raycastHit, 6f + ((SachelPack)this).heightOffGround, num))
				{
					if ((Object)(object)((Component)((RaycastHit)(ref ((Projectile)this).raycastHit)).collider).GetComponent<SawBlade>() != (Object)null)
					{
						((Projectile)this).Death();
					}
					if ((Object)(object)((Component)((RaycastHit)(ref ((Projectile)this).raycastHit)).collider).GetComponent<Unit>() != (Object)null)
					{
						((SachelPack)this).TryStickToUnit(((Component)((RaycastHit)(ref ((Projectile)this).raycastHit)).collider).GetComponent<Unit>(), false);
						((BroforceObject)this).xI = (((BroforceObject)this).yI = 0f);
						((SachelPack)this).PlayStuckSound(0.7f);
					}
					else if ((Object)(object)((Component)((RaycastHit)(ref ((Projectile)this).raycastHit)).collider).GetComponent<DamageRelay>() != (Object)null)
					{
						((SachelPack)this).stuckLeft = true;
						((BroforceObject)this).xI = (((BroforceObject)this).yI = 0f);
						((SachelPack)this).PlayStuckSound(0.7f);
					}
					else if ((Object)(object)((Component)((RaycastHit)(ref ((Projectile)this).raycastHit)).collider).GetComponent<BossBlockPiece>() != (Object)null || (Object)(object)((Component)((RaycastHit)(ref ((Projectile)this).raycastHit)).collider).GetComponent<BossBlockWeapon>() != (Object)null)
					{
						((SachelPack)this).stuckLeft = true;
						((BroforceObject)this).xI = (((BroforceObject)this).yI = 0f);
						((SachelPack)this).PlayStuckSound(0.7f);
					}
					else if ((Object)(object)((Component)((RaycastHit)(ref ((Projectile)this).raycastHit)).collider).GetComponent<Block>() != (Object)null)
					{
						((SachelPack)this).stuckLeft = true;
						((BroforceObject)this).xI = (((BroforceObject)this).yI = 0f);
						((SachelPack)this).PlayStuckSound(0.7f);
					}
					else
					{
						((BroforceObject)this).xI = ((BroforceObject)this).xI * (0f - ((SachelPack)this).bounceXM);
						((SachelPack)this).MakeBounceEffect((DirectionEnum)4, ((RaycastHit)(ref ((Projectile)this).raycastHit)).point);
						((SachelPack)this).PlayBounceSound(((BroforceObject)this).xI);
					}
					((SachelPack)this).stickyToUnits = false;
				}
			}
			else if (((BroforceObject)this).xI > 0f && Physics.Raycast(new Vector3(((BroforceObject)this).X - 4f, ((BroforceObject)this).Y, 0f), Vector3.right, ref ((Projectile)this).raycastHit, 4f + ((SachelPack)this).heightOffGround, num))
			{
				if ((Object)(object)((Component)((RaycastHit)(ref ((Projectile)this).raycastHit)).collider).GetComponent<SawBlade>() != (Object)null)
				{
					((Projectile)this).Death();
				}
				if ((Object)(object)((Component)((RaycastHit)(ref ((Projectile)this).raycastHit)).collider).GetComponent<Unit>() != (Object)null)
				{
					((SachelPack)this).TryStickToUnit(((Component)((RaycastHit)(ref ((Projectile)this).raycastHit)).collider).GetComponent<Unit>(), false);
					((BroforceObject)this).xI = (((BroforceObject)this).yI = 0f);
					((SachelPack)this).PlayStuckSound(0.7f);
				}
				else if ((Object)(object)((Component)((RaycastHit)(ref ((Projectile)this).raycastHit)).collider).GetComponent<DamageRelay>() != (Object)null)
				{
					((SachelPack)this).stuckRight = true;
					((BroforceObject)this).xI = (((BroforceObject)this).yI = 0f);
					((SachelPack)this).PlayStuckSound(0.7f);
				}
				else if ((Object)(object)((Component)((RaycastHit)(ref ((Projectile)this).raycastHit)).collider).GetComponent<BossBlockPiece>() != (Object)null || (Object)(object)((Component)((RaycastHit)(ref ((Projectile)this).raycastHit)).collider).GetComponent<BossBlockWeapon>() != (Object)null)
				{
					((SachelPack)this).stuckRight = true;
					((BroforceObject)this).xI = (((BroforceObject)this).yI = 0f);
					((SachelPack)this).PlayStuckSound(0.7f);
				}
				else if ((Object)(object)((Component)((RaycastHit)(ref ((Projectile)this).raycastHit)).collider).GetComponent<Block>() != (Object)null)
				{
					((SachelPack)this).stuckRight = true;
					((BroforceObject)this).xI = (((BroforceObject)this).yI = 0f);
					((SachelPack)this).PlayStuckSound(0.7f);
				}
				else
				{
					((SachelPack)this).stickyToUnits = false;
					((BroforceObject)this).xI = ((BroforceObject)this).xI * (0f - ((SachelPack)this).bounceXM);
					((SachelPack)this).MakeBounceEffect((DirectionEnum)5, ((RaycastHit)(ref ((Projectile)this).raycastHit)).point);
					((SachelPack)this).PlayBounceSound(((BroforceObject)this).xI);
				}
			}
			if (((BroforceObject)this).yI < 0f)
			{
				if (Physics.Raycast(new Vector3(((BroforceObject)this).X, ((BroforceObject)this).Y + 6f, 0f), Vector3.down, ref ((Projectile)this).raycastHit, 6f + ((SachelPack)this).heightOffGround - ((BroforceObject)this).yI * ((Projectile)this).t, num))
				{
					if ((Object)(object)((Component)((RaycastHit)(ref ((Projectile)this).raycastHit)).collider).GetComponent<SawBlade>() != (Object)null)
					{
						((Projectile)this).Death();
					}
					((SachelPack)this).stickyToUnits = false;
					((BroforceObject)this).xI = ((BroforceObject)this).xI * ((SachelPack)this).frictionM;
					if (((BroforceObject)this).yI < -40f)
					{
						((BroforceObject)this).yI = ((BroforceObject)this).yI * (0f - ((SachelPack)this).bounceYM);
						((SachelPack)this).MakeBounceEffect((DirectionEnum)3, ((RaycastHit)(ref ((Projectile)this).raycastHit)).point);
					}
					else
					{
						((BroforceObject)this).yI = 0f;
						((BroforceObject)this).Y = ((RaycastHit)(ref ((Projectile)this).raycastHit)).point.y + ((SachelPack)this).heightOffGround;
					}
					((SachelPack)this).PlayBounceSound(((BroforceObject)this).yI);
				}
			}
			else if (((BroforceObject)this).yI > 0f && Physics.Raycast(new Vector3(((BroforceObject)this).X, ((BroforceObject)this).Y - 6f, 0f), Vector3.up, ref ((Projectile)this).raycastHit, 6f + ((SachelPack)this).heightOffGround + ((BroforceObject)this).yI * ((Projectile)this).t, num))
			{
				if ((Object)(object)((Component)((RaycastHit)(ref ((Projectile)this).raycastHit)).collider).GetComponent<SawBlade>() != (Object)null)
				{
					((Projectile)this).Death();
				}
				if ((Object)(object)((Component)((RaycastHit)(ref ((Projectile)this).raycastHit)).collider).GetComponent<Unit>() != (Object)null)
				{
					((SachelPack)this).TryStickToUnit(((Component)((RaycastHit)(ref ((Projectile)this).raycastHit)).collider).GetComponent<Unit>(), false);
					((BroforceObject)this).xI = (((BroforceObject)this).yI = 0f);
					((SachelPack)this).PlayStuckSound(0.7f);
				}
				else if ((Object)(object)((Component)((RaycastHit)(ref ((Projectile)this).raycastHit)).collider).GetComponent<DamageRelay>() != (Object)null)
				{
					((SachelPack)this).stuckUp = true;
					((BroforceObject)this).xI = (((BroforceObject)this).yI = 0f);
					((SachelPack)this).PlayStuckSound(0.7f);
				}
				else if ((Object)(object)((Component)((RaycastHit)(ref ((Projectile)this).raycastHit)).collider).GetComponent<BossBlockPiece>() != (Object)null || (Object)(object)((Component)((RaycastHit)(ref ((Projectile)this).raycastHit)).collider).GetComponent<BossBlockWeapon>() != (Object)null)
				{
					((SachelPack)this).stuckUp = true;
					((BroforceObject)this).xI = (((BroforceObject)this).yI = 0f);
					((SachelPack)this).PlayStuckSound(0.7f);
				}
				else if ((Object)(object)((Component)((RaycastHit)(ref ((Projectile)this).raycastHit)).collider).GetComponent<Block>() != (Object)null)
				{
					((SachelPack)this).stuckUp = true;
					((BroforceObject)this).xI = (((BroforceObject)this).yI = 0f);
					((SachelPack)this).PlayStuckSound(0.7f);
				}
				else
				{
					((SachelPack)this).stickyToUnits = false;
					((BroforceObject)this).yI = ((BroforceObject)this).yI * (0f - (((SachelPack)this).bounceYM + 0.1f));
					((SachelPack)this).MakeBounceEffect((DirectionEnum)2, ((RaycastHit)(ref ((Projectile)this).raycastHit)).point);
					((SachelPack)this).PlayBounceSound(((BroforceObject)this).yI);
				}
			}
		}
		if ((Object)(object)((SachelPack)this).stuckToUnit != (Object)null)
		{
			Vector3 val = ((Component)((SachelPack)this).stuckToUnit).transform.TransformPoint(((SachelPack)this).stuckTolocalPos);
			((BroforceObject)this).SetXY(val.x, val.y);
			((BroforceObject)this).xI = ((BroforceObject)((SachelPack)this).stuckToUnit).xI;
			((BroforceObject)this).yI = ((BroforceObject)((SachelPack)this).stuckToUnit).yI;
			if (((BroforceObject)((SachelPack)this).stuckToUnit).health <= 0 && !stickToDeadUnit && Mathf.Abs(((BroforceObject)((SachelPack)this).stuckToUnit).xI) + Mathf.Abs(((BroforceObject)((SachelPack)this).stuckToUnit).yI) < 100f)
			{
				((SachelPack)this).DetachFromUnit();
			}
			return false;
		}
		return true;
	}

	protected override void SetRotation()
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)((SachelPack)this).stuckToUnit != (Object)null)
		{
			((Component)this).transform.localScale = new Vector3(1f, 1f, 1f);
			((Component)this).transform.eulerAngles = new Vector3(0f, 0f, 0f);
		}
		else if (((BroforceObject)this).xI > 0f)
		{
			((Component)this).transform.localScale = new Vector3(-1f, 1f, 1f);
			((Component)this).transform.eulerAngles = new Vector3(0f, 0f, Math.GetAngle(((BroforceObject)this).yI, 0f - ((BroforceObject)this).xI) * 180f / (float)Math.PI);
		}
		else if (((BroforceObject)this).xI < 0f || ((SachelPack)this).stuckLeft || ((SachelPack)this).stuckRight)
		{
			((Component)this).transform.localScale = new Vector3(1f, 1f, 1f);
			((Component)this).transform.eulerAngles = new Vector3(0f, 0f, Math.GetAngle(((BroforceObject)this).yI, 0f - ((BroforceObject)this).xI) * 180f / (float)Math.PI);
		}
		else if (previousSpeed > 0f)
		{
			((Component)this).transform.localScale = new Vector3(-1f, 1f, 1f);
			((Component)this).transform.eulerAngles = new Vector3(0f, 0f, -90f);
		}
		else
		{
			((Component)this).transform.localScale = new Vector3(1f, 1f, 1f);
			((Component)this).transform.eulerAngles = new Vector3(0f, 0f, 90f);
		}
	}
}
public class ExplosiveGum : CustomSachelPack
{
	protected bool stickToDeadUnit;

	protected float previousSpeed;

	protected override void Awake()
	{
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)base.DefaultSoundHolder == (Object)null)
		{
			ref SoundHolder defaultSoundHolder = ref base.DefaultSoundHolder;
			TestVanDammeAnim heroPrefab = HeroController.GetHeroPrefab((HeroType)49);
			defaultSoundHolder = ((BroGummer)((heroPrefab is BroGummer) ? heroPrefab : null)).sachelPackProjectile.soundHolder;
		}
		((CustomSachelPack)this).Awake();
		((Projectile)this).life = 1f;
		((Projectile)this).fullLife = 1f;
		((SachelPack)this).range = 20f;
		((SachelPack)this).blastForce = 8f;
		((SachelPack)this).sticky = true;
		((SachelPack)this).stickyToUnits = true;
		((Projectile)this).damage = 20;
		((Projectile)this).damageInternal = 1;
		((Projectile)this).fullDamage = 1;
		((Projectile)this).damageType = (DamageType)1;
		((Projectile)this).canHitGrenades = false;
		((Projectile)this).projectileSize = 8f;
		((Projectile)this).soundVolume = 0.6f;
	}

	public override void PrefabSetup()
	{
		TestVanDammeAnim heroPrefab = HeroController.GetHeroPrefab((HeroType)49);
		Projectile sachelPackProjectile = ((BroGummer)((heroPrefab is BroGummer) ? heroPrefab : null)).sachelPackProjectile;
		SachelPack val = (SachelPack)(object)((sachelPackProjectile is SachelPack) ? sachelPackProjectile : null);
		((SachelPack)this).fire1 = val.fire1;
		((SachelPack)this).fire2 = val.fire2;
		((SachelPack)this).fire3 = val.fire3;
		((SachelPack)this).smoke1 = val.smoke1;
		((SachelPack)this).smoke2 = val.smoke2;
		((SachelPack)this).explosion = val.explosion;
		((SachelPack)this).explosionSmall = val.explosionSmall;
		((Projectile)this).shrapnel = ((Projectile)val).shrapnel;
		((Projectile)this).shrapnelSpark = ((Projectile)val).shrapnelSpark;
		((Projectile)this).flickPuff = ((Projectile)val).flickPuff;
		((SachelPack)this).heightOffGround = val.heightOffGround;
		((SachelPack)this).bounceYM = val.bounceYM;
		((SachelPack)this).bounceXM = val.bounceXM;
		((SachelPack)this).frictionM = val.frictionM;
		((SachelPack)this).bounceVolumeM = val.bounceVolumeM;
		((Projectile)this).soundVolume = ((Projectile)val).soundVolume;
		((Projectile)this).sparkCount = ((Projectile)val).sparkCount;
		((Projectile)this).horizontalProjectile = ((Projectile)val).horizontalProjectile;
	}

	public override void TryStickToUnit(Unit unit, bool _stickToDeadUnit = false)
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		stickToDeadUnit = _stickToDeadUnit;
		if ((Object)(object)unit != (Object)null)
		{
			((SachelPack)this).stuckToUnit = unit;
			((SachelPack)this).PlayStuckSound(0.7f);
			Vector3 val = ((Component)((SachelPack)this).stuckToUnit).transform.InverseTransformPoint(((Component)this).transform.position);
			((SachelPack)this).StickToUnit(((SachelPack)this).stuckToUnit, val);
		}
	}
}
internal class TranqDart : CustomProjectile
{
	protected override void Awake()
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		base.SpriteWidth = 10f;
		base.SpriteHeight = 10f;
		((CustomProjectile)this).Awake();
		((Projectile)this).damageType = (DamageType)3;
		((Projectile)this).damage = 3;
		((Projectile)this).damageInternal = ((Projectile)this).damage;
		((Projectile)this).fullDamage = ((Projectile)this).damage;
		((Projectile)this).life = 0.3f;
	}

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

	private bool CanFallOnFace(Mook mook)
	{
		//IL_0001: 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)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Invalid comparison between Unknown and I4
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Invalid comparison between Unknown and I4
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Expected I4, but got Unknown
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Invalid comparison between Unknown and I4
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Invalid comparison between Unknown and I4
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Invalid comparison between Unknown and I4
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Invalid comparison between Unknown and I4
		MookType mookType = mook.mookType;
		if ((int)mookType <= 9)
		{
			switch ((int)mookType)
			{
			default:
				if ((int)mookType == 7 || (int)mookType == 9)
				{
					goto IL_004e;
				}
				goto IL_0050;
			case 0:
				break;
			case 1:
			case 4:
				goto IL_004e;
			case 2:
			case 3:
				goto IL_0050;
			}
			if (mook is MookGeneral)
			{
				return false;
			}
			return true;
		}
		if ((int)mookType == 12 || (int)mookType == 15 || (int)mookType == 17)
		{
			goto IL_004e;
		}
		goto IL_0050;
		IL_0050:
		return false;
		IL_004e:
		return true;
	}

	protected override void HitUnits()
	{
		//IL_0499: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0202: Unknown result type (might be due to invalid IL or missing references)
		//IL_023b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0242: Invalid comparison between Unknown and I4
		//IL_043f: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_03be: Unknown result type (might be due to invalid IL or missing references)
		//IL_0369: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
		bool flag = false;
		float projectileSize = ((Projectile)this).projectileSize;
		float num = ((Projectile)this).projectileSize / 2f;
		MonoBehaviour firedBy = ((Projectile)this).firedBy;
		MonoBehaviour firedBy2 = ((Projectile)this).firedBy;
		if (Map.units != null)
		{
			for (int num2 = Map.units.Count - 1; num2 >= 0; num2--)
			{
				Unit val = Map.units[num2];
				if ((Object)(object)val != (Object)null && (GameModeController.DoesPlayerNumDamage(((Projectile)this).playerNum, ((NetworkedUnit)val).playerNum) || (((NetworkedUnit)val).playerNum < 0 && val.CatchFriendlyBullets())) && !val.invulnerable && ((BroforceObject)val).health > 0)
				{
					float num3 = ((BroforceObject)val).X - ((BroforceObject)this).X;
					if (Mathf.Abs(num3) - projectileSize < val.width)
					{
						float num4 = ((BroforceObject)val).Y + val.height / 2f + 4f - ((BroforceObject)this).Y;
						if (Mathf.Abs(num4) - num < val.height && Mathf.Sqrt(num3 * num3 + num4 * num4) <= projectileSize + val.width && ((Object)(object)firedBy2 == (Object)null || (Object)(object)firedBy2 != (Object)(object)val || val.CatchFriendlyBullets()))
						{
							float num5 = 20f / (float)((BroforceObject)val).health;
							num5 = ((num5 < 2f) ? 2f : num5);
							if (((Component)val).CompareTag("Metal") || ((Component)val).CompareTag("Boss") || val is DolphLundrenSoldier || val is SatanMiniboss)
							{
								if (MissionImpossibro.bossHitCounter.ContainsKey(val))
								{
									if (MissionImpossibro.bossHitCounter[val] > 8)
									{
										val.Stun(num5);
										MissionImpossibro.bossHitCounter[val] = -6;
									}
									else
									{
										Dictionary<Unit, int> bossHitCounter = MissionImpossibro.bossHitCounter;
										Unit key = val;
										int value = bossHitCounter[key] + 1;
										bossHitCounter[key] = value;
									}
								}
								else
								{
									MissionImpossibro.bossHitCounter.Add(val, 1);
								}
								Map.KnockAndDamageUnit(firedBy, val, ((Projectile)this).damage, ((Projectile)this).damageType, ((BroforceObject)this).xI, ((BroforceObject)this).yI, (int)Mathf.Sign(((BroforceObject)this).xI), false, ((BroforceObject)this).X, ((BroforceObject)this).Y, false);
								flag = true;
								break;
							}
							if ((int)val.actionState != 12 && !val.IsIncapacitated())
							{
								if (val is Mook)
								{
									Mook val2 = (Mook)(object)((val is Mook) ? val : null);
									if (CanFallOnFace(val2))
									{
										if (!((Unit)val2).IsOnGround())
										{
											if (val2 is MookJetpack)
											{
												Traverse.Create((object)((val2 is MookJetpack) ? val2 : null)).Method("StartSpiralling", new object[0]).GetValue();
											}
											else
											{
												((Unit)val2).IsParachuteActive = false;
												Traverse val3 = Traverse.Create((object)val2);
												val3.Method("FallOnFace", new object[0]).GetValue();
												val3.Field("fallenTime").SetValue((object)num5);
											}
											Map.KnockAndDamageUnit(firedBy, val, 2, ((Projectile)this).damageType, ((BroforceObject)this).xI, ((BroforceObject)this).yI, (int)Mathf.Sign(((BroforceObject)this).xI), false, ((BroforceObject)this).X, ((BroforceObject)this).Y, false);
										}
										else
										{
											Traverse val4 = Traverse.Create((object)val2);
											val4.Method("FallOnFace", new object[0]).GetValue();
											val4.Field("fallenTime").SetValue((object)num5);
											Map.KnockAndDamageUnit(firedBy, val, 2, ((Projectile)this).damageType, ((BroforceObject)this).xI, ((BroforceObject)this).yI, (int)Mathf.Sign(((BroforceObject)this).xI), false, ((BroforceObject)this).X, ((BroforceObject)this).Y, false);
										}
									}
									else
									{
										val.Stun(num5);
										if (((BroforceObject)val).maxHealth > 10)
										{
											Map.KnockAndDamageUnit(firedBy, val, ((Projectile)this).damage + 2, ((Projectile)this).damageType, ((BroforceObject)this).xI, ((BroforceObject)this).yI, (int)Mathf.Sign(((BroforceObject)this).xI), false, ((BroforceObject)this).X, ((BroforceObject)this).Y, false);
										}
										else
										{
											Map.KnockAndDamageUnit(firedBy, val, ((Projectile)this).damage, ((Projectile)this).damageType, ((BroforceObject)this).xI, ((BroforceObject)this).yI, (int)Mathf.Sign(((BroforceObject)this).xI), false, ((BroforceObject)this).X, ((BroforceObject)this).Y, false);
										}
									}
								}
								else
								{
									val.Stun(num5);
									Map.KnockAndDamageUnit(firedBy, val, ((Projectile)this).damage, ((Projectile)this).damageType, ((BroforceObject)this).xI, ((BroforceObject)this).yI, (int)Mathf.Sign(((BroforceObject)this).xI), false, ((BroforceObject)this).X, ((BroforceObject)this).Y, false);
								}
								flag = true;
								break;
							}
						}
					}
				}
			}
		}
		if (flag)
		{
			((Projectile)this).MakeEffects(false, ((BroforceObject)this).X, ((BroforceObject)this).Y, false, ((RaycastHit)(ref ((Projectile)this).raycastHit)).normal, ((RaycastHit)(ref ((Projectile)this).raycastHit)).point);
			Object.Destroy((Object)(object)((Component)this).gameObject);
			((Projectile)this).hasHit = true;
		}
	}

	protected override void TryHitUnitsAtSpawn()
	{
		((Projectile)this).HitUnits();
	}

	public void Setup()
	{
		((Behaviour)this).enabled = true;
	}
}