Decompiled source of BungusSuperForms v1.0.0

plugins/BungusSuperFormsMod.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AncientScepter;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using BungusSuperFormsMod.Internal;
using BungusSuperFormsMod.MyEntityStates;
using EntityStates;
using HG.BlendableTypes;
using HG.Reflection;
using HedgehogUtils;
using HedgehogUtils.Boost;
using HedgehogUtils.Boost.EntityStates;
using HedgehogUtils.Forms;
using HedgehogUtils.Forms.EntityStates;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API;
using RoR2;
using RoR2.ContentManagement;
using RoR2.Skills;
using SonicTheHedgehog.Modules;
using SonicTheHedgehog.Modules.Survivors;
using SonicTheHedgehog.SkillStates;
using UnityEngine;
using UnityEngine.AddressableAssets;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("BungusSuperFormsMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+787cbb86a08080e7aa21f3d05fe30390454fc247")]
[assembly: AssemblyProduct("BungusSuperFormsMod")]
[assembly: AssemblyTitle("BungusSuperFormsMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BungusSuperFormsMod
{
	public static class AncientScepter
	{
		public static GameObject scepterWungusBoostFlash;

		public static RequiresFormBoostSkillDef scepterWungusBoost;

		public static void Initialize()
		{
			//IL_001f: 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_0047: 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)
			scepterWungusBoostFlash = Assets.CreateNewBoostFlash("DS_GAMING_BUNGUS_SUPER_FORMS_SCEPTER_WUNGUS_BOOST_FLASH", 1.15f, 1.4f, new Color(0f, 0f, 0f), new Color(1f, 0f, 1f), new Color(1f, 0.8f, 1f), new Color(1f, 0f, 1f));
			Assets.AddScepterToBoostFlash(scepterWungusBoostFlash);
			CreateScepterWungusBoost();
			ItemBase<AncientScepterItem>.instance.RegisterScepterSkill((SkillDef)(object)scepterWungusBoost, "SonicTheHedgehog", (SkillDef)(object)SkillDefs.wungusBoost);
		}

		private static void CreateScepterWungusBoost()
		{
			//IL_0074: 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)
			scepterWungusBoost = Helpers.CopyBoostSkillDef<RequiresFormBoostSkillDef>(SkillDefs.wungusBoost);
			((SkillDef)scepterWungusBoost).skillName = "DS_GAMING_BUNGUS_SUPER_FORMS_UTILITY_WUNGUS_BOOST_NAME";
			((SkillDef)scepterWungusBoost).skillNameToken = "DS_GAMING_BUNGUS_SUPER_FORMS_UTILITY_WUNGUS_BOOST_NAME";
			((SkillDef)scepterWungusBoost).skillDescriptionToken = "DS_GAMING_BUNGUS_SUPER_FORMS_UTILITY_WUNGUS_BOOST_DESCRIPTION";
			((SkillDef)scepterWungusBoost).icon = Assets.mainAssetBundle.LoadAsset<Sprite>("texWungusBoostIcon");
			((RequiresFormSkillDef)scepterWungusBoost).requiredForm = FormDefs.wungusSuperFormDef;
			((SkillDef)scepterWungusBoost).activationState = new SerializableEntityStateType(typeof(ScepterWungusBoost));
		}
	}
	public static class Assets
	{
		private const string assetbundleName = "bungussuperformsbundle";

		private const string dllName = "BungusSuperFormsMod.dll";

		internal static AssetBundle mainAssetBundle;

		public static Material bungusSuperFormOverlay;

		public static Material bungusOutlineOverlay;

		public static Material wungusSuperFormOverlay;

		public static Material wungusOutlineOverlay;

		public static GameObject wungusBoostFlash;

		public static GameObject wungusBoostAura;

		public static void Initialize()
		{
			LoadAssetBundle();
			CreateMaterials();
		}

		internal static void LoadAssetBundle()
		{
			try
			{
				if ((Object)(object)mainAssetBundle == (Object)null)
				{
					mainAssetBundle = AssetBundle.LoadFromFile(Assembly.GetExecutingAssembly().Location.Replace("BungusSuperFormsMod.dll", "bungussuperformsbundle"));
				}
			}
			catch (Exception ex)
			{
				Log.Error("Failed to load assetbundle. Make sure your assetbundle name is setup correctly\n" + ex);
			}
		}

		public static void CreateMaterials()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Expected O, but got Unknown
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			bungusSuperFormOverlay = new Material(Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/EliteVoid/matEliteVoidOverlay.mat").WaitForCompletion());
			bungusSuperFormOverlay.SetTexture("_RemapTex", Addressables.LoadAssetAsync<Texture>((object)"RoR2/Base/Common/ColorRamps/texRampLoaderSwing.png").WaitForCompletion());
			bungusSuperFormOverlay.SetFloat("_AlphaBoost", 4f);
			bungusOutlineOverlay = new Material(Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/LunarGolem/matLunarGolemShield.mat").WaitForCompletion());
			bungusOutlineOverlay.SetColor("_TintColor", new Color(0.25f, 1f, 0.6f, 1f));
			bungusOutlineOverlay.SetColor("_EmissionColor", new Color(0.25f, 1f, 0.6f, 0.5f));
			bungusOutlineOverlay.SetFloat("_OffsetAmount", 0.01f);
			wungusSuperFormOverlay = new Material(Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/EliteVoid/matEliteVoidOverlay.mat").WaitForCompletion());
			wungusOutlineOverlay = new Material(bungusOutlineOverlay);
			wungusOutlineOverlay.SetColor("_TintColor", new Color(0.9f, 0.1f, 0.75f, 1f));
			wungusOutlineOverlay.SetColor("_EmissionColor", new Color(0.9f, 0.1f, 0.75f, 0.5f));
			wungusBoostAura = Assets.CreateNewBoostAura("DS_GAMING_BUNGUS_SUPER_FORMS_WUNGUS_BOOST_AURA", 1.15f, 0.7f, new Color(0f, 0f, 0f), new Color(1f, 0f, 1f), new Color(1f, 0.8f, 1f), new Color(1f, 0f, 1f));
			wungusBoostFlash = Assets.CreateNewBoostFlash("DS_GAMING_BUNGUS_SUPER_FORMS_WUNGUS_BOOST_FLASH", 1.15f, 1.4f, new Color(0f, 0f, 0f), new Color(1f, 0f, 1f), new Color(1f, 0.8f, 1f), new Color(1f, 0f, 1f));
		}
	}
	[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.ds_gaming.BungusSuperForms", "BungusSuperForms", "1.0.0")]
	public class BungusSuperFormsPlugin : BaseUnityPlugin
	{
		public const string PluginGUID = "com.ds_gaming.BungusSuperForms";

		public const string PluginAuthor = "ds_gaming";

		public const string PluginName = "BungusSuperForms";

		public const string PluginVersion = "1.0.0";

		public const string Prefix = "DS_GAMING_BUNGUS_SUPER_FORMS_";

		public static bool sonicModLoaded;

		public static bool ancientScepterLoaded;

		public void Awake()
		{
			sonicModLoaded = Chainloader.PluginInfos.ContainsKey("com.ds_gaming.SonicTheHedgehog");
			ancientScepterLoaded = Chainloader.PluginInfos.ContainsKey("com.DestroyedClone.AncientScepter");
			Log.Init(((BaseUnityPlugin)this).Logger);
			Assets.Initialize();
			FormBuffs.RegisterBuffs();
			FormDefs.Initialize();
			SkillDefs.Initialize();
			Stats.Initialize();
			Language.Initialize();
			States.RegisterStates();
			new ContentPacks().Initialize();
		}
	}
	public static class FormBuffs
	{
		internal static BuffDef bungusFormBuff;

		internal static BuffDef wungusFormBuff;

		internal static BuffDef wungusBoostBuff;

		internal static void RegisterBuffs()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			bungusFormBuff = AddNewBuff("bdBungusForm", Assets.mainAssetBundle.LoadAsset<Sprite>("texBungusBuffIcon"), new Color(0.1f, 7f, 0.5f), canStack: false, isDebuff: false);
			wungusFormBuff = AddNewBuff("bdWungusForm", Assets.mainAssetBundle.LoadAsset<Sprite>("texWungusBuffIcon"), new Color(0.8f, 0.4f, 0.8f), canStack: false, isDebuff: false);
			wungusBoostBuff = AddNewBuff("bdWungusBoost", LegacyResourcesAPI.Load<BuffDef>("BuffDefs/CloakSpeed").iconSprite, new Color(0.8f, 0.4f, 0.8f), canStack: false, isDebuff: false);
		}

		internal static BuffDef AddNewBuff(string buffName, Sprite buffIcon, Color buffColor, bool canStack, bool isDebuff)
		{
			//IL_0010: 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)
			BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
			((Object)val).name = buffName;
			val.buffColor = buffColor;
			val.canStack = canStack;
			val.isDebuff = isDebuff;
			val.eliteDef = null;
			val.iconSprite = buffIcon;
			Content.AddBuffDef(val);
			return val;
		}
	}
	public static class FormDefs
	{
		public static FormDef bungusSuperFormDef;

		public static FormDef wungusSuperFormDef;

		public static void Initialize()
		{
			//IL_0021: 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_0042: 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)
			//IL_0089: 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_00b2: 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)
			bungusSuperFormDef = Forms.CreateFormDef("DS_GAMING_BUNGUS_SUPER_FORMS_BUNGUS_SUPER_FORM", FormBuffs.bungusFormBuff, 30f, true, false, false, 1, false, false, false, new SerializableEntityStateType(typeof(BungusState)), new SerializableEntityStateType(typeof(TransformationAnimation)), (Dictionary<string, RenderReplacements>)null, typeof(FormHandler), new AllowedBodyList
			{
				whitelist = false,
				bodyNames = Array.Empty<string>()
			}, (KeyCode)98);
			wungusSuperFormDef = Forms.CreateFormDef("DS_GAMING_BUNGUS_SUPER_FORMS_WUNGUS_SUPER_FORM", FormBuffs.wungusFormBuff, 30f, true, false, false, 1, false, true, true, new SerializableEntityStateType(typeof(WungusState)), default(SerializableEntityStateType), BungusSuperFormsPlugin.sonicModLoaded ? CreateSonicRenderDictionary() : null, typeof(FormHandler), new AllowedBodyList
			{
				whitelist = false,
				bodyNames = Array.Empty<string>()
			}, (KeyCode)98);
			FormCatalog.AddFormDefs((FormDef[])(object)new FormDef[2] { bungusSuperFormDef, wungusSuperFormDef });
		}

		private static Dictionary<string, RenderReplacements> CreateSonicRenderDictionary()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			return new Dictionary<string, RenderReplacements> { 
			{
				"DS_GAMING_SONIC_THE_HEDGEHOG_BODY_DEFAULT_SKIN_NAME",
				new RenderReplacements
				{
					material = null,
					mesh = Assets.superSonicMesh
				}
			} };
		}

		[SystemInitializer(new Type[] { typeof(ItemCatalog) })]
		public static void InitializeFormItemRequirements()
		{
			//IL_0010: 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_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			bungusSuperFormDef.neededItems = (NeededItem[])(object)new NeededItem[1]
			{
				new NeededItem
				{
					item = Items.Mushroom.itemIndex,
					count = 7
				}
			};
			wungusSuperFormDef.neededItems = (NeededItem[])(object)new NeededItem[1]
			{
				new NeededItem
				{
					item = Items.MushroomVoid.itemIndex,
					count = 7
				}
			};
		}
	}
	public static class Language
	{
		public static void Initialize()
		{
			LanguageAPI.Add("DS_GAMING_BUNGUS_SUPER_FORMS_BUNGUS_SUPER_FORM", "Bungus");
			LanguageAPI.Add("DS_GAMING_BUNGUS_SUPER_FORMS_BUNGUS_SUPER_FORM_PREFIX", "Bustling {0}");
			LanguageAPI.Add("DS_GAMING_BUNGUS_SUPER_FORMS_WUNGUS_SUPER_FORM", "Wungus");
			LanguageAPI.Add("DS_GAMING_BUNGUS_SUPER_FORMS_WUNGUS_SUPER_FORM_PREFIX", "Weeping {0}");
			LanguageAPI.Add("DS_GAMING_BUNGUS_SUPER_FORMS_UTILITY_WUNGUS_BOOST_NAME", "Weeping Boost");
			LanguageAPI.Add("DS_GAMING_BUNGUS_SUPER_FORMS_UTILITY_WUNGUS_BOOST_DESCRIPTION", "<style=cIsUtility>Move 65% faster</style> than normal.");
		}
	}
	public static class SkillDefs
	{
		public static RequiresFormBoostSkillDef wungusBoost;

		public static void Initialize()
		{
			if (BungusSuperFormsPlugin.sonicModLoaded)
			{
				CreateSonicWungusBoost();
			}
		}

		private static void CreateSonicWungusBoost()
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			wungusBoost = Helpers.CopyBoostSkillDef<RequiresFormBoostSkillDef>(SonicSkillDefs.boostSkillDef);
			((SkillDef)wungusBoost).skillName = "DS_GAMING_BUNGUS_SUPER_FORMS_UTILITY_WUNGUS_BOOST_NAME";
			((SkillDef)wungusBoost).skillNameToken = "DS_GAMING_BUNGUS_SUPER_FORMS_UTILITY_WUNGUS_BOOST_NAME";
			((SkillDef)wungusBoost).skillDescriptionToken = "DS_GAMING_BUNGUS_SUPER_FORMS_UTILITY_WUNGUS_BOOST_DESCRIPTION";
			((SkillDef)wungusBoost).icon = Assets.mainAssetBundle.LoadAsset<Sprite>("texWungusBoostIcon");
			((SkillDef)wungusBoost).activationState = new SerializableEntityStateType(typeof(WungusBoost));
			((RequiresFormSkillDef)wungusBoost).requiredForm = FormDefs.wungusSuperFormDef;
			wungusBoost.boostHUDColor = new Color(0.8f, 0.4f, 0.8f);
			if (BungusSuperFormsPlugin.ancientScepterLoaded)
			{
				AncientScepter.Initialize();
			}
		}
	}
	public class SkillReplacer : MonoBehaviour
	{
		private FormComponent formComponent;

		private CharacterBody body;

		[SystemInitializer(new Type[] { typeof(BodyCatalog) })]
		internal static void AddSkillReplacerComponent()
		{
			if (BungusSuperFormsPlugin.sonicModLoaded)
			{
				BodyCatalog.FindBodyPrefab("SonicTheHedgehog").AddComponent<SkillReplacer>();
			}
		}

		public void Start()
		{
			formComponent = ((Component)this).GetComponent<FormComponent>();
			if (Object.op_Implicit((Object)(object)formComponent))
			{
				body = ((Component)this).GetComponent<CharacterBody>();
				formComponent.OnFormChanged += FormChanged;
			}
			else
			{
				Object.Destroy((Object)(object)this);
			}
		}

		public void OnDestroy()
		{
			formComponent.OnFormChanged -= FormChanged;
		}

		public void FormChanged(FormDef previous, FormDef active)
		{
			if (Util.HasEffectiveAuthority(((Component)this).gameObject) && (Object)(object)active == (Object)(object)FormDefs.wungusSuperFormDef)
			{
				SkillOverrides();
			}
		}

		public void SkillOverrides()
		{
			if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.skillLocator) && Object.op_Implicit((Object)(object)body.skillLocator.utility) && (Object)(object)body.skillLocator.utility.baseSkill == (Object)(object)SonicSkillDefs.boostSkillDef)
			{
				body.skillLocator.utility.SetSkillOverride((object)this, (SkillDef)(object)SkillDefs.wungusBoost, (SkillOverridePriority)2);
			}
		}
	}
	public static class States
	{
		internal static void RegisterStates()
		{
			Content.AddEntityState(typeof(BungusState));
			Content.AddEntityState(typeof(WungusState));
			Content.AddEntityState(typeof(TransformationAnimation));
			if (BungusSuperFormsPlugin.sonicModLoaded)
			{
				RegisterSonicStates();
				if (BungusSuperFormsPlugin.ancientScepterLoaded)
				{
					RegisterScepterStates();
				}
			}
		}

		internal static void RegisterSonicStates()
		{
			Content.AddEntityState(typeof(WungusBoost));
		}

		internal static void RegisterScepterStates()
		{
			Content.AddEntityState(typeof(ScepterWungusBoost));
		}
	}
	public static class Stats
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static StatHookEventHandler <0>__RecalculateStats;

			public static hook_RecalculateStats <1>__RecalcStatAPIDoesntHaveAcceleration;
		}

		public static void Initialize()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0032: 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_003d: Expected O, but got Unknown
			object obj = <>O.<0>__RecalculateStats;
			if (obj == null)
			{
				StatHookEventHandler val = RecalculateStats;
				<>O.<0>__RecalculateStats = val;
				obj = (object)val;
			}
			RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj;
			object obj2 = <>O.<1>__RecalcStatAPIDoesntHaveAcceleration;
			if (obj2 == null)
			{
				hook_RecalculateStats val2 = RecalcStatAPIDoesntHaveAcceleration;
				<>O.<1>__RecalcStatAPIDoesntHaveAcceleration = val2;
				obj2 = (object)val2;
			}
			CharacterBody.RecalculateStats += (hook_RecalculateStats)obj2;
		}

		public static void RecalculateStats(CharacterBody self, StatHookEventArgs stats)
		{
			if (self.HasBuff(FormBuffs.bungusFormBuff))
			{
				stats.moveSpeedReductionMultAdd += 0.5f;
				stats.armorAdd += 200f;
				stats.healthMultAdd += 1f;
				if (Object.op_Implicit((Object)(object)self.inventory))
				{
					stats.damageMultAdd += 0.06f * (float)self.inventory.GetItemCount(Items.Mushroom);
				}
			}
			if (self.HasBuff(FormBuffs.wungusFormBuff))
			{
				stats.sprintSpeedAdd += 0.5f;
				stats.healthMultAdd += 1f;
				if (Object.op_Implicit((Object)(object)self.inventory))
				{
					stats.damageMultAdd += 0.04f * (float)self.inventory.GetItemCount(Items.MushroomVoid);
				}
			}
			if (self.HasBuff(FormBuffs.wungusBoostBuff))
			{
				BoostLogic.BoostStats(self, stats, 0.65f);
				stats.armorAdd += 50f;
			}
		}

		private static void RecalcStatAPIDoesntHaveAcceleration(orig_RecalculateStats orig, CharacterBody self)
		{
			orig.Invoke(self);
			if (self.HasBuff(FormBuffs.wungusFormBuff))
			{
				self.acceleration *= 3f;
			}
		}
	}
}
namespace BungusSuperFormsMod.MyEntityStates
{
	public class BungusState : FormStateBase
	{
		private TemporaryOverlayInstance temporaryOverlay;

		public override void OnEnter()
		{
			((FormStateBase)this).OnEnter();
			((FormStateBase)this).Heal(1f);
			((FormStateBase)this).ApplyOverlay(ref temporaryOverlay, Assets.bungusSuperFormOverlay);
			((FormStateBase)this).Flash(0.5f);
		}

		public override void OnExit()
		{
			((FormStateBase)this).RemoveOverlay(ref temporaryOverlay);
			((FormStateBase)this).Flash(0.5f);
			((FormStateBase)this).OnExit();
		}

		public override void FixedUpdate()
		{
			((FormStateBase)this).FixedUpdate();
		}
	}
	public class ScepterWungusBoost : ScepterBoostBase
	{
		protected override BuffDef buff => FormBuffs.wungusBoostBuff;

		public override void OnEnter()
		{
			((ScepterBoostBase)this).OnEnter();
		}

		public override void OnExit()
		{
			((ScepterBoostBase)this).OnExit();
		}

		public override GameObject GetFlashPrefab()
		{
			return AncientScepter.scepterWungusBoostFlash;
		}

		public override GameObject GetAuraPrefab()
		{
			return Assets.wungusBoostAura;
		}

		public override Material GetOverlayMaterial()
		{
			return null;
		}
	}
	public class TransformationAnimation : GenericTransformationBase
	{
		private static float cameraDistance = -7f;

		private CharacterCameraParamsData cameraParams = new CharacterCameraParamsData
		{
			maxPitch = BlendableFloat.op_Implicit(70f),
			minPitch = BlendableFloat.op_Implicit(-70f),
			pivotVerticalOffset = BlendableFloat.op_Implicit(0.5f),
			idealLocalCameraPos = BlendableVector3.op_Implicit(new Vector3(0f, 0f, cameraDistance)),
			wallCushion = BlendableFloat.op_Implicit(0.1f)
		};

		private CameraParamsOverrideHandle camOverrideHandle;

		protected override float duration => 1.4f;

		public override void OnEnter()
		{
			//IL_002c: 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_003a: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			((GenericTransformationBase)this).OnEnter();
			if (((TransformationBase)this).fromTeamSuper || ((EntityState)this).isAuthority)
			{
			}
			camOverrideHandle = ((EntityState)this).cameraTargetParams.AddParamsOverride(new CameraParamsOverrideRequest
			{
				cameraParamsData = cameraParams,
				priority = 1f
			}, ((GenericTransformationBase)this).duration / 2f);
		}

		public override void Transform()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			((GenericTransformationBase)this).Transform();
			Util.PlaySound("Play_hedgehogutils_super_transform", ((EntityState)this).gameObject);
			((EntityState)this).cameraTargetParams.RemoveParamsOverride(camOverrideHandle, 0.2f);
		}
	}
	public class WungusBoost : Boost
	{
		protected override BuffDef buff => FormBuffs.wungusBoostBuff;

		public override void OnEnter()
		{
			((Boost)this).OnEnter();
			if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator))
			{
				((EntityState)this).modelLocator.normalizeToFloor = true;
			}
		}

		public override void OnExit()
		{
			if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator))
			{
				((EntityState)this).modelLocator.normalizeToFloor = false;
			}
			((Boost)this).OnExit();
		}

		public override GameObject GetFlashPrefab()
		{
			return Assets.wungusBoostFlash;
		}

		public override GameObject GetAuraPrefab()
		{
			return Assets.wungusBoostAura;
		}

		public override Material GetOverlayMaterial()
		{
			return null;
		}
	}
	public class WungusState : FormStateBase
	{
		private TemporaryOverlayInstance temporaryOverlay;

		protected BoostLogic boostLogic;

		public override void OnEnter()
		{
			((FormStateBase)this).OnEnter();
			Util.PlaySound("Play_item_void_critGlasses", ((EntityState)this).gameObject);
			((FormStateBase)this).Heal(1f);
			((FormStateBase)this).ApplyOverlay(ref temporaryOverlay, Assets.wungusSuperFormOverlay);
			((FormStateBase)this).Flash(0.5f);
			boostLogic = ((EntityState)this).GetComponent<BoostLogic>();
			if (Object.op_Implicit((Object)(object)boostLogic))
			{
				boostLogic.alwaysMaxBoost = true;
			}
		}

		public override void OnExit()
		{
			((FormStateBase)this).RemoveOverlay(ref temporaryOverlay);
			((FormStateBase)this).Flash(0.5f);
			if (Object.op_Implicit((Object)(object)boostLogic))
			{
				boostLogic.alwaysMaxBoost = false;
			}
			((FormStateBase)this).OnExit();
		}

		public override void FixedUpdate()
		{
			((FormStateBase)this).FixedUpdate();
		}
	}
}
namespace BungusSuperFormsMod.Internal
{
	internal class ContentPacks : IContentPackProvider
	{
		[CompilerGenerated]
		private sealed class <FinalizeAsync>d__21 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public FinalizeAsyncArgs args;

			public ContentPacks <>4__this;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				if (<>1__state != 0)
				{
					return false;
				}
				<>1__state = -1;
				args.ReportProgress(1f);
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <GenerateContentPackAsync>d__20 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public GetContentPackAsyncArgs args;

			public ContentPacks <>4__this;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				if (<>1__state != 0)
				{
					return false;
				}
				<>1__state = -1;
				ContentPack.Copy(<>4__this.contentPack, args.output);
				args.ReportProgress(1f);
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <LoadStaticContentAsync>d__19 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public LoadStaticContentAsyncArgs args;

			public ContentPacks <>4__this;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				if (<>1__state != 0)
				{
					return false;
				}
				<>1__state = -1;
				<>4__this.contentPack.identifier = <>4__this.identifier;
				<>4__this.contentPack.bodyPrefabs.Add(bodyPrefabs.ToArray());
				<>4__this.contentPack.masterPrefabs.Add(masterPrefabs.ToArray());
				<>4__this.contentPack.projectilePrefabs.Add(projectilePrefabs.ToArray());
				<>4__this.contentPack.networkedObjectPrefabs.Add(networkedObjectPrefabs.ToArray());
				<>4__this.contentPack.survivorDefs.Add(survivorDefs.ToArray());
				<>4__this.contentPack.unlockableDefs.Add(unlockableDefs.ToArray());
				<>4__this.contentPack.skillDefs.Add(skillDefs.ToArray());
				<>4__this.contentPack.skillFamilies.Add(skillFamilies.ToArray());
				<>4__this.contentPack.entityStateTypes.Add(entityStates.ToArray());
				<>4__this.contentPack.buffDefs.Add(buffDefs.ToArray());
				<>4__this.contentPack.effectDefs.Add(effectDefs.ToArray());
				<>4__this.contentPack.itemTierDefs.Add(itemTierDefs.ToArray());
				<>4__this.contentPack.itemDefs.Add(itemDefs.ToArray());
				<>4__this.contentPack.networkSoundEventDefs.Add(networkSoundEventDefs.ToArray());
				args.ReportProgress(1f);
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		internal ContentPack contentPack = new ContentPack();

		public static List<GameObject> bodyPrefabs = new List<GameObject>();

		public static List<GameObject> masterPrefabs = new List<GameObject>();

		public static List<GameObject> projectilePrefabs = new List<GameObject>();

		public static List<GameObject> networkedObjectPrefabs = new List<GameObject>();

		public static List<SurvivorDef> survivorDefs = new List<SurvivorDef>();

		public static List<UnlockableDef> unlockableDefs = new List<UnlockableDef>();

		public static List<SkillFamily> skillFamilies = new List<SkillFamily>();

		public static List<SkillDef> skillDefs = new List<SkillDef>();

		public static List<Type> entityStates = new List<Type>();

		public static List<BuffDef> buffDefs = new List<BuffDef>();

		public static List<EffectDef> effectDefs = new List<EffectDef>();

		public static List<ItemTierDef> itemTierDefs = new List<ItemTierDef>();

		public static List<ItemDef> itemDefs = new List<ItemDef>();

		public static List<NetworkSoundEventDef> networkSoundEventDefs = new List<NetworkSoundEventDef>();

		public string identifier => "com.ds_gaming.BungusSuperForms";

		public void Initialize()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders);
		}

		private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider)
		{
			addContentPackProvider.Invoke((IContentPackProvider)(object)this);
		}

		[IteratorStateMachine(typeof(<LoadStaticContentAsync>d__19))]
		public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <LoadStaticContentAsync>d__19(0)
			{
				<>4__this = this,
				args = args
			};
		}

		[IteratorStateMachine(typeof(<GenerateContentPackAsync>d__20))]
		public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <GenerateContentPackAsync>d__20(0)
			{
				<>4__this = this,
				args = args
			};
		}

		[IteratorStateMachine(typeof(<FinalizeAsync>d__21))]
		public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <FinalizeAsync>d__21(0)
			{
				<>4__this = this,
				args = args
			};
		}
	}
	internal class Content
	{
		public static void AddCharacterBodyPrefab(GameObject bprefab)
		{
			ContentPacks.bodyPrefabs.Add(bprefab);
		}

		public static void AddMasterPrefab(GameObject prefab)
		{
			ContentPacks.masterPrefabs.Add(prefab);
		}

		public static void AddProjectilePrefab(GameObject prefab)
		{
			ContentPacks.projectilePrefabs.Add(prefab);
		}

		public static void AddNetworkedObjectPrefab(GameObject prefab)
		{
			ContentPacks.networkedObjectPrefabs.Add(prefab);
		}

		public static void AddSurvivorDef(SurvivorDef survivorDef)
		{
			ContentPacks.survivorDefs.Add(survivorDef);
		}

		public static void AddUnlockableDef(UnlockableDef unlockableDef)
		{
			ContentPacks.unlockableDefs.Add(unlockableDef);
		}

		public static void AddSkillDef(SkillDef skillDef)
		{
			ContentPacks.skillDefs.Add(skillDef);
		}

		public static void AddSkillFamily(SkillFamily skillFamily)
		{
			ContentPacks.skillFamilies.Add(skillFamily);
		}

		public static void AddEntityState(Type entityState)
		{
			ContentPacks.entityStates.Add(entityState);
		}

		public static void AddBuffDef(BuffDef buffDef)
		{
			ContentPacks.buffDefs.Add(buffDef);
		}

		public static void AddEffectDef(EffectDef effectDef)
		{
			ContentPacks.effectDefs.Add(effectDef);
		}

		public static void AddItemDef(ItemDef itemDef)
		{
			ContentPacks.itemDefs.Add(itemDef);
		}

		public static void AddItemTierDef(ItemTierDef itemDef)
		{
			ContentPacks.itemTierDefs.Add(itemDef);
		}

		public static void AddNetworkSoundEventDef(NetworkSoundEventDef networkSoundEventDef)
		{
			ContentPacks.networkSoundEventDefs.Add(networkSoundEventDef);
		}
	}
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
}