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 PlayBiteVocal()
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
try
{
UnitSounds componentInChildren = ((Component)((Component)this).transform.root).GetComponentInChildren<UnitSounds>();
if ((Object)(object)componentInChildren != (Object)null && (Object)(object)data != (Object)null && (Object)(object)data.mainRig != (Object)null)
{
componentInChildren.PlayVocalSound(4, 100f, data.mainRig.position);
}
}
catch
{
}
}
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();
PlayBiteVocal();
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_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Expected O, but got Unknown
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: Expected O, but got Unknown
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01eb: Expected O, but got Unknown
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_0214: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_0221: Unknown result type (might be due to invalid IL or missing references)
//IL_0235: Unknown result type (might be due to invalid IL or missing references)
//IL_024a: Expected O, but got Unknown
//IL_026b: Unknown result type (might be due to invalid IL or missing references)
//IL_0272: Expected O, but got Unknown
//IL_027c: Unknown result type (might be due to invalid IL or missing references)
//IL_0281: Unknown result type (might be due to invalid IL or missing references)
//IL_0283: Unknown result type (might be due to invalid IL or missing references)
//IL_0288: Unknown result type (might be due to invalid IL or missing references)
//IL_0293: Unknown result type (might be due to invalid IL or missing references)
//IL_0295: Unknown result type (might be due to invalid IL or missing references)
//IL_029b: Expected O, but got Unknown
//IL_029d: Unknown result type (might be due to invalid IL or missing references)
//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
//IL_02af: Unknown result type (might be due to invalid IL or missing references)
//IL_02b5: Expected O, but got Unknown
//IL_0311: Unknown result type (might be due to invalid IL or missing references)
//IL_0321: Expected O, but got Unknown
//IL_0336: Unknown result type (might be due to invalid IL or missing references)
//IL_033b: Unknown result type (might be due to invalid IL or missing references)
//IL_0340: Unknown result type (might be due to invalid IL or missing references)
//IL_054c: Unknown result type (might be due to invalid IL or missing references)
//IL_0561: Expected O, but got Unknown
//IL_060f: Unknown result type (might be due to invalid IL or missing references)
//IL_0614: Unknown result type (might be due to invalid IL or missing references)
//IL_0625: Unknown result type (might be due to invalid IL or missing references)
//IL_062f: Unknown result type (might be due to invalid IL or missing references)
//IL_0634: Unknown result type (might be due to invalid IL or missing references)
//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
//IL_03cb: Expected O, but got Unknown
//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
//IL_079e: Unknown result type (might be due to invalid IL or missing references)
//IL_07ae: Expected O, but got Unknown
//IL_0a22: Unknown result type (might be due to invalid IL or missing references)
//IL_0a32: Expected O, but got Unknown
//IL_0b88: Unknown result type (might be due to invalid IL or missing references)
//IL_0b9d: Expected O, but got Unknown
//IL_0cb5: Unknown result type (might be due to invalid IL or missing references)
//IL_0cc5: Expected O, but got Unknown
//IL_0d42: Unknown result type (might be due to invalid IL or missing references)
//IL_0d57: Expected O, but got Unknown
//IL_0d92: Unknown result type (might be due to invalid IL or missing references)
//IL_0da7: Expected O, but got Unknown
//IL_0888: Unknown result type (might be due to invalid IL or missing references)
//IL_088f: Expected O, but got Unknown
//IL_0891: Unknown result type (might be due to invalid IL or missing references)
//IL_08b3: Unknown result type (might be due to invalid IL or missing references)
//IL_0e04: Unknown result type (might be due to invalid IL or missing references)
//IL_0e14: Expected O, but got Unknown
//IL_08d6: Unknown result type (might be due to invalid IL or missing references)
//IL_0bf7: Unknown result type (might be due to invalid IL or missing references)
//IL_0bfe: Expected O, but got Unknown
//IL_0c00: Unknown result type (might be due to invalid IL or missing references)
//IL_0e66: Unknown result type (might be due to invalid IL or missing references)
//IL_0e6d: Expected O, but got Unknown
//IL_0e6f: Unknown result type (might be due to invalid IL or missing references)
//IL_0f05: Unknown result type (might be due to invalid IL or missing references)
//IL_0f0c: Expected O, but got Unknown
//IL_0f0e: 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_crawling_zombie");
Sprite val6 = LoadIcon("unit_fly_zombie");
Sprite val7 = LoadIcon("unit_giant_zombie");
Sprite val8 = LoadIcon("unit_mother");
Sprite val9 = LoadIcon("unit_fly_mother");
Sprite val10 = LoadIcon("weapon_claw");
Sprite val11 = LoadIcon("weapon_punch");
Sprite val12 = LoadIcon("weapon_harpoon");
Sprite val13 = LoadIcon("ability_bite");
Sprite val14 = LoadIcon("ability_wings");
GameObject val15 = UPool.MyPool.AddObject("僵尸撕咬", (GameObject)SLMALoader.SDic["moves"]["Vampirebite"], true, (HideFlags)52, val13, 48970001, true);
SetZombieTag(val15);
DodgeMove component = val15.GetComponent<DodgeMove>();
CombatMoveDataInstance obj = component.moves[0];
obj.force /= 3f;
component.moves[0].forceDirection = (ForceDirection)1;
DodgeMove val16 = val15.AddComponent<DodgeMove>();
((Object)val16).hideFlags = (HideFlags)61;
val16.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 val17 = val15.AddComponent<DodgeMove>();
((Object)val17).hideFlags = (HideFlags)61;
val17.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 val18 = val15.AddComponent<DodgeMove>();
((Object)val18).hideFlags = (HideFlags)61;
val18.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)val15.GetComponent<VapireBite>());
ConditionalEvent component2 = val15.GetComponent<ConditionalEvent>();
ConditionalEventInstance[] array = new ConditionalEventInstance[1];
ConditionalEventInstance val19 = new ConditionalEventInstance();
val19.conditions = (EventCondition[])(object)new EventCondition[2]
{
new EventCondition
{
valueType = (ValueType)1,
value = 1f,
conditionType = (ConditionType)1
},
new EventCondition
{
value = 1.1f,
conditionType = (ConditionType)0
}
};
val19.moves = (Move[])(object)new Move[3]
{
(Move)component,
(Move)val17,
(Move)val16
};
array[0] = val19;
component2.events = (ConditionalEventInstance[])(object)array;
StripVampirebiteDamageChildren(val15);
ZombieBiteMove = val15;
Unit component3 = UPool.MyPool.AddObject("僵尸", (GameObject)SLMALoader.SDic["bases"]["Humanoid"], true, (HideFlags)52, (Sprite)null, 0, false).GetComponent<Unit>();
Color val20 = 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 val21 in componentsInChildren)
{
if ((Object)(object)val21 == (Object)null)
{
continue;
}
Material[] materials = val21.materials;
for (int j = 0; j < materials.Length; j++)
{
if (!((Object)(object)materials[j] == (Object)null))
{
Material val22 = new Material(materials[j]);
val22.color = val20;
materials[j] = val22;
}
}
val21.materials = materials;
TeamColor val23 = ((Component)val21).GetComponent<TeamColor>();
if ((Object)(object)val23 == (Object)null)
{
val23 = ((Component)val21).gameObject.AddComponent<TeamColor>();
}
if (materials.Length != 0)
{
val23.redMaterial = materials[0];
val23.blueMaterial = materials[0];
}
}
Material greenMaterial = null;
Renderer[] componentsInChildren2 = ((Component)component3).gameObject.GetComponentsInChildren<Renderer>(true);
for (int k = 0; k < componentsInChildren2.Length; k++)
{
Renderer val24 = componentsInChildren2[k];
if ((Object)(object)val24 != (Object)null && val24.sharedMaterials != null && val24.sharedMaterials.Length != 0 && (Object)(object)val24.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 val25 = UPool.MyPool.AddObject("僵尸之爪", (GameObject)SLMALoader.SDic["weapons"]["MinoTaurGrab"], true, (HideFlags)52, val10, 48970002, true);
SetZombieTag(val25);
((Weapon)val25.GetComponent<MeleeWeapon>()).internalCooldown = 1f;
MeleeWeapon component5 = val25.GetComponent<MeleeWeapon>();
component5.curveForce *= 0.8f;
val25.GetComponent<MeleeWeapon>().canDealDamageOutSideOfSwing = true;
val25.GetComponentInChildren<Holdable>().ignoreDissarm = false;
val25.GetComponent<CollisionWeapon>().ignoreTeamMates = true;
val25.GetComponent<CollisionWeapon>().damage = 0f;
ZombieBite zombieBite = val25.AddComponent<ZombieBite>();
zombieBite.effect = ((Component)Zombification.ConvenientInstance()).GetComponent<UnitEffectBase>();
zombieBite.infectionCooldown = 0.5f;
zombieBite.infectionDistance = 1f;
val25.GetComponent<Holdable>().holdableData.forwardRotation = Vector3.right;
val25.GetComponent<Holdable>().holdableData.relativePosition = Vector3.forward * 0.3f;
val25.GetComponent<Holdable>().holdableData.lookAtTargetWhenWithin = 3f;
Renderer[] componentsInChildren3 = val25.GetComponentsInChildren<Renderer>();
for (int l = 0; l < componentsInChildren3.Length; l++)
{
componentsInChildren3[l].enabled = false;
}
Faction val26 = SLMATool.CreateFaction("Zombie", (UnitBlueprint[])null, val2, 48974896);
UnitBlueprint val27 = SLMATool.CreateUnit("僵尸", (UnitBlueprint)null, val26, val3);
ApplyMinotaurVocals(val27);
val27.forceCost = 100u;
val27.health = 120f;
val27.damageMultiplier = 2.5f;
val27.maxSizeRandom = 1f;
val27.minSizeRandom = 1f;
val27.UnitBase = UPool.MyPool.GetObject("僵尸");
val27.movementSpeedMuiltiplier = 1f;
val27.turnSpeed = float.MaxValue;
val27.holdinigWithTwoHands = false;
val27.RightWeapon = UPool.MyPool.GetObject("僵尸之爪");
val27.LeftWeapon = UPool.MyPool.GetObject("僵尸之爪");
val27.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[1] { val15 };
MotherSummon.ZombieBlueprint = val27;
UnitBlueprint val28 = SLMATool.CreateUnit("骷髅僵尸", val27, val26, val3);
ApplyMinotaurVocals(val28);
GameObject val29 = (val28.UnitBase = UPool.MyPool.AddObject("骷髅僵尸基础", (GameObject)SLMALoader.SDic["bases"]["Stiffy"], true, (HideFlags)52, (Sprite)null, 0, false));
ApplyMinotaurVocals(val28);
if ((Object)(object)val29.GetComponent<ZombieVoiceOverride>() == (Object)null)
{
val29.AddComponent<ZombieVoiceOverride>();
}
UnitRig component6 = val29.GetComponent<UnitRig>();
if ((Object)(object)component6 != (Object)null && component6.boneTransforms != null)
{
for (int m = 0; m < component6.boneTransforms.Length; m++)
{
Transform val31 = component6.boneTransforms[m];
if ((Object)(object)val31 == (Object)null)
{
continue;
}
Renderer[] componentsInChildren4 = ((Component)val31).GetComponentsInChildren<Renderer>(true);
foreach (Renderer val32 in componentsInChildren4)
{
if ((Object)(object)val32 == (Object)null)
{
continue;
}
Material[] materials2 = val32.materials;
for (int num = 0; num < materials2.Length; num++)
{
if (!((Object)(object)materials2[num] == (Object)null))
{
Material val33 = new Material(materials2[num]);
val33.color = val20;
if (val33.HasProperty("_Color"))
{
val33.SetColor("_Color", val20);
}
if (val33.HasProperty("_BaseColor"))
{
val33.SetColor("_BaseColor", val20);
}
materials2[num] = val33;
}
}
val32.materials = materials2;
}
}
}
if ((Object)(object)val29.GetComponent<SkeletonZombieColor>() == (Object)null)
{
val29.AddComponent<SkeletonZombieColor>();
}
val28.health = 120f;
val28.forceCost = 100u;
val28.RightWeapon = UPool.MyPool.GetObject("僵尸之爪");
val28.LeftWeapon = UPool.MyPool.GetObject("僵尸之爪");
List<GameObject> list = STools.ToList(val28.objectsToSpawnAsChildren);
if ((Object)(object)val15 != (Object)null && !list.Contains(val15))
{
list.Add(val15);
}
val28.objectsToSpawnAsChildren = list.ToArray();
UnitBlueprint val34 = SLMATool.CreateUnit("爬行僵尸", val27, val26, val5);
ApplyMinotaurVocals(val34);
GameObject val35 = UPool.MyPool.AddObject("爬行僵尸感染之爪", (GameObject)SLMALoader.SDic["weapons"]["MinoTaurGrab"], true, (HideFlags)52, (Sprite)null, 0, false);
SetZombieTag(val35);
CollisionWeapon component7 = val35.GetComponent<CollisionWeapon>();
if ((Object)(object)component7 != (Object)null)
{
component7.ignoreTeamMates = true;
component7.damage = 0f;
}
ZombieBite zombieBite2 = val35.GetComponent<ZombieBite>();
if ((Object)(object)zombieBite2 == (Object)null)
{
zombieBite2 = val35.AddComponent<ZombieBite>();
}
zombieBite2.effect = ((Component)Zombification.ConvenientInstance()).GetComponent<UnitEffectBase>();
zombieBite2.infectionCooldown = 0.5f;
zombieBite2.infectionDistance = 1f;
val34.RightWeapon = val35;
val34.LeftWeapon = val35;
GameObject val36 = UPool.MyPool.AddObject("爬行僵尸基础", val27.UnitBase, true, (HideFlags)52, (Sprite)null, 0, false);
CrawlingZombieController component8 = val36.GetComponent<CrawlingZombieController>();
if ((Object)(object)component8 == (Object)null)
{
component8 = val36.AddComponent<CrawlingZombieController>();
}
val34.UnitBase = val36;
val34.health = 500f;
val34.forceCost = 300u;
val34.animationMultiplier = 1f;
val34.movementSpeedMuiltiplier = 0.65f;
val34.balanceMultiplier = 2000f;
val34.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[1] { val15 };
GameObject val37 = UPool.MyPool.AddObject("僵尸之翼", (GameObject)SLMALoader.SDic["moves"]["Wings"], true, (HideFlags)52, val14, 48970004, true);
SetZombieTag(val37);
SkinnedMeshRenderer[] componentsInChildren5 = val37.GetComponentsInChildren<SkinnedMeshRenderer>(true);
foreach (SkinnedMeshRenderer val38 in componentsInChildren5)
{
if ((Object)(object)val38 == (Object)null)
{
continue;
}
Material[] materials3 = ((Renderer)val38).materials;
for (int num3 = 0; num3 < materials3.Length; num3++)
{
if (!((Object)(object)materials3[num3] == (Object)null))
{
Material val39 = new Material(materials3[num3]);
val39.color = val20;
materials3[num3] = val39;
}
}
((Renderer)val38).materials = materials3;
}
UnitBlueprint val40 = SLMATool.CreateUnit("飞行僵尸", val27, val26, val6);
ApplyMinotaurVocals(val40);
val40.forceCost = 200u;
List<GameObject> list2 = STools.ToList(val40.objectsToSpawnAsChildren);
list2.Add(val37);
val40.objectsToSpawnAsChildren = list2.ToArray();
GameObject val41 = UPool.MyPool.AddObject("僵尸爆炸", (GameObject)SLMALoader.SDic["explosions"]["E_ExplosionIceGiant"], true, (HideFlags)52, (Sprite)null, 0, false);
Explosion componentInChildren = val41.GetComponentInChildren<Explosion>();
componentInChildren.damage *= 2f;
Explosion componentInChildren2 = val41.GetComponentInChildren<Explosion>();
componentInChildren2.radius *= 1.5f;
val41.GetComponentInChildren<Explosion>().ignoreTeamMates = true;
val41.AddComponent<ExplosionAddEffect>().EffectPrefab = ((Component)Zombification.ConvenientInstance()).GetComponent<UnitEffectBase>();
GameObject val42 = UPool.MyPool.AddObject("僵尸重拳", (GameObject)SLMALoader.SDic["weapons"]["GiantPunch"], true, (HideFlags)52, val11, 48970003, true);
SetZombieTag(val42);
val42.AddComponent<MeleeWeaponSpawn>().objectToSpawn = val41;
GameObject val43 = UPool.MyPool.AddObject("母体召唤枪", (GameObject)SLMALoader.SDic["weapons"]["HarpoonGun"], true, (HideFlags)52, val12, 48970005, true);
SetZombieTag(val43);
Renderer[] componentsInChildren6 = val43.GetComponentsInChildren<Renderer>();
for (int num4 = 0; num4 < componentsInChildren6.Length; num4++)
{
componentsInChildren6[num4].enabled = false;
}
GameObject val44 = UPool.MyPool.AddObject("感染鱼叉", (GameObject)SLMALoader.SDic["projectiles"]["P_Harpoon"], true, (HideFlags)52, (Sprite)null, 0, false);
MeshRenderer[] componentsInChildren7 = val44.GetComponentsInChildren<MeshRenderer>(true);
foreach (MeshRenderer val45 in componentsInChildren7)
{
if ((Object)(object)val45 == (Object)null)
{
continue;
}
Material[] materials4 = ((Renderer)val45).materials;
for (int num6 = 0; num6 < materials4.Length; num6++)
{
if (!((Object)(object)materials4[num6] == (Object)null))
{
Material val46 = new Material(materials4[num6]);
val46.color = val20;
materials4[num6] = val46;
}
}
((Renderer)val45).materials = materials4;
}
LineRenderer[] componentsInChildren8 = val44.GetComponentsInChildren<LineRenderer>(true);
foreach (LineRenderer val47 in componentsInChildren8)
{
if ((Object)(object)val47 == (Object)null)
{
continue;
}
Material[] materials5 = ((Renderer)val47).materials;
for (int num8 = 0; num8 < materials5.Length; num8++)
{
if (!((Object)(object)materials5[num8] == (Object)null))
{
Material val48 = new Material(materials5[num8]);
val48.color = val20;
materials5[num8] = val48;
}
}
((Renderer)val47).materials = materials5;
}
val43.GetComponent<RangeWeapon>().ObjectToSpawn = val44;
((Weapon)val43.GetComponent<RangeWeapon>()).internalCooldown = 2.5f;
((Weapon)val43.GetComponent<RangeWeapon>()).internalCounter = 2.5f;
UnitBlueprint val49 = SLMATool.CreateUnit("巨型僵尸", val27, val26, val7);
ApplyMinotaurVocals(val49);
val49.forceCost = 1000u;
val49.sizeMultiplier = 2f;
val49.maxSizeRandom = 3f;
val49.minSizeRandom = 2f;
val49.health = 750f;
val49.RightWeapon = UPool.MyPool.GetObject("僵尸重拳");
val49.LeftWeapon = UPool.MyPool.GetObject("僵尸重拳");
UnitBlueprint val50 = SLMATool.CreateUnit("僵尸母体", val27, val26, val8);
ApplyMinotaurVocals(val50);
val50.UnitBase = ((Component)component4).gameObject;
val50.RightWeapon = val43;
val50.LeftWeapon = val43;
val50.forceCost = 7000u;
val50.sizeMultiplier = 2f;
val50.health = 1000f;
UnitBlueprint val51 = SLMATool.CreateUnit("飞行僵尸母体", val27, val26, val9);
ApplyMinotaurVocals(val51);
val51.UnitBase = ((Component)component4).gameObject;
val51.RightWeapon = val43;
val51.LeftWeapon = val43;
val51.forceCost = 7000u;
val51.sizeMultiplier = 2f;
val51.health = 1000f;
List<GameObject> list3 = STools.ToList(val51.objectsToSpawnAsChildren);
list3.Add(val37);
val51.objectsToSpawnAsChildren = list3.ToArray();
UnitBlueprint val52 = SLMATool.CreateUnit("疾行僵尸", val27, val26, val4);
ApplyMinotaurVocals(val52);
val52.forceCost = 150u;
val52.health = 140f;
val52.damageMultiplier *= 1.5f;
val52.movementSpeedMuiltiplier = 3f;
val52.maxSizeRandom = 0.89f;
val52.minSizeRandom = 0.8f;
val52.turnSpeed = float.MaxValue;
val52.holdinigWithTwoHands = false;
val52.RightWeapon = UPool.MyPool.GetObject("僵尸之爪");
val52.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] 嵌入图标缺失: " + fileName));
}
return val;
}
private static Sprite LoadEmbeddedIcon(string fileName)
{
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Expected O, but got Unknown
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
try
{
Assembly assembly = typeof(UManager).Assembly;
string text = "Zombie.Icons." + fileName + ".png";
Stream manifestResourceStream = assembly.GetManifestResourceStream(text);
if (manifestResourceStream == null)
{
string text2 = fileName + ".png";
string[] manifestResourceNames = assembly.GetManifestResourceNames();
foreach (string text3 in manifestResourceNames)
{
if (text3.Equals(text, StringComparison.OrdinalIgnoreCase) || text3.EndsWith("." + text2, StringComparison.OrdinalIgnoreCase) || text3.EndsWith(text2, StringComparison.OrdinalIgnoreCase))
{
text = text3;
manifestResourceStream = assembly.GetManifestResourceStream(text);
break;
}
}
}
if (manifestResourceStream == null)
{
Debug.LogWarning((object)("[Zombie] Icon resource not found: " + 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: " + text));
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), 100f);
}
}
catch (Exception ex)
{
Debug.LogWarning((object)("[Zombie] Icon load error 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("爬行僵尸", "爬行僵尸#Crawling Zombie#這うゾンビ#Krabbelnder Zombie#Zombie rampant#Ползучий зомби#Zombi rastrero#Zombi strisciante");
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 bool greenApplied;
private int retryFrames;
private void Awake()
{
greenApplied = TryApplyZombieGreen();
}
private void OnEnable()
{
if (!greenApplied)
{
greenApplied = TryApplyZombieGreen();
}
}
private void Start()
{
if (!greenApplied)
{
greenApplied = TryApplyZombieGreen();
}
}
private void LateUpdate()
{
if (!greenApplied && retryFrames < 12)
{
retryFrames++;
greenApplied = TryApplyZombieGreen();
}
}
private bool TryApplyZombieGreen()
{
if ((Object)(object)GreenMaterial == (Object)null)
{
return false;
}
Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(true);
if (componentsInChildren == null || componentsInChildren.Length == 0)
{
return false;
}
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 || sharedMaterials.Length == 0)
{
continue;
}
dictionary2[val] = (Material[])sharedMaterials.Clone();
foreach (Material val2 in sharedMaterials)
{
if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2 == (Object)(object)GreenMaterial))
{
if (dictionary.ContainsKey(val2))
{
dictionary[val2]++;
}
else
{
dictionary.Add(val2, 1);
}
}
}
}
if (dictionary.Count == 0)
{
return dictionary2.Count > 0;
}
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)
{
return false;
}
bool result = false;
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;
result = true;
}
}
if (flag)
{
key.sharedMaterials = array;
}
}
return result;
}
}
public class CrawlingZombieController : MonoBehaviour
{
private Rigidbody[] bodies;
private Rigidbody pelvis;
private Rigidbody chest;
private Rigidbody head;
private Rigidbody leftUpperLeg;
private Rigidbody rightUpperLeg;
private Rigidbody leftLowerLeg;
private Rigidbody rightLowerLeg;
private Rigidbody leftArm;
private Rigidbody rightArm;
private Rigidbody leftForearm;
private Rigidbody rightForearm;
private void Awake()
{
bodies = ((Component)this).GetComponentsInChildren<Rigidbody>(true);
}
private void Start()
{
if (bodies == null || bodies.Length == 0)
{
bodies = ((Component)this).GetComponentsInChildren<Rigidbody>(true);
}
for (int i = 0; i < bodies.Length; i++)
{
Rigidbody val = bodies[i];
if (!((Object)(object)val == (Object)null))
{
string text = ((Object)val).name.ToLowerInvariant();
if ((Object)(object)pelvis == (Object)null && (text.Contains("pelvis") || text.Contains("hip")))
{
pelvis = val;
}
else if ((Object)(object)chest == (Object)null && (text.Contains("chest") || text.Contains("spine")))
{
chest = val;
}
else if ((Object)(object)head == (Object)null && text.Contains("head"))
{
head = val;
}
if ((Object)(object)leftUpperLeg == (Object)null && (text.Contains("leftupperleg") || text.Contains("l_thigh") || text.Contains("left thigh")))
{
leftUpperLeg = val;
}
else if ((Object)(object)rightUpperLeg == (Object)null && (text.Contains("rightupperleg") || text.Contains("r_thigh") || text.Contains("right thigh")))
{
rightUpperLeg = val;
}
else if ((Object)(object)leftLowerLeg == (Object)null && (text.Contains("leftlowerleg") || text.Contains("l_calf") || text.Contains("left calf")))
{
leftLowerLeg = val;
}
else if ((Object)(object)rightLowerLeg == (Object)null && (text.Contains("rightlowerleg") || text.Contains("r_calf") || text.Contains("right calf")))
{
rightLowerLeg = val;
}
else if ((Object)(object)leftForearm == (Object)null && (text.Contains("leftforearm") || text.Contains("l_forearm") || text.Contains("left forearm")))
{
leftForearm = val;
}
else if ((Object)(object)rightForearm == (Object)null && (text.Contains("rightforearm") || text.Contains("r_forearm") || text.Contains("right forearm")))
{
rightForearm = val;
}
else if ((Object)(object)leftArm == (Object)null && (text.Contains("leftarm") || text.Contains("l_arm") || text.Contains("left arm")))
{
leftArm = val;
}
else if ((Object)(object)rightArm == (Object)null && (text.Contains("rightarm") || text.Contains("r_arm") || text.Contains("right arm")))
{
rightArm = val;
}
val.drag = Mathf.Max(val.drag, 2.25f);
val.angularDrag = Mathf.Max(val.angularDrag, 5f);
val.maxAngularVelocity = 60f;
}
}
if ((Object)(object)pelvis == (Object)null && bodies.Length != 0)
{
pelvis = bodies[0];
}
if ((Object)(object)chest == (Object)null)
{
chest = pelvis;
}
}
private void FixedUpdate()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: 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_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: 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_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
//IL_01f5: 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_020f: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
//IL_0236: Unknown result type (might be due to invalid IL or missing references)
//IL_023b: Unknown result type (might be due to invalid IL or missing references)
//IL_023c: Unknown result type (might be due to invalid IL or missing references)
//IL_0246: Unknown result type (might be due to invalid IL or missing references)
//IL_0358: Unknown result type (might be due to invalid IL or missing references)
//IL_0359: Unknown result type (might be due to invalid IL or missing references)
//IL_0374: Unknown result type (might be due to invalid IL or missing references)
//IL_0375: Unknown result type (might be due to invalid IL or missing references)
//IL_039a: Unknown result type (might be due to invalid IL or missing references)
//IL_039d: Unknown result type (might be due to invalid IL or missing references)
//IL_03af: Unknown result type (might be due to invalid IL or missing references)
//IL_03b4: 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_03ce: Unknown result type (might be due to invalid IL or missing references)
//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
//IL_03da: Unknown result type (might be due to invalid IL or missing references)
//IL_0285: Unknown result type (might be due to invalid IL or missing references)
//IL_028f: Unknown result type (might be due to invalid IL or missing references)
//IL_0294: Unknown result type (might be due to invalid IL or missing references)
//IL_029a: Unknown result type (might be due to invalid IL or missing references)
//IL_029f: Unknown result type (might be due to invalid IL or missing references)
//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
//IL_040c: Unknown result type (might be due to invalid IL or missing references)
//IL_040e: Unknown result type (might be due to invalid IL or missing references)
//IL_0413: Unknown result type (might be due to invalid IL or missing references)
//IL_041a: Unknown result type (might be due to invalid IL or missing references)
//IL_041f: Unknown result type (might be due to invalid IL or missing references)
//IL_0430: Unknown result type (might be due to invalid IL or missing references)
//IL_0435: Unknown result type (might be due to invalid IL or missing references)
//IL_043a: Unknown result type (might be due to invalid IL or missing references)
//IL_043f: Unknown result type (might be due to invalid IL or missing references)
//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0403: Unknown result type (might be due to invalid IL or missing references)
//IL_0491: Unknown result type (might be due to invalid IL or missing references)
//IL_0497: Unknown result type (might be due to invalid IL or missing references)
//IL_04a9: Unknown result type (might be due to invalid IL or missing references)
//IL_04ad: Unknown result type (might be due to invalid IL or missing references)
//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
//IL_045c: Unknown result type (might be due to invalid IL or missing references)
//IL_0462: Unknown result type (might be due to invalid IL or missing references)
//IL_04f2: Unknown result type (might be due to invalid IL or missing references)
//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
//IL_04ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0511: Unknown result type (might be due to invalid IL or missing references)
//IL_0514: Unknown result type (might be due to invalid IL or missing references)
//IL_051e: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)pelvis == (Object)null))
{
Vector3 forward = ((Component)this).transform.forward;
forward.y = 0f;
if (((Vector3)(ref forward)).sqrMagnitude < 0.001f)
{
forward = Vector3.forward;
}
((Vector3)(ref forward)).Normalize();
Vector3 val = Vector3.Cross(Vector3.up, forward);
Vector3 normalized = ((Vector3)(ref val)).normalized;
HoldNearGround(pelvis, 0.3f, 105f, 16f);
if ((Object)(object)chest != (Object)null && (Object)(object)chest != (Object)(object)pelvis)
{
HoldNearGround(chest, 0.18f, 135f, 20f);
}
pelvis.AddForce(Vector3.down * 90f, (ForceMode)5);
KeepLow(leftUpperLeg, 65f, forward);
KeepLow(rightUpperLeg, 65f, forward);
KeepLow(leftLowerLeg, 50f, forward);
KeepLow(rightLowerLeg, 50f, forward);
val = Vector3.up * 0.18f - forward * 0.98f;
Vector3 normalized2 = ((Vector3)(ref val)).normalized;
pelvis.AddTorque(Vector3.Cross(((Component)pelvis).transform.up, normalized2) * 145f, (ForceMode)5);
if ((Object)(object)chest != (Object)null && (Object)(object)chest != (Object)(object)pelvis)
{
chest.AddForce(Vector3.down * 58f, (ForceMode)5);
val = Vector3.up * 0.72f - forward * 0.69f;
Vector3 normalized3 = ((Vector3)(ref val)).normalized;
chest.AddTorque(Vector3.Cross(((Component)chest).transform.up, normalized3) * 165f, (ForceMode)5);
chest.AddTorque(Vector3.Cross(((Component)chest).transform.forward, forward) * 70f, (ForceMode)5);
}
if ((Object)(object)head != (Object)null)
{
HoldNearGround(head, 0.6f, 80f, 16f);
val = Vector3.up * 0.96f + forward * 0.28f;
Vector3 normalized4 = ((Vector3)(ref val)).normalized;
head.AddTorque(Vector3.Cross(((Component)head).transform.up, normalized4) * 175f, (ForceMode)5);
head.AddTorque(Vector3.Cross(((Component)head).transform.forward, forward) * 75f, (ForceMode)5);
}
float num = Time.time * 11.5f;
float num2 = Mathf.Sin(num);
float num3 = Mathf.Sin(num + (float)Math.PI);
float num4 = Mathf.Max(0f, num2);
float num5 = Mathf.Max(0f, num3);
CrawlArm(leftArm, leftForearm, num2, forward, normalized, -1f);
CrawlArm(rightArm, rightForearm, num3, forward, normalized, 1f);
float num6 = 24f + (num4 + num5) * 32f;
pelvis.AddForce(forward * num6, (ForceMode)5);
Vector3 velocity = pelvis.velocity;
velocity.y = Mathf.Min(velocity.y, 0f);
Vector3 val2 = Vector3.ProjectOnPlane(velocity, Vector3.up);
float num7 = 5.5f;
if (((Vector3)(ref val2)).magnitude > num7)
{
val2 = ((Vector3)(ref val2)).normalized * num7;
}
pelvis.velocity = val2 + Vector3.up * velocity.y;
Vector3 val3 = Vector3.ProjectOnPlane(pelvis.velocity, Vector3.up);
if (((Vector3)(ref val3)).magnitude < 6.5f)
{
pelvis.AddForce(forward * 10f, (ForceMode)5);
}
float num8 = Mathf.Sin(num) * 16f;
float num9 = Mathf.Cos(num) * 8f;
pelvis.AddForce(normalized * (num8 + num9), (ForceMode)5);
pelvis.AddTorque(forward * (0f - num8) * 5.5f, (ForceMode)5);
if ((Object)(object)chest != (Object)null && (Object)(object)chest != (Object)(object)pelvis)
{
chest.AddForce(normalized * num8 * 1.65f, (ForceMode)5);
chest.AddTorque(forward * num8 * 8.5f, (ForceMode)5);
}
}
}
private void HoldNearGround(Rigidbody body, float targetDistance, float spring, float damping)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)body == (Object)null)
{
return;
}
RaycastHit[] array = Physics.RaycastAll(body.worldCenterOfMass + Vector3.up * 0.15f, Vector3.down, 3f, -1, (QueryTriggerInteraction)1);
float num = float.MaxValue;
for (int i = 0; i < array.Length; i++)
{
Collider collider = ((RaycastHit)(ref array[i])).collider;
if (!((Object)(object)collider == (Object)null) && !((Component)collider).transform.IsChildOf(((Component)this).transform))
{
num = Mathf.Min(num, ((RaycastHit)(ref array[i])).distance - 0.15f);
}
}
if (num != float.MaxValue)
{
float num2 = num - targetDistance;
float num3 = Vector3.Dot(body.velocity, Vector3.up);
float num4 = num2 * (0f - spring) - num3 * damping;
body.AddForce(Vector3.up * num4, (ForceMode)5);
}
}
private void KeepLow(Rigidbody body, float downwardForce, Vector3 forward)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: 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_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: 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)
if (!((Object)(object)body == (Object)null))
{
body.AddForce(Vector3.down * downwardForce, (ForceMode)5);
Vector3 val = Vector3.up * 0.12f - forward * 0.99f;
Vector3 normalized = ((Vector3)(ref val)).normalized;
body.AddTorque(Vector3.Cross(((Component)body).transform.up, normalized) * 115f, (ForceMode)5);
}
}
private void CrawlArm(Rigidbody upperArm, Rigidbody forearm, float stroke, Vector3 forward, Vector3 right, float side)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: 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_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
float num = Mathf.Max(0f, stroke);
float num2 = Mathf.Max(0f, 0f - stroke);
if ((Object)(object)upperArm != (Object)null)
{
upperArm.AddForce(forward * (14f + num * 34f - num2 * 28f) + right * side * (8f + num * 8f) - Vector3.up * (20f + num * 18f), (ForceMode)5);
}
if ((Object)(object)forearm != (Object)null)
{
forearm.AddForce(forward * (12f + num * 28f - num2 * 22f) + right * side * 4f - Vector3.up * (22f + num * 18f), (ForceMode)5);
}
}
}
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_01f9: 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);
}
Renderer[] componentsInChildren = ((Component)unit).GetComponentsInChildren<Renderer>(true);
Renderer[] array = componentsInChildren;
foreach (Renderer val in array)
{
if ((Object)(object)val == (Object)null)
{
continue;
}
Material[] materials = val.materials;
Material[] array2 = materials;
foreach (Material val2 in array2)
{
if ((Object)(object)val2 != (Object)null)
{
tuplist.Add(Tuple.Create<Material, Color>(val2, val2.color));
}
}
}
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));
}
Color finalZombieGreen = Color32.op_Implicit(new Color32((byte)120, (byte)170, (byte)50, byte.MaxValue));
Renderer[] finalRenderers = gameObject.GetComponentsInChildren<Renderer>(true);
Renderer[] array = finalRenderers;
foreach (Renderer renderer in array)
{
if ((Object)(object)renderer == (Object)null)
{
continue;
}
Material[] finalMaterials = renderer.materials;
Material firstGreenMaterial = null;
for (int k = 0; k < finalMaterials.Length; k++)
{
Material sourceMaterial = finalMaterials[k];
if (!((Object)(object)sourceMaterial == (Object)null) && !IsEyeMaterial(renderer, sourceMaterial))
{
Material zombieMaterial = new Material(sourceMaterial);
zombieMaterial.color = finalZombieGreen;
finalMaterials[k] = zombieMaterial;
if ((Object)(object)firstGreenMaterial == (Object)null)
{
firstGreenMaterial = zombieMaterial;
}
}
}
renderer.materials = finalMaterials;
TeamColor teamColor = ((Component)renderer).GetComponentInChildren<TeamColor>();
if ((Object)(object)teamColor != (Object)null && (Object)(object)firstGreenMaterial != (Object)null)
{
teamColor.blueMaterial = firstGreenMaterial;
teamColor.redMaterial = firstGreenMaterial;
}
}
TeamColor[] componentsInChildren3 = gameObject.GetComponentsInChildren<TeamColor>(true);
foreach (TeamColor teamColor2 in componentsInChildren3)
{
if (!((Object)(object)teamColor2 == (Object)null))
{
Material greenMaterial = FindZombieGreenMaterialForTeamColor(teamColor2, finalZombieGreen);
if ((Object)(object)greenMaterial != (Object)null)
{
teamColor2.blueMaterial = greenMaterial;
teamColor2.redMaterial = greenMaterial;
}
teamColor2.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);
}
private Material FindZombieGreenMaterialForTeamColor(TeamColor teamColor, Color zombieGreen)
{
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Expected O, but got Unknown
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
Renderer[] array = ((Component)teamColor).GetComponentsInChildren<Renderer>(true);
if (array == null || array.Length == 0)
{
Renderer componentInParent = ((Component)teamColor).GetComponentInParent<Renderer>();
if ((Object)(object)componentInParent != (Object)null)
{
array = (Renderer[])(object)new Renderer[1] { componentInParent };
}
}
foreach (Renderer val in array)
{
if ((Object)(object)val == (Object)null)
{
continue;
}
Material[] materials = val.materials;
foreach (Material val2 in materials)
{
if (!((Object)(object)val2 == (Object)null) && !IsEyeMaterial(val, val2))
{
Material val3 = new Material(val2);
val3.color = zombieGreen;
return val3;
}
}
}
return null;
}
private bool IsEyeMaterial(Renderer renderer, Material material)
{
string text = (((Object)(object)renderer != (Object)null && ((Object)renderer).name != null) ? ((Object)renderer).name : string.Empty);
string text2 = (((Object)(object)material != (Object)null && ((Object)material).name != null) ? ((Object)material).name : string.Empty);
return text.IndexOf("eye", StringComparison.OrdinalIgnoreCase) >= 0 || text2.IndexOf("eye", StringComparison.OrdinalIgnoreCase) >= 0;
}
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;
}
}