Decompiled source of Anime Crossover Clash v1.1.0

AnimeCrossoverClash.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using InControl;
using ModdingUtils.Utils;
using Photon.Pun;
using TMPro;
using UnboundLib;
using UnboundLib.Cards;
using UnboundLib.GameModes;
using UnboundLib.Networking;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("AnimeCrossoverClash")]
[assembly: AssemblyDescription("Anime heroes' movesets as ROUNDS cards")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AnimeCrossoverClash")]
[assembly: AssemblyCopyright("Copyright 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3b8e2a71-6c4d-4f1e-9a55-2d7c0e9b4a13")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace AnimeCrossoverClash;

public static class CardArt
{
	private static readonly Dictionary<string, GameObject> templates = new Dictionary<string, GameObject>();

	private static GameObject holder;

	public static GameObject Get(string fileName)
	{
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Expected O, but got Unknown
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Expected O, but got Unknown
		if (templates.TryGetValue(fileName, out var value) && (Object)(object)value != (Object)null)
		{
			return value;
		}
		Texture2D val = LoadTexture(fileName);
		if ((Object)(object)val == (Object)null)
		{
			return null;
		}
		if ((Object)(object)holder == (Object)null)
		{
			holder = new GameObject("CrossoverCardArtHolder");
			holder.SetActive(false);
			Object.DontDestroyOnLoad((Object)(object)holder);
		}
		value = new GameObject("CardArt_" + fileName, new Type[1] { typeof(RectTransform) });
		value.transform.SetParent(holder.transform, false);
		RectTransform val2 = (RectTransform)value.transform;
		val2.anchorMin = Vector2.zero;
		val2.anchorMax = Vector2.one;
		val2.offsetMin = Vector2.zero;
		val2.offsetMax = Vector2.zero;
		Image obj = value.AddComponent<Image>();
		obj.sprite = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
		obj.preserveAspect = true;
		((Graphic)obj).raycastTarget = false;
		templates[fileName] = value;
		return value;
	}

	public static Texture2D LoadTexture(string fileName, bool warnIfMissing = true)
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Expected O, but got Unknown
		try
		{
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), fileName);
			if (File.Exists(text))
			{
				Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
				((Texture)val).filterMode = (FilterMode)1;
				if (ImageConversion.LoadImage(val, File.ReadAllBytes(text)))
				{
					return val;
				}
			}
			if (warnIfMissing)
			{
				Debug.LogWarning("[Crossover] " + fileName + " not found or unreadable at: " + text);
			}
		}
		catch (Exception ex)
		{
			Debug.LogWarning("[Crossover] failed to load " + fileName + ": " + ex.Message);
		}
		return null;
	}

	public static CardInfoStat Stat(bool positive, string name, string amount)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Expected O, but got Unknown
		return new CardInfoStat
		{
			positive = positive,
			stat = name,
			amount = amount,
			simepleAmount = (SimpleAmount)0
		};
	}

	public static string Percent(float multiplier)
	{
		int num = Mathf.RoundToInt((multiplier - 1f) * 100f);
		return ((num >= 0) ? "+" : "") + num + "%";
	}
}
public static class HeroConfig
{
	public static ConfigEntry<KeyCode>[] Keys;

	public static ConfigEntry<KeyCode> UltimateKey;

	public static ConfigEntry<KeyCode> ChargeKey;

	public static ConfigEntry<KeyCode> AssistKey;

	public static ConfigEntry<KeyCode> GunKey;

	public static ConfigEntry<float> Volume;

	public static ConfigEntry<float> CostumeScale;

	public static ConfigEntry<float> CostumeHeight;

	public static ConfigEntry<bool> Hud;

	public static ConfigEntry<bool> CutIns;

	public static ConfigEntry<bool> Aura;

	public static ConfigEntry<bool> ComboCounter;

	private static ConfigEntry<float> cooldownMult;

	private static ConfigEntry<float> damageMult;

	private static ConfigEntry<float> kiRegenMult;

	private static ConfigEntry<float> ultGainMult;

	private static ConfigEntry<float> formSeconds;

	private static ConfigEntry<bool> heroCardsInPicks;

	private static readonly Dictionary<string, ConfigEntry<bool>> heroEnabled = new Dictionary<string, ConfigEntry<bool>>();

	private static ConfigFile file;

	public static float CooldownMult = 1f;

	public static float DamageMult = 1f;

	public static float KiRegenMult = 1f;

	public static float UltGainMult = 1f;

	public static float FormSeconds = 20f;

	public static bool HeroCardsInPicks = true;

	private static readonly HashSet<string> disabled = new HashSet<string>();

	public static string UltLabel => Label((KeyCode)((UltimateKey == null) ? 116 : ((int)UltimateKey.Value)));

	public static string ChargeLabel => Label((KeyCode)((ChargeKey == null) ? 102 : ((int)ChargeKey.Value)));

	public static string AssistLabel => Label((KeyCode)((AssistKey == null) ? 103 : ((int)AssistKey.Value)));

	public static string GunLabel => Label((KeyCode)((GunKey == null) ? 99 : ((int)GunKey.Value)));

	public static void Bind(ConfigFile cfg)
	{
		file = cfg;
		Keys = new ConfigEntry<KeyCode>[3]
		{
			cfg.Bind<KeyCode>("Controls", "Ability1", (KeyCode)113, "Keyboard key for a hero's first ability (controller: D-pad Down)."),
			cfg.Bind<KeyCode>("Controls", "Ability2", (KeyCode)101, "Keyboard key for a hero's second ability (controller: D-pad Left)."),
			cfg.Bind<KeyCode>("Controls", "Ability3", (KeyCode)114, "Keyboard key for a hero's third ability (controller: D-pad Right).")
		};
		UltimateKey = cfg.Bind<KeyCode>("Controls", "Ultimate", (KeyCode)116, "Unleashes your ultimate once the gauge is full (controller: D-pad Up).");
		ChargeKey = cfg.Bind<KeyCode>("Controls", "Charge", (KeyCode)102, "Hold to power up: ki fills fast but you slow down. With a full gauge and a Limit Break, keep holding to transform (controller: hold Y).");
		AssistKey = cfg.Bind<KeyCode>("Controls", "Assist", (KeyCode)103, "Calls your Crossover Episode partner in for their signature move (controller: right stick click).");
		GunKey = cfg.Bind<KeyCode>("Controls", "GunToggle", (KeyCode)99, "With a hero your gun is put away and the fire button throws your combo. This key takes the gun out, and puts it away again (controller: Back / Select).");
		Volume = cfg.Bind<float>("Presentation", "Volume", 0.6f, "Volume of the mod's sound effects (0 = off, 1 = full).");
		Hud = cfg.Bind<bool>("Presentation", "HeroHud", true, "Show your hero's portrait, ki, ultimate gauge and moves in the bottom-left corner.");
		CutIns = cfg.Bind<bool>("Presentation", "CutIns", true, "Show the full-screen cut-in banners for ultimates, transformations and new heroes.");
		ComboCounter = cfg.Bind<bool>("Presentation", "ComboCounter", true, "Show the hit combo counter above fighters.");
		Aura = cfg.Bind<bool>("Presentation", "Aura", true, "Heroes give off a faint aura all the time (charging and transforming always show theirs).");
		CostumeScale = cfg.Bind<float>("Presentation", "CostumeScale", 1f, "Size of the hair and headgear drawn on heroes (1 = fitted to the body).");
		CostumeHeight = cfg.Bind<float>("Presentation", "CostumeHeight", 0f, "Moves the hair and headgear up (positive) or down, in body sizes.");
		cooldownMult = cfg.Bind<float>("Gameplay", "CooldownMultiplier", 1f, "Multiplies every ability cooldown (0.5 = twice as often). The host's value is used online.");
		damageMult = cfg.Bind<float>("Gameplay", "DamageMultiplier", 1f, "Multiplies all hero damage. The host's value is used online.");
		kiRegenMult = cfg.Bind<float>("Gameplay", "KiRegenMultiplier", 1f, "Multiplies how fast ki refills on its own and while charging. The host's value is used online.");
		ultGainMult = cfg.Bind<float>("Gameplay", "UltimateGainMultiplier", 1f, "Multiplies how fast the ultimate gauge fills. The host's value is used online.");
		formSeconds = cfg.Bind<float>("Gameplay", "TransformationSeconds", 20f, "How long a Limit Break transformation lasts. The host's value is used online.");
		heroCardsInPicks = cfg.Bind<bool>("Gameplay", "HeroCardsInPicks", true, "Hero cards show up in normal card picks for players without a hero, so you can choose who you become. Off: heroes only come from the Isekai Truck and Reincarnation. The host's value is used online.");
		ApplyLocal();
	}

	public static void BindHero(string title, bool form)
	{
		heroEnabled[title] = file.Bind<bool>("Heroes", SafeKey(title), true, form ? (title + ": a transformation unlocked by Limit Break.") : (title + ": can be picked as a card, or summoned by the Isekai Truck, Reincarnation or Crossover Episode."));
		if (!heroEnabled[title].Value)
		{
			disabled.Add(title);
		}
	}

	private static string SafeKey(string title)
	{
		string text = title;
		string[] array = new string[8] { "=", "\n", "\t", "\\", "\"", "'", "[", "]" };
		foreach (string oldValue in array)
		{
			text = text.Replace(oldValue, "");
		}
		return text;
	}

	public static bool Enabled(string title)
	{
		return !disabled.Contains(title);
	}

	public static void ApplyLocal()
	{
		if (file != null)
		{
			file.Reload();
		}
		CooldownMult = Mathf.Clamp(cooldownMult.Value, 0.1f, 10f);
		DamageMult = Mathf.Clamp(damageMult.Value, 0f, 10f);
		KiRegenMult = Mathf.Clamp(kiRegenMult.Value, 0.1f, 10f);
		UltGainMult = Mathf.Clamp(ultGainMult.Value, 0.1f, 10f);
		FormSeconds = Mathf.Clamp(formSeconds.Value, 3f, 120f);
		HeroCardsInPicks = heroCardsInPicks.Value;
		disabled.Clear();
		foreach (KeyValuePair<string, ConfigEntry<bool>> item in heroEnabled)
		{
			if (!item.Value.Value)
			{
				disabled.Add(item.Key);
			}
		}
	}

	public static void Sync()
	{
		if (PhotonNetwork.OfflineMode || !PhotonNetwork.InRoom)
		{
			ApplyLocal();
		}
		else if (PhotonNetwork.IsMasterClient)
		{
			ApplyLocal();
			NetworkingManager.RPC_Others(typeof(HeroConfig), "RPCA_Sync", new object[7]
			{
				CooldownMult,
				DamageMult,
				KiRegenMult,
				UltGainMult,
				FormSeconds,
				HeroCardsInPicks,
				string.Join("|", new List<string>(disabled).ToArray())
			});
		}
	}

	[UnboundRPC]
	public static void RPCA_Sync(float cooldown, float damage, float kiRegen, float ultGain, float form, bool heroCards, string off)
	{
		CooldownMult = cooldown;
		DamageMult = damage;
		KiRegenMult = kiRegen;
		UltGainMult = ultGain;
		FormSeconds = form;
		HeroCardsInPicks = heroCards;
		disabled.Clear();
		string[] array = off.Split(new char[1] { '|' });
		foreach (string text in array)
		{
			if (text.Length > 0)
			{
				disabled.Add(text);
			}
		}
		Debug.Log("[Crossover] using the host's settings (cooldowns x" + cooldown + ", damage x" + damage + ", ki x" + kiRegen + ", ultimate x" + ultGain + ", forms " + form + "s)");
	}

	public static KeyCode Key(int slot)
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		if (Keys == null)
		{
			return (KeyCode)(slot switch
			{
				1 => 101, 
				0 => 113, 
				_ => 114, 
			});
		}
		return Keys[slot].Value;
	}

	public unsafe static string Label(KeyCode k)
	{
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Invalid comparison between Unknown and I4
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Invalid comparison between Unknown and I4
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Invalid comparison between Unknown and I4
		string text = ((object)(*(KeyCode*)(&k))/*cast due to .constrained prefix*/).ToString();
		if (text.StartsWith("Alpha"))
		{
			return text.Substring(5);
		}
		if (text.StartsWith("Keypad"))
		{
			return "Num" + text.Substring(6);
		}
		if ((int)k == 325)
		{
			return "MMB";
		}
		if ((int)k == 326)
		{
			return "M4";
		}
		if ((int)k == 327)
		{
			return "M5";
		}
		return text;
	}

	public static string KeyLabel(int slot)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		return Label(Key(slot));
	}
}
[BepInDependency("com.willis.rounds.unbound", "3.2.13")]
[BepInDependency("pykess.rounds.plugins.moddingutils", "0.4.8")]
[BepInDependency("root.rarity.lib", "1.3.0")]
[BepInPlugin("com.kpcnre.rounds.animecrossoverclash", "Anime Crossover Clash", "1.1.0")]
public class Plugin : BaseUnityPlugin
{
	public const string ModId = "com.kpcnre.rounds.animecrossoverclash";

	public const string ModName = "Anime Crossover Clash";

	public const string Version = "1.1.0";

	internal static Plugin Instance;

	private static CardInfo truck;

	private static CardInfo limitBreak;

	private static CardInfo reincarnation;

	private static CardInfo crossover;

	private static CardInfo finalEpisode;

	private static readonly List<CardInfo> tropes = new List<CardInfo>();

	private void Awake()
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		Instance = this;
		HeroConfig.Bind(((BaseUnityPlugin)this).Config);
		try
		{
			new Harmony("com.kpcnre.rounds.animecrossoverclash").PatchAll();
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("Harmony patches failed (combos with the gun away / damage resistance / Plot Armor won't work): " + ex));
		}
	}

	private void Start()
	{
		CustomCard.BuildCard<IsekaiTruckCard>((Action<CardInfo>)delegate(CardInfo c)
		{
			truck = c;
		});
		CustomCard.BuildCard<LimitBreakCard>((Action<CardInfo>)delegate(CardInfo c)
		{
			limitBreak = c;
		});
		CustomCard.BuildCard<CrossoverEpisodeCard>((Action<CardInfo>)delegate(CardInfo c)
		{
			crossover = c;
		});
		CustomCard.BuildCard<ReincarnationCard>((Action<CardInfo>)delegate(CardInfo c)
		{
			reincarnation = c;
		});
		CustomCard.BuildCard<FinalEpisodeCard>((Action<CardInfo>)delegate(CardInfo c)
		{
			finalEpisode = c;
		});
		HeroRegistry.Add<GokuCard, GokuHero>(GokuHero.Data);
		HeroRegistry.Add<VegetaCard, VegetaHero>(VegetaHero.Data);
		HeroRegistry.Add<NarutoCard, NarutoHero>(NarutoHero.Data);
		HeroRegistry.Add<SasukeCard, SasukeHero>(SasukeHero.Data);
		HeroRegistry.Add<ItachiCard, ItachiHero>(ItachiHero.Data);
		HeroRegistry.Add<LuffyCard, LuffyHero>(LuffyHero.Data);
		HeroRegistry.Add<ZoroCard, ZoroHero>(ZoroHero.Data);
		HeroRegistry.Add<IchigoCard, IchigoHero>(IchigoHero.Data);
		HeroRegistry.Add<GojoCard, GojoHero>(GojoHero.Data);
		HeroRegistry.Add<SukunaCard, SukunaHero>(SukunaHero.Data);
		HeroRegistry.Add<YujiCard, YujiHero>(YujiHero.Data);
		HeroRegistry.Add<TanjiroCard, TanjiroHero>(TanjiroHero.Data);
		HeroRegistry.Add<ZenitsuCard, ZenitsuHero>(ZenitsuHero.Data);
		HeroRegistry.Add<RengokuCard, RengokuHero>(RengokuHero.Data);
		HeroRegistry.Add<DekuCard, DekuHero>(DekuHero.Data);
		HeroRegistry.Add<BakugoCard, BakugoHero>(BakugoHero.Data);
		HeroRegistry.Add<TodorokiCard, TodorokiHero>(TodorokiHero.Data);
		HeroRegistry.Add<LeviCard, LeviHero>(LeviHero.Data);
		HeroRegistry.Add<ErenCard, ErenHero>(ErenHero.Data);
		HeroRegistry.Add<SaitamaCard, SaitamaHero>(SaitamaHero.Data);
		HeroRegistry.Add<GonCard, GonHero>(GonHero.Data);
		HeroRegistry.Add<KilluaCard, KilluaHero>(KilluaHero.Data);
		HeroRegistry.Add<DenjiCard, DenjiHero>(DenjiHero.Data);
		HeroRegistry.Add<MustangCard, MustangHero>(MustangHero.Data);
		HeroRegistry.Add<JinwooCard, JinwooHero>(JinwooHero.Data);
		HeroRegistry.AddForm<SuperSaiyanGokuHero>(SuperSaiyanGokuHero.Data, GokuHero.Data.Title);
		HeroRegistry.AddForm<UltraInstinctGokuHero>(UltraInstinctGokuHero.Data, SuperSaiyanGokuHero.Data.Title);
		HeroRegistry.AddForm<KuramaNarutoHero>(KuramaNarutoHero.Data, NarutoHero.Data.Title);
		HeroRegistry.AddForm<Gear5LuffyHero>(Gear5LuffyHero.Data, LuffyHero.Data.Title);
		HeroRegistry.AddForm<BankaiIchigoHero>(BankaiIchigoHero.Data, IchigoHero.Data.Title);
		HeroRegistry.AddForm<AdultGonHero>(AdultGonHero.Data, GonHero.Data.Title);
		HeroConfig.ApplyLocal();
		CustomCard.BuildCard<PlotArmorCard>((Action<CardInfo>)delegate(CardInfo c)
		{
			tropes.Add(c);
		});
		CustomCard.BuildCard<PowerOfFriendshipCard>((Action<CardInfo>)delegate(CardInfo c)
		{
			tropes.Add(c);
		});
		CustomCard.BuildCard<MainCharacterEnergyCard>((Action<CardInfo>)delegate(CardInfo c)
		{
			tropes.Add(c);
		});
		CustomCard.BuildCard<RivalCard>((Action<CardInfo>)delegate(CardInfo c)
		{
			tropes.Add(c);
		});
		CustomCard.BuildCard<TrainingArcCard>((Action<CardInfo>)delegate(CardInfo c)
		{
			tropes.Add(c);
		});
		CustomCard.BuildCard<IronFistCard>();
		CustomCard.BuildCard<WayOfTheBladeCard>();
		CustomCard.BuildCard<ShinobiArtsCard>();
		CustomCard.BuildCard<ArcaneOverflowCard>();
		((BaseUnityPlugin)this).Logger.LogInfo((object)("Anime Crossover Clash cards registered (" + HeroRegistry.All.Count + " heroes and forms)"));
		try
		{
			AddCardGating();
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)("Card gating unavailable (ModdingUtils too old?), story and trope cards show up for everyone: " + ex.GetType().Name));
		}
		try
		{
			Unbound.RegisterHandshake("com.kpcnre.rounds.animecrossoverclash", (Action)HeroConfig.Sync);
		}
		catch (Exception ex2)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)("No settings sync with other players: " + ex2.Message));
		}
		GameModeManager.AddHook("PointStart", (Func<IGameModeHandler, IEnumerator>)PointStart);
		GameModeManager.AddHook("PointEnd", (Func<IGameModeHandler, IEnumerator>)EndEffects);
		GameModeManager.AddHook("GameEnd", (Func<IGameModeHandler, IEnumerator>)EndEffects);
		GameModeManager.AddHook("GameStart", (Func<IGameModeHandler, IEnumerator>)NewGame);
		HeroHud.Ensure();
	}

	[MethodImpl(MethodImplOptions.NoInlining)]
	private static void AddCardGating()
	{
		Cards.instance.AddCardValidationFunction((Func<Player, CardInfo, bool>)delegate(Player player, CardInfo card)
		{
			if ((Object)(object)card == (Object)null)
			{
				return true;
			}
			switch (card.cardName)
			{
			case "Isekai Truck":
				return HeroRegistry.CanAwaken(player);
			case "Limit Break":
				return HeroRegistry.CanLimitBreak(player);
			case "Crossover Episode":
				return HeroRegistry.CanCrossover(player);
			case "Final Episode":
			case "Reincarnation":
			case "Plot Armor":
			case "Main Character Energy":
			case "Rival":
				return HeroRegistry.HasAnyHero(player);
			case "Training Arc":
				if (HeroRegistry.HasAnyHero(player))
				{
					return HeroStats.Count(player, "Training Arc") < 3;
				}
				return false;
			case "Power of Friendship":
				if (HeroRegistry.HasAnyHero(player))
				{
					return HasTeammate(player);
				}
				return false;
			default:
			{
				HeroClass? heroClass = ClassCards.ClassOf(card);
				if (heroClass.HasValue)
				{
					return HeroRegistry.HasClass(player, heroClass.Value);
				}
				if (HeroRegistry.IsHeroCard(card))
				{
					return HeroRegistry.CanPickHero(player, card.cardName);
				}
				return true;
			}
			}
		});
	}

	private static bool HasTeammate(Player p)
	{
		if ((Object)(object)PlayerManager.instance == (Object)null)
		{
			return false;
		}
		foreach (Player player in PlayerManager.instance.players)
		{
			if ((Object)(object)player != (Object)(object)p && player.teamID == p.teamID)
			{
				return true;
			}
		}
		return false;
	}

	internal static void HideFromPicks(CardInfo card)
	{
		try
		{
			HideCard(card);
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)Instance).Logger.LogWarning((object)("Could not hide " + card.cardName + " from picks: " + ex.GetType().Name));
		}
	}

	[MethodImpl(MethodImplOptions.NoInlining)]
	private static void HideCard(CardInfo card)
	{
		Cards.instance.AddHiddenCard(card);
	}

	private IEnumerator PointStart(IGameModeHandler gm)
	{
		PlotArmor.ResetRound();
		yield break;
	}

	private IEnumerator EndEffects(IGameModeHandler gm)
	{
		Hero[] array = Object.FindObjectsOfType<Hero>();
		foreach (Hero hero in array)
		{
			if (!((Object)(object)hero == (Object)null) && !hero.IsAssist)
			{
				hero.SetCharging(on: false);
				if (hero.BaseTitle != null && (Object)(object)hero.Owner != (Object)null)
				{
					Hero.SwapForm(hero.Owner, hero.Title, hero.BaseTitle, 0f);
				}
			}
		}
		SpeedBoost[] array2 = Object.FindObjectsOfType<SpeedBoost>();
		for (int i = 0; i < array2.Length; i++)
		{
			Object.DestroyImmediate((Object)(object)array2[i]);
		}
		Empowered[] array3 = Object.FindObjectsOfType<Empowered>();
		for (int i = 0; i < array3.Length; i++)
		{
			Object.Destroy((Object)(object)array3[i]);
		}
		DamageResist[] array4 = Object.FindObjectsOfType<DamageResist>();
		for (int i = 0; i < array4.Length; i++)
		{
			Object.Destroy((Object)(object)array4[i]);
		}
		HeroZone[] array5 = Object.FindObjectsOfType<HeroZone>();
		for (int i = 0; i < array5.Length; i++)
		{
			Object.Destroy((Object)(object)((Component)array5[i]).gameObject);
		}
		Giant[] array6 = Object.FindObjectsOfType<Giant>();
		for (int i = 0; i < array6.Length; i++)
		{
			Object.DestroyImmediate((Object)(object)array6[i]);
		}
		Flight[] array7 = Object.FindObjectsOfType<Flight>();
		for (int i = 0; i < array7.Length; i++)
		{
			Object.DestroyImmediate((Object)(object)array7[i]);
		}
		ChannelBeam[] array8 = Object.FindObjectsOfType<ChannelBeam>();
		for (int i = 0; i < array8.Length; i++)
		{
			Object.DestroyImmediate((Object)(object)((Component)array8[i]).gameObject);
		}
		Domain[] array9 = Object.FindObjectsOfType<Domain>();
		for (int i = 0; i < array9.Length; i++)
		{
			Object.Destroy((Object)(object)((Component)array9[i]).gameObject);
		}
		Minion[] array10 = Object.FindObjectsOfType<Minion>();
		for (int i = 0; i < array10.Length; i++)
		{
			Object.Destroy((Object)(object)((Component)array10[i]).gameObject);
		}
		Avatar[] array11 = Object.FindObjectsOfType<Avatar>();
		for (int i = 0; i < array11.Length; i++)
		{
			Object.Destroy((Object)(object)((Component)array11[i]).gameObject);
		}
		IceBlock[] array12 = Object.FindObjectsOfType<IceBlock>();
		for (int i = 0; i < array12.Length; i++)
		{
			Object.Destroy((Object)(object)((Component)array12[i]).gameObject);
		}
		CutMark[] array13 = Object.FindObjectsOfType<CutMark>();
		for (int i = 0; i < array13.Length; i++)
		{
			Object.Destroy((Object)(object)((Component)array13[i]).gameObject);
		}
		yield break;
	}

	private IEnumerator NewGame(IGameModeHandler gm)
	{
		Story.ResetSpent();
		HeroConfig.Sync();
		yield break;
	}
}
public static class ClassCards
{
	public const string Brawler = "Iron Fist Discipline";

	public const string Swordsman = "Way of the Blade";

	public const string Shinobi = "Shinobi Arts";

	public const string Caster = "Arcane Overflow";

	public static string Title(HeroClass c)
	{
		return c switch
		{
			HeroClass.Swordsman => "Way of the Blade", 
			HeroClass.Shinobi => "Shinobi Arts", 
			HeroClass.Caster => "Arcane Overflow", 
			_ => "Iron Fist Discipline", 
		};
	}

	public static HeroClass? ClassOf(CardInfo card)
	{
		if ((Object)(object)card == (Object)null)
		{
			return null;
		}
		return card.cardName switch
		{
			"Iron Fist Discipline" => HeroClass.Brawler, 
			"Way of the Blade" => HeroClass.Swordsman, 
			"Shinobi Arts" => HeroClass.Shinobi, 
			"Arcane Overflow" => HeroClass.Caster, 
			_ => null, 
		};
	}
}
public abstract class ClassCard : CustomCard
{
	protected abstract HeroClass Class { get; }

	protected abstract string Flavor { get; }

	protected abstract CardInfoStat[] Lines { get; }

	protected virtual void Stats(Gun gun, CharacterStatModifiers statModifiers, Block block)
	{
	}

	public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
	{
		cardInfo.allowMultiple = false;
		Stats(gun, statModifiers, block);
	}

	public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
	{
	}

	protected override string GetTitle()
	{
		return ClassCards.Title(Class);
	}

	protected override string GetDescription()
	{
		return Flavor + " Only for " + Class.ToString() + " heroes.";
	}

	protected override GameObject GetCardArt()
	{
		return CardArt.Get("class_" + Class.ToString().ToLower() + "_cardart.png");
	}

	protected override Rarity GetRarity()
	{
		return (Rarity)1;
	}

	protected override CardInfoStat[] GetStats()
	{
		return Lines;
	}

	public override string GetModName()
	{
		return "Anime Crossover Clash";
	}
}
public class IronFistCard : ClassCard
{
	protected override HeroClass Class => HeroClass.Brawler;

	protected override string Flavor => "Fists forged by a thousand fights.";

	protected override CardInfoStat[] Lines => (CardInfoStat[])(object)new CardInfoStat[2]
	{
		CardArt.Stat(positive: true, "Combo damage", "+40%"),
		CardArt.Stat(positive: true, "Health", "+25%")
	};

	protected override CardThemeColorType GetTheme()
	{
		return (CardThemeColorType)0;
	}

	protected override void Stats(Gun gun, CharacterStatModifiers statModifiers, Block block)
	{
		statModifiers.health = 1.25f;
	}
}
public class WayOfTheBladeCard : ClassCard
{
	protected override HeroClass Class => HeroClass.Swordsman;

	protected override string Flavor => "Nothing you can't cut.";

	protected override CardInfoStat[] Lines => (CardInfoStat[])(object)new CardInfoStat[2]
	{
		CardArt.Stat(positive: true, "Slash reach", "+30%"),
		CardArt.Stat(positive: true, "Block cooldown", "-15%")
	};

	protected override CardThemeColorType GetTheme()
	{
		return (CardThemeColorType)3;
	}

	protected override void Stats(Gun gun, CharacterStatModifiers statModifiers, Block block)
	{
		block.cdMultiplier = 0.85f;
	}
}
public class ShinobiArtsCard : ClassCard
{
	protected override HeroClass Class => HeroClass.Shinobi;

	protected override string Flavor => "Those who break the rules are scum, but those who abandon their friends are worse.";

	protected override CardInfoStat[] Lines => (CardInfoStat[])(object)new CardInfoStat[2]
	{
		CardArt.Stat(positive: true, "Kunai", "+1 per throw"),
		CardArt.Stat(positive: true, "Movement speed", "+20%")
	};

	protected override CardThemeColorType GetTheme()
	{
		return (CardThemeColorType)4;
	}

	protected override void Stats(Gun gun, CharacterStatModifiers statModifiers, Block block)
	{
		statModifiers.movementSpeed = 1.2f;
	}
}
public class ArcaneOverflowCard : ClassCard
{
	public const float KiCostMult = 0.75f;

	protected override HeroClass Class => HeroClass.Caster;

	protected override string Flavor => "Your reserves are bottomless.";

	protected override CardInfoStat[] Lines => (CardInfoStat[])(object)new CardInfoStat[2]
	{
		CardArt.Stat(positive: true, "Ki costs", "-25%"),
		CardArt.Stat(positive: true, "Health", "+10%")
	};

	protected override CardThemeColorType GetTheme()
	{
		return (CardThemeColorType)8;
	}

	protected override void Stats(Gun gun, CharacterStatModifiers statModifiers, Block block)
	{
		statModifiers.health = 1.1f;
	}
}
public class IsekaiTruckCard : CustomCard
{
	public const string CardTitle = "Isekai Truck";

	private const float HealthBonus = 1.1f;

	public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
	{
		cardInfo.allowMultiple = true;
		statModifiers.health = 1.1f;
	}

	public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
	{
		Story.Grant(player, "Isekai Truck", () => (!HeroRegistry.CanAwaken(player)) ? null : HeroRegistry.Random(player, null, otherSeries: false)?.Card, null);
	}

	protected override string GetTitle()
	{
		return "Isekai Truck";
	}

	protected override string GetDescription()
	{
		return "Truck-kun sends you to another world. You're reborn as a random anime hero.";
	}

	protected override GameObject GetCardArt()
	{
		return CardArt.Get("isekai_truck_cardart.png");
	}

	protected override Rarity GetRarity()
	{
		return (Rarity)0;
	}

	protected override CardInfoStat[] GetStats()
	{
		return (CardInfoStat[])(object)new CardInfoStat[2]
		{
			CardArt.Stat(positive: true, "Hero", "random"),
			CardArt.Stat(positive: true, "Health", CardArt.Percent(1.1f))
		};
	}

	protected override CardThemeColorType GetTheme()
	{
		return (CardThemeColorType)1;
	}

	public override string GetModName()
	{
		return "Anime Crossover Clash";
	}
}
public class LimitBreakCard : CustomCard
{
	public const string CardTitle = "Limit Break";

	private const float HealthBonus = 1.15f;

	public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
	{
		cardInfo.allowMultiple = true;
		statModifiers.health = 1.15f;
	}

	public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
	{
	}

	protected override string GetTitle()
	{
		return "Limit Break";
	}

	protected override string GetDescription()
	{
		return "You've found a new power. With a full ultimate gauge, hold Charge to transform: Super Saiyan, Bankai, Gear 5...";
	}

	protected override GameObject GetCardArt()
	{
		return CardArt.Get("limit_break_cardart.png");
	}

	protected override Rarity GetRarity()
	{
		return (Rarity)2;
	}

	protected override CardInfoStat[] GetStats()
	{
		return (CardInfoStat[])(object)new CardInfoStat[3]
		{
			CardArt.Stat(positive: true, "Transformation", "unlocked"),
			CardArt.Stat(positive: true, "Full gauge + hold " + HeroConfig.ChargeLabel, "transform"),
			CardArt.Stat(positive: true, "Health", CardArt.Percent(1.15f))
		};
	}

	protected override CardThemeColorType GetTheme()
	{
		return (CardThemeColorType)4;
	}

	public override string GetModName()
	{
		return "Anime Crossover Clash";
	}
}
public class CrossoverEpisodeCard : CustomCard
{
	public const string CardTitle = "Crossover Episode";

	public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
	{
		cardInfo.allowMultiple = false;
		statModifiers.health = 1.1f;
	}

	public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
	{
		Story.Grant(player, "Crossover Episode", () => (CardInfo)null, null, delegate
		{
			HeroRegistry.Entry entry = HeroRegistry.Random(player, HeroRegistry.HeroOf(player), otherSeries: true);
			if (entry != null)
			{
				HeroNet.SendAssistSet(player, entry.Title);
			}
		});
	}

	protected override string GetTitle()
	{
		return "Crossover Episode";
	}

	protected override string GetDescription()
	{
		return "Worlds collide! A hero from another series becomes your partner. Press Assist and they jump in.";
	}

	protected override GameObject GetCardArt()
	{
		return CardArt.Get("crossover_episode_cardart.png");
	}

	protected override Rarity GetRarity()
	{
		return (Rarity)2;
	}

	protected override CardInfoStat[] GetStats()
	{
		return (CardInfoStat[])(object)new CardInfoStat[3]
		{
			CardArt.Stat(positive: true, "Assist partner", "another series"),
			CardArt.Stat(positive: true, "Assist " + HeroConfig.AssistLabel, "their signature move"),
			CardArt.Stat(positive: true, "Health", "+10%")
		};
	}

	protected override CardThemeColorType GetTheme()
	{
		return (CardThemeColorType)7;
	}

	public override string GetModName()
	{
		return "Anime Crossover Clash";
	}
}
public class ReincarnationCard : CustomCard
{
	public const string CardTitle = "Reincarnation";

	private const float HealthBonus = 1.15f;

	public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
	{
		cardInfo.allowMultiple = true;
		statModifiers.health = 1.15f;
	}

	public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
	{
		HeroRegistry.Entry old = null;
		Story.Grant(player, "Reincarnation", delegate
		{
			old = HeroRegistry.HeroOf(player);
			return (old == null) ? null : HeroRegistry.Random(player, old, otherSeries: false)?.Card;
		}, () => (old == null) ? null : old.Card);
		Hero[] components = ((Component)player).GetComponents<Hero>();
		foreach (Hero hero in components)
		{
			if (hero.keepWithoutCard && !hero.IsAssist)
			{
				Object.Destroy((Object)(object)hero);
			}
		}
	}

	protected override string GetTitle()
	{
		return "Reincarnation";
	}

	protected override string GetDescription()
	{
		return "Reborn in yet another world. Your hero is swapped for a different random one.";
	}

	protected override GameObject GetCardArt()
	{
		return CardArt.Get("reincarnation_cardart.png");
	}

	protected override Rarity GetRarity()
	{
		return (Rarity)1;
	}

	protected override CardInfoStat[] GetStats()
	{
		return (CardInfoStat[])(object)new CardInfoStat[2]
		{
			CardArt.Stat(positive: true, "Hero", "swapped for another"),
			CardArt.Stat(positive: true, "Health", CardArt.Percent(1.15f))
		};
	}

	protected override CardThemeColorType GetTheme()
	{
		return (CardThemeColorType)6;
	}

	public override string GetModName()
	{
		return "Anime Crossover Clash";
	}
}
public class FinalEpisodeCard : CustomCard
{
	public const string CardTitle = "Final Episode";

	private const float HealthBonus = 1.2f;

	private const float DamageBonus = 1.1f;

	public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
	{
		cardInfo.allowMultiple = true;
		statModifiers.health = 1.2f;
		gun.damage = 1.1f;
	}

	public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
	{
		Story.Grant(player, "Final Episode", () => (CardInfo)null, () => HeroRegistry.HeroOf(player)?.Card);
		Hero[] components = ((Component)player).GetComponents<Hero>();
		foreach (Hero hero in components)
		{
			if (hero.keepWithoutCard && !hero.IsAssist)
			{
				Object.Destroy((Object)(object)hero);
			}
		}
	}

	protected override string GetTitle()
	{
		return "Final Episode";
	}

	protected override string GetDescription()
	{
		return "Your hero's story is over. They leave, your gun comes back, and you're free to choose a new hero.";
	}

	protected override GameObject GetCardArt()
	{
		return CardArt.Get("final_episode_cardart.png");
	}

	protected override Rarity GetRarity()
	{
		return (Rarity)0;
	}

	protected override CardInfoStat[] GetStats()
	{
		return (CardInfoStat[])(object)new CardInfoStat[3]
		{
			CardArt.Stat(positive: false, "Hero", "removed"),
			CardArt.Stat(positive: true, "Health", CardArt.Percent(1.2f)),
			CardArt.Stat(positive: true, "Damage", CardArt.Percent(1.1f))
		};
	}

	protected override CardThemeColorType GetTheme()
	{
		return (CardThemeColorType)3;
	}

	public override string GetModName()
	{
		return "Anime Crossover Clash";
	}
}
internal static class Story
{
	private static readonly Dictionary<string, int> spent = new Dictionary<string, int>();

	public static void ResetSpent()
	{
		spent.Clear();
	}

	public static void Grant(Player player, string title, Func<CardInfo> pick, Func<CardInfo> remove, Action then = null)
	{
		if (!((Object)(object)Plugin.Instance == (Object)null) && (PhotonNetwork.OfflineMode || PhotonNetwork.IsMasterClient))
		{
			((MonoBehaviour)Plugin.Instance).StartCoroutine(GrantLater(player, title, pick, remove, then));
		}
	}

	private static IEnumerator GrantLater(Player player, string title, Func<CardInfo> pick, Func<CardInfo> remove, Action then)
	{
		yield return (object)new WaitForSeconds(0.2f);
		if ((Object)(object)player == (Object)null)
		{
			yield break;
		}
		int num = HeroStats.Count(player, title);
		string key = player.playerID + "|" + title;
		spent.TryGetValue(key, out var value);
		if (num <= value)
		{
			spent[key] = num;
			yield break;
		}
		spent[key] = num;
		CardInfo card = pick();
		CardInfo val = remove?.Invoke();
		then?.Invoke();
		if ((Object)(object)val != (Object)null)
		{
			Cards.instance.RemoveCardFromPlayer(player, val, (SelectionType)0, true);
			Debug.Log("[Crossover] player " + player.playerID + " lost " + val.cardName);
			yield return (object)new WaitForSeconds(0.3f);
			if ((Object)(object)player == (Object)null)
			{
				yield break;
			}
		}
		if (!((Object)(object)card == (Object)null))
		{
			Cards.instance.AddCardToPlayer(player, card, false, "", 2f, 0f, true);
			Debug.Log("[Crossover] player " + player.playerID + " got " + card.cardName);
		}
	}
}
public static class HeroStats
{
	public const float FriendRange = 8f;

	public static int Count(Player p, string title)
	{
		int num = 0;
		List<CardInfo> list = (((Object)(object)p != (Object)null) ? p.data.currentCards : null);
		if (list != null)
		{
			foreach (CardInfo item in list)
			{
				if ((Object)(object)item != (Object)null && item.cardName == title)
				{
					num++;
				}
			}
		}
		return num;
	}

	private static int Training(Player p)
	{
		return Mathf.Min(Count(p, "Training Arc"), 3);
	}

	public static float MaxKi(Player p)
	{
		return 100f + 30f * (float)Training(p);
	}

	public static float KiRegenMult(Player p)
	{
		float num = HeroConfig.KiRegenMult * (1f + 0.2f * (float)Training(p));
		if (FriendNear(p))
		{
			num *= 1.5f;
		}
		return num;
	}

	public static float KiCostMult(Player p)
	{
		if (!Hero.HasCard(p, "Arcane Overflow"))
		{
			return 1f;
		}
		return 0.75f;
	}

	public static float CooldownMult(Player p)
	{
		return HeroConfig.CooldownMult;
	}

	public static float UltGainMult(Player p)
	{
		return HeroConfig.UltGainMult * (Hero.HasCard(p, "Main Character Energy") ? 1.5f : 1f);
	}

	public static bool FriendNear(Player p)
	{
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)p == (Object)null || !Hero.HasCard(p, "Power of Friendship") || (Object)(object)PlayerManager.instance == (Object)null)
		{
			return false;
		}
		foreach (Player player in PlayerManager.instance.players)
		{
			if ((Object)(object)player != (Object)(object)p && player.teamID == p.teamID && !player.data.dead && Vector2.Distance(Vector2.op_Implicit(((Component)player).transform.position), Vector2.op_Implicit(((Component)p).transform.position)) <= 8f)
			{
				return true;
			}
		}
		return false;
	}

	public static float DamageMult(Player p, Player target)
	{
		float num = Empowered.Multiplier(p) * HeroConfig.DamageMult * (1f + 0.05f * (float)Training(p));
		if (FriendNear(p))
		{
			num *= 1.25f;
		}
		if ((Object)(object)target != (Object)null && (Object)(object)p.data.lastSourceOfDamage == (Object)(object)target && Hero.HasCard(p, "Rival"))
		{
			num *= 1.3f;
		}
		Hero hero = Hero.Main(p);
		if ((Object)(object)hero != (Object)null)
		{
			num *= hero.PassiveDamage;
		}
		return num;
	}

	public static float Damage(Player owner, float baseDamage, Player target)
	{
		Gun val = (((Object)(object)owner.data.weaponHandler != (Object)null) ? owner.data.weaponHandler.gun : null);
		return baseDamage * (((Object)(object)val != (Object)null) ? Mathf.Max(0.2f, val.damage) : 1f) * DamageMult(owner, target);
	}

	public static void Deal(Player owner, Player target, Vector2 dir, float baseDamage)
	{
		//IL_0033: 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_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: 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_0056: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)owner == (Object)null) && !((Object)(object)target == (Object)null))
		{
			float num = Damage(owner, baseDamage, target);
			Vector2 val = ((((Vector2)(ref dir)).sqrMagnitude > 0.0001f) ? ((Vector2)(ref dir)).normalized : Vector2.up);
			((Damagable)target.data.healthHandler).CallTakeDamage(val * num, Vector2.op_Implicit(((Component)target).transform.position), (GameObject)null, owner, true);
			Credit(owner, num);
		}
	}

	public static void Credit(Player owner, float damage)
	{
		if (!((Object)(object)owner == (Object)null) && owner.data.view.IsMine)
		{
			Hero hero = Hero.Main(owner);
			if ((Object)(object)hero != (Object)null)
			{
				hero.OnDealt(damage);
			}
		}
	}
}
public static class PlotArmor
{
	private static readonly HashSet<int> spent = new HashSet<int>();

	public static void ResetRound()
	{
		spent.Clear();
	}

	public static bool Save(Player p, ref Vector2 damage)
	{
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)p == (Object)null || spent.Contains(p.playerID) || !Hero.HasCard(p, "Plot Armor"))
		{
			return false;
		}
		float health = p.data.health;
		if (((Vector2)(ref damage)).magnitude < health)
		{
			return false;
		}
		spent.Add(p.playerID);
		damage = ((Vector2)(ref damage)).normalized * Mathf.Max(0f, health - 1f);
		PopText.Spawn("PLOT ARMOR!", ((Component)p).transform.position + Vector3.up * 2.4f, new Color(1f, 0.9f, 0.45f), 8f, 1.4f, Vector3.up * 0.6f);
		RingFx.Spawn(((Component)p).transform.position, new Color(1f, 0.9f, 0.45f, 0.9f), 0.5f, 3.5f, 0.5f);
		Sfx.Play("chime", 0.9f, 0.8f);
		return true;
	}
}
public abstract class TropeCard : CustomCard
{
	protected abstract string Title { get; }

	protected abstract string ArtKey { get; }

	protected abstract string Description { get; }

	protected abstract CardInfoStat[] Lines { get; }

	protected virtual bool Multiple => false;

	protected virtual void Stats(Gun gun, CharacterStatModifiers statModifiers, Block block)
	{
	}

	public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
	{
		cardInfo.allowMultiple = Multiple;
		Stats(gun, statModifiers, block);
	}

	public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
	{
	}

	protected override string GetTitle()
	{
		return Title;
	}

	protected override string GetDescription()
	{
		return Description;
	}

	protected override GameObject GetCardArt()
	{
		return CardArt.Get(ArtKey + "_cardart.png");
	}

	protected override CardInfoStat[] GetStats()
	{
		return Lines;
	}

	public override string GetModName()
	{
		return "Anime Crossover Clash";
	}
}
public class PlotArmorCard : TropeCard
{
	public const string CardTitle = "Plot Armor";

	protected override string Title => "Plot Armor";

	protected override string ArtKey => "plot_armor";

	protected override string Description => "The main character can't lose before the final episode. Once a round, a finishing blow leaves you on 1 HP.";

	protected override CardInfoStat[] Lines => (CardInfoStat[])(object)new CardInfoStat[1] { CardArt.Stat(positive: true, "Lethal hit", "survive once per round") };

	protected override Rarity GetRarity()
	{
		return (Rarity)2;
	}

	protected override CardThemeColorType GetTheme()
	{
		return (CardThemeColorType)1;
	}
}
public class PowerOfFriendshipCard : TropeCard
{
	public const string CardTitle = "Power of Friendship";

	public const float DamageMult = 1.25f;

	protected override string Title => "Power of Friendship";

	protected override string ArtKey => "power_of_friendship";

	protected override string Description => "Your nakama are your strength. Near a teammate, your hero hits harder and ki flows faster.";

	protected override CardInfoStat[] Lines => (CardInfoStat[])(object)new CardInfoStat[2]
	{
		CardArt.Stat(positive: true, "Near a teammate", "+25% damage, +50% ki"),
		CardArt.Stat(positive: true, "Health", "+15%")
	};

	protected override Rarity GetRarity()
	{
		return (Rarity)1;
	}

	protected override CardThemeColorType GetTheme()
	{
		return (CardThemeColorType)6;
	}

	protected override void Stats(Gun gun, CharacterStatModifiers statModifiers, Block block)
	{
		statModifiers.health = 1.15f;
	}
}
public class MainCharacterEnergyCard : TropeCard
{
	public const string CardTitle = "Main Character Energy";

	public const float GainMult = 1.5f;

	protected override string Title => "Main Character Energy";

	protected override string ArtKey => "main_character_energy";

	protected override string Description => "The story revolves around you. Your ultimate is ready sooner.";

	protected override CardInfoStat[] Lines => (CardInfoStat[])(object)new CardInfoStat[2]
	{
		CardArt.Stat(positive: true, "Ultimate gauge", "+50% faster"),
		CardArt.Stat(positive: true, "Health", "+10%")
	};

	protected override Rarity GetRarity()
	{
		return (Rarity)1;
	}

	protected override CardThemeColorType GetTheme()
	{
		return (CardThemeColorType)8;
	}

	protected override void Stats(Gun gun, CharacterStatModifiers statModifiers, Block block)
	{
		statModifiers.health = 1.1f;
	}
}
public class RivalCard : TropeCard
{
	public const string CardTitle = "Rival";

	public const float DamageMult = 1.3f;

	protected override string Title => "Rival";

	protected override string ArtKey => "rival";

	protected override string Description => "Whoever hurt you last is your rival now. You'll settle it.";

	protected override CardInfoStat[] Lines => (CardInfoStat[])(object)new CardInfoStat[2]
	{
		CardArt.Stat(positive: true, "Vs. last attacker", "+30% hero damage"),
		CardArt.Stat(positive: true, "Movement speed", "+5%")
	};

	protected override Rarity GetRarity()
	{
		return (Rarity)1;
	}

	protected override CardThemeColorType GetTheme()
	{
		return (CardThemeColorType)0;
	}

	protected override void Stats(Gun gun, CharacterStatModifiers statModifiers, Block block)
	{
		statModifiers.movementSpeed = 1.05f;
	}
}
public class TrainingArcCard : TropeCard
{
	public const string CardTitle = "Training Arc";

	public const int MaxCopies = 3;

	public const float KiPerCopy = 30f;

	public const float DamagePerCopy = 0.05f;

	protected override string Title => "Training Arc";

	protected override string ArtKey => "training_arc";

	protected override string Description => "Three episodes of push-ups and a waterfall. Stacks up to three times.";

	protected override bool Multiple => true;

	protected override CardInfoStat[] Lines => (CardInfoStat[])(object)new CardInfoStat[3]
	{
		CardArt.Stat(positive: true, "Max ki", "+30"),
		CardArt.Stat(positive: true, "Ki regen", "+20%"),
		CardArt.Stat(positive: true, "Hero damage", "+5%")
	};

	protected override Rarity GetRarity()
	{
		return (Rarity)0;
	}

	protected override CardThemeColorType GetTheme()
	{
		return (CardThemeColorType)7;
	}
}
public class CutIn : MonoBehaviour
{
	private const float In = 0.16f;

	private const float Hold = 0.7f;

	private const float Out = 0.2f;

	private static readonly Dictionary<string, Sprite> portraits = new Dictionary<string, Sprite>();

	private static readonly List<CutIn> showing = new List<CutIn>();

	private RectTransform band;

	private Image flash;

	private readonly List<RectTransform> streaks = new List<RectTransform>();

	private float born;

	private float slot;

	public static void Show(string lookKey, string line, string sub, Color color)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Expected O, but got Unknown
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		if (HeroConfig.CutIns != null && !HeroConfig.CutIns.Value)
		{
			PopText.Spawn(line, Vector3.up * 6f, color, 9f, 1.2f, Vector3.up * 0.3f);
			return;
		}
		try
		{
			showing.RemoveAll((CutIn x) => (Object)(object)x == (Object)null);
			GameObject val = new GameObject("CutIn");
			Object.DontDestroyOnLoad((Object)val);
			CutIn cutIn = val.AddComponent<CutIn>();
			cutIn.born = Time.unscaledTime;
			cutIn.slot = showing.Count % 3;
			showing.Add(cutIn);
			cutIn.Build(lookKey, line, sub, color);
		}
		catch (Exception ex)
		{
			Debug.Log("[Crossover] no cut-in: " + ex.Message);
		}
	}

	private void Build(string lookKey, string line, string sub, Color color)
	{
		//IL_0036: 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_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: 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_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: Unknown result type (might be due to invalid IL or missing references)
		//IL_014c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: Unknown result type (might be due to invalid IL or missing references)
		//IL_0184: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0269: Unknown result type (might be due to invalid IL or missing references)
		//IL_026b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0275: Unknown result type (might be due to invalid IL or missing references)
		//IL_0284: Unknown result type (might be due to invalid IL or missing references)
		//IL_0293: Unknown result type (might be due to invalid IL or missing references)
		//IL_02db: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0213: Unknown result type (might be due to invalid IL or missing references)
		//IL_0222: Unknown result type (might be due to invalid IL or missing references)
		//IL_0227: Unknown result type (might be due to invalid IL or missing references)
		//IL_0253: Unknown result type (might be due to invalid IL or missing references)
		Canvas obj = ((Component)this).gameObject.AddComponent<Canvas>();
		obj.renderMode = (RenderMode)0;
		obj.sortingOrder = 80;
		CanvasScaler obj2 = ((Component)this).gameObject.AddComponent<CanvasScaler>();
		obj2.uiScaleMode = (ScaleMode)1;
		obj2.referenceResolution = new Vector2(1920f, 1080f);
		obj2.matchWidthOrHeight = 0.5f;
		flash = ((Component)Box(((Component)this).transform, Vector2.zero, new Vector2(4000f, 3000f), new Color(1f, 1f, 1f, 0f))).GetComponent<Image>();
		band = Box(((Component)this).transform, new Vector2(0f, 120f - slot * 260f), new Vector2(2600f, 230f), new Color(0.06f, 0.04f, 0.1f, 0.94f));
		((Transform)band).localRotation = Quaternion.Euler(0f, 0f, -7f);
		Box((Transform)(object)band, new Vector2(0f, 118f), new Vector2(2600f, 10f), color);
		Box((Transform)(object)band, new Vector2(0f, -118f), new Vector2(2600f, 10f), color);
		for (int i = 0; i < 14; i++)
		{
			RectTransform item = Box((Transform)(object)band, new Vector2(Random.Range(-1300f, 1300f), Random.Range(-100f, 100f)), new Vector2(Random.Range(120f, 420f), Random.Range(2f, 5f)), new Color(color.r, color.g, color.b, Random.Range(0.25f, 0.6f)));
			streaks.Add(item);
		}
		Sprite val = Portrait(lookKey);
		if ((Object)(object)val != (Object)null)
		{
			RectTransform obj3 = Box((Transform)(object)band, new Vector2(-560f, 0f), new Vector2(300f, 300f), Color.white);
			Image component = ((Component)obj3).GetComponent<Image>();
			component.sprite = val;
			component.preserveAspect = true;
			((Transform)obj3).localRotation = Quaternion.Euler(0f, 0f, 7f);
		}
		TextMeshProUGUI obj4 = Text((Transform)(object)band, line, 86f, Color.Lerp(color, Color.white, 0.35f), new Vector2(140f, 22f), new Vector2(1500f, 120f));
		((TMP_Text)obj4).fontStyle = (FontStyles)3;
		((TMP_Text)obj4).enableAutoSizing = true;
		((TMP_Text)obj4).fontSizeMin = 40f;
		((TMP_Text)obj4).fontSizeMax = 86f;
		((TMP_Text)Text((Transform)(object)band, sub, 30f, new Color(0.9f, 0.9f, 0.95f), new Vector2(140f, -68f), new Vector2(1500f, 44f))).fontStyle = (FontStyles)2;
		Update();
	}

	private void Update()
	{
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: 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_00f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0116: Unknown result type (might be due to invalid IL or missing references)
		//IL_016c: Unknown result type (might be due to invalid IL or missing references)
		float num = Time.unscaledTime - born;
		if (num >= 1.0600001f)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
			return;
		}
		float num2 = ((num < 0.16f) ? Mathf.Lerp(-2600f, 0f, 1f - (1f - num / 0.16f) * (1f - num / 0.16f)) : ((!(num < 0.86f)) ? Mathf.Lerp(60f, 2800f, (num - 0.16f - 0.7f) / 0.2f) : Mathf.Lerp(0f, 60f, (num - 0.16f) / 0.7f)));
		band.anchoredPosition = new Vector2(num2, band.anchoredPosition.y);
		foreach (RectTransform streak in streaks)
		{
			Vector2 anchoredPosition = streak.anchoredPosition;
			anchoredPosition.x -= Time.unscaledDeltaTime * 3200f;
			if (anchoredPosition.x < -1400f)
			{
				anchoredPosition.x += 2800f;
			}
			streak.anchoredPosition = anchoredPosition;
		}
		((Graphic)flash).color = new Color(1f, 1f, 1f, (num < 0.12f) ? (0.28f * (1f - num / 0.12f)) : 0f);
	}

	private void OnDestroy()
	{
		showing.Remove(this);
	}

	private static Sprite Portrait(string lookKey)
	{
		//IL_0048: 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)
		if (portraits.TryGetValue(lookKey, out var value))
		{
			return value;
		}
		Texture2D val = CardArt.LoadTexture(lookKey + "_cardart.png", warnIfMissing: false);
		value = (((Object)(object)val != (Object)null) ? Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)) : null);
		portraits[lookKey] = value;
		return value;
	}

	private static RectTransform Box(Transform parent, Vector2 pos, Vector2 size, Color color)
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Expected O, but got Unknown
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: 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_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: 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_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Expected O, but got Unknown
		GameObject val = new GameObject("Box", new Type[1] { typeof(RectTransform) });
		RectTransform val2 = (RectTransform)val.transform;
		((Transform)val2).SetParent(parent, false);
		Vector2 val3 = default(Vector2);
		((Vector2)(ref val3))..ctor(0.5f, 0.5f);
		val2.pivot = val3;
		Vector2 anchorMin = (val2.anchorMax = val3);
		val2.anchorMin = anchorMin;
		val2.anchoredPosition = pos;
		val2.sizeDelta = size;
		Image obj = val.AddComponent<Image>();
		obj.sprite = HeroSprites.White();
		((Graphic)obj).color = color;
		((Graphic)obj).raycastTarget = false;
		return val2;
	}

	private static TextMeshProUGUI Text(Transform parent, string text, float size, Color color, Vector2 pos, Vector2 box)
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: 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_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("Text", new Type[1] { typeof(RectTransform) });
		RectTransform val2 = (RectTransform)val.transform;
		((Transform)val2).SetParent(parent, false);
		Vector2 val3 = default(Vector2);
		((Vector2)(ref val3))..ctor(0.5f, 0.5f);
		val2.pivot = val3;
		Vector2 anchorMin = (val2.anchorMax = val3);
		val2.anchorMin = anchorMin;
		val2.anchoredPosition = pos;
		val2.sizeDelta = box;
		TextMeshProUGUI obj = val.AddComponent<TextMeshProUGUI>();
		((TMP_Text)obj).text = text;
		((TMP_Text)obj).fontSize = size;
		((Graphic)obj).color = color;
		((TMP_Text)obj).alignment = (TextAlignmentOptions)513;
		((TMP_Text)obj).enableWordWrapping = false;
		((Graphic)obj).raycastTarget = false;
		((TMP_Text)obj).outlineWidth = 0.22f;
		((TMP_Text)obj).outlineColor = new Color32((byte)10, (byte)5, (byte)20, byte.MaxValue);
		return obj;
	}
}
public class HeroHud : MonoBehaviour
{
	private class Chip
	{
		public Image back;

		public Image cooldown;

		public TextMeshProUGUI key;

		public TextMeshProUGUI name;

		public TextMeshProUGUI cost;
	}

	private class Panel
	{
		public GameObject go;

		public Hero hero;

		public Image portrait;

		public Image ki;

		public Image ult;

		public TextMeshProUGUI title;

		public TextMeshProUGUI kiText;

		public TextMeshProUGUI ultText;

		public Chip[] chips;
	}

	private static HeroHud instance;

	private static readonly HashSet<string> introduced = new HashSet<string>();

	private static readonly Dictionary<string, Sprite> portraits = new Dictionary<string, Sprite>();

	private static readonly Color KiColor = new Color(0.35f, 0.85f, 1f);

	private static readonly Color UltColor = new Color(1f, 0.8f, 0.25f);

	private static readonly Color FormColor = new Color(1f, 0.45f, 0.9f);

	private RectTransform canvas;

	private readonly Dictionary<Player, Panel> panels = new Dictionary<Player, Panel>();

	private float nextScan;

	private GameObject strip;

	private CanvasGroup stripGroup;

	private float stripUntil;

	private const float ChipStep = 112f;

	private const float BarX = 158f;

	private const float BarW = 330f;

	private static HeroHud Get()
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Expected O, but got Unknown
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Expected O, but got Unknown
		if ((Object)(object)instance != (Object)null)
		{
			return instance;
		}
		GameObject val = new GameObject("CrossoverHud");
		Object.DontDestroyOnLoad((Object)(object)val);
		instance = val.AddComponent<HeroHud>();
		Canvas obj = val.AddComponent<Canvas>();
		obj.renderMode = (RenderMode)0;
		obj.sortingOrder = 60;
		CanvasScaler obj2 = val.AddComponent<CanvasScaler>();
		obj2.uiScaleMode = (ScaleMode)1;
		obj2.referenceResolution = new Vector2(1920f, 1080f);
		obj2.matchWidthOrHeight = 0.5f;
		instance.canvas = (RectTransform)val.transform;
		return instance;
	}

	public static void Ensure()
	{
		Get();
	}

	public static void Arrive(Hero h)
	{
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			if (!((Object)(object)h == (Object)null) && !introduced.Contains(h.Title))
			{
				introduced.Add(h.Title);
				CutIn.Show(h.Look.Key, h.Title.ToUpper() + "!", h.Info.Anime + "  -  " + h.Class, h.Look.Glow);
				Sfx.Play("awaken", 0.9f);
				Get().BuildStrip(h);
			}
		}
		catch (Exception ex)
		{
			Debug.Log("[Crossover] no intro: " + ex.Message);
		}
	}

	private void BuildStrip(Hero h)
	{
		//IL_0029: 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_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Unknown result type (might be due to invalid IL or missing references)
		//IL_0177: Unknown result type (might be due to invalid IL or missing references)
		//IL_017c: Unknown result type (might be due to invalid IL or missing references)
		//IL_018b: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)strip != (Object)null)
		{
			Object.Destroy((Object)(object)strip);
		}
		RectTransform val = Box((Transform)(object)canvas, new Vector2(0.5f, 0f), new Vector2(0.5f, 0.5f), new Vector2(0f, 120f), new Vector2(1300f, 64f), new Color(0.05f, 0.03f, 0.1f, 0.82f));
		strip = ((Component)val).gameObject;
		stripGroup = strip.AddComponent<CanvasGroup>();
		string text = "<color=#ffe08a>";
		string text2 = text + "Fire</color> " + ClassCombo(h.Class) + "   " + text + HeroConfig.KeyLabel(0) + "/" + HeroConfig.KeyLabel(1) + "/" + HeroConfig.KeyLabel(2) + "</color> moves (ki)   " + text + "Hold " + HeroConfig.ChargeLabel + "</color> charge   " + text + HeroConfig.UltLabel + "</color> ultimate   " + text + "Block</color> +ki   " + text + HeroConfig.GunLabel + "</color> gun";
		TextMeshProUGUI obj = Text((Transform)(object)val, text2, 24f, Color.white, new Vector2(0.5f, 0.5f), Vector2.zero, new Vector2(1260f, 56f), (TextAlignmentOptions)514);
		((TMP_Text)obj).enableAutoSizing = true;
		((TMP_Text)obj).fontSizeMin = 14f;
		((TMP_Text)obj).fontSizeMax = 24f;
		stripUntil = Time.unscaledTime + 8f;
	}

	private static string ClassCombo(HeroClass c)
	{
		return c switch
		{
			HeroClass.Swordsman => "slash, slash, launcher", 
			HeroClass.Shinobi => "kunai, kunai, kunai fan", 
			HeroClass.Caster => "bolt, bolt, ki blast", 
			_ => "jab, jab, kick", 
		};
	}

	private void Update()
	{
		if ((Object)(object)strip != (Object)null)
		{
			float num = stripUntil - Time.unscaledTime;
			stripGroup.alpha = Mathf.Clamp01(num / 0.8f);
			if (num <= 0f)
			{
				Object.Destroy((Object)(object)strip);
				strip = null;
			}
		}
		if (Time.unscaledTime >= nextScan)
		{
			nextScan = Time.unscaledTime + 0.25f;
			Rescan(HeroConfig.Hud != null && HeroConfig.Hud.Value);
		}
		foreach (KeyValuePair<Player, Panel> panel in panels)
		{
			Refresh(panel.Value);
		}
	}

	private void Rescan(bool on)
	{
		//IL_0248: Unknown result type (might be due to invalid IL or missing references)
		//IL_0261: Unknown result type (might be due to invalid IL or missing references)
		List<Player> list = new List<Player>();
		if (on && (Object)(object)PlayerManager.instance != (Object)null)
		{
			foreach (Player player in PlayerManager.instance.players)
			{
				if ((Object)(object)player != (Object)null && player.data.view.IsMine && !player.data.dead && (Object)(object)Hero.Main(player) != (Object)null)
				{
					list.Add(player);
				}
			}
		}
		List<Player> list2 = new List<Player>();
		foreach (KeyValuePair<Player, Panel> panel in panels)
		{
			if (!list.Contains(panel.Key) || (Object)(object)panel.Value.hero == (Object)null || (Object)(object)panel.Value.hero != (Object)(object)Hero.Main(panel.Key) || (Object)(object)Hero.AssistOf(panel.Key) != (Object)null != (panel.Value.chips.Length == 4))
			{
				list2.Add(panel.Key);
			}
		}
		foreach (Player item in list2)
		{
			if ((Object)(object)panels[item].go != (Object)null)
			{
				Object.Destroy((Object)(object)panels[item].go);
			}
			panels.Remove(item);
		}
		foreach (Player item2 in list)
		{
			if (!panels.ContainsKey(item2) && panels.Count < 4)
			{
				panels[item2] = Build(Hero.Main(item2));
			}
		}
		int num = 0;
		foreach (KeyValuePair<Player, Panel> panel2 in panels)
		{
			if ((Object)(object)panel2.Value.go != (Object)null)
			{
				((RectTransform)panel2.Value.go.transform).anchoredPosition = new Vector2(24f, (float)(24 + num++ * 170));
			}
		}
	}

	private Panel Build(Hero h)
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Expected O, but got Unknown
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Expected O, but got Unknown
		//IL_0047: 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_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: 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_0096: 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_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
		//IL_0141: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: Unknown result type (might be due to invalid IL or missing references)
		//IL_0155: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_020c: Unknown result type (might be due to invalid IL or missing references)
		//IL_021b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0247: Unknown result type (might be due to invalid IL or missing references)
		//IL_0251: Unknown result type (might be due to invalid IL or missing references)
		//IL_026c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0271: Unknown result type (might be due to invalid IL or missing references)
		//IL_0280: Unknown result type (might be due to invalid IL or missing references)
		//IL_028f: Unknown result type (might be due to invalid IL or missing references)
		//IL_02af: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0307: Unknown result type (might be due to invalid IL or missing references)
		//IL_0320: Unknown result type (might be due to invalid IL or missing references)
		//IL_0342: Unknown result type (might be due to invalid IL or missing references)
		//IL_0347: Unknown result type (might be due to invalid IL or missing references)
		//IL_0356: Unknown result type (might be due to invalid IL or missing references)
		//IL_0365: Unknown result type (might be due to invalid IL or missing references)
		//IL_03af: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0411: Unknown result type (might be due to invalid IL or missing references)
		//IL_0416: Unknown result type (might be due to invalid IL or missing references)
		//IL_041b: Unknown result type (might be due to invalid IL or missing references)
		//IL_042a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0443: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0523: Unknown result type (might be due to invalid IL or missing references)
		//IL_0528: Unknown result type (might be due to invalid IL or missing references)
		//IL_0537: Unknown result type (might be due to invalid IL or missing references)
		//IL_0546: Unknown result type (might be due to invalid IL or missing references)
		//IL_0582: Unknown result type (might be due to invalid IL or missing references)
		//IL_0587: Unknown result type (might be due to invalid IL or missing references)
		//IL_0596: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a5: Unknown result type (might be due to invalid IL or missing references)
		Panel panel = new Panel
		{
			hero = h
		};
		GameObject val = new GameObject("HeroPanel", new Type[1] { typeof(RectTransform) });
		RectTransform val2 = (RectTransform)val.transform;
		((Transform)val2).SetParent((Transform)(object)canvas, false);
		Vector2 val3 = (val2.pivot = Vector2.zero);
		Vector2 anchorMin = (val2.anchorMax = val3);
		val2.anchorMin = anchorMin;
		val2.sizeDelta = new Vector2(620f, 158f);
		panel.go = val;
		Color color = Color.Lerp(h.Look.Glow, Color.white, 0.2f);
		((Transform)Box((Transform)(object)val2, Vector2.zero, Vector2.zero, new Vector2(60f, 0f), new Vector2(560f, 158f), new Color(0.05f, 0.03f, 0.1f, 0.7f))).localRotation = Quaternion.Euler(0f, 0f, 0f);
		Box((Transform)(object)val2, Vector2.zero, Vector2.zero, new Vector2(60f, 154f), new Vector2(560f, 4f), color);
		RectTransform val5 = Box((Transform)(object)val2, Vector2.zero, Vector2.zero, new Vector2(0f, 6f), new Vector2(150f, 150f), Color.white);
		panel.portrait = ((Component)val5).GetComponent<Image>();
		Sprite val6 = Portrait(h.Look.Key);
		if ((Object)(object)val6 != (Object)null)
		{
			panel.portrait.sprite = val6;
			panel.portrait.preserveAspect = true;
		}
		else
		{
			((Graphic)panel.portrait).color = new Color(h.Look.Glow.r, h.Look.Glow.g, h.Look.Glow.b, 0.5f);
		}
		panel.title = Text((Transform)(object)val2, h.Title.ToUpper(), 26f, color, Vector2.zero, new Vector2(158f, 120f), new Vector2(380f, 34f), (TextAlignmentOptions)513);
		((TMP_Text)panel.title).fontStyle = (FontStyles)3;
		panel.ki = Bar(val2, new Vector2(158f, 100f), 14f, KiColor);
		panel.kiText = Text((Transform)(object)val2, "", 15f, KiColor, Vector2.zero, new Vector2(496f, 98f), new Vector2(110f, 22f), (TextAlignmentOptions)513);
		panel.ult = Bar(val2, new Vector2(158f, 76f), 18f, UltColor);
		for (int i = 1; i < 4; i++)
		{
			Box((Transform)(object)val2, Vector2.zero, Vector2.zero, new Vector2(158f + 330f * (float)i / 4f - 1f, 76f), new Vector2(2f, 18f), new Color(0.05f, 0.03f, 0.1f, 0.9f));
		}
		panel.ultText = Text((Transform)(object)val2, "", 15f, UltColor, Vector2.zero, new Vector2(496f, 75f), new Vector2(150f, 22f), (TextAlignmentOptions)513);
		bool flag = (Object)(object)Hero.AssistOf(h.Owner) != (Object)null;
		panel.chips = new Chip[flag ? 4 : 3];
		for (int j = 0; j < panel.chips.Length; j++)
		{
			Chip chip = new Chip();
			RectTransform val7 = Box((Transform)(object)val2, Vector2.zero, Vector2.zero, new Vector2(158f + (float)j * 112f, 8f), new Vector2(106f, 58f), new Color(0.12f, 0.1f, 0.2f, 0.95f));
			chip.back = ((Component)val7).GetComponent<Image>();
			RectTransform val8 = Box((Transform)(object)val7, Vector2.zero, Vector2.zero, Vector2.zero, new Vector2(106f, 58f), new Color(0f, 0f, 0f, 0.6f));
			chip.cooldown = ((Component)val8).GetComponent<Image>();
			chip.cooldown.type = (Type)3;
			chip.cooldown.fillMethod = (FillMethod)0;
			chip.cooldown.fillOrigin = 1;
			string text = ((j < 3) ? HeroConfig.KeyLabel(j) : HeroConfig.AssistLabel);
			chip.key = Text((Transform)(object)val7, text, 22f, Color.white, Vector2.zero, new Vector2(4f, 30f), new Vector2(30f, 26f), (TextAlignmentOptions)513);
			((TMP_Text)chip.key).fontStyle = (FontStyles)1;
			string text2 = ((j < 3) ? h.MoveName(j) : Hero.AssistOf(h.Owner).Title);
			chip.name = Text((Transform)(object)val7, text2, 13f, new Color(0.92f, 0.92f, 0.96f), Vector2.zero, new Vector2(4f, 4f), new Vector2(98f, 26f), (TextAlignmentOptions)1025);
			((TMP_Text)chip.name).enableWordWrapping = true;
			((TMP_Text)chip.name).overflowMode = (TextOverflowModes)1;
			chip.cost = Text((Transform)(object)val7, "", 13f, KiColor, Vector2.zero, new Vector2(34f, 34f), new Vector2(68f, 20f), (TextAlignmentOptions)516);
			panel.chips[j] = chip;
		}
		return panel;
	}

	private void Refresh(Panel pn)
	{
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0131: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0158: Unknown result type (might be due to invalid IL or missing references)
		//IL_023b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0234: Unknown result type (might be due to invalid IL or missing references)
		//IL_0293: Unknown result type (might be due to invalid IL or missing references)
		//IL_0278: Unknown result type (might be due to invalid IL or missing references)
		Hero hero = pn.hero;
		if ((Object)(object)hero == (Object)null || (Object)(object)pn.go == (Object)null || (Object)(object)hero.Owner == (Object)null)
		{
			return;
		}
		float num = Mathf.Max(1f, hero.MaxKi);
		pn.ki.fillAmount = hero.Ki / num;
		((TMP_Text)pn.kiText).text = "KI " + Mathf.FloorToInt(hero.Ki);
		if (hero.FormLeft > 0f)
		{
			((Graphic)pn.ult).color = FormColor;
			pn.ult.fillAmount = hero.FormLeft / Mathf.Max(1f, HeroConfig.FormSeconds);
			((Graphic)pn.ultText).color = FormColor;
			((TMP_Text)pn.ultText).text = Mathf.CeilToInt(hero.FormLeft) + "s";
		}
		else
		{
			bool num2 = hero.Ult >= 100f;
			bool flag = num2 && Mathf.Repeat(Time.unscaledTime, 0.5f) < 0.25f;
			((Graphic)pn.ult).color = (flag ? Color.white : UltColor);
			pn.ult.fillAmount = hero.Ult / 100f;
			((Graphic)pn.ultText).color = UltColor;
			if (!num2)
			{
				((TMP_Text)pn.ultText).text = "ULT " + Mathf.FloorToInt(hero.Ult) + "%";
			}
			else
			{
				((TMP_Text)pn.ultText).text = ((hero.NextForm != null) ? (HeroConfig.UltLabel + " / hold " + HeroConfig.ChargeLabel) : ("READY " + HeroConfig.UltLabel));
			}
		}
		for (int i = 0; i < pn.chips.Length; i++)
		{
			Chip chip = pn.chips[i];
			if (i < 3)
			{
				float num3 = hero.MoveCost(i);
				bool flag2 = hero.Ki >= num3;
				((TMP_Text)chip.cost).text = Mathf.RoundToInt(num3).ToString();
				((Graphic)chip.cost).color = (Color)(flag2 ? KiColor : new Color(1f, 0.4f, 0.4f));
				chip.cooldown.fillAmount = hero.CooldownFraction(i);
				((Graphic)chip.back).color = (flag2 ? new Color(0.12f, 0.1f, 0.2f, 0.95f) : new Color(0.25f, 0.08f, 0.1f, 0.95f));
			}
			else
			{
				((TMP_Text)chip.cost).text = "";
				chip.cooldown.fillAmount = hero.AssistFraction;
			}
		}
	}

	private static Sprite Portrait(string key)
	{
		//IL_0048: 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)
		if (portraits.TryGetValue(key, out var value))
		{
			return value;
		}
		Texture2D val = CardArt.LoadTexture(key + "_cardart.png", warnIfMissing: false);
		value = (((Object)(object)val != (Object)null) ? Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)) : null);
		portraits[key] = value;
		return value;
	}

	private static Image Bar(RectTransform parent, Vector2 pos, float height, Color color)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: 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)
		//IL_0012: 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_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: 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_004d: Unknown result type (might be due to invalid IL or missing references)
		Box((Transform)(object)parent, Vector2.zero, Vector2.zero, pos, new Vector2(330f, height), new Color(0.02f, 0.02f, 0.05f, 0.9f));
		Image component = ((Component)Box((Transform)(object)parent, Vector2.zero, Vector2.zero, pos, new Vector2(330f, height), color)).GetComponent<Image>();
		component.type = (Type)3;
		component.fillMethod = (FillMethod)0;
		component.fillOrigin = 0;
		return component;
	}

	private static RectTransform Box(Transform parent, Vector2 anchor, Vector2 pivot, Vector2 pos, Vector2 size, Color color)
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Expected O, but got Unknown
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: 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_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Expected O, but got Unknown
		GameObject val = new GameObject("Box", new Type[1] { typeof(RectTransform) });
		RectTransform val2 = (RectTransform)val.transform;
		((Transform)val2).SetParent(parent, false);
		Vector2 anchorMin = (val2.anchorMax = anchor);
		val2.anchorMin = anchorMin;
		val2.pivot = pivot;
		val2.anchoredPosition = pos;
		val2.sizeDelta = size;
		Image obj = val.AddComponent<Image>();
		obj.sprite = HeroSprites.White();
		((Graphic)obj).color = color;
		((Graphic)obj).raycastTarget = false;
		return val2;
	}

	private static TextMeshProUGUI Text(Transform parent, string text, float size, Color color, Vector2 anchor, Vector2 pos, Vector2 box, TextAlignmentOptions align)
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: 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_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: 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)
		GameObject val = new GameObject("Text", new Type[1] { typeof(RectTransform) });
		RectTransform val2 = (RectTransform)val.transform;
		((Transform)val2).SetParent(parent, false);
		Vector2 anchorMin = (val2.anchorMax = anchor);
		val2.anchorMin = anchorMin;
		val2.pivot = (Vector2)((anchor == Vector2.zero) ? Vector2.zero : new Vector2(0.5f, 0.5f));
		val2.anchoredPosition = pos;
		val2.sizeDelta = box;
		TextMeshProUGUI obj = val.AddComponent<TextMeshProUGUI>();
		((TMP_Text)obj).text = text;
		((TMP_Text)obj).fontSize = size;
		((Graphic)obj).color = color;
		((TMP_Text)obj).alignment = align;
		((TMP_Text)obj).enableWordWrapping = false;
		((Graphic)obj).raycastTarget = false;
		((TMP_Text)obj).outlineWidth = 0.2f;
		((TMP_Text)obj).outlineColor = new Color32((byte)10, (byte)5, (byte)20, byte.MaxValue);
		return obj;
	}
}
public static class Sfx
{
	private const int Rate = 44100;

	private static readonly Dictionary<string, AudioClip> clips = new Dictionary<string, AudioClip>();

	private static AudioSource[] voices;

	private static int next;

	private static readonly Random rnd = new Random(7);

	public static void Play(string name, float volume = 1f, float pitch = 1f)
	{
		try
		{
			float num = ((HeroConfig.Volume != null) ? HeroConfig.Volume.Value : 0.6f);
			if (num <= 0f)
			{
				return;
			}
			AudioClip val = Clip(name);
			if (!((Object)(object)val == (Object)null))
			{
				if (voices == null)
				{
					MakeVoices();
				}
				AudioSource obj = voices[next];
				next = (next + 1) % voices.Length;
				obj.pitch = pitch;
				obj.PlayOneShot(val, Mathf.Clamp01(volume * num));
			}
		}
		catch (Exception ex)
		{
			Debug.Log("[Crossover] sound " + name + " failed: " + ex.Message);
		}
	}

	private static void MakeVoices()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Expected O, but got Unknown
		GameObject val = new GameObject("CrossoverSfx");
		Object.DontDestroyOnLoad((Object)(object)val);
		voices = (AudioSource[])(object)new AudioSource[12];
		for (int i = 0; i < voices.Length; i++)
		{
			voices[i] = val.AddComponent<AudioSource>();
			voices[i].playOnAwake = false;
			voices[i].spatialBlend = 0f;
		}
	}

	private static AudioClip Clip(string name)
	{
		if (clips.TryGetValue(name, out var value))
		{
			return value;
		}
		float[] array;
		switch (name)
		{
		case "punch":
			array = Punch(0.09f, 90f, 0.7f);
			break;
		case "heavy":
			array = Punch(0.22f, 60f, 1f);
			break;
		case "slash":
			array = Slash();
			break;
		case "whoosh":
			array = Whoosh(0.28f);
			break;
		case "cast":
			array = Sweep(0.18f, 420f, 980f, 0.35f);
			break;
		case "beam":
			array = BeamSound();
			break;
		case "zap":
			array = Zap();
			break;
		case "boom":
			array = Boom();
			break;
		case "chime":
			array = Chime();
			break;
		case "hum":
			array = Hum();
			break;
		case "powerup":
			array = PowerUp();
			break;
		case "awaken":
			array = Awaken();
			break;
		default:
			return null;
		}
		value = AudioClip.Create("crossover_" + name, array.Length, 1, 44100, false);
		value.SetData(array, 0);
		clips[name] = value;
		return value;
	}

	private static float Noise()
	{
		return (float)(rnd.NextDouble() * 2.0 - 1.0);
	}

	private static float[] Punch(float length, float thump, float amp)
	{
		int num = (int)(length * 44100f);
		float[] array = new float[num];
		double num2 = 0.0;
		for (int i = 0; i < num; i++)
		{
			float num3 = (float)i / 44100f / length;
			float num4 = Mathf.Exp((0f - num3) * 6f);
			num2 += Math.PI * 2.0 * (double)thump * (double)(1.6f - num3 * 0.8f) / 44100.0;
			array[i] = amp * (0.75f * (float)Math.Sin(num2) * num4 + 0.45f * Noise() * Mathf.Exp((0f - num3) * 22f));
		}
		return array;
	}

	private static float[] Slash()
	{
		int num = 8820;
		float[] array = new float[num];
		float num2 = 0f;
		float num3 = 0f;
		for (int i = 0; i < num; i++)
		{
			float num4 = (float)i / 44100f;
			float num5 = (float)i / (float)num;
			float num6 = Noise();
			num2 = 0.85f * (num2 + num6 - num3);
			num3 = num6;
			float num7 = Mathf.Min(1f, num5 * 25f) * Mathf.Exp((0f - num5) * 7f);
			array[i] = num7 * (num2 * 0.55f + (float)Math.Sin(Math.PI * 6200.0 * (double)num4) * 0.12f * Mathf.Exp((0f - num5) * 10f));
		}
		return array;
	}

	private static float[] Whoosh(float length)
	{
		int num = (int)(length * 44100f);
		float[] array = new float[num];
		float num2 = 0f;
		for (int i = 0; i < num; i++)
		{
			float num3 = (float)i / (float)num;
			float num4 = Mathf.Lerp(0.02f, 0.25f, Mathf.Sin(num3 * (float)Math.PI));
			num2 += (Noise() - num2) * num4;
			array[i] = num2 * Mathf.Sin(num3 * (float)Math.PI) * 1.4f;
		}
		return array;
	}

	private static float[] Sweep(float length, float from, float to, float amp)
	{
		int num = (int)(length * 44100f);
		float[] array = new float[num];
		double num2 = 0.0;
		for (int i = 0; i < num; i++)
		{
			float num3 = (float)i / (float)num;
			num2 += Math.PI * 2.0 * (double)Mathf.Lerp(from, to, num3 * num3) / 44100.0;
			float num4 = Mathf.Min(1f, num3 * 20f) * (1f - num3);
			array[i] = amp * num4 * ((float)Math.Sin(num2) * 0.7f + (float)Math.Sin(num2 * 2.01) * 0.3f);
		}
		return array;
	}

	private static float[] BeamSound()
	{
		int num = 35280;
		float[] array = new float[num];
		double num2 = 0.0;
		float num3 = 0f;
		for (int i = 0; i < num; i++)
		{
			float num4 = (float)i / (float)num;
			num2 += Math.PI * 2.0 * (double)Mathf.Lerp(140f, 220f, Mathf.Sqrt(num4)) / 44100.0;
			num3 += (Noise() - num3) * 0.2f;
			float num5 = Mathf.Min(1f, num4 * 15f) * Mathf.Pow(1f - num4, 1.2f);
			float num6 = (float)Math.Sin(num2) + 0.5f * (float)Math.Sin(num2 * 3.0) + 0.25f * (float)Math.Sin(num2 * 5.0);
			array[i] = num5 * (num6 * 0.35f + num3 * 0.6f);
		}
		return array;
	}

	private static float[] Zap()
	{
		int num = 19845;
		float[] array = new float[num];
		for (int i = 0; i < num; i++)
		{
			float num2 = (float)i / (float)num;
			float num3 = ((rnd.NextDouble() < 0.08 * (double)(1f - num2)) ? (Noise() * 2f) : 0f);
			array[i] = Noise() * Mathf.Exp((0f - num2) * 18f) * 0.9f + num3 * 0.5f;
			array[i] = Mathf.Clamp(array[i], -1f, 1f);
		}
		return array;
	}

	private static float[] Boom()
	{
		int num = 39690;
		float[] array = new float[num];
		float num2 = 0f;
		double num3 = 0.0;
		for (int i = 0; i < num; i++)
		{
			float num4 = (float)i / (float)num;
			num2 += (Noise() - num2) * Mathf.Lerp(0.5f, 0.03f, num4);
			num3 += Math.PI * 2.0 * (double)Mathf.Lerp(70f, 35f, num4) / 44100.0;
			array[i] = (num2 * 1.2f + (float)Math.Sin(num3) * 0.6f) * Mathf.Exp((0f - num4) * 4.5f);
		}
		return array;
	}

	private static float[] Chime()
	{
		int num = 26460;
		float[] array = new float[num];
		float[] array2 = new float[3] { 660f, 880f, 1320f };
		for (int i = 0; i < array2.Length; i++)
		{
			int num2 = (int)((float)i * 0.08f * 44100f);
			for (int j = num2; j < num; j++)
			{
				float num3 = (float)(j - num2) / 44100f;
				array[j] += (float)Math.Sin(Math.PI * 2.0 * (double)array2[i] * (double)num3) * Mathf.Exp((0f - num3) * 5f) * 0.25f;
			}
		}
		return array;
	}

	private static float[] Hum()
	{
		int num = 24255;
		float[] array = new float[num];
		for (int i = 0; i < num; i++)
		{
			float num2 = (float)i / 44100f;
			float num3 = (float)i / (float)num;
			float num4 = Mathf.Min(1f, num3 * 10f) * (1f - num3);
			array[i] = num4 * 0.4f * (float)Math.Sin(Math.PI * 440.0 * (double)num2) * (0.7f + 0.3f * Mathf.Sin(num2 * 2f * (float)Math.PI * 9f));
		}
		return array;
	}

	private static float[] PowerUp()
	{
		int num = 39690;
		float[] array = new float[num];
		double num2 = 0.0;
		float num3 = 0f;
		for (int i = 0; i < num; i++)
		{
			float num4 = (float)i / (float)num;
			num2 += Math.PI * 2.0 * (double)Mathf.Lerp(60f, 320f, num4 * num4) / 44100.0;
			num3 += (Noise() - num3) * Mathf.Lerp(0.03f, 0.3f, num4);
			float num5 = Mathf.Min(1f, num4 * 6f) * ((num4 < 0.8f) ? 1f : ((1f - num4) / 0.2f));
			array[i] = num5 * ((float)Math.Sin(num2) * 0.45f + num3 * 0.7f);
		}
		return array;
	}

	private static float[] Awaken()
	{
		int num = 52920;
		float[] array = new float[num];
		float num2 = 0f;
		for (int i = 0; i < num; i++)
		{
			float num3 = (float)i / 44100f;
			float num4 = (float)i / (float)num;
			num2 += (Noise() - num2) * 0.02f;
			float num5 = Mathf.Sin(num4 * (float)Math.PI);
			float num6 = ((float)Math.Sin(Math.PI * 784.0 * (double)num3) + (float)Math.Sin(Math.PI * 1174.0 * (double)num3)) * 0.1f * num4;
			array[i] = num5 * (num2 * 2f + (float)Math.Sin(Math.PI * 110.0 * (double)num3) * 0.3f + num6);
		}
		return array;
	}
}
public class GunHolster : MonoBehaviour
{
	private const float CheckInterval = 0.2f;

	private Player player;

	private Hero attacker;

	private bool gunOut;

	private float nextCheck;

	private readonly List<SpriteRenderer> hidden = new List<SpriteRenderer>();

	public bool Holstered
	{
		get
		{
			if (!gunOut)
			{
				return (Object)(object)attacker != (Object)null;
			}
			return false;
		}
	}

	public static void Holster(Player p)
	{
		GunHolster gunHolster = Of(p);
		gunHolster.gunOut = false;
		gunHolster.nextCheck = 0f;
	}

	public static GunHolster Of(Player p)
	{
		GunHolster gunHolster = ((Component)p).GetComponent<GunHolster>();
		if ((Object)(object)gunHolster == (Object)null)
		{
			gunHolster = ((Component)p).gameObject.AddComponent<GunHolster>();
		}
		gunHolster.player = p;
		return gunHolster;
	}

	public void SetGunOut(bool value)
	{
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		gunOut = value;
		nextCheck = 0f;
		if ((Object)(object)player != (Object)null)
		{
			PopText.Spawn(value ? "GUN OUT" : "COMBO MODE", ((Component)player).transform.position + Vector3.up * 2.2f, new Color(0.9f, 0.9f, 1f), 5f, 0.8f, Vector3.up * 0.5f);
		}
	}

	public void Attack()
	{
		if ((Object)(object)attacker != (Object)null)
		{
			attacker.Basic();
		}
	}

	private void Update()
	{
		if (!((Object)(object)player == (Object)null) && !((Object)(object)attacker == (Object)null) && player.data.view.IsMine && !player.data.dead && TogglePressed())
		{
			HeroNet.SendGunOut(player, !gunOut);
		}
	}

	private bool TogglePressed()
	{
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		PlayerActions playerActions = player.data.playerActions;
		if (playerActions != null && ((PlayerActionSet)playerActions).Device != null)
		{
			if (!((OneAxisInputControl)((PlayerActionSet)playerActions).Device.GetControl((InputControlType)100)).WasPressed)
			{
				return ((OneAxisInputControl)((PlayerActionSet)playerActions).Device.GetControl((InputControlType)102)).WasPressed;
			}
			return true;
		}
		return Input.GetKeyDown((KeyCode)((HeroConfig.GunKey == null) ? 99 : ((int)HeroConfig.GunKey.Value)));
	}

	private void LateUpdate()
	{
		if ((Object)(object)player == (Object)null)
		{
			Object.Destroy((Object)(object)this);
		}
		else if (!(Time.time < nextCheck))
		{
			nextCheck = Time.time + 0.2f;
			attacker = Hero.Main(player);
			if (Holstered)
			{
				Hide();
			}
			else
			{
				Show();
			}
		}
	}

	private void Hide()
	{
		Gun val = (((Object)(object)player.data.weaponHandler != (Object)null) ? player.data.weaponHandler.gun : null);
		if ((Object)(object)val == (Object)null)
		{
			return;
		}
		SpriteRenderer[] componentsInChildren = ((Component)val).GetComponentsInChildren<SpriteRenderer>(true);
		foreach (SpriteRenderer val2 in componentsInChildren)
		{
			if ((Object)(object)val2 != (Object)null && ((Renderer)val2).enabled)
			{
				((Renderer)val2).enabled = false;
				hidden.Add(val2);
			}
		}
	}

	private void Show()
	{
		foreach (SpriteRenderer item in hidden)
		{
			if ((Object)(object)item != (Object)null)
			{
				((Renderer)item).enabled = true;
			}
		}
		hidden.Clear();
	}

	private void OnDestroy()
	{
		Show();
	}
}
[HarmonyPatch(typeof(WeaponHandler), "Attack")]
internal static class HolsteredAttackPatch
{
	private static bool Prefix(CharacterData ___data)
	{
		if ((Object)(object)___data == (Object)null || (Object)(object)___data.player == (Object)null)
		{
			return true;
		}
		GunHolster component = ((Component)___data.player).GetComponent<GunHolster>();
		if ((Object)(object)component == (Object)null || !component.Holstered)
		{
			return true;
		}
		if (___data.view.IsMine && (Object)(object)___data.input != (Object)null && ___data.input.shootIsPressed)
		{
			component.Attack();
		}
		return false;
	}
}
public enum HeroClass
{
	Brawler,
	Swordsman,
	Shinobi,
	Caster
}
public enum HairStyle
{
	S