Decompiled source of KangMod v0.3.0

KangMod.dll

Decompiled 10 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.GummyClone;
using EntityStates.Mage;
using HG;
using KangMod.TimeItems;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using MonoMod.RuntimeDetour;
using R2API;
using RoR2;
using RoR2.Achievements;
using RoR2.Audio;
using RoR2.CharacterAI;
using RoR2.ConVar;
using RoR2.Hologram;
using RoR2.Navigation;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("KangMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+d6cd30bd5f8458b7adb10683dec010af2519a29e")]
[assembly: AssemblyProduct("KangMod")]
[assembly: AssemblyTitle("KangMod")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[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 KangMod
{
	public static class AltBulwark
	{
		public static SkillDef Create(GameObject body)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			MeshFilter val = (from f in Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Engi/EngiBubbleShield.prefab").WaitForCompletion().GetComponentsInChildren<MeshFilter>(true)
				where Object.op_Implicit((Object)(object)f.sharedMesh) && Object.op_Implicit((Object)(object)((Component)f).GetComponent<MeshRenderer>())
				orderby MaxExtent(f.sharedMesh) descending
				select f).FirstOrDefault();
			if (Object.op_Implicit((Object)(object)val))
			{
				BulwarkField.shellMesh = val.sharedMesh;
				BulwarkField.shellRadius = Mathf.Max(0.01f, MaxExtent(val.sharedMesh));
				BulwarkField.shellMaterials = (from m in ((Renderer)((Component)val).GetComponent<MeshRenderer>()).sharedMaterials
					where Object.op_Implicit((Object)(object)m)
					select KangVfx.TintMaterial(m, KangVfx.Magenta, KangVfx.Cyan)).ToArray();
				Debug.Log((object)$"[Kang] Bulwark shell <- {((Object)val).name} mesh={((Object)val.sharedMesh).name} r={BulwarkField.shellRadius:0.##} mats={BulwarkField.shellMaterials.Length}");
			}
			else
			{
				Debug.LogWarning((object)"[Kang] Bulwark: no mesh in EngiBubbleShield.prefab, the shell will be invisible");
			}
			SkillDef val2 = Kang.NewSkill("KangQuantumBulwark", "KANG_UTILITY_BULWARK", typeof(QuantumBulwark), "Body", body.GetComponent<SkillLocator>().utility);
			val2.baseRechargeInterval = 12f;
			val2.interruptPriority = (InterruptPriority)1;
			val2.icon = KangIcons.Get("QuantumBulwark") ?? val2.icon;
			LanguageAPI.Add("KANG_UTILITY_BULWARK_NAME", "Quantum Bulwark");
			LanguageAPI.Add("KANG_UTILITY_BULWARK_DESC", "Gain a <style=cIsHealing>barrier</style> worth <style=cIsHealing>30% of your max health</style> and knock back nearby enemies for <style=cIsDamage>200% damage</style>. For 2.5s, enemy projectiles that reach you are <style=cIsUtility>absorbed</style> and <style=cIsUtility>redirected</style> at their shooter for <style=cIsDamage>100% damage</style> each, up to 10 times.");
			return val2;
		}

		private static float MaxExtent(Mesh m)
		{
			//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_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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_001b: Unknown result type (might be due to invalid IL or missing references)
			Bounds bounds = m.bounds;
			Vector3 extents = ((Bounds)(ref bounds)).extents;
			return Mathf.Max(extents.x, Mathf.Max(extents.y, extents.z));
		}
	}
	public class QuantumBulwark : BaseSkillState
	{
		private const float BarrierFraction = 0.3f;

		private const float PulseDamage = 2f;

		private const float PulseRadius = 8f;

		private const float PulseForce = 1900f;

		private const float PulseLift = 600f;

		private const float PulseEffectScale = 1f;

		public override void OnEnter()
		{
			//IL_00a5: 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)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: 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_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: 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_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: 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_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: 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_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: 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)
			//IL_0148: 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_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: 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_018b: Expected O, but got Unknown
			((BaseState)this).OnEnter();
			KangSfx.Play("Play_lunar_golem_attack2_shieldActivate", ((EntityState)this).gameObject);
			KangSfx.Play("Play_lunar_golem_attack1_explode", ((EntityState)this).gameObject);
			((EntityState)this).GetComponent<KangSeq>()?.Play("BulwarkBurst");
			GameFeel.Kick(((EntityState)this).characterBody, 0.8f);
			BulwarkField bulwarkField = default(BulwarkField);
			if (!((EntityState)this).TryGetComponent<BulwarkField>(ref bulwarkField))
			{
				bulwarkField = ((EntityState)this).gameObject.AddComponent<BulwarkField>();
			}
			bulwarkField.Refresh();
			if (NetworkServer.active)
			{
				((EntityState)this).healthComponent.AddBarrier(((EntityState)this).healthComponent.fullCombinedHealth * 0.3f);
			}
			if (((EntityState)this).isAuthority)
			{
				new BlastAttack
				{
					attacker = ((EntityState)this).gameObject,
					inflictor = ((EntityState)this).gameObject,
					teamIndex = ((BaseState)this).GetTeam(),
					position = ((EntityState)this).characterBody.corePosition,
					radius = 8f,
					baseDamage = ((BaseState)this).damageStat * 2f,
					procCoefficient = 1f,
					crit = ((BaseState)this).RollCrit(),
					baseForce = 1900f,
					bonusForce = Vector3.up * 600f,
					damageType = DamageTypeCombo.op_Implicit((DamageSource)4),
					falloffModel = (FalloffModel)0,
					attackerFiltering = (AttackerFiltering)2
				}.Fire();
				if (Object.op_Implicit((Object)(object)KangVfx.BigExplosion))
				{
					EffectManager.SpawnEffect(KangVfx.BigExplosion, new EffectData
					{
						origin = ((EntityState)this).characterBody.corePosition,
						scale = 1f
					}, true);
				}
				((EntityState)this).outer.SetNextStateToMain();
			}
		}
	}
	public class BulwarkField : MonoBehaviour
	{
		private const float Duration = 2.5f;

		private const float EraseRadius = 3.5f;

		private const float RedirectDamage = 1f;

		private const int MaxRedirects = 10;

		internal static Mesh shellMesh;

		internal static Material[] shellMaterials;

		internal static float shellRadius = 1f;

		private CharacterBody body;

		private GameObject shell;

		private float timeLeft;

		private int redirectsLeft;

		private static readonly List<ProjectileController> caught = new List<ProjectileController>();

		private void Awake()
		{
			body = ((Component)this).GetComponent<CharacterBody>();
		}

		public void Refresh()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_00a9: 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_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			timeLeft = 2.5f;
			redirectsLeft = 10;
			if (!Object.op_Implicit((Object)(object)shell) && Object.op_Implicit((Object)(object)shellMesh))
			{
				shell = new GameObject("KangBulwarkShell");
				shell.AddComponent<MeshFilter>().sharedMesh = shellMesh;
				((Renderer)shell.AddComponent<MeshRenderer>()).sharedMaterials = shellMaterials;
				shell.transform.SetParent(((Component)this).transform, false);
				shell.transform.position = (Object.op_Implicit((Object)(object)body) ? body.corePosition : ((Component)this).transform.position);
				shell.transform.localScale = Vector3.one * (3.5f / shellRadius);
			}
		}

		private void FixedUpdate()
		{
			timeLeft -= Time.fixedDeltaTime;
			if (timeLeft <= 0f || !Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.healthComponent) || !body.healthComponent.alive)
			{
				Object.Destroy((Object)(object)this);
			}
			else if (NetworkServer.active)
			{
				EraseProjectiles();
			}
		}

		private void EraseProjectiles()
		{
			//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_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Expected O, but got Unknown
			Vector3 corePosition = body.corePosition;
			TeamIndex teamIndex = body.teamComponent.teamIndex;
			foreach (ProjectileController instances in InstanceTracker.GetInstancesList<ProjectileController>())
			{
				if (!instances.cannotBeDeleted && Object.op_Implicit((Object)(object)instances.teamFilter) && instances.teamFilter.teamIndex != teamIndex)
				{
					Vector3 val = ((Component)instances).transform.position - corePosition;
					if (((Vector3)(ref val)).sqrMagnitude < 12.25f)
					{
						caught.Add(instances);
					}
				}
			}
			foreach (ProjectileController item in caught)
			{
				if (Object.op_Implicit((Object)(object)KangVfx.Impact))
				{
					EffectManager.SpawnEffect(KangVfx.Impact, new EffectData
					{
						origin = ((Component)item).transform.position
					}, true);
				}
				if (redirectsLeft > 0 && Redirect(item.owner))
				{
					redirectsLeft--;
				}
				Object.Destroy((Object)(object)((Component)item).gameObject);
			}
			caught.Clear();
		}

		private bool Redirect(GameObject shooter)
		{
			//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_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_0049: 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_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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: 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_0076: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: 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_00bc: 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_00d2: 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_00e5: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody val = (Object.op_Implicit((Object)(object)shooter) ? shooter.GetComponent<CharacterBody>() : null);
			if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.healthComponent) || !val.healthComponent.alive)
			{
				return false;
			}
			Vector3 corePosition = body.corePosition;
			Vector3 val2 = val.corePosition - corePosition;
			new BulletAttack
			{
				owner = ((Component)this).gameObject,
				weapon = ((Component)this).gameObject,
				origin = corePosition,
				aimVector = ((Vector3)(ref val2)).normalized,
				maxDistance = ((Vector3)(ref val2)).magnitude + 2f,
				radius = 0.3f,
				smartCollision = true,
				damage = body.damage * 1f,
				procCoefficient = 1f,
				force = 200f,
				isCrit = body.RollCrit(),
				damageType = DamageTypeCombo.op_Implicit((DamageSource)4),
				tracerEffectPrefab = KangVfx.Tracer,
				hitEffectPrefab = KangVfx.Impact
			}.Fire();
			return true;
		}

		private void OnDestroy()
		{
			if (Object.op_Implicit((Object)(object)shell))
			{
				Object.Destroy((Object)(object)shell);
			}
		}
	}
	public static class AltCouncil
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static StatHookEventHandler <0>__ApplyDamagePenalty;
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static GetDeployableSameSlotLimit <>9__24_0;

			public static Action <>9__24_1;

			internal int <Create>b__24_0(CharacterMaster master, int countMultiplier)
			{
				return 3;
			}

			internal void <Create>b__24_1()
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: 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)
				markerIndex = MarkerItem.itemIndex;
				ItemDef gummyCloneIdentifier = Items.GummyCloneIdentifier;
				gummyIndex = (ItemIndex)((!Object.op_Implicit((Object)(object)gummyCloneIdentifier)) ? (-1) : ((int)gummyCloneIdentifier.itemIndex));
			}
		}

		public const int CloneCount = 3;

		public const int SlotLimit = 3;

		public const float Lifetime = 12f;

		public const float DamageMultiplier = 0.5f;

		public const float Cooldown = 40f;

		internal static readonly ManualLogSource Log = Logger.CreateLogSource("KangMod.Council");

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

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

		public static SkillDef Skill { get; private set; }

		public static ItemDef MarkerItem { get; private set; }

		public static DeployableSlot Slot { get; private set; }

		public static GameObject AiMaster { get; private set; }

		public static SkillDef Create(GameObject body)
		{
			//IL_0042: 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_0037: 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_0042: Expected O, but got Unknown
			//IL_0071: 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_007c: Expected O, but got Unknown
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)Skill))
			{
				return Skill;
			}
			SkillLocator component = body.GetComponent<SkillLocator>();
			MarkerItem = CreateMarker();
			object obj = <>c.<>9__24_0;
			if (obj == null)
			{
				GetDeployableSameSlotLimit val = (CharacterMaster master, int countMultiplier) => 3;
				<>c.<>9__24_0 = val;
				obj = (object)val;
			}
			Slot = DeployableAPI.RegisterDeployableSlot((GetDeployableSameSlotLimit)obj);
			KangPassives.RegisterVariantSlot(Slot);
			AiMaster = AltCouncilMaster.Create(body);
			object obj2 = <>O.<0>__ApplyDamagePenalty;
			if (obj2 == null)
			{
				StatHookEventHandler val2 = ApplyDamagePenalty;
				<>O.<0>__ApplyDamagePenalty = val2;
				obj2 = (object)val2;
			}
			RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj2;
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: 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)
				markerIndex = MarkerItem.itemIndex;
				ItemDef gummyCloneIdentifier = Items.GummyCloneIdentifier;
				gummyIndex = (ItemIndex)((!Object.op_Implicit((Object)(object)gummyCloneIdentifier)) ? (-1) : ((int)gummyCloneIdentifier.itemIndex));
			});
			SkillDef obj3 = Kang.NewSkill("KangCouncil", "KANG_SPECIAL_COUNCIL", typeof(AltCouncilSummon), "Weapon", Object.op_Implicit((Object)(object)component) ? component.special : null, (SkillDef)(object)ScriptableObject.CreateInstance<AltCouncilSkillDef>());
			obj3.baseRechargeInterval = 40f;
			obj3.interruptPriority = (InterruptPriority)2;
			obj3.mustKeyPress = true;
			obj3.cancelSprintingOnActivation = true;
			obj3.isCombatSkill = true;
			Skill = obj3;
			LanguageAPI.Add("KANG_SPECIAL_COUNCIL_NAME", "Council of Kangs");
			LanguageAPI.Add("KANG_SPECIAL_COUNCIL_DESC", "Summon <style=cIsUtility>3 Variants of yourself</style> from collapsing timelines for 12 seconds. They fight with your skills and <style=cIsUtility>carry your items</style>, but deal <style=cIsDamage>50% damage</style>.");
			LanguageAPI.Add("KANG_SPECIAL_COUNCIL_MARKER_NAME", "Council Variant");
			LanguageAPI.Add("KANG_SPECIAL_COUNCIL_MARKER_PICKUP", "Marks a temporary Variant summoned by Council of Kangs.");
			LanguageAPI.Add("KANG_SPECIAL_COUNCIL_MARKER_DESC", "Marks a temporary Variant summoned by Council of Kangs. It deals 50% damage and cannot call a council of its own.");
			LanguageAPI.Add("KANG_SPECIAL_COUNCIL_MARKER_LORE", "A Kang from a timeline that is already ending.");
			return obj3;
		}

		public static bool IsCouncilClone(CharacterBody body)
		{
			if (Object.op_Implicit((Object)(object)body))
			{
				return IsCouncilClone(body.inventory);
			}
			return false;
		}

		public static bool IsCouncilClone(Inventory inventory)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Invalid comparison between Unknown and I4
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)inventory) && (int)markerIndex != -1)
			{
				return inventory.GetItemCountPermanent(markerIndex) > 0;
			}
			return false;
		}

		internal static bool CanSummon(CharacterBody body)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Invalid comparison between Unknown and I4
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			Inventory val = (Object.op_Implicit((Object)(object)body) ? body.inventory : null);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return true;
			}
			if (IsCouncilClone(val))
			{
				return false;
			}
			if ((int)gummyIndex != -1)
			{
				return val.GetItemCountPermanent(gummyIndex) <= 0;
			}
			return true;
		}

		private static void ApplyDamagePenalty(CharacterBody body, StatHookEventArgs args)
		{
			if (IsCouncilClone(body))
			{
				args.damageTotalMult *= 0.5f;
			}
		}

		private static ItemDef CreateMarker()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			ItemDef val = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC1/GummyClone/GummyCloneIdentifier.asset").WaitForCompletion();
			ItemDef val2;
			if (Object.op_Implicit((Object)(object)val))
			{
				val2 = Object.Instantiate<ItemDef>(val);
			}
			else
			{
				Log.LogWarning((object)"GummyCloneIdentifier template missing; building the marker by hand.");
				val2 = ScriptableObject.CreateInstance<ItemDef>();
				typeof(ItemDef).GetField("deprecatedTier", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(val2, (object)(ItemTier)5);
			}
			((Object)val2).name = "KangCouncilMarker";
			val2.nameToken = "KANG_SPECIAL_COUNCIL_MARKER_NAME";
			val2.pickupToken = "KANG_SPECIAL_COUNCIL_MARKER_PICKUP";
			val2.descriptionToken = "KANG_SPECIAL_COUNCIL_MARKER_DESC";
			val2.loreToken = "KANG_SPECIAL_COUNCIL_MARKER_LORE";
			val2.hidden = true;
			val2.canRemove = false;
			val2.unlockableDef = null;
			val2.requiredExpansion = null;
			ItemDef obj = val2;
			ItemTag[] array = new ItemTag[15];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			obj.tags = (ItemTag[])(object)array;
			ContentAddition.AddItemDef(val2);
			return val2;
		}
	}
	public class AltCouncilSkillDef : SkillDef
	{
		public override bool IsReady(GenericSkill skillSlot)
		{
			if (((SkillDef)this).IsReady(skillSlot))
			{
				return AltCouncil.CanSummon(skillSlot.characterBody);
			}
			return false;
		}
	}
	public class AltCouncilSummon : BaseSkillState
	{
		private const float BaseDuration = 0.5f;

		private float duration;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			duration = 0.5f / ((BaseState)this).attackSpeedStat;
			((EntityState)this).PlayAnimation("Gesture, Additive", "PrepWall", "PrepWall.playbackRate", duration, 0f);
			KangSfx.Play("Play_item_use_gateway_create", ((EntityState)this).gameObject);
			if (NetworkServer.active)
			{
				AltCouncilSpawn.SummonServer(((EntityState)this).characterBody);
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void OnExit()
		{
			((EntityState)this).PlayAnimation("Gesture, Additive", "FireWall");
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)1;
		}
	}
	internal static class AltCouncilMaster
	{
		internal static GameObject Create(GameObject body)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mage/MageMonsterMaster.prefab").WaitForCompletion(), "KangMonsterMaster", true);
			val.GetComponent<CharacterMaster>().bodyPrefab = body;
			AISkillDriver[] components = val.GetComponents<AISkillDriver>();
			for (int i = 0; i < components.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)components[i]);
			}
			AddDrivers(val);
			ContentAddition.AddMaster(val);
			return val;
		}

		private static void AddDrivers(GameObject m)
		{
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			AISkillDriver obj = Driver(m, "LeashToLeader", (SkillSlot)(-1), (TargetType)2, (MovementType)1, (AimType)1, 60f);
			obj.shouldSprint = true;
			obj.driverUpdateTimerOverride = 3f;
			AISkillDriver obj2 = Driver(m, "UtilityWhenHurt", (SkillSlot)2, (TargetType)0, (MovementType)2, (AimType)2);
			obj2.requireSkillReady = true;
			obj2.maxUserHealthFraction = 0.4f;
			obj2.maxUserTimeSinceDamaged = 1.5f;
			obj2.noRepeat = true;
			AISkillDriver obj3 = Driver(m, "Secondary", (SkillSlot)1, (TargetType)0, (MovementType)2, (AimType)2, 0f, 35f);
			obj3.requireSkillReady = true;
			obj3.selectionRequiresTargetLoS = true;
			obj3.activationRequiresAimConfirmation = true;
			obj3.buttonPressType = (ButtonPressType)2;
			obj3.noRepeat = true;
			AISkillDriver obj4 = Driver(m, "PrimaryStrafe", (SkillSlot)0, (TargetType)0, (MovementType)2, (AimType)2, 0f, 25f);
			obj4.selectionRequiresTargetLoS = true;
			obj4.activationRequiresAimConfirmation = true;
			obj4.buttonPressType = (ButtonPressType)0;
			AISkillDriver obj5 = Driver(m, "PrimaryChase", (SkillSlot)0, (TargetType)0, (MovementType)1, (AimType)2, 25f, 45f);
			obj5.selectionRequiresTargetLoS = true;
			obj5.activationRequiresAimConfirmation = true;
			obj5.buttonPressType = (ButtonPressType)0;
			Driver(m, "ChaseEnemy", (SkillSlot)(-1), (TargetType)0, (MovementType)1, (AimType)1).shouldSprint = true;
			Driver(m, "ReturnToLeader", (SkillSlot)(-1), (TargetType)2, (MovementType)1, (AimType)1, 15f).shouldSprint = true;
			Driver(m, "WaitNearLeader", (SkillSlot)(-1), (TargetType)2, (MovementType)0, (AimType)3);
		}

		private static AISkillDriver Driver(GameObject m, string name, SkillSlot slot, TargetType target, MovementType move, AimType aim, float minDistance = 0f, float maxDistance = float.PositiveInfinity)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: 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_0026: Unknown result type (might be due to invalid IL or missing references)
			AISkillDriver obj = m.AddComponent<AISkillDriver>();
			obj.customName = name;
			obj.skillSlot = slot;
			obj.moveTargetType = target;
			obj.movementType = move;
			obj.aimType = aim;
			obj.minDistance = minDistance;
			obj.maxDistance = maxDistance;
			return obj;
		}
	}
	internal static class AltCouncilSpawn
	{
		private const float RingRadius = 3f;

		private const float MaxDrop = 3f;

		internal static void SummonServer(CharacterBody summoner)
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: 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_009b: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				return;
			}
			CharacterMaster val = (Object.op_Implicit((Object)(object)summoner) ? summoner.master : null);
			if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)AltCouncil.AiMaster) || !Object.op_Implicit((Object)(object)DirectorCore.instance) || !Object.op_Implicit((Object)(object)Run.instance) || !AltCouncil.CanSummon(summoner))
			{
				return;
			}
			Xoroshiro128Plus rng = new Xoroshiro128Plus(Run.instance.seed + (ulong)Run.instance.fixedTime);
			Vector3 val2 = Vector3.ProjectOnPlane(Object.op_Implicit((Object)(object)summoner.inputBank) ? summoner.inputBank.aimDirection : ((Component)summoner).transform.forward, Vector3.up);
			if (((Vector3)(ref val2)).sqrMagnitude < 0.01f)
			{
				val2 = ((Component)summoner).transform.forward;
			}
			Quaternion val3 = Quaternion.LookRotation(((Vector3)(ref val2)).normalized);
			float y = ((Quaternion)(ref val3)).eulerAngles.y;
			Quaternion facing = Quaternion.Euler(0f, y, 0f);
			int num = 0;
			for (int i = 0; i < 3; i++)
			{
				float angle = y + 90f * (float)(i + 1);
				if (SpawnOne(summoner, val, RingSpot(summoner, angle), facing, rng))
				{
					num++;
				}
			}
			if (num < 3)
			{
				AltCouncil.Log.LogWarning((object)$"Council of Kangs spawned {num}/{3} Variants (no valid ground near the caster).");
			}
		}

		private static Vector3? RingSpot(CharacterBody summoner, float angle)
		{
			//IL_0001: 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_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: 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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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_006b: 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)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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)
			Vector3 corePosition = summoner.corePosition;
			Vector3 val = Quaternion.Euler(0f, angle, 0f) * Vector3.forward;
			float num = 3f;
			float num2 = num;
			LayerIndex world = LayerIndex.world;
			RaycastHit val2 = default(RaycastHit);
			if (Physics.SphereCast(corePosition, 0.5f, val, ref val2, num2, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1))
			{
				num = Mathf.Max(0f, ((RaycastHit)(ref val2)).distance - 0.5f);
			}
			Vector3 val3 = corePosition + val * num + Vector3.up;
			float num3 = val3.y - summoner.footPosition.y + 3f;
			Vector3 down = Vector3.down;
			world = LayerIndex.world;
			RaycastHit val4 = default(RaycastHit);
			if (Physics.Raycast(val3, down, ref val4, num3, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1))
			{
				return ((RaycastHit)(ref val4)).point;
			}
			return null;
		}

		private static bool SpawnOne(CharacterBody summoner, CharacterMaster owner, Vector3? spot, Quaternion facing, Xoroshiro128Plus rng)
		{
			//IL_0049: 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_0050: 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_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			//IL_002f: 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_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			AltCouncilSpawnCard altCouncilSpawnCard = AltCouncilSpawnCard.FromOwner(owner, AltCouncil.AiMaster);
			if (!Object.op_Implicit((Object)(object)altCouncilSpawnCard))
			{
				return false;
			}
			try
			{
				((MasterCopySpawnCard)altCouncilSpawnCard).GiveItem(AltCouncil.MarkerItem, 1);
				if (spot.HasValue && TrySpawn((SpawnCard)(object)altCouncilSpawnCard, Direct(spot.Value, facing), summoner, owner, rng))
				{
					return true;
				}
				DirectorPlacementRule rule = new DirectorPlacementRule
				{
					placementMode = (PlacementMode)1,
					spawnOnTarget = ((Component)summoner).transform,
					minDistance = 2f,
					maxDistance = 12f
				};
				if (TrySpawn((SpawnCard)(object)altCouncilSpawnCard, rule, summoner, owner, rng))
				{
					return true;
				}
				return TrySpawn((SpawnCard)(object)altCouncilSpawnCard, Direct(summoner.footPosition, facing), summoner, owner, rng);
			}
			finally
			{
				Object.Destroy((Object)(object)altCouncilSpawnCard);
			}
		}

		private static DirectorPlacementRule Direct(Vector3 position, Quaternion rotation)
		{
			//IL_0000: 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)
			//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_000d: Unknown result type (might be due to invalid IL or missing references)
			//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)
			//IL_0014: 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_001b: Expected O, but got Unknown
			return new DirectorPlacementRule
			{
				placementMode = (PlacementMode)6,
				position = position,
				rotation = rotation
			};
		}

		private static bool TrySpawn(SpawnCard card, DirectorPlacementRule rule, CharacterBody summoner, CharacterMaster owner, Xoroshiro128Plus rng)
		{
			//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_001d: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			DirectorSpawnRequest val = new DirectorSpawnRequest(card, rule, rng)
			{
				teamIndexOverride = owner.teamIndex,
				ignoreTeamMemberLimit = true,
				summonerBodyObject = ((Component)summoner).gameObject
			};
			val.onSpawnedServer = (Action<SpawnResult>)Delegate.Combine(val.onSpawnedServer, (Action<SpawnResult>)delegate(SpawnResult result)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				OnSpawnedServer(result, owner);
			});
			return Object.op_Implicit((Object)(object)DirectorCore.instance.TrySpawnObject(val));
		}

		private static void OnSpawnedServer(SpawnResult result, CharacterMaster owner)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: 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_002b: 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_0063: Expected O, but got Unknown
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: 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_00e3: Expected O, but got Unknown
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Expected O, but got Unknown
			if (!result.success || !Object.op_Implicit((Object)(object)result.spawnedInstance))
			{
				return;
			}
			CharacterMaster component = result.spawnedInstance.GetComponent<CharacterMaster>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			Deployable val = result.spawnedInstance.AddComponent<Deployable>();
			val.onUndeploy = (UnityEvent)(((object)val.onUndeploy) ?? ((object)new UnityEvent()));
			val.onUndeploy.AddListener(new UnityAction(component.TrueKill));
			if (Object.op_Implicit((Object)(object)owner))
			{
				owner.AddDeployable(val, AltCouncil.Slot);
			}
			result.spawnedInstance.AddComponent<MasterSuicideOnTimer>().lifeTimer = 12f;
			GameObject bodyObject = component.GetBodyObject();
			if (!Object.op_Implicit((Object)(object)bodyObject))
			{
				return;
			}
			CharacterBody component2 = bodyObject.GetComponent<CharacterBody>();
			if (Object.op_Implicit((Object)(object)component2) && Object.op_Implicit((Object)(object)KangVfx.RiftOpen))
			{
				EffectManager.SpawnEffect(KangVfx.RiftOpen, new EffectData
				{
					origin = component2.footPosition,
					rotation = Util.QuaternionSafeLookRotation(Vector3.up)
				}, true);
			}
			EntityStateMachine[] components = bodyObject.GetComponents<EntityStateMachine>();
			foreach (EntityStateMachine val2 in components)
			{
				if (!(val2.customName != "Body"))
				{
					val2.SetState((EntityState)new GummyCloneSpawnState());
					break;
				}
			}
		}
	}
	internal class AltCouncilSpawnCard : MasterCopySpawnCard
	{
		internal static AltCouncilSpawnCard FromOwner(CharacterMaster owner, GameObject aiMasterPrefab)
		{
			if (!Object.op_Implicit((Object)(object)owner) || !Object.op_Implicit((Object)(object)owner.GetBody()) || !Object.op_Implicit((Object)(object)aiMasterPrefab))
			{
				return null;
			}
			AltCouncilSpawnCard altCouncilSpawnCard = ScriptableObject.CreateInstance<AltCouncilSpawnCard>();
			((MasterCopySpawnCard)altCouncilSpawnCard).onPreSpawnSetup = UseOwnerLevel;
			MasterCopySpawnCard.CopyDataFromMaster((MasterCopySpawnCard)(object)altCouncilSpawnCard, owner, true, false);
			((SpawnCard)altCouncilSpawnCard).prefab = aiMasterPrefab;
			altCouncilSpawnCard.StripItems();
			return altCouncilSpawnCard;
		}

		private void StripItems()
		{
			//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_0037: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: 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_00ba: 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 (base.srcItemStacks == null)
			{
				return;
			}
			ItemIndex val = (ItemIndex)((!Object.op_Implicit((Object)(object)Items.ExtraLife)) ? (-1) : ((int)Items.ExtraLife.itemIndex));
			ItemIndex val2 = (ItemIndex)((!Object.op_Implicit((Object)(object)Items.ExtraLifeVoid)) ? (-1) : ((int)Items.ExtraLifeVoid.itemIndex));
			for (int i = 0; i < base.srcItemStacks.Length; i++)
			{
				if (base.srcItemStacks[i] == 0 && (base.srcRentalItemStacks == null || i >= base.srcRentalItemStacks.Length || base.srcRentalItemStacks[i] == 0) && (base.srcTempItemRawValues == null || i >= base.srcTempItemRawValues.Length || base.srcTempItemRawValues[i] == 0f))
				{
					continue;
				}
				ItemIndex val3 = (ItemIndex)i;
				ItemDef itemDef = ItemCatalog.GetItemDef(val3);
				if (!Object.op_Implicit((Object)(object)itemDef) || itemDef.ContainsTag((ItemTag)13) || val3 == val || val3 == val2)
				{
					base.srcItemStacks[i] = 0;
					if (base.srcRentalItemStacks != null && i < base.srcRentalItemStacks.Length)
					{
						base.srcRentalItemStacks[i] = 0;
					}
					if (base.srcTempItemRawValues != null && i < base.srcTempItemRawValues.Length)
					{
						base.srcTempItemRawValues[i] = 0f;
					}
				}
			}
		}

		private static void UseOwnerLevel(CharacterMaster spawned)
		{
			//IL_002b: 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)
			Inventory val = (Object.op_Implicit((Object)(object)spawned) ? spawned.inventory : null);
			ItemDef useAmbientLevel = Items.UseAmbientLevel;
			if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)useAmbientLevel))
			{
				int itemCountPermanent = val.GetItemCountPermanent(useAmbientLevel.itemIndex);
				if (itemCountPermanent > 0)
				{
					val.RemoveItemPermanent(useAmbientLevel.itemIndex, itemCountPermanent);
				}
			}
		}
	}
	public static class AltEchoShot
	{
		public const float BaseDuration = 0.6f;

		public const float DamageCoefficient = 2f;

		public const float ProcCoefficient = 1f;

		public const float Force = 200f;

		public const float EchoDelay = 1f;

		public const float EchoDamageCoefficient = 0.8f;

		public const float EchoProcCoefficient = 0.5f;

		public const float EchoForce = 100f;

		public const float Range = 200f;

		public const float BulletRadius = 0.3f;

		internal static GameObject shotTracer;

		internal static GameObject echoTracer;

		internal static GameObject hitEffect;

		internal static GameObject muzzleFlash;

		internal static GameObject echoFlash;

		private static bool assetsBuilt;

		public static SkillDef Create(GameObject body)
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			BuildAssets();
			SkillLocator val = (Object.op_Implicit((Object)(object)body) ? body.GetComponent<SkillLocator>() : null);
			SteppedSkillDef val2 = ScriptableObject.CreateInstance<SteppedSkillDef>();
			val2.stepCount = 2;
			val2.stepGraceDuration = 0.1f;
			SkillDef obj = Kang.NewSkill("KangEchoShot", "KANG_PRIMARY_ECHO", typeof(EchoShotFire), "Weapon", Object.op_Implicit((Object)(object)val) ? val.primary : null, (SkillDef)(object)val2);
			obj.baseRechargeInterval = 0f;
			obj.interruptPriority = (InterruptPriority)0;
			obj.mustKeyPress = false;
			obj.cancelSprintingOnActivation = true;
			obj.isCombatSkill = true;
			LanguageAPI.Add("KANG_PRIMARY_ECHO_NAME", "Echo Shot");
			LanguageAPI.Add("KANG_PRIMARY_ECHO_DESC", "Fire a quantum shot for <style=cIsDamage>200% damage</style>. One second later, an <style=cIsUtility>echo</style> fires from where you stood at what you are aiming at now, for <style=cIsDamage>80%</style>.");
			return obj;
		}

		private static void BuildAssets()
		{
			//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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			if (!assetsBuilt)
			{
				assetsBuilt = true;
				KangVfx.Init();
				shotTracer = KangVfx.Effect("EchoShotTracer", "RoR2/Base/Engi/TracerEngiTurret.prefab", KangVfx.Amber, KangVfx.Gold);
				echoTracer = KangVfx.Effect("EchoShotEchoTracer", "RoR2/Base/Engi/TracerEngiTurret.prefab", KangVfx.Gold, Color.white);
				hitEffect = KangVfx.TemporalImpact;
				muzzleFlash = KangVfx.TemporalMuzzleFlash;
				echoFlash = KangVfx.WithSound(KangVfx.TemporalMuzzleFlash, "KangEchoShotEchoFlash", "Play_lunar_wisp_attack1_shoot_bullet");
			}
		}
	}
	public class EchoShotFire : BaseSkillState, IStepSetter
	{
		private int step;

		private float duration;

		public void SetStep(int i)
		{
			step = i;
		}

		public override void OnEnter()
		{
			//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_0035: 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_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: 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_01aa: 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_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: 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)
			((BaseState)this).OnEnter();
			duration = 0.6f / ((BaseState)this).attackSpeedStat;
			string text = ((step == 0) ? "MuzzleLeft" : "MuzzleRight");
			Ray aimRay = ((BaseState)this).GetAimRay();
			((BaseState)this).StartAimMode(aimRay, 2f, false);
			KangSfx.Play("Play_moonBrother_m1_laser_shoot", ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat);
			((EntityState)this).PlayAnimation((step == 0) ? "Gesture Left, Additive" : "Gesture Right, Additive", (step == 0) ? "FireGauntletLeft" : "FireGauntletRight", "FireGauntlet.playbackRate", duration, 0f);
			((EntityState)this).PlayAnimation("Gesture, Additive", "HoldGauntletsUp", "FireGauntlet.playbackRate", duration, 0f);
			((EntityState)this).GetComponent<KangSeq>()?.Play((step == 0) ? "EchoLeft" : "EchoRight", ((BaseState)this).attackSpeedStat);
			if (Object.op_Implicit((Object)(object)AltEchoShot.muzzleFlash))
			{
				EffectManager.SimpleMuzzleFlash(AltEchoShot.muzzleFlash, ((EntityState)this).gameObject, text, false);
			}
			((BaseState)this).AddRecoil(-0.4f, -0.8f, -0.3f, 0.3f);
			if (((EntityState)this).isAuthority)
			{
				new BulletAttack
				{
					owner = ((EntityState)this).gameObject,
					weapon = ((EntityState)this).gameObject,
					origin = ((Ray)(ref aimRay)).origin,
					aimVector = ((Ray)(ref aimRay)).direction,
					maxDistance = 200f,
					radius = 0.3f,
					smartCollision = true,
					damage = ((BaseState)this).damageStat * 2f,
					procCoefficient = 1f,
					force = 200f,
					isCrit = ((BaseState)this).RollCrit(),
					falloffModel = (FalloffModel)0,
					damageType = new DamageTypeCombo
					{
						damageType = (DamageType)0,
						damageTypeExtended = (DamageTypeExtended)0,
						damageSource = (DamageSource)1
					},
					muzzleName = text,
					tracerEffectPrefab = AltEchoShot.shotTracer,
					hitEffectPrefab = AltEchoShot.hitEffect
				}.Fire();
				EchoShotEchoes.Schedule(((EntityState)this).characterBody, aimRay, ((BaseState)this).damageStat * 0.8f);
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)1;
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			((BaseSkillState)this).OnSerialize(writer);
			writer.Write((byte)step);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			((BaseSkillState)this).OnDeserialize(reader);
			step = reader.ReadByte();
		}
	}
	public class EchoShotEchoes : MonoBehaviour
	{
		private struct Echo
		{
			public float time;

			public Vector3 origin;

			public Vector3 direction;

			public float damage;
		}

		private readonly Queue<Echo> pending = new Queue<Echo>();

		private CharacterBody body;

		public static void Schedule(CharacterBody body, Ray aim, float damage)
		{
			//IL_0055: 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_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.op_Implicit((Object)(object)body) && Util.HasEffectiveAuthority(((Component)body).gameObject))
			{
				EchoShotEchoes echoShotEchoes = ((Component)body).GetComponent<EchoShotEchoes>();
				if (!Object.op_Implicit((Object)(object)echoShotEchoes))
				{
					echoShotEchoes = ((Component)body).gameObject.AddComponent<EchoShotEchoes>();
				}
				echoShotEchoes.pending.Enqueue(new Echo
				{
					time = Time.fixedTime + 1f,
					origin = ((Ray)(ref aim)).origin,
					direction = ((Ray)(ref aim)).direction,
					damage = damage
				});
			}
		}

		private void Awake()
		{
			body = ((Component)this).GetComponent<CharacterBody>();
		}

		private void FixedUpdate()
		{
			if (pending.Count == 0)
			{
				return;
			}
			if (!Object.op_Implicit((Object)(object)body) || !Util.HasEffectiveAuthority(((Component)this).gameObject))
			{
				pending.Clear();
				return;
			}
			while (pending.Count > 0 && Time.fixedTime >= pending.Peek().time)
			{
				Echo e = pending.Dequeue();
				if (Object.op_Implicit((Object)(object)body.healthComponent) && body.healthComponent.alive)
				{
					Fire(e);
				}
			}
		}

		private void Fire(Echo e)
		{
			//IL_0036: 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_001f: 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_003b: 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_004a: 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_0053: 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)
			//IL_0062: 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_0071: 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_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: 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)
			//IL_009e: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: 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_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: 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_0102: 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_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: 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_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: 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_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: 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_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Expected O, but got Unknown
			//IL_01c2: 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_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: 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_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Expected O, but got Unknown
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: 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_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Expected O, but got Unknown
			Ray val = (Ray)(Object.op_Implicit((Object)(object)body.inputBank) ? body.inputBank.GetAimRay() : new Ray(e.origin, e.direction));
			GameObject gameObject = ((Component)this).gameObject;
			Ray val2 = val;
			LayerIndex val3 = LayerIndex.world;
			int num = LayerMask.op_Implicit(((LayerIndex)(ref val3)).mask);
			val3 = LayerIndex.entityPrecise;
			RaycastHit val5 = default(RaycastHit);
			Vector3 val4 = (Util.CharacterRaycast(gameObject, val2, ref val5, 200f, LayerMask.op_Implicit(num | LayerMask.op_Implicit(((LayerIndex)(ref val3)).mask)), (QueryTriggerInteraction)1) ? ((RaycastHit)(ref val5)).point : ((Ray)(ref val)).GetPoint(200f)) - e.origin;
			val4 = ((((Vector3)(ref val4)).sqrMagnitude > 0.01f) ? ((Vector3)(ref val4)).normalized : e.direction);
			Vector3 end = e.origin + val4 * 200f;
			new BulletAttack
			{
				owner = ((Component)this).gameObject,
				weapon = ((Component)this).gameObject,
				origin = e.origin,
				aimVector = val4,
				maxDistance = 200f,
				radius = 0.3f,
				smartCollision = true,
				damage = e.damage,
				procCoefficient = 0.5f,
				force = 100f,
				isCrit = body.RollCrit(),
				falloffModel = (FalloffModel)0,
				damageType = new DamageTypeCombo
				{
					damageType = (DamageType)0,
					damageTypeExtended = (DamageTypeExtended)0,
					damageSource = (DamageSource)1
				},
				hitEffectPrefab = AltEchoShot.hitEffect,
				allowTrajectoryAimAssist = false,
				hitCallback = (HitCallback)delegate(BulletAttack b, ref BulletHit hit)
				{
					//IL_0012: Unknown result type (might be due to invalid IL or missing references)
					//IL_0017: Unknown result type (might be due to invalid IL or missing references)
					bool num2 = BulletAttack.defaultHitCallback.Invoke(b, ref hit);
					if (!num2)
					{
						end = hit.point;
					}
					return num2;
				}
			}.Fire();
			if (Object.op_Implicit((Object)(object)AltEchoShot.echoFlash))
			{
				EffectManager.SpawnEffect(AltEchoShot.echoFlash, new EffectData
				{
					origin = e.origin,
					rotation = Util.QuaternionSafeLookRotation(val4)
				}, true);
			}
			if (Object.op_Implicit((Object)(object)AltEchoShot.echoTracer))
			{
				EffectManager.SpawnEffect(AltEchoShot.echoTracer, new EffectData
				{
					origin = end,
					start = e.origin
				}, true);
			}
		}
	}
	public static class AltPuppet
	{
		public static IEnumerable<HurtBox> FindEnemies(CharacterBody viewer, Vector3 origin, Vector3 direction, float range, float halfAngle)
		{
			//IL_0000: 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)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//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)
			//IL_0014: 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)
			//IL_0021: 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_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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: 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_004d: 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_0060: 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)
			BullseyeSearch val = new BullseyeSearch
			{
				viewer = viewer,
				searchOrigin = origin,
				searchDirection = direction,
				maxDistanceFilter = range,
				maxAngleFilter = halfAngle,
				teamMaskFilter = TeamMask.GetEnemyTeams(viewer.teamComponent.teamIndex),
				filterByLoS = true,
				filterByDistinctEntity = true,
				sortMode = (SortMode)((!(halfAngle < 180f)) ? 1 : 2)
			};
			val.RefreshCandidates();
			val.FilterOutGameObject(((Component)viewer).gameObject);
			return from h in val.GetResults()
				where Object.op_Implicit((Object)(object)h.healthComponent) && h.healthComponent.alive && Object.op_Implicit((Object)(object)h.healthComponent.body)
				select h;
		}

		public static void Hit(HealthComponent victim, GameObject attacker, float damage, float procCoefficient, bool crit, DamageSource source, Vector3 position)
		{
			//IL_0018: 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_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_003a: 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_003d: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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_0051: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			if (NetworkServer.active && Object.op_Implicit((Object)(object)victim) && victim.alive)
			{
				DamageInfo val = new DamageInfo
				{
					attacker = attacker,
					inflictor = attacker,
					damage = damage,
					crit = crit,
					position = position,
					procCoefficient = procCoefficient,
					damageType = DamageTypeCombo.op_Implicit(source),
					damageColorIndex = (DamageColorIndex)0
				};
				victim.TakeDamage(val);
				GlobalEventManager.instance.OnHitEnemy(val, ((Component)victim).gameObject);
				GlobalEventManager.instance.OnHitAll(val, ((Component)victim).gameObject);
			}
		}

		public static bool RollCrit(GameObject attacker)
		{
			CharacterBody val = (Object.op_Implicit((Object)(object)attacker) ? attacker.GetComponent<CharacterBody>() : null);
			if (Object.op_Implicit((Object)(object)val))
			{
				return val.RollCrit();
			}
			return false;
		}
	}
	public static class AltTimeLock
	{
		public const float DamageCoefficient = 3f;

		public const float ProcCoefficient = 1f;

		public const float BlastRadius = 8f;

		public const float LockDuration = 2.5f;

		public const float BacklashFraction = 0.3f;

		public const float Cooldown = 10f;

		public const float BaseFireDuration = 0.5f;

		public static readonly Color ChronoTint = new Color(0.35f, 0.9f, 1f, 1f);

		internal static GameObject orbPrefab;

		internal static GameObject muzzleFlash;

		private static bool initialized;

		public static ModdedDamageType TimeLockDamage { get; private set; }

		public static SkillDef Create(GameObject body)
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			Init();
			SkillLocator val = (Object.op_Implicit((Object)(object)body) ? body.GetComponent<SkillLocator>() : null);
			SkillDef val2 = Kang.NewSkill("KangTimeLock", "KANG_SECONDARY_TIMELOCK", typeof(TimeLockFire), "Weapon", Object.op_Implicit((Object)(object)val) ? val.secondary : null);
			val2.baseRechargeInterval = 10f;
			val2.interruptPriority = (InterruptPriority)1;
			val2.mustKeyPress = false;
			val2.cancelSprintingOnActivation = true;
			val2.isCombatSkill = true;
			val2.keywordTokens = new string[1] { "KANG_SECONDARY_TIMELOCK_KEYWORD" };
			return val2;
		}

		private static void Init()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			if (!initialized)
			{
				initialized = true;
				TimeLockedState.Init();
				TimeLockDamage = DamageAPI.ReserveDamageType();
				KangVfx.Init();
				muzzleFlash = KangVfx.MuzzleFlash;
				orbPrefab = BuildOrb();
				GlobalEventManager.onServerDamageDealt += OnServerDamageDealt;
				LanguageAPI.Add("KANG_SECONDARY_TIMELOCK_NAME", "Time-Lock");
				LanguageAPI.Add("KANG_SECONDARY_TIMELOCK_DESC", "Launch a chrono-orb for <style=cIsDamage>300% damage</style>. Enemies within 8m are <style=cIsUtility>Time-Locked</style> for 2.5s and <style=cIsHealth>executed below 30% health</style>. When the lock ends, they suffer <style=cIsDamage>30% of " + (KangBalance.V2 ? "the damage you and your summons dealt to them" : "all damage dealt to them") + "</style> again.");
				LanguageAPI.Add("KANG_SECONDARY_TIMELOCK_KEYWORD", "<style=cKeywordName>Time-Locked</style><style=cSub>Cannot move or act, and is <style=cIsHealth>executed below 30% health</style>. Bosses and enemies that cannot be frozen are <style=cIsUtility>slowed by 60%</style> instead, but still suffer the backlash.</style>");
			}
		}

		internal static GameObject Load(string key)
		{
			//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)
			return Addressables.LoadAssetAsync<GameObject>((object)key).WaitForCompletion();
		}

		private static GameObject BuildOrb()
		{
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: 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_016d: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = PrefabAPI.InstantiateClone(Load("RoR2/Base/Mage/MageLightningboltBasic.prefab"), "KangTimeLockOrb", true);
			ProjectileSingleTargetImpact[] components = val.GetComponents<ProjectileSingleTargetImpact>();
			for (int i = 0; i < components.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)components[i]);
			}
			ProjectileOverlapAttack[] components2 = val.GetComponents<ProjectileOverlapAttack>();
			for (int i = 0; i < components2.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)components2[i]);
			}
			ProjectileProximityBeamController[] components3 = val.GetComponents<ProjectileProximityBeamController>();
			for (int i = 0; i < components3.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)components3[i]);
			}
			ProjectileImpactExplosion val2 = val.GetComponent<ProjectileImpactExplosion>();
			if (!Object.op_Implicit((Object)(object)val2))
			{
				val2 = val.AddComponent<ProjectileImpactExplosion>();
				val2.lifetime = 3f;
			}
			val2.impactEffect = KangVfx.ChronoBlast;
			((ProjectileExplosion)val2).blastRadius = 8f;
			((ProjectileExplosion)val2).blastDamageCoefficient = 1f;
			((ProjectileExplosion)val2).blastProcCoefficient = 1f;
			((ProjectileExplosion)val2).falloffModel = (FalloffModel)0;
			val2.destroyOnEnemy = true;
			val2.destroyOnWorld = true;
			val2.impactOnWorld = true;
			((ProjectileExplosion)val2).fireChildren = false;
			((ProjectileExplosion)val2).childrenCount = 0;
			((ProjectileExplosion)val2).applyDot = false;
			if (((ProjectileExplosion)val2).timedDebuffs != null)
			{
				((ProjectileExplosion)val2).timedDebuffs.Clear();
			}
			ProjectileController component = val.GetComponent<ProjectileController>();
			component.procCoefficient = 1f;
			KangVfx.SetFlightLoop(component, "Play_lunar_wisp_attack2_aliveLoop", "Stop_lunar_wisp_attack2_aliveLoop");
			GameObject val3 = Load("RoR2/Base/LunarWisp/LunarWispTrackingBombGhost.prefab");
			if (Object.op_Implicit((Object)(object)val3))
			{
				val3 = PrefabAPI.InstantiateClone(val3, "KangTimeLockOrbGhost", false);
				KangVfx.Tint(val3, ChronoTint, Color.Lerp(ChronoTint, Color.white, 0.6f));
				component.ghostPrefabAddress = new AssetReferenceT<GameObject>("");
				component.ghostPrefab = val3;
			}
			ContentAddition.AddProjectile(val);
			Debug.Log((object)("[KangAlt] TimeLock orb: components=[" + string.Join(",", from c in val.GetComponents<Component>()
				select ((object)c).GetType().Name) + "] " + string.Format("lifetime={0} impactEffect={1} ghost={2}", val2.lifetime, Object.op_Implicit((Object)(object)val2.impactEffect) ? ((Object)val2.impactEffect).name : "none", Object.op_Implicit((Object)(object)val3) ? ((Object)val3).name : "none")));
			return val;
		}

		private static void OnServerDamageDealt(DamageReport report)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			DamageInfo damageInfo = report.damageInfo;
			if (damageInfo != null && DamageAPI.HasModdedDamageType(damageInfo, TimeLockDamage))
			{
				CharacterBody victimBody = report.victimBody;
				if (Object.op_Implicit((Object)(object)victimBody) && Object.op_Implicit((Object)(object)report.victim) && report.victim.alive)
				{
					TimeLockedState.Apply(victimBody, report.attacker, 2.5f, 0.3f, damageInfo);
				}
			}
		}

		internal static Material RecolorMaterial(Material source, Color tint)
		{
			//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_001d: Expected O, but got Unknown
			//IL_0049: 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_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			Material val = new Material(source)
			{
				name = ((Object)source).name + " (Kang)"
			};
			string[] array = new string[2] { "_TintColor", "_Color" };
			foreach (string text in array)
			{
				if (val.HasProperty(text))
				{
					val.SetColor(text, Keep(val.GetColor(text), tint));
				}
			}
			if (val.HasProperty("_RemapTex") && Object.op_Implicit((Object)(object)val.GetTexture("_RemapTex")))
			{
				val.SetTexture("_RemapTex", (Texture)(object)Ramp(tint));
			}
			return val;
		}

		private static Color Keep(Color original, Color tint)
		{
			//IL_0012: 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_0022: 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)
			//IL_0030: 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)
			float num = Mathf.Max(1f, ((Color)(ref original)).maxColorComponent);
			return new Color(tint.r * num, tint.g * num, tint.b * num, original.a * tint.a);
		}

		private static Texture2D Ramp(Color tint)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: 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_001c: Expected O, but got Unknown
			//IL_0029: 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_0035: 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_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(256, 1, (TextureFormat)4, false)
			{
				wrapMode = (TextureWrapMode)1,
				filterMode = (FilterMode)1
			};
			Color[] array = (Color[])(object)new Color[256];
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(tint.r, tint.g, tint.b, 1f);
			for (int i = 0; i < 256; i++)
			{
				float num = (float)i / 255f;
				array[i] = ((num < 0.5f) ? Color.Lerp(new Color(0f, 0f, 0f, 0f), val2, num * 2f) : Color.Lerp(val2, Color.white, (num - 0.5f) * 2f));
			}
			val.SetPixels(array);
			val.Apply(false, true);
			return val;
		}
	}
	public class TimeLockBacklash : MonoBehaviour
	{
		private static readonly Dictionary<HealthComponent, TimeLockBacklash> armed = new Dictionary<HealthComponent, TimeLockBacklash>();

		private static bool initialized;

		private HealthComponent victim;

		private GameObject attacker;

		private CharacterMaster lockerMaster;

		private float fraction;

		private float endTime;

		private float stored;

		private DamageInfo exclude;

		private bool released;

		public static void Init()
		{
			if (!initialized)
			{
				initialized = true;
				GlobalEventManager.onServerDamageDealt += OnServerDamageDealt;
			}
		}

		public static TimeLockBacklash Begin(CharacterBody victimBody, GameObject attacker, float duration, float fraction, DamageInfo exclude = null)
		{
			if (!NetworkServer.active || !Object.op_Implicit((Object)(object)victimBody) || !Object.op_Implicit((Object)(object)victimBody.healthComponent))
			{
				return null;
			}
			Init();
			TimeLockBacklash timeLockBacklash = ((Component)victimBody).GetComponent<TimeLockBacklash>();
			if (!Object.op_Implicit((Object)(object)timeLockBacklash) || timeLockBacklash.released)
			{
				timeLockBacklash = ((Component)victimBody).gameObject.AddComponent<TimeLockBacklash>();
			}
			timeLockBacklash.victim = victimBody.healthComponent;
			if (Object.op_Implicit((Object)(object)attacker))
			{
				timeLockBacklash.attacker = attacker;
				CharacterBody component = attacker.GetComponent<CharacterBody>();
				timeLockBacklash.lockerMaster = (Object.op_Implicit((Object)(object)component) ? component.master : null);
			}
			timeLockBacklash.fraction = Mathf.Max(timeLockBacklash.fraction, fraction);
			timeLockBacklash.endTime = Mathf.Max(timeLockBacklash.endTime, Time.fixedTime + duration);
			timeLockBacklash.exclude = exclude;
			armed[timeLockBacklash.victim] = timeLockBacklash;
			return timeLockBacklash;
		}

		private static void OnServerDamageDealt(DamageReport report)
		{
			if (armed.Count != 0 && Object.op_Implicit((Object)(object)report.victim) && armed.TryGetValue(report.victim, out var value) && Object.op_Implicit((Object)(object)value) && !value.released && report.damageInfo != value.exclude && (!KangBalance.V2 || value.FromLocker(report)))
			{
				value.stored += report.damageDealt;
			}
		}

		private bool FromLocker(DamageReport report)
		{
			if (!Object.op_Implicit((Object)(object)attacker))
			{
				return false;
			}
			if ((Object)(object)report.attacker == (Object)(object)attacker)
			{
				return true;
			}
			CharacterMaster attackerMaster = report.attackerMaster;
			if (Object.op_Implicit((Object)(object)lockerMaster) && Object.op_Implicit((Object)(object)attackerMaster) && Object.op_Implicit((Object)(object)attackerMaster.minionOwnership))
			{
				return (Object)(object)attackerMaster.minionOwnership.ownerMaster == (Object)(object)lockerMaster;
			}
			return false;
		}

		private void FixedUpdate()
		{
			if (!NetworkServer.active)
			{
				Object.Destroy((Object)(object)this);
			}
			else if (!released && Time.fixedTime >= endTime)
			{
				Release();
			}
		}

		private void Release()
		{
			//IL_006f: 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)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: 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_00d2: 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_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_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Expected O, but got Unknown
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Expected O, but got Unknown
			released = true;
			float num = stored * fraction;
			if (Object.op_Implicit((Object)(object)victim) && victim.alive && num > 0f)
			{
				Vector3 val = (Object.op_Implicit((Object)(object)victim.body) ? victim.body.corePosition : ((Component)victim).transform.position);
				victim.TakeDamage(new DamageInfo
				{
					damage = num,
					attacker = attacker,
					inflictor = attacker,
					position = val,
					force = Vector3.zero,
					crit = false,
					procCoefficient = 0f,
					procChainMask = default(ProcChainMask),
					damageType = new DamageTypeCombo
					{
						damageType = (DamageType)66,
						damageTypeExtended = (DamageTypeExtended)262144
					},
					damageColorIndex = (DamageColorIndex)15
				});
				if (Object.op_Implicit((Object)(object)TimeLockedState.lockEffectPrefab))
				{
					EffectManager.SpawnEffect(TimeLockedState.lockEffectPrefab, new EffectData
					{
						origin = val,
						scale = (Object.op_Implicit((Object)(object)victim.body) ? (victim.body.radius * 2f) : 2f)
					}, true);
				}
			}
			Object.Destroy((Object)(object)this);
		}

		private void OnDestroy()
		{
			if (victim != null && armed.TryGetValue(victim, out var value) && value == this)
			{
				armed.Remove(victim);
			}
		}
	}
	public class TimeLockedState : BaseState, ICustomState
	{
		public const float DefaultDuration = 2.5f;

		public static Material overlayMaterial;

		public static GameObject lockEffectPrefab;

		public static BuffDef lockedBuff;

		public float lockDuration = 2.5f;

		public GameObject attacker;

		private Animator modelAnimator;

		private TemporaryOverlayInstance overlay;

		private static bool initialized;

		private static EntityStateIndex stateIndex = (EntityStateIndex)(-1);

		public static EntityStateIndex StateIndex
		{
			get
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Invalid comparison between Unknown and I4
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				if ((int)stateIndex == -1)
				{
					stateIndex = EntityStateCatalog.GetStateIndex(typeof(TimeLockedState));
				}
				return stateIndex;
			}
		}

		public static void Init()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: 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)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			if (!initialized)
			{
				initialized = true;
				bool flag = default(bool);
				ContentAddition.AddEntityState(typeof(TimeLockedState), ref flag);
				Material val = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/VFX/matGhostEffect.mat").WaitForCompletion();
				overlayMaterial = (Object.op_Implicit((Object)(object)val) ? AltTimeLock.RecolorMaterial(val, AltTimeLock.ChronoTint) : null);
				KangVfx.Init();
				lockEffectPrefab = KangVfx.ChronoBlast;
				BuffDef val2 = Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/Base/Nullifier/bdNullified.asset").WaitForCompletion();
				lockedBuff = ScriptableObject.CreateInstance<BuffDef>();
				((Object)lockedBuff).name = "bdKangTimeLocked";
				lockedBuff.iconSprite = (Object.op_Implicit((Object)(object)val2) ? val2.iconSprite : null);
				lockedBuff.buffColor = AltTimeLock.ChronoTint;
				lockedBuff.canStack = false;
				lockedBuff.isDebuff = true;
				lockedBuff.flags = (Flags)1;
				ContentAddition.AddBuffDef(lockedBuff);
				TimeLockBacklash.Init();
			}
		}

		public static bool CanLock(CharacterBody victim)
		{
			if (!Object.op_Implicit((Object)(object)victim) || victim.isChampion || victim.isBoss)
			{
				return false;
			}
			SetStateOnHurt component = ((Component)victim).GetComponent<SetStateOnHurt>();
			if (Object.op_Implicit((Object)(object)component) && component.canBeFrozen)
			{
				return Object.op_Implicit((Object)(object)component.targetStateMachine);
			}
			return false;
		}

		public static bool TryLock(CharacterBody victim, GameObject attacker, float duration)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Invalid comparison between Unknown and I4
			//IL_0031: 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_004f: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active || !CanLock(victim) || (int)StateIndex == -1)
			{
				return false;
			}
			SetStateOnHurt component = ((Component)victim).GetComponent<SetStateOnHurt>();
			if (!component.targetStateMachine.CanInterruptState((InterruptPriority)7))
			{
				return false;
			}
			component.SetCustomState(StateIndex, (InterruptPriority)7, new CustomStateInfo
			{
				duration = duration,
				attacker = attacker
			});
			return true;
		}

		public static bool Apply(CharacterBody victim, GameObject attacker, float duration, float backlashFraction = 0f, DamageInfo excludeFromBacklash = null)
		{
			if (!NetworkServer.active || !Object.op_Implicit((Object)(object)victim) || !Object.op_Implicit((Object)(object)victim.healthComponent) || !victim.healthComponent.alive)
			{
				return false;
			}
			bool num = TryLock(victim, attacker, duration);
			if (!num && Object.op_Implicit((Object)(object)Buffs.Slow60))
			{
				victim.AddTimedBuff(Buffs.Slow60, duration);
			}
			if (Object.op_Implicit((Object)(object)lockedBuff))
			{
				victim.AddTimedBuff(lockedBuff, duration);
			}
			if (backlashFraction > 0f)
			{
				TimeLockBacklash.Begin(victim, attacker, duration, backlashFraction, excludeFromBacklash);
			}
			return num;
		}

		public void SetCustomInfo(CustomStateInfo info)
		{
			//IL_0000: 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_000e: Unknown result type (might be due to invalid IL or missing references)
			if (info.duration > 0f)
			{
				lockDuration = info.duration;
			}
			attacker = info.attacker;
		}

		public override void OnEnter()
		{
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			if (Object.op_Implicit((Object)(object)modelTransform) && Object.op_Implicit((Object)(object)overlayMaterial))
			{
				CharacterModel component = ((Component)modelTransform).GetComponent<CharacterModel>();
				if (Object.op_Implicit((Object)(object)component))
				{
					overlay = TemporaryOverlayManager.AddOverlay(((EntityState)this).gameObject);
					overlay.duration = lockDuration;
					overlay.originalMaterial = overlayMaterial;
					overlay.AddToCharacterModel(component);
				}
			}
			modelAnimator = ((EntityState)this).GetModelAnimator();
			if (Object.op_Implicit((Object)(object)modelAnimator))
			{
				((Behaviour)modelAnimator).enabled = false;
			}
			SpawnLockEffect();
			if (Object.op_Implicit((Object)(object)((EntityState)this).rigidbody) && !((EntityState)this).rigidbody.isKinematic)
			{
				((EntityState)this).rigidbody.velocity = Vector3.zero;
				if (Object.op_Implicit((Object)(object)((EntityState)this).rigidbodyMotor))
				{
					((EntityState)this).rigidbodyMotor.moveVector = Vector3.zero;
				}
			}
			((EntityState)this).healthComponent.isInFrozenState = true;
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection))
			{
				((EntityState)this).characterDirection.moveVector = ((EntityState)this).characterDirection.forward;
			}
		}

		public override void OnExit()
		{
			if (Object.op_Implicit((Object)(object)modelAnimator))
			{
				((Behaviour)modelAnimator).enabled = true;
			}
			if (overlay != null)
			{
				if (overlay.managerIndex >= 0)
				{
					TemporaryOverlayManager.RemoveOverlay(overlay.managerIndex);
				}
				else
				{
					overlay.Destroy();
				}
				overlay = null;
			}
			SpawnLockEffect();
			((EntityState)this).healthComponent.isInFrozenState = false;
			((EntityState)this).OnExit();
		}

		private void SpawnLockEffect()
		{
			//IL_001f: 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_002b: 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_004c: Expected O, but got Unknown
			if (Object.op_Implicit((Object)(object)lockEffectPrefab) && Object.op_Implicit((Object)(object)((EntityState)this).characterBody))
			{
				EffectManager.SpawnEffect(lockEffectPrefab, new EffectData
				{
					origin = ((EntityState)this).characterBody.corePosition,
					scale = ((EntityState)this).characterBody.radius
				}, false);
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= lockDuration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)7;
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			((EntityState)this).OnSerialize(writer);
			writer.Write(lockDuration);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			((EntityState)this).OnDeserialize(reader);
			lockDuration = reader.ReadSingle();
		}
	}
	public class TimeLockFire : BaseSkillState
	{
		private float duration;

		public override void OnEnter()
		{
			//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_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: 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_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			duration = 0.5f / ((BaseState)this).attackSpeedStat;
			Ray aimRay = ((BaseState)this).GetAimRay();
			((BaseState)this).StartAimMode(aimRay, 2f, false);
			KangSfx.Play("Play_lunar_wisp_attack2_launch", ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat);
			((EntityState)this).PlayAnimation("Gesture Right, Additive", "FireGauntletRight", "FireGauntlet.playbackRate", duration, 0f);
			((EntityState)this).PlayAnimation("Gesture, Additive", "HoldGauntletsUp", "FireGauntlet.playbackRate", duration, 0f);
			if (Object.op_Implicit((Object)(object)AltTimeLock.muzzleFlash))
			{
				EffectManager.SimpleMuzzleFlash(AltTimeLock.muzzleFlash, ((EntityState)this).gameObject, "MuzzleRight", false);
			}
			if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)AltTimeLock.orbPrefab))
			{
				DamageTypeCombo value = new DamageTypeCombo
				{
					damageType = (DamageType)0,
					damageTypeExtended = (DamageTypeExtended)0,
					damageSource = (DamageSource)2
				};
				DamageAPI.AddModdedDamageType(ref value, AltTimeLock.TimeLockDamage);
				ProjectileManager.instance.FireProjectile(new FireProjectileInfo
				{
					projectilePrefab = AltTimeLock.orbPrefab,
					position = ((Ray)(ref aimRay)).origin,
					rotation = Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction),
					owner = ((EntityState)this).gameObject,
					damage = ((BaseState)this).damageStat * 3f,
					force = 0f,
					crit = ((BaseState)this).RollCrit(),
					damageTypeOverride = value
				});
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)1;
		}
	}
	public static class AltVolley
	{
		public const float ConqueredDuration = 6f;

		public const float ConqueredThreshold = 0.45f;

		public const string ConqueredKeyword = "KANG_CONQUERED_KEYWORD";

		public static BuffDef Conquered { get; private set; }

		public static ModdedDamageType ConqueredDamage { get; private set; }

		public static SkillDef Create(GameObject body)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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_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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			/