Decompiled source of CoopBot v1.0.1
CoopBot.dll
Decompiled 2 weeks 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.Collections.ObjectModel; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using Dungeonator; using HarmonyLib; using InControl; using Pathfinding; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.0.0.0")] namespace CoopBot; public class CoopBotBrain : MonoBehaviour { private enum OrderKind { None, Interact, Break, Regroup } private struct Bullet { public Vector2 pos; public Vector2 vel; } private struct Zone { public Vector2 c; public float r; } public PlayerController Bot; public Vector2 Move; public bool Shoot; private bool m_dodge; private bool m_reload; private int m_interactTicks; private int m_itemTicks; private float m_nextItemTime; private int m_swapTicks; private float m_nextSwapTime; private OrderKind m_order; private Component m_orderTarget; private IPlayerInteractable m_orderInteractable; private Vector2 m_orderCenter; private float m_orderExpires; private float m_lastInteractTime = -10f; private int m_interactAttempts; private int m_dropState; private Vector2 m_dropSpot; private float m_dropDeadline; private List<Vector2> m_waypoints = new List<Vector2>(); private Vector2 m_pathGoal = new Vector2(-999f, -999f); private float m_nextPathTime; private float m_strafeSign = 1f; private float m_nextStrafeFlip; private float m_dodgeReadyTime; private float m_stuckTimer; private Vector2 m_lastPos; private float m_farTimer; private Vector2 m_facing = Vector2.right; private const float FollowStart = 4.5f; private const float FollowStop = 2.5f; private const float Leash = 16f; private const float EngageRange = 18f; private ElevatorDepartureController m_elevator; private float m_nextElevatorScan; private int m_ghostFrame; private AIActor m_lockedEnemy; private Vector2 m_coverSpot; private bool m_hasCover; private float m_nextCoverSearch; private readonly HashSet<FlippableCover> m_triedTables = new HashSet<FlippableCover>(); private FlippableCover m_table; private float m_tableDeadline; private float m_coverSince = -1f; private float m_coverCooldownUntil; private float m_lastHealth = -1f; private bool m_thin; private float m_thinUntil; private int m_unstickStage; private float m_nextBlankTime; public bool WantBlank; private readonly List<Bullet> m_bullets = new List<Bullet>(); private Vector2 m_evadeDir; private float m_evadeUntil; private float m_weaveSign = 1f; private const float BulletR = 1.1f; private readonly Dictionary<Projectile, float> m_reactAt = new Dictionary<Projectile, float>(); private float m_nextReactCleanup; private Vector2 m_aimErr; private float m_aimErrUntil; private float m_chargeStart = -1f; private float m_releaseUntil; private readonly List<Zone> m_zones = new List<Zone>(); private float m_nextZoneScan; private static readonly FieldInfo RocketPos = typeof(SkyRocket).GetField("m_targetLandPosition", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly FieldInfo RocketState = typeof(SkyRocket).GetField("m_state", BindingFlags.Instance | BindingFlags.NonPublic); private bool BulletsIncoming => m_bullets.Count > 0; private float MoveSpeed => Mathf.Max(4f, Bot.stats.GetStatValue((StatType)0)); public bool ConsumeUseItem() { if (m_itemTicks <= 0) { return false; } m_itemTicks--; return true; } public bool ConsumeSwapGun() { if (m_swapTicks <= 0) { return false; } m_swapTicks--; return m_swapTicks > 0; } public bool ConsumeDodge() { bool dodge = m_dodge; m_dodge = false; return dodge; } public bool ConsumeReload() { bool reload = m_reload; m_reload = false; return reload; } public bool ConsumeInteract() { if (m_interactTicks <= 0) { return false; } m_interactTicks--; return true; } private static int TileMask() { return CollisionMask.LayerToMask((CollisionLayer)6, (CollisionLayer)8); } private static bool TilesBlock(Vector2 from, Vector2 to) { //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_001f: 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) Vector2 val = to - from; float magnitude = ((Vector2)(ref val)).magnitude; if (magnitude < 0.01f) { return false; } RaycastResult val2 = default(RaycastResult); bool num = PhysicsEngine.Instance.Raycast(from, val, magnitude, ref val2, true, false, TileMask(), (CollisionLayer?)null, false, (Func<SpeculativeRigidbody, bool>)null, (SpeculativeRigidbody)null); if (num) { RaycastResult.Pool.Free(ref val2); } return num; } private static bool MoveBlocked(Vector2 from, Vector2 to, float width = 0.32f) { //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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_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) //IL_0091: Unknown result type (might be due to invalid IL or missing references) Vector2 val = to - from; float magnitude = ((Vector2)(ref val)).magnitude; if (magnitude < 0.01f) { return false; } Vector2 val2 = new Vector2(0f - val.y, val.x); Vector2 val3 = ((Vector2)(ref val2)).normalized * width; int num = CollisionMask.LayerToMask((CollisionLayer)6, (CollisionLayer)5, (CollisionLayer)8); SpeculativeRigidbody val4 = (((Object)(object)CoopBotPlugin.Brain != (Object)null && (Object)(object)CoopBotPlugin.Brain.Bot != (Object)null) ? ((BraveBehaviour)CoopBotPlugin.Brain.Bot).specRigidbody : null); RaycastResult val5 = default(RaycastResult); for (int i = -1; i <= 1; i++) { if (PhysicsEngine.Instance.Raycast(from + val3 * (float)i, val, magnitude, ref val5, true, true, num, (CollisionLayer?)null, false, (Func<SpeculativeRigidbody, bool>)null, val4)) { RaycastResult.Pool.Free(ref val5); return true; } } return false; } private void Update() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: 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_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01af: 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_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_0376: 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_0380: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025f: 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_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_0400: 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_039d: 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_0297: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_0203: 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_0437: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Unknown result type (might be due to invalid IL or missing references) //IL_042e: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) Move = Vector2.zero; Shoot = false; GameManager instance = GameManager.Instance; PlayerController primaryPlayer = instance.PrimaryPlayer; if ((Object)(object)Bot == (Object)null || (Object)(object)primaryPlayer == (Object)null || instance.IsLoadingLevel || instance.IsPaused) { return; } if (Bot.IsGhost || ((BraveBehaviour)Bot).healthHaver.IsDead) { GhostUpdate(primaryPlayer); } else { if ((int)Bot.CurrentInputState != 0) { return; } Vector2 unitCenter = ((BraveBehaviour)Bot).specRigidbody.UnitCenter; Vector2 unitCenter2 = ((BraveBehaviour)primaryPlayer).specRigidbody.UnitCenter; RoomHandler currentRoom = Bot.CurrentRoom; if (Time.time > m_orderExpires && m_order != OrderKind.None) { EndOrder("Order timed out."); } float num = Vector2.Distance(unitCenter, unitCenter2); bool flag = currentRoom != null && currentRoom == primaryPlayer.CurrentRoom; bool flag2 = Bot.IsInCombat && currentRoom != null && currentRoom.HasActiveEnemies((ActiveEnemyType)0); if (num > 40f || (!flag && !flag2 && !primaryPlayer.IsInCombat && num > 22f)) { m_farTimer += Time.deltaTime; if (m_farTimer > 2.5f) { Bot.ReuniteWithOtherPlayer(primaryPlayer, true); m_farTimer = 0f; return; } } else { m_farTimer = 0f; } AIActor val = PickEnemy(currentRoom, unitCenter); Vector2? aim = null; if ((Object)(object)val == (Object)null && ElevatorNearPlayer(unitCenter2)) { if (m_order != OrderKind.None) { EndOrder("Bot: heading to the elevator."); } if (num > 0.35f) { MoveToward(unitCenter, unitCenter2, 0.3f); if (((Vector2)(ref Move)).sqrMagnitude < 0.01f) { Vector2 val2 = unitCenter2 - unitCenter; Move = ((Vector2)(ref val2)).normalized; } if (num < 1.5f) { Move *= Mathf.Clamp(num, 0.3f, 1f); } } if (num > 8f) { m_farTimer += Time.deltaTime; if (m_farTimer > 2f) { Bot.ReuniteWithOtherPlayer(primaryPlayer, true); m_farTimer = 0f; } } Bot.forceAimPoint = unitCenter + m_facing * 5f; if (((Vector2)(ref Move)).sqrMagnitude > 0.01f) { m_facing = ((Vector2)(ref Move)).normalized; } UnstickCheck(unitCenter); return; } if (m_order == OrderKind.Interact) { RunInteractOrder(unitCenter, ref aim); } else if (m_order == OrderKind.Break) { RunBreakOrder(unitCenter, ref aim); } else if (m_order == OrderKind.Regroup) { if (num < 3f) { EndOrder("Regrouped."); } else { MoveToward(unitCenter, unitCenter2, 1.5f); } } bool flag3 = m_order != OrderKind.None; AutoUseItem(currentRoom, unitCenter, val); if ((Object)(object)val != (Object)null) { Vector2 unitCenter3 = ((BraveBehaviour)val).specRigidbody.UnitCenter; float num2 = Vector2.Distance(unitCenter, unitCenter3); bool flag4 = !TilesBlock(unitCenter, unitCenter3); if (num2 < 18f && flag4) { Vector2 val3 = ((BraveBehaviour)val).specRigidbody.Velocity * Mathf.Clamp(num2 / 18f, 0f, 0.6f); aim = unitCenter3 + val3 + AimError(num2); Shoot = true; } if (!flag3 && !CoverMove(currentRoom, unitCenter, unitCenter3, num2, flag4)) { CombatMove(unitCenter, unitCenter3, num2, flag4, unitCenter2, num); } } else if (!flag3) { FollowMove(unitCenter, unitCenter2, num); } AvoidProjectiles(unitCenter); PitGuard(unitCenter); HazardGuard(unitCenter); DangerZoneGuard(unitCenter); if (((Vector2)(ref Move)).sqrMagnitude > 0.01f) { m_facing = ((Vector2)(ref Move)).normalized; } Bot.forceAimPoint = (Vector2)(((??)aim) ?? (unitCenter + m_facing * 5f)); HandleReloadAndAmmo((Object)(object)val != (Object)null); ChargeCycle(); UnstickCheck(unitCenter); } } private bool ElevatorNearPlayer(Vector2 primPos) { //IL_0056: 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) if (Time.time > m_nextElevatorScan) { m_nextElevatorScan = Time.time + 1.5f; m_elevator = Object.FindObjectOfType<ElevatorDepartureController>(); } if ((Object)(object)m_elevator == (Object)null || !((Component)m_elevator).gameObject.activeInHierarchy) { return false; } return Vector2.Distance(Vector3Extensions.XY(((BraveBehaviour)m_elevator).transform.position), primPos) < 9f; } private void GhostUpdate(PlayerController prim) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: 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_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: 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) if ((Object)(object)Bot == (Object)null || (Object)(object)((BraveBehaviour)Bot).specRigidbody == (Object)null) { return; } Vector2 unitCenter = ((BraveBehaviour)Bot).specRigidbody.UnitCenter; Vector2 unitCenter2 = ((BraveBehaviour)prim).specRigidbody.UnitCenter; float num = Vector2.Distance(unitCenter, unitCenter2); Vector2 val; if (num > 2.5f) { val = unitCenter2 - unitCenter; Move = ((Vector2)(ref val)).normalized * Mathf.Min(1f, (num - 2f) / 2f); } if (num > 30f) { Bot.ReuniteWithOtherPlayer(prim, true); } bool flag = false; ReadOnlyCollection<Projectile> allProjectiles = StaticReferenceManager.AllProjectiles; for (int i = 0; i < allProjectiles.Count; i++) { if (flag) { break; } Projectile val2 = allProjectiles[i]; if ((Object)(object)val2 == (Object)null || (Object)(object)((BraveBehaviour)val2).specRigidbody == (Object)null || !val2.collidesWithPlayer || val2.Owner is PlayerController) { continue; } Vector2 unitCenter3 = ((BraveBehaviour)val2).specRigidbody.UnitCenter; Vector2 velocity = ((BraveBehaviour)val2).specRigidbody.Velocity; if (!(((Vector2)(ref velocity)).sqrMagnitude < 0.25f)) { Vector2 val3 = unitCenter2 - unitCenter3; float num2 = Mathf.Clamp(Vector2.Dot(val3, velocity) / ((Vector2)(ref velocity)).sqrMagnitude, 0f, 0.8f); val = val3 - velocity * num2; if (((Vector2)(ref val)).magnitude < 1.4f) { flag = true; } } } m_ghostFrame++; Shoot = flag && m_ghostFrame % 2 == 0; Bot.forceAimPoint = unitCenter + Vector2.right; } private void HandleReloadAndAmmo(bool hasEnemy) { Gun currentGun = ((GameActor)Bot).CurrentGun; if ((Object)(object)currentGun == (Object)null || currentGun.IsReloading || Bot.IsDodgeRolling) { return; } if (currentGun.InfiniteAmmo || currentGun.CurrentAmmo > 0) { int clipCapacity = currentGun.ClipCapacity; int clipShotsRemaining = currentGun.ClipShotsRemaining; if (clipCapacity > 0 && clipCapacity <= 200 && (currentGun.InfiniteAmmo || currentGun.CurrentAmmo > clipShotsRemaining) && (clipShotsRemaining <= 0 || (!Shoot && (float)clipShotsRemaining < (float)clipCapacity * 0.6f) || (!hasEnemy && clipShotsRemaining < clipCapacity))) { m_reload = true; } } else { if (!(Time.time > m_nextSwapTime) || Bot.inventory == null || Bot.inventory.AllGuns.Count <= 1) { return; } if (CanDropHeld()) { try { Bot.ForceDropGun(currentGun); } catch (Exception) { } } else { m_swapTicks = 3; } m_nextSwapTime = Time.time + 1f; } } private AIActor PickEnemy(RoomHandler room, Vector2 pos) { //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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_00ee: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_lockedEnemy != (Object)null) { AIActor lockedEnemy = m_lockedEnemy; if (!((Object)(object)((BraveBehaviour)lockedEnemy).healthHaver == (Object)null) && !((BraveBehaviour)lockedEnemy).healthHaver.IsDead && ((Behaviour)lockedEnemy).isActiveAndEnabled && !((Object)(object)((BraveBehaviour)lockedEnemy).specRigidbody == (Object)null)) { return lockedEnemy; } m_lockedEnemy = null; } if (room == null) { return null; } List<AIActor> activeEnemies = room.GetActiveEnemies((ActiveEnemyType)0); if (activeEnemies == null) { return null; } AIActor result = null; float num = float.MaxValue; for (int i = 0; i < activeEnemies.Count; i++) { AIActor val = activeEnemies[i]; if (!((Object)(object)val == (Object)null) && !((Object)(object)((BraveBehaviour)val).healthHaver == (Object)null) && !((BraveBehaviour)val).healthHaver.IsDead && !val.IsHarmlessEnemy && !((Object)(object)val.CompanionOwner != (Object)null) && ((Behaviour)val).isActiveAndEnabled && !((Object)(object)((BraveBehaviour)val).specRigidbody == (Object)null)) { Vector2 unitCenter = ((BraveBehaviour)val).specRigidbody.UnitCenter; float num2 = Vector2.Distance(pos, unitCenter) + (TilesBlock(pos, unitCenter) ? 12f : 0f); if (num2 < num) { num = num2; result = val; } } } return result; } public void DropItemNow() { if ((Object)(object)Bot == (Object)null || ((BraveBehaviour)Bot).healthHaver.IsDead || Bot.IsGhost) { return; } PlayerItem currentItem = Bot.CurrentItem; if ((Object)(object)currentItem == (Object)null) { CoopBotPlugin.Say("Bot: no active item."); return; } try { Bot.DropActiveItem(currentItem, 4f, false); CoopBotPlugin.Say("Bot: dropped its item."); } catch (Exception) { } } public void UseItemNow() { if (!((Object)(object)Bot == (Object)null) && !((BraveBehaviour)Bot).healthHaver.IsDead && !Bot.IsGhost) { PlayerItem currentItem = Bot.CurrentItem; if ((Object)(object)currentItem == (Object)null) { CoopBotPlugin.Say("Bot: no active item."); return; } if (currentItem.IsOnCooldown || !currentItem.CanBeUsed(Bot)) { CoopBotPlugin.Say("Bot: item not ready."); return; } m_itemTicks = 2; CoopBotPlugin.Say("Bot: using its item."); } } private void AutoUseItem(RoomHandler room, Vector2 pos, AIActor enemy) { //IL_00b9: 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) if ((Object)(object)enemy == (Object)null || Time.time < m_nextItemTime || m_itemTicks > 0 || Bot.IsDodgeRolling) { return; } PlayerItem currentItem = Bot.CurrentItem; if ((Object)(object)currentItem == (Object)null || currentItem.IsCurrentlyActive || currentItem.IsOnCooldown || !currentItem.CanBeUsed(Bot)) { return; } int num = 0; List<AIActor> list = ((room != null) ? room.GetActiveEnemies((ActiveEnemyType)0) : null); if (list != null) { for (int i = 0; i < list.Count; i++) { AIActor val = list[i]; if (!((Object)(object)val == (Object)null) && !((Object)(object)((BraveBehaviour)val).healthHaver == (Object)null) && !((BraveBehaviour)val).healthHaver.IsDead && !((Object)(object)((BraveBehaviour)val).specRigidbody == (Object)null) && Vector2.Distance(pos, ((BraveBehaviour)val).specRigidbody.UnitCenter) < 12f) { num++; } } } float currentHealthPercentage = ((BraveBehaviour)Bot).healthHaver.GetCurrentHealthPercentage(); bool isBoss = ((BraveBehaviour)enemy).healthHaver.IsBoss; if (num >= 3 || isBoss || (num >= 2 && currentHealthPercentage < 0.7f) || currentHealthPercentage < 0.4f) { m_itemTicks = 2; m_nextItemTime = Time.time + 2f; } } private static bool CoverBlocks(Vector2 from, Vector2 to) { //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_0028: 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) Vector2 val = to - from; float magnitude = ((Vector2)(ref val)).magnitude; if (magnitude < 0.01f) { return false; } int num = CollisionMask.LayerToMask((CollisionLayer)6, (CollisionLayer)5, (CollisionLayer)8); RaycastResult val2 = default(RaycastResult); bool num2 = PhysicsEngine.Instance.Raycast(from, val, magnitude, ref val2, true, true, num, (CollisionLayer?)null, false, (Func<SpeculativeRigidbody, bool>)null, (SpeculativeRigidbody)null); if (num2) { RaycastResult.Pool.Free(ref val2); } return num2; } private bool WantsCover() { float num = ((BraveBehaviour)Bot).healthHaver.GetCurrentHealth() + ((BraveBehaviour)Bot).healthHaver.Armor; bool num2 = m_lastHealth >= 0f && num < m_lastHealth; m_lastHealth = num; if (num2 && m_coverSince >= 0f) { m_coverSince = -1f; m_coverCooldownUntil = Time.time + 6f; } if (Time.time < m_coverCooldownUntil) { return false; } if (!WantsCoverRaw()) { m_coverSince = -1f; return false; } if (m_coverSince < 0f) { m_coverSince = Time.time; } if (Time.time - m_coverSince > 2.5f) { m_coverSince = -1f; m_coverCooldownUntil = Time.time + 5f; return false; } return true; } private bool WantsCoverRaw() { float num = Mathf.Clamp01(CoopBotPlugin.CoverPreference.Value); Gun currentGun = ((GameActor)Bot).CurrentGun; if ((Object)(object)currentGun != (Object)null && currentGun.IsReloading && num > 0.05f) { return true; } if (((BraveBehaviour)Bot).healthHaver.GetCurrentHealthPercentage() < Mathf.Lerp(0.2f, 0.9f, num)) { return true; } return Time.time % 5f / 5f < num * 0.6f; } private bool CoverMove(RoomHandler room, Vector2 pos, Vector2 ep, float d, bool los) { //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: 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_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0171: 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_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_016a: 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_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0319: 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_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0237: 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_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) if (room == null) { return false; } bool flag = WantsCover(); if ((Object)(object)m_table == (Object)null && d > 5f && CoopBotPlugin.CoverPreference.Value > 0.1f && Time.time > m_nextCoverSearch) { m_nextCoverSearch = Time.time + 1f; ReadOnlyCollection<IPlayerInteractable> roomInteractables = room.GetRoomInteractables(); float num = 8f; for (int i = 0; i < roomInteractables.Count; i++) { IPlayerInteractable obj = roomInteractables[i]; FlippableCover val = (FlippableCover)(object)((obj is FlippableCover) ? obj : null); if (!((Object)(object)val == (Object)null) && !val.IsFlipped && !val.IsBroken && !m_triedTables.Contains(val)) { float num2 = Vector2.Distance(pos, ((BraveBehaviour)val).specRigidbody.UnitCenter); if (num2 < num) { num = num2; m_table = val; m_tableDeadline = Time.time + 6f; } } } } Vector2 val2; if ((Object)(object)m_table != (Object)null) { if (m_table.IsFlipped || m_table.IsBroken || Time.time > m_tableDeadline) { m_triedTables.Add(m_table); m_table = null; } else { Vector2 unitCenter = ((BraveBehaviour)m_table).specRigidbody.UnitCenter; val2 = unitCenter - ep; Vector2 val3; if (!(((Vector2)(ref val2)).sqrMagnitude > 0.01f)) { val3 = Vector2.up; } else { val2 = unitCenter - ep; val3 = ((Vector2)(ref val2)).normalized; } Vector2 val4 = val3; Vector2 val5 = unitCenter - val4 * 1.1f; if (!(m_table.GetDistanceToPoint(((GameActor)Bot).CenterPosition) < 0.85f)) { if (Vector2.Distance(pos, val5) > 0.5f && m_table.GetDistanceToPoint(((GameActor)Bot).CenterPosition) > 1.6f) { MoveToward(pos, val5, 0.3f); return true; } MoveToward(pos, unitCenter, 0.2f); if (((Vector2)(ref Move)).sqrMagnitude < 0.01f) { val2 = unitCenter - pos; Move = ((Vector2)(ref val2)).normalized; } return true; } m_interactTicks = 3; m_triedTables.Add(m_table); m_table = null; } } if (!flag) { m_hasCover = false; return false; } if (!m_hasCover || Time.time > m_nextCoverSearch) { m_nextCoverSearch = Time.time + 0.6f; m_hasCover = FindCover(room, pos, out m_coverSpot); } if (!m_hasCover) { return false; } if (BulletsIncoming && Vector2.Distance(pos, m_coverSpot) < 0.8f) { return false; } if (!CoverBlocks(m_coverSpot, ep) && !los) { m_hasCover = false; return false; } if (Vector2.Distance(pos, m_coverSpot) > 0.45f) { MoveToward(pos, m_coverSpot, 0.3f); if (((Vector2)(ref Move)).sqrMagnitude < 0.01f) { val2 = m_coverSpot - pos; Move = ((Vector2)(ref val2)).normalized; } } return true; } private bool FindCover(RoomHandler room, Vector2 pos, out Vector2 spot) { //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_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) //IL_00f2: 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_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_0086: 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_015c: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) spot = pos; List<AIActor> activeEnemies = room.GetActiveEnemies((ActiveEnemyType)0); if (activeEnemies == null) { return false; } List<Vector2> list = new List<Vector2>(); for (int i = 0; i < activeEnemies.Count; i++) { if (list.Count >= 6) { break; } AIActor val = activeEnemies[i]; if (!((Object)(object)val == (Object)null) && !((Object)(object)((BraveBehaviour)val).healthHaver == (Object)null) && !((BraveBehaviour)val).healthHaver.IsDead && !((Object)(object)((BraveBehaviour)val).specRigidbody == (Object)null) && !val.IsHarmlessEnemy) { Vector2 unitCenter = ((BraveBehaviour)val).specRigidbody.UnitCenter; if (Vector2.Distance(unitCenter, pos) < 20f) { list.Add(unitCenter); } } } if (list.Count == 0) { return false; } Vector2 unitCenter2 = ((BraveBehaviour)GameManager.Instance.PrimaryPlayer).specRigidbody.UnitCenter; float num = float.MaxValue; bool flag = false; for (int j = 0; j < 3; j++) { float num2 = 2f + (float)j * 2.2f; for (int k = 0; k < 16; k++) { Vector2 val2 = pos + Vector2.op_Implicit(Quaternion.Euler(0f, 0f, (float)k * 22.5f) * Vector3.right) * num2; if (Pit(val2) || MoveBlocked(pos, val2)) { continue; } int num3 = 0; float num4 = float.MaxValue; for (int l = 0; l < list.Count; l++) { num4 = Mathf.Min(num4, Vector2.Distance(val2, list[l])); if (CoverBlocks(val2, list[l])) { num3++; } } if (num3 >= list.Count && !(num4 < 3.5f)) { float num5 = num2 + Vector2.Distance(val2, unitCenter2) * 0.25f + Random.value * 0.5f; if (num5 < num) { num = num5; spot = val2; flag = true; } } } if (flag) { break; } } return flag; } private void FollowMove(Vector2 pos, Vector2 primPos, float distToPrim) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) if (distToPrim > 4.5f || (distToPrim > 2.5f && m_waypoints.Count > 0 && ((Vector2)(ref Move)).sqrMagnitude > 0f)) { MoveToward(pos, primPos, 2.5f); } else if (distToPrim < 1.2f) { Vector2 val = pos - primPos; if (((Vector2)(ref val)).sqrMagnitude < 0.01f) { val = Vector2.right; } Move = ((Vector2)(ref val)).normalized * 0.7f; } } private void CombatMove(Vector2 pos, Vector2 ep, float d, bool los, Vector2 primPos, float distToPrim) { //IL_000a: 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_0025: 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_0032: 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_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_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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_0082: 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_006f: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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_010c: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) if (distToPrim > 16f) { MoveToward(pos, primPos, 2.5f); return; } if (!los || d > 11f) { MoveToward(pos, ep, 8f); return; } Vector2 val = ep - pos; Vector2 normalized = ((Vector2)(ref val)).normalized; if (d < 4.5f) { Vector2 val2 = -normalized; if (MoveBlocked(pos, pos + val2 * 1.5f)) { val2 = Perp(normalized) * m_strafeSign; } Move = val2; return; } if (Time.time > m_nextStrafeFlip) { m_strafeSign = ((Random.value < 0.5f) ? (-1f) : 1f); m_nextStrafeFlip = Time.time + Random.Range(1.2f, 2.8f); } Vector2 val3 = Perp(normalized) * m_strafeSign; if (MoveBlocked(pos, pos + val3 * 1.5f)) { m_strafeSign = 0f - m_strafeSign; val3 = -val3; } Move = val3 * 0.8f; } private static Vector2 Perp(Vector2 v) { //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_000d: Unknown result type (might be due to invalid IL or missing references) return new Vector2(0f - v.y, v.x); } private void MoveToward(Vector2 pos, Vector2 goal, float stopDistance) { //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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_015d: 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_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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_0116: 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) if (Vector2.Distance(pos, goal) <= stopDistance) { m_waypoints.Clear(); return; } Vector2 val; if (!MoveBlocked(pos, goal, 0.45f) && Vector2.Distance(pos, goal) < 6f) { m_waypoints.Clear(); val = goal - pos; Move = ((Vector2)(ref val)).normalized; return; } if (!(Time.time > m_nextPathTime)) { val = goal - m_pathGoal; if (!(((Vector2)(ref val)).sqrMagnitude > 4f) && m_waypoints.Count != 0) { goto IL_00a3; } } RecomputePath(pos, goal); goto IL_00a3; IL_00a3: while (m_waypoints.Count > 0 && Vector2.Distance(pos, m_waypoints[0]) < (m_thin ? 0.3f : 0.45f)) { m_waypoints.RemoveAt(0); } if (m_waypoints.Count > 0) { if (!m_thin && m_waypoints.Count > 1 && Vector2.Distance(pos, m_waypoints[1]) < 2.2f && !MoveBlocked(pos, m_waypoints[1], 0.5f)) { m_waypoints.RemoveAt(0); } val = m_waypoints[0] - pos; Move = ((Vector2)(ref val)).normalized; } else { val = goal - pos; Move = ((Vector2)(ref val)).normalized; } } private void RecomputePath(Vector2 pos, Vector2 goal) { //IL_0012: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) m_nextPathTime = Time.time + 0.5f; m_pathGoal = goal; m_waypoints.Clear(); if (!Pathfinder.HasInstance) { return; } IntVector2 val = Vector2Extensions.ToIntVector2(pos, (VectorConversions)0); IntVector2 val2 = Vector2Extensions.ToIntVector2(goal, (VectorConversions)0); bool flag = false; Path val3 = null; if (!m_thin) { flag = Pathfinder.Instance.GetPath(val, val2, ref val3, (IntVector2?)new IntVector2(2, 2), (CellTypes)2, (CellValidator)null, (ExtraWeightingFunction)null, false); } if (!flag) { flag = Pathfinder.Instance.GetPath(val, val2, ref val3, (IntVector2?)IntVector2.One, (CellTypes)2, (CellValidator)null, (ExtraWeightingFunction)null, false); } if (!flag) { for (int i = 1; i <= 2; i++) { if (flag) { break; } for (int j = -i; j <= i; j++) { if (flag) { break; } for (int k = -i; k <= i; k++) { if (flag) { break; } if (Mathf.Max(Mathf.Abs(j), Mathf.Abs(k)) == i) { flag = Pathfinder.Instance.GetPath(val, new IntVector2(val2.x + j, val2.y + k), ref val3, (IntVector2?)IntVector2.One, (CellTypes)2, (CellValidator)null, (ExtraWeightingFunction)null, false); } } } } } if (!flag || val3 == null || val3.Positions == null) { return; } foreach (IntVector2 position in val3.Positions) { m_waypoints.Add(Pathfinder.GetClearanceOffset(position, val3.Clearance)); } } private void UnstickCheck(Vector2 pos) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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_0109: 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_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_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_0148: 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_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018e: 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_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: 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_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0233: 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_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: 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_0203: 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_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) if (m_thin && Time.time > m_thinUntil) { m_thin = false; } if (((Vector2)(ref Move)).sqrMagnitude > 0.25f) { Vector2 val = pos - m_lastPos; if (((Vector2)(ref val)).sqrMagnitude < 0.0004f) { m_stuckTimer += Time.deltaTime; if (m_stuckTimer > 0.35f) { int num = ((m_stuckTimer < 0.9f) ? 1 : ((m_stuckTimer < 1.6f) ? 2 : ((m_stuckTimer < 2.6f) ? 3 : 4))); if (num != m_unstickStage) { m_unstickStage = num; m_waypoints.Clear(); m_nextPathTime = 0f; m_thin = true; m_thinUntil = Time.time + 4f; } switch (num) { case 1: { Vector2 val2 = new Vector2(Mathf.Floor(pos.x) + 0.5f, Mathf.Floor(pos.y) + 0.5f) - pos; if (((Vector2)(ref val2)).magnitude > 0.08f) { Move = ((Vector2)(ref val2)).normalized; } break; } case 2: { Vector2 move = Move; Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(Mathf.Sign(move.x) * ((Mathf.Abs(move.x) > 0.2f) ? 1f : 0f), 0f); Vector2 val4 = default(Vector2); ((Vector2)(ref val4))..ctor(0f, Mathf.Sign(move.y) * ((Mathf.Abs(move.y) > 0.2f) ? 1f : 0f)); if (val3 != Vector2.zero && !MoveBlocked(pos, pos + val3 * 0.6f, 0.2f)) { Move = val3; } else if (val4 != Vector2.zero && !MoveBlocked(pos, pos + val4 * 0.6f, 0.2f)) { Move = val4; } else { Move = Perp(move) * m_strafeSign; } break; } case 3: Move = Perp(Move) * m_strafeSign; m_strafeSign = 0f - m_strafeSign; break; default: { m_stuckTimer = 0f; m_unstickStage = 0; PlayerController primaryPlayer = GameManager.Instance.PrimaryPlayer; if (m_order != OrderKind.None) { EndOrder("Bot: stuck, giving up."); } else if ((Object)(object)primaryPlayer != (Object)null && Vector2.Distance(pos, ((BraveBehaviour)primaryPlayer).specRigidbody.UnitCenter) > 3f) { Bot.ReuniteWithOtherPlayer(primaryPlayer, true); } break; } } } goto IL_02e9; } } m_stuckTimer = 0f; m_unstickStage = 0; goto IL_02e9; IL_02e9: m_lastPos = pos; } public bool ConsumeBlank() { bool wantBlank = WantBlank; WantBlank = false; return wantBlank; } private static bool SafeStep(Vector2 pos, Vector2 dir, float len) { //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_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_0035: 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) if (MoveBlocked(pos, pos + dir * len)) { return false; } if ((Object)(object)GameManager.Instance.Dungeon == (Object)null) { return true; } for (int i = 1; i <= 3; i++) { if (Pit(pos + dir * (len * (float)i / 3f))) { return false; } } return true; } private static bool Pit(Vector2 p) { //IL_001e: 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_0025: 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_003c: 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_004d: Invalid comparison between Unknown and I4 Dungeon dungeon = GameManager.Instance.Dungeon; if ((Object)(object)dungeon == (Object)null || dungeon.data == null) { return true; } IntVector2 val = Vector2Extensions.ToIntVector2(p, (VectorConversions)0); if (!dungeon.data.CheckInBounds(val)) { return true; } CellData val2 = dungeon.data[val]; if (val2 != null) { return (int)val2.type == 4; } return true; } private static bool PathPits(Vector2 pos, Vector2 dir, float len) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) for (int i = 1; i <= 4; i++) { if (Pit(pos + dir * (len * (float)i / 4f))) { return true; } } return false; } private float PlanCost(Vector2 pos, Vector2 dir, float speed, float invulnUntil) { //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_001c: 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_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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) float num = 0f; for (float num2 = 0.05f; num2 <= 0.75f; num2 += 0.05f) { if (num2 < invulnUntil) { continue; } Vector2 val = pos + dir * speed * num2; for (int i = 0; i < m_bullets.Count; i++) { Vector2 val2 = m_bullets[i].pos + m_bullets[i].vel * num2 - val; float magnitude = ((Vector2)(ref val2)).magnitude; if (magnitude < 1.1f) { num += 1.1f - magnitude + 0.5f; } } } return num; } private float NewReaction() { float num = 0.04f + Random.value * 0.12f; if (Random.value < 0.03f) { num += 0.25f; } return Time.time + num; } private void AvoidProjectiles(Vector2 pos) { //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_020d: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_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_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_034a: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0315: 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_00f2: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0377: 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) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_039d: 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_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: 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_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_04aa: Unknown result type (might be due to invalid IL or missing references) //IL_04ce: Unknown result type (might be due to invalid IL or missing references) //IL_04d3: Unknown result type (might be due to invalid IL or missing references) //IL_04d8: Unknown result type (might be due to invalid IL or missing references) //IL_04dd: 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_04e4: Unknown result type (might be due to invalid IL or missing references) //IL_04e5: Unknown result type (might be due to invalid IL or missing references) //IL_04e6: Unknown result type (might be due to invalid IL or missing references) //IL_04f4: Unknown result type (might be due to invalid IL or missing references) //IL_04f9: Unknown result type (might be due to invalid IL or missing references) //IL_0580: 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_050a: Unknown result type (might be due to invalid IL or missing references) //IL_050b: Unknown result type (might be due to invalid IL or missing references) //IL_050f: Unknown result type (might be due to invalid IL or missing references) //IL_0514: Unknown result type (might be due to invalid IL or missing references) //IL_058f: Unknown result type (might be due to invalid IL or missing references) //IL_0591: Unknown result type (might be due to invalid IL or missing references) //IL_0520: Unknown result type (might be due to invalid IL or missing references) //IL_0521: Unknown result type (might be due to invalid IL or missing references) //IL_0525: Unknown result type (might be due to invalid IL or missing references) //IL_052f: Unknown result type (might be due to invalid IL or missing references) //IL_0534: Unknown result type (might be due to invalid IL or missing references) //IL_0540: Unknown result type (might be due to invalid IL or missing references) //IL_0541: Unknown result type (might be due to invalid IL or missing references) //IL_056d: Unknown result type (might be due to invalid IL or missing references) //IL_056f: Unknown result type (might be due to invalid IL or missing references) if (Bot.IsDodgeRolling) { return; } m_bullets.Clear(); ReadOnlyCollection<Projectile> allProjectiles = StaticReferenceManager.AllProjectiles; int num = 0; Bullet item; for (int i = 0; i < allProjectiles.Count; i++) { Projectile val = allProjectiles[i]; if ((Object)(object)val == (Object)null || (Object)(object)((BraveBehaviour)val).specRigidbody == (Object)null || !val.collidesWithPlayer || val.Owner is PlayerController) { continue; } Vector2 velocity = ((BraveBehaviour)val).specRigidbody.Velocity; if (((Vector2)(ref velocity)).sqrMagnitude < 0.25f) { continue; } Vector2 unitCenter = ((BraveBehaviour)val).specRigidbody.UnitCenter; Vector2 val2 = unitCenter - pos; if (!(((Vector2)(ref val2)).sqrMagnitude > 256f)) { if (!m_reactAt.TryGetValue(val, out var value)) { value = NewReaction(); m_reactAt[val] = value; } if (!(Time.time < value)) { List<Bullet> bullets = m_bullets; item = new Bullet { pos = unitCenter, vel = velocity }; bullets.Add(item); } } } if (Time.time > m_nextReactCleanup) { m_nextReactCleanup = Time.time + 3f; List<Projectile> list = new List<Projectile>(); foreach (KeyValuePair<Projectile, float> item2 in m_reactAt) { if ((Object)(object)item2.Key == (Object)null) { list.Add(item2.Key); } } foreach (Projectile item3 in list) { m_reactAt.Remove(item3); } if (m_reactAt.Count > 600) { m_reactAt.Clear(); } } if (m_bullets.Count == 0) { m_evadeUntil = 0f; return; } bool flag = false; for (int j = 0; j < m_bullets.Count; j++) { Vector2 val3 = pos - m_bullets[j].pos; item = m_bullets[j]; float magnitude = ((Vector2)(ref item.vel)).magnitude; float num2 = Mathf.Max(0f, Vector2.Dot(val3, m_bullets[j].vel) / (magnitude * magnitude)); Vector2 val4 = val3 - m_bullets[j].vel * num2; if (num2 < 0.55f && ((Vector2)(ref val4)).magnitude < 1.6f) { flag = true; num++; } } float speed = MoveSpeed * 0.75f; float num3 = PlanCost(pos, Vector2.zero, 0f, 0f); if (!flag && Time.time < m_evadeUntil && PlanCost(pos, m_evadeDir, speed, 0f) <= 0.01f && SafeStep(pos, m_evadeDir, 1.6f)) { Move = m_evadeDir; return; } if (num3 <= 0.01f) { m_evadeUntil = 0f; return; } Vector2 val5 = Vector2.zero; float num4 = float.MaxValue; float num5 = float.MaxValue; for (int k = 0; k < 16; k++) { Vector2 val6 = Vector2.op_Implicit(Quaternion.Euler(0f, 0f, (float)k * 22.5f) * Vector3.right); if (SafeStep(pos, val6, 0.9f)) { float num6 = PlanCost(pos, val6, speed, 0f); float num7 = num6 * 10f + Random.value * 0.8f; if (num7 < num4) { num4 = num7; val5 = val6; num5 = num6; } } } if (num5 <= 0.01f) { Move = val5; m_evadeDir = val5; m_evadeUntil = Time.time + 0.12f + Random.value * 0.2f; } if ((num5 > 0.01f || (flag && Random.value < 0.9f)) && Time.time >= m_dodgeReadyTime) { float speed2 = Mathf.Max(8f, Bot.rollStats.GetModifiedDistance(Bot) / Mathf.Max(0.2f, Bot.rollStats.GetModifiedTime(Bot))); float modifiedDistance = Bot.rollStats.GetModifiedDistance(Bot); Vector2 val7 = Vector2.zero; float num8 = float.MaxValue; for (int l = 0; l < 16; l++) { Vector2 val8 = Vector2.op_Implicit(Quaternion.Euler(0f, 0f, (float)l * 22.5f) * Vector3.right); if (!MoveBlocked(pos, pos + val8 * Mathf.Min(modifiedDistance, 1.2f)) && !Pit(pos + val8 * modifiedDistance)) { Pit(pos + val8 * modifiedDistance * 0.5f); float num9 = PlanCost(pos, val8, speed2, 0.4f) * 10f + Random.value * 1.5f; if (num9 < num8) { num8 = num9; val7 = val8; } } } if (val7 != Vector2.zero) { Move = val7; m_dodge = true; m_dodgeReadyTime = Time.time + 0.05f; m_evadeUntil = 0f; } } if (num >= 6 && Bot.Blanks > 0 && Time.time >= m_nextBlankTime && num5 > 0.01f) { WantBlank = true; m_nextBlankTime = Time.time + 2.5f; } } private Vector2 AimError(float dist) { //IL_0050: 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_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) if (Time.time > m_aimErrUntil) { m_aimErrUntil = Time.time + Random.Range(0.25f, 0.6f); m_aimErr = Random.insideUnitCircle * (0.12f + 0.03f * Mathf.Min(dist, 12f)); } return m_aimErr; } private static bool Hazard(Vector2 p) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_0055: Unknown result type (might be due to invalid IL or missing references) Dictionary<IntVector2, DeadlyDeadlyGoopManager> allGoopPositionMap = DeadlyDeadlyGoopManager.allGoopPositionMap; if (allGoopPositionMap == null || allGoopPositionMap.Count == 0) { return false; } IntVector2 key = Vector2Extensions.ToIntVector2(p / DeadlyDeadlyGoopManager.GOOP_GRID_SIZE, (VectorConversions)0); if (!allGoopPositionMap.TryGetValue(key, out var value) || (Object)(object)value == (Object)null || (Object)(object)value.goopDefinition == (Object)null) { return false; } if (!value.IsPositionInGoop(p)) { return false; } if (value.IsPositionOnFire(p)) { return true; } GoopDefinition goopDefinition = value.goopDefinition; if (!goopDefinition.damagesPlayers && !goopDefinition.AppliesDamageOverTime && !goopDefinition.DrainsAmmo && !goopDefinition.AppliesCharm && !goopDefinition.AppliesCheese) { return goopDefinition.AppliesSpeedModifier; } return true; } private static int HazardAlong(Vector2 a, Vector2 b) { //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_0010: Unknown result type (might be due to invalid IL or missing references) int num = 0; for (int i = 0; i <= 8; i++) { if (Hazard(Vector2.Lerp(a, b, (float)i / 8f))) { num++; } } return num; } private static bool HazardNear(Vector2 p) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_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_0024: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_006c: Unknown result type (might be due to invalid IL or missing references) if (!Hazard(p) && !Hazard(p + new Vector2(0.3f, 0f)) && !Hazard(p - new Vector2(0.3f, 0f)) && !Hazard(p + new Vector2(0f, 0.3f))) { return Hazard(p - new Vector2(0f, 0.3f)); } return true; } private void HazardGuard(Vector2 pos) { //IL_0027: 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_0040: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_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_00fe: 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_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011b: 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_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: 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_0154: 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_02ec: 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_01f8: 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_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0189: 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_021d: 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_02c2: 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_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_022d: 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_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) if (Bot.IsDodgeRolling || ((GameActor)Bot).IsFalling) { return; } bool isOnFire = Bot.IsOnFire; bool flag = Hazard(pos); Vector2 val = ((((Vector2)(ref Move)).sqrMagnitude > 0.01f) ? ((Vector2)(ref Move)).normalized : Vector2.zero); bool flag2 = !flag && val != Vector2.zero && (Hazard(pos + val * 0.6f) || Hazard(pos + val * 1f)); if (!isOnFire && !flag && !flag2) { return; } float modifiedDistance = Bot.rollStats.GetModifiedDistance(Bot); Vector2 val2 = Vector2.zero; float num = float.MaxValue; for (int i = 0; i < 24; i++) { Vector2 val3 = Vector2.op_Implicit(Quaternion.Euler(0f, 0f, (float)i * 15f) * Vector3.right); Vector2 val4 = pos + val3 * modifiedDistance; if (!Pit(val4) && !Pit(pos + val3 * modifiedDistance * 0.5f) && !Pit(val4 + val3 * 0.5f) && !MoveBlocked(pos, val4) && !HazardNear(val4)) { int num2 = HazardAlong(pos, val4) - (flag ? 1 : 0); float num3 = (float)Mathf.Max(0, num2) * 3f - ((val == Vector2.zero) ? 0f : Vector2.Dot(val3, val)) + Random.value * 0.2f; if (num3 < num) { num = num3; val2 = val3; } } } if (flag2 && !isOnFire) { for (int j = 0; j < 16; j++) { Vector2 val5 = Vector2.op_Implicit(Quaternion.Euler(0f, 0f, (float)j * 22.5f) * Vector3.right); if (Vector2.Dot(val5, val) > 0.1f && SafeStep(pos, val5, 1.4f) && !Hazard(pos + val5 * 0.7f) && !Hazard(pos + val5 * 1.3f)) { Move = val5; return; } } if (Time.time >= m_dodgeReadyTime && val2 != Vector2.zero && Vector2.Dot(val2, val) > 0.5f) { Move = val2; m_dodge = true; m_dodgeReadyTime = Time.time + 0.4f; } else { Move = Vector2.zero; } } else if (!(val2 == Vector2.zero) && !(Time.time < m_dodgeReadyTime)) { Move = val2; m_dodge = true; m_dodgeReadyTime = Time.time + 0.4f; } } private void ChargeCycle() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 if (!Shoot) { m_chargeStart = -1f; return; } Gun currentGun = ((GameActor)Bot).CurrentGun; if ((Object)(object)currentGun == (Object)null || currentGun.DefaultModule == null || (int)currentGun.DefaultModule.shootStyle != 3) { m_chargeStart = -1f; return; } if (Time.time < m_releaseUntil) { Shoot = false; return; } if (m_chargeStart < 0f) { m_chargeStart = Time.time; } float num = Mathf.Clamp(currentGun.DefaultModule.LongestChargeTime, 0.25f, 3f) + 0.15f; if (Time.time - m_chargeStart > num) { m_releaseUntil = Time.time + 0.15f; m_chargeStart = -1f; Shoot = false; } } private void ScanZones() { //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_008d: 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_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) m_zones.Clear(); try { SkyRocket[] array = Object.FindObjectsOfType<SkyRocket>(); foreach (SkyRocket val in array) { if (!((Object)(object)val == (Object)null) && ((Component)val).gameObject.activeInHierarchy && val.ExplosionData != null && (object)RocketPos != null && (object)RocketState != null && (int)RocketState.GetValue(val) != 0) { Vector3 val2 = (Vector3)RocketPos.GetValue(val); m_zones.Add(new Zone { c = new Vector2(val2.x, val2.y), r = Mathf.Max(1.5f, val.ExplosionData.GetDefinedDamageRadius()) }); } } ReticleRiserEffect[] array2 = Object.FindObjectsOfType<ReticleRiserEffect>(); foreach (ReticleRiserEffect val3 in array2) { if (!((Object)(object)val3 == (Object)null) && ((Component)val3).gameObject.activeInHierarchy) { tk2dSlicedSprite component = ((Component)val3).GetComponent<tk2dSlicedSprite>(); float num = (((Object)(object)component != (Object)null) ? (Mathf.Max(component.dimensions.x, component.dimensions.y) / 32f) : 1.5f); m_zones.Add(new Zone { c = Vector3Extensions.XY(((Component)val3).transform.position), r = Mathf.Clamp(num, 1f, 6f) }); } } } catch (Exception) { } } private float ZoneDepth(Vector2 p, float margin) { //IL_001d: 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) float num = 0f; for (int i = 0; i < m_zones.Count; i++) { float num2 = m_zones[i].r + margin - Vector2.Distance(p, m_zones[i].c); if (num2 > num) { num = num2; } } return num; } private void DangerZoneGuard(Vector2 pos) { //IL_006b: 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_0070: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_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_0094: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //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_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_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_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0146: 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_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_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_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) if (Time.time > m_nextZoneScan) { m_nextZoneScan = Time.time + 0.15f; ScanZones(); } if (m_zones.Count == 0 || Bot.IsDodgeRolling || ((GameActor)Bot).IsFalling) { return; } Vector2 val = ((((Vector2)(ref Move)).sqrMagnitude > 0.01f) ? ((Vector2)(ref Move)).normalized : Vector2.zero); float num = ZoneDepth(pos, 0.5f); if (num <= 0f) { if (val != Vector2.zero && ZoneDepth(pos + val * 0.8f, 0.3f) > 0f) { Move = Vector2.zero; } return; } float modifiedDistance = Bot.rollStats.GetModifiedDistance(Bot); Vector2 val2 = Vector2.zero; float num2 = float.MaxValue; for (int i = 0; i < 24; i++) { Vector2 val3 = Vector2.op_Implicit(Quaternion.Euler(0f, 0f, (float)i * 15f) * Vector3.right); float num3 = ((num > 1.3f) ? modifiedDistance : Mathf.Min(num + 0.6f, 2.5f)); Vector2 val4 = pos + val3 * num3; if (!Pit(val4) && !Pit(pos + val3 * num3 * 0.5f) && !MoveBlocked(pos, val4)) { float num4 = ZoneDepth(val4, 0.5f) * 3f + (float)HazardAlong(pos, val4) * 0.3f + Random.value * 0.2f; if (num4 < num2) { num2 = num4; val2 = val3; } } } if (!(val2 == Vector2.zero)) { Move = val2; if (num > 1f && Time.time >= m_dodgeReadyTime) { m_dodge = true; m_dodgeReadyTime = Time.time + 0.4f; } } } private void PitGuard(Vector2 pos) { //IL_001b: 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_0034: 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_0047: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_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_006c: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: 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_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: 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_014d: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: 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_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: 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_0220: 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_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_0261: 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_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) if (Bot.IsDodgeRolling || ((GameActor)Bot).IsFalling) { return; } bool flag = Pit(pos); Vec