Decompiled source of MithrixEX v1.0.0

MithrixEX.dll

Decompiled 2 months 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.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using EntityStates;
using EntityStates.BrotherMonster;
using EntityStates.BrotherMonster.Weapon;
using EntityStates.LunarWisp;
using EntityStates.Missions.BrotherEncounter;
using EntityStates.Turret1;
using HG;
using HG.Reflection;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using MithrixEX.Buffs;
using MithrixEX.CharacterMasters;
using MysticsRisky2Utils;
using MysticsRisky2Utils.BaseAssetTypes;
using MysticsRisky2Utils.ContentManagement;
using On.EntityStates.BrotherMonster;
using On.EntityStates.BrotherMonster.Weapon;
using On.EntityStates.Missions.BrotherEncounter;
using On.RoR2;
using On.RoR2.UI;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using R2API.Utils;
using RoR2;
using RoR2.ContentManagement;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("MithrixEX")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MithrixEX")]
[assembly: AssemblyTitle("MithrixEX")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: UnverifiableCode]
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 MithrixEX
{
	public class BrotherEX
	{
		public BodyIndex brotherBodyIndex;

		public BodyIndex brotherHurtBodyIndex;

		public MusicTrackDef replacementSong;

		private float oldWaveProjectileArc;

		private bool isUlting;

		private int ultWaveCount = 15;

		private float ultMaxDuration = 8f;

		private float ultMaxFiringDuration = 7f;

		private int ultWavesFired;

		private GameObject ultWaveProjectilePrefab;

		private float ultPlayerVisionDistance = 90f;

		public GameObject arenaEffects;

		public CharacterMaster brotherDummyAttackerMaster;

		private MeteorStormController _meteorStormController;

		public float meteorTimer;

		public float spinnyTimer;

		public MeteorStormController meteorStormController
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)_meteorStormController))
				{
					_meteorStormController = LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/MeteorStorm").GetComponent<MeteorStormController>();
				}
				return _meteorStormController;
			}
		}

		public BrotherEX()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: 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_0099: Expected O, but got Unknown
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Expected O, but got Unknown
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Expected O, but got Unknown
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Expected O, but got Unknown
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Expected O, but got Unknown
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Expected O, but got Unknown
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Expected O, but got Unknown
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Expected O, but got Unknown
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Expected O, but got Unknown
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Expected O, but got Unknown
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Expected O, but got Unknown
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Expected O, but got Unknown
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Expected O, but got Unknown
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Expected O, but got Unknown
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Expected O, but got Unknown
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Expected O, but got Unknown
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Expected O, but got Unknown
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Expected O, but got Unknown
			brotherBodyIndex = BodyCatalog.FindBodyIndex("BrotherBody");
			brotherHurtBodyIndex = BodyCatalog.FindBodyIndex("BrotherHurtBody");
			replacementSong = MusicTrackCatalog.FindMusicTrackDef("muSong23");
			ultWaveProjectilePrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/BrotherHaunt/BrotherUltLineProjectileStatic.prefab").WaitForCompletion();
			CharacterBody.onBodyStartGlobal += CharacterBody_onBodyStartGlobal;
			CharacterBody.OnDeathStart += new hook_OnDeathStart(CharacterBody_OnDeathStart);
			MusicController.PickCurrentTrack += new hook_PickCurrentTrack(MusicController_PickCurrentTrack);
			MusicController.RecalculateHealth += new hook_RecalculateHealth(MusicController_RecalculateHealth);
			CharacterBody.RecalculateStats += new hook_RecalculateStats(CharacterBody_RecalculateStats);
			Language.GetLocalizedStringByToken += new hook_GetLocalizedStringByToken(Language_GetLocalizedStringByToken);
			Phase1.PreEncounterBegin += new hook_PreEncounterBegin(Phase1_PreEncounterBegin);
			EncounterFinished.OnEnter += new hook_OnEnter(EncounterFinished_OnEnter);
			WeaponSlam.FixedUpdate += new hook_FixedUpdate(WeaponSlam_FixedUpdate);
			oldWaveProjectileArc = WeaponSlam.waveProjectileArc;
			WeaponSlam.waveProjectileArc = 360f;
			WeaponSlam.waveProjectileCount += 5;
			SprintBash.OnEnter += new hook_OnEnter(SprintBash_OnEnter);
			HoldSkyLeap.OnEnter += new hook_OnEnter(HoldSkyLeap_OnEnter);
			HoldSkyLeap.FixedUpdate += new hook_FixedUpdate(HoldSkyLeap_FixedUpdate);
			ExitSkyLeap.OnEnter += new hook_OnEnter(ExitSkyLeap_OnEnter);
			BaseSlideState.duration *= 0.5f;
			UltEnterState.OnEnter += new hook_OnEnter(UltEnterState_OnEnter);
			UltChannelState.FixedUpdate += new hook_FixedUpdate(UltChannelState_FixedUpdate);
			UltChannelState.OnExit += new hook_OnExit(UltChannelState_OnExit);
			FistSlam.FixedUpdate += new hook_FixedUpdate(FistSlam_FixedUpdate);
			FireLunarShards.OnEnter += new hook_OnEnter(FireLunarShards_OnEnter);
			Phase2.OnEnter += new hook_OnEnter(Phase2_OnEnter);
			Phase2.FixedUpdate += new hook_FixedUpdate(Phase2_FixedUpdate);
			BrotherEncounterPhaseBaseState.FixedUpdate += new hook_FixedUpdate(BrotherEncounterPhaseBaseState_FixedUpdate);
			ItemStealController.BrotherItemFilter += new hook_BrotherItemFilter(ItemStealController_BrotherItemFilter);
		}

		private void CharacterBody_onBodyStartGlobal(CharacterBody body)
		{
			//IL_0008: 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)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active && (body.bodyIndex == brotherBodyIndex || body.bodyIndex == brotherHurtBodyIndex) && !body.HasBuff(MithrixEXContent.Buffs.MithrixEX_EXBoss))
			{
				body.AddBuff(MithrixEXContent.Buffs.MithrixEX_EXBoss);
			}
		}

		private void CharacterBody_OnDeathStart(orig_OnDeathStart orig, CharacterBody self)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			if (self.bodyIndex == brotherBodyIndex || self.bodyIndex == brotherHurtBodyIndex)
			{
				self.RemoveBuff(MithrixEXContent.Buffs.MithrixEX_EXBoss);
				isUlting = false;
			}
			orig.Invoke(self);
		}

		private void MusicController_PickCurrentTrack(orig_PickCurrentTrack orig, MusicController self, ref MusicTrackDef newTrack)
		{
			orig.Invoke(self, ref newTrack);
			if (newTrack.cachedName == "muSong25")
			{
				newTrack = replacementSong;
			}
		}

		private void MusicController_RecalculateHealth(orig_RecalculateHealth orig, MusicController self, GameObject playerObject)
		{
			orig.Invoke(self, playerObject);
			if (isUlting)
			{
				self.rtpcPlayerHealthValue.value = -50f;
			}
		}

		private void CharacterBody_RecalculateStats(orig_RecalculateStats orig, CharacterBody self)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Invalid comparison between Unknown and I4
			orig.Invoke(self);
			if (isUlting && (int)self.teamComponent.teamIndex == 1 && self.visionDistance > ultPlayerVisionDistance)
			{
				self.visionDistance = ultPlayerVisionDistance;
			}
		}

		private string Language_GetLocalizedStringByToken(orig_GetLocalizedStringByToken orig, Language self, string token)
		{
			if (token == "BROTHER_DIALOGUE_FORMAT")
			{
				return self.GetLocalizedFormattedStringByToken("<color=#AB9AD3><size=180%>{1} EX: <link=\"ChallengeModeShaky\">{0}</link></color></size>", new object[2]
				{
					"{0}",
					self.GetLocalizedStringByToken("BROTHER_BODY_NAME")
				});
			}
			return orig.Invoke(self, token);
		}

		private void Phase1_PreEncounterBegin(orig_PreEncounterBegin orig, Phase1 self)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			EXBossAssets.fightEffectsActive = true;
			if (Object.op_Implicit((Object)(object)BrotherEXAssets.arenaEffectsPrefab))
			{
				arenaEffects = Object.Instantiate<GameObject>(BrotherEXAssets.arenaEffectsPrefab, new Vector3(-80f, 491f, 0f), Quaternion.identity);
			}
		}

		private void EncounterFinished_OnEnter(orig_OnEnter orig, EncounterFinished self)
		{
			orig.Invoke(self);
			EXBossAssets.fightEffectsActive = false;
			if (Object.op_Implicit((Object)(object)arenaEffects))
			{
				Object.Destroy((Object)(object)arenaEffects);
			}
		}

		public static void GlobalKnockup(Vector3 myPosition, bool strong)
		{
			//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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers((TeamIndex)1))
			{
				if (Object.op_Implicit((Object)(object)teamMember.body))
				{
					CharacterBody body = teamMember.body;
					Vector3 val = Vector3.up * 1000f;
					Vector3 val2 = myPosition - teamMember.body.corePosition;
					PlayerKnockupStun.KnockupBody(body, val + ((Vector3)(ref val2)).normalized * (strong ? (-3000f) : 500f));
				}
			}
		}

		private void WeaponSlam_FixedUpdate(orig_FixedUpdate orig, WeaponSlam self)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)self.modelAnimator) && self.modelAnimator.GetFloat("blast.hitBoxActive") > 0.5f && !self.hasDoneBlastAttack)
			{
				GlobalKnockup(((EntityState)self).characterBody.corePosition, Object.op_Implicit((Object)(object)PhaseCounter.instance) && PhaseCounter.instance.phase == 3);
			}
			orig.Invoke(self);
		}

		private void SprintBash_OnEnter(orig_OnEnter orig, SprintBash self)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			DamageAPI.AddModdedDamageType(((BasicMeleeAttack)self).overlapAttack, BrotherEXAssets.destroyItemDamageType);
		}

		private void HoldSkyLeap_OnEnter(orig_OnEnter orig, HoldSkyLeap self)
		{
			//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_002f: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = ((EntityState)self).characterBody.transform.position;
			orig.Invoke(self);
			if (NetworkServer.active)
			{
				GameObject obj = Object.Instantiate<GameObject>(BrotherEXAssets.skyLeapHomingController);
				obj.transform.position = position;
				obj.GetComponent<BrotherEXAssets.ChallengeModeSkyLeapHomingController>().body = ((EntityState)self).characterBody;
				NetworkServer.Spawn(obj);
			}
		}

		private void HoldSkyLeap_FixedUpdate(orig_FixedUpdate orig, HoldSkyLeap self)
		{
			orig.Invoke(self);
		}

		private void ExitSkyLeap_OnEnter(orig_OnEnter orig, ExitSkyLeap self)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			float waveProjectileDamageCoefficient = ExitSkyLeap.waveProjectileDamageCoefficient;
			ExitSkyLeap.waveProjectileDamageCoefficient = 1f;
			orig.Invoke(self);
			ExitSkyLeap.waveProjectileDamageCoefficient = waveProjectileDamageCoefficient;
			GlobalKnockup(((EntityState)self).characterBody.corePosition, strong: false);
			foreach (BrotherEXAssets.ChallengeModeSkyLeapHomingController item in InstanceTracker.GetInstancesList<BrotherEXAssets.ChallengeModeSkyLeapHomingController>().ToList())
			{
				if ((Object)(object)item.body == (Object)(object)((EntityState)self).characterBody)
				{
					Object.Destroy((Object)(object)((Component)item).gameObject);
				}
			}
		}

		private void UltEnterState_OnEnter(orig_OnEnter orig, UltEnterState self)
		{
			orig.Invoke(self);
			isUlting = true;
			ultWavesFired = 0;
		}

		private void UltChannelState_FireWave(orig_FireWave orig, UltChannelState self)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			float waveProjectileDamageCoefficient = UltChannelState.waveProjectileDamageCoefficient;
			UltChannelState.waveProjectileDamageCoefficient = 3f;
			orig.Invoke(self);
			UltChannelState.waveProjectileDamageCoefficient = waveProjectileDamageCoefficient;
			RoR2Application.fixedTimeTimers.CreateTimer(1f, (Action)delegate
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0063: Unknown result type (might be due to invalid IL or missing references)
				//IL_0068: 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_0079: 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_008f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0090: Unknown result type (might be due to invalid IL or missing references)
				//IL_0095: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
				if (self != null && Object.op_Implicit((Object)(object)((EntityState)self).gameObject))
				{
					GlobalKnockup(((EntityState)self).characterBody.corePosition, strong: false);
					if (((EntityState)self).isAuthority)
					{
						float num = 360f / (float)ExitSkyLeap.waveProjectileCount;
						Vector3 val = Vector3.ProjectOnPlane(((EntityState)self).inputBank.aimDirection, Vector3.up);
						Vector3 footPosition = ((EntityState)self).characterBody.footPosition;
						for (int i = 0; i < ExitSkyLeap.waveProjectileCount; i++)
						{
							Vector3 val2 = Quaternion.AngleAxis(num * (float)i, Vector3.up) * val;
							ProjectileManager.instance.FireProjectile(ExitSkyLeap.waveProjectilePrefab, footPosition, Util.QuaternionSafeLookRotation(val2), ((EntityState)self).gameObject, ((EntityState)self).characterBody.damage * 1f, ExitSkyLeap.waveProjectileForce, Util.CheckRoll(((EntityState)self).characterBody.crit, ((EntityState)self).characterBody.master), (DamageColorIndex)0, (GameObject)null, -1f);
						}
					}
				}
			});
		}

		private void UltChannelState_FixedUpdate(orig_FixedUpdate orig, UltChannelState self)
		{
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Expected O, but got Unknown
			//IL_00de: 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_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: 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)
			//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_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			self.wavesFired = 99;
			orig.Invoke(self);
			if (!((EntityState)self).isAuthority)
			{
				return;
			}
			if (Mathf.CeilToInt(((EntityState)self).fixedAge / ultMaxFiringDuration * (float)ultWaveCount) > ultWavesFired && ultWavesFired < ultWaveCount)
			{
				ultWavesFired++;
				foreach (CharacterBody item in from x in TeamComponent.GetTeamMembers((TeamIndex)1)
					where Object.op_Implicit((Object)(object)x.body) && x.body.isPlayerControlled
					select x.body)
				{
					Vector3 val = (Object.op_Implicit((Object)(object)item.inputBank) ? item.inputBank.aimDirection : item.transform.forward);
					val.y = 0f;
					((Vector3)(ref val)).Normalize();
					Vector3 val2 = item.footPosition - val * 150f;
					ProjectileManager.instance.FireProjectile(ultWaveProjectilePrefab, val2, Util.QuaternionSafeLookRotation(val), ((EntityState)self).gameObject, ((EntityState)self).characterBody.damage * 4f, UltChannelState.waveProjectileForce, Util.CheckRoll(((EntityState)self).characterBody.crit, ((EntityState)self).characterBody.master), (DamageColorIndex)0, (GameObject)null, -1f);
				}
			}
			if (((EntityState)self).fixedAge > ultMaxDuration)
			{
				((EntityState)self).outer.SetNextState((EntityState)new UltExitState());
			}
		}

		private void UltChannelState_OnExit(orig_OnExit orig, UltChannelState self)
		{
			orig.Invoke(self);
			isUlting = false;
		}

		private void FistSlam_FixedUpdate(orig_FixedUpdate orig, FistSlam self)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)self.modelAnimator) && self.modelAnimator.GetFloat("fist.hitBoxActive") > 0.5f && !self.hasAttacked)
			{
				GlobalKnockup(((EntityState)self).characterBody.corePosition, strong: false);
			}
			orig.Invoke(self);
		}

		public void RunMeteors(float meteorInterval, int meteorCount, float meteorRadius, float meteorBaseDamage)
		{
			//IL_006f: 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_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: 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_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				return;
			}
			meteorTimer -= Time.fixedDeltaTime;
			if (!(meteorTimer <= 0f))
			{
				return;
			}
			meteorTimer += meteorInterval;
			RaycastHit val2 = default(RaycastHit);
			for (int i = 0; i < meteorCount; i++)
			{
				Vector2 val = 250f * Random.insideUnitCircle;
				Vector3 meteorPosition = new Vector3(val.x, 491f, val.y);
				if (Physics.Raycast(new Ray(meteorPosition, Vector3.down), ref val2, 500f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)0))
				{
					meteorPosition.y = ((RaycastHit)(ref val2)).point.y;
				}
				meteorPosition += Vector3.up * 0.2f;
				RoR2Application.fixedTimeTimers.CreateTimer(Random.Range(0f, meteorInterval), (Action)delegate
				{
					//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_001c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0026: Unknown result type (might be due to invalid IL or missing references)
					//IL_003d: Expected O, but got Unknown
					//IL_0066: Unknown result type (might be due to invalid IL or missing references)
					EffectManager.SpawnEffect(meteorStormController.warningEffectPrefab, new EffectData
					{
						origin = meteorPosition,
						scale = meteorRadius
					}, true);
					RoR2Application.fixedTimeTimers.CreateTimer(2f, (Action)delegate
					{
						//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_001c: Unknown result type (might be due to invalid IL or missing references)
						//IL_002c: Expected O, but got Unknown
						//IL_002c: Unknown result type (might be due to invalid IL or missing references)
						//IL_0031: Unknown result type (might be due to invalid IL or missing references)
						//IL_005a: 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_0063: 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_0069: Unknown result type (might be due to invalid IL or missing references)
						//IL_006e: Unknown result type (might be due to invalid IL or missing references)
						//IL_0073: Unknown result type (might be due to invalid IL or missing references)
						//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_007c: 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_008c: Unknown result type (might be due to invalid IL or missing references)
						//IL_0092: Unknown result type (might be due to invalid IL or missing references)
						//IL_009d: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
						//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
						EffectManager.SpawnEffect(meteorStormController.impactEffectPrefab, new EffectData
						{
							origin = meteorPosition
						}, true);
						new BlastAttack
						{
							baseDamage = meteorBaseDamage * (0.8f + 0.2f * (float)Run.instance.ambientLevelFloor),
							crit = false,
							falloffModel = (FalloffModel)0,
							bonusForce = Vector3.zero,
							damageColorIndex = (DamageColorIndex)0,
							position = meteorPosition,
							procChainMask = default(ProcChainMask),
							procCoefficient = 1f,
							teamIndex = (TeamIndex)2,
							radius = meteorRadius
						}.Fire();
					});
				});
			}
		}

		private void FireLunarShards_OnEnter(orig_OnEnter orig, FireLunarShards self)
		{
			//IL_002a: 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_007e: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (((BaseSkillState)self).activatorSkillSlot.stock > 0)
			{
				return;
			}
			Util.PlaySound(SeekingBomb.fireBombSoundString, ((EntityState)self).gameObject);
			Ray aimRay = ((BaseState)self).GetAimRay();
			Transform modelTransform = ((EntityState)self).GetModelTransform();
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				ChildLocator component = ((Component)modelTransform).GetComponent<ChildLocator>();
				if (Object.op_Implicit((Object)(object)component))
				{
					((Ray)(ref aimRay)).origin = ((Component)component.FindChild(FireLunarShards.muzzleString)).transform.position;
				}
			}
			if (((EntityState)self).isAuthority)
			{
				ProjectileManager.instance.FireProjectile(SeekingBomb.projectilePrefab, ((Ray)(ref aimRay)).origin, Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction), ((EntityState)self).gameObject, ((BaseState)self).damageStat * SeekingBomb.bombDamageCoefficient, SeekingBomb.bombForce, Util.CheckRoll(((BaseState)self).critStat, ((EntityState)self).characterBody.master), (DamageColorIndex)0, (GameObject)null, -1f);
			}
		}

		public void RunSpinny(float spinnyInterval, int count, float damageMultiplier)
		{
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			spinnyTimer += Time.fixedDeltaTime;
			if (!(spinnyTimer >= spinnyInterval))
			{
				return;
			}
			spinnyTimer -= spinnyInterval;
			if (Object.op_Implicit((Object)(object)brotherDummyAttackerMaster) && brotherDummyAttackerMaster.hasBody)
			{
				CharacterBody body = brotherDummyAttackerMaster.GetBody();
				GameObject val = UltChannelState.waveProjectileLeftPrefab;
				if (Random.value <= 0.5f)
				{
					val = UltChannelState.waveProjectileRightPrefab;
				}
				float num = 360f / (float)count;
				Vector3 val2 = Vector3.ProjectOnPlane(Random.onUnitSphere, Vector3.up);
				Vector3 normalized = ((Vector3)(ref val2)).normalized;
				Vector3 val3 = default(Vector3);
				((Vector3)(ref val3))..ctor(-80f, 491f, 0f);
				for (int i = 0; i < count; i++)
				{
					Vector3 val4 = Quaternion.AngleAxis(num * (float)i, Vector3.up) * normalized;
					ProjectileManager.instance.FireProjectile(val, val3, Util.QuaternionSafeLookRotation(val4), ((Component)body).gameObject, body.damage * damageMultiplier, UltChannelState.waveProjectileForce, false, (DamageColorIndex)0, (GameObject)null, -1f);
				}
			}
		}

		private void Phase2_OnEnter(orig_OnEnter orig, Phase2 self)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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)
			//IL_003c: 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)
			//IL_0050: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			orig.Invoke(self);
			if (Object.op_Implicit((Object)(object)brotherDummyAttackerMaster) || !NetworkServer.active)
			{
				return;
			}
			DirectorSpawnRequest val = new DirectorSpawnRequest((SpawnCard)(object)BrotherDummyAttacker.characterSpawnCard, new DirectorPlacementRule
			{
				placementMode = (PlacementMode)0,
				position = new Vector3(0f, 1000f, 0f)
			}, RoR2Application.rng);
			val.teamIndexOverride = (TeamIndex)2;
			val.ignoreTeamMemberLimit = true;
			val.onSpawnedServer = (Action<SpawnResult>)Delegate.Combine(val.onSpawnedServer, (Action<SpawnResult>)delegate(SpawnResult spawnResult)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: 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)
				if (spawnResult.success && Object.op_Implicit((Object)(object)spawnResult.spawnedInstance))
				{
					brotherDummyAttackerMaster = spawnResult.spawnedInstance.GetComponent<CharacterMaster>();
					brotherDummyAttackerMaster.inventory.GiveItem(Items.UseAmbientLevel, 1);
				}
			});
			DirectorCore.instance.TrySpawnObject(val);
		}

		private void Phase2_FixedUpdate(orig_FixedUpdate orig, Phase2 self)
		{
			orig.Invoke(self);
			RunMeteors(1f, 15, 8f, 20f);
			RunSpinny(6f, 6, 2f);
		}

		private void BrotherEncounterPhaseBaseState_FixedUpdate(orig_FixedUpdate orig, BrotherEncounterPhaseBaseState self)
		{
			orig.Invoke(self);
			if (Object.op_Implicit((Object)(object)PhaseCounter.instance))
			{
				if (PhaseCounter.instance.phase == 3)
				{
					RunMeteors(0.2f, 6, 10f, 30f);
				}
				if (PhaseCounter.instance.phase == 4)
				{
					RunMeteors(0.2f, 12, 6f, 30f);
				}
			}
		}

		private bool ItemStealController_BrotherItemFilter(orig_BrotherItemFilter orig, ItemIndex itemIndex)
		{
			return false;
		}
	}
	public class BrotherEXAssets : BaseLoadableAsset
	{
		public class ChallengeModeSkyLeapHomingController : MonoBehaviour
		{
			public CharacterBody body;

			public GameObject warningCircle;

			public Transform warningCircleTransform;

			public float leapAcceleration = 40f;

			public float leapMaxSpeed = 30f;

			public Vector3 leapSpeed = Vector3.zero;

			public Vector3 homingPosition = Vector3.zero;

			private Vector3 spareVector = Vector3.zero;

			public void Start()
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: 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)
				warningCircle = Object.Instantiate<GameObject>(leapWarningCircle, new Vector3(((Component)this).transform.position.x, 0f, ((Component)this).transform.position.z), Quaternion.identity);
				warningCircleTransform = warningCircle.transform;
			}

			public void FixedUpdate()
			{
				//IL_0076: Unknown result type (might be due to invalid IL or missing references)
				//IL_007b: Unknown result type (might be due to invalid IL or missing references)
				//IL_008a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0090: Unknown result type (might be due to invalid IL or missing references)
				//IL_0095: 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_009e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b8: 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_013d: 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_014d: 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_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_005b: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
				//IL_020c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0237: Unknown result type (might be due to invalid IL or missing references)
				//IL_025e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0274: Unknown result type (might be due to invalid IL or missing references)
				//IL_0285: Unknown result type (might be due to invalid IL or missing references)
				//IL_0220: Unknown result type (might be due to invalid IL or missing references)
				//IL_018c: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)body) && body.master.aiComponents.Length != 0 && body.master.aiComponents[0].currentEnemy != null)
				{
					homingPosition = body.master.aiComponents[0].currentEnemy.lastKnownBullseyePosition.Value;
					homingPosition.y = 0f;
				}
				Vector3 position = ((Component)this).transform.position;
				position.y = 0f;
				Vector3 val = leapSpeed;
				Vector3 val2 = homingPosition - position;
				leapSpeed = val + ((Vector3)(ref val2)).normalized * leapAcceleration * Time.fixedDeltaTime;
				if (Mathf.Abs(leapSpeed.x) > leapMaxSpeed)
				{
					leapSpeed.x = Mathf.Sign(leapSpeed.x) * leapMaxSpeed;
				}
				if (Mathf.Abs(leapSpeed.z) > leapMaxSpeed)
				{
					leapSpeed.z = Mathf.Sign(leapSpeed.z) * leapMaxSpeed;
				}
				Transform transform = ((Component)this).transform;
				transform.position += leapSpeed * Time.fixedDeltaTime;
				if (Object.op_Implicit((Object)(object)body) && body.hasEffectiveAuthority)
				{
					((BaseCharacterController)body.characterMotor).Motor.SetPosition(new Vector3(((Component)this).transform.position.x, body.transform.position.y, ((Component)this).transform.position.z), true);
				}
				float y = 491f;
				RaycastHit val3 = default(RaycastHit);
				if (Physics.Raycast(new Ray(new Vector3(((Component)this).transform.position.x, 560f, ((Component)this).transform.position.z), Vector3.down), ref val3, 500f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)0))
				{
					y = ((RaycastHit)(ref val3)).point.y;
				}
				spareVector.x = ((Component)this).transform.position.x;
				spareVector.y = y;
				spareVector.z = ((Component)this).transform.position.z;
				((Component)this).transform.position = spareVector;
				warningCircleTransform.position = spareVector;
			}

			public void OnEnable()
			{
				InstanceTracker.Add<ChallengeModeSkyLeapHomingController>(this);
			}

			public void OnDisable()
			{
				InstanceTracker.Remove<ChallengeModeSkyLeapHomingController>(this);
			}

			public void OnDestroy()
			{
				if (Object.op_Implicit((Object)(object)warningCircle))
				{
					Object.Destroy((Object)(object)warningCircle);
				}
			}
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static DamageReportEventHandler <0>__GenericGameEvents_OnTakeDamage;
		}

		public static GameObject arenaEffectsPrefab;

		public static ModdedDamageType destroyItemDamageType;

		public static SkillDef playerStunLockedSkill;

		public static GameObject skyLeapHomingController;

		public static GameObject leapWarningCircle;

		public override void OnPluginAwake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			((BaseLoadableAsset)this).OnPluginAwake();
			destroyItemDamageType = DamageAPI.ReserveDamageType();
			skyLeapHomingController = Utils.CreateBlankPrefab("MithrixEX_SkyLeapHomingController", true);
			skyLeapHomingController.AddComponent<NetworkTransform>();
			skyLeapHomingController.GetComponent<NetworkIdentity>().localPlayerAuthority = true;
			skyLeapHomingController.AddComponent<ChallengeModeSkyLeapHomingController>();
		}

		public override void Load()
		{
			//IL_0055: 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_008a: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Expected O, but got Unknown
			arenaEffectsPrefab = MithrixEX.AssetBundle.LoadAsset<GameObject>("Assets/Mods/ChallengeMode/Modifiers/BrotherEX/BrotherEXArenaEffects.prefab");
			playerStunLockedSkill = ScriptableObject.CreateInstance<SkillDef>();
			playerStunLockedSkill.skillName = "MithrixEX_StunLocked";
			playerStunLockedSkill.skillNameToken = "Stunned";
			playerStunLockedSkill.skillDescriptionToken = "Cannot act.";
			playerStunLockedSkill.icon = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Engi/EngiCancelTargetingDummy.asset").WaitForCompletion().icon;
			playerStunLockedSkill.activationStateMachineName = "Weapon";
			playerStunLockedSkill.activationState = new SerializableEntityStateType(typeof(Idle));
			playerStunLockedSkill.interruptPriority = (InterruptPriority)0;
			playerStunLockedSkill.baseRechargeInterval = 0f;
			playerStunLockedSkill.baseMaxStock = 0;
			playerStunLockedSkill.rechargeStock = 0;
			playerStunLockedSkill.requiredStock = 0;
			playerStunLockedSkill.stockToConsume = 0;
			playerStunLockedSkill.resetCooldownTimerOnUse = false;
			playerStunLockedSkill.fullRestockOnAssign = false;
			playerStunLockedSkill.dontAllowPastMaxStocks = false;
			playerStunLockedSkill.beginSkillCooldownOnSkillEnd = false;
			playerStunLockedSkill.cancelSprintingOnActivation = false;
			playerStunLockedSkill.forceSprintDuringState = false;
			playerStunLockedSkill.canceledFromSprinting = false;
			playerStunLockedSkill.isCombatSkill = false;
			playerStunLockedSkill.mustKeyPress = true;
			MithrixEXContent.Resources.skillDefs.Add(playerStunLockedSkill);
			object obj = <>O.<0>__GenericGameEvents_OnTakeDamage;
			if (obj == null)
			{
				DamageReportEventHandler val = GenericGameEvents_OnTakeDamage;
				<>O.<0>__GenericGameEvents_OnTakeDamage = val;
				obj = (object)val;
			}
			GenericGameEvents.OnTakeDamage += (DamageReportEventHandler)obj;
			leapWarningCircle = MithrixEX.AssetBundle.LoadAsset<GameObject>("Assets/Mods/ChallengeMode/Modifiers/BrotherEX/SkyLeapWarning.prefab");
			((BaseLoadableAsset)this).OnLoad();
			base.asset = arenaEffectsPrefab;
		}

		private static void GenericGameEvents_OnTakeDamage(DamageReport damageReport)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active && DamageAPI.HasModdedDamageType(damageReport.damageInfo, destroyItemDamageType) && Object.op_Implicit((Object)(object)damageReport.victimMaster) && Object.op_Implicit((Object)(object)damageReport.victimMaster.inventory))
			{
				List<ItemDef> list = (from x in damageReport.victimMaster.inventory.itemAcquisitionOrder
					select ItemCatalog.GetItemDef(x) into x
					where (Object)(object)x != (Object)null && x.canRemove && !x.hidden
					select x).ToList();
				if (list.Count > 0)
				{
					ItemDef val = RoR2Application.rng.NextElementUniform<ItemDef>(list);
					damageReport.victimMaster.inventory.RemoveItem(val, 1);
					damageReport.victimMaster.inventory.GiveItem(Items.ScrapWhite, 1);
					CharacterMasterNotificationQueue.SendTransformNotification(damageReport.victimMaster, val.itemIndex, Items.ScrapWhite.itemIndex, (TransformationType)0);
				}
			}
		}
	}
	public class EXBossAssets : BaseLoadableAsset
	{
		public static GameObject fightEffectsPrefab;

		public static GameObject fightEffectsInstance;

		public static bool fightEffectsActive
		{
			get
			{
				return (Object)(object)fightEffectsInstance != (Object)null;
			}
			set
			{
				if (Object.op_Implicit((Object)(object)fightEffectsInstance) == value)
				{
					return;
				}
				if (value)
				{
					if (Object.op_Implicit((Object)(object)fightEffectsPrefab))
					{
						fightEffectsInstance = Object.Instantiate<GameObject>(fightEffectsPrefab);
						WeatherParticles obj = fightEffectsInstance.AddComponent<WeatherParticles>();
						obj.lockPosition = true;
						obj.lockRotation = false;
					}
				}
				else if (Object.op_Implicit((Object)(object)fightEffectsInstance))
				{
					Object.Destroy((Object)(object)fightEffectsInstance);
				}
			}
		}

		public override void Load()
		{
			fightEffectsPrefab = MithrixEX.AssetBundle.LoadAsset<GameObject>("Assets/Mods/ChallengeMode/EXBoss/EXBossFightEffects.prefab");
			((BaseLoadableAsset)this).OnLoad();
			base.asset = fightEffectsPrefab;
		}
	}
	[BepInPlugin("com.Nuxlar.MithrixEX", "MithrixEX", "1.0.0")]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class MithrixEX : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Action <>9__9_0;

			public static CollectContentPackProvidersDelegate <>9__9_1;

			internal void <Awake>b__9_0()
			{
				new BrotherEX();
			}

			internal void <Awake>b__9_1(AddContentPackProviderDelegate addContentPackProvider)
			{
				addContentPackProvider.Invoke((IContentPackProvider)(object)new MithrixEXContent());
			}
		}

		public const string PluginGUID = "com.Nuxlar.MithrixEX";

		public const string PluginName = "MithrixEX";

		public const string PluginVersion = "1.0.0";

		public static Assembly executingAssembly;

		internal static PluginInfo pluginInfo;

		internal static Type declaringType;

		private static AssetBundle _assetBundle;

		public static AssetBundle AssetBundle
		{
			get
			{
				if ((Object)(object)_assetBundle == (Object)null)
				{
					_assetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(pluginInfo.Location), "challengemodeassetbundle"));
				}
				return _assetBundle;
			}
		}

		public void Awake()
		{
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Expected O, but got Unknown
			pluginInfo = ((BaseUnityPlugin)this).Info;
			executingAssembly = Assembly.GetExecutingAssembly();
			declaringType = MethodBase.GetCurrentMethod().DeclaringType;
			new BrotherEX();
			TMProEffects.Init();
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate
			{
				new BrotherEX();
			});
			ContentLoadHelper.PluginAwakeLoad<BaseBuff>(executingAssembly);
			ContentLoadHelper.PluginAwakeLoad<BaseCharacterBody>(executingAssembly);
			ContentLoadHelper.PluginAwakeLoad<BaseCharacterMaster>(executingAssembly);
			ContentLoadHelper.PluginAwakeLoad<BrotherEXAssets>(executingAssembly);
			object obj = <>c.<>9__9_1;
			if (obj == null)
			{
				CollectContentPackProvidersDelegate val = delegate(AddContentPackProviderDelegate addContentPackProvider)
				{
					addContentPackProvider.Invoke((IContentPackProvider)(object)new MithrixEXContent());
				};
				<>c.<>9__9_1 = val;
				obj = (object)val;
			}
			ContentManager.collectContentPackProviders += (CollectContentPackProvidersDelegate)obj;
		}
	}
	public class MithrixEXContent : IContentPackProvider
	{
		public static class Resources
		{
			public static List<GameObject> bodyPrefabs = new List<GameObject>();

			public static List<GameObject> masterPrefabs = new List<GameObject>();

			public static List<SkillDef> skillDefs = new List<SkillDef>();

			public static List<SkillFamily> skillFamilies = new List<SkillFamily>();
		}

		public static class Buffs
		{
			public static BuffDef MithrixEX_EXBoss;

			public static BuffDef MithrixEX_PlayerKnockupStun;
		}

		private ContentPack contentPack = new ContentPack();

		public string identifier => "MithrixEX";

		public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
		{
			contentPack.identifier = identifier;
			ContentLoadHelper contentLoadHelper = new ContentLoadHelper();
			Action[] loadDispatchers3 = new Action[5]
			{
				delegate
				{
					contentLoadHelper.DispatchLoad<BuffDef>(MithrixEX.executingAssembly, typeof(BaseBuff), (Action<BuffDef[]>)delegate(BuffDef[] x)
					{
						contentPack.buffDefs.Add(x);
					});
				},
				delegate
				{
					contentLoadHelper.DispatchLoad<GameObject>(MithrixEX.executingAssembly, typeof(BaseCharacterBody), (Action<GameObject[]>)delegate(GameObject[] x)
					{
						contentPack.bodyPrefabs.Add(x);
					});
				},
				delegate
				{
					contentLoadHelper.DispatchLoad<GameObject>(MithrixEX.executingAssembly, typeof(BaseCharacterMaster), (Action<GameObject[]>)delegate(GameObject[] x)
					{
						contentPack.masterPrefabs.Add(x);
					});
				},
				delegate
				{
					contentLoadHelper.DispatchLoad<GameObject>(MithrixEX.executingAssembly, typeof(EXBossAssets), (Action<GameObject[]>)null);
				},
				delegate
				{
					contentLoadHelper.DispatchLoad<GameObject>(MithrixEX.executingAssembly, typeof(BrotherEXAssets), (Action<GameObject[]>)null);
				}
			};
			int k = 0;
			while (k < loadDispatchers3.Length)
			{
				loadDispatchers3[k]();
				args.ReportProgress(Util.Remap((float)(k + 1), 0f, (float)loadDispatchers3.Length, 0f, 0.05f));
				yield return null;
				int num = k + 1;
				k = num;
			}
			while (contentLoadHelper.coroutine.MoveNext())
			{
				args.ReportProgress(Util.Remap(contentLoadHelper.progress.value, 0f, 1f, 0.05f, 0.9f));
				yield return contentLoadHelper.coroutine.Current;
			}
			loadDispatchers3 = new Action[5]
			{
				delegate
				{
					ContentLoadHelper.PopulateTypeFields<BuffDef>(typeof(Buffs), contentPack.buffDefs, (Func<string, string>)null);
				},
				delegate
				{
					contentPack.bodyPrefabs.Add(Resources.bodyPrefabs.ToArray());
				},
				delegate
				{
					contentPack.masterPrefabs.Add(Resources.masterPrefabs.ToArray());
				},
				delegate
				{
					contentPack.skillDefs.Add(Resources.skillDefs.ToArray());
				},
				delegate
				{
					contentPack.skillFamilies.Add(Resources.skillFamilies.ToArray());
				}
			};
			k = 0;
			while (k < loadDispatchers3.Length)
			{
				loadDispatchers3[k]();
				args.ReportProgress(Util.Remap((float)(k + 1), 0f, (float)loadDispatchers3.Length, 0.9f, 0.95f));
				yield return null;
				int num = k + 1;
				k = num;
			}
			loadDispatchers3 = new Action[1]
			{
				delegate
				{
					ContentLoadHelper.InvokeAfterContentPackLoaded<BaseBuff>(MithrixEX.executingAssembly);
				}
			};
			k = 0;
			while (k < loadDispatchers3.Length)
			{
				loadDispatchers3[k]();
				args.ReportProgress(Util.Remap((float)(k + 1), 0f, (float)loadDispatchers3.Length, 0.95f, 0.99f));
				yield return null;
				int num = k + 1;
				k = num;
			}
		}

		public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
		{
			ContentPack.Copy(contentPack, args.output);
			args.ReportProgress(1f);
			yield break;
		}

		public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
		{
			args.ReportProgress(1f);
			yield break;
		}
	}
	public static class MithrixEXUtils
	{
		public static event Func<CharacterBody, bool> onGetBodyIsHot;

		public static event Func<CharacterBody, bool> onGetBodyIsCold;

		public static bool CurrentStageNameMatches(string stageName)
		{
			if (Object.op_Implicit((Object)(object)Stage.instance) && (Object)(object)Stage.instance.sceneDef != (Object)null)
			{
				return Stage.instance.sceneDef.baseSceneName == stageName;
			}
			return false;
		}

		public static bool CurrentStageHasCommonInteractables()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			if (Object.op_Implicit((Object)(object)Stage.instance) && (Object)(object)Stage.instance.sceneDef != (Object)null && (int)Stage.instance.sceneDef.sceneType != 1)
			{
				return false;
			}
			foreach (string item in new List<string> { "moon2", "voidstage", "voidraid", "arena" })
			{
				if (CurrentStageNameMatches(item))
				{
					return false;
				}
			}
			return true;
		}

		public static bool CurrentStageHasBosses()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_003a: 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: Invalid comparison between Unknown and I4
			if (Object.op_Implicit((Object)(object)Stage.instance) && (Object)(object)Stage.instance.sceneDef != (Object)null && ((int)Stage.instance.sceneDef.sceneType == 3 || (int)Stage.instance.sceneDef.sceneType == 0 || (int)Stage.instance.sceneDef.sceneType == -1))
			{
				return false;
			}
			foreach (string item in new List<string> { "bazaar", "arena", "voidstage" })
			{
				if (CurrentStageNameMatches(item))
				{
					return false;
				}
			}
			return true;
		}

		public static void RemoveFromArray<T>(ref T[] array, T element)
		{
			int num = Array.IndexOf(array, element);
			if (num != -1)
			{
				ArrayUtils.ArrayRemoveAtAndResize<T>(ref array, num, 1);
			}
		}

		public static float MoveNumberTowards(float current, float target, float speed)
		{
			if (current < target)
			{
				current = Mathf.Min(current + speed, target);
			}
			else if (current > target)
			{
				current = Mathf.Max(current - speed, target);
			}
			return current;
		}

		public static bool IsBodyUnderCeiling(CharacterBody body)
		{
			//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_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_002f: Unknown result type (might be due to invalid IL or missing references)
			return Physics.Raycast(new Ray(body.corePosition + Vector3.up * body.radius, Vector3.up), 500f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1);
		}

		public static bool BodyIsHot(CharacterBody body)
		{
			bool flag = body.HasBuff(Buffs.OnFire) || body.HasBuff(Buffs.StrongerBurn);
			if (!flag)
			{
				DotController val = DotController.FindDotController(((Component)body).gameObject);
				if (Object.op_Implicit((Object)(object)val) && val.HasDotActive((DotIndex)2))
				{
					flag = true;
				}
			}
			if (!flag && MithrixEXUtils.onGetBodyIsHot != null)
			{
				flag = MithrixEXUtils.onGetBodyIsHot(body);
			}
			return flag;
		}

		public static bool BodyIsCold(CharacterBody body)
		{
			bool flag = body.HasBuff(Buffs.Slow80) || (Object.op_Implicit((Object)(object)body.healthComponent) && body.healthComponent.isInFrozenState);
			if (!flag && MithrixEXUtils.onGetBodyIsCold != null)
			{
				flag = MithrixEXUtils.onGetBodyIsCold(body);
			}
			return flag;
		}
	}
	public static class TMProEffects
	{
		public class ChallengeModeTextEffects : MonoBehaviour
		{
			public TMP_Text textComponent;

			public bool textChanged;

			public TMP_MeshInfo[] cachedMeshInfo;

			public float updateTimer;

			public float updateFrequency = 0.016f;

			public List<TMP_LinkInfo> linksToUpdate = new List<TMP_LinkInfo>();

			public float currentTime;

			public void Awake()
			{
				textComponent = ((Component)this).GetComponent<TMP_Text>();
				textChanged = true;
			}

			public void Start()
			{
				if (Object.op_Implicit((Object)(object)textComponent) && ((Behaviour)textComponent).isActiveAndEnabled)
				{
					textComponent.ForceMeshUpdate(false, false);
				}
			}

			public void OnEnable()
			{
				TMPro_EventManager.TEXT_CHANGED_EVENT.Add((Action<Object>)ON_TEXT_CHANGED);
			}

			public void OnDisable()
			{
				TMPro_EventManager.TEXT_CHANGED_EVENT.Remove((Action<Object>)ON_TEXT_CHANGED);
			}

			public void ON_TEXT_CHANGED(Object obj)
			{
				if (obj == (Object)(object)textComponent)
				{
					textChanged = true;
				}
			}

			public void Update()
			{
				//IL_00c1: 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_011b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0120: 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_014f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0220: Unknown result type (might be due to invalid IL or missing references)
				//IL_0227: Unknown result type (might be due to invalid IL or missing references)
				//IL_0239: Unknown result type (might be due to invalid IL or missing references)
				//IL_0165: Unknown result type (might be due to invalid IL or missing references)
				//IL_016a: Unknown result type (might be due to invalid IL or missing references)
				//IL_016c: Unknown result type (might be due to invalid IL or missing references)
				//IL_030e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0315: Unknown result type (might be due to invalid IL or missing references)
				//IL_0187: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_024f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0254: Unknown result type (might be due to invalid IL or missing references)
				//IL_0256: Unknown result type (might be due to invalid IL or missing references)
				//IL_034e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0353: Unknown result type (might be due to invalid IL or missing references)
				//IL_0355: Unknown result type (might be due to invalid IL or missing references)
				//IL_035c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0368: Unknown result type (might be due to invalid IL or missing references)
				//IL_036f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0381: Unknown result type (might be due to invalid IL or missing references)
				//IL_026a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0283: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
				//IL_0201: Unknown result type (might be due to invalid IL or missing references)
				//IL_0203: Unknown result type (might be due to invalid IL or missing references)
				//IL_0208: Unknown result type (might be due to invalid IL or missing references)
				//IL_029d: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
				//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
				//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
				currentTime += Time.deltaTime;
				updateTimer -= Time.deltaTime;
				while (updateTimer <= 0f)
				{
					updateTimer += updateFrequency;
					if (!Object.op_Implicit((Object)(object)textComponent) || !((Behaviour)textComponent).isActiveAndEnabled)
					{
						continue;
					}
					TMP_TextInfo textInfo = textComponent.textInfo;
					if (textInfo == null || textInfo.meshInfo == null || textInfo.meshInfo.Length == 0 || textInfo.meshInfo[0].vertices == null)
					{
						break;
					}
					if (textChanged)
					{
						textChanged = false;
						cachedMeshInfo = textInfo.CopyMeshInfoVertexData();
						linksToUpdate.Clear();
						for (int i = 0; i < textInfo.linkCount; i++)
						{
							TMP_LinkInfo item = textInfo.linkInfo[i];
							string linkID = ((TMP_LinkInfo)(ref item)).GetLinkID();
							if (linkID == "ChallengeModeShaky" || linkID == "ChallengeModeRainbow")
							{
								linksToUpdate.Add(item);
							}
						}
					}
					bool flag = false;
					foreach (TMP_LinkInfo item2 in linksToUpdate)
					{
						TMP_LinkInfo current = item2;
						string linkID2 = ((TMP_LinkInfo)(ref current)).GetLinkID();
						if (!(linkID2 == "ChallengeModeShaky"))
						{
							if (!(linkID2 == "ChallengeModeRainbow"))
							{
								continue;
							}
							for (int j = current.linkTextfirstCharacterIndex; j < current.linkTextfirstCharacterIndex + current.linkTextLength; j++)
							{
								TMP_CharacterInfo val = textInfo.characterInfo[j];
								if (val.isVisible)
								{
									flag = true;
									Color32[] colors = cachedMeshInfo[val.materialReferenceIndex].colors32;
									Color32[] colors2 = textInfo.meshInfo[val.materialReferenceIndex].colors32;
									for (int k = 0; k <= 3; k++)
									{
										colors2[val.vertexIndex + k] = Color32.op_Implicit(Color.Lerp(Color32.op_Implicit(colors[val.vertexIndex + k]), Color.HSVToRGB((Time.time * 0.15f + 0.06f * (float)j) % 1f, 1f, 1f), 0.2f));
									}
								}
							}
							continue;
						}
						for (int l = current.linkTextfirstCharacterIndex; l < current.linkTextfirstCharacterIndex + current.linkTextLength; l++)
						{
							TMP_CharacterInfo val2 = textInfo.characterInfo[l];
							if (val2.isVisible)
							{
								flag = true;
								float num = 2f;
								Vector3[] vertices = cachedMeshInfo[val2.materialReferenceIndex].vertices;
								Vector3[] vertices2 = textInfo.meshInfo[val2.materialReferenceIndex].vertices;
								Vector3 val3 = new Vector3(Random.Range(0f - num, num), Random.Range(0f - num, num), 0f) * val2.scale;
								for (int m = 0; m <= 3; m++)
								{
									vertices2[val2.vertexIndex + m] = vertices[val2.vertexIndex + m] + val3;
								}
							}
						}
					}
					if (flag)
					{
						for (int n = 0; n < textInfo.meshInfo.Length; n++)
						{
							TMP_MeshInfo val4 = textInfo.meshInfo[n];
							val4.mesh.vertices = val4.vertices;
							val4.mesh.colors32 = val4.colors32;
							textComponent.UpdateGeometry(val4.mesh, n);
							textComponent.UpdateVertexData((TMP_VertexDataUpdateFlags)16);
						}
					}
				}
			}
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Start <0>__ChatBox_Start;

			public static hook_Awake <1>__HGTextMeshProUGUI_Awake;
		}

		public static void Init()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			object obj = <>O.<0>__ChatBox_Start;
			if (obj == null)
			{
				hook_Start val = ChatBox_Start;
				<>O.<0>__ChatBox_Start = val;
				obj = (object)val;
			}
			ChatBox.Start += (hook_Start)obj;
			object obj2 = <>O.<1>__HGTextMeshProUGUI_Awake;
			if (obj2 == null)
			{
				hook_Awake val2 = HGTextMeshProUGUI_Awake;
				<>O.<1>__HGTextMeshProUGUI_Awake = val2;
				obj2 = (object)val2;
			}
			HGTextMeshProUGUI.Awake += (hook_Awake)obj2;
		}

		private static void ChatBox_Start(orig_Start orig, ChatBox self)
		{
			orig.Invoke(self);
			((Component)self.messagesText.textComponent).gameObject.AddComponent<ChallengeModeTextEffects>();
		}

		private static void HGTextMeshProUGUI_Awake(orig_Awake orig, HGTextMeshProUGUI self)
		{
			orig.Invoke(self);
			if (!Object.op_Implicit((Object)(object)((Component)self).GetComponent<ChallengeModeTextEffects>()))
			{
				((Component)self).gameObject.AddComponent<ChallengeModeTextEffects>().textComponent = (TMP_Text)(object)self;
			}
		}
	}
}
namespace MithrixEX.CharacterMasters
{
	public class BrotherDummyAttacker : BaseCharacterMaster
	{
		public static CharacterSpawnCard characterSpawnCard;

		public override void OnPluginAwake()
		{
			((BaseLoadableAsset)this).OnPluginAwake();
			base.prefab = Utils.CreateBlankPrefab("MithrixEX_BrotherDummyAttackerMaster", true);
		}

		public override void OnLoad()
		{
			((BaseLoadableAsset)this).OnLoad();
			base.masterName = "MithrixEX_BrotherDummyAttacker";
			((BaseCharacterMaster)this).Prepare();
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate
			{
				base.prefab.GetComponent<CharacterMaster>().bodyPrefab = BodyCatalog.FindBodyPrefab("MithrixEX_BrotherDummyAttackerBody");
			});
			characterSpawnCard = base.spawnCard;
		}
	}
}
namespace MithrixEX.CharacterBodies
{
	public class BrotherDummyAttacker : BaseCharacterBody
	{
		public override void OnPluginAwake()
		{
			((BaseLoadableAsset)this).OnPluginAwake();
			base.prefab = Utils.CreateBlankPrefab("MithrixEX_BrotherDummyAttackerBody", true);
			base.prefab.GetComponent<NetworkIdentity>().localPlayerAuthority = true;
		}

		public override void OnLoad()
		{
			//IL_00c6: 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_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: 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_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			((BaseLoadableAsset)this).OnLoad();
			Utils.CopyChildren(MithrixEX.AssetBundle.LoadAsset<GameObject>("Assets/Mods/ChallengeMode/Modifiers/HotSand/BurnInflictor.prefab"), base.prefab, true);
			base.bodyName = "MithrixEX_BrotherDummyAttacker";
			base.modelBaseTransform = base.prefab.transform.Find("ModelBase");
			base.modelTransform = base.prefab.transform.Find("ModelBase/EmptyMesh");
			base.meshObject = ((Component)base.modelTransform).gameObject;
			((BaseCharacterBody)this).Prepare();
			((BaseCharacterBody)this).SetUpChildLocator((NameTransformPair[])(object)new NameTransformPair[0]);
			base.modelLocator.dontReleaseModelOnDeath = false;
			base.modelLocator.autoUpdateModelTransform = false;
			base.modelLocator.dontDetatchFromParent = true;
			base.modelLocator.noCorpse = true;
			CharacterBody component = base.prefab.GetComponent<CharacterBody>();
			component.bodyFlags = (BodyFlags)2328;
			component.baseMaxHealth = 200f;
			component.baseDamage = 18f;
			component.baseMoveSpeed = 0f;
			component.baseAcceleration = 0f;
			component.baseJumpPower = 0f;
			component.baseJumpCount = 0;
			component.portraitIcon = (Texture)(object)Addressables.LoadAssetAsync<Texture2D>((object)"RoR2/Base/Common/MiscIcons/texMysteryIcon.png").WaitForCompletion();
			component.bodyColor = Color.black;
			component.aimOriginTransform = base.modelBaseTransform;
			((BaseCharacterBody)this).AfterCharacterBodySetup();
			component.baseNameToken = "UNIDENTIFIED";
			component.subtitleNameToken = "";
			base.prefab.AddComponent<MithrixEXRejectAllDamage>();
			EntityStateMachine deathStateMachine = ((BaseCharacterBody)this).SetUpEntityStateMachine("Body", typeof(Uninitialized), typeof(Uninitialized));
			CharacterDeathBehavior component2 = base.prefab.GetComponent<CharacterDeathBehavior>();
			component2.deathStateMachine = deathStateMachine;
			component2.deathState = new SerializableEntityStateType(typeof(DeathState));
			((Component)base.modelTransform).GetComponent<CharacterModel>().baseRendererInfos = (RendererInfo[])(object)new RendererInfo[0];
			((BaseCharacterBody)this).AfterCharacterModelSetUp();
		}
	}
	public class MithrixEXRejectAllDamage : MonoBehaviour, IOnIncomingDamageServerReceiver
	{
		public void OnIncomingDamageServer(DamageInfo damageInfo)
		{
			damageInfo.rejected = true;
		}
	}
}
namespace MithrixEX.Buffs
{
	public class EXBoss : BaseBuff
	{
		public override void OnLoad()
		{
			//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_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Expected O, but got Unknown
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Expected O, but got Unknown
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Expected O, but got Unknown
			((Object)base.buffDef).name = "MithrixEX_EXBoss";
			base.buffDef.buffColor = Color.white;
			base.buffDef.canStack = false;
			base.buffDef.isDebuff = false;
			base.buffDef.isHidden = true;
			Overlays.CreateOverlay(MithrixEX.AssetBundle.LoadAsset<Material>("Assets/Mods/ChallengeMode/EXBoss/matEXBossOverlay.mat"), (Func<CharacterModel, bool>)((CharacterModel characterModel) => Object.op_Implicit((Object)(object)characterModel.body) && characterModel.body.radius < 5f && characterModel.body.HasBuff(base.buffDef)));
			Overlays.CreateOverlay(MithrixEX.AssetBundle.LoadAsset<Material>("Assets/Mods/ChallengeMode/EXBoss/matEXBossOverlayGiant.mat"), (Func<CharacterModel, bool>)((CharacterModel characterModel) => Object.op_Implicit((Object)(object)characterModel.body) && characterModel.body.radius >= 5f && characterModel.body.HasBuff(base.buffDef)));
			Util.GetBestBodyName += new hook_GetBestBodyName(Util_GetBestBodyName);
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
			GenericGameEvents.OnApplyDamageReductionModifiers += new DamageModifierEventHandler(GenericGameEvents_OnApplyDamageReductionModifiers);
		}

		private string Util_GetBestBodyName(orig_GetBestBodyName orig, GameObject bodyObject)
		{
			string text = orig.Invoke(bodyObject);
			if (Object.op_Implicit((Object)(object)bodyObject))
			{
				CharacterBody component = bodyObject.GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)component) && component.HasBuff(base.buffDef))
				{
					text = Language.GetStringFormatted("{0} EX", new object[1] { text });
				}
			}
			return text;
		}

		private void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
		{
			if (sender.HasBuff(base.buffDef))
			{
				args.moveSpeedMultAdd += 0.2f;
			}
		}

		private void GenericGameEvents_OnApplyDamageReductionModifiers(DamageInfo damageInfo, GenericCharacterInfo attackerInfo, GenericCharacterInfo victimInfo, ref float damage)
		{
			//IL_0000: 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)
			if (Object.op_Implicit((Object)(object)attackerInfo.body) && attackerInfo.body.HasBuff(base.buffDef))
			{
				damage *= 0.7f;
			}
		}
	}
	public class PlayerKnockupStun : BaseBuff
	{
		public class ChallengeModePlayerStunHelper : MonoBehaviour
		{
			public CharacterBody body;

			public bool effectSpawned;

			public float effectCooldown;

			public void Awake()
			{
				body = ((Component)this).GetComponent<CharacterBody>();
			}

			public void FixedUpdate()
			{
				effectCooldown -= Time.fixedDeltaTime;
			}

			public void SpawnVFX(float duration)
			{
				GameObject obj = Object.Instantiate<GameObject>(StunState.stunVfxPrefab, body.transform);
				obj.GetComponent<ScaleParticleSystemDuration>().newDuration = duration;
				obj.AddComponent<DestroyOnTimer>().duration = duration;
			}
		}

		public class SyncKnockupToServer : INetMessage, ISerializableObject
		{
			private NetworkInstanceId objID;

			private float maxDuration;

			public SyncKnockupToServer()
			{
			}

			public SyncKnockupToServer(NetworkInstanceId objID, float maxDuration)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				this.objID = objID;
				this.maxDuration = maxDuration;
			}

			public void Deserialize(NetworkReader reader)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				objID = reader.ReadNetworkId();
				maxDuration = reader.ReadSingle();
			}

			public void OnReceived()
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				if (!NetworkServer.active)
				{
					return;
				}
				GameObject val = Util.FindNetworkObject(objID);
				if (Object.op_Implicit((Object)(object)val))
				{
					CharacterBody component = val.GetComponent<CharacterBody>();
					if (Object.op_Implicit((Object)(object)component))
					{
						component.AddTimedBuff(MithrixEXContent.Buffs.MithrixEX_PlayerKnockupStun, maxDuration);
					}
				}
			}

			public void Serialize(NetworkWriter writer)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				writer.Write(objID);
				writer.Write(maxDuration);
			}
		}

		public class SyncKnockupRemovalToServer : INetMessage, ISerializableObject
		{
			private NetworkInstanceId objID;

			public SyncKnockupRemovalToServer()
			{
			}

			public SyncKnockupRemovalToServer(NetworkInstanceId objID)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				this.objID = objID;
			}

			public void Deserialize(NetworkReader reader)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				objID = reader.ReadNetworkId();
			}

			public void OnReceived()
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				if (!NetworkServer.active)
				{
					return;
				}
				GameObject val = Util.FindNetworkObject(objID);
				if (Object.op_Implicit((Object)(object)val))
				{
					CharacterBody component = val.GetComponent<CharacterBody>();
					if (Object.op_Implicit((Object)(object)component))
					{
						HandleKnockupRemovalServer(component);
					}
				}
			}

			public void Serialize(NetworkWriter writer)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				writer.Write(objID);
			}
		}

		public override void OnPluginAwake()
		{
			((BaseLoadableAsset)this).OnPluginAwake();
			NetworkingAPI.RegisterMessageType<SyncKnockupToServer>();
			NetworkingAPI.RegisterMessageType<SyncKnockupRemovalToServer>();
		}

		public override void OnLoad()
		{
			//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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			((Object)base.buffDef).name = "MithrixEX_PlayerKnockupStun";
			base.buffDef.buffColor = Color.white;
			base.buffDef.canStack = false;
			base.buffDef.isDebuff = true;
			base.buffDef.isHidden = true;
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
			CharacterBody.RecalculateStats += new hook_RecalculateStats(CharacterBody_RecalculateStats);
			CharacterMotor.OnLanded += new hook_OnLanded(CharacterMotor_OnLanded);
			CharacterBody.OnClientBuffsChanged += new hook_OnClientBuffsChanged(CharacterBody_OnClientBuffsChanged);
		}

		private void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
		{
			if (sender.HasBuff(base.buffDef))
			{
				args.moveSpeedRootCount++;
				if (Object.op_Implicit((Object)(object)sender.skillLocator.primary))
				{
					sender.skillLocator.primary.SetSkillOverride((object)sender, BrotherEXAssets.playerStunLockedSkill, (SkillOverridePriority)4);
				}
				if (Object.op_Implicit((Object)(object)sender.skillLocator.secondary))
				{
					sender.skillLocator.secondary.SetSkillOverride((object)sender, BrotherEXAssets.playerStunLockedSkill, (SkillOverridePriority)4);
				}
				if (Object.op_Implicit((Object)(object)sender.skillLocator.utility))
				{
					sender.skillLocator.utility.SetSkillOverride((object)sender, BrotherEXAssets.playerStunLockedSkill, (SkillOverridePriority)4);
				}
				if (Object.op_Implicit((Object)(object)sender.skillLocator.special))
				{
					sender.skillLocator.special.SetSkillOverride((object)sender, BrotherEXAssets.playerStunLockedSkill, (SkillOverridePriority)4);
				}
			}
			else
			{
				if (Object.op_Implicit((Object)(object)sender.skillLocator.primary))
				{
					sender.skillLocator.primary.UnsetSkillOverride((object)sender, BrotherEXAssets.playerStunLockedSkill, (SkillOverridePriority)4);
				}
				if (Object.op_Implicit((Object)(object)sender.skillLocator.secondary))
				{
					sender.skillLocator.secondary.UnsetSkillOverride((object)sender, BrotherEXAssets.playerStunLockedSkill, (SkillOverridePriority)4);
				}
				if (Object.op_Implicit((Object)(object)sender.skillLocator.utility))
				{
					sender.skillLocator.utility.UnsetSkillOverride((object)sender, BrotherEXAssets.playerStunLockedSkill, (SkillOverridePriority)4);
				}
				if (Object.op_Implicit((Object)(object)sender.skillLocator.special))
				{
					sender.skillLocator.special.UnsetSkillOverride((object)sender, BrotherEXAssets.playerStunLockedSkill, (SkillOverridePriority)4);
				}
			}
		}

		private void CharacterBody_RecalculateStats(orig_RecalculateStats orig, CharacterBody self)
		{
			orig.Invoke(self);
			if (self.HasBuff(base.buffDef))
			{
				self.jumpPower = 0f;
				self.maxJumpHeight = 0f;
				self.maxJumpCount = 0;
				self.moveSpeed = 0f;
			}
		}

		private void CharacterMotor_OnLanded(orig_OnLanded orig, CharacterMotor self)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (self.hasEffectiveAuthority)
			{
				if (NetworkServer.active)
				{
					HandleKnockupRemovalServer(self.body);
				}
				else
				{
					NetMessageExtensions.Send((INetMessage)(object)new SyncKnockupRemovalToServer(((Component)self.body).GetComponent<NetworkIdentity>().netId), (NetworkDestination)2);
				}
			}
		}

		private void CharacterBody_OnClientBuffsChanged(orig_OnClientBuffsChanged orig, CharacterBody self)
		{
			orig.Invoke(self);
			ChallengeModePlayerStunHelper challengeModePlayerStunHelper = ((Component)self).GetComponent<ChallengeModePlayerStunHelper>();
			if (!Object.op_Implicit((Object)(object)challengeModePlayerStunHelper))
			{
				challengeModePlayerStunHelper = ((Component)self).gameObject.AddComponent<ChallengeModePlayerStunHelper>();
			}
			if (self.HasBuff(base.buffDef) && !challengeModePlayerStunHelper.effectSpawned && challengeModePlayerStunHelper.effectCooldown <= 0f)
			{
				challengeModePlayerStunHelper.SpawnVFX(1.2f);
				challengeModePlayerStunHelper.effectSpawned = true;
				challengeModePlayerStunHelper.effectCooldown = 1f;
			}
			else if (!self.HasBuff(base.buffDef) && challengeModePlayerStunHelper.effectSpawned)
			{
				challengeModePlayerStunHelper.effectSpawned = false;
				challengeModePlayerStunHelper.effectCooldown = 1f;
			}
		}

		public static void KnockupBody(CharacterBody body, Vector3 force, float maxDuration = 2.3f, bool requireGrounded = true)
		{
			//IL_003b: 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.op_Implicit((Object)(object)body) && body.hasEffectiveAuthority && (!requireGrounded || (Object.op_Implicit((Object)(object)body.characterMotor) && body.characterMotor.isGrounded)) && Object.op_Implicit((Object)(object)body.healthComponent))
			{
				HandleKnockupLocal(body, force);
				if (NetworkServer.active)
				{
					body.AddTimedBuff(MithrixEXContent.Buffs.MithrixEX_PlayerKnockupStun, maxDuration);
				}
				else
				{
					NetMessageExtensions.Send((INetMessage)(object)new SyncKnockupToServer(((Component)body).GetComponent<NetworkIdentity>().netId, maxDuration), (NetworkDestination)2);
				}
			}
		}

		private static void HandleKnockupLocal(CharacterBody body, Vector3 force)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: 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)
			body.characterMotor.velocity = Vector3.zero;
			body.healthComponent.TakeDamageForce(force, true, true);
			body.characterMotor.jumpCount = 0;
		}

		private static void HandleKnockupRemovalServer(CharacterBody body)
		{
			if (body.HasBuff(MithrixEXContent.Buffs.MithrixEX_PlayerKnockupStun))
			{
				body.ClearTimedBuffs(MithrixEXContent.Buffs.MithrixEX_PlayerKnockupStun);
				if (body.HasBuff(MithrixEXContent.Buffs.MithrixEX_PlayerKnockupStun))
				{
					body.RemoveBuff(MithrixEXContent.Buffs.MithrixEX_PlayerKnockupStun);
				}
				body.AddTimedBuff(MithrixEXContent.Buffs.MithrixEX_PlayerKnockupStun, 0.5f);
			}
		}
	}
}