Decompiled source of JJK Ten Shadows v1.1.1

WolfShikigami.dll

Decompiled a day 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 BepInEx;
using HarmonyLib;
using InControl;
using ModdingUtils.Utils;
using RarityLib.Utils;
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("WolfShikigami")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WolfShikigami")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c323d85f-dee5-4afa-a24e-ef63cf917902")]
[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 MyFirstMod;

public class DummyTarget : MonoBehaviour
{
	public static readonly List<DummyTarget> All = new List<DummyTarget>();

	private const float MaxHealth = 200f;

	private const float Gravity = 55f;

	private const float MaxFallSpeed = 40f;

	private float health = 200f;

	private SpriteRenderer sr;

	private Rigidbody2D rb;

	private float flashUntil;

	public static void Spawn(Vector3 position)
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Expected O, but got Unknown
		//IL_0011: 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_0027: 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_005f: 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)
		GameObject val = new GameObject("TrainingDummy");
		val.transform.position = position;
		val.transform.localScale = Vector3.one * 1.5f;
		Texture2D whiteTexture = Texture2D.whiteTexture;
		Sprite sprite = Sprite.Create(whiteTexture, new Rect(0f, 0f, (float)((Texture)whiteTexture).width, (float)((Texture)whiteTexture).height), new Vector2(0.5f, 0.5f), (float)((Texture)whiteTexture).width);
		SpriteRenderer obj = val.AddComponent<SpriteRenderer>();
		obj.sprite = sprite;
		((Renderer)obj).sortingOrder = 5;
		Rigidbody2D obj2 = val.AddComponent<Rigidbody2D>();
		obj2.gravityScale = 0f;
		obj2.mass = 1000f;
		obj2.freezeRotation = true;
		BoxCollider2D val2 = val.AddComponent<BoxCollider2D>();
		val2.size = Vector2.one;
		foreach (Player player in PlayerManager.instance.players)
		{
			Collider2D[] componentsInChildren = ((Component)player).GetComponentsInChildren<Collider2D>();
			foreach (Collider2D val3 in componentsInChildren)
			{
				Physics2D.IgnoreCollision((Collider2D)(object)val2, val3);
			}
		}
		val.AddComponent<DummyTarget>();
	}

	private void Awake()
	{
		sr = ((Component)this).GetComponent<SpriteRenderer>();
		rb = ((Component)this).GetComponent<Rigidbody2D>();
	}

	private void OnEnable()
	{
		All.Add(this);
	}

	private void OnDisable()
	{
		All.Remove(this);
	}

	public void TakeHit(float damage)
	{
		health -= damage;
		flashUntil = Time.time + 0.15f;
		Debug.Log("[Dummy] took " + damage + " damage, health now " + Mathf.Max(health, 0f));
		if (health <= 0f)
		{
			Debug.Log("[Dummy] reached 0 HP, resetting");
			health = 200f;
		}
	}

	public void Burn(float perTick, int ticks, float interval)
	{
		((MonoBehaviour)this).StartCoroutine(BurnRoutine(perTick, ticks, interval));
	}

	private IEnumerator BurnRoutine(float perTick, int ticks, float interval)
	{
		for (int i = 0; i < ticks; i++)
		{
			yield return (object)new WaitForSeconds(interval);
			TakeHit(perTick);
		}
	}

	private void FixedUpdate()
	{
		//IL_0015: 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)
		if (!((Object)(object)rb == (Object)null))
		{
			float num = Mathf.Max(rb.velocity.y - 55f * Time.fixedDeltaTime, -40f);
			rb.velocity = new Vector2(0f, num);
		}
	}

	private void Update()
	{
		//IL_0006: 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_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: 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_006e: Unknown result type (might be due to invalid IL or missing references)
		if (((Component)this).transform.position.y < -100f)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
			return;
		}
		float num = 1f - Mathf.Clamp01(health / 200f);
		Color val = Color.Lerp(Color.white, new Color(0.8f, 0.1f, 0.1f), num);
		sr.color = ((Time.time < flashUntil) ? Color.yellow : val);
	}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.kpcnre.rounds.jjktenshadows", "JJK Ten Shadows", "1.1.1")]
public class Plugin : BaseUnityPlugin
{
	private const string ModId = "com.kpcnre.rounds.jjktenshadows";

	public const string ModName = "JJK Ten Shadows";

	public const string Version = "1.1.1";

	public const string EpicRarity = "Epic";

	private void Awake()
	{
		//IL_0005: 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_0064: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			new Harmony("com.kpcnre.rounds.jjktenshadows").PatchAll();
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("Mahoraga adaptation hooks failed, adaptation won't work: " + ex));
		}
		try
		{
			RarityUtils.AddRarity("Epic", 0.05f, new Color(0.75f, 0.25f, 1f), new Color(0.45f, 0.12f, 0.65f));
		}
		catch (Exception ex2)
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Epic rarity not added (" + ex2.Message + "); using the existing one if there is one"));
		}
	}

	private void Start()
	{
		CustomCard.BuildCard<UnlockTenShadowsCard>();
		CustomCard.BuildCard<NueCard>();
		CustomCard.BuildCard<ToadCard>();
		CustomCard.BuildCard<SerpentCard>();
		CustomCard.BuildCard<ElephantCard>();
		CustomCard.BuildCard<RabbitCard>();
		CustomCard.BuildCard<OxCard>();
		CustomCard.BuildCard<DeerCard>();
		CustomCard.BuildCard<TigerCard>();
		CustomCard.BuildCard<MahoragaCard>();
		CustomCard.BuildCard<SwordCard>();
		CustomCard.BuildCard<DomainCard>();
		CustomCard.BuildCard<ShadowSwimCard>();
		CustomCard.BuildCard<ShadowClonesCard>();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Ten Shadows cards registered");
		try
		{
			AddCardGating();
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)("Card gating unavailable (ModdingUtils too old?), shadow cards can appear without Unlock Ten Shadows: " + ex.GetType().Name));
		}
		GameModeManager.AddHook("PointEnd", (Func<IGameModeHandler, IEnumerator>)RemoveAllWolves);
		GameModeManager.AddHook("GameEnd", (Func<IGameModeHandler, IEnumerator>)RemoveAllWolves);
		GameModeManager.AddHook("GameStart", (Func<IGameModeHandler, IEnumerator>)ResetDivineDogs);
		GameModeManager.AddHook("RoundEnd", (Func<IGameModeHandler, IEnumerator>)ResetAdaptations);
		GameModeManager.AddHook("GameStart", (Func<IGameModeHandler, IEnumerator>)ResetAdaptations);
	}

	private IEnumerator ResetAdaptations(IGameModeHandler gm)
	{
		Adaptation.ResetAll();
		yield break;
	}

	[MethodImpl(MethodImplOptions.NoInlining)]
	private static void AddCardGating()
	{
		Cards.instance.AddCardValidationFunction((Func<Player, CardInfo, bool>)((Player player, CardInfo card) => !Shadows.IsShadowCard(card) || Shadows.HasCard(player, "Unlock Ten Shadows")));
	}

	private IEnumerator ResetDivineDogs(IGameModeHandler gm)
	{
		DivineDogs.Reset();
		yield break;
	}

	private IEnumerator RemoveAllWolves(IGameModeHandler gm)
	{
		ShadowMinion[] array = Object.FindObjectsOfType<ShadowMinion>();
		ShadowMinion[] array2 = array;
		for (int i = 0; i < array2.Length; i++)
		{
			Object.Destroy((Object)(object)((Component)array2[i]).gameObject);
		}
		if (array.Length != 0)
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Point ended, removed " + array.Length + " wolf/wolves"));
		}
		yield break;
	}
}
public static class ShadowLayers
{
	private static int hitboxLayer = -1;

	private static int movementMaskCache;

	public static int HitboxLayer
	{
		get
		{
			if (hitboxLayer < 0)
			{
				hitboxLayer = Pick();
			}
			return hitboxLayer;
		}
	}

	public static int MapMask
	{
		get
		{
			int num = 1 << HitboxLayer;
			return (movementMaskCache | LayerMask.GetMask(new string[1] { "Default" })) & ~num;
		}
	}

	private static int Pick()
	{
		int num = 0;
		int num2 = 0;
		RayCastTrail[] array = Resources.FindObjectsOfTypeAll<RayCastTrail>();
		foreach (RayCastTrail obj in array)
		{
			num |= MaskOf(obj, "mask");
			num2 |= MaskOf(obj, "playerMask");
		}
		int num3 = 0;
		if ((Object)(object)PlayerManager.instance != (Object)null)
		{
			foreach (Player player in PlayerManager.instance.players)
			{
				num3 |= MaskOf(player.data, "groundMask");
				LegRaycasters[] componentsInChildren = ((Component)player).GetComponentsInChildren<LegRaycasters>(true);
				foreach (LegRaycasters obj2 in componentsInChildren)
				{
					num3 |= MaskOf(obj2, "mask");
				}
				WallRayCaster[] componentsInChildren2 = ((Component)player).GetComponentsInChildren<WallRayCaster>(true);
				foreach (WallRayCaster obj3 in componentsInChildren2)
				{
					num3 |= MaskOf(obj3, "mask");
				}
				IkLeg[] componentsInChildren3 = ((Component)player).GetComponentsInChildren<IkLeg>(true);
				foreach (IkLeg obj4 in componentsInChildren3)
				{
					num3 |= MaskOf(obj4, "mask");
				}
				PlayerCollision[] componentsInChildren4 = ((Component)player).GetComponentsInChildren<PlayerCollision>(true);
				foreach (PlayerCollision obj5 in componentsInChildren4)
				{
					num3 |= MaskOf(obj5, "mask");
				}
			}
		}
		movementMaskCache = num3;
		Debug.Log("[TenShadows] layers: bullets=" + Describe(num) + " bulletPlayers=" + Describe(num2) + " playerMovement=" + Describe(num3));
		int num4 = FirstLayer(num & ~num3);
		if (num4 < 0)
		{
			num4 = FirstLayer(num2 & ~num3);
		}
		if (num4 < 0)
		{
			Debug.LogWarning("[TenShadows] no bullet-only layer found, shadows stay on Default");
			num4 = 0;
		}
		Debug.Log("[TenShadows] shadow hitboxes use layer " + num4 + " (" + LayerMask.LayerToName(num4) + ")");
		return num4;
	}

	private static int MaskOf(object obj, string field)
	{
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		if (obj == null)
		{
			return 0;
		}
		FieldInfo fieldInfo = AccessTools.Field(obj.GetType(), field);
		if (fieldInfo == null || fieldInfo.FieldType != typeof(LayerMask))
		{
			return 0;
		}
		LayerMask val = (LayerMask)fieldInfo.GetValue(obj);
		return ((LayerMask)(ref val)).value;
	}

	private static int FirstLayer(int mask)
	{
		for (int i = 0; i < 32; i++)
		{
			if ((mask & (1 << i)) != 0 && !string.IsNullOrEmpty(LayerMask.LayerToName(i)))
			{
				return i;
			}
		}
		return -1;
	}

	private static string Describe(int mask)
	{
		string text = "";
		for (int i = 0; i < 32; i++)
		{
			if ((mask & (1 << i)) != 0)
			{
				text = text + ((text.Length > 0) ? "," : "") + i + ":" + LayerMask.LayerToName(i);
			}
		}
		return "[" + text + "]";
	}
}
public class ShadowWheel : MonoBehaviour
{
	private const float Scale = 2.5f;

	private const float WheelSize = 16f;

	private const float SlotRadius = 3.875f;

	private const float IconSize = 2.125f;

	private const float GlowSize = 3.75f;

	private const float LabelSize = 1.2f;

	private const float FaceRadius = 5.375f;

	private const float HubFraction = 23f / 86f;

	private const float HoverIconScale = 1.3f;

	private const float OpenDuration = 0.15f;

	public const float ScreenFraction = 0.72f;

	public const float HubScreenFraction = 0.064687505f;

	private const int SlotCount = 10;

	private const float SlotStep = 36f;

	private Player player;

	private List<ShadowDef> shadows;

	private ShadowCaster caster;

	private RectTransform anchor;

	private RectTransform spin;

	private RectTransform glow;

	private RectTransform wedge;

	private readonly List<Image> icons = new List<Image>();

	private TextMeshProUGUI label;

	private TextMeshProUGUI header;

	private string headerText;

	private string emptyText;

	private float openedAt;

	private static Sprite wheelSprite;

	private static Sprite glowSprite;

	private static Sprite wedgeSprite;

	public ShadowDef Hovered { get; private set; }

	public static ShadowWheel Open(Player player, List<ShadowDef> owned, ShadowDef current, ShadowCaster caster, string header, string empty)
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		ShadowWheel shadowWheel = new GameObject("TenShadowsWheel").AddComponent<ShadowWheel>();
		shadowWheel.player = player;
		shadowWheel.shadows = new List<ShadowDef>(owned);
		shadowWheel.caster = caster;
		shadowWheel.Hovered = current;
		shadowWheel.headerText = header;
		shadowWheel.emptyText = empty;
		shadowWheel.Build();
		return shadowWheel;
	}

	public void Hover(Vector2 dir)
	{
		//IL_0000: 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)
		float num = Mathf.Atan2(dir.y, dir.x) * 57.29578f;
		float num2 = float.MaxValue;
		int num3 = Mathf.Min(shadows.Count, 10);
		for (int i = 0; i < num3; i++)
		{
			float num4 = Mathf.Abs(Mathf.DeltaAngle(num, SlotAngle(i)));
			if (num4 < num2)
			{
				num2 = num4;
				Hovered = shadows[i];
			}
		}
	}

	private void Build()
	{
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_015e: Unknown result type (might be due to invalid IL or missing references)
		//IL_019c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_020d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0241: Unknown result type (might be due to invalid IL or missing references)
		//IL_0257: Unknown result type (might be due to invalid IL or missing references)
		openedAt = Time.time;
		Canvas obj = ((Component)this).gameObject.AddComponent<Canvas>();
		obj.renderMode = (RenderMode)0;
		obj.sortingOrder = 500;
		anchor = NewRect("Anchor", ((Component)this).transform);
		spin = NewRect("Spin", (Transform)(object)anchor);
		NewImage("Wheel", (Transform)(object)spin, GetWheelSprite(), 16f);
		Image val = NewImage("Wedge", (Transform)(object)spin, GetWedgeSprite(), 10.75f);
		((Graphic)val).color = new Color(0.62f, 0.35f, 1f, 0.55f);
		wedge = ((Graphic)val).rectTransform;
		Image val2 = NewImage("Glow", (Transform)(object)spin, GetGlowSprite(), 3.75f);
		((Graphic)val2).color = new Color(0.85f, 0.7f, 1f, 1f);
		glow = ((Graphic)val2).rectTransform;
		int num = Mathf.Min(shadows.Count, 10);
		for (int i = 0; i < num; i++)
		{
			Image val3 = NewImage("Icon_" + i, (Transform)(object)spin, caster.IconOf(shadows[i]), 2.125f);
			val3.preserveAspect = true;
			((Graphic)val3).rectTransform.anchoredPosition = SlotPosition(i);
			icons.Add(val3);
		}
		RectTransform val4 = NewRect("Label", (Transform)(object)anchor);
		val4.sizeDelta = new Vector2(24f, 2.4f);
		val4.anchoredPosition = new Vector2(0f, -9.2f);
		label = ((Component)val4).gameObject.AddComponent<TextMeshProUGUI>();
		((TMP_Text)label).alignment = (TextAlignmentOptions)514;
		((TMP_Text)label).enableWordWrapping = false;
		((TMP_Text)label).fontSize = 1.2f;
		((Graphic)label).color = new Color(1f, 0.9f, 0.6f);
		((Graphic)label).raycastTarget = false;
		RectTransform val5 = NewRect("Header", (Transform)(object)anchor);
		val5.sizeDelta = new Vector2(24f, 3.6000001f);
		val5.anchoredPosition = new Vector2(0f, 9.32f);
		header = ((Component)val5).gameObject.AddComponent<TextMeshProUGUI>();
		((TMP_Text)header).alignment = (TextAlignmentOptions)514;
		((TMP_Text)header).enableWordWrapping = false;
		((TMP_Text)header).fontSize = 0.96000004f;
		((TMP_Text)header).richText = true;
		((Graphic)header).raycastTarget = false;
		((TMP_Text)header).text = headerText ?? "";
		Place();
		Refresh();
	}

	private void LateUpdate()
	{
		//IL_0054: 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_0093: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)player == (Object)null)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
			return;
		}
		Place();
		float num = Mathf.Clamp01((Time.time - openedAt) / 0.15f);
		float num2 = 1f - (1f - num) * (1f - num);
		((Transform)spin).localScale = Vector3.one * Mathf.Lerp(0.6f, 1f, num2);
		((Transform)spin).localRotation = Quaternion.Euler(0f, 0f, Mathf.Lerp(-45f, 0f, num2));
		Refresh();
	}

	private void Place()
	{
		//IL_0036: 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_004c: Unknown result type (might be due to invalid IL or missing references)
		float num = (float)Screen.height * 0.72f / 16f;
		((Transform)anchor).position = new Vector3((float)Screen.width / 2f, (float)Screen.height / 2f, 0f);
		((Transform)anchor).localScale = Vector3.one * num;
	}

	private void Refresh()
	{
		//IL_0085: 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_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Unknown result type (might be due to invalid IL or missing references)
		//IL_0131: 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_0160: Unknown result type (might be due to invalid IL or missing references)
		int num = Mathf.Min(shadows.Count, 10);
		int num2 = ((Hovered != null) ? shadows.IndexOf(Hovered) : (-1));
		bool flag = num2 >= 0 && num2 < num;
		float num3 = 1f + 0.08f * Mathf.Sin(Time.time * 8f);
		((Component)glow).gameObject.SetActive(flag);
		((Component)wedge).gameObject.SetActive(flag);
		if (flag)
		{
			glow.anchoredPosition = SlotPosition(num2);
			((Transform)glow).localScale = Vector3.one * num3;
			((Transform)wedge).localRotation = Quaternion.Euler(0f, 0f, SlotAngle(num2) - 90f);
		}
		for (int i = 0; i < num; i++)
		{
			bool flag2 = i == num2;
			((Transform)((Graphic)icons[i]).rectTransform).localScale = Vector3.one * (flag2 ? (1.3f * num3) : 1f);
			Color color = (Color)(CanSummon(shadows[i]) ? Color.white : new Color(0.45f, 0.45f, 0.5f));
			if (!flag2 && num > 1)
			{
				color.a = 0.45f;
			}
			((Graphic)icons[i]).color = color;
		}
		if (Hovered == null)
		{
			((TMP_Text)label).text = ((shadows.Count == 0) ? emptyText : "");
			return;
		}
		string text = caster.NameOf(Hovered);
		if (caster.MaxActive(Hovered) > 1)
		{
			text = text + "  " + caster.ActiveCount(Hovered) + "/" + caster.MaxActive(Hovered);
		}
		float num4 = caster.CooldownLeft(Hovered);
		if (num4 > 0f)
		{
			text = text + "  <color=#9a9aa8>(" + Mathf.CeilToInt(num4) + "s)</color>";
		}
		float num5 = caster.CostOf(Hovered);
		if (num5 > 0f)
		{
			text += (caster.CanAfford(Hovered) ? ("  <color=#9fb4ff>" + Mathf.CeilToInt(num5) + " CE</color>") : ("  <color=#ff7a7a>" + Mathf.CeilToInt(num5) + " CE - not enough</color>"));
		}
		((TMP_Text)label).text = text;
	}

	private bool CanSummon(ShadowDef shadow)
	{
		if (caster.CooldownLeft(shadow) <= 0f && caster.ActiveCount(shadow) < caster.MaxActive(shadow))
		{
			return caster.CanAfford(shadow);
		}
		return false;
	}

	private static RectTransform NewRect(string name, Transform parent)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: 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_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		RectTransform component = new GameObject(name, new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>();
		((Transform)component).SetParent(parent, false);
		Vector2 val = default(Vector2);
		((Vector2)(ref val))..ctor(0.5f, 0.5f);
		component.anchorMax = val;
		component.anchorMin = val;
		component.pivot = new Vector2(0.5f, 0.5f);
		component.anchoredPosition = Vector2.zero;
		component.sizeDelta = Vector2.zero;
		return component;
	}

	private static Image NewImage(string name, Transform parent, Sprite sprite, float size)
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		RectTransform obj = NewRect(name, parent);
		obj.sizeDelta = new Vector2(size, size);
		Image obj2 = ((Component)obj).gameObject.AddComponent<Image>();
		obj2.sprite = sprite;
		((Graphic)obj2).raycastTarget = false;
		return obj2;
	}

	private static float SlotAngle(int i)
	{
		return 90f - 36f * (float)i;
	}

	private static Vector2 SlotPosition(int i)
	{
		//IL_0019: 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)
		float num = SlotAngle(i) * ((float)Math.PI / 180f);
		return new Vector2(Mathf.Cos(num), Mathf.Sin(num)) * 3.875f;
	}

	private static Sprite GetWheelSprite()
	{
		//IL_0069: 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_0040: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)wheelSprite != (Object)null)
		{
			return wheelSprite;
		}
		Texture2D val = WolfSprite.LoadTexture("wheel.png");
		if ((Object)(object)val == (Object)null)
		{
			val = MakeDisc(128, new Color(0.08f, 0.05f, 0.13f, 0.7f), 1f);
		}
		wheelSprite = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
		return wheelSprite;
	}

	private static Sprite GetGlowSprite()
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)glowSprite != (Object)null)
		{
			return glowSprite;
		}
		Texture2D val = MakeDisc(64, Color.white, 2f);
		glowSprite = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
		return glowSprite;
	}

	private static Sprite GetWedgeSprite()
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Expected O, but got Unknown
		//IL_0140: Unknown result type (might be due to invalid IL or missing references)
		//IL_014f: 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_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: 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)
		if ((Object)(object)wedgeSprite != (Object)null)
		{
			return wedgeSprite;
		}
		Texture2D val = new Texture2D(256, 256, (TextureFormat)4, false);
		float num = 128f;
		for (int i = 0; i < 256; i++)
		{
			for (int j = 0; j < 256; j++)
			{
				Vector2 val2 = new Vector2((float)j + 0.5f - num, (float)i + 0.5f - num) / num;
				float magnitude = ((Vector2)(ref val2)).magnitude;
				float num2 = Mathf.Abs(Mathf.DeltaAngle(Mathf.Atan2(val2.y, val2.x) * 57.29578f, 90f));
				float num3 = 0f;
				if (magnitude > 23f / 86f && magnitude < 1f && num2 < 18f)
				{
					float num4 = Mathf.Clamp01((18f - num2) / 4f);
					float num5 = Mathf.Clamp01(Mathf.Min(magnitude - 23f / 86f, 1f - magnitude) * 12f);
					num3 = num4 * num5;
				}
				val.SetPixel(j, i, new Color(1f, 1f, 1f, num3));
			}
		}
		val.Apply();
		wedgeSprite = Sprite.Create(val, new Rect(0f, 0f, 256f, 256f), new Vector2(0.5f, 0.5f));
		return wedgeSprite;
	}

	private static Texture2D MakeDisc(int size, Color color, float falloff)
	{
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Expected O, but got Unknown
		//IL_002e: 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_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		Texture2D val = new Texture2D(size, size, (TextureFormat)4, false);
		float num = (float)size / 2f;
		for (int i = 0; i < size; i++)
		{
			for (int j = 0; j < size; j++)
			{
				float num2 = Vector2.Distance(new Vector2((float)j + 0.5f, (float)i + 0.5f), new Vector2(num, num)) / num;
				float num3 = Mathf.Clamp01(1f - Mathf.Pow(num2, falloff * 2f));
				if (num2 > 1f)
				{
					num3 = 0f;
				}
				val.SetPixel(j, i, new Color(color.r, color.g, color.b, color.a * num3));
			}
		}
		val.Apply();
		return val;
	}
}
public class ShadowDef
{
	public Func<Player, string> Name;

	public string CardTitle;

	public float Cooldown;

	public Func<Player, int> MaxActive;

	public Func<Player, Sprite> Icon;

	public Action<Player, int, Vector2> Summon;

	public Func<Player, int> ActiveCount;

	public Action<Player> Toggle;

	public float Cost;
}
public static class Shadows
{
	public static readonly List<ShadowDef> All = new List<ShadowDef>
	{
		new ShadowDef
		{
			Name = (Player p) => (!DivineDogs.TotalityDestroyed(p)) ? ((!DivineDogs.HasTotality(p)) ? "Divine Dogs" : "Divine Dog: Totality") : "Divine Dog: Totality (destroyed)",
			CardTitle = "Unlock Ten Shadows",
			Cooldown = 8f,
			Cost = 20f,
			MaxActive = (Player p) => (!DivineDogs.TotalityDestroyed(p)) ? (DivineDogs.HasTotality(p) ? 1 : 2) : 0,
			Icon = (Player p) => WolfSprite.Get(DivineDogs.HasTotality(p) ? 2 : 0),
			Summon = WolfNet.SummonDog,
			ActiveCount = WolfNet.ActiveCount
		},
		new ShadowDef
		{
			Name = (Player p) => "Nue",
			CardTitle = "Nue",
			Cooldown = 12f,
			Cost = 30f,
			MaxActive = (Player p) => 1,
			Icon = (Player p) => NueSprites.Get(0),
			Summon = WolfNet.SummonNue,
			ActiveCount = WolfNet.NueCount
		},
		new ShadowDef
		{
			Name = (Player p) => "Toad",
			CardTitle = "Toad",
			Cooldown = 10f,
			Cost = 25f,
			MaxActive = (Player p) => 1,
			Icon = (Player p) => ToadSprites.Get(0),
			Summon = WolfNet.SummonToad,
			ActiveCount = WolfNet.ToadCount
		},
		new ShadowDef
		{
			Name = (Player p) => "Great Serpent",
			CardTitle = "Great Serpent",
			Cooldown = 14f,
			Cost = 35f,
			MaxActive = (Player p) => 1,
			Icon = (Player p) => SerpentSprites.Body(),
			Summon = WolfNet.SummonSerpent,
			ActiveCount = WolfNet.SerpentCount
		},
		new ShadowDef
		{
			Name = (Player p) => "Max Elephant",
			CardTitle = "Max Elephant",
			Cooldown = 18f,
			Cost = 45f,
			MaxActive = (Player p) => 1,
			Icon = (Player p) => ElephantSprites.Get(0),
			Summon = WolfNet.SummonElephant,
			ActiveCount = WolfNet.ElephantCount
		},
		new ShadowDef
		{
			Name = (Player p) => "Rabbit Escape",
			CardTitle = "Rabbit Escape",
			Cooldown = 14f,
			Cost = 25f,
			MaxActive = (Player p) => 1,
			Icon = (Player p) => RabbitSprites.Get(),
			Summon = WolfNet.SummonRabbits,
			ActiveCount = WolfNet.RabbitCount
		},
		new ShadowDef
		{
			Name = (Player p) => "Piercing Ox",
			CardTitle = "Piercing Ox",
			Cooldown = 12f,
			Cost = 35f,
			MaxActive = (Player p) => 1,
			Icon = (Player p) => OxSprites.Get(1),
			Summon = WolfNet.SummonOx,
			ActiveCount = WolfNet.OxCount
		},
		new ShadowDef
		{
			Name = (Player p) => "Round Deer",
			CardTitle = "Round Deer",
			Cooldown = 22f,
			Cost = 40f,
			MaxActive = (Player p) => 1,
			Icon = (Player p) => DeerSprites.Get(),
			Summon = WolfNet.SummonDeer,
			ActiveCount = WolfNet.DeerCount
		},
		new ShadowDef
		{
			Name = (Player p) => "Tiger Funeral",
			CardTitle = "Tiger Funeral",
			Cooldown = 20f,
			Cost = 55f,
			MaxActive = (Player p) => 1,
			Icon = (Player p) => WolfSprite.Get(3),
			Summon = WolfNet.SummonTiger,
			ActiveCount = WolfNet.TigerCount
		},
		new ShadowDef
		{
			Name = (Player p) => "Mahoraga's wheel: " + (MahoragaWheel.IsOn(p) ? "ON" : "OFF") + " (pick to toggle)",
			CardTitle = "Divine General Mahoraga",
			Cooldown = 0f,
			MaxActive = (Player p) => 1,
			Icon = (Player p) => MahoragaWheel.Icon(),
			ActiveCount = (Player p) => 0,
			Toggle = MahoragaWheel.RequestToggle
		}
	};

	public static readonly List<ShadowDef> Abilities = new List<ShadowDef>
	{
		new ShadowDef
		{
			Name = (Player p) => "Chimera Shadow Garden",
			CardTitle = "Chimera Shadow Garden",
			Cooldown = 40f,
			Cost = 60f,
			MaxActive = (Player p) => 1,
			Icon = (Player p) => ChimeraDomain.Icon(),
			Summon = ChimeraDomain.Cast,
			ActiveCount = ChimeraDomain.ActiveCount
		},
		new ShadowDef
		{
			Name = (Player p) => "Shadow Swim",
			CardTitle = "Shadow Swim",
			Cooldown = 6f,
			Cost = 20f,
			MaxActive = (Player p) => 1,
			Icon = (Player p) => CardIcon("swim_cardart.png"),
			Summon = ShadowSwim.Cast,
			ActiveCount = (Player p) => ShadowSwim.IsSwimming(p) ? 1 : 0
		},
		new ShadowDef
		{
			Name = (Player p) => "Shadow Clones" + (WeaponWielder.IsEquipped(p) ? " (with your sword)" : " (with your gun)"),
			CardTitle = "Shadow Clones",
			Cooldown = 10f,
			Cost = 30f,
			MaxActive = (Player p) => 1,
			Icon = (Player p) => CardIcon("clones_cardart.png"),
			Summon = ShadowClone.Cast,
			ActiveCount = ShadowClone.ActiveCount
		}
	};

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

	public static readonly List<ShadowDef> Weapons = new List<ShadowDef>
	{
		new ShadowDef
		{
			Name = (Player p) => "Black-Bladed Sword" + ((WeaponWielder.Equipped(p) == "Black-Bladed Sword") ? " (equipped - pick to put away)" : " (pick to equip)"),
			CardTitle = "Black-Bladed Sword",
			Cooldown = 0f,
			MaxActive = (Player p) => 1,
			Icon = (Player p) => WeaponWielder.SwordSprite(),
			ActiveCount = (Player p) => 0,
			Toggle = delegate(Player p)
			{
				WeaponWielder.RequestToggle(p, "Black-Bladed Sword");
			}
		}
	};

	public static Sprite CardIcon(string file)
	{
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		if (cardIcons.TryGetValue(file, out var value) && (Object)(object)value != (Object)null)
		{
			return value;
		}
		Texture2D val = WolfSprite.LoadTexture(file);
		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), (float)((Texture)val).width) : ElephantSprites.Disc());
		cardIcons[file] = value;
		return value;
	}

	public static bool IsShadowCard(CardInfo card)
	{
		if ((Object)(object)card == (Object)null || card.cardName == "Unlock Ten Shadows")
		{
			return false;
		}
		if (card.cardName == "Divine General Mahoraga")
		{
			return true;
		}
		foreach (ShadowDef weapon in Weapons)
		{
			if (card.cardName == weapon.CardTitle)
			{
				return true;
			}
		}
		foreach (ShadowDef ability in Abilities)
		{
			if (card.cardName == ability.CardTitle)
			{
				return true;
			}
		}
		foreach (ShadowDef item in All)
		{
			if (card.cardName == item.CardTitle)
			{
				return true;
			}
		}
		return false;
	}

	public static bool HasCard(Player player, string cardTitle)
	{
		List<CardInfo> currentCards = player.data.currentCards;
		if (currentCards == null)
		{
			return false;
		}
		foreach (CardInfo item in currentCards)
		{
			if ((Object)(object)item != (Object)null && item.cardName == cardTitle)
			{
				return true;
			}
		}
		return false;
	}
}
public class ShadowCaster : MonoBehaviour
{
	public bool keepWithoutCard;

	private const float GracePeriod = 2f;

	private const float CheckInterval = 0.5f;

	private const float StickDeadZone = 0.5f;

	private Player player;

	private float graceUntil;

	private float nextCheck;

	private int summonCounter;

	private readonly List<ShadowDef> owned = new List<ShadowDef>();

	private readonly List<ShadowDef> ownedWeapons = new List<ShadowDef>();

	private readonly List<ShadowDef> ownedAbilities = new List<ShadowDef>();

	private int page;

	private const int PageCount = 3;

	private CursedEnergy energy;

	private readonly Dictionary<ShadowDef, float> readyAt = new Dictionary<ShadowDef, float>();

	private readonly List<GameObject> summons = new List<GameObject>();

	private ShadowDef selected;

	private ShadowWheel wheel;

	private void Awake()
	{
		player = ((Component)this).GetComponent<Player>();
		graceUntil = Time.time + 2f;
		energy = ((Component)this).GetComponent<CursedEnergy>();
		if ((Object)(object)energy == (Object)null)
		{
			energy = ((Component)this).gameObject.AddComponent<CursedEnergy>();
		}
	}

	private void Start()
	{
		if ((Object)(object)player != (Object)null && (Object)(object)player.data.block != (Object)null)
		{
			Block block = player.data.block;
			block.BlockAction = (Action<BlockTriggerType>)Delegate.Combine(block.BlockAction, new Action<BlockTriggerType>(OnBlock));
		}
	}

	private void OnBlock(BlockTriggerType trigger)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		if ((int)trigger == 0 && !((Object)(object)player == (Object)null) && !player.data.dead && player.data.view.IsMine)
		{
			TrySummon();
		}
	}

	private void Update()
	{
		//IL_0193: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)player == (Object)null)
		{
			return;
		}
		if (Time.time >= nextCheck)
		{
			nextCheck = Time.time + 0.5f;
			RefreshOwned();
			if (!keepWithoutCard && Time.time >= graceUntil && owned.Count == 0 && ownedWeapons.Count == 0 && ownedAbilities.Count == 0 && !Shadows.HasCard(player, "Unlock Ten Shadows"))
			{
				Debug.Log("[TenShadows] no Ten Shadows cards left, removing ability");
				Object.Destroy((Object)(object)this);
				return;
			}
		}
		if (player.data.dead || !player.data.view.IsMine)
		{
			CloseWheel(confirm: false);
			return;
		}
		if (ChimeraDomain.Inside(player))
		{
			foreach (ShadowDef item in new List<ShadowDef>(readyAt.Keys))
			{
				readyAt[item] -= Time.deltaTime;
			}
		}
		if (WheelHeld())
		{
			if ((Object)(object)wheel != (Object)null && PagePressed())
			{
				page = (page + 1) % 3;
				Object.Destroy((Object)(object)((Component)wheel).gameObject);
				wheel = null;
			}
			if ((Object)(object)wheel == (Object)null)
			{
				wheel = OpenWheel();
			}
			if (AimDirection(out var dir))
			{
				wheel.Hover(dir);
			}
		}
		else
		{
			CloseWheel(confirm: true);
		}
	}

	public void Track(GameObject summon)
	{
		summons.RemoveAll((GameObject s) => (Object)(object)s == (Object)null);
		summons.Add(summon);
	}

	public int ActiveCount(ShadowDef shadow)
	{
		if (shadow.ActiveCount == null)
		{
			return 0;
		}
		return shadow.ActiveCount(player);
	}

	public int MaxActive(ShadowDef shadow)
	{
		if (shadow.MaxActive == null)
		{
			return 1;
		}
		return shadow.MaxActive(player);
	}

	public string NameOf(ShadowDef shadow)
	{
		return shadow.Name(player);
	}

	public Sprite IconOf(ShadowDef shadow)
	{
		return shadow.Icon(player);
	}

	public float CostOf(ShadowDef shadow)
	{
		float num = shadow.Cost;
		if (ChimeraDomain.Inside(player))
		{
			num *= 0.5f;
		}
		return num;
	}

	public bool CanAfford(ShadowDef shadow)
	{
		if (!((Object)(object)energy == (Object)null))
		{
			return energy.Current + 0.01f >= CostOf(shadow);
		}
		return true;
	}

	private ShadowWheel OpenWheel()
	{
		string[] array = new string[3] { "SHIKIGAMI", "WEAPONS", "ABILITIES" };
		string text = "";
		for (int i = 0; i < 3; i++)
		{
			text = text + ((i > 0) ? "   " : "") + ((i == page) ? ("<color=#ffe08a>" + array[i] + "</color>") : ("<color=#8a86a0>" + array[i].ToLower() + "</color>"));
		}
		text += "\n<size=60%><color=#8a86a0>K / scroll: next page</color></size>";
		if (page == 1)
		{
			return ShadowWheel.Open(player, ownedWeapons, null, this, text, "No weapons yet - pick weapon cards");
		}
		if (page == 2)
		{
			return ShadowWheel.Open(player, ownedAbilities, ownedAbilities.Contains(selected) ? selected : null, this, text, "No abilities yet - pick ability cards");
		}
		return ShadowWheel.Open(player, owned, owned.Contains(selected) ? selected : null, this, text, "No shadows yet - pick shadow cards");
	}

	public float CooldownLeft(ShadowDef shadow)
	{
		if (!readyAt.TryGetValue(shadow, out var value))
		{
			return 0f;
		}
		return Mathf.Max(0f, value - Time.time);
	}

	private void OnDestroy()
	{
		if ((Object)(object)player != (Object)null && (Object)(object)player.data != (Object)null && (Object)(object)player.data.block != (Object)null)
		{
			Block block = player.data.block;
			block.BlockAction = (Action<BlockTriggerType>)Delegate.Remove(block.BlockAction, new Action<BlockTriggerType>(OnBlock));
		}
		CloseWheel(confirm: false);
		foreach (GameObject summon in summons)
		{
			if ((Object)(object)summon != (Object)null)
			{
				Object.Destroy((Object)(object)summon);
			}
		}
		summons.Clear();
	}

	private void RefreshOwned()
	{
		owned.Clear();
		List<CardInfo> currentCards = player.data.currentCards;
		if (currentCards != null)
		{
			foreach (CardInfo item in currentCards)
			{
				if ((Object)(object)item == (Object)null)
				{
					continue;
				}
				foreach (ShadowDef item2 in Shadows.All)
				{
					if (item.cardName == item2.CardTitle && !owned.Contains(item2))
					{
						owned.Add(item2);
					}
				}
			}
		}
		if (keepWithoutCard)
		{
			foreach (ShadowDef item3 in Shadows.All)
			{
				if (!owned.Contains(item3))
				{
					owned.Add(item3);
				}
			}
		}
		ownedWeapons.Clear();
		foreach (ShadowDef weapon in Shadows.Weapons)
		{
			if (keepWithoutCard || Shadows.HasCard(player, weapon.CardTitle))
			{
				ownedWeapons.Add(weapon);
			}
		}
		ownedAbilities.Clear();
		foreach (ShadowDef ability in Shadows.Abilities)
		{
			if (keepWithoutCard || Shadows.HasCard(player, ability.CardTitle))
			{
				ownedAbilities.Add(ability);
			}
		}
		if (selected == null || (!owned.Contains(selected) && !ownedAbilities.Contains(selected)) || selected.Toggle != null)
		{
			selected = owned.Find((ShadowDef s) => s.Toggle == null) ?? ownedAbilities.Find((ShadowDef s) => s.Toggle == null);
		}
	}

	private void TrySummon()
	{
		//IL_0185: Unknown result type (might be due to invalid IL or missing references)
		//IL_0199: Unknown result type (might be due to invalid IL or missing references)
		//IL_019e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		if (selected != null && selected.Toggle == null && selected.Summon != null)
		{
			if (ActiveCount(selected) >= MaxActive(selected))
			{
				Debug.Log("[TenShadows] already have " + MaxActive(selected) + " " + NameOf(selected) + " out");
			}
			else if (CooldownLeft(selected) > 0f)
			{
				Debug.Log("[TenShadows] " + NameOf(selected) + " on cooldown (" + CooldownLeft(selected).ToString("F1") + "s)");
			}
			else if ((Object)(object)energy != (Object)null && !energy.TrySpend(CostOf(selected)))
			{
				Debug.Log("[TenShadows] not enough cursed energy for " + NameOf(selected));
			}
			else
			{
				readyAt[selected] = Time.time + selected.Cooldown;
				summonCounter++;
				int arg = player.playerID * 100000 + summonCounter;
				Vector2 arg2 = Vector2.op_Implicit(((Component)this).transform.position + new Vector3(-2.5f, 1.1f, 0f));
				selected.Summon(player, arg, arg2);
			}
		}
	}

	private void CloseWheel(bool confirm)
	{
		if (!((Object)(object)wheel == (Object)null))
		{
			if (confirm && wheel.Hovered != null && wheel.Hovered.Toggle != null)
			{
				wheel.Hovered.Toggle(player);
			}
			else if (confirm && wheel.Hovered != null && wheel.Hovered != selected)
			{
				selected = wheel.Hovered;
				Debug.Log("[TenShadows] selected " + NameOf(selected));
			}
			Object.Destroy((Object)(object)((Component)wheel).gameObject);
			wheel = null;
		}
	}

	private bool UsesController()
	{
		PlayerActions playerActions = player.data.playerActions;
		if (playerActions != null)
		{
			return ((PlayerActionSet)playerActions).Device != null;
		}
		return false;
	}

	private bool PagePressed()
	{
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		if (UsesController())
		{
			InputDevice device = ((PlayerActionSet)player.data.playerActions).Device;
			if (!((OneAxisInputControl)device.DPadLeft).WasPressed)
			{
				return ((OneAxisInputControl)device.DPadRight).WasPressed;
			}
			return true;
		}
		if (!Input.GetKeyDown((KeyCode)107))
		{
			return Mathf.Abs(Input.mouseScrollDelta.y) > 0.1f;
		}
		return true;
	}

	private bool WheelHeld()
	{
		if (UsesController())
		{
			return ((OneAxisInputControl)((PlayerActionSet)player.data.playerActions).Device.DPadUp).IsPressed;
		}
		return Input.GetKey((KeyCode)106);
	}

	private bool AimDirection(out Vector2 dir)
	{
		//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_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: 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)
		if (UsesController())
		{
			dir = ((TwoAxisInputControl)player.data.playerActions.Aim).Value;
			return ((Vector2)(ref dir)).magnitude > 0.5f;
		}
		dir = Vector2.op_Implicit(Input.mousePosition) - new Vector2((float)Screen.width / 2f, (float)Screen.height / 2f);
		return ((Vector2)(ref dir)).magnitude > (float)Screen.height * 0.064687505f;
	}
}
public class UnlockTenShadowsCard : CustomCard
{
	public const string CardTitle = "Unlock Ten Shadows";

	private const float HealthBonus = 1.15f;

	private const float SpeedBonus = 1.15f;

	private const float DamageBonus = 1.1f;

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

	public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
	{
		if ((Object)(object)((Component)player).gameObject.GetComponent<ShadowCaster>() == (Object)null)
		{
			((Component)player).gameObject.AddComponent<ShadowCaster>();
		}
	}

	protected override string GetTitle()
	{
		return "Unlock Ten Shadows";
	}

	protected override string GetDescription()
	{
		return "Gain the Divine Dogs and unlock shadow cards. Hold J (controller: D-pad Up) to choose a shadow, K (controller: Y) to summon it.";
	}

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

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

	protected override CardInfoStat[] GetStats()
	{
		return (CardInfoStat[])(object)new CardInfoStat[5]
		{
			CardArt.Stat(positive: true, "Health", Percent(1.15f)),
			CardArt.Stat(positive: true, "Movement speed", Percent(1.15f)),
			CardArt.Stat(positive: true, "Damage", Percent(1.1f)),
			CardArt.Stat(positive: true, "Divine Dogs", "x" + 2),
			CardArt.Stat(positive: true, "Cursed energy", 100f.ToString("F0") + " (+" + 7f.ToString("F0") + "/s)")
		};
	}

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

	public override string GetModName()
	{
		return "JJK Ten Shadows";
	}

	private static string Percent(float multiplier)
	{
		return "+" + Mathf.RoundToInt((multiplier - 1f) * 100f) + "%";
	}
}
public class WolfHealth : Damagable
{
	public const float MaxHealth = 200f;

	public Player owner;

	public ShadowMinion behavior;

	private float maxHealth = 200f;

	private float health = 200f;

	private bool retreating;

	private Transform barFill;

	private SpriteRenderer barFillRenderer;

	private float BarWidth = 2.16f;

	private const float BarHeight = 0.2f;

	private float BarY = 2.016f;

	private Transform barBack;

	public float Ratio => Mathf.Clamp01(health / maxHealth);

	public void SetBarVisible(bool visible)
	{
		if ((Object)(object)barBack != (Object)null)
		{
			((Component)barBack).gameObject.SetActive(visible);
		}
		if ((Object)(object)barFill != (Object)null)
		{
			((Component)barFill).gameObject.SetActive(visible);
		}
	}

	public void SetBarPlacement(float width, float y)
	{
		//IL_0032: 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_008e: Unknown result type (might be due to invalid IL or missing references)
		BarWidth = width;
		BarY = y;
		if ((Object)(object)barBack != (Object)null)
		{
			barBack.localPosition = new Vector3(0f, BarY, 0f);
			barBack.localScale = new Vector3(BarWidth + 0.1f, 0.28f, 1f);
		}
		if ((Object)(object)barFill != (Object)null)
		{
			barFill.localPosition = new Vector3((0f - BarWidth) / 2f, BarY, 0f);
		}
		UpdateBar();
	}

	public void SetMaxHealth(float value)
	{
		maxHealth = value;
		health = value;
		UpdateBar();
	}

	private void Awake()
	{
		BuildHealthBar();
		UpdateBar();
	}

	public void Heal(float amount)
	{
		if (!(amount <= 0f) && !(health <= 0f))
		{
			health = Mathf.Min(maxHealth, health + amount);
			UpdateBar();
		}
	}

	public void SetRetreating(bool value)
	{
		if (retreating != value)
		{
			retreating = value;
			UpdateBar();
		}
	}

	public override void CallTakeDamage(Vector2 damage, Vector2 damagePosition, GameObject damagingWeapon = null, Player damagingPlayer = null, bool lethal = true)
	{
		ReportHit(((Vector2)(ref damage)).magnitude, damagingPlayer);
	}

	public override void TakeDamage(Vector2 damage, Vector2 damagePosition, GameObject damagingWeapon = null, Player damagingPlayer = null, bool lethal = true, bool ignoreBlock = false)
	{
		ReportHit(((Vector2)(ref damage)).magnitude, damagingPlayer);
	}

	public override void TakeDamage(Vector2 damage, Vector2 damagePosition, Color dmgColor, GameObject damagingWeapon = null, Player damagingPlayer = null, bool lethal = true, bool ignoreBlock = false)
	{
		ReportHit(((Vector2)(ref damage)).magnitude, damagingPlayer);
	}

	private void ReportHit(float amount, Player attacker)
	{
		if ((!((Object)(object)attacker != (Object)null) || !((Object)(object)owner != (Object)null) || attacker.teamID != owner.teamID) && !(amount <= 0f) && !((Object)(object)behavior == (Object)null) && (((Object)(object)attacker != (Object)null) ? attacker.data.view.IsMine : behavior.isAuthority))
		{
			WolfNet.SendDamage(behavior.netId, amount, ((Object)(object)attacker != (Object)null) ? attacker.playerID : (-1));
		}
	}

	public void ApplyDamage(float amount)
	{
		if (health <= 0f)
		{
			return;
		}
		health -= amount;
		Debug.Log("[Wolf] took " + amount.ToString("F0") + " damage, health now " + Mathf.Max(health, 0f).ToString("F0"));
		UpdateBar();
		if (health <= 0f)
		{
			Debug.Log("[Wolf] died");
			if (behavior is WolfBehavior && behavior.variant == 1 && (Object)(object)owner != (Object)null)
			{
				WolfNet.SendFormTotality(owner);
			}
			if (behavior is WolfBehavior && behavior.variant == 2 && (Object)(object)owner != (Object)null)
			{
				WolfNet.SendTotalityDestroyed(owner);
			}
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}

	public void SetFromNetwork(float ratio, bool isRetreating)
	{
		health = ratio * maxHealth;
		retreating = isRetreating;
		UpdateBar();
	}

	private void BuildHealthBar()
	{
		//IL_0026: 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_0044: 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_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Expected O, but got Unknown
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: Expected O, but got Unknown
		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
		Texture2D whiteTexture = Texture2D.whiteTexture;
		Rect val = default(Rect);
		((Rect)(ref val))..ctor(0f, 0f, (float)((Texture)whiteTexture).width, (float)((Texture)whiteTexture).height);
		Sprite sprite = Sprite.Create(whiteTexture, val, new Vector2(0.5f, 0.5f), (float)((Texture)whiteTexture).width);
		Sprite sprite2 = Sprite.Create(whiteTexture, val, new Vector2(0f, 0.5f), (float)((Texture)whiteTexture).width);
		GameObject val2 = new GameObject("HpBack");
		val2.transform.SetParent(((Component)this).transform, false);
		barBack = val2.transform;
		val2.transform.localPosition = new Vector3(0f, BarY, 0f);
		val2.transform.localScale = new Vector3(BarWidth + 0.1f, 0.28f, 1f);
		SpriteRenderer obj = val2.AddComponent<SpriteRenderer>();
		obj.sprite = sprite;
		obj.color = new Color(0f, 0f, 0f, 0.75f);
		((Renderer)obj).sortingOrder = 20;
		GameObject val3 = new GameObject("HpFill");
		val3.transform.SetParent(((Component)this).transform, false);
		val3.transform.localPosition = new Vector3((0f - BarWidth) / 2f, BarY, 0f);
		barFill = val3.transform;
		barFillRenderer = val3.AddComponent<SpriteRenderer>();
		barFillRenderer.sprite = sprite2;
		((Renderer)barFillRenderer).sortingOrder = 21;
	}

	private void UpdateBar()
	{
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: 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_006f: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)barFill == (Object)null))
		{
			float ratio = Ratio;
			barFill.localScale = new Vector3(BarWidth * ratio, 0.2f, 1f);
			barFillRenderer.color = (Color)(retreating ? new Color(0.35f, 0.75f, 1f) : Color.Lerp(new Color(0.9f, 0.15f, 0.15f), new Color(0.3f, 0.9f, 0.35f), ratio));
		}
	}
}
public static class WolfSprite
{
	public const float WolfWidth = 4.8f;

	private static readonly string[] Files = new string[4] { "wolf.png", "wolf_white.png", "wolf_totality.png", "tiger.png" };

	private static readonly Sprite[] cached = (Sprite[])(object)new Sprite[Files.Length];

	public static Sprite Get()
	{
		return Get(0);
	}

	public static Sprite Get(int variant)
	{
		//IL_006b: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		if (variant < 0 || variant >= Files.Length)
		{
			variant = 0;
		}
		if ((Object)(object)cached[variant] != (Object)null)
		{
			return cached[variant];
		}
		Texture2D val = LoadTexture(Files[variant]);
		if ((Object)(object)val != (Object)null)
		{
			float num = (float)((Texture)val).width / 4.8f;
			cached[variant] = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), num);
			return cached[variant];
		}
		if (variant != 0)
		{
			return cached[variant] = Get(0);
		}
		Texture2D whiteTexture = Texture2D.whiteTexture;
		cached[0] = Sprite.Create(whiteTexture, new Rect(0f, 0f, (float)((Texture)whiteTexture).width, (float)((Texture)whiteTexture).height), new Vector2(0.5f, 0.5f), (float)((Texture)whiteTexture).width / 4.8f * 0.5f);
		return cached[0];
	}

	public static Texture2D LoadTexture(string fileName)
	{
		//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;
				}
			}
			Debug.LogWarning("[Wolf] " + fileName + " not found or unreadable at: " + text);
		}
		catch (Exception ex)
		{
			Debug.LogWarning("[Wolf] failed to load " + fileName + ": " + ex.Message);
		}
		return null;
	}
}
public class WolfBehavior : ShadowMinion
{
	private const float StateInterval = 0.1f;

	private const float CopySmoothing = 15f;

	private const float CopyTimeout = 3f;

	private const float CopySnapDistance = 6f;

	private float nextStateSend;

	private Vector2 netPos;

	private float lastNetUpdate;

	private const float FootDepth = 1.7472f;

	private const float HalfLength = 1.3f;

	private const float BodyHeight = 2.6f;

	private const float Gravity = 45f;

	private const float MaxFallSpeed = 35f;

	private const float RunSpeed = 11f;

	private const float GroundAccel = 60f;

	private const float AirAccel = 25f;

	private const float MaxJumpHeight = 8.5f;

	private const float JumpCooldown = 0.35f;

	private const float FollowDistance = 3.5f;

	private const float FollowSlack = 1f;

	private const float SideSwitchDelay = 0.3f;

	private const float StuckTime = 1.6f;

	private const float TravelDistance = 45f;

	private const float FallLimit = 30f;

	private const float SinkTime = 0.25f;

	private const float EmergeTime = 0.3f;

	public const float SummonCooldown = 8f;

	public const int MaxDogs = 2;

	public const float Lifetime = 30f;

	public const float TrackRange = 30f;

	private const float LeashRange = 40f;

	private const float BiteRange = 3f;

	private const float BiteCooldown = 1f;

	public const float BiteDamage = 25f;

	private const float PounceMin = 3f;

	private const float PounceMax = 7f;

	private const float PounceSpeed = 17f;

	private const float PounceCooldown = 2f;

	private const float TotalityBiteCooldown = 0.75f;

	private const float TotalityPounceCooldown = 1.4f;

	private const float TotalitySpeedBonus = 1.2f;

	private const float RetreatBelow = 0.3f;

	private const float ResumeAbove = 0.7f;

	private const float RegenPerSecond = 10f;

	private const float RegenRange = 5f;

	private const float FlipLock = 0.3f;

	private Transform visualT;

	private SpriteRenderer visualSr;

	private WolfHealth hp;

	private BoxCollider2D box;

	private SpriteRenderer puddle;

	private float dieAt;

	private float nextBite;

	private float lungeUntil;

	private float lastFlipTime = -10f;

	private float nextPounce;

	private float nextJump;

	private float nextRetarget;

	private bool retreating;

	private Vector2 velocity;

	private bool grounded;

	private int mapMask;

	private float bestGoalDistance = float.MaxValue;

	private float lastProgress;

	private int travelPhase;

	private float travelPhaseEnd;

	private Vector2 travelDestination;

	private float behindSign = -1f;

	private float lastOwnerX;

	private float lastSideSwitch = -10f;

	private Transform currentTarget;

	private Player currentPlayer;

	private DummyTarget currentDummy;

	private Vector2 lastAnimPos;

	private float puddleUntil;

	private HuntMarker marker;

	private Transform markedTarget;

	public bool IsTotality => variant == 2;

	public bool IsTiger => variant == 3;

	private float BiteDmg
	{
		get
		{
			if (!IsTiger)
			{
				if (!IsTotality)
				{
					return 25f;
				}
				return 45f;
			}
			return 60f;
		}
	}

	private float BiteCd
	{
		get
		{
			if (!IsTiger)
			{
				if (!IsTotality)
				{
					return 1f;
				}
				return 0.75f;
			}
			return 0.7f;
		}
	}

	private float PounceCd
	{
		get
		{
			if (!IsTiger)
			{
				if (!IsTotality)
				{
					return 2f;
				}
				return 1.4f;
			}
			return 1.2f;
		}
	}

	private float SpeedMult
	{
		get
		{
			if (IsTiger)
			{
				return 1.25f;
			}
			float num = (IsTotality ? 1.2f : 1f);
			if (!TigerBuffs.Active(owner))
			{
				return num;
			}
			return num * 1.2f;
		}
	}

	private float SizeMult
	{
		get
		{
			if (!IsTiger)
			{
				if (!IsTotality)
				{
					return 1f;
				}
				return 1.4f;
			}
			return 1.5f;
		}
	}

	private float HuntRange
	{
		get
		{
			if (!IsTiger)
			{
				return 30f;
			}
			return 12f;
		}
	}

	private float Leash
	{
		get
		{
			if (!IsTiger)
			{
				return 40f;
			}
			return 18f;
		}
	}

	private float LifeSpan
	{
		get
		{
			if (!IsTiger)
			{
				return 30f;
			}
			return 20f;
		}
	}

	private int WhiteOffset => (variant == 1) ? 1 : 0;

	private float Foot => 1.7472f * SizeMult;

	private float FeetY => ((Component)this).transform.position.y - Foot;

	public void BecomeTotality()
	{
		//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_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		variant = 2;
		((Object)((Component)this).gameObject).name = "DivineDog_Totality";
		Transform transform = ((Component)this).transform;
		transform.position += Vector3.up * 1.7472f * (1.4f - ((Component)this).transform.localScale.y);
		((Component)this).transform.localScale = Vector3.one * 1.4f;
		((Component)((Component)this).transform.Find("Visual")).GetComponent<SpriteRenderer>().sprite = WolfSprite.Get(2);
		WolfHealth component = ((Component)this).GetComponent<WolfHealth>();
		if ((Object)(object)component != (Object)null)
		{
			component.SetMaxHealth(450f);
			component.SetRetreating(value: false);
		}
		if ((Object)(object)marker != (Object)null)
		{
			Object.Destroy((Object)(object)((Component)marker).gameObject);
			marker = null;
			markedTarget = null;
		}
		dieAt = Time.time + 30f;
		lungeUntil = Time.time + 0.4f;
		retreating = false;
	}

	public void BecomeTiger()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		variant = 3;
		((Component)this).transform.localScale = Vector3.one * 1.5f;
		((Component)((Component)this).transform.Find("Visual")).GetComponent<SpriteRenderer>().sprite = WolfSprite.Get(3);
		WolfHealth component = ((Component)this).GetComponent<WolfHealth>();
		if ((Object)(object)component != (Object)null)
		{
			component.SetMaxHealth(500f);
		}
	}

	private void Start()
	{
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: 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_00be: Unknown result type (might be due to invalid IL or missing references)
		hp = ((Component)this).GetComponent<WolfHealth>();
		box = ((Component)this).GetComponent<BoxCollider2D>();
		visualT = ((Component)this).transform.Find("Visual");
		visualSr = ((Component)visualT).GetComponent<SpriteRenderer>();
		dieAt = Time.time + LifeSpan;
		lastOwnerX = (((Object)(object)owner != (Object)null) ? ((Component)owner).transform.position.x : 0f);
		netPos = Vector2.op_Implicit(((Component)this).transform.position);
		lastNetUpdate = Time.time;
		lastProgress = Time.time;
		lastAnimPos = Vector2.op_Implicit(((Component)this).transform.position);
		mapMask = MapMask(owner);
		BuildPuddle();
		if ((Object)(object)box != (Object)null)
		{
			foreach (Player player in PlayerManager.instance.players)
			{
				Collider2D[] componentsInChildren = ((Component)player).GetComponentsInChildren<Collider2D>();
				foreach (Collider2D val in componentsInChildren)
				{
					Physics2D.IgnoreCollision((Collider2D)(object)box, val);
				}
			}
		}
		travelPhase = 2;
		travelPhaseEnd = Time.time + 0.3f;
	}

	private void Update()
	{
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: 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_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: 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)
		if ((Object)(object)owner == (Object)null || owner.data.dead)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
			return;
		}
		if (!isAuthority)
		{
			UpdateCopy();
			return;
		}
		if (Time.time >= dieAt)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
			return;
		}
		float dt = Mathf.Min(Time.deltaTime, 0.05f);
		Vector2 val = Vector2.op_Implicit(((Component)owner).transform.position);
		TrackOwnerSide(val);
		if (travelPhase != 0)
		{
			UpdateShadowTravel();
		}
		else if (((Component)this).transform.position.y < val.y - 30f || Vector2.Distance(Vector2.op_Implicit(((Component)this).transform.position), val) > 45f)
		{
			StartShadowTravel(GroundNear(val + new Vector2(behindSign * 3.5f, 0f)));
		}
		else
		{
			Think(val, dt);
			Move(dt);
		}
		Animate();
		UpdateMarker();
		if (Time.time >= nextStateSend)
		{
			nextStateSend = Time.time + 0.1f;
			WolfNet.SendState(this, visualSr.flipX, ((Object)(object)hp != (Object)null) ? hp.Ratio : 1f, retreating, Time.time < lungeUntil);
		}
	}

	private void Think(Vector2 ownerPos, float dt)
	{
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: 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_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: 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_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		UpdateRetreatState();
		if (retreating)
		{
			Vector2 goal = ownerPos + new Vector2(behindSign * 3.5f * 0.6f * SizeMult, 0f);
			Seek(goal, 1f, 13.75f, owner.data.isGrounded, dt);
			if (Vector2.Distance(Vector2.op_Implicit(((Component)this).transform.position), ownerPos) < 5f * SizeMult && (Object)(object)hp != (Object)null)
			{
				hp.Heal(10f * Time.deltaTime);
			}
			return;
		}
		UpdateTarget(Vector2.op_Implicit(((Component)this).transform.position), ownerPos);
		if ((Object)(object)currentTarget != (Object)null)
		{
			Hunt(dt);
			return;
		}
		float num = (3.5f + (float)WhiteOffset * 2.5f) * SizeMult;
		Vector2 goal2 = ownerPos + new Vector2(behindSign * num, 0f);
		Seek(goal2, 1f, 11f, owner.data.isGrounded, dt);
	}

	private void Hunt(float dt)
	{
		//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_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: 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_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_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: 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_009c: 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_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		Vector2 val = Vector2.op_Implicit(((Component)this).transform.position);
		Vector2 val2 = Vector2.op_Implicit(currentTarget.position);
		Vector2 val3 = val2 - val;
		float magnitude = ((Vector2)(ref val3)).magnitude;
		FaceDirection(val3.x);
		if (grounded && Time.time >= nextPounce && magnitude > 3f * SizeMult && magnitude < 7f * SizeMult && val3.y > -2f)
		{
			nextPounce = Time.time + PounceCd;
			float num = Mathf.Clamp(val3.y + 1.5f, 1.5f, 8.5f);
			velocity = new Vector2(Mathf.Sign(val3.x) * 17f * SpeedMult, Mathf.Sqrt(90f * num));
			grounded = false;
			lungeUntil = Time.time + 0.2f;
		}
		else
		{
			Seek(val2, 1.5f * SizeMult, 11f * SpeedMult, climbToGoal: true, dt);
		}
		if (!(magnitude < 3f * SizeMult) || !(Time.time >= nextBite))
		{
			return;
		}
		nextBite = Time.time + BiteCd;
		lungeUntil = Time.time + 0.15f;
		if ((Object)(object)currentPlayer != (Object)null)
		{
			float num2 = ShadowDamage.Hit(this, currentPlayer, BiteDmg, Vector2.up);
			if (IsTiger)
			{
				WolfNet.SendBurn(currentPlayer, num2 * 0.05f, 12, 0.5f, owner);
			}
		}
		else if ((Object)(object)currentDummy != (Object)null)
		{
			ShadowDamage.HitDummy(this, currentDummy, BiteDmg);
			if (IsTiger)
			{
				currentDummy.Burn(BiteDmg * 0.05f, 12, 0.5f);
			}
		}
	}

	private void Seek(Vector2 goal, float slack, float speed, bool climbToGoal, float dt)
	{
		//IL_0000: 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_016a: Unknown result type (might be due to invalid IL or missing references)
		//IL_016f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0174: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01de: Unknown result type (might be due to invalid IL or missing references)
		//IL_0145: Unknown result type (might be due to invalid IL or missing references)
		float num = goal.x - ((Component)this).transform.position.x;
		float num2 = Mathf.Sign(num);
		bool flag = Mathf.Abs(num) > slack;
		float num3 = (flag ? (num2 * speed) : 0f);
		velocity.x = Mathf.MoveTowards(velocity.x, num3, (grounded ? 60f : 25f) * dt);
		if (flag && Mathf.Abs(velocity.x) > 1f)
		{
			FaceDirection(velocity.x);
		}
		if (grounded && Time.time >= nextJump)
		{
			float num4 = goal.y - FeetY;
			bool flag2 = climbToGoal && num4 > 1.5f * SizeMult && Mathf.Abs(num) < 10f;
			bool num5 = flag && WallAhead(num2, 1.3f * SizeMult + 1.2f);
			bool flag3 = flag && !GroundAhead(num2);
			if (num5)
			{
				Jump(WallHeightAhead(num2) + 1f);
			}
			else if (flag2)
			{
				Jump(num4 + 1.5f);
			}
			else if (flag3 && goal.y > FeetY - 1.5f)
			{
				Jump(3f);
			}
		}
		float num6 = Vector2.Distance(Vector2.op_Implicit(((Component)this).transform.position), goal);
		if (num6 < bestGoalDistance - 1f || num6 < slack + 1.5f)
		{
			bestGoalDistance = num6;
			lastProgress = Time.time;
		}
		else if (Time.time - lastProgress > 1.6f)
		{
			StartShadowTravel(GroundNear(goal - new Vector2(num2 * 2f * SizeMult, 0f)));
		}
	}

	private void Jump(float height)
	{
		height = Mathf.Clamp(height, 1.5f, 8.5f);
		velocity.y = Mathf.Sqrt(90f * height);
		grounded = false;
		nextJump = Time.time + 0.35f;
	}

	private unsafe void StartShadowTravel(Vector2 destination)
	{
		//IL_0019: 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_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: 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)
		travelPhase = 1;
		travelPhaseEnd = Time.time + 0.25f;
		travelDestination = destination;
		velocity = Vector2.zero;
		Vector2 val = destination;
		Debug.Log("[Wolf] shadow travel to " + ((object)(*(Vector2*)(&val))/*cast due to .constrained prefix*/).ToString());
	}

	private void UpdateShadowTravel()
	{
		//IL_0040: 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_0055: 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)
		if (!(Time.time < travelPhaseEnd))
		{
			if (travelPhase == 1)
			{
				((Component)this).transform.position = new Vector3(travelDestination.x, travelDestination.y + Foot, ((Component)this).transform.position.z);
				velocity = Vector2.zero;
				grounded = false;
				travelPhase = 2;
				travelPhaseEnd = Time.time + 0.3f;
			}
			else
			{
				travelPhase = 0;
				bestGoalDistance = float.MaxValue;
				lastProgress = Time.time;
			}
		}
	}

	private Vector2 GroundNear(Vector2 point)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: 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)
		if (CastMap(point + Vector2.up * 3f, Vector2.down, 40f, out var result))
		{
			return ((RaycastHit2D)(ref result)).point;
		}
		return point;
	}

	private void Move(float dt)
	{
		//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_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0225: Unknown result type (might be due to invalid IL or missing references)
		//IL_022b: 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_0253: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: 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_00b0: 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_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0166: Unknown result type (might be due to invalid IL or missing references)
		//IL_017f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0181: Unknown result type (might be due to invalid IL or missing references)
		//IL_0295: Unknown result type (might be due to invalid IL or missing references)
		//IL_029b: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
		Vector2 val = Vector2.op_Implicit(((Component)this).transform.position);
		float num = 1.3f * SizeMult;
		velocity.y = Mathf.Max(velocity.y - 45f * dt, -35f);
		float num2 = velocity.x * dt;
		RaycastHit2D result;
		if (Mathf.Abs(num2) > 0.0001f)
		{
			float num3 = Mathf.Sign(num2);
			float[] array = new float[3] { 0.35f, 1.2f, 2.2f };
			Vector2 origin = default(Vector2);
			foreach (float num4 in array)
			{
				((Vector2)(ref origin))..ctor(val.x, val.y - Foot + num4 * SizeMult);
				if (CastMap(origin, new Vector2(num3, 0f), num + Mathf.Abs(num2), out result))
				{
					num2 = num3 * Mathf.Max(0f, ((RaycastHit2D)(ref result)).distance - num);
					velocity.x = 0f;
				}
			}
			val.x += num2;
		}
		float num5 = velocity.y * dt;
		if (num5 <= 0f)
		{
			float num6 = float.MaxValue;
			float[] array = new float[3]
			{
				(0f - num) * 0.6f,
				0f,
				num * 0.6f
			};
			Vector2 origin2 = default(Vector2);
			foreach (float num7 in array)
			{
				((Vector2)(ref origin2))..ctor(val.x + num7, val.y - Foot + 0.5f);
				if (CastMap(origin2, Vector2.down, 0.5f + Mathf.Abs(num5) + 0.05f, out result) && ((RaycastHit2D)(ref result)).distance < num6)
				{
					num6 = ((RaycastHit2D)(ref result)).distance;
				}
			}
			if (num6 < float.MaxValue)
			{
				val.y = val.y - Foot + 0.5f - num6 + Foot;
				velocity.y = 0f;
				grounded = true;
			}
			else
			{
				val.y += num5;
				grounded = false;
			}
		}
		else
		{
			Vector2 origin3 = default(Vector2);
			((Vector2)(ref origin3))..ctor(val.x, val.y - Foot + 2.6f * SizeMult - 0.3f);
			if (CastMap(origin3, Vector2.up, num5 + 0.3f, out result))
			{
				velocity.y = 0f;
			}
			else
			{
				val.y += num5;
			}
			grounded = false;
		}
		((Component)this).transform.position = new Vector3(val.x, val.y, ((Component)this).transform.position.z);
	}

	private bool WallAhead(float dir, float reach)
	{
		//IL_0008: 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_0032: Unknown result type (might be due to invalid IL or missing references)
		Vector2 origin = default(Vector2);
		((Vector2)(ref origin))..ctor(((Component)this).transform.position.x, FeetY + 0.5f * SizeMult);
		RaycastHit2D result;
		return CastMap(origin, new Vector2(dir, 0f), reach, out result);
	}

	private float WallHeightAhead(float dir)
	{
		//IL_0023: 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_0042: Unknown result type (might be due to invalid IL or missing references)
		float distance = 1.3f * SizeMult + 1.5f;
		Vector2 origin = default(Vector2);
		for (float num = 1f; num <= 8.5f; num += 1f)
		{
			((Vector2)(ref origin))..ctor(((Component)this).transform.position.x, FeetY + num);
			if (!CastMap(origin, new Vector2(dir, 0f), distance, out var _))
			{
				return num;
			}
		}
		return 8.5f;
	}

	private bool GroundAhead(float dir)
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		Vector2 origin = default(Vector2);
		((Vector2)(ref origin))..ctor(((Component)this).transform.position.x + dir * (1.3f * SizeMult + 1f), FeetY + 0.5f);
		RaycastHit2D result;
		return CastMap(origin, Vector2.down, 3.5f, out result);
	}

	private bool CastMap(Vector2 origin, Vector2 dir, float distance, out RaycastHit2D result)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: 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_006e: 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)
		result = default(RaycastHit2D);
		float num = float.MaxValue;
		RaycastHit2D[] array = Physics2D.RaycastAll(origin, dir, distance, mapMask);
		for (int i = 0; i < array.Length; i++)
		{
			RaycastHit2D val = array[i];
			if (!((Object)(object)((RaycastHit2D)(ref val)).collider == (Object)null) && !((RaycastHit2D)(ref val)).collider.isTrigger && !((Object)(object)((Component)((RaycastHit2D)(ref val)).collider).GetComponentInParent<Player>() != (Object)null) && ((RaycastHit2D)(ref val)).distance < num)
			{
				num = ((RaycastHit2D)(ref val)).distance;
				result = val;
			}
		}
		return num < float.MaxValue;
	}

	internal static int MapMask(Player p)
	{
		return ShadowLayers.MapMask;
	}

	private void Animate()
	{
		//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_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: 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_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//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_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d1: 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)
		//IL_0154: Unknown result type (might be due to invalid IL or missing references)
		Vector2 val = Vector2.op_Implicit(((Component)this).transform.position);
		Vector2 val2 = (val - lastAnimPos) / Mathf.Max(Time.deltaTime, 0.0001f);
		lastAnimPos = val;
		float num = ((Time.time < lungeUntil) ? 1.12f : 1f);
		float num2 = 1f;
		if (travelPhase == 1)
		{
			num2 = Mathf.Clamp01((travelPhaseEnd - Time.time) / 0.25f);
		}
		else if (travelPhase == 2)
		{
			num2 = 1f - Mathf.Clamp01((travelPhaseEnd - Time.time) / 0.3f);
		}
		visualT.localScale = new Vector3(num, num * Mathf.Max(num2, 0.02f), 1f);
		float num3 = 0f;
		float num4 = 0f;
		bool flag = (isAuthority ? grounded : (Mathf.Abs(val2.y) < 1f));
		if (travelPhase == 0)
		{
			if (flag && Mathf.Abs(val2.x) > 1f)
			{
				num3 = Mathf.Abs(Mathf.Sin(Time.time * 14f)) * 0.18f;
				num4 = Mathf.Sin(Time.time * 14f) * 2.5f;
			}
			else if (!flag)
			{
				num4 = Mathf.Clamp(val2.y * 1.2f, -14f, 14f) * (visualSr.flipX ? (-1f) : 1f);
			}
		}
		visualT.localPosition = new Vector3(0f, -1.7472f * (1f - Mathf.Max(num2, 0.02f)) + num3, 0f);
		visualT.localRotation = Quaternion.Euler(0f, 0f, num4);
		((Renderer)puddle).enabled = travelPhase != 0 || puddleUntil > Time.time;
	}

	private void BuildPuddle()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Expected O, but got Unknown
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: 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)
		Texture2D val = new Texture2D(64, 16, (TextureFormat)4, false);
		for (int i = 0; i < 16; i++)
		{
			for (int j = 0; j < 64; j++)
			{
				float num = ((float)j + 0.5f) / 32f - 1f;
				float num2 = ((float)i + 0.5f) / 8f - 1f;
				float num3 = Mathf.Sqrt(num * num + num2 * num2);
				val.SetPixel(j, i, new Color(0.06f, 0.04f, 0.1f, Mathf.Clamp01((1f - num3) * 4f) * 0.9f));
			}
		}
		val.Apply();
		GameObject val2 = new GameObject("ShadowPuddle");
		val2.transform.SetParent(((Component)this).transform, false);
		val2.transform.localPosition = new Vector3(0f, -1.7472f, 0f);
		puddle = val2.AddComponent<SpriteRenderer>();
		puddle.sprite = Sprite.Create(val, new Rect(0f, 0f, 64f, 16f), new Vector2(0.5f, 0.5f), 16.410257f);
		((Renderer)puddle).sortingOrder = 9;
		((Renderer)puddle).enabled = false;
	}

	private void UpdateCopy()
	{
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_004f: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		if (Time.time - lastNetUpdate > 3f)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
			return;
		}
		if (travelPhase == 2 && Time.time >= travelPhaseEnd)
		{
			travelPhase = 0;
		}
		Vector2 val = Vector2.op_Implicit(((Component)this).transform.position);
		if (Vector2.Distance(val, netPos) > 6f * SizeMult)
		{
			((Component)this).transform.position = new Vector3(netPos.x, netPos.y, ((Component)this).transform.position.z);
			puddleUntil = Time.time + 0.4f;
			lastAnimPos = netPos;
		}
		else
		{
			float num = 1f - Mathf.Exp(-15f * Time.deltaTime);
			Vector2 val2 = Vector2.Lerp(val, netPos, num);
			((Component)this).transform.position = new Vector3(val2.x, val2.y, ((Component)this).transform.position.z);
		}
		Animate();
	}

	public override void ApplyNetworkState(Vector2 pos, bool flip, float hpRatio, bool isRetreating, bool lunging)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		netPos = pos;
		lastNetUpdate = Time.time;
		if ((Object)(object)visualSr != (Object)null)
		{
			visualSr.flipX = flip;
		}
		if (lunging)
		{
			lungeUntil = Time.time + 0.1f;
		}
		if ((Object)(object)hp == (Object)null)
		{
			hp = ((Component)this).GetComponent<WolfHealth>();
		}
		if ((Object)(object)hp != (Object)null)
		{
			hp.SetFromNetwork(hpRatio, isRetreating);
		}
	}

	private void UpdateMarker()
	{
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: 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_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		Transform val = (retreating ? null : currentTarget);
		if (!((Object)(object)val == (Object)(object)markedTarget) || !((Object)(object)marker != (Object)null))
		{
			if ((Object)(object)marker == (Object)null)
			{
				Color color = (Color)((variant == 1) ? Color.white : ((variant == 2) ? new Color(0.8f, 0.95f, 1f) : ((variant == 3) ? new Color(1f, 0.55f, 0.15f) : new Color(0.75f, 0.55f, 1f))));
				marker = HuntMarker.Create(color, (float)WhiteOffset * 22f);
			}
			marker.SetTarget(val);
			markedTarget = val;
		}
	}

	private void OnDestroy()
	{
		if ((Object)(object)marker != (Object)null)
		{
			Object.Destroy((Object)(object)((Component)marker).gameObject);
		}
		UnregisterAndAnnounce();
	}

	private void TrackOwnerSide(Vector2 ownerPos)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		float num = ownerPos.x - lastOwnerX;
		lastOwnerX = ownerPos.x;
		if (Mathf.Abs(num) > 0.03f && Time.time - lastSideSwitch > 0.3f)
		{
			float num2 = ((num > 0f) ? (-1f) : 1f);
			if (num2 != behindSign)
			{
				behindSign = num2;
				lastSideSwitch = Time.time;
			}
		}
	}

	private void UpdateRetreatState()
	{
		if (!((Object)(object)hp == (Object)null))
		{
			float ratio = hp.Ratio;
			if (!retreating && ratio < 0.3f)
			{
				retreating = true;
				ClearTarget();
				hp.SetRetreating(value: true);
				Debug.Log("[Wolf] low health, retreating to owner");
			}
			else if (retreating && ratio >= 0.7f)
			{
				retreating = false;
				hp.SetRetreating(value: false);
				Debug.Log("[Wolf] recovered, back to hunting");
			}
		}
	}

	private void UpdateTarget(Vector2 myPos, Vector2 ownerPos)
	{
		//IL_0079: 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_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_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f2: 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_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)currentTarget != (Object)null && (((Object)(object)currentPlayer != (Object)null && currentPlayer.data.dead) || Vector2.Distance(Vector2.op_Implicit(currentTarget.position), ownerPos) > HuntRange + 3f || Vector2.Distance(myPos, ownerPos) > Leash))
		{
			ClearTarget();
		}
		Player foundPlayer;
		DummyTarget foundDummy;
		if ((Object)(object)currentTarget == (Object)null)
		{
			Transform val = FindTargetNearOwner(ownerPos, out foundPlayer, out foundDummy);
			if ((Object)(object)val != (Object)null)
			{
				SetTarget(val, foundPlayer, foundDummy);
			}
		}
		else if (Time.time >= nextRetarget)
		{
			nextRetarget = Time.time + 0.5f;
			Transform val2 = FindTargetNearOwner(ownerPos, out foundPlayer, out foundDummy);
			if ((Object)(object)val2 != (Object)null && (Object)(object)val2 != (Object)(object)currentTarget && Vector2.Distance(Vector2.op_Implicit(val2.position), ownerPos) < Vector2.Distance(Vector2.op_Implicit(currentTarget.position), ownerPos) - 3f)
			{
				SetTarget(val2, foundPlayer, foundDummy);
			}
		}
	}

	private void SetTarget(Transform t, Player p, DummyTarget d)
	{
		if ((Object)(object)t != (Object)(object)currentTarget)
		{
			bestGoalDistance = float.MaxValue;
			lastProgress = Time.time;
		}
		currentTarget = t;
		currentPlayer = p;
		currentDummy = d;
	}

	private void ClearTarget()
	{
		if ((Object)(object)currentTarget != (Object)null)
		{
			bestGoalDistance = float.MaxValue;
			lastProgress = Time.time;
		}
		currentTarget = null;
		currentPlayer = null;
		currentDummy = null;
	}

	private Transform FindTargetNearOwner(Vector2 ownerPos, out Player foundPlayer, out DummyTarget foundDummy)
	{
		//IL_004f: 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_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		foundPlayer = null;
		foundDummy = null;
		Transform result = null;
		float num = HuntRange;
		foreach (Player player in PlayerManager.instance.players)
		{
			if (player.teamID != owner.teamID && !player.data.dead)
			{
				float num2 = Vector2.Distance(Vector2.op_Implicit(((Component)player).transform.position), ownerPos);
				if (num2 < num)
				{
					num = num2;
					result = ((Component)player).transform;
					foundPlayer = player;
					foundDummy = null;
				}
			}
		}
		foreach (DummyTarget item in DummyTarget.All)
		{
			float num3 = Vector2.Distance(Vector2.op_Implicit(((Component)item).transform.position), ownerPos);
			if (num3 < num)
			{
				num = num3;
				result = ((Component)item).transform;
				foundDummy = item;
				foundPlayer = null;
			}
		}
		return result;
	}

	private void FaceDirection(float dx)
	{
		bool flag;
		if (dx > 0.5f)
		{
			flag = false;
		}
		else
		{
			if (!(dx < -0.5f))
			{
				return;
			}
			flag = true;
		}
		if (flag != visualSr.flipX && !(Time.time - lastFlipTime < 0.3f))
		{
			visualSr.flipX = flag;
			lastFlipTime = Time.time;
		}
	}
}
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_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Expected O, but got Unknown
		//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_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b8: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Expected O, but got Unknown
		if (templates.TryGetValue(fileName, out var value) && (Object)(object)value != (Object)null)
		{
			return value;
		}
		Texture2D val = WolfSprite.LoadTexture(fileName);
		if ((Object)(object)val == (Object)null)
		{
			return null;
		}
		if ((Object)(object)holder == (Object)null)
		{
			holder = new GameObject("TenShadowsCardArtHolder");
			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 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 class ElephantCard : CustomCard
{
	public const string CardTitle = "Max Elephant";

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

	public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
	{
		if ((Object)(object)((Component)player).gameObject.GetComponent<ShadowCaster>() == (Object)null)
		{
			((Component)player).gameObject.AddComponent<ShadowCaster>();
		}
	}

	protected override string GetTitle()
	{
		return "Max Elephant";
	}

	protected override string GetDescription()
	{
		return "Adds Max Elephant to your Ten Shadows. It drops from the sky above you: the higher the fall, the bigger the area damage. The impact floods the area with water that slows enemies.";
	}

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

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

	protected override CardInfoStat[] GetStats()
	{
		return (CardInfoStat[])(object)new CardInfoStat[4]
		{
			CardArt.Stat(positive: true, "Impact damage", 15f.ToString("F0") + "-" + 100f.ToString("F0") + " (fall height)"),
			CardArt.Stat(positive: true, "Impact radius", 4.5f.ToString("0.#")),
			CardArt.Stat(positive: true, "Water", "slows for " + 5f.ToString("F0") + "s"),
			CardArt.Stat(positive: false, "Cooldown", 18f.ToString("F0") + "s")
		};
	}

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

	public override string GetModName()
	{
		return "JJK Ten Shadows";
	}
}
public static class ElephantSprites
{
	public const float Width = 7f;

	private const float PixelsPerUnit = 91.42857f;

	private const float FeetY = 0.031111112f;

	public static readonly float BodyHeight = 3.4781249f;

	public const int Idle = 0;

	public const int Spray = 1;

	private static readonly string[] Files = new string[2] { "elephant.png", "elephant_spray.png" };

	private static readonly Sprite[] cached = (Sprite[])(object)new Sprite[Files.Length];

	private static Sprite disc;

	public static Sprite Get(int frame)
	{
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)cached[frame] != (Object)null)
		{
			return cached[frame];
		}
		Texture2D val = WolfSprite.LoadTexture(Files[frame]);
		if ((Object)(object)val == (Object)null)
		{
			return cached[frame] = ((frame == 0) ? WolfSprite.Get(0) : Get(0));
		}
		return cached[frame] = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.031111112f), 91.42857f);
	}

	public static Sprite Disc()
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Expected O, but got Unknown
		//IL_00ae: 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_003d: 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)