Decompiled source of Itachi v1.0.0

plugins/Itachi/Itachi.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization.Json;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using ExtraSkillSlots;
using KinematicCharacterController;
using On.RoR2;
using On.RoR2.UI;
using R2API;
using R2API.Utils;
using Rewired;
using RoR2;
using RoR2.Achievements;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.Navigation;
using RoR2.Skills;
using RoR2.UI;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Itachi")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+8ca1dc24264be23d2b4ab84a252e0cb3b3789fae")]
[assembly: AssemblyProduct("Itachi")]
[assembly: AssemblyTitle("Itachi")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ItachiMod;

public static class Ama
{
	public static float IgniteAt = 0.2f;

	public static float CastTime = 0.48f;

	public static float Cone = 5f;

	public static float TickEvery = 0.5f;

	public static float EyeSeconds = 1.8f;

	public static int MaxPatchesPerCaster = 3;

	public static int Casts;

	public static int Ignitions;

	public static int Ticks;

	public static int Patches;

	public static bool Pick(CharacterBody b, Ray aim, out HurtBox hb, out Vector3 point)
	{
		//IL_0004: 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_0023: 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_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ff: 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_0064: 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_0074: 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_0086: 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_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		//IL_014d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0152: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01be: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_017d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0182: Unknown result type (might be due to invalid IL or missing references)
		hb = null;
		point = Vector3.zero;
		if (!Object.op_Implicit((Object)(object)b))
		{
			return false;
		}
		float value = Tuning.AmaRange.Value;
		Vector3 val;
		if (Combat.AimHit(aim, b, value + 12f, out var best) && Object.op_Implicit((Object)(object)((RaycastHit)(ref best)).collider))
		{
			HurtBox component = ((Component)((RaycastHit)(ref best)).collider).GetComponent<HurtBox>();
			if (Object.op_Implicit((Object)(object)component) && Combat.Target(component, b))
			{
				val = ((RaycastHit)(ref best)).point - b.corePosition;
				if (((Vector3)(ref val)).magnitude <= value)
				{
					hb = component;
					point = ((RaycastHit)(ref best)).point;
					return true;
				}
			}
		}
		BullseyeSearch val2 = new BullseyeSearch
		{
			searchOrigin = ((Ray)(ref aim)).origin,
			searchDirection = ((Ray)(ref aim)).direction,
			maxDistanceFilter = value + 12f,
			maxAngleFilter = Cone,
			teamMaskFilter = TeamMask.all,
			filterByLoS = true,
			sortMode = (SortMode)2,
			viewer = b
		};
		((TeamMask)(ref val2.teamMaskFilter)).RemoveTeam(b.teamComponent.teamIndex);
		val2.RefreshCandidates();
		val2.FilterOutGameObject(((Component)b).gameObject);
		foreach (HurtBox result in val2.GetResults())
		{
			if (Object.op_Implicit((Object)(object)result) && Combat.Target(result, b))
			{
				val = ((Component)result).transform.position - b.corePosition;
				if (((Vector3)(ref val)).magnitude <= value && !Object.op_Implicit((Object)(object)((Component)result.healthComponent).GetComponent<IllusionLure>()))
				{
					hb = result;
					point = ((Component)result).transform.position;
					return true;
				}
			}
		}
		if (Combat.AimHit(aim, b, value + 12f, out var best2, entities: false))
		{
			val = ((RaycastHit)(ref best2)).point - b.corePosition;
			if (((Vector3)(ref val)).magnitude <= value)
			{
				point = ((RaycastHit)(ref best2)).point;
				return true;
			}
		}
		return false;
	}
}
public class AmaterasuSkillDef : SkillDef
{
	private class Data : BaseSkillInstanceData
	{
		public CharacterBody body;

		public InputBankTest input;

		public float next;

		public bool ok;
	}

	public override BaseSkillInstanceData OnAssigned(GenericSkill s)
	{
		return (BaseSkillInstanceData)(object)new Data
		{
			body = ((Component)s).GetComponent<CharacterBody>(),
			input = ((Component)s).GetComponent<InputBankTest>()
		};
	}

	private static bool Has(GenericSkill s)
	{
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		if (!(s.skillInstanceData is Data data) || !Object.op_Implicit((Object)(object)data.body) || !Object.op_Implicit((Object)(object)data.input))
		{
			return true;
		}
		if (Time.time >= data.next)
		{
			data.next = Time.time + 0.1f;
			data.ok = Ama.Pick(data.body, new Ray(data.input.aimOrigin, data.input.aimDirection), out var _, out var _);
		}
		return data.ok;
	}

	public override bool CanExecute(GenericSkill s)
	{
		if (Has(s))
		{
			return ((SkillDef)this).CanExecute(s);
		}
		return false;
	}

	public override bool IsReady(GenericSkill s)
	{
		if (((SkillDef)this).IsReady(s))
		{
			return Has(s);
		}
		return false;
	}
}
public sealed class AmaterasuCast : BaseSkillState
{
	public GameObject victim;

	public Vector3 point;

	public ushort seed;

	private bool ignited;

	private bool ok;

	public override void OnEnter()
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		((BaseState)this).OnEnter();
		if (((EntityState)this).isAuthority)
		{
			ok = Ama.Pick(((EntityState)this).characterBody, ((BaseState)this).GetAimRay(), out var hb, out point);
			victim = ((ok && Object.op_Implicit((Object)(object)hb) && Object.op_Implicit((Object)(object)hb.healthComponent)) ? ((Component)hb.healthComponent).gameObject : null);
			seed = (ushort)Random.Range(1, 65000);
			if (!ok && Object.op_Implicit((Object)(object)((BaseSkillState)this).activatorSkillSlot))
			{
				((BaseSkillState)this).activatorSkillSlot.AddOneStock();
			}
		}
		else
		{
			ok = Object.op_Implicit((Object)(object)victim) || point != Vector3.zero;
		}
		((BaseState)this).StartAimMode(Ama.CastTime + 0.5f, false);
		((EntityState)this).characterBody.SetAimTimer(Ama.CastTime + 0.5f);
		if (ok)
		{
			CharVisual v = CharVisual.Find(((EntityState)this).characterBody);
			EyeSwap.Mangekyo(v, Ama.EyeSeconds);
			AmaFx.EyeGlint(v);
			Snd.Sfx("AmaSting", ((EntityState)this).gameObject);
			Snd.Voice(((EntityState)this).characterBody, "Amaterasu", 1.7f, grunt: false, 2);
			Ama.Casts++;
		}
		Combat.Trace?.Invoke("AMA_CAST victim=" + (Object.op_Implicit((Object)(object)victim) ? ((Object)victim).name : "none") + " point=" + ((Vector3)(ref point)).ToString("0.0") + " authority=" + ((EntityState)this).isAuthority + " server=" + NetworkServer.active);
	}

	public override void FixedUpdate()
	{
		//IL_004b: 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_009b: Unknown result type (might be due to invalid IL or missing references)
		((EntityState)this).FixedUpdate();
		if (ok && !ignited && ((EntityState)this).fixedAge >= Ama.IgniteAt)
		{
			ignited = true;
			AmaFx.Ignition(Object.op_Implicit((Object)(object)victim) ? AmaFx.Centre(victim) : point, victim, seed);
			Snd.Sfx("AmaIgnite", Object.op_Implicit((Object)(object)victim) ? victim : ((EntityState)this).gameObject);
			if (NetworkServer.active)
			{
				AmaterasuServer.Ignite(((EntityState)this).characterBody, victim, point);
			}
		}
		if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= (ok ? Ama.CastTime : 0.1f))
		{
			((EntityState)this).outer.SetNextStateToMain();
		}
	}

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

	public override void OnSerialize(NetworkWriter w)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		((BaseSkillState)this).OnSerialize(w);
		w.Write(victim);
		w.Write(point);
		w.Write(seed);
	}

	public override void OnDeserialize(NetworkReader r)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		((BaseSkillState)this).OnDeserialize(r);
		victim = r.ReadGameObject();
		point = r.ReadVector3();
		seed = r.ReadUInt16();
	}
}
public static class AmaterasuServer
{
	public static void Ignite(CharacterBody caster, GameObject victimGo, Vector3 point)
	{
		//IL_013e: Unknown result type (might be due to invalid IL or missing references)
		//IL_013f: Unknown result type (might be due to invalid IL or missing references)
		//IL_014c: 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_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d1: 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_0125: 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)
		if (!NetworkServer.active || !Object.op_Implicit((Object)(object)caster))
		{
			return;
		}
		HealthComponent val = (Object.op_Implicit((Object)(object)victimGo) ? victimGo.GetComponent<HealthComponent>() : null);
		if (Object.op_Implicit((Object)(object)val) && val.alive)
		{
			CharacterBody body = val.body;
			HurtBox val2 = (Object.op_Implicit((Object)(object)body) ? body.mainHurtBox : null);
			if (!Object.op_Implicit((Object)(object)val2))
			{
				val2 = victimGo.GetComponentInChildren<HurtBox>();
			}
			if (Object.op_Implicit((Object)(object)val2) && Combat.Target(val2, caster))
			{
				Vector3 val3 = ((Component)val2).transform.position - caster.corePosition;
				if (!(((Vector3)(ref val3)).magnitude > Tuning.AmaRange.Value * 1.5f + 10f))
				{
					bool crit = caster.RollCrit();
					Combat.Source = "Amaterasu.ignite";
					Combat.Deal(caster, val2, AmaFx.Centre(victimGo), Tuning.AmaIgnite.Value, 1f, crit, Vector3.zero, (DamageType)2048, null, (DamageColorIndex)9, (DamageSource)8);
					Ama.Ignitions++;
					if (!val.alive)
					{
						AmaPatch.Spawn(caster, Object.op_Implicit((Object)(object)body) ? body.footPosition : ((Component)val2).transform.position);
					}
					else
					{
						AmaBurn.Begin(caster, val, crit);
					}
					return;
				}
			}
			Combat.Trace?.Invoke("AMA_SERVER rejected");
		}
		else if (point != Vector3.zero)
		{
			AmaPatch.Spawn(caster, point, Tuning.AmaPatchSeconds.Value + 1f);
		}
	}
}
public sealed class AmaBurn : MonoBehaviour
{
	private CharacterBody caster;

	private CharacterMaster casterMaster;

	private TeamIndex team;

	private float casterDamage;

	private HealthComponent hc;

	private float until;

	private float next;

	private float started;

	private bool crit;

	private bool boss;

	public static readonly List<AmaBurn> All = new List<AmaBurn>();

	public const float Forever = 100000f;

	public static float Seconds(CharacterBody vb, out bool boss)
	{
		boss = Object.op_Implicit((Object)(object)vb) && (vb.isChampion || vb.isBoss);
		float value = Tuning.AmaDuration.Value;
		if (!boss)
		{
			if (!(value > 0f))
			{
				return 100000f;
			}
			return value;
		}
		return Mathf.Max(0.5f, Tuning.AmaBossDuration.Value);
	}

	public static void Begin(CharacterBody caster, HealthComponent hc, bool crit)
	{
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		AmaBurn amaBurn = ((Component)hc).GetComponents<AmaBurn>().FirstOrDefault((AmaBurn x) => (Object)(object)x.caster == (Object)(object)caster || (Object.op_Implicit((Object)(object)x.casterMaster) && Object.op_Implicit((Object)(object)caster) && (Object)(object)x.casterMaster == (Object)(object)caster.master)) ?? ((Component)hc).gameObject.AddComponent<AmaBurn>();
		bool num = amaBurn.started <= 0f;
		amaBurn.caster = caster;
		amaBurn.casterMaster = (Object.op_Implicit((Object)(object)caster) ? caster.master : null);
		amaBurn.team = (TeamIndex)((!Object.op_Implicit((Object)(object)caster) || !Object.op_Implicit((Object)(object)caster.teamComponent)) ? 1 : ((int)caster.teamComponent.teamIndex));
		amaBurn.casterDamage = (Object.op_Implicit((Object)(object)caster) ? caster.damage : 12f);
		amaBurn.hc = hc;
		amaBurn.crit = crit;
		float num2 = Seconds(hc.body, out amaBurn.boss);
		amaBurn.until = Time.fixedTime + num2;
		if (amaBurn.next <= 0f)
		{
			amaBurn.next = Time.fixedTime + Ama.TickEvery;
		}
		if (num)
		{
			amaBurn.started = Time.fixedTime;
		}
		CharacterBody body = hc.body;
		if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)Deception.Burning))
		{
			body.ClearTimedBuffs(Deception.Burning);
			body.AddTimedBuff(Deception.Burning, num2);
		}
		Combat.Trace?.Invoke("AMA_BURN start/refresh " + ((Object)hc).name + " boss=" + amaBurn.boss + " until+" + ((num2 >= 100000f) ? "death" : num2.ToString("0.0")));
	}

	private void OnEnable()
	{
		All.Add(this);
	}

	private void OnDisable()
	{
		All.Remove(this);
	}

	private void OnDestroy()
	{
		if (!NetworkServer.active || !Object.op_Implicit((Object)(object)hc) || !Object.op_Implicit((Object)(object)hc.body) || !Object.op_Implicit((Object)(object)Deception.Burning))
		{
			return;
		}
		AmaBurn[] components = ((Component)hc).GetComponents<AmaBurn>();
		foreach (AmaBurn amaBurn in components)
		{
			if ((Object)(object)amaBurn != (Object)(object)this && ((Behaviour)amaBurn).enabled)
			{
				return;
			}
		}
		hc.body.ClearTimedBuffs(Deception.Burning);
	}

	private void FixedUpdate()
	{
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cf: 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_0266: Unknown result type (might be due to invalid IL or missing references)
		if (!NetworkServer.active)
		{
			Object.Destroy((Object)(object)this);
			return;
		}
		if (!Object.op_Implicit((Object)(object)hc))
		{
			Object.Destroy((Object)(object)this);
			return;
		}
		if (!hc.alive)
		{
			if (Object.op_Implicit((Object)(object)caster))
			{
				AmaPatch.Spawn(caster, Object.op_Implicit((Object)(object)hc.body) ? hc.body.footPosition : ((Component)this).transform.position);
			}
			Combat.Trace?.Invoke("AMA_BURN end=death " + ((Object)hc).name + " after=" + (Time.fixedTime - started).ToString("0.0") + "s");
			Object.Destroy((Object)(object)this);
			return;
		}
		if (Time.fixedTime >= until)
		{
			Combat.Trace?.Invoke("AMA_BURN end=time " + ((Object)hc).name + " after=" + (Time.fixedTime - started).ToString("0.0") + "s");
			Object.Destroy((Object)(object)this);
			return;
		}
		if (!Object.op_Implicit((Object)(object)caster) && Object.op_Implicit((Object)(object)casterMaster))
		{
			CharacterBody body = casterMaster.GetBody();
			if (Object.op_Implicit((Object)(object)body))
			{
				caster = body;
			}
		}
		if (Object.op_Implicit((Object)(object)caster))
		{
			casterDamage = caster.damage;
			if (Object.op_Implicit((Object)(object)caster.teamComponent))
			{
				team = caster.teamComponent.teamIndex;
			}
		}
		while (Time.fixedTime >= next && Time.fixedTime < until + 0.01f)
		{
			next += Ama.TickEvery;
			CharacterBody body2 = hc.body;
			HurtBox val = (Object.op_Implicit((Object)(object)body2) ? body2.mainHurtBox : null);
			if (Object.op_Implicit((Object)(object)val))
			{
				Combat.Source = "Amaterasu.burn";
				float num = Tuning.AmaBurn.Value * Ama.TickEvery;
				if (Object.op_Implicit((Object)(object)caster))
				{
					Combat.Deal(caster, val, AmaFx.Centre(((Component)hc).gameObject), num, Tuning.AmaBurnProc.Value, crit, Vector3.zero, (DamageType)67110912, null, (DamageColorIndex)9, (DamageSource)8);
				}
				else
				{
					Orphan(val, num);
				}
				Ama.Ticks++;
				if (!Object.op_Implicit((Object)(object)hc) || !hc.alive)
				{
					break;
				}
				continue;
			}
			break;
		}
	}

	private void Orphan(HurtBox hb, float coef)
	{
		//IL_0022: 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_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_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)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: Expected O, but got Unknown
		CharacterBody body = hc.body;
		if (((Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.teamComponent)) ? body.teamComponent.teamIndex : hb.teamIndex) != team)
		{
			DamageInfo val = new DamageInfo
			{
				attacker = null,
				inflictor = ((Component)this).gameObject,
				damage = casterDamage * coef,
				crit = crit,
				position = AmaFx.Centre(((Component)hc).gameObject),
				force = Vector3.zero,
				procCoefficient = 0f,
				damageType = new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)67110912), (DamageTypeExtended)0, (DamageSource)8),
				damageColorIndex = (DamageColorIndex)9
			};
			float combinedHealth = hc.combinedHealth;
			hc.TakeDamage(val);
			Combat.Trace?.Invoke("DAMAGE source=Amaterasu.burn.orphan slot=Special victim=" + (Object.op_Implicit((Object)(object)body) ? ((Object)body).name : ((Object)hc).name) + " coef=" + coef.ToString("0.00") + " loss=" + (combinedHealth - hc.combinedHealth).ToString("0.0"));
		}
	}
}
public sealed class AmaPatch : MonoBehaviour
{
	private CharacterBody caster;

	private Vector3 c;

	private float r;

	private float until;

	private float next;

	private static readonly List<AmaPatch> all = new List<AmaPatch>();

	public static void Spawn(CharacterBody caster, Vector3 at, float seconds = -1f)
	{
		//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_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fb: 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_0114: Unknown result type (might be due to invalid IL or missing references)
		//IL_0163: Unknown result type (might be due to invalid IL or missing references)
		//IL_016a: Unknown result type (might be due to invalid IL or missing references)
		//IL_016b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		if (!NetworkServer.active || !Object.op_Implicit((Object)(object)caster))
		{
			return;
		}
		if (seconds < 0f)
		{
			seconds = Tuning.AmaPatchSeconds.Value;
		}
		if (!(seconds <= 0f))
		{
			if (Combat.TryGround(at + Vector3.up * 0.5f, 6f, out var g))
			{
				at = g;
			}
			all.RemoveAll((AmaPatch x) => !Object.op_Implicit((Object)(object)x));
			List<AmaPatch> list = (from x in all
				where (Object)(object)x.caster == (Object)(object)caster
				orderby x.until
				select x).ToList();
			while (list.Count >= Ama.MaxPatchesPerCaster)
			{
				Object.Destroy((Object)(object)((Component)list[0]).gameObject);
				list.RemoveAt(0);
			}
			AmaPatch amaPatch = new GameObject("ItachiAmaterasuPatch").AddComponent<AmaPatch>();
			amaPatch.caster = caster;
			amaPatch.c = at;
			amaPatch.r = Tuning.AmaPatchRadius.Value;
			amaPatch.until = Time.fixedTime + seconds;
			amaPatch.next = Time.fixedTime + 0.25f;
			all.Add(amaPatch);
			Ama.Patches++;
			Fx.Emit(AmaFx.PatchFx, at, amaPatch.r, at + Vector3.up, seconds);
			Combat.Trace?.Invoke("AMA_PATCH at " + ((Vector3)(ref at)).ToString("0.0") + " s=" + seconds.ToString("0.0"));
		}
	}

	private void FixedUpdate()
	{
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: 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_008e: 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_00b9: 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 (!Object.op_Implicit((Object)(object)caster) || Time.fixedTime >= until)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
		else
		{
			if (Time.fixedTime < next)
			{
				return;
			}
			next += 0.5f;
			foreach (HurtBox item in Combat.Around(caster, c + Vector3.up * 0.6f, r, sight: false))
			{
				Vector3 val = Combat.Point(item, c);
				if (!(val.y > c.y + 2.6f))
				{
					Combat.Source = "Amaterasu.patch";
					Combat.Deal(caster, item, val, Tuning.AmaPatchDamage.Value * 0.5f, 0.1f, crit: false, Vector3.zero, (DamageType)67110912, null, (DamageColorIndex)9, (DamageSource)8);
				}
			}
		}
	}
}
public static class AmaFx
{
	private sealed class EyeGlowFx : MonoBehaviour
	{
		public CharVisual v;

		public float t0;

		public float life;

		private Transform l;

		private Transform r;

		private Transform ul;

		private Transform dl;

		private Transform ur;

		private Transform dr;

		private Renderer rl;

		private Renderer rr;

		private MaterialPropertyBlock mpb;

		private static Material mat;

		public static float Size = 0.075f;

		public static float Alpha = 0.9f;

		private static Material Mat
		{
			get
			{
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)mat))
				{
					mat = Fx.Additive((Texture)(object)Fx.Soft);
					mat.SetColor("_TintColor", new Color(1f, 0.05f, 0.03f, 1f));
					mat.renderQueue = 3050;
				}
				return mat;
			}
		}

		private void LateUpdate()
		{
			//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_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Expected O, but got Unknown
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: 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_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: 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_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: 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_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: 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_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: 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_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: 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_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: 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_0302: 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_030c: 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_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_039f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03be: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)v))
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			float num = Time.time - t0;
			if (num > life)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			if (!Object.op_Implicit((Object)(object)l))
			{
				ul = v.Bone("eyeup_l");
				dl = v.Bone("eyedown_l");
				ur = v.Bone("eyeup_r");
				dr = v.Bone("eyedown_r");
				GameObject val = Fx.Quad(((Component)this).transform, Mat, "eyeL");
				GameObject val2 = Fx.Quad(((Component)this).transform, Mat, "eyeR");
				l = val.transform;
				r = val2.transform;
				rl = val.GetComponent<Renderer>();
				rr = val2.GetComponent<Renderer>();
				mpb = new MaterialPropertyBlock();
			}
			Transform parent = ((Component)this).transform.parent;
			Vector3 val3 = ((Component)v).transform.forward;
			val3.y = 0f;
			val3 = ((((Vector3)(ref val3)).sqrMagnitude > 0.01f) ? ((Vector3)(ref val3)).normalized : Vector3.forward);
			Vector3 val4 = Vector3.Cross(Vector3.up, val3);
			Vector3 val5 = ((Object.op_Implicit((Object)(object)ul) && Object.op_Implicit((Object)(object)dl)) ? ((ul.position + dl.position) * 0.5f) : (parent.position + Vector3.up * 0.12f - val4 * 0.032f + val3 * 0.08f));
			Vector3 val6 = ((Object.op_Implicit((Object)(object)ur) && Object.op_Implicit((Object)(object)dr)) ? ((ur.position + dr.position) * 0.5f) : (parent.position + Vector3.up * 0.12f + val4 * 0.032f + val3 * 0.08f));
			Camera val7 = Fx.Cam();
			Quaternion val8 = (Object.op_Implicit((Object)(object)val7) ? ((Component)val7).transform.rotation : Quaternion.LookRotation(-val3));
			Vector3 val9;
			if (Object.op_Implicit((Object)(object)val7))
			{
				val9 = ((Component)val7).transform.position - (val5 + val6) * 0.5f;
				_ = ((Vector3)(ref val9)).normalized;
			}
			Vector3 val10 = (val5 + val6) * 0.5f - parent.position;
			val10.y = 0f;
			val10 = ((((Vector3)(ref val10)).sqrMagnitude > 1E-06f) ? ((Vector3)(ref val10)).normalized : val3);
			l.SetPositionAndRotation(val5 + val10 * 0.035f, val8);
			r.SetPositionAndRotation(val6 + val10 * 0.035f, val8);
			float num2 = 1f;
			float num3 = Mathf.Clamp01(num / 0.12f) * Mathf.Clamp01((life - num) / 0.35f) * (0.8f + 0.2f * Mathf.Sin(num * 9f)) * num2;
			val9 = (l.localScale = (r.localScale = Vector3.one * Size / Mathf.Max(0.001f, ((Component)this).transform.lossyScale.x)));
			mpb.SetColor("_TintColor", new Color(1f, 0.05f, 0.03f, Alpha * num3));
			rl.SetPropertyBlock(mpb);
			rr.SetPropertyBlock(mpb);
		}
	}

	private sealed class PatchView : MonoBehaviour
	{
		private float fadeAt;

		private float a0;

		private List<Renderer> sc;

		private MaterialPropertyBlock mpb;

		private void Start()
		{
			//IL_002f: 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_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: 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)
			//IL_033e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0343: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: Unknown result type (might be due to invalid IL or missing references)
			//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: 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_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: 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_03e9: 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_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: 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_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_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			EffectComponent component = ((Component)this).GetComponent<EffectComponent>();
			EffectData val = (Object.op_Implicit((Object)(object)component) ? component.effectData : null);
			if (val == null)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			((Component)this).transform.position = val.origin;
			float num = Mathf.Max(0.5f, val.scale);
			float num2 = Mathf.Max(0.5f, val.genericFloat);
			List<Renderer> list = new List<Renderer>();
			RaycastHit val3 = default(RaycastHit);
			for (int i = 0; i < 8; i++)
			{
				float num3 = (float)i * 51.4f + Random.value * 20f;
				float num4 = ((i == 0) ? 0f : (num * Random.Range(0.45f, 0.8f)));
				Vector3 val2 = Quaternion.Euler(0f, num3, 0f) * Vector3.forward * num4;
				if (Physics.Raycast(val.origin + val2 + Vector3.up * 1.5f, Vector3.down, ref val3, 3.5f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
				{
					GameObject val4 = Fx.Quad(((Component)this).transform, Scorch, "scorch");
					val4.transform.position = ((RaycastHit)(ref val3)).point + ((RaycastHit)(ref val3)).normal * 0.06f;
					val4.transform.rotation = Quaternion.LookRotation(-((RaycastHit)(ref val3)).normal) * Quaternion.Euler(0f, 0f, Random.value * 360f);
					val4.transform.localScale = Vector3.one * ((i == 0) ? (num * 1.35f) : (num * Random.Range(0.8f, 1.05f)));
					list.Add(val4.GetComponent<Renderer>());
				}
			}
			ParticleSystem obj = BlackFlames.MakeSystem(((Component)this).transform, Black, 220, burst: false);
			ShapeModule shape = obj.shape;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)10;
			((ShapeModule)(ref shape)).radius = num * 0.9f;
			((ShapeModule)(ref shape)).rotation = new Vector3(-90f, 0f, 0f);
			((ShapeModule)(ref shape)).position = Vector3.up * 0.1f;
			EmissionModule emission = obj.emission;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(Mathf.Clamp(num * num * 22f, 40f, 220f));
			MainModule main = obj.main;
			((MainModule)(ref main)).duration = num2;
			((MainModule)(ref main)).loop = false;
			((MainModule)(ref main)).startSize3D = true;
			((MainModule)(ref main)).startSizeX = new MinMaxCurve(0.3f, 0.6f);
			((MainModule)(ref main)).startSizeY = new MinMaxCurve(0.55f, 1.2f);
			((MainModule)(ref main)).startSizeZ = MinMaxCurve.op_Implicit(1f);
			obj.Play();
			ParticleSystem obj2 = BlackFlames.MakeSystem(((Component)this).transform, Rim, 120, burst: false);
			shape = obj2.shape;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)10;
			((ShapeModule)(ref shape)).radius = num;
			((ShapeModule)(ref shape)).rotation = new Vector3(-90f, 0f, 0f);
			emission = obj2.emission;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(Mathf.Clamp(num * num * 4f, 12f, 60f));
			main = obj2.main;
			((MainModule)(ref main)).duration = num2;
			((MainModule)(ref main)).loop = false;
			((MainModule)(ref main)).startSize3D = true;
			if (StormFlames)
			{
				((MainModule)(ref main)).startSizeX = new MinMaxCurve(0.2f, 0.38f);
				((MainModule)(ref main)).startSizeY = new MinMaxCurve(1.3f, 2.4f);
				((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(Mathf.Clamp(num * num * 8f, 18f, 90f));
			}
			else
			{
				((MainModule)(ref main)).startSizeX = new MinMaxCurve(0.5f, 0.9f);
				((MainModule)(ref main)).startSizeY = new MinMaxCurve(0.8f, 1.5f);
			}
			((MainModule)(ref main)).startSizeZ = MinMaxCurve.op_Implicit(1f);
			obj2.Play();
			Snd.Sfx("AmaBurn", ((Component)this).gameObject);
			Object.Destroy((Object)(object)((Component)this).gameObject, num2 + 1.2f);
			fadeAt = Time.time + num2;
			sc = list;
			a0 = 0.5f;
		}

		private void LateUpdate()
		{
			//IL_005c: 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_001c: Expected O, but got Unknown
			if (sc == null)
			{
				return;
			}
			if (mpb == null)
			{
				mpb = new MaterialPropertyBlock();
			}
			float num = a0 * Mathf.Clamp01(1f - (Time.time - fadeAt) / 1.1f);
			mpb.SetColor("_TintColor", new Color(0f, 0f, 0f, num));
			foreach (Renderer item in sc)
			{
				if (Object.op_Implicit((Object)(object)item))
				{
					item.SetPropertyBlock(mpb);
				}
			}
		}
	}

	public static GameObject PatchFx;

	private static Material black;

	private static Material rim;

	private static Material scorch;

	private static Material flash;

	public static bool StormFlames = true;

	public static bool BodySheet;

	public static bool TendrilSheet;

	private static Texture2D tongues;

	private static Material glint;

	private static Material mgkFlash;

	private static Material mgkGlow;

	public static float FlashSize = 0.42f;

	public static float FlashLife = 0.7f;

	public static float FlashUp = 0.12f;

	public static float FlashToCam = 0.3f;

	private static ParticleSystem tburst;

	private static ParticleSystem burst;

	public static Material Black
	{
		get
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)black))
			{
				Texture2D val = (StormFlames ? Media.Texture("Storm_4efb_amt00_0.png") : null);
				black = Fx.AlphaTex((Texture)(object)(Object.op_Implicit((Object)(object)val) ? val : Tongues));
				black.SetColor("_TintColor", new Color(0f, 0f, 0f, 1f));
				black.renderQueue = 3010;
				BodySheet = (Object)(object)val != (Object)null;
			}
			return black;
		}
	}

	public static Material Rim
	{
		get
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)rim))
			{
				Texture2D val = (StormFlames ? Media.Texture("Storm_2efb_amt00_0.png") : null);
				rim = Fx.AlphaTex((Texture)(object)(Object.op_Implicit((Object)(object)val) ? val : Tongues));
				rim.SetColor("_TintColor", new Color(0f, 0f, 0f, 0.96f));
				rim.renderQueue = 3008;
				TendrilSheet = (Object)(object)val != (Object)null;
			}
			return rim;
		}
	}

	public static Texture2D Tongues
	{
		get
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)tongues))
			{
				return tongues;
			}
			tongues = new Texture2D(512, 256, (TextureFormat)4, true);
			Color[] array = (Color[])(object)new Color[131072];
			Random random = new Random(11);
			for (int i = 0; i < 8; i++)
			{
				int num = i % 4 * 128;
				int num2 = ((i < 4) ? 1 : 0) * 128;
				float num3 = (float)random.NextDouble() * 6.28f;
				float num4 = ((float)random.NextDouble() - 0.5f) * 0.5f;
				float num5 = 0.45f + (float)random.NextDouble() * 0.3f;
				float num6 = (float)random.NextDouble();
				for (int j = 0; j < 128; j++)
				{
					for (int k = 0; k < 128; k++)
					{
						float num7 = (float)j / 127f;
						float num8 = (float)k / 127f - 0.5f;
						float num9 = num4 * num7 * num7 + 0.06f * Mathf.Sin(num7 * 9f + num3) * num7;
						float num10 = 0.36f * Mathf.Pow(Mathf.Clamp01(1f - num7), 1.05f) * (1f + 0.22f * Mathf.Sin(num7 * 17f + num3 * 2f)) * Mathf.Clamp01(num7 * 6f + 0.35f);
						float num11 = Mathf.Abs(num8 - num9);
						float num12 = Mathf.Clamp01((num10 - num11) / 0.035f);
						if (num6 > 0.72f && num7 > num5)
						{
							float num13 = num9 + (num6 - 0.4f) * 0.5f * (num7 - num5) / (1f - num5) * 2f;
							float num14 = num10 * 0.55f;
							float num15 = Mathf.Abs(num8 - num13);
							num12 = Mathf.Max(num12 * Mathf.Clamp01((num11 - num14 * 0.2f) / 0.04f + 0.2f), Mathf.Clamp01((num14 - num15) / 0.03f));
						}
						num12 *= Mathf.Clamp01(num7 * 5f + 0.1f);
						array[(num2 + j) * 512 + num + k] = new Color(1f, 1f, 1f, num12);
					}
				}
			}
			tongues.SetPixels(array);
			tongues.Apply(true);
			((Texture)tongues).wrapMode = (TextureWrapMode)1;
			return tongues;
		}
	}

	private static Material Scorch
	{
		get
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)scorch))
			{
				scorch = Fx.AlphaTex((Texture)(object)Fx.Soft);
				scorch.SetColor("_TintColor", new Color(0f, 0f, 0f, 0.75f));
			}
			return scorch;
		}
	}

	private static Material Flash
	{
		get
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)flash))
			{
				flash = Fx.AlphaTex((Texture)(object)Fx.Soft);
				flash.SetColor("_TintColor", new Color(0f, 0f, 0f, 0.55f));
			}
			return flash;
		}
	}

	private static Material Glint
	{
		get
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)glint))
			{
				glint = Fx.Additive((Texture)(object)Fx.Soft);
				glint.SetColor("_TintColor", new Color(1f, 0.06f, 0.04f, 1f));
				glint.renderQueue = 3100;
				glint.SetInt("_ZTest", 8);
			}
			return glint;
		}
	}

	public static Material GlintMat => Glint;

	private static ParticleSystem TendrilBurst
	{
		get
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)tburst))
			{
				tburst = BlackFlames.MakeSystem(null, Rim, 120, burst: true, tendril: true);
				MainModule main = tburst.main;
				((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.4f, 0.6f);
			}
			return tburst;
		}
	}

	private static ParticleSystem Burst
	{
		get
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)burst))
			{
				burst = BlackFlames.MakeSystem(null, Black, 160, burst: true);
				MainModule main = burst.main;
				((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.25f, 0.45f);
			}
			return burst;
		}
	}

	public static void EyeGlint(CharVisual v, bool streak = true)
	{
		//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_004d: 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_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: 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_00c4: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)v))
		{
			return;
		}
		Transform val = v.Bone("head");
		if (Object.op_Implicit((Object)(object)val))
		{
			Vector3 val2 = ((Component)v).transform.forward;
			val2.y = 0f;
			val2 = ((((Vector3)(ref val2)).sqrMagnitude > 0.01f) ? ((Vector3)(ref val2)).normalized : Vector3.forward);
			Vector3 at = val.position + Vector3.up * 0.07f + val2 * 0.3f;
			if (streak)
			{
				ItachiFx.Quad(Glint, at, 0.9f, 0.3f, 0f, 1.25f, 0f, (Vector2?)new Vector2(1f, 0.07f), 1.5f);
			}
			ItachiFx.Quad(Glint, at, 0.22f, 0.26f, 45f, 1.1f, 0f, null, 1.4f);
		}
	}

	public static void MangekyoFlash(CharVisual v)
	{
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: 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_00fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_013e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)v))
		{
			return;
		}
		Transform val = v.Bone("head");
		if (Object.op_Implicit((Object)(object)val))
		{
			if (!Object.op_Implicit((Object)(object)mgkFlash))
			{
				mgkFlash = NightFx.Unlit((Texture)(object)NightFx.Mangekyo, 3008);
				mgkFlash.SetInt("_ZTest", 8);
				mgkGlow = Fx.Additive((Texture)(object)Fx.Soft);
				mgkGlow.SetColor("_TintColor", new Color(1f, 0.05f, 0.04f, 0.8f));
				mgkGlow.renderQueue = 3007;
				mgkGlow.SetInt("_ZTest", 8);
			}
			Camera val2 = Fx.Cam();
			Vector3 val3 = val.position + Vector3.up * FlashUp;
			if (Object.op_Implicit((Object)(object)val2))
			{
				Vector3 val4 = val3;
				Vector3 val5 = ((Component)val2).transform.position - val3;
				val3 = val4 + ((Vector3)(ref val5)).normalized * FlashToCam;
			}
			ItachiFx.Quad(mgkGlow, val3, FlashSize * 1.9f, FlashLife * 1.1f, 0f, 1.3f, 0f, null, 1.4f);
			ItachiFx.Quad(mgkFlash, val3, FlashSize, FlashLife, 0f, 1.35f, -220f, null, 1.6f);
		}
	}

	public static void EyeHold(CharVisual v, float seconds)
	{
		//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)
		if (!Object.op_Implicit((Object)(object)v))
		{
			return;
		}
		Transform val = v.Bone("head");
		if (Object.op_Implicit((Object)(object)val))
		{
			EyeGlowFx componentInChildren = ((Component)val).GetComponentInChildren<EyeGlowFx>();
			if (Object.op_Implicit((Object)(object)componentInChildren))
			{
				Object.Destroy((Object)(object)((Component)componentInChildren).gameObject);
			}
			GameObject val2 = new GameObject("ItachiEyeGlow");
			val2.transform.SetParent(val, false);
			EyeGlowFx eyeGlowFx = val2.AddComponent<EyeGlowFx>();
			eyeGlowFx.v = v;
			eyeGlowFx.t0 = Time.time;
			eyeGlowFx.life = seconds;
		}
	}

	public static void Prepare()
	{
		PatchFx = Fx.MakeEffect("ItachiAmaterasuPatch", delegate(GameObject g)
		{
			g.AddComponent<PatchView>();
		});
		BlackFlames.Install();
	}

	public static Vector3 Centre(GameObject go)
	{
		//IL_0047: 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_0034: Unknown result type (might be due to invalid IL or missing references)
		HealthComponent val = (Object.op_Implicit((Object)(object)go) ? go.GetComponent<HealthComponent>() : null);
		CharacterBody val2 = (Object.op_Implicit((Object)(object)val) ? val.body : null);
		if (!Object.op_Implicit((Object)(object)val2))
		{
			if (!Object.op_Implicit((Object)(object)go))
			{
				return Vector3.zero;
			}
			return go.transform.position;
		}
		return Eph.Centre(val2);
	}

	public static void Ignition(Vector3 at, GameObject victim, int seed)
	{
		//IL_003f: 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_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_012c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
		//IL_0146: 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_0176: Unknown result type (might be due to invalid IL or missing references)
		//IL_0198: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_022a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0236: Unknown result type (might be due to invalid IL or missing references)
		HealthComponent val = (Object.op_Implicit((Object)(object)victim) ? victim.GetComponent<HealthComponent>() : null);
		float num = ((Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.body)) ? Eph.Size(val.body) : 1.2f);
		ItachiFx.Quad(Flash, at, num * 0.6f, 0.12f, 0f, 1.4f, 0f, null, 2f);
		ParticleSystem val2 = Burst;
		((Component)val2).transform.position = at;
		ShapeModule shape = val2.shape;
		((ShapeModule)(ref shape)).radius = Mathf.Clamp(num * 0.45f, 0.3f, 2.5f);
		EmitParams val3 = default(EmitParams);
		int num2 = Mathf.Clamp((int)(18f * num), 14, 60);
		for (int i = 0; i < num2; i++)
		{
			((EmitParams)(ref val3)).position = at + Random.insideUnitSphere * num * 0.5f;
			((EmitParams)(ref val3)).velocity = Random.onUnitSphere * 1.1f * num + Vector3.up * 1.4f;
			((EmitParams)(ref val3)).startSize3D = new Vector3(0.55f, 1f, 1f) * num * Random.Range(0.45f, 0.8f);
			val2.Emit(val3, 1);
		}
		ParticleSystem tendrilBurst = TendrilBurst;
		((Component)tendrilBurst).transform.position = at;
		int num3 = Mathf.Clamp((int)(8f * num), 6, 30);
		for (int j = 0; j < num3; j++)
		{
			((EmitParams)(ref val3)).position = at + new Vector3(Random.Range(-0.5f, 0.5f), Random.Range(-0.6f, 0.1f), Random.Range(-0.5f, 0.5f)) * num;
			((EmitParams)(ref val3)).velocity = Vector3.up * Random.Range(2f, 3.5f) * Mathf.Sqrt(num);
			float num4 = num * Random.Range(1.1f, 1.7f);
			((EmitParams)(ref val3)).startSize3D = new Vector3(num4 * 0.2f, num4, 1f);
			tendrilBurst.Emit(val3, 1);
		}
	}
}
public sealed class BlackFlames : MonoBehaviour
{
	private sealed class Burner
	{
		public GameObject root;

		public ParticleSystem black;

		public ParticleSystem rim;

		public float stopAt = -1f;

		public float nextSound;

		public Collider[] cols;

		public float[] cum;

		public float acc;

		public float area;

		public float t0;
	}

	private static BlackFlames inst;

	private readonly Dictionary<CharacterBody, Burner> live = new Dictionary<CharacterBody, Burner>();

	private float scan;

	public static int Burning;

	public static float BodyLife0 = 0.45f;

	public static float BodyLife1 = 0.75f;

	public static float TendrilLife0 = 0.45f;

	public static float TendrilLife1 = 0.75f;

	public static float TendrilNoise = 1.6f;

	public static float TendrilNoiseFreq = 1.4f;

	public static float SustainAfter = 6f;

	public static float SustainMul = 0.45f;

	public static float GlobalFloor = 0.3f;

	public static int GlobalSoft = 8;

	public static int MaxBurners = 48;

	private static float globalSound;

	public static float InnerShare = 0.3f;

	public static float BodyRate = 26f;

	public static float BodyH = 0.5f;

	public static float BodyW = 0.36f;

	public static float TendrilRate = 55f;

	public static float TendrilH = 1.25f;

	public static float TendrilW = 0.25f;

	public static float TendrilBoost = 2.6f;

	public static float BodyBoost = 1f;

	public static float ShellRate = 40f;

	public static float ShellMin = 70f;

	public static float ShellMax = 750f;

	public static float ShellSize = 1.35f;

	public static float ShellWidth = 0.5f;

	public static float ShellOut = 0.06f;

	private float LodGlobal
	{
		get
		{
			if (live.Count <= GlobalSoft)
			{
				return 1f;
			}
			return Mathf.Max(GlobalFloor, (float)GlobalSoft / (float)live.Count);
		}
	}

	public static void Install()
	{
		//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_001d: Expected O, but got Unknown
		if (!Object.op_Implicit((Object)(object)inst))
		{
			GameObject val = new GameObject("ItachiBlackFlames");
			Object.DontDestroyOnLoad((Object)val);
			inst = val.AddComponent<BlackFlames>();
		}
	}

	public static ParticleSystem MakeSystem(Transform parent, Material mat, int max, bool burst)
	{
		return MakeSystem(parent, mat, max, burst, (Object)(object)mat == (Object)(object)AmaFx.Rim);
	}

	public static ParticleSystem MakeSystem(Transform parent, Material mat, int max, bool burst, bool tendril)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: 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_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_012e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0133: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Unknown result type (might be due to invalid IL or missing references)
		//IL_0142: Expected O, but got Unknown
		//IL_013d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_014e: Expected O, but got Unknown
		//IL_0158: Unknown result type (might be due to invalid IL or missing references)
		//IL_0162: Unknown result type (might be due to invalid IL or missing references)
		//IL_0167: Unknown result type (might be due to invalid IL or missing references)
		//IL_016e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0178: Unknown result type (might be due to invalid IL or missing references)
		//IL_017d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0194: Unknown result type (might be due to invalid IL or missing references)
		//IL_0199: Unknown result type (might be due to invalid IL or missing references)
		//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_01af: 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_01c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01db: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0210: Unknown result type (might be due to invalid IL or missing references)
		//IL_0269: Unknown result type (might be due to invalid IL or missing references)
		//IL_027f: Unknown result type (might be due to invalid IL or missing references)
		//IL_029d: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fa: Expected O, but got Unknown
		//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0318: Unknown result type (might be due to invalid IL or missing references)
		//IL_031d: Unknown result type (might be due to invalid IL or missing references)
		//IL_032e: 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)
		//IL_0344: Unknown result type (might be due to invalid IL or missing references)
		//IL_0349: Unknown result type (might be due to invalid IL or missing references)
		//IL_034e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0358: Expected O, but got Unknown
		//IL_0353: Unknown result type (might be due to invalid IL or missing references)
		//IL_035d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0364: Expected O, but got Unknown
		//IL_036e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0378: Unknown result type (might be due to invalid IL or missing references)
		//IL_037d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0384: Unknown result type (might be due to invalid IL or missing references)
		//IL_038e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0393: Unknown result type (might be due to invalid IL or missing references)
		//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_03af: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03db: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0415: Unknown result type (might be due to invalid IL or missing references)
		//IL_042b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0441: Unknown result type (might be due to invalid IL or missing references)
		//IL_0452: Unknown result type (might be due to invalid IL or missing references)
		//IL_046f: Unknown result type (might be due to invalid IL or missing references)
		ParticleSystem val = MakeLegacy(parent, mat, max, burst);
		if (!AmaFx.StormFlames)
		{
			return val;
		}
		MainModule main = val.main;
		TextureSheetAnimationModule textureSheetAnimation = val.textureSheetAnimation;
		SizeOverLifetimeModule sizeOverLifetime = val.sizeOverLifetime;
		VelocityOverLifetimeModule velocityOverLifetime = val.velocityOverLifetime;
		NoiseModule noise = val.noise;
		ColorOverLifetimeModule colorOverLifetime = val.colorOverLifetime;
		if (!tendril && AmaFx.BodySheet)
		{
			((TextureSheetAnimationModule)(ref textureSheetAnimation)).numTilesX = 8;
			((TextureSheetAnimationModule)(ref textureSheetAnimation)).numTilesY = 8;
			((TextureSheetAnimationModule)(ref textureSheetAnimation)).animation = (ParticleSystemAnimationType)1;
			((TextureSheetAnimationModule)(ref textureSheetAnimation)).rowMode = (ParticleSystemAnimationRowMode)1;
			((TextureSheetAnimationModule)(ref textureSheetAnimation)).frameOverTime = new MinMaxCurve(1f, AnimationCurve.Linear(0f, 0f, 1f, 0.999f));
			((TextureSheetAnimationModule)(ref textureSheetAnimation)).startFrame = MinMaxCurve.op_Implicit(0f);
			((TextureSheetAnimationModule)(ref textureSheetAnimation)).cycleCount = 1;
			((MainModule)(ref main)).startLifetime = new MinMaxCurve(BodyLife0, BodyLife1);
			((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true;
			((SizeOverLifetimeModule)(ref sizeOverLifetime)).separateAxes = true;
			((SizeOverLifetimeModule)(ref sizeOverLifetime)).x = new MinMaxCurve(1f, AnimationCurve.Constant(0f, 1f, 1f));
			((SizeOverLifetimeModule)(ref sizeOverLifetime)).y = new MinMaxCurve(1f, new AnimationCurve((Keyframe[])(object)new Keyframe[2]
			{
				new Keyframe(0f, 0.85f),
				new Keyframe(1f, 1.25f)
			}));
			Gradient val2 = new Gradient();
			val2.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
			{
				new GradientColorKey(Color.white, 0f),
				new GradientColorKey(Color.white, 1f)
			}, (GradientAlphaKey[])(object)new GradientAlphaKey[4]
			{
				new GradientAlphaKey(0f, 0f),
				new GradientAlphaKey(1f, 0.08f),
				new GradientAlphaKey(1f, 0.8f),
				new GradientAlphaKey(0f, 1f)
			});
			((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val2);
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).y = new MinMaxCurve(0.5f, 1.2f);
			((NoiseModule)(ref noise)).strength = MinMaxCurve.op_Implicit(0.45f);
		}
		else if (tendril && AmaFx.TendrilSheet)
		{
			((TextureSheetAnimationModule)(ref textureSheetAnimation)).numTilesX = 16;
			((TextureSheetAnimationModule)(ref textureSheetAnimation)).numTilesY = 1;
			((TextureSheetAnimationModule)(ref textureSheetAnimation)).animation = (ParticleSystemAnimationType)0;
			((TextureSheetAnimationModule)(ref textureSheetAnimation)).frameOverTime = new MinMaxCurve(1f, AnimationCurve.Linear(0f, 0f, 1f, 1f));
			((TextureSheetAnimationModule)(ref textureSheetAnimation)).startFrame = new MinMaxCurve(0f, 15f);
			((TextureSheetAnimationModule)(ref textureSheetAnimation)).cycleCount = 3;
			((MainModule)(ref main)).startLifetime = new MinMaxCurve(TendrilLife0, TendrilLife1);
			((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true;
			((SizeOverLifetimeModule)(ref sizeOverLifetime)).separateAxes = true;
			((SizeOverLifetimeModule)(ref sizeOverLifetime)).x = new MinMaxCurve(1f, new AnimationCurve((Keyframe[])(object)new Keyframe[2]
			{
				new Keyframe(0f, 1f),
				new Keyframe(1f, 0.55f)
			}));
			((SizeOverLifetimeModule)(ref sizeOverLifetime)).y = new MinMaxCurve(1f, new AnimationCurve((Keyframe[])(object)new Keyframe[3]
			{
				new Keyframe(0f, 0.55f),
				new Keyframe(0.35f, 1.1f),
				new Keyframe(1f, 1.35f)
			}));
			Gradient val3 = new Gradient();
			val3.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
			{
				new GradientColorKey(Color.white, 0f),
				new GradientColorKey(Color.white, 1f)
			}, (GradientAlphaKey[])(object)new GradientAlphaKey[4]
			{
				new GradientAlphaKey(0f, 0f),
				new GradientAlphaKey(1f, 0.1f),
				new GradientAlphaKey(0.9f, 0.65f),
				new GradientAlphaKey(0f, 1f)
			});
			((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val3);
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).y = new MinMaxCurve(1.6f, 3.2f);
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).x = new MinMaxCurve(-0.5f, 0.5f);
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).z = new MinMaxCurve(-0.5f, 0.5f);
			((NoiseModule)(ref noise)).strength = MinMaxCurve.op_Implicit(TendrilNoise);
			((NoiseModule)(ref noise)).frequency = TendrilNoiseFreq;
			((NoiseModule)(ref noise)).scrollSpeed = MinMaxCurve.op_Implicit(2.6f);
			((NoiseModule)(ref noise)).damping = false;
		}
		return val;
	}

	private static ParticleSystem MakeLegacy(Transform parent, Material mat, int max, bool burst)
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Expected O, but got Unknown
		//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_0077: 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_00a3: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: 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_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_010a: 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_0162: Unknown result type (might be due to invalid IL or missing references)
		//IL_0175: Unknown result type (might be due to invalid IL or missing references)
		//IL_017a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0184: Unknown result type (might be due to invalid IL or missing references)
		//IL_018b: Expected O, but got Unknown
		//IL_0195: 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_01ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0202: Unknown result type (might be due to invalid IL or missing references)
		//IL_0213: Unknown result type (might be due to invalid IL or missing references)
		//IL_0218: Unknown result type (might be due to invalid IL or missing references)
		//IL_0226: Unknown result type (might be due to invalid IL or missing references)
		//IL_0231: Unknown result type (might be due to invalid IL or missing references)
		//IL_0236: Unknown result type (might be due to invalid IL or missing references)
		//IL_0261: Unknown result type (might be due to invalid IL or missing references)
		//IL_0266: 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_027c: Unknown result type (might be due to invalid IL or missing references)
		//IL_028d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0292: Unknown result type (might be due to invalid IL or missing references)
		//IL_0297: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a1: Expected O, but got Unknown
		//IL_029c: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02da: Unknown result type (might be due to invalid IL or missing references)
		//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ff: Expected O, but got Unknown
		//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_031f: Unknown result type (might be due to invalid IL or missing references)
		//IL_032a: Unknown result type (might be due to invalid IL or missing references)
		//IL_032f: Unknown result type (might be due to invalid IL or missing references)
		//IL_034d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0363: Unknown result type (might be due to invalid IL or missing references)
		//IL_0379: Unknown result type (might be due to invalid IL or missing references)
		//IL_0384: Unknown result type (might be due to invalid IL or missing references)
		//IL_0389: Unknown result type (might be due to invalid IL or missing references)
		//IL_039a: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_040c: Unknown result type (might be due to invalid IL or missing references)
		//IL_041d: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject(burst ? "AmaBurst" : "AmaFlames");
		if (Object.op_Implicit((Object)(object)parent))
		{
			val.transform.SetParent(parent, false);
		}
		else
		{
			Object.DontDestroyOnLoad((Object)(object)val);
		}
		ParticleSystem val2 = val.AddComponent<ParticleSystem>();
		val2.Stop(true, (ParticleSystemStopBehavior)0);
		MainModule main = val2.main;
		((MainModule)(ref main)).loop = !burst;
		((MainModule)(ref main)).playOnAwake = false;
		((MainModule)(ref main)).maxParticles = max;
		((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
		((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.24f, 0.42f);
		((MainModule)(ref main)).startSpeed = new MinMaxCurve(0.05f, 0.3f);
		((MainModule)(ref main)).startRotation = new MinMaxCurve(-0.1f, 0.1f);
		((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(-0.08f);
		EmissionModule emission = val2.emission;
		((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(burst ? 0f : 40f);
		ShapeModule shape = val2.shape;
		((ShapeModule)(ref shape)).enabled = true;
		((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)5;
		((ShapeModule)(ref shape)).scale = Vector3.one;
		TextureSheetAnimationModule textureSheetAnimation = val2.textureSheetAnimation;
		((TextureSheetAnimationModule)(ref textureSheetAnimation)).enabled = true;
		((TextureSheetAnimationModule)(ref textureSheetAnimation)).numTilesX = 4;
		((TextureSheetAnimationModule)(ref textureSheetAnimation)).numTilesY = 2;
		((TextureSheetAnimationModule)(ref textureSheetAnimation)).animation = (ParticleSystemAnimationType)0;
		((TextureSheetAnimationModule)(ref textureSheetAnimation)).frameOverTime = new MinMaxCurve(0.55f, AnimationCurve.Linear(0f, 0f, 1f, 1f));
		((TextureSheetAnimationModule)(ref textureSheetAnimation)).startFrame = new MinMaxCurve(0f, 3.5f);
		((TextureSheetAnimationModule)(ref textureSheetAnimation)).cycleCount = 1;
		ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime;
		((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
		Gradient val3 = new Gradient();
		val3.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
		{
			new GradientColorKey(Color.white, 0f),
			new GradientColorKey(Color.white, 1f)
		}, (GradientAlphaKey[])(object)new GradientAlphaKey[4]
		{
			new GradientAlphaKey(0f, 0f),
			new GradientAlphaKey(1f, 0.12f),
			new GradientAlphaKey(0.85f, 0.6f),
			new GradientAlphaKey(0f, 1f)
		});
		((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val3);
		SizeOverLifetimeModule sizeOverLifetime = val2.sizeOverLifetime;
		((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true;
		((SizeOverLifetimeModule)(ref sizeOverLifetime)).separateAxes = true;
		((SizeOverLifetimeModule)(ref sizeOverLifetime)).x = new MinMaxCurve(1f, new AnimationCurve((Keyframe[])(object)new Keyframe[3]
		{
			new Keyframe(0f, 0.8f),
			new Keyframe(0.4f, 1f),
			new Keyframe(1f, 0.45f)
		}));
		((SizeOverLifetimeModule)(ref sizeOverLifetime)).y = new MinMaxCurve(1f, new AnimationCurve((Keyframe[])(object)new Keyframe[3]
		{
			new Keyframe(0f, 0.45f),
			new Keyframe(0.45f, 1.15f),
			new Keyframe(1f, 0.7f)
		}));
		((SizeOverLifetimeModule)(ref sizeOverLifetime)).z = new MinMaxCurve(1f, AnimationCurve.Constant(0f, 1f, 1f));
		VelocityOverLifetimeModule velocityOverLifetime = val2.velocityOverLifetime;
		((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled = true;
		((VelocityOverLifetimeModule)(ref velocityOverLifetime)).space = (ParticleSystemSimulationSpace)1;
		((VelocityOverLifetimeModule)(ref velocityOverLifetime)).x = new MinMaxCurve(-0.25f, 0.25f);
		((VelocityOverLifetimeModule)(ref velocityOverLifetime)).y = new MinMaxCurve(0.7f, 1.5f);
		((VelocityOverLifetimeModule)(ref velocityOverLifetime)).z = new MinMaxCurve(-0.25f, 0.25f);
		NoiseModule noise = val2.noise;
		((NoiseModule)(ref noise)).enabled = true;
		((NoiseModule)(ref noise)).strength = MinMaxCurve.op_Implicit(0.6f);
		((NoiseModule)(ref noise)).frequency = 2.2f;
		((NoiseModule)(ref noise)).scrollSpeed = MinMaxCurve.op_Implicit(1.5f);
		ParticleSystemRenderer component = val.GetComponent<ParticleSystemRenderer>();
		((Renderer)component).sharedMaterial = mat;
		component.renderMode = (ParticleSystemRenderMode)3;
		((Renderer)component).shadowCastingMode = (ShadowCastingMode)0;
		component.sortMode = (ParticleSystemSortMode)3;
		((MainModule)(ref main)).startSize3D = true;
		((MainModule)(ref main)).startSizeX = new MinMaxCurve(0.6f, 1f);
		((MainModule)(ref main)).startSizeY = new MinMaxCurve(0.6f, 1f);
		((MainModule)(ref main)).startSizeZ = MinMaxCurve.op_Implicit(1f);
		return val2;
	}

	private void LateUpdate()
	{
		if (!Object.op_Implicit((Object)(object)Deception.Burning))
		{
			return;
		}
		if (Time.time >= scan)
		{
			scan = Time.time + 0.15f;
			foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList)
			{
				if (Object.op_Implicit((Object)(object)readOnlyInstances) && readOnlyInstances.HasBuff(Deception.Burning) && !live.ContainsKey(readOnlyInstances) && live.Count < MaxBurners)
				{
					live[readOnlyInstances] = Make(readOnlyInstances);
				}
			}
		}
		Burning = 0;
		KeyValuePair<CharacterBody, Burner>[] array = live.ToArray();
		for (int i = 0; i < array.Length; i++)
		{
			KeyValuePair<CharacterBody, Burner> keyValuePair = array[i];
			CharacterBody key = keyValuePair.Key;
			Burner value = keyValuePair.Value;
			if (!Object.op_Implicit((Object)(object)value.root))
			{
				live.Remove(key);
				continue;
			}
			bool flag = Object.op_Implicit((Object)(object)key) && key.HasBuff(Deception.Burning) && Object.op_Implicit((Object)(object)key.healthComponent) && key.healthComponent.alive;
			if (!flag && value.stopAt < 0f)
			{
				value.stopAt = Time.time;
				value.black.Stop(true, (ParticleSystemStopBehavior)1);
				value.rim.Stop(true, (ParticleSystemStopBehavior)1);
				if (!Object.op_Implicit((Object)(object)key))
				{
					value.root.transform.SetParent((Transform)null, true);
				}
			}
			if (value.stopAt >= 0f && Time.time - value.stopAt > 0.8f)
			{
				Object.Destroy((Object)(object)value.root);
				live.Remove(key);
			}
			else if (flag)
			{
				Burning++;
				Fit(key, value);
				if (Time.time >= value.nextSound && Time.time >= globalSound)
				{
					bool flag2 = Time.time - value.t0 > SustainAfter;
					value.nextSound = Time.time + (flag2 ? 4f : 1.6f);
					globalSound = Time.time + 0.3f;
					Snd.Sfx("AmaBurn", ((Component)key).gameObject);
				}
			}
		}
	}

	private static Burner Make(CharacterBody b)
	{
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Expected O, but got Unknown
		GameObject val = new GameObject("ItachiAmaterasuOn_" + ((Object)b).name);
		val.transform.SetParent(b.transform, false);
		Burner burner = new Burner
		{
			root = val,
			black = MakeSystem(val.transform, AmaFx.Black, 1400, burst: false),
			rim = MakeSystem(val.transform, AmaFx.Rim, 140, burst: false)
		};
		burner.t0 = Time.time;
		Shell(b, burner);
		Fit(b, burner);
		burner.black.Play();
		burner.rim.Play();
		burner.nextSound = Time.time + 0.8f;
		return burner;
	}

	private static float Lod(Burner u)
	{
		return ((Time.time - u.t0 > SustainAfter) ? SustainMul : 1f) * (Object.op_Implicit((Object)(object)inst) ? inst.LodGlobal : 1f);
	}

	private static void Shell(CharacterBody b, Burner u)
	{
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: 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_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: 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: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: Unknown result type (might be due to invalid IL or missing references)
		List<Collider> list = new List<Collider>();
		HurtBoxGroup val = (Object.op_Implicit((Object)(object)b) ? b.hurtBoxGroup : null);
		if (Object.op_Implicit((Object)(object)val) && val.hurtBoxes != null)
		{
			HurtBox[] hurtBoxes = val.hurtBoxes;
			foreach (HurtBox val2 in hurtBoxes)
			{
				if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.collider) && list.Count < 24)
				{
					list.Add(val2.collider);
				}
			}
		}
		if (list.Count == 0 && Object.op_Implicit((Object)(object)b) && Object.op_Implicit((Object)(object)b.mainHurtBox) && Object.op_Implicit((Object)(object)b.mainHurtBox.collider))
		{
			list.Add(b.mainHurtBox.collider);
		}
		u.cols = list.ToArray();
		u.cum = new float[u.cols.Length];
		u.area = 0f;
		for (int j = 0; j < u.cols.Length; j++)
		{
			Bounds bounds = u.cols[j].bounds;
			Vector3 extents = ((Bounds)(ref bounds)).extents;
			u.area += 4f * (extents.x * extents.y + extents.y * extents.z + extents.x * extents.z);
			u.cum[j] = u.area;
		}
	}

	private static Vector3 SurfacePoint(Collider c, out Vector3 n, out float part)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: 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_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_00e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: 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_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//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_00cb: 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_00d1: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		Bounds bounds = c.bounds;
		Vector3 extents = ((Bounds)(ref bounds)).extents;
		part = Mathf.Clamp(2f * Mathf.Max(extents.y, Mathf.Min(extents.x, extents.z)), 0.35f, 99f);
		Vector3 onUnitSphere = Random.onUnitSphere;
		MeshCollider val = (MeshCollider)(object)((c is MeshCollider) ? c : null);
		Vector3 val3;
		if ((val == null || val.convex) && c.enabled && ((Component)c).gameObject.activeInHierarchy)
		{
			Vector3 val2 = ((Bounds)(ref bounds)).center + Vector3.Scale(onUnitSphere, extents * 1.6f + Vector3.one * 0.3f);
			val3 = c.ClosestPoint(val2);
			Vector3 val4 = val3 - val2;
			if (((Vector3)(ref val4)).sqrMagnitude < 1E-06f)
			{
				val3 = ((Bounds)(ref bounds)).center + Vector3.Scale(onUnitSphere, extents);
			}
		}
		else
		{
			val3 = ((Bounds)(ref bounds)).center + Vector3.Scale(onUnitSphere, extents * 0.9f);
		}
		n = val3 - ((Bounds)(ref bounds)).center;
		n = ((((Vector3)(ref n)).sqrMagnitude > 1E-06f) ? ((Vector3)(ref n)).normalized : onUnitSphere);
		return val3;
	}

	private static void EmitShell(CharacterBody b, Burner u, float ty)
	{
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: 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_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_0171: Unknown result type (might be due to invalid IL or missing references)
		if (u.cols == null || u.cols.Length == 0 || u.area <= 0f)
		{
			return;
		}
		float num = Mathf.Clamp(u.area * ShellRate, ShellMin, ShellMax) * Lod(u);
		u.acc += num * Time.deltaTime;
		int num2 = Mathf.Min(24, (int)u.acc);
		u.acc -= num2;
		EmitParams val = default(EmitParams);
		for (int i = 0; i < num2; i++)
		{
			float num3 = Random.value * u.area;
			int j;
			for (j = 0; j < u.cum.Length - 1 && u.cum[j] < num3; j++)
			{
			}
			Collider val2 = u.cols[j];
			if (Object.op_Implicit((Object)(object)val2))
			{
				Vector3 n;
				float part;
				Vector3 val3 = SurfacePoint(val2, out n, out part);
				float num4 = Mathf.Min(ty, part * ShellSize) * Random.Range(0.75f, 1.15f);
				((EmitParams)(ref val)).position = val3 + n * ShellOut;
				((EmitParams)(ref val)).velocity = n * Random.Range(0.1f, 0.45f) + Vector3.up * Random.Range(0.2f, 0.6f);
				((EmitParams)(ref val)).startSize3D = new Vector3(num4 * ShellWidth, num4, 1f);
				u.black.Emit(val, 1);
			}
		}
	}

	private static void Fit(CharacterBody b, Burner u)
	{
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_0112: 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_012e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0133: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0140: Unknown result type (might be due to invalid IL or missing references)
		//IL_0145: Unknown result type (might be due to invalid IL or missing references)
		//IL_0229: Unknown result type (might be due to invalid IL or missing references)
		//IL_023b: 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_025d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0269: Unknown result type (might be due to invalid IL or missing references)
		//IL_0270: Unknown result type (might be due to invalid IL or missing references)
		//IL_0280: 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_0304: Unknown result type (might be due to invalid IL or missing references)
		//IL_0309: Unknown result type (might be due to invalid IL or missing references)
		//IL_035f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0216: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
		if (AmaFx.StormFlames)
		{
			AmaFx.Rim.SetFloat("_AlphaBoost", TendrilBoost);
			AmaFx.Black.SetFloat("_AlphaBoost