Decompiled source of DanJoMeShi v0.0.2

danjomeshi.dll

Decompiled 4 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using BepInEx;
using DM;
using EzECS.Barriers;
using FhpSLib.BundleModCore;
using HarmonyLib;
using Landfall.TABC;
using Landfall.TABS;
using Landfall.TABS.AI;
using Landfall.TABS.AI.Components;
using Landfall.TABS.AI.Components.Modifiers;
using Landfall.TABS.AI.Components.Tags;
using SLMA;
using TFBGames;
using Unity.Collections;
using Unity.Entities;
using Unity.Jobs;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("fixmod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("made in SFT by FhpSlime")]
[assembly: AssemblyCopyright("Copyright ©  2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3a45c3cf-230c-4310-952f-0887d4266a22")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace migong
{
	public static class UManager
	{
		public static string modname;

		public static string modder;

		private static string com;

		public static SLMABundleMod bundleMod;

		public static SLMABundleMod bundleMod1;

		static UManager()
		{
			modname = "SFT";
			modder = "FhpSlime";
		}

		public static void SetRiders(UnitBlueprint me, UnitBlueprint[] riders)
		{
			s.SetField<UnitBlueprint>(me, "Riders", (object)riders);
		}

		public static void EditBlueprint(UnitBlueprint unit, LandfallContentDatabase db)
		{
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: 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_03e1: Unknown result type (might be due to invalid IL or missing references)
			if (unit.Entity.Name == "玛露西尔")
			{
				s.SetField<UnitBlueprint>(unit, "VocalRef", (object)"Farmer Attack Vocals/Scythe");
				s.SetField<UnitBlueprint>(unit, "DeathRef", (object)"Farmer Attack Vocals/Scythe");
				s.SetField<UnitBlueprint>(unit, "VoicePitch", (object)1.3f);
				unit.Validate();
				unit.health = 800f;
				unit.forceCost = 2200u;
				unit.UnitBase = bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("马鹿");
				unit.RightWeapon = bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("马鹿法杖");
				ChineseLibrary.服装设置(unit, (GameObject[])(object)new GameObject[1] { bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("马鹿服装") });
				ChineseLibrary.技能设置(unit, (GameObject[])(object)new GameObject[3]
				{
					bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("闪光弹"),
					bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("火球术"),
					bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("恢复魔法")
				});
				unit.MovementComponents = new List<IMovementComponent> { (IMovementComponent)(object)default(KeepRangedDistance) };
			}
			if (unit.Entity.Name == "莱欧斯")
			{
				s.SetField<UnitBlueprint>(unit, "VocalRef", (object)"Ancient Attack Vocals/Hoplite");
				s.SetField<UnitBlueprint>(unit, "DeathRef", (object)"Ancient Death Vocals/Hoplite");
				s.SetField<UnitBlueprint>(unit, "VoicePitch", (object)0.8f);
				unit.Validate();
				unit.massMultiplier = 5f;
				unit.health = 1000f;
				unit.forceCost = 1500u;
				unit.sizeMultiplier = 1.2f;
				unit.UnitBase = bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("莱欧斯");
				unit.RightWeapon = bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("莱欧斯的剑");
				ChineseLibrary.技能设置(unit, (GameObject[])(object)new GameObject[4]
				{
					bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("战吼"),
					bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("格挡"),
					bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("闪避"),
					bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("惊世情商")
				});
				ChineseLibrary.服装设置(unit, (GameObject[])(object)new GameObject[7]
				{
					bundleMod1.GetAssetBundle("raptor").LoadAsset<GameObject>("莱欧斯锁子甲 1"),
					bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("莱欧斯上衣"),
					bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("莱欧斯头发"),
					bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("莱欧斯肩甲"),
					bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("莱欧斯胸甲"),
					bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("莱欧斯裤子"),
					bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("莱欧斯鞋子")
				});
			}
			if (unit.Entity.Name == "齐尔查克")
			{
				s.SetField<UnitBlueprint>(unit, "VocalRef", (object)"Farmer Attack Vocals/Halfling");
				s.SetField<UnitBlueprint>(unit, "DeathRef", (object)"Farmer Death Vocals/Halfling");
				s.SetField<UnitBlueprint>(unit, "VoicePitch", (object)0.8f);
				unit.Validate();
				unit.forceCost = 1200u;
				unit.health = 1000f;
				unit.MovementComponents = new List<IMovementComponent> { (IMovementComponent)(object)default(KeepRangedDistance) };
				unit.UnitBase = bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("查克");
				unit.RightWeapon = bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("查克的弓");
				ChineseLibrary.服装设置(unit, (GameObject[])(object)new GameObject[1] { bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("查克服装") });
				ChineseLibrary.技能设置(unit, (GameObject[])(object)new GameObject[4]
				{
					bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("跑路"),
					bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("躲闪"),
					bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("观察战场"),
					bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("触发陷阱")
				});
			}
			if (unit.Entity.Name == "森西")
			{
				s.SetField<UnitBlueprint>(unit, "VocalRef", (object)"Viking Attack Vocals/Jarl");
				s.SetField<UnitBlueprint>(unit, "DeathRef", (object)"Viking Death Vocals/Jarl");
				s.SetField<UnitBlueprint>(unit, "VoicePitch", (object)0.8f);
				unit.Validate();
				unit.massMultiplier = 10f;
				unit.health = 2500f;
				unit.sizeMultiplier = 1.2f;
				unit.forceCost = 1600u;
				bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("森西").AddComponent<ModifyEffect>();
				unit.UnitBase = bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("森西");
				unit.RightWeapon = bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("森西的斧头");
				ChineseLibrary.服装设置(unit, (GameObject[])(object)new GameObject[9]
				{
					bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("森西头盔"),
					bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("森西小胡子"),
					bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("森西背心"),
					bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("森西胖次"),
					bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("森西胡子"),
					bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("森西腿甲"),
					bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("森西鞋子"),
					bundleMod1.GetAssetBundle("raptor").LoadAsset<GameObject>("森西护腕 1"),
					bundleMod1.GetAssetBundle("raptor").LoadAsset<GameObject>("森西下装 1")
				});
				ChineseLibrary.技能设置(unit, (GameObject[])(object)new GameObject[2]
				{
					bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("面包支援"),
					bundleMod.GetAssetBundle("migong").LoadAsset<GameObject>("种族缺陷")
				});
			}
		}

		public static void EditClothes(GameObject cloth, CharacterItem item, PropItemData data, Unit unit, int index, LandfallContentDatabase db)
		{
		}

		public static void EditProjectiles(GameObject proj, ProjectileHit projhit, Unit unit, LandfallContentDatabase db)
		{
		}

		public static void EditCombatMoves(GameObject move, int index, Unit unit, LandfallContentDatabase db)
		{
		}

		public static void CodeAfterSpawn(Unit unit, LandfallContentDatabase db)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			if (unit.unitBlueprint.Entity.Name == "unit name")
			{
				Transform head = unit.data.head;
				head.localScale *= 2f;
			}
		}

		public static void Init(LandfallContentDatabase db)
		{
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Expected O, but got Unknown
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Expected O, but got Unknown
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Expected O, but got Unknown
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Expected O, but got Unknown
			com = "Bundle Mod Init";
			com = "Bundle Mod Init";
			AssetBundle val;
			using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("migong"))
			{
				val = AssetBundle.LoadFromStream(stream);
			}
			if (Loader.BundleMode)
			{
				SLMABundleMod obj = SLMABundleMod.CreatSLMABundleMod("TestMod", "0.0.1");
				obj.AddAssetBundle("migong", val);
				obj.Dev_mode = true;
				obj.LoadAssetBundle("migong");
				bundleMod = obj;
			}
			AssetBundle val2;
			using (Stream stream2 = Assembly.GetExecutingAssembly().GetManifestResourceStream("raptor"))
			{
				val2 = AssetBundle.LoadFromStream(stream2);
			}
			if (Loader.BundleMode)
			{
				SLMABundleMod obj2 = SLMABundleMod.CreatSLMABundleMod("TestMod2", "0.0.2");
				obj2.AddAssetBundle("raptor", val2);
				obj2.Dev_mode = true;
				obj2.LoadAssetBundle("raptor");
				bundleMod1 = obj2;
			}
			SoundBank soundBank = ServiceLocator.GetService<SoundPlayer>().soundBank;
			SoundBank[] array = bundleMod.GetAssetBundle("migong").LoadAllAssets<SoundBank>();
			if (array != null)
			{
				List<SoundBankCategory> list = soundBank.Categories.ToList();
				SoundBank[] array2 = array;
				foreach (SoundBank val3 in array2)
				{
					if ((Object)(object)val3 != (Object)null)
					{
						list.AddRange(val3.Categories);
					}
				}
				soundBank.Categories = list.ToArray();
			}
			VoiceBundle[] array3 = bundleMod.GetAssetBundle("migong").LoadAllAssets<VoiceBundle>();
			if (array3 != null && array3.Length != 0)
			{
				VoiceBundleDatabaseUpdater.AddVoiceBundles(array3.ToList());
			}
			else
			{
				Debug.LogError((object)"No VoiceBundle found in the loaded AssetBundle.");
			}
			bundleMod.GetAssetBundle("migong").LoadAllAssets<VoiceBundle>();
			MyModItems.GetInstance();
			Faction val4 = SLMATool.CreateFaction("Custom1", (UnitBlueprint[])null, bundleMod.GetAssetBundle("migong").LoadAsset<Sprite>("迷宫饭"), 1452);
			SLMATool.CreateUnit("莱欧斯", (UnitBlueprint)SLMALoader.SDic["blueprints"]["UNIT_TRIBAL_CLUB"], val4, bundleMod.GetAssetBundle("migong").LoadAsset<Sprite>("莱欧斯图标"));
			SLMATool.CreateUnit("玛露西尔", (UnitBlueprint)SLMALoader.SDic["blueprints"]["UNIT_TRIBAL_CLUB"], val4, bundleMod.GetAssetBundle("migong").LoadAsset<Sprite>("马鹿图标"));
			SLMATool.CreateUnit("齐尔查克", (UnitBlueprint)SLMALoader.SDic["blueprints"]["UNIT_TRIBAL_CLUB"], val4, bundleMod.GetAssetBundle("migong").LoadAsset<Sprite>("查克图标"));
			SLMATool.CreateUnit("森西", (UnitBlueprint)SLMALoader.SDic["blueprints"]["UNIT_TRIBAL_CLUB"], val4, bundleMod.GetAssetBundle("migong").LoadAsset<Sprite>("森西图标"));
			com = "——————————Fations and Units——————————";
			com = "——————————Clothes——————————";
			com = "——————————Weapons——————————";
			com = "——————————Effects——————————";
			com = "——————————Explosions——————————";
			com = "——————————UnitBases——————————";
			com = "——————————Projectiles——————————";
			com = "——————————Moves——————————";
		}

		public static void EditWeapons(GameObject weapon, Team team, Unit unit, MeleeWeapon melee, RangeWeapon range, LandfallContentDatabase db)
		{
		}

		public static void SetMoveConditionalValue(this ConditionalEventInstance gameObject, ConditionType type, ValueType valuet, float value)
		{
			//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_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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_0065: Expected O, but got Unknown
			bool flag = false;
			EventCondition[] conditions = gameObject.conditions;
			foreach (EventCondition val in conditions)
			{
				if (val.conditionType == type)
				{
					val.valueType = valuet;
					val.value = value;
					flag = true;
				}
			}
			if (!flag)
			{
				List<EventCondition> list = gameObject.conditions.ToList();
				list.Add(new EventCondition
				{
					conditionType = type,
					valueType = valuet,
					value = value
				});
				gameObject.conditions = list.ToArray();
			}
		}
	}
	[BepInPlugin("migong", "migong", "1.0.0")]
	internal class Loader : BaseUnityPlugin
	{
		public static bool BundleMode;

		private void Awake()
		{
			((MonoBehaviour)this).StartCoroutine("call");
		}

		private IEnumerator call()
		{
			yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)Object.FindObjectOfType<ServiceLocator>() != (Object)null));
			yield return (object)new WaitUntil((Func<bool>)(() => ServiceLocator.GetService<ISaveLoaderService>() != null));
			SLMALoader.GetInstance();
			LandfallContentDatabase landfallContentDatabase = ContentDatabase.Instance().LandfallContentDatabase;
			UManager.Init(landfallContentDatabase);
			new Harmony(UManager.modname).PatchAll();
			GOSLMA.EditWeapons = ((GOSLMA.EditWeapons == null) ? new Action<GameObject, Team, Unit, MeleeWeapon, RangeWeapon, LandfallContentDatabase>(UManager.EditWeapons) : ((Action<GameObject, Team, Unit, MeleeWeapon, RangeWeapon, LandfallContentDatabase>)Delegate.Combine(new Action<GameObject, Team, Unit, MeleeWeapon, RangeWeapon, LandfallContentDatabase>(UManager.EditWeapons), GOSLMA.EditWeapons)));
			GOSLMA.EditClothes = ((GOSLMA.EditClothes == null) ? new Action<GameObject, CharacterItem, PropItemData, Unit, int, LandfallContentDatabase>(UManager.EditClothes) : ((Action<GameObject, CharacterItem, PropItemData, Unit, int, LandfallContentDatabase>)Delegate.Combine(new Action<GameObject, CharacterItem, PropItemData, Unit, int, LandfallContentDatabase>(UManager.EditClothes), GOSLMA.EditClothes)));
			GOSLMA.EditCombatMoves = ((GOSLMA.EditCombatMoves == null) ? new Action<GameObject, int, Unit, LandfallContentDatabase>(UManager.EditCombatMoves) : ((Action<GameObject, int, Unit, LandfallContentDatabase>)Delegate.Combine(new Action<GameObject, int, Unit, LandfallContentDatabase>(UManager.EditCombatMoves), GOSLMA.EditCombatMoves)));
			GOSLMA.CodeAfterSpawn = ((GOSLMA.CodeAfterSpawn == null) ? new Action<Unit, LandfallContentDatabase>(UManager.CodeAfterSpawn) : ((Action<Unit, LandfallContentDatabase>)Delegate.Combine(new Action<Unit, LandfallContentDatabase>(UManager.CodeAfterSpawn), GOSLMA.CodeAfterSpawn)));
			GOSLMA.EditProjectiles = ((GOSLMA.EditProjectiles == null) ? new Action<GameObject, ProjectileHit, Unit, LandfallContentDatabase>(UManager.EditProjectiles) : ((Action<GameObject, ProjectileHit, Unit, LandfallContentDatabase>)Delegate.Combine(new Action<GameObject, ProjectileHit, Unit, LandfallContentDatabase>(UManager.EditProjectiles), GOSLMA.EditProjectiles)));
			UnitBlueprint[] array = Resources.FindObjectsOfTypeAll<UnitBlueprint>();
			for (int i = 0; i < array.Length; i++)
			{
				UManager.EditBlueprint(array[i], landfallContentDatabase);
			}
			Debug.Log((object)("Loaded " + UManager.modname + " Successfully"));
			Debug.Log((object)(UManager.modname + "is made in SFT by FhpSlime"));
			Debug.Log((object)(UManager.modder + "wished you a pleasant trip"));
		}

		static Loader()
		{
			BundleMode = true;
		}
	}
}
public class Item : MonoBehaviour
{
	public enum kind
	{
		Weapon,
		Cloth,
		Skill,
		Unit,
		Projectile,
		Other
	}

	public string name;

	public kind Kind;
}
namespace migong
{
	public class MyModItems : MonoBehaviour
	{
		private static Dictionary<string, Item> items;

		private static MyModItems instance { get; set; }

		public static MyModItems GetInstance()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)instance == (Object)null)
			{
				instance = new GameObject("MyModItems").AddComponent<MyModItems>();
				Object.DontDestroyOnLoad((Object)(object)instance);
			}
			return instance;
		}

		public void AddItem(Item item)
		{
			items.Add(item.name, item);
		}

		public Item GetItem(string name)
		{
			Item value = new Item
			{
				name = null,
				Kind = Item.kind.Other
			};
			items.TryGetValue(name, out value);
			return value;
		}
	}
}
public class Example : MonoBehaviour
{
	public GameObject prefab;

	private void Start()
	{
		if ((Object)(object)prefab != (Object)null)
		{
			Transform[] componentsInChildren = prefab.GetComponentsInChildren<Transform>();
			if (componentsInChildren.Length > 1)
			{
				_ = componentsInChildren[1];
			}
		}
	}
}
public class VoiceBundleDatabaseUpdater
{
	public static void AddVoiceBundles(IEnumerable<VoiceBundle> newVoiceBundles)
	{
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		LandfallContentDatabase landfallContentDatabase = ContentDatabase.Instance().LandfallContentDatabase;
		FieldInfo field = typeof(LandfallContentDatabase).GetField("m_voiceBundles", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field == null)
		{
			Debug.LogError((object)"m_voiceBundles field not found.");
			return;
		}
		Dictionary<DatabaseID, VoiceBundle> voiceBundlesDictionary = (Dictionary<DatabaseID, VoiceBundle>)field.GetValue(landfallContentDatabase);
		if (voiceBundlesDictionary == null)
		{
			Debug.LogError((object)"m_voiceBundles dictionary is null.");
			return;
		}
		Func<VoiceBundle, bool> predicate = (VoiceBundle voiceBundle) => Object.op_Implicit((Object)(object)voiceBundle) && voiceBundlesDictionary != null && !voiceBundlesDictionary.ContainsKey(voiceBundle.Entity.GUID);
		foreach (VoiceBundle item in newVoiceBundles.Where(predicate))
		{
			voiceBundlesDictionary.Add(item.Entity.GUID, item);
		}
		field.SetValue(landfallContentDatabase, voiceBundlesDictionary);
		Debug.Log((object)$"{newVoiceBundles.Count()} VoiceBundles added to the database.");
	}
}
public class AddUnitEffectToTarget2 : MonoBehaviour
{
	public delegate void AddedEffectEventHandler(Unit attacker, DataHandler targetData);

	public UnitEffectBase EffectPrefab;

	private Unit ownUnit;

	private TeamHolder rootTeamHolder;

	public bool onlyTeamMates;

	public event AddedEffectEventHandler AddedEffect;

	private void Start()
	{
		TeamHolder.GetTeamRelevantComponents(((Component)this).transform.root, ref ownUnit, ref rootTeamHolder);
	}

	public void Go()
	{
		Unit component = ((Component)((Component)this).transform.root).GetComponent<Unit>();
		if (Object.op_Implicit((Object)(object)component))
		{
			AddEffect(component, component.data.targetData);
		}
	}

	public void AddEffect(Unit attacker, DataHandler targetData)
	{
		//IL_0102: 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_0117: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: 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_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_0039: 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)
		if ((Object)(object)attacker == (Object)null || (Object)(object)targetData == (Object)null || targetData.Dead)
		{
			return;
		}
		Unit component = ((Component)targetData.unit).GetComponent<Unit>();
		if (!onlyTeamMates || !((Object)(object)component != (Object)null) || component.Team == ownUnit.Team)
		{
			UnitEffectBase val = UnitEffectBase.AddEffectToTarget(((Component)((Component)targetData.unit).transform).gameObject, EffectPrefab);
			if ((Object)(object)val == (Object)null)
			{
				UnitEffectBase obj = Object.Instantiate<UnitEffectBase>(EffectPrefab, ((Component)targetData.unit).transform.root);
				((Component)obj).transform.position = ((Component)targetData.unit).transform.position;
				((Component)obj).transform.rotation = Quaternion.LookRotation(targetData.mainRig.position - attacker.data.mainRig.position);
				TeamHolder.AddTeamHolder(((Component)obj).gameObject, attacker, rootTeamHolder);
				val = obj;
				val.DoEffect();
			}
			else
			{
				((Component)val).transform.rotation = Quaternion.LookRotation(targetData.mainRig.position - attacker.data.mainRig.position);
				val.Ping();
			}
			this.AddedEffect?.Invoke(attacker, targetData);
		}
	}
}
public class ModifyEffect : MonoBehaviour
{
	private class OriginalEffectValues
	{
		public float damagePerStack;

		public float forcePerStack;

		public float effectDuration;
	}

	private Dictionary<DamageOverTimeEffect, OriginalEffectValues> originalValues = new Dictionary<DamageOverTimeEffect, OriginalEffectValues>();

	private void Update()
	{
		DamageOverTimeEffect[] componentsInChildren = ((Component)this).GetComponentsInChildren<DamageOverTimeEffect>();
		foreach (DamageOverTimeEffect val in componentsInChildren)
		{
			if (!((Object)val).name.ToUpper().Contains("HEAL") || !((Object)val).name.ToUpper().Contains("Enrage") || !((Object)val).name.ToUpper().Contains("减速"))
			{
				if (!originalValues.ContainsKey(val))
				{
					RecordOriginalValues(val);
				}
				ModifyEffectValues(val);
			}
		}
	}

	private void RecordOriginalValues(DamageOverTimeEffect effectBase)
	{
		OriginalEffectValues originalEffectValues = new OriginalEffectValues();
		originalEffectValues.damagePerStack = effectBase.damagePerStack;
		originalEffectValues.forcePerStack = effectBase.forcePerStack;
		originalEffectValues.effectDuration = effectBase.effectDuration;
		originalValues[effectBase] = originalEffectValues;
	}

	private void ModifyEffectValues(DamageOverTimeEffect effectBase)
	{
		OriginalEffectValues originalEffectValues = originalValues[effectBase];
		effectBase.damagePerStack = originalEffectValues.damagePerStack / 3f;
		effectBase.forcePerStack = originalEffectValues.forcePerStack / 3f;
		effectBase.effectDuration = originalEffectValues.effectDuration / 3f;
	}
}
public class HealthBoostEffect : UnitEffectBase
{
	public UnityEvent healthBoostEvent;

	private Unit unit;

	private void Awake()
	{
		unit = ((Component)((Component)this).transform.root).GetComponent<Unit>();
	}

	public override void DoEffect()
	{
		CheckAndBoostHealth();
	}

	public override void Ping()
	{
		CheckAndBoostHealth();
	}

	private void CheckAndBoostHealth()
	{
		if ((Object)(object)unit != (Object)null)
		{
			float health = unit.data.health;
			float num = unit.data.maxHealth * 0.75f;
			if (health < num)
			{
				unit.data.health = num;
				healthBoostEvent.Invoke();
			}
		}
	}
}
public class WeaponChanger : MonoBehaviour
{
	public GameObject rightHandWeapon;

	public GameObject leftHandWeapon;

	public bool dualWield;

	private Unit unit;

	private Transform rightHandTransform;

	private Transform leftHandTransform;

	private void Start()
	{
		unit = ((Component)this).GetComponentInParent<Unit>();
		if ((Object)(object)unit != (Object)null)
		{
			rightHandTransform = ((Component)((Component)unit).GetComponentInChildren<HandRight>()).transform;
			leftHandTransform = ((Component)((Component)unit).GetComponentInChildren<HandLeft>()).transform;
			if ((Object)(object)unit.WeaponHandler == (Object)null)
			{
				Debug.LogError((object)"WeaponHandler component not found on unit!");
			}
		}
		else
		{
			Debug.LogError((object)"Unit component not found!");
		}
	}

	public void GoChange()
	{
		if ((Object)(object)unit == (Object)null || (Object)(object)unit.WeaponHandler == (Object)null)
		{
			Debug.LogError((object)"Unit or WeaponHandler is not initialized!");
			return;
		}
		DeleteGuns();
		if (dualWield)
		{
			SetDualWieldGun(rightHandWeapon, rightHandTransform, leftHandTransform);
			return;
		}
		SetGun(rightHandWeapon, rightHandTransform, (HandType)0);
		SetGun(leftHandWeapon, leftHandTransform, (HandType)1);
	}

	private void DeleteGuns()
	{
		if ((Object)(object)unit.WeaponHandler.rightWeapon != (Object)null)
		{
			Object.Destroy((Object)(object)((Component)unit.WeaponHandler.rightWeapon).gameObject);
		}
		if ((Object)(object)unit.WeaponHandler.leftWeapon != (Object)null)
		{
			Object.Destroy((Object)(object)((Component)unit.WeaponHandler.leftWeapon).gameObject);
		}
	}

	private void SetGun(GameObject weaponPrefab, Transform handTransform, HandType handType)
	{
		//IL_000c: 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_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: 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)
		if (!((Object)(object)weaponPrefab == (Object)null))
		{
			Holdable componentInChildren = Object.Instantiate<GameObject>(weaponPrefab, handTransform.position, handTransform.rotation, ((Component)unit).transform).GetComponentInChildren<Holdable>();
			componentInChildren.WasGrabbed(unit.data, handTransform);
			unit.WeaponHandler.SetWeapon(((Component)componentInChildren).GetComponent<Weapon>(), handType);
			if ((int)handType == 0)
			{
				unit.holdingHandler.rightObject = componentInChildren;
				unit.holdingHandler.rightHandActivity = (HandActivity)1;
			}
			else
			{
				unit.holdingHandler.leftObject = componentInChildren;
				unit.holdingHandler.leftHandActivity = (HandActivity)2;
			}
			JointActions.AttachJoint(((Component)handTransform).GetComponentInParent<Rigidbody>(), componentInChildren, handTransform.position, handTransform.rotation, false, 0f);
		}
	}

	private void SetDualWieldGun(GameObject weaponPrefab, Transform rightHandTransform, Transform leftHandTransform)
	{
		//IL_000c: 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_0086: 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_00ae: 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_00e1: 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)
		if (!((Object)(object)weaponPrefab == (Object)null))
		{
			GameObject val = Object.Instantiate<GameObject>(weaponPrefab, rightHandTransform.position, rightHandTransform.rotation, ((Component)unit).transform);
			Holdable componentInChildren = val.GetComponentInChildren<Holdable>();
			componentInChildren.WasGrabbed(unit.data, rightHandTransform);
			unit.WeaponHandler.SetWeapon(((Component)componentInChildren).GetComponent<Weapon>(), (HandType)0);
			unit.holdingHandler.rightObject = componentInChildren;
			unit.holdingHandler.leftObject = componentInChildren;
			unit.holdingHandler.rightHandActivity = (HandActivity)1;
			unit.holdingHandler.leftHandActivity = (HandActivity)1;
			JointActions.AttachJoint(((Component)rightHandTransform).GetComponentInParent<Rigidbody>(), componentInChildren, ((Component)val.GetComponentInChildren<HandRight>()).transform.position, ((Component)val.GetComponentInChildren<HandRight>()).transform.rotation, false, 0f);
			JointActions.AttachJoint(((Component)leftHandTransform).GetComponentInParent<Rigidbody>(), componentInChildren, ((Component)val.GetComponentInChildren<HandLeft>()).transform.position, ((Component)val.GetComponentInChildren<HandLeft>()).transform.rotation, false, 0f);
		}
	}
}
[Serializable]
[StructLayout(LayoutKind.Sequential, Size = 1)]
public struct FriendlyLeastHealthTargetingMM : ITargetingComponent, IComponentData
{
}
[UpdateBefore(typeof(PreUpdateBarrier))]
public class FindFriendlyTargetSystemMM : JobComponentSystem
{
	private struct UnitFilter
	{
		public EntityArray Entities;

		[ReadOnly]
		public SharedComponentDataArray<Team> Teams;

		public ComponentDataArray<GroundPosition> Positions;

		public ComponentDataArray<PredictedPosition> PredictedPositions;

		public ComponentDataArray<Range> Ranges;

		public ComponentDataArray<Health> Healths;

		public ComponentDataArray<HipPosition> SearchPositions;

		public ComponentDataArray<Direction> Directions;

		public ComponentDataArray<Velocity> Velocities;

		public ComponentDataArray<UnitTag> UnitTags;

		[ReadOnly]
		public SubtractiveComponent<IsInPool> IsInPool;

		public readonly int Length;

		public readonly int GroupIndex;

		[ReadOnly]
		public ComponentDataArray<FriendlyLeastHealthTargetingMM> TargetFriendTag;
	}

	private struct TargetFilter
	{
		public EntityArray Entities;

		[ReadOnly]
		public SharedComponentDataArray<Team> Teams;

		public ComponentDataArray<Range> Ranges;

		public ComponentDataArray<Health> Healths;

		public ComponentDataArray<HipPosition> SearchPositions;

		public ComponentDataArray<UnitTag> UnitTags;

		[ReadOnly]
		public SubtractiveComponent<IsInPool> IsInPool;

		public readonly int Length;

		public readonly int GroupIndex;
	}

	private struct Job : IJobParallelFor
	{
		public EntityArray UnitEntities;

		public ComponentDataArray<PredictedPosition> UnitPositions;

		[ReadOnly]
		public EntityArray TargetEntities;

		[ReadOnly]
		public ComponentDataArray<HipPosition> TargetPositions;

		[ReadOnly]
		public ComponentDataArray<Health> TargetHealths;

		[ReadOnly]
		public ComponentDataArray<Range> TargetRanges;

		public Concurrent CommandBuffer;

		[ReadOnly]
		public ComponentDataFromEntity<HasTargetTag> HasTargetTag;

		public void Execute(int index)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: 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_00d9: 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_00e2: 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)
			Entity val = ((EntityArray)(ref UnitEntities))[index];
			_ = UnitPositions[index];
			Entity val2 = Entity.Null;
			int num = -1;
			float num2 = float.MaxValue;
			for (int i = 0; i < ((EntityArray)(ref TargetEntities)).Length; i++)
			{
				_ = TargetPositions[i];
				Health val3 = TargetHealths[i];
				float num3 = val3.CurrentHealth / val3.MaxHealth;
				if (num3 < num2)
				{
					num2 = num3;
					val2 = ((EntityArray)(ref TargetEntities))[i];
					num = i;
				}
			}
			if (num > -1)
			{
				((Concurrent)(ref CommandBuffer)).SetComponent<AttackThickness>(index, val, new AttackThickness
				{
					Value = 0f
				});
				((Concurrent)(ref CommandBuffer)).SetComponent<HasTargetTag>(index, val, new HasTargetTag
				{
					Target = val2
				});
				((Concurrent)(ref CommandBuffer)).SetComponent<IsTarget>(index, val2, new IsTarget
				{
					Targetee = val
				});
			}
			else
			{
				((Concurrent)(ref CommandBuffer)).SetComponent<AttackThickness>(index, val, new AttackThickness
				{
					Value = 0f
				});
			}
		}
	}

	[Inject]
	private UnitFilter m_filter;

	[Inject]
	private TargetFilter m_targetFilter;

	[Inject]
	private PreUpdateBarrier m_barrier;

	protected override void OnCreateManager()
	{
		((ScriptBehaviourManager)this).OnCreateManager();
	}

	protected override void OnDestroyManager()
	{
		((ScriptBehaviourManager)this).OnDestroyManager();
	}

	protected override JobHandle OnUpdate(JobHandle inputDeps)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: 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_0054: 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_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_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: 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_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_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: 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_010d: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: 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_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_0129: Unknown result type (might be due to invalid IL or missing references)
		//IL_0130: 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_0139: 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_0144: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: 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_0164: Unknown result type (might be due to invalid IL or missing references)
		//IL_0166: Unknown result type (might be due to invalid IL or missing references)
		//IL_016d: Unknown result type (might be due to invalid IL or missing references)
		//IL_016f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0176: Unknown result type (might be due to invalid IL or missing references)
		//IL_0178: Unknown result type (might be due to invalid IL or missing references)
		//IL_017f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0181: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Unknown result type (might be due to invalid IL or missing references)
		//IL_018a: 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_0193: 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_01a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c1: 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_01ce: Unknown result type (might be due to invalid IL or missing references)
		EntityCommandBuffer val = ((BarrierSystem)m_barrier).CreateCommandBuffer();
		ComponentDataFromEntity<HasTargetTag> componentDataFromEntity = ((ComponentSystemBase)this).GetComponentDataFromEntity<HasTargetTag>(true);
		ComponentGroup obj = ((ComponentSystemBase)this).ComponentGroups[m_targetFilter.GroupIndex];
		ComponentGroup val2 = ((ComponentSystemBase)this).ComponentGroups[m_filter.GroupIndex];
		val2.SetFilter<Team>(new Team
		{
			Value = 0
		});
		obj.SetFilter<Team>(new Team
		{
			Value = 0
		});
		EntityArray entityArray = val2.GetEntityArray();
		ComponentDataArray<PredictedPosition> componentDataArray = val2.GetComponentDataArray<PredictedPosition>();
		EntityArray entityArray2 = obj.GetEntityArray();
		ComponentDataArray<HipPosition> componentDataArray2 = obj.GetComponentDataArray<HipPosition>();
		ComponentDataArray<Health> componentDataArray3 = obj.GetComponentDataArray<Health>();
		ComponentDataArray<Range> componentDataArray4 = obj.GetComponentDataArray<Range>();
		obj.ResetFilter();
		obj.SetFilter<Team>(new Team
		{
			Value = 1
		});
		val2.ResetFilter();
		val2.SetFilter<Team>(new Team
		{
			Value = 1
		});
		EntityArray entityArray3 = val2.GetEntityArray();
		ComponentDataArray<PredictedPosition> componentDataArray5 = val2.GetComponentDataArray<PredictedPosition>();
		EntityArray entityArray4 = obj.GetEntityArray();
		ComponentDataArray<HipPosition> componentDataArray6 = obj.GetComponentDataArray<HipPosition>();
		ComponentDataArray<Health> componentDataArray7 = obj.GetComponentDataArray<Health>();
		ComponentDataArray<Range> componentDataArray8 = obj.GetComponentDataArray<Range>();
		Job job = default(Job);
		job.UnitEntities = entityArray;
		job.UnitPositions = componentDataArray;
		job.TargetPositions = componentDataArray2;
		job.TargetEntities = entityArray2;
		job.TargetHealths = componentDataArray3;
		job.TargetRanges = componentDataArray4;
		job.CommandBuffer = ((EntityCommandBuffer)(ref val)).ToConcurrent();
		job.HasTargetTag = componentDataFromEntity;
		Job job2 = job;
		job = default(Job);
		job.UnitEntities = entityArray3;
		job.UnitPositions = componentDataArray5;
		job.TargetEntities = entityArray4;
		job.TargetPositions = componentDataArray6;
		job.TargetHealths = componentDataArray7;
		job.TargetRanges = componentDataArray8;
		job.CommandBuffer = ((EntityCommandBuffer)(ref val)).ToConcurrent();
		job.HasTargetTag = componentDataFromEntity;
		Job job3 = job;
		JobHandle val3 = IJobParallelForExtensions.Schedule<Job>(job2, ((EntityArray)(ref entityArray)).Length, 12, inputDeps);
		return IJobParallelForExtensions.Schedule<Job>(job3, ((EntityArray)(ref entityArray3)).Length, 12, val3);
	}
}
public class ChangeTargetingType2 : MonoBehaviour
{
	public float targetFriendlyFor;

	public bool stopAttacks = true;

	public float stopAttacksFor;

	public bool setStopToEffectTime = true;

	private UnitAPI api;

	public float teamDamage;

	private float originalteamdamage;

	private CollisionWeapon rightDamage;

	private CollisionWeapon leftDamage;

	private bool rightTeamDamageIsSet;

	private bool leftTeamDamageIsSet;

	private void Update()
	{
		if (targetFriendlyFor > 0f)
		{
			targetFriendlyFor -= Time.deltaTime;
		}
		else if (api.CurrentTargetingType != api.DefaultTargetingType)
		{
			SetDefault();
		}
	}

	public void SetTargetFriendlyFor(float f)
	{
		if (!Object.op_Implicit((Object)(object)api))
		{
			api = ((Component)((Component)this).transform.root).GetComponent<UnitAPI>();
		}
		targetFriendlyFor = f;
		WeaponHandler weaponHandler = ((Component)api).GetComponent<Unit>().data.weaponHandler;
		if (stopAttacks)
		{
			if (setStopToEffectTime)
			{
				stopAttacksFor = f;
			}
			if ((Object)(object)weaponHandler != (Object)null)
			{
				weaponHandler.StopAttacksFor(stopAttacksFor);
			}
			else
			{
				MultipleWeaponHandler componentInChildren = ((Component)api).GetComponentInChildren<MultipleWeaponHandler>();
				if (Object.op_Implicit((Object)(object)componentInChildren))
				{
					componentInChildren.StopAttacksFor(stopAttacksFor);
				}
			}
		}
		if (teamDamage != 0f)
		{
			if (Object.op_Implicit((Object)(object)weaponHandler.rightWeapon))
			{
				rightDamage = ((Component)weaponHandler.rightWeapon).GetComponent<CollisionWeapon>();
				if (Object.op_Implicit((Object)(object)rightDamage))
				{
					originalteamdamage = rightDamage.teamDamage;
					rightDamage.teamDamage = teamDamage;
					rightTeamDamageIsSet = true;
				}
			}
			if (Object.op_Implicit((Object)(object)weaponHandler.leftWeapon))
			{
				leftDamage = ((Component)weaponHandler.leftWeapon).GetComponent<CollisionWeapon>();
				if (Object.op_Implicit((Object)(object)leftDamage))
				{
					originalteamdamage = leftDamage.teamDamage;
					leftDamage.teamDamage = teamDamage;
					leftTeamDamageIsSet = true;
				}
			}
		}
		SetTargetFriendly();
	}

	public void SetTargetFriendly()
	{
		if (!Object.op_Implicit((Object)(object)api))
		{
			api = ((Component)((Component)this).transform.root).GetComponent<UnitAPI>();
		}
		api.SetTargetingType((ITargetingComponent)(object)default(FriendlyLeastHealthTargetingMM));
	}

	public void SetDefault()
	{
		if (!Object.op_Implicit((Object)(object)api))
		{
			api = ((Component)((Component)this).transform.root).GetComponent<UnitAPI>();
		}
		api.SetTargetingType(api.DefaultTargetingType);
		if (rightTeamDamageIsSet)
		{
			rightDamage.teamDamage = originalteamdamage;
			rightTeamDamageIsSet = false;
		}
		if (leftTeamDamageIsSet)
		{
			leftDamage.teamDamage = originalteamdamage;
			leftTeamDamageIsSet = false;
		}
	}
}
[Serializable]
[StructLayout(LayoutKind.Sequential, Size = 1)]
public struct FriendlyLeastHealthTargetingMS : ITargetingComponent, IComponentData
{
}
[UpdateBefore(typeof(PreUpdateBarrier))]
public class FindFriendlyTargetSystemMS : JobComponentSystem
{
	private struct UnitFilter
	{
		public EntityArray Entities;

		[ReadOnly]
		public SharedComponentDataArray<Team> Teams;

		public ComponentDataArray<GroundPosition> Positions;

		public ComponentDataArray<PredictedPosition> PredictedPositions;

		public ComponentDataArray<Range> Ranges;

		public ComponentDataArray<Health> Healths;

		public ComponentDataArray<HipPosition> SearchPositions;

		public ComponentDataArray<Direction> Directions;

		public ComponentDataArray<Velocity> Velocities;

		public ComponentDataArray<UnitTag> UnitTags;

		[ReadOnly]
		public SubtractiveComponent<IsInPool> IsInPool;

		public readonly int Length;

		public readonly int GroupIndex;

		[ReadOnly]
		public ComponentDataArray<FriendlyLeastHealthTargetingMS> TargetFriendTag;
	}

	private struct TargetFilter
	{
		public EntityArray Entities;

		[ReadOnly]
		public SharedComponentDataArray<Team> Teams;

		public ComponentDataArray<Range> Ranges;

		public ComponentDataArray<Health> Healths;

		public ComponentDataArray<HipPosition> SearchPositions;

		public ComponentDataArray<UnitTag> UnitTags;

		[ReadOnly]
		public SubtractiveComponent<IsInPool> IsInPool;

		public readonly int Length;

		public readonly int GroupIndex;
	}

	private struct Job : IJobParallelFor
	{
		private static Random random;

		public EntityArray UnitEntities;

		public ComponentDataArray<PredictedPosition> UnitPositions;

		[ReadOnly]
		public EntityArray TargetEntities;

		[ReadOnly]
		public ComponentDataArray<HipPosition> TargetPositions;

		[ReadOnly]
		public ComponentDataArray<Health> TargetHealths;

		[ReadOnly]
		public ComponentDataArray<Range> TargetRanges;

		public Concurrent CommandBuffer;

		[ReadOnly]
		public ComponentDataFromEntity<HasTargetTag> HasTargetTag;

		public void Execute(int index)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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_0080: 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_008b: 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_0091: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			Entity val = ((EntityArray)(ref UnitEntities))[index];
			_ = UnitPositions[index];
			Entity val2 = Entity.Null;
			int num = -1;
			if (((EntityArray)(ref TargetEntities)).Length > 0)
			{
				num = ((Random)(ref random)).NextInt(((EntityArray)(ref TargetEntities)).Length);
				val2 = ((EntityArray)(ref TargetEntities))[num];
			}
			if (num > -1)
			{
				((Concurrent)(ref CommandBuffer)).SetComponent<AttackThickness>(index, val, new AttackThickness
				{
					Value = 0f
				});
				((Concurrent)(ref CommandBuffer)).SetComponent<HasTargetTag>(index, val, new HasTargetTag
				{
					Target = val2
				});
				((Concurrent)(ref CommandBuffer)).SetComponent<IsTarget>(index, val2, new IsTarget
				{
					Targetee = val
				});
			}
			else
			{
				((Concurrent)(ref CommandBuffer)).SetComponent<AttackThickness>(index, val, new AttackThickness
				{
					Value = 0f
				});
			}
		}

		static Job()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			random = new Random((uint)DateTime.Now.Ticks);
		}
	}

	[Inject]
	private UnitFilter m_filter;

	[Inject]
	private TargetFilter m_targetFilter;

	[Inject]
	private PreUpdateBarrier m_barrier;

	protected override void OnCreateManager()
	{
		((ScriptBehaviourManager)this).OnCreateManager();
	}

	protected override void OnDestroyManager()
	{
		((ScriptBehaviourManager)this).OnDestroyManager();
	}

	protected override JobHandle OnUpdate(JobHandle inputDeps)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: 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_0054: 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_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_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: 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_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_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: 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_010d: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: 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_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_0129: Unknown result type (might be due to invalid IL or missing references)
		//IL_0130: 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_0139: 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_0144: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: 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_0164: Unknown result type (might be due to invalid IL or missing references)
		//IL_0166: Unknown result type (might be due to invalid IL or missing references)
		//IL_016d: Unknown result type (might be due to invalid IL or missing references)
		//IL_016f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0176: Unknown result type (might be due to invalid IL or missing references)
		//IL_0178: Unknown result type (might be due to invalid IL or missing references)
		//IL_017f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0181: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Unknown result type (might be due to invalid IL or missing references)
		//IL_018a: 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_0193: 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_01a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c1: 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_01ce: Unknown result type (might be due to invalid IL or missing references)
		EntityCommandBuffer val = ((BarrierSystem)m_barrier).CreateCommandBuffer();
		ComponentDataFromEntity<HasTargetTag> componentDataFromEntity = ((ComponentSystemBase)this).GetComponentDataFromEntity<HasTargetTag>(true);
		ComponentGroup obj = ((ComponentSystemBase)this).ComponentGroups[m_targetFilter.GroupIndex];
		ComponentGroup val2 = ((ComponentSystemBase)this).ComponentGroups[m_filter.GroupIndex];
		val2.SetFilter<Team>(new Team
		{
			Value = 0
		});
		obj.SetFilter<Team>(new Team
		{
			Value = 0
		});
		EntityArray entityArray = val2.GetEntityArray();
		ComponentDataArray<PredictedPosition> componentDataArray = val2.GetComponentDataArray<PredictedPosition>();
		EntityArray entityArray2 = obj.GetEntityArray();
		ComponentDataArray<HipPosition> componentDataArray2 = obj.GetComponentDataArray<HipPosition>();
		ComponentDataArray<Health> componentDataArray3 = obj.GetComponentDataArray<Health>();
		ComponentDataArray<Range> componentDataArray4 = obj.GetComponentDataArray<Range>();
		obj.ResetFilter();
		obj.SetFilter<Team>(new Team
		{
			Value = 1
		});
		val2.ResetFilter();
		val2.SetFilter<Team>(new Team
		{
			Value = 1
		});
		EntityArray entityArray3 = val2.GetEntityArray();
		ComponentDataArray<PredictedPosition> componentDataArray5 = val2.GetComponentDataArray<PredictedPosition>();
		EntityArray entityArray4 = obj.GetEntityArray();
		ComponentDataArray<HipPosition> componentDataArray6 = obj.GetComponentDataArray<HipPosition>();
		ComponentDataArray<Health> componentDataArray7 = obj.GetComponentDataArray<Health>();
		ComponentDataArray<Range> componentDataArray8 = obj.GetComponentDataArray<Range>();
		Job job = default(Job);
		job.UnitEntities = entityArray;
		job.UnitPositions = componentDataArray;
		job.TargetPositions = componentDataArray2;
		job.TargetEntities = entityArray2;
		job.TargetHealths = componentDataArray3;
		job.TargetRanges = componentDataArray4;
		job.CommandBuffer = ((EntityCommandBuffer)(ref val)).ToConcurrent();
		job.HasTargetTag = componentDataFromEntity;
		Job job2 = job;
		job = default(Job);
		job.UnitEntities = entityArray3;
		job.UnitPositions = componentDataArray5;
		job.TargetEntities = entityArray4;
		job.TargetPositions = componentDataArray6;
		job.TargetHealths = componentDataArray7;
		job.TargetRanges = componentDataArray8;
		job.CommandBuffer = ((EntityCommandBuffer)(ref val)).ToConcurrent();
		job.HasTargetTag = componentDataFromEntity;
		Job job3 = job;
		JobHandle val3 = IJobParallelForExtensions.Schedule<Job>(job2, ((EntityArray)(ref entityArray)).Length, 12, inputDeps);
		return IJobParallelForExtensions.Schedule<Job>(job3, ((EntityArray)(ref entityArray3)).Length, 12, val3);
	}
}
public class ChangeTargetingType2__0 : MonoBehaviour
{
	public float targetFriendlyFor;

	public bool stopAttacks = true;

	public float stopAttacksFor;

	public bool setStopToEffectTime = true;

	private UnitAPI api;

	public float teamDamage;

	private float originalteamdamage;

	private CollisionWeapon rightDamage;

	private CollisionWeapon leftDamage;

	private bool rightTeamDamageIsSet;

	private bool leftTeamDamageIsSet;

	private void Update()
	{
		if (targetFriendlyFor > 0f)
		{
			targetFriendlyFor -= Time.deltaTime;
		}
		else if (api.CurrentTargetingType != api.DefaultTargetingType)
		{
			SetDefault();
		}
	}

	public void SetTargetFriendlyFor(float f)
	{
		if (!Object.op_Implicit((Object)(object)api))
		{
			api = ((Component)((Component)this).transform.root).GetComponent<UnitAPI>();
		}
		targetFriendlyFor = f;
		WeaponHandler weaponHandler = ((Component)api).GetComponent<Unit>().data.weaponHandler;
		if (stopAttacks)
		{
			if (setStopToEffectTime)
			{
				stopAttacksFor = f;
			}
			if ((Object)(object)weaponHandler != (Object)null)
			{
				weaponHandler.StopAttacksFor(stopAttacksFor);
			}
			else
			{
				MultipleWeaponHandler componentInChildren = ((Component)api).GetComponentInChildren<MultipleWeaponHandler>();
				if (Object.op_Implicit((Object)(object)componentInChildren))
				{
					componentInChildren.StopAttacksFor(stopAttacksFor);
				}
			}
		}
		if (teamDamage != 0f)
		{
			if (Object.op_Implicit((Object)(object)weaponHandler.rightWeapon))
			{
				rightDamage = ((Component)weaponHandler.rightWeapon).GetComponent<CollisionWeapon>();
				if (Object.op_Implicit((Object)(object)rightDamage))
				{
					originalteamdamage = rightDamage.teamDamage;
					rightDamage.teamDamage = teamDamage;
					rightTeamDamageIsSet = true;
				}
			}
			if (Object.op_Implicit((Object)(object)weaponHandler.leftWeapon))
			{
				leftDamage = ((Component)weaponHandler.leftWeapon).GetComponent<CollisionWeapon>();
				if (Object.op_Implicit((Object)(object)leftDamage))
				{
					originalteamdamage = leftDamage.teamDamage;
					leftDamage.teamDamage = teamDamage;
					leftTeamDamageIsSet = true;
				}
			}
		}
		SetTargetFriendly();
	}

	public void SetTargetFriendly()
	{
		if (!Object.op_Implicit((Object)(object)api))
		{
			api = ((Component)((Component)this).transform.root).GetComponent<UnitAPI>();
		}
		api.SetTargetingType((ITargetingComponent)(object)default(FriendlyLeastHealthTargetingMS));
	}

	public void SetDefault()
	{
		if (!Object.op_Implicit((Object)(object)api))
		{
			api = ((Component)((Component)this).transform.root).GetComponent<UnitAPI>();
		}
		api.SetTargetingType(api.DefaultTargetingType);
		if (rightTeamDamageIsSet)
		{
			rightDamage.teamDamage = originalteamdamage;
			rightTeamDamageIsSet = false;
		}
		if (leftTeamDamageIsSet)
		{
			leftDamage.teamDamage = originalteamdamage;
			leftTeamDamageIsSet = false;
		}
	}
}
[UpdateBefore(typeof(PreUpdateBarrier))]
public class FindFriendlyTargetSystemMM__0 : JobComponentSystem
{
	private struct UnitFilter
	{
		public EntityArray Entities;

		[ReadOnly]
		public SharedComponentDataArray<Team> Teams;

		public ComponentDataArray<GroundPosition> Positions;

		public ComponentDataArray<PredictedPosition> PredictedPositions;

		public ComponentDataArray<Range> Ranges;

		public ComponentDataArray<Health> Healths;

		public ComponentDataArray<HipPosition> SearchPositions;

		public ComponentDataArray<Direction> Directions;

		public ComponentDataArray<Velocity> Velocities;

		public ComponentDataArray<UnitTag> UnitTags;

		[ReadOnly]
		public SubtractiveComponent<IsInPool> IsInPool;

		public readonly int Length;

		public readonly int GroupIndex;

		[ReadOnly]
		public ComponentDataArray<FriendlyLeastHealthTargetingMM2> TargetFriendTag;
	}

	private struct TargetFilter
	{
		public EntityArray Entities;

		[ReadOnly]
		public SharedComponentDataArray<Team> Teams;

		public ComponentDataArray<Range> Ranges;

		public ComponentDataArray<Health> Healths;

		public ComponentDataArray<HipPosition> SearchPositions;

		public ComponentDataArray<UnitTag> UnitTags;

		[ReadOnly]
		public SubtractiveComponent<IsInPool> IsInPool;

		public readonly int Length;

		public readonly int GroupIndex;
	}

	private struct Job : IJobParallelFor
	{
		public EntityArray UnitEntities;

		public ComponentDataArray<PredictedPosition> UnitPositions;

		[ReadOnly]
		public EntityArray TargetEntities;

		[ReadOnly]
		public ComponentDataArray<HipPosition> TargetPositions;

		[ReadOnly]
		public ComponentDataArray<Health> TargetHealths;

		[ReadOnly]
		public ComponentDataArray<Range> TargetRanges;

		public Concurrent CommandBuffer;

		[ReadOnly]
		public ComponentDataFromEntity<HasTargetTag> HasTargetTag;

		public void Execute(int index)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: 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_00d9: 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_00e2: 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)
			Entity val = ((EntityArray)(ref UnitEntities))[index];
			_ = UnitPositions[index];
			Entity val2 = Entity.Null;
			int num = -1;
			float num2 = float.MaxValue;
			for (int i = 0; i < ((EntityArray)(ref TargetEntities)).Length; i++)
			{
				_ = TargetPositions[i];
				Health val3 = TargetHealths[i];
				float num3 = val3.CurrentHealth / val3.MaxHealth;
				if (num3 < num2)
				{
					num2 = num3;
					val2 = ((EntityArray)(ref TargetEntities))[i];
					num = i;
				}
			}
			if (num > -1)
			{
				((Concurrent)(ref CommandBuffer)).SetComponent<AttackThickness>(index, val, new AttackThickness
				{
					Value = 0f
				});
				((Concurrent)(ref CommandBuffer)).SetComponent<HasTargetTag>(index, val, new HasTargetTag
				{
					Target = val2
				});
				((Concurrent)(ref CommandBuffer)).SetComponent<IsTarget>(index, val2, new IsTarget
				{
					Targetee = val
				});
			}
			else
			{
				((Concurrent)(ref CommandBuffer)).SetComponent<AttackThickness>(index, val, new AttackThickness
				{
					Value = 0f
				});
			}
		}
	}

	[Inject]
	private UnitFilter m_filter;

	[Inject]
	private TargetFilter m_targetFilter;

	[Inject]
	private PreUpdateBarrier m_barrier;

	protected override void OnCreateManager()
	{
		((ScriptBehaviourManager)this).OnCreateManager();
	}

	protected override void OnDestroyManager()
	{
		((ScriptBehaviourManager)this).OnDestroyManager();
	}

	protected override JobHandle OnUpdate(JobHandle inputDeps)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: 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_0054: 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_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_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: 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_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_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: 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_010d: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: 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_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_0129: Unknown result type (might be due to invalid IL or missing references)
		//IL_0130: 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_0139: 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_0144: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: 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_0164: Unknown result type (might be due to invalid IL or missing references)
		//IL_0166: Unknown result type (might be due to invalid IL or missing references)
		//IL_016d: Unknown result type (might be due to invalid IL or missing references)
		//IL_016f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0176: Unknown result type (might be due to invalid IL or missing references)
		//IL_0178: Unknown result type (might be due to invalid IL or missing references)
		//IL_017f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0181: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Unknown result type (might be due to invalid IL or missing references)
		//IL_018a: 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_0193: 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_01a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c1: 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_01ce: Unknown result type (might be due to invalid IL or missing references)
		EntityCommandBuffer val = ((BarrierSystem)m_barrier).CreateCommandBuffer();
		ComponentDataFromEntity<HasTargetTag> componentDataFromEntity = ((ComponentSystemBase)this).GetComponentDataFromEntity<HasTargetTag>(true);
		ComponentGroup obj = ((ComponentSystemBase)this).ComponentGroups[m_targetFilter.GroupIndex];
		ComponentGroup val2 = ((ComponentSystemBase)this).ComponentGroups[m_filter.GroupIndex];
		val2.SetFilter<Team>(new Team
		{
			Value = 1
		});
		obj.SetFilter<Team>(new Team
		{
			Value = 0
		});
		EntityArray entityArray = val2.GetEntityArray();
		ComponentDataArray<PredictedPosition> componentDataArray = val2.GetComponentDataArray<PredictedPosition>();
		EntityArray entityArray2 = obj.GetEntityArray();
		ComponentDataArray<HipPosition> componentDataArray2 = obj.GetComponentDataArray<HipPosition>();
		ComponentDataArray<Health> componentDataArray3 = obj.GetComponentDataArray<Health>();
		ComponentDataArray<Range> componentDataArray4 = obj.GetComponentDataArray<Range>();
		obj.ResetFilter();
		obj.SetFilter<Team>(new Team
		{
			Value = 1
		});
		val2.ResetFilter();
		val2.SetFilter<Team>(new Team
		{
			Value = 0
		});
		EntityArray entityArray3 = val2.GetEntityArray();
		ComponentDataArray<PredictedPosition> componentDataArray5 = val2.GetComponentDataArray<PredictedPosition>();
		EntityArray entityArray4 = obj.GetEntityArray();
		ComponentDataArray<HipPosition> componentDataArray6 = obj.GetComponentDataArray<HipPosition>();
		ComponentDataArray<Health> componentDataArray7 = obj.GetComponentDataArray<Health>();
		ComponentDataArray<Range> componentDataArray8 = obj.GetComponentDataArray<Range>();
		Job job = default(Job);
		job.UnitEntities = entityArray;
		job.UnitPositions = componentDataArray;
		job.TargetPositions = componentDataArray2;
		job.TargetEntities = entityArray2;
		job.TargetHealths = componentDataArray3;
		job.TargetRanges = componentDataArray4;
		job.CommandBuffer = ((EntityCommandBuffer)(ref val)).ToConcurrent();
		job.HasTargetTag = componentDataFromEntity;
		Job job2 = job;
		job = default(Job);
		job.UnitEntities = entityArray3;
		job.UnitPositions = componentDataArray5;
		job.TargetEntities = entityArray4;
		job.TargetPositions = componentDataArray6;
		job.TargetHealths = componentDataArray7;
		job.TargetRanges = componentDataArray8;
		job.CommandBuffer = ((EntityCommandBuffer)(ref val)).ToConcurrent();
		job.HasTargetTag = componentDataFromEntity;
		Job job3 = job;
		JobHandle val3 = IJobParallelForExtensions.Schedule<Job>(job2, ((EntityArray)(ref entityArray)).Length, 12, inputDeps);
		return IJobParallelForExtensions.Schedule<Job>(job3, ((EntityArray)(ref entityArray3)).Length, 12, val3);
	}
}
[Serializable]
[StructLayout(LayoutKind.Sequential, Size = 1)]
public struct FriendlyLeastHealthTargetingMM2 : ITargetingComponent, IComponentData
{
}
public class ChangeTargetingType2__0__0 : MonoBehaviour
{
	public float targetFriendlyFor;

	public bool stopAttacks = true;

	public float stopAttacksFor;

	public bool setStopToEffectTime = true;

	private UnitAPI api;

	public float teamDamage;

	private float originalteamdamage;

	private CollisionWeapon rightDamage;

	private CollisionWeapon leftDamage;

	private bool rightTeamDamageIsSet;

	private bool leftTeamDamageIsSet;

	private void Update()
	{
		if (targetFriendlyFor > 0f)
		{
			targetFriendlyFor -= Time.deltaTime;
		}
		else if (api.CurrentTargetingType != api.DefaultTargetingType)
		{
			SetDefault();
		}
	}

	public void SetTargetFriendlyFor(float f)
	{
		if (!Object.op_Implicit((Object)(object)api))
		{
			api = ((Component)((Component)this).transform.root).GetComponent<UnitAPI>();
		}
		targetFriendlyFor = f;
		WeaponHandler weaponHandler = ((Component)api).GetComponent<Unit>().data.weaponHandler;
		if (stopAttacks)
		{
			if (setStopToEffectTime)
			{
				stopAttacksFor = f;
			}
			if ((Object)(object)weaponHandler != (Object)null)
			{
				weaponHandler.StopAttacksFor(stopAttacksFor);
			}
			else
			{
				MultipleWeaponHandler componentInChildren = ((Component)api).GetComponentInChildren<MultipleWeaponHandler>();
				if (Object.op_Implicit((Object)(object)componentInChildren))
				{
					componentInChildren.StopAttacksFor(stopAttacksFor);
				}
			}
		}
		if (teamDamage != 0f)
		{
			if (Object.op_Implicit((Object)(object)weaponHandler.rightWeapon))
			{
				rightDamage = ((Component)weaponHandler.rightWeapon).GetComponent<CollisionWeapon>();
				if (Object.op_Implicit((Object)(object)rightDamage))
				{
					originalteamdamage = rightDamage.teamDamage;
					rightDamage.teamDamage = teamDamage;
					rightTeamDamageIsSet = true;
				}
			}
			if (Object.op_Implicit((Object)(object)weaponHandler.leftWeapon))
			{
				leftDamage = ((Component)weaponHandler.leftWeapon).GetComponent<CollisionWeapon>();
				if (Object.op_Implicit((Object)(object)leftDamage))
				{
					originalteamdamage = leftDamage.teamDamage;
					leftDamage.teamDamage = teamDamage;
					leftTeamDamageIsSet = true;
				}
			}
		}
		SetTargetFriendly();
	}

	public void SetTargetFriendly()
	{
		if (!Object.op_Implicit((Object)(object)api))
		{
			api = ((Component)((Component)this).transform.root).GetComponent<UnitAPI>();
		}
		api.SetTargetingType((ITargetingComponent)(object)default(FriendlyLeastHealthTargetingMM2));
	}

	public void SetDefault()
	{
		if (!Object.op_Implicit((Object)(object)api))
		{
			api = ((Component)((Component)this).transform.root).GetComponent<UnitAPI>();
		}
		api.SetTargetingType(api.DefaultTargetingType);
		if (rightTeamDamageIsSet)
		{
			rightDamage.teamDamage = originalteamdamage;
			rightTeamDamageIsSet = false;
		}
		if (leftTeamDamageIsSet)
		{
			leftDamage.teamDamage = originalteamdamage;
			leftTeamDamageIsSet = false;
		}
	}
}
public class Effect_Tase : UnitEffectBase
{
	private float taserEffect;

	public float taseAmount = 4f;

	public float selfOffset = 2f;

	public override void DoEffect()
	{
		Tase(taseAmount);
	}

	public override void Ping()
	{
	}

	public void Tase(float amount)
	{
		((MonoBehaviour)this).StartCoroutine(DoTase(amount));
	}

	public IEnumerator DoTase(float amount)
	{
		bool previouslyContainedConstantForce = true;
		Rigidbody mainRig = ((Component)((Component)this).transform.root).GetComponent<Unit>().data.mainRig;
		ConstantForce constantForce = ((Component)mainRig).GetComponent<ConstantForce>();
		if ((Object)(object)constantForce == (Object)null || constantForce.force == Vector3.down * 0f * mainRig.mass)
		{
			previouslyContainedConstantForce = false;
			if ((Object)(object)constantForce == (Object)null)
			{
				constantForce = ((Component)mainRig).gameObject.AddComponent<ConstantForce>();
			}
			constantForce.force = Vector3.down * 700f * mainRig.mass;
		}
		taserEffect = amount;
		yield return (object)new WaitUntil((Func<bool>)(() => taserEffect <= 0f));
		if (!previouslyContainedConstantForce)
		{
			constantForce.force = Vector3.down * 0f * mainRig.mass;
		}
		Effect_Tase[] array = Object.FindObjectsOfType<Effect_Tase>();
		for (int i = 0; i < array.Length; i++)
		{
			Object.Destroy((Object)(object)array[i]);
		}
	}

	public void FixedUpdate()
	{
		//IL_0069: 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_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: 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)
		if (taserEffect > 0f && !((Component)((Component)this).transform.root).GetComponent<Unit>().data.Dead)
		{
			taserEffect -= Time.fixedDeltaTime;
			Rigidbody[] allRigs = ((Component)((Component)((Component)this).transform.root).GetComponent<Unit>().data).GetComponent<RigidbodyHolder>().AllRigs;
			foreach (Rigidbody obj in allRigs)
			{
				obj.AddTorque(Random.insideUnitSphere * 100f * Mathf.Cos(Time.time * 15f), (ForceMode)0);
				obj.AddTorque(Random.insideUnitSphere * 2000f * Mathf.Cos(Time.time * 15f), (ForceMode)5);
			}
		}
	}
}
public class GoCheckHealth : MonoBehaviour
{
	public float checkInterval = 0.1f;

	public float maxCheckTime = 3f;

	public UnityEvent onTargetFound;

	public UnityEvent onTargetNotFound;

	private Unit unit;

	private Transform targetTrans;

	private Coroutine checkCoroutine;

	public float requiredHealthRatio = 0.5f;

	private void Start()
	{
		unit = ((Component)((Component)this).transform.root).GetComponent<Unit>();
		if ((Object)(object)unit != (Object)null)
		{
			targetTrans = ((Component)unit.data.mainRig).transform;
		}
	}

	public void GoCheck()
	{
		Debug.Log((object)"GoCheck() called");
		if (checkCoroutine != null)
		{
			Debug.Log((object)"Stopping existing check coroutine");
			((MonoBehaviour)this).StopCoroutine(checkCoroutine);
		}
		checkCoroutine = ((MonoBehaviour)this).StartCoroutine(CheckTarget());
	}

	private IEnumerator CheckTarget()
	{
		Debug.Log((object)"CheckTarget() started");
		float timer = 0f;
		while (timer < maxCheckTime)
		{
			if ((Object)(object)unit == (Object)null || unit.data.Dead)
			{
				Debug.Log((object)"Unit is null or dead, stopping check");
				break;
			}
			if (Object.op_Implicit((Object)(object)unit.data.targetData))
			{
				float distanceToTarget = unit.data.distanceToTarget;
				float health = unit.data.targetData.health;
				float maxHealth = unit.data.targetData.maxHealth;
				float num = health / maxHealth;
				Debug.Log((object)$"Checking target: distance = {distanceToTarget}, health = {health}, maxHealth = {maxHealth}, healthRatio = {num}");
				if (num < requiredHealthRatio)
				{
					Debug.Log((object)"Target found with health ratio below required, invoking onTargetFound event");
					UnityEvent val = onTargetFound;
					if (val != null)
					{
						val.Invoke();
					}
					checkCoroutine = null;
					yield break;
				}
			}
			timer += checkInterval;
			yield return (object)new WaitForSeconds(checkInterval);
		}
		Debug.Log((object)"Target not found within max check time, invoking onTargetNotFound event");
		UnityEvent val2 = onTargetNotFound;
		if (val2 != null)
		{
			val2.Invoke();
		}
		checkCoroutine = null;
	}
}
public class MeleeWeaponAddEffect2 : CollisionWeaponEffect
{
	public UnitEffectBase EffectPrefab;

	public bool ignoreTeamMates;

	private bool doEffect;

	private bool faEffect;

	public override void DoEffect(Transform hitTransform, Collision hit)
	{
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Expected O, but got Unknown
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		if (faEffect || !doEffect)
		{
			return;
		}
		if (ignoreTeamMates)
		{
			Unit component = ((Component)((Component)this).transform.root).GetComponent<Unit>();
			Unit component2 = ((Component)hitTransform.root).GetComponent<Unit>();
			if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component2) && component.Team == component2.Team)
			{
				return;
			}
		}
		Type type = ((object)EffectPrefab).GetType();
		UnitEffectBase val = (UnitEffectBase)((Component)hitTransform.root).GetComponentInChildren(type);
		if ((Object)(object)val == (Object)null)
		{
			GameObject obj = Object.Instantiate<GameObject>(((Component)EffectPrefab).gameObject, hitTransform.root);
			obj.transform.position = hitTransform.root.position;
			obj.GetComponent<UnitEffectBase>().DoEffect();
		}
		else
		{
			val.Ping();
		}
	}

	public void Do()
	{
		doEffect = true;
		faEffect = false;
	}

	public void Fa()
	{
		faEffect = true;
		doEffect = false;
	}
}
public class NewSpookySwords : MonoBehaviour
{
	public delegate void AttackedEventHandler(Rigidbody target, int useAttackID);

	public UnityEvent shootEvent;

	private ShootPosition[] swordPoints;

	private List<SpookySword> swords = new List<SpookySword>();

	public GameObject sourceSword;

	public float followSpeed = 1f;

	public float throwSpeed = 100f;

	public AnimationCurve throwCurve;

	private DataHandler data;

	private float attackspeedMulti = 1f;

	public float attackRange = 10f;

	[CompilerGenerated]
	private AttackedEventHandler m_Attacked;

	private float counter;

	private bool allSwordsUsed;

	public float attackRate;

	private bool swordsGenerated;

	public event AttackedEventHandler Attacked
	{
		[CompilerGenerated]
		add
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			AttackedEventHandler val = this.m_Attacked;
			AttackedEventHandler val2;
			do
			{
				val2 = val;
				AttackedEventHandler value2 = (AttackedEventHandler)Delegate.Combine((Delegate?)(object)val2, (Delegate?)(object)value);
				val = Interlocked.CompareExchange(ref this.m_Attacked, value2, val2);
			}
			while (val != val2);
		}
		[CompilerGenerated]
		remove
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			AttackedEventHandler val = this.m_Attacked;
			AttackedEventHandler val2;
			do
			{
				val2 = val;
				AttackedEventHandler value2 = (AttackedEventHandler)Delegate.Remove((Delegate?)(object)val2, (Delegate?)(object)value);
				val = Interlocked.CompareExchange(ref this.m_Attacked, value2, val2);
			}
			while (val != val2);
		}
	}

	private void Awake()
	{
		swordPoints = ((Component)this).GetComponentsInChildren<ShootPosition>();
	}

	private void Update()
	{
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: 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_00e4: 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_00fb: 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_0110: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: 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)
		if ((Object)(object)data == (Object)null || data.Dead || !swordsGenerated)
		{
			return;
		}
		float num = Mathf.Clamp(Time.deltaTime, 0f, 0.02f);
		for (int i = 0; i < swords.Count; i++)
		{
			if ((Object)(object)swords[i].gameObject != (Object)null)
			{
				SpookySword obj = swords[i];
				obj.sinceSpawn += num;
				swords[i].move.velocity = (((Component)swordPoints[i]).transform.position - swords[i].gameObject.transform.position) * (followSpeed / 3f);
				swords[i].gameObject.transform.rotation = quaternion.op_Implicit(quaternion.LookRotation(float3.op_Implicit(Vector3.up), float3.op_Implicit(((Component)swordPoints[i]).transform.position - ((Component)this).transform.position)));
			}
		}
	}

	private IEnumerator DoAttack(SpookySword attackSword, Rigidbody targ)
	{
		if (!Object.op_Implicit((Object)(object)attackSword.gameObject))
		{
			yield break;
		}
		float counter = 0f;
		float t = ((Keyframe)(ref throwCurve.keys[throwCurve.keys.Length - 1])).time;
		ProjectileStick stick = attackSword.gameObject.GetComponent<ProjectileStick>();
		((Behaviour)attackSword.gameObject.GetComponent<RaycastTrail>()).enabled = true;
		Vector3 val;
		while (counter < t)
		{
			if ((Object)(object)attackSword.gameObject == (Object)null || (Object)(object)targ == (Object)null)
			{
				yield break;
			}
			float num = Mathf.Clamp(Time.deltaTime, 0f, 0.02f);
			counter += Time.deltaTime;
			val = targ.position - attackSword.gameObject.transform.position;
			Vector3 normalized = ((Vector3)(ref val)).normalized;
			attackSword.move.velocity = Vector3.Lerp(attackSword.move.velocity, throwCurve.Evaluate(counter) * (throwSpeed / 2f) * normalized, num * 2f);
			attackSword.gameObject.transform.rotation = Quaternion.Lerp(attackSword.gameObject.transform.rotation, quaternion.op_Implicit(quaternion.LookRotation(float3.op_Implicit(normalized), float3.op_Implicit(Vector3.up))), num * 1.5f);
			yield return null;
		}
		while ((Object)(object)attackSword.gameObject != (Object)null && !stick.stuck && !((Object)(object)targ == (Object)null))
		{
			float num2 = Mathf.Clamp(Time.deltaTime, 0f, 0.02f);
			val = targ.position - attackSword.gameObject.transform.position;
			Vector3 normalized2 = ((Vector3)(ref val)).normalized;
			attackSword.move.velocity = Vector3.Lerp(attackSword.move.velocity, throwSpeed * normalized2, num2 * 4f);
			attackSword.gameObject.transform.rotation = Quaternion.Lerp(attackSword.gameObject.transform.rotation, quaternion.op_Implicit(quaternion.LookRotation(float3.op_Implicit(normalized2), float3.op_Implicit(Vector3.up))), num2 * 3f);
			yield return null;
		}
	}

	public void Go()
	{
		if (allSwordsUsed || !swordsGenerated)
		{
			GenerateSwords();
		}
		if (swords.Count > 0)
		{
			((MonoBehaviour)this).StartCoroutine(ReleaseSwords());
		}
	}

	public void Attack(Rigidbody target, int useAttackID)
	{
		if (useAttackID < 0 || useAttackID >= swords.Count)
		{
			useAttackID = Random.Range(0, swords.Count);
		}
		SpookySword val = swords[useAttackID];
		if (val != null)
		{
			((MonoBehaviour)this).StartCoroutine(DoAttack(val, target));
			shootEvent.Invoke();
			swords.RemoveAt(useAttackID);
			if (swords.Count == 0)
			{
				allSwordsUsed = true;
				swordsGenerated = false;
			}
			AttackedEventHandler attacked = this.Attacked;
			if (attacked != null)
			{
				attacked.Invoke(target, useAttackID);
			}
		}
	}

	private SpookySword CreateNewSword(Vector3 pos, quaternion rot)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Expected O, but got Unknown
		SpookySword val = new SpookySword
		{
			gameObject = Object.Instantiate<GameObject>(sourceSword, pos, quaternion.op_Implicit(rot))
		};
		val.move = val.gameObject.GetComponent<MoveTransform>();
		GameObjectExtensions.FetchComponent<TeamHolder>(val.gameObject).team = data.team;
		val.gameObject.GetComponentInChildren<CodeAnimation>().speedMultiplier = attackspeedMulti / 3f;
		return val;
	}

	private void GenerateSwords()
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		swords.Clear();
		List<Renderer> list = new List<Renderer>();
		for (int i = 0; i < swordPoints.Length; i++)
		{
			SpookySword val = CreateNewSword(((Component)swordPoints[i]).transform.position + Vector3.up * 2f, quaternion.op_Implicit(((Component)swordPoints[i]).transform.rotation));
			Renderer[] componentsInChildren = val.gameObject.GetComponentsInChildren<Renderer>();
			if (componentsInChildren != null && componentsInChildren.Length != 0)
			{
				list.AddRange(componentsInChildren);
			}
			swords.Add(val);
		}
		if ((Object)(object)data != (Object)null && (Object)(object)data.unit != (Object)null)
		{
			data.unit.AddRenderersToShowHide(list.ToArray(), data.unit.IsSpawnedInBlindPlacement);
		}
		allSwordsUsed = false;
		swordsGenerated = true;
	}

	private void OnDestroy()
	{
		((MonoBehaviour)this).StopAllCoroutines();
		for (int i = 0; i < swords.Count; i++)
		{
			if ((Object)(object)swords[i].gameObject != (Object)null)
			{
				Object.Destroy((Object)(object)swords[i].gameObject);
			}
		}
	}

	private void Start()
	{
		data = ((Component)((Component)this).transform.root).GetComponentInChildren<DataHandler>();
	}

	private IEnumerator ReleaseSwords()
	{
		yield return (object)new WaitForSeconds(1f);
		while (swords.Count > 0)
		{
			int useAttackID = Random.Range(0, swords.Count);
			Attack(data.targetMainRig, useAttackID);
			yield return (object)new WaitForSeconds(0.7f);
		}
	}
}
public class newice2 : UnitEffectBase
{
	public float effectAmount = 10f;

	public float dragPerAmount = 1f;

	public float removeDragSpeed = 2f;

	private RigidbodyHolder rigHolder;

	private const float UpdateEffectColorTimeInterval = 0.6f;

	public Color fostColor;

	public UnitColorInstance color;

	public Material iceMaterial;

	public float amount;

	private float healthMultiplier = 1f;

	private WeaponHandler weapons;

	private DataHandler data;

	private DragHandler dragHandler;

	private UnitColorHandler colorHandler;

	private bool done;

	private float timer;

	private INetworkService m_networkService;

	private NetworkBattleController m_networkBattle;

	[SerializeField]
	private float maxAmount = 100f;

	private NetworkBattleController NetworkBattle
	{
		get
		{
			if ((Object)(object)m_networkBattle == (Object)null)
			{
				m_networkBattle = ServiceLocator.GetService<NetworkBattleController>();
			}
			return m_networkBattle;
		}
	}

	private void Start()
	{
		m_networkService = ServiceLocator.GetService<INetworkService>();
		m_networkBattle = ServiceLocator.GetService<NetworkBattleController>();
	}

	private void Update()
	{
		if (done || !Object.op_Implicit((Object)(object)rigHolder) || (data.Dead && !((UnitEffectBase)this).ShouldSkipDeadTests))
		{
			return;
		}
		bool flag = false;
		for (int i = 0; i < rigHolder.AllDrags.Length; i++)
		{
			if (rigHolder.AllDrags[i].x > rigHolder.defaultDrags[i].x)
			{
				flag = true;
				Vector2[] allDrags = rigHolder.AllDrags;
				int num = i;
				allDrags[num].x = allDrags[num].x - Time.deltaTime * removeDragSpeed * 0.5f;
			}
			if (rigHolder.AllDrags[i].y > rigHolder.defaultDrags[i].y)
			{
				flag = true;
				Vector2[] allDrags2 = rigHolder.AllDrags;
				int num2 = i;
				allDrags2[num2].y = allDrags2[num2].y - Time.deltaTime * removeDragSpeed * 0.5f;
			}
		}
		if (flag)
		{
			amount -= Time.deltaTime * removeDragSpeed * dragPerAmount * 0.5f;
		}
		timer += Time.deltaTime;
		if ((Object)(object)colorHandler != (Object)null)
		{
			colorHandler.SetColor(color, Mathf.Clamp(amount * 0.03f, 0f, 1f));
		}
		if ((Object)(object)dragHandler != (Object)null)
		{
			dragHandler.UpdateDrag();
		}
	}

	public override void DoEffect()
	{
		Add(effectAmount);
	}

	public override void Ping()
	{
		Add(effectAmount);
	}

	private void Add(float a)
	{
		if ((Object.op_Implicit((Object)(object)data) && data.Dead && !((UnitEffectBase)this).ShouldSkipDeadTests) || done)
		{
			return;
		}
		if (!Object.op_Implicit((Object)(object)rigHolder))
		{
			rigHolder = ((Component)((Component)this).transform.parent).GetComponentInChildren<RigidbodyHolder>();
			if (Object.op_Implicit((Object)(object)rigHolder))
			{
				dragHandler = ((Component)rigHolder).GetComponent<DragHandler>();
				data = ((Component)rigHolder).GetComponent<DataHandler>();
				colorHandler = ((Component)rigHolder).GetComponent<UnitColorHandler>();
				weapons = ((Component)rigHolder).GetComponent<WeaponHandler>();
				healthMultiplier = 1f / Mathf.Clamp(5f, 1f, float.PositiveInfinity);
			}
		}
		if ((Object.op_Implicit((Object)(object)data) && data.Dead && !((UnitEffectBase)this).ShouldSkipDeadTests) || !Object.op_Implicit((Object)(object)rigHolder))
		{
			return;
		}
		fl