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 System.Security;
using System.Security.Permissions;
using System.Text;
using Architect.Api;
using Architect.Behaviour.Fixers;
using Architect.Behaviour.Utility;
using Architect.Config.Types;
using Architect.Content.Preloads;
using Architect.Objects;
using Architect.Objects.Categories;
using Architect.Objects.Groups;
using Architect.Objects.Placeable;
using Architect.Utils;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GlobalSettings;
using HutongGames.PlayMaker;
using HutongGames.PlayMaker.Actions;
using Microsoft.CodeAnalysis;
using TeamCherry.Localization;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("EnemyRando")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.7.20.0")]
[assembly: AssemblyInformationalVersion("0.7.20+cb66db50befd0c304e97edd62ee35dba3c52fafc")]
[assembly: AssemblyProduct("EnemyRando")]
[assembly: AssemblyTitle("SimpleEnemyRando")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.7.20.0")]
[module: UnverifiableCode]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[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 BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace EnemyRando
{
public static class EnemyChooser
{
public enum EnemyType
{
Enemy,
Boss,
Misc
}
private static bool _setupObjects;
private static PlaceableObject[]? _all;
private static PlaceableObject[]? _bosses;
private static PlaceableObject[]? _enemies;
private static readonly string[] IgnoredEnemies = new string[10] { "stilkin", "stilkin_trapper", "surface_scuttler", "slab_jailer", "white_palace_fly", "garpid", "crystal_drifter", "leaf_glider", "snitchfly", "brushflit" };
private static readonly string[] SummonerEnemies = new string[5] { "song_maestro", "broodmother", "gargant_gloom", "grove_pilgrim", "coral_big_jellyfish" };
private static void SetupObjects()
{
if (_setupObjects)
{
return;
}
if (_all == null)
{
_all = (from PlaceableObject o in ((AbstractCategory)Categories.Enemies).GetObjects()
where Object.op_Implicit((Object)(object)o.Prefab.GetComponent<HealthManager>()) && !IgnoredEnemies.Contains(o.GetId())
select o).ToArray();
}
if (_enemies == null)
{
_enemies = _all.Where((PlaceableObject o) => GetEnemyType(o.Prefab.gameObject.GetComponent<HealthManager>()) == EnemyType.Enemy).ToArray();
}
if (_bosses == null)
{
_bosses = _all.Where((PlaceableObject o) => GetEnemyType(o.Prefab.gameObject.GetComponent<HealthManager>()) == EnemyType.Boss).ToArray();
}
_setupObjects = true;
}
public static (PlaceableObject, bool, bool) GetRandomEnemy(HealthManager source, Settings.RandoType type)
{
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
SetupObjects();
if (1 == 0)
{
}
PlaceableObject[] array = type switch
{
Settings.RandoType.Enemy => _enemies,
Settings.RandoType.Boss => _bosses,
_ => _all,
};
if (1 == 0)
{
}
PlaceableObject[] array2 = array;
int num = array2.Length;
Scene scene;
switch (Settings.Consistency.Value)
{
case Settings.ConsistencyType.EnemyType:
{
EnemyDeathEffects enemyDeathEffects = source.enemyDeathEffects;
int code;
if (Object.op_Implicit((Object)(object)enemyDeathEffects))
{
EnemyJournalRecord journalRecord = enemyDeathEffects.journalRecord;
string data;
if (!Object.op_Implicit((Object)(object)journalRecord))
{
scene = ((Component)source).gameObject.scene;
data = ((Scene)(ref scene)).name;
}
else
{
data = LocalisedString.op_Implicit(journalRecord.displayName);
}
code = GetCode(data);
}
else
{
scene = ((Component)source).gameObject.scene;
code = GetCode(((Scene)(ref scene)).name);
}
Random.InitState(code + Settings.Seed.Value);
break;
}
case Settings.ConsistencyType.Individual:
{
string name = ((Object)source).name;
scene = ((Component)source).gameObject.scene;
string text = name + ((Scene)(ref scene)).name;
if (Object.op_Implicit((Object)(object)((Component)source).transform.parent))
{
text += ((Object)((Component)source).transform.parent).name;
}
int code = GetCode(text);
Random.InitState(code + Settings.Seed.Value);
break;
}
case Settings.ConsistencyType.Room:
{
scene = ((Component)source).gameObject.scene;
int code = GetCode(((Scene)(ref scene)).name);
Random.InitState(code + Settings.Seed.Value);
break;
}
default:
throw new ArgumentOutOfRangeException();
case Settings.ConsistencyType.None:
break;
}
PlaceableObject val = array2[Random.Range(0, num)];
if (((Object)source).name.Contains("Slab Fly Small Fresh") || ((Object)source).name.Contains("Aspid Hatchling") || ((Object)source).name.Contains("Gloomfly") || ((Object)source).name.Contains("Song Automaton Tiny") || ((Object)source).name.Contains("Coral Swimmer Small"))
{
while (SummonerEnemies.Contains(val.GetId()))
{
val = array2[Random.Range(0, num)];
}
}
bool item;
bool item2;
if (PlayerData.instance.GetBool("blackThreadWorld"))
{
item = Random.value <= Settings.BlackThreadChanceAct3.Value;
item2 = Random.value <= Settings.PlasmifiedChanceAct3.Value;
}
else
{
item = Random.value <= Settings.BlackThreadChance.Value;
item2 = Random.value <= Settings.PlasmifiedChance.Value;
}
return (val, item, item2);
}
private static int GetCode(string data)
{
int num = 0;
byte[] bytes = Encoding.Unicode.GetBytes(data);
foreach (byte b in bytes)
{
num += b;
}
return num;
}
public static Settings.RandoType GetRandoType(this EnemyType type)
{
if (1 == 0)
{
}
Settings.RandoType result = type switch
{
EnemyType.Boss => Settings.BossRandoType.Value,
EnemyType.Enemy => Settings.EnemyRandoType.Value,
_ => Settings.MiscRandoType.Value,
};
if (1 == 0)
{
}
return result;
}
public static EnemyType GetEnemyType(HealthManager hm)
{
Transform parent = ((Component)hm).transform.parent;
if (Object.op_Implicit((Object)(object)parent) && ((Object)parent).name.Contains("Shellwood Hive"))
{
return EnemyType.Misc;
}
EnemyDeathEffects component = ((Component)hm).GetComponent<EnemyDeathEffects>();
if (component is EnemyDeathEffectsNoEffect)
{
return EnemyType.Misc;
}
if (((Object)hm).name.Contains("Phantom") || ((Object)hm).name.Contains("Lace") || ((Object)hm).name.Contains("Silk Boss") || ((Object)hm).name.Contains("Bone Beast") || ((Object)hm).name.Contains("SG_head"))
{
return EnemyType.Boss;
}
PlayMakerFSM[] components = ((Component)hm).GetComponents<PlayMakerFSM>();
foreach (PlayMakerFSM val in components)
{
FsmState[] fsmStates = val.FsmStates;
foreach (FsmState val2 in fsmStates)
{
if (val2?.actions != null && val2.actions.Any((FsmStateAction a) => a is DisplayBossTitle))
{
return EnemyType.Boss;
}
}
}
return EnemyType.Enemy;
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("me.cometcake575.enemyrando", "SimpleEnemyRando", "0.7.20")]
public class EnemyRandoPlugin : BaseUnityPlugin
{
internal static EnemyRandoPlugin Instance;
internal static ManualLogSource Logger;
public const string Id = "me.cometcake575.enemyrando";
public static string Name => "SimpleEnemyRando";
public static string Version => "0.7.20";
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Instance = this;
Logger.LogInfo((object)("Plugin " + Name + " (me.cometcake575.enemyrando) has loaded!"));
Settings.Init(((BaseUnityPlugin)this).Config);
Randomiser.Init();
}
}
public static class Randomiser
{
[CompilerGenerated]
private sealed class <>c__DisplayClass2_0
{
public PlayMakerFSM fsm;
internal void <ZeroHp>b__2()
{
((Component)fsm).gameObject.transform.Translate(0f, 4f, 0f);
}
internal void <ZeroHp>b__3()
{
fsm.SendEvent("FINAL");
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass3_0
{
public HealthManager healthManager;
internal bool <WaitForRando>b__0()
{
return !Object.op_Implicit((Object)(object)healthManager) || !healthManager.isDead;
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass6_0
{
public HealthManager healthManager;
public PlayMakerFSM fsm;
public bool arena;
internal bool <Rando>b__0()
{
//IL_0274: Unknown result type (might be due to invalid IL or missing references)
//IL_0279: Unknown result type (might be due to invalid IL or missing references)
//IL_0284: Unknown result type (might be due to invalid IL or missing references)
//IL_0289: Unknown result type (might be due to invalid IL or missing references)
//IL_028b: Unknown result type (might be due to invalid IL or missing references)
//IL_028d: Unknown result type (might be due to invalid IL or missing references)
//IL_028e: Unknown result type (might be due to invalid IL or missing references)
//IL_0293: Unknown result type (might be due to invalid IL or missing references)
//IL_0295: Unknown result type (might be due to invalid IL or missing references)
//IL_0296: 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_02a2: Unknown result type (might be due to invalid IL or missing references)
//IL_02ae: 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_02bd: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)healthManager) || healthManager.isDead)
{
return true;
}
bool flag = ((Component)healthManager).gameObject.layer == InteractiveLayer;
if (((Component)healthManager).gameObject.layer != EnemiesLayer && !flag)
{
return false;
}
if (healthManager != null && healthManager.IsInvincible && healthManager.InvincibleFromDirection == 0)
{
return false;
}
Renderer component = ((Component)healthManager).GetComponent<Renderer>();
if (Object.op_Implicit((Object)(object)component) && !component.enabled)
{
return false;
}
if (Object.op_Implicit((Object)(object)fsm))
{
if (fsm.ActiveStateName.Contains("Intro") || fsm.ActiveStateName.Contains("Zoom") || fsm.ActiveStateName.Contains("Roar") || fsm.ActiveStateName.Contains("Drop") || fsm.ActiveStateName.Contains("Pause"))
{
return false;
}
if (((Object)healthManager).name.Contains("Handmaiden") && fsm.ActiveStateName != "Tele In End")
{
return false;
}
if (((Object)healthManager).name.Contains("Flower Queen") && fsm.ActiveStateName != "Idle")
{
return false;
}
}
Collider2D component2 = ((Component)healthManager).GetComponent<Collider2D>();
if ((!Object.op_Implicit((Object)(object)component2) || !((Behaviour)component2).isActiveAndEnabled) && ((Object)healthManager).name != "Splinter Queen" && !((Object)healthManager).name.Contains("Coral Swimmer Small") && !((Object)healthManager).name.Contains("Swamp Drifter") && !flag)
{
return false;
}
if (!arena)
{
return true;
}
Vector3 position = ((Component)healthManager).transform.position;
Vector3 position2 = HeroController.instance.transform.position;
Vector3 val = position2 - position;
RaycastHit2D val2 = Physics2D.Raycast(Vector2.op_Implicit(position), Vector2.op_Implicit(((Vector3)(ref val)).normalized), ((Vector3)(ref val)).magnitude, LayerMask.op_Implicit(TerrainMask));
return !Object.op_Implicit((Object)(object)((RaycastHit2D)(ref val2)).collider);
}
}
[CompilerGenerated]
private sealed class <FinishSpawn>d__9 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public HealthManager hm;
public Collider2D ogCol;
public bool arena;
private EnemyDeathEffects <de>5__1;
private GameObject <corpse>5__2;
private Collider2D <col>5__3;
private Bounds <ogBounds>5__4;
private Bounds <bounds>5__5;
private float <yShift>5__6;
private Collider2D <touch>5__7;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <FinishSpawn>d__9(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<de>5__1 = null;
<corpse>5__2 = null;
<col>5__3 = null;
<touch>5__7 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_00d8: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: 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_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = null;
<>1__state = 1;
return true;
case 1:
{
<>1__state = -1;
<de>5__1 = hm.enemyDeathEffects;
if (!Object.op_Implicit((Object)(object)<de>5__1))
{
return false;
}
<de>5__1.SkipKillFreeze = true;
<corpse>5__2 = <de>5__1.GetInstantiatedCorpse((AttackTypes)1);
if (Object.op_Implicit((Object)(object)<corpse>5__2))
{
<corpse>5__2.AddComponent<BlockAudio>();
}
if (!Object.op_Implicit((Object)(object)ogCol))
{
return false;
}
<col>5__3 = ((Component)hm).GetComponent<Collider2D>();
if (!Object.op_Implicit((Object)(object)<col>5__3))
{
return false;
}
<ogBounds>5__4 = ogCol.bounds;
<bounds>5__5 = <col>5__3.bounds;
<yShift>5__6 = (((Bounds)(ref <ogBounds>5__4)).max.y - ((Bounds)(ref <bounds>5__5)).min.y) * 1.1f;
RaycastHit2D val = Physics2D.Raycast(Vector2.op_Implicit(((Bounds)(ref <ogBounds>5__4)).max), new Vector2(0f, -1f), ((Bounds)(ref <ogBounds>5__4)).max.y - ((Bounds)(ref <bounds>5__5)).min.y, LayerMask.op_Implicit(TerrainMask));
<touch>5__7 = ((RaycastHit2D)(ref val)).collider;
if (!Object.op_Implicit((Object)(object)<touch>5__7))
{
return false;
}
((Component)hm).transform.Translate(0f, <yShift>5__6, 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();
}
}
[CompilerGenerated]
private sealed class <Rando>d__6 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public HealthManager healthManager;
public Settings.RandoType type;
private <>c__DisplayClass6_0 <>8__1;
private bool <noControl>5__2;
private EnemyDeathEffects <de>5__3;
private GameObject <corpse>5__4;
private tk2dSprite[] <>s__5;
private int <>s__6;
private tk2dSprite <o>5__7;
private SpriteRenderer[] <>s__8;
private int <>s__9;
private SpriteRenderer <o>5__10;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Rando>d__6(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>8__1 = null;
<de>5__3 = null;
<corpse>5__4 = null;
<>s__5 = null;
<o>5__7 = null;
<>s__8 = null;
<o>5__10 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Expected O, but got Unknown
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Expected O, but got Unknown
//IL_048f: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Expected O, but got Unknown
//IL_044d: Unknown result type (might be due to invalid IL or missing references)
//IL_0457: Expected O, but got Unknown
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_018f: Expected O, but got Unknown
//IL_037d: Unknown result type (might be due to invalid IL or missing references)
//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>8__1 = new <>c__DisplayClass6_0();
<>8__1.healthManager = healthManager;
<>2__current = (object)new WaitForSeconds(0.02f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
if (!Object.op_Implicit((Object)(object)<>8__1.healthManager))
{
return false;
}
if (Object.op_Implicit((Object)(object)((Component)<>8__1.healthManager).GetComponent<ReplacementEnemy>()))
{
return false;
}
<>8__1.fsm = ((Component)<>8__1.healthManager).GetComponent<PlayMakerFSM>();
<>8__1.arena = Object.op_Implicit((Object)(object)((Component)<>8__1.healthManager).GetComponentInParent<BattleWave>()) || (Object.op_Implicit((Object)(object)((Component)<>8__1.healthManager).transform.parent) && ((Object)((Component)<>8__1.healthManager).transform.parent).name.Contains("Key Control"));
if (<>8__1.healthManager.hp > 100000)
{
return false;
}
<>8__1.healthManager.hp = 10000;
if (<>8__1.arena)
{
<>2__current = (object)new WaitForSeconds(0.75f);
<>1__state = 2;
return true;
}
goto IL_019f;
case 2:
<>1__state = -1;
goto IL_019f;
case 3:
<>1__state = -1;
if (!Object.op_Implicit((Object)(object)<>8__1.healthManager) || <>8__1.healthManager.isDead)
{
return false;
}
<>2__current = (object)new WaitForSeconds(<>8__1.arena ? 0.75f : 0.02f);
<>1__state = 4;
return true;
case 4:
<>1__state = -1;
if (<>8__1.healthManager.hp > 100000)
{
return false;
}
<noControl>5__2 = HeroController.instance.controlReqlinquished;
<>8__1.healthManager.largeGeoDrops = 0;
<>8__1.healthManager.mediumGeoDrops = 0;
<>8__1.healthManager.smallGeoDrops = 0;
<>8__1.healthManager.shellShardDrops = 0;
if (!Object.op_Implicit((Object)(object)<>8__1.healthManager))
{
return false;
}
if (!SpawnRandomEnemy(<>8__1.healthManager, type, <>8__1.arena, <>8__1.healthManager.initHp))
{
return false;
}
<de>5__3 = <>8__1.healthManager.enemyDeathEffects;
if (Object.op_Implicit((Object)(object)<de>5__3))
{
<corpse>5__4 = <de>5__3.GetInstantiatedCorpse((AttackTypes)1);
if (Object.op_Implicit((Object)(object)<corpse>5__4))
{
<>s__5 = <corpse>5__4.GetComponentsInChildren<tk2dSprite>();
for (<>s__6 = 0; <>s__6 < <>s__5.Length; <>s__6++)
{
<o>5__7 = <>s__5[<>s__6];
((tk2dBaseSprite)<o>5__7).color = Color.clear;
<o>5__7 = null;
}
<>s__5 = null;
<>s__8 = <corpse>5__4.GetComponentsInChildren<SpriteRenderer>();
for (<>s__9 = 0; <>s__9 < <>s__8.Length; <>s__9++)
{
<o>5__10 = <>s__8[<>s__9];
<o>5__10.color = Color.clear;
<o>5__10 = null;
}
<>s__8 = null;
<corpse>5__4.AddComponent<ColorLock>();
}
<corpse>5__4 = null;
}
if (<noControl>5__2)
{
<>2__current = (object)new WaitForSeconds(0.2f);
<>1__state = 5;
return true;
}
break;
case 5:
{
<>1__state = -1;
if (HeroController.instance.controlReqlinquished && !HeroController.instance.cState.isBinding && (int)HeroController.instance.transitionState == 0 && !HeroController.instance.cState.dashing && !PlayerData.instance.atBench && !HeroController.instance.sprintFSM.ActiveStateName.Contains("Sprint") && !HeroController.instance.umbrellaFSM.ActiveStateName.Contains("Inflate") && !HeroController.instance.isUmbrellaActive.Value && !HeroController.instance.cState.isSprinting && !HeroController.instance.cState.jumping && !HeroController.instance.cState.floating)
{
HeroController.instance.RegainControl();
HeroController.instance.StartAnimationControl();
}
break;
}
IL_019f:
<>2__current = (object)new WaitUntil((Func<bool>)delegate
{
//IL_0274: Unknown result type (might be due to invalid IL or missing references)
//IL_0279: Unknown result type (might be due to invalid IL or missing references)
//IL_0284: Unknown result type (might be due to invalid IL or missing references)
//IL_0289: Unknown result type (might be due to invalid IL or missing references)
//IL_028b: Unknown result type (might be due to invalid IL or missing references)
//IL_028d: Unknown result type (might be due to invalid IL or missing references)
//IL_028e: Unknown result type (might be due to invalid IL or missing references)
//IL_0293: Unknown result type (might be due to invalid IL or missing references)
//IL_0295: Unknown result type (might be due to invalid IL or missing references)
//IL_0296: 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_02a2: Unknown result type (might be due to invalid IL or missing references)
//IL_02ae: 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_02bd: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)<>8__1.healthManager) || <>8__1.healthManager.isDead)
{
return true;
}
bool flag = ((Component)<>8__1.healthManager).gameObject.layer == InteractiveLayer;
if (((Component)<>8__1.healthManager).gameObject.layer != EnemiesLayer && !flag)
{
return false;
}
if (<>8__1.healthManager != null && <>8__1.healthManager.IsInvincible && <>8__1.healthManager.InvincibleFromDirection == 0)
{
return false;
}
Renderer component = ((Component)<>8__1.healthManager).GetComponent<Renderer>();
if (Object.op_Implicit((Object)(object)component) && !component.enabled)
{
return false;
}
if (Object.op_Implicit((Object)(object)<>8__1.fsm))
{
if (<>8__1.fsm.ActiveStateName.Contains("Intro") || <>8__1.fsm.ActiveStateName.Contains("Zoom") || <>8__1.fsm.ActiveStateName.Contains("Roar") || <>8__1.fsm.ActiveStateName.Contains("Drop") || <>8__1.fsm.ActiveStateName.Contains("Pause"))
{
return false;
}
if (((Object)<>8__1.healthManager).name.Contains("Handmaiden") && <>8__1.fsm.ActiveStateName != "Tele In End")
{
return false;
}
if (((Object)<>8__1.healthManager).name.Contains("Flower Queen") && <>8__1.fsm.ActiveStateName != "Idle")
{
return false;
}
}
Collider2D component2 = ((Component)<>8__1.healthManager).GetComponent<Collider2D>();
if ((!Object.op_Implicit((Object)(object)component2) || !((Behaviour)component2).isActiveAndEnabled) && ((Object)<>8__1.healthManager).name != "Splinter Queen" && !((Object)<>8__1.healthManager).name.Contains("Coral Swimmer Small") && !((Object)<>8__1.healthManager).name.Contains("Swamp Drifter") && !flag)
{
return false;
}
if (!<>8__1.arena)
{
return true;
}
Vector3 position = ((Component)<>8__1.healthManager).transform.position;
Vector3 position2 = HeroController.instance.transform.position;
Vector3 val = position2 - position;
RaycastHit2D val2 = Physics2D.Raycast(Vector2.op_Implicit(position), Vector2.op_Implicit(((Vector3)(ref val)).normalized), ((Vector3)(ref val)).magnitude, LayerMask.op_Implicit(TerrainMask));
return !Object.op_Implicit((Object)(object)((RaycastHit2D)(ref val2)).collider);
});
<>1__state = 3;
return true;
}
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();
}
}
[CompilerGenerated]
private sealed class <WaitForRando>d__3 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public HealthManager healthManager;
public Settings.RandoType type;
private <>c__DisplayClass3_0 <>8__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <WaitForRando>d__3(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>8__1 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>8__1 = new <>c__DisplayClass3_0();
<>8__1.healthManager = healthManager;
<>2__current = (object)new WaitUntil((Func<bool>)(() => !Object.op_Implicit((Object)(object)<>8__1.healthManager) || !<>8__1.healthManager.isDead));
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>2__current = Rando(<>8__1.healthManager, type);
<>1__state = 2;
return true;
case 2:
<>1__state = -1;
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();
}
}
[CompilerGenerated]
private sealed class <ZeroHp>d__2 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public ReplacementEnemy rando;
private PlayMakerFSM[] <fsms>5__1;
private bool <die>5__2;
private bool <canRerando>5__3;
private bool <b3>5__4;
private PlayMakerFSM <phaseControl>5__5;
private PlayMakerFSM[] <>s__6;
private int <>s__7;
private <>c__DisplayClass2_0 <>8__8;
private FsmGameObject <cc>5__9;
private FsmState <fail>5__10;
private FsmState <idle>5__11;
private Transform <par>5__12;
private ReplacedEnemy[] <>s__13;
private int <>s__14;
private ReplacedEnemy <rep>5__15;
private IEnumerator<ReplacementEnemy> <>s__16;
private ReplacementEnemy <replacement>5__17;
private GameObject <bs>5__18;
private PlayMakerFSM <ctrl>5__19;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ZeroHp>d__2(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<fsms>5__1 = null;
<phaseControl>5__5 = null;
<>s__6 = null;
<>8__8 = null;
<cc>5__9 = null;
<fail>5__10 = null;
<idle>5__11 = null;
<par>5__12 = null;
<>s__13 = null;
<rep>5__15 = null;
<>s__16 = null;
<replacement>5__17 = null;
<bs>5__18 = null;
<ctrl>5__19 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
if (!Object.op_Implicit((Object)(object)rando.target))
{
return false;
}
<fsms>5__1 = ((Component)rando.target).GetComponents<PlayMakerFSM>();
<die>5__2 = true;
<canRerando>5__3 = true;
if (((Object)rando.target).name.Contains("Flower Queen"))
{
rando.target.hasSpecialDeath = false;
}
if (((Object)rando.target).name.Contains("Dock Guard"))
{
FSMUtility.LocateMyFSM(((Component)rando.target).gameObject, "Control").SendEvent("ZERO HP");
return false;
}
<>s__6 = <fsms>5__1;
for (<>s__7 = 0; <>s__7 < <>s__6.Length; <>s__7++)
{
<>8__8 = new <>c__DisplayClass2_0();
<>8__8.fsm = <>s__6[<>s__7];
if (((IEnumerable<FsmTransition>)<>8__8.fsm.FsmGlobalTransitions).FirstOrDefault((Func<FsmTransition, bool>)((FsmTransition ev) => ev.EventName == "ZERO HP")) != null)
{
<>8__8.fsm.SendEvent("ZERO HP");
if (rando.target.hasSpecialDeath)
{
<die>5__2 = false;
}
}
if (((Object)<>8__8.fsm).name == "Conductor Boss")
{
<>8__8.fsm.SendEvent("DIE");
}
if (((IEnumerable<FsmTransition>)<>8__8.fsm.FsmGlobalTransitions).FirstOrDefault((Func<FsmTransition, bool>)((FsmTransition ev) => ev.EventName == "FINAL BLOCK")) != null)
{
<>8__8.fsm.SendEvent("FINAL BLOCK");
<fail>5__10 = FsmUtils.GetState(<>8__8.fsm, "Fail Hit");
if (<fail>5__10.actions.Length == 15)
{
FsmUtils.AddAction(<fail>5__10, (Action)delegate
{
((Component)<>8__8.fsm).gameObject.transform.Translate(0f, 4f, 0f);
}, -1, false);
}
<die>5__2 = false;
<fail>5__10 = null;
}
<cc>5__9 = <>8__8.fsm.FsmVariables.FindFsmGameObject("Centipede Control");
FsmGameObject obj = <cc>5__9;
if (obj != null)
{
obj.Value.GetComponent<PlayMakerFSM>().SetState("Bellbeast Jumps In");
}
if (((Object)rando.target).name.Contains("Spine Floater"))
{
<idle>5__11 = FsmUtils.GetState(<>8__8.fsm, "Idle");
FsmState obj2 = <idle>5__11;
if (obj2 != null)
{
FsmUtils.AddAction(obj2, (Action)delegate
{
<>8__8.fsm.SendEvent("FINAL");
}, 0, true);
}
<die>5__2 = false;
<canRerando>5__3 = false;
<idle>5__11 = null;
}
if (((Object)rando.target).name.Contains("Bone Flyer Giant"))
{
rando.target.hasSpecialDeath = false;
}
if (((Object)<>8__8.fsm).name.Contains("Driller ") && <>8__8.fsm.FsmName.Equals("Death Checker"))
{
<>8__8.fsm.SetState("Notify Parent");
<par>5__12 = ((Component)rando.target).transform.parent;
if (Object.op_Implicit((Object)(object)<par>5__12))
{
<>s__13 = ((Component)<par>5__12).GetComponentsInChildren<ReplacedEnemy>(true);
for (<>s__14 = 0; <>s__14 < <>s__13.Length; <>s__14++)
{
<rep>5__15 = <>s__13[<>s__14];
<>s__16 = <rep>5__15.replacements.Where((ReplacementEnemy replacement) => Object.op_Implicit((Object)(object)replacement)).GetEnumerator();
try
{
while (<>s__16.MoveNext())
{
<replacement>5__17 = <>s__16.Current;
((Component)<replacement>5__17).gameObject.SetActive(false);
<replacement>5__17 = null;
}
}
finally
{
if (<>s__16 != null)
{
<>s__16.Dispose();
}
}
<>s__16 = null;
<rep>5__15 = null;
}
<>s__13 = null;
((Component)<par>5__12).gameObject.SetActive(false);
}
<canRerando>5__3 = false;
((Component)rando.target).transform.parent = null;
rando.target.hasSpecialDeath = false;
<par>5__12 = null;
}
<cc>5__9 = null;
<>8__8 = null;
}
<>s__6 = null;
if (((Object)rando.target).name.Contains("Lost Lace"))
{
rando.target.hasSpecialDeath = false;
}
<b3>5__4 = ((Object)rando.target).name.Contains("Conductor");
if ((((Object)rando.target).name.Contains("Slasher") || ((Object)rando.target).name.Contains("Slammer")) | <b3>5__4)
{
<bs>5__18 = GameObject.Find("Boss Scene");
if (Object.op_Implicit((Object)(object)<bs>5__18))
{
((Component)rando.target).gameObject.SetActive(false);
((Component)rando.target).transform.parent = <bs>5__18.transform.Find("Husks");
<ctrl>5__19 = FSMUtility.LocateMyFSM(<bs>5__18, "Control");
if (Object.op_Implicit((Object)(object)<ctrl>5__19))
{
if (<b3>5__4)
{
<ctrl>5__19.SetState("Death Explode");
}
else
{
<ctrl>5__19.SendEvent("HUSK KILLED");
}
}
<canRerando>5__3 = false;
<die>5__2 = false;
<ctrl>5__19 = null;
}
<bs>5__18 = null;
}
if (<die>5__2)
{
rando.target.Die((float?)0f, (AttackTypes)1, true);
}
<phaseControl>5__5 = FSMUtility.LocateMyFSM(((Component)rando.target).gameObject, "Phase Control");
if (Object.op_Implicit((Object)(object)<phaseControl>5__5))
{
<phaseControl>5__5.SetState("Death Hit");
}
if (<canRerando>5__3)
{
((MonoBehaviour)EnemyRandoPlugin.Instance).StartCoroutine(WaitForRando(rando.target, rando.randoType));
}
if (Object.op_Implicit((Object)(object)rando) && Object.op_Implicit((Object)(object)((Component)rando).gameObject))
{
Object.Destroy((Object)(object)((Component)rando).gameObject);
}
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();
}
}
private const string ON_RANDO_DEATH = "OnRandoDeath";
private static readonly int EnemiesLayer = LayerMask.NameToLayer("Enemies");
private static readonly int InteractiveLayer = LayerMask.NameToLayer("Interactive Object");
private static readonly LayerMask TerrainMask = LayerMask.op_Implicit(LayerMask.GetMask(new string[1] { "Terrain" }));
public static void Init()
{
HookUtils.Hook(typeof(SendMessage), "OnEnter", (Delegate)(Action<Action<SendMessage>, SendMessage>)delegate(Action<SendMessage> orig, SendMessage self)
{
if (self.functionCall.FunctionName.Contains("FreezeMoment") && Object.op_Implicit((Object)(object)((Component)((FsmStateAction)self).fsmComponent).GetComponent<BlockAudio>()))
{
((FsmStateAction)self).Finish();
}
else
{
orig(self);
}
}, Array.Empty<Type>());
HookUtils.Hook(typeof(CreateObject), "OnEnter", (Delegate)(Action<Action<CreateObject>, CreateObject>)delegate(Action<CreateObject> orig, CreateObject self)
{
GameObject value = self.gameObject.value;
if (Object.op_Implicit((Object)(object)value) && Object.op_Implicit((Object)(object)value.GetComponent<FreezeMomentOnEnable>()) && Object.op_Implicit((Object)(object)((Component)((FsmStateAction)self).fsmComponent).GetComponent<BlockAudio>()))
{
((FsmStateAction)self).Finish();
}
else
{
orig(self);
}
}, Array.Empty<Type>());
HookUtils.Hook(typeof(ApplyMusicCue), "OnEnter", (Delegate)(Action<Action<ApplyMusicCue>, ApplyMusicCue>)delegate(Action<ApplyMusicCue> orig, ApplyMusicCue self)
{
if (Object.op_Implicit((Object)(object)((Component)((FsmStateAction)self).fsmComponent).GetComponent<BlockAudio>()))
{
((FsmStateAction)self).Finish();
}
else
{
orig(self);
}
}, Array.Empty<Type>());
HookUtils.Hook(typeof(TransitionToAudioSnapshot), "OnEnter", (Delegate)(Action<Action<TransitionToAudioSnapshot>, TransitionToAudioSnapshot>)delegate(Action<TransitionToAudioSnapshot> orig, TransitionToAudioSnapshot self)
{
if (Object.op_Implicit((Object)(object)((Component)((FsmStateAction)self).fsmComponent).GetComponent<BlockAudio>()))
{
((FsmStateAction)self).Finish();
}
else
{
orig(self);
}
}, Array.Empty<Type>());
HookUtils.Hook(typeof(StartRoarEmitter), "OnEnter", (Delegate)(Action<Action<StartRoarEmitter>, StartRoarEmitter>)delegate(Action<StartRoarEmitter> _, StartRoarEmitter self)
{
((FsmStateAction)self).Finish();
}, Array.Empty<Type>());
HookUtils.Hook(typeof(HealthManager), "OnEnable", (Delegate)(Action<Action<HealthManager>, HealthManager>)delegate(Action<HealthManager> orig, HealthManager healthManager)
{
orig(healthManager);
if (!healthManager.isDead && PreloadManager.HasPreloaded)
{
EnemyRandoPlugin.Logger.LogInfo((object)((Object)healthManager).name);
if (!Object.op_Implicit((Object)(object)((Component)healthManager).GetComponent<ReplacementEnemy>()) && !Object.op_Implicit((Object)(object)((Component)healthManager).GetComponent<ReplacedEnemy>()) && (!Object.op_Implicit((Object)(object)((Component)healthManager).transform.parent) || !((Object)((Component)healthManager).transform.parent).name.Contains("Intro Minions")) && !((Object)healthManager).name.Contains("Music Box Bell"))
{
Settings.RandoType randoType = EnemyChooser.GetEnemyType(healthManager).GetRandoType();
if (randoType != 0)
{
((MonoBehaviour)EnemyRandoPlugin.Instance).StartCoroutine(Rando(healthManager, randoType));
}
}
}
}, Array.Empty<Type>());
EventHooks.OnEvent = (Action<GameObject, string>)Delegate.Combine(EventHooks.OnEvent, (Action<GameObject, string>)delegate(GameObject o, string s)
{
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
if (!(s != "OnRandoDeath"))
{
ReplacementEnemy component = o.GetComponent<ReplacementEnemy>();
if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.target))
{
ReplacedEnemy component2 = ((Component)component.target).gameObject.GetComponent<ReplacedEnemy>();
if (Object.op_Implicit((Object)(object)component2))
{
component2.replacements.Remove(component);
if (component2.replacements.Count == 0)
{
DamageHero[] componentsInChildren = ((Component)component2).GetComponentsInChildren<DamageHero>();
foreach (DamageHero val in componentsInChildren)
{
((Behaviour)val).enabled = false;
}
if (!component.target.hasSpecialDeath || ((Object)component.target).name.Contains("Spine Floater"))
{
((Component)component.target).transform.position = ((Component)component).transform.position;
}
Object.Destroy((Object)(object)component2);
((Component)component.target).gameObject.SetActive(true);
((MonoBehaviour)EnemyRandoPlugin.Instance).StartCoroutine(ZeroHp(component));
}
}
}
}
});
}
[IteratorStateMachine(typeof(<ZeroHp>d__2))]
private static IEnumerator ZeroHp(ReplacementEnemy rando)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ZeroHp>d__2(0)
{
rando = rando
};
}
[IteratorStateMachine(typeof(<WaitForRando>d__3))]
private static IEnumerator WaitForRando(HealthManager healthManager, Settings.RandoType type)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <WaitForRando>d__3(0)
{
healthManager = healthManager,
type = type
};
}
[IteratorStateMachine(typeof(<Rando>d__6))]
private static IEnumerator Rando(HealthManager healthManager, Settings.RandoType type)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Rando>d__6(0)
{
healthManager = healthManager,
type = type
};
}
private static bool SpawnRandomEnemy(HealthManager source, Settings.RandoType type, bool arena, int hp)
{
//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_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Invalid comparison between Unknown and I4
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: 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_0094: 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)
if (Object.op_Implicit((Object)(object)((Component)source).gameObject.GetComponent<ReplacedEnemy>()))
{
return false;
}
ReplacedEnemy replacedEnemy = ((Component)source).gameObject.AddComponent<ReplacedEnemy>();
((Component)source).gameObject.SetActive(false);
(PlaceableObject, bool, bool) randomEnemy = EnemyChooser.GetRandomEnemy(source, type);
PlaceableObject item = randomEnemy.Item1;
bool item2 = randomEnemy.Item2;
bool item3 = randomEnemy.Item3;
Quaternion rotation = ((Component)source).gameObject.transform.rotation;
RotationGroup rotationGroup = item.GetRotationGroup();
if ((int)rotationGroup <= 1)
{
rotation = item.Prefab.transform.rotation;
}
Vector3 position = ((Component)source).gameObject.transform.position;
position.z = item.ZPosition;
Collider2D component = ((Component)source).GetComponent<Collider2D>();
for (int i = 0; i < Math.Max(1, Settings.Multiplier.Value); i++)
{
GameObject val = Object.Instantiate<GameObject>(item.Prefab, position, rotation);
ReplacementEnemy replacementEnemy = val.AddComponent<ReplacementEnemy>();
replacementEnemy.target = source;
replacementEnemy.randoType = type;
EventHooks.AddEvent(val, "OnDeath", "OnRandoDeath");
((Object)val).name = "[Enemy Rando] " + ((SelectableObject)item).GetName() + " (" + ((Object)source).name + ")";
item.PostSpawnAction?.Invoke(val);
foreach (ConfigType item4 in item.ConfigGroup)
{
ConfigValue defaultValue = item4.GetDefaultValue();
if (defaultValue != null && defaultValue.GetPriority() < 0)
{
defaultValue.Setup(val, (string)null);
}
}
ObjectUtils.RemoveComponent<PersistentBoolItem>(val);
ObjectUtils.RemoveComponent<TestGameObjectActivator>(val);
ObjectUtils.RemoveComponent<DeactivateIfPlayerdataFalse>(val);
ObjectUtils.RemoveComponent<DeactivateIfPlayerdataFalseDelayed>(val);
ObjectUtils.RemoveComponent<DeactivateIfPlayerdataTrue>(val);
ObjectUtils.RemoveComponent<ConstrainPosition>(val);
HealthManager component2 = val.GetComponent<HealthManager>();
if (Settings.MaintainHp.Value)
{
component2.hp = hp;
}
if (item2)
{
component2.hp *= 2;
}
component2.bigEnemyDeath = source.bigEnemyDeath;
if (PlayerData.instance.nailUpgrades < 2)
{
ObjectUtils.RemoveComponent<LifebloodState>(val);
}
val.SetActive(true);
foreach (ConfigType item5 in item.ConfigGroup)
{
ConfigValue defaultValue2 = item5.GetDefaultValue();
if (defaultValue2 != null && defaultValue2.GetPriority() >= 0)
{
defaultValue2.Setup(val, (string)null);
}
}
if (item3)
{
val.AddComponent<LifebloodState>();
}
if (item2)
{
CustomBlackThreadState val2 = val.AddComponent<CustomBlackThreadState>();
val2.customAttack = Effects.BlackThreadAttacksDefault[Random.RandomRangeInt(0, 4)];
((BlackThreadState)val2).extraSpriteRenderers = val.GetComponentsInChildren<SpriteRenderer>(true);
((BlackThreadState)val2).extraMeshRenderers = val.GetComponentsInChildren<MeshRenderer>(true);
((BlackThreadState)val2).useCustomHPMultiplier = true;
((BlackThreadState)val2).customHPMultiplier = 1f;
component2.blackThreadState = (BlackThreadState)(object)val2;
component2.hasBlackThreadState = true;
}
replacedEnemy.replacements.Add(replacementEnemy);
((MonoBehaviour)EnemyRandoPlugin.Instance).StartCoroutine(FinishSpawn(component2, component, arena));
}
return true;
}
[IteratorStateMachine(typeof(<FinishSpawn>d__9))]
private static IEnumerator FinishSpawn(HealthManager hm, Collider2D ogCol, bool arena)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <FinishSpawn>d__9(0)
{
hm = hm,
ogCol = ogCol,
arena = arena
};
}
}
public class ReplacedEnemy : MonoBehaviour
{
public List<ReplacementEnemy> replacements = new List<ReplacementEnemy>();
private void OnEnable()
{
((Component)this).gameObject.SetActive(false);
}
}
public class BlockAudio : MonoBehaviour
{
}
public class ReplacementEnemy : BlockAudio
{
public HealthManager? target;
public Settings.RandoType randoType;
}
public static class Settings
{
public enum ConsistencyType
{
None,
EnemyType,
Individual,
Room
}
public enum RandoType
{
Disabled,
Any,
Enemy,
Boss
}
public static ConfigEntry<ConsistencyType> Consistency;
public static ConfigEntry<int> Seed;
public static ConfigEntry<int> Multiplier;
public static ConfigEntry<RandoType> EnemyRandoType;
public static ConfigEntry<RandoType> BossRandoType;
public static ConfigEntry<RandoType> MiscRandoType;
public static ConfigEntry<float> BlackThreadChance;
public static ConfigEntry<float> BlackThreadChanceAct3;
public static ConfigEntry<float> PlasmifiedChance;
public static ConfigEntry<float> PlasmifiedChanceAct3;
public static ConfigEntry<bool> MaintainHp;
public static void Init(ConfigFile config)
{
Seed = config.Bind<int>("Options", "Seed", Random.RandomRangeInt(0, 99999), "The seed for the randomisation.\nOnly has an effect if Consistency is set to EnemyType, Individual or Room.");
Consistency = config.Bind<ConsistencyType>("Options", "ConsistencyMode", ConsistencyType.None, "Whether enemies should be consistently randomised to the same thing.\nNone means they are random each time,\nEnemyType will randomise enemies of the same type to the same thing,\nIndividual will randomise each individual enemy to the same thing each time.\nRoom will randomise each enemy in a room to the same thing.");
Multiplier = config.Bind<int>("Options", "Multiplier", 1, "How many copies of randomised enemies should be spawned.");
MaintainHp = config.Bind<bool>("Options", "MaintainHp", false, "Controls whether replacement enemies should have the same health as the ones they replace.");
EnemyRandoType = config.Bind<RandoType>("Targets", "EnemyRandoType", RandoType.Any, "What enemies should be able to turn into.\n'Disabled' - Will not be randomised.\n'Any' - Can randomise into enemies or bosses.\n'Enemy' - Can only randomise into regular enemies.\n'Boss' - Can only randomise into bosses.");
BossRandoType = config.Bind<RandoType>("Targets", "BossRandoType", RandoType.Any, "What bosses should be able to turn into.\n'Disabled' - Will not be randomised.\n'Any' - Can randomise into enemies or bosses.\n'Enemy' - Can only randomise into regular enemies.\n'Boss' - Can only randomise into bosses.");
MiscRandoType = config.Bind<RandoType>("Targets", "MiscRandoType", RandoType.Disabled, "What non living objects with health managers (e.g. moss cocoons) should be able to turn into.\n'Disabled' - Will not be randomised.\n'Any' - Can randomise into enemies or bosses.\n'Enemy' - Can only randomise into regular enemies.\n'Boss' - Can only randomise into bosses.");
BlackThreadChance = config.Bind<float>("States", "BlackThreadChance", 0f, "The chance of randomised enemies becoming black threaded outside of Act 3.");
BlackThreadChanceAct3 = config.Bind<float>("States", "BlackThreadChanceAct3", 0.5f, "The chance of randomised enemies becoming black threaded in Act 3.");
PlasmifiedChance = config.Bind<float>("States", "PlasmifiedChance", 0f, "The chance of randomised enemies becoming plasmified outside of Act 3.");
PlasmifiedChanceAct3 = config.Bind<float>("States", "PlasmifiedChanceAct3", 0f, "The chance of randomised enemies becoming plasmified in Act 3.");
}
}
}