Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Reanimated Madara v0.7.1
plugins/ReanimatedMadara/ReanimatedMadara.dll
Decompiled 6 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Serialization.Json; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using ExtraSkillSlots; using KinematicCharacterController; using On.RoR2; using On.RoR2.UI; using R2API; using R2API.Utils; using Rewired; using RoR2; using RoR2.CameraModes; using RoR2.ContentManagement; using RoR2.Projectile; using RoR2.Skills; using RoR2.UI; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.Rendering.PostProcessing; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ReanimatedMadara")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+01bfac71619110f3e34256ed78738578f13dd36f")] [assembly: AssemblyProduct("ReanimatedMadara")] [assembly: AssemblyTitle("ReanimatedMadara")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace ReanimatedMadaraMod; public static class Snd { private static readonly Dictionary<int, float> voiceUntil = new Dictionary<int, float>(); public static void Init() { string path = Path.Combine(Media.Assets, "Audio", "RMadara.bnk"); if (File.Exists(path)) { SoundBanks.Add(File.ReadAllBytes(path)); } else { Plugin.Log.LogWarning((object)"RMADARA_AUDIO bank missing"); } } public static uint Sfx(string key, GameObject at) { uint result = (Object.op_Implicit((Object)(object)at) ? AkSoundEngine.PostEvent("Play_RMadara_" + key, at) : 0u); Combat.Trace?.Invoke("SFX Play_RMadara_" + key + " playingId=" + result + " rt=" + Time.realtimeSinceStartup.ToString("0.000")); return result; } public static bool Voice(CharacterBody body, string key, float length, bool grunt = false) { if (!Object.op_Implicit((Object)(object)body)) { return false; } int instanceID = ((Object)body).GetInstanceID(); float time = Time.time; if (voiceUntil.TryGetValue(instanceID, out var value) && time < value) { return false; } if (grunt && Random.value > 0.55f) { return false; } voiceUntil[instanceID] = time + length; bool flag = VoiceLoadout.Get(body) == VoiceLoadout.Lang.English; Sfx((flag ? "VE_" : "V_") + key, ((Component)body).gameObject); Combat.Trace?.Invoke("VOICE " + (flag ? "VE_" : "V_") + key); return true; } } public static class PrimaryVoice { private sealed class St { public float last = -999f; public int target = -1; } private static readonly Dictionary<int, St> state = new Dictionary<int, St>(); public static void Swing(CharacterBody body, int stage, int finisher, string key, float length) { if (!Object.op_Implicit((Object)(object)body)) { return; } int instanceID = ((Object)body).GetInstanceID(); if (!state.TryGetValue(instanceID, out var value)) { value = (state[instanceID] = new St()); } if (stage == 0) { value.target = ((!(Random.value < Tuning.PrimaryVoiceChance.Value)) ? (-1) : ((!(Random.value < 0.5f)) ? finisher : 0)); Combat.Trace?.Invoke("PRIMARYVOICE string start plan=" + value.target); } if (value.target == stage) { value.target = -1; float num = Time.time - value.last; if (num < Tuning.PrimaryVoiceCooldown.Value) { Combat.Trace?.Invoke("PRIMARYVOICE cooldown skip age=" + num.ToString("0.0")); } else if (Snd.Voice(body, key, length)) { value.last = Time.time; Combat.Trace?.Invoke("PRIMARYVOICE played " + key + " stage=" + stage); } } } } public static class ChakraBurst { private static Transform holder; private static ParticleSystem core; private static ParticleSystem hot; private static ParticleSystem rim; private static ParticleSystem ring; private static ParticleSystem frag; private static Texture2D thinRing; private static Texture2D chunk; private static Texture2D puff; public static float RingK = 2.6f; public static float HotAlpha = 0.85f; public static float RimAlpha = 0.5f; public static float CoreAlpha = 1f; public static float RingAlpha = 1f; public static float FragAlpha = 1f; public static float Size = 1f; private static readonly Color CoreC = new Color(0.85f, 0.96f, 1f); private static readonly Color HotC = new Color(0.7f, 0.9f, 1f); private static readonly Color RimC = new Color(0.15f, 0.45f, 1f); private static readonly Color FragC = new Color(0.75f, 0.92f, 1f); private static readonly Color RingC = new Color(0.75f, 0.93f, 1f); private static Texture2D ThinRing { get { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_004f: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)thinRing)) { thinRing = new Texture2D(256, 256, (TextureFormat)4, true) { wrapMode = (TextureWrapMode)1 }; Color[] array = (Color[])(object)new Color[65536]; float num = 127.5f; for (int i = 0; i < 256; i++) { for (int j = 0; j < 256; j++) { float num2 = Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(num, num)) / num; float num3 = Mathf.Clamp01((num2 - 0.86f) / 0.03f) * Mathf.Clamp01((0.985f - num2) / 0.02f); num3 = Mathf.Max(num3, 0.25f * Mathf.Clamp01((num2 - 0.7f) / 0.16f) * Mathf.Clamp01((0.985f - num2) / 0.02f)); array[i * 256 + j] = new Color(1f, 1f, 1f, num3); } } thinRing.SetPixels(array); thinRing.Apply(true); } return thinRing; } } private static Texture2D Chunk { get { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)chunk)) { chunk = new Texture2D(32, 32, (TextureFormat)4, true) { wrapMode = (TextureWrapMode)1 }; Color[] array = (Color[])(object)new Color[1024]; for (int i = 0; i < 32; i++) { for (int j = 0; j < 32; j++) { float num = Mathf.Abs((float)j / 31f * 2f - 1f); float num2 = Mathf.Abs((float)i / 31f * 2f - 1f); float num3 = Mathf.Pow(Mathf.Pow(num, 1.4f) + Mathf.Pow(num2, 1.4f), 0.71428573f); float num4 = Mathf.Clamp01((1f - num3) / 0.25f); array[i * 32 + j] = new Color(1f, 1f, 1f, num4); } } chunk.SetPixels(array); chunk.Apply(true); } return chunk; } } private static Texture2D Puff { get { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)puff)) { puff = new Texture2D(64, 64, (TextureFormat)4, true) { wrapMode = (TextureWrapMode)1 }; Random random = new Random(41); float[,] array = new float[9, 9]; float[,] array2 = new float[17, 17]; for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { array[i, j] = (float)random.NextDouble(); } } for (int k = 0; k < 17; k++) { for (int l = 0; l < 17; l++) { array2[k, l] = (float)random.NextDouble(); } } Color[] array3 = (Color[])(object)new Color[4096]; for (int m = 0; m < 64; m++) { for (int n = 0; n < 64; n++) { float num = (float)n / 63f; float num2 = (float)m / 63f; float num3 = Vector2.Distance(new Vector2(num, num2), new Vector2(0.5f, 0.5f)) * 2f; float num4 = V(array, 8, num * 8f, num2 * 8f) * 0.65f + V(array2, 16, num * 16f, num2 * 16f) * 0.35f; float num5 = Mathf.Clamp01(((1f - num3) * 1.5f - num4 * 0.6f) / 0.35f); array3[m * 64 + n] = new Color(1f, 1f, 1f, num5 * num5); } } puff.SetPixels(array3); puff.Apply(true); } return puff; static float V(float[,] gg, int G2, float u, float v) { int num6 = Mathf.Min(G2 - 1, (int)u); int num7 = Mathf.Min(G2 - 1, (int)v); float num8 = Mathf.SmoothStep(0f, 1f, u - (float)num6); float num9 = Mathf.SmoothStep(0f, 1f, v - (float)num7); return Mathf.Lerp(Mathf.Lerp(gg[num6, num7], gg[num6 + 1, num7], num8), Mathf.Lerp(gg[num6, num7 + 1], gg[num6 + 1, num7 + 1], num8), num9); } } } private static Material Mat(Texture tex, bool add) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) Material obj = (add ? Fx.Additive(tex) : Fx.AlphaTex(tex)); obj.SetColor("_TintColor", new Color(0.5f, 0.5f, 0.5f, 0.5f)); obj.SetFloat("_VertexColorOn", 1f); obj.EnableKeyword("VERTEXCOLOR"); obj.SetFloat("_VertexAlphaOn", 1f); obj.EnableKeyword("VERTEXALPHA"); return obj; } private static ParticleSystem Sys(string name, Material m, int max, ParticleSystemRenderMode mode, AnimationCurve size, Gradient col, float drag = 0f, float gravity = 0f, float maxScreen = 2f) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) ParticleSystem val = Fx.Particles(holder, m, Color.white, 1f, 1f, 0f, max); ((Object)((Component)val).gameObject).name = "RMadaraChakra " + name; MainModule main = val.main; ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(gravity); ((MainModule)(ref main)).startRotation = new MinMaxCurve(0f, MathF.PI * 2f); ParticleSystemRenderer component = ((Component)val).GetComponent<ParticleSystemRenderer>(); component.renderMode = mode; component.maxParticleSize = maxScreen; SizeOverLifetimeModule sizeOverLifetime = val.sizeOverLifetime; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, size); ColorOverLifetimeModule colorOverLifetime = val.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true; ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(col); if (drag > 0f) { LimitVelocityOverLifetimeModule limitVelocityOverLifetime = val.limitVelocityOverLifetime; ((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).enabled = true; ((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).limit = MinMaxCurve.op_Implicit(0f); ((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).dampen = drag; } return val; } private static Gradient G(params float[] ak) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return GC(Color.white, Color.white, ak); } private static Gradient GC(Color c0, Color c1, params float[] ak) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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) Gradient val = new Gradient(); GradientAlphaKey[] array = (GradientAlphaKey[])(object)new GradientAlphaKey[ak.Length / 2]; for (int i = 0; i < array.Length; i++) { array[i] = new GradientAlphaKey(ak[i * 2 + 1], ak[i * 2]); } val.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(c0, 0f), new GradientColorKey(c1, 1f) }, array); return val; } private static AnimationCurve C(params float[] k) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0013: Unknown result type (might be due to invalid IL or missing references) AnimationCurve val = new AnimationCurve(); for (int i = 0; i < k.Length; i += 2) { val.AddKey(new Keyframe(k[i], k[i + 1])); } for (int j = 0; j < val.length; j++) { val.SmoothTangents(j, 0f); } return val; } public static void Warm() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)holder)) { GameObject val = new GameObject("RMadaraChakraBurst"); Object.DontDestroyOnLoad((Object)val); holder = val.transform; core = Sys("core", Mat((Texture)(object)Fx.Soft, add: true), 60, (ParticleSystemRenderMode)0, C(0f, 0.35f, 0.15f, 0.9f, 0.7f, 1f, 1f, 1.1f), G(0f, 1f, 0.7f, 0.9f, 1f, 0f)); hot = Sys("hot", Mat((Texture)(object)Puff, add: true), 300, (ParticleSystemRenderMode)0, C(0f, 0.4f, 0.3f, 0.9f, 1f, 1.25f), GC(Color.white, new Color(0.35f, 0.6f, 1f), 0f, 0f, 0.05f, 1f, 0.45f, 0.7f, 1f, 0f), 0.08f); RotationOverLifetimeModule rotationOverLifetime = hot.rotationOverLifetime; ((RotationOverLifetimeModule)(ref rotationOverLifetime)).enabled = true; ((RotationOverLifetimeModule)(ref rotationOverLifetime)).z = new MinMaxCurve(-0.8f, 0.8f); rim = Sys("rim", Mat((Texture)(object)Puff, add: false), 300, (ParticleSystemRenderMode)0, C(0f, 0.5f, 0.35f, 0.95f, 1f, 1.3f), G(0f, 0f, 0.06f, 1f, 0.5f, 0.55f, 1f, 0f), 0.08f); ring = Sys("ring", Mat((Texture)(object)ThinRing, add: true), 40, (ParticleSystemRenderMode)0, C(0f, 0.08f, 0.3f, 0.9f, 1f, 1f), G(0f, 1f, 0.55f, 0.7f, 1f, 0f)); frag = Sys("frag", Mat((Texture)(object)Chunk, add: true), 300, (ParticleSystemRenderMode)0, C(0f, 1f, 0.7f, 0.75f, 1f, 0.3f), G(0f, 1f, 0.6f, 0.9f, 1f, 0f), 0.05f, 1.4f, 0.35f); } } private static void E(ParticleSystem ps, Vector3 p, Vector3 v, float size, float life, Color c) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) EmitParams val = default(EmitParams); ((EmitParams)(ref val)).position = p; ((EmitParams)(ref val)).velocity = v; ((EmitParams)(ref val)).startSize = size; ((EmitParams)(ref val)).startLifetime = life; ((EmitParams)(ref val)).startColor = Color32.op_Implicit(c); ps.Emit(val, 1); } public static void Flecks(Vector3 at, float r, int n, float size) { //IL_0019: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_005a: 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) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) Warm(); Camera val = Fx.Cam(); if (!Object.op_Implicit((Object)(object)val) || !(Vector3.Distance(((Component)val).transform.position, at) < 2f)) { for (int i = 0; i < n; i++) { Vector3 onUnitSphere = Random.onUnitSphere; E(hot, at + onUnitSphere * r * Random.Range(0.4f, 1f), onUnitSphere * Random.Range(1.2f, 2.6f) + Vector3.up * 0.6f, size * Random.Range(0.7f, 1.2f), Random.Range(0.22f, 0.38f), new Color(0.45f, 0.82f, 1f, 0.9f)); } } } public static void Burst(Vector3 at, float R, float power, Vector3 dir = default(Vector3)) { //IL_0019: 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_005b: 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_0060: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: 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_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //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_0297: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: 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_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Unknown result type (might be due to invalid IL or missing references) Warm(); Camera val = Fx.Cam(); if (Object.op_Implicit((Object)(object)val) && Vector3.Distance(((Component)val).transform.position, at) < R * 1.6f + 1f) { return; } R *= Size; float num = Mathf.Sqrt(R); Vector3 val2 = ((((Vector3)(ref dir)).sqrMagnitude > 0.01f) ? ((Vector3)(ref dir)).normalized : Vector3.up); E(core, at, Vector3.zero, R * 1.6f, 0.22f, new Color(CoreC.r, CoreC.g, CoreC.b, CoreAlpha)); int num2 = Mathf.Clamp(Mathf.RoundToInt(8f + R * 2.5f), 8, 20); Vector3 val3; for (int i = 0; i < num2; i++) { val3 = Random.onUnitSphere * 0.6f + val2 * 1.1f; Vector3 normalized = ((Vector3)(ref val3)).normalized; E(hot, at + normalized * R * 0.1f, normalized * R * Random.Range(2.2f, 3.6f), R * Random.Range(0.6f, 0.95f), Random.Range(0.25f, 0.42f), new Color(HotC.r, HotC.g, HotC.b, HotAlpha * Random.Range(0.75f, 1f))); if (i % 2 == 0) { val3 = Random.onUnitSphere + val2 * 0.8f; normalized = ((Vector3)(ref val3)).normalized; E(rim, at + normalized * R * 0.3f, normalized * R * Random.Range(2.4f, 3.4f), R * Random.Range(0.7f, 1.05f), Random.Range(0.35f, 0.55f), new Color(RimC.r, RimC.g, RimC.b, RimAlpha * Random.Range(0.7f, 1f))); } } int num3 = Mathf.Clamp(Mathf.RoundToInt(8f + R * 2f * (0.5f + power * 0.5f)), 8, 16); for (int j = 0; j < num3; j++) { val3 = Random.onUnitSphere * 0.7f + val2 + Vector3.up * 0.25f; Vector3 normalized2 = ((Vector3)(ref val3)).normalized; E(frag, at + normalized2 * R * 0.2f, normalized2 * R * Random.Range(5f, 9f), Random.Range(0.45f, 0.8f) * num, Random.Range(0.4f, 0.7f), new Color(FragC.r, FragC.g, FragC.b, FragAlpha)); } E(ring, at, Vector3.zero, R * RingK, 0.2f + 0.05f * power, new Color(RingC.r, RingC.g, RingC.b, RingAlpha * 0.85f)); if (power > 1f) { ShakeEmitter.CreateSimpleShakeEmitter(at, new Wave { amplitude = 0.7f, frequency = 22f }, 0.18f, 25f, true); } } } public static class Combat { public sealed class SpreadDealer : MonoBehaviour { public CharacterBody attacker; public Vector3 center; public float coef; public float proc; public float force; public float upward; public DamageType type; public bool crit; public string source; public readonly List<HurtBox> targets = new List<HurtBox>(); private void FixedUpdate() { //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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_00c7: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) int num = 0; while (targets.Count > 0 && num < PerStep) { HurtBox val = targets[0]; targets.RemoveAt(0); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.healthComponent) && val.healthComponent.alive && Object.op_Implicit((Object)(object)attacker)) { num++; Vector3 val2 = Point(val, center); Vector3 val3 = val2 - center; val3.y = 0f; val3 = ((((Vector3)(ref val3)).sqrMagnitude < 0.01f) ? Vector3.up : ((Vector3)(ref val3)).normalized); Source = source; CharacterBody obj = attacker; float coefficient = coef; float num2 = proc; bool num3 = crit; Vector3 val4 = val3 + Vector3.up * upward; Deal(obj, val, val2, coefficient, num2, num3, ((Vector3)(ref val4)).normalized * force, type, null, (DamageColorIndex)0); } } if (targets.Count == 0 || !Object.op_Implicit((Object)(object)attacker)) { Object.Destroy((Object)(object)((Component)this).gameObject); } } } public static Action<string> Trace; public static string Source = ""; private static readonly Collider[] buffer = (Collider[])(object)new Collider[512]; public static int PerStep = 6; private static readonly RaycastHit[] rayHits = (RaycastHit[])(object)new RaycastHit[32]; public static bool Target(HurtBox hurt, CharacterBody attacker) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)hurt) || !Object.op_Implicit((Object)(object)hurt.healthComponent) || !hurt.healthComponent.alive || !Object.op_Implicit((Object)(object)attacker) || !Object.op_Implicit((Object)(object)attacker.teamComponent) || (Object)(object)hurt.healthComponent == (Object)(object)attacker.healthComponent) { return false; } CharacterBody body = hurt.healthComponent.body; if (((Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.teamComponent)) ? body.teamComponent.teamIndex : hurt.teamIndex) == attacker.teamComponent.teamIndex || hurt.teamIndex == attacker.teamComponent.teamIndex) { return false; } return FriendlyFireManager.ShouldDirectHitProceed(hurt.healthComponent, attacker.teamComponent.teamIndex); } public static bool TargetBody(CharacterBody victim, CharacterBody attacker) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Invalid comparison between I4 and Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)victim) || !Object.op_Implicit((Object)(object)attacker) || (Object)(object)victim == (Object)(object)attacker || !Object.op_Implicit((Object)(object)victim.healthComponent) || !victim.healthComponent.alive || !Object.op_Implicit((Object)(object)attacker.teamComponent)) { return false; } if (((!Object.op_Implicit((Object)(object)victim.teamComponent)) ? (-1) : ((int)victim.teamComponent.teamIndex)) == (int)attacker.teamComponent.teamIndex) { return false; } return FriendlyFireManager.ShouldDirectHitProceed(victim.healthComponent, attacker.teamComponent.teamIndex); } public static bool Visible(Vector3 a, Vector3 b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return !Physics.Linecast(a, b, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1); } public static Vector3 Point(HurtBox h, Vector3 from) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) Collider val = (Object.op_Implicit((Object)(object)h) ? h.collider : null); if (!Object.op_Implicit((Object)(object)val)) { if (!Object.op_Implicit((Object)(object)h)) { return from; } return ((Component)h).transform.position; } return val.ClosestPoint(from); } public static bool Deal(CharacterBody attacker, HurtBox hurt, Vector3 position, float coefficient, float proc, bool crit, Vector3 force, DamageType type = (DamageType)0u, GameObject inflictor = null, DamageColorIndex color = (DamageColorIndex)0) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //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) if (!NetworkServer.active || !Target(hurt, attacker)) { return false; } DamageInfo val = new DamageInfo { attacker = ((Component)attacker).gameObject, inflictor = (Object.op_Implicit((Object)(object)inflictor) ? inflictor : ((Component)attacker).gameObject), damage = attacker.damage * coefficient, crit = crit, position = position, force = force, procCoefficient = proc, damageType = DamageTypeCombo.op_Implicit(type), damageColorIndex = color }; HealthComponent healthComponent = hurt.healthComponent; float combinedHealth = healthComponent.combinedHealth; healthComponent.TakeDamage(val); if (!val.rejected) { GlobalEventManager instance = GlobalEventManager.instance; if (instance != null) { instance.OnHitEnemy(val, ((Component)healthComponent).gameObject); } GlobalEventManager instance2 = GlobalEventManager.instance; if (instance2 != null) { instance2.OnHitAll(val, ((Component)healthComponent).gameObject); } } if (Trace != null) { Trace("DAMAGE source=" + Source + " victim=" + (Object.op_Implicit((Object)(object)healthComponent.body) ? ((Object)healthComponent.body).name : ((Object)healthComponent).name) + " team=" + ((Object.op_Implicit((Object)(object)healthComponent.body) && Object.op_Implicit((Object)(object)healthComponent.body.teamComponent)) ? ((object)healthComponent.body.teamComponent.teamIndex/*cast due to .constrained prefix*/).ToString() : "?") + " coef=" + coefficient.ToString("0.00") + " loss=" + (combinedHealth - healthComponent.combinedHealth).ToString("0.0") + " rejected=" + val.rejected); } return !val.rejected; } public static int Capsule(CharacterBody attacker, Vector3 a, Vector3 b, float radius, List<HurtBox> into, HashSet<HealthComponent> exclude) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) int num = Physics.OverlapCapsuleNonAlloc(a, b, radius, buffer, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask), (QueryTriggerInteraction)2); int num2 = 0; for (int i = 0; i < num; i++) { HurtBox component = ((Component)buffer[i]).GetComponent<HurtBox>(); if (!Target(component, attacker) || exclude.Contains(component.healthComponent)) { continue; } bool flag = false; foreach (HurtBox item in into) { if ((Object)(object)item.healthComponent == (Object)(object)component.healthComponent) { flag = true; break; } } if (!flag) { into.Add(component); num2++; } } return num2; } public static List<HurtBox> Around(CharacterBody attacker, Vector3 origin, float radius, bool sight = true) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) Dictionary<HealthComponent, HurtBox> dictionary = new Dictionary<HealthComponent, HurtBox>(); int num = Physics.OverlapSphereNonAlloc(origin, radius, buffer, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask), (QueryTriggerInteraction)2); for (int i = 0; i < num; i++) { HurtBox component = ((Component)buffer[i]).GetComponent<HurtBox>(); if (!Target(component, attacker)) { continue; } Vector3 val = buffer[i].ClosestPoint(origin); Vector3 val2; if (sight) { val2 = val - origin; if (((Vector3)(ref val2)).sqrMagnitude > 0.25f && !Visible(origin, val)) { continue; } } if (dictionary.TryGetValue(component.healthComponent, out var value)) { val2 = Point(component, origin) - origin; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; val2 = Point(value, origin) - origin; if (!(sqrMagnitude < ((Vector3)(ref val2)).sqrMagnitude)) { continue; } } dictionary[component.healthComponent] = component; } List<HurtBox> list = new List<HurtBox>(dictionary.Values); list.Sort(delegate(HurtBox x, HurtBox y) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) Vector3 val3 = Point(x, origin) - origin; float sqrMagnitude2 = ((Vector3)(ref val3)).sqrMagnitude; val3 = Point(y, origin) - origin; return sqrMagnitude2.CompareTo(((Vector3)(ref val3)).sqrMagnitude); }); return list; } public static int Blast(CharacterBody attacker, Vector3 center, float radius, float coefficient, float proc, float force, DamageType type = (DamageType)0u, HashSet<HealthComponent> once = null, GameObject inflictor = null, float upward = 0.35f) { //IL_001b: 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_004b: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || !Object.op_Implicit((Object)(object)attacker)) { return 0; } bool crit = attacker.RollCrit(); int num = 0; foreach (HurtBox item in Around(attacker, center, radius)) { if (once == null || once.Add(item.healthComponent)) { Vector3 val = Point(item, center); Vector3 val2 = val - center; val2.y = 0f; val2 = ((((Vector3)(ref val2)).sqrMagnitude < 0.01f) ? Vector3.up : ((Vector3)(ref val2)).normalized); Vector3 val3 = val2 + Vector3.up * upward; if (Deal(attacker, item, val, coefficient, proc, crit, ((Vector3)(ref val3)).normalized * force, type, inflictor, (DamageColorIndex)0)) { num++; } } } return num; } public static int BlastSpread(CharacterBody attacker, Vector3 center, float radius, float coefficient, float proc, float force, DamageType type = (DamageType)0u, float upward = 0.35f, string source = null) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || !Object.op_Implicit((Object)(object)attacker)) { return 0; } List<HurtBox> list = Around(attacker, center, radius); if (list.Count == 0) { return 0; } SpreadDealer spreadDealer = new GameObject("RMadaraBlastSpread").AddComponent<SpreadDealer>(); spreadDealer.attacker = attacker; spreadDealer.center = center; spreadDealer.coef = coefficient; spreadDealer.proc = proc; spreadDealer.force = force; spreadDealer.type = type; spreadDealer.upward = upward; spreadDealer.crit = attacker.RollCrit(); spreadDealer.source = source ?? Source; spreadDealer.targets.AddRange(list); return list.Count; } public static bool AimHit(Ray ray, CharacterBody owner, float range, out RaycastHit best, bool entities = true) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) best = default(RaycastHit); float num = float.MaxValue; int num2 = LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask) | (entities ? LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask) : 0); int num3 = Physics.RaycastNonAlloc(ray, rayHits, range, num2, (QueryTriggerInteraction)1); for (int i = 0; i < num3; i++) { RaycastHit val = rayHits[i]; if (((RaycastHit)(ref val)).distance >= num || !Object.op_Implicit((Object)(object)((RaycastHit)(ref val)).collider)) { continue; } HurtBox component = ((Component)((RaycastHit)(ref val)).collider).GetComponent<HurtBox>(); if (Object.op_Implicit((Object)(object)component)) { if (!Target(component, owner)) { continue; } } else if (Object.op_Implicit((Object)(object)owner) && ((Component)((RaycastHit)(ref val)).collider).transform.IsChildOf(((Component)owner).gameObject.transform)) { continue; } best = val; num = ((RaycastHit)(ref val)).distance; } return num < float.MaxValue; } public static int Box(CharacterBody attacker, Vector3 center, Vector3 half, Quaternion rot, Dictionary<HealthComponent, HurtBox> into) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) into.Clear(); int num = Physics.OverlapBoxNonAlloc(center, half, buffer, rot, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask), (QueryTriggerInteraction)2); for (int i = 0; i < num; i++) { HurtBox component = ((Component)buffer[i]).GetComponent<HurtBox>(); if (Target(component, attacker) && (!into.ContainsKey(component.healthComponent) || component.isBullseye)) { into[component.healthComponent] = component; } } return into.Count; } public static List<HurtBox> Cone(CharacterBody attacker, Vector3 origin, Vector3 dir, float range, float halfAngle, bool sight = false) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_006b: Unknown result type (might be due to invalid IL or missing references) List<HurtBox> list = new List<HurtBox>(); dir = ((Vector3)(ref dir)).normalized; float num = Mathf.Cos(halfAngle * (MathF.PI / 180f)); foreach (HurtBox item in Around(attacker, origin, range, sight)) { Vector3 val = Point(item, origin) - origin; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < 2.5f || Vector3.Dot(val / Mathf.Max(0.01f, magnitude), dir) >= num) { list.Add(item); } } return list; } public static List<HurtBox> Front(CharacterBody attacker, Vector3 origin, Vector3 fwd, float range, float halfAngle, float minUp, float maxUp) { //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_002a: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) List<HurtBox> list = new List<HurtBox>(); fwd.y = 0f; fwd = ((Vector3)(ref fwd)).normalized; float num = Mathf.Cos(halfAngle * (MathF.PI / 180f)); foreach (HurtBox item in Around(attacker, origin + Vector3.up * (minUp + maxUp) * 0.5f, Mathf.Sqrt(range * range + (maxUp - minUp) * (maxUp - minUp) * 0.25f), sight: false)) { Vector3 val = Point(item, origin) - origin; float y = val.y; val.y = 0f; float magnitude = ((Vector3)(ref val)).magnitude; if (!(y < minUp) && !(y > maxUp) && !(magnitude > range) && (magnitude < 2f || Vector3.Dot(val / Mathf.Max(0.01f, magnitude), fwd) >= num)) { list.Add(item); } } return list; } public static Vector3 Ground(Vector3 p, float down = 60f) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (!Physics.Raycast(p + Vector3.up * 3f, Vector3.down, ref val, down, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { return p; } return ((RaycastHit)(ref val)).point; } public static bool TryGround(Vector3 p, float down, out Vector3 g) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_0022: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (Physics.Raycast(p + Vector3.up * 1.5f, Vector3.down, ref val, down, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { g = ((RaycastHit)(ref val)).point; return true; } g = p; return false; } public static bool IsHeavy(CharacterBody b) { if (Object.op_Implicit((Object)(object)b)) { if (!b.isChampion && !b.isBoss && (!Object.op_Implicit((Object)(object)b.characterMotor) || !(b.characterMotor.mass >= 700f))) { if (Object.op_Implicit((Object)(object)b.rigidbody)) { return b.rigidbody.mass >= 700f; } return false; } return true; } return false; } public static float Mass(CharacterBody b) { if (!Object.op_Implicit((Object)(object)b.characterMotor)) { if (!Object.op_Implicit((Object)(object)b.rigidbody)) { return 100f; } return b.rigidbody.mass; } return b.characterMotor.mass; } } public sealed class RMadaraDeath : GenericCharacterDeath { public override bool shouldAutoDestroy { get { if (((EntityState)this).fixedAge > 10f) { if (!(((EntityState)this).fixedAge > 40f)) { return !TengaiActor.ActiveFor(((EntityState)this).gameObject); } return true; } return false; } } public override void OnEnter() { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) ((GenericCharacterDeath)this).OnEnter(); try { SusanooStrike.HideAll(((EntityState)this).GetComponent<CharacterBody>()); } catch (Exception ex) { Plugin.Log.LogWarning((object)("RMADARA_DEATH " + ex.Message)); } Snd.Voice(((EntityState)this).characterBody, "Death", 3f); CharVisual charVisual = CharVisual.Find(((EntityState)this).characterBody); if (Object.op_Implicit((Object)(object)charVisual)) { try { Ragdoll.Spawn(charVisual, Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) ? ((EntityState)this).characterMotor.velocity : Vector3.zero); return; } catch (Exception ex2) { Plugin.Log.LogWarning((object)("RMADARA_RAGDOLL " + ex2)); return; } } Plugin.Log.LogWarning((object)"RMADARA_RAGDOLL no visual"); } public override void PlayDeathAnimation(float crossfadeDuration = 0.1f) { } } public static class Ragdoll { private static readonly string[][] parts = new string[11][] { new string[2] { "pelvis", "" }, new string[2] { "spine1", "pelvis" }, new string[2] { "head", "spine1" }, new string[2] { "l upperarm", "spine1" }, new string[2] { "l forearm", "l upperarm" }, new string[2] { "r upperarm", "spine1" }, new string[2] { "r forearm", "r upperarm" }, new string[2] { "l thigh", "pelvis" }, new string[2] { "l calf", "l thigh" }, new string[2] { "r thigh", "pelvis" }, new string[2] { "r calf", "r thigh" } }; private static readonly Queue<GameObject> corpses = new Queue<GameObject>(); public static void Spawn(CharVisual v, Vector3 velocity) { //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Expected O, but got Unknown //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_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0284: 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_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: 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_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0350: 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_035d: Unknown result type (might be due to invalid IL or missing references) //IL_036c: 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_0379: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) Dictionary<string, Transform> dictionary = new Dictionary<string, Transform>(); string[][] array = parts; foreach (string[] array2 in array) { Transform val = v.Bone(array2[0]); if (!Object.op_Implicit((Object)(object)val)) { Plugin.Log.LogWarning((object)("RMADARA_RAGDOLL missing bone " + array2[0])); return; } dictionary[array2[0]] = val; } Transform presentation = v.Presentation; presentation.SetParent((Transform)null, true); if (Object.op_Implicit((Object)(object)v.Anim)) { v.Anim.Stop(); } v.Dying = true; ((Behaviour)v).enabled = false; Dictionary<string, Rigidbody> dictionary2 = new Dictionary<string, Rigidbody>(); array = parts; foreach (string[] array3 in array) { Transform val2 = dictionary[array3[0]]; ((Component)val2).gameObject.layer = LayerIndex.debris.intVal; Rigidbody val3 = ((Component)val2).gameObject.AddComponent<Rigidbody>(); val3.mass = ((array3[0] == "pelvis" || array3[0] == "spine1") ? 8 : 3); val3.drag = 0.2f; val3.angularDrag = 0.8f; val3.velocity = velocity * 0.6f + Vector3.up * 1.5f; Transform val4 = null; foreach (Transform item in val2) { Transform val5 = item; if (val5.childCount > 0 || ((Object)val5).name.Contains("hand") || ((Object)val5).name.Contains("foot")) { val4 = val5; break; } } CapsuleCollider obj = ((Component)val2).gameObject.AddComponent<CapsuleCollider>(); float num; Vector3 localPosition; if (!Object.op_Implicit((Object)(object)val4)) { num = 0.18f; } else { localPosition = val4.localPosition; num = ((Vector3)(ref localPosition)).magnitude; } float num2 = num; float num3 = Mathf.Max(0.01f, val2.lossyScale.x); obj.radius = ((array3[0] == "pelvis" || array3[0] == "spine1") ? 0.13f : ((array3[0] == "head") ? 0.11f : 0.06f)) / num3; obj.height = Mathf.Max(obj.radius * 2f, num2); Vector3 val6; if (!Object.op_Implicit((Object)(object)val4)) { val6 = Vector3.up; } else { localPosition = val4.localPosition; val6 = ((Vector3)(ref localPosition)).normalized; } Vector3 val7 = val6; obj.direction = ((!(Mathf.Abs(val7.x) > Mathf.Abs(val7.y))) ? ((Mathf.Abs(val7.y) > Mathf.Abs(val7.z)) ? 1 : 2) : ((!(Mathf.Abs(val7.x) > Mathf.Abs(val7.z))) ? 2 : 0)); obj.center = val7 * num2 * 0.5f; dictionary2[array3[0]] = val3; if (array3[1] != "") { CharacterJoint obj2 = ((Component)val2).gameObject.AddComponent<CharacterJoint>(); ((Joint)obj2).connectedBody = dictionary2[array3[1]]; obj2.enableProjection = true; SoftJointLimit lowTwistLimit = obj2.lowTwistLimit; ((SoftJointLimit)(ref lowTwistLimit)).limit = -30f; obj2.lowTwistLimit = lowTwistLimit; SoftJointLimit highTwistLimit = obj2.highTwistLimit; ((SoftJointLimit)(ref highTwistLimit)).limit = 30f; obj2.highTwistLimit = highTwistLimit; SoftJointLimit swing1Limit = obj2.swing1Limit; ((SoftJointLimit)(ref swing1Limit)).limit = 45f; obj2.swing1Limit = swing1Limit; } } Collider[] componentsInChildren = ((Component)presentation).GetComponentsInChildren<Collider>(); foreach (Collider val8 in componentsInChildren) { foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList) { if (Object.op_Implicit((Object)(object)readOnlyInstances)) { Collider[] componentsInChildren2 = ((Component)readOnlyInstances).GetComponentsInChildren<Collider>(); foreach (Collider val9 in componentsInChildren2) { Physics.IgnoreCollision(val8, val9); } } } } corpses.Enqueue(((Component)presentation).gameObject); while (corpses.Count > 4) { GameObject val10 = corpses.Dequeue(); if (Object.op_Implicit((Object)(object)val10)) { Object.Destroy((Object)(object)val10); } } Object.Destroy((Object)(object)((Component)presentation).gameObject, 14f); Plugin.Log.LogInfo((object)"RMADARA_RAGDOLL spawned"); } } public sealed class ForestCast : BaseSkillState { public const float Duration = 0.6f; public const float RootFor = 0.4f; private ActionPlay act; private Vector3 dir; public override void OnEnter() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); Ray aimRay = ((BaseState)this).GetAimRay(); dir = Aim.Flat(((Ray)(ref aimRay)).direction); if (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection)) { ((EntityState)this).characterDirection.forward = dir; } ((EntityState)this).characterBody.SetAimTimer(1.5f); ((BaseState)this).StartAimMode(1.5f, false); CharVisual charVisual = CharVisual.Find(((EntityState)this).characterBody); if (Object.op_Implicit((Object)(object)charVisual)) { act = new ActionPlay { clip = "spl1s", startF = 18f, endF = 44f, duration = 0.6f }; charVisual.PlayAction(act); } Snd.Voice(((EntityState)this).characterBody, "Forest", 3f); Snd.Sfx("Chakra_Burst", ((EntityState)this).gameObject); if (NetworkServer.active) { ForestActor.Spawn(((EntityState)this).characterBody, aimRay); } } public override void FixedUpdate() { //IL_0026: 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) ((EntityState)this).FixedUpdate(); if (((EntityState)this).fixedAge < 0.4f && Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((EntityState)this).characterMotor.moveDirection = Vector3.zero; if (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection)) { ((EntityState)this).characterDirection.forward = dir; } } if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= 0.6f) { ((EntityState)this).outer.SetNextStateToMain(); } } public override void OnExit() { CharVisual charVisual = CharVisual.Find(((EntityState)this).characterBody); if (Object.op_Implicit((Object)(object)charVisual) && act != null) { charVisual.EndAction(act); } ((EntityState)this).OnExit(); } public override InterruptPriority GetMinimumInterruptPriority() { if (((EntityState)this).fixedAge < 0.4f) { return (InterruptPriority)2; } return (InterruptPriority)1; } } public sealed class ForestActor : NetworkBehaviour { public static GameObject Prefab; public static int Casts; public static ForestActor Last; public static float Range = 45f; public static float Radius = 15f; public static float Height = 22f; public static float Erupt = 0.25f; public static float LashStart = 0.75f; public static float LashEnd = 13.75f; public static float Step = 0.5f; public static float Life = 16.4f; public static float EruptCoef = 3f; public static float LashCoefPerSec = 1.5f; public static float RootTime = 1.5f; public static float ForestRadius = 100f; public static float TreeReach = 9f; public static float FarSpacing = 7.5f; public static float GridCell = 9f; public static float LevelUp = 60f; public static float LevelDown = 60f; public static float MidRadius = 50f; public static int NearTrees = 10; public static int MidTrees = 28; public static int FarTrees = 34; public static int FarClusters = 9; public readonly List<Vector3> spots = new List<Vector3>(); public int nearCount; public static int PerStep = 10; public GameObject owner; public Vector3 center; public float startTime; public int seed; public readonly List<string> Log = new List<string>(); private bool erupted; private int ticks; private readonly HashSet<HealthComponent> rooted = new HashSet<HealthComponent>(); private readonly List<(HurtBox h, float coef, float proc, bool first)> queue = new List<(HurtBox, float, float, bool)>(); private bool crit; public float Age => (Object.op_Implicit((Object)(object)Run.instance) ? Run.instance.fixedTime : Time.fixedTime) - startTime; private CharacterBody Owner { get { if (!Object.op_Implicit((Object)(object)owner)) { return null; } return owner.GetComponent<CharacterBody>(); } } public static void Build() { //IL_0005: 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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_002e: Expected O, but got Unknown GameObject val = new GameObject("RMadaraForest"); val.AddComponent<NetworkIdentity>(); val.AddComponent<ForestActor>(); Prefab = PrefabAPI.InstantiateClone(val, "RMadaraForest", true); Object.DestroyImmediate((Object)val); Plugin.NetworkPrefabs.Add(Prefab); } public static Vector3 AimPoint(CharacterBody b, Ray aim, out string how) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_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_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_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_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) if (Combat.AimHit(aim, b, Range + 8f, out var best)) { Vector3 val = ((RaycastHit)(ref best)).point - b.footPosition; if (((Vector3)(ref val)).magnitude <= Range + 2f && Combat.TryGround(((RaycastHit)(ref best)).point + Vector3.up * 2f, 40f, out var g)) { how = "aim"; return g; } } Vector3 val2 = Aim.Flat(((Ray)(ref aim)).direction); float num = Range; if (Combat.AimHit(aim, b, 400f, out var best2)) { num = Mathf.Min(Range, Vector3.Distance(new Vector3(((RaycastHit)(ref best2)).point.x, 0f, ((RaycastHit)(ref best2)).point.z), new Vector3(b.footPosition.x, 0f, b.footPosition.z))); } if (Combat.TryGround(b.footPosition + val2 * num + Vector3.up * 20f, 60f, out var g2)) { how = "ahead"; return g2; } how = "under"; return Combat.Ground(b.footPosition + val2 * 6f + Vector3.up * 2f, 30f); } public unsafe static void Spawn(CharacterBody b, Ray aim) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) string text = "self"; Vector3 g; Vector3 val = (Combat.TryGround(b.footPosition + Vector3.up * 2f, 30f, out g) ? g : b.footPosition); GameObject val2 = Object.Instantiate<GameObject>(Prefab, val, Quaternion.identity); ForestActor component = val2.GetComponent<ForestActor>(); component.owner = ((Component)b).gameObject; component.center = val; component.seed = Random.Range(1, 1073741824); PickSpots(component, b.footPosition); component.startTime = (Object.op_Implicit((Object)(object)Run.instance) ? Run.instance.fixedTime : Time.fixedTime); NetworkServer.Spawn(val2); Casts++; Last = component; ManualLogSource log = Plugin.Log; string[] obj = new string[6] { "RMADARA_FOREST cast how=", text, " center=", null, null, null }; Vector3 val3 = val; obj[3] = ((object)(*(Vector3*)(&val3))/*cast due to .constrained prefix*/).ToString(); obj[4] = " dist="; obj[5] = Vector3.Distance(val, b.footPosition).ToString("0.0"); log.LogInfo((object)string.Concat(obj)); } private void Start() { Last = this; ((Component)this).gameObject.AddComponent<ForestLook>().actor = this; } private List<HurtBox> Gather(CharacterBody ob) { return Gather(ob, lash: false); } private List<HurtBox> Gather(CharacterBody ob, bool lash) { //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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) float num = (lash ? (ForestRadius + TreeReach) : Radius); List<HurtBox> list = new List<HurtBox>(); Combat.Capsule(ob, center - Vector3.up * 6f, center + Vector3.up * (Height + 6f), num + 1f, list, new HashSet<HealthComponent>()); if (!lash) { list.RemoveAll(delegate(HurtBox h) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Combat.Point(h, center) - center; float y = val.y; val.y = 0f; return ((Vector3)(ref val)).magnitude > Radius + (Object.op_Implicit((Object)(object)h.healthComponent.body) ? (h.healthComponent.body.radius * 0.5f) : 0f) || y < -4f || y > Height; }); return list; } list.RemoveAll(delegate(HurtBox h) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Combat.Point(h, center); float num2 = (Object.op_Implicit((Object)(object)h.healthComponent.body) ? (h.healthComponent.body.radius * 0.5f) : 0f); foreach (Vector3 spot in spots) { Vector3 val2 = val - spot; float y = val2.y; val2.y = 0f; if (((Vector3)(ref val2)).magnitude <= TreeReach + num2 && y >= -4f && y <= Height) { return false; } } return true; }); return list; } private static void PickSpots(ForestActor a, Vector3 ownerFoot) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_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_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_0217: 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_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0365: 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) Random rng = new Random(a.seed ^ 0x5F3759); Vector3 C = a.center; List<Vector3> list = a.spots; list.Clear(); for (int i = 0; i < 120; i++) { if (list.Count >= NearTrees) { break; } float num = Mathf.Lerp(4f, 14f, Mathf.Sqrt(R())); float num2 = R() * 6.2832f; Vector3 p0 = C + new Vector3(Mathf.Cos(num2), 0f, Mathf.Sin(num2)) * num; if (!list.Any((Vector3 s) => Flat(s, p0) < 4.6f) && Combat.TryGround(p0 + Vector3.up * 10f, 30f, out var g) && !(Mathf.Abs(g.y - C.y) > 9f) && Headroom(g) && !(Flat(g, ownerFoot) < 3.5f)) { list.Add(g); } } a.nearCount = list.Count; List<Vector3> list2 = new List<Vector3>(); float gridCell = GridCell; Vector3 val = default(Vector3); for (float num3 = 0f - ForestRadius; num3 <= ForestRadius; num3 += gridCell) { for (float num4 = 0f - ForestRadius; num4 <= ForestRadius; num4 += gridCell) { ((Vector3)(ref val))..ctor(num3 + (R() - 0.5f) * gridCell * 0.8f, 0f, num4 + (R() - 0.5f) * gridCell * 0.8f); float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < 13f || magnitude > ForestRadius) { continue; } RaycastHit[] array = Physics.RaycastAll(C + val + Vector3.up * LevelUp, Vector3.down, LevelUp + LevelDown, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1); for (int num5 = 0; num5 < array.Length; num5++) { RaycastHit val2 = array[num5]; if (((RaycastHit)(ref val2)).normal.y > 0.72f && TengaiScar.Visible(((RaycastHit)(ref val2)).collider) && Headroom(((RaycastHit)(ref val2)).point)) { list2.Add(((RaycastHit)(ref val2)).point); } } } } for (int num6 = list2.Count - 1; num6 > 0; num6--) { int index = rng.Next(num6 + 1); Vector3 value = list2[num6]; list2[num6] = list2[index]; list2[index] = value; } int num7 = 0; int num8 = 0; foreach (Vector3 g2 in list2) { float num9 = Flat(g2, C); bool isMid = num9 < MidRadius; if (!(isMid ? (num7 >= MidTrees) : (num8 >= FarTrees)) && !list.Any((Vector3 s) => Flat(s, g2) < (isMid ? 6.5f : 8f) && Mathf.Abs(s.y - g2.y) < 9f) && !(Flat(g2, ownerFoot) < 6f)) { list.Add(g2); if (isMid) { num7++; } else { num8++; } if (num7 >= MidTrees && num8 >= FarTrees) { break; } } } a.Log.Add("FOREST spots near=" + a.nearCount + " mid=" + num7 + " far=" + num8 + " candidates=" + list2.Count + " levels(min/max dy)=" + ((list.Count > 0) ? (list.Min((Vector3 s) => s.y - C.y).ToString("0") + "/" + list.Max((Vector3 s) => s.y - C.y).ToString("0")) : "-")); float R() { return (float)rng.NextDouble(); } } private static bool Headroom(Vector3 p) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_0024: Unknown result type (might be due to invalid IL or missing references) return !Physics.Raycast(p + Vector3.up * 0.6f, Vector3.up, 6f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1); } private static float Flat(Vector3 a, Vector3 b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) return Vector2.Distance(new Vector2(a.x, a.z), new Vector2(b.x, b.z)); } private void FixedUpdate() { if (!NetworkServer.active) { return; } float age = Age; CharacterBody val = Owner; if (Object.op_Implicit((Object)(object)val) && !erupted && age >= Erupt) { erupted = true; crit = val.RollCrit(); foreach (HurtBox item in Gather(val)) { queue.Add((item, EruptCoef, 1f, true)); } Log.Add("FOREST erupt targets=" + queue.Count); } if (Object.op_Implicit((Object)(object)val) && age >= LashStart + Step * (float)ticks && age <= LashEnd + 0.01f) { ticks++; crit = val.RollCrit(); List<HurtBox> list = Gather(val, lash: true); foreach (HurtBox item2 in list) { queue.Add((item2, LashCoefPerSec * Step, 0.5f, false)); } if (ticks <= 2 || ticks % 4 == 0) { Log.Add("FOREST tick=" + ticks + " targets=" + list.Count); } } int num = 0; while (Object.op_Implicit((Object)(object)val) && queue.Count > 0 && num < PerStep) { (HurtBox, float, float, bool) tuple = queue[0]; queue.RemoveAt(0); num++; Hit(val, tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4); } if (age >= Life) { NetworkServer.Destroy(((Component)this).gameObject); } } private void Hit(CharacterBody ob, HurtBox h, float coef, float proc, bool erupt) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_019d: 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) if (!Object.op_Implicit((Object)(object)h) || !Object.op_Implicit((Object)(object)h.healthComponent) || !h.healthComponent.alive) { return; } CharacterBody body = h.healthComponent.body; Combat.Source = (erupt ? "ForestErupt" : "ForestLash"); bool flag = Combat.Deal(ob, h, Combat.Point(h, center), coef, proc, crit, Vector3.zero, (DamageType)0, null, (DamageColorIndex)0); if (Object.op_Implicit((Object)(object)body)) { if (Combat.IsHeavy(body) || (!Object.op_Implicit((Object)(object)body.characterMotor) && !Object.op_Implicit((Object)(object)body.rigidbody))) { if (body.healthComponent.alive) { body.AddTimedBuff(Buffs.Slow50, Step + 0.6f); } } else { if (erupt) { SetStateOnHurt component = ((Component)body).GetComponent<SetStateOnHurt>(); if (Object.op_Implicit((Object)(object)component) && component.canBeStunned) { component.SetStun(0.5f); } } if (rooted.Add(h.healthComponent) && body.healthComponent.alive) { body.AddTimedBuff(Buffs.Entangle, RootTime); } } } string text = "FOREST " + (erupt ? "erupt" : "lash") + " victim=" + (Object.op_Implicit((Object)(object)body) ? ((Object)body).name.Replace("(Clone)", "") : ((Object)h.healthComponent).name) + " team=" + ((Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.teamComponent)) ? ((object)body.teamComponent.teamIndex/*cast due to .constrained prefix*/).ToString() : "?") + " ok=" + flag + " t=" + Age.ToString("0.00"); if (Log.Count < 300) { Log.Add(text); } Combat.Trace?.Invoke(text); } public override bool OnSerialize(NetworkWriter w, bool initial) { //IL_000e: 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) //IL_0064: 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) w.Write(owner); w.Write(center); w.Write(startTime); w.Write(seed); w.Write((byte)nearCount); w.Write((byte)spots.Count); foreach (Vector3 spot in spots) { w.Write(spot); } return true; } public override void OnDeserialize(NetworkReader r, bool initial) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) owner = r.ReadGameObject(); center = r.ReadVector3(); startTime = r.ReadSingle(); seed = r.ReadInt32(); nearCount = r.ReadByte(); int num = r.ReadByte(); spots.Clear(); for (int i = 0; i < num; i++) { spots.Add(r.ReadVector3()); } } } public sealed class ForestLook : MonoBehaviour { private sealed class Branch { public bool thick; public bool fork; public GrowLimb limb; public float h; public float start; public float yaw; public float pitch; public GameObject leaf; public float leafS; public float leafR; public float whipT0 = -9f; } private sealed class Tree { public CapsuleCollider col; public int idx; public bool far; public bool settled; public bool frozenOn; public readonly List<GameObject> frozen = new List<GameObject>(); public GrowLimb trunk; public List<Branch> branches = new List<Branch>(); public GameObject top; public float topS; public List<(GameObject g, float s)> roots = new List<(GameObject, float)>(); public float delay; public float H; public float R; public float lean; public int kind; public readonly List<GrowLimb> arcs = new List<GrowLimb>(); public Vector3 basePos; public List<Renderer> rends = new List<Renderer>(); } private sealed class Spike { public Transform t; public float s; public float delay; public float len; } private sealed class Vine { public GrowLimb limb; public float born; public CharacterBody body; public bool whip; public Vector3 from; } public ForestActor actor; public static bool TreeRun = true; public static float LeafNear = 6f; public static float LeafRange = 6f; public static float LeafRangeClimb = 8f; public static float MaxTilt = 15f; public static float ColliderNear = 4f; public static float ColliderRadius = 0.8f; public static int MaxTrees = 9; public static int Spikes = 14; public static float GrowT = 1.15f; public static float WitherAt = 13.8f; public static float WitherT = 1.5f; public static float NearFadeAt = 4.5f; public static float LeanMin = 15f; public static float LeanMax = 35f; public static float LeanRecover = 14f; public static float TwistCurl = 11f; public static float HorizMin = 72f; public static float HorizMax = 86f; public static float ArcLenMin = 4.5f; public static float ArcLenMax = 8.5f; public static float ArcCurl = 95f; public static float ArcStart = 68f; public static float ColliderMaxLean = 18f; private readonly List<Tree> trees = new List<Tree>(); private readonly List<Spike> spikes = new List<Spike>(); private readonly List<Vine> vines = new List<Vine>(); private readonly HashSet<CharacterBody> bound = new HashSet<CharacterBody>(); private GameObject root; private Material bark; private ParticleSystem leafFall; private int lashTick; private bool fxErupt; private bool fxWither; public static string LastInfo = ""; private float minFade = 1f; public static readonly List<ForestLook> Live = new List<ForestLook>(); private float shatterAt = -1f; private readonly Queue<int> pendingFar = new Queue<int>(); private Action<int> makeFar; private static float Flat2(Vector3 a, Vector3 b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) return Vector2.Distance(new Vector2(a.x, a.z), new Vector2(b.x, b.z)); } private void Start() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: 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_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0357: 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_0440: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: 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_0211: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) root = new GameObject("RMadaraForestLook"); Random rng = new Random(actor.seed); Vector3 C = actor.center; bark = new Material(WoodKit.Bark); CharacterBody ob = (Object.op_Implicit((Object)(object)actor.owner) ? actor.owner.GetComponent<CharacterBody>() : null); Vector3 ownerFoot = (Object.op_Implicit((Object)(object)ob) ? ob.footPosition : (C + Vector3.one * 999f)); List<Vector3> spots = actor.spots; for (int i = 0; i < spots.Count; i++) { if (i < actor.nearCount) { Make(i); } else { pendingFar.Enqueue(i); } } makeFar = Make; Vector3 val = default(Vector3); for (int j = 0; j < Spikes; j++) { float num = Mathf.Lerp(1.5f, 14f, Mathf.Sqrt(R())); float num2 = R() * 6.2832f; ((Vector3)(ref val))..ctor(Mathf.Cos(num2), 0f, Mathf.Sin(num2)); if (Combat.TryGround(C + val * num + Vector3.up * 8f, 25f, out var g) && !(Vector3.Distance(new Vector3(g.x, 0f, g.z), new Vector3(ownerFoot.x, 0f, ownerFoot.z)) < 5f)) { string name = WoodKit.Spikes[j % WoodKit.Spikes.Length]; GameObject val2 = WoodKit.Piece(name, root.transform, "spike"); val2.transform.position = g - Vector3.up * 0.5f; val2.transform.rotation = WoodDragonLook.Tilt(val, Mathf.Lerp(12f, 38f, R())); val2.transform.localScale = Vector3.zero; float num3 = Mathf.Lerp(3.5f, 7f, R()); spikes.Add(new Spike { t = val2.transform, len = num3, s = WoodKit.ScaleFor(name, num3), delay = 0.03f + num / 14f * 0.22f + R() * 0.05f }); } } leafFall = TengaiLook.Ps(root.transform, WoodKit.Lit("Storm_3hsmeff1_leaf01_0.png", WoodKit.LeafTint), Color.white, 0.14f, 0.3f, 2.2f, 3.2f, 0f, 260, (ParticleSystemSimulationSpace)1); MainModule main = leafFall.main; ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(0.18f); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(0.5f, 2f); ParticleSystemRenderer component = ((Component)leafFall).GetComponent<ParticleSystemRenderer>(); ((Renderer)component).sharedMaterial = Fx.AlphaTex((Texture)(object)Fx.Soft); ((Renderer)component).sharedMaterial.SetColor("_TintColor", new Color(0.13f, 0.24f, 0.08f, 0.85f)); Plugin.Log.LogInfo((object)("RMADARA_FOREST look trees=" + trees.Count + " near=" + actor.nearCount + " far=" + (trees.Count - actor.nearCount) + " spikes=" + spikes.Count + " ownerInside=" + (Vector3.Distance(ownerFoot, C) < ForestActor.Radius))); Drive(actor.Age); void Make(int si) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invali