Decompiled source of MarvelPrototype v0.23.0
BepInEx/plugins/MarvelPrototype/MarvelPrototype.dll
Decompiled a week 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.Reflection.Emit; using System.Runtime.CompilerServices; using System.Text; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyFileVersion("0.23.0.0")] [assembly: AssemblyVersion("0.23.0.0")] namespace MarvelPrototype; public static class ArgumentBridge { private sealed class Entry { public MethodInfo Target; public Action<object, MethodBase, object[]> Handler; } private static readonly List<Entry> Entries = new List<Entry>(); private static ModuleBuilder module; public static MethodInfo Create(MethodInfo target, Action<object, MethodBase, object[]> handler) { if (module == null) { module = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("MarvelPrototype.StatusBridges"), AssemblyBuilderAccess.Run).DefineDynamicModule("StatusBridges"); } int count = Entries.Count; Entries.Add(new Entry { Target = target, Handler = handler }); ParameterInfo[] parameters = target.GetParameters(); Type[] array = new Type[parameters.Length + 1]; array[0] = typeof(object); for (int i = 0; i < parameters.Length; i++) { array[i + 1] = (parameters[i].ParameterType.IsByRef ? parameters[i].ParameterType : parameters[i].ParameterType.MakeByRefType()); } TypeBuilder typeBuilder = module.DefineType("Prefix" + count, TypeAttributes.Public | TypeAttributes.Abstract | TypeAttributes.Sealed); MethodBuilder methodBuilder = typeBuilder.DefineMethod("Before", MethodAttributes.Public | MethodAttributes.Static, typeof(void), array); methodBuilder.DefineParameter(1, ParameterAttributes.None, "__instance"); for (int j = 0; j < parameters.Length; j++) { methodBuilder.DefineParameter(j + 2, ParameterAttributes.None, parameters[j].Name); } ILGenerator iLGenerator = methodBuilder.GetILGenerator(); LocalBuilder local = iLGenerator.DeclareLocal(typeof(object[])); iLGenerator.Emit(OpCodes.Ldc_I4, parameters.Length); iLGenerator.Emit(OpCodes.Newarr, typeof(object)); iLGenerator.Emit(OpCodes.Stloc, local); for (int k = 0; k < parameters.Length; k++) { Type elementType = array[k + 1].GetElementType(); iLGenerator.Emit(OpCodes.Ldloc, local); iLGenerator.Emit(OpCodes.Ldc_I4, k); iLGenerator.Emit(OpCodes.Ldarg, (short)(k + 1)); iLGenerator.Emit(OpCodes.Ldobj, elementType); if (elementType.IsValueType) { iLGenerator.Emit(OpCodes.Box, elementType); } iLGenerator.Emit(OpCodes.Stelem_Ref); } iLGenerator.Emit(OpCodes.Ldc_I4, count); iLGenerator.Emit(OpCodes.Ldarg_0); iLGenerator.Emit(OpCodes.Ldloc, local); iLGenerator.Emit(OpCodes.Call, typeof(ArgumentBridge).GetMethod("Dispatch")); for (int l = 0; l < parameters.Length; l++) { Type elementType2 = array[l + 1].GetElementType(); iLGenerator.Emit(OpCodes.Ldarg, (short)(l + 1)); iLGenerator.Emit(OpCodes.Ldloc, local); iLGenerator.Emit(OpCodes.Ldc_I4, l); iLGenerator.Emit(OpCodes.Ldelem_Ref); iLGenerator.Emit(elementType2.IsValueType ? OpCodes.Unbox_Any : OpCodes.Castclass, elementType2); iLGenerator.Emit(OpCodes.Stobj, elementType2); } iLGenerator.Emit(OpCodes.Ret); return typeBuilder.CreateType().GetMethod("Before"); } public static void Dispatch(int id, object instance, object[] args) { Entry entry = Entries[id]; entry.Handler(instance, entry.Target, args); } } [DefaultExecutionOrder(24)] public sealed class BlackWidowCombatAI : MonoBehaviour { internal UnitRef Self; internal UnitRef Target; internal BlackWidowVisual Visual; internal BlackWidowMotor Motor; internal WidowsBiteSystem Bite; internal readonly WidowCombatClock Clock = new WidowCombatClock(); private BlackWidowMeleeSystem melee; private WidowTakedown takedown; private WidowGrapplingLine grapple; internal MarvelInteractionScene Interaction; internal float CalmReady; internal float TeamReady; private SpiderAbilityControl control; private WebStatus status; private bool locked; private bool overridden; private bool initialized; private bool cleaned; private float think; private float lastHP; private float staggerUntil; private float nextShot; private int shots; private int moves; private Vector3 facing; private Vector3 travel; private bool fired; internal Vector3 Facing { get { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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) if (!(((Vector3)(ref facing)).sqrMagnitude > 0.01f)) { if (Self == null) { return Vector3.forward; } return Self.Forward; } return facing; } } internal bool Ready { get { if (initialized && !cleaned && Self != null && Self.Alive && Self.Active && Clock.Free && !Object.op_Implicit((Object)(object)Interaction) && !Disabled && Upright) { return !R.Get(Self.API, "IsRemotelyControlled", fallback: false); } return false; } } internal bool Upright { get { //IL_0045: 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_0083: 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) if (Self != null && Motor != null && Object.op_Implicit((Object)(object)Self.Main) && Object.op_Implicit((Object)(object)Motor.Head) && Motor.Head.position.y > Self.Main.position.y + 0.25f * Self.Scale) { Vector3 velocity = Self.Main.velocity; return ((Vector3)(ref velocity)).magnitude < 11f; } return false; } } private bool Disabled { get { if ((!Object.op_Implicit((Object)(object)status) || (!status.Held && !status.Shock && !status.Blind)) && !(Time.time < staggerUntil)) { if (Self != null && Object.op_Implicit((Object)(object)Self.Main)) { return Self.Main.isKinematic; } return false; } return true; } } internal void Initialize(UnitRef u, BlackWidowVisual v, BlackWidowMotor m) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) Self = u; Visual = v; Motor = m; facing = u.Forward; control = SpiderAbilityControl.For(u); status = WebStatus.For(u); Bite = ((Component)this).gameObject.AddComponent<WidowsBiteSystem>(); Bite.Widow = this; melee = new BlackWidowMeleeSystem(this); lastHP = R.Get(u.Data, "health", 720f); CalmReady = Time.time + 2f; TeamReady = Time.time + 3f; initialized = true; } private void Acquire() { if (!locked) { control.Acquire(actor: true); locked = true; } if (!overridden) { status.PhysicsOverrides++; overridden = true; } Motor.Begin(); } private void Unlock() { if (locked && Object.op_Implicit((Object)(object)control)) { control.Release(actor: true); } locked = false; if (overridden && Object.op_Implicit((Object)(object)status)) { status.PhysicsOverrides = Math.Max(0, status.PhysicsOverrides - 1); } overridden = false; } private void Update() { //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0238: 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_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_029c: 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_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: 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_037a: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: 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) if (!initialized || cleaned) { return; } try { if (Self == null || !Object.op_Implicit((Object)(object)Self.Unit) || !Self.Alive) { if (Object.op_Implicit((Object)(object)Interaction)) { Interaction.Cancel(); } FinishAction(); Clock.Die(); Unlock(); Motor.Dispose(restore: false); return; } if (!World.InBattle || !Self.Active || R.Get(Self.API, "IsRemotelyControlled", fallback: false)) { if (Object.op_Implicit((Object)(object)Interaction)) { Interaction.Cancel(); } FinishAction(); Unlock(); return; } Acquire(); float num = R.Get(Self.Data, "health", lastHP); float num2 = Mathf.Max(0f, lastHP - num); lastHP = num; if (num2 >= 100f) { staggerUntil = Time.time + 0.32f; if (Object.op_Implicit((Object)(object)Interaction)) { Interaction.Cancel(); } FinishAction(); } if (Disabled) { if (Object.op_Implicit((Object)(object)Interaction)) { Interaction.Cancel(); } FinishAction(); } else { if (Object.op_Implicit((Object)(object)Interaction)) { return; } if (Clock.Expired(Time.time)) { FinishAction(); } if (Time.time < think) { return; } think = Time.time + 0.065f; Target = Resolve(); if (Target == null) { FinishAction(); return; } Vector3 val = UnitRef.Flat(Target.Position - Self.Position); if (((Vector3)(ref val)).sqrMagnitude > 0.01f) { facing = ((Vector3)(ref val)).normalized; } BlackWidowVisual visual = Visual; Vector3 val2 = Aim(Target) - Visual.Hand(left: false); visual.Aim = ((Vector3)(ref val2)).normalized; if (!Clock.Free) { return; } Vector3 incoming; bool heavy; bool flag = Threat(out incoming, out heavy); WidowSituation s = Situation(flag, heavy); if (flag && s.Distance < 3.2f && Clock.Available(WidowAttack.Counter, Time.time) && StartAttack(WidowAttack.Counter)) { travel = Vector3.Cross(Vector3.up, incoming) * (float)((Self.Id % 2 == 0) ? 1 : (-1)); } else if (flag && !Clock.AttackRequired && Time.time - Clock.LastAttack <= 1.6f && Clock.Evade(Time.time, heavy && s.Distance < 4f)) { moves++; int num3 = moves % 4; Clock.End = Time.time + ((num3 == 0 || num3 == 3) ? 0.68f : 0.45f); Vector3 normalized; if (num3 != 3 || heavy || !(s.Distance < 3.5f)) { val2 = Vector3.Cross(Vector3.up, incoming) * (float)((Self.Id % 2 == 0) ? 1 : (-1)) - incoming * 0.18f; normalized = ((Vector3)(ref val2)).normalized; } else { normalized = Facing; } travel = normalized; Motor.Jump(travel, (num3 == 3) ? 5.7f : (heavy ? 3.5f : 1.5f), num3 switch { 2 => 0f, 3 => 4.2f, 0 => 1.9f, _ => 1.3f, }); } else { WidowAttack? widowAttack = Clock.Select(s, Time.time); if (widowAttack.HasValue) { StartAttack(widowAttack.Value); } } } } catch (Exception ex) { Launcher.WarnOnce("widow_update_" + Self.Id, "Black Widow action canceled: " + ex); if (Object.op_Implicit((Object)(object)Interaction)) { Interaction.Cancel(); } FinishAction(); } } private UnitRef Resolve() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) return World.Enemies(Self, Self.Position, 10000f).OrderBy(delegate(UnitRef u) { //IL_0001: 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_002c: 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) float num = Vector3.Distance(u.Position, Self.Position); return (!(num < 4f)) ? (num + (float)((!World.ClearPath(Self, Self.Position, Aim(u), u, terrainOnly: true)) ? 10 : 0) - (float)((u.WeaponReach > 5f) ? 3 : 0) + (float)((u.Health > 3000f) ? 2 : 0)) : (num - 50f); }).FirstOrDefault(); } internal static Vector3 Aim(UnitRef u) { //IL_001a: 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) if (!Object.op_Implicit((Object)(object)u.Torso)) { return u.Position; } return u.Torso.position; } private WidowSituation Situation(bool threat, bool heavy) { //IL_0022: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) Motor.Native.FindFloor(); UnitRef[] source = World.Enemies(Self, Self.Position, 25f).ToArray(); WebStatus component = Target.Unit.GetComponent<WebStatus>(); WidowSituation result = new WidowSituation { Distance = Vector3.Distance(Self.Position, Target.Position) / Self.Scale, MassRatio = HulkCombat.Mass(Target) / Mathf.Max(1f, HulkCombat.Mass(Self)), HeightRatio = Target.Scale / Self.Scale, EnemyHP = Target.Health }; float enemySpeed; if (!Object.op_Implicit((Object)(object)Target.Main)) { enemySpeed = 0f; } else { Vector3 val = UnitRef.Flat(Target.Main.velocity); enemySpeed = ((Vector3)(ref val)).magnitude; } result.EnemySpeed = enemySpeed; result.Crowd = source.Count((UnitRef u) => Vector3.Distance(u.Position, Self.Position) < 6f * Self.Scale); result.Ranged = source.Count((UnitRef u) => u.WeaponReach > 5f); result.Threat = threat; result.HeavyThreat = heavy; result.CanGrapple = WidowTakedown.Can(this, Target); result.Clear = World.ClearPath(Self, Visual.Hand(left: false), Aim(Target), Target, terrainOnly: true); result.Grounded = Motor.Grounded; result.Staggered = Object.op_Implicit((Object)(object)component) && (component.Shock || component.Snared); return result; } private bool Threat(out Vector3 incoming, out bool heavy) { //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_003e: 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_0043: 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_01ba: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015b: 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_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_034b: 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_0355: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) incoming = Facing; heavy = false; ProjectileTracker.Refresh(); Vector3 val = (Object.op_Implicit((Object)(object)Motor.Torso) ? Motor.Torso.position : Self.Position); float num = 0.61f; bool flag = false; Vector3 val4; foreach (FlightRef flight in ProjectileTracker.Flights) { if (!Object.op_Implicit((Object)(object)flight.Transform) || (flight.Owner != null && flight.Owner.Team == Self.Team)) { continue; } Vector3 val2 = flight.Velocity - (Object.op_Implicit((Object)(object)Self.Main) ? Self.Main.velocity : Vector3.zero); float magnitude = ((Vector3)(ref val2)).magnitude; if (!(magnitude < 3f)) { Vector3 val3 = val - flight.Transform.position; float num2 = Vector3.Dot(val3, val2) / ((Vector3)(ref val2)).sqrMagnitude; val4 = val3 - val2 * num2; float magnitude2 = ((Vector3)(ref val4)).magnitude; if (num2 < num && WidowRules.ProjectileThreat(num2, magnitude2, magnitude, Self.Scale)) { num = num2; val4 = flight.Transform.position - val; incoming = ((Vector3)(ref val4)).normalized; heavy = Object.op_Implicit((Object)(object)flight.Body) && flight.Body.mass > 3f; flag = true; } } } if (flag) { return true; } foreach (UnitRef item in World.Enemies(Self, Self.Position, 26f)) { Vector3 val5 = UnitRef.Flat(Self.Position - item.Position); if (item.WeaponReach > 5f && ((Vector3)(ref val5)).magnitude > 4f && Vector3.Dot(item.Forward, ((Vector3)(ref val5)).normalized) > 0.94f && (Object)(object)R.Get<Rigidbody>(item.Data, "targetMainRig") == (Object)(object)Self.TargetBody) { incoming = -((Vector3)(ref val5)).normalized; return true; } if (((Vector3)(ref val5)).magnitude > 3.3f * Self.Scale) { continue; } float num3 = HulkCombat.Mass(item) / Mathf.Max(1f, HulkCombat.Mass(Self)); if (Object.op_Implicit((Object)(object)item.Main) && Vector3.Dot(item.Main.velocity, ((Vector3)(ref val5)).normalized) > 3.5f) { incoming = -((Vector3)(ref val5)).normalized; heavy = num3 > 2.15f; return true; } Transform[] array = (Transform[])(object)new Transform[2] { item.LeftHand, item.RightHand }; foreach (Transform val6 in array) { Rigidbody val7 = item.LimbBody(val6); if (Object.op_Implicit((Object)(object)val7)) { Vector3 pointVelocity = val7.GetPointVelocity(val6.position); val4 = val - val6.position; if (Vector3.Dot(pointVelocity, ((Vector3)(ref val4)).normalized) > 2.8f) { val4 = val6.position - val; incoming = ((Vector3)(ref val4)).normalized; heavy = num3 > 2.15f; return true; } } } } return false; } private bool StartAttack(WidowAttack attack) { //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) if (!Clock.Enter(attack, Time.time)) { return false; } fired = false; shots = 0; nextShot = Time.time + 0.18f; Visual.Switch(WidowRules.Weapon(attack)); if (attack == WidowAttack.Takedown || attack == WidowAttack.BiteGrapple || attack == WidowAttack.ArmLock) { goto IL_009b; } if (attack == WidowAttack.Counter && WidowTakedown.Can(this, Target) && Object.op_Implicit((Object)(object)Target.Main)) { Vector3 velocity = Target.Main.velocity; if (((Vector3)(ref velocity)).magnitude > 3.5f) { goto IL_009b; } } switch (attack) { case WidowAttack.Grapple: grapple = ((Component)this).gameObject.AddComponent<WidowGrapplingLine>(); if (!grapple.Begin(this, WidowTakedown.Can(this, Target) ? Target : null)) { grapple.Stop(); grapple = null; Clock.Finish(); return false; } Clock.RetreatReady = Time.time + 7f; break; case WidowAttack.Smoke: travel = SafeSide(away: true); break; default: melee.Begin(attack, Target); break; case WidowAttack.Bite: case WidowAttack.Pistols: break; } goto IL_0185; IL_0185: return true; IL_009b: takedown = ((Component)this).gameObject.AddComponent<WidowTakedown>(); if (!takedown.Begin(this, Target, attack)) { takedown.Stop(); takedown = null; Clock.Finish(); return false; } goto IL_0185; } private Vector3 SafeSide(bool away) { //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_000b: 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_0032: 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_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_0052: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c3: 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_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.Cross(Vector3.up, Facing) * (float)((Self.Id % 2 == 0) ? 1 : (-1)); Vector3[] array = new Vector3[3]; Vector3 val2 = val - Facing * (away ? 0.25f : 0f); array[0] = ((Vector3)(ref val2)).normalized; val2 = -val - Facing * (away ? 0.25f : 0f); array[1] = ((Vector3)(ref val2)).normalized; array[2] = Facing; Vector3[] array2 = (Vector3[])(object)array; foreach (Vector3 val3 in array2) { if (World.GroundBelow(Self.Position + val3 * 1.3f * Self.Scale, 3.3f * Self.Scale, out var _) && World.ClearPath(Self, Self.Position, Self.Position + val3 * 1.3f * Self.Scale, Target, terrainOnly: true)) { return val3; } } return Facing; } private void FixedUpdate() { //IL_0097: 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_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_0264: 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_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_034b: 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_021e: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_06af: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_0629: Unknown result type (might be due to invalid IL or missing references) //IL_0634: Unknown result type (might be due to invalid IL or missing references) //IL_0439: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Unknown result type (might be due to invalid IL or missing references) //IL_0445: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Unknown result type (might be due to invalid IL or missing references) //IL_045d: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0464: Unknown result type (might be due to invalid IL or missing references) //IL_0474: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_047e: Unknown result type (might be due to invalid IL or missing references) //IL_0485: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_049a: Unknown result type (might be due to invalid IL or missing references) //IL_04ba: Unknown result type (might be due to invalid IL or missing references) //IL_04bb: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04d1: Unknown result type (might be due to invalid IL or missing references) //IL_04d6: Unknown result type (might be due to invalid IL or missing references) //IL_04db: Unknown result type (might be due to invalid IL or missing references) //IL_04e2: Unknown result type (might be due to invalid IL or missing references) //IL_04f2: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Unknown result type (might be due to invalid IL or missing references) //IL_0582: Unknown result type (might be due to invalid IL or missing references) //IL_058d: Unknown result type (might be due to invalid IL or missing references) //IL_05b8: Unknown result type (might be due to invalid IL or missing references) //IL_05b0: Unknown result type (might be due to invalid IL or missing references) //IL_0671: Unknown result type (might be due to invalid IL or missing references) //IL_0669: Unknown result type (might be due to invalid IL or missing references) //IL_05bd: Unknown result type (might be due to invalid IL or missing references) //IL_05c5: Unknown result type (might be due to invalid IL or missing references) //IL_0676: Unknown result type (might be due to invalid IL or missing references) //IL_067e: Unknown result type (might be due to invalid IL or missing references) //IL_0694: Unknown result type (might be due to invalid IL or missing references) //IL_05ee: Unknown result type (might be due to invalid IL or missing references) if (!initialized || cleaned || Self == null || !Self.Alive || !World.InBattle || !Object.op_Implicit((Object)(object)Self.Main) || !locked) { return; } try { if (Disabled) { if (Object.op_Implicit((Object)(object)Interaction)) { Interaction.Cancel(); } FinishAction(); Motor.Limit(); } else { if (Object.op_Implicit((Object)(object)Interaction)) { return; } Motor.Turn(Facing); bool flag = Object.op_Implicit((Object)(object)takedown) || (Clock.Attack == WidowAttack.JumpKick && Clock.State == WidowState.MeleeCombat); float crouch = ((Clock.State != WidowState.Dodge) ? 1f : ((moves % 3 == 0) ? 0.38f : 0.73f)); if (Clock.State == WidowState.Dodge) { Motor.Acrobatics(Facing, moves % 4, Mathf.Clamp01((Time.time - Clock.Start) / Mathf.Max(0.1f, Clock.End - Clock.Start))); } else { Motor.Hold(Facing, crouch, !flag); } Motor.Hands(Facing); if (Object.op_Implicit((Object)(object)takedown)) { takedown.Step(); } else if (Object.op_Implicit((Object)(object)grapple)) { grapple.Step(); } else if (melee.Running) { if (Target != null && Target.Alive && Vector3.Distance(Self.Position, Target.Position) > 1.55f * Self.Scale) { Motor.Drive(Facing, 4.8f, Target); } if (Clock.State == WidowState.Counter) { Motor.Drive(travel, 4.5f, Target); } Motor.Gait(Facing, 0f); melee.Step(); } else if (Clock.State == WidowState.Dodge) { Motor.Drive(travel, 6f); if (moves % 4 == 2) { Motor.Gait(Facing, 6f, 0.42f); } } else if (Clock.State == WidowState.SmokeReposition) { if (!fired) { fired = true; Bite.Launch(WidowProjectileKind.Smoke, Visual.Hand(left: true), Self.Position + Facing * 1.2f - Vector3.up * 0.65f * Self.Scale); } Motor.Drive(travel, 5.7f, Target); Motor.Gait(Facing, 5.7f, 0.72f); } else if (Clock.State == WidowState.PistolCombat || Clock.State == WidowState.WidowsBite) { if (Target == null || !Target.Alive) { FinishAction(); return; } Vector3 val = Aim(Target) - Visual.Hand(left: false); Vector3 normalized = ((Vector3)(ref val)).normalized; Visual.Aim = normalized; Vector3 val2 = (Object.op_Implicit((Object)(object)Motor.Torso) ? Motor.Torso.position : Self.Position); Vector3 val3 = Vector3.Cross(Vector3.up, Facing); Motor.Pose(Motor.Left, val2 + normalized * 0.58f * Self.Scale - val3 * 0.2f * Self.Scale); Motor.Pose(Motor.Right, val2 + normalized * 0.59f * Self.Scale + val3 * 0.2f * Self.Scale); Visual.Align(); if (Time.time >= nextShot) { nextShot = Time.time + 0.19f; bool flag2 = Clock.State == WidowState.WidowsBite; if (shots < (flag2 ? 1 : 4)) { Bite.Fire(shots % 2 == 0, Target, flag2); shots++; } } float num = Vector3.Distance(Self.Position, Target.Position) / Self.Scale; Vector3 direction = ((num > 16f) ? Facing : SafeSide(away: false)); Motor.Drive(direction, (num > 16f) ? 5.5f : 2.5f, Target); Motor.Gait(Facing, 2.5f); } else if (Target != null && Target.Alive) { float num2 = Vector3.Distance(Self.Position, Target.Position) / Self.Scale; float speed = ((num2 > 2.2f) ? 6.4f : 1.8f); Vector3 direction2 = ((num2 > 2.2f) ? Facing : SafeSide(away: false)); Motor.Drive(direction2, speed, Target); Motor.Gait(Facing, speed); } else { Motor.Gait(Facing, 0f); } Visual.Align(); Motor.Limit(); } } catch (Exception ex) { Launcher.WarnOnce("widow_fixed_" + Self.Id, "Black Widow physical action canceled: " + ex); if (Object.op_Implicit((Object)(object)Interaction)) { Interaction.Cancel(); } FinishAction(); Motor.Limit(); } } internal bool Reserve(MarvelInteractionScene scene, WidowState state, float seconds) { if (!Ready || !Object.op_Implicit((Object)(object)scene)) { return false; } FinishAction(); Interaction = scene; Clock.State = state; Clock.Start = Time.time; Clock.End = Time.time + seconds; return true; } internal void Release(MarvelInteractionScene scene) { if (!((Object)(object)Interaction != (Object)(object)scene)) { Interaction = null; Clock.Finish(); Clock.AttackRequired = true; } } internal void Face(Vector3 point) { //IL_0000: 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_0011: 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_0038: 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_0045: 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_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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = UnitRef.Flat(point - Self.Position); if (((Vector3)(ref val)).sqrMagnitude > 0.01f) { facing = ((Vector3)(ref val)).normalized; } BlackWidowVisual visual = Visual; Vector3 val2 = point - Visual.Hand(left: false); visual.Aim = ((Vector3)(ref val2)).normalized; } internal void TakedownFinished(WidowTakedown a) { if (!((Object)(object)takedown != (Object)(object)a)) { takedown = null; Clock.Finish(); Clock.AttackRequired = true; } } internal void GrappleFinished(WidowGrapplingLine a) { if (!((Object)(object)grapple != (Object)(object)a)) { grapple = null; Clock.Finish(); Clock.AttackRequired = true; } } internal void FinishAction() { if (Object.op_Implicit((Object)(object)takedown)) { WidowTakedown widowTakedown = takedown; takedown = null; widowTakedown.Stop(); } if (Object.op_Implicit((Object)(object)grapple)) { WidowGrapplingLine widowGrapplingLine = grapple; grapple = null; widowGrapplingLine.Stop(); } if (melee != null) { melee.Stop(); } Clock.Finish(); } private void Cleanup() { if (!cleaned) { cleaned = true; if (Object.op_Implicit((Object)(object)Interaction)) { Interaction.Cancel(); } FinishAction(); if (Object.op_Implicit((Object)(object)Bite)) { Bite.Clear(); } Unlock(); if (Motor != null) { Motor.Dispose(Self != null && Self.Alive); } initialized = false; } } private void OnDisable() { Cleanup(); } private void OnDestroy() { Cleanup(); } } internal static class WidowEffects { internal static void Arc(Vector3 from, Vector3 to, float seconds = 0.13f, float width = 0.018f) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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) new GameObject("Marvel_Widow_ElectricArc").AddComponent<WidowElectricArc>().Begin(from, to, seconds, width); } internal static void Shock(UnitRef enemy) { //IL_0031: 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_0036: 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_0049: 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_005e: 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_0071: 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_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_0087: 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_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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) if (enemy != null && Object.op_Implicit((Object)(object)enemy.Unit)) { Vector3 val = (Object.op_Implicit((Object)(object)enemy.Torso) ? enemy.Torso.position : enemy.Position); for (int i = 0; i < 3; i++) { Arc(val + Vector3.up * 0.3f * enemy.Scale + Vector3.right * (float)(i - 1) * 0.17f * enemy.Scale, val + Vector3.down * 0.35f * enemy.Scale - Vector3.right * (float)(i - 1) * 0.12f * enemy.Scale, 0.22f); } } } internal static void Impact(Vector3 point) { //IL_0000: 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) HawkeyeEffects.Puff(point, new Color(0.7f, 0.77f, 0.8f, 0.24f), 0.16f, 0.12f); } } public sealed class WidowElectricArc : MonoBehaviour { private LineRenderer line; private Vector3 a; private Vector3 b; private float end; private float width; internal void Begin(Vector3 from, Vector3 to, float seconds, float thick) { //IL_0006: 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_000e: Unknown result type (might be due to invalid IL or missing references) BlackWidowAssets.Ensure(); a = from; b = to; end = Time.time + Mathf.Clamp(seconds, 0.03f, 0.5f); width = thick; line = ((Component)this).gameObject.AddComponent<LineRenderer>(); ((Renderer)line).sharedMaterial = BlackWidowAssets.Electric; line.positionCount = 9; line.widthMultiplier = width; } private void Update() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_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_0061: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_00a7: 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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) if (!World.InBattle || Time.time >= end) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } Vector3 val = b - a; val = Vector3.Cross(((Vector3)(ref val)).normalized, Vector3.up); Vector3 normalized = ((Vector3)(ref val)).normalized; for (int i = 0; i < 9; i++) { float num = (float)i / 8f; line.SetPosition(i, Vector3.Lerp(a, b, num) + normalized * Mathf.Sin((float)i * 3.1f + Time.time * 80f) * Mathf.Sin(num * (float)Math.PI) * 0.055f); } LineRenderer obj = line; LineRenderer obj2 = line; Color val2 = default(Color); ((Color)(ref val2))..ctor(0.55f, 0.9f, 1f, Mathf.Clamp01((end - Time.time) * 8f)); obj2.endColor = val2; obj.startColor = val2; } } public sealed class WidowSmoke : MonoBehaviour { internal static readonly HashSet<WidowSmoke> Clouds = new HashSet<WidowSmoke>(); private UnitRef source; private float end; internal static void Spawn(UnitRef owner, Vector3 point) { //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_0010: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Marvel_Widow_SmokeCloud"); val.transform.position = point + Vector3.up * 0.3f; WidowSmoke widowSmoke = val.AddComponent<WidowSmoke>(); widowSmoke.source = owner; widowSmoke.end = Time.time + 3.8f; Clouds.Add(widowSmoke); val.AddComponent<HawkeyePuffs>().Build(new Color(0.43f, 0.47f, 0.5f, 0.38f), 2.7f, 3.8f, 11, cloud: true); } internal static bool Obscured(UnitRef observer, Vector3 from, Vector3 to) { //IL_004e: 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_005a: 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_006c: 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_0088: 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) if (observer == null) { return false; } if (Object.op_Implicit((Object)(object)observer.Unit.GetComponent<BlackWidowCombatAI>())) { return false; } foreach (WidowSmoke cloud in Clouds) { if (Object.op_Implicit((Object)(object)cloud) && cloud.source != null && Time.time < cloud.end && HawkeyeRules.SmokeIntersects(from.x, from.y, from.z, to.x, to.y, to.z, ((Component)cloud).transform.position.x, ((Component)cloud).transform.position.y + 0.5f, ((Component)cloud).transform.position.z, 2.16f)) { return true; } } return false; } internal static void Install(Harmony h) { //IL_002e: 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_0047: Expected O, but got Unknown MethodInfo methodInfo = R.Method(World.ApiType, "SetAttackTarget"); if (methodInfo != null) { h.Patch((MethodBase)methodInfo, new HarmonyMethod(ArgumentBridge.Create(methodInfo, Sight)) { priority = 620 }, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } private static void Sight(object instance, MethodBase method, object[] args) { //IL_0083: 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_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) if (Clouds.Count == 0 || !World.InBattle) { return; } Component val = (Component)((instance is Component) ? instance : null); if (!Object.op_Implicit((Object)(object)val)) { return; } UnitRef unitRef = World.Get(val); if (unitRef == null) { return; } ParameterInfo[] parameters = method.GetParameters(); int num = -1; for (int i = 0; i < parameters.Length; i++) { if (parameters[i].Name == "targetPos") { num = i; } } if (num < 0 || !Obscured(unitRef, Object.op_Implicit((Object)(object)unitRef.Head) ? unitRef.Head.position : unitRef.Position, R.Vector(args[num], unitRef.Position))) { return; } for (int j = 0; j < parameters.Length; j++) { if (parameters[j].Name == "canSeeTarget" || parameters[j].Name == "startAttack") { args[j] = false; } } } private void Update() { if (!World.InBattle || source == null || !Object.op_Implicit((Object)(object)source.Unit) || Time.time >= end) { Object.Destroy((Object)(object)((Component)this).gameObject); } } private void OnDisable() { Clouds.Remove(this); } private void OnDestroy() { Clouds.Remove(this); } } public sealed class WidowShock : MonoBehaviour { private UnitRef self; private SpiderAbilityControl control; private WebStatus status; private float end; private float immune; private bool locked; internal static void Apply(UnitRef victim, UnitRef source, float seconds) { if (victim == null || !victim.Alive) { return; } WidowShock widowShock = victim.Unit.GetComponent<WidowShock>(); if (!Object.op_Implicit((Object)(object)widowShock)) { widowShock = victim.Unit.gameObject.AddComponent<WidowShock>(); } if (!(Time.time < widowShock.immune)) { HulkController component = victim.Unit.GetComponent<HulkController>(); IronSpiderController component2 = victim.Unit.GetComponent<IronSpiderController>(); bool flag = (Object.op_Implicit((Object)(object)component) && component.Clock.Hulk) || (Object.op_Implicit((Object)(object)component2) && component2.BlockNormal) || HulkCombat.Mass(victim) > HulkCombat.Mass(source) * 3f; widowShock.self = victim; widowShock.end = Time.time + Mathf.Min(flag ? 0.24f : 1.25f, seconds); widowShock.immune = widowShock.end + 3.5f; widowShock.control = SpiderAbilityControl.For(victim); widowShock.status = WebStatus.For(victim); widowShock.status.ShockUntil = Mathf.Max(widowShock.status.ShockUntil, widowShock.end); if (!widowShock.locked) { widowShock.control.Acquire(); widowShock.locked = true; } widowShock.status.SuspendBalance(widowShock.end - Time.time); WidowEffects.Shock(victim); } } private void FixedUpdate() { //IL_0092: 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) if (self == null || !self.Alive || !World.InBattle) { Release(); Object.Destroy((Object)(object)this); } else if (Time.time >= end) { Release(); if (Time.time >= immune) { Object.Destroy((Object)(object)this); } } else { Rigidbody main = self.Main; if (Object.op_Implicit((Object)(object)main) && !main.isKinematic) { main.AddTorque(new Vector3(Mathf.Sin(Time.time * 43f), 0f, Mathf.Cos(Time.time * 37f)) * 8f, (ForceMode)5); } } } private void Release() { if (locked) { if (Object.op_Implicit((Object)(object)control)) { control.Release(); } locked = false; if (Object.op_Implicit((Object)(object)status)) { status.ResumeBalance(); } } } private void OnDisable() { Release(); } private void OnDestroy() { Release(); } } internal sealed class BlackWidowMeleeSystem { private readonly BlackWidowCombatAI widow; private WidowAttack attack; private UnitRef target; private float start; private float end; private bool active; private bool jumped; private int stage = -1; private readonly HashSet<int> hit = new HashSet<int>(); private Vector3 previousA; private Vector3 previousB; private Rigidbody limb; internal bool Running => active; internal BlackWidowMeleeSystem(BlackWidowCombatAI owner) { widow = owner; } internal void Begin(WidowAttack a, UnitRef enemy) { Stop(); attack = a; target = enemy; start = Time.time; end = start + WidowRules.Duration(a); active = true; widow.Visual.Switch(WidowRules.Weapon(a)); } internal void Step() { //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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: 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) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: 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_026b: 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) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0353: 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_0364: 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_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_03fa: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_04ba: Unknown result type (might be due to invalid IL or missing references) //IL_04ad: Unknown result type (might be due to invalid IL or missing references) //IL_04af: Unknown result type (might be due to invalid IL or missing references) //IL_04b3: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Unknown result type (might be due to invalid IL or missing references) //IL_0526: Unknown result type (might be due to invalid IL or missing references) //IL_05d0: Unknown result type (might be due to invalid IL or missing references) //IL_05bb: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Unknown result type (might be due to invalid IL or missing references) //IL_05d7: Unknown result type (might be due to invalid IL or missing references) //IL_05d9: Unknown result type (might be due to invalid IL or missing references) //IL_0541: Unknown result type (might be due to invalid IL or missing references) //IL_07a0: Unknown result type (might be due to invalid IL or missing references) //IL_07a2: Unknown result type (might be due to invalid IL or missing references) //IL_07a8: Unknown result type (might be due to invalid IL or missing references) //IL_07aa: Unknown result type (might be due to invalid IL or missing references) //IL_0636: Unknown result type (might be due to invalid IL or missing references) //IL_063b: Unknown result type (might be due to invalid IL or missing references) //IL_0640: Unknown result type (might be due to invalid IL or missing references) //IL_0653: Unknown result type (might be due to invalid IL or missing references) //IL_0658: Unknown result type (might be due to invalid IL or missing references) //IL_065d: Unknown result type (might be due to invalid IL or missing references) //IL_06b3: Unknown result type (might be due to invalid IL or missing references) //IL_06b8: Unknown result type (might be due to invalid IL or missing references) //IL_074b: Unknown result type (might be due to invalid IL or missing references) //IL_06ca: Unknown result type (might be due to invalid IL or missing references) //IL_06cf: Unknown result type (might be due to invalid IL or missing references) //IL_06d8: Unknown result type (might be due to invalid IL or missing references) //IL_06da: Unknown result type (might be due to invalid IL or missing references) //IL_0769: Unknown result type (might be due to invalid IL or missing references) //IL_076b: Unknown result type (might be due to invalid IL or missing references) //IL_0770: Unknown result type (might be due to invalid IL or missing references) //IL_0773: Unknown result type (might be due to invalid IL or missing references) //IL_0778: Unknown result type (might be due to invalid IL or missing references) //IL_077d: Unknown result type (might be due to invalid IL or missing references) //IL_06f8: Unknown result type (might be due to invalid IL or missing references) //IL_06fa: Unknown result type (might be due to invalid IL or missing references) //IL_06ff: Unknown result type (might be due to invalid IL or missing references) //IL_0702: Unknown result type (might be due to invalid IL or missing references) //IL_0707: Unknown result type (might be due to invalid IL or missing references) //IL_070c: Unknown result type (might be due to invalid IL or missing references) //IL_0715: Unknown result type (might be due to invalid IL or missing references) //IL_0718: Unknown result type (might be due to invalid IL or missing references) //IL_071d: Unknown result type (might be due to invalid IL or missing references) //IL_0722: Unknown result type (might be due to invalid IL or missing references) if (!active) { return; } if (Time.time >= end || target == null || !target.Alive || !widow.Self.Alive) { Stop(); return; } float num = Time.time - start; int num2 = ((attack == WidowAttack.DoubleBaton && num >= 0.35f) ? 1 : 0); bool flag = attack == WidowAttack.BatonLeft || attack == WidowAttack.Punch || (attack == WidowAttack.DoubleBaton && num2 == 0); bool flag2 = WidowRules.Kick(attack); BlackWidowVisual visual = widow.Visual; Vector3 facing = widow.Facing; Vector3 val = Vector3.Cross(Vector3.up, facing); Vector3 val2 = (Object.op_Implicit((Object)(object)widow.Motor.Torso) ? widow.Motor.Torso.position : widow.Self.Position); Vector3 val3; if (stage != num2) { stage = num2; hit.Clear(); limb = ((!flag2) ? (flag ? widow.Motor.Left : widow.Motor.Right) : (flag ? widow.Motor.FootL : widow.Motor.FootR)); val3 = (previousA = (previousB = (Object.op_Implicit((Object)(object)limb) ? widow.Motor.Point(limb) : val2))); } float num3 = num - ((num2 == 1) ? 0.35f : 0f); float num4 = Mathf.Clamp01((num3 - 0.075f) / 0.22f); bool flag3 = WidowRules.Weapon(attack) == WidowWeapon.Batons || attack == WidowAttack.StaffSweep; Vector3 val4 = ((!WidowRules.Low(attack)) ? ((attack != WidowAttack.Elbow) ? (Object.op_Implicit((Object)(object)target.Torso) ? target.Torso.position : target.Position) : (Object.op_Implicit((Object)(object)target.Head) ? target.Head.position : target.Position)) : (Object.op_Implicit((Object)(object)target.LeftFoot) ? target.LeftFoot.position : (target.Position - Vector3.up * 0.65f * target.Scale))); Vector3 val5 = val2 - facing * 0.17f * widow.Self.Scale + val * (flag ? (-0.31f) : 0.31f) * widow.Self.Scale; if (flag2) { val5 = widow.Self.Position + Vector3.up * 0.03f * widow.Self.Scale - facing * 0.19f * widow.Self.Scale; } if (attack == WidowAttack.Knee) { val4 = target.Position + Vector3.up * 0.05f * target.Scale; } if (attack == WidowAttack.StaffSweep || attack == WidowAttack.SpinningKick || attack == WidowAttack.BackKick) { float num5 = Mathf.Lerp(-65f, 80f, num4); val4 = val2 + Quaternion.AngleAxis(num5, Vector3.up) * facing * (flag2 ? 0.85f : 0.65f) * widow.Self.Scale; if (flag2) { val4.y = (WidowRules.Low(attack) ? (target.Position.y - 0.5f * target.Scale) : (target.Position.y + 0.2f * target.Scale)); } } widow.Motor.Pose(limb, (num3 < 0.08f) ? val5 : Vector3.Lerp(val5, val4, num4), (num3 < 0.08f) ? 100 : 165); if (attack == WidowAttack.JumpKick && !jumped) { jumped = true; widow.Motor.Jump(facing, 3f, 2.4f); } if (attack == WidowAttack.Counter && num3 < 0.16f) { widow.Motor.Drive(val * (float)((widow.Self.Id % 2 == 0) ? 1 : (-1)), 3f, target); } if (flag3) { visual.BatonYaw = ((attack == WidowAttack.StaffSweep) ? Mathf.Lerp(-95f, 85f, num4) : Mathf.Lerp(-50f, 28f, num4)); visual.BatonPitch = Mathf.Lerp(-30f, 32f, num4); } visual.Align(); Vector3 val6 = (Object.op_Implicit((Object)(object)limb) ? widow.Motor.Point(limb) : val2); Vector3 val7 = val6; float num6 = (flag2 ? 0.105f : 0.08f) * widow.Self.Scale; if (flag3) { Transform val8 = visual.Baton(flag); if (Object.op_Implicit((Object)(object)val8)) { val6 = val8.TransformPoint(new Vector3(0f, 0f, (attack == WidowAttack.StaffSweep) ? (-0.62f) : 0.05f)); val7 = val8.TransformPoint(new Vector3(0f, 0f, 0.59f)); num6 = 0.048f * widow.Self.Scale; } } if (num3 >= ((attack == WidowAttack.StaffSweep) ? 0.18f : 0.1f) && num3 <= ((attack == WidowAttack.StaffSweep) ? 0.4f : 0.32f)) { Sweep(previousA, val6, num6); if (flag3) { Sweep(previousB, val7, num6); Collider[] array = Physics.OverlapCapsule(val6, val7, num6, -1, (QueryTriggerInteraction)1); foreach (Collider val9 in array) { Vector3 point = val9.ClosestPoint(val7); val3 = val6 - previousA; float magnitude = ((Vector3)(ref val3)).magnitude; val3 = val7 - previousB; Contact(val9, point, Mathf.Max(magnitude, ((Vector3)(ref val3)).magnitude) / Time.fixedDeltaTime); } } else { Collider[] array = Physics.OverlapSphere(val6, num6, -1, (QueryTriggerInteraction)1); foreach (Collider val10 in array) { Vector3 point2 = val10.ClosestPoint(val6); val3 = val6 - previousA; Contact(val10, point2, ((Vector3)(ref val3)).magnitude / Time.fixedDeltaTime); } } } previousA = val6; previousB = val7; } private void Sweep(Vector3 from, Vector3 to, float radius) { //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_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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) Vector3 val = to - from; if (((Vector3)(ref val)).sqrMagnitude < 1E-06f) { return; } foreach (RaycastHit item in from h in Physics.SphereCastAll(@from, radius, ((Vector3)(ref val)).normalized, ((Vector3)(ref val)).magnitude, -1, (QueryTriggerInteraction)1) orderby ((RaycastHit)(ref h)).distance select h) { RaycastHit current = item; if (World.Get((Component)(object)((RaycastHit)(ref current)).collider) != widow.Self) { if (World.Get((Component)(object)((RaycastHit)(ref current)).collider) == null) { break; } Contact(((RaycastHit)(ref current)).collider, ((RaycastHit)(ref current)).point, ((Vector3)(ref val)).magnitude / Time.fixedDeltaTime); } } } private void Contact(Collider c, Vector3 point, float speed) { //IL_0091: 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_0096: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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_0100: 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_012c: 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_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: 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_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) if (!active || speed < 1.1f || !Object.op_Implicit((Object)(object)c)) { return; } UnitRef unitRef = World.Get((Component)(object)c); if (unitRef == null || !unitRef.Alive || unitRef.Team == widow.Self.Team || hit.Contains(unitRef.Id) || !World.ClearPath(widow.Self, Object.op_Implicit((Object)(object)limb) ? widow.Motor.Point(limb) : widow.Self.Position, point, unitRef, terrainOnly: true)) { return; } hit.Add(unitRef.Id); float num = HulkCombat.Mass(unitRef) / Mathf.Max(1f, HulkCombat.Mass(widow.Self)); float num2 = WidowRules.ForceScale(num); Vector3 val = UnitRef.Flat(unitRef.Position - widow.Self.Position); Vector3 val2 = ((Vector3)(ref val)).normalized; if (((Vector3)(ref val2)).sqrMagnitude < 0.01f) { val2 = widow.Facing; } unitRef.Damage(WidowRules.Damage(attack), val2, widow.Self); unitRef.AddVelocity(val2 * (WidowRules.Kick(attack) ? 2.8f : 1.45f) * num2 + Vector3.up * 0.22f * num2, 3.3f); if (unitRef.Alive) { if (num <= 2.15f) { WebStatus.For(unitRef).SuspendBalance(WidowRules.Low(attack) ? 0.65f : 0.24f); } if (WidowRules.Weapon(attack) == WidowWeapon.Batons || attack == WidowAttack.StaffSweep) { WidowShock.Apply(unitRef, widow.Self, 0.42f); } } WidowEffects.Impact(point); if (WidowRules.Weapon(attack) != WidowWeapon.Unarmed) { WidowEffects.Arc(point, point + Vector3.up * 0.2f, 0.12f); } } internal void Stop() { active = false; jumped = false; target = null; limb = null; hit.Clear(); stage = -1; if (Object.op_Implicit((Object)(object)widow.Visual)) { widow.Visual.BatonYaw = (widow.Visual.BatonPitch = 0f); } } } internal sealed class BlackWidowMotor { private readonly UnitRef self; internal readonly IronManMotor Native; private bool begun; private readonly Quaternion hipOffset; private readonly Quaternion torsoOffset; private readonly Quaternion headOffset; internal Rigidbody Left => Native.Left; internal Rigidbody Right => Native.Right; internal Rigidbody FootL => Native.FootL; internal Rigidbody FootR => Native.FootR; internal Rigidbody Torso => Native.Torso; internal Rigidbody Head => Native.Head; internal bool Grounded => Native.Grounded; internal BlackWidowMotor(UnitRef u) { //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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_0075: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_00a6: 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) //IL_00b6: 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_00bb: Unknown result type (might be due to invalid IL or missing references) self = u; Native = new IronManMotor(u, physicalSkin: true); Vector3 forward = u.Forward; Quaternion val = Quaternion.LookRotation((((Vector3)(ref forward)).sqrMagnitude > 0.01f) ? u.Forward : Vector3.forward); hipOffset = Quaternion.Inverse(val) * u.Main.rotation; torsoOffset = (Object.op_Implicit((Object)(object)Torso) ? (Quaternion.Inverse(val) * Torso.rotation) : hipOffset); headOffset = (Object.op_Implicit((Object)(object)Head) ? (Quaternion.Inverse(val) * Head.rotation) : hipOffset); } internal Vector3 Point(Rigidbody body) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return Native.Point(body); } internal Vector3 Hand(bool left) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return Native.Hand(left); } internal Vector3 Foot(bool left) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return Native.Foot(left); } internal void Begin() { if (!begun) { begun = true; Native.Begin(); } } internal void Hold(Vector3 facing, float crouch = 1f, bool support = true, float roll = 0f) { //IL_0011: 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_0063: Unknown result type (might be due to invalid IL or missing references) Native.EnsureAuthority(); Native.Stabilize(facing, crouch, 0f, support, 0.7f); if (Mathf.Abs(roll) > 0.1f && Object.op_Implicit((Object)(object)self.Main) && !self.Main.isKinematic) { self.Main.AddTorque(facing * roll, (ForceMode)5); } } internal void Gait(Vector3 direction, float speed, float crouch = 1f, bool air = false) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) Native.Gait(direction, speed, crouch, air); } internal void Drive(Vector3 direction, float speed, UnitRef target = null) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) Native.Drive(direction, Mathf.Min(7.8f, speed), target); } internal void Hands(Vector3 facing) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_005a: 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_0070: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.Cross(Vector3.up, facing); Vector3 val2 = (Object.op_Implicit((Object)(object)Torso) ? Torso.position : self.Position); Pose(Left, val2 - val * 0.34f * self.Scale + facing * 0.3f * self.Scale, 75f); Pose(Right, val2 + val * 0.34f * self.Scale + facing * 0.28f * self.Scale, 75f); } internal void Pose(Rigidbody limb, Vector3 goal, float force = 130f) { //IL_003c: 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_0041: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_00a6: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: 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_00d3: 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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)limb) && !((Object)(object)limb == (Object)(object)self.Main)) { Vector3 val = (Object.op_Implicit((Object)(object)Torso) ? Torso.position : self.Position); if ((Object)(object)limb == (Object)(object)Left || (Object)(object)limb == (Object)(object)Right) { Vector3 val2 = val + Vector3.Cross(Vector3.up, self.Forward) * (((Object)(object)limb == (Object)(object)Left) ? (-0.25f) : 0.25f) * self.Scale + Vector3.up * 0.12f * self.Scale; goal = val2 + Vector3.ClampMagnitude(goal - val2, 0.73f * self.Scale); } else if ((Object)(object)limb == (Object)(object)FootL || (Object)(object)limb == (Object)(object)FootR) { goal = self.Position + Vector3.ClampMagnitude(goal - self.Position, 1.04f * self.Scale); } Native.Pose(limb, goal, Mathf.Min(180f, force)); } } internal void Turn(Vector3 direction) { //IL_002e: 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_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) //IL_0041: Unknown result type (might be due to invalid IL or missing references) Transform val = R.Get<Transform>(self.Data, "characterForwardObject"); if (Object.op_Implicit((Object)(object)val) && ((Vector3)(ref direction)).sqrMagnitude > 0.01f) { Vector3 val2 = UnitRef.Flat(direction); val.rotation = Quaternion.LookRotation(((Vector3)(ref val2)).normalized, Vector3.up); } } internal void Jump(Vector3 direction, float speed, float up) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) if (Native.FindFloor()) { UnitRef unitRef = self; Vector3 val = UnitRef.Flat(direction); unitRef.AddVelocity(((Vector3)(ref val)).normalized * Mathf.Min(7f, speed) + Vector3.up * Mathf.Min(6f, up), 9f); } } internal void Acrobatics(Vector3 facing, int kind, float phase) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_0095: 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_00a7: 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_00bc: 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_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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) if (kind == 2) { Hold(facing, 0.42f); return; } Native.EnsureAuthority(); Quaternion val = Quaternion.LookRotation(facing, Vector3.up); float num = kind switch { 3 => phase * 300f, 0 => phase * 360f, _ => Mathf.Sin(phase * (float)Math.PI) * 18f, }; Quaternion val2 = val * Quaternion.Euler((kind == 1) ? 0f : num, 0f, (kind == 1) ? num : 0f); Rotate(self.Main, val2 * hipOffset); Rotate(Torso, val2 * torsoOffset); Rotate(Head, val2 * headOffset); Pose(FootL, self.Position + val * new Vector3(-0.16f, -0.35f, -0.15f) * self.Scale, 95f); Pose(FootR, self.Position + val * new Vector3(0.16f, -0.3f, 0.1f) * self.Scale, 95f); } private static void Rotate(Rigidbody body, Quaternion goal) { //IL_0011: 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_0052: 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_0066: 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_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_0085: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)body) && !body.isKinematic) { Quaternion val = goal * Quaternion.Inverse(body.rotation); float num = default(float); Vector3 val2 = default(Vector3); ((Quaternion)(ref val)).ToAngleAxis(ref num, ref val2); if (num > 180f) { num -= 360f; } if (WidowRules.Finite(num) && HulkCombat.Finite(val2)) { body.AddTorque(Vector3.ClampMagnitude(val2 * num * ((float)Math.PI / 180f) * 135f - body.angularVelocity * 8f, 190f), (ForceMode)5); } } } internal void Limit() { HulkCombat.Cap(self, 13f); self.CapOwnMotion(13f, 6f); } internal void Dispose(bool restore) { Native.Dispose(restore); begun = false; } } public enum WidowState { Idle, MeleeCombat, PistolCombat, BatonCombat, WidowsBite, Dodge, Counter, Grapple, Takedown, SmokeReposition, HulkCalming, TeamInteraction, Dead } public enum WidowAttack { Punch, Elbow, Knee, QuickKick, SpinningKick, Sweep, JumpKick, LowKick, BackKick, ArmLock, Counter, Takedown, BatonLeft, BatonRight, DoubleBaton, StaffSweep, Bite, BiteGrapple, Pistols, Smoke, Grapple } public enum WidowWeapon { Unarmed, Batons, Staff, Pistols } internal struct WidowSituation { internal float Distance; internal float MassRatio; internal float HeightRatio; internal float EnemyHP; internal float EnemySpeed; internal int Crowd; internal int Ranged; internal bool Threat; internal bool HeavyThreat; internal bool CanGrapple; internal bool Clear; internal bool Grounded; internal bool Staggered; } internal static class WidowRules { internal const float Health = 720f; internal const float Speed = 1.55f; internal const float Size = 0.95f; internal const float Mass = 0.95f; internal const int Cost = 2100; internal const float MaxSpeed = 13f; internal const float MaxUp = 6f; internal const float MaxAngular = 10f; internal const float MinimumAggression = 0.75f; internal const float CalmCooldown = 34f; internal const float CalmSeconds = 7f; internal const float CalmContact = 1.65f; internal const float CalmTimeout = 3.4f; internal const float CalmMaxDistance = 8f; internal const float SmokeSeconds = 3.8f; internal const float SmokeRadius = 2.7f; internal const float TeamCooldown = 29f; internal static bool Finite(float v) { if (!float.IsNaN(v)) { return !float.IsInfinity(v); } return false; } internal static bool CanThrow(float mass, float height, bool held, bool alive, bool protectedForm) { if (alive && !held && !protectedForm && Finite(mass) && Finite(height) && mass > 0f && mass <= 2.15f && height > 0f) { return height <= 1.32f; } return false; } internal static bool Heavy(WidowSituation s) { if (!(s.MassRatio > 2.15f) && !(s.HeightRatio > 1.32f)) { return s.EnemyHP > 2100f; } return true; } internal static float Cooldown(WidowAttack a) { return a switch { WidowAttack.Takedown => 5.8f, WidowAttack.ArmLock => 4.6f, WidowAttack.BiteGrapple => 6.8f, WidowAttack.Bite => 3.7f, WidowAttack.StaffSweep => 7f, WidowAttack.Smoke => 11f, WidowAttack.Grapple => 7.8f, WidowAttack.Counter => 2.8f, WidowAttack.Pistols => 1.25f, WidowAttack.DoubleBaton => 1.7f, _ => 0.38f, }; } internal static float Duration(WidowAttack a) { switch (a) { case WidowAttack.ArmLock: case WidowAttack.Counter: case WidowAttack.Takedown: case WidowAttack.BiteGrapple: return 1.35f; case WidowAttack.Pistols: return 0.86f; case WidowAttack.Smoke: return 0.78f; case WidowAttack.Grapple: return 1.1f; case WidowAttack.DoubleBaton: return 0.76f; case WidowAttack.StaffSweep: return 0.68f; default: return 0.48f; } } internal static WidowWeapon Weapon(WidowAttack a) { switch (a) { default: return WidowWeapon.Unarmed; case WidowAttack.BatonLeft: case WidowAttack.BatonRight: case WidowAttack.DoubleBaton: return WidowWeapon.Batons; case WidowAttack.StaffSweep: return WidowWeapon.Staff; case WidowAttack.Pistols: return WidowWeapon.Pistols; } } internal static WidowState State(WidowAttack a) { switch (a) { default: if (Weapon(a) == WidowWeapon.Unarmed) { return WidowState.MeleeCombat; } return WidowState.BatonCombat; case WidowAttack.Grapple: return WidowState.Grapple; case WidowAttack.Smoke: return WidowState.SmokeReposition; case WidowAttack.Counter: return WidowState.Counter; case WidowAttack.ArmLock: case WidowAttack.Takedown: case WidowAttack.BiteGrapple: return WidowState.Takedown; case WidowAttack.Bite: return WidowState.WidowsBite; case WidowAttack.Pistols: return WidowState.PistolCombat; } } internal static float Damage(WidowAttack a) { switch (a) { case WidowAttack.Elbow: return 35f; case WidowAttack.Knee: return 38f; case WidowAttack.QuickKick: case WidowAttack.BackKick: return 39f; case WidowAttack.SpinningKick: case WidowAttack.JumpKick: return 48f; case WidowAttack.Sweep: case WidowAttack.LowKick: return 24f; case WidowAttack.BatonLeft: case WidowAttack.BatonRight: return 31f; case WidowAttack.DoubleBaton: return 27f; case WidowAttack.StaffSweep: return 42f; case WidowAttack.Counter: return 36f; default: return 26f; } } internal static bool Kick(WidowAttack a) { if (a >= WidowAttack.Knee) { return a <= WidowAttack.BackKick; } return false; } internal static bool Low(WidowAttack a) { if (a != WidowAttack.Sweep) { return a == WidowAttack.LowKick; } return true; } internal static float ForceScale(float massRatio) { if (Finite(massRatio) && !(massRatio <= 0f)) { return (float)Math.Min(1.15, Math.Max(0.08, 1.0 / Math.Sqrt(massRatio))); } return 0f; } internal static bool ProjectileThreat(float time, float miss, float speed, float scale) { if (Finite(time) && Finite(miss) && Finite(speed) && scale > 0f && time > 0.11f && time < 0.6f && speed >= 3f && speed <= 95f) { return miss < 0.78f * scale; } return false; } } internal sealed class WidowCombatClock { internal WidowState State; internal WidowAttack Attack; internal float Start; internal float End; internal float LastAttack = -100f; internal float EvadeReady; internal float RetreatReady; internal bool AttackRequired; private readonly Dictionary<WidowAttack, float> ready = new Dictionary<WidowAttack, float>(); private int style; internal bool Free => State == WidowState.Idle; internal bool Available(WidowAttack a, float now) { if (ready.TryGetValue(a, out var value)) { return now >= value; } return true; } internal bool Enter(WidowAttack a, float now) { if (!Free || !Available(a, now) || !WidowRules.Finite(now)) { return false; } Attack = a; State = WidowRules.State(a); Start = now; End = now + WidowRules.Duration(a); ready[a] = now + WidowRules.Cooldown(a); if (a != WidowAttack.Smoke && a != WidowAttack.Grapple) { LastAttack = now; AttackRequired = false; } else { AttackRequired = true; } return true; } internal bool Evade(float now, bool retreat) { if (!Free || now < EvadeReady || AttackRequired || now - LastAttack > 1.6f) { return false; } State = WidowState.Dodge; Start = now; End = now + (retreat ? 0.55f : 0.32f); EvadeReady = now + 1.15f; if (retreat) { RetreatReady = now + 7f; } AttackRequired = true; return true; } internal void Finish() { if (State != WidowState.Dead) { State = WidowState.Idle; } End = 0f; } internal bool Expired(float now) { if (!Free && State != WidowState.Dead) { return now >= End; } return false; } internal WidowAttack? Select(WidowSituation s, float now) { if (!Free || !WidowRules.Finite(s.Distance) || s.Distance < 0f) { return null; } bool flag = AttackRequired || now - LastAttack > 1.6f; if (!flag && s.Crowd >= 4 && s.Distance < 6f && Available(WidowAttack.Smoke, now)) { return WidowAttack.Smoke; } if (!flag && WidowRules.Heavy(s) && s.Distance < 4.3f && now >= RetreatReady && s.Grounded && Available(WidowAttack.Grapple, now)) { return WidowAttack.Grapple; } if (s.Threat && s.Distance < 3f && Available(WidowAttack.Counter, now)) { return WidowAttack.Counter; } if (s.Distance > 3.2f) { if (!flag && s.CanGrapple && s.Distance < 7f && s.EnemySpeed > 3f && Available(WidowAttack.Grapple, now)) { return WidowAttack.Grapple; } if (s.Clear && s.Distance < 8f && Available(WidowAttack.Bite, now) && (s.Threat || WidowRules.Heavy(s))) { return WidowAttack.Bite; } if (s.Clear && s.Distance <= 34f && Available(WidowAttack.Pistols, now) && (s.Distance > 10f || s.Ranged > 0 || WidowRules.Heavy(s))) { return WidowAttack.Pistols; } return null; } if (s.CanGrapple && Available(WidowAttack.Takedown, now) && (s.Staggered || s.EnemySpeed > 3f)) { return WidowAttack.Takedown; } if (s.CanGrapple && Available(WidowAttack.BiteGrapple, now) && s.EnemyHP > 300f) { return WidowAttack.BiteGrapple; } if (s.Crowd >= 3 && Availab