Decompiled source of BFRM v1.21.4
bellusfennec-BFRM.dll
Decompiled 19 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.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using CardChoiceSpawnUniqueCardPatch.CustomCategories; using CardThemeLib; using CooldownUILib; using HarmonyLib; using Jotunn.Utils; using Microsoft.CodeAnalysis; using ModdingUtils.Extensions; using ModdingUtils.Utils; using MrFuntikMod.Cards; using MrFuntikMod.Effects; using MrFuntikMod.Extensions; using MrFuntikMod.Patches; using Photon.Pun; using RarityLib.Utils; using UnboundLib; using UnboundLib.Cards; using UnboundLib.GameModes; using UnboundLib.Networking; using UnboundLib.Utils; using UnityEngine; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("bellusfennec-BFRM")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+2ef4e33de08931cd6c7ca281f1859aa50ef03a65")] [assembly: AssemblyProduct("bellusfennec-BFRM")] [assembly: AssemblyTitle("bellusfennec-BFRM")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace MrFuntikMod { public static class Assets { private static AssetBundle _bfrmBundle; public static void Init() { _bfrmBundle = AssetUtils.LoadAssetBundleFromResources("bfrm", typeof(MrFuntikMod).Assembly); if ((Object)(object)_bfrmBundle == (Object)null) { Debug.LogWarning((object)"[MFM] Failed to load 'bfrm' bundle"); } } } [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.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.bellusfennec.rounds.mod", "BFRM", "1.21.1")] [BepInProcess("Rounds.exe")] public class MrFuntikMod : BaseUnityPlugin { [CompilerGenerated] private sealed class <GameStart>d__21 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public IGameModeHandler gm; public MrFuntikMod <>4__this; private List<Player>.Enumerator <>s__1; private Player <player>5__2; private GravitySurgeMono <gravitySurge>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <GameStart>d__21(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>s__1 = default(List<Player>.Enumerator); <player>5__2 = null; <gravitySurge>5__3 = null; <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; AntiRadarCard.ClearCache(); DeathDefyMono.ClearStaticData(); ExecutionerMono.ClearPendingExecutions(); BurnEffectManager.ClearAll(); <>s__1 = PlayerManager.instance.players.GetEnumerator(); try { while (<>s__1.MoveNext()) { <player>5__2 = <>s__1.Current; <gravitySurge>5__3 = ((Component)<player>5__2).GetComponent<GravitySurgeMono>(); if ((Object)(object)<gravitySurge>5__3 != (Object)null) { <gravitySurge>5__3.ResetState(); } if (!CharacterStatModifiersExtension.GetAdditionalData(<player>5__2.data.stats).blacklistedCategories.Contains(ImmunityCards)) { CharacterStatModifiersExtension.GetAdditionalData(<player>5__2.data.stats).blacklistedCategories.Add(ImmunityCards); } if (!CharacterStatModifiersExtension.GetAdditionalData(<player>5__2.data.stats).blacklistedCategories.Contains(ImmunityMasterCategory)) { CharacterStatModifiersExtension.GetAdditionalData(<player>5__2.data.stats).blacklistedCategories.Add(ImmunityMasterCategory); } if (!CharacterStatModifiersExtension.GetAdditionalData(<player>5__2.data.stats).blacklistedCategories.Contains(ArcFieldCategory)) { CharacterStatModifiersExtension.GetAdditionalData(<player>5__2.data.stats).blacklistedCategories.Add(ArcFieldCategory); } if (!CharacterStatModifiersExtension.GetAdditionalData(<player>5__2.data.stats).blacklistedCategories.Contains(GravitySurgeCategory)) { CharacterStatModifiersExtension.GetAdditionalData(<player>5__2.data.stats).blacklistedCategories.Add(GravitySurgeCategory); } if (!CharacterStatModifiersExtension.GetAdditionalData(<player>5__2.data.stats).blacklistedCategories.Contains(AuraCards)) { CharacterStatModifiersExtension.GetAdditionalData(<player>5__2.data.stats).blacklistedCategories.Add(AuraCards); } if (!CharacterStatModifiersExtension.GetAdditionalData(<player>5__2.data.stats).blacklistedCategories.Contains(AuraMasterCategory)) { CharacterStatModifiersExtension.GetAdditionalData(<player>5__2.data.stats).blacklistedCategories.Add(AuraMasterCategory); } if (!CharacterStatModifiersExtension.GetAdditionalData(<player>5__2.data.stats).blacklistedCategories.Contains(RollbackCategory)) { CharacterStatModifiersExtension.GetAdditionalData(<player>5__2.data.stats).blacklistedCategories.Add(RollbackCategory); } <gravitySurge>5__3 = null; <player>5__2 = null; } } finally { ((IDisposable)<>s__1).Dispose(); } <>s__1 = default(List<Player>.Enumerator); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const string ModId = "com.bellusfennec.rounds.mod"; private const string ModName = "BFRM"; public const string Version = "1.21.1"; public const string ModInitials = "BFRM"; internal static CardCategory NonImmunityCards; internal static CardCategory ImmunityCards; internal static CardCategory ImmunityMasterCategory; internal static CardCategory AuraMasterCategory; internal static CardCategory ArcFieldCategory; internal static CardCategory GravitySurgeCategory; internal static CardCategory NonAuraCards; internal static CardCategory AuraCards; internal static CardCategory RollbackCategory; public static List<CardInfo> hiddenCards = new List<CardInfo>(); private Harmony harmony; public static MrFuntikMod instance { get; private set; } private void Awake() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown Assets.Init(); RarityUtils.AddRarity("Hidden", 0.2f, new Color(0.85f, 0.5f, 0.35f), new Color(0.45f, 0.25f, 0.15f)); CardThemeLib.instance.CreateOrGetType("Hidden", new CardThemeColor { bgColor = new Color(0.15f, 0.1f, 0.08f), targetColor = new Color(0.85f, 0.5f, 0.35f) }); harmony = new Harmony("com.bellusfennec.rounds.mod"); harmony.PatchAll(); } private void Start() { Debug.Log((object)"[BFRM] Start."); AntiSlowExternalModsPatch.ApplyPatches(harmony); NonImmunityCards = CustomCardCategories.instance.CardCategory("NonImmunityCards"); ImmunityCards = CustomCardCategories.instance.CardCategory("ImmunityCards"); ImmunityMasterCategory = CustomCardCategories.instance.CardCategory("ImmunityMasterCategory"); AuraMasterCategory = CustomCardCategories.instance.CardCategory("AuraMasterCategory"); ArcFieldCategory = CustomCardCategories.instance.CardCategory("ArcFieldCategory"); GravitySurgeCategory = CustomCardCategories.instance.CardCategory("GravitySurgeCategory"); NonAuraCards = CustomCardCategories.instance.CardCategory("NonAuraCards"); AuraCards = CustomCardCategories.instance.CardCategory("AuraCards"); RollbackCategory = CustomCardCategories.instance.CardCategory("RollbackCategory"); instance = this; DeathDefyHandler.RegisterHooks(); CustomCard.BuildCard<WeakenedDebuffCard>((Action<CardInfo>)delegate(CardInfo cardInfo) { Cards.instance.AddHiddenCard(cardInfo); hiddenCards.Add(cardInfo); }); CustomCard.BuildCard<DrainedDebuffCard>((Action<CardInfo>)delegate(CardInfo cardInfo) { Cards.instance.AddHiddenCard(cardInfo); hiddenCards.Add(cardInfo); }); CustomCard.BuildCard<SoftRicochetDebuffCard>((Action<CardInfo>)delegate(CardInfo cardInfo) { Cards.instance.AddHiddenCard(cardInfo); hiddenCards.Add(cardInfo); }); CustomCard.BuildCard<ColdWaterDebuffCard>((Action<CardInfo>)delegate(CardInfo cardInfo) { Cards.instance.AddHiddenCard(cardInfo); hiddenCards.Add(cardInfo); }); CustomCard.BuildCard<HeavyHandsDebuffCard>((Action<CardInfo>)delegate(CardInfo cardInfo) { Cards.instance.AddHiddenCard(cardInfo); hiddenCards.Add(cardInfo); }); CustomCard.BuildCard<OverheatedDebuffCard>((Action<CardInfo>)delegate(CardInfo cardInfo) { Cards.instance.AddHiddenCard(cardInfo); hiddenCards.Add(cardInfo); }); CustomCard.BuildCard<BlurredFocusDebuffCard>((Action<CardInfo>)delegate(CardInfo cardInfo) { Cards.instance.AddHiddenCard(cardInfo); hiddenCards.Add(cardInfo); }); CustomCard.BuildCard<DeathSentenceDebuffCard>((Action<CardInfo>)delegate(CardInfo cardInfo) { Cards.instance.AddHiddenCard(cardInfo); hiddenCards.Add(cardInfo); }); CustomCard.BuildCard<BrokenBurstDebuffCard>((Action<CardInfo>)delegate(CardInfo cardInfo) { Cards.instance.AddHiddenCard(cardInfo); hiddenCards.Add(cardInfo); }); CustomCard.BuildCard<BloodRotDebuffCard>((Action<CardInfo>)delegate(CardInfo cardInfo) { Cards.instance.AddHiddenCard(cardInfo); hiddenCards.Add(cardInfo); }); CustomCard.BuildCard<BallisticDragDebuffCard>((Action<CardInfo>)delegate(CardInfo cardInfo) { Cards.instance.AddHiddenCard(cardInfo); hiddenCards.Add(cardInfo); }); CustomCard.BuildCard<SlowStepDebuffCard>((Action<CardInfo>)delegate(CardInfo cardInfo) { Cards.instance.AddHiddenCard(cardInfo); hiddenCards.Add(cardInfo); }); CustomCard.BuildCard<TrafficLightCard>(); CustomCard.BuildCard<BerserkerCard>(); CustomCard.BuildCard<RicochetPowerCard>(); CustomCard.BuildCard<PlanetCard>(); CustomCard.BuildCard<BlazingTrailCard>(); CustomCard.BuildCard<DeathDefyCard>(); CustomCard.BuildCard<FadeoutCard>(); CustomCard.BuildCard<ExtendedGuardCard>(); CustomCard.BuildCard<ExecutionerCard>(); CustomCard.BuildCard<ArcFieldCard>((Action<CardInfo>)delegate(CardInfo cardInfo) { ArcFieldCard.cardInfoSelf = cardInfo; }); CustomCard.BuildCard<GravitySurgeCard>((Action<CardInfo>)delegate(CardInfo cardInfo) { GravitySurgeCard.cardInfoSelf = cardInfo; }); CustomCard.BuildCard<BacktrackCard>((Action<CardInfo>)delegate(CardInfo cardInfo) { BacktrackCard.cardInfoSelf = cardInfo; }); CustomCard.BuildCard<RollbackCard>(); CustomCard.BuildCard<DominionCard>(); CustomCard.BuildCard<WeakeningAuraCard>(); CustomCard.BuildCard<DrainAuraCard>(); CustomCard.BuildCard<SoftRicochetAuraCard>(); CustomCard.BuildCard<ColdWaterAuraCard>(); CustomCard.BuildCard<HeavyHandsAuraCard>(); CustomCard.BuildCard<OverheatedAuraCard>(); CustomCard.BuildCard<BlurredFocusAuraCard>(); CustomCard.BuildCard<DeathSentenceAuraCard>(); CustomCard.BuildCard<BrokenBurstAuraCard>(); CustomCard.BuildCard<BloodRotAuraCard>(); CustomCard.BuildCard<BallisticDragAuraCard>(); CustomCard.BuildCard<SlowStepAuraCard>(); GameModeManager.AddHook("PlayerPickEnd", (Func<IGameModeHandler, IEnumerator>)((IGameModeHandler gm) => ImmunizeCard.ExtraPicks())); GameModeManager.AddHook("PlayerPickEnd", (Func<IGameModeHandler, IEnumerator>)((IGameModeHandler gm) => DominionCard.ExtraPicks())); GameModeManager.AddHook("GameStart", (Func<IGameModeHandler, IEnumerator>)GameStart); ExtensionMethods.ExecuteAfterSeconds((MonoBehaviour)(object)instance, 1f, (Action)delegate { foreach (Card value in CardManager.cards.Values) { if (!value.cardInfo.categories.Contains(ImmunityCards)) { value.cardInfo.categories = CollectionExtensions.AddToArray<CardCategory>(value.cardInfo.categories, NonImmunityCards); } if (!value.cardInfo.categories.Contains(AuraCards)) { value.cardInfo.categories = CollectionExtensions.AddToArray<CardCategory>(value.cardInfo.categories, NonAuraCards); } } }); } [IteratorStateMachine(typeof(<GameStart>d__21))] private IEnumerator GameStart(IGameModeHandler gm) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <GameStart>d__21(0) { <>4__this = this, gm = gm }; } } internal class CardCheck : MonoBehaviour { public static readonly string[] AllowedModInitials = new string[2] { "BFRM", "MFM" }; public static int Amount(Player player, string cardName) { if ((Object)(object)player == (Object)null || (Object)(object)player.data == (Object)null || player.data.currentCards == null) { return 0; } List<CardInfo> currentCards = player.data.currentCards; int num = 0; for (int num2 = currentCards.Count - 1; num2 >= 0; num2--) { if ((Object)(object)currentCards[num2] != (Object)null && currentCards[num2].cardName == cardName) { num++; } } return num; } public static int AmountFromAllowedMods(Player player, string cardName) { if ((Object)(object)player == (Object)null || (Object)(object)player.data == (Object)null || player.data.currentCards == null) { return 0; } List<CardInfo> currentCards = player.data.currentCards; int num = 0; for (int num2 = currentCards.Count - 1; num2 >= 0; num2--) { CardInfo val = currentCards[num2]; if ((Object)(object)val != (Object)null && val.cardName == cardName && IsFromAllowedMod(val)) { num++; } } return num; } public static bool HasCardFromAllowedMods(Player player, string cardName) { return AmountFromAllowedMods(player, cardName) > 0; } public static bool IsFromAllowedMod(CardInfo card) { if ((Object)(object)card == (Object)null) { return false; } string cardModName = GetCardModName(card); if (string.IsNullOrEmpty(cardModName)) { return false; } for (int i = 0; i < AllowedModInitials.Length; i++) { if (cardModName == AllowedModInitials[i]) { return true; } } return false; } private static string GetCardModName(CardInfo card) { if ((Object)(object)card == (Object)null) { return null; } string cardName = card.cardName; if ((Object)(object)card.sourceCard != (Object)null) { cardName = card.sourceCard.cardName; } try { foreach (KeyValuePair<string, Card> card2 in CardManager.cards) { if ((Object)(object)card2.Value.cardInfo != (Object)null && card2.Value.cardInfo.cardName == cardName) { return card2.Value.category; } } } catch { } return null; } } public static class ArcFieldHelper { public static bool HasThunderCore(Player player) { if ((Object)(object)player == (Object)null) { return false; } MonoBehaviour[] components = ((Component)player).gameObject.GetComponents<MonoBehaviour>(); MonoBehaviour[] array = components; foreach (MonoBehaviour val in array) { if ((Object)(object)val != (Object)null && ((object)val).GetType().Name == "ElectricBulletEffect") { return true; } } return CardCheck.HasCardFromAllowedMods(player, "Thunder Core"); } public static bool HasPlanet(Player player) { if ((Object)(object)player == (Object)null) { return false; } MonoBehaviour[] components = ((Component)player).gameObject.GetComponents<MonoBehaviour>(); MonoBehaviour[] array = components; foreach (MonoBehaviour val in array) { if ((Object)(object)val != (Object)null && ((object)val).GetType().Name == "GravityFieldMono") { return true; } } return CardCheck.HasCardFromAllowedMods(player, "Planet"); } public static void CheckUnlockArcField(Player player) { if (!((Object)(object)player == (Object)null)) { List<CardCategory> blacklistedCategories = CharacterStatModifiersExtension.GetAdditionalData(player.data.stats).blacklistedCategories; bool flag = HasThunderCore(player); bool flag2 = HasPlanet(player); if (flag && flag2 && blacklistedCategories.Contains(MrFuntikMod.ArcFieldCategory)) { blacklistedCategories.Remove(MrFuntikMod.ArcFieldCategory); } } } public static void CheckLockArcField(Player player, string removingComponent) { if ((Object)(object)player == (Object)null) { return; } List<CardCategory> blacklistedCategories = CharacterStatModifiersExtension.GetAdditionalData(player.data.stats).blacklistedCategories; bool flag = HasThunderCore(player); bool flag2 = HasPlanet(player); if (removingComponent == "ThunderCore") { int num = CardCheck.AmountFromAllowedMods(player, "Thunder Core"); if (num <= 1) { flag = false; } } if (removingComponent == "Planet") { int num2 = CardCheck.AmountFromAllowedMods(player, "Planet"); if (num2 <= 1) { flag2 = false; } } if ((!flag || !flag2) && !blacklistedCategories.Contains(MrFuntikMod.ArcFieldCategory)) { blacklistedCategories.Add(MrFuntikMod.ArcFieldCategory); } } } public static class GravitySurgeHelper { public static bool HasPlanet(Player player) { if ((Object)(object)player == (Object)null) { return false; } MonoBehaviour[] components = ((Component)player).gameObject.GetComponents<MonoBehaviour>(); MonoBehaviour[] array = components; foreach (MonoBehaviour val in array) { if ((Object)(object)val != (Object)null && ((object)val).GetType().Name == "GravityFieldMono") { return true; } } return CardCheck.HasCardFromAllowedMods(player, "Planet"); } public static void CheckUnlockGravitySurge(Player player) { if (!((Object)(object)player == (Object)null)) { List<CardCategory> blacklistedCategories = CharacterStatModifiersExtension.GetAdditionalData(player.data.stats).blacklistedCategories; if (HasPlanet(player) && blacklistedCategories.Contains(MrFuntikMod.GravitySurgeCategory)) { blacklistedCategories.Remove(MrFuntikMod.GravitySurgeCategory); } } } public static void CheckLockGravitySurge(Player player) { if (!((Object)(object)player == (Object)null)) { List<CardCategory> blacklistedCategories = CharacterStatModifiersExtension.GetAdditionalData(player.data.stats).blacklistedCategories; if (!blacklistedCategories.Contains(MrFuntikMod.GravitySurgeCategory)) { blacklistedCategories.Add(MrFuntikMod.GravitySurgeCategory); } } } public static void CheckLockGravitySurgeOnStackRemove(Player player, bool isLastStack) { if ((Object)(object)player == (Object)null) { return; } int num = CardCheck.AmountFromAllowedMods(player, "Planet"); if (num <= 1) { List<CardCategory> blacklistedCategories = CharacterStatModifiersExtension.GetAdditionalData(player.data.stats).blacklistedCategories; if (!blacklistedCategories.Contains(MrFuntikMod.GravitySurgeCategory)) { blacklistedCategories.Add(MrFuntikMod.GravitySurgeCategory); } } } } public static class ImmunityHelper { private static CardCategory _immunityCategory; private static CardCategory ImmunityCategory { get { if ((Object)(object)_immunityCategory == (Object)null) { _immunityCategory = CustomCardCategories.instance.CardCategory("ImmunityCards"); } return _immunityCategory; } } public static int CountImmunityCards(Player player) { if ((Object)(object)player == (Object)null || (Object)(object)player.data == (Object)null || player.data.currentCards == null) { return 0; } int num = 0; foreach (CardInfo currentCard in player.data.currentCards) { if (!((Object)(object)currentCard == (Object)null) && currentCard.categories != null && currentCard.categories.Contains(ImmunityCategory) && CardCheck.IsFromAllowedMod(currentCard)) { num++; } } return num; } public static void CheckUnlockImmunityMaster(Player player) { if (!((Object)(object)player == (Object)null)) { List<CardCategory> blacklistedCategories = CharacterStatModifiersExtension.GetAdditionalData(player.data.stats).blacklistedCategories; int num = CountImmunityCards(player) + 1; if (num >= 2 && blacklistedCategories.Contains(MrFuntikMod.ImmunityMasterCategory)) { blacklistedCategories.Remove(MrFuntikMod.ImmunityMasterCategory); } } } public static void CheckLockImmunityMaster(Player player) { if (!((Object)(object)player == (Object)null)) { List<CardCategory> blacklistedCategories = CharacterStatModifiersExtension.GetAdditionalData(player.data.stats).blacklistedCategories; int num = CountImmunityCards(player) - 1; if (num < 2 && !blacklistedCategories.Contains(MrFuntikMod.ImmunityMasterCategory)) { blacklistedCategories.Add(MrFuntikMod.ImmunityMasterCategory); } } } } public static class RollbackHelper { public static bool HasBacktrack(Player player) { if ((Object)(object)player == (Object)null) { return false; } return (Object)(object)((Component)player).gameObject.GetComponent<BacktrackMono>() != (Object)null; } public static void CheckUnlockRollback(Player player) { if (!((Object)(object)player == (Object)null)) { List<CardCategory> blacklistedCategories = CharacterStatModifiersExtension.GetAdditionalData(player.data.stats).blacklistedCategories; if (HasBacktrack(player) && blacklistedCategories.Contains(MrFuntikMod.RollbackCategory)) { blacklistedCategories.Remove(MrFuntikMod.RollbackCategory); } } } public static void CheckLockRollback(Player player) { if (!((Object)(object)player == (Object)null)) { List<CardCategory> blacklistedCategories = CharacterStatModifiersExtension.GetAdditionalData(player.data.stats).blacklistedCategories; BacktrackMono component = ((Component)player).gameObject.GetComponent<BacktrackMono>(); bool flag = false; if (!blacklistedCategories.Contains(MrFuntikMod.RollbackCategory)) { blacklistedCategories.Add(MrFuntikMod.RollbackCategory); } } } public static void CheckLockRollbackOnStackRemove(Player player, bool isLastStack) { if (!((Object)(object)player == (Object)null) && isLastStack) { List<CardCategory> blacklistedCategories = CharacterStatModifiersExtension.GetAdditionalData(player.data.stats).blacklistedCategories; if (!blacklistedCategories.Contains(MrFuntikMod.RollbackCategory)) { blacklistedCategories.Add(MrFuntikMod.RollbackCategory); } } } } } namespace MrFuntikMod.Extensions { [Serializable] public class BlockAdditionalData { public float discombobulateRange; public float discombobulateDuration; public float timeOfLastSuccessfulBlock; public BlockAdditionalData() { discombobulateRange = 0f; discombobulateDuration = 0f; timeOfLastSuccessfulBlock = -100f; } } public static class BlockExtension { public static readonly ConditionalWeakTable<Block, BlockAdditionalData> data = new ConditionalWeakTable<Block, BlockAdditionalData>(); public static BlockAdditionalData GetAdditionalData(this Block block) { return data.GetOrCreateValue(block); } public static void AddData(this Block block, BlockAdditionalData value) { try { data.Add(block, value); } catch (Exception) { } } } [Serializable] public class CardInfoAdditionalData { public bool isRandom; public bool isClassBlacklistCard; public CardInfoAdditionalData() { isRandom = false; isClassBlacklistCard = false; } } public static class CardInfoExtension { public static readonly ConditionalWeakTable<CardInfo, CardInfoAdditionalData> data = new ConditionalWeakTable<CardInfo, CardInfoAdditionalData>(); public static CardInfoAdditionalData GetAdditionalData(this CardInfo cardInfo) { return data.GetOrCreateValue(cardInfo); } public static void AddData(this CardInfo cardInfo, CardInfoAdditionalData value) { try { data.Add(cardInfo, value); } catch (Exception) { } } } [Serializable] public class CharacterStatModifiersAdditionalData { public float piercingDamage; public int shuffles; public CharacterStatModifiersAdditionalData() { piercingDamage = 0f; shuffles = 0; } } public static class CharacterStatModifiersExtension { public static readonly ConditionalWeakTable<CharacterStatModifiers, CharacterStatModifiersAdditionalData> data = new ConditionalWeakTable<CharacterStatModifiers, CharacterStatModifiersAdditionalData>(); public static CharacterStatModifiersAdditionalData GetAdditionalData(this CharacterStatModifiers characterstats) { return data.GetOrCreateValue(characterstats); } public static void AddData(this CharacterStatModifiers characterstats, CharacterStatModifiersAdditionalData value) { try { data.Add(characterstats, value); } catch (Exception) { } } } [HarmonyPatch(typeof(CharacterStatModifiers), "ResetStats")] internal class CharacterStatModifiersPatchResetStats { private static void Prefix(CharacterStatModifiers __instance) { __instance.GetAdditionalData().piercingDamage = 0f; __instance.GetAdditionalData().shuffles = 0; } } } namespace MrFuntikMod.RoundsEffects { public class FriendlyFireEffect : DealtDamageEffect { public float multiplier = 1f; public override void DealtDamage(Vector2 damage, bool selfDamage, Player damagedPlayer = null) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) Player damagedPlayer2 = damagedPlayer; if (!selfDamage && (!((Object)(object)damagedPlayer2 != (Object)null) || damagedPlayer2.teamID != ((Component)this).gameObject.GetComponent<Player>().teamID)) { return; } if (damagedPlayer2.data.health - ((Vector2)(ref damage)).magnitude <= 0f) { damagedPlayer2.data.healthHandler.Heal(((Vector2)(ref damage)).magnitude * (1f - multiplier)); return; } ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)Unbound.Instance, 2, (Action)delegate { damagedPlayer2.data.healthHandler.Heal(((Vector2)(ref damage)).magnitude * (1f - multiplier)); }); } } } namespace MrFuntikMod.Patches { [HarmonyPatch(typeof(ProjectileHit), "RPCA_DoHit")] public class AegisShieldPatch_RPCA_DoHit { public static bool Prefix(ProjectileHit __instance, Vector2 hitPoint, Vector2 hitNormal, Vector2 vel, int viewID, int colliderID, ref bool wasBlocked) { if (viewID == -1) { return true; } PhotonView photonView = PhotonNetwork.GetPhotonView(viewID); if ((Object)(object)photonView == (Object)null) { return true; } Player component = ((Component)photonView).GetComponent<Player>(); if ((Object)(object)component == (Object)null) { return true; } if ((Object)(object)component.data == (Object)null || component.data.dead) { return true; } if ((Object)(object)component.data.healthHandler == (Object)null || component.data.healthHandler.isRespawning) { return true; } if (!AegisShieldMono.IsShieldActiveForPlayer(component)) { return true; } wasBlocked = true; return true; } } [HarmonyPatch(typeof(HealthHandler), "DoDamage")] public class AegisShieldPatch_DoDamage { public static bool Prefix(HealthHandler __instance, ref Vector2 damage, Vector2 position, Color blinkColor, GameObject damagingWeapon, Player damagingPlayer, bool healthRemoval, bool lethal, bool ignoreBlock) { if ((Object)(object)__instance == (Object)null) { return true; } Player component = ((Component)__instance).GetComponent<Player>(); if ((Object)(object)component == (Object)null) { return true; } if ((Object)(object)component.data == (Object)null || component.data.dead) { return true; } if (__instance.isRespawning) { return true; } if (!AegisShieldMono.IsShieldActiveForPlayer(component)) { return true; } return false; } } [HarmonyPatch(typeof(HealthHandler), "CallTakeDamage")] public class AegisShieldPatch_CallTakeDamage { public static bool Prefix(HealthHandler __instance, Vector2 damage, Vector2 position, GameObject damagingWeapon, Player damagingPlayer, bool lethal) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null || damage == Vector2.zero) { return true; } Player component = ((Component)__instance).GetComponent<Player>(); if ((Object)(object)component == (Object)null) { return true; } if ((Object)(object)component.data == (Object)null || component.data.dead) { return true; } if (__instance.isRespawning) { return true; } if (!AegisShieldMono.IsShieldActiveForPlayer(component)) { return true; } return false; } } [HarmonyPatch(typeof(HealthHandler), "TakeDamage", new Type[] { typeof(Vector2), typeof(Vector2), typeof(Color), typeof(GameObject), typeof(Player), typeof(bool), typeof(bool) })] public class AegisShieldPatch_TakeDamage { public static bool Prefix(HealthHandler __instance, Vector2 damage, Vector2 position, Color dmgColor, GameObject damagingWeapon, Player damagingPlayer, bool lethal, bool ignoreBlock) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null || damage == Vector2.zero) { return true; } Player component = ((Component)__instance).GetComponent<Player>(); if ((Object)(object)component == (Object)null) { return true; } if ((Object)(object)component.data == (Object)null || component.data.dead) { return true; } if (__instance.isRespawning) { return true; } if (!AegisShieldMono.IsShieldActiveForPlayer(component)) { return true; } return false; } } [HarmonyPatch(typeof(HealthHandler), "RPCA_SendTakeDamage")] public class AegisShieldPatch_RPCA_SendTakeDamage { public static bool Prefix(HealthHandler __instance, ref Vector2 damage, Vector2 position, bool lethal, int playerID) { if ((Object)(object)__instance == (Object)null) { return true; } Player component = ((Component)__instance).GetComponent<Player>(); if ((Object)(object)component == (Object)null) { return true; } if ((Object)(object)component.data == (Object)null || component.data.dead) { return true; } if (__instance.isRespawning) { return true; } if (!AegisShieldMono.IsShieldActiveForPlayer(component)) { return true; } return false; } } [HarmonyPatch(typeof(HealthHandler), "TakeForce")] public class AegisShieldPatch_TakeForce { public static bool Prefix(HealthHandler __instance, ref Vector2 force, ForceMode2D forceMode, bool forceIgnoreMass, bool ignoreBlock, float setFlying) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null || force == Vector2.zero) { return true; } Player component = ((Component)__instance).GetComponent<Player>(); if ((Object)(object)component == (Object)null) { return true; } if ((Object)(object)component.data == (Object)null || component.data.dead) { return true; } if (__instance.isRespawning) { return true; } if (!AegisShieldMono.IsShieldActiveForPlayer(component)) { return true; } if (AntiKnockbackHelper.IsCalledFromOutOfBounds()) { return true; } return false; } } [HarmonyPatch(typeof(HealthHandler), "RPCA_SendTakeForce")] public class AegisShieldPatch_RPCA_SendTakeForce { public static bool Prefix(HealthHandler __instance, Vector2 force, int forceMode, bool forceIgnoreMass, bool ignoreBlock, float setFlying) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null || force == Vector2.zero) { return true; } Player component = ((Component)__instance).GetComponent<Player>(); if ((Object)(object)component == (Object)null) { return true; } if ((Object)(object)component.data == (Object)null || component.data.dead) { return true; } if (__instance.isRespawning) { return true; } if (!AegisShieldMono.IsShieldActiveForPlayer(component)) { return true; } if (AntiKnockbackHelper.IsCalledFromOutOfBounds()) { return true; } return false; } } internal static class AntiRadarEffectHelper { private static float lastEffectTime; private const float EFFECT_COOLDOWN = 1.5f; public static void PlayRadarEvadeEffect(Player player) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)player == (Object)null) && !(Time.time - lastEffectTime < 1.5f)) { lastEffectTime = Time.time; Color color = default(Color); ((Color)(ref color))..ctor(0.4f, 0.8f, 1f, 0.8f); ShieldEffect.PlayShieldEffect(player, color, 0.6f, 0.6f); } } } [HarmonyPatch(typeof(PlayerManager), "GetClosestPlayer")] [HarmonyPatch(new Type[] { typeof(Vector2), typeof(bool) })] public class GetClosestPlayerPatch { [HarmonyPostfix] public static void Postfix(ref Player __result, Vector2 refPos, bool needVision) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)__result == (Object)null) && AntiRadarCard.HasImmunity(__result)) { Player val = __result; __result = FindClosestPlayerWithoutImmunity(refPos, val, needVision); AntiRadarEffectHelper.PlayRadarEvadeEffect(val); } } private static Player FindClosestPlayerWithoutImmunity(Vector2 pos, Player excluded, bool needVision) { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) if (PlayerManager.instance?.players == null) { return null; } Player result = null; float num = float.MaxValue; foreach (Player player in PlayerManager.instance.players) { if (!((Object)(object)player == (Object)null) && !((Object)(object)player == (Object)(object)excluded) && !((Object)(object)player.data == (Object)null) && !player.data.dead && ((Component)player).gameObject.activeInHierarchy && !AntiRadarCard.HasImmunity(player) && (!needVision || PlayerManager.instance.CanSeePlayer(pos, player).canSee)) { float num2 = Vector2.Distance(pos, player.data.playerVel.position); if (num2 < num) { num = num2; result = player; } } } return result; } } [HarmonyPatch(typeof(PlayerManager), "GetClosestPlayer")] [HarmonyPatch(new Type[] { typeof(Vector2), typeof(Vector2) })] public class GetClosestPlayerForwardPatch { [HarmonyPostfix] public static void Postfix(ref Player __result, Vector2 refPos, Vector2 forward) { //IL_0023: 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) if (!((Object)(object)__result == (Object)null) && AntiRadarCard.HasImmunity(__result)) { Player val = __result; __result = FindClosestPlayerWithoutImmunity(refPos, forward, val); AntiRadarEffectHelper.PlayRadarEvadeEffect(val); } } private static Player FindClosestPlayerWithoutImmunity(Vector2 refPos, Vector2 forward, Player excluded) { //IL_00bd: 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_00e2: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) if (PlayerManager.instance?.players == null) { return null; } Player result = null; float num = float.MaxValue; foreach (Player player in PlayerManager.instance.players) { if (!((Object)(object)player == (Object)null) && !((Object)(object)player == (Object)(object)excluded) && !((Object)(object)player.data == (Object)null) && !player.data.dead && ((Component)player).gameObject.activeInHierarchy && !AntiRadarCard.HasImmunity(player) && PlayerManager.instance.CanSeePlayer(refPos, player).canSee) { float num2 = Vector2.Distance(refPos, player.data.playerVel.position); float num3 = Vector2.Angle(forward, player.data.playerVel.position - refPos); float num4 = num2 + num3; if (num4 < num) { num = num4; result = player; } } } return result; } } [HarmonyPatch(typeof(BounceEffectRetarget), "FindTarget")] public class TargetBouncePatch { [HarmonyPostfix] public static void Postfix(BounceEffectRetarget __instance, ref Player __result, HitInfo hit) { //IL_0028: 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) //IL_0038: 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_0042: 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_0049: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)__result == (Object)null) && AntiRadarCard.HasImmunity(__result)) { Player val = __result; Vector3 pos = ((Component)__instance).transform.position + Vector2.op_Implicit(hit.normal * 0.1f); __result = FindVisiblePlayerWithoutImmunity(pos, val); AntiRadarEffectHelper.PlayRadarEvadeEffect(val); } } private static Player FindVisiblePlayerWithoutImmunity(Vector3 pos, Player exclude) { //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) if (PlayerManager.instance?.players == null) { return null; } Player result = null; float num = float.MaxValue; foreach (Player player in PlayerManager.instance.players) { if (!((Object)(object)player == (Object)null) && !((Object)(object)player == (Object)(object)exclude) && !((Object)(object)player.data == (Object)null) && !player.data.dead && ((Component)player).gameObject.activeInHierarchy && !AntiRadarCard.HasImmunity(player) && PlayerManager.instance.CanSeePlayer(Vector2.op_Implicit(pos), player).canSee) { float num2 = Vector3.Distance(pos, ((Component)player).transform.position); if (num2 < num) { num = num2; result = player; } } } return result; } } [HarmonyPatch(typeof(HealthHandler), "Heal")] public class HealEffectPatch { [HarmonyPrefix] private static void Prefix(HealthHandler __instance, ref float healAmount) { WeakenedHealMono component = ((Component)__instance).GetComponent<WeakenedHealMono>(); if ((Object)(object)component != (Object)null && component.GetStacks() > 0) { float healMultiplier = component.GetHealMultiplier(); healAmount *= healMultiplier; } } } [HarmonyPatch(typeof(ProjectileHit), "RPCA_DoHit")] [HarmonyPriority(800)] public class DancerDodgePatch { public static bool Prefix(ProjectileHit __instance, Vector2 hitPoint, Vector2 hitNormal, Vector2 vel, int viewID, int colliderID, bool wasBlocked) { if (wasBlocked) { return true; } if (viewID == -1) { return true; } PhotonView photonView = PhotonNetwork.GetPhotonView(viewID); if ((Object)(object)photonView == (Object)null) { return true; } HealthHandler component = ((Component)photonView).GetComponent<HealthHandler>(); if ((Object)(object)component == (Object)null) { return true; } if (component.isRespawning) { return true; } Player component2 = ((Component)component).GetComponent<Player>(); if ((Object)(object)component2 == (Object)null) { return true; } if ((Object)(object)component2.data == (Object)null || component2.data.dead) { return true; } Block component3 = ((Component)component).GetComponent<Block>(); if ((Object)(object)component3 != (Object)null && component3.IsBlocking()) { return true; } DancerMono component4 = ((Component)component2).GetComponent<DancerMono>(); if ((Object)(object)component4 == (Object)null) { return true; } if (!__instance.view.IsMine) { return true; } Debug.Log((object)"[BFRM] TryDodge."); if (component4.TryDodge()) { NetworkingManager.RPC(typeof(DancerDodgePatch), "RPC_ShowDodgeEffect", new object[1] { component2.playerID }); return false; } return true; } [UnboundRPC] public static void RPC_ShowDodgeEffect(int playerID) { Player val = ((IEnumerable<Player>)PlayerManager.instance.players).FirstOrDefault((Func<Player, bool>)((Player p) => p.playerID == playerID)); if (!((Object)(object)val == (Object)null)) { DancerMono component = ((Component)val).GetComponent<DancerMono>(); if ((Object)(object)component != (Object)null) { component.ShowMissText(); } } } } public class DeathDefyHandler { [CompilerGenerated] private sealed class <OnBattleStart>d__1 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public IGameModeHandler gm; private List<Player>.Enumerator <>s__1; private Player <player>5__2; private CharacterData <data>5__3; private DeathDefyMono <deathDefy>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OnBattleStart>d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>s__1 = default(List<Player>.Enumerator); <player>5__2 = null; <data>5__3 = null; <deathDefy>5__4 = null; <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; <>s__1 = PlayerManager.instance.players.GetEnumerator(); try { while (<>s__1.MoveNext()) { <player>5__2 = <>s__1.Current; if ((Object)(object)<player>5__2 == (Object)null) { continue; } <data>5__3 = ((Component)<player>5__2).GetComponent<CharacterData>(); if ((Object)(object)<data>5__3 == (Object)null) { continue; } <deathDefy>5__4 = ((Component)<player>5__2).GetComponent<DeathDefyMono>(); if (!((Object)(object)<deathDefy>5__4 == (Object)null) && <data>5__3.view.IsMine) { if (<deathDefy>5__4.TryRollReviveOnBattleStart()) { NetworkingManager.RPC(typeof(DeathDefyHandler), "RPC_AddRespawn", new object[1] { <player>5__2.playerID }); } <data>5__3 = null; <deathDefy>5__4 = null; <player>5__2 = null; } } } finally { ((IDisposable)<>s__1).Dispose(); } <>s__1 = default(List<Player>.Enumerator); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <OnPointEnd>d__2 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public IGameModeHandler gm; private List<Player>.Enumerator <>s__1; private Player <player>5__2; private DeathDefyMono <deathDefy>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OnPointEnd>d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>s__1 = default(List<Player>.Enumerator); <player>5__2 = null; <deathDefy>5__3 = null; <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; <>s__1 = PlayerManager.instance.players.GetEnumerator(); try { while (<>s__1.MoveNext()) { <player>5__2 = <>s__1.Current; if (!((Object)(object)<player>5__2 == (Object)null)) { <deathDefy>5__3 = ((Component)<player>5__2).GetComponent<DeathDefyMono>(); if (!((Object)(object)<deathDefy>5__3 == (Object)null)) { <deathDefy>5__3.ClearTempRespawns(); <deathDefy>5__3 = null; <player>5__2 = null; } } } } finally { ((IDisposable)<>s__1).Dispose(); } <>s__1 = default(List<Player>.Enumerator); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static void RegisterHooks() { GameModeManager.AddHook("BattleStart", (Func<IGameModeHandler, IEnumerator>)OnBattleStart); GameModeManager.AddHook("PointEnd", (Func<IGameModeHandler, IEnumerator>)OnPointEnd); } [IteratorStateMachine(typeof(<OnBattleStart>d__1))] private static IEnumerator OnBattleStart(IGameModeHandler gm) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <OnBattleStart>d__1(0) { gm = gm }; } [IteratorStateMachine(typeof(<OnPointEnd>d__2))] private static IEnumerator OnPointEnd(IGameModeHandler gm) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <OnPointEnd>d__2(0) { gm = gm }; } [UnboundRPC] public static void RPC_AddRespawn(int playerID) { Player val = ((IEnumerable<Player>)PlayerManager.instance.players).FirstOrDefault((Func<Player, bool>)((Player p) => p.playerID == playerID)); if (!((Object)(object)val == (Object)null)) { DeathDefyMono component = ((Component)val).GetComponent<DeathDefyMono>(); if (!((Object)(object)component == (Object)null)) { component.AddTempRespawn(); } } } [UnboundRPC] public static void RPC_ShowText(int playerID) { Player val = ((IEnumerable<Player>)PlayerManager.instance.players).FirstOrDefault((Func<Player, bool>)((Player p) => p.playerID == playerID)); if (!((Object)(object)val == (Object)null)) { DeathDefyMono component = ((Component)val).GetComponent<DeathDefyMono>(); if (!((Object)(object)component == (Object)null)) { component.ShowReviveText(); } } } } [HarmonyPatch(typeof(HealthHandler), "RPCA_Die_Phoenix")] public class DeathDefyPhoenixPatch { public static void Postfix(HealthHandler __instance) { Player component = ((Component)__instance).GetComponent<Player>(); if ((Object)(object)component == (Object)null) { return; } CharacterData component2 = ((Component)__instance).GetComponent<CharacterData>(); if ((Object)(object)component2 == (Object)null) { return; } DeathDefyMono component3 = ((Component)component).GetComponent<DeathDefyMono>(); if (!((Object)(object)component3 == (Object)null) && component2.view.IsMine) { if (component3.HasDeathDefyRespawns()) { NetworkingManager.RPC(typeof(DeathDefyHandler), "RPC_ShowText", new object[1] { component.playerID }); } if (component3.TryProcessDeathDefyRespawn()) { NetworkingManager.RPC(typeof(DeathDefyHandler), "RPC_AddRespawn", new object[1] { component.playerID }); } } } } [HarmonyPatch(typeof(Gun), "BulletInit")] public class BulletInitPatch { private static void Postfix(Gun __instance, GameObject bullet) { if ((Object)(object)__instance.player == (Object)null || !__instance.player.data.view.IsMine) { return; } ExecutionerMono component = ((Component)__instance.player).GetComponent<ExecutionerMono>(); if (!((Object)(object)component == (Object)null) && component.TryExecute()) { PhotonView component2 = bullet.GetComponent<PhotonView>(); if (!((Object)(object)component2 == (Object)null)) { int viewID = component2.ViewID; ApplyExecutionerEffect(viewID); NetworkingManager.RPC(typeof(BulletInitPatch), "RPC_SetExecutionerBullet", new object[1] { viewID }); } } } private static void ApplyExecutionerEffect(int bulletViewID) { PhotonView photonView = PhotonNetwork.GetPhotonView(bulletViewID); if (!((Object)(object)photonView == (Object)null)) { GameObject gameObject = ((Component)photonView).gameObject; ExecutionerBullet executionerBullet = gameObject.GetComponent<ExecutionerBullet>(); if ((Object)(object)executionerBullet == (Object)null) { executionerBullet = gameObject.AddComponent<ExecutionerBullet>(); } executionerBullet.isExecutionerShot = true; executionerBullet.ApplyBloodyVisuals(); } } [UnboundRPC] public static void RPC_SetExecutionerBullet(int bulletViewID) { ApplyExecutionerEffect(bulletViewID); } } [HarmonyPatch(typeof(ProjectileHit), "RPCA_DoHit")] [HarmonyPriority(0)] public class ExecutionerPatch { public static bool Prefix(ProjectileHit __instance, Vector2 hitPoint, Vector2 hitNormal, Vector2 vel, int viewID, int colliderID, ref bool wasBlocked) { //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) if (wasBlocked || viewID == -1) { return true; } ExecutionerBullet component = ((Component)__instance).GetComponent<ExecutionerBullet>(); if ((Object)(object)component == (Object)null || !component.isExecutionerShot) { return true; } PhotonView photonView = PhotonNetwork.GetPhotonView(viewID); if ((Object)(object)photonView == (Object)null) { return true; } Player component2 = ((Component)photonView).GetComponent<Player>(); if ((Object)(object)component2 == (Object)null || component2.data.dead) { return true; } HealthHandler component3 = ((Component)component2).GetComponent<HealthHandler>(); if ((Object)(object)component3 == (Object)null || component3.isRespawning) { return true; } if ((Object)(object)__instance.ownPlayer != (Object)null && __instance.ownPlayer.data.view.IsMine) { Vector2 val = Vector2.op_Implicit(((Component)component2).transform.position - ((Component)__instance.ownPlayer).transform.position); Vector2 normalized = ((Vector2)(ref val)).normalized; if (component2.data.stats.remainingRespawns > 0) { component2.data.view.RPC("RPCA_Die_Phoenix", (RpcTarget)0, new object[1] { normalized }); } else { component2.data.view.RPC("RPCA_Die", (RpcTarget)0, new object[1] { normalized }); } NetworkingManager.RPC(typeof(ExecutionerPatch), "RPC_ShowExecuteEffect", new object[4] { __instance.ownPlayer.playerID, ((Component)component2).transform.position.x, ((Component)component2).transform.position.y, ((Component)component2).transform.position.z }); } return false; } [UnboundRPC] public static void RPC_ShowExecuteEffect(int attackerPlayerID, float posX, float posY, float posZ) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) ExecutionerMono.ShowExecuteTextStatic(attackerPlayerID, new Vector3(posX, posY, posZ)); } } [HarmonyPatch(typeof(HealthHandler), "RPCA_Die")] public class ExecutionerDeathPatch { public static void Postfix(HealthHandler __instance, Vector2 deathDirection) { Player component = ((Component)__instance).GetComponent<Player>(); if (!((Object)(object)component == (Object)null)) { ExecutionerMono.OnPlayerDied(component.playerID); } } } [HarmonyPatch(typeof(HealthHandler), "RPCA_Die_Phoenix")] public class ExecutionerDeathPhoenixPatch { public static void Postfix(HealthHandler __instance, Vector2 deathDirection) { Player component = ((Component)__instance).GetComponent<Player>(); if (!((Object)(object)component == (Object)null)) { ExecutionerMono.OnPlayerDied(component.playerID); } } } [HarmonyPatch(typeof(Block), "RPCA_DoBlock")] public class ExtendedGuardSyncPatch { private static int patchCallCount; public static void Prefix(Block __instance, bool firstBlock, bool dontSetCD, BlockTriggerType triggerType, Vector3 useBlockPos, bool onlyBlockEffects) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 patchCallCount++; if ((int)triggerType > 0 || !firstBlock) { return; } Player component = ((Component)__instance).GetComponent<Player>(); if ((Object)(object)component == (Object)null) { return; } ExtendedGuardMono component2 = ((Component)component).GetComponent<ExtendedGuardMono>(); if ((Object)(object)component2 == (Object)null) { return; } CharacterData component3 = ((Component)component).GetComponent<CharacterData>(); if (!((Object)(object)component3 == (Object)null) && component3.view.IsMine) { float value = Random.value; float critChance = component2.GetCritChance(); if (value < critChance) { NetworkingManager.RPC(typeof(ExtendedGuardSyncPatch), "RPC_ActivateCritBlock", new object[1] { component.playerID }); } } } [UnboundRPC] public static void RPC_ActivateCritBlock(int playerID) { Player val = ((IEnumerable<Player>)PlayerManager.instance.players).FirstOrDefault((Func<Player, bool>)((Player p) => p.playerID == playerID)); if (!((Object)(object)val == (Object)null)) { ExtendedGuardMono component = ((Component)val).GetComponent<ExtendedGuardMono>(); if ((Object)(object)component != (Object)null) { component.ActivateCritBlockFromRPC(); } } } } [HarmonyPatch(typeof(CharacterStatModifiers), "AddSlowAddative")] public class AntiSlowPatch_AddSlowAddative { public static bool Prefix(CharacterStatModifiers __instance, float slowToAdd, float maxValue, bool isFastSlow) { Player component = ((Component)__instance).GetComponent<Player>(); if ((Object)(object)component != (Object)null && (Object)(object)((Component)component).gameObject.GetComponent<AntiSlowMono>() != (Object)null) { PlayResistEffects(component); return false; } return true; } public static void PlayResistEffects(Player player) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) Color color = default(Color); ((Color)(ref color))..ctor(0.2f, 1f, 0.6f, 1f); ShieldEffect.PlayShieldEffect(player, color); } } [HarmonyPatch(typeof(CharacterStatModifiers), "RPCA_AddSlow")] public class AntiSlowPatch_RPCA_AddSlow { public static bool Prefix(CharacterStatModifiers __instance, float slowToAdd, bool isFastSlow) { Player component = ((Component)__instance).GetComponent<Player>(); if ((Object)(object)component != (Object)null && (Object)(object)((Component)component).gameObject.GetComponent<AntiSlowMono>() != (Object)null) { AntiSlowPatch_AddSlowAddative.PlayResistEffects(component); return false; } return true; } } [HarmonyPatch(typeof(CharacterStatModifiers), "DoSlowDown")] [HarmonyPatch(new Type[] { typeof(float) })] public class AntiSlowPatch_DoSlowDown { public static bool Prefix(CharacterStatModifiers __instance, float newSlow) { Player component = ((Component)__instance).GetComponent<Player>(); if ((Object)(object)component != (Object)null && (Object)(object)((Component)component).gameObject.GetComponent<AntiSlowMono>() != (Object)null) { return false; } return true; } } public static class AntiSlowExternalModsPatch { public static void ApplyPatches(Harmony harmony) { TryPatchMethod(harmony, "GoldHealthMono", "OnStart", "GoldHealth OnStart", "GoldHealthOnStartPrefix"); TryPatchMethod(harmony, "GoldenGlazeMono", "DoHitEffect", "Golden Glaze DoHitEffect", "GenericDoHitEffectPrefix"); } private static void TryPatchMethod(Harmony harmony, string className, string methodName, string displayName, string prefixMethodName) { //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Expected O, but got Unknown try { Type type = null; Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { try { Type[] types; try { types = assembly.GetTypes(); } catch (ReflectionTypeLoadException ex) { types = ex.Types; } if (types == null) { continue; } Type[] array = types; foreach (Type type2 in array) { if (type2 != null && type2.Name == className) { type = type2; break; } } if (!(type != null)) { continue; } break; } catch (Exception) { } } if (type == null) { return; } MethodInfo method = type.GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method == null) { return; } MethodInfo method2 = typeof(AntiSlowExternalModsPatch).GetMethod(prefixMethodName, BindingFlags.Static | BindingFlags.Public); if (!(method2 == null)) { HarmonyMethod val = new HarmonyMethod(method2) { priority = 800 }; if (!(val.method == null)) { harmony.Patch((MethodBase)method, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } } catch (Exception) { } } public static bool GoldHealthOnStartPrefix(object __instance) { try { MonoBehaviour val = (MonoBehaviour)((__instance is MonoBehaviour) ? __instance : null); if ((Object)(object)val == (Object)null) { return true; } Player component = ((Component)val).GetComponent<Player>(); if ((Object)(object)component != (Object)null && (Object)(object)((Component)component).gameObject.GetComponent<AntiSlowMono>() != (Object)null) { AntiSlowPatch_AddSlowAddative.PlayResistEffects(component); Object.Destroy((Object)(object)val); return false; } } catch (Exception ex) { Debug.LogWarning((object)("[MFM] Error in GoldHealthOnStartPrefix: " + ex.Message)); } return true; } public static bool GenericDoHitEffectPrefix(object __instance, object hit) { try { Type type = hit.GetType(); FieldInfo field = type.GetField("transform", BindingFlags.Instance | BindingFlags.Public); Transform val = null; if (field != null) { object? value = field.GetValue(hit); val = (Transform)((value is Transform) ? value : null); } if ((Object)(object)val == (Object)null) { return true; } Player component = ((Component)val).GetComponent<Player>(); if ((Object)(object)component != (Object)null && (Object)(object)((Component)component).gameObject.GetComponent<AntiSlowMono>() != (Object)null) { AntiSlowPatch_AddSlowAddative.PlayResistEffects(component); return false; } } catch (Exception ex) { Debug.LogWarning((object)("[MFM] Error in GenericDoHitEffectPrefix: " + ex.Message)); } return true; } } internal static class AntiKnockbackHelper { private static float lastEffectTime; private const float EFFECT_COOLDOWN = 0.15f; private static readonly Color SHIELD_COLOR = new Color(0.9f, 0.5f, 0.2f, 1f); public static bool IsCalledFromOutOfBounds() { StackTrace stackTrace = new StackTrace(); StackFrame[] frames = stackTrace.GetFrames(); if (frames == null) { return false; } StackFrame[] array = frames; foreach (StackFrame stackFrame in array) { if (stackFrame.GetMethod()?.DeclaringType?.Name == "OutOfBoundsHandler") { return true; } } return false; } public static void PlayResistEffects(Player player) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (!(Time.time - lastEffectTime < 0.15f)) { lastEffectTime = Time.time; ShieldEffect.PlayShieldEffect(player, SHIELD_COLOR, 0.8f); } } public static bool ShouldBlockKnockback(Player player) { if ((Object)(object)player == (Object)null) { return false; } if ((Object)(object)((Component)player).gameObject.GetComponent<AntiKnockbackMono>() == (Object)null) { return false; } if (IsCalledFromOutOfBounds()) { return false; } return true; } } [HarmonyPatch(typeof(HealthHandler), "TakeForce")] public class AntiKnockbackPatch_TakeForce { public static bool Prefix(HealthHandler __instance, ref Vector2 force) { Player component = ((Component)__instance).GetComponent<Player>(); if (!AntiKnockbackHelper.ShouldBlockKnockback(component)) { return true; } AntiKnockbackHelper.PlayResistEffects(component); return false; } } [HarmonyPatch(typeof(HealthHandler), "RPCA_SendTakeForce")] public class AntiKnockbackPatch_RPCA { public static bool Prefix(HealthHandler __instance, Vector2 force) { Player component = ((Component)__instance).GetComponent<Player>(); if (!AntiKnockbackHelper.ShouldBlockKnockback(component)) { return true; } AntiKnockbackHelper.PlayResistEffects(component); return false; } } [HarmonyPatch(typeof(SilenceHandler), "RPCA_AddSilence")] public class AntiSilencePatch { private static float lastEffectTime; private const float EFFECT_COOLDOWN = 0.15f; public static bool Prefix(SilenceHandler __instance, float __0) { Player component = ((Component)__instance).GetComponent<Player>(); if ((Object)(object)component != (Object)null && (Object)(object)((Component)component).GetComponent<AntiSilenceMono>() != (Object)null) { PlayResistEffect(component); return false; } return true; } private static void PlayResistEffect(Player player) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) if (!(Time.time - lastEffectTime < 0.15f)) { lastEffectTime = Time.time; Color color = default(Color); ((Color)(ref color))..ctor(0.6f, 0.6f, 1f, 1f); ShieldEffect.PlayShieldEffect(player, color); } } } } namespace MrFuntikMod.Effects { public class AegisShieldMono : MonoBehaviour { [CompilerGenerated] private sealed class <OnPointStart>d__21 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public IGameModeHandler gm; public AegisShieldMono <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OnPointStart>d__21(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; <>4__this.ResetState(); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const float BASE_SHIELD_DURATION = 3f; private const float BASE_COOLDOWN = 15f; private const float DURATION_PER_STACK = 1f; private const float COOLDOWN_REDUCTION_PER_STACK = 2f; public int stackCount = 1; private Player player; private Block block; private CharacterData data; private bool isShieldActive = false; private float shieldTimer = 0f; private float currentShieldDuration = 0f; private float cooldownRemaining = 0f; private bool isReady = true; private Action<BlockTriggerType> blockAction; private GameObject shieldVisual; private LineRenderer shieldRenderer; private CooldownUI cooldownUI; private static Material sharedMaterial; public static bool IsShieldActiveForPlayer(Player player) { if ((Object)(object)player == (Object)null || (Object)(object)player.data == (Object)null || player.data.dead) { return false; } AegisShieldMono component = ((Component)player).gameObject.GetComponent<AegisShieldMono>(); return (Object)(object)component != (Object)null && component.isShieldActive; } private void Start() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) player = ((Component)this).GetComponent<Player>(); block = ((Component)this).GetComponent<Block>(); data = ((Component)this).GetComponent<CharacterData>(); if ((Object)(object)sharedMaterial == (Object)null) { sharedMaterial = new Material(Shader.Find("Sprites/Default")); } blockAction = OnBlock; block.BlockAction = (Action<BlockTriggerType>)Delegate.Combine(block.BlockAction, blockAction); CreateShieldVisual(); if (data.view.IsMine) { cooldownUI = CooldownUI.Create(((Component)this).transform, 1f); cooldownUI.SetIcon("O", (Color?)new Color(0.2f, 0.8f, 1f)); } GameModeManager.AddHook("PointStart", (Func<IGameModeHandler, IEnumerator>)OnPointStart); if ((Object)(object)data.healthHandler != (Object)null) { HealthHandler healthHandler = data.healthHandler; healthHandler.reviveAction = (Action)Delegate.Combine(healthHandler.reviveAction, new Action(OnRevive)); } } private void OnRevive() { ResetState(); } [IteratorStateMachine(typeof(<OnPointStart>d__21))] private IEnumerator OnPointStart(IGameModeHandler gm) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <OnPointStart>d__21(0) { <>4__this = this, gm = gm }; } private void Update() { if ((Object)(object)player == (Object)null || (Object)(object)data == (Object)null) { return; } if (data.dead) { CooldownUI obj = cooldownUI; if (obj != null) { obj.Hide(); } if ((Object)(object)shieldVisual != (Object)null && shieldVisual.activeSelf) { shieldVisual.SetActive(false); } return; } if (!isReady && cooldownRemaining > 0f) { cooldownRemaining -= Time.deltaTime; if (cooldownRemaining <= 0f) { cooldownRemaining = 0f; isReady = true; } } if (isShieldActive) { shieldTimer += TimeHandler.deltaTime; if (shieldTimer < currentShieldDuration) { block.sinceBlock = 0f; UpdateShieldVisual(); } else { DeactivateShield(); } } UpdateUI(); } private void OnBlock(BlockTriggerType triggerType) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 if ((int)triggerType <= 0 && isReady && !isShieldActive && !((Object)(object)data == (Object)null) && !data.dead && data.view.IsMine) { ActivateShieldLocal(); NetworkingManager.RPC(typeof(AegisShieldMono), "RPC_ActivateShield", new object[1] { player.playerID }); } } [UnboundRPC] public static void RPC_ActivateShield(int playerID) { Player val = ((IEnumerable<Player>)PlayerManager.instance.players).FirstOrDefault((Func<Player, bool>)((Player p) => p.playerID == playerID)); if (!((Object)(object)val == (Object)null)) { ((Component)val).GetComponent<AegisShieldMono>()?.ActivateShieldLocal(); } } private void ActivateShieldLocal() { currentShieldDuration = GetShieldDuration(); isShieldActive = true; shieldTimer = 0f; isReady = false; cooldownRemaining = GetCooldown(); if ((Object)(object)shieldVisual != (Object)null) { shieldVisual.SetActive(true); } } private void DeactivateShield() { isShieldActive = false; shieldTimer = 0f; currentShieldDuration = 0f; if ((Object)(object)shieldVisual != (Object)null) { shieldVisual.SetActive(false); } } private float GetShieldDuration() { return 3f + (float)(stackCount - 1) * 1f; } private float GetCooldown() { return Mathf.Max(15f - (float)(stackCount - 1) * 2f, 5f); } public float GetShieldTimeRemaining() { return isShieldActive ? Mathf.Max(0f, currentShieldDuration - shieldTimer) : 0f; } public void AddStack() { stackCount++; } public void RemoveStack() { stackCount--; } private void ResetState() { isShieldActive = false; shieldTimer = 0f; currentShieldDuration = 0f; cooldownRemaining = 0f; isReady = true; if ((Object)(object)shieldVisual != (Object)null) { shieldVisual.SetActive(false); } CooldownUI obj = cooldownUI; if (obj != null) { obj.Hide(); } } private void CreateShieldVisual() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) shieldVisual = new GameObject("AegisShield"); shieldVisual.transform.SetParent(((Component)this).transform); shieldVisual.transform.localPosition = Vector3.zero; shieldRenderer = shieldVisual.AddComponent<LineRenderer>(); shieldRenderer.useWorldSpace = false; shieldRenderer.loop = true; shieldRenderer.startWidth = 0.15f; shieldRenderer.endWidth = 0.15f; shieldRenderer.positionCount = 36; ((Renderer)shieldRenderer).material = sharedMaterial; ((Renderer)shieldRenderer).sortingLayerName = "MostFront"; ((Renderer)shieldRenderer).sortingOrder = 100; for (int i = 0; i < 36; i++) { float num = (float)i / 36f * MathF.PI * 2f; shieldRenderer.SetPosition(i, new Vector3(Mathf.Cos(num), Mathf.Sin(num), 0f)); } shieldVisual.SetActive(false); } private void UpdateShieldVisual() { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)shieldRenderer == (Object)null)) { float shieldTimeRemaining = GetShieldTimeRemaining(); float num = shieldTimeRemaining / currentShieldDuration; float num2 = 1f + Mathf.Sin(Time.time * 8f) * 0.1f; float num3 = 1.2f * num2; for (int i = 0; i < 36; i++) { float num4 = (float)i / 36f * MathF.PI * 2f; shieldRenderer.SetPosition(i, new Vector3(Mathf.Cos(num4) * num3, Mathf.Sin(num4) * num3, 0f)); } Color val = ((!(num > 0.5f)) ? Color.Lerp(new Color(1f, 1f, 0.3f, 0.8f), new Color(1f, 0.3f, 0.3f, 0.8f), (0.5f - num) * 2f) : Color.Lerp(new Color(0.2f, 0.8f, 1f, 0.8f), new Color(1f, 1f, 0.3f, 0.8f), (1f - num) * 2f)); if (shieldTimeRemaining <= 1f) { float num5 = Mathf.Sin(Time.time * 20f) * 0.5f + 0.5f; val.a *= num5; } shieldRenderer.startColor = val; shieldRenderer.endColor = val; } } private void UpdateUI() { if (!((Object)(object)cooldownUI == (Object)null)) { if (!isReady && cooldownRemaining > 0f) { cooldownUI.ShowCooldown(cooldownRemaining, GetCooldown()); } else if (isShieldActive) { cooldownUI.ShowActive(GetShieldTimeRemaining()); } else { cooldownUI.Hide(); } } } private void OnDestroy() { if ((Object)(object)block != (Object)null && blockAction != null) { block.BlockAction = (Action<BlockTriggerType>)Delegate.Remove(block.BlockAction, blockAction); } if ((Object)(object)data != (Object)null && (Object)(object)data.healthHandler != (Object)null) { HealthHandler healthHandler = data.healthHandler; healthHandler.reviveAction = (Action)Delegate.Remove(healthHandler.reviveAction, new Action(OnRevive)); } GameModeManager.RemoveHook("PointStart", (Func<IGameModeHandler, IEnumerator>)OnPointStart); if ((Object)(object)shieldVisual != (Object)null) { Object.Destroy((Object)(object)shieldVisual); } if ((Object)(object)cooldownUI != (Object)null) { Object.Destroy((Object)(object)((Component)cooldownUI).gameObject); } } } public class ArcFieldMono : MonoBehaviour { private const float RADIUS_BONUS = 3f; private const float DAMAGE_MULTIPLIER = 0.01f; private const float BASE_BULLET_DAMAGE = 55f; private const float TICK_INTERVAL = 0.15f; private const float ARC_DURATION = 0.15f; private Player player; private CharacterData data; private PhotonView view; private float nextTickTime; private float currentRadius; private Player[] cachedPlayers; private float lastPlayerCacheTime; private const float PLAYER_CACHE_INTERVAL = 0.5f; private static Material sharedMaterial; private List<LineRenderer> ambientArcs = new List<LineRenderer>(); private const int AMBIENT_ARC_COUNT = 4; private float ambientUpdateInterval = 0.07f; private float lastAmbientUpdate; private static int wallLayerMask = -1; private static bool wallLayerMaskInitialized = false; private void Start() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown player = ((Component)this).GetComponent<Player>(); data = ((Component)this).GetComponent<CharacterData>(); view = player?.data?.view; if ((Object)(object)sharedMaterial == (Object)null) { sharedMaterial = new Material(Shader.Find("Sprites/Default")); } if (!wallLayerMaskInitialized) { wallLayerMask = LayerMask.GetMask(new string[3] { "Default", "Obstacle", "IgnorePlayer" }); if (wallLayerMask == 0) { wallLayerMask = ~LayerMask.GetMask(new string[2] { "Player", "PlayerObjectCollider" }); } wallLayerMaskInitialized = true; } UpdatePlayerCache(); nextTickTime = Time.time + 0.15f; CreateAmbientArcs(); } private void Update() { if ((Object)(object)player == (Object)null || (Object)(object)data == (Object)null || !data.isPlaying || data.dead) { return; } UpdateRadius(); if (Time.time - lastPlayerCacheTime > 0.5f) { UpdatePlayerCache(); } UpdateAmbientArcs(); if (Time.time >= nextTickTime) { if ((Object)(object)view != (Object)null && view.IsMine) { DamageNearbyEnemies(); } nextTickTime = Time.time + 0.15f; } } private void UpdateRadius() { //IL_0035: 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) float num = 1f; if ((Object)(object)data.stats != (Object)null) { num = data.stats.sizeMultiplier; } float num2 = Mathf.Max(((Component)this).transform.localScale.x, ((Component)this).transform.localScale.y); if (num2 > num) { num = num2; } currentRadius = num + 3f; } private float GetPlayerBulletDamage() { if ((Object)(object)player?.data?.weaponHandler?.gun != (Object)null) { return player.data.weaponHandler.gun.damage * 55f; } return 55f; } private void UpdatePlayerCache() { if ((Object)(object)PlayerManager.instance != (Object)null && PlayerManager.instance.players != null) { cachedPlayers = PlayerManager.instance.players.ToArray(); } lastPlayerCacheTime = Time.time; } private void DamageNearbyEnemies() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) if (cachedPlayers == null) { return; } Vector3 position = ((Component)this).transform.position; float playerBulletDamage = GetPlayerBulletDamage(); float num = playerBulletDamage * 0.01f; for (int i = 0; i < cachedPlayers.Length; i++) { Player val = cachedPlayers[i]; if (IsValidTarget(val)) { Vector3 position2 = ((Component)val).transform.position; float num2 = Vector2.Distance(Vector2.op_Implicit(position), Vector2.op_Implicit(position2)); if (num2 <= currentRadius && HasLineOfSight(position, position2)) { Vector3 val2 = position2 - position; Vector2 val3 = Vector2.op_Implicit(((Vector3)(ref val2)).normalized); ((Damagable)val.data.healthHandler).CallTakeDamage(val3 * num, Vector2.op_Implicit(position), (GameObject)null, player, true); NetworkingManager.RPC(typeof(ArcFieldMono), "RPCA_CreateLightningArc", new object[2] { player.playerID, val.playerID }); } } } } private bool IsValidTarget(Player targetPlayer) { if ((Object)(object)targetPlayer == (Object)null) { return false; } if (targetPlayer.playerID == player.playerID) { return false; } if (targetPlayer.teamID == player.teamID) { return false; } if ((Object)(object)targetPlayer.data == (Object)null) { return false; } if (targetPlayer.data.dead) { return false; } if (!targetPlayer.data.isPlaying) { return false; } return true; } private bool HasLineOfSight(Vector3 from, Vector3 to) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_002e: Unknown result type (might be due to invalid IL or missing references) Vector2 val = Vector2.op_Implicit(to - from); float magnitude = ((Vector2)(ref val)).magnitude; RaycastHit2D val2 = Physics2D.Raycast(Vector2.op_Implicit(from), ((Vector2)(ref val)).normalized, magnitude, wallLayerMask); return (Object)(object)((RaycastHit2D)(ref val2)).collider == (Object)null; } [UnboundRPC] public static void RPCA_CreateLightningArc(int ownerPlayerID, int targetPlayerID) { //IL_006e: 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) Player val = PlayerManager.instance.players.Find((Player p) => p.playerID == ownerPlayerID); Player val2 = PlayerManager.instance.players.Find((Player p) => p.playerID == targetPlayerID); if (!((Object)(object)val == (Object)null) && !((Object)(object)val2 == (Object)null)) { CreateLightningArcVisual(((Component)val).transform.position, ((Component)val2).transform.position); ArcFieldMono component = ((Component)val).GetComponent<ArcFieldMono>(); if ((Object)(object)component != (Object)null) { component.BoostAmbientArcs(); } } } private static void CreateLightningArcVisual(Vector3 start, Vector3 end) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("ArcField_Lightning"); val.transform.position = start; LineRenderer val2 = val.AddComponent<LineRenderer>(); val2.startWidth = 0.12f; val2.endWidth = 0.05f; val2.positionCount = 5; if ((Object)(object)sharedMaterial == (Object)null) { sharedMaterial = new Material(Shader.Find("Sprites/Default")); } ((Renderer)val2).material = sharedMaterial; val2.startColor = new Color(0.4f, 0.75f, 1f, 1f); val2.endColor = new Color(0.85f, 0.95f, 1f, 0.8f); ((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val2).receiveShadows = false; val2.SetPosition(0, start); for (int i = 1; i < val2.positionCount - 1; i++) { float num = (float)i / (float)(val2.positionCount - 1); Vector3 val3 = Vector3.Lerp(start, end, num); val3 += Vector2.op_Implicit(Random.insideUnitCircle) * 0.35f; val2.SetPosition(i, val3); } val2.SetPosition(val2.positionCount - 1, end); ArcFieldLightningDestroy arcFieldLightningDestroy = val.AddComponent<ArcFieldLightningDestroy>(); arcFieldLightningDestroy.lifetime = 0.15f; } private void CreateAmbientArcs() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < 4; i++) { GameObject val = new GameObject($"ArcField_Ambient_{i}"); val.transform.SetParent(((Component)this).transform); val.transform.localPosition = Vector3.zero; LineRenderer val2 = val.AddComponent<LineRenderer>(); val2.startWidth = 0.06f; val2.endWidth = 0.02f; val2.positionCount = 3; ((Renderer)val2).material = sharedMaterial; val2.startColor = new Color(0.5f, 0.8f, 1f, 0.5f); val2.endColor = new Color(0.85f, 0.95f, 1f, 0.25f); ((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val2).receiveShadows = false; ambientArcs.Add(val2); } } private void UpdateAmbientArcs() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) if (Time.time - lastAmbientUpdate < ambientUpdateInterval) { return; } lastAmbientUpdate = Time.time; Vector3 position = ((Component)this).transform.position; float num = Mathf.Min(1.2f, currentRadius * 0.2f); Vector3 val2 = default(Vector3); for (int i = 0; i < ambientArcs.Count; i++) { LineRenderer val = ambientArcs[i]; if (!((Object)(object)val == (Object)null)) { for (int j = 0; j < val.positionCount; j++) { float num2 = Random.Range(0f, 360f) * (MathF.PI / 180f); float num3 = Random.Range(num * 0.4f, num); ((Vector3)(ref val2))..ctor(Mathf.Cos(num2) * num3, Mathf.Sin(num2) * num3, 0f); val.SetPosition(j, position + val2); } } } } private void BoostAmbientArcs() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < ambientArcs.Count; i++) { LineRenderer val = ambientArcs[i]; if (!((Object)(object)val == (Object)null)) { val.startColor = new Color(0.5f, 0.85f, 1f, 0.95f); val.endColor = new Color(0.9f, 0.95f, 1f, 0.75f); val.startWidth = 0.1f; } } ((MonoBehaviour)this).Invoke("ResetAmbientArcs", 0.12f); } private void ResetAmbientArcs() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < ambientArcs.Count; i++) { LineRenderer val = ambientArcs[i]; if (!((Object)(object)val == (Object)null)) { val.startColor = new Color(0.5f, 0.8f, 1f, 0.5f); val.endColor = new Color(0.85f, 0.95f, 1f, 0.25f); val.startWidth = 0.06f; } } } private void OnDestroy() { for (int i = 0; i < ambientArcs.Count; i++) { if ((Object)(object)ambientArcs[i] != (Object)null) { Object.Destroy((Object)(object)((Component)ambientArcs[i]).gameObject); } } ambientArcs.Clear(); } } public class ArcFieldLightningDestroy : MonoBehaviour { public float lifetime = 0.15f; private float timer = 0f; private LineRenderer lineRenderer; private Color startColorInitial; private Color endColorInitial; private void Start() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) lineRenderer = ((Component)this).GetComponent<LineRenderer>(); if ((Object)(object)lineRenderer != (Object)null) { startColorInitial = lineRenderer.startColor; endColorInitial = lineRenderer.endColor; } } private void Update() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) timer += Time.deltaTime; if ((Object)(object)lineRenderer != (Object)null) { float num = 1f - timer / lifetime; lineRenderer.startColor = new Color(startColorInitial.r, startColorInitial.g, startColorInitial.b, startColorInitial.a * num); lineRenderer.endColor = new Color(endColorInitial.r, endColorInitial.g, endColorInitial.b, endColorInitial.a * num); } if (timer >= lifetime) { Object.Destroy((Object)(object)((Component)this).gameObject); } } } public class BacktrackMono : MonoBehaviour { private struct Snapshot { public Vector3 position; public float time; } [CompilerGenerated] private sealed class <OnPointStart>d__23 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public IGameModeHandler gm; public BacktrackMono <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OnPointStart>d__23(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; <>4__this.ResetState(); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const float BACKTRACK_TIME = 3f; private const float BASE_COOLDOWN = 15f; private const float COOLDOWN_REDUCTION_PER_STACK = 2f; private const float RECORD_INTERVAL = 0.05f; private const float HISTORY_DURATION = 4f; public int stackCount = 1; private Player player; private Block block; private CharacterData data; private float cooldownRemaining = 0f; private bool isReady = true; private float lastRecordTime = 0f; private LinkedList<Snapshot> history = new LinkedList<Snapshot>(); private Action<BlockTriggerType> blockAction; private CooldownUI cooldownUI; private GameObject backtrackPreview; private SpriteRenderer previewSprite; private static Material ghostMaterial; public bool IsHolding => false; private void Start() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_00c7: Unknown result type (might be due to invalid IL or missing references) player = ((Component)this).GetComponent<Player>(); block = ((Component)this).GetComponent<Block>(); data = ((Component)this).GetComponent<CharacterData>(); if ((Object)(object)ghostMaterial == (Object)null) { ghostMaterial = new Material(Shader.Find("Sprites/Default")); } blockAction = OnBlock; block.BlockAction = (Action<BlockTriggerType>)Delegate.Combine(block.BlockAction, blockAction); if (data.view.IsMine) { cooldownUI = CooldownUI.Create(((Component)this).transform, 1f); cooldownUI.SetIcon("<", (Color?)new Color(0.5f, 0.8f, 1f)); CreateBacktrackPreview(); } GameModeManager.AddHook("PointStart", (Func<IGameModeHandler, IEnumerator>)OnPointStart); if ((Object)(object)data.healthHandler != (Object)null) { HealthHandler healthHandler = data.healthHandler; healthHandler.reviveAction = (Action)Delegate.Combine(healthHandler.reviveAction, new Action(OnRevive)); } } private void OnRevive() { ResetState(); } [IteratorStateMachine(typeof(<OnPointStart>d__23))] private IEnumerator OnPointStart(IGameModeHandler gm) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <OnPointStart>d__23(0) { <>4__this = this, gm = gm }; } private void Update() { if ((Object)(object)player == (Object)null || (Object)(object)data == (Object)null) { HideAllUI(); return; } if (data.dead) { HideAllUI(); return; } if (Time.time - lastRecordTime >= 0.05f) { RecordSnapshot(); lastRecordTime = Time.time; } CleanOldHistory(); if (!isReady) { cooldownRemaining -= Time.deltaTime; if (cooldownRemaining <= 0f) { cooldownRemaining = 0f; isReady = true; } } if (data.view.IsMine) { UpdateUI(); UpdateBacktrackPreview(); } } private void OnDisable() { HideAllUI(); } private void HideAllUI() { CooldownUI obj = cooldownUI; if (obj != null) { obj.Hide(); } if ((Object)(object)backtrackPreview != (Object)null) { backtrackPreview.SetActive(false); } } private void ResetState() { history?.Clear(); cooldownRemaining = 0f; isReady = true; lastRecordTime = 0f; HideAllUI(); } private void RecordSnapshot() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)data == (Object)null) && history != null) { history.AddLast(new Snapshot { position = ((Component)this).transform.position, time = Time.time }); } } private void CleanOldHistory() { if (history != null) { float num = Time.time - 4f; while (history.Count > 0 && history.First.Value.time < num) { history.RemoveFirst(); } } } private void OnBlock(BlockTriggerType triggerType) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Invalid comparison between Unknown and I4 //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)data == (Object)null) && !data.dead && isReady && data.view.IsMine && (int)triggerType <= 0 && history != null && history.Count != 0) { float num = Time.time - 3f; float time = history.First.Value.time; float targetTime = Mathf.Max(num, time); Snapshot? snapshot = FindSnapshotAtTime(targetTime); if (snapshot.HasValue && !(Vector3.Distance(((Component)this).transform.position, snapshot.Value.positio