Decompiled source of tripletmodnotclickbait v1.0.2
RoundsMod.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.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<EchoCoroutineRunner>(); Object.DontDestroyOnLoad((Object)(object)((Component)echoCoroutineRunner).gameObject); EchoCard.Runner = echoCoroutineRunner; CustomCard.BuildCard<SwiftCard>((Action<CardInfo>)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<SpriteRenderer>(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<HeavyCard>(); CustomCard.BuildCard<PistachioCard>(); CustomCard.BuildCard<LandmineCard>(); CustomCard.BuildCard<InvisibilityCard>(); CustomCard.BuildCard<WrapCard>(); CustomCard.BuildCard<MomentumCard>(); CustomCard.BuildCard<LastStandCard>(); CustomCard.BuildCard<EchoCard>(); CustomCard.BuildCard<OverclockCard>(); CustomCard.BuildCard<SwapCard>(); CustomCard.BuildCard<AnchorCard>(); CustomCard.BuildCard<TimeStopCard>(); CustomCard.BuildCard<RussianRouletteCard>(); CustomCard.BuildCard<BoomerangCard>(); ScrambleRunner scrambleRunner = new GameObject("ScrambleRunner").AddComponent<ScrambleRunner>(); Object.DontDestroyOnLoad((Object)(object)((Component)scrambleRunner).gameObject); scrambleRunner.RegisterHooks(); CustomCard.BuildCard<TelefraggerCard>(); CustomCard.BuildCard<PinballCard>(); CustomCard.BuildCard<SlipperyCard>(); CustomCard.BuildCard<MartyrdomCard>(); CustomCard.BuildCard<ChainReactionCard>(); CustomCard.BuildCard<CardThiefCard>(); CustomCard.BuildCard<ScrambleCard>(); 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<Rigidbody2D>() : 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<int, int> StackCounts = new Dictionary<int, int>(); internal static readonly Dictionary<int, int> GunToPlayer = new Dictionary<int, int>(); 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<AnchorBehaviour>() == (Object)null) { GameObject val = new GameObject("AnchorEffect"); val.transform.SetParent(((Component)player).transform, false); val.AddComponent<AnchorBehaviour>().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<AnchorBehaviour>(); 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<HomingBulletBehaviour>(); } } } 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<MoveTransform>(); _projHit = ((Component)this).GetComponent<ProjectileHit>(); 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<int, int> StackCounts = new Dictionary<int, int>(); internal static readonly Dictionary<int, int> GunToPlayer = new Dictionary<int, int>(); internal static readonly Dictionary<int, Player> PlayerRefs = new Dictionary<int, Player>(); 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<BoomerangBulletBehaviour>().Init(value2); } } } internal class BulletWrapBehaviour : MonoBehaviour { [CompilerGenerated] private sealed class <PostWrapCleanup>d__13 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public BulletWrapBehaviour <>4__this; private Collider2D[] <cols>5__2; private ProjectileHit[] <projHits>5__3; private ProjectileCollision[] <projCols>5__4; private RayCastTrail[] <rcts>5__5; private TrailRenderer[] <trails>5__6; private LineRenderer[] <lines>5__7; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PostWrapCleanup>d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <cols>5__2 = null; <projHits>5__3 = null; <projCols>5__4 = null; <rcts>5__5 = null; <trails>5__6 = null; <lines>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; <cols>5__2 = ((Component)bulletWrapBehaviour).GetComponentsInChildren<Collider2D>(true); <projHits>5__3 = ((Component)bulletWrapBehaviour).GetComponentsInChildren<ProjectileHit>(true); <projCols>5__4 = ((Component)bulletWrapBehaviour).GetComponentsInChildren<ProjectileCollision>(true); <rcts>5__5 = ((Component)bulletWrapBehaviour).GetComponentsInChildren<RayCastTrail>(true); <trails>5__6 = ((Component)bulletWrapBehaviour).GetComponentsInChildren<TrailRenderer>(true); <lines>5__7 = ((Component)bulletWrapBehaviour).GetComponentsInChildren<LineRenderer>(true); Collider2D[] array = <cols>5__2; for (int i = 0; i < array.Length; i++) { ((Behaviour)array[i]).enabled = false; } ProjectileHit[] array2 = <projHits>5__3; for (int i = 0; i < array2.Length; i++) { ((Behaviour)array2[i]).enabled = false; } ProjectileCollision[] array3 = <projCols>5__4; for (int i = 0; i < array3.Length; i++) { ((Behaviour)array3[i]).enabled = false; } RayCastTrail[] array4 = <rcts>5__5; for (int i = 0; i < array4.Length; i++) { ((Behaviour)array4[i]).enabled = false; } TrailRenderer[] array5 = <trails>5__6; for (int i = 0; i < array5.Length; i++) { array5[i].emitting = false; } LineRenderer[] array6 = <lines>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={<cols>5__2.Length} ph={<projHits>5__3.Length} pc={<projCols>5__4.Length} rct={<rcts>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 = <cols>5__2; foreach (Collider2D val in array) { if ((Object)(object)val != (Object)null) { ((Behaviour)val).enabled = true; } } ProjectileHit[] array2 = <projHits>5__3; foreach (ProjectileHit val2 in array2) { if ((Object)(object)val2 != (Object)null) { ((Behaviour)val2).enabled = true; } } ProjectileCollision[] array3 = <projCols>5__4; foreach (ProjectileCollision val3 in array3) { if ((Object)(object)val3 != (Object)null) { ((Behaviour)val3).enabled = true; } } RayCastTrail[] array4 = <rcts>5__5; foreach (RayCastTrail val4 in array4) { if ((Object)(object)val4 != (Object)null) { ((Behaviour)val4).enabled = true; } } TrailRenderer[] array5 = <trails>5__6; foreach (TrailRenderer val5 in array5) { if ((Object)(object)val5 != (Object)null) { val5.Clear(); val5.emitting = true; } } LineRenderer[] array6 = <lines>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<Rigidbody2D>(); 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<RayCastTrail>(); 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<RayCastTrail>(); 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<FieldInfo> list = new List<FieldInfo>(); 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<MoveTransform>(); 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(<PostWrapCleanup>d__13))] private IEnumerator PostWrapCleanup() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PostWrapCleanup>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<GameObject>(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<int, int> _stackCounts = new Dictionary<int, int>(); 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<CardThiefBehaviour>() != (Object)null)) { GameObject val = new GameObject("CardThiefWatcher"); val.transform.SetParent(((Component)player).transform, false); val.AddComponent<CardThiefBehaviour>().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<CardThiefBehaviour>(); 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<int, int> _stackCounts; private readonly Dictionary<int, bool> _wasDeadLastFrame = new Dictionary<int, bool>(); public void Init(Player player, Dictionary<int, int> 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<CardInfo>)) { _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<int, int> _stackCounts = new Dictionary<int, int>(); 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<ChainReactionBehaviour>() != (Object)null)) { GameObject val = new GameObject("ChainReactionWatcher"); val.transform.SetParent(((Component)player).transform, false); val.AddComponent<ChainReactionBehaviour>().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<ChainReactionBehaviour>(); if ((Object)(object)componentInChildren != (Object)null) { Object.Destroy((Object)(object)((Component)componentInChildren).gameObject); } } } internal class ChainReactionBehaviour : MonoBehaviour { [CompilerGenerated] private sealed class <ChainExplosion>d__9 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public float delay; public Vector2 origin; public ChainReactionBehaviour <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ChainExplosion>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<Rigidbody2D>(); 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 <ExplosionVisual>d__10 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Vector2 origin; private GameObject <boom>5__2; private Material <mat>5__3; private float <duration>5__4; private float <elapsed>5__5; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ExplosionVisual>d__10(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <boom>5__2 = null; <mat>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; <boom>5__2 = GameObject.CreatePrimitive((PrimitiveType)0); <boom>5__2.transform.position = Vector2.op_Implicit(origin); Object.Destroy((Object)(object)<boom>5__2.GetComponent<Collider>()); <mat>5__3 = new Material(Shader.Find("Sprites/Default")); <mat>5__3.color = new Color(1f, 0.4f, 0f, 0.9f); <boom>5__2.GetComponent<Renderer>().material = <mat>5__3; <duration>5__4 = 0.45f; <elapsed>5__5 = 0f; break; case 1: <>1__state = -1; break; } if (<elapsed>5__5 < <duration>5__4) { <elapsed>5__5 += Time.deltaTime; float num = <elapsed>5__5 / <duration>5__4; <boom>5__2.transform.localScale = Vector3.one * Mathf.Lerp(0.5f, 8f, num); <mat>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)<boom>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<int, int> _stackCounts; private readonly Dictionary<int, bool> _wasDeadLastFrame = new Dictionary<int, bool>(); public void Init(Player player, Dictionary<int, int> 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(<ChainExplosion>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 <ChainExplosion>d__9(0) { <>4__this = this, origin = origin, delay = delay }; } [IteratorStateMachine(typeof(<ExplosionVisual>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 <ExplosionVisual>d__10(0) { origin = origin }; } } internal class EchoCoroutineRunner : MonoBehaviour { [CompilerGenerated] private sealed class <EchoRoutine>d__2 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Gun gun; public int stacks; private int <gid>5__2; private int <i>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <EchoRoutine>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); } <gid>5__2 = ((Object)gun).GetInstanceID(); <i>5__3 = 1; break; case 1: <>1__state = -1; if ((Object)(object)gun == (Object)null) { return false; } EchoBulletInitPatch.IncrementPending(<gid>5__2); _attackMethod?.Invoke(gun, new object[5] { 1f, true, 1f, 0f, false }); <i>5__3++; break; } if (<i>5__3 <= stacks) { <>2__current = (object)new WaitForSeconds((float)<i>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(<EchoRoutine>d__2))] private IEnumerator EchoRoutine(Gun gun, int stacks) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <EchoRoutine>d__2(0) { gun = gun, stacks = stacks }; } } internal class EchoCard : CustomCard { internal static readonly Dictionary<int, int> StackCounts = new Dictionary<int, int>(); internal static readonly Dictionary<int, int> GunToPlayer = new Dictionary<int, int>(); 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<int, int> PendingEchoShots = new Dictionary<int, int>(); private static readonly Dictionary<int, int> _pendingConsumedFrame = new Dictionary<int, int>(); private static readonly Dictionary<int, Vector3> _lastFirePos = new Dictionary<int, Vector3>(); private static readonly Dictionary<int, int> _lastEchoFrame = new Dictionary<int, int>(); 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<Rigidbody2D>(); 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<MoveTransform>(); ProjectileHit component = ((Component)this).GetComponent<ProjectileHit>(); 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 <DurationRoutine>d__8 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public float duration; public InvisibilityBehaviour <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DurationRoutine>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<Renderer>(true).Concat(((Component)gun).GetComponentsInChildren<Renderer>(true)).ToArray(); _canvases = ((Component)player).GetComponentsInChildren<Canvas>(true).Concat(((Component)gun).GetComponentsInChildren<Canvas>(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(<DurationRoutine>d__8))] private IEnumerator DurationRoutine(float duration) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DurationRoutine>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<int, Action<BlockTriggerType>> _blockDelegates = new Dictionary<int, Action<BlockTriggerType>>(); private static readonly Dictionary<int, int> _stackCounts = new Dictionary<int, int>(); 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<BlockTriggerType>)Delegate.Remove(block.BlockAction, value); } _stackCounts.TryGetValue(instanceID, out var value2); _stackCounts[instanceID] = value2 + 1; Action<BlockTriggerType> action = delegate { ActivateInvisibility(player, gun); }; _blockDelegates[instanceID] = action; block.BlockAction = (Action<BlockTriggerType>)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<BlockTriggerType>)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<InvisibilityBehaviour>(); 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<InvisibilityBehaviour>().Init(player, gun, (float)value * 7f); } } } internal class LandmineBehaviour : MonoBehaviour { [CompilerGenerated] private sealed class <ArmRoutine>d__14 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public LandmineBehaviour <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ArmRoutine>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 <BlinkRoutine>d__15 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public LandmineBehaviour <>4__this; private Renderer <rend>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <BlinkRoutine>d__15(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <rend>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; <rend>5__2 = ((visual != null) ? visual.GetComponent<Renderer>() : null); if ((Object)(object)<rend>5__2 == (Object)null) { return false; } break; } case 1: <>1__state = -1; <rend>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) { <rend>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 <ExplosionEffect>d__18 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public LandmineBehaviour <>4__this; private GameObject <boom>5__2; private Material <mat>5__3; private float <duration>5__4; private float <elapsed>5__5; private float <maxScale>5__6; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ExplosionEffect>d__18(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <boom>5__2 = null; <mat>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); } <boom>5__2 = GameObject.CreatePrimitive((PrimitiveType)0); <boom>5__2.transform.position = ((Component)landmineBehaviour).transform.position; Object.Destroy((Object)(object)<boom>5__2.GetComponent<Collider>()); <mat>5__3 = new Material(Shader.Find("Sprites/Default")); <mat>5__3.color = new Color(1f, 0.4f, 0f, 0.9f); <boom>5__2.GetComponent<Renderer>().material = <mat>5__3; <duration>5__4 = 0.45f; <elapsed>5__5 = 0f; <maxScale>5__6 = 6f; break; case 1: <>1__state = -1; break; } if (<elapsed>5__5 < <duration>5__4) { <elapsed>5__5 += Time.deltaTime; float num2 = <elapsed>5__5 / <duration>5__4; <boom>5__2.transform.localScale = Vector3.one * Mathf.Lerp(0.5f, <maxScale>5__6, num2); <mat>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)<boom>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<LandmineBehaviour> ActiveMines = new List<LandmineBehaviour>(); 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<Collider>()); Renderer component = _visual.GetComponent<Renderer>(); if ((Object)(object)component != (Object)null) { component.material = new Material(Shader.Find("Sprites/Default")) { color = Color.grey }; } } [IteratorStateMachine(typeof(<ArmRoutine>d__14))] private IEnumerator ArmRoutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ArmRoutine>d__14(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<BlinkRoutine>d__15))] private IEnumerator BlinkRoutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <BlinkRoutine>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<Player>() != (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<Rigidbody2D>(); if (component != null) { component.AddForce(val4 * 100f * num2, (ForceMode2D)1); } } } ((MonoBehaviour)this).StartCoroutine(ExplosionEffect()); } [IteratorStateMachine(typeof(<ExplosionEffect>d__18))] private IEnumerator ExplosionEffect() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ExplosionEffect>d__18(0) { <>4__this = this }; } } internal class LandmineCard : CustomCard { [CompilerGenerated] private sealed class <OnRoundStart>d__12 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OnRoundStart>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<int, Action<BlockTriggerType>> _blockDelegates = new Dictionary<int, Action<BlockTriggerType>>(); private static readonly Dictionary<int, int> _stackCounts = new Dictionary<int, int>(); 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<IGameModeHandler, IEnumerator>)OnRoundStart); } if (_blockDelegates.ContainsKey(instanceID)) { return; } Action<BlockTriggerType> 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<BlockTriggerType>)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<BlockTriggerType>)Delegate.Remove(block.BlockAction, value2); _blockDelegates.Remove(instanceID); } } [IteratorStateMachine(typeof(<OnRoundStart>d__12))] private static IEnumerator OnRoundStart(IGameModeHandler gm) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <OnRoundStart>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<LandmineBehaviour>().Init(owner); } } internal class LastStandBehaviour : MonoBehaviour { [CompilerGenerated] private sealed class <PulseRoutine>d__16 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public LastStandBehaviour <>4__this; private Renderer <rend>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PulseRoutine>d__16(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <rend>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; <rend>5__2 = ((indicator != null) ? indicator.GetComponent<Renderer>() : null); break; } case 1: <>1__state = -1; if ((Object)(object)<rend>5__2 != (Object)null) { <rend>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)<rend>5__2 != (Object)null) { <rend>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<Collider>()); Renderer component = _indicator.GetComponent<Renderer>(); 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 *