Decompiled source of IAmBecomeMissiles v1.3.0

MissileRework.dll

Decompiled 3 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using IL.RoR2;
using ModularEclipse;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MoreStats;
using On.RoR2;
using On.RoR2.Projectile;
using ProcSolver;
using R2API;
using R2API.Utils;
using RainrotSharedUtils.MoreProjectiles;
using RoR2;
using RoR2.ContentManagement;
using RoR2.ExpansionManagement;
using RoR2.Projectile;
using RoR2BepInExPack.GameAssetPaths.Version_1_39_0;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.ResourceManagement.AsyncOperations;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("MissileRework")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MissileRework")]
[assembly: AssemblyTitle("MissileRework")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: UnverifiableCode]
[module: UnverifiableCode]
[module: UnverifiableCode]
[module: UnverifiableCode]
[module: UnverifiableCode]
namespace MissileRework;

[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.RiskOfBrainrot.IAmBecomeMissiles", "IAmBecomeMissiles", "1.2.1")]
[R2APISubmoduleDependency(new string[] { "LanguageAPI", "ContentAddition", "DamageAPI" })]
public class MissileReworkPlugin : BaseUnityPlugin
{
	public static GameObject missilePrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/MissileProjectile");

	public float procCoefficient = 0.4f;

	public float procChance = 10f;

	public static float atgMk3BaseDamageCoefficientPerRocket = 3f;

	private static int maxMissiles = 100;

	private string damagePerMissile = atgMk3BaseDamageCoefficientPerRocket * 100f + "%";

	private string overspillThreshold = overspillThresholdCoefficient * 100f + "%";

	public static float overspillThresholdCoefficient = 2f;

	public static int missilesPerOverspillBase = 1;

	public static int missilesPerOverspillStack = 1;

	public static ArtifactDef MissileArtifact = null;

	public const float missileSpread = 45f;

	public const float projectileSpread = 20f;

	public const string guid = "com.RiskOfBrainrot.IAmBecomeMissiles";

	public const string teamName = "RiskOfBrainrot";

	public const string modName = "IAmBecomeMissiles";

	public const string version = "1.2.1";

	public static bool ModularEclipseLoaded = isLoaded("com.HouseOfFruits.ModularEclipse");

	private ItemDef icbmItemDef;

	private static AssetBundle _assetBundle;

	private float shrimpShieldBase = 40f;

	private float shrimpDamageCoeffBase = 0.3f;

	private float shrimpDamageCoeffStack = 0.3f;

	public static PluginInfo PInfo { get; private set; }

	internal static ConfigFile CustomConfigFile { get; set; }

	public static ConfigEntry<bool> ShouldReworkIcbm { get; set; }

	public static ConfigEntry<bool> ShouldAddArtifact { get; set; }

	public static ConfigEntry<bool> ShouldReworkAtg { get; set; }

	public static ConfigEntry<bool> ShouldReworkShrimp { get; set; }

	public static ConfigEntry<bool> ShouldReworkDml { get; set; }

	public static ConfigEntry<bool> ShouldReworkEnemyMissileTargeting { get; set; }

	public static AssetBundle assetBundle
	{
		get
		{
			if ((Object)(object)_assetBundle == (Object)null)
			{
				_assetBundle = AssetBundle.LoadFromFile(GetAssetBundlePath("missilereworkassets"));
			}
			return _assetBundle;
		}
		set
		{
			_assetBundle = value;
		}
	}

	internal void ReworkAtg()
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Expected O, but got Unknown
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Expected O, but got Unknown
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Expected O, but got Unknown
		missilePrefab.GetComponent<ProjectileController>().procCoefficient = procCoefficient;
		GlobalEventManager.ProcessHitEnemy += new Manipulator(RemoveVanillaAtgLogic);
		OnHit.GetHitBehavior += new HitHookEventHandler(AtgReworkLogic);
		CharacterBody.OnInventoryChanged += new hook_OnInventoryChanged(AddItemBehavior);
		LanguageAPI.Add("ITEM_MISSILE_NAME", "AtG Missile Mk.3");
		LanguageAPI.Add("ITEM_MISSILE_PICKUP", "Chance to fire a volley of missiles. Missiles fired are increased by higher damage hits. Watch for the backblast.");
		LanguageAPI.Add("ITEM_MISSILE_DESC", $"<style=cIsDamage>{procChance}%</style> chance to fire a volley of " + $"<style=cIsDamage>{missilesPerOverspillBase}</style> <style=cStack>(+{missilesPerOverspillStack} per stack)</style> missiles on hit " + "for <style=cIsDamage>" + damagePerMissile + "</style> base damage each. Every <style=cIsDamage>" + overspillThreshold + "</style> attack damage dealt increases volleys loaded by <style=cIsDamage>1</style>.");
	}

	private void AtgReworkLogic(CharacterBody attackerBody, DamageInfo damageInfo, CharacterBody victimBody)
	{
		if (((ProcChainMask)(ref damageInfo.procChainMask)).HasProc((ProcType)1))
		{
			return;
		}
		CharacterMaster master = attackerBody.master;
		Inventory inventory = attackerBody.inventory;
		if ((Object)(object)master != (Object)null && (Object)(object)inventory != (Object)null)
		{
			int itemCountEffective = inventory.GetItemCountEffective(Items.Missile);
			if (itemCountEffective > 0 && Util.CheckRoll(procChance * GetProcRate(damageInfo), master))
			{
				DoMissileProc(damageInfo, ((Component)victimBody).gameObject, attackerBody, master, itemCountEffective);
			}
		}
	}

	private void AddItemBehavior(orig_OnInventoryChanged orig, CharacterBody self)
	{
		orig.Invoke(self);
		if (NetworkServer.active)
		{
			self.AddItemBehavior<Mk3MissileBehavior>(self.inventory.GetItemCountEffective(Items.Missile));
		}
	}

	private void RemoveVanillaAtgLogic(ILContext il)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Expected O, but got Unknown
		//IL_005b: 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)
		ILCursor val = new ILCursor(il);
		val.GotoNext((MoveType)2, new Func<Instruction, bool>[2]
		{
			(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.RoR2Content/Items", "Missile"),
			(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective")
		});
		val.Emit(OpCodes.Pop);
		val.Emit(OpCodes.Ldc_I4, 0);
	}

	public static int CalculateOverspill(DamageInfo damageInfo, float attackerBodyDamage, float overspillThreshold, bool rollForMore = false)
	{
		int num = 0;
		float num2 = damageInfo.damage / attackerBodyDamage;
		num = Mathf.FloorToInt(num2 / overspillThreshold);
		if (!rollForMore)
		{
			return num;
		}
		float num3 = num2 % overspillThreshold;
		if (num3 <= Mathf.Epsilon)
		{
			return num;
		}
		if (Util.CheckRoll0To1(num3 / overspillThreshold, 0f, (CharacterMaster)null))
		{
			num++;
		}
		return num;
	}

	private void DoMissileProc(DamageInfo damageInfo, GameObject victim, CharacterBody attackerBody, CharacterMaster attackerMaster, int missileItemCount)
	{
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		if (missileItemCount > 0)
		{
			Mk3MissileBehavior component = ((Component)attackerBody).gameObject.GetComponent<Mk3MissileBehavior>();
			if (!((Object)(object)component == (Object)null))
			{
				int num = 1 + CalculateOverspill(damageInfo, attackerBody.damage, overspillThresholdCoefficient);
				int num2 = missilesPerOverspillBase + missilesPerOverspillStack * (missileItemCount - 1);
				int num3 = num * num2;
				FireProjectileInfo val = default(FireProjectileInfo);
				val.projectilePrefab = missilePrefab;
				val.procChainMask = damageInfo.procChainMask;
				val.damage = atgMk3BaseDamageCoefficientPerRocket * attackerBody.damage;
				val.crit = damageInfo.crit;
				val.target = victim;
				FireProjectileInfo newMissile = val;
				component.AddMissiles(newMissile, Mathf.Min(num3, maxMissiles - component.currentMissiles.Count));
			}
		}
	}

	private bool IsVanillaIcbmHeld(CharacterBody sender)
	{
		return Object.op_Implicit((Object)(object)sender.inventory) && sender.inventory.GetItemCountEffective(Items.MoreMissile) > 0;
	}

	internal void ReworkIcbm()
	{
		DisableICBM();
		LanguageAPI.Add("ITEM_MOREMISSILE_PICKUP", "Knock 'em dead, faggot.");
		LanguageAPI.Add("ITEM_MOREMISSILE_DESC", "Knock 'em dead, faggot.");
	}

	private void DisableICBM()
	{
		//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)
		AssetReferenceT<ItemDef> val = new AssetReferenceT<ItemDef>(RoR2_DLC1_MoreMissile.MoreMissile_asset);
		AsyncOperationHandle<ItemDef> val2 = AssetAsyncReferenceManager<ItemDef>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2);
		val2.Completed += delegate(AsyncOperationHandle<ItemDef> ctx)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			ItemDef result = ctx.Result;
			result.tier = (ItemTier)5;
			result.deprecatedTier = (ItemTier)5;
		};
	}

	private bool IsMoreMissilesActive(CharacterBody sender)
	{
		return RunArtifactManager.instance.IsArtifactEnabled(MissileArtifact);
	}

	private void CreateArtifact()
	{
		//IL_0080: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Expected O, but got Unknown
		MissileArtifact = ScriptableObject.CreateInstance<ArtifactDef>();
		MissileArtifact.cachedName = "BorboWarfare";
		MissileArtifact.nameToken = "ARTIFACT_MISSILE_NAME";
		MissileArtifact.descriptionToken = "ARTIFACT_MISSILE_DESC";
		MissileArtifact.smallIconSelectedSprite = assetBundle.LoadAsset<Sprite>("Assets/warfare.png");
		MissileArtifact.smallIconDeselectedSprite = assetBundle.LoadAsset<Sprite>("Assets/warfaredeactivated.png");
		MissileArtifact.unlockableDef = null;
		MissileArtifact.requiredExpansion = Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC1/Common/DLC1.asset").WaitForCompletion();
		LanguageAPI.Add(MissileArtifact.nameToken, "Artifact of Warfare");
		LanguageAPI.Add(MissileArtifact.descriptionToken, "Triple most projectile attacks.");
		ContentAddition.AddArtifactDef(MissileArtifact);
		if (ModularEclipseLoaded)
		{
			ModularEclipseCompat(MissileArtifact);
		}
		MoreProjectilesModule.MoreProjectilesProvider += new MoreProjectilesEventHandler(IsMoreMissilesActive);
	}

	internal static bool isLoaded(string modguid)
	{
		foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos)
		{
			string key = pluginInfo.Key;
			PluginInfo value = pluginInfo.Value;
			if (key == modguid)
			{
				return true;
			}
		}
		return false;
	}

	public static string GetAssetBundlePath(string bundleName)
	{
		return Path.Combine(Path.GetDirectoryName(PInfo.Location), bundleName);
	}

	public void Awake()
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Expected O, but got Unknown
		//IL_015c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0166: Expected O, but got Unknown
		//IL_016e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0178: Expected O, but got Unknown
		PInfo = ((BaseUnityPlugin)this).Info;
		CustomConfigFile = new ConfigFile(Paths.ConfigPath + "\\IAmBecomeMissiles.cfg", true);
		ShouldAddArtifact = CustomConfigFile.Bind<bool>("IAmBecomeMissiles: Content", "Artifact of Warfare", true, "Set to TRUE to turn Pocket ICBM into an artifact.");
		ShouldReworkIcbm = CustomConfigFile.Bind<bool>("IAmBecomeMissiles: Reworks", "Pocket ICBM", true, "Set to TRUE to disable Pocket ICBM. Recommended with Artifact of Warfare enabled!");
		ShouldReworkAtg = CustomConfigFile.Bind<bool>("IAmBecomeMissiles: Reworks", "AtG Missile Mk.3", true, "Set to TRUE to rework AtG Missile Mk.1.");
		ShouldReworkShrimp = CustomConfigFile.Bind<bool>("IAmBecomeMissiles: Reworks", "Plasma Shrimp", true, "Set to TRUE to rework Plasma Shrimp.");
		ShouldReworkDml = CustomConfigFile.Bind<bool>("IAmBecomeMissiles: Reworks", "Disposable Missile Launcher", true, "Set to TRUE to rework Disposable Missile Launcher.");
		ShouldReworkEnemyMissileTargeting = CustomConfigFile.Bind<bool>("IAmBecomeMissiles: Reworks", "Missile Tracking", true, "Set to TRUE to rework missile tracking on enemies.");
		if (ShouldAddArtifact.Value)
		{
			CreateArtifact();
		}
		if (ShouldReworkIcbm.Value)
		{
			ReworkIcbm();
		}
		if (ShouldReworkAtg.Value)
		{
			ReworkAtg();
		}
		if (ShouldReworkShrimp.Value)
		{
			ReworkPrimp();
		}
		if (ShouldReworkEnemyMissileTargeting.Value)
		{
			MissileController.FixedUpdate += new hook_FixedUpdate(MissileController_FixedUpdate);
			MissileController.FindTarget += new hook_FindTarget(MissileController_FindTarget);
		}
	}

	private void MissileController_FixedUpdate(orig_FixedUpdate orig, MissileController self)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Invalid comparison between Unknown and I4
		if ((Object)(object)self.teamFilter != (Object)null && (int)self.teamFilter.teamIndex != 1 && (Object)(object)self.targetComponent.target != (Object)null)
		{
			HurtBox component = ((Component)self.targetComponent.target).GetComponent<HurtBox>();
			object obj;
			if (component == null)
			{
				obj = null;
			}
			else
			{
				HealthComponent healthComponent = component.healthComponent;
				obj = ((healthComponent != null) ? healthComponent.body.characterMotor : null);
			}
			CharacterMotor val = (CharacterMotor)obj;
			if ((Object)(object)val != (Object)null && val.isGrounded)
			{
				self.targetComponent.target = self.FindTarget();
			}
		}
		orig.Invoke(self);
	}

	private Transform MissileController_FindTarget(orig_FindTarget orig, MissileController self)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Invalid comparison between Unknown and I4
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: 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)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		if ((int)self.teamFilter.teamIndex == 1)
		{
			return orig.Invoke(self);
		}
		self.search.searchOrigin = self.transform.position;
		self.search.searchDirection = self.transform.forward;
		((TeamMask)(ref self.search.teamMaskFilter)).RemoveTeam(self.teamFilter.teamIndex);
		self.search.sortMode = (SortMode)1;
		self.search.RefreshCandidates();
		self.search.candidatesEnumerable = (from v in self.search.candidatesEnumerable.AsEnumerable()
			where !((Object)(object)v.hurtBox.healthComponent.body.characterMotor != (Object)null) || !v.hurtBox.healthComponent.body.characterMotor.isGrounded
			select v).ToList();
		HurtBox val = self.search.GetResults().FirstOrDefault();
		if ((Object)(object)val == (Object)null)
		{
			return null;
		}
		return ((Component)val).transform;
	}

	public static float GetProcRate(DamageInfo damageInfo)
	{
		if (!Chainloader.PluginInfos.ContainsKey("com.RiskOfBrainrot.ProcSolver"))
		{
			return damageInfo.procCoefficient;
		}
		return _GetProcRate(damageInfo);
	}

	[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
	private static float _GetProcRate(DamageInfo damageInfo)
	{
		return ProcSolverPlugin.GetProcRateMod(damageInfo);
	}

	[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
	public static void ModularEclipseCompat(ArtifactDef artifactDef)
	{
		ModularEclipsePlugin.SetArtifactDefaultWhitelist(artifactDef, true);
	}

	internal void ReworkPrimp()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Expected O, but got Unknown
		GlobalEventManager.ProcessHitEnemy += new Manipulator(ShrimpRework);
		RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(ShrimpShieldFix);
		LanguageAPI.Add("ITEM_MISSILEVOID_PICKUP", "While you have shield, fire a missile on every hit. <style=cIsVoid>Corrupts all AtG Missile Mk. 3s</style>.");
		LanguageAPI.Add("ITEM_MISSILEVOID_DESC", $"Gain <style=cIsHealing>{shrimpShieldBase} shield</style>. " + "While you have a <style=cIsHealing>shield</style>, hitting an enemy fires a missile that deals " + $"<style=cIsDamage>{shrimpDamageCoeffBase * 100f}%</style> " + $"<style=cStack>(+{shrimpDamageCoeffStack * 100f}% per stack)</style> TOTAL damage. " + "<style=cIsVoid>Corrupts all AtG Missile Mk. 3s</style>.");
	}

	private void ShrimpShieldFix(CharacterBody sender, StatHookEventArgs args)
	{
		Inventory inventory = sender.inventory;
		if (Object.op_Implicit((Object)(object)inventory) && inventory.GetItemCountEffective(Items.MissileVoid) > 0)
		{
			args.shieldMultAdd -= 0.1f;
			args.baseShieldAdd += shrimpShieldBase;
		}
	}

	private void ShrimpRework(ILContext il)
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Expected O, but got Unknown
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		ILCursor val = new ILCursor(il);
		int shrimpLoc = 32;
		if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3]
		{
			(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.DLC1Content/Items", "MissileVoid"),
			(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective"),
			(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref shrimpLoc)
		}))
		{
			Debug.LogError((object)"IAmBecomeMissiles: Shrimp rework hook failed (breakpoint 1)");
			return;
		}
		if (!val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
		{
			(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "RoR2.Util", "OnHitProcDamage")
		}))
		{
			Debug.LogError((object)"IAmBecomeMissiles: Shrimp rework hook failed (breakpoint 2)");
			return;
		}
		val.Emit(OpCodes.Ldloc, shrimpLoc);
		val.EmitDelegate<Func<float, int, float>>((Func<float, int, float>)((float damageCoefficient, int itemCount) => shrimpDamageCoeffBase + shrimpDamageCoeffStack * (float)(itemCount - 1)));
		if (!ShouldReworkIcbm.Value)
		{
			return;
		}
		if (!val.TryGotoPrev((MoveType)2, new Func<Instruction, bool>[2]
		{
			(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.DLC1Content/Items", "MoreMissile"),
			(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective")
		}))
		{
			Debug.LogError((object)"IAmBecomeMissiles: Shrimp rework hook failed (breakpoint 3)");
			return;
		}
		val.EmitDelegate<Func<int, int>>((Func<int, int>)((int icbmCount) => RunArtifactManager.instance.IsArtifactEnabled(MissileArtifact) ? 1 : 0));
	}
}
public class Mk3MissileBehavior : ItemBehavior
{
	public List<FireProjectileInfo> currentMissiles = new List<FireProjectileInfo>(0);

	private float missileMaxTimer = 0.075f;

	private float currentMissileTimer = 0f;

	private float missileSpread = 0f;

	private float missileSpreadFraction = 0.33f;

	private float missileSpreadMax = 0.6f;

	public void AddMissiles(FireProjectileInfo newMissile, int count)
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		while (count > 0)
		{
			count--;
			currentMissiles.Add(newMissile);
		}
	}

	private void FixedUpdate()
	{
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: 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)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: 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_008a: 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_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: 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)
		if (currentMissiles.Count > 0 && base.stack > 0)
		{
			while (currentMissileTimer <= 0f)
			{
				FireProjectileInfo val = currentMissiles[0];
				val.position = ((Component)base.body).gameObject.transform.position;
				missileSpread += (missileSpreadMax - missileSpread) * missileSpreadFraction;
				MissileUtils.FireMissile(base.body.corePosition, base.body, val.procChainMask, val.target, val.damage, val.crit, val.projectilePrefab, (DamageColorIndex)3, Vector3.up + Random.insideUnitSphere * missileSpread, 200f, true);
				currentMissiles.RemoveAt(0);
				currentMissileTimer += GetScaledDelay();
			}
			if (currentMissileTimer > 0f)
			{
				currentMissileTimer -= Time.fixedDeltaTime;
			}
		}
		else
		{
			currentMissileTimer = GetScaledDelay();
			missileSpread = 0f;
		}
	}

	private float GetScaledDelay()
	{
		return missileMaxTimer / base.body.attackSpeed;
	}
}