Decompiled source of Joker Mode v1.2.1

plugins/ViendStanceChangeSkill/JokerMode.dll

Decompiled 3 months ago
using System;
using System.Collections;
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 AncientScepter;
using BepInEx;
using BepInEx.Bootstrap;
using EntityStates;
using EntityStates.VoidSurvivor.CorruptMode;
using EntityStates.VoidSurvivor.JokerMode;
using On.EntityStates.VoidSurvivor.CorruptMode;
using On.RoR2;
using R2API;
using R2API.Utils;
using RiskyMod.Survivors;
using RiskyMod.Survivors.DLC1.VoidFiend;
using RoR2;
using RoR2.ContentManagement;
using RoR2.HudOverlay;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;
using ViendStanceChangeSkill;
using ViendStanceChangeSkill.Modules;

[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 = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ViendStanceChangeSkill")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+f2b3ae2698faac9be9b7365b75bce115fbac5a32")]
[assembly: AssemblyProduct("ViendStanceChangeSkill")]
[assembly: AssemblyTitle("ViendStanceChangeSkill")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ViendStanceChangeSkill
{
	public class ViendSkillDataComponent : MonoBehaviour
	{
		public int s1Stock;

		public int s2Stock;

		public int s3Stock;

		public int s4Stock;

		public float s1RechargeStopwatch;

		public float s2RechargeStopwatch;

		public float s3RechargeStopwatch;

		public float s4RechargeStopwatch;
	}
	[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.Moffein.ViendStanceChangeSkill", "ViendStanceChangeSkill", "1.2.1")]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class ViendStanceChangeSkillPlugin : BaseUnityPlugin
	{
		public static AssetBundle assetBundle;

		private static bool compatRiskyModLoaded = false;

		private static bool compatScepterLoaded = false;

		public static float corruptDamagePenalty = 0.25f;

		public static float corruptScepterDamageMult = 1f;

		public static float corruptDamageTakenMult = 1.25f;

		public static PluginInfo pluginInfo;

		private static BodyIndex viendBodyIndex = (BodyIndex)(-1);

		private static ItemIndex scepterIndex = (ItemIndex)(-1);

		private void Awake()
		{
			pluginInfo = ((BaseUnityPlugin)this).Info;
			compatRiskyModLoaded = Chainloader.PluginInfos.ContainsKey("com.RiskyLives.RiskyMod");
			compatScepterLoaded = Chainloader.PluginInfos.ContainsKey("com.DestroyedClone.AncientScepter");
			using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ViendStanceChangeSkill.jokerviendbundle"))
			{
				assetBundle = AssetBundle.LoadFromStream(stream);
			}
			Setup();
			Tokens.LoadLanguage();
			new Content().Initialize();
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(OnLoad));
		}

		private void OnLoad()
		{
			//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_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			scepterIndex = ItemCatalog.FindItemIndex("ITEM_ANCIENT_SCEPTER");
			viendBodyIndex = BodyCatalog.FindBodyIndex("VoidSurvivorBody");
		}

		private void Setup()
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			Content.entityStates.Add(typeof(EnterJokerMode));
			Content.entityStates.Add(typeof(ExitJokerMode));
			AddStanceChangeMachine();
			CreateSkillDefs();
			DisableCorruptMeter();
			CorruptStatMod();
			CorruptMode.OnExit += new hook_OnExit(CorruptMode_OnExit);
		}

		private void CorruptMode_OnExit(orig_OnExit orig, CorruptMode self)
		{
			orig.Invoke(self);
			if (!((EntityState)self).isAuthority || !Object.op_Implicit((Object)(object)((EntityState)self).characterBody))
			{
				return;
			}
			ViendSkillDataComponent component = ((Component)((EntityState)self).characterBody).GetComponent<ViendSkillDataComponent>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			if (Object.op_Implicit((Object)(object)((EntityState)self).skillLocator))
			{
				if (Object.op_Implicit((Object)(object)((EntityState)self).skillLocator.primary))
				{
					((EntityState)self).skillLocator.primary.stock = component.s1Stock;
					((EntityState)self).skillLocator.primary.rechargeStopwatch = component.s1RechargeStopwatch;
				}
				if (Object.op_Implicit((Object)(object)((EntityState)self).skillLocator.secondary))
				{
					((EntityState)self).skillLocator.secondary.stock = component.s2Stock;
					((EntityState)self).skillLocator.secondary.rechargeStopwatch = component.s2RechargeStopwatch;
				}
				if (Object.op_Implicit((Object)(object)((EntityState)self).skillLocator.utility))
				{
					((EntityState)self).skillLocator.utility.stock = component.s3Stock;
					((EntityState)self).skillLocator.utility.rechargeStopwatch = component.s3RechargeStopwatch;
				}
				if (Object.op_Implicit((Object)(object)((EntityState)self).skillLocator.special))
				{
					((EntityState)self).skillLocator.special.stock = component.s4Stock;
					((EntityState)self).skillLocator.special.rechargeStopwatch = component.s4RechargeStopwatch;
				}
			}
			Object.Destroy((Object)(object)component);
		}

		private void AddStanceChangeMachine()
		{
			//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_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/VoidSurvivor/VoidSurvivorBody.prefab").WaitForCompletion();
			EntityStateMachine val2 = val.AddComponent<EntityStateMachine>();
			val2.customName = "Stance";
			val2.initialStateType = new SerializableEntityStateType(typeof(BaseState));
			val2.mainStateType = new SerializableEntityStateType(typeof(BaseState));
			NetworkStateMachine component = val.GetComponent<NetworkStateMachine>();
			component.stateMachines = component.stateMachines.Append(val2).ToArray();
		}

		private void CreateSkillDefs()
		{
			//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_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_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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: 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_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Expected O, but got Unknown
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			SkillFamily val = Addressables.LoadAssetAsync<SkillFamily>((object)"RoR2/DLC1/VoidSurvivor/VoidSurvivorSpecialFamily.asset").WaitForCompletion();
			SkillDef val2 = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/DLC1/VoidSurvivor/CrushHealth.asset").WaitForCompletion();
			SkillDef val3 = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/DLC1/VoidSurvivor/CrushCorruption.asset").WaitForCompletion();
			SkillDef val4 = ScriptableObject.CreateInstance<SkillDef>();
			val4.activationState = new SerializableEntityStateType(typeof(EnterJokerMode));
			val4.activationStateMachineName = "Stance";
			val4.baseMaxStock = 1;
			val4.baseRechargeInterval = 12f;
			val4.beginSkillCooldownOnSkillEnd = true;
			val4.canceledFromSprinting = false;
			val4.cancelSprintingOnActivation = false;
			val4.forceSprintDuringState = false;
			val4.fullRestockOnAssign = true;
			val4.icon = val2.icon;
			val4.interruptPriority = (InterruptPriority)0;
			val4.isCombatSkill = false;
			val4.keywordTokens = new string[0];
			val4.mustKeyPress = true;
			val4.rechargeStock = 1;
			val4.requiredStock = 1;
			val4.stockToConsume = 1;
			val4.resetCooldownTimerOnUse = false;
			val4.skillDescriptionToken = "VIENDJOKERMODE_ENTER_SKILL_DESCRIPTION";
			val4.skillNameToken = "VIENDJOKERMODE_ENTER_SKILL_NAME";
			val4.skillName = "ViendStanceChange";
			((Object)val4).name = val4.skillName;
			Content.skillDefs.Add(val4);
			Content.EnterStanceChange = val4;
			SkillDef val5 = ScriptableObject.CreateInstance<SkillDef>();
			val5.activationState = new SerializableEntityStateType(typeof(ExitJokerMode));
			val5.activationStateMachineName = "Stance";
			val5.baseMaxStock = 1;
			val5.baseRechargeInterval = 12f;
			val5.beginSkillCooldownOnSkillEnd = true;
			val5.canceledFromSprinting = false;
			val5.cancelSprintingOnActivation = false;
			val5.forceSprintDuringState = false;
			val5.fullRestockOnAssign = true;
			val5.icon = val3.icon;
			val5.interruptPriority = (InterruptPriority)1;
			val5.isCombatSkill = false;
			val5.keywordTokens = new string[0];
			val5.mustKeyPress = true;
			val5.rechargeStock = 1;
			val5.requiredStock = 1;
			val5.stockToConsume = 1;
			val5.resetCooldownTimerOnUse = false;
			val5.skillDescriptionToken = "Society.";
			val5.skillNameToken = "VIENDJOKERMODE_EXIT_SKILL_DESCRIPTION";
			val5.skillName = "VIENDJOKERMODE_EXIT_SKILL_NAME";
			((Object)val5).name = val5.skillName;
			Content.skillDefs.Add(val5);
			Content.ExitStanceChange = val5;
			EnterJokerMode.exitSkillDef = val5;
			Array.Resize(ref val.variants, val.variants.Length + 1);
			Variant[] variants = val.variants;
			int num = val.variants.Length - 1;
			Variant val6 = new Variant
			{
				skillDef = val4,
				unlockableDef = null
			};
			((Variant)(ref val6)).viewableNode = new Node(val4.skillName, false, (Node)null);
			variants[num] = val6;
			SkillDef val7 = ScriptableObject.CreateInstance<SkillDef>();
			val7.activationState = new SerializableEntityStateType(typeof(EnterJokerMode));
			val7.activationStateMachineName = "Stance";
			val7.baseMaxStock = 1;
			val7.baseRechargeInterval = 6f;
			val7.beginSkillCooldownOnSkillEnd = true;
			val7.canceledFromSprinting = false;
			val7.cancelSprintingOnActivation = false;
			val7.forceSprintDuringState = false;
			val7.fullRestockOnAssign = true;
			val7.icon = assetBundle.LoadAsset<Sprite>("JOKERSCEPTER");
			val7.interruptPriority = (InterruptPriority)0;
			val7.isCombatSkill = false;
			val7.keywordTokens = new string[0];
			val7.mustKeyPress = true;
			val7.rechargeStock = 1;
			val7.requiredStock = 1;
			val7.stockToConsume = 1;
			val7.resetCooldownTimerOnUse = false;
			val7.skillDescriptionToken = "VIENDJOKERMODE_ENTER_SKILL_SCEPTER_DESCRIPTION";
			val7.skillNameToken = "VIENDJOKERMODE_ENTER_SKILL_SCEPTER_NAME";
			val7.skillName = "ViendStanceChangeScepter";
			((Object)val7).name = val7.skillName;
			Content.skillDefs.Add(val7);
			Content.EnterStanceChangeScepter = val7;
			RegisterScepterSkill();
		}

		private void RegisterScepterSkill()
		{
			if (compatScepterLoaded)
			{
				RegisterScepterSkillInternal();
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private void RegisterScepterSkillInternal()
		{
			ItemBase<AncientScepterItem>.instance.RegisterScepterSkill(Content.EnterStanceChangeScepter, "VoidSurvivorBody", Content.EnterStanceChange);
		}

		private void DisableCorruptMeter()
		{
			//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
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			UncorruptedMode.FixedUpdate += new hook_FixedUpdate(UncorruptedMode_FixedUpdate);
			CorruptMode.FixedUpdate += new hook_FixedUpdate(CorruptMode_FixedUpdate);
			VoidSurvivorController.UpdateUI += new hook_UpdateUI(DisableCorruptUI);
			VoidSurvivorController.FixedUpdate += new hook_FixedUpdate(DisableCorruptAnimator);
		}

		private void DisableCorruptAnimator(orig_FixedUpdate orig, VoidSurvivorController self)
		{
			orig.Invoke(self);
			if (Object.op_Implicit((Object)(object)self.characterAnimator) && HasStanceChange(self.characterBody))
			{
				float num = (self.isCorrupted ? 1f : 0f);
				self.characterAnimator.SetFloat("corruptionFraction", num);
			}
		}

		private void DisableCorruptUI(orig_UpdateUI orig, VoidSurvivorController self)
		{
			if (!HasStanceChange(self.characterBody))
			{
				orig.Invoke(self);
			}
			else if (self.overlayController != null)
			{
				self.overlayController.onInstanceAdded -= self.OnOverlayInstanceAdded;
				self.overlayController.onInstanceRemove -= self.OnOverlayInstanceRemoved;
				self.fillUiList.Clear();
				HudOverlayManager.RemoveOverlay(self.overlayController);
				self.overlayController = null;
			}
		}

		private void CorruptMode_FixedUpdate(orig_FixedUpdate orig, CorruptMode self)
		{
			if (!HasStanceChange(((EntityState)self).skillLocator))
			{
				orig.Invoke(self);
			}
		}

		private void UncorruptedMode_FixedUpdate(orig_FixedUpdate orig, UncorruptedMode self)
		{
			if (!HasStanceChange(((EntityState)self).skillLocator))
			{
				orig.Invoke(self);
			}
		}

		private void CorruptStatMod()
		{
			//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
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStats);
			HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage);
		}

		private void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: 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_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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_0052: 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)
			if (self.body.bodyIndex == viendBodyIndex && DamageTypeCombo.op_Implicit(damageInfo.damageType & DamageTypeCombo.op_Implicit((DamageType)2)) == 0L && DamageTypeCombo.op_Implicit(damageInfo.damageType & DamageTypeCombo.op_Implicit((DamageType)2097152)) == 0L && DamageTypeCombo.op_Implicit(damageInfo.damageType & DamageTypeCombo.op_Implicit((DamageType)int.MinValue)) == 0L && self.body.HasBuff(Buffs.VoidSurvivorCorruptMode) && HasStanceChange(self.body))
			{
				damageInfo.damage *= corruptDamageTakenMult;
			}
			orig.Invoke(self, damageInfo);
		}

		private void RecalculateStats(CharacterBody sender, StatHookEventArgs args)
		{
			if (sender.HasBuff(Buffs.VoidSurvivorCorruptMode) && HasStanceChange(sender))
			{
				if (!RiskyModViendArmorStripEnabled())
				{
					args.armorAdd -= 100f;
				}
				if (!HasScepter(sender))
				{
					args.damageMultAdd -= corruptDamagePenalty;
				}
			}
		}

		public static bool HasScepter(CharacterBody body)
		{
			return Object.op_Implicit((Object)(object)body) && HasScepter(body.inventory);
		}

		public static bool HasScepter(Inventory inventory)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			return Object.op_Implicit((Object)(object)inventory) && inventory.GetItemCount(scepterIndex) > 0;
		}

		public static bool RiskyModViendArmorStripEnabled()
		{
			if (compatRiskyModLoaded)
			{
				return RiskyModViendArmorStripEnabledInternal();
			}
			return false;
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private static bool RiskyModViendArmorStripEnabledInternal()
		{
			return SurvivorsCore.enabled && VoidFiendCore.enabled && VoidFiendCore.removeCorruptArmor;
		}

		public static bool HasStanceChange(CharacterBody body)
		{
			return Object.op_Implicit((Object)(object)body) && HasStanceChange(body.skillLocator);
		}

		public static bool HasStanceChange(SkillLocator skillLocator)
		{
			return Object.op_Implicit((Object)(object)skillLocator) && Object.op_Implicit((Object)(object)skillLocator.special) && (Object)(object)skillLocator.special.baseSkill == (Object)(object)Content.EnterStanceChange;
		}
	}
}
namespace ViendStanceChangeSkill.Modules
{
	public class Content : IContentPackProvider
	{
		public static SkillDef EnterStanceChange;

		public static SkillDef ExitStanceChange;

		public static SkillDef EnterStanceChangeScepter;

		internal ContentPack contentPack = new ContentPack();

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

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

		public string identifier => "com.Moffein.ViendStanceChangeSkil";

		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);
		}

		public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
		{
			contentPack.identifier = identifier;
			contentPack.skillDefs.Add(skillDefs.ToArray());
			contentPack.entityStateTypes.Add(entityStates.ToArray());
			args.ReportProgress(1f);
			yield break;
		}

		public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
		{
			ContentPack.Copy(contentPack, args.output);
			args.ReportProgress(1f);
			yield break;
		}

		public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
		{
			args.ReportProgress(1f);
			yield break;
		}
	}
	public class Tokens
	{
		internal static string languageRoot => Path.Combine(assemblyDir, "language");

		internal static string assemblyDir => Path.GetDirectoryName(ViendStanceChangeSkillPlugin.pluginInfo.Location);

		internal static void LoadLanguage()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			Language.SetFolders += new hook_SetFolders(fixme);
		}

		private static void fixme(orig_SetFolders orig, Language self, IEnumerable<string> newFolders)
		{
			if (Directory.Exists(languageRoot))
			{
				IEnumerable<string> second = Directory.EnumerateDirectories(Path.Combine(languageRoot), self.name);
				orig.Invoke(self, newFolders.Union(second));
			}
			else
			{
				orig.Invoke(self, newFolders);
			}
		}
	}
}
namespace EntityStates.VoidSurvivor.JokerMode
{
	public class EnterJokerMode : BaseState
	{
		private VoidSurvivorController voidSurvivorController;

		public static SkillDef exitSkillDef;

		public override void OnEnter()
		{
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Expected O, but got Unknown
			((BaseState)this).OnEnter();
			voidSurvivorController = ((EntityState)this).GetComponent<VoidSurvivorController>();
			if (Object.op_Implicit((Object)(object)((EntityState)this).skillLocator) && Object.op_Implicit((Object)(object)((EntityState)this).skillLocator.special))
			{
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody))
				{
					ViendSkillDataComponent viendSkillDataComponent = ((Component)((EntityState)this).characterBody).GetComponent<ViendSkillDataComponent>();
					if (!Object.op_Implicit((Object)(object)viendSkillDataComponent))
					{
						viendSkillDataComponent = ((Component)((EntityState)this).characterBody).gameObject.AddComponent<ViendSkillDataComponent>();
					}
					viendSkillDataComponent.s1Stock = (Object.op_Implicit((Object)(object)((EntityState)this).skillLocator.primary) ? ((EntityState)this).skillLocator.primary.stock : 0);
					viendSkillDataComponent.s1RechargeStopwatch = (Object.op_Implicit((Object)(object)((EntityState)this).skillLocator.primary) ? ((EntityState)this).skillLocator.primary.rechargeStopwatch : 0f);
					viendSkillDataComponent.s2Stock = (Object.op_Implicit((Object)(object)((EntityState)this).skillLocator.secondary) ? ((EntityState)this).skillLocator.secondary.stock : 0);
					viendSkillDataComponent.s2RechargeStopwatch = (Object.op_Implicit((Object)(object)((EntityState)this).skillLocator.secondary) ? ((EntityState)this).skillLocator.secondary.rechargeStopwatch : 0f);
					viendSkillDataComponent.s3Stock = (Object.op_Implicit((Object)(object)((EntityState)this).skillLocator.utility) ? ((EntityState)this).skillLocator.utility.stock : 0);
					viendSkillDataComponent.s3RechargeStopwatch = (Object.op_Implicit((Object)(object)((EntityState)this).skillLocator.utility) ? ((EntityState)this).skillLocator.utility.rechargeStopwatch : 0f);
					viendSkillDataComponent.s4Stock = (Object.op_Implicit((Object)(object)((EntityState)this).skillLocator.special) ? ((EntityState)this).skillLocator.special.stock : 0);
					viendSkillDataComponent.s4RechargeStopwatch = (Object.op_Implicit((Object)(object)((EntityState)this).skillLocator.special) ? ((EntityState)this).skillLocator.special.rechargeStopwatch : 0f);
				}
				((EntityState)this).skillLocator.special.SetSkillOverride((object)this, exitSkillDef, (SkillOverridePriority)4);
			}
			if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)voidSurvivorController) && Object.op_Implicit((Object)(object)voidSurvivorController.bodyStateMachine))
			{
				voidSurvivorController.bodyStateMachine.SetInterruptState((EntityState)new EnterCorruptionTransition(), (InterruptPriority)1);
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority)
			{
				GenericSkill val = (Object.op_Implicit((Object)(object)((EntityState)this).skillLocator) ? ((EntityState)this).skillLocator.special : null);
				if (!Object.op_Implicit((Object)(object)val) || val.stock <= 0)
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
			}
		}

		public override void OnExit()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)voidSurvivorController) && Object.op_Implicit((Object)(object)voidSurvivorController.bodyStateMachine))
			{
				voidSurvivorController.bodyStateMachine.SetInterruptState((EntityState)new ExitCorruptionTransition(), (InterruptPriority)1);
			}
			((EntityState)this).OnExit();
			if (Object.op_Implicit((Object)(object)((EntityState)this).skillLocator) && Object.op_Implicit((Object)(object)((EntityState)this).skillLocator.special))
			{
				((EntityState)this).skillLocator.special.UnsetSkillOverride((object)this, exitSkillDef, (SkillOverridePriority)4);
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)1;
		}
	}
	public class ExitJokerMode : BaseState
	{
		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			((EntityState)this).outer.SetNextStateToMain();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)2;
		}
	}
}