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.Windows.Forms;
using BepInEx;
using DM;
using Landfall.TABS;
using Landfall.TABS.AI.Components.Modifiers;
using Landfall.TABS.AI.Components.Tags;
using SLMA;
using TFBGames;
using UnityEngine;
using UnityEngine.Events;
using Zombie;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Zombie")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Zombie")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e5ff577f-fa5d-4f3b-a1c5-66e306eed9f4")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
public class MotherZombie : MonoBehaviour
{
public void Start()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: 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_01b9: Unknown result type (might be due to invalid IL or missing references)
//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
//IL_021d: Unknown result type (might be due to invalid IL or missing references)
Unit component = ((Component)this).GetComponent<Unit>();
((Component)component).gameObject.GetComponentInChildren<Unit>().unitType = (UnitType)1;
Balance componentInChildren = ((Component)component).gameObject.GetComponentInChildren<Balance>();
componentInChildren.forceMultiplier *= 1.5f;
Balance componentInChildren2 = ((Component)component).gameObject.GetComponentInChildren<Balance>();
componentInChildren2.allowedLegAngle *= 2f;
Balance componentInChildren3 = ((Component)component).gameObject.GetComponentInChildren<Balance>();
componentInChildren3.allowedTorsoAngle *= 2f;
((Component)((Component)component).gameObject.GetComponentInChildren<RigidbodyHolder>().AllRigs[0]).transform.localScale = new Vector3(3f, 3f, 3f);
((Component)((Component)component).gameObject.GetComponentInChildren<RigidbodyHolder>().AllRigs[2]).transform.localScale = new Vector3(3f, 1.15f, 3.5f);
((Component)((Component)component).gameObject.GetComponentInChildren<RigidbodyHolder>().AllRigs[1]).transform.localScale = new Vector3(3f, 1.15f, 3.5f);
((Component)((Component)component).gameObject.GetComponentInChildren<RigidbodyHolder>().AllRigs[3]).transform.localScale = new Vector3(3f, 3f, 1f);
((Component)((Component)component).gameObject.GetComponentInChildren<RigidbodyHolder>().AllRigs[5]).transform.localScale = new Vector3(3f, 3f, 1f);
((Component)((Component)component).gameObject.GetComponentInChildren<RigidbodyHolder>().AllRigs[7]).transform.localScale = new Vector3(3f, 1.15f, 3.5f);
((Component)((Component)component).gameObject.GetComponentInChildren<RigidbodyHolder>().AllRigs[8]).transform.localScale = new Vector3(3f, 1.15f, 3.5f);
((Component)((Component)component).gameObject.GetComponentInChildren<RigidbodyHolder>().AllRigs[9]).transform.localScale = new Vector3(3f, 1.15f, 3.5f);
((Component)((Component)component).gameObject.GetComponentInChildren<RigidbodyHolder>().AllRigs[10]).transform.localScale = new Vector3(3f, 1.15f, 3.5f);
}
}
public class ZombieBite : MonoBehaviour
{
private DataHandler data;
private DataHandler targetData;
private float scanCounter;
private float infectionCounter;
public UnitEffectBase effect;
public float infectionCooldown = 0.5f;
public float infectionDistance = 1f;
private void OnEnable()
{
data = ((Component)((Component)this).transform.root).GetComponentInChildren<DataHandler>();
targetData = null;
scanCounter = 0f;
infectionCounter = 0f;
}
private void Update()
{
if ((Object)(object)data == (Object)null)
{
data = ((Component)((Component)this).transform.root).GetComponentInChildren<DataHandler>();
}
if ((Object)(object)data == (Object)null || data.Dead)
{
return;
}
if (infectionCounter > 0f)
{
infectionCounter -= Time.deltaTime;
}
if ((Object)(object)data.targetData == (Object)null)
{
targetData = null;
return;
}
targetData = data.targetData;
scanCounter += Time.deltaTime;
if (!(scanCounter < 0.05f))
{
scanCounter = 0f;
TryInfectHeldTarget();
}
}
private void TryInfectHeldTarget()
{
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)targetData == (Object)null || targetData.Dead || infectionCounter > 0f || (Object)(object)data.head == (Object)null || (Object)(object)targetData.mainRig == (Object)null)
{
return;
}
float num = Vector3.Distance(data.head.position, targetData.mainRig.position + ((Component)targetData.mainRig).transform.up * 0.15f);
if (num > infectionDistance)
{
return;
}
GameObject gameObject = ((Component)((Component)targetData).transform.root).gameObject;
if ((Object)(object)gameObject == (Object)null)
{
return;
}
Zombification zombification = gameObject.GetComponentInChildren<Zombification>();
if ((Object)(object)zombification == (Object)null)
{
if ((Object)(object)effect == (Object)null)
{
Debug.LogError((object)"[Zombie] ZombieBite has no Zombification effect prefab.");
return;
}
GameObject val = Object.Instantiate<GameObject>(((Component)effect).gameObject, gameObject.transform);
((Object)val).name = "Zombification";
((Object)val).hideFlags = (HideFlags)61;
val.SetActive(true);
zombification = val.GetComponent<Zombification>();
if ((Object)(object)zombification == (Object)null)
{
zombification = val.GetComponentInChildren<Zombification>();
}
if ((Object)(object)zombification == (Object)null)
{
Debug.LogError((object)("[Zombie] Could not create Zombification on " + ((Object)gameObject).name));
Object.Destroy((Object)(object)val);
return;
}
((UnitEffectBase)zombification).DoEffect();
Debug.Log((object)("[Zombie] Infection attached to " + ((Object)gameObject).name));
}
((UnitEffectBase)zombification).Ping();
infectionCounter = infectionCooldown;
}
}
[BepInPlugin("org.bepinex.plugins.Zombie", "Zombie", "1.0.0")]
internal class Loader : BaseUnityPlugin
{
private void Awake()
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected O, but got Unknown
Debug.Log((object)"运行核心!");
Debug.Log((object)("本模组制作by " + UManager.可修改作者));
Debug.Log((object)"核心基于SLMAcore");
GameObject val = new GameObject(UManager.可修改模组名字);
Object.DontDestroyOnLoad((Object)(object)val);
val.AddComponent<Main>();
}
}
[BepInPlugin("org.bepinex.plugins.Zombie", "Zombie", "1.0.0")]
public class Main : BaseUnityPlugin
{
public LandfallUnitDatabase db;
public void Awake()
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
if (UManager.是否弹窗)
{
MessageBox.Show("本模组为" + UManager.可修改作者 + "制作\r\n模组名字为" + UManager.可修改模组名字, "SLMA", (MessageBoxButtons)0, (MessageBoxIcon)16, (MessageBoxDefaultButton)0, (MessageBoxOptions)131072);
}
Debug.Log((object)("Loaded " + UManager.可修改模组名字 + "....."));
SLMALoader.GetInstance();
UManager.Init(ContentDatabase.Instance().LandfallContentDatabase);
Debug.Log((object)("Loaded " + UManager.可修改模组名字 + "............"));
Debug.Log((object)("Loaded " + UManager.可修改模组名字 + " Successfully"));
Debug.Log((object)(UManager.可修改作者 + "祝您玩的愉快"));
Debug.Log((object)(UManager.可修改作者 + " wished you a pleasant trip"));
}
}
public class MotherSummon : MonoBehaviour
{
public static UnitBlueprint ZombieBlueprint;
public float interval = 5f;
public int maxAlive = 8;
public float detectRadius = 30f;
public LayerMask enemyLayerMask = LayerMask.op_Implicit(-1);
private Unit unit;
private float timer = 2f;
private float detectTimer;
private readonly List<GameObject> summoned = new List<GameObject>();
private void Start()
{
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Expected O, but got Unknown
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
unit = ((Component)this).GetComponent<Unit>();
if ((Object)(object)unit == (Object)null)
{
unit = ((Component)this).GetComponentInParent<Unit>();
}
Debug.Log((object)("[Zombie] MotherSummon.Start unit=" + (((Object)(object)unit != (Object)null) ? ((Object)((Component)unit).gameObject).name : "NULL") + " blueprint=" + (((Object)ZombieBlueprint != (Object)null) ? ((Object)ZombieBlueprint).name : "NULL")));
}
private void Update()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Expected O, but got Unknown
if ((Object)(object)unit == (Object)null || (Object)ZombieBlueprint == (Object)null || (Object)(object)unit.data == (Object)null || unit.data.Dead)
{
return;
}
for (int num = summoned.Count - 1; num >= 0; num--)
{
if ((Object)(object)summoned[num] == (Object)null)
{
summoned.RemoveAt(num);
}
}
timer += Time.deltaTime;
if (timer < interval || summoned.Count >= maxAlive)
{
return;
}
detectTimer += Time.deltaTime;
if (!(detectTimer < 0.5f))
{
detectTimer = 0f;
if (HasNearbyEnemy())
{
timer = 0f;
SpawnZombie();
}
}
}
private bool HasNearbyEnemy()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
try
{
Collider[] array = Physics.OverlapSphere(unit.data.mainRig.position, detectRadius, LayerMask.op_Implicit(enemyLayerMask));
for (int i = 0; i < array.Length; i++)
{
Unit componentInParent = ((Component)array[i]).GetComponentInParent<Unit>();
if ((Object)(object)componentInParent != (Object)null && (Object)(object)componentInParent != (Object)(object)unit && componentInParent.Team != unit.Team && !componentInParent.data.Dead)
{
return true;
}
}
}
catch (Exception ex)
{
Debug.LogWarning((object)("[Zombie] MotherSummon.HasNearbyEnemy 异常: " + ex.Message));
}
return false;
}
private void SpawnZombie()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: 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_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
try
{
Vector3 val = unit.data.mainRig.position + ((Component)unit.data.mainRig).transform.forward * 2f + Random.insideUnitSphere * 1f;
val.y = unit.data.mainRig.position.y;
GameObject val2 = ZombieBlueprint.Spawn(val, Quaternion.LookRotation(((Component)unit.data.mainRig).transform.forward), unit.Team, 1f, (UnitPoolInfo?)null)[0];
Unit component = val2.GetComponent<Unit>();
if ((Object)(object)component != (Object)null)
{
component.data.fallTime = 0.3f;
}
summoned.Add(val2);
Debug.Log((object)("[Zombie] 母体召唤了僵尸, 当前存活召唤物: " + summoned.Count));
}
catch (Exception ex)
{
Debug.LogError((object)("[Zombie] 母体召唤失败: " + ex));
}
}
}
public static class STools
{
public static void RendererColorChanger(Renderer[] renderers, Color color)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < renderers.Length; i++)
{
Material[] materials = renderers[i].materials;
for (int j = 0; j < materials.Length; j++)
{
materials[j].color = color;
}
}
}
public static List<T> ToList<T>(T[] ts)
{
List<T> list = new List<T>();
foreach (T item in ts)
{
list.Add(item);
}
return list;
}
public static void RendererColorChanger(MeshRenderer[] renderers, Color color)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < renderers.Length; i++)
{
Material[] materials = ((Renderer)renderers[i]).materials;
for (int j = 0; j < materials.Length; j++)
{
materials[j].color = color;
}
}
}
public static void RendererColorChanger(SkinnedMeshRenderer[] renderers, Color color)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < renderers.Length; i++)
{
Material[] materials = ((Renderer)renderers[i]).materials;
for (int j = 0; j < materials.Length; j++)
{
materials[j].color = color;
}
}
}
public static void RendererColorChanger(Renderer[] renderers, Material[] color)
{
for (int i = 0; i < renderers.Length; i++)
{
renderers[i].materials = color;
}
}
public static void RendererColorChanger(MeshRenderer[] renderers, Material[] color)
{
for (int i = 0; i < renderers.Length; i++)
{
((Renderer)renderers[i]).materials = color;
}
}
public static void RendererColorChanger(SkinnedMeshRenderer[] renderers, Material[] color)
{
for (int i = 0; i < renderers.Length; i++)
{
((Renderer)renderers[i]).materials = color;
}
}
}
public static class UManager
{
public static string 可修改作者 = "Fhp史莱姆";
public static string 可修改模组名字 = "僵尸mod";
public static string 注释;
public static string 不准修改Path = "SLMApackage\\image";
public static bool 是否弹窗 = false;
public static GameObject MasterObject { get; private set; }
public static GameObject ZombieBiteMove { get; private set; }
public static void Init(LandfallContentDatabase db)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Expected O, but got Unknown
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: 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_0180: Expected O, but got Unknown
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_01df: Expected O, but got Unknown
//IL_0201: Unknown result type (might be due to invalid IL or missing references)
//IL_0206: Unknown result type (might be due to invalid IL or missing references)
//IL_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
//IL_0229: Unknown result type (might be due to invalid IL or missing references)
//IL_023e: Expected O, but got Unknown
//IL_025f: Unknown result type (might be due to invalid IL or missing references)
//IL_0266: Expected O, but got Unknown
//IL_0270: Unknown result type (might be due to invalid IL or missing references)
//IL_0275: Unknown result type (might be due to invalid IL or missing references)
//IL_0277: Unknown result type (might be due to invalid IL or missing references)
//IL_027c: Unknown result type (might be due to invalid IL or missing references)
//IL_0287: Unknown result type (might be due to invalid IL or missing references)
//IL_0289: Unknown result type (might be due to invalid IL or missing references)
//IL_028f: Expected O, but got Unknown
//IL_0291: Unknown result type (might be due to invalid IL or missing references)
//IL_0296: Unknown result type (might be due to invalid IL or missing references)
//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
//IL_02a9: Expected O, but got Unknown
//IL_0305: Unknown result type (might be due to invalid IL or missing references)
//IL_0315: Expected O, but got Unknown
//IL_032a: Unknown result type (might be due to invalid IL or missing references)
//IL_032f: Unknown result type (might be due to invalid IL or missing references)
//IL_0334: Unknown result type (might be due to invalid IL or missing references)
//IL_0540: Unknown result type (might be due to invalid IL or missing references)
//IL_0555: Expected O, but got Unknown
//IL_0603: Unknown result type (might be due to invalid IL or missing references)
//IL_0608: Unknown result type (might be due to invalid IL or missing references)
//IL_0619: Unknown result type (might be due to invalid IL or missing references)
//IL_0623: Unknown result type (might be due to invalid IL or missing references)
//IL_0628: Unknown result type (might be due to invalid IL or missing references)
//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
//IL_03bf: Expected O, but got Unknown
//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
//IL_0792: Unknown result type (might be due to invalid IL or missing references)
//IL_07a2: Expected O, but got Unknown
//IL_0895: Unknown result type (might be due to invalid IL or missing references)
//IL_08aa: Expected O, but got Unknown
//IL_09c2: Unknown result type (might be due to invalid IL or missing references)
//IL_09d2: Expected O, but got Unknown
//IL_0a4f: Unknown result type (might be due to invalid IL or missing references)
//IL_0a64: Expected O, but got Unknown
//IL_0a9f: Unknown result type (might be due to invalid IL or missing references)
//IL_0ab4: Expected O, but got Unknown
//IL_0b11: Unknown result type (might be due to invalid IL or missing references)
//IL_0b21: Expected O, but got Unknown
//IL_0904: Unknown result type (might be due to invalid IL or missing references)
//IL_090b: Expected O, but got Unknown
//IL_090d: Unknown result type (might be due to invalid IL or missing references)
//IL_0b73: Unknown result type (might be due to invalid IL or missing references)
//IL_0b7a: Expected O, but got Unknown
//IL_0b7c: Unknown result type (might be due to invalid IL or missing references)
//IL_0c12: Unknown result type (might be due to invalid IL or missing references)
//IL_0c19: Expected O, but got Unknown
//IL_0c1b: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject();
((Object)val).hideFlags = (HideFlags)61;
val.SetActive(false);
MasterObject = val;
RegisterTranslations();
Sprite val2 = LoadIcon("faction_zombie");
Sprite val3 = LoadIcon("unit_zombie");
Sprite val4 = LoadIcon("unit_fast_zombie");
Sprite val5 = LoadIcon("unit_fly_zombie");
Sprite val6 = LoadIcon("unit_giant_zombie");
Sprite val7 = LoadIcon("unit_mother");
Sprite val8 = LoadIcon("unit_fly_mother");
Sprite val9 = LoadIcon("weapon_claw");
Sprite val10 = LoadIcon("weapon_punch");
Sprite val11 = LoadIcon("weapon_harpoon");
Sprite val12 = LoadIcon("ability_bite");
Sprite val13 = LoadIcon("ability_wings");
GameObject val14 = UPool.MyPool.AddObject("僵尸撕咬", (GameObject)SLMALoader.SDic["moves"]["Vampirebite"], true, (HideFlags)52, val12, 48970001, true);
SetZombieTag(val14);
DodgeMove component = val14.GetComponent<DodgeMove>();
CombatMoveDataInstance obj = component.moves[0];
obj.force /= 3f;
component.moves[0].forceDirection = (ForceDirection)1;
DodgeMove val15 = val14.AddComponent<DodgeMove>();
((Object)val15).hideFlags = (HideFlags)61;
val15.moves = (CombatMoveDataInstance[])(object)new CombatMoveDataInstance[1]
{
new CombatMoveDataInstance
{
rigidbodyToMove = (RigidBodyToMove)7,
forceDirection = (ForceDirection)10,
force = component.moves[0].force,
forceCurve = component.moves[0].forceCurve
}
};
DodgeMove val16 = val14.AddComponent<DodgeMove>();
((Object)val16).hideFlags = (HideFlags)61;
val16.moves = (CombatMoveDataInstance[])(object)new CombatMoveDataInstance[1]
{
new CombatMoveDataInstance
{
rigidbodyToMove = (RigidBodyToMove)6,
forceDirection = (ForceDirection)10,
force = component.moves[0].force,
forceCurve = component.moves[0].forceCurve
}
};
DodgeMove val17 = val14.AddComponent<DodgeMove>();
((Object)val17).hideFlags = (HideFlags)61;
val17.moves = (CombatMoveDataInstance[])(object)new CombatMoveDataInstance[1]
{
new CombatMoveDataInstance
{
rigidbodyToMove = (RigidBodyToMove)0,
forceDirection = (ForceDirection)10,
force = component.moves[0].force,
forceCurve = component.moves[0].forceCurve
}
};
Object.Destroy((Object)(object)val14.GetComponent<VapireBite>());
ConditionalEvent component2 = val14.GetComponent<ConditionalEvent>();
ConditionalEventInstance[] array = new ConditionalEventInstance[1];
ConditionalEventInstance val18 = new ConditionalEventInstance();
val18.conditions = (EventCondition[])(object)new EventCondition[2]
{
new EventCondition
{
valueType = (ValueType)1,
value = 1f,
conditionType = (ConditionType)1
},
new EventCondition
{
value = 1.1f,
conditionType = (ConditionType)0
}
};
val18.moves = (Move[])(object)new Move[3]
{
(Move)component,
(Move)val16,
(Move)val15
};
array[0] = val18;
component2.events = (ConditionalEventInstance[])(object)array;
StripVampirebiteDamageChildren(val14);
ZombieBiteMove = val14;
Unit component3 = UPool.MyPool.AddObject("僵尸", (GameObject)SLMALoader.SDic["bases"]["Humanoid"], true, (HideFlags)52, (Sprite)null, 0, false).GetComponent<Unit>();
Color color = Color32.op_Implicit(new Color32((byte)120, (byte)170, (byte)50, byte.MaxValue));
if ((Object)(object)((Component)component3).gameObject.GetComponent<ZombieVoiceOverride>() == (Object)null)
{
((Component)component3).gameObject.AddComponent<ZombieVoiceOverride>();
}
Renderer[] componentsInChildren = ((Component)component3).gameObject.GetComponentsInChildren<Renderer>(true);
foreach (Renderer val19 in componentsInChildren)
{
if ((Object)(object)val19 == (Object)null)
{
continue;
}
Material[] materials = val19.materials;
for (int j = 0; j < materials.Length; j++)
{
if (!((Object)(object)materials[j] == (Object)null))
{
Material val20 = new Material(materials[j]);
val20.color = color;
materials[j] = val20;
}
}
val19.materials = materials;
TeamColor val21 = ((Component)val19).GetComponent<TeamColor>();
if ((Object)(object)val21 == (Object)null)
{
val21 = ((Component)val19).gameObject.AddComponent<TeamColor>();
}
if (materials.Length != 0)
{
val21.redMaterial = materials[0];
val21.blueMaterial = materials[0];
}
}
Material greenMaterial = null;
Renderer[] componentsInChildren2 = ((Component)component3).gameObject.GetComponentsInChildren<Renderer>(true);
for (int k = 0; k < componentsInChildren2.Length; k++)
{
Renderer val22 = componentsInChildren2[k];
if ((Object)(object)val22 != (Object)null && val22.sharedMaterials != null && val22.sharedMaterials.Length != 0 && (Object)(object)val22.sharedMaterials[0] != (Object)null)
{
greenMaterial = componentsInChildren2[k].sharedMaterials[0];
break;
}
}
SkeletonZombieColor.GreenMaterial = greenMaterial;
Unit component4 = UPool.MyPool.AddObject("僵尸母体", ((Component)component3).gameObject, true, (HideFlags)52, (Sprite)null, 0, false).GetComponent<Unit>();
component4.data.canFall = false;
((Component)component4).gameObject.AddComponent<MotherZombie>();
((Component)component4).gameObject.AddComponent<MotherSummon>();
GameObject val23 = UPool.MyPool.AddObject("僵尸之爪", (GameObject)SLMALoader.SDic["weapons"]["MinoTaurGrab"], true, (HideFlags)52, val9, 48970002, true);
SetZombieTag(val23);
((Weapon)val23.GetComponent<MeleeWeapon>()).internalCooldown = 1f;
MeleeWeapon component5 = val23.GetComponent<MeleeWeapon>();
component5.curveForce *= 0.8f;
val23.GetComponent<MeleeWeapon>().canDealDamageOutSideOfSwing = true;
val23.GetComponentInChildren<Holdable>().ignoreDissarm = false;
val23.GetComponent<CollisionWeapon>().ignoreTeamMates = true;
val23.GetComponent<CollisionWeapon>().damage = 0f;
ZombieBite zombieBite = val23.AddComponent<ZombieBite>();
zombieBite.effect = ((Component)Zombification.ConvenientInstance()).GetComponent<UnitEffectBase>();
zombieBite.infectionCooldown = 0.5f;
zombieBite.infectionDistance = 1f;
val23.GetComponent<Holdable>().holdableData.forwardRotation = Vector3.right;
val23.GetComponent<Holdable>().holdableData.relativePosition = Vector3.forward * 0.3f;
val23.GetComponent<Holdable>().holdableData.lookAtTargetWhenWithin = 3f;
Renderer[] componentsInChildren3 = val23.GetComponentsInChildren<Renderer>();
for (int l = 0; l < componentsInChildren3.Length; l++)
{
componentsInChildren3[l].enabled = false;
}
Faction val24 = SLMATool.CreateFaction("Zombie", (UnitBlueprint[])null, val2, 48974896);
UnitBlueprint val25 = SLMATool.CreateUnit("僵尸", (UnitBlueprint)null, val24, val3);
ApplyMinotaurVocals(val25);
val25.forceCost = 100u;
val25.health = 120f;
val25.damageMultiplier = 2.5f;
val25.maxSizeRandom = 1f;
val25.minSizeRandom = 1f;
val25.UnitBase = UPool.MyPool.GetObject("僵尸");
val25.movementSpeedMuiltiplier = 1f;
val25.turnSpeed = float.MaxValue;
val25.holdinigWithTwoHands = false;
val25.RightWeapon = UPool.MyPool.GetObject("僵尸之爪");
val25.LeftWeapon = UPool.MyPool.GetObject("僵尸之爪");
val25.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[1] { val14 };
MotherSummon.ZombieBlueprint = val25;
UnitBlueprint val26 = SLMATool.CreateUnit("骷髅僵尸", val25, val24, val3);
ApplyMinotaurVocals(val26);
GameObject val27 = (val26.UnitBase = UPool.MyPool.AddObject("骷髅僵尸基础", (GameObject)SLMALoader.SDic["bases"]["Stiffy"], true, (HideFlags)52, (Sprite)null, 0, false));
if ((Object)(object)val27.GetComponent<ZombieVoiceOverride>() == (Object)null)
{
val27.AddComponent<ZombieVoiceOverride>();
}
if ((Object)(object)val27.GetComponent<SkeletonZombieColor>() == (Object)null)
{
val27.AddComponent<SkeletonZombieColor>();
}
val26.health = 120f;
val26.forceCost = 100u;
val26.RightWeapon = UPool.MyPool.GetObject("僵尸之爪");
val26.LeftWeapon = UPool.MyPool.GetObject("僵尸之爪");
List<GameObject> list = STools.ToList(val26.objectsToSpawnAsChildren);
if ((Object)(object)val14 != (Object)null && !list.Contains(val14))
{
list.Add(val14);
}
val26.objectsToSpawnAsChildren = list.ToArray();
GameObject val29 = UPool.MyPool.AddObject("僵尸之翼", (GameObject)SLMALoader.SDic["moves"]["Wings"], true, (HideFlags)52, val13, 48970004, true);
SetZombieTag(val29);
SkinnedMeshRenderer[] componentsInChildren4 = val29.GetComponentsInChildren<SkinnedMeshRenderer>(true);
foreach (SkinnedMeshRenderer val30 in componentsInChildren4)
{
if ((Object)(object)val30 == (Object)null)
{
continue;
}
Material[] materials2 = ((Renderer)val30).materials;
for (int n = 0; n < materials2.Length; n++)
{
if (!((Object)(object)materials2[n] == (Object)null))
{
Material val31 = new Material(materials2[n]);
val31.color = color;
materials2[n] = val31;
}
}
((Renderer)val30).materials = materials2;
}
UnitBlueprint val32 = SLMATool.CreateUnit("飞行僵尸", val25, val24, val5);
ApplyMinotaurVocals(val32);
val32.forceCost = 200u;
List<GameObject> list2 = STools.ToList(val32.objectsToSpawnAsChildren);
list2.Add(val29);
val32.objectsToSpawnAsChildren = list2.ToArray();
GameObject val33 = UPool.MyPool.AddObject("僵尸爆炸", (GameObject)SLMALoader.SDic["explosions"]["E_ExplosionIceGiant"], true, (HideFlags)52, (Sprite)null, 0, false);
Explosion componentInChildren = val33.GetComponentInChildren<Explosion>();
componentInChildren.damage *= 2f;
Explosion componentInChildren2 = val33.GetComponentInChildren<Explosion>();
componentInChildren2.radius *= 1.5f;
val33.GetComponentInChildren<Explosion>().ignoreTeamMates = true;
val33.AddComponent<ExplosionAddEffect>().EffectPrefab = ((Component)Zombification.ConvenientInstance()).GetComponent<UnitEffectBase>();
GameObject val34 = UPool.MyPool.AddObject("僵尸重拳", (GameObject)SLMALoader.SDic["weapons"]["GiantPunch"], true, (HideFlags)52, val10, 48970003, true);
SetZombieTag(val34);
val34.AddComponent<MeleeWeaponSpawn>().objectToSpawn = val33;
GameObject val35 = UPool.MyPool.AddObject("母体召唤枪", (GameObject)SLMALoader.SDic["weapons"]["HarpoonGun"], true, (HideFlags)52, val11, 48970005, true);
SetZombieTag(val35);
Renderer[] componentsInChildren5 = val35.GetComponentsInChildren<Renderer>();
for (int num = 0; num < componentsInChildren5.Length; num++)
{
componentsInChildren5[num].enabled = false;
}
GameObject val36 = UPool.MyPool.AddObject("感染鱼叉", (GameObject)SLMALoader.SDic["projectiles"]["P_Harpoon"], true, (HideFlags)52, (Sprite)null, 0, false);
MeshRenderer[] componentsInChildren6 = val36.GetComponentsInChildren<MeshRenderer>(true);
foreach (MeshRenderer val37 in componentsInChildren6)
{
if ((Object)(object)val37 == (Object)null)
{
continue;
}
Material[] materials3 = ((Renderer)val37).materials;
for (int num3 = 0; num3 < materials3.Length; num3++)
{
if (!((Object)(object)materials3[num3] == (Object)null))
{
Material val38 = new Material(materials3[num3]);
val38.color = color;
materials3[num3] = val38;
}
}
((Renderer)val37).materials = materials3;
}
LineRenderer[] componentsInChildren7 = val36.GetComponentsInChildren<LineRenderer>(true);
foreach (LineRenderer val39 in componentsInChildren7)
{
if ((Object)(object)val39 == (Object)null)
{
continue;
}
Material[] materials4 = ((Renderer)val39).materials;
for (int num5 = 0; num5 < materials4.Length; num5++)
{
if (!((Object)(object)materials4[num5] == (Object)null))
{
Material val40 = new Material(materials4[num5]);
val40.color = color;
materials4[num5] = val40;
}
}
((Renderer)val39).materials = materials4;
}
val35.GetComponent<RangeWeapon>().ObjectToSpawn = val36;
((Weapon)val35.GetComponent<RangeWeapon>()).internalCooldown = 2.5f;
((Weapon)val35.GetComponent<RangeWeapon>()).internalCounter = 2.5f;
UnitBlueprint val41 = SLMATool.CreateUnit("巨型僵尸", val25, val24, val6);
ApplyMinotaurVocals(val41);
val41.forceCost = 1000u;
val41.sizeMultiplier = 2f;
val41.maxSizeRandom = 3f;
val41.minSizeRandom = 2f;
val41.health = 750f;
val41.RightWeapon = UPool.MyPool.GetObject("僵尸重拳");
val41.LeftWeapon = UPool.MyPool.GetObject("僵尸重拳");
UnitBlueprint val42 = SLMATool.CreateUnit("僵尸母体", val25, val24, val7);
ApplyMinotaurVocals(val42);
val42.UnitBase = ((Component)component4).gameObject;
val42.RightWeapon = val35;
val42.LeftWeapon = val35;
val42.forceCost = 7000u;
val42.sizeMultiplier = 2f;
val42.health = 1000f;
UnitBlueprint val43 = SLMATool.CreateUnit("飞行僵尸母体", val25, val24, val8);
ApplyMinotaurVocals(val43);
val43.UnitBase = ((Component)component4).gameObject;
val43.RightWeapon = val35;
val43.LeftWeapon = val35;
val43.forceCost = 7000u;
val43.sizeMultiplier = 2f;
val43.health = 1000f;
List<GameObject> list3 = STools.ToList(val43.objectsToSpawnAsChildren);
list3.Add(val29);
val43.objectsToSpawnAsChildren = list3.ToArray();
UnitBlueprint val44 = SLMATool.CreateUnit("疾行僵尸", val25, val24, val4);
ApplyMinotaurVocals(val44);
val44.forceCost = 150u;
val44.health = 140f;
val44.damageMultiplier *= 1.5f;
val44.movementSpeedMuiltiplier = 3f;
val44.maxSizeRandom = 0.89f;
val44.minSizeRandom = 0.8f;
val44.turnSpeed = float.MaxValue;
val44.holdinigWithTwoHands = false;
val44.RightWeapon = UPool.MyPool.GetObject("僵尸之爪");
val44.LeftWeapon = UPool.MyPool.GetObject("僵尸之爪");
}
private static void ApplyMinotaurVocals(UnitBlueprint unit)
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
if ((Object)(object)unit == (Object)null)
{
return;
}
try
{
UnitBlueprint val = (UnitBlueprint)SLMALoader.SDic["blueprints"]["UNIT_ANCIENT_MINOTAUR"];
if ((Object)(object)val == (Object)null)
{
Debug.LogWarning((object)"[Zombie] UNIT_ANCIENT_MINOTAUR blueprint was not found.");
return;
}
string text = (string)s.GetField<UnitBlueprint>(val, "vocalRef");
string text2 = (string)s.GetField<UnitBlueprint>(val, "deathRef");
if (!string.IsNullOrEmpty(text))
{
s.SetField<UnitBlueprint>(unit, "vocalRef", (object)(text + "(p=.7)"));
}
if (!string.IsNullOrEmpty(text2))
{
s.SetField<UnitBlueprint>(unit, "deathRef", (object)(text2 + "(p=.7)"));
}
unit.voiceBundle = null;
}
catch (Exception ex)
{
Debug.LogWarning((object)("[Zombie] Failed to apply Minotaur vocals: " + ex.Message));
}
}
private static void SetZombieTag(GameObject go)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
CharacterItem componentInChildren = go.GetComponentInChildren<CharacterItem>();
if ((Object)(object)componentInChildren != (Object)null)
{
componentInChildren.tags = new List<Tag>
{
new Tag((TagType)0, "Zombie")
};
}
}
private static void StripVampirebiteDamageChildren(GameObject biteMove)
{
try
{
CollisionWeapon[] componentsInChildren = biteMove.GetComponentsInChildren<CollisionWeapon>(true);
for (int i = 0; i < componentsInChildren.Length; i++)
{
Object.Destroy((Object)(object)componentsInChildren[i]);
}
Component[] componentsInChildren2 = biteMove.GetComponentsInChildren<Component>(true);
Component[] array = componentsInChildren2;
foreach (Component val in array)
{
if ((Object)(object)val != (Object)null && ((object)val).GetType().Name == "MoveCollisionWeapon")
{
Object.Destroy((Object)(object)val);
}
}
CollisionSound[] componentsInChildren3 = biteMove.GetComponentsInChildren<CollisionSound>(true);
for (int k = 0; k < componentsInChildren3.Length; k++)
{
Object.Destroy((Object)(object)componentsInChildren3[k]);
}
}
catch (Exception ex)
{
Debug.LogWarning((object)("[Zombie] StripVampirebiteDamageChildren 异常: " + ex.Message));
}
}
public static Sprite LoadIcon(string fileName)
{
Sprite val = LoadEmbeddedIcon(fileName);
if ((Object)(object)val == (Object)null)
{
Debug.LogWarning((object)("[Zombie] Embedded icon could not be loaded: " + fileName));
}
return val;
}
private static Sprite LoadEmbeddedIcon(string fileName)
{
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Expected O, but got Unknown
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
try
{
Assembly assembly = typeof(UManager).Assembly;
string name = "Zombie.Icons." + fileName + ".png";
Stream manifestResourceStream = assembly.GetManifestResourceStream(name);
if (manifestResourceStream == null)
{
string value = ".Icons." + fileName + ".png";
string[] manifestResourceNames = assembly.GetManifestResourceNames();
for (int i = 0; i < manifestResourceNames.Length; i++)
{
if (manifestResourceNames[i].EndsWith(value, StringComparison.OrdinalIgnoreCase))
{
name = manifestResourceNames[i];
break;
}
}
manifestResourceStream = assembly.GetManifestResourceStream(name);
}
if (manifestResourceStream == null)
{
string value2 = fileName + ".png";
string[] manifestResourceNames2 = assembly.GetManifestResourceNames();
for (int j = 0; j < manifestResourceNames2.Length; j++)
{
if (manifestResourceNames2[j].EndsWith(value2, StringComparison.OrdinalIgnoreCase))
{
name = manifestResourceNames2[j];
manifestResourceStream = assembly.GetManifestResourceStream(name);
break;
}
}
}
if (manifestResourceStream == null)
{
Debug.LogWarning((object)("[Zombie] Icon resource not found in assembly: " + fileName));
return null;
}
using (manifestResourceStream)
{
byte[] array = new byte[manifestResourceStream.Length];
manifestResourceStream.Read(array, 0, array.Length);
Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
if (!ImageConversion.LoadImage(val, array))
{
Debug.LogWarning((object)("[Zombie] Failed to decode icon: " + fileName));
Object.Destroy((Object)(object)val);
return null;
}
((Texture)val).filterMode = (FilterMode)1;
return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
}
}
catch (Exception ex)
{
Debug.LogWarning((object)("[Zombie] Icon load failed for " + fileName + ": " + ex.Message));
return null;
}
}
private static void AddTransl(string key, string trans)
{
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
try
{
Dictionary<int, Language> dictionary = new Dictionary<int, Language>
{
{
0,
(Language)7
},
{
1,
(Language)0
},
{
2,
(Language)8
},
{
3,
(Language)3
},
{
4,
(Language)1
},
{
5,
(Language)6
},
{
6,
(Language)4
},
{
7,
(Language)2
}
};
Dictionary<Language, Dictionary<string, string>> dictionary2 = (Dictionary<Language, Dictionary<string, string>>)typeof(Localizer).GetField("m_localization", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null);
string[] array = trans.Split(new string[1] { "#" }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < dictionary.Count && i < array.Length; i++)
{
if (dictionary2.TryGetValue(dictionary[i], out var value) && !value.ContainsKey(key))
{
value.Add(key, array[i]);
}
}
}
catch (Exception ex)
{
Debug.LogWarning((object)("[Zombie] 翻译注册失败 " + key + ": " + ex.Message));
}
}
private static void RegisterTranslations()
{
AddTransl("Zombie", "僵尸#Zombie#ゾンビ#Zombie#Zombie#Зомби#Zombi#Zombi");
AddTransl("僵尸", "僵尸#Zombie#ゾンビ#Zombie#Zombie#Зомби#Zombi#Zombi");
AddTransl("疾行僵尸", "疾行僵尸#Fast Zombie#疾走ゾンビ#Schneller Zombie#Zombie rapide#Быстрый зомби#Zombi rápido#Zombi veloce");
AddTransl("飞行僵尸", "飞行僵尸#Fly Zombie#飛行ゾンビ#Fliegender Zombie#Zombie volant#Летающий зомби#Zombi volador#Zombi volante");
AddTransl("骷髅僵尸", "骷髅僵尸#Skeleton Zombie#スケルトンゾンビ#Skelett-Zombie#Zombie squelette#Скелет-зомби#Zombi esqueleto#Zombi scheletro");
AddTransl("巨型僵尸", "巨型僵尸#Giant Zombie#巨大ゾンビ#Riesen-Zombie#Zombie géant#Гигантский зомби#Zombi gigante#Zombi gigante");
AddTransl("僵尸母体", "僵尸母体#Zombie Mother#ゾンビマザー#Zombie-Mutter#Mère zombie#Мать зомби#Madre zombi#Madre zombi");
AddTransl("飞行僵尸母体", "飞行僵尸母体#Fly Zombie Mother#飛行ゾンビマザー#Fliegende Zombie-Mutter#Mère zombie volante#Летающая мать зомби#Madre zombi voladora#Madre zombi volante");
AddTransl("僵尸之爪", "僵尸之爪#Zombie Claw#ゾンビの爪#Zombie-Klaue#Griffe de zombie#Коготь зомби#Garra de zombi#Artiglio di zombi");
AddTransl("僵尸重拳", "僵尸重拳#Zombie Smash#ゾンビ重撃#Zombie-Hieb#Coup de zombie#Удар зомби#Golpe de zombi#Pugno di zombi");
AddTransl("母体召唤枪", "母体召唤枪#Mother's Call#母体の呼び声#Ruf der Mutter#Appel de la mère#Зов матери#Llamada de la madre#Richiamo della madre");
AddTransl("僵尸撕咬", "僵尸撕咬#Zombie Bite#ゾンビバイト#Zombie-Biss#Morsure de zombie#Укус зомби#Mordisco de zombi#Morso di zombi");
AddTransl("僵尸之翼", "僵尸之翼#Zombie Wings#ゾンビの翼#Zombie-Flügel#Ailes de zombie#Крылья зомби#Alas de zombi#Ali di zombi");
}
}
public class SkeletonZombieColor : MonoBehaviour
{
public static Material GreenMaterial;
private void Awake()
{
Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(true);
bool[] array = new bool[componentsInChildren.Length];
for (int i = 0; i < componentsInChildren.Length; i++)
{
if ((Object)(object)componentsInChildren[i] != (Object)null)
{
array[i] = componentsInChildren[i].enabled;
componentsInChildren[i].enabled = false;
}
}
ApplyZombieGreen();
for (int j = 0; j < componentsInChildren.Length; j++)
{
if ((Object)(object)componentsInChildren[j] != (Object)null)
{
componentsInChildren[j].enabled = array[j];
}
}
}
private void ApplyZombieGreen()
{
if ((Object)(object)GreenMaterial == (Object)null)
{
Debug.LogWarning((object)"[Zombie] Skeleton Zombie green material was not captured.");
return;
}
Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(true);
Dictionary<Material, int> dictionary = new Dictionary<Material, int>();
Dictionary<Renderer, Material[]> dictionary2 = new Dictionary<Renderer, Material[]>();
foreach (Renderer val in componentsInChildren)
{
if ((Object)(object)val == (Object)null)
{
continue;
}
Material[] sharedMaterials = val.sharedMaterials;
if (sharedMaterials == null)
{
continue;
}
dictionary2[val] = (Material[])sharedMaterials.Clone();
foreach (Material val2 in sharedMaterials)
{
if (!((Object)(object)val2 == (Object)null))
{
if (dictionary.ContainsKey(val2))
{
dictionary[val2]++;
}
else
{
dictionary.Add(val2, 1);
}
}
}
}
Material val3 = null;
int num = 0;
foreach (KeyValuePair<Material, int> item in dictionary)
{
if (item.Value > num)
{
num = item.Value;
val3 = item.Key;
}
}
if ((Object)(object)val3 == (Object)null)
{
Debug.LogWarning((object)"[Zombie] Could not identify Stiffy body material.");
return;
}
foreach (KeyValuePair<Renderer, Material[]> item2 in dictionary2)
{
Renderer key = item2.Key;
Material[] value = item2.Value;
Material[] array = (Material[])value.Clone();
bool flag = false;
for (int k = 0; k < array.Length; k++)
{
if ((Object)(object)array[k] == (Object)(object)val3)
{
array[k] = GreenMaterial;
flag = true;
}
}
if (flag)
{
key.sharedMaterials = array;
}
}
Debug.Log((object)"[Zombie] Applied green only to Stiffy body material slots; eye/sclera slots were preserved.");
}
}
namespace Zombie;
public class ZombieVoiceOverride : MonoBehaviour
{
private const string MinotaurVocalRef = "Ancient Attack Vocals/Minotaur";
private bool applied;
private void Start()
{
((MonoBehaviour)this).StartCoroutine(ApplyWhenReady());
}
private IEnumerator ApplyWhenReady()
{
yield return null;
float elapsed = 0f;
while (!applied && elapsed < 5f)
{
ApplyMinotaurVocal();
if (applied)
{
yield break;
}
yield return (object)new WaitForSeconds(0.1f);
elapsed += 0.1f;
}
if (!applied)
{
Debug.LogWarning((object)("[Zombie] Could not find/apply UnitSounds for Minotaur vocals on " + ((Object)((Component)this).gameObject).name));
}
}
private void ApplyMinotaurVocal()
{
UnitSounds componentInChildren = ((Component)this).GetComponentInChildren<UnitSounds>(true);
if ((Object)(object)componentInChildren == (Object)null)
{
return;
}
try
{
AudioPathData val = null;
AudioPathData.ValidateAndAssignPathData("Ancient Attack Vocals/Minotaur", ref val, (Object)null);
if (val == null)
{
Debug.LogWarning((object)"[Zombie] Failed to resolve Minotaur vocal path: Ancient Attack Vocals/Minotaur");
return;
}
componentInChildren.VocalPathData = val;
applied = true;
Debug.Log((object)("[Zombie] Minotaur VocalPathData applied to spawned zombie: " + ((Object)((Component)this).gameObject).name));
}
catch (Exception ex)
{
Debug.LogWarning((object)("[Zombie] Error applying Minotaur VocalPathData: " + ex.Message));
}
}
}
public class Zombification : UnitEffectBase
{
private static readonly List<GameObject> blacklist = new List<GameObject> { (GameObject)SLMALoader.SDic["bases"]["Stiffy"] };
private Unit unit;
private readonly List<Tuple<Material, Color>> tuplist = new List<Tuple<Material, Color>>();
private float infectionRate = 1.5f;
private Color infectionColor;
private bool infectionStarted;
private float infectionProgress;
public float infectionDuration = 15f;
private float infectionRoof;
private bool canBeInfected = true;
private bool dying;
private bool conversionStarted;
private string DeathRef = "";
private string VocalRef = "";
private UnityAction deathAction;
public Zombification()
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Expected O, but got Unknown
deathAction = new UnityAction(OnInfectedDeath);
}
public static Zombification ConvenientInstance(float infectionPower = 5f)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
Zombification zombification = new GameObject
{
hideFlags = (HideFlags)61
}.AddComponent<Zombification>();
zombification.infectionRate = infectionPower;
return zombification;
}
public override void DoEffect()
{
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0232: Unknown result type (might be due to invalid IL or missing references)
unit = ((Component)((Component)this).transform.root).GetComponent<Unit>();
if ((Object)(object)unit == (Object)null || (Object)(object)unit.unitBlueprint == (Object)null || (Object)(object)unit.unitBlueprint.UnitBase == (Object)null || blacklist.Contains(unit.unitBlueprint.UnitBase) || (Object)(object)unit.data == (Object)null)
{
canBeInfected = false;
}
else
{
if (canBeInfected && infectionRoof > 0f && tuplist.Count > 0)
{
return;
}
canBeInfected = true;
dying = false;
conversionStarted = false;
infectionStarted = false;
infectionProgress = 0f;
tuplist.Clear();
infectionColor = Color32.op_Implicit(new Color32((byte)120, (byte)170, (byte)50, byte.MaxValue));
infectionRoof = Mathf.Max(unit.data.maxHealth / 2.5f, 1f);
if ((Object)(object)unit.data.healthHandler != (Object)null)
{
unit.data.healthHandler.deathEvent.RemoveListener(deathAction);
unit.data.healthHandler.deathEvent.AddListener(deathAction);
}
SkinnedMeshRenderer[] componentsInChildren = ((Component)unit).GetComponentsInChildren<SkinnedMeshRenderer>();
SkinnedMeshRenderer[] componentsInChildren2 = unit.unitBlueprint.UnitBase.GetComponentsInChildren<SkinnedMeshRenderer>();
SkinnedMeshRenderer[] array = componentsInChildren;
foreach (SkinnedMeshRenderer val in array)
{
SkinnedMeshRenderer[] array2 = componentsInChildren2;
foreach (SkinnedMeshRenderer val2 in array2)
{
if (((Object)val).name != ((Object)val2).name)
{
continue;
}
Material[] materials = ((Renderer)val).materials;
Material[] array3 = materials;
foreach (Material val3 in array3)
{
if ((Object)(object)val3 != (Object)null)
{
tuplist.Add(Tuple.Create<Material, Color>(val3, val3.color));
}
}
break;
}
}
Debug.Log((object)("[Zombie] Infection initialized on " + ((Object)((Component)unit).gameObject).name + " roof=" + infectionRoof + " rate=" + infectionRate));
}
}
public override void Ping()
{
if (canBeInfected && !((Object)(object)unit == (Object)null) && !((Object)(object)unit.data == (Object)null) && !unit.data.Dead && !(infectionRoof <= 0f) && !dying)
{
infectionStarted = true;
Debug.Log((object)("[Zombie] Infection started: " + ((Object)((Component)unit).gameObject).name));
}
}
private void Update()
{
if ((Object)(object)unit == (Object)null)
{
unit = ((Component)((Component)this).transform.root).GetComponent<Unit>();
}
if (!canBeInfected || (Object)(object)unit == (Object)null || (Object)(object)unit.data == (Object)null)
{
return;
}
if (!unit.data.Dead && !dying && infectionStarted)
{
infectionProgress += Time.deltaTime / Mathf.Max(infectionDuration, 0.01f);
infectionProgress = Mathf.Clamp01(infectionProgress);
LerpColors(infectionProgress);
if (infectionProgress >= 1f)
{
FinishInfection();
}
}
else if (dying && unit.data.Dead && !conversionStarted)
{
BeginConversion();
}
}
private void FinishInfection()
{
if (!dying && canBeInfected && !((Object)(object)unit == (Object)null) && !((Object)(object)unit.data == (Object)null))
{
dying = true;
infectionProgress = 1f;
LerpColors(1f);
Debug.Log((object)("[Zombie] Infection complete; killing " + ((Object)((Component)unit).gameObject).name));
Scream(unit, death: true);
unit.data.healthHandler.Die((Unit)null);
}
}
private void OnInfectedDeath()
{
if (dying && !conversionStarted)
{
BeginConversion();
}
}
private void BeginConversion()
{
if (!conversionStarted && !((Object)(object)unit == (Object)null))
{
conversionStarted = true;
((MonoBehaviour)this).StartCoroutine(OnDeathConvert());
}
}
private void LerpColors(float progress)
{
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
if (tuplist == null || tuplist.Count == 0)
{
return;
}
progress = Mathf.Clamp01(progress);
float num = Mathf.SmoothStep(0f, 1f, progress);
foreach (Tuple<Material, Color> item in tuplist)
{
if ((Object)(object)item.Item1 != (Object)null)
{
item.Item1.color = Color.Lerp(item.Item2, infectionColor, num);
}
}
}
private void Scream(Unit target, bool death = false)
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
try
{
UnitSounds componentInChildren = ((Component)target).GetComponentInChildren<UnitSounds>();
if ((Object)(object)componentInChildren != (Object)null)
{
if (death)
{
componentInChildren.PlayDeathSound(100f, target.data.mainRig.position);
}
else
{
componentInChildren.PlayVocalSound(4, 100f, target.data.mainRig.position);
}
}
}
catch (NullReferenceException)
{
}
}
private void Start()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
try
{
UnitBlueprint val = (UnitBlueprint)SLMALoader.SDic["blueprints"]["UNIT_ANCIENT_MINOTAUR"];
DeathRef = (string)s.GetField<UnitBlueprint>(val, "deathRef");
VocalRef = (string)s.GetField<UnitBlueprint>(val, "vocalRef");
}
catch (Exception)
{
}
}
private void OnDestroy()
{
if ((Object)(object)unit != (Object)null && (Object)(object)unit.data != (Object)null && (Object)(object)unit.data.healthHandler != (Object)null)
{
unit.data.healthHandler.deathEvent.RemoveListener(deathAction);
}
}
private IEnumerator OnDeathConvert()
{
yield return (object)new WaitForSeconds(Random.Range(2f, 5f));
if ((Object)(object)unit == (Object)null || (Object)(object)unit.data == (Object)null)
{
yield break;
}
if ((Object)(object)unit.WeaponHandler != (Object)null)
{
if ((Object)(object)unit.WeaponHandler.rightWeapon != (Object)null)
{
((Component)unit.WeaponHandler.rightWeapon).transform.SetParent((Transform)null);
}
if ((Object)(object)unit.WeaponHandler.leftWeapon != (Object)null)
{
((Component)unit.WeaponHandler.leftWeapon).transform.SetParent((Transform)null);
}
}
UnitBlueprint unitBlueprint = Object.Instantiate<UnitBlueprint>(unit.unitBlueprint);
unitBlueprint.Mount = null;
s.SetField<UnitBlueprint>(unitBlueprint, "Riders", (object)new UnitBlueprint[0]);
unitBlueprint.MovementComponents = new List<IMovementComponent> { (IMovementComponent)(object)default(KeepPreferredDistance) };
unitBlueprint.TargetingComponent = (ITargetingComponent)(object)default(EnemyLeastWeightTargeting);
s.SetField<UnitBlueprint>(unitBlueprint, "deathRef", (object)DeathRef);
s.SetField<UnitBlueprint>(unitBlueprint, "vocalRef", (object)VocalRef);
unitBlueprint.health = unit.unitBlueprint.health * 0.35f;
unitBlueprint.holdinigWithTwoHands = unitBlueprint.holdinigWithTwoHands;
if ((Object)(object)UManager.ZombieBiteMove != (Object)null)
{
if (unitBlueprint.objectsToSpawnAsChildren == null)
{
unitBlueprint.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[1] { UManager.ZombieBiteMove };
}
else if (!unitBlueprint.objectsToSpawnAsChildren.Contains(UManager.ZombieBiteMove))
{
List<GameObject> list = unitBlueprint.objectsToSpawnAsChildren.ToList();
list.Add(UManager.ZombieBiteMove);
unitBlueprint.objectsToSpawnAsChildren = list.ToArray();
}
}
unitBlueprint.UnitBase = unit.unitBlueprint.UnitBase;
unitBlueprint.RightWeapon = UPool.MyPool.GetObject("僵尸之爪");
unitBlueprint.LeftWeapon = UPool.MyPool.GetObject("僵尸之爪");
unitBlueprint.m_props = unit.unitBlueprint.m_props;
GameObject gameObject = unitBlueprint.Spawn(unit.data.mainRig.position + Vector3.up * 1000f, unit.data.mainRig.rotation, OppositeTeam(unit.Team), 1f, (UnitPoolInfo?)null)[0];
Unit component = gameObject.GetComponent<Unit>();
UnitSounds zombieSounds = gameObject.GetComponentInChildren<UnitSounds>();
if ((Object)(object)zombieSounds != (Object)null && !string.IsNullOrEmpty(VocalRef))
{
try
{
AudioPathData minotaurVocal = null;
AudioPathData.ValidateAndAssignPathData(VocalRef, ref minotaurVocal, (Object)null);
if (minotaurVocal != null)
{
zombieSounds.VocalPathData = minotaurVocal;
Debug.Log((object)("[Zombie] Applied Minotaur VocalPathData: " + VocalRef));
}
else
{
Debug.LogWarning((object)("[Zombie] Failed to resolve Minotaur VocalRef: " + VocalRef));
}
}
catch (Exception ex)
{
Debug.LogWarning((object)("[Zombie] Error applying Minotaur vocal: " + ex));
}
}
else
{
Debug.LogWarning((object)("[Zombie] Could not apply Minotaur vocal. UnitSounds=" + ((Object)(object)zombieSounds != (Object)null) + " VocalRef=" + VocalRef));
}
SkinnedMeshRenderer[] componentsInChildren = gameObject.GetComponentsInChildren<SkinnedMeshRenderer>();
SkinnedMeshRenderer[] array = componentsInChildren;
foreach (SkinnedMeshRenderer skinnedMeshRenderer in array)
{
SkinnedMeshRenderer[] componentsInChildren2 = unit.unitBlueprint.UnitBase.GetComponentsInChildren<SkinnedMeshRenderer>();
SkinnedMeshRenderer[] array2 = componentsInChildren2;
foreach (SkinnedMeshRenderer skinnedMeshRenderer2 in array2)
{
List<Material> list2 = new List<Material>();
if (((Object)skinnedMeshRenderer).name == ((Object)skinnedMeshRenderer2).name)
{
Material zombieMaterial = new Material(((Renderer)skinnedMeshRenderer).material);
zombieMaterial.color = Color32.op_Implicit(new Color32((byte)120, (byte)170, (byte)50, byte.MaxValue));
for (int k = 0; k < ((Renderer)skinnedMeshRenderer).materials.Length; k++)
{
list2.Add(zombieMaterial);
}
((Renderer)skinnedMeshRenderer).materials = list2.ToArray();
TeamColor teamColor = ((Component)skinnedMeshRenderer).GetComponentInChildren<TeamColor>();
if ((Object)(object)teamColor != (Object)null)
{
teamColor.blueMaterial = zombieMaterial;
teamColor.redMaterial = zombieMaterial;
}
}
}
}
TeamColor[] componentsInChildren3 = gameObject.GetComponentsInChildren<TeamColor>();
for (int l = 0; l < componentsInChildren3.Length; l++)
{
componentsInChildren3[l].SetTeamColor(unit.Team);
}
Rigidbody[] allRigs = unit.data.allRigs.AllRigs;
Rigidbody[] allRigs2 = component.data.allRigs.AllRigs;
((Component)unit).GetComponentsInChildren<Rigidbody>();
gameObject.transform.localScale = ((Component)unit).transform.localScale;
for (int m = 0; m < allRigs2.Length; m++)
{
((Component)allRigs2[m]).transform.localScale = ((Component)allRigs[m]).transform.localScale;
((Component)allRigs2[m]).transform.position = ((Component)allRigs[m]).transform.position;
((Component)allRigs2[m]).transform.rotation = ((Component)allRigs[m]).transform.rotation;
allRigs2[m].velocity = allRigs[m].velocity;
}
component.data.fallTime = 0.3f;
Scream(component);
Object.Destroy((Object)(object)((Component)unit).gameObject);
}
public Team OppositeTeam(Team originalTeam)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Invalid comparison between Unknown and I4
//IL_0011: 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)
if ((int)originalTeam != 0)
{
if ((int)originalTeam == 1)
{
return (Team)0;
}
return (Team)0;
}
return (Team)1;
}
}