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 BroMakerLib.Loggers;
using Effects;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Brostbuster")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Brostbuster")]
[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 Brostbuster;
[HeroPreset(/*Could not decode attribute arguments.*/)]
public class Brostbuster : CustomHero
{
private LineRenderer protonLine1;
private LineRenderer protonLine1Cap;
private LineRenderer protonLine2;
private Material[] protonLine2Mats;
protected Vector3 protonLineHitpoint;
protected const float protonLineRange = 500f;
protected const float offsetSpeed = 4f;
protected const float swaySpeedLerpM = 1f;
protected const int protonUnitDamage = 1;
protected const int protonWallDamage = 1;
protected float currentOffset;
protected float currentOffset2;
protected float sparkCooldown;
protected float flameCooldown;
protected float muzzleFlashCooldown;
protected int protonLine2Frame;
protected float protonLine2FrameCounter;
protected float protonDamageCooldown;
protected float fireKnockbackCooldown;
protected float effectCooldown;
public static Random rnd = new Random();
protected LayerMask fragileGroundLayer;
public AudioClip protonStartup;
public AudioClip protonBeamStartup;
public AudioClip protonLoop;
public AudioClip protonEnd;
public AudioSource protonAudio;
protected bool playedBeamStartup;
protected float startupTime;
protected float shutdownTime;
public static HashSet<Brostbuster> currentBros = new HashSet<Brostbuster>();
protected float currentGunPosition;
private GhostTrap trapPrefab;
private GhostTrap currentTrap;
protected int SlimerTraps;
protected bool usingSlimerMelee;
protected bool playedSlimerAudio;
protected bool alreadySpawnedSlimer;
private Slimer slimerPrefab;
private Slimer currentSlimer;
public static Color SlimerColor = new Color(0.058824f, 1f, 0f);
protected bool throwingMook;
public AudioClip slimerTrapOpen;
public AudioSource slimerPortalSource;
protected bool acceptedDeath;
[SaveableSetting(null)]
public static bool filterVariants = false;
[SaveableSetting(null)]
public static List<int> enabledVariants = new List<int> { 0, 1, 2, 3 };
public override void PreloadAssets()
{
CustomHero.PreloadSprites(((CustomHero)this).DirectoryPath, new List<string> { "protonLine1.png", "protonLine1End.png", "protonLine21.png", "protonLine22.png", "protonLine23.png", "protonLine24.png" });
CustomHero.PreloadSprites(((CustomHero)this).ProjectilePath, new List<string> { "ghostTrap.png", "slimer.png" });
CustomHero.PreloadSounds(((CustomHero)this).SoundPath, new List<string>
{
"protonStartup.wav", "protonStartup2.wav", "protonLoop.wav", "protonEnd.wav", "slimerTrapOpen.wav", "freeze1.wav", "freeze2.wav", "freeze3.wav", "freeze4.wav", "freeze5.wav",
"freeze6.wav", "freeze7.wav", "freeze8.wav", "slimer1.wav", "slimer2.wav", "slimer3.wav", "slimer4.wav", "trapOpen.wav", "trapMain.wav", "trapClosing.wav",
"trapClosed.wav"
});
}
public override void HarmonyPatches(Harmony harmony)
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
harmony.PatchAll(executingAssembly);
}
public override int GetVariant()
{
if (currentBros.Count > 0)
{
List<int> list = ((!filterVariants) ? new List<int> { 0, 1, 2, 3 } : new List<int>(enabledVariants));
foreach (Brostbuster currentBro in currentBros)
{
if (!((TestVanDammeAnim)currentBro).recalling)
{
list.Remove(((CustomHero)currentBro).CurrentVariant);
}
}
if (list.Count > 0)
{
currentBros.Add(this);
return list[Random.Range(0, list.Count)];
}
}
currentBros.Add(this);
if (filterVariants)
{
return enabledVariants[Random.Range(0, enabledVariants.Count)];
}
return ((CustomHero)this).GetVariant();
}
public override void UIOptions()
{
((CustomHero)this).UIOptions();
filterVariants = GUILayout.Toggle(filterVariants, "Only spawn with certain skins", (GUILayoutOption[])(object)new GUILayoutOption[0]);
if (!filterVariants)
{
return;
}
GUILayout.Space(15f);
bool flag = enabledVariants.Contains(0);
bool flag2 = enabledVariants.Contains(1);
bool flag3 = enabledVariants.Contains(2);
bool flag4 = enabledVariants.Contains(3);
if (flag != (flag = GUILayout.Toggle(flag, "Ray Stantz", (GUILayoutOption[])(object)new GUILayoutOption[0])))
{
if (flag)
{
enabledVariants.Add(0);
}
else
{
enabledVariants.Remove(0);
}
}
if (flag2 != (flag2 = GUILayout.Toggle(flag2, "Peter Venkman", (GUILayoutOption[])(object)new GUILayoutOption[0])))
{
if (flag2)
{
enabledVariants.Add(1);
}
else
{
enabledVariants.Remove(1);
}
}
if (flag3 != (flag3 = GUILayout.Toggle(flag3, "Egon Spengler", (GUILayoutOption[])(object)new GUILayoutOption[0])))
{
if (flag3)
{
enabledVariants.Add(2);
}
else
{
enabledVariants.Remove(2);
}
}
if (flag4 != (flag4 = GUILayout.Toggle(flag4, "Winston Zeddemore", (GUILayoutOption[])(object)new GUILayoutOption[0])))
{
if (flag4)
{
enabledVariants.Add(3);
}
else
{
enabledVariants.Remove(3);
}
}
}
public override void BeforePrefabSetup()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
base.SoundHolderVoiceType = (SoundHolderVoiceTypes)2;
}
public override void AfterPrefabSetup()
{
protonStartup = ResourcesController.GetAudioClip(((CustomHero)this).SoundPath, "protonStartup.wav");
protonBeamStartup = ResourcesController.GetAudioClip(((CustomHero)this).SoundPath, "protonStartup2.wav");
protonLoop = ResourcesController.GetAudioClip(((CustomHero)this).SoundPath, "protonLoop.wav");
protonEnd = ResourcesController.GetAudioClip(((CustomHero)this).SoundPath, "protonEnd.wav");
slimerTrapOpen = ResourcesController.GetAudioClip(((CustomHero)this).SoundPath, "slimerTrapOpen.wav");
protonAudio = ((Component)this).gameObject.AddComponent<AudioSource>();
protonAudio.rolloffMode = (AudioRolloffMode)1;
protonAudio.minDistance = 200f;
protonAudio.dopplerLevel = 0.1f;
protonAudio.maxDistance = 500f;
protonAudio.spatialBlend = 1f;
protonAudio.volume = 0.33f;
}
protected override void Awake()
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: 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_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_01a5: 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_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
((CustomHero)this).Awake();
protonLine1 = new GameObject("ProtonLine1", new Type[1] { typeof(LineRenderer) }).GetComponent<LineRenderer>();
((Component)protonLine1).transform.parent = ((Component)this).transform;
((Renderer)protonLine1).material = ResourcesController.GetMaterial(((CustomHero)this).DirectoryPath, "protonLine1.png");
((Renderer)protonLine1).material.mainTexture.wrapMode = (TextureWrapMode)0;
protonLine1Cap = new GameObject("ProtonLine1End", new Type[1] { typeof(LineRenderer) }).GetComponent<LineRenderer>();
((Component)protonLine1Cap).transform.parent = ((Component)this).transform;
((Renderer)protonLine1Cap).material = ResourcesController.GetMaterial(((CustomHero)this).DirectoryPath, "protonLine1End.png");
((Renderer)protonLine1Cap).material.mainTexture.wrapMode = (TextureWrapMode)0;
protonLine2 = new GameObject("ProtonLine2", new Type[1] { typeof(LineRenderer) }).GetComponent<LineRenderer>();
((Component)protonLine2).transform.parent = ((Component)this).transform;
protonLine2Mats = (Material[])(object)new Material[4];
for (int i = 0; i < 4; i++)
{
protonLine2Mats[i] = ResourcesController.GetMaterial(((CustomHero)this).DirectoryPath, "protonLine2" + (i + 1) + ".png");
protonLine2Mats[i].mainTexture.wrapMode = (TextureWrapMode)0;
}
((Renderer)protonLine2).material = protonLine2Mats[0];
fragileGroundLayer = LayerMask.op_Implicit(LayerMask.op_Implicit(((TestVanDammeAnim)this).fragileLayer) | LayerMask.op_Implicit(((TestVanDammeAnim)this).groundLayer));
trapPrefab = CustomGrenade.CreatePrefab<GhostTrap>();
slimerPrefab = CustomProjectile.CreatePrefab<Slimer>();
((BroBase)this).currentMeleeType = (MeleeType)2;
((BroBase)this).meleeType = (MeleeType)2;
}
protected override void Start()
{
((CustomHero)this).Start();
currentBros.Add(this);
}
protected override void Update()
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Invalid comparison between Unknown and I4
((BroBase)this).Update();
if (acceptedDeath)
{
if (((BroforceObject)this).health <= 0 && !((TestVanDammeAnim)this).WillReviveAlready)
{
return;
}
currentBros.Add(this);
acceptedDeath = false;
}
if (((TestVanDammeAnim)this).isOnHelicopter)
{
StopProtonGun();
((Behaviour)protonAudio).enabled = false;
}
if ((int)((Unit)this).actionState == 5 && !acceptedDeath)
{
StopProtonGun();
((Behaviour)protonAudio).enabled = false;
if (!((TestVanDammeAnim)this).WillReviveAlready)
{
currentBros.Remove(this);
acceptedDeath = true;
}
}
}
protected override void StartFiring()
{
((TestVanDammeAnim)this).StartFiring();
fireKnockbackCooldown = 0f;
((Behaviour)protonAudio).enabled = true;
protonAudio.clip = protonStartup;
protonAudio.loop = false;
protonAudio.volume = 0.33f;
protonAudio.Play();
if (shutdownTime - 0.2f > 0f && playedBeamStartup)
{
startupTime = shutdownTime / 2f;
protonAudio.time = startupTime / 2f;
}
else
{
startupTime = 0f;
protonAudio.time = 0f;
}
playedBeamStartup = false;
}
protected override void RunFiring()
{
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
protonDamageCooldown -= ((Unit)this).t;
effectCooldown -= ((Unit)this).t;
flameCooldown -= ((Unit)this).t;
fireKnockbackCooldown -= ((Unit)this).t;
if (((TestVanDammeAnim)this).fire)
{
if (!playedBeamStartup)
{
startupTime += ((Unit)this).t;
if (startupTime > 1.1f || !protonAudio.isPlaying)
{
protonAudio.clip = protonBeamStartup;
protonAudio.time = 0f;
protonAudio.Play();
StartProtonGun();
playedBeamStartup = true;
}
return;
}
if (!protonAudio.isPlaying)
{
protonAudio.clip = protonLoop;
protonAudio.loop = true;
protonAudio.Play();
}
currentOffset += ((Unit)this).t * 4f;
currentOffset2 += ((Unit)this).t * 4f * 1.9f;
UpdateProtonGun();
((TestVanDammeAnim)this).StopRolling();
((TestVanDammeAnim)this).FireFlashAvatar();
if ((int)((TestVanDammeAnim)this).currentGesture != 0)
{
((TestVanDammeAnim)this).SetGestureAnimation((Gestures)0);
}
}
else if (shutdownTime > 0f)
{
shutdownTime -= ((Unit)this).t;
if (shutdownTime <= 0f)
{
((Behaviour)protonAudio).enabled = false;
playedBeamStartup = false;
}
}
}
protected override void AddSpeedLeft()
{
if (!usingSlimerMelee)
{
((BroBase)this).AddSpeedLeft();
if (((TestVanDammeAnim)this).xIBlast > ((TestVanDammeAnim)this).speed * 1.6f)
{
((TestVanDammeAnim)this).xIBlast = ((TestVanDammeAnim)this).speed * 1.6f;
}
}
}
protected override void AddSpeedRight()
{
if (!usingSlimerMelee)
{
((BroBase)this).AddSpeedRight();
if (((TestVanDammeAnim)this).xIBlast < ((TestVanDammeAnim)this).speed * -1.6f)
{
((TestVanDammeAnim)this).xIBlast = ((TestVanDammeAnim)this).speed * -1.6f;
}
}
}
protected override void RunGun()
{
if (!((TestVanDammeAnim)this).wallDrag && ((TestVanDammeAnim)this).fire && playedBeamStartup)
{
((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 < 1)
{
((TestVanDammeAnim)this).gunFrame = 3;
}
((TestVanDammeAnim)this).SetGunSprite(((TestVanDammeAnim)this).gunFrame, 0);
}
}
else 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(((TestVanDammeAnim)this).gunFrame, 0);
}
}
protected override void SetGunPosition(float xOffset, float yOffset)
{
currentGunPosition = yOffset;
((CustomHero)this).SetGunPosition(xOffset, yOffset);
}
protected override void StopFiring()
{
((TestVanDammeAnim)this).StopFiring();
StopProtonGun();
protonAudio.clip = protonEnd;
protonAudio.loop = false;
protonAudio.volume = 0.08f;
protonAudio.Play();
shutdownTime = protonEnd.length + 0.2f;
}
protected void StartProtonGun()
{
currentOffset = 0f;
currentOffset2 = 0f;
protonLine2Frame = 0;
protonLine2FrameCounter = 0f;
protonDamageCooldown = 0f;
effectCooldown = 0f;
((Renderer)protonLine1).enabled = true;
protonLine1.startWidth = 8f;
protonLine1.endWidth = 13f;
protonLine1.textureMode = (LineTextureMode)3;
((Renderer)protonLine1Cap).enabled = true;
protonLine1Cap.startWidth = 3f;
protonLine1Cap.textureMode = (LineTextureMode)3;
protonLine1Cap.numCornerVertices = 10;
protonLine1Cap.positionCount = 3;
((Renderer)protonLine2).enabled = true;
protonLine2.startWidth = 13f;
protonLine2.endWidth = 18f;
protonLine2.textureMode = (LineTextureMode)3;
DrawProtonLine();
}
protected void UpdateProtonGun()
{
DrawProtonLine();
}
protected void StopProtonGun()
{
((Renderer)protonLine1).enabled = false;
((Renderer)protonLine1Cap).enabled = false;
((Renderer)protonLine2).enabled = false;
}
protected void DrawProtonLine()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: 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_0043: 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_0065: 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_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_0254: Unknown result type (might be due to invalid IL or missing references)
//IL_0255: Unknown result type (might be due to invalid IL or missing references)
//IL_0256: Unknown result type (might be due to invalid IL or missing references)
//IL_025b: Unknown result type (might be due to invalid IL or missing references)
//IL_0279: Unknown result type (might be due to invalid IL or missing references)
//IL_0286: Unknown result type (might be due to invalid IL or missing references)
//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0320: Unknown result type (might be due to invalid IL or missing references)
//IL_032d: Unknown result type (might be due to invalid IL or missing references)
//IL_0350: Unknown result type (might be due to invalid IL or missing references)
//IL_0376: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_0456: Unknown result type (might be due to invalid IL or missing references)
//IL_0463: Unknown result type (might be due to invalid IL or missing references)
//IL_0470: Unknown result type (might be due to invalid IL or missing references)
//IL_047d: Unknown result type (might be due to invalid IL or missing references)
//IL_048a: Unknown result type (might be due to invalid IL or missing references)
//IL_0497: 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_0394: Unknown result type (might be due to invalid IL or missing references)
//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
//IL_03bb: 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_03ee: Unknown result type (might be due to invalid IL or missing references)
//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
//IL_041e: Unknown result type (might be due to invalid IL or missing references)
//IL_0444: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(((BroforceObject)this).X + ((Component)this).transform.localScale.x * 10f, ((BroforceObject)this).Y + 7f + currentGunPosition, 0f);
Vector3 endPoint = Vector3.zero;
Vector3 val2 = val;
val.x += ((Component)this).transform.localScale.x * 10f;
Vector3 val3 = val;
val3.x += ((Component)this).transform.localScale.x * 0.5f;
float num = ((Component)this).transform.localScale.x * (1.9f * Math.Sin(Math.PI2 * currentOffset));
val3.y += num;
Vector3 val4 = default(Vector3);
((Vector3)(ref val4))..ctor(((Component)this).transform.localScale.x * Mathf.Abs(val2.x - val3.x) / 2f + val2.x, val2.y + 0.75f * num);
if (sparkCooldown <= 0f)
{
int num2 = rnd.Next(3, 5);
for (int i = 0; i < num2; i++)
{
EffectsController.CreateSparkParticles(EffectsController.instance.sparkParticleShower, val2.x, val.y, 1, 0f, 30f + Random.value * 20f, Random.value * 50f, Random.value * 50f, 0.5f, 0.2f + Random.value * 0.2f);
}
sparkCooldown = Random.Range(0.25f, 0.5f);
}
sparkCooldown -= ((Unit)this).t;
Vector3 val5 = default(Vector3);
((Vector3)(ref val5))..ctor(((BroforceObject)this).X, ((BroforceObject)this).Y + 7f, 0f);
ProtonLineHitDetection(val5, ref endPoint);
float num3 = Vector3.Distance(val5, endPoint);
((Renderer)protonLine2).material = protonLine2Mats[protonLine2Frame];
protonLine2FrameCounter += ((Unit)this).t;
if (protonLine2FrameCounter >= 0.1f)
{
protonLine2FrameCounter -= 0.1f;
protonLine2Frame++;
if (protonLine2Frame > 3)
{
protonLine2Frame = 0;
}
}
Vector3 val6 = endPoint - val;
float magnitude = ((Vector3)(ref val6)).magnitude;
if (num3 > 30f)
{
protonLine1.SetPosition(0, val);
protonLine1.SetPosition(1, endPoint);
((Renderer)protonLine1).material.SetTextureScale("_MainTex", new Vector2(magnitude * 0.035f, 1f));
((Renderer)protonLine1).material.SetTextureOffset("_MainTex", new Vector2(0f - currentOffset, 0f));
protonLine1Cap.SetPosition(0, val2);
protonLine1Cap.SetPosition(1, val4);
protonLine1Cap.SetPosition(2, val3);
val2.z = -10f;
endPoint.z = -10f;
protonLine2.SetPosition(0, val2);
protonLine2.SetPosition(1, endPoint);
((Renderer)protonLine2).material.SetTextureScale("_MainTex", new Vector2(magnitude * 0.035f, 1f));
((Renderer)protonLine2).material.SetTextureOffset("_MainTex", new Vector2(0f - currentOffset2, 0f));
}
else if (num3 > 15f)
{
protonLine1.SetPosition(0, val);
protonLine1.SetPosition(1, val);
protonLine1Cap.SetPosition(0, val2);
protonLine1Cap.SetPosition(1, val4);
protonLine1Cap.SetPosition(2, endPoint);
val2.z = -10f;
endPoint.z = -10f;
protonLine2.SetPosition(0, val2);
protonLine2.SetPosition(1, endPoint);
((Renderer)protonLine2).material.SetTextureScale("_MainTex", new Vector2(magnitude * 0.035f, 1f));
((Renderer)protonLine2).material.SetTextureOffset("_MainTex", new Vector2(0f - currentOffset2, 0f));
}
else
{
protonLine1.SetPosition(0, val);
protonLine1.SetPosition(1, val);
protonLine1Cap.SetPosition(0, val);
protonLine1Cap.SetPosition(1, val);
protonLine1Cap.SetPosition(2, val);
protonLine2.SetPosition(0, val);
protonLine2.SetPosition(1, val);
}
}
public Unit HitClosestUnit(MonoBehaviour damageSender, int playerNum, float xRange, float yRange, float x, float y, int direction, Vector3 startPoint, bool haveHitGround, Vector3 groundVector)
{
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
if (Map.units == null)
{
return null;
}
int num = 999999;
float num2 = Mathf.Max(xRange, yRange);
Unit val = null;
for (int num3 = Map.units.Count - 1; num3 >= 0; num3--)
{
Unit val2 = Map.units[num3];
if ((Object)(object)val2 != (Object)null && !val2.invulnerable && ((BroforceObject)val2).health <= num && GameModeController.DoesPlayerNumDamage(playerNum, ((NetworkedUnit)val2).playerNum))
{
float num4 = ((BroforceObject)val2).X - x;
if (Mathf.Abs(num4) - xRange < val2.width && Mathf.Sign(num4) == (float)direction)
{
float num5 = ((BroforceObject)val2).Y + val2.height / 2f + 3f - y;
if (Mathf.Abs(num5) - yRange < val2.height)
{
float num6 = Mathf.Abs(num4) + Mathf.Abs(num5);
if (num6 < num2 && ((BroforceObject)val2).health > 0)
{
val = val2;
num2 = num6;
}
}
}
}
}
if ((Object)(object)val != (Object)null && (!haveHitGround || Mathf.Abs(((BroforceObject)val).X - x) < Mathf.Abs(groundVector.x - x)))
{
DamageUnit(val, startPoint);
return val;
}
return null;
}
public bool HitProjectiles(int playerNum, int damage, DamageType damageType, float xRange, float yRange, float x, float y, float xI, float yI, int direction)
{
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
bool result = false;
for (int num = Map.damageableProjectiles.Count - 1; num >= 0; num--)
{
Projectile val = Map.damageableProjectiles[num];
if ((Object)(object)val != (Object)null && GameModeController.DoesPlayerNumDamage(playerNum, val.playerNum))
{
float num2 = ((BroforceObject)val).X - x;
if (Mathf.Abs(num2) - xRange < val.projectileSize && Mathf.Sign(num2) == (float)direction && Mathf.Abs(((BroforceObject)val).Y - y) - yRange < val.projectileSize)
{
Map.DamageProjectile(val, damage, damageType, xI, yI, 0f, playerNum);
result = true;
}
}
}
return result;
}
protected void ProtonLineHitDetection(Vector3 startPoint, ref Vector3 endPoint)
{
//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_0011: 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_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: 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_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: 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_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_025e: Unknown result type (might be due to invalid IL or missing references)
//IL_026f: Unknown result type (might be due to invalid IL or missing references)
//IL_0275: Unknown result type (might be due to invalid IL or missing references)
//IL_0281: Unknown result type (might be due to invalid IL or missing references)
//IL_029c: Unknown result type (might be due to invalid IL or missing references)
//IL_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_0229: 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_0245: Unknown result type (might be due to invalid IL or missing references)
//IL_024a: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: 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_01f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: 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_0103: Unknown result type (might be due to invalid IL or missing references)
RaycastHit raycastHit = ((TestVanDammeAnim)this).raycastHit;
bool flag = false;
bool flag2 = false;
float num = 500f;
if (Physics.Raycast(startPoint, (((Component)this).transform.localScale.x > 0f) ? Vector3.right : Vector3.left, ref ((TestVanDammeAnim)this).raycastHit, num, LayerMask.op_Implicit(fragileGroundLayer)))
{
raycastHit = ((TestVanDammeAnim)this).raycastHit;
num = ((RaycastHit)(ref ((TestVanDammeAnim)this).raycastHit)).distance;
flag = true;
}
if (currentBros.Count > 1)
{
try
{
foreach (Brostbuster currentBro in currentBros)
{
if (((TestVanDammeAnim)currentBro).fire && currentBro.playedBeamStartup && Tools.FastAbsWithinRange(((BroforceObject)this).Y - ((BroforceObject)currentBro).Y, 10f))
{
float num2 = ((BroforceObject)this).X - ((BroforceObject)currentBro).X;
if (Tools.FastAbsWithinRange(num2, num) && -1f * Mathf.Sign(num2) == ((Component)this).transform.localScale.x && Mathf.Sign(num2) == ((Component)currentBro).transform.localScale.x)
{
num = Mathf.Abs(num2 / 2f);
flag2 = true;
flag = false;
}
}
}
}
catch
{
}
}
Unit val;
if ((Object)(object)(val = HitClosestUnit((MonoBehaviour)(object)this, ((NetworkedUnit)this).playerNum, num, 6f, startPoint.x, startPoint.y, (int)((Component)this).transform.localScale.x, startPoint, flag, ((RaycastHit)(ref raycastHit)).point)) != (Object)null)
{
endPoint = new Vector3(((BroforceObject)val).X, startPoint.y, 0f);
}
else if (flag)
{
DamageCollider(raycastHit);
endPoint = new Vector3(((RaycastHit)(ref raycastHit)).point.x, ((RaycastHit)(ref raycastHit)).point.y, 0f);
}
else if (flag2)
{
endPoint = new Vector3(startPoint.x + ((Component)this).transform.localScale.x * num, startPoint.y, 0f);
CreateExplosion(endPoint);
}
else
{
endPoint = new Vector3(startPoint.x + ((Component)this).transform.localScale.x * 500f, startPoint.y, 0f);
}
HitProjectiles(((NetworkedUnit)this).playerNum, 1, (DamageType)1, Mathf.Abs(endPoint.x - startPoint.x), 6f, startPoint.x, startPoint.y, ((Component)this).transform.localScale.x * 30f, 20f, (int)((Component)this).transform.localScale.x);
}
protected void DamageUnit(Unit unit, Vector3 startPoint)
{
//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_00e3: 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_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
if (protonDamageCooldown > 0f)
{
return;
}
if ((Object)(object)unit != (Object)null && SortOfFollow.IsItSortOfVisible(((Component)unit).transform.position, 24f, 24f))
{
unit.Damage(1, (DamageType)1, ((Component)this).transform.localScale.x, 0f, (int)((Component)this).transform.localScale.x, (MonoBehaviour)(object)this, ((BroforceObject)unit).X, ((BroforceObject)unit).Y);
unit.Knock((DamageType)1, ((Component)this).transform.localScale.x * 30f, 20f, false);
if (BroMakerUtilities.IsBoss(unit) || unit is Tank)
{
protonDamageCooldown = 0.055f;
}
else
{
protonDamageCooldown = 0.08f;
}
}
MakeHitEffect(new Vector3(((BroforceObject)unit).X + ((Component)this).transform.localScale.x * 4f, startPoint.y));
}
protected void DamageCollider(RaycastHit hit)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: 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_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Expected O, but got Unknown
//IL_0053: 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_0076: 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_0099: Unknown result type (might be due to invalid IL or missing references)
if (protonDamageCooldown > 0f)
{
return;
}
if (SortOfFollow.IsItSortOfVisible(((RaycastHit)(ref hit)).point, 24f, 24f))
{
Unit component = ((Component)((RaycastHit)(ref hit)).collider).GetComponent<Unit>();
if ((Object)(object)component != (Object)null)
{
component.Damage(1 + ((((BroforceObject)component).health > 30) ? 1 : 0), (DamageType)1, ((Component)this).transform.localScale.x, 0f, (int)((Component)this).transform.localScale.x, (MonoBehaviour)(object)this, ((RaycastHit)(ref hit)).point.x, ((RaycastHit)(ref hit)).point.y);
component.Knock((DamageType)1, ((Component)this).transform.localScale.x * 30f, 20f, false);
}
else
{
((Component)((RaycastHit)(ref hit)).collider).SendMessage("Damage", (object)new DamageObject(1, (DamageType)0, 0f, 0f, ((RaycastHit)(ref hit)).point.x, ((RaycastHit)(ref hit)).point.y, (MonoBehaviour)(object)this));
}
protonDamageCooldown = 0.05f;
}
MakeHitEffect(new Vector3(((RaycastHit)(ref hit)).point.x + ((Component)this).transform.localScale.x * 4f, ((RaycastHit)(ref hit)).point.y));
}
protected void MakeHitEffect(Vector3 hitPoint)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: 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_005b: 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_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
if (effectCooldown <= 0f)
{
EffectsController.CreateEffect(EffectsController.instance.whiteFlashPopSmallPrefab, hitPoint.x, hitPoint.y + (float)Random.Range(-3, 3), 0f, 0f, Vector3.zero, (Transform)null);
effectCooldown = 0.15f;
}
if (flameCooldown <= 0f)
{
EffectsController.CreateFire(hitPoint.x, hitPoint.y + Random.Range(-1f, 1f) - 2f, 0f, 0f, new Vector3(((Component)this).transform.localScale.x * (float)Random.Range(0, 20), (float)Random.Range(0, 20), 0f));
flameCooldown = 0.1f;
}
}
protected void CreateExplosion(Vector3 position)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: 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_0112: 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_0052: 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_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
if (!(effectCooldown > 0f))
{
EffectsController.CreatePlumes(position.x, position.y, 5, 10f, 360f, 0f, 0f);
if (((NetworkObject)this).IsMine)
{
float num = 90f;
int num2 = 30;
MapController.DamageGround((MonoBehaviour)(object)this, num2, (DamageType)2, num, position.x, position.y, (Collider[])null, false);
Map.ExplodeUnits((MonoBehaviour)(object)this, num2, (DamageType)2, num, num * 0.8f, position.x, position.y - 32f, 200f, 200f, ((NetworkedUnit)this).playerNum, true, true, true);
MapController.BurnUnitsAround_NotNetworked((MonoBehaviour)(object)this, ((NetworkedUnit)this).playerNum, 5, num * 1f, position.x, position.y, true, true);
Map.HitProjectiles(((NetworkedUnit)this).playerNum, num2, (DamageType)2, num, position.x, position.y, 0f, 0f, 0.25f);
Map.ShakeTrees(position.x, position.y, 320f, 64f, 160f);
}
SortOfFollow.Shake(1f);
EffectsController.CreateHugeExplosion(position.x, position.y, 20f, 20f, 80f, 1f, 32f, 0.7f, 0.9f, 8, 20, 110f, 160f, 0f, 0.9f);
effectCooldown = 0.3f;
}
}
protected override void OnDestroy()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
if ((int)((Unit)this).actionState != 5)
{
currentBros.Remove(this);
}
((BroBase)this).OnDestroy();
}
protected override void UseSpecial()
{
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: 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)
if ((Object)(object)currentTrap != (Object)null && currentTrap.state != GhostTrap.TrapState.Closed)
{
currentTrap.StartClosingTrap();
}
else if (((TestVanDammeAnim)this).SpecialAmmo > 0)
{
((TestVanDammeAnim)this).PlayThrowLightSound(0.4f);
int specialAmmo = ((TestVanDammeAnim)this).SpecialAmmo;
((TestVanDammeAnim)this).SpecialAmmo = specialAmmo - 1;
if (((NetworkObject)this).IsMine)
{
Grenade val = ((!((TestVanDammeAnim)this).down || !((Unit)this).IsOnGround() || !((TestVanDammeAnim)this).ducking) ? ProjectileController.SpawnGrenadeLocally((Grenade)(object)trapPrefab, (MonoBehaviour)(object)this, ((BroforceObject)this).X + Mathf.Sign(((Component)this).transform.localScale.x) * 8f, ((BroforceObject)this).Y + 8f, 0.001f, 0.011f, Mathf.Sign(((Component)this).transform.localScale.x) * 200f, 150f, ((NetworkedUnit)this).playerNum, 0) : ProjectileController.SpawnGrenadeLocally((Grenade)(object)trapPrefab, (MonoBehaviour)(object)this, ((BroforceObject)this).X + Mathf.Sign(((Component)this).transform.localScale.x) * 6f, ((BroforceObject)this).Y + 3f, 0.001f, 0.011f, Mathf.Sign(((Component)this).transform.localScale.x) * 30f, 70f, ((NetworkedUnit)this).playerNum, 0));
currentTrap = ((Component)val).GetComponent<GhostTrap>();
currentTrap.thrownBy = ((NetworkedUnit)this).playerNum;
((Behaviour)currentTrap).enabled = true;
}
}
else
{
HeroController.FlashSpecialAmmo(((NetworkedUnit)this).playerNum);
((TestVanDammeAnim)this).ActivateGun();
}
((TestVanDammeAnim)this).pressSpecialFacingDirection = 0;
}
public void ReturnTrap()
{
SlimerTraps++;
}
protected void MeleeAttack(bool shouldTryHitTerrain, bool playMissSound)
{
//IL_0062: 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_00cc: 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)
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);
if (Object.op_Implicit((Object)(object)Map.HitClosestUnit((MonoBehaviour)(object)this, ((NetworkedUnit)this).playerNum, 4, (DamageType)14, 14f, 24f, ((BroforceObject)this).X + ((Component)this).transform.localScale.x * 8f, ((BroforceObject)this).Y + 8f, ((Component)this).transform.localScale.x * 200f, 500f, true, false, ((NetworkObject)this).IsMine, false, true)))
{
((TestVanDammeAnim)this).sound.PlaySoundEffectAt(((TestVanDammeAnim)this).soundHolder.alternateMeleeHitSound, 1f, ((Component)this).transform.position, 1f, true, false, false, 0f);
((TestVanDammeAnim)this).meleeHasHit = true;
}
else if (playMissSound)
{
((TestVanDammeAnim)this).sound.PlaySoundEffectAt(((TestVanDammeAnim)this).soundHolder.missSounds, 0.3f, ((Component)this).transform.position, 1f, true, false, false, 0f);
}
((TestVanDammeAnim)this).meleeChosenUnit = null;
if (shouldTryHitTerrain && ((BroBase)this).TryMeleeTerrain(0, 2))
{
((TestVanDammeAnim)this).meleeHasHit = true;
}
((TestVanDammeAnim)this).TriggerBroMeleeEvent();
}
protected void SpawnSlimer()
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
currentSlimer = ((CustomProjectile)slimerPrefab).SpawnProjectileLocally((MonoBehaviour)(object)this, ((BroforceObject)this).X, ((BroforceObject)this).Y + 6f, ((Component)this).transform.localScale.x * 175f, 0f, ((NetworkedUnit)this).playerNum, 0f) as Slimer;
SlimerTraps--;
alreadySpawnedSlimer = true;
}
public override void SetGestureAnimation(Gestures gesture)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
if (!((TestVanDammeAnim)this).doingMelee)
{
((BroBase)this).SetGestureAnimation(gesture);
}
}
protected override void StartCustomMelee()
{
if (usingSlimerMelee)
{
return;
}
if (((BroBase)this).CanStartNewMelee())
{
alreadySpawnedSlimer = false;
playedSlimerAudio = false;
((Unit)this).frame = 1;
((TestVanDammeAnim)this).counter = -0.05f;
throwingMook = (Object)(object)((TestVanDammeAnim)this).nearbyMook != (Object)null && ((Unit)((TestVanDammeAnim)this).nearbyMook).CanBeThrown();
usingSlimerMelee = SlimerTraps > 0 && !throwingMook;
((TestVanDammeAnim)this).AnimateMelee();
}
else if (((BroBase)this).CanStartMeleeFollowUp())
{
((TestVanDammeAnim)this).meleeFollowUp = true;
alreadySpawnedSlimer = false;
playedSlimerAudio = false;
usingSlimerMelee = SlimerTraps > 0;
}
if (!((TestVanDammeAnim)this).jumpingMelee)
{
((TestVanDammeAnim)this).dashingMelee = true;
if (!usingSlimerMelee)
{
((BroforceObject)this).xI = (float)((NetworkedUnit)this).Direction * ((TestVanDammeAnim)this).speed;
}
}
((BroBase)this).StartMeleeCommon();
}
protected override void AnimateCustomMelee()
{
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
((BroBase)this).AnimateMeleeCommon();
if (usingSlimerMelee)
{
((TestVanDammeAnim)this).frameRate = 0.06f;
int num = 11 + ((Unit)this).frame;
((TestVanDammeAnim)this).sprite.SetLowerLeftPixel((float)(num * ((TestVanDammeAnim)this).spritePixelWidth), (float)(9 * ((TestVanDammeAnim)this).spritePixelHeight));
if (((Unit)this).frame == 0 && !playedSlimerAudio)
{
slimerPortalSource = ((TestVanDammeAnim)this).sound.PlaySoundEffectAt(slimerTrapOpen, 0.4f, ((Component)this).transform.position, 1f, true, false, true, 0f);
playedSlimerAudio = true;
}
else if (((Unit)this).frame == 8 && !alreadySpawnedSlimer)
{
((TestVanDammeAnim)this).counter = ((TestVanDammeAnim)this).counter - 0.066f;
SpawnSlimer();
}
else if (((Unit)this).frame >= 9)
{
((Unit)this).frame = 0;
((TestVanDammeAnim)this).CancelMelee();
}
return;
}
if (!throwingMook)
{
((TestVanDammeAnim)this).frameRate = 0.04f;
}
int num2 = 25 + Mathf.Clamp(((Unit)this).frame, 0, 6);
int num3 = 1;
if (!((TestVanDammeAnim)this).standingMelee)
{
if (((TestVanDammeAnim)this).jumpingMelee)
{
num2 = 17 + Mathf.Clamp(((Unit)this).frame, 0, 6);
num3 = 6;
}
else if (((TestVanDammeAnim)this).dashingMelee)
{
num2 = 17 + Mathf.Clamp(((Unit)this).frame, 0, 6);
num3 = 6;
if (((Unit)this).frame == 4)
{
((TestVanDammeAnim)this).counter = ((TestVanDammeAnim)this).counter - 0.0334f;
}
else if (((Unit)this).frame == 5)
{
((TestVanDammeAnim)this).counter = ((TestVanDammeAnim)this).counter - 0.0334f;
}
}
}
((TestVanDammeAnim)this).sprite.SetLowerLeftPixel((float)(num2 * ((TestVanDammeAnim)this).spritePixelWidth), (float)(num3 * ((TestVanDammeAnim)this).spritePixelHeight));
if (((Unit)this).frame == 3)
{
((TestVanDammeAnim)this).counter = ((TestVanDammeAnim)this).counter - 0.066f;
MeleeAttack(shouldTryHitTerrain: true, playMissSound: true);
}
else if (((Unit)this).frame > 3 && !((TestVanDammeAnim)this).meleeHasHit)
{
MeleeAttack(shouldTryHitTerrain: false, playMissSound: false);
}
if (((Unit)this).frame >= 6)
{
((Unit)this).frame = 0;
((TestVanDammeAnim)this).CancelMelee();
}
}
protected override void RunCustomMeleeMovement()
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Invalid comparison between Unknown and I4
//IL_029c: Unknown result type (might be due to invalid IL or missing references)
//IL_024e: Unknown result type (might be due to invalid IL or missing references)
//IL_0214: Unknown result type (might be due to invalid IL or missing references)
if (usingSlimerMelee)
{
if (!((TestVanDammeAnim)this).jumpingMelee && ((Unit)this).frame < 9)
{
((BroforceObject)this).xI = Mathf.Lerp(((BroforceObject)this).xI, 0f, ((Unit)this).t * 5f);
}
if ((int)((Unit)this).actionState == 3)
{
if (((TestVanDammeAnim)this).isInQuicksand)
{
((BroforceObject)this).xI = ((BroforceObject)this).xI * (1f - ((Unit)this).t * 20f);
((BroforceObject)this).xI = Mathf.Clamp(((BroforceObject)this).xI, -16f, 16f);
((TestVanDammeAnim)this).xIBlast = ((TestVanDammeAnim)this).xIBlast * (1f - ((Unit)this).t * 20f);
}
if (((TestVanDammeAnim)this).jumpTime > 0f)
{
((TestVanDammeAnim)this).jumpTime = ((TestVanDammeAnim)this).jumpTime - ((Unit)this).t;
if (!((TestVanDammeAnim)this).buttonJump)
{
((TestVanDammeAnim)this).jumpTime = 0f;
}
}
if (!((Object)(object)((TestVanDammeAnim)this).impaledByTransform != (Object)null))
{
if (((TestVanDammeAnim)this).wallClimbing)
{
((TestVanDammeAnim)this).ApplyWallClimbingGravity();
}
else if (((BroforceObject)this).yI > 40f)
{
((TestVanDammeAnim)this).ApplyFallingGravity();
}
else
{
((TestVanDammeAnim)this).ApplyFallingGravity();
}
}
if (((BroforceObject)this).yI < ((TestVanDammeAnim)this).maxFallSpeed)
{
((BroforceObject)this).yI = ((TestVanDammeAnim)this).maxFallSpeed;
}
if (((BroforceObject)this).yI < -50f)
{
((TestVanDammeAnim)this).RunFalling();
}
if (((TestVanDammeAnim)this).canCeilingHang && ((TestVanDammeAnim)this).hangGrace > 0f)
{
((TestVanDammeAnim)this).RunCheckHanging();
}
}
if (((TestVanDammeAnim)this).chimneyFlip || ((TestVanDammeAnim)this).wallClimbing || ((TestVanDammeAnim)this).wallDragTime > 0f)
{
((TestVanDammeAnim)this).CancelMelee();
}
}
else 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) * 6f;
}
}
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()
{
if ((Object)(object)slimerPortalSource != (Object)null && !alreadySpawnedSlimer && usingSlimerMelee)
{
slimerPortalSource.Stop();
}
((BroBase)this).CancelMelee();
usingSlimerMelee = false;
}
protected override void AnimateWallAnticipation()
{
if (usingSlimerMelee)
{
((TestVanDammeAnim)this).CancelMelee();
}
((TestVanDammeAnim)this).AnimateWallAnticipation();
}
}
internal class FloatingObject
{
public const float moveSpeed = 35f;
public float verticalMoveSpeed = 25f;
public float curMoveSpeed;
public float lerpSpeed = 10f;
public float curLerpSpeed = 1f;
public bool slowingDown;
public GhostTrap trap;
public BroforceObject trappedObject;
public Vector3 grabbedPosition;
public Vector3 currentPosition;
public float currentRotation;
public float rotationSpeed;
private bool movingRight;
public float targetHeight;
public float leftMostX;
public float rightMostX;
public float distanceToCenter;
public bool reachedStartingHeight;
public float height;
public FloatingObject(BroforceObject grabbedObject, GhostTrap parentTrap)
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
trap = parentTrap;
trappedObject = grabbedObject;
grabbedPosition = ((Component)trappedObject).transform.position;
currentPosition = ((Component)trappedObject).transform.position;
currentRotation = 0f;
if (Random.value > 0.5f)
{
rotationSpeed = Random.Range(-40f, -10f);
}
else
{
rotationSpeed = Random.Range(10f, 40f);
}
if (currentPosition.y > trap.topFloatingY)
{
targetHeight = trap.topFloatingY - 10f;
}
else if (currentPosition.y + 20f > trap.topFloatingY)
{
targetHeight = currentPosition.y + 5f;
}
else if (currentPosition.y < ((BroforceObject)trap).Y)
{
targetHeight = ((BroforceObject)trap).Y + 30f;
}
else
{
targetHeight = currentPosition.y + 15f;
}
DetermineLimits();
if (Tools.FastAbsWithinRange(currentPosition.x - rightMostX, 30f) || currentPosition.x - rightMostX > 0f)
{
movingRight = false;
}
else if (Tools.FastAbsWithinRange(currentPosition.x - leftMostX, 30f) || currentPosition.x - leftMostX < 0f)
{
movingRight = true;
}
else
{
movingRight = Random.value > 0.5f;
}
Unit val = (Unit)(object)((grabbedObject is Unit) ? grabbedObject : null);
if (val != null)
{
height = val.height;
}
}
public void DetermineLimits()
{
float num = (trap.topFloatingY - ((BroforceObject)trap).Y) / (trap.leftFloatingX - ((BroforceObject)trap).X);
leftMostX = (targetHeight - (((BroforceObject)trap).Y - ((BroforceObject)trap).X * num)) / num;
rightMostX = ((BroforceObject)trap).X - leftMostX + ((BroforceObject)trap).X;
}
public void MoveObject(float t)
{
//IL_035c: Unknown result type (might be due to invalid IL or missing references)
//IL_0371: Unknown result type (might be due to invalid IL or missing references)
//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0400: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)trappedObject == (Object)null)
{
RemoveObject();
return;
}
if (reachedStartingHeight && currentPosition.y < ((BroforceObject)trap).Y + 30f)
{
MoveUnitToCenter(t);
return;
}
float num = currentPosition.y - targetHeight;
if (num > 0.2f)
{
currentPosition.y -= t * verticalMoveSpeed;
}
else if (num < -0.2f)
{
currentPosition.y += t * verticalMoveSpeed;
}
else
{
reachedStartingHeight = true;
verticalMoveSpeed = 5f;
targetHeight -= 5f;
DetermineLimits();
}
num = currentPosition.x - rightMostX;
float num2 = currentPosition.x - leftMostX;
if (movingRight && Tools.FastAbsWithinRange(num, 5f))
{
movingRight = false;
slowingDown = false;
}
else if (!movingRight && Tools.FastAbsWithinRange(num2, 5f))
{
movingRight = true;
slowingDown = false;
}
if (movingRight && (Tools.FastAbsWithinRange(num, 10f) || slowingDown))
{
if (!slowingDown)
{
curMoveSpeed = 35f;
slowingDown = true;
currentPosition.x += t * 35f;
curLerpSpeed = 3f;
}
else
{
curLerpSpeed = Mathf.Lerp(curLerpSpeed, lerpSpeed, 2f);
curMoveSpeed = Mathf.Lerp(curMoveSpeed, -35f, t * curLerpSpeed);
currentPosition.x += t * curMoveSpeed;
if (Tools.FastAbsWithinRange(curMoveSpeed - -35f, 2f))
{
movingRight = false;
slowingDown = false;
}
}
}
else if (!movingRight && (Tools.FastAbsWithinRange(num2, 10f) || slowingDown))
{
if (!slowingDown)
{
curMoveSpeed = -35f;
slowingDown = true;
currentPosition.x += t * 35f;
curLerpSpeed = 3f;
}
else
{
curLerpSpeed = Mathf.Lerp(curLerpSpeed, lerpSpeed, 2f);
curMoveSpeed = Mathf.Lerp(curMoveSpeed, 35f, t * curLerpSpeed);
currentPosition.x += t * curMoveSpeed;
if (Tools.FastAbsWithinRange(curMoveSpeed - 35f, 2f))
{
movingRight = true;
slowingDown = false;
}
}
}
else if (movingRight)
{
currentPosition.x += t * 35f;
}
else
{
currentPosition.x -= t * 35f;
}
trappedObject.X = currentPosition.x;
trappedObject.Y = currentPosition.y;
((Component)trappedObject).transform.position = currentPosition;
((Component)trappedObject).transform.rotation = Quaternion.identity;
currentRotation += rotationSpeed * t;
if (currentRotation >= 360f)
{
currentRotation -= 360f;
}
else if (currentRotation <= -360f)
{
currentRotation += 360f;
}
((Component)trappedObject).transform.RotateAround(((Component)trappedObject).transform.position + new Vector3(0f, height), Vector3.forward, currentRotation);
}
public void MoveUnitToCenter(float t)
{
//IL_0045: 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_0061: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: 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_00ed: 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_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: 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_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)trappedObject == (Object)null)
{
RemoveObject();
return;
}
if (distanceToCenter == 0f)
{
distanceToCenter = Vector3.Distance(currentPosition, ((Component)trap).transform.position);
}
currentPosition = Vector3.MoveTowards(currentPosition, ((Component)trap).transform.position, 35f * t);
trappedObject.X = currentPosition.x;
trappedObject.Y = currentPosition.y;
((Component)trappedObject).transform.position = currentPosition;
((Component)trappedObject).transform.rotation = Quaternion.identity;
((Component)trappedObject).transform.RotateAround(((Component)trappedObject).transform.position + new Vector3(0f, height), Vector3.forward, currentRotation);
float num = Vector3.Distance(currentPosition, ((Component)trap).transform.position);
if (num > 2f)
{
((Component)trappedObject).transform.localScale = new Vector3(num / distanceToCenter, num / distanceToCenter, 1f);
}
else
{
ConsumeObject();
}
}
public void ConsumeObject()
{
BroforceObject obj = trappedObject;
Unit val = (Unit)(object)((obj is Unit) ? obj : null);
if (val != null)
{
trap.killedUnits++;
GhostTrap.grabbedUnits.Remove(val);
}
else
{
GhostTrap.grabbedObjects.Remove(trappedObject);
}
trap.floatingObjects.Remove(this);
Object.Destroy((Object)(object)((Component)trappedObject).gameObject);
}
public void RemoveObject()
{
BroforceObject obj = trappedObject;
Unit val = (Unit)(object)((obj is Unit) ? obj : null);
if (val != null)
{
trap.killedUnits++;
GhostTrap.grabbedUnits.Remove(val);
}
else
{
GhostTrap.grabbedObjects.Remove(trappedObject);
}
trap.floatingObjects.Remove(this);
}
public void ReleaseObject()
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
trappedObject.X = currentPosition.x;
trappedObject.Y = currentPosition.y;
((Component)trappedObject).transform.position = currentPosition;
((Component)trappedObject).transform.rotation = Quaternion.identity;
((Behaviour)trappedObject).enabled = true;
}
}
internal class GhostTrap : CustomGrenade
{
public enum TrapState
{
Thrown,
Opening,
Open,
Closing,
ClosingAnimation,
Closed
}
public AudioClip trapOpen;
public AudioClip trapMain;
public AudioClip trapClosing;
public AudioClip trapClosed;
protected AudioSource trapAudio;
protected int currentClip;
protected float shutdownTime;
protected int frame;
protected float counter;
protected const float trapWidth = 224f;
protected const float trapHeight = 128f;
protected float trapFramerate = 0.145f;
protected const int lastOpeningFrame = 9;
protected const int lastFrame = 19;
public TrapState state;
public float runTime;
protected float attractCounter;
public bool expediteClose;
public float topLeftX;
public float topLeftY;
public float topRightX;
public float topRightY;
public float bottomX;
public float bottomY;
public float topFloatingY;
public float leftFloatingX;
public float rightFloatingX;
public const float width = 120f;
public const float height = 130f;
public static Dictionary<Unit, FloatingObject> grabbedUnits = new Dictionary<Unit, FloatingObject>();
public static Dictionary<BroforceObject, FloatingObject> grabbedObjects = new Dictionary<BroforceObject, FloatingObject>();
public List<FloatingObject> floatingObjects = new List<FloatingObject>();
public List<Unit> ignoredUnits = new List<Unit>();
public int killedUnits;
public int thrownBy = -1;
protected override void Awake()
{
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: 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_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
try
{
if ((Object)(object)((Shrapnel)this).sprite == (Object)null)
{
base.SpriteLowerLeftPixel = new Vector2(0f, 128f);
base.SpritePixelDimensions = new Vector2(224f, 128f);
((Shrapnel)this).spriteWidth = 224f;
((Shrapnel)this).spriteHeight = 128f;
base.SpriteOffset = new Vector3(9f, 60f, 0f);
}
ref SoundHolder defaultSoundHolder = ref base.DefaultSoundHolder;
TestVanDammeAnim heroPrefab = HeroController.GetHeroPrefab((HeroType)11);
defaultSoundHolder = ((heroPrefab is SnakeBroskin) ? heroPrefab : null).specialGrenade.soundHolder;
((CustomGrenade)this).Awake();
((Grenade)this).disabledAtStart = false;
((Shrapnel)this).shrink = false;
((Grenade)this).trailType = (TrailType)4;
((Shrapnel)this).rotationSpeedMultiplier = 0f;
((Shrapnel)this).lifeLossOnBounce = false;
((Shrapnel)this).deathOnBounce = false;
((Shrapnel)this).destroyInsideWalls = false;
((Shrapnel)this).startLife = 10000f;
((Shrapnel)this).life = 10000f;
if ((Object)(object)trapAudio == (Object)null)
{
if ((Object)(object)((Component)this).gameObject.GetComponent<AudioSource>() == (Object)null)
{
trapAudio = ((Component)this).gameObject.AddComponent<AudioSource>();
trapAudio.rolloffMode = (AudioRolloffMode)0;
trapAudio.minDistance = 300f;
trapAudio.dopplerLevel = 0.1f;
trapAudio.maxDistance = 3000f;
trapAudio.spatialBlend = 1f;
trapAudio.volume = 0.33f;
}
else
{
trapAudio = ((Component)this).GetComponent<AudioSource>();
}
}
((Component)this).gameObject.layer = 28;
}
catch (Exception ex)
{
BMLogger.Log("Exception Creating Projectile: " + ex.ToString(), (LogType)3, true);
}
}
public override void PrefabSetup()
{
trapOpen = ResourcesController.GetAudioClip(base.SoundPath, "trapOpen.wav");
trapMain = ResourcesController.GetAudioClip(base.SoundPath, "trapMain.wav");
trapClosing = ResourcesController.GetAudioClip(base.SoundPath, "trapClosing.wav");
trapClosed = ResourcesController.GetAudioClip(base.SoundPath, "trapClosed.wav");
}
public override void ThrowGrenade(float XI, float YI, float newX, float newY, int _playerNum)
{
}
public override void Launch(float newX, float newY, float xI, float yI)
{
((Grenade)this).Launch(newX, newY, xI, yI);
((Shrapnel)this).startLife = 10000f;
((Shrapnel)this).life = 10000f;
}
protected override void RegisterGrenade()
{
}
protected override void HitFragile()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: 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_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Expected O, but got Unknown
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(((BroforceObject)this).xI, ((BroforceObject)this).yI, 0f);
Vector3 normalized = ((Vector3)(ref val)).normalized;
Collider[] array = Physics.OverlapSphere(new Vector3(((BroforceObject)this).X + normalized.x * 2f, ((BroforceObject)this).Y + normalized.y * 2f, 0f), 2f, LayerMask.op_Implicit(((Grenade)this).fragileLayer));
for (int i = 0; i < array.Length; i++)
{
EffectsController.CreateProjectilePuff(((BroforceObject)this).X, ((BroforceObject)this).Y);
if ((Object)(object)((Component)array[i]).GetComponent<DoorDoodad>() != (Object)null && state != TrapState.Closed)
{
((Shrapnel)this).Bounce(true, false);
}
else
{
((Component)array[i]).gameObject.SendMessage("Damage", (object)new DamageObject(1, ((Grenade)this).damageType, ((BroforceObject)this).xI, ((BroforceObject)this).yI, ((BroforceObject)this).X, ((BroforceObject)this).Y, (MonoBehaviour)(object)this), (SendMessageOptions)1);
}
}
}
protected override bool Update()
{
((Grenade)this).Update();
runTime += ((Shrapnel)this).t;
switch (state)
{
case TrapState.Opening:
case TrapState.Open:
counter += ((Shrapnel)this).t;
if (counter > trapFramerate)
{
counter -= trapFramerate;
frame++;
if (state != TrapState.Open && frame == 10)
{
trapFramerate = 0.08f;
state = TrapState.Open;
}
else if (frame > 19)
{
frame = 10;
}
((Shrapnel)this).sprite.SetLowerLeftPixel((float)frame * 224f, 128f);
}
attractCounter += ((Shrapnel)this).t;
if (runTime < 6f && attractCounter >= 0.0334f)
{
attractCounter -= 0.0334f;
Map.AttractMooks(((BroforceObject)this).X, ((BroforceObject)this).Y, 200f, 100f);
}
if (state > TrapState.Opening)
{
FindObjects();
}
if (trapAudio.clip.length - trapAudio.time <= 0.02f)
{
if (currentClip == 0)
{
trapAudio.clip = trapMain;
trapAudio.Play();
currentClip++;
}
else
{
trapAudio.clip = trapClosing;
trapAudio.Play();
currentClip = 2;
}
}
if (runTime > 8f)
{
trapFramerate = 0.08f;
runTime = 10f;
state = TrapState.Closing;
}
break;
case TrapState.Closing:
counter += ((Shrapnel)this).t;
if (counter > trapFramerate)
{
counter -= trapFramerate;
frame--;
if (frame < 10)
{
frame = 19;
}
((Shrapnel)this).sprite.SetLowerLeftPixel((float)frame * 224f, 128f);
}
if (runTime < 14f)
{
FindObjects();
}
if (currentClip == 2 && trapAudio.clip.length - trapAudio.time <= 0.02f)
{
trapAudio.clip = trapClosed;
trapAudio.Play();
currentClip++;
shutdownTime = trapClosed.length + 0.1f;
}
if (expediteClose && runTime > 12f && floatingObjects.Count == 0 && currentClip == 2)
{
trapAudio.clip = trapClosed;
trapAudio.Play();
currentClip++;
runTime = 15.5f;
shutdownTime = trapClosed.length + 0.1f;
}
if (runTime > 16f)
{
CloseTrap();
}
break;
case TrapState.ClosingAnimation:
counter += ((Shrapnel)this).t;
if (counter > trapFramerate)
{
counter -= trapFramerate;
frame--;
if (frame < 0)
{
frame = 0;
((BroforceObject)this).xI = 0f;
((BroforceObject)this).yI = 0f;
state = TrapState.Closed;
}
((Shrapnel)this).sprite.SetLowerLeftPixel((float)frame * 224f, 128f);
}
break;
case TrapState.Closed:
CheckReturnTrap();
((Shrapnel)this).sprite.SetLowerLeftPixel(0f, 128f);
if (shutdownTime > 0f)
{
shutdownTime -= ((Shrapnel)this).t;
if (shutdownTime <= 0f)
{
((Behaviour)trapAudio).enabled = false;
}
}
break;
}
return true;
}
protected override void LateUpdate()
{
((NetworkObject)this).LateUpdate();
MoveUnits();
}
protected override void RunMovement()
{
if (state == TrapState.Thrown || state == TrapState.Closed)
{
((Grenade)this).RunMovement();
if (((BroforceObject)this).Y < 0f)
{
((Grenade)this).DestroyGrenade();
}
}
}
protected override void Bounce(bool bounceX, bool bounceY)
{
if (state != TrapState.Closed && bounceY && ((BroforceObject)this).yI <= 0f)
{
ActivateTrap();
((BroforceObject)this).yI = 0f;
((BroforceObject)this).xI = 0f;
}
else
{
((Grenade)this).Bounce(bounceX, bounceY);
}
}
protected override void RunWarnings()
{
}
public override void Death()
{
if (state == TrapState.Closed && runTime > 100f)
{
((Grenade)this).DestroyGrenade();
}
}
protected override void DestroyGrenade()
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
protected override void OnDestroy()
{
ReleaseUnits();
((NetworkObject)this).OnDestroy();
}
protected void ActivateTrap()
{
runTime = 0.5f;
state = TrapState.Opening;
trapAudio.clip = trapOpen;
trapAudio.loop = false;
trapAudio.Play();
bottomX = ((BroforceObject)this).X;
bottomY = ((BroforceObject)this).Y - 10f;
topRightX = bottomX + 120f;
topRightY = bottomY + 130f;
topLeftX = bottomX - 120f;
topLeftY = topRightY;
topFloatingY = ((BroforceObject)this).Y + 110f;
leftFloatingX = ((BroforceObject)this).X - 90f;
rightFloatingX = ((BroforceObject)this).X + 90f;
}
public void StartClosingTrap()
{
expediteClose = true;
if (state == TrapState.Thrown)
{
ActivateTrap();
}
else if (state < TrapState.Closing)
{
trapFramerate = 0.08f;
runTime = 10f;
state = TrapState.Closing;
trapAudio.clip = trapClosing;
trapAudio.Play();
currentClip = 2;
}
}
public void CloseTrap()
{
frame = 9;
counter = 0f;
trapFramerate = 0.11f;
state = TrapState.ClosingAnimation;
((Shrapnel)this).sprite.SetLowerLeftPixel((float)frame * 224f, 128f);
ReleaseUnits();
}
protected void CheckReturnTrap()
{
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: 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_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Unknown result type (might be due to invalid IL or missing references)
if (state != TrapState.Closed)
{
return;
}
if ((Object)(object)((Grenade)this).firedBy != (Object)null && ((BroforceObject)/*isinst with value type is only supported in some contexts*/).health > 0)
{
float num = ((Component)((Grenade)this).firedBy).transform.position.x - ((BroforceObject)this).X;
float num2 = ((Component)((Grenade)this).firedBy).transform.position.y + 10f - ((BroforceObject)this).Y;
if (Mathf.Abs(num) < 9f && Mathf.Abs(num2) < 14f)
{
Brostbuster brostbuster = ((Grenade)this).firedBy as Brostbuster;
if (Object.op_Implicit((Object)(object)brostbuster) && killedUnits > 0)
{
brostbuster.ReturnTrap();
}
Sound.GetInstance().PlaySoundEffectAt(((Grenade)this).soundHolder.powerUp, 0.7f, ((Component)this).transform.position, 0.95f + Random.value * 0.1f, true, false, false, 0f);
EffectsController.CreatePuffDisappearEffect(((BroforceObject)this).X, ((BroforceObject)this).Y + 3f, 0f, 0f);
((Grenade)this).DestroyGrenade();
}
return;
}
for (int i = 0; i < HeroController.players.Length; i++)
{
if (!((Object)(object)HeroController.players[i] != (Object)null) || !HeroController.players[i].IsAliveAndSpawnedHero() || !(HeroController.players[i].character is Brostbuster brostbuster2))
{
continue;
}
float num3 = ((Component)brostbuster2).transform.position.x - ((BroforceObject)this).X;
float num4 = ((Component)brostbuster2).transform.position.y + 10f - ((BroforceObject)this).Y;
if (Mathf.Abs(num3) < 9f && Mathf.Abs(num4) < 14f)
{
if (killedUnits > 0)
{
brostbuster2.ReturnTrap();
}
Sound.GetInstance().PlaySoundEffectAt(((Grenade)this).soundHolder.powerUp, 0.7f, ((Component)this).transform.position, 0.95f + Random.value * 0.1f, true, false, false, 0f);
EffectsController.CreatePuffDisappearEffect(((BroforceObject)this).X, ((BroforceObject)this).Y + 3f, 0f, 0f);
((Grenade)this).DestroyGrenade();
}
}
}
private float Sign(float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y)
{
return (p1X - p3X) * (p2Y - p3Y) - (p2X - p3X) * (p1Y - p3Y);
}
private bool ShouldGrabUnit(float x, float y)
{
float num = Sign(x, y, topLeftX, topLeftY, topRightX, topRightY);
float num2 = Sign(x, y, topRightX, topRightY, bottomX, bottomY);
float num3 = Sign(x, y, bottomX, bottomY, topLeftX, topLeftY);
bool flag = num < 0f || num2 < 0f || num3 < 0f;
bool flag2 = num > 0f || num2 > 0f || num3 > 0f;
return !(flag && flag2);
}
protected void AddUnit(Unit unit)
{
FloatingObject floatingObject = new FloatingObject((BroforceObject)(object)unit, this);
floatingObjects.Add(floatingObject);
grabbedUnits.Add(unit, floatingObject);
unit.Panic(1000f, true);
if (unit is Mook)
{
((TestVanDammeAnim)((unit is Mook) ? unit : null)).SetInvulnerable(float.MaxValue, true, false);
}
Map.units.Remove(unit);
}
protected void AddObject(BroforceObject grabbedObject)
{
Projectile val = (Projectile)(object)((grabbedObject is Projectile) ? grabbedObject : null);
if (val != null)
{
Map.projectiles.Remove(val);
}
else
{
Grenade val2 = (Grenade)(object)((grabbedObject is Grenade) ? grabbedObject : null);
if (val2 != null)
{
Map.grenades.Remove(val2);
ProjectileTrail fieldValue = HarmonyExtensions.GetFieldValue<ProjectileTrail>((object)val2, "createdTrail");
if (fieldValue != null)
{
fieldValue.EffectDie();
}
}
}
((Behaviour)grabbedObject).enabled = false;
FloatingObject floatingObject = new FloatingObject(grabbedObject, this);
floatingObjects.Add(floatingObject);
grabbedObjects.Add(grabbedObject, floatingObject);
}
protected void FindObjects()
{
for (int i = 0; i < Map.units.Count; i++)
{
Unit val = Map.units[i];
if (!((Object)(object)val != (Object)null) || !((Component)val).gameObject.activeSelf || !GameModeController.DoesPlayerNumDamage(thrownBy, ((NetworkedUnit)val).playerNum) || ((BroforceObject)val).health <= 0 || grabbedUnits.ContainsKey(val) || ignoredUnits.Contains(val))
{
continue;
}
if (((Component)val).CompareTag("Boss") || ((Component)val).CompareTag("Metal") || val is SatanMiniboss || val is DolphLundrenSoldier || val is Tank || val is MookVehicleDigger)
{
ignoredUnits.Add(val);
}
else if (Tools.FastAbsWithinRange(((BroforceObject)val).X - bottomX, 50f) && Tools.FastAbsWithinRange(((BroforceObject)val).Y - bottomY, 20f))
{
AddUnit(val);
}
else if (Tools.FastAbsWithinRange(((BroforceObject)val).X - bottomX, 120f))
{
float num = ((BroforceObject)val).Y - bottomY;
if (Tools.FastAbsWithinRange(num, 130f) && Mathf.Sign(num) == 1f && ShouldGrabUnit(((BroforceObject)val).X, ((BroforceObject)val).Y))
{
AddUnit(val);
}
}
}
if (state >= TrapState.Closing)
{
return;
}
for (int j = 0; j < Map.projectiles.Count; j++)
{
Projectile val2 = Map.projectiles[j];
if (!((Object)(object)val2 != (Object)null) || !((Component)val2).gameObject.activeSelf || !GameModeController.DoesPlayerNumDamage(val2.playerNum, thrownBy) || grabbedObjects.ContainsKey((BroforceObject)(object)val2))
{
continue;
}
if (Tools.FastAbsWithinRange(((BroforceObject)val2).X - bottomX, 50f) && Tools.FastAbsWithinRange(((BroforceObject)val2).Y - bottomY, 20f))
{
AddObject((BroforceObject)(object)val2);
}
else if (Tools.FastAbsWithinRange(((BroforceObject)val2).X - bottomX, 120f))
{
float num2 = ((BroforceObject)val2).Y - bottomY;
if (Tools.FastAbsWithinRange(num2, 130f) && Mathf.Sign(num2) == 1f && ShouldGrabUnit(((BroforceObject)val2).X, ((BroforceObject)val2).Y))
{
AddObject((BroforceObject)(object)val2);
}
}
}
for (int k = 0; k < Map.grenades.Count; k++)
{
Grenade val3 = Map.grenades[k];
if (!((Object)(object)val3 != (Object)null) || !((Component)val3).gameObject.activeSelf || !GameModeController.DoesPlayerNumDamage(val3.playerNum, thrownBy) || grabbedObjects.ContainsKey((BroforceObject)(object)val3))
{
continue;
}
if (Tools.FastAbsWithinRange(((BroforceObject)val3).X - bottomX, 50f) && Tools.FastAbsWithinRange(((BroforceObject)val3).Y - bottomY, 20f))
{
AddObject((BroforceObject)(object)val3);
}
else if (Tools.FastAbsWithinRange(((BroforceObject)val3).X - bottomX, 120f))
{
float num3 = ((BroforceObject)val3).Y - bottomY;
if (Tools.FastAbsWithinRange(num3, 130f) && Mathf.Sign(num3) == 1f && ShouldGrabUnit(((BroforceObject)val3).X, ((BroforceObject)val3).Y))
{
AddObject((BroforceObject)(object)val3);
}
}
}
}
protected void MoveUnits()
{
if (state == TrapState.Open)
{
for (int num = floatingObjects.Count - 1; num >= 0; num--)
{
floatingObjects[num].MoveObject(((Shrapnel)this).t);
}
}
else
{
for (int num2 = floatingObjects.Count - 1; num2 >= 0; num2--)
{
floatingObjects[num2].MoveUnitToCenter(((Shrapnel)this).t);
}
}
}
protected void ReleaseUnits()
{
for (int i = 0; i < floatingObjects.Count; i++)
{
floatingObjects[i].ReleaseObject();
BroforceObject trappedObject = floatingObjects[i].trappedObject;
Unit val = (Unit)(object)((trappedObject is Unit) ? trappedObject : null);
if (val != null)
{
grabbedUnits.Remove(val);
Map.units.Add(val);
continue;
}
BroforceObject trappedObject2 = floatingObjects[i].trappedObject;
Projectile val2 = (Projectile)(object)((trappedObject2 is Projectile) ? trappedObject2 : null);
if (val2 != null)
{
grabbedObjects.Remove((BroforceObject)(object)val2);
Map.projectiles.Add(val2);
continue;
}
BroforceObject trappedObject3 = floatingObjects[i].trappedObject;
Grenade val3 = (Grenade)(object)((trappedObject3 is Grenade) ? trappedObject3 : null);
if (val3 != null)
{
grabbedObjects.Remove((BroforceObject)(object)val3);
Map.grenades.Add(val3);
}
}
}
}
internal class HarmonyPatches
{
[HarmonyPatch(typeof(TestVanDammeAnim), "RunBlindStars")]
private static class TestVanDammeAnim_RunBlindStars_Patch
{
public static bool Prefix(Mook __instance)
{
if (GhostTrap.grabbedUnits.Count > 0 && GhostTrap.grabbedUnits.ContainsKey((Unit)(object)__instance))
{
return false;
}
return true;
}
}
[HarmonyPatch(typeof(TestVanDammeAnim), "EvaluateIsJumping")]
private static class TestVanDammeAnim_EvaluateIsJumping_Patch
{
public static bool Prefix(TestVanDammeAnim __instance)
{
if (GhostTrap.grabbedUnits.Count > 0 && GhostTrap.grabbedUnits.ContainsKey((Unit)(object)__instance))
{
return false;
}
return true;
}
}
[HarmonyPatch(typeof(Mook), "Land")]
private static class Mook_Land_Patch
{
public static bool Prefix(Mook __instance)
{
if (GhostTrap.grabbedUnits.Count > 0 && GhostTrap.grabbedUnits.ContainsKey((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 (GhostTrap.grabbedUnits.Count > 0 && GhostTrap.grabbedUnits.TryGetValue((Unit)(object)__instance, out var value))
{
__result = value.currentPosition.y;
return false;
}
return true;
}
}
[HarmonyPatch(typeof(EffectsController), "GetBloodColor")]
private static class EffectsController_GetBloodColor_Patch
{
public static void Postfix(ref BloodColor color, ref Color __result)
{
//IL_000e: 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)
if ((int)color == 1 && Slimer.overrideBloodColor > 0)
{
__result = Brostbuster.SlimerColor;
}
}
}
}
internal class Slimer : CustomProjectile
{
private readonly BloodColor bloodColor = (BloodColor)1;
public static int overrideBloodColor;
public List<Unit> frozenUnits = new List<Unit>();
protected const float frameRate = 0.1f;
protected int frame;
protected float counter;
protected float startingY;
protected float startingX;
public AudioClip[] freezeSounds;
public AudioClip[] slimerGroans;
public AudioSource slimerAudio;
protected override void Awake()
{
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: 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_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)base.Sprite == (Object)null)
{
base.SpriteLowerLeftPixel = new Vector2(0f, 32f);
base.SpritePixelDimensions = new Vector2(32f, 32f);
base.SpriteWidth = 32f;
base.SpriteHeight = 32f;
base.SpriteColor = new Color(1f, 1f, 1f, 0.75f);
}
((CustomProjectile)this).Awake();
((Projectile)this).damageType = (DamageType)33;
((Projectile)this).damage = 0;
((Projectile)this).damageInternal = ((Projectile)this).damage;
((Projectile)this).fullDamage = ((Projectile)this).damage;
((Projectile)this).life = 4f;
if ((Object)(object)slimerAudio == (Object)null)
{
if ((Object)(object)((Component)this).gameObject.GetComponent<AudioSource>() == (Object)null)
{
slimerAudio = ((Component)this).gameObject.AddComponent<AudioSource>();
slimerAudio.rolloffMode = (AudioRolloffMode)0;
slimerAudio.minDistance = 150f;
slimerAudio.maxDistance = 2000f;
slimerAudio.dopplerLevel = 0.1f;
slimerAudio.spatialBlend = 1f;
slimerAudio.volume = 0.6f;
}
else
{
slimerAudio = ((Component)this).GetComponent<AudioSource>();
}
}
((Component)this).gameObject.layer = 28;
}
public override void PrefabSetup()
{
freezeSounds = (AudioClip[])(object)new AudioClip[8];
freezeSounds[0] = ResourcesController.GetAudioClip(base.SoundPath, "freeze1.wav");
freezeSounds[1] = ResourcesController.GetAudioClip(base.SoundPath, "freeze2.wav");
freezeSounds[2] = ResourcesController.GetAudioClip(base.SoundPath, "freeze3.wav");
freezeSounds[3] = ResourcesController.GetAudioClip(base.SoundPath, "freeze4.wav");
freezeSounds[4] = ResourcesController.GetAudioClip(base.SoundPath, "freeze5.wav");
freezeSounds[5] = ResourcesController.GetAudioClip(base.SoundPath, "freeze6.wav");
freezeSounds[6] = ResourcesController.GetAudioClip(base.SoundPath, "freeze7.wav");
freezeSounds[7] = ResourcesController.GetAudioClip(base.SoundPath, "freeze8.wav");
slimerGroans = (AudioClip[])(object)new AudioClip[4];
slimerGroans[0] = ResourcesController.GetAudioClip(base.SoundPath, "slimer1.wav");
slimerGroans[1] = ResourcesController.GetAudioClip(base.SoundPath, "slimer2.wav");
slimerGroans[2] = ResourcesController.GetAudioClip(base.SoundPath, "slimer3.wav");
slimerGroans[3] = ResourcesController.GetAudioClip(base.SoundPath, "slimer4.wav");
}
public override void Fire(float newX, float newY, float xI, float yI, float _zOffset, int playerNum, MonoBehaviour FiredBy)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: 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_004d: Unknown result type (might be due to invalid IL or missing references)
((Projectile)this).Fire(newX, newY, xI, yI, _zOffset, playerNum, FiredBy);
((Component)this).transform.localScale = new Vector3(((Component)this).transform.localScale.x * -1f, ((Component)this).transform.localScale.y, ((Component)this).transform.localScale.z);
startingY = ((BroforceObject)this).Y;
startingX = ((BroforceObject)this).X;
slimerAudio.clip = slimerGroans[Random.Range(0, slimerGroans.Length)];
slimerAudio.loop = false;
slimerAudio.Play();
}
protected override void Update()
{
((Projectile)this).Update();
counter += ((Projectile)this).t;
if (counter > 0.1f)
{
counter -= 0.1f;
frame++;
if (frame > 7)
{
frame = 0;
}
base.Sprite.SetLowerLeftPixel((float)(frame * 32), 32f);
}
((BroforceObject)this).Y = startingY + 25f * Math.Sin(Mathf.Abs(((BroforceObject)this).X - startingX) / 25f);
}
protected override void TryHitUnitsAtSpawn()
{
}
protected override bool HitWalls()
{
//IL_0050: 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_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: 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_0200: Unknown result type (might be due to invalid IL or missing references)
//IL_022f: Unknown result type (might be due to invalid IL or missing references)
//IL_025e: Unknown result type (might be due to invalid IL or missing references)
overrideBloodColor++;
float num = Mathf.Abs(((BroforceObject)this).xI) * ((Projectile)this).t;
if (Physics.Raycast(new Vector3(((BroforceObject)this).X - Mathf.Sign(((BroforceObject)this).xI) * ((Projectile)this).projectileSize, ((BroforceObject)this).Y + ((Projectile)this).projectileSize * 0.5f, 0f), new Vector3(((BroforceObject)this).xI, ((BroforceObject)this).yI, 0f), ref ((Projectile)this).raycastHit, ((Projectile)this).projectileSize * 2f + num, LayerMask.op_Implicit(((Projectile)this).groundLayer)) && ((RaycastHit)(ref ((Projectile)this).raycastHit)).distance < ((Projectile)this).projectileSize + num && (Object)(object)((Component)((RaycastHit)(ref ((Projectile)this).raycastHit)).collider).gameObject.GetComponent<Block>() == (Object)null)
{
((Projectile)this).ProjectileApplyDamageToBlock(((Component)((RaycastHit)(ref ((Projectile)this).raycastHit)).collider).gameObject, 15, ((Projectile)this).damageType, ((BroforceObject)this).xI, ((BroforceObject)this).yI);
((Projectile)this).MakeEffects(true, ((RaycastHit)(ref ((Projectile)this).raycastHit)).point.x + ((RaycastHit)(ref ((Projectile)this).raycastHit)).normal.x * 3f, ((RaycastHit)(ref ((Projectile)this).raycastHit)).point.y + ((RaycastHit)(ref ((Projectile)this).raycastHit)).normal.y * 3f, true, ((RaycastHit)(ref ((Projectile)this).raycastHit)).normal, ((RaycastHit)(ref ((Projectile)this).raycastHit)).point);
}
if (((BroforceObject)this).X < 0f || ((BroforceObject)this).Y < 0f)
{
return false;
}
int num2 = (int)((((BroforceObject)this).X + 8f) / 16f);
int num3 = (int)((((BroforceObject)this).Y + 8f) / 16f);
for (int i = 0; i < 2; i++)
{
if (Map.IsBlockSolid(num2, num3 + 1))
{
Block block = Map.GetBlock(num2, num3 + 1);
if ((Object)(object)block != (Object)null)
{
block.Bloody((DirectionEnum)3, bloodColor, true);
}
}
if (Map.IsBlockSolid(num2 - 1, num3))
{
Block block2 = Map.GetBlock(num2 - 1, num3);
if ((Object)(object)block2 != (Object)null)
{
block2.Bloody((DirectionEnum)5, bloodColor, true);
}
}
if (Map.IsBlockSolid(num2 + 1, num3))
{
Block block3 = Map.GetBlock(num2 + 1, num3);
if ((Object)(object)block3 != (Object)null)
{
block3.Bloody((DirectionEnum)4, bloodColor, true);
}
}
if (Map.IsBlockSolid(num2, num3 - 1))
{
Block block4 = Map.GetBlock(num2, num3 - 1);
if ((Object)(object)block4 != (Object)null)
{
block4.Bloody((DirectionEnum)2, bloodColor, true);
}
}
num2++;
}
overrideBloodColor--;
return ((Projectile)this).HitWalls();
}
public bool FreezeUnits(MonoBehaviour firedBy, int playerNum, float x, float y, float range, float freezeTime)
{
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
if (Map.units == null)
{
return false;
}
bool result = false;
for (int num = Map.units.Count - 1; num >= 0; num--)
{
Unit val = Map.units[num];
if ((Object)(object)val != (Object)null && !val.invulnerable && GameModeController.DoesPlayerNumDamage(playerNum, ((NetworkedUnit)val).playerNum))
{
float num2 = ((BroforceObject)val).X - x;
if (Mathf.Abs(num2) - range < val.width && (((BroforceObject)val).Y != y || num2 != 0f) && Mathf.Abs(((BroforceObject)val).Y + val.height / 2f + 3f - y) - range < val.height && !frozenUnits.Contains(val))
{
if (val.CanFreeze())
{
val.Freeze(freezeTime);
Sound.GetInstance().PlaySoundEffectAt(freezeSounds, 0.6f, ((Component)val).transform.position, 1f, true, true, false, 0f);
}
else
{
val.Damage(15, (DamageType)33, 0f, 10f, 0, firedBy, x, y);
}
frozenUnits.Add(val);
result = true;
}
}
}
return result;
}
protected override void HitUnits()
{
FreezeUnits(((Projectile)this).firedBy, ((Projectile)this).playerNum, ((BroforceObject)this).X, ((BroforceObject)this).Y - 3f, 18f, 3f);
}
protected override void HitHorizontalWalls()
{
}
protected override void HitFragile()
{
}
protected override void HitGrenades()
{
}
protected override void HitProjectiles()
{
}
}