Decompiled source of Minions v1.0.0

Minions.dll

Decompiled 8 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using UnboundLib;
using UnboundLib.Cards;
using UnityEngine;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Minions")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Minions")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("6d3bc1b3-c9c8-421b-be30-a66f50d448a2")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LandmineMod;

public class BulletPositionTracker : MonoBehaviour
{
	public Vector3 lastValidPosition { get; private set; } = Vector3.zero;

	private void Update()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0041: Unknown result type (might be due to invalid IL or missing references)
		if (((Component)this).transform.position != Vector3.zero)
		{
			Vector3 position = ((Component)this).transform.position;
			if (((Vector3)(ref position)).sqrMagnitude > 0.1f)
			{
				lastValidPosition = ((Component)this).transform.position;
			}
		}
	}
}
public class DroneBehavior : MinionBehavior
{
	public float moveSpeed = 8f;

	public float shootRange = 12f;

	public float explosionRadius = 4f;

	public float explosionDamage = 50f;

	private Rigidbody2D rb;

	private Player targetPlayer;

	private static Sprite bulletSprite;

	private void Start()
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Expected O, but got Unknown
		//IL_0028: 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_005e: Unknown result type (might be due to invalid IL or missing references)
		rb = ((Component)this).GetComponent<Rigidbody2D>();
		if ((Object)(object)bulletSprite == (Object)null)
		{
			Texture2D val = new Texture2D(1, 1);
			val.SetPixel(0, 0, Color.yellow);
			val.Apply();
			bulletSprite = Sprite.Create(val, new Rect(0f, 0f, 1f, 1f), new Vector2(0.5f, 0.5f));
		}
		((MonoBehaviour)this).StartCoroutine(LifeTimer());
		((MonoBehaviour)this).StartCoroutine(ShootRoutine());
	}

	private void FixedUpdate()
	{
		//IL_0027: 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_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_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: 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_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		FindTarget();
		if ((Object)(object)targetPlayer != (Object)null)
		{
			Vector3 val = ((Component)targetPlayer).transform.position - ((Component)this).transform.position;
			Vector2 val2 = Vector2.op_Implicit(((Vector3)(ref val)).normalized);
			float num = Mathf.Atan2(val2.y, val2.x) * 57.29578f;
			((Component)this).transform.rotation = Quaternion.Euler(0f, 0f, num);
			float num2 = Vector2.Distance(Vector2.op_Implicit(((Component)this).transform.position), Vector2.op_Implicit(((Component)targetPlayer).transform.position));
			if (num2 > shootRange)
			{
				rb.velocity = val2 * moveSpeed;
			}
			else
			{
				rb.velocity = Vector2.Lerp(rb.velocity, Vector2.zero, Time.fixedDeltaTime * 5f);
			}
		}
	}

	private void FindTarget()
	{
		targetPlayer = (from p in PlayerManager.instance.players
			where !p.data.dead && p.playerID != ownerID
			orderby Vector2.Distance(Vector2.op_Implicit(((Component)this).transform.position), Vector2.op_Implicit(((Component)p).transform.position))
			select p).FirstOrDefault();
	}

	private IEnumerator ShootRoutine()
	{
		while (true)
		{
			float attackDelay = 1f;
			Player ownerPlayer = ((IEnumerable<Player>)PlayerManager.instance.players).FirstOrDefault((Func<Player, bool>)((Player p) => p.playerID == ownerID));
			if ((Object)(object)ownerPlayer != (Object)null && (Object)(object)ownerPlayer.data?.weaponHandler?.gun != (Object)null)
			{
				Gun ownerGun = ownerPlayer.data.weaponHandler.gun;
				attackDelay = Mathf.Max(0.1f, ownerGun.attackSpeed);
			}
			yield return (object)new WaitForSeconds(attackDelay);
			if ((Object)(object)targetPlayer != (Object)null && Vector2.Distance(Vector2.op_Implicit(((Component)this).transform.position), Vector2.op_Implicit(((Component)targetPlayer).transform.position)) <= shootRange)
			{
				ShootBullet();
			}
		}
	}

	private void ShootBullet()
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_0118: Expected O, but got Unknown
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0135: Unknown result type (might be due to invalid IL or missing references)
		//IL_013a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0158: Unknown result type (might be due to invalid IL or missing references)
		//IL_0179: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)Plugin.LaserSound != (Object)null)
		{
			AudioSource.PlayClipAtPoint(Plugin.LaserSound, ((Component)this).transform.position, 1f);
		}
		float num = 5f;
		Player val = ((IEnumerable<Player>)PlayerManager.instance.players).FirstOrDefault((Func<Player, bool>)((Player p) => p.playerID == ownerID));
		if ((Object)(object)val != (Object)null && (Object)(object)val.data?.weaponHandler?.gun != (Object)null)
		{
			num = val.data.weaponHandler.gun.damage * 0.1f;
		}
		MinionStats ownerStats = GetOwnerStats();
		if ((Object)(object)ownerStats != (Object)null)
		{
			num *= ownerStats.damageMultiplier;
		}
		Vector3 val2 = ((Component)targetPlayer).transform.position - ((Component)this).transform.position;
		Vector2 val3 = Vector2.op_Implicit(((Vector3)(ref val2)).normalized);
		float num2 = Mathf.Atan2(val3.y, val3.x) * 57.29578f;
		GameObject val4 = new GameObject("DroneBullet");
		val4.transform.position = ((Component)this).transform.position + Vector2.op_Implicit(val3) * 0.7f;
		val4.transform.rotation = Quaternion.Euler(0f, 0f, num2);
		val4.transform.localScale = new Vector3(0.5f, 0.15f, 1f);
		SpriteRenderer val5 = val4.AddComponent<SpriteRenderer>();
		val5.sprite = (((Object)(object)Plugin.laserSprite != (Object)null) ? Plugin.laserSprite : bulletSprite);
		((Renderer)val5).sortingLayerName = "Default";
		((Renderer)val5).sortingOrder = 100;
		CircleCollider2D val6 = val4.AddComponent<CircleCollider2D>();
		((Collider2D)val6).isTrigger = true;
		val6.radius = 0.2f;
		Rigidbody2D val7 = val4.AddComponent<Rigidbody2D>();
		val7.bodyType = (RigidbodyType2D)0;
		val7.gravityScale = 0f;
		val7.collisionDetectionMode = (CollisionDetectionMode2D)1;
		DroneBullet droneBullet = val4.AddComponent<DroneBullet>();
		droneBullet.ownerID = ownerID;
		droneBullet.damage = num;
	}

	private IEnumerator LifeTimer()
	{
		yield return (object)new WaitForSeconds(10f);
		Explode();
	}

	private void Explode()
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: 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)
		Player val = ((IEnumerable<Player>)PlayerManager.instance.players).FirstOrDefault((Func<Player, bool>)((Player p) => p.playerID == ownerID));
		Collider2D[] array = Physics2D.OverlapCircleAll(Vector2.op_Implicit(((Component)this).transform.position), explosionRadius);
		Collider2D[] array2 = array;
		foreach (Collider2D val2 in array2)
		{
			Player componentInParent = ((Component)val2).GetComponentInParent<Player>();
			if ((Object)(object)componentInParent != (Object)null)
			{
				Vector3 val3 = ((Component)componentInParent).transform.position - ((Component)this).transform.position;
				Vector2 val4 = Vector2.op_Implicit(((Vector3)(ref val3)).normalized);
				((Damagable)componentInParent.data.healthHandler).TakeDamage(val4 * explosionDamage, Vector2.op_Implicit(((Component)this).transform.position), (GameObject)null, val, true, false);
			}
		}
		Object.Destroy((Object)(object)((Component)this).gameObject);
	}
}
public class DroneBullet : MonoBehaviour
{
	public int ownerID;

	public float damage = 15f;

	public float speed = 25f;

	private void Start()
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		Object.Destroy((Object)(object)((Component)this).gameObject, 3f);
		((Component)this).GetComponent<Rigidbody2D>().velocity = Vector2.op_Implicit(((Component)this).transform.right * speed);
	}

	private void OnTriggerEnter2D(Collider2D col)
	{
		//IL_0056: 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_0071: 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)
		if ((Object)(object)((Component)col).GetComponentInParent<DroneBehavior>() != (Object)null)
		{
			return;
		}
		Player componentInParent = ((Component)col).GetComponentInParent<Player>();
		if ((Object)(object)componentInParent != (Object)null)
		{
			Player val = ((IEnumerable<Player>)PlayerManager.instance.players).FirstOrDefault((Func<Player, bool>)((Player p) => p.playerID == ownerID));
			((Damagable)componentInParent.data.healthHandler).TakeDamage(Vector2.op_Implicit(((Component)this).transform.right * damage), Vector2.op_Implicit(((Component)this).transform.position), (GameObject)null, val, true, false);
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
		else if (!col.isTrigger)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
}
public class DroneCard : CustomCard
{
	public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
	{
		cardInfo.allowMultiple = true;
		block.cdMultiplier = 0.85f;
	}

	public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
	{
		ExtensionMethods.GetOrAddComponent<DroneSpawner>(((Component)player).gameObject, false);
	}

	public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData characterData, HealthHandler healthHandler, Gravity gravity, Block block, CharacterStatModifiers characterStats)
	{
		DroneSpawner component = ((Component)player).gameObject.GetComponent<DroneSpawner>();
		if ((Object)(object)component != (Object)null)
		{
			Object.Destroy((Object)(object)component);
		}
	}

	protected override string GetTitle()
	{
		return "Attack Drone";
	}

	protected override string GetDescription()
	{
		return "Summon a Drone when you block!";
	}

	protected override GameObject GetCardArt()
	{
		return null;
	}

	protected override Rarity GetRarity()
	{
		return (Rarity)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_0050: Expected O, but got Unknown
		return (CardInfoStat[])(object)new CardInfoStat[2]
		{
			new CardInfoStat
			{
				positive = true,
				stat = "Drone",
				amount = "+1"
			},
			new CardInfoStat
			{
				positive = true,
				stat = "Block Cooldown",
				amount = "-15%"
			}
		};
	}

	protected override CardThemeColorType GetTheme()
	{
		return (CardThemeColorType)3;
	}
}
public class DroneSpawner : MonoBehaviour
{
	private Block block;

	private Player player;

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

	private void OnBlock(BlockTriggerType trigger)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = ((Component)this).transform.position + Vector3.up * 1.5f;
		NetworkingManager.RaiseEvent("LandmineMod_SpawnDrone", new object[2] { val, player.playerID });
	}

	private void OnDestroy()
	{
		if ((Object)(object)block != (Object)null)
		{
			Block obj = block;
			obj.BlockAction = (Action<BlockTriggerType>)Delegate.Remove(obj.BlockAction, new Action<BlockTriggerType>(OnBlock));
		}
	}
}
public class LandmineBehavior : MonoBehaviour
{
	public int ownerID;

	public float fuseTime = 5f;

	public float explosionRadius = 3.5f;

	public float damage = 65f;

	public float knockbackForce = 25f;

	private SpriteRenderer spriteRenderer;

	private Light blinkLight;

	private void Start()
	{
		//IL_0031: 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)
		spriteRenderer = ((Component)this).GetComponent<SpriteRenderer>();
		blinkLight = ((Component)this).gameObject.AddComponent<Light>();
		blinkLight.type = (LightType)2;
		blinkLight.color = Color.red;
		blinkLight.range = 4f;
		blinkLight.intensity = 0f;
		((Component)blinkLight).transform.localPosition = new Vector3(0f, 0f, -1f);
		((MonoBehaviour)this).StartCoroutine(FuseRoutine());
	}

	private IEnumerator FuseRoutine()
	{
		int totalBlinks = Mathf.FloorToInt(fuseTime);
		float flashDuration = 0.2f;
		float offDuration = 1f - flashDuration;
		for (int i = 0; i < totalBlinks; i++)
		{
			if ((Object)(object)spriteRenderer != (Object)null)
			{
				spriteRenderer.color = Color.red;
			}
			if ((Object)(object)blinkLight != (Object)null)
			{
				blinkLight.intensity = 8f;
			}
			if ((Object)(object)Plugin.BeepSound != (Object)null)
			{
				AudioSource.PlayClipAtPoint(Plugin.BeepSound, ((Component)this).transform.position, 1f);
			}
			yield return (object)new WaitForSeconds(flashDuration);
			if ((Object)(object)spriteRenderer != (Object)null)
			{
				spriteRenderer.color = Color.white;
			}
			if ((Object)(object)blinkLight != (Object)null)
			{
				blinkLight.intensity = 0f;
			}
			yield return (object)new WaitForSeconds(offDuration);
		}
		Explode();
	}

	private void Explode()
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: 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_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: 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_0115: Unknown result type (might be due to invalid IL or missing references)
		//IL_0119: 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_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: 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_0152: Unknown result type (might be due to invalid IL or missing references)
		//IL_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0162: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Unknown result type (might be due to invalid IL or missing references)
		//IL_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_018b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0193: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)Plugin.ExplosionSound != (Object)null)
		{
			AudioSource.PlayClipAtPoint(Plugin.ExplosionSound, ((Component)this).transform.position, 1f);
		}
		Player val = ((IEnumerable<Player>)PlayerManager.instance.players).FirstOrDefault((Func<Player, bool>)((Player p) => p.playerID == ownerID));
		Explosion val2 = Resources.FindObjectsOfTypeAll<Explosion>().FirstOrDefault();
		if ((Object)(object)val2 != (Object)null)
		{
			GameObject val3 = Object.Instantiate<GameObject>(((Component)val2).gameObject, ((Component)this).transform.position, Quaternion.identity);
			Explosion component = val3.GetComponent<Explosion>();
			component.damage = 0f;
			component.range = explosionRadius;
			component.force = 0f;
		}
		Collider2D[] array = Physics2D.OverlapCircleAll(Vector2.op_Implicit(((Component)this).transform.position), explosionRadius);
		Collider2D[] array2 = array;
		foreach (Collider2D val4 in array2)
		{
			Player component2 = ((Component)val4).GetComponent<Player>();
			if ((Object)(object)component2 != (Object)null)
			{
				Vector3 val5 = ((Component)component2).transform.position - ((Component)this).transform.position;
				Vector2 val6 = Vector2.op_Implicit(((Vector3)(ref val5)).normalized);
				if (val6 == Vector2.zero)
				{
					val6 = Vector2.up;
				}
				((Damagable)component2.data.healthHandler).TakeDamage(val6 * damage, Vector2.op_Implicit(((Component)this).transform.position), (GameObject)null, val, true, false);
				Rigidbody2D component3 = ((Component)component2).GetComponent<Rigidbody2D>();
				if ((Object)(object)component3 != (Object)null)
				{
					component3.AddForce(val6 * knockbackForce, (ForceMode2D)1);
				}
			}
		}
		Object.Destroy((Object)(object)((Component)this).gameObject);
	}
}
public class LandmineCard : CustomCard
{
	public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
	{
		cardInfo.allowMultiple = true;
	}

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

	public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData characterData, HealthHandler healthHandler, Gravity gravity, Block block, CharacterStatModifiers characterStats)
	{
		LandmineBlockHandler component = ((Component)player).GetComponent<LandmineBlockHandler>();
		if ((Object)(object)component != (Object)null)
		{
			component.mineCount--;
			if (component.mineCount <= 0)
			{
				Object.Destroy((Object)(object)component);
			}
		}
	}

	protected override string GetTitle()
	{
		return "Landmine Block";
	}

	protected override string GetDescription()
	{
		return "Spawns a landmine at your feet whenever you block.";
	}

	protected override GameObject GetCardArt()
	{
		return null;
	}

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

	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 = "Mines on Block",
				amount = "+1"
			},
			new CardInfoStat
			{
				positive = true,
				stat = "Fuse Time",
				amount = "5s"
			}
		};
	}

	protected override CardThemeColorType GetTheme()
	{
		return (CardThemeColorType)0;
	}
}
public class LandmineBlockHandler : MonoBehaviour
{
	public Player ownerPlayer;

	public int mineCount = 0;

	private Block block;

	private void Start()
	{
		block = ((Component)this).GetComponent<Block>();
		if ((Object)(object)block != (Object)null)
		{
			Block obj = block;
			obj.BlockAction = (Action<BlockTriggerType>)Delegate.Combine(obj.BlockAction, new Action<BlockTriggerType>(OnBlock));
		}
	}

	private void OnDestroy()
	{
		if ((Object)(object)block != (Object)null)
		{
			Block obj = block;
			obj.BlockAction = (Action<BlockTriggerType>)Delegate.Remove(obj.BlockAction, new Action<BlockTriggerType>(OnBlock));
		}
	}

	private void OnBlock(BlockTriggerType triggerType)
	{
		//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_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)ownerPlayer == (Object)null))
		{
			Vector3 position = ((Component)ownerPlayer).transform.position;
			for (int i = 0; i < mineCount; i++)
			{
				NetworkingManager.RaiseEvent("LandmineMod_SpawnMine", new object[3] { position.x, position.y, ownerPlayer.playerID });
			}
		}
	}
}
public abstract class MinionBehavior : MonoBehaviour
{
	public int ownerID;

	public MinionStats GetOwnerStats()
	{
		Player val = ((IEnumerable<Player>)PlayerManager.instance.players).FirstOrDefault((Func<Player, bool>)((Player p) => p.playerID == ownerID));
		return ((Object)(object)val != (Object)null) ? ((Component)val).GetComponent<MinionStats>() : null;
	}
}
public class MinionDamageCard : CustomCard
{
	public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
	{
		cardInfo.allowMultiple = true;
	}

	public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
	{
		MinionStats orAddComponent = ExtensionMethods.GetOrAddComponent<MinionStats>(((Component)player).gameObject, false);
		orAddComponent.damageMultiplier += 0.35f;
	}

	public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData characterData, HealthHandler healthHandler, Gravity gravity, Block block, CharacterStatModifiers characterStats)
	{
		MinionStats component = ((Component)player).gameObject.GetComponent<MinionStats>();
		if ((Object)(object)component != (Object)null)
		{
			component.damageMultiplier -= 0.35f;
		}
	}

	protected override string GetTitle()
	{
		return "Back to Work!";
	}

	protected override string GetDescription()
	{
		return "Boosts the damage output of all active minions.";
	}

	protected override GameObject GetCardArt()
	{
		return null;
	}

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

	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 = "Minion Damage",
				amount = "+35%"
			}
		};
	}

	protected override CardThemeColorType GetTheme()
	{
		return (CardThemeColorType)3;
	}
}
public class MinionStats : MonoBehaviour
{
	public float damageMultiplier = 1f;

	public float fireRateMultiplier = 1f;
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.yourname.rounds.landminemod", "Landmine Mod", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static Action<AudioClip> <>9__11_0;

		public static Action<AudioClip> <>9__11_1;

		public static Action<AudioClip> <>9__11_2;

		public static PhotonEvent <>9__11_3;

		public static PhotonEvent <>9__11_4;

		internal void <Start>b__11_0(AudioClip clip)
		{
			BeepSound = clip;
		}

		internal void <Start>b__11_1(AudioClip clip)
		{
			ExplosionSound = clip;
		}

		internal void <Start>b__11_2(AudioClip clip)
		{
			LaserSound = clip;
		}

		internal void <Start>b__11_3(object[] data)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			float num = (float)data[0];
			float num2 = (float)data[1];
			int ownerID = (int)data[2];
			SpawnMineLocally(new Vector3(num, num2, 1f), ownerID);
		}

		internal void <Start>b__11_4(object[] data)
		{
			//IL_0004: 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_0013: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = (Vector3)data[0];
			int ownerID = (int)data[1];
			SpawnDroneLocally(position, ownerID);
		}
	}

	private const string ModId = "com.yourname.rounds.landminemod";

	private const string ModName = "Landmine Mod";

	private const string Version = "1.0.0";

	public const string SpawnMineEvent = "LandmineMod_SpawnMine";

	public const string SpawnDroneEvent = "LandmineMod_SpawnDrone";

	private static Sprite mineSprite;

	private static Sprite droneSprite;

	public static Sprite laserSprite;

	public static AudioClip BeepSound;

	public static AudioClip ExplosionSound;

	public static AudioClip LaserSound;

	private void Start()
	{
		//IL_0114: Unknown result type (might be due to invalid IL or missing references)
		//IL_0119: Unknown result type (might be due to invalid IL or missing references)
		//IL_011f: Expected O, but got Unknown
		//IL_013e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: Expected O, but got Unknown
		string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
		string filePath = Path.Combine(directoryName, "MINIONSmine.png");
		mineSprite = LoadSpriteFromFile(filePath);
		string filePath2 = Path.Combine(directoryName, "MINIONSdrone.png");
		droneSprite = LoadSpriteFromFile(filePath2);
		string filePath3 = Path.Combine(directoryName, "MINIONSlaser.png");
		laserSprite = LoadSpriteFromFile(filePath3);
		((MonoBehaviour)this).StartCoroutine(LoadAudioFile(Path.Combine(directoryName, "MINIONSbeep.mp3"), delegate(AudioClip clip)
		{
			BeepSound = clip;
		}));
		((MonoBehaviour)this).StartCoroutine(LoadAudioFile(Path.Combine(directoryName, "MINIONSexplosion.mp3"), delegate(AudioClip clip)
		{
			ExplosionSound = clip;
		}));
		((MonoBehaviour)this).StartCoroutine(LoadAudioFile(Path.Combine(directoryName, "MINIONSlaser.mp3"), delegate(AudioClip clip)
		{
			LaserSound = clip;
		}));
		object obj = <>c.<>9__11_3;
		if (obj == null)
		{
			PhotonEvent val = delegate(object[] data)
			{
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				float num = (float)data[0];
				float num2 = (float)data[1];
				int ownerID = (int)data[2];
				SpawnMineLocally(new Vector3(num, num2, 1f), ownerID);
			};
			<>c.<>9__11_3 = val;
			obj = (object)val;
		}
		NetworkingManager.RegisterEvent("LandmineMod_SpawnMine", (PhotonEvent)obj);
		object obj2 = <>c.<>9__11_4;
		if (obj2 == null)
		{
			PhotonEvent val2 = delegate(object[] data)
			{
				//IL_0004: 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_0013: Unknown result type (might be due to invalid IL or missing references)
				Vector3 position = (Vector3)data[0];
				int ownerID = (int)data[1];
				SpawnDroneLocally(position, ownerID);
			};
			<>c.<>9__11_4 = val2;
			obj2 = (object)val2;
		}
		NetworkingManager.RegisterEvent("LandmineMod_SpawnDrone", (PhotonEvent)obj2);
		CustomCard.BuildCard<LandmineCard>();
		CustomCard.BuildCard<DroneCard>();
	}

	private IEnumerator LoadAudioFile(string fullPath, Action<AudioClip> callback)
	{
		if (!File.Exists(fullPath))
		{
			Debug.LogError((object)("[LandmineMod] Missing sound file at: " + fullPath));
			yield break;
		}
		string uri = "file:///" + fullPath.Replace("\\", "/");
		UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(uri, (AudioType)13);
		try
		{
			yield return www.SendWebRequest();
			if (www.isNetworkError || www.isHttpError)
			{
				Debug.LogError((object)("[LandmineMod] Audio Load Error: " + www.error));
				yield break;
			}
			AudioClip clip = DownloadHandlerAudioClip.GetContent(www);
			callback?.Invoke(clip);
			Debug.Log((object)("[LandmineMod] Loaded audio clip: " + Path.GetFileName(fullPath)));
		}
		finally
		{
			((IDisposable)www)?.Dispose();
		}
	}

	public static void SpawnMineLocally(Vector3 position, int ownerID)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("Landmine");
		val.transform.position = position;
		int num = LayerMask.NameToLayer("Player");
		if (num != -1)
		{
			val.layer = num;
		}
		else
		{
			val.layer = 0;
		}
		SpriteRenderer val2 = val.AddComponent<SpriteRenderer>();
		if ((Object)(object)mineSprite != (Object)null)
		{
			val2.sprite = mineSprite;
			((Renderer)val2).sortingOrder = 100;
		}
		val.transform.localScale = new Vector3(0.1f, 0.1f, 1f);
		BoxCollider2D val3 = val.AddComponent<BoxCollider2D>();
		val3.edgeRadius = 0.5f;
		((Collider2D)val3).isTrigger = false;
		Rigidbody2D val4 = val.AddComponent<Rigidbody2D>();
		val4.mass = 2f;
		val4.gravityScale = 1f;
		val4.collisionDetectionMode = (CollisionDetectionMode2D)1;
		LandmineBehavior landmineBehavior = val.AddComponent<LandmineBehavior>();
		landmineBehavior.ownerID = ownerID;
	}

	public static void SpawnDroneLocally(Vector3 position, int ownerID)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("AttackDrone");
		val.transform.position = position;
		SpriteRenderer val2 = val.AddComponent<SpriteRenderer>();
		if ((Object)(object)droneSprite != (Object)null)
		{
			val2.sprite = droneSprite;
			((Renderer)val2).sortingOrder = 100;
		}
		val.transform.localScale = new Vector3(0.2f, 0.2f, 1f);
		CircleCollider2D val3 = val.AddComponent<CircleCollider2D>();
		val3.radius = 0.5f;
		((Collider2D)val3).isTrigger = true;
		Rigidbody2D val4 = val.AddComponent<Rigidbody2D>();
		val4.mass = 1f;
		val4.gravityScale = 0f;
		val4.drag = 1f;
		DroneBehavior droneBehavior = val.AddComponent<DroneBehavior>();
		droneBehavior.ownerID = ownerID;
	}

	private static Sprite LoadSpriteFromFile(string filePath)
	{
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Expected O, but got Unknown
		//IL_0067: 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)
		if (!File.Exists(filePath))
		{
			Debug.LogError((object)("[LandmineMod] Missing image file at: " + filePath));
			return null;
		}
		byte[] array = File.ReadAllBytes(filePath);
		Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
		ImageConversion.LoadImage(val, array);
		Debug.Log((object)("[LandmineMod] Loaded sprite image: " + filePath));
		return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f);
	}
}