Decompiled source of BrainrotCards v0.1.0
BrainrotCards.dll
Decompiled 4 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using BrainrotCards.Cards; using BrainrotCards.Core; using BrainrotCards.Effects; using HarmonyLib; using Microsoft.CodeAnalysis; using ModdingUtils.Extensions; using ModdingUtils.Utils; using Photon.Pun; using TMPro; using UnboundLib; using UnboundLib.Cards; using UnboundLib.GameModes; using UnboundLib.Networking; using UnboundLib.Utils; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; using WillsWackyManagers.Utils; [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("BrainrotCards")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0+ddf9180d6a77d25cf198abec79e83d7c2e8ae5b7")] [assembly: AssemblyProduct("BrainrotCards")] [assembly: AssemblyTitle("BrainrotCards")] [assembly: AssemblyVersion("0.1.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BrainrotCards { [BepInPlugin("dannythealien.rounds.brainrotcards", "Brainrot Cards", "0.1.0")] [BepInProcess("Rounds.exe")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class BrainrotPlugin : BaseUnityPlugin { public const string Guid = "dannythealien.rounds.brainrotcards"; public const string Version = "0.1.0"; public const string ModInitials = "BRAIN"; internal static ManualLogSource Log; private void Awake() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; DevTools.Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Dev", "TestKeys", false, "Developer test mode: F9/F10 give player 1/2 the next Brainrot card, F11 lists cards, extra logging."); ((Component)this).gameObject.AddComponent<DevTools>(); Harmony val = new Harmony("dannythealien.rounds.brainrotcards"); Type[] typesFromAssembly = AccessTools.GetTypesFromAssembly(typeof(BrainrotPlugin).Assembly); foreach (Type type in typesFromAssembly) { if (type.GetCustomAttributes(typeof(HarmonyPatch), inherit: false).Length != 0) { try { val.CreateClassProcessor(type).Patch(); } catch (Exception arg) { Log.LogError((object)$"Patch {type.Name} failed: {arg}"); } } } } private void Start() { Fight.Register(); CustomCard.BuildCard<Skibidi>(); CustomCard.BuildCard<Gigachad>(); CustomCard.BuildCard<BigChungus>(); CustomCard.BuildCard<Doge>(); CustomCard.BuildCard<SigmaGrindset>(); CustomCard.BuildCard<LeeroyJenkins>(); CustomCard.BuildCard<Rickroll>(); CustomCard.BuildCard<CartoonBonk>(); CustomCard.BuildCard<VineBoom>(); CustomCard.BuildCard<EmotionalDamage>(); CustomCard.BuildCard<Mitochondria>(); CustomCard.BuildCard<FreeRealEstate>(); CustomCard.BuildCard<Ligma>(); CustomCard.BuildCard<EmergencyMeeting>(); CustomCard.BuildCard<SpeedrunAny>(); CustomCard.BuildCard<OhioFinalBoss>(); CustomCard.BuildCard<OnlyInOhio>(); CustomCard.BuildCard<SkylineChili>(); CustomCard.BuildCard<CedarPoint>(); CustomCard.BuildCard<LakeErieFire>(); CustomCard.BuildCard<ClevelandSportsFan>(); CustomCard.BuildCard<FloridaMan>(); CustomCard.BuildCard<GatorBite>(); CustomCard.BuildCard<HurricaneSeason>(); CustomCard.BuildCard<BathSalts>(); CustomCard.BuildCard<PublixSub>(); CustomCard.BuildCard<RetirementCommunity>(); CustomCard.BuildCard<Sunburn>(); CustomCard.BuildCard<CornMaze>((Action<CardInfo>)BrainrotCurse.Register); CustomCard.BuildCard<Humidity>((Action<CardInfo>)BrainrotCurse.Register); CustomCard.BuildCard<WindowsXP>((Action<CardInfo>)BrainrotCurse.Register); CustomCard.BuildCard<LagSpike>((Action<CardInfo>)BrainrotCurse.Register); CustomCard.BuildCard<TouchGrass>((Action<CardInfo>)BrainrotCurse.Register); CustomCard.BuildCard<TeamOhio>(); CustomCard.BuildCard<TeamFlorida>(); Log.LogInfo((object)"Brainrot Cards loaded: 35 cards."); } } } namespace BrainrotCards.Core { public abstract class BrainrotCard : CustomCard { public string Id => ((object)this).GetType().Name; protected virtual Type EffectType => null; protected virtual string[] Tags => Array.Empty<string>(); public override string GetModName() { return "BRAIN"; } protected override GameObject GetCardArt() { return null; } public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block) { CardTags.Set(Id, Tags); Setup(cardInfo, gun, cardStats, statModifiers, block); } protected virtual void Setup(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block) { } public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { Holder.Of(player).Add(Id); Status.Of(player); if (EffectType != null && (Object)(object)((Component)player).GetComponent(EffectType) == (Object)null) { ((Component)player).gameObject.AddComponent(EffectType); } Added(player, gun, gunAmmo, data); } public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { Holder holder = Holder.Of(player); holder.Remove(Id); if (EffectType != null && !holder.Has(Id)) { Component component = ((Component)player).GetComponent(EffectType); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } } Removed(player, gun, gunAmmo, data); } protected virtual void Added(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data) { } protected virtual void Removed(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data) { } protected static CardInfoStat Stat(bool positive, string stat, string amount) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown return new CardInfoStat { positive = positive, stat = stat, amount = amount, simepleAmount = (SimpleAmount)0 }; } } public static class Damage { public const float CloseRange = 6f; public static bool Bypass; public static void Raw(Player target, float amount, Player attacker) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) Bypass = true; try { ((Damagable)target.data.healthHandler).CallTakeDamage(Vector2.down * amount, Vector2.op_Implicit(((Component)target).transform.position), (GameObject)null, attacker, true); } finally { Bypass = false; } } public static bool Modify(HealthHandler targetHealth, Player attacker, ProjectileHit bullet, ref Vector2 damage) { //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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_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_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Unknown result type (might be due to invalid IL or missing references) if (Bypass || damage == Vector2.zero) { return true; } Player component = ((Component)targetHealth).GetComponent<Player>(); if ((Object)(object)component == (Object)null) { return true; } if (component.data.block.IsBlocking()) { return true; } Holder holder = Holder.Of(component); if (holder.Has("PublixSub") && PublixSubEffect.InDeliLine(component)) { return false; } float num = 1f; if (holder.Has("RetirementCommunity")) { Vector2 val = Velocity.Get(component); if (((Vector2)(ref val)).magnitude < 1.5f) { num *= 0.7f; } } if (!((Object)(object)attacker == (Object)null) && !((Object)(object)attacker == (Object)(object)component)) { Holder holder2 = Holder.Of(attacker); float num2 = Vector2.Distance(Vector2.op_Implicit(((Component)attacker).transform.position), Vector2.op_Implicit(((Component)component).transform.position)); if (holder.Has("Gigachad") && num2 < 6f) { num *= 0.8f; } Status component2 = ((Component)attacker).GetComponent<Status>(); if ((Object)(object)component2 != (Object)null) { num *= component2.OutgoingDamageMult; } BulletTag bulletTag = (((Object)(object)bullet != (Object)null) ? ((Component)bullet).GetComponent<BulletTag>() : null); if ((Object)(object)bulletTag != (Object)null) { DevTools.Log($"bullet tag: bounces {bulletTag.Bounces} (start {bulletTag.initialReflects}), stored bonus {bulletTag.bonus:0.00}"); if (holder2.Has("OhioFinalBoss")) { num *= 1f + 0.25f * (float)bulletTag.Bounces; } if (holder2.Has("Mitochondria")) { num *= 1f + bulletTag.bonus; } } bool flag = num2 < 6f; if (holder2.Has("GatorBite") && flag) { num *= 1.5f; } Status component3 = ((Component)component).GetComponent<Status>(); if (holder2.Has("Sunburn")) { num *= (((Object)(object)component3 != (Object)null && component3.SunMarked) ? 1.6f : 0.9f); } if (holder2.Has("TeamOhio") && holder.HasAny("Florida")) { num *= 1.25f; } if (holder2.Has("TeamFlorida") && holder.HasAny("Ohio")) { num *= 1.25f; } if (holder2.Has("LeeroyJenkins") && Fight.Elapsed < 3f) { num *= 1.6f; } if (holder2.Has("FloridaMan") && FloridaManEffect.GoodRoll(attacker)) { num *= 2f; } SigmaEffect component4 = ((Component)attacker).GetComponent<SigmaEffect>(); if ((Object)(object)component4 != (Object)null) { num *= component4.DamageMult; } if (holder2.Has("ClevelandSportsFan")) { Fight.RoundsLost.TryGetValue(attacker.playerID, out var value); num *= 1f + 0.12f * (float)value * (float)holder2.Count("ClevelandSportsFan"); } if (holder2.Has("GatorBite") && flag) { Net.ApplyStatus(component, StatusKind.JumpLock, 1.5f); } if (holder2.Has("Sunburn")) { Net.ApplyStatus(component, StatusKind.SunMark, 3f); } if (holder2.Has("Ligma")) { Net.ApplyStatus(component, StatusKind.Inverted, 1.5f); } if (holder2.Has("EmotionalDamage") && ((Object)(object)component3 == (Object)null || component3.emotionalStacks < 6)) { Net.ApplyStatus(component, StatusKind.Emotional, 0f); } CartoonBonkEffect component5 = ((Component)attacker).GetComponent<CartoonBonkEffect>(); if ((Object)(object)component5 != (Object)null && component5.TryUse()) { Net.ApplyStatus(component, StatusKind.Squash, 3f); } } if (num != 1f) { DevTools.Log($"damage {component.playerID}<-{(((Object)(object)attacker != (Object)null) ? attacker.playerID : (-1))} x{num:0.00} ({((Vector2)(ref damage)).magnitude:0.0} -> {((Vector2)(ref damage)).magnitude * num:0.0})"); } damage *= num; return true; } } public class DevTools : MonoBehaviour { public static ConfigEntry<bool> Enabled; private int next; private float nextPoll; public static string CommandFile => Path.Combine(Paths.ConfigPath, "brainrot-dev-commands.txt"); public static void Log(string msg) { if (Enabled != null && Enabled.Value) { BrainrotPlugin.Log.LogInfo((object)("[dev] " + msg)); } } private void PollCommands() { if (Time.unscaledTime < nextPoll) { return; } nextPoll = Time.unscaledTime + 0.5f; string[] array; try { if (!File.Exists(CommandFile)) { return; } array = File.ReadAllLines(CommandFile); if (array.Length == 0) { return; } File.WriteAllText(CommandFile, ""); } catch (Exception) { return; } string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string text = array2[i].Trim(); if (text.Length != 0) { try { Run(text); } catch (Exception ex2) { Log("command '" + text + "' failed: " + ex2.Message); } } } } private void Run(string line) { //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_049f: Unknown result type (might be due to invalid IL or missing references) //IL_04a6: Expected O, but got Unknown //IL_0510: Unknown result type (might be due to invalid IL or missing references) //IL_051c: Unknown result type (might be due to invalid IL or missing references) //IL_06a7: Unknown result type (might be due to invalid IL or missing references) string[] parts = line.Split(new char[1] { ' ' }, 3); List<Player> list = PlayerManager.instance?.players; switch (parts[0].ToLowerInvariant()) { case "give": { CardInfo val6 = ((IEnumerable<CardInfo>)Ours()).FirstOrDefault((Func<CardInfo, bool>)((CardInfo c) => string.Equals(c.cardName, parts[2], StringComparison.OrdinalIgnoreCase))); if ((Object)(object)val6 == (Object)null) { Log("no card named " + parts[2]); break; } Player val7 = list[int.Parse(parts[1])]; Cards.instance.AddCardToPlayer(val7, val6, false, "", 0f, 0f, true); Log($"gave {val6.cardName} to player {val7.playerID}"); break; } case "hit": { string[] array4 = ((parts.Length > 2) ? parts[2] : "").Split(new char[1] { ' ' }); float amount = ((array4.Length > 1) ? float.Parse(array4[1], CultureInfo.InvariantCulture) : 20f); Hit(int.Parse(parts[1]), int.Parse(array4[0]), amount); break; } case "tp": { string[] array = parts[2].Split(new char[1] { ' ' }); Player val = list[int.Parse(parts[1])]; CultureInfo invariantCulture = CultureInfo.InvariantCulture; Warp.To(val, new Vector2(float.Parse(array[0], invariantCulture), float.Parse(array[1], invariantCulture))); Log($"tp player {val.playerID} -> {((Component)val).transform.position}"); break; } case "block": { Player val9 = list[int.Parse(parts[1])]; val9.data.block.TryBlock(); Log($"player {val9.playerID} block, blocking={val9.data.block.IsBlocking()}"); break; } case "menu": { string text = line.Substring(5).Trim(); Button[] array5 = Object.FindObjectsOfType<Button>(); Button[] array6 = array5; foreach (Button val8 in array6) { if (((Behaviour)val8).isActiveAndEnabled) { TextMeshProUGUI componentInChildren = ((Component)val8).GetComponentInChildren<TextMeshProUGUI>(); object obj2; if (!((Object)(object)componentInChildren != (Object)null)) { Text componentInChildren2 = ((Component)val8).GetComponentInChildren<Text>(); obj2 = ((componentInChildren2 != null) ? componentInChildren2.text : null); } else { obj2 = ((TMP_Text)componentInChildren).text; } string text2 = (string)obj2; if (text2 != null && string.Equals(text2.Trim(), text, StringComparison.OrdinalIgnoreCase)) { ((UnityEvent)val8.onClick).Invoke(); Log("menu clicked " + text); return; } } } Log("menu: no button '" + text + "'. Visible: " + string.Join(" | ", array5.Where((Button b) => ((Behaviour)b).isActiveAndEnabled).Select(delegate(Button b) { TextMeshProUGUI componentInChildren3 = ((Component)b).GetComponentInChildren<TextMeshProUGUI>(); return (((componentInChildren3 != null) ? ((TMP_Text)componentInChildren3).text : null) ?? "?").Trim(); }))); break; } case "fakeblock": { string[] array3 = parts[2].Split(new char[1] { ' ' }); Player val3 = list[int.Parse(parts[1])]; Player val4 = list[int.Parse(array3[0])]; GameObject val5 = new GameObject("FakeBullet"); val5.SetActive(false); ProjectileHit obj = val5.AddComponent<ProjectileHit>(); obj.ownPlayer = val4; obj.damage = ((array3.Length > 1) ? float.Parse(array3[1], CultureInfo.InvariantCulture) : 30f); obj.dealDamageMultiplierr = 1f; float health = val4.data.health; val3.data.block.BlockProjectileAction?.Invoke(val5, Vector3.right, ((Component)val3).transform.position); Log($"fakeblock: shooter {val4.playerID} health {health:0.0} -> {val4.data.health:0.0}"); Object.Destroy((Object)(object)val5); break; } case "hover": { string[] array2 = parts[2].Split(new char[1] { ' ' }); Player val2 = list[int.Parse(parts[1])]; float num = float.Parse(array2[0], CultureInfo.InvariantCulture); ((MonoBehaviour)this).StartCoroutine(Hover(val2, num)); Log($"hover player {val2.playerID} for {num}s"); break; } case "clear": foreach (Player item in list) { Cards.instance.RemoveAllCardsFromPlayer(item, true); } Log("cleared all cards"); break; case "list": { foreach (Player item2 in list) { Log($"player {item2.playerID}: hp {item2.data.health:0}/{item2.data.maxHealth:0} speed {item2.data.stats.movementSpeed:0.00} " + $"dead {item2.data.dead} pos {((Component)item2).transform.position} cards: " + string.Join(", ", item2.data.currentCards.Select((CardInfo c) => c.cardName))); } break; } default: Log("unknown command " + line); break; } } private void Update() { if (!Enabled.Value) { return; } PollCommands(); if (Input.GetKeyDown((KeyCode)288)) { Move(1); } if (Input.GetKeyDown((KeyCode)287)) { Move(-1); } if (Input.GetKeyDown((KeyCode)290)) { Give(0); } if (Input.GetKeyDown((KeyCode)291)) { Give(1); } if (Input.GetKeyDown((KeyCode)293)) { foreach (Player player in PlayerManager.instance.players) { Cards.instance.RemoveAllCardsFromPlayer(player, true); } } if (Input.GetKeyDown((KeyCode)289)) { Hit(0, 1); } if (Input.GetKeyDown((KeyCode)286)) { Hit(1, 0); } if (!Input.GetKeyDown((KeyCode)292)) { return; } foreach (Player player2 in PlayerManager.instance.players) { Log($"player {player2.playerID}: " + string.Join(", ", player2.data.currentCards.Select((CardInfo c) => c.cardName))); } } private static List<CardInfo> Ours() { return (from c in CardManager.cards.Values select c.cardInfo into c where (Object)(object)c != (Object)null && (Object)(object)((Component)c).GetComponent<BrainrotCard>() != (Object)null orderby c.cardName select c).ToList(); } private void Move(int d) { List<CardInfo> list = Ours(); if (list.Count != 0) { next = ((next + d) % list.Count + list.Count) % list.Count; Log($"cursor: {next} {list[next].cardName}"); } } private static void Hit(int from, int to) { Hit(from, to, 20f); } private static void Hit(int from, int to, float amount) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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) List<Player> list = PlayerManager.instance?.players; if (list != null && list.Count >= 2) { Player val = list[from]; Player val2 = list[to]; float health = val2.data.health; ((Damagable)val2.data.healthHandler).CallTakeDamage(Vector2.right * amount, Vector2.op_Implicit(((Component)val2).transform.position), (GameObject)null, val, true); Log($"test hit {val.playerID}->{val2.playerID}: health {health:0.0} -> {val2.data.health:0.0}"); } } private static IEnumerator Hover(Player p, float secs) { Vector3 pos = ((Component)p).transform.position; float end = Time.time + secs; while (Time.time < end && (Object)(object)p != (Object)null && !p.data.dead) { ((Component)p).transform.position = pos; Warp.To(p, Vector2.op_Implicit(pos)); yield return (object)new WaitForFixedUpdate(); } } private void Give(int index) { List<Player> list = PlayerManager.instance?.players; if (list == null || list.Count <= index) { Log("no player " + index); return; } List<CardInfo> list2 = Ours(); if (list2.Count != 0) { CardInfo val = list2[next % list2.Count]; Cards.instance.AddCardToPlayer(list[index], val, false, "", 0f, 0f, true); Log($"gave {val.cardName} to player {list[index].playerID}"); } } } public static class Fight { public static readonly Dictionary<int, int> RoundsLost = new Dictionary<int, int>(); public static int Counter { get; private set; } public static float StartTime { get; private set; } = -9999f; public static bool Active { get; private set; } public static float Elapsed => Time.time - StartTime; public static event Action Started; public static event Action Ended; public static Random Rng(Player p, int salt) { return new Random(Counter * 7919 + p.playerID * 104729 + salt * 31 + 17); } internal static void Register() { GameModeManager.AddHook("GameStart", (Func<IGameModeHandler, IEnumerator>)OnGameStart); GameModeManager.AddHook("PointStart", (Func<IGameModeHandler, IEnumerator>)OnPointStart); GameModeManager.AddHook("PointEnd", (Func<IGameModeHandler, IEnumerator>)OnPointEnd); GameModeManager.AddHook("RoundEnd", (Func<IGameModeHandler, IEnumerator>)OnRoundEnd); } private static IEnumerator OnGameStart(IGameModeHandler gm) { Counter = 0; RoundsLost.Clear(); yield break; } private static IEnumerator OnPointStart(IGameModeHandler gm) { Counter++; StartTime = Time.time; Active = true; DevTools.Log($"fight {Counter} started"); SafeInvoke(Fight.Started); yield break; } private static IEnumerator OnPointEnd(IGameModeHandler gm) { Active = false; SafeInvoke(Fight.Ended); yield break; } private static IEnumerator OnRoundEnd(IGameModeHandler gm) { Active = false; int[] source = gm.GetRoundWinners() ?? new int[0]; foreach (Player player in PlayerManager.instance.players) { if (!source.Contains(player.teamID)) { RoundsLost.TryGetValue(player.playerID, out var value); RoundsLost[player.playerID] = value + 1; } } yield break; } private static void SafeInvoke(Action a) { if (a == null) { return; } Delegate[] invocationList = a.GetInvocationList(); for (int i = 0; i < invocationList.Length; i++) { Action action = (Action)invocationList[i]; try { action(); } catch (Exception ex) { BrainrotPlugin.Log.LogError((object)ex); } } } } public class Popup : MonoBehaviour { private float born; private float life; private TextMesh tm; private Color color; private Vector3 velocity = new Vector3(0f, 2.5f, 0f); private static Font font; public static void Show(Player p, string text, Color color, float life = 1.4f) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)p == (Object)null)) { Show(Vector2.op_Implicit(((Component)p).transform.position) + Vector2.up * 1.8f, text, color, life); } } public static void Show(Vector2 pos, string text, Color color, float life = 1.4f) { //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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)font == (Object)null) { font = Resources.GetBuiltinResource<Font>("Arial.ttf"); } GameObject val = new GameObject("BrainrotPopup"); val.transform.position = new Vector3(pos.x, pos.y, -5f); TextMesh val2 = val.AddComponent<TextMesh>(); val2.richText = false; val2.text = text; val2.font = font; val2.fontSize = 64; val2.characterSize = 0.08f; val2.anchor = (TextAnchor)4; val2.alignment = (TextAlignment)1; val2.fontStyle = (FontStyle)1; val2.color = color; ((Renderer)val.GetComponent<MeshRenderer>()).material = font.material; ((Renderer)val.GetComponent<MeshRenderer>()).sortingOrder = 500; Popup popup = val.AddComponent<Popup>(); popup.tm = val2; popup.color = color; popup.born = Time.time; popup.life = life; } private void Update() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) float num = (Time.time - born) / life; if (num >= 1f) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } Transform transform = ((Component)this).transform; transform.position += velocity * Time.deltaTime; velocity *= 1f - 2f * Time.deltaTime; float num2 = ((num < 0.1f) ? Mathf.Lerp(0.5f, 1.2f, num / 0.1f) : Mathf.Lerp(1.2f, 1f, (num - 0.1f) * 3f)); ((Component)this).transform.localScale = Vector3.one * num2; tm.color = new Color(color.r, color.g, color.b, 1f - Mathf.Clamp01((num - 0.7f) / 0.3f)); } } public static class Fx { private static Material lineMat; private static Sprite circle; public static Material LineMaterial { get { //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) //IL_0022: Expected O, but got Unknown //IL_0023: Expected O, but got Unknown if (!((Object)(object)lineMat != (Object)null)) { Material val = new Material(Shader.Find("Sprites/Default")); lineMat = val; return val; } return lineMat; } } public static Sprite Circle { get { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_00b6: 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_0031: 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_0079: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)circle != (Object)null) { return circle; } Texture2D val = new Texture2D(128, 128, (TextureFormat)4, false); for (int i = 0; i < 128; i++) { for (int j = 0; j < 128; j++) { float num = Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(64f, 64f)) / 64f; float num2 = Mathf.Clamp01((1f - num) * 4f); val.SetPixel(j, i, new Color(1f, 1f, 1f, num2)); } } val.Apply(); circle = Sprite.Create(val, new Rect(0f, 0f, 128f, 128f), new Vector2(0.5f, 0.5f), 128f); return circle; } } public static void Ring(Vector2 center, float radius, Color color) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_0031: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("BrainrotRing"); val.transform.position = new Vector3(center.x, center.y, -5f); val.AddComponent<Ring>().Init(radius, color); } } public class Ring : MonoBehaviour { private LineRenderer lr; private float radius; private float born; private Color color; private const int Segments = 48; private const float Life = 0.35f; public void Init(float radius, Color color) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) this.radius = radius; this.color = color; born = Time.time; lr = ((Component)this).gameObject.AddComponent<LineRenderer>(); ((Renderer)lr).material = Fx.LineMaterial; lr.positionCount = 49; lr.useWorldSpace = false; lr.widthMultiplier = 0.25f; ((Renderer)lr).sortingOrder = 400; } private void Update() { //IL_0076: 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_00d6: Unknown result type (might be due to invalid IL or missing references) float num = (Time.time - born) / 0.35f; if (num >= 1f) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } float num2 = Mathf.Lerp(0.2f, radius, Mathf.Sqrt(num)); for (int i = 0; i <= 48; i++) { float num3 = (float)i * (float)Math.PI * 2f / 48f; lr.SetPosition(i, new Vector3(Mathf.Cos(num3) * num2, Mathf.Sin(num3) * num2, 0f)); } Color val = default(Color); ((Color)(ref val))..ctor(color.r, color.g, color.b, color.a * (1f - num)); lr.startColor = val; lr.endColor = val; } } public class DarknessOverlay : MonoBehaviour { public Player target; private RectTransform hole; private Canvas canvas; private Image[] sides; private static Sprite holeSprite; public static DarknessOverlay Create(Player target) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown GameObject val = new GameObject("BrainrotCornMaze"); Object.DontDestroyOnLoad((Object)val); DarknessOverlay darknessOverlay = val.AddComponent<DarknessOverlay>(); darknessOverlay.target = target; darknessOverlay.Build(); return darknessOverlay; } private void Build() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_0065: 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_009f: Expected O, but got Unknown //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_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_0100: Unknown result type (might be due to invalid IL or missing references) canvas = ((Component)this).gameObject.AddComponent<Canvas>(); canvas.renderMode = (RenderMode)0; canvas.sortingOrder = 50; GameObject val = new GameObject("Hole"); val.transform.SetParent(((Component)this).transform, false); hole = val.AddComponent<RectTransform>(); Image obj = val.AddComponent<Image>(); obj.sprite = HoleSprite(); ((Graphic)obj).color = Color.black; ((Graphic)obj).raycastTarget = false; sides = (Image[])(object)new Image[4]; for (int i = 0; i < 4; i++) { GameObject val2 = new GameObject("Side" + i); val2.transform.SetParent(((Component)this).transform, false); sides[i] = val2.AddComponent<Image>(); ((Graphic)sides[i]).color = Color.black; ((Graphic)sides[i]).raycastTarget = false; RectTransform rectTransform = ((Graphic)sides[i]).rectTransform; Vector2 anchorMin = (rectTransform.anchorMax = Vector2.zero); rectTransform.anchorMin = anchorMin; rectTransform.pivot = Vector2.zero; } } private static Sprite HoleSprite() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_00b2: 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_0031: 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_0075: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)holeSprite != (Object)null) { return holeSprite; } Texture2D val = new Texture2D(256, 256, (TextureFormat)4, false); for (int i = 0; i < 256; i++) { for (int j = 0; j < 256; j++) { float num = Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(128f, 128f)) / 128f; val.SetPixel(j, i, new Color(0f, 0f, 0f, Mathf.Clamp01((num - 0.55f) / 0.45f))); } } val.Apply(); holeSprite = Sprite.Create(val, new Rect(0f, 0f, 256f, 256f), new Vector2(0.5f, 0.5f)); return holeSprite; } private void LateUpdate() { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0112: 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_013f: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) bool flag = (Object)(object)target != (Object)null && !target.data.dead && Fight.Active && (Object)(object)Camera.main != (Object)null; ((Behaviour)canvas).enabled = flag; if (flag) { float num = (float)Screen.height * 0.55f; Vector2 val = Vector2.op_Implicit(Camera.main.WorldToScreenPoint(((Component)target).transform.position)); RectTransform obj = hole; Vector2 anchorMin = (hole.anchorMax = Vector2.zero); obj.anchorMin = anchorMin; hole.sizeDelta = new Vector2(num, num); hole.anchoredPosition = val; float num2 = num / 2f; float num3 = Screen.width; float num4 = Screen.height; Place(sides[0], 0f, 0f, num3, Mathf.Max(0f, val.y - num2)); Place(sides[1], 0f, val.y + num2, num3, Mathf.Max(0f, num4 - (val.y + num2))); Place(sides[2], 0f, val.y - num2, Mathf.Max(0f, val.x - num2), num); Place(sides[3], val.x + num2, val.y - num2, Mathf.Max(0f, num3 - (val.x + num2)), num); } } private static void Place(Image img, float x, float y, float w, float h) { //IL_0008: 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) ((Graphic)img).rectTransform.anchoredPosition = new Vector2(x, y); ((Graphic)img).rectTransform.sizeDelta = new Vector2(w, h); } } public class Holder : MonoBehaviour { public Player player; public CharacterData data; private readonly Dictionary<string, int> cards = new Dictionary<string, int>(); public bool IsMine { get { if ((Object)(object)data != (Object)null && (Object)(object)data.view != (Object)null) { return data.view.IsMine; } return false; } } public bool Alive { get { if ((Object)(object)data != (Object)null && !data.dead) { return data.isPlaying; } return false; } } public static Holder Of(Player p) { if (!((Object)(object)p == (Object)null)) { return ExtensionMethods.GetOrAddComponent<Holder>(((Component)p).gameObject, false); } return null; } private void Awake() { player = ((Component)this).GetComponent<Player>(); data = ((Component)this).GetComponent<CharacterData>(); } public int Count(string id) { if (!cards.TryGetValue(id, out var value)) { return 0; } return value; } public bool Has(string id) { return Count(id) > 0; } public bool HasAny(string tag) { foreach (KeyValuePair<string, int> card in cards) { if (card.Value > 0 && CardTags.Has(card.Key, tag)) { return true; } } return false; } internal void Add(string id) { cards[id] = Count(id) + 1; } internal void Remove(string id) { cards[id] = Mathf.Max(0, Count(id) - 1); } } public static class CardTags { public const string Ohio = "Ohio"; public const string Florida = "Florida"; private static readonly Dictionary<string, HashSet<string>> tags = new Dictionary<string, HashSet<string>>(); public static void Set(string id, params string[] t) { tags[id] = new HashSet<string>(t); } public static bool Has(string id, string tag) { if (tags.TryGetValue(id, out var value)) { return value.Contains(tag); } return false; } } public static class Net { private static readonly Dictionary<int, int> meetingFight = new Dictionary<int, int>(); private static string Clip(string t) { if (!string.IsNullOrEmpty(t)) { if (t.Length <= 64) { return t; } return t.Substring(0, 64); } return ""; } public static void ApplyStatus(Player target, StatusKind kind, float duration) { NetworkingManager.RPC(typeof(Net), "RPC_Status", new object[3] { target.playerID, (int)kind, duration }); } [UnboundRPC] private static void RPC_Status(int playerID, int kind, float duration) { DevTools.Log("RPC_Status " + string.Join(", ", playerID, kind, duration)); Player val = Players.ById(playerID); if (!((Object)(object)val == (Object)null) && Enum.IsDefined(typeof(StatusKind), kind)) { Status.Of(val).Apply((StatusKind)kind, Mathf.Clamp(duration, 0f, 5f)); } } public static void Shove(Vector2 pos, float radius, float force, int sourceID, string text = null) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) NetworkingManager.RPC(typeof(Net), "RPC_Shove", new object[6] { pos.x, pos.y, radius, force, sourceID, text ?? "" }); } [UnboundRPC] private static void RPC_Shove(float x, float y, float radius, float force, int sourceID, string text) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) DevTools.Log("RPC_Shove " + string.Join(", ", x, y, radius, force, sourceID, text)); radius = Mathf.Clamp(radius, 0f, 12f); force = Mathf.Clamp(force, 0f, 6000f); text = Clip(text); Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(x, y); Fx.Ring(val, radius, new Color(1f, 0.9f, 0.4f, 0.8f)); Player val2 = Players.ById(sourceID); if (!string.IsNullOrEmpty(text) && (Object)(object)val2 != (Object)null) { Popup.Show(val2, text, new Color(1f, 0.9f, 0.4f)); } foreach (Player player in PlayerManager.instance.players) { if (player.playerID != sourceID && !player.data.dead && player.data.view.IsMine) { Vector2 val3 = Vector2.op_Implicit(((Component)player).transform.position) - val; if (!(((Vector2)(ref val3)).magnitude > radius)) { Vector2 val4 = ((((Vector2)(ref val3)).sqrMagnitude < 0.01f) ? Vector2.up : ((Vector2)(ref val3)).normalized); Vector2 val5 = val4 + Vector2.up * 0.35f; val4 = ((Vector2)(ref val5)).normalized; player.data.healthHandler.TakeForce(val4 * force, (ForceMode2D)1, true, false, 0.4f); } } } } public static void Heal(Player target, float fractionOfMax) { NetworkingManager.RPC(typeof(Net), "RPC_Heal", new object[2] { target.playerID, fractionOfMax }); } [UnboundRPC] private static void RPC_Heal(int playerID, float fraction) { DevTools.Log("RPC_Heal " + string.Join(", ", playerID, fraction)); Player val = Players.ById(playerID); if (!((Object)(object)val == (Object)null) && !val.data.dead && Holder.Of(val).Has("VineBoom")) { val.data.healthHandler.Heal(val.data.maxHealth * Mathf.Clamp(fraction, 0f, 0.25f)); } } public static void Say(Player p, string text, Color color) { //IL_0029: 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_0045: Unknown result type (might be due to invalid IL or missing references) NetworkingManager.RPC(typeof(Net), "RPC_Say", new object[5] { p.playerID, text, color.r, color.g, color.b }); } [UnboundRPC] private static void RPC_Say(int playerID, string text, float r, float g, float b) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) DevTools.Log("RPC_Say " + string.Join(", ", playerID, text, r, g, b)); Player val = Players.ById(playerID); if ((Object)(object)val != (Object)null) { Popup.Show(val, Clip(text), new Color(r, g, b)); } } public static void Meeting(Player caller) { NetworkingManager.RPC(typeof(Net), "RPC_Meeting", new object[1] { caller.playerID }); } [UnboundRPC] private static void RPC_Meeting(int playerID) { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) DevTools.Log("RPC_Meeting " + string.Join(", ", playerID)); Player val = Players.ById(playerID); if ((Object)(object)val == (Object)null || !Fight.Active || !Holder.Of(val).Has("EmergencyMeeting") || (meetingFight.TryGetValue(playerID, out var value) && value == Fight.Counter)) { return; } meetingFight[playerID] = Fight.Counter; Popup.Show(val, "EMERGENCY MEETING", new Color(1f, 0.25f, 0.25f), 2.5f); SpawnPoint[] spawnPoints = MapManager.instance.GetSpawnPoints(); if (spawnPoints != null && spawnPoints.Length >= PlayerManager.instance.players.Count) { foreach (Player player in PlayerManager.instance.players) { if (!player.data.dead && player.data.view.IsMine) { SpawnPoint val2 = spawnPoints[PlayerManager.instance.players.IndexOf(player)]; Warp.To(player, Vector2.op_Implicit(val2.localStartPos)); } } } if (!val.data.dead) { val.data.healthHandler.Heal(val.data.maxHealth * 0.3f); } } } public static class Players { public static Player ById(int id) { foreach (Player player in PlayerManager.instance.players) { if (player.playerID == id) { return player; } } return null; } } public static class Warp { public static void To(Player p, Vector2 pos) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) PlayerCollision component = ((Component)p).GetComponent<PlayerCollision>(); if (component != null) { component.IgnoreWallForFrames(2); } ((Component)p).transform.position = Vector2.op_Implicit(pos); Velocity.Set(p, Vector2.zero); } } public static class Velocity { private static readonly FieldInfo velField = AccessTools.Field(typeof(PlayerVelocity), "velocity"); public static Vector2 Get(Player p) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) return (Vector2)velField.GetValue(p.data.playerVel); } public static void Set(Player p, Vector2 v) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) velField.SetValue(p.data.playerVel, v); } } public class BulletTag : MonoBehaviour { public int initialReflects; public float bonus; public RayHitReflect reflect; public int Bounces { get { if (!((Object)(object)reflect == (Object)null)) { return Mathf.Max(0, initialReflects - reflect.reflects); } return 0; } } } [HarmonyPatch] internal static class Patches { internal static ProjectileHit CurrentBullet; [HarmonyPatch(typeof(ProjectileHit), "RPCA_DoHit")] [HarmonyPrefix] private static void DoHitPrefix(ProjectileHit __instance) { CurrentBullet = __instance; } [HarmonyPatch(typeof(ProjectileHit), "RPCA_DoHit")] [HarmonyPostfix] private static void DoHitPostfix(ProjectileHit __instance, Vector2 hitPoint, int viewID, int colliderID, bool wasBlocked) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) CurrentBullet = null; if (viewID != -1) { DevTools.Log($"bullet hit view {viewID} blocked={wasBlocked}"); } try { if (viewID == -1 && colliderID != -1 && (Object)(object)__instance.ownPlayer != (Object)null && Holder.Of(__instance.ownPlayer).Has("LakeErieFire")) { Puddle.Spawn(hitPoint, __instance.ownPlayer); } } catch (Exception ex) { BrainrotPlugin.Log.LogError((object)ex); } } [HarmonyPatch(typeof(HealthHandler), "RPCA_Die")] [HarmonyPrefix] private static void DiePrefix(HealthHandler __instance, out bool __state) { __state = !((Component)__instance).GetComponent<CharacterData>().dead; } [HarmonyPatch(typeof(HealthHandler), "RPCA_Die")] [HarmonyPostfix] private static void DiePostfix(HealthHandler __instance, bool __state) { OnDeath(__instance, __state); } [HarmonyPatch(typeof(HealthHandler), "RPCA_Die_Phoenix")] [HarmonyPrefix] private static void PhoenixPrefix(HealthHandler __instance, out bool __state) { __state = !((Component)__instance).GetComponent<CharacterData>().dead; } [HarmonyPatch(typeof(HealthHandler), "RPCA_Die_Phoenix")] [HarmonyPostfix] private static void PhoenixPostfix(HealthHandler __instance, bool __state) { OnDeath(__instance, __state); } private static void OnDeath(HealthHandler hh, bool wasAlive) { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) if (!wasAlive) { return; } DevTools.Log("death: player " + ((Component)hh).GetComponent<CharacterData>().player.playerID); try { CharacterData component = ((Component)hh).GetComponent<CharacterData>(); Player player = component.player; int num = Holder.Of(player).Count("FreeRealEstate"); if (num > 0) { GunAmmo componentInChildren = ((Component)component.weaponHandler.gun).GetComponentInChildren<GunAmmo>(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.maxAmmo = Mathf.Clamp(componentInChildren.maxAmmo + num, 1, 90); } component.maxHealth *= Mathf.Pow(1.05f, (float)num); Popup.Show(player, "it's free real estate", new Color(0.8f, 0.7f, 0.4f), 2f); } Player lastSourceOfDamage = component.lastSourceOfDamage; if ((Object)(object)lastSourceOfDamage != (Object)null && (Object)(object)lastSourceOfDamage != (Object)(object)player && !lastSourceOfDamage.data.dead && Holder.Of(lastSourceOfDamage).Has("VineBoom") && lastSourceOfDamage.data.view.IsMine) { Net.Shove(Vector2.op_Implicit(((Component)lastSourceOfDamage).transform.position), 10f, 3500f, lastSourceOfDamage.playerID, "*VINE BOOM*"); Net.Heal(lastSourceOfDamage, 0.25f); } } catch (Exception ex) { BrainrotPlugin.Log.LogError((object)ex); } } [HarmonyPatch(typeof(Player), "FullReset")] [HarmonyPrefix] private static void FullResetPrefix(Player __instance) { DynMult.ForgetAll(__instance); } [HarmonyPatch(typeof(GeneralInput), "Update")] [HarmonyPostfix] private static void InputPostfix(GeneralInput __instance) { //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) Status component = ((Component)__instance).GetComponent<Status>(); if ((Object)(object)component != (Object)null && component.Inverted) { __instance.direction = new Vector3(0f - __instance.direction.x, __instance.direction.y, __instance.direction.z); } } [HarmonyPatch(typeof(PlayerJump), "Jump")] [HarmonyPrefix] private static bool JumpPrefix(PlayerJump __instance, bool forceJump) { if (forceJump) { return true; } Status component = ((Component)__instance).GetComponent<Status>(); if (!((Object)(object)component == (Object)null)) { return !component.JumpLocked; } return true; } [HarmonyPatch(typeof(Gun), "Attack")] [HarmonyPrefix] private static bool AttackPrefix(Gun __instance, ref bool __result) { Player val = (((Object)(object)__instance.player != (Object)null) ? __instance.player : ((Component)__instance).GetComponentInParent<Player>()); if ((Object)(object)val != (Object)null && PublixSubEffect.InDeliLine(val)) { __result = false; return false; } return true; } } [HarmonyPatch] internal static class DamagePatch { [HarmonyPatch(typeof(HealthHandler), "CallTakeDamage")] [HarmonyPrefix] [HarmonyPriority(200)] private static bool CallTakeDamagePrefix(HealthHandler __instance, ref Vector2 damage, Player damagingPlayer) { try { return Damage.Modify(__instance, damagingPlayer, Patches.CurrentBullet, ref damage); } catch (Exception ex) { BrainrotPlugin.Log.LogError((object)ex); return true; } } } public enum StatusKind { Squash = 1, JumpLock, Inverted, SunMark, Emotional, SpeedUp } public class Status : MonoBehaviour { private Player player; private CharacterData data; public float squashUntil; public float jumpLockUntil; public float invertedUntil; public float sunMarkUntil; public int emotionalStacks; private int speedStacks; private float speedUntil; private DynMult moveMult; private bool squashedVisual; private static readonly string[] EmotionalLines = new string[7] { "EMOTIONAL DAMAGE", "skill issue", "ratio", "L + bozo", "touch grass", "cope", "who asked" }; private SpriteRenderer[] renderers; private bool tinted; public bool Squashed => Time.time < squashUntil; public bool JumpLocked => Time.time < jumpLockUntil; public bool Inverted => Time.time < invertedUntil; public bool SunMarked => Time.time < sunMarkUntil; public float OutgoingDamageMult => 1f - Mathf.Min(0.36f, 0.06f * (float)emotionalStacks); public static Status Of(Player p) { if (!((Object)(object)p == (Object)null)) { return ExtensionMethods.GetOrAddComponent<Status>(((Component)p).gameObject, false); } return null; } private void Awake() { player = ((Component)this).GetComponent<Player>(); data = ((Component)this).GetComponent<CharacterData>(); moveMult = new DynMult(player, () => data.stats.movementSpeed, delegate(float v) { data.stats.movementSpeed = v; }); Fight.Started += ResetAll; } private void OnDestroy() { Fight.Started -= ResetAll; moveMult.Reset(); } private void ResetAll() { squashUntil = (jumpLockUntil = (invertedUntil = (sunMarkUntil = (speedUntil = 0f)))); emotionalStacks = 0; speedStacks = 0; } public void Apply(StatusKind kind, float duration) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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) float num = Time.time + duration; switch (kind) { case StatusKind.Squash: squashUntil = num; Popup.Show(player, "BONK", new Color(1f, 0.85f, 0.2f)); break; case StatusKind.JumpLock: jumpLockUntil = num; Popup.Show(player, "DEATH ROLL", new Color(0.3f, 0.7f, 0.3f)); break; case StatusKind.Inverted: invertedUntil = num; Popup.Show(player, "ligma?", new Color(0.8f, 0.4f, 1f)); break; case StatusKind.SunMark: sunMarkUntil = num; break; case StatusKind.Emotional: emotionalStacks++; Popup.Show(player, EmotionalLines[Random.Range(0, EmotionalLines.Length)], new Color(0.6f, 0.8f, 1f)); break; case StatusKind.SpeedUp: speedStacks++; speedUntil = num; break; } } private void Update() { if (speedStacks > 0 && Time.time >= speedUntil) { speedStacks = 0; } float num = 1f; if (Squashed) { num *= 0.6f; } num *= 1f + 0.1f * (float)speedStacks; moveMult.Set(num); UpdateTint(); } private void LateUpdate() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_0033: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) if (Squashed) { Vector3 localScale = ((Component)this).transform.localScale; float num = Mathf.Abs(localScale.x); ((Component)this).transform.localScale = new Vector3(localScale.x, num * 0.5f, localScale.z); squashedVisual = true; } else if (squashedVisual) { Vector3 localScale2 = ((Component)this).transform.localScale; ((Component)this).transform.localScale = new Vector3(localScale2.x, Mathf.Abs(localScale2.x), localScale2.z); squashedVisual = false; } } private void UpdateTint() { //IL_0073: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) bool sunMarked = SunMarked; if (sunMarked == tinted) { return; } if (renderers == null) { renderers = ((Component)this).GetComponentsInChildren<SpriteRenderer>(true); } SpriteRenderer[] array = renderers; foreach (SpriteRenderer val in array) { if (!((Object)(object)val == (Object)null)) { val.color = (sunMarked ? new Color(1f, 0.45f, 0.35f, val.color.a) : new Color(1f, 1f, 1f, val.color.a)); } } tinted = sunMarked; } } public class DynMult { private readonly Func<float> get; private readonly Action<float> set; private float applied = 1f; private static readonly Dictionary<Player, List<WeakReference>> registry = new Dictionary<Player, List<WeakReference>>(); public float Current => applied; public DynMult(Player owner, Func<float> get, Action<float> set) { this.get = get; this.set = set; if (!((Object)(object)owner == (Object)null)) { if (!registry.TryGetValue(owner, out var value)) { value = (registry[owner] = new List<WeakReference>()); } value.RemoveAll((WeakReference w) => !w.IsAlive); value.Add(new WeakReference(this)); } } internal static void ForgetAll(Player owner) { if ((Object)(object)owner == (Object)null || !registry.TryGetValue(owner, out var value)) { return; } foreach (WeakReference item in value) { if (item.Target is DynMult dynMult) { dynMult.applied = 1f; } } } public void Set(float factor) { factor = Mathf.Max(0.05f, factor); if (!Mathf.Approximately(factor, applied)) { set(get() / applied * factor); applied = factor; } } public void Reset() { Set(1f); } } } namespace BrainrotCards.Effects { public class CornMazeEffect : CardEffect { private DarknessOverlay overlay; private void Start() { if (base.IsMine && !PhotonNetwork.OfflineMode) { overlay = DarknessOverlay.Create(player); } } protected override void OnDestroy() { base.OnDestroy(); if ((Object)(object)overlay != (Object)null) { Object.Destroy((Object)(object)((Component)overlay).gameObject); } } } public class HumidityEffect : CardEffect { private DynMult move; private DynMult reload; protected override void Awake() { base.Awake(); move = new DynMult(player, () => data.stats.movementSpeed, delegate(float v) { data.stats.movementSpeed = v; }); reload = new DynMult(player, () => gunAmmo.reloadTimeMultiplier, delegate(float v) { gunAmmo.reloadTimeMultiplier = v; }); } protected override void OnFightStart() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) Popup.Show(player, "it's so humid", new Color(0.5f, 0.8f, 0.6f), 1.5f); } private void Update() { float num = (Fight.Active ? (Mathf.Clamp01(Fight.Elapsed / 40f) * (float)holder.Count("Humidity")) : 0f); num = Mathf.Min(num, 1.5f); move.Set(Mathf.Max(0.1f, 1f - 0.4f * num)); reload.Set(1f + 0.4f * num); } protected override void OnDestroy() { base.OnDestroy(); move.Reset(); reload.Reset(); } } public class WindowsXPEffect : CardEffect { private float next; protected override void OnFightStart() { next = Fight.StartTime + 8f + 0.7f * (float)player.playerID; } private void Update() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) if (base.IsMine && base.Playing && !(Time.time < next)) { next = Time.time + 15f; data.stunHandler.AddStun(1f); Net.Say(player, "(Not Responding)", new Color(0.4f, 0.6f, 1f)); } } } public class LagSpikeEffect : CardEffect { private readonly Queue<(float t, Vector2 pos)> history = new Queue<(float, Vector2)>(); private float next; private int n; protected override void OnFightStart() { history.Clear(); n = 0; Schedule(); } private void Schedule() { Random random = Fight.Rng(player, 3300 + n++); next = Time.time + 6f + (float)random.NextDouble() * 4f; } private void FixedUpdate() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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) if (!base.IsMine || !base.Playing) { return; } history.Enqueue((Time.time, Vector2.op_Implicit(((Component)player).transform.position))); while (history.Count > 0 && history.Peek().t < Time.time - 1f) { (float, Vector2) tuple = history.Dequeue(); if (Time.time >= next) { Schedule(); Warp.To(player, tuple.Item2); Net.Say(player, "lag", new Color(1f, 0.3f, 0.3f)); history.Clear(); break; } } } } public class TouchGrassEffect : CardEffect { private float nextTick; private bool warned; private void Update() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) if (!base.IsMine || !base.Playing) { return; } if (data.isGrounded || data.sinceGrounded < 1f) { nextTick = 0f; warned = false; return; } if (!warned) { warned = true; Net.Say(player, "touch grass", new Color(0.4f, 0.9f, 0.3f)); } if (Time.time >= nextTick) { nextTick = Time.time + 1f; DevTools.Log($"touch grass burn: airborne {data.sinceGrounded:0.0}s"); Damage.Raw(player, data.maxHealth * 0.03f * (float)holder.Count("TouchGrass"), null); } } } public class FloridaManEffect : CardEffect { private static readonly string[] Good = new string[3] { "FLORIDA MAN WRESTLES GATOR, WINS", "FLORIDA MAN OUTRUNS POLICE ON A LAWNMOWER", "FLORIDA MAN BENCH PRESSES A MANATEE" }; private static readonly string[] Bad = new string[3] { "FLORIDA MAN LIGHTS FIREWORK INDOORS", "FLORIDA MAN MICROWAVES A FIRE EXTINGUISHER", "FLORIDA MAN HUGS A TRANSFORMER" }; private DynMult move; public static bool GoodRoll(Player p) { return Fight.Rng(p, 24).NextDouble() < 0.5; } protected override void Awake() { base.Awake(); move = new DynMult(player, () => data.stats.movementSpeed, delegate(float v) { data.stats.movementSpeed = v; }); } protected override void OnDestroy() { base.OnDestroy(); move.Reset(); } protected override void OnFightEnd() { move.Reset(); } protected override void OnFightStart() { ((MonoBehaviour)this).StartCoroutine(Headline()); } private IEnumerator Headline() { yield return (object)new WaitForSeconds(0.6f); if (!base.Playing) { yield break; } Random random = Fight.Rng(player, 240); if (GoodRoll(player)) { move.Set(1.5f); Popup.Show(player, Good[random.Next(Good.Length)], new Color(0.3f, 1f, 0.5f), 2.5f); yield break; } Popup.Show(player, Bad[random.Next(Bad.Length)], new Color(1f, 0.4f, 0.2f), 2.5f); if (base.IsMine) { Damage.Raw(player, data.maxHealth * 0.5f, null); Net.Shove(Vector2.op_Implicit(((Component)player).transform.position), 7f, 3500f, player.playerID, "BOOM"); } } } public class HurricaneEffect : CardEffect { private float nextGust; private int gustIndex; protected override void OnFightStart() { gustIndex = 0; nextGust = Fight.StartTime + 8f + 0.5f * (float)player.playerID; } private void Update() { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0117: 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_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) if (!Fight.Active || Time.time < nextGust) { return; } nextGust += 8f; gustIndex++; float num = (float)Fight.Rng(player, 2600 + gustIndex).NextDouble() * (float)Math.PI * 2f; Vector2 val = new Vector2(Mathf.Cos(num), Mathf.Sin(num) * 0.5f); Vector2 normalized = ((Vector2)(ref val)).normalized; float num2 = holder.Count("HurricaneSeason"); Popup.Show(player, (normalized.x >= 0f) ? "HURRICANE >>>" : "<<< HURRICANE", new Color(0.6f, 0.85f, 1f), 1.6f); foreach (Player player in PlayerManager.instance.players) { if (!player.data.dead && player.data.view.IsMine) { player.data.healthHandler.TakeForce(normalized * 3000f * num2, (ForceMode2D)1, true, true, 0.3f); } } MoveTransform[] array = Object.FindObjectsOfType<MoveTransform>(); foreach (MoveTransform obj in array) { obj.velocity += Vector2.op_Implicit(normalized * 25f * num2); } } } public class BathSaltsEffect : CardEffect { protected override void Awake() { base.Awake(); CharacterStatModifiers stats = data.stats; stats.WasDealtDamageAction = (Action<Vector2, bool>)Delegate.Combine(stats.WasDealtDamageAction, new Action<Vector2, bool>(OnHit)); } protected override void OnDestroy() { base.OnDestroy(); CharacterStatModifiers stats = data.stats; stats.WasDealtDamageAction = (Action<Vector2, bool>)Delegate.Remove(stats.WasDealtDamageAction, new Action<Vector2, bool>(OnHit)); } private void OnHit(Vector2 dmg, bool selfDamage) { if (!selfDamage && base.Playing) { Status.Of(player).Apply(StatusKind.SpeedUp, 3f); } } } public class PublixSubEffect : CardEffect { public const float Seconds = 2f; public static bool InDeliLine(Player p) { if (Fight.Active && Fight.Elapsed < 2f) { return Holder.Of(p).Has("PublixSub"); } return false; } protected override void OnFightStart() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) Popup.Show(player, "deli line...", new Color(0.4f, 0.8f, 0.4f), 2f); } } public class SkibidiEffect : CardEffect { private float lastDir; private float cooldownUntil; private void Update() { //IL_00ad: 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) if (!base.IsMine || !base.Playing || (Object)(object)data.input == (Object)null) { return; } float x = data.input.direction.x; float num = ((Mathf.Abs(x) > 0.5f) ? Mathf.Sign(x) : 0f); if (num != 0f && lastDir != 0f && num != lastDir && data.isGrounded && Time.time > cooldownUntil) { data.healthHandler.TakeForce(new Vector2(num * 2200f, 300f), (ForceMode2D)1, true, false, 0f); cooldownUntil = Time.time + 0.7f; if (Random.value < 0.35f) { Net.Say(player, "dop dop yes yes", new Color(1f, 0.9f, 0.3f)); } } if (num != 0f) { lastDir = num; } } } public class BigChungusEffect : CardEffect { private int hits; private DynMult size; private DynMult maxHp; private static readonly MethodInfo configure = AccessTools.Method(typeof(CharacterStatModifiers), "ConfigureMassAndSize", (Type[])null, (Type[])null); protected override void Awake() { base.Awake(); size = new DynMult(player, () => data.stats.sizeMultiplier, delegate(float v) { data.stats.sizeMultiplier = v; }); maxHp = new DynMult(player, () => data.maxHealth, delegate(float v) { data.maxHealth = v; }); CharacterStatModifiers stats = data.stats; stats.WasDealtDamageAction = (Action<Vector2, bool>)Delegate.Combine(stats.WasDealtDamageAction, new Action<Vector2, bool>(OnHit)); } protected override void OnDestroy() { base.OnDestroy(); CharacterStatModifiers stats = data.stats; stats.WasDealtDamageAction = (Action<Vector2, bool>)Delegate.Remove(stats.WasDealtDamageAction, new Action<Vector2, bool>(OnHit)); Apply(0); } private void OnHit(Vector2 dmg, bool selfDamage) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) if (!selfDamage && base.Playing && hits < 10) { Apply(hits + holder.Count("BigChungus")); if (hits == 5) { Popup.Show(player, "BIG CHUNGUS", new Color(0.7f, 0.6f, 0.5f)); } } } protected override void OnFightStart() { Apply(0); } private void Apply(int n) { hits = Mathf.Min(n, 10); size.Set(1f + 0.06f * (float)hits); maxHp.Set(1f + 0.06f * (float)hits); configure?.Invoke(data.stats, null); if (data.health > data.maxHealth) { data.health = data.maxHealth; } } } public class DogeEffect : CardEffect { private static readonly string[] Lines = new string[5] { "wow", "much jump", "very air", "such shove", "so doge" }; protected override void Awake() { base.Awake(); PlayerJump jump = data.jump; jump.JumpAction = (Action)Delegate.Combine(jump.JumpAction, new Action(OnJump)); } protected override void OnDestroy() { base.OnDestroy(); PlayerJump jump = data.jump; jump.JumpAction = (Action)Delegate.Remove(jump.JumpAction, new Action(OnJump)); } private void OnJump() { //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) if (base.IsMine && base.Playing && !data.isGrounded && !(data.sinceGrounded < 0.1f)) { Net.Shove(Vector2.op_Implicit(((Component)player).transform.position), 4.5f, 2500f * (float)holder.Count("Doge"), player.playerID, Lines[Random.Range(0, Lines.Length)]); } } } public class SigmaEffect : CardEffect { private float lastBlock; public float DamageMult { get { float num = Time.time - Mathf.Max(lastBlock, Fight.StartTime); return 1f + Mathf.Min(0.45f, 0.03f * num) * (float)holder.Count("SigmaGrindset"); } } protected override void Awake() { base.Awake(); Block block = data.block; block.BlockAction = (Action<BlockTriggerType>)Delegate.Combine(block.BlockAction, new Action<BlockTriggerType>(OnBlock)); } protected override void OnDestroy() { base.OnDestroy(); Block block = data.block; block.BlockAction = (Action<BlockTriggerType>)Delegate.Remove(block.BlockAction, new Action<BlockTriggerType>(OnBlock)); } private void OnBlock(BlockTriggerType t) { lastBlock = Time.time; } } public class LeeroyEffect : CardEffect { private DynMult move; protected override void Awake() { base.Awake(); move = new DynMult(player, () => data.stats.movementSpeed, delegate(float v) { data.stats.movementSpeed = v; }); } protected override void OnDestroy() { base.OnDestroy(); move.Reset(); } protected override void OnFightStart() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) Popup.Show(player, "LEEROOOY JENKINS", new Color(1f, 0.3f, 0.2f), 2f); } private void Update() { move.Set((Fight.Active && Fight.Elapsed < 3f) ? 2f : 1f); } } public class RickrollEffect : CardEffect { protected override void Awake() { base.Awake(); Block block = data.block; block.BlockProjectileAction = (Action<GameObject, Vector3, Vector3>)Delegate.Combine(block.BlockProjectileAction, new Action<GameObject, Vector3, Vector3>(OnBlocked)); } protected override void OnDestroy() { base.OnDestroy(); Block block = data.block; block.BlockProjectileAction = (Action<GameObject, Vector3, Vector3>)Delegate.Remove(block.BlockProjectileAction, new Action<GameObject, Vector3, Vector3>(OnBlocked)); } private void OnBlocked(GameObject projectile, Vector3 forward, Vector3 hitPos) { //IL_00cc: Unknown result type (might be due to invalid IL or missing references) DevTools.Log($"rickroll: player {player.playerID} blocked a projectile (mine={base.IsMine})"); if (base.IsMine && !((Object)(object)projectile == (Object)null)) { ProjectileHit component = projectile.GetComponent<ProjectileHit>(); if (!((Object)(object)component == (Object)null) && !((Object)(object)component.ownPlayer == (Object)null) && !((Object)(object)component.ownPlayer == (Object)(object)player) && !component.ownPlayer.data.dead) { float amount = component.damage * component.dealDamageMultiplierr * (float)holder.Count("Rickroll"); Damage.Raw(component.ownPlayer, amount, player); Net.Say(component.ownPlayer, "never gonna give you up", new Color(1f, 0.5f, 0.8f)); } } } } public class CartoonBonkEffect : CardEffect { private bool used; protected override void OnFightStart() { used = false; } public bool TryUse() { if (used) { return false; } used = true; return true; } } public class MitochondriaEffect : CardEffect { private float lastShot; private float chargeThisFrame; private int chargeFrame = -1; protected override void Awake() { base.Awake(); Gun obj = gun; obj.ShootPojectileAction = (Action<GameObject>)Delegate.Combine(obj.ShootPojectileAction, new Action<GameObject>(OnShoot)); } protected override void OnDestroy() { base.OnDestroy(); Gun obj = gun; obj.ShootPojectileAction = (Action<GameObject>)Delegate.Remove(obj.ShootPojectileAction, new Action<GameObject>(OnShoot)); } protected override void OnFightStart() { lastShot = Time.time; } private void OnShoot(GameObject bullet) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) if (chargeFrame != Time.frameCount) { chargeFrame = Time.frameCount; chargeThisFrame = Mathf.Min(1f, 0.2f * (Time.time - Mathf.Max(lastShot, Fight.StartTime))); lastShot = Time.time; if (chargeThisFrame >= 1f) { Popup.Show(player, "ATP", new Color(0.4f, 1f, 0.4f), 0.8f); } } BulletTagger.Tag(bullet).bonus = chargeThisFrame; } } public class EmergencyMeetingEffect : CardEffect { private bool used; protected override void OnFightStart() { used = false; } private void Update() { if (!used && base.IsMine && base.Playing && data.health > 0f && data.health < data.maxHealth * 0.25f) { used = true; Net.Meeting(player); } } } public class SpeedrunEffect : CardEffect { private bool killed; private int lastCountdown; protected override void OnFightStart() { killed = false; lastCountdown = 0; } private void Update() { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) if (!base.Playing || killed) { return; } float num = 30f - Fight.Elapsed; int num2 = Mathf.CeilToInt(num); if (num2 <= 5 && num2 >= 1 && num2 != lastCountdown) { lastCountdown = num2; Popup.Show(player, num2.ToString(), new Color(1f, 0.3f, 0.3f), 0.9f); } if (num <= 0f) { killed = true; if (base.IsMine) { Net.Say(player, "WR? no. any% reset", new Color(1f, 0.3f, 0.3f)); string text = ((data.stats.remainingRespawns > 0) ? "RPCA_Die_Phoenix" : "RPCA_Die"); data.view.RPC(text, (RpcTarget)0, new object[1] { Vector2.up }); } } } } public static class BulletTagger { public static BulletTag Tag(GameObject bullet) { BulletTag component = bullet.GetComponent<BulletTag>(); if ((Object)(object)component != (Object)null) { return component; } component = bullet.AddComponent<BulletTag>(); component.reflect = bullet.GetComponentInChildren<RayHitReflect>(); component.initialReflects = (((Object)(object)component.reflect != (Object)null) ? component.reflect.reflects : 0); return component; } } public class OhioBossEffect : CardEffect { protected override void Awake() { base.Awake(); Gun obj = gun; obj.ShootPojectileAction = (Action<GameObject>)Delegate.Combine(obj.ShootPojectileAction, new Action<GameObject>(OnShoot)); } protected override void OnDestroy() { base.OnDestroy(); Gun obj = gun; obj.ShootPojectileAction = (Action<GameObject>)Delegate.Remove(obj.ShootPojectileAction, new Action<GameObject>(OnShoot)); } private void OnShoot(GameObject bullet) { BulletTagger.Tag(bullet); } } public class OnlyInOhioEffect : CardEffect { private struct Knob { public string name; public bool inverse; public Func<CardEffect, DynMult> make; } private readonly List<DynMult> active = new List<DynMult>(); private List<Knob> Knobs() { return new List<Knob> { new Knob { name = "DAMAGE", make = (CardEffect e) => new DynMult(player, () => gun.damage, delegate(float v) { gun.damage = v; }) }, new Knob { name = "MOVE SPEED", make = (CardEffect e) => new DynMult(player, () => data.stats.movementSpeed, delegate(float v) { data.stats.movementSpeed = v; }) }, new Knob { name = "JUMP", make = (CardEffect e) => new DynMult(player, () => data.stats.jump, delegate(float v) { data.stats.jump = v; }) }, new Knob { name = "BULLET SPEED", make = (CardEffect e) => new DynMult(player, () => gun.projectileSpeed, delegate(float v) { gun.projectileSpeed = v; }) }, new Knob { name = "ATTACK SPEED", inverse = true, make = (CardEffect e) => new DynMult(player, () => gun.attackSpeed, delegate(float v) { gun.attackSpeed = v; }) }, new Knob { name = "RELOAD SPEED", inverse = true, make = (CardEffect e) => new DynMult(player, () => gunAmmo.reloadTimeMultiplier, delegate(float v) { gunAmmo.reloadTimeMultiplier = v; }) } }; } protected override void OnFightStart() { //IL_00af: Unknown result type (might be due to invalid IL or missing references) Clear(); List<Knob> list = Knobs(); Random random = Fight.Rng(player, 18); int num = random.Next(list.Count); int num2 = random.Next(list.Count - 1); if (num2 >= num) { num2++; } Apply(list[num], good: true); Apply(list[num2], good: false); Popup.Show(player, "Only in Ohio: " + list[num].name + " x2, " + list[num2].name + " x0.5", new Color(0.9f, 0.5f, 1f), 2.5f); } private void Apply(Knob k, bool good) { DynMult dynMult = k.make(this); float num = (good ? 2f : 0.5f); if (k.inverse) { num = 1f / num; } dynMult.Set(num); active.Add(dynMult); } private void Clear() { foreach (DynMult item in active) { item.Reset(); } active.Clear(); } protected override void OnFightEnd() { Clear(); } protected override void OnDestroy() { base.OnDestroy(); Clear(); } } public class SkylineChiliEffect : CardEffect { protected override void Awake() { base.Awake(); PlayerJump jump = data.jump; jump.JumpAction = (Action)Delegate.Combine(jump.JumpAction, new Action(OnJump)); } protected override void OnDestroy() { base.OnDestroy(); PlayerJump jump = data.jump; jump.JumpAction = (Action)Delegate.Remove(jump.JumpAction, new Action(OnJump)); } private void OnJump() { //IL_0066: Unknown result type (might be due to invalid IL or missing references) if (base.IsMine && base.Playing) { Damage.Raw(player, data.maxHealth * 0.01f * (float)holder.Count("SkylineChili"), null); if (Random.value < 0.15f) { Net.Say(player, "heartburn", new Color(1f, 0.5f, 0.2f)); } } } } public class CedarPointEffect : CardEffect { private enum Phase { Idle, Rising, Hanging, Slamming } private Phase phase; private float hangUntil; protected override void Awake() { base.Awake(); PlayerJump jump = data.jump; jump.JumpAction = (Action)Delegate.Combine(jump.JumpAction, new Action(OnJump)); } protected override void OnDestroy() { base.OnDestroy(); PlayerJump jump = data.jump; jump.JumpAction = (Action)Delegate.Remove(jump.JumpAction, new Action(OnJump)); } protected override void OnFightStart() { phase = Phase.Idle; } private void OnJump() { if (base.IsMine && base.Playing && phase == Phase.Idle) { phase = Phase.Rising; } } private void FixedUpdate() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) if (!base.IsMine || !base.Playing) { phase = Phase.Idle; return; } Vector2 val = Velocity.Get(player); switch (phase) { case Phase.Rising: if (data.isGrounded && data.sinceGrounded <= 0f) { phase = Phase.Idle; } else if (val.y <= 0f) { phase = Phase.Hanging; hangUntil = Time.time + 0.4f; } break; case Phase.Hanging: Velocity.Set(player, new Vector2(val.x * 0.5f, 0f)); if (Time.time >= hangUntil) { phase = Phase.Slamming; Velocity.Set(player, new Vector2(0f, -60f)); } break; case Phase.Slamming: if (data.isGrounded) { phase = Phase.Idle; Net.Shove(Vector2.op_Implicit(((Component)player).transform.position), 6f, 3000f, player.playerID, "CEDAR POINT!"); } break; } } private void LateUpdate() { //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) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (phase == Phase.Hanging && base.IsMine) { Vector2 val = Velocity.Get(player); Velocity.Set(player, new Vector2(val.x, 0f)); } } } public class ClevelandEffect : CardEffect { private static readonly string[] Lines = new string[4] { "next year bro", "we're so back", "trust the process", "it's our year (it's not)" }; protected override void OnFightStart() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) Fight.RoundsLost.TryGetValue(player.playerID, out var value); if (value > 0) { Popup.Show(player, $"Brady: \"{Lines[value % Lines.Length]}\" (+{12 * value}%)", new Color(1f, 0.55f, 0.2f), 2.2f); } } } public class Puddle : MonoBehaviour { private const float Life = 3f; private const float Radius = 1.6f; private const float TickEvery = 0.5f; private const float DamagePerTick = 6f; private static int alive; private static readonly Dictionary<int, float> lastBurn = new Dictionary<int, float>(); private Player owner; private float born; private float nextTick; private SpriteRenderer sr; public static void Spawn(Vector2 pos, Player owner) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) if (alive < 40) { DevTools.Log($"puddle at {pos}"); GameObject val = new GameObject("LakeEriePuddle"); val.transform.position = new Vector3(pos.x, pos.y, -1f); val.transform.localScale = new Vector3(3.2f, 1.2800001f, 1f); Puddle puddle = val.AddComponent<Puddle>(); puddle.owner = owner; puddle.born = Time.time; puddle.nextTick = Time.time + 0.5f; puddle.sr = val.AddComponent<SpriteRenderer>(); puddle.sr.sprite = Fx.Circle; ((Renderer)puddle.sr).sortingOrder = 300; alive++; } } private void OnDestroy() { alive--; } private void Update() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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) float num = (Time.time - born) / 3f; if (num >= 1f || !Fight.Active) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } float num2 = 0.85f + 0.15f * Mathf.Sin(Time.time * 25f + born); sr.color = new Color(1f, 0.45f * num2, 0.05f, 0.75f * (1f - num * num)); if (Time.time < nextTick) { return; } nextTick += 0.5f; foreach (Player player in PlayerManager.instance.players) { if (!player.data.dead && player.data.view.IsMine) { Vector2 val = Vector2.op_Implicit(((Component)player).transform.position - ((Component)this).transform.position); if (!(Mathf.Abs(val.x) >= 1.6f) && !(Mathf.Abs(val.y) >= 1.5f) && (!lastBurn.TryGetValue(player.playerID, out var value) || !(Time.time - value < 0.45f))) { lastBurn[player.playerID] = Time.time; Damage.Raw(player, 6f, owner); } } } } } public abstract class CardEffect : MonoBehaviour { protected Player player; protected CharacterData data; protected Holder holder; protected Gun gun; protected GunAmmo gunAmmo; protected bool IsMine => holder.IsMine; protected bool Playing { get { if (Fight.Active && data.isPlaying) { return !data.dead; } return false; } } protected virtual void Awake() { player = ((Component)this).GetComponent<Player>(); data = ((Component)this).GetComponent<CharacterData>(); holder = Holder.Of(player); gun = data.weaponHandler.gun; gunAmmo = ((Component)gun).GetComponentInChildren<GunAmmo>(); Fight.Started += OnFightStart; Fight.Ended += OnFightEnd; } protected virtual void OnDestroy() { Fight.Started -= OnFightStart; Fight.Ended -= OnFightEnd; } protected virtual void OnFightStart() { } protected virtual void OnFightEnd() { } } } namespace BrainrotCards.Cards { public abstract class BrainrotCurse : BrainrotCard { public static readonly List<CardInfo> All = new List<CardInfo>(); protected override Rarity GetRarity() { return (Rarity)0; } protected override CardThemeColorType GetTheme() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return CurseThemes.CorruptedRed; } protected override void Setup(CardInfo c, Gun gun, ApplyCardStats s, CharacterStatModifiers st, Block b) { c.categories = (CardCategory[])(object)new CardCategory[1] { CurseManager.instance.curseCategory }; CardInfoExtension.GetAdditionalData(c).canBeReassigned = false; } public static void Register(CardInfo card) { All.Add(card); CurseManager.instance.RegisterCurse(card); } } public class CornMaze : BrainrotCurse { protected override string[] Tags => new string[1] { "OhioCurse" }; protected override Type EffectType => typeof(CornMazeEffect); protected override string GetTitle() { return "Corn Maze"; } protected override string GetDescription() { return "Brady has been lost in here since 2019. You can only see a small circle around yourself."; } protected override CardInfoStat[] GetStats() { return (CardInfoStat[])(object)new CardInfoStat[1] { BrainrotCard.Stat(positive: false, "Vision", "Tiny") }; } } public class Humidity : BrainrotCurse { protected override string[] Tags => new string[1] { "FloridaCurse" }; protected override Type EffectType => typeof(HumidityEffect); protected override string GetTitle() { return "Humidity"; } protected override string GetDescription() { return "It's not the heat. The longer the round goes, the slower you move and reload."; } protected override CardInfoStat[] GetStats() { return (CardInfoStat[])(object)new CardInfoStat[2] { BrainrotCard.Stat(positive: false, "Speed over time", "-40%"), BrainrotCard.Stat(positive: false, "Reload over time", "+40%") }; } } public class WindowsXP : BrainrotCurse { protected override Type EffectType => typeof(WindowsXPEffect); protected override string GetTitle() { return "Windows XP Shutdown"; } protected override string GetDescription() { return "(Not Responding). Every 15 seconds you freeze completely for 1 second."; } protected override CardInfoStat[] GetStats() { return (CardInfoStat[])(object)new CardInfoStat[1] { BrainrotCard.Stat(positive: false, "Freeze every 15s", "1s") }; } } public class LagSpike : BrainrotCurse { protected override Type EffectType => typeof(LagSpikeEffect); protected override string GetTitle() { return "Lag Spike"; } protected override string GetDescription() { return "Your wifi is from 2009. Every few seconds you snap back to where you were a second ago."; } protected override CardInfoStat[] GetStats() { return (CardInfoStat[])(object)new CardInfoStat[1] { BrainrotCard.Stat(positive: false, "Rubber-band", "6-10s") }; } } public class TouchGrass : BrainrotCurse { protected override Type EffectType => typeof(TouchGrassEffect); protected override string GetTitle() { return "Touch Grass"; } protected override string GetDescription() { return "Go outside. After 1 second in the air you lose 3% health every second until you land."; } protected override CardInfoStat[] GetStats() { return (CardInfoStat[])(object)new CardInfoStat[1] { BrainrotCard.Stat(positive: false, "Air damage", "3%/s") }; } } public abstract class TeamCard : BrainrotCard { protected override Rarity GetRarity() { return (Rarity)2; } protected override void Added(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data) { ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)Unbound.Instance, 20, (Action)delegate { foreach (Player item in PlayerManager.instance.players.Where((Player p) => p.teamID != player.teamID).ToList()) { if (BrainrotCurse.All.Count == 0) { break; } CurseManager.instance.CursePlayer(item, (Action<CardInfo>)null, (Func<CardInfo, Player, bool>)((CardInfo card, Player p) => BrainrotCurse.All.Any((CardInfo c) => c.cardName == card.cardName))); } }); } } public class TeamOhio : TeamCard { protected override string[] Tags => new string[1] { "Ohio" }; protected override string GetTitle() { return "Team Ohio"; } protected override string GetDescription() { return "Brady's squad. +25% damage against anyone holding a Florida card. Every enemy gets a Brainrot curse."; } protected override CardThemeColorType GetTheme() { return (CardThemeColorType)0; } protected override CardInfoStat[] GetStats() { return (CardInfoStat[])(object)new CardInfoStat[2] { BrainrotCard.Stat(positive: true, "Dmg vs Florida", "+25%"), BrainrotCard.Stat(positive: true, "Curse enemies", "Yes") }; } } public class TeamFlorida : TeamCard { protected override string[] Tags => new string[1] { "Florida" }; protected override string GetTitle() { return "Team Florida"; } protected override string GetDescription() { return "Gator gang. +25% damage against anyone holding an Ohio card. Every enemy gets a Brainrot curse."; } protected override CardThemeColorType GetTheme() { return (CardThemeColorType)7; } protected override CardInfoStat[] GetStats() { return (CardInfoStat[])(object)new CardInfoStat[2] { BrainrotCard.Stat(positive: true, "Dmg vs Ohio", "+25%"), BrainrotCard.Stat(positive: true, "Curse enemies", "Yes") }; } } public class FloridaMan : BrainrotCard { protected override string[] Tags => new string[1] { "Florida" }; protected override Type EffectType => typeof(FloridaManEffect); protected override string GetTitle() { return "Florida Man"; } protected override string GetDescription() { return "Every round is a new headline. Coin flip: +100% damage and +50% speed, OR you blow up at the start."; } protected override Rarity GetRarity() { return (Rarity)2; } protected override CardThemeColorType GetTheme() { return (CardThemeColorType)0; } protected override CardInfoStat[] GetStats() { return (CardInfoStat[])(object)new CardInfoStat[2] { BrainrotCard.Stat(positive: true, "+100% dmg, +50% speed", "Heads"), BrainrotCard.Stat(positive: false, "Explode", "Tails") }; } } public class GatorBite : BrainrotCard { protected override string[] Tags => new string[1] { "Florida" }; protected override string GetTitle() { return "Gator Bite"; } protected override string GetDescription() { return "Close-range hits bite 50% harder and death-roll the target: no jumping for 1.5 seconds."; } protected override Rarity GetRarity() { return (Rarity)1; } protected override CardThemeColorType GetTheme() { return (CardThemeColorType)6; } protected override void Setup(CardInfo c, Gun gun, ApplyCardStats s, CharacterStatModifiers st, Block b) { gun.projectileSpeed = 0.8f; } protected override CardInfoStat[] GetStats() { return (CardInfoStat[])(object)new CardInfoStat[3] { BrainrotCard.Stat(positive: true, "Close-range dmg", "+50%"), BrainrotCard.Stat(positive: true, "No jump on hit", "1.5s"), BrainrotCard.Stat(positive: false, "Bullet speed", "-20%") }; } } public class HurricaneSeason : BrainrotCard { protected override string[] Tags => new string[1] { "Florida" }; protected override Type EffectType => typeof(HurricaneEffect); protected override string GetTitle() { return "Hurricane Season"; } protected override string GetDescription() { return "Every 8 seconds a gust of wind shoves every player and every bullet the same way. Including you."; } protected override Rarity GetRarity() { return (Rarity)2; } protected override CardThemeColorType GetTheme() { return (CardThemeColorType)7; } protected override CardInfoStat[] GetStats() { return (CardInfoStat[])(object)new CardInfoStat[2] { BrainrotCard.Stat(positive: true, "Wind gust every", "8s"), BrainrotCard.Stat(positive: false, "Hits you too", "Yes") }; } } public class BathSalts : BrainrotCard { protected override string[] Tags => new string[1] { "Florida" }; protected override Type EffectType => typeof(BathSaltsEffect); protected overr