using System;
using System.Collections;
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.Curses.Cards;
using AALUND13Cards.Curses.MonoBehaviours;
using BepInEx;
using HarmonyLib;
using InControl;
using JARL.Utils;
using Microsoft.CodeAnalysis;
using ModdingUtils.GameModes;
using ModdingUtils.Utils;
using Photon.Pun;
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.MonoBehaviours.CardsEffects
{
public class ReverseLifeSteelEffect : MonoBehaviour, IOnDoDamageEvent
{
public float ReverseLifeSteelPercentage = 0.2f;
private Player player;
public void OnDamage(DamageInfo damage)
{
//IL_0000: 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)damage.DamagingPlayer != (Object)null)
{
damage.DamagingPlayer.data.healthHandler.Heal(((Vector2)(ref damage.Damage)).magnitude * ReverseLifeSteelPercentage);
}
}
private void Start()
{
player = ((Component)this).GetComponentInParent<Player>();
DamageEventHandler.Instance.RegisterDamageEvent((object)this, player);
}
private void OnDestroy()
{
DamageEventHandler.Instance.UnregisterDamageEvent((object)this, player);
}
}
}
namespace AALUND13Cards.Core.Cards.Effects
{
public class AddPostProcessingEffect : OnAddedEffect
{
public List<Material> PostProcessingEffects = new List<Material>();
public override void OnAdded(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
{
if (!player.data.view.IsMine)
{
return;
}
Camera main = Camera.main;
if (!((Object)(object)main != (Object)null))
{
return;
}
foreach (Material postProcessingEffect in PostProcessingEffects)
{
((Component)main).gameObject.AddComponent<PostProcessingEffect>().Material = postProcessingEffect;
}
}
}
}
namespace AALUND13Cards.Curses
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("AALUND13.Cards.Curses", "AALUND13 Curses Cards", "1.0.0")]
[BepInProcess("Rounds.exe")]
internal class AAC_Curses : BaseUnityPlugin
{
internal const string ModId = "AALUND13.Cards.Curses";
internal const string ModName = "AALUND13 Curses 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_curses_assets", typeof(AAC_Curses).Assembly);
if ((Object)(object)assets != (Object)null)
{
new Harmony("AALUND13.Cards.Curses").PatchAll();
}
}
private void Start()
{
if ((Object)(object)assets == (Object)null)
{
Unbound.BuildModal("AALUND13 Cards Error", "The mod \"AALUND13 Curses Cards\" assets failled to load, All the cards will be disable in this mod");
throw new NullReferenceException("Failled to load \"AALUND13 Curses Cards\" assets");
}
if (AAC_Core.Plugins.Exists((BaseUnityPlugin plugin) => plugin.Info.Metadata.GUID == "com.willuwontu.rounds.tabinfo"))
{
TabinfoInterface.Setup();
}
Object.DontDestroyOnLoad((Object)(object)Object.Instantiate<GameObject>(assets.LoadAsset<GameObject>("FlashlightMaskHandler")));
CardResgester cardResgester = assets.LoadAsset<GameObject>("CursesModCards").GetComponent<CardResgester>();
cardResgester.RegisterCards();
AACMenu.OnMenuRegister = (Action)Delegate.Combine(AACMenu.OnMenuRegister, (Action)delegate
{
AACMenu.CreateModuleMenuWithReadmeGenerator("AALUND13 Curses Cards", "1.0.0", cardResgester);
});
assets.LoadAsset<GameObject>("CursesPhotonPrefabPool").GetComponent<PhotonPrefabPool>().RegisterPrefabs();
}
}
internal class TabinfoInterface
{
public static void Setup()
{
StatCategory orCreateCategory = TabinfoInterface.GetOrCreateCategory("AA Stats", 6);
TabInfoManager.RegisterStat(orCreateCategory, "Is Bind", (Func<Player, bool>)((Player p) => GetCursesStatsFromPlayer(p).IsBind), (Func<Player, string>)((Player p) => (!GetCursesStatsFromPlayer(p).IsBind) ? "No" : "Yes"));
TabInfoManager.RegisterStat(orCreateCategory, "Is Decay Time Disable", (Func<Player, bool>)((Player p) => GetCursesStatsFromPlayer(p).DisableDecayTime), (Func<Player, string>)((Player p) => (!GetCursesStatsFromPlayer(p).DisableDecayTime) ? "No" : "Yes"));
}
private static CursesStats GetCursesStatsFromPlayer(Player player)
{
return CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<CursesStats>();
}
}
}
namespace AALUND13Cards.Curses.Patches
{
[HarmonyPatch(typeof(CharacterStatModifiers))]
public class CharacterStatModifiersPatch
{
[HarmonyPatch("ResetStats")]
[HarmonyPrefix]
public static void ResetStats(CharacterStatModifiers __instance)
{
//IL_0015: 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_0020: Expected O, but got Unknown
CharacterData val = (CharacterData)Traverse.Create((object)__instance).Field("data").GetValue();
CharacterDataExtensions.GetAdditionalData(val).Reset();
if (!val.view.IsMine)
{
return;
}
Camera main = Camera.main;
if ((Object)(object)main != (Object)null)
{
PostProcessingEffect[] components = ((Component)main).GetComponents<PostProcessingEffect>();
for (int i = 0; i < components.Length; i++)
{
Object.Destroy((Object)(object)components[i]);
}
}
}
}
[HarmonyPatch(typeof(DamageOverTime))]
public class DamageOverTimePatch
{
[HarmonyPatch("TakeDamageOverTime")]
[HarmonyPrefix]
public static bool TakeDamageOverTimePrefix(DamageOverTime __instance, Vector2 damage, Vector2 position, float time, float interval, Color color, GameObject damagingWeapon, Player damagingPlayer, bool lethal)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_0038: 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_003a: Unknown result type (might be due to invalid IL or missing references)
CharacterData val = (CharacterData)Traverse.Create((object)__instance).Field("data").GetValue();
if (CharacterDataExtensions.GetAdditionalData(val).CustomStatsRegistry.GetOrCreate<CursesStats>().DisableDecayTime)
{
val.healthHandler.DoDamage(damage, position, color, damagingWeapon, damagingPlayer, true, lethal, false);
return false;
}
return true;
}
}
}
namespace AALUND13Cards.Curses.MonoBehaviours
{
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
public class PostProcessingEffect : MonoBehaviour
{
public Material Material;
private void OnRenderImage(RenderTexture src, RenderTexture dest)
{
if ((Object)(object)Material == (Object)null)
{
Graphics.Blit((Texture)(object)src, dest);
return;
}
RenderTexture temporary = RenderTexture.GetTemporary(((Texture)src).width, ((Texture)src).height);
Graphics.Blit((Texture)(object)src, temporary, Material, 0);
Graphics.Blit((Texture)(object)temporary, dest);
RenderTexture.ReleaseTemporary(temporary);
}
}
}
namespace AALUND13Cards.Curses.MonoBehaviours.CardsEffects
{
public class AddPostProcessingEffectInRounds : MonoBehaviour, IRoundStartHookHandler, IRoundEndHookHandler
{
public List<Material> PostProcessingEffects = new List<Material>();
private List<PostProcessingEffect> addedEffects = new List<PostProcessingEffect>();
private CharacterData characterData;
public void OnRoundEnd()
{
foreach (PostProcessingEffect addedEffect in addedEffects)
{
((Behaviour)addedEffect).enabled = false;
}
}
public void OnRoundStart()
{
foreach (PostProcessingEffect addedEffect in addedEffects)
{
((Behaviour)addedEffect).enabled = true;
}
}
private void Start()
{
characterData = ((Component)this).GetComponentInParent<CharacterData>();
Camera main = Camera.main;
if ((Object)(object)main != (Object)null && characterData.view.IsMine)
{
foreach (Material postProcessingEffect2 in PostProcessingEffects)
{
PostProcessingEffect postProcessingEffect = ((Component)main).gameObject.AddComponent<PostProcessingEffect>();
postProcessingEffect.Material = postProcessingEffect2;
((Behaviour)postProcessingEffect).enabled = false;
addedEffects.Add(postProcessingEffect);
}
}
InterfaceGameModeHooksManager.instance.RegisterHooks((object)this);
}
private void OnDestroy()
{
foreach (PostProcessingEffect addedEffect in addedEffects)
{
Object.Destroy((Object)(object)addedEffect);
}
InterfaceGameModeHooksManager.instance.RemoveHooks((object)this);
}
}
public class HealingRadiance : MonoBehaviour
{
public float healingAmount = 10f;
private CharacterData data;
private bool effectActive;
private void Start()
{
data = ((Component)this).GetComponentInParent<CharacterData>();
}
private void Update()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: 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)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
if (!(data.input.direction == Vector3.zero) && !(data.input.direction == Vector3.down))
{
return;
}
foreach (Player enemyPlayer in PlayerStatus.GetEnemyPlayers(data.player))
{
enemyPlayer.data.healthHandler.Heal(healingAmount * TimeHandler.deltaTime);
}
}
}
public class LifeLinkedAdder : MonoBehaviour
{
public GameObject LifeLinkPrefab;
private GameObject instantiatedLifeLink;
private void Start()
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
Player componentInParent = ((Component)this).gameObject.GetComponentInParent<Player>();
if (componentInParent.data.view.IsMine)
{
Player random = ExtensionMethods.GetRandom<Player>((IList)PlayerStatus.GetOtherPlayers(componentInParent));
instantiatedLifeLink = PhotonNetwork.Instantiate(((Object)LifeLinkPrefab).name, Vector3.zero, Quaternion.identity, (byte)0, new object[2] { componentInParent.playerID, random.playerID });
}
}
private void OnDestroy()
{
if ((Object)(object)instantiatedLifeLink != (Object)null)
{
PhotonNetwork.Destroy(instantiatedLifeLink);
}
}
}
[RequireComponent(typeof(PhotonView))]
public class LifeLinkMono : MonoBehaviour, IPunInstantiateMagicCallback
{
[CompilerGenerated]
private sealed class <LinkedDeath>d__10 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public LifeLinkMono <>4__this;
private Vector2 <oldPosition>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LinkedDeath>d__10(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//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_0037: 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_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: 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_0082: 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_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
int num = <>1__state;
LifeLinkMono lifeLinkMono = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
<oldPosition>5__2 = Vector2.op_Implicit(lifeLinkMono.LinkTargetTwo.transform.position);
break;
case 1:
<>1__state = -1;
break;
}
if (lifeLinkMono.lineTurnBackAmount > 0f)
{
lifeLinkMono.lineTurnBackAmount -= Time.deltaTime * 2f;
Vector2 val = Vector2.Lerp(<oldPosition>5__2, Vector2.op_Implicit(((Component)lifeLinkMono.player).transform.position), 1f - lifeLinkMono.lineTurnBackAmount);
lifeLinkMono.LinkTargetTwo.transform.position = Vector2.op_Implicit(val);
<>2__current = null;
<>1__state = 1;
return true;
}
lifeLinkMono.LineRenderer.gameObject.SetActive(false);
if (lifeLinkMono.player.data.view.IsMine)
{
lifeLinkMono.player.data.view.RPC("RPCA_Die", (RpcTarget)0, new object[1] { Vector2.down });
}
lifeLinkMono.player.data.health = 0f;
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public GameObject LinkTargetOne;
public GameObject LinkTargetTwo;
public GameObject LineRenderer;
private Player player;
private Player linkedPlayer;
private float lineTurnBackAmount = 1f;
private bool linkedDeathStarted;
public void OnPhotonInstantiate(PhotonMessageInfo info)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Expected O, but got Unknown
object[] instantiationData = info.photonView.InstantiationData;
int playerId = (int)instantiationData[0];
int linkedPlayerId = (int)instantiationData[1];
player = ((IEnumerable<Player>)PlayerManager.instance.players).FirstOrDefault((Func<Player, bool>)((Player p) => p.playerID == playerId));
linkedPlayer = ((IEnumerable<Player>)PlayerManager.instance.players).FirstOrDefault((Func<Player, bool>)((Player p) => p.playerID == linkedPlayerId));
DeathHandler.OnPlayerDeath += new DeathHandlerDelegate(OnDeath);
HealthHandler healthHandler = linkedPlayer.data.healthHandler;
healthHandler.reviveAction = (Action)Delegate.Combine(healthHandler.reviveAction, new Action(OnRevive));
HealthHandler healthHandler2 = player.data.healthHandler;
healthHandler2.reviveAction = (Action)Delegate.Combine(healthHandler2.reviveAction, new Action(OnRevive));
}
private void OnDeath(Player player, Dictionary<Player, DamageInfo> playerDamageInfos)
{
ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)this, 1, (Action)delegate
{
if (!player.data.healthHandler.isRespawning)
{
if ((Object)(object)player == (Object)(object)linkedPlayer)
{
if (!linkedDeathStarted)
{
linkedDeathStarted = true;
((MonoBehaviour)this).StartCoroutine(LinkedDeath());
}
}
else if ((Object)(object)player == (Object)(object)this.player)
{
linkedDeathStarted = true;
lineTurnBackAmount = 0f;
LineRenderer.gameObject.SetActive(false);
}
}
});
}
private void OnRevive()
{
if (!player.data.dead && !linkedPlayer.data.dead)
{
linkedDeathStarted = false;
lineTurnBackAmount = 1f;
LineRenderer.gameObject.SetActive(true);
}
}
[IteratorStateMachine(typeof(<LinkedDeath>d__10))]
private IEnumerator LinkedDeath()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LinkedDeath>d__10(0)
{
<>4__this = this
};
}
private void Update()
{
//IL_0033: 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)player == (Object)null) && !((Object)(object)linkedPlayer == (Object)null))
{
LinkTargetOne.transform.position = ((Component)player).transform.position;
if (!linkedDeathStarted)
{
LinkTargetTwo.transform.position = ((Component)linkedPlayer).transform.position;
}
}
}
private void OnDestroy()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Expected O, but got Unknown
if ((Object)(object)player != (Object)null)
{
DeathHandler.OnPlayerDeath -= new DeathHandlerDelegate(OnDeath);
HealthHandler healthHandler = player.data.healthHandler;
healthHandler.reviveAction = (Action)Delegate.Remove(healthHandler.reviveAction, new Action(OnRevive));
}
if ((Object)(object)linkedPlayer != (Object)null)
{
HealthHandler healthHandler2 = linkedPlayer.data.healthHandler;
healthHandler2.reviveAction = (Action)Delegate.Remove(healthHandler2.reviveAction, new Action(OnRevive));
}
}
}
public class SwapBlockAndFireEffect : MonoBehaviour
{
private CharacterData CharacterData;
private PlayerActions PlayerActions;
private List<BindingSource> blockBindingSources;
private List<BindingSource> fireBindingSources;
private void Start()
{
CharacterData = ((Component)this).GetComponentInParent<CharacterData>();
PlayerActions = CharacterData.playerActions;
blockBindingSources = PlayerActions.Block.Bindings.ToList();
fireBindingSources = PlayerActions.Fire.Bindings.ToList();
foreach (BindingSource blockBindingSource in blockBindingSources)
{
_ = blockBindingSource;
PlayerActions.Block.ClearBindings();
}
foreach (BindingSource fireBindingSource in fireBindingSources)
{
_ = fireBindingSource;
PlayerActions.Fire.ClearBindings();
}
foreach (BindingSource blockBindingSource2 in blockBindingSources)
{
_ = blockBindingSource2;
foreach (BindingSource fireBindingSource2 in fireBindingSources)
{
PlayerActions.Block.AddBinding(fireBindingSource2);
}
}
foreach (BindingSource fireBindingSource3 in fireBindingSources)
{
_ = fireBindingSource3;
foreach (BindingSource blockBindingSource3 in blockBindingSources)
{
PlayerActions.Fire.AddBinding(blockBindingSource3);
}
}
}
private void OnDestroy()
{
foreach (BindingSource blockBindingSource in blockBindingSources)
{
if (!PlayerActions.Block.HasBinding(blockBindingSource))
{
PlayerActions.Block.AddBinding(blockBindingSource);
}
}
foreach (BindingSource fireBindingSource in fireBindingSources)
{
if (!PlayerActions.Fire.HasBinding(fireBindingSource))
{
PlayerActions.Fire.AddBinding(fireBindingSource);
}
}
}
}
}
namespace AALUND13Cards.Curses.Handlers
{
public class FlashlightMaskHandler : MonoBehaviour
{
[CompilerGenerated]
private sealed class <FadeCoroutine>d__17 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public FlashlightMaskHandler <>4__this;
public float from;
public float to;
public float duration;
private float <elapsed>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <FadeCoroutine>d__17(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
int num = <>1__state;
FlashlightMaskHandler flashlightMaskHandler = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
<elapsed>5__2 = 0f;
break;
case 1:
<>1__state = -1;
break;
}
if (<elapsed>5__2 < duration)
{
<elapsed>5__2 += Time.deltaTime;
flashlightMaskHandler.globalFade = Mathf.Lerp(from, to, Mathf.Clamp01(<elapsed>5__2 / duration));
flashlightMaskHandler.mat.SetFloat("_GlobalFade", flashlightMaskHandler.globalFade);
<>2__current = null;
<>1__state = 1;
return true;
}
flashlightMaskHandler.globalFade = to;
flashlightMaskHandler.mat.SetFloat("_GlobalFade", flashlightMaskHandler.globalFade);
flashlightMaskHandler.fadeCoroutine = null;
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public Material mat;
public float RadiusFadeInMultiplier = 0.2f;
public float RadiusFadeOutMultiplier = 1f;
public float FadeDuration = 2f;
private Dictionary<Player, float> currentRadii = new Dictionary<Player, float>();
private Coroutine fadeCoroutine;
private float globalFade;
private bool isBattleActive;
private bool oldIsBattleActive;
public static FlashlightMaskHandler Instance { get; private set; }
private void Awake()
{
Instance = this;
globalFade = 0f;
mat.SetFloat("_GlobalFade", globalFade);
}
private void OnDestroy()
{
if (fadeCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(fadeCoroutine);
}
Instance = null;
}
private void Update()
{
//IL_0103: 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)
//IL_0112: 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_012a: 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_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
List<Player> list = PlayerManager.instance.players.Where((Player p) => p.data.view.IsMine && !p.data.dead).ToList();
int num = Mathf.Clamp(list.Count, 0, 32);
isBattleActive = GameManager.instance.battleOngoing && list.Any((Player p) => CharacterDataExtensions.GetCustomStatsRegistry(p.data).GetOrCreate<CursesStats>().IsBind) && num > 0;
if (isBattleActive != oldIsBattleActive)
{
oldIsBattleActive = isBattleActive;
if (isBattleActive)
{
OnBattleStart();
}
else
{
OnBattleEnd();
}
}
Vector4[] array = (Vector4[])(object)new Vector4[32];
float[] array2 = new float[32];
Camera main = Camera.main;
for (int i = 0; i < num; i++)
{
Player val = list[i];
if (!((Object)(object)val == (Object)null) && Object.op_Implicit((Object)(object)((Component)val).transform))
{
Vector3 val2 = main.WorldToViewportPoint(((Component)val).transform.position);
array[i] = new Vector4(val2.x, val2.y, 0f, 0f);
float num2 = CalculateRadius(val);
if (!currentRadii.ContainsKey(val))
{
currentRadii[val] = num2;
}
float num3 = currentRadii[val];
num3 = Mathf.MoveTowards(num3, num2, Time.deltaTime);
currentRadii[val] = num3;
array2[i] = num3;
}
}
for (int j = num; j < 32; j++)
{
array[j] = Vector4.zero;
array2[j] = 0f;
}
mat.SetVectorArray("_LightPosArray", array);
mat.SetFloatArray("_RadiusArray", array2);
mat.SetInt("_LightCount", num);
foreach (Player item in currentRadii.Keys.Except(list).ToList())
{
currentRadii.Remove(item);
}
}
private float CalculateRadius(Player player)
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)player == (Object)null || !Object.op_Implicit((Object)(object)((Component)player).transform))
{
return 0f;
}
float orthographicSize = Camera.main.orthographicSize;
float num = Mathf.Max(((Component)player).transform.localScale.x, 2f);
float num2 = 1f / Mathf.Max(orthographicSize, 0.01f);
float num3 = (isBattleActive ? RadiusFadeInMultiplier : RadiusFadeOutMultiplier);
return Mathf.Max(num * num2 * num3, 0.01f);
}
[IteratorStateMachine(typeof(<FadeCoroutine>d__17))]
private IEnumerator FadeCoroutine(float from, float to, float duration)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <FadeCoroutine>d__17(0)
{
<>4__this = this,
from = from,
to = to,
duration = duration
};
}
public void OnBattleStart()
{
isBattleActive = true;
if (fadeCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(fadeCoroutine);
}
fadeCoroutine = ((MonoBehaviour)this).StartCoroutine(FadeCoroutine(globalFade, 1f, FadeDuration));
}
public void OnBattleEnd()
{
isBattleActive = false;
if (fadeCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(fadeCoroutine);
}
fadeCoroutine = ((MonoBehaviour)this).StartCoroutine(FadeCoroutine(globalFade, 0f, FadeDuration));
}
}
}
namespace AALUND13Cards.Curses.Cards
{
public class CursesStats : ICustomStats
{
public bool IsBind;
public bool DisableDecayTime;
public void ResetStats()
{
DisableDecayTime = false;
IsBind = false;
}
}
}
namespace AALUND13Cards.Curses.Cards.StatModifers
{
public class CursesStatsModifers : CustomStatModifers
{
[Header("Curses Stats")]
public bool IsBind;
public bool DisableDecayTime;
public override void Apply(Player player)
{
CursesStats orCreate = CharacterDataExtensions.GetCustomStatsRegistry(player.data).GetOrCreate<CursesStats>();
if (IsBind)
{
orCreate.IsBind = true;
}
if (DisableDecayTime)
{
orCreate.DisableDecayTime = true;
}
}
}
}