using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnboundLib.Cards;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: SecurityPermission(8, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(/*Could not decode attribute arguments.*/)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("Systems.R00t.BlockOverhall", "Block Overhall", "0.0.0")]
[BepInProcess("Rounds.exe")]
public class Patch : BaseUnityPlugin
{
[Serializable]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
internal class BlockPatchblocked : Object
{
private static void Prefix(Block __instance, GameObject projectile, Vector3 forward, Vector3 hitPos)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
bool flag = false;
ProjectileHit component = projectile.GetComponent<ProjectileHit>();
HealthHandler val = (HealthHandler)Traverse.Create((object)__instance).Field("health").GetValue();
Player val2 = (Player)Traverse.Create((object)val).Field("player").GetValue();
float num = 0f;
Enumerator<CardInfo> enumerator = val2.data.currentCards.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
CardInfo current = enumerator.Current;
if (BlockCardMappings.ContainsKey(current.cardName.ToLower()))
{
num += (float)BlockCardMappings[current.cardName.ToLower()] / 100f;
}
}
}
finally
{
((IDisposable)enumerator).Dispose();
}
if (num > 1.5f)
{
num = 1.5f;
}
if (num < 1f && Enumerable.Any<CardInfo>((IEnumerable<CardInfo>)(object)component.ownPlayer.data.currentCards, (Func<CardInfo, bool>)((CardInfo c) => c.cardName.ToLower() == "drill ammo")))
{
num = 1f;
}
if (num > 0f)
{
Vector2 val3 = Vector2.op_Implicit((component.bulletCanDealDeamage ? component.damage : 1f) * num * ((Vector3)(ref forward)).normalized);
((Damagable)val).TakeDamage(val3, Vector2.op_Implicit(hitPos), component.projectileColor, component.ownWeapon, component.ownPlayer, true, true);
flag = true;
}
if (flag)
{
Object.Destroy((Object)(object)projectile);
}
}
}
public class Movedown : CustomCard
{
public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
{
if (MovementCardMappings.ContainsKey(((Component)this).GetComponent<CardInfo>().cardName.ToLower()))
{
CharacterStatModifiers statModifiers = base.statModifiers;
statModifiers.movementSpeed -= (float)MovementCardMappings[((Component)this).GetComponent<CardInfo>().cardName.ToLower()] / 100f;
}
}
protected override GameObject GetCardArt()
{
return null;
}
protected override string GetDescription()
{
return null;
}
protected override Rarity GetRarity()
{
return (Rarity)0;
}
protected override CardInfoStat[] GetStats()
{
return null;
}
protected override CardThemeColorType GetTheme()
{
return (CardThemeColorType)0;
}
protected override string GetTitle()
{
return null;
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass5_0 : Object
{
public KeyValuePair<string, int> m;
internal bool <Start>b__0(CardInfo c)
{
return c.cardName.ToLower() == m.Key;
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass5_1 : Object
{
public KeyValuePair<string, int> m;
internal bool <Start>b__1(CardInfo c)
{
return c.cardName.ToLower() == m.Key;
}
}
private const string ModId = "Systems.R00t.BlockOverhall";
private const string ModName = "Block Overhall";
public const string Version = "0.0.0";
public static Dictionary<string, int> BlockCardMappings;
public static Dictionary<string, int> MovementCardMappings;
private void Start()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: 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_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: 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_0096: Expected O, but got Unknown
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Expected O, but got Unknown
new Harmony("Systems.R00t.BlockOverhall").PatchAll();
Enumerator<string, int> enumerator = BlockCardMappings.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
<>c__DisplayClass5_0 CS$<>8__locals0 = new <>c__DisplayClass5_0();
CS$<>8__locals0.m = enumerator.Current;
CardInfo obj = Enumerable.FirstOrDefault<CardInfo>((IEnumerable<CardInfo>)(object)CardChoice.instance.cards, (Func<CardInfo, bool>)((CardInfo c) => c.cardName.ToLower() == CS$<>8__locals0.m.Key));
List<CardInfoStat> val = Enumerable.ToList<CardInfoStat>((IEnumerable<CardInfoStat>)(object)obj.cardStats);
val.Add(new CardInfoStat
{
amount = String.Format("+{0}%", (object)CS$<>8__locals0.m.Value),
positive = false,
stat = "Bullet Penetration"
});
obj.cardStats = val.ToArray();
}
}
finally
{
((IDisposable)enumerator).Dispose();
}
enumerator = MovementCardMappings.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
<>c__DisplayClass5_1 CS$<>8__locals1 = new <>c__DisplayClass5_1();
CS$<>8__locals1.m = enumerator.Current;
CardInfo obj2 = Enumerable.FirstOrDefault<CardInfo>((IEnumerable<CardInfo>)(object)CardChoice.instance.cards, (Func<CardInfo, bool>)((CardInfo c) => c.cardName.ToLower() == CS$<>8__locals1.m.Key));
List<CardInfoStat> val2 = Enumerable.ToList<CardInfoStat>((IEnumerable<CardInfoStat>)(object)obj2.cardStats);
val2.Add(new CardInfoStat
{
amount = String.Format("-{0}%", (object)CS$<>8__locals1.m.Value),
positive = false,
stat = "Movement Speed"
});
obj2.cardStats = val2.ToArray();
((Component)obj2).gameObject.AddComponent<Movedown>();
}
}
finally
{
((IDisposable)enumerator).Dispose();
}
}
static Patch()
{
Dictionary<string, int> obj = new Dictionary<string, int>();
obj.Add("silence", 30);
obj.Add("shield charge", 20);
obj.Add("teleport", 15);
obj.Add("echo", 10);
obj.Add("overpower", 15);
BlockCardMappings = obj;
Dictionary<string, int> obj2 = new Dictionary<string, int>();
obj2.Add("huge", 10);
obj2.Add("tank", 10);
obj2.Add("shockwave", 5);
obj2.Add("supernova", 5);
obj2.Add("implode", 5);
obj2.Add("shield charge", 5);
MovementCardMappings = obj2;
}
}