Decompiled source of UltimateLifeform v1.1.0

╛┐╝½╔·╬∩mod.dll

Decompiled 4 minutes 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 BepInEx;
using DM;
using HarmonyLib;
using Landfall.TABS;
using Landfall.TABS.AI.Systems;
using Landfall.TABS.GameMode;
using Landfall.TABS.GameState;
using Landfall.TABS.Services;
using Landfall.TABS.WinConditions;
using SLMA;
using TFBGames;
using TMPro;
using Unity.Entities;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("made 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 WHAT;

public static class UManager
{
	public static class CustomSprite
	{
		public static Sprite Image2Sprite(string name)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(name);
			Texture2D val = new Texture2D(4, 4);
			byte[] array = new byte[stream.Length];
			stream.Read(array, 0, (int)stream.Length);
			((Texture)val).filterMode = (FilterMode)0;
			ImageConversion.LoadImage(val, array);
			return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
		}
	}

	public static string modname;

	public static string modder;

	private static string com;

	public static Dictionary<string, object> Weapon => SLMALoader.SDic["weapons"];

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

	public static void EditBlueprint(UnitBlueprint unit, LandfallContentDatabase db)
	{
	}

	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)
	{
	}

	public static void Init(LandfallContentDatabase db)
	{
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Expected O, but got Unknown
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Expected O, but got Unknown
		//IL_0157: Unknown result type (might be due to invalid IL or missing references)
		//IL_0167: Expected O, but got Unknown
		//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d3: Expected O, but got Unknown
		//IL_0200: Unknown result type (might be due to invalid IL or missing references)
		//IL_0214: Expected O, but got Unknown
		//IL_024c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0260: Expected O, but got Unknown
		//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0305: Expected O, but got Unknown
		//IL_0396: Unknown result type (might be due to invalid IL or missing references)
		//IL_03aa: Expected O, but got Unknown
		Faction val = SLMATool.CreateFaction("<i><b><#800080>宇宙究极无敌7891派系</b></i>", (UnitBlueprint[])null, CustomSprite.Image2Sprite("e.png"), 9751);
		Faction val2 = SLMATool.CreateFaction("神秘派系", (UnitBlueprint[])null, (Sprite)null, 10001);
		GameObject val3 = UPool.MyPool.AddObject("飞雷神", (GameObject)Weapon["WarGlaivecurved"], true, (HideFlags)52, (Sprite)null, 10002, true);
		val3.AddComponent<黑色身体>();
		val3.AddComponent<SmartAssassinAI>();
		UnitBlueprint obj = SLMATool.CreateUnit("飞雷神", (UnitBlueprint)null, val2, CustomSprite.Image2Sprite("icon1.png"));
		obj.health = 3500f;
		SLMATool.UnitCost(obj, 6000);
		obj.sizeMultiplier = 1.25f;
		obj.damageMultiplier = 1.5f;
		obj.RightWeapon = val3;
		obj.LeftWeapon = val3;
		GameObject val4 = UPool.MyPool.AddObject("<i><b><#800080>『究极生物』</b></i>", (GameObject)Weapon["MinoTaurGrab"], true, (HideFlags)52, (Sprite)null, 21554, true);
		val4.AddComponent<NotDie>();
		val4.AddComponent<黑色身体>();
		val4.AddComponent<UpdateKillMod>();
		val4.AddComponent<NAN1>();
		val4.AddComponent<NAN3>();
		val4.AddComponent<NAN4>();
		val4.AddComponent<AuraEffect>();
		val4.AddComponent<BlackBeamOnSpawn>();
		UnitBlueprint obj2 = SLMATool.CreateUnit("<i><b><#800080>『究极生物』</b></i>", (UnitBlueprint)null, val, CustomSprite.Image2Sprite("f4.png"));
		UPool.MyPool.AddObject("终极防御模型", (GameObject)SLMALoader.SDic["bases"]["Humanoid"], true, (HideFlags)52, (Sprite)null, 0, false).AddComponent<不死之身>();
		obj2.health = 2.8E+38f;
		SLMATool.UnitCost(obj2, -2147483647);
		obj2.sizeMultiplier = 1.3f;
		obj2.RightWeapon = val4;
		obj2.LeftWeapon = val4;
		GameObject val5 = UPool.MyPool.AddObject("锁血", (GameObject)SLMALoader.SDic["moves"]["Head_up"], true, (HideFlags)52, (Sprite)null, 981564, true);
		val5.AddComponent<NotDie>();
		GameObject val6 = UPool.MyPool.AddObject("超级秒杀(请勿选择此技能后在兵编中测试)", (GameObject)SLMALoader.SDic["moves"]["Head_up"], true, (HideFlags)52, (Sprite)null, 114514, true);
		val6.AddComponent<UpdateKillMod>();
		ChineseLibrary.技能设置(obj2, (GameObject[])(object)new GameObject[2] { val5, val6 });
		GameObject val7 = UPool.MyPool.AddObject("<i><b><#FF0000>『78生命体』</b></i>", (GameObject)Weapon["MinoTaurGrab"], true, (HideFlags)52, (Sprite)null, 21555, true);
		val7.AddComponent<NotDie>();
		val7.AddComponent<彩虹变色渲染>();
		val7.AddComponent<NAN1>();
		val7.AddComponent<NAN3>();
		val7.AddComponent<究极同化>();
		val7.AddComponent<NAN4>();
		UnitBlueprint obj3 = SLMATool.CreateUnit("<i><b><#FF0000>『78生命体』</b></i>", (UnitBlueprint)null, val, CustomSprite.Image2Sprite("icon2.png"));
		obj3.health = 2.8E+38f;
		SLMATool.UnitCost(obj3, 9999999);
		obj3.sizeMultiplier = 1.3f;
		obj3.RightWeapon = val7;
		obj3.LeftWeapon = val7;
		GameObject val8 = UPool.MyPool.AddObject("<i><b><#FF0000>『91生命体』</b></i>", (GameObject)Weapon["MinoTaurGrab"], true, (HideFlags)52, (Sprite)null, 21556, true);
		val8.AddComponent<NotDie>();
		val8.AddComponent<金属反光渲染>();
		val8.AddComponent<NAN1>();
		val8.AddComponent<NAN3>();
		val8.AddComponent<普通同化>();
		val8.AddComponent<NAN4>();
		UnitBlueprint obj4 = SLMATool.CreateUnit("<i><b><#FF0000>『91生命体』</b></i>", (UnitBlueprint)null, val, CustomSprite.Image2Sprite("R-C.png"));
		obj4.health = 2.8E+38f;
		SLMATool.UnitCost(obj4, -9999999);
		obj4.sizeMultiplier = 1.3f;
		obj4.RightWeapon = val8;
		obj4.LeftWeapon = val8;
		GameObject val9 = UPool.MyPool.AddObject("<i><b><#4B0082>『混虚空行者·天空坠落』</b></i>", (GameObject)Weapon["MinoTaurGrab"], true, (HideFlags)52, (Sprite)null, 21557, true);
		val9.AddComponent<NotDie>();
		val9.AddComponent<趋势技能>();
		val9.AddComponent<NAN1>();
		val9.AddComponent<方块化>();
		val9.AddComponent<NAN3>();
		val9.AddComponent<NAN4>();
		val9.AddComponent<AuraEffect>();
		UnitBlueprint obj5 = SLMATool.CreateUnit("<i><b><#4B0082>『虚空行者·天空坠落』</b></i>", (UnitBlueprint)null, val, CustomSprite.Image2Sprite("无标题.png"));
		obj5.health = 2.8E+38f;
		SLMATool.UnitCost(obj5, -114514);
		obj5.sizeMultiplier = 0.1f;
		obj5.RightWeapon = val9;
		obj5.LeftWeapon = val9;
	}

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

	private static object GetSoundContainer(LandfallContentDatabase db, string name)
	{
		try
		{
			MethodInfo method = typeof(LandfallContentDatabase).GetMethod("GetSoundContainer", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (method != null)
			{
				return method.Invoke(db, new object[1] { name });
			}
			PropertyInfo property = typeof(LandfallContentDatabase).GetProperty("SoundContainers", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (property != null)
			{
				return (property.GetValue(db) is IDictionary dictionary) ? dictionary[name] : null;
			}
		}
		catch (Exception ex)
		{
			Debug.LogError((object)("[WHAT] 获取声音容器失败 " + name + ": " + ex.Message));
		}
		return null;
	}

	private static UnitBlueprint FindUnitBlueprint(string unitName)
	{
		UnitBlueprint[] array = Resources.FindObjectsOfTypeAll<UnitBlueprint>();
		foreach (UnitBlueprint val in array)
		{
			if (val.Entity != null && val.Entity.Name != null && val.Entity.Name.ToLower().Contains(unitName.ToLower()))
			{
				return val;
			}
		}
		return null;
	}
}
[BepInPlugin("UltimateLifeform", "UltimateLifeform", "1.0.4")]
internal class Loader : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		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"));
	}
}
public class NotDie : MonoBehaviour
{
	private void Start()
	{
		GooglyEye[] componentsInChildren = ((Component)((Component)this).GetComponentInParent<Unit>()).GetComponentsInChildren<GooglyEye>();
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			componentsInChildren[i].dead = componentsInChildren[i].open;
		}
		((Component)((Component)this).gameObject.GetComponentInParent<Unit>()).GetComponentInChildren<DataHandler>().healthHandler.AddDieAction((Action)delegate
		{
			Object.Instantiate<GameObject>(UPool.MyPool.GetObject("不死.exe"));
		});
	}

	private void Update()
	{
		((Component)this).GetComponentInParent<Unit>().dead = false;
		((Component)this).GetComponentInParent<Unit>().data.Dead = false;
		((Component)this).GetComponentInParent<Unit>().data.health = ((Component)this).GetComponentInParent<Unit>().data.maxHealth;
		GooglyEye[] componentsInChildren = ((Component)((Component)this).GetComponentInParent<Unit>()).GetComponentsInChildren<GooglyEye>();
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			componentsInChildren[i].SetState((EyeState)0);
		}
	}
}
public static class 的的了了
{
	public static string RainbowText(string text, int offset)
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00f4: 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_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: Unknown result type (might be due to invalid IL or missing references)
		//IL_016b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_0182: Unknown result type (might be due to invalid IL or missing references)
		//IL_0187: Unknown result type (might be due to invalid IL or missing references)
		//IL_012e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_0154: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: Unknown result type (might be due to invalid IL or missing references)
		string text2 = "";
		for (int i = 0; i < text.Length; i++)
		{
			float num = (float)((i + offset) % text.Length) / (float)text.Length;
			Color val = ((!(num < 1f / 7f)) ? ((!(num < 0.2857143f)) ? ((!(num < 0.42857143f)) ? ((!(num < 0.5714286f)) ? ((!(num < 0.71428573f)) ? ((!(num < 0.85714287f)) ? Color.Lerp(new Color(0f, 0.75f, 1f), Color.red, (num - 0.85714287f) * 7f) : Color.Lerp(Color.cyan, new Color(0f, 0.75f, 1f), (num - 0.71428573f) * 7f)) : Color.Lerp(Color.green, Color.cyan, (num - 0.5714286f) * 7f)) : Color.Lerp(new Color(0.5f, 1f, 0f), Color.green, (num - 0.42857143f) * 7f)) : Color.Lerp(Color.yellow, new Color(0.5f, 1f, 0f), (num - 0.2857143f) * 7f)) : Color.Lerp(new Color(1f, 0.5f, 0f), Color.yellow, (num - 1f / 7f) * 7f)) : Color.Lerp(Color.red, new Color(1f, 0.5f, 0f), num * 7f));
			string arg = ColorUtility.ToHtmlStringRGB(val);
			text2 += $"<color=#{arg}>{text[i]}</color>";
		}
		return text2;
	}
}
public class UpdateKillMod : MonoBehaviour
{
	private Unit currentUnit;

	private TeamSystem teamSystem;

	private GameModeService gameModeService;

	private GameStateManager gameStateManager;

	private WinConditionPropagator winConditionPropagator;

	private bool hasTriggered;

	private static FieldInfo isInvulnerableField;

	private static FieldInfo willBeRewivedField;

	private static FieldInfo aiEnabledField;

	static UpdateKillMod()
	{
		aiEnabledField = typeof(Unit).GetField("m_aiEnabled", BindingFlags.Instance | BindingFlags.NonPublic);
		isInvulnerableField = typeof(HealthHandler).GetField("isInvulnerable", BindingFlags.Instance | BindingFlags.NonPublic);
		willBeRewivedField = typeof(HealthHandler).GetField("willBeRewived", BindingFlags.Instance | BindingFlags.NonPublic);
	}

	private void Start()
	{
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Invalid comparison between Unknown and I4
		currentUnit = ((Component)((Component)this).transform.root).GetComponentInChildren<Unit>();
		gameModeService = ServiceLocator.GetService<GameModeService>();
		gameStateManager = ServiceLocator.GetService<GameStateManager>();
		World active = World.Active;
		teamSystem = ((active != null) ? active.GetExistingManager<TeamSystem>() : null);
		GameModeService val = gameModeService;
		if ((((Object)(object)val != (Object)null) ? val.CurrentGameMode : null) != null)
		{
			winConditionPropagator = gameModeService.CurrentGameMode.WinConditionPropagator;
		}
		if (gameStateManager != null)
		{
			gameStateManager.GameStateChanged += OnGameStateChanged;
		}
		GameStateManager val2 = gameStateManager;
		if (val2 != null && (int)val2.GameState == 1 && !hasTriggered)
		{
			hasTriggered = true;
			((MonoBehaviour)this).StartCoroutine(InstantKillEnemies());
		}
	}

	private void OnGameStateChanged(GameState newState)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Invalid comparison between Unknown and I4
		if ((int)newState == 1 && !hasTriggered)
		{
			hasTriggered = true;
			((MonoBehaviour)this).StartCoroutine(InstantKillEnemies());
		}
	}

	private void OnDestroy()
	{
		if (gameStateManager != null)
		{
			gameStateManager.GameStateChanged -= OnGameStateChanged;
		}
	}

	private Team GetPlayerTeam()
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)currentUnit != (Object)null))
		{
			return (Team)1;
		}
		return currentUnit.Team;
	}

	private void KillUnit(Unit unit)
	{
		if (!((Object)(object)unit == (Object)null))
		{
			PrintDestroy(unit);
			FieldInfo fieldInfo = aiEnabledField;
			if (fieldInfo != null)
			{
				fieldInfo.SetValue(unit, false);
			}
			Object.Destroy((Object)(object)((Component)unit).gameObject);
		}
	}

	private IEnumerator InstantKillEnemies()
	{
		if (!ShouldTriggerKill())
		{
			Debug.Log((object)string.Format("单位 {0} (实例ID: {1}) 实例ID不是最小的,跳过秒杀", ((Object)(object)currentUnit != (Object)null) ? ((Object)currentUnit).name : "null", ((Object)(object)currentUnit != (Object)null) ? ((Object)currentUnit).GetInstanceID() : 0));
			yield break;
		}
		Team myTeam = GetPlayerTeam();
		Debug.Log((object)string.Format("单位 {0} (实例ID: {1}) 触发秒杀,队伍: {2}", ((Object)(object)currentUnit != (Object)null) ? ((Object)currentUnit).name : "null", ((Object)(object)currentUnit != (Object)null) ? ((Object)currentUnit).GetInstanceID() : 0, myTeam));
		int num = 0;
		Unit[] array = Object.FindObjectsOfType<Unit>();
		foreach (Unit val in array)
		{
			if ((Object)(object)val != (Object)null && val.Team != myTeam)
			{
				Debug.Log((object)("杀死敌方: " + ((Object)((Component)val).gameObject).name));
				KillUnit(val);
				num++;
			}
		}
		Debug.Log((object)$"杀死 {num} 个敌方单位,数据已炸毁");
		yield return null;
		GameModeService val2 = gameModeService;
		if ((((Object)(object)val2 != (Object)null) ? val2.CurrentGameMode : null) != null)
		{
			Debug.Log((object)"调用 DecideWinner");
			string text = 的的了了.RainbowText("I've told you before, you cannot kill me! Now prepare to face my attack!", Random.Range(0, 360));
			gameModeService.CurrentGameMode.DecideWinner(myTeam, text);
			string customTitle = (((int)myTeam != 1) ? 的的了了.RainbowText("红队已粉碎敌方数据!", Random.Range(0, 360)) : 的的了了.RainbowText("蓝队已抹除敌方存在!", Random.Range(0, 360)));
			((MonoBehaviour)this).StartCoroutine(ModifyWinTitleCoroutine(customTitle));
		}
		else
		{
			Debug.LogError((object)"无法调用胜利");
		}
	}

	private bool ShouldTriggerKill()
	{
		if ((Object)(object)currentUnit == (Object)null)
		{
			return false;
		}
		int instanceID = ((Object)currentUnit).GetInstanceID();
		int num = instanceID;
		UpdateKillMod[] array = Object.FindObjectsOfType<UpdateKillMod>();
		foreach (UpdateKillMod updateKillMod in array)
		{
			if (!((Object)(object)updateKillMod == (Object)(object)this) && (Object)(object)updateKillMod.currentUnit != (Object)null && ((Object)updateKillMod.currentUnit).GetInstanceID() < num)
			{
				return false;
			}
		}
		return instanceID == num;
	}

	private Unit GetMinInstanceIDUnit()
	{
		Unit result = null;
		int num = int.MaxValue;
		UpdateKillMod[] array = Object.FindObjectsOfType<UpdateKillMod>();
		foreach (UpdateKillMod updateKillMod in array)
		{
			if ((Object)(object)updateKillMod.currentUnit != (Object)null)
			{
				int instanceID = ((Object)updateKillMod.currentUnit).GetInstanceID();
				if (instanceID < num)
				{
					num = instanceID;
					result = updateKillMod.currentUnit;
				}
			}
		}
		return result;
	}

	private IEnumerator ModifyWinTitleCoroutine(string customTitle)
	{
		yield return (object)new WaitForSeconds(0.3f);
		Debug.Log((object)"开始查找胜利弹窗...");
		GameObject val = null;
		string[] array = new string[6] { "WinPanel", "VictoryPanel", "GameOverPanel", "BattleResultPanel", "Canvas/ScreenSpaceOverlay/WinPanel", "Canvas/WinPanel" };
		foreach (string text in array)
		{
			val = GameObject.Find(text);
			if ((Object)(object)val != (Object)null)
			{
				Debug.Log((object)("通过名称找到胜利弹窗: " + text));
				break;
			}
		}
		if ((Object)(object)val == (Object)null)
		{
			GameObject[] array2 = Object.FindObjectsOfType<GameObject>();
			foreach (GameObject val2 in array2)
			{
				if (((Object)val2).name.Contains("Win") || ((Object)val2).name.Contains("Victory") || ((Object)val2).name.Contains("Result"))
				{
					val = val2;
					Debug.Log((object)("通过部分匹配找到胜利弹窗: " + ((Object)val2).name));
					break;
				}
			}
		}
		if ((Object)(object)val == (Object)null)
		{
			Debug.LogWarning((object)"UpdateKillMod: 未找到胜利弹窗,标题修改失败");
			yield break;
		}
		TextMeshProUGUI[] componentsInChildren = val.GetComponentsInChildren<TextMeshProUGUI>(true);
		Text[] componentsInChildren2 = val.GetComponentsInChildren<Text>(true);
		bool flag = false;
		TextMeshProUGUI[] array3 = componentsInChildren;
		foreach (TextMeshProUGUI val3 in array3)
		{
			string text2 = ((TMP_Text)val3).text;
			if (text2.Contains("红队胜利") || text2.Contains("蓝队胜利") || text2.Contains("Red Team Wins") || text2.Contains("Blue Team Wins") || text2 == "Victory!" || text2 == "胜利!" || (text2.Contains("Team") && text2.Contains("Wins")))
			{
				Debug.Log((object)("找到主标题(TMP),原文: " + text2));
				((TMP_Text)val3).text = customTitle;
				flag = true;
				Debug.Log((object)("已修改主标题为: " + customTitle));
				break;
			}
		}
		if (!flag)
		{
			array3 = componentsInChildren;
			foreach (TextMeshProUGUI val4 in array3)
			{
				string text3 = ((TMP_Text)val4).text;
				if (text3.Contains("胜利") || text3.Contains("Victory") || text3.Contains("Win") || text3.Contains("Team") || text3.Contains("Blue") || text3.Contains("Red"))
				{
					Debug.Log((object)("找到标题(TMP),原文: " + text3));
					((TMP_Text)val4).text = customTitle;
					flag = true;
					break;
				}
			}
		}
		if (!flag)
		{
			Text[] array4 = componentsInChildren2;
			foreach (Text val5 in array4)
			{
				string text4 = val5.text;
				if (text4.Contains("红队胜利") || text4.Contains("蓝队胜利") || text4.Contains("Red Team Wins") || text4.Contains("Blue Team Wins") || text4 == "Victory!" || text4 == "胜利!")
				{
					Debug.Log((object)("找到主标题(UI),原文: " + text4));
					val5.text = customTitle;
					flag = true;
					break;
				}
			}
		}
		if (!flag)
		{
			Text[] array4 = componentsInChildren2;
			foreach (Text val6 in array4)
			{
				string text5 = val6.text;
				if (text5.Contains("胜利") || text5.Contains("Victory") || text5.Contains("Win"))
				{
					Debug.Log((object)("找到标题(UI),原文: " + text5));
					val6.text = customTitle;
					flag = true;
					break;
				}
			}
		}
		if (flag)
		{
			yield break;
		}
		if (componentsInChildren.Length != 0)
		{
			TextMeshProUGUI val7 = null;
			float num = float.MinValue;
			array3 = componentsInChildren;
			foreach (TextMeshProUGUI val8 in array3)
			{
				float y = ((TMP_Text)val8).transform.position.y;
				if (y > num)
				{
					num = y;
					val7 = val8;
				}
			}
			if ((Object)(object)val7 != (Object)null)
			{
				((TMP_Text)val7).text = customTitle;
			}
			else
			{
				((TMP_Text)componentsInChildren[0]).text = customTitle;
			}
		}
		else if (componentsInChildren2.Length != 0)
		{
			Text val9 = null;
			float num2 = float.MinValue;
			Text[] array4 = componentsInChildren2;
			foreach (Text val10 in array4)
			{
				float y2 = ((Component)val10).transform.position.y;
				if (y2 > num2)
				{
					num2 = y2;
					val9 = val10;
				}
			}
			if ((Object)(object)val9 != (Object)null)
			{
				val9.text = customTitle;
			}
			else
			{
				componentsInChildren2[0].text = customTitle;
			}
		}
		else
		{
			Debug.LogWarning((object)"胜利弹窗中没有找到任何文本组件");
		}
	}

	private void PrintDestroy(Unit unit)
	{
		if (!((Object)(object)unit == (Object)null))
		{
			if ((Object)(object)unit.unitBlueprint != (Object)null)
			{
				unit.unitBlueprint.health = 0f;
				unit.unitBlueprint.animationMultiplier = 0f;
				unit.unitBlueprint.LeftWeapon = null;
				unit.unitBlueprint.RightWeapon = null;
				unit.unitBlueprint.movementSpeedMuiltiplier = 0f;
			}
			if ((Object)(object)unit.data != (Object)null)
			{
				unit.data.health = -1f;
				unit.data.Dead = true;
			}
			unit.dead = true;
			if ((Object)(object)unit.data != (Object)null)
			{
				Object.Destroy((Object)(object)unit.data);
			}
			MovementHandler component = ((Component)unit).GetComponent<MovementHandler>();
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
			if ((Object)(object)unit.data != (Object)null && (Object)(object)unit.data.healthHandler != (Object)null)
			{
				Object.Destroy((Object)(object)unit.data.healthHandler);
			}
			SetDeadEyes(unit);
			unit.FreezeBody();
		}
	}

	private void SetDeadEyes(Unit unit)
	{
		if ((Object)(object)unit == (Object)null)
		{
			return;
		}
		try
		{
			EyeSpawner componentInChildren = ((Component)unit).GetComponentInChildren<EyeSpawner>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				FieldInfo field = typeof(EyeSpawner).GetField("deadEye", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (field != null)
				{
					object value = field.GetValue(componentInChildren);
					if (value != null)
					{
						FieldInfo field2 = typeof(EyeSpawner).GetField("currentEye", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
						if (field2 != null)
						{
							object? value2 = field2.GetValue(componentInChildren);
							GameObject val = (GameObject)((value2 is GameObject) ? value2 : null);
							if ((Object)(object)val != (Object)null)
							{
								Object.Destroy((Object)(object)val);
							}
						}
						GameObject val2 = (GameObject)((value is GameObject) ? value : null);
						if ((Object)(object)val2 != (Object)null)
						{
							GameObject value3 = Object.Instantiate<GameObject>(val2, ((Component)componentInChildren).transform);
							if (field2 != null)
							{
								field2.SetValue(componentInChildren, value3);
							}
							Debug.Log((object)("已将 " + ((Object)unit).name + " 眼睛改为死亡状态"));
						}
					}
				}
				MethodInfo method = typeof(EyeSpawner).GetMethod("SpawnDeadEye", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (method != null)
				{
					method.Invoke(componentInChildren, null);
					Debug.Log((object)("调用 SpawnDeadEye: " + ((Object)unit).name));
				}
			}
			Transform val3 = FindChildRecursive(((Component)unit).transform, "Head");
			if (!((Object)(object)val3 != (Object)null))
			{
				return;
			}
			Renderer[] componentsInChildren = ((Component)val3).GetComponentsInChildren<Renderer>();
			foreach (Renderer val4 in componentsInChildren)
			{
				if (((Object)val4).name.ToLower().Contains("eye") || ((Object)val4).name.ToLower().Contains("eyeball"))
				{
					Material val5 = FindDeadEyeMaterial();
					if ((Object)(object)val5 != (Object)null)
					{
						val4.material = val5;
						Debug.Log((object)("替换眼睛材质为死亡材质: " + ((Object)val4).name));
					}
				}
			}
		}
		catch (Exception ex)
		{
			Debug.LogWarning((object)("设置死亡眼睛失败 " + ((Object)unit).name + ": " + ex.Message));
		}
	}

	private Transform FindChildRecursive(Transform parent, string name)
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Expected O, but got Unknown
		if (((Object)parent).name == name)
		{
			return parent;
		}
		foreach (Transform item in parent)
		{
			Transform parent2 = item;
			Transform val = FindChildRecursive(parent2, name);
			if ((Object)(object)val != (Object)null)
			{
				return val;
			}
		}
		return null;
	}

	private Material FindDeadEyeMaterial()
	{
		Material[] array = Resources.FindObjectsOfTypeAll<Material>();
		foreach (Material val in array)
		{
			string text = ((Object)val).name.ToLower();
			if (text.Contains("deadeye") || text.Contains("dead_eye") || text.Contains("xeye") || text.Contains("crosseye") || (text.Contains("death") && text.Contains("eye")))
			{
				return val;
			}
		}
		return null;
	}
}
public class 不死之身 : MonoBehaviour
{
	private static bool harmonyPatched;

	private Unit unit;

	private bool hasDeclaredVictory;

	private GameModeService gameModeService;

	private Team myTeam;

	private static FieldInfo healthField;

	private static FieldInfo invulnerableField;

	private static MethodInfo dieMethod;

	public static bool BypassProtection;

	private static bool reflectionInitialized;

	private void Start()
	{
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		InitializeReflection();
		unit = ((Component)this).GetComponent<Unit>();
		if ((Object)(object)unit == (Object)null)
		{
			unit = ((Component)((Component)this).transform.root).GetComponentInChildren<Unit>();
		}
		if ((Object)(object)unit == (Object)null)
		{
			unit = ((Component)this).GetComponentInParent<Unit>();
		}
		if ((Object)(object)unit == (Object)null)
		{
			Debug.LogError((object)("[不死之身] 在 " + ((Object)((Component)this).gameObject).name + " 及其父级/子级中未找到 Unit 组件!请将脚本挂在兵种根对象上。"));
			return;
		}
		myTeam = unit.Team;
		Debug.Log((object)$"[不死之身]  单位: {((Object)unit).name}, 队伍: {myTeam}");
		gameModeService = ServiceLocator.GetService<GameModeService>();
		if ((Object)(object)gameModeService == (Object)null)
		{
			Debug.LogWarning((object)"[不死之身] GameModeService 获取失败,将在触发时重试");
		}
		if (!harmonyPatched)
		{
			ApplyHarmonyPatches();
			harmonyPatched = true;
		}
		Debug.Log((object)(" 不死之身已激活 - " + ((Object)unit).name + " 免疫删除"));
	}

	private void ApplyHarmonyPatches()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Expected O, but got Unknown
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Expected O, but got Unknown
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Expected O, but got Unknown
		try
		{
			Harmony val = new Harmony("rainbowtext.protection");
			MethodInfo method = typeof(Unit).GetMethod("DestroyUnit", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (method != null)
			{
				MethodInfo method2 = typeof(DeleteProtectionPatch).GetMethod("Prefix");
				val.Patch((MethodBase)method, new HarmonyMethod(method2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			MethodInfo method3 = typeof(Object).GetMethod("Destroy", new Type[1] { typeof(Object) });
			if (method3 != null)
			{
				MethodInfo method4 = typeof(DestroyProtectionPatch).GetMethod("Prefix");
				val.Patch((MethodBase)method3, new HarmonyMethod(method4), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			Debug.Log((object)"[不死之身] Harmony patches applied successfully");
		}
		catch (Exception ex)
		{
			Debug.LogError((object)("[不死之身] Failed to apply Harmony patches: " + ex.Message));
		}
	}

	public void TriggerVictory()
	{
		//IL_0190: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		if (hasDeclaredVictory)
		{
			Debug.Log((object)"[不死之身] 胜利已触发,跳过重复调用");
			return;
		}
		if ((Object)(object)unit == (Object)null)
		{
			unit = ((Component)((Component)this).transform.root).GetComponentInChildren<Unit>();
			if (!((Object)(object)unit != (Object)null))
			{
				Debug.LogError((object)"[不死之身] 无法获取 Unit 组件,无法触发胜利");
				return;
			}
			myTeam = unit.Team;
			Debug.Log((object)("[不死之身] 重新获取 Unit 成功: " + ((Object)unit).name));
		}
		hasDeclaredVictory = true;
		Debug.Log((object)$"\ud83c\udfc6 [不死之身] {((Object)unit).name} 被攻击销毁!宣告 {myTeam} 胜利!");
		if ((Object)(object)gameModeService == (Object)null)
		{
			gameModeService = ServiceLocator.GetService<GameModeService>();
			if ((Object)(object)gameModeService == (Object)null)
			{
				gameModeService = Object.FindObjectOfType<GameModeService>();
			}
		}
		DestroyAllEnemies();
		if ((Object)(object)gameModeService == (Object)null)
		{
			Debug.LogError((object)"[不死之身] GameModeService 为空!");
			return;
		}
		if (gameModeService.CurrentGameMode == null)
		{
			Debug.LogError((object)"[不死之身] CurrentGameMode 为空!");
			return;
		}
		string text = "你无法杀死我!";
		string text2 = "You are trying to destroy an indestructible unit!";
		try
		{
			text = 的的了了.RainbowText("你无法杀死我!", Random.Range(0, 360));
			text2 = 的的了了.RainbowText("You are trying to destroy an indestructible unit!", Random.Range(0, 360));
		}
		catch (Exception ex)
		{
			Debug.LogWarning((object)("RainbowText 调用失败: " + ex.Message));
		}
		Debug.Log((object)("\ud83d\udcdd 胜利标题: " + text));
		Debug.Log((object)("\ud83d\udcdd 胜利副文本: " + text2));
		gameModeService.CurrentGameMode.DecideWinner(myTeam, text2);
		((MonoBehaviour)this).StartCoroutine(ModifyWinTitleCoroutine(text));
	}

	private IEnumerator ModifyWinTitleCoroutine(string customTitle)
	{
		yield return null;
		yield return null;
		Debug.Log((object)"\ud83d\udd0d 查找胜利弹窗...");
		GameObject val = null;
		string[] array = new string[6] { "WinPanel", "VictoryPanel", "GameOverPanel", "BattleResultPanel", "Canvas/ScreenSpaceOverlay/WinPanel", "Canvas/WinPanel" };
		foreach (string text in array)
		{
			val = GameObject.Find(text);
			if ((Object)(object)val != (Object)null)
			{
				Debug.Log((object)("✅ 找到胜利弹窗: " + text));
				break;
			}
		}
		if ((Object)(object)val == (Object)null)
		{
			GameObject[] array2 = Object.FindObjectsOfType<GameObject>();
			foreach (GameObject val2 in array2)
			{
				if (((Object)val2).name.Contains("Win") || ((Object)val2).name.Contains("Victory") || ((Object)val2).name.Contains("Result"))
				{
					val = val2;
					Debug.Log((object)("✅ 通过部分匹配找到: " + ((Object)val2).name));
					break;
				}
			}
		}
		if ((Object)(object)val == (Object)null)
		{
			Debug.LogWarning((object)"❌ 未找到胜利弹窗");
			yield break;
		}
		TextMeshProUGUI[] componentsInChildren = val.GetComponentsInChildren<TextMeshProUGUI>(true);
		Text[] componentsInChildren2 = val.GetComponentsInChildren<Text>(true);
		bool flag = false;
		TextMeshProUGUI[] array3 = componentsInChildren;
		foreach (TextMeshProUGUI val3 in array3)
		{
			string text2 = ((TMP_Text)val3).text;
			if (text2.Contains("胜利") || text2.Contains("Victory") || text2.Contains("Win") || text2.Contains("Team") || text2.Contains("Blue") || text2.Contains("Red") || text2.Contains("队伍"))
			{
				Debug.Log((object)("\ud83d\udcdd 修改标题: \"" + text2 + "\" → \"" + customTitle + "\""));
				((TMP_Text)val3).text = customTitle;
				flag = true;
				break;
			}
		}
		if (!flag)
		{
			Text[] array4 = componentsInChildren2;
			foreach (Text val4 in array4)
			{
				string text3 = val4.text;
				if (text3.Contains("胜利") || text3.Contains("Victory") || text3.Contains("Win") || text3.Contains("Team") || text3.Contains("Blue") || text3.Contains("Red") || text3.Contains("队伍"))
				{
					Debug.Log((object)("\ud83d\udcdd 修改标题(UI): \"" + text3 + "\" → \"" + customTitle + "\""));
					val4.text = customTitle;
					flag = true;
					break;
				}
			}
		}
		if (!flag && componentsInChildren.Length != 0)
		{
			Debug.Log((object)("\ud83d\udcdd 使用第一个TMP组件: " + customTitle));
			((TMP_Text)componentsInChildren[0]).text = customTitle;
		}
		Debug.Log((object)"✅ 胜利标题修改完成");
	}

	private float GetHealth(HealthHandler handler)
	{
		if ((Object)(object)handler == (Object)null || healthField == null)
		{
			return 0f;
		}
		try
		{
			return (float)healthField.GetValue(handler);
		}
		catch
		{
			return 0f;
		}
	}

	private void SetHealth(HealthHandler handler, float value)
	{
		if ((Object)(object)handler == (Object)null || healthField == null)
		{
			return;
		}
		try
		{
			healthField.SetValue(handler, value);
		}
		catch
		{
		}
	}

	private void SetInvulnerable(HealthHandler handler, bool value)
	{
		if ((Object)(object)handler == (Object)null || invulnerableField == null)
		{
			return;
		}
		try
		{
			invulnerableField.SetValue(handler, value);
		}
		catch
		{
		}
	}

	private void CallDie(HealthHandler handler)
	{
		if ((Object)(object)handler == (Object)null || dieMethod == null)
		{
			return;
		}
		try
		{
			dieMethod.Invoke(handler, null);
		}
		catch
		{
		}
	}

	private void DestroyAllEnemies()
	{
		//IL_0043: 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)
		Debug.Log((object)"=== \ud83d\udd25 开始销毁所有敌人 ===");
		Unit[] array = Object.FindObjectsOfType<Unit>();
		int num = 0;
		int num2 = 0;
		BypassProtection = true;
		Debug.Log((object)"\ud83d\udd13 已开启防销毁白名单");
		try
		{
			Unit[] array2 = array;
			foreach (Unit val in array2)
			{
				if ((Object)(object)val == (Object)null || val.Team == myTeam)
				{
					continue;
				}
				Debug.Log((object)("\ud83d\udccc 处理敌人: " + ((Object)val).name));
				HealthHandler component = ((Component)val).GetComponent<HealthHandler>();
				if ((Object)(object)component != (Object)null)
				{
					try
					{
						SetHealth(component, 0f);
						SetInvulnerable(component, value: false);
						CallDie(component);
						num2++;
						Debug.Log((object)("  ✅ 强制 " + ((Object)val).name + " 血量归零"));
					}
					catch (Exception ex)
					{
						Debug.LogWarning((object)("  ⚠\ufe0f 血量归零失败: " + ex.Message));
					}
				}
				不死之身 component2 = ((Component)val).GetComponent<不死之身>();
				if ((Object)(object)component2 != (Object)null)
				{
					try
					{
						Object.Destroy((Object)(object)component2);
						Debug.Log((object)("  ✅ 移除 " + ((Object)val).name + " 的不死之身"));
					}
					catch
					{
					}
				}
				try
				{
					Object.Destroy((Object)(object)((Component)val).gameObject);
					num++;
					Debug.Log((object)("  ✅ 销毁 " + ((Object)val).name));
				}
				catch (Exception ex2)
				{
					Debug.LogWarning((object)("  ⚠\ufe0f 销毁失败: " + ex2.Message));
					try
					{
						((Component)val).gameObject.SetActive(false);
					}
					catch
					{
					}
				}
			}
		}
		finally
		{
			BypassProtection = false;
			Debug.Log((object)"\ud83d\udd12 已关闭防销毁白名单");
		}
		Debug.Log((object)$"\ud83d\udcca 清理完成: 销毁 {num} 个, 血量归零 {num2} 个");
	}

	private void InitializeReflection()
	{
		if (reflectionInitialized)
		{
			return;
		}
		try
		{
			healthField = typeof(HealthHandler).GetField("m_health", BindingFlags.Instance | BindingFlags.NonPublic);
			if (healthField == null)
			{
				healthField = typeof(HealthHandler).GetField("health", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			}
			invulnerableField = typeof(HealthHandler).GetField("isInvulnerable", BindingFlags.Instance | BindingFlags.NonPublic);
			dieMethod = typeof(HealthHandler).GetMethod("Die", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			reflectionInitialized = true;
			Debug.Log((object)"[不死之身] 反射初始化成功");
		}
		catch (Exception ex)
		{
			Debug.LogWarning((object)("[不死之身] 反射初始化失败: " + ex.Message));
			reflectionInitialized = true;
		}
	}
}
public class DeleteMarker : MonoBehaviour
{
}
public class DeleteMarker__0 : MonoBehaviour
{
}
[HarmonyPatch]
public class DeleteProtectionPatch
{
	public static bool Prefix(Unit __instance)
	{
		if (不死之身.BypassProtection)
		{
			return true;
		}
		不死之身 component = ((Component)__instance).GetComponent<不死之身>();
		if ((Object)(object)component != (Object)null)
		{
			Debug.Log((object)("不死之身:阻止单位删除 - " + ((Object)__instance).name));
			component.TriggerVictory();
			return false;
		}
		return true;
	}
}
public class NAN4 : MonoBehaviour
{
	[Header("无实体状态设置")]
	[Tooltip("是否在启动时立即进入无实体状态")]
	public bool enablePhantomOnStart = true;

	[Tooltip("是否包含武器在无实体状态中")]
	public bool includeWeapons = true;

	[Tooltip("是否在死亡时自动退出无实体状态")]
	public bool disablePhantomOnDeath = true;

	[Tooltip("是否在组件销毁时恢复原始层")]
	public bool restoreLayersOnDestroy = true;

	[Header("调试信息")]
	[SerializeField]
	public bool showDebugInfo = true;

	private RigidbodyHolder rigidbodyHolder;

	private WeaponHandler weaponHandler;

	private DataHandler data;

	private HealthHandler healthHandler;

	private List<Rigidbody> allRigidbodies = new List<Rigidbody>();

	private List<int> originalRigidbodyLayers = new List<int>();

	private List<Collider> allColliders = new List<Collider>();

	private List<int> originalColliderLayers = new List<int>();

	private bool isPhantomState;

	private const int MAP_LAYER = 8;

	private const int PHANTOM_LAYER = 20;

	public bool IsPhantomStateActive => isPhantomState;

	public int RigidbodyCount => allRigidbodies.Count;

	public int ColliderCount => allColliders.Count;

	private void Start()
	{
		rigidbodyHolder = ((Component)((Component)this).transform.root).GetComponentInChildren<RigidbodyHolder>();
		weaponHandler = ((Component)((Component)this).transform.root).GetComponentInChildren<WeaponHandler>();
		data = ((Component)((Component)this).transform.root).GetComponentInChildren<DataHandler>();
		healthHandler = ((Component)((Component)this).transform.root).GetComponentInChildren<HealthHandler>();
		if ((Object)(object)rigidbodyHolder == (Object)null)
		{
			Debug.LogError((object)"PhantomStateComponent: 无法找到RigidbodyHolder组件!", (Object)(object)this);
			return;
		}
		if ((Object)(object)data == (Object)null)
		{
			Debug.LogError((object)"PhantomStateComponent: 无法找到DataHandler组件!", (Object)(object)this);
			return;
		}
		CollectAllRigidbodiesAndColliders();
		if (enablePhantomOnStart)
		{
			EnablePhantomState();
		}
		if ((Object)(object)healthHandler != (Object)null && disablePhantomOnDeath)
		{
			healthHandler.UnitDied += OnUnitDied;
		}
		if (showDebugInfo)
		{
			Debug.Log((object)$"PhantomStateComponent: 初始化完成,收集到 {allRigidbodies.Count} 个Rigidbody和 {allColliders.Count} 个Collider", (Object)(object)this);
		}
	}

	private void OnDestroy()
	{
		if ((Object)(object)healthHandler != (Object)null)
		{
			healthHandler.UnitDied -= OnUnitDied;
		}
		if (restoreLayersOnDestroy && isPhantomState)
		{
			RestoreOriginalLayers();
		}
	}

	private void CollectAllRigidbodiesAndColliders()
	{
		allRigidbodies.Clear();
		originalRigidbodyLayers.Clear();
		allColliders.Clear();
		originalColliderLayers.Clear();
		if ((Object)(object)rigidbodyHolder != (Object)null && rigidbodyHolder.AllRigs != null)
		{
			Rigidbody[] allRigs = rigidbodyHolder.AllRigs;
			foreach (Rigidbody val in allRigs)
			{
				if ((Object)(object)val != (Object)null)
				{
					allRigidbodies.Add(val);
					originalRigidbodyLayers.Add(((Component)val).gameObject.layer);
				}
			}
		}
		if (includeWeapons && (Object)(object)weaponHandler != (Object)null)
		{
			if ((Object)(object)weaponHandler.rightWeapon != (Object)null && (Object)(object)weaponHandler.rightWeapon.rigidbody != (Object)null)
			{
				allRigidbodies.Add(weaponHandler.rightWeapon.rigidbody);
				originalRigidbodyLayers.Add(((Component)weaponHandler.rightWeapon.rigidbody).gameObject.layer);
			}
			if ((Object)(object)weaponHandler.leftWeapon != (Object)null && (Object)(object)weaponHandler.leftWeapon.rigidbody != (Object)null)
			{
				allRigidbodies.Add(weaponHandler.leftWeapon.rigidbody);
				originalRigidbodyLayers.Add(((Component)weaponHandler.leftWeapon.rigidbody).gameObject.layer);
			}
		}
		if (!((Object)(object)data != (Object)null))
		{
			return;
		}
		Collider[] componentsInChildren = ((Component)((Component)data).transform).GetComponentsInChildren<Collider>();
		foreach (Collider val2 in componentsInChildren)
		{
			if ((Object)(object)val2 != (Object)null)
			{
				allColliders.Add(val2);
				originalColliderLayers.Add(((Component)val2).gameObject.layer);
			}
		}
	}

	public void EnablePhantomState()
	{
		if (isPhantomState)
		{
			if (showDebugInfo)
			{
				Debug.Log((object)"PhantomStateComponent: 已经处于无实体状态", (Object)(object)this);
			}
			return;
		}
		for (int i = 0; i < allRigidbodies.Count; i++)
		{
			if ((Object)(object)allRigidbodies[i] != (Object)null)
			{
				((Component)allRigidbodies[i]).gameObject.layer = 20;
			}
		}
		for (int j = 0; j < allColliders.Count; j++)
		{
			if ((Object)(object)allColliders[j] != (Object)null)
			{
				((Component)allColliders[j]).gameObject.layer = 20;
			}
		}
		isPhantomState = true;
		if (showDebugInfo)
		{
			Debug.Log((object)$"PhantomStateComponent: 已启用无实体状态,设置了 {allRigidbodies.Count} 个Rigidbody和 {allColliders.Count} 个Collider", (Object)(object)this);
		}
	}

	public void DisablePhantomState()
	{
		if (!isPhantomState)
		{
			if (showDebugInfo)
			{
				Debug.Log((object)"PhantomStateComponent: 已经退出无实体状态", (Object)(object)this);
			}
			return;
		}
		RestoreOriginalLayers();
		isPhantomState = false;
		if (showDebugInfo)
		{
			Debug.Log((object)"PhantomStateComponent: 已禁用无实体状态", (Object)(object)this);
		}
	}

	private void RestoreOriginalLayers()
	{
		for (int i = 0; i < allRigidbodies.Count && i < originalRigidbodyLayers.Count; i++)
		{
			if ((Object)(object)allRigidbodies[i] != (Object)null)
			{
				((Component)allRigidbodies[i]).gameObject.layer = originalRigidbodyLayers[i];
			}
		}
		for (int j = 0; j < allColliders.Count && j < originalColliderLayers.Count; j++)
		{
			if ((Object)(object)allColliders[j] != (Object)null)
			{
				((Component)allColliders[j]).gameObject.layer = originalColliderLayers[j];
			}
		}
		if (showDebugInfo)
		{
			Debug.Log((object)"PhantomStateComponent: 已恢复原始层", (Object)(object)this);
		}
	}

	private void OnUnitDied(Unit unit)
	{
		if (disablePhantomOnDeath && isPhantomState)
		{
			DisablePhantomState();
		}
	}

	public void TogglePhantomState()
	{
		if (isPhantomState)
		{
			DisablePhantomState();
		}
		else
		{
			EnablePhantomState();
		}
	}

	public bool IsPhantomState()
	{
		return isPhantomState;
	}

	public void RefreshReferences()
	{
		CollectAllRigidbodiesAndColliders();
		if (showDebugInfo)
		{
			Debug.Log((object)$"PhantomStateComponent: 已刷新引用,当前有 {allRigidbodies.Count} 个Rigidbody和 {allColliders.Count} 个Collider", (Object)(object)this);
		}
	}
}
[HarmonyPatch(typeof(Object), "Destroy")]
public class DestroyProtectionPatch
{
	public static bool Prefix(Object obj)
	{
		if (不死之身.BypassProtection)
		{
			return true;
		}
		GameObject val = (GameObject)(object)((obj is GameObject) ? obj : null);
		if ((Object)(object)val != (Object)null)
		{
			不死之身 component = val.GetComponent<不死之身>();
			if ((Object)(object)component != (Object)null)
			{
				Debug.Log((object)("不死之身:阻止GameObject销毁 - " + ((Object)val).name));
				component.TriggerVictory();
				return false;
			}
			不死之身 componentInChildren = val.GetComponentInChildren<不死之身>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				Debug.Log((object)("不死之身:阻止受保护对象的销毁 - " + ((Object)val).name));
				componentInChildren.TriggerVictory();
				return false;
			}
		}
		Component val2 = (Component)(object)((obj is Component) ? obj : null);
		if ((Object)(object)val2 != (Object)null)
		{
			不死之身 component2 = val2.GetComponent<不死之身>();
			if ((Object)(object)component2 != (Object)null)
			{
				Debug.Log((object)("不死之身:阻止组件销毁 - " + ((Object)val2).name));
				component2.TriggerVictory();
				return false;
			}
		}
		return true;
	}
}
public class 黑色身体 : MonoBehaviour
{
	private Unit _unit;

	private MaterialPropertyBlock _propBlock;

	private static readonly int ColorID;

	[Header("黑色效果")]
	[SerializeField]
	private Color bodyColor = Color.black;

	private Renderer[] _bodyRenderers;

	[Header("眼睛颜色(不改)")]
	[SerializeField]
	private Color eyeColor = Color.white;

	private Renderer[] _eyeRenderers;

	private void Start()
	{
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Expected O, but got Unknown
		_unit = ((Component)this).GetComponentInParent<Unit>();
		if ((Object)(object)_unit != (Object)null)
		{
			Renderer[] componentsInChildren = ((Component)_unit).GetComponentsInChildren<Renderer>(true);
			_bodyRenderers = componentsInChildren.Where((Renderer r) => !IsEyeRenderer(r)).ToArray();
			_eyeRenderers = componentsInChildren.Where((Renderer r) => IsEyeRenderer(r)).ToArray();
		}
		_propBlock = new MaterialPropertyBlock();
		ApplyColor();
	}

	private void Update()
	{
		ApplyColor();
	}

	static 黑色身体()
	{
		ColorID = Shader.PropertyToID("_Color");
	}

	private void ApplyColor()
	{
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		if (_bodyRenderers != null)
		{
			Renderer[] bodyRenderers = _bodyRenderers;
			foreach (Renderer val in bodyRenderers)
			{
				if (!((Object)(object)val == (Object)null))
				{
					val.GetPropertyBlock(_propBlock);
					_propBlock.SetColor(ColorID, bodyColor);
					val.SetPropertyBlock(_propBlock);
				}
			}
		}
		if (_eyeRenderers != null)
		{
			Renderer[] bodyRenderers = _eyeRenderers;
			for (int i = 0; i < bodyRenderers.Length; i++)
			{
				_ = (Object)(object)bodyRenderers[i] == (Object)null;
			}
		}
	}

	private bool IsEyeRenderer(Renderer renderer)
	{
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)renderer == (Object)null)
		{
			return false;
		}
		string text = ((Object)renderer).name.ToLower();
		if (text.Contains("eye") || text.Contains("eyes") || text.Contains("pupil") || text.Contains("iris") || text.Contains("look") || text.Contains("sight"))
		{
			return true;
		}
		Material sharedMaterial = renderer.sharedMaterial;
		if ((Object)(object)sharedMaterial != (Object)null)
		{
			string text2 = ((Object)sharedMaterial).name.ToLower();
			if (text2.Contains("eye") || text2.Contains("pupil"))
			{
				return true;
			}
		}
		if ((Object)(object)sharedMaterial != (Object)null && sharedMaterial.HasProperty("_Color"))
		{
			Color color = sharedMaterial.GetColor("_Color");
			if (color.r > 0.9f && color.g > 0.9f && color.b > 0.9f)
			{
				return true;
			}
		}
		return false;
	}
}
public class NAN1 : MonoBehaviour
{
	private void Update()
	{
		if (Object.op_Implicit((Object)(object)((Component)this).GetComponentInChildren<UnitEffectBase>()))
		{
			UnitEffectBase[] componentsInChildren = ((Component)this).GetComponentsInChildren<UnitEffectBase>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				Object.Destroy((Object)(object)((Component)componentsInChildren[i]).gameObject);
			}
		}
	}
}
public class NAN3 : MonoBehaviour
{
	private HealthHandler healthHandler;

	private DataHandler dataHandler;

	private Unit unit;

	[Header("删除设置")]
	[Tooltip("是否完全删除HealthHandler组件")]
	public bool completelyRemoveHealthHandler = true;

	[Tooltip("是否禁用HealthHandler的Update方法")]
	public bool disableHealthHandlerUpdate = true;

	[Tooltip("是否禁用HealthHandler的TakeDamage方法")]
	public bool disableHealthHandlerTakeDamage = true;

	[Tooltip("是否禁用HealthHandler的Die方法")]
	public bool disableHealthHandlerDie = true;

	[Header("调试信息")]
	[SerializeField]
	public bool showDebugInfo;

	[Tooltip("是否清除DataHandler中的healthHandler引用")]
	public bool clearDataHandlerReference = true;

	private void Start()
	{
		healthHandler = ((Component)this).GetComponentInChildren<HealthHandler>();
		dataHandler = ((Component)this).GetComponentInChildren<DataHandler>();
		unit = ((Component)this).GetComponentInChildren<Unit>();
		if ((Object)(object)healthHandler == (Object)null)
		{
			Debug.LogWarning((object)"HealthHandlerRemover: 未找到HealthHandler组件");
			return;
		}
		if ((Object)(object)dataHandler == (Object)null)
		{
			Debug.LogWarning((object)"HealthHandlerRemover: 未找到DataHandler组件");
			return;
		}
		if ((Object)(object)unit == (Object)null)
		{
			Debug.LogWarning((object)"HealthHandlerRemover: 未找到Unit组件");
			return;
		}
		RemoveHealthHandlerFunctionality();
		if (showDebugInfo)
		{
			Debug.Log((object)("HealthHandlerRemover: 单位 " + ((Object)unit).name + " 的HealthHandler功能已被删除"));
		}
	}

	private void RemoveHealthHandlerFunctionality()
	{
		if ((Object)(object)healthHandler == (Object)null)
		{
			return;
		}
		if (clearDataHandlerReference)
		{
			ClearDataHandlerHealthHandlerReference();
		}
		if (completelyRemoveHealthHandler)
		{
			Object.Destroy((Object)(object)healthHandler);
			healthHandler = null;
			if (showDebugInfo)
			{
				Debug.Log((object)("HealthHandlerRemover: 完全删除了单位 " + ((Object)unit).name + " 的HealthHandler组件"));
			}
		}
		else
		{
			((Behaviour)healthHandler).enabled = false;
			if (showDebugInfo)
			{
				Debug.Log((object)("HealthHandlerRemover: 禁用了单位 " + ((Object)unit).name + " 的HealthHandler组件"));
			}
		}
		if ((Object)(object)dataHandler != (Object)null)
		{
			dataHandler.health = Mathf.Max(dataHandler.health, 1f);
			dataHandler.maxHealth = Mathf.Max(dataHandler.maxHealth, 1f);
			dataHandler.Dead = false;
		}
	}

	public void RemoveHealthHandlerCompletely()
	{
		if ((Object)(object)healthHandler != (Object)null)
		{
			Object.Destroy((Object)(object)healthHandler);
			healthHandler = null;
			if (showDebugInfo)
			{
				Unit val = unit;
				Debug.Log((object)("HealthHandlerRemover: 完全删除了单位 " + (((Object)(object)val != (Object)null) ? ((Object)val).name : null) + " 的HealthHandler组件"));
			}
		}
	}

	public void DisableHealthHandler()
	{
		if ((Object)(object)healthHandler != (Object)null)
		{
			((Behaviour)healthHandler).enabled = false;
			if (showDebugInfo)
			{
				Unit val = unit;
				Debug.Log((object)("HealthHandlerRemover: 禁用了单位 " + (((Object)(object)val != (Object)null) ? ((Object)val).name : null) + " 的HealthHandler组件"));
			}
		}
	}

	public void EnableHealthHandler()
	{
		if ((Object)(object)healthHandler != (Object)null)
		{
			((Behaviour)healthHandler).enabled = true;
			if (showDebugInfo)
			{
				Unit val = unit;
				Debug.Log((object)("HealthHandlerRemover: 启用了单位 " + (((Object)(object)val != (Object)null) ? ((Object)val).name : null) + " 的HealthHandler组件"));
			}
		}
	}

	public void SetHealth(float health)
	{
		if ((Object)(object)dataHandler != (Object)null)
		{
			dataHandler.health = Mathf.Max(health, 1f);
			dataHandler.maxHealth = Mathf.Max(dataHandler.maxHealth, health);
		}
	}

	public float GetHealth()
	{
		DataHandler val = dataHandler;
		if ((Object)(object)val == (Object)null)
		{
			return 0f;
		}
		return val.health;
	}

	public float GetMaxHealth()
	{
		DataHandler val = dataHandler;
		if ((Object)(object)val == (Object)null)
		{
			return 0f;
		}
		return val.maxHealth;
	}

	public bool IsHealthHandlerRemoved()
	{
		if (!((Object)(object)healthHandler == (Object)null))
		{
			return !((Behaviour)healthHandler).enabled;
		}
		return true;
	}

	private void OnDestroy()
	{
		if (showDebugInfo)
		{
			Unit val = unit;
			Debug.Log((object)("HealthHandlerRemover: 组件已销毁,单位 " + (((Object)(object)val != (Object)null) ? ((Object)val).name : null) + " 的HealthHandler处理已删除"));
		}
	}

	public NAN3()
	{
		showDebugInfo = true;
	}

	private void ClearDataHandlerHealthHandlerReference()
	{
		if (!((Object)(object)dataHandler != (Object)null))
		{
			return;
		}
		FieldInfo field = typeof(DataHandler).GetField("healthHandler", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
		if (field != null)
		{
			field.SetValue(dataHandler, null);
			if (showDebugInfo)
			{
				Debug.Log((object)("HealthHandlerRemover: 清除了单位 " + ((Object)unit).name + " 的DataHandler中healthHandler引用"));
			}
		}
		else
		{
			Debug.LogWarning((object)"HealthHandlerRemover: 无法找到DataHandler中的healthHandler字段");
		}
	}
}
public class AuraEffect : MonoBehaviour
{
	[Header("球体粒子设置")]
	[SerializeField]
	private int particleCount = 200;

	[SerializeField]
	private float radius = 2.5f;

	[SerializeField]
	private float rotationSpeed = 60f;

	[SerializeField]
	private float particleSize = 0.05f;

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

	private Unit parentUnit;

	private List<Vector3> originalPositions = new List<Vector3>();

	private Transform hipTransform;

	private void Start()
	{
		parentUnit = ((Component)this).GetComponentInParent<Unit>();
		if ((Object)(object)parentUnit == (Object)null)
		{
			Debug.LogWarning((object)"AuraEffect 需要放在含有 Unit 组件的物体或其子物体上");
			return;
		}
		if ((Object)(object)parentUnit.data != (Object)null && (Object)(object)parentUnit.data.hip != (Object)null)
		{
			hipTransform = ((Component)parentUnit.data.hip).transform;
		}
		else
		{
			hipTransform = ((Component)parentUnit).transform;
		}
		CreateSphere();
	}

	private void OnDestroy()
	{
		foreach (Transform particle in particles)
		{
			if ((Object)(object)particle != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)particle).gameObject);
			}
		}
		particles.Clear();
		originalPositions.Clear();
	}

	private void Update()
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: 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_0090: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		if (particles.Count == 0 || (Object)(object)hipTransform == (Object)null)
		{
			return;
		}
		Vector3 position = hipTransform.position;
		float num = rotationSpeed * Time.deltaTime * ((float)Math.PI / 180f);
		for (int i = 0; i < particles.Count; i++)
		{
			Transform val = particles[i];
			if (!((Object)(object)val == (Object)null))
			{
				Vector3 val2 = originalPositions[i];
				float num2 = Mathf.Cos(num);
				float num3 = Mathf.Sin(num);
				float num4 = val2.x * num2 - val2.z * num3;
				float num5 = val2.x * num3 + val2.z * num2;
				float y = val2.y;
				originalPositions[i] = new Vector3(num4, y, num5);
				val.position = position + new Vector3(num4, y, num5) * radius;
				val.LookAt(position);
			}
		}
	}

	private void CreateSphere()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Expected O, but got Unknown
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Expected O, but got Unknown
		//IL_0043: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: 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_0119: Unknown result type (might be due to invalid IL or missing references)
		//IL_0124: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("ParticleTemplate");
		val.SetActive(false);
		val.AddComponent<MeshFilter>().mesh = Resources.GetBuiltinResource<Mesh>("Cube.fbx");
		MeshRenderer obj = val.AddComponent<MeshRenderer>();
		Material val2 = new Material(Shader.Find("Standard"));
		val2.SetColor("_Color", Color.black);
		((Renderer)obj).material = val2;
		float num = (float)Math.PI * (3f - Mathf.Sqrt(5f));
		Vector3 val3 = default(Vector3);
		for (int i = 0; i < particleCount; i++)
		{
			float num2 = 1f - (float)i / (float)(particleCount - 1) * 2f;
			float num3 = Mathf.Sqrt(1f - num2 * num2);
			float num4 = num * (float)i;
			float num5 = Mathf.Cos(num4) * num3;
			float num6 = Mathf.Sin(num4) * num3;
			((Vector3)(ref val3))..ctor(num5, num2, num6);
			originalPositions.Add(val3);
			Vector3 localPosition = val3 * radius;
			GameObject val4 = Object.Instantiate<GameObject>(val, ((Component)this).transform);
			((Object)val4).name = $"AuraParticle_{i}";
			val4.transform.localPosition = localPosition;
			val4.transform.localScale = Vector3.one * particleSize;
			particles.Add(val4.transform);
			val4.SetActive(true);
		}
		Object.Destroy((Object)(object)val);
	}
}
public class BlackBeamOnSpawn : MonoBehaviour
{
	private void Start()
	{
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = Resources.Load<GameObject>("E_MagicMissileSmite");
		if ((Object)(object)val == (Object)null)
		{
			val = Resources.Load<GameObject>("Effects/E_MagicMissileSmite");
		}
		if ((Object)(object)val == (Object)null)
		{
			GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>();
			foreach (GameObject val2 in array)
			{
				if (((Object)val2).name == "E_MagicMissileSmite")
				{
					val = val2;
					break;
				}
			}
		}
		if ((Object)(object)val == (Object)null)
		{
			Debug.LogError((object)"[WHAT] 找不到 E_MagicMissileSmite");
			return;
		}
		Vector3 position = ((Component)this).transform.position;
		position.y = 0.05f;
		GameObject val3 = Object.Instantiate<GameObject>(val, position, Quaternion.Euler(-90f, 0f, 0f));
		((Object)val3).name = "BlackBeam_WHAT";
		MakeBlack(val3);
		DisableLogic(val3);
		Debug.Log((object)"[WHAT] 原版黑色光束已生成");
	}

	private void MakeBlack(GameObject obj)
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Expected O, but got Unknown
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: Expected O, but got Unknown
		//IL_00e9: 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)
		ParticleSystem[] componentsInChildren = obj.GetComponentsInChildren<ParticleSystem>(true);
		foreach (ParticleSystem obj2 in componentsInChildren)
		{
			MainModule main = obj2.main;
			((MainModule)(ref main)).startColor = new MinMaxGradient(Color.black);
			ColorOverLifetimeModule colorOverLifetime = obj2.colorOverLifetime;
			if (((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled)
			{
				Gradient val = new Gradient();
				val.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
				{
					new GradientColorKey(Color.black, 0f),
					new GradientColorKey(Color.black, 1f)
				}, (GradientAlphaKey[])(object)new GradientAlphaKey[2]
				{
					new GradientAlphaKey(1f, 0f),
					new GradientAlphaKey(0f, 1f)
				});
				((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(val);
			}
		}
		ParticleSystemRenderer[] componentsInChildren2 = obj.GetComponentsInChildren<ParticleSystemRenderer>(true);
		foreach (ParticleSystemRenderer obj3 in componentsInChildren2)
		{
			Material val2 = new Material(((Renderer)obj3).material);
			val2.color = Color.black;
			val2.SetColor("_TintColor", Color.black);
			((Renderer)obj3).material = val2;
		}
	}

	private void DisableLogic(GameObject obj)
	{
		ProjectileEntity component = obj.GetComponent<ProjectileEntity>();
		if ((Object)(object)component != (Object)null)
		{
			((Behaviour)component).enabled = false;
		}
		Rigidbody component2 = obj.GetComponent<Rigidbody>();
		if ((Object)(object)component2 != (Object)null)
		{
			component2.isKinematic = true;
			component2.useGravity = false;
		}
		MoveTransform component3 = obj.GetComponent<MoveTransform>();
		if ((Object)(object)component3 != (Object)null)
		{
			((Behaviour)component3).enabled = false;
		}
		RaycastTrail component4 = obj.GetComponent<RaycastTrail>();
		if ((Object)(object)component4 != (Object)null)
		{
			((Behaviour)component4).enabled = false;
		}
		ProjectileHit component5 = obj.GetComponent<ProjectileHit>();
		if ((Object)(object)component5 != (Object)null)
		{
			((Behaviour)component5).enabled = false;
		}
	}
}
public class DelayedShake : MonoBehaviour
{
	public float delay = 0.1f;

	private float timer;

	private bool triggered;

	private void Update()
	{
		if (triggered)
		{
			return;
		}
		timer += Time.deltaTime;
		if (timer >= delay)
		{
			triggered = true;
			AddScreensShake component = ((Component)this).GetComponent<AddScreensShake>();
			if ((Object)(object)component != (Object)null)
			{
				((Component)component).SendMessage("Shake", (SendMessageOptions)1);
			}
		}
	}
}
public class DelayedShake__0 : MonoBehaviour
{
	public float delay = 0.05f;

	private float timer;

	private bool triggered;

	private void Update()
	{
		if (triggered)
		{
			return;
		}
		timer += Time.deltaTime;
		if (timer >= delay)
		{
			triggered = true;
			AddScreensShake component = ((Component)this).GetComponent<AddScreensShake>();
			if ((Object)(object)component != (Object)null)
			{
				((Component)component).SendMessage("Shake", (SendMessageOptions)1);
			}
		}
	}
}
public class DelayedShake__1 : MonoBehaviour
{
	public float delay = 0.05f;

	private float timer;

	private bool triggered;

	private void Update()
	{
		if (triggered)
		{
			return;
		}
		timer += Time.deltaTime;
		if (timer >= delay)
		{
			triggered = true;
			AddScreensShake component = ((Component)this).GetComponent<AddScreensShake>();
			if ((Object)(object)component != (Object)null)
			{
				((Component)component).SendMessage("Shake", (SendMessageOptions)1);
			}
		}
	}
}
public class 究极同化 : GameStateListener
{
	private Unit unit;

	private bool onBattle;

	private GameModeService gameModeService;

	private TeamSystem m_teamSystem;

	private ITimeService timeService;

	private bool hasExecuted;

	public void Start()
	{
		m_teamSystem = World.Active.GetOrCreateManager<TeamSystem>();
		unit = ((Component)((Component)this).gameObject.transform.root).GetComponentInChildren<Unit>();
		gameModeService = ServiceLocator.GetService<GameModeService>();
		timeService = ServiceLocator.GetService<ITimeService>();
	}

	public void Update()
	{
		if (onBattle && !hasExecuted)
		{
			TriggerVictory();
			AssimilateEnemies();
			hasExecuted = true;
		}
	}

	private void RestartBattle()
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		timeService.SetState(1f, 1f, false);
		Scene activeScene = SceneManager.GetActiveScene();
		SceneManager.LoadScene(((Scene)(ref activeScene)).name);
	}

	protected override void Awake()
	{
		((GameStateListener)this).Awake();
	}

	public override void OnEnterBattleState()
	{
		onBattle = true;
		hasExecuted = false;
	}

	public override void OnEnterPlacementState()
	{
		onBattle = false;
		hasExecuted = false;
	}

	private void TriggerVictory()
	{
		//IL_0026: 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)
		gameModeService.CurrentGameMode.WinConditionPropagator.ClearAllWinConditions();
		gameModeService.CurrentGameMode.OnWinnerDecided(unit.Team, "给我掉");
		gameModeService.CurrentGameMode.DecideWinner(unit.Team, "给我掉");
		timeService.SetState(0f, 0f, false);
	}

	private void AssimilateEnemies()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Invalid comparison between Unknown and I4
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: 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_0099: Unknown result type (might be due to invalid IL or missing references)
		Team val = (Team)((int)unit.Team != 1);
		List<Unit> teamUnits = m_teamSystem.GetTeamUnits(val);
		if (teamUnits.Count == 0)
		{
			return;
		}
		foreach (Unit item in teamUnits)
		{
			if (!((Object)(object)item == (Object)null) && !((Object)(object)item.data == (Object)null) && !((Object)(object)item.data.mainRig == (Object)null))
			{
				item.unitBlueprint.Spawn(item.data.mainRig.position, item.data.mainRig.rotation, unit.Team, item.unitBlueprint.sizeMultiplier, (UnitPoolInfo?)null);
				item.data.healthHandler.Die(unit);
				((Component)item).gameObject.SetActive(false);
			}
		}
	}
}
public class 普通同化 : GameStateListener
{
	private Unit unit;

	private bool onBattle;

	private GameModeService gameModeService;

	private TeamSystem m_teamSystem;

	private ITimeService timeService;

	private bool hasExecuted;

	public void Start()
	{
		m_teamSystem = World.Active.GetOrCreateManager<TeamSystem>();
		unit = ((Component)((Component)this).gameObject.transform.root).GetComponentInChildren<Unit>();
		gameModeService = ServiceLocator.GetService<GameModeService>();
		timeService = ServiceLocator.GetService<ITimeService>();
	}

	public void Update()
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Invalid comparison between Unknown and I4
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_017d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: 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_00bd: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
		if (!onBattle || hasExecuted)
		{
			return;
		}
		Team val = (Team)((int)unit.Team != 1);
		List<Unit> teamUnits = m_teamSystem.GetTeamUnits(val);
		if (teamUnits.Count == 0)
		{
			return;
		}
		foreach (Unit item in teamUnits)
		{
			if (!((Object)(object)item == (Object)null) && !((Object)(object)item.data == (Object)null) && !((Object)(object)item.data.mainRig == (Object)null))
			{
				CreateBlackBeam(unit.data.mainRig.position, item.data.mainRig.position);
				item.unitBlueprint.Spawn(item.data.mainRig.position, item.data.mainRig.rotation, unit.Team, item.unitBlueprint.sizeMultiplier, (UnitPoolInfo?)null);
				item.data.healthHandler.Die(unit);
				((Component)item).gameObject.SetActive(false);
			}
		}
		gameModeService.CurrentGameMode.WinConditionPropagator.ClearAllWinConditions();
		gameModeService.CurrentGameMode.OnWinnerDecided(unit.Team, "给我掉");
		gameModeService.CurrentGameMode.DecideWinner(unit.Team, "给我掉");
		((MonoBehaviour)this).Invoke("RestartBattle", 0.5f);
		hasExecuted = true;
	}

	private void CreateBlackBeam(Vector3 start, Vector3 end)
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Expected O, but got Unknown
		//IL_000b: 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_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: 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_0077: 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_0097: Expected O, but got Unknown
		//IL_009d: 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)
		GameObject val = new GameObject("BlackBeam");
		Vector3 val2 = end - start;
		float magnitude = ((Vector3)(ref val2)).magnitude;
		GameObject obj = GameObject.CreatePrimitive((PrimitiveType)2);
		obj.transform.SetParent(val.transform);
		obj.transform.position = (start + end) / 2f;
		obj.transform.up = ((Vector3)(ref val2)).normalized;
		obj.transform.localScale = new Vector3(0.1f, magnitude / 2f, 0.1f);
		Renderer component = obj.GetComponent<Renderer>();
		Material val3 = new Material(Shader.Find("Standard"));
		val3.SetColor("_Color", Color.black);
		val3.SetColor("_EmissionColor", Color.black);
		val3.EnableKeyword("_EMISSION");
		component.material = val3;
		Object.Destroy((Object)(object)obj.GetComponent<Collider>());
		Object.Destroy((Object)(object)val, 1f);
	}

	private void RestartBattle()
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		timeService.SetState(1f, 1f, false);
		Scene activeScene = SceneManager.GetActiveScene();
		SceneManager.LoadScene(((Scene)(ref activeScene)).name);
	}

	protected override void Awake()
	{
		((GameStateListener)this).Awake();
	}

	public override void OnEnterBattleState()
	{
		onBattle = true;
		hasExecuted = false;
	}

	public override void OnEnterPlacementState()
	{
		onBattle = false;
		hasExecuted = false;
	}
}
public class 方块化 : GameStateListener
{
	private Unit unit;

	private GameObject cubeModel;

	private Animator[] originalAnimators;

	private Rigidbody[] originalRigidbodies;

	private float[] originalMasses;

	private bool[] originalAnimatorEnabled;

	private bool[] originalRigidbodyKinematic;

	private bool isCube;

	public float cubeSize = 2f;

	public float floatHeight = 1.5f;

	private bool isCreating;

	public void Start()
	{
		if ((Object)(object)unit == (Object)null)
		{
			unit = ((Component)((Component)this).gameObject.transform.root).GetComponentInChildren<Unit>();
			if ((Object)(object)unit == (Object)null)
			{
				unit = ((Component)((Component)this).gameObject.transform.root).GetComponent<Unit>();
			}
		}
		Debug.Log((object)("[方块化] Start 被调用,unit=" + (((Object)(object)unit != (Object)null) ? ((Object)unit).name : "null")));
		((MonoBehaviour)this).StartCoroutine(FloatInAir());
		((MonoBehaviour)this).StartCoroutine(DelayedCreateCube());
	}

	protected override void Awake()
	{
		((GameStateListener)this).Awake();
		unit = ((Component)((Component)this).gameObject.transform.root).GetComponentInChildren<Unit>();
		if ((Object)(object)unit == (Object)null)
		{
			unit = ((Component)((Component)this).gameObject.transform.root).GetComponent<Unit>();
		}
	}

	public override void OnEnterBattleState()
	{
		CreateBlackCube();
	}

	public override void OnEnterPlacementState()
	{
		CreateBlackCube();
	}

	private void CreateBlackCube()
	{
		//IL_017c: Unknown result type (might be due to invalid IL or missing references)
		//IL_018f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0280: Unknown result type (might be due to invalid IL or missing references)
		//IL_0295: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0324: Unknown result type (might be due to invalid IL or missing references)
		//IL_0344: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fb: Expected O, but got Unknown
		if (isCube || isCreating)
		{
			return;
		}
		isCreating = true;
		Debug.Log((object)"[方块化] CreateBlackCube 被调用");
		if ((Object)(object)unit == (Object)null)
		{
			Debug.LogError((object)"[方块化] unit 为 null,无法方块化");
			isCreating = false;
			return;
		}
		if ((Object)(object)cubeModel != (Object)null)
		{
			Object.Destroy((Object)(object)cubeModel);
			cubeModel = null;
		}
		Transform transform = ((Component)unit).transform;
		originalAnimators = ((Component)transform).GetComponentsInChildren<Animator>(true);
		originalAnimatorEnabled = new bool[originalAnimators.Length];
		for (int i = 0; i < originalAnimators.Length; i++)
		{
			if ((Object)(object)originalAnimators[i] != (Object)null)
			{
				originalAnimatorEnabled[i] = ((Behaviour)originalAnimators[i]).enabled;
				((Behaviour)originalAnimators[i]).enabled = false;
			}
		}
		originalRigidbodies = ((Component)transform).GetComponentsInChildren<Rigidbody>(true);
		originalMasses = new float[originalRigidbodies.Length];
		originalRigidbodyKinematic = new bool[originalRigidbodies.Length];
		for (int j = 0; j < originalRigidbodies.Length; j++)
		{
			if ((Object)(object)originalRigidbodies[j] != (Object)null)
			{
				originalMasses[j] = originalRigidbodies[j].mass;
				originalRigidbodyKinematic[j] = originalRigidbodies[j].isKinematic;
				originalRigidbodies[j].mass = 0f;
				originalRigidbodies[j].isKinematic = true;
				originalRigidbodies[j].velocity = Vector3.zero;
				originalRigidbodies[j].angularVelocity = Vector3.zero;
				originalRigidbodies[j].useGravity = false;
			}
		}
		Collider[] componentsInChildren = ((Component)transform).GetComponentsInChildren<Collider>(true);
		foreach (Collider val in componentsInChildren)
		{
			if ((Object)(object)val != (Object)null)
			{
				val.enabled = false;
			}
		}
		Renderer[] componentsInChildren2 = ((Component)transform).GetComponentsInChildren<Renderer>(true);
		foreach (Renderer val2 in componentsInChildren2)
		{
			if ((Object)(object)val2 != (Object)null && (Object)(object)((Component)val2).gameObject != (Object)(object)cubeModel)
			{
				val2.enabled = false;
			}
		}
		cubeModel = GameObject.CreatePrimitive((PrimitiveType)3);
		Collider component = cubeModel.GetComponent<Collider>();
		if ((Object)(object)component != (Object)null)
		{
			Object.Destroy((Object)(object)component);
		}
		cubeModel.transform.SetParent((Transform)null, true);
		cubeModel.transform.position = transform.position;
		cubeModel.transform.rotation = Quaternion.identity;
		cubeModel.transform.localScale = new Vector3(cubeSize, cubeSize, cubeSize);
		Renderer component2 = cubeModel.GetComponent<Renderer>();
		if ((Object)(object)component2 != (Object)null)
		{
			component2.material = new Material(Shader.Find("Standard"))
			{
				color = Color.black
			};
		}
		isCube = true;
		isCreating = false;
		Debug.Log((object)string.Concat("[方块化] 方块化完成!方块世界尺寸=", cubeModel.transform.lossyScale, ",方块位置=", cubeModel.transform.position));
	}

	public void RestoreOriginalModel()
	{
		if ((Object)(object)cubeModel != (Object)null)
		{
			Object.Destroy((Object)(object)cubeModel);
			cubeModel = null;
		}
		if ((Object)(object)unit == (Object)null)
		{
			return;
		}
		Transform transform = ((Component)unit).transform;
		if (originalAnimators != null)
		{
			for (int i = 0; i < originalAnimators.Length; i++)
			{
				if ((Object)(object)originalAnimators[i] != (Object)null)
				{
					((Behaviour)originalAnimators[i]).enabled = originalAnimatorEnabled[i];
				}
			}
		}
		if (originalRigidbodies != null)
		{
			for (int j = 0; j < originalRigidbodies.Length; j++)
			{
				if ((Object)(object)originalRigidbodies[j] != (Object)null)
				{
					originalRigidbodies[j].mass = originalMasses[j];
					originalRigidbodies[j].isKinematic = originalRigidbodyKinematic[j];
					originalRigidbodies[j].useGravity = true;
				}
			}
		}
		Collider[] componentsInChildren = ((Component)transform).GetComponentsInChildren<Collider>(true);
		foreach (Collider val in componentsInChildren)
		{
			if ((Object)(object)val != (Object)null)
			{
				val.enabled = true;
			}
		}
		Renderer[] componentsInChildren2 = ((Component)transform).GetComponentsInChildren<Renderer>(true);
		foreach (Renderer val2 in componentsInChildren2)
		{
			if ((Object)(object)val2 != (Object)null)
			{
				val2.enabled = true;
			}
		}
		isCube = false;
		isCreating = false;
	}

	private IEnumerator DelayedCreateCube()
	{
		yield return null;
		CreateBlackCube();
	}

	private void OnDestroy()
	{
		if ((Object)(object)cubeModel != (Object)null)
		{
			Object.Destroy((Object)(object)cubeModel);
			cubeModel = null;
		}
	}

	private IEnumerator FloatInAir()
	{
		if ((Object)(object)unit == (Object)null)
		{
			yield break;
		}
		yield return null;
		Vector3 basePos = ((Component)unit).transform.position;
		float targetY = basePos.y + floatHeight;
		((Component)unit).transform.position = new Vector3(basePos.x, targetY, basePos.z);
		if ((Object)(object)cubeModel != (Object)null)
		{
			cubeModel.transform.position = new Vector3(basePos.x, targetY, basePos.z);
		}
		while (true)
		{
			if ((Object)(object)unit != (Object)null)
			{
				_ = ((Component)unit).transform.position;
				((Component)unit).transform.position = new Vector3(basePos.x, targetY, basePos.z);
				if ((Object)(object)cubeModel != (Object)null)
				{
					cubeModel.transform.position = new Vector3(basePos.x, targetY, basePos.z);
				}
			}
			yield return null;
		}
	}
}
public class 趋势技能 : GameStateListener
{
	private Unit unit;

	private GameModeService gameModeService;

	private float 计数器;

	private bool 战斗中判断;

	private bool 判断;

	public string 弹窗 = "给我掉!!!";

	private float 获胜计时器;

	private bool isInBattle;

	private bool hasWon;

	private float initialHealth;

	private float initialMaxHealth;

	private void Start()
	{
		unit = ((Component)((Component)this).transform.root).GetComponent<Unit>();
		gameModeService = ServiceLocator.GetService<GameModeService>();
		战斗中判断 = true;
		计数器 = 0f;
		获胜计时器 = 0f;
		判断 = true;
		isInBattle = false;
		hasWon = false;
		if ((Object)(object)unit.data != (Object)null)
		{
			initialHealth = unit.data.health;
			initialMaxHealth = unit.data.maxHealth;
		}
	}

	private void Update()
	{
		//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0119: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		if (!isInBattle || hasWon)
		{
			return;
		}
		if ((Object)(object)unit.data != (Object)null)
		{
			unit.data.health = initialHealth;
			unit.data.maxHealth = initialMaxHealth;
		}
		计数器 += Time.deltaTime;
		获胜计时器 += Time.deltaTime;
		Unit val = FindAnyEnemyUnit();
		if ((Object)(object)val == (Object)null)
		{
			val = FindDeadEnemyUnit();
		}
		if ((Object)(object)val != (Object)null)
		{
			if (计数器 > 0.03f)
			{
				计数器 = 0f;
				if ((Object)(object)val.data != (Object)null && (Object)(object)val.data.mainRig != (Object)null)
				{
					unit.data.mainRig.position = val.data.mainRig.position;
				}
				else if ((Object)(object)((Component)val).transform != (Object)null)
				{
					((Component)unit).transform.position = ((Component)val).transform.position;
				}
				KillUnit(val);
			}
		}
		else if (战斗中判断 && 获胜计时器 > 0.04f)
		{
			战斗中判断 = false;
			hasWon = true;
			if ((Object)(object)unit.data != (Object)null)
			{
				unit.data.health = initialHealth;
				unit.data.maxHealth = initialMaxHealth;
				unit.data.Dead = false;
			}
			gameModeService.CurrentGameMode.OnWinnerDecided(unit.Team, 弹窗);
			gameModeService.CurrentGameMode.DecideWinner(unit.Team, 弹窗);
		}
	}

	public override void OnEnterBattleState()
	{
		isInBattle = true;
	}

	public override void OnEnterPlacementState()
	{
		isInBattle = false;
	}

	private Unit FindAnyEnemyUnit()
	{
		//IL_001d: 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)
		Unit[] array = Object.FindObjectsOfType<Unit>();
		foreach (Unit val in array)
		{
			if ((Object)(object)val != (Object)(object)unit && val.Team != unit.Team && (Object)(object)val.data != (Object)null && !val.data.Dead)
			{
				return val;
			}
		}
		return null;
	}

	private void KillUnit(Unit target)
	{
		if (!((Object)(object)target == (Object)null))
		{
			if ((Object)(object)target.data != (Object)null)
			{
				target.data.Dead = true;
				target.data.health = 0f;
			}
			Collider component = ((Component)target).GetComponent<Collider>();
			if ((Object)(object)component != (Object)null)
			{
				component.enabled = false;
			}
			Collider[] componentsInChildren = ((Component)target).GetComponentsInChildren<Collider>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				componentsInChildren[i].enabled = false;
			}
			Rigidbody component2 = ((Component)target).GetComponent<Rigidbody>();
			if ((Object)(object)component2 != (Object)null)
			{
				component2.isKinematic = true;
			}
			Renderer[] componentsInChildren2 = ((Component)target).GetComponentsInChildren<Renderer>();
			for (int j = 0; j < componentsInChildren2.Length; j++)
			{
				componentsInChildren2[j].enabled = false;
			}
			if ((Object)(object)((Component)target).gameObject != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)target).gameObject);
			}
		}
	}

	private Unit FindDeadEnemyUnit()
	{
		//IL_001d: 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)
		Unit[] array = Object.FindObjectsOfType<Unit>();
		foreach (Unit val in array)
		{
			if ((Object)(object)val != (Object)(object)unit && val.Team != unit.Team && (Object)(object)val.data != (Object)null && val.data.Dead)
			{
				return val;
			}
		}
		return null;
	}
}
public class 彩虹变色渲染 : MonoBehaviour
{
	private Unit unit;

	private List<Renderer> rainbowRenderers;

	private List<Color> originalColors;

	public float rainbowSpeed = 0.5f;

	public float phaseOffset = 0.1f;

	public float saturation = 1f;

	public float value = 1f;

	public float emissionIntensity = 0.5f;

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

	private void Update()
	{
		UpdateRainbowColor();
	}

	private void InitializeRainbowRenderers()
	{
		//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d4: 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_0132: 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_00f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)unit == (Object)null)
		{
			return;
		}
		Renderer[] componentsInChildren = ((Component)unit).GetComponentsInChildren<Renderer>(true);
		rainbowRenderers = new List<Renderer>();
		originalColors = new List<Color>();
		Renderer[] array = componentsInChildren;
		foreach (Renderer val in array)
		{
			string text = ((Object)val).name.ToLower();
			if (text.Contains("eye") || text.Contains("eyes") || text.Contains("eyeball") || text.Contains("pupil") || text.Contains("眼球") || text.Contains("眼睛") || text.Contains("瞳孔"))
			{
				continue;
			}
			if ((Object)(object)val.material != (Object)null)
			{
				Color color = val.material.color;
				if (color.r < 0.1f && color.g < 0.1f && color.b < 0.1f && color.a > 0.5f)
				{
					continue;
				}
			}
			rainbowRenderers.Add(val);
			if ((Object)(object)val.material != (Object)null)
			{
				originalColors.Add(val.material.color);
			}
			else
			{
				originalColors.Add(Color.white);
			}
		}
	}

	private void UpdateRainbowColor()
	{
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		float num = Time.time * rainbowSpeed % 1f;
		for (int i = 0; i < rainbowRenderers.Count; i++)
		{
			Renderer val = rainbowRenderers[i];
			if (!((Object)(object)val == (Object)null) && !((Object)(object)val.material == (Object)null))
			{
				Color val2 = Color.HSVToRGB((num + (float)i * phaseOffset) % 1f, saturation, value);
				val.material.color = val2;
				if (val.material.HasProperty("_EmissionColor"))
				{
					val.material.SetColor("_EmissionColor", val2 * emissionIntensity);
					val.material.EnableKeyword("_EMISSION");
				}
			}
		}
	}

	private void OnDestroy()
	{
		RestoreOriginalColors();
	}

	public void RestoreOriginalColors()
	{
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < rainbowRenderers.Count; i++)
		{
			Renderer val = rainbowRenderers[i];
			if (!((Object)(object)val == (Object)null) && !((Object)(object)val.material == (Object)null))
			{
				val.material.color = originalColors[i];
				if (val.material.HasProperty("_EmissionColor"))
				{
					val.material.SetColor("_EmissionColor", Color.black);
				}
			}
		}
	}
}
public class 金属反光渲染 : MonoBehaviour
{
	private Unit unit;

	private List<Renderer> metalRenderers;

	private List<Color> originalColors;

	public float metallic = 1f;

	public float glossiness = 1f;

	public float smoothness = 1f;

	public float emissionIntensity = 0.3f;

	private List<Material> originalMaterials;

	public Color metalColor = new Color(0.8f, 0.8f, 0.9f, 1f);

	public float reflectionProbeIntensity = 1f;

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

	private void Update()
	{
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < metalRenderers.Count; i++)
		{
			Renderer val = metalRenderers[i];
			if (!((Object)(object)val == (Object)null) && !((Object)(object)val.material == (Object)null))
			{
				val.material.color = metalColor;
				if (val.material.HasProperty("_EmissionColor"))
				{
					val.material.SetColor("_EmissionColor", metalColor * emissionIntensity);
				}
			}
		}
	}

	private void InitializeMetalRenderers()
	{
		//IL_01bd: 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_0112: Unknown result type (might be due to invalid IL or missing references)
		//IL_0119: Expected O, but got Unknown
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_018c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0197: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)unit == (Object)null)
		{
			return;
		}
		Renderer[] componentsInChildren = ((Component)unit).GetComponentsInChildren<Renderer>(true);
		metalRenderers = new List<Renderer>();
		originalColors = new List<Color>();
		originalMaterials = new List<Material>();
		Renderer[] array = componentsInChildren;
		foreach (Renderer val in array)
		{
			string text = ((Object)val).name.ToLower();
			if (text.Contains("eye") || text.Contains("eyes") || text.Contains("eyeball") || text.Contains("pupil") || text.Contains("眼球") || text.Contains("眼睛") || text.Contains("瞳孔"))
			{
				continue;
			}
			metalRenderers.Add(val);
			if ((Object)(object)val.material != (Object)null)
			{
				originalColors.Add(val.material.color);
				originalMaterials.Add(val.material);
				Material val2 = new Material(Shader.Find("Standard"));
				val2.color = metalColor;
				val2.SetFloat("_Metallic", metallic);
				val2.SetFloat("_Glossiness", glossiness);
				val2.SetFloat("_Smoothness", smoothness);
				val2.SetInt("_SpecularHighlights", 1);
				val2.SetInt("_GlossyReflections", 1);
				if (val2.HasProperty("_EmissionColor"))
				{
					val2.SetColor("_EmissionColor", metalColor * emissionIntensity);
					val2.EnableKeyword("_EMISSION");
				}
				val.material = val2;
			}
			else
			{
				originalColors.Add(Color.white);
				originalMaterials.Add(null);
			}
		}
	}

	private void OnDestroy()
	{
		for (int i = 0; i < metalRenderers.Count; i++)
		{
			Renderer val = metalRenderers[i];
			if (!((Object)(object)val == (Object)null) && (Object)(object)originalMaterials[i] != (Object)null)
			{
				val.material = originalMaterials[i];
			}
		}
	}

	private void SetupReflectionProbe()
	{
		//IL_000d: 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_0062: Unknown result type (might be due to invalid IL or missing references)
		if (Object.FindObjectsOfType<ReflectionProbe>().Length == 0)
		{
			ReflectionProbe obj = new GameObject("DynamicReflectionProbe").AddComponent<ReflectionProbe>();
			obj.mode = (ReflectionProbeMode)1;
			obj.refreshMode = (ReflectionProbeRefreshMode)1;
			obj.timeSlicingMode = (ReflectionProbeTimeSlicingMode)2;
			obj.intensity = reflectionProbeIntensity;
			obj.size = new Vector3(1000f, 1000f, 1000f);
			((Component)obj).transform.position = ((Component)unit).transform.position;
		}
	}
}
public class InfinityHealth : MonoBehaviour
{
	private Unit _unit;

	private void Start()
	{
		_unit = ((Component)this).GetComponentInParent<Unit>();
	}

	private void Update()
	{
		Unit unit = _unit;
		if (!((Object)(object)(((Object)(object)unit != (Object)null) ? unit.data : null) == (Obj