Decompiled source of DiscipleClan v0.0.1
plugins/DiscipleClan.Plugin.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using DiscipleClan.Plugin.StatusEffects; using DiscipleClan.Plugin.Wards; using HarmonyLib; using Microsoft.CodeAnalysis; using Microsoft.Extensions.Configuration; using ShinyShoe; using SimpleInjector; using TrainworksReloaded.Base.Extensions; using TrainworksReloaded.Base.Localization; using TrainworksReloaded.Core; using TrainworksReloaded.Core.Enum; using TrainworksReloaded.Core.Extensions; using TrainworksReloaded.Core.Impl; using TrainworksReloaded.Core.Interfaces; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("DiscipleClan.Plugin")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.0.1.0")] [assembly: AssemblyInformationalVersion("0.0.1+7184846b1a6a006fb5c81f3f49f09756af2ff35d")] [assembly: AssemblyProduct("DiscipleClan.Plugin")] [assembly: AssemblyTitle("DiscipleClan.Plugin")] [assembly: AssemblyVersion("0.0.1.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.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 DiscipleClan.Plugin { public static class CharacterTriggers { public static Trigger OnRelocate; public static Trigger OnGainEmber; } [BepInPlugin("DiscipleClan.Plugin", "DiscipleClan.Plugin", "0.0.1")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Logger = new ManualLogSource("DiscipleClan.Plugin"); internal static Lazy<WardManager> WardManager = new Lazy<WardManager>(() => new WardManager()); public void Awake() { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) Logger = ((BaseUnityPlugin)this).Logger; WardManager wardManager = WardManager.Value; DepInjector.AddProvider((IProvider)(object)wardManager); Railend.ConfigurePreAction((Action<Container>)delegate(Container builder) { builder.RegisterInstance<WardManager>(wardManager); }); Railhead.GetBuilder().Configure("DiscipleClan.Plugin", (Action<IConfigurationBuilder>)delegate(IConfigurationBuilder c) { ConfigurationExtensions.AddMergedJsonFile(c, new List<string>(71) { "json/class/chrono.json", "json/text/text.json", "json/text/chronolock.json", "json/champion/disciple_base.json", "json/champion/disciple_upgrades.json", "json/champion/second_disciple.json", "json/champion/second_disciple_upgrades.json", "json/subtypes/seer.json", "json/subtypes/pythian.json", "json/subtypes/eternal.json", "json/subtypes/ward.json", "json/status_effects/gravity.json", "json/status_effects/pyreboost.json", "json/status_effects/emberboost.json", "json/status_effects/icarian.json", "json/status_effects/hide_until_boss.json", "json/triggers/relocate.json", "json/triggers/gain_ember.json", "json/cardpool/banner_pool.json", "json/map_nodes/banner.json", "json/units/cinderborn.json", "json/units/waxwing.json", "json/units/fortune_finder.json", "json/units/flashwing.json", "json/units/snecko.json", "json/units/embermaker.json", "json/units/ancient_savant.json", "json/units/ancient_pyresnail.json", "json/wards/haruspex_ward_beta.json", "json/wards/power_ward_beta.json", "json/wards/shifter_ward_beta.json", "json/wards/spike_ward.json", "json/units/jelly_scholar.json", "json/units/newtons.json", "json/units/minerva_owl.json", "json/units/morsowl.json", "json/units/fireshaped.json", "json/units/diviner_of_the_infinite.json", "json/spells/pattern_shift.json", "json/spells/apple_elixir.json", "json/spells/seek.json", "json/spells/firewall.json", "json/spells/dilation.json", "json/spells/rewind.json", "json/spells/flashfire_spell.json", "json/spells/epoch_tome.json", "json/spells/revelation.json", "json/spells/palm_reading.json", "json/spells/emberwave_beta.json", "json/spells/pyre_spike.json", "json/spells/rocket_speed.json", "json/spells/haruspex_ward_beta.json", "json/spells/chronomancy.json", "json/spells/analog.json", "json/spells/pendulum_beta.json", "json/spells/time_stamp.json", "json/spells/right_timing_beta.json", "json/spells/right_timing_delta.json", "json/spells/time_freeze.json", "json/spells/wax_pinion.json", "json/relics/rewind_first_spell.json", "json/relics/free_time.json", "json/relics/gravity_on_ascend.json", "json/relics/gold_over_time.json", "json/relics/pyre_damage_on_ember.json", "json/relics/quick_and_dirty.json", "json/relics/rage_against_the_pyre.json", "json/relics/refund_x_costs.json", "json/relics/first_buff_extra_stack.json", "json/relics/gold_on_pyre_kill.json", "json/relics/highest_hp_to_front.json" }); }); Railend.ConfigurePostAction((Action<Container>)delegate(Container c) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) IRegister<Trigger> manager = c.GetInstance<IRegister<Trigger>>(); CharacterTriggers.OnRelocate = GetTrigger("OnRelocate"); CharacterTriggers.OnGainEmber = GetTrigger("OnGainEmber"); Trigger GetTrigger(string id) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) return IEnumerableUtility.GetValueOrDefault<string, Trigger>((IDictionary<string, Trigger>)manager, StringExtensions.GetId("DiscipleClan.Plugin", "CTriggerEnum", id), (Trigger)0); } }); Logger.LogInfo((object)"Plugin DiscipleClan.Plugin is loaded!"); new Harmony("DiscipleClan.Plugin").PatchAll(); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "DiscipleClan.Plugin"; public const string PLUGIN_NAME = "DiscipleClan.Plugin"; public const string PLUGIN_VERSION = "0.0.1"; } } namespace DiscipleClan.Plugin.Wards { public class WardData { public string titleKey { get; set; } = ""; public string descriptionKey { get; set; } = ""; public Sprite? iconSprite { get; set; } public List<RoomModifierData> roomModifierData { get; set; } = new List<RoomModifierData>(); } public class WardDefinition : IDefinition<WardData> { public string Key { get; set; } public WardData Data { get; set; } public IConfiguration Configuration { get; set; } public string Id { get; set; } = ""; public bool IsModded { get; set; } = true; public WardDefinition(string key, WardData data, IConfiguration configuration) { Key = key; Data = data; Configuration = configuration; } } public class WardFinalizer : IDataFinalizer { private readonly IModLogger<WardFinalizer> logger; private readonly ICache<IDefinition<WardData>> cache; private readonly IRegister<Sprite> spriteRegister; private readonly IRegister<RoomModifierData> roomModifierRegister; public WardFinalizer(IModLogger<WardFinalizer> logger, ICache<IDefinition<WardData>> cache, IRegister<Sprite> spriteRegister, IRegister<RoomModifierData> roomModifierRegister) { this.logger = logger; this.cache = cache; this.spriteRegister = spriteRegister; this.roomModifierRegister = roomModifierRegister; } public void FinalizeData() { foreach (IDefinition<WardData> cacheItem in cache.GetCacheItems()) { FinalizeWard(cacheItem); } cache.Clear(); } private void FinalizeWard(IDefinition<WardData> definition) { IConfiguration configuration = definition.Configuration; WardData data = definition.Data; string key = definition.Key; logger.Log((LogLevel)16, (object)("Finalizing Ward " + definition.Key + " " + definition.Id + " path: " + ConfigurationExtensions.GetPath(configuration) + "...")); ReferencedObject val = ParseReferenceExtensions.ParseReference(configuration.GetSection("icon")) ?? ParseReferenceExtensions.ParseReference(configuration.GetSection("sprite_icon")); Sprite iconSprite = default(Sprite); bool? flag = default(bool?); if (val != null && RegisterExtensions.TryLookupId<Sprite>(spriteRegister, val.ToId(key, "Sprite"), ref iconSprite, ref flag, val.context)) { data.iconSprite = iconSprite; } List<RoomModifierData> list = new List<RoomModifierData>(); RoomModifierData item = default(RoomModifierData); foreach (IConfigurationSection child in configuration.GetSection("param_room_modifiers").GetChildren()) { ReferencedObject val2 = ParseReferenceExtensions.ParseReference(child) ?? ParseReferenceExtensions.ParseReference(child.GetSection("room_modifier")); if (val2 != null) { string text = val2.ToId(key, "RoomModifier"); if (RegisterExtensions.TryLookupId<RoomModifierData>(roomModifierRegister, text, ref item, ref flag, val2.context)) { list.Add(item); } } } if (list.Count > 0) { data.roomModifierData = list; } } } public class WardManager : IProvider, IClient { [CompilerGenerated] private sealed class <GetModifiersForRoom>d__9 : IEnumerable<IRoomStateModifier>, IEnumerable, IEnumerator<IRoomStateModifier>, IEnumerator, IDisposable { private int <>1__state; private IRoomStateModifier <>2__current; private int <>l__initialThreadId; public WardManager <>4__this; private int roomIndex; public int <>3__roomIndex; private IEnumerator<WardState> <>7__wrap1; private IEnumerator<IRoomStateModifier> <>7__wrap2; IRoomStateModifier IEnumerator<IRoomStateModifier>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <GetModifiersForRoom>d__9(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if ((uint)(num - -4) <= 1u || num == 1) { try { if (num == -4 || num == 1) { try { } finally { <>m__Finally2(); } } } finally { <>m__Finally1(); } } <>7__wrap1 = null; <>7__wrap2 = null; <>1__state = -2; } private bool MoveNext() { try { int num = <>1__state; WardManager wardManager = <>4__this; if (num != 0) { if (num != 1) { return false; } <>1__state = -4; goto IL_00a8; } <>1__state = -1; <>7__wrap1 = wardManager.GetWards(roomIndex).GetEnumerator(); <>1__state = -3; goto IL_00c2; IL_00a8: while (<>7__wrap2.MoveNext()) { IRoomStateModifier current = <>7__wrap2.Current; if (current != null) { <>2__current = current; <>1__state = 1; return true; } } <>m__Finally2(); <>7__wrap2 = null; goto IL_00c2; IL_00c2: WardState current2; do { if (<>7__wrap1.MoveNext()) { current2 = <>7__wrap1.Current; continue; } <>m__Finally1(); <>7__wrap1 = null; return false; } while (current2?.Modifiers == null); <>7__wrap2 = current2.Modifiers.GetEnumerator(); <>1__state = -4; goto IL_00a8; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>7__wrap1 != null) { <>7__wrap1.Dispose(); } } private void <>m__Finally2() { <>1__state = -3; if (<>7__wrap2 != null) { <>7__wrap2.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<IRoomStateModifier> IEnumerable<IRoomStateModifier>.GetEnumerator() { <GetModifiersForRoom>d__9 <GetModifiersForRoom>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <GetModifiersForRoom>d__ = this; } else { <GetModifiersForRoom>d__ = new <GetModifiersForRoom>d__9(0) { <>4__this = <>4__this }; } <GetModifiersForRoom>d__.roomIndex = <>3__roomIndex; return <GetModifiersForRoom>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<IRoomStateModifier>)this).GetEnumerator(); } } public const int MaxWardsPerRoom = 4; private readonly Dictionary<int, List<WardState>> _rooms = new Dictionary<int, List<WardState>>(); private readonly List<(WardState Ward, int RoomIndex)> _addLater = new List<(WardState, int)>(); private WardUI? _wardUI; private static void Log(LogLevel level, string message) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Plugin.Logger.Log(level, (object)("[WardManager] " + message)); } public void AddWard(WardState ward, int roomIndex) { if (ward == null || roomIndex < 0) { Log((LogLevel)4, $"AddWard skipped: ward null={ward == null}, roomIndex={roomIndex}"); return; } if (!_rooms.TryGetValue(roomIndex, out List<WardState> value)) { value = new List<WardState>(); _rooms[roomIndex] = value; Log((LogLevel)32, $"Created ward list for room {roomIndex}"); } if (value.Count >= 4) { Log((LogLevel)32, $"AddWard skipped: room {roomIndex} full ({value.Count}/{4})"); return; } value.Add(ward); Log((LogLevel)16, $"Added ward to room {roomIndex} (count={value.Count}, titleKey={ward.titleKey})"); _wardUI?.SetupWardIcons(roomIndex); } public void AddWardLater(WardState ward, int roomIndex) { if (ward == null || roomIndex < 0) { Log((LogLevel)4, $"AddWardLater skipped: ward null={ward == null}, roomIndex={roomIndex}"); return; } _addLater.Add((ward, roomIndex)); Log((LogLevel)32, $"Queued ward for room {roomIndex} (queue size={_addLater.Count})"); } public void FlushAddLater() { int count = _addLater.Count; if (count == 0) { return; } Log((LogLevel)32, $"FlushAddLater: applying {count} queued ward(s)"); foreach (var (ward, roomIndex) in _addLater) { AddWard(ward, roomIndex); } _addLater.Clear(); } public IReadOnlyList<WardState> GetWards(int roomIndex) { if (!_rooms.TryGetValue(roomIndex, out List<WardState> value)) { return new List<WardState>(); } return value; } [IteratorStateMachine(typeof(<GetModifiersForRoom>d__9))] public IEnumerable<IRoomStateModifier> GetModifiersForRoom(int roomIndex) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <GetModifiersForRoom>d__9(-2) { <>4__this = this, <>3__roomIndex = roomIndex }; } public void ResetWards() { int count = _rooms.Count; int count2 = _addLater.Count; _rooms.Clear(); _addLater.Clear(); Log((LogLevel)16, $"ResetWards: cleared {count} room(s), {count2} queued"); } public void NewProviderAvailable(IProvider newProvider) { RoomManager val = (RoomManager)(object)((newProvider is RoomManager) ? newProvider : null); if (val != null) { EnsureWardUI(val); } } public void ProviderRemoved(IProvider removeProvider) { } public void NewProviderFullyInstalled(IProvider newProvider) { RoomManager val = (RoomManager)(object)((newProvider is RoomManager) ? newProvider : null); if (val != null) { EnsureWardUI(val); } } private void EnsureWardUI(RoomManager roomManager) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_wardUI != (Object)null) && !((Object)(object)roomManager == (Object)null)) { Transform wardUIParent = GetWardUIParent(roomManager); if ((Object)(object)wardUIParent == (Object)null) { Log((LogLevel)4, "EnsureWardUI: could not get parent transform from RoomManager"); return; } GameObject val = new GameObject("Ward Container"); val.transform.SetParent(wardUIParent); val.transform.localScale = Vector3.one; val.transform.localPosition = new Vector3(-700f, 175f, 0f); _wardUI = val.AddComponent<WardUI>(); _wardUI.SetManager(this); Log((LogLevel)16, "WardUI created and attached to RoomManager"); } } private static Transform? GetWardUIParent(RoomManager roomManager) { try { RoomUI roomUI = roomManager.GetRoomUI(); if ((Object)(object)roomUI == (Object)null) { return null; } object obj = ((object)roomUI).GetType().GetMethod("GetRoomCapacityUI")?.Invoke(roomUI, null); if (obj != null) { Component val = (Component)((obj is Component) ? obj : null); if (val != null) { return val.transform.parent; } } return (roomUI != null) ? ((Component)roomUI).transform : null; } catch { return null; } } } public class WardPipeline : IDataPipeline<IRegister<WardData>, WardData> { private readonly PluginAtlas atlas; private readonly IModLogger<WardPipeline> logger; private readonly IRegister<LocalizationTerm> termRegister; public WardPipeline(PluginAtlas atlas, IModLogger<WardPipeline> logger, IRegister<LocalizationTerm> termRegister) { this.atlas = atlas; this.logger = logger; this.termRegister = termRegister; } public List<IDefinition<WardData>> Run(IRegister<WardData> service) { List<IDefinition<WardData>> list = new List<IDefinition<WardData>>(); foreach (KeyValuePair<string, PluginDefinition> pluginDefinition in atlas.PluginDefinitions) { list.AddRange((IEnumerable<IDefinition<WardData>>)LoadWards(service, pluginDefinition.Key, pluginDefinition.Value.Configuration)); } return list; } private List<WardDefinition> LoadWards(IRegister<WardData> service, string key, IConfiguration pluginConfig) { List<WardDefinition> list = new List<WardDefinition>(); foreach (IConfigurationSection child in pluginConfig.GetSection("wards").GetChildren()) { WardDefinition wardDefinition = LoadWard(service, key, child); if (wardDefinition != null) { list.Add(wardDefinition); } } return list; } private WardDefinition? LoadWard(IRegister<WardData> service, string key, IConfiguration configuration) { string text = ParseExtensions.ParseString(configuration.GetSection("id")); if (text == null) { return null; } logger.Log((LogLevel)16, (object)("Loading Ward " + key + " " + text + " path: " + ConfigurationExtensions.GetPath(configuration) + "...")); string id = StringExtensions.GetId(key, "Ward", text); string text2 = "WardData_descriptionKey-" + id; string text3 = "WardData_titleKey-" + id; WardData wardData = new WardData(); LocalizationTerm val = ParseEnumExtensions.ParseLocalizationTerm(configuration.GetSection("descriptions")); if (val != null) { wardData.descriptionKey = text2; val.Key = text2; ((IRegisterableDictionary<LocalizationTerm>)(object)termRegister).Register(text2, val); } LocalizationTerm val2 = ParseEnumExtensions.ParseLocalizationTerm(configuration.GetSection("title")); if (val2 != null) { wardData.titleKey = text3; val2.Key = text3; ((IRegisterableDictionary<LocalizationTerm>)(object)termRegister).Register(text3, val2); } ((IRegisterableDictionary<WardData>)(object)service).Register(id, wardData); return new WardDefinition(key, wardData, configuration) { Id = text }; } } public class WardRegister : Dictionary<string, WardData>, IRegister<WardData>, IRegisterableDictionary<WardData>, IDictionary<string, WardData>, ICollection<KeyValuePair<string, WardData>>, IEnumerable<KeyValuePair<string, WardData>>, IEnumerable { private readonly IModLogger<WardRegister> logger; public WardRegister(IModLogger<WardRegister> logger) { this.logger = logger; } public void Register(string key, WardData item) { logger.Log((LogLevel)32, (object)("Register Ward (" + key + ")")); Add(key, item); } public List<string> GetAllIdentifiers(RegisterIdentifierType identifierType) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Invalid comparison between Unknown and I4 if ((int)identifierType != 0) { if ((int)identifierType == 1) { return base.Keys.ToList(); } return new List<string>(); } return base.Keys.ToList(); } public bool TryLookupIdentifier(string identifier, RegisterIdentifierType identifierType, [NotNullWhen(true)] out WardData? lookup, [NotNullWhen(true)] out bool? IsModded) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 lookup = null; IsModded = true; if ((int)identifierType != 0) { if ((int)identifierType == 1) { return TryGetValue(identifier, out lookup); } return false; } return TryGetValue(identifier, out lookup); } } public class WardState { public string titleKey { get; set; } = ""; public string descriptionKey { get; set; } = ""; public Sprite? iconSprite { get; set; } public IReadOnlyList<IRoomStateModifier> Modifiers { get; set; } = Array.Empty<IRoomStateModifier>(); public void Initialize(WardData data, SaveManager saveManager) { if (data == null) { return; } titleKey = data.titleKey ?? ""; descriptionKey = data.descriptionKey ?? ""; iconSprite = data.iconSprite; List<IRoomStateModifier> list = new List<IRoomStateModifier>(); if (data.roomModifierData != null) { foreach (RoomModifierData roomModifierDatum in data.roomModifierData) { object? obj = Activator.CreateInstance(TypeNameCache.GetType(roomModifierDatum.GetRoomStateModifierClassName())); IRoomStateModifier val = (IRoomStateModifier)((obj is IRoomStateModifier) ? obj : null); if (val != null) { val.Initialize(roomModifierDatum, saveManager); list.Add(val); } } } Modifiers = list; } } public class WardUI : MonoBehaviour { private const float FixedBufferWidth = 52f; private const float PipIndicatorWidth = 48f; private const float PipIndicatorBufferWidth = 52f; private WardManager? _manager; private static void Log(LogLevel level, string message) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Plugin.Logger.Log(level, (object)("[WardUI] " + message)); } public void SetManager(WardManager manager) { _manager = manager; Log((LogLevel)32, "SetManager called"); } public void SetupWardIcons(int roomIndex) { //IL_0028: 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_00c5: Expected O, but got Unknown //IL_00f9: 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_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) if (_manager == null) { Log((LogLevel)4, "SetupWardIcons skipped: manager null"); return; } foreach (Transform item in ((Component)this).transform) { Object.Destroy((Object)(object)((Component)item).gameObject); } IReadOnlyList<WardState> wards = _manager.GetWards(roomIndex); int num = 0; foreach (WardState item2 in wards) { if ((Object)(object)item2?.iconSprite == (Object)null) { Log((LogLevel)32, $"SetupWardIcons room {roomIndex}: skipping ward (iconSprite null, titleKey={item2?.titleKey})"); continue; } GameObject val = new GameObject { name = "Ward Icon" }; val.transform.SetParent(((Component)this).transform); val.AddComponent<CanvasRenderer>(); val.AddComponent<Image>().sprite = item2.iconSprite; val.transform.localPosition = Vector3.zero; RectTransform component = val.GetComponent<RectTransform>(); if ((Object)(object)component != (Object)null) { component.offsetMax = new Vector2(GetContainerWidth(num), component.offsetMax.y); component.sizeDelta = new Vector2(0.48f, 0.82f); } num++; if (!string.IsNullOrEmpty(item2.titleKey) || !string.IsNullOrEmpty(item2.descriptionKey)) { AddTooltip(val, item2.titleKey, item2.descriptionKey); } } Log((LogLevel)32, $"SetupWardIcons room {roomIndex}: showed {num} icon(s)"); } private static float GetContainerWidth(int count) { return 0f - (104f + 48f * (float)count + 52f * (float)(count - 1)); } private static void AddTooltip(GameObject go, string titleKey, string bodyKey) { LocalizedTooltipProvider val = go.AddComponent<LocalizedTooltipProvider>(); if (!((Object)(object)val == (Object)null)) { AccessTools.Field(typeof(LocalizedTooltipProvider), "tooltipTitleKey").SetValue(val, titleKey); AccessTools.Field(typeof(LocalizedTooltipProvider), "tooltipBodyKey").SetValue(val, bodyKey); } } } } namespace DiscipleClan.Plugin.StatusEffects { public class StatusEffectEmberboostState : StatusEffectState { [CompilerGenerated] private sealed class <OnTriggered>d__0 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ICoreGameManagers coreGameManagers; public InputTriggerParams inputTriggerParams; public StatusEffectEmberboostState <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OnTriggered>d__0(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { int num = <>1__state; StatusEffectEmberboostState statusEffectEmberboostState = <>4__this; if (num != 0) { return false; } <>1__state = -1; if (coreGameManagers == null || (Object)(object)inputTriggerParams.associatedCharacter == (Object)null) { return false; } string statusId = ((StatusEffectState)statusEffectEmberboostState).GetStatusId(); int statusEffectStacks = inputTriggerParams.associatedCharacter.GetStatusEffectStacks(statusId); if (statusEffectStacks <= 0) { return false; } RoomManager roomManager = coreGameManagers.GetRoomManager(); if ((Object)(object)roomManager != (Object)null) { try { RoomUI roomUI = roomManager.GetRoomUI(); if ((Object)(object)roomUI != (Object)null) { int currentRoomIndex = inputTriggerParams.associatedCharacter.GetCurrentRoomIndex(); roomUI.SetSelectedRoom(currentRoomIndex, false); } } catch { } } PlayerManager? playerManager = GetPlayerManager(coreGameManagers); if (playerManager != null) { playerManager.AddEnergy(statusEffectStacks, false); } inputTriggerParams.associatedCharacter.ShowNotification($"+{statusEffectStacks} [ember]", (Source)1, (RelicState)null); inputTriggerParams.associatedCharacter.RemoveStatusEffect(statusId, 1, 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(); } } [IteratorStateMachine(typeof(<OnTriggered>d__0))] protected override IEnumerator OnTriggered(InputTriggerParams inputTriggerParams, OutputTriggerParams outputTriggerParams, ICoreGameManagers coreGameManagers) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <OnTriggered>d__0(0) { <>4__this = this, inputTriggerParams = inputTriggerParams, coreGameManagers = coreGameManagers }; } private static PlayerManager? GetPlayerManager(ICoreGameManagers coreGameManagers) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown if (coreGameManagers == null) { return null; } MethodInfo method = ((object)coreGameManagers).GetType().GetMethod("GetPlayerManager", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { return (PlayerManager)method.Invoke(coreGameManagers, null); } return null; } } public class StatusEffectGravityState : StatusEffectState { [CompilerGenerated] private sealed class <OnTriggered>d__0 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ICoreGameManagers coreGameManagers; public InputTriggerParams inputTriggerParams; public StatusEffectGravityState <>4__this; private string <statusId>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OnTriggered>d__0(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <statusId>5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0091: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown int num = <>1__state; StatusEffectGravityState statusEffectGravityState = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; if (coreGameManagers == null || (Object)(object)inputTriggerParams.associatedCharacter == (Object)null) { return false; } <statusId>5__2 = ((StatusEffectState)statusEffectGravityState).GetStatusId(); if (inputTriggerParams.associatedCharacter.GetStatusEffectStacks(<statusId>5__2) <= 0) { return false; } RoomManager roomManager = coreGameManagers.GetRoomManager(); if ((Object)(object)roomManager == (Object)null) { return false; } if (!CanDescend(inputTriggerParams.associatedCharacter, roomManager)) { return false; } CardEffectParams val = new CardEffectParams { targets = new List<CharacterState> { inputTriggerParams.associatedCharacter }, selfTarget = inputTriggerParams.associatedCharacter, cardTriggeredCharacter = inputTriggerParams.associatedCharacter, selectedRoom = inputTriggerParams.associatedCharacter.GetCurrentRoomIndex() }; <>2__current = CardEffectBump.Bump((CardEffectState)null, val, coreGameManagers, -1, (SpawnPoint)null); <>1__state = 1; return true; } case 1: <>1__state = -1; inputTriggerParams.associatedCharacter.RemoveStatusEffect(<statusId>5__2, 1, 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(); } } [IteratorStateMachine(typeof(<OnTriggered>d__0))] protected override IEnumerator OnTriggered(InputTriggerParams inputTriggerParams, OutputTriggerParams outputTriggerParams, ICoreGameManagers coreGameManagers) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <OnTriggered>d__0(0) { <>4__this = this, inputTriggerParams = inputTriggerParams, coreGameManagers = coreGameManagers }; } private static bool CanDescend(CharacterState character, RoomManager roomManager) { int currentRoomIndex = character.GetCurrentRoomIndex(); if (currentRoomIndex <= 0) { return false; } RoomState room = roomManager.GetRoom(currentRoomIndex - 1); if ((Object)(object)room != (Object)null && !GameObjectUtil.IsDestroyedOrInactive((Component)(object)room)) { return room.IsRoomEnabled(); } return false; } } public class StatusEffectHideUntilBossState : StatusEffectState { private SaveManager? _saveManager; private CombatManager? _combatManager; public override void OnStacksAdded(CharacterState character, int numStacksAdded, AddStatusEffectParams addStatusEffectParams, ICoreGameManagers coreGameManagers) { SaveManager saveManager = coreGameManagers.GetSaveManager(); CombatManager combatManager = coreGameManagers.GetCombatManager(); if (!((Object)(object)saveManager == (Object)null) && coreGameManagers != null) { _saveManager = saveManager; _combatManager = combatManager; } } public override bool GetUnitIsTargetable(bool inCombat) { if (!inCombat) { return true; } if ((Object)(object)_combatManager == (Object)null || (Object)(object)_saveManager == (Object)null) { return true; } if (_combatManager.GetTurnCount() > 0) { return true; } return false; } } public class StatusEffectIcarianState : StatusEffectState { [CompilerGenerated] private sealed class <OnTriggered>d__0 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ICoreGameManagers coreGameManagers; public InputTriggerParams inputTriggerParams; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OnTriggered>d__0(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: 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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: { <>1__state = -1; if (coreGameManagers == null || (Object)(object)inputTriggerParams.associatedCharacter == (Object)null) { return false; } CharacterState associatedCharacter = inputTriggerParams.associatedCharacter; int currentRoomIndex = associatedCharacter.GetCurrentRoomIndex(); if (currentRoomIndex == 2 && associatedCharacter.GetStatusEffectStacks("gravity") > 0) { return false; } CombatManager combatManager = GetCombatManager(coreGameManagers); if ((Object)(object)combatManager != (Object)null) { HeroManager heroManager = GetHeroManager(combatManager); if ((Object)(object)heroManager != (Object)null) { List<CharacterState> charactersInRoom = GetCharactersInRoom(heroManager, currentRoomIndex); if (charactersInRoom != null) { foreach (CharacterState item in charactersInRoom) { if ((Object)(object)item != (Object)null && item.GetStatusEffectStacks("relentless") > 0) { return false; } } } } } if ((Object)(object)coreGameManagers.GetRoomManager() == (Object)null) { return false; } if (currentRoomIndex == 2) { associatedCharacter.Sacrifice((CardState)null, false, false, (CharacterState)null); return false; } CardEffectParams val = new CardEffectParams { targets = new List<CharacterState> { associatedCharacter }, selfTarget = associatedCharacter, cardTriggeredCharacter = associatedCharacter, selectedRoom = currentRoomIndex }; <>2__current = CardEffectBump.Bump((CardEffectState)null, val, coreGameManagers, 1, (SpawnPoint)null); <>1__state = 1; return true; } case 1: <>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(); } } [IteratorStateMachine(typeof(<OnTriggered>d__0))] protected override IEnumerator OnTriggered(InputTriggerParams inputTriggerParams, OutputTriggerParams outputTriggerParams, ICoreGameManagers coreGameManagers) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <OnTriggered>d__0(0) { inputTriggerParams = inputTriggerParams, coreGameManagers = coreGameManagers }; } private static CombatManager? GetCombatManager(ICoreGameManagers core) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown if (core == null) { return null; } return (CombatManager)(((object)core).GetType().GetMethod("GetCombatManager", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.Invoke(core, null)); } private static HeroManager? GetHeroManager(object combatManager) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown if (combatManager == null) { return null; } return (HeroManager)(combatManager.GetType().GetMethod("GetHeroManager", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.Invoke(combatManager, null)); } private static List<CharacterState> GetCharactersInRoom(HeroManager heroManager, int roomIndex) { List<CharacterState> list = new List<CharacterState>(); heroManager.AddCharactersInRoomToList(list, roomIndex); return list; } } public class StatusEffectPyreboostState : StatusEffectState { private int _lastBuff; public void OnPyreAttackChange(int pyreAttack, int pyreNumAttacks) { CharacterState associatedCharacter = ((StatusEffectState)this).GetAssociatedCharacter(); if (!((Object)(object)associatedCharacter == (Object)null) && !associatedCharacter.IsDead) { associatedCharacter.DebuffDamage(_lastBuff, (RelicState)null, true); int num = associatedCharacter.GetStatusEffectStacks(((StatusEffectState)this).GetStatusId()) * pyreAttack * pyreNumAttacks; associatedCharacter.BuffDamage(num, (RelicState)null, true); _lastBuff = num; } } public override void OnStacksAdded(CharacterState character, int numStacksAdded, AddStatusEffectParams addStatusEffectParams, ICoreGameManagers coreGameManagers) { if (!((Object)(object)character == (Object)null) && numStacksAdded > 0) { SaveManager saveManager = coreGameManagers.GetSaveManager(); if (!((Object)(object)saveManager == (Object)null)) { SubscribeToPyreAttackChanged(saveManager); int displayedPyreAttack = GetDisplayedPyreAttack(saveManager); int displayedPyreNumAttacks = GetDisplayedPyreNumAttacks(saveManager); OnPyreAttackChange(displayedPyreAttack, displayedPyreNumAttacks); } } } public override void OnStacksRemoved(CharacterState character, int numStacksRemoved, ICoreGameManagers coreGameManagers) { SaveManager saveManager = coreGameManagers.GetSaveManager(); if (!((Object)(object)saveManager == (Object)null)) { int displayedPyreAttack = GetDisplayedPyreAttack(saveManager); int displayedPyreNumAttacks = GetDisplayedPyreNumAttacks(saveManager); OnPyreAttackChange(displayedPyreAttack, displayedPyreNumAttacks); } } private void SubscribeToPyreAttackChanged(SaveManager saveManager) { if (!((Object)(object)saveManager == (Object)null)) { saveManager.pyreAttackChangedSignal.AddListener((Action<int, int>)OnPyreAttackChange); } } private static int GetDisplayedPyreAttack(SaveManager saveManager) { if ((Object)(object)saveManager == (Object)null) { return 0; } return saveManager.GetDisplayedPyreAttack(); } private static int GetDisplayedPyreNumAttacks(SaveManager saveManager) { if ((Object)(object)saveManager == (Object)null) { return 0; } return saveManager.GetDisplayedPyreNumAttacks(); } } } namespace DiscipleClan.Plugin.RoomModifiers { public sealed class RoomStateFriendlyDamageAdditionModifier : RoomStateModifierBase, IRoomStateDamageModifier, IRoomStateModifier, ILocalizationParamInt, ILocalizationParameterContext { private int damageAddition; public override void Initialize(RoomModifierData roomModifierData, SaveManager saveManager) { ((RoomStateModifierBase)this).Initialize(roomModifierData, saveManager); damageAddition = roomModifierData.GetParamInt(); } public int GetModifiedAttackDamage(Type damageType, CharacterState attackerState, bool requestingForCharacterStats, ICoreGameManagers coreGameManagers) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)attackerState.GetTeamType() == 2) { return attackerState.GetUnmodifiedAttackDamage(true) + damageAddition; } return 0; } public int GetModifiedMagicPowerDamage(ICoreGameManagers coreGameManagers) { return 0; } } public sealed class RoomStateFriendlyDamagePerCapacityModifier : RoomStateModifierBase, IRoomStateDamageModifier, IRoomStateModifier, ILocalizationParamInt, ILocalizationParameterContext { public int GetModifiedAttackDamage(Type damageType, CharacterState attackerState, bool requestingForCharacterStats, ICoreGameManagers coreGameManagers) { if (requestingForCharacterStats) { return ((RoomStateModifierBase)this).GetDynamicInt(attackerState); } return 0; } public override int GetDynamicInt(CharacterState characterContext) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) if ((int)characterContext.GetTeamType() == 2 && characterContext.GetSpawnPoint(false) != null) { RoomState currentRoom = characterContext.GetCurrentRoom(false); if ((Object)(object)currentRoom != (Object)null) { return currentRoom.GetCapacityInfo(characterContext.GetTeamType()).count * ((RoomStateModifierBase)this).GetParamInt(); } } return 0; } public int GetModifiedMagicPowerDamage(ICoreGameManagers coreGameManagers) { return 0; } } public sealed class RoomStateWardRandomDamageModifier : RoomStateModifierBase, IRoomStateModifier, ILocalizationParamInt, ILocalizationParameterContext { private readonly int _power; public RoomStateWardRandomDamageModifier(int power) { _power = power; } public void ApplyRandomDamage(RoomState room, ICoreGameManagers coreGameManagers) { if (!((Object)(object)room == (Object)null) && coreGameManagers != null) { _ = _power; _ = 0; } } } } namespace DiscipleClan.Plugin.RelicEffects { public class RelicEffectAddStatusOnMonsterAscend : RelicEffectBase, IRelicEffect { private List<StatusEffectStackData> _paramStatusEffects = new List<StatusEffectStackData>(); private bool _sourceTeamMonsters = true; public override void Initialize(RelicState relicState, RelicData relicData, RelicEffectData relicEffectData) { ((RelicEffectBase)this).Initialize(relicState, relicData, relicEffectData); if (relicEffectData != null) { _paramStatusEffects = GetParamStatusEffects(relicEffectData); _sourceTeamMonsters = GetSourceTeamMonsters(relicEffectData); } } public override PropDescriptions CreateEditorInspectorDescriptions() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown return new PropDescriptions(); } public void OnUnitAscended(CharacterState character, RelicManager relicManager) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Invalid comparison between Unknown and I4 if ((Object)(object)character == (Object)null || (Object)(object)relicManager == (Object)null || (_sourceTeamMonsters && (int)character.GetTeamType() != 2) || _paramStatusEffects == null || _paramStatusEffects.Count == 0) { return; } foreach (StatusEffectStackData paramStatusEffect in _paramStatusEffects) { if (paramStatusEffect.statusId != null && paramStatusEffect.count > 0) { character.AddStatusEffect(paramStatusEffect.statusId, paramStatusEffect.count, (CharacterState)null, true, false); } } } public IReadOnlyList<StatusEffectStackData> GetParamStatusEffects() { return _paramStatusEffects; } public bool GetSourceTeamMonsters() { return _sourceTeamMonsters; } private static List<StatusEffectStackData> GetParamStatusEffects(RelicEffectData data) { List<StatusEffectStackData> list = new List<StatusEffectStackData>(); if (data == null) { return list; } try { if ((((object)data).GetType().GetProperty("param_status_effects") ?? ((object)data).GetType().GetProperty("ParamStatusEffects"))?.GetValue(data) is IEnumerable enumerable) { foreach (object item2 in enumerable) { if (item2 is StatusEffectStackData item) { list.Add(item); } else if (item2 != null) { string text = (item2.GetType().GetProperty("status")?.GetValue(item2) as string) ?? (item2.GetType().GetProperty("statusId")?.GetValue(item2) as string); int count = 1; if (item2.GetType().GetProperty("count")?.GetValue(item2) is int num) { count = num; } if (text != null) { list.Add(new StatusEffectStackData { statusId = text, count = count }); } } } } } catch { } return list; } private static bool GetSourceTeamMonsters(RelicEffectData data) { if (data == null) { return true; } try { return !((((object)data).GetType().GetProperty("source_team") ?? ((object)data).GetType().GetProperty("SourceTeam"))?.GetValue(data) is string text) || text == "monsters"; } catch { return true; } } } public struct StatusEffectStackData { public string statusId; public int count; } public class RelicEffectRewind : RelicEffectBase, ICardPlayedRelicEffect, IRelicEffect, ITurnPhaseStartOfPlayerTurnAfterDrawRelicEffect, ITurnPhaseTimingRelicEffect { [CompilerGenerated] private sealed class <ApplyEffect>d__5 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public RelicEffectParams relicEffectParams; private CardState <cardToReturn>5__2; private CardManager <cardManager>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ApplyEffect>d__5(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <cardToReturn>5__2 = null; <cardManager>5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (_firstSpellPlayedThisTurn == null) { return false; } <cardToReturn>5__2 = _firstSpellPlayedThisTurn; _firstSpellPlayedThisTurn = null; <cardManager>5__3 = GetCardManagerFromSaveManager(relicEffectParams.saveManager); if ((Object)(object)<cardManager>5__3 == (Object)null) { return false; } <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 1; return true; case 1: <>1__state = -1; if (<cardManager>5__3.GetDiscardPile(false).Contains(<cardToReturn>5__2)) { <cardManager>5__3.DrawSpecificCard(<cardToReturn>5__2, false, (DrawSource)1, <cardToReturn>5__2, <cardManager>5__3.GetHand(false).Count, 1); <cardManager>5__3.GetDiscardPile(false).Remove(<cardToReturn>5__2); } 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 <ApplyEffectOnCardPlayed>d__8 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ApplyEffectOnCardPlayed>d__8(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>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 <ApplyEffectTurnPhaseTiming>d__10 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ApplyEffectTurnPhaseTiming>d__10(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; _firstSpellPlayedThisTurn = null; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <OnCardPlayed>d__4 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CardPlayedRelicEffectParams relicEffectParams; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OnCardPlayed>d__4(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Invalid comparison between Unknown and I4 if (<>1__state != 0) { return false; } <>1__state = -1; if (_firstSpellPlayedThisTurn != null) { return false; } CardState cardState = relicEffectParams.cardState; if (cardState == null || (int)cardState.GetCardType() != 0) { return false; } if ((int)cardState.GetDiscardEffectWhenPlayed(((RelicEffectParams)relicEffectParams).relicManager, (Type)null) != 1) { return false; } foreach (CardTraitState traitState in cardState.GetTraitStates()) { CardTraitExhaustState val = (CardTraitExhaustState)(object)((traitState is CardTraitExhaustState) ? traitState : null); if (val != null && val.WillExhaustOnNextPlay(cardState, ((RelicEffectParams)relicEffectParams).relicManager)) { return false; } } _firstSpellPlayedThisTurn = cardState; 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 static CardState? _firstSpellPlayedThisTurn; public override void Initialize(RelicState relicState, RelicData relicData, RelicEffectData relicEffectData) { ((RelicEffectBase)this).Initialize(relicState, relicData, relicEffectData); } public override PropDescriptions CreateEditorInspectorDescriptions() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown return new PropDescriptions(); } public bool TestCardPlayed(CardPlayedRelicEffectParams relicEffectParams) { return true; } [IteratorStateMachine(typeof(<OnCardPlayed>d__4))] public IEnumerator OnCardPlayed(CardPlayedRelicEffectParams relicEffectParams) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <OnCardPlayed>d__4(0) { relicEffectParams = relicEffectParams }; } [IteratorStateMachine(typeof(<ApplyEffect>d__5))] public IEnumerator ApplyEffect(RelicEffectParams relicEffectParams) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ApplyEffect>d__5(0) { relicEffectParams = relicEffectParams }; } private static CardManager? GetCardManagerFromSaveManager(SaveManager saveManager) { if ((Object)(object)saveManager == (Object)null) { return null; } object? obj = typeof(SaveManager).GetField("cardManager", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(saveManager); return (CardManager?)((obj is CardManager) ? obj : null); } public bool TestEffectOnCardPlayed(CardPlayedRelicEffectParams relicEffectParams, ICoreGameManagers coreGameManagers) { return true; } [IteratorStateMachine(typeof(<ApplyEffectOnCardPlayed>d__8))] public IEnumerator ApplyEffectOnCardPlayed(CardPlayedRelicEffectParams relicEffectParams, ICoreGameManagers coreGameManagers) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ApplyEffectOnCardPlayed>d__8(0); } public bool TestEffectTurnPhaseTiming(RelicEffectParams relicEffectParams, ICoreGameManagers coreGameManagers) { return true; } [IteratorStateMachine(typeof(<ApplyEffectTurnPhaseTiming>d__10))] public IEnumerator ApplyEffectTurnPhaseTiming(RelicEffectParams relicEffectParams, ICoreGameManagers coreGameManagers) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ApplyEffectTurnPhaseTiming>d__10(0); } } } namespace DiscipleClan.Plugin.Patches { public static class WardRoomModifierPatchHelper { public static readonly Type[] ElementTypes = new Type[20] { typeof(IRoomStateSpawnModifier), typeof(IRoomStateDuplicateUnitModifier), typeof(IRoomStateSpawnPointsChangedModifier), typeof(IRoomStatePostCombatModifier), typeof(IRoomStatePreCombatModifier), typeof(IRoomStatePyreStatsModifier), typeof(IRoomStateUnitOrderPossiblyChangedModifier), typeof(IRoomStateCostModifier), typeof(IRoomStateDamageModifier), typeof(IRoomStateEmberForCostStatModifier), typeof(IRoomStateEnergyModifier), typeof(IRoomStateForgePointsForCostStatModifier), typeof(IRoomStateMoonPhaseOverrideModifier), typeof(IRoomStateStatusEffectStackModifier), typeof(IRoomStateStatusEffectModifier), typeof(IRoomStateTriggerCountModifier), typeof(IRoomStateOnStatusEffectAppliedModifier), typeof(IRoomStateOnCharacterTriggerModifier), typeof(IRoomStateCardManagerModifier), typeof(IRoomStateRoomSelectedModifier) }; public static MethodBase GetClosedGeneric(Type elementType) { return (from m in typeof(RoomState).GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) where m.Name == "GetRoomStateModifiersFromTrainRoomAttachments" && m.IsGenericMethodDefinition && m.GetParameters().Length == 1 && m.GetParameters()[0].ParameterType == typeof(Type) select m).Single().MakeGenericMethod(elementType); } public static IEnumerable<T>? MergeWardModifiers<T>(RoomState room, IEnumerable<T> original) where T : class { if ((Object)(object)room == (Object)null || original == null) { return null; } Container container = Railend.GetContainer(); WardManager wardManager = ((container != null) ? container.GetInstance<WardManager>() : null); if (wardManager == null) { return null; } IEnumerable<IRoomStateModifier> modifiersForRoom = wardManager.GetModifiersForRoom(room.GetRoomIndex()); if (modifiersForRoom == null) { return null; } List<T> list = modifiersForRoom.OfType<T>().ToList(); if (list.Count == 0) { return null; } return original.Concat(list); } } [HarmonyPatch] public static class GetRoomStateModifiersFromTrainRoomAttachmentsPatch { private static MethodBase TargetMethod() { return (from m in typeof(RoomState).GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) where m.Name == "GetRoomStateModifiersFromTrainRoomAttachments" && !m.IsGenericMethodDefinition && m.GetParameters().Length == 1 && m.GetParameters()[0].ParameterType == typeof(Type) select m).Single(); } private static void Postfix(RoomState __instance, ref IEnumerable __result, MethodBase __originalMethod) { if ((Object)(object)__instance == (Object)null || __result == null || __originalMethod == null || __originalMethod.IsGenericMethod) { return; } Container container = Railend.GetContainer(); WardManager wardManager = ((container != null) ? container.GetInstance<WardManager>() : null); if (wardManager != null) { IEnumerable<IRoomStateModifier> modifiersForRoom = wardManager.GetModifiersForRoom(__instance.GetRoomIndex()); if (modifiersForRoom != null) { IEnumerable<IRoomStateModifier> first = __result.Cast<IRoomStateModifier>(); __result = first.Concat(modifiersForRoom); } } } } [HarmonyPatch(typeof(CharacterState), "GetMovementSpeed")] public static class GravityGetMovementSpeedPatch { private static void Postfix(ref int __result, CharacterState __instance) { if (!((Object)(object)__instance == (Object)null)) { string gravityStatusId = GetGravityStatusId(__instance); if (!string.IsNullOrEmpty(gravityStatusId) && __instance.GetStatusEffectStacks(gravityStatusId) > 0 && !__instance.IsMiniboss() && !__instance.IsOuterTrainBoss()) { __result = 0; __instance.RemoveStatusEffect(gravityStatusId, 1, true); } } } private static string? GetGravityStatusId(CharacterState character) { List<StatusEffectStack> list = new List<StatusEffectStack>(); character.GetStatusEffects(ref list, false); foreach (StatusEffectStack item in list) { if (item.State is StatusEffectGravityState) { return item.State.GetStatusId(); } } return null; } } [HarmonyPatch(typeof(PlayerManager), "AddEnergy")] public static class OnGainEmberPatch { public static Dictionary<CharacterState, int> EnergyData { get; } = new Dictionary<CharacterState, int>(); private static void Postfix(PlayerManager __instance, int addEnergy, bool suppressSignal = false) { //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown if ((Object)(object)__instance == (Object)null || addEnergy <= 0) { return; } SaveManager saveManager = GetSaveManager(__instance); if ((Object)(object)saveManager == (Object)null) { return; } CombatManager combatManager = GetCombatManager(saveManager); RoomManager roomManager = saveManager.GetRoomManager(); if ((Object)(object)combatManager == (Object)null || (Object)(object)roomManager == (Object)null) { return; } EnergyData.Clear(); for (int num = roomManager.GetNumRooms() - 1; num >= 0; num--) { RoomState room = roomManager.GetRoom(num); if (!((Object)(object)room == (Object)null) && !GameObjectUtil.IsDestroyedOrInactive((Component)(object)room)) { List<CharacterState> list = new List<CharacterState>(); room.AddCharactersToList(list, (Type)2, false, true); room.AddCharactersToList(list, (Type)1, false, true); foreach (CharacterState item in list) { if (!((Object)(object)item == (Object)null)) { EnergyData[item] = addEnergy; combatManager.QueueTrigger(item, CharacterTriggers.OnGainEmber, (CharacterState)null, true, true, new FireTriggersData { paramInt = addEnergy }, 1, (CharacterTriggerState)null); } } } } } private static SaveManager? GetSaveManager(PlayerManager instance) { if ((Object)(object)instance == (Object)null) { return null; } object? obj = ((object)instance).GetType().GetField("saveManager", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(instance); return (SaveManager?)((obj is SaveManager) ? obj : null); } private static CombatManager? GetCombatManager(SaveManager saveManager) { if ((Object)(object)saveManager == (Object)null) { return null; } object? obj = ((object)saveManager).GetType().GetField("combatManager", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(saveManager); return (CombatManager?)((obj is CombatManager) ? obj : null); } } [HarmonyPatch(typeof(CharacterState), "MoveUpDownTrain")] public static class OnRelocatePatch { private static void Postfix(CharacterState __instance, SpawnPoint destinationSpawnPoint, int delayIndex, int prevRoomIndex) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown RoomState val = ((destinationSpawnPoint != null) ? destinationSpawnPoint.GetRoomOwner() : null) ?? null; if ((Object)(object)__instance == (Object)null || (Object)(object)val == (Object)null) { return; } CombatManager combatManager = GetCombatManager(__instance); if (!((Object)(object)combatManager == (Object)null)) { int num = val.GetRoomIndex() - prevRoomIndex; if (num != 0) { combatManager.QueueTrigger(__instance, CharacterTriggers.OnRelocate, (CharacterState)null, true, true, new FireTriggersData { paramInt = num }, 1, (CharacterTriggerState)null); } } } private static CombatManager? GetCombatManager(CharacterState character) { object obj = typeof(CharacterState).GetField("allGameManagers", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(character); if (obj == null) { return null; } object obj2 = obj.GetType().GetMethod("GetCoreManagers", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.Invoke(obj, null); if (obj2 == null) { return null; } object? obj3 = obj2.GetType().GetMethod("GetCombatManager", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.Invoke(obj2, null); return (CombatManager?)((obj3 is CombatManager) ? obj3 : null); } } } namespace DiscipleClan.Plugin.CardTraits { public class CardTraitApplyStatusToPlayedUnits : CardTraitState { [CompilerGenerated] private sealed class <OnCardDiscarded>d__6 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ICoreGameManagers coreGameManagers; public CardTraitApplyStatusToPlayedUnits <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OnCardDiscarded>d__6(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { int num = <>1__state; CardTraitApplyStatusToPlayedUnits cardTraitApplyStatusToPlayedUnits = <>4__this; if (num != 0) { return false; } <>1__state = -1; foreach (CardState allCard in coreGameManagers.GetCardManager().GetAllCards(new List<CardState>())) { if (allCard.IsMonsterCard()) { CardStateModifiers temporaryCardStateModifiers = allCard.GetTemporaryCardStateModifiers(); if (temporaryCardStateModifiers.HasUpgrade(cardTraitApplyStatusToPlayedUnits.Upgrade)) { temporaryCardStateModifiers.RemoveUpgrade(cardTraitApplyStatusToPlayedUnits.Upgrade); } } } 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 static CardUpgradeState? _upgrade; public CardUpgradeState Upgrade { get { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown if (_upgrade == null) { CardUpgradeData val = ScriptableObject.CreateInstance<CardUpgradeData>(); ((Object)val).name = ((CardTraitState)this).GetTraitStateName() + "Upgrade"; StatusEffectStackData[] paramStatusEffects = ((CardTraitState)this).GetParamStatusEffects(); AccessTools.Field(typeof(CardUpgradeData), "statusEffectUpgrades").SetValue(val, paramStatusEffects); _upgrade = new CardUpgradeState(); _upgrade.Setup(val, false, false); } return _upgrade; } set { _upgrade = value; } } public override PropDescriptions CreateEditorInspectorDescriptions() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown return new PropDescriptions(); } public override void OnCardDrawn(CardState thisCard, ICoreGameManagers coreGameManagers) { foreach (CardState allCard in coreGameManagers.GetCardManager().GetAllCards(new List<CardState>())) { if (allCard.IsMonsterCard()) { CardStateModifiers temporaryCardStateModifiers = allCard.GetTemporaryCardStateModifiers(); if (!temporaryCardStateModifiers.HasUpgrade(Upgrade)) { temporaryCardStateModifiers.AddUpgrade(Upgrade, (CardStateModifiers)null); } } } } [IteratorStateMachine(typeof(<OnCardDiscarded>d__6))] public override IEnumerator OnCardDiscarded(DiscardCardParams discardCardParams, ICoreGameManagers coreGameManagers) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <OnCardDiscarded>d__6(0) { <>4__this = this, coreGameManagers = coreGameManagers }; } } public class CardTraitPyreboost : CardTraitState { public override PropDescriptions CreateEditorInspectorDescriptions() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown return new PropDescriptions(); } public override int OnApplyingDamage(ApplyingDamageParameters damageParams, ICoreGameManagers coreGameManagers) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) SaveManager saveManager = coreGameManagers.GetSaveManager(); int displayedPyreAttack = saveManager.GetDisplayedPyreAttack(); int displayedPyreNumAttacks = saveManager.GetDisplayedPyreNumAttacks(); Plugin.Logger.LogInfo((object)$"Pyre attack: {displayedPyreAttack}, Pyre num attacks: {displayedPyreNumAttacks}, Param int: {((CardTraitState)this).GetParamInt()}"); return damageParams.damage + displayedPyreAttack * displayedPyreNumAttacks * ((CardTraitState)this).GetParamInt(); } public override string GetCardTooltipText() { return ((CardTraitState)this).LocalizeTraitKey("ReplacementStringsData_replacement-DiscipleClan.Plugin_CardTraitPyreboost_TooltipText"); } public override string GetCardTooltipId() { return ((CardTraitState)this).LocalizeTraitKey("ReplacementStringsData_replacement-DiscipleClan.Plugin_CardTraitPyreboost"); } public override string GetCardText() { return ((CardTraitState)this).LocalizeTraitKey("ReplacementStringsData_replacement-DiscipleClan.Plugin_CardTraitPyreboost_CardText"); } } } namespace DiscipleClan.Plugin.CardEffects { public class CardEffectAddClassStatus : CardEffectBase { [CompilerGenerated] private sealed class <ApplyEffect>d__18 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ICoreGameManagers coreGameManagers; public CardEffectParams cardEffectParams; public CardEffectState cardEffectState; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ApplyEffect>d__18(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; if (coreGameManagers == null || cardEffectParams?.targets == null || cardEffectParams.targets.Count == 0) { return false; } SaveManager saveManager = coreGameManagers.GetSaveManager(); StatusEffectStackData statusEffectStack = GetStatusEffectStack(cardEffectState, saveManager); if (statusEffectStack == null) { return false; } if (statusEffectStack.statusId == "burnout") { CharacterState val = cardEffectParams.targets[0]; if ((Object)(object)val != (Object)null && (val.IsMiniboss() || val.IsOuterTrainBoss())) { return false; } } foreach (CharacterState target in cardEffectParams.targets) { if ((Object)(object)target != (Object)null && statusEffectStack.count > 0) { target.AddStatusEffect(statusEffectStack.statusId, statusEffectStack.count, (CharacterState)null, true, false); } } 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 ClanDisciple = "DiscipleClan"; private const string ClanHellhorned = "Hellhorned"; private const string ClanAwoken = "Awoken"; private const string ClanStygian = "Stygian"; private const string ClanUmbra = "Umbra"; private const string ClanMeltingRemnant = "MeltingRemnant"; private const string StatusRage = "rage"; private const string StatusArmor = "armor"; private const string StatusSpikes = "spikes"; private const string StatusRegen = "regen"; private const string StatusSpellWeakness = "spellweakness"; private const string StatusFrostbite = "frostbite"; private const string StatusDamageShield = "damageshield"; private const string StatusLifesteal = "lifesteal"; private const string StatusBurnout = "burnout"; private const string StatusStealth = "stealth"; private const string StatusGravity = "gravity"; public override PropDescriptions CreateEditorInspectorDescriptions() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown return new PropDescriptions(); } [IteratorStateMachine(typeof(<ApplyEffect>d__18))] public override IEnumerator ApplyEffect(CardEffectState cardEffectState, CardEffectParams cardEffectParams, ICoreGameManagers coreGameManagers, ISystemManagers sysManagers) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ApplyEffect>d__18(0) { cardEffectState = cardEffectState, cardEffectParams = cardEffectParams, coreGameManagers = coreGameManagers }; } public override bool TestEffect(CardEffectState cardEffectState, CardEffectParams cardEffectParams, ICoreGameManagers coreGameManagers) { if (cardEffectParams?.targets == null || cardEffectParams.targets.Count <= 0) { return false; } SaveManager saveManager = coreGameManagers.GetSaveManager(); StatusEffectStackData statusEffectStack = GetStatusEffectStack(cardEffectState, saveManager); if (statusEffectStack == null) { return false; } StatusEffectStackData val = statusEffectStack; if (val.statusId == "burnout" && (cardEffectParams.targets[0].IsMiniboss() || cardEffectParams.targets[0].IsOuterTrainBoss())) { return false; } if (coreGameManagers.GetStatusEffectManager().GetStatusEffectDataById(val.statusId, true).IsStackable()) { return true; } foreach (CharacterState target in cardEffectParams.targets) { if ((Object)(object)target != (Object)null && !target.HasStatusEffect(val.statusId)) { return true; } } return false; } private static StatusEffectStackData? GetStatusEffectStack(CardEffectState cardEffectState, SaveManager saveManager) { //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Expected O, but got Unknown ClassData mainClass = saveManager.GetMainClass(); ClassData subClass = saveManager.GetSubClass(); int mainChampionIndex = saveManager.GetMainChampionIndex(); int subChampionIndex = saveManager.GetSubChampionIndex(); ClassData val = null; bool flag; if (((GameData)mainClass).GetID() == "DiscipleClan") { val = subClass; flag = subChampionIndex != 0; } else { val = mainClass; flag = mainChampionIndex != 0; } int paramInt = cardEffectState.GetParamInt(); string statusId; int num; switch (((GameData)val).GetID()) { case "Hellhorned": statusId = (flag ? "armor" : "rage"); num = (flag ? (paramInt * 2) : paramInt); break; case "Awoken": statusId = (flag ? "regen" : "spikes"); num = paramInt; break; case "Stygian": statusId = (flag ? "frostbite" : "spellweakness"); num = (flag ? paramInt : (paramInt / 2)); break; case "Umbra": statusId = (flag ? "lifesteal" : "damageshield"); num = paramInt / 2; break; case "MeltingRemnant": statusId = (flag ? "stealth" : "burnout"); num = (flag ? (paramInt / 2) : (paramInt + 1)); break; default: statusId = "gravity"; num = Math.Max(0, paramInt / 2); break; } if (num <= 0) { return null; } return new StatusEffectStackData { statusId = statusId, count = num }; } } public class CardEffectAddStatusEffectPerAppliedStatus : CardEffectAddStatusEffect { [CompilerGenerated] private sealed class <ApplyEffect>d__1 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CardEffectParams cardEffectParams; public CardEffectState cardEffectState; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ApplyEffect>d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; if (cardEffectParams?.targets == null || cardEffectParams.targets.Count == 0) { return false; } CharacterState cardTriggeredCharacter = cardEffectParams.cardTriggeredCharacter; if ((Object)(object)cardTriggeredCharacter == (Object)null) { return false; } if (!TryGetLastStatusEffectKeyValuePair(cardTriggeredCharacter, out string statusId, out int count)) { return false; } if (string.IsNullOrEmpty(statusId)) { return false; } int num = (int)(cardEffectState.GetParamMultiplier() * (float)count); foreach (CharacterState target in cardEffectParams.targets) { target.AddStatusEffect(statusId, num, (CharacterState)null, true, false); } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public override PropDescriptions CreateEditorInspectorDescriptions() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown return new PropDescriptions(); } [IteratorStateMachine(typeof(<ApplyEffect>d__1))] public override IEnumerator ApplyEffect(CardEffectState cardEffectState, CardEffectParams cardEffectParams, ICoreGameManagers coreGameManagers, ISystemManagers sysManagers) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ApplyEffect>d__1(0) { cardEffectState = cardEffectState, cardEffectParams = cardEffectParams }; } private static bool TryGetLastStatusEffectKeyValuePair(CharacterState character, out string? statusId, out int count) { statusId = null; count = 0; try { object propOrField = GetPropOrField(character, ((object)character).GetType(), "PrimaryStateInformation"); if (!(((propOrField != null) ? GetPropOrField(propOrField, propOrField.GetType(), "statusEffects") : null) is IEnumerable<KeyValuePair<string, StatusEffectStack>> source)) { return false; } KeyValuePair<string, StatusEffectStack> keyValuePair = source.LastOrDefault(); if (keyValuePair.Key == null) { return false; } statusId = keyValuePair.Key; count = keyValuePair.Value.Count; return true; } catch { return false; } } private static object? GetPropOrField(object obj, Type type, string name) { object obj2 = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(obj); if (obj2 == null) { FieldInfo? field = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if ((object)field == null) { return null; } obj2 = field.GetValue(obj); } return obj2; } } public class CardEffectAddTempCardUpgradeToParentCard : CardEffectBase { [CompilerGenerated] private sealed class <ApplyEffect>d__5 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CardEffectState cardEffectState; public ICoreGameManagers coreGameManagers; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ApplyEffect>d__5(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown if (<>1__state != 0) { return false; } <>1__state = -1; CardState parentCardState = cardEffectState.GetParentCardState(); if (parentCardState == null) { return false; } CardUpgradeData paramCardUpgradeData = cardEffectState.GetParamCardUpgradeData(); if ((Object)(object)paramCardUpgradeData == (Object)null) { return false; } CardUpgradeState val = new CardUpgradeState(); val.Setup(paramCardUpgradeData, false, false); List<CardUpgradeMaskData> filters = val.GetFilters(); RelicManager relicManager = coreGameManagers.GetRelicManager(); if (filters.Count > 0) { foreach (CardUpgradeMaskData item in filters) { if (item.FilterCard<CardState>(parentCardState, relicManager)) { return false; } } } parentCardState.GetTemporaryCardStateModifiers().AddUpgrade(val, (CardStateModifiers)null); parentCardState.UpdateCardBodyText((SaveManager)null); coreGameManagers.GetCardManager().RefreshCardInHand(parentCardState, true, false, false); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public override bool CanPlayAfterBossDead => false; public override bool CanApplyInPreviewMode => false; public override PropDescriptions CreateEditorInspectorDescriptions() { //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) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0025: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown PropDescriptions val = new PropDescriptions { }; string fieldName; ((Dictionary<string, PropDescription>)val)[fieldName] = new PropDescription("Card Upgrade", "", (Type)null, false); return val; } [IteratorStateMachine(typeof(<ApplyEffect>d__5))] public override IEnumerator ApplyEffect(CardEffectState cardEffectState, CardEffectParams cardEffectParams, ICoreGameManagers coreGameManagers, ISystemManagers sysManagers) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ApplyEffect>d__5(0) { cardEffectState = cardEffectState, coreGameManagers = coreGameManagers }; } } public class CardEffectAddWard : CardEffectBase { [CompilerGenerated] private sealed class <ApplyEffect>d__2 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ICoreGameManagers coreGameManagers; public CardEffectParams cardEffectParams; public CardEffectState cardEffectState; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ApplyEffect>d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; if (coreGameManagers == null || cardEffectParams == null) { Log((LogLevel)4, "ApplyEffect skipped: coreGameManagers or cardEffectParams null"); return false; } string paramStr = cardEffectState.GetParamStr(); if (string.IsNullOrEmpty(paramStr)) { Log((LogLevel)4, "ApplyEffect skipped: param_str (ward ID) null or empty"); return false; } Container container = Railend.GetContainer(); WardRegister instance = container.GetInstance<WardRegister>(); WardManager instance2 = container.GetInstance<WardManager>(); if (instance == null || instance2 == null) { Log((LogLevel)4, "ApplyEffect skipped: WardRegister or WardManager null (wardId=" + paramStr + ")"); return false; } string text = StringExtensions.ToId(paramStr, "DiscipleClan.Plugin", "Ward"); WardData wardData = default(WardData); bool? flag = default(bool?); if (!RegisterExtensions.TryLookupId<WardData>((IRegister<WardData>)(object)instance, text, ref wardData, ref flag, (IConfigurationSection)null) || wardData == null) { Log((LogLevel)4, "ApplyEffect skipped: ward not found lookupId=" + text + " (param_str=" + paramStr + ")"); return false; } int selectedRoom = cardEffectParams.selectedRoom; if (selectedRoom < 0) { Log((LogLevel)4, $"ApplyEffect skipped: selectedRoom={selectedRoom} (wardId={paramStr})"); return false; } WardState wardState = new WardState(); SaveManager saveManager = coreGameManagers.GetSaveManager(); wardState.Initialize(wardData, saveManager); bool paramBool = cardEffectState.GetParamBool(); if (paramBool) { instance2.AddWardLater(wardState, selectedRoom); } else { instance2.AddWard(wardState, selectedRoom); } Log((LogLevel)16, $"ApplyEffect: wardId={paramStr} roomIndex={selectedRoom} addLater={paramBool}"); 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 static void Log(LogLevel level, string message) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Plugin.Logger.Log(level, (object)("[CardEffectAddWard] " + message)); } public override PropDescriptions CreateEditorInspectorDescriptions() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown return new PropDescriptions(); } [IteratorStateMachine(typeof(<ApplyEffect>d__2))] public override IEnumerator ApplyEffect(CardEffectState cardEffectState, CardEffectParams cardEffectParams, ICoreGameManagers coreGameManagers, ISystemManagers sysManagers) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ApplyEffect>d__2(0) { cardEffectState = cardEffectState, cardEffectParams = cardEffectParams, coreGameManagers = coreGameManagers }; } public override bool TestEffect(CardEffectState cardEffectState, CardEffectParams cardEffectParams, ICoreGameManagers coreGameManagers) { if (cardEffectParams == null) { Log((LogLevel)32, "TestEffect: false (cardEffectParams null)"); return false; } string paramStr = cardEffectState.GetParamStr(); if (string.IsNullOrEmpty(paramStr)) { Log((LogLevel)32, "TestEffect: false (ward ID null or empty)"); return false; } Container container = Railend.GetContainer(); WardRegister instance = container.GetInstance<WardRegister>(); if (instance == null) { Log((LogLevel)4, "TestEffect: false (WardRegister null, wardId=" + paramStr + ")"); return false; } string text = StringExtensions.ToId(paramStr, "DiscipleClan.Plugin", "Ward"); WardData wardData = default(WardData); bool? flag = default(bool?); if (!RegisterExtensions.TryLookupId<WardData>((IRegister<WardData>)(object)instance, text, ref wardData, ref flag, (IConfigurationSection)null) || wardData == null) { Log((LogLevel)32, "TestEffect: false (ward not found lookupId=" + text + ")"); return false; } if (cardEffectParams.selectedRoom < 0) { Log((LogLevel)32, $"TestEffect: false (selectedRoom={cardEffectParams.selectedRoom})"); return false; } WardManager instance2 = container.GetInstance<WardManager>(); if (instance2 == null) { Log((LogLevel)4, "TestEffect: false (WardManager null, wardId=" + paramStr + ")"); return false; } int count = instance2.GetWards(cardEffectParams.selectedRoom).Count; bool flag2 = count < 4; Log((LogLevel)32, $"TestEffect: wardId={paramStr} room={cardEffectParams.selectedRoom} count={count} => {flag2}"); return flag2; } } public class CardEffectChooseDraw : CardEffectBase { [CompilerGenerated] private sealed class <>c__DisplayClass2_0 { public CardEffectState cardEffectState; public CardManager cardManager; public CardEffectParams cardEffectParams; public ScreenManager screenManager; public CardStateChosenDelegate <>9__1; internal void <ApplyEffect>b__0(IScreen screen) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_0075: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_0094: Expected O, but got Unknown DeckScreen val = (DeckScreen)(object)((screen is DeckScreen) ? screen : null); if ((Object)(object)val == (Object)null) { return; } Params val2 = new Params { mode = (Mode)9, targetMode = cardEffectState.GetTargetMode(), showCancel = false }; CardState parentCardState = cardEffectState.GetParentCardState(); val2.titleKey = ((parentCardState != null) ? parentCardState.GetTitleKey() : null); val2.instructionsKey = "SeekCopyInstructions"; val2.numCardsSelectable = cardEffectState.GetParamInt(); val.Setup(val2); CardStateChosenDelegate obj = <>9__1; if (obj == null) { CardStateChosenDelegate val3 = delegate(CardState chosenCardState) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) cardManager.DrawSpecificCard(chosenCardState, false, GetDrawSource(cardEffectState.GetTargetMode()), cardEffectParams.playedCard, 1, 1); screenManager.SetScreenActive((ScreenName)3, false, (ScreenActiveCallback)null); }; CardStateChosenDelegate val4 = val3; <>9__1 = val3; obj = val4; } val.AddDeckScreenCardStateChosenDelegate(obj); } internal void <ApplyEffect>b__1(CardState chosenCardState) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) cardManager.DrawSpecificCard(chosenCardState, false, GetDrawSource(cardEffectState.GetTargetMode()), cardEffectParams.playedCard, 1, 1); screenManager.SetScreenActive((ScreenName)3, false, (ScreenActiveCallback)null); } } [CompilerGenerated] private sealed class <ApplyEffect>d__2 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CardEffectState cardEffectState; public CardEffectParams cardEffectParams; public ICoreGameManagers coreGameManagers; public ISystemManagers sysManagers; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ApplyEffect>d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown if (<>1__state != 0) { return false; } <>1__state = -1; <>c__DisplayClass2_0 CS$<>8__locals0 = new <>c__DisplayClass2_0 { cardEffectState = cardEffectState, cardEffectParams = cardEffectParams, cardManager = coreGameManagers.GetCardManager() }; List<CardState> drawPile = CS$<>8__locals0.cardManager.GetDrawPile(false); if (drawPile != null && drawPile.Count == 0) { List<CardState> discardPile = CS$<>8__locals0.cardManager.GetDiscardPile(false); if (discardPile == null || discardPile.Count <= 0) { return false; } CS$<>8__locals0.cardManager.ShuffleDeck(false); } drawPile = CS$<>8__locals0.cardManager.GetDrawPile(false); if (drawPile == null || drawPile.Count == 0) { return false; } CS$<>8__locals0.screenManager = sysManagers.GetScreenManager(); CS$<>8__locals0.screenManager.SetScreenActive((ScreenName)3, true, (ScreenActiveCallback)delegate(IScreen screen) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_0075: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_0094: Expected O, but got Unknown DeckScreen val = (DeckScreen)(object)((screen is DeckScreen) ? screen : null); if (!((Object)(object)val == (Object)null)) { Params val2 = new Params { mode = (Mode)9, targetMode = CS$<>8__locals0.cardEffectState.GetTargetMode(), showCancel = false }; CardState parentCardState = CS$<>8__locals0.cardEffectState.GetParentCardState(); val2.titleKey = ((parentCardState != null) ? parentCardState.GetTitleKey() : null); val2.instructionsKey = "SeekCopyInstructions"; val2.numCardsSelectable = CS$<>8__locals0.cardEffectState.GetParamInt(); val.Setup(val2); CardStateChosenDelegate obj = CS$<>8__locals0.<>9__1; if (obj == null) { CardStateChosenDelegate val3 = delegate(CardState chosenCardState) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) CS$<>8__locals0.cardManager.DrawSpecificCard(chosenCardState, false, GetDrawSource(CS$<>8__locals0.cardEffectState.GetTargetMode()), CS$<>8__locals0.cardEffectParams.playedCard, 1, 1); CS$<>8__locals0.screenManager.SetScreenActive((ScreenName)3, false, (ScreenActiveCallback)null); }; CardStateChosenDelegate val4 = val3; CS$<>8__locals0.<>9__1 = val3; obj = val4; } val.AddDeckScreenCardStateChosenDelegate(obj); } }); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public override PropDescriptions CreateEditorInspectorDescriptions() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown return new PropDescriptions(); } public override bool TestEffect(CardEffectState cardEffectState, CardEffectParams cardEffectParams, ICoreGameManagers coreGameManagers) { CardManager cardManager = coreGameManagers.GetCardManager(); if ((Object)(object)cardManager == (Object)null) { return false; } List<CardState> drawPile = cardManager.GetDrawPile(false); if (drawPile == null || drawPile.Count == 0) { List<CardState> discardPile = cardManager.GetDiscardPile(false); if (discardPile == null || discardPile.Count == 0) { return false; } } return true; } [IteratorStateMachine(typeof(<ApplyEffect>d__2))] public override IEnumerator ApplyEffect(CardEffectState cardEffectState, CardEffectParams cardEffectParams, ICoreGameManagers coreGameManagers, ISystemManagers sysManagers) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ApplyEffect>d__2(0) { cardEffectState = cardEffectState, cardEffectParams = cardEffectParams, coreGameManagers = coreGameManagers, sysManagers = sysManagers