using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using AALUND13Cards.Core;
using AALUND13Cards.Core.Cards;
using AALUND13Cards.Core.Extensions;
using AALUND13Cards.Core.Handlers;
using AALUND13Cards.Core.Utils;
using AALUND13Cards.Standard.Cards;
using BepInEx;
using CardChoiceSpawnUniqueCardPatch.CustomCategories;
using HarmonyLib;
using JARL.Bases;
using JARL.Extensions;
using Microsoft.CodeAnalysis;
using ModdingUtils.Utils;
using ModsPlus;
using Photon.Pun;
using RarityLib.Utils;
using Sonigon;
using SoundImplementation;
using TabInfo.Utils;
using UnboundLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace AALUND13Cards.Core.Patches
{
[HarmonyPatch(typeof(Cards), "PlayerIsAllowedCard")]
internal class AllowedCardPatch
{
private static void Postfix(Player player, CardInfo card, ref bool __result)
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)player == (Object)null) && !((Object)(object)card == (Object)null) && card.categories.Contains(CustomCardCategories.instance.CardCategory("Curse")) && CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<StandardStats>().MaxRarityForCurse != null)
{
Rarity rarityData = RarityUtils.GetRarityData(card.rarity);
Rarity maxRarityForCurse = CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<StandardStats>().MaxRarityForCurse;
if (rarityData.relativeRarity < maxRarityForCurse.relativeRarity)
{
__result = false;
}
}
}
}
}
namespace AALUND13Cards.Core.MonoBehaviours.ProjectilesEffects
{
public class ConnectingBullets : MonoBehaviour
{
private static Dictionary<Player, GameObject> PlayerLastBullet = new Dictionary<Player, GameObject>();
public float DamageInterval = 0.5f;
public float DamageMultiplier = 0.75f;
public float MaxDistance = 20f;
public GameObject ConnectingBulletPrefab;
private Dictionary<Player, float> lastDamageTime = new Dictionary<Player, float>();
private GameObject connectingBulletInstance;
private GameObject connectedBullet;
private ChildRPC childRPC;
private ProjectileHit ProjectileHit;
private ProjectileHit OtherProjectileHit;
private void Start()
{
//IL_006c: 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_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_00a2: 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_00ac: 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_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: 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)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
ProjectileHit = ((Component)this).GetComponentInParent<ProjectileHit>();
childRPC = ((Component)this).GetComponentInParent<ChildRPC>();
if (PlayerLastBullet.ContainsKey(ProjectileHit.ownPlayer) && (Object)(object)PlayerLastBullet[ProjectileHit.ownPlayer] != (Object)null && Vector2.Distance(Vector2.op_Implicit(PlayerLastBullet[ProjectileHit.ownPlayer].transform.position), Vector2.op_Implicit(((Component)this).gameObject.transform.position)) < MaxDistance)
{
connectingBulletInstance = Object.Instantiate<GameObject>(ConnectingBulletPrefab, Vector2.op_Implicit(Vector2.zero), Quaternion.identity);
LineEffect component = connectingBulletInstance.GetComponent<LineEffect>();
connectedBullet = PlayerLastBullet[ProjectileHit.ownPlayer];
OtherProjectileHit = connectedBullet.GetComponent<ProjectileHit>();
component.fromPos = connectedBullet.transform;
component.toPos = ((Component)this).gameObject.transform;
LineRenderer component2 = connectingBulletInstance.GetComponent<LineRenderer>();
component2.startColor = GetProjectileColor(OtherProjectileHit);
component2.endColor = GetProjectileColor(ProjectileHit);
component2.SetPositions((Vector3[])(object)new Vector3[2]
{
connectedBullet.transform.position,
((Component)this).gameObject.transform.position
});
}
PlayerLastBullet[ProjectileHit.ownPlayer] = ((Component)((Component)this).transform.parent).gameObject;
}
private Color GetProjectileColor(ProjectileHit projectileHit)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: 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_0021: Unknown result type (might be due to invalid IL or missing references)
if (projectileHit.projectileColor == Color.black)
{
return new Color(0.75f, 0.28530002f, 0.0882f);
}
return projectileHit.projectileColor * 0.75f;
}
private void Update()
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_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 ((Object)(object)connectedBullet == (Object)null && (Object)(object)connectingBulletInstance != (Object)null)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
else if ((Object)(object)connectingBulletInstance != (Object)null && Vector2.Distance(Vector2.op_Implicit(connectedBullet.transform.position), Vector2.op_Implicit(((Component)this).gameObject.transform.position)) > MaxDistance)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
private void FixedUpdate()
{
//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_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)connectingBulletInstance != (Object)null && (Object)(object)connectedBullet != (Object)null)
{
DamageBetweenPoints(Vector2.op_Implicit(connectedBullet.transform.position), Vector2.op_Implicit(((Component)this).gameObject.transform.position));
}
}
private void OnDestroy()
{
if ((Object)(object)connectingBulletInstance != (Object)null)
{
Object.Destroy((Object)(object)connectingBulletInstance);
}
}
private bool CanDamagePlayer(Player player)
{
List<HealthHandler> obj = (List<HealthHandler>)ExtensionMethods.GetFieldValue((object)ProjectileHit, "playersHit");
List<HealthHandler> list = (List<HealthHandler>)ExtensionMethods.GetFieldValue((object)OtherProjectileHit, "playersHit");
if (obj.Contains(player.data.healthHandler) || list.Contains(player.data.healthHandler))
{
return false;
}
return true;
}
private void DamageBetweenPoints(Vector2 pointA, Vector2 pointB)
{
//IL_001d: 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_001f: 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)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//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_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: 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_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_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
if (!ProjectileHit.ownPlayer.data.view.IsMine)
{
return;
}
Vector2 val = (pointA + pointB) / 2f;
RaycastHit2D[] array = Physics2D.LinecastAll(pointA, pointB);
for (int i = 0; i < array.Length; i++)
{
RaycastHit2D val2 = array[i];
Player component = ((Component)((RaycastHit2D)(ref val2)).collider).GetComponent<Player>();
if ((Object)(object)component != (Object)null && CanDamagePlayer(component))
{
if (!lastDamageTime.ContainsKey(component))
{
lastDamageTime[component] = 0f;
}
if (Time.time - lastDamageTime[component] >= DamageInterval)
{
lastDamageTime[component] = Time.time;
Vector3 val3 = ((Component)component).transform.position - Vector2.op_Implicit(val);
Vector2 val4 = Vector2.op_Implicit(((Vector3)(ref val3)).normalized);
((Damagable)component.data.healthHandler).CallTakeDamage(val4 * GetChainDamage(component), Vector2.op_Implicit(((Component)component).transform.position), ProjectileHit.ownWeapon, ProjectileHit.ownPlayer, true);
}
}
}
}
private float GetChainDamage(Player targetPlayer)
{
float damage = ProjectileHit.damage;
float damage2 = connectedBullet.GetComponent<ProjectileHit>().damage;
float percentageDamage = ProjectileHit.percentageDamage;
float percentageDamage2 = connectedBullet.GetComponent<ProjectileHit>().percentageDamage;
return ((damage + damage2) / 2f + targetPlayer.data.maxHealth * (percentageDamage + percentageDamage2) / 2f) * DamageMultiplier;
}
}
public class RayHitExecution : RayHitEffect
{
[Range(0f, 1f)]
public float executionPercentage = 0.3f;
public override HasToReturn DoHitEffect(HitInfo hit)
{
//IL_0099: 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)
if (Object.op_Implicit((Object)(object)hit.transform))
{
CharacterData component = ((Component)hit.transform).GetComponent<CharacterData>();
if (!((Object)(object)component == (Object)null) && !component.dead)
{
if (!((component.health + CharacterDataExtensions.GetAdditionalData(component).totalArmor) / component.maxHealth > executionPercentage))
{
if (component.stats.remainingRespawns > 0)
{
component.view.RPC("RPCA_Die_Phoenix", (RpcTarget)0, new object[1] { Vector2.down });
}
else
{
component.view.RPC("RPCA_Die", (RpcTarget)0, new object[1] { Vector2.down });
}
component.health = 0f;
return (HasToReturn)1;
}
return (HasToReturn)1;
}
return (HasToReturn)1;
}
return (HasToReturn)1;
}
}
}
namespace AALUND13Cards.Core.MonoBehaviours.CardsEffects
{
public class CurrentHPRegenMono : MonoBehaviour
{
[Tooltip("Percentage of current health to activate the regeneration. If the character's health is above this percentage, regeneration will not be applied.")]
public float activatePercentage = 0.75f;
public float CurrentHPRegenPercentage = 0.15f;
private CharacterData data;
private float oldRegen;
private void Start()
{
data = ((Component)this).GetComponentInParent<CharacterData>();
}
public void Update()
{
if (oldRegen != 0f && data.health / data.maxHealth > activatePercentage)
{
HealthHandler healthHandler = data.healthHandler;
healthHandler.regeneration -= oldRegen;
oldRegen = 0f;
}
else if (data.health / data.maxHealth <= activatePercentage)
{
float num = data.health * CurrentHPRegenPercentage;
HealthHandler healthHandler2 = data.healthHandler;
healthHandler2.regeneration -= oldRegen;
HealthHandler healthHandler3 = data.healthHandler;
healthHandler3.regeneration += num;
oldRegen = num;
}
}
}
public class RollBackTeleport : MonoBehaviour
{
[Header("Sounds")]
public SoundEvent SoundTeleport;
[Header("Teleport Settings")]
public GameObject SaveTeleportPositionPrefab;
[Header("Particle Systems")]
public ParticleSystem[] parts;
public ParticleSystem[] remainParts;
private GameObject saveTeleportPosition;
private CharacterData data;
private Vector2 SavePosition;
private bool DoTeleport;
private void Start()
{
data = ((Component)this).GetComponentInParent<CharacterData>();
SoundTeleport.variables.audioMixerGroup = SoundVolumeManager.Instance.audioMixer.FindMatchingGroups("SFX")[0];
Block componentInParent = ((Component)this).GetComponentInParent<Block>();
componentInParent.SuperFirstBlockAction = (Action<BlockTriggerType>)Delegate.Combine(componentInParent.SuperFirstBlockAction, new Action<BlockTriggerType>(OnBlock));
HealthHandler healthHandler = data.healthHandler;
healthHandler.reviveAction = (Action)Delegate.Combine(healthHandler.reviveAction, new Action(ResetTeleport));
if (data.view.IsMine)
{
saveTeleportPosition = Object.Instantiate<GameObject>(SaveTeleportPositionPrefab);
saveTeleportPosition.SetActive(false);
}
}
private void OnDestroy()
{
Block componentInParent = ((Component)this).GetComponentInParent<Block>();
componentInParent.SuperFirstBlockAction = (Action<BlockTriggerType>)Delegate.Remove(componentInParent.SuperFirstBlockAction, new Action<BlockTriggerType>(OnBlock));
HealthHandler healthHandler = data.healthHandler;
healthHandler.reviveAction = (Action)Delegate.Remove(healthHandler.reviveAction, new Action(ResetTeleport));
if ((Object)(object)saveTeleportPosition != (Object)null)
{
Object.Destroy((Object)(object)saveTeleportPosition);
}
}
private void OnDisable()
{
ResetTeleport();
}
public void OnBlock(BlockTriggerType triggerType)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: 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_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: 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_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: 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_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
if ((int)triggerType != 0)
{
return;
}
if (DoTeleport)
{
Vector2 val = Vector2.op_Implicit(((Component)data).transform.position);
((Component)this).GetComponentInParent<PlayerCollision>().IgnoreWallForFrames(2);
((Component)data).transform.position = Vector2.op_Implicit(SavePosition);
for (int i = 0; i < remainParts.Length; i++)
{
((Component)remainParts[i]).transform.position = Vector2.op_Implicit(val);
remainParts[i].Play();
}
for (int j = 0; j < parts.Length; j++)
{
((Component)parts[j]).transform.position = Vector2.op_Implicit(SavePosition);
parts[j].Play();
}
SoundManager.Instance.Play(SoundTeleport, ((Component)data).transform);
ExtensionMethods.SetFieldValue((object)data.playerVel, "velocity", (object)Vector2.zero);
data.sinceGrounded = 0f;
ResetTeleport();
}
else
{
if ((Object)(object)saveTeleportPosition != (Object)null)
{
saveTeleportPosition.transform.position = ((Component)data).transform.position;
saveTeleportPosition.SetActive(true);
}
SavePosition = Vector2.op_Implicit(((Component)data).transform.position);
DoTeleport = true;
}
}
public void ResetTeleport()
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)saveTeleportPosition != (Object)null)
{
saveTeleportPosition.SetActive(false);
}
DoTeleport = false;
SavePosition = Vector2.zero;
}
}
public class StoreDamageEffect : MonoBehaviour, IOnDoDamageEvent
{
public float DamageToStorePercentage = 0.5f;
public float MaxStoredDamageMultiplier = 5f;
[Tooltip("Cooldown time in seconds before damage can be stored again after releasing stored damage.")]
public float CoolddownTime = 5f;
private float maxStoredDamage = 100f;
private float storedDamage;
private float cooldownTimer;
private bool damageReductionApplied;
private Player player;
private DamageSpawnObjects damageSpawnObjects;
private CustomHealthBar storedDamageBar;
public void ReleaseStoredDamage()
{
//IL_0013: 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)
if (storedDamage > 0f)
{
damageSpawnObjects.SpawnDamage(Vector2.up * storedDamage);
ResetStoredDamage();
cooldownTimer = CoolddownTime;
}
}
public void OnDamage(DamageInfo damage)
{
if (!(cooldownTimer > 0f))
{
float num = ((Vector2)(ref damage.Damage)).magnitude / (1f - DamageToStorePercentage);
storedDamage = Mathf.Min(maxStoredDamage, storedDamage + num * DamageToStorePercentage);
if (storedDamage == maxStoredDamage && damageReductionApplied)
{
CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<StandardStats>().DamageReduction -= DamageToStorePercentage;
damageReductionApplied = false;
}
storedDamageBar.CurrentHealth = storedDamage;
}
}
public void ResetStoredDamage()
{
storedDamage = 0f;
storedDamageBar.CurrentHealth = storedDamage;
if (!damageReductionApplied)
{
CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<StandardStats>().DamageReduction += DamageToStorePercentage;
damageReductionApplied = true;
}
}
private void Start()
{
player = ((Component)this).GetComponentInParent<Player>();
damageSpawnObjects = ((Component)this).GetComponent<DamageSpawnObjects>();
storedDamageBar = CreateStoredDamageBar();
DamageEventHandler.Instance.RegisterDamageEvent((object)this, player);
HealthHandler healthHandler = player.data.healthHandler;
healthHandler.reviveAction = (Action)Delegate.Combine(healthHandler.reviveAction, new Action(OnRevive));
maxStoredDamage = player.data.maxHealth * MaxStoredDamageMultiplier;
storedDamageBar.SetValues(0f, maxStoredDamage);
ResetStoredDamage();
}
private void OnDestroy()
{
DamageEventHandler.Instance.UnregisterDamageEvent((object)this, player);
HealthHandler healthHandler = player.data.healthHandler;
healthHandler.reviveAction = (Action)Delegate.Remove(healthHandler.reviveAction, new Action(OnRevive));
Object.Destroy((Object)(object)((Component)storedDamageBar).gameObject);
}
private void Update()
{
maxStoredDamage = player.data.maxHealth * MaxStoredDamageMultiplier;
storedDamageBar.MaxHealth = maxStoredDamage;
if (cooldownTimer > 0f)
{
cooldownTimer = Mathf.Max(0f, cooldownTimer - TimeHandler.deltaTime);
if (damageReductionApplied)
{
CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<StandardStats>().DamageReduction -= DamageToStorePercentage;
damageReductionApplied = false;
}
else if (cooldownTimer <= 0f && !damageReductionApplied)
{
CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<StandardStats>().DamageReduction += DamageToStorePercentage;
damageReductionApplied = true;
}
}
if (storedDamage > maxStoredDamage)
{
storedDamage = maxStoredDamage;
storedDamageBar.CurrentHealth = storedDamage;
}
}
private CustomHealthBar CreateStoredDamageBar()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("Damage Storage Bar");
CustomHealthBar obj = val.AddComponent<CustomHealthBar>();
obj.SetColor(new Color(1f, 0.64705884f, 0f, 1f) * 0.8f);
ExtensionMethods.AddStatusIndicator(player, val, 0f, true);
Object.Destroy((Object)(object)((Component)val.transform.Find("Healthbar(Clone)/Canvas/Image/White")).gameObject);
return obj;
}
private void OnRevive()
{
ResetStoredDamage();
cooldownTimer = 0f;
}
}
}
namespace AALUND13Cards.Standard
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("AALUND13.Cards.Standard", "AALUND13 Standard Cards", "1.0.0")]
[BepInProcess("Rounds.exe")]
internal class AAC_Standard : BaseUnityPlugin
{
internal const string ModId = "AALUND13.Cards.Standard";
internal const string ModName = "AALUND13 Standard Cards";
internal const string Version = "1.0.0";
private static AssetBundle assets;
private void Awake()
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
assets = AssetsUtils.LoadAssetBundle("aac_standard_assets", typeof(AAC_Standard).Assembly);
if ((Object)(object)assets != (Object)null)
{
new Harmony("AALUND13.Cards.Standard").PatchAll();
}
}
private void Start()
{
if ((Object)(object)assets == (Object)null)
{
Unbound.BuildModal("AALUND13 Cards Error", "The mod \"AALUND13 Standard Cards\" assets failled to load, All the cards will be disable in this mod");
throw new NullReferenceException("Failled to load \"AALUND13 Standard Cards\" assets");
}
if (AAC_Core.Plugins.Exists((BaseUnityPlugin plugin) => plugin.Info.Metadata.GUID == "com.willuwontu.rounds.tabinfo"))
{
TabinfoInterface.Setup();
}
CardResgester cardResgester = assets.LoadAsset<GameObject>("StandardModCards").GetComponent<CardResgester>();
cardResgester.RegisterCards();
AACMenu.OnMenuRegister = (Action)Delegate.Combine(AACMenu.OnMenuRegister, (Action)delegate
{
AACMenu.CreateModuleMenuWithReadmeGenerator("AALUND13 Standard Cards", "1.0.0", cardResgester);
});
}
}
internal class TabinfoInterface
{
public static void Setup()
{
StatCategory orCreateCategory = TabinfoInterface.GetOrCreateCategory("AA Stats", 6);
TabInfoManager.RegisterStat(orCreateCategory, "Delay Damage", (Func<Player, bool>)((Player p) => GetStandardStatsFromPlayer(p).secondToDealDamage != 0f), (Func<Player, string>)((Player p) => $"{GetStandardStatsFromPlayer(p).secondToDealDamage} seconds"));
TabInfoManager.RegisterStat(orCreateCategory, "Blocks When Recharge", (Func<Player, bool>)((Player p) => GetStandardStatsFromPlayer(p).BlocksWhenRecharge != 0), (Func<Player, string>)((Player p) => $"{GetStandardStatsFromPlayer(p).BlocksWhenRecharge}"));
TabInfoManager.RegisterStat(orCreateCategory, "Stun Block Time", (Func<Player, bool>)((Player p) => GetStandardStatsFromPlayer(p).StunBlockTime != 0f), (Func<Player, string>)((Player p) => $"{GetStandardStatsFromPlayer(p).StunBlockTime:0}s"));
TabInfoManager.RegisterStat(orCreateCategory, "Max Rarity For Curse", (Func<Player, bool>)((Player p) => GetStandardStatsFromPlayer(p).MaxRarityForCurse != null), (Func<Player, string>)((Player p) => GetStandardStatsFromPlayer(p).MaxRarityForCurse.name));
TabInfoManager.RegisterStat(orCreateCategory, "Damage Reduction", (Func<Player, bool>)((Player p) => GetStandardStatsFromPlayer(p).DamageReduction != 0f), (Func<Player, string>)((Player p) => $"{GetStandardStatsFromPlayer(p).DamageReduction * 100f:0}%"));
}
private static StandardStats GetStandardStatsFromPlayer(Player player)
{
return CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<StandardStats>();
}
}
}
namespace AALUND13Cards.Standard.Patches
{
[HarmonyPatch(typeof(Block))]
internal class BlockPatch
{
public static Dictionary<Block, bool> BlockRechargeAlreadyTriggered = new Dictionary<Block, bool>();
[HarmonyPatch("IDoBlock")]
[HarmonyPrefix]
public static void IDoBlockPrefix(Block __instance, bool firstBlock, bool dontSetCD, BlockTriggerType triggerType)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
if (!(!firstBlock || dontSetCD) && (int)triggerType == 0)
{
BlockRechargeAlreadyTriggered[__instance] = false;
}
}
[HarmonyPatch("Start")]
[HarmonyPostfix]
public static void StartPostfix(Block __instance)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
CharacterData data = (CharacterData)ExtensionMethods.GetFieldValue((object)__instance, "data");
__instance.BlockRechargeAction = delegate
{
if (!(BlockRechargeAlreadyTriggered.TryGetValue(__instance, out var value) && value))
{
for (int i = 0; i < CharacterDataExtensions.GetCustomStatsRegistry(data).GetOrCreate<StandardStats>().BlocksWhenRecharge; i++)
{
float num = (float)ExtensionMethods.GetFieldValue((object)__instance, "timeBetweenBlocks");
float num2 = (float)i * num;
((MonoBehaviour)__instance).StartCoroutine("DelayBlock", (object)num2);
}
BlockRechargeAlreadyTriggered[__instance] = true;
}
};
}
[HarmonyPatch("blocked")]
[HarmonyPrefix]
public static void BlockedPrefix(Block __instance, GameObject projectile, Vector3 forward, Vector3 hitPos)
{
//IL_0011: 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_0033: Expected O, but got Unknown
ProjectileHit component = projectile.GetComponent<ProjectileHit>();
_ = (HealthHandler)ExtensionMethods.GetFieldValue((object)__instance, "health");
CharacterData data = component.ownPlayer.data;
CharacterData val = (CharacterData)ExtensionMethods.GetFieldValue((object)__instance, "data");
bool flag = false;
if ((Object)(object)data != (Object)null && CharacterDataExtensions.GetCustomStatsRegistry(data).GetOrCreate<StandardStats>().StunBlockTime > 0f)
{
((MonoBehaviour)val.block).StopAllCoroutines();
val.block.sinceBlock = float.PositiveInfinity;
val.stunHandler.AddStun(val.stunTime + CharacterDataExtensions.GetCustomStatsRegistry(data).GetOrCreate<StandardStats>().StunBlockTime);
flag = true;
}
if (flag)
{
Object.Destroy((Object)(object)projectile);
}
}
}
[HarmonyPatch(typeof(HealthHandler))]
internal class HealthHandlerPatch
{
[HarmonyPatch("DoDamage")]
[HarmonyPrefix]
public static void DoDamage(HealthHandler __instance, ref Vector2 damage, Vector2 position, Color blinkColor, GameObject damagingWeapon, Player damagingPlayer, bool healthRemoval, bool lethal, bool ignoreBlock)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: 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)
CharacterData val = (CharacterData)Traverse.Create((object)__instance).Field("data").GetValue();
StandardStats characterAdditionalData = CharacterDataExtensions.GetCustomStatsRegistry(val).GetOrCreate<StandardStats>();
if (characterAdditionalData.DamageReduction > 0f)
{
damage = new Vector2(damage.x * (1f - characterAdditionalData.DamageReduction), damage.y * (1f - characterAdditionalData.DamageReduction));
}
if (characterAdditionalData.secondToDealDamage > 0f && !characterAdditionalData.dealDamage)
{
Vector2 val2 = default(Vector2);
((Vector2)(ref val2))..ctor(damage.x, damage.y);
ExtensionMethods.GetOrAddComponent<DelayDamageHandler>(((Component)__instance).gameObject, false).DelayDamage(new DelayDamageInfo(val2, position, blinkColor, damagingWeapon, damagingPlayer, healthRemoval, lethal, ignoreBlock), characterAdditionalData.secondToDealDamage, (Action)delegate
{
characterAdditionalData.dealDamage = true;
}, (Action)null);
damage = Vector2.zero;
}
else if (characterAdditionalData.dealDamage)
{
characterAdditionalData.dealDamage = false;
}
}
}
[HarmonyPatch(typeof(ResetBlock), "Go")]
internal class ResetBlockPatch
{
public static void Postfix(Block __instance)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
CharacterData val = (CharacterData)ExtensionMethods.GetFieldValue((object)__instance, "data");
if (!(BlockPatch.BlockRechargeAlreadyTriggered.TryGetValue(__instance, out var value) && value))
{
for (int i = 0; i < CharacterDataExtensions.GetCustomStatsRegistry(val).GetOrCreate<StandardStats>().BlocksWhenRecharge; i++)
{
float num = (float)ExtensionMethods.GetFieldValue((object)__instance, "timeBetweenBlocks");
float num2 = (float)i * num;
((MonoBehaviour)__instance).StartCoroutine("DelayBlock", (object)num2);
}
BlockPatch.BlockRechargeAlreadyTriggered[__instance] = false;
}
}
}
}
namespace AALUND13Cards.Standard.Cards
{
public class StandardStats : ICustomStats
{
public float secondToDealDamage;
public bool dealDamage = true;
public int BlocksWhenRecharge;
public float StunBlockTime;
public Rarity MaxRarityForCurse;
public float DamageReduction;
public void ResetStats()
{
secondToDealDamage = 0f;
dealDamage = true;
BlocksWhenRecharge = 0;
StunBlockTime = 0f;
MaxRarityForCurse = null;
DamageReduction = 0f;
}
}
}
namespace AALUND13Cards.Standard.Cards.StatModifers
{
public class StandardStatModifers : CustomStatModifers
{
[Header("Curses Stats")]
public bool SetMaxRarityForCurse;
public CardRarity MaxRarityForCurse;
[Header("Blocks Stats")]
public int BlocksWhenRecharge;
public float StunBlockTime;
[Header("Uncategorized Stats")]
public float SecondToDealDamage;
public override void Apply(Player player)
{
//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_0058: Unknown result type (might be due to invalid IL or missing references)
StandardStats orCreate = CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<StandardStats>();
if (SecondToDealDamage > 0f)
{
orCreate.dealDamage = false;
}
orCreate.secondToDealDamage += SecondToDealDamage;
if (SetMaxRarityForCurse)
{
Rarity rarity = RarityUtils.GetRarity(((object)(CardRarity)(ref MaxRarityForCurse)).ToString());
orCreate.MaxRarityForCurse = RarityUtils.GetRarityData(rarity);
}
orCreate.BlocksWhenRecharge += BlocksWhenRecharge;
orCreate.StunBlockTime += StunBlockTime;
}
}
}