using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using RoundsMod.Cards; using UnboundLib.Cards; using UnboundLib.GameModes; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("RoundsMod")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RoundsMod")] [assembly: AssemblyTitle("RoundsMod")] [assembly: AssemblyVersion("1.0.0.0")] namespace RoundsMod { internal class FilteredLogListener : ILogListener, IDisposable { private readonly StreamWriter _writer; internal FilteredLogListener(string path) { _writer = new StreamWriter(path, append: false) { AutoFlush = true }; } public void LogEvent(object sender, LogEventArgs args) { //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_0038: Invalid comparison between Unknown and I4 //IL_0062: Unknown result type (might be due to invalid IL or missing references) bool num = args.Source.SourceName == "tripletmodnotclickbait" || args.Source.SourceName.StartsWith("RoundsMod"); bool flag = (args.Level & 7) > 0; if (num || flag) { _writer.WriteLine($"[{DateTime.Now:HH:mm:ss.fff}] [{args.Level,-7}:{args.Source.SourceName,30}] {args.Data}"); } } public void Dispose() { _writer.Dispose(); } } [BepInPlugin("com.thisonerandomgy.tripletmodnotclickbait", "tripletmodnotclickbait", "1.0.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private void Awake() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) string path = Path.Combine(Paths.BepInExRootPath, "RoundsMod.log"); Logger.Listeners.Add((ILogListener)(object)new FilteredLogListener(path)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"RoundsMod loaded!"); WrapCard.Log = ((BaseUnityPlugin)this).Logger; EchoCoroutineRunner echoCoroutineRunner = new GameObject("EchoCoroutineRunner").AddComponent(); Object.DontDestroyOnLoad((Object)(object)((Component)echoCoroutineRunner).gameObject); EchoCard.Runner = echoCoroutineRunner; CustomCard.BuildCard((Action)delegate(CardInfo card) { //IL_00b9: 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_017c: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Logger.LogInfo((object)("SwiftCard built: '" + card.cardName + "' cardArt=" + (((Object)(object)card.cardArt != (Object)null) ? ((Object)card.cardArt).name : "NULL"))); if ((Object)(object)card.cardArt != (Object)null) { SpriteRenderer componentInChildren = card.cardArt.GetComponentInChildren(true); ((BaseUnityPlugin)this).Logger.LogInfo((object)(" SpriteRenderer: " + ((!((Object)(object)componentInChildren != (Object)null)) ? "NONE" : (((Object)(object)componentInChildren.sprite != (Object)null) ? ((Object)componentInChildren.sprite).name : "NO SPRITE")))); ((BaseUnityPlugin)this).Logger.LogInfo((object)$" localScale: {card.cardArt.transform.localScale}"); ((BaseUnityPlugin)this).Logger.LogInfo((object)$" activeSelf: {card.cardArt.activeSelf}"); ((BaseUnityPlugin)this).Logger.LogInfo((object)$" activeInHierarchy: {card.cardArt.activeInHierarchy}"); if ((Object)(object)componentInChildren != (Object)null) { ((BaseUnityPlugin)this).Logger.LogInfo((object)$" sortingLayer: {((Renderer)componentInChildren).sortingLayerName} order: {((Renderer)componentInChildren).sortingOrder}"); ((BaseUnityPlugin)this).Logger.LogInfo((object)$" sr.localPos: {((Component)componentInChildren).transform.localPosition}"); ((BaseUnityPlugin)this).Logger.LogInfo((object)$" sr.localScale: {((Component)componentInChildren).transform.localScale}"); } } }); CustomCard.BuildCard(); CustomCard.BuildCard(); CustomCard.BuildCard(); CustomCard.BuildCard(); CustomCard.BuildCard(); CustomCard.BuildCard(); CustomCard.BuildCard(); CustomCard.BuildCard(); CustomCard.BuildCard(); CustomCard.BuildCard(); CustomCard.BuildCard(); CustomCard.BuildCard(); CustomCard.BuildCard(); CustomCard.BuildCard(); ScrambleRunner scrambleRunner = new GameObject("ScrambleRunner").AddComponent(); Object.DontDestroyOnLoad((Object)(object)((Component)scrambleRunner).gameObject); scrambleRunner.RegisterHooks(); CustomCard.BuildCard(); CustomCard.BuildCard(); CustomCard.BuildCard(); CustomCard.BuildCard(); CustomCard.BuildCard(); CustomCard.BuildCard(); CustomCard.BuildCard(); try { new Harmony("com.thisonerandomgy.tripletmodnotclickbait").PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[Wrap] Harmony patches applied successfully."); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("[Wrap] Harmony patch failed: " + ex.Message)); } } } } namespace RoundsMod.Cards { internal class AnchorBehaviour : MonoBehaviour { private const float MaxSpeed = 2f; private Player _player; public void Init(Player player) { _player = player; } private void FixedUpdate() { //IL_004b: 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) if (!((Object)(object)_player == (Object)null) && !((Object)(object)_player.data == (Object)null)) { PlayerVelocity playerVel = _player.data.playerVel; Rigidbody2D val = ((playerVel != null) ? ((Component)playerVel).GetComponent() : null); if (!((Object)(object)val == (Object)null)) { val.velocity = Vector2.ClampMagnitude(val.velocity, 2f); } } } } internal class AnchorCard : CustomCard { private const float MovePenalty = 0.9f; internal static readonly Dictionary StackCounts = new Dictionary(); internal static readonly Dictionary GunToPlayer = new Dictionary(); protected override string GetTitle() { return "Anchor"; } protected override string GetDescription() { return "Movement is nearly locked. Bullets home aggressively. Deal double damage."; } protected override CardInfoStat[] GetStats() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //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_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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0060: 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_006c: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown return (CardInfoStat[])(object)new CardInfoStat[3] { new CardInfoStat { positive = true, stat = "Damage", amount = "x2", simepleAmount = (SimpleAmount)3 }, new CardInfoStat { positive = true, stat = "Homing", amount = "Aggressive", simepleAmount = (SimpleAmount)0 }, new CardInfoStat { positive = false, stat = "Move Speed", amount = "-90%", simepleAmount = (SimpleAmount)7 } }; } protected override Rarity GetRarity() { return (Rarity)2; } protected override GameObject GetCardArt() { return CardArt.Load("C_ANCHORCARD"); } protected override CardThemeColorType GetTheme() { return (CardThemeColorType)0; } public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) int instanceID = ((Object)player).GetInstanceID(); int instanceID2 = ((Object)gun).GetInstanceID(); StackCounts.TryGetValue(instanceID, out var value); StackCounts[instanceID] = value + 1; GunToPlayer[instanceID2] = instanceID; characterStats.movementSpeed -= 0.9f; gun.damage *= 2f; if ((Object)(object)((Component)player).GetComponentInChildren() == (Object)null) { GameObject val = new GameObject("AnchorEffect"); val.transform.SetParent(((Component)player).transform, false); val.AddComponent().Init(player); } } public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { int instanceID = ((Object)player).GetInstanceID(); if (!StackCounts.TryGetValue(instanceID, out var value)) { return; } characterStats.movementSpeed += 0.9f; gun.damage /= 2f; if (value > 1) { StackCounts[instanceID] = value - 1; return; } StackCounts.Remove(instanceID); GunToPlayer.Remove(((Object)gun).GetInstanceID()); AnchorBehaviour componentInChildren = ((Component)player).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { Object.Destroy((Object)(object)((Component)componentInChildren).gameObject); } } } [HarmonyPatch(typeof(Gun), "BulletInit")] internal static class AnchorBulletInitPatch { [HarmonyPostfix] private static void Postfix(Gun __instance, GameObject bullet) { int instanceID = ((Object)__instance).GetInstanceID(); if (AnchorCard.GunToPlayer.ContainsKey(instanceID)) { bullet.AddComponent(); } } } internal class BoomerangBulletBehaviour : MonoBehaviour { private const float HalfTime = 0.6f; private static readonly BindingFlags _allInstance = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; private static FieldInfo _velocityField; private static FieldInfo _dragField; private static FieldInfo _dragMinSpeedField; private static FieldInfo _playersHitField; private MoveTransform _mover; private ProjectileHit _projHit; private Vector3 _initialVelocity; private float _elapsed; private bool _reversed; public void Init(Player owner) { //IL_00d6: 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) _mover = ((Component)this).GetComponent(); _projHit = ((Component)this).GetComponent(); if (_velocityField == null) { _velocityField = typeof(MoveTransform).GetField("velocity", _allInstance); _dragField = typeof(MoveTransform).GetField("drag", _allInstance); _dragMinSpeedField = typeof(MoveTransform).GetField("dragMinSpeed", _allInstance); } if (_playersHitField == null) { _playersHitField = typeof(ProjectileHit).GetField("playersHit", _allInstance); } if ((Object)(object)_mover != (Object)null && _velocityField != null) { _initialVelocity = (Vector3)_velocityField.GetValue(_mover); _dragField?.SetValue(_mover, 0f); _dragMinSpeedField?.SetValue(_mover, 0f); } } private void Update() { //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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_0059: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_mover == (Object)null || _velocityField == null) { return; } _elapsed += Time.deltaTime; if (!_reversed) { float num = Mathf.Clamp01(_elapsed / 0.6f); SetVelocity(_initialVelocity * (1f - num)); if (_elapsed >= 0.6f) { _reversed = true; _elapsed = 0f; if ((Object)(object)_projHit != (Object)null && _playersHitField != null) { (_playersHitField.GetValue(_projHit) as IList)?.Clear(); } if ((Object)(object)_projHit != (Object)null) { _projHit.fullSelfDamage = true; } } } else { float num2 = Mathf.Clamp01(_elapsed / 0.6f); SetVelocity(-_initialVelocity * num2); if (_elapsed >= 0.6f) { ((Behaviour)this).enabled = false; } } } private void SetVelocity(Vector3 vel) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) _velocityField.SetValue(_mover, vel); } } internal class BoomerangCard : CustomCard { internal static readonly Dictionary StackCounts = new Dictionary(); internal static readonly Dictionary GunToPlayer = new Dictionary(); internal static readonly Dictionary PlayerRefs = new Dictionary(); protected override string GetTitle() { return "Boomerang"; } protected override string GetDescription() { return "Bullets decelerate, stop, then return. Can hit enemies on the way back — even yourself."; } protected override CardInfoStat[] GetStats() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown return (CardInfoStat[])(object)new CardInfoStat[1] { new CardInfoStat { positive = true, stat = "Bullet", amount = "Returns after 0.6 s", simepleAmount = (SimpleAmount)0 } }; } protected override Rarity GetRarity() { return (Rarity)1; } protected override GameObject GetCardArt() { return CardArt.Load("C_BOOMERANGCARD"); } protected override CardThemeColorType GetTheme() { return (CardThemeColorType)3; } public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { int instanceID = ((Object)player).GetInstanceID(); int instanceID2 = ((Object)gun).GetInstanceID(); StackCounts.TryGetValue(instanceID, out var value); StackCounts[instanceID] = value + 1; GunToPlayer[instanceID2] = instanceID; PlayerRefs[instanceID] = player; } public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { int instanceID = ((Object)player).GetInstanceID(); if (StackCounts.TryGetValue(instanceID, out var value)) { if (value > 1) { StackCounts[instanceID] = value - 1; return; } StackCounts.Remove(instanceID); GunToPlayer.Remove(((Object)gun).GetInstanceID()); PlayerRefs.Remove(instanceID); } } } [HarmonyPatch(typeof(Gun), "BulletInit")] internal static class BoomerangBulletInitPatch { [HarmonyPostfix] private static void Postfix(Gun __instance, GameObject bullet) { int instanceID = ((Object)__instance).GetInstanceID(); if (BoomerangCard.GunToPlayer.TryGetValue(instanceID, out var value)) { BoomerangCard.PlayerRefs.TryGetValue(value, out var value2); bullet.AddComponent().Init(value2); } } } internal class BulletWrapBehaviour : MonoBehaviour { [CompilerGenerated] private sealed class d__13 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public BulletWrapBehaviour <>4__this; private Collider2D[] 5__2; private ProjectileHit[] 5__3; private ProjectileCollision[] 5__4; private RayCastTrail[] 5__5; private TrailRenderer[] 5__6; private LineRenderer[] 5__7; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; 5__3 = null; 5__4 = null; 5__5 = null; 5__6 = null; 5__7 = null; <>1__state = -2; } private bool MoveNext() { //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Expected O, but got Unknown //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Expected O, but got Unknown //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Expected O, but got Unknown int num = <>1__state; BulletWrapBehaviour bulletWrapBehaviour = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; 5__2 = ((Component)bulletWrapBehaviour).GetComponentsInChildren(true); 5__3 = ((Component)bulletWrapBehaviour).GetComponentsInChildren(true); 5__4 = ((Component)bulletWrapBehaviour).GetComponentsInChildren(true); 5__5 = ((Component)bulletWrapBehaviour).GetComponentsInChildren(true); 5__6 = ((Component)bulletWrapBehaviour).GetComponentsInChildren(true); 5__7 = ((Component)bulletWrapBehaviour).GetComponentsInChildren(true); Collider2D[] array = 5__2; for (int i = 0; i < array.Length; i++) { ((Behaviour)array[i]).enabled = false; } ProjectileHit[] array2 = 5__3; for (int i = 0; i < array2.Length; i++) { ((Behaviour)array2[i]).enabled = false; } ProjectileCollision[] array3 = 5__4; for (int i = 0; i < array3.Length; i++) { ((Behaviour)array3[i]).enabled = false; } RayCastTrail[] array4 = 5__5; for (int i = 0; i < array4.Length; i++) { ((Behaviour)array4[i]).enabled = false; } TrailRenderer[] array5 = 5__6; for (int i = 0; i < array5.Length; i++) { array5[i].emitting = false; } LineRenderer[] array6 = 5__7; for (int i = 0; i < array6.Length; i++) { array6[i].positionCount = 0; } ManualLogSource log2 = WrapCard.Log; if (log2 != null) { log2.LogInfo((object)$"[Wrap] Cleanup: disabled col={5__2.Length} ph={5__3.Length} pc={5__4.Length} rct={5__5.Length}"); } <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 1; return true; } case 1: <>1__state = -1; <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 2; return true; case 2: <>1__state = -1; <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 3; return true; case 3: { <>1__state = -1; if ((Object)(object)bulletWrapBehaviour == (Object)null || (Object)(object)((Component)bulletWrapBehaviour).gameObject == (Object)null) { return false; } bulletWrapBehaviour.ResetRayCastTrailPositions(((Component)bulletWrapBehaviour).transform.position); Collider2D[] array = 5__2; foreach (Collider2D val in array) { if ((Object)(object)val != (Object)null) { ((Behaviour)val).enabled = true; } } ProjectileHit[] array2 = 5__3; foreach (ProjectileHit val2 in array2) { if ((Object)(object)val2 != (Object)null) { ((Behaviour)val2).enabled = true; } } ProjectileCollision[] array3 = 5__4; foreach (ProjectileCollision val3 in array3) { if ((Object)(object)val3 != (Object)null) { ((Behaviour)val3).enabled = true; } } RayCastTrail[] array4 = 5__5; foreach (RayCastTrail val4 in array4) { if ((Object)(object)val4 != (Object)null) { ((Behaviour)val4).enabled = true; } } TrailRenderer[] array5 = 5__6; foreach (TrailRenderer val5 in array5) { if ((Object)(object)val5 != (Object)null) { val5.Clear(); val5.emitting = true; } } LineRenderer[] array6 = 5__7; foreach (LineRenderer val6 in array6) { if ((Object)(object)val6 != (Object)null) { val6.positionCount = 0; } } ManualLogSource log = WrapCard.Log; if (log != null) { log.LogInfo((object)"[Wrap] Cleanup: re-enabled"); } return false; } } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private int _wrapsRemaining; private bool _firstWrap = true; private static readonly BindingFlags _allInstance = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; private static FieldInfo _velocityField; private static FieldInfo[] _rctPosFields; private static bool _rctPosFieldsScanned; private static readonly string[] _candidateNames = new string[17] { "startPos", "lastPos", "prevPos", "from", "start", "last", "prev", "pos", "startPosition", "lastPosition", "previousPosition", "lastFramePos", "currentPos", "rayStart", "rayFrom", "origin", "lastOrigin" }; public void Init(int wraps) { _wrapsRemaining = wraps; } private void LateUpdate() { //IL_0021: 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_002b: 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_002d: 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_004d: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) if (_wrapsRemaining <= 0) { return; } Camera main = Camera.main; if ((Object)(object)main == (Object)null) { return; } Vector3 val = main.WorldToViewportPoint(((Component)this).transform.position); Vector3 val2 = val; bool flag = false; if (val.x < 0f) { val2.x = 1f; flag = true; } else if (val.x > 1f) { val2.x = 0f; flag = true; } else if (val.y < 0f) { val2.y = 1f; flag = true; } else if (val.y > 1f) { val2.y = 0f; flag = true; } if (flag) { if (_firstWrap) { _firstWrap = false; DumpBulletInfo(); } Vector3 velocity = GetVelocity(); Vector3 val3 = main.ViewportToWorldPoint(val2); val3.z = ((Component)this).transform.position.z; val3 += velocity * Time.deltaTime; ((Component)this).transform.position = val3; Rigidbody2D component = ((Component)this).GetComponent(); if ((Object)(object)component != (Object)null) { component.position = new Vector2(val3.x, val3.y); } ResetRayCastTrailPositions(val3); _wrapsRemaining--; ((MonoBehaviour)this).StartCoroutine(PostWrapCleanup()); } } private void DumpBulletInfo() { ManualLogSource log = WrapCard.Log; if (log != null) { log.LogInfo((object)"[Wrap] ── RayCastTrail fields ──"); } RayCastTrail component = ((Component)this).GetComponent(); if ((Object)(object)component != (Object)null) { FieldInfo[] fields = ((object)component).GetType().GetFields(_allInstance); foreach (FieldInfo fieldInfo in fields) { ManualLogSource log2 = WrapCard.Log; if (log2 != null) { log2.LogInfo((object)$"[Wrap] {fieldInfo.Name} ({fieldInfo.FieldType.Name}) = {fieldInfo.GetValue(component)}"); } } } else { ManualLogSource log3 = WrapCard.Log; if (log3 != null) { log3.LogInfo((object)"[Wrap] (no RayCastTrail on root)"); } } } private void ResetRayCastTrailPositions(Vector3 pos) { //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_007f: 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) if (!_rctPosFieldsScanned) { ScanRctPosFields(); } if (_rctPosFields == null || _rctPosFields.Length == 0) { return; } RayCastTrail component = ((Component)this).GetComponent(); if ((Object)(object)component == (Object)null) { return; } FieldInfo[] rctPosFields = _rctPosFields; foreach (FieldInfo fieldInfo in rctPosFields) { if (fieldInfo.FieldType == typeof(Vector2)) { fieldInfo.SetValue(component, Vector2.op_Implicit(pos)); } else if (fieldInfo.FieldType == typeof(Vector3)) { fieldInfo.SetValue(component, pos); } ManualLogSource log = WrapCard.Log; if (log != null) { log.LogInfo((object)$"[Wrap] Reset RayCastTrail.{fieldInfo.Name} → {pos}"); } } } private static void ScanRctPosFields() { _rctPosFieldsScanned = true; List list = new List(); string[] candidateNames = _candidateNames; foreach (string name in candidateNames) { FieldInfo field = typeof(RayCastTrail).GetField(name, _allInstance); if (field != null && (field.FieldType == typeof(Vector2) || field.FieldType == typeof(Vector3))) { list.Add(field); } } _rctPosFields = list.ToArray(); } private Vector3 GetVelocity() { //IL_0010: 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_004e: Unknown result type (might be due to invalid IL or missing references) MoveTransform component = ((Component)this).GetComponent(); if ((Object)(object)component == (Object)null) { return Vector3.zero; } if (_velocityField == null) { _velocityField = typeof(MoveTransform).GetField("velocity", _allInstance); } if (!(_velocityField != null)) { return Vector3.zero; } return (Vector3)_velocityField.GetValue(component); } [IteratorStateMachine(typeof(d__13))] private IEnumerator PostWrapCleanup() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__13(0) { <>4__this = this }; } } internal static class CardArt { private static readonly ManualLogSource Log = Logger.CreateLogSource("RoundsMod.CardArt"); private static AssetBundle _bundle; private static bool _loadAttempted; private static AssetBundle Bundle { get { if (_loadAttempted) { return _bundle; } _loadAttempted = true; Assembly executingAssembly = Assembly.GetExecutingAssembly(); string[] manifestResourceNames = executingAssembly.GetManifestResourceNames(); foreach (string text in manifestResourceNames) { if (text.EndsWith("cardarts")) { using (Stream stream = executingAssembly.GetManifestResourceStream(text)) { byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); _bundle = AssetBundle.LoadFromMemory(array); } break; } } return _bundle; } } public static GameObject Load(string prefabName) { AssetBundle bundle = Bundle; if ((Object)(object)bundle == (Object)null) { return null; } GameObject obj = bundle.LoadAsset(prefabName); if ((Object)(object)obj == (Object)null) { Log.LogWarning((object)("Card art '" + prefabName + "' not found in bundle.")); } return obj; } } internal class CardThiefCard : CustomCard { private static readonly Dictionary _stackCounts = new Dictionary(); protected override string GetTitle() { return "Card Thief"; } protected override string GetDescription() { return "On kill, steal a random card from your victim."; } protected override CardInfoStat[] GetStats() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown return (CardInfoStat[])(object)new CardInfoStat[1] { new CardInfoStat { positive = true, stat = "On Kill", amount = "Steal 1 random card", simepleAmount = (SimpleAmount)0 } }; } protected override Rarity GetRarity() { return (Rarity)2; } protected override GameObject GetCardArt() { return CardArt.Load("C_CARDTHIEFCARD"); } protected override CardThemeColorType GetTheme() { return (CardThemeColorType)8; } public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) int instanceID = ((Object)player).GetInstanceID(); _stackCounts.TryGetValue(instanceID, out var value); _stackCounts[instanceID] = value + 1; if (!((Object)(object)((Component)player).GetComponentInChildren() != (Object)null)) { GameObject val = new GameObject("CardThiefWatcher"); val.transform.SetParent(((Component)player).transform, false); val.AddComponent().Init(player, _stackCounts); } } public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { int instanceID = ((Object)player).GetInstanceID(); if (!_stackCounts.TryGetValue(instanceID, out var value)) { return; } if (value > 1) { _stackCounts[instanceID] = value - 1; return; } _stackCounts.Remove(instanceID); CardThiefBehaviour componentInChildren = ((Component)player).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { Object.Destroy((Object)(object)((Component)componentInChildren).gameObject); } } } internal class CardThiefBehaviour : MonoBehaviour { private static readonly ManualLogSource Log = Logger.CreateLogSource("RoundsMod.CardThief"); private static bool _reflected; private static FieldInfo _currentCardsField; private static MethodInfo _addCardMethod; private static MethodInfo _removeCardMethod; private static object _moddingUtilsCardsInstance; private Player _player; private Dictionary _stackCounts; private readonly Dictionary _wasDeadLastFrame = new Dictionary(); public void Init(Player player, Dictionary stackCounts) { _player = player; _stackCounts = stackCounts; EnsureReflection(); } private static void EnsureReflection() { if (_reflected) { return; } _reflected = true; BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; BindingFlags bindingAttr2 = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; _currentCardsField = typeof(CharacterData).GetField("currentCards", bindingAttr); if (_currentCardsField == null) { FieldInfo[] fields = typeof(CharacterData).GetFields(bindingAttr); foreach (FieldInfo fieldInfo in fields) { if (fieldInfo.FieldType == typeof(List)) { _currentCardsField = fieldInfo; break; } } } _addCardMethod = typeof(CharacterData).GetMethod("AddCard", bindingAttr, null, new Type[1] { typeof(CardInfo) }, null); Type type = Type.GetType("ModdingUtils.Utils.Cards, ModdingUtils"); if (type != null) { MethodInfo[] methods = type.GetMethods(bindingAttr2); foreach (MethodInfo methodInfo in methods) { if (!(methodInfo.Name != "RemoveCardFromPlayer")) { ParameterInfo[] parameters = methodInfo.GetParameters(); if (parameters.Length >= 2 && parameters[0].ParameterType == typeof(Player) && parameters[1].ParameterType == typeof(CardInfo)) { _removeCardMethod = methodInfo; break; } } } if (_removeCardMethod == null) { PropertyInfo propertyInfo = type.GetProperty("instance", bindingAttr2) ?? type.GetProperty("Instance", bindingAttr2); if (propertyInfo != null) { _moddingUtilsCardsInstance = propertyInfo.GetValue(null); methods = type.GetMethods(bindingAttr); foreach (MethodInfo methodInfo2 in methods) { if (!(methodInfo2.Name != "RemoveCardFromPlayer")) { ParameterInfo[] parameters2 = methodInfo2.GetParameters(); if (parameters2.Length >= 2 && parameters2[0].ParameterType == typeof(Player) && parameters2[1].ParameterType == typeof(CardInfo)) { _removeCardMethod = methodInfo2; break; } } } } } } Log.LogInfo((object)("[CardThief] currentCardsField=" + ((_currentCardsField != null) ? _currentCardsField.Name : "null") + ", addCard=" + ((_addCardMethod != null) ? "found" : "null") + ", removeCard=" + ((_removeCardMethod != null) ? "found" : "null"))); } private void Update() { if ((Object)(object)_player == (Object)null) { return; } foreach (Player player in PlayerManager.instance.players) { if ((Object)(object)player == (Object)null || (Object)(object)player == (Object)(object)_player || (Object)(object)player.data == (Object)null) { continue; } int instanceID = ((Object)player).GetInstanceID(); bool value; bool flag = _wasDeadLastFrame.TryGetValue(instanceID, out value) && value; bool dead = player.data.dead; _wasDeadLastFrame[instanceID] = dead; if (!(!dead || flag) && !((Object)(object)player.data.lastSourceOfDamage != (Object)(object)_player)) { _stackCounts.TryGetValue(((Object)_player).GetInstanceID(), out var value2); int num = Mathf.Max(1, value2); for (int i = 0; i < num; i++) { StealCard(player); } } } } private void StealCard(Player victim) { if (_currentCardsField == null) { return; } object value = _currentCardsField.GetValue(victim.data); if (value == null || !(value is IList list) || list.Count == 0) { return; } int index = Random.Range(0, list.Count); object? obj = list[index]; CardInfo val = (CardInfo)((obj is CardInfo) ? obj : null); if ((Object)(object)val == (Object)null) { return; } try { if (_removeCardMethod != null && _removeCardMethod.Invoke(_moddingUtilsCardsInstance, new object[3] { victim, val, false }) is IEnumerator enumerator) { ((MonoBehaviour)this).StartCoroutine(enumerator); } } catch (Exception ex) { Log.LogWarning((object)("[CardThief] RemoveCardFromPlayer failed: " + ex.Message)); } try { if (_addCardMethod != null) { _addCardMethod.Invoke(_player.data, new object[1] { val }); } } catch (Exception ex2) { Log.LogWarning((object)("[CardThief] AddCard failed: " + ex2.Message)); } } } internal class ChainReactionCard : CustomCard { private static readonly Dictionary _stackCounts = new Dictionary(); protected override string GetTitle() { return "Chain Reaction"; } protected override string GetDescription() { return "On kill, detonate an explosion at the kill location."; } protected override CardInfoStat[] GetStats() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown return (CardInfoStat[])(object)new CardInfoStat[1] { new CardInfoStat { positive = true, stat = "On Kill", amount = "Explosion at kill pos", simepleAmount = (SimpleAmount)0 } }; } protected override Rarity GetRarity() { return (Rarity)2; } protected override GameObject GetCardArt() { return CardArt.Load("C_CHAINREACTIONCARD"); } protected override CardThemeColorType GetTheme() { return (CardThemeColorType)0; } public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) int instanceID = ((Object)player).GetInstanceID(); _stackCounts.TryGetValue(instanceID, out var value); _stackCounts[instanceID] = value + 1; if (!((Object)(object)((Component)player).GetComponentInChildren() != (Object)null)) { GameObject val = new GameObject("ChainReactionWatcher"); val.transform.SetParent(((Component)player).transform, false); val.AddComponent().Init(player, _stackCounts); } } public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { int instanceID = ((Object)player).GetInstanceID(); if (!_stackCounts.TryGetValue(instanceID, out var value)) { return; } if (value > 1) { _stackCounts[instanceID] = value - 1; return; } _stackCounts.Remove(instanceID); ChainReactionBehaviour componentInChildren = ((Component)player).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { Object.Destroy((Object)(object)((Component)componentInChildren).gameObject); } } } internal class ChainReactionBehaviour : MonoBehaviour { [CompilerGenerated] private sealed class d__9 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public float delay; public Vector2 origin; public ChainReactionBehaviour <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__9(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_0191: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: 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_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_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; ChainReactionBehaviour chainReactionBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; if (delay > 0f) { <>2__current = (object)new WaitForSeconds(delay); <>1__state = 1; return true; } goto IL_0057; case 1: <>1__state = -1; goto IL_0057; case 2: { <>1__state = -1; return false; } IL_0057: foreach (Player player in PlayerManager.instance.players) { if ((Object)(object)player == (Object)null || (Object)(object)player.data == (Object)null || player.data.dead) { continue; } Vector2 val = Vector2.op_Implicit(((Component)player).transform.position); float num2 = Vector2.Distance(val, origin); if (num2 > 4f) { continue; } Vector2 val2 = val - origin; Vector2 val3 = ((((Vector2)(ref val2)).sqrMagnitude > 0.01f) ? ((Vector2)(ref val2)).normalized : Vector2.up); float num3 = 1f - num2 / 4f; ((Damagable)player.data.healthHandler).CallTakeDamage(val3 * 80f * num3, origin, (GameObject)null, chainReactionBehaviour._player, true); PlayerVelocity playerVel = player.data.playerVel; if (playerVel != null) { Rigidbody2D component = ((Component)playerVel).GetComponent(); if (component != null) { component.AddForce(val3 * 80f * num3, (ForceMode2D)1); } } } <>2__current = ((MonoBehaviour)chainReactionBehaviour).StartCoroutine(chainReactionBehaviour.ExplosionVisual(origin)); <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__10 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Vector2 origin; private GameObject 5__2; private Material 5__3; private float 5__4; private float 5__5; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__10(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; 5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_0080: 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_00fb: 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) switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__2 = GameObject.CreatePrimitive((PrimitiveType)0); 5__2.transform.position = Vector2.op_Implicit(origin); Object.Destroy((Object)(object)5__2.GetComponent()); 5__3 = new Material(Shader.Find("Sprites/Default")); 5__3.color = new Color(1f, 0.4f, 0f, 0.9f); 5__2.GetComponent().material = 5__3; 5__4 = 0.45f; 5__5 = 0f; break; case 1: <>1__state = -1; break; } if (5__5 < 5__4) { 5__5 += Time.deltaTime; float num = 5__5 / 5__4; 5__2.transform.localScale = Vector3.one * Mathf.Lerp(0.5f, 8f, num); 5__3.color = new Color(1f, 0.4f, 0f, Mathf.Lerp(0.9f, 0f, num)); <>2__current = null; <>1__state = 1; return true; } Object.Destroy((Object)(object)5__2); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static readonly ManualLogSource Log = Logger.CreateLogSource("RoundsMod.ChainReaction"); private const float ExplosionRadius = 4f; private const float ExplosionDamage = 80f; private const float ExplosionKnock = 80f; private Player _player; private Dictionary _stackCounts; private readonly Dictionary _wasDeadLastFrame = new Dictionary(); public void Init(Player player, Dictionary stackCounts) { _player = player; _stackCounts = stackCounts; Log.LogInfo((object)$"[ChainReaction] Init — watching as player {((Object)player).GetInstanceID()}."); } private void Update() { //IL_0135: 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_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_player == (Object)null) { return; } foreach (Player player in PlayerManager.instance.players) { if ((Object)(object)player == (Object)null || (Object)(object)player == (Object)(object)_player || (Object)(object)player.data == (Object)null) { continue; } int instanceID = ((Object)player).GetInstanceID(); bool value; bool flag = _wasDeadLastFrame.TryGetValue(instanceID, out value) && value; bool dead = player.data.dead; _wasDeadLastFrame[instanceID] = dead; if (!dead || flag) { continue; } int num = (((Object)(object)player.data.lastSourceOfDamage != (Object)null) ? ((Object)player.data.lastSourceOfDamage).GetInstanceID() : (-1)); int instanceID2 = ((Object)_player).GetInstanceID(); Log.LogInfo((object)$"[ChainReaction] Player {instanceID} just died — lastDamageSource={num} owner={instanceID2} match={num == instanceID2}"); if (!((Object)(object)player.data.lastSourceOfDamage != (Object)(object)_player)) { Vector2 val = Vector2.op_Implicit(((Component)player).transform.position); _stackCounts.TryGetValue(((Object)_player).GetInstanceID(), out var value2); int num2 = Mathf.Max(1, value2); Log.LogInfo((object)$"[ChainReaction] Triggering {num2} explosion(s) at ({val.x:F1},{val.y:F1})."); for (int i = 0; i < num2; i++) { ((MonoBehaviour)this).StartCoroutine(ChainExplosion(val, (float)i * 0.25f)); } } } } [IteratorStateMachine(typeof(d__9))] private IEnumerator ChainExplosion(Vector2 origin, float delay) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__9(0) { <>4__this = this, origin = origin, delay = delay }; } [IteratorStateMachine(typeof(d__10))] private IEnumerator ExplosionVisual(Vector2 origin) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__10(0) { origin = origin }; } } internal class EchoCoroutineRunner : MonoBehaviour { [CompilerGenerated] private sealed class d__2 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Gun gun; public int stacks; private int 5__2; private int 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (_attackMethod == null) { _attackMethod = typeof(Gun).GetMethod("Attack", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } 5__2 = ((Object)gun).GetInstanceID(); 5__3 = 1; break; case 1: <>1__state = -1; if ((Object)(object)gun == (Object)null) { return false; } EchoBulletInitPatch.IncrementPending(5__2); _attackMethod?.Invoke(gun, new object[5] { 1f, true, 1f, 0f, false }); 5__3++; break; } if (5__3 <= stacks) { <>2__current = (object)new WaitForSeconds((float)5__3 * 0.5f); <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static MethodInfo _attackMethod; public void RunEcho(Gun gun, int stacks) { ((MonoBehaviour)this).StartCoroutine(EchoRoutine(gun, stacks)); } [IteratorStateMachine(typeof(d__2))] private IEnumerator EchoRoutine(Gun gun, int stacks) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__2(0) { gun = gun, stacks = stacks }; } } internal class EchoCard : CustomCard { internal static readonly Dictionary StackCounts = new Dictionary(); internal static readonly Dictionary GunToPlayer = new Dictionary(); internal static EchoCoroutineRunner Runner; protected override string GetTitle() { return "Echo"; } protected override string GetDescription() { return "Fires a second identical bullet 0.5 s after the original shot."; } protected override CardInfoStat[] GetStats() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown return (CardInfoStat[])(object)new CardInfoStat[1] { new CardInfoStat { positive = true, stat = "Echo Bullets", amount = "+1 per 0.5 s", simepleAmount = (SimpleAmount)0 } }; } protected override Rarity GetRarity() { return (Rarity)1; } protected override GameObject GetCardArt() { return CardArt.Load("C_ECHOCARD"); } protected override CardThemeColorType GetTheme() { return (CardThemeColorType)8; } public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { int instanceID = ((Object)player).GetInstanceID(); int instanceID2 = ((Object)gun).GetInstanceID(); StackCounts.TryGetValue(instanceID, out var value); StackCounts[instanceID] = value + 1; GunToPlayer[instanceID2] = instanceID; } public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { int instanceID = ((Object)player).GetInstanceID(); if (StackCounts.TryGetValue(instanceID, out var value)) { if (value > 1) { StackCounts[instanceID] = value - 1; return; } StackCounts.Remove(instanceID); GunToPlayer.Remove(((Object)gun).GetInstanceID()); } } } [HarmonyPatch(typeof(Gun), "BulletInit")] internal static class EchoBulletInitPatch { internal static readonly Dictionary PendingEchoShots = new Dictionary(); private static readonly Dictionary _pendingConsumedFrame = new Dictionary(); private static readonly Dictionary _lastFirePos = new Dictionary(); private static readonly Dictionary _lastEchoFrame = new Dictionary(); internal static void IncrementPending(int gid) { PendingEchoShots.TryGetValue(gid, out var value); PendingEchoShots[gid] = value + 1; } [HarmonyPostfix] private static void Postfix(Gun __instance, GameObject bullet) { //IL_00db: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) int instanceID = ((Object)__instance).GetInstanceID(); if (!EchoCard.GunToPlayer.TryGetValue(instanceID, out var value)) { return; } if (PendingEchoShots.TryGetValue(instanceID, out var value2) && value2 > 0) { int frameCount = Time.frameCount; if (!_pendingConsumedFrame.TryGetValue(instanceID, out var value3) || value3 != frameCount) { _pendingConsumedFrame[instanceID] = frameCount; PendingEchoShots[instanceID] = value2 - 1; } _lastEchoFrame[instanceID] = frameCount; if ((Object)(object)bullet != (Object)null && _lastFirePos.TryGetValue(instanceID, out var value4)) { bullet.transform.position = value4; Rigidbody2D component = bullet.GetComponent(); if ((Object)(object)component != (Object)null) { component.position = new Vector2(value4.x, value4.y); } } return; } if ((Object)(object)bullet != (Object)null) { _lastFirePos[instanceID] = bullet.transform.position; } if (EchoCard.StackCounts.TryGetValue(value, out var value5) && value5 > 0 && !((Object)(object)EchoCard.Runner == (Object)null)) { int frameCount2 = Time.frameCount; if (!_lastEchoFrame.TryGetValue(instanceID, out var value6) || value6 != frameCount2) { _lastEchoFrame[instanceID] = frameCount2; EchoCard.Runner.RunEcho(__instance, value5); } } } } internal class HeavyCard : CustomCard { private static readonly ManualLogSource Log = Logger.CreateLogSource("RoundsMod.HeavyCard"); protected override string GetTitle() { return "Heavy"; } protected override string GetDescription() { return "I looooooooove chocolate but I can't eat it or I'll get fat."; } protected override CardInfoStat[] GetStats() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //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_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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0060: 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_006c: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //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) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown return (CardInfoStat[])(object)new CardInfoStat[4] { new CardInfoStat { positive = true, stat = "Health", amount = "+30%", simepleAmount = (SimpleAmount)2 }, new CardInfoStat { positive = true, stat = "Damage", amount = "+30%", simepleAmount = (SimpleAmount)2 }, new CardInfoStat { positive = false, stat = "Move Speed", amount = "-30%", simepleAmount = (SimpleAmount)2 }, new CardInfoStat { positive = false, stat = "Jump Height", amount = "-30%", simepleAmount = (SimpleAmount)2 } }; } protected override Rarity GetRarity() { return (Rarity)0; } protected override GameObject GetCardArt() { return CardArt.Load("C_HEAVYCARD"); } protected override CardThemeColorType GetTheme() { return (CardThemeColorType)3; } public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { Log.LogInfo((object)"SwiftCard picked!"); characterStats.movementSpeed -= 0.3f; characterStats.jump -= 0.3f; gun.damage += 0.3f; characterStats.health += 0.3f; characterStats.sizeMultiplier += 1f; } public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { characterStats.movementSpeed += 0.3f; characterStats.jump += 0.3f; gun.damage -= 0.3f; characterStats.health -= 0.3f; characterStats.sizeMultiplier -= 1f; } } internal class HomingBulletBehaviour : MonoBehaviour { private Player _owner; private MoveTransform _mover; private float _elapsed; private const float BaseTurnRate = 3f; private const float TurnGrowth = 2f; private static readonly BindingFlags _allInstance = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; private static FieldInfo _velocityField; private void Start() { _mover = ((Component)this).GetComponent(); ProjectileHit component = ((Component)this).GetComponent(); if ((Object)(object)component != (Object)null) { if (_velocityField == null) { _velocityField = typeof(MoveTransform).GetField("velocity", _allInstance); } _owner = component.ownPlayer; } } private void Update() { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_mover == (Object)null || _velocityField == null) { return; } Player val = FindNearestEnemy(); if (!((Object)(object)val == (Object)null)) { _elapsed += Time.deltaTime; float num = 3f + 2f * _elapsed; if (SlipperyBehaviour.SlipperyPlayers.Contains(((Object)val).GetInstanceID())) { num *= 0.25f; } Vector3 val2 = (Vector3)_velocityField.GetValue(_mover); float magnitude = ((Vector3)(ref val2)).magnitude; if (!(magnitude < 0.1f)) { Vector3 val3 = ((Component)val).transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val3)).normalized; Vector3 val4 = Vector3.RotateTowards(((Vector3)(ref val2)).normalized, normalized, num * Time.deltaTime, 0f); _velocityField.SetValue(_mover, val4 * magnitude); } } } private Player FindNearestEnemy() { //IL_005a: 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) Player result = null; float num = float.MaxValue; foreach (Player player in PlayerManager.instance.players) { if (!((Object)(object)player == (Object)null) && !((Object)(object)player == (Object)(object)_owner) && !((Object)(object)player.data == (Object)null) && !player.data.dead) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)player).transform.position); if (num2 < num) { num = num2; result = player; } } } return result; } } internal class InvisibilityBehaviour : MonoBehaviour { [CompilerGenerated] private sealed class d__8 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public float duration; public InvisibilityBehaviour <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__8(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown int num = <>1__state; InvisibilityBehaviour invisibilityBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(duration); <>1__state = 1; return true; case 1: <>1__state = -1; invisibilityBehaviour.EndInvisibility(); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private Player _player; private Renderer[] _renderers; private Canvas[] _canvases; private float _lastHealth; private bool _ended; private bool _active; public void Init(Player player, Gun gun, float duration) { _player = player; _renderers = ((Component)player).GetComponentsInChildren(true).Concat(((Component)gun).GetComponentsInChildren(true)).ToArray(); _canvases = ((Component)player).GetComponentsInChildren(true).Concat(((Component)gun).GetComponentsInChildren(true)).ToArray(); Renderer[] renderers = _renderers; for (int i = 0; i < renderers.Length; i++) { renderers[i].enabled = false; } Canvas[] canvases = _canvases; for (int i = 0; i < canvases.Length; i++) { ((Behaviour)canvases[i]).enabled = false; } _active = true; _lastHealth = player.data.health; ((MonoBehaviour)this).StartCoroutine(DurationRoutine(duration)); } private void Update() { if (!_active || _ended || (Object)(object)_player == (Object)null || (Object)(object)_player.data == (Object)null) { return; } Renderer[] renderers = _renderers; foreach (Renderer val in renderers) { if ((Object)(object)val != (Object)null) { val.enabled = false; } } Canvas[] canvases = _canvases; foreach (Canvas val2 in canvases) { if ((Object)(object)val2 != (Object)null) { ((Behaviour)val2).enabled = false; } } float health = _player.data.health; if (health < _lastHealth) { EndInvisibility(); } else { _lastHealth = health; } } [IteratorStateMachine(typeof(d__8))] private IEnumerator DurationRoutine(float duration) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__8(0) { <>4__this = this, duration = duration }; } private void EndInvisibility() { if (_ended) { return; } _ended = true; _active = false; Renderer[] renderers = _renderers; foreach (Renderer val in renderers) { if ((Object)(object)val != (Object)null) { val.enabled = true; } } Canvas[] canvases = _canvases; foreach (Canvas val2 in canvases) { if ((Object)(object)val2 != (Object)null) { ((Behaviour)val2).enabled = true; } } Object.Destroy((Object)(object)((Component)this).gameObject); } } internal class InvisibilityCard : CustomCard { private const float CooldownPenalty = 2f; private const float BaseDuration = 7f; private static readonly Dictionary> _blockDelegates = new Dictionary>(); private static readonly Dictionary _stackCounts = new Dictionary(); protected override string GetTitle() { return "Shadow Walker"; } protected override string GetDescription() { return "Blocking merges you with the shadows for 7 seconds or until hit. Longer block cooldown."; } protected override CardInfoStat[] GetStats() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //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_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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown return (CardInfoStat[])(object)new CardInfoStat[2] { new CardInfoStat { positive = true, stat = "Shadow", amount = "7s on block", simepleAmount = (SimpleAmount)0 }, new CardInfoStat { positive = false, stat = "Block Cooldown", amount = "+2s", simepleAmount = (SimpleAmount)0 } }; } protected override Rarity GetRarity() { return (Rarity)1; } protected override GameObject GetCardArt() { return CardArt.Load("C_INVISIBILITYCARD"); } protected override CardThemeColorType GetTheme() { return (CardThemeColorType)3; } public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { int instanceID = ((Object)player).GetInstanceID(); if (_blockDelegates.TryGetValue(instanceID, out var value)) { block.BlockAction = (Action)Delegate.Remove(block.BlockAction, value); } _stackCounts.TryGetValue(instanceID, out var value2); _stackCounts[instanceID] = value2 + 1; Action action = delegate { ActivateInvisibility(player, gun); }; _blockDelegates[instanceID] = action; block.BlockAction = (Action)Delegate.Combine(block.BlockAction, action); block.cooldown += 2f; } public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { int instanceID = ((Object)player).GetInstanceID(); block.cooldown -= 2f; if (!_stackCounts.TryGetValue(instanceID, out var value)) { return; } value--; if (value <= 0) { _stackCounts.Remove(instanceID); if (_blockDelegates.TryGetValue(instanceID, out var value2)) { block.BlockAction = (Action)Delegate.Remove(block.BlockAction, value2); _blockDelegates.Remove(instanceID); } } else { _stackCounts[instanceID] = value; } } private static void ActivateInvisibility(Player player, Gun gun) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) int instanceID = ((Object)player).GetInstanceID(); if (_stackCounts.TryGetValue(instanceID, out var value) && value > 0) { InvisibilityBehaviour componentInChildren = ((Component)player).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { Object.Destroy((Object)(object)((Component)componentInChildren).gameObject); } GameObject val = new GameObject("InvisibilityEffect"); val.transform.SetParent(((Component)player).transform, false); val.AddComponent().Init(player, gun, (float)value * 7f); } } } internal class LandmineBehaviour : MonoBehaviour { [CompilerGenerated] private sealed class d__14 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public LandmineBehaviour <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__14(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown int num = <>1__state; LandmineBehaviour landmineBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(3f); <>1__state = 1; return true; case 1: <>1__state = -1; landmineBehaviour._armed = true; ((MonoBehaviour)landmineBehaviour).StartCoroutine(landmineBehaviour.BlinkRoutine()); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__15 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public LandmineBehaviour <>4__this; private Renderer 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__15(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown int num = <>1__state; LandmineBehaviour landmineBehaviour = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; GameObject visual = landmineBehaviour._visual; 5__2 = ((visual != null) ? visual.GetComponent() : null); if ((Object)(object)5__2 == (Object)null) { return false; } break; } case 1: <>1__state = -1; 5__2.material.color = new Color(0.25f, 0f, 0f); <>2__current = (object)new WaitForSeconds(0.35f); <>1__state = 2; return true; case 2: <>1__state = -1; break; } if (!landmineBehaviour._exploded) { 5__2.material.color = Color.red; <>2__current = (object)new WaitForSeconds(0.35f); <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__18 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public LandmineBehaviour <>4__this; private GameObject 5__2; private Material 5__3; private float 5__4; private float 5__5; private float 5__6; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__18(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; 5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0128: 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) int num = <>1__state; LandmineBehaviour landmineBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; if ((Object)(object)landmineBehaviour._visual != (Object)null) { landmineBehaviour._visual.SetActive(false); } 5__2 = GameObject.CreatePrimitive((PrimitiveType)0); 5__2.transform.position = ((Component)landmineBehaviour).transform.position; Object.Destroy((Object)(object)5__2.GetComponent()); 5__3 = new Material(Shader.Find("Sprites/Default")); 5__3.color = new Color(1f, 0.4f, 0f, 0.9f); 5__2.GetComponent().material = 5__3; 5__4 = 0.45f; 5__5 = 0f; 5__6 = 6f; break; case 1: <>1__state = -1; break; } if (5__5 < 5__4) { 5__5 += Time.deltaTime; float num2 = 5__5 / 5__4; 5__2.transform.localScale = Vector3.one * Mathf.Lerp(0.5f, 5__6, num2); 5__3.color = new Color(1f, 0.4f, 0f, Mathf.Lerp(0.9f, 0f, num2)); <>2__current = null; <>1__state = 1; return true; } Object.Destroy((Object)(object)5__2); Object.Destroy((Object)(object)((Component)landmineBehaviour).gameObject); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static readonly List ActiveMines = new List(); private const float ArmDelay = 3f; private const float TriggerRadius = 0.8f; private const float ExplosionRadius = 3f; private const float DamageAmount = 100f; private const float KnockbackForce = 100f; private Player _owner; private bool _armed; private bool _exploded; private GameObject _visual; public static void DestroyAllMines() { foreach (LandmineBehaviour activeMine in ActiveMines) { if ((Object)(object)activeMine != (Object)null) { Object.Destroy((Object)(object)((Component)activeMine).gameObject); } } ActiveMines.Clear(); } public void Init(Player owner) { _owner = owner; ActiveMines.Add(this); SetupVisual(); ((MonoBehaviour)this).StartCoroutine(ArmRoutine()); } private void OnDestroy() { ActiveMines.Remove(this); } private void SetupVisual() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown _visual = GameObject.CreatePrimitive((PrimitiveType)0); _visual.transform.SetParent(((Component)this).transform, false); _visual.transform.localScale = Vector3.one * 0.5f; Object.Destroy((Object)(object)_visual.GetComponent()); Renderer component = _visual.GetComponent(); if ((Object)(object)component != (Object)null) { component.material = new Material(Shader.Find("Sprites/Default")) { color = Color.grey }; } } [IteratorStateMachine(typeof(d__14))] private IEnumerator ArmRoutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__14(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__15))] private IEnumerator BlinkRoutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__15(0) { <>4__this = this }; } private void Update() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (!_armed || _exploded) { return; } Collider2D[] array = Physics2D.OverlapCircleAll(Vector2.op_Implicit(((Component)this).transform.position), 0.8f); for (int i = 0; i < array.Length; i++) { if ((Object)(object)((Component)array[i]).GetComponentInParent() != (Object)null) { Explode(); break; } } } private void Explode() { //IL_000f: 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_0070: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_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_012b: Unknown result type (might be due to invalid IL or missing references) _exploded = true; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(((Component)this).transform.position.x, ((Component)this).transform.position.y); Vector2 val2 = default(Vector2); foreach (Player player in PlayerManager.instance.players) { if ((Object)(object)player == (Object)null || (Object)(object)player.data == (Object)null) { continue; } ((Vector2)(ref val2))..ctor(((Component)player).transform.position.x, ((Component)player).transform.position.y); float num = Vector2.Distance(val2, val); if (!(num > 3f)) { Vector2 val3 = val2 - val; Vector2 val4 = ((((Vector2)(ref val3)).sqrMagnitude > 0.01f) ? ((Vector2)(ref val3)).normalized : Vector2.up); float num2 = 1f - num / 3f; ((Damagable)player.data.healthHandler).CallTakeDamage(val4 * 100f * num2, val, (GameObject)null, _owner, true); Rigidbody2D component = ((Component)player.data.playerVel).GetComponent(); if (component != null) { component.AddForce(val4 * 100f * num2, (ForceMode2D)1); } } } ((MonoBehaviour)this).StartCoroutine(ExplosionEffect()); } [IteratorStateMachine(typeof(d__18))] private IEnumerator ExplosionEffect() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__18(0) { <>4__this = this }; } } internal class LandmineCard : CustomCard { [CompilerGenerated] private sealed class d__12 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; LandmineBehaviour.DestroyAllMines(); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static readonly Dictionary> _blockDelegates = new Dictionary>(); private static readonly Dictionary _stackCounts = new Dictionary(); private static bool _hookRegistered; private const float SpreadRadius = 1.5f; protected override string GetTitle() { return "Landmines"; } protected override string GetDescription() { return "Blocking drops a landmine per copy. Mines arm after 3 s and explode when stepped on."; } protected override CardInfoStat[] GetStats() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown return (CardInfoStat[])(object)new CardInfoStat[1] { new CardInfoStat { positive = true, stat = "Trap", amount = "Landmine on block", simepleAmount = (SimpleAmount)0 } }; } protected override Rarity GetRarity() { return (Rarity)1; } protected override GameObject GetCardArt() { return CardArt.Load("C_LANDMINECARD"); } protected override CardThemeColorType GetTheme() { return (CardThemeColorType)0; } public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { int instanceID = ((Object)player).GetInstanceID(); _stackCounts.TryGetValue(instanceID, out var value); _stackCounts[instanceID] = value + 1; if (!_hookRegistered) { _hookRegistered = true; GameModeManager.AddHook("RoundStart", (Func)OnRoundStart); } if (_blockDelegates.ContainsKey(instanceID)) { return; } Action action = delegate { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_0043: Unknown result type (might be due to invalid IL or missing references) int value2; int num = ((!_stackCounts.TryGetValue(((Object)player).GetInstanceID(), out value2)) ? 1 : value2); for (int i = 0; i < num; i++) { Vector2 offset = ((num > 1) ? (Random.insideUnitCircle * 1.5f) : Vector2.zero); SpawnLandmine(player, offset); } }; _blockDelegates[instanceID] = action; block.BlockAction = (Action)Delegate.Combine(block.BlockAction, action); } public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { int instanceID = ((Object)player).GetInstanceID(); if (!_stackCounts.TryGetValue(instanceID, out var value)) { return; } if (value > 1) { _stackCounts[instanceID] = value - 1; return; } _stackCounts.Remove(instanceID); if (_blockDelegates.TryGetValue(instanceID, out var value2)) { block.BlockAction = (Action)Delegate.Remove(block.BlockAction, value2); _blockDelegates.Remove(instanceID); } } [IteratorStateMachine(typeof(d__12))] private static IEnumerator OnRoundStart(IGameModeHandler gm) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__12(0); } private static void SpawnLandmine(Player owner, Vector2 offset = default(Vector2)) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Landmine"); val.transform.position = ((Component)owner).transform.position + new Vector3(offset.x, offset.y, 0f); val.AddComponent().Init(owner); } } internal class LastStandBehaviour : MonoBehaviour { [CompilerGenerated] private sealed class d__16 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public LastStandBehaviour <>4__this; private Renderer 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__16(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown //IL_00b1: 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_0079: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; LastStandBehaviour lastStandBehaviour = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; GameObject indicator = lastStandBehaviour._indicator; 5__2 = ((indicator != null) ? indicator.GetComponent() : null); break; } case 1: <>1__state = -1; if ((Object)(object)5__2 != (Object)null) { 5__2.material.color = new Color(0.6f, 0f, 0f); } <>2__current = (object)new WaitForSeconds(0.3f); <>1__state = 2; return true; case 2: <>1__state = -1; break; } if (lastStandBehaviour._isActive) { if ((Object)(object)5__2 != (Object)null) { 5__2.material.color = Color.red; } <>2__current = (object)new WaitForSeconds(0.3f); <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const float HpThreshold = 0.25f; private const float MoveBonus = 0.6f; private const float AttackSpeedFactor = 0.25f; private Player _player; private CharacterStatModifiers _stats; private Gun _gun; private float _baseAttackSpeed; private GameObject _indicator; private bool _isActive; private int _stacks; public void Init(Player player, Gun gun, CharacterStatModifiers stats, int stacks) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown _player = player; _gun = gun; _stats = stats; _stacks = stacks; _baseAttackSpeed = (((Object)(object)gun != (Object)null) ? gun.attackSpeed : 1f); _indicator = GameObject.CreatePrimitive((PrimitiveType)0); _indicator.transform.SetParent(((Component)player).transform, false); _indicator.transform.localPosition = new Vector3(0f, 1.2f, 0f); _indicator.transform.localScale = Vector3.zero; Object.Destroy((Object)(object)_indicator.GetComponent()); Renderer component = _indicator.GetComponent(); if ((Object)(object)component != (Object)null) { component.material = new Material(Shader.Find("Sprites/Default")) { color = Color.red }; } } public void UpdateStacks(int stacks) { int num = stacks - _stacks; _stacks = stacks; if (_isActive && (Object)(object)_stats != (Object)null) { CharacterStatModifiers stats = _stats; stats.attackSpeedMultiplier += (float)num * 1.5f; } } private void Update() { if (!((Object)(object)_player == (Object)null) && !((Object)(object)_player.data == (Object)null)) { bool flag = _player.data.health < _player.data.maxHealth * 0.25f; if (flag && !_isActive) { Activate(); } else if (!flag && _isActive) { Deactivate(); } } } private void LateUpdate() { if (!((Object)(object)_gun == (Object)null)) { _gun.attackSpeed = (_isActive ? (_baseAttackSpeed * 0.25f) : _baseAttackSpeed); } } private void Activate() { //IL_0064: 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) _isActive = true; if ((Object)(object)_stats != (Object)null) { CharacterStatModifiers stats = _stats; stats.movementSpeed += 0.6f; CharacterStatModifiers stats2 = _stats; stats2.attackSpeedMultiplier += (float)_stacks * 1.5f; } if ((Object)(object)_indicator != (Object)null) { _indicator.transform.localScale = Vector3.one * 0.4f; ((MonoBehaviour)this).StartCoroutine(PulseRoutine()); } } private void Deactivate() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) _isActive = false; if ((Object)(object)_stats != (Object)null) { CharacterStatModifiers stats = _stats; stats.movementSpeed -= 0.6f; CharacterStatModifiers stats2 = _stats; stats2.attackSpeedMultiplier -= (float)_stacks * 1.5f; } if ((Object)(object)_indicator != (Object)null) { _indicator.transform.localScale = Vector3.zero; } ((MonoBehaviour)this).StopAllCoroutines(); } [IteratorStateMachine(typeof(d__16))] private IEnumerator PulseRoutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__16(0) { <>4__this = this }; } private void OnDestroy() { if (_isActive && (Object)(object)_stats != (Object)null) { CharacterStatModifiers stats = _stats; stats.movementSpeed -= 0.6f; CharacterStatModifiers stats2 = _stats; stats2.attackSpeedMultiplier -= (float)_stacks * 1.5f; } if ((Object)(object)_gun != (Object)null) { _gun.attackSpeed = _baseAttackSpeed; } if ((Object)(object)_indicator != (Object)null) { Object.Destroy((Object)(object)_indicator); } } } internal class LastStandCard : CustomCard { private static readonly Dictionary _stackCounts = new Dictionary(); protected override string GetTitle() { return "Last Stand"; } protected override string GetDescription() { return "Below 25% HP, gain a large boost to move speed and fire rate. Opponents can see when you activate."; } protected override CardInfoStat[] GetStats() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //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_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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown return (CardInfoStat[])(object)new CardInfoStat[2] { new CardInfoStat { positive = true, stat = "Move Speed", amount = "+60% below 25% HP", simepleAmount = (SimpleAmount)0 }, new CardInfoStat { positive = true, stat = "Fire Rate", amount = "+150% below 25% HP", simepleAmount = (SimpleAmount)0 } }; } protected override Rarity GetRarity() { return (Rarity)1; } protected override GameObject GetCardArt() { return CardArt.Load("C_LASTSTANDCARD"); } protected override CardThemeColorType GetTheme() { return (CardThemeColorType)0; } public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) int instanceID = ((Object)player).GetInstanceID(); _stackCounts.TryGetValue(instanceID, out var value); _stackCounts[instanceID] = value + 1; LastStandBehaviour componentInChildren = ((Component)player).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.UpdateStacks(_stackCounts[instanceID]); return; } GameObject val = new GameObject("LastStandEffect"); val.transform.SetParent(((Component)player).transform, false); val.AddComponent().Init(player, gun, characterStats, _stackCounts[instanceID]); } public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { int instanceID = ((Object)player).GetInstanceID(); if (!_stackCounts.TryGetValue(instanceID, out var value)) { return; } if (value > 1) { _stackCounts[instanceID] = value - 1; ((Component)player).GetComponentInChildren()?.UpdateStacks(_stackCounts[instanceID]); return; } _stackCounts.Remove(instanceID); LastStandBehaviour componentInChildren = ((Component)player).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { Object.Destroy((Object)(object)((Component)componentInChildren).gameObject); } } } internal class MartyrdomCard : CustomCard { private static readonly Dictionary _stackCounts = new Dictionary(); protected override string GetTitle() { return "Martyrdom"; } protected override string GetDescription() { return "On death, explode in a ring of bullets and a radial blast. More copies = more bullets."; } protected override CardInfoStat[] GetStats() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //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_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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown return (CardInfoStat[])(object)new CardInfoStat[2] { new CardInfoStat { positive = true, stat = "On Death", amount = "Explosion + bullet ring", simepleAmount = (SimpleAmount)0 }, new CardInfoStat { positive = false, stat = "Reload Speed", amount = "-15%", simepleAmount = (SimpleAmount)0 } }; } protected override Rarity GetRarity() { return (Rarity)2; } protected override GameObject GetCardArt() { return CardArt.Load("C_MARTYRDOMCARD"); } protected override CardThemeColorType GetTheme() { return (CardThemeColorType)0; } public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { //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) int instanceID = ((Object)player).GetInstanceID(); _stackCounts.TryGetValue(instanceID, out var value); _stackCounts[instanceID] = value + 1; gunAmmo.reloadTimeAdd += 0.15f; MartyrdomBehaviour componentInChildren = ((Component)player).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.UpdateStacks(_stackCounts[instanceID]); return; } GameObject val = new GameObject("MartyrdomEffect"); val.transform.SetParent(((Component)player).transform, false); val.AddComponent().Init(player, gun, _stackCounts[instanceID]); } public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { int instanceID = ((Object)player).GetInstanceID(); if (!_stackCounts.TryGetValue(instanceID, out var value)) { return; } gunAmmo.reloadTimeAdd -= 0.15f; if (value > 1) { _stackCounts[instanceID] = value - 1; ((Component)player).GetComponentInChildren()?.UpdateStacks(_stackCounts[instanceID]); return; } _stackCounts.Remove(instanceID); MartyrdomBehaviour componentInChildren = ((Component)player).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { Object.Destroy((Object)(object)((Component)componentInChildren).gameObject); } } } internal class MartyrdomBehaviour : MonoBehaviour { [CompilerGenerated] private sealed class d__18 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Vector2 origin; private GameObject 5__2; private Material 5__3; private float 5__4; private float 5__5; private float 5__6; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__18(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; 5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0107: 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) switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__2 = GameObject.CreatePrimitive((PrimitiveType)0); 5__2.transform.position = Vector2.op_Implicit(origin); Object.Destroy((Object)(object)5__2.GetComponent()); 5__3 = new Material(Shader.Find("Sprites/Default")); 5__3.color = new Color(1f, 0.1f, 0.1f, 0.9f); 5__2.GetComponent().material = 5__3; 5__4 = 0.5f; 5__5 = 0f; 5__6 = 8f; break; case 1: <>1__state = -1; break; } if (5__5 < 5__4) { 5__5 += Time.deltaTime; float num = 5__5 / 5__4; 5__2.transform.localScale = Vector3.one * Mathf.Lerp(0.4f, 5__6, num); 5__3.color = new Color(1f, 0.1f, 0.1f, Mathf.Lerp(0.9f, 0f, num)); <>2__current = null; <>1__state = 1; return true; } Object.Destroy((Object)(object)5__2); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static readonly ManualLogSource Log = Logger.CreateLogSource("RoundsMod.Martyrdom"); private const float ExplosionRadius = 4f; private const float ExplosionDamage = 80f; private const float ExplosionKnock = 80f; private const int BulletsPerStack = 8; private static MethodInfo _attackMethod; private Player _player; private Gun _gun; private int _stacks; private bool _wasDead; private bool _fired; private bool _hasBeenAlive; private bool _wasHealthZero; private int _logFrame; public void Init(Player player, Gun gun, int stacks) { _player = player; _gun = gun; _stacks = stacks; Log.LogInfo((object)$"[Martyrdom] Init — player={((Object)player).GetInstanceID()} stacks={stacks}"); } public void UpdateStacks(int stacks) { _stacks = stacks; Log.LogInfo((object)$"[Martyrdom] Stacks updated to {stacks}."); } private void Update() { if (!((Object)(object)_player == (Object)null) && !((Object)(object)_player.data == (Object)null)) { float health = _player.data.health; bool dead = _player.data.dead; if (!dead && _wasDead) { Log.LogInfo((object)"[Martyrdom] Player respawned — resetting triggers."); _fired = false; _wasHealthZero = false; _hasBeenAlive = false; } bool flag = dead && !_wasDead; _wasDead = dead; if (!_hasBeenAlive && health > 0f) { _hasBeenAlive = true; } bool flag2 = _hasBeenAlive && health <= 0f && !_wasHealthZero; _wasHealthZero = health <= 0f; if ((flag || flag2) && !_fired) { _fired = true; Log.LogInfo((object)$"[Martyrdom] TRIGGERED — justDied={flag} healthZero={flag2} health={health:F1}"); Explode(); } _logFrame++; if (_logFrame % 120 == 0) { Log.LogInfo((object)$"[Martyrdom] Poll — dead={dead} health={health:F1} fired={_fired} hasBeenAlive={_hasBeenAlive}"); } } } private void Explode() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0193: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) Vector2 val = Vector2.op_Implicit(((Component)_player).transform.position); foreach (Player player in PlayerManager.instance.players) { if ((Object)(object)player == (Object)null || (Object)(object)player.data == (Object)null) { continue; } Vector2 val2 = Vector2.op_Implicit(((Component)player).transform.position); float num = Vector2.Distance(val2, val); if (num > 4f) { continue; } Vector2 val3 = val2 - val; Vector2 val4 = ((((Vector2)(ref val3)).sqrMagnitude > 0.01f) ? ((Vector2)(ref val3)).normalized : Vector2.up); float num2 = 1f - num / 4f; ((Damagable)player.data.healthHandler).CallTakeDamage(val4 * 80f * num2, val, (GameObject)null, _player, true); PlayerVelocity playerVel = player.data.playerVel; if (playerVel != null) { Rigidbody2D component = ((Component)playerVel).GetComponent(); if (component != null) { component.AddForce(val4 * 80f * num2, (ForceMode2D)1); } } } if ((Object)(object)_gun != (Object)null) { if (_attackMethod == null) { _attackMethod = typeof(Gun).GetMethod("Attack", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if (_attackMethod != null) { int num3 = 8 * _stacks; float num4 = 360f / (float)num3; Vector3 eulerAngles = ((Component)_gun).transform.eulerAngles; Log.LogInfo((object)$"[Martyrdom] Firing {num3} bullets in ring."); for (int i = 0; i < num3; i++) { ((Component)_gun).transform.eulerAngles = new Vector3(0f, 0f, (float)i * num4); _attackMethod.Invoke(_gun, new object[5] { 1f, true, 1f, 0f, false }); } ((Component)_gun).transform.eulerAngles = eulerAngles; } else { Log.LogWarning((object)"[Martyrdom] Gun.Attack not found via reflection; no bullet ring."); } } else { Log.LogWarning((object)"[Martyrdom] _gun is null; skipping bullet ring."); } ((MonoBehaviour)this).StartCoroutine(ExplosionEffect(val)); } [IteratorStateMachine(typeof(d__18))] private IEnumerator ExplosionEffect(Vector2 origin) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__18(0) { origin = origin }; } } internal class MomentumBulletBehaviour : MonoBehaviour { private static readonly BindingFlags _allInstance = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; private static FieldInfo _velocityField; private Vector3 _bonus; private bool _applied; public void Init(Vector3 bonus) { //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) _bonus = bonus; if (_velocityField == null) { _velocityField = typeof(MoveTransform).GetField("velocity", _allInstance); } } private void Update() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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) if (_applied) { Object.Destroy((Object)(object)this); return; } _applied = true; MoveTransform component = ((Component)this).GetComponent(); if (!((Object)(object)component == (Object)null) && !(_velocityField == null)) { Vector3 val = (Vector3)_velocityField.GetValue(component); _velocityField.SetValue(component, val + _bonus); } } } internal class MomentumCard : CustomCard { internal static readonly Dictionary StackCounts = new Dictionary(); internal static readonly Dictionary GunToPlayer = new Dictionary(); internal static readonly Dictionary PlayerRefs = new Dictionary(); protected override string GetTitle() { return "Momentum"; } protected override string GetDescription() { return "Your bullets inherit your movement velocity when fired."; } protected override CardInfoStat[] GetStats() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown return (CardInfoStat[])(object)new CardInfoStat[1] { new CardInfoStat { positive = true, stat = "Bullet Speed", amount = "+50% movement", simepleAmount = (SimpleAmount)2 } }; } protected override Rarity GetRarity() { return (Rarity)0; } protected override GameObject GetCardArt() { return CardArt.Load("C_MOMENTUMCARD"); } protected override CardThemeColorType GetTheme() { return (CardThemeColorType)3; } public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { int instanceID = ((Object)player).GetInstanceID(); int instanceID2 = ((Object)gun).GetInstanceID(); StackCounts.TryGetValue(instanceID, out var value); StackCounts[instanceID] = value + 1; GunToPlayer[instanceID2] = instanceID; PlayerRefs[instanceID] = player; } public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { int instanceID = ((Object)player).GetInstanceID(); if (StackCounts.TryGetValue(instanceID, out var value)) { if (value > 1) { StackCounts[instanceID] = value - 1; return; } StackCounts.Remove(instanceID); PlayerRefs.Remove(instanceID); GunToPlayer.Remove(((Object)gun).GetInstanceID()); } } } [HarmonyPatch(typeof(Gun), "BulletInit")] internal static class MomentumBulletInitPatch { [HarmonyPostfix] private static void Postfix(Gun __instance, GameObject bullet) { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) int instanceID = ((Object)__instance).GetInstanceID(); if (MomentumCard.GunToPlayer.TryGetValue(instanceID, out var value) && MomentumCard.StackCounts.TryGetValue(value, out var value2) && value2 > 0 && MomentumCard.PlayerRefs.TryGetValue(value, out var value3) && !((Object)(object)value3 == (Object)null)) { CharacterData data = value3.data; object obj; if (data == null) { obj = null; } else { PlayerVelocity playerVel = data.playerVel; obj = ((playerVel != null) ? ((Component)playerVel).GetComponent() : null); } if (obj == null) { obj = ((Component)value3).GetComponent() ?? ((Component)value3).GetComponentInChildren(); } Rigidbody2D val = (Rigidbody2D)obj; if (!((Object)(object)val == (Object)null)) { Vector3 val2 = Vector2.op_Implicit(val.velocity); bullet.AddComponent().Init(val2 * (float)value2 * 0.5f); } } } } internal class OverclockBehaviour : MonoBehaviour { [CompilerGenerated] private sealed class d__14 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public OverclockBehaviour <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__14(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown //IL_0083: 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_00f4: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; OverclockBehaviour overclockBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; goto IL_0029; case 1: <>1__state = -1; if ((Object)(object)overclockBehaviour._gun == (Object)null) { return false; } _isJammed[overclockBehaviour._gunId] = true; if ((Object)(object)overclockBehaviour._indicator != (Object)null) { overclockBehaviour._indicator.transform.localScale = Vector3.one * 0.35f; } <>2__current = (object)new WaitForSeconds(2f); <>1__state = 2; return true; case 2: { <>1__state = -1; if ((Object)(object)overclockBehaviour._gun == (Object)null) { return false; } _isJammed[overclockBehaviour._gunId] = false; if ((Object)(object)overclockBehaviour._indicator != (Object)null) { overclockBehaviour._indicator.transform.localScale = Vector3.zero; } goto IL_0029; } IL_0029: <>2__current = (object)new WaitForSeconds(3f); <>1__state = 1; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const float ActiveTime = 3f; private const float JamTime = 2f; private const float FastAttackSpeed = 0.04f; private static readonly Dictionary _isJammed = new Dictionary(); private CharacterStatModifiers _stats; private Gun _gun; private int _stacks; private int _gunId; private float _baseAttackSpeed; private GameObject _indicator; public static bool IsJammed(int gunId) { bool value; return _isJammed.TryGetValue(gunId, out value) && value; } public void Init(Gun gun, CharacterStatModifiers stats, int stacks) { //IL_0080: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown _stats = stats; _gun = gun; _stacks = stacks; _gunId = ((Object)gun).GetInstanceID(); _baseAttackSpeed = gun.attackSpeed; _isJammed[_gunId] = false; _indicator = GameObject.CreatePrimitive((PrimitiveType)0); _indicator.transform.SetParent(((Component)this).transform.parent, false); _indicator.transform.localPosition = new Vector3(0f, -0.8f, 0f); _indicator.transform.localScale = Vector3.zero; Object.Destroy((Object)(object)_indicator.GetComponent()); Renderer component = _indicator.GetComponent(); if ((Object)(object)component != (Object)null) { component.material = new Material(Shader.Find("Sprites/Default")) { color = new Color(1f, 0.6f, 0f) }; } ((MonoBehaviour)this).StartCoroutine(JamCycle()); } public void UpdateStacks(int newStacks) { _stacks = newStacks; } private void LateUpdate() { if (!((Object)(object)_gun == (Object)null)) { if (IsJammed(_gunId)) { _gun.attackSpeed = _baseAttackSpeed; } else { _gun.attackSpeed = 0.04f; } } } [IteratorStateMachine(typeof(d__14))] private IEnumerator JamCycle() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__14(0) { <>4__this = this }; } private void OnDestroy() { if ((Object)(object)_gun != (Object)null) { _gun.attackSpeed = _baseAttackSpeed; } _isJammed.Remove(_gunId); if ((Object)(object)_indicator != (Object)null) { Object.Destroy((Object)(object)_indicator); } } } internal class OverclockCard : CustomCard { private static readonly Dictionary _stackCounts = new Dictionary(); protected override string GetTitle() { return "Overclock"; } protected override string GetDescription() { return "Massively increased fire rate and ammo, but low damage and the gun jams for 2 seconds every 3 seconds."; } protected override CardInfoStat[] GetStats() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //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_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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0060: 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_006c: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //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) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown return (CardInfoStat[])(object)new CardInfoStat[4] { new CardInfoStat { positive = true, stat = "Fire Rate", amount = "Massively ↑", simepleAmount = (SimpleAmount)3 }, new CardInfoStat { positive = true, stat = "Ammo", amount = "+40", simepleAmount = (SimpleAmount)3 }, new CardInfoStat { positive = false, stat = "Damage", amount = "-70%", simepleAmount = (SimpleAmount)7 }, new CardInfoStat { positive = false, stat = "Jam", amount = "2 s every 3 s", simepleAmount = (SimpleAmount)0 } }; } protected override Rarity GetRarity() { return (Rarity)2; } protected override GameObject GetCardArt() { return CardArt.Load("C_OVERCLOCKCARD"); } protected override CardThemeColorType GetTheme() { return (CardThemeColorType)0; } public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { //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) int instanceID = ((Object)player).GetInstanceID(); _stackCounts.TryGetValue(instanceID, out var value); _stackCounts[instanceID] = value + 1; gun.damage *= 0.3f; gunAmmo.maxAmmo += 40; OverclockBehaviour componentInChildren = ((Component)player).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.UpdateStacks(_stackCounts[instanceID]); return; } GameObject val = new GameObject("OverclockEffect"); val.transform.SetParent(((Component)player).transform, false); val.AddComponent().Init(gun, characterStats, _stackCounts[instanceID]); } public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { int instanceID = ((Object)player).GetInstanceID(); if (!_stackCounts.TryGetValue(instanceID, out var value)) { return; } gun.damage /= 0.3f; gunAmmo.maxAmmo -= 40; if (value > 1) { _stackCounts[instanceID] = value - 1; ((Component)player).GetComponentInChildren()?.UpdateStacks(_stackCounts[instanceID]); return; } _stackCounts.Remove(instanceID); OverclockBehaviour componentInChildren = ((Component)player).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { Object.Destroy((Object)(object)((Component)componentInChildren).gameObject); } } } [HarmonyPatch(typeof(Gun), "Attack")] internal static class OverclockJamPatch { [HarmonyPrefix] private static bool Prefix(Gun __instance) { if (OverclockBehaviour.IsJammed(((Object)__instance).GetInstanceID())) { return false; } return true; } } internal class PinballCard : CustomCard { private static readonly Dictionary _stackCounts = new Dictionary(); protected override string GetTitle() { return "Pinball"; } protected override string GetDescription() { return "Taking damage launches you like a pinball. Hurt anyone you pass through."; } protected override CardInfoStat[] GetStats() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //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_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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown return (CardInfoStat[])(object)new CardInfoStat[2] { new CardInfoStat { positive = false, stat = "Control", amount = "Chaos on hit", simepleAmount = (SimpleAmount)0 }, new CardInfoStat { positive = true, stat = "On Launch", amount = "Damages nearby enemies", simepleAmount = (SimpleAmount)0 } }; } protected override Rarity GetRarity() { return (Rarity)1; } protected override GameObject GetCardArt() { return CardArt.Load("C_PINBALLCARD"); } protected override CardThemeColorType GetTheme() { return (CardThemeColorType)0; } public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) int instanceID = ((Object)player).GetInstanceID(); _stackCounts.TryGetValue(instanceID, out var value); _stackCounts[instanceID] = value + 1; if (!((Object)(object)((Component)player).GetComponentInChildren() != (Object)null)) { GameObject val = new GameObject("PinballEffect"); val.transform.SetParent(((Component)player).transform, false); val.AddComponent().Init(player); } } public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { int instanceID = ((Object)player).GetInstanceID(); if (!_stackCounts.TryGetValue(instanceID, out var value)) { return; } if (value > 1) { _stackCounts[instanceID] = value - 1; return; } _stackCounts.Remove(instanceID); PinballBehaviour componentInChildren = ((Component)player).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { Object.Destroy((Object)(object)((Component)componentInChildren).gameObject); } } } internal class PinballBehaviour : MonoBehaviour { private static readonly ManualLogSource Log = Logger.CreateLogSource("RoundsMod.Pinball"); private const float LaunchSpeed = 30f; private const float LaunchDuration = 0.5f; private const float DamagePerHit = 50f; private const float DamageRadius = 0.7f; private Player _player; private float _lastHealth; private bool _isLaunching; private float _launchTimer; private HashSet _hitThisLaunch = new HashSet(); public void Init(Player player) { _player = player; _lastHealth = (((Object)(object)player.data != (Object)null) ? player.data.health : 100f); CharacterData data = player.data; object obj; if (data == null) { obj = null; } else { PlayerVelocity playerVel = data.playerVel; obj = ((playerVel != null) ? ((Component)playerVel).GetComponent() : null); } Rigidbody2D val = (Rigidbody2D)obj; Log.LogInfo((object)("[Pinball] Init — rb=" + (((Object)(object)val != (Object)null) ? "found" : "NULL") + " isKinematic=" + (((Object)(object)val != (Object)null) ? val.isKinematic.ToString() : "?") + $" health={_lastHealth:F1}")); } private void Update() { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: 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_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_017b: 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_017f: 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_019b: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_player == (Object)null || (Object)(object)_player.data == (Object)null) { return; } float health = _player.data.health; if (!_isLaunching && health < _lastHealth) { Log.LogInfo((object)$"[Pinball] Health decreased {_lastHealth:F1} → {health:F1}; launching."); StartLaunch(); } _lastHealth = health; if (!_isLaunching) { return; } _launchTimer -= Time.deltaTime; if (_launchTimer <= 0f) { _isLaunching = false; _hitThisLaunch.Clear(); return; } Collider2D[] array = Physics2D.OverlapCircleAll(Vector2.op_Implicit(((Component)_player).transform.position), 0.7f); for (int i = 0; i < array.Length; i++) { Player componentInParent = ((Component)array[i]).GetComponentInParent(); if ((Object)(object)componentInParent == (Object)null || (Object)(object)componentInParent == (Object)(object)_player || (Object)(object)componentInParent.data == (Object)null) { continue; } int instanceID = ((Object)componentInParent).GetInstanceID(); if (!_hitThisLaunch.Contains(instanceID)) { _hitThisLaunch.Add(instanceID); Log.LogInfo((object)$"[Pinball] Hit player {instanceID} during launch."); Vector2 val = Vector2.op_Implicit(((Component)_player).transform.position); Vector2 val2 = Vector2.op_Implicit(((Component)componentInParent).transform.position); Vector2 val3 = val2 - val; Vector2 val4; if (!(((Vector2)(ref val3)).sqrMagnitude > 0.01f)) { val4 = Vector2.up; } else { val3 = val2 - val; val4 = ((Vector2)(ref val3)).normalized; } Vector2 val5 = val4; ((Damagable)componentInParent.data.healthHandler).CallTakeDamage(val5 * 50f, val, (GameObject)null, _player, true); } } } private void StartLaunch() { //IL_0069: 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_0088: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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_00c6: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) _isLaunching = true; _launchTimer = 0.5f; _hitThisLaunch.Clear(); PlayerVelocity playerVel = _player.data.playerVel; Rigidbody2D val = ((playerVel != null) ? ((Component)playerVel).GetComponent() : null); if ((Object)(object)val == (Object)null) { Log.LogWarning((object)"[Pinball] rb is NULL in StartLaunch; cannot apply force."); return; } Log.LogInfo((object)$"[Pinball] rb found — isKinematic={val.isKinematic} bodyType={val.bodyType} vel before={val.velocity}"); Vector2 insideUnitCircle = Random.insideUnitCircle; Vector2 val2 = ((Vector2)(ref insideUnitCircle)).normalized; if (((Vector2)(ref val2)).sqrMagnitude < 0.01f) { val2 = Vector2.up; } val.velocity = val2 * 30f; Log.LogInfo((object)$"[Pinball] Set velocity to {val.velocity} (target dir={val2} speed={30f})"); } } internal class PistachioCard : CustomCard { private static readonly ManualLogSource Log = Logger.CreateLogSource("RoundsMod.PistachioCard"); protected override string GetTitle() { return "Pistachio"; } protected override string GetDescription() { return "Gus's cat fr irl"; } protected override CardInfoStat[] GetStats() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //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_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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0060: 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_006c: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown return (CardInfoStat[])(object)new CardInfoStat[3] { new CardInfoStat { positive = true, stat = "Lives", amount = "9", simepleAmount = (SimpleAmount)0 }, new CardInfoStat { positive = false, stat = "Size", amount = "+200%", simepleAmount = (SimpleAmount)3 }, new CardInfoStat { positive = false, stat = "Everything Else", amount = "nerfed crazy style", simepleAmount = (SimpleAmount)0 } }; } protected override Rarity GetRarity() { return (Rarity)0; } protected override GameObject GetCardArt() { return CardArt.Load("C_PISTACHIOCARD"); } protected override CardThemeColorType GetTheme() { return (CardThemeColorType)3; } public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { Log.LogInfo((object)"SwiftCard picked!"); characterStats.respawns += 8; characterStats.sizeMultiplier *= 3f; characterStats.health *= 0.5f; gun.damage *= 0.05f; gun.attackSpeed *= 3f; gun.projectileSpeed *= 0.2f; block.cdMultiplier *= 5f; } public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { characterStats.respawns -= 8; characterStats.sizeMultiplier /= 3f; characterStats.health /= 0.5f; gun.damage /= 0.05f; gun.attackSpeed /= 3f; gun.projectileSpeed /= 0.2f; block.cdMultiplier /= 5f; } } internal class RRLuckyMarker : MonoBehaviour { private void Awake() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); foreach (Renderer val in componentsInChildren) { if ((Object)(object)val.material != (Object)null) { val.material.color = new Color(1f, 0.15f, 0f); } } } } internal class RussianRouletteCard : CustomCard { internal static readonly Dictionary StackCounts = new Dictionary(); internal static readonly Dictionary GunToPlayer = new Dictionary(); internal static readonly Dictionary JackpotFrame = new Dictionary(); internal static readonly Dictionary JackpotActive = new Dictionary(); protected override string GetTitle() { return "Russian Roulette"; } protected override string GetDescription() { return "Each shot has a 1 in 6 chance of dealing 10x damage. Lucky bullets glow red."; } protected override CardInfoStat[] GetStats() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //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_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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown return (CardInfoStat[])(object)new CardInfoStat[2] { new CardInfoStat { positive = true, stat = "Jackpot Chance", amount = "1 in 6", simepleAmount = (SimpleAmount)0 }, new CardInfoStat { positive = true, stat = "Jackpot Damage", amount = "x4", simepleAmount = (SimpleAmount)3 } }; } protected override Rarity GetRarity() { return (Rarity)1; } protected override GameObject GetCardArt() { return CardArt.Load("C_RUSSIANROULETTECARD"); } protected override CardThemeColorType GetTheme() { return (CardThemeColorType)0; } public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { int instanceID = ((Object)player).GetInstanceID(); int instanceID2 = ((Object)gun).GetInstanceID(); StackCounts.TryGetValue(instanceID, out var value); StackCounts[instanceID] = value + 1; GunToPlayer[instanceID2] = instanceID; } public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { int instanceID = ((Object)player).GetInstanceID(); if (StackCounts.TryGetValue(instanceID, out var value)) { if (value > 1) { StackCounts[instanceID] = value - 1; return; } StackCounts.Remove(instanceID); GunToPlayer.Remove(((Object)gun).GetInstanceID()); } } } [HarmonyPatch(typeof(Gun), "BulletInit")] internal static class RussianRouletteBulletInitPrefixPatch { [HarmonyPrefix] private static void Prefix(Gun __instance) { int instanceID = ((Object)__instance).GetInstanceID(); if (!RussianRouletteCard.GunToPlayer.ContainsKey(instanceID) || !RussianRouletteCard.StackCounts.TryGetValue(RussianRouletteCard.GunToPlayer[instanceID], out var value)) { return; } int frameCount = Time.frameCount; if (!RussianRouletteCard.JackpotFrame.TryGetValue(instanceID, out var value2) || value2 != frameCount) { bool value3 = false; for (int i = 0; i < value; i++) { if (Random.Range(0, 6) == 0) { value3 = true; break; } } RussianRouletteCard.JackpotFrame[instanceID] = frameCount; RussianRouletteCard.JackpotActive[instanceID] = value3; } if (RussianRouletteCard.JackpotActive.TryGetValue(instanceID, out var value4) && value4) { __instance.damage *= 4f; } } } [HarmonyPatch(typeof(Gun), "BulletInit")] internal static class RussianRouletteBulletInitPostfixPatch { [HarmonyPostfix] private static void Postfix(Gun __instance, GameObject bullet) { int instanceID = ((Object)__instance).GetInstanceID(); if (RussianRouletteCard.JackpotActive.TryGetValue(instanceID, out var value) && value) { __instance.damage /= 4f; if ((Object)(object)bullet != (Object)null) { bullet.AddComponent(); } } } } internal class ScrambleCard : CustomCard { internal static readonly HashSet ActiveOwners = new HashSet(); protected override string GetTitle() { return "Scramble"; } protected override string GetDescription() { return "At the start of each round, all cards from all players are shuffled and redistributed."; } protected override CardInfoStat[] GetStats() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown return (CardInfoStat[])(object)new CardInfoStat[1] { new CardInfoStat { positive = true, stat = "Round Start", amount = "Shuffle all cards", simepleAmount = (SimpleAmount)0 } }; } protected override Rarity GetRarity() { return (Rarity)2; } protected override GameObject GetCardArt() { return CardArt.Load("C_SCRAMBLECARD"); } protected override CardThemeColorType GetTheme() { return (CardThemeColorType)8; } public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { ActiveOwners.Add(((Object)player).GetInstanceID()); } public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { ActiveOwners.Remove(((Object)player).GetInstanceID()); } } internal class ScrambleRunner : MonoBehaviour { [CompilerGenerated] private sealed class d__6 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public ScrambleRunner <>4__this; private List 5__2; private List<(Player player, int count)> 5__3; private List<(Player player, int count)>.Enumerator <>7__wrap3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__6(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__2 = null; 5__3 = null; <>7__wrap3 = default(List<(Player, int)>.Enumerator); <>1__state = -2; } private bool MoveNext() { try { int num = <>1__state; ScrambleRunner scrambleRunner = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; bool flag = false; foreach (Player player in PlayerManager.instance.players) { if (!((Object)(object)player == (Object)null) && !((Object)(object)player.data == (Object)null) && ScrambleCard.ActiveOwners.Contains(((Object)player).GetInstanceID()) && !player.data.dead) { flag = true; break; } } if (!flag) { return false; } EnsureReflection(); if (_currentCardsField == null) { return false; } 5__2 = new List(); 5__3 = new List<(Player, int)>(); foreach (Player player2 in PlayerManager.instance.players) { if ((Object)(object)player2 == (Object)null || (Object)(object)player2.data == (Object)null) { continue; } IList list = _currentCardsField.GetValue(player2.data) as IList; int item3 = list?.Count ?? 0; 5__3.Add((player2, item3)); if (list == null) { continue; } foreach (object item4 in list) { CardInfo val = (CardInfo)((item4 is CardInfo) ? item4 : null); if (val != null) { 5__2.Add(val); } } } if (5__2.Count < 2) { return false; } int num4 = 0; foreach (var item5 in 5__3) { if (item5.count > 0) { num4++; } } if (num4 < 2) { return false; } for (int num5 = 5__2.Count - 1; num5 > 0; num5--) { int index = Random.Range(0, num5 + 1); CardInfo value = 5__2[num5]; 5__2[num5] = 5__2[index]; 5__2[index] = value; } <>7__wrap3 = 5__3.GetEnumerator(); <>1__state = -3; goto IL_032f; } case 1: <>1__state = -3; goto IL_032f; case 2: { <>1__state = -1; int count = 5__3.Count; int num2 = 0; while (num2 < 5__2.Count) { int num3 = 0; while (num3 < count && num2 < 5__2.Count) { Player item = 5__3[num3].player; try { if (_addCardMethod != null) { _addCardMethod.Invoke(item.data, new object[1] { 5__2[num2] }); } } catch (Exception ex) { Log.LogWarning((object)("[Scramble] AddCard failed: " + ex.Message)); } num3++; num2++; } } Log.LogInfo((object)$"[Scramble] Shuffled {5__2.Count} cards among {count} players."); return false; } IL_032f: while (<>7__wrap3.MoveNext()) { Player item2 = <>7__wrap3.Current.player; IEnumerator enumerator = null; try { if (_removeAllMethod != null && _removeAllMethod.Invoke(null, new object[1] { item2 }) is IEnumerator enumerator2) { enumerator = enumerator2; } } catch (Exception ex2) { Log.LogWarning((object)("[Scramble] RemoveAllCardsFromPlayer failed: " + ex2.Message)); } if (enumerator != null) { <>2__current = ((MonoBehaviour)scrambleRunner).StartCoroutine(enumerator); <>1__state = 1; return true; } } <>m__Finally1(); <>7__wrap3 = default(List<(Player, int)>.Enumerator); <>2__current = null; <>1__state = 2; return true; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>7__wrap3).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static readonly ManualLogSource Log = Logger.CreateLogSource("RoundsMod.Scramble"); private static bool _reflected; private static FieldInfo _currentCardsField; private static MethodInfo _addCardMethod; private static MethodInfo _removeAllMethod; public void RegisterHooks() { try { GameModeManager.AddHook("RoundStart", (Func)OnRoundStart); Log.LogInfo((object)"[Scramble] Round start hook registered."); } catch (Exception ex) { Log.LogWarning((object)("[Scramble] Hook registration failed: " + ex.Message)); } } [IteratorStateMachine(typeof(d__6))] private IEnumerator OnRoundStart(IGameModeHandler gm) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__6(0) { <>4__this = this }; } private static void EnsureReflection() { if (_reflected) { return; } _reflected = true; BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; BindingFlags bindingAttr2 = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; _currentCardsField = typeof(CharacterData).GetField("currentCards", bindingAttr); if (_currentCardsField == null) { FieldInfo[] fields = typeof(CharacterData).GetFields(bindingAttr); foreach (FieldInfo fieldInfo in fields) { if (fieldInfo.FieldType == typeof(List)) { _currentCardsField = fieldInfo; break; } } } _addCardMethod = typeof(CharacterData).GetMethod("AddCard", bindingAttr, null, new Type[1] { typeof(CardInfo) }, null); Type type = Type.GetType("ModdingUtils.Utils.Cards, ModdingUtils"); if (type != null) { _removeAllMethod = type.GetMethod("RemoveAllCardsFromPlayer", bindingAttr2); } Log.LogInfo((object)("[Scramble] currentCards=" + ((_currentCardsField != null) ? _currentCardsField.Name : "null") + ", addCard=" + ((_addCardMethod != null) ? "found" : "null") + ", removeAll=" + ((_removeAllMethod != null) ? "found" : "null"))); } } internal class SlipperyCard : CustomCard { private static readonly Dictionary _stackCounts = new Dictionary(); protected override string GetTitle() { return "Slippery"; } protected override string GetDescription() { return "Move faster, but nearly impossible to stop. Homing bullets lose track of you."; } protected override CardInfoStat[] GetStats() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //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_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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0060: 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_006c: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown return (CardInfoStat[])(object)new CardInfoStat[3] { new CardInfoStat { positive = true, stat = "Move Speed", amount = "+50%", simepleAmount = (SimpleAmount)2 }, new CardInfoStat { positive = false, stat = "Control", amount = "Very low drag", simepleAmount = (SimpleAmount)0 }, new CardInfoStat { positive = true, stat = "Homing Resist", amount = "-75% turn rate", simepleAmount = (SimpleAmount)0 } }; } protected override Rarity GetRarity() { return (Rarity)0; } protected override GameObject GetCardArt() { return CardArt.Load("C_SLIPPERYCARD"); } protected override CardThemeColorType GetTheme() { return (CardThemeColorType)3; } public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) int instanceID = ((Object)player).GetInstanceID(); _stackCounts.TryGetValue(instanceID, out var value); _stackCounts[instanceID] = value + 1; characterStats.movementSpeed += 0.5f; if (!((Object)(object)((Component)player).GetComponentInChildren() != (Object)null)) { GameObject val = new GameObject("SlipperyEffect"); val.transform.SetParent(((Component)player).transform, false); val.AddComponent().Init(player); } } public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { int instanceID = ((Object)player).GetInstanceID(); if (!_stackCounts.TryGetValue(instanceID, out var value)) { return; } characterStats.movementSpeed -= 0.5f; if (value > 1) { _stackCounts[instanceID] = value - 1; return; } _stackCounts.Remove(instanceID); SlipperyBehaviour componentInChildren = ((Component)player).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { Object.Destroy((Object)(object)((Component)componentInChildren).gameObject); } } } internal class SlipperyBehaviour : MonoBehaviour { private static readonly ManualLogSource Log = Logger.CreateLogSource("RoundsMod.Slippery"); internal static readonly HashSet SlipperyPlayers = new HashSet(); private const float InertiaRetain = 0.97f; private Player _player; private Vector2 _inertialVelocity; private int _logFrame; public void Init(Player player) { _player = player; SlipperyPlayers.Add(((Object)player).GetInstanceID()); CharacterData data = player.data; object obj; if (data == null) { obj = null; } else { PlayerVelocity playerVel = data.playerVel; obj = ((playerVel != null) ? ((Component)playerVel).GetComponent() : null); } Rigidbody2D val = (Rigidbody2D)obj; Log.LogInfo((object)("[Slippery] Init — rb=" + (((Object)(object)val != (Object)null) ? "found" : "NULL") + " isKinematic=" + (((Object)(object)val != (Object)null) ? val.isKinematic.ToString() : "?"))); } private void FixedUpdate() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_player == (Object)null || (Object)(object)_player.data == (Object)null) { return; } PlayerVelocity playerVel = _player.data.playerVel; Rigidbody2D val = ((playerVel != null) ? ((Component)playerVel).GetComponent() : null); if (!((Object)(object)val == (Object)null)) { Vector2 velocity = val.velocity; float magnitude = ((Vector2)(ref velocity)).magnitude; _inertialVelocity *= 0.97f; if (magnitude > ((Vector2)(ref _inertialVelocity)).magnitude) { _inertialVelocity = velocity; } if (((Vector2)(ref _inertialVelocity)).magnitude > magnitude + 0.1f) { val.velocity = _inertialVelocity; } _logFrame++; if (_logFrame % 150 == 0) { ManualLogSource log = Log; string text = $"[Slippery] game={magnitude:F2} inertia={((Vector2)(ref _inertialVelocity)).magnitude:F2}"; Vector2 velocity2 = val.velocity; log.LogInfo((object)(text + $" final={((Vector2)(ref velocity2)).magnitude:F2}")); } } } private void OnDestroy() { if (!((Object)(object)_player == (Object)null)) { SlipperyPlayers.Remove(((Object)_player).GetInstanceID()); Log.LogInfo((object)"[Slippery] Destroyed."); } } } internal class SwapCard : CustomCard { internal static readonly Dictionary StackCounts = new Dictionary(); protected override string GetTitle() { return "Swap"; } protected override string GetDescription() { return "On direct hit, instantly swap positions with the player you hit."; } protected override CardInfoStat[] GetStats() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown return (CardInfoStat[])(object)new CardInfoStat[1] { new CardInfoStat { positive = true, stat = "On Hit", amount = "Swap positions", simepleAmount = (SimpleAmount)0 } }; } protected override Rarity GetRarity() { return (Rarity)2; } protected override GameObject GetCardArt() { return CardArt.Load("C_SWAPCARD"); } protected override CardThemeColorType GetTheme() { return (CardThemeColorType)8; } public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { int instanceID = ((Object)player).GetInstanceID(); StackCounts.TryGetValue(instanceID, out var value); StackCounts[instanceID] = value + 1; } public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { int instanceID = ((Object)player).GetInstanceID(); if (StackCounts.TryGetValue(instanceID, out var value)) { if (value > 1) { StackCounts[instanceID] = value - 1; } else { StackCounts.Remove(instanceID); } } } } [HarmonyPatch(typeof(ProjectileHit), "Hit")] internal static class SwapHitPatch { [HarmonyPostfix] private static void Postfix(ProjectileHit __instance, HitInfo hit) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) Player ownPlayer = __instance.ownPlayer; if ((Object)(object)ownPlayer == (Object)null || !SwapCard.StackCounts.ContainsKey(((Object)ownPlayer).GetInstanceID())) { return; } Collider2D collider = hit.collider; Player val = ((collider != null) ? ((Component)collider).GetComponentInParent() : null); if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)ownPlayer)) { Vector3 position = ((Component)ownPlayer).transform.position; Vector3 position2 = ((Component)val).transform.position; ((Component)ownPlayer).transform.position = position2; ((Component)val).transform.position = position; CharacterData data = ownPlayer.data; object obj; if (data == null) { obj = null; } else { PlayerVelocity playerVel = data.playerVel; obj = ((playerVel != null) ? ((Component)playerVel).GetComponent() : null); } Rigidbody2D val2 = (Rigidbody2D)obj; CharacterData data2 = val.data; object obj2; if (data2 == null) { obj2 = null; } else { PlayerVelocity playerVel2 = data2.playerVel; obj2 = ((playerVel2 != null) ? ((Component)playerVel2).GetComponent() : null); } Rigidbody2D val3 = (Rigidbody2D)obj2; if ((Object)(object)val2 != (Object)null) { val2.position = new Vector2(position2.x, position2.y); } if ((Object)(object)val3 != (Object)null) { val3.position = new Vector2(position.x, position.y); } if ((Object)(object)val2 != (Object)null && (Object)(object)val3 != (Object)null) { Vector2 velocity = val2.velocity; val2.velocity = val3.velocity; val3.velocity = velocity; } } } } internal class SwiftCard : CustomCard { private static readonly ManualLogSource Log = Logger.CreateLogSource("RoundsMod.SwiftCard"); protected override string GetTitle() { return "Swift"; } protected override string GetDescription() { return "Move faster."; } protected override CardInfoStat[] GetStats() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown return (CardInfoStat[])(object)new CardInfoStat[1] { new CardInfoStat { positive = true, stat = "Move Speed", amount = "+30%", simepleAmount = (SimpleAmount)2 } }; } protected override Rarity GetRarity() { return (Rarity)0; } protected override GameObject GetCardArt() { return CardArt.Load("C_SWIFTCARD"); } protected override CardThemeColorType GetTheme() { return (CardThemeColorType)3; } public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { Log.LogInfo((object)"SwiftCard picked!"); characterStats.movementSpeed += 0.3f; } public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { characterStats.movementSpeed -= 0.3f; } } internal class TelefraggerCard : CustomCard { private static readonly Dictionary _stackCounts = new Dictionary(); protected override string GetTitle() { return "Telefragger"; } protected override string GetDescription() { return "Every 7 seconds, teleport to a random location on the map. Stay nimble."; } protected override CardInfoStat[] GetStats() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //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_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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0060: 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_006c: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //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) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown return (CardInfoStat[])(object)new CardInfoStat[4] { new CardInfoStat { positive = true, stat = "Move Speed", amount = "+20%", simepleAmount = (SimpleAmount)2 }, new CardInfoStat { positive = true, stat = "Bullet Speed", amount = "+15%", simepleAmount = (SimpleAmount)2 }, new CardInfoStat { positive = true, stat = "Attack Speed", amount = "+15%", simepleAmount = (SimpleAmount)2 }, new CardInfoStat { positive = true, stat = "Reload Speed", amount = "+20%", simepleAmount = (SimpleAmount)2 } }; } protected override Rarity GetRarity() { return (Rarity)1; } protected override GameObject GetCardArt() { return CardArt.Load("C_TELEFRAGGERCARD"); } protected override CardThemeColorType GetTheme() { return (CardThemeColorType)3; } public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) int instanceID = ((Object)player).GetInstanceID(); _stackCounts.TryGetValue(instanceID, out var value); _stackCounts[instanceID] = value + 1; characterStats.movementSpeed += 0.2f; gun.projectileSpeed += 0.15f; gun.attackSpeed += 0.15f; gunAmmo.reloadTimeAdd -= 0.2f; if (!((Object)(object)((Component)player).GetComponentInChildren() != (Object)null)) { GameObject val = new GameObject("TelefraggerEffect"); val.transform.SetParent(((Component)player).transform, false); val.AddComponent().Init(player); } } public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { int instanceID = ((Object)player).GetInstanceID(); if (!_stackCounts.TryGetValue(instanceID, out var value)) { return; } characterStats.movementSpeed -= 0.2f; gun.projectileSpeed -= 0.15f; gun.attackSpeed -= 0.15f; gunAmmo.reloadTimeAdd += 0.2f; if (value > 1) { _stackCounts[instanceID] = value - 1; return; } _stackCounts.Remove(instanceID); TelefraggerBehaviour componentInChildren = ((Component)player).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { Object.Destroy((Object)(object)((Component)componentInChildren).gameObject); } } } internal class TelefraggerBehaviour : MonoBehaviour { [CompilerGenerated] private sealed class d__8 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Vector3 pos; public bool isArrival; private GameObject 5__2; private Material 5__3; private float 5__4; private float 5__5; private float 5__6; private float 5__7; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__8(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; 5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_0032: 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_0061: Expected O, but got Unknown //IL_009e: 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_0138: 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_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__2 = GameObject.CreatePrimitive((PrimitiveType)0); 5__2.transform.position = pos; Object.Destroy((Object)(object)5__2.GetComponent()); 5__3 = new Material(Shader.Find("Sprites/Default")); 5__3.color = (isArrival ? new Color(0f, 0.8f, 1f, 0.85f) : new Color(1f, 1f, 0f, 0.85f)); 5__2.GetComponent().material = 5__3; 5__4 = 0.15f; 5__5 = 0f; 5__6 = (isArrival ? 0.1f : 0.6f); 5__7 = (isArrival ? 0.6f : 0.05f); break; case 1: <>1__state = -1; break; } if (5__5 < 5__4) { 5__5 += Time.deltaTime; float num = 5__5 / 5__4; 5__2.transform.localScale = Vector3.one * Mathf.Lerp(5__6, 5__7, num); 5__3.color = new Color(5__3.color.r, 5__3.color.g, 5__3.color.b, Mathf.Lerp(0.85f, 0f, num)); <>2__current = null; <>1__state = 1; return true; } Object.Destroy((Object)(object)5__2); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__7 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public TelefraggerBehaviour <>4__this; private Collider2D[] 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Expected O, but got Unknown //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //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_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: 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_0165: 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_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0278: 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_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: 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_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Expected O, but got Unknown //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; TelefraggerBehaviour telefraggerBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; goto IL_0031; case 1: <>1__state = -1; if (!((Object)(object)telefraggerBehaviour._player == (Object)null) && !((Object)(object)telefraggerBehaviour._player.data == (Object)null) && !telefraggerBehaviour._player.data.dead) { Camera main = Camera.main; if ((Object)(object)main == (Object)null) { Log.LogWarning((object)"[Telefragger] Camera.main is null; skipping."); } else { float num2 = main.orthographicSize - 1.5f; float num3 = num2 * main.aspect - 1.5f; if (num2 <= 0f || num3 <= 0f) { Log.LogWarning((object)"[Telefragger] Camera bounds too small; skipping."); } else { 5__2 = ((Component)telefraggerBehaviour._player).GetComponentsInChildren(true); Collider2D[] array = 5__2; for (int i = 0; i < array.Length; i++) { ((Behaviour)array[i]).enabled = false; } Vector3 position = ((Component)telefraggerBehaviour._player).transform.position; bool flag = false; int num4 = 0; Vector3 position2 = ((Component)main).transform.position; Vector2 val2 = default(Vector2); for (int j = 0; j < 10; j++) { num4++; ((Vector2)(ref val2))..ctor(position2.x + Random.Range(0f - num3, num3), position2.y + Random.Range(0f - num2, num2)); bool flag2 = false; array = Physics2D.OverlapCircleAll(val2, 0.5f); for (int i = 0; i < array.Length; i++) { if (!array[i].isTrigger) { flag2 = true; break; } } if (!flag2) { ((Vector3)(ref position))..ctor(val2.x, val2.y, ((Component)telefraggerBehaviour._player).transform.position.z); flag = true; break; } } if (flag) { Log.LogInfo((object)$"[Telefragger] Found clear destination after {num4} tries."); Vector3 position3 = ((Component)telefraggerBehaviour._player).transform.position; ((MonoBehaviour)telefraggerBehaviour).StartCoroutine(telefraggerBehaviour.TeleportFlash(position3, isArrival: false)); ((Component)telefraggerBehaviour._player).transform.position = position; PlayerVelocity playerVel = telefraggerBehaviour._player.data.playerVel; Rigidbody2D val3 = ((playerVel != null) ? ((Component)playerVel).GetComponent() : null); if ((Object)(object)val3 != (Object)null) { val3.position = new Vector2(position.x, position.y); val3.velocity = Vector2.zero; } Log.LogInfo((object)$"[Telefragger] Teleported from ({position3.x:F1},{position3.y:F1}) to ({position.x:F1},{position.y:F1})."); ((MonoBehaviour)telefraggerBehaviour).StartCoroutine(telefraggerBehaviour.TeleportFlash(position, isArrival: true)); <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 2; return true; } array = 5__2; foreach (Collider2D val4 in array) { if ((Object)(object)val4 != (Object)null) { ((Behaviour)val4).enabled = true; } } Log.LogWarning((object)$"[Telefragger] No clear destination after {num4} tries; skipping teleport."); } } } goto IL_0031; case 2: <>1__state = -1; <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 3; return true; case 3: <>1__state = -1; <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 4; return true; case 4: { <>1__state = -1; Collider2D[] array = 5__2; foreach (Collider2D val in array) { if ((Object)(object)val != (Object)null) { ((Behaviour)val).enabled = true; } } 5__2 = null; goto IL_0031; } IL_0031: <>2__current = (object)new WaitForSeconds(7f); <>1__state = 1; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static readonly ManualLogSource Log = Logger.CreateLogSource("RoundsMod.Telefragger"); private const float Interval = 7f; private const float Margin = 1.5f; private const float CheckRadius = 0.5f; private const int MaxTries = 10; private Player _player; public void Init(Player player) { _player = player; Log.LogInfo((object)"[Telefragger] Behaviour Init."); ((MonoBehaviour)this).StartCoroutine(TeleportLoop()); } [IteratorStateMachine(typeof(d__7))] private IEnumerator TeleportLoop() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__7(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__8))] private IEnumerator TeleportFlash(Vector3 pos, bool isArrival) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__8(0) { pos = pos, isArrival = isArrival }; } } internal class TimeStopCard : CustomCard { private static readonly Dictionary _stackCounts = new Dictionary(); protected override string GetTitle() { return "Time Stop"; } protected override string GetDescription() { return "On kill, all other players freeze in place for 1.5 seconds."; } protected override CardInfoStat[] GetStats() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown return (CardInfoStat[])(object)new CardInfoStat[1] { new CardInfoStat { positive = true, stat = "On Kill", amount = "Freeze others 1.5 s", simepleAmount = (SimpleAmount)0 } }; } protected override Rarity GetRarity() { return (Rarity)2; } protected override GameObject GetCardArt() { return CardArt.Load("C_TIMESTOPCARD"); } protected override CardThemeColorType GetTheme() { return (CardThemeColorType)8; } public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) int instanceID = ((Object)player).GetInstanceID(); _stackCounts.TryGetValue(instanceID, out var value); _stackCounts[instanceID] = value + 1; if (!((Object)(object)((Component)player).GetComponentInChildren() != (Object)null)) { GameObject val = new GameObject("TimeStopWatcher"); val.transform.SetParent(((Component)player).transform, false); val.AddComponent().Init(player, _stackCounts); } } public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { int instanceID = ((Object)player).GetInstanceID(); if (!_stackCounts.TryGetValue(instanceID, out var value)) { return; } if (value > 1) { _stackCounts[instanceID] = value - 1; return; } _stackCounts.Remove(instanceID); TimeStopWatcherBehaviour componentInChildren = ((Component)player).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { Object.Destroy((Object)(object)((Component)componentInChildren).gameObject); } } } internal class TimeStopWatcherBehaviour : MonoBehaviour { private Player _player; private Dictionary _stackCounts; private readonly Dictionary _wasDeadLastFrame = new Dictionary(); public void Init(Player player, Dictionary stackCounts) { _player = player; _stackCounts = stackCounts; } private void Update() { if ((Object)(object)_player == (Object)null) { return; } foreach (Player player in PlayerManager.instance.players) { if (!((Object)(object)player == (Object)null) && !((Object)(object)player == (Object)(object)_player) && !((Object)(object)player.data == (Object)null)) { int instanceID = ((Object)player).GetInstanceID(); bool value; bool flag = _wasDeadLastFrame.TryGetValue(instanceID, out value) && value; bool dead = player.data.dead; bool num = dead && !flag; _wasDeadLastFrame[instanceID] = dead; if (num && !((Object)(object)player.data.lastSourceOfDamage != (Object)(object)_player)) { _stackCounts.TryGetValue(((Object)_player).GetInstanceID(), out var value2); float duration = (float)Mathf.Max(1, value2) * 1.5f; FreezeAll(duration); } } } } private void FreezeAll(float duration) { //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) foreach (Player player in PlayerManager.instance.players) { if (!((Object)(object)player == (Object)null) && !((Object)(object)player == (Object)(object)_player) && !((Object)(object)player.data == (Object)null) && !player.data.dead) { TimeStopFreezeBehaviour componentInChildren = ((Component)player).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.ExtendOrReset(duration); continue; } GameObject val = new GameObject("TimeStopFreeze"); val.transform.SetParent(((Component)player).transform, false); val.AddComponent().Init(player, duration); } } } } internal class TimeStopFreezeBehaviour : MonoBehaviour { [CompilerGenerated] private sealed class d__7 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public TimeStopFreezeBehaviour <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown int num = <>1__state; TimeStopFreezeBehaviour timeStopFreezeBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(timeStopFreezeBehaviour._duration); <>1__state = 1; return true; case 1: <>1__state = -1; timeStopFreezeBehaviour.End(); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private Player _target; private float _duration; private bool _ended; private Behaviour _input; public void Init(Player target, float duration) { _target = target; _duration = duration; _input = (Behaviour)(object)target.data?.input; if ((Object)(object)_input != (Object)null) { _input.enabled = false; } ((MonoBehaviour)this).StartCoroutine(DurationRoutine()); } public void ExtendOrReset(float duration) { _duration = duration; ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).StartCoroutine(DurationRoutine()); } private void FixedUpdate() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) if (!_ended && !((Object)(object)_target == (Object)null) && !((Object)(object)_target.data == (Object)null)) { PlayerVelocity playerVel = _target.data.playerVel; Rigidbody2D val = ((playerVel != null) ? ((Component)playerVel).GetComponent() : null); if ((Object)(object)val != (Object)null) { val.velocity = Vector2.zero; } } } [IteratorStateMachine(typeof(d__7))] private IEnumerator DurationRoutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__7(0) { <>4__this = this }; } private void End() { if (!_ended) { _ended = true; if ((Object)(object)_input != (Object)null) { _input.enabled = true; } Object.Destroy((Object)(object)((Component)this).gameObject); } } private void OnDestroy() { if (!_ended && (Object)(object)_input != (Object)null) { _input.enabled = true; } } } internal class WrapCard : CustomCard { internal static readonly Dictionary StackCounts = new Dictionary(); internal static readonly Dictionary GunToPlayer = new Dictionary(); internal static ManualLogSource Log; protected override string GetTitle() { return "Wraparound"; } protected override string GetDescription() { return "Bullets that leave the screen reappear on the opposite edge."; } protected override CardInfoStat[] GetStats() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown return (CardInfoStat[])(object)new CardInfoStat[1] { new CardInfoStat { positive = true, stat = "Wraps per bullet", amount = "+1", simepleAmount = (SimpleAmount)0 } }; } protected override Rarity GetRarity() { return (Rarity)1; } protected override GameObject GetCardArt() { return CardArt.Load("C_WRAPCARD"); } protected override CardThemeColorType GetTheme() { return (CardThemeColorType)8; } public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { int instanceID = ((Object)player).GetInstanceID(); int instanceID2 = ((Object)gun).GetInstanceID(); StackCounts.TryGetValue(instanceID, out var value); StackCounts[instanceID] = value + 1; GunToPlayer[instanceID2] = instanceID; ManualLogSource log = Log; if (log != null) { log.LogInfo((object)$"[Wrap] OnAddCard: player={instanceID} gun={instanceID2} stacks={StackCounts[instanceID]}"); } } public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { int instanceID = ((Object)player).GetInstanceID(); if (StackCounts.TryGetValue(instanceID, out var value)) { if (value > 1) { StackCounts[instanceID] = value - 1; return; } StackCounts.Remove(instanceID); GunToPlayer.Remove(((Object)gun).GetInstanceID()); } } } [HarmonyPatch(typeof(Gun), "BulletInit")] internal static class GunBulletInitPatch { [HarmonyPostfix] private static void Postfix(Gun __instance, GameObject bullet) { int instanceID = ((Object)__instance).GetInstanceID(); int value; bool flag = WrapCard.GunToPlayer.TryGetValue(instanceID, out value); int value2 = 0; bool flag2 = flag && WrapCard.StackCounts.TryGetValue(value, out value2) && value2 > 0; ManualLogSource log = WrapCard.Log; if (log != null) { log.LogInfo((object)$"[Wrap] BulletInit: gun={instanceID} knownGun={flag} pid={value} hasWraps={flag2} bullet='{((bullet != null) ? ((Object)bullet).name : null)}'"); } if (flag2) { bullet.AddComponent().Init(value2); ManualLogSource log2 = WrapCard.Log; if (log2 != null) { log2.LogInfo((object)$"[Wrap] Attached BulletWrapBehaviour, stacks={value2}"); } } } } }