Decompiled source of Relic Stats v1.0.1

RelicStats.dll

Decompiled 2 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Battle;
using Battle.Attacks;
using Battle.Attacks.AttackBehaviours;
using Battle.Enemies;
using Battle.PegBehaviour;
using Battle.StatusEffects;
using BepInEx;
using BepInEx.Logging;
using Currency;
using HarmonyLib;
using I2.Loc;
using Map;
using Microsoft.CodeAnalysis;
using PeglinUI;
using PeglinUI.LoadoutManager;
using PeglinUI.PostBattle;
using PeglinUI.RunSummary;
using PeglinUI.UIUtils;
using Relics;
using TMPro;
using ToolBox.Serialization;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("RelicStats")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Show usage stats on acquired relics")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+04020f9c586b1c3179389dd6c1c605b91b39375f")]
[assembly: AssemblyProduct("Relic Stats")]
[assembly: AssemblyTitle("RelicStats")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace RelicStats
{
	public abstract class Tracker
	{
		public static readonly Dictionary<RelicEffect, Tracker> trackers = new Dictionary<RelicEffect, Tracker>();

		public static readonly HashSet<RelicEffect> relics = new HashSet<RelicEffect>();

		public abstract RelicEffect Relic { get; }

		public abstract string Tooltip { get; }

		public abstract object State { get; set; }

		public abstract void Reset();

		public abstract void Used();

		public virtual void Flash()
		{
		}

		public virtual void Checked()
		{
		}

		public void Updated()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			Plugin.UpdateTooltip(Relic);
		}

		public static void PopulateTrackers()
		{
			Type[] types = typeof(Tracker).Assembly.GetTypes();
			foreach (Type type in types)
			{
				if (type.IsSubclassOf(typeof(Tracker)) && !type.IsAbstract)
				{
					AddTracker((Tracker)type.GetConstructor(Type.EmptyTypes).Invoke(null));
				}
			}
			ResetAll();
		}

		[Conditional("DEBUG")]
		public static void ValidateTrackers()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: 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)
			foreach (RelicEffect value in Enum.GetValues(typeof(RelicEffect)))
			{
				if (!trackers.ContainsKey(value))
				{
					Plugin.Logger.LogWarning((object)$"Missing a tracker for {(object)value}");
				}
			}
			Type[] types = typeof(Tracker).Assembly.GetTypes();
			foreach (Type type in types)
			{
				if (type.IsSubclassOf(typeof(Tracker)))
				{
					bool flag = false;
					bool flag2 = false;
					FieldInfo[] fields = type.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
					foreach (FieldInfo obj in fields)
					{
						flag = true;
						if (obj.Name[0] != '_')
						{
							flag2 = true;
						}
					}
					MethodInfo method = type.GetMethod("Reset", BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public);
					PropertyInfo property = type.GetProperty("State", BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public);
					if (flag && method == null)
					{
						Plugin.Logger.LogWarning((object)$"Tracker class {type} should override Reset method");
					}
					if (flag2 && property == null)
					{
						Plugin.Logger.LogWarning((object)$"Tracker class {type} should override State property");
					}
				}
				bool flag3 = type.GetCustomAttributes(typeof(HarmonyPatch), inherit: false).Length != 0;
				bool flag4 = false;
				MethodInfo[] methods = type.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
				for (int j = 0; j < methods.Length; j++)
				{
					if (methods[j].GetCustomAttributes(typeof(HarmonyPatch), inherit: false).Length != 0)
					{
						flag4 = true;
						break;
					}
				}
				if (!flag3 && flag4)
				{
					Plugin.Logger.LogWarning((object)$"Class {type} should have [HarmonyPatch]");
				}
				else if (flag3 && !flag4)
				{
					Plugin.Logger.LogWarning((object)$"Class {type} should not have [HarmonyPatch]");
				}
			}
		}

		private static void AddTracker(Tracker tracker)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			trackers.Add(tracker.Relic, tracker);
		}

		public static void ResetAll(bool clearOwned = true)
		{
			foreach (KeyValuePair<RelicEffect, Tracker> tracker in trackers)
			{
				tracker.Value.Reset();
			}
			if (clearOwned)
			{
				relics.Clear();
			}
		}

		public static void AddRelic(RelicEffect relic, bool isNew)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			if (!relics.Contains(relic))
			{
				if (isNew && trackers.TryGetValue(relic, out var value))
				{
					value.Reset();
				}
				relics.Add(relic);
			}
		}

		public static bool HaveRelic(RelicEffect relic)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return relics.Contains(relic);
		}

		public static void LoadData()
		{
			ResetAll(clearOwned: false);
			RelicStatsSaveData relicStatsSaveData = (RelicStatsSaveData)(object)DataSerializer.Load<SaveObjectData>(RelicStatsSaveData.KEY, (SaveType)1);
			if (relicStatsSaveData == null)
			{
				return;
			}
			foreach (KeyValuePair<int, object> relicState in relicStatsSaveData.relicStates)
			{
				if (trackers.TryGetValue((RelicEffect)relicState.Key, out var value))
				{
					try
					{
						value.State = relicState.Value;
					}
					catch (InvalidCastException)
					{
					}
				}
			}
		}

		public static void SaveData()
		{
			//IL_0021: 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_0044: Expected I4, but got Unknown
			RelicStatsSaveData relicStatsSaveData = new RelicStatsSaveData();
			foreach (Tracker value in trackers.Values)
			{
				if (HaveRelic(value.Relic))
				{
					relicStatsSaveData.relicStates[(int)value.Relic] = value.State;
				}
			}
			((SaveObjectData)relicStatsSaveData).Save();
		}
	}
	public class RelicStatsSaveData : SaveObjectData
	{
		public static readonly string KEY = "com.mrphlip.peglin.RelicStats_RelicData";

		public Dictionary<int, object> relicStates;

		public override string Name => KEY;

		public RelicStatsSaveData()
			: base(true, (SaveType)1)
		{
			relicStates = new Dictionary<int, object>();
		}
	}
	public abstract class NoopTracker : Tracker
	{
		public override string Tooltip => null;

		public override object State
		{
			get
			{
				return null;
			}
			set
			{
			}
		}

		public override void Reset()
		{
		}

		public override void Used()
		{
		}
	}
	public abstract class TodoTracker : NoopTracker
	{
	}
	public abstract class SimpleCounter : Tracker
	{
		public int count;

		public virtual int Step => 1;

		public override object State
		{
			get
			{
				return count;
			}
			set
			{
				count = (int)value;
			}
		}

		public override void Reset()
		{
			count = 0;
			Updated();
		}

		public override void Used()
		{
			count += Step;
			Updated();
		}
	}
	public abstract class HealingCounter : SimpleCounter
	{
		protected bool _active;

		public override string Tooltip => $"{count} <style=heal>healed</style>";

		public override void Reset()
		{
			base.Reset();
			_active = false;
		}

		public override void Used()
		{
		}

		public virtual void Heal(float amount)
		{
			if (_active)
			{
				count += (int)amount;
				Updated();
			}
			_active = false;
		}
	}
	public abstract class SelfDamageCounter : SimpleCounter
	{
		protected bool _active;

		public override string Tooltip => $"{count} <style=damage>self-damage</style>";

		public override void Reset()
		{
			base.Reset();
			_active = false;
		}

		public override void Used()
		{
		}

		public virtual void SelfDamage(float amount)
		{
			if (_active)
			{
				count += (int)amount;
				Updated();
			}
			_active = false;
		}
	}
	public abstract class DamageCounter : Tracker
	{
		protected int goodCount;

		protected int badCount;

		public override object State
		{
			get
			{
				return (goodCount, badCount);
			}
			set
			{
				(goodCount, badCount) = ((int, int))value;
			}
		}

		public override string Tooltip
		{
			get
			{
				string text = $"{goodCount} <style=damage>damage added</style>";
				if (badCount > 0)
				{
					text = $"{text}; {badCount} <style=dmg_negative>damage removed</style>";
				}
				return text;
			}
		}

		public override void Reset()
		{
			goodCount = (badCount = 0);
			Updated();
		}

		public override void Used()
		{
		}

		public virtual void HandleFire(Attack attack, AttackManager attackManager, float[] dmgValues, float dmgMult, int dmgBonus, int critCount)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if (Tracker.HaveRelic(Relic))
			{
				float damage = attack.GetDamage(attackManager, dmgValues, dmgMult, dmgBonus, critCount, false);
				float baseDamage = GetBaseDamage(attack, attackManager, dmgValues, dmgMult, dmgBonus, critCount);
				if (damage > baseDamage)
				{
					goodCount += (int)(damage - baseDamage);
					Updated();
				}
				else if (damage < baseDamage)
				{
					badCount += (int)(baseDamage - damage);
					Updated();
				}
			}
		}

		public abstract float GetBaseDamage(Attack attack, AttackManager attackManager, float[] dmgValues, float dmgMult, int dmgBonus, int critCount);
	}
	public abstract class PegDamageCounter : DamageCounter
	{
		protected bool _active;

		private float _peg_count;

		private int _bonus_count;

		public virtual int Step => 1;

		public override void Reset()
		{
			base.Reset();
			_active = false;
			_peg_count = (_bonus_count = 0);
		}

		public override void Used()
		{
			_active = true;
		}

		public virtual void StartAddPeg()
		{
		}

		public virtual void AddPeg(float multiplier, int bonus)
		{
			if (_active)
			{
				_peg_count += multiplier;
				_bonus_count += bonus;
			}
			_active = false;
		}

		public override float GetBaseDamage(Attack attack, AttackManager attackManager, float[] dmgValues, float dmgMult, int dmgBonus, int critCount)
		{
			float[] array = new float[dmgValues.Length + 1];
			array = dmgValues.Append(0f - _peg_count).ToArray();
			float damage = attack.GetDamage(attackManager, array, dmgMult, dmgBonus - _bonus_count, critCount, false);
			_peg_count = (_bonus_count = 0);
			return damage;
		}
	}
	public abstract class OrbDamageCounter : DamageCounter
	{
		public override void Used()
		{
		}

		public override float GetBaseDamage(Attack attack, AttackManager attackManager, float[] dmgValues, float dmgMult, int dmgBonus, int critCount)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: 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)
			Dictionary<RelicEffect, Relic> attr = Refl<Dictionary<RelicEffect, Relic>>.GetAttr<RelicManager>(Utils.GetResource<RelicManager>(), "_ownedRelics");
			Relic value = attr[Relic];
			attr.Remove(Relic);
			float damage = attack.GetDamage(attackManager, dmgValues, dmgMult, dmgBonus, critCount, false);
			attr.Add(Relic, value);
			return damage;
		}
	}
	public abstract class MultDamageCounter : DamageCounter
	{
		protected bool _active;

		protected float _multiplier = 1f;

		public override void Reset()
		{
			base.Reset();
			_active = false;
			_multiplier = 1f;
		}

		public override void Used()
		{
			_active = true;
		}

		public virtual void AddDamageMultiplier(float mult)
		{
			if (_active)
			{
				_multiplier *= mult;
			}
			_active = false;
		}

		public override float GetBaseDamage(Attack attack, AttackManager attackManager, float[] dmgValues, float dmgMult, int dmgBonus, int critCount)
		{
			dmgMult /= _multiplier;
			_multiplier = 1f;
			return attack.GetDamage(attackManager, dmgValues, dmgMult, dmgBonus, critCount, false);
		}
	}
	public abstract class PegBuffDamageCounter : DamageCounter
	{
		protected Dictionary<int, int> _pegBuffs = new Dictionary<int, int>();

		protected int _bonus;

		public override void Reset()
		{
			base.Reset();
			NewBattle();
		}

		public void NewBattle()
		{
			_pegBuffs.Clear();
			_bonus = 0;
		}

		public void HandleHitPeg(Peg peg)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if (Tracker.HaveRelic(Relic) && _pegBuffs.ContainsKey(((Object)((Component)peg).gameObject).GetInstanceID()))
			{
				_bonus += (int)((float)_pegBuffs[((Object)((Component)peg).gameObject).GetInstanceID()] * peg.buffDamageMultiplier);
			}
		}

		public override float GetBaseDamage(Attack attack, AttackManager attackManager, float[] dmgValues, float dmgMult, int dmgBonus, int critCount)
		{
			dmgBonus -= _bonus;
			_bonus = 0;
			return attack.GetDamage(attackManager, dmgValues, dmgMult, dmgBonus, critCount, false);
		}
	}
	public abstract class DamageTargetedCounter : SimpleCounter
	{
		protected bool _active;

		public override string Tooltip => $"{count} <style=damage>damage dealt</style>";

		public override void Reset()
		{
			base.Reset();
			_active = false;
		}

		public override void Used()
		{
			_active = true;
		}

		public virtual void Damage(float amount)
		{
			if (_active)
			{
				count += (int)amount;
				Updated();
			}
			_active = false;
		}
	}
	public abstract class DamageAllCounter : SimpleCounter
	{
		protected bool _active;

		public override string Tooltip => $"{count} <style=damage>damage dealt</style>";

		public DamageAllCounter()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			Enemy.OnAllEnemiesDamaged = (DamageAllEnemies)Delegate.Combine((Delegate?)(object)Enemy.OnAllEnemiesDamaged, (Delegate?)new DamageAllEnemies(DamageAllEnemies));
		}

		public override void Reset()
		{
			base.Reset();
			_active = false;
		}

		public override void Used()
		{
			_active = true;
		}

		private void DamageAllEnemies(float damageAmount, EnemyDamageSource source = 0)
		{
			if (_active)
			{
				count += Utils.EnemyDamageCount() * (int)damageAmount;
				Updated();
			}
			_active = false;
		}
	}
	public abstract class StatusEffectCounter : SimpleCounter
	{
		protected bool _active;

		public abstract StatusEffectType type { get; }

		public override string Tooltip => $"{count} {Utils.TypeDesc(type)} added</style>";

		public override void Reset()
		{
			base.Reset();
			_active = false;
		}

		public override void Used()
		{
			_active = true;
		}

		public void ApplyStatusEffect(StatusEffect statusEffect)
		{
			//IL_0009: 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)
			if (_active && statusEffect.EffectType == type)
			{
				count += statusEffect.Intensity;
				Updated();
			}
			_active = false;
		}
	}
	public class Utils
	{
		public static T GetResource<T>() where T : Object
		{
			T[] array = Resources.FindObjectsOfTypeAll<T>();
			if (array.Length != 0)
			{
				return array[0];
			}
			return default(T);
		}

		public static TFld GetAttr<TObj, TFld>(TObj obj, string field)
		{
			return (TFld)typeof(TObj).GetField(field, BindingFlags.Instance | BindingFlags.NonPublic).GetValue(obj);
		}

		public static void SetAttr<TObj, TFld>(TObj obj, string field, TFld val)
		{
			typeof(TObj).GetField(field, BindingFlags.Instance | BindingFlags.NonPublic).SetValue(obj, val);
		}

		public static TFld GetStaticAttr<TObj, TFld>(string field)
		{
			return (TFld)typeof(TObj).GetField(field, BindingFlags.Static | BindingFlags.NonPublic).GetValue(null);
		}

		public static string Plural(int n, string ifplural = "s", string ifsingle = "")
		{
			if (n != 1)
			{
				return ifplural;
			}
			return ifsingle;
		}

		public static int EnemyDamageCount()
		{
			int num = 0;
			Delegate[] invocationList = ((Delegate)(object)Enemy.OnAllEnemiesDamaged).GetInvocationList();
			for (int i = 0; i < invocationList.Length; i++)
			{
				if (invocationList[i].Target is Enemy)
				{
					num++;
				}
			}
			return num;
		}

		public static string TypeDesc(StatusEffectType type)
		{
			//IL_0000: 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_0044: Expected I4, but got Unknown
			//IL_0044: 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_005d: Expected I4, but got Unknown
			switch (type - 1)
			{
			default:
				switch (type - 30)
				{
				case 0:
					return "<style=dodge>Ballusion";
				case 1:
					return "<style=dmg_limit>Intangiball";
				case 2:
					return "<style=exploitaball>Exploitaball";
				case 3:
					return "<style=transpherency>Transpherency";
				}
				break;
			case 0:
				return "<style=bramble>Bramble";
			case 1:
				return "<style=stunned>Stunned";
			case 2:
				return "<style=blind>Blind";
			case 3:
				return "<style=confuse>Confused";
			case 6:
				return "<style=damage>Reflect";
			case 7:
				return "<style=strength>Muscircle";
			case 8:
				return "<style=finesse>Spinesse";
			case 9:
				return "<style=balance>Ballance";
			case 10:
				return "<style=dexterity>Dexspherity";
			case 11:
				return "<style=shield>Ballwark";
			case 14:
				return "<style=poison>Spinfection";
			case 4:
			case 5:
			case 12:
			case 13:
				break;
			}
			return null;
		}
	}
	public class Refl<TFld>
	{
		public static TFld GetAttr<TObj>(TObj obj, string field)
		{
			return Utils.GetAttr<TObj, TFld>(obj, field);
		}

		public static void SetAttr<TObj>(TObj obj, string field, TFld val)
		{
			Utils.SetAttr(obj, field, val);
		}

		public static TFld GetStaticAttr<TObj>(string field)
		{
			return Utils.GetStaticAttr<TObj, TFld>(field);
		}
	}
	[HarmonyPatch]
	public class Hooks
	{
		private static int prevDamageAmountCount;

		private static int prevDamageBonus;

		private static bool _buildingRunSummary;

		[HarmonyPatch(typeof(GameInit), "Start")]
		[HarmonyPrefix]
		private static void StartGame(GameInit __instance)
		{
			Plugin.Logger.LogInfo((object)"New game, resetting all counters");
			Tracker.ResetAll();
		}

		[HarmonyPatch(typeof(RunSummary), "LoadMainMenu")]
		[HarmonyPrefix]
		private static void EndGame(GameInit __instance)
		{
			Plugin.Logger.LogInfo((object)"Game over, resetting all counters");
			Tracker.ResetAll();
		}

		[HarmonyPatch(typeof(RelicManager), "AddRelic")]
		[HarmonyPostfix]
		private static void AddRelic(Relic relic)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			Tracker.AddRelic(relic.effect, isNew: true);
		}

		[HarmonyPatch(typeof(RelicManager), "LoadRelicFromSaveFile")]
		[HarmonyPostfix]
		private static void AddRelicFromSave(Relic relic)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			Tracker.AddRelic(relic.effect, isNew: false);
		}

		[HarmonyPatch(typeof(RelicManager), "LoadRelicData")]
		[HarmonyPostfix]
		private static void LoadRelicData()
		{
			Plugin.Logger.LogInfo((object)"Loading relic state");
			Tracker.LoadData();
		}

		[HarmonyPatch(typeof(RelicManager), "SaveRelicData")]
		[HarmonyPostfix]
		private static void SaveRelicData()
		{
			Plugin.Logger.LogInfo((object)"Saving relic state");
			Tracker.SaveData();
		}

		[HarmonyPatch(typeof(RelicManager), "AttemptUseRelic")]
		[HarmonyPostfix]
		private static void RelicUsed(RelicEffect re, bool __result)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			if (__result)
			{
				Tracker value = null;
				if (Tracker.trackers.TryGetValue(re, out value))
				{
					value.Used();
				}
			}
		}

		[HarmonyPatch(typeof(RelicManager), "FlashRelic")]
		[HarmonyPostfix]
		private static void RelicFlashed(RelicEffect re)
		{
			//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)
			if (Tracker.HaveRelic(re))
			{
				Tracker value = null;
				if (Tracker.trackers.TryGetValue(re, out value))
				{
					value.Flash();
				}
			}
		}

		[HarmonyPatch(typeof(RelicManager), "RelicEffectActive")]
		[HarmonyPostfix]
		private static void RelicChecked(RelicEffect re, bool __result)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			if (__result)
			{
				Tracker value = null;
				if (Tracker.trackers.TryGetValue(re, out value))
				{
					value.Checked();
				}
			}
		}

		[HarmonyPatch(typeof(TargetedAttack), "Fire")]
		[HarmonyPrefix]
		private static void FireTargeted(TargetedAttack __instance, AttackManager attackManager, float[] dmgValues, float dmgMult, int dmgBonus, int critCount)
		{
			HandleFire((Attack)(object)__instance, attackManager, dmgValues, dmgMult, dmgBonus, critCount);
		}

		[HarmonyPatch(typeof(ProjectileAttack), "Fire")]
		[HarmonyPrefix]
		private static void FireProjectile(ProjectileAttack __instance, AttackManager attackManager, float[] dmgValues, float dmgMult, int dmgBonus, int critCount)
		{
			HandleFire((Attack)(object)__instance, attackManager, dmgValues, dmgMult, dmgBonus, critCount);
		}

		private static void HandleFire(Attack __instance, AttackManager attackManager, float[] dmgValues, float dmgMult, int dmgBonus, int critCount)
		{
			foreach (Tracker value in Tracker.trackers.Values)
			{
				if (value is DamageCounter damageCounter)
				{
					damageCounter.HandleFire(__instance, attackManager, dmgValues, dmgMult, dmgBonus, critCount);
				}
			}
		}

		[HarmonyPatch(typeof(BattleController), "AddDamageMultiplier")]
		[HarmonyPostfix]
		private static void AddDamageMultiplier(float mult)
		{
			foreach (Tracker value in Tracker.trackers.Values)
			{
				if (value is MultDamageCounter multDamageCounter)
				{
					multDamageCounter.AddDamageMultiplier(mult);
				}
			}
		}

		[HarmonyPatch(typeof(BattleController), "AddPeg")]
		[HarmonyPrefix]
		private static void AddPegPre(BattleController __instance)
		{
			prevDamageAmountCount = __instance.damageAmounts.Count;
			prevDamageBonus = Refl<int>.GetAttr<BattleController>(__instance, "_damageBonus");
			foreach (Tracker value in Tracker.trackers.Values)
			{
				if (value is PegDamageCounter pegDamageCounter)
				{
					pegDamageCounter.StartAddPeg();
				}
			}
		}

		[HarmonyPatch(typeof(BattleController), "AddPeg")]
		[HarmonyPostfix]
		private static void AddPegPost(BattleController __instance)
		{
			float num = 0f;
			for (int i = prevDamageAmountCount; i < __instance.damageAmounts.Count; i++)
			{
				num += __instance.damageAmounts[i];
			}
			int attr = Refl<int>.GetAttr<BattleController>(__instance, "_damageBonus");
			attr -= prevDamageBonus;
			foreach (Tracker value in Tracker.trackers.Values)
			{
				if (value is PegDamageCounter pegDamageCounter)
				{
					pegDamageCounter.AddPeg(num, attr);
				}
			}
		}

		[HarmonyPatch(typeof(BattleController), "GrantAdditionalBasicPeg")]
		[HarmonyPrefix]
		private static void GrantAdditionalBasicPegPre(BattleController __instance)
		{
			AddPegPre(__instance);
		}

		[HarmonyPatch(typeof(BattleController), "GrantAdditionalBasicPeg")]
		[HarmonyPostfix]
		private static void GrantAdditionalBasicPegPost(BattleController __instance)
		{
			AddPegPost(__instance);
		}

		[HarmonyPatch(typeof(PlayerHealthController), "Heal")]
		[HarmonyPostfix]
		private static void Heal(float amount, float __result)
		{
			foreach (Tracker value in Tracker.trackers.Values)
			{
				if (value is HealingCounter healingCounter)
				{
					healingCounter.Heal(__result);
				}
			}
		}

		[HarmonyPatch(typeof(PlayerHealthController), "DealSelfDamage")]
		[HarmonyPrefix]
		private static void SelfDamage(float damage)
		{
			foreach (Tracker value in Tracker.trackers.Values)
			{
				if (value is SelfDamageCounter selfDamageCounter)
				{
					selfDamageCounter.SelfDamage(damage);
				}
				if (value is WandOfSkulltimateWrath wandOfSkulltimateWrath)
				{
					wandOfSkulltimateWrath.SelfDamage(damage);
				}
			}
		}

		[HarmonyPatch(typeof(Attack), "GetStatusEffects")]
		[HarmonyPostfix]
		public static void AttackEffects(List<StatusEffect> __result)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Invalid comparison between Unknown and I4
			//IL_003c: 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)
			foreach (StatusEffect item in __result)
			{
				RelicEffect? val = (((int)item.EffectType != 3) ? null : new RelicEffect?((RelicEffect)44));
				RelicEffect? val2 = val;
				if (val2.HasValue && Tracker.HaveRelic(val2.Value))
				{
					((SimpleCounter)Tracker.trackers[val2.Value]).count += item.Intensity;
				}
			}
		}

		[HarmonyPatch(typeof(TargetingManager), "AttemptDamageTargetedEnemy")]
		[HarmonyPostfix]
		private static void Damage(float damage, bool __result)
		{
			if (!__result)
			{
				return;
			}
			foreach (Tracker value in Tracker.trackers.Values)
			{
				if (value is DamageTargetedCounter damageTargetedCounter)
				{
					damageTargetedCounter.Damage(damage);
				}
				if (value is InfernalIngot infernalIngot)
				{
					infernalIngot.Damage(damage);
				}
			}
		}

		[HarmonyPatch(typeof(PlayerStatusEffectController), "ApplyStatusEffect")]
		[HarmonyPrefix]
		private static void ApplyStatusEffect(StatusEffect statusEffect)
		{
			foreach (Tracker value in Tracker.trackers.Values)
			{
				if (value is StatusEffectCounter statusEffectCounter)
				{
					statusEffectCounter.ApplyStatusEffect(statusEffect);
				}
			}
			((RefresherCourse)Tracker.trackers[(RelicEffect)91]).ApplyStatusEffect(statusEffect);
		}

		[HarmonyPatch(typeof(RunStatisticsDetails), "CreateRelics")]
		[HarmonyPrefix]
		private static void SetupRelicsPre()
		{
			//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)
			Scene activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name == "RunSummary")
			{
				_buildingRunSummary = true;
			}
		}

		[HarmonyPatch(typeof(RunStatisticsDetails), "CreateRelics")]
		[HarmonyPostfix]
		private static void SetupRelicsPost()
		{
			_buildingRunSummary = false;
		}

		[HarmonyPatch(typeof(LoadoutIcon), "InitializeRelic")]
		[HarmonyPostfix]
		private static void FixRelicIcon(LoadoutIcon __instance)
		{
			if (_buildingRunSummary)
			{
				if ((Object)(object)__instance.text != (Object)null)
				{
					Object.Destroy((Object)(object)__instance.text);
					__instance.text = null;
				}
				MouseOverDetectorPointerHandler component = ((Component)__instance).GetComponent<MouseOverDetectorPointerHandler>();
				SelectionEventListener component2 = ((Component)__instance).GetComponent<SelectionEventListener>();
				if ((Object)(object)component == (Object)null)
				{
					((Component)__instance).gameObject.AddComponent<MouseOverDetectorPointerHandler>();
				}
				if ((Object)(object)component2 == (Object)null)
				{
					((Component)__instance).gameObject.AddComponent<SelectionEventListener>();
				}
				if ((Object)(object)component == (Object)null || (Object)(object)component2 == (Object)null)
				{
					__instance.SetupTooltipEventsRelic();
				}
			}
		}

		[HarmonyPatch(typeof(PegManager), "InitializePegs")]
		[HarmonyPostfix]
		private static void NewBattle()
		{
			((SlimySalve)Tracker.trackers[(RelicEffect)48]).NewBattle();
			((GloriousSuffeRing)Tracker.trackers[(RelicEffect)61]).NewBattle();
			((EndlessDevouRing)Tracker.trackers[(RelicEffect)154]).NewBattle();
			foreach (Tracker value in Tracker.trackers.Values)
			{
				if (value is PegBuffDamageCounter pegBuffDamageCounter)
				{
					pegBuffDamageCounter.NewBattle();
				}
			}
		}

		[HarmonyPatch(typeof(Peg), "CheckForRelicBuff")]
		[HarmonyPrefix]
		private static void RelicBuff(Peg __instance)
		{
			((GloriousSuffeRing)Tracker.trackers[(RelicEffect)61]).HandleRelicBuff(__instance);
			((EndlessDevouRing)Tracker.trackers[(RelicEffect)154]).HandleRelicBuff(__instance);
		}

		[HarmonyPatch(typeof(BattleController), "HandlePegActivated")]
		[HarmonyPrefix]
		private static void HitPeg(Peg peg)
		{
			((GloriousSuffeRing)Tracker.trackers[(RelicEffect)61]).HandleHitPeg(peg);
			((EndlessDevouRing)Tracker.trackers[(RelicEffect)154]).HandleHitPeg(peg);
			foreach (Tracker value in Tracker.trackers.Values)
			{
				if (value is PegBuffDamageCounter pegBuffDamageCounter)
				{
					pegBuffDamageCounter.HandleHitPeg(peg);
				}
			}
		}
	}
	[HarmonyPatch]
	public class Transpilers
	{
		public static int? IsLoadArg(CodeInstruction op)
		{
			if (op.opcode == OpCodes.Ldarg_0)
			{
				return 0;
			}
			if (op.opcode == OpCodes.Ldarg_1)
			{
				return 1;
			}
			if (op.opcode == OpCodes.Ldarg_2)
			{
				return 2;
			}
			if (op.opcode == OpCodes.Ldarg_3)
			{
				return 3;
			}
			if (op.opcode == OpCodes.Ldarg)
			{
				return (int?)op.operand;
			}
			if (op.opcode == OpCodes.Ldarg_S)
			{
				return (byte?)op.operand;
			}
			return null;
		}

		public static int? IsLoadLoc(CodeInstruction op)
		{
			if (op.opcode == OpCodes.Ldloc_0)
			{
				return 0;
			}
			if (op.opcode == OpCodes.Ldloc_1)
			{
				return 1;
			}
			if (op.opcode == OpCodes.Ldloc_2)
			{
				return 2;
			}
			if (op.opcode == OpCodes.Ldloc_3)
			{
				return 3;
			}
			if (op.opcode == OpCodes.Ldloc)
			{
				return (int?)op.operand;
			}
			if (op.opcode == OpCodes.Ldloc_S)
			{
				return (byte?)op.operand;
			}
			return null;
		}

		public static bool IsLoad(CodeInstruction op)
		{
			if (!IsLoadArg(op).HasValue)
			{
				return IsLoadLoc(op).HasValue;
			}
			return true;
		}

		public static int? IsStoreArg(CodeInstruction op)
		{
			if (op.opcode == OpCodes.Starg)
			{
				return (int?)op.operand;
			}
			if (op.opcode == OpCodes.Starg_S)
			{
				return (byte?)op.operand;
			}
			return null;
		}

		public static int? IsStoreLoc(CodeInstruction op)
		{
			if (op.opcode == OpCodes.Stloc_0)
			{
				return 0;
			}
			if (op.opcode == OpCodes.Stloc_1)
			{
				return 1;
			}
			if (op.opcode == OpCodes.Stloc_2)
			{
				return 2;
			}
			if (op.opcode == OpCodes.Stloc_3)
			{
				return 3;
			}
			if (op.opcode == OpCodes.Stloc)
			{
				return (int?)op.operand;
			}
			if (op.opcode == OpCodes.Stloc_S)
			{
				return (byte?)op.operand;
			}
			return null;
		}

		public static bool IsStore(CodeInstruction op)
		{
			if (!IsStoreArg(op).HasValue)
			{
				return IsStoreLoc(op).HasValue;
			}
			return true;
		}

		public static CodeInstruction MakeLoadArg(int arg)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			if (arg != 0)
			{
				if (arg != 1)
				{
					if (arg != 2)
					{
						if (arg != 3)
						{
							if (arg >= 0 && arg < 256)
							{
								return new CodeInstruction(OpCodes.Ldarg_S, (object)(byte)arg);
							}
							return new CodeInstruction(OpCodes.Ldarg, (object)arg);
						}
						return new CodeInstruction(OpCodes.Ldarg_3, (object)null);
					}
					return new CodeInstruction(OpCodes.Ldarg_2, (object)null);
				}
				return new CodeInstruction(OpCodes.Ldarg_1, (object)null);
			}
			return new CodeInstruction(OpCodes.Ldarg_0, (object)null);
		}

		public static CodeInstruction MakeLoadLoc(int loc)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			if (loc != 0)
			{
				if (loc != 1)
				{
					if (loc != 2)
					{
						if (loc != 3)
						{
							if (loc >= 0 && loc < 256)
							{
								return new CodeInstruction(OpCodes.Ldloc_S, (object)(byte)loc);
							}
							return new CodeInstruction(OpCodes.Ldloc, (object)loc);
						}
						return new CodeInstruction(OpCodes.Ldloc_3, (object)null);
					}
					return new CodeInstruction(OpCodes.Ldloc_2, (object)null);
				}
				return new CodeInstruction(OpCodes.Ldloc_1, (object)null);
			}
			return new CodeInstruction(OpCodes.Ldloc_0, (object)null);
		}

		public static CodeInstruction LoadFromStore(CodeInstruction op)
		{
			int? num = IsStoreArg(op);
			if (num.HasValue)
			{
				return MakeLoadArg(num.Value);
			}
			num = IsStoreLoc(op);
			if (num.HasValue)
			{
				return MakeLoadLoc(num.Value);
			}
			return null;
		}

		public static FieldInfo IsLoadField(CodeInstruction op)
		{
			if (op.opcode == OpCodes.Ldfld)
			{
				return (FieldInfo)op.operand;
			}
			return null;
		}

		public static MethodInfo IsCallMethod(CodeInstruction op)
		{
			if (op.opcode == OpCodes.Call)
			{
				return (MethodInfo)op.operand;
			}
			if (op.opcode == OpCodes.Callvirt)
			{
				return (MethodInfo)op.operand;
			}
			return null;
		}

		public static int? IsLoadConstInt(CodeInstruction op)
		{
			if (op.opcode == OpCodes.Ldc_I4_0)
			{
				return 0;
			}
			if (op.opcode == OpCodes.Ldc_I4_1)
			{
				return 1;
			}
			if (op.opcode == OpCodes.Ldc_I4_2)
			{
				return 2;
			}
			if (op.opcode == OpCodes.Ldc_I4_3)
			{
				return 3;
			}
			if (op.opcode == OpCodes.Ldc_I4_4)
			{
				return 4;
			}
			if (op.opcode == OpCodes.Ldc_I4_5)
			{
				return 5;
			}
			if (op.opcode == OpCodes.Ldc_I4_6)
			{
				return 6;
			}
			if (op.opcode == OpCodes.Ldc_I4_7)
			{
				return 7;
			}
			if (op.opcode == OpCodes.Ldc_I4_8)
			{
				return 8;
			}
			if (op.opcode == OpCodes.Ldc_I4_M1)
			{
				return -1;
			}
			if (op.opcode == OpCodes.Ldc_I4)
			{
				return (int?)op.operand;
			}
			if (op.opcode == OpCodes.Ldc_I4_S)
			{
				return (sbyte?)op.operand;
			}
			return null;
		}

		public static float? IsLoadConstFloat(CodeInstruction op)
		{
			if (op.opcode == OpCodes.Ldc_R4)
			{
				return (float?)op.operand;
			}
			return null;
		}

		public static bool IsBranchFalse(CodeInstruction op)
		{
			if (op.opcode == OpCodes.Brfalse)
			{
				return true;
			}
			if (op.opcode == OpCodes.Brfalse_S)
			{
				return true;
			}
			return false;
		}

		public static CodeInstruction MakeCall(MethodInfo func)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			return new CodeInstruction(OpCodes.Call, (object)func);
		}

		[HarmonyPatch(typeof(PlayerHealthController), "Damage")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> PlayerDamagePatcher(IEnumerable<CodeInstruction> origCode)
		{
			//IL_05fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0605: Expected O, but got Unknown
			//IL_07b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_07bb: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(origCode);
			bool flag = false;
			bool flag2 = false;
			bool flag3 = false;
			bool flag4 = false;
			bool flag5 = false;
			for (int i = 0; i < list.Count; i++)
			{
				if (IsLoadArg(list[i]) == 0 && IsLoadField(list[i + 1])?.Name == "_relicManager" && IsLoadConstInt(list[i + 2]) == 11 && IsCallMethod(list[i + 3])?.Name == "AttemptUseRelic" && IsBranchFalse(list[i + 4]) && IsLoadConstFloat(list[i + 5]) == 0f && IsStore(list[i + 6]))
				{
					CodeInstruction val = LoadFromStore(list[i + 6]);
					CodeInstruction item = MakeCall(typeof(Transpilers).GetMethod("NoDamageOnReload"));
					if (list[i + 5].labels.Count > 0)
					{
						val.labels = list[i + 5].labels;
						list[i + 5].labels = new List<Label>();
					}
					list.Insert(i + 5, item);
					list.Insert(i + 5, val);
					i += 6;
					flag = true;
				}
				else if (IsLoadArg(list[i]) == 0 && IsLoadField(list[i + 1])?.Name == "_relicManager" && IsLoadConstInt(list[i + 2]) == 76 && IsCallMethod(list[i + 3])?.Name == "AttemptUseRelic" && IsBranchFalse(list[i + 4]) && IsLoadConstFloat(list[i + 5]) == 0f && IsStore(list[i + 6]))
				{
					CodeInstruction val2 = LoadFromStore(list[i + 6]);
					CodeInstruction item2 = MakeCall(typeof(Transpilers).GetMethod("PreventFirstDamage"));
					if (list[i + 5].labels.Count > 0)
					{
						val2.labels = list[i + 5].labels;
						list[i + 5].labels = new List<Label>();
					}
					list.Insert(i + 5, item2);
					list.Insert(i + 5, val2);
					i += 6;
					flag2 = true;
				}
				else if (IsLoadArg(list[i]) == 0 && IsLoadField(list[i + 1])?.Name == "_relicManager" && IsLoadConstInt(list[i + 2]) == 109 && IsCallMethod(list[i + 3])?.Name == "AttemptUseRelic" && IsBranchFalse(list[i + 4]) && IsLoadConstFloat(list[i + 5]) == 0f && IsStore(list[i + 6]))
				{
					CodeInstruction val3 = LoadFromStore(list[i + 6]);
					CodeInstruction item3 = MakeCall(typeof(Transpilers).GetMethod("PreventLethalDamage"));
					if (list[i + 5].labels.Count > 0)
					{
						val3.labels = list[i + 5].labels;
						list[i + 5].labels = new List<Label>();
					}
					list.Insert(i + 5, item3);
					list.Insert(i + 5, val3);
					i += 6;
					flag3 = true;
				}
				else if (IsLoadArg(list[i]) == 0 && IsLoadField(list[i + 1])?.Name == "_relicManager" && IsLoadConstInt(list[i + 2]) == 177 && IsCallMethod(list[i + 3])?.Name == "AttemptUseRelic" && IsBranchFalse(list[i + 4]) && IsLoad(list[i + 5]) && IsLoadConstFloat(list[i + 6]) == 2f && list[i + 7].opcode == OpCodes.Div)
				{
					CodeInstruction item4 = new CodeInstruction(OpCodes.Dup, (object)null);
					CodeInstruction item5 = MakeCall(typeof(Transpilers).GetMethod("HalveDamage"));
					list.Insert(i + 8, item5);
					list.Insert(i + 8, item4);
					i += 8;
					flag4 = true;
				}
				else if (IsLoadArg(list[i]) == 0 && IsLoadField(list[i + 1])?.Name == "_relicManager" && IsLoadConstInt(list[i + 2]) == 115 && IsCallMethod(list[i + 3])?.Name == "AttemptUseRelic" && IsBranchFalse(list[i + 4]) && IsLoadArg(list[i + 5]).HasValue && IsLoadArg(list[i + 6]) == 0 && IsLoadField(list[i + 7])?.Name == "_armour" && IsLoadConstFloat(list[i + 8]).HasValue && list[i + 9].opcode == OpCodes.Mul)
				{
					CodeInstruction item6 = new CodeInstruction(OpCodes.Dup, (object)null);
					CodeInstruction item7 = MakeCall(typeof(Transpilers).GetMethod("BallwarkCounter"));
					list.Insert(i + 10, item7);
					list.Insert(i + 10, item6);
					i += 10;
					flag5 = true;
				}
			}
			if (!flag)
			{
				Plugin.Logger.LogError((object)"Couldn't find Round Guard code in PlayerHealthController.Damage");
				return null;
			}
			if (!flag2)
			{
				Plugin.Logger.LogError((object)"Couldn't find Puppet code in PlayerHealthController.Damage");
				return null;
			}
			if (!flag3)
			{
				Plugin.Logger.LogError((object)"Couldn't find Sash of Focus code in PlayerHealthController.Damage");
				return null;
			}
			if (!flag4)
			{
				Plugin.Logger.LogError((object)"Couldn't find Torn Sash code in PlayerHealthController.Damage");
				return null;
			}
			if (!flag5)
			{
				Plugin.Logger.LogError((object)"Couldn't find Ripostal Service code in PlayerHealthController.Damage");
				return null;
			}
			list.Insert(0, MakeCall(typeof(Transpilers).GetMethod("DamagePre")));
			return list;
		}

		public static void DamagePre()
		{
			((RoundGuard)Tracker.trackers[(RelicEffect)11]).Disable();
			((SeraphicShield)Tracker.trackers[(RelicEffect)95]).Disable();
		}

		public static void NoDamageOnReload(float amount)
		{
			((RoundGuard)Tracker.trackers[(RelicEffect)11]).DamageAvoided(amount);
			((SeraphicShield)Tracker.trackers[(RelicEffect)95]).DamageAvoided(amount);
		}

		public static void PreventFirstDamage(float amount)
		{
			((Puppet)Tracker.trackers[(RelicEffect)76]).DamageAvoided(amount);
		}

		public static void PreventLethalDamage(float amount)
		{
			((SashOfFocus)Tracker.trackers[(RelicEffect)109]).DamageAvoided(amount);
		}

		public static void HalveDamage(float amount)
		{
			((TornSash)Tracker.trackers[(RelicEffect)177]).DamageAvoided(amount);
		}

		public static void BallwarkCounter(float amount)
		{
			((RipostalService)Tracker.trackers[(RelicEffect)115]).Damage(amount);
		}
	}
	[BepInPlugin("com.mrphlip.peglin.RelicStats", "Relic Stats", "1.0.1")]
	[BepInProcess("Peglin.exe")]
	[HarmonyPatch]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("com.mrphlip.peglin.RelicStats");

		internal static ManualLogSource Logger;

		private static Tooltip _activeTooltip;

		private static string _baseTooltip;

		private static RelicEffect? _activeRelic;

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Tracker.PopulateTrackers();
			harmony.PatchAll();
			Logger.LogInfo((object)"Plugin com.mrphlip.peglin.RelicStats is loaded!");
		}

		[HarmonyPatch(typeof(Tooltip), "Initialize", new Type[] { typeof(Relic) })]
		[HarmonyPostfix]
		private static void PatchTooltipInitPost(Tooltip __instance, Relic relic)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			if (Tracker.HaveRelic(relic.effect))
			{
				_activeTooltip = __instance;
				_activeRelic = relic.effect;
				_baseTooltip = ((TMP_Text)__instance.descriptionText).text;
				Localize component = ((Component)__instance.descriptionText).GetComponent<Localize>();
				component.mTerm = null;
				component.mTermSecondary = null;
				component.FinalTerm = null;
				component.FinalSecondaryTerm = null;
				UpdateTooltip(relic.effect);
			}
		}

		[HarmonyPatch(typeof(TooltipManager), "HideTooltip")]
		[HarmonyPrefix]
		private static void HideTooltip()
		{
			_activeTooltip = null;
			_activeRelic = null;
			_baseTooltip = null;
		}

		public static void UpdateTooltip(RelicEffect relic)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if ((RelicEffect?)relic != _activeRelic)
			{
				return;
			}
			Tracker value = null;
			if (Tracker.trackers.TryGetValue(relic, out value))
			{
				string tooltip = value.Tooltip;
				if (string.IsNullOrEmpty(tooltip))
				{
					((TMP_Text)_activeTooltip.descriptionText).text = _baseTooltip;
				}
				else
				{
					((TMP_Text)_activeTooltip.descriptionText).text = _baseTooltip + "\n<sprite name=\"BULLET\"><indent=8%>" + tooltip + "</indent>";
				}
			}
		}
	}
	public class ConsolationPrize : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)0;

		public override string Tooltip
		{
			get
			{
				count++;
				return $"{count} time{Utils.Plural(count)} consoled";
			}
		}

		public override void Used()
		{
		}
	}
	public class EnhancedGunpowder : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)1;

		public override string Tooltip => $"{count} <sprite name=\"BOMB\"> exploded";
	}
	public class AlchemistCookbook : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)2;

		public override string Tooltip => $"{count} <sprite name=\"BOMB_REGULAR\"> created";
	}
	[HarmonyPatch]
	public class Cookie : HealingCounter
	{
		public override RelicEffect Relic => (RelicEffect)3;

		[HarmonyPatch(typeof(PlayerHealthController), "CheckForRelicOnRefreshPotion")]
		[HarmonyPrefix]
		private static void Enable()
		{
			((Cookie)Tracker.trackers[(RelicEffect)3])._active = true;
		}

		[HarmonyPatch(typeof(PlayerHealthController), "CheckForRelicOnRefreshPotion")]
		[HarmonyPostfix]
		private static void Disable()
		{
			((Cookie)Tracker.trackers[(RelicEffect)3])._active = false;
		}
	}
	[HarmonyPatch]
	public class WellDoneSteak : HealingCounter
	{
		public override RelicEffect Relic => (RelicEffect)4;

		[HarmonyPatch(typeof(PlayerHealthController), "CheckForRelicOnReload")]
		[HarmonyPrefix]
		private static void Enable()
		{
			((WellDoneSteak)Tracker.trackers[(RelicEffect)4])._active = true;
		}

		[HarmonyPatch(typeof(PlayerHealthController), "CheckForRelicOnReload")]
		[HarmonyPostfix]
		private static void Disable()
		{
			((WellDoneSteak)Tracker.trackers[(RelicEffect)4])._active = false;
		}
	}
	public class BagOfOrangePegs : MultDamageCounter
	{
		public override RelicEffect Relic => (RelicEffect)5;
	}
	public class LightShaftPotion : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)6;

		public override string Tooltip => $"{count} <sprite name=\"REFRESH_PEG\"> crits";
	}
	public class HeavyShaftPotion : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)7;

		public override string Tooltip => $"{count} <sprite name=\"CRIT_PEG\"> refreshes";
	}
	public class WeightedChip : MultDamageCounter
	{
		public override RelicEffect Relic => (RelicEffect)8;
	}
	public class OldSaltShaker : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)9;

		public override int Step => 10;

		public override string Tooltip => $"{count} <style=damage>damage added</style>";
	}
	public class GiftThatKeepsGiving : NoopTracker
	{
		public override RelicEffect Relic => (RelicEffect)10;
	}
	public class RoundGuard : SimpleCounter
	{
		private bool _active;

		public override RelicEffect Relic => (RelicEffect)11;

		public override string Tooltip => $"{count} <style=damage>damage avoided</style>";

		public override void Reset()
		{
			base.Reset();
			_active = false;
		}

		public void Disable()
		{
			_active = false;
		}

		public override void Used()
		{
			_active = true;
		}

		public void DamageAvoided(float damage)
		{
			if (_active)
			{
				count += (int)damage;
				Updated();
			}
			_active = false;
		}
	}
	[HarmonyPatch]
	public class Refillibuster : DamageAllCounter
	{
		public override RelicEffect Relic => (RelicEffect)12;

		[HarmonyPatch(typeof(PegManager), "ResetPegs")]
		[HarmonyPostfix]
		private static void AfterResetPegs()
		{
			((Refillibuster)Tracker.trackers[(RelicEffect)12])._active = false;
		}
	}
	[HarmonyPatch]
	public class MatryoshkaDoll : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)13;

		public override string Tooltip => $"{count} orb{Utils.Plural(count)} duplicated";

		public override void Used()
		{
		}

		[HarmonyPatch(typeof(BattleController), "ArmBallForShot")]
		[HarmonyPostfix]
		private static void ArmOrb()
		{
			if (Tracker.HaveRelic((RelicEffect)13))
			{
				MatryoshkaDoll obj = (MatryoshkaDoll)Tracker.trackers[(RelicEffect)13];
				obj.count++;
				obj.Updated();
			}
		}
	}
	[HarmonyPatch]
	public class Recombombulator : SimpleCounter
	{
		private bool _active;

		public override RelicEffect Relic => (RelicEffect)14;

		public override string Tooltip => $"{count} <sprite name=\"BOMB_REGULAR\"> refreshed";

		public override void Reset()
		{
			base.Reset();
			_active = false;
		}

		public override void Used()
		{
			_active = true;
		}

		[HarmonyPatch(typeof(Bomb), "Reset", new Type[] { })]
		[HarmonyPostfix]
		private static void ResetBomb()
		{
			Recombombulator recombombulator = (Recombombulator)Tracker.trackers[(RelicEffect)14];
			if (recombombulator._active)
			{
				recombombulator.count++;
				recombombulator.Updated();
			}
		}

		[HarmonyPatch(typeof(PegManager), "ResetPegs")]
		[HarmonyPostfix]
		private static void EndResetPegs()
		{
			((Recombombulator)Tracker.trackers[(RelicEffect)14])._active = false;
		}
	}
	public class ShortFuse : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)15;

		public override string Tooltip => $"{count} <sprite name=\"BOMB\"> exploded";
	}
	[HarmonyPatch]
	public class StrangeBrew : PegDamageCounter
	{
		public override RelicEffect Relic => (RelicEffect)16;

		[HarmonyPatch(typeof(BattleController), "HandlePegActivated")]
		[HarmonyPrefix]
		private static void Disable()
		{
			((StrangeBrew)Tracker.trackers[(RelicEffect)16])._active = false;
		}
	}
	public class LuckyPenny : NoopTracker
	{
		public override RelicEffect Relic => (RelicEffect)17;
	}
	public class ThreeExtraCrits : NoopTracker
	{
		public override RelicEffect Relic => (RelicEffect)18;
	}
	[HarmonyPatch]
	public class RefreshingPunch : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)19;

		public override string Tooltip => $"{count} <sprite name=\"REFRESH_PEG\"> exploded";

		public override void Used()
		{
		}

		[HarmonyPatch(typeof(Peg), "RefreshSplash")]
		[HarmonyPostfix]
		private static void RefreshSplashPre()
		{
			RefreshingPunch obj = (RefreshingPunch)Tracker.trackers[(RelicEffect)19];
			obj.count++;
			obj.Updated();
		}
	}
	public class PegBag : NoopTracker
	{
		public override RelicEffect Relic => (RelicEffect)20;
	}
	public class ThreeExtraRefresh : NoopTracker
	{
		public override RelicEffect Relic => (RelicEffect)21;
	}
	public class EvadeChance : NoopTracker
	{
		public override RelicEffect Relic => (RelicEffect)22;
	}
	public class Apple : NoopTracker
	{
		public override RelicEffect Relic => (RelicEffect)23;
	}
	public class WallChicken : NoopTracker
	{
		public override RelicEffect Relic => (RelicEffect)24;
	}
	public class PowerGlove : OrbDamageCounter
	{
		public override RelicEffect Relic => (RelicEffect)25;
	}
	public class Ambidexionary : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)26;

		public override string Tooltip => $"{count} extra discard{Utils.Plural(count)} used";

		public Ambidexionary()
		{
			BattleController.OnOrbDiscarded = (Action)Delegate.Combine(BattleController.OnOrbDiscarded, new Action(OrbDiscarded));
		}

		public override void Used()
		{
		}

		public void OrbDiscarded()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if (Tracker.HaveRelic(Relic))
			{
				BattleController resource = Utils.GetResource<BattleController>();
				if (resource.NumShotsDiscarded == resource.MaxDiscardedShots)
				{
					count++;
					Updated();
				}
			}
		}
	}
	public class DecoyOrb : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)27;

		public override string Tooltip => $"{count} free reload{Utils.Plural(count)}";
	}
	public class KineticMeteorite : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)28;

		public override string Tooltip => $"{count} explosive force{Utils.Plural(count)}";
	}
	public class Pocketwatch : PegDamageCounter
	{
		public override RelicEffect Relic => (RelicEffect)29;
	}
	public class ImprovedCatalyst : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)30;

		public override int Step => (int)((float)Utils.EnemyDamageCount() * 10f);

		public override string Tooltip => $"{count} <style=damage>damage added</style>";
	}
	public class AmbiguousAmulet : PegDamageCounter
	{
		public override RelicEffect Relic => (RelicEffect)31;
	}
	public class CursedMask : OrbDamageCounter
	{
		public override RelicEffect Relic => (RelicEffect)32;
	}
	[HarmonyPatch]
	public class SealedConviction : SimpleCounter
	{
		private bool _active;

		public override RelicEffect Relic => (RelicEffect)33;

		public override int Step => RelicManager.SEALED_CONVICTION_BALLANCE;

		public override string Tooltip => $"{count} <style=balance>ballance added</style>";

		public override void Reset()
		{
			base.Reset();
			_active = false;
		}

		public override void Used()
		{
			if (_active)
			{
				count += Step;
				Updated();
			}
		}

		[HarmonyPatch(typeof(PlayerStatusEffectController), "ApplyStartingBonuses")]
		[HarmonyPrefix]
		private static void BattleStartPre()
		{
			((SealedConviction)Tracker.trackers[(RelicEffect)33])._active = true;
		}

		[HarmonyPatch(typeof(PlayerStatusEffectController), "ApplyStartingBonuses")]
		[HarmonyPostfix]
		private static void BattleStartPost()
		{
			((SealedConviction)Tracker.trackers[(RelicEffect)33])._active = false;
		}

		[HarmonyPatch(typeof(BattleController), "ShuffleDeck")]
		[HarmonyPrefix]
		private static void ReloadPre()
		{
			((SealedConviction)Tracker.trackers[(RelicEffect)33])._active = true;
		}

		[HarmonyPatch(typeof(BattleController), "ShuffleDeck")]
		[HarmonyPostfix]
		private static void ReloadPost()
		{
			((SealedConviction)Tracker.trackers[(RelicEffect)33])._active = false;
		}
	}
	public class Electropegnet : NoopTracker
	{
		public override RelicEffect Relic => (RelicEffect)34;
	}
	[HarmonyPatch]
	public class SuperBoots : HealingCounter
	{
		public override RelicEffect Relic => (RelicEffect)35;

		[HarmonyPatch(typeof(PostBattleController), "TriggerVictory")]
		[HarmonyPrefix]
		private static void Enable()
		{
			((SuperBoots)Tracker.trackers[(RelicEffect)35])._active = true;
		}

		[HarmonyPatch(typeof(PostBattleController), "TriggerVictory")]
		[HarmonyPostfix]
		private static void Disable()
		{
			((SuperBoots)Tracker.trackers[(RelicEffect)35])._active = false;
		}
	}
	public class SpecialButton : NoopTracker
	{
		public override RelicEffect Relic => (RelicEffect)36;
	}
	public class FreshBandana : NoopTracker
	{
		public override RelicEffect Relic => (RelicEffect)37;
	}
	public class MonsterTraining : PegDamageCounter
	{
		public override RelicEffect Relic => (RelicEffect)38;

		public override void StartAddPeg()
		{
			_active = false;
		}

		public override void Used()
		{
			_active = true;
		}

		public override void AddPeg(float multiplier, int bonus)
		{
			base.AddPeg(multiplier / 2f, 0);
		}
	}
	public class Refreshiv : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)39;

		public override string Tooltip => string.Format("{0} refresh{1}", count, Utils.Plural(count, "es"));
	}
	public class TacticalTreat : NoopTracker
	{
		public override RelicEffect Relic => (RelicEffect)40;
	}
	public class UnicornHorn : NoopTracker
	{
		public override RelicEffect Relic => (RelicEffect)41;
	}
	[HarmonyPatch]
	public class RallyingHeart : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)42;

		public override string Tooltip => $"{count} <style=heal>healed</style>";

		public override void Used()
		{
		}

		[HarmonyPatch(typeof(PlayerHealthController), "HealEndOfBattleAmount")]
		[HarmonyPrefix]
		private static void Heal(PlayerHealthController __instance)
		{
			if (Tracker.HaveRelic((RelicEffect)42))
			{
				int endOfBattleHealAmount = __instance.endOfBattleHealAmount;
				Dictionary<RelicEffect, Relic> attr = Refl<Dictionary<RelicEffect, Relic>>.GetAttr<RelicManager>(Utils.GetResource<RelicManager>(), "_ownedRelics");
				Relic value = attr[(RelicEffect)42];
				attr.Remove((RelicEffect)42);
				int endOfBattleHealAmount2 = __instance.endOfBattleHealAmount;
				attr.Add((RelicEffect)42, value);
				RallyingHeart rallyingHeart = (RallyingHeart)Tracker.trackers[(RelicEffect)42];
				if (endOfBattleHealAmount > endOfBattleHealAmount2)
				{
					rallyingHeart.count += endOfBattleHealAmount - endOfBattleHealAmount2;
					rallyingHeart.Updated();
				}
			}
		}
	}
	public class SufferTheSling : OrbDamageCounter
	{
		public override RelicEffect Relic => (RelicEffect)43;
	}
	public class SandArrows : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)44;

		public override string Tooltip => $"{count} <style=blind>Blind applied</style>";

		public override void Used()
		{
		}
	}
	public class Overwhammer : TodoTracker
	{
		public override RelicEffect Relic => (RelicEffect)45;
	}
	public class InconspicuousRing : PegDamageCounter
	{
		public override RelicEffect Relic => (RelicEffect)46;
	}
	public class OldGardenerGloves : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)47;

		public override int Step => 10;

		public override string Tooltip => $"{count} <style=damage>damage added</style>";
	}
	[HarmonyPatch]
	public class SlimySalve : HealingCounter
	{
		private bool _sliming;

		private HashSet<int> _slimedPegs = new HashSet<int>();

		public override RelicEffect Relic => (RelicEffect)48;

		public override void Reset()
		{
			base.Reset();
			_sliming = false;
			_slimedPegs.Clear();
		}

		public override void Used()
		{
			_sliming = true;
		}

		[HarmonyPatch(typeof(RegularPeg), "CheckAndApplySlime")]
		[HarmonyPostfix]
		private static void CheckApplySlimeRegularPost()
		{
			((SlimySalve)Tracker.trackers[(RelicEffect)48])._sliming = false;
		}

		[HarmonyPatch(typeof(LongPeg), "CheckAndApplySlime")]
		[HarmonyPostfix]
		private static void CheckApplySlimeLongPost()
		{
			((SlimySalve)Tracker.trackers[(RelicEffect)48])._sliming = false;
		}

		[HarmonyPatch(typeof(RegularPeg), "ApplySlimeToPeg")]
		[HarmonyPostfix]
		private static void ApplySlimeRegular(RegularPeg __instance, SlimeType sType)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			if ((int)sType == 15)
			{
				SlimySalve slimySalve = (SlimySalve)Tracker.trackers[(RelicEffect)48];
				if (slimySalve._sliming)
				{
					slimySalve._slimedPegs.Add(((Object)((Component)__instance).gameObject).GetInstanceID());
					slimySalve._sliming = false;
				}
			}
		}

		[HarmonyPatch(typeof(LongPeg), "ApplySlimeToPeg")]
		[HarmonyPostfix]
		private static void ApplySlimeLong(LongPeg __instance, SlimeType sType)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			if ((int)sType == 15)
			{
				SlimySalve slimySalve = (SlimySalve)Tracker.trackers[(RelicEffect)48];
				if (slimySalve._sliming)
				{
					slimySalve._slimedPegs.Add(((Object)((Component)__instance).gameObject).GetInstanceID());
					slimySalve._sliming = false;
				}
			}
		}

		public void NewBattle()
		{
			_slimedPegs.Clear();
			_sliming = false;
		}

		[HarmonyPatch(typeof(RegularPeg), "PegActivated")]
		[HarmonyPrefix]
		private static void EnableRegular(RegularPeg __instance)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Invalid comparison between Unknown and I4
			SlimySalve slimySalve = (SlimySalve)Tracker.trackers[(RelicEffect)48];
			if (slimySalve._slimedPegs.Contains(((Object)((Component)__instance).gameObject).GetInstanceID()))
			{
				if ((int)((Peg)__instance).slimeType != 15)
				{
					slimySalve._slimedPegs.Remove(((Object)((Component)__instance).gameObject).GetInstanceID());
				}
				else
				{
					slimySalve._active = true;
				}
			}
		}

		[HarmonyPatch(typeof(RegularPeg), "PegActivated")]
		[HarmonyPostfix]
		private static void DisableRegular()
		{
			((SlimySalve)Tracker.trackers[(RelicEffect)48])._active = false;
		}

		[HarmonyPatch(typeof(LongPeg), "PegActivated")]
		[HarmonyPrefix]
		private static void EnableLong(LongPeg __instance)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Invalid comparison between Unknown and I4
			SlimySalve slimySalve = (SlimySalve)Tracker.trackers[(RelicEffect)48];
			if (slimySalve._slimedPegs.Contains(((Object)((Component)__instance).gameObject).GetInstanceID()))
			{
				if ((int)((Peg)__instance).slimeType != 15)
				{
					slimySalve._slimedPegs.Remove(((Object)((Component)__instance).gameObject).GetInstanceID());
				}
				else
				{
					slimySalve._active = true;
				}
			}
		}

		[HarmonyPatch(typeof(LongPeg), "PegActivated")]
		[HarmonyPostfix]
		private static void DisableLong()
		{
			((SlimySalve)Tracker.trackers[(RelicEffect)48])._active = false;
		}
	}
	[HarmonyPatch]
	public class InfernalIngot : HealingCounter
	{
		private bool _damageActive;

		private int damageCount;

		public override RelicEffect Relic => (RelicEffect)49;

		public override string Tooltip => $"{damageCount} <style=damage>damage dealt</style>; {base.Tooltip}";

		public override object State
		{
			get
			{
				return (count, damageCount);
			}
			set
			{
				(count, damageCount) = ((int, int))value;
			}
		}

		public override void Reset()
		{
			base.Reset();
			_damageActive = false;
			damageCount = 0;
		}

		public override void Used()
		{
			_active = true;
			_damageActive = true;
		}

		[HarmonyPatch(typeof(TargetingManager), "HandlePegActivated")]
		[HarmonyPostfix]
		private static void Disable()
		{
			InfernalIngot obj = (InfernalIngot)Tracker.trackers[(RelicEffect)49];
			obj._active = false;
			obj._damageActive = false;
		}

		public void Damage(float amount)
		{
			if (_damageActive)
			{
				damageCount += (int)amount;
				Updated();
			}
			_damageActive = false;
		}
	}
	[HarmonyPatch]
	public class MentalMantle : DamageTargetedCounter
	{
		public override RelicEffect Relic => (RelicEffect)50;

		[HarmonyPatch(typeof(TargetingManager), "HandlePegActivated")]
		[HarmonyPostfix]
		private static void Disable()
		{
			((MentalMantle)Tracker.trackers[(RelicEffect)50])._active = false;
		}
	}
	[HarmonyPatch]
	public class PoppingCorn : HealingCounter
	{
		public override RelicEffect Relic => (RelicEffect)51;

		[HarmonyPatch(typeof(PlayerHealthController), "HandlePegActivated")]
		[HarmonyPrefix]
		private static void Enable()
		{
			((PoppingCorn)Tracker.trackers[(RelicEffect)51])._active = true;
		}

		[HarmonyPatch(typeof(PlayerHealthController), "HandlePegActivated")]
		[HarmonyPostfix]
		private static void Disable()
		{
			((PoppingCorn)Tracker.trackers[(RelicEffect)51])._active = false;
		}
	}
	[HarmonyPatch]
	public class WeaponizedEnvy : DamageTargetedCounter
	{
		public override RelicEffect Relic => (RelicEffect)52;

		[HarmonyPatch(typeof(TargetingManager), "HandlePlayerHealed")]
		[HarmonyPostfix]
		private static void Disable()
		{
			((WeaponizedEnvy)Tracker.trackers[(RelicEffect)52])._active = false;
		}
	}
	[HarmonyPatch]
	public class WandOfSkulltimateWrath : PegDamageCounter
	{
		private bool _selfDamageActive;

		private int selfDamageCount;

		public override RelicEffect Relic => (RelicEffect)53;

		public override string Tooltip => $"{base.Tooltip}; {selfDamageCount} <style=damage>self-damage</style>";

		public override object State
		{
			get
			{
				return (goodCount, badCount, selfDamageCount);
			}
			set
			{
				(goodCount, badCount, selfDamageCount) = ((int, int, int))value;
			}
		}

		public override void StartAddPeg()
		{
			_active = false;
		}

		public override void Used()
		{
		}

		public override void Checked()
		{
			_active = true;
		}

		public override void AddPeg(float multiplier, int bonus)
		{
			base.AddPeg(multiplier / 2f, 0);
		}

		public override void Reset()
		{
			base.Reset();
			_selfDamageActive = false;
			selfDamageCount = 0;
		}

		[HarmonyPatch(typeof(PlayerHealthController), "HandlePegActivated")]
		[HarmonyPrefix]
		private static void Enable()
		{
			((WandOfSkulltimateWrath)Tracker.trackers[(RelicEffect)53])._selfDamageActive = true;
		}

		[HarmonyPatch(typeof(PlayerHealthController), "HandlePegActivated")]
		[HarmonyPostfix]
		private static void Disable()
		{
			((WandOfSkulltimateWrath)Tracker.trackers[(RelicEffect)53])._selfDamageActive = false;
		}

		public virtual void SelfDamage(float amount)
		{
			if (_selfDamageActive)
			{
				selfDamageCount += (int)amount;
				Updated();
			}
			_selfDamageActive = false;
		}
	}
	public class RingOfReuse : NoopTracker
	{
		public override RelicEffect Relic => (RelicEffect)54;
	}
	public class EchoChamber : OrbDamageCounter
	{
		public override RelicEffect Relic => (RelicEffect)55;
	}
	public class GrabbyHand : TodoTracker
	{
		public override RelicEffect Relic => (RelicEffect)56;
	}
	public class KnifesEdge : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)57;

		public override string Tooltip => $"{count} crit{Utils.Plural(count)}";
	}
	public class BasicBlade : OrbDamageCounter
	{
		public override RelicEffect Relic => (RelicEffect)58;
	}
	public class CritsomallosFleece : OrbDamageCounter
	{
		public override RelicEffect Relic => (RelicEffect)59;
	}
	[HarmonyPatch]
	public class EyeOfTurtle : Tracker
	{
		private bool _orbActive;

		private bool _relicActive;

		private int orbCount;

		private int relicCount;

		public override RelicEffect Relic => (RelicEffect)60;

		public override string Tooltip => $"{orbCount} extra orb{Utils.Plural(orbCount)}; {relicCount} extra relic{Utils.Plural(relicCount)}";

		public override object State
		{
			get
			{
				return (orbCount, relicCount);
			}
			set
			{
				(orbCount, relicCount) = ((int, int))value;
			}
		}

		public override void Reset()
		{
			_orbActive = (_relicActive = false);
			orbCount = (relicCount = 0);
		}

		public override void Used()
		{
			if (_orbActive)
			{
				orbCount++;
				Updated();
			}
			if (_relicActive)
			{
				relicCount++;
				Updated();
			}
			_orbActive = (_relicActive = false);
		}

		[HarmonyPatch(typeof(PopulateSuggestionOrbs), "GenerateAddableOrbs")]
		[HarmonyPrefix]
		private static void EnableOrb()
		{
			((EyeOfTurtle)Tracker.trackers[(RelicEffect)60])._orbActive = true;
			((Peglintuition)Tracker.trackers[(RelicEffect)97])._orbActive = true;
		}

		[HarmonyPatch(typeof(PopulateSuggestionOrbs), "GenerateAddableOrbs")]
		[HarmonyPostfix]
		private static void DisableOrb()
		{
			((EyeOfTurtle)Tracker.trackers[(RelicEffect)60])._orbActive = false;
			((Peglintuition)Tracker.trackers[(RelicEffect)97])._orbActive = false;
		}

		[HarmonyPatch(typeof(BattleUpgradeCanvas), "SetupRelicGrant")]
		[HarmonyPrefix]
		private static void EnableRelic(bool isTreasure)
		{
			((EyeOfTurtle)Tracker.trackers[(RelicEffect)60])._relicActive = !isTreasure;
			((Peglintuition)Tracker.trackers[(RelicEffect)97])._relicActive = true;
		}

		[HarmonyPatch(typeof(BattleUpgradeCanvas), "SetupRelicGrant")]
		[HarmonyPostfix]
		private static void DisableRelic()
		{
			((EyeOfTurtle)Tracker.trackers[(RelicEffect)60])._relicActive = false;
			((Peglintuition)Tracker.trackers[(RelicEffect)97])._relicActive = false;
		}
	}
	public class GloriousSuffeRing : OrbDamageCounter
	{
		private Dictionary<int, int> _pegBuffs = new Dictionary<int, int>();

		private int _bonus;

		public override RelicEffect Relic => (RelicEffect)61;

		public override void Reset()
		{
			base.Reset();
			NewBattle();
		}

		public void NewBattle()
		{
			_pegBuffs.Clear();
			_bonus = 0;
		}

		public void HandleRelicBuff(Peg peg)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if (Tracker.HaveRelic(Relic))
			{
				if (_pegBuffs.ContainsKey(((Object)((Component)peg).gameObject).GetInstanceID()))
				{
					_pegBuffs[((Object)((Component)peg).gameObject).GetInstanceID()] += RelicManager.ALL_ORBS_DEBUFF_AMOUNT;
				}
				else
				{
					_pegBuffs[((Object)((Component)peg).gameObject).GetInstanceID()] = RelicManager.ALL_ORBS_DEBUFF_AMOUNT;
				}
			}
		}

		public void HandleHitPeg(Peg peg)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if (Tracker.HaveRelic(Relic) && _pegBuffs.ContainsKey(((Object)((Component)peg).gameObject).GetInstanceID()))
			{
				_bonus += (int)((float)_pegBuffs[((Object)((Component)peg).gameObject).GetInstanceID()] * peg.buffDamageMultiplier);
			}
		}

		public override float GetBaseDamage(Attack attack, AttackManager attackManager, float[] dmgValues, float dmgMult, int dmgBonus, int critCount)
		{
			float baseDamage = base.GetBaseDamage(attack, attackManager, dmgValues, dmgMult, dmgBonus - _bonus, critCount);
			_bonus = 0;
			return baseDamage;
		}
	}
	public class SapperSack : NoopTracker
	{
		public override RelicEffect Relic => (RelicEffect)62;
	}
	public class Bombulet : NoopTracker
	{
		public override RelicEffect Relic => (RelicEffect)63;
	}
	public class BombBaton : NoopTracker
	{
		public override RelicEffect Relic => (RelicEffect)64;
	}
	public class PowderCollector : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)65;

		public override string Tooltip => $"{count} <sprite name=\"BOMB_REGULAR\"> created";
	}
	[HarmonyPatch]
	public class BadCheese : DamageAllCounter
	{
		public override RelicEffect Relic => (RelicEffect)66;

		[HarmonyPatch(typeof(BattleController), "DealCheeseDamage")]
		[HarmonyPrefix]
		private static void Enable()
		{
			((BadCheese)Tracker.trackers[(RelicEffect)66])._active = true;
		}

		[HarmonyPatch(typeof(BattleController), "DealCheeseDamage")]
		[HarmonyPostfix]
		private static void Disable()
		{
			((BadCheese)Tracker.trackers[(RelicEffect)66])._active = false;
		}
	}
	[HarmonyPatch]
	public class RingOfPain : DamageAllCounter
	{
		public override RelicEffect Relic => (RelicEffect)67;

		[HarmonyPatch(typeof(PlayerHealthController), "AttemptDamageReturn")]
		[HarmonyPrefix]
		private static void Enable()
		{
			((RingOfPain)Tracker.trackers[(RelicEffect)67])._active = true;
		}

		[HarmonyPatch(typeof(PlayerHealthController), "AttemptDamageReturn")]
		[HarmonyPostfix]
		private static void Disable()
		{
			((RingOfPain)Tracker.trackers[(RelicEffect)67])._active = false;
		}
	}
	public class PerfectedReactant : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)68;

		public override int Step => (int)((float)Utils.EnemyDamageCount() * 20f);

		public override string Tooltip => $"{count} <style=damage>damage added</style>";
	}
	public class DodgyShortcut : NoopTracker
	{
		public override RelicEffect Relic => (RelicEffect)69;
	}
	public class CrumpledCharacterSheet : NoopTracker
	{
		public override RelicEffect Relic => (RelicEffect)70;
	}
	public class CurseOfThePeglinKing : NoopTracker
	{
		public override RelicEffect Relic => (RelicEffect)71;
	}
	public class AncientMeteorite : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)72;

		public override string Tooltip => $"{count} explosive force{Utils.Plural(count)}";
	}
	public class DumbBell : StatusEffectCounter
	{
		public override RelicEffect Relic => (RelicEffect)73;

		public override StatusEffectType type => (StatusEffectType)8;
	}
	public class TheCake : NoopTracker
	{
		public override RelicEffect Relic => (RelicEffect)74;
	}
	public class Refreshield : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)75;

		public override string Tooltip => string.Format("{0} refresh{1}", count, Utils.Plural(count, "es"));
	}
	public class Puppet : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)76;

		public override string Tooltip => $"{count} <style=damage>damage avoided</style>";

		public override void Used()
		{
		}

		public void DamageAvoided(float damage)
		{
			count += (int)damage;
			Updated();
		}
	}
	public class ComplexClaw : OrbDamageCounter
	{
		public override RelicEffect Relic => (RelicEffect)77;
	}
	public class IntentionalOboe : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)78;

		public override string Tooltip => $"{count} <style=damage>damage avoided</style>";
	}
	public class SpiralSlayer : StatusEffectCounter
	{
		public override RelicEffect Relic => (RelicEffect)79;

		public override StatusEffectType type => (StatusEffectType)8;
	}
	public class ShrewdScales : StatusEffectCounter
	{
		public override RelicEffect Relic => (RelicEffect)80;

		public override StatusEffectType type => (StatusEffectType)10;
	}
	public class ConsumingChalice : OrbDamageCounter
	{
		public override RelicEffect Relic => (RelicEffect)81;
	}
	public class UnpretentiousPendant : OrbDamageCounter
	{
		public override RelicEffect Relic => (RelicEffect)82;
	}
	public class SmokeMod : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)83;

		public override string Tooltip => $"{count} <style=balance>Blind applied</style>";
	}
	public class PocketSand : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)84;

		public override int Step => 15;

		public override string Tooltip => $"{count} <style=balance>Blind applied</style>";
	}
	public class BetsysHedge : OrbDamageCounter
	{
		public override RelicEffect Relic => (RelicEffect)85;
	}
	public class ShortStack : OrbDamageCounter
	{
		public override RelicEffect Relic => (RelicEffect)86;
	}
	[HarmonyPatch]
	public class PumpkinPi : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)87;

		public override string Tooltip => $"{count} orb{Utils.Plural(count)} teleported";

		public override void Used()
		{
		}

		[HarmonyPatch(typeof(SlotTrigger), "OnTriggerEnter2D")]
		[HarmonyPrefix]
		private static void SlotEnter(SlotTrigger __instance, Collider2D collision)
		{
			if (Tracker.HaveRelic((RelicEffect)87) && (Object)(object)((Component)collision).GetComponent<PachinkoBall>() != (Object)null && BattleController.AwaitingShotCompletion() && Refl<bool>.GetAttr<SlotTrigger>(__instance, "_isPortal") && Refl<int>.GetAttr<SlotTrigger>(__instance, "_portalUsageCount") < 3)
			{
				PumpkinPi obj = (PumpkinPi)Tracker.trackers[(RelicEffect)87];
				obj.count++;
				obj.Updated();
			}
		}
	}
	public class HaglinsSatchel : NoopTracker
	{
		public override RelicEffect Relic => (RelicEffect)88;
	}
	public class SafetyNet : PegDamageCounter
	{
		private int _counter;

		public override RelicEffect Relic => (RelicEffect)89;

		public override void Reset()
		{
			base.Reset();
			_active = false;
			_counter = 0;
		}

		public override void Used()
		{
			_active = true;
			_counter = 5;
		}

		public override void AddPeg(float multiplier, int bonus)
		{
			base.AddPeg(multiplier, bonus);
			if (--_counter > 0)
			{
				_active = true;
			}
		}
	}
	public class AncientFleece : OrbDamageCounter
	{
		public override RelicEffect Relic => (RelicEffect)90;
	}
	public class RefresherCourse : Tracker
	{
		private int musCount;

		private int spinCount;

		private bool _active;

		public override RelicEffect Relic => (RelicEffect)91;

		public override object State
		{
			get
			{
				return (musCount, spinCount);
			}
			set
			{
				(musCount, spinCount) = ((int, int))value;
			}
		}

		public override string Tooltip => $"{musCount} <style=strength>Muscircle added</style>; {spinCount} <style=finesse>Spinesse added</style>";

		public override void Reset()
		{
			musCount = (spinCount = 0);
			_active = false;
		}

		public override void Used()
		{
			_active = true;
		}

		public void ApplyStatusEffect(StatusEffect statusEffect)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Invalid comparison between Unknown and I4
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Invalid comparison between Unknown and I4
			if (_active)
			{
				if ((int)statusEffect.EffectType == 8)
				{
					musCount += statusEffect.Intensity;
				}
				else if ((int)statusEffect.EffectType == 9)
				{
					spinCount += statusEffect.Intensity;
				}
				Updated();
				_active = false;
			}
		}
	}
	public class HerosBackpack : OrbDamageCounter
	{
		public override RelicEffect Relic => (RelicEffect)92;
	}
	public class AimLimiter : OrbDamageCounter
	{
		public override RelicEffect Relic => (RelicEffect)93;
	}
	[HarmonyPatch]
	public class AxeMeAnything : SimpleCounter
	{
		private bool _bombActive;

		private float _damageMod;

		public override RelicEffect Relic => (RelicEffect)94;

		public override string Tooltip => $"{count} <style=damage>damage added</style>";

		public override void Used()
		{
		}

		public override void Reset()
		{
			base.Reset();
			_bombActive = false;
			_damageMod = 0f;
		}

		[HarmonyPatch(typeof(BattleController), "OnBombDeath")]
		[HarmonyPrefix]
		private static void EnableBomb()
		{
			((AxeMeAnything)Tracker.trackers[(RelicEffect)94])._bombActive = true;
		}

		[HarmonyPatch(typeof(BattleController), "OnBombDeath")]
		[HarmonyPostfix]
		private static void DisableBomb()
		{
			((AxeMeAnything)Tracker.trackers[(RelicEffect)94])._bombActive = false;
		}

		[HarmonyPatch(typeof(Attack), "GetDamageMod")]
		[HarmonyPostfix]
		private static void GetDamageMod(float enemyDamageMod, float __result)
		{
			if (Tracker.HaveRelic((RelicEffect)94))
			{
				AxeMeAnything axeMeAnything = (AxeMeAnything)Tracker.trackers[(RelicEffect)94];
				if (enemyDamageMod < 1f && __result > 1f)
				{
					axeMeAnything._damageMod = (__result - enemyDamageMod) / __result;
				}
				else
				{
					axeMeAnything._damageMod = 0f;
				}
			}
		}

		[HarmonyPatch(typeof(Enemy), "Damage")]
		[HarmonyPrefix]
		private static void EnemyDamage(Enemy __instance, float damage, float damageMod)
		{
			if (!Tracker.HaveRelic((RelicEffect)94))
			{
				return;
			}
			AxeMeAnything axeMeAnything = (AxeMeAnything)Tracker.trackers[(RelicEffect)94];
			if (axeMeAnything._bombActive)
			{
				if (__instance.bombDamageMod < damageMod)
				{
					axeMeAnything.count += (int)(damage * (damageMod - __instance.bombDamageMod));
					axeMeAnything.Updated();
				}
			}
			else if (axeMeAnything._damageMod != 0f)
			{
				axeMeAnything.count += (int)(damage * damageMod * axeMeAnything._damageMod);
				axeMeAnything.Updated();
				axeMeAnything._damageMod = 0f;
			}
		}
	}
	public class SeraphicShield : SimpleCounter
	{
		private bool _active;

		public override RelicEffect Relic => (RelicEffect)95;

		public override string Tooltip => $"{count} <style=damage>damage avoided</style>";

		public override void Reset()
		{
			base.Reset();
			_active = false;
		}

		public void Disable()
		{
			_active = false;
		}

		public override void Used()
		{
			_active = true;
		}

		public void DamageAvoided(float damage)
		{
			if (_active)
			{
				count += (int)damage;
				Updated();
			}
			_active = false;
		}
	}
	[HarmonyPatch]
	public class Critikris : DamageAllCounter
	{
		public override RelicEffect Relic => (RelicEffect)96;

		[HarmonyPatch(typeof(BattleController), "ActivateCrit")]
		[HarmonyPostfix]
		private static void AfterActivateCrit()
		{
			((Critikris)Tracker.trackers[(RelicEffect)96])._active = false;
		}
	}
	public class Peglintuition : EyeOfTurtle
	{
		public override RelicEffect Relic => (RelicEffect)97;
	}
	public class MoltenGold : NoopTracker
	{
		public override RelicEffect Relic => (RelicEffect)98;
	}
	[HarmonyPatch]
	public class MoltenMantle : DamageTargetedCounter
	{
		public override RelicEffect Relic => (RelicEffect)99;

		[HarmonyPatch(typeof(BattleController), "HandleCoinCollected")]
		[HarmonyPostfix]
		private static void Disable()
		{
			((MoltenMantle)Tracker.trackers[(RelicEffect)99])._active = false;
		}
	}
	[HarmonyPatch]
	public class Navigationflation : SimpleCounter
	{
		private bool _doingBomb;

		public override RelicEffect Relic => (RelicEffect)100;

		public override int Step
		{
			get
			{
				if (Tracker.HaveRelic((RelicEffect)99))
				{
					return 0;
				}
				if (_doingBomb)
				{
					if (Tracker.HaveRelic((RelicEffect)143))
					{
						return 15;
					}
					return 0;
				}
				return 3;
			}
		}

		public override string Tooltip => $"{count} <sprite name=\"GOLD\"> added";

		public override void Reset()
		{
			base.Reset();
			_doingBomb = false;
		}

		[HarmonyPatch(typeof(Bomb), "PegActivated")]
		[HarmonyPrefix]
		private static void StartBomb()
		{
			((Navigationflation)Tracker.trackers[(RelicEffect)100])._doingBomb = true;
		}

		[HarmonyPatch(typeof(Bomb), "PegActivated")]
		[HarmonyPostfix]
		private static void EndBomb()
		{
			((Navigationflation)Tracker.trackers[(RelicEffect)100])._doingBomb = false;
		}
	}
	public class DuplicationPotion : NoopTracker
	{
		public override RelicEffect Relic => (RelicEffect)101;
	}
	public class RefillosophersStone : NoopTracker
	{
		public override RelicEffect Relic => (RelicEffect)102;
	}
	[HarmonyPatch]
	public class PeglinerosPendant : PegDamageCounter
	{
		public override RelicEffect Relic => (RelicEffect)103;

		[HarmonyPatch(typeof(PegCoinOverlay), "TriggerCoinCollected")]
		[HarmonyPostfix]
		private static void Disable()
		{
			((PeglinerosPendant)Tracker.trackers[(RelicEffect)103])._active = false;
		}
	}
	public class WandOfSkulltimateGreed : NoopTracker
	{
		public override RelicEffect Relic => (RelicEffect)104;
	}
	public class DefreshPotion : NoopTracker
	{
		public override RelicEffect Relic => (RelicEffect)105;
	}
	public class SaltShaker : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)106;

		public override string Tooltip => $"{count} max HP added";
	}
	[HarmonyPatch]
	public class GardenersGloves : SimpleCounter
	{
		private bool _active;

		private float _currentDamage;

		public override RelicEffect Relic => (RelicEffect)107;

		public override string Tooltip => $"{count} <style=damage>damage avoided</style>";

		public override void Reset()
		{
			base.Reset();
			_active = false;
		}

		public override void Used()
		{
			if (_active)
			{
				count += (int)Mathf.Ceil(_currentDamage / 2f);
				Updated();
			}
			_active = false;
		}

		[HarmonyPatch(typeof(PlayerHealthController), "DealSelfDamage")]
		[HarmonyPrefix]
		private static void Enable(float damage)
		{
			GardenersGloves obj = (GardenersGloves)Tracker.trackers[(RelicEffect)107];
			obj._currentDamage = damage;
			obj._active = true;
		}

		[HarmonyPatch(typeof(PlayerHealthController), "DealSelfDamage")]
		[HarmonyPostfix]
		private static void Disable(float damage)
		{
			((GardenersGloves)Tracker.trackers[(RelicEffect)107])._active = false;
		}
	}
	public class GrindingMonstera : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)108;

		public override string Tooltip => $"{count} max HP added";
	}
	public class SashOfFocus : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)109;

		public override string Tooltip => $"{count} <style=damage>damage avoided</style>";

		public override void Used()
		{
		}

		public void DamageAvoided(float damage)
		{
			count += (int)damage;
			Updated();
		}
	}
	public class PrimeRodOfFrost : TodoTracker
	{
		public override RelicEffect Relic => (RelicEffect)110;
	}
	public class BasaltToadem : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)111;

		public override int Step => 4;

		public override string Tooltip => $"{count} max HP added";
	}
	public class DungeonDie : OrbDamageCounter
	{
		public override RelicEffect Relic => (RelicEffect)112;
	}
	public class PerfectForger : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)113;

		public override string Tooltip => $"{count} orb{Utils.Plural(count)} upgraded";
	}
	[HarmonyPatch]
	public class BranchOfEmber : Tracker
	{
		private bool _active;

		private int blindCount;

		private int brambleCount;

		public override RelicEffect Relic => (RelicEffect)114;

		public override object State
		{
			get
			{
				return (blindCount, brambleCount);
			}
			set
			{
				(blindCount, brambleCount) = ((int, int))value;
			}
		}

		public override string Tooltip => $"{blindCount} <style=blind>Blind applied</style>; {brambleCount} <style=bramble>Bramble applied</style>";

		public override void Reset()
		{
			_active = false;
			blindCount = (brambleCount = 0);
		}

		public override void Used()
		{
			_active = true;
		}

		[HarmonyPatch(typeof(Enemy), "CheckForKnockOnEffects")]
		[HarmonyPostfix]
		private static void Disable()
		{
			((BranchOfEmber)Tracker.trackers[(RelicEffect)114])._active = false;
		}

		[HarmonyPatch(typeof(Enemy), "ApplyStatusEffect")]
		[HarmonyPrefix]
		private static void Apply(StatusEffect statusEffect)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Invalid comparison between Unknown and I4
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Invalid comparison between Unknown and I4
			BranchOfEmber branchOfEmber = (BranchOfEmber)Tracker.trackers[(RelicEffect)114];
			if (branchOfEmber._active)
			{
				if ((int)statusEffect.EffectType == 3)
				{
					branchOfEmber.blindCount += statusEffect.Intensity;
				}
				else if ((int)statusEffect.EffectType == 1)
				{
					branchOfEmber.brambleCount += statusEffect.Intensity;
				}
				branchOfEmber.Updated();
				branchOfEmber._active = false;
			}
		}
	}
	public class RipostalService : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)115;

		public override string Tooltip => $"{count} <style=damage>damage dealt</style>";

		public override void Used()
		{
		}

		public void Damage(float damage)
		{
			count += (int)damage;
			Updated();
		}
	}
	public class EssentialOil : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)116;

		public override int Step => 2;

		public override string Tooltip => $"{count} <style=ballwark>Ballwark added</style>";
	}
	public class ArmourOnPegs : NoopTracker
	{
		public override RelicEffect Relic => (RelicEffect)117;
	}
	public class StartWithBallwark : StatusEffectCounter
	{
		public override RelicEffect Relic => (RelicEffect)118;

		public override StatusEffectType type => (StatusEffectType)12;
	}
	public class OrbertsStory : Tracker
	{
		private int treasureCount;

		private int rareCount;

		public override RelicEffect Relic => (RelicEffect)119;

		public override object State
		{
			get
			{
				return (treasureCount, rareCount);
			}
			set
			{
				(treasureCount, rareCount) = ((int, int))value;
			}
		}

		public override string Tooltip => $"{treasureCount} extra treasure{Utils.Plural(treasureCount)}; {rareCount} extra rare relic{Utils.Plural(rareCount)}";

		public override void Reset()
		{
			treasureCount = (rareCount = 0);
		}

		public override void Used()
		{
			treasureCount++;
			Updated();
		}

		public override void Flash()
		{
			rareCount++;
			Updated();
		}
	}
	[HarmonyPatch]
	public class KnightCap : SimpleCounter
	{
		private bool _active;

		public override RelicEffect Relic => (RelicEffect)120;

		public override string Tooltip => $"{count} max HP added";

		public override void Reset()
		{
			base.Reset();
			_active = false;
		}

		public override void Used()
		{
			_active = true;
		}

		[HarmonyPatch(typeof(BattleUpgradeCanvas), "SetUpPostBattleOptions")]
		[HarmonyPostfix]
		private static void Disable()
		{
			((KnightCap)Tracker.trackers[(RelicEffect)120])._active = false;
		}

		[HarmonyPatch(typeof(PlayerHealthController), "AdjustMaxHealth")]
		[HarmonyPrefix]
		private static void AddMaxHP(float amount)
		{
			KnightCap knightCap = (KnightCap)Tracker.trackers[(RelicEffect)120];
			if (knightCap._active)
			{
				knightCap.count += (int)amount;
				knightCap.Updated();
			}
			knightCap._active = false;
		}
	}
	public class BallpeenHammer : StatusEffectCounter
	{
		public override RelicEffect Relic => (RelicEffect)121;

		public override StatusEffectType type => (StatusEffectType)12;
	}
	public class FieryFurnace : StatusEffectCounter
	{
		public override RelicEffect Relic => (RelicEffect)122;

		public override StatusEffectType type => (StatusEffectType)12;
	}
	public class TrainingWeight : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)123;

		public override string Tooltip => $"{count} <style=strength>Muscircle added</style>";
	}
	public class BrassicaceaeKnuckles : StatusEffectCounter
	{
		public override RelicEffect Relic => (RelicEffect)124;

		public override StatusEffectType type => (StatusEffectType)8;
	}
	[HarmonyPatch]
	public class Roundreloquence : Tracker
	{
		protected bool _active;

		private int brambleCount;

		private int poisonCount;

		private int blindCount;

		private int exploitCount;

		private int transpCount;

		public override RelicEffect Relic => (RelicEffect)125;

		public override object State
		{
			get
			{
				return (brambleCount, poisonCount, blindCount, exploitCount, transpCount);
			}
			set
			{
				(brambleCount, poisonCount, blindCount, exploitCount, transpCount) = ((int, int, int, int, int))value;
			}
		}

		public override string Tooltip => $"{brambleCount} <style=bramble>Bramble</style>; {poisonCount} <style=poison>Spinfection</style>; {blindCount} <style=blind>Blind</style>; {exploitCount} <style=exploitaball>Exploitaball</style>; {transpCount} <style=transpherency>Transpherency</style>";

		public override void Reset()
		{
			_active = false;
			brambleCount = (poisonCount = (blindCount = (exploitCount = (transpCount = 0))));
		}

		public override void Used()
		{
		}

		[HarmonyPatch(typeof(AddRandomStatusEffectOnHit), "AffectEnemy")]
		[HarmonyPrefix]
		private static void Enable()
		{
			((Roundreloquence)Tracker.trackers[(RelicEffect)125])._active = true;
		}

		[HarmonyPatch(typeof(AddRandomStatusEffectOnHit), "AffectEnemy")]
		[HarmonyPostfix]
		private static void Disable()
		{
			((Roundreloquence)Tracker.trackers[(RelicEffect)125])._active = false;
		}

		[HarmonyPatch(typeof(Enemy), "ApplyStatusEffect")]
		[HarmonyPrefix]
		private static void ApplyStatusHook(StatusEffect statusEffect)
		{
			((Roundreloquence)Tracker.trackers[(RelicEffect)125]).ApplyStatus(statusEffect);
			((EffectiveCriticism)Tracker.trackers[(RelicEffect)183]).ApplyStatus(statusEffect);
		}

		protected void ApplyStatus(StatusEffect statusEffect)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Invalid comparison between Unknown and I4
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Invalid comparison between Unknown and I4
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Invalid comparison between Unknown and I4
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Invalid comparison between Unknown and I4
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Invalid comparison between Unknown and I4
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			if (_active)
			{
				if ((int)statusEffect.EffectType == 1)
				{
					brambleCount += statusEffect.Intensity;
				}
				else if ((int)statusEffect.EffectType == 15)
				{
					poisonCount += statusEffect.Intensity;
				}
				else if ((int)statusEffect.EffectType == 3)
				{
					blindCount += statusEffect.Intensity;
				}
				else if ((int)statusEffect.EffectType == 32)
				{
					exploitCount += statusEffect.Intensity;
				}
				else if ((int)statusEffect.EffectType == 33)
				{
					transpCount += statusEffect.Intensity;
				}
				else
				{
					Plugin.Logger.LogWarning((object)$"Unexpected debuff from Roundreloquence: {statusEffect.EffectType}");
				}
				Updated();
				_active = false;
			}
		}
	}
	public class MaskOfSorrow : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)126;

		public override string Tooltip => $"{count} debuff{Utils.Plural(count)} increased";
	}
	[HarmonyPatch]
	public class MaskOfJoy : SimpleCounter
	{
		private bool _active = true;

		public override RelicEffect Relic => (RelicEffect)127;

		public override string Tooltip => $"{count} buff{Utils.Plural(count)} increased";

		public override void Reset()
		{
			base.Reset();
			_active = false;
		}

		public override void Used()
		{
			if (_active)
			{
				base.Used();
			}
		}

		[HarmonyPatch(typeof(PlayerStatusEffectController), "CheckRelicIntensityEffects")]
		[HarmonyPrefix]
		private static void Disable(PlayerStatusEffectController __instance, StatusEffect statusEffect)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Invalid comparison between Unknown and I4
			if (!Refl<StatusEffectType[]>.GetAttr<PlayerStatusEffectController>(__instance, "_positiveStatusEffects").Contains(statusEffect.EffectType) || (int)statusEffect.EffectType == 12 || statusEffect.Intensity <= 0)
			{
				((MaskOfJoy)Tracker.trackers[(RelicEffect)127])._active = false;
			}
		}

		[HarmonyPatch(typeof(PlayerStatusEffectController), "CheckRelicIntensityEffects")]
		[HarmonyPostfix]
		private static void Enable()
		{
			((MaskOfJoy)Tracker.trackers[(RelicEffect)127])._active = true;
		}
	}
	public class GrubbyGloves : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)128;

		public override string Tooltip => $"{count} <style=poison>Spinfection applied</style>";
	}
	public class ChokeMod : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)129;

		public override string Tooltip => $"{count} <style=poison>Spinfection applied</style>";
	}
	public class AuAuger : TodoTracker
	{
		public override RelicEffect Relic => (RelicEffect)130;
	}
	public class BeckoningCrit : SimpleCounter
	{
		public override RelicEffect Relic => (RelicEffect)131;

		public override string Tooltip => $"{count} crit{Utils.Plural(count)}";
	}
	[HarmonyPatch]
	public class AGoodSlime : PegBuffDamageCounter
	{
		private bool _active;

		public override RelicEffect Relic => (RelicEffect)132;

		public override void Reset()
		{
			base.Reset();
			_active = false;
		}

		public override void Used()
		{
			_active = true;
		}

		[HarmonyPatch(typeof(Peg), "AddBuff")]
		[HarmonyPrefix]
		private static void AddBuff(Peg __instance, int amount)
		{
			AGoodSlime aGoodSlime = (AGoodSlime)Tracker.trackers[(RelicEffect)132];
			if (aGoodSlime._active)
			{
				if (aGoodSlime._pegBuffs.ContainsKey(((Object)((Component)__instance).gameObject).GetInstanceID()))
				{
					aGoodSlime._pegBuffs[((Object)((Component)__instance).gameObject).GetInstanceID()] += amount;
				}
				else
				{
					aGoodSlime._pegBuffs[((Object)((Component)__instance).gameObject).GetInstanceID()] = amount;
				}
			}
			aGoodSlime._active = false;
		}

		[HarmonyPatch(typeof(RegularPeg), "CheckAndApplySlime")]
		[HarmonyPostfix]
		private static void Disable()
		{
			((AGoodSlime)Tracker.trackers[(RelicEffect)132])._active = false;
		}

		[HarmonyPatch(typeof(LongPeg), "CheckAndApplySlime")]
		[HarmonyPostfix]
		private static void DisableLong()
		{
			((AGoodSlime)Tracker.trackers[(RelicEffect)132])._active = false;
		}

		[HarmonyPatch(typeof(PegManager), "AddQueuedDamageReductionSlime")]
		[HarmonyPostfix]
		private static void DisableQueued()
		{
			((AGoodSlime)Tracker.trackers[(RelicEffect)132])._active = false;
		}
	}
	[HarmonyPatch]
	public class Adventurine : PegBuffDamageCounter
	{
		private bool _active;

		public override RelicEffect Relic => (RelicEffect)133;

		public override void Reset()
		{
			base.Reset();
			_active = false;
		}

		public override void Used()
		{
			_active = true;
		}

		[HarmonyPatch(typeof(Peg), "CheckForPachinkoBuff")]
		[HarmonyPrefix]
		private static void CheckBuffPre()
		{
			((Adventurine)Tracker.trackers[(RelicEffect)133])._active = false;
		}

		[HarmonyPatch(typeof(Peg), "CheckForPachinkoBuff")]
		[HarmonyPostfix]
		private static void CheckBuffPre(Peg __instance)
		{
			Adventurine adventurine = (Adventurine)Tracker.trackers[(RelicEffect)133];
			if (adventurine._active)
			{
				if (adventurine._pegBuffs.ContainsKey(((Object)((Component)__instance).gameObject).GetInstanceID()))
				{
					adventurine._pegBuffs[((Object)((Component)__instance).gameObject).GetInstanceID()] += RelicManager.FIRST_PEG_HIT_BUFF_AMOUNT;
				}
				else
				{
					adventurine._pegBuffs[((Object)((Component)__instance).gameObject).GetInstanceID()] = RelicManager.FIRST_PEG_HIT_BUFF_AMOUNT;
				}
			}
			adventurine._active = false;
		}
	}
	[HarmonyPatch]
	public class AliensRock : SimpleCounter
	{
		private static bool _active;

		private static Enemy _lastEnemy;

		private static int _lastRange;

		private static AoeType _lastType;

		private static SlotType _lastSlot;

		private static Enemy[] _lastResult;

		public override RelicEffect Relic => (RelicEffect)134;

		public override string Tooltip => $"{count} <style=damage>damage added</style>";

		public override void Reset()
		{
			base.Reset();
			ResetTemps();
		}

		private static void ResetTemps()
		{
			_active = false;
			_lastEnemy = null;
			_lastResult = null;
		}

		public override void Used()
		{
		}

		[HarmonyPatch(typeof(EnemyManager), "GetSplashRangeEnemies")]
		[HarmonyPostfix]
		private static void GetEnemies(Enemy enemy, int range, AoeType aoeType, SlotType slotType, Enemy[] __result)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			if (_active)
			{
				_lastEnemy = enemy;
				_lastRange = range;
				_lastType = aoeType;
				_lastSlot = slotType;
				_lastResult = __result;
			}
		}

		[HarmonyPatch(typeof(TargetedAttack), "HandleSpellHit")]
		[HarmonyPrefix]
		private static void EnableTarget()
		{
			_active = true;
		}

		[HarmonyPatch(typeof(TargetedAttack), "HandleSpellHit")]
		[HarmonyPostfix]
		private static void ProcessTarget(TargetedAttack __instance)
		{
			//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)
			_active = false;
			EnemyManager enemyManager = Refl<AttackManager>.GetAttr<TargetedAttack>(__instance, "_attackManager").enemyManager;
			float attr = Refl<float>.GetAttr<TargetedAttack>(__instance, "_hitDamage");
			if (Tracker.HaveRelic((RelicEffect)162) || Tracker.HaveRelic((RelicEffect)134))
			{
				Enemy[] splashRangeEnemies = enemyManager.GetSplashRangeEnemies(_lastEnemy, 0, _lastType, _lastSlot);
				if (Tracker.HaveRelic((RelicEffect)162))
				{
					((OldAliensrock)Tracker.trackers[(RelicEffect)162]).Handle(_lastResult, splashRangeEnemies, attr);
				}
				else
				{
					((AliensRock)Tracker.trackers[(RelicEffect)134]).Handle(_lastResult, splashRangeEnemies, attr);
				}
			}
			ResetTemps();
		}

		[HarmonyPatch(typeof(AoeAttack), "HandleSpellHit")]
		[HarmonyPrefix]
		private static void EnableAoe()
		{
			_active = true;
		}

		[HarmonyPatch(typeof(AoeAttack), "HandleSpellHit")]
		[HarmonyPostfix]
		private static void ProcessAoe(AoeAttack __instance)
		{
			//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)
			_active = false;
			EnemyManager enemyManager = Refl<AttackManager>.GetAttr<AoeAttack>(__instance, "_attackManager").enemyManager;
			float attr = Refl<float>.GetAttr<AoeAttack>(__instance, "_hitDamage");
			if (Tracker.HaveRelic((RelicEffect)134))
			{
				Enemy[] splashRangeEnemies = enemyManager.GetSplashRangeEnemies(_lastEnemy, _lastRange - 1, _lastType, _lastSlot);
				((AliensRock)Tracker.trackers[(RelicEffect)134]).Handle(_lastResult, splashRangeEnemies, attr);
			}
			ResetTemps();
		}

		private void Handle(Enemy[] enemiesHit, Enemy[] enemiesIgnore, float damage)
		{
			int num = 0;
			foreach (Enemy val in enemiesHit)
			{
				if ((Object)(object)val != (Object)null && !enemiesIgnore.Contains(val))
				{
					num++;
				}
			}
			count += num * (int)damage;
			Updated();
		}
	}
	public class Spinventoriginality : OrbDamageCounter
	{
		public override RelicEffect Relic => (RelicEffect)135;

		public override float GetBaseDamage(Attack attack, AttackManager attackManager, float[] dmgValues, float dmgMult, int dmgBonus, int critCount)
		{
			bool at