Decompiled source of MFM v1.1.8
MrFuntikMod.dll
Decompiled 3 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using CardChoiceSpawnUniqueCardPatch.CustomCategories; using CardThemeLib; using ClassesManagerReborn; using ClassesManagerReborn.Util; using CooldownUILib; using HarmonyLib; using Jotunn.Utils; using Microsoft.CodeAnalysis; using ModdingUtils.Extensions; using ModdingUtils.MonoBehaviours; using MrFuntikMod.Cards; using MrFuntikMod.Effects; using MrFuntikMod.Extensions; using MrFuntikMod.Patches; using MrFuntikMod.RoundsEffects; using Photon.Pun; using RarityLib.Utils; using Sonigon; using Sonigon.Internal; 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("MrFuntikMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+998646ed6b56f8f2ec20593584750379446b3511")] [assembly: AssemblyProduct("MrFuntikMod")] [assembly: AssemblyTitle("MrFuntikMod")] [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 MFM.Mono { public class MaxHealthEffect : ReversibleEffect { private bool active; private ColorEffect colorEffect; private Color color = Color.clear; public override void OnAwake() { ((ReversibleEffect)this).SetLivesToEffect(int.MaxValue); } public override void OnStart() { base.applyImmediately = false; active = false; } public override void OnUpdate() { if (HealthInRange()) { ((ReversibleEffect)this).ApplyModifiers(); } else if (((ReversibleEffect)this).modifiersActive && !HealthInRange()) { ((ReversibleEffect)this).ClearModifiers(false); } if (!active && HealthInRange()) { ApplyColorEffect(); active = true; } else if (active && !HealthInRange()) { if ((Object)(object)colorEffect != (Object)null) { Object.Destroy((Object)(object)colorEffect); } active = false; } } private void ApplyColorEffect() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) if (color != Color.clear) { colorEffect = ((Component)base.player).gameObject.AddComponent<ColorEffect>(); colorEffect.SetColor(color); Debug.Log((object)"color is set!"); } } private bool HealthInRange() { return (double)base.data.health == (double)base.data.maxHealth; } public override void OnOnDisable() { ((ReversibleEffect)this).ClearModifiers(false); active = false; } public override void OnOnDestroy() { } public void SetColor(Color color) { //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) this.color = color; } } } namespace MrFuntikMod { internal class Assets { private static readonly AssetBundle Bundle = AssetUtils.LoadAssetBundleFromResources("myasset", typeof(MrFuntikMod).Assembly); public static GameObject CHESS_KNIGHT_Art = Bundle.LoadAsset<GameObject>("C_CHESS_KNIGHT"); public static GameObject Narcissism_Art = Bundle.LoadAsset<GameObject>("C_narcissism"); public static GameObject CHESS_PAWN_Art = Bundle.LoadAsset<GameObject>("C_CHESS_PAWN"); public static GameObject CHESS_ROOK_Art = Bundle.LoadAsset<GameObject>("C_CHESS_ROOK"); public static GameObject CHESS_BISHOP_Art = Bundle.LoadAsset<GameObject>("C_CHESS_BISHOP"); public static GameObject unstable_gun_Art = Bundle.LoadAsset<GameObject>("C_unstable_gun"); public static GameObject NecroCardArt = Bundle.LoadAsset<GameObject>("C_necro_card"); public static GameObject Necro2CardArt = Bundle.LoadAsset<GameObject>("C_necro2_card"); public static GameObject Necro3CardArt = Bundle.LoadAsset<GameObject>("C_necro3_card"); public static GameObject CHESS_QUEEN_Art = Bundle.LoadAsset<GameObject>("C_CHESS_QUEEN"); public static GameObject VampireCastleArt = Bundle.LoadAsset<GameObject>("C_VAMPIRE_CASTLE"); public static GameObject OneShotMan_Art = Bundle.LoadAsset<GameObject>("C_ONESHOT_MAN"); public static GameObject DrillHands_Art = Bundle.LoadAsset<GameObject>("C_DRILL_HANDS"); public static GameObject BounceConverter_Art = Bundle.LoadAsset<GameObject>("C_BOUNCE_CONVERTER"); public static GameObject PhenomenalBalance_Art = Bundle.LoadAsset<GameObject>("C_PHENOMENAL_BALANCE"); public static GameObject BalanceBlock_Art = Bundle.LoadAsset<GameObject>("C_BALANCE_BLOCK"); public static GameObject BalanceTank_Art = Bundle.LoadAsset<GameObject>("C_BALANCE_TANK"); public static GameObject BalanceHitman_Art = Bundle.LoadAsset<GameObject>("C_BALANCE_HITMAN"); public static GameObject BalanceBullets_Art = Bundle.LoadAsset<GameObject>("C_BALANCE_BULLETS"); public static GameObject BalanceMayhem_Art = Bundle.LoadAsset<GameObject>("C_BALANCE_MAYHEM"); public static GameObject BalanceSpeed_Art = Bundle.LoadAsset<GameObject>("C_BALANCE_SPEED"); public static GameObject BalanceReload_Art = Bundle.LoadAsset<GameObject>("C_BALANCE_RELOAD"); public static GameObject ThunderCode_Art = Bundle.LoadAsset<GameObject>("C_THUNDER_CORE"); public static GameObject EarthSpears_Art = Bundle.LoadAsset<GameObject>("C_EARTHSPEARS"); public static GameObject Dancer_Art = Bundle.LoadAsset<GameObject>("C_DANCER"); public static GameObject Momentum_Art = Bundle.LoadAsset<GameObject>("C_MOMENTUM"); public static GameObject Aegis_Art = Bundle.LoadAsset<GameObject>("C_AEGIS"); public static GameObject Immunize_Art = Bundle.LoadAsset<GameObject>("C_IMMUNIZE"); public static GameObject Rooted_Art = Bundle.LoadAsset<GameObject>("C_ROOTED"); public static GameObject SonicRiot_Art = Bundle.LoadAsset<GameObject>("C_SONIC_RIOT"); public static GameObject ControlledFire_Art = Bundle.LoadAsset<GameObject>("C_CONTROLLED_FIRE"); public static GameObject Unstoppable_Art = Bundle.LoadAsset<GameObject>("C_UNSTOPPABLE"); public static GameObject SaferyDetonator_Art = Bundle.LoadAsset<GameObject>("C_SAFETY_DETONATOR"); public static GameObject AntiRadar_Art = Bundle.LoadAsset<GameObject>("C_ANTI_RADAR"); public static AudioClip DemRes1 = Bundle.LoadAsset<AudioClip>("dem_res_1"); public static AudioClip DemRes2 = Bundle.LoadAsset<AudioClip>("dem_rev_2"); public static AudioClip DemRes3 = Bundle.LoadAsset<AudioClip>("dem_res_3"); public static AudioClip DemRes4 = Bundle.LoadAsset<AudioClip>("dem_res_4"); public static AudioClip DemRes5 = Bundle.LoadAsset<AudioClip>("dem_res_pontiff"); } 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 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); } } } } [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.MrseFuntik.Rounds.MFM", "MrFuntikMod", "1.1.0")] [BepInProcess("Rounds.exe")] public class MrFuntikMod : BaseUnityPlugin { [CompilerGenerated] private sealed class <GameStart>d__22 : 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; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <GameStart>d__22(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>s__1 = default(List<Player>.Enumerator); <player>5__2 = 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 (!CharacterStatModifiersExtension.GetAdditionalData(<player>5__2.data.stats).blacklistedCategories.Contains(NecroCard2)) { CharacterStatModifiersExtension.GetAdditionalData(<player>5__2.data.stats).blacklistedCategories.Add(NecroCard2); } if (!CharacterStatModifiersExtension.GetAdditionalData(<player>5__2.data.stats).blacklistedCategories.Contains(NecroCard3)) { CharacterStatModifiersExtension.GetAdditionalData(<player>5__2.data.stats).blacklistedCategories.Add(NecroCard3); } if (!CharacterStatModifiersExtension.GetAdditionalData(<player>5__2.data.stats).blacklistedCategories.Contains(BalanceCard)) { CharacterStatModifiersExtension.GetAdditionalData(<player>5__2.data.stats).blacklistedCategories.Add(BalanceCard); } ((Component)<player>5__2).gameObject.AddComponent<MFMBalanceMono>(); 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); } <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.MrseFuntik.Rounds.MFM"; private const string ModName = "MrFuntikMod"; public const string Version = "1.1.0"; public const string ModInitials = "MFM"; internal static List<CardInfo> hiddenCards = new List<CardInfo>(); internal static CardCategory NonBalanceCard; internal static CardCategory BalanceCard; internal static CardCategory NonNecroCard; internal static CardCategory NecroCard2; internal static CardCategory NecroCard3; internal static CardCategory ImmunityMasterCategory; internal static CardCategory ArcFieldCategory; internal static CardCategory NonImmunityCards; internal static CardCategory ImmunityCards; private Harmony harmony; public static MrFuntikMod instance { get; private set; } private static void Main() { } private void Awake() { //IL_001a: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown 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) }); RarityUtils.AddRarity("NecroCards", 0.11f, new Color(0.96f, 0.188f, 0.188f), new Color(0.96f, 0.188f, 0.188f)); harmony = new Harmony("com.MrseFuntik.Rounds.MFM"); harmony.PatchAll(); } private void Start() { AntiSlowExternalModsPatch.ApplyPatches(harmony); NonNecroCard = CustomCardCategories.instance.CardCategory("NonNecroCard"); NecroCard2 = CustomCardCategories.instance.CardCategory("NecroCard2"); NecroCard3 = CustomCardCategories.instance.CardCategory("NecroCard3"); NonBalanceCard = CustomCardCategories.instance.CardCategory("NonBalanceCard"); BalanceCard = CustomCardCategories.instance.CardCategory("BalanceCard"); ImmunityMasterCategory = CustomCardCategories.instance.CardCategory("ImmunityMasterCategory"); ArcFieldCategory = CustomCardCategories.instance.CardCategory("ArcFieldCategory"); NonImmunityCards = CustomCardCategories.instance.CardCategory("NonImmunityCards"); ImmunityCards = CustomCardCategories.instance.CardCategory("ImmunityCards"); instance = this; CustomCard.BuildCard<ChessPawn>(); CustomCard.BuildCard<ChessKnightCard>(); CustomCard.BuildCard<ChessRookCard>(); CustomCard.BuildCard<ChessBishopCard>(); CustomCard.BuildCard<ChessQueenCard>(); CustomCard.BuildCard<NARCISSISM>(); CustomCard.BuildCard<UnstableGunCard>(); CustomCard.BuildCard<VampireCastleCard>(); CustomCard.BuildCard<OneShotManCard>(); CustomCard.BuildCard<DrillHands>(); CustomCard.BuildCard<BounceConverter>(); CustomCard.BuildCard<PhenomenalBalance>(); CustomCard.BuildCard<BalanceBlock>(); CustomCard.BuildCard<BalanceHitman>(); CustomCard.BuildCard<BalanceBullets>(); CustomCard.BuildCard<BalanceMayhem>(); CustomCard.BuildCard<BalanceReload>(); CustomCard.BuildCard<BalanceSpeed>(); CustomCard.BuildCard<BalanceTank>(); CustomCard.BuildCard<Necronomicon_I>(); CustomCard.BuildCard<Necronomicon_II>(); CustomCard.BuildCard<Necronomicon_II_b>(); CustomCard.BuildCard<Necronomicon_II_c>(); CustomCard.BuildCard<Necronomicon_II_d>(); CustomCard.BuildCard<Necronomicon_II_e>(); CustomCard.BuildCard<Necronomicon_III>(); CustomCard.BuildCard<Necronomicon_III_b>(); CustomCard.BuildCard<Necronomicon_III_c>(); CustomCard.BuildCard<Necronomicon_III_d>(); CustomCard.BuildCard<Necronomicon_III_e>(); CustomCard.BuildCard<ThunderCoreCard>(); CustomCard.BuildCard<EarthspearsCard>(); CustomCard.BuildCard<DancerCard>(); CustomCard.BuildCard<AegisCard>(); CustomCard.BuildCard<ImmunizeCard>(); CustomCard.BuildCard<MomentumCard>(); CustomCard.BuildCard<UnstoppableCard>(); CustomCard.BuildCard<RootedCard>(); CustomCard.BuildCard<SonicRiotCard>(); CustomCard.BuildCard<SafetyDetonatorCard>(); CustomCard.BuildCard<AntiRadarCard>(); CustomCard.BuildCard<ControlledFireCard>((Action<CardInfo>)delegate(CardInfo cardInfo) { ControlledFireCard.cardInfoSelf = cardInfo; }); GameModeManager.AddHook("PlayerPickEnd", (Func<IGameModeHandler, IEnumerator>)((IGameModeHandler gm) => PhenomenalBalance.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(NecroCard2) && !value.cardInfo.categories.Contains(NecroCard3)) { value.cardInfo.categories = CollectionExtensions.AddToArray<CardCategory>(value.cardInfo.categories, NonNecroCard); } if (!value.cardInfo.categories.Contains(BalanceCard)) { value.cardInfo.categories = CollectionExtensions.AddToArray<CardCategory>(value.cardInfo.categories, NonBalanceCard); } if (!value.cardInfo.categories.Contains(ImmunityCards)) { value.cardInfo.categories = CollectionExtensions.AddToArray<CardCategory>(value.cardInfo.categories, NonImmunityCards); } } }); } [IteratorStateMachine(typeof(<GameStart>d__22))] private IEnumerator GameStart(IGameModeHandler gm) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <GameStart>d__22(0) { <>4__this = this, gm = gm }; } } } 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 FriendlyBulletsDealtDamageEffect : 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(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)"[MFM] 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(); } } } } [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); } } } [Serializable] [HarmonyPatch(typeof(Block), "blocked")] internal class BlockPatchblocked { private static void Prefix(Block __instance, GameObject projectile, Vector3 forward, Vector3 hitPos) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) bool flag = false; ProjectileHit component = projectile.GetComponent<ProjectileHit>(); HealthHandler val = (HealthHandler)Traverse.Create((object)__instance).Field("health").GetValue(); if ((double)component.ownPlayer.data.stats.GetAdditionalData().piercingDamage > 0.0) { Vector2 val2 = Vector2.op_Implicit((component.bulletCanDealDeamage ? component.damage : 1f) * component.ownPlayer.data.stats.GetAdditionalData().piercingDamage * ((Vector3)(ref forward)).normalized); ((Damagable)val).TakeDamage(val2, Vector2.op_Implicit(hitPos), component.projectileColor, component.ownWeapon, component.ownPlayer, true, true); flag = true; } if (flag) { Object.Destroy((Object)(object)projectile); } } private static void Postfix(Block __instance) { __instance.GetAdditionalData().timeOfLastSuccessfulBlock = Time.time; } } } 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 DancerMono : MonoBehaviour { [CompilerGenerated] private sealed class <OnPointStart>d__7 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public IGameModeHandler gm; public DancerMono <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OnPointStart>d__7(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.ResetForNewRound(); 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_DODGE_CHANCE = 0.2f; private const float DODGE_CHANCE_PER_STACK = 0.2f; private const float MAX_DODGE_CHANCE = 0.6f; public int stackCount = 1; private Player player; private void Start() { player = ((Component)this).GetComponent<Player>(); GameModeManager.AddHook("PointStart", (Func<IGameModeHandler, IEnumerator>)OnPointStart); } private void OnDestroy() { GameModeManager.RemoveHook("PointStart", (Func<IGameModeHandler, IEnumerator>)OnPointStart); } [IteratorStateMachine(typeof(<OnPointStart>d__7))] private IEnumerator OnPointStart(IGameModeHandler gm) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <OnPointStart>d__7(0) { <>4__this = this, gm = gm }; } public float GetDodgeChance() { float num = 0.2f + (float)(stackCount - 1) * 0.2f; return Mathf.Min(num, 0.6f); } public bool TryDodge() { if (!CanDodge()) { return false; } float value = Random.value; float dodgeChance = GetDodgeChance(); return value < dodgeChance; } public bool CanDodge() { if ((Object)(object)player == (Object)null) { return false; } if ((Object)(object)player.data == (Object)null) { return false; } if (player.data.health <= 0f) { return false; } if (player.data.dead) { return false; } if (!((Component)player).gameObject.activeInHierarchy) { return false; } return true; } public void ShowMissText() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) if (CanDodge()) { Vector3 position = ((Component)player).transform.position + new Vector3(Random.Range(-0.3f, 0.3f), 0.5f, 0f); TextEffectPool<MissTextEffect>.Show(position); } } public void AddStack() { stackCount++; } public void RemoveStack() { stackCount--; } public void ResetForNewRound() { } } public class AntiSlowMono : MonoBehaviour { private Player player = null; private CharacterStatModifiers stats = null; private static bool typesSearched; private static Type? glueEffectType; private static Type? crushEffectType; private static Type? pulsarEffectType; private static Type? goldHealthMonoType; private static Type? igniteEffectType; private float checkTimer = 0f; private const float CHECK_INTERVAL = 0.1f; private float lastEffectTime = -1f; private const float EFFECT_COOLDOWN = 0.5f; public void Start() { player = ((Component)this).GetComponent<Player>(); stats = ((Component)this).GetComponent<CharacterStatModifiers>(); if (!typesSearched) { SearchSlowEffectTypes(); typesSearched = true; } } private static void SearchSlowEffectTypes() { 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 type in array) { if (!(type == null)) { switch (type.Name) { case "GlueEffect": glueEffectType = type; break; case "CrushEffect": crushEffectType = type; break; case "PulsarEffect": pulsarEffectType = type; break; case "GoldHealthMono": goldHealthMonoType = type; break; case "IgniteEffect": igniteEffectType = type; break; } } } } catch (Exception) { } } } public void Update() { if ((Object)(object)stats != (Object)null && (stats.slow > 0f || stats.slowSlow > 0f || stats.fastSlow > 0f)) { stats.slow = 0f; stats.slowSlow = 0f; stats.fastSlow = 0f; } checkTimer += Time.deltaTime; if (checkTimer >= 0.1f) { checkTimer = 0f; CheckAndRemoveSlowEffects(); } } private void CheckAndRemoveSlowEffects() { bool flag = false; flag |= RemoveSlowEffectIfExists(glueEffectType); flag |= RemoveSlowEffectIfExists(crushEffectType); flag |= RemoveSlowEffectIfExists(pulsarEffectType); flag |= RemoveSlowEffectIfExists(goldHealthMonoType); if ((flag | RemoveSlowEffectIfExists(igniteEffectType)) && Time.time - lastEffectTime >= 0.5f) { lastEffectTime = Time.time; AntiSlowPatch_AddSlowAddative.PlayResistEffects(player); } } private bool RemoveSlowEffectIfExists(Type? effectType) { if (effectType == null) { return false; } Component component = ((Component)this).GetComponent(effectType); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); return true; } return false; } private void OnDestroy() { } } public class AntiKnockbackMono : MonoBehaviour { private Player player = null; public void Start() { player = ((Component)this).GetComponent<Player>(); } private void OnDestroy() { } } public class AntiSilenceMono : MonoBehaviour { private Player player; public void Start() { player = ((Component)this).GetComponent<Player>(); } private void OnDestroy() { } } public class AntiStunMono : MonoBehaviour { private CharacterData data = null; public Player player = null; private Vector2 lastMoveSpeed; private float lastEffectTime; private readonly float effectCooldown = 0.15f; public void Start() { data = ((Component)this).GetComponentInParent<CharacterData>(); player = ((Component)this).GetComponent<Player>(); } public void Update() { if (!((Object)(object)player == (Object)null) && !((Object)(object)player.data == (Object)null)) { if (player.data.isStunned) { CancelStun(); PlayResistEffect(); } else { TrySaveVelocity(); } } } private void CancelStun() { //IL_0025: 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) StunHandler stunHandler = player.data.stunHandler; ((MonoBehaviour)stunHandler.codeAnim).StopAllCoroutines(); stunHandler.codeAnim.currentState = (AnimationUse)2; stunHandler.codeAnim.animations = (CodeAnimationInstance[])(object)new CodeAnimationInstance[0]; stunHandler.codeAnim.isPlaying = false; stunHandler.StopStun(); ExtensionMethods.SetFieldValue((object)player.data.playerVel, "velocity", (object)lastMoveSpeed); } private void PlayResistEffect() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) if (!(Time.time - lastEffectTime < effectCooldown)) { lastEffectTime = Time.time; Color color = default(Color); ((Color)(ref color))..ctor(0.3f, 0.8f, 1f, 1f); ShieldEffect.PlayShieldEffect(player, color); } } private void TrySaveVelocity() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) try { lastMoveSpeed = (Vector2)ExtensionMethods.GetFieldValue((object)player.data.playerVel, "velocity"); } catch { } } private void OnDestroy() { } } public static class TextEffectPool<T> where T : FloatingTextEffect { private static readonly Stack<T> pool = new Stack<T>(); private static Transform poolContainer = null; private const int MAX_POOL_SIZE = 10; public static int PoolSize => pool.Count; private static void EnsureContainer() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown if ((Object)(object)poolContainer == (Object)null) { GameObject val = new GameObject("TextEffectPool_" + typeof(T).Name); Object.DontDestroyOnLoad((Object)(object)val); poolContainer = val.transform; } } public static T Get() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown EnsureContainer(); T val; if (pool.Count > 0) { val = pool.Pop(); } else { GameObject val2 = new GameObject(typeof(T).Name); Object.DontDestroyOnLoad((Object)(object)val2); val = val2.AddComponent<T>(); } ((Component)val).gameObject.SetActive(true); return val; } public static void Return(T effect) { if (!((Object)(object)effect == (Object)null)) { ((Component)effect).gameObject.SetActive(false); if (pool.Count < 10) { ((Component)effect).transform.SetParent(poolContainer); pool.Push(effect); } else { Object.Destroy((Object)(object)((Component)effect).gameObject); } } } public static void Show(Vector3 position) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) T val = Get(); val.Activate(position); } } public abstract class FloatingTextEffect : MonoBehaviour { protected TextMesh textMesh = null; protected MeshRenderer meshRenderer = null; protected TextMesh[] outlineTexts = null; protected GameObject[] outlineObjects = null; protected float timer = 0f; protected Vector3 startPosition; protected bool isActive = false; protected const int OUTLINE_COUNT = 8; protected abstract string DisplayText { get; } protected abstract Color MainColor { get; } protected abstract Color OutlineColor { get; } protected virtual Color EndColor => new Color(MainColor.r * 0.5f, MainColor.g * 0.5f, MainColor.b * 0.5f, 0f); protected virtual float Lifetime => 1.4f; protected virtual float FloatSpeed => 2.5f; protected virtual int FontSize => 48; protected virtual float CharacterSize => 0.15f; protected virtual float OutlineOffset => 0.015f; protected virtual float InitialScale => 0.3f; protected virtual float MaxRotation => 15f; protected virtual void Awake() { CreateOutlines(); CreateMainText(); } private void CreateOutlines() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) outlineTexts = (TextMesh[])(object)new TextMesh[8]; outlineObjects = (GameObject[])(object)new GameObject[8]; for (int i = 0; i < 8; i++) { outlineObjects[i] = new GameObject($"Outline_{i}"); outlineObjects[i].transform.SetParent(((Component)this).transform); float num = (float)i / 8f * MathF.PI * 2f; outlineObjects[i].transform.localPosition = new Vector3(Mathf.Cos(num) * OutlineOffset, Mathf.Sin(num) * OutlineOffset, 0.01f); outlineTexts[i] = outlineObjects[i].AddComponent<TextMesh>(); outlineTexts[i].text = DisplayText; outlineTexts[i].fontSize = FontSize; outlineTexts[i].characterSize = CharacterSize; outlineTexts[i].anchor = (TextAnchor)4; outlineTexts[i].alignment = (TextAlignment)1; outlineTexts[i].color = OutlineColor; outlineTexts[i].fontStyle = (FontStyle)1; MeshRenderer component = outlineObjects[i].GetComponent<MeshRenderer>(); if ((Object)(object)component != (Object)null) { ((Renderer)component).sortingLayerName = "MostFront"; ((Renderer)component).sortingOrder = 499; } } } private void CreateMainText() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) textMesh = ((Component)this).gameObject.AddComponent<TextMesh>(); textMesh.text = DisplayText; textMesh.fontSize = FontSize; textMesh.characterSize = CharacterSize; textMesh.anchor = (TextAnchor)4; textMesh.alignment = (TextAlignment)1; textMesh.color = MainColor; textMesh.fontStyle = (FontStyle)1; meshRenderer = ((Component)this).GetComponent<MeshRenderer>(); if ((Object)(object)meshRenderer != (Object)null) { ((Renderer)meshRenderer).sortingLayerName = "MostFront"; ((Renderer)meshRenderer).sortingOrder = 500; } } public virtual void Activate(Vector3 position) { //IL_0007: 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) //IL_0010: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.position = position; startPosition = position; timer = 0f; isActive = true; textMesh.color = MainColor; for (int i = 0; i < 8; i++) { outlineTexts[i].color = OutlineColor; } ((Component)this).transform.localScale = Vector3.one * InitialScale; ((Component)this).transform.rotation = Quaternion.Euler(0f, 0f, Random.Range(0f - MaxRotation, MaxRotation)); ((Component)this).gameObject.SetActive(true); } protected virtual void Update() { if (isActive) { timer += Time.deltaTime; float num = timer / Lifetime; if (num >= 1f) { Deactivate(); return; } UpdatePosition(num); UpdateScale(num); UpdateAlpha(num); ApplyExtraEffects(num); } } protected virtual void UpdatePosition(float progress) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) float num = 1f - Mathf.Pow(1f - progress, 2f); float num2 = num * FloatSpeed; ((Component)this).transform.position = startPosition + new Vector3(0f, num2, 0f); } protected virtual void UpdateScale(float progress) { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) float num2; if (progress < 0.1f) { float num = progress / 0.1f; num2 = InitialScale + num * (1.5f - InitialScale); } else if (progress < 0.2f) { float num3 = (progress - 0.1f) / 0.1f; num2 = 1.5f - num3 * 0.3f; } else if (progress < 0.7f) { float num4 = Mathf.Sin((progress - 0.2f) * 20f) * 0.05f; num2 = 1.2f + num4; } else { float num5 = (progress - 0.7f) / 0.3f; num2 = 1.2f - num5 * 0.4f; } ((Component)this).transform.localScale = Vector3.one * num2; } protected virtual void UpdateAlpha(float progress) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) float num; if (progress < 0.6f) { num = 1f; } else { num = 1f - (progress - 0.6f) / 0.4f; num = Mathf.Pow(num, 0.5f); } Color color = Color.Lerp(MainColor, EndColor, progress * 0.7f); color.a = num; textMesh.color = color; Color outlineColor = OutlineColor; outlineColor.a = num * 0.8f; for (int i = 0; i < 8; i++) { outlineTexts[i].color = outlineColor; } } protected virtual void ApplyExtraEffects(float progress) { //IL_0028: 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) float num = Mathf.Sin(timer * 12f) * 0.08f * (1f - progress); Transform transform = ((Component)this).transform; transform.position += new Vector3(num, 0f, 0f); } protected virtual void Deactivate() { isActive = false; ((Component)this).gameObject.SetActive(false); } } public class MissTextEffect : FloatingTextEffect { protected override string DisplayText => "MISS!"; protected override Color MainColor => new Color(1f, 1f, 0.2f, 1f); protected override Color OutlineColor => new Color(0.1f, 0.1f, 0.1f, 1f); protected override Color EndColor => new Color(1f, 0.5f, 0f, 0f); protected override void ApplyExtraEffects(float progress) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) base.ApplyExtraEffects(progress); float num = Mathf.Sin(timer * 8f) * 5f * (1f - progress); ((Component)this).transform.rotation = Quaternion.Euler(0f, 0f, num + Random.Range(-0.5f, 0.5f)); } } public class ExecuteTextEffect : FloatingTextEffect { protected override string DisplayText => "EXECUTED!"; protected override Color MainColor => new Color(1f, 0.1f, 0.1f, 1f); protected override Color OutlineColor => new Color(0.2f, 0f, 0f, 1f); protected override Color EndColor => new Color(0.5f, 0f, 0f, 0f); protected override float Lifetime => 1.6f; protected override float FloatSpeed => 2f; protected override int FontSize => 52; protected override float OutlineOffset => 0.02f; protected override float InitialScale => 0.2f; protected override float MaxRotation => 10f; protected override void UpdateScale(float progress) { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) float num2; if (progress < 0.08f) { float num = progress / 0.08f; num2 = 0.2f + num * 1.6f; } else if (progress < 0.15f) { float num3 = (progress - 0.08f) / 0.07f; num2 = 1.8f - num3 * 0.5f; } else if (progress < 0.65f) { num2 = 1.3f; } else { float num4 = (progress - 0.65f) / 0.35f; num2 = 1.3f - num4 * 0.5f; } ((Component)this).transform.localScale = Vector3.one * num2; } protected override void ApplyExtraEffects(float progress) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) if (progress < 0.2f) { float num = (1f - progress / 0.2f) * 0.1f; Transform transform = ((Component)this).transform; transform.position += new Vector3(Random.Range(0f - num, num), Random.Range(0f - num, num), 0f); } } } public class ReviveTextEffect : FloatingTextEffect { protected override string DisplayText => "I'll be back!"; protected override Color MainColor => new Color(1f, 1f, 1f, 1f); protected override Color OutlineColor => new Color(0.7f, 0.85f, 1f, 1f); protected override void ApplyExtraEffects(float progress) { //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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Sin(timer * 15f) * 0.1f + 0.9f; Color color = textMesh.color; color.r *= num; color.g *= num; color.b *= num; textMesh.color = color; float num2 = Mathf.Sin(timer * 12f) * 0.08f * (1f - progress); Transform transform = ((Component)this).transform; transform.position += new Vector3(num2, 0f, 0f); } } public class BlockCooldownEnforcer : MonoBehaviour { private float updateTimer = 0f; private const float UPDATE_INTERVAL = 1f; private Player player; private void Start() { player = ((Component)this).GetComponent<Player>(); } private void Update() { updateTimer += Time.deltaTime; if (updateTimer < 1f) { return; } updateTimer = 0f; if (!((Object)(object)player == (Object)null) && !((Object)(object)player.data == (Object)null) && !((Object)(object)player.data.block == (Object)null)) { float num = (float)player.data.block.additionalBlocks * 0.2f + 1.5f; if (player.data.block.cooldown < num) { player.data.block.cooldown = num; } } } } public class ImmunizeMono : BlockCooldownEnforcer { } public class DominionMono : BlockCooldownEnforcer { } public class ShieldEffect : MonoBehaviour { private static Dictionary<int, GameObject> activeShields = new Dictionary<int, GameObject>(); public static void PlayShieldEffect(Player player, Color color, float duration = 1f, float targetRadius = 0.8f) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0063: 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_00bb: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)player == (Object)null)) { if (activeShields.TryGetValue(player.playerID, out GameObject value) && (Object)(object)value != (Object)null) { Object.Destroy((Object)(object)value); } GameObject val = new GameObject("ShieldEffect"); val.transform.SetParent(((Component)player).transform); val.transform.localPosition = Vector3.zero; LineRenderer val2 = val.AddComponent<LineRenderer>(); val2.useWorldSpace = false; val2.loop = true; val2.startWidth = 0.1f; val2.endWidth = 0.1f; val2.positionCount = 36; ((Renderer)val2).material = new Material(Shader.Find("Sprites/Default")); val2.startColor = color; val2.endColor = color; ((Renderer)val2).sortingLayerName = "UI"; ((Renderer)val2).sortingOrder = 10000; for (int i = 0; i < 36; i++) { float num = (float)i / 36f * MathF.PI * 2f; val2.SetPosition(i, new Vector3(Mathf.Cos(num), Mathf.Sin(num), 0f)); } ShieldAnimator shieldAnimator = val.AddComponent<ShieldAnimator>(); shieldAnimator.Init(val2, color, duration, targetRadius, player.playerID); activeShields[player.playerID] = val; } } public static void RemoveShield(int playerID) { activeShields.Remove(playerID); } } public class ShieldAnimator : MonoBehaviour { private LineRenderer line; private Color baseColor; private float duration; private float targetRadius; private int playerID; private float startTime; public void Init(LineRenderer lr, Color color, float dur, float radius, int pid) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) line = lr; baseColor = color; duration = dur; targetRadius = radius; playerID = pid; startTime = Time.time; ((Component)this).transform.localScale = Vector3.zero; } private void Update() { //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) float num = Time.time - startTime; float num2 = num / duration; if (num2 >= 1f) { ShieldEffect.RemoveShield(playerID); Object.Destroy((Object)(object)((Component)this).gameObject); return; } float num4; float num5; if (num2 < 0.2f) { float num3 = num2 / 0.2f; num4 = targetRadius * (1f - Mathf.Pow(1f - num3, 2f)); num5 = num3; } else if (num2 < 0.7f) { float num6 = (num2 - 0.2f) / 0.5f; float num7 = 1f + Mathf.Sin(num6 * MathF.PI * 4f) * 0.05f; num4 = targetRadius * num7; num5 = 1f; } else { float num8 = (num2 - 0.7f) / 0.3f; num4 = targetRadius * (1f + num8 * 0.1f); num5 = 1f - num8; } ((Component)this).transform.localScale = Vector3.one * num4; ((Component)this).transform.Rotate(0f, 0f, Time.deltaTime * 45f); Color val = baseColor; val.a = num5 * 0.85f; line.startColor = val; line.endColor = val; } } } namespace MrFuntikMod.Cards { public class AegisCard : CustomCard { public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block) { } public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { AegisShieldMono component = ((Component)player).gameObject.GetComponent<AegisShieldMono>(); if ((Object)(object)component != (Object)null) { component.AddStack(); return; } AegisShieldMono aegisShieldMono = ((Component)player).gameObject.AddComponent<AegisShieldMono>(); aegisShieldMono.stackCount = 1; } public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { AegisShieldMono component = ((Component)player).gameObject.GetComponent<AegisShieldMono>(); if ((Object)(object)component != (Object)null) { component.RemoveStack(); if (component.stackCount <= 0) { Object.Destroy((Object)(object)component); } } } protected override string GetTitle() { return "Aegis"; } protected override string GetDescription() { return "Blocking grants <b><color=#ff4500>invulnerability</color></b>; +1s duration and -2s cooldown per stack."; } protected override GameObject? GetCardArt() { return Assets.Aegis_Art; } protected override Rarity GetRarity() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return (Rarity)2; } protected override CardInfoStat[] GetStats() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown return (CardInfoStat[])(object)new CardInfoStat[2] { new CardInfoStat { positive = true, stat = "Invulnerability Duration", amount = "3s", simepleAmount = (SimpleAmount)0 }, new CardInfoStat { positive = false, stat = "Shield Cooldown", amount = "15s", simepleAmount = (SimpleAmount)0 } }; } protected override CardThemeColorType GetTheme() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return (CardThemeColorType)0; } public override string GetModName() { return "MFM"; } } public class AntiRadarCard : CustomCard { private static readonly Dictionary<int, bool> _immunityCache = new Dictionary<int, bool>(); public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block) { CardCategory val = CustomCardCategories.instance.CardCategory("ImmunityCards"); cardInfo.categories = (CardCategory[])(object)new CardCategory[1] { val }; cardInfo.allowMultiple = false; } public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { _immunityCache[player.playerID] = true; ImmunityHelper.CheckUnlockImmunityMaster(player); } public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { _immunityCache.Remove(player.playerID); ImmunityHelper.CheckLockImmunityMaster(player); } protected override string GetTitle() { return "Anti Radar"; } protected override string GetDescription() { return "Ignored by homing and tracking.</i>\n<color=green>Auto-Targeting Immunity</color>"; } protected override GameObject GetCardArt() { return Assets.AntiRadar_Art; } protected override Rarity GetRarity() { return (Rarity)0; } protected override CardInfoStat[] GetStats() { return (CardInfoStat[])(object)new CardInfoStat[0]; } protected override CardThemeColorType GetTheme() { return (CardThemeColorType)2; } public override string GetModName() { return "MFM"; } public static bool HasImmunity(Player player) { if ((Object)(object)player == (Object)null) { return false; } if (_immunityCache.TryGetValue(player.playerID, out var value)) { return value; } if (player.data?.currentCards == null) { return false; } bool flag = player.data.currentCards.Any((CardInfo c) => (Object)(object)c != (Object)null && c.cardName == "Anti Radar"); _immunityCache[player.playerID] = flag; return flag; } public static void ClearCache() { _immunityCache.Clear(); } } internal class BalanceBlock : CustomCard { public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block) { cardInfo.categories = (CardCategory[])(object)new CardCategory[1] { MrFuntikMod.BalanceCard }; statModifiers.health = 0.75f; statModifiers.movementSpeed = 0.75f; block.cdMultiplier = 0.5f; } public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { } public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats) { } protected override string GetTitle() { return "Balance: Block"; } protected override string GetDescription() { return ""; } protected override GameObject GetCardArt() { return Assets.BalanceBlock_Art; } protected override Rarity GetRarity() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return (Rarity)0; } protected override CardInfoStat[] GetStats() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_0061: 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_006d: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: