Decompiled source of MoonFaceWaterBottle v2.0.1

plugins\MoonFaceWaterBottle.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnboundLib.Cards;
using UnboundLib.GameModes;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("MoonFaceWaterBottle")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MoonFaceWaterBottle")]
[assembly: AssemblyTitle("MoonFaceWaterBottle")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MoonFaceWaterBottle;

public class DoorDashCard : CustomCard
{
	protected override string GetTitle()
	{
		return "DoorDash";
	}

	protected override string GetDescription()
	{
		return "On block heal half your missing HP, then stumble: heavy slow + no jumps + chunky gravity until the food coma passes. Food coma stacks time = max(timer left, ⌊ heal ÷ 5 ⌋ seconds capped at five). Blocking again refreshes timing without double-dipping slowdown.";
	}

	protected override GameObject GetCardArt()
	{
		return null;
	}

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

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

	protected override CardInfoStat[] GetStats()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: 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_002b: Expected O, but got Unknown
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Expected O, but got Unknown
		return (CardInfoStat[])(object)new CardInfoStat[2]
		{
			new CardInfoStat
			{
				positive = true,
				stat = "Block heal",
				amount = "+50% missing HP"
			},
			new CardInfoStat
			{
				positive = false,
				stat = "Food coma duration",
				amount = $"{1f}-{5f}s from ⌊ heal ÷ 5 ⌋ HP"
			}
		};
	}

	public override string GetModName()
	{
		return "MFWB";
	}

	public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
	{
	}

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

	public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
	{
		DoorDashEffect component = ((Component)player).gameObject.GetComponent<DoorDashEffect>();
		if ((Object)(object)component != (Object)null)
		{
			Object.Destroy((Object)(object)component);
		}
	}
}
public class DoorDashEffect : MonoBehaviour
{
	private Player _player;

	private Block _block;

	private HealthHandler _health;

	private Action<BlockTriggerType> _blockHandler;

	private bool _subscribed;

	private float _baselineMoveSpeed = float.NaN;

	private float _baselineJump = float.NaN;

	private float _baselineGravity = float.NaN;

	private float _slowUntil;

	private Coroutine _countdown;

	private CharacterStatModifiers GetStats()
	{
		if (!((Object)(object)_player != (Object)null))
		{
			return null;
		}
		return ((Component)_player).GetComponent<CharacterStatModifiers>();
	}

	private void Start()
	{
		_player = ((Component)this).GetComponent<Player>();
		if (!((Object)(object)_player?.data?.block == (Object)null))
		{
			_block = _player.data.block;
			_health = _player.data.healthHandler;
			Subscribe();
		}
	}

	private void OnEnable()
	{
		if ((Object)(object)_block != (Object)null)
		{
			Subscribe();
		}
	}

	private void OnDisable()
	{
		Unsubscribe();
		ForceRestoreStats("OnDisable");
	}

	private void OnDestroy()
	{
		Unsubscribe();
		StopCountdownCoroutine();
		ForceRestoreStats("OnDestroy");
	}

	internal static float DebuffSecondsForHeal(float healAmount)
	{
		return Mathf.Clamp(Mathf.Floor(healAmount / 5f), 1f, 5f);
	}

	private void Subscribe()
	{
		if (!_subscribed && !((Object)(object)_block == (Object)null))
		{
			_blockHandler = OnBlock;
			_block.BlockAction = (Action<BlockTriggerType>)Delegate.Combine(_block.BlockAction, _blockHandler);
			_subscribed = true;
		}
	}

	private void Unsubscribe()
	{
		if (_subscribed && !((Object)(object)_block == (Object)null) && _blockHandler != null)
		{
			_block.BlockAction = (Action<BlockTriggerType>)Delegate.Remove(_block.BlockAction, _blockHandler);
			_subscribed = false;
		}
	}

	private void OnBlock(BlockTriggerType t)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		if ((int)t != 0 || (Object)(object)_player?.data == (Object)null || (Object)(object)_health == (Object)null)
		{
			return;
		}
		float num = Mathf.Max(0f, _player.data.maxHealth - _player.data.health);
		if (num <= 0.01f)
		{
			return;
		}
		float num2 = num * 0.5f;
		_health.Heal(num2);
		float num3 = DebuffSecondsForHeal(num2);
		CharacterStatModifiers stats = GetStats();
		if (!((Object)(object)stats == (Object)null))
		{
			ApplyOrRefreshBaseline(stats);
			float slowUntil = Mathf.Max(Time.time + num3, _slowUntil);
			_slowUntil = slowUntil;
			if (_countdown == null)
			{
				_countdown = ((MonoBehaviour)this).StartCoroutine(CountUntilRestore());
			}
		}
	}

	private void ApplyOrRefreshBaseline(CharacterStatModifiers sm)
	{
		if (float.IsNaN(_baselineMoveSpeed))
		{
			_baselineMoveSpeed = sm.movementSpeed;
			_baselineJump = sm.jump;
			_baselineGravity = sm.gravity;
			sm.movementSpeed *= 0.52f;
			sm.jump = 0f;
			sm.gravity *= 1.65f;
		}
	}

	private IEnumerator CountUntilRestore()
	{
		CharacterStatModifiers sm = GetStats();
		if (!((Object)(object)sm == (Object)null))
		{
			WaitForSeconds waitStep = new WaitForSeconds(0.05f);
			while (_slowUntil > Time.time)
			{
				yield return waitStep;
			}
			if ((Object)(object)sm != (Object)null && !float.IsNaN(_baselineMoveSpeed))
			{
				sm.movementSpeed = _baselineMoveSpeed;
				sm.jump = _baselineJump;
				sm.gravity = _baselineGravity;
			}
			_baselineMoveSpeed = float.NaN;
			_baselineJump = float.NaN;
			_baselineGravity = float.NaN;
			_slowUntil = 0f;
			_countdown = null;
		}
	}

	private void StopCountdownCoroutine()
	{
		if (_countdown != null)
		{
			((MonoBehaviour)this).StopCoroutine(_countdown);
			_countdown = null;
		}
	}

	private void ForceRestoreStats(string _)
	{
		StopCountdownCoroutine();
		CharacterStatModifiers stats = GetStats();
		if ((Object)(object)stats != (Object)null && !float.IsNaN(_baselineMoveSpeed))
		{
			stats.movementSpeed = _baselineMoveSpeed;
			stats.jump = _baselineJump;
			stats.gravity = _baselineGravity;
		}
		_baselineMoveSpeed = float.NaN;
		_baselineJump = float.NaN;
		_baselineGravity = float.NaN;
		_slowUntil = 0f;
	}
}
public class DylartilleryCard : CustomCard
{
	protected override string GetTitle()
	{
		return "Dylartillery";
	}

	protected override string GetDescription()
	{
		return "Your primary fire originates from the ceiling and rains straight down.";
	}

	protected override GameObject GetCardArt()
	{
		return null;
	}

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

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

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

	public override string GetModName()
	{
		return "MFWB";
	}

	public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
	{
	}

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

	public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
	{
		DylartilleryEffect component = ((Component)player).gameObject.GetComponent<DylartilleryEffect>();
		if ((Object)(object)component != (Object)null)
		{
			Object.Destroy((Object)(object)component);
		}
	}
}
public class DylartilleryEffect : MonoBehaviour
{
	private const float HeightAboveCamera = 2f;

	private const float FallbackHeight = 25f;

	private const float MinFallSpeed = 28f;

	private const float HorizontalSpreadHalfWidth = 0.55f;

	private const float DownAngleSpread = 11f;

	private Player _player;

	private Gun _gun;

	private Action<GameObject> _handler;

	private bool _subscribed;

	private void Start()
	{
		_player = ((Component)this).GetComponent<Player>();
		if (!((Object)(object)_player == (Object)null) && !((Object)(object)_player.data == (Object)null) && !((Object)(object)_player.data.weaponHandler == (Object)null))
		{
			_gun = _player.data.weaponHandler.gun;
			Subscribe();
		}
	}

	private void OnEnable()
	{
		if ((Object)(object)_gun != (Object)null)
		{
			Subscribe();
		}
	}

	private void OnDisable()
	{
		Unsubscribe();
	}

	private void OnDestroy()
	{
		Unsubscribe();
	}

	private void Subscribe()
	{
		if (!_subscribed && !((Object)(object)_gun == (Object)null))
		{
			_handler = OnProjectileSpawned;
			_gun.ShootPojectileAction = (Action<GameObject>)Delegate.Combine(_gun.ShootPojectileAction, _handler);
			_subscribed = true;
		}
	}

	private void Unsubscribe()
	{
		if (_subscribed && !((Object)(object)_gun == (Object)null) && _handler != null)
		{
			_gun.ShootPojectileAction = (Action<GameObject>)Delegate.Remove(_gun.ShootPojectileAction, _handler);
			_subscribed = false;
		}
	}

	private void OnProjectileSpawned(GameObject projectile)
	{
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0110: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: Unknown result type (might be due to invalid IL or missing references)
		//IL_014a: Unknown result type (might be due to invalid IL or missing references)
		//IL_015c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_0166: Unknown result type (might be due to invalid IL or missing references)
		//IL_016a: Unknown result type (might be due to invalid IL or missing references)
		//IL_016c: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)projectile == (Object)null || (Object)(object)_player == (Object)null)
		{
			return;
		}
		Camera main = Camera.main;
		float altitudeY = ((!((Object)(object)main != (Object)null) || !main.orthographic) ? (((Component)_player).transform.position.y + 25f) : (((Component)main).transform.position.y + main.orthographicSize + 2f));
		Vector3 position = ((Component)_player).transform.position;
		Vector3 position2 = AimOnHorizontalPlane(main, altitudeY, position);
		position2.x += Random.Range(-0.55f, 0.55f);
		position2.z = projectile.transform.position.z;
		projectile.transform.position = position2;
		float num = Random.Range(-11f, 11f);
		projectile.transform.rotation = Quaternion.Euler(0f, 0f, -90f + num);
		MoveTransform component = projectile.GetComponent<MoveTransform>();
		if ((Object)(object)component != (Object)null)
		{
			Vector3 velocity = component.velocity;
			Vector2 val = new Vector2(velocity.x, velocity.y);
			float num2 = ((Vector2)(ref val)).magnitude;
			if (num2 < 28f)
			{
				num2 = 28f;
			}
			Vector3 velocity2 = Quaternion.Euler(0f, 0f, num) * new Vector3(0f, 0f - num2, 0f);
			component.velocity = velocity2;
		}
	}

	private static Vector3 AimOnHorizontalPlane(Camera cam, float altitudeY, Vector3 fallback)
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: 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_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)cam == (Object)null)
		{
			return fallback;
		}
		Ray val = cam.ScreenPointToRay(Input.mousePosition);
		float y = ((Ray)(ref val)).direction.y;
		if (Mathf.Abs(y) < 0.0001f)
		{
			return new Vector3(fallback.x, altitudeY, fallback.z);
		}
		float num = (altitudeY - ((Ray)(ref val)).origin.y) / y;
		float num2 = ((Ray)(ref val)).origin.x + ((Ray)(ref val)).direction.x * num;
		float num3 = ((Ray)(ref val)).origin.z + ((Ray)(ref val)).direction.z * num;
		return new Vector3(num2, altitudeY, num3);
	}
}
public class KomodoConfidenceCard : CustomCard
{
	protected override string GetTitle()
	{
		return "Komodo Confidence";
	}

	protected override string GetDescription()
	{
		return "\"Fake it 'til you make it\": when your bullets are punching above their tiny damage numbers they show up chunky; once real damage climbs, they tuck back toward respectable size—but other size cards still add on top.";
	}

	protected override GameObject GetCardArt()
	{
		return null;
	}

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

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

	protected override CardInfoStat[] GetStats()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: 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_002b: Expected O, but got Unknown
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Expected O, but got Unknown
		return (CardInfoStat[])(object)new CardInfoStat[2]
		{
			new CardInfoStat
			{
				positive = true,
				stat = "Low-damage swagger",
				amount = "~+80% projectile bulk when dmg is tiny"
			},
			new CardInfoStat
			{
				positive = false,
				stat = "Higher damage",
				amount = "~7% tighter than vanilla at full bore"
			}
		};
	}

	public override string GetModName()
	{
		return "MFWB";
	}

	public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
	{
	}

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

	public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
	{
		KomodoConfidenceEffect component = ((Component)player).gameObject.GetComponent<KomodoConfidenceEffect>();
		if ((Object)(object)component != (Object)null)
		{
			Object.Destroy((Object)(object)component);
		}
	}
}
public class KomodoConfidenceEffect : MonoBehaviour
{
	private const float SoftDamage = 0.12f;

	private const float FirmDamage = 95f;

	private const float BigShowMul = 1.78f;

	private const float TightMul = 0.93f;

	private Player _player;

	private Gun _gun;

	private Action<GameObject> _handler;

	private bool _subscribed;

	private void Start()
	{
		_player = ((Component)this).GetComponent<Player>();
		if (!((Object)(object)_player?.data?.weaponHandler?.gun == (Object)null))
		{
			_gun = _player.data.weaponHandler.gun;
			Subscribe();
		}
	}

	private void OnEnable()
	{
		if ((Object)(object)_gun != (Object)null)
		{
			Subscribe();
		}
	}

	private void OnDisable()
	{
		Unsubscribe();
	}

	private void OnDestroy()
	{
		Unsubscribe();
	}

	private void Subscribe()
	{
		if (!_subscribed && !((Object)(object)_gun == (Object)null))
		{
			_handler = OnSpawn;
			_gun.ShootPojectileAction = (Action<GameObject>)Delegate.Combine(_gun.ShootPojectileAction, _handler);
			_subscribed = true;
		}
	}

	private void Unsubscribe()
	{
		if (_subscribed && !((Object)(object)_gun == (Object)null) && _handler != null)
		{
			_gun.ShootPojectileAction = (Action<GameObject>)Delegate.Remove(_gun.ShootPojectileAction, _handler);
			_subscribed = false;
		}
	}

	private void OnSpawn(GameObject projectile)
	{
		if (!((Object)(object)projectile == (Object)null) && !((Object)(object)_gun == (Object)null))
		{
			float softness = InverseDamageFactor(_gun);
			((MonoBehaviour)this).StartCoroutine(ReapplySizing(projectile, softness));
		}
	}

	private float InverseDamageFactor(Gun gun)
	{
		float num = Mathf.Max(gun.damage * Mathf.Max(0.0001f, gun.bulletDamageMultiplier), 0.03f);
		float num2 = Mathf.InverseLerp(0.12f, 95f, num);
		num2 = Mathf.Clamp01(num2);
		return 1f - num2;
	}

	private IEnumerator ReapplySizing(GameObject projectile, float softness)
	{
		if (!((Object)(object)projectile == (Object)null))
		{
			yield return null;
			yield return null;
			float num = Mathf.Lerp(1.78f, 0.93f, 1f - softness);
			num = Mathf.Clamp(num, 0.93f, 1.86f);
			Transform transform = projectile.transform;
			transform.localScale *= num;
			RayCastTrail componentInChildren = projectile.GetComponentInChildren<RayCastTrail>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				float num2 = Mathf.Lerp(0.14f, 0f, 1f - softness);
				componentInChildren.extraSize += num2;
			}
		}
	}
}
public class LeavingYourMarkCard : CustomCard
{
	protected override string GetTitle()
	{
		return "Leaving Your Mark";
	}

	protected override string GetDescription()
	{
		return "When you take real HP damage you retaliate: a quick burst and a brief hot spot on the ground. Throttled so it is not every chip of damage.";
	}

	protected override GameObject GetCardArt()
	{
		return null;
	}

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

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

	protected override CardInfoStat[] GetStats()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: 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_002b: Expected O, but got Unknown
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Expected O, but got Unknown
		return (CardInfoStat[])(object)new CardInfoStat[2]
		{
			new CardInfoStat
			{
				positive = true,
				stat = "Retaliation",
				amount = "Burst + short hazard on taking HP loss"
			},
			new CardInfoStat
			{
				positive = false,
				stat = "Cooldown",
				amount = "~0.38s between procs"
			}
		};
	}

	public override string GetModName()
	{
		return "MFWB";
	}

	public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
	{
	}

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

	public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
	{
		LeavingYourMarkEffect component = ((Component)player).gameObject.GetComponent<LeavingYourMarkEffect>();
		if ((Object)(object)component != (Object)null)
		{
			Object.Destroy((Object)(object)component);
		}
	}
}
public class LeavingYourMarkEffect : MonoBehaviour
{
	private const float ThrottleSeconds = 0.38f;

	private const int BurstCount = 8;

	private const float ZoneLifetime = 0.85f;

	private Player _player;

	private Gun _gun;

	private float _lastProc;

	private void Start()
	{
		_player = ((Component)this).GetComponent<Player>();
		if ((Object)(object)_player?.data?.weaponHandler?.gun != (Object)null)
		{
			_gun = _player.data.weaponHandler.gun;
		}
	}

	public void NotifyDamaged(float damageDealt)
	{
		if (!((Object)(object)_player == (Object)null) && !(Time.time - _lastProc < 0.38f))
		{
			_lastProc = Time.time;
			((MonoBehaviour)this).StopAllCoroutines();
			((MonoBehaviour)this).StartCoroutine(ReactRoutine(damageDealt));
		}
	}

	private IEnumerator ReactRoutine(float referenceDamage)
	{
		SpawnBurst(referenceDamage);
		yield return null;
		SpawnZone(referenceDamage);
	}

	private void SpawnBurst(float referenceDamage)
	{
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)_gun == (Object)null) && _gun.projectiles != null && _gun.projectiles.Length != 0)
		{
			float damage = Mathf.Clamp(referenceDamage * 0.22f, 3f, 18f);
			Vector2 val = Vector2.op_Implicit(((Component)_player).transform.position);
			Vector2 val2 = default(Vector2);
			for (int i = 0; i < 8; i++)
			{
				float num = (float)i * (float)Math.PI * 2f / 8f;
				((Vector2)(ref val2))..ctor(Mathf.Cos(num), Mathf.Sin(num));
				GameObject val3 = new GameObject("MFWB_LeavingMarkShard");
				val3.transform.position = Vector2.op_Implicit(val);
				val3.AddComponent<LeavingYourMarkShard>().Setup(_player, damage, val2 * 26f);
			}
		}
	}

	private void SpawnZone(float referenceDamage)
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		float damagePerTick = Mathf.Clamp(referenceDamage * 0.35f, 4f, 14f);
		GameObject val = new GameObject("MFWB_LeavingMarkZone");
		val.transform.position = ((Component)_player).transform.position;
		CircleCollider2D obj = val.AddComponent<CircleCollider2D>();
		((Collider2D)obj).isTrigger = true;
		obj.radius = 1.05f;
		val.AddComponent<LeavingYourMarkHurtZone>().Setup(_player, damagePerTick, 0.85f);
	}
}
public class LeavingYourMarkShard : MonoBehaviour
{
	private Player _owner;

	private float _damage;

	private bool _spent;

	public void Setup(Player owner, float damage, Vector2 velocity)
	{
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		_owner = owner;
		_damage = damage;
		Rigidbody2D obj = ((Component)this).gameObject.AddComponent<Rigidbody2D>();
		obj.gravityScale = 0f;
		obj.collisionDetectionMode = (CollisionDetectionMode2D)1;
		obj.velocity = velocity;
		CircleCollider2D obj2 = ((Component)this).gameObject.AddComponent<CircleCollider2D>();
		((Collider2D)obj2).isTrigger = true;
		obj2.radius = 0.15f;
		Object.Destroy((Object)(object)((Component)this).gameObject, 0.55f);
	}

	private void OnTriggerEnter2D(Collider2D col)
	{
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		if (!_spent)
		{
			HealthHandler componentInParent = ((Component)col).GetComponentInParent<HealthHandler>();
			Player val = MfwbHealth.PlayerOf(componentInParent);
			if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)_owner))
			{
				_spent = true;
				Bounds bounds = col.bounds;
				Vector2 val2 = Vector2.op_Implicit(((Bounds)(ref bounds)).center);
				((Damagable)componentInParent).CallTakeDamage(new Vector2(_damage, 0f), val2, (GameObject)null, _owner, false);
			}
		}
	}
}
public class LeavingYourMarkHurtZone : MonoBehaviour
{
	private Player _owner;

	private float _damagePerTick;

	private float _until;

	private float _lastTick;

	public void Setup(Player owner, float damagePerTick, float lifetime)
	{
		_owner = owner;
		_damagePerTick = damagePerTick;
		_until = Time.time + lifetime;
	}

	private void Update()
	{
		if (Time.time > _until)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}

	private void OnTriggerStay2D(Collider2D col)
	{
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		if (!(Time.time > _until))
		{
			HealthHandler componentInParent = ((Component)col).GetComponentInParent<HealthHandler>();
			Player val = MfwbHealth.PlayerOf(componentInParent);
			if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)_owner) && !(Time.time - _lastTick < 0.13f))
			{
				_lastTick = Time.time;
				Bounds bounds = col.bounds;
				Vector2 val2 = Vector2.op_Implicit(((Bounds)(ref bounds)).center);
				((Damagable)componentInParent).CallTakeDamage(new Vector2(_damagePerTick, 0f), val2, (GameObject)null, _owner, false);
			}
		}
	}
}
[HarmonyPatch]
public static class LeavingYourMarkTakeDamagePatches
{
	public static IEnumerable<MethodBase> TargetMethods()
	{
		yield return AccessTools.Method(typeof(HealthHandler), "TakeDamage", new Type[6]
		{
			typeof(Vector2),
			typeof(Vector2),
			typeof(GameObject),
			typeof(Player),
			typeof(bool),
			typeof(bool)
		}, (Type[])null);
		yield return AccessTools.Method(typeof(HealthHandler), "TakeDamage", new Type[7]
		{
			typeof(Vector2),
			typeof(Vector2),
			typeof(Color),
			typeof(GameObject),
			typeof(Player),
			typeof(bool),
			typeof(bool)
		}, (Type[])null);
	}

	[HarmonyPrefix]
	public static void Prefix(HealthHandler __instance, ref float __state)
	{
		CharacterData val = MfwbHealth.DataOf(__instance);
		__state = (((Object)(object)val != (Object)null) ? val.health : 0f);
	}

	[HarmonyPostfix]
	public static void Postfix(HealthHandler __instance, float __state)
	{
		CharacterData val = MfwbHealth.DataOf(__instance);
		Player val2 = MfwbHealth.PlayerOf(__instance);
		if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val == (Object)null))
		{
			float num = __state - val.health;
			if (!(num <= 0.05f))
			{
				((Component)val2).GetComponent<LeavingYourMarkEffect>()?.NotifyDamaged(num);
			}
		}
	}
}
public class LowBlowCard : CustomCard
{
	protected override string GetTitle()
	{
		return "Low Blow";
	}

	protected override string GetDescription()
	{
		return "Your primary bullets tag for bonus damage when they connect from below your target.";
	}

	protected override GameObject GetCardArt()
	{
		return null;
	}

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

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

	protected override CardInfoStat[] GetStats()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: 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_0047: Expected O, but got Unknown
		return (CardInfoStat[])(object)new CardInfoStat[1]
		{
			new CardInfoStat
			{
				positive = true,
				stat = "Low hits",
				amount = "+" + Mathf.RoundToInt(39.999996f) + "% damage"
			}
		};
	}

	public override string GetModName()
	{
		return "MFWB";
	}

	public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
	{
	}

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

	public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
	{
		LowBlowEffect component = ((Component)player).gameObject.GetComponent<LowBlowEffect>();
		if (!((Object)(object)component == (Object)null))
		{
			component.RemoveStack();
			if (component.Stacks <= 0)
			{
				Object.Destroy((Object)(object)component);
			}
		}
	}
}
public class LowBlowEffect : MonoBehaviour
{
	private Player _player;

	private Gun _gun;

	private Action<GameObject> _handler;

	private bool _subscribed;

	public int Stacks { get; private set; }

	public void AddStack()
	{
		Stacks = Mathf.Max(1, Stacks + 1);
	}

	public void RemoveStack()
	{
		Stacks = Mathf.Max(0, Stacks - 1);
	}

	private void Start()
	{
		_player = ((Component)this).GetComponent<Player>();
		if (!((Object)(object)_player?.data?.weaponHandler?.gun == (Object)null))
		{
			_gun = _player.data.weaponHandler.gun;
			Subscribe();
		}
	}

	private void OnEnable()
	{
		if ((Object)(object)_gun != (Object)null)
		{
			Subscribe();
		}
	}

	private void OnDisable()
	{
		Unsubscribe();
	}

	private void OnDestroy()
	{
		Unsubscribe();
	}

	private void Subscribe()
	{
		if (!_subscribed && !((Object)(object)_gun == (Object)null))
		{
			_handler = OnSpawn;
			_gun.ShootPojectileAction = (Action<GameObject>)Delegate.Combine(_gun.ShootPojectileAction, _handler);
			_subscribed = true;
		}
	}

	private void Unsubscribe()
	{
		if (_subscribed && !((Object)(object)_gun == (Object)null) && _handler != null)
		{
			_gun.ShootPojectileAction = (Action<GameObject>)Delegate.Remove(_gun.ShootPojectileAction, _handler);
			_subscribed = false;
		}
	}

	private void OnSpawn(GameObject projectile)
	{
		if (!((Object)(object)projectile == (Object)null) && Stacks > 0)
		{
			LowBlowProjectileTag lowBlowProjectileTag = projectile.GetComponent<LowBlowProjectileTag>();
			if ((Object)(object)lowBlowProjectileTag == (Object)null)
			{
				lowBlowProjectileTag = projectile.gameObject.AddComponent<LowBlowProjectileTag>();
			}
			lowBlowProjectileTag.Enabled = true;
			lowBlowProjectileTag.Multiplier = 1f + 0.39999998f * (float)Mathf.Max(1, Stacks);
		}
	}
}
[HarmonyPatch(typeof(ProjectileHit), "Hit", new Type[]
{
	typeof(HitInfo),
	typeof(bool)
})]
public static class LowBlowHitPatch
{
	public const float DefaultMultiplier = 1.4f;

	[HarmonyPrefix]
	public static void Prefix(ProjectileHit __instance, HitInfo hit)
	{
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		LowBlowProjectileTag component = ((Component)__instance).GetComponent<LowBlowProjectileTag>();
		if ((Object)(object)component == (Object)null || !component.Enabled || (Object)(object)__instance.ownPlayer == (Object)null || (Object)(object)hit.collider == (Object)null)
		{
			return;
		}
		HealthHandler componentInParent = ((Component)hit.collider).GetComponentInParent<HealthHandler>();
		Player val = MfwbHealth.PlayerOf(componentInParent);
		if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)__instance.ownPlayer))
		{
			float y = ((Component)componentInParent).transform.position.y;
			if (!(((Component)__instance).transform.position.y >= y - 0.18f))
			{
				__instance.damage *= component.Multiplier;
			}
		}
	}
}
public class LowBlowProjectileTag : MonoBehaviour
{
	public bool Enabled = true;

	public float Multiplier = 1.4f;
}
internal static class MfwbHealth
{
	internal static Player PlayerOf(HealthHandler h)
	{
		if ((Object)(object)h == (Object)null)
		{
			return null;
		}
		object value = Traverse.Create((object)h).Field("player").GetValue();
		return (Player)((value is Player) ? value : null);
	}

	internal static CharacterData DataOf(HealthHandler h)
	{
		if ((Object)(object)h == (Object)null)
		{
			return null;
		}
		object value = Traverse.Create((object)h).Field("data").GetValue();
		return (CharacterData)((value is CharacterData) ? value : null);
	}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("keller.rounds.moonfacewaterbottle", "Moon Face Water Bottle", "2.0.1")]
[BepInProcess("Rounds.exe")]
public class MoonFaceWaterBottlePlugin : BaseUnityPlugin
{
	public const string ModId = "keller.rounds.moonfacewaterbottle";

	public const string ModName = "Moon Face Water Bottle";

	public const string Version = "2.0.1";

	public const string ModInitials = "MFWB";

	private void Awake()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		new Harmony("keller.rounds.moonfacewaterbottle").PatchAll();
	}

	private void Start()
	{
		PipeGongRoundHook.Register();
		CustomCard.BuildCard<DylartilleryCard>();
		CustomCard.BuildCard<DoorDashCard>();
		CustomCard.BuildCard<KomodoConfidenceCard>();
		CustomCard.BuildCard<LeavingYourMarkCard>();
		CustomCard.BuildCard<LowBlowCard>();
		CustomCard.BuildCard<OrbitBuddyCard>();
		CustomCard.BuildCard<PipeGongCard>();
	}
}
public class OrbitBuddyCard : CustomCard
{
	protected override string GetTitle()
	{
		return "Orbit Buddy";
	}

	protected override string GetDescription()
	{
		return "A soft-body buddy orbits around you damped-like. Each primary launches an extra kinetic pellet from your buddy, aimed with your gun. Stacks boost damage. Buddy shots spawn only on your client (local pellet) — multiplayer behaviour may differ from vanilla bullets.";
	}

	protected override GameObject GetCardArt()
	{
		return null;
	}

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

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

	protected override CardInfoStat[] GetStats()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: 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_002b: Expected O, but got Unknown
		return (CardInfoStat[])(object)new CardInfoStat[1]
		{
			new CardInfoStat
			{
				positive = true,
				stat = "Buddy shot",
				amount = "~+10× gun dmg mult per stack — local proj"
			}
		};
	}

	public override string GetModName()
	{
		return "MFWB";
	}

	public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
	{
	}

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

	public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
	{
		OrbitBuddyEffect component = ((Component)player).gameObject.GetComponent<OrbitBuddyEffect>();
		if (!((Object)(object)component == (Object)null))
		{
			component.RemoveStack();
			if (component.Stacks <= 0)
			{
				Object.Destroy((Object)(object)component);
			}
		}
	}
}
public class OrbitBuddyEffect : MonoBehaviour
{
	private const float OrbitRadius = 1.05f;

	private const float OrbitSpeed = 2.05f;

	private const float SmoothTime = 0.09f;

	private Player _player;

	private Gun _gun;

	private GameObject _pet;

	private Action<GameObject> _shootHook;

	private bool _hooked;

	private float _orbitAngle;

	private Vector3 _smoothVel;

	public int Stacks { get; private set; }

	public void AddStack()
	{
		Stacks = Mathf.Max(1, Stacks + 1);
	}

	public void RemoveStack()
	{
		Stacks = Mathf.Max(0, Stacks - 1);
	}

	private void Start()
	{
		_player = ((Component)this).GetComponent<Player>();
		if (!((Object)(object)_player?.data?.weaponHandler?.gun == (Object)null))
		{
			_gun = _player.data.weaponHandler.gun;
			EnsurePet();
			Subscribe();
		}
	}

	private void OnEnable()
	{
		if ((Object)(object)_gun != (Object)null)
		{
			Subscribe();
		}
	}

	private void OnDisable()
	{
		Unsubscribe();
	}

	private void OnDestroy()
	{
		Unsubscribe();
		if ((Object)(object)_pet != (Object)null)
		{
			Object.Destroy((Object)(object)_pet);
		}
	}

	private static bool HasLocalAuthority(Player player)
	{
		if ((Object)(object)player?.data?.view == (Object)null)
		{
			return true;
		}
		return player.data.view.IsMine;
	}

	private void EnsurePet()
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Expected O, but got Unknown
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Expected O, but got Unknown
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)_pet != (Object)null) && !((Object)(object)_player == (Object)null))
		{
			Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false)
			{
				wrapMode = (TextureWrapMode)1,
				filterMode = (FilterMode)1
			};
			val.SetPixels((Color[])(object)new Color[4]
			{
				Color.white,
				Color.white,
				Color.white,
				Color.white
			});
			val.Apply(false);
			_pet = new GameObject("MFWB_OrbitBuddyPet");
			Sprite sprite = Sprite.Create(val, new Rect(0f, 0f, 2f, 2f), new Vector2(0.5f, 0.5f), 16f);
			SpriteRenderer obj = _pet.AddComponent<SpriteRenderer>();
			obj.sprite = sprite;
			obj.color = new Color(0.45f, 0.92f, 1f, 0.94f);
			_pet.transform.localScale = Vector3.one * 0.35f;
			_pet.transform.position = PlayerAnchor() + Vector3.right * 1.05f;
		}
	}

	private Vector3 PlayerAnchor()
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)_player != (Object)null))
		{
			return Vector3.zero;
		}
		return ((Component)_player).transform.position;
	}

	private void LateUpdate()
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)_player == (Object)null) && !((Object)(object)_pet == (Object)null))
		{
			Vector3 val = PlayerAnchor();
			_orbitAngle += 2.05f * Time.deltaTime;
			Vector3 val2 = val + new Vector3(Mathf.Cos(_orbitAngle) * 1.05f, Mathf.Sin(_orbitAngle) * 1.05f, 0f);
			_pet.transform.position = Vector3.SmoothDamp(_pet.transform.position, val2, ref _smoothVel, 0.09f);
			Vector3 position = _pet.transform.position;
			position.z = val.z;
			_pet.transform.position = position;
		}
	}

	private void Subscribe()
	{
		if (!_hooked && !((Object)(object)_gun == (Object)null))
		{
			_shootHook = OnPrimarySpawn;
			_gun.ShootPojectileAction = (Action<GameObject>)Delegate.Combine(_gun.ShootPojectileAction, _shootHook);
			_hooked = true;
		}
	}

	private void Unsubscribe()
	{
		if (_hooked && !((Object)(object)_gun == (Object)null) && _shootHook != null)
		{
			_gun.ShootPojectileAction = (Action<GameObject>)Delegate.Remove(_gun.ShootPojectileAction, _shootHook);
			_hooked = false;
		}
	}

	private void OnPrimarySpawn(GameObject _)
	{
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Expected O, but got Unknown
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Unknown result type (might be due to invalid IL or missing references)
		//IL_011a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0146: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)_gun == (Object)null) && !((Object)(object)_player == (Object)null) && Stacks > 0 && HasLocalAuthority(_player))
		{
			Vector3 position = (((Object)(object)_pet != (Object)null) ? _pet.transform.position : PlayerAnchor());
			Vector2 aimDirection = GetAimDirection();
			float damagePerHit = Mathf.Clamp(_gun.damage * Mathf.Max(0.08f, _gun.bulletDamageMultiplier) * 4.2f * (float)Stacks, 7f, 85f);
			float num = Mathf.Clamp(_gun.projectileSpeed * 38f + 28f + _gun.damage * 6f * (float)Stacks, 32f, 170f);
			GameObject val = new GameObject("MFWB_OrbitBuddyPelletVisual");
			val.transform.position = position;
			val.transform.position = new Vector3(val.transform.position.x, val.transform.position.y, PlayerAnchor().z);
			val.AddComponent<OrbitBuddyPellet>().Initialize(_player, aimDirection * num, damagePerHit);
		}
	}

	private Vector2 GetAimDirection()
	{
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)_gun != (Object)null && (Object)(object)_gun.shootPosition != (Object)null)
		{
			Vector2 val = Vector2.op_Implicit(_gun.shootPosition.right);
			if (!(((Vector2)(ref val)).sqrMagnitude > 1E-05f))
			{
				return Vector2.right;
			}
			return ((Vector2)(ref val)).normalized;
		}
		return Vector2.right;
	}
}
internal sealed class OrbitBuddyPellet : MonoBehaviour
{
	private Player _owner;

	private Vector2 _velocity;

	private float _damage;

	private bool _spent;

	private Rigidbody2D _rb;

	public void Initialize(Player owner, Vector2 velocity, float damagePerHit)
	{
		//IL_0008: 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)
		_owner = owner;
		_velocity = velocity;
		_damage = damagePerHit;
	}

	private void Start()
	{
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		_rb = ((Component)this).gameObject.AddComponent<Rigidbody2D>();
		_rb.bodyType = (RigidbodyType2D)0;
		_rb.gravityScale = 0f;
		_rb.constraints = (RigidbodyConstraints2D)4;
		_rb.collisionDetectionMode = (CollisionDetectionMode2D)1;
		_rb.velocity = _velocity;
		CircleCollider2D obj = ((Component)this).gameObject.AddComponent<CircleCollider2D>();
		obj.radius = 0.16f;
		((Collider2D)obj).isTrigger = true;
		Object.Destroy((Object)(object)((Component)this).gameObject, 3f);
	}

	private void OnTriggerEnter2D(Collider2D col)
	{
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		if (!_spent && !((Object)(object)_owner == (Object)null))
		{
			HealthHandler componentInParent = ((Component)col).GetComponentInParent<HealthHandler>();
			Player val = MfwbHealth.PlayerOf(componentInParent);
			if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)_owner))
			{
				_spent = true;
				Vector2 val2 = Vector2.op_Implicit(((Component)componentInParent).transform.position);
				((Damagable)componentInParent).CallTakeDamage(new Vector2(_damage, _damage), val2, ((Component)this).gameObject, _owner, false);
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
}
public class PipeGongCard : CustomCard
{
	protected override string GetTitle()
	{
		return "Pipe Gong";
	}

	protected override string GetDescription()
	{
		return "When you win a round, celebrate with a sharp metal clang (local-only SFX).";
	}

	protected override GameObject GetCardArt()
	{
		return null;
	}

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

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

	protected override CardInfoStat[] GetStats()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: 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_002b: Expected O, but got Unknown
		return (CardInfoStat[])(object)new CardInfoStat[1]
		{
			new CardInfoStat
			{
				positive = true,
				stat = "Round win",
				amount = "Clang!"
			}
		};
	}

	public override string GetModName()
	{
		return "MFWB";
	}

	public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
	{
	}

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

	public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
	{
		PipeGongTracker component = ((Component)player).gameObject.GetComponent<PipeGongTracker>();
		if ((Object)(object)component != (Object)null)
		{
			Object.Destroy((Object)(object)component);
		}
	}
}
public static class PipeGongRoundHook
{
	private static bool _registered;

	internal static void Register()
	{
		if (!_registered)
		{
			_registered = true;
			GameModeManager.AddHook("RoundEnd", (Func<IGameModeHandler, IEnumerator>)OnRoundEnd);
		}
	}

	private static IEnumerator OnRoundEnd(IGameModeHandler gm)
	{
		if (gm == null)
		{
			yield break;
		}
		int[] roundWinners = gm.GetRoundWinners();
		if (roundWinners == null || roundWinners.Length == 0)
		{
			yield break;
		}
		Player val = null;
		foreach (Player player in PlayerManager.instance.players)
		{
			if ((Object)(object)player?.data?.view != (Object)null && player.data.view.IsMine)
			{
				val = player;
				break;
			}
		}
		if ((Object)(object)val == (Object)null || (Object)(object)((Component)val).GetComponent<PipeGongTracker>() == (Object)null)
		{
			yield break;
		}
		bool flag = false;
		int[] array = roundWinners;
		for (int i = 0; i < array.Length; i++)
		{
			if (array[i] == val.teamID)
			{
				flag = true;
				break;
			}
		}
		if (flag)
		{
			PipeGongAudio.PlayNonBlocking();
		}
	}
}
internal static class PipeGongAudio
{
	private static AudioClip _clip;

	public static void PlayNonBlocking()
	{
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)_clip == (Object)null)
		{
			_clip = BuildClangClip();
		}
		Vector3 val = (((Object)(object)Camera.main != (Object)null) ? ((Component)Camera.main).transform.position : Vector3.zero);
		AudioSource.PlayClipAtPoint(_clip, val, 0.65f);
	}

	private static AudioClip BuildClangClip()
	{
		float num = 0.35f;
		int num2 = (int)(44100f * num);
		float[] array = new float[num2];
		Random random = new Random(42);
		for (int i = 0; i < num2; i++)
		{
			float num3 = (float)i / 44100f;
			float num4 = Mathf.Exp((0f - num3) * 7f);
			float num5 = 580f;
			float num6 = 1220f;
			float num7 = Mathf.Sin((float)Math.PI * 2f * num5 * num3) * 0.55f + Mathf.Sin((float)Math.PI * 2f * num6 * num3) * 0.35f;
			float num8 = (float)(random.NextDouble() * 2.0 - 1.0) * 0.12f;
			array[i] = Mathf.Clamp((num7 + num8) * num4, -1f, 1f);
		}
		AudioClip obj = AudioClip.Create("MFWB_PipeGongClang", num2, 1, 44100, false);
		obj.SetData(array, 0);
		return obj;
	}
}
public class PipeGongTracker : MonoBehaviour
{
}