Decompiled source of PlayableClayApothecary v1.0.0

PlayableApothecary.dll

Decompiled 5 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using EntityStates;
using EntityStates.ClayGrenadier;
using EntityStates.Merc;
using Grumpy;
using KinematicCharacterController;
using R2API;
using R2API.Utils;
using Rewired.ComponentControls.Effects;
using RoR2;
using RoR2.ExpansionManagement;
using RoR2.Navigation;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;

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

internal class Assets
{
	public static AssetBundle MainAssetBundle;

	public static T Load<T>(string name) where T : Object
	{
		return MainAssetBundle.LoadAsset<T>(name);
	}

	public static void PopulateAssets()
	{
		Assembly executingAssembly = Assembly.GetExecutingAssembly();
		if ((Object)(object)MainAssetBundle == (Object)null)
		{
			using (Stream stream = executingAssembly.GetManifestResourceStream("PlayableApothecary.AssetBundle." + "PlayableApothecary".ToLower() + "assets"))
			{
				MainAssetBundle = AssetBundle.LoadFromStream(stream);
			}
		}
	}
}
internal class Behaviour : HuntressTracker
{
	public SkillDef secondary1;

	public SkillDef secondary2;

	private NetworkedBodyAttachment attachment;

	private void Start()
	{
		((HuntressTracker)this).Start();
		if (NetworkServer.active)
		{
			attachment = Object.Instantiate<GameObject>(Prefabs.urnAttachmentPrefab).GetComponent<NetworkedBodyAttachment>();
			attachment.AttachToGameObjectAndSpawn(((Component)this).gameObject, (string)null);
		}
	}

	private void FixedUpdate()
	{
		((HuntressTracker)this).FixedUpdate();
		if (Input.GetKeyDown((KeyCode)108))
		{
			MainPlugin.config.Reload();
			Chat.AddMessage("Config reloaded.");
			base.maxTrackingDistance = MainPlugin.primary2Range.Value;
		}
	}

	private void OnDisable()
	{
		if (Object.op_Implicit((Object)(object)attachment))
		{
			Object.Destroy((Object)(object)((Component)attachment).gameObject);
		}
		((HuntressTracker)this).OnDisable();
	}
}
internal class CharacterSelectBehaviour : MonoBehaviour
{
	private BodyIndex bodyIndex;

	private CharacterSelectSurvivorPreviewDisplayController select;

	private Loadout currentLoadout = new Loadout();

	private uint lastPrimaryIndex;

	private uint lastSecondaryIndex;

	private bool set;

	private int primarySlotIndex = 0;

	private int secondarySlotIndex = 1;

	private void Start()
	{
		//IL_005f: 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_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		currentLoadout = Loadout.RequestInstance();
		select = ((Component)this).GetComponentInParent<CharacterSelectSurvivorPreviewDisplayController>();
		if (Object.op_Implicit((Object)(object)select))
		{
			NetworkUser.onLoadoutChangedGlobal += OnLoadoutChangedGlobal;
			select.networkUser.networkLoadout.CopyLoadout(currentLoadout);
			bodyIndex = BodyCatalog.FindBodyIndex("PlayableApothecaryBody");
			lastPrimaryIndex = currentLoadout.bodyLoadoutManager.GetSkillVariant(bodyIndex, primarySlotIndex);
			lastSecondaryIndex = currentLoadout.bodyLoadoutManager.GetSkillVariant(bodyIndex, secondarySlotIndex);
		}
	}

	private void OnLoadoutChangedGlobal(NetworkUser changedNetworkUser)
	{
		//IL_0051: 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_00cb: 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)
		if ((Object)(object)changedNetworkUser != (Object)(object)select.networkUser)
		{
			return;
		}
		if (set)
		{
			set = false;
			return;
		}
		changedNetworkUser.networkLoadout.CopyLoadout(currentLoadout);
		uint skillVariant = currentLoadout.bodyLoadoutManager.GetSkillVariant(bodyIndex, primarySlotIndex);
		uint num = currentLoadout.bodyLoadoutManager.GetSkillVariant(bodyIndex, secondarySlotIndex);
		if (lastPrimaryIndex != skillVariant)
		{
			Debug.LogWarning((object)"primary changed");
			lastPrimaryIndex = skillVariant;
			if (skillVariant == 1 && num == 1)
			{
				num = 0u;
				lastSecondaryIndex = 0u;
				currentLoadout.bodyLoadoutManager.SetSkillVariant(bodyIndex, secondarySlotIndex, lastSecondaryIndex);
				set = true;
			}
		}
		if (lastSecondaryIndex != num)
		{
			Debug.LogWarning((object)"secondary changed");
			lastSecondaryIndex = num;
			if (skillVariant == 1 && num == 1)
			{
				lastPrimaryIndex = 0u;
				currentLoadout.bodyLoadoutManager.SetSkillVariant(bodyIndex, primarySlotIndex, lastPrimaryIndex);
				set = true;
			}
		}
		if (set)
		{
			changedNetworkUser.localUser.userProfile.SetLoadout(currentLoadout);
		}
	}

	private void OnDisable()
	{
		if (Object.op_Implicit((Object)(object)select))
		{
			NetworkUser.onLoadoutChangedGlobal -= OnLoadoutChangedGlobal;
		}
	}
}
internal class DisplayBehaviour : MonoBehaviour
{
	private Animator animator;

	private void Awake()
	{
		animator = ((Component)this).GetComponent<Animator>();
	}

	private void Start()
	{
		animator.SetBool("isGrounded", true);
	}
}
internal class UrnTether : MonoBehaviour
{
	private TetherVfxOrigin tetherVfxOrigin;

	private NetworkedBodyAttachment attachment;

	private SphereSearch sphereSearch = new SphereSearch();

	private float stopwatch = 1f;

	private List<HurtBox> hurtboxes = new List<HurtBox>();

	private List<Transform> transforms = new List<Transform>();

	private void Awake()
	{
		attachment = ((Component)this).GetComponent<NetworkedBodyAttachment>();
		tetherVfxOrigin = ((Component)this).GetComponent<TetherVfxOrigin>();
	}

	private void FixedUpdate()
	{
		if (Object.op_Implicit((Object)(object)attachment.attachedBody))
		{
			stopwatch += Time.fixedDeltaTime;
			if (stopwatch >= 1f / MainPlugin.passiveTicks.Value / attachment.attachedBody.attackSpeed)
			{
				stopwatch = 0f;
				Tick();
			}
		}
	}

	private void Tick()
	{
		hurtboxes.Clear();
		transforms.Clear();
		SearchForTargets(hurtboxes);
		if (hurtboxes.Count > 0)
		{
			DamageTargets();
		}
		tetherVfxOrigin.SetTetheredTransforms(transforms);
	}

	protected void SearchForTargets(List<HurtBox> dest)
	{
		//IL_000c: 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_0022: 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_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: 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)
		sphereSearch.mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask;
		sphereSearch.origin = ((Component)this).transform.position;
		sphereSearch.radius = MainPlugin.passiveRadius.Value;
		sphereSearch.queryTriggerInteraction = (QueryTriggerInteraction)0;
		sphereSearch.RefreshCandidates();
		sphereSearch.FilterCandidatesByHurtBoxTeam(TeamMask.GetEnemyTeams(attachment.attachedBody.teamComponent.teamIndex));
		sphereSearch.OrderCandidatesByDistance();
		sphereSearch.FilterCandidatesByDistinctHurtBoxEntities();
		sphereSearch.FilterByLiveEntities();
		sphereSearch.GetHurtBoxes(dest);
		sphereSearch.ClearCandidates();
	}

	private void DamageTargets()
	{
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Expected O, but got Unknown
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: 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)
		foreach (HurtBox hurtbox in hurtboxes)
		{
			CharacterBody body = hurtbox.healthComponent.body;
			Transform val = (((Object)(object)body != (Object)null) ? body.coreTransform : null) ?? ((Component)hurtbox).transform;
			transforms.Add(val);
			if (NetworkServer.active)
			{
				DamageInfo val2 = new DamageInfo();
				val2.attacker = attachment.attachedBodyObject;
				val2.inflictor = ((Component)this).gameObject;
				val2.position = val.position;
				val2.crit = attachment.attachedBody.RollCrit();
				val2.damage = attachment.attachedBody.damage * MainPlugin.passiveDamageCoefficient.Value;
				val2.damageColorIndex = (DamageColorIndex)0;
				val2.force = Vector3.zero;
				val2.procCoefficient = 1f;
				val2.damageType = DamageTypeCombo.Generic | DamageTypeCombo.op_Implicit((DamageType)512);
				val2.procChainMask = default(ProcChainMask);
				hurtbox.healthComponent.TakeDamage(val2);
				attachment.attachedBody.healthComponent.Heal(val2.damage * MainPlugin.passiveHealCoefficient.Value, default(ProcChainMask), true);
			}
		}
	}

	private void OnDisable()
	{
	}
}
internal class CharacterBodySetup
{
	internal static GameObject baseBody = Prefabs.Load<GameObject>("RoR2/DLC1/ClayGrenadier/ClayGrenadierBody.prefab");

	internal static GameObject baseMaster = Prefabs.Load<GameObject>("RoR2/DLC1/ClayGrenadier/ClayGrenadierMaster.prefab");

	internal const string SURVIVORNAME = "Clay Apothecary";

	internal const string SURVIVORNAMEKEY = "PLAYABLEAPOTHECARY_";

	internal static Color characterColor = Color32.op_Implicit(new Color32((byte)51, (byte)23, (byte)23, byte.MaxValue));

	internal static void CreateCharacterBodies()
	{
		RegisterStates();
		CreateSurvivorPrefab();
	}

	internal static void CreateSurvivorPrefab()
	{
		//IL_0006: 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_0150: Expected O, but got Unknown
		//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_020f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0219: Unknown result type (might be due to invalid IL or missing references)
		//IL_024e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0258: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = CreateBodyPrefab("Clay Apothecary", characterColor, 200f);
		val.GetComponent<SetStateOnHurt>().canBeHitStunned = false;
		val.GetComponent<ExpansionRequirementComponent>().requireEntitlementIfPlayerControlled = true;
		Behaviour behaviour = val.AddComponent<Behaviour>();
		((HuntressTracker)behaviour).maxTrackingDistance = MainPlugin.primary2Range.Value;
		CharacterBody component = val.GetComponent<CharacterBody>();
		component.mainRootSpeed = 0f;
		component.baseMaxHealth = 160f;
		component.levelMaxHealth = 48f;
		component.baseRegen = 2.5f;
		component.levelRegen = 0.5f;
		component.baseMaxShield = 0f;
		component.levelMaxShield = 0f;
		component.baseMoveSpeed = 7f;
		component.levelMoveSpeed = 0f;
		component.baseAcceleration = 110f;
		component.baseJumpPower = 15f;
		component.levelJumpPower = 0f;
		component.baseDamage = 15f;
		component.levelDamage = 3f;
		component.baseAttackSpeed = 1f;
		component.levelAttackSpeed = 0f;
		component.baseCrit = 1f;
		component.levelCrit = 0f;
		component.baseArmor = 20f;
		component.levelArmor = 0f;
		component.baseJumpCount = 1;
		component.sprintingSpeedMultiplier = 1.45f;
		component.spreadBloomDecayTime = 0.7f;
		component.spreadBloomCurve = new AnimationCurve();
		component.spreadBloomCurve.AddKey(0.3506f, 0.0087f);
		component.spreadBloomCurve.AddKey(1f, 2f);
		val.GetComponent<HealthComponent>().health = component.baseMaxHealth;
		CapsuleCollider component2 = val.GetComponent<CapsuleCollider>();
		component2.radius = 0.75f;
		component2.height = 1.82f;
		KinematicCharacterMotor component3 = val.GetComponent<KinematicCharacterMotor>();
		component3.CapsuleRadius = component2.radius;
		component3.CapsuleHeight = component2.height;
		ModelLocator component4 = val.GetComponent<ModelLocator>();
		component4.modelBaseTransform.localPosition = Vector3.up * -1f;
		component4.modelBaseTransform.localScale = Vector3.one;
		Transform modelTransform = component4.modelTransform;
		modelTransform.localScale = Vector3.one * 2f;
		((Component)modelTransform).GetComponent<FootstepHandler>().footstepDustPrefab = Prefabs.Load<GameObject>("RoR2/Base/Common/VFX/GenericFootstepDust.prefab");
		Transform val2 = val.transform.Find("AimOrigin");
		val2.localPosition = Vector3.up * 0.7f;
		CreateSurvivorDef(val);
		PassiveSetup(val);
		PrimarySetup(val);
		SecondarySetup(val);
		UtilitySetup(val);
		SpecialSetup(val);
	}

	internal static void CreateSurvivorDef(GameObject characterPrefab)
	{
		//IL_0149: Unknown result type (might be due to invalid IL or missing references)
		//IL_014e: Unknown result type (might be due to invalid IL or missing references)
		CharacterBody component = characterPrefab.GetComponent<CharacterBody>();
		string text = ((Object)characterPrefab).name.Replace("Body", "");
		string text2 = text.Replace(" ", "").ToUpper();
		string text3 = " <style=cSub>\r\n\r\n< ! > \r\n\r\n< ! > \r\n\r\n< ! > \r\n\r\n< ! > \r\n\r\n";
		string text4 = "..and so it left.";
		string text5 = "..and so it vanished.";
		string text6 = "";
		LanguageAPI.Add("PLAYABLEAPOTHECARY_" + text2 + "_DESCRIPTION", text3);
		LanguageAPI.Add("PLAYABLEAPOTHECARY_" + text2 + "_SUBTITLE", "");
		LanguageAPI.Add("PLAYABLEAPOTHECARY_" + text2 + "_OUTRO", text4);
		LanguageAPI.Add("PLAYABLEAPOTHECARY_" + text2 + "_FAIL", text5);
		GameObject val = PrefabAPI.InstantiateClone(((Component)characterPrefab.GetComponent<ModelLocator>().modelBaseTransform).gameObject, text + "Display", false);
		val.AddComponent<CharacterSelectSurvivorPreviewDisplayController>().bodyPrefab = characterPrefab;
		val.AddComponent<CharacterSelectBehaviour>();
		HurtBoxGroup componentInChildren = val.GetComponentInChildren<HurtBoxGroup>();
		((Component)componentInChildren).gameObject.AddComponent<DisplayBehaviour>();
		Object.Destroy((Object)(object)componentInChildren);
		SurvivorDef val2 = ScriptableObject.CreateInstance<SurvivorDef>();
		val2.cachedName = "PLAYABLEAPOTHECARY_" + text2 + "_NAME";
		val2.unlockableDef = null;
		val2.descriptionToken = "PLAYABLEAPOTHECARY_" + text2 + "_DESCRIPTION";
		val2.primaryColor = component.bodyColor;
		val2.bodyPrefab = characterPrefab;
		val2.displayPrefab = val;
		val2.outroFlavorToken = "PLAYABLEAPOTHECARY_" + text2 + "_OUTRO";
		val2.desiredSortPosition = 22f;
		val2.mainEndingEscapeFailureFlavorToken = "PLAYABLEAPOTHECARY_" + text2 + "_FAIL";
		ContentAddition.AddSurvivorDef(val2);
		GameObject val3 = PrefabAPI.InstantiateClone(baseMaster, text + "Master", true);
		ContentAddition.AddMaster(val3);
		CharacterMaster component2 = val3.GetComponent<CharacterMaster>();
		component2.bodyPrefab = characterPrefab;
	}

	internal static void RegisterStates()
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: 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_0033: 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_0043: Unknown result type (might be due to invalid IL or missing references)
		bool flag = default(bool);
		ContentAddition.AddEntityState<Primary>(ref flag);
		ContentAddition.AddEntityState<PrimarySpikes>(ref flag);
		ContentAddition.AddEntityState<Secondary>(ref flag);
		ContentAddition.AddEntityState<Utility>(ref flag);
		ContentAddition.AddEntityState<LunarUtility>(ref flag);
		ContentAddition.AddEntityState<Special>(ref flag);
		ContentAddition.AddEntityState<CharacterMain>(ref flag);
		ContentAddition.AddEntityState<MeleeSkillState>(ref flag);
		ContentAddition.AddEntityState<BasicMeleeSkillState>(ref flag);
	}

	internal static void PassiveSetup(GameObject characterPrefab)
	{
		SkillLocator component = characterPrefab.GetComponent<SkillLocator>();
		LanguageAPI.Add("PLAYABLEAPOTHECARY__PASSIVE_NAME", "Mired Urn");
		LanguageAPI.Add("PLAYABLEAPOTHECARY__PASSIVE_DESCRIPTION", "<style=cIsDamage>Tar</style>. The nearest enemies to you will be tethered to you, dealing <style=cIsDamage>" + MainPlugin.passiveDamageCoefficient.Value * 100f + "% damage</style>, and <style=cIsHealing>healing</style> you for <style=cIsHealing>" + MainPlugin.passiveHealCoefficient.Value * 100f + "%</style> of the damage dealt.");
		component.passiveSkill.enabled = true;
		component.passiveSkill.skillNameToken = "PLAYABLEAPOTHECARY__PASSIVE_NAME";
		component.passiveSkill.skillDescriptionToken = "PLAYABLEAPOTHECARY__PASSIVE_DESCRIPTION";
		component.passiveSkill.icon = Prefabs.Load<SkillDef>("RoR2/Base/Treebot/TreebotBodyFireFlower2.asset").icon;
	}

	internal static void PrimarySetup(GameObject characterPrefab)
	{
		SkillLocator component = characterPrefab.GetComponent<SkillLocator>();
		string text = "_M1";
		LanguageAPI.Add("PLAYABLEAPOTHECARY_" + text, "Tar Beam");
		LanguageAPI.Add("PLAYABLEAPOTHECARY_" + text + "_DESCRIPTION", "<style=cIsDamage>Tar</style>. Fire a beam for <style=cIsDamage>" + MainPlugin.primary2DamageCoefficient.Value * 100f + "% damage</style>, chaining on up to <style=cIsDamage>" + MainPlugin.primary2MaxTargets.Value + "</style> targets, reducing the damage by <style=cIsDamage>" + MainPlugin.primary2DamageReduction.Value * 100f + "%</style> for each subsequent target, and <style=cIsHealing>heals</style> for <style=cIsHealing>" + MainPlugin.primary2Heal.Value * 100f + "%</style> of the damage dealt.");
		SkillDef skill = Utils.NewSkillDef<HuntressTrackingSkillDef>(typeof(Primary), "Weapon", 0, 0f, beginSkillCooldownOnSkillEnd: true, canceledFromSprinting: false, fullRestockOnAssign: true, (InterruptPriority)0, isCombatSkill: true, mustKeyPress: false, cancelSprintingOnActivation: false, 0, 0, 0, Prefabs.Load<SkillDef>("RoR2/DLC1/VoidSurvivor/FireCorruptBeam.asset").icon, "PLAYABLEAPOTHECARY_" + text, "PLAYABLEAPOTHECARY_" + text + "_DESCRIPTION", Array.Empty<string>());
		component.primary = Utils.NewGenericSkill(characterPrefab, skill);
		text = "_M1_ALT";
		LanguageAPI.Add("PLAYABLEAPOTHECARY_" + text, "Tar Spikes");
		LanguageAPI.Add("PLAYABLEAPOTHECARY_" + text + "_DESCRIPTION", "<style=cIsDamage>Tar</style>. Fire a spike for <style=cIsDamage>" + MainPlugin.primaryDamageCoefficient.Value * 100f + "% damage</style>.");
		SkillDef skillDef = Utils.NewSkillDef<SkillDef>(typeof(PrimarySpikes), "Weapon", 0, 0f, beginSkillCooldownOnSkillEnd: true, canceledFromSprinting: false, fullRestockOnAssign: true, (InterruptPriority)0, isCombatSkill: true, mustKeyPress: false, cancelSprintingOnActivation: false, 0, 0, 0, Prefabs.Load<SkillDef>("RoR2/Base/Commando/CommandoBodyFirePistol.asset").icon, "PLAYABLEAPOTHECARY_" + text, "PLAYABLEAPOTHECARY_" + text + "_DESCRIPTION", Array.Empty<string>());
		Utils.AddAlt(component.primary.skillFamily, skillDef);
	}

	internal static void SecondarySetup(GameObject characterPrefab)
	{
		Behaviour component = characterPrefab.GetComponent<Behaviour>();
		SkillLocator component2 = characterPrefab.GetComponent<SkillLocator>();
		string text = "_M2";
		LanguageAPI.Add("PLAYABLEAPOTHECARY_" + text, "Tar Slam");
		LanguageAPI.Add("PLAYABLEAPOTHECARY_" + text + "_DESCRIPTION", "<style=cIsDamage>Tar</style>. Slam the ground, dealing <style=cIsDamage>" + MainPlugin.secondaryDamageCoefficient.Value * 100f + "% damage</style>, and fire a mortar at the target for <style=cIsDamage>" + MainPlugin.secondaryProjDamageCoefficient.Value * 100f + "% damage</style>.");
		SkillDef val = Utils.NewSkillDef<SkillDef>(typeof(Secondary), "Weapon", 1, MainPlugin.secondaryCooldown.Value, beginSkillCooldownOnSkillEnd: true, canceledFromSprinting: false, fullRestockOnAssign: false, (InterruptPriority)1, isCombatSkill: true, mustKeyPress: true, cancelSprintingOnActivation: false, 1, 1, 1, Prefabs.Load<SkillDef>("RoR2/Base/Croco/CrocoChainableLeap.asset").icon, "PLAYABLEAPOTHECARY_" + text, "PLAYABLEAPOTHECARY_" + text + "_DESCRIPTION", Array.Empty<string>());
		component2.secondary = Utils.NewGenericSkill(characterPrefab, val);
		component.secondary1 = val;
		text = "_M2_ALT";
		LanguageAPI.Add("PLAYABLEAPOTHECARY_" + text, "Tar Spikes");
		LanguageAPI.Add("PLAYABLEAPOTHECARY_" + text + "_DESCRIPTION", "<style=cIsDamage>Tar</style>. Fire a spike for <style=cIsDamage>" + MainPlugin.primary2DamageCoefficient.Value * 100f + "% damage</style>.");
		val = Utils.NewSkillDef<SkillDef>(typeof(PrimarySpikes), "Weapon", 10, MainPlugin.secondaryAltCooldown.Value, beginSkillCooldownOnSkillEnd: true, canceledFromSprinting: false, fullRestockOnAssign: false, (InterruptPriority)1, isCombatSkill: true, mustKeyPress: false, cancelSprintingOnActivation: false, 10, 1, 1, Prefabs.Load<SkillDef>("RoR2/Base/Commando/CommandoBodyFirePistol.asset").icon, "PLAYABLEAPOTHECARY_" + text, "PLAYABLEAPOTHECARY_" + text + "_DESCRIPTION", Array.Empty<string>());
		Utils.AddAlt(component2.secondary.skillFamily, val);
		component.secondary2 = val;
	}

	internal static void UtilitySetup(GameObject characterPrefab)
	{
		SkillLocator component = characterPrefab.GetComponent<SkillLocator>();
		string text = "_UTIL";
		LanguageAPI.Add("PLAYABLEAPOTHECARY_" + text, "Tar Overheat");
		LanguageAPI.Add("PLAYABLEAPOTHECARY_" + text + "_DESCRIPTION", "<style=cIsDamage>Tar</style>. Knockback nearby enemies and gain <style=cIsDamage>" + MainPlugin.utilityAttackSpeedMult.Value * 100f + "% attack speed</style>, <style=cIsUtility>" + MainPlugin.utilityMoveSpeedMult.Value * 100f + "% movement speed</style> and <style=cIsHealing>" + MainPlugin.utilityRegenMult.Value * 100f + "% health regeneration</style>.");
		SkillDef skill = Utils.NewSkillDef<SkillDef>(typeof(Utility), "Add", 2, MainPlugin.utilityCooldown.Value, beginSkillCooldownOnSkillEnd: true, canceledFromSprinting: false, fullRestockOnAssign: false, (InterruptPriority)1, isCombatSkill: true, mustKeyPress: true, cancelSprintingOnActivation: false, 1, 1, 1, Prefabs.Load<SkillDef>("RoR2/Base/Toolbot/ToolbotDualWield.asset").icon, "PLAYABLEAPOTHECARY_" + text, "PLAYABLEAPOTHECARY_" + text + "_DESCRIPTION", Array.Empty<string>());
		component.utility = Utils.NewGenericSkill(characterPrefab, skill);
		text = "_UTIL_ALT";
		LanguageAPI.Add("PLAYABLEAPOTHECARY_" + text, "Tar Spill");
		LanguageAPI.Add("PLAYABLEAPOTHECARY_" + text + "_DESCRIPTION", "Fade away, becoming <style=cIsUtility>intangible</style>, gaining <style=cIsUtility>+30% movement speed</style> and dealing <style=cIsDamage>" + MainPlugin.utility2DamageCoefficient.Value * 100f + "% damage</style> to enemies around you. <style=cIsHealing>Heal</style> for <style=cIsHealing>18.2%</style> of your <style=cIsHealth>maximum health</style>. Lasts <style=cIsUtility>3s</style>.");
		skill = Utils.NewSkillDef<SkillDef>(typeof(LunarUtility), "Body", 1, MainPlugin.utility2Cooldown.Value, beginSkillCooldownOnSkillEnd: true, canceledFromSprinting: false, fullRestockOnAssign: false, (InterruptPriority)1, isCombatSkill: true, mustKeyPress: true, cancelSprintingOnActivation: false, 1, 1, 1, Prefabs.Load<SkillDef>("RoR2/Base/LunarSkillReplacements/LunarUtilityReplacement.asset").icon, "PLAYABLEAPOTHECARY_" + text, "PLAYABLEAPOTHECARY_" + text + "_DESCRIPTION", Array.Empty<string>());
		Utils.AddAlt(component.utility.skillFamily, skill);
	}

	internal static void SpecialSetup(GameObject characterPrefab)
	{
		SkillLocator component = characterPrefab.GetComponent<SkillLocator>();
		string text = "_SPEC";
		LanguageAPI.Add("PLAYABLEAPOTHECARY_" + text, "Tar Fling");
		LanguageAPI.Add("PLAYABLEAPOTHECARY_" + text + "_DESCRIPTION", "<style=cIsDamage>Tar</style>. Throw tar barrels for <style=cIsDamage>" + MainPlugin.specialProjCount.Value + "x" + MainPlugin.specialDamageCoefficient.Value * 100f + "% damage</style>.");
		SkillDef skill = Utils.NewSkillDef<SkillDef>(typeof(Special), "Weapon", 1, MainPlugin.specialCooldown.Value, beginSkillCooldownOnSkillEnd: true, canceledFromSprinting: false, fullRestockOnAssign: false, (InterruptPriority)1, isCombatSkill: true, mustKeyPress: true, cancelSprintingOnActivation: false, 3, 1, 1, Prefabs.Load<SkillDef>("RoR2/DLC2/Chef/ChefGlaze.asset").icon, "PLAYABLEAPOTHECARY_" + text, "PLAYABLEAPOTHECARY_" + text + "_DESCRIPTION", Array.Empty<string>());
		component.special = Utils.NewGenericSkill(characterPrefab, skill);
	}

	internal static GameObject CreateBodyPrefab(string characterName, Color bodyColor, float mass)
	{
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_019b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_024b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0250: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0387: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d9: Unknown result type (might be due to invalid IL or missing references)
		string text = characterName.Replace(" ", "");
		string text2 = text.ToUpper();
		LanguageAPI.Add("PLAYABLEAPOTHECARY_" + text2 + "_NAME", characterName);
		GameObject val = PrefabAPI.InstantiateClone(baseBody, text + "Body", true);
		val.GetComponent<NetworkIdentity>().localPlayerAuthority = true;
		ModelLocator component = val.GetComponent<ModelLocator>();
		Object.DestroyImmediate((Object)(object)((Component)component.modelTransform).gameObject);
		GameObject val2 = Assets.Load<GameObject>("ApothecaryMdl");
		val2.AddComponent<AnimationEvents>().soundCenter = val2;
		val2.transform.parent = component.modelBaseTransform;
		val2.transform.localPosition = Vector3.zero;
		val2.transform.localRotation = Quaternion.identity;
		component.modelTransform = val2.transform;
		ChildLocator component2 = val2.GetComponent<ChildLocator>();
		((Component)component2.FindChild("body")).GetComponent<Renderer>().material = Prefabs.Load<Material>("RoR2/DLC1/ClayGrenadier/matClayGrenadierBody.mat");
		((Component)component2.FindChild("limbs")).GetComponent<Renderer>().material = Prefabs.Load<Material>("RoR2/DLC1/ClayGrenadier/matClayGrenadierLimbs.mat");
		MidpointBetweenTwoTransforms val3 = ((Component)component2.FindChild("MuzzleBetweenHands")).gameObject.AddComponent<MidpointBetweenTwoTransforms>();
		val3.transform1 = component2.FindChild("hand.r");
		val3.transform2 = component2.FindChild("hand.l");
		CharacterBody component3 = val.GetComponent<CharacterBody>();
		((Object)component3).name = "PlayableApothecaryBody";
		component3.baseNameToken = "PLAYABLEAPOTHECARY_" + text2 + "_NAME";
		component3.subtitleNameToken = "PLAYABLEAPOTHECARY_" + text2 + "_SUBTITLE";
		component3.bodyFlags = (BodyFlags)16;
		component3.hullClassification = (HullClassification)0;
		Sprite val4 = Assets.Load<Sprite>(text);
		component3.portraitIcon = (Texture)(object)(Object.op_Implicit((Object)(object)val4) ? val4.texture : null);
		component3.isChampion = false;
		component3.currentVehicle = null;
		component3.skinIndex = 0u;
		component3.bodyColor = bodyColor;
		HealthComponent component4 = val.GetComponent<HealthComponent>();
		component4.health = component3.baseMaxHealth;
		component4.shield = 0f;
		component4.barrier = 0f;
		CharacterMotor component5 = val.GetComponent<CharacterMotor>();
		component5.mass = mass;
		CameraTargetParams component6 = val.GetComponent<CameraTargetParams>();
		component6.cameraParams = Prefabs.Load<CharacterCameraParams>("RoR2/Base/Common/ccpStandard.asset");
		component6.cameraPivotTransform = null;
		component6.recoil = Vector2.zero;
		component6.dontRaycastToPivot = false;
		KinematicCharacterMotor component7 = val.GetComponent<KinematicCharacterMotor>();
		component7.CharacterController = (ICharacterController)(object)component5;
		component7.playerCharacter = true;
		component7.MaxStepHeight = 0.182f;
		val.GetComponent<Interactor>().maxInteractionDistance = 3f;
		val.GetComponent<InteractionDriver>().highlightInteractor = true;
		CharacterModel val5 = val2.AddComponent<CharacterModel>();
		SkinnedMeshRenderer[] componentsInChildren = val2.GetComponentsInChildren<SkinnedMeshRenderer>();
		List<RendererInfo> list = new List<RendererInfo>();
		foreach (SkinnedMeshRenderer val6 in componentsInChildren)
		{
			list.Add(new RendererInfo
			{
				renderer = (Renderer)(object)val6,
				defaultMaterial = ((Renderer)val6).material,
				defaultShadowCastingMode = (ShadowCastingMode)1,
				ignoreOverlays = false
			});
		}
		RendererInfo[] array = list.ToArray();
		val5.body = component3;
		val5.baseRendererInfos = array;
		val5.autoPopulateLightInfos = true;
		val5.temporaryOverlays = new List<TemporaryOverlayInstance>();
		val5.mainSkinnedMeshRenderer = componentsInChildren[0];
		LanguageAPI.Add(text2 + "BODY_DEFAULT_SKIN_NAME", "Default");
		ModelSkinController val7 = val2.AddComponent<ModelSkinController>();
		val7.skins = (SkinDef[])(object)new SkinDef[1] { Skins.CreateNewSkinDef(Utils.CreateNewSkinDefInfo(componentsInChildren, val2, text2 + "BODY_DEFAULT_SKIN_NAME", array)) };
		Collider[] componentsInChildren2 = val2.GetComponentsInChildren<Collider>();
		HurtBoxGroup val8 = val2.AddComponent<HurtBoxGroup>();
		List<HurtBox> list2 = new List<HurtBox>();
		Collider[] array2 = componentsInChildren2;
		foreach (Collider val9 in array2)
		{
			HurtBox val10 = ((Component)val9).gameObject.AddComponent<HurtBox>();
			((Component)val10).gameObject.layer = LayerIndex.entityPrecise.intVal;
			val10.healthComponent = component4;
			val10.isBullseye = true;
			val10.damageModifier = (DamageModifier)0;
			val10.hurtBoxGroup = val8;
			val10.indexInGroup = 0;
			val8.mainHurtBox = val10;
			val8.bullseyeCount = 1;
			list2.Add(val10);
		}
		val8.hurtBoxes = list2.ToArray();
		AimAnimator val11 = val2.AddComponent<AimAnimator>();
		val11.inputBank = val.GetComponent<InputBankTest>();
		val11.directionComponent = val.GetComponent<CharacterDirection>();
		val11.pitchRangeMin = -40f;
		val11.pitchRangeMax = 40f;
		val11.yawRangeMin = -45f;
		val11.yawRangeMax = 45f;
		val11.pitchGiveupRange = 30f;
		val11.yawGiveupRange = 30f;
		val11.giveupDuration = 3f;
		val11.raisedApproachSpeed = 720f;
		val11.loweredApproachSpeed = 360f;
		val11.smoothTime = 0.3f;
		val11.aimType = (AimType)0;
		SfxLocator component8 = val.GetComponent<SfxLocator>();
		component8.barkSound = "";
		component8.openSound = "";
		component8.fallDamageSound = "Play_char_land_fall_damage";
		component8.aliveLoopStart = "";
		component8.aliveLoopStop = "";
		val.GetComponent<Rigidbody>().mass = mass;
		FootstepHandler val12 = val2.AddComponent<FootstepHandler>();
		val12.baseFootstepString = "Play_clayGrenadier_step";
		val12.sprintFootstepOverrideString = "";
		val12.enableFootstepDust = true;
		val12.footstepDustPrefab = Prefabs.Load<GameObject>("RoR2/Base/Common/VFX/GenericFootstepDust.prefab");
		GenericSkill[] componentsInChildren3 = val.GetComponentsInChildren<GenericSkill>();
		foreach (GenericSkill val13 in componentsInChildren3)
		{
			Object.DestroyImmediate((Object)(object)val13);
		}
		Utils.NewStateMachine<Idle>(val, "Add");
		Utils.NewStateMachine<Idle>(val, "Weapon");
		EntityStateMachine component9 = ((Component)component3).GetComponent<EntityStateMachine>();
		component9.mainStateType = new SerializableEntityStateType(typeof(CharacterMain));
		NetworkStateMachine component10 = ((Component)component3).GetComponent<NetworkStateMachine>();
		component10.stateMachines = ((Component)component3).GetComponents<EntityStateMachine>();
		ContentAddition.AddBody(val);
		return val;
	}
}
internal class Hook
{
	internal static void Hooks()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
	}

	private static void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
	{
		if (sender.HasBuff(Prefabs.buff))
		{
			args.attackSpeedMultAdd += MainPlugin.utilityAttackSpeedMult.Value;
			args.moveSpeedMultAdd += MainPlugin.utilityMoveSpeedMult.Value;
			args.regenMultAdd += MainPlugin.utilityRegenMult.Value;
		}
	}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.Dragonyck.PlayableApothecary", "PlayableApothecary", "1.0.0")]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
public class MainPlugin : BaseUnityPlugin
{
	public const string MODUID = "com.Dragonyck.PlayableApothecary";

	public const string MODNAME = "PlayableApothecary";

	public const string VERSION = "1.0.0";

	internal const string MODKEY = "PLAYABLEAPOTHECARY_";

	internal static ConfigFile config;

	internal static ConfigEntry<float> passiveHealCoefficient;

	internal static ConfigEntry<float> passiveDamageCoefficient;

	internal static ConfigEntry<float> passiveTicks;

	internal static ConfigEntry<float> passiveRadius;

	internal static ConfigEntry<float> primaryDamageCoefficient;

	internal static ConfigEntry<float> primaryFireRate;

	internal static ConfigEntry<float> primary2Ticks;

	internal static ConfigEntry<float> primary2DamageCoefficient;

	internal static ConfigEntry<float> primary2DamageReduction;

	internal static ConfigEntry<float> primary2Range;

	internal static ConfigEntry<int> primary2MaxTargets;

	internal static ConfigEntry<float> primary2Heal;

	internal static ConfigEntry<float> secondaryDamageCoefficient;

	internal static ConfigEntry<float> secondaryDuration;

	internal static ConfigEntry<float> secondaryDelay;

	internal static ConfigEntry<float> secondaryRadius;

	internal static ConfigEntry<float> secondaryProjDamageCoefficient;

	internal static ConfigEntry<float> secondaryProjSnapAngle;

	internal static ConfigEntry<float> secondaryCooldown;

	internal static ConfigEntry<float> secondaryAltCooldown;

	internal static ConfigEntry<float> utilityDuration;

	internal static ConfigEntry<float> utilityAttackSpeedMult;

	internal static ConfigEntry<float> utilityMoveSpeedMult;

	internal static ConfigEntry<float> utilityRegenMult;

	internal static ConfigEntry<float> utilityRadius;

	internal static ConfigEntry<float> utilityKnockback;

	internal static ConfigEntry<float> utilityCooldown;

	internal static ConfigEntry<float> utility2DamageCoefficient;

	internal static ConfigEntry<float> utility2Radius;

	internal static ConfigEntry<float> utility2FireRate;

	internal static ConfigEntry<float> utility2Cooldown;

	internal static ConfigEntry<float> specialDuration;

	internal static ConfigEntry<int> specialProjCount;

	internal static ConfigEntry<float> specialDamageCoefficient;

	internal static ConfigEntry<float> specialSpread;

	internal static ConfigEntry<float> specialRadius;

	internal static ConfigEntry<float> specialFireDelay;

	internal static ConfigEntry<float> specialCooldown;

	private void Awake()
	{
		passiveHealCoefficient = ((BaseUnityPlugin)this).Config.Bind<float>("Passive", "Heal Coefficient", 0.25f, (ConfigDescription)null);
		passiveDamageCoefficient = ((BaseUnityPlugin)this).Config.Bind<float>("Passive", "Damage Coefficient", 0.25f, (ConfigDescription)null);
		passiveRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Passive", "Radius", 4f, (ConfigDescription)null);
		passiveTicks = ((BaseUnityPlugin)this).Config.Bind<float>("Passive", "Ticks Per Second", 4f, (ConfigDescription)null);
		primaryDamageCoefficient = ((BaseUnityPlugin)this).Config.Bind<float>("Tar Spikes", "Damage Coefficient", 2f, (ConfigDescription)null);
		primaryFireRate = ((BaseUnityPlugin)this).Config.Bind<float>("Tar Spikes", "Spikes Per Second", 9f, (ConfigDescription)null);
		primary2Ticks = ((BaseUnityPlugin)this).Config.Bind<float>("Tar Beam", "Ticks Per Second", 5f, (ConfigDescription)null);
		primary2DamageCoefficient = ((BaseUnityPlugin)this).Config.Bind<float>("Tar Beam", "Damage Coefficient", 0.4f, (ConfigDescription)null);
		primary2DamageReduction = ((BaseUnityPlugin)this).Config.Bind<float>("Tar Beam", "Damage Reduction Mult Per Target", 0.5f, (ConfigDescription)null);
		primary2Range = ((BaseUnityPlugin)this).Config.Bind<float>("Tar Beam", "Range", 14f, (ConfigDescription)null);
		primary2MaxTargets = ((BaseUnityPlugin)this).Config.Bind<int>("Tar Beam", "Max Targets", 3, (ConfigDescription)null);
		primary2Heal = ((BaseUnityPlugin)this).Config.Bind<float>("Tar Beam", "Heal Mult", 0.01f, (ConfigDescription)null);
		secondaryDamageCoefficient = ((BaseUnityPlugin)this).Config.Bind<float>("Face Slam", "Slam Damage Coefficient", 1.5f, (ConfigDescription)null);
		secondaryDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Face Slam", "Duration", 2.46f, (ConfigDescription)null);
		secondaryDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Face Slam", "Slam Delay", 1f, (ConfigDescription)null);
		secondaryRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Face Slam", "Slam Radius", 15f, (ConfigDescription)null);
		secondaryProjDamageCoefficient = ((BaseUnityPlugin)this).Config.Bind<float>("Face Slam", "Projectile Damage Coefficient", 4f, (ConfigDescription)null);
		secondaryProjSnapAngle = ((BaseUnityPlugin)this).Config.Bind<float>("Face Slam", "Projectile SnapOn Angle", 100f, (ConfigDescription)null);
		secondaryCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Face Slam", "Cooldown", 5f, (ConfigDescription)null);
		secondaryAltCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Tar Spikes", "Cooldown", 2f, "Secondary version only.");
		utilityDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Tar Buff", "Duration", 4f, (ConfigDescription)null);
		utilityAttackSpeedMult = ((BaseUnityPlugin)this).Config.Bind<float>("Tar Buff", "Attack Speed Mult", 0.5f, (ConfigDescription)null);
		utilityMoveSpeedMult = ((BaseUnityPlugin)this).Config.Bind<float>("Tar Buff", "Movement Speed Mult", 0.5f, (ConfigDescription)null);
		utilityRegenMult = ((BaseUnityPlugin)this).Config.Bind<float>("Tar Buff", "Regen Mult", 1f, (ConfigDescription)null);
		utilityRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Tar Buff", "Radius", 12f, (ConfigDescription)null);
		utilityKnockback = ((BaseUnityPlugin)this).Config.Bind<float>("Tar Buff", "Knockback Force", 2400f, (ConfigDescription)null);
		utilityCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Tar Buff", "Cooldown", 10f, (ConfigDescription)null);
		utility2DamageCoefficient = ((BaseUnityPlugin)this).Config.Bind<float>("Tar Spill", "Damage Coefficient", 1.4f, (ConfigDescription)null);
		utility2Radius = ((BaseUnityPlugin)this).Config.Bind<float>("Tar Spill", "Radius", 12f, (ConfigDescription)null);
		utility2FireRate = ((BaseUnityPlugin)this).Config.Bind<float>("Tar Spill", "Hits Per Second", 5f, (ConfigDescription)null);
		utility2Cooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Tar Spill", "Cooldown", 6f, (ConfigDescription)null);
		specialDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Tar Fling", "Duration", 1.9f, (ConfigDescription)null);
		specialProjCount = ((BaseUnityPlugin)this).Config.Bind<int>("Tar Fling", "Projectile Count", 4, (ConfigDescription)null);
		specialDamageCoefficient = ((BaseUnityPlugin)this).Config.Bind<float>("Tar Fling", "Damage Coefficient", 1.5f, (ConfigDescription)null);
		specialSpread = ((BaseUnityPlugin)this).Config.Bind<float>("Tar Fling", "Spread", 6f, (ConfigDescription)null);
		specialRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Tar Fling", "Radius", 6f, (ConfigDescription)null);
		specialFireDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Tar Fling", "Fire Delay", 1f, (ConfigDescription)null);
		specialCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Tar Fling", "Cooldown", 10f, (ConfigDescription)null);
		config = ((BaseUnityPlugin)this).Config;
		Assets.PopulateAssets();
		Prefabs.CreatePrefabs();
		CharacterBodySetup.CreateCharacterBodies();
		Hook.Hooks();
	}
}
internal class Prefabs
{
	internal static GameObject muzzleflash;

	internal static GameObject squidHit;

	internal static GameObject lunarCoreVFX;

	internal static GameObject beamMuzzleEffect;

	internal static GameObject hitEffect;

	internal static GameObject spikeProjectileGhost;

	internal static GameObject spikeProjectile;

	internal static GameObject ballProjectile;

	internal static BuffDef buff;

	internal static GameObject urnAttachmentPrefab;

	internal static GameObject tetherVFX;

	internal static Material baseMaterial = Load<Material>("RoR2/Base/Commando/matCommandoDualies.mat");

	internal static void CreatePrefabs()
	{
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Expected O, but got Unknown
		//IL_0144: 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_0064: Expected O, but got Unknown
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0407: Unknown result type (might be due to invalid IL or missing references)
		//IL_0411: Expected O, but got Unknown
		//IL_047c: Unknown result type (might be due to invalid IL or missing references)
		//IL_048e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0498: Unknown result type (might be due to invalid IL or missing references)
		//IL_049d: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0527: Unknown result type (might be due to invalid IL or missing references)
		//IL_0531: Unknown result type (might be due to invalid IL or missing references)
		//IL_0554: Unknown result type (might be due to invalid IL or missing references)
		squidHit = Instantiate("RoR2/Base/Squid/SquidTurretHitEffect.prefab", "GooHit");
		Texture2D val = Load<Texture2D>("RoR2/Base/Common/ColorRamps/texClayGooRamp.png");
		ParticleSystemRenderer[] componentsInChildren = squidHit.GetComponentsInChildren<ParticleSystemRenderer>();
		foreach (ParticleSystemRenderer val2 in componentsInChildren)
		{
			if (((Object)val2).name != "Ring")
			{
				Material val3 = new Material(((Renderer)val2).material);
				val3.SetColor("_EmissionColor", Color.black);
				val3.SetTexture("_RemapTex", (Texture)(object)val);
				val3.SetFloat("_SpecularStrength", 0f);
				((Renderer)val2).material = val3;
			}
			else
			{
				((Component)val2).gameObject.SetActive(false);
			}
		}
		ContentAddition.AddEffect(squidHit);
		muzzleflash = Instantiate("RoR2/Base/Squid/MuzzleflashSquid.prefab", "GooMuzzleFlash");
		Renderer component = ((Component)muzzleflash.transform.GetChild(0)).GetComponent<Renderer>();
		component.material = new Material(component.material);
		component.material.SetFloat("_SpecularStrength", 0f);
		ContentAddition.AddEffect(muzzleflash);
		buff = Utils.NewBuffDef("Tar Overdrive", stack: false, hidden: false, Load<BuffDef>("RoR2/Base/Grandparent/bdOverheat.asset").iconSprite, CharacterBodySetup.characterColor);
		lunarCoreVFX = Instantiate("RoR2/Base/LunarSkillReplacements/CrowstormCoreVFX.prefab", "LunarCoreVFX");
		ParticleSystemRenderer[] componentsInChildren2 = lunarCoreVFX.GetComponentsInChildren<ParticleSystemRenderer>();
		foreach (ParticleSystemRenderer val4 in componentsInChildren2)
		{
			string name = ((Object)val4).name;
			if (name == "FeatherRings")
			{
				((Component)val4).transform.localScale = Vector3.one * 3f;
				((Renderer)val4).material = Load<Material>("RoR2/DLC1/ClayGrenadier/matClayGrenadierShockwave.mat");
			}
			if (name == "Big Feathers")
			{
				((Component)val4).gameObject.SetActive(false);
			}
			if (name == "Core")
			{
				((Renderer)val4).material = Load<Material>("RoR2/Base/Clay/matClayBubbleBillboard.mat");
			}
		}
		beamMuzzleEffect = Instantiate("RoR2/Base/ClayBoss/ClayBossMulcher.prefab", "BeamMuzzleEffect");
		Object.Destroy((Object)(object)beamMuzzleEffect.GetComponent<DestroyOnParticleEnd>());
		Object.Destroy((Object)(object)beamMuzzleEffect.GetComponent<DetachParticleOnDestroyAndEndEmission>());
		Object.Destroy((Object)(object)beamMuzzleEffect.GetComponent<ShakeEmitter>());
		ParticleSystemRenderer[] componentsInChildren3 = beamMuzzleEffect.GetComponentsInChildren<ParticleSystemRenderer>();
		foreach (ParticleSystemRenderer val5 in componentsInChildren3)
		{
			string name2 = ((Object)val5).name;
			if (name2 == "Single Floating Particle" || name2 == "Trail")
			{
				((Component)val5).gameObject.SetActive(false);
			}
			else
			{
				((Component)val5).transform.localScale = Vector3.one * 0.08f;
			}
		}
		hitEffect = Instantiate("RoR2/Base/Squid/SquidTurretHitEffect.prefab", "HitEffect");
		Material material = Load<Material>("RoR2/DLC1/VoidBarnacle/matVoidBarnacleGoo.mat");
		ParticleSystemRenderer[] componentsInChildren4 = hitEffect.GetComponentsInChildren<ParticleSystemRenderer>();
		foreach (ParticleSystemRenderer val6 in componentsInChildren4)
		{
			string name3 = ((Object)val6).name;
			if (name3 == "Ring")
			{
				((Component)val6).gameObject.SetActive(false);
			}
			else
			{
				((Renderer)val6).material = material;
			}
		}
		Utils.RegisterEffect(hitEffect, -1f);
		urnAttachmentPrefab = Instantiate("RoR2/Base/SiphonOnLowHealth/SiphonNearbyBodyAttachment.prefab", "UrnAttachmentPrefab", registerNetwork: true);
		Object.Destroy((Object)(object)urnAttachmentPrefab.GetComponent<SiphonNearbyController>());
		urnAttachmentPrefab.AddComponent<UrnTether>();
		tetherVFX = Instantiate(urnAttachmentPrefab.GetComponent<TetherVfxOrigin>().tetherPrefab, "TetherVFX", registerNetwork: true);
		tetherVFX.GetComponent<TetherVfx>().fadeOut.timeMax = 0.25f;
		LineRenderer component2 = tetherVFX.GetComponent<LineRenderer>();
		((Renderer)component2).material = new Material(((Renderer)component2).material);
		component2.widthMultiplier = 0.6f;
		spikeProjectileGhost = Instantiate("RoR2/Base/ClayBoss/TarballGhost.prefab", "SpikeProjectileGhost");
		TrailRenderer componentInChildren = spikeProjectileGhost.GetComponentInChildren<TrailRenderer>();
		componentInChildren.widthMultiplier = 0.5f;
		componentInChildren.time = 0.2f;
		MeshRenderer componentInChildren2 = spikeProjectileGhost.GetComponentInChildren<MeshRenderer>(true);
		((Component)componentInChildren2).transform.localScale = new Vector3(2f, 0.25f, 0.25f);
		((Component)componentInChildren2).transform.localRotation = Quaternion.Euler(Vector3.up * 90f);
		((Behaviour)((Component)componentInChildren2).GetComponent<RotateAroundAxis>()).enabled = false;
		ParticleSystemRenderer[] componentsInChildren5 = spikeProjectileGhost.GetComponentsInChildren<ParticleSystemRenderer>();
		foreach (ParticleSystemRenderer val7 in componentsInChildren5)
		{
			switch (((Object)val7).name)
			{
			case "Flames":
				((Component)val7).gameObject.SetActive(false);
				break;
			case "Goo":
				((Component)val7).transform.localScale = Vector3.one * 0.25f;
				break;
			case "Donut":
				((Component)val7).transform.localScale = new Vector3(3f, 0.25f, 1f);
				break;
			}
		}
		spikeProjectile = Instantiate("RoR2/Base/Brother/LunarShardProjectile.prefab", "SpikeProjectile", registerNetwork: true);
		spikeProjectile.GetComponent<ProjectileController>().ghostPrefab = spikeProjectileGhost;
		ProjectileImpactExplosion component3 = spikeProjectile.GetComponent<ProjectileImpactExplosion>();
		((ProjectileExplosion)component3).blastDamageCoefficient = 1f;
		component3.impactEffect = hitEffect;
		((ProjectileExplosion)component3).explosionEffect = component3.impactEffect;
		ContentAddition.AddProjectile(spikeProjectile);
		ballProjectile = Instantiate("RoR2/DLC1/ClayGrenadier/ClayGrenadierBarrelProjectile.prefab", "BallProjectile", registerNetwork: true);
		((ProjectileExplosion)ballProjectile.GetComponent<ProjectileImpactExplosion>()).blastRadius = MainPlugin.specialRadius.Value;
		ContentAddition.AddProjectile(ballProjectile);
	}

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

	internal static GameObject Instantiate(string path, string name, bool registerNetwork = false)
	{
		return PrefabAPI.InstantiateClone(Load<GameObject>(path), name, registerNetwork);
	}

	internal static GameObject Instantiate(GameObject obj, string name, bool registerNetwork = false)
	{
		return PrefabAPI.InstantiateClone(obj, name, registerNetwork);
	}

	public static Material InstantiateDefaultSurvivorMaterial(Texture tex)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		Material val = new Material(baseMaterial);
		if (Object.op_Implicit((Object)(object)val))
		{
			val.SetColor("_Color", Color.white);
			val.SetTexture("_MainTex", tex);
			val.SetColor("_EmColor", Color.black);
			val.SetFloat("_EmPower", 0f);
			val.SetTexture("_EmTex", (Texture)null);
			val.SetFloat("_NormalStrength", 1f);
			val.SetTexture("_NormalTex", (Texture)null);
			val.SetFloat("_Cull", 0f);
			return val;
		}
		return val;
	}

	public static Material InstantiateDefaultSurvivorMaterial(Color color, Texture tex, Color emColor, float emPower, Texture emTex, float normStr, Texture normTex)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		Material val = new Material(baseMaterial);
		if (Object.op_Implicit((Object)(object)val))
		{
			val.SetColor("_Color", color);
			val.SetTexture("_MainTex", tex);
			val.SetColor("_EmColor", emColor);
			val.SetFloat("_EmPower", emPower);
			val.SetTexture("_EmTex", emTex);
			val.SetFloat("_NormalStrength", 1f);
			val.SetTexture("_NormalTex", normTex);
			val.SetFloat("_Cull", 0f);
			return val;
		}
		return val;
	}
}
internal class BasicMeleeSkillState : BaseSkillState
{
	private float duration = 0.2f;

	private Vector3 dir;

	private OverlapAttack attack;

	private float damageCoefficient = 4.2f;

	private GameObject hitEffectPrefab = null;

	private bool parried;

	public Animator animator;

	private uint ID;

	private string hitboxGroupName = "";

	public override void OnEnter()
	{
		((BaseState)this).OnEnter();
		animator = ((EntityState)this).GetModelAnimator();
		if (!animator.GetBool("slide"))
		{
			((BaseState)this).StartAimMode(1f, true);
		}
		((EntityState)this).PlayAnimation("LeftArm, Override", "MeleeAttack");
		AkSoundEngine.PostEvent(ID, ((EntityState)this).gameObject);
		attack = ((BaseState)this).InitMeleeOverlap(damageCoefficient, hitEffectPrefab, ((EntityState)this).GetModelTransform(), hitboxGroupName);
	}

	public override void FixedUpdate()
	{
		((EntityState)this).FixedUpdate();
		if (((EntityState)this).isAuthority)
		{
			attack.Fire((List<HurtBox>)null);
		}
		if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
		{
			((EntityState)this).outer.SetNextStateToMain();
		}
	}

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

	public override InterruptPriority GetMinimumInterruptPriority()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		return (InterruptPriority)1;
	}
}
internal class CharacterMain : GenericCharacterMain
{
}
internal class MeleeSkillState : BaseSkillState
{
	public float attackDuration;

	private bool hopped;

	private bool hasSwung;

	public bool isInHitPause;

	public float hitPauseDuration;

	public float hopVelocity;

	public float hitPauseTimer;

	public float stopwatch;

	public HitStopCachedState hitStopCachedState;

	public OverlapAttack overlapAttack;

	public bool hasHit;

	private bool hasAnimParameter;

	private float attackSpeedScaling;

	public Animator animator;

	public int attackIndex = 1;

	private GameObject swingEffectInstance;

	public virtual float baseAttackDuration => 0f;

	public virtual float earlyExitDurationPercentage => 0f;

	public virtual float damageCoefficient => 0f;

	public virtual float forceMagnitude => 440f;

	public virtual float rootMotionSpeed => 25f;

	public virtual float baseHopVelocity => 4f;

	public virtual string layerName => "Gesture, Override";

	public virtual string animationStateName => "";

	public virtual string animParameter => "M1";

	public virtual string hitBoxGroupName => "";

	public virtual string hitBoxActiveParameter => "Curve";

	public virtual string swingMuzzle => "";

	public virtual GameObject swingEffectPrefab => null;

	public virtual bool hopOnHit => true;

	public virtual bool rootMotion => false;

	public virtual bool rootMotionWhileHitting => false;

	public virtual string swingSound => "";

	public virtual DamageTypeCombo damageType => DamageTypeCombo.Generic;

	public virtual DamageColorIndex damageColor => (DamageColorIndex)0;

	public virtual Vector3 bonusForce => Vector3.zero;

	public virtual GameObject hitEffectPrefab => null;

	public virtual bool crossfade => false;

	public virtual bool finisher => attackIndex == 2;

	public virtual bool scaleSwingEffectSpeed => false;

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

	public override void OnDeserialize(NetworkReader reader)
	{
		((BaseSkillState)this).OnDeserialize(reader);
		attackIndex = reader.ReadInt32();
	}

	public override void OnEnter()
	{
		//IL_00b4: 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)
		((BaseState)this).OnEnter();
		attackSpeedScaling = Math.Min(((BaseState)this).attackSpeedStat, 6f);
		attackDuration = baseAttackDuration / attackSpeedScaling;
		hitPauseDuration = GroundLight.hitPauseDuration / attackSpeedScaling;
		hopVelocity = baseHopVelocity / attackSpeedScaling;
		animator = ((EntityState)this).GetModelAnimator();
		animator.SetFloat(hitBoxActiveParameter, 0f);
		overlapAttack = ((BaseState)this).InitMeleeOverlap(damageCoefficient, hitEffectPrefab, ((EntityState)this).GetModelTransform(), hitBoxGroupName);
		overlapAttack.pushAwayForce = 1f;
		overlapAttack.damageType = damageType;
		hasAnimParameter = !Utility.IsNullOrWhiteSpace(animParameter);
		if (hasAnimParameter && !Utility.IsNullOrWhiteSpace(animationStateName))
		{
			if (crossfade)
			{
				((EntityState)this).PlayAnimation("Additive, Override", animationStateName, animParameter, attackDuration, 0f);
				((EntityState)this).PlayCrossfade(layerName, animationStateName, animParameter, attackDuration, 0.1f);
			}
			else
			{
				((EntityState)this).PlayAnimation(layerName, animationStateName, animParameter, attackDuration, 0f);
			}
		}
	}

	public virtual Vector3 rootMotionDirection()
	{
		//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_000f: Unknown result type (might be due to invalid IL or missing references)
		return ((EntityState)this).characterDirection.forward;
	}

	public override void FixedUpdate()
	{
		//IL_0030: 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_00fb: 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)
		//IL_0109: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_011b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		((EntityState)this).FixedUpdate();
		if (((EntityState)this).isAuthority)
		{
			bool flag = FireMeleeAttack(overlapAttack, animator, hitBoxActiveParameter, forceMagnitude, bonusForce);
			hasHit = flag || hasHit;
			if (hasHit)
			{
				if (hopOnHit && !((EntityState)this).characterMotor.isGrounded && !hopped)
				{
					((BaseState)this).SmallHop(((EntityState)this).characterMotor, hopVelocity);
					hopped = true;
				}
				if (!rootMotionWhileHitting && !isInHitPause && hasAnimParameter)
				{
					isInHitPause = true;
				}
			}
			if (animator.GetFloat(hitBoxActiveParameter) > 0.1f && rootMotion && !isInHitPause)
			{
				Vector3 val = rootMotionDirection();
				CharacterMotor characterMotor = ((EntityState)this).characterMotor;
				characterMotor.rootMotion += val * rootMotionSpeed * Time.fixedDeltaTime;
			}
			if (hitPauseTimer >= hitPauseDuration && isInHitPause)
			{
				isInHitPause = false;
				animator.speed = 1f;
			}
			if (!isInHitPause)
			{
				stopwatch += Time.fixedDeltaTime;
			}
			else
			{
				hitPauseTimer += Time.fixedDeltaTime;
				animator.speed = 0f;
			}
			if (stopwatch >= attackDuration * earlyExitDurationPercentage)
			{
				if (((EntityState)this).inputBank.skill1.down && SetState())
				{
					return;
				}
				if (stopwatch >= attackDuration)
				{
					BaseSkillState val2 = StateOverride();
					if (val2 != null)
					{
						((EntityState)this).outer.SetNextState((EntityState)(object)val2);
					}
					else
					{
						((EntityState)this).outer.SetNextStateToMain();
					}
					return;
				}
			}
		}
		if (!(animator.GetFloat(hitBoxActiveParameter) >= 0.11f) || hasSwung)
		{
			return;
		}
		hasSwung = true;
		AkSoundEngine.PostEvent(swingSound, ((EntityState)this).gameObject);
		if (Object.op_Implicit((Object)(object)swingEffectPrefab) && !Utility.IsNullOrWhiteSpace(swingMuzzle))
		{
			if (scaleSwingEffectSpeed)
			{
				SpawnSwingEffect(swingMuzzle);
			}
			else
			{
				EffectManager.SimpleMuzzleFlash(swingEffectPrefab, ((EntityState)this).gameObject, swingMuzzle, false);
			}
		}
		float num = 4.2f;
		((BaseState)this).AddRecoil(-0.1f * num, 0.1f * num, -1f * num, 1f * num);
	}

	public override void OnExit()
	{
		if (Object.op_Implicit((Object)(object)swingEffectInstance))
		{
			EntityState.Destroy((Object)(object)swingEffectInstance);
		}
		((EntityState)this).OnExit();
	}

	public void SpawnSwingEffect(string muzzle)
	{
		//IL_0011: 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)
		Transform val = ((BaseState)this).FindModelChild(muzzle);
		swingEffectInstance = Object.Instantiate<GameObject>(swingEffectPrefab, val.position, val.rotation, val);
		ScaleParticleSystemDuration component = swingEffectInstance.GetComponent<ScaleParticleSystemDuration>();
		component.initialDuration = attackDuration;
		component._newDuration = attackDuration;
	}

	public bool FireMeleeAttack(OverlapAttack attack, Animator animator, string mecanimHitboxActiveParameter, float forceMagnitude, Vector3 bonusForce)
	{
		//IL_0042: 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_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)
		bool result = false;
		if (Object.op_Implicit((Object)(object)animator) && animator.GetFloat(mecanimHitboxActiveParameter) > 0.1f)
		{
			attack.forceVector = (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection) ? ((EntityState)this).characterDirection.forward : ((EntityState)this).transform.forward) * forceMagnitude + bonusForce;
			result = attack.Fire((List<HurtBox>)null);
		}
		return result;
	}

	public virtual bool SetState()
	{
		return false;
	}

	public virtual BaseSkillState StateOverride()
	{
		return null;
	}

	public override InterruptPriority GetMinimumInterruptPriority()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		return (InterruptPriority)1;
	}
}
internal class PrimaryMelee : MeleeSkillState
{
	public override float baseAttackDuration => 0.9f;

	public override float earlyExitDurationPercentage => 0.95f;

	public override string layerName => "Gesture, Override";

	public override string animationStateName => "Attack" + attackIndex;

	public override string animParameter => "M1";

	public override string hitBoxGroupName => "Punch";

	public override float forceMagnitude => 250f;

	public override float damageCoefficient => 2.5f;

	public override string swingSound => "";

	public override float baseHopVelocity => 6f;

	public override GameObject hitEffectPrefab => null;

	public override string swingMuzzle => animationStateName + "Muzzle";

	public override bool crossfade => true;

	public override GameObject swingEffectPrefab => null;

	public override DamageTypeCombo damageType => DamageTypeCombo.GenericPrimary;

	public override bool scaleSwingEffectSpeed => false;

	public override bool finisher => attackIndex == 3;

	public override void OnEnter()
	{
		base.OnEnter();
		((BaseState)this).StartAimMode(2f, false);
	}

	public override bool SetState()
	{
		if (finisher)
		{
			return false;
		}
		PrimaryMelee primaryMelee = new PrimaryMelee();
		primaryMelee.attackIndex = attackIndex + 1;
		((EntityState)this).outer.SetNextState((EntityState)(object)primaryMelee);
		return true;
	}

	public override InterruptPriority GetMinimumInterruptPriority()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		return (InterruptPriority)1;
	}
}
internal class Primary : BaseSkillState
{
	private float stopwatch = 1f;

	private List<KeyValuePair<TetherVfx, HealthComponent>> tethers = new List<KeyValuePair<TetherVfx, HealthComponent>>();

	private Behaviour behaviour;

	private SphereSearch search = new SphereSearch();

	private TeamMask mask;

	private GameObject effectInstance;

	private HurtBox target => ((HuntressTracker)behaviour).trackingTarget;

	public override void OnEnter()
	{
		//IL_004b: 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_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: 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_00a2: 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)
		((BaseState)this).OnEnter();
		behaviour = ((EntityState)this).GetComponent<Behaviour>();
		if (!Object.op_Implicit((Object)(object)target))
		{
			if (((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
			return;
		}
		mask = TeamMask.GetEnemyTeams(((EntityState)this).teamComponent.teamIndex);
		search.mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask;
		Transform val = ((BaseState)this).FindModelChild("MuzzleFace");
		effectInstance = Object.Instantiate<GameObject>(Prefabs.beamMuzzleEffect, val.position, Quaternion.identity, val);
		effectInstance.transform.localPosition = Vector3.up * 0.1f;
		AddTether(effectInstance.transform, ((HuntressTracker)behaviour).trackingTarget.healthComponent, ((Component)((HuntressTracker)behaviour).trackingTarget).transform).transform.parent = ((EntityState)this).transform;
		AkSoundEngine.PostEvent("Play_siphonOnLowHealth_launch", ((EntityState)this).gameObject);
		AkSoundEngine.PostEvent("Play_siphonOnLowHealth_siphonLoop", ((EntityState)this).gameObject);
	}

	private GameObject AddTether(Transform parent, HealthComponent health, Transform target)
	{
		GameObject val = Object.Instantiate<GameObject>(Prefabs.tetherVFX, parent);
		TetherVfx component = val.GetComponent<TetherVfx>();
		component.tetherTargetTransform = target;
		tethers.Add(new KeyValuePair<TetherVfx, HealthComponent>(component, health));
		return val;
	}

	public override void FixedUpdate()
	{
		//IL_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0162: Unknown result type (might be due to invalid IL or missing references)
		//IL_018f: Unknown result type (might be due to invalid IL or missing references)
		//IL_027e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0283: Unknown result type (might be due to invalid IL or missing references)
		//IL_028b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0290: Unknown result type (might be due to invalid IL or missing references)
		//IL_0295: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e8: Expected O, but got Unknown
		//IL_030f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0315: Unknown result type (might be due to invalid IL or missing references)
		((EntityState)this).FixedUpdate();
		if (((EntityState)this).isAuthority && (!((BaseSkillState)this).IsKeyDownAuthority() || !Object.op_Implicit((Object)(object)target)))
		{
			((EntityState)this).outer.SetNextStateToMain();
		}
		stopwatch += Time.fixedDeltaTime;
		if (!(stopwatch >= 1f / MainPlugin.primary2Ticks.Value / ((BaseState)this).attackSpeedStat))
		{
			return;
		}
		stopwatch = 0f;
		for (int i = 0; i < tethers.Count; i++)
		{
			KeyValuePair<TetherVfx, HealthComponent> keyValuePair = tethers.ElementAt(i);
			TetherVfx key = keyValuePair.Key;
			HealthComponent value = keyValuePair.Value;
			if (!Object.op_Implicit((Object)(object)value))
			{
				tethers.RemoveAt(i);
				if (Object.op_Implicit((Object)(object)key))
				{
					((Behaviour)key.fadeOut).enabled = true;
				}
			}
		}
		int num = MainPlugin.primary2MaxTargets.Value + 1;
		if (tethers.Count < num)
		{
			for (int j = 0; j < num - tethers.Count; j++)
			{
				HealthComponent value2 = tethers.ElementAt(tethers.Count - 1).Value;
				search.origin = ((Component)value2).transform.position;
				search.radius = MainPlugin.primary2Range.Value;
				search.RefreshCandidates();
				search.FilterCandidatesByHurtBoxTeam(mask);
				search.OrderCandidatesByDistance();
				search.FilterCandidatesByDistinctHurtBoxEntities();
				search.FilterOutHurtBoxes(tethers);
				HurtBox val = search.GetHurtBoxes().FirstOrDefault();
				if (Object.op_Implicit((Object)(object)val))
				{
					AddTether(((Component)value2).transform, val.healthComponent, ((Component)val).transform);
				}
				search.ClearCandidates();
			}
		}
		if (!NetworkServer.active)
		{
			return;
		}
		float num2 = ((BaseState)this).damageStat * MainPlugin.primary2DamageCoefficient.Value;
		float value3 = MainPlugin.primary2Heal.Value;
		for (int k = 0; k < tethers.Count; k++)
		{
			HealthComponent value4 = tethers.ElementAt(k).Value;
			DamageInfo val2 = new DamageInfo
			{
				position = ((Component)value4).transform.position,
				attacker = ((EntityState)this).gameObject,
				inflictor = ((EntityState)this).gameObject,
				crit = ((BaseState)this).RollCrit(),
				procCoefficient = 1f,
				damage = num2,
				damageType = (DamageTypeCombo.GenericPrimary | DamageTypeCombo.op_Implicit((DamageType)512))
			};
			value4.TakeDamage(val2);
			if (value3 > 0f)
			{
				((EntityState)this).healthComponent.Heal(num2 * value3, default(ProcChainMask), true);
			}
			num2 *= MainPlugin.primary2DamageReduction.Value;
		}
	}

	public override void OnExit()
	{
		AkSoundEngine.PostEvent("Play_siphonOnLowHealth_retract", ((EntityState)this).gameObject);
		AkSoundEngine.PostEvent("Stop_siphonOnLowHealth_siphonLoop", ((EntityState)this).gameObject);
		if (Object.op_Implicit((Object)(object)effectInstance))
		{
			EntityState.Destroy((Object)(object)effectInstance);
		}
		foreach (KeyValuePair<TetherVfx, HealthComponent> tether in tethers)
		{
			if (Object.op_Implicit((Object)(object)tether.Key))
			{
				((Behaviour)tether.Key.fadeOut).enabled = true;
			}
		}
		((EntityState)this).OnExit();
	}

	public override InterruptPriority GetMinimumInterruptPriority()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		return (InterruptPriority)1;
	}
}
internal class PrimarySpikes : BaseSkillState
{
	private float duration;

	private bool isSecondary;

	public override void OnEnter()
	{
		//IL_019a: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a0: Invalid comparison between Unknown and I4
		//IL_0034: 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_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: 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_00c5: 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_0123: Unknown result type (might be due to invalid IL or missing references)
		((BaseState)this).OnEnter();
		duration = 1f / MainPlugin.primaryFireRate.Value / ((BaseState)this).attackSpeedStat;
		if (((EntityState)this).isAuthority)
		{
			Ray aimRay = ((BaseState)this).GetAimRay();
			FireProjectileInfo val = new FireProjectileInfo
			{
				position = ((Ray)(ref aimRay)).origin,
				rotation = Quaternion.LookRotation(((Ray)(ref aimRay)).direction),
				crit = ((EntityState)this).characterBody.RollCrit(),
				damage = ((EntityState)this).characterBody.damage * MainPlugin.primaryDamageCoefficient.Value,
				damageColorIndex = (DamageColorIndex)0,
				damageTypeOverride = (DamageTypeCombo.op_Implicit((DamageType)512) | (((int)((EntityState)this).skillLocator.FindSkillSlot(((BaseSkillState)this).activatorSkillSlot) == 0) ? DamageTypeCombo.GenericPrimary : DamageTypeCombo.GenericSecondary)),
				owner = ((EntityState)this).gameObject,
				procChainMask = default(ProcChainMask),
				force = 50f,
				useFuseOverride = false,
				useSpeedOverride = false,
				target = null,
				projectilePrefab = Prefabs.spikeProjectile
			};
			ProjectileManager.instance.FireProjectile(val);
		}
		float num = 1.5f;
		((BaseState)this).AddRecoil(-0.4f * num, -0.8f * num, -0.3f * num, 0.3f * num);
		((EntityState)this).characterBody.AddSpreadBloom(0.4f);
		EffectManager.SimpleMuzzleFlash(Prefabs.muzzleflash, ((EntityState)this).gameObject, "Muzzle", false);
		AkSoundEngine.PostEvent("Play_moonBrother_m1_laser_shoot", ((EntityState)this).gameObject);
		isSecondary = (int)((EntityState)this).skillLocator.FindSkillSlot(((BaseSkillState)this).activatorSkillSlot) == 1;
	}

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

	public override InterruptPriority GetMinimumInterruptPriority()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		return (InterruptPriority)((!isSecondary) ? 1 : 2);
	}
}
internal class Secondary : BaseSkillState
{
	private string animationLayerName = "Body";

	private string animationStateName = "FaceSlam";

	private string playbackRateParam = "FaceSlam.playbackRate";

	private static int FaceSlamStateHash = Animator.StringToHash("FaceSlam");

	private static int FaceSlamParamHash = Animator.StringToHash("FaceSlam.playbackRate");

	private string chargeEffectMuzzleString = "MuzzleFace";

	private float blastForceMagnitude = 3000f;

	private float blastUpwardForce = 1500f;

	private string blastMuzzleString = "MuzzleBlast";

	private float projectileForce = 1600f;

	private Transform modelTransform;

	private bool hasFiredBlast;

	private float duration;

	private float durationBeforeBlast;

	private GameObject chargeInstance;

	private float baseDuration => MainPlugin.secondaryDuration.Value;

	private float baseDurationBeforeBlast => MainPlugin.secondaryDelay.Value;

	private float blastDamageCoefficient => MainPlugin.secondaryDamageCoefficient.Value;

	private float projectileDamageCoefficient => MainPlugin.secondaryProjDamageCoefficient.Value;

	private float blastRadius => MainPlugin.secondaryRadius.Value;

	private float projectileSnapOnAngle => MainPlugin.secondaryProjSnapAngle.Value;

	public override void OnEnter()
	{
		//IL_008e: 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_00c7: 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)
		((BaseState)this).OnEnter();
		modelTransform = ((EntityState)this).GetModelTransform();
		duration = baseDuration / ((BaseState)this).attackSpeedStat;
		durationBeforeBlast = baseDurationBeforeBlast / ((BaseState)this).attackSpeedStat;
		Util.PlayAttackSpeedSound("Play_clayGrenadier_attack1_chargeup", ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat);
		((EntityState)this).PlayAnimation("Gesture, Override", "Secondary", "M2", duration, 0f);
		if (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection))
		{
			((EntityState)this).characterDirection.moveVector = ((EntityState)this).characterDirection.forward;
		}
		Transform val = ((BaseState)this).FindModelChild(chargeEffectMuzzleString);
		if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)FaceSlam.chargeEffectPrefab))
		{
			chargeInstance = Object.Instantiate<GameObject>(FaceSlam.chargeEffectPrefab, val.position, val.rotation);
			chargeInstance.transform.parent = val;
			ScaleParticleSystemDuration component = chargeInstance.GetComponent<ScaleParticleSystemDuration>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.newDuration = durationBeforeBlast;
			}
		}
		if (NetworkServer.active)
		{
			((EntityState)this).characterBody.AddTimedBuff(Buffs.HiddenInvincibility, duration);
		}
	}

	public override void FixedUpdate()
	{
		//IL_0054: 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_005f: 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_0065: 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_007e: Expected O, but got Unknown
		//IL_017e: 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)
		//IL_0182: 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_01a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_022d: Unknown result type (might be due to invalid IL or missing references)
		//IL_022f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c0: 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_00d2: 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_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_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_011b: 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_0138: 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_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_0143: 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_0152: 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_0168: Unknown result type (might be due to invalid IL or missing references)
		//IL_016a: 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_0171: 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_032a: Unknown result type (might be due to invalid IL or missing references)
		//IL_032c: Unknown result type (might be due to invalid IL or missing references)
		//IL_035c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0366: Unknown result type (might be due to invalid IL or missing references)
		//IL_036b: Unknown result type (might be due to invalid IL or missing references)
		//IL_023f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0246: Expected O, but got Unknown
		//IL_0255: Unknown result type (might be due to invalid IL or missing references)
		//IL_025a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0271: Unknown result type (might be due to invalid IL or missing references)
		//IL_027f: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0223: Unknown result type (might be due to invalid IL or missing references)
		//IL_0228: Unknown result type (might be due to invalid IL or missing references)
		//IL_0317: Unknown result type (might be due to invalid IL or missing references)
		//IL_031c: Unknown result type (might be due to invalid IL or missing references)
		((EntityState)this).FixedUpdate();
		if (((EntityState)this).fixedAge > durationBeforeBlast && !hasFiredBlast)
		{
			hasFiredBlast = true;
			if (Object.op_Implicit((Object)(object)chargeInstance))
			{
				EntityState.Destroy((Object)(object)chargeInstance);
			}
			Vector3 footPosition = ((EntityState)this).characterBody.footPosition;
			EffectManager.SpawnEffect(FaceSlam.blastImpactEffect, new EffectData
			{
				origin = footPosition,
				scale = blastRadius
			}, true);
			if (((EntityState)this).isAuthority)
			{
				if (Object.op_Implicit((Object)(object)modelTransform))
				{
					Transform val = ((BaseState)this).FindModelChild(blastMuzzleString);
					if (Object.op_Implicit((Object)(object)val))
					{
						new BlastAttack
						{
							attacker = ((EntityState)this).gameObject,
							inflictor = ((EntityState)this).gameObject,
							teamIndex = TeamComponent.GetObjectTeam(((EntityState)this).gameObject),
							baseDamage = ((BaseState)this).damageStat * blastDamageCoefficient,
							baseForce = blastForceMagnitude,
							position = val.position,
							radius = blastRadius,
							bonusForce = new Vector3(0f, blastUpwardForce, 0f),
							damageType = (DamageTypeCombo.GenericSecondary | DamageTypeCombo.op_Implicit((DamageType)512) | DamageTypeCombo.op_Implicit((DamageType)32)),
							attackerFiltering = (AttackerFiltering)2,
							falloffModel = (FalloffModel)0
						}.Fire();
					}
				}
				Vector3 val2 = footPosition;
				RaycastHit val3 = default(RaycastHit);
				if (Physics.Raycast(((BaseState)this).GetAimRay(), ref val3, 1000f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask) | LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask)))
				{
					val2 = ((RaycastHit)(ref val3)).point;
					if (Object.op_Implicit((Object)(object)((RaycastHit)(ref val3)).collider))
					{
						CharacterBody component = ((Component)((RaycastHit)(ref val3)).collider).GetComponent<CharacterBody>();
						if (Object.op_Implicit((Object)(object)component))
						{
							val2 = component.footPosition;
						}
						HurtBox component2 = ((Component)((RaycastHit)(ref val3)).collider).GetComponent<HurtBox>();
						if (Object.op_Implicit((Object)(object)component2))
						{
							val2 = component2.healthComponent.body.footPosition;
						}
					}
				}
				if (val2 == footPosition)
				{
					BullseyeSearch val4 = new BullseyeSearch();
					val4.viewer = ((EntityState)this).characterBody;
					val4.teamMaskFilter = TeamMask.allButNeutral;
					((TeamMask)(ref val4.teamMaskFilter)).RemoveTeam(((EntityState)this).characterBody.teamComponent.teamIndex);
					val4.sortMode = (SortMode)3;
					val4.minDistanceFilter = 0f;
					val4.maxDistanceFilter = 1000f;
					val4.searchOrigin = ((EntityState)this).inputBank.aimOrigin;
					val4.searchDirection = ((EntityState)this).inputBank.aimDirection;
					val4.maxAngleFilter = projectileSnapOnAngle;
					val4.filterByLoS = false;
					val4.RefreshCandidates();
					HurtBox val5 = val4.GetResults().FirstOrDefault();
					if (Object.op_Implicit((Object)(object)val5) && Object.op_Implicit((Object)(object)val5.healthComponent))
					{
						val2 = val5.healthComponent.body.footPosition;
					}
				}
				ProjectileManager.instance.FireProjectile(FaceSlam.projectilePrefab, val2, Quaternion.identity, ((EntityState)this).gameObject, ((EntityState)this).characterBody.damage * projectileDamageCoefficient, projectileForce, ((BaseState)this).RollCrit(), (DamageColorIndex)0, (GameObject)null, -1f, (DamageTypeCombo?)(DamageTypeCombo.GenericSecondary | DamageTypeCombo.op_Implicit((DamageType)512)));
			}
		}
		if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
		{
			((EntityState)this).outer.SetNextStateToMain();
		}
	}

	public override void OnExit()
	{
		if (Object.op_Implicit((Object)(object)chargeInstance))
		{
			EntityState.Destroy((Object)(object)chargeInstance);
		}
		((EntityState)this).OnExit();
	}

	public override InterruptPriority GetMinimumInterruptPriority()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		return (InterruptPriority)2;
	}
}
internal class Special : GenericProjectileBaseState
{
	[SerializeField]
	public float aimCalculationRaycastDistance;

	[SerializeField]
	public string animationLayerName = "Body";

	[SerializeField]
	public string animationStateName = "FaceSlam";

	[SerializeField]
	public string playbackRateParam = "FaceSlam.playbackRate";

	[SerializeField]
	public int projectileCount;

	[SerializeField]
	public float projectilePitchBonusPerProjectile;

	[SerializeField]
	public float projectileYawBonusPerProjectile;

	[SerializeField]
	public GameObject chargeEffectPrefab;

	[SerializeField]
	public string chargeEffectMuzzleString;

	[SerializeField]
	public string enterSoundString;

	private GameObject chargeInstance;

	private int currentProjectileCount;

	public override void OnEnter()
	{
		//IL_0157: Unknown result type (might be due to invalid IL or missing references)
		//IL_015c: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: 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_01ab: 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)
		aimCalculationRaycastDistance = 1000f;
		animationStateName = "";
		animationLayerName = "";
		base.damageCoefficient = MainPlugin.specialDamageCoefficient.Value;
		chargeEffectPrefab = Prefabs.Load<GameObject>("RoR2/DLC1/ClayGrenadier/ChargeClayGrenadierBarrel.prefab");
		base.projectilePrefab = Prefabs.ballProjectile;
		base.effectPrefab = Prefabs.Load<GameObject>("RoR2/Base/ClayBoss/MuzzleflashClayBoss.prefab467");
		chargeEffectMuzzleString = "MuzzleBetweenHands";
		base.bloom = 1f;
		base.baseDuration = MainPlugin.specialDuration.Value;
		base.baseDelayBeforeFiringProjectile = MainPlugin.specialFireDelay.Value;
		base.attackSoundString = "Play_clayGrenadier_attack2_throw";
		base.targetMuzzle = "MuzzleBetweenHands";
		base.recoilAmplitude = 1f;
		projectileYawBonusPerProjectile = 0f;
		projectilePitchBonusPerProjectile = -3f;
		base.projectilePitchBonus = 6f;
		projectileCount = MainPlugin.specialProjCount.Value;
		playbackRateParam = "ThrowBarrel.playbackRate";
		base.minSpread = 0f;
		base.maxSpread = MainPlugin.specialSpread.Value;
		base.force = 0f;
		enterSoundString = "Play_clayGrenadier_attack2_chargeup";
		((GenericProjectileBaseState)this).OnEnter();
		Util.PlayAttackSpeedSound(enterSoundString, ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat);
		if (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection))
		{
			CharacterDirection characterDirection = ((EntityState)this).characterDirection;
			Ray aimRay = ((BaseState)this).GetAimRay();
			characterDirection.moveVector = ((Ray)(ref aimRay)).direction;
		}
		((EntityState)this).characterBody.SetAimTimer(0f);
		Transform val = ((BaseState)this).FindModelChild(chargeEffectMuzzleString);
		if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)chargeEffectPrefab))
		{
			chargeInstance = Object.Instantiate<GameObject>(chargeEffectPrefab, val.position, val.rotation);
			chargeInstance.transform.parent = val;
			ScaleParticleSystemDuration component = chargeInstance.GetComponent<ScaleParticleSystemDuration>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.newDuration = base.delayBeforeFiringProjectile;
			}
		}
		if (NetworkServer.active)
		{
			((EntityState)this).characterBody.AddTimedBuff(Buffs.HiddenInvincibility, base.duration);
		}
		((ProjectileExplosion)Prefabs.ballProjectile.GetComponent<ProjectileImpactExplosion>()).blastRadius = MainPlugin.specialRadius.Value;
		((EntityState)this).PlayAnimation("Gesture, Override", "Special", "Special", base.duration, 0f);
	}

	public override void PlayAnimation(float duration)
	{
		((GenericProjectileBaseState)this).PlayAnimation(duration);
		((EntityState)this).PlayCrossfade(animationLayerName, animationStateName, playbackRateParam, duration, 0.2f);
	}

	public override Ray ModifyProjectileAimRay(Ray aimRay)
	{
		//IL_0003: 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_000a: 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_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: 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_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f4: 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_0134: 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_0070: 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_007c: 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_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: 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_00c5: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0139: Unknown result type (might be due to invalid IL or missing references)
		RaycastHit val = default(RaycastHit);
		Ray val2 = aimRay;
		float desiredForwardSpeed = base.projectilePrefab.GetComponent<ProjectileSimple>().desiredForwardSpeed;
		((Ray)(ref val2)).origin = ((Ray)(ref aimRay)).origin;
		if (Util.CharacterRaycast(((EntityState)this).gameObject, val2, ref val, float.PositiveInfinity, LayerMask.op_Implicit(LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask) | LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask)), (QueryTriggerInteraction)1))
		{
			float num = desiredForwardSpeed;
			Vector3 val3 = ((RaycastHit)(ref val)).point - ((Ray)(ref aimRay)).origin;
			Vector2 val4 = default(Vector2);
			((Vector2)(ref val4))..ctor(val3.x, val3.z);
			float magnitude = ((Vector2)(ref val4)).magnitude;
			float num2 = Trajectory.CalculateInitialYSpeed(magnitude / num, val3.y);
			Vector3 val5 = default(Vector3);
			((Vector3)(ref val5))..ctor(val4.x / magnitude * num, num2, val4.y / magnitude * num);
			desiredForwardSpeed = ((Vector3)(ref val5)).magnitude;
			((Ray)(ref aimRay)).direction = val5 / desiredForwardSpeed;
		}
		((Ray)(ref aimRay)).direction = Util.ApplySpread(((Ray)(ref aimRay)).direction, 0f, 0f, 1f, 1f, projectileYawBonusPerProjectile * (float)currentProjectileCount, projectilePitchBonusPerProjectile * (float)currentProjectileCount);
		return aimRay;
	}

	public override void FireProjectile()
	{
		for (int i = 0; i < projectileCount; i++)
		{
			((GenericProjectileBaseState)this).FireProjectile();
			currentProjectileCount++;
		}
		if (Object.op_Implicit((Object)(object)chargeInstance))
		{
			EntityState.Destroy((Object)(object)chargeInstance);
		}
	}

	public override void OnExit()
	{
		if (Object.op_Implicit((Object)(object)chargeInstance))
		{
			EntityState.Destroy((Object)(object)chargeInstance);
		}
		((GenericProjectileBaseState)this).OnExit();
	}

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

	private CharacterModel characterModel;

	private GameObject coreVfxInstance;

	private GameObject footVfxInstance;

	private float healTimer;

	private float duration;

	private ICharacterGravityParameterProvider characterGravityParameterProvider;

	private ICharacterFlightParameterProvider characterFlightParameterProvider;

	[SerializeField]
	public string animationLayerName;

	[SerializeField]
	public string animationStateName;

	[SerializeField]
	public string playbackRateParam;

	private EffectManagerHelper _emh_coreVfxInstance;

	private EffectManagerHelper _emh_footVfxInstance;

	private BlastAttack blastAttack;

	private float stopwatch = 1f;

	private float fireRate;

	public override void Reset()
	{
		((BaseState)this).Reset();
		hurtBoxGroup = null;
		characterModel = null;
		coreVfxInstance = null;
		footVfxInstance = null;
		healTimer = 0f;
		duration = 0f;
		_emh_coreVfxInstance = null;
		_emh_footVfxInstance = null;
	}

	public override void OnEnter()
	{
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0110: 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_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_0133: Expected O, but got Unknown
		//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_01ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e5: 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_01fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0301: Unknown result type (might be due to invalid IL or missing references)
		//IL_0311: Unknown result type (might be due to invalid IL or missing references)
		//IL_0312: Unknown result type (might be due to invalid IL or missing references)
		//IL_031c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0321: Unknown result type (might be due to invalid IL or missing references)
		//IL_0326: Unknown result type (might be due to invalid IL or missing references)
		//IL_032b: Unknown result type (might be due to invalid IL or missing references)
		//IL_032d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0332: Unknown result type (mig