Decompiled source of Acolyte Thorn Bound and Passive v0.8.7

plugins/AcolyteSacrificeHeal.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Acolyte;
using EntityStates.Acolyte.Backpack;
using EntityStates.Acolyte.Weapon;
using EntityStates.LilReaper;
using HarmonyLib;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.ContentManagement;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.ResourceManagement.AsyncOperations;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("AcolyteThornboundSmoke")]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace AcolyteSacrificeHeal
{
	internal sealed class AnimaBudget
	{
		private readonly HashSet<object> creditedVictims = new HashSet<object>();

		internal double GrantedSeconds { get; private set; }

		internal float Credit(object victim, float secondsPerKill, float maxSeconds)
		{
			if (victim == null || !Finite(secondsPerKill) || !Finite(maxSeconds) || secondsPerKill <= 0f || maxSeconds <= 0f)
			{
				return 0f;
			}
			double num = Math.Max(0.0, (double)maxSeconds - GrantedSeconds);
			if (num <= 0.0 || !creditedVictims.Add(victim))
			{
				return 0f;
			}
			double num2 = Math.Min(secondsPerKill, num);
			GrantedSeconds += num2;
			return (float)num2;
		}

		private static bool Finite(float value)
		{
			if (!float.IsNaN(value))
			{
				return !float.IsInfinity(value);
			}
			return false;
		}
	}
	internal sealed class AnimaExtension : IDisposable
	{
		private readonly ConfigEntry<bool> enabled;

		private readonly ConfigEntry<float> secondsPerKill;

		private readonly ConfigEntry<float> maxSeconds;

		private readonly ConfigEntry<bool> logExtensions;

		private readonly ManualLogSource logger;

		private readonly FieldInfo stopwatch;

		private readonly ConditionalWeakTable<BaseBackpackState, AnimaBudget> budgets = new ConditionalWeakTable<BaseBackpackState, AnimaBudget>();

		internal bool IsEnabled => enabled.Value;

		internal float SecondsPerKill => secondsPerKill.Value;

		internal float MaxBonusSeconds => maxSeconds.Value;

		internal AnimaExtension(ConfigFile config, ManualLogSource logger)
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			this.logger = logger;
			enabled = config.Bind<bool>("Anima", "Enabled", true, "Enemy kills credited to the player in Anima Harvester or Anima Echo form extend that transformation.");
			secondsPerKill = config.Bind<float>("Anima", "SecondsPerKill", 0.2f, new ConfigDescription("Seconds added per eligible enemy kill. Extracted souls, allied kills, and minion kills do not count.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f), Array.Empty<object>()));
			maxSeconds = config.Bind<float>("Anima", "MaxBonusSeconds", 3f, new ConfigDescription("Total bonus seconds available per transformation. Spending bonus time does not refill this allowance. Set to zero to disable.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f), Array.Empty<object>()));
			logExtensions = config.Bind<bool>("Debug", "LogAnimaExtensions", false, "Log bonus time per eligible kill and the total earned this transformation.");
			stopwatch = typeof(BaseBackpackState).GetField("stopwatch", BindingFlags.Instance | BindingFlags.NonPublic);
			if (stopwatch == null || stopwatch.FieldType != typeof(float))
			{
				throw new MissingFieldException("Anima Conviction drain timer changed; extension cannot initialize.");
			}
			GlobalEventManager.onCharacterDeathServer += OnDeath;
			logger.LogInfo((object)("Anima kill extension loaded: " + secondsPerKill.Value + "s per kill, maximum " + maxSeconds.Value + "s per transformation; enabled=" + enabled.Value));
		}

		private void OnDeath(DamageReport report)
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active || !enabled.Value || report == null)
			{
				return;
			}
			CharacterBody attackerBody = report.attackerBody;
			HealthComponent victim = report.victim;
			if (!Object.op_Implicit((Object)(object)attackerBody) || !attackerBody.isPlayerControlled || !Object.op_Implicit((Object)(object)victim) || !Object.op_Implicit((Object)(object)report.victimBody) || !Object.op_Implicit((Object)(object)attackerBody.healthComponent) || !attackerBody.healthComponent.alive || !Object.op_Implicit((Object)(object)attackerBody.teamComponent))
			{
				return;
			}
			TeamMask enemyTeams = TeamMask.GetEnemyTeams(attackerBody.teamComponent.teamIndex);
			if (!((TeamMask)(ref enemyTeams)).HasTeam(report.victimTeamIndex) || Object.op_Implicit((Object)(object)((Component)victim).GetComponent<ExtractedSoulController>()) || Object.op_Implicit((Object)(object)((Component)report.victimBody).GetComponent<ExtractedSoulController>()))
			{
				return;
			}
			AcolyteFormController component = ((Component)attackerBody).GetComponent<AcolyteFormController>();
			if (!Object.op_Implicit((Object)(object)component) || (!component.isReaperForm && !component.isEchoForm) || component.souls <= 0)
			{
				return;
			}
			EntityStateMachine val = EntityStateMachine.FindByCustomName(((Component)attackerBody).gameObject, "Backpack");
			BaseBackpackState val2 = (BaseBackpackState)(Object.op_Implicit((Object)(object)val) ? /*isinst with value type is only supported in some contexts*/: null);
			if ((!(val2 is ReaperActivate) || !component.isReaperForm) && (!(val2 is BackpackActivate) || !component.isEchoForm))
			{
				return;
			}
			EntityStateMachine[] components = ((Component)attackerBody).GetComponents<EntityStateMachine>();
			foreach (EntityStateMachine val3 in components)
			{
				if (val3.state is EnterBanish || val3.state is Return)
				{
					return;
				}
			}
			float num = (float)stopwatch.GetValue(val2);
			if (float.IsNaN(num) || float.IsInfinity(num))
			{
				return;
			}
			AnimaBudget value = budgets.GetValue(val2, (BaseBackpackState _) => new AnimaBudget());
			float num2 = value.Credit(victim, secondsPerKill.Value, maxSeconds.Value);
			if (!(num2 <= 0f))
			{
				stopwatch.SetValue(val2, num - num2);
				if (logExtensions.Value)
				{
					logger.LogInfo((object)("Anima kill: +" + num2.ToString("0.###") + "s; total " + value.GrantedSeconds.ToString("0.###") + "/" + maxSeconds.Value + "s this transformation."));
				}
			}
		}

		public void Dispose()
		{
			GlobalEventManager.onCharacterDeathServer -= OnDeath;
		}
	}
	[BepInPlugin("local.acolyte.sacrificeheal", "Acolyte Thorn Bound and Passive", "0.8.7")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public sealed class Plugin : BaseUnityPlugin
	{
		private sealed class HitContext
		{
			internal GenericDamageOrb Orb;

			internal HealthComponent Victim;

			internal HitContext Previous;

			internal bool Confirmed;
		}

		public const string PluginGuid = "local.acolyte.sacrificeheal";

		internal static Plugin Instance;

		private ConfigEntry<float> recoveryPercent;

		private ConfigEntry<bool> diagnosticLogging;

		private Harmony harmony;

		private AnimaExtension animaExtension;

		private TooltipPresentation presentation;

		private ThornboundModule thornbound;

		[ThreadStatic]
		private static HitContext currentHit;

		private void Awake()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Expected O, but got Unknown
			//IL_00e1: 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_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Expected O, but got Unknown
			//IL_0117: Expected O, but got Unknown
			//IL_0117: Expected O, but got Unknown
			Instance = this;
			recoveryPercent = ((BaseUnityPlugin)this).Config.Bind<float>("Healing", "MaxHealthPercent", 5f, new ConfigDescription("Maximum percent of max HP per successful normal-form Sacrifice hit. Restores HP from an existing reserve, or grants recoverable health if the reserve is empty. A hit grants one effect, never both.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()));
			diagnosticLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "LogHealing", false, "Log each Sacrifice HP transfer or empty-reserve grant for testing.");
			thornbound = new ThornboundModule(((BaseUnityPlugin)this).Config, ((BaseUnityPlugin)this).Logger);
			try
			{
				MethodInfo methodInfo = typeof(Sacrifice).GetNestedType("SacrificeOrb", BindingFlags.Public | BindingFlags.NonPublic)?.GetMethod("OnArrival", BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (methodInfo == null)
				{
					throw new MissingMethodException("SacrificeOrb.OnArrival: game version unsupported.");
				}
				harmony = new Harmony("local.acolyte.sacrificeheal");
				harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(Plugin), "BeginHit", (Type[])null), new HarmonyMethod(typeof(Plugin), "CompleteHit", (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(Plugin), "EndHit", (Type[])null), (HarmonyMethod)null);
				GlobalEventManager.onServerDamageDealt += OnDamageDealt;
				try
				{
					animaExtension = new AnimaExtension(((BaseUnityPlugin)this).Config, ((BaseUnityPlugin)this).Logger);
				}
				catch (Exception ex)
				{
					((BaseUnityPlugin)this).Logger.LogError((object)("Anima extension disabled; R healing remains active: " + ex));
				}
				try
				{
					presentation = new TooltipPresentation(recoveryPercent, animaExtension, ((BaseUnityPlugin)this).Logger);
				}
				catch (Exception ex2)
				{
					((BaseUnityPlugin)this).Logger.LogError((object)("Ability descriptions unavailable; gameplay remains active: " + ex2));
				}
				((BaseUnityPlugin)this).Logger.LogInfo((object)("Acolyte Thorn Bound and Passive 0.8.7 loaded. Normal-form R transfers up to " + recoveryPercent.Value + "% max HP from reserve, or grants recoverable health if empty."));
			}
			catch (Exception ex3)
			{
				Harmony obj = harmony;
				if (obj != null)
				{
					obj.UnpatchSelf();
				}
				((BaseUnityPlugin)this).Logger.LogError((object)("Acolyte Sacrifice Heal could not initialize: " + ex3));
				((Behaviour)this).enabled = false;
			}
		}

		private void OnDestroy()
		{
			presentation?.Dispose();
			thornbound?.Dispose();
			animaExtension?.Dispose();
			GlobalEventManager.onServerDamageDealt -= OnDamageDealt;
			Harmony obj = harmony;
			if (obj != null)
			{
				obj.UnpatchSelf();
			}
			if ((Object)(object)Instance == (Object)(object)this)
			{
				Instance = null;
			}
		}

		private static void BeginHit(GenericDamageOrb __instance, out HitContext __state)
		{
			__state = new HitContext
			{
				Orb = __instance,
				Previous = currentHit,
				Victim = (Object.op_Implicit((Object)(object)((Orb)__instance).target) ? ((Orb)__instance).target.healthComponent : null)
			};
			currentHit = __state;
		}

		private static void OnDamageDealt(DamageReport report)
		{
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			HitContext hitContext = currentHit;
			if (NetworkServer.active && hitContext != null && !hitContext.Confirmed && report?.damageInfo != null)
			{
				DamageInfo damageInfo = report.damageInfo;
				if (!((Object)(object)report.victim != (Object)(object)hitContext.Victim) && !((Object)(object)report.attacker != (Object)(object)hitContext.Orb.attacker) && !damageInfo.rejected && !(report.damageDealt <= 0f) && !Object.op_Implicit((Object)(object)damageInfo.inflictor) && ((ProcChainMask)(ref damageInfo.procChainMask)).Equals(hitContext.Orb.procChainMask) && damageInfo.damageType.damageSource == hitContext.Orb.damageType.damageSource)
				{
					hitContext.Confirmed = true;
				}
			}
		}

		private static void CompleteHit(HitContext __state)
		{
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Invalid comparison between Unknown and I4
			if (!NetworkServer.active || !__state.Confirmed || !Object.op_Implicit((Object)(object)Instance) || !Object.op_Implicit((Object)(object)__state.Orb.attacker))
			{
				return;
			}
			CharacterBody component = __state.Orb.attacker.GetComponent<CharacterBody>();
			AcolyteFormController component2 = __state.Orb.attacker.GetComponent<AcolyteFormController>();
			if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component2) || component2.inTransformation || !Object.op_Implicit((Object)(object)component.healthComponent) || !component.healthComponent.alive)
			{
				return;
			}
			HealthComponent healthComponent = component.healthComponent;
			bool eclipse = Object.op_Implicit((Object)(object)component.teamComponent) && (int)component.teamComponent.teamIndex == 1 && Object.op_Implicit((Object)(object)Run.instance) && (int)Run.instance.selectedDifficulty >= 7;
			RecoveryResult recoveryResult = SacrificeRecovery.Apply(healthComponent, Instance.recoveryPercent.Value, component.HasBuff(Buffs.HealingDisabled), eclipse);
			if (Instance.diagnosticLogging.Value)
			{
				if (recoveryResult.RestoredHP > 0f)
				{
					((BaseUnityPlugin)Instance).Logger.LogInfo((object)("Sacrifice restored " + recoveryResult.RestoredHP.ToString("0.##") + " HP; reserve remaining " + healthComponent.regainableHealth.ToString("0.##")));
				}
				else if (recoveryResult.GrantedReserve > 0f)
				{
					((BaseUnityPlugin)Instance).Logger.LogInfo((object)("Sacrifice granted " + recoveryResult.GrantedReserve.ToString("0.##") + " recoverable HP; HP unchanged by the bonus."));
				}
			}
		}

		private static Exception EndHit(Exception __exception, HitContext __state)
		{
			if (__state != null)
			{
				currentHit = __state.Previous;
			}
			return __exception;
		}
	}
	internal static class RecoveryRules
	{
		internal static float EmptyReserveAmount(float fullHealth, float health, float reserve, float percent, bool healingBlocked, bool eclipsePenalty)
		{
			if (reserve != 0f)
			{
				return 0f;
			}
			return Amount(fullHealth, health, fullHealth - health, percent, healingBlocked, eclipsePenalty);
		}

		internal static float Amount(float fullHealth, float health, float reserve, float percent, bool healingBlocked, bool eclipsePenalty)
		{
			if (healingBlocked || !Finite(fullHealth) || !Finite(health) || !Finite(reserve) || !Finite(percent) || fullHealth <= 0f || health <= 0f || reserve <= 0f)
			{
				return 0f;
			}
			float num = fullHealth * Math.Max(0f, Math.Min(100f, percent)) / 100f;
			if (eclipsePenalty)
			{
				num *= 0.5f;
			}
			return Math.Max(0f, Math.Min(num, Math.Min(reserve, fullHealth - health)));
		}

		private static bool Finite(float value)
		{
			if (!float.IsNaN(value))
			{
				return !float.IsInfinity(value);
			}
			return false;
		}
	}
	internal struct RecoveryResult
	{
		internal float RestoredHP;

		internal float GrantedReserve;
	}
	internal static class SacrificeRecovery
	{
		internal static RecoveryResult Apply(HealthComponent health, float percent, bool blocked, bool eclipse)
		{
			if (!Object.op_Implicit((Object)(object)health) || !health.alive)
			{
				return default(RecoveryResult);
			}
			if (health.regainableHealth == 0f)
			{
				float num = RecoveryRules.EmptyReserveAmount(health.fullHealth, health.health, health.regainableHealth, percent, blocked, eclipse);
				if (!(num > 0f))
				{
					return default(RecoveryResult);
				}
				return new RecoveryResult
				{
					GrantedReserve = health.GrantRegainableHealthServer(num)
				};
			}
			float num2 = RecoveryRules.Amount(health.fullHealth, health.health, health.regainableHealth, percent, blocked, eclipse);
			if (num2 <= 0f)
			{
				return default(RecoveryResult);
			}
			float num3 = health.SpendRegainableHealthServer(num2);
			health.Networkhealth = Math.Min(health.fullHealth, health.health + num3);
			return new RecoveryResult
			{
				RestoredHP = num3
			};
		}
	}
	internal static class ThornActions
	{
		private static readonly float[] LandingAngles = new float[8] { 0f, 45f, -45f, 90f, -90f, 135f, -135f, 180f };

		internal static void Assail(CharacterBody owner, Ray aim, int step)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: 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_006f: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active && Object.op_Implicit((Object)(object)owner))
			{
				Quaternion rotation = Util.QuaternionSafeLookRotation(((Ray)(ref aim)).direction) * Quaternion.Euler(0f, 0f, (step == 0) ? 20f : (-20f));
				ProjectileManager.instance.FireProjectile(new FireProjectileInfo
				{
					projectilePrefab = ThornboundContent.Thorn,
					owner = ((Component)owner).gameObject,
					position = ((Ray)(ref aim)).origin,
					rotation = rotation,
					damage = owner.damage * 2.5f,
					crit = Util.CheckRoll(owner.crit, owner.master),
					force = 0f
				});
			}
		}

		internal static bool Reap(CharacterBody owner, CharacterBody target)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: 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_0028: 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_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Expected O, but got Unknown
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Expected O, but got Unknown
			if (!NetworkServer.active || !ValidTarget(owner, target))
			{
				return false;
			}
			if (!TryPlanReap(owner, target, out var rootDestination))
			{
				return false;
			}
			Vector3 corePosition = owner.corePosition;
			Vector3 val = corePosition + rootDestination - ((Component)owner).transform.position;
			Vector3 val2 = target.corePosition - val;
			Vector3 normalized = ((Vector3)(ref val2)).normalized;
			Effect(ThornboundContent.ReapEffect, corePosition, normalized);
			TeleportHelper.TeleportGameObject(((Component)owner).gameObject, rootDestination);
			Physics.SyncTransforms();
			Effect(ThornboundContent.ReapEffect, val, normalized);
			Swing(val, normalized, 0);
			Vector3 val3 = (Object.op_Implicit((Object)(object)target.mainHurtBox) ? ((Component)target.mainHurtBox).transform.position : target.corePosition);
			DamageInfo val4 = new DamageInfo
			{
				attacker = ((Component)owner).gameObject,
				inflictor = ((Component)owner).gameObject,
				damage = owner.damage * 2f,
				crit = Util.CheckRoll(owner.crit, owner.master),
				position = val3,
				procCoefficient = 0.8f,
				damageType = new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)0), (DamageTypeExtended)0, (DamageSource)2)
			};
			target.healthComponent.TakeDamage(val4);
			GlobalEventManager.instance.OnHitEnemy(val4, ((Component)target).gameObject);
			GlobalEventManager.instance.OnHitAll(val4, ((Component)target).gameObject);
			ThornCombat.Fire(ThornboundContent.BriarPatch, owner, ThornBrambleStrike.GroundPoint(val3), Vector3.forward, owner.damage * 1f, val4.crit, null);
			if (Object.op_Implicit((Object)(object)ThornboundContent.ReapBurstEffect))
			{
				EffectManager.SpawnEffect(ThornboundContent.ReapBurstEffect, new EffectData
				{
					origin = val3,
					rotation = Quaternion.identity,
					scale = 0.35f
				}, true);
			}
			return true;
		}

		internal static bool ValidTarget(CharacterBody owner, CharacterBody target)
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: 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_00a5: 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_00aa: 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_00b9: 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_00cd: 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_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: 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_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)owner) && Object.op_Implicit((Object)(object)target) && Object.op_Implicit((Object)(object)owner.healthComponent) && owner.healthComponent.alive && Object.op_Implicit((Object)(object)target.healthComponent) && target.healthComponent.alive && Object.op_Implicit((Object)(object)owner.teamComponent) && Object.op_Implicit((Object)(object)target.teamComponent))
			{
				TeamMask enemyTeams = TeamMask.GetEnemyTeams(owner.teamComponent.teamIndex);
				if (((TeamMask)(ref enemyTeams)).HasTeam(target.teamComponent.teamIndex))
				{
					Vector3 val = (Object.op_Implicit((Object)(object)target.mainHurtBox) ? ((Component)target.mainHurtBox).transform.position : target.corePosition);
					Vector3 val2 = (Object.op_Implicit((Object)(object)owner.inputBank) ? owner.inputBank.aimOrigin : owner.corePosition);
					if (Vector3.Distance(owner.corePosition, val) <= 37f)
					{
						LayerIndex world = LayerIndex.world;
						return !Physics.Linecast(val2, val, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1);
					}
					return false;
				}
			}
			return false;
		}

		internal static bool TryPlanReap(CharacterBody owner, CharacterBody target, out Vector3 rootDestination)
		{
			//IL_0016: 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_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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_00b1: 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_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: 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_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: 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_01a8: 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_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: 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_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: 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_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: 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_026f: 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_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: 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_02cd: 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_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: 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_0313: 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)
			//IL_031a: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0331: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			rootDestination = (Object.op_Implicit((Object)(object)owner) ? ((Component)owner).transform.position : Vector3.zero);
			if (!ValidTarget(owner, target))
			{
				return false;
			}
			CapsuleCollider val = ((Object.op_Implicit((Object)(object)owner.characterMotor) && Object.op_Implicit((Object)(object)((BaseCharacterController)owner.characterMotor).Motor)) ? ((BaseCharacterController)owner.characterMotor).Motor.Capsule : ((Component)owner).GetComponent<CapsuleCollider>());
			Vector3 position = ((Component)owner).transform.position;
			Vector3 val2 = (Object.op_Implicit((Object)(object)val) ? (((Component)val).transform.TransformPoint(val.center) - position) : Vector3.up);
			float num = (Object.op_Implicit((Object)(object)val) ? (val.radius * Mathf.Max(((Component)val).transform.lossyScale.x, ((Component)val).transform.lossyScale.z)) : 0.6f);
			float num2 = (Object.op_Implicit((Object)(object)val) ? Mathf.Max(num, val.height * ((Component)val).transform.lossyScale.y * 0.5f) : 1f);
			float num3 = Mathf.Max(0.2f, num - 0.03f);
			float num4 = Mathf.Max(num3, num2 - 0.03f);
			float num5 = val2.y - num2;
			Vector3 val3 = Vector3.ProjectOnPlane(position - target.footPosition, Vector3.up);
			Vector3 val4 = ((Vector3)(ref val3)).normalized;
			if (((Vector3)(ref val4)).sqrMagnitude < 0.1f)
			{
				val4 = Vector3.back;
			}
			float num6 = Mathf.Max(2.5f, num + target.radius + 0.5f);
			float[] landingAngles = LandingAngles;
			RaycastHit val7 = default(RaycastHit);
			foreach (float num7 in landingAngles)
			{
				Vector3 val5 = target.footPosition + Quaternion.AngleAxis(num7, Vector3.up) * val4 * num6;
				Vector3 val6 = val5 + Vector3.up * 2.5f;
				Vector3 down = Vector3.down;
				LayerIndex world = LayerIndex.world;
				if (Physics.Raycast(val6, down, ref val7, 8f, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1) && Mathf.Abs(((RaycastHit)(ref val7)).point.y - val5.y) <= 2f)
				{
					val5.y = ((RaycastHit)(ref val7)).point.y + 0.1f;
				}
				Vector3 val8 = val5 - Vector3.up * num5;
				float num8 = Vector3.Distance(val8, position);
				if (num8 < 0.8f || num8 > 36f)
				{
					continue;
				}
				Vector3 val9 = val8 + val2;
				Vector3 val10 = val9 + Vector3.up * (num4 - num3);
				Vector3 val11 = val9 - Vector3.up * (num4 - num3);
				world = LayerIndex.world;
				if (Physics.CheckCapsule(val11, val10, num3, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1))
				{
					continue;
				}
				Vector3 val12 = position + val2;
				world = LayerIndex.world;
				if (!Physics.Linecast(val12, val9, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1))
				{
					Vector3 val13 = (Object.op_Implicit((Object)(object)target.mainHurtBox) ? ((Component)target.mainHurtBox).transform.position : target.corePosition);
					world = LayerIndex.world;
					if (!Physics.Linecast(val9, val13, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1))
					{
						rootDestination = val8;
						return true;
					}
				}
			}
			return false;
		}

		private static void Swing(Vector3 origin, Vector3 direction, int step)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			if (Object.op_Implicit((Object)(object)ThornboundContent.SwingEffect))
			{
				EffectManager.SpawnEffect(ThornboundContent.SwingEffect, new EffectData
				{
					origin = origin,
					rotation = Util.QuaternionSafeLookRotation(direction) * Quaternion.Euler(0f, 0f, (step == 0) ? (-20f) : 20f),
					scale = 0.45f
				}, true);
			}
		}

		private static void Effect(GameObject prefab, Vector3 origin, Vector3 direction)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			if (Object.op_Implicit((Object)(object)prefab))
			{
				EffectManager.SpawnEffect(prefab, new EffectData
				{
					origin = origin,
					rotation = Util.QuaternionSafeLookRotation(direction),
					scale = 0.5f
				}, true);
			}
		}
	}
	public sealed class ThornAssail : BaseSkillState, IStepSetter
	{
		private float duration;

		private bool fired;

		private int step;

		public void SetStep(int step)
		{
			this.step = step & 1;
		}

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			duration = 0.7f / Mathf.Max(0.1f, ((BaseState)this).attackSpeedStat);
			((BaseState)this).StartAimMode(duration + 0.5f, false);
			((EntityState)this).PlayCrossfade("FullBody, Override", (step == 0) ? "Assail1" : "Assail2", "Primary.playbackRate", duration, 0.05f);
		}

		public override void FixedUpdate()
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (!fired && ((EntityState)this).fixedAge >= duration * 0.3f)
			{
				fired = true;
				Util.PlaySound("Play_Champ_Reaper_Primary_Swing", ((EntityState)this).gameObject);
				if (NetworkServer.active)
				{
					ThornActions.Assail(((EntityState)this).characterBody, ((BaseState)this).GetAimRay(), step);
				}
			}
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

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

		public override void OnDeserialize(NetworkReader reader)
		{
			((BaseSkillState)this).OnDeserialize(reader);
			step = reader.ReadByte() & 1;
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)1;
		}
	}
	public sealed class BrambleStormCast : BaseSkillState
	{
		public override void OnEnter()
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			ThornboundController component = ((EntityState)this).GetComponent<ThornboundController>();
			if (!Object.op_Implicit((Object)(object)component) || !component.TryStorm())
			{
				if (((EntityState)this).isAuthority)
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
				return;
			}
			((BaseState)this).StartAimMode(3f, false);
			((EntityState)this).PlayAnimation("FullBody, Override", "FireSoulStorm", "Utility.playbackRate", 0.8f, 0f);
			if (NetworkServer.active)
			{
				new GameObject("ThornboundCommittedStorm").AddComponent<ThornStorm>().Initialize(((EntityState)this).characterBody, ((BaseState)this).GetAimRay());
			}
		}

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

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)1;
		}
	}
	public sealed class ThornReap : BaseSkillState
	{
		private GameObject targetObject;

		internal void SetTarget(HurtBox target)
		{
			targetObject = ((Object.op_Implicit((Object)(object)target) && Object.op_Implicit((Object)(object)target.healthComponent)) ? ((Component)target.healthComponent).gameObject : null);
		}

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			((BaseState)this).StartAimMode(1f, false);
			((EntityState)this).PlayAnimation("FullBody, Override", "SwingScythe", "Primary.playbackRate", 0.5f, 0f);
			if (NetworkServer.active && (!Object.op_Implicit((Object)(object)targetObject) || !ThornActions.Reap(((EntityState)this).characterBody, targetObject.GetComponent<CharacterBody>())) && ((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)((BaseSkillState)this).activatorSkillSlot))
			{
				((BaseSkillState)this).activatorSkillSlot.AddOneStock();
			}
		}

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

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

		public override void OnDeserialize(NetworkReader reader)
		{
			((BaseSkillState)this).OnDeserialize(reader);
			targetObject = reader.ReadGameObject();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
	public sealed class ThornboundContent : IContentPackProvider
	{
		private readonly ContentPack pack = new ContentPack();

		internal static SkillDef Form;

		internal static SkillDef Primary;

		internal static SkillDef Storm;

		internal static SkillDef Reap;

		internal static GameObject Thorn;

		internal static GameObject Tendril;

		internal static GameObject GroundBramble;

		internal static GameObject BriarPatch;

		internal static GameObject BrambleLine;

		internal static GameObject Impact;

		internal static GameObject Telegraph;

		internal static GameObject SwingEffect;

		internal static GameObject ReapEffect;

		internal static GameObject ReapBurstEffect;

		internal static GameObject StormSourceEffect;

		internal static Material TrailMaterial;

		internal static Material TelegraphMaterial;

		internal static SkillFamily Family;

		private static BuffDef brambleSlow;

		public string identifier => "local.acolyte.sacrificeheal.thornbound";

		public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
		{
			AsyncOperationHandle<GameObject> bodyLoad = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC4/Acolyte/AcolyteBody.prefab");
			yield return bodyLoad;
			GameObject body = bodyLoad.Result;
			if (!Object.op_Implicit((Object)(object)body))
			{
				throw new InvalidOperationException("Acolyte body unavailable.");
			}
			ThornboundIcons.Load();
			AsyncOperationHandle<BuffDef> slowLoad = Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/Base/Common/bdSlow50.asset");
			yield return slowLoad;
			brambleSlow = slowLoad.Result;
			if (!Object.op_Implicit((Object)(object)brambleSlow))
			{
				throw new InvalidOperationException("Native slow buff unavailable.");
			}
			Family = body.GetComponent<AcolyteFormController>().transformSkillSlot.skillFamily;
			Form = Object.Instantiate<SkillDef>(Family.variants.Select((Variant v) => v.skillDef).First((SkillDef d) => d.skillNameToken == "ACOLYTE_SPECIAL_TRANSFORM_NAME"));
			((Object)Form).name = (Form.skillName = "AcolyteThornboundAnima");
			Form.skillNameToken = "THORNBOUND_FORM_NAME";
			Form.skillDescriptionToken = "THORNBOUND_FORM_DESCRIPTION";
			Form.icon = ThornboundIcons.Form;
			Primary = Skill<ThornAssail>("PRIMARY", "Thorn Assail", "Swing to launch a broad, piercing green slash for <style=cIsDamage>250% damage</style>. Uses the Harvester's sweeping projectile shape. Each wave damages an enemy once.", ThornboundIcons.Primary, 0f, press: false);
			Storm = Skill<BrambleStormCast>("STORM", "Bramble Storm", "After <style=cIsUtility>3s</style>, unleash <style=cIsDamage>18 bramble strikes</style> over <style=cIsUtility>9s</style>. Favor bosses, elites, and groups, spreading strikes among nearby enemies. White lines track briefly, then lock: growing spikes deal <style=cIsDamage>200% damage</style>, followed by a <style=cIsDamage>150% damage</style> ground eruption with a <style=cIsUtility>1.5s fuse</style>. Both hits <style=cIsUtility>slow by 50% for 2s</style>. <style=cIsUtility>One cast per transformation.</style> The storm persists after returning.", ThornboundIcons.Storm, 999f, press: true);
			Storm.hideCooldown = true;
			Storm.isCooldownBlockedUntilManuallyReset = true;
			Reap = Skill<ThornReap>("REAP", "Briar Reap", "Lock onto <style=cIsUtility>one enemy within 36m</style> using the M2 marker. Blink beside it and strike for <style=cIsDamage>200% damage</style>. Plant a <style=cIsUtility>4m bramble patch for 3s</style>, dealing <style=cIsDamage>100% total damage</style> and refreshing a <style=cIsUtility>50% slow for 2s</style> on its hits. Requires a visible target and a clear landing spot. <style=cIsUtility>7s cooldown.</style>", ThornboundIcons.Reap, 7f, press: true);
			LanguageAPI.Add("THORNBOUND_FORM_NAME", "Thornbound Anima");
			LanguageAPI.Add("THORNBOUND_FORM_DESCRIPTION", Description());
			AsyncOperationHandle<GameObject> ghostLoad = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC4/ReaperBoss/BrambleStormSpikeProjectileGroundGhost.prefab");
			AsyncOperationHandle<GameObject> impactLoad = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC4/ReaperBoss/ReapBossBrambleStormGroundExplosionVFX.prefab");
			AsyncOperationHandle<GameObject> telegraphLoad = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC4/ReaperBoss/BrambleAnticipationVFX.prefab");
			AsyncOperationHandle<Material> materialLoad = Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC4/ReaperBoss/matReaperBrambleBlast.mat");
			AsyncOperationHandle<GameObject> initialLoad = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC4/ReaperBoss/BrambleStormSpikeProjectileInitial.prefab");
			AsyncOperationHandle<GameObject> groundLoad = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC4/ReaperBoss/BrambleStormSpikeProjectileGround.prefab");
			AsyncOperationHandle<GameObject> lineLoad = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC4/ReaperBoss/Line.prefab");
			AsyncOperationHandle<GameObject> swingLoad = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC4/ReaperBoss/ReaperBossAssailSwipe.prefab");
			AsyncOperationHandle<GameObject> reapLoad = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC4/ReaperBoss/ReaperBossReapTeleportVFXVariant.prefab");
			AsyncOperationHandle<GameObject> waveLoad = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC4/LilReaper/SlashStormProjectile.prefab");
			yield return ghostLoad;
			yield return impactLoad;
			yield return telegraphLoad;
			yield return materialLoad;
			yield return initialLoad;
			yield return groundLoad;
			yield return lineLoad;
			yield return swingLoad;
			yield return reapLoad;
			yield return waveLoad;
			if (!Object.op_Implicit((Object)(object)ghostLoad.Result) || !Object.op_Implicit((Object)(object)impactLoad.Result) || !Object.op_Implicit((Object)(object)telegraphLoad.Result) || !Object.op_Implicit((Object)(object)initialLoad.Result) || !Object.op_Implicit((Object)(object)groundLoad.Result) || !Object.op_Implicit((Object)(object)lineLoad.Result))
			{
				throw new InvalidOperationException("Native bramble assets unavailable.");
			}
			Impact = impactLoad.Result;
			Telegraph = telegraphLoad.Result;
			TrailMaterial = materialLoad.Result;
			SwingEffect = PlayerEffect(swingLoad.Result, "ThornboundAssailSwing");
			SwingEffect.GetComponent<EffectComponent>().soundName = "Play_Champ_Reaper_Primary_Swing";
			ReapEffect = PlayerEffect(reapLoad.Result, "ThornboundReapTeleport");
			ReapBurstEffect = PlayerEffect(impactLoad.Result, "ThornboundReapBrambleBurst");
			EffectManagerHelper component = ReapBurstEffect.GetComponent<EffectManagerHelper>();
			if (Object.op_Implicit((Object)(object)component))
			{
				Object.DestroyImmediate((Object)(object)component);
			}
			ReapBurstEffect.GetComponent<VFXAttributes>().DoNotPool = true;
			ReapBurstEffect.GetComponent<EffectComponent>().applyScaleFirst = true;
			Transform[] componentsInChildren = ReapBurstEffect.GetComponentsInChildren<Transform>(true);
			foreach (Transform val in componentsInChildren)
			{
				if (((Object)val).name == "Flash" || ((Object)val).name == "DistortionOut")
				{
					((Component)val).gameObject.SetActive(false);
				}
			}
			pack.effectDefs.Add((EffectDef[])(object)new EffectDef[3]
			{
				new EffectDef(SwingEffect),
				new EffectDef(ReapEffect),
				new EffectDef(ReapBurstEffect)
			});
			BrambleLine = lineLoad.Result;
			TelegraphMaterial = new Material(((Renderer)BrambleLine.GetComponent<LineRenderer>()).sharedMaterial);
			((Object)TelegraphMaterial).name = "ThornboundWhiteTelegraph";
			if (TelegraphMaterial.HasProperty("_RemapTex"))
			{
				TelegraphMaterial.SetTexture("_RemapTex", (Texture)(object)Texture2D.whiteTexture);
			}
			if (TelegraphMaterial.HasProperty("_TintColor"))
			{
				TelegraphMaterial.SetColor("_TintColor", Color.white);
			}
			if (TelegraphMaterial.HasProperty("_Color"))
			{
				TelegraphMaterial.SetColor("_Color", Color.white);
			}
			GameObject val2 = PrefabAPI.InstantiateClone(ghostLoad.Result, "ThornboundBrambleGhost", false);
			MonoBehaviour[] componentsInChildren2 = val2.GetComponentsInChildren<MonoBehaviour>(true);
			foreach (MonoBehaviour val3 in componentsInChildren2)
			{
				if (!(val3 is ProjectileGhostController) && !((object)val3).GetType().Name.StartsWith("Ak"))
				{
					Object.DestroyImmediate((Object)(object)val3);
				}
			}
			if (!Object.op_Implicit((Object)(object)val2.GetComponent<ProjectileGhostController>()))
			{
				val2.AddComponent<ProjectileGhostController>();
			}
			val2.transform.localScale = Vector3.one * 0.24f;
			if (!Object.op_Implicit((Object)(object)waveLoad.Result))
			{
				throw new InvalidOperationException("Native Harvester wave unavailable.");
			}
			Thorn = PrefabAPI.InstantiateClone(waveLoad.Result, "ThornboundBrambleWave", true);
			ProjectileController component2 = Thorn.GetComponent<ProjectileController>();
			component2.allowPrediction = false;
			component2.procCoefficient = 1f;
			Thorn.GetComponent<ProjectileDamage>().damageType = new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)0), (DamageTypeExtended)0, (DamageSource)1);
			ProjectileOverlapAttack component3 = Thorn.GetComponent<ProjectileOverlapAttack>();
			component3.resetInterval = -1f;
			component3.isOverrideTeam = false;
			component3.attackFiltering = (AttackerFiltering)2;
			GameObject val4 = (component2.ghostPrefab = PrefabAPI.InstantiateClone(component2.ghostPrefab, "ThornboundBrambleWaveGhost", false));
			component2.ghostPrefabAddress = (AssetReferenceT<GameObject>)new AssetReferenceGameObject("");
			componentsInChildren = val4.GetComponentsInChildren<Transform>(true);
			foreach (Transform val5 in componentsInChildren)
			{
				if (((Object)val5).name == "Tracers")
				{
					((Component)val5).gameObject.SetActive(false);
				}
			}
			ThornWaveVisuals.RemoveCenterFin(val4);
			Light[] componentsInChildren3 = val4.GetComponentsInChildren<Light>(true);
			for (int num = 0; num < componentsInChildren3.Length; num++)
			{
				componentsInChildren3[num].color = new Color(0.2f, 1f, 0.08f);
			}
			Renderer[] componentsInChildren4 = val4.GetComponentsInChildren<Renderer>(true);
			foreach (Renderer val6 in componentsInChildren4)
			{
				Material[] sharedMaterials = val6.sharedMaterials;
				for (int num2 = 0; num2 < sharedMaterials.Length; num2++)
				{
					if (Object.op_Implicit((Object)(object)sharedMaterials[num2]))
					{
						Material val7 = new Material(sharedMaterials[num2]);
						((Object)val7).name = "ThornboundBrambleWave_" + ((Object)sharedMaterials[num2]).name;
						if (val7.HasProperty("_TintColor"))
						{
							val7.SetColor("_TintColor", new Color(0.12f, 3.5f, 0.12f));
						}
						sharedMaterials[num2] = val7;
					}
				}
				val6.sharedMaterials = sharedMaterials;
			}
			GroundBramble = PrefabAPI.InstantiateClone(groundLoad.Result, "ThornboundGroundBramble", true);
			componentsInChildren2 = GroundBramble.GetComponents<MonoBehaviour>();
			foreach (MonoBehaviour val8 in componentsInChildren2)
			{
				if (((object)val8).GetType().Name == "ProjectileReaperExtractSoul" || val8 is ScenePropInstance)
				{
					Object.DestroyImmediate((Object)(object)val8);
				}
			}
			ProjectileExplosion component4 = GroundBramble.GetComponent<ProjectileExplosion>();
			component4.timedDebuffs = new List<TimedDebuffInfo>();
			component4.blastRadius = 4f;
			component4.blastDamageCoefficient = 1f;
			component4.blastAttackerFiltering = (AttackerFiltering)2;
			component4.falloffModel = (FalloffModel)0;
			GroundBramble.GetComponent<ProjectileFuse>().fuse = 1.5f;
			GroundBramble.GetComponent<ProjectileController>().allowPrediction = false;
			GroundBramble.GetComponent<ProjectileController>().procCoefficient = 0.5f;
			GroundBramble.GetComponent<ProjectileDamage>().damageType = SecondaryDamage();
			Slow(GroundBramble);
			BriarPatch = PrefabAPI.InstantiateClone(GroundBramble, "ThornboundBriarPatch", true);
			Object.DestroyImmediate((Object)(object)BriarPatch.GetComponent<ProjectileExplosion>());
			Object.DestroyImmediate((Object)(object)BriarPatch.GetComponent<ProjectileFuse>());
			ProjectileController component5 = BriarPatch.GetComponent<ProjectileController>();
			component5.procCoefficient = 0.25f;
			BriarPatch.GetComponent<ProjectileDamage>().damageType = new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)0), (DamageTypeExtended)0, (DamageSource)2);
			GameObject val9 = PrefabAPI.InstantiateClone(val2, "ThornboundBriarPatchGhost", false);
			val9.transform.localScale = Vector3.one * 0.3f;
			for (int num3 = 0; num3 < 6; num3++)
			{
				GameObject obj = PrefabAPI.InstantiateClone(val2, "PatchThorn" + num3, false);
				Object.DestroyImmediate((Object)(object)obj.GetComponent<ProjectileGhostController>());
				obj.transform.SetParent(val9.transform, false);
				obj.transform.localScale = Vector3.one * 0.65f;
				obj.transform.localPosition = Quaternion.AngleAxis((float)num3 * 60f, Vector3.up) * Vector3.forward * 7f;
			}
			componentsInChildren4 = val9.GetComponentsInChildren<Renderer>(true);
			foreach (Renderer val10 in componentsInChildren4)
			{
				Material[] sharedMaterials2 = val10.sharedMaterials;
				for (int num4 = 0; num4 < sharedMaterials2.Length; num4++)
				{
					if (Object.op_Implicit((Object)(object)sharedMaterials2[num4]))
					{
						Material val11 = new Material(sharedMaterials2[num4]);
						((Object)val11).name = "ThornboundGreenPatch_" + ((Object)sharedMaterials2[num4]).name;
						if (val11.HasProperty("_TintColor"))
						{
							val11.SetColor("_TintColor", new Color(0.12f, 3.5f, 0.12f));
						}
						if (val11.HasProperty("_Color"))
						{
							val11.SetColor("_Color", new Color(0.15f, 0.8f, 0.12f));
						}
						sharedMaterials2[num4] = val11;
					}
				}
				val10.sharedMaterials = sharedMaterials2;
			}
			component5.ghostPrefab = val9;
			component5.ghostPrefabAddress = (AssetReferenceT<GameObject>)new AssetReferenceGameObject("");
			BriarPatch.AddComponent<ThornBriarPatch>();
			StormSourceEffect = PrefabAPI.InstantiateClone(val9, "ThornboundStormSource", false);
			Object.DestroyImmediate((Object)(object)StormSourceEffect.GetComponent<ProjectileGhostController>());
			componentsInChildren = ((IEnumerable)StormSourceEffect.transform).Cast<Transform>().ToArray();
			for (int num = 0; num < componentsInChildren.Length; num++)
			{
				Object.DestroyImmediate((Object)(object)((Component)componentsInChildren[num]).gameObject);
			}
			componentsInChildren4 = StormSourceEffect.GetComponents<Renderer>();
			for (int num = 0; num < componentsInChildren4.Length; num++)
			{
				Object.DestroyImmediate((Object)(object)componentsInChildren4[num]);
			}
			MeshFilter[] components = StormSourceEffect.GetComponents<MeshFilter>();
			for (int num = 0; num < components.Length; num++)
			{
				Object.DestroyImmediate((Object)(object)components[num]);
			}
			StormSourceEffect.transform.localScale = Vector3.one;
			Collider[] componentsInChildren5 = StormSourceEffect.GetComponentsInChildren<Collider>(true);
			for (int num = 0; num < componentsInChildren5.Length; num++)
			{
				Object.DestroyImmediate((Object)(object)componentsInChildren5[num]);
			}
			ShakeEmitter[] componentsInChildren6 = StormSourceEffect.GetComponentsInChildren<ShakeEmitter>(true);
			for (int num = 0; num < componentsInChildren6.Length; num++)
			{
				Object.DestroyImmediate((Object)(object)componentsInChildren6[num]);
			}
			EffectComponent obj2 = StormSourceEffect.AddComponent<EffectComponent>();
			obj2.applyScale = false;
			obj2.positionAtReferencedTransform = false;
			obj2.parentToReferencedTransform = false;
			StormSourceEffect.AddComponent<VFXAttributes>().DoNotPool = true;
			StormSourceEffect.AddComponent<DestroyOnTimer>().duration = 13.85f;
			Material val12 = new Material(TelegraphMaterial);
			((Object)val12).name = "ThornboundGreenSourceRing";
			if (val12.HasProperty("_TintColor"))
			{
				val12.SetColor("_TintColor", new Color(0.35f, 1f, 0.08f));
			}
			if (val12.HasProperty("_Color"))
			{
				val12.SetColor("_Color", new Color(0.35f, 1f, 0.08f));
			}
			SourceRing(StormSourceEffect, val12, 2.4f, 0.12f, thorns: true);
			SourceRing(StormSourceEffect, val12, 1.7f, 0.07f, thorns: false);
			pack.effectDefs.Add((EffectDef[])(object)new EffectDef[1]
			{
				new EffectDef(StormSourceEffect)
			});
			Tendril = PrefabAPI.InstantiateClone(initialLoad.Result, "ThornboundGrowingBramble", true);
			Tendril.GetComponent<ProjectileController>().allowPrediction = false;
			Tendril.GetComponent<ProjectileController>().procCoefficient = 0.5f;
			Tendril.GetComponent<ProjectileDamage>().damageType = SecondaryDamage();
			Slow(Tendril);
			ProjectileOverlapAttack component6 = Tendril.GetComponent<ProjectileOverlapAttack>();
			component6.isOverrideTeam = false;
			component6.damageCoefficient = 0.5714286f;
			component6.overlapProcCoefficient = 1f;
			component6.attackFiltering = (AttackerFiltering)2;
			((Behaviour)component6).enabled = false;
			((Behaviour)Tendril.GetComponent<ProjectileMalachiteSpike>()).enabled = false;
			Object.DestroyImmediate((Object)(object)Tendril.GetComponent<ProjectileFireChildren>());
			Object.DestroyImmediate((Object)(object)Tendril.GetComponent<DestroyOnTimer>());
			Tendril.AddComponent<ThornBrambleStrike>();
			pack.projectilePrefabs.Add((GameObject[])(object)new GameObject[4] { Thorn, Tendril, GroundBramble, BriarPatch });
			pack.skillDefs.Add((SkillDef[])(object)new SkillDef[4] { Form, Primary, Storm, Reap });
			pack.entityStateTypes.Add(new Type[3]
			{
				typeof(ThornAssail),
				typeof(BrambleStormCast),
				typeof(ThornReap)
			});
			args.ReportProgress(1f);
		}

		private static DamageTypeCombo SecondaryDamage()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			return new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)0), (DamageTypeExtended)0, (DamageSource)4);
		}

		private static void Slow(GameObject projectile)
		{
			ProjectileInflictTimedBuff obj = projectile.AddComponent<ProjectileInflictTimedBuff>();
			obj.buffDef = brambleSlow;
			obj.duration = 2f;
		}

		private static void SourceRing(GameObject parent, Material material, float radius, float width, bool thorns)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(thorns ? "ThornRim" : "InnerRing");
			val.transform.SetParent(parent.transform, false);
			LineRenderer val2 = val.AddComponent<LineRenderer>();
			((Renderer)val2).sharedMaterial = material;
			val2.useWorldSpace = false;
			val2.loop = true;
			val2.positionCount = 64;
			float startWidth = (val2.endWidth = width);
			val2.startWidth = startWidth;
			Color val3 = default(Color);
			((Color)(ref val3))..ctor(0.35f, 1f, 0.08f);
			val2.endColor = val3;
			val2.startColor = val3;
			for (int i = 0; i < val2.positionCount; i++)
			{
				float num2 = (float)i * (float)Math.PI * 2f / (float)val2.positionCount;
				float num3 = ((thorns && i % 8 == 0) ? (radius + 0.7f) : radius);
				val2.SetPosition(i, new Vector3(Mathf.Sin(num2) * num3, 0f, Mathf.Cos(num2) * num3));
			}
		}

		private static GameObject PlayerEffect(GameObject source, string name)
		{
			if (!Object.op_Implicit((Object)(object)source))
			{
				throw new InvalidOperationException("Native swing/teleport effect unavailable.");
			}
			GameObject val = PrefabAPI.InstantiateClone(source, name, false);
			EffectComponent component = val.GetComponent<EffectComponent>();
			component.applyScale = true;
			component.positionAtReferencedTransform = false;
			component.parentToReferencedTransform = false;
			ShakeEmitter[] componentsInChildren = val.GetComponentsInChildren<ShakeEmitter>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)componentsInChildren[i]);
			}
			return val;
		}

		private SkillDef Skill<T>(string token, string title, string description, Sprite icon, float cooldown, bool press) where T : EntityState
		{
			//IL_0093: 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)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			SkillDef val;
			if (!(token == "PRIMARY"))
			{
				val = (SkillDef)(object)((!(token == "REAP")) ? ((ThornReapSkillDef)(object)ScriptableObject.CreateInstance<SkillDef>()) : ScriptableObject.CreateInstance<ThornReapSkillDef>());
			}
			else
			{
				SteppedSkillDef obj = ScriptableObject.CreateInstance<SteppedSkillDef>();
				obj.stepCount = 2;
				obj.stepGraceDuration = 2f;
				val = (SkillDef)(object)obj;
			}
			((Object)val).name = (val.skillName = "Thornbound" + token);
			val.skillNameToken = "THORNBOUND_" + token + "_NAME";
			val.skillDescriptionToken = "THORNBOUND_" + token + "_DESCRIPTION";
			val.activationState = new SerializableEntityStateType(typeof(T));
			val.activationStateMachineName = "Weapon";
			val.interruptPriority = (InterruptPriority)(!(token == "PRIMARY"));
			if (token == "REAP")
			{
				val.interruptPriority = (InterruptPriority)2;
			}
			val.icon = icon;
			val.baseMaxStock = 1;
			val.rechargeStock = 1;
			val.requiredStock = 1;
			val.stockToConsume = ((cooldown > 0f) ? 1 : 0);
			val.baseRechargeInterval = cooldown;
			val.fullRestockOnAssign = true;
			val.beginSkillCooldownOnSkillEnd = true;
			val.mustKeyPress = press;
			val.isCombatSkill = true;
			val.cancelSprintingOnActivation = true;
			LanguageAPI.Add(val.skillNameToken, title);
			LanguageAPI.Add(val.skillDescriptionToken, description);
			return val;
		}

		internal static string Description()
		{
			return "Transform into <style=cIsDamage>Thornbound Anima</style> for <style=cIsUtility>" + ThornboundModule.Duration.Value.ToString("0.#", CultureInfo.InvariantCulture) + "s</style> at full Convictions. Gain Thorn Assail, a short Briar Reap blink, and a telegraphed Bramble Storm. <style=cIsUtility>One storm per transformation.</style> White tracking lines lock before spikes grow and erupt. The storm finishes after you return. Uses the Anima Harvester model and normal recoverable-health mechanics.";
		}

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

		public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
		{
			if (!Family.variants.Any((Variant v) => (Object)(object)v.skillDef == (Object)(object)Form))
			{
				List<Variant> list = Family.variants.ToList();
				Variant item = new Variant
				{
					skillDef = Form
				};
				((Variant)(ref item)).viewableNode = new Node("ThornboundAnima", false, (Node)null);
				list.Add(item);
				Family.variants = list.ToArray();
			}
			args.ReportProgress(1f);
			yield break;
		}
	}
	internal static class ThornboundIcons
	{
		internal static Sprite Form;

		internal static Sprite Primary;

		internal static Sprite Reap;

		internal static Sprite Storm;

		internal static void Load()
		{
			if (!Object.op_Implicit((Object)(object)Form))
			{
				Form = Read("thornbound-anima");
				Primary = Read("thorn-assail");
				Reap = Read("briar-reap");
				Storm = Read("bramble-storm");
			}
		}

		private static Sprite Read(string name)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			string name2 = "AcolyteSacrificeHeal.Icons." + name + ".png";
			using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(name2);
			using MemoryStream memoryStream = new MemoryStream();
			if (stream == null)
			{
				throw new InvalidOperationException("Missing embedded icon: " + name);
			}
			stream.CopyTo(memoryStream);
			Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
			((Object)val).name = "ThornboundIcon_" + name;
			((Texture)val).wrapMode = (TextureWrapMode)1;
			((Texture)val).filterMode = (FilterMode)1;
			if (!ImageConversion.LoadImage(val, memoryStream.ToArray(), true))
			{
				throw new InvalidOperationException("Could not decode icon: " + name);
			}
			Sprite obj = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f);
			((Object)obj).name = ((Object)val).name;
			return obj;
		}
	}
	internal sealed class ThornboundModule : IDisposable
	{
		internal static ConfigEntry<float> Duration;

		private readonly ConfigEntry<bool> enabled;

		private readonly ManualLogSource log;

		private readonly Harmony hooks = new Harmony("local.acolyte.sacrificeheal.thornbound");

		internal ThornboundModule(ConfigFile config, ManualLogSource log)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Expected O, but got Unknown
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Expected O, but got Unknown
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Expected O, but got Unknown
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Expected O, but got Unknown
			this.log = log;
			enabled = config.Bind<bool>("Thornbound", "Enabled", true, "Register the third Litany option, Thornbound Anima. Restart required; all multiplayer participants need matching settings.");
			Duration = config.Bind<float>("Thornbound", "DurationSeconds", 24f, new ConfigDescription("Duration at full Convictions. Storm winds up for 3s and fires for 9s; tracking lines, growing spikes, and delayed eruptions finish independently of form duration.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(20f, 40f), Array.Empty<object>()));
			if (enabled.Value)
			{
				hooks.Patch((MethodBase)AccessTools.Method(typeof(BaseBackpackState), "OnEnter", (Type[])null, (Type[])null), new HarmonyMethod(typeof(ThornboundModule), "Enter", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				hooks.Patch((MethodBase)AccessTools.Method(typeof(AcolyteBodySwapController), "SwapBodyInternal", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(ThornboundModule), "Swapped", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				hooks.Patch((MethodBase)AccessTools.Method(typeof(AcolyteBodySwapController), "UnswapBodyInternal", (Type[])null, (Type[])null), new HarmonyMethod(typeof(ThornboundModule), "Unswapping", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(Collect);
				RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(Loaded));
			}
		}

		private void Collect(AddContentPackProviderDelegate add)
		{
			add.Invoke((IContentPackProvider)(object)new ThornboundContent());
		}

		internal static bool Selected(AcolyteFormController form)
		{
			if (Object.op_Implicit((Object)(object)form) && Object.op_Implicit((Object)(object)form.transformSkillSlot) && Object.op_Implicit((Object)(object)ThornboundContent.Form))
			{
				return (Object)(object)form.transformSkillSlot.skillDef == (Object)(object)ThornboundContent.Form;
			}
			return false;
		}

		private static void Enter(BaseBackpackState __instance)
		{
			if (__instance is ReaperActivate)
			{
				AcolyteFormController component = ((Component)((EntityState)__instance).outer).GetComponent<AcolyteFormController>();
				if (Selected(component))
				{
					__instance.duration = Duration.Value;
					(((Component)component).GetComponent<ThornboundController>() ?? ((Component)component).gameObject.AddComponent<ThornboundController>()).Begin(__instance);
				}
			}
		}

		private static void Swapped(AcolyteBodySwapController __instance)
		{
			ThornboundController component = ((Component)__instance).GetComponent<ThornboundController>();
			if (Object.op_Implicit((Object)(object)component) && component.Active)
			{
				component.ApplySkills();
			}
		}

		private static void Unswapping(AcolyteBodySwapController __instance)
		{
			ThornboundController component = ((Component)__instance).GetComponent<ThornboundController>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.End();
			}
		}

		private void Loaded()
		{
			try
			{
				if (!Object.op_Implicit((Object)(object)ThornboundContent.Form) || ThornboundContent.Form.skillIndex < 0)
				{
					throw new InvalidOperationException("Third Litany skill is absent from the catalog.");
				}
				if (ProjectileCatalog.GetProjectileIndex(ThornboundContent.Tendril) < 0 || ProjectileCatalog.GetProjectileIndex(ThornboundContent.GroundBramble) < 0 || ProjectileCatalog.GetProjectileIndex(ThornboundContent.BriarPatch) < 0)
				{
					throw new InvalidOperationException("Growing bramble, ground eruption, or Reap patch is absent from the projectile catalog.");
				}
				log.LogInfo((object)("THORNBOUND CATALOG PASS: third Litany, attacks, and projectile registered. Full-duration form " + Duration.Value + "s; 3s windup, 9s storm, one cast per transformation."));
			}
			catch (Exception ex)
			{
				log.LogError((object)("THORNBOUND CATALOG FAILURE: " + ex));
			}
		}

		public void Dispose()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			ContentManager.collectContentPackProviders -= new CollectContentPackProvidersDelegate(Collect);
			RoR2Application.onLoad = (Action)Delegate.Remove(RoR2Application.onLoad, new Action(Loaded));
			hooks.UnpatchSelf();
		}
	}
	public sealed class ThornboundController : MonoBehaviour
	{
		private BaseBackpackState state;

		private bool spentStorm;

		private SkillLocator skills;

		private ThornReapLock targetLock;

		internal bool Active { get; private set; }

		internal void Begin(BaseBackpackState state)
		{
			End();
			this.state = state;
			spentStorm = false;
			Active = true;
		}

		internal bool TryStorm()
		{
			if (Active && state != null)
			{
				return ThornboundRules.TrySpendStorm(ref spentStorm);
			}
			return false;
		}

		internal void ApplySkills()
		{
			skills = ((Component)this).GetComponent<SkillLocator>();
			if (Object.op_Implicit((Object)(object)skills))
			{
				targetLock = ((Component)this).GetComponent<ThornReapLock>() ?? ((Component)this).gameObject.AddComponent<ThornReapLock>();
				targetLock.Begin();
				Set(skills.primary, ThornboundContent.Primary);
				Set(skills.secondary, ThornboundContent.Reap);
				Set(skills.utility, ThornboundContent.Storm);
			}
		}

		private void Set(GenericSkill slot, SkillDef def)
		{
			if (Object.op_Implicit((Object)(object)slot) && Object.op_Implicit((Object)(object)def))
			{
				slot.SetSkillOverride((object)this, def, (SkillOverridePriority)4);
			}
		}

		private void Unset(GenericSkill slot, SkillDef def)
		{
			if (Object.op_Implicit((Object)(object)slot) && Object.op_Implicit((Object)(object)def))
			{
				slot.UnsetSkillOverride((object)this, def, (SkillOverridePriority)4);
			}
		}

		internal void End()
		{
			if (Object.op_Implicit((Object)(object)targetLock))
			{
				targetLock.End();
			}
			targetLock = null;
			if (Object.op_Implicit((Object)(object)skills))
			{
				Unset(skills.primary, ThornboundContent.Primary);
				Unset(skills.secondary, ThornboundContent.Reap);
				Unset(skills.utility, ThornboundContent.Storm);
			}
			Active = false;
			state = null;
			skills = null;
		}

		private void FixedUpdate()
		{
			if (Active)
			{
				AcolyteFormController component = ((Component)this).GetComponent<AcolyteFormController>();
				if (!Object.op_Implicit((Object)(object)component) || !component.inTransformation || !Object.op_Implicit((Object)(object)((EntityState)state).outer) || (object)((EntityState)state).outer.state != state)
				{
					End();
				}
			}
		}

		private void OnDestroy()
		{
			End();
		}
	}
	internal static class ThornboundRules
	{
		internal const float Windup = 3f;

		internal const float StormDuration = 9f;

		internal const float FlightLifetime = 8f;

		internal const float TrackingTime = 0.75f;

		internal const float GrowthTime = 1.1f;

		internal const int Tendrils = 18;

		internal const float PrimaryDamage = 2.5f;

		internal const float PrimaryDuration = 0.7f;

		internal const float StormSpikeDamage = 2f;

		internal const float StormEruptionDamage = 1.5f;

		internal const float EruptionFuse = 1.5f;

		internal const float StormDamage = 3.5f;

		internal const float ReapDamage = 2f;

		internal const float ReapRange = 36f;

		internal const float ReapCooldown = 7f;

		internal const float ReapBurstDamage = 1f;

		internal const float ReapBurstRadius = 4f;

		internal const float PatchDuration = 3f;

		internal const float PatchInterval = 0.5f;

		internal const float SlowDuration = 2f;

		internal const int PatchPulses = 6;

		internal const float StormHeight = 18f;

		internal const float StormSourceDuration = 13.85f;

		internal static int DueTendrils(float age)
		{
			if (float.IsNaN(age) || age < 3f)
			{
				return 0;
			}
			return Math.Min(18, 1 + (int)((age - 3f) / 0.5f));
		}

		internal static bool TrySpendStorm(ref bool spent)
		{
			if (spent)
			{
				return false;
			}
			spent = true;
			return true;
		}

		internal static bool SpreadStrike(int index)
		{
			return index % 3 == 2;
		}
	}
	public sealed class ThornBrambleStrike : NetworkBehaviour
	{
		private const BindingFlags Private = BindingFlags.Instance | BindingFlags.NonPublic;

		private static readonly MethodInfo InitializeProjectile = typeof(ProjectileManager).GetMethod("InitializeProjectile", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);

		private static readonly FieldInfo MaxDistance = Field("maxDistance");

		private static readonly FieldInfo Penetration = Field("penetrateDistance");

		private static readonly FieldInfo TargetHeight = Field("targetPositionHeightOffset");

		private static readonly FieldInfo GoToTarget = Field("goToProjectileTarget");

		private ProjectileController controller;

		private ProjectileMalachiteSpike spike;

		private LineRenderer line;

		private Vector3 endpoint;

		private float age;

		private float syncAge;

		private bool ready;

		private bool locked;

		private bool activated;

		private bool erupted;

		internal Vector3 Endpoint => endpoint;

		internal bool Locked => locked;

		internal bool Activated => activated;

		internal LineRenderer TelegraphLine => line;

		private static FieldInfo Field(string name)
		{
			return typeof(ProjectileMalachiteSpike).GetField(name, BindingFlags.Instance | BindingFlags.NonPublic) ?? throw new MissingFieldException(typeof(ProjectileMalachiteSpike).FullName, name);
		}

		internal static ThornBrambleStrike Fire(CharacterBody owner, Vector3 origin, Vector3 destination, HurtBox target, float damage, bool crit)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active || !Object.op_Implicit((Object)(object)owner) || !Object.op_Implicit((Object)(object)ThornboundContent.Tendril))
			{
				return null;
			}
			Quaternion val = Util.QuaternionSafeLookRotation(destination - origin);
			GameObject val2 = Object.Instantiate<GameObject>(ThornboundContent.Tendril, origin, val);
			ThornBrambleStrike component = val2.GetComponent<ThornBrambleStrike>();
			component.endpoint = Clip(origin, destination);
			component.ready = true;
			InitializeProjectile.Invoke(null, new object[2]
			{
				val2.GetComponent<ProjectileController>(),
				(object)new FireProjectileInfo
				{
					projectilePrefab = ThornboundContent.Tendril,
					owner = ((Component)owner).gameObject,
					position = origin,
					rotation = val,
					target = (Object.op_Implicit((Object)(object)target) ? ((Component)target).gameObject : null),
					damage = damage,
					crit = crit,
					force = 0f
				}
			});
			NetworkServer.Spawn(val2);
			return component;
		}

		private void Awake()
		{
			controller = ((Component)this).GetComponent<ProjectileController>();
			spike = ((Component)this).GetComponent<ProjectileMalachiteSpike>();
		}

		private void Start()
		{
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: 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)
			if (Object.op_Implicit((Object)(object)ThornboundContent.BrambleLine))
			{
				GameObject val = Object.Instantiate<GameObject>(ThornboundContent.BrambleLine, ((Component)this).transform);
				line = val.GetComponent<LineRenderer>();
				((Renderer)line).sharedMaterial = ThornboundContent.TelegraphMaterial;
				line.useWorldSpace = true;
				line.positionCount = 2;
				line.startWidth = 0.12f;
				line.endWidth = 0.06f;
				LineRenderer obj = line;
				Color startColor = (line.endColor = Color.white);
				obj.startColor = startColor;
			}
			Draw();
		}

		private static Vector3 Clip(Vector3 origin, Vector3 destination)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: 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_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: 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_0028: 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_0045: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Vector3.ClampMagnitude(destination - origin, 85f);
			Vector3 normalized = ((Vector3)(ref val)).normalized;
			float magnitude = ((Vector3)(ref val)).magnitude;
			LayerIndex world = LayerIndex.world;
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(origin, normalized, ref val2, magnitude, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1))
			{
				return ((RaycastHit)(ref val2)).point;
			}
			return origin + val;
		}

		internal static Vector3 GroundPoint(Vector3 point)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: 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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = point + Vector3.up * 6f;
			Vector3 down = Vector3.down;
			LayerIndex world = LayerIndex.world;
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(val, down, ref val2, 50f, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1))
			{
				return ((RaycastHit)(ref val2)).point + Vector3.up * 0.1f;
			}
			return point;
		}

		private void FixedUpdate()
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: 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_0140: Unknown result type (might be due to invalid IL or missing references)
			if (!ready)
			{
				return;
			}
			age += Time.fixedDeltaTime;
			if (NetworkServer.active)
			{
				if (!locked)
				{
					HurtBox targetHurtBox = ((Component)this).GetComponent<ProjectileTargetComponent>().targetHurtBox;
					if (Object.op_Implicit((Object)(object)targetHurtBox) && Object.op_Implicit((Object)(object)targetHurtBox.healthComponent) && targetHurtBox.healthComponent.alive)
					{
						endpoint = Clip(((Component)this).transform.position, ThornTargeting.AimPoint(targetHurtBox));
					}
					if (age >= 0.75f)
					{
						locked = true;
					}
					syncAge += Time.fixedDeltaTime;
					if (locked || syncAge >= 0.1f)
					{
						((NetworkBehaviour)this).SetDirtyBit(1u);
						syncAge = 0f;
					}
				}
				if (locked && !erupted && age >= 1.85f)
				{
					erupted = true;
					ProjectileDamage component = ((Component)this).GetComponent<ProjectileDamage>();
					ThornCombat.Fire(ThornboundContent.GroundBramble, Object.op_Implicit((Object)(object)controller.owner) ? controller.owner.GetComponent<CharacterBody>() : null, endpoint, Vector3.up, component.damage * 0.42857143f, component.crit, null, controller.procChainMask);
				}
				if (age >= 3.75f)
				{
					NetworkServer.Destroy(((Component)this).gameObject);
					return;
				}
			}
			if (locked && !activated)
			{
				Activate();
			}
			Draw();
		}

		private void Activate()
		{
			//IL_0008: 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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			activated = true;
			Vector3 val = endpoint - ((Component)this).transform.position;
			((Component)this).transform.rotation = Util.QuaternionSafeLookRotation(val);
			MaxDistance.SetValue(spike, Mathf.Max(0.1f, ((Vector3)(ref val)).magnitude));
			Penetration.SetValue(spike, 0f);
			TargetHeight.SetValue(spike, 0f);
			GoToTarget.SetValue(spike, false);
			((Behaviour)spike).enabled = true;
			((Behaviour)((Component)this).GetComponent<ProjectileOverlapAttack>()).enabled = NetworkServer.active;
		}

		private void Draw()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)line))
			{
				((Renderer)line).enabled = ready && (!locked || age < 1.85f);
				line.SetPosition(0, ((Component)this).transform.position);
				line.SetPosition(1, endpoint);
			}
		}

		public override bool OnSerialize(NetworkWriter writer, bool initialState)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			writer.Write(ready);
			writer.Write(endpoint);
			writer.Write(locked);
			writer.Write(age);
			return true;
		}

		public override void OnDeserialize(NetworkReader reader, bool initialState)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			ready = reader.ReadBoolean();
			endpoint = reader.ReadVector3();
			locked = reader.ReadBoolean();
			age = reader.ReadSingle();
		}
	}
	public sealed class ThornBriarPatch : MonoBehaviour
	{
		private ProjectileController controller;

		private ProjectileDamage damage;

		private float age;

		private int pulses;

		private void Awake()
		{
			controller = ((Component)this).GetComponent<ProjectileController>();
			damage = ((Component)this).GetComponent<ProjectileDamage>();
		}

		private void FixedUpdate()
		{
			//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_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: 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_0120: 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_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Expected O, but got Unknown
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				return;
			}
			if (!Object.op_Implicit((Object)(object)controller.owner))
			{
				NetworkServer.Destroy(((Component)this).gameObject);
				return;
			}
			CharacterBody component = controller.owner.GetComponent<CharacterBody>();
			if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.healthComponent) || !component.healthComponent.alive)
			{
				NetworkServer.Destroy(((Component)this).gameObject);
				return;
			}
			age += Time.fixedDeltaTime;
			while (pulses < 6 && age >= (float)pulses * 0.5f)
			{
				new BlastAttack
				{
					attacker = controller.owner,
					inflictor = ((Component)this).gameObject,
					teamIndex = controller.teamFilter.teamIndex,
					position = ((Component)this).transform.position,
					radius = 4f,
					baseDamage = damage.damage / 6f,
					crit = damage.crit,
					procCoefficient = controller.procCoefficient / 6f,
					procChainMask = controller.procChainMask,
					damageType = damage.damageType,
					attackerFiltering = (AttackerFiltering)6,
					filterCallback = new CustomFilter(CanHit),
					falloffModel = (FalloffModel)0,
					losType = (LoSType)1
				}.Fire();
				pulses++;
			}
			if (age >= 3f)
			{
				NetworkServer.Destroy(((Component)this).gameObject);
			}
		}

		private bool CanHit(BlastAttackFilterStruct hit)
		{
			//IL_0000: 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)
			//IL_0024: 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_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody val = (Object.op_Implicit((Object)(object)hit.healthComponent) ? hit.healthComponent.body : null);
			if (Object.op_Implicit((Object)(object)val) && hit.healthComponent.alive && Object.op_Implicit((Object)(object)val.teamComponent))
			{
				TeamMask enemyTeams = TeamMask.GetEnemyTeams(controller.teamFilter.teamIndex);
				if (((TeamMask)(ref enemyTeams)).HasTeam(val.teamComponent.teamIndex))
				{
					Vector3 val2 = (Object.op_Implicit((Object)(object)val.mainHurtBox) ? ((Component)val.mainHurtBox).transform.position : val.corePosition);
					Vector3 val3 = ((Component)this).transform.position + Vector3.up * 0.1f;
					LayerIndex world = LayerIndex.world;
					return !Physics.Linecast(val3, val2, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1);
				}
			}
			return false;
		}
	}
	internal static class ThornCombat
	{
		internal static void Fire(GameObject prefab, CharacterBody owner, Vector3 origin, Vector3 direction, float damage, bool crit, HurtBox target, ProcChainMask procChainMask = default(ProcChainMask))
		{
			//IL_001f: 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_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active && Object.op_Implicit((Object)(object)prefab) && Object.op_Implicit((Object)(object)owner))
			{
				ProjectileManager.instance.FireProjectile(new FireProjectileInfo
				{
					projectilePrefab = prefab,
					owner = ((Component)owner).gameObject,
					position = origin,
					rotation = Util.QuaternionSafeLookRotation(direction),
					damage = damage,
					crit = crit,
					target = (Object.op_Implicit((Object)(object)target) ? ((Component)target).gameObject : null),
					force = 0f,
					procChainMask = procChainMask
				});
			}
		}
	}
	public sealed class ThornStorm : MonoBehaviour
	{
		private CharacterBody owner;

		private Ray aim;

		private Vector3 origin;

		private float age;

		private float damage;

		private bool crit;

		private int fired;

		private readonly Queue<CharacterBody> recent = new Queue<CharacterBody>();

		internal void Initialize(CharacterBody owner, Ray aim)
		{
			//IL_0008: 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_0039: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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)
			this.owner = owner;
			this.aim = aim;
			damage = owner.damage * 3.5f;
			crit = Util.CheckRoll(owner.crit, owner.master);
			origin = LaunchOrigin(owner.corePosition);
			if (Object.op_Implicit((Object)(object)ThornboundContent.Telegraph))
			{
				EffectManager.SimpleEffect(ThornboundContent.Telegraph, origin, Quaternion.identity, true);
			}
			if (Object.op_Implicit((Object)(object)Thornbo